@sheetxl/io-xlsx 0.8.0-beta.2 → 0.8.0-beta.20

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 (217) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/Bw35-W8cnzxxvqQy.mjs +104 -0
  3. package/browser/esm/{CMHb6pUUmsCP9r_9.mjs → C16bEh6IrUpJONhS.mjs} +3 -3
  4. package/browser/esm/CPK1-z95jtLOfCXG.mjs +2474 -0
  5. package/browser/esm/CSOuRlSN9bhykqDr.mjs +4627 -0
  6. package/browser/esm/{DhqYgh9G2vLn7mIE.mjs → D2872f7aTugYxhht.mjs} +3 -3
  7. package/browser/esm/D7ogsrtXfjU5NW7r.mjs +10312 -0
  8. package/browser/esm/D8CQKL3Y3CMFOPqD.mjs +7007 -0
  9. package/browser/esm/{CMzkLUwbgA73RvCb.mjs → DpPFQ7-tBwVyjvWr.mjs} +3 -3
  10. package/browser/esm/{IZf0hIeLYj3T0Xvu.mjs → PgUWs0pPSCSFYJtU.mjs} +194 -144
  11. package/browser/esm/RFSuXvJ9sgsaA2LC.mjs +2433 -0
  12. package/browser/esm/{_UDbQq5-pHbU1f82.mjs → S4Uq85YdUb6O5Pz0.mjs} +2 -2
  13. package/browser/esm/index.mjs +3 -4
  14. package/licenses/dependencies.txt +2 -2
  15. package/node/esm/BOAucs-qLpjtUOcZ.mjs +6957 -0
  16. package/node/esm/{CY-pSutJLHskZfXZ.mjs → BSHqfcsR9hY-JB30.mjs} +2 -2
  17. package/node/esm/{CB1ijGbhl-e2l6Mm.mjs → C6eSWtTkyDQKbQdT.mjs} +3 -3
  18. package/node/esm/{Bi_kZVtZams7taqa.mjs → CPhiu1T7tl-leKh2.mjs} +3 -3
  19. package/node/esm/D2vDZOgLcv-YiWnB.mjs +4741 -0
  20. package/node/esm/DFw0ibBUmPyd-wey.mjs +2479 -0
  21. package/node/esm/DGuQIj077oygCTGu.mjs +2562 -0
  22. package/node/esm/Qn2Bv4QG3mOLiJHh.mjs +7269 -0
  23. package/node/esm/index.mjs +65 -28
  24. package/package.json +8 -9
  25. package/types/src/AutoFilterRules.d.ts +85 -22
  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 +30 -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/CustGeomUtils.d.ts +7 -0
  80. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  81. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  82. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +8 -3
  83. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +15 -2
  84. package/types/src/reader/domVisitors/CommentVisitor.d.ts +7 -2
  85. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  86. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +34 -1
  87. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  88. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +14 -2
  89. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +30 -2
  90. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  91. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +10 -0
  92. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +1 -11
  93. package/types/src/reader/domVisitors/FeaturePropertyBagVisitor.d.ts +18 -0
  94. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +0 -11
  95. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  96. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  97. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  98. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  99. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
  100. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +26 -5
  101. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +11 -2
  102. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +9 -3
  103. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  104. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  105. package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +9 -0
  106. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  107. package/types/src/reader/domVisitors/TimelinesVisitor.d.ts +13 -0
  108. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
  109. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  110. package/types/src/reader/domVisitors/index.d.ts +10 -36
  111. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
  112. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +31 -6
  113. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +26 -8
  114. package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
  115. package/types/src/richValue/IRichValueHandler.d.ts +109 -0
  116. package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
  117. package/types/src/richValue/RichDataParts.d.ts +69 -0
  118. package/types/src/richValue/RichRecordWriter.d.ts +61 -0
  119. package/types/src/richValue/RichValueHandlers.d.ts +25 -0
  120. package/types/src/richValue/RichValueResolver.d.ts +54 -0
  121. package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
  122. package/types/src/richValue/index.d.ts +7 -0
  123. package/types/src/utils/DrawingMLText.d.ts +39 -0
  124. package/types/src/utils/FormControls.d.ts +170 -0
  125. package/types/src/utils/SharedNames.d.ts +13 -0
  126. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  127. package/types/src/utils/VmlNoteShapes.d.ts +88 -35
  128. package/types/src/utils/VmlNoteStyle.d.ts +25 -0
  129. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  130. package/types/src/vba/VBAProject.d.ts +0 -19
  131. package/types/src/writer/EvaluationSheet.d.ts +5 -0
  132. package/types/src/writer/builder/Emitter.d.ts +5 -0
  133. package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
  134. package/types/src/writer/builder/PackageBuilder.d.ts +4 -41
  135. package/types/src/writer/builder/Types.d.ts +28 -28
  136. package/types/src/writer/emitters/CommentsEmitter.d.ts +10 -4
  137. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  138. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
  139. package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
  140. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
  141. package/types/src/writer/emitters/PivotTableEmitter.d.ts +30 -1
  142. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  143. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  144. package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
  145. package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
  146. package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
  147. package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
  148. package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
  149. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  150. package/types/src/writer/emitters/SlicerEmitter.d.ts +132 -0
  151. package/types/src/writer/emitters/StylesEmitter.d.ts +35 -2
  152. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  153. package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +7 -1
  154. package/types/src/writer/emitters/WorkbookEmitter.d.ts +24 -2
  155. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  156. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  157. package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
  158. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  159. package/types/src/writer/utils/DateSystem.d.ts +6 -0
  160. package/types/src/writer/utils/DefaultRows.d.ts +22 -0
  161. package/types/src/writer/utils/DrawMLUtils.d.ts +42 -3
  162. package/types/src/writer/utils/DummyFunction.d.ts +0 -25
  163. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  164. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  165. package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
  166. package/types/src/writer/utils/SheetStyleLayout.d.ts +86 -0
  167. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  168. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  169. package/types/src/writer/utils/XfVariants.d.ts +61 -0
  170. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  171. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  172. package/browser/cjs/BzOEBR0jaxXg9wvt.cjs +0 -5
  173. package/browser/cjs/C8oC1tPbhgR0Dqtx.cjs +0 -2
  174. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  175. package/browser/cjs/Ca-xJDjg5bOpUPXX.cjs +0 -1
  176. package/browser/cjs/D3EWCPfCu-qMOIGd.cjs +0 -1
  177. package/browser/cjs/DULsYP_GcPGLVYSE.cjs +0 -11
  178. package/browser/cjs/DtBN3UOzNJjYBwJ6.cjs +0 -1
  179. package/browser/cjs/index.cjs +0 -1
  180. package/browser/cjs/sNZR19Wk-XQ2xZ9E.cjs +0 -1
  181. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  182. package/browser/esm/B9q618XELV7uWJsA.mjs +0 -67
  183. package/browser/esm/BwbMurFOptAFs7gC.mjs +0 -5214
  184. package/browser/esm/D75_rfogFUfXADKc.mjs +0 -3324
  185. package/browser/esm/DfuBawaydlvgZMR-.mjs +0 -4428
  186. package/browser/esm/DoMlKUCnMSlR2qX5.mjs +0 -159
  187. package/browser/esm/DtpWa7tZahylJ3HS.mjs +0 -2310
  188. package/node/esm/BD03jrMQ_UKA196-.mjs +0 -4535
  189. package/node/esm/BxHvzSROx_N_7nJH.mjs +0 -2356
  190. package/node/esm/CO1M1H1N6fB422K-.mjs +0 -2959
  191. package/node/esm/CWpezSa6TERGEv-B.mjs +0 -3410
  192. package/node/esm/Dezt2uIDqlxjiuk5.mjs +0 -170
  193. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  194. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  195. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  196. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  197. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  198. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  199. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  200. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  201. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  202. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  203. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  204. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  205. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  206. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  207. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  208. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  209. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  210. package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
  211. package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
  212. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  213. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  214. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  215. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  216. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
  217. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +0 -28
