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