const g = '.rte-content, .editora-content, [contenteditable="true"]', st = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", b = "p,div,li,h1,h2,h3,h4,h5,h6,blockquote,pre,td,th", _ = "ul,ol", y = "b,strong,i,em,u,s,strike,font,span", w = "td,th", m = "data-editora-format-painter-bookmark", O = ["link", "address", "comments", "citations", "track-changes"], L = [
  "fontFamily",
  "fontSize",
  "color",
  "backgroundColor",
  "textTransform"
], at = [
  "textAlign",
  "lineHeight",
  "marginLeft",
  "marginRight"
], lt = ["listStyleType"], ct = [
  "borderCollapse",
  "borderSpacing",
  "width"
], ut = [
  "backgroundColor",
  "textAlign",
  "verticalAlign",
  "borderTopColor",
  "borderRightColor",
  "borderBottomColor",
  "borderLeftColor",
  "borderTopStyle",
  "borderRightStyle",
  "borderBottomStyle",
  "borderLeftStyle",
  "borderTopWidth",
  "borderRightWidth",
  "borderBottomWidth",
  "borderLeftWidth",
  "paddingTop",
  "paddingRight",
  "paddingBottom",
  "paddingLeft"
], X = {
  background: "backgroundcolor",
  bgcolor: "backgroundcolor",
  blockquote: "block",
  blocks: "block",
  font: "fontfamily",
  fontname: "fontfamily",
  fontsize: "fontsize",
  foreground: "color",
  forecolor: "color",
  heading: "block",
  headings: "block",
  liststyle: "list",
  lists: "list",
  strike: "strikethrough",
  tablecell: "table",
  tablecells: "table",
  textcolor: "color",
  texttransform: "texttransform"
}, ft = '<svg width="24" height="24" focusable="false" viewBox="0 0 24 24"><path d="M17.8 3.2a2.8 2.8 0 0 1 4 4L14 15l-4-4 7.8-7.8Zm-1.4 4.2L19 10l1.4-1.4-2.6-2.6-1.4 1.4Zm-7.8 5 3 3-1.4 1.4c-.5.5-1.2.8-1.9.8H7.2l-1.6 1.6a2.7 2.7 0 0 1-3.8 0 1 1 0 0 1 0-1.4l6.8-5.4Zm-.2 3.2H9l-4.6 3.7c.2 0 .5-.2.7-.4l1.9-1.9c.2-.2.4-.3.7-.3h1.1c.2 0 .5-.1.6-.3l.2-.2-1.2-1.3ZM5.5 3l.7 1.8L8 5.5l-1.8.7L5.5 8l-.7-1.8L3 5.5l1.8-.7L5.5 3Zm3.8 4.4.5 1.2 1.2.5-1.2.5-.5 1.2-.5-1.2-1.2-.5 1.2-.5.5-1.2Z" fill-rule="evenodd"></path></svg>', v = /* @__PURE__ */ new WeakMap();
let I = null, P = !1, p = {
  ignoredFormats: O,
  keepActiveAfterMouseApply: !1
};
const ne = (t = {}) => {
  var n, r;
  const e = {
    ignoredFormats: (n = t.ignoredFormats) != null ? n : O,
    keepActiveAfterMouseApply: (r = t.keepActiveAfterMouseApply) != null ? r : !1
  };
  return p = e, {
    name: "formatPainter",
    toolbar: [
      {
        label: "Format Painter",
        command: "toggleFormatPainter",
        icon: ft,
        shortcut: "Ctrl+Alt+C / Ctrl+Alt+V"
      }
    ],
    commands: {
      retrieveFormats: (o, i) => Y(i, e),
      paintFormats: (o, i) => J(i, e),
      toggleFormatPainter: (o, i) => dt(i, e),
      cancelFormatPainter: (o, i) => G(i)
    },
    initialize: () => {
      mt();
    }
  };
};
function Y(t, e = p) {
  const n = C(t);
  if (!n) return !1;
  const r = U(n, e);
  if (!r) return !1;
  const o = E(n);
  return o.options = e, o.snapshot = r, I = r, M(n, !1), !0;
}
function J(t, e = p) {
  const n = C(t);
  if (!n) return !1;
  const r = E(n);
  r.options = e;
  const o = r.snapshot || I;
  return o ? Q(n, o) : !1;
}
function dt(t, e = p) {
  const n = C(t);
  if (!n) return !1;
  const r = E(n);
  if (r.options = e, r.active)
    return h(n, !1), !0;
  const o = U(n, e);
  return o ? (r.snapshot = o, I = o, h(n, !0), !0) : !1;
}
function G(t) {
  const e = C(t);
  return e ? (h(e, !1), !0) : (document.querySelectorAll(`${g}.rte-format-painter-active`).forEach((n) => {
    h(n, !1);
  }), !0);
}
function mt() {
  P || typeof document == "undefined" || (P = !0, document.addEventListener("keydown", Et, !0), document.addEventListener("mouseup", gt, !0));
}
function Et(t) {
  const e = t.key.toLowerCase(), n = t.ctrlKey || t.metaKey;
  if (t.key === "Escape") {
    G();
    return;
  }
  if (!n || !t.altKey || t.shiftKey) return;
  const r = j() || C();
  if (r) {
    if (e === "c") {
      Y({ contentElement: r }, E(r).options) && t.preventDefault();
      return;
    }
    e === "v" && J({ contentElement: r }, E(r).options) && t.preventDefault();
  }
}
function gt(t) {
  const e = t.target;
  if (e != null && e.closest(".rte-toolbar-wrapper, .editora-toolbar-container")) return;
  const n = e == null ? void 0 : e.closest(g);
  if (!(n instanceof HTMLElement)) return;
  const r = E(n);
  if (!r.active || !r.snapshot) return;
  const o = window.getSelection();
  if (!o || o.rangeCount === 0 || o.getRangeAt(0).collapsed) return;
  Q(n, r.snapshot) && !r.options.keepActiveAfterMouseApply && h(n, !1);
}
function E(t) {
  let e = v.get(t);
  return e || (e = { snapshot: null, active: !1, options: p }, v.set(t, e)), e;
}
function C(t) {
  var o;
  if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
  const e = D((o = t == null ? void 0 : t.editorElement) != null ? o : null);
  if (e) return e;
  const n = typeof window != "undefined" ? window.__editoraCommandEditorRoot : null, r = D(n);
  return r || j() || ht();
}
function D(t) {
  return t ? t.matches(g) ? t : t.querySelector(g) : null;
}
function j() {
  const t = window.getSelection();
  if (!t || t.rangeCount === 0) return null;
  const e = t.getRangeAt(0), n = d(e.commonAncestorContainer), r = n == null ? void 0 : n.closest(g);
  return r instanceof HTMLElement ? r : null;
}
function ht() {
  const t = document.activeElement;
  if (!(t instanceof HTMLElement)) return null;
  const e = t.closest(g);
  return e instanceof HTMLElement ? e : null;
}
function d(t) {
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
}
function U(t, e) {
  const n = window.getSelection(), r = n && n.rangeCount > 0 ? n.getRangeAt(0) : null, o = r ? r.collapsed ? r.startContainer : r.commonAncestorContainer : null, i = d(o) || t;
  if (!t.contains(i)) return null;
  const s = ee(e.ignoredFormats), a = nt(i, t), l = i.closest("li"), u = l == null ? void 0 : l.closest(_), f = i.closest(w), it = f == null ? void 0 : f.closest("table");
  return {
    inline: pt(r, i, t, s),
    block: !c(s, "block") && a ? Nt(a, s) : null,
    list: !c(s, "list") && u ? bt(u, l) : null,
    table: c(s, "table") ? null : kt(it, f, s),
    ignoredFormats: s
  };
}
function pt(t, e, n, r) {
  if (!t || t.collapsed)
    return H(e, r);
  const i = Ct(t, e, n).map((s) => H(s, r));
  return Tt(i);
}
function Ct(t, e, n) {
  const r = [], o = document.createTreeWalker(
    t.commonAncestorContainer,
    NodeFilter.SHOW_TEXT,
    {
      acceptNode: (s) => !n.contains(s) || !t.intersectsNode(s) ? NodeFilter.FILTER_REJECT : (s.textContent || "").trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
    }
  );
  let i = o.nextNode();
  for (; i && r.length < 64; ) {
    const s = d(i);
    s && !r.includes(s) && r.push(s), i = o.nextNode();
  }
  return r.length > 0 ? r : [e];
}
function H(t, e) {
  const n = window.getComputedStyle(t), r = {};
  c(e, "bold") || (r.bold = St(t, n)), c(e, "italic") || (r.italic = At(t, n)), c(e, "underline") || (r.underline = $(t, n, "underline")), c(e, "strikethrough") || (r.strikethrough = $(t, n, "line-through"));
  const o = {};
  return L.forEach((i) => {
    if (c(e, i)) return;
    const s = n[i];
    yt(i, s) && (o[i] = s);
  }), { marks: r, styles: o };
}
function Tt(t) {
  const e = {};
  ["bold", "italic", "underline", "strikethrough"].forEach((o) => {
    const i = t.map((s) => s.marks[o]).filter((s) => s != null);
    i.length !== 0 && (e[o] = i.every(Boolean));
  });
  const r = {};
  return L.forEach((o) => {
    const i = t.map((s) => s.styles[o]).filter((s) => !!s);
    i.length === t.length && i.every((s) => s === i[0]) && (r[o] = i[0]);
  }), { marks: e, styles: r };
}
function Nt(t, e) {
  const n = window.getComputedStyle(t), r = {};
  at.forEach((s) => {
    if (c(e, s)) return;
    const l = t.style[s] || n[s];
    Lt(s, l) && (r[s] = l);
  });
  const o = {}, i = t.getAttribute("dir") || t.style.direction;
  return (i === "ltr" || i === "rtl" || i === "auto") && (o.dir = i), {
    tagName: rt(t),
    styles: r,
    attrs: o
  };
}
function bt(t, e) {
  const n = {};
  lt.forEach((i) => {
    const s = t.style[i] || window.getComputedStyle(t)[i];
    s && s !== "disc" && s !== "decimal" && (n[i] = s);
  });
  const r = {};
  N(t, r, "data-type"), N(t, r, "type");
  const o = {};
  return e && (N(e, o, "data-type"), N(e, o, "data-checked")), {
    tagName: t.tagName.toLowerCase() === "ol" ? "ol" : "ul",
    styles: n,
    attrs: r,
    itemAttrs: o
  };
}
function kt(t, e, n) {
  return !t && !e ? null : {
    table: t ? W(t, ct, n) : null,
    cell: e ? W(e, ut, n) : null
  };
}
function W(t, e, n) {
  const r = window.getComputedStyle(t), o = {};
  return e.forEach((i) => {
    if (c(n, i)) return;
    const a = t.style[i] || r[i];
    Rt(i, a) && (o[i] = a);
  }), { styles: o, attrs: {} };
}
function St(t, e) {
  if (t.closest("b,strong")) return !0;
  const n = e.fontWeight;
  return /^(bold|bolder|[5-9]\d{2,})$/.test(n);
}
function At(t, e) {
  return !!t.closest("i,em") || e.fontStyle === "italic";
}
function $(t, e, n) {
  const r = n === "underline" ? "u" : "s,strike";
  return !!t.closest(r) || e.textDecorationLine.includes(n);
}
function yt(t, e) {
  return !(!e || t === "backgroundColor" && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textTransform" && e === "none");
}
function Lt(t, e) {
  return !(!e || t === "textAlign" && e === "start" || t === "lineHeight" && e === "normal" || (t === "marginLeft" || t === "marginRight") && e === "0px");
}
function Rt(t, e) {
  return !(!e || (t === "backgroundColor" || t.endsWith("Color")) && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textAlign" && e === "start" || t === "verticalAlign" && e === "middle" || t.endsWith("Width") && e === "0px" || t.endsWith("Style") && e === "none" || t.startsWith("padding") && e === "0px" || t === "borderSpacing" && e === "0px" || t === "width" && e === "auto");
}
function Q(t, e) {
  const n = window.getSelection();
  if (!n || n.rangeCount === 0) return !1;
  const r = n.getRangeAt(0);
  if (!t.contains(r.startContainer) || !t.contains(r.endContainer)) return !1;
  const o = t.innerHTML, i = !r.collapsed, s = Jt(t);
  Ft(t, r, e.table), wt(t, r, e), s == null || s();
  const a = window.getSelection(), l = a && a.rangeCount > 0 ? a.getRangeAt(0) : null;
  i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) && Mt(l, a, e), Ut(t), Qt(t);
  const u = t.innerHTML;
  return o === u ? !1 : (te(t, o, u), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0);
}
function wt(t, e, n) {
  const r = Xt(t, e);
  n.list && zt(r, n.list), n.block && r.forEach((o) => {
    const i = o.isConnected ? o : null;
    if (!i) return;
    const s = Vt(i, n.block.tagName);
    k(s, n.block.styles), n.block.attrs.dir ? s.setAttribute("dir", n.block.attrs.dir) : s.removeAttribute("dir");
  });
}
function Ft(t, e, n) {
  var i;
  if (!n) return;
  const r = Kt(t, e);
  if (n.cell && r.forEach((s) => {
    k(s, n.cell.styles);
  }), !n.table) return;
  const o = /* @__PURE__ */ new Set();
  if (r.forEach((s) => {
    const a = s.closest("table");
    a instanceof HTMLElement && o.add(a);
  }), o.size === 0) {
    const s = (i = d(e.startContainer)) == null ? void 0 : i.closest("table");
    s instanceof HTMLElement && t.contains(s) && o.add(s);
  }
  o.forEach((s) => {
    k(s, n.table.styles);
  });
}
function Mt(t, e, n) {
  vt(t);
  const r = n.inline, o = t.cloneContents();
  if (Yt(o)) {
    _t(t, e, n);
    return;
  }
  const i = t.extractContents();
  qt(i, n);
  const s = document.createDocumentFragment(), a = K("start"), l = K("end");
  s.appendChild(a), s.appendChild(et(i, r)), s.appendChild(l), t.insertNode(s), Dt(a, l, n);
  const u = document.createRange();
  u.setStartAfter(a), u.setEndBefore(l), e.removeAllRanges(), e.addRange(u);
}
function _t(t, e, n) {
  const r = Ot(t), o = [];
  if (r.forEach((s) => {
    var u;
    let a = It(s, t);
    if (!a || !a.data.trim() || $t(a)) return;
    a = xt(a, n);
    const l = et(document.createTextNode(a.data), n.inline);
    (u = a.parentNode) == null || u.replaceChild(l, a), o.push(l);
  }), o.length === 0) return;
  const i = document.createRange();
  i.setStartBefore(o[0]), i.setEndAfter(o[o.length - 1]), e.removeAllRanges(), e.addRange(i);
}
function Ot(t) {
  if (t.startContainer === t.endContainer && t.startContainer.nodeType === Node.TEXT_NODE)
    return [t.startContainer];
  const e = [], n = document.createTreeWalker(t.commonAncestorContainer, NodeFilter.SHOW_TEXT, {
    acceptNode: (o) => !o.textContent || !o.textContent.trim() || !t.intersectsNode(o) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
  });
  let r = n.nextNode();
  for (; r; )
    e.push(r), r = n.nextNode();
  return e;
}
function It(t, e) {
  const n = t.data.length;
  let r = 0, o = n;
  if (t === e.startContainer && (r = Math.max(0, Math.min(e.startOffset, n))), t === e.endContainer && (o = Math.max(0, Math.min(e.endOffset, n))), r >= o) return null;
  let i = t;
  return o < i.data.length && i.splitText(o), r > 0 && (i = i.splitText(r)), i;
}
function xt(t, e) {
  let n = t, r = n.parentElement;
  for (; r && r.matches(y) && !x(r, e) && tt(r, e); )
    Bt(r, n), r = n.parentElement;
  return n;
}
function Bt(t, e) {
  const n = t.parentNode;
  if (!n || e.parentNode !== t) return;
  const r = t.cloneNode(!1), o = t.cloneNode(!1);
  for (; t.firstChild && t.firstChild !== e; )
    r.appendChild(t.firstChild);
  for (; e.nextSibling; )
    o.appendChild(e.nextSibling);
  q(r) && n.insertBefore(r, t), n.insertBefore(e, t), q(o) && n.insertBefore(o, t), n.removeChild(t);
}
function q(t) {
  return Array.from(t.childNodes).some((e) => e.nodeType !== Node.TEXT_NODE ? !0 : !!(e.textContent || "").trim());
}
function vt(t) {
  let e = d(t.startContainer), n = d(t.endContainer);
  for (; e && e === n && e.matches(y); ) {
    if (!Pt(t, e)) return;
    t.selectNode(e), e = e.parentElement, n = d(t.endContainer);
  }
}
function Pt(t, e) {
  const n = document.createRange();
  return n.selectNodeContents(e), t.compareBoundaryPoints(Range.START_TO_START, n) === 0 && t.compareBoundaryPoints(Range.END_TO_END, n) === 0;
}
function Dt(t, e, n) {
  let r = d(t.parentNode);
  for (; r && r.contains(e); ) {
    const o = r.parentElement;
    r.matches(y) && !x(r, n) && Ht(r, t, e) && tt(r, n) && S(r), r = o;
  }
}
function Ht(t, e, n) {
  let r = "before";
  for (const o of Array.from(t.childNodes)) {
    if (o === e) {
      r = "inside";
      continue;
    }
    if (o === n) {
      r = "after";
      continue;
    }
    if (r !== "inside" && !Wt(o))
      return !1;
  }
  return r === "after";
}
function Wt(t) {
  return t.nodeType === Node.TEXT_NODE ? !(t.textContent || "").replace(/\uFEFF/g, "").trim() : t.nodeType === Node.COMMENT_NODE ? ot(t) : t.nodeType !== Node.ELEMENT_NODE ? !0 : t.hasAttribute(m);
}
function tt(t, e) {
  return t.matches("span") ? L.some((n) => !c(e.ignoredFormats, n)) : t.matches("b,strong") ? !c(e.ignoredFormats, "bold") : t.matches("i,em") ? !c(e.ignoredFormats, "italic") : t.matches("u") ? !c(e.ignoredFormats, "underline") : t.matches("s,strike") ? !c(e.ignoredFormats, "strikethrough") : !0;
}
function $t(t) {
  if (t.nodeType !== Node.TEXT_NODE || (t.textContent || "").trim()) return !1;
  const e = t.parentElement;
  return !!(e != null && e.matches(_));
}
function et(t, e) {
  let n = t;
  const r = Object.entries(e.styles);
  if (r.length > 0) {
    const o = document.createElement("span");
    o.classList.add("rte-format-painted"), r.forEach(([i, s]) => {
      o.style.setProperty(B(i), s);
    }), o.appendChild(n), n = o;
  }
  return e.marks.strikethrough && (n = T("s", n)), e.marks.underline && (n = T("u", n)), e.marks.italic && (n = T("i", n)), e.marks.bold && (n = T("b", n)), n;
}
function T(t, e) {
  const n = document.createElement(t);
  return n.appendChild(e), n;
}
function qt(t, e) {
  Array.from(t.querySelectorAll(y)).forEach((n) => {
    if (n instanceof HTMLElement && !x(n, e)) {
      if (n.matches("span")) {
        if (L.forEach((r) => {
          c(e.ignoredFormats, r) || n.style.removeProperty(B(r));
        }), n.getAttribute("style") || n.attributes.length > 0) return;
        S(n);
        return;
      }
      n.matches("b,strong") && c(e.ignoredFormats, "bold") || n.matches("i,em") && c(e.ignoredFormats, "italic") || n.matches("u") && c(e.ignoredFormats, "underline") || n.matches("s,strike") && c(e.ignoredFormats, "strikethrough") || S(n);
    }
  });
}
function x(t, e) {
  return !!(t.matches("a") && c(e.ignoredFormats, "link") || R(t, "comment") && c(e.ignoredFormats, "comments") || R(t, "citation") && c(e.ignoredFormats, "citations") || R(t, "track") && c(e.ignoredFormats, "trackchanges"));
}
function R(t, e) {
  const n = e.toLowerCase();
  return t.className.toString().toLowerCase().includes(n) ? !0 : Array.from(t.attributes).some((o) => {
    const i = A(o.name), s = o.value.toLowerCase();
    return i.includes(n) || s.includes(n);
  });
}
function zt(t, e) {
  t.filter((r) => r.tagName.toLowerCase() === "li").forEach((r) => {
    const o = r.closest(_);
    if (!o) return;
    const i = Zt(o, e.tagName);
    k(i, e.styles), Z(i, e.attrs), Z(r, e.itemAttrs);
  });
}
function Kt(t, e) {
  var o;
  const n = Array.from(t.querySelectorAll(w)).filter((i) => i instanceof HTMLElement && e.intersectsNode(i));
  if (n.length > 0) return n;
  const r = (o = d(e.startContainer)) == null ? void 0 : o.closest(w);
  return r instanceof HTMLElement && t.contains(r) ? [r] : [];
}
function k(t, e) {
  Object.entries(e).forEach(([n, r]) => {
    t.style.setProperty(B(n), r);
  });
}
function Vt(t, e) {
  var o, i;
  const n = rt(t);
  if (n === e || n === "li" || n === "td" || n === "th") return t;
  if (e === "blockquote") {
    const s = document.createElement("blockquote");
    for (; t.firstChild; ) s.appendChild(t.firstChild);
    return F(t, s), (o = t.parentNode) == null || o.replaceChild(s, t), s;
  }
  if (!/^(p|div|h[1-6]|pre)$/.test(e)) return t;
  const r = document.createElement(e);
  for (; t.firstChild; ) r.appendChild(t.firstChild);
  return F(t, r), (i = t.parentNode) == null || i.replaceChild(r, t), r;
}
function Zt(t, e) {
  var r;
  if (t.tagName.toLowerCase() === e) return t;
  const n = document.createElement(e);
  for (; t.firstChild; ) n.appendChild(t.firstChild);
  return F(t, n), (r = t.parentNode) == null || r.replaceChild(n, t), n;
}
function Xt(t, e) {
  const n = Array.from(t.querySelectorAll(b)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
  if (n.length > 0)
    return n.filter((o) => !n.some((i) => i !== o && i.contains(o)));
  const r = nt(d(e.startContainer), t);
  return r ? [r] : [];
}
function nt(t, e) {
  const n = t == null ? void 0 : t.closest(b);
  return n instanceof HTMLElement && e.contains(n) ? n : null;
}
function rt(t) {
  const e = t.tagName.toLowerCase();
  return e === "blockquote" || /^h[1-6]$/.test(e) || e === "pre" || e === "li" || e === "td" || e === "th" ? e : "p";
}
function Yt(t) {
  return Array.from(t.childNodes).some((e) => {
    if (e.nodeType !== Node.ELEMENT_NODE) return !1;
    const n = e;
    return n.matches(b) || !!n.querySelector(b);
  });
}
function Jt(t) {
  const e = window.getSelection();
  if (!e || e.rangeCount === 0) return null;
  const n = e.getRangeAt(0);
  if (!t.contains(n.startContainer) || !t.contains(n.endContainer)) return null;
  const r = n.collapsed, o = z("start"), i = z("end"), s = n.cloneRange();
  if (!r) {
    const l = s.cloneRange();
    l.collapse(!1), l.insertNode(i);
  }
  const a = s.cloneRange();
  return a.collapse(!0), a.insertNode(o), () => {
    const l = V(t, "start"), u = V(t, "end");
    if (!l) return;
    const f = document.createRange();
    r || !u ? (f.setStartAfter(l), f.collapse(!0)) : (f.setStartAfter(l), f.setEndBefore(u)), e.removeAllRanges(), e.addRange(f);
  };
}
function z(t) {
  return document.createComment(`${m}:selection:${t}`);
}
function K(t) {
  return document.createComment(`${m}:inline:${t}`);
}
function ot(t) {
  return Gt(t) || jt(t);
}
function Gt(t) {
  return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${m}:selection:start` || t.nodeValue === `${m}:selection:end`);
}
function jt(t) {
  return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${m}:inline:start` || t.nodeValue === `${m}:inline:end`);
}
function V(t, e) {
  const n = `${m}:selection:${e}`, r = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT);
  let o = r.nextNode();
  for (; o; ) {
    if (o.nodeValue === n) return o;
    o = r.nextNode();
  }
  return null;
}
function Ut(t) {
  t.querySelectorAll(`[${m}]`).forEach((o) => o.remove());
  const e = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT), n = [];
  let r = e.nextNode();
  for (; r; )
    ot(r) && n.push(r), r = e.nextNode();
  n.forEach((o) => o.remove());
}
function Qt(t) {
  t.querySelectorAll("span").forEach((e) => {
    e instanceof HTMLElement && (e.attributes.length > 0 || S(e));
  });
}
function S(t) {
  const e = t.parentNode;
  if (e) {
    for (; t.firstChild; )
      e.insertBefore(t.firstChild, t);
    e.removeChild(t);
  }
}
function N(t, e, n) {
  const r = t.getAttribute(n);
  r != null && (e[n] = r);
}
function Z(t, e) {
  ["data-type", "data-checked", "type"].forEach((n) => {
    e[n] != null && t.setAttribute(n, e[n]);
  });
}
function F(t, e) {
  Array.from(t.attributes).forEach((n) => {
    n.name !== "style" && e.setAttribute(n.name, n.value);
  });
}
function h(t, e) {
  const n = E(t);
  if (n.active === e && t.classList.contains("rte-format-painter-active") === e) {
    M(t, e);
    return;
  }
  n.active = e, t.classList.toggle("rte-format-painter-active", e), M(t, e);
}
function M(t, e) {
  const n = t.closest(st) || document;
  n.querySelectorAll(
    '[data-command="toggleFormatPainter"], [data-command="formatPainter"]'
  ).forEach((o) => {
    o instanceof HTMLElement && (o.classList.toggle("active", e), o.setAttribute("data-active", e ? "true" : "false"), o.setAttribute("aria-pressed", e ? "true" : "false"));
  }), n.dispatchEvent(
    new CustomEvent("editora:format-painter-toggle", {
      bubbles: !0,
      detail: { active: e }
    })
  );
}
function te(t, e, n) {
  if (e === n) return;
  const r = window.execEditorCommand || window.executeEditorCommand;
  if (typeof r == "function")
    try {
      r("recordDomTransaction", { editor: t, beforeHTML: e, afterHTML: n });
    } catch (o) {
      try {
        r("recordDomTransaction", t, e, n);
      } catch (i) {
      }
    }
}
function ee(t) {
  return (t != null ? t : O).map(A).map((e) => X[e] || e).filter(Boolean);
}
function c(t, e) {
  const n = X[A(e)] || A(e);
  return t.includes(n);
}
function A(t) {
  return t.toLowerCase().replace(/[^a-z0-9]/g, "");
}
function B(t) {
  return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
}
export {
  ne as FormatPainterPlugin
};
//# sourceMappingURL=FormatPainterPlugin.native-CsMrKfFU.mjs.map
