@sheetxl/studio-vanilla 0.4.10 → 0.4.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 (131) hide show
  1. package/browser/cjs/B0rdyyttE2Aibsag.cjs +7 -0
  2. package/browser/cjs/B2e7dDI-zKoqXpIW.cjs +107 -0
  3. package/browser/cjs/BAyEOOtO-9sHQQRW.cjs +7 -0
  4. package/browser/cjs/BPTHTRDvNOVkUJGa.cjs +7 -0
  5. package/browser/cjs/BlSFY6zLlebuejdV.cjs +7 -0
  6. package/browser/cjs/BplA5pDzOJpfTZuA.cjs +7 -0
  7. package/browser/cjs/BshvMtUxTJHj3JQN.cjs +7 -0
  8. package/browser/cjs/BuWtGFX0HiBezGjw.cjs +7 -0
  9. package/browser/cjs/C5FXOMLhAu_KTjVe.cjs +7 -0
  10. package/browser/cjs/C7EZCTczsC-gkRcq.cjs +7 -0
  11. package/browser/cjs/CFcjX5-nVsgzdZ4F.cjs +7 -0
  12. package/browser/cjs/CjZbhk41S1qO_74G.cjs +7 -0
  13. package/browser/cjs/CuTW2Pt-L5n-hNxV.cjs +7 -0
  14. package/browser/cjs/D3iOk-Q2tRdUeTcn.cjs +7 -0
  15. package/browser/cjs/DFspSkki779xN-Ey.cjs +7 -0
  16. package/browser/cjs/DFtyXc7YFh9dIp74.cjs +7 -0
  17. package/browser/cjs/Db_Ew1r6yOMYylvA.cjs +7 -0
  18. package/browser/cjs/DgBn3aW39yjgm0X_.cjs +7 -0
  19. package/browser/cjs/DiBy6-IxLscyMW2y.cjs +7 -0
  20. package/browser/cjs/DrlS1oz9Nea8Pm3j.cjs +7 -0
  21. package/browser/cjs/Dx-jp_LJxWbAScyA.cjs +7 -0
  22. package/browser/cjs/SzxJv7OUs5ojl8gx.cjs +7 -0
  23. package/browser/cjs/T4SHYo66xDT3l9JN.cjs +7 -0
  24. package/browser/cjs/index.cjs +4 -3
  25. package/browser/cjs/vfUix5Di0Ro8tEID.cjs +7 -0
  26. package/browser/esm/B5kkStdEkTczERyM.mjs +7 -0
  27. package/browser/esm/B905wKzTtod-jbsD.mjs +7 -0
  28. package/browser/esm/BALnKy2Fp7fyk-lc.mjs +7 -0
  29. package/browser/esm/BDVJ7eOPpW5FnEAP.mjs +7 -0
  30. package/browser/esm/BGpv6Kq7eBlJy43T.mjs +7 -0
  31. package/browser/esm/BUSR_OK5Qi6hRPfw.mjs +7 -0
  32. package/browser/esm/BXUGsC1Mo3FP8vnW.mjs +7 -0
  33. package/browser/esm/BlGoi1_x9rUMpWMd.mjs +7 -0
  34. package/browser/esm/Bo_ZPRrOQrqOVHAF.mjs +7 -0
  35. package/browser/esm/BuURCm92KsyGHG9e.mjs +7 -0
  36. package/browser/esm/CFFC0SNc24a0Dxnh.mjs +7 -0
  37. package/browser/esm/CGZ5MX7afzMxDkCe.mjs +7 -0
  38. package/browser/esm/Cc_VWd0wF5-39LsI.mjs +7 -0
  39. package/browser/esm/Cq8D_M0jeHLcnRjg.mjs +7 -0
  40. package/browser/esm/CzmNwV9tfFYUp_gS.mjs +7 -0
  41. package/browser/esm/De6RPxc4p_jXLlT5.mjs +7 -0
  42. package/browser/esm/DlVZFM9ZR5jGyG0_.mjs +7 -0
  43. package/browser/esm/DqXxZP6yKF4U1YfY.mjs +7 -0
  44. package/browser/esm/DtmE60AvstK9u0Ta.mjs +107 -0
  45. package/browser/esm/Dz2OVgq3kxi1TkfX.mjs +7 -0
  46. package/browser/esm/PS0cqYnlMVEGOQpI.mjs +7 -0
  47. package/browser/esm/QBGUD1XS5_pysBLL.mjs +7 -0
  48. package/browser/esm/index.mjs +2 -8
  49. package/browser/esm/tFhROdVSw9KLQfUN.mjs +7 -0
  50. package/browser/esm/uGDCdtqxjqRCo4Xn.mjs +7 -0
  51. package/cdn/index.js +40 -44
  52. package/cdn/loader.js +1 -1
  53. package/package.json +5 -5
  54. package/browser/cjs/B1UGqZP_7Z0Ewpog.cjs +0 -6
  55. package/browser/cjs/B6m9VXoFseD4zuZ5.cjs +0 -6
  56. package/browser/cjs/BKePSaEpM6Z063z-.cjs +0 -161
  57. package/browser/cjs/Bqn0ZeP_srNfL9rG.cjs +0 -6
  58. package/browser/cjs/C-izbj62pQuZjOrT.cjs +0 -304
  59. package/browser/cjs/C-w-GX8N54TxTjjf.cjs +0 -6
  60. package/browser/cjs/C1QGdcqJ-9sdGTQR.cjs +0 -6
  61. package/browser/cjs/C38aiRglHLxZ8KRY.cjs +0 -6
  62. package/browser/cjs/C4JMn_hMnlOnDpQO.cjs +0 -6
  63. package/browser/cjs/CApEj4LhhPUvQjIG.cjs +0 -16
  64. package/browser/cjs/CFcJbmmXjWjl6fQH.cjs +0 -6
  65. package/browser/cjs/CKiDbCZ6rGgXK7yN.cjs +0 -42
  66. package/browser/cjs/CM8btXQsJbnFKXUm.cjs +0 -6
  67. package/browser/cjs/Cb0K3Wzp7BAa4zni.cjs +0 -15
  68. package/browser/cjs/CiAUhPU7v1BK-8Bb.cjs +0 -7
  69. package/browser/cjs/CsXS-EN0N5SZHTnQ.cjs +0 -145
  70. package/browser/cjs/Cu2eUomoF0HToa4l.cjs +0 -6
  71. package/browser/cjs/Cy7ii9B_Vqx94pbu.cjs +0 -19
  72. package/browser/cjs/CzI4ZcsmzsyPBpWN.cjs +0 -12
  73. package/browser/cjs/DKHzUx2gKXwboKy1.cjs +0 -11
  74. package/browser/cjs/DKc8wAq8dwbDddQn.cjs +0 -11
  75. package/browser/cjs/DMyKApbUVRtNYC4e.cjs +0 -6
  76. package/browser/cjs/DROR08HMGyg7rizQ.cjs +0 -6
  77. package/browser/cjs/DfGDZlbFVknGyu_X.cjs +0 -6
  78. package/browser/cjs/OQdqVM_6m78kE5Aj.cjs +0 -7
  79. package/browser/cjs/v4OEtYXaUw_GeiXM.cjs +0 -12
  80. package/browser/esm/4uEr84M4w57AMyDg.mjs +0 -1703
  81. package/browser/esm/B8Ja5DlyKAy8xfQD.mjs +0 -1365
  82. package/browser/esm/B9bN60uAvy62vnwt.mjs +0 -22
  83. package/browser/esm/BAOzSQdzHl43K9Hd.mjs +0 -50
  84. package/browser/esm/BQYSD5Nb35y0WeeV.mjs +0 -421
  85. package/browser/esm/BVcaNvORp_uKPQgJ.mjs +0 -46
  86. package/browser/esm/BqXO_cQhrMJu7JoQ.mjs +0 -3756
  87. package/browser/esm/C18A_DcIEHNYBDvR.mjs +0 -46
  88. package/browser/esm/C7FoKZbSzjvuY3UB.mjs +0 -43
  89. package/browser/esm/CCIJpHSbFPjTEF8S.mjs +0 -1665
  90. package/browser/esm/CHNPjJxb0GY_naLa.mjs +0 -25025
  91. package/browser/esm/CKHsU9LUNYowimxS.mjs +0 -1346
  92. package/browser/esm/C_Zx1tYjI3n7KKZH.mjs +0 -21
  93. package/browser/esm/Cm-m3bZh0V44y0li.mjs +0 -390
  94. package/browser/esm/D1e_ccSgcNXvWHgy.mjs +0 -151
  95. package/browser/esm/D47D26mVYSAdb5C8.mjs +0 -2178
  96. package/browser/esm/D9CdO3PtV12RnK8K.mjs +0 -1467
  97. package/browser/esm/D9x-Q8y57gePf-tE.mjs +0 -944
  98. package/browser/esm/DHhXutXh7b5LsU1m.mjs +0 -2346
  99. package/browser/esm/DIGFi66CQPMV3HsL.mjs +0 -84
  100. package/browser/esm/DamiTeQsSMP2Cwld.mjs +0 -58
  101. package/browser/esm/DhD48oFrbrnZ6Zg5.mjs +0 -13208
  102. package/browser/esm/Ln2ZalJgj1CiJJue.mjs +0 -50
  103. package/browser/esm/S9fgUO7h8YgZxoKH.mjs +0 -633
  104. package/browser/esm/qVAHcpq07IhtAaQc.mjs +0 -24
  105. package/browser/esm/xrzJ8ILZHb118Oyt.mjs +0 -41
  106. package/cdn/assets/2-xJlw77WsCoyz09.js +0 -24872
  107. package/cdn/assets/B-9FcTf3xBEVGdjV.js +0 -1467
  108. package/cdn/assets/B-p1i2SNRMunPXCF.js +0 -43
  109. package/cdn/assets/B3J6oAmsS7oLNFPd.js +0 -46
  110. package/cdn/assets/B8Ja5DlyKAy8xfQD.js +0 -1365
  111. package/cdn/assets/BG3YTMAzNKPRGoLs.js +0 -50
  112. package/cdn/assets/BQYSD5Nb35y0WeeV.js +0 -421
  113. package/cdn/assets/BbzUpvQOkxsN-yIH.js +0 -2346
  114. package/cdn/assets/BqXO_cQhrMJu7JoQ.js +0 -3756
  115. package/cdn/assets/Bt1JSlSpWXDOBfq3.js +0 -1703
  116. package/cdn/assets/CCIJpHSbFPjTEF8S.js +0 -1665
  117. package/cdn/assets/CKHsU9LUNYowimxS.js +0 -1346
  118. package/cdn/assets/CWLJZwD2GVXljoWG.js +0 -46
  119. package/cdn/assets/Cm-m3bZh0V44y0li.js +0 -390
  120. package/cdn/assets/CtQlXGkNWgI-vtGy.js +0 -2178
  121. package/cdn/assets/DIGFi66CQPMV3HsL.js +0 -84
  122. package/cdn/assets/DK4S0DbayChkfTD6.js +0 -58
  123. package/cdn/assets/DQvsBz9F1GS_S7r9.js +0 -50
  124. package/cdn/assets/DTOgv_zwXSur-yCq.js +0 -151
  125. package/cdn/assets/DYZjOnD8WWQkCYuH.js +0 -944
  126. package/cdn/assets/DhD48oFrbrnZ6Zg5.js +0 -13208
  127. package/cdn/assets/DhyAyTCDkMBf392P.js +0 -21
  128. package/cdn/assets/P7HeVw5SHROLSWBz.js +0 -24
  129. package/cdn/assets/S4Z0SN8x6EltjsHT.js +0 -22
  130. package/cdn/assets/S9fgUO7h8YgZxoKH.js +0 -633
  131. package/cdn/assets/guYe4C_6pE93QsDV.js +0 -41
