@sheetxl/io-xlsx 0.8.0-beta.9 → 1.0.0
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/LICENSE.md +8 -7
- package/browser/esm/7rZlWcm56hn3Jmnk.mjs +7021 -0
- package/browser/esm/AZus_5slvoIVhf1u.mjs +10323 -0
- package/browser/esm/B9QfzGvsvg-V3utu.mjs +4632 -0
- package/browser/esm/{C-2KaUyV4gs-sDTZ.mjs → BIR_Si489gIkGOnc.mjs} +194 -144
- package/browser/esm/{DsSIg46AR7IFBN5N.mjs → BJFvc-i40R4rPZ5y.mjs} +939 -804
- package/browser/esm/{D-epcZSoKLbsAIaC.mjs → BX8Ebx4NC5zp7_3J.mjs} +3 -3
- package/browser/esm/{CxtFawTfwRTCC4Xr.mjs → Bnxw38IvtA04zXEE.mjs} +2 -2
- package/browser/esm/CfVhYH77KdrR3fEK.mjs +24 -0
- package/browser/esm/index.mjs +3 -4
- package/browser/esm/jIQks3Crw6jehdDU.mjs +2474 -0
- package/browser/esm/{CRrTMRdN_IcSA_pm.mjs → qc9hnuR2z-whY8YO.mjs} +3 -3
- package/browser/esm/wZGpmkMUubNjClhG.mjs +104 -0
- package/licenses/dependencies.txt +2 -2
- package/node/esm/{BsTMtvwpQoPNv95M.mjs → BNLHWJHyy5eB0P_4.mjs} +2 -2
- package/node/esm/CVtsY2F9A9NzEGLk.mjs +2478 -0
- package/node/esm/CoeQ0LO-nNXiowwv.mjs +7284 -0
- package/node/esm/CxY3iIYLXVhCebeV.mjs +4746 -0
- package/node/esm/D2CZy9TQM9h2uqBh.mjs +2562 -0
- package/node/esm/{BCr4lCI6qQXXN0K1.mjs → Dm0hvKcR4xb0TV_N.mjs} +3 -3
- package/node/esm/_IA1gQ-zFQYQSZSs.mjs +6957 -0
- package/node/esm/index.mjs +65 -28
- package/node/esm/{CBtj0-a4l2qux2hA.mjs → zZFe3mW0xjmobowq.mjs} +3 -3
- package/package.json +9 -10
- package/types/src/AutoFilterRules.d.ts +34 -44
- package/types/src/ConditionalFormatRules.d.ts +2 -2
- package/types/src/DataTableFormula.d.ts +26 -0
- package/types/src/DataValidationRules.d.ts +0 -5
- package/types/src/DefinedNameAttributes.d.ts +8 -0
- package/types/src/ExcelCalcStamp.d.ts +0 -36
- package/types/src/ExcelCompat.d.ts +15 -143
- package/types/src/ExcelFunctionFacts.d.ts +0 -272
- package/types/src/ExcelReservedNames.d.ts +0 -65
- package/types/src/KnownFonts.d.ts +37 -0
- package/types/src/LegacyFormula.d.ts +1 -46
- package/types/src/OOXMLExtensions.d.ts +24 -2
- package/types/src/PageLayoutAttributes.d.ts +8 -0
- package/types/src/Plugin.d.ts +15 -3
- package/types/src/ProtectionAttributes.d.ts +2 -2
- package/types/src/SheetKinds.d.ts +42 -0
- package/types/src/SheetViewAttributes.d.ts +4 -0
- package/types/src/SortExtent.d.ts +16 -0
- package/types/src/SourcePackage.d.ts +0 -44
- package/types/src/SparklineGroups.d.ts +52 -0
- package/types/src/Types.d.ts +13 -3
- package/types/src/XlsxHeader.d.ts +19 -0
- package/types/src/chart/ChartExXml.d.ts +38 -0
- package/types/src/chart/ChartPartXml.d.ts +47 -0
- package/types/src/chart/ChartSpaceXml.d.ts +37 -0
- package/types/src/chart/_XmlTree.d.ts +34 -0
- package/types/src/chart/_chartCodecs.d.ts +12 -0
- package/types/src/chart/_chartExCodecs.d.ts +7 -0
- package/types/src/chart/_chartExFold.d.ts +14 -0
- package/types/src/chart/_chartExMarkup.d.ts +236 -0
- package/types/src/chart/_chartExStyle.d.ts +13 -0
- package/types/src/chart/_codec.d.ts +78 -0
- package/types/src/chart/_drawingml.d.ts +10 -0
- package/types/src/chart/_xml.d.ts +70 -0
- package/types/src/pivot/PivotArea.d.ts +20 -0
- package/types/src/pivot/PivotCacheRead.d.ts +30 -0
- package/types/src/pivot/PivotCacheWrite.d.ts +23 -0
- package/types/src/pivot/PivotFilters.d.ts +29 -0
- package/types/src/pivot/PivotFormats.d.ts +60 -0
- package/types/src/pivot/PivotTableRead.d.ts +44 -0
- package/types/src/pivot/PivotTableWrite.d.ts +13 -0
- package/types/src/pivot/_PivotCacheXml.d.ts +48 -0
- package/types/src/pivot/_PivotTableXml.d.ts +23 -0
- package/types/src/reader/CellControls.d.ts +18 -0
- package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
- package/types/src/reader/DummyFunctionUnwrap.d.ts +43 -23
- package/types/src/reader/HeaderStyles.d.ts +15 -0
- package/types/src/reader/IsoDateCell.d.ts +20 -0
- package/types/src/reader/LibreOfficeDataTable.d.ts +12 -0
- package/types/src/reader/PivotButtons.d.ts +14 -0
- package/types/src/reader/PivotCellFormats.d.ts +22 -0
- package/types/src/reader/SlicerJoin.d.ts +26 -0
- package/types/src/reader/ZipReader.d.ts +1 -1
- package/types/src/reader/_SlicerRecord.d.ts +59 -0
- package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
- package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
- package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +3 -11
- package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +8 -1
- package/types/src/reader/domVisitors/CommentVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +13 -6
- package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
- package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +10 -7
- package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +22 -13
- package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +5 -5
- package/types/src/reader/domVisitors/DrawingVisitor.d.ts +4 -2
- package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +1 -11
- package/types/src/reader/domVisitors/FeaturePropertyBagVisitor.d.ts +18 -0
- package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +0 -11
- package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
- package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
- package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +26 -5
- package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +11 -2
- package/types/src/reader/domVisitors/SlicersVisitor.d.ts +9 -3
- package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/TimelinesVisitor.d.ts +13 -0
- package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
- package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
- package/types/src/reader/domVisitors/index.d.ts +6 -34
- package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
- package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +31 -6
- package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +26 -8
- package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
- package/types/src/richValue/IRichValueHandler.d.ts +109 -0
- package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
- package/types/src/richValue/RichDataParts.d.ts +69 -0
- package/types/src/richValue/RichRecordWriter.d.ts +61 -0
- package/types/src/richValue/RichValueHandlers.d.ts +25 -0
- package/types/src/richValue/RichValueResolver.d.ts +54 -0
- package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
- package/types/src/richValue/index.d.ts +7 -0
- package/types/src/utils/DrawingMLText.d.ts +2 -2
- package/types/src/utils/FormControls.d.ts +79 -6
- package/types/src/utils/SharedNames.d.ts +13 -0
- package/types/src/utils/SpreadsheetFont.d.ts +38 -0
- package/types/src/utils/VmlNoteShapes.d.ts +25 -32
- package/types/src/utils/VmlNoteStyle.d.ts +25 -0
- package/types/src/utils/VmlPrefixes.d.ts +24 -0
- package/types/src/vba/VBAProject.d.ts +0 -19
- package/types/src/writer/EvaluationSheet.d.ts +5 -0
- package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
- package/types/src/writer/builder/PackageBuilder.d.ts +2 -41
- package/types/src/writer/builder/Types.d.ts +18 -28
- package/types/src/writer/emitters/CommentsEmitter.d.ts +3 -3
- package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
- package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
- package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
- package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
- package/types/src/writer/emitters/PivotTableEmitter.d.ts +30 -1
- package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
- package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
- package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
- package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
- package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
- package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
- package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
- package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
- package/types/src/writer/emitters/SlicerEmitter.d.ts +132 -0
- package/types/src/writer/emitters/StylesEmitter.d.ts +35 -2
- package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
- package/types/src/writer/emitters/WorkbookEmitter.d.ts +24 -2
- package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
- package/types/src/writer/utils/AutoFilter.d.ts +3 -3
- package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
- package/types/src/writer/utils/DateSystem.d.ts +6 -0
- package/types/src/writer/utils/DefaultRows.d.ts +22 -0
- package/types/src/writer/utils/DrawMLUtils.d.ts +8 -6
- package/types/src/writer/utils/DummyFunction.d.ts +0 -25
- package/types/src/writer/utils/DxfCollector.d.ts +14 -11
- package/types/src/writer/utils/PrstGeomUtils.d.ts +11 -3
- package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
- package/types/src/writer/utils/SheetStyleLayout.d.ts +86 -0
- package/types/src/writer/utils/TextUtils.d.ts +6 -1
- package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
- package/types/src/writer/utils/XfVariants.d.ts +61 -0
- package/browser/cjs/B0Ugu_crqQYpdfQz.cjs +0 -1
- package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
- package/browser/cjs/BHM3_D9PsNURVAVy.cjs +0 -1
- package/browser/cjs/BHWdwAQ322YA8JAZ.cjs +0 -6
- package/browser/cjs/CeuX8p1aBuKTuagi.cjs +0 -2
- package/browser/cjs/D3EWCPfCu-qMOIGd.cjs +0 -1
- package/browser/cjs/DSM4q1dhVVXvsgby.cjs +0 -30
- package/browser/cjs/DiAHwNv2I8RHE9GY.cjs +0 -1
- package/browser/cjs/index.cjs +0 -1
- package/browser/cjs/wrpXlaSBGEicQf6_.cjs +0 -6
- package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
- package/browser/esm/Bu64BYvRAlVftMr1.mjs +0 -67
- package/browser/esm/CWt4fDYEbj2hvsl_.mjs +0 -3346
- package/browser/esm/Ccnxz-y2WBEgfvvh.mjs +0 -6498
- package/browser/esm/Dx64JMAGwNNDBkC1.mjs +0 -4928
- package/browser/esm/Sv4twwEJDb9dZ91h.mjs +0 -149
- package/node/esm/BPn5XBizKkwaUqXB.mjs +0 -4285
- package/node/esm/BVV11IlqF6Lmlv8D.mjs +0 -154
- package/node/esm/BiJEEgltJzx94zIR.mjs +0 -3433
- package/node/esm/CkmZuMvRTpva7eQu.mjs +0 -5074
- package/node/esm/j0RE2usgdljRw_gr.mjs +0 -2345
- package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
- package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
- package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
- package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
- package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
- package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
- package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
- package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
- package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
- package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
- package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
- package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
- package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
- package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
- package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
- package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
- package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
- package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
- package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
- package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
- package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
- package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
- package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
- package/types/src/writer/utils/HiddenFormulaXfs.d.ts +0 -28
|
@@ -1,3433 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.9
|
|
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 { At as t, Bt as e, Ct as s, Dt as o, Et as r, Ft as i, Gt as n, Ht as a, It as c, J as l, K as h, Lt as u, Nt as d, Pt as p, Rt as f, Ut as g, Vt as m, W as x, Y as y, _ as b, bt as T, et as v, ft as w, i as S, it as C, o as A, ot as E, p as P, pt as O, rt as I, s as D, ut as _, vt as V, wt as L, xt as N, yt as $, zt as R } from "./BPn5XBizKkwaUqXB.mjs";
|
|
8
|
-
import { a as B, c as j, i as M, l as H, n as F, o as W, r as z, s as X, t as q } from "./BVV11IlqF6Lmlv8D.mjs";
|
|
9
|
-
import { BufferUtils as U, CommonUtils as G, ExpectedError as K } from "@sheetxl/utils";
|
|
10
|
-
import { AddressUtils as J, CommonUtils as Z, CoordUtils as Q, FormulaError as Y, ICondition as tt, IConditionalFormat as et, IRange as st, OutOfBoundsError as ot, PersonCollection as rt, ResourceCollection as it, Theme as nt, Tuple as at, Workbook as ct } from "@sheetxl/sdk";
|
|
11
|
-
import { BlobReader as lt, Uint8ArrayReader as ht, Uint8ArrayWriter as ut, ZipReader as dt } from "@zip.js/zip.js";
|
|
12
|
-
var pt = /* @__PURE__ */ new Uint8Array(0), ft = class t {
|
|
13
|
-
constructor(t, e, s) {
|
|
14
|
-
this.buffers = /* @__PURE__ */ new Map(), this.zip = t, this.entries = e, this.rawBuffer = s;
|
|
15
|
-
}
|
|
16
|
-
static normalize(t) {
|
|
17
|
-
return t.startsWith("/") ? t.slice(1) : t;
|
|
18
|
-
}
|
|
19
|
-
static async create(e) {
|
|
20
|
-
const s = e instanceof Blob ? pt : e instanceof Uint8Array ? e : new Uint8Array(e), o = new dt(e instanceof Blob ? new lt(e) : new ht(s)), r = /* @__PURE__ */ new Map();
|
|
21
|
-
for (const t of await o.getEntries()) t.directory || r.set(t.filename, t);
|
|
22
|
-
return new t(o, r, s);
|
|
23
|
-
}
|
|
24
|
-
getNames() {
|
|
25
|
-
return [...this.entries.keys()];
|
|
26
|
-
}
|
|
27
|
-
has(e) {
|
|
28
|
-
return this.entries.has(t.normalize(e));
|
|
29
|
-
}
|
|
30
|
-
uncompressedSize(e) {
|
|
31
|
-
return this.entries.get(t.normalize(e))?.uncompressedSize ?? 0;
|
|
32
|
-
}
|
|
33
|
-
async getBuffer(e) {
|
|
34
|
-
const s = t.normalize(e), o = this.buffers.get(s);
|
|
35
|
-
if (o) return o;
|
|
36
|
-
const r = this.entries.get(s);
|
|
37
|
-
if (!r) return null;
|
|
38
|
-
const i = await r.getData(new ut());
|
|
39
|
-
return this.buffers.set(s, i), i;
|
|
40
|
-
}
|
|
41
|
-
async prefetch(t) {
|
|
42
|
-
const e = [];
|
|
43
|
-
for (const [s, o] of this.entries) !this.buffers.has(s) && t(s, o) && e.push(o.getData(new ut()).then((t) => {
|
|
44
|
-
this.buffers.set(s, t);
|
|
45
|
-
}));
|
|
46
|
-
await Promise.all(e);
|
|
47
|
-
}
|
|
48
|
-
getEntry(e) {
|
|
49
|
-
return this.buffers.get(t.normalize(e)) ?? null;
|
|
50
|
-
}
|
|
51
|
-
async getTextStream(e, s) {
|
|
52
|
-
const o = this.entries.get(t.normalize(e));
|
|
53
|
-
if (!o) return null;
|
|
54
|
-
const r = new TransformStream();
|
|
55
|
-
o.getData(r.writable).catch(() => {});
|
|
56
|
-
const i = r.readable.getReader(), n = new TextDecoder("utf-8");
|
|
57
|
-
return new ReadableStream({ async pull(t) {
|
|
58
|
-
const { value: e, done: o } = await i.read();
|
|
59
|
-
if (o) {
|
|
60
|
-
const e = n.decode();
|
|
61
|
-
e && t.enqueue(e), t.close();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
s?.(e.byteLength);
|
|
65
|
-
const r = n.decode(e, { stream: !0 });
|
|
66
|
-
r && t.enqueue(r);
|
|
67
|
-
} }).getReader();
|
|
68
|
-
}
|
|
69
|
-
getRawEntry(e) {
|
|
70
|
-
const s = this.entries.get(t.normalize(e));
|
|
71
|
-
if (!s || s.encrypted) return null;
|
|
72
|
-
const o = s.offset;
|
|
73
|
-
if (o + 30 > this.rawBuffer.byteLength) return null;
|
|
74
|
-
const r = new DataView(this.rawBuffer.buffer, this.rawBuffer.byteOffset + o, 30);
|
|
75
|
-
if (67324752 !== r.getUint32(0, !0)) return null;
|
|
76
|
-
const i = o + 30 + r.getUint16(26, !0) + r.getUint16(28, !0), n = i + s.compressedSize;
|
|
77
|
-
return n > this.rawBuffer.byteLength ? null : {
|
|
78
|
-
data: this.rawBuffer.subarray(i, n),
|
|
79
|
-
compressionMethod: s.compressionMethod,
|
|
80
|
-
signature: s.signature
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async close() {
|
|
84
|
-
await this.zip.close();
|
|
85
|
-
}
|
|
86
|
-
}, gt = class {
|
|
87
|
-
constructor(t) {
|
|
88
|
-
this._sink = t, this._samples = [], this._t0 = mt(), this._tPrev = this._t0, this._heapPrev = xt();
|
|
89
|
-
}
|
|
90
|
-
mark(t) {
|
|
91
|
-
const e = mt(), s = xt(), o = {
|
|
92
|
-
label: t,
|
|
93
|
-
tMs: e - this._t0,
|
|
94
|
-
dtMs: e - this._tPrev,
|
|
95
|
-
heapBytes: s,
|
|
96
|
-
dHeapBytes: void 0 !== s && void 0 !== this._heapPrev ? s - this._heapPrev : void 0,
|
|
97
|
-
rssBytes: yt()
|
|
98
|
-
};
|
|
99
|
-
this._tPrev = e, this._heapPrev = s, this._samples.push(o), this._sink?.(o);
|
|
100
|
-
}
|
|
101
|
-
samples() {
|
|
102
|
-
return this._samples;
|
|
103
|
-
}
|
|
104
|
-
toTable() {
|
|
105
|
-
return this._samples.map((t) => ({
|
|
106
|
-
phase: t.label,
|
|
107
|
-
tMs: Math.round(t.tMs),
|
|
108
|
-
dtMs: Math.round(t.dtMs),
|
|
109
|
-
heapMB: void 0 !== t.heapBytes ? bt(t.heapBytes / 1048576) : "—",
|
|
110
|
-
dHeapMB: void 0 !== t.dHeapBytes ? bt(t.dHeapBytes / 1048576) : "—",
|
|
111
|
-
rssMB: void 0 !== t.rssBytes ? bt(t.rssBytes / 1048576) : "—"
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
}, mt = "object" == typeof performance && "function" == typeof performance.now ? () => performance.now() : () => Date.now();
|
|
115
|
-
function xt() {
|
|
116
|
-
const t = "object" == typeof performance ? performance.memory : void 0;
|
|
117
|
-
if (t && "number" == typeof t.usedJSHeapSize) return t.usedJSHeapSize;
|
|
118
|
-
const e = globalThis.process;
|
|
119
|
-
return "object" == typeof e && "function" == typeof e.memoryUsage ? e.memoryUsage().heapUsed : void 0;
|
|
120
|
-
}
|
|
121
|
-
function yt() {
|
|
122
|
-
const t = globalThis.process;
|
|
123
|
-
if ("object" == typeof t && "function" == typeof t.memoryUsage) return t.memoryUsage().rss;
|
|
124
|
-
}
|
|
125
|
-
function bt(t) {
|
|
126
|
-
return Math.round(10 * t) / 10;
|
|
127
|
-
}
|
|
128
|
-
var Tt = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", vt = `-${Tt}.0-9·̀-ͯ‿-⁀`, wt = (new RegExp(`^[${Tt}]$`, "u"), new RegExp(`^[${vt}]$`, "u"), new RegExp(`^[${Tt}][${vt}]*$`, "u")), St = (new RegExp(`^[${vt}]+$`, "u"), [
|
|
129
|
-
32,
|
|
130
|
-
10,
|
|
131
|
-
13,
|
|
132
|
-
9
|
|
133
|
-
]);
|
|
134
|
-
function Ct(t) {
|
|
135
|
-
return t >= 65 && t <= 90 || t >= 97 && t <= 122 || 58 === t || 95 === t || 8204 === t || 8205 === t || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
|
|
136
|
-
}
|
|
137
|
-
var kt = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", At = `-${kt}.0-9·̀-ͯ‿-⁀`;
|
|
138
|
-
new RegExp(`^[${kt}]$`, "u"), new RegExp(`^[${At}]$`, "u"), new RegExp(`^[${kt}][${At}]*$`, "u"), new RegExp(`^[${At}]+$`, "u");
|
|
139
|
-
var Et = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", Pt = `-${Et}.0-9·̀-ͯ‿-⁀`, Ot = (new RegExp(`^[${Et}]$`, "u"), new RegExp(`^[${Pt}]$`, "u"), new RegExp(`^[${Et}][${Pt}]*$`, "u"));
|
|
140
|
-
function It(t) {
|
|
141
|
-
return t >= 65 && t <= 90 || 95 === t || t >= 97 && t <= 122 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
|
|
142
|
-
}
|
|
143
|
-
var Dt = function(t) {
|
|
144
|
-
return 32 === t || 10 === t || 13 === t || 9 === t;
|
|
145
|
-
}, _t = function(t) {
|
|
146
|
-
return t >= 32 && t <= 55295 || 10 === t || 13 === t || 9 === t || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
|
|
147
|
-
}, Vt = Ct, Lt = function(t) {
|
|
148
|
-
return Ct(t) || t >= 48 && t <= 57 || 45 === t || 46 === t || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
|
|
149
|
-
}, Nt = St, $t = wt, Rt = function(t) {
|
|
150
|
-
return t >= 1 && t <= 55295 || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
|
|
151
|
-
}, Bt = It, jt = function(t) {
|
|
152
|
-
return It(t) || 45 === t || 46 === t || t >= 48 && t <= 57 || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
|
|
153
|
-
}, Mt = Ot, Ht = "http://www.w3.org/XML/1998/namespace", Ft = "http://www.w3.org/2000/xmlns/", Wt = {
|
|
154
|
-
__proto__: null,
|
|
155
|
-
xml: Ht,
|
|
156
|
-
xmlns: Ft
|
|
157
|
-
}, zt = {
|
|
158
|
-
__proto__: null,
|
|
159
|
-
amp: "&",
|
|
160
|
-
gt: ">",
|
|
161
|
-
lt: "<",
|
|
162
|
-
quot: "\"",
|
|
163
|
-
apos: "'"
|
|
164
|
-
}, Xt = -1, qt = -2, Ut = 13, Gt = 33, Kt = 10, Jt = 60, Zt = 61, Qt = 62, Yt = 63, te = 93, ee = (t) => 34 === t || 39 === t, se = [34, 39], oe = [
|
|
165
|
-
...se,
|
|
166
|
-
91,
|
|
167
|
-
Qt
|
|
168
|
-
], re = [
|
|
169
|
-
...se,
|
|
170
|
-
Jt,
|
|
171
|
-
te
|
|
172
|
-
], ie = [
|
|
173
|
-
Zt,
|
|
174
|
-
Yt,
|
|
175
|
-
...Nt
|
|
176
|
-
], ne = [
|
|
177
|
-
...Nt,
|
|
178
|
-
Qt,
|
|
179
|
-
38,
|
|
180
|
-
Jt
|
|
181
|
-
];
|
|
182
|
-
function ae(t, e, s) {
|
|
183
|
-
switch (e) {
|
|
184
|
-
case "xml":
|
|
185
|
-
s !== Ht && t.fail(`xml prefix must be bound to ${Ht}.`);
|
|
186
|
-
break;
|
|
187
|
-
case "xmlns": s !== Ft && t.fail(`xmlns prefix must be bound to ${Ft}.`);
|
|
188
|
-
}
|
|
189
|
-
switch (s) {
|
|
190
|
-
case Ft:
|
|
191
|
-
t.fail("" === e ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${Ft}.`);
|
|
192
|
-
break;
|
|
193
|
-
case Ht: switch (e) {
|
|
194
|
-
case "xml": break;
|
|
195
|
-
case "":
|
|
196
|
-
t.fail(`the default namespace may not be set to ${s}.`);
|
|
197
|
-
break;
|
|
198
|
-
default: t.fail("may not assign the xml namespace to another prefix.");
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
var ce, le = (t) => Mt.test(t), he = (t) => $t.test(t), ue = {
|
|
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
|
-
}, de = class {
|
|
217
|
-
get closed() {
|
|
218
|
-
return this._closed;
|
|
219
|
-
}
|
|
220
|
-
constructor(t) {
|
|
221
|
-
this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment;
|
|
222
|
-
const e = this.xmlnsOpt = !!this.opt.xmlns;
|
|
223
|
-
if (this.trackPosition = !1 !== this.opt.position, this.fileName = this.opt.fileName, e) {
|
|
224
|
-
this.nameStartCheck = Bt, this.nameCheck = jt, this.isName = le, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = {
|
|
225
|
-
__proto__: null,
|
|
226
|
-
...Wt
|
|
227
|
-
};
|
|
228
|
-
const t = this.opt.additionalNamespaces;
|
|
229
|
-
null != t && (function(t, e) {
|
|
230
|
-
for (const s of Object.keys(e)) ae(t, s, e[s]);
|
|
231
|
-
}(this, t), Object.assign(this.ns, t));
|
|
232
|
-
} else this.nameStartCheck = Vt, this.nameCheck = Lt, this.isName = he, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
|
|
233
|
-
this.stateTable = [
|
|
234
|
-
this.sBegin,
|
|
235
|
-
this.sBeginWhitespace,
|
|
236
|
-
this.sDoctype,
|
|
237
|
-
this.sDoctypeQuote,
|
|
238
|
-
this.sDTD,
|
|
239
|
-
this.sDTDQuoted,
|
|
240
|
-
this.sDTDOpenWaka,
|
|
241
|
-
this.sDTDOpenWakaBang,
|
|
242
|
-
this.sDTDComment,
|
|
243
|
-
this.sDTDCommentEnding,
|
|
244
|
-
this.sDTDCommentEnded,
|
|
245
|
-
this.sDTDPI,
|
|
246
|
-
this.sDTDPIEnding,
|
|
247
|
-
this.sText,
|
|
248
|
-
this.sEntity,
|
|
249
|
-
this.sOpenWaka,
|
|
250
|
-
this.sOpenWakaBang,
|
|
251
|
-
this.sComment,
|
|
252
|
-
this.sCommentEnding,
|
|
253
|
-
this.sCommentEnded,
|
|
254
|
-
this.sCData,
|
|
255
|
-
this.sCDataEnding,
|
|
256
|
-
this.sCDataEnding2,
|
|
257
|
-
this.sPIFirstChar,
|
|
258
|
-
this.sPIRest,
|
|
259
|
-
this.sPIBody,
|
|
260
|
-
this.sPIEnding,
|
|
261
|
-
this.sXMLDeclNameStart,
|
|
262
|
-
this.sXMLDeclName,
|
|
263
|
-
this.sXMLDeclEq,
|
|
264
|
-
this.sXMLDeclValueStart,
|
|
265
|
-
this.sXMLDeclValue,
|
|
266
|
-
this.sXMLDeclSeparator,
|
|
267
|
-
this.sXMLDeclEnding,
|
|
268
|
-
this.sOpenTag,
|
|
269
|
-
this.sOpenTagSlash,
|
|
270
|
-
this.sAttrib,
|
|
271
|
-
this.sAttribName,
|
|
272
|
-
this.sAttribNameSawWhite,
|
|
273
|
-
this.sAttribValue,
|
|
274
|
-
this.sAttribValueQuoted,
|
|
275
|
-
this.sAttribValueClosed,
|
|
276
|
-
this.sAttribValueUnquoted,
|
|
277
|
-
this.sCloseTag,
|
|
278
|
-
this.sCloseTagSawWhite
|
|
279
|
-
], this._init();
|
|
280
|
-
}
|
|
281
|
-
_init() {
|
|
282
|
-
this.openWakaBang = "", this.text = "", this.name = "", this.piTarget = "", this.entity = "", this.q = null, this.tags = [], this.tag = null, this.topNS = null, this.chunk = "", this.chunkPosition = 0, this.i = 0, this.prevI = 0, this.carriedFromPrevious = void 0, this.forbiddenState = 0, this.attribList = [];
|
|
283
|
-
const { fragmentOpt: t } = this;
|
|
284
|
-
this.state = t ? Ut : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
|
|
285
|
-
let { defaultXMLVersion: e } = this.opt;
|
|
286
|
-
if (void 0 === e) {
|
|
287
|
-
if (!0 === this.opt.forceXMLVersion) throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
|
|
288
|
-
e = "1.0";
|
|
289
|
-
}
|
|
290
|
-
this.setXMLVersion(e), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = {
|
|
291
|
-
version: void 0,
|
|
292
|
-
encoding: void 0,
|
|
293
|
-
standalone: void 0
|
|
294
|
-
}, this.line = 1, this.column = 0, this.ENTITIES = Object.create(zt), this.readyHandler?.();
|
|
295
|
-
}
|
|
296
|
-
get position() {
|
|
297
|
-
return this.chunkPosition + this.i;
|
|
298
|
-
}
|
|
299
|
-
get columnIndex() {
|
|
300
|
-
return this.position - this.positionAtNewLine;
|
|
301
|
-
}
|
|
302
|
-
on(t, e) {
|
|
303
|
-
this[ue[t]] = e;
|
|
304
|
-
}
|
|
305
|
-
off(t) {
|
|
306
|
-
this[ue[t]] = void 0;
|
|
307
|
-
}
|
|
308
|
-
makeError(t) {
|
|
309
|
-
let e = this.fileName ?? "";
|
|
310
|
-
return this.trackPosition && (e.length > 0 && (e += ":"), e += `${this.line}:${this.column}`), e.length > 0 && (e += ": "), new Error(e + t);
|
|
311
|
-
}
|
|
312
|
-
fail(t) {
|
|
313
|
-
const e = this.makeError(t), s = this.errorHandler;
|
|
314
|
-
if (void 0 === s) throw e;
|
|
315
|
-
return s(e), this;
|
|
316
|
-
}
|
|
317
|
-
write(t) {
|
|
318
|
-
if (this.closed) return this.fail("cannot write after close.");
|
|
319
|
-
let e = !1;
|
|
320
|
-
null === t ? (e = !0, t = "") : "object" == typeof t && (t = t.toString()), void 0 !== this.carriedFromPrevious && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0);
|
|
321
|
-
let s = t.length;
|
|
322
|
-
const o = t.charCodeAt(s - 1);
|
|
323
|
-
!e && (13 === o || o >= 55296 && o <= 56319) && (this.carriedFromPrevious = t[s - 1], s--, t = t.slice(0, s));
|
|
324
|
-
const { stateTable: r } = this;
|
|
325
|
-
for (this.chunk = t, this.i = 0; this.i < s;) r[this.state].call(this);
|
|
326
|
-
return this.chunkPosition += s, e ? this.end() : this;
|
|
327
|
-
}
|
|
328
|
-
close() {
|
|
329
|
-
return this.write(null);
|
|
330
|
-
}
|
|
331
|
-
getCode10() {
|
|
332
|
-
const t = this.chunk, e = this.i;
|
|
333
|
-
if (this.prevI = e, this.i++, e >= t.length) return Xt;
|
|
334
|
-
const s = t.charCodeAt(e);
|
|
335
|
-
if (this.column++, s < 55296) {
|
|
336
|
-
if (s >= 32 || 9 === s) return s;
|
|
337
|
-
switch (s) {
|
|
338
|
-
case Kt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Kt;
|
|
339
|
-
case 13: return t.charCodeAt(e + 1) === Kt && (this.i = e + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, qt;
|
|
340
|
-
default: return this.fail("disallowed character."), s;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (s > 56319) return s >= 57344 && s <= 65533 || this.fail("disallowed character."), s;
|
|
344
|
-
const o = 65536 + 1024 * (s - 55296) + (t.charCodeAt(e + 1) - 56320);
|
|
345
|
-
return this.i = e + 2, o > 1114111 && this.fail("disallowed character."), o;
|
|
346
|
-
}
|
|
347
|
-
getCode11() {
|
|
348
|
-
const { chunk: t, i: e } = this;
|
|
349
|
-
if (this.prevI = e, this.i = e + 1, e >= t.length) return Xt;
|
|
350
|
-
const s = t.charCodeAt(e);
|
|
351
|
-
if (this.column++, s < 55296) {
|
|
352
|
-
if (s > 31 && s < 127 || s > 159 && 8232 !== s || 9 === s) return s;
|
|
353
|
-
switch (s) {
|
|
354
|
-
case Kt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Kt;
|
|
355
|
-
case 13: {
|
|
356
|
-
const s = t.charCodeAt(e + 1);
|
|
357
|
-
s !== Kt && 133 !== s || (this.i = e + 2);
|
|
358
|
-
}
|
|
359
|
-
case 133:
|
|
360
|
-
case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, qt;
|
|
361
|
-
default: return this.fail("disallowed character."), s;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (s > 56319) return s >= 57344 && s <= 65533 || this.fail("disallowed character."), s;
|
|
365
|
-
const o = 65536 + 1024 * (s - 55296) + (t.charCodeAt(e + 1) - 56320);
|
|
366
|
-
return this.i = e + 2, o > 1114111 && this.fail("disallowed character."), o;
|
|
367
|
-
}
|
|
368
|
-
getCodeNorm() {
|
|
369
|
-
const t = this.getCode();
|
|
370
|
-
return t === qt ? Kt : t;
|
|
371
|
-
}
|
|
372
|
-
unGet() {
|
|
373
|
-
this.i = this.prevI, this.column--;
|
|
374
|
-
}
|
|
375
|
-
captureTo(t) {
|
|
376
|
-
let { i: e } = this;
|
|
377
|
-
const { chunk: s } = this;
|
|
378
|
-
for (;;) {
|
|
379
|
-
const o = this.getCode(), r = o === qt, i = r ? Kt : o;
|
|
380
|
-
if (i === Xt || t.includes(i)) return this.text += s.slice(e, this.prevI), i;
|
|
381
|
-
r && (this.text += `${s.slice(e, this.prevI)}\n`, e = this.i);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
captureToChar(t) {
|
|
385
|
-
let { i: e } = this;
|
|
386
|
-
const { chunk: s } = this;
|
|
387
|
-
for (;;) {
|
|
388
|
-
let o = this.getCode();
|
|
389
|
-
switch (o) {
|
|
390
|
-
case qt:
|
|
391
|
-
this.text += `${s.slice(e, this.prevI)}\n`, e = this.i, o = Kt;
|
|
392
|
-
break;
|
|
393
|
-
case Xt: return this.text += s.slice(e), !1;
|
|
394
|
-
}
|
|
395
|
-
if (o === t) return this.text += s.slice(e, this.prevI), !0;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
captureNameChars() {
|
|
399
|
-
const { chunk: t, i: e } = this;
|
|
400
|
-
for (;;) {
|
|
401
|
-
const s = this.getCode();
|
|
402
|
-
if (s === Xt) return this.name += t.slice(e), Xt;
|
|
403
|
-
if (!Lt(s)) return this.name += t.slice(e, this.prevI), s === qt ? Kt : s;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
skipSpaces() {
|
|
407
|
-
for (;;) {
|
|
408
|
-
const t = this.getCodeNorm();
|
|
409
|
-
if (t === Xt || !Dt(t)) return t;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
setXMLVersion(t) {
|
|
413
|
-
this.currentXMLVersion = t, "1.0" === t ? (this.isChar = _t, this.getCode = this.getCode10) : (this.isChar = Rt, this.getCode = this.getCode11);
|
|
414
|
-
}
|
|
415
|
-
sBegin() {
|
|
416
|
-
65279 === this.chunk.charCodeAt(0) && (this.i++, this.column++), this.state = 1;
|
|
417
|
-
}
|
|
418
|
-
sBeginWhitespace() {
|
|
419
|
-
const t = this.i, e = this.skipSpaces();
|
|
420
|
-
switch (this.prevI !== t && (this.xmlDeclPossible = !1), e) {
|
|
421
|
-
case Jt:
|
|
422
|
-
if (this.state = 15, 0 !== this.text.length) throw new Error("no-empty text at start");
|
|
423
|
-
break;
|
|
424
|
-
case Xt: break;
|
|
425
|
-
default: this.unGet(), this.state = Ut, this.xmlDeclPossible = !1;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
sDoctype() {
|
|
429
|
-
const t = this.captureTo(oe);
|
|
430
|
-
switch (t) {
|
|
431
|
-
case Qt:
|
|
432
|
-
this.doctypeHandler?.(this.text), this.text = "", this.state = Ut, this.doctype = !0;
|
|
433
|
-
break;
|
|
434
|
-
case Xt: break;
|
|
435
|
-
default: this.text += String.fromCodePoint(t), 91 === t ? this.state = 4 : ee(t) && (this.state = 3, this.q = t);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
sDoctypeQuote() {
|
|
439
|
-
const t = this.q;
|
|
440
|
-
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2);
|
|
441
|
-
}
|
|
442
|
-
sDTD() {
|
|
443
|
-
const t = this.captureTo(re);
|
|
444
|
-
t !== Xt && (this.text += String.fromCodePoint(t), t === te ? this.state = 2 : t === Jt ? this.state = 6 : ee(t) && (this.state = 5, this.q = t));
|
|
445
|
-
}
|
|
446
|
-
sDTDQuoted() {
|
|
447
|
-
const t = this.q;
|
|
448
|
-
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null);
|
|
449
|
-
}
|
|
450
|
-
sDTDOpenWaka() {
|
|
451
|
-
const t = this.getCodeNorm();
|
|
452
|
-
switch (this.text += String.fromCodePoint(t), t) {
|
|
453
|
-
case 33:
|
|
454
|
-
this.state = 7, this.openWakaBang = "";
|
|
455
|
-
break;
|
|
456
|
-
case Yt:
|
|
457
|
-
this.state = 11;
|
|
458
|
-
break;
|
|
459
|
-
default: this.state = 4;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
sDTDOpenWakaBang() {
|
|
463
|
-
const t = String.fromCodePoint(this.getCodeNorm()), e = this.openWakaBang += t;
|
|
464
|
-
this.text += t, "-" !== e && (this.state = "--" === e ? 8 : 4, this.openWakaBang = "");
|
|
465
|
-
}
|
|
466
|
-
sDTDComment() {
|
|
467
|
-
this.captureToChar(45) && (this.text += "-", this.state = 9);
|
|
468
|
-
}
|
|
469
|
-
sDTDCommentEnding() {
|
|
470
|
-
const t = this.getCodeNorm();
|
|
471
|
-
this.text += String.fromCodePoint(t), this.state = 45 === t ? 10 : 8;
|
|
472
|
-
}
|
|
473
|
-
sDTDCommentEnded() {
|
|
474
|
-
const t = this.getCodeNorm();
|
|
475
|
-
this.text += String.fromCodePoint(t), t === Qt ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
|
|
476
|
-
}
|
|
477
|
-
sDTDPI() {
|
|
478
|
-
this.captureToChar(Yt) && (this.text += "?", this.state = 12);
|
|
479
|
-
}
|
|
480
|
-
sDTDPIEnding() {
|
|
481
|
-
const t = this.getCodeNorm();
|
|
482
|
-
this.text += String.fromCodePoint(t), t === Qt && (this.state = 4);
|
|
483
|
-
}
|
|
484
|
-
sText() {
|
|
485
|
-
0 !== this.tags.length ? this.handleTextInRoot() : this.handleTextOutsideRoot();
|
|
486
|
-
}
|
|
487
|
-
sEntity() {
|
|
488
|
-
let { i: t } = this;
|
|
489
|
-
const { chunk: e } = this;
|
|
490
|
-
t: for (;;) switch (this.getCode()) {
|
|
491
|
-
case qt:
|
|
492
|
-
this.entity += `${e.slice(t, this.prevI)}\n`, t = this.i;
|
|
493
|
-
break;
|
|
494
|
-
case 59: {
|
|
495
|
-
const { entityReturnState: s } = this, o = this.entity + e.slice(t, this.prevI);
|
|
496
|
-
let r;
|
|
497
|
-
this.state = s, "" === o ? (this.fail("empty entity name."), r = "&;") : (r = this.parseEntity(o), this.entity = ""), s === Ut && void 0 === this.textHandler || (this.text += r);
|
|
498
|
-
break t;
|
|
499
|
-
}
|
|
500
|
-
case Xt:
|
|
501
|
-
this.entity += e.slice(t);
|
|
502
|
-
break t;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
sOpenWaka() {
|
|
506
|
-
const t = this.getCode();
|
|
507
|
-
if (Vt(t)) this.state = 34, this.unGet(), this.xmlDeclPossible = !1;
|
|
508
|
-
else switch (t) {
|
|
509
|
-
case 47:
|
|
510
|
-
this.state = 43, this.xmlDeclPossible = !1;
|
|
511
|
-
break;
|
|
512
|
-
case 33:
|
|
513
|
-
this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
|
|
514
|
-
break;
|
|
515
|
-
case Yt:
|
|
516
|
-
this.state = 23;
|
|
517
|
-
break;
|
|
518
|
-
default: this.fail("disallowed character in tag name"), this.state = Ut, this.xmlDeclPossible = !1;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
sOpenWakaBang() {
|
|
522
|
-
switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
|
|
523
|
-
case "[CDATA[":
|
|
524
|
-
this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0), this.state = 20, this.openWakaBang = "";
|
|
525
|
-
break;
|
|
526
|
-
case "--":
|
|
527
|
-
this.state = 17, this.openWakaBang = "";
|
|
528
|
-
break;
|
|
529
|
-
case "DOCTYPE":
|
|
530
|
-
this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
|
|
531
|
-
break;
|
|
532
|
-
default: this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
sComment() {
|
|
536
|
-
this.captureToChar(45) && (this.state = 18);
|
|
537
|
-
}
|
|
538
|
-
sCommentEnding() {
|
|
539
|
-
const t = this.getCodeNorm();
|
|
540
|
-
45 === t ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17);
|
|
541
|
-
}
|
|
542
|
-
sCommentEnded() {
|
|
543
|
-
const t = this.getCodeNorm();
|
|
544
|
-
t !== Qt ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = Ut;
|
|
545
|
-
}
|
|
546
|
-
sCData() {
|
|
547
|
-
this.captureToChar(te) && (this.state = 21);
|
|
548
|
-
}
|
|
549
|
-
sCDataEnding() {
|
|
550
|
-
const t = this.getCodeNorm();
|
|
551
|
-
t === te ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
|
|
552
|
-
}
|
|
553
|
-
sCDataEnding2() {
|
|
554
|
-
const t = this.getCodeNorm();
|
|
555
|
-
switch (t) {
|
|
556
|
-
case Qt:
|
|
557
|
-
this.cdataHandler?.(this.text), this.text = "", this.state = Ut;
|
|
558
|
-
break;
|
|
559
|
-
case te:
|
|
560
|
-
this.text += "]";
|
|
561
|
-
break;
|
|
562
|
-
default: this.text += `]]${String.fromCodePoint(t)}`, this.state = 20;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
sPIFirstChar() {
|
|
566
|
-
const t = this.getCodeNorm();
|
|
567
|
-
this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === Yt || Dt(t) ? (this.fail("processing instruction without a target."), this.state = t === Yt ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24);
|
|
568
|
-
}
|
|
569
|
-
sPIRest() {
|
|
570
|
-
const { chunk: t, i: e } = this;
|
|
571
|
-
for (;;) {
|
|
572
|
-
const s = this.getCodeNorm();
|
|
573
|
-
if (s === Xt) return void (this.piTarget += t.slice(e));
|
|
574
|
-
if (!this.nameCheck(s)) {
|
|
575
|
-
this.piTarget += t.slice(e, this.prevI);
|
|
576
|
-
const o = s === Yt;
|
|
577
|
-
o || Dt(s) ? "xml" === this.piTarget ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = o ? Gt : 27) : this.state = o ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(s));
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
sPIBody() {
|
|
583
|
-
if (0 === this.text.length) {
|
|
584
|
-
const t = this.getCodeNorm();
|
|
585
|
-
t === Yt ? this.state = 26 : Dt(t) || (this.text = String.fromCodePoint(t));
|
|
586
|
-
} else this.captureToChar(Yt) && (this.state = 26);
|
|
587
|
-
}
|
|
588
|
-
sPIEnding() {
|
|
589
|
-
const t = this.getCodeNorm();
|
|
590
|
-
if (t === Qt) {
|
|
591
|
-
const { piTarget: t } = this;
|
|
592
|
-
"xml" === t.toLowerCase() && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({
|
|
593
|
-
target: t,
|
|
594
|
-
body: this.text
|
|
595
|
-
}), this.piTarget = this.text = "", this.state = Ut;
|
|
596
|
-
} else t === Yt ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25);
|
|
597
|
-
this.xmlDeclPossible = !1;
|
|
598
|
-
}
|
|
599
|
-
sXMLDeclNameStart() {
|
|
600
|
-
const t = this.skipSpaces();
|
|
601
|
-
t !== Yt ? t !== Xt && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = Gt;
|
|
602
|
-
}
|
|
603
|
-
sXMLDeclName() {
|
|
604
|
-
const t = this.captureTo(ie);
|
|
605
|
-
if (t === Yt) return this.state = Gt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
|
|
606
|
-
if (Dt(t) || t === Zt) {
|
|
607
|
-
if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
|
|
608
|
-
case 0:
|
|
609
|
-
this.fail("did not expect any more name/value pairs.");
|
|
610
|
-
break;
|
|
611
|
-
case 1:
|
|
612
|
-
this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
|
|
613
|
-
break;
|
|
614
|
-
default: this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
|
|
615
|
-
}
|
|
616
|
-
this.state = t === Zt ? 30 : 29;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
sXMLDeclEq() {
|
|
620
|
-
const t = this.getCodeNorm();
|
|
621
|
-
if (t === Yt) return this.state = Gt, void this.fail("XML declaration is incomplete.");
|
|
622
|
-
Dt(t) || (t !== Zt && this.fail("value required."), this.state = 30);
|
|
623
|
-
}
|
|
624
|
-
sXMLDeclValueStart() {
|
|
625
|
-
const t = this.getCodeNorm();
|
|
626
|
-
if (t === Yt) return this.state = Gt, void this.fail("XML declaration is incomplete.");
|
|
627
|
-
Dt(t) || (ee(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
|
|
628
|
-
}
|
|
629
|
-
sXMLDeclValue() {
|
|
630
|
-
const t = this.captureTo([this.q, Yt]);
|
|
631
|
-
if (t === Yt) return this.state = Gt, this.text = "", void this.fail("XML declaration is incomplete.");
|
|
632
|
-
if (t === Xt) return;
|
|
633
|
-
const e = this.text;
|
|
634
|
-
switch (this.text = "", this.name) {
|
|
635
|
-
case "version": {
|
|
636
|
-
this.xmlDeclExpects = ["encoding", "standalone"];
|
|
637
|
-
const t = e;
|
|
638
|
-
this.xmlDecl.version = t, /^1\.[0-9]+$/.test(t) ? this.opt.forceXMLVersion || this.setXMLVersion(t) : this.fail("version number must match /^1\\.[0-9]+$/.");
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
case "encoding":
|
|
642
|
-
/^[A-Za-z][A-Za-z0-9._-]*$/.test(e) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = e;
|
|
643
|
-
break;
|
|
644
|
-
case "standalone": "yes" !== e && "no" !== e && this.fail("standalone value must match \"yes\" or \"no\"."), this.xmlDeclExpects = [], this.xmlDecl.standalone = e;
|
|
645
|
-
}
|
|
646
|
-
this.name = "", this.state = 32;
|
|
647
|
-
}
|
|
648
|
-
sXMLDeclSeparator() {
|
|
649
|
-
const t = this.getCodeNorm();
|
|
650
|
-
t !== Yt ? (Dt(t) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = Gt;
|
|
651
|
-
}
|
|
652
|
-
sXMLDeclEnding() {
|
|
653
|
-
this.getCodeNorm() === Qt ? ("xml" !== this.piTarget ? this.fail("processing instructions are not allowed before root.") : "version" !== this.name && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmlDeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = Ut) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
|
|
654
|
-
}
|
|
655
|
-
sOpenTag() {
|
|
656
|
-
const t = this.captureNameChars();
|
|
657
|
-
if (t === Xt) return;
|
|
658
|
-
const e = this.tag = {
|
|
659
|
-
name: this.name,
|
|
660
|
-
attributes: Object.create(null)
|
|
661
|
-
};
|
|
662
|
-
switch (this.name = "", this.xmlnsOpt && (this.topNS = e.ns = Object.create(null)), this.openTagStartHandler?.(e), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t) {
|
|
663
|
-
case Qt:
|
|
664
|
-
this.openTag();
|
|
665
|
-
break;
|
|
666
|
-
case 47:
|
|
667
|
-
this.state = 35;
|
|
668
|
-
break;
|
|
669
|
-
default: Dt(t) || this.fail("disallowed character in tag name."), this.state = 36;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
sOpenTagSlash() {
|
|
673
|
-
this.getCode() === Qt ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
|
|
674
|
-
}
|
|
675
|
-
sAttrib() {
|
|
676
|
-
const t = this.skipSpaces();
|
|
677
|
-
t !== Xt && (Vt(t) ? (this.unGet(), this.state = 37) : t === Qt ? this.openTag() : 47 === t ? this.state = 35 : this.fail("disallowed character in attribute name."));
|
|
678
|
-
}
|
|
679
|
-
sAttribName() {
|
|
680
|
-
const t = this.captureNameChars();
|
|
681
|
-
t === Zt ? this.state = 39 : Dt(t) ? this.state = 38 : t === Qt ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== Xt && this.fail("disallowed character in attribute name.");
|
|
682
|
-
}
|
|
683
|
-
sAttribNameSawWhite() {
|
|
684
|
-
const t = this.skipSpaces();
|
|
685
|
-
switch (t) {
|
|
686
|
-
case Xt: return;
|
|
687
|
-
case Zt:
|
|
688
|
-
this.state = 39;
|
|
689
|
-
break;
|
|
690
|
-
default: this.fail("attribute without value."), this.text = "", this.name = "", t === Qt ? this.openTag() : Vt(t) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
sAttribValue() {
|
|
694
|
-
const t = this.getCodeNorm();
|
|
695
|
-
ee(t) ? (this.q = t, this.state = 40) : Dt(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet());
|
|
696
|
-
}
|
|
697
|
-
sAttribValueQuoted() {
|
|
698
|
-
const { q: t, chunk: e } = this;
|
|
699
|
-
let { i: s } = this;
|
|
700
|
-
for (;;) switch (this.getCode()) {
|
|
701
|
-
case t:
|
|
702
|
-
this.pushAttrib(this.name, this.text + e.slice(s, this.prevI)), this.name = this.text = "", this.q = null, this.state = 41;
|
|
703
|
-
return;
|
|
704
|
-
case 38:
|
|
705
|
-
this.text += e.slice(s, this.prevI), this.state = 14, this.entityReturnState = 40;
|
|
706
|
-
return;
|
|
707
|
-
case Kt:
|
|
708
|
-
case qt:
|
|
709
|
-
case 9:
|
|
710
|
-
this.text += `${e.slice(s, this.prevI)} `, s = this.i;
|
|
711
|
-
break;
|
|
712
|
-
case Jt:
|
|
713
|
-
this.text += e.slice(s, this.prevI), this.fail("disallowed character.");
|
|
714
|
-
return;
|
|
715
|
-
case Xt:
|
|
716
|
-
this.text += e.slice(s);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
sAttribValueClosed() {
|
|
721
|
-
const t = this.getCodeNorm();
|
|
722
|
-
Dt(t) ? this.state = 36 : t === Qt ? this.openTag() : 47 === t ? this.state = 35 : Vt(t) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name.");
|
|
723
|
-
}
|
|
724
|
-
sAttribValueUnquoted() {
|
|
725
|
-
const t = this.captureTo(ne);
|
|
726
|
-
switch (t) {
|
|
727
|
-
case 38:
|
|
728
|
-
this.state = 14, this.entityReturnState = 42;
|
|
729
|
-
break;
|
|
730
|
-
case Jt:
|
|
731
|
-
this.fail("disallowed character.");
|
|
732
|
-
break;
|
|
733
|
-
case Xt: break;
|
|
734
|
-
default: this.text.includes("]]>") && this.fail("the string \"]]>\" is disallowed in char data."), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === Qt ? this.openTag() : this.state = 36;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
sCloseTag() {
|
|
738
|
-
const t = this.captureNameChars();
|
|
739
|
-
t === Qt ? this.closeTag() : Dt(t) ? this.state = 44 : t !== Xt && this.fail("disallowed character in closing tag.");
|
|
740
|
-
}
|
|
741
|
-
sCloseTagSawWhite() {
|
|
742
|
-
switch (this.skipSpaces()) {
|
|
743
|
-
case Qt:
|
|
744
|
-
this.closeTag();
|
|
745
|
-
break;
|
|
746
|
-
case Xt: break;
|
|
747
|
-
default: this.fail("disallowed character in closing tag.");
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
handleTextInRoot() {
|
|
751
|
-
let { i: t, forbiddenState: e } = this;
|
|
752
|
-
const { chunk: s, textHandler: o } = this;
|
|
753
|
-
t: for (;;) switch (this.getCode()) {
|
|
754
|
-
case Jt:
|
|
755
|
-
if (this.state = 15, void 0 !== o) {
|
|
756
|
-
const { text: e } = this, r = s.slice(t, this.prevI);
|
|
757
|
-
0 !== e.length ? (o(e + r), this.text = "") : 0 !== r.length && o(r);
|
|
758
|
-
}
|
|
759
|
-
e = 0;
|
|
760
|
-
break t;
|
|
761
|
-
case 38:
|
|
762
|
-
this.state = 14, this.entityReturnState = Ut, void 0 !== o && (this.text += s.slice(t, this.prevI)), e = 0;
|
|
763
|
-
break t;
|
|
764
|
-
case te:
|
|
765
|
-
switch (e) {
|
|
766
|
-
case 0:
|
|
767
|
-
e = 1;
|
|
768
|
-
break;
|
|
769
|
-
case 1:
|
|
770
|
-
e = 2;
|
|
771
|
-
break;
|
|
772
|
-
case 2: break;
|
|
773
|
-
default: throw new Error("impossible state");
|
|
774
|
-
}
|
|
775
|
-
break;
|
|
776
|
-
case Qt:
|
|
777
|
-
2 === e && this.fail("the string \"]]>\" is disallowed in char data."), e = 0;
|
|
778
|
-
break;
|
|
779
|
-
case qt:
|
|
780
|
-
void 0 !== o && (this.text += `${s.slice(t, this.prevI)}\n`), t = this.i, e = 0;
|
|
781
|
-
break;
|
|
782
|
-
case Xt:
|
|
783
|
-
void 0 !== o && (this.text += s.slice(t));
|
|
784
|
-
break t;
|
|
785
|
-
default: e = 0;
|
|
786
|
-
}
|
|
787
|
-
this.forbiddenState = e;
|
|
788
|
-
}
|
|
789
|
-
handleTextOutsideRoot() {
|
|
790
|
-
let { i: t } = this;
|
|
791
|
-
const { chunk: e, textHandler: s } = this;
|
|
792
|
-
let o = !1;
|
|
793
|
-
t: for (;;) {
|
|
794
|
-
const r = this.getCode();
|
|
795
|
-
switch (r) {
|
|
796
|
-
case Jt:
|
|
797
|
-
if (this.state = 15, void 0 !== s) {
|
|
798
|
-
const { text: o } = this, r = e.slice(t, this.prevI);
|
|
799
|
-
0 !== o.length ? (s(o + r), this.text = "") : 0 !== r.length && s(r);
|
|
800
|
-
}
|
|
801
|
-
break t;
|
|
802
|
-
case 38:
|
|
803
|
-
this.state = 14, this.entityReturnState = Ut, void 0 !== s && (this.text += e.slice(t, this.prevI)), o = !0;
|
|
804
|
-
break t;
|
|
805
|
-
case qt:
|
|
806
|
-
void 0 !== s && (this.text += `${e.slice(t, this.prevI)}\n`), t = this.i;
|
|
807
|
-
break;
|
|
808
|
-
case Xt:
|
|
809
|
-
void 0 !== s && (this.text += e.slice(t));
|
|
810
|
-
break t;
|
|
811
|
-
default: Dt(r) || (o = !0);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
o && (this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0));
|
|
815
|
-
}
|
|
816
|
-
pushAttribNS(t, e) {
|
|
817
|
-
const { prefix: s, local: o } = this.qName(t), r = {
|
|
818
|
-
name: t,
|
|
819
|
-
prefix: s,
|
|
820
|
-
local: o,
|
|
821
|
-
value: e
|
|
822
|
-
};
|
|
823
|
-
if (this.attribList.push(r), this.attributeHandler?.(r), "xmlns" === s) {
|
|
824
|
-
const t = e.trim();
|
|
825
|
-
"1.0" === this.currentXMLVersion && "" === t && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[o] = t, ae(this, o, t);
|
|
826
|
-
} else if ("xmlns" === t) {
|
|
827
|
-
const t = e.trim();
|
|
828
|
-
this.topNS[""] = t, ae(this, "", t);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
pushAttribPlain(t, e) {
|
|
832
|
-
const s = {
|
|
833
|
-
name: t,
|
|
834
|
-
value: e
|
|
835
|
-
};
|
|
836
|
-
this.attribList.push(s), this.attributeHandler?.(s);
|
|
837
|
-
}
|
|
838
|
-
end() {
|
|
839
|
-
this.sawRoot || this.fail("document must contain a root element.");
|
|
840
|
-
const { tags: t } = this;
|
|
841
|
-
for (; t.length > 0;) {
|
|
842
|
-
const e = t.pop();
|
|
843
|
-
this.fail(`unclosed tag: ${e.name}`);
|
|
844
|
-
}
|
|
845
|
-
0 !== this.state && this.state !== Ut && this.fail("unexpected end.");
|
|
846
|
-
const { text: e } = this;
|
|
847
|
-
return 0 !== e.length && (this.textHandler?.(e), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
|
|
848
|
-
}
|
|
849
|
-
resolve(t) {
|
|
850
|
-
let e = this.topNS[t];
|
|
851
|
-
if (void 0 !== e) return e;
|
|
852
|
-
const { tags: s } = this;
|
|
853
|
-
for (let o = s.length - 1; o >= 0; o--) if (e = s[o].ns[t], void 0 !== e) return e;
|
|
854
|
-
return e = this.ns[t], void 0 !== e ? e : this.opt.resolvePrefix?.(t);
|
|
855
|
-
}
|
|
856
|
-
qName(t) {
|
|
857
|
-
const e = t.indexOf(":");
|
|
858
|
-
if (-1 === e) return {
|
|
859
|
-
prefix: "",
|
|
860
|
-
local: t
|
|
861
|
-
};
|
|
862
|
-
const s = t.slice(e + 1), o = t.slice(0, e);
|
|
863
|
-
return ("" === o || "" === s || s.includes(":")) && this.fail(`malformed name: ${t}.`), {
|
|
864
|
-
prefix: o,
|
|
865
|
-
local: s
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
processAttribsNS() {
|
|
869
|
-
const { attribList: t } = this, e = this.tag;
|
|
870
|
-
{
|
|
871
|
-
const { prefix: t, local: s } = this.qName(e.name);
|
|
872
|
-
e.prefix = t, e.local = s;
|
|
873
|
-
const o = e.uri = this.resolve(t) ?? "";
|
|
874
|
-
"" !== t && ("xmlns" === t && this.fail("tags may not have \"xmlns\" as prefix."), "" === o && (this.fail(`unbound namespace prefix: ${JSON.stringify(t)}.`), e.uri = t));
|
|
875
|
-
}
|
|
876
|
-
if (0 === t.length) return;
|
|
877
|
-
const { attributes: s } = e, o = /* @__PURE__ */ new Set();
|
|
878
|
-
for (const e of t) {
|
|
879
|
-
const { name: t, prefix: r, local: i } = e;
|
|
880
|
-
let n, a;
|
|
881
|
-
"" === r ? (n = "xmlns" === t ? Ft : "", a = t) : (n = this.resolve(r), void 0 === n && (this.fail(`unbound namespace prefix: ${JSON.stringify(r)}.`), n = r), a = `{${n}}${i}`), o.has(a) && this.fail(`duplicate attribute: ${a}.`), o.add(a), e.uri = n, s[t] = e;
|
|
882
|
-
}
|
|
883
|
-
this.attribList = [];
|
|
884
|
-
}
|
|
885
|
-
processAttribsPlain() {
|
|
886
|
-
const { attribList: t } = this, e = this.tag.attributes;
|
|
887
|
-
for (const { name: s, value: o } of t) void 0 !== e[s] && this.fail(`duplicate attribute: ${s}.`), e[s] = o;
|
|
888
|
-
this.attribList = [];
|
|
889
|
-
}
|
|
890
|
-
openTag() {
|
|
891
|
-
this.processAttribs();
|
|
892
|
-
const { tags: t } = this, e = this.tag;
|
|
893
|
-
e.isSelfClosing = !1, this.openTagHandler?.(e), t.push(e), this.state = Ut, this.name = "";
|
|
894
|
-
}
|
|
895
|
-
openSelfClosingTag() {
|
|
896
|
-
this.processAttribs();
|
|
897
|
-
const { tags: t } = this, e = this.tag;
|
|
898
|
-
e.isSelfClosing = !0, this.openTagHandler?.(e), this.closeTagHandler?.(e), null === (this.tag = t[t.length - 1] ?? null) && (this.closedRoot = !0), this.state = Ut, this.name = "";
|
|
899
|
-
}
|
|
900
|
-
closeTag() {
|
|
901
|
-
const { tags: t, name: e } = this;
|
|
902
|
-
if (this.state = Ut, this.name = "", "" === e) return this.fail("weird empty close tag."), void (this.text += "</>");
|
|
903
|
-
const s = this.closeTagHandler;
|
|
904
|
-
let o = t.length;
|
|
905
|
-
for (; o-- > 0;) {
|
|
906
|
-
const o = this.tag = t.pop();
|
|
907
|
-
if (this.topNS = o.ns, s?.(o), o.name === e) break;
|
|
908
|
-
this.fail(`unexpected close tag: ${e}.`);
|
|
909
|
-
}
|
|
910
|
-
0 === o ? this.closedRoot = !0 : o < 0 && (this.fail(`unmatched closing tag: ${e}.`), this.text += `</${e}>`);
|
|
911
|
-
}
|
|
912
|
-
parseEntity(t) {
|
|
913
|
-
if ("#" !== t[0]) {
|
|
914
|
-
const e = this.ENTITIES[t];
|
|
915
|
-
return void 0 !== e ? e : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`);
|
|
916
|
-
}
|
|
917
|
-
let e = NaN;
|
|
918
|
-
return "x" === t[1] && /^#x[0-9a-f]+$/i.test(t) ? e = parseInt(t.slice(2), 16) : /^#[0-9]+$/.test(t) && (e = parseInt(t.slice(1), 10)), this.isChar(e) ? String.fromCodePoint(e) : (this.fail("malformed character entity."), `&${t};`);
|
|
919
|
-
}
|
|
920
|
-
}, pe = /&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g, fe = {
|
|
921
|
-
amp: "&",
|
|
922
|
-
lt: "<",
|
|
923
|
-
gt: ">",
|
|
924
|
-
quot: "\"",
|
|
925
|
-
apos: "'"
|
|
926
|
-
}, ge = (t, e) => {
|
|
927
|
-
const s = fe[e];
|
|
928
|
-
if (void 0 !== s) return s;
|
|
929
|
-
const o = 120 === e.charCodeAt(1) ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
|
|
930
|
-
return o > 0 && o <= 1114111 ? String.fromCodePoint(o) : t;
|
|
931
|
-
}, me = (t) => {
|
|
932
|
-
let e = t;
|
|
933
|
-
return -1 !== e.indexOf("\r") && (e = e.replace(/\r\n?/g, "\n")), -1 !== e.indexOf("&") && (e = e.replace(pe, ge)), e;
|
|
934
|
-
}, xe = (t) => {
|
|
935
|
-
let e = t;
|
|
936
|
-
const s = e.length;
|
|
937
|
-
for (let t = 0; t < s; t++) {
|
|
938
|
-
const s = e.charCodeAt(t);
|
|
939
|
-
if (9 === s || 10 === s || 13 === s) {
|
|
940
|
-
e = e.replace(/\r\n|[\t\n\r]/g, " ");
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
return -1 !== e.indexOf("&") && (e = e.replace(pe, ge)), e;
|
|
945
|
-
}, ye = (t) => 32 === t || 9 === t || 10 === t || 13 === t, be = class t {
|
|
946
|
-
constructor() {
|
|
947
|
-
this._openTagHandler = void 0, this._closeTagHandler = void 0, this._textHandler = void 0, this._cdataHandler = void 0, this._errorHandler = void 0, this._endHandler = void 0, this._scanners = null, this._carry = "", this._text = "", this._tags = [], this._sawRoot = !1, this._closed = !1;
|
|
948
|
-
}
|
|
949
|
-
static {
|
|
950
|
-
this.NEED_MORE = -1;
|
|
951
|
-
}
|
|
952
|
-
static {
|
|
953
|
-
this.NOT_HANDLED = -2;
|
|
954
|
-
}
|
|
955
|
-
static decodeText(t) {
|
|
956
|
-
return me(t);
|
|
957
|
-
}
|
|
958
|
-
on(t, e) {
|
|
959
|
-
switch (t) {
|
|
960
|
-
case "opentag":
|
|
961
|
-
this._openTagHandler = e;
|
|
962
|
-
break;
|
|
963
|
-
case "closetag":
|
|
964
|
-
this._closeTagHandler = e;
|
|
965
|
-
break;
|
|
966
|
-
case "text":
|
|
967
|
-
this._textHandler = e;
|
|
968
|
-
break;
|
|
969
|
-
case "cdata":
|
|
970
|
-
this._cdataHandler = e;
|
|
971
|
-
break;
|
|
972
|
-
case "error":
|
|
973
|
-
this._errorHandler = e;
|
|
974
|
-
break;
|
|
975
|
-
case "end": this._endHandler = e;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
setElementScanners(t) {
|
|
979
|
-
if (!t || 0 === t.length) return void (this._scanners = null);
|
|
980
|
-
const e = new Array(128);
|
|
981
|
-
for (const s of t) {
|
|
982
|
-
const t = s.name.charCodeAt(0);
|
|
983
|
-
if (!(t < 128) || void 0 !== e[t]) throw new Error(`Element scanner '${s.name}' needs an ASCII first character no other scanner uses.`);
|
|
984
|
-
e[t] = s;
|
|
985
|
-
}
|
|
986
|
-
this._scanners = e;
|
|
987
|
-
}
|
|
988
|
-
fail(t) {
|
|
989
|
-
const e = new Error(t), s = this._errorHandler;
|
|
990
|
-
if (void 0 === s) throw e;
|
|
991
|
-
s(e);
|
|
992
|
-
}
|
|
993
|
-
write(t) {
|
|
994
|
-
if (this._closed) return this.fail("cannot write after close."), this;
|
|
995
|
-
let e = t;
|
|
996
|
-
0 !== this._carry.length && (e = this._carry + t, this._carry = "");
|
|
997
|
-
const s = e.length;
|
|
998
|
-
let o = 0;
|
|
999
|
-
for (; o < s;) {
|
|
1000
|
-
const t = e.indexOf("<", o);
|
|
1001
|
-
if (-1 === t) return this._text += e.slice(o), this;
|
|
1002
|
-
t > o && (this._text += e.slice(o, t));
|
|
1003
|
-
const r = this._markup(e, t, s);
|
|
1004
|
-
if (-1 === r) return this._carry = e.slice(t), this;
|
|
1005
|
-
o = r;
|
|
1006
|
-
}
|
|
1007
|
-
return this;
|
|
1008
|
-
}
|
|
1009
|
-
close() {
|
|
1010
|
-
0 !== this._carry.length && (this.fail("unexpected end."), this._carry = ""), this._sawRoot || this.fail("document must contain a root element.");
|
|
1011
|
-
const t = this._tags;
|
|
1012
|
-
for (; t.length > 0;) {
|
|
1013
|
-
const e = t.pop();
|
|
1014
|
-
this.fail(`unclosed tag: ${e.name}`);
|
|
1015
|
-
}
|
|
1016
|
-
return this._flushText(), this._closed = !0, this._endHandler?.(), this;
|
|
1017
|
-
}
|
|
1018
|
-
_flushText() {
|
|
1019
|
-
const t = this._text;
|
|
1020
|
-
if (0 === t.length) return;
|
|
1021
|
-
this._text = "";
|
|
1022
|
-
const e = this._textHandler;
|
|
1023
|
-
void 0 !== e && 0 !== this._tags.length && e(me(t));
|
|
1024
|
-
}
|
|
1025
|
-
_markup(e, s, o) {
|
|
1026
|
-
if (s + 1 >= o) return -1;
|
|
1027
|
-
const r = e.charCodeAt(s + 1);
|
|
1028
|
-
if (47 === r) {
|
|
1029
|
-
const t = e.indexOf(">", s + 2);
|
|
1030
|
-
return -1 === t ? -1 : (this._flushText(), this._closeTag(e.slice(s + 2, t).trimEnd()), t + 1);
|
|
1031
|
-
}
|
|
1032
|
-
if (63 === r) {
|
|
1033
|
-
const t = e.indexOf("?>", s + 2);
|
|
1034
|
-
return -1 === t ? -1 : t + 2;
|
|
1035
|
-
}
|
|
1036
|
-
if (33 === r) {
|
|
1037
|
-
if (s + 4 > o) return -1;
|
|
1038
|
-
if (45 === e.charCodeAt(s + 2) && 45 === e.charCodeAt(s + 3)) {
|
|
1039
|
-
const t = e.indexOf("-->", s + 4);
|
|
1040
|
-
return -1 === t ? -1 : t + 3;
|
|
1041
|
-
}
|
|
1042
|
-
if (s + 9 > o) return -1;
|
|
1043
|
-
if (e.startsWith("[CDATA[", s + 2)) {
|
|
1044
|
-
const t = e.indexOf("]]>", s + 9);
|
|
1045
|
-
return -1 === t ? -1 : (this._flushText(), this._cdataHandler?.(e.slice(s + 9, t)), t + 3);
|
|
1046
|
-
}
|
|
1047
|
-
const t = e.indexOf("[", s + 2), r = e.indexOf(">", s + 2);
|
|
1048
|
-
if (-1 === r) return -1;
|
|
1049
|
-
if (-1 !== t && t < r) {
|
|
1050
|
-
const s = e.indexOf("]>", t);
|
|
1051
|
-
return -1 === s ? -1 : s + 2;
|
|
1052
|
-
}
|
|
1053
|
-
return r + 1;
|
|
1054
|
-
}
|
|
1055
|
-
const i = this._scanners;
|
|
1056
|
-
if (null !== i) {
|
|
1057
|
-
const n = r < 128 ? i[r] : void 0;
|
|
1058
|
-
if (void 0 !== n && e.startsWith(n.name, s + 1)) {
|
|
1059
|
-
const r = s + 1 + n.name.length;
|
|
1060
|
-
if (r >= o) return -1;
|
|
1061
|
-
const i = e.charCodeAt(r);
|
|
1062
|
-
if (62 === i || 47 === i || ye(i)) {
|
|
1063
|
-
this._flushText();
|
|
1064
|
-
const r = n.scan(e, s, o);
|
|
1065
|
-
if (r !== t.NOT_HANDLED) {
|
|
1066
|
-
if (r !== t.NEED_MORE) {
|
|
1067
|
-
this._sawRoot = !0;
|
|
1068
|
-
const t = n.openTag;
|
|
1069
|
-
void 0 !== t && this._tags.push(t);
|
|
1070
|
-
}
|
|
1071
|
-
return r;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
return this._openTag(e, s, o);
|
|
1077
|
-
}
|
|
1078
|
-
_openTag(t, e, s) {
|
|
1079
|
-
let o = e + 1, r = 0;
|
|
1080
|
-
for (; o < s && (r = t.charCodeAt(o), 62 !== r && 47 !== r && !ye(r));) o++;
|
|
1081
|
-
if (o >= s) return -1;
|
|
1082
|
-
const i = t.slice(e + 1, o), n = {};
|
|
1083
|
-
let a = !1;
|
|
1084
|
-
for (;;) {
|
|
1085
|
-
for (; o < s && ye(r = t.charCodeAt(o));) o++;
|
|
1086
|
-
if (o >= s) return -1;
|
|
1087
|
-
if (62 === r) {
|
|
1088
|
-
o++;
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
if (47 === r) {
|
|
1092
|
-
if (o + 1 >= s) return -1;
|
|
1093
|
-
if (62 !== t.charCodeAt(o + 1)) {
|
|
1094
|
-
this.fail("forward-slash in opening tag not followed by >."), o++;
|
|
1095
|
-
continue;
|
|
1096
|
-
}
|
|
1097
|
-
a = !0, o += 2;
|
|
1098
|
-
break;
|
|
1099
|
-
}
|
|
1100
|
-
const e = o;
|
|
1101
|
-
for (; o < s && (r = t.charCodeAt(o), 61 !== r && 62 !== r && 47 !== r && !ye(r));) o++;
|
|
1102
|
-
if (o >= s) return -1;
|
|
1103
|
-
const i = t.slice(e, o);
|
|
1104
|
-
for (; o < s && ye(r = t.charCodeAt(o));) o++;
|
|
1105
|
-
if (o >= s) return -1;
|
|
1106
|
-
if (61 !== r) {
|
|
1107
|
-
this.fail("attribute without value.");
|
|
1108
|
-
continue;
|
|
1109
|
-
}
|
|
1110
|
-
for (o++; o < s && ye(r = t.charCodeAt(o));) o++;
|
|
1111
|
-
if (o >= s) return -1;
|
|
1112
|
-
if (34 !== r && 39 !== r) {
|
|
1113
|
-
this.fail("unquoted attribute value.");
|
|
1114
|
-
continue;
|
|
1115
|
-
}
|
|
1116
|
-
const c = t.indexOf(34 === r ? "\"" : "'", o + 1);
|
|
1117
|
-
if (-1 === c) return -1;
|
|
1118
|
-
"__proto__" !== i && (n[i] = xe(t.slice(o + 1, c))), o = c + 1;
|
|
1119
|
-
}
|
|
1120
|
-
this._flushText(), this._sawRoot = !0;
|
|
1121
|
-
const c = {
|
|
1122
|
-
name: i,
|
|
1123
|
-
attributes: n,
|
|
1124
|
-
isSelfClosing: a
|
|
1125
|
-
};
|
|
1126
|
-
return this._openTagHandler?.(c), a ? this._closeTagHandler?.(c) : this._tags.push(c), o;
|
|
1127
|
-
}
|
|
1128
|
-
_closeTag(t) {
|
|
1129
|
-
if ("" === t) return void this.fail("weird empty close tag.");
|
|
1130
|
-
const e = this._tags, s = this._closeTagHandler;
|
|
1131
|
-
let o = e.length;
|
|
1132
|
-
for (; o-- > 0;) {
|
|
1133
|
-
const o = e.pop();
|
|
1134
|
-
if (s?.(o), o.name === t) return;
|
|
1135
|
-
this.fail(`unexpected close tag: ${t}.`);
|
|
1136
|
-
}
|
|
1137
|
-
this.fail(`unmatched closing tag: ${t}.`);
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
(function(t) {
|
|
1141
|
-
t.Events = {
|
|
1142
|
-
XmlDecl: "xmldecl",
|
|
1143
|
-
Text: "text",
|
|
1144
|
-
ProcessingInstruction: "processinginstruction",
|
|
1145
|
-
Doctype: "doctype",
|
|
1146
|
-
Comment: "comment",
|
|
1147
|
-
OpenTagStart: "opentagstart",
|
|
1148
|
-
Attribute: "attribute",
|
|
1149
|
-
OpenTag: "opentag",
|
|
1150
|
-
CloseTag: "closetag",
|
|
1151
|
-
CDdata: "cdata",
|
|
1152
|
-
Error: "error",
|
|
1153
|
-
End: "end",
|
|
1154
|
-
Ready: "ready"
|
|
1155
|
-
};
|
|
1156
|
-
t.parseStream = async (t, e, s) => {
|
|
1157
|
-
if (s?.lean) return (async (t, e) => {
|
|
1158
|
-
const s = new be();
|
|
1159
|
-
let o;
|
|
1160
|
-
e.elementScanners && s.setElementScanners(e.elementScanners), e.onOpenTag && s.on("opentag", e.onOpenTag), e.onCloseTag && s.on("closetag", e.onCloseTag), e.onText && s.on("text", e.onText), e.onError && s.on("error", e.onError);
|
|
1161
|
-
const r = e.onEnd;
|
|
1162
|
-
for (r && s.on("end", () => {
|
|
1163
|
-
o = r();
|
|
1164
|
-
});;) {
|
|
1165
|
-
const { value: e, done: o } = await t.read();
|
|
1166
|
-
if (o) break;
|
|
1167
|
-
s.write(e);
|
|
1168
|
-
}
|
|
1169
|
-
return s.close(), o;
|
|
1170
|
-
})(t, e);
|
|
1171
|
-
const o = new de({
|
|
1172
|
-
position: !1,
|
|
1173
|
-
...s
|
|
1174
|
-
});
|
|
1175
|
-
let r;
|
|
1176
|
-
e.onOpenTagStart && o.on(ce.Events.OpenTagStart, e.onOpenTagStart), e.onOpenTag && o.on(ce.Events.OpenTag, e.onOpenTag), e.onCloseTag && o.on(ce.Events.CloseTag, e.onCloseTag), e.onAttribute && o.on(ce.Events.Attribute, e.onAttribute), e.onText && o.on(ce.Events.Text, e.onText), e.onError && o.on(ce.Events.Error, e.onError);
|
|
1177
|
-
const i = e.onEnd;
|
|
1178
|
-
if (i) {
|
|
1179
|
-
const t = () => {
|
|
1180
|
-
r = i();
|
|
1181
|
-
};
|
|
1182
|
-
o.on(ce.Events.End, t);
|
|
1183
|
-
}
|
|
1184
|
-
for (;;) {
|
|
1185
|
-
const { value: e, done: s } = await t.read();
|
|
1186
|
-
if (s) break;
|
|
1187
|
-
o.write(e);
|
|
1188
|
-
}
|
|
1189
|
-
return o.close(), r;
|
|
1190
|
-
};
|
|
1191
|
-
})(ce || (ce = {}));
|
|
1192
|
-
var Te = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null, ve = (t) => {
|
|
1193
|
-
const e = parseInt(t);
|
|
1194
|
-
return isNaN(e) ? null : e;
|
|
1195
|
-
}, we = (t) => {
|
|
1196
|
-
const e = parseFloat(t);
|
|
1197
|
-
return isNaN(e) ? null : e;
|
|
1198
|
-
}, Se = null, Ce = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ke = (t) => Ce(t).replace(/"/g, """), Ae = class {
|
|
1199
|
-
constructor() {
|
|
1200
|
-
this._registeredVisitors = /* @__PURE__ */ new Map();
|
|
1201
|
-
}
|
|
1202
|
-
registerVisitor(t) {
|
|
1203
|
-
this._registeredVisitors.set(t.from, t);
|
|
1204
|
-
}
|
|
1205
|
-
createEventHandler(t, e, s) {
|
|
1206
|
-
const o = this._registeredVisitors, r = [], i = [];
|
|
1207
|
-
let n = null, a = null, c = null, l = null;
|
|
1208
|
-
const h = [], u = {
|
|
1209
|
-
key: null,
|
|
1210
|
-
source: t,
|
|
1211
|
-
parent: null
|
|
1212
|
-
};
|
|
1213
|
-
let d = null, p = !1, f = null, g = null, m = null;
|
|
1214
|
-
const x = (t, e) => {
|
|
1215
|
-
let s = c.attributes[t];
|
|
1216
|
-
if (e) if (Array.isArray(e)) {
|
|
1217
|
-
const t = e.length;
|
|
1218
|
-
for (let o = 0; o < t; o++) {
|
|
1219
|
-
if (null == s) return;
|
|
1220
|
-
if (s = e[o](s), null == s) return;
|
|
1221
|
-
}
|
|
1222
|
-
} else {
|
|
1223
|
-
if (null == s) return;
|
|
1224
|
-
if (s = e(s), null == s) return;
|
|
1225
|
-
}
|
|
1226
|
-
return s;
|
|
1227
|
-
}, y = {
|
|
1228
|
-
getSource: () => d?.source ?? null,
|
|
1229
|
-
setSource: (t) => {
|
|
1230
|
-
d.source = t;
|
|
1231
|
-
},
|
|
1232
|
-
setKey: (t) => {
|
|
1233
|
-
d.key = t;
|
|
1234
|
-
},
|
|
1235
|
-
getFrom: () => c,
|
|
1236
|
-
getAttribute: (t, e) => x(t, e) ?? null,
|
|
1237
|
-
hasAttribute: (t) => null !== y.getAttribute(t),
|
|
1238
|
-
getParent: () => {
|
|
1239
|
-
const t = h[h.length - 2];
|
|
1240
|
-
return t.parent ?? t.source;
|
|
1241
|
-
},
|
|
1242
|
-
getPath: () => {
|
|
1243
|
-
const t = [], e = i.length;
|
|
1244
|
-
for (let s = 0; s < e; s++) t.push(i[s].local);
|
|
1245
|
-
return t.join("\\");
|
|
1246
|
-
},
|
|
1247
|
-
parseAttribute: x,
|
|
1248
|
-
getRawXml: () => m,
|
|
1249
|
-
copyToObject: (t, e, s, o) => {
|
|
1250
|
-
const r = x(o ?? e, s);
|
|
1251
|
-
void 0 !== r && (t[e] = r);
|
|
1252
|
-
},
|
|
1253
|
-
copyTo: (t, e, s) => {
|
|
1254
|
-
const o = x(s ?? t, e);
|
|
1255
|
-
void 0 !== o && (d.source[t] = o);
|
|
1256
|
-
},
|
|
1257
|
-
warn: (t, e) => {
|
|
1258
|
-
s ? s(t, void 0, e?.onceKey) : console.warn(t);
|
|
1259
|
-
}
|
|
1260
|
-
};
|
|
1261
|
-
return {
|
|
1262
|
-
onOpenTag: (t) => {
|
|
1263
|
-
let e = t.name;
|
|
1264
|
-
const s = e.indexOf(":");
|
|
1265
|
-
if (-1 !== s && (e = e.slice(s + 1)), f) return f.push(((t) => {
|
|
1266
|
-
const e = t.attributes ?? {};
|
|
1267
|
-
let s = `<${t.name}`;
|
|
1268
|
-
for (const t in e) {
|
|
1269
|
-
const o = e[t];
|
|
1270
|
-
s += ` ${t}="${ke("string" == typeof o ? o : o?.value ?? "")}"`;
|
|
1271
|
-
}
|
|
1272
|
-
return s + ">";
|
|
1273
|
-
})(t)), n = {
|
|
1274
|
-
local: e,
|
|
1275
|
-
tag: t,
|
|
1276
|
-
destination: null
|
|
1277
|
-
}, i.push(n), a = e, void (c = t);
|
|
1278
|
-
const m = (r.length > 0 ? r[r.length - 1] : o).get(e);
|
|
1279
|
-
if (n = {
|
|
1280
|
-
local: e,
|
|
1281
|
-
visitor: m,
|
|
1282
|
-
tag: t,
|
|
1283
|
-
destination: null
|
|
1284
|
-
}, p) return i.push(n), a = e, void (c = t);
|
|
1285
|
-
l = n?.visitor ?? null, a = e, c = t;
|
|
1286
|
-
let x = !!m && null === m.to;
|
|
1287
|
-
if (m && !x && m.scope) {
|
|
1288
|
-
const t = m.scope(y);
|
|
1289
|
-
null === t ? x = !0 : t && (r.push(t), n.pushedScope = !0);
|
|
1290
|
-
}
|
|
1291
|
-
m && (0 === i.length ? (d = u, n.destination = d, n.pushedDestination = !0, h.push(d)) : x ? (d = null, n.destination = null) : m.transparent ? n.destination = d : (d = {
|
|
1292
|
-
key: null,
|
|
1293
|
-
source: {},
|
|
1294
|
-
parent: null
|
|
1295
|
-
}, n.destination = d, n.pushedDestination = !0, h.push(d))), i.push(n), p = x;
|
|
1296
|
-
const b = l?.openTag?.(y);
|
|
1297
|
-
void 0 !== b && (d.parent = b), m?.raw && !x && (f = [], g = n);
|
|
1298
|
-
},
|
|
1299
|
-
onCloseTag: (t) => {
|
|
1300
|
-
let e = t.name;
|
|
1301
|
-
const o = e.indexOf(":");
|
|
1302
|
-
if (-1 !== o && (e = e.slice(o + 1)), e !== a) throw new Error(`mismatch open/close tag: '${e}'/'${a}'`);
|
|
1303
|
-
let x = !1;
|
|
1304
|
-
if (f) {
|
|
1305
|
-
if (i[i.length - 1] !== g) return f.push(`</${t.name}>`), i.pop(), n = i[i.length - 1] ?? null, a = n?.local ?? null, void (c = n?.tag ?? null);
|
|
1306
|
-
m = f.join(""), f = null, g = null, x = !0;
|
|
1307
|
-
}
|
|
1308
|
-
p || l?.closeTag?.(y), x && (m = null);
|
|
1309
|
-
const b = i.pop() ?? null;
|
|
1310
|
-
n = i[i.length - 1] ?? null, b?.pushedScope && r.pop();
|
|
1311
|
-
const T = b?.destination;
|
|
1312
|
-
if (T && b.pushedDestination) {
|
|
1313
|
-
h.pop(), d = h[h.length - 1] ?? u;
|
|
1314
|
-
const t = b.visitor;
|
|
1315
|
-
t && t.to && void 0 !== T.source && (Array.isArray(t.to) ? d.source.push ? d.source.push(T.source) : s?.(`Unable to parse array for ${t.from} at ${y.getPath()}`) : T.key ? d.source[T.key] = T.source : "string" == typeof t.to && (d.source[t.to] = T.source));
|
|
1316
|
-
} else T || (d = h[h.length - 1] ?? u);
|
|
1317
|
-
a = n?.local ?? null, c = n?.tag ?? null, l = n?.visitor ?? null, p = !n?.destination;
|
|
1318
|
-
},
|
|
1319
|
-
onText: (t) => {
|
|
1320
|
-
f ? f.push(Ce(t)) : l?.text?.(t, y);
|
|
1321
|
-
},
|
|
1322
|
-
onEnd: e
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
}, Ee = `IFERROR(${O}(`, Pe = Ee.toUpperCase(), Oe = w.toUpperCase(), Ie = { kind: "none" }, De = { kind: "spilled" }, _e = (t, e) => {
|
|
1326
|
-
if (34 !== t.charCodeAt(e)) return null;
|
|
1327
|
-
let s = "", o = e + 1;
|
|
1328
|
-
for (; o < t.length;) if (34 === t.charCodeAt(o)) {
|
|
1329
|
-
if (34 !== t.charCodeAt(o + 1)) return {
|
|
1330
|
-
value: s,
|
|
1331
|
-
end: o + 1
|
|
1332
|
-
};
|
|
1333
|
-
s += "\"", o += 2;
|
|
1334
|
-
} else s += t[o], o++;
|
|
1335
|
-
return null;
|
|
1336
|
-
}, Ve = (t) => {
|
|
1337
|
-
const e = [];
|
|
1338
|
-
let s = 0;
|
|
1339
|
-
for (; s < t.length;) {
|
|
1340
|
-
const o = t.charCodeAt(s);
|
|
1341
|
-
if (34 === o) {
|
|
1342
|
-
const e = _e(t, s);
|
|
1343
|
-
if (null === e) break;
|
|
1344
|
-
s = e.end;
|
|
1345
|
-
continue;
|
|
1346
|
-
}
|
|
1347
|
-
if (!(o >= 65 && o <= 90 || o >= 97 && o <= 122 || 95 === o)) {
|
|
1348
|
-
s++;
|
|
1349
|
-
continue;
|
|
1350
|
-
}
|
|
1351
|
-
let r = s + 1;
|
|
1352
|
-
for (; r < t.length;) {
|
|
1353
|
-
const e = t.charCodeAt(r);
|
|
1354
|
-
if (!(e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || 95 === e || 46 === e)) break;
|
|
1355
|
-
r++;
|
|
1356
|
-
}
|
|
1357
|
-
40 === t.charCodeAt(r) && e.push(t.slice(s, r).toUpperCase().replace(/^_XLFN\./, "").replace(/^_XLWS\./, "")), s = r;
|
|
1358
|
-
}
|
|
1359
|
-
return e;
|
|
1360
|
-
}, Le = (t) => {
|
|
1361
|
-
const e = (e) => {
|
|
1362
|
-
if (t) return new RegExp(`<(?:[\\w.-]+:)?${e}\\b[^>]*>([^<]*)<`).exec(t)?.[1];
|
|
1363
|
-
}, s = (t) => {
|
|
1364
|
-
const e = parseInt(t ?? "", 10);
|
|
1365
|
-
return isNaN(e) ? 0 : e;
|
|
1366
|
-
};
|
|
1367
|
-
return {
|
|
1368
|
-
c: s(e("col")),
|
|
1369
|
-
r: s(e("row")),
|
|
1370
|
-
x: $(e("colOff") ?? "0") ?? 0,
|
|
1371
|
-
y: $(e("rowOff") ?? "0") ?? 0
|
|
1372
|
-
};
|
|
1373
|
-
}, Ne = "formulaDialect", $e = (t, e, s, o, r, m, T, w) => {
|
|
1374
|
-
const S = new Ae(), k = w?.get("parseInlineDxf"), A = w?.get(Ne), P = (t) => A && t ? A.readDetached(t) : t, O = new at.TransposedBuilder();
|
|
1375
|
-
let D = null;
|
|
1376
|
-
S.registerVisitor({
|
|
1377
|
-
from: "autoFilter",
|
|
1378
|
-
to: "autoTable",
|
|
1379
|
-
openTag: (t) => {
|
|
1380
|
-
const e = t.getAttribute("ref"), s = J.fastStringToRange(e);
|
|
1381
|
-
t.getSource().r = s, t.getSource().v = {};
|
|
1382
|
-
},
|
|
1383
|
-
closeTag: (t) => {
|
|
1384
|
-
const e = t.getSource(), s = e.v, o = s.hiddenButtons;
|
|
1385
|
-
if (Array.isArray(o)) {
|
|
1386
|
-
const t = o.length, r = e.r, i = r.colEnd - r.colStart + 1;
|
|
1387
|
-
0 === t ? s.hiddenButtons = !1 : t === i && (s.hiddenButtons = !0);
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
}), S.registerVisitor({
|
|
1391
|
-
from: "conditionalFormatting",
|
|
1392
|
-
to: {},
|
|
1393
|
-
openTag: (t) => {
|
|
1394
|
-
const e = t.getParent();
|
|
1395
|
-
e.conditionals || (e.conditionals = []);
|
|
1396
|
-
let s = t.getAttribute("sqref");
|
|
1397
|
-
s && (s = s.trim().split(/\s+/).join(","));
|
|
1398
|
-
const o = {
|
|
1399
|
-
r: s,
|
|
1400
|
-
conditionals: e.conditionals
|
|
1401
|
-
}, r = t.getAttribute("pivot", Te);
|
|
1402
|
-
null !== r && (o.pivot = r), t.setSource(o);
|
|
1403
|
-
}
|
|
1404
|
-
}), S.registerVisitor({
|
|
1405
|
-
from: "cfRule",
|
|
1406
|
-
to: {},
|
|
1407
|
-
openTag: (t) => {
|
|
1408
|
-
const e = t.getParent();
|
|
1409
|
-
if (!e?.r) return;
|
|
1410
|
-
const s = t.getSource() ?? {};
|
|
1411
|
-
void 0 !== e.pivot && (s.pivot = e.pivot), e.conditionals.push({
|
|
1412
|
-
r: e.r,
|
|
1413
|
-
v: null,
|
|
1414
|
-
rule: s
|
|
1415
|
-
}), t.copyToObject(s, "type", Se), t.copyToObject(s, "priority", ve), t.copyToObject(s, "stopIfTrue", Te);
|
|
1416
|
-
const r = t.getAttribute("dxfId", ve);
|
|
1417
|
-
if (null !== r) {
|
|
1418
|
-
let e = o?.get(r);
|
|
1419
|
-
e || (m?.(`Unable to load conditional color. Invalid dxfI: '${r}' at '${t.getPath()}'.`), e = {}), s.style = e;
|
|
1420
|
-
}
|
|
1421
|
-
t.copyToObject(s, "aboveAverage", Te), t.copyToObject(s, "equalAverage", Te), t.copyToObject(s, "stdDev", ve), t.copyToObject(s, "bottom", Te), t.copyToObject(s, "percent", Te), t.copyToObject(s, "rank", ve), t.copyToObject(s, "operator", Se), t.copyToObject(s, "text", Se), t.copyToObject(s, "timePeriod", Se);
|
|
1422
|
-
},
|
|
1423
|
-
closeTag: (t) => {
|
|
1424
|
-
const e = t.getParent();
|
|
1425
|
-
if (!e?.r) return;
|
|
1426
|
-
const s = e.conditionals[e.conditionals.length - 1], o = s?.rule;
|
|
1427
|
-
if (!o) return;
|
|
1428
|
-
const r = {}, i = I(o, m);
|
|
1429
|
-
i && (r.condition = i), o.style && (r.style = o.style), o.scale && (r.scale = o.scale), o.stopIfTrue && (r.stopIfTrue = !0), o.pivot && (r.pivot = !0), s.v = r, s.priority = o.priority, o.x14Id && (s.x14Id = o.x14Id), delete s.rule;
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
const L = (t) => {
|
|
1433
|
-
const e = t.conditions ?? [], s = [];
|
|
1434
|
-
for (let t = 0; t < e.length; t++) {
|
|
1435
|
-
const o = e[t], r = {};
|
|
1436
|
-
o.type && (r.type = o.type), void 0 !== o.value && (r.value = o.value), o.exclusive && (r.exclusive = !0), s.push(r);
|
|
1437
|
-
}
|
|
1438
|
-
return s;
|
|
1439
|
-
};
|
|
1440
|
-
S.registerVisitor({
|
|
1441
|
-
from: "colorScale",
|
|
1442
|
-
to: {},
|
|
1443
|
-
openTag: (t) => {},
|
|
1444
|
-
closeTag: (t) => {
|
|
1445
|
-
const e = t.getSource(), s = e.colors ?? [], o = L(e);
|
|
1446
|
-
for (let t = 0; t < o.length; t++) o[t].color = s[t];
|
|
1447
|
-
t.getParent().scale = {
|
|
1448
|
-
type: et.ScaleType.ColorScale,
|
|
1449
|
-
stops: o
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1452
|
-
}), S.registerVisitor({
|
|
1453
|
-
from: "dataBar",
|
|
1454
|
-
to: {},
|
|
1455
|
-
openTag: (t) => {
|
|
1456
|
-
t.copyTo("maxLength", ve), t.copyTo("minLength", ve), t.copyTo("showValue", Te);
|
|
1457
|
-
},
|
|
1458
|
-
closeTag: (t) => {
|
|
1459
|
-
const e = t.getSource(), s = {
|
|
1460
|
-
type: et.ScaleType.DataBar,
|
|
1461
|
-
stops: L(e)
|
|
1462
|
-
}, o = e.colors?.[0];
|
|
1463
|
-
o && (s.color = o), void 0 !== e.minLength && (s.minLength = e.minLength), void 0 !== e.maxLength && (s.maxLength = e.maxLength), void 0 !== e.showValue && (s.showValue = e.showValue), t.getParent().scale = s;
|
|
1464
|
-
}
|
|
1465
|
-
}), S.registerVisitor({
|
|
1466
|
-
from: "iconSet",
|
|
1467
|
-
to: {},
|
|
1468
|
-
openTag: (t) => {
|
|
1469
|
-
t.copyTo("iconSet", Se), t.copyTo("reverse", Te), t.copyTo("showValue", Te);
|
|
1470
|
-
},
|
|
1471
|
-
closeTag: (t) => {
|
|
1472
|
-
const e = t.getSource(), s = {
|
|
1473
|
-
type: et.ScaleType.IconSet,
|
|
1474
|
-
stops: L(e)
|
|
1475
|
-
};
|
|
1476
|
-
void 0 !== e.iconSet && (s.iconSet = e.iconSet), void 0 !== e.reverse && (s.reverse = e.reverse), void 0 !== e.showValue && (s.showValue = e.showValue), t.getParent().scale = s;
|
|
1477
|
-
}
|
|
1478
|
-
}), S.registerVisitor({
|
|
1479
|
-
from: "formula",
|
|
1480
|
-
to: {},
|
|
1481
|
-
text: (t, e) => {
|
|
1482
|
-
const s = e.getParent();
|
|
1483
|
-
let o = s.formulas;
|
|
1484
|
-
o || (o = [], s.formulas = o), o.push(P(t));
|
|
1485
|
-
}
|
|
1486
|
-
}), S.registerVisitor({
|
|
1487
|
-
from: "cfvo",
|
|
1488
|
-
to: {},
|
|
1489
|
-
openTag: (t) => {
|
|
1490
|
-
const e = t.getParent();
|
|
1491
|
-
e.conditions || (e.conditions = []);
|
|
1492
|
-
const s = t.getSource();
|
|
1493
|
-
if (e.conditions.push(s), t.copyTo("type", Se), s.type === et.ColorStopType.Formula) {
|
|
1494
|
-
const e = t.getAttribute("val");
|
|
1495
|
-
null != e && (s.value = P(String(e)));
|
|
1496
|
-
} else t.copyTo("value", we, "val");
|
|
1497
|
-
!1 === t.getAttribute("gte", Te) && (s.exclusive = !0);
|
|
1498
|
-
}
|
|
1499
|
-
}), S.registerVisitor({
|
|
1500
|
-
from: "color",
|
|
1501
|
-
to: {},
|
|
1502
|
-
openTag: (t) => {
|
|
1503
|
-
const e = t.getParent();
|
|
1504
|
-
e.colors || (e.colors = []);
|
|
1505
|
-
const s = X((e) => t.getAttribute(e));
|
|
1506
|
-
e.colors.push(s);
|
|
1507
|
-
}
|
|
1508
|
-
}), S.registerVisitor({
|
|
1509
|
-
from: "filterColumn",
|
|
1510
|
-
to: {},
|
|
1511
|
-
openTag: (t) => {
|
|
1512
|
-
const e = t.getParent().v, s = parseInt(t.getAttribute("colId")), o = t.getSource();
|
|
1513
|
-
o.index = s;
|
|
1514
|
-
let r = e.filter;
|
|
1515
|
-
r || (r = { conditions: [] }, e.filter = r);
|
|
1516
|
-
let i = r.conditions;
|
|
1517
|
-
if (i || (i = [], r.conditions = i), i.push(o), t.getAttribute("hiddenButton", Te) && e) {
|
|
1518
|
-
let t = e.hiddenButtons;
|
|
1519
|
-
t || (t = [], e.hiddenButtons = t), t.push(s);
|
|
1520
|
-
}
|
|
1521
|
-
if (t.getAttribute("showButton", Te) && e) {
|
|
1522
|
-
let t = e.showButtons;
|
|
1523
|
-
t || (t = [], e.showButtons = t), t.push(s);
|
|
1524
|
-
}
|
|
1525
|
-
return o;
|
|
1526
|
-
}
|
|
1527
|
-
}), S.registerVisitor({
|
|
1528
|
-
from: "colorFilter",
|
|
1529
|
-
openTag: (t) => {
|
|
1530
|
-
const e = t.getParent(), s = {};
|
|
1531
|
-
e.operator = tt.BuiltInOperatorNames.Color, e.param = s, t.copyToObject(s, "cellColor", Te), t.copyToObject(s, "styleId", ve, "dxfId");
|
|
1532
|
-
}
|
|
1533
|
-
}), S.registerVisitor({
|
|
1534
|
-
from: "iconFilter",
|
|
1535
|
-
openTag: (t) => {
|
|
1536
|
-
const e = t.getParent(), s = {};
|
|
1537
|
-
e.operator = tt.BuiltInOperatorNames.Icon, e.param = s, t.copyToObject(s, "iconId", ve), t.copyToObject(s, "iconSet", Se);
|
|
1538
|
-
}
|
|
1539
|
-
}), S.registerVisitor({
|
|
1540
|
-
from: "top10",
|
|
1541
|
-
openTag: (t) => {
|
|
1542
|
-
const e = t.getParent(), s = {};
|
|
1543
|
-
e.operator = tt.BuiltInOperatorNames.TopN, e.param = s, t.copyToObject(s, "filterVal", we), t.copyToObject(s, "percent", Te), t.copyToObject(s, "top", Te), t.copyToObject(s, "limit", we, "val");
|
|
1544
|
-
}
|
|
1545
|
-
}), S.registerVisitor({
|
|
1546
|
-
from: "dynamicFilter",
|
|
1547
|
-
openTag: (t) => {
|
|
1548
|
-
const e = t.getParent(), s = l(t.getAttribute("type"));
|
|
1549
|
-
e.operator = s.operator, e.param = s.param;
|
|
1550
|
-
}
|
|
1551
|
-
});
|
|
1552
|
-
const N = {
|
|
1553
|
-
from: "filters",
|
|
1554
|
-
to: {},
|
|
1555
|
-
openTag: (t) => {
|
|
1556
|
-
const e = t.getParent(), s = { byDisplay: !0 };
|
|
1557
|
-
return e.operator = tt.BuiltInOperatorNames.InSet, e.param = s, t.copyToObject(s, "blank", Te), s.blank && (e.includeBlanks = !0), t.copyToObject(s, "calendarType", Se), s;
|
|
1558
|
-
}
|
|
1559
|
-
};
|
|
1560
|
-
S.registerVisitor(N);
|
|
1561
|
-
const $ = {
|
|
1562
|
-
from: "filter",
|
|
1563
|
-
openTag: (t) => {
|
|
1564
|
-
const e = t.getParent();
|
|
1565
|
-
let s = e.items;
|
|
1566
|
-
s || (s = [], e.items = s), s.push(t.getAttribute("val", Se));
|
|
1567
|
-
}
|
|
1568
|
-
};
|
|
1569
|
-
S.registerVisitor($);
|
|
1570
|
-
const B = {
|
|
1571
|
-
from: "dateGroupItem",
|
|
1572
|
-
to: {},
|
|
1573
|
-
openTag: (t) => {
|
|
1574
|
-
const e = t.getParent();
|
|
1575
|
-
let s = e.dateGroups;
|
|
1576
|
-
s || (s = [], e.dateGroups = s), s.push(t.getSource()), t.copyTo("group", Se, "dateTimeGrouping"), t.copyTo("day", ve), t.copyTo("hour", ve), t.copyTo("minute", ve), t.copyTo("month", ve), t.copyTo("second", ve), t.copyTo("year", ve);
|
|
1577
|
-
}
|
|
1578
|
-
};
|
|
1579
|
-
S.registerVisitor(B);
|
|
1580
|
-
const j = /* @__PURE__ */ new Map();
|
|
1581
|
-
j.set("filterColumn", {
|
|
1582
|
-
from: "filterColumn",
|
|
1583
|
-
transparent: !0
|
|
1584
|
-
}), j.set("filters", N), j.set("filter", $), j.set("dateGroupItem", B), S.registerVisitor({
|
|
1585
|
-
from: "customFilters",
|
|
1586
|
-
openTag: (t) => {
|
|
1587
|
-
const e = t.getParent(), s = t.getAttribute("and"), o = "and" === s || "1" === s, r = [];
|
|
1588
|
-
return e.operator = o ? tt.BuiltInOperatorNames.And : tt.BuiltInOperatorNames.Or, e.param = r, t.setSource(e), r;
|
|
1589
|
-
},
|
|
1590
|
-
closeTag: (t) => {
|
|
1591
|
-
const e = t.getSource(), s = e?.param;
|
|
1592
|
-
if (!e || !s) return;
|
|
1593
|
-
const o = 1 === s.length ? s[0] : y(e);
|
|
1594
|
-
o !== e && (e.operator = o.operator, e.param = o.param, o.includeBlanks && (e.includeBlanks = !0));
|
|
1595
|
-
}
|
|
1596
|
-
}), S.registerVisitor({
|
|
1597
|
-
from: "customFilter",
|
|
1598
|
-
openTag: (t) => {
|
|
1599
|
-
const e = t.getParent();
|
|
1600
|
-
let s;
|
|
1601
|
-
Array.isArray(e) ? (s = {}, e.push(s)) : s = e;
|
|
1602
|
-
const o = v({
|
|
1603
|
-
operator: t.getAttribute("operator"),
|
|
1604
|
-
val: t.getAttribute("val")
|
|
1605
|
-
}, (e) => t.warn(e));
|
|
1606
|
-
o && (s.operator = o.operator, s.param = o.param, o.includeBlanks && (s.includeBlanks = !0));
|
|
1607
|
-
}
|
|
1608
|
-
}), S.registerVisitor({
|
|
1609
|
-
from: "sortState",
|
|
1610
|
-
to: {},
|
|
1611
|
-
openTag: (t) => {
|
|
1612
|
-
const e = t.getParent();
|
|
1613
|
-
let s = e.v;
|
|
1614
|
-
s && (s.sort = {}, t.setSource(e));
|
|
1615
|
-
}
|
|
1616
|
-
}), S.registerVisitor({
|
|
1617
|
-
from: "sortCondition",
|
|
1618
|
-
to: {},
|
|
1619
|
-
openTag: (t) => {
|
|
1620
|
-
const e = t.getParent(), s = e.v;
|
|
1621
|
-
if (!s) return;
|
|
1622
|
-
const o = s.sort;
|
|
1623
|
-
if (!o) return;
|
|
1624
|
-
let r = o.sorts;
|
|
1625
|
-
r || (r = [], o.sorts = r);
|
|
1626
|
-
const i = t.getAttribute("ref");
|
|
1627
|
-
let n = 0;
|
|
1628
|
-
if (i) {
|
|
1629
|
-
const t = J.fastStringToRange(i, je).colStart, s = e.r, o = s.colStart;
|
|
1630
|
-
n = s ? t - o : t;
|
|
1631
|
-
}
|
|
1632
|
-
const a = {};
|
|
1633
|
-
t.copyToObject(a, "sortOn", Se, "sortBy"), t.copyToObject(a, "dxfId", Se, "sortBy"), t.copyToObject(a, "iconSet", Se), t.copyToObject(a, "customList", Se), a.reverse = t.getAttribute("descending", Te) ?? !1;
|
|
1634
|
-
const c = {
|
|
1635
|
-
index: n,
|
|
1636
|
-
criteria: a
|
|
1637
|
-
};
|
|
1638
|
-
r.push(c);
|
|
1639
|
-
}
|
|
1640
|
-
});
|
|
1641
|
-
const M = (t) => {
|
|
1642
|
-
D = t.getSource(), t.copyTo("topLeft", Se, "topLeftCell");
|
|
1643
|
-
const e = V(t.getAttribute("defaultGridColor")), s = t.getAttribute("colorId");
|
|
1644
|
-
null === s || e || (t.getSource().gridLineColor = "index" + parseFloat(s)), t.copyTo("showZeros", Te), t.copyTo("showFormulas", Te), t.copyTo("zoomScale", ve), t.copyTo("showRowHeaders", Te, "showRowColHeaders"), t.copyTo("showColumnHeaders", Te, "showRowColHeaders"), t.copyTo("showRowGridlines", Te, "showGridLines"), t.copyTo("showColumnGridlines", Te, "showGridLines"), t.copyTo("rightToLeft", Te), t.copyTo("showOutlineSymbols", Te);
|
|
1645
|
-
};
|
|
1646
|
-
S.registerVisitor({
|
|
1647
|
-
from: "sheetView",
|
|
1648
|
-
to: "view",
|
|
1649
|
-
openTag: (t) => {
|
|
1650
|
-
M(t);
|
|
1651
|
-
},
|
|
1652
|
-
closeTag: () => {
|
|
1653
|
-
D = null;
|
|
1654
|
-
}
|
|
1655
|
-
}), S.registerVisitor({
|
|
1656
|
-
from: "customSheetViews",
|
|
1657
|
-
to: "customSheetViews",
|
|
1658
|
-
openTag: (t) => {
|
|
1659
|
-
t.setSource([]);
|
|
1660
|
-
}
|
|
1661
|
-
}), S.registerVisitor({
|
|
1662
|
-
from: "customSheetView",
|
|
1663
|
-
to: [],
|
|
1664
|
-
openTag: (t) => {
|
|
1665
|
-
M(t);
|
|
1666
|
-
},
|
|
1667
|
-
closeTag: () => {
|
|
1668
|
-
D = null;
|
|
1669
|
-
}
|
|
1670
|
-
}), S.registerVisitor({
|
|
1671
|
-
from: "selection",
|
|
1672
|
-
to: "selection",
|
|
1673
|
-
openTag: (t) => {
|
|
1674
|
-
if (!D) return;
|
|
1675
|
-
t.copyTo("cell", Se, "activeCell"), t.copyTo("rangeIndex", ve, "activeCellId");
|
|
1676
|
-
const e = t.getAttribute("activeCell"), s = t.getAttribute("sqref");
|
|
1677
|
-
if (s && s !== e) t.getSource().ranges = s.trim().split(/\s+/);
|
|
1678
|
-
}
|
|
1679
|
-
}), S.registerVisitor({
|
|
1680
|
-
from: "pane",
|
|
1681
|
-
to: null,
|
|
1682
|
-
openTag: (t) => {
|
|
1683
|
-
if (!D) return;
|
|
1684
|
-
if ("frozen" === t.getAttribute("state")) {
|
|
1685
|
-
const e = {};
|
|
1686
|
-
D.freezePanes = e, t.copyToObject(e, "topLeft", Se, "topLeftCell");
|
|
1687
|
-
const s = (D.topLeft ? J.fastStringToCell(D.topLeft) : void 0) ?? {
|
|
1688
|
-
colIndex: 0,
|
|
1689
|
-
rowIndex: 0
|
|
1690
|
-
}, o = {
|
|
1691
|
-
colIndex: 0,
|
|
1692
|
-
rowIndex: 0
|
|
1693
|
-
};
|
|
1694
|
-
t.copyToObject(o, "colIndex", ve, "xSplit"), t.copyToObject(o, "rowIndex", ve, "ySplit");
|
|
1695
|
-
const r = {
|
|
1696
|
-
colIndex: s.colIndex + o.colIndex,
|
|
1697
|
-
rowIndex: s.rowIndex + o.rowIndex
|
|
1698
|
-
};
|
|
1699
|
-
e.coords = J.cellToString(r);
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
}), S.registerVisitor({
|
|
1703
|
-
from: "sheetPr",
|
|
1704
|
-
transparent: !0,
|
|
1705
|
-
openTag: (e) => {
|
|
1706
|
-
const s = e.getAttribute("codeName");
|
|
1707
|
-
s && (t.codeName = s), !1 === e.getAttribute("enableFormatConditionsCalculation", Te) && (t.conditionalFormatCalculation = !1);
|
|
1708
|
-
}
|
|
1709
|
-
}), S.registerVisitor({
|
|
1710
|
-
from: "tabColor",
|
|
1711
|
-
to: null,
|
|
1712
|
-
openTag: (e) => {
|
|
1713
|
-
const s = X((t) => e.getAttribute(t));
|
|
1714
|
-
s && (t.tabColor = s);
|
|
1715
|
-
}
|
|
1716
|
-
}), S.registerVisitor({
|
|
1717
|
-
from: "pageSetUpPr",
|
|
1718
|
-
to: "pageSetUpPr",
|
|
1719
|
-
openTag: (t) => {}
|
|
1720
|
-
}), S.registerVisitor({
|
|
1721
|
-
from: "outlinePr",
|
|
1722
|
-
to: null,
|
|
1723
|
-
openTag: (e) => {
|
|
1724
|
-
const s = (t) => {
|
|
1725
|
-
const s = e.getAttribute(t);
|
|
1726
|
-
return "0" === s || "false" === s;
|
|
1727
|
-
}, o = {};
|
|
1728
|
-
s("summaryBelow") && (o.summaryRow = "up"), s("summaryRight") && (o.summaryColumn = "left"), ((t) => {
|
|
1729
|
-
const s = e.getAttribute(t);
|
|
1730
|
-
return "1" === s || "true" === s;
|
|
1731
|
-
})("applyStyles") && (o.automaticStyles = !0), Object.keys(o).length > 0 && (t.outline = o);
|
|
1732
|
-
}
|
|
1733
|
-
}), S.registerVisitor({
|
|
1734
|
-
from: "pageMargins",
|
|
1735
|
-
to: "pageMargins",
|
|
1736
|
-
openTag: (t) => {
|
|
1737
|
-
t.copyTo("bottom", we), t.copyTo("footer", we), t.copyTo("header", we), t.copyTo("left", we), t.copyTo("right", we), t.copyTo("top", we), t.copyTo("bottom", we);
|
|
1738
|
-
}
|
|
1739
|
-
}), S.registerVisitor({
|
|
1740
|
-
from: "pageSetup",
|
|
1741
|
-
to: "pageSetup",
|
|
1742
|
-
openTag: (t) => {
|
|
1743
|
-
t.copyTo("blackAndWhite", Te), t.copyTo("cellComments"), t.copyTo("copies", ve), t.copyTo("draft", Te), t.copyTo("errors"), t.copyTo("firstPageNumber", ve), t.copyTo("fitToHeight", ve), t.copyTo("fitToWidth", ve), t.copyTo("horizontalDpi", ve), t.copyTo("orientation"), t.copyTo("pageOrder"), t.copyTo("paperSize", ve), t.copyTo("scale", ve), t.copyTo("useFirstPageNumber", Te), t.copyTo("usePrinterDefaults", Te), t.copyTo("verticalDpi", ve);
|
|
1744
|
-
}
|
|
1745
|
-
}), S.registerVisitor({
|
|
1746
|
-
from: "printOptions",
|
|
1747
|
-
to: "printOptions",
|
|
1748
|
-
openTag: (t) => {
|
|
1749
|
-
t.copyTo("gridLines", Te), t.copyTo("gridLinesSet", Te), t.copyTo("headings", Te), t.copyTo("horizontalCentered", Te), t.copyTo("verticalCentered", Te);
|
|
1750
|
-
}
|
|
1751
|
-
}), S.registerVisitor({
|
|
1752
|
-
from: "headerFoot",
|
|
1753
|
-
to: "headerFoot",
|
|
1754
|
-
openTag: (t) => {}
|
|
1755
|
-
}), S.registerVisitor({
|
|
1756
|
-
from: "mergeCells",
|
|
1757
|
-
to: "merges",
|
|
1758
|
-
openTag: (t) => {
|
|
1759
|
-
t.setSource([]);
|
|
1760
|
-
}
|
|
1761
|
-
}), S.registerVisitor({
|
|
1762
|
-
from: "dataValidations",
|
|
1763
|
-
to: "validations",
|
|
1764
|
-
openTag: (t) => {
|
|
1765
|
-
t.setSource([]);
|
|
1766
|
-
}
|
|
1767
|
-
});
|
|
1768
|
-
const H = {
|
|
1769
|
-
from: "dataValidation",
|
|
1770
|
-
to: [],
|
|
1771
|
-
openTag: (t) => {
|
|
1772
|
-
let e = t.getAttribute("sqref");
|
|
1773
|
-
e && (e = e.trim().split(/\s+/).join(","));
|
|
1774
|
-
const s = {}, o = {
|
|
1775
|
-
r: e,
|
|
1776
|
-
v: s,
|
|
1777
|
-
rule: {
|
|
1778
|
-
type: t.getAttribute("type") ?? void 0,
|
|
1779
|
-
operator: t.getAttribute("operator") ?? void 0
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1782
|
-
!0 === t.getAttribute("showDropDown", Te) && (s.hideDropdown = !0), t.copyToObject(s, "alert", Se, "error"), t.copyToObject(s, "alertTitle", Se, "errorTitle"), t.copyToObject(s, "showAlertMessage", Te, "showErrorMessage"), s.alertStyle = t.getAttribute("errorStyle") ?? "stop", t.copyToObject(s, "imeMode"), t.copyToObject(s, "prompt"), t.copyToObject(s, "promptTitle"), t.copyToObject(s, "showPromptMessage", Te, "showInputMessage"), t.setSource(o);
|
|
1783
|
-
},
|
|
1784
|
-
closeTag: (t) => {
|
|
1785
|
-
const e = t.getSource();
|
|
1786
|
-
if (!e?.rule) return;
|
|
1787
|
-
const s = h(e.rule, m);
|
|
1788
|
-
s && (t.getAttribute("allowBlank", Te) && (s.includeBlanks = !0), e.v.condition = s), delete e.rule;
|
|
1789
|
-
}
|
|
1790
|
-
};
|
|
1791
|
-
S.registerVisitor(H), S.registerVisitor({
|
|
1792
|
-
from: "formula1",
|
|
1793
|
-
to: {},
|
|
1794
|
-
text: (t, e) => {
|
|
1795
|
-
const s = e.getParent().rule;
|
|
1796
|
-
s?.type && (s.formula1 = x(P(t), s.type));
|
|
1797
|
-
}
|
|
1798
|
-
}), S.registerVisitor({
|
|
1799
|
-
from: "formula2",
|
|
1800
|
-
to: {},
|
|
1801
|
-
text: (t, e) => {
|
|
1802
|
-
const s = e.getParent().rule;
|
|
1803
|
-
s?.type && (s.formula2 = x(P(t), s.type));
|
|
1804
|
-
}
|
|
1805
|
-
}), S.registerVisitor({
|
|
1806
|
-
from: "picture",
|
|
1807
|
-
to: "picture",
|
|
1808
|
-
openTag: (t) => {
|
|
1809
|
-
const s = t.getAttribute("r:id");
|
|
1810
|
-
if (!s) return void t.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.sheet.picture.noRel" });
|
|
1811
|
-
const o = e(s, "resource");
|
|
1812
|
-
t.getSource().resId = o;
|
|
1813
|
-
}
|
|
1814
|
-
});
|
|
1815
|
-
const F = {
|
|
1816
|
-
from: "slicer",
|
|
1817
|
-
to: {},
|
|
1818
|
-
openTag: (t) => {
|
|
1819
|
-
const s = t.getAttribute("r:id");
|
|
1820
|
-
if (!s) return void t.warn("A slicer names no cache; it was not imported.", { onceKey: "xlsx.sheet.slicer.noRel" });
|
|
1821
|
-
const o = e(s)?.slicers, r = t.getParent();
|
|
1822
|
-
r.slicers || (r.slicers = {});
|
|
1823
|
-
const i = Object.keys(o);
|
|
1824
|
-
for (const t of i) r.slicers[t] = o[t];
|
|
1825
|
-
}
|
|
1826
|
-
};
|
|
1827
|
-
S.registerVisitor(F);
|
|
1828
|
-
const W = (t, e) => ({
|
|
1829
|
-
from: t,
|
|
1830
|
-
to: {},
|
|
1831
|
-
openTag: (t) => {
|
|
1832
|
-
t.setSource("");
|
|
1833
|
-
},
|
|
1834
|
-
text: (t, e) => {
|
|
1835
|
-
e.setSource((e.getSource() ?? "") + t);
|
|
1836
|
-
},
|
|
1837
|
-
closeTag: (t) => {
|
|
1838
|
-
e(String(t.getSource() ?? ""), t);
|
|
1839
|
-
}
|
|
1840
|
-
}), z = /* @__PURE__ */ new Map();
|
|
1841
|
-
z.set("dataValidations", {
|
|
1842
|
-
from: "dataValidations",
|
|
1843
|
-
to: "validations",
|
|
1844
|
-
openTag: (t) => {
|
|
1845
|
-
const e = t.getParent();
|
|
1846
|
-
t.setSource(e.validations ?? []);
|
|
1847
|
-
},
|
|
1848
|
-
closeTag: (t) => {
|
|
1849
|
-
0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
|
|
1850
|
-
}
|
|
1851
|
-
}), z.set("dataValidation", {
|
|
1852
|
-
...H,
|
|
1853
|
-
closeTag: (t) => {
|
|
1854
|
-
H.closeTag(t);
|
|
1855
|
-
const e = t.getSource();
|
|
1856
|
-
e && !e.r && (t.warn("x14 dataValidation with no xm:sqref was dropped."), t.setSource(void 0));
|
|
1857
|
-
}
|
|
1858
|
-
});
|
|
1859
|
-
const q = (t) => ({
|
|
1860
|
-
from: t,
|
|
1861
|
-
to: {},
|
|
1862
|
-
openTag: (e) => {
|
|
1863
|
-
e.setSource({
|
|
1864
|
-
rule: e.getParent()?.rule,
|
|
1865
|
-
key: t
|
|
1866
|
-
});
|
|
1867
|
-
}
|
|
1868
|
-
});
|
|
1869
|
-
z.set("formula1", q("formula1")), z.set("formula2", q("formula2")), z.set("f", W("f", (t, e) => {
|
|
1870
|
-
const s = e.getParent(), o = s?.rule;
|
|
1871
|
-
o && (o[s.key] = x(P(t), o.type));
|
|
1872
|
-
})), z.set("sqref", W("sqref", (t, e) => {
|
|
1873
|
-
const s = e.getParent(), o = t.trim();
|
|
1874
|
-
s && o && (s.r = o.split(/\s+/).join(","));
|
|
1875
|
-
}));
|
|
1876
|
-
const U = /* @__PURE__ */ new Map(), G = [], K = /* @__PURE__ */ new Map();
|
|
1877
|
-
K.set("conditionalFormattings", {
|
|
1878
|
-
from: "conditionalFormattings",
|
|
1879
|
-
transparent: !0
|
|
1880
|
-
}), K.set("conditionalFormatting", {
|
|
1881
|
-
from: "conditionalFormatting",
|
|
1882
|
-
to: {},
|
|
1883
|
-
openTag: (t) => {
|
|
1884
|
-
t.setSource({ rules: [] });
|
|
1885
|
-
},
|
|
1886
|
-
closeTag: (t) => {
|
|
1887
|
-
const e = t.getSource(), s = e?.rules ?? [];
|
|
1888
|
-
for (let t = 0; t < s.length; t++) {
|
|
1889
|
-
const o = s[t];
|
|
1890
|
-
o.sqref = e.sqref, o.id ? U.set(o.id, o) : G.push(o);
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
}), K.set("cfRule", {
|
|
1894
|
-
from: "cfRule",
|
|
1895
|
-
to: {},
|
|
1896
|
-
openTag: (t) => {
|
|
1897
|
-
t.copyTo("id", Se), t.copyTo("type", Se), t.copyTo("priority", ve), t.copyTo("stopIfTrue", Te), t.copyTo("operator", Se), t.copyTo("text", Se), t.copyTo("timePeriod", Se), t.copyTo("aboveAverage", Te), t.copyTo("equalAverage", Te), t.copyTo("stdDev", ve), t.copyTo("bottom", Te), t.copyTo("percent", Te), t.copyTo("rank", ve);
|
|
1898
|
-
},
|
|
1899
|
-
closeTag: (t) => {
|
|
1900
|
-
const e = t.getSource();
|
|
1901
|
-
e && t.getParent()?.rules?.push(e);
|
|
1902
|
-
}
|
|
1903
|
-
}), K.set("sqref", W("sqref", (t, e) => {
|
|
1904
|
-
const s = e.getParent(), o = t.trim();
|
|
1905
|
-
s && o && (s.sqref = o);
|
|
1906
|
-
})), K.set("dataBar", {
|
|
1907
|
-
from: "dataBar",
|
|
1908
|
-
to: {},
|
|
1909
|
-
openTag: (t) => {
|
|
1910
|
-
t.copyTo("minLength", ve), t.copyTo("maxLength", ve), t.copyTo("gradient", Te), t.copyTo("border", Te), t.copyTo("direction", Se), t.copyTo("axisPosition", Se), t.copyTo("negativeBarColorSameAsPositive", Te), t.copyTo("negativeBarBorderColorSameAsPositive", Te);
|
|
1911
|
-
},
|
|
1912
|
-
closeTag: (t) => {
|
|
1913
|
-
t.getParent().dataBar = t.getSource();
|
|
1914
|
-
}
|
|
1915
|
-
}), K.set("iconSet", {
|
|
1916
|
-
from: "iconSet",
|
|
1917
|
-
to: {},
|
|
1918
|
-
openTag: (t) => {
|
|
1919
|
-
t.copyTo("iconSet", Se), t.copyTo("custom", Te), t.copyTo("reverse", Te), t.copyTo("showValue", Te);
|
|
1920
|
-
},
|
|
1921
|
-
closeTag: (t) => {
|
|
1922
|
-
t.getParent().iconSet = t.getSource();
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
|
-
const Z = /* @__PURE__ */ new Map();
|
|
1926
|
-
Z.set("f", W("f", (t, e) => {
|
|
1927
|
-
const s = e.getParent();
|
|
1928
|
-
if (!s) return;
|
|
1929
|
-
const o = t.trim(), r = Number(o);
|
|
1930
|
-
s.value = o.length > 0 && Number.isFinite(r) ? r : P(t);
|
|
1931
|
-
})), K.set("cfvo", {
|
|
1932
|
-
from: "cfvo",
|
|
1933
|
-
to: {},
|
|
1934
|
-
scope: () => Z,
|
|
1935
|
-
openTag: (t) => {
|
|
1936
|
-
const e = t.getParent();
|
|
1937
|
-
e.conditions || (e.conditions = []);
|
|
1938
|
-
const s = t.getSource();
|
|
1939
|
-
e.conditions.push(s), t.copyTo("type", Se), !1 === t.getAttribute("gte", Te) && (s.exclusive = !0);
|
|
1940
|
-
}
|
|
1941
|
-
}), K.set("f", W("f", (t, e) => {
|
|
1942
|
-
const s = e.getParent();
|
|
1943
|
-
s && (s.formulas ??= []).push(P(t));
|
|
1944
|
-
})), K.set("dxf", {
|
|
1945
|
-
from: "dxf",
|
|
1946
|
-
to: {},
|
|
1947
|
-
raw: !0,
|
|
1948
|
-
closeTag: (t) => {
|
|
1949
|
-
if (!k) return;
|
|
1950
|
-
const e = t.getParent();
|
|
1951
|
-
if (!e) return;
|
|
1952
|
-
const s = k(t.getRawXml() ?? "");
|
|
1953
|
-
s && (e.style = s);
|
|
1954
|
-
}
|
|
1955
|
-
});
|
|
1956
|
-
const Q = (t) => ({
|
|
1957
|
-
from: t,
|
|
1958
|
-
to: {},
|
|
1959
|
-
openTag: (e) => {
|
|
1960
|
-
const s = X((t) => e.getAttribute(t));
|
|
1961
|
-
s && (e.getParent()[t] = s);
|
|
1962
|
-
}
|
|
1963
|
-
});
|
|
1964
|
-
K.set("borderColor", Q("borderColor")), K.set("negativeFillColor", Q("negativeFillColor")), K.set("negativeBorderColor", Q("negativeBorderColor")), K.set("axisColor", Q("axisColor")), K.set("cfIcon", {
|
|
1965
|
-
from: "cfIcon",
|
|
1966
|
-
to: {},
|
|
1967
|
-
openTag: (t) => {
|
|
1968
|
-
const e = t.getAttribute("iconSet"), s = t.getAttribute("iconId", ve);
|
|
1969
|
-
if (null === e || null === s) return;
|
|
1970
|
-
const o = t.getParent();
|
|
1971
|
-
o.icons || (o.icons = []), o.icons.push({
|
|
1972
|
-
set: e,
|
|
1973
|
-
id: s
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
});
|
|
1977
|
-
const Y = /* @__PURE__ */ new Map();
|
|
1978
|
-
Y.set("id", W("id", (t, e) => {
|
|
1979
|
-
const s = e.getParent(), o = t.trim();
|
|
1980
|
-
s && o && (s.x14Id = o);
|
|
1981
|
-
}));
|
|
1982
|
-
const st = /* @__PURE__ */ new Map();
|
|
1983
|
-
st.set("slicerList", {
|
|
1984
|
-
from: "slicerList",
|
|
1985
|
-
transparent: !0
|
|
1986
|
-
}), st.set("slicer", F);
|
|
1987
|
-
const ot = /* @__PURE__ */ new Map([
|
|
1988
|
-
[n(c), z],
|
|
1989
|
-
[n(p), K],
|
|
1990
|
-
[n(i), K],
|
|
1991
|
-
[n(d), Y],
|
|
1992
|
-
[n(f), st],
|
|
1993
|
-
[n(R), st],
|
|
1994
|
-
[n(u), j]
|
|
1995
|
-
]), rt = /* @__PURE__ */ new Set();
|
|
1996
|
-
S.registerVisitor({
|
|
1997
|
-
from: "extLst",
|
|
1998
|
-
transparent: !0
|
|
1999
|
-
}), S.registerVisitor({
|
|
2000
|
-
from: "ext",
|
|
2001
|
-
transparent: !0,
|
|
2002
|
-
scope: (t) => {
|
|
2003
|
-
const e = t.getAttribute("uri"), s = n(e), o = ot.get(s);
|
|
2004
|
-
if (o) return o;
|
|
2005
|
-
if (!a.has(s) && !rt.has(s)) {
|
|
2006
|
-
rt.add(s);
|
|
2007
|
-
const o = g[s];
|
|
2008
|
-
t.warn(o ? `Extension content '${o}' (${e}) is not read; it will be lost on resave.` : `Unknown extension content (uri ${e}) is not read; it will be lost on resave.`);
|
|
2009
|
-
}
|
|
2010
|
-
return null;
|
|
2011
|
-
}
|
|
2012
|
-
}), S.registerVisitor({
|
|
2013
|
-
from: "mergeCell",
|
|
2014
|
-
to: [],
|
|
2015
|
-
openTag: (t) => {
|
|
2016
|
-
const e = t.getAttribute("ref");
|
|
2017
|
-
t.setSource(e);
|
|
2018
|
-
}
|
|
2019
|
-
}), S.registerVisitor({
|
|
2020
|
-
from: "hyperlinks",
|
|
2021
|
-
to: "hyperlinks",
|
|
2022
|
-
openTag: (t) => {
|
|
2023
|
-
t.setSource([]);
|
|
2024
|
-
}
|
|
2025
|
-
}), S.registerVisitor({
|
|
2026
|
-
from: "hyperlink",
|
|
2027
|
-
to: [],
|
|
2028
|
-
openTag: (t) => {
|
|
2029
|
-
const s = t.getAttribute("r:id"), o = t.getAttribute("ref");
|
|
2030
|
-
if (!o) return void t.warn("A hyperlink has no ref; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.noRef" });
|
|
2031
|
-
t.setKey(o);
|
|
2032
|
-
let r = s ? e(s) : "";
|
|
2033
|
-
if ("string" != typeof r) return void t.warn("A hyperlink has an invalid address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
|
|
2034
|
-
r.endsWith("\\") && (r = r.substring(0, r.length - 1));
|
|
2035
|
-
const i = t.getAttribute("location");
|
|
2036
|
-
if (i && (r += "#" + i), !r) return void t.warn("A hyperlink has no address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
|
|
2037
|
-
let n;
|
|
2038
|
-
const a = t.getAttribute("tooltip");
|
|
2039
|
-
n = a ? {
|
|
2040
|
-
address: r,
|
|
2041
|
-
screenTip: a
|
|
2042
|
-
} : r, t.setSource({
|
|
2043
|
-
r: o,
|
|
2044
|
-
v: n
|
|
2045
|
-
});
|
|
2046
|
-
}
|
|
2047
|
-
}), S.registerVisitor({
|
|
2048
|
-
from: "drawing",
|
|
2049
|
-
to: "movables",
|
|
2050
|
-
openTag: (t) => {
|
|
2051
|
-
const s = t.getAttribute("r:id");
|
|
2052
|
-
if (!s) return;
|
|
2053
|
-
const o = e(s);
|
|
2054
|
-
o ? t.setSource(o.movables) : t.warn("A drawing part is missing; its shapes were not imported.", { onceKey: "xlsx.sheet.drawing.missing" });
|
|
2055
|
-
}
|
|
2056
|
-
}), S.registerVisitor({
|
|
2057
|
-
from: "legacyDrawing",
|
|
2058
|
-
to: "legacyDrawing",
|
|
2059
|
-
openTag: (t) => {
|
|
2060
|
-
t.setSource(e(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
|
|
2061
|
-
}
|
|
2062
|
-
}), S.registerVisitor({
|
|
2063
|
-
from: "legacyDrawingHF",
|
|
2064
|
-
to: "legacyDrawingHF",
|
|
2065
|
-
openTag: (t) => {
|
|
2066
|
-
t.setSource(e(t.getAttribute("r:id"), "legacyDrawing") ?? void 0);
|
|
2067
|
-
}
|
|
2068
|
-
});
|
|
2069
|
-
let it = null, nt = !1;
|
|
2070
|
-
const ct = /* @__PURE__ */ new Map(), lt = {
|
|
2071
|
-
from: "Fallback",
|
|
2072
|
-
to: null
|
|
2073
|
-
}, ht = {
|
|
2074
|
-
from: "Choice",
|
|
2075
|
-
transparent: !0
|
|
2076
|
-
};
|
|
2077
|
-
ct.set("Fallback", lt), ct.set("Choice", ht), ct.set("control", {
|
|
2078
|
-
from: "control",
|
|
2079
|
-
transparent: !0,
|
|
2080
|
-
openTag: (t) => {
|
|
2081
|
-
const s = t.getAttribute("name"), o = t.getAttribute("r:id"), r = o ? e(o, "formControl") : null;
|
|
2082
|
-
if (!r) return t.warn(`The form control '${s ?? ""}' has no properties and was not read.`, { onceKey: "xlsx.sheet.control.noProperties" }), void (it = null);
|
|
2083
|
-
const i = r.json, n = parseInt(t.getAttribute("shapeId") ?? "", 10);
|
|
2084
|
-
isNaN(n) || (i.shapeId = n);
|
|
2085
|
-
const a = {
|
|
2086
|
-
anchor: {
|
|
2087
|
-
tl: {
|
|
2088
|
-
c: 0,
|
|
2089
|
-
r: 0,
|
|
2090
|
-
x: 0,
|
|
2091
|
-
y: 0
|
|
2092
|
-
},
|
|
2093
|
-
br: {
|
|
2094
|
-
c: 0,
|
|
2095
|
-
r: 0,
|
|
2096
|
-
x: 0,
|
|
2097
|
-
y: 0
|
|
2098
|
-
}
|
|
2099
|
-
},
|
|
2100
|
-
content: {
|
|
2101
|
-
type: r.type,
|
|
2102
|
-
json: i
|
|
2103
|
-
}
|
|
2104
|
-
};
|
|
2105
|
-
s && (a.content.name = s), it = {
|
|
2106
|
-
movable: a,
|
|
2107
|
-
control: i
|
|
2108
|
-
};
|
|
2109
|
-
},
|
|
2110
|
-
closeTag: () => {
|
|
2111
|
-
it && (t.movables || (t.movables = []), t.movables.push(it.movable), it = null);
|
|
2112
|
-
}
|
|
2113
|
-
}), ct.set("controlPr", {
|
|
2114
|
-
from: "controlPr",
|
|
2115
|
-
transparent: !0,
|
|
2116
|
-
raw: !0,
|
|
2117
|
-
openTag: (t) => {
|
|
2118
|
-
if (!it) return;
|
|
2119
|
-
const e = t.getFrom().attributes ?? {}, s = {};
|
|
2120
|
-
for (const t in e) {
|
|
2121
|
-
const o = e[t];
|
|
2122
|
-
s[t] = "string" == typeof o ? o : o?.value ?? "";
|
|
2123
|
-
}
|
|
2124
|
-
b(s, it.control);
|
|
2125
|
-
},
|
|
2126
|
-
closeTag: (t) => {
|
|
2127
|
-
if (!it) return;
|
|
2128
|
-
const e = ((t) => {
|
|
2129
|
-
const e = /<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(t);
|
|
2130
|
-
if (!e) return null;
|
|
2131
|
-
const s = e[2], o = (t) => new RegExp(`<(?:[\\w.-]+:)?${t}\\b[^>]*>([\\s\\S]*?)<\\/(?:[\\w.-]+:)?${t}>`).exec(s)?.[1], r = e[1], i = /\bmoveWithCells="(?:1|true)"/.test(r), n = /\bsizeWithCells="(?:1|true)"/.test(r);
|
|
2132
|
-
return {
|
|
2133
|
-
anchor: {
|
|
2134
|
-
tl: Le(o("from")),
|
|
2135
|
-
br: Le(o("to"))
|
|
2136
|
-
},
|
|
2137
|
-
anchorType: i ? n ? "twoCell" : "oneCell" : "absolute",
|
|
2138
|
-
rest: (t.slice(0, e.index) + t.slice(e.index + e[0].length)).trim()
|
|
2139
|
-
};
|
|
2140
|
-
})(t.getRawXml() ?? "");
|
|
2141
|
-
e ? (it.movable.anchor = e.anchor, "twoCell" !== e.anchorType && (it.movable.anchorType = e.anchorType), e.rest && (it.control.xml = e.rest)) : nt || (nt = !0, t.warn("A form control has no anchor; it is placed at the top left of the sheet."));
|
|
2142
|
-
}
|
|
2143
|
-
});
|
|
2144
|
-
const ut = {
|
|
2145
|
-
from: "controls",
|
|
2146
|
-
transparent: !0,
|
|
2147
|
-
scope: () => ct
|
|
2148
|
-
};
|
|
2149
|
-
S.registerVisitor(ut);
|
|
2150
|
-
const dt = /* @__PURE__ */ new Map([
|
|
2151
|
-
["Choice", ht],
|
|
2152
|
-
["Fallback", lt],
|
|
2153
|
-
["controls", ut]
|
|
2154
|
-
]);
|
|
2155
|
-
S.registerVisitor({
|
|
2156
|
-
from: "AlternateContent",
|
|
2157
|
-
transparent: !0,
|
|
2158
|
-
scope: () => dt
|
|
2159
|
-
}), S.registerVisitor({
|
|
2160
|
-
from: "tableParts",
|
|
2161
|
-
to: "tables",
|
|
2162
|
-
openTag: (t) => {
|
|
2163
|
-
t.setSource([]);
|
|
2164
|
-
}
|
|
2165
|
-
}), S.registerVisitor({
|
|
2166
|
-
from: "tablePart",
|
|
2167
|
-
to: [],
|
|
2168
|
-
openTag: (t) => {
|
|
2169
|
-
const s = t.getAttribute("r:id");
|
|
2170
|
-
if (!s) return;
|
|
2171
|
-
const o = e(s);
|
|
2172
|
-
o ? t.setSource(o) : t.warn("A table part is missing; the table was not imported.", { onceKey: "xlsx.sheet.table.missing" });
|
|
2173
|
-
}
|
|
2174
|
-
});
|
|
2175
|
-
const pt = (t, e) => {
|
|
2176
|
-
e.conditions?.length && (t.stops = L(e)), void 0 !== e.minLength && (t.minLength = e.minLength), void 0 !== e.maxLength && (t.maxLength = e.maxLength), (e.gradient ?? 1) && (t.gradient = !0), e.border && e.borderColor && (t.borderColor = e.borderColor), !e.negativeBarColorSameAsPositive && e.negativeFillColor && (t.negativeFillColor = e.negativeFillColor), !(e.negativeBarBorderColorSameAsPositive ?? 1) && e.negativeBorderColor && (t.negativeBorderColor = e.negativeBorderColor), e.axisColor && (t.axisColor = e.axisColor), "middle" !== e.axisPosition && "none" !== e.axisPosition || (t.axisPosition = e.axisPosition), "leftToRight" !== e.direction && "rightToLeft" !== e.direction || (t.direction = e.direction);
|
|
2177
|
-
}, ft = (t, e) => {
|
|
2178
|
-
e.conditions?.length && (t.stops = L(e)), e.iconSet && e.iconSet !== t.iconSet && (t.iconSet = e.iconSet), e.icons?.length && (t.icon = e.icons), void 0 !== e.reverse && (t.reverse = e.reverse), void 0 !== e.showValue && (t.showValue = e.showValue);
|
|
2179
|
-
}, gt = (t) => {
|
|
2180
|
-
if (!t.sqref) return null;
|
|
2181
|
-
const e = t.sqref.split(/\s+/).join(",");
|
|
2182
|
-
if ("iconSet" === t.type) {
|
|
2183
|
-
if (!t.iconSet) return null;
|
|
2184
|
-
const s = {
|
|
2185
|
-
type: et.ScaleType.IconSet,
|
|
2186
|
-
stops: []
|
|
2187
|
-
};
|
|
2188
|
-
return ft(s, t.iconSet), {
|
|
2189
|
-
r: e,
|
|
2190
|
-
v: { scale: s },
|
|
2191
|
-
priority: t.priority
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
const s = I(t, m);
|
|
2195
|
-
if (!s) return null;
|
|
2196
|
-
const o = { condition: s };
|
|
2197
|
-
return t.style && (o.style = t.style), t.stopIfTrue && (o.stopIfTrue = !0), {
|
|
2198
|
-
r: e,
|
|
2199
|
-
v: o,
|
|
2200
|
-
priority: t.priority
|
|
2201
|
-
};
|
|
2202
|
-
};
|
|
2203
|
-
S.registerVisitor({
|
|
2204
|
-
from: "worksheet",
|
|
2205
|
-
to: {},
|
|
2206
|
-
openTag: (t) => {},
|
|
2207
|
-
closeTag: (t) => {
|
|
2208
|
-
const e = t.getSource();
|
|
2209
|
-
let s = e?.conditionals;
|
|
2210
|
-
if (s) for (let t = 0; t < s.length; t++) {
|
|
2211
|
-
const e = s[t], o = e.x14Id;
|
|
2212
|
-
if (!o) continue;
|
|
2213
|
-
delete e.x14Id;
|
|
2214
|
-
const r = U.get(o);
|
|
2215
|
-
if (!r) continue;
|
|
2216
|
-
U.delete(o);
|
|
2217
|
-
const i = e.v?.scale;
|
|
2218
|
-
r.dataBar && i?.type === et.ScaleType.DataBar ? pt(i, r.dataBar) : r.iconSet && i?.type === et.ScaleType.IconSet && ft(i, r.iconSet);
|
|
2219
|
-
}
|
|
2220
|
-
const o = [...U.values(), ...G], r = /* @__PURE__ */ new Set();
|
|
2221
|
-
let i = 0;
|
|
2222
|
-
for (let t = 0; t < o.length; t++) {
|
|
2223
|
-
const n = gt(o[t]);
|
|
2224
|
-
n ? (s || (s = [], e.conditionals = s), s.push(n)) : (r.add(o[t].type ?? "unknown"), i++);
|
|
2225
|
-
}
|
|
2226
|
-
if (i > 0) {
|
|
2227
|
-
const t = [...r].map((t) => `'${t}'`).join(", ");
|
|
2228
|
-
m?.(1 === i ? `An x14-only conditional formatting rule (type ${t}) is not read and will be lost on resave.` : `${i} x14-only conditional formatting rules (types ${t}) are not read and will be lost on resave.`);
|
|
2229
|
-
}
|
|
2230
|
-
if (s) {
|
|
2231
|
-
s.length > 1 && s.sort((t, e) => (t.priority ?? Infinity) - (e.priority ?? Infinity));
|
|
2232
|
-
for (let t = 0; t < s.length; t++) delete s[t].priority;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
}), S.registerVisitor({
|
|
2236
|
-
from: "customProperties",
|
|
2237
|
-
to: "customProperties",
|
|
2238
|
-
openTag: (t) => {
|
|
2239
|
-
t.setSource([]);
|
|
2240
|
-
},
|
|
2241
|
-
closeTag: (t) => {
|
|
2242
|
-
const e = t.getSource();
|
|
2243
|
-
if (e.length > 0) t.getParent().customProperties = e;
|
|
2244
|
-
}
|
|
2245
|
-
}), S.registerVisitor({
|
|
2246
|
-
from: "customPr",
|
|
2247
|
-
to: {},
|
|
2248
|
-
openTag: (t) => {
|
|
2249
|
-
const s = t.getParent();
|
|
2250
|
-
t.copyTo("name");
|
|
2251
|
-
const o = t.getAttribute("r:id");
|
|
2252
|
-
if (!o) return void t.warn("A custom property names no part; it was not imported.", { onceKey: "xlsx.sheet.customProperty.noRel" });
|
|
2253
|
-
const r = e(o, "resource"), i = t.getSource();
|
|
2254
|
-
i.resId = r, s.push(i);
|
|
2255
|
-
}
|
|
2256
|
-
}), S.registerVisitor({
|
|
2257
|
-
from: "sheetProtection",
|
|
2258
|
-
to: "protection",
|
|
2259
|
-
openTag: (t) => {
|
|
2260
|
-
const e = t.getSource();
|
|
2261
|
-
for (const s of C) {
|
|
2262
|
-
const o = t.hasAttribute(s.attribute) ? t.getAttribute(s.attribute) : null;
|
|
2263
|
-
e[s.key] = E(s, o);
|
|
2264
|
-
}
|
|
2265
|
-
if (e.sheet) return;
|
|
2266
|
-
const s = {};
|
|
2267
|
-
if (t.copyToObject(s, "hash", Se, "hashValue"), t.copyToObject(s, "algorithm", Se, "algorithmName"), t.copyToObject(s, "salt", Se, "saltValue"), t.copyToObject(s, "spinCount", ve), Object.keys(s).length > 0) t.getSource().password = s;
|
|
2268
|
-
}
|
|
2269
|
-
}), S.registerVisitor({
|
|
2270
|
-
from: "protectedRanges",
|
|
2271
|
-
to: "protectedRanges",
|
|
2272
|
-
openTag: (t) => {
|
|
2273
|
-
t.setSource([]);
|
|
2274
|
-
}
|
|
2275
|
-
}), S.registerVisitor({
|
|
2276
|
-
from: "protectedRange",
|
|
2277
|
-
to: [],
|
|
2278
|
-
openTag: (t) => {
|
|
2279
|
-
let e = t.getAttribute("sqref");
|
|
2280
|
-
e && (e = e.trim().split(/\s+/).join(","));
|
|
2281
|
-
const s = {}, o = {
|
|
2282
|
-
r: e,
|
|
2283
|
-
v: s
|
|
2284
|
-
};
|
|
2285
|
-
t.copyToObject(s, "name"), t.copyToObject(s, "securityDescriptor");
|
|
2286
|
-
const r = {};
|
|
2287
|
-
t.copyToObject(r, "hash", Se, "hashValue"), t.copyToObject(r, "algorithm", Se, "algorithmName"), t.copyToObject(r, "salt", Se, "saltValue"), t.copyToObject(r, "spinCount", ve), Object.keys(r).length > 0 && (s.password = r), t.setSource(o);
|
|
2288
|
-
},
|
|
2289
|
-
closeTag: (t) => {
|
|
2290
|
-
const e = t.getSource();
|
|
2291
|
-
e?.r && e.v.name || t.setSource(void 0);
|
|
2292
|
-
}
|
|
2293
|
-
}), S.registerVisitor({
|
|
2294
|
-
from: "sheetFormatPr",
|
|
2295
|
-
to: "sheetFormatPr",
|
|
2296
|
-
openTag: (e) => {
|
|
2297
|
-
e.copyToObject(t, "defaultColSize", we, "defaultColWidth");
|
|
2298
|
-
const s = e.getAttribute("customHeight");
|
|
2299
|
-
"1" !== s && "true" !== s || e.copyToObject(t, "defaultRowSize", we, "defaultRowHeight");
|
|
2300
|
-
}
|
|
2301
|
-
}), S.registerVisitor({
|
|
2302
|
-
from: "cols",
|
|
2303
|
-
to: "cols",
|
|
2304
|
-
openTag: (t) => {
|
|
2305
|
-
t.setSource([]);
|
|
2306
|
-
}
|
|
2307
|
-
}), S.registerVisitor({
|
|
2308
|
-
from: "col",
|
|
2309
|
-
to: [],
|
|
2310
|
-
openTag: (t) => {
|
|
2311
|
-
const e = t.getSource(), s = t.getAttribute("min"), o = t.getAttribute("max"), r = void 0 === s ? 0 : parseInt(s) - 1, i = void 0 === o ? r : parseInt(o) - 1;
|
|
2312
|
-
e.r = J.runToString(r, i, !0);
|
|
2313
|
-
const n = {};
|
|
2314
|
-
e.v = n, t.copyToObject(n, "sz", we, "width"), t.copyToObject(n, "csz", Te, "customWidth"), t.copyToObject(n, "h", Te, "hidden"), t.copyToObject(n, "l", ve, "outlineLevel"), t.copyToObject(n, "cl", Te, "collapsed"), t.copyToObject(n, "s", ve, "style");
|
|
2315
|
-
}
|
|
2316
|
-
}), S.registerVisitor({
|
|
2317
|
-
from: "oleObjects",
|
|
2318
|
-
to: null,
|
|
2319
|
-
openTag: (t) => {
|
|
2320
|
-
t.warn("'OLE Objects' are not supported.");
|
|
2321
|
-
}
|
|
2322
|
-
});
|
|
2323
|
-
let mt = !1, xt = !1, yt = 0, bt = "";
|
|
2324
|
-
const Tt = (t) => {
|
|
2325
|
-
const e = t.indexOf(":");
|
|
2326
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
2327
|
-
};
|
|
2328
|
-
return Me(O, t, S.createEventHandler(t, r, m), m, T, {
|
|
2329
|
-
onOpenTag: (t) => {
|
|
2330
|
-
mt = !0;
|
|
2331
|
-
const e = Tt(t.name);
|
|
2332
|
-
"t" === e || "v" === e ? 0 === yt && (xt = !0) : "rPh" !== e && "phoneticPr" !== e || yt++;
|
|
2333
|
-
},
|
|
2334
|
-
onText: (t) => {
|
|
2335
|
-
xt && (bt += t);
|
|
2336
|
-
},
|
|
2337
|
-
onCloseTag: (t) => {
|
|
2338
|
-
const e = Tt(t.name);
|
|
2339
|
-
"t" === e || "v" === e ? xt = !1 : "rPh" !== e && "phoneticPr" !== e || yt > 0 && yt--;
|
|
2340
|
-
},
|
|
2341
|
-
onEnd: () => {
|
|
2342
|
-
if (!mt) return;
|
|
2343
|
-
const t = s(_(bt));
|
|
2344
|
-
return mt = !1, xt = !1, yt = 0, bt = "", t;
|
|
2345
|
-
},
|
|
2346
|
-
onError: (t) => {}
|
|
2347
|
-
}, w);
|
|
2348
|
-
}, Re = class {
|
|
2349
|
-
static {
|
|
2350
|
-
this.Collapsed = 1;
|
|
2351
|
-
}
|
|
2352
|
-
static {
|
|
2353
|
-
this.CustomFormat = 2;
|
|
2354
|
-
}
|
|
2355
|
-
static {
|
|
2356
|
-
this.CustomHeight = 4;
|
|
2357
|
-
}
|
|
2358
|
-
static {
|
|
2359
|
-
this.Hidden = 8;
|
|
2360
|
-
}
|
|
2361
|
-
static {
|
|
2362
|
-
this.Ht = 16;
|
|
2363
|
-
}
|
|
2364
|
-
static {
|
|
2365
|
-
this.OutlineLevel = 32;
|
|
2366
|
-
}
|
|
2367
|
-
static {
|
|
2368
|
-
this.Ph = 64;
|
|
2369
|
-
}
|
|
2370
|
-
static {
|
|
2371
|
-
this.R = 128;
|
|
2372
|
-
}
|
|
2373
|
-
static {
|
|
2374
|
-
this.S = 256;
|
|
2375
|
-
}
|
|
2376
|
-
static {
|
|
2377
|
-
this.Spans = 512;
|
|
2378
|
-
}
|
|
2379
|
-
static {
|
|
2380
|
-
this.ThickBot = 1024;
|
|
2381
|
-
}
|
|
2382
|
-
static {
|
|
2383
|
-
this.ThickTop = 2048;
|
|
2384
|
-
}
|
|
2385
|
-
}, Be = (t, e, s) => {
|
|
2386
|
-
if (t[0].value[0] === t[1].value[0]) return e;
|
|
2387
|
-
}, je = {
|
|
2388
|
-
colStart: 0,
|
|
2389
|
-
colEnd: 0,
|
|
2390
|
-
rowStart: 0,
|
|
2391
|
-
rowEnd: 0
|
|
2392
|
-
}, Me = (t, e, s, o, r, i, n) => {
|
|
2393
|
-
let a = !1, c = !1, l = [], h = !1, u = null, d = null, p = null, f = null, g = null, m = null;
|
|
2394
|
-
const x = n?.get("richData") ?? Z.EmptyArray, y = n?.get("dummyWrapped") ?? null, b = J.normalizeA1ToR1C1, T = Q.createConflatingRanges(), v = /* @__PURE__ */ new Map(), w = [];
|
|
2395
|
-
let S = !1, C = !1, k = null;
|
|
2396
|
-
let A = !1;
|
|
2397
|
-
const E = Q.createConflatingRanges();
|
|
2398
|
-
let P = !1, O = -1, I = -1, D = null, _ = null, V = null;
|
|
2399
|
-
const L = [];
|
|
2400
|
-
let N = null, $ = -2, R = 0, B = "", j = "", M = "", H = "", F = "", W = "", z = "", X = "", q = "", U = "", G = "", K = "", tt = "", et = "", ot = !0, rt = null, it = !1, nt = !1, at = !1, ct = null, lt = 0;
|
|
2401
|
-
const ht = (t) => {
|
|
2402
|
-
let o = t.name;
|
|
2403
|
-
const p = o.indexOf(":");
|
|
2404
|
-
if (-1 !== p && (o = o.slice(p + 1)), lt++, lt % 196608 == 0 && r?.(lt), _) {
|
|
2405
|
-
const e = t.attributes;
|
|
2406
|
-
switch (o) {
|
|
2407
|
-
case "v":
|
|
2408
|
-
c = !0;
|
|
2409
|
-
break;
|
|
2410
|
-
case "f":
|
|
2411
|
-
switch (h = !0, e.t ?? null) {
|
|
2412
|
-
case null:
|
|
2413
|
-
case "normal": break;
|
|
2414
|
-
case "shared":
|
|
2415
|
-
const t = e.si;
|
|
2416
|
-
d = e.ref, u = t;
|
|
2417
|
-
break;
|
|
2418
|
-
case "array":
|
|
2419
|
-
d = e.ref, k = d;
|
|
2420
|
-
break;
|
|
2421
|
-
case "datatable": d = e.ref, h = !0;
|
|
2422
|
-
}
|
|
2423
|
-
const t = e.ca;
|
|
2424
|
-
void 0 !== t && (A = "1" === t);
|
|
2425
|
-
break;
|
|
2426
|
-
case "is":
|
|
2427
|
-
P = !0;
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
P && !h && i?.onOpenTag?.(t);
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
if (a) {
|
|
2434
|
-
if ("c" === o) {
|
|
2435
|
-
_ = t;
|
|
2436
|
-
const e = t.attributes, s = e.r;
|
|
2437
|
-
I = J.fastStringToCol(s);
|
|
2438
|
-
const o = e.t;
|
|
2439
|
-
void 0 === o ? V = null : (V = o, "str" === V && (P = !0));
|
|
2440
|
-
let r = e.s;
|
|
2441
|
-
void 0 === r && (null !== ct || at) && (r = "0"), void 0 !== r && (r = parseInt(r), rt && rt.value === r && rt.colEnd + 1 === I ? rt.colEnd = I : (rt = {
|
|
2442
|
-
colStart: I,
|
|
2443
|
-
rowStart: O,
|
|
2444
|
-
colEnd: I,
|
|
2445
|
-
rowEnd: O,
|
|
2446
|
-
value: r
|
|
2447
|
-
}, l.push(rt))), k = null, C = !1;
|
|
2448
|
-
const i = e.cm;
|
|
2449
|
-
S = void 0 !== i && ((t) => {
|
|
2450
|
-
const e = (n?.get("metadata"))?.cells;
|
|
2451
|
-
if (!e) return !1;
|
|
2452
|
-
const s = parseInt(t, 10);
|
|
2453
|
-
return !(!Number.isFinite(s) || s < 1) && !0 === (e[s - 1]?.get("XLDAPR"))?.fDynamic;
|
|
2454
|
-
})(i);
|
|
2455
|
-
const a = e.vm;
|
|
2456
|
-
if (void 0 !== a) {
|
|
2457
|
-
const t = x[parseInt(a) - 1];
|
|
2458
|
-
if (Y.isError(t)) {
|
|
2459
|
-
const e = t.getCode();
|
|
2460
|
-
D = {
|
|
2461
|
-
t: "e",
|
|
2462
|
-
v: e
|
|
2463
|
-
}, S && e === Y.Code.Spill && (C = !0);
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
} else {
|
|
2468
|
-
if (nt && "row" === o) {
|
|
2469
|
-
a = !0;
|
|
2470
|
-
const e = t.attributes.r;
|
|
2471
|
-
if (O = parseInt(e) - 1, R = 0, j = t.attributes.customHeight, void 0 !== j && (R |= Re.CustomHeight), j !== q && (ot = !0, q = j), B = t.attributes.ht, void 0 !== B && (R |= Re.Ht), B !== X && (ot = !0, X = B), M = t.attributes.hidden, void 0 !== M && (R |= Re.Hidden), M !== U && (ot = !0, U = M), F = t.attributes.s, void 0 !== F && (R |= Re.S), F !== K && (ot = !0, K = F), H = t.attributes.customFormat, void 0 !== H && (R |= Re.CustomFormat), H !== G && (ot = !0, G = H), W = t.attributes.outlineLevel, void 0 !== W && (R |= Re.OutlineLevel), W !== tt && (ot = !0, tt = W), z = t.attributes.collapsed, void 0 !== z && (R |= Re.Collapsed), z !== et && (ot = !0, et = z), 0 !== R) if ($ + 1 !== O || ot) {
|
|
2472
|
-
const t = void 0 !== j && ("1" === j || "true" === j), e = void 0 !== H && ("1" === H || "true" === H);
|
|
2473
|
-
ct = e && void 0 !== F ? F : null, e && null === ct && (ct = "0"), N = {
|
|
2474
|
-
min: O,
|
|
2475
|
-
max: O,
|
|
2476
|
-
value: {
|
|
2477
|
-
sz: void 0 === B ? -1 : parseFloat(B),
|
|
2478
|
-
csz: t,
|
|
2479
|
-
h: void 0 !== M && ("1" === M || "true" === M),
|
|
2480
|
-
s: null === ct ? void 0 : "0" === ct ? 0 : parseInt(ct),
|
|
2481
|
-
l: void 0 === W || "0" === W ? 0 : parseInt(W),
|
|
2482
|
-
cl: void 0 !== z && ("1" === z || "true" === z)
|
|
2483
|
-
}
|
|
2484
|
-
}, L.push(N);
|
|
2485
|
-
} else N.max = O;
|
|
2486
|
-
$ = O, ot = !1;
|
|
2487
|
-
return;
|
|
2488
|
-
}
|
|
2489
|
-
if ("sheetData" === o && (nt = !0), !it && "sheetData" === o) {
|
|
2490
|
-
it = !0;
|
|
2491
|
-
const t = e.cols, s = t ? t.length : 0;
|
|
2492
|
-
for (let e = 0; !at && e < s; e++) t[e].v.s && (at = !0);
|
|
2493
|
-
}
|
|
2494
|
-
s?.onOpenTag?.(t);
|
|
2495
|
-
}
|
|
2496
|
-
}, ut = (e) => {
|
|
2497
|
-
let o = e.name;
|
|
2498
|
-
if ("sheetData" === o && (nt = !1), !h || "c" !== o && "f" !== o || (u && (f = v.get(u) ?? null), f && (T.append(O, I, f), A && E.append(O, I)), null !== k && w.push([k, S ? C ? "error" : "dynamic" : "fixed"]), h = !1, f = null, u = null, d = null, c = !1, A = !1, k = null, S = !1, C = !1), _) {
|
|
2499
|
-
const s = o.indexOf(":");
|
|
2500
|
-
if (-1 !== s && (o = o.slice(s + 1)), P) if ("is" === o || "v" === o) {
|
|
2501
|
-
const e = i?.onEnd?.();
|
|
2502
|
-
null != e && t.pushAt(O, I, "" + e);
|
|
2503
|
-
} else "f" !== o && i?.onCloseTag?.(e);
|
|
2504
|
-
c && (c = !1), "c" === o && (_ = null, P = !1);
|
|
2505
|
-
return;
|
|
2506
|
-
}
|
|
2507
|
-
if (a) return a = !1, void (rt = null);
|
|
2508
|
-
s?.onCloseTag?.(e);
|
|
2509
|
-
}, dt = (r) => {
|
|
2510
|
-
const n = r.trim();
|
|
2511
|
-
if (c) {
|
|
2512
|
-
switch (D = null, V) {
|
|
2513
|
-
case null:
|
|
2514
|
-
case "n":
|
|
2515
|
-
D = parseFloat(n);
|
|
2516
|
-
break;
|
|
2517
|
-
case "b":
|
|
2518
|
-
D = "1" === n || "true" === n;
|
|
2519
|
-
break;
|
|
2520
|
-
case "s":
|
|
2521
|
-
D = n;
|
|
2522
|
-
break;
|
|
2523
|
-
case "e":
|
|
2524
|
-
if ("#VALUE!" === n) {
|
|
2525
|
-
const t = _.attributes.vm;
|
|
2526
|
-
if (void 0 !== t) {
|
|
2527
|
-
const e = x[parseInt(t) - 1];
|
|
2528
|
-
if (Y.isError(e)) {
|
|
2529
|
-
D = {
|
|
2530
|
-
t: "e",
|
|
2531
|
-
v: e.getCode()
|
|
2532
|
-
};
|
|
2533
|
-
break;
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
const t = Y.getBuiltInByLabel(n);
|
|
2538
|
-
t ? D = {
|
|
2539
|
-
t: "e",
|
|
2540
|
-
v: t.getCode()
|
|
2541
|
-
} : (D = n, o?.(`Unknown formula error '${n}' in cell ${J.cellToString({
|
|
2542
|
-
colIndex: I,
|
|
2543
|
-
rowIndex: O
|
|
2544
|
-
})}`));
|
|
2545
|
-
break;
|
|
2546
|
-
case "str":
|
|
2547
|
-
case "inlineStr": P = !0;
|
|
2548
|
-
}
|
|
2549
|
-
null !== D && t.pushAt(O, I, D);
|
|
2550
|
-
}
|
|
2551
|
-
if (u) {
|
|
2552
|
-
if (g === u) f = m;
|
|
2553
|
-
else {
|
|
2554
|
-
if (f = v.get(u) ?? null, !f) {
|
|
2555
|
-
const t = [];
|
|
2556
|
-
p = b(n, O, I, t), f = [
|
|
2557
|
-
p,
|
|
2558
|
-
t,
|
|
2559
|
-
n
|
|
2560
|
-
], v.set(u, f);
|
|
2561
|
-
}
|
|
2562
|
-
g = u, m = f;
|
|
2563
|
-
}
|
|
2564
|
-
u = null;
|
|
2565
|
-
}
|
|
2566
|
-
if (h) {
|
|
2567
|
-
if (null !== y) {
|
|
2568
|
-
const t = ((t) => {
|
|
2569
|
-
if (t.length < Ee.length) return Ie;
|
|
2570
|
-
if (t.slice(0, Ee.length).toUpperCase() !== Pe) return Ie;
|
|
2571
|
-
const e = _e(t, Ee.length);
|
|
2572
|
-
if (null === e) return Ie;
|
|
2573
|
-
if (41 !== t.charCodeAt(e.end)) return Ie;
|
|
2574
|
-
if (44 !== t.charCodeAt(e.end + 1)) return Ie;
|
|
2575
|
-
if (41 !== t.charCodeAt(t.length - 1)) return Ie;
|
|
2576
|
-
const s = e.value;
|
|
2577
|
-
return s.toUpperCase() === Oe ? De : 0 === s.length ? Ie : {
|
|
2578
|
-
kind: "formula",
|
|
2579
|
-
formula: s
|
|
2580
|
-
};
|
|
2581
|
-
})(n);
|
|
2582
|
-
"none" !== t.kind && y.push({
|
|
2583
|
-
sheet: e,
|
|
2584
|
-
rowIndex: O,
|
|
2585
|
-
colIndex: I,
|
|
2586
|
-
formula: "formula" === t.kind ? t.formula : null
|
|
2587
|
-
});
|
|
2588
|
-
}
|
|
2589
|
-
const t = [];
|
|
2590
|
-
p = b(n, O, I, t), f = [
|
|
2591
|
-
p,
|
|
2592
|
-
t,
|
|
2593
|
-
n
|
|
2594
|
-
];
|
|
2595
|
-
}
|
|
2596
|
-
P ? i?.onText?.(r) : a || s?.onText?.(n);
|
|
2597
|
-
}, pt = {
|
|
2598
|
-
r: void 0,
|
|
2599
|
-
t: void 0,
|
|
2600
|
-
s: void 0,
|
|
2601
|
-
cm: void 0,
|
|
2602
|
-
vm: void 0
|
|
2603
|
-
}, ft = {
|
|
2604
|
-
name: "c",
|
|
2605
|
-
attributes: pt,
|
|
2606
|
-
isSelfClosing: !1
|
|
2607
|
-
}, gt = {
|
|
2608
|
-
t: void 0,
|
|
2609
|
-
si: void 0,
|
|
2610
|
-
ref: void 0,
|
|
2611
|
-
ca: void 0
|
|
2612
|
-
}, mt = {
|
|
2613
|
-
name: "f",
|
|
2614
|
-
attributes: gt,
|
|
2615
|
-
isSelfClosing: !1
|
|
2616
|
-
}, xt = {
|
|
2617
|
-
name: "v",
|
|
2618
|
-
attributes: {},
|
|
2619
|
-
isSelfClosing: !1
|
|
2620
|
-
}, yt = {
|
|
2621
|
-
r: void 0,
|
|
2622
|
-
s: void 0,
|
|
2623
|
-
ht: void 0,
|
|
2624
|
-
hidden: void 0,
|
|
2625
|
-
collapsed: void 0,
|
|
2626
|
-
customHeight: void 0,
|
|
2627
|
-
customFormat: void 0,
|
|
2628
|
-
outlineLevel: void 0
|
|
2629
|
-
}, bt = {
|
|
2630
|
-
name: "row",
|
|
2631
|
-
attributes: yt,
|
|
2632
|
-
isSelfClosing: !1
|
|
2633
|
-
}, Tt = be.NEED_MORE, vt = be.NOT_HANDLED, wt = be.decodeText;
|
|
2634
|
-
let St = !1;
|
|
2635
|
-
const Ct = (t, e, s, o) => {
|
|
2636
|
-
for (;;) {
|
|
2637
|
-
let r = 0;
|
|
2638
|
-
for (; e < s && (32 === (r = t.charCodeAt(e)) || 9 === r || 10 === r || 13 === r);) e++;
|
|
2639
|
-
if (e >= s) return Tt;
|
|
2640
|
-
if (62 === r) return St = !1, e + 1;
|
|
2641
|
-
if (47 === r) return e + 1 >= s ? Tt : 62 !== t.charCodeAt(e + 1) ? vt : (St = !0, e + 2);
|
|
2642
|
-
const i = e;
|
|
2643
|
-
for (; e < s && 61 !== (r = t.charCodeAt(e));) {
|
|
2644
|
-
if (62 === r || 47 === r || 32 === r || 9 === r || 10 === r || 13 === r) return vt;
|
|
2645
|
-
e++;
|
|
2646
|
-
}
|
|
2647
|
-
if (e + 1 >= s) return Tt;
|
|
2648
|
-
const n = e - i, a = t.charCodeAt(e + 1);
|
|
2649
|
-
if (34 !== a && 39 !== a) return vt;
|
|
2650
|
-
const c = e + 2;
|
|
2651
|
-
let l = c;
|
|
2652
|
-
for (; l < s && (r = t.charCodeAt(l)) !== a;) {
|
|
2653
|
-
if (38 === r || r < 32) return vt;
|
|
2654
|
-
l++;
|
|
2655
|
-
}
|
|
2656
|
-
if (l >= s) return Tt;
|
|
2657
|
-
e = l + 1;
|
|
2658
|
-
const h = t.charCodeAt(i);
|
|
2659
|
-
if (2 === o) switch (n) {
|
|
2660
|
-
case 1:
|
|
2661
|
-
114 === h ? yt.r = t.slice(c, l) : 115 === h && (yt.s = t.slice(c, l));
|
|
2662
|
-
break;
|
|
2663
|
-
case 2:
|
|
2664
|
-
t.startsWith("ht", i) && (yt.ht = t.slice(c, l));
|
|
2665
|
-
break;
|
|
2666
|
-
case 6:
|
|
2667
|
-
t.startsWith("hidden", i) && (yt.hidden = t.slice(c, l));
|
|
2668
|
-
break;
|
|
2669
|
-
case 9:
|
|
2670
|
-
t.startsWith("collapsed", i) && (yt.collapsed = t.slice(c, l));
|
|
2671
|
-
break;
|
|
2672
|
-
case 12: t.startsWith("customHeight", i) ? yt.customHeight = t.slice(c, l) : t.startsWith("customFormat", i) ? yt.customFormat = t.slice(c, l) : t.startsWith("outlineLevel", i) && (yt.outlineLevel = t.slice(c, l));
|
|
2673
|
-
}
|
|
2674
|
-
else if (0 === o) 1 === n ? 114 === h ? pt.r = t.slice(c, l) : 116 === h ? pt.t = t.slice(c, l) : 115 === h && (pt.s = t.slice(c, l)) : 2 === n && 109 === t.charCodeAt(i + 1) && (99 === h ? pt.cm = t.slice(c, l) : 118 === h && (pt.vm = t.slice(c, l)));
|
|
2675
|
-
else if (1 === n) 116 === h && (gt.t = t.slice(c, l));
|
|
2676
|
-
else if (2 === n) {
|
|
2677
|
-
const e = t.charCodeAt(i + 1);
|
|
2678
|
-
115 === h && 105 === e ? gt.si = t.slice(c, l) : 99 === h && 97 === e && (gt.ca = t.slice(c, l));
|
|
2679
|
-
} else 3 === n && t.startsWith("ref", i) && (gt.ref = t.slice(c, l));
|
|
2680
|
-
}
|
|
2681
|
-
}, kt = (t, e, s) => 47 === t.charCodeAt(e + 1) && t.charCodeAt(e + 2) === s && 62 === t.charCodeAt(e + 3);
|
|
2682
|
-
return {
|
|
2683
|
-
...s,
|
|
2684
|
-
onEnd: () => {
|
|
2685
|
-
L.length > 0 && (e.rows = J.runsToRefs(L, !1));
|
|
2686
|
-
let o = T.done(Be);
|
|
2687
|
-
const r = o.length;
|
|
2688
|
-
if (r > 0) {
|
|
2689
|
-
const t = new Array(r);
|
|
2690
|
-
for (let e = 0; e < r; e++) {
|
|
2691
|
-
const s = o[e], r = J.rangeToString(s), i = s.value[1];
|
|
2692
|
-
t[e] = [r, J.resolveRelativeToA1(i, s.rowStart, s.colStart)];
|
|
2693
|
-
}
|
|
2694
|
-
e.formulas = t;
|
|
2695
|
-
}
|
|
2696
|
-
const i = E.done(!0), n = i.length;
|
|
2697
|
-
if (n > 0) {
|
|
2698
|
-
const t = new Array(n);
|
|
2699
|
-
for (let e = 0; e < n; e++) {
|
|
2700
|
-
const s = i[e];
|
|
2701
|
-
t[e] = J.rangeToString(s);
|
|
2702
|
-
}
|
|
2703
|
-
e.volatile = t;
|
|
2704
|
-
}
|
|
2705
|
-
w.length > 0 && (e.formulaArray = [...w]);
|
|
2706
|
-
const a = l.length;
|
|
2707
|
-
if (a > 0) {
|
|
2708
|
-
l.sort(Q.createRangeComparator(st.Axis.Column));
|
|
2709
|
-
let t = l[0], s = t.colStart, o = t.colEnd, r = t.rowEnd, i = t.value;
|
|
2710
|
-
const n = [];
|
|
2711
|
-
n.push(t);
|
|
2712
|
-
let c = null;
|
|
2713
|
-
for (let e = 1; e < a; e++) c = l[e], i !== c.value || s !== c.colStart || o !== c.colEnd || r + 1 !== c.rowEnd ? (n.push(c), t = c, s = t.colStart, o = t.colEnd, r = t.rowEnd, i = t.value) : (r = c.rowEnd, t.rowEnd = r);
|
|
2714
|
-
const h = n.length, u = new Array(h);
|
|
2715
|
-
for (let t = 0; t < h; t++) {
|
|
2716
|
-
const e = n[t];
|
|
2717
|
-
u[t] = [J.rangeToString(e), e.value];
|
|
2718
|
-
}
|
|
2719
|
-
e.directStyles = u;
|
|
2720
|
-
}
|
|
2721
|
-
const c = t.build();
|
|
2722
|
-
c && (e.data = c.tuples), s?.onEnd?.();
|
|
2723
|
-
},
|
|
2724
|
-
onOpenTag: ht,
|
|
2725
|
-
onCloseTag: ut,
|
|
2726
|
-
onText: dt,
|
|
2727
|
-
elementScanners: [{
|
|
2728
|
-
name: "c",
|
|
2729
|
-
scan: (t, e, s) => {
|
|
2730
|
-
if (!a || null !== _) return vt;
|
|
2731
|
-
pt.r = pt.t = pt.s = pt.cm = pt.vm = void 0;
|
|
2732
|
-
let o = Ct(t, e + 2, s, 0);
|
|
2733
|
-
if (o < 0) return o;
|
|
2734
|
-
const r = pt.t;
|
|
2735
|
-
if (void 0 === pt.r || "str" === r || "inlineStr" === r) return vt;
|
|
2736
|
-
let i = !1, n = -1, c = -1, l = -1, h = -1, u = o;
|
|
2737
|
-
if (!St) for (gt.t = gt.si = gt.ref = gt.ca = void 0;;) {
|
|
2738
|
-
const e = t.indexOf("<", o);
|
|
2739
|
-
if (-1 === e || e + 3 >= s) return Tt;
|
|
2740
|
-
for (let s = o; s < e; s++) {
|
|
2741
|
-
const e = t.charCodeAt(s);
|
|
2742
|
-
if (32 !== e && 9 !== e && 10 !== e && 13 !== e) return vt;
|
|
2743
|
-
}
|
|
2744
|
-
const r = t.charCodeAt(e + 1), a = t.charCodeAt(e + 2);
|
|
2745
|
-
if (47 === r) {
|
|
2746
|
-
if (!kt(t, e, 99)) return vt;
|
|
2747
|
-
u = e + 4;
|
|
2748
|
-
break;
|
|
2749
|
-
}
|
|
2750
|
-
if (102 === r && !i && -1 === l && (32 === a || 62 === a || 47 === a)) {
|
|
2751
|
-
if (i = !0, o = Ct(t, e + 2, s, 1), o < 0) return o;
|
|
2752
|
-
if (St) continue;
|
|
2753
|
-
const r = t.indexOf("<", o);
|
|
2754
|
-
if (-1 === r || r + 3 >= s) return Tt;
|
|
2755
|
-
if (!kt(t, r, 102)) return vt;
|
|
2756
|
-
n = o, c = r, o = r + 4;
|
|
2757
|
-
continue;
|
|
2758
|
-
}
|
|
2759
|
-
if (118 === r && 62 === a && -1 === l) {
|
|
2760
|
-
const r = t.indexOf("<", e + 3);
|
|
2761
|
-
if (-1 === r || r + 3 >= s) return Tt;
|
|
2762
|
-
if (!kt(t, r, 118)) return vt;
|
|
2763
|
-
l = e + 3, h = r, o = r + 4;
|
|
2764
|
-
continue;
|
|
2765
|
-
}
|
|
2766
|
-
return vt;
|
|
2767
|
-
}
|
|
2768
|
-
return ht(ft), i && (ht(mt), c > n && dt(wt(t.slice(n, c))), ut(mt)), -1 !== l && (ht(xt), h > l && dt(wt(t.slice(l, h))), ut(xt)), ut(ft), u;
|
|
2769
|
-
}
|
|
2770
|
-
}, {
|
|
2771
|
-
name: "row",
|
|
2772
|
-
openTag: bt,
|
|
2773
|
-
scan: (t, e, s) => {
|
|
2774
|
-
if (!nt || a || null !== _) return vt;
|
|
2775
|
-
yt.r = yt.s = yt.ht = yt.hidden = yt.collapsed = yt.customHeight = yt.customFormat = yt.outlineLevel = void 0;
|
|
2776
|
-
const o = Ct(t, e + 4, s, 2);
|
|
2777
|
-
return o < 0 ? o : St || void 0 === yt.r ? vt : (ht(bt), o);
|
|
2778
|
-
}
|
|
2779
|
-
}]
|
|
2780
|
-
};
|
|
2781
|
-
}, He = (t) => {
|
|
2782
|
-
const e = t.indexOf(":");
|
|
2783
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
2784
|
-
}, Fe = {
|
|
2785
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
|
|
2786
|
-
"application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
|
|
2787
|
-
"application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
|
|
2788
|
-
"application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
|
|
2789
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
|
|
2790
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
|
|
2791
|
-
"application/vnd.ms-excel.worksheet": "sheets",
|
|
2792
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
|
|
2793
|
-
"application/vnd.ms-excel.chartsheet": "charts",
|
|
2794
|
-
"application/vnd.ms-excel.macrosheet+xml": "macros",
|
|
2795
|
-
"application/vnd.ms-excel.macrosheet": "macros",
|
|
2796
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
|
|
2797
|
-
"application/vnd.ms-excel.dialogsheet": "dialogs",
|
|
2798
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
|
|
2799
|
-
"application/vnd.ms-excel.sharedStrings": "strs",
|
|
2800
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
|
|
2801
|
-
"application/vnd.ms-excel.styles": "styles",
|
|
2802
|
-
"application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
|
|
2803
|
-
"application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
|
|
2804
|
-
"application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
|
|
2805
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
|
|
2806
|
-
"application/vnd.ms-excel.comments": "comments",
|
|
2807
|
-
"application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
|
|
2808
|
-
"application/vnd.ms-excel.person+xml": "people",
|
|
2809
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
|
|
2810
|
-
"application/vnd.ms-excel.sheetMetadata": "metadata",
|
|
2811
|
-
"application/vnd.ms-excel.externalLink": "links",
|
|
2812
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
|
|
2813
|
-
"application/vnd.openxmlformats-officedocument.theme+xml": "themes"
|
|
2814
|
-
}, We = (t) => t.startsWith("/") ? t.slice(1) : t, ze = /^xl\/(worksheets|chartsheets)\/[^/]+\.xml$/i, Xe = (t) => "string" == typeof t ? t : (t?.runs ?? []).map((t) => t.text ?? "").join(""), qe = async (i, n) => {
|
|
2815
|
-
const { password: a, onVBA: c, profile: l, calcOnLoad: h = "auto", createWorkbookOptions: u = {}, ...d } = n ?? {}, p = !!u.origin && "string" != typeof u.origin, f = l ? new gt("function" == typeof l ? l : void 0) : null, g = [], x = (t, e, s) => {
|
|
2816
|
-
g.push([
|
|
2817
|
-
t,
|
|
2818
|
-
e ?? "",
|
|
2819
|
-
s
|
|
2820
|
-
]);
|
|
2821
|
-
}, y = { onWarning: x }, b = n?.progress, v = b?.onProgress ? b.onProgress.bind(b) : void 0, w = i.byteLength;
|
|
2822
|
-
let C = 0, k = 0;
|
|
2823
|
-
const E = v ? (t) => {
|
|
2824
|
-
if (C <= 0) return;
|
|
2825
|
-
k += t;
|
|
2826
|
-
const e = Math.min(w, Math.round(k / C * w));
|
|
2827
|
-
v(e, w);
|
|
2828
|
-
} : void 0, O = import("./j0RE2usgdljRw_gr.mjs");
|
|
2829
|
-
let I = null;
|
|
2830
|
-
try {
|
|
2831
|
-
I = new DOMParser();
|
|
2832
|
-
} catch (t) {}
|
|
2833
|
-
let V = null;
|
|
2834
|
-
try {
|
|
2835
|
-
V = new XMLSerializer();
|
|
2836
|
-
} catch (t) {}
|
|
2837
|
-
let $, R, X, Z = null;
|
|
2838
|
-
I || (Z = import("@xmldom/xmldom"));
|
|
2839
|
-
try {
|
|
2840
|
-
const [t, e] = await Promise.all([Z, O]);
|
|
2841
|
-
$ = new e.DOMTransformer(), R = I ?? new t.DOMParser(), X = V ?? new t.XMLSerializer();
|
|
2842
|
-
} catch (t) {
|
|
2843
|
-
throw new Error("Unable to load XLSX parser.", { cause: t });
|
|
2844
|
-
}
|
|
2845
|
-
const Q = (t) => X.serializeToString(t);
|
|
2846
|
-
let Y;
|
|
2847
|
-
try {
|
|
2848
|
-
Y = await ft.create(i);
|
|
2849
|
-
} catch (t) {
|
|
2850
|
-
throw new K("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: t });
|
|
2851
|
-
}
|
|
2852
|
-
f?.mark("zip-open");
|
|
2853
|
-
try {
|
|
2854
|
-
if (!Y.has("[Content_Types].xml")) throw new K("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
|
|
2855
|
-
const i = (t) => {
|
|
2856
|
-
const e = Y.getEntry(t);
|
|
2857
|
-
return e ? { content: e } : void 0;
|
|
2858
|
-
}, n = {
|
|
2859
|
-
workbooks: [],
|
|
2860
|
-
sheets: [],
|
|
2861
|
-
charts: [],
|
|
2862
|
-
dialogs: [],
|
|
2863
|
-
macros: [],
|
|
2864
|
-
strs: [],
|
|
2865
|
-
comments: [],
|
|
2866
|
-
threadedcomments: [],
|
|
2867
|
-
links: [],
|
|
2868
|
-
coreprops: [],
|
|
2869
|
-
extprops: [],
|
|
2870
|
-
custprops: [],
|
|
2871
|
-
themes: [],
|
|
2872
|
-
styles: [],
|
|
2873
|
-
metadata: [],
|
|
2874
|
-
people: [],
|
|
2875
|
-
overrides: {},
|
|
2876
|
-
sst: "",
|
|
2877
|
-
style: "",
|
|
2878
|
-
defaults: {}
|
|
2879
|
-
};
|
|
2880
|
-
{
|
|
2881
|
-
const t = ((t, e) => ({
|
|
2882
|
-
onOpenTag: (e) => {
|
|
2883
|
-
const s = ((t) => {
|
|
2884
|
-
const e = t.indexOf(":");
|
|
2885
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
2886
|
-
})(e.name), o = e.attributes;
|
|
2887
|
-
if ("Override" === s) {
|
|
2888
|
-
const e = o.ContentType, s = o.PartName;
|
|
2889
|
-
if (!e || !s) return;
|
|
2890
|
-
t.overrides[s.startsWith("/") ? s.slice(1) : s] = e;
|
|
2891
|
-
const r = Fe[e], i = r ? t[r] : void 0;
|
|
2892
|
-
Array.isArray(i) && i.push(s);
|
|
2893
|
-
} else if ("Default" === s) {
|
|
2894
|
-
const e = o.Extension, s = o.ContentType;
|
|
2895
|
-
e && (t.defaults[e.toLowerCase()] = s);
|
|
2896
|
-
}
|
|
2897
|
-
},
|
|
2898
|
-
onEnd: () => {
|
|
2899
|
-
t.sst = t.strs.length > 0 ? t.strs[0] : "", t.style = t.styles.length > 0 ? t.styles[0] : "";
|
|
2900
|
-
},
|
|
2901
|
-
onError: (t) => {
|
|
2902
|
-
e?.(`Error parsing content types: ${t?.message ?? t}`);
|
|
2903
|
-
}
|
|
2904
|
-
}))(n, (t) => {
|
|
2905
|
-
g.push([t, "[Content_Types].xml"]);
|
|
2906
|
-
}), e = await Y.getTextStream("[Content_Types].xml");
|
|
2907
|
-
if (!e) throw new Error("Error parsing content types: '[Content_Types].xml'");
|
|
2908
|
-
try {
|
|
2909
|
-
await ce.parseStream(e, t, { xmlns: !1 });
|
|
2910
|
-
} catch (t) {
|
|
2911
|
-
throw new Error("Error parsing content types: '[Content_Types].xml'", { cause: t });
|
|
2912
|
-
}
|
|
2913
|
-
p && await Y.getBuffer("[Content_Types].xml");
|
|
2914
|
-
}
|
|
2915
|
-
f?.mark("content-types");
|
|
2916
|
-
const a = n.sst, d = /* @__PURE__ */ new Set();
|
|
2917
|
-
for (const t of n.sheets) d.add(We(t));
|
|
2918
|
-
a && d.add(We(a));
|
|
2919
|
-
for (const t of d) C += Y.uncompressedSize(t);
|
|
2920
|
-
if (await Y.prefetch((t) => !d.has(t) && !ze.test(t)), f?.mark("prefetch-side-parts"), 0 === n.workbooks.length) {
|
|
2921
|
-
const t = z("_rels/.rels", i, R, $, y), e = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
|
|
2922
|
-
if (t) {
|
|
2923
|
-
for (const s of t.values()) if (s.type === e && s.target) {
|
|
2924
|
-
n.workbooks.push(s.target);
|
|
2925
|
-
break;
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
if (0 === n.workbooks.length) throw new K("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
|
|
2930
|
-
n.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], n.richdata = ["/xl/richData/rdrichvalue.xml"];
|
|
2931
|
-
const k = u?.resources ?? new it(), O = k.beginPersist(), I = {}, V = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new Map();
|
|
2932
|
-
X.set("richTypes", []), X.set("parseInlineDxf", (t) => {
|
|
2933
|
-
if (!t) return;
|
|
2934
|
-
const s = R.parseFromString(`<dxf xmlns:x14="${e}" xmlns:xm="${m}">${t}</dxf>`, "text/xml")?.documentElement;
|
|
2935
|
-
if (!s) return;
|
|
2936
|
-
const o = $.parseDxf(s, "", y);
|
|
2937
|
-
return Object.keys(o).length > 0 ? o : void 0;
|
|
2938
|
-
});
|
|
2939
|
-
const Z = [];
|
|
2940
|
-
X.set("dummyWrapped", Z);
|
|
2941
|
-
const tt = W("metadata", n, i, R, $, y).entries().next()?.value?.[1]?.metadata;
|
|
2942
|
-
tt && X.set("metadata", tt), X.set(Ne, r());
|
|
2943
|
-
const et = /* @__PURE__ */ new Map(), st = [], ot = /* @__PURE__ */ new Set(), at = (t) => {
|
|
2944
|
-
ot.add(We(t));
|
|
2945
|
-
}, lt = (t, e = et) => {
|
|
2946
|
-
const s = t.lastIndexOf("/"), o = t.substring(0, s + 1) + "_rels/" + t.substring(s + 1, t.length) + ".rels";
|
|
2947
|
-
let r = e.get(o);
|
|
2948
|
-
return r || (r = z(o, i, R, $, bt), e.set(o, r)), r;
|
|
2949
|
-
}, ht = (e, s, o, r = et) => {
|
|
2950
|
-
let n = lt(s, r).get(e), a = n?.target;
|
|
2951
|
-
if (!a) return null;
|
|
2952
|
-
if ("External" === n.targetMode) {
|
|
2953
|
-
if (!o) return n.target;
|
|
2954
|
-
const t = k.add({ source: { external: n.target } });
|
|
2955
|
-
return t.addReference(I), V.add(t), O.toResourceId(t);
|
|
2956
|
-
}
|
|
2957
|
-
const c = s.lastIndexOf("/"), l = s.substring(0, c + 1);
|
|
2958
|
-
a.startsWith("/") || (a = l + a), a = H(a);
|
|
2959
|
-
const h = $?.getVisitorParamsState().get("dxfs");
|
|
2960
|
-
let u = r.get(a);
|
|
2961
|
-
if (!u) {
|
|
2962
|
-
const e = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", s = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
|
2963
|
-
if (n.type === e) {
|
|
2964
|
-
const e = {};
|
|
2965
|
-
u = e;
|
|
2966
|
-
const s = async () => {
|
|
2967
|
-
const s = $e(e, (t, e) => "legacyDrawing" === e ? pt(t, a) : "formControl" === e ? ft(t, a) : "part" === e ? gt(t, a) : ht(t, a, "resource" === e) ?? null, Ct, h, () => {}, (t, e, s) => {
|
|
2968
|
-
x(t, e ? `${e} (${a})` : a, s);
|
|
2969
|
-
}, void 0, X), o = await Y.getTextStream(a, E);
|
|
2970
|
-
if (o) try {
|
|
2971
|
-
await ce.parseStream(o, s, {
|
|
2972
|
-
xmlns: !1,
|
|
2973
|
-
lean: !0
|
|
2974
|
-
});
|
|
2975
|
-
} catch (t) {
|
|
2976
|
-
throw new Error(`Error parsing sheet: '${a}'`, { cause: t });
|
|
2977
|
-
}
|
|
2978
|
-
const i = lt(a, r);
|
|
2979
|
-
if (i) {
|
|
2980
|
-
dt(e, a, i, r), P(e);
|
|
2981
|
-
const s = [];
|
|
2982
|
-
i.forEach((e, o) => {
|
|
2983
|
-
if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" !== e.type) return;
|
|
2984
|
-
const r = gt(o, a, e.type, (t) => "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" !== t);
|
|
2985
|
-
if (!r?.xml) return;
|
|
2986
|
-
const i = /<pivotTableDefinition\b[^>]*>/.exec(r.xml)?.[0] ?? "", n = parseInt(/\scacheId="(\d+)"/.exec(i)?.[1] ?? "", 10);
|
|
2987
|
-
if (isNaN(n)) return void g.push([`Pivot table '${r.name}' names no cache and was dropped.`, a]);
|
|
2988
|
-
const c = /\sname="([^"]*)"/.exec(i)?.[1];
|
|
2989
|
-
s.push({
|
|
2990
|
-
...c ? { name: t(c) } : {},
|
|
2991
|
-
cacheId: n,
|
|
2992
|
-
part: r
|
|
2993
|
-
});
|
|
2994
|
-
}), s.length > 0 && (e.pivotTables = s);
|
|
2995
|
-
}
|
|
2996
|
-
};
|
|
2997
|
-
st.push(s());
|
|
2998
|
-
} else if (n.type === s) {
|
|
2999
|
-
const t = B(a, i, R, $, bt);
|
|
3000
|
-
if (t && 0 !== Object.keys(t).length) {
|
|
3001
|
-
const e = t, s = e.__bookRelId, o = e.__absoluteUrlRelId;
|
|
3002
|
-
delete e.__bookRelId, delete e.__absoluteUrlRelId;
|
|
3003
|
-
const i = [];
|
|
3004
|
-
lt(a, r)?.forEach((t, e) => {
|
|
3005
|
-
if ("External" === t.targetMode && t.type && t.target) {
|
|
3006
|
-
const r = {
|
|
3007
|
-
type: t.type,
|
|
3008
|
-
target: t.target
|
|
3009
|
-
};
|
|
3010
|
-
e === s ? r.role = "book" : e === o && (r.role = "absoluteUrl"), i.push(r);
|
|
3011
|
-
}
|
|
3012
|
-
}), i.sort((t, e) => ("book" === t.role ? 0 : 1) - ("book" === e.role ? 0 : 1)), e.sources = i, at(a), u = e;
|
|
3013
|
-
} else u = null;
|
|
3014
|
-
} else u = o ? M(a, i, (t, e) => {
|
|
3015
|
-
const s = k.add({ source: { buffer: t } });
|
|
3016
|
-
return s.addReference(I), V.add(s), O.toResourceId(s);
|
|
3017
|
-
}, bt) : B(a, i, R, $, bt);
|
|
3018
|
-
}
|
|
3019
|
-
return u;
|
|
3020
|
-
}, ut = (t, e) => {
|
|
3021
|
-
if (!t) return null;
|
|
3022
|
-
const s = lt(e, et)?.get(t);
|
|
3023
|
-
if (!s?.target || "External" === s.targetMode) return null;
|
|
3024
|
-
let o = s.target;
|
|
3025
|
-
return o.startsWith("/") || (o = e.substring(0, e.lastIndexOf("/") + 1) + o), H(o);
|
|
3026
|
-
}, dt = (t, e, s, o) => {
|
|
3027
|
-
const r = [], i = /* @__PURE__ */ new Map(), n = [];
|
|
3028
|
-
s.forEach((t, s) => {
|
|
3029
|
-
if ("http://schemas.microsoft.com/office/2017/10/relationships/threadedComment" !== t.type) return;
|
|
3030
|
-
const a = ht(s, e, !1, o)?.comments;
|
|
3031
|
-
if (!a) return;
|
|
3032
|
-
for (let t = 0; t < a.length; t++) {
|
|
3033
|
-
const e = a[t];
|
|
3034
|
-
if (!e?.v?.id) continue;
|
|
3035
|
-
const { parentId: s, done: o, content: c, ...l } = e.v, h = {
|
|
3036
|
-
...l,
|
|
3037
|
-
content: Xe(c)
|
|
3038
|
-
};
|
|
3039
|
-
s ? n.push({
|
|
3040
|
-
parentId: s,
|
|
3041
|
-
json: h
|
|
3042
|
-
}) : (o && (h.done = !0), i.set(h.id, h), r.push({
|
|
3043
|
-
r: e.r,
|
|
3044
|
-
v: h
|
|
3045
|
-
}));
|
|
3046
|
-
}
|
|
3047
|
-
const c = ut(s, e);
|
|
3048
|
-
c && at(c);
|
|
3049
|
-
});
|
|
3050
|
-
for (let t = 0; t < n.length; t++) {
|
|
3051
|
-
const { parentId: e, json: s } = n[t], o = i.get(e);
|
|
3052
|
-
o && (o.replies ??= []).push(s);
|
|
3053
|
-
}
|
|
3054
|
-
const a = [];
|
|
3055
|
-
if (s.forEach((t, s) => {
|
|
3056
|
-
if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" !== t.type) return;
|
|
3057
|
-
const r = ht(s, e, !1, o), n = r?.comments;
|
|
3058
|
-
if (!n) return;
|
|
3059
|
-
const c = r?.authors;
|
|
3060
|
-
for (let t = 0; t < n.length; t++) {
|
|
3061
|
-
const e = n[t];
|
|
3062
|
-
if (!e?.r) continue;
|
|
3063
|
-
let s = c && void 0 !== e.v.authorId ? c[e.v.authorId] : void 0;
|
|
3064
|
-
if (s && s.startsWith("tc=")) {
|
|
3065
|
-
if (i.has(j(s.substring(3)))) continue;
|
|
3066
|
-
s = void 0;
|
|
3067
|
-
}
|
|
3068
|
-
const o = {
|
|
3069
|
-
id: G.uuidV4().toUpperCase(),
|
|
3070
|
-
asNote: !0,
|
|
3071
|
-
content: e.v.content ?? ""
|
|
3072
|
-
}, r = s ? yt({ displayName: s }) : void 0;
|
|
3073
|
-
r && (o.personId = r.id), a.push({
|
|
3074
|
-
r: e.r,
|
|
3075
|
-
v: o
|
|
3076
|
-
});
|
|
3077
|
-
}
|
|
3078
|
-
const l = ut(s, e);
|
|
3079
|
-
l && at(l);
|
|
3080
|
-
}), 0 === r.length && 0 === a.length) return;
|
|
3081
|
-
const c = [...r, ...a], l = t.legacyDrawing;
|
|
3082
|
-
if (l?.xml) {
|
|
3083
|
-
const { rest: e, notes: s } = D(l.xml);
|
|
3084
|
-
if (s.length > 0) {
|
|
3085
|
-
const o = /* @__PURE__ */ new Map();
|
|
3086
|
-
for (let t = 0; t < s.length; t++) {
|
|
3087
|
-
const e = s[t];
|
|
3088
|
-
o.set(J.cellToString({
|
|
3089
|
-
rowIndex: e.row,
|
|
3090
|
-
colIndex: e.col
|
|
3091
|
-
}), e);
|
|
3092
|
-
}
|
|
3093
|
-
for (let t = 0; t < c.length; t++) {
|
|
3094
|
-
const e = c[t], s = o.get(String(e.r).toUpperCase());
|
|
3095
|
-
if (!s) continue;
|
|
3096
|
-
if (o.delete(String(e.r).toUpperCase()), !e.v.asNote) continue;
|
|
3097
|
-
const r = A(s.xml), i = {};
|
|
3098
|
-
if (r.anchor) {
|
|
3099
|
-
const [t, e, o, n, a, c, l, h] = r.anchor;
|
|
3100
|
-
i.anchor = {
|
|
3101
|
-
tl: {
|
|
3102
|
-
c: t - s.col,
|
|
3103
|
-
x: e,
|
|
3104
|
-
r: o - s.row,
|
|
3105
|
-
y: n
|
|
3106
|
-
},
|
|
3107
|
-
br: {
|
|
3108
|
-
c: a - s.col,
|
|
3109
|
-
x: c,
|
|
3110
|
-
r: l - s.row,
|
|
3111
|
-
y: h
|
|
3112
|
-
}
|
|
3113
|
-
};
|
|
3114
|
-
}
|
|
3115
|
-
r.xml && (i.xml = r.xml), (i.anchor || i.xml) && (e.v.box = i), r.visible && (e.v.shown = !0), r.alt && (e.v.description = r.alt);
|
|
3116
|
-
}
|
|
3117
|
-
const r = [];
|
|
3118
|
-
o.forEach((t) => {
|
|
3119
|
-
r.push(t.xml);
|
|
3120
|
-
});
|
|
3121
|
-
const i = S(e, r);
|
|
3122
|
-
i ? l.xml = i : delete t.legacyDrawing;
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
|
-
t.comments = c;
|
|
3126
|
-
}, pt = (t, e) => {
|
|
3127
|
-
const s = ut(t, e);
|
|
3128
|
-
if (!s) return null;
|
|
3129
|
-
const o = i(We(s));
|
|
3130
|
-
if (!o) return null;
|
|
3131
|
-
const r = { xml: new TextDecoder("utf-8").decode(o.content) }, n = [];
|
|
3132
|
-
return lt(s, et)?.forEach((t, e) => {
|
|
3133
|
-
if ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" !== t.type) return;
|
|
3134
|
-
const o = ht(e, s, !0);
|
|
3135
|
-
"number" == typeof o && n.push({
|
|
3136
|
-
id: e,
|
|
3137
|
-
resId: o
|
|
3138
|
-
});
|
|
3139
|
-
}), n.length > 0 && (r.images = n), at(s), r;
|
|
3140
|
-
}, ft = (t, e) => {
|
|
3141
|
-
const s = ut(t, e);
|
|
3142
|
-
if (!s) return null;
|
|
3143
|
-
const o = B(s, i, R, $, bt)?.formControl ?? null;
|
|
3144
|
-
return o && at(s), o;
|
|
3145
|
-
}, gt = (t, e, s, o, r = /* @__PURE__ */ new Set()) => {
|
|
3146
|
-
const a = ut(t, e);
|
|
3147
|
-
if (!a || r.has(a)) return null;
|
|
3148
|
-
const c = s ?? lt(e, et)?.get(t)?.type;
|
|
3149
|
-
if (!c) return null;
|
|
3150
|
-
const l = i(We(a));
|
|
3151
|
-
if (!l) return null;
|
|
3152
|
-
r.add(a);
|
|
3153
|
-
const h = a.substring(a.lastIndexOf("/") + 1), u = n.overrides[We(a)] ?? n.defaults[h.substring(h.lastIndexOf(".") + 1).toLowerCase()], d = {
|
|
3154
|
-
id: t,
|
|
3155
|
-
type: c,
|
|
3156
|
-
name: h
|
|
3157
|
-
};
|
|
3158
|
-
if (u && (d.contentType = u), ((t, e) => t ? t.endsWith("+xml") || "application/xml" === t : /\.(xml|rels|vml)$/i.test(e))(u, h)) d.xml = new TextDecoder("utf-8").decode(l.content);
|
|
3159
|
-
else {
|
|
3160
|
-
const s = ht(t, e, !0);
|
|
3161
|
-
if ("number" != typeof s) return null;
|
|
3162
|
-
d.resId = s;
|
|
3163
|
-
}
|
|
3164
|
-
const p = [];
|
|
3165
|
-
return lt(a, et)?.forEach((t, e) => {
|
|
3166
|
-
if (!t?.type) return;
|
|
3167
|
-
if (o && !o(t.type)) return;
|
|
3168
|
-
if ("External" === t.targetMode) {
|
|
3169
|
-
const s = ht(e, a, !0);
|
|
3170
|
-
"number" == typeof s && p.push({
|
|
3171
|
-
id: e,
|
|
3172
|
-
type: t.type,
|
|
3173
|
-
resId: s
|
|
3174
|
-
});
|
|
3175
|
-
return;
|
|
3176
|
-
}
|
|
3177
|
-
const s = gt(e, a, t.type, o, r);
|
|
3178
|
-
s && p.push(s);
|
|
3179
|
-
}), p.length > 0 && (d.parts = p), at(a), d;
|
|
3180
|
-
};
|
|
3181
|
-
W("coreprops", n, i, R, $, y), W("extprops", n, i, R, $, y);
|
|
3182
|
-
const mt = new rt(), xt = W("people", n, i, R, $, y);
|
|
3183
|
-
if (xt.size > 0) {
|
|
3184
|
-
const [t, e] = xt.entries().next().value;
|
|
3185
|
-
mt.fromJSON(e?.persons), at(t);
|
|
3186
|
-
}
|
|
3187
|
-
const yt = (t) => {
|
|
3188
|
-
if (t) return mt.add(t).toJSON();
|
|
3189
|
-
}, bt = {
|
|
3190
|
-
paramMap: X,
|
|
3191
|
-
getRefs: lt,
|
|
3192
|
-
getRef: ht,
|
|
3193
|
-
parsedRefs: et,
|
|
3194
|
-
readEmbeddedPart: (t, e) => gt(t, e),
|
|
3195
|
-
addPerson: yt,
|
|
3196
|
-
serializeElement: Q,
|
|
3197
|
-
onWarning: x
|
|
3198
|
-
}, Tt = [];
|
|
3199
|
-
if (a) {
|
|
3200
|
-
const t = await Y.getTextStream(a, E);
|
|
3201
|
-
if (t) {
|
|
3202
|
-
const e = ((t, e) => {
|
|
3203
|
-
let s = !1, o = !1, r = 0, i = "";
|
|
3204
|
-
return {
|
|
3205
|
-
onOpenTag: (t) => {
|
|
3206
|
-
const e = He(t.name);
|
|
3207
|
-
"t" === e ? s && 0 === r && (o = !0) : "si" === e ? (s = !0, i = "", r = 0) : "rPh" !== e && "phoneticPr" !== e || r++;
|
|
3208
|
-
},
|
|
3209
|
-
onText: (t) => {
|
|
3210
|
-
o && (i += t);
|
|
3211
|
-
},
|
|
3212
|
-
onCloseTag: (e) => {
|
|
3213
|
-
const n = He(e.name);
|
|
3214
|
-
"t" === n ? o = !1 : "si" === n ? (t(_(i)), s = !1, i = "") : "rPh" !== n && "phoneticPr" !== n || r > 0 && r--;
|
|
3215
|
-
},
|
|
3216
|
-
onError: (t) => {
|
|
3217
|
-
e?.(`Error parsing shared strings: ${t?.message ?? t}`);
|
|
3218
|
-
}
|
|
3219
|
-
};
|
|
3220
|
-
})((t) => {
|
|
3221
|
-
Tt.push(t);
|
|
3222
|
-
}, (t) => {
|
|
3223
|
-
x(t, a);
|
|
3224
|
-
});
|
|
3225
|
-
try {
|
|
3226
|
-
await ce.parseStream(t, e, { xmlns: !1 });
|
|
3227
|
-
} catch (t) {
|
|
3228
|
-
throw new Error(`Error parsing shared strings: '${a}'`, { cause: t });
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
f?.mark("shared-strings");
|
|
3233
|
-
let vt = Tt.length;
|
|
3234
|
-
const wt = /* @__PURE__ */ new Map();
|
|
3235
|
-
let St = vt;
|
|
3236
|
-
const Ct = (t) => {
|
|
3237
|
-
const e = wt.get(t);
|
|
3238
|
-
if (void 0 !== e) return e;
|
|
3239
|
-
const s = St;
|
|
3240
|
-
return wt.set(t, St++), Tt.push(t), s;
|
|
3241
|
-
}, kt = [];
|
|
3242
|
-
n.slicersCache = kt;
|
|
3243
|
-
const At = Y.getNames(), Et = At.length;
|
|
3244
|
-
for (let t = 0; t < Et; t++) {
|
|
3245
|
-
const e = At[t];
|
|
3246
|
-
e && e.startsWith("xl/slicerCache") && kt.push(`/${e}`);
|
|
3247
|
-
}
|
|
3248
|
-
const Pt = W("slicersCache", n, i, R, $, bt), Ot = /* @__PURE__ */ new Map();
|
|
3249
|
-
Pt.forEach((t) => {
|
|
3250
|
-
const e = t.name;
|
|
3251
|
-
delete t.name, Ot.set(e, t);
|
|
3252
|
-
}), X.set("slicerCaches", Ot), W("richstructure", n, i, R, $, bt), W("richdata", n, i, R, $, bt);
|
|
3253
|
-
const It = W("themes", n, i, R, $, bt);
|
|
3254
|
-
let Dt = null;
|
|
3255
|
-
if (It && It.entries) {
|
|
3256
|
-
let t = It.entries().next();
|
|
3257
|
-
t?.value?.[1] && (Dt = t.value[1]);
|
|
3258
|
-
}
|
|
3259
|
-
const _t = new nt(Dt);
|
|
3260
|
-
let Vt = W("styles", n, i, R, $, bt).entries().next()?.value?.[1];
|
|
3261
|
-
Vt && (Vt = JSON.parse(U.JSONStableStringify(Vt)));
|
|
3262
|
-
const Lt = W("workbooks", n, i, R, $, bt);
|
|
3263
|
-
f?.mark("side-parts-json"), await Promise.all(st);
|
|
3264
|
-
{
|
|
3265
|
-
const t = Lt.entries().next().value?.[1], e = r(t?.names), s = t?.sheets ?? [];
|
|
3266
|
-
for (let t = 0; t < s.length; t++) {
|
|
3267
|
-
const r = s[t]?.sheet;
|
|
3268
|
-
r && o(r, e);
|
|
3269
|
-
}
|
|
3270
|
-
const i = t?.names;
|
|
3271
|
-
if (i) for (let t = 0; t < i.length; t++) {
|
|
3272
|
-
const s = i[t]?.ref;
|
|
3273
|
-
"string" == typeof s && (i[t].ref = e.readDetached(s));
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
v && C > 0 && (v(w, w), await new Promise((t) => setTimeout(t, 0))), f?.mark("sheets");
|
|
3277
|
-
const Nt = {
|
|
3278
|
-
...Lt.entries().next().value?.[1],
|
|
3279
|
-
styles: Vt,
|
|
3280
|
-
theme: _t.toJSON()
|
|
3281
|
-
};
|
|
3282
|
-
F(Nt, X.get(q)), Nt.calc = {
|
|
3283
|
-
...Nt.calc ?? {},
|
|
3284
|
-
legacyIntersect: !0
|
|
3285
|
-
}, Tt.length > 0 && (Nt.strings = Tt);
|
|
3286
|
-
const $t = mt.toJSON();
|
|
3287
|
-
$t && $t.length > 0 && (Nt.people = $t);
|
|
3288
|
-
const Rt = Y.getEntry("xl/vbaProject.bin");
|
|
3289
|
-
if (Rt) try {
|
|
3290
|
-
const { VBAProject: t } = await import("./CBtj0-a4l2qux2hA.mjs"), e = t.extract(Rt);
|
|
3291
|
-
if (e) {
|
|
3292
|
-
const s = /* @__PURE__ */ new Map();
|
|
3293
|
-
for (const t of Nt.sheets ?? []) {
|
|
3294
|
-
const e = t?.sheet?.codeName;
|
|
3295
|
-
e && s.set(e, t.sheet);
|
|
3296
|
-
}
|
|
3297
|
-
for (const o of e.modules) {
|
|
3298
|
-
const e = { language: "vba" }, { header: r, body: i } = t.splitAttributes(o.code);
|
|
3299
|
-
i && (e.source = i), r && (e.sourceHeader = r);
|
|
3300
|
-
const n = "document" === o.type ? s.get(o.name) : void 0;
|
|
3301
|
-
n || "document" !== o.type || (e.scope = "workbook");
|
|
3302
|
-
const a = n ? n.modules ??= {} : Nt.modules ??= {};
|
|
3303
|
-
a[o.name] || (a[o.name] = e);
|
|
3304
|
-
}
|
|
3305
|
-
c?.(e);
|
|
3306
|
-
} else g.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
|
|
3307
|
-
} catch (t) {
|
|
3308
|
-
g.push([`Error extracting VBA: ${t?.message ?? t}`, "xl/vbaProject.bin"]);
|
|
3309
|
-
}
|
|
3310
|
-
const Bt = X.get("calcId"), jt = void 0 === Bt || !(Number(Bt) >= 191029), Mt = u.calcOnLoad ?? ("auto" === h && jt ? "full" : h), Ht = {
|
|
3311
|
-
...u,
|
|
3312
|
-
calcOnLoad: Mt,
|
|
3313
|
-
resources: k,
|
|
3314
|
-
json: Nt
|
|
3315
|
-
};
|
|
3316
|
-
void 0 === Ht.disableLoadAutoFit && (Ht.disableLoadAutoFit = !1), f?.mark("json-assembled");
|
|
3317
|
-
const Ft = new ct(Ht);
|
|
3318
|
-
if (f?.mark("workbook-constructed"), Z.length > 0 && "none" !== Mt) {
|
|
3319
|
-
await Ft.whenCalculationReady();
|
|
3320
|
-
const t = /* @__PURE__ */ new Map(), e = Nt.sheets ?? [], s = Ft.getSheets().getItems();
|
|
3321
|
-
for (let o = 0; o < e.length; o++) {
|
|
3322
|
-
const r = e[o]?.sheet, i = s[o];
|
|
3323
|
-
r && i && t.set(r, i);
|
|
3324
|
-
}
|
|
3325
|
-
((t, e, s) => {
|
|
3326
|
-
if (0 === e.length) return;
|
|
3327
|
-
const o = t.getCalculation().getFunctions(), r = /* @__PURE__ */ new Map(), i = (t) => {
|
|
3328
|
-
let e = r.get(t);
|
|
3329
|
-
return void 0 === e && (e = null !== o.getByName(t), r.set(t, e)), e;
|
|
3330
|
-
}, n = /* @__PURE__ */ new Map();
|
|
3331
|
-
for (const t of e) {
|
|
3332
|
-
let e = n.get(t.sheet);
|
|
3333
|
-
e || (e = [], n.set(t.sheet, e)), e.push(t);
|
|
3334
|
-
}
|
|
3335
|
-
for (const [t, e] of n) {
|
|
3336
|
-
const o = s.get(t);
|
|
3337
|
-
if (!o) continue;
|
|
3338
|
-
const r = (t, e) => `${t},${e}`, n = /* @__PURE__ */ new Set();
|
|
3339
|
-
for (const t of e) null === t.formula && n.add(r(t.rowIndex, t.colIndex));
|
|
3340
|
-
for (const t of e) {
|
|
3341
|
-
if (null === t.formula) continue;
|
|
3342
|
-
const e = Ve(t.formula);
|
|
3343
|
-
let s = !0;
|
|
3344
|
-
for (const t of e) if (!i(t)) {
|
|
3345
|
-
s = !1;
|
|
3346
|
-
break;
|
|
3347
|
-
}
|
|
3348
|
-
if (!s) continue;
|
|
3349
|
-
const a = [], c = [[t.rowIndex, t.colIndex]], l = /* @__PURE__ */ new Set([r(t.rowIndex, t.colIndex)]);
|
|
3350
|
-
for (; c.length > 0;) {
|
|
3351
|
-
const [t, e] = c.pop(), s = [
|
|
3352
|
-
[t + 1, e],
|
|
3353
|
-
[t - 1, e],
|
|
3354
|
-
[t, e + 1],
|
|
3355
|
-
[t, e - 1]
|
|
3356
|
-
];
|
|
3357
|
-
for (const [t, e] of s) {
|
|
3358
|
-
const s = r(t, e);
|
|
3359
|
-
!l.has(s) && n.has(s) && (l.add(s), a.push([t, e]), c.push([t, e]));
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
|
-
for (const [t, e] of a) n.delete(r(t, e)), o.getRange({
|
|
3363
|
-
rowStart: t,
|
|
3364
|
-
colStart: e,
|
|
3365
|
-
rowEnd: t,
|
|
3366
|
-
colEnd: e
|
|
3367
|
-
}).clear();
|
|
3368
|
-
o.getRange({
|
|
3369
|
-
rowStart: t.rowIndex,
|
|
3370
|
-
colStart: t.colIndex,
|
|
3371
|
-
rowEnd: t.rowIndex,
|
|
3372
|
-
colEnd: t.colIndex
|
|
3373
|
-
}).setValue("=" + t.formula);
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
})(Ft, Z, t);
|
|
3377
|
-
}
|
|
3378
|
-
if (V.forEach((t) => {
|
|
3379
|
-
t.deleteReference(I);
|
|
3380
|
-
}), O.endPersist(), p) {
|
|
3381
|
-
s(Ft);
|
|
3382
|
-
const t = /* @__PURE__ */ new Map();
|
|
3383
|
-
let e = 0;
|
|
3384
|
-
for (const s of Y.getNames()) {
|
|
3385
|
-
const o = Y.getEntry(s);
|
|
3386
|
-
if (!o) continue;
|
|
3387
|
-
const r = Y.getRawEntry(s), i = r ? {
|
|
3388
|
-
data: o,
|
|
3389
|
-
uncompressedSize: Y.uncompressedSize(s),
|
|
3390
|
-
raw: {
|
|
3391
|
-
compressedData: r.data,
|
|
3392
|
-
compressionMethod: r.compressionMethod,
|
|
3393
|
-
signature: r.signature
|
|
3394
|
-
}
|
|
3395
|
-
} : {
|
|
3396
|
-
data: o,
|
|
3397
|
-
uncompressedSize: Y.uncompressedSize(s)
|
|
3398
|
-
};
|
|
3399
|
-
t.set(s, i), e += o.byteLength;
|
|
3400
|
-
}
|
|
3401
|
-
if (e > 67108864) g.push([`Source package too large to retain (${e} bytes, limit ${T}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
|
|
3402
|
-
else if (t.size > 0) {
|
|
3403
|
-
const e = new N(t, ot);
|
|
3404
|
-
L(Ft, e);
|
|
3405
|
-
let o = Ft.getSheets().getItems();
|
|
3406
|
-
const r = Ft.getTransactions().addListener({ onCommitEnd: (t) => {
|
|
3407
|
-
const s = t.getOperation()?.name;
|
|
3408
|
-
"insertCells" !== s && "deleteCells" !== s || e.markStructuralChange();
|
|
3409
|
-
} }), i = Ft.addListeners({ onSheetsChange: () => {
|
|
3410
|
-
const t = Ft.getSheets().getItems();
|
|
3411
|
-
(t.length !== o.length || t.some((t, e) => t !== o[e])) && e.markStructuralChange(), o = t;
|
|
3412
|
-
} });
|
|
3413
|
-
Ft.addListeners({ onClose: () => {
|
|
3414
|
-
r(), i(), s(Ft);
|
|
3415
|
-
} });
|
|
3416
|
-
}
|
|
3417
|
-
}
|
|
3418
|
-
if (g.length && b?.onWarning) {
|
|
3419
|
-
const t = /* @__PURE__ */ new Set();
|
|
3420
|
-
for (const e of g) {
|
|
3421
|
-
const [s, o, r] = e, i = r ?? s;
|
|
3422
|
-
t.has(i) || (t.add(i), b.onWarning(s, o));
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
return f && !0 === l && console.table(f.toTable()), Ft;
|
|
3426
|
-
} catch (t) {
|
|
3427
|
-
let e = "Unable to parse XLSX.";
|
|
3428
|
-
throw t instanceof ot && (e = "Unable to open XLSX. There are too many rows or columns."), new Error(e, { cause: t });
|
|
3429
|
-
} finally {
|
|
3430
|
-
await Y.close().catch(() => {});
|
|
3431
|
-
}
|
|
3432
|
-
};
|
|
3433
|
-
export { qe as readXLSX };
|