@sheetxl/io-xlsx 0.8.0-beta.10 → 0.8.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/browser/esm/{NQIuOQIleHC4NUW6.mjs → BiDqExNXiY7ykk8E.mjs} +527 -646
  2. package/browser/esm/{2EOdn2WRK5y1L58S.mjs → Bs0EzhdU8WgGfPzf.mjs} +2 -2
  3. package/browser/esm/CLWsOc6DO8l1G_LF.mjs +2213 -0
  4. package/browser/esm/{xc_LzCPgHn-acgFZ.mjs → CZ9I80og75SDRjv0.mjs} +2 -2
  5. package/browser/esm/{DXopGe8PrLWmwGaV.mjs → CuAXx5i4uqTz-mMY.mjs} +1 -1
  6. package/browser/esm/{BLXcoiDAaOMjFuhw.mjs → Cv3R6fGatARKedSn.mjs} +2531 -1952
  7. package/browser/esm/{B-jb5SuiVh5NnBG_.mjs → CzFYJPxmLyKgEKF0.mjs} +2 -2
  8. package/browser/esm/{BKT8OBj-bhQwdg49.mjs → DICL6ecj9BdJv8aX.mjs} +47 -10
  9. package/browser/esm/DatIA9fZbEPjW4bh.mjs +5638 -0
  10. package/browser/esm/index.mjs +2 -2
  11. package/browser/esm/{CI_CZI5m5-KkiAK5.mjs → yveeVJ6hKDI5KDEz.mjs} +1599 -990
  12. package/node/esm/B9Zn6H1RV07Ob377.mjs +2294 -0
  13. package/node/esm/Bpqm_PpGLpdjL47-.mjs +2368 -0
  14. package/node/esm/{BmdmvgO5Zdgx-RWo.mjs → CAJxmJdobUbzpUz5.mjs} +2 -2
  15. package/node/esm/{CHqRP_NjPpPd7m9L.mjs → CxlSbH7mmnEEsqmX.mjs} +1 -1
  16. package/node/esm/DD-yXSBzvDYy0TX5.mjs +5842 -0
  17. package/node/esm/{nNQ7MG89sGKwkjMA.mjs → DScqM1V4wPntNP6-.mjs} +1672 -1086
  18. package/node/esm/{O5mti2R9drFOlXc7.mjs → fopiRR7OiVoEiF7B.mjs} +2 -2
  19. package/node/esm/index.mjs +64 -27
  20. package/node/esm/{CtAF486aZqYzMeLM.mjs → ipiyzn5Pfohw2afB.mjs} +1777 -1157
  21. package/package.json +3 -3
  22. package/types/src/AutoFilterRules.d.ts +8 -1
  23. package/types/src/DefinedNameAttributes.d.ts +8 -0
  24. package/types/src/ExcelCompat.d.ts +15 -3
  25. package/types/src/KnownFonts.d.ts +50 -0
  26. package/types/src/LegacyFormula.d.ts +13 -0
  27. package/types/src/PageLayoutAttributes.d.ts +8 -0
  28. package/types/src/Plugin.d.ts +12 -0
  29. package/types/src/ProtectionAttributes.d.ts +2 -2
  30. package/types/src/SheetKinds.d.ts +57 -0
  31. package/types/src/SheetViewAttributes.d.ts +4 -0
  32. package/types/src/SortExtent.d.ts +16 -0
  33. package/types/src/Types.d.ts +11 -0
  34. package/types/src/XlsxHeader.d.ts +19 -0
  35. package/types/src/chart/ChartExXml.d.ts +38 -0
  36. package/types/src/chart/ChartPartXml.d.ts +47 -0
  37. package/types/src/chart/ChartSpaceXml.d.ts +36 -0
  38. package/types/src/chart/_XmlTree.d.ts +34 -0
  39. package/types/src/chart/_chartCodecs.d.ts +10 -0
  40. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  41. package/types/src/chart/_chartExFold.d.ts +14 -0
  42. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  43. package/types/src/chart/_chartExStyle.d.ts +22 -0
  44. package/types/src/chart/_codec.d.ts +78 -0
  45. package/types/src/chart/_drawingml.d.ts +10 -0
  46. package/types/src/chart/_xml.d.ts +70 -0
  47. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  48. package/types/src/reader/DummyFunctionUnwrap.d.ts +2 -2
  49. package/types/src/reader/HeaderStyles.d.ts +15 -0
  50. package/types/src/reader/IsoDateCell.d.ts +20 -0
  51. package/types/src/reader/LibreOfficeDataTable.d.ts +11 -0
  52. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  53. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +3 -3
  54. package/types/src/reader/domVisitors/CommentVisitor.d.ts +2 -2
  55. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +3 -1
  56. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +2 -2
  57. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +23 -8
  58. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  59. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  60. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
  61. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +2 -0
  62. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  63. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  64. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  65. package/types/src/reader/domVisitors/index.d.ts +2 -30
  66. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +46 -6
  67. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +16 -11
  68. package/types/src/utils/DrawingMLText.d.ts +2 -2
  69. package/types/src/utils/FormControls.d.ts +4 -4
  70. package/types/src/utils/SharedNames.d.ts +13 -0
  71. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  72. package/types/src/utils/VmlNoteShapes.d.ts +16 -23
  73. package/types/src/utils/VmlNoteStyle.d.ts +44 -0
  74. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  75. package/types/src/writer/builder/PackageBuilder.d.ts +2 -0
  76. package/types/src/writer/builder/Types.d.ts +7 -0
  77. package/types/src/writer/emitters/CommentsEmitter.d.ts +3 -3
  78. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  79. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
  80. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  81. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  82. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  83. package/types/src/writer/emitters/SlicerEmitter.d.ts +3 -3
  84. package/types/src/writer/emitters/WorkbookEmitter.d.ts +5 -0
  85. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  86. package/types/src/writer/utils/AutoFilter.d.ts +1 -1
  87. package/types/src/writer/utils/DefaultRows.d.ts +38 -0
  88. package/types/src/writer/utils/DxfCollector.d.ts +11 -8
  89. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +1 -1
  90. package/types/src/writer/utils/SheetStyleLayout.d.ts +73 -0
  91. package/types/src/writer/utils/TextUtils.d.ts +6 -1
  92. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  93. package/browser/esm/BPmehfSqdvgsLBsB.mjs +0 -5153
  94. package/node/esm/BpxxiZ2oKPkUSfdB.mjs +0 -2486
  95. package/node/esm/QS_theNoeqNGLStj.mjs +0 -5298
  96. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  97. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  98. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  99. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  100. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  101. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  102. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  103. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  104. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  105. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  106. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  107. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  108. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  109. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  110. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  111. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  112. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  113. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  114. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  115. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  116. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
