var To = Object.defineProperty;
var ns = (s) => {
throw TypeError(s);
};
var ko = (s, t, e) => t in s ? To(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
var ee = (s, t, e) => ko(s, typeof t != "symbol" ? t + "" : t, e), yi = (s, t, e) => t.has(s) || ns("Cannot " + e);
var Ei = (s, t, e) => (yi(s, t, "read from private field"), e ? e.call(s) : t.get(s)), ie = (s, t, e) => t.has(s) ? ns("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), Me = (s, t, e, i) => (yi(s, t, "write to private field"), i ? i.call(s, e) : t.set(s, e), e), Be = (s, t, e) => (yi(s, t, "access private method"), e);
var Io = "2.1.16";
const kt = "[data-trix-attachment]", yn = { preview: { presentation: "gallery", caption: { name: !0, size: !0 } }, file: { caption: { size: !0 } } }, G = { 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) === G[this.listAttribute].tagName;
} }, numberList: { tagName: "ol", parse: !1 }, number: { tagName: "li", listAttribute: "numberList", group: !1, nestable: !0, test(s) {
return ss(s.parentNode) === G[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 Le = { 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) }, br = { ADD_ATTR: ["language"], SAFE_FOR_XML: !1, RETURN_DOM: !0 }, b = { 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 Ro = [b.bytes, b.KB, b.MB, b.GB, b.TB, b.PB];
var vr = { prefix: "IEC", precision: 2, formatter(s) {
switch (s) {
case 0:
return "0 ".concat(b.bytes);
case 1:
return "1 ".concat(b.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(Ro[e]);
}
} };
const ii = "\uFEFF", _t = " ", _r = function(s) {
for (const t in s) {
const e = s[t];
this[t] = e;
}
return this;
}, En = document.documentElement, Do = En.matches, k = function(s) {
let { onElement: t, matchingSelector: e, withCallback: i, inPhase: n, preventDefault: r, times: o } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const a = t || En, c = e, d = n === "capturing", h = function(m) {
o != null && --o == 0 && h.destroy();
const p = At(m.target, { matchingSelector: c });
p != null && (i == null || i.call(p, m, p), r && m.preventDefault());
};
return h.destroy = () => a.removeEventListener(s, h, d), a.addEventListener(s, h, d), h;
}, Ar = 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 && _r.call(n, i), n;
}, me = function(s) {
let { onElement: t, bubbles: e, cancelable: i, attributes: n } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const r = t ?? En, o = Ar(s, { bubbles: e, cancelable: i, attributes: n });
return r.dispatchEvent(o);
}, yr = function(s, t) {
if ((s == null ? void 0 : s.nodeType) === 1) return Do.call(s, t);
}, At = 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 (yr(s, t)) return s;
s = s.parentNode;
}
}
}, Sn = (s) => document.activeElement !== s && wt(s, document.activeElement), wt = function(s, t) {
if (s && t) for (; t; ) {
if (t === s) return !0;
t = t.parentNode;
}
}, xi = 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;
}, yt = (s) => {
var t;
return s == null || (t = s.parentNode) === null || t === void 0 ? void 0 : t.removeChild(s);
}, Je = 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);
}, K = (s) => {
var t;
return s == null || (t = s.tagName) === null || t === void 0 ? void 0 : t.toLowerCase();
}, _ = 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 ne;
const ge = function() {
if (ne != null) return ne;
ne = [];
for (const s in G) {
const t = G[s];
t.tagName && ne.push(t.tagName);
}
return ne;
}, Li = (s) => zt(s == null ? void 0 : s.firstChild), os = 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 ge().includes(K(e)) && !ge().includes(K(e.firstChild));
}(s);
}, zt = (s) => Oo(s) && (s == null ? void 0 : s.data) === "block", Oo = (s) => (s == null ? void 0 : s.nodeType) === Node.COMMENT_NODE, Kt = function(s) {
let { name: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (s) return pe(s) ? s.data === ii ? !t || s.parentNode.dataset.trixCursorTarget === t : void 0 : Kt(s.firstChild);
}, It = (s) => yr(s, kt), Er = (s) => pe(s) && (s == null ? void 0 : s.data) === "", pe = (s) => (s == null ? void 0 : s.nodeType) === Node.TEXT_NODE, xn = { level2Enabled: !0, getLevel() {
return this.level2Enabled && Le.supportsInputEvents ? 2 : 0;
}, pickFiles(s) {
const t = _("input", { type: "file", multiple: !0, hidden: !0, id: this.fileInputId });
t.addEventListener("change", () => {
s(t.files), yt(t);
}), yt(document.getElementById(this.fileInputId)), document.body.appendChild(t), t.click();
} };
var ze = { removeBlankTableCells: !1, tableCellSeparator: " | ", tableRowSeparator: `
` }, Dt = { 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(kt, ")"), e = s.closest(t);
if (e) return e.getAttribute("href");
} }, strike: { tagName: "del", inheritable: !0 }, frozen: { style: { backgroundColor: "highlight" } } }, Sr = { getDefaultHTML: () => `
`) };
const an = { interval: 5e3 };
var Ce = Object.freeze({ __proto__: null, attachments: yn, blockAttributes: G, browser: Le, 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: br, fileSize: vr, input: xn, keyNames: { 8: "backspace", 9: "tab", 13: "return", 27: "escape", 37: "left", 39: "right", 46: "delete", 68: "d", 72: "h", 79: "o" }, lang: b, parser: ze, textAttributes: Dt, toolbar: Sr, undo: an });
class M {
static proxyMethod(t) {
const { name: e, toMethod: i, toProperty: n, optional: r } = Mo(t);
this.prototype[e] = function() {
let o, a;
var c, d;
return i ? a = r ? (c = this[i]) === null || c === void 0 ? void 0 : c.call(this) : this[i]() : n && (a = this[n]), r ? (o = (d = a) === null || d === void 0 ? void 0 : d[e], o ? as.call(o, a, arguments) : void 0) : (o = a[e], as.call(o, a, arguments));
};
}
}
const Mo = function(s) {
const t = s.match(Bo);
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: as } = Function.prototype, Bo = new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");
var Ci, wi, Ti;
class ye extends M {
static box() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
return t instanceof this ? t : this.fromUCS2String(t == null ? void 0 : t.toString());
}
static fromUCS2String(t) {
return new this(t, ln(t));
}
static fromCodepoints(t) {
return new this(cn(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 cn(this.codepoints.slice(0, Math.max(0, t))).length;
}
offsetFromUCS2Offset(t) {
return ln(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 No = ((Ci = Array.from) === null || Ci === void 0 ? void 0 : Ci.call(Array, "👼").length) === 1, Po = ((wi = " ".codePointAt) === null || wi === void 0 ? void 0 : wi.call(" ", 0)) != null, Fo = ((Ti = String.fromCodePoint) === null || Ti === void 0 ? void 0 : Ti.call(String, 32, 128124)) === " 👼";
let ln, cn;
ln = No && Po ? (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;
}, cn = Fo ? (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 qo = 0;
class Bt extends M {
static fromJSONString(t) {
return this.fromJSON(JSON.parse(t));
}
constructor() {
super(...arguments), this.id = ++qo;
}
hasSameConstructorAs(t) {
return this.constructor === (t == null ? void 0 : 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 ye.box(this);
}
getCacheKey() {
return this.id.toString();
}
}
const Ot = 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;
}, Ln = 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;
}, Ho = /[\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]/, $o = function() {
const s = _("input", { dir: "auto", name: "x", dirName: "x.dir" }), t = _("textarea", { dir: "auto", name: "y", dirName: "y.dir" }), e = _("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 o = r.trim().charAt(0);
return Ho.test(o) ? "rtl" : "ltr";
};
}();
let ki = null, Ii = null, Ri = null, Ne = null;
const dn = () => (ki || (ki = jo().concat(Uo())), ki), D = (s) => G[s], Uo = () => (Ii || (Ii = Object.keys(G)), Ii), hn = (s) => Dt[s], jo = () => (Ri || (Ri = Object.keys(Dt)), Ri), xr = function(s, t) {
Vo(s).textContent = t.replace(/%t/g, s);
}, Vo = function(s) {
const t = document.createElement("style");
t.setAttribute("type", "text/css"), t.setAttribute("data-tag-name", s.toLowerCase());
const e = Wo();
return e && t.setAttribute("nonce", e), document.head.insertBefore(t, document.head.firstChild), t;
}, Wo = 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, "]")), cs = { "application/x-trix-feature-detection": "test" }, Lr = function(s) {
const t = s.getData("text/plain"), e = s.getData("text/html");
if (!t || !e) return t == null ? void 0 : t.length;
{
const { body: i } = new DOMParser().parseFromString(e, "text/html");
if (i.textContent === t) return !i.querySelector("*");
}
}, Cr = /Mac|^iP/.test(navigator.platform) ? (s) => s.metaKey : (s) => s.ctrlKey, Cn = (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;
}, Yt = 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;
}, x = function(s) {
if (s != null) return Array.isArray(s) || (s = [s, s]), [ds(s[0]), ds(s[1] != null ? s[1] : s[0])];
}, gt = function(s) {
if (s == null) return;
const [t, e] = x(s);
return un(t, e);
}, Ye = function(s, t) {
if (s == null || t == null) return;
const [e, i] = x(s), [n, r] = x(t);
return un(e, n) && un(i, r);
}, ds = function(s) {
return typeof s == "number" ? s : wr(s);
}, un = function(s, t) {
return typeof s == "number" ? s === t : Yt(s, t);
};
class Tr extends M {
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 Mt = new Tr(), kr = function() {
const s = window.getSelection();
if (s.rangeCount > 0) return s;
}, fe = function() {
var s;
const t = (s = kr()) === null || s === void 0 ? void 0 : s.getRangeAt(0);
if (t && !zo(t)) return t;
}, Ir = function(s) {
const t = window.getSelection();
return t.removeAllRanges(), t.addRange(s), Mt.update();
}, zo = (s) => hs(s.startContainer) || hs(s.endContainer), hs = (s) => !Object.getPrototypeOf(s), ue = (s) => s.replace(new RegExp("".concat(ii), "g"), "").replace(new RegExp("".concat(_t), "g"), " "), wn = new RegExp("[^\\S".concat(_t, "]")), Tn = (s) => s.replace(new RegExp("".concat(wn.source), "g"), " ").replace(/\ {2,}/g, " "), us = function(s, t) {
if (s.isEqualTo(t)) return ["", ""];
const e = Di(s, t), { length: i } = e.utf16String;
let n;
if (i) {
const { offset: r } = e, o = s.codepoints.slice(0, r).concat(s.codepoints.slice(r + i));
n = Di(t, ye.fromCodepoints(o));
} else n = Di(t, s);
return [e.utf16String.toString(), n.utf16String.toString()];
}, Di = 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 X extends Bt {
static fromCommonAttributesOfObjects() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
if (!t.length) return new this();
let e = se(t[0]), i = e.getKeys();
return t.slice(1).forEach((n) => {
i = e.getKeysCommonToHash(se(n)), e = e.slice(i);
}), e;
}
static box(t) {
return se(t);
}
constructor() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
super(...arguments), this.values = Ke(t);
}
add(t, e) {
return this.merge(Ko(t, e));
}
remove(t) {
return new X(Ke(this.values, t));
}
get(t) {
return this.values[t];
}
has(t) {
return t in this.values;
}
merge(t) {
return new X(Go(this.values, Jo(t)));
}
slice(t) {
const e = {};
return Array.from(t).forEach((i) => {
this.has(i) && (e[i] = this.values[i]);
}), new X(e);
}
getKeys() {
return Object.keys(this.values);
}
getKeysCommonToHash(t) {
return t = se(t), this.getKeys().filter((e) => this.values[e] === t.values[e]);
}
isEqualTo(t) {
return Ot(this.toArray(), se(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 Ke(this.values);
}
toJSON() {
return this.toObject();
}
contentsForInspection() {
return { values: JSON.stringify(this.values) };
}
}
const Ko = function(s, t) {
const e = {};
return e[s] = t, e;
}, Go = function(s, t) {
const e = Ke(s);
for (const i in t) {
const n = t[i];
e[i] = n;
}
return e;
}, Ke = function(s, t) {
const e = {};
return Object.keys(s).sort().forEach((i) => {
i !== t && (e[i] = s[i]);
}), e;
}, se = function(s) {
return s instanceof X ? s : new X(s);
}, Jo = function(s) {
return s instanceof X ? s.values : s;
};
class kn {
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((o) => {
var a;
if (t) {
var c, d, h;
if ((c = o.canBeGrouped) !== null && c !== void 0 && c.call(o, i) && (d = (h = t[t.length - 1]).canBeGroupedWith) !== null && d !== void 0 && d.call(h, o, i)) return void t.push(o);
r.push(new this(t, { depth: i, asTree: n })), t = null;
}
(a = o.canBeGrouped) !== null && a !== void 0 && a.call(o, i) ? t = [o] : r.push(o);
}), 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 Yo extends M {
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 Xo {
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 Xe extends M {
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;
}
}
Xe.proxyMethod("getPromise().then"), Xe.proxyMethod("getPromise().catch");
class Nt extends M {
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 kn && (i.viewClass = t, t = Qo);
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 == null ? void 0 : 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 Qo extends Nt {
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);
}
}
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
const { entries: Rr, setPrototypeOf: gs, isFrozen: Zo, getPrototypeOf: ta, getOwnPropertyDescriptor: ea } = Object;
let { freeze: J, seal: Z, create: Dr } = Object, { apply: mn, construct: gn } = typeof Reflect < "u" && Reflect;
J || (J = function(s) {
return s;
}), Z || (Z = function(s) {
return s;
}), mn || (mn = 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);
}), gn || (gn = 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 Pe = Y(Array.prototype.forEach), ia = Y(Array.prototype.lastIndexOf), ps = Y(Array.prototype.pop), re = Y(Array.prototype.push), na = Y(Array.prototype.splice), Ge = Y(String.prototype.toLowerCase), Oi = Y(String.prototype.toString), Mi = Y(String.prototype.match), oe = Y(String.prototype.replace), sa = Y(String.prototype.indexOf), ra = Y(String.prototype.trim), rt = Y(Object.prototype.hasOwnProperty), z = Y(RegExp.prototype.test), ae = (fs = TypeError, function() {
for (var s = arguments.length, t = new Array(s), e = 0; e < s; e++) t[e] = arguments[e];
return gn(fs, t);
});
var fs;
function Y(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 mn(s, t, i);
};
}
function A(s, t) {
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ge;
gs && gs(s, null);
let i = t.length;
for (; i--; ) {
let n = t[i];
if (typeof n == "string") {
const r = e(n);
r !== n && (Zo(t) || (t[i] = r), n = r);
}
s[n] = !0;
}
return s;
}
function oa(s) {
for (let t = 0; t < s.length; t++)
rt(s, t) || (s[t] = null);
return s;
}
function ut(s) {
const t = Dr(null);
for (const [e, i] of Rr(s))
rt(s, e) && (Array.isArray(i) ? t[e] = oa(i) : i && typeof i == "object" && i.constructor === Object ? t[e] = ut(i) : t[e] = i);
return t;
}
function le(s, t) {
for (; s !== null; ) {
const e = ea(s, t);
if (e) {
if (e.get) return Y(e.get);
if (typeof e.value == "function") return Y(e.value);
}
s = ta(s);
}
return function() {
return null;
};
}
const bs = J(["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"]), Bi = J(["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"]), Ni = J(["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"]), aa = J(["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"]), Pi = J(["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"]), la = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), vs = J(["#text"]), _s = J(["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"]), Fi = J(["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"]), As = J(["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"]), Fe = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ca = Z(/\{\{[\w\W]*|[\w\W]*\}\}/gm), da = Z(/<%[\w\W]*|[\w\W]*%>/gm), ha = Z(/\$\{[\w\W]*/gm), ua = Z(/^data-[\-\w.\u00B7-\uFFFF]+$/), ma = Z(/^aria-[\-\w]+$/), Or = Z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), ga = Z(/^(?:\w+script|data):/i), pa = Z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Mr = Z(/^html$/i), fa = Z(/^[a-z][.\w]*(-[.\w]+)+$/i);
var ys = Object.freeze({ __proto__: null, ARIA_ATTR: ma, ATTR_WHITESPACE: pa, CUSTOM_ELEMENT: fa, DATA_ATTR: ua, DOCTYPE_NAME: Mr, ERB_EXPR: da, IS_ALLOWED_URI: Or, IS_SCRIPT_OR_DATA: ga, MUSTACHE_EXPR: ca, TMPLIT_EXPR: ha });
const ba = 1, va = 3, _a = 7, Aa = 8, ya = 9, Ea = function() {
return typeof window > "u" ? null : window;
};
var Ee = function s() {
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ea();
const e = (l) => s(l);
if (e.version = "3.2.7", e.removed = [], !t || !t.document || t.document.nodeType !== ya || !t.Element) return e.isSupported = !1, e;
let { document: i } = t;
const n = i, r = n.currentScript, { DocumentFragment: o, HTMLTemplateElement: a, Node: c, Element: d, NodeFilter: h, NamedNodeMap: m = t.NamedNodeMap || t.MozNamedAttrMap, HTMLFormElement: p, DOMParser: f, trustedTypes: L } = t, C = d.prototype, U = le(C, "cloneNode"), j = le(C, "remove"), q = le(C, "nextSibling"), N = le(C, "childNodes"), O = le(C, "parentNode");
if (typeof a == "function") {
const l = i.createElement("template");
l.content && l.content.ownerDocument && (i = l.content.ownerDocument);
}
let w, tt = "";
const { implementation: ct, createNodeIterator: Et, createDocumentFragment: fo, getElementsByTagName: bo } = i, { importNode: vo } = n;
let W = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] };
e.isSupported = typeof Rr == "function" && typeof O == "function" && ct && ct.createHTMLDocument !== void 0;
const { MUSTACHE_EXPR: ai, ERB_EXPR: li, TMPLIT_EXPR: ci, DATA_ATTR: _o, ARIA_ATTR: Ao, IS_SCRIPT_OR_DATA: yo, ATTR_WHITESPACE: Dn, CUSTOM_ELEMENT: Eo } = ys;
let { IS_ALLOWED_URI: On } = ys, P = null;
const Mn = A({}, [...bs, ...Bi, ...Ni, ...Pi, ...vs]);
let H = null;
const Bn = A({}, [..._s, ...Fi, ...As, ...Fe]);
let I = Object.seal(Dr(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 } })), Qt = null, di = null, Nn = !0, hi = !0, Pn = !1, Fn = !0, Ft = !1, we = !0, St = !1, ui = !1, mi = !1, qt = !1, Te = !1, ke = !1, qn = !0, Hn = !1, gi = !0, Zt = !1, Ht = {}, $t = null;
const $n = A({}, ["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 Un = null;
const jn = A({}, ["audio", "video", "img", "source", "image", "track"]);
let pi = null;
const Vn = A({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Ie = "http://www.w3.org/1998/Math/MathML", Re = "http://www.w3.org/2000/svg", dt = "http://www.w3.org/1999/xhtml";
let Ut = dt, fi = !1, bi = null;
const So = A({}, [Ie, Re, dt], Oi);
let De = A({}, ["mi", "mo", "mn", "ms", "mtext"]), Oe = A({}, ["annotation-xml"]);
const xo = A({}, ["title", "style", "font", "a", "script"]);
let te = null;
const Lo = ["application/xhtml+xml", "text/html"];
let F = null, jt = null;
const Co = i.createElement("form"), Wn = function(l) {
return l instanceof RegExp || l instanceof Function;
}, vi = function() {
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
if (!jt || jt !== l) {
if (l && typeof l == "object" || (l = {}), l = ut(l), te = Lo.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? "text/html" : l.PARSER_MEDIA_TYPE, F = te === "application/xhtml+xml" ? Oi : Ge, P = rt(l, "ALLOWED_TAGS") ? A({}, l.ALLOWED_TAGS, F) : Mn, H = rt(l, "ALLOWED_ATTR") ? A({}, l.ALLOWED_ATTR, F) : Bn, bi = rt(l, "ALLOWED_NAMESPACES") ? A({}, l.ALLOWED_NAMESPACES, Oi) : So, pi = rt(l, "ADD_URI_SAFE_ATTR") ? A(ut(Vn), l.ADD_URI_SAFE_ATTR, F) : Vn, Un = rt(l, "ADD_DATA_URI_TAGS") ? A(ut(jn), l.ADD_DATA_URI_TAGS, F) : jn, $t = rt(l, "FORBID_CONTENTS") ? A({}, l.FORBID_CONTENTS, F) : $n, Qt = rt(l, "FORBID_TAGS") ? A({}, l.FORBID_TAGS, F) : ut({}), di = rt(l, "FORBID_ATTR") ? A({}, l.FORBID_ATTR, F) : ut({}), Ht = !!rt(l, "USE_PROFILES") && l.USE_PROFILES, Nn = l.ALLOW_ARIA_ATTR !== !1, hi = l.ALLOW_DATA_ATTR !== !1, Pn = l.ALLOW_UNKNOWN_PROTOCOLS || !1, Fn = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ft = l.SAFE_FOR_TEMPLATES || !1, we = l.SAFE_FOR_XML !== !1, St = l.WHOLE_DOCUMENT || !1, qt = l.RETURN_DOM || !1, Te = l.RETURN_DOM_FRAGMENT || !1, ke = l.RETURN_TRUSTED_TYPE || !1, mi = l.FORCE_BODY || !1, qn = l.SANITIZE_DOM !== !1, Hn = l.SANITIZE_NAMED_PROPS || !1, gi = l.KEEP_CONTENT !== !1, Zt = l.IN_PLACE || !1, On = l.ALLOWED_URI_REGEXP || Or, Ut = l.NAMESPACE || dt, De = l.MATHML_TEXT_INTEGRATION_POINTS || De, Oe = l.HTML_INTEGRATION_POINTS || Oe, I = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && Wn(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (I.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && Wn(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (I.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (I.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ft && (hi = !1), Te && (qt = !0), Ht && (P = A({}, vs), H = [], Ht.html === !0 && (A(P, bs), A(H, _s)), Ht.svg === !0 && (A(P, Bi), A(H, Fi), A(H, Fe)), Ht.svgFilters === !0 && (A(P, Ni), A(H, Fi), A(H, Fe)), Ht.mathMl === !0 && (A(P, Pi), A(H, As), A(H, Fe))), l.ADD_TAGS && (P === Mn && (P = ut(P)), A(P, l.ADD_TAGS, F)), l.ADD_ATTR && (H === Bn && (H = ut(H)), A(H, l.ADD_ATTR, F)), l.ADD_URI_SAFE_ATTR && A(pi, l.ADD_URI_SAFE_ATTR, F), l.FORBID_CONTENTS && ($t === $n && ($t = ut($t)), A($t, l.FORBID_CONTENTS, F)), gi && (P["#text"] = !0), St && A(P, ["html", "head", "body"]), P.table && (A(P, ["tbody"]), delete Qt.tbody), l.TRUSTED_TYPES_POLICY) {
if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function") throw ae('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ae('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
w = l.TRUSTED_TYPES_POLICY, tt = w.createHTML("");
} else w === void 0 && (w = function(g, u) {
if (typeof g != "object" || typeof g.createPolicy != "function") return null;
let y = null;
const S = "data-tt-policy-suffix";
u && u.hasAttribute(S) && (y = u.getAttribute(S));
const v = "dompurify" + (y ? "#" + y : "");
try {
return g.createPolicy(v, { createHTML: (B) => B, createScriptURL: (B) => B });
} catch {
return console.warn("TrustedTypes policy " + v + " could not be created."), null;
}
}(L, r)), w !== null && typeof tt == "string" && (tt = w.createHTML(""));
J && J(l), jt = l;
}
}, zn = A({}, [...Bi, ...Ni, ...aa]), Kn = A({}, [...Pi, ...la]), at = function(l) {
re(e.removed, { element: l });
try {
O(l).removeChild(l);
} catch {
j(l);
}
}, xt = function(l, g) {
try {
re(e.removed, { attribute: g.getAttributeNode(l), from: g });
} catch {
re(e.removed, { attribute: null, from: g });
}
if (g.removeAttribute(l), l === "is") if (qt || Te) try {
at(g);
} catch {
}
else try {
g.setAttribute(l, "");
} catch {
}
}, Gn = function(l) {
let g = null, u = null;
if (mi) l = "" + l;
else {
const v = Mi(l, /^[\r\n\t ]+/);
u = v && v[0];
}
te === "application/xhtml+xml" && Ut === dt && (l = '' + l + "");
const y = w ? w.createHTML(l) : l;
if (Ut === dt) try {
g = new f().parseFromString(y, te);
} catch {
}
if (!g || !g.documentElement) {
g = ct.createDocument(Ut, "template", null);
try {
g.documentElement.innerHTML = fi ? tt : y;
} catch {
}
}
const S = g.body || g.documentElement;
return l && u && S.insertBefore(i.createTextNode(u), S.childNodes[0] || null), Ut === dt ? bo.call(g, St ? "html" : "body")[0] : St ? g.documentElement : S;
}, Jn = function(l) {
return Et.call(l.ownerDocument || l, l, h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION, null);
}, _i = function(l) {
return l instanceof p && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof m) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
}, Yn = function(l) {
return typeof c == "function" && l instanceof c;
};
function ht(l, g, u) {
Pe(l, (y) => {
y.call(e, g, u, jt);
});
}
const Xn = function(l) {
let g = null;
if (ht(W.beforeSanitizeElements, l, null), _i(l)) return at(l), !0;
const u = F(l.nodeName);
if (ht(W.uponSanitizeElement, l, { tagName: u, allowedTags: P }), we && l.hasChildNodes() && !Yn(l.firstElementChild) && z(/<[/\w!]/g, l.innerHTML) && z(/<[/\w!]/g, l.textContent) || l.nodeType === _a || we && l.nodeType === Aa && z(/<[/\w]/g, l.data)) return at(l), !0;
if (!P[u] || Qt[u]) {
if (!Qt[u] && Zn(u) && (I.tagNameCheck instanceof RegExp && z(I.tagNameCheck, u) || I.tagNameCheck instanceof Function && I.tagNameCheck(u)))
return !1;
if (gi && !$t[u]) {
const y = O(l) || l.parentNode, S = N(l) || l.childNodes;
if (S && y)
for (let v = S.length - 1; v >= 0; --v) {
const B = U(S[v], !0);
B.__removalCount = (l.__removalCount || 0) + 1, y.insertBefore(B, q(l));
}
}
return at(l), !0;
}
return l instanceof d && !function(y) {
let S = O(y);
S && S.tagName || (S = { namespaceURI: Ut, tagName: "template" });
const v = Ge(y.tagName), B = Ge(S.tagName);
return !!bi[y.namespaceURI] && (y.namespaceURI === Re ? S.namespaceURI === dt ? v === "svg" : S.namespaceURI === Ie ? v === "svg" && (B === "annotation-xml" || De[B]) : !!zn[v] : y.namespaceURI === Ie ? S.namespaceURI === dt ? v === "math" : S.namespaceURI === Re ? v === "math" && Oe[B] : !!Kn[v] : y.namespaceURI === dt ? !(S.namespaceURI === Re && !Oe[B]) && !(S.namespaceURI === Ie && !De[B]) && !Kn[v] && (xo[v] || !zn[v]) : !(te !== "application/xhtml+xml" || !bi[y.namespaceURI]));
}(l) ? (at(l), !0) : u !== "noscript" && u !== "noembed" && u !== "noframes" || !z(/<\/no(script|embed|frames)/i, l.innerHTML) ? (Ft && l.nodeType === va && (g = l.textContent, Pe([ai, li, ci], (y) => {
g = oe(g, y, " ");
}), l.textContent !== g && (re(e.removed, { element: l.cloneNode() }), l.textContent = g)), ht(W.afterSanitizeElements, l, null), !1) : (at(l), !0);
}, Qn = function(l, g, u) {
if (qn && (g === "id" || g === "name") && (u in i || u in Co)) return !1;
if (!(hi && !di[g] && z(_o, g))) {
if (!(Nn && z(Ao, g))) {
if (!H[g] || di[g]) {
if (!(Zn(l) && (I.tagNameCheck instanceof RegExp && z(I.tagNameCheck, l) || I.tagNameCheck instanceof Function && I.tagNameCheck(l)) && (I.attributeNameCheck instanceof RegExp && z(I.attributeNameCheck, g) || I.attributeNameCheck instanceof Function && I.attributeNameCheck(g, l)) || g === "is" && I.allowCustomizedBuiltInElements && (I.tagNameCheck instanceof RegExp && z(I.tagNameCheck, u) || I.tagNameCheck instanceof Function && I.tagNameCheck(u)))) return !1;
} else if (!pi[g]) {
if (!z(On, oe(u, Dn, ""))) {
if ((g !== "src" && g !== "xlink:href" && g !== "href" || l === "script" || sa(u, "data:") !== 0 || !Un[l]) && !(Pn && !z(yo, oe(u, Dn, "")))) {
if (u) return !1;
}
}
}
}
}
return !0;
}, Zn = function(l) {
return l !== "annotation-xml" && Mi(l, Eo);
}, ts = function(l) {
ht(W.beforeSanitizeAttributes, l, null);
const { attributes: g } = l;
if (!g || _i(l)) return;
const u = { attrName: "", attrValue: "", keepAttr: !0, allowedAttributes: H, forceKeepAttr: void 0 };
let y = g.length;
for (; y--; ) {
const S = g[y], { name: v, namespaceURI: B, value: pt } = S, et = F(v), Ai = pt;
let $ = v === "value" ? Ai : ra(Ai);
if (u.attrName = et, u.attrValue = $, u.keepAttr = !0, u.forceKeepAttr = void 0, ht(W.uponSanitizeAttribute, l, u), $ = u.attrValue, !Hn || et !== "id" && et !== "name" || (xt(v, l), $ = "user-content-" + $), we && z(/((--!?|])>)|<\/(style|title|textarea)/i, $)) {
xt(v, l);
continue;
}
if (et === "attributename" && Mi($, "href")) {
xt(v, l);
continue;
}
if (u.forceKeepAttr) continue;
if (!u.keepAttr) {
xt(v, l);
continue;
}
if (!Fn && z(/\/>/i, $)) {
xt(v, l);
continue;
}
Ft && Pe([ai, li, ci], (is) => {
$ = oe($, is, " ");
});
const es = F(l.nodeName);
if (Qn(es, et, $)) {
if (w && typeof L == "object" && typeof L.getAttributeType == "function" && !B) switch (L.getAttributeType(es, et)) {
case "TrustedHTML":
$ = w.createHTML($);
break;
case "TrustedScriptURL":
$ = w.createScriptURL($);
}
if ($ !== Ai) try {
B ? l.setAttributeNS(B, v, $) : l.setAttribute(v, $), _i(l) ? at(l) : ps(e.removed);
} catch {
xt(v, l);
}
} else xt(v, l);
}
ht(W.afterSanitizeAttributes, l, null);
}, wo = function l(g) {
let u = null;
const y = Jn(g);
for (ht(W.beforeSanitizeShadowDOM, g, null); u = y.nextNode(); ) ht(W.uponSanitizeShadowNode, u, null), Xn(u), ts(u), u.content instanceof o && l(u.content);
ht(W.afterSanitizeShadowDOM, g, null);
};
return e.sanitize = function(l) {
let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, y = null, S = null, v = null;
if (fi = !l, fi && (l = ""), typeof l != "string" && !Yn(l)) {
if (typeof l.toString != "function") throw ae("toString is not a function");
if (typeof (l = l.toString()) != "string") throw ae("dirty is not a string, aborting");
}
if (!e.isSupported) return l;
if (ui || vi(g), e.removed = [], typeof l == "string" && (Zt = !1), Zt) {
if (l.nodeName) {
const et = F(l.nodeName);
if (!P[et] || Qt[et]) throw ae("root node is forbidden and cannot be sanitized in-place");
}
} else if (l instanceof c) u = Gn(""), y = u.ownerDocument.importNode(l, !0), y.nodeType === ba && y.nodeName === "BODY" || y.nodeName === "HTML" ? u = y : u.appendChild(y);
else {
if (!qt && !Ft && !St && l.indexOf("<") === -1) return w && ke ? w.createHTML(l) : l;
if (u = Gn(l), !u) return qt ? null : ke ? tt : "";
}
u && mi && at(u.firstChild);
const B = Jn(Zt ? l : u);
for (; S = B.nextNode(); ) Xn(S), ts(S), S.content instanceof o && wo(S.content);
if (Zt) return l;
if (qt) {
if (Te) for (v = fo.call(u.ownerDocument); u.firstChild; ) v.appendChild(u.firstChild);
else v = u;
return (H.shadowroot || H.shadowrootmode) && (v = vo.call(n, v, !0)), v;
}
let pt = St ? u.outerHTML : u.innerHTML;
return St && P["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && z(Mr, u.ownerDocument.doctype.name) && (pt = "
` + pt), Ft && Pe([ai, li, ci], (et) => {
pt = oe(pt, et, " ");
}), w && ke ? w.createHTML(pt) : pt;
}, e.setConfig = function() {
vi(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), ui = !0;
}, e.clearConfig = function() {
jt = null, ui = !1;
}, e.isValidAttribute = function(l, g, u) {
jt || vi({});
const y = F(l), S = F(g);
return Qn(y, S, u);
}, e.addHook = function(l, g) {
typeof g == "function" && re(W[l], g);
}, e.removeHook = function(l, g) {
if (g !== void 0) {
const u = ia(W[l], g);
return u === -1 ? void 0 : na(W[l], u, 1)[0];
}
return ps(W[l]);
}, e.removeHooks = function(l) {
W[l] = [];
}, e.removeAllHooks = function() {
W = { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] };
}, e;
}();
Ee.addHook("uponSanitizeAttribute", function(s, t) {
/^data-trix-/.test(t.attrName) && (t.forceKeepAttr = !0);
});
const Sa = "style href src width height language class".split(" "), xa = "javascript:".split(" "), La = "script iframe form noscript".split(" ");
class ni extends M {
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 || Sa, this.forbiddenProtocols = i || xa, this.forbiddenElements = n || La, this.purifyOptions = r || {}, this.body = Ca(t);
}
sanitize() {
this.sanitizeElements(), this.normalizeListElementNesting();
const t = Object.assign({}, br, this.purifyOptions);
return Ee.setConfig(t), this.body = Ee.sanitize(this.body), this.body;
}
getHTML() {
return this.body.innerHTML;
}
getBody() {
return this.body;
}
sanitizeElements() {
const t = Je(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) => yt(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 && K(e) === "li" && e.appendChild(t);
}), this.body;
}
elementIsRemovable(t) {
if ((t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE) return this.elementIsForbidden(t) || this.elementIsntSerializable(t);
}
elementIsForbidden(t) {
return this.forbiddenElements.includes(K(t));
}
elementIsntSerializable(t) {
return t.getAttribute("data-trix-serialize") === "false" && !It(t);
}
}
const Ca = function() {
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
s = s.replace(/<\/html[^>]*>[^]*$/i, "