var Pa = "2.1.16";
const Bt = "[data-trix-attachment]", Sn = { preview: { presentation: "gallery", caption: { name: !0, size: !0 } }, file: { caption: { size: !0 } } }, X = { default: { tagName: "div", parse: !1 }, quote: { tagName: "blockquote", nestable: !0 }, heading1: { tagName: "h1", terminal: !0, breakOnReturn: !0, group: !1 }, code: { tagName: "pre", terminal: !0, htmlAttributes: ["language"], text: { plaintext: !0 } }, bulletList: { tagName: "ul", parse: !1 }, bullet: { tagName: "li", listAttribute: "bulletList", group: !1, nestable: !0, test(s) {
return ss(s.parentNode) === X[this.listAttribute].tagName;
} }, numberList: { tagName: "ol", parse: !1 }, number: { tagName: "li", listAttribute: "numberList", group: !1, nestable: !0, test(s) {
return ss(s.parentNode) === X[this.listAttribute].tagName;
} }, attachmentGallery: { tagName: "div", exclusive: !0, terminal: !0, parse: !1, group: !1 } }, ss = (s) => {
var t;
return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase();
}, rs = navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i), Si = rs && parseInt(rs[1]);
var Te = { composesExistingText: /Android.*Chrome/.test(navigator.userAgent), recentAndroid: Si && Si > 12, samsungAndroid: Si && navigator.userAgent.match(/Android.*SM-/), forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent), supportsInputEvents: typeof InputEvent < "u" && ["data", "getTargetRanges", "inputType"].every(((s) => s in InputEvent.prototype)) }, Mr = { ADD_ATTR: ["language"], SAFE_FOR_XML: !1, RETURN_DOM: !0 }, v = { attachFiles: "Attach Files", bold: "Bold", bullets: "Bullets", byte: "Byte", bytes: "Bytes", captionPlaceholder: "Add a caption…", code: "Code", heading1: "Heading", indent: "Increase Level", italic: "Italic", link: "Link", numbers: "Numbers", outdent: "Decrease Level", quote: "Quote", redo: "Redo", remove: "Remove", strike: "Strikethrough", undo: "Undo", unlink: "Unlink", url: "URL", urlPlaceholder: "Enter a URL…", GB: "GB", KB: "KB", MB: "MB", PB: "PB", TB: "TB" };
const Fa = [v.bytes, v.KB, v.MB, v.GB, v.TB, v.PB];
var Nr = { prefix: "IEC", precision: 2, formatter(s) {
switch (s) {
case 0:
return "0 ".concat(v.bytes);
case 1:
return "1 ".concat(v.byte);
default:
let t;
this.prefix === "SI" ? t = 1e3 : this.prefix === "IEC" && (t = 1024);
const e = Math.floor(Math.log(s) / Math.log(t)), i = (s / Math.pow(t, e)).toFixed(this.precision).replace(/0*$/, "").replace(/\.$/, "");
return "".concat(i, " ").concat(Fa[e]);
}
} };
const ni = "\uFEFF", St = " ", Pr = function(s) {
for (const t in s) {
const e = s[t];
this[t] = e;
}
return this;
}, Ln = document.documentElement, Ha = Ln.matches, B = function(s) {
let { onElement: t, matchingSelector: e, withCallback: i, inPhase: n, preventDefault: r, times: a } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const o = t || Ln, l = e, c = n === "capturing", u = function(h) {
a != null && --a == 0 && u.destroy();
const m = Lt(h.target, { matchingSelector: l });
m != null && (i?.call(m, h, m), r && h.preventDefault());
};
return u.destroy = () => o.removeEventListener(s, u, c), o.addEventListener(s, u, c), u;
}, Fr = function(s) {
let { bubbles: t, cancelable: e, attributes: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
t = t !== !1, e = e !== !1;
const n = document.createEvent("Events");
return n.initEvent(s, t, e), i != null && Pr.call(n, i), n;
}, be = function(s) {
let { onElement: t, bubbles: e, cancelable: i, attributes: n } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const r = t ?? Ln, a = Fr(s, { bubbles: e, cancelable: i, attributes: n });
return r.dispatchEvent(a);
}, Hr = function(s, t) {
if (s?.nodeType === 1) return Ha.call(s, t);
}, Lt = function(s) {
let { matchingSelector: t, untilNode: e } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
for (; s && s.nodeType !== Node.ELEMENT_NODE; ) s = s.parentNode;
if (s != null) {
if (t == null) return s;
if (s.closest && e == null) return s.closest(t);
for (; s && s !== e; ) {
if (Hr(s, t)) return s;
s = s.parentNode;
}
}
}, Cn = (s) => document.activeElement !== s && Ot(s, document.activeElement), Ot = function(s, t) {
if (s && t) for (; t; ) {
if (t === s) return !0;
t = t.parentNode;
}
}, Li = function(s) {
var t;
if ((t = s) === null || t === void 0 || !t.parentNode) return;
let e = 0;
for (s = s.previousSibling; s; ) e++, s = s.previousSibling;
return e;
}, Ct = (s) => {
var t;
return s == null || (t = s.parentNode) === null || t === void 0 ? void 0 : t.removeChild(s);
}, Qe = function(s) {
let { onlyNodesOfType: t, usingFilter: e, expandEntityReferences: i } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const n = (() => {
switch (t) {
case "element":
return NodeFilter.SHOW_ELEMENT;
case "text":
return NodeFilter.SHOW_TEXT;
case "comment":
return NodeFilter.SHOW_COMMENT;
default:
return NodeFilter.SHOW_ALL;
}
})();
return document.createTreeWalker(s, n, e ?? null, i === !0);
}, Y = (s) => {
var t;
return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase();
}, x = function(s) {
let t, e, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
typeof s == "object" ? (i = s, s = i.tagName) : i = { attributes: i };
const n = document.createElement(s);
if (i.editable != null && (i.attributes == null && (i.attributes = {}), i.attributes.contenteditable = i.editable), i.attributes) for (t in i.attributes) e = i.attributes[t], n.setAttribute(t, e);
if (i.style) for (t in i.style) e = i.style[t], n.style[t] = e;
if (i.data) for (t in i.data) e = i.data[t], n.dataset[t] = e;
return i.className && i.className.split(" ").forEach(((r) => {
n.classList.add(r);
})), i.textContent && (n.textContent = i.textContent), i.childNodes && [].concat(i.childNodes).forEach(((r) => {
n.appendChild(r);
})), n;
};
let le;
const _e = function() {
if (le != null) return le;
le = [];
for (const s in X) {
const t = X[s];
t.tagName && le.push(t.tagName);
}
return le;
}, Ci = (s) => Zt(s?.firstChild), as = function(s) {
let { strict: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { strict: !0 };
return t ? Zt(s) : Zt(s) || !Zt(s.firstChild) && (function(e) {
return _e().includes(Y(e)) && !_e().includes(Y(e.firstChild));
})(s);
}, Zt = (s) => qa(s) && s?.data === "block", qa = (s) => s?.nodeType === Node.COMMENT_NODE, te = function(s) {
let { name: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (s) return ve(s) ? s.data === ni ? !t || s.parentNode.dataset.trixCursorTarget === t : void 0 : te(s.firstChild);
}, Mt = (s) => Hr(s, Bt), qr = (s) => ve(s) && s?.data === "", ve = (s) => s?.nodeType === Node.TEXT_NODE, wn = { level2Enabled: !0, getLevel() {
return this.level2Enabled && Te.supportsInputEvents ? 2 : 0;
}, pickFiles(s) {
const t = x("input", { type: "file", multiple: !0, hidden: !0, id: this.fileInputId });
t.addEventListener("change", (() => {
s(t.files), Ct(t);
})), Ct(document.getElementById(this.fileInputId)), document.body.appendChild(t), t.click();
} };
var Je = { removeBlankTableCells: !1, tableCellSeparator: " | ", tableRowSeparator: `
` }, Pt = { bold: { tagName: "strong", inheritable: !0, parser(s) {
const t = window.getComputedStyle(s);
return t.fontWeight === "bold" || t.fontWeight >= 600;
} }, italic: { tagName: "em", inheritable: !0, parser: (s) => window.getComputedStyle(s).fontStyle === "italic" }, href: { groupTagName: "a", parser(s) {
const t = "a:not(".concat(Bt, ")"), e = s.closest(t);
if (e) return e.getAttribute("href");
} }, strike: { tagName: "del", inheritable: !0 }, frozen: { style: { backgroundColor: "highlight" } } }, $r = { getDefaultHTML: () => `
`) };
const cn = { interval: 5e3 };
var ke = Object.freeze({ __proto__: null, attachments: Sn, blockAttributes: X, browser: Te, css: { attachment: "attachment", attachmentCaption: "attachment__caption", attachmentCaptionEditor: "attachment__caption-editor", attachmentMetadata: "attachment__metadata", attachmentMetadataContainer: "attachment__metadata-container", attachmentName: "attachment__name", attachmentProgress: "attachment__progress", attachmentSize: "attachment__size", attachmentToolbar: "attachment__toolbar", attachmentGallery: "attachment-gallery" }, dompurify: Mr, fileSize: Nr, input: wn, keyNames: { 8: "backspace", 9: "tab", 13: "return", 27: "escape", 37: "left", 39: "right", 46: "delete", 68: "d", 72: "h", 79: "o" }, lang: v, parser: Je, textAttributes: Pt, toolbar: $r, undo: cn });
class H {
static proxyMethod(t) {
const { name: e, toMethod: i, toProperty: n, optional: r } = $a(t);
this.prototype[e] = function() {
let a, o;
var l, c;
return i ? o = r ? (l = this[i]) === null || l === void 0 ? void 0 : l.call(this) : this[i]() : n && (o = this[n]), r ? (a = (c = o) === null || c === void 0 ? void 0 : c[e], a ? os.call(a, o, arguments) : void 0) : (a = o[e], os.call(a, o, arguments));
};
}
}
const $a = function(s) {
const t = s.match(Ua);
if (!t) throw new Error("can't parse @proxyMethod expression: ".concat(s));
const e = { name: t[4] };
return t[2] != null ? e.toMethod = t[1] : e.toProperty = t[1], t[3] != null && (e.optional = !0), e;
}, { apply: os } = Function.prototype, Ua = new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");
var wi, Ti, ki;
class Le extends H {
static box() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
return t instanceof this ? t : this.fromUCS2String(t?.toString());
}
static fromUCS2String(t) {
return new this(t, hn(t));
}
static fromCodepoints(t) {
return new this(un(t), t);
}
constructor(t, e) {
super(...arguments), this.ucs2String = t, this.codepoints = e, this.length = this.codepoints.length, this.ucs2Length = this.ucs2String.length;
}
offsetToUCS2Offset(t) {
return un(this.codepoints.slice(0, Math.max(0, t))).length;
}
offsetFromUCS2Offset(t) {
return hn(this.ucs2String.slice(0, Math.max(0, t))).length;
}
slice() {
return this.constructor.fromCodepoints(this.codepoints.slice(...arguments));
}
charAt(t) {
return this.slice(t, t + 1);
}
isEqualTo(t) {
return this.constructor.box(t).ucs2String === this.ucs2String;
}
toJSON() {
return this.ucs2String;
}
getCacheKey() {
return this.ucs2String;
}
toString() {
return this.ucs2String;
}
}
const Va = ((wi = Array.from) === null || wi === void 0 ? void 0 : wi.call(Array, "👼").length) === 1, ja = ((Ti = " ".codePointAt) === null || Ti === void 0 ? void 0 : Ti.call(" ", 0)) != null, Wa = ((ki = String.fromCodePoint) === null || ki === void 0 ? void 0 : ki.call(String, 32, 128124)) === " 👼";
let hn, un;
hn = Va && ja ? (s) => Array.from(s).map(((t) => t.codePointAt(0))) : function(s) {
const t = [];
let e = 0;
const { length: i } = s;
for (; e < i; ) {
let n = s.charCodeAt(e++);
if (55296 <= n && n <= 56319 && e < i) {
const r = s.charCodeAt(e++);
(64512 & r) == 56320 ? n = ((1023 & n) << 10) + (1023 & r) + 65536 : e--;
}
t.push(n);
}
return t;
}, un = Wa ? (s) => String.fromCodePoint(...Array.from(s || [])) : function(s) {
return (() => {
const t = [];
return Array.from(s).forEach(((e) => {
let i = "";
e > 65535 && (e -= 65536, i += String.fromCharCode(e >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t.push(i + String.fromCharCode(e));
})), t;
})().join("");
};
let za = 0;
class qt extends H {
static fromJSONString(t) {
return this.fromJSON(JSON.parse(t));
}
constructor() {
super(...arguments), this.id = ++za;
}
hasSameConstructorAs(t) {
return this.constructor === t?.constructor;
}
isEqualTo(t) {
return this === t;
}
inspect() {
const t = [], e = this.contentsForInspection() || {};
for (const i in e) {
const n = e[i];
t.push("".concat(i, "=").concat(n));
}
return "#<".concat(this.constructor.name, ":").concat(this.id).concat(t.length ? " ".concat(t.join(", ")) : "", ">");
}
contentsForInspection() {
}
toJSONString() {
return JSON.stringify(this);
}
toUTF16String() {
return Le.box(this);
}
getCacheKey() {
return this.id.toString();
}
}
const Ft = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
if (s.length !== t.length) return !1;
for (let e = 0; e < s.length; e++)
if (s[e] !== t[e]) return !1;
return !0;
}, Tn = function(s) {
const t = s.slice(0);
for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n];
return t.splice(...i), t;
}, Ka = /[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/, Ga = (function() {
const s = x("input", { dir: "auto", name: "x", dirName: "x.dir" }), t = x("textarea", { dir: "auto", name: "y", dirName: "y.dir" }), e = x("form");
e.appendChild(s), e.appendChild(t);
const i = (function() {
try {
return new FormData(e).has(t.dirName);
} catch {
return !1;
}
})(), n = (function() {
try {
return s.matches(":dir(ltr),:dir(rtl)");
} catch {
return !1;
}
})();
return i ? function(r) {
return t.value = r, new FormData(e).get(t.dirName);
} : n ? function(r) {
return s.value = r, s.matches(":dir(rtl)") ? "rtl" : "ltr";
} : function(r) {
const a = r.trim().charAt(0);
return Ka.test(a) ? "rtl" : "ltr";
};
})();
let Ii = null, Ri = null, Di = null, Fe = null;
const mn = () => (Ii || (Ii = Ya().concat(Ja())), Ii), P = (s) => X[s], Ja = () => (Ri || (Ri = Object.keys(X)), Ri), gn = (s) => Pt[s], Ya = () => (Di || (Di = Object.keys(Pt)), Di), Ur = function(s, t) {
Xa(s).textContent = t.replace(/%t/g, s);
}, Xa = function(s) {
const t = document.createElement("style");
t.setAttribute("type", "text/css"), t.setAttribute("data-tag-name", s.toLowerCase());
const e = Qa();
return e && t.setAttribute("nonce", e), document.head.insertBefore(t, document.head.firstChild), t;
}, Qa = function() {
const s = ls("trix-csp-nonce") || ls("csp-nonce");
if (s) {
const { nonce: t, content: e } = s;
return t == "" ? e : t;
}
}, ls = (s) => document.head.querySelector("meta[name=".concat(s, "]")), ds = { "application/x-trix-feature-detection": "test" }, Vr = function(s) {
const t = s.getData("text/plain"), e = s.getData("text/html");
if (!t || !e) return t?.length;
{
const { body: i } = new DOMParser().parseFromString(e, "text/html");
if (i.textContent === t) return !i.querySelector("*");
}
}, jr = /Mac|^iP/.test(navigator.platform) ? (s) => s.metaKey : (s) => s.ctrlKey, kn = (s) => setTimeout(s, 1), Wr = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
const t = {};
for (const e in s) {
const i = s[e];
t[e] = i;
}
return t;
}, ne = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (Object.keys(s).length !== Object.keys(t).length) return !1;
for (const e in s)
if (s[e] !== t[e]) return !1;
return !0;
}, k = function(s) {
if (s != null) return Array.isArray(s) || (s = [s, s]), [cs(s[0]), cs(s[1] != null ? s[1] : s[0])];
}, _t = function(s) {
if (s == null) return;
const [t, e] = k(s);
return pn(t, e);
}, Ze = function(s, t) {
if (s == null || t == null) return;
const [e, i] = k(s), [n, r] = k(t);
return pn(e, n) && pn(i, r);
}, cs = function(s) {
return typeof s == "number" ? s : Wr(s);
}, pn = function(s, t) {
return typeof s == "number" ? s === t : ne(s, t);
};
class zr extends H {
constructor() {
super(...arguments), this.update = this.update.bind(this), this.selectionManagers = [];
}
start() {
this.started || (this.started = !0, document.addEventListener("selectionchange", this.update, !0));
}
stop() {
if (this.started) return this.started = !1, document.removeEventListener("selectionchange", this.update, !0);
}
registerSelectionManager(t) {
if (!this.selectionManagers.includes(t)) return this.selectionManagers.push(t), this.start();
}
unregisterSelectionManager(t) {
if (this.selectionManagers = this.selectionManagers.filter(((e) => e !== t)), this.selectionManagers.length === 0) return this.stop();
}
notifySelectionManagersOfSelectionChange() {
return this.selectionManagers.map(((t) => t.selectionDidChange()));
}
update() {
this.notifySelectionManagersOfSelectionChange();
}
reset() {
this.update();
}
}
const Ht = new zr(), Kr = function() {
const s = window.getSelection();
if (s.rangeCount > 0) return s;
}, ye = function() {
var s;
const t = (s = Kr()) === null || s === void 0 ? void 0 : s.getRangeAt(0);
if (t && !Za(t)) return t;
}, Gr = function(s) {
const t = window.getSelection();
return t.removeAllRanges(), t.addRange(s), Ht.update();
}, Za = (s) => hs(s.startContainer) || hs(s.endContainer), hs = (s) => !Object.getPrototypeOf(s), fe = (s) => s.replace(new RegExp("".concat(ni), "g"), "").replace(new RegExp("".concat(St), "g"), " "), In = new RegExp("[^\\S".concat(St, "]")), Rn = (s) => s.replace(new RegExp("".concat(In.source), "g"), " ").replace(/\ {2,}/g, " "), us = function(s, t) {
if (s.isEqualTo(t)) return ["", ""];
const e = Oi(s, t), { length: i } = e.utf16String;
let n;
if (i) {
const { offset: r } = e, a = s.codepoints.slice(0, r).concat(s.codepoints.slice(r + i));
n = Oi(t, Le.fromCodepoints(a));
} else n = Oi(t, s);
return [e.utf16String.toString(), n.utf16String.toString()];
}, Oi = function(s, t) {
let e = 0, i = s.length, n = t.length;
for (; e < i && s.charAt(e).isEqualTo(t.charAt(e)); ) e++;
for (; i > e + 1 && s.charAt(i - 1).isEqualTo(t.charAt(n - 1)); ) i--, n--;
return { utf16String: s.slice(e, i), offset: e };
};
class et extends qt {
static fromCommonAttributesOfObjects() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
if (!t.length) return new this();
let e = de(t[0]), i = e.getKeys();
return t.slice(1).forEach(((n) => {
i = e.getKeysCommonToHash(de(n)), e = e.slice(i);
})), e;
}
static box(t) {
return de(t);
}
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
super(...arguments), this.values = Ye(t);
}
add(t, e) {
return this.merge(to(t, e));
}
remove(t) {
return new et(Ye(this.values, t));
}
get(t) {
return this.values[t];
}
has(t) {
return t in this.values;
}
merge(t) {
return new et(eo(this.values, io(t)));
}
slice(t) {
const e = {};
return Array.from(t).forEach(((i) => {
this.has(i) && (e[i] = this.values[i]);
})), new et(e);
}
getKeys() {
return Object.keys(this.values);
}
getKeysCommonToHash(t) {
return t = de(t), this.getKeys().filter(((e) => this.values[e] === t.values[e]));
}
isEqualTo(t) {
return Ft(this.toArray(), de(t).toArray());
}
isEmpty() {
return this.getKeys().length === 0;
}
toArray() {
if (!this.array) {
const t = [];
for (const e in this.values) {
const i = this.values[e];
t.push(t.push(e, i));
}
this.array = t.slice(0);
}
return this.array;
}
toObject() {
return Ye(this.values);
}
toJSON() {
return this.toObject();
}
contentsForInspection() {
return { values: JSON.stringify(this.values) };
}
}
const to = function(s, t) {
const e = {};
return e[s] = t, e;
}, eo = function(s, t) {
const e = Ye(s);
for (const i in t) {
const n = t[i];
e[i] = n;
}
return e;
}, Ye = function(s, t) {
const e = {};
return Object.keys(s).sort().forEach(((i) => {
i !== t && (e[i] = s[i]);
})), e;
}, de = function(s) {
return s instanceof et ? s : new et(s);
}, io = function(s) {
return s instanceof et ? s.values : s;
};
class Dn {
static groupObjects() {
let t, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { depth: i, asTree: n } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
n && i == null && (i = 0);
const r = [];
return Array.from(e).forEach(((a) => {
var o;
if (t) {
var l, c, u;
if ((l = a.canBeGrouped) !== null && l !== void 0 && l.call(a, i) && (c = (u = t[t.length - 1]).canBeGroupedWith) !== null && c !== void 0 && c.call(u, a, i)) return void t.push(a);
r.push(new this(t, { depth: i, asTree: n })), t = null;
}
(o = a.canBeGrouped) !== null && o !== void 0 && o.call(a, i) ? t = [a] : r.push(a);
})), t && r.push(new this(t, { depth: i, asTree: n })), r;
}
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], { depth: e, asTree: i } = arguments.length > 1 ? arguments[1] : void 0;
this.objects = t, i && (this.depth = e, this.objects = this.constructor.groupObjects(this.objects, { asTree: i, depth: this.depth + 1 }));
}
getObjects() {
return this.objects;
}
getDepth() {
return this.depth;
}
getCacheKey() {
const t = ["objectGroup"];
return Array.from(this.getObjects()).forEach(((e) => {
t.push(e.getCacheKey());
})), t.join("/");
}
}
class no extends H {
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
super(...arguments), this.objects = {}, Array.from(t).forEach(((e) => {
const i = JSON.stringify(e);
this.objects[i] == null && (this.objects[i] = e);
}));
}
find(t) {
const e = JSON.stringify(t);
return this.objects[e];
}
}
class so {
constructor(t) {
this.reset(t);
}
add(t) {
const e = ms(t);
this.elements[e] = t;
}
remove(t) {
const e = ms(t), i = this.elements[e];
if (i) return delete this.elements[e], i;
}
reset() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
return this.elements = {}, Array.from(t).forEach(((e) => {
this.add(e);
})), t;
}
}
const ms = (s) => s.dataset.trixStoreKey;
class ti extends H {
isPerforming() {
return this.performing === !0;
}
hasPerformed() {
return this.performed === !0;
}
hasSucceeded() {
return this.performed && this.succeeded;
}
hasFailed() {
return this.performed && !this.succeeded;
}
getPromise() {
return this.promise || (this.promise = new Promise(((t, e) => (this.performing = !0, this.perform(((i, n) => {
this.succeeded = i, this.performing = !1, this.performed = !0, this.succeeded ? t(n) : e(n);
})))))), this.promise;
}
perform(t) {
return t(!1);
}
release() {
var t, e;
(t = this.promise) === null || t === void 0 || (e = t.cancel) === null || e === void 0 || e.call(t), this.promise = null, this.performing = null, this.performed = null, this.succeeded = null;
}
}
ti.proxyMethod("getPromise().then"), ti.proxyMethod("getPromise().catch");
class $t extends H {
constructor(t) {
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
super(...arguments), this.object = t, this.options = e, this.childViews = [], this.rootView = this;
}
getNodes() {
return this.nodes || (this.nodes = this.createNodes()), this.nodes.map(((t) => t.cloneNode(!0)));
}
invalidate() {
var t;
return this.nodes = null, this.childViews = [], (t = this.parentView) === null || t === void 0 ? void 0 : t.invalidate();
}
invalidateViewForObject(t) {
var e;
return (e = this.findViewForObject(t)) === null || e === void 0 ? void 0 : e.invalidate();
}
findOrCreateCachedChildView(t, e, i) {
let n = this.getCachedViewForObject(e);
return n ? this.recordChildView(n) : (n = this.createChildView(...arguments), this.cacheViewForObject(n, e)), n;
}
createChildView(t, e) {
let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
e instanceof Dn && (i.viewClass = t, t = ro);
const n = new t(e, i);
return this.recordChildView(n);
}
recordChildView(t) {
return t.parentView = this, t.rootView = this.rootView, this.childViews.push(t), t;
}
getAllChildViews() {
let t = [];
return this.childViews.forEach(((e) => {
t.push(e), t = t.concat(e.getAllChildViews());
})), t;
}
findElement() {
return this.findElementForObject(this.object);
}
findElementForObject(t) {
const e = t?.id;
if (e) return this.rootView.element.querySelector("[data-trix-id='".concat(e, "']"));
}
findViewForObject(t) {
for (const e of this.getAllChildViews()) if (e.object === t) return e;
}
getViewCache() {
return this.rootView !== this ? this.rootView.getViewCache() : this.isViewCachingEnabled() ? (this.viewCache || (this.viewCache = {}), this.viewCache) : void 0;
}
isViewCachingEnabled() {
return this.shouldCacheViews !== !1;
}
enableViewCaching() {
this.shouldCacheViews = !0;
}
disableViewCaching() {
this.shouldCacheViews = !1;
}
getCachedViewForObject(t) {
var e;
return (e = this.getViewCache()) === null || e === void 0 ? void 0 : e[t.getCacheKey()];
}
cacheViewForObject(t, e) {
const i = this.getViewCache();
i && (i[e.getCacheKey()] = t);
}
garbageCollectCachedViews() {
const t = this.getViewCache();
if (t) {
const e = this.getAllChildViews().concat(this).map(((i) => i.object.getCacheKey()));
for (const i in t) e.includes(i) || delete t[i];
}
}
}
class ro extends $t {
constructor() {
super(...arguments), this.objectGroup = this.object, this.viewClass = this.options.viewClass, delete this.options.viewClass;
}
getChildViews() {
return this.childViews.length || Array.from(this.objectGroup.getObjects()).forEach(((t) => {
this.findOrCreateCachedChildView(this.viewClass, t, this.options);
})), this.childViews;
}
createNodes() {
const t = this.createContainerElement();
return this.getChildViews().forEach(((e) => {
Array.from(e.getNodes()).forEach(((i) => {
t.appendChild(i);
}));
})), [t];
}
createContainerElement() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.objectGroup.getDepth();
return this.getChildViews()[0].createContainerElement(t);
}
}
const { entries: Jr, setPrototypeOf: gs, isFrozen: ao, getPrototypeOf: oo, getOwnPropertyDescriptor: lo } = Object;
let { freeze: Q, seal: st, create: Yr } = Object, { apply: fn, construct: bn } = typeof Reflect < "u" && Reflect;
Q || (Q = function(s) {
return s;
}), st || (st = function(s) {
return s;
}), fn || (fn = function(s, t) {
for (var e = arguments.length, i = new Array(e > 2 ? e - 2 : 0), n = 2; n < e; n++) i[n - 2] = arguments[n];
return s.apply(t, i);
}), bn || (bn = function(s) {
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) e[i - 1] = arguments[i];
return new s(...e);
});
const He = Z(Array.prototype.forEach), co = Z(Array.prototype.lastIndexOf), ps = Z(Array.prototype.pop), ce = Z(Array.prototype.push), ho = Z(Array.prototype.splice), Xe = Z(String.prototype.toLowerCase), Bi = Z(String.prototype.toString), Mi = Z(String.prototype.match), he = Z(String.prototype.replace), uo = Z(String.prototype.indexOf), mo = Z(String.prototype.trim), lt = Z(Object.prototype.hasOwnProperty), J = Z(RegExp.prototype.test), ue = (fs = TypeError, function() {
for (var s = arguments.length, t = new Array(s), e = 0; e < s; e++) t[e] = arguments[e];
return bn(fs, t);
});
var fs;
function Z(s) {
return function(t) {
t instanceof RegExp && (t.lastIndex = 0);
for (var e = arguments.length, i = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n];
return fn(s, t, i);
};
}
function L(s, t) {
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Xe;
gs && gs(s, null);
let i = t.length;
for (; i--; ) {
let n = t[i];
if (typeof n == "string") {
const r = e(n);
r !== n && (ao(t) || (t[i] = r), n = r);
}
s[n] = !0;
}
return s;
}
function go(s) {
for (let t = 0; t < s.length; t++)
lt(s, t) || (s[t] = null);
return s;
}
function ft(s) {
const t = Yr(null);
for (const [e, i] of Jr(s))
lt(s, e) && (Array.isArray(i) ? t[e] = go(i) : i && typeof i == "object" && i.constructor === Object ? t[e] = ft(i) : t[e] = i);
return t;
}
function me(s, t) {
for (; s !== null; ) {
const e = lo(s, t);
if (e) {
if (e.get) return Z(e.get);
if (typeof e.value == "function") return Z(e.value);
}
s = oo(s);
}
return function() {
return null;
};
}
const bs = Q(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Ni = Q(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Pi = Q(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), po = Q(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Fi = Q(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), fo = Q(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), _s = Q(["#text"]), vs = Q(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Hi = Q(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ys = Q(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), qe = Q(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), bo = st(/\{\{[\w\W]*|[\w\W]*\}\}/gm), _o = st(/<%[\w\W]*|[\w\W]*%>/gm), vo = st(/\$\{[\w\W]*/gm), yo = st(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ao = st(/^aria-[\-\w]+$/), Xr = st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Eo = st(/^(?:\w+script|data):/i), xo = st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Qr = st(/^html$/i), So = st(/^[a-z][.\w]*(-[.\w]+)+$/i);
var As = Object.freeze({ __proto__: null, ARIA_ATTR: Ao, ATTR_WHITESPACE: xo, CUSTOM_ELEMENT: So, DATA_ATTR: yo, DOCTYPE_NAME: Qr, ERB_EXPR: _o, IS_ALLOWED_URI: Xr, IS_SCRIPT_OR_DATA: Eo, MUSTACHE_EXPR: bo, TMPLIT_EXPR: vo });
const Lo = 1, Co = 3, wo = 7, To = 8, ko = 9, Io = function() {
return typeof window > "u" ? null : window;
};
var Ce = (function s() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Io();
const e = (d) => s(d);
if (e.version = "3.2.7", e.removed = [], !t || !t.document || t.document.nodeType !== ko || !t.Element) return e.isSupported = !1, e;
let { document: i } = t;
const n = i, r = n.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: l, Element: c, NodeFilter: u, NamedNodeMap: h = t.NamedNodeMap || t.MozNamedAttrMap, HTMLFormElement: m, DOMParser: g, trustedTypes: b } = t, A = c.prototype, I = me(A, "cloneNode"), q = me(A, "remove"), R = me(A, "nextSibling"), $ = me(A, "childNodes"), _ = me(A, "parentNode");
if (typeof o == "function") {
const d = i.createElement("template");
d.content && d.content.ownerDocument && (i = d.content.ownerDocument);
}
let S, E = "";
const { implementation: j, createNodeIterator: ct, createDocumentFragment: wt, getElementsByTagName: mt } = i, { importNode: li } = n;
let K = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] };
e.isSupported = typeof Jr == "function" && typeof _ == "function" && j && j.createHTMLDocument !== void 0;
const { MUSTACHE_EXPR: Tt, ERB_EXPR: Vt, TMPLIT_EXPR: tt, DATA_ATTR: di, ARIA_ATTR: ci, IS_SCRIPT_OR_DATA: hi, ATTR_WHITESPACE: Ie, CUSTOM_ELEMENT: ui } = As;
let { IS_ALLOWED_URI: F } = As, D = null;
const Mn = L({}, [...bs, ...Ni, ...Pi, ...Fi, ..._s]);
let W = null;
const Nn = L({}, [...vs, ...Hi, ...ys, ...qe]);
let M = Object.seal(Yr(null, { tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 } })), re = null, mi = null, Pn = !0, gi = !0, Fn = !1, Hn = !0, jt = !1, Re = !0, kt = !1, pi = !1, fi = !1, Wt = !1, De = !1, Oe = !1, qn = !0, $n = !1, bi = !0, ae = !1, zt = {}, Kt = null;
const Un = L({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
let Vn = null;
const jn = L({}, ["audio", "video", "img", "source", "image", "track"]);
let _i = null;
const Wn = L({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Be = "http://www.w3.org/1998/Math/MathML", Me = "http://www.w3.org/2000/svg", gt = "http://www.w3.org/1999/xhtml";
let Gt = gt, vi = !1, yi = null;
const Da = L({}, [Be, Me, gt], Bi);
let Ne = L({}, ["mi", "mo", "mn", "ms", "mtext"]), Pe = L({}, ["annotation-xml"]);
const Oa = L({}, ["title", "style", "font", "a", "script"]);
let oe = null;
const Ba = ["application/xhtml+xml", "text/html"];
let V = null, Jt = null;
const Ma = i.createElement("form"), zn = function(d) {
return d instanceof RegExp || d instanceof Function;
}, Ai = function() {
let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
if (!Jt || Jt !== d) {
if (d && typeof d == "object" || (d = {}), d = ft(d), oe = Ba.indexOf(d.PARSER_MEDIA_TYPE) === -1 ? "text/html" : d.PARSER_MEDIA_TYPE, V = oe === "application/xhtml+xml" ? Bi : Xe, D = lt(d, "ALLOWED_TAGS") ? L({}, d.ALLOWED_TAGS, V) : Mn, W = lt(d, "ALLOWED_ATTR") ? L({}, d.ALLOWED_ATTR, V) : Nn, yi = lt(d, "ALLOWED_NAMESPACES") ? L({}, d.ALLOWED_NAMESPACES, Bi) : Da, _i = lt(d, "ADD_URI_SAFE_ATTR") ? L(ft(Wn), d.ADD_URI_SAFE_ATTR, V) : Wn, Vn = lt(d, "ADD_DATA_URI_TAGS") ? L(ft(jn), d.ADD_DATA_URI_TAGS, V) : jn, Kt = lt(d, "FORBID_CONTENTS") ? L({}, d.FORBID_CONTENTS, V) : Un, re = lt(d, "FORBID_TAGS") ? L({}, d.FORBID_TAGS, V) : ft({}), mi = lt(d, "FORBID_ATTR") ? L({}, d.FORBID_ATTR, V) : ft({}), zt = !!lt(d, "USE_PROFILES") && d.USE_PROFILES, Pn = d.ALLOW_ARIA_ATTR !== !1, gi = d.ALLOW_DATA_ATTR !== !1, Fn = d.ALLOW_UNKNOWN_PROTOCOLS || !1, Hn = d.ALLOW_SELF_CLOSE_IN_ATTR !== !1, jt = d.SAFE_FOR_TEMPLATES || !1, Re = d.SAFE_FOR_XML !== !1, kt = d.WHOLE_DOCUMENT || !1, Wt = d.RETURN_DOM || !1, De = d.RETURN_DOM_FRAGMENT || !1, Oe = d.RETURN_TRUSTED_TYPE || !1, fi = d.FORCE_BODY || !1, qn = d.SANITIZE_DOM !== !1, $n = d.SANITIZE_NAMED_PROPS || !1, bi = d.KEEP_CONTENT !== !1, ae = d.IN_PLACE || !1, F = d.ALLOWED_URI_REGEXP || Xr, Gt = d.NAMESPACE || gt, Ne = d.MATHML_TEXT_INTEGRATION_POINTS || Ne, Pe = d.HTML_INTEGRATION_POINTS || Pe, M = d.CUSTOM_ELEMENT_HANDLING || {}, d.CUSTOM_ELEMENT_HANDLING && zn(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (M.tagNameCheck = d.CUSTOM_ELEMENT_HANDLING.tagNameCheck), d.CUSTOM_ELEMENT_HANDLING && zn(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (M.attributeNameCheck = d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), d.CUSTOM_ELEMENT_HANDLING && typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (M.allowCustomizedBuiltInElements = d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), jt && (gi = !1), De && (Wt = !0), zt && (D = L({}, _s), W = [], zt.html === !0 && (L(D, bs), L(W, vs)), zt.svg === !0 && (L(D, Ni), L(W, Hi), L(W, qe)), zt.svgFilters === !0 && (L(D, Pi), L(W, Hi), L(W, qe)), zt.mathMl === !0 && (L(D, Fi), L(W, ys), L(W, qe))), d.ADD_TAGS && (D === Mn && (D = ft(D)), L(D, d.ADD_TAGS, V)), d.ADD_ATTR && (W === Nn && (W = ft(W)), L(W, d.ADD_ATTR, V)), d.ADD_URI_SAFE_ATTR && L(_i, d.ADD_URI_SAFE_ATTR, V), d.FORBID_CONTENTS && (Kt === Un && (Kt = ft(Kt)), L(Kt, d.FORBID_CONTENTS, V)), bi && (D["#text"] = !0), kt && L(D, ["html", "head", "body"]), D.table && (L(D, ["tbody"]), delete re.tbody), d.TRUSTED_TYPES_POLICY) {
if (typeof d.TRUSTED_TYPES_POLICY.createHTML != "function") throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
if (typeof d.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
S = d.TRUSTED_TYPES_POLICY, E = S.createHTML("");
} else S === void 0 && (S = (function(f, p) {
if (typeof f != "object" || typeof f.createPolicy != "function") return null;
let C = null;
const T = "data-tt-policy-suffix";
p && p.hasAttribute(T) && (C = p.getAttribute(T));
const y = "dompurify" + (C ? "#" + C : "");
try {
return f.createPolicy(y, { createHTML: (U) => U, createScriptURL: (U) => U });
} catch {
return console.warn("TrustedTypes policy " + y + " could not be created."), null;
}
})(b, r)), S !== null && typeof E == "string" && (E = S.createHTML(""));
Q && Q(d), Jt = d;
}
}, Kn = L({}, [...Ni, ...Pi, ...po]), Gn = L({}, [...Fi, ...fo]), ht = function(d) {
ce(e.removed, { element: d });
try {
_(d).removeChild(d);
} catch {
q(d);
}
}, It = function(d, f) {
try {
ce(e.removed, { attribute: f.getAttributeNode(d), from: f });
} catch {
ce(e.removed, { attribute: null, from: f });
}
if (f.removeAttribute(d), d === "is") if (Wt || De) try {
ht(f);
} catch {
}
else try {
f.setAttribute(d, "");
} catch {
}
}, Jn = function(d) {
let f = null, p = null;
if (fi) d = "" + d;
else {
const y = Mi(d, /^[\r\n\t ]+/);
p = y && y[0];
}
oe === "application/xhtml+xml" && Gt === gt && (d = '' + d + "");
const C = S ? S.createHTML(d) : d;
if (Gt === gt) try {
f = new g().parseFromString(C, oe);
} catch {
}
if (!f || !f.documentElement) {
f = j.createDocument(Gt, "template", null);
try {
f.documentElement.innerHTML = vi ? E : C;
} catch {
}
}
const T = f.body || f.documentElement;
return d && p && T.insertBefore(i.createTextNode(p), T.childNodes[0] || null), Gt === gt ? mt.call(f, kt ? "html" : "body")[0] : kt ? f.documentElement : T;
}, Yn = function(d) {
return ct.call(d.ownerDocument || d, d, u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION, null);
}, Ei = function(d) {
return d instanceof m && (typeof d.nodeName != "string" || typeof d.textContent != "string" || typeof d.removeChild != "function" || !(d.attributes instanceof h) || typeof d.removeAttribute != "function" || typeof d.setAttribute != "function" || typeof d.namespaceURI != "string" || typeof d.insertBefore != "function" || typeof d.hasChildNodes != "function");
}, Xn = function(d) {
return typeof l == "function" && d instanceof l;
};
function pt(d, f, p) {
He(d, ((C) => {
C.call(e, f, p, Jt);
}));
}
const Qn = function(d) {
let f = null;
if (pt(K.beforeSanitizeElements, d, null), Ei(d)) return ht(d), !0;
const p = V(d.nodeName);
if (pt(K.uponSanitizeElement, d, { tagName: p, allowedTags: D }), Re && d.hasChildNodes() && !Xn(d.firstElementChild) && J(/<[/\w!]/g, d.innerHTML) && J(/<[/\w!]/g, d.textContent) || d.nodeType === wo || Re && d.nodeType === To && J(/<[/\w]/g, d.data)) return ht(d), !0;
if (!D[p] || re[p]) {
if (!re[p] && ts(p) && (M.tagNameCheck instanceof RegExp && J(M.tagNameCheck, p) || M.tagNameCheck instanceof Function && M.tagNameCheck(p)))
return !1;
if (bi && !Kt[p]) {
const C = _(d) || d.parentNode, T = $(d) || d.childNodes;
if (T && C)
for (let y = T.length - 1; y >= 0; --y) {
const U = I(T[y], !0);
U.__removalCount = (d.__removalCount || 0) + 1, C.insertBefore(U, R(d));
}
}
return ht(d), !0;
}
return d instanceof c && !(function(C) {
let T = _(C);
T && T.tagName || (T = { namespaceURI: Gt, tagName: "template" });
const y = Xe(C.tagName), U = Xe(T.tagName);
return !!yi[C.namespaceURI] && (C.namespaceURI === Me ? T.namespaceURI === gt ? y === "svg" : T.namespaceURI === Be ? y === "svg" && (U === "annotation-xml" || Ne[U]) : !!Kn[y] : C.namespaceURI === Be ? T.namespaceURI === gt ? y === "math" : T.namespaceURI === Me ? y === "math" && Pe[U] : !!Gn[y] : C.namespaceURI === gt ? !(T.namespaceURI === Me && !Pe[U]) && !(T.namespaceURI === Be && !Ne[U]) && !Gn[y] && (Oa[y] || !Kn[y]) : !(oe !== "application/xhtml+xml" || !yi[C.namespaceURI]));
})(d) ? (ht(d), !0) : p !== "noscript" && p !== "noembed" && p !== "noframes" || !J(/<\/no(script|embed|frames)/i, d.innerHTML) ? (jt && d.nodeType === Co && (f = d.textContent, He([Tt, Vt, tt], ((C) => {
f = he(f, C, " ");
})), d.textContent !== f && (ce(e.removed, { element: d.cloneNode() }), d.textContent = f)), pt(K.afterSanitizeElements, d, null), !1) : (ht(d), !0);
}, Zn = function(d, f, p) {
if (qn && (f === "id" || f === "name") && (p in i || p in Ma)) return !1;
if (!(gi && !mi[f] && J(di, f))) {
if (!(Pn && J(ci, f))) {
if (!W[f] || mi[f]) {
if (!(ts(d) && (M.tagNameCheck instanceof RegExp && J(M.tagNameCheck, d) || M.tagNameCheck instanceof Function && M.tagNameCheck(d)) && (M.attributeNameCheck instanceof RegExp && J(M.attributeNameCheck, f) || M.attributeNameCheck instanceof Function && M.attributeNameCheck(f, d)) || f === "is" && M.allowCustomizedBuiltInElements && (M.tagNameCheck instanceof RegExp && J(M.tagNameCheck, p) || M.tagNameCheck instanceof Function && M.tagNameCheck(p)))) return !1;
} else if (!_i[f]) {
if (!J(F, he(p, Ie, ""))) {
if ((f !== "src" && f !== "xlink:href" && f !== "href" || d === "script" || uo(p, "data:") !== 0 || !Vn[d]) && !(Fn && !J(hi, he(p, Ie, "")))) {
if (p) return !1;
}
}
}
}
}
return !0;
}, ts = function(d) {
return d !== "annotation-xml" && Mi(d, ui);
}, es = function(d) {
pt(K.beforeSanitizeAttributes, d, null);
const { attributes: f } = d;
if (!f || Ei(d)) return;
const p = { attrName: "", attrValue: "", keepAttr: !0, allowedAttributes: W, forceKeepAttr: void 0 };
let C = f.length;
for (; C--; ) {
const T = f[C], { name: y, namespaceURI: U, value: vt } = T, rt = V(y), xi = vt;
let z = y === "value" ? xi : mo(xi);
if (p.attrName = rt, p.attrValue = z, p.keepAttr = !0, p.forceKeepAttr = void 0, pt(K.uponSanitizeAttribute, d, p), z = p.attrValue, !$n || rt !== "id" && rt !== "name" || (It(y, d), z = "user-content-" + z), Re && J(/((--!?|])>)|<\/(style|title|textarea)/i, z)) {
It(y, d);
continue;
}
if (rt === "attributename" && Mi(z, "href")) {
It(y, d);
continue;
}
if (p.forceKeepAttr) continue;
if (!p.keepAttr) {
It(y, d);
continue;
}
if (!Hn && J(/\/>/i, z)) {
It(y, d);
continue;
}
jt && He([Tt, Vt, tt], ((ns) => {
z = he(z, ns, " ");
}));
const is = V(d.nodeName);
if (Zn(is, rt, z)) {
if (S && typeof b == "object" && typeof b.getAttributeType == "function" && !U) switch (b.getAttributeType(is, rt)) {
case "TrustedHTML":
z = S.createHTML(z);
break;
case "TrustedScriptURL":
z = S.createScriptURL(z);
}
if (z !== xi) try {
U ? d.setAttributeNS(U, y, z) : d.setAttribute(y, z), Ei(d) ? ht(d) : ps(e.removed);
} catch {
It(y, d);
}
} else It(y, d);
}
pt(K.afterSanitizeAttributes, d, null);
}, Na = function d(f) {
let p = null;
const C = Yn(f);
for (pt(K.beforeSanitizeShadowDOM, f, null); p = C.nextNode(); ) pt(K.uponSanitizeShadowNode, p, null), Qn(p), es(p), p.content instanceof a && d(p.content);
pt(K.afterSanitizeShadowDOM, f, null);
};
return e.sanitize = function(d) {
let f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, C = null, T = null, y = null;
if (vi = !d, vi && (d = ""), typeof d != "string" && !Xn(d)) {
if (typeof d.toString != "function") throw ue("toString is not a function");
if (typeof (d = d.toString()) != "string") throw ue("dirty is not a string, aborting");
}
if (!e.isSupported) return d;
if (pi || Ai(f), e.removed = [], typeof d == "string" && (ae = !1), ae) {
if (d.nodeName) {
const rt = V(d.nodeName);
if (!D[rt] || re[rt]) throw ue("root node is forbidden and cannot be sanitized in-place");
}
} else if (d instanceof l) p = Jn(""), C = p.ownerDocument.importNode(d, !0), C.nodeType === Lo && C.nodeName === "BODY" || C.nodeName === "HTML" ? p = C : p.appendChild(C);
else {
if (!Wt && !jt && !kt && d.indexOf("<") === -1) return S && Oe ? S.createHTML(d) : d;
if (p = Jn(d), !p) return Wt ? null : Oe ? E : "";
}
p && fi && ht(p.firstChild);
const U = Yn(ae ? d : p);
for (; T = U.nextNode(); ) Qn(T), es(T), T.content instanceof a && Na(T.content);
if (ae) return d;
if (Wt) {
if (De) for (y = wt.call(p.ownerDocument); p.firstChild; ) y.appendChild(p.firstChild);
else y = p;
return (W.shadowroot || W.shadowrootmode) && (y = li.call(n, y, !0)), y;
}
let vt = kt ? p.outerHTML : p.innerHTML;
return kt && D["!doctype"] && p.ownerDocument && p.ownerDocument.doctype && p.ownerDocument.doctype.name && J(Qr, p.ownerDocument.doctype.name) && (vt = "
` + vt), jt && He([Tt, Vt, tt], ((rt) => {
vt = he(vt, rt, " ");
})), S && Oe ? S.createHTML(vt) : vt;
}, e.setConfig = function() {
Ai(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), pi = !0;
}, e.clearConfig = function() {
Jt = null, pi = !1;
}, e.isValidAttribute = function(d, f, p) {
Jt || Ai({});
const C = V(d), T = V(f);
return Zn(C, T, p);
}, e.addHook = function(d, f) {
typeof f == "function" && ce(K[d], f);
}, e.removeHook = function(d, f) {
if (f !== void 0) {
const p = co(K[d], f);
return p === -1 ? void 0 : ho(K[d], p, 1)[0];
}
return ps(K[d]);
}, e.removeHooks = function(d) {
K[d] = [];
}, e.removeAllHooks = function() {
K = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] };
}, e;
})();
Ce.addHook("uponSanitizeAttribute", (function(s, t) {
/^data-trix-/.test(t.attrName) && (t.forceKeepAttr = !0);
}));
const Ro = "style href src width height language class".split(" "), Do = "javascript:".split(" "), Oo = "script iframe form noscript".split(" ");
class si extends H {
static setHTML(t, e, i) {
const n = new this(e, i).sanitize(), r = n.getHTML ? n.getHTML() : n.outerHTML;
t.innerHTML = r;
}
static sanitize(t, e) {
const i = new this(t, e);
return i.sanitize(), i;
}
constructor(t) {
let { allowedAttributes: e, forbiddenProtocols: i, forbiddenElements: n, purifyOptions: r } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
super(...arguments), this.allowedAttributes = e || Ro, this.forbiddenProtocols = i || Do, this.forbiddenElements = n || Oo, this.purifyOptions = r || {}, this.body = Bo(t);
}
sanitize() {
this.sanitizeElements(), this.normalizeListElementNesting();
const t = Object.assign({}, Mr, this.purifyOptions);
return Ce.setConfig(t), this.body = Ce.sanitize(this.body), this.body;
}
getHTML() {
return this.body.innerHTML;
}
getBody() {
return this.body;
}
sanitizeElements() {
const t = Qe(this.body), e = [];
for (; t.nextNode(); ) {
const i = t.currentNode;
switch (i.nodeType) {
case Node.ELEMENT_NODE:
this.elementIsRemovable(i) ? e.push(i) : this.sanitizeElement(i);
break;
case Node.COMMENT_NODE:
e.push(i);
}
}
return e.forEach(((i) => Ct(i))), this.body;
}
sanitizeElement(t) {
return t.hasAttribute("href") && this.forbiddenProtocols.includes(t.protocol) && t.removeAttribute("href"), Array.from(t.attributes).forEach(((e) => {
let { name: i } = e;
this.allowedAttributes.includes(i) || i.indexOf("data-trix") === 0 || t.removeAttribute(i);
})), t;
}
normalizeListElementNesting() {
return Array.from(this.body.querySelectorAll("ul,ol")).forEach(((t) => {
const e = t.previousElementSibling;
e && Y(e) === "li" && e.appendChild(t);
})), this.body;
}
elementIsRemovable(t) {
if (t?.nodeType === Node.ELEMENT_NODE) return this.elementIsForbidden(t) || this.elementIsntSerializable(t);
}
elementIsForbidden(t) {
return this.forbiddenElements.includes(Y(t));
}
elementIsntSerializable(t) {
return t.getAttribute("data-trix-serialize") === "false" && !Mt(t);
}
}
const Bo = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
s = s.replace(/<\/html[^>]*>[^]*$/i, "