UNPKG

@sheetxl/io

Version:

IO - Import/Export Libraries for SheetXL.

1,186 lines 77.5 kB
/** * @license @sheetxl/io - IO - Import/Export Libraries for SheetXL. - v0.7.5 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */ import { CommonUtils as t } from "@sheetxl/utils"; import { p as e, t as s, a as r, b as o, c as i, d as n, r as l } from "./CaMMfYYKHYs03fiz.mjs"; import { IFont as a, IAutoFilter as c, Sort as u, IRange as h, AddressUtils as p, IFill as g, IBorder as d, IStyle as m, ITextFrame as b, FormulaError as f } from "@sheetxl/sdk"; class A { constructor(t2) { this.list = t2; } get length() { return this.list.length; } item(t2) { return this.list[t2]; } forEach(t2, e2) { for (let e3 = 0; e3 < this.list.length; e3++) t2(this.list[e3], e3, this); } } const y = (t2) => true === t2 || "1" === t2 || "on" === t2 || "true" === t2 || false !== t2 && "0" !== t2 && "off" !== t2 && "false" !== t2 && null, v = (t2) => { const e2 = parseInt(t2); return isNaN(e2) ? null : e2; }, F = (t2) => { const e2 = parseFloat(t2); return isNaN(e2) ? null : e2; }, C = /* @__PURE__ */ new Map(); class w { constructor(t2, e2, s2, r2, o2, i2 = null, n2) { const l2 = (t3, e3, s3) => n2?.getRef?.(t3, e3, s3, n2?.parsedRefs), a2 = (t3) => n2?.getRefs?.(t3, n2?.parsedRefs); this._parent = t2, this.sharedShared = e2, this.currentPath = s2, this.elemRoot = r2, this.jsonRoot = o2, t2 ? (this._fileLocation = t2._fileLocation, this._getRef = t2._getRef, this._getRefs = t2._getRefs) : (i2 && (this._fileLocation = i2), l2 && a2 && (this._getRef = l2), a2 && (this._getRefs = a2), this._onWarning = n2?.onWarning, this._addPerson = n2?.addPerson); } getRef(t2, e2 = false) { return this._getRef?.(t2, this._fileLocation, e2) ?? null; } getRelationships() { return this._getRefs(this._fileLocation) ?? C; } getPath() { return this.currentPath; } getElemRoot() { return this.elemRoot; } getJsonRoot() { return this.jsonRoot; } warn(t2) { this._onWarning ? this._onWarning(t2) : this._parent ? this._parent?.warn?.(t2) : console.warn(t2); } addPerson(t2) { return this._addPerson ? this._addPerson(t2) : this._parent ? this._parent?._addPerson?.(t2) : null; } getVisitorParamsState() { return this.sharedShared.getVisitorParamsState(); } evaluate(t2, e2) { if (!t2) return e2; let s2 = [e2]; const r2 = t2.split("/"); for (let t3 = 0; t3 < r2.length; t3++) { const e3 = r2[t3]; if ("" === e3 || "." === e3) continue; let o2 = []; for (let t4 = 0; t4 < s2.length; t4++) { const r3 = s2[t4], i2 = r3.childNodes; for (let t5 = 0; i2 && t5 < i2.length; t5++) { const s3 = r3.childNodes[t5]; s3.localName !== e3 && "*" !== e3 || o2.push(s3); } } s2 = o2; } return 1 === s2.length ? s2[0] : 0 === s2.length ? null : new A(s2); } getFromPath(e2, s2) { return t.getFromPath(e2, s2); } setToPath(e2, s2, r2) { return t.setToPath(e2, s2, r2); } getValAttrAsString(t2, e2) { let s2 = this.evaluate(t2, e2); return s2 && s2.hasAttribute("val") ? s2.getAttribute("val") ?? null : null; } getValAttrAsBoolean(t2, e2, s2 = false) { let r2 = this.evaluate(t2, e2); if (!r2) return null; const o2 = r2.hasAttribute("val") ? r2.getAttribute("val") : void 0; return null == o2 ? s2 : "1" === o2 || "on" === o2 || "true" === o2 || "0" !== o2 && "off" !== o2 && "false" !== o2 && s2; } getValAttrAsInteger(t2, e2) { let s2 = this.evaluate(t2, e2); return s2 && s2.hasAttribute("val") ? parseInt(s2.getAttribute("val")) ?? null : null; } getValAttrAsFloat(t2, e2) { let s2 = this.evaluate(t2, e2); return s2 && s2.hasAttribute("val") ? parseFloat(s2.getAttribute("val")) ?? null : null; } get BOOLEAN_COPY() { return y; } get INT_COPY() { return v; } get FLOAT_COPY() { return F; } copyFromAttribute(t2, e2, s2, r2 = e2, o2 = null) { if (!t2 || !s2 || !t2.hasAttribute(e2)) return; let i2 = t2.getAttribute(e2); if (o2) if (Array.isArray(o2)) for (let t3 = 0; t3 < o2.length; t3++) { if (null == i2) return; if (i2 = o2[t3](i2), null == i2) return; } else { if (null == i2) return; if (i2 = o2(i2), null == i2) return; } this.setToPath(s2, r2, i2); } } class P { constructor(t2) { this.jsonKey = t2; } visit(t2, e2, s2) { const r2 = {}; return s2[this.jsonKey] = r2, r2; } } class N { visit(t2, e2, s2) { if (!e2) return; const r2 = e2.childNodes; for (let e3 = 0; e3 < r2.length; e3++) { const o2 = r2.item(e3); 1 === o2.nodeType && "Relationship" === o2.localName && this.processRelationship(t2, o2, s2); } return s2; } processRelationship(t2, e2, s2) { const r2 = {}; t2.copyFromAttribute(e2, "Target", r2, "target"), t2.copyFromAttribute(e2, "Type", r2, "type"), t2.copyFromAttribute(e2, "TargetMode", r2, "targetMode"); s2[e2.getAttribute("Id")] = r2; } } const O = (s2, r2) => { if (s2 || !s2.hasAttribute("rot")) return; const o2 = s2.getAttribute("rot"), i2 = t.roundAccurately(e(o2), 2); -1e3 !== i2 && (r2.rotation = i2); }, T = (t2, e2, s2, r2, o2) => { const i2 = t2.getValAttrAsString(r2, e2); null !== i2 && (s2[o2] = i2); }, V = (t2, e2, s2, r2, o2 = r2, i2 = null) => { const n2 = t2.getValAttrAsBoolean(r2, e2, i2); null !== n2 && (s2[o2] = n2); }, S = (t2, e2, s2, r2, o2) => { const i2 = t2.getValAttrAsInteger(r2, e2); null !== i2 && (s2[o2] = i2); }, x = (t2, e2, s2, r2, o2, i2 = 1) => { const n2 = t2.getValAttrAsFloat(r2, e2); null !== n2 && (s2[o2] = n2 * i2); }; class k { visit(t2, e2, s2) { return V(t2, e2, s2, "roundedCorners", "roundedCorners"), S(t2, e2, s2, ".//AlternateContent/Fallback/style", "styleId"), s2.range = null, s2; } afterVisit(t2, e2, s2) { let r2 = {}; s2.types = r2; let o2 = {}, i2 = 0, n2 = {}, l2 = 0, a2 = t2.getVisitorParamsState().get("axes"); const c2 = t2.getVisitorParamsState().get("types"); for (let t3 = 0; t3 < c2.length; t3++) { const e3 = c2[t3]; if (e3.xAxisId) { const r3 = e3.xAxisId, n3 = a2.get(r3); o2[t3 + ""] = n3, e3.offsetXAxis = t3, delete e3.xAxisId, s2.xAxes = o2, o2.length = ++i2; } if (e3.yAxisId) { const r3 = e3.yAxisId, o3 = a2.get(r3); n2[t3 + ""] = o3, e3.offsetYAxis = t3, delete e3.yAxisId, s2.yAxes = n2, n2.length = ++l2; } r2[t3 + ""] = e3; } r2.length = c2.length; const u2 = t2.getVisitorParamsState().get("series"); if (!u2 || 0 === u2.length) return; const h2 = {}; s2.series = h2; for (let t3 = 0; t3 < u2.length; t3++) h2[t3 + ""] = u2[t3]; h2.length = u2.length; } } class L { visit(t2, e2, s2) { return V(t2, e2, s2, "plotVisOnly", "plotVisOnly"), T(t2, e2, s2, "dispBlanksAs", "dispBlanksAs"), V(t2, e2, s2, ".//extLst/ext/dataDisplayOptions16/dispNaAsBlank", "dispNaAsBlank"), V(t2, e2, s2, "showDLblsOverMax", "showDLblsOverMax"), s2; } afterVisit(t2, e2, s2) { try { const r2 = t2.getValAttrAsBoolean("autoTitleDeleted", e2), o2 = t2.evaluate("title", e2); t2.setToPath(s2, "title.shown", !(true === r2 || !o2)); const i2 = t2.evaluate("legend", e2); t2.setToPath(s2, "legend.shown", null !== i2); } catch (t3) { throw new Error("Unexpected Error parsing Chart: " + t3); } } } class I { visit(t2, e2, s2) { let r2 = {}; return s2.plotArea = r2, r2; } } class B { EnumMappings() { } static fromOoxmlGradientType(t2) { return "circle" === t2 ? "radial" : t2; } static fromOoxmlLineCap(t2) { if ("rnd" === t2) return "round"; if ("flat" === t2) return "butt"; if ("sq" === t2) return "square"; throw new Error("Invalid lineCap type: " + t2); } static fromOoxmlCompound(t2) { return "sng" === t2 ? "single" : t2; } static fromOoxmlAlignment(t2) { return "ctr" === t2 ? "center" : t2; } } class _ { visit(t2, e2, s2) { } processStroke(t2, e2, o2) { const i2 = {}, n2 = t2.evaluate("ln", e2); if (n2) { n2.hasAttribute("algn") && (i2.align = B.fromOoxmlAlignment(n2.getAttribute("algn"))), n2.hasAttribute("cap") && (i2.lineCap = B.fromOoxmlLineCap(n2.getAttribute("cap"))), n2.hasAttribute("cmpd") && (i2.compound = B.fromOoxmlCompound(n2.getAttribute("cmpd"))), n2.hasAttribute("w") && (i2.width = s(n2.getAttribute("w"))); const e3 = t2.evaluate("miter", n2); e3 && (i2.lineJoin = "miter", e3.hasAttribute("lim") && (i2.miter = parseFloat(e3.getAttribute("lim")))); t2.evaluate("bevel", n2) && (i2.lineJoin = "bevel"); t2.evaluate("round", n2) && (i2.lineJoin = "round"); const l2 = t2.evaluate("custDash", n2); if (l2) { const e4 = t2.evaluate("ds", l2); if (e4 && e4.length > 0) { let t3 = ""; for (let s2 = 0; s2 < e4.length; s2++) { const o3 = e4.item(s2); t3 += r(o3.getAttribute("d")) + "," + r(o3.getAttribute("sp")); } i2.dash = t3; } } const a2 = t2.evaluate("prstDash", n2); a2 && a2.hasAttribute("val") && (i2.dash = a2.getAttribute("val")), this.parseEndElement(t2, n2, i2, "headEnd", "head"), this.parseEndElement(t2, n2, i2, "tailEnd", "tail"); const c2 = this.processFill(t2, n2, o2); i2.fill = c2; } return i2; } parseEndElement(t2, e2, s2, r2, o2) { const i2 = t2.evaluate(r2, e2); if (i2 && (i2.hasAttribute("type") && (s2[o2 + "Type"] = i2.getAttribute("type")), i2.hasAttribute("len") || i2.hasAttribute("w"))) { const t3 = i2.getAttribute("len") ? i2.getAttribute("len") : "med", e3 = i2.getAttribute("w") ? i2.getAttribute("w") : "med"; s2[o2 + "Size"] = t3 + "-" + e3; } } processFill(t2, e2, s2) { const r2 = {}; if (t2.evaluate("noFill", e2)) return r2.none = true, r2; const i2 = t2.evaluate("solidFill", e2); if (i2) { const e3 = this.processAdjColor(t2, i2); return e3 && (r2.solid = e3), r2; } const n2 = t2.evaluate("gradFill", e2); if (n2) { n2.hasAttribute("rotWithShape") && (r2.isRotated = "1" === n2.getAttribute("rotWithShape")); const e3 = this.processGradFill(t2, n2); return r2.gradient = e3, r2; } const l2 = t2.evaluate("pattFill", e2); if (l2) { const e3 = this.processPatternFill(t2, l2); return r2.pattern = e3, r2; } const a2 = t2.evaluate("blipFill", e2); if (a2) { a2.hasAttribute("rotWithShape") && (r2.isRotated = o(a2.getAttribute("rotWithShape"))), a2.hasAttribute("dpi") && (r2.dpi = a2.getAttribute("dpi")); const e3 = this.processImageFill(t2, a2); return r2.image = e3, r2; } return r2.none = true, r2; } processGradFill(t2, s2) { const i2 = {}, n2 = t2.evaluate("lin", s2); if (n2) { if (i2.type = "linear", n2.hasAttribute("ang")) { const t3 = e(n2.getAttribute("ang")); i2.angle = t3; } if (n2.hasAttribute("scaled")) { const t3 = o(n2.getAttribute("scaled")); i2.scaled = t3; } } const l2 = {}; s2.hasAttribute("flip") && (l2.mirror = s2.getAttribute("flip")), Object.keys(l2).length > 0 && (i2.tile = l2); const a2 = t2.evaluate("path", s2); if (a2) { a2.hasAttribute("path") && (i2.type = B.fromOoxmlGradientType(a2.getAttribute("path"))); const e2 = t2.evaluate("fillToRect", a2); e2 && (i2.fillTo = this.getRect(e2)); } const c2 = t2.evaluate("tileRect", s2); c2 && (i2.tile.bounds = this.getRect(c2)); const u2 = [], h2 = t2.evaluate("gsLst/gs", s2); for (let e2 = 0; h2 && e2 < h2.length; e2++) { const s3 = h2.item(e2), o2 = { offset: r(s3.getAttribute("pos")), color: this.processAdjColor(t2, s3) }; u2.push(o2); } return u2.length > 0 && (i2.stops = u2), i2; } getRect(t2) { const e2 = {}; return t2.hasAttribute("t") && (e2.t = r(t2.getAttribute("t"))), t2.hasAttribute("l") && (e2.l = r(t2.getAttribute("l"))), t2.hasAttribute("b") && (e2.b = r(t2.getAttribute("b"))), t2.hasAttribute("r") && (e2.r = r(t2.getAttribute("r"))), 0 === Object.keys(e2).length ? null : e2; } processImageFill(t2, e2) { const s2 = { ref: "https://www.sheetxl.com/logo-color-padded-white.jpg", tile: false }; return s2; } processPatternFill(t2, e2) { const s2 = {}, r2 = e2.getAttribute("prst"); s2.type = r2; const o2 = t2.evaluate("bgClr", e2); if (o2) { const e3 = this.processAdjColor(t2, o2); e3 && (s2.background = e3); } const i2 = t2.evaluate("fgClr", e2); if (i2) { let e3 = this.processAdjColor(t2, i2); e3 && (s2.foreground = e3); } return s2; } processAdjColor(t2, e2) { const s2 = t2.evaluate("hslClr", e2); if (s2) return this.processHslClr(t2, s2); const r2 = t2.evaluate("prstClr", e2); if (r2) return this.processClrWithValAttribute(t2, r2); const o2 = t2.evaluate("schemeClr", e2); if (o2) return this.processClrWithValAttribute(t2, o2); const i2 = t2.evaluate("sysClr", e2); if (i2) { return this.processClrWithValAttribute(t2, i2); } const n2 = t2.evaluate("scrgbClr", e2); if (n2) return this.processScrgbClrElement(t2, n2); const l2 = t2.evaluate("srgbClr", e2); return l2 ? this.processSrgbClrElement(t2, l2) : null; } processScrgbClrElement(t2, e2) { let s2 = "lrgba(" + r(e2.getAttribute("r")) + "," + r(e2.getAttribute("g")) + "," + r(e2.getAttribute("b")) + ")"; return s2 += this.processAdjustments(t2, e2), s2; } processSrgbClrElement(t2, e2) { let s2 = e2.getAttribute("val"); return s2 += this.processAdjustments(t2, e2), s2; } processHslClr(t2, s2) { let o2 = "hsl(" + e(s2.getAttribute("hue")) + "," + r(s2.getAttribute("sat")) + "," + r(s2.getAttribute("lum")) + ")"; return o2 += this.processAdjustments(t2, s2), o2; } processClrWithValAttribute(t2, e2) { const s2 = e2.getAttribute("val"); if (!s2) return; let r2 = s2; return r2 += this.processAdjustments(t2, e2), r2; } processAdjustments(t2, e2) { let s2 = ""; const r2 = e2.childNodes; for (let o2 = 0; o2 < r2.length; o2++) { const i2 = r2.item(o2); if (1 === i2.nodeType) { let r3 = i2.localName; s2 += "hue" === r3 || "hueOff" === r3 || "hueMod" === r3 ? this.processAdjustmentElement(t2, e2, r3, 6e4) : "gray" === r3 || "comp" === r3 || "inv" === r3 || "gamma" === r3 || "invGamma" === r3 ? this.processAdjustmentElement(t2, e2, r3, 1) : this.processAdjustmentElement(t2, e2, r3); } } return s2; } processAdjustmentElement(t2, e2, s2, r2 = 1e3) { const o2 = t2.evaluate(s2, e2); if (!o2) return ""; const i2 = o2.getAttribute("val"); if (!i2) return ` ${s2}`; return ` ${s2} ${!i2 || parseFloat(i2) / r2}`; } } class j extends _ { visit(t2, e2, s2) { try { const r2 = t2.evaluate("xfrm", e2); if (r2) { O(r2, s2); const e3 = { x: 0, y: 0, width: 0, height: 0 }, o3 = t2.evaluate("off", r2); o3 && (e3.x = i(o3.getAttribute("x")) ?? 0, e3.y = i(o3.getAttribute("y")) ?? 0); const n3 = t2.evaluate("ext", r2); o3 && (e3.width = i(n3.getAttribute("cx")) ?? 0, e3.height = i(n3.getAttribute("cy")) ?? 0), s2.bounds = e3; } const o2 = t2.evaluate("prstGeom", e2); if (o2?.hasAttribute("prst")) s2.geometry = o2?.getAttribute("prst"); else { t2.evaluate("customGeom", e2) && console.warn("customGeom not supported yet"); } const n2 = this.processFill(t2, e2, s2); n2 && Object.keys(n2).length > 0 && (s2.fill = n2); const l2 = this.processStroke(t2, e2, s2); return l2 && Object.keys(l2).length > 0 && (s2.stroke = l2), s2; } catch (t3) { throw console.warn(t3), new Error("Unexpected Error parsing Shape Properties element"); } } } class R { visit(t2, e2, s2) { let r2 = {}; if (T(t2, e2, r2, "grouping", "grouping"), V(t2, e2, r2, "varyColors", "varyColors"), x(t2, e2, r2, "gapWidth", "gapWidth", 0.01), x(t2, e2, r2, "overlap", "overlap", 0.01), this.parseType(t2, e2, r2), S(t2, e2, r2, "bubbleScale", "bubbleScale"), V(t2, e2, r2, "showNegBubbles", "showNegativeBubbleValues"), V(t2, e2, r2, "sizeRepresents", "bubbleSizeRepresentsWidth"), S(t2, e2, r2, "firstSliceAng", "startAngle"), S(t2, e2, r2, "holeSize", "holeSize"), T(t2, e2, r2, "scatterStyle", "scatterStyle"), this.parseAxisIds(t2, e2, r2), Object.keys(r2).length > 0) { let e3 = t2.getVisitorParamsState().get("types"); e3 || (e3 = [], t2.getVisitorParamsState().set("types", e3)), e3.push(r2); } return r2; } parseType(t2, e2, s2) { switch (e2.localName) { case "areaChart": s2.type = "area"; break; case "bubbleChart": s2.type = "bubble"; break; case "doughnutChart": case "ofPieType": case "pieChart": s2.type = "pie"; break; case "lineChart": s2.type = "line"; break; case "scatterChart": s2.type = "scatter"; } } parseAxisIds(t2, e2, s2) { const r2 = t2.evaluate("axId", e2); if (!r2 || 0 === r2.length) return; const o2 = r2.item(0).getAttribute("val"); s2.xAxisId = o2; const i2 = r2.item(1).getAttribute("val"); s2.yAxisId = i2; } } class E extends R { parseType(t2, e2, s2) { const r2 = t2.getValAttrAsString("barDir", e2); r2 && (s2.type = "col" === r2 ? "column" : "bar"); } } class Y { constructor(t2) { this.jsonKey = t2; } visit(t2, e2, s2) { let r2 = {}, o2 = r2, i2 = t2.getValAttrAsString("idx", e2); null !== i2 && (o2 = {}, o2[i2] = r2); const n2 = t2.getValAttrAsBoolean("delete", e2); this.parseNumFormat(t2, e2, r2), true === n2 ? (r2.showBubbleSize = false, r2.showCatName = false, r2.showLeaderLines = false, r2.showPercentage = false, r2.showSerName = false, r2.showVal = false, r2.showLegendKey = false) : (V(t2, e2, r2, "showBubbleSize", "showBubbleSize"), V(t2, e2, r2, "showCatName", "showCatName"), V(t2, e2, r2, "showLeaderLines", "showLeaderLines"), V(t2, e2, r2, "showPercent", "showPercentage"), V(t2, e2, r2, "showSerName", "showSerName"), V(t2, e2, r2, "showVal", "showVal"), V(t2, e2, r2, "showLegendKey", "showLegendKey")); const l2 = t2.evaluate("separator", e2); return null !== l2 && (r2.separator = l2.textContent), T(t2, e2, r2, "dLblPos", "position"), s2[this.jsonKey] = o2, r2; } parseNumFormat(t2, e2, s2) { const r2 = t2.evaluate("numFmt", e2); if (r2) { const t3 = r2.getAttribute("formatCode"); s2.formatCode = t3, r2.hasAttribute("sourceLinked") && (s2.sourceLinked = "1" === r2.getAttribute("sourceLinked")); } } } const D = (t2, e2, s2) => { if (true === t2.getValAttrAsBoolean("invertIfNegative", e2)) { if (t2.evaluate("extLst/ext/invertSolidFillFmt", e2)) { if (s2.fill && s2.fillNegative) { const e3 = t2.getFromPath(s2, "fill.solid.adjs"); e3 && t2.setToPath(s2, "fillNegative.solid.adjs", e3); } } else { const t3 = { val: "FFFFFF" }, e3 = {}; e3.solid = t3, s2.fillNegative = e3; const r2 = { val: "000000" }, o2 = {}; o2.solid = r2; const i2 = {}; i2.fill = o2, s2.strokeNegative = i2; } } }; class M { visit(t2, e2, s2) { const r2 = {}; S(t2, e2, r2, "explosion", "explosion"); let o2 = t2.evaluate("cat/*/f", e2); o2 || (o2 = t2.evaluate("xVal/*/f", e2)); let i2 = null; null !== o2 && null !== o2.firstChild && (i2 = o2.firstChild.nodeValue), o2 || (o2 = t2.evaluate("cat/strLit", e2), o2 || (o2 = t2.evaluate("cat/numLit", e2)), o2 && (i2 = this.parsePointsAsString(t2, o2))), null !== i2 && (r2.xRange = i2); let n2 = t2.evaluate("val/*/f", e2); n2 || (n2 = t2.evaluate("yVal/*/f", e2)); let l2 = null; n2 && n2.firstChild && (l2 = n2.firstChild.nodeValue), n2 || (n2 = t2.evaluate("val/numLit", e2), null !== n2 && (l2 = this.parsePointsAsString(t2, n2))), null !== l2 && (r2.valRange = l2), this.parseTitleRangeOrValue(t2, e2, r2), S(t2, e2, r2, "idx", "idx"), V(t2, e2, r2, "smooth", "smooth"); const a2 = t2.getVisitorParamsState().get("types").length - 1; r2.offsetChart = a2; let c2 = t2.getVisitorParamsState().get("series"); return c2 || (c2 = [], t2.getVisitorParamsState().set("series", c2)), c2.push(r2), r2; } parseTitleRangeOrValue(t2, e2, s2) { const r2 = t2.evaluate("tx/strRef/f", e2); if (null !== r2) { const e3 = r2.firstChild.nodeValue; t2.setToPath(s2, "title.range", e3); } else { const r3 = t2.evaluate("tx/v", e2); null !== r3 && t2.setToPath(s2, "title.text.simpleRun", r3.firstChild.nodeValue); } } parsePointsAsString(t2, e2) { let s2 = "{"; const r2 = t2.getValAttrAsInteger("ptCount", e2), o2 = t2.evaluate("pt", e2), i2 = []; for (let s3 = 0; o2 && r2 && s3 < r2; s3++) { let r3 = null, o3 = t2.evaluate("pt[@idx='" + s3 + "']/v", e2); o3 instanceof Node && (r3 = o3.textContent), i2[s3] = r3; } for (let t3 = 0; t3 < i2.length; t3++) t3 > 0 && (s2 += ","), void 0 !== i2[t3] && (s2 += i2[t3]); return s2 += "}", s2; } afterVisit(t2, e2, s2) { D(t2, e2, s2); let r2 = t2.getFromPath(s2, "points"); if (r2) { const e3 = Object.keys(r2); for (let o2 = 0; o2 < e3.length; o2++) { const i2 = e3[o2], n2 = t2.getFromPath(r2, i2); if (!n2) continue; let l2 = t2.getFromPath(n2, "markers"); l2 && (t2.setToPath(s2, "markers.points." + i2, l2), delete n2.markers); } } } } class U { DataPointVisitor() { } visit(t2, e2, s2) { let r2 = t2.getFromPath(s2, "points"), o2 = null; r2 ? o2 = r2 : (o2 = {}, t2.setToPath(s2, "points", o2)); let i2 = {}, n2 = t2.getValAttrAsString("idx", e2); return null !== n2 && (o2[n2] = i2), V(t2, e2, i2, "bubble3D", "bubble3D"), S(t2, e2, i2, "explosion", "explosion"), D(t2, e2, i2), i2; } } class z { visit(t2, e2, s2) { const r2 = e2.parentNode.localName; if ("ser" === r2 || "dPt" === r2) { const r3 = {}, o2 = t2.getValAttrAsString("size", e2); null !== o2 && (r3.size = o2); const i2 = t2.getValAttrAsString("symbol", e2); return i2 && (r3.type = i2), s2.markers = r3, r3; } return null; } } class G { visit(t2, e2, s2) { let r2 = {}; this.parseScaling(t2, e2, r2), x(t2, e2, r2, "majorUnit", "majorUnits"), x(t2, e2, r2, "minorUnit", "minorUnits"), V(t2, e2, r2, "delete", "shown"), this.parseOrientation(t2, e2, r2), this.parseNumFormat(t2, e2, r2), T(t2, e2, r2, "majorTickMark", "majorTickMarks"), T(t2, e2, r2, "minorTickMark", "minorTickMarks"), T(t2, e2, r2, "crosses", "crosses"), x(t2, e2, r2, "crossesAt", "crosses"), T(t2, e2, r2, "crossBetween", "crossBetween"), this.parseLabelAlign(t2, e2, r2), S(t2, e2, r2, "lblOffset", "labelOffset"), T(t2, e2, r2, "tickLblPos", "labelPosition"); const o2 = t2.getValAttrAsInteger("noMultiLvlLbl", e2); r2.labelMultiLevel = null !== o2 && 0 === o2, S(t2, e2, r2, "tickMarkSkip", "tickMarkSkip"), S(t2, e2, r2, "tickLblSkip", "labelInterval"), this.parseDisplayCustOrBuiltInUnit(e2, t2, r2), this.parseTimeUnits(t2, e2, r2, "majorUnitDates", "majorTimeUnit", "majorUnit"), this.parseTimeUnits(t2, e2, r2, "minorUnitDates", "minorTimeUnit", "minorUnit"), T(t2, e2, r2, "baseTimeUnit", "baseUnitDates"), t2.getVisitorParamsState().get("axes") || t2.getVisitorParamsState().set("axes", /* @__PURE__ */ new Map()); const i2 = t2.getValAttrAsString("axId", e2); return t2.getVisitorParamsState().get("axes").set(i2, r2), r2; } parseTimeUnits(t2, e2, s2, r2, o2, i2) { const n2 = {}; let l2 = t2.getValAttrAsString(o2, e2); if (null !== l2) { n2.dem = l2; let s3 = t2.getValAttrAsString(i2, e2); n2.amt = s3; } Object.keys(n2).length > 0 && (s2[r2] = n2); } parseDisplayCustOrBuiltInUnit(t2, e2, s2) { let r2 = e2.getValAttrAsString("dispUnits/builtInUnit", t2); r2 || (r2 = e2.getValAttrAsString("dispUnits/custUnit", t2)), r2 && (s2.displayUnits = r2); } parseLabelAlign(t2, e2, s2) { let r2 = t2.getValAttrAsString("lblAlgn", e2); null !== r2 && ("ctr" === r2 ? s2.labelAlign = "center" : "l" === r2 ? s2.labelAlign = "left" : "r" === r2 && (s2.labelAlign = "right")); } parseOrientation(t2, e2, s2) { const r2 = t2.getValAttrAsString("AxPos", e2); null !== r2 && ("b" === r2 ? s2.orientation = "bottom" : "l" === r2 ? s2.orientation = "left" : "r" === r2 ? s2.orientation = "right" : "t" === r2 && (s2.orientation = "top")); } parseNumFormat(t2, e2, s2) { const r2 = {}, o2 = t2.evaluate("numFmt", e2); null !== o2 && (o2.hasAttribute("formatCode") && (r2.formatCode = o2.getAttribute("formatCode")), o2.hasAttribute("sourceLinked") && (r2.sourceLinked = "1" === o2.getAttribute("sourceLinked"))), Object.keys(r2).length > 0 && (s2.labels = r2); } parseScaling(t2, e2, s2) { const r2 = t2.getValAttrAsString("scaling/orientation", e2); null !== r2 && (s2.inverted = "minMax" !== r2); const o2 = t2.getValAttrAsFloat("scaling/logBase", e2); null !== o2 && (s2.logBase = o2, s2.scaleType = "log"), x(t2, e2, s2, "scaling/max", "max"), x(t2, e2, s2, "scaling/min", "min"); } afterVisit(t2, e2, s2) { s2.fill && s2.labels && (s2.labels.fill = s2.fill, delete s2.fill); let r2 = t2.getValAttrAsBoolean("delete", e2); null !== r2 && (t2.setToPath(s2, "labels.shown", true !== r2), t2.setToPath(s2, "shown", true !== r2)); const o2 = t2.getFromPath(s2, "dispUnits.displayUnitsLabel"); o2 && (t2.setToPath(s2, "displayUnitsLabel", o2), delete s2.dispUnits); const i2 = t2.evaluate("title", e2); t2.setToPath(s2, "title.shown", null !== i2); const n2 = t2.evaluate("minorGridlines", e2); t2.setToPath(s2, "gridLinesMinor.shown", null !== n2); const l2 = t2.evaluate("majorGridlines", e2); t2.setToPath(s2, "gridLinesMajor.shown", null !== l2); } } class W { constructor(t2 = "text") { this._jsonKey = t2; } getTextPath() { return this._jsonKey; } visit(t2, e2, s2) { let r2 = t2.getFromPath(s2, this.getTextPath()); return r2 || (r2 = {}), this.parseTextElement(t2, e2, r2, false), Object.keys(r2).length > 0 && t2.setToPath(s2, this.getTextPath(), r2), s2; } parseTextElement(t2, e2, s2, r2) { const o2 = t2.evaluate("p/pPr/defRPr", e2) ?? t2.evaluate("defRPr", e2); o2 && (this.parseTextProperties(t2, o2, s2), new j().visit(t2, o2, s2)); let i2 = [], n2 = t2.evaluate("p/r", e2) ?? t2.evaluate("r", e2); const l2 = (e3) => { const s3 = {}; let r3 = t2.evaluate("t", e3); const o3 = t2.evaluate("rPr", e3); o3 && this.parseTextProperties(t2, o3, s3), r3 ? s3.text = r3.firstChild.textContent ?? "" : e3.textContent && (s3.text = e3.textContent ?? ""), i2.push(s3); }; if (void 0 !== n2?.length) for (let t3 = 0; n2 && t3 < n2.length; t3++) l2(n2.item(t3)); else l2(n2 || e2); i2.length > 0 && (s2.runs = i2); const a2 = t2.evaluate("bodyPr", e2); a2 && O(a2, s2); } parseTextProperties(t2, e2, s2) { if (!e2) return; e2.hasAttribute("sz") && (s2.size = parseFloat(e2.getAttribute("sz")) / 100), e2.hasAttribute("b") && (s2.weight = "1" === e2.getAttribute("b") ? 700 : 400), e2.hasAttribute("i") && (s2.italic = "1" === e2.getAttribute("i")), e2.hasAttribute("u") && (s2.underline = e2.getAttribute("u")), e2.hasAttribute("strike") && (s2.strike = e2.getAttribute("strike")); const r2 = t2.evaluate("latin", e2); if (r2) { if (!r2.getAttribute("typeface").startsWith("+")) { const t3 = s2.font ?? {}; if (r2.hasAttribute("typeface") && (t3.family = r2.getAttribute("typeface")), r2.hasAttribute("panose")) { const e3 = r2.getAttribute("panose"); e3 && (t3.fallbacks = [a.getPanoseFallback(e3)]); } r2.hasAttribute("pitchFamily") && (t3.pitch = r2.getAttribute("pitchFamily")), r2.hasAttribute("charset") && (t3.charset = r2.getAttribute("charset")), Object.keys(t3).length > 0 && (s2.font = t3); } } } } class X { visit(t2, e2, s2) { let r2 = t2.getVisitorParamsState().get("series")[t2.getValAttrAsInteger("idx", e2)]; if (r2) { let s3 = t2.getFromPath(r2, "title"); s3 || (s3 = {}, t2.setToPath(r2, "title", s3)); let o2 = s3, i2 = t2.getValAttrAsBoolean("delete", e2); return null !== i2 && (o2.shown = !i2), o2; } return s2; } } class $ { visit(t2, e2, s2) { const r2 = {}; return V(t2, e2, r2, "overlay", "overlay"), T(t2, e2, r2, "legendPos", "position"), s2.legend = r2, r2; } } class K extends j { visit(t2, e2, s2) { const r2 = this.processFill(t2, e2, s2); Object.keys(r2).length > 0 && (s2.fillNegative = r2); const o2 = this.processStroke(t2, e2, s2); return Object.keys(o2).length > 0 && (s2.strokeNegative = o2), s2; } } class H extends W { constructor(t2 = "title") { super(t2); } parseTitleRangeOrValue(t2, e2, s2) { let r2 = t2.evaluate("tx/strRef/f", e2) ?? null; if (r2) { const e3 = r2.firstElementChild.nodeValue; t2.setToPath(s2, "range", e3); } } visit(t2, e2, s2) { const r2 = {}; V(t2, e2, r2, "overlay", "overlay"), s2[this._jsonKey] = r2; let o2 = t2.getFromPath(r2, this.getTextPath()); o2 || (o2 = {}), this.parseTitleRangeOrValue(t2, e2, r2); const i2 = t2.evaluate("txPr", e2); i2 && this.parseTextElement(t2, i2, o2, false); const n2 = t2.evaluate("tx/rich", e2); return n2 && this.parseTextElement(t2, n2, o2, true), Object.keys(o2).length > 0 && t2.setToPath(r2, this.getTextPath(), o2), r2; } afterVisit(t2, e2, s2) { if (s2?.text) { const t3 = s2.text?.rotation ?? null; null !== t3 && (s2.rotation = parseInt(t3), delete s2.title.rotation); } } } class J { visit(t2, e2, s2) { const r2 = t2.evaluate("manualLayout", e2); if (r2) { let e3 = {}; x(t2, r2, e3, "x", "x"), x(t2, r2, e3, "y", "y"), x(t2, r2, e3, "w", "w"), x(t2, r2, e3, "h", "h"), T(t2, r2, e3, "xMode", "xMode"), T(t2, r2, e3, "yMode", "yMode"), T(t2, r2, e3, "wMode", "wMode"), T(t2, r2, e3, "hMode", "hMode"), Object.keys(e3).length > 0 && (s2.manualLayout = e3); } return s2; } } class q { visit(t2, e2, s2) { return s2.name = e2.getAttribute("name"), s2; } } class Q extends _ { visit(t2, e2, s2) { const r2 = {}; r2.name = e2.getAttribute("name"); const o2 = e2.childNodes; for (let s3 = 0; s3 < o2.length; s3++) { const i2 = o2.item(s3); if (1 === i2.nodeType) { let s4 = i2.localName; const o3 = t2.evaluate(s4, e2), n2 = this.processAdjColor(t2, o3); r2[s4] = n2; } } return Object.keys(r2).length > 0 && (s2.colors = r2), r2; } } class Z { visit(t2, e2, s2) { const r2 = {}; r2.name = e2.getAttribute("name"); const o2 = t2.evaluate("majorFont", e2), i2 = this.processFontElement(t2, o2, {}); r2.majorFont = i2.family, i2.fallbacks && (r2.majorFallbacks = i2.fallbacks); const n2 = t2.evaluate("minorFont", e2), l2 = this.processFontElement(t2, n2, {}); return r2.minorFont = l2.family, i2.fallbacks && (r2.minorFallbacks = l2.fallbacks), s2.fonts = r2, r2; } processFontElement(t2, e2, s2) { if (!e2) return; const r2 = t2.evaluate("latin", e2); if (!r2) return; const o2 = r2.getAttribute("typeface"); o2 && (s2.family = o2); const i2 = r2.getAttribute("panose"); return i2 && (s2.fallbacks = [a.getPanoseFallback(i2)]), s2; } } class tt { visit(t2, e2, s2) { if (!e2) return; const r2 = {}, o2 = e2.getAttribute("r:id"); if (o2) { const e3 = t2.getRef(o2); "string" == typeof e3 && (r2.address = e3); } return t2.copyFromAttribute(e2, "tooltip", r2), t2.copyFromAttribute(e2, "history", r2, "history", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "tgtFrame", r2, "target"), s2.hyperlink = r2, r2; } } class et { visit(t2, e2, s2) { if (!e2) return; const r2 = {}; return t2.copyFromAttribute(e2, "ref", r2), this.processFilterColumns(t2, e2, r2), Object.keys(r2).length > 0 && (s2.filter = r2), r2; } processColorFilter(t2, e2) { const s2 = { type: c.Type.Color }; return t2.copyFromAttribute(e2, "cellColor", s2, "cellColor", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "dxfId", s2, "styleId", t2.INT_COPY), s2; } processCustomFilter(t2, e2) { const s2 = {}; return t2.copyFromAttribute(e2, "operator", s2, "operator", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "val", s2, "val"), s2; } processCustomFilters(t2, e2) { const s2 = { type: c.Type.Custom }; t2.copyFromAttribute(e2, "and", s2, "and", t2.BOOLEAN_COPY); const r2 = e2.childNodes; s2.filters = []; for (let e3 = 0; e3 < r2.length; e3++) { const o2 = r2.item(e3); if (1 !== o2.nodeType) continue; let i2 = null; "customFilter" === o2.localName && (i2 = this.processCustomFilter(t2, o2)), i2 && s2.filters.push(i2); } return s2; } processDynamicFilter(t2, e2) { const s2 = { type: c.Type.Dynamic }; return t2.copyFromAttribute(e2, "type", s2, "dynamicType"), t2.copyFromAttribute(e2, "val", s2, "val", t2.INT_COPY), t2.copyFromAttribute(e2, "maxVal", s2, "maxVal", t2.INT_COPY), s2; } processDateGroupItem(t2, e2) { const s2 = {}; return t2.copyFromAttribute(e2, "dateTimeGrouping", s2, "group"), t2.copyFromAttribute(e2, "day", s2, "day", t2.INT_COPY), t2.copyFromAttribute(e2, "hour", s2, "hour", t2.INT_COPY), t2.copyFromAttribute(e2, "minute", s2, "minute", t2.INT_COPY), t2.copyFromAttribute(e2, "month", s2, "month", t2.INT_COPY), t2.copyFromAttribute(e2, "second", s2, "second", t2.INT_COPY), t2.copyFromAttribute(e2, "year", s2, "year", t2.INT_COPY), s2; } processFilterItem(t2, e2) { if (e2.hasAttribute("val")) return e2.getAttribute("val"); } processFilters(t2, e2) { const s2 = { type: c.Type.Items }; t2.copyFromAttribute(e2, "blank", s2, "blank", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "calendarType", s2, "calendarType"); let r2 = [], o2 = []; const i2 = e2.childNodes; for (let e3 = 0; e3 < i2.length; e3++) { const s3 = i2.item(e3); if (1 === s3.nodeType) { if ("dateGroupItem" === s3.localName) { const e4 = this.processDateGroupItem(t2, s3); e4 && r2.push(e4); } else if ("filter" === s3.localName) { const e4 = this.processFilterItem(t2, s3); void 0 !== e4 && o2.push(e4); } } } return r2.length > 0 && (s2.dateGroups = r2), o2.length > 0 && (s2.items = o2), s2; } processIcon(t2, e2) { const s2 = { type: c.Type.Icon }; return t2.copyFromAttribute(e2, "iconId", s2, "iconId", t2.INT_COPY), t2.copyFromAttribute(e2, "iconSet", s2), s2; } processTop10(t2, e2) { const s2 = { type: c.Type.Top10 }; return t2.copyFromAttribute(e2, "filterVal", s2, "filterVal", t2.FLOAT_COPY), t2.copyFromAttribute(e2, "percent", s2, "percent", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "top", s2, "top", t2.BOOLEAN_COPY), t2.copyFromAttribute(e2, "val", s2, "val", t2.FLOAT_COPY), s2; } processFilterCriteria(t2, e2, s2) { if (!e2) return; const r2 = e2.childNodes, o2 = []; for (let e3 = 0; e3 < r2.length; e3++) { const s3 = r2.item(e3); if (1 !== s3.nodeType) continue; let i2 = null; "colorFilter" === s3.localName ? i2 = this.processColorFilter(t2, s3) : "customFilters" === s3.localName ? i2 = this.processCustomFilters(t2, s3) : "dynamicFilter" === s3.localName ? i2 = this.processDynamicFilter(t2, s3) : "filters" === s3.localName ? i2 = this.processFilters(t2, s3) : "iconFilter" === s3.localName ? i2 = this.processIcon(t2, s3) : "top10" === s3.localName && (i2 = this.processTop10(t2, s3)), i2 && o2.push(i2); } return o2.length > 0 && (s2.criteria = o2), o2; } processFilterColumn(t2, e2) { if (!e2) return null; const s2 = {}; if (!e2.hasAttribute("colId")) return; s2.offset = parseInt(e2.getAttribute("colId")); let r2 = false; return e2.hasAttribute("hiddenButton") && (r2 = o(e2.getAttribute("hiddenButton"))), r2 && (s2.hiddenButton = true), e2.hasAttribute("showButton") && (s2.showButton = o(e2.getAttribute("showButton"))), this.processFilterCriteria(t2, e2, s2), s2; } processFilterColumns(t2, e2, s2) { if (!e2) return; const r2 = e2.childNodes, o2 = []; for (let e3 = 0; e3 < r2.length; e3++) { const s3 = r2.item(e3); if (1 === s3.nodeType && "filterColumn" === s3.localName) { const e4 = this.processFilterColumn(t2, s3); e4 && o2.push(e4); } } return o2.length > 0 && (s2.fields = o2), o2; } } class st { visit(t2, e2, s2) { if (!e2) return; const r2 = {}; if (t2.copyFromAttribute(e2, "ref", r2), e2.hasAttribute("caseSensitive")) { const t3 = o(e2.getAttribute("caseSensitive")); r2.collatorOptions = t3 ? u.CaseSensitiveOptions : u.CaseInsensitiveOptions; } const i2 = e2.getAttribute("sortMethod"); if (null != i2 && "none" !== i2 && ("stroke" === i2 ? r2.collatorOptions = { ...r2.collatorOptions, collation: "stroke" } : "pinYin" === i2 && (r2.collatorOptions = { ...r2.collatorOptions, collation: "pinyin" })), e2.hasAttribute("columnSort")) { o(e2.getAttribute("columnSort")) && (r2.orientation = h.Orientation.Column); } const n2 = p.fastStringToRange(r2.ref); return this.processSortConditions(t2, e2, r2, n2), Object.keys(r2).length > 0 && (s2.sort = r2), r2; } processSortCondition(t2, e2, s2) { if (!e2) return null; const r2 = {}; if (e2.hasAttribute("ref")) { if (e2.hasAttribute("ref")) { const t3 = e2.getAttribute("ref"), o2 = p.fastStringToRange(t3); r2.offset = s2 ? o2.colStart - s2.colStart : o2.colStart; } return r2.reverse = false, e2.hasAttribute("descending") && (r2.reverse = o(e2.getAttribute("descending"))), t2.copyFromAttribute(e2, "sortBy", r2, "sortOn"), t2.copyFromAttribute(e2, "dxfId", r2), t2.copyFromAttribute(e2, "iconSet", r2), t2.copyFromAttribute(e2, "customList", r2), r2; } console.warn("no ref for sort conditional", t2.getPath()); } processSortConditions(t2, e2, s2, r2) { if (!e2) return; const o2 = e2.childNodes, i2 = []; for (let e3 = 0; e3 < o2.length; e3++) { const s3 = o2.item(e3); if (1 === s3.nodeType && "sortCondition" === s3.localName) { const e4 = this.processSortCondition(t2, s3, r2); e4 && i2.push(e4); } } return i2.length > 0 && (s2.fields = i2), i2; } } class rt { visit(t2, e2, s2) { } processDataBarColor(t2, e2, s2, r2, o2 = "dk1") { if (!e2) return; const i2 = n((t3) => e2.getAttribute(t3), o2); return i2 && (s2[r2] = i2), s2; } processFonts(t2, e2, s2) { if (!e2) return; const r2 = e2.childNodes; let o2 = 0; for (let e3 = 0; e3 < r2.length; e3++) { const i2 = r2.item(e3); if (1 === i2.nodeType && "font" === i2.localName) { const e4 = {}; this.processFont(t2, i2, e4), s2[o2++] = e4; } } return s2; } processFont(t2, e2, s2) { t2.getValAttrAsBoolean("b", e2, true) && (s2.weight = 700), t2.getValAttrAsBoolean("i", e2, true) && (s2.style = a.Style.Italic), t2.getValAttrAsBoolean("strike", e2, true) && (s2.strike = true); const r2 = t2.evaluate("u", e2); if (r2) { const t3 = r2.getAttribute("val"); s2.underline = t3 || a.UnderlineStyle.Single; } T(t2, e2, s2, "vertAlign", "verticalAlign"), "superscript" === s2.verticalAlign ? s2.verticalAlign = a.VerticalAlignment.Super : "subscript" === s2.verticalAlign && (s2.verticalAlign = a.VerticalAlignment.Sub), x(t2, e2, s2, "sz", "size"); const o2 = t2.evaluate("color", e2); this.processDataBarColor(t2, o2, s2, "fill"), s2.fill || (s2.fill = "dk1"), T(t2, e2, s2, "name", "family"), T(t2, e2, s2, "rFont", "family"); const i2 = t2.evaluate("family", e2); if (i2) { const t3 = i2.getAttribute("val"); if (t3) switch (t3) { case "1": s2.fallbacks = ["serif"]; break; case "2": s2.fallbacks = ["sans-serif"]; break; case "3": s2.fallbacks = ["monospace"]; break; case "4": s2.fallbacks = ["cursive"]; break; case "5": s2.fallbacks = ["fantasy"]; } } T(t2, e2, s2, "scheme", "scheme"), V(t2, e2, s2, "shadow", "shadow", true), V(t2, e2, s2, "outline", "outline", true); t2.getValAttrAsBoolean("condense", e2, true) && (s2.letterSpacing = -1); return t2.getValAttrAsBoolean("extend", e2, true) && (s2.letterSpacing = 1), T(t2, e2, s2, "charset", "charset"), s2; } processFills(t2, e2, s2) { if (!e2) return; const r2 = e2.childNodes; let o2 = 0; for (let e3 = 0; e3 < r2.length; e3++) { const i2 = r2.item(e3); 1 === i2.nodeType && "fill" === i2.localName && this.processFill(t2, i2, s2, o2++); } return s2; } processFill(t2, e2, s2, r2) { const o2 = { type: g.Type.None }, i2 = e2.childNodes; let n2 = false; for (let e3 = 0; !n2 && e3 < i2.length; e3++) { const s3 = i2.item(e3); 1 === s3.nodeType && ("gradientFill" === s3.localName ? (this.processGradientFill(t2, s3, o2), n2 = true) : "patternFill" === s3.localName && (this.processPatternFill(t2, s3, o2), n2 = true)); } return s2[r2] = o2, s2; } processGradientFill(t2, e2, s2) { if (!e2) return; s2.type = g.Type.Gradient; const r2 = []; s2.stops = r2, s2.angle = 90 + (e2.hasAttribute("degree") ? parseFloat(e2.getAttribute("degree")) : 0); const o2 = e2.getAttribute("type"); o2 && (s2.gradientType = o2); const i2 = (t3) => { if (!t3) return 0; const e3 = parseFloat(t3); return isNaN(e3) ? 0 : e3; }; (e2.hasAttribute("left") || e2.hasAttribute("top") || e2.hasAttribute("right") || e2.hasAttribute("bottom")) && (s2.fillTo = { left: i2(e2.getAttribute("left")), top: i2(e2.getAttribute("top")), right: i2(e2.getAttribute("right")), bottom: i2(e2.getAttribute("bottom")) }); const n2 = e2.childNodes; for (let e3 = 0; e3 < n2.length; e3++) { const s3 = n2.item(e3); if (1 === s3.nodeType && "stop" === s3.localName) { const e4 = {}; r2.push(e4); const o3 = parseFloat(s3.getAttribute("position")); e4.offset = o3; const i3 = t2.evaluate("color", s3); this.processDataBarColor(t2, i3, e4, "color"); } } return s2; } processPatternFill(t2, e2, s2) { if (!e2) return; const r2 = t2.getVisitorParamsState().get("processingDXFs"), o2 = e2.getAttribute("patternType") || (r2 ? g.BuiltInSheetPattern.Solid : g.BuiltInSheetPattern.None); if (o2 === g.BuiltInSheetPattern.None) return { none: true }; s2.type = g.Type.Pattern, o2 && (s2.patternType = o2); let i2, n2 = "foreground", l2 = "background"; const a2 = s2.patternType === g.BuiltInSheetPattern.Solid && r2; if (a2) { i2 = "lt1"; const t3 = n2; n2 = l2, l2 = t3; } const c2 = t2.evaluate("fgColor", e2); this.processDataBarColor(t2, c2, s2, n2, i2); const u2 = t2.evaluate("bgColor", e2); return this.processDataBarColor(t2, u2, s2, l2, i2), a2 && !s2.foreground && (s2.foreground = i2), s2; } processBorders(t2, e2, s2, r2) { if (!e2) return; const o2 = e2.childNodes; let i2 = 0; for (let e3 = 0; e3 < o2.length; e3++) { const n2 = o2.item(e3); 1 === n2.nodeType && "border" === n2.localName && this.processBorder(t2, n2, s2, i2++, r2); } return s2; } processBorder(t2, e2, s2, r2, o2) { if (!e2) return; const i2 = {}; return this.processBorderStroke(t2, e2, i2, d.Edge.Left), this.processBorderStroke(t2, e2, i2, d.Edge.Right), o2 ? (i2.right || i2.left) && (i2.right ? i2.vertical = { ...i2.right } : i2.vertical = { ...i2.left }) : this.processBorderStroke(t2, e2, i2, d.Edge.Vertical), this.processBorderStroke(t2, e2, i2, d.Edge.Top), this.processBorderStroke(t2, e2, i2, d.Edge.Bottom), o2 ? (i2.bottom || i2.top) && (i2.right ? i2.horizontal = { ...i2.bottom } : i2.horizontal = { ...i2.top }) : this.processBorderStroke(t2, e2, i2, d.Edge.Horizontal), s2[r2] = i2, s2; } processBorderStroke(t2, e2, s2, r2) { if (!e2) return; const o2 = t2.evaluate(r2, e2); if (!o2) return; const i2 = {}; o2.hasAttribute("style") && (i2.style = o2.getAttribute("style")); const n2 = t2.evaluate("color", o2); return n2 && this.processDataBarColor(t2, n2, i2, "color"), Object.keys(i2).length > 0 ? s2[r2] = i2 : null; } } class ot extends rt { visit(t2, e2, s2) { this.processNumFmts(t2, t2.evaluate("numFmts", e2), null), t2.getVisitorParamsState().set("colorsToProcess", /* @__PURE__ */ new Set()); const r2 = { fills: {}, fonts: {}, borders: {} }; this.processFonts(t2, t2.evaluate("fonts", e2), r2.fonts), this.processFills(t2, t2.evaluate("fills", e2), r2.fills), this.processBorders(t2, t2.evaluate("borders", e2), r2.borders, true), r2.fills[0] = { type: g.Type.None }, r2.fills[1] = { type: g.Type.Pattern, patternType: g.BuiltInSheetPattern.Gray125 }, r2.borders[0] = {}; const o2 = []; this.processXFs(t2, t2.evaluate("cellStyleXfs", e2), o2, r2, null, false); const i2 = /* @__PURE__ */ new Map(); if (o2.length > 0) { const r3 = []; this.processCellStyles(t2, t2.evaluate("cellStyles", e2), r3, o2, i2), s2.named = r3; } const n2 = []; this.processXFs(t2, t2.evaluate("cellXfs", e2), n2, r2, i2), Object.keys(n2).length > 0 && (s2.direct = n2); const l2 = []; return this.processDXFs(t2, t2.evaluate("dxfs", e2), l2), this.processTableStyles(t2, t2.evaluate("tableStyles", e2), s2, l2), this.processIndexColors(t2, t2.evaluate("colors/indexedColors", e2), s2), this.processMruColors(t2, t2.evaluate("colors/mruColors", e2), s2), s2; } processIndexColors(t2, e2, s2) { if (!e2) return; const r2 = [], o2 = e2.childNodes; for (let e3 = 0; e3 < o2.length; e3++) { const s3 = o2.item(e3); if (1 === s3.nodeType && "rgbColor" === s3.localName) { const e4 = { color: null }; this.processDataBarColor(t2, s3, e4, "color"), e4.color && r2.push(e4.color); } } s2.indexedColors = r2; } processMruColors(t2, e2, s2) { if (!e2) return; const r2 = [], o2 = e2.childNodes; for (let e3 = 0; e3 < o2.length; e3++) { const s3 = o2.item(e3); if (1 === s3.nodeType && "color" === s3.localName) { const e4 = { color: null }; this.processDataBarColor(t2, s3, e4, "color"), e4.color && r2.push(e4.color); } } r2.length > 0 && (s2.mruColors = r2); } processNumFmts(t2, e2, s2) { if (!e2) return; const r2 = /* @__PURE__ */ new Map(); if (t2.getVisitorParamsState().set("numFmts", r2), !e2) return; const o2 = e2.childNodes; for (let t3 = 0; t3 < o2.length; t3++) { const e3 = o2.item(t3); if (1 === e3.nodeType && "numFmt" === e3.localName) { const t4 = e3.getAttribute("numFmtId"), s3 = e3.getAttribute("formatCode"); if (t4 && s3) { const e4 = s3.replace(/\\(.)/g, "$1"); r2.set(parseInt(t4), e4); } } } } processXFs(t2, e2, s2, r2, o2 = null, i2 = true) { if (!e2) return; const n2 = e2.childNodes; for (let e3 = 0; e3 < n2.length; e3++) { const l2 = n2.item(e3); if (1 === l2.nodeType && "xf" === l2.localName) { const e4 = {}; this.processXF(t2, l2, e4, r2, o2, i2), s2.push(e4); } } } processXF(t2, e2, s2, r2, i2, n2) { if (!e2) return; const l2 = e2.getAttribute("xfId"); if (l2 && i2) { const t3 = i2.get(parseInt(l2)); t3 && t3 !== m.BuiltInName.Normal && (s2.named = t3); } const a2 = (t3) => !(!n2 && e2.hasAttribute(t3)) || o(e2.getAttribute("applyFont")); if (a2("applyFont")) { const t3 = r2.fonts[e2.getAttribute("fontId")]; t3 && (s2.font = t3); } if (a2("applyFill")) { const t3 = r2.fills[e2.getAttribute("fillId")]; t3 && Object.keys(t3).length > 0 && (s2.fill = t3); } if (a2("applyBorder")) { const t3 = r2.borders[e2.getAttribute("borderId")]; t3 && Object.keys(t3).length > 0 && (s2.border = t3); } if (a2("applyNumberFormat")) { const r3 = e2.getAttribute("numFmtId"); if (r3) { const e3 = parseInt(r3); let o2; const i3 = t2.getVisitorParamsState(); if (i3) { const t3 = i3.get("numFmts"); t3 && (o2 = t3.get(e3)), s2.numberFormat = o2 ?? e3; } else console.warn("no visitor params state"); } } a2("applyAlignment") && this.processAlignment(t2, t2.evaluate("alignment", e2), s2), a2("applyProtection") && this.processProtection(t2, t2.evaluate("protection", e2), s2); const c2 = o(e2.getAttribute("quotePrefix")); c2 && (s2.quotePrefix = c2); } processAlignment(t2, e2, s2) { const r2 = {}; if (e2?.hasAttribute("horizontal") ? r2.horizontal = e2.getAttribute("horizontal") : r2.horizontal = b.HorizontalAlignment.General, e2?.hasAttribute("vertical") ? r2.vertical = e2.getAttribute("vertical") : r2.vertical = b.VerticalAlignment.Bottom, e2?.hasAttribute("indent") ? r2.indent = parseInt(e2.getAttribute("indent")) : r2.indent = 0, e2?.hasAttribute("relativeIndent") ? r2.relativeIndent = parseInt(e2.getAttribute("relativeIndent")) : r2.relativeIndent = 0, o(e2?.getAttribute("wrapText")) ? r2.overflow = b.Overflow.Wrap : r2.overflow = b.Overflow.Vi