UNPKG

@sheetxl/studio-vanilla

Version:

SheetXL Studio - Vanilla entry point for integrating SheetXL UI.

1,155 lines 69 kB
import { N as Pt, am as Vt, aA as ye, aB as be, aC as Rt, aD as wt, aa as te, aE as xe, aF as we, az as ve, aG as Se, ar as ee, w as Ce, aH as ke, aj as Ae } from "./EFJ5klSL3OL5aq6z.mjs"; /** * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.6.4 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */ const ne = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", De = new RegExp(`^[${ne}][-${ne}.0-9·̀-ͯ‿-⁀]*$`, "u"); function pe(i) { return i >= 65 && i <= 90 || i >= 97 && i <= 122 || i === 58 || i === 95 || i === 8204 || i === 8205 || i >= 192 && i <= 214 || i >= 216 && i <= 246 || i >= 248 && i <= 767 || i >= 880 && i <= 893 || i >= 895 && i <= 8191 || i >= 8304 && i <= 8591 || i >= 11264 && i <= 12271 || i >= 12289 && i <= 55295 || i >= 63744 && i <= 64975 || i >= 65008 && i <= 65533 || i >= 65536 && i <= 983039; } const ae = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿", Ee = new RegExp(`^[${ae}][-${ae}.0-9·̀-ͯ‿-⁀]*$`, "u"); function ge(i) { return i >= 65 && i <= 90 || i === 95 || i >= 97 && i <= 122 || i >= 192 && i <= 214 || i >= 216 && i <= 246 || i >= 248 && i <= 767 || i >= 880 && i <= 893 || i >= 895 && i <= 8191 || i >= 8204 && i <= 8205 || i >= 8304 && i <= 8591 || i >= 11264 && i <= 12271 || i >= 12289 && i <= 55295 || i >= 63744 && i <= 64975 || i >= 65008 && i <= 65533 || i >= 65536 && i <= 983039; } const rt = function(i) { return i === 32 || i === 10 || i === 13 || i === 9; }, Pe = function(i) { return i >= 32 && i <= 55295 || i === 10 || i === 13 || i === 9 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111; }, zt = pe, le = function(i) { return pe(i) || i >= 48 && i <= 57 || i === 45 || i === 46 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256; }, fe = [32, 10, 13, 9], Oe = De, Ie = function(i) { return i >= 1 && i <= 55295 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111; }, Ve = ge, Le = function(i) { return ge(i) || i === 45 || i === 46 || i >= 48 && i <= 57 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256; }, Ne = Ee, Yt = "http://www.w3.org/XML/1998/namespace", Ht = "http://www.w3.org/2000/xmlns/", Re = { __proto__: null, xml: Yt, xmlns: Ht }, $e = { __proto__: null, amp: "&", gt: ">", lt: "<", quot: '"', apos: "'" }, N = -1, bt = -2, tt = 13, Ot = 33, pt = 10, At = 60, Mt = 61, B = 62, z = 63, jt = 93, Kt = (i) => i === 34 || i === 39, me = [34, 39], Me = [...me, 91, B], je = [...me, At, jt], He = [Mt, z, ...fe], Fe = [...fe, B, 38, At]; function se(i, t, s) { switch (t) { case "xml": s !== Yt && i.fail(`xml prefix must be bound to ${Yt}.`); break; case "xmlns": s !== Ht && i.fail(`xmlns prefix must be bound to ${Ht}.`); } switch (s) { case Ht: i.fail(t === "" ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${Ht}.`); break; case Yt: switch (t) { case "xml": break; case "": i.fail(`the default namespace may not be set to ${s}.`); break; default: i.fail("may not assign the xml namespace to another prefix."); } } } const Xe = (i) => Ne.test(i), Be = (i) => Oe.test(i), ce = { xmldecl: "xmldeclHandler", text: "textHandler", processinginstruction: "piHandler", doctype: "doctypeHandler", comment: "commentHandler", opentagstart: "openTagStartHandler", attribute: "attributeHandler", opentag: "openTagHandler", closetag: "closeTagHandler", cdata: "cdataHandler", error: "errorHandler", end: "endHandler", ready: "readyHandler" }; class We { constructor(t) { this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment; const s = this.xmlnsOpt = !!this.opt.xmlns; if (this.trackPosition = this.opt.position !== !1, this.fileName = this.opt.fileName, s) { this.nameStartCheck = Ve, this.nameCheck = Le, this.isName = Xe, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = { __proto__: null, ...Re }; const o = this.opt.additionalNamespaces; o != null && (function(n, a) { for (const l of Object.keys(a)) se(n, l, a[l]); }(this, o), Object.assign(this.ns, o)); } else this.nameStartCheck = zt, this.nameCheck = le, this.isName = Be, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain; this.stateTable = [this.sBegin, this.sBeginWhitespace, this.sDoctype, this.sDoctypeQuote, this.sDTD, this.sDTDQuoted, this.sDTDOpenWaka, this.sDTDOpenWakaBang, this.sDTDComment, this.sDTDCommentEnding, this.sDTDCommentEnded, this.sDTDPI, this.sDTDPIEnding, this.sText, this.sEntity, this.sOpenWaka, this.sOpenWakaBang, this.sComment, this.sCommentEnding, this.sCommentEnded, this.sCData, this.sCDataEnding, this.sCDataEnding2, this.sPIFirstChar, this.sPIRest, this.sPIBody, this.sPIEnding, this.sXMLDeclNameStart, this.sXMLDeclName, this.sXMLDeclEq, this.sXMLDeclValueStart, this.sXMLDeclValue, this.sXMLDeclSeparator, this.sXMLDeclEnding, this.sOpenTag, this.sOpenTagSlash, this.sAttrib, this.sAttribName, this.sAttribNameSawWhite, this.sAttribValue, this.sAttribValueQuoted, this.sAttribValueClosed, this.sAttribValueUnquoted, this.sCloseTag, this.sCloseTagSawWhite], this._init(); } get closed() { return this._closed; } _init() { 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 = []; const { fragmentOpt: t } = this; this.state = t ? tt : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0; let { defaultXMLVersion: s } = this.opt; if (s === void 0) { if (this.opt.forceXMLVersion === !0) throw new Error("forceXMLVersion set but defaultXMLVersion is not set"); s = "1.0"; } this.setXMLVersion(s), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = { version: void 0, encoding: void 0, standalone: void 0 }, this.line = 1, this.column = 0, this.ENTITIES = Object.create($e), this.readyHandler?.(); } get position() { return this.chunkPosition + this.i; } get columnIndex() { return this.position - this.positionAtNewLine; } on(t, s) { this[ce[t]] = s; } off(t) { this[ce[t]] = void 0; } makeError(t) { let s = this.fileName ?? ""; return this.trackPosition && (s.length > 0 && (s += ":"), s += `${this.line}:${this.column}`), s.length > 0 && (s += ": "), new Error(s + t); } fail(t) { const s = this.makeError(t), o = this.errorHandler; if (o === void 0) throw s; return o(s), this; } write(t) { if (this.closed) return this.fail("cannot write after close; assign an onready handler."); let s = !1; t === null ? (s = !0, t = "") : typeof t == "object" && (t = t.toString()), this.carriedFromPrevious !== void 0 && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0); let o = t.length; const n = t.charCodeAt(o - 1); !s && (n === 13 || n >= 55296 && n <= 56319) && (this.carriedFromPrevious = t[o - 1], o--, t = t.slice(0, o)); const { stateTable: a } = this; for (this.chunk = t, this.i = 0; this.i < o; ) a[this.state].call(this); return this.chunkPosition += o, s ? this.end() : this; } close() { return this.write(null); } getCode10() { const t = this.chunk, s = this.i; if (this.prevI = s, this.i++, s >= t.length) return N; const o = t.charCodeAt(s); if (this.column++, o < 55296) { if (o >= 32 || o === 9) return o; switch (o) { case pt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, pt; case 13: return t.charCodeAt(s + 1) === pt && (this.i = s + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, bt; default: return this.fail("disallowed character."), o; } } if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o; const n = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320); return this.i = s + 2, n > 1114111 && this.fail("disallowed character."), n; } getCode11() { const { chunk: t, i: s } = this; if (this.prevI = s, this.i = s + 1, s >= t.length) return N; const o = t.charCodeAt(s); if (this.column++, o < 55296) { if (o > 31 && o < 127 || o > 159 && o !== 8232 || o === 9) return o; switch (o) { case pt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, pt; case 13: { const a = t.charCodeAt(s + 1); a !== pt && a !== 133 || (this.i = s + 2); } case 133: case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, bt; default: return this.fail("disallowed character."), o; } } if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o; const n = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320); return this.i = s + 2, n > 1114111 && this.fail("disallowed character."), n; } getCodeNorm() { const t = this.getCode(); return t === bt ? pt : t; } unget() { this.i = this.prevI, this.column--; } captureTo(t) { let { i: s } = this; const { chunk: o } = this; for (; ; ) { const n = this.getCode(), a = n === bt, l = a ? pt : n; if (l === N || t.includes(l)) return this.text += o.slice(s, this.prevI), l; a && (this.text += `${o.slice(s, this.prevI)} `, s = this.i); } } captureToChar(t) { let { i: s } = this; const { chunk: o } = this; for (; ; ) { let n = this.getCode(); switch (n) { case bt: this.text += `${o.slice(s, this.prevI)} `, s = this.i, n = pt; break; case N: return this.text += o.slice(s), !1; } if (n === t) return this.text += o.slice(s, this.prevI), !0; } } captureNameChars() { const { chunk: t, i: s } = this; for (; ; ) { const o = this.getCode(); if (o === N) return this.name += t.slice(s), N; if (!le(o)) return this.name += t.slice(s, this.prevI), o === bt ? pt : o; } } skipSpaces() { for (; ; ) { const t = this.getCodeNorm(); if (t === N || !rt(t)) return t; } } setXMLVersion(t) { this.currentXMLVersion = t, t === "1.0" ? (this.isChar = Pe, this.getCode = this.getCode10) : (this.isChar = Ie, this.getCode = this.getCode11); } sBegin() { this.chunk.charCodeAt(0) === 65279 && (this.i++, this.column++), this.state = 1; } sBeginWhitespace() { const t = this.i, s = this.skipSpaces(); switch (this.prevI !== t && (this.xmlDeclPossible = !1), s) { case At: if (this.state = 15, this.text.length !== 0) throw new Error("no-empty text at start"); break; case N: break; default: this.unget(), this.state = tt, this.xmlDeclPossible = !1; } } sDoctype() { const t = this.captureTo(Me); switch (t) { case B: this.doctypeHandler?.(this.text), this.text = "", this.state = tt, this.doctype = !0; break; case N: break; default: this.text += String.fromCodePoint(t), t === 91 ? this.state = 4 : Kt(t) && (this.state = 3, this.q = t); } } sDoctypeQuote() { const t = this.q; this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2); } sDTD() { const t = this.captureTo(je); t !== N && (this.text += String.fromCodePoint(t), t === jt ? this.state = 2 : t === At ? this.state = 6 : Kt(t) && (this.state = 5, this.q = t)); } sDTDQuoted() { const t = this.q; this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null); } sDTDOpenWaka() { const t = this.getCodeNorm(); switch (this.text += String.fromCodePoint(t), t) { case 33: this.state = 7, this.openWakaBang = ""; break; case z: this.state = 11; break; default: this.state = 4; } } sDTDOpenWakaBang() { const t = String.fromCodePoint(this.getCodeNorm()), s = this.openWakaBang += t; this.text += t, s !== "-" && (this.state = s === "--" ? 8 : 4, this.openWakaBang = ""); } sDTDComment() { this.captureToChar(45) && (this.text += "-", this.state = 9); } sDTDCommentEnding() { const t = this.getCodeNorm(); this.text += String.fromCodePoint(t), this.state = t === 45 ? 10 : 8; } sDTDCommentEnded() { const t = this.getCodeNorm(); this.text += String.fromCodePoint(t), t === B ? this.state = 4 : (this.fail("malformed comment."), this.state = 8); } sDTDPI() { this.captureToChar(z) && (this.text += "?", this.state = 12); } sDTDPIEnding() { const t = this.getCodeNorm(); this.text += String.fromCodePoint(t), t === B && (this.state = 4); } sText() { this.tags.length !== 0 ? this.handleTextInRoot() : this.handleTextOutsideRoot(); } sEntity() { let { i: t } = this; const { chunk: s } = this; t: for (; ; ) switch (this.getCode()) { case bt: this.entity += `${s.slice(t, this.prevI)} `, t = this.i; break; case 59: { const { entityReturnState: o } = this, n = this.entity + s.slice(t, this.prevI); let a; this.state = o, n === "" ? (this.fail("empty entity name."), a = "&;") : (a = this.parseEntity(n), this.entity = ""), o === tt && this.textHandler === void 0 || (this.text += a); break t; } case N: this.entity += s.slice(t); break t; } } sOpenWaka() { const t = this.getCode(); if (zt(t)) this.state = 34, this.unget(), this.xmlDeclPossible = !1; else switch (t) { case 47: this.state = 43, this.xmlDeclPossible = !1; break; case 33: this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1; break; case z: this.state = 23; break; default: this.fail("disallowed character in tag name"), this.state = tt, this.xmlDeclPossible = !1; } } sOpenWakaBang() { switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) { case "[CDATA[": 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 = ""; break; case "--": this.state = 17, this.openWakaBang = ""; break; case "DOCTYPE": this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = ""; break; default: this.openWakaBang.length >= 7 && this.fail("incorrect syntax."); } } sComment() { this.captureToChar(45) && (this.state = 18); } sCommentEnding() { const t = this.getCodeNorm(); t === 45 ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17); } sCommentEnded() { const t = this.getCodeNorm(); t !== B ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = tt; } sCData() { this.captureToChar(jt) && (this.state = 21); } sCDataEnding() { const t = this.getCodeNorm(); t === jt ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20); } sCDataEnding2() { const t = this.getCodeNorm(); switch (t) { case B: this.cdataHandler?.(this.text), this.text = "", this.state = tt; break; case jt: this.text += "]"; break; default: this.text += `]]${String.fromCodePoint(t)}`, this.state = 20; } } sPIFirstChar() { const t = this.getCodeNorm(); this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === z || rt(t) ? (this.fail("processing instruction without a target."), this.state = t === z ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24); } sPIRest() { const { chunk: t, i: s } = this; for (; ; ) { const o = this.getCodeNorm(); if (o === N) return void (this.piTarget += t.slice(s)); if (!this.nameCheck(o)) { this.piTarget += t.slice(s, this.prevI); const n = o === z; n || rt(o) ? this.piTarget === "xml" ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = n ? Ot : 27) : this.state = n ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(o)); break; } } } sPIBody() { if (this.text.length === 0) { const t = this.getCodeNorm(); t === z ? this.state = 26 : rt(t) || (this.text = String.fromCodePoint(t)); } else this.captureToChar(z) && (this.state = 26); } sPIEnding() { const t = this.getCodeNorm(); if (t === B) { const { piTarget: s } = this; s.toLowerCase() === "xml" && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({ target: s, body: this.text }), this.piTarget = this.text = "", this.state = tt; } else t === z ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25); this.xmlDeclPossible = !1; } sXMLDeclNameStart() { const t = this.skipSpaces(); t !== z ? t !== N && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = Ot; } sXMLDeclName() { const t = this.captureTo(He); if (t === z) return this.state = Ot, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete."); if (rt(t) || t === Mt) { if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) { case 0: this.fail("did not expect any more name/value pairs."); break; case 1: this.fail(`expected the name ${this.xmlDeclExpects[0]}.`); break; default: this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`); } this.state = t === Mt ? 30 : 29; } } sXMLDeclEq() { const t = this.getCodeNorm(); if (t === z) return this.state = Ot, void this.fail("XML declaration is incomplete."); rt(t) || (t !== Mt && this.fail("value required."), this.state = 30); } sXMLDeclValueStart() { const t = this.getCodeNorm(); if (t === z) return this.state = Ot, void this.fail("XML declaration is incomplete."); rt(t) || (Kt(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31); } sXMLDeclValue() { const t = this.captureTo([this.q, z]); if (t === z) return this.state = Ot, this.text = "", void this.fail("XML declaration is incomplete."); if (t === N) return; const s = this.text; switch (this.text = "", this.name) { case "version": { this.xmlDeclExpects = ["encoding", "standalone"]; const o = s; this.xmlDecl.version = o, /^1\.[0-9]+$/.test(o) ? this.opt.forceXMLVersion || this.setXMLVersion(o) : this.fail("version number must match /^1\\.[0-9]+$/."); break; } case "encoding": /^[A-Za-z][A-Za-z0-9._-]*$/.test(s) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = s; break; case "standalone": s !== "yes" && s !== "no" && this.fail('standalone value must match "yes" or "no".'), this.xmlDeclExpects = [], this.xmlDecl.standalone = s; } this.name = "", this.state = 32; } sXMLDeclSeparator() { const t = this.getCodeNorm(); t !== z ? (rt(t) || (this.fail("whitespace required."), this.unget()), this.state = 27) : this.state = Ot; } sXMLDeclEnding() { this.getCodeNorm() === B ? (this.piTarget !== "xml" ? this.fail("processing instructions are not allowed before root.") : this.name !== "version" && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmldeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = tt) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1; } sOpenTag() { const t = this.captureNameChars(); if (t === N) return; const s = this.tag = { name: this.name, attributes: /* @__PURE__ */ Object.create(null) }; switch (this.name = "", this.xmlnsOpt && (this.topNS = s.ns = /* @__PURE__ */ Object.create(null)), this.openTagStartHandler?.(s), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t) { case B: this.openTag(); break; case 47: this.state = 35; break; default: rt(t) || this.fail("disallowed character in tag name."), this.state = 36; } } sOpenTagSlash() { this.getCode() === B ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36); } sAttrib() { const t = this.skipSpaces(); t !== N && (zt(t) ? (this.unget(), this.state = 37) : t === B ? this.openTag() : t === 47 ? this.state = 35 : this.fail("disallowed character in attribute name.")); } sAttribName() { const t = this.captureNameChars(); t === Mt ? this.state = 39 : rt(t) ? this.state = 38 : t === B ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== N && this.fail("disallowed character in attribute name."); } sAttribNameSawWhite() { const t = this.skipSpaces(); switch (t) { case N: return; case Mt: this.state = 39; break; default: this.fail("attribute without value."), this.text = "", this.name = "", t === B ? this.openTag() : zt(t) ? (this.unget(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36); } } sAttribValue() { const t = this.getCodeNorm(); Kt(t) ? (this.q = t, this.state = 40) : rt(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unget()); } sAttribValueQuoted() { const { q: t, chunk: s } = this; let { i: o } = this; for (; ; ) switch (this.getCode()) { case t: return this.pushAttrib(this.name, this.text + s.slice(o, this.prevI)), this.name = this.text = "", this.q = null, void (this.state = 41); case 38: return this.text += s.slice(o, this.prevI), this.state = 14, void (this.entityReturnState = 40); case pt: case bt: case 9: this.text += `${s.slice(o, this.prevI)} `, o = this.i; break; case At: return this.text += s.slice(o, this.prevI), void this.fail("disallowed character."); case N: return void (this.text += s.slice(o)); } } sAttribValueClosed() { const t = this.getCodeNorm(); rt(t) ? this.state = 36 : t === B ? this.openTag() : t === 47 ? this.state = 35 : zt(t) ? (this.fail("no whitespace between attributes."), this.unget(), this.state = 37) : this.fail("disallowed character in attribute name."); } sAttribValueUnquoted() { const t = this.captureTo(Fe); switch (t) { case 38: this.state = 14, this.entityReturnState = 42; break; case At: this.fail("disallowed character."); break; case N: break; default: this.text.includes("]]>") && this.fail('the string "]]>" is disallowed in char data.'), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === B ? this.openTag() : this.state = 36; } } sCloseTag() { const t = this.captureNameChars(); t === B ? this.closeTag() : rt(t) ? this.state = 44 : t !== N && this.fail("disallowed character in closing tag."); } sCloseTagSawWhite() { switch (this.skipSpaces()) { case B: this.closeTag(); break; case N: break; default: this.fail("disallowed character in closing tag."); } } handleTextInRoot() { let { i: t, forbiddenState: s } = this; const { chunk: o, textHandler: n } = this; t: for (; ; ) switch (this.getCode()) { case At: if (this.state = 15, n !== void 0) { const { text: a } = this, l = o.slice(t, this.prevI); a.length !== 0 ? (n(a + l), this.text = "") : l.length !== 0 && n(l); } s = 0; break t; case 38: this.state = 14, this.entityReturnState = tt, n !== void 0 && (this.text += o.slice(t, this.prevI)), s = 0; break t; case jt: switch (s) { case 0: s = 1; break; case 1: s = 2; break; case 2: break; default: throw new Error("impossible state"); } break; case B: s === 2 && this.fail('the string "]]>" is disallowed in char data.'), s = 0; break; case bt: n !== void 0 && (this.text += `${o.slice(t, this.prevI)} `), t = this.i, s = 0; break; case N: n !== void 0 && (this.text += o.slice(t)); break t; default: s = 0; } this.forbiddenState = s; } handleTextOutsideRoot() { let { i: t } = this; const { chunk: s, textHandler: o } = this; let n = !1; t: for (; ; ) { const a = this.getCode(); switch (a) { case At: if (this.state = 15, o !== void 0) { const { text: l } = this, g = s.slice(t, this.prevI); l.length !== 0 ? (o(l + g), this.text = "") : g.length !== 0 && o(g); } break t; case 38: this.state = 14, this.entityReturnState = tt, o !== void 0 && (this.text += s.slice(t, this.prevI)), n = !0; break t; case bt: o !== void 0 && (this.text += `${s.slice(t, this.prevI)} `), t = this.i; break; case N: o !== void 0 && (this.text += s.slice(t)); break t; default: rt(a) || (n = !0); } } n && (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)); } pushAttribNS(t, s) { const { prefix: o, local: n } = this.qname(t), a = { name: t, prefix: o, local: n, value: s }; if (this.attribList.push(a), this.attributeHandler?.(a), o === "xmlns") { const l = s.trim(); this.currentXMLVersion === "1.0" && l === "" && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[n] = l, se(this, n, l); } else if (t === "xmlns") { const l = s.trim(); this.topNS[""] = l, se(this, "", l); } } pushAttribPlain(t, s) { const o = { name: t, value: s }; this.attribList.push(o), this.attributeHandler?.(o); } end() { this.sawRoot || this.fail("document must contain a root element."); const { tags: t } = this; for (; t.length > 0; ) { const o = t.pop(); this.fail(`unclosed tag: ${o.name}`); } this.state !== 0 && this.state !== tt && this.fail("unexpected end."); const { text: s } = this; return s.length !== 0 && (this.textHandler?.(s), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this; } resolve(t) { let s = this.topNS[t]; if (s !== void 0) return s; const { tags: o } = this; for (let n = o.length - 1; n >= 0; n--) if (s = o[n].ns[t], s !== void 0) return s; return s = this.ns[t], s !== void 0 ? s : this.opt.resolvePrefix?.(t); } qname(t) { const s = t.indexOf(":"); if (s === -1) return { prefix: "", local: t }; const o = t.slice(s + 1), n = t.slice(0, s); return (n === "" || o === "" || o.includes(":")) && this.fail(`malformed name: ${t}.`), { prefix: n, local: o }; } processAttribsNS() { const { attribList: t } = this, s = this.tag; { const { prefix: a, local: l } = this.qname(s.name); s.prefix = a, s.local = l; const g = s.uri = this.resolve(a) ?? ""; a !== "" && (a === "xmlns" && this.fail('tags may not have "xmlns" as prefix.'), g === "" && (this.fail(`unbound namespace prefix: ${JSON.stringify(a)}.`), s.uri = a)); } if (t.length === 0) return; const { attributes: o } = s, n = /* @__PURE__ */ new Set(); for (const a of t) { const { name: l, prefix: g, local: S } = a; let b, x; g === "" ? (b = l === "xmlns" ? Ht : "", x = l) : (b = this.resolve(g), b === void 0 && (this.fail(`unbound namespace prefix: ${JSON.stringify(g)}.`), b = g), x = `{${b}}${S}`), n.has(x) && this.fail(`duplicate attribute: ${x}.`), n.add(x), a.uri = b, o[l] = a; } this.attribList = []; } processAttribsPlain() { const { attribList: t } = this, s = this.tag.attributes; for (const { name: o, value: n } of t) s[o] !== void 0 && this.fail(`duplicate attribute: ${o}.`), s[o] = n; this.attribList = []; } openTag() { this.processAttribs(); const { tags: t } = this, s = this.tag; s.isSelfClosing = !1, this.openTagHandler?.(s), t.push(s), this.state = tt, this.name = ""; } openSelfClosingTag() { this.processAttribs(); const { tags: t } = this, s = this.tag; s.isSelfClosing = !0, this.openTagHandler?.(s), this.closeTagHandler?.(s), (this.tag = t[t.length - 1] ?? null) === null && (this.closedRoot = !0), this.state = tt, this.name = ""; } closeTag() { const { tags: t, name: s } = this; if (this.state = tt, this.name = "", s === "") return this.fail("weird empty close tag."), void (this.text += "</>"); const o = this.closeTagHandler; let n = t.length; for (; n-- > 0; ) { const a = this.tag = t.pop(); if (this.topNS = a.ns, o?.(a), a.name === s) break; this.fail("unexpected close tag."); } n === 0 ? this.closedRoot = !0 : n < 0 && (this.fail(`unmatched closing tag: ${s}.`), this.text += `</${s}>`); } parseEntity(t) { if (t[0] !== "#") { const o = this.ENTITIES[t]; return o !== void 0 ? o : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`); } let s = NaN; return t[1] === "x" && /^#x[0-9a-f]+$/i.test(t) ? s = parseInt(t.slice(2), 16) : /^#[0-9]+$/.test(t) && (s = parseInt(t.slice(1), 10)), this.isChar(s) ? String.fromCodePoint(s) : (this.fail("malformed character entity."), `&${t};`); } } var ie, Ct; (Ct = ie || (ie = {})).Events = { XmlDecl: "xmldecl", Text: "text", ProcessingInstruction: "processinginstruction", Doctype: "doctype", Comment: "comment", OpenTagStart: "opentagstart", Attribute: "attribute", OpenTag: "opentag", CloseTag: "closetag", CDdata: "cdata", Error: "error", End: "end", Ready: "ready" }, Ct.parseStream = async (i, t, s) => { const o = new We({ position: !1, ...s }); let n; if (t.onOpenTagStart && o.on(Ct.Events.OpenTagStart, t.onOpenTagStart), t.onOpenTag && o.on(Ct.Events.OpenTag, t.onOpenTag), t.onCloseTag && o.on(Ct.Events.CloseTag, t.onCloseTag), t.onAttribute && o.on(Ct.Events.Attribute, t.onAttribute), t.onText && o.on(Ct.Events.Text, t.onText), t.onError && o.on(Ct.Events.Error, t.onError), t.onEnd) { t.onEnd; const a = () => { n = t.onEnd(); }; o.on(Ct.Events.End, a); } for (; ; ) { const { value: a, done: l } = await i.read(); if (l) break; o.write(a); } return o.close(), n; }; const P = (i) => i === !0 || i === "1" || i === "on" || i === "true" || i !== !1 && i !== "0" && i !== "off" && i !== "false" && null, L = (i) => { const t = parseInt(i); return isNaN(t) ? null : t; }, xt = (i) => { const t = parseFloat(i); return isNaN(t) ? null : t; }, O = null; class _e { constructor() { this._registeredVisitors = /* @__PURE__ */ new Map(); } registerVisitor(t) { this._registeredVisitors.set(t.from, t); } createEventHandler(t, s, o) { const n = this._registeredVisitors, a = []; let l = null, g = null, S = null, b = null; const x = [], C = { key: null, source: t }; let w = null, u = !1; const A = (T, m) => { let I = S.attributes[T]; if (m) { if (Array.isArray(m)) { for (let H = 0; H < m.length; H++) if (I == null || (I = m[H](I), I == null)) return; } else if (I == null || (I = m(I), I == null)) return; } return I; }, f = { getSource: () => w.source, setSource: (T) => { w.source = T; }, setKey: (T) => { w.key = T; }, getFrom: () => S, getAttribute: (T, m) => A(T, m) ?? null, hasAttribute: (T) => f.getAttribute(T) !== null, getParent: () => x[x.length - 2].source, getPath: () => { const T = []; for (let m = 0; m < a.length; m++) T.push(a[m].local); return T.join("\\"); }, parseAttribute: A, copyToObject: (T, m, I, H) => { const W = A(H ?? m, I); W !== void 0 && (T[m] = W); }, copyTo: (T, m, I) => { const H = A(I ?? T, m); H !== void 0 && (w.source[T] = H); }, warn: (T) => { o ? o?.(T) : console.warn(T); } }; return { onOpenTag: (T) => { let m = T.name; const I = m.indexOf(":"); I !== -1 && (m = m.slice(I + 1)); const H = n.get(m); if (l = { local: m, visitor: H, tag: T, destination: null }, u) return a.push(l), g = m, void (S = T); b = l?.visitor ?? null, H && (w = a.length === 0 ? C : b?.to !== null ? { key: null, source: {} } : null, l.destination = w, w && x.push(w)), a.push(l), g = m, S = T, u = b?.to === null, b?.openTag?.(f); }, onCloseTag: (T) => { let m = T.name; const I = m.indexOf(":"); if (I !== -1 && (m = m.slice(I + 1)), m !== g) throw new Error(`mismatch open/close tag: '${m}'/'${g}'`); u || b?.closeTag?.(f); const H = a.pop() ?? null; l = a[a.length - 1] ?? null; const W = H?.destination; if (W) { x.pop(), w = x[x.length - 1] ?? C; const Z = H.visitor; Z && Z.to && W.source !== void 0 && (Array.isArray(Z.to) ? w.source.push ? w.source.push(W.source) : o?.(`Unable to parse array for ${Z.from} at ${f.getPath()}`) : W.key ? w.source[W.key] = W.source : typeof Z.to == "string" && (w.source[Z.to] = W.source)); } g = l?.local ?? null, S = l?.tag ?? null, b = l?.visitor ?? null, u = !l?.destination; }, onText: (T) => { b?.text?.(T, f); }, onEnd: s }; } } const he = (i, t, s, o = null) => { if (!i) return null; let n = i; n.startsWith("/") && (n = n.substring(1)); let a = o?.parsedRefs?.get(i); if (a !== void 0) return a; const l = t(n); if (!l) return null; let g = l.content; try { s && (g = s(g)); } catch (S) { console.warn(S); } return o?.parsedRefs?.set(i, g), g; }, oe = (i, t, s, o, n = null) => { if (!i) return null; let a = i; a.startsWith("/") && (a = a.substring(1)); let l = n?.parsedRefs?.get(i); if (l !== void 0) return l; const g = t(a); if (!g) return null; const S = g.content; try { const b = new TextDecoder().decode(S), x = s.parseFromString(b, "text/xml"), C = o.convert(x, i, n); return n?.parsedRefs?.set(i, C), C; } catch (b) { console.warn(b); } return null; }, $t = (i, t, s, o, n = null) => { const a = /* @__PURE__ */ new Map(); let l = t.Directory[i]; const g = l ? l.length : 0; for (let S = 0; S < g; S++) { const b = l[S]; if (!b) continue; let x = b; x.startsWith("/") && (x = x.substring(1)); const C = oe(x, (w) => t.files[w], s, o, n); a.set(x, C); } return a; }, qe = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"], ue = (i, t = "dk1") => { let s; const o = i("auto"); o === void 0 || o !== "1" && o !== "true" || (s = t); const n = i("indexed"); n && (s = `index${n}`); const a = i("rgb"); a && (s = a.toLowerCase(), a.length !== 8 || a.startsWith("FF") || (s = "FF" + a.substring(2, a.length))); const l = i("theme"); l && (s = qe[l]); let g = i("tint"); if (g && (s += ` ${Se.AdjustmentType.ETint} ${parseFloat(g)}`), s) return s; }, ze = (i) => i && i.replace(/^\{([\s\S]+)\}$/, "$1"), Je = (i) => i ? te.roundAccurately(parseFloat(i) / 12700, 4) : null, Ke = (i) => i ? te.roundAccurately(parseFloat(i) / 9525, 1) : null, Ye = (i) => parseFloat(i) / 1e3, ts = (i) => parseFloat(i) / 6e4, Ue = (i) => i === "true" || i === "1"; class It { static { this.Collapsed = 1; } static { this.CustomFormat = 2; } static { this.CustomHeight = 4; } static { this.Hidden = 8; } static { this.Ht = 16; } static { this.OutlineLevel = 32; } static { this.Ph = 64; } static { this.R = 128; } static { this.S = 256; } static { this.Spans = 512; } static { this.ThickBot = 1024; } static { this.ThickTop = 2048; } } const Ge = (i, t, s) => { if (i[0].value[0] === i[1].value[0]) return t; }, de = { colStart: 0, colEnd: 0, rowStart: 0, rowEnd: 0 }, Ze = (i, t, s, o, n, a) => { let l = !1, g = !1, S = [], b = !1, x = null, C = null, w = null, u = null, A = null, f = null; const T = a?.get("richData") ?? [], m = wt.normalizeA1ToR1C1, I = ee.createConflatingRanges(), H = /* @__PURE__ */ new Map(), W = []; let Z = null; const Ft = ee.createConflatingRanges(); let gt, ct = !1, F = -1, $ = -1, et = null, vt = null; const Xt = []; let Lt = null, Bt = -2, ht = 0, ut = "", ft = "", mt = "", Q = "", dt = "", Tt = "", St = "", Dt = "", Ut = "", Nt = "", Gt = "", Zt = "", D = "", U = "", M = !0, q = null; return { ...s, onEnd: () => { Xt.length > 0 && (t.rows = Xt); let d = I.done(Ge); const p = d.length; if (p > 0) { const E = new Array(p); for (let v = 0; v < p; v++) { const R = d[v], G = wt.rangeToString(R), st = R.value[1], it = wt.resolveRelativeToA1(st, R.rowStart, R.colStart); E[v] = [G, it]; } t.formulas = E; } const J = Ft.done(!0), V = J.length; if (V > 0) { const E = new Array(V); for (let v = 0; v < V; v++) { const R = J[v], G = wt.rangeToString(R); E[v] = G; } t.volatile = E; } if (W.length > 0 && (t.dynamicArray = [...W]), S.length > 0) { S.sort(ee.createRangeComparator(Ce.Orientation.Column)); const E = []; let v = null, R = -1, G = -1, st = -1, it = -1, Y = null; const yt = S.length; yt > 0 && (v = S[0], R = v.colStart, G = v.colEnd, st = v.rowEnd, it = v.value, E.push(v)); for (let k = 1; k < yt; k++) Y = S[k], it !== Y.value || R !== Y.colStart || G !== Y.colEnd || st + 1 !== Y.rowEnd ? (E.push(Y), v = Y, R = v.colStart, G = v.colEnd, st = v.rowEnd, it = v.value) : (st = Y.rowEnd, v.rowEnd = st); let Wt = []; for (let k = 0; k < E.length; k++) { const X = E[k]; Wt.push({ r: { colStart: X.colStart, colEnd: X.colEnd, rowStart: X.rowStart, rowEnd: X.rowEnd }, v: X.value }); } t.directStyles = Wt; } const K = i.build(); if (K) { const E = K.tuples; t.data = E; } s?.onEnd?.(); }, onOpenTag: (d) => { let p = d.name; const J = p.indexOf(":"); if (J !== -1 && (p = p.slice(J + 1)), gt) { const V = d.attributes; switch (p) { case "v": g = !0; break; case "f": switch (V.t ?? null) { case null: case "normal": b = !0; break; case "shared": const K = V.si; C = V.ref, x = K; break; case "array": b = !0, C = V.ref, Z = [C, !1]; break; case "datatable": b = !0, C = V.ref, b = !0; } V.ca !== void 0 && Ft.append(F, $); break; case "is": return void (ct = !0); } return void (ct && n?.onOpenTag(d)); } if (l) { if (p === "c") { gt = d; const V = d.attributes.r; $ = wt.fastStringToCol(V); const K = d.attributes.t; K === void 0 ? vt = null : (vt = K, vt === "str" && (ct = !0)); let E = d.attributes.s; E !== void 0 && (E = parseInt(E), q && q.value === E && q.colEnd + 1 === $ ? q.colEnd = $ : (q = { colStart: $, rowStart: F, colEnd: $, rowEnd: F, value: E }, S.push(q))); } } else { if (p === "row") { l = !0; const V = d.attributes.r; if (F = parseInt(V) - 1, ht = 0, ft = d.attributes.customHeight, ft !== void 0 && (ht |= It.CustomHeight), ft !== Ut && (M = !0, Ut = ft), ut = d.attributes.ht, ut !== void 0 && (ht |= It.Ht), ut !== Dt && (M = !0, Dt = ut), mt = d.attributes.hidden, mt !== void 0 && (ht |= It.Hidden), mt !== Nt && (M = !0, Nt = mt), dt = d.attributes.s, dt !== void 0 && (ht |= It.S), dt !== Zt && (M = !0, Zt = dt), Q = d.attributes.customFormat, Q !== void 0 && (ht |= It.CustomFormat), Q !== Gt && (M = !0, Gt = Q), Tt = d.attributes.outlineLevel, Tt !== void 0 && (ht |= It.OutlineLevel), Tt !== D && (M = !0, D = Tt), St = d.attributes.collapsed, St !== void 0 && (ht |= It.Collapsed), St !== U && (M = !0, U = St), ht !== 0) if (Bt + 1 !== F || M) { const K = ft !== void 0 && (ft === "1" || ft === "true"), E = Q !== void 0 && (Q === "1" || Q === "true"); Lt = { min: F, max: F, sz: K && ut !== void 0 ? parseFloat(ut) : -1, csz: K, h: mt !== void 0 && (mt === "1" || mt === "true"), s: K && dt !== void 0 && dt !== "0" ? parseInt(dt) : 0, cs: E, l: Tt === void 0 || Tt === "0" ? 0 : parseInt(Tt), cl: St !== void 0 && (St === "1" || St === "true") }, Xt.push(Lt); } else Lt.max = F; return Bt = F, void (M = !1); } s?.onOpenTag(d); } }, onCloseTag: (d) => { if (gt) { let p = d.name; const J = p.indexOf(":"); if (J !== -1 && (p = p.slice(J + 1)), ct) if (p === "is" || p === "v") { const V = n?.onEnd(); V !== null && i.addValue(F, $, "" + V); } else n?.onCloseTag?.(d); return g && (g = !1), void (p === "c" && (gt = null, ct = !1)); } if (l) return l = !1, void (q = null); s?.onCloseTag(d); }, onText: (d) => { if (d = d.trim(), g) { switch (et = null, vt) { case null: case "n": et = parseFloat(d); break; case "b": et = d === "1" || d === "true"; break; case "s": et = d; break; case "e": if (d === "#VALUE!") { const J = gt.attributes.vm; if (J !== void 0) { const V = T[parseInt(J) - 1]; if (V && V.isFormulaError) { et = { t: Vt.Error, v: V.getCode() }; break; } } } const p = Ae.getBuiltInByLabel(d); p ? et = { t: Vt.Error, v: p.getCode() } : (et = d, o?.(`Unknown formula error '${d}' in cell ${wt.cellToString({ colIndex: $, rowIndex: F })}`)); break; case "str": case "inlineStr": ct = !0; } et !== null && i.addValue(F, $, et); } if (Z && (vt === "e" && (Z[1] = !0), W.push(Z), Z = null), x) if (A === x) u = f; else { if (u = H.get(x), !u) { const p = []; w = m(d, F, $, p), u = [w, p, d], H.set(x, u); } A = x, f = u; } if (b) { const p = []; w = m(d, F, $, p), u = [w, p, d]; } if (u) return I.append(F, $, u), u = null, b = !1, x = null, void (C = null); ct ? n?.onText(d) : l || s?.onText(d); } }; }, es = Object.freeze(Object.defineProperty({ __proto__: null, fromBufferXLSX: async (i, t) => { const { password: s, onWarning: o, createWorkbookOptions: n = {}, ...a } = t ?? {}, l = import("./B7xKwPc3dShIy-nn.mjs"), g = import("./DQLbhwTDnMxQTVoS.mjs"); let S = null; try { S = new DOMParser(); } catch { } let b = null; S || (b = import("./BGRzYPSFkaGgdzEZ.mjs").then((u) => u.i)); let x = null, C = null, w = null; try { const u = await Promise.all([l, g, b]); x = u[0], C = u[1], w = u[2]; } catch (u) { throw new Error("Unable to load XLSX parser.", { cause: u }); } try { const u = x.read(i, { type: "array", sheets: [], cellStyles: !1, bookFiles: !0 }); if (!u.Directory) throw new Error("Unable to parse as an Excel document. Try to save as '.xlsx' and try again."); u.Directory.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], u.Directory.richdata = ["/xl/richData/rdrichvalue.xml"]; const A = new C.FromOOXMLConverter(), f = S ?? new w.DOMParser(), T = n?.resources ?? new ye(), m = T.beginPersist(), I = {}, H = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Map(); W.set("richTypes", []); const Z = /* @__PURE__ */ new Map(), Ft = [], gt = (D) => u.files[D], ct = (D, U) => { const M = D.lastIndexOf("/"), q = D.substring(0, M + 1) + "_rels/" + D.substring(M + 1, D.length) + ".rels"; let d = U.get(q); return d || (d = ((p, J, V, K, E = null) => { if (!p) return null; const v = oe(p, J, V, K, E); if (!v) return null; const R = /* @__PURE__ */ new Map(), G = Object.keys(v), st = G.length; for (let it = 0; it < st; it++) { const Y = G[it], yt = v[Y]; R.set(Y, yt); } return R; })(q, gt, f, A, $), U.set(q, d)), d; }, F = (D, U, M, q = Z) => { let d = ct(U, q).get(D), p = d?.target; if (!p) return null; if (d.targetMode === "External") return d.target; const J = U.lastIndexOf("/"), V = U.substring(0, J + 1); p.startsWith("/") || (p = V + p), p = ((v) => { const R = v.split(/\/+/); return R.reduce((G, st, it) => (st === "." ? G.splice(it, 1) : st === ".." && G.splice(it - 1, 2), G), R).join("/"); })(p); const K = A?.getVisitorParamsState().get("dxfs"); let E = q.get(p); if (!E) if (d.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") { const v = {}; E = v; const R = async () => { const G = ((k, X, _t, ot, nt, at, kt) => { const h = new _e(), lt = new be.TransposedBuilder(); let _ = null; h.registerVisitor({ from: "autoFilter", to: "filter", openTag: (e) => { e.copyTo("ref", O); } }), h.registerVisitor({ from: "conditionalFormatting", to: {}, openTag: (e) => { const r = e.getParent(); r.conditionals || (r.conditionals = []), r.conditionals.push(e.getSource()); const c = e.getAttribute("sqref"); c && (e.getSource().ref = c.split(" ").join(",")), e.copyTo("pivot", P); }, closeTag: (e) => { const r = e.getSource(); if (r.rule) { const c = Object.keys(r.rule); for (let y = 0; y < c.length; y++) { const j = c[y]; j !== "rule" && (r[j] = r.rule[j]); } } delete r.rule; } }), h.registerVisitor({ from: "cfRule", to: "rule", openTag: (e) => { const r = e.getParent(); e.copyToObject(r, "type", O), e.copyToObject(r, "priority", L), e.copyToObject(r, "stopIfTrue", P); const c = e.getAttribute("dxfId", L); if (c !== null) { let y = ot?.get(c); y || (at?.(`Unable to load conditional color. Invalid dxfI: '${c}' at '${e.getPath()}'.`), y = {}), r.style = y; } e.copyToObject(r, "aboveAverage", P), e.copyToObject(r, "equalAverage", P), e.copyToObject(r, "stdDev", L), e.copyToObject(r, "bottom", P), e.copyToObject(r, "percent", P), e.copyToObject(r, "rank", L), e.copyToObject(r, "operator", O), e.copyToObject(r, "text", O), e.copyToObject(r, "timePeriod", O); } }), h.registerVisitor({ from: "colorScale", to: "colorScale" }), h.registerVisitor({ from: "dataBar", to: "dataBar", openTag: (e) => { e.copyTo("maxLength", L), e.copyTo("minLength", L), e.copyTo("showValue", P); } }), h.registerVisitor({ from: "iconSet", to: "iconSet", openTag: (e) => { e.copyTo("iconSet", O), e.copyTo("reverse", P), e.copyTo("showValue", P); } }), h.registerVisitor({ from: "formula", to: null, text: (e, r) => { const c = r.getParent(); let y = c.formulas; y || (y = [], c.formulas = y), y.push(e); } }), h.registerVisitor({ from: "cfvo", to: {}, openTag: (e) => { const r = e.getParent(); r.conditions || (r.conditions = []), r.conditions.push(e.getSource()), e.copyTo("type", O), e.copyTo("value", xt, "val"), e.copyTo("gte", P); } }), h.registerVisitor({ from: "color", to: {}, openTag: (e) => { const r = e.getParent(); r.colors || (r.colors = []); const c = ue((y) => e.get