@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
1,015 lines (1,014 loc) • 101 kB
JavaScript
/**
* @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.
*/
var nr, _ = {}, te = {};
function ke() {
if (nr) return te;
function S(a, h) {
return h === void 0 && (h = Object), h && typeof h.getOwnPropertyDescriptors == "function" && (a = h.create(null, h.getOwnPropertyDescriptors(a))), h && typeof h.freeze == "function" ? h.freeze(a) : a;
}
function c(a, h) {
return Object.prototype.hasOwnProperty.call(a, h);
}
nr = 1;
var A = S({ allowfullscreen: !0, async: !0, autofocus: !0, autoplay: !0, checked: !0, controls: !0, default: !0, defer: !0, disabled: !0, formnovalidate: !0, hidden: !0, ismap: !0, itemscope: !0, loop: !0, multiple: !0, muted: !0, nomodule: !0, novalidate: !0, open: !0, playsinline: !0, readonly: !0, required: !0, reversed: !0, selected: !0 }), R = S({ area: !0, base: !0, br: !0, col: !0, embed: !0, hr: !0, img: !0, input: !0, link: !0, meta: !0, param: !0, source: !0, track: !0, wbr: !0 }), g = S({ script: !1, style: !1, textarea: !0, title: !0 });
function m(a) {
return a === H.HTML;
}
var H = S({ HTML: "text/html", XML_APPLICATION: "application/xml", XML_TEXT: "text/xml", XML_XHTML_APPLICATION: "application/xhtml+xml", XML_SVG_IMAGE: "image/svg+xml" }), J = Object.keys(H).map(function(a) {
return H[a];
}), Q = S({ HTML: "http://www.w3.org/1999/xhtml", SVG: "http://www.w3.org/2000/svg", XML: "http://www.w3.org/XML/1998/namespace", XMLNS: "http://www.w3.org/2000/xmlns/" });
return te.assign = function(a, h) {
if (a === null || typeof a != "object") throw new TypeError("target is not an object");
for (var p in h) c(h, p) && (a[p] = h[p]);
return a;
}, te.find = function(a, h, p) {
if (p === void 0 && (p = Array.prototype), a && typeof p.find == "function") return p.find.call(a, h);
for (var oe = 0; oe < a.length; oe++) if (c(a, oe)) {
var U = a[oe];
if (h.call(void 0, U, oe, a)) return U;
}
}, te.freeze = S, te.HTML_BOOLEAN_ATTRIBUTES = A, te.HTML_RAW_TEXT_ELEMENTS = g, te.HTML_VOID_ELEMENTS = R, te.hasDefaultHTMLNamespace = function(a) {
return m(a) || a === H.XML_XHTML_APPLICATION;
}, te.hasOwn = c, te.isHTMLBooleanAttribute = function(a) {
return c(A, a.toLowerCase());
}, te.isHTMLRawTextElement = function(a) {
var h = a.toLowerCase();
return c(g, h) && !g[h];
}, te.isHTMLEscapableRawTextElement = function(a) {
var h = a.toLowerCase();
return c(g, h) && g[h];
}, te.isHTMLMimeType = m, te.isHTMLVoidElement = function(a) {
return c(R, a.toLowerCase());
}, te.isValidMimeType = function(a) {
return J.indexOf(a) > -1;
}, te.MIME_TYPE = H, te.NAMESPACE = Q, te;
}
var or, Ue = {};
function Xe() {
if (or) return Ue;
function S(a, h) {
a.prototype = Object.create(Error.prototype, { constructor: { value: a }, name: { value: a.name, enumerable: !0, writable: h } });
}
or = 1;
var c = ke().freeze({ Error: "Error", IndexSizeError: "IndexSizeError", DomstringSizeError: "DomstringSizeError", HierarchyRequestError: "HierarchyRequestError", WrongDocumentError: "WrongDocumentError", InvalidCharacterError: "InvalidCharacterError", NoDataAllowedError: "NoDataAllowedError", NoModificationAllowedError: "NoModificationAllowedError", NotFoundError: "NotFoundError", NotSupportedError: "NotSupportedError", InUseAttributeError: "InUseAttributeError", InvalidStateError: "InvalidStateError", SyntaxError: "SyntaxError", InvalidModificationError: "InvalidModificationError", NamespaceError: "NamespaceError", InvalidAccessError: "InvalidAccessError", ValidationError: "ValidationError", TypeMismatchError: "TypeMismatchError", SecurityError: "SecurityError", NetworkError: "NetworkError", AbortError: "AbortError", URLMismatchError: "URLMismatchError", QuotaExceededError: "QuotaExceededError", TimeoutError: "TimeoutError", InvalidNodeTypeError: "InvalidNodeTypeError", DataCloneError: "DataCloneError", EncodingError: "EncodingError", NotReadableError: "NotReadableError", UnknownError: "UnknownError", ConstraintError: "ConstraintError", DataError: "DataError", TransactionInactiveError: "TransactionInactiveError", ReadOnlyError: "ReadOnlyError", VersionError: "VersionError", OperationError: "OperationError", NotAllowedError: "NotAllowedError", OptOutError: "OptOutError" }), A = Object.keys(c);
function R(a) {
return typeof a == "number" && a >= 1 && a <= 25;
}
function g(a, h) {
var p;
R(a) ? (this.name = A[a], this.message = h || "") : (this.message = a, this.name = typeof (p = h) == "string" && p.substring(p.length - c.Error.length) === c.Error ? h : c.Error), Error.captureStackTrace && Error.captureStackTrace(this, g);
}
S(g, !0), Object.defineProperties(g.prototype, { code: { enumerable: !0, get: function() {
var a = A.indexOf(this.name);
return R(a) ? a : 0;
} } });
for (var m = { INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 }, H = Object.entries(m), J = 0; J < H.length; J++) g[H[J][0]] = H[J][1];
function Q(a, h) {
this.message = a, this.locator = h, Error.captureStackTrace && Error.captureStackTrace(this, Q);
}
return S(Q), Ue.DOMException = g, Ue.DOMExceptionName = c, Ue.ExceptionCode = m, Ue.ParseError = Q, Ue;
}
var ar, ir, $ = {}, O = {};
function fr() {
if (ar) return O;
function S(k) {
try {
typeof k != "function" && (k = RegExp);
var V = new k("𝌆", "u").exec("𝌆");
return !!V && V[0].length === 2;
} catch {
}
return !1;
}
ar = 1;
var c = S();
function A(k) {
if (k.source[0] !== "[") throw new Error(k + " can not be used with chars");
return k.source.slice(1, k.source.lastIndexOf("]"));
}
function R(k, V) {
if (k.source[0] !== "[") throw new Error("/" + k.source + "/ can not be used with chars_without");
if (!V || typeof V != "string") throw new Error(JSON.stringify(V) + " is not a valid search");
if (k.source.indexOf(V) === -1) throw new Error('"' + V + '" is not is /' + k.source + "/");
if (V === "-" && k.source.indexOf(V) !== 1) throw new Error('"' + V + '" is not at the first postion of /' + k.source + "/");
return new RegExp(k.source.replace(V, ""), c ? "u" : "");
}
function g(k) {
var V = this;
return new RegExp(Array.prototype.slice.call(arguments).map(function(se) {
var be = typeof se == "string";
if (be && V === void 0 && se === "|") throw new Error("use regg instead of reg to wrap expressions with `|`!");
return be ? se : se.source;
}).join(""), c ? "mu" : "m");
}
function m(k) {
if (arguments.length === 0) throw new Error("no parameters provided");
return g.apply(m, ["(?:"].concat(Array.prototype.slice.call(arguments), [")"]));
}
var H = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;
c && (H = g("[", A(H), "\\u{10000}-\\u{10FFFF}", "]"));
var J = /[\x20\x09\x0D\x0A]/, Q = A(J), a = g(J, "+"), h = g(J, "*"), p = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
c && (p = g("[", A(p), "\\u{10000}-\\u{10FFFF}", "]"));
var oe = g("[", A(p), A(/[-.0-9\xB7]/), A(/[\u0300-\u036F\u203F-\u2040]/), "]"), U = g(p, oe, "*"), W = g(oe, "+"), me = g("&", U, ";"), ce = m(/&#[0-9]+;|&#x[0-9a-fA-F]+;/), le = m(me, "|", ce), ae = g("%", U, ";"), l = m(g('"', m(/[^%&"]/, "|", ae, "|", le), "*", '"'), "|", g("'", m(/[^%&']/, "|", ae, "|", le), "*", "'")), y = m('"', m(/[^<&"]/, "|", le), "*", '"', "|", "'", m(/[^<&']/, "|", le), "*", "'"), o = g(R(p, ":"), R(oe, ":"), "*"), i = g(o, m(":", o), "?"), d = g("^", i, "$"), N = g("(", i, ")"), T = m(/"[^"]*"|'[^']*'/), u = g(/^<\?/, "(", U, ")", m(a, "(", H, "*?)"), "?", /\?>/), D = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/, E = m('"', D, '*"', "|", "'", R(D, "'"), "*'"), w = "<!--", I = g(w, m(R(H, "-"), "|", g("-", R(H, "-"))), "*", "-->"), f = "#PCDATA", F = m(g(/\(/, h, f, m(h, /\|/, h, i), "*", h, /\)\*/), "|", g(/\(/, h, f, h, /\)/)), C = m("EMPTY", "|", "ANY", "|", F, "|", g(/\([^>]+\)/, /[?*+]?/)), ne = g("<!ELEMENT", a, m(i, "|", ae), a, m(C, "|", ae), h, ">"), M = g("NOTATION", a, /\(/, h, U, m(h, /\|/, h, U), "*", h, /\)/), Ee = g(/\(/, h, W, m(h, /\|/, h, W), "*", h, /\)/), j = m(M, "|", Ee), q = m(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", j), ee = m(/#REQUIRED|#IMPLIED/, "|", m(m("#FIXED", a), "?", y)), G = g("<!ATTLIST", a, U, m(a, U, a, q, a, ee), "*", h, ">"), Y = "about:legacy-compat", ve = m('"' + Y + '"', "|", "'" + Y + "'"), Ne = "SYSTEM", de = "PUBLIC", v = m(m(Ne, a, T), "|", m(de, a, E, a, T)), Te = g("^", m(m(Ne, a, "(?<SystemLiteralOnly>", T, ")"), "|", m(de, a, "(?<PubidLiteral>", E, ")", a, "(?<SystemLiteral>", T, ")"))), fe = m(a, "NDATA", a, U), ie = "<!ENTITY", xe = g(ie, a, U, a, m(l, "|", m(v, fe, "?")), h, ">"), ye = m(l, "|", v), De = m(xe, "|", g(ie, a, "%", a, U, a, ye, h, ">")), ue = g(de, a, E), X = g("<!NOTATION", a, U, a, m(v, "|", ue), h, ">"), ge = g(h, "=", h), Se = /1[.]\d+/, Re = g(a, "version", ge, m("'", Se, "'", "|", '"', Se, '"')), Ie = /[A-Za-z][-A-Za-z0-9._]*/, Ae = g(/^<\?xml/, Re, m(a, "encoding", ge, m('"', Ie, '"', "|", "'", Ie, "'")), "?", m(a, "standalone", ge, m("'", m("yes", "|", "no"), "'", "|", '"', m("yes", "|", "no"), '"')), "?", h, /\?>/), L = g(H, "*?", /\]\]>/), K = g(/<!\[CDATA\[/, L);
return O.chars = A, O.chars_without = R, O.detectUnicodeSupport = S, O.reg = g, O.regg = m, O.ABOUT_LEGACY_COMPAT = Y, O.ABOUT_LEGACY_COMPAT_SystemLiteral = ve, O.AttlistDecl = G, O.CDATA_START = "<![CDATA[", O.CDATA_END = "]]>", O.CDSect = K, O.Char = H, O.Comment = I, O.COMMENT_START = w, O.COMMENT_END = "-->", O.DOCTYPE_DECL_START = "<!DOCTYPE", O.elementdecl = ne, O.EntityDecl = De, O.EntityValue = l, O.ExternalID = v, O.ExternalID_match = Te, O.Name = U, O.NotationDecl = X, O.Reference = le, O.PEReference = ae, O.PI = u, O.PUBLIC = de, O.PubidLiteral = E, O.QName = i, O.QName_exact = d, O.QName_group = N, O.S = a, O.SChar_s = Q, O.S_OPT = h, O.SYSTEM = Ne, O.SystemLiteral = T, O.UNICODE_REPLACEMENT_CHARACTER = "�", O.UNICODE_SUPPORT = c, O.XMLDecl = Ae, O;
}
function hr() {
if (ir) return $;
ir = 1;
var S = ke(), c = S.find, A = S.hasDefaultHTMLNamespace, R = S.hasOwn, g = S.isHTMLMimeType, m = S.isHTMLRawTextElement, H = S.isHTMLVoidElement, J = S.MIME_TYPE, Q = S.NAMESPACE, a = Symbol(), h = Xe(), p = h.DOMException, oe = h.DOMExceptionName, U = fr();
function W(e) {
if (e !== a) throw new TypeError("Illegal constructor");
}
function me(e) {
return e !== "";
}
function ce(e, r) {
return R(e, r) || (e[r] = !0), e;
}
function le(e) {
if (!e) return [];
var r, t = (r = e) ? r.split(/[\t\n\f\r ]+/).filter(me) : [];
return Object.keys(t.reduce(ce, {}));
}
function ae(e) {
if (!U.QName_exact.test(e)) throw new p(p.INVALID_CHARACTER_ERR, 'invalid character in qualified name "' + e + '"');
}
function l(e, r) {
ae(r), e = e || null;
var t = null, n = r;
if (r.indexOf(":") >= 0) {
var s = r.split(":");
t = s[0], n = s[1];
}
if (t !== null && e === null) throw new p(p.NAMESPACE_ERR, "prefix is non-null and namespace is null");
if (t === "xml" && e !== S.NAMESPACE.XML) throw new p(p.NAMESPACE_ERR, 'prefix is "xml" and namespace is not the XML namespace');
if ((t === "xmlns" || r === "xmlns") && e !== S.NAMESPACE.XMLNS) throw new p(p.NAMESPACE_ERR, 'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');
if (e === S.NAMESPACE.XMLNS && t !== "xmlns" && r !== "xmlns") throw new p(p.NAMESPACE_ERR, 'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');
return [e, t, n];
}
function y(e, r) {
for (var t in e) R(e, t) && (r[t] = e[t]);
}
function o(e, r) {
var t = e.prototype;
if (!(t instanceof r)) {
let n = function() {
};
n.prototype = r.prototype, y(t, n = new n()), e.prototype = t = n;
}
t.constructor != e && (typeof e != "function" && console.error("unknown Class:" + e), t.constructor = e);
}
var i = {}, d = i.ELEMENT_NODE = 1, N = i.ATTRIBUTE_NODE = 2, T = i.TEXT_NODE = 3, u = i.CDATA_SECTION_NODE = 4, D = i.ENTITY_REFERENCE_NODE = 5, E = i.ENTITY_NODE = 6, w = i.PROCESSING_INSTRUCTION_NODE = 7, I = i.COMMENT_NODE = 8, f = i.DOCUMENT_NODE = 9, F = i.DOCUMENT_TYPE_NODE = 10, C = i.DOCUMENT_FRAGMENT_NODE = 11, ne = i.NOTATION_NODE = 12, M = S.freeze({ DOCUMENT_POSITION_DISCONNECTED: 1, DOCUMENT_POSITION_PRECEDING: 2, DOCUMENT_POSITION_FOLLOWING: 4, DOCUMENT_POSITION_CONTAINS: 8, DOCUMENT_POSITION_CONTAINED_BY: 16, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32 });
function Ee(e, r) {
if (r.length < e.length) return Ee(r, e);
var t = null;
for (var n in e) {
if (e[n] !== r[n]) return t;
t = e[n];
}
return t;
}
function j(e) {
return e.guid || (e.guid = Math.random()), e.guid;
}
function q() {
}
function ee(e, r) {
this._node = e, this._refresh = r, G(this);
}
function G(e) {
var r = e._node._inc || e._node.ownerDocument._inc;
if (e._inc !== r) {
var t = e._refresh(e._node);
if (rr(e, "length", t.length), !e.$$length || t.length < e.$$length) for (var n = t.length; n in e; n++) R(e, n) && delete e[n];
y(t, e), e._inc = r;
}
}
function Y() {
}
function ve(e, r) {
for (var t = 0; t < e.length; ) {
if (e[t] === r) return t;
t++;
}
}
function Ne(e, r, t) {
var n = ve(r, t);
if (n >= 0) {
for (var s = r.length - 1; n <= s; ) r[n] = r[++n];
if (r.length = s, e) {
var b = e.ownerDocument;
b && xe(b, e, t), t.ownerElement = null;
}
}
}
function de() {
}
function v(e) {
W(e);
}
function Te(e) {
return (e == "<" ? "<" : e == ">" && ">") || e == "&" && "&" || e == '"' && """ || "&#" + e.charCodeAt() + ";";
}
function fe(e, r) {
if (r(e)) return !0;
if (e = e.firstChild) do
if (fe(e, r)) return !0;
while (e = e.nextSibling);
}
function ie(e, r) {
W(e);
var t = r || {};
this.ownerDocument = this, this.contentType = t.contentType || J.XML_APPLICATION, this.type = g(this.contentType) ? "html" : "xml";
}
function xe(e, r, t, n) {
e && e._inc++, t.namespaceURI === Q.XMLNS && delete r._nsMap[t.prefix ? t.localName : ""];
}
function ye(e, r, t) {
if (e && e._inc) {
e._inc++;
var n = r.childNodes;
if (t && !t.nextSibling) n[n.length++] = t;
else {
for (var s = r.firstChild, b = 0; s; ) n[b++] = s, s = s.nextSibling;
n.length = b, delete n[n.length];
}
}
}
function De(e, r) {
if (e !== r.parentNode) throw new p(p.NOT_FOUND_ERR, "child's parent is not parent");
var t = r.previousSibling, n = r.nextSibling;
return t ? t.nextSibling = n : e.firstChild = n, n ? n.previousSibling = t : e.lastChild = t, ye(e.ownerDocument, e), r.parentNode = null, r.previousSibling = null, r.nextSibling = null, r;
}
function ue(e) {
return e && e.nodeType === v.DOCUMENT_TYPE_NODE;
}
function X(e) {
return e && e.nodeType === v.ELEMENT_NODE;
}
function ge(e) {
return e && e.nodeType === v.TEXT_NODE;
}
function Se(e, r) {
var t = e.childNodes || [];
if (c(t, X) || ue(r)) return !1;
var n = c(t, ue);
return !(r && n && t.indexOf(n) > t.indexOf(r));
}
function Re(e, r) {
var t = e.childNodes || [];
if (c(t, function(s) {
return X(s) && s !== r;
})) return !1;
var n = c(t, ue);
return !(r && n && t.indexOf(n) > t.indexOf(r));
}
function Ie(e, r, t) {
var n = e.childNodes || [], s = r.childNodes || [];
if (r.nodeType === v.DOCUMENT_FRAGMENT_NODE) {
var b = s.filter(X);
if (b.length > 1 || c(s, ge)) throw new p(p.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
if (b.length === 1 && !Se(e, t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
}
if (X(r) && !Se(e, t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
if (ue(r)) {
if (c(n, ue)) throw new p(p.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
var P = c(n, X);
if (t && n.indexOf(P) < n.indexOf(t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
if (!t && P) throw new p(p.HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
}
}
function Ae(e, r, t) {
var n = e.childNodes || [], s = r.childNodes || [];
if (r.nodeType === v.DOCUMENT_FRAGMENT_NODE) {
var b = s.filter(X);
if (b.length > 1 || c(s, ge)) throw new p(p.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
if (b.length === 1 && !Re(e, t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
}
if (X(r) && !Re(e, t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
if (ue(r)) {
if (c(n, function(x) {
return ue(x) && x !== t;
})) throw new p(p.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
var P = c(n, X);
if (t && n.indexOf(P) < n.indexOf(t)) throw new p(p.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
}
}
function L(e, r, t, n) {
(function(B, Z, z) {
if (!(pe = B) || pe.nodeType !== v.DOCUMENT_NODE && pe.nodeType !== v.DOCUMENT_FRAGMENT_NODE && pe.nodeType !== v.ELEMENT_NODE) throw new p(p.HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + B.nodeType);
var pe;
if (z && z.parentNode !== B) throw new p(p.NOT_FOUND_ERR, "child not in parent");
if (!function(re) {
return re && (re.nodeType === v.CDATA_SECTION_NODE || re.nodeType === v.COMMENT_NODE || re.nodeType === v.DOCUMENT_FRAGMENT_NODE || re.nodeType === v.DOCUMENT_TYPE_NODE || re.nodeType === v.ELEMENT_NODE || re.nodeType === v.PROCESSING_INSTRUCTION_NODE || re.nodeType === v.TEXT_NODE);
}(Z) || ue(Z) && B.nodeType !== v.DOCUMENT_NODE) throw new p(p.HIERARCHY_REQUEST_ERR, "Unexpected node type " + Z.nodeType + " for parent node type " + B.nodeType);
})(e, r, t), e.nodeType === v.DOCUMENT_NODE && (n || Ie)(e, r, t);
var s = r.parentNode;
if (s && s.removeChild(r), r.nodeType === C) {
var b = r.firstChild;
if (b == null) return r;
var P = r.lastChild;
} else b = P = r;
var x = t ? t.previousSibling : e.lastChild;
b.previousSibling = x, P.nextSibling = t, x ? x.nextSibling = b : e.firstChild = b, t == null ? e.lastChild = P : t.previousSibling = P;
do
b.parentNode = e;
while (b !== P && (b = b.nextSibling));
return ye(e.ownerDocument || e, e, r), r.nodeType == C && (r.firstChild = r.lastChild = null), r;
}
function K(e) {
W(e), this._nsMap = /* @__PURE__ */ Object.create(null);
}
function k(e) {
W(e), this.namespaceURI = null, this.prefix = null, this.ownerElement = null;
}
function V(e) {
W(e);
}
function se(e) {
W(e);
}
function be(e) {
W(e);
}
function _e(e) {
W(e);
}
function Be(e) {
W(e);
}
function je(e) {
W(e);
}
function ze(e) {
W(e);
}
function Fe(e) {
W(e);
}
function He(e) {
W(e);
}
function Ge(e) {
W(e);
}
function $e() {
}
function Je(e) {
var r = [], t = this.nodeType === f && this.documentElement || this, n = t.prefix, s = t.namespaceURI;
if (s && n == null && (n = t.lookupPrefix(s)) == null) var b = [{ namespace: s, prefix: null }];
return Le(this, r, e, b), r.join("");
}
function Ke(e, r, t) {
var n = e.prefix || "", s = e.namespaceURI;
if (!s || n === "xml" && s === Q.XML || s === Q.XMLNS) return !1;
for (var b = t.length; b--; ) {
var P = t[b];
if (P.prefix === n) return P.namespace !== s;
}
return !0;
}
function Qe(e, r, t) {
e.push(" ", r, '="', t.replace(/[<>&"\t\n\r]/g, Te), '"');
}
function Le(e, r, t, n) {
n || (n = []);
var s = (e.nodeType === f ? e : e.ownerDocument).type === "html";
if (t) {
if (!(e = t(e))) return;
if (typeof e == "string") return void r.push(e);
}
switch (e.nodeType) {
case d:
var b = e.attributes, P = b.length, x = e.firstChild, B = e.tagName, Z = B;
if (!s && !e.prefix && e.namespaceURI) {
for (var z, pe = 0; pe < b.length; pe++) if (b.item(pe).name === "xmlns") {
z = b.item(pe).value;
break;
}
if (!z) {
for (var re = n.length - 1; re >= 0; re--) if ((he = n[re]).prefix === "" && he.namespace === e.namespaceURI) {
z = he.namespace;
break;
}
}
if (z !== e.namespaceURI) for (re = n.length - 1; re >= 0; re--) {
var he;
if ((he = n[re]).namespace === e.namespaceURI) {
he.prefix && (Z = he.prefix + ":" + B);
break;
}
}
}
r.push("<", Z);
for (var Oe = 0; Oe < P; Oe++) (we = b.item(Oe)).prefix == "xmlns" ? n.push({ prefix: we.localName, namespace: we.value }) : we.nodeName == "xmlns" && n.push({ prefix: "", namespace: we.value });
for (Oe = 0; Oe < P; Oe++) {
var we, Me, Ye;
Ke(we = b.item(Oe), 0, n) && (Qe(r, (Me = we.prefix || "") ? "xmlns:" + Me : "xmlns", Ye = we.namespaceURI), n.push({ prefix: Me, namespace: Ye })), Le(we, r, t, n);
}
B === Z && Ke(e, 0, n) && (Qe(r, (Me = e.prefix || "") ? "xmlns:" + Me : "xmlns", Ye = e.namespaceURI), n.push({ prefix: Me, namespace: Ye }));
var Ze = !x;
if (Ze && (s || e.namespaceURI === Q.HTML) && (Ze = H(B)), Ze) r.push("/>");
else {
if (r.push(">"), s && m(B)) for (; x; ) x.data ? r.push(x.data) : Le(x, r, t, n.slice()), x = x.nextSibling;
else for (; x; ) Le(x, r, t, n.slice()), x = x.nextSibling;
r.push("</", Z, ">");
}
return;
case f:
case C:
for (x = e.firstChild; x; ) Le(x, r, t, n.slice()), x = x.nextSibling;
return;
case N:
return Qe(r, e.name, e.value);
case T:
return r.push(e.data.replace(/[<&>]/g, Te));
case u:
return r.push(U.CDATA_START, e.data, U.CDATA_END);
case I:
return r.push(U.COMMENT_START, e.data, U.COMMENT_END);
case F:
var tr = e.publicId, qe = e.systemId;
return r.push(U.DOCTYPE_DECL_START, " ", e.name), tr ? (r.push(" ", U.PUBLIC, " ", tr), qe && qe !== "." && r.push(" ", qe)) : qe && qe !== "." && r.push(" ", U.SYSTEM, " ", qe), e.internalSubset && r.push(" [", e.internalSubset, "]"), void r.push(">");
case w:
return r.push("<?", e.target, " ", e.data, "?>");
case D:
return r.push("&", e.nodeName, ";");
default:
r.push("??", e.nodeName);
}
}
function er(e, r, t) {
var n;
switch (r.nodeType) {
case d:
(n = r.cloneNode(!1)).ownerDocument = e;
case C:
break;
case N:
t = !0;
}
if (n || (n = r.cloneNode(!1)), n.ownerDocument = e, n.parentNode = null, t) for (var s = r.firstChild; s; ) n.appendChild(er(e, s, t)), s = s.nextSibling;
return n;
}
function We(e, r, t) {
var n = new r.constructor(a);
for (var s in r) if (R(r, s)) {
var b = r[s];
typeof b != "object" && b != n[s] && (n[s] = b);
}
switch (r.childNodes && (n.childNodes = new q()), n.ownerDocument = e, n.nodeType) {
case d:
var P = r.attributes, x = n.attributes = new Y(), B = P.length;
x._ownerElement = n;
for (var Z = 0; Z < B; Z++) n.setAttributeNode(We(e, P.item(Z), !0));
break;
case N:
t = !0;
}
if (t) for (var z = r.firstChild; z; ) n.appendChild(We(e, z, t)), z = z.nextSibling;
return n;
}
function rr(e, r, t) {
e[r] = t;
}
q.prototype = { length: 0, item: function(e) {
return e >= 0 && e < this.length ? this[e] : null;
}, toString: function(e) {
for (var r = [], t = 0; t < this.length; t++) Le(this[t], r, e);
return r.join("");
}, filter: function(e) {
return Array.prototype.filter.call(this, e);
}, indexOf: function(e) {
return Array.prototype.indexOf.call(this, e);
} }, q.prototype[Symbol.iterator] = function() {
var e = this, r = 0;
return { next: function() {
return r < e.length ? { value: e[r++], done: !1 } : { done: !0 };
}, return: function() {
return { done: !0 };
} };
}, ee.prototype.item = function(e) {
return G(this), this[e] || null;
}, o(ee, q), Y.prototype = { length: 0, item: q.prototype.item, getNamedItem: function(e) {
this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase());
for (var r = 0; r < this.length; ) {
var t = this[r];
if (t.nodeName === e) return t;
r++;
}
return null;
}, setNamedItem: function(e) {
var r = e.ownerElement;
if (r && r !== this._ownerElement) throw new p(p.INUSE_ATTRIBUTE_ERR);
var t = this.getNamedItemNS(e.namespaceURI, e.localName);
return t === e ? e : (function(n, s, b, P) {
if (P ? s[ve(s, P)] = b : (s[s.length] = b, s.length++), n) {
b.ownerElement = n;
var x = n.ownerDocument;
x && (P && xe(x, n, P), Z = n, z = b, (B = x) && B._inc++, z.namespaceURI === Q.XMLNS && (Z._nsMap[z.prefix ? z.localName : ""] = z.value));
}
var B, Z, z;
}(this._ownerElement, this, e, t), t);
}, setNamedItemNS: function(e) {
return this.setNamedItem(e);
}, removeNamedItem: function(e) {
var r = this.getNamedItem(e);
if (!r) throw new p(p.NOT_FOUND_ERR, e);
return Ne(this._ownerElement, this, r), r;
}, removeNamedItemNS: function(e, r) {
var t = this.getNamedItemNS(e, r);
if (!t) throw new p(p.NOT_FOUND_ERR, e ? e + " : " + r : r);
return Ne(this._ownerElement, this, t), t;
}, getNamedItemNS: function(e, r) {
e || (e = null);
for (var t = 0; t < this.length; ) {
var n = this[t];
if (n.localName === r && n.namespaceURI === e) return n;
t++;
}
return null;
} }, Y.prototype[Symbol.iterator] = function() {
var e = this, r = 0;
return { next: function() {
return r < e.length ? { value: e[r++], done: !1 } : { done: !0 };
}, return: function() {
return { done: !0 };
} };
}, de.prototype = { hasFeature: function(e, r) {
return !0;
}, createDocument: function(e, r, t) {
var n = J.XML_APPLICATION;
e === Q.HTML ? n = J.XML_XHTML_APPLICATION : e === Q.SVG && (n = J.XML_SVG_IMAGE);
var s = new ie(a, { contentType: n });
if (s.implementation = this, s.childNodes = new q(), s.doctype = t || null, t && s.appendChild(t), r) {
var b = s.createElementNS(e, r);
s.appendChild(b);
}
return s;
}, createDocumentType: function(e, r, t, n) {
ae(e);
var s = new Be(a);
return s.name = e, s.nodeName = e, s.publicId = r || "", s.systemId = t || "", s.internalSubset = n || "", s.childNodes = new q(), s;
}, createHTMLDocument: function(e) {
var r = new ie(a, { contentType: J.HTML });
if (r.implementation = this, r.childNodes = new q(), e !== !1) {
r.doctype = this.createDocumentType("html"), r.doctype.ownerDocument = r, r.appendChild(r.doctype);
var t = r.createElement("html");
r.appendChild(t);
var n = r.createElement("head");
if (t.appendChild(n), typeof e == "string") {
var s = r.createElement("title");
s.appendChild(r.createTextNode(e)), n.appendChild(s);
}
t.appendChild(r.createElement("body"));
}
return r;
} }, v.prototype = { firstChild: null, lastChild: null, previousSibling: null, nextSibling: null, parentNode: null, get parentElement() {
return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null;
}, childNodes: null, ownerDocument: null, nodeValue: null, namespaceURI: null, prefix: null, localName: null, baseURI: "about:blank", get isConnected() {
var e = this.getRootNode();
return e && e.nodeType === e.DOCUMENT_NODE;
}, contains: function(e) {
if (!e) return !1;
var r = e;
do {
if (this === r) return !0;
r = e.parentNode;
} while (r);
return !1;
}, getRootNode: function(e) {
var r = this;
do {
if (!r.parentNode) return r;
r = r.parentNode;
} while (r);
}, isEqualNode: function(e) {
if (!e || this.nodeType !== e.nodeType) return !1;
switch (this.nodeType) {
case this.DOCUMENT_TYPE_NODE:
if (this.name !== e.name || this.publicId !== e.publicId || this.systemId !== e.systemId) return !1;
break;
case this.ELEMENT_NODE:
if (this.namespaceURI !== e.namespaceURI || this.prefix !== e.prefix || this.localName !== e.localName || this.attributes.length !== e.attributes.length) return !1;
for (var r = 0; r < this.attributes.length; r++) {
var t = this.attributes.item(r);
if (!t.isEqualNode(e.getAttributeNodeNS(t.namespaceURI, t.localName))) return !1;
}
break;
case this.ATTRIBUTE_NODE:
if (this.namespaceURI !== e.namespaceURI || this.localName !== e.localName || this.value !== e.value) return !1;
break;
case this.PROCESSING_INSTRUCTION_NODE:
if (this.target !== e.target || this.data !== e.data) return !1;
break;
case this.TEXT_NODE:
case this.COMMENT_NODE:
if (this.data !== e.data) return !1;
}
if (this.childNodes.length !== e.childNodes.length) return !1;
for (r = 0; r < this.childNodes.length; r++) if (!this.childNodes[r].isEqualNode(e.childNodes[r])) return !1;
return !0;
}, isSameNode: function(e) {
return this === e;
}, insertBefore: function(e, r) {
return L(this, e, r);
}, replaceChild: function(e, r) {
L(this, e, r, Ae), r && this.removeChild(r);
}, removeChild: function(e) {
return De(this, e);
}, appendChild: function(e) {
return this.insertBefore(e, null);
}, hasChildNodes: function() {
return this.firstChild != null;
}, cloneNode: function(e) {
return We(this.ownerDocument || this, this, e);
}, normalize: function() {
for (var e = this.firstChild; e; ) {
var r = e.nextSibling;
r && r.nodeType == T && e.nodeType == T ? (this.removeChild(r), e.appendData(r.data)) : (e.normalize(), e = r);
}
}, isSupported: function(e, r) {
return this.ownerDocument.implementation.hasFeature(e, r);
}, lookupPrefix: function(e) {
for (var r = this; r; ) {
var t = r._nsMap;
if (t) {
for (var n in t) if (R(t, n) && t[n] === e) return n;
}
r = r.nodeType == N ? r.ownerDocument : r.parentNode;
}
return null;
}, lookupNamespaceURI: function(e) {
for (var r = this; r; ) {
var t = r._nsMap;
if (t && R(t, e)) return t[e];
r = r.nodeType == N ? r.ownerDocument : r.parentNode;
}
return null;
}, isDefaultNamespace: function(e) {
return this.lookupPrefix(e) == null;
}, compareDocumentPosition: function(e) {
if (this === e) return 0;
var r = e, t = this, n = null, s = null;
if (r instanceof k && (r = (n = r).ownerElement), t instanceof k && (t = (s = t).ownerElement, n && r && t === r)) for (var b, P = 0; b = t.attributes[P]; P++) {
if (b === n) return M.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + M.DOCUMENT_POSITION_PRECEDING;
if (b === s) return M.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + M.DOCUMENT_POSITION_FOLLOWING;
}
if (!r || !t || t.ownerDocument !== r.ownerDocument) return M.DOCUMENT_POSITION_DISCONNECTED + M.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + (j(t.ownerDocument) > j(r.ownerDocument) ? M.DOCUMENT_POSITION_FOLLOWING : M.DOCUMENT_POSITION_PRECEDING);
if (s && r === t) return M.DOCUMENT_POSITION_CONTAINS + M.DOCUMENT_POSITION_PRECEDING;
if (n && r === t) return M.DOCUMENT_POSITION_CONTAINED_BY + M.DOCUMENT_POSITION_FOLLOWING;
for (var x = [], B = r.parentNode; B; ) {
if (!s && B === t) return M.DOCUMENT_POSITION_CONTAINED_BY + M.DOCUMENT_POSITION_FOLLOWING;
x.push(B), B = B.parentNode;
}
x.reverse();
for (var Z = [], z = t.parentNode; z; ) {
if (!n && z === r) return M.DOCUMENT_POSITION_CONTAINS + M.DOCUMENT_POSITION_PRECEDING;
Z.push(z), z = z.parentNode;
}
Z.reverse();
var pe = Ee(x, Z);
for (var re in pe.childNodes) {
var he = pe.childNodes[re];
if (he === t) return M.DOCUMENT_POSITION_FOLLOWING;
if (he === r) return M.DOCUMENT_POSITION_PRECEDING;
if (Z.indexOf(he) >= 0) return M.DOCUMENT_POSITION_FOLLOWING;
if (x.indexOf(he) >= 0) return M.DOCUMENT_POSITION_PRECEDING;
}
return 0;
} }, y(i, v), y(i, v.prototype), y(M, v), y(M, v.prototype), ie.prototype = { implementation: null, nodeName: "#document", nodeType: f, doctype: null, documentElement: null, _inc: 1, insertBefore: function(e, r) {
if (e.nodeType === C) {
for (var t = e.firstChild; t; ) {
var n = t.nextSibling;
this.insertBefore(t, r), t = n;
}
return e;
}
return L(this, e, r), e.ownerDocument = this, this.documentElement === null && e.nodeType === d && (this.documentElement = e), e;
}, removeChild: function(e) {
var r = De(this, e);
return r === this.documentElement && (this.documentElement = null), r;
}, replaceChild: function(e, r) {
L(this, e, r, Ae), e.ownerDocument = this, r && this.removeChild(r), X(e) && (this.documentElement = e);
}, importNode: function(e, r) {
return er(this, e, r);
}, getElementById: function(e) {
var r = null;
return fe(this.documentElement, function(t) {
if (t.nodeType == d && t.getAttribute("id") == e) return r = t, !0;
}), r;
}, createElement: function(e) {
var r = new K(a);
return r.ownerDocument = this, this.type === "html" && (e = e.toLowerCase()), A(this.contentType) && (r.namespaceURI = Q.HTML), r.nodeName = e, r.tagName = e, r.localName = e, r.childNodes = new q(), (r.attributes = new Y())._ownerElement = r, r;
}, createDocumentFragment: function() {
var e = new He(a);
return e.ownerDocument = this, e.childNodes = new q(), e;
}, createTextNode: function(e) {
var r = new se(a);
return r.ownerDocument = this, r.childNodes = new q(), r.appendData(e), r;
}, createComment: function(e) {
var r = new be(a);
return r.ownerDocument = this, r.childNodes = new q(), r.appendData(e), r;
}, createCDATASection: function(e) {
var r = new _e(a);
return r.ownerDocument = this, r.childNodes = new q(), r.appendData(e), r;
}, createProcessingInstruction: function(e, r) {
var t = new Ge(a);
return t.ownerDocument = this, t.childNodes = new q(), t.nodeName = t.target = e, t.nodeValue = t.data = r, t;
}, createAttribute: function(e) {
if (!U.QName_exact.test(e)) throw new p(p.INVALID_CHARACTER_ERR, 'invalid character in name "' + e + '"');
return this.type === "html" && (e = e.toLowerCase()), this._createAttribute(e);
}, _createAttribute: function(e) {
var r = new k(a);
return r.ownerDocument = this, r.childNodes = new q(), r.name = e, r.nodeName = e, r.localName = e, r.specified = !0, r;
}, createEntityReference: function(e) {
if (!U.Name.test(e)) throw new p(p.INVALID_CHARACTER_ERR, 'not a valid xml name "' + e + '"');
if (this.type === "html") throw new p("document is an html document", oe.NotSupportedError);
var r = new Fe(a);
return r.ownerDocument = this, r.childNodes = new q(), r.nodeName = e, r;
}, createElementNS: function(e, r) {
var t = l(e, r), n = new K(a), s = n.attributes = new Y();
return n.childNodes = new q(), n.ownerDocument = this, n.nodeName = r, n.tagName = r, n.namespaceURI = t[0], n.prefix = t[1], n.localName = t[2], s._ownerElement = n, n;
}, createAttributeNS: function(e, r) {
var t = l(e, r), n = new k(a);
return n.ownerDocument = this, n.childNodes = new q(), n.nodeName = r, n.name = r, n.specified = !0, n.namespaceURI = t[0], n.prefix = t[1], n.localName = t[2], n;
} }, o(ie, v), K.prototype = { nodeType: d, attributes: null, getQualifiedName: function() {
return this.prefix ? this.prefix + ":" + this.localName : this.localName;
}, _isInHTMLDocumentAndNamespace: function() {
return this.ownerDocument.type === "html" && this.namespaceURI === Q.HTML;
}, hasAttributes: function() {
return !(!this.attributes || !this.attributes.length);
}, hasAttribute: function(e) {
return !!this.getAttributeNode(e);
}, getAttribute: function(e) {
var r = this.getAttributeNode(e);
return r ? r.value : null;
}, getAttributeNode: function(e) {
return this._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase()), this.attributes.getNamedItem(e);
}, setAttribute: function(e, r) {
this._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase());
var t = this.getAttributeNode(e);
t ? t.value = t.nodeValue = "" + r : ((t = this.ownerDocument._createAttribute(e)).value = t.nodeValue = "" + r, this.setAttributeNode(t));
}, removeAttribute: function(e) {
var r = this.getAttributeNode(e);
r && this.removeAttributeNode(r);
}, setAttributeNode: function(e) {
return this.attributes.setNamedItem(e);
}, setAttributeNodeNS: function(e) {
return this.attributes.setNamedItemNS(e);
}, removeAttributeNode: function(e) {
return this.attributes.removeNamedItem(e.nodeName);
}, removeAttributeNS: function(e, r) {
var t = this.getAttributeNodeNS(e, r);
t && this.removeAttributeNode(t);
}, hasAttributeNS: function(e, r) {
return this.getAttributeNodeNS(e, r) != null;
}, getAttributeNS: function(e, r) {
var t = this.getAttributeNodeNS(e, r);
return t ? t.value : null;
}, setAttributeNS: function(e, r, t) {
var n = l(e, r)[2], s = this.getAttributeNodeNS(e, n);
s ? s.value = s.nodeValue = "" + t : ((s = this.ownerDocument.createAttributeNS(e, r)).value = s.nodeValue = "" + t, this.setAttributeNode(s));
}, getAttributeNodeNS: function(e, r) {
return this.attributes.getNamedItemNS(e, r);
}, getElementsByClassName: function(e) {
var r = le(e);
return new ee(this, function(t) {
var n = [];
return r.length > 0 && fe(t, function(s) {
if (s !== t && s.nodeType === d) {
var b = s.getAttribute("class");
if (b) {
var P = e === b;
if (!P) {
var x = le(b);
P = r.every((B = x, function(Z) {
return B && B.indexOf(Z) !== -1;
}));
}
P && n.push(s);
}
}
var B;
}), n;
});
}, getElementsByTagName: function(e) {
var r = (this.nodeType === f ? this : this.ownerDocument).type === "html", t = e.toLowerCase();
return new ee(this, function(n) {
var s = [];
return fe(n, function(b) {
b !== n && b.nodeType === d && (e === "*" || b.getQualifiedName() === (r && b.namespaceURI === Q.HTML ? t : e)) && s.push(b);
}), s;
});
}, getElementsByTagNameNS: function(e, r) {
return new ee(this, function(t) {
var n = [];
return fe(t, function(s) {
s === t || s.nodeType !== d || e !== "*" && s.namespaceURI !== e || r !== "*" && s.localName != r || n.push(s);
}), n;
});
} }, ie.prototype.getElementsByClassName = K.prototype.getElementsByClassName, ie.prototype.getElementsByTagName = K.prototype.getElementsByTagName, ie.prototype.getElementsByTagNameNS = K.prototype.getElementsByTagNameNS, o(K, v), k.prototype.nodeType = N, o(k, v), V.prototype = { data: "", substringData: function(e, r) {
return this.data.substring(e, e + r);
}, appendData: function(e) {
e = this.data + e, this.nodeValue = this.data = e, this.length = e.length;
}, insertData: function(e, r) {
this.replaceData(e, 0, r);
}, deleteData: function(e, r) {
this.replaceData(e, r, "");
}, replaceData: function(e, r, t) {
t = this.data.substring(0, e) + t + this.data.substring(e + r), this.nodeValue = this.data = t, this.length = t.length;
} }, o(V, v), se.prototype = { nodeName: "#text", nodeType: T, splitText: function(e) {
var r = this.data, t = r.substring(e);
r = r.substring(0, e), this.data = this.nodeValue = r, this.length = r.length;
var n = this.ownerDocument.createTextNode(t);
return this.parentNode && this.parentNode.insertBefore(n, this.nextSibling), n;
} }, o(se, V), be.prototype = { nodeName: "#comment", nodeType: I }, o(be, V), _e.prototype = { nodeName: "#cdata-section", nodeType: u }, o(_e, se), Be.prototype.nodeType = F, o(Be, v), je.prototype.nodeType = ne, o(je, v), ze.prototype.nodeType = E, o(ze, v), Fe.prototype.nodeType = D, o(Fe, v), He.prototype.nodeName = "#document-fragment", He.prototype.nodeType = C, o(He, v), Ge.prototype.nodeType = w, o(Ge, V), $e.prototype.serializeToString = function(e, r) {
return Je.call(e, r);
}, v.prototype.toString = Je;
try {
if (Object.defineProperty) {
let e = function(r) {
switch (r.nodeType) {
case d:
case C:
var t = [];
for (r = r.firstChild; r; ) r.nodeType !== 7 && r.nodeType !== 8 && t.push(e(r)), r = r.nextSibling;
return t.join("");
default:
return r.nodeValue;
}
};
Object.defineProperty(ee.prototype, "length", { get: function() {
return G(this), this.$$length;
} }), Object.defineProperty(v.prototype, "textContent", { get: function() {
return e(this);
}, set: function(r) {
switch (this.nodeType) {
case d:
case C:
for (; this.firstChild; ) this.removeChild(this.firstChild);
(r || String(r)) && this.appendChild(this.ownerDocument.createTextNode(r));
break;
default:
this.data = r, this.value = r, this.nodeValue = r;
}
} }), rr = function(r, t, n) {
r["$$" + t] = n;
};
}
} catch {
}
return $._updateLiveList = G, $.Attr = k, $.CDATASection = _e, $.CharacterData = V, $.Comment = be, $.Document = ie, $.DocumentFragment = He, $.DocumentType = Be, $.DOMImplementation = de, $.Element = K, $.Entity = ze, $.EntityReference = Fe, $.LiveNodeList = ee, $.NamedNodeMap = Y, $.Node = v, $.NodeList = q, $.Notation = je, $.Text = se, $.ProcessingInstruction = Ge, $.XMLSerializer = $e, $;
}
var sr, Ce = {}, lr = {}, cr, ur, pr, Ve = {};
function mr() {
if (cr) return Ve;
cr = 1;
var S = ke(), c = fr(), A = Xe(), R = S.isHTMLEscapableRawTextElement, g = S.isHTMLMimeType, m = S.isHTMLRawTextElement, H = S.hasOwn, J = S.NAMESPACE, Q = A.ParseError, a = A.DOMException;
function h() {
}
h.prototype = { parse: function(o, i, d) {
var N = this.domBuilder;
N.startDocument(), ce(i, i = /* @__PURE__ */ Object.create(null)), function(T, u, D, E, w) {
var I = g(E.mimeType);
function f(L) {
var K = L[L.length - 1] === ";" ? L : L + ";";
if (!I && K !== L) return w.error("EntityRef: expecting ;"), L;
var k = c.Reference.exec(K);
if (!k || k[0].length !== K.length) return w.error("entity not matching Reference production: " + L), L;
var V = K.slice(1, -1);
return H(D, V) ? D[V] : V.charAt(0) === "#" ? function(se) {
if (se > 65535) {
var be = 55296 + ((se -= 65536) >> 10), _e = 56320 + (1023 & se);
return String.fromCharCode(be, _e);
}
return String.fromCharCode(se);
}(parseInt(V.substr(1).replace("x", "0x"))) : (w.error("entity not found:" + L), L);
}
function F(L) {
if (L > G) {
var K = T.substring(G, L).replace(p, f);
j && C(G), E.characters(K, 0, L - G), G = L;
}
}
function C(L, K) {
for (; L >= M && (K = Ee.exec(T)); ) ne = K.index, M = ne + K[0].length, j.lineNumber++;
j.columnNumber = L - ne + 1;
}
T.indexOf(c.UNICODE_REPLACEMENT_CHARACTER) >= 0 && w.warning("Unicode replacement character detected, source encoding issues?");
for (var ne = 0, M = 0, Ee = /.*(?:\r\n?|\n)|.*$/g, j = E.locator, q = [{ currentNSMap: u }], ee = [], G = 0; ; ) {
try {
var Y = T.indexOf("<", G);
if (Y < 0) {
if (!I && ee.length > 0) return w.fatalError("unclosed xml tag(s): " + ee.join(", "));
if (!T.substring(G).match(/^\s*$/)) {
var ve = E.doc, Ne = ve.createTextNode(T.substr(G));
if (ve.documentElement) return w.error("Extra content at the end of the document");
ve.appendChild(Ne), E.currentElement = Ne;
}
return;
}
if (Y > G) {
var de = T.substring(G, Y);
I || ee.length !== 0 || (de = de.replace(new RegExp(c.S_OPT.source, "g"), "")) && w.error("Unexpected content outside root element: '" + de + "'"), F(Y);
}
switch (T.charAt(Y + 1)) {
case "/":
var v = T.indexOf(">", Y + 2), Te = T.substring(Y + 2, v > 0 ? v : void 0);
if (!Te) return w.fatalError("end tag name missing");
var fe = v > 0 && c.reg("^", c.QName_group, c.S_OPT, "$").exec(Te);
if (!fe) return w.fatalError('end tag name contains invalid characters: "' + Te + '"');
if (!E.currentElement && !E.doc.documentElement) return;
var ie = ee[ee.length - 1] || E.currentElement.tagName || E.doc.documentElement.tagName || "";
if (ie !== fe[1]) {
var xe = fe[1].toLowerCase();
if (!I || ie.toLowerCase() !== xe) return w.fatalError('Opening and ending tag mismatch: "' + ie + '" != "' + Te + '"');
}
var ye = q.pop();
ee.pop();
var De = ye.localNSMap;
if (E.endElement(ye.uri, ye.localName, ie), De) for (var ue in De) H(De, ue) && E.endPrefixMapping(ue);
v++;
break;
case "?":
j && C(Y), v = l(T, Y, E, w);
break;
case "!":
j && C(Y), v = ae(T, Y, E, w, I);
break;
default:
j && C(Y);
var X = new y(), ge = q[q.length - 1].currentNSMap, Se = (v = U(T, Y, X, ge, f, w, I), X.length);
if (X.closed || (I && S.isHTMLVoidElement(X.tagName) ? X.closed = !0 : ee.push(X.tagName)), j && Se) {
for (var Re = oe(j, {}), Ie = 0; Ie < Se; Ie++) {
var Ae = X[Ie];
C(Ae.offset), Ae.locator = oe(j, {});
}
E.locator = Re, W(X, E, ge) && q.push(X), E.locator = j;
} else W(X, E, ge) && q.push(X);
I && !X.closed ? v = me(T, v, X.tagName, f, E) : v++;
}
} catch (L) {
if (L instanceof Q) throw L;
if (L instanceof a) throw new Q(L.name + ": " + L.message, E.locator, L);
w.error("element parse error: " + L), v = -1;
}
v > G ? G = v : F(Math.max(Y, G) + 1);
}
}(o, i, d, N, this.errorHandler), N.endDocument();
} };
var p = /&#?\w+;?/g;
function oe(o, i) {
return i.lineNumber = o.lineNumber, i.columnNumber = o.columnNumber, i;
}
function U(o, i, d, N, T, u, D) {
function E(ne, M, Ee) {
return H(d.attributeNames, ne) ? u.fatalError("Attribute " + ne + " redefined") : !D && M.indexOf("<") >= 0 ? u.fatalError("Unescaped '<' not allowed in attributes values") : void d.addValue(ne, M.replace(/[\t\n\r]/g, " ").replace(p, T), Ee);
}
for (var w, I = ++i, f = 0; ; ) {
var F = o.charAt(I);
switch (F) {
case "=":
if (f === 1) w = o.slice(i, I), f = 3;
else {
if (f !== 2) throw new Error("attribute equal must after attrName");
f = 3;
}
break;
case "'":
case '"':
if (f === 3 || f === 1) {
if (f === 1 && (u.warning('attribute value must after "="'), w = o.slice(i, I)), i = I + 1, !((I = o.indexOf(F, i)) > 0)) throw new Error("attribute value no end '" + F + "' match");
E(w, C = o.slice(i, I), i - 1), f = 5;
} else {
if (f != 4) throw new Error('attribute value must after "="');
E(w, C = o.slice(i, I), i), u.warning('attribute "' + w + '" missed start quot(' + F + ")!!"), i = I + 1, f = 5;
}
break;
case "/":
switch (f) {
case 0:
d.setTagName(o.slice(i, I));
case 5:
case 6:
case 7:
f = 7, d.closed = !0;
case 4:
case 1:
break;
case 2:
d.closed = !0;
break;
default:
throw new Error("attribute invalid close char('/')");
}
break;
case "":
return u.error("unexpected end of input"), f == 0 && d.setTagName(o.slice(i, I)), I;
case ">":
switch (f) {