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

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