@@ -1,2486 +0,0 @@
1
- /**
2
- * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.10
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 { A as t, D as s, E as r, F as o, I as i, M as n, N as l, O as a, P as c, Q as u, St as h, T as d, Z as p, Zt as m, bt as g, ct as f, h as b, j as y, k as A, lt as v, rt as N, w as V, xt as S } from "./nNQ7MG89sGKwkjMA.mjs";
8
- import { i as x, n as F, r as C } from "./CtAF486aZqYzMeLM.mjs";
9
- import { CommonUtils as P } from "@sheetxl/utils";
10
- import { AddressUtils as w, FormulaError as T, IBorders as O, ICellStyle as k, ICondition as I, IFill as L, IFont as B, IRange as _, IShape as E, ISlicerStyle as D, ITextFrame as R, ShapeStyleUtils as j, Sort as Y, Tuple as M } from "@sheetxl/sdk";
11
- var U = class {
12
- constructor(t) {
13
- this.list = t;
14
- }
15
- get length() {
16
- return this.list.length;
17
- }
18
- item(t) {
19
- return this.list[t];
20
- }
21
- forEach(t, e) {
22
- const s = this.list, r = s.length;
23
- for (let e = 0; e < r; e++) t(s[e], e, this);
24
- }
25
- entries() {
26
- return this.list.entries();
27
- }
28
- keys() {
29
- return this.list.keys();
30
- }
31
- values() {
32
- return this.list.values();
33
- }
34
- [Symbol.iterator]() {
35
- return this.list.values();
36
- }
37
- }, z = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null, X = (t) => {
38
- const e = parseInt(t);
39
- return isNaN(e) ? null : e;
40
- }, G = (t) => {
41
- const e = parseFloat(t);
42
- return isNaN(e) ? null : e;
43
- }, W = /* @__PURE__ */ new Map(), H = class {
44
- constructor(t, e, s, r, o, i = null, n = P.EmptyObject) {
45
- this._fileLocation = "";
46
- const l = (t, e, s) => n?.getRef?.(t, e, s, n?.parsedRefs), a = (t) => n?.getRefs?.(t, n?.parsedRefs);
47
- this._parent = t, this.sharedShared = e, this.currentPath = s, this.elemRoot = r, this.jsonRoot = o, t ? (this._fileLocation = t._fileLocation, this._getRef = t._getRef, this._getRefs = t._getRefs, this._serializeElement = t._serializeElement, this._readEmbeddedPart = t._readEmbeddedPart) : (i && (this._fileLocation = i), n?.getRef && (this._getRef = l), n?.getRefs && (this._getRefs = a), this._onWarning = n?.onWarning, this._addPerson = n?.addPerson, this._serializeElement = n?.serializeElement, this._readEmbeddedPart = n?.readEmbeddedPart);
48
- }
49
- getRef(t, e = !1) {
50
- return this._getRef?.(t, this._fileLocation, e) ?? null;
51
- }
52
- readEmbeddedPart(t) {
53
- return this._readEmbeddedPart?.(t, this._fileLocation) ?? null;
54
- }
55
- getRelationships() {
56
- return this._getRefs?.(this._fileLocation) ?? W;
57
- }
58
- getPath() {
59
- return this.currentPath;
60
- }
61
- getFileLocation() {
62
- return this._fileLocation;
63
- }
64
- getElemRoot() {
65
- return this.elemRoot;
66
- }
67
- getJsonRoot() {
68
- return this.jsonRoot;
69
- }
70
- warn(t, e) {
71
- this._raiseWarning(t, this.getFileLocation(), e?.onceKey);
72
- }
73
- _raiseWarning(t, e, s) {
74
- this._onWarning ? this._onWarning(t, e, s) : this._parent ? this._parent._raiseWarning(t, e, s) : console.warn(t);
75
- }
76
- serializeElement(t) {
77
- return this._serializeElement?.(t) ?? null;
78
- }
79
- addPerson(t) {
80
- return "string" == typeof t && (t = { displayName: t }), this._addPerson ? this._addPerson(t) : this._parent ? this._parent?._addPerson?.(t) ?? null : null;
81
- }
82
- getVisitorParamsState() {
83
- return this.sharedShared.getVisitorParamsState();
84
- }
85
- evaluate(t, e) {
86
- if (!t) return e;
87
- let s = [e];
88
- const r = t.split("/"), o = r.length;
89
- for (let t = 0; t < o; t++) {
90
- const e = r[t];
91
- if ("" === e || "." === e) continue;
92
- const i = [], n = ("*" === e || "**" === e) && !(t === o - 1);
93
- for (const o of s) if (o) if (n) {
94
- const e = r[t + 1];
95
- e && "" !== e && "." !== e && (this._findDescendants(o, e, i), t++);
96
- } else if ("*" === e || "**" === e) {
97
- if (!o.childNodes) continue;
98
- const t = o.childNodes, e = t.length;
99
- for (let s = 0; s < e; s++) {
100
- const e = t[s];
101
- 1 === e.nodeType && i.push(e);
102
- }
103
- } else {
104
- if (!o.childNodes) continue;
105
- const t = o.childNodes, s = t.length;
106
- for (let r = 0; r < s; r++) {
107
- const s = t[r];
108
- if (1 !== s.nodeType) continue;
109
- const o = s;
110
- this._matchesElementName(o, e) && i.push(o);
111
- }
112
- }
113
- if (s = i, 0 === s.length) return null;
114
- }
115
- return 1 === s.length ? s[0] : 0 === s.length ? null : new U(s);
116
- }
117
- _matchesElementName(t, e) {
118
- return e.includes(":") ? (t.tagName || t.nodeName) === e : t.localName === e;
119
- }
120
- _findDescendants(t, e, s) {
121
- if (!t || !t.childNodes) return;
122
- const r = t.childNodes, o = r.length;
123
- for (let t = 0; t < o; t++) {
124
- const o = r[t];
125
- if (1 !== o.nodeType) continue;
126
- const i = o;
127
- this._matchesElementName(i, e) && s.push(i), this._findDescendants(i, e, s);
128
- }
129
- }
130
- getFromPath(t, e) {
131
- return P.getFromPath(t, e);
132
- }
133
- setToPath(t, e, s) {
134
- return P.setToPath(t, e, s);
135
- }
136
- getValAttrAsString(t, e) {
137
- let s = this.evaluate(t, e);
138
- return s && s.hasAttribute("val") ? s.getAttribute("val") ?? null : null;
139
- }
140
- getValAttrAsBoolean(t, e, s = !1) {
141
- let r = this.evaluate(t, e);
142
- if (!r) return null;
143
- const o = r.hasAttribute("val") ? r.getAttribute("val") : void 0;
144
- return null == o ? s : "1" === o || "on" === o || "true" === o || "0" !== o && "off" !== o && "false" !== o && s;
145
- }
146
- getValAttrAsInteger(t, e) {
147
- let s = this.evaluate(t, e);
148
- return s && s.hasAttribute("val") ? parseInt(s.getAttribute("val")) ?? null : null;
149
- }
150
- getValAttrAsFloat(t, e) {
151
- let s = this.evaluate(t, e);
152
- return s && s.hasAttribute("val") ? parseFloat(s.getAttribute("val")) ?? null : null;
153
- }
154
- get BOOLEAN_COPY() {
155
- return z;
156
- }
157
- get INT_COPY() {
158
- return X;
159
- }
160
- get FLOAT_COPY() {
161
- return G;
162
- }
163
- copyFromAttribute(t, e, s, r = e, o = null) {
164
- if (!t || !s || !t.hasAttribute(e)) return;
165
- let i = t.getAttribute(e);
166
- if (o) if (Array.isArray(o)) {
167
- const t = o.length;
168
- for (let e = 0; e < t; e++) {
169
- if (null == i) return;
170
- if (i = o[e](i), null == i) return;
171
- }
172
- } else {
173
- if (null == i) return;
174
- if (i = o(i), null == i) return;
175
- }
176
- this.setToPath(s, r, i);
177
- }
178
- }, K = class {
179
- constructor(t) {
180
- this.jsonKey = t;
181
- }
182
- visit(t, e, s) {
183
- const r = {};
184
- return s[this.jsonKey] = r, r;
185
- }
186
- }, $ = class {
187
- visit(t, e, s) {
188
- let r = {};
189
- if (o(t, e, r, "grouping", "grouping"), n(t, e, r, "varyColors", "varyColors"), l(t, e, r, "gapWidth", "gapWidth", .01), l(t, e, r, "overlap", "overlap", .01), this.parseType(t, e, r), c(t, e, r, "bubbleScale", "bubbleScale"), n(t, e, r, "showNegBubbles", "showNegativeBubbleValues"), n(t, e, r, "sizeRepresents", "bubbleSizeRepresentsWidth"), c(t, e, r, "firstSliceAng", "startAngle"), c(t, e, r, "holeSize", "holeSize"), o(t, e, r, "scatterStyle", "scatterStyle"), this.parseAxisIds(t, e, r), Object.keys(r).length > 0) {
190
- let e = t.getVisitorParamsState().get("types");
191
- e || (t.warn("A chart type was read outside a chart; its types were started fresh.", { onceKey: "xlsx.chart.typesState" }), e = [], t.getVisitorParamsState().set("types", e)), e.push(r);
192
- }
193
- return r;
194
- }
195
- parseType(t, e, s) {
196
- switch (e.localName) {
197
- case "areaChart":
198
- s.type = "area";
199
- break;
200
- case "bubbleChart":
201
- s.type = "bubble";
202
- break;
203
- case "doughnutChart":
204
- case "ofPieType":
205
- case "pieChart":
206
- s.type = "pie";
207
- break;
208
- case "lineChart":
209
- s.type = "line";
210
- break;
211
- case "scatterChart": s.type = "scatter";
212
- }
213
- }
214
- parseAxisIds(t, e, s) {
215
- const r = t.evaluate("axId", e);
216
- r && 0 !== r.length && (s.xAxisId = r.item(0).getAttribute("val"), s.yAxisId = r.item(1).getAttribute("val"));
217
- }
218
- }, q = (t, e, s) => {
219
- if (!0 === t.getValAttrAsBoolean("invertIfNegative", e)) if (t.evaluate("extLst/ext/invertSolidFillFmt", e)) {
220
- if (s.fill && s.fillNegative) {
221
- const e = t.getFromPath(s, "fill.solid.adjs");
222
- e && t.setToPath(s, "fillNegative.solid.adjs", e);
223
- }
224
- } else {
225
- const t = { val: "FFFFFF" }, e = {};
226
- e.solid = t, s.fillNegative = e;
227
- const r = { val: "000000" }, o = {};
228
- o.solid = r;
229
- const i = {};
230
- i.fill = o, s.strokeNegative = i;
231
- }
232
- }, Z = class {
233
- visit(t, e, s) {}
234
- processDataBarColor(t, e, s, r, o = "auto") {
235
- if (!e) return;
236
- const i = C((t) => e.getAttribute(t), o);
237
- return i && (s[r] = i), s;
238
- }
239
- processFonts(t, e, s) {
240
- if (!e) return;
241
- const r = e.childNodes;
242
- let o = 0;
243
- const i = r.length;
244
- for (let e = 0; e < i; e++) {
245
- const i = r.item(e);
246
- if (1 === i.nodeType && "font" === i.localName) {
247
- const e = {};
248
- this.processFont(t, i, e), s[o++] = e;
249
- }
250
- }
251
- return s;
252
- }
253
- processFont(t, e, s) {
254
- t.getValAttrAsBoolean("b", e, !0) && (s.weight = 700), t.getValAttrAsBoolean("i", e, !0) && (s.style = B.Style.Italic), t.getValAttrAsBoolean("strike", e, !0) && (s.strike = !0);
255
- const r = t.evaluate("u", e);
256
- r && (s.underline = r.getAttribute("val") || B.UnderlineStyle.Single), o(t, e, s, "vertAlign", "verticalAlign"), "superscript" === s.verticalAlign ? s.verticalAlign = B.VerticalAlignment.Super : "subscript" === s.verticalAlign && (s.verticalAlign = B.VerticalAlignment.Sub), l(t, e, s, "sz", "size");
257
- const i = t.evaluate("color", e);
258
- this.processDataBarColor(t, i, s, "color"), s.color || (s.color = "auto"), o(t, e, s, "name", "family"), o(t, e, s, "rFont", "family");
259
- const a = t.evaluate("family", e);
260
- if (a) {
261
- const t = a.getAttribute("val");
262
- if (t) switch (t) {
263
- case "1":
264
- s.fallbacks = ["serif"];
265
- break;
266
- case "2":
267
- s.fallbacks = ["sans-serif"];
268
- break;
269
- case "3":
270
- s.fallbacks = ["monospace"];
271
- break;
272
- case "4":
273
- s.fallbacks = ["cursive"];
274
- break;
275
- case "5": s.fallbacks = ["fantasy"];
276
- }
277
- }
278
- return o(t, e, s, "scheme", "scheme"), void 0 !== s.family && void 0 === s.scheme && (s.scheme = B.Scheme.None), n(t, e, s, "shadow", "shadow", !0), n(t, e, s, "outline", "outline", !0), t.getValAttrAsBoolean("condense", e, !0) && (s.letterSpacing = -1), t.getValAttrAsBoolean("extend", e, !0) && (s.letterSpacing = 1), c(t, e, s, "charset", "charset"), s;
279
- }
280
- processFills(t, e, s) {
281
- if (!e) return;
282
- const r = e.childNodes;
283
- let o = 0;
284
- const i = r.length;
285
- for (let e = 0; e < i; e++) {
286
- const i = r.item(e);
287
- 1 === i.nodeType && "fill" === i.localName && this.processFill(t, i, s, o++);
288
- }
289
- return s;
290
- }
291
- processFill(t, e, s, r) {
292
- const o = { type: L.Type.None }, i = e.childNodes;
293
- let n = !1;
294
- const l = i.length;
295
- for (let e = 0; !n && e < l; e++) {
296
- const s = i.item(e);
297
- 1 === s.nodeType && ("gradientFill" === s.localName ? (this.processGradientFill(t, s, o), n = !0) : "patternFill" === s.localName && (this.processPatternFill(t, s, o), n = !0));
298
- }
299
- return s[r] = o, s;
300
- }
301
- processGradientFill(t, e, s) {
302
- if (!e) return;
303
- s.type = L.Type.Gradient;
304
- const r = [];
305
- s.stops = r;
306
- const o = e.getAttribute("type");
307
- o && (s.gradientType = o);
308
- const i = e.hasAttribute("degree") ? parseFloat(e.getAttribute("degree")) : 0;
309
- (i + 90) % 360 != 0 && (s.angle = (i + 90) % 360), (e.hasAttribute("left") || e.hasAttribute("top") || e.hasAttribute("right") || e.hasAttribute("bottom")) && (s.focus = {
310
- left: J(e.getAttribute("left")),
311
- top: J(e.getAttribute("top")),
312
- right: J(e.getAttribute("right")),
313
- bottom: J(e.getAttribute("bottom"))
314
- });
315
- const n = e.childNodes, l = n.length;
316
- for (let e = 0; e < l; e++) {
317
- const s = n.item(e);
318
- if (1 === s.nodeType && "stop" === s.localName) {
319
- const e = {};
320
- r.push(e), e.offset = parseFloat(s.getAttribute("position") ?? "");
321
- const o = t.evaluate("color", s);
322
- this.processDataBarColor(t, o, e, "color");
323
- }
324
- }
325
- return s;
326
- }
327
- processPatternFill(t, e, s) {
328
- if (!e) return;
329
- const r = t.getVisitorParamsState().get("processingDXFs"), o = e.getAttribute("patternType") || (r ? L.BuiltInSheetPattern.Solid : L.BuiltInSheetPattern.None);
330
- if (o === L.BuiltInSheetPattern.None) return { none: !0 };
331
- s.type = L.Type.Pattern, o && (s.patternType = o);
332
- let i = "foreground", n = "background";
333
- const l = s.patternType === L.BuiltInSheetPattern.Solid && r;
334
- let a = l ? "dk1" : "lt1", c = l ? "lt1" : "dk1";
335
- if (l) {
336
- const t = i;
337
- i = n, n = t;
338
- }
339
- const u = t.evaluate("fgColor", e);
340
- this.processDataBarColor(t, u, s, i, a);
341
- const h = t.evaluate("bgColor", e);
342
- return this.processDataBarColor(t, h, s, n, c), l && (s.foreground || (s.foreground = "lt1"), s.background || (s.background = "dk1")), s;
343
- }
344
- processBorders(t, e, s, r) {
345
- if (!e) return;
346
- const o = e.childNodes;
347
- let i = 0;
348
- const n = o.length;
349
- for (let e = 0; e < n; e++) {
350
- const n = o.item(e);
351
- 1 === n.nodeType && "border" === n.localName && this.processBorder(t, n, s, i++, r);
352
- }
353
- return s;
354
- }
355
- processBorder(t, e, s, r, o) {
356
- if (!e) return;
357
- const i = {};
358
- return this.processBorderStroke(t, e, i, O.Edge.Left), this.processBorderStroke(t, e, i, O.Edge.Right), o ? (i.right || i.left) && (i.right ? i.vertical = { ...i.right } : i.vertical = { ...i.left }) : this.processBorderStroke(t, e, i, O.Edge.Vertical), this.processBorderStroke(t, e, i, O.Edge.Top), this.processBorderStroke(t, e, i, O.Edge.Bottom), o ? (i.bottom || i.top) && (i.bottom ? i.horizontal = { ...i.bottom } : i.horizontal = { ...i.top }) : this.processBorderStroke(t, e, i, O.Edge.Horizontal), s[r] = i, s;
359
- }
360
- processBorderStroke(t, e, s, r) {
361
- if (!e) return;
362
- const o = t.evaluate(r, e);
363
- if (!o) return;
364
- const i = {};
365
- o.hasAttribute("style") ? i.style = o.getAttribute("style") : t.getVisitorParamsState().get("processingDXFs") && (i.style = O.StrokeStyle.None);
366
- const n = t.evaluate("color", o);
367
- return n && this.processDataBarColor(t, n, i, "color"), Object.keys(i).length > 0 ? s[r] = i : null;
368
- }
369
- }, J = (t) => {
370
- if (!t) return 0;
371
- const e = parseFloat(t);
372
- return isNaN(e) ? 0 : e;
373
- }, Q = new Set(Object.values(D.ElementType).filter((t) => t !== D.ElementType.WholeTable && t !== D.ElementType.HeaderRow)), tt = {
374
- auto: "auto",
375
- autoNoTable: "automaticExceptTables",
376
- manual: "manual"
377
- }, et = [
378
- "tableId",
379
- "columnId",
380
- "cacheName",
381
- "cachePath",
382
- "sourceName",
383
- "sortOrder",
384
- "customListSort",
385
- "crossFilter"
386
- ], st = (t, e) => {
387
- const s = t.content, r = s?.json;
388
- if (r) {
389
- if ("shape" === s.type || e && "picture" === s.type) {
390
- const { rotation: s, flipH: o, flipV: i, bounds: n } = r;
391
- delete r.rotation, delete r.flipH, delete r.flipV, delete r.bounds, void 0 !== s && 0 !== s && (t.rotation = s), o && (t.flipH = !0), i && (t.flipV = !0), e && n && (t.anchor = {
392
- tl: {
393
- x: n.x,
394
- y: n.y
395
- },
396
- br: {
397
- x: n.width,
398
- y: n.height
399
- }
400
- });
401
- }
402
- if ("group" === s.type) for (const t of r.members ?? []) st(t, !0);
403
- }
404
- }, rt = [
405
- ["fillRef", "fill"],
406
- ["lnRef", "stroke"],
407
- ["effectRef", "effect"]
408
- ], ot = class {
409
- visit(t, e, s) {
410
- if (!e) return;
411
- let r = t.evaluate("*/cNvPr", e);
412
- return r.item && (r = r.item(0)), r && (t.copyFromAttribute(r, "name", s), t.copyFromAttribute(r, "descr", s, "description"), t.copyFromAttribute(r, "hidden", s, "hidden", t.BOOLEAN_COPY), this.readNonVisualDetails(t, r, s), t.copyFromAttribute(r, "id", s)), s;
413
- }
414
- readNonVisualDetails(t, e, r) {
415
- e.hasAttribute("title") && (r.title = e.getAttribute("title"));
416
- const o = t.evaluate("hlinkClick", e);
417
- o && (r.hyperlink = s(t, o));
418
- const i = t.evaluate("hlinkHover", e);
419
- i && (r.hoverHyperlink = s(t, i));
420
- const n = t.evaluate("extLst", e), l = n ? t.serializeElement(n) : null;
421
- l && (r.extLst = {
422
- ...r.extLst,
423
- nonVisual: l
424
- });
425
- }
426
- setContent(t, e) {
427
- const s = t;
428
- void 0 !== s.name && (e.name = s.name, delete s.name), void 0 !== s.description && (e.description = s.description, delete s.description);
429
- for (const t of [
430
- "title",
431
- "hyperlink",
432
- "hoverHyperlink",
433
- "extLst"
434
- ]) void 0 !== s[t] && (e.json && (e.json[t] = s[t]), delete s[t]);
435
- t.content = e;
436
- }
437
- isGroupContent(t) {
438
- return Array.isArray(t?.members);
439
- }
440
- readMemberHeader(t, e, s) {
441
- const r = {}, o = {
442
- anchor: void 0,
443
- content: {
444
- type: s,
445
- json: r
446
- }
447
- };
448
- let i = t.evaluate("*/cNvPr", e);
449
- if (i?.item && (i = i.item(0)), i) {
450
- const s = i.getAttribute("name");
451
- null !== s && (o.content.name = s);
452
- const n = i.getAttribute("descr");
453
- n && (o.content.description = n), t.copyFromAttribute(i, "hidden", o, "hidden", t.BOOLEAN_COPY), this.readNonVisualDetails(t, i, r);
454
- const l = this.readSourceId(t, e);
455
- void 0 !== l && (r.sourceId = l);
456
- }
457
- return {
458
- movable: o,
459
- content: r
460
- };
461
- }
462
- readStyleRefs(t, e, s) {
463
- const r = t.evaluate("style", e);
464
- if (!r) return void (s.style = null);
465
- const o = new A(), i = {};
466
- for (const [e, s] of rt) {
467
- const n = t.evaluate(e, r);
468
- if (!n) continue;
469
- const l = { index: parseInt(n.getAttribute("idx") ?? "0", 10) || 0 }, a = o.processAdjColor(t, n);
470
- a && (l.color = a), i[s] = l;
471
- }
472
- const n = t.evaluate("fontRef", r);
473
- if (n) {
474
- const e = { index: n.getAttribute("idx") ?? "none" }, s = o.processAdjColor(t, n);
475
- s && (e.color = s), i.font = e;
476
- }
477
- const l = j.withoutDefaultStyleRefs({
478
- ...s,
479
- style: i
480
- });
481
- l && (s.style = l);
482
- }
483
- readLocks(t) {
484
- const e = t?.attributes;
485
- if (!e || 0 === e.length) return;
486
- const s = {};
487
- for (let t = 0; t < e.length; t++) {
488
- const r = e.item(t);
489
- r.name.startsWith("xmlns") || (s[r.localName ?? r.name] = S(r.value));
490
- }
491
- return Object.keys(s).length > 0 ? s : void 0;
492
- }
493
- readSourceId(t, e) {
494
- let s = t.evaluate("*/cNvPr", e);
495
- s?.item && (s = s.item(0));
496
- const r = s?.getAttribute?.("id"), o = r ? parseInt(r, 10) : void 0;
497
- return void 0 === o || isNaN(o) ? void 0 : o;
498
- }
499
- }, it = class extends ot {
500
- visit(t, e, s) {
501
- if (e) return this.visitShape(t, e, s, "sp", "nvSpPr/cNvSpPr/spLocks");
502
- }
503
- visitShape(t, e, s, r, o) {
504
- const n = i[r];
505
- if (this.isGroupContent(s)) {
506
- if (t.getPath().includes("Fallback")) return {};
507
- const { movable: i, content: l } = this.readMemberHeader(t, e, "shape");
508
- n !== E.Type.Shape && (l.type = n), this.readStyleRefs(t, e, l), this.readShapeDetails(t, e, r, o, l);
509
- const a = t.evaluate(o, e);
510
- a?.hasAttribute?.("noChangeAspect") && (i.lockAspect = "1" === a.getAttribute("noChangeAspect"));
511
- const c = this.readTwinOf(t, e);
512
- return void 0 !== c && Object.assign(l, { twinOf: c }), s.members.push(i), l;
513
- }
514
- if (t.getPath().includes("Fallback") && s.content) {
515
- const r = s.content.json;
516
- if ("shape" === s.content.type && r && (r.type ?? E.Type.Shape) === n) {
517
- const s = t.evaluate("txBody", e), o = s ? new V().readTextBody(t, s) : null;
518
- o && "" !== d(o) && (r.text = o);
519
- }
520
- return {};
521
- }
522
- s = super.visit(t, e, s);
523
- const l = t.evaluate(o, e);
524
- l?.hasAttribute?.("noChangeAspect") && (s.lockAspect = "1" === l.getAttribute("noChangeAspect"));
525
- const a = n === E.Type.Shape ? {} : { type: n }, c = this.readSourceId(t, e);
526
- void 0 !== c && (a.sourceId = c), this.readStyleRefs(t, e, a), this.readShapeDetails(t, e, r, o, a);
527
- const u = this.readTwinOf(t, e);
528
- return void 0 !== u && Object.assign(a, { twinOf: u }), this.setContent(s, {
529
- type: "shape",
530
- json: a
531
- }), a;
532
- }
533
- readTwinOf(t, e) {
534
- let s = t.evaluate("*/cNvPr/extLst/ext/compatExt", e);
535
- s?.item && (s = s.item(0));
536
- const r = /^_x0000_s(\d+)$/.exec(s?.getAttribute?.("spid") ?? "");
537
- return r ? parseInt(r[1], 10) : void 0;
538
- }
539
- readShapeDetails(t, e, s, r, o) {
540
- const i = e.getAttribute("macro");
541
- i && (o.macro = i);
542
- const n = e.getAttribute("textlink");
543
- n && (o.textLink = n), e.hasAttribute("fLocksText") && (o.locksText = S(e.getAttribute("fLocksText"))), e.hasAttribute("fPublished") && (o.published = S(e.getAttribute("fPublished")));
544
- const l = r.slice(0, r.lastIndexOf("/")), a = t.evaluate(l, e);
545
- "1" === a?.getAttribute?.("txBox") && (o.textBox = !0);
546
- const c = this.readLocks(t.evaluate(r, e));
547
- if (c && (o.locks = c), "cxnSp" === s && a) {
548
- const e = (e) => {
549
- const s = t.evaluate(e, a);
550
- if (s?.getAttribute) return {
551
- id: parseInt(s.getAttribute("id") ?? "0", 10) || 0,
552
- index: parseInt(s.getAttribute("idx") ?? "0", 10) || 0
553
- };
554
- }, s = e("stCxn"), r = e("endCxn");
555
- (s || r) && (o.connectorEnds = {}, s && (o.connectorEnds.start = s), r && (o.connectorEnds.end = r));
556
- }
557
- }
558
- }, nt = (t, e, s, r) => {
559
- const o = t.evaluate(s, e), i = t.evaluate(r, e);
560
- return o || i ? {
561
- x: h(o?.getAttribute("x") ?? null) ?? 0,
562
- y: h(o?.getAttribute("y") ?? null) ?? 0,
563
- width: h(i?.getAttribute("cx") ?? null) ?? 0,
564
- height: h(i?.getAttribute("cy") ?? null) ?? 0
565
- } : null;
566
- }, lt = "richTypes", at = "richData";
567
- var ct = (t) => {
568
- const e = t.getAttribute("val");
569
- return "0" !== e && "false" !== e;
570
- }, ut = {
571
- 1: "serif",
572
- 2: "sans-serif",
573
- 3: "monospace",
574
- 4: "cursive",
575
- 5: "fantasy"
576
- };
577
- function ht(t) {
578
- const e = {}, s = t.childNodes;
579
- for (let t = 0; t < s.length; t++) {
580
- const r = s.item(t);
581
- if (1 === r.nodeType) switch (r.localName) {
582
- case "b":
583
- e.weight = ct(r) ? 700 : 400;
584
- break;
585
- case "i":
586
- e.style = ct(r) ? B.Style.Italic : B.Style.Normal;
587
- break;
588
- case "strike":
589
- e.strike = ct(r);
590
- break;
591
- case "outline":
592
- e.outline = ct(r);
593
- break;
594
- case "shadow":
595
- e.shadow = ct(r);
596
- break;
597
- case "extend":
598
- e.extend = ct(r);
599
- break;
600
- case "u":
601
- e.underline = r.getAttribute("val") || B.UnderlineStyle.Single;
602
- break;
603
- case "vertAlign": {
604
- const t = r.getAttribute("val");
605
- "superscript" === t ? e.verticalAlign = B.VerticalAlignment.Super : "subscript" === t ? e.verticalAlign = B.VerticalAlignment.Sub : "baseline" === t && (e.verticalAlign = B.VerticalAlignment.Baseline);
606
- break;
607
- }
608
- case "sz": {
609
- const t = parseFloat(r.getAttribute("val") ?? "");
610
- isNaN(t) || (e.size = t);
611
- break;
612
- }
613
- case "rFont": {
614
- const t = r.getAttribute("val");
615
- t && (e.family = t);
616
- break;
617
- }
618
- case "family": {
619
- const t = ut[r.getAttribute("val") ?? ""];
620
- t && (e.fallbacks = [t]);
621
- break;
622
- }
623
- case "charset": {
624
- const t = parseInt(r.getAttribute("val") ?? "", 10);
625
- isNaN(t) || (e.charset = t);
626
- break;
627
- }
628
- case "scheme": {
629
- const t = r.getAttribute("val");
630
- t && (e.scheme = t);
631
- break;
632
- }
633
- case "color": {
634
- const t = r.getAttribute("rgb");
635
- if (t && !r.hasAttribute("theme")) {
636
- e.color = "#" + (8 === t.length ? t.substring(2) : t).toUpperCase();
637
- break;
638
- }
639
- const s = C((t) => r.getAttribute(t));
640
- s && (e.color = s);
641
- break;
642
- }
643
- }
644
- }
645
- return Object.keys(e).length > 0 ? e : null;
646
- }
647
- var dt = {
648
- RelsVisitor: class {
649
- visit(t, e, s) {
650
- if (!e) return;
651
- const r = e.childNodes, o = r.length;
652
- for (let e = 0; e < o; e++) {
653
- const o = r.item(e);
654
- 1 === o.nodeType && "Relationship" === o.localName && this.processRelationship(t, o, s);
655
- }
656
- return s;
657
- }
658
- processRelationship(t, e, s) {
659
- const r = {};
660
- t.copyFromAttribute(e, "Target", r, "target"), t.copyFromAttribute(e, "Type", r, "type"), t.copyFromAttribute(e, "TargetMode", r, "targetMode");
661
- s[e.getAttribute("Id")] = r;
662
- }
663
- },
664
- CorePropertiesVisitor: class {
665
- visit(t, e, s) {
666
- const r = [], o = e.childNodes, i = o.length;
667
- for (let e = 0; e < i; e++) {
668
- const s = o.item(e);
669
- if (1 !== s.nodeType) continue;
670
- const i = this.processProperty(t, s);
671
- i && r.push(i);
672
- }
673
- return r.length > 0 && (s.properties = r), r;
674
- }
675
- processProperty(t, e) {
676
- if (e) return e.getAttribute("xsi:type"), {
677
- key: e.localName,
678
- value: e.textContent || ""
679
- };
680
- }
681
- },
682
- AppPropertiesVisitor: class {
683
- visit(t, e, s) {
684
- const r = [], o = e.childNodes, i = o.length;
685
- for (let e = 0; e < i; e++) {
686
- const s = o.item(e);
687
- if (1 !== s.nodeType) continue;
688
- const i = this.processProperty(t, s);
689
- i && r.push(i);
690
- }
691
- return r.length > 0 && (s.properties = r), r;
692
- }
693
- processProperty(t, e) {
694
- if (e) return {
695
- key: e.localName,
696
- value: e.textContent || ""
697
- };
698
- }
699
- },
700
- ChartSpaceVisitor: class {
701
- visit(t, e, s) {
702
- return n(t, e, s, "roundedCorners", "roundedCorners"), c(t, e, s, ".//AlternateContent/Fallback/style", "styleId"), t.getVisitorParamsState().set("types", []), t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()), s.range = null, s;
703
- }
704
- afterVisit(t, e, s) {
705
- let r = {};
706
- s.types = r;
707
- let o = {}, i = 0, n = {}, l = 0, a = t.getVisitorParamsState().get("axes");
708
- const c = t.getVisitorParamsState().get("types"), u = c.length;
709
- for (let t = 0; t < u; t++) {
710
- const e = c[t];
711
- if (e.xAxisId) {
712
- const r = e.xAxisId, n = a.get(r);
713
- o[t + ""] = n, e.offsetXAxis = t, delete e.xAxisId, s.xAxes = o, o.length = ++i;
714
- }
715
- if (e.yAxisId) {
716
- const r = e.yAxisId, o = a.get(r);
717
- n[t + ""] = o, e.offsetYAxis = t, delete e.yAxisId, s.yAxes = n, n.length = ++l;
718
- }
719
- r[t + ""] = e;
720
- }
721
- r.length = c.length;
722
- const h = t.getVisitorParamsState().get("series");
723
- if (!h || 0 === h.length) return;
724
- const d = {};
725
- s.series = d;
726
- const p = h.length;
727
- for (let t = 0; t < p; t++) d[t + ""] = h[t];
728
- d.length = p, t.getVisitorParamsState().delete("types"), t.getVisitorParamsState().delete("axes"), t.getVisitorParamsState().delete("series");
729
- }
730
- },
731
- ChartVisitor: class {
732
- visit(t, e, s) {
733
- return t.getVisitorParamsState().set("types", []), t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()), n(t, e, s, "plotVisOnly", "plotVisOnly"), o(t, e, s, "dispBlanksAs", "dispBlanksAs"), n(t, e, s, ".//extLst/ext/dataDisplayOptions16/dispNaAsBlank", "dispNaAsBlank"), n(t, e, s, "showDLblsOverMax", "showDLblsOverMax"), s;
734
- }
735
- afterVisit(t, e, s) {
736
- try {
737
- const r = t.getValAttrAsBoolean("autoTitleDeleted", e), o = t.evaluate("title", e);
738
- t.setToPath(s, "title.shown", !(!0 === r || !o));
739
- const i = t.evaluate("legend", e);
740
- t.setToPath(s, "legend.shown", null !== i);
741
- } catch (t) {
742
- throw new Error("Unexpected Error parsing Chart: " + t);
743
- }
744
- }
745
- },
746
- PlotAreaVisitor: class {
747
- visit(t, e, s) {
748
- let r = {};
749
- return s.plotArea = r, r;
750
- }
751
- },
752
- ShapePropertiesVisitor: a,
753
- BarChartTypeVisitor: class extends $ {
754
- parseType(t, e, s) {
755
- const r = t.getValAttrAsString("barDir", e);
756
- r && (s.type = "col" === r ? "column" : "bar");
757
- }
758
- },
759
- ChartTypeVisitor: $,
760
- DataLabelsVisitor: class {
761
- constructor(t) {
762
- this.jsonKey = t;
763
- }
764
- visit(t, e, s) {
765
- let r = {}, i = r, l = t.getValAttrAsString("idx", e);
766
- null !== l && (i = {}, i[l] = r);
767
- const a = t.getValAttrAsBoolean("delete", e);
768
- this.parseNumFormat(t, e, r), !0 === a ? (r.showBubbleSize = !1, r.showCatName = !1, r.showLeaderLines = !1, r.showPercentage = !1, r.showSerName = !1, r.showVal = !1, r.showLegendKey = !1) : (n(t, e, r, "showBubbleSize", "showBubbleSize"), n(t, e, r, "showCatName", "showCatName"), n(t, e, r, "showLeaderLines", "showLeaderLines"), n(t, e, r, "showPercent", "showPercentage"), n(t, e, r, "showSerName", "showSerName"), n(t, e, r, "showVal", "showVal"), n(t, e, r, "showLegendKey", "showLegendKey"));
769
- const c = t.evaluate("separator", e);
770
- return null !== c && (r.separator = c.textContent), o(t, e, r, "dLblPos", "position"), s[this.jsonKey] = i, r;
771
- }
772
- parseNumFormat(t, e, s) {
773
- const r = t.evaluate("numFmt", e);
774
- r && (s.formatCode = r.getAttribute("formatCode"), r.hasAttribute("sourceLinked") && (s.sourceLinked = "1" === r.getAttribute("sourceLinked")));
775
- }
776
- },
777
- SeriesVisitor: class {
778
- visit(t, e, s) {
779
- const r = {};
780
- c(t, e, r, "explosion", "explosion");
781
- let o = t.evaluate("cat/*/f", e);
782
- o || (o = t.evaluate("xVal/*/f", e));
783
- let i = null;
784
- null !== o && null !== o.firstChild && (i = o.firstChild.nodeValue), o || (o = t.evaluate("cat/strLit", e), o || (o = t.evaluate("cat/numLit", e)), o && (i = this.parsePointsAsString(t, o))), null !== i && (r.xRange = i);
785
- let l = t.evaluate("val/*/f", e);
786
- l || (l = t.evaluate("yVal/*/f", e));
787
- let a = null;
788
- l && l.firstChild && (a = l.firstChild.nodeValue), l || (l = t.evaluate("val/numLit", e), null !== l && (a = this.parsePointsAsString(t, l))), null !== a && (r.valRange = a), this.parseTitleRangeOrValue(t, e, r), c(t, e, r, "idx", "idx"), n(t, e, r, "smooth", "smooth"), r.offsetChart = t.getVisitorParamsState().get("types").length - 1;
789
- let u = t.getVisitorParamsState().get("series");
790
- return u || (u = [], t.getVisitorParamsState().set("series", u)), u.push(r), r;
791
- }
792
- parseTitleRangeOrValue(t, e, s) {
793
- const r = t.evaluate("tx/strRef/f", e);
794
- if (null !== r) {
795
- const e = r.firstChild.nodeValue;
796
- t.setToPath(s, "title.range", e);
797
- } else {
798
- const r = t.evaluate("tx/v", e);
799
- null !== r && t.setToPath(s, "title.text.simpleRun", r.firstChild.nodeValue);
800
- }
801
- }
802
- parsePointsAsString(t, e) {
803
- let s = "{";
804
- const r = t.getValAttrAsInteger("ptCount", e), o = t.evaluate("pt", e), i = [];
805
- for (let s = 0; o && r && s < r; s++) {
806
- let r = null;
807
- const o = t.evaluate("pt[@idx='" + s + "']/v", e);
808
- o && (r = o.textContent), i[s] = r;
809
- }
810
- for (let t = 0; t < i.length; t++) t > 0 && (s += ","), void 0 !== i[t] && (s += i[t]);
811
- return s += "}", s;
812
- }
813
- afterVisit(t, e, s) {
814
- q(t, e, s);
815
- let r = t.getFromPath(s, "points");
816
- if (r) {
817
- const e = Object.keys(r);
818
- for (let o = 0; o < e.length; o++) {
819
- const i = e[o], n = t.getFromPath(r, i);
820
- if (!n) continue;
821
- let l = t.getFromPath(n, "markers");
822
- l && (t.setToPath(s, "markers.points." + i, l), delete n.markers);
823
- }
824
- }
825
- }
826
- },
827
- DataPointVisitor: class {
828
- DataPointVisitor() {}
829
- visit(t, e, s) {
830
- let r = t.getFromPath(s, "points"), o = null;
831
- r ? o = r : (o = {}, t.setToPath(s, "points", o));
832
- let i = {}, l = t.getValAttrAsString("idx", e);
833
- return null !== l && (o[l] = i), n(t, e, i, "bubble3D", "bubble3D"), c(t, e, i, "explosion", "explosion"), q(t, e, i), i;
834
- }
835
- },
836
- MarkerVisitor: class {
837
- visit(t, e, s) {
838
- const r = e.parentNode.localName;
839
- if ("ser" === r || "dPt" === r) {
840
- const r = {}, o = t.getValAttrAsString("size", e);
841
- null !== o && (r.size = o);
842
- const i = t.getValAttrAsString("symbol", e);
843
- return i && (r.type = i), s.markers = r, r;
844
- }
845
- return null;
846
- }
847
- },
848
- AxisVisitor: class {
849
- visit(t, e, s) {
850
- let r = {};
851
- this.parseScaling(t, e, r), l(t, e, r, "majorUnit", "majorUnits"), l(t, e, r, "minorUnit", "minorUnits"), n(t, e, r, "delete", "shown"), this.parseOrientation(t, e, r), this.parseNumFormat(t, e, r), o(t, e, r, "majorTickMark", "majorTickMarks"), o(t, e, r, "minorTickMark", "minorTickMarks"), o(t, e, r, "crosses", "crosses"), l(t, e, r, "crossesAt", "crosses"), o(t, e, r, "crossBetween", "crossBetween"), this.parseLabelAlign(t, e, r), c(t, e, r, "lblOffset", "labelOffset"), o(t, e, r, "tickLblPos", "labelPosition");
852
- const i = t.getValAttrAsInteger("noMultiLvlLbl", e);
853
- r.labelMultiLevel = null !== i && 0 === i, c(t, e, r, "tickMarkSkip", "tickMarkSkip"), c(t, e, r, "tickLblSkip", "labelInterval"), this.parseDisplayCustOrBuiltInUnit(e, t, r), this.parseTimeUnits(t, e, r, "majorUnitDates", "majorTimeUnit", "majorUnit"), this.parseTimeUnits(t, e, r, "minorUnitDates", "minorTimeUnit", "minorUnit"), o(t, e, r, "baseTimeUnit", "baseUnitDates"), t.getVisitorParamsState().get("axes") || (t.warn("An axis was read outside a chart; its axes were started fresh.", { onceKey: "xlsx.chart.axesState" }), t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()));
854
- const a = t.getValAttrAsString("axId", e);
855
- return t.getVisitorParamsState().get("axes").set(a, r), r;
856
- }
857
- parseTimeUnits(t, e, s, r, o, i) {
858
- const n = {};
859
- let l = t.getValAttrAsString(o, e);
860
- null !== l && (n.dem = l, n.amt = t.getValAttrAsString(i, e)), Object.keys(n).length > 0 && (s[r] = n);
861
- }
862
- parseDisplayCustOrBuiltInUnit(t, e, s) {
863
- let r = e.getValAttrAsString("dispUnits/builtInUnit", t);
864
- r || (r = e.getValAttrAsString("dispUnits/custUnit", t)), r && (s.displayUnits = r);
865
- }
866
- parseLabelAlign(t, e, s) {
867
- let r = t.getValAttrAsString("lblAlgn", e);
868
- null !== r && ("ctr" === r ? s.labelAlign = "center" : "l" === r ? s.labelAlign = "left" : "r" === r && (s.labelAlign = "right"));
869
- }
870
- parseOrientation(t, e, s) {
871
- const r = t.getValAttrAsString("AxPos", e);
872
- null !== r && ("b" === r ? s.orientation = "bottom" : "l" === r ? s.orientation = "left" : "r" === r ? s.orientation = "right" : "t" === r && (s.orientation = "top"));
873
- }
874
- parseNumFormat(t, e, s) {
875
- const r = {}, o = t.evaluate("numFmt", e);
876
- null !== o && (o.hasAttribute("formatCode") && (r.formatCode = o.getAttribute("formatCode")), o.hasAttribute("sourceLinked") && (r.sourceLinked = "1" === o.getAttribute("sourceLinked"))), Object.keys(r).length > 0 && (s.labels = r);
877
- }
878
- parseScaling(t, e, s) {
879
- const r = t.getValAttrAsString("scaling/orientation", e);
880
- null !== r && (s.inverted = "minMax" !== r);
881
- const o = t.getValAttrAsFloat("scaling/logBase", e);
882
- null !== o && (s.logBase = o, s.scaleType = "log"), l(t, e, s, "scaling/max", "max"), l(t, e, s, "scaling/min", "min");
883
- }
884
- afterVisit(t, e, s) {
885
- s.fill && s.labels && (s.labels.fill = s.fill, delete s.fill);
886
- let r = t.getValAttrAsBoolean("delete", e);
887
- null !== r && (t.setToPath(s, "labels.shown", !0 !== r), t.setToPath(s, "shown", !0 !== r));
888
- const o = t.getFromPath(s, "dispUnits.displayUnitsLabel");
889
- o && (t.setToPath(s, "displayUnitsLabel", o), delete s.dispUnits);
890
- const i = t.evaluate("title", e);
891
- t.setToPath(s, "title.shown", null !== i);
892
- const n = t.evaluate("minorGridlines", e);
893
- t.setToPath(s, "gridLinesMinor.shown", null !== n);
894
- const l = t.evaluate("majorGridlines", e);
895
- t.setToPath(s, "gridLinesMajor.shown", null !== l);
896
- }
897
- },
898
- TextPropertiesVisitor: r,
899
- ShapeTextVisitor: V,
900
- LegendEntryVisitor: class {
901
- visit(t, e, s) {
902
- const r = t.getVisitorParamsState().get("series");
903
- let o = t.getValAttrAsInteger("idx", e), i = null !== o ? r[o] : void 0;
904
- if (i) {
905
- let s = t.getFromPath(i, "title");
906
- s || (s = {}, t.setToPath(i, "title", s));
907
- let r = s, o = t.getValAttrAsBoolean("delete", e);
908
- return null !== o && (r.shown = !o), r;
909
- }
910
- return s;
911
- }
912
- },
913
- LegendVisitor: class {
914
- visit(t, e, s) {
915
- const r = {};
916
- return n(t, e, r, "overlay", "overlay"), o(t, e, r, "legendPos", "position"), s.legend = r, r;
917
- }
918
- },
919
- NegativeShapeVisitor: class extends a {
920
- visit(t, e, s) {
921
- const r = this.getFill(t, e);
922
- Object.keys(r).length > 0 && (s.fillNegative = r);
923
- const o = this.getStroke(t, e);
924
- return Object.keys(o).length > 0 && (s.strokeNegative = o), s;
925
- }
926
- },
927
- TitleVisitor: class extends r {
928
- constructor(t = "title") {
929
- super(t);
930
- }
931
- parseTitleRangeOrValue(t, e, s) {
932
- let r = t.evaluate("tx/strRef/f", e) ?? null;
933
- if (r) {
934
- const e = r.firstElementChild.nodeValue;
935
- t.setToPath(s, "range", e);
936
- }
937
- }
938
- visit(t, e, s) {
939
- const r = {};
940
- n(t, e, r, "overlay", "overlay"), s[this._jsonKey] = r;
941
- let o = t.getFromPath(r, this.getTextPath());
942
- o || (o = {}), this.parseTitleRangeOrValue(t, e, r);
943
- const i = t.evaluate("txPr", e);
944
- i && this.parseTextElement(t, i, o, !1);
945
- const l = t.evaluate("tx/rich", e);
946
- return l && this.parseTextElement(t, l, o, !0), Object.keys(o).length > 0 && t.setToPath(r, "text", o), r;
947
- }
948
- afterVisit(t, e, s) {
949
- if (s?.text) {
950
- const t = s.text?.rotation ?? null;
951
- null !== t && (s.rotation = parseInt(t), delete s.title.rotation);
952
- }
953
- }
954
- },
955
- LayoutVisitor: class {
956
- visit(t, e, s) {
957
- const r = t.evaluate("manualLayout", e);
958
- if (r) {
959
- let e = {};
960
- l(t, r, e, "x", "x"), l(t, r, e, "y", "y"), l(t, r, e, "w", "w"), l(t, r, e, "h", "h"), o(t, r, e, "xMode", "xMode"), o(t, r, e, "yMode", "yMode"), o(t, r, e, "wMode", "wMode"), o(t, r, e, "hMode", "hMode"), Object.keys(e).length > 0 && (s.manualLayout = e);
961
- }
962
- return s;
963
- }
964
- },
965
- ThemeVisitor: class {
966
- visit(t, e, s) {
967
- return s.name = e.getAttribute("name"), s;
968
- }
969
- },
970
- ClrSchemeVisitor: class extends A {
971
- visit(t, e, s) {
972
- const r = {};
973
- r.name = e.getAttribute("name");
974
- const o = e.childNodes, i = o.length;
975
- for (let s = 0; s < i; s++) {
976
- const i = o.item(s);
977
- if (1 === i.nodeType) {
978
- let s = i.localName;
979
- const o = t.evaluate(s, e);
980
- r[s] = this.processAdjColor(t, o);
981
- }
982
- }
983
- return Object.keys(r).length > 0 && (s.colors = r), r;
984
- }
985
- },
986
- FontSchemeVisitor: class {
987
- visit(t, e, s) {
988
- const r = {};
989
- r.name = e.getAttribute("name");
990
- const o = t.evaluate("majorFont", e), i = this.processFontElement(t, o, {});
991
- i && (r.majorFont = i.family, i.fallbacks && (r.majorFallbacks = i.fallbacks));
992
- const n = t.evaluate("minorFont", e), l = this.processFontElement(t, n, {});
993
- return l && (r.minorFont = l.family, l.fallbacks && (r.minorFallbacks = l.fallbacks)), s.fonts = r, r;
994
- }
995
- processFontElement(t, e, s) {
996
- if (!e) return;
997
- const r = t.evaluate("latin", e);
998
- if (!r) return;
999
- const o = r.getAttribute("typeface");
1000
- o && (s.family = o);
1001
- const i = r.getAttribute("panose");
1002
- return i && (s.fallbacks = [B.getPanoseFallback(i)]), s;
1003
- }
1004
- },
1005
- FmtSchemeVisitor: class extends A {
1006
- visit(t, e, s) {
1007
- const r = this.parseFillList(t, e, "fillStyleLst"), o = this.parseLnList(t, e, "lnStyleLst"), i = this.parseEffectStyleList(t, e, "effectStyleLst"), n = this.parseFillList(t, e, "bgFillStyleLst");
1008
- if (r && (s.fillStyleLst = r), o && (s.lnStyleLst = o), i && (s.effectStyleLst = i), n && (s.bgFillStyleLst = n), r && o && i && n) return;
1009
- const l = t.serializeElement(e);
1010
- l && (s.formatSchemeXml = l);
1011
- }
1012
- parseFillList(t, e, s) {
1013
- const r = t.evaluate(s, e);
1014
- if (!r) return;
1015
- const o = [], i = r.childNodes, n = i.length;
1016
- for (let e = 0; e < n; e++) {
1017
- const s = i.item(e);
1018
- if (1 !== s.nodeType) continue;
1019
- const r = this.parseFillListItem(t, s);
1020
- if (void 0 === r) return;
1021
- o.push(r);
1022
- }
1023
- return o;
1024
- }
1025
- parseFillListItem(t, e) {
1026
- switch (e.localName) {
1027
- case "noFill": return { type: L.Type.None };
1028
- case "solidFill": {
1029
- const s = this.processAdjColor(t, e);
1030
- return s ? {
1031
- type: L.Type.Solid,
1032
- color: s
1033
- } : void 0;
1034
- }
1035
- case "gradFill": return this.processGradFill(t, e);
1036
- case "pattFill": return this.processPatternFill(t, e);
1037
- default: return;
1038
- }
1039
- }
1040
- parseLnList(t, e, s) {
1041
- const r = t.evaluate(s, e);
1042
- if (!r) return;
1043
- const o = [], i = r.childNodes, n = i.length;
1044
- for (let e = 0; e < n; e++) {
1045
- const s = i.item(e);
1046
- 1 === s.nodeType && o.push(this.parseLn(t, s));
1047
- }
1048
- return o;
1049
- }
1050
- parseEffectStyleList(t, e, s) {
1051
- const r = t.evaluate(s, e);
1052
- if (!r) return;
1053
- const o = [], i = r.childNodes, n = i.length;
1054
- for (let e = 0; e < n; e++) {
1055
- const s = i.item(e);
1056
- if (1 !== s.nodeType) continue;
1057
- if (t.evaluate("scene3d", s) || t.evaluate("sp3d", s)) return;
1058
- const r = this.getEffects(t, s);
1059
- if (void 0 === r) return;
1060
- o.push(r ?? []);
1061
- }
1062
- return o;
1063
- }
1064
- },
1065
- AutoFilterVisitor: class {
1066
- visit(t, e, s) {
1067
- if (!e) return;
1068
- const r = {}, o = [];
1069
- return this.processFilterColumns(t, e, o, s), o.length > 0 && (r.conditions = o), Object.keys(r).length > 0 && (s.filter = r), r;
1070
- }
1071
- processColorFilter(t, e) {
1072
- const s = {}, r = {
1073
- operator: I.BuiltInOperatorNames.Color,
1074
- param: s
1075
- };
1076
- return t.copyFromAttribute(e, "cellColor", s, "cellColor", t.BOOLEAN_COPY), t.copyFromAttribute(e, "dxfId", s, "styleId", t.INT_COPY), r;
1077
- }
1078
- processCustomFilter(t, e) {
1079
- return N({
1080
- operator: e.getAttribute("operator"),
1081
- val: e.getAttribute("val")
1082
- }, (e) => t.warn(e));
1083
- }
1084
- processCustomFilters(t, e) {
1085
- const s = e.getAttribute("and"), r = "and" === s || "1" === s;
1086
- e.getAttribute("val");
1087
- const o = [], i = {
1088
- operator: r ? I.BuiltInOperatorNames.And : I.BuiltInOperatorNames.Or,
1089
- param: o
1090
- }, n = e.childNodes, l = n.length;
1091
- for (let e = 0; e < l; e++) {
1092
- const s = n.item(e);
1093
- if (1 !== s.nodeType) continue;
1094
- let r = null;
1095
- "customFilter" === s.localName && (r = this.processCustomFilter(t, s)), r && o.push(r);
1096
- }
1097
- return 1 === o.length ? o[0] : u(i);
1098
- }
1099
- processDynamicFilter(t, e) {
1100
- return p(e.getAttribute("type"));
1101
- }
1102
- processDateGroupItem(t, e) {
1103
- const s = {};
1104
- return t.copyFromAttribute(e, "dateTimeGrouping", s, "group"), t.copyFromAttribute(e, "day", s, "day", t.INT_COPY), t.copyFromAttribute(e, "hour", s, "hour", t.INT_COPY), t.copyFromAttribute(e, "minute", s, "minute", t.INT_COPY), t.copyFromAttribute(e, "month", s, "month", t.INT_COPY), t.copyFromAttribute(e, "second", s, "second", t.INT_COPY), t.copyFromAttribute(e, "year", s, "year", t.INT_COPY), s;
1105
- }
1106
- processFilterItem(t, e) {
1107
- if (e.hasAttribute("val")) return e.getAttribute("val");
1108
- }
1109
- processFilters(t, e) {
1110
- const s = {}, r = {
1111
- operator: I.BuiltInOperatorNames.InSet,
1112
- param: s
1113
- };
1114
- r.selector = I.BuiltInSelectorNames.Display, t.copyFromAttribute(e, "blank", s, "blank", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calendarType", s, "calendarType");
1115
- let o = [], i = [];
1116
- const n = e.childNodes, l = n.length;
1117
- for (let e = 0; e < l; e++) {
1118
- const s = n.item(e);
1119
- if (1 === s.nodeType) {
1120
- if ("dateGroupItem" === s.localName) {
1121
- const e = this.processDateGroupItem(t, s);
1122
- e && o.push(e);
1123
- } else if ("filter" === s.localName) {
1124
- const e = this.processFilterItem(t, s);
1125
- void 0 !== e && i.push(e);
1126
- }
1127
- }
1128
- }
1129
- return o.length > 0 && (s.dateGroups = o), i.length > 0 && (s.items = i), r;
1130
- }
1131
- processIcon(t, e) {
1132
- const s = {}, r = {
1133
- operator: I.BuiltInOperatorNames.Icon,
1134
- param: s
1135
- };
1136
- return t.copyFromAttribute(e, "iconId", s, "iconId", t.INT_COPY), t.copyFromAttribute(e, "iconSet", s), r;
1137
- }
1138
- processTop10(t, e) {
1139
- const s = {}, r = {
1140
- operator: I.BuiltInOperatorNames.TopN,
1141
- param: s
1142
- };
1143
- return t.copyFromAttribute(e, "filterVal", s, "filterVal", t.FLOAT_COPY), t.copyFromAttribute(e, "percent", s, "percent", t.BOOLEAN_COPY), t.copyFromAttribute(e, "top", s, "top", t.BOOLEAN_COPY), t.copyFromAttribute(e, "val", s, "limit", t.FLOAT_COPY), r;
1144
- }
1145
- processFilterColumnExt(t, e) {
1146
- const s = e.childNodes;
1147
- for (let e = 0; e < s.length; e++) {
1148
- const r = s.item(e);
1149
- if (1 !== r.nodeType || "ext" !== r.localName) continue;
1150
- if (m(r.getAttribute("uri")) !== m("{1AD28BCE-077C-4C59-8B6E-1921CE8616D4}")) continue;
1151
- const o = r.childNodes;
1152
- for (let e = 0; e < o.length; e++) {
1153
- const s = o.item(e);
1154
- if (1 !== s.nodeType || "filterColumn" !== s.localName) continue;
1155
- const r = s.childNodes;
1156
- for (let e = 0; e < r.length; e++) {
1157
- const s = r.item(e);
1158
- if (1 === s.nodeType && "filters" === s.localName) return this.processFilters(t, s);
1159
- }
1160
- }
1161
- }
1162
- }
1163
- processFilterCriteria(t, e) {
1164
- if (!e) return;
1165
- const s = e.childNodes;
1166
- let r;
1167
- const o = s.length;
1168
- for (let e = 0; e < o; e++) {
1169
- const o = s.item(e);
1170
- 1 === o.nodeType && ("colorFilter" === o.localName ? r = this.processColorFilter(t, o) : "customFilters" === o.localName ? r = this.processCustomFilters(t, o) : "dynamicFilter" === o.localName ? r = this.processDynamicFilter(t, o) : "filters" === o.localName ? r = this.processFilters(t, o) : "iconFilter" === o.localName ? r = this.processIcon(t, o) : "top10" === o.localName ? r = this.processTop10(t, o) : "extLst" === o.localName && (r = this.processFilterColumnExt(t, o) ?? r));
1171
- }
1172
- return r;
1173
- }
1174
- processFilterColumn(t, e, s) {
1175
- if (!e) return null;
1176
- if (!e.hasAttribute("colId")) return;
1177
- const r = parseInt(e.getAttribute("colId"));
1178
- let o = !1;
1179
- if (e.hasAttribute("hiddenButton") && (o = S(e.getAttribute("hiddenButton"))), o && s) {
1180
- let t = s.hiddenButtons;
1181
- t || (t = [], s.hiddenButtons = t), t.push(r);
1182
- }
1183
- let i = !1;
1184
- if (e.hasAttribute("showButton") && (i = S(e.getAttribute("showButton"))), i && s) {
1185
- let t = s.showButtons;
1186
- !0 !== t && (t || (t = [], s.showButtons = t), t[r] = !0);
1187
- }
1188
- const n = this.processFilterCriteria(t, e);
1189
- return n ? (n.index = r, n) : null;
1190
- }
1191
- processFilterColumns(t, e, s, r) {
1192
- if (!e) return;
1193
- const o = e.childNodes, i = o.length;
1194
- for (let e = 0; e < i; e++) {
1195
- const i = o.item(e);
1196
- if (1 === i.nodeType && "filterColumn" === i.localName) {
1197
- const e = this.processFilterColumn(t, i, r);
1198
- e && s.push(e);
1199
- }
1200
- }
1201
- return s;
1202
- }
1203
- },
1204
- SortStateVisitor: class {
1205
- visit(t, e, s) {
1206
- if (!e) return;
1207
- const r = e.getAttribute("ref"), o = {};
1208
- e.hasAttribute("caseSensitive") && (o.collatorOptions = S(e.getAttribute("caseSensitive")) ? Y.CaseSensitiveOptions : Y.CaseInsensitiveOptions);
1209
- const i = e.getAttribute("sortMethod");
1210
- null != i && "none" !== i && ("stroke" === i ? o.collatorOptions = {
1211
- ...o.collatorOptions,
1212
- collation: "stroke"
1213
- } : "pinYin" === i && (o.collatorOptions = {
1214
- ...o.collatorOptions,
1215
- collation: "pinyin"
1216
- }));
1217
- const n = {};
1218
- e.hasAttribute("columnSort") && S(e.getAttribute("columnSort")) && (n.axis = _.Axis.Column);
1219
- const l = w.fastStringToRange(r), a = [];
1220
- return this.processSortConditions(t, e, a, l, o), a.length > 0 && (n.sorts = a), Object.keys(a).length > 0 && (s.sort = n), n;
1221
- }
1222
- processSortCondition(t, e, s, r) {
1223
- if (!e) return null;
1224
- const o = {};
1225
- if (!e.hasAttribute("ref")) return void t.warn("A sort condition has no ref; it was dropped.", { onceKey: "xlsx.sheet.sort.noRef" });
1226
- if (e.hasAttribute("ref")) {
1227
- const t = e.getAttribute("ref"), r = w.fastStringToRange(t);
1228
- o.index = s ? r.colStart - s.colStart : r.colStart;
1229
- }
1230
- const i = { ...r };
1231
- return o.criteria = i, i.reverse = !1, e.hasAttribute("descending") && (i.reverse = S(e.getAttribute("descending"))), t.copyFromAttribute(e, "sortBy", i, "sortOn"), t.copyFromAttribute(e, "dxfId", i), t.copyFromAttribute(e, "iconSet", i), t.copyFromAttribute(e, "customList", i), o;
1232
- }
1233
- processSortConditions(t, e, s, r, o) {
1234
- if (!e) return;
1235
- const i = e.childNodes, n = i.length;
1236
- for (let e = 0; e < n; e++) {
1237
- const n = i.item(e);
1238
- if (1 === n.nodeType && "sortCondition" === n.localName) {
1239
- const e = this.processSortCondition(t, n, r, o);
1240
- e && s.push(e);
1241
- }
1242
- }
1243
- }
1244
- },
1245
- SheetStyleVisitor: class extends Z {
1246
- visit(t, e, s) {
1247
- this.processNumFmts(t, t.evaluate("numFmts", e), null), t.getVisitorParamsState().set("colorsToProcess", /* @__PURE__ */ new Set());
1248
- const r = {
1249
- fills: {},
1250
- fonts: {},
1251
- borders: {}
1252
- };
1253
- this.processFonts(t, t.evaluate("fonts", e), r.fonts), this.processFills(t, t.evaluate("fills", e), r.fills), this.processBorders(t, t.evaluate("borders", e), r.borders, !0), r.fills[0] = { type: L.Type.None }, r.fills[1] = {
1254
- type: L.Type.Pattern,
1255
- patternType: L.BuiltInSheetPattern.Gray125
1256
- }, r.borders[0] = {
1257
- bottom: { style: O.StrokeStyle.None },
1258
- left: { style: O.StrokeStyle.None },
1259
- right: { style: O.StrokeStyle.None },
1260
- top: { style: O.StrokeStyle.None }
1261
- };
1262
- const o = [];
1263
- this.processXFs(t, t.evaluate("cellStyleXfs", e), o, r, null, !1);
1264
- const i = /* @__PURE__ */ new Map();
1265
- if (o.length > 0) {
1266
- const r = [];
1267
- this.processCellStyles(t, t.evaluate("cellStyles", e), r, o, i), s.named = r;
1268
- }
1269
- const n = [];
1270
- this.processXFs(t, t.evaluate("cellXfs", e), n, r, i), Object.keys(n).length > 0 && (s.direct = n);
1271
- const l = this.collectHiddenXfs(t.evaluate("cellXfs", e));
1272
- l.size > 0 && t.getVisitorParamsState().set(F, l);
1273
- const a = [];
1274
- return this.processDXFs(t, t.evaluate("dxfs", e), a), this.processTableStyles(t, t.evaluate("tableStyles", e), s, a), this.processSlicerStyles(t, t.evaluate("extLst", e), s), this.processIndexColors(t, t.evaluate("colors/indexedColors", e), s), this.processMruColors(t, t.evaluate("colors/mruColors", e), s), s;
1275
- }
1276
- processIndexColors(t, e, s) {
1277
- if (!e) return;
1278
- const r = [], o = e.childNodes, i = o.length;
1279
- for (let e = 0; e < i; e++) {
1280
- const s = o.item(e);
1281
- if (1 === s.nodeType && "rgbColor" === s.localName) {
1282
- const e = { color: null };
1283
- this.processDataBarColor(t, s, e, "color"), e.color && r.push(e.color);
1284
- }
1285
- }
1286
- s.indexedColors = r;
1287
- }
1288
- processMruColors(t, e, s) {
1289
- if (!e) return;
1290
- const r = [], o = e.childNodes, i = o.length;
1291
- for (let e = 0; e < i; e++) {
1292
- const s = o.item(e);
1293
- if (1 === s.nodeType && "color" === s.localName) {
1294
- const e = { color: null };
1295
- this.processDataBarColor(t, s, e, "color"), e.color && r.push(e.color);
1296
- }
1297
- }
1298
- r.length > 0 && (s.mruColors = r);
1299
- }
1300
- processNumFmts(t, e, s) {
1301
- if (!e) return;
1302
- const r = /* @__PURE__ */ new Map();
1303
- if (t.getVisitorParamsState().set("numFmts", r), !e) return;
1304
- const o = e.childNodes, i = o.length;
1305
- for (let t = 0; t < i; t++) {
1306
- const e = o.item(t);
1307
- if (1 === e.nodeType && "numFmt" === e.localName) {
1308
- const t = e.getAttribute("numFmtId"), s = e.getAttribute("formatCode");
1309
- if (t && s) {
1310
- const e = s;
1311
- r.set(parseInt(t), e);
1312
- }
1313
- }
1314
- }
1315
- }
1316
- processXFs(t, e, s, r, o = null, i = !0) {
1317
- if (!e) return;
1318
- const n = e.childNodes, l = n.length;
1319
- for (let e = 0; e < l; e++) {
1320
- const l = n.item(e);
1321
- if (1 === l.nodeType && "xf" === l.localName) {
1322
- const e = {};
1323
- this.processXF(t, l, e, r, o, i), s.push(e);
1324
- }
1325
- }
1326
- }
1327
- processXF(t, e, s, r, o, i) {
1328
- if (!e) return;
1329
- const n = e.getAttribute("xfId");
1330
- if (n && o) {
1331
- const t = o.get(parseInt(n));
1332
- t && t !== k.BuiltInName.Normal && (s.named = t);
1333
- }
1334
- const l = (t) => !(!i && e.hasAttribute(t)) || S(e.getAttribute(t)), a = (t) => !i || e.hasAttribute(t) && S(e.getAttribute(t)), c = "0", u = i ? c : void 0;
1335
- if (l("applyFont")) {
1336
- const t = e.getAttribute("fontId") ?? u;
1337
- if (void 0 !== t && (t !== c || a("applyFont"))) {
1338
- const e = r.fonts[t];
1339
- void 0 !== e && (s.font = e);
1340
- }
1341
- }
1342
- if (l("applyFill")) {
1343
- const t = e.getAttribute("fillId") ?? u;
1344
- if (void 0 !== t && (t !== c || a("applyFill"))) {
1345
- const e = r.fills[t];
1346
- void 0 !== e && Object.keys(e).length > 0 && (s.fill = e);
1347
- }
1348
- }
1349
- if (l("applyBorder")) {
1350
- const t = e.getAttribute("borderId") ?? u;
1351
- if (void 0 !== t && (t !== c || a("applyBorder"))) {
1352
- const e = r.borders[t];
1353
- void 0 !== e && (s.borders = e);
1354
- }
1355
- }
1356
- if (l("applyNumberFormat")) {
1357
- const r = e.getAttribute("numFmtId") ?? u;
1358
- if (void 0 !== r && (r !== c || a("applyNumberFormat"))) {
1359
- const e = parseInt(r);
1360
- let o;
1361
- const i = t.getVisitorParamsState();
1362
- if (i) {
1363
- const t = i.get("numFmts");
1364
- t && (o = t.get(e)), s.numberFormat = o ?? e;
1365
- } else t.warn("Number formats were unavailable; a cell format was not read.", { onceKey: "xlsx.style.numberFormat.state" });
1366
- }
1367
- }
1368
- if (l("applyAlignment")) {
1369
- const r = t.evaluate("alignment", e);
1370
- (r || a("applyAlignment")) && this.processAlignment(t, r, s);
1371
- }
1372
- if (l("applyProtection")) {
1373
- const r = t.evaluate("protection", e);
1374
- (r || a("applyProtection")) && this.processProtection(t, r, s);
1375
- }
1376
- const h = S(e.getAttribute("quotePrefix") ?? "");
1377
- h && (s.quotePrefix = h);
1378
- }
1379
- processAlignment(t, e, s) {
1380
- const r = {};
1381
- if (e?.hasAttribute("horizontal") ? r.horizontal = e.getAttribute("horizontal") : r.horizontal = R.HorizontalAlignment.General, e?.hasAttribute("vertical") ? r.vertical = e.getAttribute("vertical") : r.vertical = R.VerticalAlignment.Bottom, e?.hasAttribute("indent") ? r.indent = parseInt(e.getAttribute("indent")) : r.indent = 0, e?.hasAttribute("relativeIndent") ? r.relativeIndent = parseInt(e.getAttribute("relativeIndent")) : r.relativeIndent = 0, S(e?.getAttribute("wrapText") ?? "") ? r.overflow = R.Overflow.Wrap : r.overflow = R.Overflow.Visible, S(e?.getAttribute("shrinkToFit") ?? "") && (r.overflow = R.Overflow.Shrink), e?.hasAttribute("textRotation")) {
1382
- let t = parseFloat(e.getAttribute("textRotation"));
1383
- t > 0 && t <= 90 ? t = 360 - t : t > 90 && t <= 180 ? t -= 90 : 255 === t && (t = 0, r.stacked = !0), r.rotation = t;
1384
- } else r.rotation = 0;
1385
- e?.hasAttribute("justifyLastLine") && (r.justifyLastLine = S(e.getAttribute("justifyLastLine")));
1386
- const o = e?.getAttribute("readingOrder");
1387
- return o && ("0" === o ? r.readingDirection = R.ReadingDirection.Auto : "1" === o ? r.readingDirection = R.ReadingDirection.LeftToRight : "2" === o ? r.readingDirection = R.ReadingDirection.RightToLeft : t.warn(`Invalid readingOrder '${o}'; the direction was left automatic.`, { onceKey: "xlsx.style.readingOrder" })), Object.keys(r).length > 0 && (s.alignment = r), s;
1388
- }
1389
- collectHiddenXfs(t) {
1390
- const e = /* @__PURE__ */ new Set();
1391
- if (!t) return e;
1392
- const s = t.childNodes;
1393
- let r = 0;
1394
- for (let t = 0; t < s.length; t++) {
1395
- const o = s.item(t);
1396
- if (1 !== o.nodeType || "xf" !== o.localName) continue;
1397
- const i = o.childNodes;
1398
- for (let t = 0; t < i.length; t++) {
1399
- const s = i.item(t);
1400
- 1 === s.nodeType && "protection" === s.localName && S(s.getAttribute("hidden") ?? "") && e.add(r);
1401
- }
1402
- r++;
1403
- }
1404
- return e;
1405
- }
1406
- processProtection(t, e, s) {
1407
- if (!e) return;
1408
- const r = e.getAttribute("locked");
1409
- return s.protection = { alwaysUnlocked: !!r && !S(r) }, s;
1410
- }
1411
- processDXF(t, e, s) {
1412
- if (!e) return;
1413
- const r = e.childNodes, o = r.length;
1414
- for (let e = 0; e < o; e++) {
1415
- const o = r.item(e);
1416
- if (1 === o.nodeType && "font" === o.localName) {
1417
- const e = {};
1418
- this.processFont(t, o, e), s.font = e;
1419
- } else if (1 === o.nodeType && "fill" === o.localName) {
1420
- const e = [];
1421
- this.processFill(t, o, e, 0), e.length > 0 && e[0] && (s.fill = e[0]);
1422
- } else if (1 === o.nodeType && "border" === o.localName) {
1423
- const e = [];
1424
- this.processBorder(t, o, e, 0, !1), e.length > 0 && e[0] && (s.borders = e[0]);
1425
- } else if (1 === o.nodeType && "numFmt" === o.localName) {
1426
- const t = o.getAttribute("formatCode");
1427
- if (t) s.numberFormat = t;
1428
- else {
1429
- const t = o.getAttribute("numFmtId");
1430
- t && (s.numberFormat = Number(t));
1431
- }
1432
- } else 1 === o.nodeType && "alignment" === o.localName && this.processAlignment(t, o, s);
1433
- }
1434
- }
1435
- processDXFs(t, e, s) {
1436
- if (!e) return;
1437
- t.getVisitorParamsState().set("processingDXFs", !0);
1438
- const r = /* @__PURE__ */ new Map();
1439
- t.getVisitorParamsState().set("dxfs", r);
1440
- const o = e.childNodes, i = o.length;
1441
- for (let e = 0; e < i; e++) {
1442
- const i = o.item(e);
1443
- if (1 === i.nodeType && "dxf" === i.localName) {
1444
- const e = {};
1445
- this.processDXF(t, i, e);
1446
- const o = s.length;
1447
- r.set(o, e), s.push(e);
1448
- }
1449
- }
1450
- t.getVisitorParamsState().delete("processingDXFs");
1451
- }
1452
- processSlicerStyles(t, e, s) {
1453
- if (!e) return;
1454
- let r = null, o = null;
1455
- const i = e.childNodes;
1456
- for (let t = 0; t < i.length; t++) {
1457
- const e = i.item(t);
1458
- if (1 !== e.nodeType || "ext" !== e.localName) continue;
1459
- const s = e.childNodes;
1460
- for (let t = 0; t < s.length; t++) {
1461
- const e = s.item(t);
1462
- 1 === e.nodeType && ("dxfs" === e.localName ? r = e : "slicerStyles" === e.localName && (o = e));
1463
- }
1464
- }
1465
- if (!o) return;
1466
- const n = [];
1467
- if (r) {
1468
- t.getVisitorParamsState().set("processingDXFs", !0);
1469
- const e = r.childNodes;
1470
- for (let s = 0; s < e.length; s++) {
1471
- const r = e.item(s);
1472
- if (1 !== r.nodeType || "dxf" !== r.localName) continue;
1473
- const o = {};
1474
- this.processDXF(t, r, o), n.push(o);
1475
- }
1476
- t.getVisitorParamsState().delete("processingDXFs");
1477
- }
1478
- const l = {}, a = o.getAttribute("defaultSlicerStyle");
1479
- a && "SlicerStyleLight1" !== a && (l.defaultSlicerStyle = a);
1480
- const c = s.tables?.styles, u = o.childNodes;
1481
- for (let e = 0; e < u.length; e++) {
1482
- const s = u.item(e);
1483
- if (1 !== s.nodeType || "slicerStyle" !== s.localName) continue;
1484
- const r = s.getAttribute("name");
1485
- if (!r) continue;
1486
- const o = {}, i = c?.[r];
1487
- i && !1 === i.table && !i.pivot && (i.wholeTable && (o.wholeTable = i.wholeTable), i.headerRow && (o.headerRow = i.headerRow), delete c[r]);
1488
- const a = t.evaluate("slicerStyleElements", s)?.childNodes, h = a?.length ?? 0;
1489
- for (let e = 0; e < h; e++) {
1490
- const s = a.item(e);
1491
- if (1 !== s.nodeType || "slicerStyleElement" !== s.localName) continue;
1492
- const r = s.getAttribute("type");
1493
- if (!r || !Q.has(r)) continue;
1494
- const i = s.getAttribute("dxfId"), l = null != i ? n[parseInt(i)] : void 0;
1495
- l ? o[r] = l : t.warn(`A slicer style names a format that does not exist (dxfId '${i}').`, { onceKey: "xlsx.style.slicerStyle.dxf" });
1496
- }
1497
- (l.styles ??= {})[r] = o;
1498
- }
1499
- c && 0 === Object.keys(c).length && (delete s.tables.styles, 0 === Object.keys(s.tables).length && delete s.tables), Object.keys(l).length > 0 && (s.slicers = l);
1500
- }
1501
- processTableStyle(t, e, s, r, o = !1) {
1502
- const i = e.getAttribute("name"), n = { name: i };
1503
- e.hasAttribute("table") && (n.table = S(e.getAttribute("table"))), e.hasAttribute("pivot") && (n.pivot = S(e.getAttribute("pivot"))), o && !n.pivot && r.unshift(null);
1504
- const l = e.childNodes, a = l.length;
1505
- for (let e = 0; e < a; e++) {
1506
- const s = l.item(e);
1507
- if (1 === s.nodeType && "tableStyleElement" === s.localName) {
1508
- const e = s.getAttribute("type"), o = s.getAttribute("dxfId");
1509
- let i = null != o ? r?.[o] : void 0;
1510
- i || (t.warn(`A table style names a format that does not exist (dxfId '${o}').`, { onceKey: "xlsx.style.tableStyle.dxf" }), i = {}), n[e] = i;
1511
- let l = null;
1512
- s.hasAttribute("size") && (l = parseInt(s.getAttribute("size"))), l && !isNaN(l) && (i.size = l);
1513
- }
1514
- }
1515
- delete n.name, s[i] = n;
1516
- }
1517
- processTableStyles(t, e, s, r, o) {
1518
- if (!e) return;
1519
- const i = {}, n = e.getAttribute("defaultTableStyle");
1520
- n && (i.defaultTableStyle = n);
1521
- const l = e.getAttribute("defaultPivotStyle");
1522
- l && (i.defaultPivotStyle = l);
1523
- const a = e.childNodes, c = {}, u = a.length;
1524
- for (let e = 0; e < u; e++) {
1525
- const s = a.item(e);
1526
- 1 === s.nodeType && "tableStyle" === s.localName && this.processTableStyle(t, s, c, r, o);
1527
- }
1528
- return Object.keys(c).length > 0 && (i.styles = c), Object.keys(i).length > 0 && (s.tables = i), s;
1529
- }
1530
- processCellStyles(t, e, s, r, o) {
1531
- if (!e) return;
1532
- const i = e.childNodes, n = i.length;
1533
- for (let t = 0; t < n; t++) {
1534
- const e = i.item(t);
1535
- if (1 === e.nodeType && "cellStyle" === e.localName) {
1536
- const t = parseInt(e.getAttribute("xfId") ?? ""), i = e.getAttribute("name"), n = e.getAttribute("builtinId");
1537
- let l = i;
1538
- if (null !== n) {
1539
- const t = k.builtInNameFromId(parseInt(n));
1540
- void 0 !== t && (l = t);
1541
- }
1542
- if (o.set(t, l), !r[t]) continue;
1543
- const a = {
1544
- name: l,
1545
- style: r[t]
1546
- };
1547
- e.getAttribute("hidden") && (a.hidden = S(e.getAttribute("hidden"))), e.getAttribute("iLevel") && (a.iLevel = parseInt(e.getAttribute("iLevel"))), s.push(a);
1548
- }
1549
- }
1550
- }
1551
- afterVisit(t, e, s) {}
1552
- },
1553
- WorkbookVisitor: class extends Z {
1554
- visit(t, e, s) {
1555
- return this.processSheetRefs(t, t.evaluate("sheets", e), s), this.processExternalReferences(t, t.evaluate("externalReferences", e), s), this.processBookViews(t, t.evaluate("bookViews", e), s), this.processDefinedNames(t, t.evaluate("definedNames", e), s), this.processCalcPr(t, t.evaluate("calcPr", e), s), this.processPivotCaches(t, t.evaluate("pivotCaches", e), s), this.processWorkbookProtection(t, t.evaluate("workbookProtection", e), s), this.processWorkbookPr(t, t.evaluate("workbookPr", e), s), s;
1556
- }
1557
- processPassword(t, e, s, r = "workbook", o = "password") {
1558
- if (!e) return;
1559
- const i = {};
1560
- t.copyFromAttribute(e, `${r}AlgorithmName`, i, "algorithm"), t.copyFromAttribute(e, `${r}HashValue`, i, "hash"), t.copyFromAttribute(e, `${r}SaltValue`, i, "salt"), t.copyFromAttribute(e, `${r}SpinCount`, i, "spinCount", t.INT_COPY), Object.keys(i).length > 0 && (s[o] = i);
1561
- }
1562
- processWorkbookProtection(t, e, s) {
1563
- if (!e) return;
1564
- const r = {};
1565
- this.processPassword(t, e, r, "workbook", "password"), this.processPassword(t, e, r, "revisions", "revisionsPassword");
1566
- for (const t of f) r[t.key] = v(t, e.getAttribute(t.attribute));
1567
- return s.protection = r, s;
1568
- }
1569
- processCalcPr(t, e, s) {
1570
- if (!e) return;
1571
- const r = {};
1572
- t.copyFromAttribute(e, "calcMode", r, "calcMode", (t) => tt[t] ?? null), t.copyFromAttribute(e, "fullCalcOnLoad", r, "fullCalcOnLoad", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calcOnSave", r, "calcOnSave", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calcCompleted", r, "calcCompleted", t.BOOLEAN_COPY), t.copyFromAttribute(e, "fullPrecision", r, "fullPrecision", t.BOOLEAN_COPY), t.copyFromAttribute(e, "forceFullCalc", r, "forceFullCalc", t.BOOLEAN_COPY), t.copyFromAttribute(e, "concurrentCalc", r, "concurrentCalc", t.BOOLEAN_COPY), t.copyFromAttribute(e, "refMode", r, "refMode"), t.copyFromAttribute(e, "iterate", r, "iterate", t.BOOLEAN_COPY), t.copyFromAttribute(e, "iterateCount", r, "maxIteration", t.INT_COPY), t.copyFromAttribute(e, "iterateDelta", r, "maxIterateChange", t.FLOAT_COPY);
1573
- const o = e.getAttribute("calcId");
1574
- null !== o && t.getVisitorParamsState().set("calcId", o), s.calc = r;
1575
- }
1576
- processSheetRefs(t, e, s) {
1577
- if (!e) return;
1578
- const r = [], o = e.childNodes, i = o.length;
1579
- for (let e = 0; e < i; e++) {
1580
- const s = o.item(e);
1581
- 1 === s.nodeType && "sheet" === s.localName && this.processSheetRef(t, s, r);
1582
- }
1583
- s.sheets = r;
1584
- }
1585
- processSheetRef(t, e, s) {
1586
- const r = {};
1587
- t.copyFromAttribute(e, "name", r, "name"), t.copyFromAttribute(e, "state", r, "visibility"), t.copyFromAttribute(e, "sheetId", r, "sheetId", t.INT_COPY);
1588
- const o = e.getAttribute("r:id"), i = t.getRef(o);
1589
- i && (r.sheet = i), s.push(r);
1590
- }
1591
- processExternalReferences(t, e, s) {
1592
- if (!e) return;
1593
- const r = [], o = e.childNodes, i = o.length;
1594
- for (let e = 0; e < i; e++) {
1595
- const s = o.item(e);
1596
- if (1 === s.nodeType && "externalReference" === s.localName) {
1597
- const e = s.getAttribute("r:id"), o = e ? t.getRef(e) : null;
1598
- r.push(o ?? null);
1599
- }
1600
- }
1601
- r.length > 0 && (s.externalBooks = r);
1602
- }
1603
- processPivotCaches(t, e, s) {
1604
- if (!e) return;
1605
- const r = [], o = e.childNodes, i = o.length;
1606
- for (let e = 0; e < i; e++) {
1607
- const s = o.item(e);
1608
- if (1 !== s.nodeType || "pivotCache" !== s.localName) continue;
1609
- const i = parseInt(s.getAttribute("cacheId") ?? "", 10), n = s.getAttribute("r:id");
1610
- if (isNaN(i) || !n) continue;
1611
- const l = t.readEmbeddedPart(n);
1612
- l && r.push({
1613
- cacheId: i,
1614
- part: l
1615
- });
1616
- }
1617
- r.length > 0 && (s.pivotCaches = r);
1618
- }
1619
- processBookViews(t, e, s) {
1620
- if (!e) return;
1621
- const r = e.childNodes;
1622
- let o = 0;
1623
- const i = r.length;
1624
- for (let e = 0; o < 1 && e < i; e++) {
1625
- const i = r.item(e);
1626
- 1 === i.nodeType && "workbookView" === i.localName && (this.processWorkbookView(t, i, s), o++);
1627
- }
1628
- }
1629
- processWorkbookView(t, e, s) {
1630
- if (!e) return;
1631
- const r = {};
1632
- t.copyFromAttribute(e, "activeTab", r, "activeSheetId", [t.INT_COPY, (t) => t]), e.hasAttribute("activeTab") || (r.activeSheetId = 0), t.copyFromAttribute(e, "showHorizontalScroll", r, "showHorizontalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showVerticalScroll", r, "showVerticalScrollbar", t.BOOLEAN_COPY), t.copyFromAttribute(e, "showSheetTabs", r, "showTabs", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tabRatio", r, "tabRatio", [t.FLOAT_COPY, (t) => t]), Object.keys(r).length > 0 && (s.view = r);
1633
- }
1634
- processDefineName(t, e, s, r) {
1635
- if (!e) return;
1636
- const o = {}, i = e.firstChild;
1637
- if (i && 3 === i.nodeType && (o.ref = i.textContent), t.copyFromAttribute(e, "name", o), t.copyFromAttribute(e, "comment", o), t.copyFromAttribute(e, "hidden", o, "hidden", t.BOOLEAN_COPY), e.hasAttribute("localSheetId")) {
1638
- const s = e.getAttribute("localSheetId");
1639
- if (!r[s]?.name) return void t.warn(`Defined name '${e.getAttribute("name")}' references a sheet with localSheetId '${s}' which does not exist.`);
1640
- o.scope = r[s].name;
1641
- }
1642
- t.copyFromAttribute(e, "customMenu", o), t.copyFromAttribute(e, "description", o), t.copyFromAttribute(e, "statusBar", o), t.copyFromAttribute(e, "help", o), t.copyFromAttribute(e, "shortcutKey", o), t.copyFromAttribute(e, "function", o, "function", t.BOOLEAN_COPY), t.copyFromAttribute(e, "functionGroupId", o, "functionGroupId", t.INT_COPY), t.copyFromAttribute(e, "publishToServer", o, "publishToServer", t.BOOLEAN_COPY), t.copyFromAttribute(e, "vbProcedure", o, "vbProcedure", t.BOOLEAN_COPY), t.copyFromAttribute(e, "xlm", o, "xlm", t.BOOLEAN_COPY), Object.keys(o).length > 0 && s.push(o);
1643
- }
1644
- processDefinedNames(t, e, s) {
1645
- if (!e) return;
1646
- const r = [], o = e.childNodes, i = o.length;
1647
- for (let e = 0; e < i; e++) {
1648
- const i = o.item(e);
1649
- 1 === i.nodeType && "definedName" === i.localName && this.processDefineName(t, i, r, s.sheets);
1650
- }
1651
- r.length > 0 && (s.names = r);
1652
- }
1653
- processWorkbookPr(t, e, s) {
1654
- e && (t.copyFromAttribute(e, "date1904", s, "date1904", t.BOOLEAN_COPY), t.copyFromAttribute(e, "codeName", s, "codeName"), t.copyFromAttribute(e, "updateLinks", s, "updateLinks"));
1655
- }
1656
- afterVisit(t, e, s) {}
1657
- },
1658
- TableVisitor: class {
1659
- visit(t, e, s) {
1660
- const r = {};
1661
- return t.copyFromAttribute(e, "ref", s, "r"), t.getVisitorParamsState().set("ref", s.r), s.v = r, t.copyFromAttribute(e, "name", r), t.copyFromAttribute(e, "displayName", r), t.copyFromAttribute(e, "headerRowCount", r, "headerRowCount", t.INT_COPY), t.copyFromAttribute(e, "totalsRowCount", r, "totalsRowCount", t.INT_COPY), this.processTableColumns(t, e, r), this.processTableStyleInfo(t, e, r), t.copyFromAttribute(e, "id", r), t.copyFromAttribute(e, "comment", r, "description"), t.copyFromAttribute(e, "connectionId", r, "connectionId", t.INT_COPY), t.copyFromAttribute(e, "tableType", r), t.copyFromAttribute(e, "published", r, "published", t.BOOLEAN_COPY), t.copyFromAttribute(e, "insertRow", r, "insertRow", t.BOOLEAN_COPY), t.copyFromAttribute(e, "insertRowShift", r, "insertRowShift", t.BOOLEAN_COPY), r.totalsRowShown = "0" !== e.getAttribute("totalsRowShown"), r;
1662
- }
1663
- afterVisit(t, e, s) {
1664
- const r = s.v;
1665
- if (t.evaluate("autoFilter", e)) {
1666
- if (Array.isArray(r.hiddenButtons)) {
1667
- const t = r.hiddenButtons.length;
1668
- 0 === t ? r.hiddenButtons = !1 : t === r.columns?.length && (r.hiddenButtons = !0);
1669
- }
1670
- } else r.hiddenButtons = !0, r.showButtons = !1;
1671
- return r;
1672
- }
1673
- processTableStyleInfo(t, e, s) {
1674
- if (!e) return;
1675
- const r = e.childNodes, o = {}, i = r.length;
1676
- for (let e = 0; e < i; e++) {
1677
- const s = r.item(e);
1678
- 1 === s.nodeType && "tableStyleInfo" === s.localName && (t.copyFromAttribute(s, "name", o), t.copyFromAttribute(s, "showColumnStripes", o, "showColumnStripes", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showFirstColumn", o, "showFirstColumn", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showLastColumn", o, "showLastColumn", t.BOOLEAN_COPY), t.copyFromAttribute(s, "showRowStripes", o, "showRowStripes", t.BOOLEAN_COPY));
1679
- }
1680
- Object.keys(o).length > 0 && (s.style = o);
1681
- }
1682
- processTableColumn(t, e, s) {
1683
- if (!e) return null;
1684
- const r = e.childNodes, o = r.length;
1685
- for (let e = 0; e < o; e++) {
1686
- const o = r.item(e);
1687
- if (1 === o.nodeType && "tableColumn" === o.localName) {
1688
- const e = {};
1689
- t.copyFromAttribute(o, "name", e), t.copyFromAttribute(o, "id", e), t.copyFromAttribute(o, "uniqueName", e), t.copyFromAttribute(o, "queryTableFieldId", e), t.copyFromAttribute(o, "totalsRowLabel", e);
1690
- let r = o.getAttribute("totalsRowFunction");
1691
- if (null !== r) if ("custom" === r) {
1692
- const s = t.evaluate("totalsRowFormula", o);
1693
- s && (e.totalsRowFormula = s.textContent);
1694
- } else e.totalsRowFormula = r;
1695
- t.copyFromAttribute(o, "totalsRowLabel", e);
1696
- const i = t.evaluate("calculatedColumnFormula", o);
1697
- i?.textContent && (e.calculatedColumnFormula = i.textContent), s.push(e);
1698
- }
1699
- }
1700
- return s;
1701
- }
1702
- processTableColumns(t, e, s) {
1703
- const r = e.childNodes, o = [], i = r.length;
1704
- for (let e = 0; e < i; e++) {
1705
- const s = r.item(e);
1706
- 1 === s.nodeType && "tableColumns" === s.localName && this.processTableColumn(t, s, o);
1707
- }
1708
- o.length > 0 && (s.columns = o);
1709
- }
1710
- },
1711
- TableX14Visitor: class {
1712
- visit(t, e, s) {
1713
- const r = t.getVisitorParamsState().get("ref");
1714
- if (r) {
1715
- const s = t.getVisitorParamsState().get("descriptions");
1716
- s && (s.add(r, e.getAttribute("altText")), s.add(r, e.getAttribute("altTextSummary")));
1717
- }
1718
- return t.copyFromAttribute(e, "altText", s), t.copyFromAttribute(e, "altTextSummary", s), s;
1719
- }
1720
- },
1721
- ExternalLinkVisitor: class {
1722
- visit(t, e, s) {
1723
- const r = e.childNodes, o = r.length;
1724
- let i = null;
1725
- for (let t = 0; t < o; t++) {
1726
- const e = r.item(t);
1727
- if (1 === e.nodeType) {
1728
- "externalBook" === e.localName && (i = e);
1729
- break;
1730
- }
1731
- }
1732
- if (!i) return s;
1733
- e.getAttribute("mc:Ignorable") && (s.mceIgnorable = !0);
1734
- const n = i.getAttribute("r:id");
1735
- n && (s.__bookRelId = n);
1736
- const l = this._findAbsoluteUrlRelId(i);
1737
- return l && (s.__absoluteUrlRelId = l), s.sheetNames = [], this.processSheetNames(t, i, s), this.processDefinedNames(t, i, s), this.processSheetDataSet(t, i, s), s;
1738
- }
1739
- processSheetNames(t, e, s) {
1740
- const r = this._findChild(e, "sheetNames");
1741
- if (!r) return;
1742
- const o = r.childNodes, i = o.length;
1743
- for (let t = 0; t < i; t++) {
1744
- const e = o.item(t);
1745
- 1 === e.nodeType && "sheetName" === e.localName && s.sheetNames.push(e.getAttribute("val") ?? "");
1746
- }
1747
- }
1748
- processDefinedNames(t, e, s) {
1749
- const r = this._findChild(e, "definedNames");
1750
- if (!r) return;
1751
- const o = [], i = r.childNodes, n = i.length;
1752
- for (let t = 0; t < n; t++) {
1753
- const e = i.item(t);
1754
- if (1 !== e.nodeType || "definedName" !== e.localName) continue;
1755
- const s = e.getAttribute("name");
1756
- if (!s) continue;
1757
- const r = {
1758
- name: s,
1759
- refersTo: e.getAttribute("refersTo") ?? ""
1760
- }, n = e.getAttribute("sheetId");
1761
- null !== n && (r.sheetIndex = parseInt(n, 10)), o.push(r);
1762
- }
1763
- o.length > 0 && (s.definedNames = o);
1764
- }
1765
- processSheetDataSet(t, e, s) {
1766
- const r = this._findChild(e, "sheetDataSet");
1767
- if (!r) return;
1768
- const o = [], i = r.childNodes, n = i.length;
1769
- for (let e = 0; e < n; e++) {
1770
- const s = i.item(e);
1771
- if (1 !== s.nodeType || "sheetData" !== s.localName) continue;
1772
- const r = s.getAttribute("sheetId");
1773
- if (null === r) continue;
1774
- const n = this.processSheetData(t, s);
1775
- n.sheetIndex = parseInt(r, 10), "1" === s.getAttribute("refreshError") && (n.refreshError = !0), o.push(n);
1776
- }
1777
- o.length > 0 && (s.sheetDataSet = o);
1778
- }
1779
- processSheetData(t, e) {
1780
- const s = new M.Builder(), r = e.childNodes, o = r.length;
1781
- for (let t = 0; t < o; t++) {
1782
- const e = r.item(t);
1783
- if (1 !== e.nodeType || "row" !== e.localName) continue;
1784
- const o = e.childNodes, i = o.length;
1785
- for (let t = 0; t < i; t++) {
1786
- const e = o.item(t);
1787
- if (1 !== e.nodeType || "cell" !== e.localName) continue;
1788
- const r = e.getAttribute("r");
1789
- if (!r) continue;
1790
- const i = w.fastStringToCell(r);
1791
- if (void 0 === i?.rowIndex || void 0 === i?.colIndex) continue;
1792
- const n = this._readCellValue(e);
1793
- void 0 !== n && s.pushAt(i.rowIndex, i.colIndex, n);
1794
- }
1795
- }
1796
- return {
1797
- sheetIndex: -1,
1798
- data: s.build()?.tuples ?? []
1799
- };
1800
- }
1801
- _readCellValue(t) {
1802
- const e = this._findChild(t, "v")?.textContent?.trim();
1803
- if (void 0 !== e && "" !== e) switch (t.getAttribute("t")) {
1804
- case null:
1805
- case "n": return parseFloat(e);
1806
- case "b": return "1" === e || "true" === e;
1807
- case "str":
1808
- default: return e;
1809
- case "e": {
1810
- const t = T.getBuiltInByLabel(e);
1811
- return t ? {
1812
- t: "e",
1813
- v: t.getCode()
1814
- } : e;
1815
- }
1816
- }
1817
- }
1818
- _findChild(t, e) {
1819
- const s = t.childNodes, r = s.length;
1820
- for (let t = 0; t < r; t++) {
1821
- const r = s.item(t);
1822
- if (1 === r.nodeType && r.localName === e) return r;
1823
- }
1824
- return null;
1825
- }
1826
- _findAbsoluteUrlRelId(t) {
1827
- const e = this._findChild(t, "alternateUrls");
1828
- return e ? this._findChild(e, "absoluteUrl")?.getAttribute("r:id") ?? null : null;
1829
- }
1830
- },
1831
- SlicerCacheDefinitionVisitor: class {
1832
- visit(t, e, s) {
1833
- t.copyFromAttribute(e, "name", s, "cacheName"), t.copyFromAttribute(e, "sourceName", s);
1834
- const r = t.evaluate("*/tableSlicerCache", e);
1835
- return r ? (t.copyFromAttribute(r, "tableId", s), t.copyFromAttribute(r, "column", s, "columnId"), t.copyFromAttribute(r, "sortOrder", s), t.copyFromAttribute(r, "customListSort", s, "customListSort", t.BOOLEAN_COPY), t.copyFromAttribute(r, "crossFilter", s), s) : (t.warn("A slicer names no table; it was not imported.", { onceKey: "xlsx.slicer.cacheDefinition" }), s);
1836
- }
1837
- },
1838
- SlicersVisitor: class {
1839
- visit(t, e, s) {
1840
- let r = s.slicers;
1841
- r || (r = {}, s.slicers = r);
1842
- const o = e.childNodes, i = o.length;
1843
- for (let e = 0; e < i; e++) {
1844
- const s = o.item(e);
1845
- 1 === s.nodeType && "slicer" === s.localName && this.processSlicer(t, s, r);
1846
- }
1847
- return r;
1848
- }
1849
- processSlicer(t, e, s) {
1850
- if (!e) return;
1851
- const r = {};
1852
- s[e.getAttribute("name")] = r, t.copyFromAttribute(e, "xr10:uid", r, "uid");
1853
- const o = e.getAttribute("cache"), i = t.getVisitorParamsState().get("slicerCaches"), n = o ? i?.get(o) : void 0;
1854
- if (n) for (let t = 0; t < et.length; t++) {
1855
- const e = et[t];
1856
- void 0 !== n[e] && (r[e] = n[e]);
1857
- }
1858
- t.copyFromAttribute(e, "caption", r), t.copyFromAttribute(e, "startItem", r, "startItem", t.INT_COPY), t.copyFromAttribute(e, "columnCount", r, "columnCount", t.INT_COPY), t.copyFromAttribute(e, "showCaption", r, "showCaption", t.BOOLEAN_COPY), t.copyFromAttribute(e, "level", r, "level", t.INT_COPY), t.copyFromAttribute(e, "style", r), t.copyFromAttribute(e, "lockedPosition", r, "lockedPosition", t.BOOLEAN_COPY), t.copyFromAttribute(e, "rowHeight", r, "rowHeight", t.INT_COPY);
1859
- }
1860
- },
1861
- FormControlPrVisitor: class {
1862
- visit(t, e, s) {
1863
- const r = {}, o = e.attributes;
1864
- for (let t = 0; t < o.length; t++) {
1865
- const e = o.item(t), s = e.name;
1866
- "xmlns" === s || s.startsWith("xmlns:") || (r[s] = e.value);
1867
- }
1868
- const i = [];
1869
- let n;
1870
- const l = e.childNodes;
1871
- for (let e = 0; e < l.length; e++) {
1872
- const s = l.item(e);
1873
- if (1 === s.nodeType) if ("itemLst" === s.localName) {
1874
- const t = s.childNodes;
1875
- for (let e = 0; e < t.length; e++) {
1876
- const s = t.item(e);
1877
- 1 === s.nodeType && "item" === s.localName && i.push(s.getAttribute("val") ?? "");
1878
- }
1879
- } else "extLst" === s.localName && (n = t.serializeElement(s) ?? void 0);
1880
- }
1881
- const a = b(r, i, n);
1882
- return s.formControl = a, a;
1883
- }
1884
- },
1885
- DrawingVisitor: class {
1886
- visit(t, e, s) {
1887
- return s;
1888
- }
1889
- afterVisit(t, e, s) {
1890
- for (const t of s?.movables ?? []) st(t, !1);
1891
- }
1892
- },
1893
- DrawingAnchorVisitor: class {
1894
- visit(t, e, s) {
1895
- if (!e) return;
1896
- const r = {};
1897
- return t.copyFromAttribute(e, "editAs", r, "anchorType"), r.anchor = {}, "absoluteAnchor" === e.localName ? (r.anchorType = "absolute", this.processAbsoluteCoord(t, t.evaluate("xdr:pos", e), r.anchor, "from", "x", "y"), this.processAbsoluteCoord(t, t.evaluate("xdr:ext", e), r.anchor, "to", "cx", "cy")) : "oneCellAnchor" === e.localName ? (this.processOffsetCoord(t, t.evaluate("from", e), r.anchor, "from"), this.processAbsoluteCoord(t, t.evaluate("xdr:ext", e), r.anchor, "to", "cx", "cy")) : (this.processOffsetCoord(t, t.evaluate("from", e), r.anchor, "from"), this.processOffsetCoord(t, t.evaluate("to", e), r.anchor, "to")), s.movables || (s.movables = []), s.movables.push(r), r;
1898
- }
1899
- processAbsoluteCoord(t, e, s, r, o, i) {
1900
- if (!e) return;
1901
- const n = {
1902
- x: 0,
1903
- y: 0
1904
- };
1905
- return n.x = h(e.getAttribute(o)), n.y = h(e.getAttribute(i)), "from" === r ? s.tl = n : s.br = n, s;
1906
- }
1907
- processOffsetCoord(t, e, s, r) {
1908
- if (!e) return;
1909
- const o = {
1910
- c: 0,
1911
- r: 0,
1912
- x: 0,
1913
- y: 0
1914
- };
1915
- return t.evaluate("col", e) && (o.c = parseInt(t.evaluate("col", e).textContent)), t.evaluate("row", e) && (o.r = parseInt(t.evaluate("row", e).textContent)), t.evaluate("colOff", e) && (o.x = h(t.evaluate("colOff", e).textContent)), t.evaluate("rowOff", e) && (o.y = h(t.evaluate("rowOff", e).textContent)), "from" === r ? s.tl = o : s.br = o, s;
1916
- }
1917
- },
1918
- DrawingGraphicFrameVisitor: class extends ot {
1919
- visit(t, e, s) {
1920
- if (!e) return;
1921
- if (this.isGroupContent(s)) {
1922
- if (t.getPath().includes("Fallback")) return {};
1923
- const { movable: r } = this.readMemberHeader(t, e, "graphicFrame"), o = t.evaluate("xfrm", e);
1924
- if (o) {
1925
- y(o, r);
1926
- const e = t.evaluate("off", o), s = t.evaluate("ext", o);
1927
- r.anchor = {
1928
- tl: {
1929
- x: h(e?.getAttribute("x") ?? null) ?? 0,
1930
- y: h(e?.getAttribute("y") ?? null) ?? 0
1931
- },
1932
- br: {
1933
- x: h(s?.getAttribute("cx") ?? null) ?? 0,
1934
- y: h(s?.getAttribute("cy") ?? null) ?? 0
1935
- }
1936
- };
1937
- }
1938
- const i = this.readGraphic(t, e);
1939
- return r.content = {
1940
- ...r.content,
1941
- type: i.type,
1942
- json: i.json
1943
- }, s.members.push(r), i.json;
1944
- }
1945
- s = super.visit(t, e, s);
1946
- const r = t.evaluate("nvGraphicFramePr/cNvGraphicFramePr", e);
1947
- if (r) {
1948
- const e = t.evaluate("graphicFrameLocks", r);
1949
- e && e.hasAttribute("noChangeAspect") && (s.lockAspect = "1" === e.getAttribute("noChangeAspect"));
1950
- }
1951
- const o = this.readGraphic(t, e);
1952
- return this.setContent(s, o), o;
1953
- }
1954
- readGraphic(t, e) {
1955
- const s = t.evaluate("graphic/graphicData", e), r = {
1956
- type: "graphicFrame",
1957
- json: {}
1958
- };
1959
- if (!s) return r;
1960
- const o = s.childNodes, i = o.length;
1961
- for (let s = 0; s < i; s++) {
1962
- const i = o.item(s);
1963
- if (1 === i.nodeType) try {
1964
- let s = i.localName;
1965
- "chart" === s ? s = "chart" : "slicer" === s && (s = "slicer"), r.type = s;
1966
- const o = i.getAttribute("r:id");
1967
- if ("chart" === s && o) {
1968
- const s = this.readSourceId(t, e);
1969
- r.json = {
1970
- xml: t.serializeElement(e) ?? void 0,
1971
- sourceId: s,
1972
- part: t.readEmbeddedPart(o) ?? void 0
1973
- };
1974
- } else if ("slicer" === s) {
1975
- const s = this.readSourceId(t, e);
1976
- void 0 !== s && (r.json = { sourceId: s });
1977
- } else o && (r.json = t.getRef(o));
1978
- } catch (e) {
1979
- t.warn(`Unable to read a graphic frame: ${e?.message ?? e}`, { onceKey: "xlsx.drawing.graphicFrame" });
1980
- }
1981
- }
1982
- return r;
1983
- }
1984
- },
1985
- DrawingSpVisitor: it,
1986
- DrawingPicVisitor: class extends ot {
1987
- visit(t, e, s) {
1988
- if (!e) return;
1989
- if (this.isGroupContent(s)) {
1990
- if (t.getPath().includes("Fallback")) return {};
1991
- const { movable: r, content: o } = this.readMemberHeader(t, e, "picture"), i = this.readImageResource(t, e);
1992
- if (null == i) return {};
1993
- o.resId = i;
1994
- const n = this.readLocks(t.evaluate("nvPicPr/cNvPicPr/picLocks", e));
1995
- return n && (void 0 !== n.noChangeAspect && (r.lockAspect = n.noChangeAspect), r.locks = n), s.members.push(r), o;
1996
- }
1997
- const r = super.visit(t, e, s), o = t.evaluate("nvPicPr/cNvPicPr", e);
1998
- if (o) {
1999
- t.copyFromAttribute(e, "preferRelativeResize", r, "preferRelativeResize", t.BOOLEAN_COPY);
2000
- const s = t.evaluate("picLocks", o);
2001
- if (s) {
2002
- s.hasAttribute("noChangeAspect") && (r.lockAspect = "1" === s.getAttribute("noChangeAspect"));
2003
- const e = {};
2004
- t.copyFromAttribute(s, "noChangeArrowheads", r, "noChangeArrowheads", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noChangeShapeType", r, "noChangeShapeType", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noEditPoints", r, "noEditPoints", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noAdjustHandles", r, "noAdjustHandles", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noCrop", r, "noCrop", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noGrp", r, "noGrp", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noMove", r, "noMove", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noResize", r, "noResize", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noRot", r, "noRot", t.BOOLEAN_COPY), t.copyFromAttribute(s, "noSelect", r, "noSelect", t.BOOLEAN_COPY), Object.keys(e).length > 0 && (r.locks = e);
2005
- }
2006
- }
2007
- const i = this.readImageResource(t, e);
2008
- if (null === i) return;
2009
- const n = { resId: i }, l = this.readSourceId(t, e);
2010
- return void 0 !== l && (n.sourceId = l), this.setContent(s, {
2011
- type: "picture",
2012
- json: n
2013
- }), r;
2014
- }
2015
- readImageResource(t, e) {
2016
- const s = t.evaluate("blipFill/blip", e);
2017
- if (!s) return;
2018
- let r = s.getAttribute("r:embed") ?? s.getAttribute("embed");
2019
- return r || (r = s.getAttribute("r:link") ?? s.getAttribute("link")), r ? t.getRef(r, !0) : (t.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.drawing.picture.noRel" }), null);
2020
- }
2021
- },
2022
- DrawingGrpSpVisitor: class extends ot {
2023
- constructor(...t) {
2024
- super(...t), this._fills = new A();
2025
- }
2026
- visit(t, e, s) {
2027
- if (!e) return;
2028
- const r = this.isGroupContent(s);
2029
- let o, i;
2030
- if (r) {
2031
- if (t.getPath().includes("Fallback")) return {};
2032
- const r = this.readMemberHeader(t, e, "group");
2033
- o = r.movable, i = r.content, s.members.push(o);
2034
- } else {
2035
- if (t.getPath().includes("Fallback") && s.content) return {};
2036
- o = super.visit(t, e, s), i = {};
2037
- const r = this.readSourceId(t, e);
2038
- void 0 !== r && (i.sourceId = r), this.setContent(o, {
2039
- type: "group",
2040
- json: i
2041
- });
2042
- }
2043
- i.members = [];
2044
- const n = t.evaluate("nvGrpSpPr/cNvGrpSpPr/grpSpLocks", e);
2045
- n?.hasAttribute?.("noChangeAspect") && (o.lockAspect = "1" === n.getAttribute("noChangeAspect"));
2046
- const l = this.readLocks(n);
2047
- l && (i.locks = l);
2048
- const a = t.evaluate("grpSpPr", e);
2049
- if (a) {
2050
- const e = t.evaluate("xfrm", a);
2051
- if (e) {
2052
- y(e, o), "1" === e.getAttribute("flipH") && (o.flipH = !0), "1" === e.getAttribute("flipV") && (o.flipV = !0);
2053
- const s = nt(t, e, "off", "ext"), n = nt(t, e, "chOff", "chExt") ?? s;
2054
- n && (i.childBounds = n), r && s && (o.anchor = {
2055
- tl: {
2056
- x: s.x,
2057
- y: s.y
2058
- },
2059
- br: {
2060
- x: s.width,
2061
- y: s.height
2062
- }
2063
- });
2064
- }
2065
- const s = this._fills.getFill(t, a);
2066
- s && Object.keys(s).length > 0 && (i.fill = s);
2067
- const n = this._fills.getEffects(t, a);
2068
- n && (i.effects = n);
2069
- const l = t.evaluate("scene3d", a), c = l ? t.serializeElement(l) : null;
2070
- c && (i.scene3d = c);
2071
- const u = t.evaluate("extLst", a), h = u ? t.serializeElement(u) : null;
2072
- h && (i.extLst = {
2073
- ...i.extLst,
2074
- properties: h
2075
- });
2076
- }
2077
- return i;
2078
- }
2079
- },
2080
- DrawingCxnSpVisitor: class extends it {
2081
- visit(t, e, s) {
2082
- if (e) return this.visitShape(t, e, s, "cxnSp", "nvCxnSpPr/cNvCxnSpPr/cxnSpLocks");
2083
- }
2084
- },
2085
- MetadataVisitor: class {
2086
- visit(t, e, s) {
2087
- const r = [], o = /* @__PURE__ */ new Map(), i = {
2088
- cells: [],
2089
- values: []
2090
- }, n = e.childNodes;
2091
- for (let t = 0; t < n.length; t++) {
2092
- const e = n.item(t);
2093
- if (1 === e.nodeType) switch (e.localName) {
2094
- case "metadataTypes":
2095
- this._parseMetadataTypes(e, r, o);
2096
- break;
2097
- case "futureMetadata":
2098
- this._attachFutureMetadata(e, o);
2099
- break;
2100
- case "cellMetadata":
2101
- this._resolveBlocks(e, r, i.cells);
2102
- break;
2103
- case "valueMetadata": this._resolveBlocks(e, r, i.values);
2104
- }
2105
- }
2106
- return s.metadata = i, i;
2107
- }
2108
- _parseMetadataTypes(t, e, s) {
2109
- const r = t.childNodes;
2110
- for (let t = 0; t < r.length; t++) {
2111
- const o = r.item(t);
2112
- if (1 === o.nodeType && "metadataType" === o.localName) {
2113
- const t = this._parseMetadataType(o);
2114
- e.push(t), s.set(t.name, t);
2115
- }
2116
- }
2117
- }
2118
- _parseMetadataType(t) {
2119
- const e = {
2120
- name: t.getAttribute("name") ?? "",
2121
- _blocks: []
2122
- }, s = t.getAttribute("minSupportedVersion");
2123
- null != s && (e.minSupportedVersion = Number(s));
2124
- for (const s of [
2125
- "copy",
2126
- "pasteAll",
2127
- "pasteValues",
2128
- "merge",
2129
- "splitFirst",
2130
- "splitAll",
2131
- "rowColShift",
2132
- "clearFormats",
2133
- "clearComments",
2134
- "assign",
2135
- "coerce",
2136
- "cellMeta",
2137
- "adjust",
2138
- "trans",
2139
- "delete",
2140
- "edit"
2141
- ]) "1" === t.getAttribute(s) && (e[s] = !0);
2142
- return e;
2143
- }
2144
- _attachFutureMetadata(t, e) {
2145
- const s = t.getAttribute("name") ?? "", r = e.get(s);
2146
- if (!r) return;
2147
- const o = t.childNodes;
2148
- for (let t = 0; t < o.length; t++) {
2149
- const e = o.item(t);
2150
- 1 === e.nodeType && "bk" === e.localName && r._blocks.push(this._parseFutureBlock(e));
2151
- }
2152
- }
2153
- _parseFutureBlock(t) {
2154
- const e = {}, s = t.childNodes;
2155
- for (let t = 0; t < s.length; t++) {
2156
- const r = s.item(t);
2157
- if (1 !== r.nodeType || "extLst" !== r.localName) continue;
2158
- const o = r.childNodes;
2159
- for (let t = 0; t < o.length; t++) {
2160
- const s = o.item(t);
2161
- if (1 !== s.nodeType || "ext" !== s.localName) continue;
2162
- const r = s.childNodes;
2163
- for (let t = 0; t < r.length; t++) {
2164
- const s = r.item(t);
2165
- 1 === s.nodeType && ("dynamicArrayProperties" === s.localName ? (e.fDynamic = "1" === s.getAttribute("fDynamic"), e.fCollapsed = "1" === s.getAttribute("fCollapsed")) : "rvb" === s.localName && (e.richValueIndex = Number(s.getAttribute("i") ?? "0")));
2166
- }
2167
- }
2168
- }
2169
- return e;
2170
- }
2171
- _resolveBlocks(t, e, s) {
2172
- const r = t.childNodes;
2173
- for (let t = 0; t < r.length; t++) {
2174
- const o = r.item(t);
2175
- 1 === o.nodeType && "bk" === o.localName && s.push(this._resolveBlock(o, e));
2176
- }
2177
- }
2178
- _resolveBlock(t, e) {
2179
- const s = /* @__PURE__ */ new Map(), r = t.childNodes;
2180
- for (let t = 0; t < r.length; t++) {
2181
- const o = r.item(t);
2182
- if (1 !== o.nodeType || "rc" !== o.localName) continue;
2183
- const i = Number(o.getAttribute("t")), n = Number(o.getAttribute("v")), l = e[i - 1];
2184
- if (!l) continue;
2185
- const { _blocks: a, ...c } = l, u = { ...c };
2186
- for (const t of Object.keys(u)) void 0 === u[t] && delete u[t];
2187
- const h = a[n];
2188
- h && (void 0 !== h.fDynamic && (u.fDynamic = h.fDynamic, u.fCollapsed = h.fCollapsed ?? !1), void 0 !== h.richValueIndex && (u.richValueIndex = h.richValueIndex)), s.set(l.name, u);
2189
- }
2190
- return s;
2191
- }
2192
- },
2193
- RichValueStructureVisitor: class {
2194
- visit(t, e, s) {
2195
- let r = t.getVisitorParamsState().get(lt);
2196
- r || (r = [], t.getVisitorParamsState().set(lt, r));
2197
- const o = e.childNodes, i = o.length;
2198
- for (let e = 0; e < i; e++) {
2199
- const s = o.item(e);
2200
- if (1 === s.nodeType && "s" === s.localName) {
2201
- const e = {
2202
- type: s.getAttribute("t") ?? "n",
2203
- keys: []
2204
- };
2205
- this.processKeys(t, s, e), r.push(e);
2206
- }
2207
- }
2208
- return s.richTypes = r, r;
2209
- }
2210
- processKeys(t, e, s) {
2211
- const r = e.childNodes, o = r.length, i = s.keys;
2212
- for (let t = 0; t < o; t++) {
2213
- const e = r.item(t);
2214
- if (1 === e.nodeType && "k" === e.localName) {
2215
- const t = e.getAttribute("n"), s = e.getAttribute("t");
2216
- i.push([t, s]);
2217
- }
2218
- }
2219
- }
2220
- },
2221
- RichValueDataVisitor: class {
2222
- visit(t, e, s) {
2223
- let r = t.getVisitorParamsState().get("richTypes");
2224
- if (!r) return void t.warn("RichValueFound but not type.");
2225
- let o = t.getVisitorParamsState().get(at);
2226
- o || (o = [], t.getVisitorParamsState().set(at, o));
2227
- const i = e.childNodes, n = i.length;
2228
- for (let e = 0; e < n; e++) {
2229
- const s = i.item(e);
2230
- if (1 === s.nodeType && "rv" === s.localName) {
2231
- const e = r[s.getAttribute("s")], i = { type: e.type };
2232
- this.processValues(t, s, i, e);
2233
- const n = this.mapType(t, i);
2234
- o.push(n);
2235
- }
2236
- }
2237
- return s.richData = o, o;
2238
- }
2239
- mapType(t, e) {
2240
- if ("_error" === e.type) {
2241
- const t = e.errorType;
2242
- if (t) try {
2243
- e = T.getBuiltInByCode(t + 1) ?? T.BuiltIn.Unknown;
2244
- } catch (t) {}
2245
- }
2246
- return e;
2247
- }
2248
- processValues(t, e, s, r) {
2249
- const o = e.childNodes, i = o.length;
2250
- r.type;
2251
- const n = r.keys;
2252
- for (let e = 0; e < i; e++) {
2253
- const r = o.item(e);
2254
- if (1 === r.nodeType && "v" === r.localName) {
2255
- const o = n[e];
2256
- if (!o) return void t.warn("Invalid richData");
2257
- const i = o[0], l = o[1];
2258
- let a = r.textContent;
2259
- "i" === l && (a = Number(a)), s[i] = a;
2260
- }
2261
- }
2262
- }
2263
- },
2264
- CommentsVisitor: class {
2265
- visit(t, e, s) {
2266
- if (!e) return;
2267
- const r = [];
2268
- this.processAuthors(t, t.evaluate("authors", e), r), r.length > 0 && (s.authors = r);
2269
- const o = [];
2270
- return s.comments = o, o;
2271
- }
2272
- processAuthors(t, e, s) {
2273
- if (!e) return;
2274
- const r = e.childNodes, o = r.length;
2275
- for (let t = 0; t < o; t++) {
2276
- const e = r.item(t);
2277
- if (1 === e.nodeType && "author" === e.localName) {
2278
- const t = e.firstChild;
2279
- t && 3 === t.nodeType && s.push(t.textContent);
2280
- }
2281
- }
2282
- }
2283
- },
2284
- CommentVisitor: class {
2285
- visit(t, e, s) {
2286
- if (!e) return;
2287
- const r = e.getAttribute("ref");
2288
- if (!r) return;
2289
- const o = { content: "" };
2290
- if (e.hasAttribute("authorId")) {
2291
- const t = parseInt(e.getAttribute("authorId"), 10);
2292
- isNaN(t) || (o.authorId = t);
2293
- }
2294
- return o.content = function(t) {
2295
- if (!t) return "";
2296
- const e = [];
2297
- let s = !0;
2298
- const r = t.childNodes;
2299
- for (let t = 0; t < r.length; t++) {
2300
- const o = r.item(t);
2301
- if (1 === o.nodeType) {
2302
- if ("t" === o.localName) e.push({ text: o.textContent ?? "" });
2303
- else if ("r" === o.localName) {
2304
- const t = { text: "" }, r = o.childNodes;
2305
- for (let e = 0; e < r.length; e++) {
2306
- const s = r.item(e);
2307
- if (1 === s.nodeType) {
2308
- if ("t" === s.localName) t.text += s.textContent ?? "";
2309
- else if ("rPr" === s.localName) {
2310
- const e = ht(s);
2311
- e && (t.font = e);
2312
- }
2313
- }
2314
- }
2315
- t.font && (s = !1), e.push(t);
2316
- }
2317
- }
2318
- }
2319
- return 0 === e.length ? t.textContent ?? "" : s ? e.map((t) => t.text).join("") : { runs: e };
2320
- }(t.evaluate("text", e)), s.push({
2321
- r,
2322
- v: o
2323
- }), o;
2324
- }
2325
- },
2326
- ThreadedCommentsVisitor: class {
2327
- visit(t, e, s) {
2328
- if (!e) return;
2329
- const r = [];
2330
- return s.comments = r, r;
2331
- }
2332
- },
2333
- ThreadedCommentVisitor: class {
2334
- visit(t, e, s) {
2335
- if (!e) return;
2336
- const r = {};
2337
- t.copyFromAttribute(e, "id", r, "id", x);
2338
- const o = e.getAttribute("ref");
2339
- t.copyFromAttribute(e, "personId", r, "personId", x), t.copyFromAttribute(e, "parentId", r, "parentId", x);
2340
- const i = e.getAttribute("dT");
2341
- i && (r.dt = function(t) {
2342
- const e = /^(.*T\d{2}:\d{2}:\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:?\d{2})?$/i.exec(t.trim());
2343
- if (!e) return t;
2344
- const [, s, r, o] = e;
2345
- return `${s}${r ? `.${(r + "00").substring(0, 3)}` : ""}${o ?? "Z"}`;
2346
- }(i)), e.hasAttribute("done") && (r.done = S(e.getAttribute("done")));
2347
- const n = function(t) {
2348
- let e;
2349
- const s = t.childNodes;
2350
- for (let t = 0; t < s.length; t++) {
2351
- const r = s.item(t);
2352
- if (1 !== r.nodeType || "mentions" !== r.localName) continue;
2353
- const o = r.childNodes;
2354
- for (let t = 0; t < o.length; t++) {
2355
- const s = o.item(t);
2356
- if (1 !== s.nodeType || "mention" !== s.localName) continue;
2357
- const r = s.getAttribute("mentionId"), i = s.getAttribute("mentionpersonId");
2358
- if (!r || !i) continue;
2359
- const n = {
2360
- id: x(r),
2361
- personId: x(i)
2362
- }, l = parseInt(s.getAttribute("startIndex") ?? "", 10);
2363
- isNaN(l) || (n.startIndex = l);
2364
- const a = parseInt(s.getAttribute("length") ?? "", 10);
2365
- isNaN(a) || (n.length = a), (e ??= []).push(n);
2366
- }
2367
- }
2368
- return e;
2369
- }(e);
2370
- return n && (r.mentions = n), s.push({
2371
- r: o,
2372
- v: r
2373
- }), r;
2374
- }
2375
- },
2376
- PersonListVisitor: class {
2377
- visit(t, e, s) {
2378
- const r = [], o = e.childNodes, i = o.length;
2379
- for (let e = 0; e < i; e++) {
2380
- const s = o.item(e);
2381
- if (1 === s.nodeType && "person" === s.localName) {
2382
- const e = {};
2383
- t.copyFromAttribute(s, "id", e, "id", x), t.copyFromAttribute(s, "displayName", e), t.copyFromAttribute(s, "userId", e, "userId", x), t.copyFromAttribute(s, "providerId", e), r.push(e);
2384
- }
2385
- }
2386
- return r.length > 0 && (s.persons = r), r;
2387
- }
2388
- }
2389
- }, pt = class {
2390
- constructor(t, e) {
2391
- this.path = t, this.visitor = e;
2392
- }
2393
- }, mt = class {
2394
- constructor() {
2395
- this.visitorsByXmlTagName = /* @__PURE__ */ new Map(), this.scopedVisitorsByXmlTagName = /* @__PURE__ */ new Map(), this.visitorParamsState = null, this.registerVisitor("Relationships", new dt.RelsVisitor()), this.registerVisitor("cp:coreProperties", new dt.CorePropertiesVisitor()), this.registerVisitor("Properties", new dt.AppPropertiesVisitor()), this.registerVisitor("spPr", new dt.ShapePropertiesVisitor()), this.registerVisitor("txBody", new dt.ShapeTextVisitor()), this.registerVisitor("txPr", new dt.TextPropertiesVisitor()), this.registerVisitor("c:chartSpace", new dt.ChartSpaceVisitor()), this.registerVisitor("c:plotArea", new dt.PlotAreaVisitor()), this.registerVisitor("c:barChart", new dt.BarChartTypeVisitor()), this.registerVisitor("c:doughnutChart", new dt.ChartTypeVisitor()), this.registerVisitor("c:lineChart", new dt.ChartTypeVisitor()), this.registerVisitor("c:ofPieType", new dt.ChartTypeVisitor()), this.registerVisitor("c:pieChart", new dt.ChartTypeVisitor()), this.registerVisitor("c:scatterChart", new dt.ChartTypeVisitor()), this.registerVisitor("c:barChart", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:doughnutChart", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:lineChart", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:ofPieType", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:pieChart", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:scatterChart", new dt.DataLabelsVisitor("dataLabels"), "dLbls"), this.registerVisitor("c:ser", new dt.SeriesVisitor()), this.registerVisitor("c:dPt", new dt.DataPointVisitor()), this.registerVisitor("c:marker", new dt.MarkerVisitor()), this.registerVisitor("c:catAx", new dt.AxisVisitor()), this.registerVisitor("c:valAx", new dt.AxisVisitor()), this.registerVisitor("c:dateAx", new dt.AxisVisitor()), this.registerVisitor("c:majorGridlines", new K("gridLinesMajor")), this.registerVisitor("c:minorGridlines", new K("gridLinesMinor")), this.registerVisitor("c:chartSpace", null, "txPr"), this.registerVisitor("c:catAx", new dt.TextPropertiesVisitor("labels.text"), "txPr"), this.registerVisitor("c:valAx", new dt.TextPropertiesVisitor("labels.text"), "txPr"), this.registerVisitor("c:dateAx", new dt.TextPropertiesVisitor("labels.text"), "txPr"), this.registerVisitor("c:legend", new dt.LegendVisitor()), this.registerVisitor("c:legend", new dt.TextPropertiesVisitor("labels.text"), "txPr"), this.registerVisitor("c:legendEntry", new dt.LegendEntryVisitor()), this.registerVisitor("c:ser", new dt.NegativeShapeVisitor(), "extLst/ext/invertSolidFillFmt/spPr"), this.registerVisitor("c:ser", new dt.DataLabelsVisitor("labels"), "dLbls"), this.registerVisitor("c:dLbl", new dt.DataLabelsVisitor("points")), this.registerVisitor("c:title", new dt.TitleVisitor()), this.registerVisitor("c:title", null, "tx/rich"), this.registerVisitor("c:title", null, "txPr"), this.registerVisitor("c:layout", new dt.LayoutVisitor()), this.registerVisitor("c:dispUnits", new K("dispUnits")), this.registerVisitor("c:dispUnitsLbl", new dt.TitleVisitor("displayUnitsLabel")), this.registerVisitor("c:dispUnitsLbl", new dt.TextPropertiesVisitor(), "tx/rich"), this.registerVisitor("a:theme", new dt.ThemeVisitor()), this.registerVisitor("a:theme", new dt.ClrSchemeVisitor(), "themeElements/clrScheme"), this.registerVisitor("a:theme", new dt.FontSchemeVisitor(), "themeElements/fontScheme"), this.registerVisitor("a:theme", new dt.FmtSchemeVisitor(), "themeElements/fmtScheme"), this.registerVisitor("autoFilter", new dt.AutoFilterVisitor()), this.registerVisitor("sortState", new dt.SortStateVisitor()), this.registerVisitor("s:workbook", new dt.WorkbookVisitor()), this.registerVisitor("styleSheet", new dt.SheetStyleVisitor()), this.registerVisitor("x14:table", new dt.TableX14Visitor()), this.registerVisitor("table", new dt.TableVisitor()), this.registerVisitor("externalLink", new dt.ExternalLinkVisitor()), this.registerVisitor("wsDr", new dt.DrawingVisitor()), this.registerVisitor("twoCellAnchor", new dt.DrawingAnchorVisitor()), this.registerVisitor("oneCellAnchor", new dt.DrawingAnchorVisitor()), this.registerVisitor("absoluteAnchor", new dt.DrawingAnchorVisitor()), this.registerVisitor("graphicFrame", new dt.DrawingGraphicFrameVisitor()), this.registerVisitor("sp", new dt.DrawingSpVisitor()), this.registerVisitor("grpSp", new dt.DrawingGrpSpVisitor()), this.registerVisitor("cxnSp", new dt.DrawingCxnSpVisitor()), this.registerVisitor("pic", new dt.DrawingPicVisitor()), this.registerVisitor("metadata", new dt.MetadataVisitor()), this.registerVisitor("rvStructures", new dt.RichValueStructureVisitor()), this.registerVisitor("rvData", new dt.RichValueDataVisitor()), this.registerVisitor("comments", new dt.CommentsVisitor()), this.registerVisitor("comment", new dt.CommentVisitor()), this.registerVisitor("ThreadedComments", new dt.ThreadedCommentsVisitor()), this.registerVisitor("threadedComment", new dt.ThreadedCommentVisitor()), this.registerVisitor("threadedComment", new dt.TextPropertiesVisitor("content"), "text"), this.registerVisitor("personList", new dt.PersonListVisitor()), this.registerVisitor("slicerCacheDefinition", new dt.SlicerCacheDefinitionVisitor()), this.registerVisitor("slicers", new dt.SlicersVisitor()), this.registerVisitor("formControlPr", new dt.FormControlPrVisitor());
2396
- }
2397
- registerVisitor(t, e, s = null) {
2398
- -1 === t.indexOf(":") && (t = "*:" + t);
2399
- const r = t.split(":"), o = r.length > 1 ? r[1] : r[0];
2400
- if (!s) return this.visitorsByXmlTagName.set(o, e), void this.visitorsByXmlTagName.set(t, e);
2401
- let i = this.scopedVisitorsByXmlTagName.get(o);
2402
- i || (i = [], this.scopedVisitorsByXmlTagName.set(o, i), this.scopedVisitorsByXmlTagName.set(t, i)), i.push(new pt(s, e));
2403
- }
2404
- parseDxf(t, e = "", s = P.EmptyObject) {
2405
- this.visitorParamsState || (this.visitorParamsState = /* @__PURE__ */ new Map());
2406
- const r = this.visitorParamsState, o = r.get("processingDXFs");
2407
- r.set("processingDXFs", !0);
2408
- try {
2409
- const r = new H(null, this, "/dxf", t, {}, e, s), o = {};
2410
- return new dt.SheetStyleVisitor().processDXF(r, t, o), o;
2411
- } finally {
2412
- void 0 === o ? r.delete("processingDXFs") : r.set("processingDXFs", o);
2413
- }
2414
- }
2415
- getVisitorParamsState() {
2416
- return this.visitorParamsState;
2417
- }
2418
- transform(t, e, s = P.EmptyObject) {
2419
- const r = t.documentElement;
2420
- this.visitorParamsState && !s?.paramMap || (this.visitorParamsState = s?.paramMap ?? /* @__PURE__ */ new Map());
2421
- const o = {};
2422
- let i = this.visitorsByXmlTagName.get(r.nodeName);
2423
- if (i || (i = this.visitorsByXmlTagName.get(r.localName)), !i) throw new Error(`A visitor for the root element: '${r.nodeName}' or '${r.localName}' must be registered.`);
2424
- const n = "/" + r.localName, l = new H(null, this, n, r, o, e, s), a = [];
2425
- this._doWalk(i, l, a, r, o, e, s);
2426
- const c = a.length;
2427
- for (let t = 0; t < c; t++) {
2428
- const e = a[t];
2429
- try {
2430
- e.visitor?.afterVisit?.(e.context, e.elemParent, e.jsonParent);
2431
- } catch (t) {
2432
- e.context.warn(`Unable to finish reading '${e.context.getPath()}': ${t?.message ?? t}`, { onceKey: "xlsx.transform.afterVisit" });
2433
- }
2434
- }
2435
- return o;
2436
- }
2437
- _walkScoped(t, e, s, r, o, i, n) {
2438
- const l = this.scopedVisitorsByXmlTagName.get(t), a = l ? l.length : 0;
2439
- for (let c = 0; c < a; c++) {
2440
- const a = l[c];
2441
- let u = null;
2442
- try {
2443
- u = e.evaluate(a.path, r);
2444
- } catch (s) {
2445
- e.warn(`Invalid path '${a.path}' for '${t}'.`, { onceKey: "xlsx.transform.invalidPath" });
2446
- }
2447
- if (!u) continue;
2448
- const h = (t) => {
2449
- let l = t.localName, c = t.parentNode;
2450
- for (; c && c !== r;) l = c.localName + "/" + l, c = c.parentNode;
2451
- const u = e.getPath() + "/" + l;
2452
- if (a.visitor) {
2453
- const r = new H(e, this, u, e.getElemRoot(), e.getJsonRoot(), i, n);
2454
- this._doWalk(a.visitor, r, s, t, o, i, n);
2455
- }
2456
- };
2457
- if (u.length > 0) {
2458
- const t = u, e = t.length;
2459
- for (let s = 0; s < e; s++) h(t.item(s));
2460
- } else h(u);
2461
- }
2462
- }
2463
- _doWalk(t, e, s, r, o, i, n) {
2464
- let l = null;
2465
- t && (s.push({
2466
- visitor: t,
2467
- context: e,
2468
- elemParent: r,
2469
- jsonParent: o
2470
- }), l = t.visit(e, r, o)), l || (l = o);
2471
- const a = r.localName;
2472
- this._walkScoped(a, e, s, r, l, i, n);
2473
- const c = this.visitorsByXmlTagName, u = e.getElemRoot(), h = e.getJsonRoot(), d = r.childNodes, p = d.length;
2474
- for (let t = 0; t < p; t++) {
2475
- const r = d.item(t);
2476
- if (1 !== r.nodeType) continue;
2477
- const a = r;
2478
- let p = a.nodeName, m = c.get(p);
2479
- m || (p = a.localName, m = c.get(p));
2480
- const g = e.getPath() + "/" + p, f = new H(e, this, g, u, h, i, n);
2481
- this._doWalk(m, f, s, a, l ?? o, i, n);
2482
- }
2483
- return l;
2484
- }
2485
- };
2486
- export { mt as DOMTransformer, H as ExecutionContext, g as NumberUtils, t as VisitorUtils };