@sheetxl/io
Version:
IO - Import/Export Libraries for SheetXL.
1,488 lines • 70.2 kB
JavaScript
import { NumberFormat as Nt, ScalarType as $t, IColor as Ce, Tuple as ke, IAutoFilter as Ft, AddressUtils as Tt, CoordUtils as ae, IRange as Ae, FormulaError as De, ResourceCollection as Ee, Theme as Pe, JSONStableStringify as Oe, Workbook as Ie, OutOfBoundsError as Ve } from "@sheetxl/sdk";
import { CommonUtils as oe, ExpectedError as Ne } from "@sheetxl/utils";
/**
* @license @sheetxl/io - IO - Import/Export Libraries for SheetXL. - v0.7.27
*
* (C) 2025-present SheetXL Inc. & Michael T. Ford
* License: The license can be found at https://www.sheetxl.com/license.
*/
const de = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", Le = new RegExp(`^[${de}][${`-${de}.0-9·̀-ͯ‿-⁀`}]*$`, "u"), Re = [32, 10, 13, 9];
function be(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 pe = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", $e = new RegExp(`^[${pe}][${`-${pe}.0-9·̀-ͯ‿-⁀`}]*$`, "u");
function xe(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 it = function(i) {
return i === 32 || i === 10 || i === 13 || i === 9;
}, Me = function(i) {
return i >= 32 && i <= 55295 || i === 10 || i === 13 || i === 9 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
}, Zt = be, ge = function(i) {
return be(i) || i >= 48 && i <= 57 || i === 45 || i === 46 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
}, we = Re, He = Le, je = function(i) {
return i >= 1 && i <= 55295 || i >= 57344 && i <= 65533 || i >= 65536 && i <= 1114111;
}, Fe = xe, Xe = function(i) {
return xe(i) || i === 45 || i === 46 || i >= 48 && i <= 57 || i === 183 || i >= 768 && i <= 879 || i >= 8255 && i <= 8256;
}, Be = $e, ie = "http://www.w3.org/XML/1998/namespace", _t = "http://www.w3.org/2000/xmlns/", We = { __proto__: null, xml: ie, xmlns: _t }, _e = { __proto__: null, amp: "&", gt: ">", lt: "<", quot: '"', apos: "'" }, N = -1, ft = -2, K = 13, Lt = 33, ut = 10, Pt = 60, Bt = 61, X = 62, z = 63, Wt = 93, se = (i) => i === 34 || i === 39, ve = [34, 39], qe = [...ve, 91, X], ze = [...ve, Pt, Wt], Ue = [Bt, z, ...we], Ge = [...we, X, 38, Pt];
function le(i, t, s) {
switch (t) {
case "xml":
s !== ie && i.fail(`xml prefix must be bound to ${ie}.`);
break;
case "xmlns":
s !== _t && i.fail(`xmlns prefix must be bound to ${_t}.`);
}
switch (s) {
case _t:
i.fail(t === "" ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${_t}.`);
break;
case ie:
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 Ze = (i) => Be.test(i), Je = (i) => He.test(i), fe = { 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 Qe {
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 = Fe, this.nameCheck = Xe, this.isName = Ze, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = { __proto__: null, ...We };
const o = this.opt.additionalNamespaces;
o != null && ((function(a, n) {
for (const c of Object.keys(n)) le(a, c, n[c]);
})(this, o), Object.assign(this.ns, o));
} else this.nameStartCheck = Zt, this.nameCheck = ge, this.isName = Je, 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 ? K : 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[fe[t]] = s;
}
off(t) {
this[fe[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.");
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 a = t.charCodeAt(o - 1);
!s && (a === 13 || a >= 55296 && a <= 56319) && (this.carriedFromPrevious = t[o - 1], o--, t = t.slice(0, o));
const { stateTable: n } = this;
for (this.chunk = t, this.i = 0; this.i < o; ) n[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 ut:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, ut;
case 13:
return t.charCodeAt(s + 1) === ut && (this.i = s + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, ft;
default:
return this.fail("disallowed character."), o;
}
}
if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
const a = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
return this.i = s + 2, a > 1114111 && this.fail("disallowed character."), a;
}
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 ut:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, ut;
case 13: {
const n = t.charCodeAt(s + 1);
n !== ut && n !== 133 || (this.i = s + 2);
}
case 133:
case 8232:
return this.line++, this.column = 0, this.positionAtNewLine = this.position, ft;
default:
return this.fail("disallowed character."), o;
}
}
if (o > 56319) return o >= 57344 && o <= 65533 || this.fail("disallowed character."), o;
const a = 65536 + 1024 * (o - 55296) + (t.charCodeAt(s + 1) - 56320);
return this.i = s + 2, a > 1114111 && this.fail("disallowed character."), a;
}
getCodeNorm() {
const t = this.getCode();
return t === ft ? ut : t;
}
unGet() {
this.i = this.prevI, this.column--;
}
captureTo(t) {
let { i: s } = this;
const { chunk: o } = this;
for (; ; ) {
const a = this.getCode(), n = a === ft, c = n ? ut : a;
if (c === N || t.includes(c)) return this.text += o.slice(s, this.prevI), c;
n && (this.text += `${o.slice(s, this.prevI)}
`, s = this.i);
}
}
captureToChar(t) {
let { i: s } = this;
const { chunk: o } = this;
for (; ; ) {
let a = this.getCode();
switch (a) {
case ft:
this.text += `${o.slice(s, this.prevI)}
`, s = this.i, a = ut;
break;
case N:
return this.text += o.slice(s), !1;
}
if (a === 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 (!ge(o)) return this.name += t.slice(s, this.prevI), o === ft ? ut : o;
}
}
skipSpaces() {
for (; ; ) {
const t = this.getCodeNorm();
if (t === N || !it(t)) return t;
}
}
setXMLVersion(t) {
this.currentXMLVersion = t, t === "1.0" ? (this.isChar = Me, this.getCode = this.getCode10) : (this.isChar = je, 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 Pt:
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 = K, this.xmlDeclPossible = !1;
}
}
sDoctype() {
const t = this.captureTo(qe);
switch (t) {
case X:
this.doctypeHandler?.(this.text), this.text = "", this.state = K, this.doctype = !0;
break;
case N:
break;
default:
this.text += String.fromCodePoint(t), t === 91 ? this.state = 4 : se(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(ze);
t !== N && (this.text += String.fromCodePoint(t), t === Wt ? this.state = 2 : t === Pt ? this.state = 6 : se(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 === X ? 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 === X && (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 ft:
this.entity += `${s.slice(t, this.prevI)}
`, t = this.i;
break;
case 59: {
const { entityReturnState: o } = this, a = this.entity + s.slice(t, this.prevI);
let n;
this.state = o, a === "" ? (this.fail("empty entity name."), n = "&;") : (n = this.parseEntity(a), this.entity = ""), o === K && this.textHandler === void 0 || (this.text += n);
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 = K, 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 !== X ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = K;
}
sCData() {
this.captureToChar(Wt) && (this.state = 21);
}
sCDataEnding() {
const t = this.getCodeNorm();
t === Wt ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
}
sCDataEnding2() {
const t = this.getCodeNorm();
switch (t) {
case X:
this.cdataHandler?.(this.text), this.text = "", this.state = K;
break;
case Wt:
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 || it(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 a = o === z;
a || it(o) ? this.piTarget === "xml" ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = a ? Lt : 27) : this.state = a ? 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 : it(t) || (this.text = String.fromCodePoint(t));
} else this.captureToChar(z) && (this.state = 26);
}
sPIEnding() {
const t = this.getCodeNorm();
if (t === X) {
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 = K;
} 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 = Lt;
}
sXMLDeclName() {
const t = this.captureTo(Ue);
if (t === z) return this.state = Lt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
if (it(t) || t === Bt) {
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 === Bt ? 30 : 29;
}
}
sXMLDeclEq() {
const t = this.getCodeNorm();
if (t === z) return this.state = Lt, void this.fail("XML declaration is incomplete.");
it(t) || (t !== Bt && this.fail("value required."), this.state = 30);
}
sXMLDeclValueStart() {
const t = this.getCodeNorm();
if (t === z) return this.state = Lt, void this.fail("XML declaration is incomplete.");
it(t) || (se(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 = Lt, 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 ? (it(t) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = Lt;
}
sXMLDeclEnding() {
this.getCodeNorm() === X ? (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 = K) : 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 X:
this.openTag();
break;
case 47:
this.state = 35;
break;
default:
it(t) || this.fail("disallowed character in tag name."), this.state = 36;
}
}
sOpenTagSlash() {
this.getCode() === X ? 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 === X ? this.openTag() : t === 47 ? this.state = 35 : this.fail("disallowed character in attribute name."));
}
sAttribName() {
const t = this.captureNameChars();
t === Bt ? this.state = 39 : it(t) ? this.state = 38 : t === X ? (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 Bt:
this.state = 39;
break;
default:
this.fail("attribute without value."), this.text = "", this.name = "", t === X ? this.openTag() : Zt(t) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
}
}
sAttribValue() {
const t = this.getCodeNorm();
se(t) ? (this.q = t, this.state = 40) : it(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 ut:
case ft:
case 9:
this.text += `${s.slice(o, this.prevI)} `, o = this.i;
break;
case Pt:
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();
it(t) ? this.state = 36 : t === X ? 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(Ge);
switch (t) {
case 38:
this.state = 14, this.entityReturnState = 42;
break;
case Pt:
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 === X ? this.openTag() : this.state = 36;
}
}
sCloseTag() {
const t = this.captureNameChars();
t === X ? this.closeTag() : it(t) ? this.state = 44 : t !== N && this.fail("disallowed character in closing tag.");
}
sCloseTagSawWhite() {
switch (this.skipSpaces()) {
case X:
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: a } = this;
t: for (; ; ) switch (this.getCode()) {
case Pt:
if (this.state = 15, a !== void 0) {
const { text: n } = this, c = o.slice(t, this.prevI);
n.length !== 0 ? (a(n + c), this.text = "") : c.length !== 0 && a(c);
}
s = 0;
break t;
case 38:
this.state = 14, this.entityReturnState = K, a !== void 0 && (this.text += o.slice(t, this.prevI)), s = 0;
break t;
case Wt:
switch (s) {
case 0:
s = 1;
break;
case 1:
s = 2;
break;
case 2:
break;
default:
throw new Error("impossible state");
}
break;
case X:
s === 2 && this.fail('the string "]]>" is disallowed in char data.'), s = 0;
break;
case ft:
a !== void 0 && (this.text += `${o.slice(t, this.prevI)}
`), t = this.i, s = 0;
break;
case N:
a !== 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 a = !1;
t: for (; ; ) {
const n = this.getCode();
switch (n) {
case Pt:
if (this.state = 15, o !== void 0) {
const { text: c } = this, g = s.slice(t, this.prevI);
c.length !== 0 ? (o(c + g), this.text = "") : g.length !== 0 && o(g);
}
break t;
case 38:
this.state = 14, this.entityReturnState = K, o !== void 0 && (this.text += s.slice(t, this.prevI)), a = !0;
break t;
case ft:
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:
it(n) || (a = !0);
}
}
a && (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: a } = this.qName(t), n = { name: t, prefix: o, local: a, value: s };
if (this.attribList.push(n), this.attributeHandler?.(n), o === "xmlns") {
const c = s.trim();
this.currentXMLVersion === "1.0" && c === "" && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[a] = c, le(this, a, c);
} else if (t === "xmlns") {
const c = s.trim();
this.topNS[""] = c, le(this, "", c);
}
}
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 !== K && 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 a = o.length - 1; a >= 0; a--) if (s = o[a].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), a = t.slice(0, s);
return (a === "" || o === "" || o.includes(":")) && this.fail(`malformed name: ${t}.`), { prefix: a, local: o };
}
processAttribsNS() {
const { attribList: t } = this, s = this.tag;
{
const { prefix: n, local: c } = this.qName(s.name);
s.prefix = n, s.local = c;
const g = s.uri = this.resolve(n) ?? "";
n !== "" && (n === "xmlns" && this.fail('tags may not have "xmlns" as prefix.'), g === "" && (this.fail(`unbound namespace prefix: ${JSON.stringify(n)}.`), s.uri = n));
}
if (t.length === 0) return;
const { attributes: o } = s, a = /* @__PURE__ */ new Set();
for (const n of t) {
const { name: c, prefix: g, local: k } = n;
let b, w;
g === "" ? (b = c === "xmlns" ? _t : "", w = c) : (b = this.resolve(g), b === void 0 && (this.fail(`unbound namespace prefix: ${JSON.stringify(g)}.`), b = g), w = `{${b}}${k}`), a.has(w) && this.fail(`duplicate attribute: ${w}.`), a.add(w), n.uri = b, o[c] = n;
}
this.attribList = [];
}
processAttribsPlain() {
const { attribList: t } = this, s = this.tag.attributes;
for (const { name: o, value: a } of t) s[o] !== void 0 && this.fail(`duplicate attribute: ${o}.`), s[o] = a;
this.attribList = [];
}
openTag() {
this.processAttribs();
const { tags: t } = this, s = this.tag;
s.isSelfClosing = !1, this.openTagHandler?.(s), t.push(s), this.state = K, 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 = K, this.name = "";
}
closeTag() {
const { tags: t, name: s } = this;
if (this.state = K, this.name = "", s === "") return this.fail("weird empty close tag."), void (this.text += "</>");
const o = this.closeTagHandler;
let a = t.length;
for (; a-- > 0; ) {
const n = this.tag = t.pop();
if (this.topNS = n.ns, o?.(n), n.name === s) break;
this.fail(`unexpected close tag: ${s}.`);
}
a === 0 ? this.closedRoot = !0 : a < 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 ce, vt;
(vt = ce || (ce = {})).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" }, vt.parseStream = async (i, t, s) => {
const o = new Qe({ position: !1, ...s });
let a;
if (t.onOpenTagStart && o.on(vt.Events.OpenTagStart, t.onOpenTagStart), t.onOpenTag && o.on(vt.Events.OpenTag, t.onOpenTag), t.onCloseTag && o.on(vt.Events.CloseTag, t.onCloseTag), t.onAttribute && o.on(vt.Events.Attribute, t.onAttribute), t.onText && o.on(vt.Events.Text, t.onText), t.onError && o.on(vt.Events.Error, t.onError), t.onEnd) {
t.onEnd;
const n = () => {
a = t.onEnd();
};
o.on(vt.Events.End, n);
}
for (; ; ) {
const { value: n, done: c } = await i.read();
if (c) break;
o.write(n);
}
return o.close(), a;
};
const E = (i) => i === !0 || i === "1" || i === "on" || i === "true" || i !== !1 && i !== "0" && i !== "off" && i !== "false" && null, V = (i) => {
const t = parseInt(i);
return isNaN(t) ? null : t;
}, mt = (i) => {
const t = parseFloat(i);
return isNaN(t) ? null : t;
}, O = null;
class Ke {
constructor() {
this._registeredVisitors = /* @__PURE__ */ new Map();
}
registerVisitor(t) {
this._registeredVisitors.set(t.from, t);
}
createEventHandler(t, s, o) {
const a = this._registeredVisitors, n = [];
let c = null, g = null, k = null, b = null;
const w = [], v = { key: null, source: t };
let T = null, I = !1;
const L = (l, p) => {
let m = k.attributes[l];
if (p) {
if (Array.isArray(p)) {
for (let $ = 0; $ < p.length; $++)
if (m == null || (m = p[$](m), m == null)) return;
} else if (m == null || (m = p(m), m == null)) return;
}
return m;
}, A = { getSource: () => T.source, setSource: (l) => {
T.source = l;
}, setKey: (l) => {
T.key = l;
}, getFrom: () => k, getAttribute: (l, p) => L(l, p) ?? null, hasAttribute: (l) => A.getAttribute(l) !== null, getParent: () => w[w.length - 2].source, getPath: () => {
const l = [];
for (let p = 0; p < n.length; p++) l.push(n[p].local);
return l.join("\\");
}, parseAttribute: L, copyToObject: (l, p, m, $) => {
const U = L($ ?? p, m);
U !== void 0 && (l[p] = U);
}, copyTo: (l, p, m) => {
const $ = L(m ?? l, p);
$ !== void 0 && (T.source[l] = $);
}, warn: (l) => {
o ? o?.(l) : console.warn(l);
} };
return { onOpenTag: (l) => {
let p = l.name;
const m = p.indexOf(":");
m !== -1 && (p = p.slice(m + 1));
const $ = a.get(p);
if (c = { local: p, visitor: $, tag: l, destination: null }, I) return n.push(c), g = p, void (k = l);
b = c?.visitor ?? null, $ && (T = n.length === 0 ? v : b?.to !== null ? { key: null, source: {} } : null, c.destination = T, T && w.push(T)), n.push(c), g = p, k = l, I = b?.to === null, b?.openTag?.(A);
}, onCloseTag: (l) => {
let p = l.name;
const m = p.indexOf(":");
if (m !== -1 && (p = p.slice(m + 1)), p !== g) throw new Error(`mismatch open/close tag: '${p}'/'${g}'`);
I || b?.closeTag?.(A);
const $ = n.pop() ?? null;
c = n[n.length - 1] ?? null;
const U = $?.destination;
if (U) {
w.pop(), T = w[w.length - 1] ?? v;
const ot = $.visitor;
ot && ot.to && U.source !== void 0 && (Array.isArray(ot.to) ? T.source.push ? T.source.push(U.source) : o?.(`Unable to parse array for ${ot.from} at ${A.getPath()}`) : U.key ? T.source[U.key] = U.source : typeof ot.to == "string" && (T.source[ot.to] = U.source));
}
g = c?.local ?? null, k = c?.tag ?? null, b = c?.visitor ?? null, I = !c?.destination;
}, onText: (l) => {
b?.text?.(l, A);
}, onEnd: s };
}
}
const me = (i, t, s, o = null) => {
if (!i) return null;
let a = i;
a.startsWith("/") && (a = a.substring(1));
let n = o?.parsedRefs?.get(i);
if (n !== void 0) return n;
const c = t(a);
if (!c) return null;
let g = c.content;
try {
s && (g = s(g));
} catch (k) {
console.warn(k);
}
return o?.parsedRefs?.set(i, g), g;
}, he = (i, t, s, o, a = null) => {
if (!i) return null;
let n = i;
n.startsWith("/") && (n = n.substring(1));
let c = a?.parsedRefs?.get(i);
if (c !== void 0) return c;
const g = t(n);
if (!g) return null;
const k = g.content;
try {
const b = new TextDecoder().decode(k), w = s.parseFromString(b, "text/xml"), v = o.convert(w, i, a);
return a?.parsedRefs?.set(i, v), v;
} catch (b) {
console.warn(b);
}
return null;
}, Xt = (i, t, s, o, a = null) => {
const n = /* @__PURE__ */ new Map();
let c = t.Directory[i];
const g = c ? c.length : 0;
for (let k = 0; k < g; k++) {
const b = c[k];
if (!b) continue;
let w = b;
w.startsWith("/") && (w = w.substring(1));
const v = he(w, (T) => t.files[T], s, o, a);
n.set(w, v);
}
return n;
}, Ye = async (i, t = 8388608) => {
await (async () => {
if (typeof ReadableStream > "u") if (typeof window > "u") {
const { ReadableStream: n } = await import("./D5Vtbt1qJyMIgK21.mjs");
globalThis.ReadableStream = n;
} else console.warn("Browser does not support ReadableStream; consider loading a polyfill.");
})();
const s = new TextDecoder("utf-8");
let o = 0;
const a = i instanceof Uint8Array ? i : new Uint8Array(i);
return new ReadableStream({ pull(n) {
if (o >= a.byteLength) return void n.close();
const c = a.subarray(o, Math.min(o + t, a.byteLength)), g = s.decode(c, { stream: o + t < a.byteLength });
n.enqueue(g), o += c.length;
} }).getReader();
}, ts = ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"], Te = (i, t = "dk1") => {
let s;
const o = i("auto");
o === void 0 || o !== "1" && o !== "true" || (s = t);
const a = i("indexed");
a && (s = `index${a}`);
const n = i("rgb");
n && (s = n.toLowerCase(), n.length !== 8 || n.startsWith("FF") || (s = "FF" + n.substring(2, n.length)));
const c = i("theme");
c && (s = ts[c]);
let g = i("tint");
if (g && (s += ` ${Ce.AdjustmentType.ETint} ${parseFloat(g)}`), s) return s;
}, es = (i) => i && i.replace(/^\{([\s\S]+)\}$/, "$1"), as = (i) => i ? oe.roundAccurately(parseFloat(i) / 12700, 4) : null, ls = (i) => i ? oe.roundAccurately(parseFloat(i) / 9525, 1) : null, cs = (i) => parseFloat(i) / 1e3, hs = (i) => parseFloat(i) / 6e4, ss = (i) => i === "true" || i === "1";
class Rt {
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 is = (i, t, s) => {
if (i[0].value[0] === i[1].value[0]) return t;
}, ye = { colStart: 0, colEnd: 0, rowStart: 0, rowEnd: 0 }, os = (i, t, s, o, a, n, c) => {
let g = !1, k = !1, b = [], w = !1, v = null, T = null, I = null, L = null, A = null, l = null;
const p = c?.get("richData") ?? [], m = Tt.normalizeA1ToR1C1, $ = ae.createConflatingRanges(), U = /* @__PURE__ */ new Map(), ot = [];
let St = null;
const Mt = ae.createConflatingRanges();
let Ct, dt = !1, j = -1, G = -1, Y = null, tt = null;
const kt = [];
let Ot = null, Jt = -2, at = 0, yt = "", bt = "", lt = "", pt = "", xt = "", J = "", ct = "", qt = "", Qt = "", re = "", It = "", Kt = "", Ht = "", Yt = "", ht = !0, y = null, B = !1, _ = !1, q = null, rt = 0;
return { ...s, onEnd: () => {
kt.length > 0 && (t.rows = kt);
let h = $.done(is);
const S = h.length;
if (S > 0) {
const C = new Array(S);
for (let x = 0; x < S; x++) {
const R = h[x], et = Tt.rangeToString(R), Z = R.value[1], gt = Tt.resolveRelativeToA1(Z, R.rowStart, R.colStart);
C[x] = [et, gt];
}
t.formulas = C;
}
const Q = Mt.done(!0), D = Q.length;
if (D > 0) {
const C = new Array(D);
for (let x = 0; x < D; x++) {
const R = Q[x], et = Tt.rangeToString(R);
C[x] = et;
}
t.volatile = C;
}
if (ot.length > 0 && (t.dynamicArray = [...ot]), b.length > 0) {
b.sort(ae.createRangeComparator(Ae.Orientation.Column));
const C = [];
let x = null, R = -1, et = -1, Z = -1, gt = -1, st = null;
const At = b.length;
At > 0 && (x = b[0], R = x.colStart, et = x.colEnd, Z = x.rowEnd, gt = x.value, C.push(x));
for (let P = 1; P < At; P++) st = b[P], gt !== st.value || R !== st.colStart || et !== st.colEnd || Z + 1 !== st.rowEnd ? (C.push(st), x = st, R = x.colStart, et = x.colEnd, Z = x.rowEnd, gt = x.value) : (Z = st.rowEnd, x.rowEnd = Z);
let zt = [];
for (let P = 0; P < C.length; P++) {
const M = C[P];
zt.push({ r: { colStart: M.colStart, colEnd: M.colEnd, rowStart: M.rowStart, rowEnd: M.rowEnd }, v: M.value });
}
t.directStyles = zt;
}
const W = i.build();
if (W) {
const C = W.tuples;
t.data = C;
}
s?.onEnd?.();
}, onOpenTag: (h) => {
let S = h.name;
const Q = S.indexOf(":");
if (Q !== -1 && (S = S.slice(Q + 1)), rt++, rt % 196608 == 0 && a(rt), Ct) {
const D = h.attributes;
switch (S) {
case "v":
k = !0;
break;
case "f":
switch (D.t ?? null) {
case null:
case "normal":
w = !0;
break;
case "shared":
const W = D.si;
T = D.ref, v = W;
break;
case "array":
w = !0, T = D.ref, St = [T, !1];
break;
case "datatable":
w = !0, T = D.ref, w = !0;
}
D.ca !== void 0 && Mt.append(j, G);
break;
case "is":
return void (dt = !0);
}
return void (dt && n?.onOpenTag(h));
}
if (g) {
if (S === "c") {
Ct = h;
const D = h.attributes.r;
G = Tt.fastStringToCol(D);
const W = h.attributes.t;
W === void 0 ? tt = null : (tt = W, tt === "str" && (dt = !0));
let C = h.attributes.s;
C === void 0 && (q !== null || _) && (C = "0"), C !== void 0 && (C = parseInt(C), y && y.value === C && y.colEnd + 1 === G ? y.colEnd = G : (y = { colStart: G, rowStart: j, colEnd: G, rowEnd: j, value: C }, b.push(y)));
}
} else {
if (S === "row") {
g = !0;
const D = h.attributes.r;
if (j = parseInt(D) - 1, at = 0, bt = h.attributes.customHeight, bt !== void 0 && (at |= Rt.CustomHeight), bt !== Qt && (ht = !0, Qt = bt), yt = h.attributes.ht, yt !== void 0 && (at |= Rt.Ht), yt !== qt && (ht = !0, qt = yt), lt = h.attributes.hidden, lt !== void 0 && (at |= Rt.Hidden), lt !== re && (ht = !0, re = lt), xt = h.attributes.s, xt !== void 0 && (at |= Rt.S), xt !== Kt && (ht = !0, Kt = xt), pt = h.attributes.customFormat, pt !== void 0 && (at |= Rt.CustomFormat), pt !== It && (ht = !0, It = pt), J = h.attributes.outlineLevel, J !== void 0 && (at |= Rt.OutlineLevel), J !== Ht && (ht = !0, Ht = J), ct = h.attributes.collapsed, ct !== void 0 && (at |= Rt.Collapsed), ct !== Yt && (ht = !0, Yt = ct), at !== 0) if (Jt + 1 !== j || ht) {
const W = bt !== void 0 && (bt === "1" || bt === "true");
q = pt !== void 0 && (pt === "1" || pt === "true") && xt !== void 0 ? xt : null, Ot = { min: j, max: j, sz: yt === void 0 ? -1 : parseFloat(yt), csz: W, h: lt !== void 0 && (lt === "1" || lt === "true"), s: q === null ? void 0 : q === "0" ? 0 : parseInt(q), l: J === void 0 || J === "0" ? 0 : parseInt(J), cl: ct !== void 0 && (ct === "1" || ct === "true") }, kt.push(Ot);
} else Ot.max = j;
return Jt = j, void (ht = !1);
}
if (!B && S === "sheetData") {
B = !0;
const D = t.cols, W = D ? D.length : 0;
for (let C = 0; !_ && C < W; C++)
D[C].s && (_ = !0);
}
s?.onOpenTag(h);
}
}, onCloseTag: (h) => {
if (Ct) {
let S = h.name;
const Q = S.indexOf(":");
if (Q !== -1 && (S = S.slice(Q + 1)), dt) if (S === "is" || S === "v") {
const D = n?.onEnd();
D !== null && i.addValue(j, G, "" + D);
} else n?.onCloseTag?.(h);
return k && (k = !1), void (S === "c" && (Ct = null, dt = !1));
}
if (g) return g = !1, void (y = null);
s?.onCloseTag(h);
}, onText: (h) => {
if (h = h.trim(), k) {
switch (Y = null, tt) {
case null:
case "n":
Y = parseFloat(h);
break;
case "b":
Y = h === "1" || h === "true";
break;
case "s":
Y = h;
break;
case "e":
if (h === "#VALUE!") {
const Q = Ct.attributes.vm;
if (Q !== void 0) {
const D = p[parseInt(Q) - 1];
if (D && D.isFormulaError) {
Y = { t: $t.Error, v: D.getCode() };
break;
}
}
}
const S = De.getBuiltInByLabel(h);
S ? Y = { t: $t.Error, v: S.getCode() } : (Y = h, o?.(`Unknown formula error '${h}' in cell ${Tt.cellToString({ colIndex: G, rowIndex: j })}`));
break;
case "str":
case "inlineStr":
dt = !0;
}
Y !== null && i.addValue(j, G, Y);
}
if (St && (tt === "e" && (St[1] = !0), ot.push(St), St = null), v) if (A === v) L = l;
else {
if (L = U.get(v), !L) {
const S = [];
I = m(h, j, G, S), L = [I, S, h], U.set(v, L);
}
A = v, l = L;
}
if (w) {
const S = [];
I = m(h, j, G, S), L = [I, S, h];
}
if (L) return $.append(j, G, L), L = null, w = !1, v = null, void (T = null);
dt ? n?.onText(h) : g || s?.onText(h);
} };
}, us = Object.freeze(Object.defineProperty({ __proto__: null, readBufferXLSX: async (i, t) => {
const { password: s, createWorkbookOptions: o = {}, ...a } = t ?? {}, n = [], c = t?.progress, g = c?.onProgress;
let k = 0;
const b = import("./BRD0wJRvRgFC749L.mjs"), w = import("./B1HyC93bLLGODj-k.mjs");
let v = null;
try {
v = new DOMParser();
} catch {
}
let T = null;
v || (T = import("./CzOyeDiJJmezSwjA.mjs").then((l) => l.i));
let I = null, L = null, A = null;
try {
const l = await Promise.all([b, w, T]);
I = l[0], L = l[1], A = l[2];
} catch (l) {
throw new Error("Unable to load XLSX parser.", { cause: l });
}
try {
const l = I.read(i, { type: "array", sheets: [], cellStyles: !1, bookFiles: !0 });
if (!l.Directory) throw new Ne("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
l.Directory.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], l.Directory.richdata = ["/xl/richData/rdrichvalue.xml"];
const p = new L.FromOOXMLConverter(), m = v ?? new A.DOMParser(), $ = o?.resources ?? new Ee(), U = $.beginPersist(), ot = {}, St = /* @__PURE__ */ new Set(), Mt = /* @__PURE__ */ new Map();
Mt.set("richTypes", []);
const Ct = /* @__PURE__ */ new Map(), dt = [], j = (y) => l.files[y], G = (y, B) => {
const _ = y.lastIndexOf("/"), q = y.substring(0, _ + 1) + "_rels/" + y.substring(_ + 1, y.length) + ".rels";
let rt = B.get(q);
return rt || (rt = ((h, S, Q, D, W = null) => {
if (!h) return null;
const C = he(h, S, Q, D, W);
if (!C) return null;
const x = /* @__PURE__ */ new Map(), R = Object.keys(C), et = R.length;
for (let Z = 0; Z < et; Z++) {
const gt = R[Z], st = C[gt];
x.set(gt, st);
}
return x;
})(q, j, m, p, tt), B.set(q, rt)), rt;
}, Y = (y, B, _, q = Ct) => {
let rt = G(B, q).get(y), h = rt?.target;
if (!h) return null;
if (rt.targetMode === "External") return rt.target;
const S = B.lastIndexOf("/"), Q = B.substring(0, S + 1);
h.startsWith("/") || (h = Q + h), h = ((C) => {
const x = C.split(/\/+/);
return x.reduce((R, et, Z) => (et === "." ? R.splice(Z, 1) : et === ".." && R.splice(Z - 1, 2), R), x).join("/");
})(h);
const D = p?.getVisitorParamsState().get("dxfs");
let W = q.get(h);
if (!W)
if (rt.type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
const x = {};
W = x;
const R = async () => {
const et = ((P, M, ne, Dt, wt, Et, jt, Ut) => {
const d = new Ke(), nt = new ke.TransposedBuilder();
let F = null;
d.registerVisitor({ from: "autoFilter", to: "filter", openTag: (e) => {
e.copyTo("ref", O);
} }), d.registerVisitor({ from: "conditionalFormatting", to: {}, openTag: (e) => {
const r = e.getParent();
r.conditionals || (r.conditionals = []), r.conditionals.push(e.getSource());
const u = e.getAttribute("sqref");
u && (e.getSource().ref = u.split(" ").join(",")), e.copyTo("pivot", E);
}, closeTag: (e) => {
const r = e.getSource();
if (r.rule) {
const u = Object.keys(r.rule);
for (let f = 0; f < u.length; f++) {
const H = u[f];
H !== "rule" && (r[H] = r.rule[H]);
}
}
delete r.rule;
} }), d.registerVisitor({ from: "cfRule", to: "rule", openTag: (e) => {
const r = e.getParent();
e.copyToObject(r, "type", O), e.copyToObject(r, "priority", V), e.copyToObject(r, "stopIfTrue", E);
const u = e.getAttribute("dxfId", V);
if (u !== null) {
let f = Dt?.get(u);
f || (Et?.(`Unable to load conditional color. Invalid dxfI: '${u}' at '${e.getPath()}'.`), f = {}), r.style = f;
}
e.copyToObject(r, "aboveAverage", E), e.copyToObject(r, "equalAverage", E), e.copyToObject(r, "stdDev", V), e.copyToObject(r, "bottom", E), e.copyToObject(r, "percent", E), e.copyToObject(r, "rank", V), e.copyToObject(r, "operator", O), e.copyToObject(r, "text", O), e.copyToObject(r, "timePeriod", O);
} }), d.registerVisitor({ from: "colorScale", to: "colorScale" }), d.registerVisitor({ from: "dataBar", to: "dataBar", openTag: (e) => {
e.copyTo("maxLength", V), e.copyTo("minLength", V), e.copyTo("showValue", E);
} }), d.registerVisitor({ from: "iconSet", to: "iconSet", openTag: (e) => {
e.copyTo("iconSet", O), e.copyTo("reverse", E), e.copyTo("showValue", E);
} }), d.registerVisitor({ from: "formula", to: null, text: (e, r) => {
const u = r.getParent();
let f = u.formulas;
f || (f = [], u.formulas = f), f.push(e);
} }), d.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", mt, "val"), e.copyTo("gte", E);
} }), d.registerVisitor({ from: "color", to: {}, openTag: (e) => {
const r = e.getParent();
r.colors || (r.colors = []);
const u = Te((f) => e.getAttribute(f));
r.colors.push(u);
} }), d.registerVisitor({ from: "filterColumn", to: "filterColumn", openTag: (e) => {
const r = e.getParent();
r.fields || (r.fields = []), r.fields.push(e.getSource()), e.copyTo("offset", V, "colId"), e.copyTo("hiddenButton", E), e.copyTo("showButton", E);
} }), d.registerVisitor({ from: "colorFilter", to: "colorFilter", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Color, e.copyTo("cellColor", E), e.copyTo("styleId", V, "dxfId");
} }), d.registerVisitor({ from: "dynamicFilter", to: "dynamicFilter", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Dynamic, e.copyTo("dynamicType", O, "type"), e.copyTo("val", mt), e.copyTo("maxVal", mt, "maxVal");
} }), d.registerVisitor({ from: "iconFilter", to: "iconFilter", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Icon, e.copyTo("iconId", V), e.copyTo("iconSet", O);
} }), d.registerVisitor({ from: "top10", to: "top10", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Top10, e.copyTo("filterVal", mt), e.copyTo("percent", E), e.copyTo("top", E), e.copyTo("val", mt);
} }), d.registerVisitor({ from: "filters", to: "filters", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Items, e.copyTo("blank", E), e.copyTo("calendarType", O);
} }), d.registerVisitor({ from: "dateGroupItem", to: "dateGroupItem", openTag: (e) => {
const r = e.getParent();
r.dateGroups || (r.dateGroups = []), r.dateGroups.push(e.getSource()), e.copyTo("group", O, "dateTimeGrouping"), e.copyTo("day", V), e.copyTo("hour", V), e.copyTo("minute", V), e.copyTo("month", V), e.copyTo("second", V), e.copyTo("year", V);
} }), d.registerVisitor({ from: "filter", to: "filter", openTag: (e) => {
const r = e.getParent();
r.items || (r.items = []), r.items.push(e.getAttribute("val", mt));
} }), d.registerVisitor({ from: "customFilters", to: "customFilters", openTag: (e) => {
const r = e.getParent();
r.criteria || (r.criteria = []), r.criteria.push(e.getSource()), e.getSource().type = Ft.Type.Custom, e.copyTo("and", E);
} }), d.registerVisitor({ from: "customFilter", to: "customFilter", openTag: (e) => {
const r = e.getParent();
r.filters || (r.filters = []), r.filters.push(e.getSource()), e.copyTo("operator", O), e.copyTo("value", mt, "val");
} }), d.registerVisitor({ from: "sortState", to: "sort", openTag: (e) => {
e.copyTo("ref", O);
} }), d.registerVisitor({ from: "sortCondition", to: "sortCondition", openTag: (e) => {
const r = e.getParent();
r.fields || (r.fields = []);
const u = e.getSource();
r.fields.push(u), e.copyTo("sortOn", O, "sortBy"), e.copyTo("dxfId", O, "sortBy"), e.copyTo("iconSet", O), e.copyTo("customList", O);
const f = e.getAttribute("ref");
if (f) {
const H = Tt.fastStringToRange(f, ye).colStart, Vt = Tt.fastStringToRange(r.ref, ye), ee = Vt.colStart;
u.offset = Vt ? H - ee : H;
}
u.reverse = e.getAttribute("descending", E) ?? !1;
} }), d.registerVisitor({ from: "AlternateContent", to: null });
const te = (e) => {
F = e.getSource(), e.copyTo("topLeft", O, "topLeftCell");
const r = ss(e.getAttribute("defaultGridColor")), u = e.getAttribute("colorId");
u === null || r || (e.getSource().gridLineColor = "index" + parseFloat(u)), e.copyTo("showZeros", E), e.copyTo("showFormulas", E), e.copyTo("zoomScale", V), e.copyTo("showRowHeaders", E, "showRowColHeaders"), e.copyTo("showColumnHeaders", E, "showRowColHeaders"), e.copyTo("showRowGridlines", E, "showGridLines"), e.copyTo("showColumnGridlines", E, "showGridLines");
};
d.registerVisitor({ from: "sheetView", to: "view", openTag: (e) => {
te(e);
}, closeTag: () => {
F = null;
} }), d.registerVisitor({ from: "customSheetViews", to: "customSheetViews", openTag: (e) => {
e.setSource([]);
} }), d.registerVisitor({ from: "customSheetView", to: [], openTag: (e) => {
te(e);
}, closeTag: () => {
F = null;
} }), d.registerVisitor({ from: "selection", to: "selection", openTag: (e) => {
if (!F) return;
e.copyTo("cell", O, "activeCell"), e.copyTo("rangeIndex", V, "activeCellId");
const r = e.getAttribute("activeCell"), u = e.getAttribute("sqref");
u && u !== r && (e.getSource().ranges = u.split(" "));
} }), d.registerVisitor({ from: "pane", to: "pane", openTag: (e) => {
if (F && e.getAttribute("state") === "frozen") {
const r = {};
F.freezePanes = r, e.copyToObject(r, "topLeft", O, "topLeftCell");
const u = F.topLeft ? Tt.fastStringToCell(F.topLeft) : { colIndex: 0, rowIndex: 0 }, f = { colIndex: 0, rowIndex: 0 };
e.copyToObject(f, "colIndex", V, "xSplit"), e.copyToObject(f, "rowIndex", V, "ySplit");
const H = { colIndex: u.colIndex + f.colIndex, rowIndex: u.rowIndex + f.rowIndex };
r.coords = Tt.cellToString(H);
}
} }), d.registerVisitor({ from: "tabColor", to: null, openTag: (e) => {
const r = Te((u) => e.getAttribute(u));
r && (P.tabColor = r);
} }), d.registerVisitor({ from: "pageSetUpPr", to: "pageSetUpPr", openTag: (e) => {
} }), d.registerVisitor({ from: "outlinePr", to: "outlinePr", openTag: (e) => {
} }), d.registerVisitor({ from: "pageMargins", to: "pageMargins", openTag: (e) => {
} }), d.registerVisitor({ from: "pageSetup", to: "pageSetup", openTag: (e) => {
} }), d.registerVisitor({ from: "printOptions", to: "printOptions", openTag: (e) => {
} }), d.registerVisitor({ from: "mergeCells", to: "merges", openTag: (e) => {
e.setSource([]);
} }), d.registerVisitor({ from: "mergeCell", to: [], openTag: (e) => {
const r = e.getAttribute("ref");
e.setSource(r);
} }), d.registerVisitor({ from: "hyperlinks", to: "hyperlinks", openTag: (e) => {
e.setSource([]);
} }), d.registerVisitor({ from: "hyperlink", to: [], openTag: (e) => {
const r = e.getAttribute("r:id"), u = e.getAttribute("ref");
if (!u) return void console.warn("No ref found for hyperlink");
e.setKey(u);
let f = r ? M(r) : "";
if (typeof f != "string") return void console.warn("Invalid address ", f);
const H = e.getAttribute("location");
f.endsWith("\\") && (f = f.substring(0, f.length - 1));
const Vt = e.getAttribute("location");
if (Vt && (H && H !== Vt && console.warn("display and location are different", H, Vt), f += "#" + Vt), !f) return void console.warn("No address found for hyperlink. r:id", r);
let ee;
const ue = e.getAttribute("tooltip");
ee = ue ? { address: f, tooltip: ue } : f, e.setSource({ r: u, v: ee });
} }), d.registerVisitor({ from: "drawing", to: "movables", openTag: (e) => {
const r = e.getAttribute("r:id");
if (!r) return;
const u = M(r);
u ? e.setSource(u.movables) : console.warn("no drawing found for rId", r);
} }), d.registerVisitor({ from: "tableParts", to: "tables", openTag: (e) => {
e.setSource([]);
} }), d.registerVisitor({ from: "tablePart", to: [], openTag: (e) => {
const r = e.getAttribute("r:id");
if (!r) return;
const u = M(r);
u ? e.setSource(u) : console.warn("no table found for rId", r);
} }), d.registerVisitor({ from: "worksheet", to: "worksheet", openTag: (e) => {
} }), d.registerVisitor({ from: "sheetProtection", to: "protection", openTag: (e) => {
let r = !1;
if (e.hasAttribute("sheet") && E(e.getAttribute("sheet")) && (r = !0), !r) return void e.setSource(void 0);
const u = (H) => H === !0 || H === "1" || H === "on" || H === "true" || H === !1 || H === "0" || H === "off" || H === "false" || null;
e.copyTo("autoFilter", u), e.copyTo("deleteColumns", u), e.copyTo("formatCells", u), e.copyTo("formatColumns", u), e.copyTo("formatRows", u), e.copyTo("insertColumns", u), e.copyTo("insertHyperlinks", u), e.copyTo("insertRows", u), e.copyTo("objects", u), e.copyTo("pivotTables", u), e.copyTo("scenarios", u), e.copyTo("selectUnlockedCells", u), e.copyTo("selectUnlockedCells", u), e.copyTo("sort", u);
const f = {};
e.copyToObject(f, "hash", O, "hashValue"), e.copyToObject(f, "algorithm", O, "algorithmName"), e.copyToObject(f, "salt", O, "saltValue"), e.copyToObject(f, "spinCount", V), Object.keys(f).length > 0 && (e.getSource().password = f);
} }), d.registerVisitor({ from: "protectedRanges", to: "protectedRanges", openTag: (e) => {
e.setSource({});
} }), d.registerVisitor({ from: "protectedRange", to: {}, openTag: (e) => {
const r = e.getAttribute("sqref");
e.setKey(r), e.copyTo("name"), e.copyTo("securityDescriptor");
const u = {};
e.copyToObject(u, "hash", O, "hashValue"), e.copyToObject(u, "algorithm", O, "algorithmName"), e.copyToObject(u, "salt", O, "saltValue"), e.copyToObject(u, "spinCount", V), Object.keys(u).length > 0 && (e.getSource().password = u);
} }), d.registerVisitor({ from: "sheetFormatPr", to: "sheetFormatPr", openTag: (e) => {
e.copyToObject(P, "defaultColSize", mt, "defaultColWidth"), e.copyToObject(P, "outlineLevelCol", V, "outlineLevelCol");
const r = e.getAttribute("customHeight");
r !== "1" && r !== "true" || e.copyToObject(P, "defaultRowSize", mt, "defaultRowHeight"), e.copyToObject(P, "outlineLevelRow", V, "outlineLevelRow");
} }), d.registerVisitor({ from: "cols", to: "cols", openTag: (e) => {
e.setSource([]);
} }), d.registerVisitor({ from: "col", to: [], openTag: (e) => {
e.copyTo("min", (r) => parseInt(r) - 1), e.copyTo("max", (r) => parseInt(r) - 1), e.copyTo("sz", mt, "width"), e.copyTo("csz", E, "customWidth"), e.copyTo("h", E, "hidden"), e.copyTo("l", V, "outlineLevel"), e.copyTo("s", V, "style");
} }), d.registerVisitor({ from: "oleObjects", to: null, openTag: (e) => {
e.warn("'OLE Objects' are not supported.");
} });
let Gt = null;
const Se = { onOpenTag: (e) => {
Gt === null && (Gt = "");
}, onText: (e) => {
Gt += e;
}, onEnd: () => {
const e = ne(Gt);
return Gt = null, e;
}, onError: (e) => {
} };
return os(nt, P, d.createEventHandler(P, wt, Et), Et, jt, Se, Ut);
})(x, (P, M = !1) => Y(P, h, M) ?? null, bt, D, () => {
}, (P, M) => {
M = M ? `${M} (${h})` : h, n.push([P, M]);
}, (P) => {
k += P, g?.(k);
}, Mt), Z = me(h, j), gt = await Ye(Z);
try {
await ce.parseStream(gt, et, { xmlns: !1 });
} catch (P) {
throw console.warn(`Error parsing sheet: '${h}'`, P), new Error(`Error parsing sheet: '${h}'`, { cause: P });
}
const st = G(h, q);
let At, zt = /* @__PURE__ */ new Map();
if (st) {
const P = "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment";
let M;
st.forEach((Dt, wt) => {
Dt.type === P && (At = Y(wt, h, !1, q)?.comments, At && At.forEach((jt) => {
zt.set(jt.id, jt);
}));
});
const ne = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
if (st.forEach((Dt, wt) => {
Dt.type === ne && (M = Y(wt, h, !1, q));
}), M || At) {
const Dt = At ?? [], wt = M?.comments;
if (wt) {
const Et = M?.authors, jt = wt.length;
for (let Ut = 0; Ut < jt; Ut++) {
const d = wt[Ut];
if (!d) continue;
let nt = Et && d.authorId !== void 0 ? Et[d.authorId] : d.authorId;
if (nt && nt.startsWith("tc=") && (nt = es(nt.substring(3)), zt.has(nt))) continue;
let F = null;
nt && (F = lt.get(nt)), F || (F = pt.get(nt)), F || (F = { id: oe.uuidV4(), displayName: nt }, pt.set(F.displayName, F), lt.set(F.id, F)), nt = F?.id ?? null;
const te = { id: oe.uuidV4(), personId: nt, ref: d.ref, done: !1, asNote: !0, content: d.content };
Dt.push(te);
}
}
x.comments = Dt;
}
}
};
dt.push(R());
} else W = _ ? me(h, j, (x) => {
const R = $.add({ buffer: x });
return R.addReference(ot), St.add(R), U.toResourceId(R);
}, tt) : he(h, j, m, p, tt);
return W;
}, tt = { paramMap: Mt, getRefs: G, getRef: Y, parsedRefs: Ct, addPerson: (y) => null }, kt = [];
let Ot = 0;
l.Strings && (Ot = parseInt(l.Strings.Unique ?? l.Strings.length ?? 0));
const Jt = l.Strings ?? [];
for (let y = 0; y < Ot; y++) kt.push(Jt[y]?.t ?? "");
const at = /* @__PURE__ */ new Map();
let yt = Ot;
const bt = (y) => {
const B = at.get(y);
if (B !== void 0) return B;
const _ = yt;
return at.set(y, yt++), kt.push(y), _;
}, lt = (Xt("richstructure", l, m, p, tt), Xt("richdata", l, m, p, tt), /* @__PURE__ */ new Map()), pt = /* @__PURE__ */ new Map(), xt = Xt("people", l, m, p);
let J = null;
if (xt.size > 0 && (J = xt.entries().next()?.value?.[1]?.persons, J)) {
const y = J.length;
for (let B = 0; B < y; B++) {
const _ = J[B];
lt.set(_.id, _), lt.set(_.displayName, _);
}
}
const ct = Xt("themes", l, m, p, tt);
let qt = null;
if (ct && ct.entries) {
let y = ct.entries().next();
y?.value?.[1] && (qt = y.value[1]);
}
const Qt = new Pe(qt);
let It = Xt("styles", l, m, p, tt).entries().next()?.value[1];
It && (It = JSON.parse(Oe(It)));
const Kt = Xt("workbooks", l, m, p, tt);
await Promise.all(dt);
const Ht = { ...Kt.entries().next().value[1], styles: It, theme: Qt.toJSON() };
kt.length > 0 && (Ht.strings = kt), J && J.length > 0 && (Ht.people = J);
const Yt = { ...o, resources: $, json: Ht }, ht = new Ie(Yt);
if (St.forEach((y) => {
y.deleteReference(ot);
}), U.endPersist(), n.length) {
const y = c?.onWarning;
if (y) for (const B of n) {
const [_, q] = B;
y(_, q);
}
}
return ht;
} catch (l) {
let p = "Unable to parse XLSX.";
throw l instanceof Ve && (p = "Unable to open XLSX. There are too many rows or columns."), new Error(p, { cause: l });
}
}, writeBufferXLSX: async (i, t) => {
const s = await import("./BRD0wJRvRgFC749L.mjs"), o = await i.toJSON(!0), a = s.utils.book_new();
for (let n = 0; n < o.sheets.length; n++) {
const c = o.sheets[n], g = s.utils.json_to_sheet([{}]);
s.utils.book_append_sheet(a, g, c.name);
const k = c.sheet, b = i.getSheetAt(n), w = b.getUsedRange();
if (w ? (g["!ref"] = w.getA1(), w.forEach((v, T) => {
const I = { t: "z" }, L = T.getCell().getStyle();
if (!L.isNormal()) {
let A = L.getNumberFormat();
A !== Nt.Type.General && (A === Nt.Type.ShortDate ? A = "m/d/yyyy" : A === Nt.Type.MediumDate ? A = "d-mmm-yy" : A === Nt.Type.LongDate ? A = "[$-x-sysdate]dddd, mmmm dd, yyyy" : A === Nt.Type.ShortTime ? A = "h:mm" : A === Nt.Type.MediumTime ? A = "h:mm AM/PM" : A === Nt.Type.LongTime && (A = "h:mm:ss AM/PM"), I.z = A);
}
if (v !== null) switch (T.getType()) {
case $t.Number:
I.t = "n", I.v = v;
break;
case $t.String:
I.t = "s", I.v = v;
break;
case $t.Boolean:
I.t = "b", I.v = v;
break;
case $t.Error:
I.t = "e", I.v = v.toString();
case $t.RichData:
}
g[T.getA1()] = I;
})) : g["!ref"] = "A1:A1", k.merges?.length > 0) {
const v = [];
g["!merges"] = v;
for (let T = 0; T < k.merges.length; T++) v.push(s.utils.decode_range(k.merges[T]));
}
if (k.cols?.length > 0) {
const v = [];
g["!cols"] = v;
const T = k.cols, I = { width: k.defaultColSize ?? b.getColumnWidthAsFontUnit(b.getColumnHeaders().getDefaultSize()) }, L = T.length;
for (let A = 0; A < L; A++) {
const l = T[A];
for (let m = v.length; m <= l.min - 1; m++) v.push(I);
const p = {};
l.sz !== void 0 && (p.width = l.sz), l.h !== void 0 && (p.hidden = l.h), l.l !== void 0 && (p.level = l.l);
for (let m = l.min; m <= l.max; m++) v.push(p);
}
}
}
return s.write(a, { type: "array", bookType: "xlsx" }), s.write(a, { type: "array", bookType: "xlsx" });
} }, Symbol.toStringTag, { value: "Module" }));
export {
us as H,
cs as a,
ss as b,
ls as c,
Te as d,
hs as p,
es as r,
as as t
};