@@ -0,0 +1,4627 @@
1
+ /**
2
+ * @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.20
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 "./DpPFQ7-tBwVyjvWr.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 ne, St as re, T as ie, Tt as S, Ur as C, Ut as ae, Vn as oe, Wr as w, Wt as T, Xn as se, Yn as ce, Z as le, Zn as ue, _ as de, _r as fe, _t as pe, ar as me, br as E, cr as D, ct as O, dn as k, dr as A, er as he, f as ge, fn as j, fr as _e, ft as ve, gr as M, ht as N, in as P, ir as F, it as I, jn as ye, jt as be, lt as xe, mn as Se, mt as Ce, n as we, nn as L, nr as Te, nt as Ee, o as De, 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 Ve, yn as B, yr as He, zr as Ue } from "./D7ogsrtXfjU5NW7r.mjs";
9
+ import { BufferUtils as V, CommonUtils as We, ExpectedError as Ge, OverlappingRange as Ke, RangeAxis as qe } from "@sheetxl/utils";
10
+ import { AddressUtils as H, BufferUtils as Je, CommonUtils as Ye, CoordUtils as Xe, FormulaError as Ze, FormulaText as Qe, FunctionDeclarations as $e, ICellStyle as et, ICondition as tt, IConditionalFormat as nt, ICustomProperty as U, IFont as rt, IRange as it, ITextFrame as at, NumberFormat as ot, OutOfBoundsError as st, PersonCollection as ct, ResourceCollection as lt, RichDataRegistry as ut, Scalar as dt, Sort as ft, Theme as pt, Tuple as mt, Workbook as ht, pivotCellFormatsOf as W } from "@sheetxl/sdk";
11
+ var gt = {
12
+ ascending: "ascending",
13
+ descending: "descending",
14
+ natural: "dataSource"
15
+ };
16
+ function _t(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 = bt(u, n.json), n.json.pivot = yt(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 ? vt(p.columns, u.columnId) : null;
63
+ p && m ? (n.json = bt(u, n.json, Qe.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 vt(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 yt(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 bt(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 ? gt[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 xt = "xl/richData/rdrichvaluestructure.xml", St = "xl/richData/rdrichvalue.xml", Ct = "xl/richData/rdarray.xml", wt = "xl/richData/rdsupportingpropertybagstructure.xml", Tt = "xl/richData/rdsupportingpropertybag.xml", Et = "xl/richData/rdRichValueTypes.xml", Dt = "xl/richData/richStyles.xml", G = (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
+ }, Ot = (e) => G(e, "k").map((e) => [e.getAttribute("n") ?? "", e.getAttribute("t") || null]), kt = (e) => G(e, "v").map((e) => ({
119
+ t: e.getAttribute("t") || null,
120
+ text: e.textContent ?? ""
121
+ })), At = (e) => {
122
+ let t = /* @__PURE__ */ new Map();
123
+ for (let n of G(e, "key")) {
124
+ let e = /* @__PURE__ */ new Map();
125
+ for (let t of G(n, "flag")) e.set(t.getAttribute("name") ?? "", t.getAttribute("value") ?? "");
126
+ t.set(n.getAttribute("name") ?? "", e);
127
+ }
128
+ return t;
129
+ }, jt = /* @__PURE__ */ new Uint8Array(), Mt = 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 ? jt : t instanceof Uint8Array ? t : new Uint8Array(t), r = t instanceof Blob ? new Ue(t) : new C(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 w());
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 w()).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
+ }, Nt = class {
204
+ constructor(e) {
205
+ this._sink = e, this._samples = [], this._t0 = Pt(), this._tPrev = this._t0, this._heapPrev = Ft();
206
+ }
207
+ mark(e) {
208
+ let t = Pt(), n = Ft(), 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: It()
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 ? "—" : Lt(e.heapBytes / 1048576),
227
+ dHeapMB: e.dHeapBytes === void 0 ? "—" : Lt(e.dHeapBytes / 1048576),
228
+ rssMB: e.rssBytes === void 0 ? "—" : Lt(e.rssBytes / 1048576)
229
+ }));
230
+ }
231
+ }, Pt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now();
232
+ function Ft() {
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 It() {
239
+ let e = globalThis.process;
240
+ if (typeof e == "object" && typeof e.memoryUsage == "function") return e.memoryUsage().rss;
241
+ }
242
+ function Lt(e) {
243
+ return Math.round(10 * e) / 10;
244
+ }
245
+ var Rt = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", zt = `-${Rt}.0-9·̀-ͯ‿-⁀`, Bt = (RegExp(`^[${Rt}]$`, "u"), RegExp(`^[${zt}]$`, "u"), RegExp(`^[${Rt}][${zt}]*$`, "u")), Vt = (RegExp(`^[${zt}]+$`, "u"), [
246
+ 32,
247
+ 10,
248
+ 13,
249
+ 9
250
+ ]);
251
+ function Ht(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 Ut = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Wt = `-${Ut}.0-9·̀-ͯ‿-⁀`;
255
+ RegExp(`^[${Ut}]$`, "u"), RegExp(`^[${Wt}]$`, "u"), RegExp(`^[${Ut}][${Wt}]*$`, "u"), RegExp(`^[${Wt}]+$`, "u");
256
+ var Gt = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Kt = `-${Gt}.0-9·̀-ͯ‿-⁀`, qt = (RegExp(`^[${Gt}]$`, "u"), RegExp(`^[${Kt}]$`, "u"), RegExp(`^[${Gt}][${Kt}]*$`, "u"));
257
+ function Jt(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 K = function(e) {
261
+ return e === 32 || e === 10 || e === 13 || e === 9;
262
+ }, Yt = function(e) {
263
+ return e >= 32 && e <= 55295 || e === 10 || e === 13 || e === 9 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
264
+ }, Xt = Ht, Zt = function(e) {
265
+ return Ht(e) || e >= 48 && e <= 57 || e === 45 || e === 46 || e === 183 || e >= 768 && e <= 879 || e >= 8255 && e <= 8256;
266
+ }, Qt = Vt, $t = Bt, en = function(e) {
267
+ return e >= 1 && e <= 55295 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
268
+ }, tn = Jt, nn = function(e) {
269
+ return Jt(e) || e === 45 || e === 46 || e >= 48 && e <= 57 || e === 183 || e >= 768 && e <= 879 || e >= 8255 && e <= 8256;
270
+ }, rn = qt, an = "http://www.w3.org/XML/1998/namespace", on = "http://www.w3.org/2000/xmlns/", sn = {
271
+ __proto__: null,
272
+ xml: an,
273
+ xmlns: on
274
+ }, cn = {
275
+ __proto__: null,
276
+ amp: "&",
277
+ gt: ">",
278
+ lt: "<",
279
+ quot: "\"",
280
+ apos: "'"
281
+ }, q = -1, ln = -2, J = 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
+ ...Qt
293
+ ], bn = [
294
+ ...Qt,
295
+ Y,
296
+ 38,
297
+ fn
298
+ ];
299
+ function xn(e, t, n) {
300
+ switch (t) {
301
+ case "xml":
302
+ n !== an && e.fail(`xml prefix must be bound to ${an}.`);
303
+ break;
304
+ case "xmlns": n !== on && e.fail(`xmlns prefix must be bound to ${on}.`);
305
+ }
306
+ switch (n) {
307
+ case on:
308
+ e.fail(t === "" ? `the default namespace may not be set to ${n}.` : `may not assign a prefix (even "xmlns") to the URI ${on}.`);
309
+ break;
310
+ case an: 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) => rn.test(e), wn = (e) => $t.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 = tn, this.nameCheck = nn, this.isName = Cn, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = {
342
+ __proto__: null,
343
+ ...sn
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 = Xt, this.nameCheck = Zt, 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 ? J : 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(cn), 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 q;
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, ln;
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 q;
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, ln;
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 === ln ? 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 === ln, a = i ? dn : r;
495
+ if (a === q || 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 ln:
505
+ this.text += `${n.slice(t, this.prevI)}\n`, t = this.i, r = dn;
506
+ break;
507
+ case q: 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 === q) return this.name += e.slice(t), q;
517
+ if (!Zt(n)) return this.name += e.slice(t, this.prevI), n === ln ? dn : n;
518
+ }
519
+ }
520
+ skipSpaces() {
521
+ for (;;) {
522
+ let e = this.getCodeNorm();
523
+ if (e === q || !K(e)) return e;
524
+ }
525
+ }
526
+ setXMLVersion(e) {
527
+ this.currentXMLVersion = e, e === "1.0" ? (this.isChar = Yt, this.getCode = this.getCode10) : (this.isChar = en, 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 q: break;
539
+ default: this.unGet(), this.state = J, 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 = J, this.doctype = !0;
547
+ break;
548
+ case q: 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 !== q && (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 ln:
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 === J && this.textHandler === void 0 || (this.text += i);
610
+ break t;
611
+ }
612
+ case q:
613
+ this.entity += t.slice(e);
614
+ break t;
615
+ }
616
+ }
617
+ sOpenWaka() {
618
+ let e = this.getCode();
619
+ if (Xt(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 = J, 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 = J : (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 = J;
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 || K(e) ? (this.fail("processing instruction without a target."), this.state = e === X ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(e), this.state = 24);
680
+ }
681
+ sPIRest() {
682
+ let { chunk: e, i: t } = this;
683
+ for (;;) {
684
+ let n = this.getCodeNorm();
685
+ if (n === q) 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 || K(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 : K(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 = J;
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 !== q && (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 (K(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
+ K(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
+ K(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 === q) 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 : (K(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 = J) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
766
+ }
767
+ sOpenTag() {
768
+ let e = this.captureNameChars();
769
+ if (e === q) 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: K(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 !== q && (Xt(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 : K(e) ? this.state = 38 : e === Y ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : e !== q && this.fail("disallowed character in attribute name.");
794
+ }
795
+ sAttribNameSawWhite() {
796
+ let e = this.skipSpaces();
797
+ switch (e) {
798
+ case q: 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() : Xt(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) : K(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 ln:
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 q:
827
+ this.text += t.slice(n);
828
+ return;
829
+ }
830
+ }
831
+ sAttribValueClosed() {
832
+ let e = this.getCodeNorm();
833
+ K(e) ? this.state = 36 : e === Y ? this.openTag() : e === 47 ? this.state = 35 : Xt(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 q: 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() : K(e) ? this.state = 44 : e !== q && this.fail("disallowed character in closing tag.");
851
+ }
852
+ sCloseTagSawWhite() {
853
+ switch (this.skipSpaces()) {
854
+ case Y:
855
+ this.closeTag();
856
+ break;
857
+ case q: 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 = J, 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 ln:
890
+ r !== void 0 && (this.text += `${n.slice(e, this.prevI)}\n`), e = this.i, t = 0;
891
+ break;
892
+ case q:
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 = J, n !== void 0 && (this.text += t.slice(e, this.prevI)), r = !0;
912
+ break t;
913
+ case ln:
914
+ n !== void 0 && (this.text += `${t.slice(e, this.prevI)}\n`), e = this.i;
915
+ break;
916
+ case q:
917
+ n !== void 0 && (this.text += t.slice(e));
918
+ break t;
919
+ default: K(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 !== J && 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" ? on : "", 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 = J, 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 = J, this.name = "";
1006
+ }
1007
+ closeTag() {
1008
+ let { tags: e, name: t } = this;
1009
+ if (this.state = J, 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(${ne}(`, 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) => [H.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 = H.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) => H.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) ? rt.Style.Italic : rt.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 = S(t.val);
1561
+ break;
1562
+ case "vertAlign": {
1563
+ let e = Ve(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
+ re(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 = he((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: rt.Style.Normal,
1630
+ underline: rt.UnderlineStyle.None,
1631
+ strike: rt.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: T(t("colOff") ?? "0") ?? 0,
1671
+ y: T(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 mt.TransposedBuilder(), b = null, ee = "topLeft";
1678
+ d.registerVisitor({
1679
+ from: "autoFilter",
1680
+ to: "autoTable",
1681
+ openTag: (e) => {
1682
+ let t = e.getAttribute("ref"), n = H.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 = O(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) => {
1735
+ let t = e.conditions ?? [], n = [];
1736
+ for (let e = 0; e < t.length; e++) {
1737
+ let r = t[e], i = {};
1738
+ r.type && (i.type = r.type), r.value !== void 0 && (i.value = r.value), r.exclusive && (i.exclusive = !0), n.push(i);
1739
+ }
1740
+ return n;
1741
+ };
1742
+ d.registerVisitor({
1743
+ from: "colorScale",
1744
+ to: {},
1745
+ openTag: (e) => {},
1746
+ closeTag: (e) => {
1747
+ let t = e.getSource(), n = t.colors ?? [], r = te(t);
1748
+ for (let e = 0; e < r.length; e++) r[e].color = n[e];
1749
+ e.getParent().scale = {
1750
+ type: nt.ScaleType.ColorScale,
1751
+ stops: r
1752
+ };
1753
+ }
1754
+ }), d.registerVisitor({
1755
+ from: "dataBar",
1756
+ to: {},
1757
+ openTag: (e) => {
1758
+ e.copyTo("maxLength", Q), e.copyTo("minLength", Q), e.copyTo("showValue", Z);
1759
+ },
1760
+ closeTag: (e) => {
1761
+ let t = e.getSource(), n = {
1762
+ type: nt.ScaleType.DataBar,
1763
+ stops: te(t)
1764
+ }, r = t.colors?.[0];
1765
+ r && (n.color = r), t.minLength !== void 0 && (n.minLength = t.minLength), t.maxLength !== void 0 && (n.maxLength = t.maxLength), t.showValue !== void 0 && (n.showValue = t.showValue), e.getParent().scale = n;
1766
+ }
1767
+ }), d.registerVisitor({
1768
+ from: "iconSet",
1769
+ to: {},
1770
+ openTag: (e) => {
1771
+ e.copyTo("iconSet", $), e.copyTo("reverse", Z), e.copyTo("showValue", Z);
1772
+ },
1773
+ closeTag: (e) => {
1774
+ let t = e.getSource(), n = {
1775
+ type: nt.ScaleType.IconSet,
1776
+ stops: te(t)
1777
+ };
1778
+ 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;
1779
+ }
1780
+ }), d.registerVisitor({
1781
+ from: "formula",
1782
+ to: {},
1783
+ text: (e, t) => {
1784
+ let n = t.getParent(), r = n.formulas;
1785
+ r || (r = [], n.formulas = r), r.push(_(e));
1786
+ }
1787
+ }), d.registerVisitor({
1788
+ from: "cfvo",
1789
+ to: {},
1790
+ openTag: (e) => {
1791
+ let t = e.getParent();
1792
+ t.conditions ||= [];
1793
+ let n = e.getSource();
1794
+ if (t.conditions.push(n), e.copyTo("type", $), n.type === nt.ColorStopType.Formula) {
1795
+ let t = e.getAttribute("val");
1796
+ t != null && (n.value = _(String(t)));
1797
+ } else e.copyTo("value", Pn, "val");
1798
+ !1 === e.getAttribute("gte", Z) && (n.exclusive = !0);
1799
+ }
1800
+ }), d.registerVisitor({
1801
+ from: "color",
1802
+ to: {},
1803
+ openTag: (e) => {
1804
+ let t = e.getParent();
1805
+ t.colors ||= [];
1806
+ let n = he((t) => e.getAttribute(t));
1807
+ t.colors.push(n);
1808
+ }
1809
+ }), d.registerVisitor({
1810
+ from: "filterColumn",
1811
+ to: {},
1812
+ openTag: (e) => {
1813
+ let t = e.getParent().v, n = parseInt(e.getAttribute("colId")), r = e.getSource();
1814
+ r.index = n;
1815
+ let i = t.filter;
1816
+ i || (i = { conditions: [] }, t.filter = i);
1817
+ let a = i.conditions;
1818
+ if (a || (a = [], i.conditions = a), a.push(r), e.getAttribute("hiddenButton", Z) && t) {
1819
+ let e = t.hiddenButtons;
1820
+ e || (e = [], t.hiddenButtons = e), e.push(n);
1821
+ }
1822
+ if (e.getAttribute("showButton", Z) && t) {
1823
+ let e = t.showButtons;
1824
+ e || (e = [], t.showButtons = e), e.push(n);
1825
+ }
1826
+ return r;
1827
+ }
1828
+ }), d.registerVisitor({
1829
+ from: "colorFilter",
1830
+ openTag: (e) => {
1831
+ let t = e.getParent(), n = {};
1832
+ t.operator = tt.BuiltInOperatorNames.Color, t.param = n, e.copyToObject(n, "cellColor", Z);
1833
+ let r = p(e);
1834
+ r && (n.style = r);
1835
+ }
1836
+ }), d.registerVisitor({
1837
+ from: "iconFilter",
1838
+ openTag: (e) => {
1839
+ let t = e.getParent(), n = {};
1840
+ t.operator = tt.BuiltInOperatorNames.Icon, t.param = n, e.copyToObject(n, "iconId", Q), e.copyToObject(n, "iconSet", $);
1841
+ }
1842
+ }), d.registerVisitor({
1843
+ from: "top10",
1844
+ openTag: (e) => {
1845
+ let t = e.getParent(), n = {};
1846
+ t.operator = tt.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");
1847
+ }
1848
+ }), d.registerVisitor({
1849
+ from: "dynamicFilter",
1850
+ openTag: (e) => {
1851
+ let t = e.getParent(), n = k(e.getAttribute("type"), e.getAttribute("val"), e.getAttribute("maxVal"));
1852
+ t.operator = n.operator, t.param = n.param;
1853
+ }
1854
+ });
1855
+ let x = {
1856
+ from: "filters",
1857
+ to: {},
1858
+ openTag: (e) => {
1859
+ let t = e.getParent(), n = {};
1860
+ return t.selector = tt.BuiltInSelectorNames.Display, t.operator = tt.BuiltInOperatorNames.InSet, t.param = n, e.copyToObject(n, "blank", Z), e.copyToObject(n, "calendarType", $), n;
1861
+ }
1862
+ };
1863
+ d.registerVisitor(x);
1864
+ let ne = {
1865
+ from: "filter",
1866
+ openTag: (e) => {
1867
+ let t = e.getParent(), n = t.items;
1868
+ n || (n = [], t.items = n), n.push(e.getAttribute("val", $));
1869
+ }
1870
+ };
1871
+ d.registerVisitor(ne);
1872
+ let re = {
1873
+ from: "dateGroupItem",
1874
+ to: {},
1875
+ openTag: (e) => {
1876
+ let t = e.getParent(), n = t.dateGroups;
1877
+ 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);
1878
+ }
1879
+ };
1880
+ d.registerVisitor(re);
1881
+ let ie = /* @__PURE__ */ new Map();
1882
+ ie.set("filterColumn", {
1883
+ from: "filterColumn",
1884
+ transparent: !0
1885
+ }), ie.set("filters", x), ie.set("filter", ne), ie.set("dateGroupItem", re), d.registerVisitor({
1886
+ from: "customFilters",
1887
+ openTag: (e) => {
1888
+ let t = e.getParent(), n = e.getAttribute("and"), r = n === "and" || n === "1", i = [];
1889
+ return t.operator = r ? tt.BuiltInOperatorNames.And : tt.BuiltInOperatorNames.Or, t.param = i, e.setSource(t), i;
1890
+ },
1891
+ closeTag: (e) => {
1892
+ let t = e.getSource(), n = t?.param;
1893
+ if (!t || !n) return;
1894
+ let r = n.length === 1 ? n[0] : j(t);
1895
+ r !== t && (t.operator = r.operator, t.param = r.param);
1896
+ }
1897
+ }), d.registerVisitor({
1898
+ from: "customFilter",
1899
+ openTag: (e) => {
1900
+ let t = e.getParent(), n;
1901
+ Array.isArray(t) ? (n = {}, t.push(n)) : n = t;
1902
+ let r = B({
1903
+ operator: e.getAttribute("operator"),
1904
+ val: e.getAttribute("val")
1905
+ }, (t) => e.warn(t));
1906
+ r && (n.operator = r.operator, n.param = r.param);
1907
+ }
1908
+ });
1909
+ let S = {}, C = null;
1910
+ d.registerVisitor({
1911
+ from: "sortState",
1912
+ to: {},
1913
+ openTag: (e) => {
1914
+ let t = e.getParent(), n = t.v;
1915
+ if (!n) return;
1916
+ let r = {};
1917
+ S = {};
1918
+ let i = e.getAttribute("caseSensitive", Z);
1919
+ i != null && (S.collatorOptions = i ? ft.CaseSensitiveOptions : ft.CaseInsensitiveOptions);
1920
+ let a = e.getAttribute("sortMethod");
1921
+ a !== "stroke" && a !== "pinYin" || (S.collatorOptions = {
1922
+ ...S.collatorOptions,
1923
+ collation: a === "stroke" ? "stroke" : "pinyin"
1924
+ }), e.getAttribute("columnSort", Z) && (r.axis = it.Axis.Column);
1925
+ let o = e.getAttribute("ref"), s = t.r;
1926
+ C = o && s ? H.fastStringToRange(o) : null, C && (r.extent = { range: v(s, C) }), n.sort = r, e.setSource(t);
1927
+ }
1928
+ }), d.registerVisitor({
1929
+ from: "sortCondition",
1930
+ to: {},
1931
+ openTag: (e) => {
1932
+ let t = e.getParent(), n = t.v;
1933
+ if (!n) return;
1934
+ let r = n.sort;
1935
+ if (!r) return;
1936
+ let i = r.sorts;
1937
+ i || (i = [], r.sorts = i);
1938
+ let a = e.getAttribute("ref"), o = 0, s = null;
1939
+ if (a) {
1940
+ let e = H.fastStringToRange(a, gr), n = e.colStart, r = t.r, i = r.colStart;
1941
+ o = r ? n - i : n, r && C && (s = be(r, C, e));
1942
+ }
1943
+ r.extent && (r.extent.sorts ??= []).push(s);
1944
+ let c = { ...S }, l = Se(e.getAttribute("sortBy"));
1945
+ l && (c.sortOn = l);
1946
+ let u = p(e);
1947
+ u && (c.style = u), e.copyToObject(c, "iconSet", $), e.copyToObject(c, "customList", $), c.reverse = e.getAttribute("descending", Z) ?? !1;
1948
+ let d = {
1949
+ index: o,
1950
+ criteria: c
1951
+ };
1952
+ i.push(d);
1953
+ }
1954
+ });
1955
+ let oe = (e) => {
1956
+ b = e.getSource(), ee = "topLeft", e.copyTo("topLeft", $, "topLeftCell");
1957
+ let t = ae(e.getAttribute("defaultGridColor")), n = e.getAttribute("colorId");
1958
+ 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");
1959
+ let r = {};
1960
+ for (let [t, n] of N) {
1961
+ let i = e.getAttribute(n, Q);
1962
+ i && (r[t] = Math.min(400, Math.max(10, i)));
1963
+ }
1964
+ 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);
1965
+ };
1966
+ d.registerVisitor({
1967
+ from: "sheetView",
1968
+ to: "view",
1969
+ openTag: (e) => {
1970
+ oe(e);
1971
+ },
1972
+ closeTag: () => {
1973
+ b = null;
1974
+ }
1975
+ }), d.registerVisitor({
1976
+ from: "customSheetViews",
1977
+ to: "customSheetViews",
1978
+ openTag: (e) => {
1979
+ e.setSource([]);
1980
+ }
1981
+ }), d.registerVisitor({
1982
+ from: "customSheetView",
1983
+ to: [],
1984
+ openTag: (e) => {
1985
+ w = !0, oe(e);
1986
+ },
1987
+ closeTag: () => {
1988
+ w = !1, b = null;
1989
+ }
1990
+ }), d.registerVisitor({
1991
+ from: "selection",
1992
+ to: null,
1993
+ openTag: (e) => {
1994
+ if (!b) return;
1995
+ let t = e.getAttribute("activeCell")?.replace(/\$/g, ""), n = e.getAttribute("sqref")?.replace(/\$/g, ""), r = e.getAttribute("pane") ?? "topLeft";
1996
+ if (r !== ee) {
1997
+ let e = b.freezePanes;
1998
+ if (e && t) {
1999
+ let i = { activeCell: t };
2000
+ n && n !== t && (i.sqref = n), (e.paneSelections ??= {})[r] = i;
2001
+ }
2002
+ return;
2003
+ }
2004
+ let i = {};
2005
+ t && (i.cell = t);
2006
+ let a = e.getAttribute("activeCellId", Q);
2007
+ a !== null && (i.rangeIndex = a), n && n !== t && (i.ranges = n.trim().split(/\s+/)), b.selection = i;
2008
+ }
2009
+ }), d.registerVisitor({
2010
+ from: "pane",
2011
+ to: null,
2012
+ openTag: (e) => {
2013
+ if (!b) return;
2014
+ ee = e.getAttribute("activePane") ?? "topLeft";
2015
+ let t = e.getAttribute("state");
2016
+ if (t === "frozen" || t === "frozenSplit") {
2017
+ let t = {};
2018
+ b.freezePanes = t, e.copyToObject(t, "topLeft", $, "topLeftCell");
2019
+ let n = (b.topLeft ? H.fastStringToCell(b.topLeft) : void 0) ?? {
2020
+ colIndex: 0,
2021
+ rowIndex: 0
2022
+ }, r = {
2023
+ colIndex: 0,
2024
+ rowIndex: 0
2025
+ };
2026
+ e.copyToObject(r, "colIndex", Q, "xSplit"), e.copyToObject(r, "rowIndex", Q, "ySplit");
2027
+ let i = {
2028
+ colIndex: n.colIndex + r.colIndex,
2029
+ rowIndex: n.rowIndex + r.rowIndex
2030
+ };
2031
+ t.coords = H.cellToString(i);
2032
+ }
2033
+ }
2034
+ }), d.registerVisitor({
2035
+ from: "sheetPr",
2036
+ transparent: !0,
2037
+ openTag: (t) => {
2038
+ let n = t.getAttribute("codeName");
2039
+ 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);
2040
+ let r = {};
2041
+ !0 === t.getAttribute("syncHorizontal", Z) && (r.horizontal = !0), !0 === t.getAttribute("syncVertical", Z) && (r.vertical = !0);
2042
+ let i = t.getAttribute("syncRef");
2043
+ i && (r.anchor = i), Object.keys(r).length > 0 && (e.syncScroll = r);
2044
+ }
2045
+ }), d.registerVisitor({
2046
+ from: "tabColor",
2047
+ to: null,
2048
+ openTag: (t) => {
2049
+ let n = he((e) => t.getAttribute(e));
2050
+ n && (e.tabColor = n);
2051
+ }
2052
+ });
2053
+ let w = !1, T = () => e.pageLayout ??= {};
2054
+ d.registerVisitor({
2055
+ from: "pageSetUpPr",
2056
+ to: null,
2057
+ openTag: (e) => {
2058
+ !0 === e.getAttribute("fitToPage", Z) && (T().fitToPage = !0), !1 === e.getAttribute("autoPageBreaks", Z) && (T().hideAutoPageBreaks = !0);
2059
+ }
2060
+ }), d.registerVisitor({
2061
+ from: "outlinePr",
2062
+ to: null,
2063
+ openTag: (t) => {
2064
+ let n = (e) => {
2065
+ let n = t.getAttribute(e);
2066
+ return n === "0" || n === "false";
2067
+ }, r = {};
2068
+ n("summaryBelow") && (r.summaryRow = "up"), n("summaryRight") && (r.summaryColumn = "left"), ((e) => {
2069
+ let n = t.getAttribute(e);
2070
+ return n === "1" || n === "true";
2071
+ })("applyStyles") && (r.automaticStyles = !0), Object.keys(r).length > 0 && (e.outline = r);
2072
+ }
2073
+ }), d.registerVisitor({
2074
+ from: "pageMargins",
2075
+ to: null,
2076
+ openTag: (e) => {
2077
+ if (w) return;
2078
+ let t = (t, n) => e.getAttribute(t, Pn) ?? n, n = {
2079
+ left: t("left", .7),
2080
+ right: t("right", .7),
2081
+ top: t("top", .75),
2082
+ bottom: t("bottom", .75),
2083
+ header: t("header", .3),
2084
+ footer: t("footer", .3)
2085
+ };
2086
+ n.left === .7 && n.right === .7 && n.top === .75 && n.bottom === .75 && n.header === .3 && n.footer === .3 || (T().margins = n);
2087
+ }
2088
+ }), d.registerVisitor({
2089
+ from: "pageSetup",
2090
+ to: null,
2091
+ openTag: (e) => {
2092
+ if (w) return;
2093
+ let n = T(), r = (t) => e.getAttribute(t, Q) ?? void 0, i = (t) => e.getAttribute(t, Z), a = e.getAttribute("orientation");
2094
+ a !== "landscape" && a !== "portrait" || (n.orientation = a);
2095
+ for (let e of [
2096
+ "paperSize",
2097
+ "scale",
2098
+ "fitToWidth",
2099
+ "fitToHeight",
2100
+ "firstPageNumber",
2101
+ "horizontalDpi",
2102
+ "verticalDpi",
2103
+ "copies"
2104
+ ]) {
2105
+ let t = r(e);
2106
+ t !== void 0 && (n[e] = t);
2107
+ }
2108
+ let o = e.getAttribute("paperHeight");
2109
+ o && (n.paperHeight = o);
2110
+ let s = e.getAttribute("paperWidth");
2111
+ 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);
2112
+ let c = e.getAttribute("cellComments"), l = ve.find(([e]) => e === c)?.[1];
2113
+ l && (n.printComments = l);
2114
+ let u = e.getAttribute("errors"), d = Ce.find(([e]) => e === u)?.[1];
2115
+ d && (n.printErrors = d);
2116
+ let f = e.getAttribute("r:id"), p = f ? t(f, "part") : null;
2117
+ p && (n.printerSettings = p);
2118
+ }
2119
+ }), d.registerVisitor({
2120
+ from: "printOptions",
2121
+ to: null,
2122
+ openTag: (e) => {
2123
+ if (w) return;
2124
+ let t = (t) => !0 === e.getAttribute(t, Z);
2125
+ t("horizontalCentered") && (T().centerHorizontally = !0), t("verticalCentered") && (T().centerVertically = !0), t("gridLines") && (T().printGridlines = !0), t("headings") && (T().printHeadings = !0);
2126
+ }
2127
+ }), d.registerVisitor({
2128
+ from: "headerFooter",
2129
+ to: {},
2130
+ openTag: (e) => {
2131
+ if (w) return;
2132
+ let t = {}, n = (t) => e.getAttribute(t, Z);
2133
+ !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 && (T().headerFooter = t);
2134
+ }
2135
+ });
2136
+ for (let e of Me) d.registerVisitor({
2137
+ from: e,
2138
+ to: {},
2139
+ text: (t, n) => {
2140
+ if (w) return;
2141
+ let r = T(), i = r.headerFooter ??= {};
2142
+ i[e] = (i[e] ?? "") + f(t);
2143
+ }
2144
+ });
2145
+ let se = "rowBreaks";
2146
+ for (let [e, t] of [["rowBreaks", "rowBreaks"], ["colBreaks", "columnBreaks"]]) d.registerVisitor({
2147
+ from: e,
2148
+ to: {},
2149
+ openTag: () => {
2150
+ se = t;
2151
+ }
2152
+ });
2153
+ d.registerVisitor({
2154
+ from: "brk",
2155
+ to: null,
2156
+ openTag: (e) => {
2157
+ if (w) return;
2158
+ let t = e.getAttribute("id", Q);
2159
+ if (t == null) return;
2160
+ let n = { index: t }, r = e.getAttribute("min", Q);
2161
+ r != null && (n.min = r);
2162
+ let i = e.getAttribute("max", Q);
2163
+ i != null && (n.max = i), !0 !== e.getAttribute("man", Z) && (n.automatic = !0), !0 === e.getAttribute("pt", Z) && (n.pivot = !0);
2164
+ let a = T();
2165
+ (a[se] ??= []).push(n);
2166
+ }
2167
+ }), d.registerVisitor({
2168
+ from: "ignoredErrors",
2169
+ transparent: !0
2170
+ }), d.registerVisitor({
2171
+ from: "ignoredError",
2172
+ to: null,
2173
+ openTag: (t) => {
2174
+ let n = t.getAttribute("sqref");
2175
+ if (!n) return;
2176
+ let r = [];
2177
+ for (let e of u) !0 === t.getAttribute(e, Z) && r.push(e);
2178
+ if (r.length !== 0) for (let t of n.trim().split(/\s+/)) (e.ignoredErrors ??= []).push({
2179
+ r: t,
2180
+ v: r
2181
+ });
2182
+ }
2183
+ }), d.registerVisitor({
2184
+ from: "mergeCells",
2185
+ to: "merges",
2186
+ openTag: (e) => {
2187
+ e.setSource([]);
2188
+ }
2189
+ }), d.registerVisitor({
2190
+ from: "dataValidations",
2191
+ to: "validations",
2192
+ openTag: (t) => {
2193
+ t.setSource([]);
2194
+ let n = {};
2195
+ !0 === t.getAttribute("disablePrompts", Z) && (n.disablePrompts = !0);
2196
+ let r = t.getAttribute("xWindow", Q);
2197
+ r !== null && (n.windowX = r);
2198
+ let i = t.getAttribute("yWindow", Q);
2199
+ i !== null && (n.windowY = i), Object.keys(n).length > 0 && (e.validationSettings = {
2200
+ ...e.validationSettings,
2201
+ ...n
2202
+ });
2203
+ }
2204
+ });
2205
+ let ce = {
2206
+ from: "dataValidation",
2207
+ to: [],
2208
+ openTag: (e) => {
2209
+ let t = e.getAttribute("sqref");
2210
+ t &&= t.trim().split(/\s+/).join(",");
2211
+ let n = {}, r = {
2212
+ r: t,
2213
+ v: n,
2214
+ rule: {
2215
+ type: e.getAttribute("type") ?? void 0,
2216
+ operator: e.getAttribute("operator") ?? void 0
2217
+ }
2218
+ };
2219
+ !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);
2220
+ },
2221
+ closeTag: (e) => {
2222
+ let t = e.getSource();
2223
+ if (!t?.rule) return;
2224
+ let n = ke(t.rule, s);
2225
+ n && (e.getAttribute("allowBlank", Z) && (n.includeBlanks = !0), t.v.condition = n), delete t.rule;
2226
+ }
2227
+ };
2228
+ d.registerVisitor(ce), d.registerVisitor({
2229
+ from: "formula1",
2230
+ to: {},
2231
+ text: (e, t) => {
2232
+ let n = t.getParent().rule;
2233
+ n?.type && (n.formula1 = I(_(e), n.type));
2234
+ }
2235
+ }), d.registerVisitor({
2236
+ from: "formula2",
2237
+ to: {},
2238
+ text: (e, t) => {
2239
+ let n = t.getParent().rule;
2240
+ n?.type && (n.formula2 = I(_(e), n.type));
2241
+ }
2242
+ }), d.registerVisitor({
2243
+ from: "picture",
2244
+ to: "picture",
2245
+ openTag: (e) => {
2246
+ let n = e.getAttribute("r:id");
2247
+ if (!n) return void e.warn("A picture names no image; it was not imported.", { onceKey: "xlsx.sheet.picture.noRel" });
2248
+ let r = t(n, "resource");
2249
+ e.getSource().resId = r;
2250
+ }
2251
+ });
2252
+ let ue = {
2253
+ from: "slicer",
2254
+ to: {},
2255
+ openTag: (e) => {
2256
+ let n = e.getAttribute("r:id");
2257
+ if (!n) return void e.warn("A slicer names no cache; it was not imported.", { onceKey: "xlsx.sheet.slicer.noRel" });
2258
+ let r = t(n)?.slicers, i = e.getParent();
2259
+ i.slicers ||= {};
2260
+ let a = Object.keys(r);
2261
+ for (let e of a) i.slicers[e] = r[e];
2262
+ }
2263
+ };
2264
+ d.registerVisitor(ue);
2265
+ let fe = {
2266
+ from: "timelineRef",
2267
+ to: {},
2268
+ openTag: (e) => {
2269
+ let n = e.getAttribute("r:id"), r = n ? t(n)?.slicers : void 0;
2270
+ if (!r) return void e.warn("A timeline names no part; it was not imported.", { onceKey: "xlsx.sheet.timeline.noRel" });
2271
+ let i = e.getParent();
2272
+ i.slicers ??= {};
2273
+ for (let e of Object.keys(r)) i.slicers[e] = r[e];
2274
+ }
2275
+ }, ge = (e, t) => ({
2276
+ from: e,
2277
+ to: {},
2278
+ openTag: (e) => {
2279
+ e.setSource("");
2280
+ },
2281
+ text: (e, t) => {
2282
+ t.setSource((t.getSource() ?? "") + e);
2283
+ },
2284
+ closeTag: (e) => {
2285
+ t(String(e.getSource() ?? ""), e);
2286
+ }
2287
+ }), P = /* @__PURE__ */ new Map();
2288
+ P.set("dataValidations", {
2289
+ from: "dataValidations",
2290
+ to: "validations",
2291
+ openTag: (e) => {
2292
+ let t = e.getParent();
2293
+ e.setSource(t.validations ?? []);
2294
+ },
2295
+ closeTag: (e) => {
2296
+ (e.getSource()?.length ?? 0) === 0 && e.setSource(void 0);
2297
+ }
2298
+ }), P.set("dataValidation", {
2299
+ ...ce,
2300
+ closeTag: (e) => {
2301
+ ce.closeTag(e);
2302
+ let t = e.getSource();
2303
+ t && !t.r && (e.warn("x14 dataValidation with no xm:sqref was dropped."), e.setSource(void 0));
2304
+ }
2305
+ });
2306
+ let ye = (e) => ({
2307
+ from: e,
2308
+ to: {},
2309
+ openTag: (t) => {
2310
+ t.setSource({
2311
+ rule: t.getParent()?.rule,
2312
+ key: e
2313
+ });
2314
+ }
2315
+ });
2316
+ P.set("formula1", ye("formula1")), P.set("formula2", ye("formula2")), P.set("f", ge("f", (e, t) => {
2317
+ let n = t.getParent(), r = n?.rule;
2318
+ r && (r[n.key] = I(_(e), r.type));
2319
+ })), P.set("sqref", ge("sqref", (e, t) => {
2320
+ let n = t.getParent(), r = e.trim();
2321
+ n && r && (n.r = r.split(/\s+/).join(","));
2322
+ }));
2323
+ let xe = /* @__PURE__ */ new Map(), we = [], L = /* @__PURE__ */ new Map();
2324
+ L.set("conditionalFormattings", {
2325
+ from: "conditionalFormattings",
2326
+ transparent: !0
2327
+ }), L.set("conditionalFormatting", {
2328
+ from: "conditionalFormatting",
2329
+ to: {},
2330
+ openTag: (e) => {
2331
+ e.setSource({ rules: [] });
2332
+ },
2333
+ closeTag: (e) => {
2334
+ let t = e.getSource(), n = t?.rules ?? [];
2335
+ for (let e = 0; e < n.length; e++) {
2336
+ let r = n[e];
2337
+ r.sqref = t.sqref, r.id ? xe.set(r.id, r) : we.push(r);
2338
+ }
2339
+ }
2340
+ }), L.set("cfRule", {
2341
+ from: "cfRule",
2342
+ to: {},
2343
+ openTag: (e) => {
2344
+ 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);
2345
+ },
2346
+ closeTag: (e) => {
2347
+ let t = e.getSource();
2348
+ t && e.getParent()?.rules?.push(t);
2349
+ }
2350
+ }), L.set("sqref", ge("sqref", (e, t) => {
2351
+ let n = t.getParent(), r = e.trim();
2352
+ n && r && (n.sqref = r);
2353
+ })), L.set("dataBar", {
2354
+ from: "dataBar",
2355
+ to: {},
2356
+ openTag: (e) => {
2357
+ 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);
2358
+ },
2359
+ closeTag: (e) => {
2360
+ e.getParent().dataBar = e.getSource();
2361
+ }
2362
+ }), L.set("iconSet", {
2363
+ from: "iconSet",
2364
+ to: {},
2365
+ openTag: (e) => {
2366
+ e.copyTo("iconSet", $), e.copyTo("custom", Z), e.copyTo("reverse", Z), e.copyTo("showValue", Z);
2367
+ },
2368
+ closeTag: (e) => {
2369
+ e.getParent().iconSet = e.getSource();
2370
+ }
2371
+ });
2372
+ let Te = /* @__PURE__ */ new Map();
2373
+ Te.set("f", ge("f", (e, t) => {
2374
+ let n = t.getParent();
2375
+ if (!n) return;
2376
+ let r = e.trim(), i = Number(r);
2377
+ n.value = r.length > 0 && Number.isFinite(i) ? i : _(e);
2378
+ })), L.set("cfvo", {
2379
+ from: "cfvo",
2380
+ to: {},
2381
+ scope: () => Te,
2382
+ openTag: (e) => {
2383
+ let t = e.getParent();
2384
+ t.conditions ||= [];
2385
+ let n = e.getSource();
2386
+ t.conditions.push(n), e.copyTo("type", $), !1 === e.getAttribute("gte", Z) && (n.exclusive = !0);
2387
+ }
2388
+ }), L.set("f", ge("f", (e, t) => {
2389
+ let n = t.getParent();
2390
+ n && (n.formulas ??= []).push(_(e));
2391
+ })), L.set("dxf", {
2392
+ from: "dxf",
2393
+ to: {},
2394
+ raw: !0,
2395
+ closeTag: (e) => {
2396
+ if (!h) return;
2397
+ let t = e.getParent();
2398
+ if (!t) return;
2399
+ let n = h(e.getRawXml() ?? "");
2400
+ n && (t.style = n);
2401
+ }
2402
+ });
2403
+ let De = (e) => ({
2404
+ from: e,
2405
+ to: {},
2406
+ openTag: (t) => {
2407
+ let n = he((e) => t.getAttribute(e));
2408
+ n && (t.getParent()[e] = n);
2409
+ }
2410
+ });
2411
+ L.set("borderColor", De("borderColor")), L.set("negativeFillColor", De("negativeFillColor")), L.set("negativeBorderColor", De("negativeBorderColor")), L.set("axisColor", De("axisColor")), L.set("cfIcon", {
2412
+ from: "cfIcon",
2413
+ to: {},
2414
+ openTag: (e) => {
2415
+ let t = e.getAttribute("iconSet"), n = e.getAttribute("iconId", Q);
2416
+ if (t === null || n === null) return;
2417
+ let r = e.getParent();
2418
+ r.icons ||= [], r.icons.push({
2419
+ set: t,
2420
+ id: n
2421
+ });
2422
+ }
2423
+ });
2424
+ let Ae = /* @__PURE__ */ new Map();
2425
+ Ae.set("id", ge("id", (e, t) => {
2426
+ let n = t.getParent(), r = e.trim();
2427
+ n && r && (n.x14Id = r);
2428
+ }));
2429
+ let Ne = /* @__PURE__ */ new Map();
2430
+ Ne.set("slicerList", {
2431
+ from: "slicerList",
2432
+ transparent: !0
2433
+ }), Ne.set("slicer", ue);
2434
+ let Pe = /* @__PURE__ */ new Map();
2435
+ Pe.set("timelineRefs", {
2436
+ from: "timelineRefs",
2437
+ transparent: !0
2438
+ }), Pe.set("timelineRef", fe);
2439
+ let Ie = /* @__PURE__ */ new Map();
2440
+ Ie.set("sparklineGroups", {
2441
+ from: "sparklineGroups",
2442
+ to: "sparklineGroups",
2443
+ openTag: (e) => {
2444
+ let t = e.getParent();
2445
+ e.setSource(t.sparklineGroups ?? []);
2446
+ },
2447
+ closeTag: (e) => {
2448
+ (e.getSource()?.length ?? 0) === 0 && e.setSource(void 0);
2449
+ }
2450
+ }), Ie.set("sparklineGroup", {
2451
+ from: "sparklineGroup",
2452
+ to: [],
2453
+ openTag: (e) => {
2454
+ let t = e.getFrom().attributes ?? {}, r = {};
2455
+ for (let e in t) {
2456
+ let n = t[e];
2457
+ r[e] = typeof n == "string" ? n : n?.value ?? "";
2458
+ }
2459
+ e.setSource({
2460
+ properties: n(r),
2461
+ entries: []
2462
+ });
2463
+ },
2464
+ closeTag: (e) => {
2465
+ let t = e.getSource(), n = Ee(t.properties, t.entries);
2466
+ n || e.warn("A sparkline group with no sparklines was dropped.", { onceKey: "xlsx.sheet.sparklineGroup.empty" }), e.setSource(n ?? void 0);
2467
+ }
2468
+ });
2469
+ for (let e of le) Ie.set(e, {
2470
+ from: e,
2471
+ to: {},
2472
+ openTag: (t) => {
2473
+ let n = he((e) => t.getAttribute(e));
2474
+ n && (t.getParent().properties[e] = n);
2475
+ }
2476
+ });
2477
+ Ie.set("sparklines", {
2478
+ from: "sparklines",
2479
+ transparent: !0
2480
+ }), Ie.set("sparkline", {
2481
+ from: "sparkline",
2482
+ to: {},
2483
+ openTag: (e) => {
2484
+ e.setSource({ isSparkline: !0 });
2485
+ },
2486
+ closeTag: (e) => {
2487
+ let t = e.getSource(), n = e.getParent(), r = t?.sqref?.trim(), i = r ? H.fastStringToRange(r.split(/\s+/)[0]) : null;
2488
+ i ? n.entries.push({
2489
+ location: {
2490
+ rowIndex: i.rowStart,
2491
+ colIndex: i.colStart
2492
+ },
2493
+ data: t.data ?? ""
2494
+ }) : e.warn("A sparkline with no location was dropped.", { onceKey: "xlsx.sheet.sparkline.incomplete" });
2495
+ }
2496
+ }), Ie.set("f", ge("f", (e, t) => {
2497
+ let n = t.getParent(), r = e.trim();
2498
+ n && r && (n.isSparkline ? n.data = r : n.properties.dateRange = r);
2499
+ })), Ie.set("sqref", ge("sqref", (e, t) => {
2500
+ let n = t.getParent();
2501
+ n?.isSparkline && (n.sqref = e);
2502
+ }));
2503
+ let Le = /* @__PURE__ */ new Map([
2504
+ [o(je), Ie],
2505
+ [o(Fe), P],
2506
+ [o(me), L],
2507
+ [o(Oe), L],
2508
+ [o(F), Ae],
2509
+ [o(A), Ne],
2510
+ [o(_e), Ne],
2511
+ [o(M), Pe],
2512
+ [o(D), ie]
2513
+ ]), R = /* @__PURE__ */ new Set();
2514
+ d.registerVisitor({
2515
+ from: "extLst",
2516
+ transparent: !0
2517
+ }), d.registerVisitor({
2518
+ from: "ext",
2519
+ transparent: !0,
2520
+ scope: (e) => {
2521
+ let t = e.getAttribute("uri"), n = o(t), r = Le.get(n);
2522
+ if (r) return r;
2523
+ if (!E.has(n) && !R.has(n)) {
2524
+ R.add(n);
2525
+ let r = Be[n];
2526
+ 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.`);
2527
+ }
2528
+ return null;
2529
+ }
2530
+ }), d.registerVisitor({
2531
+ from: "mergeCell",
2532
+ to: [],
2533
+ openTag: (e) => {
2534
+ let t = e.getAttribute("ref");
2535
+ e.setSource(t);
2536
+ }
2537
+ }), d.registerVisitor({
2538
+ from: "hyperlinks",
2539
+ to: "hyperlinks",
2540
+ openTag: (e) => {
2541
+ e.setSource([]);
2542
+ }
2543
+ }), d.registerVisitor({
2544
+ from: "hyperlink",
2545
+ to: [],
2546
+ openTag: (e) => {
2547
+ let n = e.getAttribute("r:id"), r = e.getAttribute("ref");
2548
+ if (!r) return void e.warn("A hyperlink has no ref; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.noRef" });
2549
+ e.setKey(r);
2550
+ let i = n ? t(n) : "";
2551
+ if (typeof i != "string") return void e.warn("A hyperlink has an invalid address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2552
+ i.endsWith("\\") && (i = i.substring(0, i.length - 1));
2553
+ let a = e.getAttribute("location");
2554
+ if (a && (i += "#" + a), !i) return void e.warn("A hyperlink has no address; it was dropped.", { onceKey: "xlsx.sheet.hyperlink.address" });
2555
+ let o, s = e.getAttribute("tooltip"), c = e.getAttribute("display");
2556
+ s || c ? (o = { address: i }, s && (o.screenTip = s), c && (o.display = c)) : o = i, e.setSource({
2557
+ r,
2558
+ v: o
2559
+ });
2560
+ }
2561
+ }), d.registerVisitor({
2562
+ from: "drawing",
2563
+ to: "movables",
2564
+ openTag: (e) => {
2565
+ let n = e.getAttribute("r:id");
2566
+ if (!n) return;
2567
+ let r = t(n);
2568
+ r ? e.setSource(r.movables) : e.warn("A drawing part is missing; its shapes were not imported.", { onceKey: "xlsx.sheet.drawing.missing" });
2569
+ }
2570
+ }), d.registerVisitor({
2571
+ from: "legacyDrawing",
2572
+ to: "legacyDrawing",
2573
+ openTag: (e) => {
2574
+ e.setSource(t(e.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2575
+ }
2576
+ }), d.registerVisitor({
2577
+ from: "legacyDrawingHF",
2578
+ to: "legacyDrawingHF",
2579
+ openTag: (e) => {
2580
+ e.setSource(t(e.getAttribute("r:id"), "legacyDrawing") ?? void 0);
2581
+ }
2582
+ });
2583
+ let Re = null, z = !1, Ve = /* @__PURE__ */ new Map(), He = {
2584
+ from: "Fallback",
2585
+ to: null
2586
+ }, Ue = {
2587
+ from: "Choice",
2588
+ transparent: !0
2589
+ };
2590
+ Ve.set("Fallback", He), Ve.set("Choice", Ue), Ve.set("control", {
2591
+ from: "control",
2592
+ transparent: !0,
2593
+ openTag: (e) => {
2594
+ let n = e.getAttribute("name"), r = e.getAttribute("r:id"), i = r ? t(r, "formControl") : null;
2595
+ if (!i) return e.warn(`The form control '${n ?? ""}' has no properties and was not read.`, { onceKey: "xlsx.sheet.control.noProperties" }), void (Re = null);
2596
+ let a = i.json, o = parseInt(e.getAttribute("shapeId") ?? "", 10);
2597
+ isNaN(o) || (a.shapeId = o);
2598
+ let s = {
2599
+ anchor: {
2600
+ tl: {
2601
+ c: 0,
2602
+ r: 0,
2603
+ x: 0,
2604
+ y: 0
2605
+ },
2606
+ br: {
2607
+ c: 0,
2608
+ r: 0,
2609
+ x: 0,
2610
+ y: 0
2611
+ }
2612
+ },
2613
+ content: {
2614
+ type: i.type,
2615
+ json: a
2616
+ }
2617
+ };
2618
+ n && (s.content.name = n), Re = {
2619
+ movable: s,
2620
+ control: a
2621
+ };
2622
+ },
2623
+ closeTag: () => {
2624
+ Re &&= (e.movables ||= [], e.movables.push(Re.movable), null);
2625
+ }
2626
+ }), Ve.set("controlPr", {
2627
+ from: "controlPr",
2628
+ transparent: !0,
2629
+ raw: !0,
2630
+ openTag: (e) => {
2631
+ if (!Re) return;
2632
+ let t = e.getFrom().attributes ?? {}, n = {};
2633
+ for (let e in t) {
2634
+ let r = t[e];
2635
+ n[e] = typeof r == "string" ? r : r?.value ?? "";
2636
+ }
2637
+ de(n, Re.control);
2638
+ },
2639
+ closeTag: (e) => {
2640
+ if (!Re) return;
2641
+ let t = ((e) => {
2642
+ let t = /<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(e);
2643
+ if (!t) return null;
2644
+ 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);
2645
+ return {
2646
+ anchor: {
2647
+ tl: or(r("from")),
2648
+ br: or(r("to"))
2649
+ },
2650
+ anchorType: a ? o ? "twoCell" : "oneCell" : "absolute",
2651
+ rest: (e.slice(0, t.index) + e.slice(t.index + t[0].length)).trim()
2652
+ };
2653
+ })(e.getRawXml() ?? "");
2654
+ t ? (Re.movable.anchor = t.anchor, t.anchorType !== "twoCell" && (Re.movable.anchorType = t.anchorType), t.rest && (Re.control.xml = t.rest)) : z || (z = !0, e.warn("A form control has no anchor; it is placed at the top left of the sheet."));
2655
+ }
2656
+ });
2657
+ let V = {
2658
+ from: "controls",
2659
+ transparent: !0,
2660
+ scope: () => Ve
2661
+ };
2662
+ d.registerVisitor(V);
2663
+ let We = /* @__PURE__ */ new Map([
2664
+ ["Choice", Ue],
2665
+ ["Fallback", He],
2666
+ ["controls", V]
2667
+ ]);
2668
+ d.registerVisitor({
2669
+ from: "AlternateContent",
2670
+ transparent: !0,
2671
+ scope: () => We
2672
+ }), d.registerVisitor({
2673
+ from: "tableParts",
2674
+ to: "tables",
2675
+ openTag: (e) => {
2676
+ e.setSource([]);
2677
+ }
2678
+ }), d.registerVisitor({
2679
+ from: "tablePart",
2680
+ to: [],
2681
+ openTag: (e) => {
2682
+ let n = e.getAttribute("r:id");
2683
+ if (!n) return;
2684
+ let r = t(n);
2685
+ r ? e.setSource(r) : e.warn("A table part is missing; the table was not imported.", { onceKey: "xlsx.sheet.table.missing" });
2686
+ }
2687
+ });
2688
+ let Ge = (e, t) => {
2689
+ t.conditions?.length && (e.stops = te(t)), t.minLength !== void 0 && (e.minLength = t.minLength), t.maxLength !== void 0 && (e.maxLength = t.maxLength), (t.gradient ?? 1) && (e.gradient = !0), t.border && t.borderColor && (e.borderColor = t.borderColor), !t.negativeBarColorSameAsPositive && t.negativeFillColor && (e.negativeFillColor = t.negativeFillColor), !(t.negativeBarBorderColorSameAsPositive ?? 1) && t.negativeBorderColor && (e.negativeBorderColor = t.negativeBorderColor), t.axisColor && (e.axisColor = t.axisColor), t.axisPosition !== "middle" && t.axisPosition !== "none" || (e.axisPosition = t.axisPosition), t.direction !== "leftToRight" && t.direction !== "rightToLeft" || (e.direction = t.direction);
2690
+ }, Ke = (e, t) => {
2691
+ t.conditions?.length && (e.stops = te(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);
2692
+ }, qe = (e) => {
2693
+ if (!e.sqref) return null;
2694
+ let t = e.sqref.split(/\s+/).join(",");
2695
+ if (e.type === "iconSet") {
2696
+ if (!e.iconSet) return null;
2697
+ let n = {
2698
+ type: nt.ScaleType.IconSet,
2699
+ stops: []
2700
+ };
2701
+ return Ke(n, e.iconSet), {
2702
+ r: t,
2703
+ v: { scale: n },
2704
+ priority: e.priority
2705
+ };
2706
+ }
2707
+ let n = O(e, s);
2708
+ if (!n) return null;
2709
+ let r = { condition: n };
2710
+ return e.style && (r.style = e.style), e.stopIfTrue && (r.stopIfTrue = !0), {
2711
+ r: t,
2712
+ v: r,
2713
+ priority: e.priority
2714
+ };
2715
+ };
2716
+ d.registerVisitor({
2717
+ from: "worksheet",
2718
+ to: {},
2719
+ openTag: (e) => {},
2720
+ closeTag: (e) => {
2721
+ let t = e.getSource(), n = t?.conditionals;
2722
+ if (n) for (let e = 0; e < n.length; e++) {
2723
+ let t = n[e], r = t.x14Id;
2724
+ if (!r) continue;
2725
+ delete t.x14Id;
2726
+ let i = xe.get(r);
2727
+ if (!i) continue;
2728
+ xe.delete(r);
2729
+ let a = t.v?.scale;
2730
+ i.dataBar && a?.type === nt.ScaleType.DataBar ? Ge(a, i.dataBar) : i.iconSet && a?.type === nt.ScaleType.IconSet && Ke(a, i.iconSet);
2731
+ }
2732
+ let r = [...xe.values(), ...we], i = /* @__PURE__ */ new Set(), a = 0;
2733
+ for (let e = 0; e < r.length; e++) {
2734
+ let o = qe(r[e]);
2735
+ o ? (n || (n = [], t.conditionals = n), n.push(o)) : (i.add(r[e].type ?? "unknown"), a++);
2736
+ }
2737
+ if (a > 0) {
2738
+ let e = [...i].map((e) => `'${e}'`).join(", ");
2739
+ 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.`);
2740
+ }
2741
+ if (n) {
2742
+ n.length > 1 && n.sort((e, t) => (e.priority ?? 1 / 0) - (t.priority ?? 1 / 0));
2743
+ for (let e = 0; e < n.length; e++) delete n[e].priority;
2744
+ }
2745
+ }
2746
+ }), d.registerVisitor({
2747
+ from: "customProperties",
2748
+ to: "customProperties",
2749
+ openTag: (e) => {
2750
+ e.setSource([]);
2751
+ },
2752
+ closeTag: (e) => {
2753
+ let t = e.getSource();
2754
+ t.length > 0 && (e.getParent().customProperties = t);
2755
+ }
2756
+ }), d.registerVisitor({
2757
+ from: "customPr",
2758
+ to: {},
2759
+ openTag: (e) => {
2760
+ let n = e.getParent();
2761
+ e.copyTo("name");
2762
+ let r = e.getAttribute("r:id");
2763
+ if (!r) return void e.warn("A custom property names no part; it was not imported.", { onceKey: "xlsx.sheet.customProperty.noRel" });
2764
+ let i = t(r, "resource"), a = e.getSource();
2765
+ a.resId = i, n.push(a);
2766
+ }
2767
+ }), d.registerVisitor({
2768
+ from: "sheetProtection",
2769
+ to: "protection",
2770
+ openTag: (e) => {
2771
+ let t = e.getSource();
2772
+ for (let n of pe) {
2773
+ let r = e.hasAttribute(n.attribute) ? e.getAttribute(n.attribute) : null;
2774
+ t[n.key] = ze(n, r);
2775
+ }
2776
+ if (t.sheet) return;
2777
+ let n = {};
2778
+ 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);
2779
+ }
2780
+ }), d.registerVisitor({
2781
+ from: "protectedRanges",
2782
+ to: "protectedRanges",
2783
+ openTag: (e) => {
2784
+ e.setSource([]);
2785
+ }
2786
+ }), d.registerVisitor({
2787
+ from: "protectedRange",
2788
+ to: [],
2789
+ openTag: (e) => {
2790
+ let t = e.getAttribute("sqref");
2791
+ t &&= t.trim().split(/\s+/).join(",");
2792
+ let n = {}, r = {
2793
+ r: t,
2794
+ v: n
2795
+ };
2796
+ e.copyToObject(n, "name"), e.copyToObject(n, "securityDescriptor");
2797
+ let i = {};
2798
+ 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);
2799
+ },
2800
+ closeTag: (e) => {
2801
+ let t = e.getSource();
2802
+ t?.r && t.v.name || e.setSource(void 0);
2803
+ }
2804
+ }), d.registerVisitor({
2805
+ from: "sheetFormatPr",
2806
+ to: "sheetFormatPr",
2807
+ openTag: (t) => {
2808
+ t.copyToObject(e, "defaultColSize", Pn, "defaultColWidth");
2809
+ let n = t.getAttribute("customHeight");
2810
+ n !== "1" && n !== "true" || t.copyToObject(e, "defaultRowSize", Pn, "defaultRowHeight");
2811
+ let r = t.getAttribute("baseColWidth", Q);
2812
+ r && r !== 8 && (e.baseColSize = r), m = !!t.getAttribute("zeroHeight", Z);
2813
+ }
2814
+ }), d.registerVisitor({
2815
+ from: "cols",
2816
+ to: "cols",
2817
+ openTag: (e) => {
2818
+ e.setSource([]);
2819
+ }
2820
+ }), d.registerVisitor({
2821
+ from: "col",
2822
+ to: [],
2823
+ openTag: (e) => {
2824
+ 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;
2825
+ t.r = H.runToString(i, a, !0);
2826
+ let o = {};
2827
+ 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");
2828
+ }
2829
+ }), d.registerVisitor({
2830
+ from: "oleObjects",
2831
+ to: null,
2832
+ openTag: (e) => {
2833
+ e.warn("'OLE Objects' are not supported.");
2834
+ }
2835
+ });
2836
+ let Je = !1, Ye = !1, Xe = 0, Ze = "", Qe = "", $e = (e) => {
2837
+ let t = e.indexOf(":");
2838
+ return t === -1 ? e : e.slice(t + 1);
2839
+ }, et = new nr();
2840
+ return vr(y, e, d.createEventHandler(e, a, s), s, c, {
2841
+ onOpenTag: (e) => {
2842
+ Je = !0;
2843
+ let t = $e(e.name);
2844
+ t === "t" || t === "v" ? Xe === 0 && (Ye = !0) : t === "rPh" || t === "phoneticPr" ? Xe++ : Xe === 0 && et.onOpenTag(t, e.attributes);
2845
+ },
2846
+ onText: (e) => {
2847
+ Ye && (Ze += e, et.onText(e));
2848
+ },
2849
+ onCloseTag: (e) => {
2850
+ let t = $e(e.name);
2851
+ t === "t" || t === "v" ? Ye = !1 : t === "rPh" || t === "phoneticPr" ? Xe > 0 && Xe-- : et.onCloseTag(t);
2852
+ },
2853
+ onEnd: () => {
2854
+ if (!Je) return;
2855
+ let e = et.take();
2856
+ Je = !1, Ye = !1, Xe = 0;
2857
+ let t = f(Ze);
2858
+ return Ze = "", Qe = t, e ? {
2859
+ t: "r",
2860
+ v: {
2861
+ type: "richText",
2862
+ data: { runs: rr(e, l?.get(dr)) }
2863
+ }
2864
+ } : r(t);
2865
+ },
2866
+ onError: (e) => {}
2867
+ }, l, r, () => m, () => Qe);
2868
+ }, pr = class {
2869
+ static {
2870
+ this.Collapsed = 1;
2871
+ }
2872
+ static {
2873
+ this.CustomFormat = 2;
2874
+ }
2875
+ static {
2876
+ this.CustomHeight = 4;
2877
+ }
2878
+ static {
2879
+ this.Hidden = 8;
2880
+ }
2881
+ static {
2882
+ this.Ht = 16;
2883
+ }
2884
+ static {
2885
+ this.OutlineLevel = 32;
2886
+ }
2887
+ static {
2888
+ this.Ph = 64;
2889
+ }
2890
+ static {
2891
+ this.R = 128;
2892
+ }
2893
+ static {
2894
+ this.S = 256;
2895
+ }
2896
+ static {
2897
+ this.Spans = 512;
2898
+ }
2899
+ }, mr = (e, t, n) => {
2900
+ if (e[0].value[0] === e[1].value[0]) return t;
2901
+ }, hr = /^\s*TABLE\s*\(/i, gr = {
2902
+ colStart: 0,
2903
+ colEnd: 0,
2904
+ rowStart: 0,
2905
+ rowEnd: 0
2906
+ }, _r = (e) => e === "1" || e === "true", vr = (e, t, n, r, i, a, o, s, c, l) => {
2907
+ 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, ne = null, re = null, ie = o?.get("richData") ?? Ye.EmptyArray, S = null, C = !1, ae = H.normalizeA1ToR1C1, oe = Xe.createConflatingRanges(), w = /* @__PURE__ */ new Map(), T = [], se = [], ce = !1, le = !1, ue = null, de = (e) => {
2908
+ let t = o?.get("metadata")?.values;
2909
+ if (!t) return;
2910
+ let n = parseInt(e, 10);
2911
+ if (!Number.isFinite(n) || n < 1) return;
2912
+ let r = t[n - 1]?.get("XLRICHVALUE");
2913
+ return r?.richValueIndex === void 0 ? void 0 : ie[r.richValueIndex];
2914
+ }, fe = !1, pe = Xe.createConflatingRanges(), me, E = !1, D = -1, O = -1, k = null, A = null, he = (e) => ({
2915
+ t: "r",
2916
+ v: {
2917
+ type: "hyperlink",
2918
+ data: {
2919
+ address: me,
2920
+ friendly: e
2921
+ }
2922
+ }
2923
+ }), ge = null, j = [], _e = null, ve = -2, M = 0, N = "", P = "", F = "", I = "", ye = "", be = "", xe = "", Se = "", Ce = "", we = "", L = "", Te = "", Ee = "", De = "", Oe = !0, ke = null, Ae = !1, je = !1, Me = !1, Ne = null, Pe = 0, Fe = (e) => {
2924
+ let r = e.name, s = r.indexOf(":");
2925
+ if (s !== -1 && (r = r.slice(s + 1)), Pe++, Pe % 196608 == 0 && i?.(Pe), A) {
2926
+ let t = e.attributes;
2927
+ switch (r) {
2928
+ case "v":
2929
+ g = !0;
2930
+ break;
2931
+ case "f":
2932
+ switch (v = !0, t.t ?? null) {
2933
+ case null:
2934
+ case "normal": break;
2935
+ case "shared":
2936
+ let e = t.si;
2937
+ b = t.ref, y = e;
2938
+ break;
2939
+ case "array":
2940
+ b = t.ref, ue = b;
2941
+ break;
2942
+ case "dataTable": {
2943
+ let e = ((e, t, n) => {
2944
+ let r = e.r1, i = _r(e.del1);
2945
+ if (!r && !i) return null;
2946
+ let a = e.ref ?? H.cellToString({
2947
+ rowIndex: t,
2948
+ colIndex: n
2949
+ }), o = H.fastStringToRange(a);
2950
+ if (!o) return null;
2951
+ let s = { ref: {
2952
+ rowStart: o.rowStart,
2953
+ colStart: o.colStart,
2954
+ rowEnd: o.rowEnd,
2955
+ colEnd: o.colEnd
2956
+ } }, c = _r(e.dt2D);
2957
+ if (c || _r(e.dtr) ? (r && (s.rowInput = r), i && (s.rowInputDeleted = !0)) : (r && (s.columnInput = r), i && (s.columnInputDeleted = !0)), c) {
2958
+ let t = e.r2;
2959
+ t && (s.columnInput = t), _r(e.del2) && (s.columnInputDeleted = !0);
2960
+ }
2961
+ return s;
2962
+ })(t, D, O);
2963
+ e && (se.push(e), _r(t.ca) && pe.append(D, O));
2964
+ return;
2965
+ }
2966
+ }
2967
+ let e = t.ca;
2968
+ e !== void 0 && (fe = e === "1");
2969
+ break;
2970
+ case "is":
2971
+ E = !0;
2972
+ return;
2973
+ }
2974
+ E && !v && a?.onOpenTag?.(e);
2975
+ } else if (u) {
2976
+ if (r === "c") {
2977
+ A = e, me = void 0;
2978
+ let t = e.attributes, n = t.r;
2979
+ O = n === void 0 ? O + 1 : H.fastStringToCol(n);
2980
+ let r = t.t;
2981
+ r === void 0 ? ge = null : (ge = r, ge === "str" && (E = !0));
2982
+ let i = t.s;
2983
+ i === void 0 && (Ne !== null || Me) && (i = "0"), i !== void 0 && (i = parseInt(i), ke && ke.value === i && ke.colEnd + 1 === O ? ke.colEnd = O : (ke = {
2984
+ colStart: O,
2985
+ rowStart: D,
2986
+ colEnd: O,
2987
+ rowEnd: D,
2988
+ value: i
2989
+ }, _.push(ke))), ue = null, le = !1, C = !1;
2990
+ let a = t.cm;
2991
+ ce = a !== void 0 && ((e) => {
2992
+ let t = o?.get("metadata")?.cells;
2993
+ if (!t) return !1;
2994
+ let n = parseInt(e, 10);
2995
+ return !(!Number.isFinite(n) || n < 1) && !0 === t[n - 1]?.get("XLDAPR")?.fDynamic;
2996
+ })(a);
2997
+ let s = t.vm;
2998
+ if (s !== void 0) {
2999
+ let e = de(s);
3000
+ if (Ze.isError(e)) {
3001
+ let t = e.getCode();
3002
+ k = {
3003
+ t: "e",
3004
+ v: t
3005
+ }, ce && t === Ze.Code.Spill && (le = !0);
3006
+ }
3007
+ }
3008
+ }
3009
+ } else {
3010
+ if (je && r === "row") {
3011
+ u = !0;
3012
+ let t = e.attributes.r;
3013
+ if (D = t === void 0 ? D + 1 : parseInt(t) - 1, O = -1, c?.()) {
3014
+ let e = d[d.length - 1];
3015
+ e && e.max + 1 === D ? e.max = D : d.push({
3016
+ min: D,
3017
+ max: D
3018
+ });
3019
+ }
3020
+ if (M = 0, P = e.attributes.customHeight, P !== void 0 && (M |= pr.CustomHeight), P !== Ce && (Oe = !0, Ce = P), N = e.attributes.ht, N !== void 0 && (M |= pr.Ht), N !== Se && (Oe = !0, Se = N), F = e.attributes.hidden, F !== void 0 && (M |= pr.Hidden), F !== we && (Oe = !0, we = F), ye = e.attributes.s, ye !== void 0 && (M |= pr.S), ye !== Te && (Oe = !0, Te = ye), I = e.attributes.customFormat, I !== void 0 && (M |= pr.CustomFormat), I !== L && (Oe = !0, L = I), be = e.attributes.outlineLevel, be !== void 0 && (M |= pr.OutlineLevel), be !== Ee && (Oe = !0, Ee = be), xe = e.attributes.collapsed, xe !== void 0 && (M |= pr.Collapsed), xe !== De && (Oe = !0, De = xe), M !== 0) {
3021
+ if (ve + 1 !== D || Oe) {
3022
+ let e = P !== void 0 && (P === "1" || P === "true"), t = I !== void 0 && (I === "1" || I === "true");
3023
+ Ne = t && ye !== void 0 ? ye : null, t && Ne === null && (Ne = "0"), _e = {
3024
+ min: D,
3025
+ max: D,
3026
+ value: {
3027
+ sz: N === void 0 ? -1 : parseFloat(N),
3028
+ csz: e,
3029
+ h: F !== void 0 && (F === "1" || F === "true"),
3030
+ s: Ne === null ? void 0 : Ne === "0" ? 0 : parseInt(Ne),
3031
+ l: be === void 0 || be === "0" ? 0 : parseInt(be),
3032
+ cl: xe !== void 0 && (xe === "1" || xe === "true")
3033
+ }
3034
+ }, j.push(_e);
3035
+ } else _e.max = D;
3036
+ }
3037
+ ve = D, Oe = !1;
3038
+ return;
3039
+ }
3040
+ if (r === "sheetData" && (je = !0), !Ae && r === "sheetData") {
3041
+ Ae = !0;
3042
+ let e = t.cols, n = e ? e.length : 0;
3043
+ for (let t = 0; !Me && t < n; t++) e[t].v.s && (Me = !0);
3044
+ }
3045
+ n?.onOpenTag?.(e);
3046
+ }
3047
+ }, Ie = (t) => {
3048
+ let r = t.name;
3049
+ if (r === "sheetData" && (je = !1), !v || r !== "c" && r !== "f" || (y && (x = w.get(y) ?? null), x && (me = ((e) => {
3050
+ if (e.length < 11 || (32 | e.charCodeAt(0)) != 104 || !/^HYPERLINK\(/i.test(e)) return;
3051
+ let t = 1, n = !1, r = 10;
3052
+ for (; r < e.length && t > 0; r++) {
3053
+ let i = e.charCodeAt(r);
3054
+ n ? i === 34 && (e.charCodeAt(r + 1) === 34 ? r++ : n = !1) : i === 34 ? n = !0 : i === 40 ? t++ : i === 41 && t--;
3055
+ }
3056
+ if (t !== 0 || e.slice(r).trim().length > 0) return;
3057
+ let i = /^HYPERLINK\(\s*"((?:[^"]|"")*)"\s*[,)]/i.exec(e);
3058
+ return i ? i[1].replace(/""/g, "\"") : null;
3059
+ })(x[2]), oe.append(D, O, x), fe && pe.append(D, O)), ue !== null && T.push([ue, ce ? le ? "error" : "dynamic" : "fixed"]), v = !1, x = null, y = null, b = null, g = !1, fe = !1, ue = null, ce = !1, le = !1), A) {
3060
+ let n = r.indexOf(":");
3061
+ if (n !== -1 && (r = r.slice(n + 1)), E) {
3062
+ if (r === "is" || r === "v") {
3063
+ let t = a?.onEnd?.();
3064
+ t == null || C && l?.() === "" || e.pushAt(D, O, me !== void 0 && typeof t == "number" ? he(l?.() ?? "") : typeof t == "number" ? "" + t : t);
3065
+ } else r !== "f" && a?.onCloseTag?.(t);
3066
+ }
3067
+ g &&= !1, r === "c" && (A = null, E = !1);
3068
+ } else {
3069
+ if (u) return u = !1, void (ke = null);
3070
+ n?.onCloseTag?.(t);
3071
+ }
3072
+ }, Le = (t) => {
3073
+ let i = t.trim();
3074
+ if (g) {
3075
+ switch (k = null, ge) {
3076
+ case null:
3077
+ case "n":
3078
+ k = dt.flushSubnormal(parseFloat(i));
3079
+ break;
3080
+ case "b":
3081
+ k = i === "1" || i === "true";
3082
+ break;
3083
+ case "s": {
3084
+ let e = parseInt(i, 10), t = h.get(e);
3085
+ if (t === void 0) {
3086
+ let n = f?.get(e);
3087
+ t = n ? rr(n, m) : null, h.set(e, t);
3088
+ }
3089
+ k = t ? {
3090
+ t: "r",
3091
+ v: {
3092
+ type: "richText",
3093
+ data: { runs: t }
3094
+ }
3095
+ } : i;
3096
+ break;
3097
+ }
3098
+ case "d": {
3099
+ let e = ((e, t = !1) => {
3100
+ if (!e) return null;
3101
+ let n = Qn.exec(e);
3102
+ if (n) {
3103
+ let [, e, t, r] = n;
3104
+ return e === void 0 && t === void 0 && r === void 0 ? null : (3600 * parseFloat(e ?? "0") + 60 * parseFloat(t ?? "0") + parseFloat(r ?? "0")) / 86400;
3105
+ }
3106
+ let r = Zn.exec(e);
3107
+ if (!r) return null;
3108
+ let [, i, a, o, s, c, l, u] = r;
3109
+ if (i === void 0 && s === void 0) return null;
3110
+ let d = 0;
3111
+ if (i !== void 0) {
3112
+ let e = parseInt(i, 10), n = parseInt(a, 10), r = parseInt(o, 10);
3113
+ if (n < 1 || n > 12 || r < 1 || r > 31) return null;
3114
+ let s = $n(e, n, r) - er;
3115
+ if (d = s <= 60 ? s - 1 : s, t && (d -= 1462), d < 0) return null;
3116
+ }
3117
+ 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;
3118
+ })(i, !0 === o?.get(lr));
3119
+ e === null ? s && (r?.(`Date '${i}' in cell ${H.cellToString({
3120
+ colIndex: O,
3121
+ rowIndex: D
3122
+ })} is not a date this workbook can hold; kept as text.`, void 0, "xlsx.cell.isoDateText"), k = "" + s(i)) : k = e;
3123
+ break;
3124
+ }
3125
+ case "e":
3126
+ if (i === "#VALUE!") {
3127
+ let e = A.attributes.vm;
3128
+ if (e !== void 0) {
3129
+ let t = de(e);
3130
+ if (Ze.isError(t)) {
3131
+ k = {
3132
+ t: "e",
3133
+ v: t.getCode()
3134
+ };
3135
+ break;
3136
+ }
3137
+ if (ut.isJSON(t)) {
3138
+ k = {
3139
+ t: "r",
3140
+ v: t
3141
+ };
3142
+ break;
3143
+ }
3144
+ }
3145
+ }
3146
+ let e = Ze.getBuiltInByLabel(i);
3147
+ e ? k = {
3148
+ t: "e",
3149
+ v: e.getCode()
3150
+ } : (k = i, r?.(`Unknown formula error '${i}' in cell ${H.cellToString({
3151
+ colIndex: O,
3152
+ rowIndex: D
3153
+ })}`));
3154
+ break;
3155
+ case "str":
3156
+ case "inlineStr": E = !0;
3157
+ }
3158
+ k !== null && e.pushAt(D, O, me === void 0 || typeof k != "number" && typeof k != "boolean" ? k : he(k));
3159
+ }
3160
+ let c = y !== null;
3161
+ if (y) {
3162
+ if (ne === y) x = re;
3163
+ else {
3164
+ if (x = w.get(y) ?? null, !x) {
3165
+ let e = [];
3166
+ ee = ae(i, D, O, e), x = [
3167
+ ee,
3168
+ e,
3169
+ i
3170
+ ], w.set(y, x);
3171
+ }
3172
+ ne = y, re = x;
3173
+ }
3174
+ y = null;
3175
+ }
3176
+ if (v) {
3177
+ let e = i, t = c ? void 0 : o?.get(cr);
3178
+ if (t) {
3179
+ let n = ((e) => {
3180
+ if (e.length < Rn.length || e.slice(0, Rn.length).toUpperCase() !== zn) return Vn;
3181
+ let t = Un(e, Rn.length);
3182
+ if (t === null || e.charCodeAt(t.end) !== 41 || e.charCodeAt(t.end + 1) !== 44 || e.charCodeAt(e.length - 1) !== 41) return Vn;
3183
+ let n = t.value;
3184
+ return n.toUpperCase() === Bn ? Hn : n.length === 0 ? Vn : {
3185
+ kind: "formula",
3186
+ formula: n
3187
+ };
3188
+ })(i);
3189
+ n.kind !== "none" && (S ??= new Gn(t), n.kind === "spilled" ? C = S.placeholder(D, O) : S.anchor(D, O, n.formula) && (e = n.formula, fe ||= ((e) => Wn(e).some((e) => te(e) || !0 === $e.get(e)?.getDeclaration().getReturnType()?.isVolatile()))(e)));
3190
+ }
3191
+ if (C) fe = !1;
3192
+ else {
3193
+ let t = [];
3194
+ ee = ae(e, D, O, t), x = [
3195
+ ee,
3196
+ t,
3197
+ e
3198
+ ];
3199
+ }
3200
+ }
3201
+ E ? a?.onText?.(t) : u || n?.onText?.(i);
3202
+ }, R = {
3203
+ r: void 0,
3204
+ t: void 0,
3205
+ s: void 0,
3206
+ cm: void 0,
3207
+ vm: void 0
3208
+ }, ze = {
3209
+ name: "c",
3210
+ attributes: R,
3211
+ isSelfClosing: !1
3212
+ }, z = {
3213
+ t: void 0,
3214
+ si: void 0,
3215
+ ref: void 0,
3216
+ ca: void 0
3217
+ }, Be = {
3218
+ name: "f",
3219
+ attributes: z,
3220
+ isSelfClosing: !1
3221
+ }, Ve = {
3222
+ name: "v",
3223
+ attributes: {},
3224
+ isSelfClosing: !1
3225
+ }, B = {
3226
+ r: void 0,
3227
+ s: void 0,
3228
+ ht: void 0,
3229
+ hidden: void 0,
3230
+ collapsed: void 0,
3231
+ customHeight: void 0,
3232
+ customFormat: void 0,
3233
+ outlineLevel: void 0
3234
+ }, He = {
3235
+ name: "row",
3236
+ attributes: B,
3237
+ isSelfClosing: !1
3238
+ }, Ue = Nn.NEED_MORE, V = Nn.NOT_HANDLED, We = Nn.decodeText, Ge = !1, Ke = (e, t, n, r) => {
3239
+ for (;;) {
3240
+ let i = 0;
3241
+ for (; t < n && ((i = e.charCodeAt(t)) === 32 || i === 9 || i === 10 || i === 13);) t++;
3242
+ if (t >= n) return Ue;
3243
+ if (i === 62) return Ge = !1, t + 1;
3244
+ if (i === 47) return t + 1 >= n ? Ue : e.charCodeAt(t + 1) === 62 ? (Ge = !0, t + 2) : V;
3245
+ let a = t;
3246
+ for (; t < n && (i = e.charCodeAt(t)) !== 61;) {
3247
+ if (i === 62 || i === 47 || i === 32 || i === 9 || i === 10 || i === 13) return V;
3248
+ t++;
3249
+ }
3250
+ if (t + 1 >= n) return Ue;
3251
+ let o = t - a, s = e.charCodeAt(t + 1);
3252
+ if (s !== 34 && s !== 39) return V;
3253
+ let c = t + 2, l = c;
3254
+ for (; l < n && (i = e.charCodeAt(l)) !== s;) {
3255
+ if (i === 38 || i < 32) return V;
3256
+ l++;
3257
+ }
3258
+ if (l >= n) return Ue;
3259
+ t = l + 1;
3260
+ let u = e.charCodeAt(a);
3261
+ if (r === 2) switch (o) {
3262
+ case 1:
3263
+ u === 114 ? B.r = e.slice(c, l) : u === 115 && (B.s = e.slice(c, l));
3264
+ break;
3265
+ case 2:
3266
+ e.startsWith("ht", a) && (B.ht = e.slice(c, l));
3267
+ break;
3268
+ case 6:
3269
+ e.startsWith("hidden", a) && (B.hidden = e.slice(c, l));
3270
+ break;
3271
+ case 9:
3272
+ e.startsWith("collapsed", a) && (B.collapsed = e.slice(c, l));
3273
+ break;
3274
+ case 12: e.startsWith("customHeight", a) ? B.customHeight = e.slice(c, l) : e.startsWith("customFormat", a) ? B.customFormat = e.slice(c, l) : e.startsWith("outlineLevel", a) && (B.outlineLevel = e.slice(c, l));
3275
+ }
3276
+ 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)));
3277
+ else if (o === 1) u === 116 && (z.t = e.slice(c, l));
3278
+ else if (o === 2) {
3279
+ let t = e.charCodeAt(a + 1);
3280
+ u === 115 && t === 105 ? z.si = e.slice(c, l) : u === 99 && t === 97 && (z.ca = e.slice(c, l));
3281
+ } else o === 3 && e.startsWith("ref", a) && (z.ref = e.slice(c, l));
3282
+ }
3283
+ }, qe = (e, t, n) => e.charCodeAt(t + 1) === 47 && e.charCodeAt(t + 2) === n && e.charCodeAt(t + 3) === 62;
3284
+ return {
3285
+ ...n,
3286
+ onEnd: () => {
3287
+ if (c?.()) {
3288
+ let e = 0, t = [], n = (e, t) => ({
3289
+ min: e,
3290
+ max: t,
3291
+ value: {
3292
+ sz: -1,
3293
+ csz: !1,
3294
+ h: !0,
3295
+ s: void 0,
3296
+ l: 0,
3297
+ cl: !1
3298
+ }
3299
+ });
3300
+ for (let r of d) r.min > e && t.push(n(e, r.min - 1)), e = Math.max(e, r.max + 1);
3301
+ e <= Re && t.push(n(e, Re)), t.length > 0 && (j.push(...t), j.sort((e, t) => e.min - t.min));
3302
+ }
3303
+ j.length > 0 && (t.rows = H.runsToRefs(j, !1));
3304
+ let r = oe.done(mr);
3305
+ r = ((e, t) => {
3306
+ let n = null;
3307
+ for (let t = 0; t < e.length; t++) {
3308
+ let r = e[t];
3309
+ if (!hr.test(r.value[2])) continue;
3310
+ n ??= /* @__PURE__ */ new Map();
3311
+ let i = r.value[0], a = n.get(i);
3312
+ a ? a.push(r) : n.set(i, [r]);
3313
+ }
3314
+ if (n === null) return e;
3315
+ let r = /* @__PURE__ */ new Set();
3316
+ for (let e of n.values()) {
3317
+ let n = e[0], i = {
3318
+ rowStart: n.rowStart,
3319
+ colStart: n.colStart,
3320
+ rowEnd: n.rowEnd,
3321
+ colEnd: n.colEnd
3322
+ }, a = 0;
3323
+ for (let t = 0; t < e.length; t++) {
3324
+ let n = e[t];
3325
+ 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);
3326
+ }
3327
+ if (a !== (i.rowEnd - i.rowStart + 1) * (i.colEnd - i.colStart + 1)) continue;
3328
+ let o = Xn(H.resolveRelativeToA1(n.value[1], i.rowStart, i.colStart), i);
3329
+ if (o) {
3330
+ t.push(o);
3331
+ for (let t = 0; t < e.length; t++) r.add(e[t]);
3332
+ }
3333
+ }
3334
+ return r.size === 0 ? e : e.filter((e) => !r.has(e));
3335
+ })(r, se);
3336
+ let i = r.length;
3337
+ if (i > 0 || se.length > 0) {
3338
+ let e = Array(i);
3339
+ for (let t = 0; t < i; t++) {
3340
+ let n = r[t], i = H.rangeToString(n), a = n.value[1], o = H.resolveRelativeToA1(a, n.rowStart, n.colStart);
3341
+ e[t] = [i, o];
3342
+ }
3343
+ for (let t = 0; t < se.length; t++) {
3344
+ let n = se[t], r = n.ref;
3345
+ e.push([H.cellToString({
3346
+ rowIndex: r.rowStart,
3347
+ colIndex: r.colStart
3348
+ }), p(n)]), T.push([H.rangeToString(r), "dynamic"]);
3349
+ }
3350
+ t.formulas = e;
3351
+ }
3352
+ let a = pe.done(!0), o = a.length;
3353
+ if (o > 0) {
3354
+ let e = Array(o);
3355
+ for (let t = 0; t < o; t++) {
3356
+ let n = a[t], r = H.rangeToString(n);
3357
+ e[t] = r;
3358
+ }
3359
+ t.volatile = e;
3360
+ }
3361
+ S && T.push(...S.getFormulaArray()), T.length > 0 && (t.formulaArray = [...T]);
3362
+ let s = _.length;
3363
+ if (s > 0) {
3364
+ _.sort(Xe.createRangeComparator(it.Axis.Column));
3365
+ let e = _[0], n = e.colStart, r = e.colEnd, i = e.rowEnd, a = e.value, o = [];
3366
+ o.push(e);
3367
+ let c = null;
3368
+ 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);
3369
+ let l = o.length, u = Array(l);
3370
+ for (let e = 0; e < l; e++) {
3371
+ let t = o[e], n = H.rangeToString(t);
3372
+ u[e] = [n, t.value];
3373
+ }
3374
+ t.directStyles = u;
3375
+ }
3376
+ let l = e.build();
3377
+ l && (t.data = l.tuples), n?.onEnd?.();
3378
+ },
3379
+ onOpenTag: Fe,
3380
+ onCloseTag: Ie,
3381
+ onText: Le,
3382
+ elementScanners: [{
3383
+ name: "c",
3384
+ scan: (e, t, n) => {
3385
+ if (!u || A !== null) return V;
3386
+ R.r = R.t = R.s = R.cm = R.vm = void 0;
3387
+ let r = Ke(e, t + 2, n, 0);
3388
+ if (r < 0) return r;
3389
+ let i = R.t;
3390
+ if (R.r === void 0 || i === "str" || i === "inlineStr") return V;
3391
+ let a = !1, o = -1, s = -1, c = -1, l = -1, d = r;
3392
+ if (!Ge) for (z.t = z.si = z.ref = z.ca = void 0;;) {
3393
+ let t = e.indexOf("<", r);
3394
+ if (t === -1 || t + 3 >= n) return Ue;
3395
+ for (let n = r; n < t; n++) {
3396
+ let t = e.charCodeAt(n);
3397
+ if (t !== 32 && t !== 9 && t !== 10 && t !== 13) return V;
3398
+ }
3399
+ let i = e.charCodeAt(t + 1), u = e.charCodeAt(t + 2);
3400
+ if (i === 47) {
3401
+ if (!qe(e, t, 99)) return V;
3402
+ d = t + 4;
3403
+ break;
3404
+ }
3405
+ if (i === 102 && !a && c === -1 && (u === 32 || u === 62 || u === 47)) {
3406
+ if (a = !0, r = Ke(e, t + 2, n, 1), r < 0) return r;
3407
+ if (z.t === "dataTable") return V;
3408
+ if (Ge) continue;
3409
+ let i = e.indexOf("<", r);
3410
+ if (i === -1 || i + 3 >= n) return Ue;
3411
+ if (!qe(e, i, 102)) return V;
3412
+ o = r, s = i, r = i + 4;
3413
+ } else if (i === 118 && u === 62 && c === -1) {
3414
+ let i = e.indexOf("<", t + 3);
3415
+ if (i === -1 || i + 3 >= n) return Ue;
3416
+ if (!qe(e, i, 118)) return V;
3417
+ c = t + 3, l = i, r = i + 4;
3418
+ } else return V;
3419
+ }
3420
+ return Fe(ze), a && (Fe(Be), s > o && Le(We(e.slice(o, s))), Ie(Be)), c !== -1 && (Fe(Ve), l > c && Le(We(e.slice(c, l))), Ie(Ve)), Ie(ze), d;
3421
+ }
3422
+ }, {
3423
+ name: "row",
3424
+ openTag: He,
3425
+ scan: (e, t, n) => {
3426
+ if (!je || u || A !== null) return V;
3427
+ B.r = B.s = B.ht = B.hidden = B.collapsed = B.customHeight = B.customFormat = B.outlineLevel = void 0;
3428
+ let r = Ke(e, t + 4, n, 2);
3429
+ return r < 0 ? r : Ge || B.r === void 0 ? V : (Fe(He), r);
3430
+ }
3431
+ }]
3432
+ };
3433
+ }, yr = /* @__PURE__ */ new Map([
3434
+ ["urn:schemas-microsoft-com:vml", "v"],
3435
+ ["urn:schemas-microsoft-com:office:office", "o"],
3436
+ ["urn:schemas-microsoft-com:office:excel", "x"]
3437
+ ]), 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;
3438
+ function wr(e) {
3439
+ if (!e || !((e) => {
3440
+ let t;
3441
+ for (Cr.lastIndex = 0; (t = Cr.exec(e)) !== null;) {
3442
+ let e = yr.get(t[2] ?? t[3] ?? "");
3443
+ if (e && e !== (t[1] ?? "")) return !0;
3444
+ }
3445
+ return !1;
3446
+ })(e)) return e;
3447
+ let t = [], n = (e, n, r) => {
3448
+ let i = e.indexOf(":");
3449
+ if (i === -1 && r) return null;
3450
+ let a = i === -1 ? "" : e.substring(0, i);
3451
+ if (a === "xmlns") return null;
3452
+ let o = ((e, n) => {
3453
+ let r = n?.get(e);
3454
+ if (r !== void 0) return r;
3455
+ for (let n = t.length - 1; n >= 0; n--) {
3456
+ let r = t[n].bindings.get(e);
3457
+ if (r !== void 0) return r;
3458
+ }
3459
+ })(a, n), s = o === void 0 ? void 0 : yr.get(o);
3460
+ return s ? `${s}:${i === -1 ? e : e.substring(i + 1)}` : null;
3461
+ }, r = !1, i = !1, a = e.replace(xr, (e, a, o, s, c) => {
3462
+ if (a) {
3463
+ let r = t[t.length - 1], i = n(o, null, !1);
3464
+ return r && r.name === o && (r.nested > 0 ? r.nested-- : t.pop()), i ? `</${i}>` : e;
3465
+ }
3466
+ let l = ((e) => {
3467
+ let t, n = null;
3468
+ for (Cr.lastIndex = 0; (t = Cr.exec(e)) !== null;) (n ??= /* @__PURE__ */ new Map()).set(t[1] ?? "", t[2] ?? t[3] ?? "");
3469
+ return n;
3470
+ })(s);
3471
+ l?.forEach((e, t) => {
3472
+ let n = [...yr].find(([, e]) => e === t)?.[0];
3473
+ n && n !== e && (r = !0);
3474
+ });
3475
+ let u = n(o, l, !1), d = s.replace(Sr, (e, t, r, i, a) => {
3476
+ if (r === "xmlns" || r.startsWith("xmlns:")) {
3477
+ let t = a.slice(1, -1);
3478
+ return yr.has(t) ? "" : e;
3479
+ }
3480
+ let o = n(r, l, !0);
3481
+ return o ? `${t}${o}${i}${a}` : e;
3482
+ });
3483
+ if (i || (i = !0, d = d.replace(/\s+$/, "") + br), !c) {
3484
+ let e = t[t.length - 1];
3485
+ l ? t.push({
3486
+ name: o,
3487
+ bindings: l,
3488
+ nested: 0
3489
+ }) : e && e.name === o && e.nested++;
3490
+ }
3491
+ return `<${u ?? o}${d}${c}>`;
3492
+ });
3493
+ return r ? e : a;
3494
+ }
3495
+ var Tr = {
3496
+ creator: "author",
3497
+ category: "category",
3498
+ description: "comments",
3499
+ contentStatus: "contentStatus",
3500
+ created: "creationDate",
3501
+ keywords: "keywords",
3502
+ lastModifiedBy: "lastAuthor",
3503
+ modified: "lastModifiedDate",
3504
+ lastPrinted: "lastPrinted",
3505
+ revision: "revisionNumber",
3506
+ subject: "subject",
3507
+ title: "title"
3508
+ }, Er = {
3509
+ Company: "company",
3510
+ Manager: "manager"
3511
+ }, Dr = {
3512
+ lpwstr: U.Type.String,
3513
+ lpstr: U.Type.String,
3514
+ bstr: U.Type.String,
3515
+ i1: U.Type.Number,
3516
+ i2: U.Type.Number,
3517
+ i4: U.Type.Number,
3518
+ i8: U.Type.Number,
3519
+ int: U.Type.Number,
3520
+ ui1: U.Type.Number,
3521
+ ui2: U.Type.Number,
3522
+ ui4: U.Type.Number,
3523
+ ui8: U.Type.Number,
3524
+ uint: U.Type.Number,
3525
+ r4: U.Type.Float,
3526
+ r8: U.Type.Float,
3527
+ decimal: U.Type.Float,
3528
+ bool: U.Type.Boolean,
3529
+ filetime: U.Type.Date,
3530
+ date: U.Type.Date
3531
+ }, Or = (e) => {
3532
+ let t = e.kind ? Dr[e.kind] : void 0;
3533
+ if (!t) return null;
3534
+ let n = e.value.trim(), r;
3535
+ if (t === U.Type.String) r = {
3536
+ key: e.key,
3537
+ type: t,
3538
+ value: e.value
3539
+ };
3540
+ else if (t === U.Type.Boolean) {
3541
+ if (n !== "true" && n !== "false" && n !== "1" && n !== "0") return null;
3542
+ r = {
3543
+ key: e.key,
3544
+ type: t,
3545
+ value: n === "true" || n === "1"
3546
+ };
3547
+ } else if (t === U.Type.Date) {
3548
+ let i = new Date(n);
3549
+ if (!n || isNaN(i.getTime())) return null;
3550
+ r = {
3551
+ key: e.key,
3552
+ type: t,
3553
+ value: i.toISOString()
3554
+ };
3555
+ } else {
3556
+ let i = Number(n);
3557
+ if (!n || !Number.isFinite(i)) return null;
3558
+ let a = t === U.Type.Number && i >= -2147483648 && i <= 2147483647;
3559
+ r = {
3560
+ key: e.key,
3561
+ type: a ? t : U.Type.Float,
3562
+ value: i
3563
+ };
3564
+ }
3565
+ return e.linkTarget && (r.linkTarget = e.linkTarget), r;
3566
+ }, kr = "hiddenXfs", Ar = (e) => (Array.isArray(e) ? e[1] : e?.v)?.s, jr = (e) => {
3567
+ if (!e || e.length === 0) return !1;
3568
+ let t = H.refsToRuns(e, !0), n = 0;
3569
+ for (let e of t) {
3570
+ if (e.min > n || e.value?.s === void 0) return !1;
3571
+ n = Math.max(n, e.max + 1);
3572
+ }
3573
+ return n > xe;
3574
+ }, Mr = (e, t) => {
3575
+ e.protection = {
3576
+ ...e.protection,
3577
+ showFormulas: t
3578
+ };
3579
+ }, Nr = "pivotButtonXfs", Pr = (e, t) => {
3580
+ let n = e.styles?.direct;
3581
+ if (!n || n.length === 0) return;
3582
+ let r = null, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = (e, o, s, c) => {
3583
+ let l = "";
3584
+ c && (l = a.get(c) ?? Je.JSONStableStringify(c), a.set(c, l));
3585
+ let u = `${e}|${o ?? ""}|${s ?? ""}|${l}`, d = i.get(u);
3586
+ if (d !== void 0) return d;
3587
+ let f = n[e], p = f ? Ir(f, o, s, c) : null, m = t?.get(e);
3588
+ return d = p === f ? e : p || m !== void 0 ? ((e, i) => {
3589
+ if (!r) {
3590
+ r = /* @__PURE__ */ new Map();
3591
+ for (let e = 0; e < n.length; e++) {
3592
+ let i = Je.JSONStableStringify(n[e]), a = t?.get(e);
3593
+ a !== void 0 && (i += `|${a}`), r.has(i) || r.set(i, e);
3594
+ }
3595
+ }
3596
+ let a = Je.JSONStableStringify(e);
3597
+ i !== void 0 && (a += `|${i}`);
3598
+ let o = r.get(a);
3599
+ return o === void 0 && (o = n.length, n.push(e), r.set(a, o), i !== void 0 && t.set(o, i)), o;
3600
+ })(p ?? {}, m) : null, i.set(u, d), d;
3601
+ }, s = new Map((e.pivotCaches ?? []).map((e) => [e.cacheId, e.fields]));
3602
+ for (let t of e.sheets ?? []) {
3603
+ let e = _(t), n = e?.pivotTables, r = e?.directStyles;
3604
+ if (!e || !n || n.length === 0 || !r || r.length === 0) continue;
3605
+ let i = r, a = !1;
3606
+ for (let e of n) {
3607
+ let t = Fr(e, s.get(e.cacheId));
3608
+ if (!t) continue;
3609
+ let n = [];
3610
+ for (let e of i) {
3611
+ let r = H.fastStringToRange(e[0]), i = Ur(r, t.coords);
3612
+ if (!i) {
3613
+ n.push(e);
3614
+ continue;
3615
+ }
3616
+ a = !0;
3617
+ for (let t of Wr(r, i)) n.push([H.rangeToString(t), e[1]]);
3618
+ let { rowIndex: s, colIndex: c } = t.origin;
3619
+ for (let r = i.rowStart; r <= i.rowEnd; r++) {
3620
+ let a = i.colStart, l = null, u = (e) => {
3621
+ l !== null && n.push([H.rangeToString({
3622
+ rowStart: r,
3623
+ rowEnd: r,
3624
+ colStart: a,
3625
+ colEnd: e
3626
+ }), l]);
3627
+ };
3628
+ for (let n = i.colStart; n <= i.colEnd; n++) {
3629
+ let { numberFormat: d, labelIndent: f, user: p } = t.formats.formatAt(r - s, n - c), m = o(e[1], d, f, p);
3630
+ n !== i.colStart && m === l || (n !== i.colStart && u(n - 1), a = n, l = m);
3631
+ }
3632
+ u(i.colEnd);
3633
+ }
3634
+ }
3635
+ i = n;
3636
+ }
3637
+ a && (e.directStyles = i);
3638
+ }
3639
+ }, Fr = (e, t) => {
3640
+ let n = W(e, t);
3641
+ if (!n || !e.location) return null;
3642
+ let r = H.fastStringToRange(e.location), i = {
3643
+ rowIndex: r.rowStart - n.top,
3644
+ colIndex: r.colStart
3645
+ };
3646
+ return i.rowIndex < 0 || r.rowEnd !== i.rowIndex + n.rows - 1 ? null : {
3647
+ coords: {
3648
+ rowStart: i.rowIndex,
3649
+ colStart: i.colIndex,
3650
+ rowEnd: r.rowEnd,
3651
+ colEnd: i.colIndex + n.columns - 1
3652
+ },
3653
+ origin: i,
3654
+ formats: n
3655
+ };
3656
+ }, Ir = (e, t, n, r) => {
3657
+ let i = e, a = r?.numberFormat ?? t ?? 0;
3658
+ if (e.numberFormat !== void 0 && Lr(e.numberFormat, a)) {
3659
+ let { numberFormat: e, ...t } = i;
3660
+ i = t;
3661
+ }
3662
+ let o = i.alignment;
3663
+ if (n !== null && o?.horizontal === at.HorizontalAlignment.Left && (o.indent ?? 0) === n) {
3664
+ let { horizontal: e, indent: t, ...n } = o, { alignment: r, ...a } = i;
3665
+ i = Hr(n) ? a : {
3666
+ ...a,
3667
+ alignment: n
3668
+ };
3669
+ }
3670
+ if (r) {
3671
+ let { numberFormat: e, ...t } = r;
3672
+ if (i = Br(i, t), i.alignment && Hr(i.alignment)) {
3673
+ let { alignment: e, ...t } = i;
3674
+ i = t;
3675
+ }
3676
+ }
3677
+ if (i === e) return e;
3678
+ for (let e of Object.keys(i)) if (i[e] !== void 0 && (e !== "named" || i.named !== et.BuiltInName.Normal)) return i;
3679
+ return null;
3680
+ }, Lr = (e, t) => e === t || ot.toBuiltInID(e) === ot.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 : Je.JSONStableStringify(e) === Je.JSONStableStringify(t)), Br = (e, t) => {
3681
+ let n = null, r = (t, r) => {
3682
+ n ??= { ...e }, r === void 0 ? delete n[t] : n[t] = r;
3683
+ };
3684
+ for (let n of Object.keys(e)) {
3685
+ let i = e[n], a = t[n];
3686
+ if (a !== void 0 && i !== void 0) {
3687
+ if (n === "fill") zr(i, a) && r(n);
3688
+ else if (Rr(i) && Rr(a)) {
3689
+ let e = Br(i, a);
3690
+ e !== i && r(n, Object.keys(e).some((t) => e[t] !== void 0) ? e : void 0);
3691
+ } else i === a && r(n);
3692
+ }
3693
+ }
3694
+ return n ?? e;
3695
+ }, Vr = {
3696
+ vertical: at.VerticalAlignment.Bottom,
3697
+ relativeIndent: 0,
3698
+ overflow: at.Overflow.Visible,
3699
+ rotation: 0
3700
+ }, Hr = (e) => Object.keys(e).every((t) => e[t] === void 0 || Vr[t] === e[t]), Ur = (e, t) => {
3701
+ 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);
3702
+ return n <= r && i <= a ? {
3703
+ rowStart: n,
3704
+ rowEnd: r,
3705
+ colStart: i,
3706
+ colEnd: a
3707
+ } : null;
3708
+ }, Wr = (e, t) => {
3709
+ let n = [];
3710
+ return e.rowStart < t.rowStart && n.push({
3711
+ ...e,
3712
+ rowEnd: t.rowStart - 1
3713
+ }), e.rowEnd > t.rowEnd && n.push({
3714
+ ...e,
3715
+ rowStart: t.rowEnd + 1
3716
+ }), e.colStart < t.colStart && n.push({
3717
+ rowStart: t.rowStart,
3718
+ rowEnd: t.rowEnd,
3719
+ colStart: e.colStart,
3720
+ colEnd: t.colStart - 1
3721
+ }), e.colEnd > t.colEnd && n.push({
3722
+ rowStart: t.rowStart,
3723
+ rowEnd: t.rowEnd,
3724
+ colStart: t.colEnd + 1,
3725
+ colEnd: e.colEnd
3726
+ }), n;
3727
+ }, Gr = "xfComplements", Kr = (e, t) => {
3728
+ if (typeof e == "string") return void t.push(e);
3729
+ let n = Array.isArray(e) ? e : [e];
3730
+ for (let e = 0; e < n.length; e++) {
3731
+ let r = H.rangeToString(n[e]);
3732
+ r && t.push(r);
3733
+ }
3734
+ }, qr = (e) => {
3735
+ let t = Array.isArray(e) ? e[1] : e.v;
3736
+ if (!t || !("s" in t)) return;
3737
+ let n = t.s;
3738
+ return delete t.s, n;
3739
+ }, Jr = (e, t, n, r) => {
3740
+ if (!e) return;
3741
+ let i = t ? 2 : 1, a = t ? n.rowStart : n.colStart, o = t ? n.rowEnd : n.colEnd, s, c = -1;
3742
+ for (let n of e) {
3743
+ let e = H.refToRun(n, t), l = qr(n);
3744
+ e && l !== void 0 ? l !== c || (t ? s.colEnd : s.rowEnd) + 1 !== e.min ? (s = {
3745
+ colStart: t ? e.min : a,
3746
+ rowStart: t ? a : e.min,
3747
+ colEnd: t ? e.max : o,
3748
+ rowEnd: t ? o : e.max,
3749
+ value: {
3750
+ kind: i,
3751
+ index: l
3752
+ }
3753
+ }, c = l, r.push(s)) : t ? s.colEnd = e.max : s.rowEnd = e.max : c = -1;
3754
+ }
3755
+ }, Yr = {
3756
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
3757
+ "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
3758
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
3759
+ "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
3760
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
3761
+ "application/vnd.ms-excel.template.macroEnabled.main+xml": "workbooks",
3762
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
3763
+ "application/vnd.ms-excel.worksheet": "sheets",
3764
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
3765
+ "application/vnd.ms-excel.chartsheet": "charts",
3766
+ "application/vnd.ms-excel.macrosheet+xml": "macros",
3767
+ "application/vnd.ms-excel.macrosheet": "macros",
3768
+ "application/vnd.ms-excel.intlmacrosheet+xml": "macros",
3769
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
3770
+ "application/vnd.ms-excel.dialogsheet": "dialogs",
3771
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
3772
+ "application/vnd.ms-excel.sharedStrings": "strs",
3773
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
3774
+ "application/vnd.ms-excel.styles": "styles",
3775
+ "application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
3776
+ "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
3777
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
3778
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
3779
+ "application/vnd.ms-excel.comments": "comments",
3780
+ "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
3781
+ "application/vnd.ms-excel.person+xml": "people",
3782
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
3783
+ "application/vnd.ms-excel.sheetMetadata": "metadata",
3784
+ "application/vnd.ms-excel.featurepropertybag+xml": "featurePropertyBag",
3785
+ "application/vnd.ms-excel.externalLink": "links",
3786
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
3787
+ "application/vnd.openxmlformats-officedocument.theme+xml": "themes"
3788
+ }, Xr = e({ readXLSX: () => ti }), Zr = (e) => e.startsWith("/") ? e.slice(1) : e, Qr = [
3789
+ 208,
3790
+ 207,
3791
+ 17,
3792
+ 224,
3793
+ 161,
3794
+ 177,
3795
+ 26,
3796
+ 225
3797
+ ], $r = /^xl\/worksheets\/[^/]+\.xml$/i, ei = (e) => typeof e == "string" ? e : (e?.runs ?? []).map((e) => e.text ?? "").join(""), ti = async (e, n) => {
3798
+ let { password: o, onVBA: s, profile: u, calcOnLoad: p = "auto", createWorkbookOptions: h = {}, ...v } = n ?? {};
3799
+ await Qe.load();
3800
+ let te = !!h.origin && typeof h.origin != "string", x = u ? new Nt(typeof u == "function" ? u : void 0) : null, ne = [], re = (e, t, n) => {
3801
+ ne.push([
3802
+ e,
3803
+ t ?? "",
3804
+ n
3805
+ ]);
3806
+ }, S = { onWarning: re }, C = n?.progress, ae = C?.onProgress ? C.onProgress.bind(C) : void 0, w = e.byteLength, T = 0, le = 0, de = ae ? (e) => {
3807
+ if (T <= 0) return;
3808
+ le += e;
3809
+ let t = Math.min(w, Math.round(le / T * w));
3810
+ ae(t, w);
3811
+ } : void 0, pe = import("./RFSuXvJ9sgsaA2LC.mjs"), me = null;
3812
+ try {
3813
+ me = new DOMParser();
3814
+ } catch {}
3815
+ let E = null;
3816
+ try {
3817
+ E = new XMLSerializer();
3818
+ } catch {}
3819
+ let D, O, k, A = null;
3820
+ me || (A = import("./PgUWs0pPSCSFYJtU.mjs").then((e) => t(e.default, 1)));
3821
+ try {
3822
+ let [e, t] = await Promise.all([A, pe]);
3823
+ D = new t.DOMTransformer(), O = me ?? new e.DOMParser(), k = E ?? new e.XMLSerializer();
3824
+ } catch (e) {
3825
+ throw Error("Unable to load XLSX parser.", { cause: e });
3826
+ }
3827
+ let he = (e) => k.serializeToString(e);
3828
+ if (((e) => {
3829
+ if (e.byteLength < Qr.length) return !1;
3830
+ let t = new Uint8Array(e, 0, Qr.length);
3831
+ return Qr.every((e, n) => t[n] === e);
3832
+ })(e)) throw new Ge("This is an Excel 97-2003 workbook (.xls), which cannot be read. Save it as '.xlsx' and try again.");
3833
+ let j;
3834
+ try {
3835
+ j = await Mt.create(e);
3836
+ } catch (e) {
3837
+ throw new Ge("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: e });
3838
+ }
3839
+ x?.mark("zip-open");
3840
+ try {
3841
+ if (!j.has("[Content_Types].xml")) throw new Ge("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3842
+ let e = (e) => {
3843
+ let t = j.getEntry(e);
3844
+ return t ? { content: t } : void 0;
3845
+ }, t = {
3846
+ workbooks: [],
3847
+ sheets: [],
3848
+ charts: [],
3849
+ dialogs: [],
3850
+ macros: [],
3851
+ strs: [],
3852
+ comments: [],
3853
+ threadedcomments: [],
3854
+ links: [],
3855
+ coreprops: [],
3856
+ extprops: [],
3857
+ custprops: [],
3858
+ themes: [],
3859
+ styles: [],
3860
+ metadata: [],
3861
+ people: [],
3862
+ featurePropertyBag: [],
3863
+ overrides: {},
3864
+ sst: "",
3865
+ style: "",
3866
+ defaults: {}
3867
+ };
3868
+ {
3869
+ let e = ((e, t) => ({
3870
+ onOpenTag: (t) => {
3871
+ let n = ((e) => {
3872
+ let t = e.indexOf(":");
3873
+ return t === -1 ? e : e.slice(t + 1);
3874
+ })(t.name), r = t.attributes;
3875
+ if (n === "Override") {
3876
+ let t = r.ContentType, n = r.PartName;
3877
+ if (!t || !n) return;
3878
+ e.overrides[n.startsWith("/") ? n.slice(1) : n] = t;
3879
+ let i = Yr[t], a = i ? e[i] : void 0;
3880
+ Array.isArray(a) && a.push(n);
3881
+ } else if (n === "Default") {
3882
+ let t = r.Extension, n = r.ContentType;
3883
+ t && (e.defaults[t.toLowerCase()] = n);
3884
+ }
3885
+ },
3886
+ onEnd: () => {
3887
+ e.sst = e.strs.length > 0 ? e.strs[0] : "", e.style = e.styles.length > 0 ? e.styles[0] : "";
3888
+ },
3889
+ onError: (e) => {
3890
+ t?.(`Error parsing content types: ${e?.message ?? e}`);
3891
+ }
3892
+ }))(t, (e) => {
3893
+ ne.push([e, "[Content_Types].xml"]);
3894
+ }), n = await j.getTextStream("[Content_Types].xml");
3895
+ if (!n) throw Error("Error parsing content types: '[Content_Types].xml'");
3896
+ try {
3897
+ await Sn.parseStream(n, e, { xmlns: !1 });
3898
+ } catch (e) {
3899
+ throw Error("Error parsing content types: '[Content_Types].xml'", { cause: e });
3900
+ }
3901
+ te && await j.getBuffer("[Content_Types].xml");
3902
+ }
3903
+ x?.mark("content-types");
3904
+ let n = t.sst, o = /* @__PURE__ */ new Set();
3905
+ for (let e of t.sheets) o.add(Zr(e));
3906
+ n && o.add(Zr(n));
3907
+ for (let e of o) T += j.uncompressedSize(e);
3908
+ if (await j.prefetch((e) => !o.has(e) && !$r.test(e)), x?.mark("prefetch-side-parts"), t.workbooks.length === 0) {
3909
+ let n = se("_rels/.rels", e, O, D, S);
3910
+ if (n) {
3911
+ for (let e of n.values()) if (e.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" && e.target) {
3912
+ t.workbooks.push(e.target);
3913
+ break;
3914
+ }
3915
+ }
3916
+ }
3917
+ if (t.workbooks.length === 0) throw new Ge("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
3918
+ let v = h?.resources ?? new lt(), le = v.beginPersist(), pe = {}, me = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
3919
+ E.set("parseInlineDxf", (e) => {
3920
+ if (!e) return;
3921
+ let t = O.parseFromString(`<dxf xmlns:x14="${fe}" xmlns:xm="${He}">${e}</dxf>`, "text/xml")?.documentElement;
3922
+ if (!t) return;
3923
+ let n = D.parseDxf(t, "", S);
3924
+ return Object.keys(n).length > 0 ? n : void 0;
3925
+ });
3926
+ let k = r("metadata", t, e, O, D, S).entries().next()?.value?.[1]?.metadata;
3927
+ k && E.set("metadata", k), E.set(sr, d());
3928
+ let A = /* @__PURE__ */ new Map(), _e = [], ve = /* @__PURE__ */ new Set(), M = (e) => {
3929
+ ve.add(Zr(e));
3930
+ }, N = (t, n = A) => {
3931
+ let r = t.lastIndexOf("/"), i = t.substring(0, r + 1) + "_rels/" + t.substring(r + 1, t.length) + ".rels", a = n.get(i);
3932
+ return a || (a = se(i, e, O, D, z), n.set(i, a)), a;
3933
+ }, F = (t, n, r, i = A) => {
3934
+ let a = N(n, i).get(t), o = a?.target;
3935
+ if (!o) return null;
3936
+ if (a.targetMode === "External") {
3937
+ if (!r) return a.target;
3938
+ let e = v.add({ source: { external: a.target } });
3939
+ return e.addReference(pe), me.add(e), le.toResourceId(e);
3940
+ }
3941
+ let s = n.lastIndexOf("/"), c = n.substring(0, s + 1);
3942
+ o.startsWith("/") || (o = c + o), o = Te(o);
3943
+ let l = D?.getVisitorParamsState().get("dxfs"), u = i.get(o);
3944
+ if (!u) {
3945
+ if (a.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
3946
+ let e = {};
3947
+ u = e, _e.push((async () => {
3948
+ let t = fr(e, (e, t) => t === "legacyDrawing" ? Se(e, o) : t === "formControl" ? Ce(e, o) : t === "part" ? Ee(e, o) : F(e, o, t === "resource") ?? null, Ye, l, () => {}, (e, t, n) => {
3949
+ re(e, t ? `${t} (${o})` : o, n);
3950
+ }, void 0, E), n = await j.getTextStream(o, de);
3951
+ if (n) try {
3952
+ await Sn.parseStream(n, t, {
3953
+ xmlns: !1,
3954
+ lean: !0
3955
+ });
3956
+ } catch (e) {
3957
+ throw Error(`Error parsing sheet: '${o}'`, { cause: e });
3958
+ }
3959
+ let r = N(o, i);
3960
+ if (r) {
3961
+ be(e, o, r, i), Ae(e), ge(e);
3962
+ let t = [];
3963
+ r.forEach((e, n) => {
3964
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable") return;
3965
+ let r = Ee(n, o, e.type, (e) => e !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition");
3966
+ if (!r?.xml) return;
3967
+ let i = /<pivotTableDefinition\b[^>]*>/.exec(r.xml)?.[0] ?? "", a = parseInt(/\scacheId="(\d+)"/.exec(i)?.[1] ?? "", 10);
3968
+ if (isNaN(a)) return void ne.push([`Pivot table '${r.name}' names no cache and was dropped.`, o]);
3969
+ let s = /\sname="([^"]*)"/.exec(i)?.[1], c = Le(r.xml);
3970
+ if (!c) return void ne.push([`Pivot table '${r.name}' states no location and was dropped.`, o]);
3971
+ let l = D?.getVisitorParamsState(), u = Pe(l?.get("numFmts"), l?.get("dxfs")), d = L(r.xml, u), f = d ? void 0 : P(r.xml, u);
3972
+ t.push({
3973
+ ...s ? { name: oe(s) } : {},
3974
+ cacheId: a,
3975
+ location: c,
3976
+ part: r,
3977
+ ...f ? { partFormats: f } : {},
3978
+ ...d
3979
+ });
3980
+ }), t.length > 0 && (e.pivotTables = t);
3981
+ }
3982
+ })());
3983
+ } else if (a.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink") {
3984
+ let t = ee(o, e, O, D, z);
3985
+ if (t && Object.keys(t).length !== 0) {
3986
+ let e = t, n = e.__bookRelId, r = e.__absoluteUrlRelId;
3987
+ delete e.__bookRelId, delete e.__absoluteUrlRelId;
3988
+ let a = [];
3989
+ N(o, i)?.forEach((e, t) => {
3990
+ if (e.targetMode === "External" && e.type && e.target) {
3991
+ let i = {
3992
+ type: e.type,
3993
+ target: e.target
3994
+ };
3995
+ t === n ? i.role = "book" : t === r && (i.role = "absoluteUrl"), a.push(i);
3996
+ }
3997
+ }), a.sort((e, t) => (e.role === "book" ? 0 : 1) - (t.role === "book" ? 0 : 1)), e.sources = a, M(o), u = e;
3998
+ } else u = null;
3999
+ } else u = r ? ue(o, e, (e, t) => {
4000
+ let n = v.add({ source: { buffer: e } });
4001
+ return n.addReference(pe), me.add(n), le.toResourceId(n);
4002
+ }, z) : ee(o, e, O, D, z);
4003
+ }
4004
+ return u;
4005
+ }, I = (e, t) => {
4006
+ if (!e) return null;
4007
+ let n = N(t, A)?.get(e);
4008
+ if (!n?.target || n.targetMode === "External") return null;
4009
+ let r = n.target;
4010
+ return r.startsWith("/") || (r = t.substring(0, t.lastIndexOf("/") + 1) + r), Te(r);
4011
+ }, be = (e, t, n, r) => {
4012
+ let i = [], o = /* @__PURE__ */ new Map(), s = [];
4013
+ n.forEach((e, n) => {
4014
+ if (e.type !== "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment") return;
4015
+ let a = F(n, t, !1, r)?.comments;
4016
+ if (!a) return;
4017
+ for (let e = 0; e < a.length; e++) {
4018
+ let t = a[e];
4019
+ if (!t?.v?.id) continue;
4020
+ let { parentId: n, done: r, content: c, ...l } = t.v, u = {
4021
+ ...l,
4022
+ content: ei(c)
4023
+ };
4024
+ n ? s.push({
4025
+ parentId: n,
4026
+ json: u
4027
+ }) : (r && (u.done = !0), o.set(u.id, u), i.push({
4028
+ r: t.r,
4029
+ v: u
4030
+ }));
4031
+ }
4032
+ let c = I(n, t);
4033
+ c && M(c);
4034
+ });
4035
+ for (let e = 0; e < s.length; e++) {
4036
+ let { parentId: t, json: n } = s[e], r = o.get(t);
4037
+ r && (r.replies ??= []).push(n);
4038
+ }
4039
+ let l = [];
4040
+ if (n.forEach((e, n) => {
4041
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") return;
4042
+ let i = F(n, t, !1, r), a = i?.comments;
4043
+ if (!a) return;
4044
+ let s = i?.authors;
4045
+ for (let e = 0; e < a.length; e++) {
4046
+ let t = a[e];
4047
+ if (!t?.r) continue;
4048
+ let n = s && t.v.authorId !== void 0 ? s[t.v.authorId] : void 0;
4049
+ if (n && n.startsWith("tc=")) {
4050
+ if (o.has(R(n.substring(3)))) continue;
4051
+ n = void 0;
4052
+ }
4053
+ let r = {
4054
+ id: We.uuidV4().toUpperCase(),
4055
+ asNote: !0,
4056
+ content: t.v.content ?? ""
4057
+ }, i = n ? ze({ displayName: n }) : void 0;
4058
+ i && (r.personId = i.id), l.push({
4059
+ r: t.r,
4060
+ v: r
4061
+ });
4062
+ }
4063
+ let c = I(n, t);
4064
+ c && M(c);
4065
+ }), i.length === 0 && l.length === 0) return;
4066
+ let u = [...i, ...l], d = e.legacyDrawing;
4067
+ if (d?.xml) {
4068
+ let { rest: t, notes: n } = c(d.xml);
4069
+ if (n.length > 0) {
4070
+ let r = /* @__PURE__ */ new Map();
4071
+ for (let e = 0; e < n.length; e++) {
4072
+ let t = n[e];
4073
+ r.set(H.cellToString({
4074
+ rowIndex: t.row,
4075
+ colIndex: t.col
4076
+ }), t);
4077
+ }
4078
+ for (let e = 0; e < u.length; e++) {
4079
+ let t = u[e], n = r.get(String(t.r).toUpperCase());
4080
+ if (!n || (r.delete(String(t.r).toUpperCase()), !t.v.asNote)) continue;
4081
+ let i = ie(n.xml), a = {};
4082
+ if (i.anchor) {
4083
+ let [e, t, r, o, s, c, l, u] = i.anchor;
4084
+ a.anchor = {
4085
+ tl: {
4086
+ c: e - n.col,
4087
+ x: t,
4088
+ r: r - n.row,
4089
+ y: o
4090
+ },
4091
+ br: {
4092
+ c: s - n.col,
4093
+ x: c,
4094
+ r: l - n.row,
4095
+ y: u
4096
+ }
4097
+ };
4098
+ } else i.bounds && (a.bounds = i.bounds);
4099
+ 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);
4100
+ }
4101
+ let i = [];
4102
+ r.forEach((e) => {
4103
+ i.push(e.xml);
4104
+ });
4105
+ let o = a(t, i);
4106
+ o ? d.xml = o : delete e.legacyDrawing;
4107
+ }
4108
+ }
4109
+ e.comments = u;
4110
+ }, Se = (t, n) => {
4111
+ let r = I(t, n);
4112
+ if (!r) return null;
4113
+ let i = e(Zr(r));
4114
+ if (!i) return null;
4115
+ let a = { xml: wr(new TextDecoder("utf-8").decode(i.content)) }, o = [];
4116
+ return N(r, A)?.forEach((e, t) => {
4117
+ if (e.type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") return;
4118
+ let n = F(t, r, !0);
4119
+ typeof n == "number" && o.push({
4120
+ id: t,
4121
+ resId: n
4122
+ });
4123
+ }), o.length > 0 && (a.images = o), M(r), a;
4124
+ }, Ce = (t, n) => {
4125
+ let r = I(t, n);
4126
+ if (!r) return null;
4127
+ let i = ee(r, e, O, D, z)?.formControl ?? null;
4128
+ return i && M(r), i;
4129
+ }, Ee = (n, r, i, a, o = /* @__PURE__ */ new Set()) => {
4130
+ let s = I(n, r);
4131
+ if (!s || o.has(s)) return null;
4132
+ let c = i ?? N(r, A)?.get(n)?.type;
4133
+ if (!c) return null;
4134
+ let l = e(Zr(s));
4135
+ if (!l) return null;
4136
+ o.add(s);
4137
+ let u = s.substring(s.lastIndexOf("/") + 1), d = t.overrides[Zr(s)] ?? t.defaults[u.substring(u.lastIndexOf(".") + 1).toLowerCase()], f = {
4138
+ id: n,
4139
+ type: c,
4140
+ name: u
4141
+ };
4142
+ 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);
4143
+ else {
4144
+ let e = F(n, r, !0);
4145
+ if (typeof e != "number") return null;
4146
+ f.resId = e;
4147
+ }
4148
+ let p = [];
4149
+ return N(s, A)?.forEach((e, t) => {
4150
+ if (!e?.type || a && !a(e.type)) return;
4151
+ if (e.targetMode === "External") {
4152
+ let n = F(t, s, !0);
4153
+ typeof n == "number" && p.push({
4154
+ id: t,
4155
+ type: e.type,
4156
+ resId: n
4157
+ });
4158
+ return;
4159
+ }
4160
+ let n = Ee(t, s, e.type, a, o);
4161
+ n && p.push(n);
4162
+ }), p.length > 0 && (f.parts = p), M(s), f;
4163
+ }, Oe = r("coreprops", t, e, O, D, S), ke = r("extprops", t, e, O, D, S), je = r("custprops", t, e, O, D, S);
4164
+ je.forEach((e, t) => {
4165
+ e?.custom && M(t);
4166
+ });
4167
+ let Me = new ct(), Fe = r("people", t, e, O, D, S);
4168
+ if (Fe.size > 0) {
4169
+ let [e, t] = Fe.entries().next().value;
4170
+ Me.fromJSON(t?.persons), M(e);
4171
+ }
4172
+ let ze = (e) => {
4173
+ if (e) return Me.add(e).toJSON();
4174
+ }, z = {
4175
+ paramMap: E,
4176
+ getRefs: N,
4177
+ getRef: F,
4178
+ parsedRefs: A,
4179
+ readEmbeddedPart: (e, t) => Ee(e, t),
4180
+ addPerson: ze,
4181
+ serializeElement: he,
4182
+ onWarning: re
4183
+ }, Be = [], Ve = /* @__PURE__ */ new Map();
4184
+ if (E.set(ur, Ve), n) {
4185
+ let e = await j.getTextStream(n, de);
4186
+ if (e) {
4187
+ let t = ((e, t) => {
4188
+ let n = !1, r = !1, i = 0, a = "", o = new nr();
4189
+ return {
4190
+ onOpenTag: (e) => {
4191
+ let t = tr(e.name);
4192
+ 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);
4193
+ },
4194
+ onText: (e) => {
4195
+ r && (a += e, o.onText(e));
4196
+ },
4197
+ onCloseTag: (t) => {
4198
+ let s = tr(t.name);
4199
+ 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);
4200
+ },
4201
+ onError: (e) => {
4202
+ t?.(`Error parsing shared strings: ${e?.message ?? e}`);
4203
+ }
4204
+ };
4205
+ })((e, t) => {
4206
+ t && Ve.set(Be.length, t), Be.push(e);
4207
+ }, (e) => {
4208
+ re(e, n);
4209
+ });
4210
+ try {
4211
+ await Sn.parseStream(e, t, { xmlns: !1 });
4212
+ } catch (e) {
4213
+ throw Error(`Error parsing shared strings: '${n}'`, { cause: e });
4214
+ }
4215
+ }
4216
+ }
4217
+ x?.mark("shared-strings");
4218
+ let B = Be.length, Ue = /* @__PURE__ */ new Map(), Je = B, Ye = (e) => {
4219
+ let t = Ue.get(e);
4220
+ if (t !== void 0) return t;
4221
+ let n = Je;
4222
+ return Ue.set(e, Je++), Be.push(e), n;
4223
+ }, Xe = [];
4224
+ t.slicersCache = Xe;
4225
+ let Ze = j.getNames(), Qe = Ze.length;
4226
+ for (let e = 0; e < Qe; e++) {
4227
+ let t = Ze[e];
4228
+ t && (t.startsWith("xl/slicerCache") || t.startsWith("xl/timelineCaches/") && t.endsWith(".xml")) && Xe.push(`/${t}`);
4229
+ }
4230
+ let tt = r("slicersCache", t, e, O, D, z), nt = /* @__PURE__ */ new Map();
4231
+ tt.forEach((e, t) => {
4232
+ e?.cacheName && (e.cachePath = t, nt.set(e.cacheName, e));
4233
+ }), E.set("slicerCaches", nt);
4234
+ let U = [];
4235
+ t.slicers = U;
4236
+ for (let e = 0; e < Qe; e++) {
4237
+ let t = Ze[e];
4238
+ t && (t.startsWith("xl/slicers/") || t.startsWith("xl/timelines/")) && t.endsWith(".xml") && U.push(`/${t}`);
4239
+ }
4240
+ let rt = {
4241
+ getFile: e,
4242
+ domParser: O,
4243
+ getAddress: (e, t) => {
4244
+ let n = F(t, e, !1);
4245
+ return typeof n == "string" ? n : null;
4246
+ },
4247
+ getBytes: (t, n) => {
4248
+ let r = I(n, t), i = r ? e(r.substring(1))?.content : void 0;
4249
+ return i ? i.slice().buffer : null;
4250
+ },
4251
+ addFetched: (e, t) => {
4252
+ let n = v.add({
4253
+ source: { buffer: e },
4254
+ fetchedFrom: t
4255
+ });
4256
+ return n.addReference(pe), me.add(n), le.toResourceId(n);
4257
+ },
4258
+ markAbsorbed: M
4259
+ }, it = /* @__PURE__ */ new Map();
4260
+ for (let e of ce.getAll()) it.set(e.structure, e.beginRead(rt));
4261
+ let at = ((e, t) => {
4262
+ let n = (n) => {
4263
+ let r = e(n);
4264
+ return r ? t.parseFromString(new TextDecoder().decode(r.content), "text/xml").documentElement ?? null : null;
4265
+ }, r = G(n(xt), "s").map((e) => ({
4266
+ t: e.getAttribute("t") ?? "",
4267
+ keys: Ot(e)
4268
+ })), i = G(n(St), "rv").map((e) => {
4269
+ let t = G(e, "fb")[0];
4270
+ return {
4271
+ s: parseInt(e.getAttribute("s") ?? "-1", 10),
4272
+ values: G(e, "v").map((e) => e.textContent ?? ""),
4273
+ fb: t ? t.textContent ?? "" : null
4274
+ };
4275
+ }), a = G(n(Ct), "a").map((e) => {
4276
+ let t = kt(e), n = parseInt(e.getAttribute("r") ?? "", 10), r = parseInt(e.getAttribute("c") ?? "", 10), i = n > 0 ? n : t.length;
4277
+ return {
4278
+ rows: i,
4279
+ columns: r > 0 ? r : Math.max(1, Math.ceil(t.length / Math.max(1, i))),
4280
+ items: t
4281
+ };
4282
+ }), o = G(n(wt), "s").map(Ot), s = n(Tt), c = G(G(s, "spbArrays")[0], "a").map(kt), l = G(G(s, "spbData")[0], "spb").map((e) => ({
4283
+ s: parseInt(e.getAttribute("s") ?? "-1", 10),
4284
+ values: G(e, "v").map((e) => e.textContent ?? "")
4285
+ })), u = n(Et), d = At(G(G(u, "global")[0], "keyFlags")[0]), f = /* @__PURE__ */ new Map();
4286
+ for (let e of G(G(u, "types")[0], "type")) f.set(e.getAttribute("name") ?? "", At(G(e, "keyFlags")[0]));
4287
+ let p = n(Dt), m = G(G(p, "dxfs")[0], "dxf").map((e) => G(e, "numFmt")[0]?.getAttribute("formatCode") ?? null), h = G(G(p, "richProperties")[0], "rPr").map((e) => e.getAttribute("n") ?? "");
4288
+ return {
4289
+ structures: r,
4290
+ values: i,
4291
+ arrays: a,
4292
+ bagStructures: o,
4293
+ bagArrays: c,
4294
+ bags: l,
4295
+ globalKeyFlags: d,
4296
+ typeKeyFlags: f,
4297
+ richStyles: G(G(p, "richStyles")[0], "rSty").map((e) => {
4298
+ let t = /* @__PURE__ */ new Map();
4299
+ for (let n of G(e, "rpv")) {
4300
+ let e = h[parseInt(n.getAttribute("i") ?? "-1", 10)];
4301
+ e && t.set(e, n.textContent ?? "");
4302
+ }
4303
+ let n = parseInt(e.getAttribute("dxfid") ?? "", 10);
4304
+ return {
4305
+ numberFormat: t.get("NumberFormat") ?? (n >= 0 ? m[n] ?? null : null),
4306
+ isTitle: t.get("IsTitleField") === "1",
4307
+ isHero: t.get("IsHeroField") === "1"
4308
+ };
4309
+ })
4310
+ };
4311
+ })(e, O), ot = Ne(at, it, (e) => {
4312
+ re(e, "/xl/richData/rdrichvalue.xml");
4313
+ });
4314
+ E.set("richData", at.values.map((e, t) => ot.cellValue(t)));
4315
+ for (let e = 0; e < Qe; e++) {
4316
+ let t = Ze[e];
4317
+ t.startsWith("xl/richData/") && !t.includes("/_rels/") && M(t);
4318
+ }
4319
+ let st = r("themes", t, e, O, D, z), ut = null;
4320
+ if (st && st.entries) {
4321
+ let e = st.entries().next();
4322
+ e?.value?.[1] && (ut = e.value[1]);
4323
+ }
4324
+ let dt = new pt(ut), ft = r("styles", t, e, O, D, z).entries().next()?.value?.[1];
4325
+ ft &&= JSON.parse(V.JSONStableStringify(ft));
4326
+ let mt = r("workbooks", t, e, O, D, z);
4327
+ E.set(lr, !0 === mt.entries().next().value?.[1]?.date1904), (h.calcOnLoad ?? p) !== "none" && E.set(cr, ((e, t) => {
4328
+ let n = /* @__PURE__ */ new Set();
4329
+ if (e) for (let t = 0; t < e.length; t++) n.add(String(e[t]?.name).toUpperCase());
4330
+ if (t) for (let e = 0; e < t.length; e++) try {
4331
+ let r = t[e](() => {
4332
+ throw Error("Not evaluating.");
4333
+ }, (e, t, r, i) => {
4334
+ for (let e of Object.keys(i)) n.add(e.toUpperCase());
4335
+ }, /* @__PURE__ */ new Map());
4336
+ for (let e of r.keys()) n.add(e.toUpperCase());
4337
+ } catch {}
4338
+ return (e) => n.has(e) || $e.has(e);
4339
+ })(mt.entries().next().value?.[1]?.names, h.functions)), x?.mark("side-parts-json"), await Promise.all(_e);
4340
+ {
4341
+ let e = mt.entries().next().value?.[1], t = d(e?.names), n = e?.sheets ?? [];
4342
+ for (let e = 0; e < n.length; e++) {
4343
+ let r = n[e], i = y(r);
4344
+ if (r?.kind === "macro" && i?.part.xml) {
4345
+ i.part.xml = l(i.part.xml, Be);
4346
+ continue;
4347
+ }
4348
+ let a = _(r);
4349
+ a && m(a, t);
4350
+ }
4351
+ let r = e?.names;
4352
+ if (r) for (let e = 0; e < r.length; e++) {
4353
+ let n = r[e]?.ref;
4354
+ typeof n == "string" && (r[e].ref = t.readDetached(n));
4355
+ }
4356
+ }
4357
+ ae && T > 0 && (ae(w, w), await new Promise((e) => setTimeout(e, 0))), x?.mark("sheets");
4358
+ let W = {
4359
+ ...mt.entries().next().value?.[1],
4360
+ styles: ft,
4361
+ theme: dt.toJSON()
4362
+ }, gt = ((e, t, n, r) => {
4363
+ let i = {}, a = (e, t) => {
4364
+ if (e) for (let { key: n, value: r } of e) {
4365
+ let e = t[n];
4366
+ if (e && r) {
4367
+ if (e === "revisionNumber") {
4368
+ let e = parseInt(r, 10);
4369
+ Number.isFinite(e) && (i.revisionNumber = e);
4370
+ } else i[e] = r;
4371
+ }
4372
+ }
4373
+ };
4374
+ if (a(e, Tr), a(t, Er), n) {
4375
+ let e = [];
4376
+ for (let t of n) {
4377
+ let n = Or(t);
4378
+ 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");
4379
+ }
4380
+ e.length > 0 && (i.custom = e);
4381
+ }
4382
+ return Object.keys(i).length > 0 ? i : void 0;
4383
+ })(Oe.values().next().value?.properties, ke.values().next().value?.properties, je.values().next().value?.custom, (e, t) => {
4384
+ re(e, "docProps/custom.xml", t);
4385
+ });
4386
+ gt && (W.properties = gt), ((e, t) => {
4387
+ if (!t || t.size === 0) return;
4388
+ let n = e.styles;
4389
+ if (!n) return;
4390
+ let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
4391
+ for (let n of e.sheets ?? []) {
4392
+ let e = _(n);
4393
+ if (!e) continue;
4394
+ let a = /* @__PURE__ */ new Set();
4395
+ jr(e.cols) || a.add(0);
4396
+ for (let t of e.directStyles ?? []) a.add(Array.isArray(t) ? t[1] : t.v);
4397
+ for (let t of e.rows ?? []) {
4398
+ let e = Ar(t);
4399
+ e !== void 0 && a.add(e);
4400
+ }
4401
+ for (let t of e.cols ?? []) {
4402
+ let e = Ar(t);
4403
+ e !== void 0 && a.add(e);
4404
+ }
4405
+ let o = !1;
4406
+ for (let e of a) if (t.has(e)) {
4407
+ o = !0;
4408
+ break;
4409
+ }
4410
+ if (o) {
4411
+ e.protection = {
4412
+ ...e.protection ?? { sheet: !0 },
4413
+ showFormulas: !1
4414
+ };
4415
+ for (let e of a) (t.has(e) ? i : r).add(e);
4416
+ }
4417
+ }
4418
+ if (r.size === 0) return;
4419
+ let a = n.direct ??= [];
4420
+ for (let e of r) e !== 0 && Mr(a[e] ?? (a[e] = {}), !0);
4421
+ for (let e of i) e !== 0 && Mr(a[e] ?? (a[e] = {}), !1);
4422
+ if (r.has(0)) {
4423
+ let e = n.named ??= [], t = et.BuiltInName.Normal.toLowerCase(), r = e.find((e) => e.name?.toLowerCase() === t);
4424
+ r || (r = {
4425
+ name: et.BuiltInName.Normal,
4426
+ style: {}
4427
+ }, e.push(r)), Mr(r.style, !0);
4428
+ }
4429
+ })(W, E.get(kr)), ((e, t) => {
4430
+ if (t && t.size !== 0) for (let n of e.sheets ?? []) {
4431
+ let e = _(n), r = e?.pivotTables;
4432
+ if (!e || !r || r.length === 0) continue;
4433
+ let i = r.map(De), a = r.map(() => []);
4434
+ for (let [n, r] of e.directStyles ?? []) {
4435
+ if (!t.has(r)) continue;
4436
+ let e = H.fastStringToRange(n);
4437
+ for (let t = 0; t < i.length; t++) {
4438
+ let n = i[t];
4439
+ if (!n) continue;
4440
+ 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);
4441
+ if (r > o || s > c) continue;
4442
+ let l = H.rangeToString({
4443
+ rowStart: r - n.rowStart,
4444
+ rowEnd: o - n.rowStart,
4445
+ colStart: s - n.colStart,
4446
+ colEnd: c - n.colStart
4447
+ });
4448
+ l && a[t].push(l);
4449
+ }
4450
+ }
4451
+ for (let e = 0; e < r.length; e++) a[e].length > 0 && (r[e].buttons = a[e]);
4452
+ }
4453
+ })(W, E.get(Nr));
4454
+ let vt = E.get(Gr);
4455
+ Pr(W, vt), ((e) => {
4456
+ let t = {
4457
+ colStart: 0,
4458
+ rowStart: 0,
4459
+ colEnd: xe,
4460
+ rowEnd: Re
4461
+ };
4462
+ for (let n of e.sheets ?? []) {
4463
+ let e = _(n);
4464
+ if (!e) continue;
4465
+ let r = [];
4466
+ if (Jr(e.cols, !0, t, r), Jr(e.rows, !1, t, r), r.length === 0) continue;
4467
+ let i = [];
4468
+ for (let [t, n] of e.directStyles ?? []) i.push({
4469
+ ...H.fastStringToRange(t),
4470
+ value: {
4471
+ kind: 0,
4472
+ index: n
4473
+ }
4474
+ });
4475
+ i.push(...r);
4476
+ let a = [], o = new Ke.IteratorInstance(i, { axis: qe.Column });
4477
+ for (let e = o.next(); !e.done; e = o.next()) {
4478
+ let n = e.value.overlaps, r;
4479
+ if (n.length === 1) {
4480
+ if (r = n[0].value, r.index === 0) continue;
4481
+ } else {
4482
+ let e, t, i;
4483
+ for (let r = 0; !e && r < n.length; r++) {
4484
+ let a = n[r].value;
4485
+ a.kind === 0 ? e = a : a.kind === 1 ? t = a : i = a;
4486
+ }
4487
+ r = e ?? t ?? i;
4488
+ }
4489
+ a.push([H.rangeToString(e.value.range, t), r.index]);
4490
+ }
4491
+ a.length > 0 ? e.directStyles = a : delete e.directStyles;
4492
+ }
4493
+ })(W), vt && ((e, t, n) => {
4494
+ if (!t || t.size === 0 || !n) return;
4495
+ let r = (e) => {
4496
+ if (e === void 0 || e === 0) return null;
4497
+ let r = t.get(e);
4498
+ return r === void 0 ? null : n.controls[r] ?? null;
4499
+ };
4500
+ for (let t of e.sheets ?? []) {
4501
+ let e = _(t);
4502
+ if (!e) continue;
4503
+ let n = /* @__PURE__ */ new Map();
4504
+ for (let t of e.directStyles ?? []) {
4505
+ let e = Array.isArray(t) ? t[0] : t.r, i = r(Array.isArray(t) ? t[1] : t.v);
4506
+ if (!i) continue;
4507
+ let a = JSON.stringify(i), o = n.get(a);
4508
+ o || (o = {
4509
+ control: i,
4510
+ addresses: []
4511
+ }, n.set(a, o)), Kr(e, o.addresses);
4512
+ }
4513
+ if (n.size === 0) continue;
4514
+ let i = [...e.cellControls ?? []];
4515
+ for (let { control: e, addresses: t } of n.values()) i.push({
4516
+ r: t.join(","),
4517
+ v: e
4518
+ });
4519
+ e.cellControls = i;
4520
+ }
4521
+ })(W, vt, r("featurePropertyBag", t, e, O, D, z).values().next().value?.featurePropertyBag);
4522
+ {
4523
+ let n = /* @__PURE__ */ new Map();
4524
+ r("slicers", t, e, O, D, z).forEach((e, t) => {
4525
+ e?.slicers && n.set(t, e.slicers);
4526
+ }), _t(W, {
4527
+ warn: (e, t) => {
4528
+ re(e, "xl/slicers", t);
4529
+ },
4530
+ markAbsorbed: M,
4531
+ slicerParts: n
4532
+ });
4533
+ }
4534
+ W.calc = {
4535
+ ...W.calc ?? {},
4536
+ legacyIntersect: !0
4537
+ }, Be.length > 0 && (W.strings = Be);
4538
+ let yt = Me.toJSON();
4539
+ yt && yt.length > 0 && (W.people = yt);
4540
+ let bt = j.getEntry("xl/vbaProject.bin");
4541
+ if (bt) try {
4542
+ let { VBAProject: e } = await import("./D2872f7aTugYxhht.mjs"), t = e.extract(bt);
4543
+ if (t) {
4544
+ let n = /* @__PURE__ */ new Map();
4545
+ for (let e of W.sheets ?? []) {
4546
+ let t = _(e), r = t?.codeName;
4547
+ r && n.set(r, t);
4548
+ }
4549
+ for (let r of t.modules) {
4550
+ let t = { language: "vba" }, { header: i, body: a } = e.splitAttributes(r.code);
4551
+ a && (t.source = a), i && (t.sourceHeader = i);
4552
+ let o = r.type === "document" ? n.get(r.name) : void 0;
4553
+ o || r.type !== "document" || (t.scope = "workbook");
4554
+ let s = o ? o.modules ??= {} : W.modules ??= {};
4555
+ s[r.name] || (s[r.name] = t);
4556
+ }
4557
+ s?.(t);
4558
+ } else ne.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
4559
+ } catch (e) {
4560
+ ne.push([`Error extracting VBA: ${e?.message ?? e}`, "xl/vbaProject.bin"]);
4561
+ }
4562
+ let jt = E.get("calcId"), Mt = jt === void 0 || !(Number(jt) >= 191029), Nt = h.calcOnLoad ?? (p === "auto" && Mt ? "full" : p), Pt = {
4563
+ ...h,
4564
+ calcOnLoad: Nt,
4565
+ resources: v,
4566
+ json: W
4567
+ };
4568
+ if (Pt.disableLoadAutoFit === void 0) {
4569
+ let e = E.get(Ie);
4570
+ Pt.disableLoadAutoFit = !!e?.declared && e.normalIsThemeFont && await we(e.faces);
4571
+ }
4572
+ x?.mark("json-assembled");
4573
+ let Ft = new ht(Pt);
4574
+ if (x?.mark("workbook-constructed"), me.forEach((e) => {
4575
+ e.deleteReference(pe);
4576
+ }), le.endPersist(), te) {
4577
+ g(Ft);
4578
+ let e = /* @__PURE__ */ new Map(), t = 0;
4579
+ for (let n of j.getNames()) {
4580
+ let r = j.getEntry(n);
4581
+ if (!r) continue;
4582
+ let i = j.getRawEntry(n), a = i ? {
4583
+ data: r,
4584
+ uncompressedSize: j.uncompressedSize(n),
4585
+ raw: {
4586
+ compressedData: i.data,
4587
+ compressionMethod: i.compressionMethod,
4588
+ signature: i.signature
4589
+ }
4590
+ } : {
4591
+ data: r,
4592
+ uncompressedSize: j.uncompressedSize(n)
4593
+ };
4594
+ e.set(n, a), t += r.byteLength;
4595
+ }
4596
+ if (t > 67108864) ne.push([`Source package too large to retain (${t} bytes, limit ${i}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
4597
+ else if (e.size > 0) {
4598
+ let t = new ye(e, ve);
4599
+ b(Ft, t);
4600
+ let n = Ft.getWorksheets().getItems(), r = Ft.getTransactions().addListener({ onCommitEnd: (e) => {
4601
+ let n = e.getOperation()?.name;
4602
+ n !== "insertCells" && n !== "deleteCells" || t.markStructuralChange();
4603
+ } }), i = Ft.addListeners({ onSheetsChange: () => {
4604
+ let e = Ft.getWorksheets().getItems();
4605
+ (e.length !== n.length || e.some((e, t) => e !== n[t])) && t.markStructuralChange(), n = e;
4606
+ } });
4607
+ Ft.addListeners({ onClose: () => {
4608
+ r(), i(), g(Ft);
4609
+ } });
4610
+ }
4611
+ }
4612
+ if (ne.length && C?.onWarning) {
4613
+ let e = /* @__PURE__ */ new Set();
4614
+ for (let t of ne) {
4615
+ let [n, r, i] = t, a = i ?? n;
4616
+ e.has(a) || (e.add(a), C.onWarning(n, r));
4617
+ }
4618
+ }
4619
+ return x && !0 === u && console.table(x.toTable()), await Ft.whenFontsReady(), Ft;
4620
+ } catch (e) {
4621
+ let t = "Unable to parse XLSX.";
4622
+ throw e instanceof st && (t = "Unable to open XLSX. There are too many rows or columns."), Error(t, { cause: e });
4623
+ } finally {
4624
+ await j.close().catch(() => {});
4625
+ }
4626
+ };
4627
+ export { dr as a, kr as i, Gr as n, Nr as r, ti as readXLSX, Xr as t };