@sheetxl/io-xlsx 0.8.0-beta.1 → 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 (191) hide show
  1. package/browser/esm/BiDqExNXiY7ykk8E.mjs +2327 -0
  2. package/browser/esm/{Ctqql4O-3xj2K8vv.mjs → Bs0EzhdU8WgGfPzf.mjs} +193 -143
  3. package/browser/esm/CLWsOc6DO8l1G_LF.mjs +2213 -0
  4. package/browser/esm/{CLWzJJyoSrykkVLX.mjs → CZ9I80og75SDRjv0.mjs} +2 -2
  5. package/browser/esm/{Dz1Dp8DDJvhd09RR.mjs → CuAXx5i4uqTz-mMY.mjs} +1 -1
  6. package/browser/esm/Cv3R6fGatARKedSn.mjs +8635 -0
  7. package/browser/esm/{BkNXyG6NC-w5Xo92.mjs → CzFYJPxmLyKgEKF0.mjs} +28 -13
  8. package/browser/esm/DICL6ecj9BdJv8aX.mjs +104 -0
  9. package/browser/esm/DatIA9fZbEPjW4bh.mjs +5638 -0
  10. package/browser/esm/index.mjs +2 -3
  11. package/browser/esm/yveeVJ6hKDI5KDEz.mjs +4168 -0
  12. package/licenses/dependencies.txt +2 -2
  13. package/node/esm/B9Zn6H1RV07Ob377.mjs +2294 -0
  14. package/node/esm/Bpqm_PpGLpdjL47-.mjs +2368 -0
  15. package/node/esm/{fOnuUjpPCAzmuIXN.mjs → CAJxmJdobUbzpUz5.mjs} +2 -2
  16. package/node/esm/{CEV7nKotMpeRRnQC.mjs → CxlSbH7mmnEEsqmX.mjs} +1 -1
  17. package/node/esm/DD-yXSBzvDYy0TX5.mjs +5842 -0
  18. package/node/esm/DScqM1V4wPntNP6-.mjs +5235 -0
  19. package/node/esm/{CEAmv36xpTNgFwl_.mjs → fopiRR7OiVoEiF7B.mjs} +49 -35
  20. package/node/esm/index.mjs +77 -25
  21. package/node/esm/ipiyzn5Pfohw2afB.mjs +4271 -0
  22. package/package.json +7 -8
  23. package/types/src/AutoFilterRules.d.ts +94 -11
  24. package/types/src/ConditionalFormatRules.d.ts +5 -5
  25. package/types/src/DataValidationRules.d.ts +18 -2
  26. package/types/src/DefinedNameAttributes.d.ts +8 -0
  27. package/types/src/ExcelCalcStamp.d.ts +39 -0
  28. package/types/src/ExcelCompat.d.ts +209 -42
  29. package/types/src/ExcelReservedNames.d.ts +3 -4
  30. package/types/src/KnownFonts.d.ts +50 -0
  31. package/types/src/LegacyFormula.d.ts +41 -7
  32. package/types/src/OOXMLExtensions.d.ts +14 -2
  33. package/types/src/PageLayoutAttributes.d.ts +8 -0
  34. package/types/src/Plugin.d.ts +28 -5
  35. package/types/src/ProtectionAttributes.d.ts +38 -0
  36. package/types/src/SheetKinds.d.ts +57 -0
  37. package/types/src/SheetViewAttributes.d.ts +4 -0
  38. package/types/src/SortExtent.d.ts +16 -0
  39. package/types/src/SourcePackage.d.ts +31 -12
  40. package/types/src/Types.d.ts +28 -0
  41. package/types/src/XlsxHeader.d.ts +19 -0
  42. package/types/src/chart/ChartExXml.d.ts +38 -0
  43. package/types/src/chart/ChartPartXml.d.ts +47 -0
  44. package/types/src/chart/ChartSpaceXml.d.ts +36 -0
  45. package/types/src/chart/_XmlTree.d.ts +34 -0
  46. package/types/src/chart/_chartCodecs.d.ts +10 -0
  47. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  48. package/types/src/chart/_chartExFold.d.ts +14 -0
  49. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  50. package/types/src/chart/_chartExStyle.d.ts +22 -0
  51. package/types/src/chart/_codec.d.ts +78 -0
  52. package/types/src/chart/_drawingml.d.ts +10 -0
  53. package/types/src/chart/_xml.d.ts +70 -0
  54. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  55. package/types/src/reader/DummyFunctionUnwrap.d.ts +2 -2
  56. package/types/src/reader/HeaderStyles.d.ts +15 -0
  57. package/types/src/reader/HiddenFormulas.d.ts +16 -0
  58. package/types/src/reader/IsoDateCell.d.ts +20 -0
  59. package/types/src/reader/LibreOfficeDataTable.d.ts +11 -0
  60. package/types/src/reader/SlicerJoin.d.ts +24 -0
  61. package/types/src/reader/Warning.d.ts +29 -0
  62. package/types/src/reader/ZipReader.d.ts +1 -1
  63. package/types/src/reader/_SlicerRecord.d.ts +37 -0
  64. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  65. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  66. package/types/src/reader/dom/ExecutionContext.d.ts +16 -3
  67. package/types/src/reader/dom/Types.d.ts +19 -3
  68. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  69. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +16 -3
  70. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +15 -2
  71. package/types/src/reader/domVisitors/CommentVisitor.d.ts +24 -2
  72. package/types/src/reader/domVisitors/CommentsVisitor.d.ts +2 -2
  73. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  74. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +34 -1
  75. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  76. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +14 -2
  77. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +30 -2
  78. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  79. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +10 -0
  80. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +21 -3
  81. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +4 -4
  82. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  83. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  84. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  85. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  86. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +3 -3
  87. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +21 -6
  88. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +7 -2
  89. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +7 -3
  90. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  91. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  92. package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +18 -1
  93. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  94. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +11 -1
  95. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  96. package/types/src/reader/domVisitors/index.d.ts +6 -32
  97. package/types/src/reader/sax/LeanSaxParser.d.ts +58 -0
  98. package/types/src/reader/sax/SaxParser.d.ts +11 -1
  99. package/types/src/reader/sax/SaxVisitor.d.ts +3 -2
  100. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +9 -0
  101. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +46 -6
  102. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +23 -11
  103. package/types/src/utils/DrawingMLText.d.ts +39 -0
  104. package/types/src/utils/FormControls.d.ts +170 -0
  105. package/types/src/utils/SharedNames.d.ts +13 -0
  106. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  107. package/types/src/utils/VmlNoteShapes.d.ts +128 -0
  108. package/types/src/utils/VmlNoteStyle.d.ts +44 -0
  109. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  110. package/types/src/vba/VBAProject.d.ts +52 -4
  111. package/types/src/writer/builder/ContentTypes.d.ts +13 -0
  112. package/types/src/writer/builder/Emitter.d.ts +11 -6
  113. package/types/src/writer/builder/OpcXmlUtils.d.ts +2 -0
  114. package/types/src/writer/builder/PackageBuilder.d.ts +74 -22
  115. package/types/src/writer/builder/PartWriter.d.ts +5 -0
  116. package/types/src/writer/builder/RelationshipSet.d.ts +3 -0
  117. package/types/src/writer/builder/Types.d.ts +124 -38
  118. package/types/src/writer/builder/_Types.d.ts +17 -0
  119. package/types/src/writer/emitters/CommentsEmitter.d.ts +58 -0
  120. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  121. package/types/src/writer/emitters/EmbeddedPartEmitter.d.ts +60 -0
  122. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +19 -0
  123. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +18 -0
  124. package/types/src/writer/emitters/PersonsEmitter.d.ts +17 -0
  125. package/types/src/writer/emitters/PivotTableEmitter.d.ts +45 -0
  126. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  127. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  128. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  129. package/types/src/writer/emitters/SlicerEmitter.d.ts +66 -0
  130. package/types/src/writer/emitters/StylesEmitter.d.ts +2 -2
  131. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  132. package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +27 -0
  133. package/types/src/writer/emitters/WorkbookEmitter.d.ts +21 -3
  134. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  135. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  136. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  137. package/types/src/writer/utils/DefaultRows.d.ts +38 -0
  138. package/types/src/writer/utils/DrawMLUtils.d.ts +57 -3
  139. package/types/src/writer/utils/DummyFunction.d.ts +0 -2
  140. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  141. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +28 -0
  142. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  143. package/types/src/writer/utils/SheetStyleLayout.d.ts +73 -0
  144. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  145. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  146. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  147. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  148. package/browser/cjs/BAtEL-5TLyoaPFDP.cjs +0 -2
  149. package/browser/cjs/Bg0e53JZa8vhmm5a.cjs +0 -1
  150. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  151. package/browser/cjs/CK5FFUvet6FnIYO_.cjs +0 -5
  152. package/browser/cjs/D5Y4KQhKdukOkjvA.cjs +0 -2
  153. package/browser/cjs/DV6LeTEiiFUrZoxj.cjs +0 -1
  154. package/browser/cjs/DWkuoJSgvcXJTdN1.cjs +0 -1
  155. package/browser/cjs/Db8YjGM6TG34c8aT.cjs +0 -1
  156. package/browser/cjs/index.cjs +0 -1
  157. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  158. package/browser/esm/4BWLu134ABlCQEtM.mjs +0 -3655
  159. package/browser/esm/BzQ_lPzc8C4OTIGZ.mjs +0 -99
  160. package/browser/esm/CJknI8BYGSZr-4zS.mjs +0 -52
  161. package/browser/esm/Cok_fBIUCHDSrKw0.mjs +0 -2211
  162. package/browser/esm/D-m_kQLaewdwuXaF.mjs +0 -2685
  163. package/browser/esm/Dj7D2nVdAZ3TiUks.mjs +0 -4743
  164. package/browser/esm/ijQzHH-bvDfUHIi1.mjs +0 -24
  165. package/node/esm/CF1R5ovFsRNu--Rw.mjs +0 -3744
  166. package/node/esm/Ctcl4jN52INWpKWC.mjs +0 -2255
  167. package/node/esm/CvnRSooxEQdlJgMn.mjs +0 -2766
  168. package/node/esm/DQd0vxzTaPt2qSL-.mjs +0 -108
  169. package/node/esm/ssSlRCbCqxvZ9IX8.mjs +0 -2481
  170. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  171. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  172. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  173. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  174. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  175. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  176. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  177. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  178. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  179. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  180. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  181. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  182. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  183. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  184. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  185. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  186. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  187. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  188. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  189. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  190. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  191. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
