const {
  entries: Ht,
  setPrototypeOf: wt,
  isFrozen: gn,
  getPrototypeOf: hn,
  getOwnPropertyDescriptor: Tn
} = Object;
let {
  freeze: L,
  seal: O,
  create: we
} = Object, {
  apply: et,
  construct: tt
} = typeof Reflect != "undefined" && Reflect;
L || (L = function(t) {
  return t;
});
O || (O = function(t) {
  return t;
});
et || (et = function(t, o) {
  for (var i = arguments.length, c = new Array(i > 2 ? i - 2 : 0), u = 2; u < i; u++)
    c[u - 2] = arguments[u];
  return t.apply(o, c);
});
tt || (tt = function(t) {
  for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
    i[c - 1] = arguments[c];
  return new t(...i);
});
const Re = R(Array.prototype.forEach), bn = R(Array.prototype.lastIndexOf), Ct = R(Array.prototype.pop), ce = R(Array.prototype.push), En = R(Array.prototype.splice), Ce = R(String.prototype.toLowerCase), $e = R(String.prototype.toString), qe = R(String.prototype.match), ue = R(String.prototype.replace), An = R(String.prototype.indexOf), _n = R(String.prototype.trim), C = R(Object.prototype.hasOwnProperty), x = R(RegExp.prototype.test), pe = yn(TypeError);
function R(n) {
  return function(t) {
    t instanceof RegExp && (t.lastIndex = 0);
    for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
      i[c - 1] = arguments[c];
    return et(n, t, i);
  };
}
function yn(n) {
  return function() {
    for (var t = arguments.length, o = new Array(t), i = 0; i < t; i++)
      o[i] = arguments[i];
    return tt(n, o);
  };
}
function s(n, t) {
  let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ce;
  wt && wt(n, null);
  let i = t.length;
  for (; i--; ) {
    let c = t[i];
    if (typeof c == "string") {
      const u = o(c);
      u !== c && (gn(t) || (t[i] = u), c = u);
    }
    n[c] = !0;
  }
  return n;
}
function vn(n) {
  for (let t = 0; t < n.length; t++)
    C(n, t) || (n[t] = null);
  return n;
}
function k(n) {
  const t = we(null);
  for (const [o, i] of Ht(n))
    C(n, o) && (Array.isArray(i) ? t[o] = vn(i) : i && typeof i == "object" && i.constructor === Object ? t[o] = k(i) : t[o] = i);
  return t;
}
function de(n, t) {
  for (; n !== null; ) {
    const i = Tn(n, t);
    if (i) {
      if (i.get)
        return R(i.get);
      if (typeof i.value == "function")
        return R(i.value);
    }
    n = hn(n);
  }
  function o() {
    return null;
  }
  return o;
}
const Ot = L(["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"]), Xe = L(["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", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ze = L(["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"]), Sn = L(["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"]), Ke = L(["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"]), xn = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Mt = L(["#text"]), Nt = L(["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"]), Qe = L(["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", "mask-type", "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"]), It = L(["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"]), De = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ln = O(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Rn = O(/<%[\w\W]*|[\w\W]*%>/gm), Dn = O(/\$\{[\w\W]*/gm), wn = O(/^data-[\-\w.\u00B7-\uFFFF]+$/), Cn = O(/^aria-[\-\w]+$/), Ut = O(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), On = O(/^(?:\w+script|data):/i), Mn = O(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), zt = O(/^html$/i), Nn = O(/^[a-z][.\w]*(-[.\w]+)+$/i);
var kt = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ARIA_ATTR: Cn,
  ATTR_WHITESPACE: Mn,
  CUSTOM_ELEMENT: Nn,
  DATA_ATTR: wn,
  DOCTYPE_NAME: zt,
  ERB_EXPR: Rn,
  IS_ALLOWED_URI: Ut,
  IS_SCRIPT_OR_DATA: On,
  MUSTACHE_EXPR: Ln,
  TMPLIT_EXPR: Dn
});
const me = {
  element: 1,
  text: 3,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9
}, In = function() {
  return typeof window == "undefined" ? null : window;
}, kn = function(t, o) {
  if (typeof t != "object" || typeof t.createPolicy != "function")
    return null;
  let i = null;
  const c = "data-tt-policy-suffix";
  o && o.hasAttribute(c) && (i = o.getAttribute(c));
  const u = "dompurify" + (i ? "#" + i : "");
  try {
    return t.createPolicy(u, {
      createHTML(w) {
        return w;
      },
      createScriptURL(w) {
        return w;
      }
    });
  } catch (w) {
    return console.warn("TrustedTypes policy " + u + " could not be created."), null;
  }
}, Pt = function() {
  return {
    afterSanitizeAttributes: [],
    afterSanitizeElements: [],
    afterSanitizeShadowDOM: [],
    beforeSanitizeAttributes: [],
    beforeSanitizeElements: [],
    beforeSanitizeShadowDOM: [],
    uponSanitizeAttribute: [],
    uponSanitizeElement: [],
    uponSanitizeShadowNode: []
  };
};
function Gt() {
  let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : In();
  const t = (l) => Gt(l);
  if (t.version = "3.3.2", t.removed = [], !n || !n.document || n.document.nodeType !== me.document || !n.Element)
    return t.isSupported = !1, t;
  let {
    document: o
  } = n;
  const i = o, c = i.currentScript, {
    DocumentFragment: u,
    HTMLTemplateElement: w,
    Node: M,
    Element: d,
    NodeFilter: E,
    NamedNodeMap: B = n.NamedNodeMap || n.MozNamedAttrMap,
    HTMLFormElement: j,
    DOMParser: Oe,
    trustedTypes: Te
  } = n, oe = d.prototype, qt = de(oe, "cloneNode"), Xt = de(oe, "remove"), Zt = de(oe, "nextSibling"), Kt = de(oe, "childNodes"), be = de(oe, "parentNode");
  if (typeof w == "function") {
    const l = o.createElement("template");
    l.content && l.content.ownerDocument && (o = l.content.ownerDocument);
  }
  let v, ae = "";
  const {
    implementation: Me,
    createNodeIterator: Qt,
    createDocumentFragment: Jt,
    getElementsByTagName: en
  } = o, {
    importNode: tn
  } = i;
  let S = Pt();
  t.isSupported = typeof Ht == "function" && typeof be == "function" && Me && Me.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: Ne,
    ERB_EXPR: Ie,
    TMPLIT_EXPR: ke,
    DATA_ATTR: nn,
    ARIA_ATTR: rn,
    IS_SCRIPT_OR_DATA: on,
    ATTR_WHITESPACE: at,
    CUSTOM_ELEMENT: an
  } = kt;
  let {
    IS_ALLOWED_URI: it
  } = kt, b = null;
  const lt = s({}, [...Ot, ...Xe, ...Ze, ...Ke, ...Mt]);
  let A = null;
  const st = s({}, [...Nt, ...Qe, ...It, ...De]);
  let m = Object.seal(we(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
    }
  })), ie = null, Ee = null;
  const G = Object.seal(we(null, {
    tagCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    }
  }));
  let ct = !0, Pe = !0, ut = !1, pt = !0, $ = !1, Ae = !0, V = !1, Fe = !1, He = !1, q = !1, _e = !1, ye = !1, dt = !0, mt = !1;
  const ln = "user-content-";
  let Ue = !0, le = !1, X = {}, N = null;
  const ze = s({}, ["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 ft = null;
  const gt = s({}, ["audio", "video", "img", "source", "image", "track"]);
  let Ge = null;
  const ht = s({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ve = "http://www.w3.org/1998/Math/MathML", Se = "http://www.w3.org/2000/svg", H = "http://www.w3.org/1999/xhtml";
  let Z = H, We = !1, Be = null;
  const sn = s({}, [ve, Se, H], $e);
  let xe = s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = s({}, ["annotation-xml"]);
  const cn = s({}, ["title", "style", "font", "a", "script"]);
  let se = null;
  const un = ["application/xhtml+xml", "text/html"], pn = "text/html";
  let T = null, K = null;
  const dn = o.createElement("form"), Tt = function(e) {
    return e instanceof RegExp || e instanceof Function;
  }, je = function() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(K && K === e)) {
      if ((!e || typeof e != "object") && (e = {}), e = k(e), se = // eslint-disable-next-line unicorn/prefer-includes
      un.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? pn : e.PARSER_MEDIA_TYPE, T = se === "application/xhtml+xml" ? $e : Ce, b = C(e, "ALLOWED_TAGS") ? s({}, e.ALLOWED_TAGS, T) : lt, A = C(e, "ALLOWED_ATTR") ? s({}, e.ALLOWED_ATTR, T) : st, Be = C(e, "ALLOWED_NAMESPACES") ? s({}, e.ALLOWED_NAMESPACES, $e) : sn, Ge = C(e, "ADD_URI_SAFE_ATTR") ? s(k(ht), e.ADD_URI_SAFE_ATTR, T) : ht, ft = C(e, "ADD_DATA_URI_TAGS") ? s(k(gt), e.ADD_DATA_URI_TAGS, T) : gt, N = C(e, "FORBID_CONTENTS") ? s({}, e.FORBID_CONTENTS, T) : ze, ie = C(e, "FORBID_TAGS") ? s({}, e.FORBID_TAGS, T) : k({}), Ee = C(e, "FORBID_ATTR") ? s({}, e.FORBID_ATTR, T) : k({}), X = C(e, "USE_PROFILES") ? e.USE_PROFILES : !1, ct = e.ALLOW_ARIA_ATTR !== !1, Pe = e.ALLOW_DATA_ATTR !== !1, ut = e.ALLOW_UNKNOWN_PROTOCOLS || !1, pt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, $ = e.SAFE_FOR_TEMPLATES || !1, Ae = e.SAFE_FOR_XML !== !1, V = e.WHOLE_DOCUMENT || !1, q = e.RETURN_DOM || !1, _e = e.RETURN_DOM_FRAGMENT || !1, ye = e.RETURN_TRUSTED_TYPE || !1, He = e.FORCE_BODY || !1, dt = e.SANITIZE_DOM !== !1, mt = e.SANITIZE_NAMED_PROPS || !1, Ue = e.KEEP_CONTENT !== !1, le = e.IN_PLACE || !1, it = e.ALLOWED_URI_REGEXP || Ut, Z = e.NAMESPACE || H, xe = e.MATHML_TEXT_INTEGRATION_POINTS || xe, Le = e.HTML_INTEGRATION_POINTS || Le, m = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (m.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (m.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (m.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), $ && (Pe = !1), _e && (q = !0), X && (b = s({}, Mt), A = we(null), X.html === !0 && (s(b, Ot), s(A, Nt)), X.svg === !0 && (s(b, Xe), s(A, Qe), s(A, De)), X.svgFilters === !0 && (s(b, Ze), s(A, Qe), s(A, De)), X.mathMl === !0 && (s(b, Ke), s(A, It), s(A, De))), C(e, "ADD_TAGS") || (G.tagCheck = null), C(e, "ADD_ATTR") || (G.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? G.tagCheck = e.ADD_TAGS : (b === lt && (b = k(b)), s(b, e.ADD_TAGS, T))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? G.attributeCheck = e.ADD_ATTR : (A === st && (A = k(A)), s(A, e.ADD_ATTR, T))), e.ADD_URI_SAFE_ATTR && s(Ge, e.ADD_URI_SAFE_ATTR, T), e.FORBID_CONTENTS && (N === ze && (N = k(N)), s(N, e.FORBID_CONTENTS, T)), e.ADD_FORBID_CONTENTS && (N === ze && (N = k(N)), s(N, e.ADD_FORBID_CONTENTS, T)), Ue && (b["#text"] = !0), V && s(b, ["html", "head", "body"]), b.table && (s(b, ["tbody"]), delete ie.tbody), e.TRUSTED_TYPES_POLICY) {
        if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        v = e.TRUSTED_TYPES_POLICY, ae = v.createHTML("");
      } else
        v === void 0 && (v = kn(Te, c)), v !== null && typeof ae == "string" && (ae = v.createHTML(""));
      L && L(e), K = e;
    }
  }, bt = s({}, [...Xe, ...Ze, ...Sn]), Et = s({}, [...Ke, ...xn]), mn = function(e) {
    let r = be(e);
    (!r || !r.tagName) && (r = {
      namespaceURI: Z,
      tagName: "template"
    });
    const a = Ce(e.tagName), p = Ce(r.tagName);
    return Be[e.namespaceURI] ? e.namespaceURI === Se ? r.namespaceURI === H ? a === "svg" : r.namespaceURI === ve ? a === "svg" && (p === "annotation-xml" || xe[p]) : !!bt[a] : e.namespaceURI === ve ? r.namespaceURI === H ? a === "math" : r.namespaceURI === Se ? a === "math" && Le[p] : !!Et[a] : e.namespaceURI === H ? r.namespaceURI === Se && !Le[p] || r.namespaceURI === ve && !xe[p] ? !1 : !Et[a] && (cn[a] || !bt[a]) : !!(se === "application/xhtml+xml" && Be[e.namespaceURI]) : !1;
  }, I = function(e) {
    ce(t.removed, {
      element: e
    });
    try {
      be(e).removeChild(e);
    } catch (r) {
      Xt(e);
    }
  }, Y = function(e, r) {
    try {
      ce(t.removed, {
        attribute: r.getAttributeNode(e),
        from: r
      });
    } catch (a) {
      ce(t.removed, {
        attribute: null,
        from: r
      });
    }
    if (r.removeAttribute(e), e === "is")
      if (q || _e)
        try {
          I(r);
        } catch (a) {
        }
      else
        try {
          r.setAttribute(e, "");
        } catch (a) {
        }
  }, At = function(e) {
    let r = null, a = null;
    if (He)
      e = "<remove></remove>" + e;
    else {
      const f = qe(e, /^[\r\n\t ]+/);
      a = f && f[0];
    }
    se === "application/xhtml+xml" && Z === H && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
    const p = v ? v.createHTML(e) : e;
    if (Z === H)
      try {
        r = new Oe().parseFromString(p, se);
      } catch (f) {
      }
    if (!r || !r.documentElement) {
      r = Me.createDocument(Z, "template", null);
      try {
        r.documentElement.innerHTML = We ? ae : p;
      } catch (f) {
      }
    }
    const y = r.body || r.documentElement;
    return e && a && y.insertBefore(o.createTextNode(a), y.childNodes[0] || null), Z === H ? en.call(r, V ? "html" : "body")[0] : V ? r.documentElement : y;
  }, _t = function(e) {
    return Qt.call(
      e.ownerDocument || e,
      e,
      // eslint-disable-next-line no-bitwise
      E.SHOW_ELEMENT | E.SHOW_COMMENT | E.SHOW_TEXT | E.SHOW_PROCESSING_INSTRUCTION | E.SHOW_CDATA_SECTION,
      null
    );
  }, Ve = function(e) {
    return e instanceof j && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof B) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
  }, yt = function(e) {
    return typeof M == "function" && e instanceof M;
  };
  function U(l, e, r) {
    Re(l, (a) => {
      a.call(t, e, r, K);
    });
  }
  const vt = function(e) {
    let r = null;
    if (U(S.beforeSanitizeElements, e, null), Ve(e))
      return I(e), !0;
    const a = T(e.nodeName);
    if (U(S.uponSanitizeElement, e, {
      tagName: a,
      allowedTags: b
    }), Ae && e.hasChildNodes() && !yt(e.firstElementChild) && x(/<[/\w!]/g, e.innerHTML) && x(/<[/\w!]/g, e.textContent) || e.nodeType === me.progressingInstruction || Ae && e.nodeType === me.comment && x(/<[/\w]/g, e.data))
      return I(e), !0;
    if (!(G.tagCheck instanceof Function && G.tagCheck(a)) && (!b[a] || ie[a])) {
      if (!ie[a] && xt(a) && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
        return !1;
      if (Ue && !N[a]) {
        const p = be(e) || e.parentNode, y = Kt(e) || e.childNodes;
        if (y && p) {
          const f = y.length;
          for (let D = f - 1; D >= 0; --D) {
            const z = qt(y[D], !0);
            z.__removalCount = (e.__removalCount || 0) + 1, p.insertBefore(z, Zt(e));
          }
        }
      }
      return I(e), !0;
    }
    return e instanceof d && !mn(e) || (a === "noscript" || a === "noembed" || a === "noframes") && x(/<\/no(script|embed|frames)/i, e.innerHTML) ? (I(e), !0) : ($ && e.nodeType === me.text && (r = e.textContent, Re([Ne, Ie, ke], (p) => {
      r = ue(r, p, " ");
    }), e.textContent !== r && (ce(t.removed, {
      element: e.cloneNode()
    }), e.textContent = r)), U(S.afterSanitizeElements, e, null), !1);
  }, St = function(e, r, a) {
    if (Ee[r] || dt && (r === "id" || r === "name") && (a in o || a in dn))
      return !1;
    if (!(Pe && !Ee[r] && x(nn, r))) {
      if (!(ct && x(rn, r))) {
        if (!(G.attributeCheck instanceof Function && G.attributeCheck(r, e))) {
          if (!A[r] || Ee[r]) {
            if (
              // First condition does a very basic check if a) it's basically a valid custom element tagname AND
              // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
              // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
              !(xt(e) && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, e) || m.tagNameCheck instanceof Function && m.tagNameCheck(e)) && (m.attributeNameCheck instanceof RegExp && x(m.attributeNameCheck, r) || m.attributeNameCheck instanceof Function && m.attributeNameCheck(r, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
              // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
              r === "is" && m.allowCustomizedBuiltInElements && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
            ) return !1;
          } else if (!Ge[r]) {
            if (!x(it, ue(a, at, ""))) {
              if (!((r === "src" || r === "xlink:href" || r === "href") && e !== "script" && An(a, "data:") === 0 && ft[e])) {
                if (!(ut && !x(on, ue(a, at, "")))) {
                  if (a)
                    return !1;
                }
              }
            }
          }
        }
      }
    }
    return !0;
  }, xt = function(e) {
    return e !== "annotation-xml" && qe(e, an);
  }, Lt = function(e) {
    U(S.beforeSanitizeAttributes, e, null);
    const {
      attributes: r
    } = e;
    if (!r || Ve(e))
      return;
    const a = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: A,
      forceKeepAttr: void 0
    };
    let p = r.length;
    for (; p--; ) {
      const y = r[p], {
        name: f,
        namespaceURI: D,
        value: z
      } = y, Q = T(f), Ye = z;
      let _ = f === "value" ? Ye : _n(Ye);
      if (a.attrName = Q, a.attrValue = _, a.keepAttr = !0, a.forceKeepAttr = void 0, U(S.uponSanitizeAttribute, e, a), _ = a.attrValue, mt && (Q === "id" || Q === "name") && (Y(f, e), _ = ln + _), Ae && x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, _)) {
        Y(f, e);
        continue;
      }
      if (Q === "attributename" && qe(_, "href")) {
        Y(f, e);
        continue;
      }
      if (a.forceKeepAttr)
        continue;
      if (!a.keepAttr) {
        Y(f, e);
        continue;
      }
      if (!pt && x(/\/>/i, _)) {
        Y(f, e);
        continue;
      }
      $ && Re([Ne, Ie, ke], (Dt) => {
        _ = ue(_, Dt, " ");
      });
      const Rt = T(e.nodeName);
      if (!St(Rt, Q, _)) {
        Y(f, e);
        continue;
      }
      if (v && typeof Te == "object" && typeof Te.getAttributeType == "function" && !D)
        switch (Te.getAttributeType(Rt, Q)) {
          case "TrustedHTML": {
            _ = v.createHTML(_);
            break;
          }
          case "TrustedScriptURL": {
            _ = v.createScriptURL(_);
            break;
          }
        }
      if (_ !== Ye)
        try {
          D ? e.setAttributeNS(D, f, _) : e.setAttribute(f, _), Ve(e) ? I(e) : Ct(t.removed);
        } catch (Dt) {
          Y(f, e);
        }
    }
    U(S.afterSanitizeAttributes, e, null);
  }, fn = function l(e) {
    let r = null;
    const a = _t(e);
    for (U(S.beforeSanitizeShadowDOM, e, null); r = a.nextNode(); )
      U(S.uponSanitizeShadowNode, r, null), vt(r), Lt(r), r.content instanceof u && l(r.content);
    U(S.afterSanitizeShadowDOM, e, null);
  };
  return t.sanitize = function(l) {
    let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, a = null, p = null, y = null;
    if (We = !l, We && (l = "<!-->"), typeof l != "string" && !yt(l))
      if (typeof l.toString == "function") {
        if (l = l.toString(), typeof l != "string")
          throw pe("dirty is not a string, aborting");
      } else
        throw pe("toString is not a function");
    if (!t.isSupported)
      return l;
    if (Fe || je(e), t.removed = [], typeof l == "string" && (le = !1), le) {
      if (l.nodeName) {
        const z = T(l.nodeName);
        if (!b[z] || ie[z])
          throw pe("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (l instanceof M)
      r = At("<!---->"), a = r.ownerDocument.importNode(l, !0), a.nodeType === me.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
    else {
      if (!q && !$ && !V && // eslint-disable-next-line unicorn/prefer-includes
      l.indexOf("<") === -1)
        return v && ye ? v.createHTML(l) : l;
      if (r = At(l), !r)
        return q ? null : ye ? ae : "";
    }
    r && He && I(r.firstChild);
    const f = _t(le ? l : r);
    for (; p = f.nextNode(); )
      vt(p), Lt(p), p.content instanceof u && fn(p.content);
    if (le)
      return l;
    if (q) {
      if (_e)
        for (y = Jt.call(r.ownerDocument); r.firstChild; )
          y.appendChild(r.firstChild);
      else
        y = r;
      return (A.shadowroot || A.shadowrootmode) && (y = tn.call(i, y, !0)), y;
    }
    let D = V ? r.outerHTML : r.innerHTML;
    return V && b["!doctype"] && r.ownerDocument && r.ownerDocument.doctype && r.ownerDocument.doctype.name && x(zt, r.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + r.ownerDocument.doctype.name + `>
` + D), $ && Re([Ne, Ie, ke], (z) => {
      D = ue(D, z, " ");
    }), v && ye ? v.createHTML(D) : D;
  }, t.setConfig = function() {
    let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    je(l), Fe = !0;
  }, t.clearConfig = function() {
    K = null, Fe = !1;
  }, t.isValidAttribute = function(l, e, r) {
    K || je({});
    const a = T(l), p = T(e);
    return St(a, p, r);
  }, t.addHook = function(l, e) {
    typeof e == "function" && ce(S[l], e);
  }, t.removeHook = function(l, e) {
    if (e !== void 0) {
      const r = bn(S[l], e);
      return r === -1 ? void 0 : En(S[l], r, 1)[0];
    }
    return Ct(S[l]);
  }, t.removeHooks = function(l) {
    S[l] = [];
  }, t.removeAllHooks = function() {
    S = Pt();
  }, t;
}
var Pn = Gt();
let g = null, F = null, ee = null, h = null, te = "", ne = "", fe = "insert", ge = null, P = null, J = null;
function Wt(n, t) {
  if (t === n.innerHTML) return;
  const o = window.execEditorCommand || window.executeEditorCommand;
  if (typeof o == "function")
    try {
      o("recordDomTransaction", n, t, n.innerHTML);
    } catch (i) {
    }
}
function Fn(n) {
  if (!n) return null;
  let t = n.startContainer;
  for (; t && t !== document.body; ) {
    if (t.nodeType === Node.ELEMENT_NODE) {
      const o = t;
      if (o.getAttribute("contenteditable") === "true")
        return o;
    }
    t = t.parentNode;
  }
  return null;
}
const Hn = [
  {
    id: "formal-letter",
    name: "Formal Letter",
    category: "Letters",
    description: "Professional business letter template",
    html: `<p><strong>{{ Company Name }}</strong></p>
<p>{{ Today }}</p>
<p>Dear {{ first_name }} {{ last_name }},</p>
<p>I hope this letter finds you well. [Your letter content here]</p>
<p>Thank you for your time and consideration.</p>
<p>Sincerely,<br>Your Name</p>`
  },
  {
    id: "meeting-notes",
    name: "Meeting Notes",
    category: "Notes",
    description: "Template for meeting notes with attendees and action items",
    html: `<h2>Meeting Notes - {{ today }}</h2>
<p><strong>Attendees:</strong> [List attendees]</p>
<p><strong>Agenda:</strong></p>
<ul>
  <li>[Item 1]</li>
  <li>[Item 2]</li>
  <li>[Item 3]</li>
</ul>
<p><strong>Action Items:</strong></p>
<ul>
  <li>[Owner]: [Task] - [Due Date]</li>
</ul>
<p><strong>Next Meeting:</strong> [Date]</p>`
  },
  {
    id: "proposal",
    name: "Project Proposal",
    category: "Business",
    description: "Structured project proposal template",
    html: `<h1>Project Proposal</h1>
<h2>Executive Summary</h2>
<p>[Summary of the proposal]</p>
<h2>Objectives</h2>
<ul>
  <li>[Objective 1]</li>
  <li>[Objective 2]</li>
</ul>
<h2>Scope</h2>
<p>[Project scope details]</p>
<h2>Timeline</h2>
<p>[Project timeline]</p>
<h2>Budget</h2>
<p>[Budget details]</p>
<h2>Contact</h2>
<p>{{ first_name }} {{ last_name }}<br>{{ email }}<br>{{ phone }}</p>`
  },
  {
    id: "faq",
    name: "FAQ Template",
    category: "Documentation",
    description: "FAQ document structure",
    html: `<h1>Frequently Asked Questions</h1>
<h2>General Questions</h2>
<h3>Q: What is this about?</h3>
<p>A: [Answer here]</p>
<h3>Q: Who should use this?</h3>
<p>A: [Answer here]</p>
<h2>Technical Questions</h2>
<h3>Q: How do I get started?</h3>
<p>A: [Answer here]</p>
<h3>Q: What are the requirements?</h3>
<p>A: [Answer here]</p>`
  }
];
let re = [...Hn];
const Bt = () => re, Zn = (n) => re.filter((t) => t.category === n), jt = () => {
  const n = new Set(re.map((t) => t.category));
  return Array.from(n);
}, Un = (n) => {
  const t = n.toLowerCase();
  return re.filter(
    (o) => {
      var i, c;
      return o.name.toLowerCase().includes(t) || ((i = o.description) == null ? void 0 : i.toLowerCase().includes(t)) || ((c = o.tags) == null ? void 0 : c.some((u) => u.toLowerCase().includes(t)));
    }
  );
}, Vt = (n) => Pn.sanitize(n, {
  ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
  ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
}), Kn = (n) => re.some((t) => t.id === n.id) ? (console.warn(`Template with ID ${n.id} already exists`), !1) : (re.push(n), !0), Qn = (n) => !!(n.id && n.name && n.category && n.html && n.html.trim().length > 0);
function zn(n) {
  F = document.createElement("div"), F.className = "rte-dialog-overlay", Bn(n) && F.classList.add("rte-ui-theme-dark"), F.addEventListener("click", () => W()), g = document.createElement("div"), g.className = "rte-dialog rte-template-dialog", g.addEventListener("click", (o) => o.stopPropagation());
  const t = jt();
  t.length > 0 && !te && (te = t[0]), he(), F.appendChild(g), document.body.appendChild(F), Gn(), Xn();
}
function Gn() {
  Yt(), ge = (n) => {
    n.key === "Escape" && (!F || !g || (n.preventDefault(), n.stopPropagation(), W()));
  }, document.addEventListener("keydown", ge, !0);
}
function Yt() {
  ge && (document.removeEventListener("keydown", ge, !0), ge = null);
}
const Wn = '[data-theme="dark"], .dark, .editora-theme-dark', nt = () => {
  const n = window.getSelection();
  if (!n || n.rangeCount === 0) return null;
  const t = n.anchorNode, o = t instanceof HTMLElement ? t : t == null ? void 0 : t.parentElement;
  return (o == null ? void 0 : o.closest(
    ".rte-content, .editora-content"
  )) || null;
}, Bn = (n) => {
  const t = n || nt();
  return t ? !!t.closest(Wn) : !1;
};
function rt() {
  const n = Fn(ee);
  if (n) return n;
  if (J != null && J.isConnected) return J;
  const t = nt();
  return t || document.querySelector(".rte-content, .editora-content");
}
function he() {
  if (!g) return;
  const n = jt(), t = ot();
  g.innerHTML = `
    <div class="rte-dialog-header">
      <h2>Insert Template</h2>
      <button class="rte-dialog-close" aria-label="Close">✕</button>
    </div>

    <div class="rte-dialog-body">
      <!-- Search -->
      <input
        type="text"
        placeholder="Search templates..."
        value="${ne}"
        class="rte-input rte-template-search"
        aria-label="Search templates"
      />

      <!-- Category Tabs -->
      <div class="rte-tabs">
        ${n.map((o) => `
          <button class="rte-tab ${te === o ? "active" : ""}" data-category="${o}">
            ${o}
          </button>
        `).join("")}
      </div>

      <!-- Template List -->
      <div class="rte-template-list">
        ${t.length > 0 ? t.map((o) => `
          <div
            class="rte-template-item ${(h == null ? void 0 : h.id) === o.id ? "selected" : ""}"
            data-template-id="${o.id}"
          >
            <div class="template-name">${o.name}</div>
            ${o.description ? `<div class="template-description">${o.description}</div>` : ""}
          </div>
        `).join("") : '<div class="rte-empty-state">No templates found</div>'}
      </div>

      <!-- Preview -->
      ${h ? `
        <div class="rte-template-preview">
          <strong>Preview:</strong>
          <div class="template-preview-content">${h.html}</div>
        </div>
      ` : ""}

      <!-- Insert Mode Toggle -->
      <div class="rte-insert-mode">
        <label>
          <input type="radio" name="insertMode" value="insert" ${fe === "insert" ? "checked" : ""} />
          Insert at cursor
        </label>
        <label>
          <input type="radio" name="insertMode" value="replace" ${fe === "replace" ? "checked" : ""} />
          Replace document
        </label>
      </div>
    </div>

    <div class="rte-dialog-footer">
      <button class="rte-button-secondary rte-cancel-btn">Cancel</button>
      <button class="rte-button-primary rte-insert-btn" ${h ? "" : "disabled"}>
        ${fe === "insert" ? "Insert" : "Replace"}
      </button>
    </div>
  `, Vn();
}
function jn() {
  if (!g) return;
  g.innerHTML = `
    <div class="rte-dialog-header">
      <h2>Replace Document?</h2>
    </div>
    <div class="rte-dialog-body">
      <p>This will replace your current document content. Continue?</p>
    </div>
    <div class="rte-dialog-footer">
      <button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
      <button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
    </div>
  `;
  const n = g.querySelector(".rte-cancel-warning-btn"), t = g.querySelector(".rte-confirm-replace-btn");
  n == null || n.addEventListener("click", () => he()), t == null || t.addEventListener("click", () => Yn());
}
function ot() {
  const n = Bt();
  return ne.trim() ? Un(ne) : te ? n.filter((t) => t.category === te) : n;
}
function Vn() {
  if (!g) return;
  const n = g.querySelector(".rte-dialog-close");
  n == null || n.addEventListener("click", () => W());
  const t = g.querySelector(".rte-cancel-btn");
  t == null || t.addEventListener("click", () => W());
  const o = g.querySelector(".rte-insert-btn");
  o == null || o.addEventListener("click", () => Je());
  const i = g.querySelector(".rte-template-search");
  i == null || i.addEventListener("input", (d) => {
    P !== null && cancelAnimationFrame(P), ne = d.target.value, P = requestAnimationFrame(() => {
      P = null, Ft();
    });
  }), i == null || i.addEventListener("keydown", (d) => {
    d.key === "Enter" && h ? Je() : d.key === "Escape" && W();
  });
  const c = g.querySelector(".rte-tabs");
  c == null || c.addEventListener("click", (d) => {
    const B = d.target.closest(".rte-tab");
    if (!B) return;
    const j = B.getAttribute("data-category");
    j && (te = j, ne = "", P !== null && (cancelAnimationFrame(P), P = null), Ft());
  });
  const u = g.querySelector(".rte-template-list"), w = (d) => {
    const B = d.target.closest(".rte-template-item");
    if (!B) return null;
    const j = B.getAttribute("data-template-id");
    return j && Bt().find((Oe) => Oe.id === j) || null;
  };
  u == null || u.addEventListener("click", (d) => {
    const E = w(d);
    E && (h = E, he());
  }), u == null || u.addEventListener("dblclick", (d) => {
    const E = w(d);
    E && (h = E, Je());
  });
  const M = g.querySelector(".rte-insert-mode");
  M == null || M.addEventListener("change", (d) => {
    const E = d.target;
    !E || E.name !== "insertMode" || (fe = E.value, he());
  });
}
function Ft() {
  const n = ot();
  n.length > 0 ? (!h || !n.find((t) => t.id === h.id)) && (h = n[0]) : h = null, he();
}
function Je() {
  var n;
  if (h)
    if (fe === "replace") {
      const t = rt();
      if ((n = t == null ? void 0 : t.innerHTML) != null && n.trim()) {
        jn();
        return;
      }
      $t(h), W();
    } else
      $n(h), W();
}
function Yn() {
  h && ($t(h), W());
}
function $n(n) {
  var M;
  const t = window.getSelection();
  if (!t) return;
  const o = rt();
  if (!o) return;
  if (ee)
    t.removeAllRanges(), t.addRange(ee);
  else {
    const d = document.createRange();
    d.selectNodeContents(o), d.collapse(!1), t.removeAllRanges(), t.addRange(d);
  }
  if (t.rangeCount === 0) return;
  const i = t.getRangeAt(0), c = (M = o == null ? void 0 : o.innerHTML) != null ? M : "", u = document.createRange().createContextualFragment(Vt(n.html));
  i.deleteContents(), i.insertNode(u);
  const w = document.createRange();
  w.setStartAfter(i.endContainer), w.collapse(!0), t.removeAllRanges(), t.addRange(w), o && (Wt(o, c), o.dispatchEvent(new Event("input", { bubbles: !0 })));
}
function $t(n) {
  const t = rt();
  if (t) {
    const o = t.innerHTML;
    t.innerHTML = Vt(n.html), Wt(t, o), t.dispatchEvent(new Event("input", { bubbles: !0 }));
  }
}
function W() {
  Yt(), P !== null && (cancelAnimationFrame(P), P = null), F && (F.remove(), F = null), g = null, ee = null, ne = "", J = null;
}
function qn(n) {
  const t = window.getSelection();
  t && t.rangeCount > 0 ? ee = t.getRangeAt(0).cloneRange() : ee = null;
  const o = ot();
  o.length > 0 && !h && (h = o[0]);
  const i = (n == null ? void 0 : n.contentElement) instanceof HTMLElement ? n.contentElement : nt();
  J = i || null, zn(i);
}
function Xn() {
  if (typeof document == "undefined") return;
  const n = "template-plugin-dialog-styles";
  if (document.getElementById(n)) return;
  const t = document.createElement("style");
  t.id = n, t.textContent = `
    .rte-dialog-overlay {
      --rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
      --rte-tmpl-dialog-bg: #fff;
      --rte-tmpl-dialog-text: #101828;
      --rte-tmpl-border: #d6dbe4;
      --rte-tmpl-subtle-bg: #f7f9fc;
      --rte-tmpl-subtle-hover: #eef2f7;
      --rte-tmpl-muted-text: #5f6b7d;
      --rte-tmpl-accent: #1976d2;
      --rte-tmpl-accent-strong: #1565c0;
      --rte-tmpl-ring: rgba(31, 117, 254, 0.18);
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: var(--rte-tmpl-overlay-bg);
      backdrop-filter: blur(2px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      padding: 16px;
      box-sizing: border-box;
    }
    .rte-dialog-overlay.rte-ui-theme-dark {
      --rte-tmpl-overlay-bg: rgba(2, 8, 20, 0.72);
      --rte-tmpl-dialog-bg: #202938;
      --rte-tmpl-dialog-text: #e8effc;
      --rte-tmpl-border: #49566c;
      --rte-tmpl-subtle-bg: #2a3444;
      --rte-tmpl-subtle-hover: #344256;
      --rte-tmpl-muted-text: #a5b1c5;
      --rte-tmpl-accent: #58a6ff;
      --rte-tmpl-accent-strong: #4598f4;
      --rte-tmpl-ring: rgba(88, 166, 255, 0.22);
    }
    .rte-template-dialog {
      background: var(--rte-tmpl-dialog-bg);
      color: var(--rte-tmpl-dialog-text);
      border: 1px solid var(--rte-tmpl-border);
      border-radius: 12px;
      box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
      width: 600px;
      max-height: 700px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .rte-dialog-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid var(--rte-tmpl-border);
      background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
    }
    .rte-dialog-header h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: var(--rte-tmpl-dialog-text);
    }
    .rte-dialog-close {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      color: var(--rte-tmpl-muted-text);
      padding: 0;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      transition: background-color 0.16s ease, color 0.16s ease;
    }
    .rte-dialog-close:hover {
      background-color: var(--rte-tmpl-subtle-hover);
      color: var(--rte-tmpl-dialog-text);
    }
    .rte-dialog-body {
      padding: 20px;
      flex: 1;
      overflow-y: auto;
    }
    .rte-input {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid var(--rte-tmpl-border);
      border-radius: 4px;
      font-size: 14px;
      box-sizing: border-box;
      background: var(--rte-tmpl-subtle-bg);
      color: var(--rte-tmpl-dialog-text);
    }
    .rte-input:focus {
      outline: none;
      border-color: var(--rte-tmpl-accent);
    }
    .rte-tabs {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      border-bottom: 1px solid var(--rte-tmpl-border);
      padding-bottom: 8px;
    }
    .rte-tab {
      padding: 6px 12px;
      border: none;
      background: none;
      cursor: pointer;
      font-size: 14px;
      color: var(--rte-tmpl-muted-text);
      border-bottom: 2px solid transparent;
      transition: all 0.2s;
    }
    .rte-tab:hover {
      color: var(--rte-tmpl-dialog-text);
    }
    .rte-tab.active {
      color: var(--rte-tmpl-accent);
      border-bottom-color: var(--rte-tmpl-accent);
      font-weight: 600;
    }
    .rte-template-list {
      border: 1px solid var(--rte-tmpl-border);
      border-radius: 4px;
      max-height: 250px;
      overflow-y: auto;
      margin: 12px 0;
      background: var(--rte-tmpl-subtle-bg);
    }
    .rte-template-item {
      padding: 12px;
      border-bottom: 1px solid var(--rte-tmpl-border);
      cursor: pointer;
      transition: background-color 0.2s;
      background: none;
    }
    .rte-template-item:last-child {
      border-bottom: none;
    }
    .rte-template-item:hover,
    .rte-template-item.selected {
      background-color: var(--rte-tmpl-subtle-hover);
    }
    .template-name {
      font-weight: 600;
      color: var(--rte-tmpl-dialog-text);
      margin-bottom: 4px;
    }
    .template-description {
      font-size: 12px;
      color: var(--rte-tmpl-muted-text);
    }
    .rte-template-preview {
      padding: 12px;
      background-color: var(--rte-tmpl-subtle-bg);
      border: 1px solid var(--rte-tmpl-border);
      border-radius: 4px;
      margin-top: 12px;
      max-height: 200px;
      overflow-y: auto;
    }
    .template-preview-content {
      font-size: 13px;
      line-height: 1.5;
      margin-top: 8px;
    }
    .template-preview-content * {
      margin: 4px 0;
    }
    .rte-insert-mode {
      margin-top: 12px;
      padding: 12px;
      background-color: var(--rte-tmpl-subtle-bg);
      border-radius: 4px;
      display: flex;
      gap: 16px;
    }
    .rte-insert-mode label {
      display: flex;
      align-items: center;
      cursor: pointer;
      font-size: 14px;
    }
    .rte-insert-mode input {
      margin-right: 6px;
      cursor: pointer;
    }
    .rte-empty-state {
      padding: 40px;
      text-align: center;
      color: var(--rte-tmpl-muted-text);
      font-size: 14px;
    }
    .rte-dialog-footer {
      padding: 16px 20px;
      border-top: 1px solid var(--rte-tmpl-border);
      background: var(--rte-tmpl-subtle-bg);
      display: flex;
      justify-content: flex-end;
      gap: 12px;
    }
    .rte-button-primary {
      padding: 8px 16px;
      border: none;
      border-radius: 4px;
      font-size: 14px;
      cursor: pointer;
      background-color: var(--rte-tmpl-accent);
      color: white;
      transition: all 0.2s;
    }
    .rte-button-primary:hover:not([disabled]) {
      background-color: var(--rte-tmpl-accent-strong);
    }
    .rte-button-primary[disabled] {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .rte-button-secondary {
      padding: 8px 16px;
      border: 1px solid var(--rte-tmpl-border);
      border-radius: 4px;
      font-size: 14px;
      cursor: pointer;
      background-color: var(--rte-tmpl-subtle-bg);
      color: var(--rte-tmpl-dialog-text);
      transition: all 0.2s;
    }
    .rte-button-secondary:hover {
      background-color: var(--rte-tmpl-subtle-hover);
    }
  `, document.head.appendChild(t);
}
const Jn = () => ({
  name: "template",
  toolbar: [
    {
      label: "Template",
      command: "insertTemplate",
      icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'
    }
  ],
  commands: {
    insertTemplate: (n, t) => (qn(t), !0)
  },
  keymap: {}
});
export {
  Hn as PREDEFINED_TEMPLATES,
  Jn as TemplatePlugin,
  Kn as addCustomTemplate,
  Bt as getAllTemplates,
  jt as getTemplateCategories,
  Zn as getTemplatesByCategory,
  Vt as sanitizeTemplate,
  Un as searchTemplates,
  Qn as validateTemplate
};
//# sourceMappingURL=TemplatePlugin.native-DLjFUaPW.mjs.map