@@ -1,1703 +0,0 @@
1
- import { Y } from "./CHNPjJxb0GY_naLa.mjs";
2
- import { c as x, b as f, r as I, t as Z, a as A, p as D, d as tt } from "./D9CdO3PtV12RnK8K.mjs";
3
- import { IFont as k, IAutoFilter as T, Sort as G, IRange as et, AddressUtils as W, IFill as C, IStyle as rt, ITextFrame as P, FormulaError as st, IBorder as V } from "@sheetxl/sdk";
4
- /**
5
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.4.10
6
- *
7
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
8
- * License: The license can be found at https://www.sheetxl.com/license.
9
- */
10
- class ot {
11
- constructor(t) {
12
- this.list = t;
13
- }
14
- get length() {
15
- return this.list.length;
16
- }
17
- item(t) {
18
- return this.list[t];
19
- }
20
- forEach(t, e) {
21
- for (let s = 0; s < this.list.length; s++) t(this.list[s], s, this);
22
- }
23
- }
24
- const it = (u) => u === !0 || u === "1" || u === "on" || u === "true" || u !== !1 && u !== "0" && u !== "off" && u !== "false" && null, nt = (u) => {
25
- const t = parseInt(u);
26
- return isNaN(t) ? null : t;
27
- }, lt = (u) => {
28
- const t = parseFloat(u);
29
- return isNaN(t) ? null : t;
30
- }, at = /* @__PURE__ */ new Map();
31
- class _ {
32
- constructor(t, e, s, r, o, i = null, n) {
33
- const l = (c, h, p) => n?.getRef?.(c, h, p, n?.parsedRefs), a = (c) => n?.getRefs?.(c, n?.parsedRefs);
34
- 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) : (i && (this._fileLocation = i), l && a && (this._getRef = l), a && (this._getRefs = a), this._onWarning = n?.onWarning, this._addPerson = n?.addPerson);
35
- }
36
- getRef(t, e = !1) {
37
- return this._getRef?.(t, this._fileLocation, e) ?? null;
38
- }
39
- getRelationships() {
40
- return this._getRefs(this._fileLocation) ?? at;
41
- }
42
- getPath() {
43
- return this.currentPath;
44
- }
45
- getElemRoot() {
46
- return this.elemRoot;
47
- }
48
- getJsonRoot() {
49
- return this.jsonRoot;
50
- }
51
- warn(t) {
52
- this._onWarning ? this._onWarning(t) : this._parent ? this._parent?.warn?.(t) : console.warn(t);
53
- }
54
- addPerson(t) {
55
- return this._addPerson ? this._addPerson(t) : this._parent ? this._parent?._addPerson?.(t) : null;
56
- }
57
- getVisitorParamsState() {
58
- return this.sharedShared.getVisitorParamsState();
59
- }
60
- evaluate(t, e) {
61
- if (!t) return e;
62
- let s = [e];
63
- const r = t.split("/");
64
- for (let o = 0; o < r.length; o++) {
65
- const i = r[o];
66
- if (i === "" || i === ".") continue;
67
- let n = [];
68
- for (let l = 0; l < s.length; l++) {
69
- const a = s[l], c = a.childNodes;
70
- for (let h = 0; c && h < c.length; h++) {
71
- const p = a.childNodes[h];
72
- p.localName !== i && i !== "*" || n.push(p);
73
- }
74
- }
75
- s = n;
76
- }
77
- return s.length === 1 ? s[0] : s.length === 0 ? null : new ot(s);
78
- }
79
- getFromPath(t, e) {
80
- return Y.getFromPath(t, e);
81
- }
82
- setToPath(t, e, s) {
83
- return Y.setToPath(t, e, s);
84
- }
85
- getValAttrAsString(t, e) {
86
- let s = this.evaluate(t, e);
87
- return s && s.hasAttribute("val") ? s.getAttribute("val") ?? null : null;
88
- }
89
- getValAttrAsBoolean(t, e, s = !1) {
90
- let r = this.evaluate(t, e);
91
- if (!r) return null;
92
- const o = r.hasAttribute("val") ? r.getAttribute("val") : void 0;
93
- return o == null ? s : o === "1" || o === "on" || o === "true" || o !== "0" && o !== "off" && o !== "false" && s;
94
- }
95
- getValAttrAsInteger(t, e) {
96
- let s = this.evaluate(t, e);
97
- return s && s.hasAttribute("val") ? parseInt(s.getAttribute("val")) ?? null : null;
98
- }
99
- getValAttrAsFloat(t, e) {
100
- let s = this.evaluate(t, e);
101
- return s && s.hasAttribute("val") ? parseFloat(s.getAttribute("val")) ?? null : null;
102
- }
103
- get BOOLEAN_COPY() {
104
- return it;
105
- }
106
- get INT_COPY() {
107
- return nt;
108
- }
109
- get FLOAT_COPY() {
110
- return lt;
111
- }
112
- copyFromAttribute(t, e, s, r = e, o = null) {
113
- if (!t || !s || !t.hasAttribute(e)) return;
114
- let i = t.getAttribute(e);
115
- if (o) {
116
- if (Array.isArray(o)) {
117
- for (let n = 0; n < o.length; n++) if (i == null || (i = o[n](i), i == null)) return;
118
- } else if (i == null || (i = o(i), i == null)) return;
119
- }
120
- this.setToPath(s, r, i);
121
- }
122
- }
123
- class j {
124
- constructor(t) {
125
- this.jsonKey = t;
126
- }
127
- visit(t, e, s) {
128
- const r = {};
129
- return s[this.jsonKey] = r, r;
130
- }
131
- }
132
- class ct {
133
- visit(t, e, s) {
134
- if (!e) return;
135
- const r = e.childNodes;
136
- for (let o = 0; o < r.length; o++) {
137
- const i = r.item(o);
138
- i.nodeType === 1 && i.localName === "Relationship" && this.processRelationship(t, i, s);
139
- }
140
- return s;
141
- }
142
- processRelationship(t, e, s) {
143
- const r = {};
144
- t.copyFromAttribute(e, "Target", r, "target"), t.copyFromAttribute(e, "Type", r, "type"), t.copyFromAttribute(e, "TargetMode", r, "targetMode"), s[e.getAttribute("Id")] = r;
145
- }
146
- }
147
- const H = (u, t) => {
148
- if (u || !u.hasAttribute("rot")) return;
149
- const e = u.getAttribute("rot"), s = Y.roundAccurately(D(e), 2);
150
- s !== -1e3 && (t.rotation = s);
151
- }, b = (u, t, e, s, r) => {
152
- const o = u.getValAttrAsString(s, t);
153
- o !== null && (e[r] = o);
154
- }, m = (u, t, e, s, r = s, o = null) => {
155
- const i = u.getValAttrAsBoolean(s, t, o);
156
- i !== null && (e[r] = i);
157
- }, w = (u, t, e, s, r) => {
158
- const o = u.getValAttrAsInteger(s, t);
159
- o !== null && (e[r] = o);
160
- }, y = (u, t, e, s, r, o = 1) => {
161
- const i = u.getValAttrAsFloat(s, t);
162
- i !== null && (e[r] = i * o);
163
- };
164
- class ut {
165
- visit(t, e, s) {
166
- return m(t, e, s, "roundedCorners", "roundedCorners"), w(t, e, s, ".//AlternateContent/Fallback/style", "styleId"), s.range = null, s;
167
- }
168
- afterVisit(t, e, s) {
169
- let r = {};
170
- s.types = r;
171
- let o = {}, i = 0, n = {}, l = 0, a = t.getVisitorParamsState().get("axes");
172
- const c = t.getVisitorParamsState().get("types");
173
- for (let g = 0; g < c.length; g++) {
174
- const d = c[g];
175
- if (d.xAxisId) {
176
- const v = d.xAxisId, O = a.get(v);
177
- o[g + ""] = O, d.offsetXAxis = g, delete d.xAxisId, s.xAxes = o, o.length = ++i;
178
- }
179
- if (d.yAxisId) {
180
- const v = d.yAxisId, O = a.get(v);
181
- n[g + ""] = O, d.offsetYAxis = g, delete d.yAxisId, s.yAxes = n, n.length = ++l;
182
- }
183
- r[g + ""] = d;
184
- }
185
- r.length = c.length;
186
- const h = t.getVisitorParamsState().get("series");
187
- if (!h || h.length === 0) return;
188
- const p = {};
189
- s.series = p;
190
- for (let g = 0; g < h.length; g++) p[g + ""] = h[g];
191
- p.length = h.length;
192
- }
193
- }
194
- class ht {
195
- visit(t, e, s) {
196
- return m(t, e, s, "plotVisOnly", "plotVisOnly"), b(t, e, s, "dispBlanksAs", "dispBlanksAs"), m(t, e, s, ".//extLst/ext/dataDisplayOptions16/dispNaAsBlank", "dispNaAsBlank"), m(t, e, s, "showDLblsOverMax", "showDLblsOverMax"), s;
197
- }
198
- afterVisit(t, e, s) {
199
- try {
200
- const r = t.getValAttrAsBoolean("autoTitleDeleted", e), o = t.evaluate("title", e);
201
- t.setToPath(s, "title.shown", !(r === !0 || !o));
202
- const i = t.evaluate("legend", e);
203
- t.setToPath(s, "legend.shown", i !== null);
204
- } catch (r) {
205
- throw new Error("Unexpected Error parsing Chart: " + r);
206
- }
207
- }
208
- }
209
- class pt {
210
- visit(t, e, s) {
211
- let r = {};
212
- return s.plotArea = r, r;
213
- }
214
- }
215
- class L {
216
- EnumMappings() {
217
- }
218
- static fromOoxmlGradientType(t) {
219
- return t === "circle" ? "radial" : t;
220
- }
221
- static fromOoxmlLineCap(t) {
222
- if (t === "rnd") return "round";
223
- if (t === "flat") return "butt";
224
- if (t === "sq") return "square";
225
- throw new Error("Invalid lineCap type: " + t);
226
- }
227
- static fromOoxmlCompound(t) {
228
- return t === "sng" ? "single" : t;
229
- }
230
- static fromOoxmlAlignment(t) {
231
- return t === "ctr" ? "center" : t;
232
- }
233
- }
234
- class J {
235
- visit(t, e, s) {
236
- }
237
- processStroke(t, e, s) {
238
- const r = {}, o = t.evaluate("ln", e);
239
- if (o) {
240
- o.hasAttribute("algn") && (r.align = L.fromOoxmlAlignment(o.getAttribute("algn"))), o.hasAttribute("cap") && (r.lineCap = L.fromOoxmlLineCap(o.getAttribute("cap"))), o.hasAttribute("cmpd") && (r.compound = L.fromOoxmlCompound(o.getAttribute("cmpd"))), o.hasAttribute("w") && (r.width = Z(o.getAttribute("w")));
241
- const i = t.evaluate("miter", o);
242
- i && (r.lineJoin = "miter", i.hasAttribute("lim") && (r.miter = parseFloat(i.getAttribute("lim")))), t.evaluate("bevel", o) && (r.lineJoin = "bevel"), t.evaluate("round", o) && (r.lineJoin = "round");
243
- const n = t.evaluate("custDash", o);
244
- if (n) {
245
- const c = t.evaluate("ds", n);
246
- if (c && c.length > 0) {
247
- let h = "";
248
- for (let p = 0; p < c.length; p++) {
249
- const g = c.item(p);
250
- h += A(g.getAttribute("d")) + "," + A(g.getAttribute("sp"));
251
- }
252
- r.dash = h;
253
- }
254
- }
255
- const l = t.evaluate("prstDash", o);
256
- l && l.hasAttribute("val") && (r.dash = l.getAttribute("val")), this.parseEndElement(t, o, r, "headEnd", "head"), this.parseEndElement(t, o, r, "tailEnd", "tail");
257
- const a = this.processFill(t, o, s);
258
- r.fill = a;
259
- }
260
- return r;
261
- }
262
- parseEndElement(t, e, s, r, o) {
263
- const i = t.evaluate(r, e);
264
- if (i && (i.hasAttribute("type") && (s[o + "Type"] = i.getAttribute("type")), i.hasAttribute("len") || i.hasAttribute("w"))) {
265
- const n = i.getAttribute("len") ? i.getAttribute("len") : "med", l = i.getAttribute("w") ? i.getAttribute("w") : "med";
266
- s[o + "Size"] = n + "-" + l;
267
- }
268
- }
269
- processFill(t, e, s) {
270
- const r = {};
271
- if (t.evaluate("noFill", e)) return r.none = !0, r;
272
- const o = t.evaluate("solidFill", e);
273
- if (o) {
274
- const a = this.processAdjColor(t, o);
275
- return a && (r.solid = a), r;
276
- }
277
- const i = t.evaluate("gradFill", e);
278
- if (i) {
279
- i.hasAttribute("rotWithShape") && (r.isRotated = i.getAttribute("rotWithShape") === "1");
280
- const a = this.processGradFill(t, i);
281
- return r.gradient = a, r;
282
- }
283
- const n = t.evaluate("pattFill", e);
284
- if (n) {
285
- const a = this.processPatternFill(t, n);
286
- return r.pattern = a, r;
287
- }
288
- const l = t.evaluate("blipFill", e);
289
- if (l) {
290
- l.hasAttribute("rotWithShape") && (r.isRotated = f(l.getAttribute("rotWithShape"))), l.hasAttribute("dpi") && (r.dpi = l.getAttribute("dpi"));
291
- const a = this.processImageFill(t, l);
292
- return r.image = a, r;
293
- }
294
- return r.none = !0, r;
295
- }
296
- processGradFill(t, e) {
297
- const s = {}, r = t.evaluate("lin", e);
298
- if (r) {
299
- if (s.type = "linear", r.hasAttribute("ang")) {
300
- const c = D(r.getAttribute("ang"));
301
- s.angle = c;
302
- }
303
- if (r.hasAttribute("scaled")) {
304
- const c = f(r.getAttribute("scaled"));
305
- s.scaled = c;
306
- }
307
- }
308
- const o = {};
309
- e.hasAttribute("flip") && (o.mirror = e.getAttribute("flip")), Object.keys(o).length > 0 && (s.tile = o);
310
- const i = t.evaluate("path", e);
311
- if (i) {
312
- i.hasAttribute("path") && (s.type = L.fromOoxmlGradientType(i.getAttribute("path")));
313
- const c = t.evaluate("fillToRect", i);
314
- c && (s.fillTo = this.getRect(c));
315
- }
316
- const n = t.evaluate("tileRect", e);
317
- n && (s.tile.bounds = this.getRect(n));
318
- const l = [], a = t.evaluate("gsLst/gs", e);
319
- for (let c = 0; a && c < a.length; c++) {
320
- const h = a.item(c), p = { offset: A(h.getAttribute("pos")), color: this.processAdjColor(t, h) };
321
- l.push(p);
322
- }
323
- return l.length > 0 && (s.stops = l), s;
324
- }
325
- getRect(t) {
326
- const e = {};
327
- return t.hasAttribute("t") && (e.t = A(t.getAttribute("t"))), t.hasAttribute("l") && (e.l = A(t.getAttribute("l"))), t.hasAttribute("b") && (e.b = A(t.getAttribute("b"))), t.hasAttribute("r") && (e.r = A(t.getAttribute("r"))), Object.keys(e).length === 0 ? null : e;
328
- }
329
- processImageFill(t, e) {
330
- return { ref: "https://www.sheetxl.com/logo-color-padded-white.jpg", tile: !1 };
331
- }
332
- processPatternFill(t, e) {
333
- const s = {}, r = e.getAttribute("prst");
334
- s.type = r;
335
- const o = t.evaluate("bgClr", e);
336
- if (o) {
337
- const n = this.processAdjColor(t, o);
338
- n && (s.background = n);
339
- }
340
- const i = t.evaluate("fgClr", e);
341
- if (i) {
342
- let n = this.processAdjColor(t, i);
343
- n && (s.foreground = n);
344
- }
345
- return s;
346
- }
347
- processAdjColor(t, e) {
348
- const s = t.evaluate("hslClr", e);
349
- if (s) return this.processHslClr(t, s);
350
- const r = t.evaluate("prstClr", e);
351
- if (r) return this.processClrWithValAttribute(t, r);
352
- const o = t.evaluate("schemeClr", e);
353
- if (o) return this.processClrWithValAttribute(t, o);
354
- const i = t.evaluate("sysClr", e);
355
- if (i) return this.processClrWithValAttribute(t, i);
356
- const n = t.evaluate("scrgbClr", e);
357
- if (n) return this.processScrgbClrElement(t, n);
358
- const l = t.evaluate("srgbClr", e);
359
- return l ? this.processSrgbClrElement(t, l) : null;
360
- }
361
- processScrgbClrElement(t, e) {
362
- let s = "lrgba(" + A(e.getAttribute("r")) + "," + A(e.getAttribute("g")) + "," + A(e.getAttribute("b")) + ")";
363
- return s += this.processAdjustments(t, e), s;
364
- }
365
- processSrgbClrElement(t, e) {
366
- let s = e.getAttribute("val");
367
- return s += this.processAdjustments(t, e), s;
368
- }
369
- processHslClr(t, e) {
370
- let s = "hsl(" + D(e.getAttribute("hue")) + "," + A(e.getAttribute("sat")) + "," + A(e.getAttribute("lum")) + ")";
371
- return s += this.processAdjustments(t, e), s;
372
- }
373
- processClrWithValAttribute(t, e) {
374
- const s = e.getAttribute("val");
375
- if (!s) return;
376
- let r = s;
377
- return r += this.processAdjustments(t, e), r;
378
- }
379
- processAdjustments(t, e) {
380
- let s = "";
381
- const r = e.childNodes;
382
- for (let o = 0; o < r.length; o++) {
383
- const i = r.item(o);
384
- if (i.nodeType === 1) {
385
- let n = i.localName;
386
- s += n === "hue" || n === "hueOff" || n === "hueMod" ? this.processAdjustmentElement(t, e, n, 6e4) : n === "gray" || n === "comp" || n === "inv" || n === "gamma" || n === "invGamma" ? this.processAdjustmentElement(t, e, n, 1) : this.processAdjustmentElement(t, e, n);
387
- }
388
- }
389
- return s;
390
- }
391
- processAdjustmentElement(t, e, s, r = 1e3) {
392
- const o = t.evaluate(s, e);
393
- if (!o) return "";
394
- const i = o.getAttribute("val");
395
- return i ? ` ${s} ${!i || parseFloat(i) / r}` : ` ${s}`;
396
- }
397
- }
398
- class M extends J {
399
- visit(t, e, s) {
400
- try {
401
- const r = t.evaluate("xfrm", e);
402
- if (r) {
403
- H(r, s);
404
- const l = { x: 0, y: 0, width: 0, height: 0 }, a = t.evaluate("off", r);
405
- a && (l.x = x(a.getAttribute("x")) ?? 0, l.y = x(a.getAttribute("y")) ?? 0);
406
- const c = t.evaluate("ext", r);
407
- a && (l.width = x(c.getAttribute("cx")) ?? 0, l.height = x(c.getAttribute("cy")) ?? 0), s.bounds = l;
408
- }
409
- const o = t.evaluate("prstGeom", e);
410
- o?.hasAttribute("prst") ? s.geometry = o?.getAttribute("prst") : t.evaluate("customGeom", e) && console.warn("customGeom not supported yet");
411
- const i = this.processFill(t, e, s);
412
- i && Object.keys(i).length > 0 && (s.fill = i);
413
- const n = this.processStroke(t, e, s);
414
- return n && Object.keys(n).length > 0 && (s.stroke = n), s;
415
- } catch (r) {
416
- throw console.warn(r), new Error("Unexpected Error parsing Shape Properties element");
417
- }
418
- }
419
- }
420
- class S {
421
- visit(t, e, s) {
422
- let r = {};
423
- if (b(t, e, r, "grouping", "grouping"), m(t, e, r, "varyColors", "varyColors"), y(t, e, r, "gapWidth", "gapWidth", 0.01), y(t, e, r, "overlap", "overlap", 0.01), this.parseType(t, e, r), w(t, e, r, "bubbleScale", "bubbleScale"), m(t, e, r, "showNegBubbles", "showNegativeBubbleValues"), m(t, e, r, "sizeRepresents", "bubbleSizeRepresentsWidth"), w(t, e, r, "firstSliceAng", "startAngle"), w(t, e, r, "holeSize", "holeSize"), b(t, e, r, "scatterStyle", "scatterStyle"), this.parseAxisIds(t, e, r), Object.keys(r).length > 0) {
424
- let o = t.getVisitorParamsState().get("types");
425
- o || (o = [], t.getVisitorParamsState().set("types", o)), o.push(r);
426
- }
427
- return r;
428
- }
429
- parseType(t, e, s) {
430
- switch (e.localName) {
431
- case "areaChart":
432
- s.type = "area";
433
- break;
434
- case "bubbleChart":
435
- s.type = "bubble";
436
- break;
437
- case "doughnutChart":
438
- case "ofPieType":
439
- case "pieChart":
440
- s.type = "pie";
441
- break;
442
- case "lineChart":
443
- s.type = "line";
444
- break;
445
- case "scatterChart":
446
- s.type = "scatter";
447
- }
448
- }
449
- parseAxisIds(t, e, s) {
450
- const r = t.evaluate("axId", e);
451
- if (r.length === 0) return;
452
- const o = r.item(0).getAttribute("val");
453
- s.xAxisId = o;
454
- const i = r.item(1).getAttribute("val");
455
- s.yAxisId = i;
456
- }
457
- }
458
- class gt extends S {
459
- parseType(t, e, s) {
460
- const r = t.getValAttrAsString("barDir", e);
461
- r && (s.type = r === "col" ? "column" : "bar");
462
- }
463
- }
464
- class N {
465
- constructor(t) {
466
- this.jsonKey = t;
467
- }
468
- visit(t, e, s) {
469
- let r = {}, o = r, i = t.getValAttrAsString("idx", e);
470
- i !== null && (o = {}, o[i] = r);
471
- const n = t.getValAttrAsBoolean("delete", e);
472
- this.parseNumFormat(t, e, r), n === !0 ? (r.showBubbleSize = !1, r.showCatName = !1, r.showLeaderLines = !1, r.showPercentage = !1, r.showSerName = !1, r.showVal = !1, r.showLegendKey = !1) : (m(t, e, r, "showBubbleSize", "showBubbleSize"), m(t, e, r, "showCatName", "showCatName"), m(t, e, r, "showLeaderLines", "showLeaderLines"), m(t, e, r, "showPercent", "showPercentage"), m(t, e, r, "showSerName", "showSerName"), m(t, e, r, "showVal", "showVal"), m(t, e, r, "showLegendKey", "showLegendKey"));
473
- const l = t.evaluate("separator", e);
474
- return l !== null && (r.separator = l.textContent), b(t, e, r, "dLblPos", "position"), s[this.jsonKey] = o, r;
475
- }
476
- parseNumFormat(t, e, s) {
477
- const r = t.evaluate("numFmt", e);
478
- if (r) {
479
- const o = r.getAttribute("formatCode");
480
- s.formatCode = o, r.hasAttribute("sourceLinked") && (s.sourceLinked = r.getAttribute("sourceLinked") === "1");
481
- }
482
- }
483
- }
484
- const q = (u, t, e) => {
485
- if (u.getValAttrAsBoolean("invertIfNegative", t) === !0) if (u.evaluate("extLst/ext/invertSolidFillFmt", t)) {
486
- if (e.fill && e.fillNegative) {
487
- const s = u.getFromPath(e, "fill.solid.adjs");
488
- s && u.setToPath(e, "fillNegative.solid.adjs", s);
489
- }
490
- } else {
491
- const s = { val: "FFFFFF" }, r = {};
492
- r.solid = s, e.fillNegative = r;
493
- const o = { val: "000000" }, i = {};
494
- i.solid = o;
495
- const n = {};
496
- n.fill = i, e.strokeNegative = n;
497
- }
498
- };
499
- class dt {
500
- visit(t, e, s) {
501
- const r = {};
502
- w(t, e, r, "explosion", "explosion");
503
- let o = t.evaluate("cat/*/f", e);
504
- o || (o = t.evaluate("xVal/*/f", e));
505
- let i = null;
506
- o !== null && o.firstChild !== null && (i = o.firstChild.nodeValue), o || (o = t.evaluate("cat/strLit", e), o || (o = t.evaluate("cat/numLit", e)), o && (i = this.parsePointsAsString(t, o))), i !== null && (r.xRange = i);
507
- let n = t.evaluate("val/*/f", e);
508
- n || (n = t.evaluate("yVal/*/f", e));
509
- let l = null;
510
- n && n.firstChild && (l = n.firstChild.nodeValue), n || (n = t.evaluate("val/numLit", e), n !== null && (l = this.parsePointsAsString(t, n))), l !== null && (r.valRange = l), this.parseTitleRangeOrValue(t, e, r), w(t, e, r, "idx", "idx"), m(t, e, r, "smooth", "smooth");
511
- const a = t.getVisitorParamsState().get("types").length - 1;
512
- r.offsetChart = a;
513
- let c = t.getVisitorParamsState().get("series");
514
- return c || (c = [], t.getVisitorParamsState().set("series", c)), c.push(r), r;
515
- }
516
- parseTitleRangeOrValue(t, e, s) {
517
- const r = t.evaluate("tx/strRef/f", e);
518
- if (r !== null) {
519
- const o = r.firstChild.nodeValue;
520
- t.setToPath(s, "title.range", o);
521
- } else {
522
- const o = t.evaluate("tx/v", e);
523
- o !== null && t.setToPath(s, "title.text.simpleRun", o.firstChild.nodeValue);
524
- }
525
- }
526
- parsePointsAsString(t, e) {
527
- let s = "{";
528
- const r = t.getValAttrAsInteger("ptCount", e), o = t.evaluate("pt", e), i = [];
529
- for (let n = 0; o && r && n < r; n++) {
530
- let l = null, a = t.evaluate("pt[@idx='" + n + "']/v", e);
531
- a instanceof Node && (l = a.textContent), i[n] = l;
532
- }
533
- for (let n = 0; n < i.length; n++) n > 0 && (s += ","), i[n] !== void 0 && (s += i[n]);
534
- return s += "}", s;
535
- }
536
- afterVisit(t, e, s) {
537
- q(t, e, s);
538
- let r = t.getFromPath(s, "points");
539
- if (r) {
540
- const o = Object.keys(r);
541
- for (let i = 0; i < o.length; i++) {
542
- const n = o[i], l = t.getFromPath(r, n);
543
- if (!l) continue;
544
- let a = t.getFromPath(l, "markers");
545
- a && (t.setToPath(s, "markers.points." + n, a), delete l.markers);
546
- }
547
- }
548
- }
549
- }
550
- class mt {
551
- DataPointVisitor() {
552
- }
553
- visit(t, e, s) {
554
- let r = t.getFromPath(s, "points"), o = null;
555
- r ? o = r : (o = {}, t.setToPath(s, "points", o));
556
- let i = {}, n = t.getValAttrAsString("idx", e);
557
- return n !== null && (o[n] = i), m(t, e, i, "bubble3D", "bubble3D"), w(t, e, i, "explosion", "explosion"), q(t, e, i), i;
558
- }
559
- }
560
- class bt {
561
- visit(t, e, s) {
562
- const r = e.parentNode.localName;
563
- if (r === "ser" || r === "dPt") {
564
- const o = {}, i = t.getValAttrAsString("size", e);
565
- i !== null && (o.size = i);
566
- const n = t.getValAttrAsString("symbol", e);
567
- return n && (o.type = n), s.markers = o, o;
568
- }
569
- return null;
570
- }
571
- }
572
- class R {
573
- visit(t, e, s) {
574
- let r = {};
575
- this.parseScaling(t, e, r), y(t, e, r, "majorUnit", "majorUnits"), y(t, e, r, "minorUnit", "minorUnits"), m(t, e, r, "delete", "shown"), this.parseOrientation(t, e, r), this.parseNumFormat(t, e, r), b(t, e, r, "majorTickMark", "majorTickMarks"), b(t, e, r, "minorTickMark", "minorTickMarks"), b(t, e, r, "crosses", "crosses"), y(t, e, r, "crossesAt", "crosses"), b(t, e, r, "crossBetween", "crossBetween"), this.parseLabelAlign(t, e, r), w(t, e, r, "lblOffset", "labelOffset"), b(t, e, r, "tickLblPos", "labelPosition");
576
- const o = t.getValAttrAsInteger("noMultiLvlLbl", e);
577
- r.labelMultiLevel = o !== null && o === 0, w(t, e, r, "tickMarkSkip", "tickMarkSkip"), w(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"), b(t, e, r, "baseTimeUnit", "baseUnitDates"), t.getVisitorParamsState().get("axes") || t.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map());
578
- const i = t.getValAttrAsString("axId", e);
579
- return t.getVisitorParamsState().get("axes").set(i, r), r;
580
- }
581
- parseTimeUnits(t, e, s, r, o, i) {
582
- const n = {};
583
- let l = t.getValAttrAsString(o, e);
584
- if (l !== null) {
585
- n.dem = l;
586
- let a = t.getValAttrAsString(i, e);
587
- n.amt = a;
588
- }
589
- Object.keys(n).length > 0 && (s[r] = n);
590
- }
591
- parseDisplayCustOrBuiltInUnit(t, e, s) {
592
- let r = e.getValAttrAsString("dispUnits/builtInUnit", t);
593
- r || (r = e.getValAttrAsString("dispUnits/custUnit", t)), r && (s.displayUnits = r);
594
- }
595
- parseLabelAlign(t, e, s) {
596
- let r = t.getValAttrAsString("lblAlgn", e);
597
- r !== null && (r === "ctr" ? s.labelAlign = "center" : r === "l" ? s.labelAlign = "left" : r === "r" && (s.labelAlign = "right"));
598
- }
599
- parseOrientation(t, e, s) {
600
- const r = t.getValAttrAsString("AxPos", e);
601
- r !== null && (r === "b" ? s.orientation = "bottom" : r === "l" ? s.orientation = "left" : r === "r" ? s.orientation = "right" : r === "t" && (s.orientation = "top"));
602
- }
603
- parseNumFormat(t, e, s) {
604
- const r = {}, o = t.evaluate("numFmt", e);
605
- o !== null && (o.hasAttribute("formatCode") && (r.formatCode = o.getAttribute("formatCode")), o.hasAttribute("sourceLinked") && (r.sourceLinked = o.getAttribute("sourceLinked") === "1")), Object.keys(r).length > 0 && (s.labels = r);
606
- }
607
- parseScaling(t, e, s) {
608
- const r = t.getValAttrAsString("scaling/orientation", e);
609
- r !== null && (s.inverted = r !== "minMax");
610
- const o = t.getValAttrAsFloat("scaling/logBase", e);
611
- o !== null && (s.logBase = o, s.scaleType = "log"), y(t, e, s, "scaling/max", "max"), y(t, e, s, "scaling/min", "min");
612
- }
613
- afterVisit(t, e, s) {
614
- s.fill && s.labels && (s.labels.fill = s.fill, delete s.fill);
615
- let r = t.getValAttrAsBoolean("delete", e);
616
- r !== null && (t.setToPath(s, "labels.shown", r !== !0), t.setToPath(s, "shown", r !== !0));
617
- const o = t.getFromPath(s, "dispUnits.displayUnitsLabel");
618
- o && (t.setToPath(s, "displayUnitsLabel", o), delete s.dispUnits);
619
- const i = t.evaluate("title", e);
620
- t.setToPath(s, "title.shown", i !== null);
621
- const n = t.evaluate("minorGridlines", e);
622
- t.setToPath(s, "gridLinesMinor.shown", n !== null);
623
- const l = t.evaluate("majorGridlines", e);
624
- t.setToPath(s, "gridLinesMajor.shown", l !== null);
625
- }
626
- }
627
- class F {
628
- constructor(t = "text") {
629
- this._jsonKey = t;
630
- }
631
- getTextPath() {
632
- return this._jsonKey;
633
- }
634
- visit(t, e, s) {
635
- let r = t.getFromPath(s, this.getTextPath());
636
- return r || (r = {}), this.parseTextElement(t, e, r, !1), Object.keys(r).length > 0 && t.setToPath(s, this.getTextPath(), r), s;
637
- }
638
- parseTextElement(t, e, s, r) {
639
- const o = t.evaluate("p/pPr/defRPr", e) ?? t.evaluate("defRPr", e);
640
- o && (this.parseTextProperties(t, o, s), new M().visit(t, o, s));
641
- let i = [], n = t.evaluate("p/r", e) ?? t.evaluate("r", e);
642
- const l = (c) => {
643
- const h = {};
644
- let p = t.evaluate("t", c);
645
- const g = t.evaluate("rPr", c);
646
- g && this.parseTextProperties(t, g, h), p ? h.text = p.firstChild.textContent ?? "" : c.textContent && (h.text = c.textContent ?? ""), i.push(h);
647
- };
648
- if (n?.length !== void 0) for (let c = 0; n && c < n.length; c++) l(n.item(c));
649
- else l(n || e);
650
- i.length > 0 && (s.runs = i);
651
- const a = t.evaluate("bodyPr", e);
652
- a && H(a, s);
653
- }
654
- parseTextProperties(t, e, s) {
655
- if (!e) return;
656
- e.hasAttribute("sz") && (s.size = parseFloat(e.getAttribute("sz")) / 100), e.hasAttribute("b") && (s.weight = e.getAttribute("b") === "1" ? 700 : 400), e.hasAttribute("i") && (s.italic = e.getAttribute("i") === "1"), e.hasAttribute("u") && (s.underline = e.getAttribute("u")), e.hasAttribute("strike") && (s.strike = e.getAttribute("strike"));
657
- const r = t.evaluate("latin", e);
658
- if (r && !r.getAttribute("typeface").startsWith("+")) {
659
- const o = s.font ?? {};
660
- if (r.hasAttribute("typeface") && (o.family = r.getAttribute("typeface")), r.hasAttribute("panose")) {
661
- const i = r.getAttribute("panose");
662
- i && (o.fallbacks = [k.getPanoseFallback(i)]);
663
- }
664
- r.hasAttribute("pitchFamily") && (o.pitch = r.getAttribute("pitchFamily")), r.hasAttribute("charset") && (o.charset = r.getAttribute("charset")), Object.keys(o).length > 0 && (s.font = o);
665
- }
666
- }
667
- }
668
- class ft {
669
- visit(t, e, s) {
670
- let r = t.getVisitorParamsState().get("series")[t.getValAttrAsInteger("idx", e)];
671
- if (r) {
672
- let o = t.getFromPath(r, "title");
673
- o || (o = {}, t.setToPath(r, "title", o));
674
- let i = o, n = t.getValAttrAsBoolean("delete", e);
675
- return n !== null && (i.shown = !n), i;
676
- }
677
- return s;
678
- }
679
- }
680
- class At {
681
- visit(t, e, s) {
682
- const r = {};
683
- return m(t, e, r, "overlay", "overlay"), b(t, e, r, "legendPos", "position"), s.legend = r, r;
684
- }
685
- }
686
- class yt extends M {
687
- visit(t, e, s) {
688
- const r = this.processFill(t, e, s);
689
- Object.keys(r).length > 0 && (s.fillNegative = r);
690
- const o = this.processStroke(t, e, s);
691
- return Object.keys(o).length > 0 && (s.strokeNegative = o), s;
692
- }
693
- }
694
- class X extends F {
695
- constructor(t = "title") {
696
- super(t);
697
- }
698
- parseTitleRangeOrValue(t, e, s) {
699
- let r = t.evaluate("tx/strRef/f", e) ?? null;
700
- if (r) {
701
- const o = r.firstElementChild.nodeValue;
702
- t.setToPath(s, "range", o);
703
- }
704
- }
705
- visit(t, e, s) {
706
- const r = {};
707
- m(t, e, r, "overlay", "overlay"), s[this._jsonKey] = r;
708
- let o = t.getFromPath(r, this.getTextPath());
709
- o || (o = {}), this.parseTitleRangeOrValue(t, e, r);
710
- const i = t.evaluate("txPr", e);
711
- i && this.parseTextElement(t, i, o, !1);
712
- const n = t.evaluate("tx/rich", e);
713
- return n && this.parseTextElement(t, n, o, !0), Object.keys(o).length > 0 && t.setToPath(r, this.getTextPath(), o), r;
714
- }
715
- afterVisit(t, e, s) {
716
- if (s?.text) {
717
- const r = s.text?.rotation ?? null;
718
- r !== null && (s.rotation = parseInt(r), delete s.title.rotation);
719
- }
720
- }
721
- }
722
- class vt {
723
- visit(t, e, s) {
724
- const r = t.evaluate("manualLayout", e);
725
- if (r) {
726
- let o = {};
727
- y(t, r, o, "x", "x"), y(t, r, o, "y", "y"), y(t, r, o, "w", "w"), y(t, r, o, "h", "h"), b(t, r, o, "xMode", "xMode"), b(t, r, o, "yMode", "yMode"), b(t, r, o, "wMode", "wMode"), b(t, r, o, "hMode", "hMode"), Object.keys(o).length > 0 && (s.manualLayout = o);
728
- }
729
- return s;
730
- }
731
- }
732
- class Ft {
733
- visit(t, e, s) {
734
- return s.name = e.getAttribute("name"), s;
735
- }
736
- }
737
- class Ct extends J {
738
- visit(t, e, s) {
739
- const r = {};
740
- r.name = e.getAttribute("name");
741
- const o = e.childNodes;
742
- for (let i = 0; i < o.length; i++) {
743
- const n = o.item(i);
744
- if (n.nodeType === 1) {
745
- let l = n.localName;
746
- const a = t.evaluate(l, e), c = this.processAdjColor(t, a);
747
- r[l] = c;
748
- }
749
- }
750
- return Object.keys(r).length > 0 && (s.colors = r), r;
751
- }
752
- }
753
- class wt {
754
- visit(t, e, s) {
755
- const r = {};
756
- r.name = e.getAttribute("name");
757
- const o = t.evaluate("majorFont", e), i = this.processFontElement(t, o, {});
758
- r.majorFont = i.family, i.fallbacks && (r.majorFallbacks = i.fallbacks);
759
- const n = t.evaluate("minorFont", e), l = this.processFontElement(t, n, {});
760
- return r.minorFont = l.family, i.fallbacks && (r.minorFallbacks = l.fallbacks), s.fonts = r, r;
761
- }
762
- processFontElement(t, e, s) {
763
- if (!e) return;
764
- const r = t.evaluate("latin", e);
765
- if (!r) return;
766
- const o = r.getAttribute("typeface");
767
- o && (s.family = o);
768
- const i = r.getAttribute("panose");
769
- return i && (s.fallbacks = [k.getPanoseFallback(i)]), s;
770
- }
771
- }
772
- class Pt {
773
- visit(t, e, s) {
774
- if (!e) return;
775
- const r = {}, o = e.getAttribute("r:id");
776
- if (o) {
777
- const i = t.getRef(o);
778
- typeof i == "string" && (r.address = i);
779
- }
780
- return t.copyFromAttribute(e, "tooltip", r), t.copyFromAttribute(e, "history", r, "history", t.BOOLEAN_COPY), t.copyFromAttribute(e, "tgtFrame", r, "target"), s.hyperlink = r, r;
781
- }
782
- }
783
- class Nt {
784
- visit(t, e, s) {
785
- if (!e) return;
786
- const r = {};
787
- return t.copyFromAttribute(e, "ref", r), this.processFilterColumns(t, e, r), Object.keys(r).length > 0 && (s.filter = r), r;
788
- }
789
- processColorFilter(t, e) {
790
- const s = { type: T.Type.Color };
791
- return t.copyFromAttribute(e, "cellColor", s, "cellColor", t.BOOLEAN_COPY), t.copyFromAttribute(e, "dxfId", s, "styleId", t.INT_COPY), s;
792
- }
793
- processCustomFilter(t, e) {
794
- const s = {};
795
- return t.copyFromAttribute(e, "operator", s, "operator", t.BOOLEAN_COPY), t.copyFromAttribute(e, "val", s, "val"), s;
796
- }
797
- processCustomFilters(t, e) {
798
- const s = { type: T.Type.Custom };
799
- t.copyFromAttribute(e, "and", s, "and", t.BOOLEAN_COPY);
800
- const r = e.childNodes;
801
- s.filters = [];
802
- for (let o = 0; o < r.length; o++) {
803
- const i = r.item(o);
804
- if (i.nodeType !== 1) continue;
805
- let n = null;
806
- i.localName === "customFilter" && (n = this.processCustomFilter(t, i)), n && s.filters.push(n);
807
- }
808
- return s;
809
- }
810
- processDynamicFilter(t, e) {
811
- const s = { type: T.Type.Dynamic };
812
- return t.copyFromAttribute(e, "type", s, "dynamicType"), t.copyFromAttribute(e, "val", s, "val", t.INT_COPY), t.copyFromAttribute(e, "maxVal", s, "maxVal", t.INT_COPY), s;
813
- }
814
- processDateGroupItem(t, e) {
815
- const s = {};
816
- 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;
817
- }
818
- processFilterItem(t, e) {
819
- if (e.hasAttribute("val")) return e.getAttribute("val");
820
- }
821
- processFilters(t, e) {
822
- const s = { type: T.Type.Items };
823
- t.copyFromAttribute(e, "blank", s, "blank", t.BOOLEAN_COPY), t.copyFromAttribute(e, "calendarType", s, "calendarType");
824
- let r = [], o = [];
825
- const i = e.childNodes;
826
- for (let n = 0; n < i.length; n++) {
827
- const l = i.item(n);
828
- if (l.nodeType === 1) {
829
- if (l.localName === "dateGroupItem") {
830
- const a = this.processDateGroupItem(t, l);
831
- a && r.push(a);
832
- } else if (l.localName === "filter") {
833
- const a = this.processFilterItem(t, l);
834
- a !== void 0 && o.push(a);
835
- }
836
- }
837
- }
838
- return r.length > 0 && (s.dateGroups = r), o.length > 0 && (s.items = o), s;
839
- }
840
- processIcon(t, e) {
841
- const s = { type: T.Type.Icon };
842
- return t.copyFromAttribute(e, "iconId", s, "iconId", t.INT_COPY), t.copyFromAttribute(e, "iconSet", s), s;
843
- }
844
- processTop10(t, e) {
845
- const s = { type: T.Type.Top10 };
846
- 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, "val", t.FLOAT_COPY), s;
847
- }
848
- processFilterCriteria(t, e, s) {
849
- if (!e) return;
850
- const r = e.childNodes, o = [];
851
- for (let i = 0; i < r.length; i++) {
852
- const n = r.item(i);
853
- if (n.nodeType !== 1) continue;
854
- let l = null;
855
- n.localName === "colorFilter" ? l = this.processColorFilter(t, n) : n.localName === "customFilters" ? l = this.processCustomFilters(t, n) : n.localName === "dynamicFilter" ? l = this.processDynamicFilter(t, n) : n.localName === "filters" ? l = this.processFilters(t, n) : n.localName === "iconFilter" ? l = this.processIcon(t, n) : n.localName === "top10" && (l = this.processTop10(t, n)), l && o.push(l);
856
- }
857
- return o.length > 0 && (s.criteria = o), o;
858
- }
859
- processFilterColumn(t, e) {
860
- if (!e) return null;
861
- const s = {};
862
- if (!e.hasAttribute("colId")) return;
863
- s.offset = parseInt(e.getAttribute("colId"));
864
- let r = !1;
865
- return e.hasAttribute("hiddenButton") && (r = f(e.getAttribute("hiddenButton"))), r && (s.hiddenButton = !0), e.hasAttribute("showButton") && (s.showButton = f(e.getAttribute("showButton"))), this.processFilterCriteria(t, e, s), s;
866
- }
867
- processFilterColumns(t, e, s) {
868
- if (!e) return;
869
- const r = e.childNodes, o = [];
870
- for (let i = 0; i < r.length; i++) {
871
- const n = r.item(i);
872
- if (n.nodeType === 1 && n.localName === "filterColumn") {
873
- const l = this.processFilterColumn(t, n);
874
- l && o.push(l);
875
- }
876
- }
877
- return o.length > 0 && (s.fields = o), o;
878
- }
879
- }
880
- class Ot {
881
- visit(t, e, s) {
882
- if (!e) return;
883
- const r = {};
884
- if (t.copyFromAttribute(e, "ref", r), e.hasAttribute("caseSensitive")) {
885
- const n = f(e.getAttribute("caseSensitive"));
886
- r.collatorOptions = n ? G.CaseSensitiveOptions : G.CaseInsensitiveOptions;
887
- }
888
- const o = e.getAttribute("sortMethod");
889
- o != null && o !== "none" && (o === "stroke" ? r.collatorOptions = { ...r.collatorOptions, collation: "stroke" } : o === "pinYin" && (r.collatorOptions = { ...r.collatorOptions, collation: "pinyin" })), e.hasAttribute("columnSort") && f(e.getAttribute("columnSort")) && (r.orientation = et.Orientation.Column);
890
- const i = W.fastStringToRange(r.ref);
891
- return this.processSortConditions(t, e, r, i), Object.keys(r).length > 0 && (s.sort = r), r;
892
- }
893
- processSortCondition(t, e, s) {
894
- if (!e) return null;
895
- const r = {};
896
- if (e.hasAttribute("ref")) {
897
- if (e.hasAttribute("ref")) {
898
- const o = e.getAttribute("ref"), i = W.fastStringToRange(o);
899
- r.offset = s ? i.colStart - s.colStart : i.colStart;
900
- }
901
- return r.reverse = !1, e.hasAttribute("descending") && (r.reverse = f(e.getAttribute("descending"))), t.copyFromAttribute(e, "sortBy", r, "sortOn"), t.copyFromAttribute(e, "dxfId", r), t.copyFromAttribute(e, "iconSet", r), t.copyFromAttribute(e, "customList", r), r;
902
- }
903
- console.warn("no ref for sort conditional", t.getPath());
904
- }
905
- processSortConditions(t, e, s, r) {
906
- if (!e) return;
907
- const o = e.childNodes, i = [];
908
- for (let n = 0; n < o.length; n++) {
909
- const l = o.item(n);
910
- if (l.nodeType === 1 && l.localName === "sortCondition") {
911
- const a = this.processSortCondition(t, l, r);
912
- a && i.push(a);
913
- }
914
- }
915
- return i.length > 0 && (s.fields = i), i;
916
- }
917
- }
918
- class Q {
919
- visit(t, e, s) {
920
- }
921
- processDataBarColor(t, e, s, r, o = "dk1") {
922
- if (!e) return;
923
- const i = tt((n) => e.getAttribute(n), o);
924
- return i && (s[r] = i), s;
925
- }
926
- processFonts(t, e, s) {
927
- if (!e) return;
928
- const r = e.childNodes;
929
- let o = 0;
930
- for (let i = 0; i < r.length; i++) {
931
- const n = r.item(i);
932
- if (n.nodeType === 1 && n.localName === "font") {
933
- const l = {};
934
- this.processFont(t, n, l), s[o++] = l;
935
- }
936
- }
937
- return s;
938
- }
939
- processFont(t, e, s) {
940
- t.getValAttrAsBoolean("b", e, !0) && (s.weight = 700), t.getValAttrAsBoolean("i", e, !0) && (s.style = k.Style.Italic), t.getValAttrAsBoolean("strike", e, !0) && (s.strike = !0);
941
- const r = t.evaluate("u", e);
942
- if (r) {
943
- const n = r.getAttribute("val");
944
- s.underline = n || k.UnderlineStyle.Single;
945
- }
946
- b(t, e, s, "vertAlign", "verticalAlign"), s.verticalAlign === "superscript" ? s.verticalAlign = k.VerticalAlignment.Super : s.verticalAlign === "subscript" && (s.verticalAlign = k.VerticalAlignment.Sub), y(t, e, s, "sz", "size");
947
- const o = t.evaluate("color", e);
948
- this.processDataBarColor(t, o, s, "fill"), s.fill || (s.fill = "dk1"), b(t, e, s, "name", "family"), b(t, e, s, "rFont", "family");
949
- const i = t.evaluate("family", e);
950
- if (i) {
951
- const n = i.getAttribute("val");
952
- if (n) switch (n) {
953
- case "1":
954
- s.fallbacks = ["serif"];
955
- break;
956
- case "2":
957
- s.fallbacks = ["sans-serif"];
958
- break;
959
- case "3":
960
- s.fallbacks = ["monospace"];
961
- break;
962
- case "4":
963
- s.fallbacks = ["cursive"];
964
- break;
965
- case "5":
966
- s.fallbacks = ["fantasy"];
967
- }
968
- }
969
- return b(t, e, s, "scheme", "scheme"), m(t, e, s, "shadow", "shadow", !0), m(t, e, s, "outline", "outline", !0), t.getValAttrAsBoolean("condense", e, !0) && (s.letterSpacing = -1), t.getValAttrAsBoolean("extend", e, !0) && (s.letterSpacing = 1), b(t, e, s, "charset", "charset"), s;
970
- }
971
- processFills(t, e, s) {
972
- if (!e) return;
973
- const r = e.childNodes;
974
- let o = 0;
975
- for (let i = 0; i < r.length; i++) {
976
- const n = r.item(i);
977
- n.nodeType === 1 && n.localName === "fill" && this.processFill(t, n, s, o++);
978
- }
979
- return s;
980
- }
981
- processFill(t, e, s, r) {
982
- const o = { type: C.Type.None }, i = e.childNodes;
983
- let n = !1;
984
- for (let l = 0; !n && l < i.length; l++) {
985
- const a = i.item(l);
986
- a.nodeType === 1 && (a.localName === "gradientFill" ? (this.processGradientFill(t, a, o), n = !0) : a.localName === "patternFill" && (this.processPatternFill(t, a, o), n = !0));
987
- }
988
- return s[r] = o, s;
989
- }
990
- processGradientFill(t, e, s) {
991
- if (!e) return;
992
- s.type = C.Type.Gradient;
993
- const r = [];
994
- s.stops = r, s.angle = 90 + (e.hasAttribute("degree") ? parseFloat(e.getAttribute("degree")) : 0);
995
- const o = e.getAttribute("type");
996
- o && (s.gradientType = o);
997
- const i = (l) => {
998
- if (!l) return 0;
999
- const a = parseFloat(l);
1000
- return isNaN(a) ? 0 : a;
1001
- };
1002
- (e.hasAttribute("left") || e.hasAttribute("top") || e.hasAttribute("right") || e.hasAttribute("bottom")) && (s.fillTo = { left: i(e.getAttribute("left")), top: i(e.getAttribute("top")), right: i(e.getAttribute("right")), bottom: i(e.getAttribute("bottom")) });
1003
- const n = e.childNodes;
1004
- for (let l = 0; l < n.length; l++) {
1005
- const a = n.item(l);
1006
- if (a.nodeType === 1 && a.localName === "stop") {
1007
- const c = {};
1008
- r.push(c);
1009
- const h = parseFloat(a.getAttribute("position"));
1010
- c.offset = h;
1011
- const p = t.evaluate("color", a);
1012
- this.processDataBarColor(t, p, c, "color");
1013
- }
1014
- }
1015
- return s;
1016
- }
1017
- processPatternFill(t, e, s) {
1018
- if (!e) return;
1019
- const r = t.getVisitorParamsState().get("processingDXFs"), o = e.getAttribute("patternType") || (r ? C.BuiltInSheetPattern.Solid : C.BuiltInSheetPattern.None);
1020
- if (o === C.BuiltInSheetPattern.None) return { none: !0 };
1021
- s.type = C.Type.Pattern, o && (s.patternType = o);
1022
- let i, n = "foreground", l = "background";
1023
- const a = s.patternType === C.BuiltInSheetPattern.Solid && r;
1024
- if (a) {
1025
- i = "lt1";
1026
- const p = n;
1027
- n = l, l = p;
1028
- }
1029
- const c = t.evaluate("fgColor", e);
1030
- this.processDataBarColor(t, c, s, n, i);
1031
- const h = t.evaluate("bgColor", e);
1032
- return this.processDataBarColor(t, h, s, l, i), a && !s.foreground && (s.foreground = i), s;
1033
- }
1034
- processBorders(t, e, s, r) {
1035
- if (!e) return;
1036
- const o = e.childNodes;
1037
- let i = 0;
1038
- for (let n = 0; n < o.length; n++) {
1039
- const l = o.item(n);
1040
- l.nodeType === 1 && l.localName === "border" && this.processBorder(t, l, s, i++, r);
1041
- }
1042
- return s;
1043
- }
1044
- processBorder(t, e, s, r, o) {
1045
- if (!e) return;
1046
- const i = {};
1047
- return this.processBorderStroke(t, e, i, V.Edge.Left), this.processBorderStroke(t, e, i, V.Edge.Right), o ? (i.right || i.left) && (i.right ? i.vertical = { ...i.right } : i.vertical = { ...i.left }) : this.processBorderStroke(t, e, i, V.Edge.Vertical), this.processBorderStroke(t, e, i, V.Edge.Top), this.processBorderStroke(t, e, i, V.Edge.Bottom), o ? (i.bottom || i.top) && (i.right ? i.horizontal = { ...i.bottom } : i.horizontal = { ...i.top }) : this.processBorderStroke(t, e, i, V.Edge.Horizontal), s[r] = i, s;
1048
- }
1049
- processBorderStroke(t, e, s, r) {
1050
- if (!e) return;
1051
- const o = t.evaluate(r, e);
1052
- if (!o) return;
1053
- const i = {};
1054
- o.hasAttribute("style") && (i.style = o.getAttribute("style"));
1055
- const n = t.evaluate("color", o);
1056
- return n && this.processDataBarColor(t, n, i, "color"), Object.keys(i).length > 0 ? s[r] = i : null;
1057
- }
1058
- }
1059
- class Tt extends Q {
1060
- visit(t, e, s) {
1061
- this.processNumFmts(t, t.evaluate("numFmts", e), null), t.getVisitorParamsState().set("colorsToProcess", /* @__PURE__ */ new Set());
1062
- const r = { fills: {}, fonts: {}, borders: {} };
1063
- 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: C.Type.None }, r.fills[1] = { type: C.Type.Pattern, patternType: C.BuiltInSheetPattern.Gray125 }, r.borders[0] = {};
1064
- const o = [];
1065
- this.processXFs(t, t.evaluate("cellStyleXfs", e), o, r, null, !1);
1066
- const i = /* @__PURE__ */ new Map();
1067
- if (o.length > 0) {
1068
- const a = [];
1069
- this.processCellStyles(t, t.evaluate("cellStyles", e), a, o, i), s.named = a;
1070
- }
1071
- const n = [];
1072
- this.processXFs(t, t.evaluate("cellXfs", e), n, r, i), Object.keys(n).length > 0 && (s.direct = n);
1073
- const l = [];
1074
- return this.processDXFs(t, t.evaluate("dxfs", e), l), this.processTableStyles(t, t.evaluate("tableStyles", e), s, l), this.processIndexColors(t, t.evaluate("colors/indexedColors", e), s), this.processMruColors(t, t.evaluate("colors/mruColors", e), s), s;
1075
- }
1076
- processIndexColors(t, e, s) {
1077
- if (!e) return;
1078
- const r = [], o = e.childNodes;
1079
- for (let i = 0; i < o.length; i++) {
1080
- const n = o.item(i);
1081
- if (n.nodeType === 1 && n.localName === "rgbColor") {
1082
- const l = { color: null };
1083
- this.processDataBarColor(t, n, l, "color"), l.color && r.push(l.color);
1084
- }
1085
- }
1086
- s.indexedColors = r;
1087
- }
1088
- processMruColors(t, e, s) {
1089
- if (!e) return;
1090
- const r = [], o = e.childNodes;
1091
- for (let i = 0; i < o.length; i++) {
1092
- const n = o.item(i);
1093
- if (n.nodeType === 1 && n.localName === "color") {
1094
- const l = { color: null };
1095
- this.processDataBarColor(t, n, l, "color"), l.color && r.push(l.color);
1096
- }
1097
- }
1098
- r.length > 0 && (s.mruColors = r);
1099
- }
1100
- processNumFmts(t, e, s) {
1101
- if (!e) return;
1102
- const r = /* @__PURE__ */ new Map();
1103
- if (t.getVisitorParamsState().set("numFmts", r), !e) return;
1104
- const o = e.childNodes;
1105
- for (let i = 0; i < o.length; i++) {
1106
- const n = o.item(i);
1107
- if (n.nodeType === 1 && n.localName === "numFmt") {
1108
- const l = n.getAttribute("numFmtId"), a = n.getAttribute("formatCode");
1109
- if (l && a) {
1110
- const c = a.replace(/\\(.)/g, "$1");
1111
- r.set(parseInt(l), c);
1112
- }
1113
- }
1114
- }
1115
- }
1116
- processXFs(t, e, s, r, o = null, i = !0) {
1117
- if (!e) return;
1118
- const n = e.childNodes;
1119
- for (let l = 0; l < n.length; l++) {
1120
- const a = n.item(l);
1121
- if (a.nodeType === 1 && a.localName === "xf") {
1122
- const c = {};
1123
- this.processXF(t, a, c, r, o, i), s.push(c);
1124
- }
1125
- }
1126
- }
1127
- processXF(t, e, s, r, o, i) {
1128
- if (!e) return;
1129
- const n = e.getAttribute("xfId");
1130
- if (n && o) {
1131
- const c = o.get(parseInt(n));
1132
- c && c !== rt.BuiltInName.Normal && (s.named = c);
1133
- }
1134
- const l = (c) => !(!i && e.hasAttribute(c)) || f(e.getAttribute("applyFont"));
1135
- if (l("applyFont")) {
1136
- const c = r.fonts[e.getAttribute("fontId")];
1137
- c && (s.font = c);
1138
- }
1139
- if (l("applyFill")) {
1140
- const c = r.fills[e.getAttribute("fillId")];
1141
- c && Object.keys(c).length > 0 && (s.fill = c);
1142
- }
1143
- if (l("applyBorder")) {
1144
- const c = r.borders[e.getAttribute("borderId")];
1145
- c && Object.keys(c).length > 0 && (s.border = c);
1146
- }
1147
- if (l("applyNumberFormat")) {
1148
- const c = e.getAttribute("numFmtId");
1149
- if (c) {
1150
- const h = parseInt(c);
1151
- let p;
1152
- const g = t.getVisitorParamsState();
1153
- if (g) {
1154
- const d = g.get("numFmts");
1155
- d && (p = d.get(h)), s.numberFormat = p ?? h;
1156
- } else console.warn("no visitor params state");
1157
- }
1158
- }
1159
- l("applyAlignment") && this.processAlignment(t, t.evaluate("alignment", e), s), l("applyProtection") && this.processProtection(t, t.evaluate("protection", e), s);
1160
- const a = f(e.getAttribute("quotePrefix"));
1161
- a && (s.quotePrefix = a);
1162
- }
1163
- processAlignment(t, e, s) {
1164
- const r = {};
1165
- if (e?.hasAttribute("horizontal") ? r.horizontal = e.getAttribute("horizontal") : r.horizontal = P.HorizontalAlignment.General, e?.hasAttribute("vertical") ? r.vertical = e.getAttribute("vertical") : r.vertical = P.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, f(e?.getAttribute("wrapText")) ? r.overflow = P.Overflow.Wrap : r.overflow = P.Overflow.Visible, f(e?.getAttribute("shrinkToFit")) && (r.overflow = P.Overflow.Shrink), e?.hasAttribute("textRotation")) {
1166
- let i = parseFloat(e.getAttribute("textRotation"));
1167
- i > 0 && i <= 90 ? i = 360 - i : i > 90 && i <= 180 ? i -= 90 : i === 255 && (i = 0, r.stacked = !0), r.rotation = i;
1168
- } else r.rotation = 0;
1169
- e?.hasAttribute("justifyLastLine") && (r.justifyLastLine = f(e.getAttribute("justifyLastLine")));
1170
- const o = e?.getAttribute("readingOrder");
1171
- return o && (o === "0" ? r.readingDirection = P.ReadingDirection.Auto : o === "1" ? r.readingDirection = P.ReadingDirection.LeftToRight : o === "2" ? r.readingDirection = P.ReadingDirection.RightToLeft : console.warn(`invalid readingOrder: ${o}`)), Object.keys(r).length > 0 && (s.alignment = r), s;
1172
- }
1173
- processProtection(t, e, s) {
1174
- if (!e) return;
1175
- const r = {}, o = e.getAttribute("locked");
1176
- o && !f(o) && (r.edit = !0);
1177
- const i = e.getAttribute("hidden");
1178
- return i && f(i) && (r.formulaHidden = !0), Object.keys(r).length > 0 && (s.protection = r), s;
1179
- }
1180
- processDXF(t, e, s) {
1181
- if (!e) return;
1182
- const r = e.childNodes;
1183
- for (let o = 0; o < r.length; o++) {
1184
- const i = r.item(o);
1185
- if (i.nodeType === 1 && i.localName === "font") {
1186
- const n = {};
1187
- this.processFont(t, i, n), s.font = n;
1188
- } else if (i.nodeType === 1 && i.localName === "fill") {
1189
- const n = [];
1190
- this.processFill(t, i, n, 0), n.length > 0 && n[0] && (s.fill = n[0]);
1191
- } else if (i.nodeType === 1 && i.localName === "border") {
1192
- const n = [];
1193
- this.processBorder(t, i, n, 0, !1), n.length > 0 && n[0] && (s.border = n[0]);
1194
- }
1195
- }
1196
- }
1197
- processDXFs(t, e, s) {
1198
- if (!e) return;
1199
- t.getVisitorParamsState().set("processingDXFs", !0);
1200
- const r = /* @__PURE__ */ new Map();
1201
- t.getVisitorParamsState().set("dxfs", r);
1202
- const o = e.childNodes;
1203
- for (let i = 0; i < o.length; i++) {
1204
- const n = o.item(i);
1205
- if (n.nodeType === 1 && n.localName === "dxf") {
1206
- const l = {};
1207
- this.processDXF(t, n, l);
1208
- const a = s.length;
1209
- r.set(a, l), s.push(l);
1210
- }
1211
- }
1212
- t.getVisitorParamsState().delete("processingDXFs");
1213
- }
1214
- processTableStyle(t, e, s, r, o = !1) {
1215
- const i = e.getAttribute("name"), n = { name: i };
1216
- e.hasAttribute("table") && (n.table = f(e.getAttribute("table"))), e.hasAttribute("pivot") && (n.pivot = f(e.getAttribute("pivot"))), o && !n.pivot && r.unshift(null);
1217
- const l = e.childNodes;
1218
- for (let a = 0; a < l.length; a++) {
1219
- const c = l.item(a);
1220
- if (c.nodeType === 1 && c.localName === "tableStyleElement") {
1221
- const h = c.getAttribute("type"), p = c.getAttribute("dxfId");
1222
- let g = r?.[p];
1223
- g || (console.warn("invalid dfx id", p), g = {}), n[h] = g;
1224
- let d = null;
1225
- c.hasAttribute("size") && (d = parseInt(c.getAttribute("size"))), d && !isNaN(d) && (g.size = d);
1226
- }
1227
- }
1228
- delete n.name, s[i] = n;
1229
- }
1230
- processTableStyles(t, e, s, r, o) {
1231
- if (!e) return;
1232
- const i = {}, n = e.getAttribute("defaultTableStyle");
1233
- n && (i.defaultTableStyle = n);
1234
- const l = e.getAttribute("defaultPivotStyle");
1235
- l && (i.defaultPivotStyle = l);
1236
- const a = e.childNodes, c = {};
1237
- for (let h = 0; h < a.length; h++) {
1238
- const p = a.item(h);
1239
- p.nodeType === 1 && p.localName === "tableStyle" && this.processTableStyle(t, p, c, r, o);
1240
- }
1241
- return Object.keys(c).length > 0 && (i.styles = c), Object.keys(i).length > 0 && (s.tables = i), s;
1242
- }
1243
- processCellStyles(t, e, s, r, o) {
1244
- if (!e) return;
1245
- const i = e.childNodes;
1246
- for (let n = 0; n < i.length; n++) {
1247
- const l = i.item(n);
1248
- if (l.nodeType === 1 && l.localName === "cellStyle") {
1249
- const a = parseInt(l.getAttribute("xfId")), c = l.getAttribute("name");
1250
- if (o.set(a, c), !r[a]) continue;
1251
- const h = { name: c, style: r[a] };
1252
- l.getAttribute("hidden") && (h.hidden = f(l.getAttribute("hidden"))), l.getAttribute("iLevel") && (h.iLevel = parseInt(l.getAttribute("iLevel"))), s.push(h);
1253
- }
1254
- }
1255
- }
1256
- afterVisit(t, e, s) {
1257
- }
1258
- }
1259
- class Vt extends Q {
1260
- visit(t, e, s) {
1261
- return this.processSheetRefs(t, t.evaluate("sheets", 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.processWorkbookProtection(t, t.evaluate("workbookProtection", e), s), this.processWorkbookPr(t, t.evaluate("workbookPr", e), s), s;
1262
- }
1263
- processPassword(t, e, s, r = "password") {
1264
- if (!e) return;
1265
- const o = {};
1266
- t.copyFromAttribute(e, "algorithmName", o, "algorithmName"), t.copyFromAttribute(e, "hashValue", o, "hashValue"), t.copyFromAttribute(e, "saltValue", o, "saltValue", t.BOOLEAN_COPY), t.copyFromAttribute(e, "spinCount", o, "spinCount", t.INT_COPY), Object.keys(o).length > 0 && (s[r] = o);
1267
- }
1268
- processWorkbookProtection(t, e, s) {
1269
- if (!e) return;
1270
- const r = {};
1271
- this.processPassword(t, t.evaluate("workbookPassword", e), r), this.processPassword(t, t.evaluate("revisionsPassword", e), r, "revisionsPassword");
1272
- const o = (i) => i !== !0 && i !== "1" && i !== "on" && i !== "true" && (i === !1 || i === "0" || i === "off" || i === "false" || null);
1273
- return t.copyFromAttribute(e, "lockStructure", r, "structure", o), t.copyFromAttribute(e, "lockWindows", r, "windows", o), t.copyFromAttribute(e, "lockRevision", r, "revision", o), s.protection = r, s;
1274
- }
1275
- processCalcPr(t, e, s) {
1276
- e && (s.calc = {});
1277
- }
1278
- processSheetRefs(t, e, s) {
1279
- if (!e) return;
1280
- const r = [], o = e.childNodes;
1281
- for (let i = 0; i < o.length; i++) {
1282
- const n = o.item(i);
1283
- n.nodeType === 1 && n.localName === "sheet" && this.processSheetRef(t, n, r);
1284
- }
1285
- s.sheets = r;
1286
- }
1287
- processSheetRef(t, e, s) {
1288
- const r = {};
1289
- t.copyFromAttribute(e, "name", r, "name"), t.copyFromAttribute(e, "state", r, "visibility");
1290
- const o = e.getAttribute("r:id"), i = t.getRef(o);
1291
- i && (r.sheet = i), s.push(r);
1292
- }
1293
- processBookViews(t, e, s) {
1294
- if (!e) return;
1295
- const r = e.childNodes;
1296
- let o = 0;
1297
- for (let i = 0; o < 1 && i < e.childNodes.length; i++) {
1298
- const n = r.item(i);
1299
- n.nodeType === 1 && n.localName === "workbookView" && (this.processWorkbookView(t, n, s), o++);
1300
- }
1301
- }
1302
- processWorkbookView(t, e, s) {
1303
- if (!e) return;
1304
- const r = {};
1305
- t.copyFromAttribute(e, "activeTab", r, "activeSheetId", [t.INT_COPY, (o) => o + 1]), e.hasAttribute("activeTab") || (r.activeSheetId = 1), 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, (o) => o]), Object.keys(r).length > 0 && (s.view = r);
1306
- }
1307
- processDefineName(t, e, s, r) {
1308
- if (!e) return;
1309
- const o = {}, i = e.firstChild;
1310
- if (i && i.nodeType === 3 && (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")) {
1311
- const n = e.getAttribute("localSheetId");
1312
- if (!r[n]?.name) return void console.warn(`Defined name '${e.getAttribute("name")}' references a sheet with localSheetId '${n}' which does not exist.`);
1313
- o.scope = r[n].name;
1314
- }
1315
- 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);
1316
- }
1317
- processDefinedNames(t, e, s) {
1318
- if (!e) return;
1319
- const r = [], o = e.childNodes;
1320
- for (let i = 0; i < o.length; i++) {
1321
- const n = o.item(i);
1322
- n.nodeType === 1 && n.localName === "definedName" && this.processDefineName(t, n, r, s.sheets);
1323
- }
1324
- r.length > 0 && (s.names = r);
1325
- }
1326
- processWorkbookPr(t, e, s) {
1327
- e && t.copyFromAttribute(e, "date1904", s, "date1904", t.BOOLEAN_COPY);
1328
- }
1329
- afterVisit(t, e, s) {
1330
- }
1331
- }
1332
- class St {
1333
- visit(t, e, s) {
1334
- return t.copyFromAttribute(e, "name", s), t.copyFromAttribute(e, "displayName", s), t.copyFromAttribute(e, "ref", s), t.copyFromAttribute(e, "headerRowCount", s, "headerRowCount", t.INT_COPY), t.copyFromAttribute(e, "totalsRowCount", s, "totalsRowCount", t.INT_COPY), this.processTableColumns(t, e, s), this.processTableStyleInfo(t, e, s), s;
1335
- }
1336
- processTableStyleInfo(t, e, s) {
1337
- if (!e) return;
1338
- const r = e.childNodes, o = {};
1339
- for (let i = 0; i < r.length; i++) {
1340
- const n = r.item(i);
1341
- n.nodeType === 1 && n.localName === "tableStyleInfo" && (t.copyFromAttribute(n, "name", o), t.copyFromAttribute(n, "showColumnStripes", o, "showColumnStripes", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showFirstColumn", o, "showFirstColumn", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showLastColumn", o, "showLastColumn", t.BOOLEAN_COPY), t.copyFromAttribute(n, "showRowStripes", o, "showRowStripes", t.BOOLEAN_COPY));
1342
- }
1343
- Object.keys(o).length > 0 && (s.styleOptions = o);
1344
- }
1345
- processTableColumn(t, e, s) {
1346
- if (!e) return null;
1347
- const r = e.childNodes;
1348
- for (let o = 0; o < r.length; o++) {
1349
- const i = r.item(o);
1350
- if (i.nodeType === 1 && i.localName === "tableColumn") {
1351
- const n = {};
1352
- t.copyFromAttribute(i, "name", n), t.copyFromAttribute(i, "uniqueName", n), s.push(n);
1353
- }
1354
- }
1355
- return s;
1356
- }
1357
- processTableColumns(t, e, s) {
1358
- const r = e.childNodes, o = [];
1359
- for (let i = 0; i < r.length; i++) {
1360
- const n = r.item(i);
1361
- n.nodeType === 1 && n.localName === "tableColumns" && this.processTableColumn(t, n, o);
1362
- }
1363
- o.length > 0 && (s.columns = o);
1364
- }
1365
- }
1366
- class xt {
1367
- visit(t, e, s) {
1368
- return s;
1369
- }
1370
- }
1371
- class E {
1372
- visit(t, e, s) {
1373
- if (!e) return;
1374
- const r = {};
1375
- return t.copyFromAttribute(e, "editAs", r, "anchorType"), r.anchor = {}, 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;
1376
- }
1377
- processOffsetCoord(t, e, s, r) {
1378
- if (!e) return;
1379
- const o = { c: 0, r: 0, x: 0, y: 0 };
1380
- 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 = x(t.evaluate("colOff", e).textContent)), t.evaluate("rowOff", e) && (o.y = x(t.evaluate("rowOff", e).textContent)), r === "from" ? s.tl = o : s.br = o, s;
1381
- }
1382
- }
1383
- class U {
1384
- visit(t, e, s) {
1385
- if (!e) return;
1386
- const r = t.evaluate("*/cNvPr", e);
1387
- return r && (t.copyFromAttribute(r, "name", s), t.copyFromAttribute(r, "desc", s), t.copyFromAttribute(r, "hidden", s, "hidden", t.BOOLEAN_COPY), t.copyFromAttribute(r, "id", s)), s;
1388
- }
1389
- }
1390
- class kt extends U {
1391
- visit(t, e, s) {
1392
- if (!e) return;
1393
- s = super.visit(t, e, s);
1394
- const r = t.evaluate("nvGraphicFramePr/cNvGraphicFramePr", e);
1395
- if (r) {
1396
- const n = t.evaluate("graphicFrameLocks", r);
1397
- if (n) {
1398
- n.hasAttribute("noChangeAspect") && (s.lockAspect = n.getAttribute("noChangeAspect") === "1");
1399
- const l = {};
1400
- Object.keys(l).length > 0 && (s.locks = l);
1401
- }
1402
- }
1403
- let o = { type: "graphicFrame", json: {} };
1404
- const i = t.evaluate("graphic/graphicData", e).childNodes;
1405
- for (let n = 0; n < i.length; n++) {
1406
- const l = i.item(n);
1407
- if (l.nodeType === 1) try {
1408
- let a = l.localName;
1409
- a === "chart" && (a = "chart"), o.type = a;
1410
- const c = l.getAttribute("r:id");
1411
- c && (o.json = t.getRef(c));
1412
- } catch (a) {
1413
- console.warn("Unable to parse graphicFrame", a);
1414
- }
1415
- }
1416
- return o && (s.content = o), o;
1417
- }
1418
- }
1419
- class z extends U {
1420
- visit(t, e, s) {
1421
- if (!e) return;
1422
- s = super.visit(t, e, s);
1423
- const r = t.evaluate("nvSpPr/cNvSpPr", e);
1424
- if (r) {
1425
- const i = t.evaluate("spLocks", r);
1426
- if (i) {
1427
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1428
- const n = {};
1429
- Object.keys(n).length > 0 && (s.locks = n);
1430
- }
1431
- }
1432
- t.warn(`Unable to import '${s.name}', shapes are not supported.`);
1433
- const o = {};
1434
- return s.content = { type: "sp", json: o }, o;
1435
- }
1436
- }
1437
- class It extends U {
1438
- visit(t, e, s) {
1439
- if (!e) return;
1440
- const r = super.visit(t, e, s), o = t.evaluate("nvPicPr/cNvPicPr", e);
1441
- if (o) {
1442
- t.copyFromAttribute(e, "preferRelativeResize", r, "preferRelativeResize", t.BOOLEAN_COPY);
1443
- const a = t.evaluate("picLocks", o);
1444
- if (a) {
1445
- a.hasAttribute("noChangeAspect") && (r.lockAspect = a.getAttribute("noChangeAspect") === "1");
1446
- const c = {};
1447
- t.copyFromAttribute(a, "noChangeArrowheads", r, "noChangeArrowheads", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noChangeShapeType", r, "noChangeShapeType", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noEditPoints", r, "noEditPoints", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noAdjustHandles", r, "noAdjustHandles", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noCrop", r, "noCrop", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noGrp", r, "noGrp", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noMove", r, "noMove", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noResize", r, "noResize", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noRot", r, "noRot", t.BOOLEAN_COPY), t.copyFromAttribute(a, "noSelect", r, "noSelect", t.BOOLEAN_COPY), Object.keys(c).length > 0 && (r.locks = c);
1448
- }
1449
- }
1450
- const i = t.evaluate("blipFill/blip", e);
1451
- let n;
1452
- if (i) {
1453
- const a = i.getAttribute("r:embed") ?? i.getAttribute("embed");
1454
- if (!a) return void console.warn("no rId found for blip", i);
1455
- n = t.getRef(a, !0);
1456
- }
1457
- const l = { resId: n };
1458
- return s.content = { type: "picture", json: l }, r;
1459
- }
1460
- }
1461
- class Lt extends z {
1462
- visit(t, e, s) {
1463
- if (!e) return;
1464
- s = super.visit(t, e, s);
1465
- const r = t.evaluate("nvGrpSpPr/cNvGrpSpPr", e);
1466
- if (r) {
1467
- const i = t.evaluate("grpSpLocks", r);
1468
- if (i) {
1469
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1470
- const n = {};
1471
- Object.keys(n).length > 0 && (s.locks = n);
1472
- }
1473
- }
1474
- t.warn(`Unable to import '${s.name}', group shapes are not supported.`);
1475
- const o = {};
1476
- return s.content = { type: "grpSp", json: o }, o;
1477
- }
1478
- }
1479
- class Bt extends z {
1480
- visit(t, e, s) {
1481
- if (!e) return;
1482
- s = super.visit(t, e, s);
1483
- const r = t.evaluate("nvCxnSpPr/cNvCxnSpPr", e);
1484
- if (r) {
1485
- const i = t.evaluate("cxnSpLocks", r);
1486
- if (i) {
1487
- i.hasAttribute("noChangeAspect") && (s.lockAspect = i.getAttribute("noChangeAspect") === "1");
1488
- const n = {};
1489
- Object.keys(n).length > 0 && (s.locks = n);
1490
- }
1491
- }
1492
- t.warn(`Unable to import '${s.name}', connection shapes are not supported.`);
1493
- const o = {};
1494
- return s.content = { type: "cxnSp", json: o }, o;
1495
- }
1496
- }
1497
- const $ = "richTypes";
1498
- class _t {
1499
- visit(t, e, s) {
1500
- let r = t.getVisitorParamsState().get($);
1501
- r || (r = [], t.getVisitorParamsState().set($, r));
1502
- const o = e.childNodes, i = o.length;
1503
- for (let n = 0; n < i; n++) {
1504
- const l = o.item(n);
1505
- if (l.nodeType === 1 && l.localName === "s") {
1506
- const a = { type: l.getAttribute("t") ?? "n", keys: [] };
1507
- this.processKeys(t, l, a), r.push(a);
1508
- }
1509
- }
1510
- return s.richTypes = r, r;
1511
- }
1512
- processKeys(t, e, s) {
1513
- const r = e.childNodes, o = r.length, i = s.keys;
1514
- for (let n = 0; n < o; n++) {
1515
- const l = r.item(n);
1516
- if (l.nodeType === 1 && l.localName === "k") {
1517
- const a = l.getAttribute("n"), c = l.getAttribute("t");
1518
- i.push([a, c]);
1519
- }
1520
- }
1521
- }
1522
- }
1523
- const K = "richData";
1524
- class jt {
1525
- visit(t, e, s) {
1526
- let r = t.getVisitorParamsState().get("richTypes");
1527
- if (!r) return void t.warn("RichValueFound but not type.");
1528
- let o = t.getVisitorParamsState().get(K);
1529
- o || (o = [], t.getVisitorParamsState().set(K, o));
1530
- const i = e.childNodes, n = i.length;
1531
- for (let l = 0; l < n; l++) {
1532
- const a = i.item(l);
1533
- if (a.nodeType === 1 && a.localName === "rv") {
1534
- const c = r[a.getAttribute("s")], h = { type: c.type };
1535
- this.processValues(t, a, h, c);
1536
- const p = this.mapType(t, h);
1537
- o.push(p);
1538
- }
1539
- }
1540
- return s.richData = o, o;
1541
- }
1542
- mapType(t, e) {
1543
- if (e.type === "_error") {
1544
- const s = e.errorType;
1545
- if (s) try {
1546
- e = st.getBuiltInById(s + 1);
1547
- } catch {
1548
- }
1549
- }
1550
- return e;
1551
- }
1552
- processValues(t, e, s, r) {
1553
- const o = e.childNodes, i = o.length;
1554
- r.type;
1555
- const n = r.keys;
1556
- for (let l = 0; l < i; l++) {
1557
- const a = o.item(l);
1558
- if (a.nodeType === 1 && a.localName === "v") {
1559
- const c = n[l];
1560
- if (!c) return void t.warn("Invalid richData");
1561
- const h = c[0], p = c[1];
1562
- let g = a.textContent;
1563
- p === "i" && (g = Number(g)), s[h] = g;
1564
- }
1565
- }
1566
- }
1567
- }
1568
- class Rt {
1569
- visit(t, e, s) {
1570
- if (!e) return;
1571
- const r = [];
1572
- return this.processAuthors(t, t.evaluate("authors", e), r), r.length > 0 && (s.authors = r), s.comments = [], s;
1573
- }
1574
- processAuthors(t, e, s) {
1575
- if (!e) return;
1576
- const r = e.childNodes;
1577
- for (let o = 0; o < r.length; o++) {
1578
- const i = r.item(o);
1579
- if (i.nodeType === 1 && i.localName === "author") {
1580
- const n = i.firstChild;
1581
- n && n.nodeType === 3 && s.push(n.textContent);
1582
- }
1583
- }
1584
- }
1585
- }
1586
- class Et {
1587
- visit(t, e, s) {
1588
- if (!e) return;
1589
- const r = {};
1590
- return t.copyFromAttribute(e, "ref", r), t.copyFromAttribute(e, "authorId", r, "authorId", t.INT_COPY), r.asNote = !0, s.comments || (s.comments = []), s.comments.push(r), r;
1591
- }
1592
- }
1593
- class Yt {
1594
- visit(t, e, s) {
1595
- if (!e) return;
1596
- const r = [];
1597
- return s.comments = r, r;
1598
- }
1599
- }
1600
- class Dt {
1601
- visit(t, e, s) {
1602
- if (!e) return;
1603
- const r = {};
1604
- return t.copyFromAttribute(e, "id", r, "id", I), t.copyFromAttribute(e, "personId", r, "personId", I), t.copyFromAttribute(e, "ref", r), t.copyFromAttribute(e, "parentId", r, "parentId", I), t.copyFromAttribute(e, "dT", r), e.hasAttribute("done") && (r.done = f(e.getAttribute("done"))), s.push(r), r;
1605
- }
1606
- }
1607
- class Mt {
1608
- visit(t, e, s) {
1609
- const r = [], o = e.childNodes;
1610
- for (let i = 0; i < o.length; i++) {
1611
- const n = o.item(i);
1612
- if (n.nodeType === 1 && n.localName === "person") {
1613
- const l = {};
1614
- t.copyFromAttribute(n, "id", l, "id", I), t.copyFromAttribute(n, "displayName", l), t.copyFromAttribute(n, "userId", l, "userId", I), t.copyFromAttribute(n, "providerId", l), r.push(l);
1615
- }
1616
- }
1617
- return r.length > 0 && (s.persons = r), r;
1618
- }
1619
- }
1620
- const Ut = {};
1621
- class zt {
1622
- constructor(t, e) {
1623
- this.path = t, this.visitor = e;
1624
- }
1625
- }
1626
- class $t {
1627
- constructor() {
1628
- this.visitorsByXmlTagName = /* @__PURE__ */ new Map(), this.scopedVisitorsByXmlTagName = /* @__PURE__ */ new Map(), this.visitorParamsState = null, this.registerVisitor("Relationships", new ct()), this.registerVisitor("spPr", new M()), this.registerVisitor("txBody", new F()), this.registerVisitor("txPr", new F()), this.registerVisitor("c:chartSpace", new ut()), this.registerVisitor("c:chartSpace", new ht(), "chart"), this.registerVisitor("c:plotArea", new pt()), this.registerVisitor("c:barChart", new gt()), this.registerVisitor("c:doughnutChart", new S()), this.registerVisitor("c:lineChart", new S()), this.registerVisitor("c:ofPieType", new S()), this.registerVisitor("c:pieChart", new S()), this.registerVisitor("c:scatterChart", new S()), this.registerVisitor("c:barChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:doughnutChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:lineChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:ofPieType", new N("dataLabels"), "dLbls"), this.registerVisitor("c:pieChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:scatterChart", new N("dataLabels"), "dLbls"), this.registerVisitor("c:ser", new dt()), this.registerVisitor("c:dPt", new mt()), this.registerVisitor("c:marker", new bt()), this.registerVisitor("c:catAx", new R()), this.registerVisitor("c:valAx", new R()), this.registerVisitor("c:dateAx", new R()), this.registerVisitor("c:majorGridlines", new j("gridLinesMajor")), this.registerVisitor("c:minorGridlines", new j("gridLinesMinor")), this.registerVisitor("c:chartSpace", null, "txPr"), this.registerVisitor("c:catAx", new F("labels.text"), "txPr"), this.registerVisitor("c:valAx", new F("labels.text"), "txPr"), this.registerVisitor("c:dateAx", new F("labels.text"), "txPr"), this.registerVisitor("c:legend", new At()), this.registerVisitor("c:legend", new F("labels.text"), "txPr"), this.registerVisitor("c:legendEntry", new ft()), this.registerVisitor("c:ser", new yt(), "extLst/ext/invertSolidFillFmt/spPr"), this.registerVisitor("c:ser", new N("labels"), "dLbls"), this.registerVisitor("c:dLbl", new N("points")), this.registerVisitor("c:title", new X()), this.registerVisitor("c:title", null, "tx/rich"), this.registerVisitor("c:title", null, "txPr"), this.registerVisitor("c:layout", new vt()), this.registerVisitor("c:dispUnits", new j("dispUnits")), this.registerVisitor("c:dispUnitsLbl", new X("displayUnitsLabel")), this.registerVisitor("c:dispUnitsLbl", new F(), "tx/rich"), this.registerVisitor("a:theme", new Ft()), this.registerVisitor("a:theme", new Ct(), "themeElements/clrScheme"), this.registerVisitor("a:theme", new wt(), "themeElements/fontScheme"), this.registerVisitor("autoFilter", new Nt()), this.registerVisitor("sortState", new Ot()), this.registerVisitor("s:workbook", new Vt()), this.registerVisitor("styleSheet", new Tt()), this.registerVisitor("table", new St()), this.registerVisitor("hlinkClick", new Pt()), this.registerVisitor("wsDr", new xt()), this.registerVisitor("twoCellAnchor", new E()), this.registerVisitor("oneCellAnchor", new E()), this.registerVisitor("absoluteAnchor", new E()), this.registerVisitor("graphicFrame", new kt()), this.registerVisitor("sp", new z()), this.registerVisitor("grpSp", new Lt()), this.registerVisitor("cxnSp", new Bt()), this.registerVisitor("pic", new It()), this.registerVisitor("rvStructures", new _t()), this.registerVisitor("rvData", new jt()), this.registerVisitor("comments", new Rt()), this.registerVisitor("commentList", new Et(), "comment"), this.registerVisitor("comment", new F("content"), "text"), this.registerVisitor("ThreadedComments", new Yt()), this.registerVisitor("threadedComment", new Dt()), this.registerVisitor("threadedComment", new F("content"), "text"), this.registerVisitor("personList", new Mt());
1629
- }
1630
- registerVisitor(t, e, s = null) {
1631
- t.indexOf(":") === -1 && (t = "*:" + t);
1632
- const r = t.split(":"), o = r.length > 1 ? r[1] : r[0];
1633
- if (!s) return this.visitorsByXmlTagName.set(o, e), void this.visitorsByXmlTagName.set(t, e);
1634
- let i = this.scopedVisitorsByXmlTagName.get(o);
1635
- i || (i = [], this.scopedVisitorsByXmlTagName.set(o, i), this.scopedVisitorsByXmlTagName.set(t, i)), i.push(new zt(s, e));
1636
- }
1637
- getVisitorParamsState() {
1638
- return this.visitorParamsState;
1639
- }
1640
- convert(t, e, s = Ut) {
1641
- const r = t.documentElement;
1642
- this.visitorParamsState && !s?.paramMap || (this.visitorParamsState = s?.paramMap ?? /* @__PURE__ */ new Map());
1643
- const o = {};
1644
- let i = this.visitorsByXmlTagName.get(r.nodeName);
1645
- 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.`);
1646
- const n = "/" + r.localName, l = new _(null, this, n, r, o, e, s), a = [];
1647
- this._doWalk(i, l, a, r, o, e, s);
1648
- for (let c = 0; c < a.length; c++) {
1649
- const h = a[c];
1650
- try {
1651
- h.visitor?.afterVisit?.(h.context, h.elemParent, h.jsonParent);
1652
- } catch (p) {
1653
- console.warn(`Error in afterVisit: ${h.context.getPath()}`, p);
1654
- }
1655
- }
1656
- return o;
1657
- }
1658
- _walkScoped(t, e, s, r, o, i, n) {
1659
- const l = this.scopedVisitorsByXmlTagName.get(t);
1660
- for (let a = 0; l && a < l.length; a++) {
1661
- const c = l[a];
1662
- let h = null;
1663
- try {
1664
- h = e.evaluate(c.path, r);
1665
- } catch {
1666
- console.warn(`"Invalid path '${c.path}' for '${t}'.`);
1667
- }
1668
- if (!h) continue;
1669
- const p = (g) => {
1670
- let d = g.localName, v = g.parentNode;
1671
- for (; v && v !== r; ) d = v.localName + "/" + d, v = v.parentNode;
1672
- const O = e.getPath() + "/" + d;
1673
- if (c.visitor) {
1674
- const B = new _(e, this, O, e.getElemRoot(), e.getJsonRoot(), i, n);
1675
- this._doWalk(c.visitor, B, s, g, o, i, n);
1676
- }
1677
- };
1678
- if (h.length > 0) {
1679
- const g = h;
1680
- for (let d = 0; d < g.length; d++) p(g.item(d));
1681
- } else p(h);
1682
- }
1683
- }
1684
- _doWalk(t, e, s, r, o, i, n) {
1685
- let l = null;
1686
- t && (s.push({ visitor: t, context: e, elemParent: r, jsonParent: o }), l = t.visit(e, r, o)), l || (l = o);
1687
- const a = r.localName;
1688
- this._walkScoped(a, e, s, r, l, i, n);
1689
- const c = r.childNodes;
1690
- for (let h = 0; h < c.length; h++) {
1691
- const p = c.item(h);
1692
- if (p.nodeType === 1) {
1693
- const g = p, d = g.localName, v = this.visitorsByXmlTagName.get(d), O = e.getPath() + "/" + d, B = new _(e, this, O, e.getElemRoot(), e.getJsonRoot(), i, n);
1694
- this._doWalk(v, B, s, g, l ?? o, i, n);
1695
- }
1696
- }
1697
- return l;
1698
- }
1699
- }
1700
- export {
1701
- $t as FromOOXMLConverter,
1702
- $t as default
1703
- };