@@ -0,0 +1,4168 @@
1
+ /**
2
+ * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.11
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 { $t as e, C as t, Cn as n, Dn as r, Dt as i, En as a, Et as o, Gn as s, Gt as c, Hn as l, It as u, Jn as d, Jt as f, Lt as p, Mn as m, Ot as h, Pn as g, Pt as _, Q as v, Qn as y, Rt as b, Tn as ee, Tt as x, Ut as te, Wn as ne, Wt as re, X as ie, Xt as ae, Yn as oe, Zn as se, Zt as ce, _n as le, _t as S, bn as C, bt as w, cn as T, d as E, dn as D, dt as O, en as ue, et as de, fn as k, ft as A, gn as j, gt as M, h as fe, hn as pe, ht as N, kn as P, ln as me, mn as F, n as he, pn as ge, pt as _e, qt as ve, rn as ye, rt as be, sn as xe, st as Se, t as Ce, tt as we, u as I, un as L, vn as Te, vt as Ee, w as De, wt as Oe, x as ke, xn as Ae, xt as je, zn as R } from "./Cv3R6fGatARKedSn.mjs";
8
+ import { BufferUtils as Me, CommonUtils as z, ExpectedError as Ne, OverlappingRange as Pe, RangeAxis as B } from "@sheetxl/utils";
9
+ import { AddressUtils as V, CommonUtils as Fe, CoordUtils as Ie, FormulaError as Le, FormulaText as Re, ICellStyle as ze, ICondition as H, IConditionalFormat as U, ICustomProperty as W, IFont as Be, IRange as Ve, OutOfBoundsError as He, PersonCollection as Ue, ResourceCollection as We, Sort as Ge, Theme as Ke, Tuple as qe, Workbook as Je } from "@sheetxl/sdk";
10
+ var Ye = {
11
+ ascending: "ascending",
12
+ descending: "descending",
13
+ natural: "dataSource"
14
+ };
15
+ function Xe(e, t) {
16
+ if (!t) return null;
17
+ for (let n = 0; n < e.length; n++) if (e[n].id !== void 0 && String(e[n].id) === t) return e[n];
18
+ let n = Number(t);
19
+ return Number.isInteger(n) && n >= 1 && n <= e.length ? e[n - 1] : null;
20
+ }
21
+ function Ze(e, t, n) {
22
+ let r = {
23
+ ...t,
24
+ source: n
25
+ };
26
+ if (e.caption !== void 0 && e.caption !== e.sourceName && (r.caption = e.caption), !1 === e.showCaption && (r.hiddenCaption = !0), e.columnCount !== void 0 && e.columnCount > 1 && (r.columnCount = e.columnCount), e.rowHeight !== void 0) {
27
+ let t = Math.round(e.rowHeight / 9525);
28
+ t > 0 && t !== 27 && (r.rowHeight = t);
29
+ }
30
+ e.style && e.style !== "SlicerStyleLight1" && (r.style = e.style);
31
+ let i = e.sortOrder ? Ye[e.sortOrder] : void 0;
32
+ return i && i !== "ascending" && (r.sortOrder = i), e.crossFilter && e.crossFilter !== "showItemsWithDataAtTop" && (r.crossFilter = e.crossFilter), e.lockedPosition && (r.lockedPosition = !0), !1 === e.customListSort && (r.disabledCustomListSort = !0), e.cacheName && (r.cacheName = e.cacheName), e.startItem && (r.startItem = e.startItem), e.level !== void 0 && (r.level = e.level), e.uid && (r.uid = e.uid), r;
33
+ }
34
+ var Qe = /* @__PURE__ */ new Uint8Array(), $e = class e {
35
+ constructor(e, t, n) {
36
+ this.buffers = /* @__PURE__ */ new Map(), this.zip = e, this.entries = t, this.rawBuffer = n;
37
+ }
38
+ static normalize(e) {
39
+ return e.startsWith("/") ? e.slice(1) : e;
40
+ }
41
+ static async create(t) {
42
+ let n = t instanceof Blob ? Qe : t instanceof Uint8Array ? t : new Uint8Array(t), r = t instanceof Blob ? new s(t) : new d(n), i = new ne(r), a = /* @__PURE__ */ new Map();
43
+ for (let e of await i.getEntries()) e.directory || a.set(e.filename, e);
44
+ return new e(i, a, n);
45
+ }
46
+ getNames() {
47
+ return [...this.entries.keys()];
48
+ }
49
+ has(t) {
50
+ return this.entries.has(e.normalize(t));
51
+ }
52
+ uncompressedSize(t) {
53
+ return this.entries.get(e.normalize(t))?.uncompressedSize ?? 0;
54
+ }
55
+ async getBuffer(t) {
56
+ let n = e.normalize(t), r = this.buffers.get(n);
57
+ if (r) return r;
58
+ let i = this.entries.get(n);
59
+ if (!i) return null;
60
+ let a = await i.getData(new oe());
61
+ return this.buffers.set(n, a), a;
62
+ }
63
+ async prefetch(e) {
64
+ let t = [];
65
+ for (let [n, r] of this.entries) !this.buffers.has(n) && e(n, r) && t.push(r.getData(new oe()).then((e) => {
66
+ this.buffers.set(n, e);
67
+ }));
68
+ await Promise.all(t);
69
+ }
70
+ getEntry(t) {
71
+ return this.buffers.get(e.normalize(t)) ?? null;
72
+ }
73
+ async getTextStream(t, n) {
74
+ let r = this.entries.get(e.normalize(t));
75
+ if (!r) return null;
76
+ let i = new TransformStream();
77
+ r.getData(i.writable).catch(() => {});
78
+ let a = i.readable.getReader(), o = new TextDecoder("utf-8");
79
+ return new ReadableStream({ async pull(e) {
80
+ let { value: t, done: r } = await a.read();
81
+ if (r) {
82
+ let t = o.decode();
83
+ t && e.enqueue(t), e.close();
84
+ return;
85
+ }
86
+ n?.(t.byteLength);
87
+ let i = o.decode(t, { stream: !0 });
88
+ i && e.enqueue(i);
89
+ } }).getReader();
90
+ }
91
+ getRawEntry(t) {
92
+ let n = this.entries.get(e.normalize(t));
93
+ if (!n || n.encrypted || n.crc32 === void 0) return null;
94
+ let r = n.offset;
95
+ if (r + 30 > this.rawBuffer.byteLength) return null;
96
+ let i = new DataView(this.rawBuffer.buffer, this.rawBuffer.byteOffset + r, 30);
97
+ if (i.getUint32(0, !0) !== 67324752) return null;
98
+ let a = r + 30 + i.getUint16(26, !0) + i.getUint16(28, !0), o = a + n.compressedSize;
99
+ return o > this.rawBuffer.byteLength ? null : {
100
+ data: this.rawBuffer.subarray(a, o),
101
+ compressionMethod: n.compressionMethod,
102
+ signature: n.crc32
103
+ };
104
+ }
105
+ async close() {
106
+ await this.zip.close();
107
+ }
108
+ }, et = class {
109
+ constructor(e) {
110
+ this._sink = e, this._samples = [], this._t0 = tt(), this._tPrev = this._t0, this._heapPrev = nt();
111
+ }
112
+ mark(e) {
113
+ let t = tt(), n = nt(), r = {
114
+ label: e,
115
+ tMs: t - this._t0,
116
+ dtMs: t - this._tPrev,
117
+ heapBytes: n,
118
+ dHeapBytes: n !== void 0 && this._heapPrev !== void 0 ? n - this._heapPrev : void 0,
119
+ rssBytes: rt()
120
+ };
121
+ this._tPrev = t, this._heapPrev = n, this._samples.push(r), this._sink?.(r);
122
+ }
123
+ samples() {
124
+ return this._samples;
125
+ }
126
+ toTable() {
127
+ return this._samples.map((e) => ({
128
+ phase: e.label,
129
+ tMs: Math.round(e.tMs),
130
+ dtMs: Math.round(e.dtMs),
131
+ heapMB: e.heapBytes === void 0 ? "—" : it(e.heapBytes / 1048576),
132
+ dHeapMB: e.dHeapBytes === void 0 ? "—" : it(e.dHeapBytes / 1048576),
133
+ rssMB: e.rssBytes === void 0 ? "—" : it(e.rssBytes / 1048576)
134
+ }));
135
+ }
136
+ }, tt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now();
137
+ function nt() {
138
+ let e = typeof performance == "object" ? performance.memory : void 0;
139
+ if (e && typeof e.usedJSHeapSize == "number") return e.usedJSHeapSize;
140
+ let t = globalThis.process;
141
+ return typeof t == "object" && typeof t.memoryUsage == "function" ? t.memoryUsage().heapUsed : void 0;
142
+ }
143
+ function rt() {
144
+ let e = globalThis.process;
145
+ if (typeof e == "object" && typeof e.memoryUsage == "function") return e.memoryUsage().rss;
146
+ }
147
+ function it(e) {
148
+ return Math.round(10 * e) / 10;
149
+ }
150
+ var at = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", ot = `-${at}.0-9·̀-ͯ‿-⁀`, st = (RegExp(`^[${at}]$`, "u"), RegExp(`^[${ot}]$`, "u"), RegExp(`^[${at}][${ot}]*$`, "u")), ct = (RegExp(`^[${ot}]+$`, "u"), [
151
+ 32,
152
+ 10,
153
+ 13,
154
+ 9
155
+ ]);
156
+ function lt(e) {
157
+ return e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 58 || e === 95 || e === 8204 || e === 8205 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 767 || e >= 880 && e <= 893 || e >= 895 && e <= 8191 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
158
+ }
159
+ var ut = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", dt = `-${ut}.0-9·̀-ͯ‿-⁀`;
160
+ RegExp(`^[${ut}]$`, "u"), RegExp(`^[${dt}]$`, "u"), RegExp(`^[${ut}][${dt}]*$`, "u"), RegExp(`^[${dt}]+$`, "u");
161
+ var ft = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", pt = `-${ft}.0-9·̀-ͯ‿-⁀`, mt = (RegExp(`^[${ft}]$`, "u"), RegExp(`^[${pt}]$`, "u"), RegExp(`^[${ft}][${pt}]*$`, "u"));
162
+ function G(e) {
163
+ return e >= 65 && e <= 90 || e === 95 || e >= 97 && e <= 122 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 767 || e >= 880 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
164
+ }
165
+ var K = function(e) {
166
+ return e === 32 || e === 10 || e === 13 || e === 9;
167
+ }, ht = function(e) {
168
+ return e >= 32 && e <= 55295 || e === 10 || e === 13 || e === 9 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
169
+ }, gt = lt, _t = function(e) {
170
+ return lt(e) || e >= 48 && e <= 57 || e === 45 || e === 46 || e === 183 || e >= 768 && e <= 879 || e >= 8255 && e <= 8256;
171
+ }, vt = ct, yt = st, bt = function(e) {
172
+ return e >= 1 && e <= 55295 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
173
+ }, xt = G, St = function(e) {
174
+ return G(e) || e === 45 || e === 46 || e >= 48 && e <= 57 || e === 183 || e >= 768 && e <= 879 || e >= 8255 && e <= 8256;
175
+ }, Ct = mt, wt = "http://www.w3.org/XML/1998/namespace", Tt = "http://www.w3.org/2000/xmlns/", Et = {
176
+ __proto__: null,
177
+ xml: wt,
178
+ xmlns: Tt
179
+ }, Dt = {
180
+ __proto__: null,
181
+ amp: "&",
182
+ gt: ">",
183
+ lt: "<",
184
+ quot: "\"",
185
+ apos: "'"
186
+ }, q = -1, Ot = -2, J = 13, kt = 33, At = 10, jt = 60, Mt = 61, Y = 62, X = 63, Nt = 93, Pt = (e) => e === 34 || e === 39, Ft = [34, 39], It = [
187
+ ...Ft,
188
+ 91,
189
+ Y
190
+ ], Lt = [
191
+ ...Ft,
192
+ jt,
193
+ Nt
194
+ ], Rt = [
195
+ Mt,
196
+ X,
197
+ ...vt
198
+ ], zt = [
199
+ ...vt,
200
+ Y,
201
+ 38,
202
+ jt
203
+ ];
204
+ function Bt(e, t, n) {
205
+ switch (t) {
206
+ case "xml":
207
+ n !== wt && e.fail(`xml prefix must be bound to ${wt}.`);
208
+ break;
209
+ case "xmlns": n !== Tt && e.fail(`xmlns prefix must be bound to ${Tt}.`);
210
+ }
211
+ switch (n) {
212
+ case Tt:
213
+ e.fail(t === "" ? `the default namespace may not be set to ${n}.` : `may not assign a prefix (even "xmlns") to the URI ${Tt}.`);
214
+ break;
215
+ case wt: switch (t) {
216
+ case "xml": break;
217
+ case "":
218
+ e.fail(`the default namespace may not be set to ${n}.`);
219
+ break;
220
+ default: e.fail("may not assign the xml namespace to another prefix.");
221
+ }
222
+ }
223
+ }
224
+ var Vt, Ht = (e) => Ct.test(e), Ut = (e) => yt.test(e), Wt = {
225
+ xmldecl: "xmlDeclHandler",
226
+ text: "textHandler",
227
+ processinginstruction: "piHandler",
228
+ doctype: "doctypeHandler",
229
+ comment: "commentHandler",
230
+ opentagstart: "openTagStartHandler",
231
+ attribute: "attributeHandler",
232
+ opentag: "openTagHandler",
233
+ closetag: "closeTagHandler",
234
+ cdata: "cdataHandler",
235
+ error: "errorHandler",
236
+ end: "endHandler",
237
+ ready: "readyHandler"
238
+ }, Gt = class {
239
+ get closed() {
240
+ return this._closed;
241
+ }
242
+ constructor(e) {
243
+ this.i = 0, this.prevI = 0, this.opt = e ?? {}, this.fragmentOpt = !!this.opt.fragment;
244
+ let t = this.xmlnsOpt = !!this.opt.xmlns;
245
+ if (this.trackPosition = !1 !== this.opt.position, this.fileName = this.opt.fileName, t) {
246
+ this.nameStartCheck = xt, this.nameCheck = St, this.isName = Ht, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = {
247
+ __proto__: null,
248
+ ...Et
249
+ };
250
+ let e = this.opt.additionalNamespaces;
251
+ e != null && (function(e, t) {
252
+ for (let n of Object.keys(t)) Bt(e, n, t[n]);
253
+ }(this, e), Object.assign(this.ns, e));
254
+ } else this.nameStartCheck = gt, this.nameCheck = _t, this.isName = Ut, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
255
+ this.stateTable = [
256
+ this.sBegin,
257
+ this.sBeginWhitespace,
258
+ this.sDoctype,
259
+ this.sDoctypeQuote,
260
+ this.sDTD,
261
+ this.sDTDQuoted,
262
+ this.sDTDOpenWaka,
263
+ this.sDTDOpenWakaBang,
264
+ this.sDTDComment,
265
+ this.sDTDCommentEnding,
266
+ this.sDTDCommentEnded,
267
+ this.sDTDPI,
268
+ this.sDTDPIEnding,
269
+ this.sText,
270
+ this.sEntity,
271
+ this.sOpenWaka,
272
+ this.sOpenWakaBang,
273
+ this.sComment,
274
+ this.sCommentEnding,
275
+ this.sCommentEnded,
276
+ this.sCData,
277
+ this.sCDataEnding,
278
+ this.sCDataEnding2,
279
+ this.sPIFirstChar,
280
+ this.sPIRest,
281
+ this.sPIBody,
282
+ this.sPIEnding,
283
+ this.sXMLDeclNameStart,
284
+ this.sXMLDeclName,
285
+ this.sXMLDeclEq,
286
+ this.sXMLDeclValueStart,
287
+ this.sXMLDeclValue,
288
+ this.sXMLDeclSeparator,
289
+ this.sXMLDeclEnding,
290
+ this.sOpenTag,
291
+ this.sOpenTagSlash,
292
+ this.sAttrib,
293
+ this.sAttribName,
294
+ this.sAttribNameSawWhite,
295
+ this.sAttribValue,
296
+ this.sAttribValueQuoted,
297
+ this.sAttribValueClosed,
298
+ this.sAttribValueUnquoted,
299
+ this.sCloseTag,
300
+ this.sCloseTagSawWhite
301
+ ], this._init();
302
+ }
303
+ _init() {
304
+ this.openWakaBang = "", this.text = "", this.name = "", this.piTarget = "", this.entity = "", this.q = null, this.tags = [], this.tag = null, this.topNS = null, this.chunk = "", this.chunkPosition = 0, this.i = 0, this.prevI = 0, this.carriedFromPrevious = void 0, this.forbiddenState = 0, this.attribList = [];
305
+ let { fragmentOpt: e } = this;
306
+ this.state = e ? J : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = e, this.xmlDeclPossible = !e, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
307
+ let { defaultXMLVersion: t } = this.opt;
308
+ if (t === void 0) {
309
+ if (!0 === this.opt.forceXMLVersion) throw Error("forceXMLVersion set but defaultXMLVersion is not set");
310
+ t = "1.0";
311
+ }
312
+ this.setXMLVersion(t), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = {
313
+ version: void 0,
314
+ encoding: void 0,
315
+ standalone: void 0
316
+ }, this.line = 1, this.column = 0, this.ENTITIES = Object.create(Dt), this.readyHandler?.();
317
+ }
318
+ get position() {
319
+ return this.chunkPosition + this.i;
320
+ }
321
+ get columnIndex() {
322
+ return this.position - this.positionAtNewLine;
323
+ }
324
+ on(e, t) {
325
+ this[Wt[e]] = t;
326
+ }
327
+ off(e) {
328
+ this[Wt[e]] = void 0;
329
+ }
330
+ makeError(e) {
331
+ let t = this.fileName ?? "";
332
+ return this.trackPosition && (t.length > 0 && (t += ":"), t += `${this.line}:${this.column}`), t.length > 0 && (t += ": "), Error(t + e);
333
+ }
334
+ fail(e) {
335
+ let t = this.makeError(e), n = this.errorHandler;
336
+ if (n === void 0) throw t;
337
+ return n(t), this;
338
+ }
339
+ write(e) {
340
+ if (this.closed) return this.fail("cannot write after close.");
341
+ let t = !1;
342
+ e === null ? (t = !0, e = "") : typeof e == "object" && (e = e.toString()), this.carriedFromPrevious !== void 0 && (e = `${this.carriedFromPrevious}${e}`, this.carriedFromPrevious = void 0);
343
+ let n = e.length, r = e.charCodeAt(n - 1);
344
+ !t && (r === 13 || r >= 55296 && r <= 56319) && (this.carriedFromPrevious = e[n - 1], n--, e = e.slice(0, n));
345
+ let { stateTable: i } = this;
346
+ for (this.chunk = e, this.i = 0; this.i < n;) i[this.state].call(this);
347
+ return this.chunkPosition += n, t ? this.end() : this;
348
+ }
349
+ close() {
350
+ return this.write(null);
351
+ }
352
+ getCode10() {
353
+ let e = this.chunk, t = this.i;
354
+ if (this.prevI = t, this.i++, t >= e.length) return q;
355
+ let n = e.charCodeAt(t);
356
+ if (this.column++, n < 55296) {
357
+ if (n >= 32 || n === 9) return n;
358
+ switch (n) {
359
+ case At: return this.line++, this.column = 0, this.positionAtNewLine = this.position, At;
360
+ case 13: return e.charCodeAt(t + 1) === At && (this.i = t + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, Ot;
361
+ default: return this.fail("disallowed character."), n;
362
+ }
363
+ }
364
+ if (n > 56319) return n >= 57344 && n <= 65533 || this.fail("disallowed character."), n;
365
+ let r = 65536 + 1024 * (n - 55296) + (e.charCodeAt(t + 1) - 56320);
366
+ return this.i = t + 2, r > 1114111 && this.fail("disallowed character."), r;
367
+ }
368
+ getCode11() {
369
+ let { chunk: e, i: t } = this;
370
+ if (this.prevI = t, this.i = t + 1, t >= e.length) return q;
371
+ let n = e.charCodeAt(t);
372
+ if (this.column++, n < 55296) {
373
+ if (n > 31 && n < 127 || n > 159 && n !== 8232 || n === 9) return n;
374
+ switch (n) {
375
+ case At: return this.line++, this.column = 0, this.positionAtNewLine = this.position, At;
376
+ case 13: {
377
+ let n = e.charCodeAt(t + 1);
378
+ n !== At && n !== 133 || (this.i = t + 2);
379
+ }
380
+ case 133:
381
+ case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Ot;
382
+ default: return this.fail("disallowed character."), n;
383
+ }
384
+ }
385
+ if (n > 56319) return n >= 57344 && n <= 65533 || this.fail("disallowed character."), n;
386
+ let r = 65536 + 1024 * (n - 55296) + (e.charCodeAt(t + 1) - 56320);
387
+ return this.i = t + 2, r > 1114111 && this.fail("disallowed character."), r;
388
+ }
389
+ getCodeNorm() {
390
+ let e = this.getCode();
391
+ return e === Ot ? At : e;
392
+ }
393
+ unGet() {
394
+ this.i = this.prevI, this.column--;
395
+ }
396
+ captureTo(e) {
397
+ let { i: t } = this, { chunk: n } = this;
398
+ for (;;) {
399
+ let r = this.getCode(), i = r === Ot, a = i ? At : r;
400
+ if (a === q || e.includes(a)) return this.text += n.slice(t, this.prevI), a;
401
+ i && (this.text += `${n.slice(t, this.prevI)}\n`, t = this.i);
402
+ }
403
+ }
404
+ captureToChar(e) {
405
+ let { i: t } = this, { chunk: n } = this;
406
+ for (;;) {
407
+ let r = this.getCode();
408
+ switch (r) {
409
+ case Ot:
410
+ this.text += `${n.slice(t, this.prevI)}\n`, t = this.i, r = At;
411
+ break;
412
+ case q: return this.text += n.slice(t), !1;
413
+ }
414
+ if (r === e) return this.text += n.slice(t, this.prevI), !0;
415
+ }
416
+ }
417
+ captureNameChars() {
418
+ let { chunk: e, i: t } = this;
419
+ for (;;) {
420
+ let n = this.getCode();
421
+ if (n === q) return this.name += e.slice(t), q;
422
+ if (!_t(n)) return this.name += e.slice(t, this.prevI), n === Ot ? At : n;
423
+ }
424
+ }
425
+ skipSpaces() {
426
+ for (;;) {
427
+ let e = this.getCodeNorm();
428
+ if (e === q || !K(e)) return e;
429
+ }
430
+ }
431
+ setXMLVersion(e) {
432
+ this.currentXMLVersion = e, e === "1.0" ? (this.isChar = ht, this.getCode = this.getCode10) : (this.isChar = bt, this.getCode = this.getCode11);
433
+ }
434
+ sBegin() {
435
+ this.chunk.charCodeAt(0) === 65279 && (this.i++, this.column++), this.state = 1;
436
+ }
437
+ sBeginWhitespace() {
438
+ let e = this.i, t = this.skipSpaces();
439
+ switch (this.prevI !== e && (this.xmlDeclPossible = !1), t) {
440
+ case jt:
441
+ if (this.state = 15, this.text.length !== 0) throw Error("no-empty text at start");
442
+ break;
443
+ case q: break;
444
+ default: this.unGet(), this.state = J, this.xmlDeclPossible = !1;
445
+ }
446
+ }
447
+ sDoctype() {
448
+ let e = this.captureTo(It);
449
+ switch (e) {
450
+ case Y:
451
+ this.doctypeHandler?.(this.text), this.text = "", this.state = J, this.doctype = !0;
452
+ break;
453
+ case q: break;
454
+ default: this.text += String.fromCodePoint(e), e === 91 ? this.state = 4 : Pt(e) && (this.state = 3, this.q = e);
455
+ }
456
+ }
457
+ sDoctypeQuote() {
458
+ let e = this.q;
459
+ this.captureToChar(e) && (this.text += String.fromCodePoint(e), this.q = null, this.state = 2);
460
+ }
461
+ sDTD() {
462
+ let e = this.captureTo(Lt);
463
+ e !== q && (this.text += String.fromCodePoint(e), e === Nt ? this.state = 2 : e === jt ? this.state = 6 : Pt(e) && (this.state = 5, this.q = e));
464
+ }
465
+ sDTDQuoted() {
466
+ let e = this.q;
467
+ this.captureToChar(e) && (this.text += String.fromCodePoint(e), this.state = 4, this.q = null);
468
+ }
469
+ sDTDOpenWaka() {
470
+ let e = this.getCodeNorm();
471
+ switch (this.text += String.fromCodePoint(e), e) {
472
+ case 33:
473
+ this.state = 7, this.openWakaBang = "";
474
+ break;
475
+ case X:
476
+ this.state = 11;
477
+ break;
478
+ default: this.state = 4;
479
+ }
480
+ }
481
+ sDTDOpenWakaBang() {
482
+ let e = String.fromCodePoint(this.getCodeNorm()), t = this.openWakaBang += e;
483
+ this.text += e, t !== "-" && (this.state = t === "--" ? 8 : 4, this.openWakaBang = "");
484
+ }
485
+ sDTDComment() {
486
+ this.captureToChar(45) && (this.text += "-", this.state = 9);
487
+ }
488
+ sDTDCommentEnding() {
489
+ let e = this.getCodeNorm();
490
+ this.text += String.fromCodePoint(e), this.state = e === 45 ? 10 : 8;
491
+ }
492
+ sDTDCommentEnded() {
493
+ let e = this.getCodeNorm();
494
+ this.text += String.fromCodePoint(e), e === Y ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
495
+ }
496
+ sDTDPI() {
497
+ this.captureToChar(X) && (this.text += "?", this.state = 12);
498
+ }
499
+ sDTDPIEnding() {
500
+ let e = this.getCodeNorm();
501
+ this.text += String.fromCodePoint(e), e === Y && (this.state = 4);
502
+ }
503
+ sText() {
504
+ this.tags.length === 0 ? this.handleTextOutsideRoot() : this.handleTextInRoot();
505
+ }
506
+ sEntity() {
507
+ let { i: e } = this, { chunk: t } = this;
508
+ t: for (;;) switch (this.getCode()) {
509
+ case Ot:
510
+ this.entity += `${t.slice(e, this.prevI)}\n`, e = this.i;
511
+ break;
512
+ case 59: {
513
+ let { entityReturnState: n } = this, r = this.entity + t.slice(e, this.prevI), i;
514
+ this.state = n, r === "" ? (this.fail("empty entity name."), i = "&;") : (i = this.parseEntity(r), this.entity = ""), n === J && this.textHandler === void 0 || (this.text += i);
515
+ break t;
516
+ }
517
+ case q:
518
+ this.entity += t.slice(e);
519
+ break t;
520
+ }
521
+ }
522
+ sOpenWaka() {
523
+ let e = this.getCode();
524
+ if (gt(e)) this.state = 34, this.unGet(), this.xmlDeclPossible = !1;
525
+ else switch (e) {
526
+ case 47:
527
+ this.state = 43, this.xmlDeclPossible = !1;
528
+ break;
529
+ case 33:
530
+ this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
531
+ break;
532
+ case X:
533
+ this.state = 23;
534
+ break;
535
+ default: this.fail("disallowed character in tag name"), this.state = J, this.xmlDeclPossible = !1;
536
+ }
537
+ }
538
+ sOpenWakaBang() {
539
+ switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
540
+ case "[CDATA[":
541
+ this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0), this.state = 20, this.openWakaBang = "";
542
+ break;
543
+ case "--":
544
+ this.state = 17, this.openWakaBang = "";
545
+ break;
546
+ case "DOCTYPE":
547
+ this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
548
+ break;
549
+ default: this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
550
+ }
551
+ }
552
+ sComment() {
553
+ this.captureToChar(45) && (this.state = 18);
554
+ }
555
+ sCommentEnding() {
556
+ let e = this.getCodeNorm();
557
+ e === 45 ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(e)}`, this.state = 17);
558
+ }
559
+ sCommentEnded() {
560
+ let e = this.getCodeNorm();
561
+ e === Y ? this.state = J : (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(e)}`, this.state = 17);
562
+ }
563
+ sCData() {
564
+ this.captureToChar(Nt) && (this.state = 21);
565
+ }
566
+ sCDataEnding() {
567
+ let e = this.getCodeNorm();
568
+ e === Nt ? this.state = 22 : (this.text += `]${String.fromCodePoint(e)}`, this.state = 20);
569
+ }
570
+ sCDataEnding2() {
571
+ let e = this.getCodeNorm();
572
+ switch (e) {
573
+ case Y:
574
+ this.cdataHandler?.(this.text), this.text = "", this.state = J;
575
+ break;
576
+ case Nt:
577
+ this.text += "]";
578
+ break;
579
+ default: this.text += `]]${String.fromCodePoint(e)}`, this.state = 20;
580
+ }
581
+ }
582
+ sPIFirstChar() {
583
+ let e = this.getCodeNorm();
584
+ this.nameStartCheck(e) ? (this.piTarget += String.fromCodePoint(e), this.state = 24) : e === X || K(e) ? (this.fail("processing instruction without a target."), this.state = e === X ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(e), this.state = 24);
585
+ }
586
+ sPIRest() {
587
+ let { chunk: e, i: t } = this;
588
+ for (;;) {
589
+ let n = this.getCodeNorm();
590
+ if (n === q) return void (this.piTarget += e.slice(t));
591
+ if (!this.nameCheck(n)) {
592
+ this.piTarget += e.slice(t, this.prevI);
593
+ let r = n === X;
594
+ r || K(n) ? this.piTarget === "xml" ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = r ? kt : 27) : this.state = r ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(n));
595
+ break;
596
+ }
597
+ }
598
+ }
599
+ sPIBody() {
600
+ if (this.text.length === 0) {
601
+ let e = this.getCodeNorm();
602
+ e === X ? this.state = 26 : K(e) || (this.text = String.fromCodePoint(e));
603
+ } else this.captureToChar(X) && (this.state = 26);
604
+ }
605
+ sPIEnding() {
606
+ let e = this.getCodeNorm();
607
+ if (e === Y) {
608
+ let { piTarget: e } = this;
609
+ e.toLowerCase() === "xml" && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({
610
+ target: e,
611
+ body: this.text
612
+ }), this.piTarget = this.text = "", this.state = J;
613
+ } else e === X ? this.text += "?" : (this.text += `?${String.fromCodePoint(e)}`, this.state = 25);
614
+ this.xmlDeclPossible = !1;
615
+ }
616
+ sXMLDeclNameStart() {
617
+ let e = this.skipSpaces();
618
+ e === X ? this.state = kt : e !== q && (this.state = 28, this.name = String.fromCodePoint(e));
619
+ }
620
+ sXMLDeclName() {
621
+ let e = this.captureTo(Rt);
622
+ if (e === X) return this.state = kt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
623
+ if (K(e) || e === Mt) {
624
+ if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
625
+ case 0:
626
+ this.fail("did not expect any more name/value pairs.");
627
+ break;
628
+ case 1:
629
+ this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
630
+ break;
631
+ default: this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
632
+ }
633
+ this.state = e === Mt ? 30 : 29;
634
+ }
635
+ }
636
+ sXMLDeclEq() {
637
+ let e = this.getCodeNorm();
638
+ if (e === X) return this.state = kt, void this.fail("XML declaration is incomplete.");
639
+ K(e) || (e !== Mt && this.fail("value required."), this.state = 30);
640
+ }
641
+ sXMLDeclValueStart() {
642
+ let e = this.getCodeNorm();
643
+ if (e === X) return this.state = kt, void this.fail("XML declaration is incomplete.");
644
+ K(e) || (Pt(e) ? this.q = e : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
645
+ }
646
+ sXMLDeclValue() {
647
+ let e = this.captureTo([this.q, X]);
648
+ if (e === X) return this.state = kt, this.text = "", void this.fail("XML declaration is incomplete.");
649
+ if (e === q) return;
650
+ let t = this.text;
651
+ switch (this.text = "", this.name) {
652
+ case "version": {
653
+ this.xmlDeclExpects = ["encoding", "standalone"];
654
+ let e = t;
655
+ this.xmlDecl.version = e, /^1\.[0-9]+$/.test(e) ? this.opt.forceXMLVersion || this.setXMLVersion(e) : this.fail("version number must match /^1\\.[0-9]+$/.");
656
+ break;
657
+ }
658
+ case "encoding":
659
+ /^[A-Za-z][A-Za-z0-9._-]*$/.test(t) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = t;
660
+ break;
661
+ case "standalone": t !== "yes" && t !== "no" && this.fail("standalone value must match \"yes\" or \"no\"."), this.xmlDeclExpects = [], this.xmlDecl.standalone = t;
662
+ }
663
+ this.name = "", this.state = 32;
664
+ }
665
+ sXMLDeclSeparator() {
666
+ let e = this.getCodeNorm();
667
+ e === X ? this.state = kt : (K(e) || (this.fail("whitespace required."), this.unGet()), this.state = 27);
668
+ }
669
+ sXMLDeclEnding() {
670
+ this.getCodeNorm() === Y ? (this.piTarget === "xml" ? this.name !== "version" && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version.") : this.fail("processing instructions are not allowed before root."), this.xmlDeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = J) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
671
+ }
672
+ sOpenTag() {
673
+ let e = this.captureNameChars();
674
+ if (e === q) return;
675
+ let t = this.tag = {
676
+ name: this.name,
677
+ attributes: Object.create(null)
678
+ };
679
+ switch (this.name = "", this.xmlnsOpt && (this.topNS = t.ns = Object.create(null)), this.openTagStartHandler?.(t), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), e) {
680
+ case Y:
681
+ this.openTag();
682
+ break;
683
+ case 47:
684
+ this.state = 35;
685
+ break;
686
+ default: K(e) || this.fail("disallowed character in tag name."), this.state = 36;
687
+ }
688
+ }
689
+ sOpenTagSlash() {
690
+ this.getCode() === Y ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
691
+ }
692
+ sAttrib() {
693
+ let e = this.skipSpaces();
694
+ e !== q && (gt(e) ? (this.unGet(), this.state = 37) : e === Y ? this.openTag() : e === 47 ? this.state = 35 : this.fail("disallowed character in attribute name."));
695
+ }
696
+ sAttribName() {
697
+ let e = this.captureNameChars();
698
+ e === Mt ? this.state = 39 : K(e) ? this.state = 38 : e === Y ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : e !== q && this.fail("disallowed character in attribute name.");
699
+ }
700
+ sAttribNameSawWhite() {
701
+ let e = this.skipSpaces();
702
+ switch (e) {
703
+ case q: return;
704
+ case Mt:
705
+ this.state = 39;
706
+ break;
707
+ default: this.fail("attribute without value."), this.text = "", this.name = "", e === Y ? this.openTag() : gt(e) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
708
+ }
709
+ }
710
+ sAttribValue() {
711
+ let e = this.getCodeNorm();
712
+ Pt(e) ? (this.q = e, this.state = 40) : K(e) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet());
713
+ }
714
+ sAttribValueQuoted() {
715
+ let { q: e, chunk: t } = this, { i: n } = this;
716
+ for (;;) switch (this.getCode()) {
717
+ case e:
718
+ this.pushAttrib(this.name, this.text + t.slice(n, this.prevI)), this.name = this.text = "", this.q = null, this.state = 41;
719
+ return;
720
+ case 38:
721
+ this.text += t.slice(n, this.prevI), this.state = 14, this.entityReturnState = 40;
722
+ return;
723
+ case At:
724
+ case Ot:
725
+ case 9:
726
+ this.text += `${t.slice(n, this.prevI)} `, n = this.i;
727
+ break;
728
+ case jt:
729
+ this.text += t.slice(n, this.prevI), this.fail("disallowed character.");
730
+ return;
731
+ case q:
732
+ this.text += t.slice(n);
733
+ return;
734
+ }
735
+ }
736
+ sAttribValueClosed() {
737
+ let e = this.getCodeNorm();
738
+ K(e) ? this.state = 36 : e === Y ? this.openTag() : e === 47 ? this.state = 35 : gt(e) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name.");
739
+ }
740
+ sAttribValueUnquoted() {
741
+ let e = this.captureTo(zt);
742
+ switch (e) {
743
+ case 38:
744
+ this.state = 14, this.entityReturnState = 42;
745
+ break;
746
+ case jt:
747
+ this.fail("disallowed character.");
748
+ break;
749
+ case q: break;
750
+ default: this.text.includes("]]>") && this.fail("the string \"]]>\" is disallowed in char data."), this.pushAttrib(this.name, this.text), this.name = this.text = "", e === Y ? this.openTag() : this.state = 36;
751
+ }
752
+ }
753
+ sCloseTag() {
754
+ let e = this.captureNameChars();
755
+ e === Y ? this.closeTag() : K(e) ? this.state = 44 : e !== q && this.fail("disallowed character in closing tag.");
756
+ }
757
+ sCloseTagSawWhite() {
758
+ switch (this.skipSpaces()) {
759
+ case Y:
760
+ this.closeTag();
761
+ break;
762
+ case q: break;
763
+ default: this.fail("disallowed character in closing tag.");
764
+ }
765
+ }
766
+ handleTextInRoot() {
767
+ let { i: e, forbiddenState: t } = this, { chunk: n, textHandler: r } = this;
768
+ t: for (;;) switch (this.getCode()) {
769
+ case jt:
770
+ if (this.state = 15, r !== void 0) {
771
+ let { text: t } = this, i = n.slice(e, this.prevI);
772
+ t.length === 0 ? i.length !== 0 && r(i) : (r(t + i), this.text = "");
773
+ }
774
+ t = 0;
775
+ break t;
776
+ case 38:
777
+ this.state = 14, this.entityReturnState = J, r !== void 0 && (this.text += n.slice(e, this.prevI)), t = 0;
778
+ break t;
779
+ case Nt:
780
+ switch (t) {
781
+ case 0:
782
+ t = 1;
783
+ break;
784
+ case 1:
785
+ t = 2;
786
+ break;
787
+ case 2: break;
788
+ default: throw Error("impossible state");
789
+ }
790
+ break;
791
+ case Y:
792
+ t === 2 && this.fail("the string \"]]>\" is disallowed in char data."), t = 0;
793
+ break;
794
+ case Ot:
795
+ r !== void 0 && (this.text += `${n.slice(e, this.prevI)}\n`), e = this.i, t = 0;
796
+ break;
797
+ case q:
798
+ r !== void 0 && (this.text += n.slice(e));
799
+ break t;
800
+ default: t = 0;
801
+ }
802
+ this.forbiddenState = t;
803
+ }
804
+ handleTextOutsideRoot() {
805
+ let { i: e } = this, { chunk: t, textHandler: n } = this, r = !1;
806
+ t: for (;;) {
807
+ let i = this.getCode();
808
+ switch (i) {
809
+ case jt:
810
+ if (this.state = 15, n !== void 0) {
811
+ let { text: r } = this, i = t.slice(e, this.prevI);
812
+ r.length === 0 ? i.length !== 0 && n(i) : (n(r + i), this.text = "");
813
+ }
814
+ break t;
815
+ case 38:
816
+ this.state = 14, this.entityReturnState = J, n !== void 0 && (this.text += t.slice(e, this.prevI)), r = !0;
817
+ break t;
818
+ case Ot:
819
+ n !== void 0 && (this.text += `${t.slice(e, this.prevI)}\n`), e = this.i;
820
+ break;
821
+ case q:
822
+ n !== void 0 && (this.text += t.slice(e));
823
+ break t;
824
+ default: K(i) || (r = !0);
825
+ }
826
+ }
827
+ r && (this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0));
828
+ }
829
+ pushAttribNS(e, t) {
830
+ let { prefix: n, local: r } = this.qName(e), i = {
831
+ name: e,
832
+ prefix: n,
833
+ local: r,
834
+ value: t
835
+ };
836
+ if (this.attribList.push(i), this.attributeHandler?.(i), n === "xmlns") {
837
+ let e = t.trim();
838
+ this.currentXMLVersion === "1.0" && e === "" && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[r] = e, Bt(this, r, e);
839
+ } else if (e === "xmlns") {
840
+ let e = t.trim();
841
+ this.topNS[""] = e, Bt(this, "", e);
842
+ }
843
+ }
844
+ pushAttribPlain(e, t) {
845
+ let n = {
846
+ name: e,
847
+ value: t
848
+ };
849
+ this.attribList.push(n), this.attributeHandler?.(n);
850
+ }
851
+ end() {
852
+ this.sawRoot || this.fail("document must contain a root element.");
853
+ let { tags: e } = this;
854
+ for (; e.length > 0;) {
855
+ let t = e.pop();
856
+ this.fail(`unclosed tag: ${t.name}`);
857
+ }
858
+ this.state !== 0 && this.state !== J && this.fail("unexpected end.");
859
+ let { text: t } = this;
860
+ return t.length !== 0 && (this.textHandler?.(t), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
861
+ }
862
+ resolve(e) {
863
+ let t = this.topNS[e];
864
+ if (t !== void 0) return t;
865
+ let { tags: n } = this;
866
+ for (let r = n.length - 1; r >= 0; r--) if (t = n[r].ns[e], t !== void 0) return t;
867
+ return t = this.ns[e], t === void 0 ? this.opt.resolvePrefix?.(e) : t;
868
+ }
869
+ qName(e) {
870
+ let t = e.indexOf(":");
871
+ if (t === -1) return {
872
+ prefix: "",
873
+ local: e
874
+ };
875
+ let n = e.slice(t + 1), r = e.slice(0, t);
876
+ return (r === "" || n === "" || n.includes(":")) && this.fail(`malformed name: ${e}.`), {
877
+ prefix: r,
878
+ local: n
879
+ };
880
+ }
881
+ processAttribsNS() {
882
+ let { attribList: e } = this, t = this.tag;
883
+ {
884
+ let { prefix: e, local: n } = this.qName(t.name);
885
+ t.prefix = e, t.local = n;
886
+ let r = t.uri = this.resolve(e) ?? "";
887
+ e !== "" && (e === "xmlns" && this.fail("tags may not have \"xmlns\" as prefix."), r === "" && (this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`), t.uri = e));
888
+ }
889
+ if (e.length === 0) return;
890
+ let { attributes: n } = t, r = /* @__PURE__ */ new Set();
891
+ for (let t of e) {
892
+ let { name: e, prefix: i, local: a } = t, o, s;
893
+ i === "" ? (o = e === "xmlns" ? Tt : "", s = e) : (o = this.resolve(i), o === void 0 && (this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`), o = i), s = `{${o}}${a}`), r.has(s) && this.fail(`duplicate attribute: ${s}.`), r.add(s), t.uri = o, n[e] = t;
894
+ }
895
+ this.attribList = [];
896
+ }
897
+ processAttribsPlain() {
898
+ let { attribList: e } = this, t = this.tag.attributes;
899
+ for (let { name: n, value: r } of e) t[n] !== void 0 && this.fail(`duplicate attribute: ${n}.`), t[n] = r;
900
+ this.attribList = [];
901
+ }
902
+ openTag() {
903
+ this.processAttribs();
904
+ let { tags: e } = this, t = this.tag;
905
+ t.isSelfClosing = !1, this.openTagHandler?.(t), e.push(t), this.state = J, this.name = "";
906
+ }
907
+ openSelfClosingTag() {
908
+ this.processAttribs();
909
+ let { tags: e } = this, t = this.tag;
910
+ t.isSelfClosing = !0, this.openTagHandler?.(t), this.closeTagHandler?.(t), (this.tag = e[e.length - 1] ?? null) === null && (this.closedRoot = !0), this.state = J, this.name = "";
911
+ }
912
+ closeTag() {
913
+ let { tags: e, name: t } = this;
914
+ if (this.state = J, this.name = "", t === "") return this.fail("weird empty close tag."), void (this.text += "</>");
915
+ let n = this.closeTagHandler, r = e.length;
916
+ for (; r-- > 0;) {
917
+ let r = this.tag = e.pop();
918
+ if (this.topNS = r.ns, n?.(r), r.name === t) break;
919
+ this.fail(`unexpected close tag: ${t}.`);
920
+ }
921
+ r === 0 ? this.closedRoot = !0 : r < 0 && (this.fail(`unmatched closing tag: ${t}.`), this.text += `</${t}>`);
922
+ }
923
+ parseEntity(e) {
924
+ if (e[0] !== "#") {
925
+ let t = this.ENTITIES[e];
926
+ return t === void 0 ? (this.fail(this.isName(e) ? "undefined entity." : "disallowed character in entity name."), `&${e};`) : t;
927
+ }
928
+ let t = NaN;
929
+ return e[1] === "x" && /^#x[0-9a-f]+$/i.test(e) ? t = parseInt(e.slice(2), 16) : /^#[0-9]+$/.test(e) && (t = parseInt(e.slice(1), 10)), this.isChar(t) ? String.fromCodePoint(t) : (this.fail("malformed character entity."), `&${e};`);
930
+ }
931
+ }, Kt = /&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g, qt = {
932
+ amp: "&",
933
+ lt: "<",
934
+ gt: ">",
935
+ quot: "\"",
936
+ apos: "'"
937
+ }, Jt = (e, t) => {
938
+ let n = qt[t];
939
+ if (n !== void 0) return n;
940
+ let r = t.charCodeAt(1) === 120 ? parseInt(t.slice(2), 16) : parseInt(t.slice(1), 10);
941
+ return r > 0 && r <= 1114111 ? String.fromCodePoint(r) : e;
942
+ }, Yt = (e) => {
943
+ let t = e;
944
+ return t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, "\n")), t.indexOf("&") !== -1 && (t = t.replace(Kt, Jt)), t;
945
+ }, Xt = (e) => {
946
+ let t = e, n = t.length;
947
+ for (let e = 0; e < n; e++) {
948
+ let n = t.charCodeAt(e);
949
+ if (n === 9 || n === 10 || n === 13) {
950
+ t = t.replace(/\r\n|[\t\n\r]/g, " ");
951
+ break;
952
+ }
953
+ }
954
+ return t.indexOf("&") !== -1 && (t = t.replace(Kt, Jt)), t;
955
+ }, Zt = (e) => e === 32 || e === 9 || e === 10 || e === 13, Qt = class e {
956
+ constructor() {
957
+ this._openTagHandler = void 0, this._closeTagHandler = void 0, this._textHandler = void 0, this._cdataHandler = void 0, this._errorHandler = void 0, this._endHandler = void 0, this._scanners = null, this._carry = "", this._text = "", this._tags = [], this._sawRoot = !1, this._closed = !1;
958
+ }
959
+ static {
960
+ this.NEED_MORE = -1;
961
+ }
962
+ static {
963
+ this.NOT_HANDLED = -2;
964
+ }
965
+ static decodeText(e) {
966
+ return Yt(e);
967
+ }
968
+ on(e, t) {
969
+ switch (e) {
970
+ case "opentag":
971
+ this._openTagHandler = t;
972
+ break;
973
+ case "closetag":
974
+ this._closeTagHandler = t;
975
+ break;
976
+ case "text":
977
+ this._textHandler = t;
978
+ break;
979
+ case "cdata":
980
+ this._cdataHandler = t;
981
+ break;
982
+ case "error":
983
+ this._errorHandler = t;
984
+ break;
985
+ case "end": this._endHandler = t;
986
+ }
987
+ }
988
+ setElementScanners(e) {
989
+ if (!e || e.length === 0) return void (this._scanners = null);
990
+ let t = Array(128);
991
+ for (let n of e) {
992
+ let e = n.name.charCodeAt(0);
993
+ if (!(e < 128) || t[e] !== void 0) throw Error(`Element scanner '${n.name}' needs an ASCII first character no other scanner uses.`);
994
+ t[e] = n;
995
+ }
996
+ this._scanners = t;
997
+ }
998
+ fail(e) {
999
+ let t = Error(e), n = this._errorHandler;
1000
+ if (n === void 0) throw t;
1001
+ n(t);
1002
+ }
1003
+ write(e) {
1004
+ if (this._closed) return this.fail("cannot write after close."), this;
1005
+ let t = e;
1006
+ this._carry.length !== 0 && (t = this._carry + e, this._carry = "");
1007
+ let n = t.length, r = 0;
1008
+ for (; r < n;) {
1009
+ let e = t.indexOf("<", r);
1010
+ if (e === -1) return this._text += t.slice(r), this;
1011
+ e > r && (this._text += t.slice(r, e));
1012
+ let i = this._markup(t, e, n);
1013
+ if (i === -1) return this._carry = t.slice(e), this;
1014
+ r = i;
1015
+ }
1016
+ return this;
1017
+ }
1018
+ close() {
1019
+ this._carry.length !== 0 && (this.fail("unexpected end."), this._carry = ""), this._sawRoot || this.fail("document must contain a root element.");
1020
+ let e = this._tags;
1021
+ for (; e.length > 0;) {
1022
+ let t = e.pop();
1023
+ this.fail(`unclosed tag: ${t.name}`);
1024
+ }
1025
+ return this._flushText(), this._closed = !0, this._endHandler?.(), this;
1026
+ }
1027
+ _flushText() {
1028
+ let e = this._text;
1029
+ if (e.length === 0) return;
1030
+ this._text = "";
1031
+ let t = this._textHandler;
1032
+ t !== void 0 && this._tags.length !== 0 && t(Yt(e));
1033
+ }
1034
+ _markup(t, n, r) {
1035
+ if (n + 1 >= r) return -1;
1036
+ let i = t.charCodeAt(n + 1);
1037
+ if (i === 47) {
1038
+ let e = t.indexOf(">", n + 2);
1039
+ return e === -1 ? -1 : (this._flushText(), this._closeTag(t.slice(n + 2, e).trimEnd()), e + 1);
1040
+ }
1041
+ if (i === 63) {
1042
+ let e = t.indexOf("?>", n + 2);
1043
+ return e === -1 ? -1 : e + 2;
1044
+ }
1045
+ if (i === 33) {
1046
+ if (n + 4 > r) return -1;
1047
+ if (t.charCodeAt(n + 2) === 45 && t.charCodeAt(n + 3) === 45) {
1048
+ let e = t.indexOf("-->", n + 4);
1049
+ return e === -1 ? -1 : e + 3;
1050
+ }
1051
+ if (n + 9 > r) return -1;
1052
+ if (t.startsWith("[CDATA[", n + 2)) {
1053
+ let e = t.indexOf("]]>", n + 9);
1054
+ return e === -1 ? -1 : (this._flushText(), this._cdataHandler?.(t.slice(n + 9, e)), e + 3);
1055
+ }
1056
+ let e = t.indexOf("[", n + 2), i = t.indexOf(">", n + 2);
1057
+ if (i === -1) return -1;
1058
+ if (e !== -1 && e < i) {
1059
+ let n = t.indexOf("]>", e);
1060
+ return n === -1 ? -1 : n + 2;
1061
+ }
1062
+ return i + 1;
1063
+ }
1064
+ let a = this._scanners;
1065
+ if (a !== null) {
1066
+ let o = i < 128 ? a[i] : void 0;
1067
+ if (o !== void 0 && t.startsWith(o.name, n + 1)) {
1068
+ let i = n + 1 + o.name.length;
1069
+ if (i >= r) return -1;
1070
+ let a = t.charCodeAt(i);
1071
+ if (a === 62 || a === 47 || Zt(a)) {
1072
+ this._flushText();
1073
+ let i = o.scan(t, n, r);
1074
+ if (i !== e.NOT_HANDLED) {
1075
+ if (i !== e.NEED_MORE) {
1076
+ this._sawRoot = !0;
1077
+ let e = o.openTag;
1078
+ e !== void 0 && this._tags.push(e);
1079
+ }
1080
+ return i;
1081
+ }
1082
+ }
1083
+ }
1084
+ }
1085
+ return this._openTag(t, n, r);
1086
+ }
1087
+ _openTag(e, t, n) {
1088
+ let r = t + 1, i = 0;
1089
+ for (; r < n && (i = e.charCodeAt(r), i !== 62 && i !== 47 && !Zt(i));) r++;
1090
+ if (r >= n) return -1;
1091
+ let a = e.slice(t + 1, r), o = {}, s = !1;
1092
+ for (;;) {
1093
+ for (; r < n && Zt(i = e.charCodeAt(r));) r++;
1094
+ if (r >= n) return -1;
1095
+ if (i === 62) {
1096
+ r++;
1097
+ break;
1098
+ }
1099
+ if (i === 47) {
1100
+ if (r + 1 >= n) return -1;
1101
+ if (e.charCodeAt(r + 1) !== 62) {
1102
+ this.fail("forward-slash in opening tag not followed by >."), r++;
1103
+ continue;
1104
+ }
1105
+ s = !0, r += 2;
1106
+ break;
1107
+ }
1108
+ let t = r;
1109
+ for (; r < n && (i = e.charCodeAt(r), i !== 61 && i !== 62 && i !== 47 && !Zt(i));) r++;
1110
+ if (r >= n) return -1;
1111
+ let a = e.slice(t, r);
1112
+ for (; r < n && Zt(i = e.charCodeAt(r));) r++;
1113
+ if (r >= n) return -1;
1114
+ if (i !== 61) {
1115
+ this.fail("attribute without value.");
1116
+ continue;
1117
+ }
1118
+ for (r++; r < n && Zt(i = e.charCodeAt(r));) r++;
1119
+ if (r >= n) return -1;
1120
+ if (i !== 34 && i !== 39) {
1121
+ this.fail("unquoted attribute value.");
1122
+ continue;
1123
+ }
1124
+ let c = e.indexOf(i === 34 ? "\"" : "'", r + 1);
1125
+ if (c === -1) return -1;
1126
+ a !== "__proto__" && (o[a] = Xt(e.slice(r + 1, c))), r = c + 1;
1127
+ }
1128
+ this._flushText(), this._sawRoot = !0;
1129
+ let c = {
1130
+ name: a,
1131
+ attributes: o,
1132
+ isSelfClosing: s
1133
+ };
1134
+ return this._openTagHandler?.(c), s ? this._closeTagHandler?.(c) : this._tags.push(c), r;
1135
+ }
1136
+ _closeTag(e) {
1137
+ if (e === "") return void this.fail("weird empty close tag.");
1138
+ let t = this._tags, n = this._closeTagHandler, r = t.length;
1139
+ for (; r-- > 0;) {
1140
+ let r = t.pop();
1141
+ if (n?.(r), r.name === e) return;
1142
+ this.fail(`unexpected close tag: ${e}.`);
1143
+ }
1144
+ this.fail(`unmatched closing tag: ${e}.`);
1145
+ }
1146
+ };
1147
+ (function(e) {
1148
+ e.Events = {
1149
+ XmlDecl: "xmldecl",
1150
+ Text: "text",
1151
+ ProcessingInstruction: "processinginstruction",
1152
+ Doctype: "doctype",
1153
+ Comment: "comment",
1154
+ OpenTagStart: "opentagstart",
1155
+ Attribute: "attribute",
1156
+ OpenTag: "opentag",
1157
+ CloseTag: "closetag",
1158
+ CDdata: "cdata",
1159
+ Error: "error",
1160
+ End: "end",
1161
+ Ready: "ready"
1162
+ }, e.parseStream = async (e, t, n) => {
1163
+ if (n?.lean) return (async (e, t) => {
1164
+ let n = new Qt(), r;
1165
+ t.elementScanners && n.setElementScanners(t.elementScanners), t.onOpenTag && n.on("opentag", t.onOpenTag), t.onCloseTag && n.on("closetag", t.onCloseTag), t.onText && n.on("text", t.onText), t.onError && n.on("error", t.onError);
1166
+ let i = t.onEnd;
1167
+ for (i && n.on("end", () => {
1168
+ r = i();
1169
+ });;) {
1170
+ let { value: t, done: r } = await e.read();
1171
+ if (r) break;
1172
+ n.write(t);
1173
+ }
1174
+ return n.close(), r;
1175
+ })(e, t);
1176
+ let r = new Gt({
1177
+ position: !1,
1178
+ ...n
1179
+ }), i;
1180
+ t.onOpenTagStart && r.on(Vt.Events.OpenTagStart, t.onOpenTagStart), t.onOpenTag && r.on(Vt.Events.OpenTag, t.onOpenTag), t.onCloseTag && r.on(Vt.Events.CloseTag, t.onCloseTag), t.onAttribute && r.on(Vt.Events.Attribute, t.onAttribute), t.onText && r.on(Vt.Events.Text, t.onText), t.onError && r.on(Vt.Events.Error, t.onError);
1181
+ let a = t.onEnd;
1182
+ for (a && r.on(Vt.Events.End, () => {
1183
+ i = a();
1184
+ });;) {
1185
+ let { value: t, done: n } = await e.read();
1186
+ if (n) break;
1187
+ r.write(t);
1188
+ }
1189
+ return r.close(), i;
1190
+ };
1191
+ })(Vt ||= {});
1192
+ var Z = (e) => !0 === e || e === "1" || e === "on" || e === "true" || !1 !== e && e !== "0" && e !== "off" && e !== "false" && null, Q = (e) => {
1193
+ let t = parseInt(e);
1194
+ return isNaN(t) ? null : t;
1195
+ }, $t = (e) => {
1196
+ let t = parseFloat(e);
1197
+ return isNaN(t) ? null : t;
1198
+ }, $ = null, en = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), tn = (e) => en(e).replace(/"/g, "&quot;"), nn = class {
1199
+ constructor() {
1200
+ this._registeredVisitors = /* @__PURE__ */ new Map();
1201
+ }
1202
+ registerVisitor(e) {
1203
+ this._registeredVisitors.set(e.from, e);
1204
+ }
1205
+ createEventHandler(e, t, n) {
1206
+ let r = this._registeredVisitors, i = [], a = [], o = null, s = null, c = null, l = null, u = [], d = {
1207
+ key: null,
1208
+ source: e,
1209
+ parent: null
1210
+ }, f = null, p = !1, m = null, h = null, g = null, _ = (e, t) => {
1211
+ let n = c.attributes[e];
1212
+ if (t) {
1213
+ if (Array.isArray(t)) {
1214
+ let e = t.length;
1215
+ for (let r = 0; r < e; r++) if (n == null || (n = t[r](n), n == null)) return;
1216
+ } else if (n == null || (n = t(n), n == null)) return;
1217
+ }
1218
+ return n;
1219
+ }, v = {
1220
+ getSource: () => f?.source ?? null,
1221
+ setSource: (e) => {
1222
+ f.source = e;
1223
+ },
1224
+ setKey: (e) => {
1225
+ f.key = e;
1226
+ },
1227
+ getFrom: () => c,
1228
+ getAttribute: (e, t) => _(e, t) ?? null,
1229
+ hasAttribute: (e) => v.getAttribute(e) !== null,
1230
+ getParent: () => {
1231
+ let e = u[u.length - 2];
1232
+ return e.parent ?? e.source;
1233
+ },
1234
+ getPath: () => {
1235
+ let e = [], t = a.length;
1236
+ for (let n = 0; n < t; n++) e.push(a[n].local);
1237
+ return e.join("\\");
1238
+ },
1239
+ parseAttribute: _,
1240
+ getRawXml: () => g,
1241
+ copyToObject: (e, t, n, r) => {
1242
+ let i = _(r ?? t, n);
1243
+ i !== void 0 && (e[t] = i);
1244
+ },
1245
+ copyTo: (e, t, n) => {
1246
+ let r = _(n ?? e, t);
1247
+ r !== void 0 && (f.source[e] = r);
1248
+ },
1249
+ warn: (e, t) => {
1250
+ n ? n(e, void 0, t?.onceKey) : console.warn(e);
1251
+ }
1252
+ };
1253
+ return {
1254
+ onOpenTag: (e) => {
1255
+ let t = e.name, n = t.indexOf(":");
1256
+ if (n !== -1 && (t = t.slice(n + 1)), m) return m.push(((e) => {
1257
+ let t = e.attributes ?? {}, n = `<${e.name}`;
1258
+ for (let e in t) {
1259
+ let r = t[e];
1260
+ n += ` ${e}="${tn(typeof r == "string" ? r : r?.value ?? "")}"`;
1261
+ }
1262
+ return n + ">";
1263
+ })(e)), o = {
1264
+ local: t,
1265
+ tag: e,
1266
+ destination: null
1267
+ }, a.push(o), s = t, void (c = e);
1268
+ let g = (i.length > 0 ? i[i.length - 1] : r).get(t);
1269
+ if (o = {
1270
+ local: t,
1271
+ visitor: g,
1272
+ tag: e,
1273
+ destination: null
1274
+ }, p) return a.push(o), s = t, void (c = e);
1275
+ l = o?.visitor ?? null, s = t, c = e;
1276
+ let _ = !!g && g.to === null;
1277
+ if (g && !_ && g.scope) {
1278
+ let e = g.scope(v);
1279
+ e === null ? _ = !0 : e && (i.push(e), o.pushedScope = !0);
1280
+ }
1281
+ g && (a.length === 0 ? (f = d, o.destination = f, o.pushedDestination = !0, u.push(f)) : _ ? (f = null, o.destination = null) : g.transparent ? o.destination = f : (f = {
1282
+ key: null,
1283
+ source: {},
1284
+ parent: null
1285
+ }, o.destination = f, o.pushedDestination = !0, u.push(f))), a.push(o), p = _;
1286
+ let y = l?.openTag?.(v);
1287
+ y !== void 0 && (f.parent = y), g?.raw && !_ && (m = [], h = o);
1288
+ },
1289
+ onCloseTag: (e) => {
1290
+ let t = e.name, r = t.indexOf(":");
1291
+ if (r !== -1 && (t = t.slice(r + 1)), t !== s) throw Error(`mismatch open/close tag: '${t}'/'${s}'`);
1292
+ let _ = !1;
1293
+ if (m) {
1294
+ if (a[a.length - 1] !== h) return m.push(`</${e.name}>`), a.pop(), o = a[a.length - 1] ?? null, s = o?.local ?? null, void (c = o?.tag ?? null);
1295
+ g = m.join(""), m = null, h = null, _ = !0;
1296
+ }
1297
+ p || l?.closeTag?.(v), _ && (g = null);
1298
+ let y = a.pop() ?? null;
1299
+ o = a[a.length - 1] ?? null, y?.pushedScope && i.pop();
1300
+ let b = y?.destination;
1301
+ if (b && y.pushedDestination) {
1302
+ u.pop(), f = u[u.length - 1] ?? d;
1303
+ let e = y.visitor;
1304
+ e && e.to && b.source !== void 0 && (Array.isArray(e.to) ? f.source.push ? f.source.push(b.source) : n?.(`Unable to parse array for ${e.from} at ${v.getPath()}`) : b.key ? f.source[b.key] = b.source : typeof e.to == "string" && (f.source[e.to] = b.source));
1305
+ } else b || (f = u[u.length - 1] ?? d);
1306
+ s = o?.local ?? null, c = o?.tag ?? null, l = o?.visitor ?? null, p = !o?.destination;
1307
+ },
1308
+ onText: (e) => {
1309
+ m ? m.push(en(e)) : l?.text?.(e, v);
1310
+ },
1311
+ onEnd: t
1312
+ };
1313
+ }
1314
+ }, rn = `IFERROR(${b}(`, an = rn.toUpperCase(), on = p.toUpperCase(), sn = { kind: "none" }, cn = { kind: "spilled" }, ln = (e, t) => {
1315
+ if (e.charCodeAt(t) !== 34) return null;
1316
+ let n = "", r = t + 1;
1317
+ for (; r < e.length;) if (e.charCodeAt(r) === 34) {
1318
+ if (e.charCodeAt(r + 1) !== 34) return {
1319
+ value: n,
1320
+ end: r + 1
1321
+ };
1322
+ n += "\"", r += 2;
1323
+ } else n += e[r], r++;
1324
+ return null;
1325
+ }, un = (e) => {
1326
+ let t = [], n = 0;
1327
+ for (; n < e.length;) {
1328
+ let r = e.charCodeAt(n);
1329
+ if (r === 34) {
1330
+ let t = ln(e, n);
1331
+ if (t === null) break;
1332
+ n = t.end;
1333
+ continue;
1334
+ }
1335
+ if (!(r >= 65 && r <= 90 || r >= 97 && r <= 122 || r === 95)) {
1336
+ n++;
1337
+ continue;
1338
+ }
1339
+ let i = n + 1;
1340
+ for (; i < e.length;) {
1341
+ let t = e.charCodeAt(i);
1342
+ if (!(t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 48 && t <= 57 || t === 95 || t === 46)) break;
1343
+ i++;
1344
+ }
1345
+ e.charCodeAt(i) === 40 && t.push(e.slice(n, i).toUpperCase().replace(/^_XLFN\./, "").replace(/^_XLWS\./, "")), n = i;
1346
+ }
1347
+ return t;
1348
+ }, dn = /^\s*TABLE\s*\(([^()]*)\)\s*$/i, fn = /^\s*(\$?)([A-Za-z]{1,3})(\$?)(\d{1,7})\s*$/, pn = (e) => {
1349
+ let t = fn.exec(e);
1350
+ if (!t) return null;
1351
+ let n = V.fastStringToCol(t[2]), r = parseInt(t[4], 10) - 1;
1352
+ return n < 0 || r < 0 ? null : {
1353
+ row: r,
1354
+ col: n,
1355
+ colAbsolute: t[1] === "$",
1356
+ rowAbsolute: t[3] === "$"
1357
+ };
1358
+ }, mn = (e) => V.cellToString({
1359
+ rowIndex: e.row,
1360
+ colIndex: e.col
1361
+ }), hn = (e, t) => {
1362
+ let n = dn.exec(e);
1363
+ if (!n) return null;
1364
+ let r = n[1].split(",");
1365
+ if (r.length !== 3 && r.length !== 5) return null;
1366
+ let i = [];
1367
+ for (let e = 0; e < r.length; e++) {
1368
+ let t = pn(r[e]);
1369
+ if (!t) return null;
1370
+ i.push(t);
1371
+ }
1372
+ let a = t.rowStart, o = t.colStart, s = (e) => e.colAbsolute && !e.rowAbsolute && e.col === o - 1 && e.row === a, c = (e) => e.rowAbsolute && !e.colAbsolute && e.row === a - 1 && e.col === o, l = V.rangeToString(t), u = i[0];
1373
+ if (i.length === 3) {
1374
+ let [, e, t] = i;
1375
+ return s(t) && c(u) ? {
1376
+ ref: l,
1377
+ columnInput: mn(e)
1378
+ } : c(t) && s(u) ? {
1379
+ ref: l,
1380
+ rowInput: mn(e)
1381
+ } : null;
1382
+ }
1383
+ if (!u.rowAbsolute || !u.colAbsolute || u.row !== a - 1 || u.col !== o - 1) return null;
1384
+ let [, d, f, p, m] = i;
1385
+ return s(f) && c(m) ? {
1386
+ ref: l,
1387
+ rowInput: mn(p),
1388
+ columnInput: mn(d)
1389
+ } : c(f) && s(m) ? {
1390
+ ref: l,
1391
+ rowInput: mn(d),
1392
+ columnInput: mn(p)
1393
+ } : null;
1394
+ }, gn = /^(?:(\d{4})-(\d{2})-(\d{2}))?T?(?:(\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?)?(?:Z|[+-]\d{2}:?\d{2})?$/, _n = /^PT(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?$/, vn = (e, t, n) => {
1395
+ let r = Math.floor((14 - t) / 12), i = e + 4800 - r, a = t + 12 * r - 3;
1396
+ return n + Math.floor((153 * a + 2) / 5) + 365 * i + Math.floor(i / 4) - Math.floor(i / 100) + Math.floor(i / 400) - 32045;
1397
+ }, yn = vn(1899, 12, 30), bn = (e) => {
1398
+ let t = e.indexOf(":");
1399
+ return t === -1 ? e : e.slice(t + 1);
1400
+ }, xn = class {
1401
+ constructor() {
1402
+ this._runs = null, this._text = "", this._font = null, this._inRun = !1, this._inRPr = !1;
1403
+ }
1404
+ reset() {
1405
+ this._runs = null, this._inRun = !1, this._inRPr = !1;
1406
+ }
1407
+ onOpenTag(e, t) {
1408
+ e === "r" ? (this._inRun = !0, this._text = "", this._font = null, this._runs ??= []) : e === "rPr" ? this._inRun && (this._inRPr = !0) : this._inRPr && function(e, t, n) {
1409
+ switch (e) {
1410
+ case "b":
1411
+ n.weight = wn(t) ? 700 : 400;
1412
+ break;
1413
+ case "i":
1414
+ n.style = wn(t) ? Be.Style.Italic : Be.Style.Normal;
1415
+ break;
1416
+ case "strike":
1417
+ n.strike = i(wn(t));
1418
+ break;
1419
+ case "outline":
1420
+ n.outline = wn(t);
1421
+ break;
1422
+ case "shadow":
1423
+ n.shadow = wn(t);
1424
+ break;
1425
+ case "condense":
1426
+ case "extend": {
1427
+ let r = o(e, wn(t));
1428
+ r !== void 0 && (n.letterSpacing = r);
1429
+ break;
1430
+ }
1431
+ case "u":
1432
+ n.underline = h(t.val);
1433
+ break;
1434
+ case "vertAlign": {
1435
+ let e = Oe(t.val);
1436
+ e !== void 0 && (n.baseline = e);
1437
+ break;
1438
+ }
1439
+ case "sz": {
1440
+ let e = parseFloat(t.val ?? "");
1441
+ isNaN(e) || (n.size = e);
1442
+ break;
1443
+ }
1444
+ case "rFont": {
1445
+ let e = t.val;
1446
+ e && (n.family = e);
1447
+ break;
1448
+ }
1449
+ case "family": {
1450
+ let e = Cn[t.val ?? ""];
1451
+ e && (n.fallbacks = [e]);
1452
+ break;
1453
+ }
1454
+ case "charset": {
1455
+ let e = parseInt(t.val ?? "", 10);
1456
+ isNaN(e) || (n.charset = e);
1457
+ break;
1458
+ }
1459
+ case "scheme":
1460
+ x(n, t.val);
1461
+ break;
1462
+ case "color": {
1463
+ let e = t.rgb;
1464
+ if (e && t.theme === void 0) {
1465
+ n.color = "#" + (e.length === 8 ? e.substring(2) : e).toUpperCase();
1466
+ break;
1467
+ }
1468
+ let r = D((e) => t[e]);
1469
+ r && (n.color = r);
1470
+ break;
1471
+ }
1472
+ }
1473
+ }(e, t, this._font ??= {});
1474
+ }
1475
+ onText(e) {
1476
+ this._inRun && (this._text += e);
1477
+ }
1478
+ onCloseTag(e) {
1479
+ if (e === "rPr") this._inRPr = !1, this._font ??= {};
1480
+ else if (e === "r" && this._inRun) {
1481
+ let e = l(this._text), t = this._font;
1482
+ this._runs.push(t ? {
1483
+ text: e,
1484
+ font: t
1485
+ } : { text: e }), this._inRun = !1;
1486
+ }
1487
+ }
1488
+ take() {
1489
+ let e = this._runs;
1490
+ if (this.reset(), !e) return null;
1491
+ for (let t = 0; t < e.length; t++) if (e[t].font) return e;
1492
+ return null;
1493
+ }
1494
+ };
1495
+ function Sn(e, t) {
1496
+ let n = {
1497
+ family: "Calibri",
1498
+ size: 11,
1499
+ ...t,
1500
+ weight: 400,
1501
+ style: Be.Style.Normal,
1502
+ underline: Be.UnderlineStyle.None,
1503
+ strike: Be.StrikeStyle.None,
1504
+ baseline: 0
1505
+ }, r = Array(e.length);
1506
+ for (let t = 0; t < e.length; t++) {
1507
+ let i = e[t];
1508
+ if (!i.font) {
1509
+ r[t] = i;
1510
+ continue;
1511
+ }
1512
+ let a = {
1513
+ ...n,
1514
+ ...i.font
1515
+ };
1516
+ r[t] = {
1517
+ text: i.text,
1518
+ font: a
1519
+ };
1520
+ }
1521
+ return r;
1522
+ }
1523
+ var Cn = {
1524
+ 1: "serif",
1525
+ 2: "sans-serif",
1526
+ 3: "monospace",
1527
+ 4: "cursive",
1528
+ 5: "fantasy"
1529
+ }, wn = (e) => {
1530
+ let t = e.val;
1531
+ return t === void 0 || t === "1" || t === "true";
1532
+ }, Tn = (e) => {
1533
+ let t = (t) => {
1534
+ if (e) return RegExp(`<(?:[\\w.-]+:)?${t}\\b[^>]*>([^<]*)<`).exec(e)?.[1];
1535
+ }, n = (e) => {
1536
+ let t = parseInt(e ?? "", 10);
1537
+ return isNaN(t) ? 0 : t;
1538
+ };
1539
+ return {
1540
+ c: n(t("col")),
1541
+ r: n(t("row")),
1542
+ x: re(t("colOff") ?? "0") ?? 0,
1543
+ y: re(t("rowOff") ?? "0") ?? 0
1544
+ };
1545
+ }, En = "formulaDialect", Dn = "date1904", On = "richStrings", kn = "defaultFont", An = (e, t, n, i, o, s, d, f) => {
1546
+ let p = new nn(), m = (e) => {
1547
+ let t = e.getAttribute("dxfId", Q);
1548
+ return t === null ? void 0 : i?.get(t) || (s?.(`A color filter or sort names a format that does not exist (dxfId '${t}').`), {});
1549
+ }, h = !1, g = f?.get("parseInlineDxf"), y = f?.get(En), b = (e) => y && e ? y.readDetached(e) : e, ee = new qe.TransposedBuilder(), x = null, ne = "topLeft";
1550
+ p.registerVisitor({
1551
+ from: "autoFilter",
1552
+ to: "autoTable",
1553
+ openTag: (e) => {
1554
+ let t = e.getAttribute("ref"), n = V.fastStringToRange(t);
1555
+ e.getSource().r = n, e.getSource().v = {};
1556
+ },
1557
+ closeTag: (e) => {
1558
+ let t = e.getSource(), n = t.v, r = n.hiddenButtons;
1559
+ if (Array.isArray(r)) {
1560
+ let e = r.length, i = t.r, a = i.colEnd - i.colStart + 1;
1561
+ e === 0 ? n.hiddenButtons = !1 : e === a && (n.hiddenButtons = !0);
1562
+ }
1563
+ }
1564
+ }), p.registerVisitor({
1565
+ from: "conditionalFormatting",
1566
+ to: {},
1567
+ openTag: (e) => {
1568
+ let t = e.getParent();
1569
+ t.conditionals ||= [];
1570
+ let n = e.getAttribute("sqref");
1571
+ n &&= n.trim().split(/\s+/).join(",");
1572
+ let r = {
1573
+ r: n,
1574
+ conditionals: t.conditionals
1575
+ }, i = e.getAttribute("pivot", Z);
1576
+ i !== null && (r.pivot = i), e.setSource(r);
1577
+ }
1578
+ }), p.registerVisitor({
1579
+ from: "cfRule",
1580
+ to: {},
1581
+ openTag: (e) => {
1582
+ let t = e.getParent();
1583
+ if (!t?.r) return;
1584
+ let n = e.getSource() ?? {};
1585
+ t.pivot !== void 0 && (n.pivot = t.pivot), t.conditionals.push({
1586
+ r: t.r,
1587
+ v: null,
1588
+ rule: n
1589
+ }), e.copyToObject(n, "type", $), e.copyToObject(n, "priority", Q), e.copyToObject(n, "stopIfTrue", Z);
1590
+ let r = e.getAttribute("dxfId", Q);
1591
+ if (r !== null) {
1592
+ let t = i?.get(r);
1593
+ t ||= (s?.(`Unable to load conditional color. Invalid dxfI: '${r}' at '${e.getPath()}'.`), {}), n.style = t;
1594
+ }
1595
+ e.copyToObject(n, "aboveAverage", Z), e.copyToObject(n, "equalAverage", Z), e.copyToObject(n, "stdDev", Q), e.copyToObject(n, "bottom", Z), e.copyToObject(n, "percent", Z), e.copyToObject(n, "rank", Q), e.copyToObject(n, "operator", $), e.copyToObject(n, "text", $), e.copyToObject(n, "timePeriod", $);
1596
+ },
1597
+ closeTag: (e) => {
1598
+ let t = e.getParent();
1599
+ if (!t?.r) return;
1600
+ let n = t.conditionals[t.conditionals.length - 1], r = n?.rule;
1601
+ if (!r) return;
1602
+ let i = {}, a = O(r, s);
1603
+ a && (i.condition = a), r.style && (i.style = r.style), r.scale && (i.scale = r.scale), r.stopIfTrue && (i.stopIfTrue = !0), r.pivot && (i.pivot = !0), n.v = i, n.priority = r.priority, r.x14Id && (n.x14Id = r.x14Id), delete n.rule;
1604
+ }
1605
+ });
1606
+ let re = (e) => {
1607
+ let t = e.conditions ?? [], n = [];
1608
+ for (let e = 0; e < t.length; e++) {
1609
+ let r = t[e], i = {};
1610
+ r.type && (i.type = r.type), r.value !== void 0 && (i.value = r.value), r.exclusive && (i.exclusive = !0), n.push(i);
1611
+ }
1612
+ return n;
1613
+ };
1614
+ p.registerVisitor({
1615
+ from: "colorScale",
1616
+ to: {},
1617
+ openTag: (e) => {},
1618
+ closeTag: (e) => {
1619
+ let t = e.getSource(), n = t.colors ?? [], r = re(t);
1620
+ for (let e = 0; e < r.length; e++) r[e].color = n[e];
1621
+ e.getParent().scale = {
1622
+ type: U.ScaleType.ColorScale,
1623
+ stops: r
1624
+ };
1625
+ }
1626
+ }), p.registerVisitor({
1627
+ from: "dataBar",
1628
+ to: {},
1629
+ openTag: (e) => {
1630
+ e.copyTo("maxLength", Q), e.copyTo("minLength", Q), e.copyTo("showValue", Z);
1631
+ },
1632
+ closeTag: (e) => {
1633
+ let t = e.getSource(), n = {
1634
+ type: U.ScaleType.DataBar,
1635
+ stops: re(t)
1636
+ }, r = t.colors?.[0];
1637
+ r && (n.color = r), t.minLength !== void 0 && (n.minLength = t.minLength), t.maxLength !== void 0 && (n.maxLength = t.maxLength), t.showValue !== void 0 && (n.showValue = t.showValue), e.getParent().scale = n;
1638
+ }
1639
+ }), p.registerVisitor({
1640
+ from: "iconSet",
1641
+ to: {},
1642
+ openTag: (e) => {
1643
+ e.copyTo("iconSet", $), e.copyTo("reverse", Z), e.copyTo("showValue", Z);
1644
+ },
1645
+ closeTag: (e) => {
1646
+ let t = e.getSource(), n = {
1647
+ type: U.ScaleType.IconSet,
1648
+ stops: re(t)
1649
+ };
1650
+ t.iconSet !== void 0 && (n.iconSet = t.iconSet), t.reverse !== void 0 && (n.reverse = t.reverse), t.showValue !== void 0 && (n.showValue = t.showValue), e.getParent().scale = n;
1651
+ }
1652
+ }), p.registerVisitor({
1653
+ from: "formula",
1654
+ to: {},
1655
+ text: (e, t) => {
1656
+ let n = t.getParent(), r = n.formulas;
1657
+ r || (r = [], n.formulas = r), r.push(b(e));
1658
+ }
1659
+ }), p.registerVisitor({
1660
+ from: "cfvo",
1661
+ to: {},
1662
+ openTag: (e) => {
1663
+ let t = e.getParent();
1664
+ t.conditions ||= [];
1665
+ let n = e.getSource();
1666
+ if (t.conditions.push(n), e.copyTo("type", $), n.type === U.ColorStopType.Formula) {
1667
+ let t = e.getAttribute("val");
1668
+ t != null && (n.value = b(String(t)));
1669
+ } else e.copyTo("value", $t, "val");
1670
+ !1 === e.getAttribute("gte", Z) && (n.exclusive = !0);
1671
+ }
1672
+ }), p.registerVisitor({
1673
+ from: "color",
1674
+ to: {},
1675
+ openTag: (e) => {
1676
+ let t = e.getParent();
1677
+ t.colors ||= [];
1678
+ let n = D((t) => e.getAttribute(t));
1679
+ t.colors.push(n);
1680
+ }
1681
+ }), p.registerVisitor({
1682
+ from: "filterColumn",
1683
+ to: {},
1684
+ openTag: (e) => {
1685
+ let t = e.getParent().v, n = parseInt(e.getAttribute("colId")), r = e.getSource();
1686
+ r.index = n;
1687
+ let i = t.filter;
1688
+ i || (i = { conditions: [] }, t.filter = i);
1689
+ let a = i.conditions;
1690
+ if (a || (a = [], i.conditions = a), a.push(r), e.getAttribute("hiddenButton", Z) && t) {
1691
+ let e = t.hiddenButtons;
1692
+ e || (e = [], t.hiddenButtons = e), e.push(n);
1693
+ }
1694
+ if (e.getAttribute("showButton", Z) && t) {
1695
+ let e = t.showButtons;
1696
+ e || (e = [], t.showButtons = e), e.push(n);
1697
+ }
1698
+ return r;
1699
+ }
1700
+ }), p.registerVisitor({
1701
+ from: "colorFilter",
1702
+ openTag: (e) => {
1703
+ let t = e.getParent(), n = {};
1704
+ t.operator = H.BuiltInOperatorNames.Color, t.param = n, e.copyToObject(n, "cellColor", Z);
1705
+ let r = m(e);
1706
+ r && (n.style = r);
1707
+ }
1708
+ }), p.registerVisitor({
1709
+ from: "iconFilter",
1710
+ openTag: (e) => {
1711
+ let t = e.getParent(), n = {};
1712
+ t.operator = H.BuiltInOperatorNames.Icon, t.param = n, e.copyToObject(n, "iconId", Q), e.copyToObject(n, "iconSet", $);
1713
+ }
1714
+ }), p.registerVisitor({
1715
+ from: "top10",
1716
+ openTag: (e) => {
1717
+ let t = e.getParent(), n = {};
1718
+ t.operator = H.BuiltInOperatorNames.TopN, t.param = n, e.copyToObject(n, "filterVal", $t), e.copyToObject(n, "percent", Z), e.copyToObject(n, "top", Z), e.copyToObject(n, "limit", $t, "val");
1719
+ }
1720
+ }), p.registerVisitor({
1721
+ from: "dynamicFilter",
1722
+ openTag: (e) => {
1723
+ let t = e.getParent(), n = de(e.getAttribute("type"));
1724
+ t.operator = n.operator, t.param = n.param;
1725
+ }
1726
+ });
1727
+ let ae = {
1728
+ from: "filters",
1729
+ to: {},
1730
+ openTag: (e) => {
1731
+ let t = e.getParent(), n = {};
1732
+ return t.selector = H.BuiltInSelectorNames.Display, t.operator = H.BuiltInOperatorNames.InSet, t.param = n, e.copyToObject(n, "blank", Z), e.copyToObject(n, "calendarType", $), n;
1733
+ }
1734
+ };
1735
+ p.registerVisitor(ae);
1736
+ let oe = {
1737
+ from: "filter",
1738
+ openTag: (e) => {
1739
+ let t = e.getParent(), n = t.items;
1740
+ n || (n = [], t.items = n), n.push(e.getAttribute("val", $));
1741
+ }
1742
+ };
1743
+ p.registerVisitor(oe);
1744
+ let se = {
1745
+ from: "dateGroupItem",
1746
+ to: {},
1747
+ openTag: (e) => {
1748
+ let t = e.getParent(), n = t.dateGroups;
1749
+ n || (n = [], t.dateGroups = n), n.push(e.getSource()), e.copyTo("group", $, "dateTimeGrouping"), e.copyTo("day", Q), e.copyTo("hour", Q), e.copyTo("minute", Q), e.copyTo("month", Q), e.copyTo("second", Q), e.copyTo("year", Q);
1750
+ }
1751
+ };
1752
+ p.registerVisitor(se);
1753
+ let ce = /* @__PURE__ */ new Map();
1754
+ ce.set("filterColumn", {
1755
+ from: "filterColumn",
1756
+ transparent: !0
1757
+ }), ce.set("filters", ae), ce.set("filter", oe), ce.set("dateGroupItem", se), p.registerVisitor({
1758
+ from: "customFilters",
1759
+ openTag: (e) => {
1760
+ let t = e.getParent(), n = e.getAttribute("and"), r = n === "and" || n === "1", i = [];
1761
+ return t.operator = r ? H.BuiltInOperatorNames.And : H.BuiltInOperatorNames.Or, t.param = i, e.setSource(t), i;
1762
+ },
1763
+ closeTag: (e) => {
1764
+ let t = e.getSource(), n = t?.param;
1765
+ if (!t || !n) return;
1766
+ let r = n.length === 1 ? n[0] : we(t);
1767
+ r !== t && (t.operator = r.operator, t.param = r.param);
1768
+ }
1769
+ }), p.registerVisitor({
1770
+ from: "customFilter",
1771
+ openTag: (e) => {
1772
+ let t = e.getParent(), n;
1773
+ Array.isArray(t) ? (n = {}, t.push(n)) : n = t;
1774
+ let r = Se({
1775
+ operator: e.getAttribute("operator"),
1776
+ val: e.getAttribute("val")
1777
+ }, (t) => e.warn(t));
1778
+ r && (n.operator = r.operator, n.param = r.param);
1779
+ }
1780
+ });
1781
+ let T = {}, E = null;
1782
+ p.registerVisitor({
1783
+ from: "sortState",
1784
+ to: {},
1785
+ openTag: (e) => {
1786
+ let t = e.getParent(), n = t.v;
1787
+ if (!n) return;
1788
+ let r = {};
1789
+ T = {};
1790
+ let i = e.getAttribute("caseSensitive", Z);
1791
+ i != null && (T.collatorOptions = i ? Ge.CaseSensitiveOptions : Ge.CaseInsensitiveOptions);
1792
+ let a = e.getAttribute("sortMethod");
1793
+ a !== "stroke" && a !== "pinYin" || (T.collatorOptions = {
1794
+ ...T.collatorOptions,
1795
+ collation: a === "stroke" ? "stroke" : "pinyin"
1796
+ }), e.getAttribute("columnSort", Z) && (r.axis = Ve.Axis.Column);
1797
+ let o = e.getAttribute("ref"), s = t.r;
1798
+ E = o && s ? V.fastStringToRange(o) : null, E && (r.extent = { range: u(s, E) }), n.sort = r, e.setSource(t);
1799
+ }
1800
+ }), p.registerVisitor({
1801
+ from: "sortCondition",
1802
+ to: {},
1803
+ openTag: (e) => {
1804
+ let t = e.getParent(), n = t.v;
1805
+ if (!n) return;
1806
+ let r = n.sort;
1807
+ if (!r) return;
1808
+ let i = r.sorts;
1809
+ i || (i = [], r.sorts = i);
1810
+ let a = e.getAttribute("ref"), o = 0, s = null;
1811
+ if (a) {
1812
+ let e = V.fastStringToRange(a, Pn), n = e.colStart, r = t.r, i = r.colStart;
1813
+ o = r ? n - i : n, r && E && (s = _(r, E, e));
1814
+ }
1815
+ r.extent && (r.extent.sorts ??= []).push(s);
1816
+ let c = { ...T }, l = be(e.getAttribute("sortBy"));
1817
+ l && (c.sortOn = l);
1818
+ let u = m(e);
1819
+ u && (c.style = u), e.copyToObject(c, "iconSet", $), e.copyToObject(c, "customList", $), c.reverse = e.getAttribute("descending", Z) ?? !1;
1820
+ let d = {
1821
+ index: o,
1822
+ criteria: c
1823
+ };
1824
+ i.push(d);
1825
+ }
1826
+ });
1827
+ let ue = (e) => {
1828
+ x = e.getSource(), ne = "topLeft", e.copyTo("topLeft", $, "topLeftCell");
1829
+ let t = te(e.getAttribute("defaultGridColor")), n = e.getAttribute("colorId");
1830
+ n === null || t || (e.getSource().gridLineColor = "index" + parseFloat(n)), e.copyTo("showZeros", Z), e.copyTo("showFormulas", Z), e.copyTo("zoomScale", Q), e.copyTo("viewMode", $, "view");
1831
+ let r = {};
1832
+ for (let [t, n] of Ee) {
1833
+ let i = e.getAttribute(n, Q);
1834
+ i && (r[t] = Math.min(400, Math.max(10, i)));
1835
+ }
1836
+ Object.keys(r).length > 0 && (e.getSource().zoomScales = r), e.copyTo("showRuler", Z), e.copyTo("showWhitespace", Z, "showWhiteSpace"), e.copyTo("windowProtection", Z), e.copyTo("showRowHeaders", Z, "showRowColHeaders"), e.copyTo("showColumnHeaders", Z, "showRowColHeaders"), e.copyTo("showRowGridlines", Z, "showGridLines"), e.copyTo("showColumnGridlines", Z, "showGridLines"), e.copyTo("rightToLeft", Z), e.copyTo("showOutlineSymbols", Z);
1837
+ };
1838
+ p.registerVisitor({
1839
+ from: "sheetView",
1840
+ to: "view",
1841
+ openTag: (e) => {
1842
+ ue(e);
1843
+ },
1844
+ closeTag: () => {
1845
+ x = null;
1846
+ }
1847
+ }), p.registerVisitor({
1848
+ from: "customSheetViews",
1849
+ to: "customSheetViews",
1850
+ openTag: (e) => {
1851
+ e.setSource([]);
1852
+ }
1853
+ }), p.registerVisitor({
1854
+ from: "customSheetView",
1855
+ to: [],
1856
+ openTag: (e) => {
1857
+ k = !0, ue(e);
1858
+ },
1859
+ closeTag: () => {
1860
+ k = !1, x = null;
1861
+ }
1862
+ }), p.registerVisitor({
1863
+ from: "selection",
1864
+ to: null,
1865
+ openTag: (e) => {
1866
+ if (!x) return;
1867
+ let t = e.getAttribute("activeCell")?.replace(/\$/g, ""), n = e.getAttribute("sqref")?.replace(/\$/g, ""), r = e.getAttribute("pane") ?? "topLeft";
1868
+ if (r !== ne) {
1869
+ let e = x.freezePanes;
1870
+ if (e && t) {
1871
+ let i = { activeCell: t };
1872
+ n && n !== t && (i.sqref = n), (e.paneSelections ??= {})[r] = i;
1873
+ }
1874
+ return;
1875
+ }
1876
+ let i = {};
1877
+ t && (i.cell = t);
1878
+ let a = e.getAttribute("activeCellId", Q);
1879
+ a !== null && (i.rangeIndex = a), n && n !== t && (i.ranges = n.trim().split(/\s+/)), x.selection = i;
1880
+ }
1881
+ }), p.registerVisitor({
1882
+ from: "pane",
1883
+ to: null,
1884
+ openTag: (e) => {
1885
+ if (!x) return;
1886
+ ne = e.getAttribute("activePane") ?? "topLeft";
1887
+ let t = e.getAttribute("state");
1888
+ if (t === "frozen" || t === "frozenSplit") {
1889
+ let t = {};
1890
+ x.freezePanes = t, e.copyToObject(t, "topLeft", $, "topLeftCell");
1891
+ let n = (x.topLeft ? V.fastStringToCell(x.topLeft) : void 0) ?? {
1892
+ colIndex: 0,
1893
+ rowIndex: 0
1894
+ }, r = {
1895
+ colIndex: 0,
1896
+ rowIndex: 0
1897
+ };
1898
+ e.copyToObject(r, "colIndex", Q, "xSplit"), e.copyToObject(r, "rowIndex", Q, "ySplit");
1899
+ let i = {
1900
+ colIndex: n.colIndex + r.colIndex,
1901
+ rowIndex: n.rowIndex + r.rowIndex
1902
+ };
1903
+ t.coords = V.cellToString(i);
1904
+ }
1905
+ }
1906
+ }), p.registerVisitor({
1907
+ from: "sheetPr",
1908
+ transparent: !0,
1909
+ openTag: (t) => {
1910
+ let n = t.getAttribute("codeName");
1911
+ n && (e.codeName = n), !1 === t.getAttribute("enableFormatConditionsCalculation", Z) && (e.conditionalFormatCalculation = !1), !0 === t.getAttribute("transitionEvaluation", Z) && (e.transitionFormulaEvaluation = !0), !0 === t.getAttribute("transitionEntry", Z) && (e.transitionFormulaEntry = !0), !1 === t.getAttribute("published", Z) && (e.excludeFromPublishing = !0);
1912
+ let r = {};
1913
+ !0 === t.getAttribute("syncHorizontal", Z) && (r.horizontal = !0), !0 === t.getAttribute("syncVertical", Z) && (r.vertical = !0);
1914
+ let i = t.getAttribute("syncRef");
1915
+ i && (r.anchor = i), Object.keys(r).length > 0 && (e.syncScroll = r);
1916
+ }
1917
+ }), p.registerVisitor({
1918
+ from: "tabColor",
1919
+ to: null,
1920
+ openTag: (t) => {
1921
+ let n = D((e) => t.getAttribute(e));
1922
+ n && (e.tabColor = n);
1923
+ }
1924
+ });
1925
+ let k = !1, A = () => e.pageLayout ??= {};
1926
+ p.registerVisitor({
1927
+ from: "pageSetUpPr",
1928
+ to: null,
1929
+ openTag: (e) => {
1930
+ !0 === e.getAttribute("fitToPage", Z) && (A().fitToPage = !0), !1 === e.getAttribute("autoPageBreaks", Z) && (A().hideAutoPageBreaks = !0);
1931
+ }
1932
+ }), p.registerVisitor({
1933
+ from: "outlinePr",
1934
+ to: null,
1935
+ openTag: (t) => {
1936
+ let n = (e) => {
1937
+ let n = t.getAttribute(e);
1938
+ return n === "0" || n === "false";
1939
+ }, r = {};
1940
+ n("summaryBelow") && (r.summaryRow = "up"), n("summaryRight") && (r.summaryColumn = "left"), ((e) => {
1941
+ let n = t.getAttribute(e);
1942
+ return n === "1" || n === "true";
1943
+ })("applyStyles") && (r.automaticStyles = !0), Object.keys(r).length > 0 && (e.outline = r);
1944
+ }
1945
+ }), p.registerVisitor({
1946
+ from: "pageMargins",
1947
+ to: null,
1948
+ openTag: (e) => {
1949
+ if (k) return;
1950
+ let t = (t, n) => e.getAttribute(t, $t) ?? n, n = {
1951
+ left: t("left", .7),
1952
+ right: t("right", .7),
1953
+ top: t("top", .75),
1954
+ bottom: t("bottom", .75),
1955
+ header: t("header", .3),
1956
+ footer: t("footer", .3)
1957
+ };
1958
+ n.left === .7 && n.right === .7 && n.top === .75 && n.bottom === .75 && n.header === .3 && n.footer === .3 || (A().margins = n);
1959
+ }
1960
+ }), p.registerVisitor({
1961
+ from: "pageSetup",
1962
+ to: null,
1963
+ openTag: (e) => {
1964
+ if (k) return;
1965
+ let n = A(), r = (t) => e.getAttribute(t, Q) ?? void 0, i = (t) => e.getAttribute(t, Z), a = e.getAttribute("orientation");
1966
+ a !== "landscape" && a !== "portrait" || (n.orientation = a);
1967
+ for (let e of [
1968
+ "paperSize",
1969
+ "scale",
1970
+ "fitToWidth",
1971
+ "fitToHeight",
1972
+ "firstPageNumber",
1973
+ "horizontalDpi",
1974
+ "verticalDpi",
1975
+ "copies"
1976
+ ]) {
1977
+ let t = r(e);
1978
+ t !== void 0 && (n[e] = t);
1979
+ }
1980
+ let o = e.getAttribute("paperHeight");
1981
+ o && (n.paperHeight = o);
1982
+ let s = e.getAttribute("paperWidth");
1983
+ s && (n.paperWidth = s), e.getAttribute("pageOrder") === "overThenDown" && (n.printOrder = "overThenDown"), !0 === i("blackAndWhite") && (n.blackAndWhite = !0), !0 === i("draft") && (n.draftMode = !0), !0 === i("useFirstPageNumber") && (n.useFirstPageNumber = !0), !1 === i("usePrinterDefaults") && (n.ignorePrinterDefaults = !0);
1984
+ let c = e.getAttribute("cellComments"), l = N.find(([e]) => e === c)?.[1];
1985
+ l && (n.printComments = l);
1986
+ let u = e.getAttribute("errors"), d = S.find(([e]) => e === u)?.[1];
1987
+ d && (n.printErrors = d);
1988
+ let f = e.getAttribute("r:id"), p = f ? t(f, "part") : null;
1989
+ p && (n.printerSettings = p);
1990
+ }
1991
+ }), p.registerVisitor({
1992
+ from: "printOptions",
1993
+ to: null,
1994
+ openTag: (e) => {
1995
+ if (k) return;
1996
+ let t = (t) => !0 === e.getAttribute(t, Z);
1997
+ t("horizontalCentered") && (A().centerHorizontally = !0), t("verticalCentered") && (A().centerVertically = !0), t("gridLines") && (A().printGridlines = !0), t("headings") && (A().printHeadings = !0);
1998
+ }
1999
+ }), p.registerVisitor({
2000
+ from: "headerFooter",
2001
+ to: {},
2002
+ openTag: (e) => {
2003
+ if (k) return;
2004
+ let t = {}, n = (t) => e.getAttribute(t, Z);
2005
+ !0 === n("differentOddEven") && (t.differentOddEven = !0), !0 === n("differentFirst") && (t.differentFirst = !0), !1 === n("scaleWithDoc") && (t.ignoreSheetScale = !0), !1 === n("alignWithMargins") && (t.ignoreSheetMargins = !0), Object.keys(t).length > 0 && (A().headerFooter = t);
2006
+ }
2007
+ });
2008
+ for (let e of M) p.registerVisitor({
2009
+ from: e,
2010
+ to: {},
2011
+ text: (t, n) => {
2012
+ if (k) return;
2013
+ let r = A(), i = r.headerFooter ??= {};
2014
+ i[e] = (i[e] ?? "") + l(t);
2015
+ }
2016
+ });
2017
+ let me = "rowBreaks";
2018
+ for (let [e, t] of [["rowBreaks", "rowBreaks"], ["colBreaks", "columnBreaks"]]) p.registerVisitor({
2019
+ from: e,
2020
+ to: {},
2021
+ openTag: () => {
2022
+ me = t;
2023
+ }
2024
+ });
2025
+ p.registerVisitor({
2026
+ from: "brk",
2027
+ to: null,
2028
+ openTag: (e) => {
2029
+ if (k) return;
2030
+ let t = e.getAttribute("id", Q);
2031
+ if (t == null) return;
2032
+ let n = { index: t }, r = e.getAttribute("min", Q);
2033
+ r != null && (n.min = r);
2034
+ let i = e.getAttribute("max", Q);
2035
+ i != null && (n.max = i), !0 !== e.getAttribute("man", Z) && (n.automatic = !0), !0 === e.getAttribute("pt", Z) && (n.pivot = !0);
2036
+ let a = A();
2037
+ (a[me] ??= []).push(n);
2038
+ }
2039
+ }), p.registerVisitor({
2040
+ from: "ignoredErrors",
2041
+ transparent: !0
2042
+ }), p.registerVisitor({
2043
+ from: "ignoredError",
2044
+ to: null,
2045
+ openTag: (t) => {
2046
+ let n = t.getAttribute("sqref");
2047
+ if (!n) return;
2048
+ let r = [];
2049
+ for (let e of c) !0 === t.getAttribute(e, Z) && r.push(e);
2050
+ if (r.length !== 0) for (let t of n.trim().split(/\s+/)) (e.ignoredErrors ??= []).push({
2051
+ r: t,
2052
+ v: r
2053
+ });
2054
+ }
2055
+ }), p.registerVisitor({
2056
+ from: "mergeCells",
2057
+ to: "merges",
2058
+ openTag: (e) => {
2059
+ e.setSource([]);
2060
+ }
2061
+ }), p.registerVisitor({
2062
+ from: "dataValidations",
2063
+ to: "validations",
2064
+ openTag: (t) => {
2065
+ t.setSource([]);
2066
+ let n = {};
2067
+ !0 === t.getAttribute("disablePrompts", Z) && (n.disablePrompts = !0);
2068
+ let r = t.getAttribute("xWindow", Q);
2069
+ r !== null && (n.windowX = r);
2070
+ let i = t.getAttribute("yWindow", Q);
2071
+ i !== null && (n.windowY = i), Object.keys(n).length > 0 && (e.validationSettings = {
2072
+ ...e.validationSettings,
2073
+ ...n
2074
+ });
2075
+ }
2076
+ });
2077
+ let he = {
2078
+ from: "dataValidation",
2079
+ to: [],
2080
+ openTag: (e) => {
2081
+ let t = e.getAttribute("sqref");
2082
+ t &&= t.trim().split(/\s+/).join(",");
2083
+ let n = {}, r = {
2084
+ r: t,
2085
+ v: n,
2086
+ rule: {
2087
+ type: e.getAttribute("type") ?? void 0,
2088
+ operator: e.getAttribute("operator") ?? void 0
2089
+ }
2090
+ };
2091
+ !0 === e.getAttribute("showDropDown", Z) && (n.hideDropdown = !0), e.copyToObject(n, "alert", $, "error"), e.copyToObject(n, "alertTitle", $, "errorTitle"), e.copyToObject(n, "showAlertMessage", Z, "showErrorMessage"), n.alertStyle = e.getAttribute("errorStyle") ?? "stop", e.copyToObject(n, "imeMode"), e.copyToObject(n, "prompt"), e.copyToObject(n, "promptTitle"), e.copyToObject(n, "showPromptMessage", Z, "showInputMessage"), e.setSource(r);
2092
+ },
2093
+ closeTag: (e) => {
2094
+ let t = e.getSource();
2095
+ if (!t?.rule) return;
2096
+ let n = v(t.rule, s);
2097
+ n && (e.getAttribute("allowBlank", Z) && (n.includeBlanks = !0), t.v.condition = n), delete t.rule;
2098
+ }
2099
+ };
2100
+ p.registerVisitor(he), p.registerVisitor({
2101
+ from: "formula1",
2102
+ to: {},
2103
+ text: (e, t) => {
2104
+ let n = t.getParent().rule;
2105
+ n?.type && (n.formula1 = ie(b(e), n.type));
2106
+ }
2107
+ }), p.registerVisitor({
2108
+ from: "formula2",
2109
+ to: {},
2110
+ text: (e, t) => {
2111
+ let n = t.getParent().rule;
2112
+ n?.type && (n.formula2 = ie(b(e), n.type));
2113
+ }
2114
+ }), p.registerVisitor({
2115
+ from: "picture",
2116
+ to: "picture",
2117
+ openTag: (e) => {
2118
+ let n = e.getAttribute("r:id");
2119
+ if (!n) return void e.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.sheet.picture.noRel" });
2120
+ let r = t(n, "resource");
2121
+ e.getSource().resId = r;
2122
+ }
2123
+ });
2124
+ let ge = {
2125
+ from: "slicer",
2126
+ to: {},
2127
+ openTag: (e) => {
2128
+ let n = e.getAttribute("r:id");
2129
+ if (!n) return void e.warn("A slicer names no cache; it was not imported.", { onceKey: "xlsx.sheet.slicer.noRel" });
2130
+ let r = t(n)?.slicers, i = e.getParent();
2131
+ i.slicers ||= {};
2132
+ let a = Object.keys(r);
2133
+ for (let e of a) i.slicers[e] = r[e];
2134
+ }
2135
+ };
2136
+ p.registerVisitor(ge);
2137
+ let _e = (e, t) => ({
2138
+ from: e,
2139
+ to: {},
2140
+ openTag: (e) => {
2141
+ e.setSource("");
2142
+ },
2143
+ text: (e, t) => {
2144
+ t.setSource((t.getSource() ?? "") + e);
2145
+ },
2146
+ closeTag: (e) => {
2147
+ t(String(e.getSource() ?? ""), e);
2148
+ }
2149
+ }), ve = /* @__PURE__ */ new Map();
2150
+ ve.set("dataValidations", {
2151
+ from: "dataValidations",
2152
+ to: "validations",
2153
+ openTag: (e) => {
2154
+ let t = e.getParent();
2155
+ e.setSource(t.validations ?? []);
2156
+ },
2157
+ closeTag: (e) => {
2158
+ (e.getSource()?.length ?? 0) === 0 && e.setSource(void 0);
2159
+ }
2160
+ }), ve.set("dataValidation", {
2161
+ ...he,
2162
+ closeTag: (e) => {
2163
+ he.closeTag(e);
2164
+ let t = e.getSource();
2165
+ t && !t.r && (e.warn("x14 dataValidation with no xm:sqref was dropped."), e.setSource(void 0));
2166
+ }
2167
+ });
2168
+ let ye = (e) => ({
2169
+ from: e,
2170
+ to: {},
2171
+ openTag: (t) => {
2172
+ t.setSource({
2173
+ rule: t.getParent()?.rule,
2174
+ key: e
2175
+ });
2176
+ }
2177
+ });
2178
+ ve.set("formula1", ye("formula1")), ve.set("formula2", ye("formula2")), ve.set("f", _e("f", (e, t) => {
2179
+ let n = t.getParent(), r = n?.rule;
2180
+ r && (r[n.key] = ie(b(e), r.type));
2181
+ })), ve.set("sqref", _e("sqref", (e, t) => {
2182
+ let n = t.getParent(), r = e.trim();
2183
+ n && r && (n.r = r.split(/\s+/).join(","));
2184
+ }));
2185
+ let xe = /* @__PURE__ */ new Map(), Ce = [], I = /* @__PURE__ */ new Map();
2186
+ I.set("conditionalFormattings", {
2187
+ from: "conditionalFormattings",
2188
+ transparent: !0
2189
+ }), I.set("conditionalFormatting", {
2190
+ from: "conditionalFormatting",
2191
+ to: {},
2192
+ openTag: (e) => {
2193
+ e.setSource({ rules: [] });
2194
+ },
2195
+ closeTag: (e) => {
2196
+ let t = e.getSource(), n = t?.rules ?? [];
2197
+ for (let e = 0; e < n.length; e++) {
2198
+ let r = n[e];
2199
+ r.sqref = t.sqref, r.id ? xe.set(r.id, r) : Ce.push(r);
2200
+ }
2201
+ }
2202
+ }), I.set("cfRule", {
2203
+ from: "cfRule",
2204
+ to: {},
2205
+ openTag: (e) => {
2206
+ e.copyTo("id", $), e.copyTo("type", $), e.copyTo("priority", Q), e.copyTo("stopIfTrue", Z), e.copyTo("operator", $), e.copyTo("text", $), e.copyTo("timePeriod", $), e.copyTo("aboveAverage", Z), e.copyTo("equalAverage", Z), e.copyTo("stdDev", Q), e.copyTo("bottom", Z), e.copyTo("percent", Z), e.copyTo("rank", Q);
2207
+ },
2208
+ closeTag: (e) => {
2209
+ let t = e.getSource();
2210
+ t && e.getParent()?.rules?.push(t);
2211
+ }
2212
+ }), I.set("sqref", _e("sqref", (e, t) => {
2213
+ let n = t.getParent(), r = e.trim();
2214
+ n && r && (n.sqref = r);
2215
+ })), I.set("dataBar", {
2216
+ from: "dataBar",
2217
+ to: {},
2218
+ openTag: (e) => {
2219
+ e.copyTo("minLength", Q), e.copyTo("maxLength", Q), e.copyTo("gradient", Z), e.copyTo("border", Z), e.copyTo("direction", $), e.copyTo("axisPosition", $), e.copyTo("negativeBarColorSameAsPositive", Z), e.copyTo("negativeBarBorderColorSameAsPositive", Z);
2220
+ },
2221
+ closeTag: (e) => {
2222
+ e.getParent().dataBar = e.getSource();
2223
+ }
2224
+ }), I.set("iconSet", {
2225
+ from: "iconSet",
2226
+ to: {},
2227
+ openTag: (e) => {
2228
+ e.copyTo("iconSet", $), e.copyTo("custom", Z), e.copyTo("reverse", Z), e.copyTo("showValue", Z);
2229
+ },
2230
+ closeTag: (e) => {
2231
+ e.getParent().iconSet = e.getSource();
2232
+ }
2233
+ });
2234
+ let L = /* @__PURE__ */ new Map();
2235
+ L.set("f", _e("f", (e, t) => {
2236
+ let n = t.getParent();
2237
+ if (!n) return;
2238
+ let r = e.trim(), i = Number(r);
2239
+ n.value = r.length > 0 && Number.isFinite(i) ? i : b(e);
2240
+ })), I.set("cfvo", {
2241
+ from: "cfvo",
2242
+ to: {},
2243
+ scope: () => L,
2244
+ openTag: (e) => {
2245
+ let t = e.getParent();
2246
+ t.conditions ||= [];
2247
+ let n = e.getSource();
2248
+ t.conditions.push(n), e.copyTo("type", $), !1 === e.getAttribute("gte", Z) && (n.exclusive = !0);
2249
+ }
2250
+ }), I.set("f", _e("f", (e, t) => {
2251
+ let n = t.getParent();
2252
+ n && (n.formulas ??= []).push(b(e));
2253
+ })), I.set("dxf", {
2254
+ from: "dxf",
2255
+ to: {},
2256
+ raw: !0,
2257
+ closeTag: (e) => {
2258
+ if (!g) return;
2259
+ let t = e.getParent();
2260
+ if (!t) return;
2261
+ let n = g(e.getRawXml() ?? "");
2262
+ n && (t.style = n);
2263
+ }
2264
+ });
2265
+ let De = (e) => ({
2266
+ from: e,
2267
+ to: {},
2268
+ openTag: (t) => {
2269
+ let n = D((e) => t.getAttribute(e));
2270
+ n && (t.getParent()[e] = n);
2271
+ }
2272
+ });
2273
+ I.set("borderColor", De("borderColor")), I.set("negativeFillColor", De("negativeFillColor")), I.set("negativeBorderColor", De("negativeBorderColor")), I.set("axisColor", De("axisColor")), I.set("cfIcon", {
2274
+ from: "cfIcon",
2275
+ to: {},
2276
+ openTag: (e) => {
2277
+ let t = e.getAttribute("iconSet"), n = e.getAttribute("iconId", Q);
2278
+ if (t === null || n === null) return;
2279
+ let r = e.getParent();
2280
+ r.icons ||= [], r.icons.push({
2281
+ set: t,
2282
+ id: n
2283
+ });
2284
+ }
2285
+ });
2286
+ let Oe = /* @__PURE__ */ new Map();
2287
+ Oe.set("id", _e("id", (e, t) => {
2288
+ let n = t.getParent(), r = e.trim();
2289
+ n && r && (n.x14Id = r);
2290
+ }));
2291
+ let ke = /* @__PURE__ */ new Map();
2292
+ ke.set("slicerList", {
2293
+ from: "slicerList",
2294
+ transparent: !0
2295
+ }), ke.set("slicer", ge);
2296
+ let R = /* @__PURE__ */ new Map([
2297
+ [P(le), ve],
2298
+ [P(pe), I],
2299
+ [P(j), I],
2300
+ [P(F), Oe],
2301
+ [P(C), ke],
2302
+ [P(Ae), ke],
2303
+ [P(Te), ce]
2304
+ ]), Me = /* @__PURE__ */ new Set();
2305
+ p.registerVisitor({
2306
+ from: "extLst",
2307
+ transparent: !0
2308
+ }), p.registerVisitor({
2309
+ from: "ext",
2310
+ transparent: !0,
2311
+ scope: (e) => {
2312
+ let t = e.getAttribute("uri"), n = P(t), i = R.get(n);
2313
+ if (i) return i;
2314
+ if (!a.has(n) && !Me.has(n)) {
2315
+ Me.add(n);
2316
+ let i = r[n];
2317
+ e.warn(i ? `Extension content '${i}' (${t}) is not read; it will be lost on resave.` : `Unknown extension content (uri ${t}) is not read; it will be lost on resave.`);
2318
+ }
2319
+ return null;
2320
+ }
2321
+ }), p.registerVisitor({
2322
+ from: "mergeCell",
2323
+ to: [],
2324
+ openTag: (e) => {
2325
+ let t = e.getAttribute("ref");
2326
+ e.setSource(t);
2327
+ }
2328
+ }), p.registerVisitor({
2329
+ from: "hyperlinks",
2330
+ to: "hyperlinks",
2331
+ openTag: (e) => {
2332
+ e.setSource([]);
2333
+ }
2334
+ }), p.registerVisitor({
2335
+ from: "hyperlink",
2336
+ to: [],
2337
+ openTag: (e) => {
2338
+ let n = e.getAttribute("r:id"), r = e.getAttribute("ref");
2339
+ if (!r) return void e.warn("A hyperlink has no ref; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.noRef" });
2340
+ e.setKey(r);
2341
+ let i = n ? t(n) : "";
2342
+ if (typeof i != "string") return void e.warn("A hyperlink has an invalid address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2343
+ i.endsWith("\\") && (i = i.substring(0, i.length - 1));
2344
+ let a = e.getAttribute("location");
2345
+ if (a && (i += "#" + a), !i) return void e.warn("A hyperlink has no address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2346
+ let o, s = e.getAttribute("tooltip"), c = e.getAttribute("display");
2347
+ s || c ? (o = { address: i }, s && (o.screenTip = s), c && (o.display = c)) : o = i, e.setSource({
2348
+ r,
2349
+ v: o
2350
+ });
2351
+ }
2352
+ }), p.registerVisitor({
2353
+ from: "drawing",
2354
+ to: "movables",
2355
+ openTag: (e) => {
2356
+ let n = e.getAttribute("r:id");
2357
+ if (!n) return;
2358
+ let r = t(n);
2359
+ r ? e.setSource(r.movables) : e.warn("A drawing part is missing; its shapes were not imported.", { onceKey: "xlsx.sheet.drawing.missing" });
2360
+ }
2361
+ }), p.registerVisitor({
2362
+ from: "legacyDrawing",
2363
+ to: "legacyDrawing",
2364
+ openTag: (e) => {
2365
+ e.setSource(t(e.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2366
+ }
2367
+ }), p.registerVisitor({
2368
+ from: "legacyDrawingHF",
2369
+ to: "legacyDrawingHF",
2370
+ openTag: (e) => {
2371
+ e.setSource(t(e.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2372
+ }
2373
+ });
2374
+ let z = null, Ne = !1, Pe = /* @__PURE__ */ new Map(), B = {
2375
+ from: "Fallback",
2376
+ to: null
2377
+ }, Fe = {
2378
+ from: "Choice",
2379
+ transparent: !0
2380
+ };
2381
+ Pe.set("Fallback", B), Pe.set("Choice", Fe), Pe.set("control", {
2382
+ from: "control",
2383
+ transparent: !0,
2384
+ openTag: (e) => {
2385
+ let n = e.getAttribute("name"), r = e.getAttribute("r:id"), i = r ? t(r, "formControl") : null;
2386
+ if (!i) return e.warn(`The form control '${n ?? ""}' has no properties and was not read.`, { onceKey: "xlsx.sheet.control.noProperties" }), void (z = null);
2387
+ let a = i.json, o = parseInt(e.getAttribute("shapeId") ?? "", 10);
2388
+ isNaN(o) || (a.shapeId = o);
2389
+ let s = {
2390
+ anchor: {
2391
+ tl: {
2392
+ c: 0,
2393
+ r: 0,
2394
+ x: 0,
2395
+ y: 0
2396
+ },
2397
+ br: {
2398
+ c: 0,
2399
+ r: 0,
2400
+ x: 0,
2401
+ y: 0
2402
+ }
2403
+ },
2404
+ content: {
2405
+ type: i.type,
2406
+ json: a
2407
+ }
2408
+ };
2409
+ n && (s.content.name = n), z = {
2410
+ movable: s,
2411
+ control: a
2412
+ };
2413
+ },
2414
+ closeTag: () => {
2415
+ z &&= (e.movables ||= [], e.movables.push(z.movable), null);
2416
+ }
2417
+ }), Pe.set("controlPr", {
2418
+ from: "controlPr",
2419
+ transparent: !0,
2420
+ raw: !0,
2421
+ openTag: (e) => {
2422
+ if (!z) return;
2423
+ let t = e.getFrom().attributes ?? {}, n = {};
2424
+ for (let e in t) {
2425
+ let r = t[e];
2426
+ n[e] = typeof r == "string" ? r : r?.value ?? "";
2427
+ }
2428
+ fe(n, z.control);
2429
+ },
2430
+ closeTag: (e) => {
2431
+ if (!z) return;
2432
+ let t = ((e) => {
2433
+ let t = /<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(e);
2434
+ if (!t) return null;
2435
+ let n = t[2], r = (e) => RegExp(`<(?:[\\w.-]+:)?${e}\\b[^>]*>([\\s\\S]*?)<\\/(?:[\\w.-]+:)?${e}>`).exec(n)?.[1], i = t[1], a = /\bmoveWithCells="(?:1|true)"/.test(i), o = /\bsizeWithCells="(?:1|true)"/.test(i);
2436
+ return {
2437
+ anchor: {
2438
+ tl: Tn(r("from")),
2439
+ br: Tn(r("to"))
2440
+ },
2441
+ anchorType: a ? o ? "twoCell" : "oneCell" : "absolute",
2442
+ rest: (e.slice(0, t.index) + e.slice(t.index + t[0].length)).trim()
2443
+ };
2444
+ })(e.getRawXml() ?? "");
2445
+ t ? (z.movable.anchor = t.anchor, t.anchorType !== "twoCell" && (z.movable.anchorType = t.anchorType), t.rest && (z.control.xml = t.rest)) : Ne || (Ne = !0, e.warn("A form control has no anchor; it is placed at the top left of the sheet."));
2446
+ }
2447
+ });
2448
+ let Ie = {
2449
+ from: "controls",
2450
+ transparent: !0,
2451
+ scope: () => Pe
2452
+ };
2453
+ p.registerVisitor(Ie);
2454
+ let Le = /* @__PURE__ */ new Map([
2455
+ ["Choice", Fe],
2456
+ ["Fallback", B],
2457
+ ["controls", Ie]
2458
+ ]);
2459
+ p.registerVisitor({
2460
+ from: "AlternateContent",
2461
+ transparent: !0,
2462
+ scope: () => Le
2463
+ }), p.registerVisitor({
2464
+ from: "tableParts",
2465
+ to: "tables",
2466
+ openTag: (e) => {
2467
+ e.setSource([]);
2468
+ }
2469
+ }), p.registerVisitor({
2470
+ from: "tablePart",
2471
+ to: [],
2472
+ openTag: (e) => {
2473
+ let n = e.getAttribute("r:id");
2474
+ if (!n) return;
2475
+ let r = t(n);
2476
+ r ? e.setSource(r) : e.warn("A table part is missing; the table was not imported.", { onceKey: "xlsx.sheet.table.missing" });
2477
+ }
2478
+ });
2479
+ let Re = (e, t) => {
2480
+ t.conditions?.length && (e.stops = re(t)), t.minLength !== void 0 && (e.minLength = t.minLength), t.maxLength !== void 0 && (e.maxLength = t.maxLength), (t.gradient ?? 1) && (e.gradient = !0), t.border && t.borderColor && (e.borderColor = t.borderColor), !t.negativeBarColorSameAsPositive && t.negativeFillColor && (e.negativeFillColor = t.negativeFillColor), !(t.negativeBarBorderColorSameAsPositive ?? 1) && t.negativeBorderColor && (e.negativeBorderColor = t.negativeBorderColor), t.axisColor && (e.axisColor = t.axisColor), t.axisPosition !== "middle" && t.axisPosition !== "none" || (e.axisPosition = t.axisPosition), t.direction !== "leftToRight" && t.direction !== "rightToLeft" || (e.direction = t.direction);
2481
+ }, ze = (e, t) => {
2482
+ t.conditions?.length && (e.stops = re(t)), t.iconSet && t.iconSet !== e.iconSet && (e.iconSet = t.iconSet), t.icons?.length && (e.icon = t.icons), t.reverse !== void 0 && (e.reverse = t.reverse), t.showValue !== void 0 && (e.showValue = t.showValue);
2483
+ }, W = (e) => {
2484
+ if (!e.sqref) return null;
2485
+ let t = e.sqref.split(/\s+/).join(",");
2486
+ if (e.type === "iconSet") {
2487
+ if (!e.iconSet) return null;
2488
+ let n = {
2489
+ type: U.ScaleType.IconSet,
2490
+ stops: []
2491
+ };
2492
+ return ze(n, e.iconSet), {
2493
+ r: t,
2494
+ v: { scale: n },
2495
+ priority: e.priority
2496
+ };
2497
+ }
2498
+ let n = O(e, s);
2499
+ if (!n) return null;
2500
+ let r = { condition: n };
2501
+ return e.style && (r.style = e.style), e.stopIfTrue && (r.stopIfTrue = !0), {
2502
+ r: t,
2503
+ v: r,
2504
+ priority: e.priority
2505
+ };
2506
+ };
2507
+ p.registerVisitor({
2508
+ from: "worksheet",
2509
+ to: {},
2510
+ openTag: (e) => {},
2511
+ closeTag: (e) => {
2512
+ let t = e.getSource(), n = t?.conditionals;
2513
+ if (n) for (let e = 0; e < n.length; e++) {
2514
+ let t = n[e], r = t.x14Id;
2515
+ if (!r) continue;
2516
+ delete t.x14Id;
2517
+ let i = xe.get(r);
2518
+ if (!i) continue;
2519
+ xe.delete(r);
2520
+ let a = t.v?.scale;
2521
+ i.dataBar && a?.type === U.ScaleType.DataBar ? Re(a, i.dataBar) : i.iconSet && a?.type === U.ScaleType.IconSet && ze(a, i.iconSet);
2522
+ }
2523
+ let r = [...xe.values(), ...Ce], i = /* @__PURE__ */ new Set(), a = 0;
2524
+ for (let e = 0; e < r.length; e++) {
2525
+ let o = W(r[e]);
2526
+ o ? (n || (n = [], t.conditionals = n), n.push(o)) : (i.add(r[e].type ?? "unknown"), a++);
2527
+ }
2528
+ if (a > 0) {
2529
+ let e = [...i].map((e) => `'${e}'`).join(", ");
2530
+ s?.(a === 1 ? `An x14-only conditional formatting rule (type ${e}) is not read and will be lost on resave.` : `${a} x14-only conditional formatting rules (types ${e}) are not read and will be lost on resave.`);
2531
+ }
2532
+ if (n) {
2533
+ n.length > 1 && n.sort((e, t) => (e.priority ?? 1 / 0) - (t.priority ?? 1 / 0));
2534
+ for (let e = 0; e < n.length; e++) delete n[e].priority;
2535
+ }
2536
+ }
2537
+ }), p.registerVisitor({
2538
+ from: "customProperties",
2539
+ to: "customProperties",
2540
+ openTag: (e) => {
2541
+ e.setSource([]);
2542
+ },
2543
+ closeTag: (e) => {
2544
+ let t = e.getSource();
2545
+ t.length > 0 && (e.getParent().customProperties = t);
2546
+ }
2547
+ }), p.registerVisitor({
2548
+ from: "customPr",
2549
+ to: {},
2550
+ openTag: (e) => {
2551
+ let n = e.getParent();
2552
+ e.copyTo("name");
2553
+ let r = e.getAttribute("r:id");
2554
+ if (!r) return void e.warn("A custom property names no part; it was not imported.", { onceKey: "xlsx.sheet.customProperty.noRel" });
2555
+ let i = t(r, "resource"), a = e.getSource();
2556
+ a.resId = i, n.push(a);
2557
+ }
2558
+ }), p.registerVisitor({
2559
+ from: "sheetProtection",
2560
+ to: "protection",
2561
+ openTag: (e) => {
2562
+ let t = e.getSource();
2563
+ for (let n of w) {
2564
+ let r = e.hasAttribute(n.attribute) ? e.getAttribute(n.attribute) : null;
2565
+ t[n.key] = je(n, r);
2566
+ }
2567
+ if (t.sheet) return;
2568
+ let n = {};
2569
+ e.copyToObject(n, "hash", $, "hashValue"), e.copyToObject(n, "algorithm", $, "algorithmName"), e.copyToObject(n, "salt", $, "saltValue"), e.copyToObject(n, "spinCount", Q), e.copyToObject(n, "legacyHash", $, "password"), Object.keys(n).length > 0 && (e.getSource().password = n);
2570
+ }
2571
+ }), p.registerVisitor({
2572
+ from: "protectedRanges",
2573
+ to: "protectedRanges",
2574
+ openTag: (e) => {
2575
+ e.setSource([]);
2576
+ }
2577
+ }), p.registerVisitor({
2578
+ from: "protectedRange",
2579
+ to: [],
2580
+ openTag: (e) => {
2581
+ let t = e.getAttribute("sqref");
2582
+ t &&= t.trim().split(/\s+/).join(",");
2583
+ let n = {}, r = {
2584
+ r: t,
2585
+ v: n
2586
+ };
2587
+ e.copyToObject(n, "name"), e.copyToObject(n, "securityDescriptor");
2588
+ let i = {};
2589
+ e.copyToObject(i, "hash", $, "hashValue"), e.copyToObject(i, "algorithm", $, "algorithmName"), e.copyToObject(i, "salt", $, "saltValue"), e.copyToObject(i, "spinCount", Q), e.copyToObject(i, "legacyHash", $, "password"), Object.keys(i).length > 0 && (n.password = i), e.setSource(r);
2590
+ },
2591
+ closeTag: (e) => {
2592
+ let t = e.getSource();
2593
+ t?.r && t.v.name || e.setSource(void 0);
2594
+ }
2595
+ }), p.registerVisitor({
2596
+ from: "sheetFormatPr",
2597
+ to: "sheetFormatPr",
2598
+ openTag: (t) => {
2599
+ t.copyToObject(e, "defaultColSize", $t, "defaultColWidth");
2600
+ let n = t.getAttribute("customHeight");
2601
+ n !== "1" && n !== "true" || t.copyToObject(e, "defaultRowSize", $t, "defaultRowHeight");
2602
+ let r = t.getAttribute("baseColWidth", Q);
2603
+ r && r !== 8 && (e.baseColSize = r), h = !!t.getAttribute("zeroHeight", Z);
2604
+ }
2605
+ }), p.registerVisitor({
2606
+ from: "cols",
2607
+ to: "cols",
2608
+ openTag: (e) => {
2609
+ e.setSource([]);
2610
+ }
2611
+ }), p.registerVisitor({
2612
+ from: "col",
2613
+ to: [],
2614
+ openTag: (e) => {
2615
+ let t = e.getSource(), n = e.getAttribute("min"), r = e.getAttribute("max"), i = n === void 0 ? 0 : parseInt(n) - 1, a = r === void 0 ? i : parseInt(r) - 1;
2616
+ t.r = V.runToString(i, a, !0);
2617
+ let o = {};
2618
+ t.v = o, e.copyToObject(o, "sz", $t, "width"), e.copyToObject(o, "csz", Z, "customWidth"), e.copyToObject(o, "h", Z, "hidden"), e.copyToObject(o, "l", Q, "outlineLevel"), e.copyToObject(o, "cl", Z, "collapsed"), e.getAttribute("bestFit", Z) && (o.bf = !0), e.copyToObject(o, "s", Q, "style");
2619
+ }
2620
+ }), p.registerVisitor({
2621
+ from: "oleObjects",
2622
+ to: null,
2623
+ openTag: (e) => {
2624
+ e.warn("'OLE Objects' are not supported.");
2625
+ }
2626
+ });
2627
+ let Be = !1, He = !1, Ue = 0, We = "", Ke = (e) => {
2628
+ let t = e.indexOf(":");
2629
+ return t === -1 ? e : e.slice(t + 1);
2630
+ }, Je = new xn();
2631
+ return In(ee, e, p.createEventHandler(e, o, s), s, d, {
2632
+ onOpenTag: (e) => {
2633
+ Be = !0;
2634
+ let t = Ke(e.name);
2635
+ t === "t" || t === "v" ? Ue === 0 && (He = !0) : t === "rPh" || t === "phoneticPr" ? Ue++ : Ue === 0 && Je.onOpenTag(t, e.attributes);
2636
+ },
2637
+ onText: (e) => {
2638
+ He && (We += e, Je.onText(e));
2639
+ },
2640
+ onCloseTag: (e) => {
2641
+ let t = Ke(e.name);
2642
+ t === "t" || t === "v" ? He = !1 : t === "rPh" || t === "phoneticPr" ? Ue > 0 && Ue-- : Je.onCloseTag(t);
2643
+ },
2644
+ onEnd: () => {
2645
+ if (!Be) return;
2646
+ let e = Je.take();
2647
+ Be = !1, He = !1, Ue = 0;
2648
+ let t = l(We);
2649
+ return We = "", e ? {
2650
+ t: "r",
2651
+ v: {
2652
+ type: "richText",
2653
+ data: { runs: Sn(e, f?.get(kn)) }
2654
+ }
2655
+ } : n(t);
2656
+ },
2657
+ onError: (e) => {}
2658
+ }, f, n, () => h);
2659
+ }, jn = class {
2660
+ static {
2661
+ this.Collapsed = 1;
2662
+ }
2663
+ static {
2664
+ this.CustomFormat = 2;
2665
+ }
2666
+ static {
2667
+ this.CustomHeight = 4;
2668
+ }
2669
+ static {
2670
+ this.Hidden = 8;
2671
+ }
2672
+ static {
2673
+ this.Ht = 16;
2674
+ }
2675
+ static {
2676
+ this.OutlineLevel = 32;
2677
+ }
2678
+ static {
2679
+ this.Ph = 64;
2680
+ }
2681
+ static {
2682
+ this.R = 128;
2683
+ }
2684
+ static {
2685
+ this.S = 256;
2686
+ }
2687
+ static {
2688
+ this.Spans = 512;
2689
+ }
2690
+ }, Mn = (e, t, n) => {
2691
+ if (e[0].value[0] === e[1].value[0]) return t;
2692
+ }, Nn = /^\s*TABLE\s*\(/i, Pn = {
2693
+ colStart: 0,
2694
+ colEnd: 0,
2695
+ rowStart: 0,
2696
+ rowEnd: 0
2697
+ }, Fn = (e) => e === "1" || e === "true", In = (e, t, n, r, i, a, o, s, c) => {
2698
+ let l = !1, u = [], d = o?.get(On), f = o?.get(kn), p = /* @__PURE__ */ new Map(), m = !1, h = [], g = !1, _ = null, v = null, y = null, b = null, ee = null, x = null, te = o?.get("richData") ?? Fe.EmptyArray, ne = o?.get("dummyWrapped") ?? null, re = V.normalizeA1ToR1C1, ie = Ie.createConflatingRanges(), ae = /* @__PURE__ */ new Map(), oe = [], se = !1, ce = !1, le = null, S = (e) => {
2699
+ let t = o?.get("metadata")?.values;
2700
+ if (!t) return;
2701
+ let n = parseInt(e, 10);
2702
+ if (!Number.isFinite(n) || n < 1) return;
2703
+ let r = t[n - 1]?.get("XLRICHVALUE");
2704
+ return r?.richValueIndex === void 0 ? void 0 : te[r.richValueIndex];
2705
+ }, C = !1, w = Ie.createConflatingRanges(), T = !1, E = -1, D = -1, O = null, ue = null, de = null, k = [], A = null, j = -2, M = 0, fe = "", pe = "", N = "", P = "", me = "", F = "", he = "", ge = "", ve = "", ye = "", be = "", xe = "", Se = "", Ce = "", we = !0, I = null, L = !1, Te = !1, Ee = !1, De = null, Oe = 0, ke = (e) => {
2706
+ let r = e.name, s = r.indexOf(":");
2707
+ if (s !== -1 && (r = r.slice(s + 1)), Oe++, Oe % 196608 == 0 && i?.(Oe), ue) {
2708
+ let n = e.attributes;
2709
+ switch (r) {
2710
+ case "v":
2711
+ m = !0;
2712
+ break;
2713
+ case "f":
2714
+ switch (g = !0, n.t ?? null) {
2715
+ case null:
2716
+ case "normal": break;
2717
+ case "shared":
2718
+ let e = n.si;
2719
+ v = n.ref, _ = e;
2720
+ break;
2721
+ case "array":
2722
+ v = n.ref, le = v;
2723
+ break;
2724
+ case "dataTable": {
2725
+ let e = ((e, t, n) => {
2726
+ let r = e.r1;
2727
+ if (!r) return null;
2728
+ let i = { ref: e.ref ?? V.cellToString({
2729
+ rowIndex: t,
2730
+ colIndex: n
2731
+ }) }, a = Fn(e.del1);
2732
+ if (Fn(e.dt2D)) {
2733
+ i.rowInput = r, a && (i.rowInputDeleted = !0);
2734
+ let t = e.r2;
2735
+ t && (i.columnInput = t, Fn(e.del2) && (i.columnInputDeleted = !0));
2736
+ } else Fn(e.dtr) ? (i.rowInput = r, a && (i.rowInputDeleted = !0)) : (i.columnInput = r, a && (i.columnInputDeleted = !0));
2737
+ return Fn(e.ca) && (i.calculateAlways = !0), i;
2738
+ })(n, E, D);
2739
+ e && (t.dataTables ??= []).push(e);
2740
+ return;
2741
+ }
2742
+ }
2743
+ let e = n.ca;
2744
+ e !== void 0 && (C = e === "1");
2745
+ break;
2746
+ case "is":
2747
+ T = !0;
2748
+ return;
2749
+ }
2750
+ T && !g && a?.onOpenTag?.(e);
2751
+ } else if (l) {
2752
+ if (r === "c") {
2753
+ ue = e;
2754
+ let t = e.attributes, n = t.r;
2755
+ D = n === void 0 ? D + 1 : V.fastStringToCol(n);
2756
+ let r = t.t;
2757
+ r === void 0 ? de = null : (de = r, de === "str" && (T = !0));
2758
+ let i = t.s;
2759
+ i === void 0 && (De !== null || Ee) && (i = "0"), i !== void 0 && (i = parseInt(i), I && I.value === i && I.colEnd + 1 === D ? I.colEnd = D : (I = {
2760
+ colStart: D,
2761
+ rowStart: E,
2762
+ colEnd: D,
2763
+ rowEnd: E,
2764
+ value: i
2765
+ }, h.push(I))), le = null, ce = !1;
2766
+ let a = t.cm;
2767
+ se = a !== void 0 && ((e) => {
2768
+ let t = o?.get("metadata")?.cells;
2769
+ if (!t) return !1;
2770
+ let n = parseInt(e, 10);
2771
+ return !(!Number.isFinite(n) || n < 1) && !0 === t[n - 1]?.get("XLDAPR")?.fDynamic;
2772
+ })(a);
2773
+ let s = t.vm;
2774
+ if (s !== void 0) {
2775
+ let e = S(s);
2776
+ if (Le.isError(e)) {
2777
+ let t = e.getCode();
2778
+ O = {
2779
+ t: "e",
2780
+ v: t
2781
+ }, se && t === Le.Code.Spill && (ce = !0);
2782
+ }
2783
+ }
2784
+ }
2785
+ } else {
2786
+ if (Te && r === "row") {
2787
+ l = !0;
2788
+ let t = e.attributes.r;
2789
+ if (E = t === void 0 ? E + 1 : parseInt(t) - 1, D = -1, c?.()) {
2790
+ let e = u[u.length - 1];
2791
+ e && e.max + 1 === E ? e.max = E : u.push({
2792
+ min: E,
2793
+ max: E
2794
+ });
2795
+ }
2796
+ if (M = 0, pe = e.attributes.customHeight, pe !== void 0 && (M |= jn.CustomHeight), pe !== ve && (we = !0, ve = pe), fe = e.attributes.ht, fe !== void 0 && (M |= jn.Ht), fe !== ge && (we = !0, ge = fe), N = e.attributes.hidden, N !== void 0 && (M |= jn.Hidden), N !== ye && (we = !0, ye = N), me = e.attributes.s, me !== void 0 && (M |= jn.S), me !== xe && (we = !0, xe = me), P = e.attributes.customFormat, P !== void 0 && (M |= jn.CustomFormat), P !== be && (we = !0, be = P), F = e.attributes.outlineLevel, F !== void 0 && (M |= jn.OutlineLevel), F !== Se && (we = !0, Se = F), he = e.attributes.collapsed, he !== void 0 && (M |= jn.Collapsed), he !== Ce && (we = !0, Ce = he), M !== 0) {
2797
+ if (j + 1 !== E || we) {
2798
+ let e = pe !== void 0 && (pe === "1" || pe === "true"), t = P !== void 0 && (P === "1" || P === "true");
2799
+ De = t && me !== void 0 ? me : null, t && De === null && (De = "0"), A = {
2800
+ min: E,
2801
+ max: E,
2802
+ value: {
2803
+ sz: fe === void 0 ? -1 : parseFloat(fe),
2804
+ csz: e,
2805
+ h: N !== void 0 && (N === "1" || N === "true"),
2806
+ s: De === null ? void 0 : De === "0" ? 0 : parseInt(De),
2807
+ l: F === void 0 || F === "0" ? 0 : parseInt(F),
2808
+ cl: he !== void 0 && (he === "1" || he === "true")
2809
+ }
2810
+ }, k.push(A);
2811
+ } else A.max = E;
2812
+ }
2813
+ j = E, we = !1;
2814
+ return;
2815
+ }
2816
+ if (r === "sheetData" && (Te = !0), !L && r === "sheetData") {
2817
+ L = !0;
2818
+ let e = t.cols, n = e ? e.length : 0;
2819
+ for (let t = 0; !Ee && t < n; t++) e[t].v.s && (Ee = !0);
2820
+ }
2821
+ n?.onOpenTag?.(e);
2822
+ }
2823
+ }, Ae = (t) => {
2824
+ let r = t.name;
2825
+ if (r === "sheetData" && (Te = !1), !g || r !== "c" && r !== "f" || (_ && (b = ae.get(_) ?? null), b && (ie.append(E, D, b), C && w.append(E, D)), le !== null && oe.push([le, se ? ce ? "error" : "dynamic" : "fixed"]), g = !1, b = null, _ = null, v = null, m = !1, C = !1, le = null, se = !1, ce = !1), ue) {
2826
+ let n = r.indexOf(":");
2827
+ if (n !== -1 && (r = r.slice(n + 1)), T) {
2828
+ if (r === "is" || r === "v") {
2829
+ let t = a?.onEnd?.();
2830
+ t != null && e.pushAt(E, D, typeof t == "number" ? "" + t : t);
2831
+ } else r !== "f" && a?.onCloseTag?.(t);
2832
+ }
2833
+ m &&= !1, r === "c" && (ue = null, T = !1);
2834
+ } else {
2835
+ if (l) return l = !1, void (I = null);
2836
+ n?.onCloseTag?.(t);
2837
+ }
2838
+ }, je = (i) => {
2839
+ let c = i.trim();
2840
+ if (m) {
2841
+ switch (O = null, de) {
2842
+ case null:
2843
+ case "n":
2844
+ O = parseFloat(c);
2845
+ break;
2846
+ case "b":
2847
+ O = c === "1" || c === "true";
2848
+ break;
2849
+ case "s": {
2850
+ let e = parseInt(c, 10), t = p.get(e);
2851
+ if (t === void 0) {
2852
+ let n = d?.get(e);
2853
+ t = n ? Sn(n, f) : null, p.set(e, t);
2854
+ }
2855
+ O = t ? {
2856
+ t: "r",
2857
+ v: {
2858
+ type: "richText",
2859
+ data: { runs: t }
2860
+ }
2861
+ } : c;
2862
+ break;
2863
+ }
2864
+ case "d": {
2865
+ let e = ((e, t = !1) => {
2866
+ if (!e) return null;
2867
+ let n = _n.exec(e);
2868
+ if (n) {
2869
+ let [, e, t, r] = n;
2870
+ return e === void 0 && t === void 0 && r === void 0 ? null : (3600 * parseFloat(e ?? "0") + 60 * parseFloat(t ?? "0") + parseFloat(r ?? "0")) / 86400;
2871
+ }
2872
+ let r = gn.exec(e);
2873
+ if (!r) return null;
2874
+ let [, i, a, o, s, c, l, u] = r;
2875
+ if (i === void 0 && s === void 0) return null;
2876
+ let d = 0;
2877
+ if (i !== void 0) {
2878
+ let e = parseInt(i, 10), n = parseInt(a, 10), r = parseInt(o, 10);
2879
+ if (n < 1 || n > 12 || r < 1 || r > 31) return null;
2880
+ let s = vn(e, n, r) - yn;
2881
+ if (d = s <= 60 ? s - 1 : s, t && (d -= 1462), d < 0) return null;
2882
+ }
2883
+ return s !== void 0 && (d += (3600 * parseInt(s, 10) + 60 * parseInt(c, 10) + (l === void 0 ? 0 : parseInt(l, 10)) + (u === void 0 ? 0 : parseFloat(u))) / 86400), d;
2884
+ })(c, !0 === o?.get(Dn));
2885
+ e === null ? s && (r?.(`Date '${c}' in cell ${V.cellToString({
2886
+ colIndex: D,
2887
+ rowIndex: E
2888
+ })} is not a date this workbook can hold; kept as text.`, void 0, "xlsx.cell.isoDateText"), O = "" + s(c)) : O = e;
2889
+ break;
2890
+ }
2891
+ case "e":
2892
+ if (c === "#VALUE!") {
2893
+ let e = ue.attributes.vm;
2894
+ if (e !== void 0) {
2895
+ let t = S(e);
2896
+ if (Le.isError(t)) {
2897
+ O = {
2898
+ t: "e",
2899
+ v: t.getCode()
2900
+ };
2901
+ break;
2902
+ }
2903
+ }
2904
+ }
2905
+ let e = Le.getBuiltInByLabel(c);
2906
+ e ? O = {
2907
+ t: "e",
2908
+ v: e.getCode()
2909
+ } : (O = c, r?.(`Unknown formula error '${c}' in cell ${V.cellToString({
2910
+ colIndex: D,
2911
+ rowIndex: E
2912
+ })}`));
2913
+ break;
2914
+ case "str":
2915
+ case "inlineStr": T = !0;
2916
+ }
2917
+ O !== null && e.pushAt(E, D, O);
2918
+ }
2919
+ if (_) {
2920
+ if (ee === _) b = x;
2921
+ else {
2922
+ if (b = ae.get(_) ?? null, !b) {
2923
+ let e = [];
2924
+ y = re(c, E, D, e), b = [
2925
+ y,
2926
+ e,
2927
+ c
2928
+ ], ae.set(_, b);
2929
+ }
2930
+ ee = _, x = b;
2931
+ }
2932
+ _ = null;
2933
+ }
2934
+ if (g) {
2935
+ if (ne !== null) {
2936
+ let e = ((e) => {
2937
+ if (e.length < rn.length || e.slice(0, rn.length).toUpperCase() !== an) return sn;
2938
+ let t = ln(e, rn.length);
2939
+ if (t === null || e.charCodeAt(t.end) !== 41 || e.charCodeAt(t.end + 1) !== 44 || e.charCodeAt(e.length - 1) !== 41) return sn;
2940
+ let n = t.value;
2941
+ return n.toUpperCase() === on ? cn : n.length === 0 ? sn : {
2942
+ kind: "formula",
2943
+ formula: n
2944
+ };
2945
+ })(c);
2946
+ e.kind !== "none" && ne.push({
2947
+ sheet: t,
2948
+ rowIndex: E,
2949
+ colIndex: D,
2950
+ formula: e.kind === "formula" ? e.formula : null
2951
+ });
2952
+ }
2953
+ let e = [];
2954
+ y = re(c, E, D, e), b = [
2955
+ y,
2956
+ e,
2957
+ c
2958
+ ];
2959
+ }
2960
+ T ? a?.onText?.(i) : l || n?.onText?.(c);
2961
+ }, R = {
2962
+ r: void 0,
2963
+ t: void 0,
2964
+ s: void 0,
2965
+ cm: void 0,
2966
+ vm: void 0
2967
+ }, Me = {
2968
+ name: "c",
2969
+ attributes: R,
2970
+ isSelfClosing: !1
2971
+ }, z = {
2972
+ t: void 0,
2973
+ si: void 0,
2974
+ ref: void 0,
2975
+ ca: void 0
2976
+ }, Ne = {
2977
+ name: "f",
2978
+ attributes: z,
2979
+ isSelfClosing: !1
2980
+ }, Pe = {
2981
+ name: "v",
2982
+ attributes: {},
2983
+ isSelfClosing: !1
2984
+ }, B = {
2985
+ r: void 0,
2986
+ s: void 0,
2987
+ ht: void 0,
2988
+ hidden: void 0,
2989
+ collapsed: void 0,
2990
+ customHeight: void 0,
2991
+ customFormat: void 0,
2992
+ outlineLevel: void 0
2993
+ }, Re = {
2994
+ name: "row",
2995
+ attributes: B,
2996
+ isSelfClosing: !1
2997
+ }, ze = Qt.NEED_MORE, H = Qt.NOT_HANDLED, U = Qt.decodeText, W = !1, Be = (e, t, n, r) => {
2998
+ for (;;) {
2999
+ let i = 0;
3000
+ for (; t < n && ((i = e.charCodeAt(t)) === 32 || i === 9 || i === 10 || i === 13);) t++;
3001
+ if (t >= n) return ze;
3002
+ if (i === 62) return W = !1, t + 1;
3003
+ if (i === 47) return t + 1 >= n ? ze : e.charCodeAt(t + 1) === 62 ? (W = !0, t + 2) : H;
3004
+ let a = t;
3005
+ for (; t < n && (i = e.charCodeAt(t)) !== 61;) {
3006
+ if (i === 62 || i === 47 || i === 32 || i === 9 || i === 10 || i === 13) return H;
3007
+ t++;
3008
+ }
3009
+ if (t + 1 >= n) return ze;
3010
+ let o = t - a, s = e.charCodeAt(t + 1);
3011
+ if (s !== 34 && s !== 39) return H;
3012
+ let c = t + 2, l = c;
3013
+ for (; l < n && (i = e.charCodeAt(l)) !== s;) {
3014
+ if (i === 38 || i < 32) return H;
3015
+ l++;
3016
+ }
3017
+ if (l >= n) return ze;
3018
+ t = l + 1;
3019
+ let u = e.charCodeAt(a);
3020
+ if (r === 2) switch (o) {
3021
+ case 1:
3022
+ u === 114 ? B.r = e.slice(c, l) : u === 115 && (B.s = e.slice(c, l));
3023
+ break;
3024
+ case 2:
3025
+ e.startsWith("ht", a) && (B.ht = e.slice(c, l));
3026
+ break;
3027
+ case 6:
3028
+ e.startsWith("hidden", a) && (B.hidden = e.slice(c, l));
3029
+ break;
3030
+ case 9:
3031
+ e.startsWith("collapsed", a) && (B.collapsed = e.slice(c, l));
3032
+ break;
3033
+ case 12: e.startsWith("customHeight", a) ? B.customHeight = e.slice(c, l) : e.startsWith("customFormat", a) ? B.customFormat = e.slice(c, l) : e.startsWith("outlineLevel", a) && (B.outlineLevel = e.slice(c, l));
3034
+ }
3035
+ else if (r === 0) o === 1 ? u === 114 ? R.r = e.slice(c, l) : u === 116 ? R.t = e.slice(c, l) : u === 115 && (R.s = e.slice(c, l)) : o === 2 && e.charCodeAt(a + 1) === 109 && (u === 99 ? R.cm = e.slice(c, l) : u === 118 && (R.vm = e.slice(c, l)));
3036
+ else if (o === 1) u === 116 && (z.t = e.slice(c, l));
3037
+ else if (o === 2) {
3038
+ let t = e.charCodeAt(a + 1);
3039
+ u === 115 && t === 105 ? z.si = e.slice(c, l) : u === 99 && t === 97 && (z.ca = e.slice(c, l));
3040
+ } else o === 3 && e.startsWith("ref", a) && (z.ref = e.slice(c, l));
3041
+ }
3042
+ }, He = (e, t, n) => e.charCodeAt(t + 1) === 47 && e.charCodeAt(t + 2) === n && e.charCodeAt(t + 3) === 62;
3043
+ return {
3044
+ ...n,
3045
+ onEnd: () => {
3046
+ if (c?.()) {
3047
+ let e = 0, t = [], n = (e, t) => ({
3048
+ min: e,
3049
+ max: t,
3050
+ value: {
3051
+ sz: -1,
3052
+ csz: !1,
3053
+ h: !0,
3054
+ s: void 0,
3055
+ l: 0,
3056
+ cl: !1
3057
+ }
3058
+ });
3059
+ for (let r of u) r.min > e && t.push(n(e, r.min - 1)), e = Math.max(e, r.max + 1);
3060
+ e <= _e && t.push(n(e, _e)), t.length > 0 && (k.push(...t), k.sort((e, t) => e.min - t.min));
3061
+ }
3062
+ k.length > 0 && (t.rows = V.runsToRefs(k, !1));
3063
+ let r = ie.done(Mn);
3064
+ r = ((e, t) => {
3065
+ let n = null;
3066
+ for (let t = 0; t < e.length; t++) {
3067
+ let r = e[t];
3068
+ if (!Nn.test(r.value[2])) continue;
3069
+ n ??= /* @__PURE__ */ new Map();
3070
+ let i = r.value[0], a = n.get(i);
3071
+ a ? a.push(r) : n.set(i, [r]);
3072
+ }
3073
+ if (n === null) return e;
3074
+ let r = /* @__PURE__ */ new Set();
3075
+ for (let e of n.values()) {
3076
+ let n = e[0], i = {
3077
+ rowStart: n.rowStart,
3078
+ colStart: n.colStart,
3079
+ rowEnd: n.rowEnd,
3080
+ colEnd: n.colEnd
3081
+ }, a = 0;
3082
+ for (let t = 0; t < e.length; t++) {
3083
+ let n = e[t];
3084
+ n.rowStart < i.rowStart && (i.rowStart = n.rowStart), n.colStart < i.colStart && (i.colStart = n.colStart), n.rowEnd > i.rowEnd && (i.rowEnd = n.rowEnd), n.colEnd > i.colEnd && (i.colEnd = n.colEnd), a += (n.rowEnd - n.rowStart + 1) * (n.colEnd - n.colStart + 1);
3085
+ }
3086
+ if (a !== (i.rowEnd - i.rowStart + 1) * (i.colEnd - i.colStart + 1)) continue;
3087
+ let o = hn(V.resolveRelativeToA1(n.value[1], i.rowStart, i.colStart), i);
3088
+ if (o) {
3089
+ (t.dataTables ??= []).push(o);
3090
+ for (let t = 0; t < e.length; t++) r.add(e[t]);
3091
+ }
3092
+ }
3093
+ return r.size === 0 ? e : e.filter((e) => !r.has(e));
3094
+ })(r, t);
3095
+ let i = r.length;
3096
+ if (i > 0) {
3097
+ let e = Array(i);
3098
+ for (let t = 0; t < i; t++) {
3099
+ let n = r[t], i = V.rangeToString(n), a = n.value[1], o = V.resolveRelativeToA1(a, n.rowStart, n.colStart);
3100
+ e[t] = [i, o];
3101
+ }
3102
+ t.formulas = e;
3103
+ }
3104
+ let a = w.done(!0), o = a.length;
3105
+ if (o > 0) {
3106
+ let e = Array(o);
3107
+ for (let t = 0; t < o; t++) {
3108
+ let n = a[t], r = V.rangeToString(n);
3109
+ e[t] = r;
3110
+ }
3111
+ t.volatile = e;
3112
+ }
3113
+ oe.length > 0 && (t.formulaArray = [...oe]);
3114
+ let s = h.length;
3115
+ if (s > 0) {
3116
+ h.sort(Ie.createRangeComparator(Ve.Axis.Column));
3117
+ let e = h[0], n = e.colStart, r = e.colEnd, i = e.rowEnd, a = e.value, o = [];
3118
+ o.push(e);
3119
+ let c = null;
3120
+ for (let t = 1; t < s; t++) c = h[t], a !== c.value || n !== c.colStart || r !== c.colEnd || i + 1 !== c.rowEnd ? (o.push(c), e = c, n = e.colStart, r = e.colEnd, i = e.rowEnd, a = e.value) : (i = c.rowEnd, e.rowEnd = i);
3121
+ let l = o.length, u = Array(l);
3122
+ for (let e = 0; e < l; e++) {
3123
+ let t = o[e], n = V.rangeToString(t);
3124
+ u[e] = [n, t.value];
3125
+ }
3126
+ t.directStyles = u;
3127
+ }
3128
+ let l = e.build();
3129
+ l && (t.data = l.tuples), n?.onEnd?.();
3130
+ },
3131
+ onOpenTag: ke,
3132
+ onCloseTag: Ae,
3133
+ onText: je,
3134
+ elementScanners: [{
3135
+ name: "c",
3136
+ scan: (e, t, n) => {
3137
+ if (!l || ue !== null) return H;
3138
+ R.r = R.t = R.s = R.cm = R.vm = void 0;
3139
+ let r = Be(e, t + 2, n, 0);
3140
+ if (r < 0) return r;
3141
+ let i = R.t;
3142
+ if (R.r === void 0 || i === "str" || i === "inlineStr") return H;
3143
+ let a = !1, o = -1, s = -1, c = -1, u = -1, d = r;
3144
+ if (!W) for (z.t = z.si = z.ref = z.ca = void 0;;) {
3145
+ let t = e.indexOf("<", r);
3146
+ if (t === -1 || t + 3 >= n) return ze;
3147
+ for (let n = r; n < t; n++) {
3148
+ let t = e.charCodeAt(n);
3149
+ if (t !== 32 && t !== 9 && t !== 10 && t !== 13) return H;
3150
+ }
3151
+ let i = e.charCodeAt(t + 1), l = e.charCodeAt(t + 2);
3152
+ if (i === 47) {
3153
+ if (!He(e, t, 99)) return H;
3154
+ d = t + 4;
3155
+ break;
3156
+ }
3157
+ if (i === 102 && !a && c === -1 && (l === 32 || l === 62 || l === 47)) {
3158
+ if (a = !0, r = Be(e, t + 2, n, 1), r < 0) return r;
3159
+ if (z.t === "dataTable") return H;
3160
+ if (W) continue;
3161
+ let i = e.indexOf("<", r);
3162
+ if (i === -1 || i + 3 >= n) return ze;
3163
+ if (!He(e, i, 102)) return H;
3164
+ o = r, s = i, r = i + 4;
3165
+ } else if (i === 118 && l === 62 && c === -1) {
3166
+ let i = e.indexOf("<", t + 3);
3167
+ if (i === -1 || i + 3 >= n) return ze;
3168
+ if (!He(e, i, 118)) return H;
3169
+ c = t + 3, u = i, r = i + 4;
3170
+ } else return H;
3171
+ }
3172
+ return ke(Me), a && (ke(Ne), s > o && je(U(e.slice(o, s))), Ae(Ne)), c !== -1 && (ke(Pe), u > c && je(U(e.slice(c, u))), Ae(Pe)), Ae(Me), d;
3173
+ }
3174
+ }, {
3175
+ name: "row",
3176
+ openTag: Re,
3177
+ scan: (e, t, n) => {
3178
+ if (!Te || l || ue !== null) return H;
3179
+ B.r = B.s = B.ht = B.hidden = B.collapsed = B.customHeight = B.customFormat = B.outlineLevel = void 0;
3180
+ let r = Be(e, t + 4, n, 2);
3181
+ return r < 0 ? r : W || B.r === void 0 ? H : (ke(Re), r);
3182
+ }
3183
+ }]
3184
+ };
3185
+ }, Ln = /* @__PURE__ */ new Map([
3186
+ ["urn:schemas-microsoft-com:vml", "v"],
3187
+ ["urn:schemas-microsoft-com:office:office", "o"],
3188
+ ["urn:schemas-microsoft-com:office:excel", "x"]
3189
+ ]), Rn = [...Ln].map(([e, t]) => ` xmlns:${t}="${e}"`).join(""), zn = /<(\/?)([A-Za-z_][\w.-]*(?::[\w.-]+)?)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/g, Bn = /(\s+)([A-Za-z_][\w.-]*(?::[\w.-]+)?)(\s*=\s*)("[^"]*"|'[^']*')/g, Vn = /\sxmlns(?::([\w.-]+))?\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
3190
+ function Hn(e) {
3191
+ if (!e || !((e) => {
3192
+ let t;
3193
+ for (Vn.lastIndex = 0; (t = Vn.exec(e)) !== null;) {
3194
+ let e = Ln.get(t[2] ?? t[3] ?? "");
3195
+ if (e && e !== (t[1] ?? "")) return !0;
3196
+ }
3197
+ return !1;
3198
+ })(e)) return e;
3199
+ let t = [], n = (e, n, r) => {
3200
+ let i = e.indexOf(":");
3201
+ if (i === -1 && r) return null;
3202
+ let a = i === -1 ? "" : e.substring(0, i);
3203
+ if (a === "xmlns") return null;
3204
+ let o = ((e, n) => {
3205
+ let r = n?.get(e);
3206
+ if (r !== void 0) return r;
3207
+ for (let n = t.length - 1; n >= 0; n--) {
3208
+ let r = t[n].bindings.get(e);
3209
+ if (r !== void 0) return r;
3210
+ }
3211
+ })(a, n), s = o === void 0 ? void 0 : Ln.get(o);
3212
+ return s ? `${s}:${i === -1 ? e : e.substring(i + 1)}` : null;
3213
+ }, r = !1, i = !1, a = e.replace(zn, (e, a, o, s, c) => {
3214
+ if (a) {
3215
+ let r = t[t.length - 1], i = n(o, null, !1);
3216
+ return r && r.name === o && (r.nested > 0 ? r.nested-- : t.pop()), i ? `</${i}>` : e;
3217
+ }
3218
+ let l = ((e) => {
3219
+ let t, n = null;
3220
+ for (Vn.lastIndex = 0; (t = Vn.exec(e)) !== null;) (n ??= /* @__PURE__ */ new Map()).set(t[1] ?? "", t[2] ?? t[3] ?? "");
3221
+ return n;
3222
+ })(s);
3223
+ l?.forEach((e, t) => {
3224
+ let n = [...Ln].find(([, e]) => e === t)?.[0];
3225
+ n && n !== e && (r = !0);
3226
+ });
3227
+ let u = n(o, l, !1), d = s.replace(Bn, (e, t, r, i, a) => {
3228
+ if (r === "xmlns" || r.startsWith("xmlns:")) {
3229
+ let t = a.slice(1, -1);
3230
+ return Ln.has(t) ? "" : e;
3231
+ }
3232
+ let o = n(r, l, !0);
3233
+ return o ? `${t}${o}${i}${a}` : e;
3234
+ });
3235
+ if (i || (i = !0, d = d.replace(/\s+$/, "") + Rn), !c) {
3236
+ let e = t[t.length - 1];
3237
+ l ? t.push({
3238
+ name: o,
3239
+ bindings: l,
3240
+ nested: 0
3241
+ }) : e && e.name === o && e.nested++;
3242
+ }
3243
+ return `<${u ?? o}${d}${c}>`;
3244
+ });
3245
+ return r ? e : a;
3246
+ }
3247
+ var Un = {
3248
+ creator: "author",
3249
+ category: "category",
3250
+ description: "comments",
3251
+ contentStatus: "contentStatus",
3252
+ created: "creationDate",
3253
+ keywords: "keywords",
3254
+ lastModifiedBy: "lastAuthor",
3255
+ modified: "lastModifiedDate",
3256
+ lastPrinted: "lastPrinted",
3257
+ revision: "revisionNumber",
3258
+ subject: "subject",
3259
+ title: "title"
3260
+ }, Wn = {
3261
+ Company: "company",
3262
+ Manager: "manager"
3263
+ }, Gn = {
3264
+ lpwstr: W.Type.String,
3265
+ lpstr: W.Type.String,
3266
+ bstr: W.Type.String,
3267
+ i1: W.Type.Number,
3268
+ i2: W.Type.Number,
3269
+ i4: W.Type.Number,
3270
+ i8: W.Type.Number,
3271
+ int: W.Type.Number,
3272
+ ui1: W.Type.Number,
3273
+ ui2: W.Type.Number,
3274
+ ui4: W.Type.Number,
3275
+ ui8: W.Type.Number,
3276
+ uint: W.Type.Number,
3277
+ r4: W.Type.Float,
3278
+ r8: W.Type.Float,
3279
+ decimal: W.Type.Float,
3280
+ bool: W.Type.Boolean,
3281
+ filetime: W.Type.Date,
3282
+ date: W.Type.Date
3283
+ }, Kn = (e) => {
3284
+ let t = e.kind ? Gn[e.kind] : void 0;
3285
+ if (!t) return null;
3286
+ let n = e.value.trim(), r;
3287
+ if (t === W.Type.String) r = {
3288
+ key: e.key,
3289
+ type: t,
3290
+ value: e.value
3291
+ };
3292
+ else if (t === W.Type.Boolean) {
3293
+ if (n !== "true" && n !== "false" && n !== "1" && n !== "0") return null;
3294
+ r = {
3295
+ key: e.key,
3296
+ type: t,
3297
+ value: n === "true" || n === "1"
3298
+ };
3299
+ } else if (t === W.Type.Date) {
3300
+ let i = new Date(n);
3301
+ if (!n || isNaN(i.getTime())) return null;
3302
+ r = {
3303
+ key: e.key,
3304
+ type: t,
3305
+ value: i.toISOString()
3306
+ };
3307
+ } else {
3308
+ let i = Number(n);
3309
+ if (!n || !Number.isFinite(i)) return null;
3310
+ let a = t === W.Type.Number && i >= -2147483648 && i <= 2147483647;
3311
+ r = {
3312
+ key: e.key,
3313
+ type: a ? t : W.Type.Float,
3314
+ value: i
3315
+ };
3316
+ }
3317
+ return e.linkTarget && (r.linkTarget = e.linkTarget), r;
3318
+ }, qn = "hiddenXfs", Jn = (e) => (Array.isArray(e) ? e[1] : e?.v)?.s, Yn = (e) => {
3319
+ if (!e || e.length === 0) return !1;
3320
+ let t = V.refsToRuns(e, !0), n = 0;
3321
+ for (let e of t) {
3322
+ if (e.min > n || e.value?.s === void 0) return !1;
3323
+ n = Math.max(n, e.max + 1);
3324
+ }
3325
+ return n > A;
3326
+ }, Xn = (e, t) => {
3327
+ e.protection = {
3328
+ ...e.protection,
3329
+ showFormulas: t
3330
+ };
3331
+ }, Zn = (e) => {
3332
+ let t = Array.isArray(e) ? e[1] : e.v;
3333
+ if (!t || !("s" in t)) return;
3334
+ let n = t.s;
3335
+ return delete t.s, n;
3336
+ }, Qn = (e, t, n, r) => {
3337
+ if (!e) return;
3338
+ let i = t ? 2 : 1, a = t ? n.rowStart : n.colStart, o = t ? n.rowEnd : n.colEnd, s, c = -1;
3339
+ for (let n of e) {
3340
+ let e = V.refToRun(n, t), l = Zn(n);
3341
+ e && l !== void 0 ? l !== c || (t ? s.colEnd : s.rowEnd) + 1 !== e.min ? (s = {
3342
+ colStart: t ? e.min : a,
3343
+ rowStart: t ? a : e.min,
3344
+ colEnd: t ? e.max : o,
3345
+ rowEnd: t ? o : e.max,
3346
+ value: {
3347
+ kind: i,
3348
+ index: l
3349
+ }
3350
+ }, c = l, r.push(s)) : t ? s.colEnd = e.max : s.rowEnd = e.max : c = -1;
3351
+ }
3352
+ }, $n = {
3353
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
3354
+ "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
3355
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
3356
+ "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
3357
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
3358
+ "application/vnd.ms-excel.template.macroEnabled.main+xml": "workbooks",
3359
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
3360
+ "application/vnd.ms-excel.worksheet": "sheets",
3361
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
3362
+ "application/vnd.ms-excel.chartsheet": "charts",
3363
+ "application/vnd.ms-excel.macrosheet+xml": "macros",
3364
+ "application/vnd.ms-excel.macrosheet": "macros",
3365
+ "application/vnd.ms-excel.intlmacrosheet+xml": "macros",
3366
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
3367
+ "application/vnd.ms-excel.dialogsheet": "dialogs",
3368
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
3369
+ "application/vnd.ms-excel.sharedStrings": "strs",
3370
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
3371
+ "application/vnd.ms-excel.styles": "styles",
3372
+ "application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
3373
+ "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
3374
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
3375
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
3376
+ "application/vnd.ms-excel.comments": "comments",
3377
+ "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
3378
+ "application/vnd.ms-excel.person+xml": "people",
3379
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
3380
+ "application/vnd.ms-excel.sheetMetadata": "metadata",
3381
+ "application/vnd.ms-excel.externalLink": "links",
3382
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
3383
+ "application/vnd.openxmlformats-officedocument.theme+xml": "themes"
3384
+ }, er = se({ readXLSX: () => ar }), tr = (e) => e.startsWith("/") ? e.slice(1) : e, nr = [
3385
+ 208,
3386
+ 207,
3387
+ 17,
3388
+ 224,
3389
+ 161,
3390
+ 177,
3391
+ 26,
3392
+ 225
3393
+ ], rr = /^xl\/worksheets\/[^/]+\.xml$/i, ir = (e) => typeof e == "string" ? e : (e?.runs ?? []).map((e) => e.text ?? "").join(""), ar = async (r, i) => {
3394
+ let { password: a, onVBA: o, profile: s, calcOnLoad: c = "auto", createWorkbookOptions: u = {}, ...d } = i ?? {};
3395
+ await Re.load();
3396
+ let p = !!u.origin && typeof u.origin != "string", h = s ? new et(typeof s == "function" ? s : void 0) : null, _ = [], v = (e, t, n) => {
3397
+ _.push([
3398
+ e,
3399
+ t ?? "",
3400
+ n
3401
+ ]);
3402
+ }, b = { onWarning: v }, x = i?.progress, te = x?.onProgress ? x.onProgress.bind(x) : void 0, ne = r.byteLength, re = 0, ie = 0, oe = te ? (e) => {
3403
+ if (re <= 0) return;
3404
+ ie += e;
3405
+ let t = Math.min(ne, Math.round(ie / re * ne));
3406
+ te(t, ne);
3407
+ } : void 0, se = import("./BiDqExNXiY7ykk8E.mjs"), le = null;
3408
+ try {
3409
+ le = new DOMParser();
3410
+ } catch {}
3411
+ let S = null;
3412
+ try {
3413
+ S = new XMLSerializer();
3414
+ } catch {}
3415
+ let C, w, D, O = null;
3416
+ le || (O = import("./Bs0EzhdU8WgGfPzf.mjs").then((e) => y(e.default, 1)));
3417
+ try {
3418
+ let [e, t] = await Promise.all([O, se]);
3419
+ C = new t.DOMTransformer(), w = le ?? new e.DOMParser(), D = S ?? new e.XMLSerializer();
3420
+ } catch (e) {
3421
+ throw Error("Unable to load XLSX parser.", { cause: e });
3422
+ }
3423
+ let de = (e) => D.serializeToString(e);
3424
+ if (((e) => {
3425
+ if (e.byteLength < nr.length) return !1;
3426
+ let t = new Uint8Array(e, 0, nr.length);
3427
+ return nr.every((e, n) => t[n] === e);
3428
+ })(r)) throw new Ne("This is an Excel 97-2003 workbook (.xls), which cannot be read. Save it as '.xlsx' and try again.");
3429
+ let j;
3430
+ try {
3431
+ j = await $e.create(r);
3432
+ } catch (e) {
3433
+ throw new Ne("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: e });
3434
+ }
3435
+ h?.mark("zip-open");
3436
+ try {
3437
+ if (!j.has("[Content_Types].xml")) throw new Ne("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3438
+ let r = (e) => {
3439
+ let t = j.getEntry(e);
3440
+ return t ? { content: t } : void 0;
3441
+ }, i = {
3442
+ workbooks: [],
3443
+ sheets: [],
3444
+ charts: [],
3445
+ dialogs: [],
3446
+ macros: [],
3447
+ strs: [],
3448
+ comments: [],
3449
+ threadedcomments: [],
3450
+ links: [],
3451
+ coreprops: [],
3452
+ extprops: [],
3453
+ custprops: [],
3454
+ themes: [],
3455
+ styles: [],
3456
+ metadata: [],
3457
+ people: [],
3458
+ overrides: {},
3459
+ sst: "",
3460
+ style: "",
3461
+ defaults: {}
3462
+ };
3463
+ {
3464
+ let e = ((e, t) => ({
3465
+ onOpenTag: (t) => {
3466
+ let n = ((e) => {
3467
+ let t = e.indexOf(":");
3468
+ return t === -1 ? e : e.slice(t + 1);
3469
+ })(t.name), r = t.attributes;
3470
+ if (n === "Override") {
3471
+ let t = r.ContentType, n = r.PartName;
3472
+ if (!t || !n) return;
3473
+ e.overrides[n.startsWith("/") ? n.slice(1) : n] = t;
3474
+ let i = $n[t], a = i ? e[i] : void 0;
3475
+ Array.isArray(a) && a.push(n);
3476
+ } else if (n === "Default") {
3477
+ let t = r.Extension, n = r.ContentType;
3478
+ t && (e.defaults[t.toLowerCase()] = n);
3479
+ }
3480
+ },
3481
+ onEnd: () => {
3482
+ e.sst = e.strs.length > 0 ? e.strs[0] : "", e.style = e.styles.length > 0 ? e.styles[0] : "";
3483
+ },
3484
+ onError: (e) => {
3485
+ t?.(`Error parsing content types: ${e?.message ?? e}`);
3486
+ }
3487
+ }))(i, (e) => {
3488
+ _.push([e, "[Content_Types].xml"]);
3489
+ }), t = await j.getTextStream("[Content_Types].xml");
3490
+ if (!t) throw Error("Error parsing content types: '[Content_Types].xml'");
3491
+ try {
3492
+ await Vt.parseStream(t, e, { xmlns: !1 });
3493
+ } catch (e) {
3494
+ throw Error("Error parsing content types: '[Content_Types].xml'", { cause: e });
3495
+ }
3496
+ p && await j.getBuffer("[Content_Types].xml");
3497
+ }
3498
+ h?.mark("content-types");
3499
+ let a = i.sst, d = /* @__PURE__ */ new Set();
3500
+ for (let e of i.sheets) d.add(tr(e));
3501
+ a && d.add(tr(a));
3502
+ for (let e of d) re += j.uncompressedSize(e);
3503
+ if (await j.prefetch((e) => !d.has(e) && !rr.test(e)), h?.mark("prefetch-side-parts"), i.workbooks.length === 0) {
3504
+ let e = xe("_rels/.rels", r, w, C, b);
3505
+ if (e) {
3506
+ for (let t of e.values()) if (t.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" && t.target) {
3507
+ i.workbooks.push(t.target);
3508
+ break;
3509
+ }
3510
+ }
3511
+ }
3512
+ if (i.workbooks.length === 0) throw new Ne("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3513
+ i.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], i.richdata = ["/xl/richData/rdrichvalue.xml"];
3514
+ let y = u?.resources ?? new We(), ie = y.beginPersist(), se = {}, le = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map();
3515
+ S.set("richTypes", []), S.set("parseInlineDxf", (e) => {
3516
+ if (!e) return;
3517
+ let t = w.parseFromString(`<dxf xmlns:x14="${n}" xmlns:xm="${ee}">${e}</dxf>`, "text/xml")?.documentElement;
3518
+ if (!t) return;
3519
+ let r = C.parseDxf(t, "", b);
3520
+ return Object.keys(r).length > 0 ? r : void 0;
3521
+ });
3522
+ let D = [];
3523
+ S.set("dummyWrapped", D);
3524
+ let O = L("metadata", i, r, w, C, b).entries().next()?.value?.[1]?.metadata;
3525
+ O && S.set("metadata", O), S.set(En, e());
3526
+ let M = /* @__PURE__ */ new Map(), fe = [], pe = /* @__PURE__ */ new Set(), N = (e) => {
3527
+ pe.add(tr(e));
3528
+ }, P = (e, t = M) => {
3529
+ let n = e.lastIndexOf("/"), i = e.substring(0, n + 1) + "_rels/" + e.substring(n + 1, e.length) + ".rels", a = t.get(i);
3530
+ return a || (a = xe(i, r, w, C, H), t.set(i, a)), a;
3531
+ }, F = (e, t, n, i = M) => {
3532
+ let a = P(t, i).get(e), o = a?.target;
3533
+ if (!o) return null;
3534
+ if (a.targetMode === "External") {
3535
+ if (!n) return a.target;
3536
+ let e = y.add({ source: { external: a.target } });
3537
+ return e.addReference(se), le.add(e), ie.toResourceId(e);
3538
+ }
3539
+ let s = t.lastIndexOf("/"), c = t.substring(0, s + 1);
3540
+ o.startsWith("/") || (o = c + o), o = ge(o);
3541
+ let l = C?.getVisitorParamsState().get("dxfs"), u = i.get(o);
3542
+ if (!u) {
3543
+ if (a.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
3544
+ let e = {};
3545
+ u = e, fe.push((async () => {
3546
+ let t = An(e, (e, t) => t === "legacyDrawing" ? we(e, o) : t === "formControl" ? Te(e, o) : t === "part" ? Ee(e, o) : F(e, o, t === "resource") ?? null, Ge, l, () => {}, (e, t, n) => {
3547
+ v(e, t ? `${t} (${o})` : o, n);
3548
+ }, void 0, S), n = await j.getTextStream(o, oe);
3549
+ if (n) try {
3550
+ await Vt.parseStream(n, t, {
3551
+ xmlns: !1,
3552
+ lean: !0
3553
+ });
3554
+ } catch (e) {
3555
+ throw Error(`Error parsing sheet: '${o}'`, { cause: e });
3556
+ }
3557
+ let r = P(o, i);
3558
+ if (r) {
3559
+ Se(e, o, r, i), E(e), I(e);
3560
+ let t = [];
3561
+ r.forEach((e, n) => {
3562
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable") return;
3563
+ let r = Ee(n, o, e.type, (e) => e !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition");
3564
+ if (!r?.xml) return;
3565
+ let i = /<pivotTableDefinition\b[^>]*>/.exec(r.xml)?.[0] ?? "", a = parseInt(/\scacheId="(\d+)"/.exec(i)?.[1] ?? "", 10);
3566
+ if (isNaN(a)) return void _.push([`Pivot table '${r.name}' names no cache and was dropped.`, o]);
3567
+ let s = /\sname="([^"]*)"/.exec(i)?.[1];
3568
+ t.push({
3569
+ ...s ? { name: ye(s) } : {},
3570
+ cacheId: a,
3571
+ part: r
3572
+ });
3573
+ }), t.length > 0 && (e.pivotTables = t);
3574
+ }
3575
+ })());
3576
+ } else if (a.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink") {
3577
+ let e = me(o, r, w, C, H);
3578
+ if (e && Object.keys(e).length !== 0) {
3579
+ let t = e, n = t.__bookRelId, r = t.__absoluteUrlRelId;
3580
+ delete t.__bookRelId, delete t.__absoluteUrlRelId;
3581
+ let a = [];
3582
+ P(o, i)?.forEach((e, t) => {
3583
+ if (e.targetMode === "External" && e.type && e.target) {
3584
+ let i = {
3585
+ type: e.type,
3586
+ target: e.target
3587
+ };
3588
+ t === n ? i.role = "book" : t === r && (i.role = "absoluteUrl"), a.push(i);
3589
+ }
3590
+ }), a.sort((e, t) => (e.role === "book" ? 0 : 1) - (t.role === "book" ? 0 : 1)), t.sources = a, N(o), u = t;
3591
+ } else u = null;
3592
+ } else u = n ? T(o, r, (e, t) => {
3593
+ let n = y.add({ source: { buffer: e } });
3594
+ return n.addReference(se), le.add(n), ie.toResourceId(n);
3595
+ }, H) : me(o, r, w, C, H);
3596
+ }
3597
+ return u;
3598
+ }, be = (e, t) => {
3599
+ if (!e) return null;
3600
+ let n = P(t, M)?.get(e);
3601
+ if (!n?.target || n.targetMode === "External") return null;
3602
+ let r = n.target;
3603
+ return r.startsWith("/") || (r = t.substring(0, t.lastIndexOf("/") + 1) + r), ge(r);
3604
+ }, Se = (e, n, r, i) => {
3605
+ let a = [], o = /* @__PURE__ */ new Map(), s = [];
3606
+ r.forEach((e, t) => {
3607
+ if (e.type !== "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment") return;
3608
+ let r = F(t, n, !1, i)?.comments;
3609
+ if (!r) return;
3610
+ for (let e = 0; e < r.length; e++) {
3611
+ let t = r[e];
3612
+ if (!t?.v?.id) continue;
3613
+ let { parentId: n, done: i, content: c, ...l } = t.v, u = {
3614
+ ...l,
3615
+ content: ir(c)
3616
+ };
3617
+ n ? s.push({
3618
+ parentId: n,
3619
+ json: u
3620
+ }) : (i && (u.done = !0), o.set(u.id, u), a.push({
3621
+ r: t.r,
3622
+ v: u
3623
+ }));
3624
+ }
3625
+ let c = be(t, n);
3626
+ c && N(c);
3627
+ });
3628
+ for (let e = 0; e < s.length; e++) {
3629
+ let { parentId: t, json: n } = s[e], r = o.get(t);
3630
+ r && (r.replies ??= []).push(n);
3631
+ }
3632
+ let c = [];
3633
+ if (r.forEach((e, t) => {
3634
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") return;
3635
+ let r = F(t, n, !1, i), a = r?.comments;
3636
+ if (!a) return;
3637
+ let s = r?.authors;
3638
+ for (let e = 0; e < a.length; e++) {
3639
+ let t = a[e];
3640
+ if (!t?.r) continue;
3641
+ let n = s && t.v.authorId !== void 0 ? s[t.v.authorId] : void 0;
3642
+ if (n && n.startsWith("tc=")) {
3643
+ if (o.has(k(n.substring(3)))) continue;
3644
+ n = void 0;
3645
+ }
3646
+ let r = {
3647
+ id: z.uuidV4().toUpperCase(),
3648
+ asNote: !0,
3649
+ content: t.v.content ?? ""
3650
+ }, i = n ? Le({ displayName: n }) : void 0;
3651
+ i && (r.personId = i.id), c.push({
3652
+ r: t.r,
3653
+ v: r
3654
+ });
3655
+ }
3656
+ let l = be(t, n);
3657
+ l && N(l);
3658
+ }), a.length === 0 && c.length === 0) return;
3659
+ let l = [...a, ...c], u = e.legacyDrawing;
3660
+ if (u?.xml) {
3661
+ let { rest: n, notes: r } = De(u.xml);
3662
+ if (r.length > 0) {
3663
+ let i = /* @__PURE__ */ new Map();
3664
+ for (let e = 0; e < r.length; e++) {
3665
+ let t = r[e];
3666
+ i.set(V.cellToString({
3667
+ rowIndex: t.row,
3668
+ colIndex: t.col
3669
+ }), t);
3670
+ }
3671
+ for (let e = 0; e < l.length; e++) {
3672
+ let n = l[e], r = i.get(String(n.r).toUpperCase());
3673
+ if (!r || (i.delete(String(n.r).toUpperCase()), !n.v.asNote)) continue;
3674
+ let a = t(r.xml), o = {};
3675
+ if (a.anchor) {
3676
+ let [e, t, n, i, s, c, l, u] = a.anchor;
3677
+ o.anchor = {
3678
+ tl: {
3679
+ c: e - r.col,
3680
+ x: t,
3681
+ r: n - r.row,
3682
+ y: i
3683
+ },
3684
+ br: {
3685
+ c: s - r.col,
3686
+ x: c,
3687
+ r: l - r.row,
3688
+ y: u
3689
+ }
3690
+ };
3691
+ } else a.bounds && (o.bounds = a.bounds);
3692
+ a.style.fill && (o.fill = a.style.fill), a.style.stroke && (o.stroke = a.style.stroke), a.xml && (o.xml = a.xml), (o.anchor || o.bounds || o.fill || o.stroke || o.xml) && (n.v.box = o), a.visible && (n.v.shown = !0), a.alt && (n.v.description = a.alt);
3693
+ }
3694
+ let a = [];
3695
+ i.forEach((e) => {
3696
+ a.push(e.xml);
3697
+ });
3698
+ let o = ke(n, a);
3699
+ o ? u.xml = o : delete e.legacyDrawing;
3700
+ }
3701
+ }
3702
+ e.comments = l;
3703
+ }, we = (e, t) => {
3704
+ let n = be(e, t);
3705
+ if (!n) return null;
3706
+ let i = r(tr(n));
3707
+ if (!i) return null;
3708
+ let a = { xml: Hn(new TextDecoder("utf-8").decode(i.content)) }, o = [];
3709
+ return P(n, M)?.forEach((e, t) => {
3710
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") return;
3711
+ let r = F(t, n, !0);
3712
+ typeof r == "number" && o.push({
3713
+ id: t,
3714
+ resId: r
3715
+ });
3716
+ }), o.length > 0 && (a.images = o), N(n), a;
3717
+ }, Te = (e, t) => {
3718
+ let n = be(e, t);
3719
+ if (!n) return null;
3720
+ let i = me(n, r, w, C, H)?.formControl ?? null;
3721
+ return i && N(n), i;
3722
+ }, Ee = (e, t, n, a, o = /* @__PURE__ */ new Set()) => {
3723
+ let s = be(e, t);
3724
+ if (!s || o.has(s)) return null;
3725
+ let c = n ?? P(t, M)?.get(e)?.type;
3726
+ if (!c) return null;
3727
+ let l = r(tr(s));
3728
+ if (!l) return null;
3729
+ o.add(s);
3730
+ let u = s.substring(s.lastIndexOf("/") + 1), d = i.overrides[tr(s)] ?? i.defaults[u.substring(u.lastIndexOf(".") + 1).toLowerCase()], f = {
3731
+ id: e,
3732
+ type: c,
3733
+ name: u
3734
+ };
3735
+ if (d && (f.contentType = d), ((e, t) => e ? e.endsWith("+xml") || e === "application/xml" : /\.(xml|rels|vml)$/i.test(t))(d, u)) f.xml = new TextDecoder("utf-8").decode(l.content);
3736
+ else {
3737
+ let n = F(e, t, !0);
3738
+ if (typeof n != "number") return null;
3739
+ f.resId = n;
3740
+ }
3741
+ let p = [];
3742
+ return P(s, M)?.forEach((e, t) => {
3743
+ if (!e?.type || a && !a(e.type)) return;
3744
+ if (e.targetMode === "External") {
3745
+ let n = F(t, s, !0);
3746
+ typeof n == "number" && p.push({
3747
+ id: t,
3748
+ type: e.type,
3749
+ resId: n
3750
+ });
3751
+ return;
3752
+ }
3753
+ let n = Ee(t, s, e.type, a, o);
3754
+ n && p.push(n);
3755
+ }), p.length > 0 && (f.parts = p), N(s), f;
3756
+ }, Oe = L("coreprops", i, r, w, C, b), Ae = L("extprops", i, r, w, C, b), je = L("custprops", i, r, w, C, b);
3757
+ je.forEach((e, t) => {
3758
+ e?.custom && N(t);
3759
+ });
3760
+ let Fe = new Ue(), Ie = L("people", i, r, w, C, b);
3761
+ if (Ie.size > 0) {
3762
+ let [e, t] = Ie.entries().next().value;
3763
+ Fe.fromJSON(t?.persons), N(e);
3764
+ }
3765
+ let Le = (e) => {
3766
+ if (e) return Fe.add(e).toJSON();
3767
+ }, H = {
3768
+ paramMap: S,
3769
+ getRefs: P,
3770
+ getRef: F,
3771
+ parsedRefs: M,
3772
+ readEmbeddedPart: (e, t) => Ee(e, t),
3773
+ addPerson: Le,
3774
+ serializeElement: de,
3775
+ onWarning: v
3776
+ }, U = [], W = /* @__PURE__ */ new Map();
3777
+ if (S.set(On, W), a) {
3778
+ let e = await j.getTextStream(a, oe);
3779
+ if (e) {
3780
+ let t = ((e, t) => {
3781
+ let n = !1, r = !1, i = 0, a = "", o = new xn();
3782
+ return {
3783
+ onOpenTag: (e) => {
3784
+ let t = bn(e.name);
3785
+ t === "t" ? n && i === 0 && (r = !0) : t === "si" ? (n = !0, a = "", o.reset(), i = 0) : t === "rPh" || t === "phoneticPr" ? i++ : n && i === 0 && o.onOpenTag(t, e.attributes);
3786
+ },
3787
+ onText: (e) => {
3788
+ r && (a += e, o.onText(e));
3789
+ },
3790
+ onCloseTag: (t) => {
3791
+ let s = bn(t.name);
3792
+ s === "t" ? r = !1 : s === "si" ? (e(l(a), o.take() ?? void 0), n = !1, a = "") : s === "rPh" || s === "phoneticPr" ? i > 0 && i-- : o.onCloseTag(s);
3793
+ },
3794
+ onError: (e) => {
3795
+ t?.(`Error parsing shared strings: ${e?.message ?? e}`);
3796
+ }
3797
+ };
3798
+ })((e, t) => {
3799
+ t && W.set(U.length, t), U.push(e);
3800
+ }, (e) => {
3801
+ v(e, a);
3802
+ });
3803
+ try {
3804
+ await Vt.parseStream(e, t, { xmlns: !1 });
3805
+ } catch (e) {
3806
+ throw Error(`Error parsing shared strings: '${a}'`, { cause: e });
3807
+ }
3808
+ }
3809
+ }
3810
+ h?.mark("shared-strings");
3811
+ let Be = U.length, Ve = /* @__PURE__ */ new Map(), He = Be, Ge = (e) => {
3812
+ let t = Ve.get(e);
3813
+ if (t !== void 0) return t;
3814
+ let n = He;
3815
+ return Ve.set(e, He++), U.push(e), n;
3816
+ }, qe = [];
3817
+ i.slicersCache = qe;
3818
+ let Ye = j.getNames(), Qe = Ye.length;
3819
+ for (let e = 0; e < Qe; e++) {
3820
+ let t = Ye[e];
3821
+ t && t.startsWith("xl/slicerCache") && qe.push(`/${t}`);
3822
+ }
3823
+ let $e = L("slicersCache", i, r, w, C, H), et = /* @__PURE__ */ new Map();
3824
+ $e.forEach((e, t) => {
3825
+ e?.cacheName && (e.cachePath = t, et.set(e.cacheName, e));
3826
+ }), S.set("slicerCaches", et);
3827
+ let tt = [];
3828
+ i.slicers = tt;
3829
+ for (let e = 0; e < Qe; e++) {
3830
+ let t = Ye[e];
3831
+ t && t.startsWith("xl/slicers/") && t.endsWith(".xml") && tt.push(`/${t}`);
3832
+ }
3833
+ L("richstructure", i, r, w, C, H), L("richdata", i, r, w, C, H);
3834
+ let nt = L("themes", i, r, w, C, H), rt = null;
3835
+ if (nt && nt.entries) {
3836
+ let e = nt.entries().next();
3837
+ e?.value?.[1] && (rt = e.value[1]);
3838
+ }
3839
+ let it = new Ke(rt), at = L("styles", i, r, w, C, H).entries().next()?.value?.[1];
3840
+ at &&= JSON.parse(Me.JSONStableStringify(at));
3841
+ let ot = L("workbooks", i, r, w, C, H);
3842
+ S.set(Dn, !0 === ot.entries().next().value?.[1]?.date1904), h?.mark("side-parts-json"), await Promise.all(fe);
3843
+ {
3844
+ let t = ot.entries().next().value?.[1], n = e(t?.names), r = t?.sheets ?? [];
3845
+ for (let e = 0; e < r.length; e++) {
3846
+ let t = r[e], i = g(t);
3847
+ if (t?.kind === "macro" && i?.part.xml) {
3848
+ i.part.xml = m(i.part.xml, U);
3849
+ continue;
3850
+ }
3851
+ let a = R(t);
3852
+ a && ue(a, n);
3853
+ }
3854
+ let i = t?.names;
3855
+ if (i) for (let e = 0; e < i.length; e++) {
3856
+ let t = i[e]?.ref;
3857
+ typeof t == "string" && (i[e].ref = n.readDetached(t));
3858
+ }
3859
+ }
3860
+ te && re > 0 && (te(ne, ne), await new Promise((e) => setTimeout(e, 0))), h?.mark("sheets");
3861
+ let st = {
3862
+ ...ot.entries().next().value?.[1],
3863
+ styles: at,
3864
+ theme: it.toJSON()
3865
+ }, ct = ((e, t, n, r) => {
3866
+ let i = {}, a = (e, t) => {
3867
+ if (e) for (let { key: n, value: r } of e) {
3868
+ let e = t[n];
3869
+ if (e && r) {
3870
+ if (e === "revisionNumber") {
3871
+ let e = parseInt(r, 10);
3872
+ Number.isFinite(e) && (i.revisionNumber = e);
3873
+ } else i[e] = r;
3874
+ }
3875
+ }
3876
+ };
3877
+ if (a(e, Un), a(t, Wn), n) {
3878
+ let e = [];
3879
+ for (let t of n) {
3880
+ let n = Kn(t);
3881
+ n ? e.push(n) : r?.(`The custom document property '${t.key}' holds a value of a kind that is not read (${t.kind ? "vt:" + t.kind : "none"}); it was dropped.`, "xlsx.docProps.custom.kind");
3882
+ }
3883
+ e.length > 0 && (i.custom = e);
3884
+ }
3885
+ return Object.keys(i).length > 0 ? i : void 0;
3886
+ })(Oe.values().next().value?.properties, Ae.values().next().value?.properties, je.values().next().value?.custom, (e, t) => {
3887
+ v(e, "docProps/custom.xml", t);
3888
+ });
3889
+ ct && (st.properties = ct), ((e, t) => {
3890
+ if (!t || t.size === 0) return;
3891
+ let n = e.styles;
3892
+ if (!n) return;
3893
+ let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
3894
+ for (let n of e.sheets ?? []) {
3895
+ let e = R(n);
3896
+ if (!e) continue;
3897
+ let a = /* @__PURE__ */ new Set();
3898
+ Yn(e.cols) || a.add(0);
3899
+ for (let t of e.directStyles ?? []) a.add(Array.isArray(t) ? t[1] : t.v);
3900
+ for (let t of e.rows ?? []) {
3901
+ let e = Jn(t);
3902
+ e !== void 0 && a.add(e);
3903
+ }
3904
+ for (let t of e.cols ?? []) {
3905
+ let e = Jn(t);
3906
+ e !== void 0 && a.add(e);
3907
+ }
3908
+ let o = !1;
3909
+ for (let e of a) if (t.has(e)) {
3910
+ o = !0;
3911
+ break;
3912
+ }
3913
+ if (o) {
3914
+ e.protection = {
3915
+ ...e.protection ?? { sheet: !0 },
3916
+ showFormulas: !1
3917
+ };
3918
+ for (let e of a) (t.has(e) ? i : r).add(e);
3919
+ }
3920
+ }
3921
+ if (r.size === 0) return;
3922
+ let a = n.direct ??= [];
3923
+ for (let e of r) e !== 0 && Xn(a[e] ?? (a[e] = {}), !0);
3924
+ for (let e of i) e !== 0 && Xn(a[e] ?? (a[e] = {}), !1);
3925
+ if (r.has(0)) {
3926
+ let e = n.named ??= [], t = ze.BuiltInName.Normal.toLowerCase(), r = e.find((e) => e.name?.toLowerCase() === t);
3927
+ r || (r = {
3928
+ name: ze.BuiltInName.Normal,
3929
+ style: {}
3930
+ }, e.push(r)), Xn(r.style, !0);
3931
+ }
3932
+ })(st, S.get(qn)), ((e) => {
3933
+ let t = {
3934
+ colStart: 0,
3935
+ rowStart: 0,
3936
+ colEnd: A,
3937
+ rowEnd: _e
3938
+ };
3939
+ for (let n of e.sheets ?? []) {
3940
+ let e = R(n);
3941
+ if (!e) continue;
3942
+ let r = [];
3943
+ if (Qn(e.cols, !0, t, r), Qn(e.rows, !1, t, r), r.length === 0) continue;
3944
+ let i = [];
3945
+ for (let [t, n] of e.directStyles ?? []) i.push({
3946
+ ...V.fastStringToRange(t),
3947
+ value: {
3948
+ kind: 0,
3949
+ index: n
3950
+ }
3951
+ });
3952
+ i.push(...r);
3953
+ let a = [], o = new Pe.IteratorInstance(i, { axis: B.Column });
3954
+ for (let e = o.next(); !e.done; e = o.next()) {
3955
+ let n = e.value.overlaps, r;
3956
+ if (n.length === 1) {
3957
+ if (r = n[0].value, r.index === 0) continue;
3958
+ } else {
3959
+ let e, t, i;
3960
+ for (let r = 0; !e && r < n.length; r++) {
3961
+ let a = n[r].value;
3962
+ a.kind === 0 ? e = a : a.kind === 1 ? t = a : i = a;
3963
+ }
3964
+ r = e ?? t ?? i;
3965
+ }
3966
+ a.push([V.rangeToString(e.value.range, t), r.index]);
3967
+ }
3968
+ a.length > 0 ? e.directStyles = a : delete e.directStyles;
3969
+ }
3970
+ })(st);
3971
+ {
3972
+ let e = /* @__PURE__ */ new Map();
3973
+ L("slicers", i, r, w, C, H).forEach((t, n) => {
3974
+ t?.slicers && e.set(n, t.slicers);
3975
+ }), function(e, t) {
3976
+ let n = e.sheets ?? [], r = /* @__PURE__ */ new Map();
3977
+ for (let e = 0; e < n.length; e++) {
3978
+ let t = n[e], i = R(t)?.tables ?? [];
3979
+ for (let e = 0; e < i.length; e++) {
3980
+ let t = i[e], n = Array.isArray(t) ? t[1] : t?.v;
3981
+ if (!n?.id) continue;
3982
+ let a = (n.columns ?? []).map((e) => typeof e == "string" ? { name: e } : e);
3983
+ r.set(String(n.id), {
3984
+ name: n.name ?? "",
3985
+ columns: a
3986
+ });
3987
+ }
3988
+ }
3989
+ let i = /* @__PURE__ */ new Set();
3990
+ for (let e = 0; e < n.length; e++) {
3991
+ let a = n[e], o = R(a);
3992
+ if (!o) continue;
3993
+ let s = o.slicers, c = o.movables;
3994
+ if (s && c) for (let e = c.length - 1; e >= 0; e--) {
3995
+ let n = c[e].content;
3996
+ if (n?.type !== "slicer" || n.json?.source) continue;
3997
+ let a = n.name ?? "", o = s[a];
3998
+ if (!o?.tableId) continue;
3999
+ let l = r.get(String(o.tableId)), u = l ? Xe(l.columns, o.columnId) : null;
4000
+ l && u ? (n.json = Ze(o, n.json, Re.structuredReference(l.name, u.name)), i.add(a), o.cachePath && t.markAbsorbed(o.cachePath)) : (t.warn("A slicer names no table; it was not imported.", "xlsx.slicer.cacheDefinition"), c.splice(e, 1));
4001
+ }
4002
+ delete o.slicers;
4003
+ }
4004
+ t.slicerParts.forEach((e, n) => {
4005
+ let r = Object.keys(e);
4006
+ r.length > 0 && r.every((e) => i.has(e)) && t.markAbsorbed(n);
4007
+ });
4008
+ }(st, {
4009
+ warn: (e, t) => {
4010
+ v(e, "xl/slicers", t);
4011
+ },
4012
+ markAbsorbed: N,
4013
+ slicerParts: e
4014
+ });
4015
+ }
4016
+ st.calc = {
4017
+ ...st.calc ?? {},
4018
+ legacyIntersect: !0
4019
+ }, U.length > 0 && (st.strings = U);
4020
+ let lt = Fe.toJSON();
4021
+ lt && lt.length > 0 && (st.people = lt);
4022
+ let ut = j.getEntry("xl/vbaProject.bin");
4023
+ if (ut) try {
4024
+ let { VBAProject: e } = await import("./CzFYJPxmLyKgEKF0.mjs"), t = e.extract(ut);
4025
+ if (t) {
4026
+ let n = /* @__PURE__ */ new Map();
4027
+ for (let e of st.sheets ?? []) {
4028
+ let t = R(e), r = t?.codeName;
4029
+ r && n.set(r, t);
4030
+ }
4031
+ for (let r of t.modules) {
4032
+ let t = { language: "vba" }, { header: i, body: a } = e.splitAttributes(r.code);
4033
+ a && (t.source = a), i && (t.sourceHeader = i);
4034
+ let o = r.type === "document" ? n.get(r.name) : void 0;
4035
+ o || r.type !== "document" || (t.scope = "workbook");
4036
+ let s = o ? o.modules ??= {} : st.modules ??= {};
4037
+ s[r.name] || (s[r.name] = t);
4038
+ }
4039
+ o?.(t);
4040
+ } else _.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
4041
+ } catch (e) {
4042
+ _.push([`Error extracting VBA: ${e?.message ?? e}`, "xl/vbaProject.bin"]);
4043
+ }
4044
+ let dt = S.get("calcId"), ft = dt === void 0 || !(Number(dt) >= 191029), pt = u.calcOnLoad ?? (c === "auto" && ft ? "full" : c), mt = {
4045
+ ...u,
4046
+ calcOnLoad: pt,
4047
+ resources: y,
4048
+ json: st
4049
+ };
4050
+ if (mt.disableLoadAutoFit === void 0) {
4051
+ let e = S.get(Ce);
4052
+ mt.disableLoadAutoFit = !!e?.declared && e.normalIsThemeFont && await he(e.faces);
4053
+ }
4054
+ h?.mark("json-assembled");
4055
+ let G = new Je(mt);
4056
+ if (h?.mark("workbook-constructed"), D.length > 0 && pt !== "none") {
4057
+ await G.whenCalculationReady();
4058
+ let e = /* @__PURE__ */ new Map(), t = st.sheets ?? [], n = G.getSheets({ visibility: "veryHidden" });
4059
+ for (let r = 0; r < t.length; r++) {
4060
+ let i = t[r], a = n[r], o = R(i);
4061
+ o && a?.isIWorksheet && e.set(o, a);
4062
+ }
4063
+ ((e, t, n) => {
4064
+ if (t.length === 0) return;
4065
+ let r = e.getCalculation().getFunctions(), i = /* @__PURE__ */ new Map(), a = (e) => {
4066
+ let t = i.get(e);
4067
+ return t === void 0 && (t = r.getByName(e) !== null, i.set(e, t)), t;
4068
+ }, o = /* @__PURE__ */ new Map();
4069
+ for (let e of t) {
4070
+ let t = o.get(e.sheet);
4071
+ t || (t = [], o.set(e.sheet, t)), t.push(e);
4072
+ }
4073
+ for (let [e, t] of o) {
4074
+ let r = n.get(e);
4075
+ if (!r) continue;
4076
+ let i = (e, t) => `${e},${t}`, o = /* @__PURE__ */ new Set();
4077
+ for (let e of t) e.formula === null && o.add(i(e.rowIndex, e.colIndex));
4078
+ for (let e of t) {
4079
+ if (e.formula === null) continue;
4080
+ let t = un(e.formula), n = !0;
4081
+ for (let e of t) if (!a(e)) {
4082
+ n = !1;
4083
+ break;
4084
+ }
4085
+ if (!n) continue;
4086
+ let s = [], c = [[e.rowIndex, e.colIndex]], l = /* @__PURE__ */ new Set([i(e.rowIndex, e.colIndex)]);
4087
+ for (; c.length > 0;) {
4088
+ let [e, t] = c.pop(), n = [
4089
+ [e + 1, t],
4090
+ [e - 1, t],
4091
+ [e, t + 1],
4092
+ [e, t - 1]
4093
+ ];
4094
+ for (let [e, t] of n) {
4095
+ let n = i(e, t);
4096
+ !l.has(n) && o.has(n) && (l.add(n), s.push([e, t]), c.push([e, t]));
4097
+ }
4098
+ }
4099
+ for (let [e, t] of s) o.delete(i(e, t)), r.getRange({
4100
+ rowStart: e,
4101
+ colStart: t,
4102
+ rowEnd: e,
4103
+ colEnd: t
4104
+ }).clear();
4105
+ r.getRange({
4106
+ rowStart: e.rowIndex,
4107
+ colStart: e.colIndex,
4108
+ rowEnd: e.rowIndex,
4109
+ colEnd: e.colIndex
4110
+ }).setValue("=" + e.formula);
4111
+ }
4112
+ }
4113
+ })(G, D, e);
4114
+ }
4115
+ if (le.forEach((e) => {
4116
+ e.deleteReference(se);
4117
+ }), ie.endPersist(), p) {
4118
+ ae(G);
4119
+ let e = /* @__PURE__ */ new Map(), t = 0;
4120
+ for (let n of j.getNames()) {
4121
+ let r = j.getEntry(n);
4122
+ if (!r) continue;
4123
+ let i = j.getRawEntry(n), a = i ? {
4124
+ data: r,
4125
+ uncompressedSize: j.uncompressedSize(n),
4126
+ raw: {
4127
+ compressedData: i.data,
4128
+ compressionMethod: i.compressionMethod,
4129
+ signature: i.signature
4130
+ }
4131
+ } : {
4132
+ data: r,
4133
+ uncompressedSize: j.uncompressedSize(n)
4134
+ };
4135
+ e.set(n, a), t += r.byteLength;
4136
+ }
4137
+ if (t > 67108864) _.push([`Source package too large to retain (${t} bytes, limit ${ve}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
4138
+ else if (e.size > 0) {
4139
+ let t = new f(e, pe);
4140
+ ce(G, t);
4141
+ let n = G.getWorksheets().getItems(), r = G.getTransactions().addListener({ onCommitEnd: (e) => {
4142
+ let n = e.getOperation()?.name;
4143
+ n !== "insertCells" && n !== "deleteCells" || t.markStructuralChange();
4144
+ } }), i = G.addListeners({ onSheetsChange: () => {
4145
+ let e = G.getWorksheets().getItems();
4146
+ (e.length !== n.length || e.some((e, t) => e !== n[t])) && t.markStructuralChange(), n = e;
4147
+ } });
4148
+ G.addListeners({ onClose: () => {
4149
+ r(), i(), ae(G);
4150
+ } });
4151
+ }
4152
+ }
4153
+ if (_.length && x?.onWarning) {
4154
+ let e = /* @__PURE__ */ new Set();
4155
+ for (let t of _) {
4156
+ let [n, r, i] = t, a = i ?? n;
4157
+ e.has(a) || (e.add(a), x.onWarning(n, r));
4158
+ }
4159
+ }
4160
+ return h && !0 === s && console.table(h.toTable()), await G.whenFontsReady(), G;
4161
+ } catch (e) {
4162
+ let t = "Unable to parse XLSX.";
4163
+ throw e instanceof He && (t = "Unable to open XLSX. There are too many rows or columns."), Error(t, { cause: e });
4164
+ } finally {
4165
+ await j.close().catch(() => {});
4166
+ }
4167
+ };
4168
+ export { qn as n, kn as r, ar as readXLSX, er as t };