@sheetxl/io-xlsx 0.8.0-beta.9 → 1.0.0

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