const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", le = "__editoraCommandEditorRoot", ie = "rte-smart-paste-styles", u = "rte-smart-paste-panel", h = "smart-paste", S = "smartPaste", E = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ke = typeof NodeFilter < "u" ? NodeFilter.SHOW_COMMENT : 128, ce = "__editoraSmartPasteHandled", Ce = /* @__PURE__ */ new Set([
  "script",
  "style",
  "meta",
  "link",
  "object",
  "embed",
  "iframe",
  "svg",
  "canvas",
  "math",
  "form",
  "input",
  "button",
  "textarea",
  "select",
  "option"
]), Te = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Ae = /* @__PURE__ */ new Set(["span", "font"]), Pe = /^(https?:|mailto:|tel:|#|\/)/i, we = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Le = /* @__PURE__ */ new Set([
  "color",
  "background-color",
  "font-weight",
  "font-style",
  "text-decoration",
  "text-align",
  "font-size",
  "font-family",
  "line-height",
  "letter-spacing",
  "word-spacing",
  "white-space",
  "vertical-align",
  "margin-left",
  "margin-right",
  "margin-top",
  "margin-bottom",
  "padding-left",
  "padding-right",
  "padding-top",
  "padding-bottom",
  "text-indent",
  "border",
  "border-top",
  "border-right",
  "border-bottom",
  "border-left",
  "border-color",
  "border-width",
  "border-style",
  "list-style-type"
]), $e = {
  panelTitle: "Smart Paste",
  panelAriaLabel: "Smart paste panel",
  enabledText: "Smart paste is enabled",
  disabledText: "Smart paste is disabled",
  toggleOnText: "Disable Smart Paste",
  toggleOffText: "Enable Smart Paste",
  cycleProfileText: "Cycle Profile",
  profileLabel: "Profile",
  fidelityText: "Fidelity",
  balancedText: "Balanced",
  plainText: "Plain Text",
  lastPasteHeading: "Last Paste Result",
  lastPasteEmptyText: "Paste content to see cleanup metrics.",
  lastPasteSourceLabel: "Source",
  lastPasteProfileLabel: "Profile",
  lastPasteRemovedLabel: "Removed",
  lastPasteCharsLabel: "Output Chars",
  closeText: "Close",
  shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",
  readonlyMessage: "Editor is read-only. Smart paste was skipped."
}, Y = {
  fidelity: {
    keepStyles: !0,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !0
  },
  balanced: {
    keepStyles: !1,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !0
  },
  plain: {
    keepStyles: !1,
    keepClasses: !1,
    keepDataAttributes: !1,
    preserveTables: !1
  }
}, d = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new Set();
let I = 0, Me = 0, $ = null, m = null, A = null, P = null, T = null, w = null;
function X(e) {
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
}
function Oe(e) {
  return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
`);
}
function _(e) {
  return e === "balanced" || e === "plain" ? e : "fidelity";
}
function Z(e, t) {
  return {
    keepStyles: e?.keepStyles ?? t.keepStyles,
    keepClasses: e?.keepClasses ?? t.keepClasses,
    keepDataAttributes: e?.keepDataAttributes ?? t.keepDataAttributes,
    preserveTables: e?.preserveTables ?? t.preserveTables
  };
}
function K(e = {}) {
  const t = e.profileOptions || {};
  return {
    enabled: e.enabled !== !1,
    defaultProfile: _(e.defaultProfile),
    maxHtmlLength: Math.max(8e3, Math.min(8e5, Number(e.maxHtmlLength ?? 22e4))),
    removeComments: e.removeComments !== !1,
    normalizeWhitespace: e.normalizeWhitespace !== !1,
    labels: {
      ...$e,
      ...e.labels || {}
    },
    normalizeText: e.normalizeText || Oe,
    profileOptions: {
      fidelity: Z(t.fidelity, Y.fidelity),
      balanced: Z(t.balanced, Y.balanced),
      plain: Z(t.plain, Y.plain)
    }
  };
}
function de(e) {
  return {
    enabled: e.enabled,
    defaultProfile: e.defaultProfile,
    maxHtmlLength: e.maxHtmlLength,
    removeComments: e.removeComments,
    normalizeWhitespace: e.normalizeWhitespace,
    labels: { ...e.labels },
    normalizeText: e.normalizeText,
    profileOptions: {
      fidelity: { ...e.profileOptions.fidelity },
      balanced: { ...e.profileOptions.balanced },
      plain: { ...e.profileOptions.plain }
    }
  };
}
function te(e) {
  return e.closest(ee) || e;
}
function H(e) {
  if (!e) return null;
  if (e.matches(y)) return e;
  const t = e.querySelector(y);
  return t instanceof HTMLElement ? t : null;
}
function Re() {
  if (typeof window > "u") return null;
  const e = window[le];
  if (!(e instanceof HTMLElement)) return null;
  window[le] = null;
  const t = H(e);
  if (t) return t;
  const a = e.closest(ee);
  if (a) {
    const n = H(a);
    if (n) return n;
  }
  const r = e.closest(y);
  return r instanceof HTMLElement ? r : null;
}
function ze(e) {
  const t = e.closest("[data-editora-editor]");
  if (t && H(t) === e)
    return t;
  let a = e;
  for (; a; ) {
    if (a.matches(ee) && (a === e || H(a) === e))
      return a;
    a = a.parentElement;
  }
  return te(e);
}
function me(e) {
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
}
function C(e, t = !0, a = !0) {
  if (V(), e?.contentElement instanceof HTMLElement) return e.contentElement;
  if (e?.editorElement instanceof HTMLElement) {
    const s = H(e.editorElement);
    if (s) return s;
  }
  const r = Re();
  if (r) return r;
  const n = window.getSelection();
  if (n && n.rangeCount > 0) {
    const l = me(n.getRangeAt(0).startContainer)?.closest(y);
    if (l) return l;
  }
  const o = document.activeElement;
  if (o) {
    if (o.matches(y)) return o;
    const s = o.closest(y);
    if (s) return s;
  }
  if (a) {
    if (m && m.isConnected) return m;
    m && !m.isConnected && (m = null);
  }
  return t ? document.querySelector(y) : null;
}
function _e(e) {
  const t = e.target;
  if (t) {
    const r = t.closest(y);
    if (r) return r;
  }
  const a = window.getSelection();
  if (a && a.rangeCount > 0) {
    const n = me(a.getRangeAt(0).startContainer)?.closest(y);
    if (n) return n;
  }
  return null;
}
function B(e) {
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
}
function He(e) {
  const t = te(e);
  if (B(t)) return !0;
  const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
  return B(a) ? !0 : B(document.documentElement) || B(document.body);
}
function F(e, t) {
  e.classList.remove("rte-smart-paste-theme-dark"), He(t) && e.classList.add("rte-smart-paste-theme-dark");
}
function ue(e) {
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
}
function D(e, t, a) {
  const r = ze(e);
  Array.from(
    r.querySelectorAll(
      `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
    )
  ).forEach((o) => {
    o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
  });
}
function p(e, t) {
  d.has(e) || d.set(e, t);
  let a = L.get(e);
  return a || (a = {
    enabled: t.enabled,
    profile: t.defaultProfile,
    lastReport: null
  }, L.set(e, a)), et(e), z.add(e), a;
}
function be(e) {
  const t = j.get(e);
  t && (e.removeEventListener("paste", t, !0), j.delete(e));
}
function ge(e) {
  be(e), g.get(e)?.remove(), g.delete(e), q.delete(e), d.delete(e), L.delete(e), z.delete(e), m === e && (m = null);
}
function V() {
  Array.from(z).forEach((t) => {
    t.isConnected || ge(t);
  });
}
function De(e) {
  for (let t = 0; t < e.length; t += 1) {
    const a = e[t];
    if (!(a.type !== "childList" || a.removedNodes.length === 0))
      for (let r = 0; r < a.removedNodes.length; r += 1) {
        const n = a.removedNodes[r];
        if (n.nodeType !== Node.ELEMENT_NODE) continue;
        const o = n;
        if (o.matches?.(y) || o.matches?.(`.${u}`) || o.querySelector?.(y) || o.querySelector?.(`.${u}`))
          return !0;
      }
  }
  return !1;
}
function re(e) {
  return q.get(e) === !0;
}
function O(e, t) {
  const a = e.querySelector(".rte-smart-paste-live");
  a && (a.textContent = t);
}
function J(e, t) {
  const a = t.normalizeText(e);
  return t.normalizeWhitespace ? a.split(`
`).map((n) => n.replace(/[\t ]+/g, " ").trimEnd()).join(`
`).replace(/\n{3,}/g, `

`).trim() : a;
}
function Ne(e) {
  return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
}
function qe(e) {
  return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
}
function Ie(e, t) {
  return e ? Ne(e) ? "word" : qe(e) ? "google-docs" : "html" : t ? "plain" : "html";
}
function Be(e) {
  return e.split(/\s+/).map((a) => a.trim()).filter(Boolean).filter((a) => !/^mso/i.test(a)).filter((a) => !/^docs-/i.test(a)).filter((a) => !/^c\d+$/i.test(a)).join(" ");
}
function We(e) {
  if (!e) return { value: "", changed: !1 };
  const t = e.split(";"), a = [];
  let r = !1;
  return t.forEach((n) => {
    const o = n.indexOf(":");
    if (o <= 0) {
      n.trim() && (r = !0);
      return;
    }
    const s = n.slice(0, o).trim().toLowerCase(), l = n.slice(o + 1).trim();
    if (!s || !l) {
      r = !0;
      return;
    }
    if (!Le.has(s)) {
      r = !0;
      return;
    }
    if (/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)) {
      r = !0;
      return;
    }
    a.push(`${s}: ${l}`);
  }), {
    value: a.join("; "),
    changed: r
  };
}
function fe(e) {
  const t = e.trim();
  return t && (Pe.test(t) || we.test(t)) ? t : "";
}
function pe(e) {
  const t = e.parentNode;
  if (t) {
    for (; e.firstChild; )
      t.insertBefore(e.firstChild, e);
    t.removeChild(e);
  }
}
function Ke(e, t, a, r) {
  const n = e.tagName.toLowerCase();
  if (Ce.has(n)) {
    r.removedElements += 1, e.remove();
    return;
  }
  if (!t.preserveTables && Te.has(n)) {
    const s = e.textContent || "", l = document.createTextNode(s);
    e.replaceWith(l), r.removedElements += 1;
    return;
  }
  if (Array.from(e.attributes).forEach((s) => {
    const l = s.name.toLowerCase(), i = s.value;
    if (l.startsWith("on")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "style") {
      if (!t.keepStyles) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      const c = We(i);
      if (!c.value) {
        e.removeAttribute(s.name), r.removedAttributes += 1, c.changed && (r.normalizedStyles += 1);
        return;
      }
      (c.changed || c.value !== i) && (e.setAttribute("style", c.value), r.normalizedStyles += 1);
      return;
    }
    if (l === "class") {
      if (!t.keepClasses) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      const c = Be(i);
      if (!c) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      c !== i && (e.setAttribute("class", c), r.removedAttributes += 1);
      return;
    }
    if (l.startsWith("data-") && !t.keepDataAttributes) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "id" || l === "xmlns" || l.startsWith("xml")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if ((a === "word" || a === "google-docs") && (l === "lang" || l === "dir")) {
      e.removeAttribute(s.name), r.removedAttributes += 1;
      return;
    }
    if (l === "href" || l === "src" || l === "xlink:href") {
      const c = fe(i);
      if (!c) {
        e.removeAttribute(s.name), r.removedAttributes += 1;
        return;
      }
      c !== i && e.setAttribute(s.name, c);
    }
  }), n === "a") {
    if (!e.getAttribute("href")) {
      pe(e), r.removedElements += 1;
      return;
    }
    e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
  }
  if (n === "img") {
    const s = e.getAttribute("src");
    if (!s || !fe(s)) {
      r.removedElements += 1, e.remove();
      return;
    }
  }
  if (Ae.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
    const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
    if (!s && !l) {
      e.remove(), r.removedElements += 1;
      return;
    }
    !s && l && (pe(e), r.removedElements += 1);
  }
}
function Ve(e, t, a, r, n) {
  const o = document.createElement("template");
  o.innerHTML = e;
  const s = {
    removedElements: 0,
    removedAttributes: 0,
    removedComments: 0,
    normalizedStyles: 0
  };
  if (r.removeComments)
    try {
      const f = document.createTreeWalker(o.content, ke, null), b = [];
      let k = f.nextNode();
      for (; k; )
        b.push(k), k = f.nextNode();
      b.forEach((v) => {
        v.remove(), s.removedComments += 1;
      });
    } catch {
    }
  Array.from(o.content.querySelectorAll("*")).forEach((f) => {
    f.isConnected && Ke(f, t, a, s);
  });
  let i = o.innerHTML;
  r.normalizeWhitespace && n !== "fidelity" ? i = i.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (i = i.trim());
  const c = (o.content.textContent || "").trim().length;
  return {
    html: i,
    textLength: c,
    counters: s
  };
}
function he(e) {
  const t = window.getSelection();
  if (!t || t.rangeCount === 0) return null;
  const a = t.getRangeAt(0);
  return e.contains(a.commonAncestorContainer) ? a : null;
}
function ye(e, t) {
  if (!e.isConnected) return;
  const a = window.getSelection();
  a && (a.removeAllRanges(), a.addRange(t));
}
function je(e, t) {
  e.focus({ preventScroll: !0 });
  try {
    if (document.execCommand("insertHTML", !1, t))
      return !0;
  } catch {
  }
  const a = he(e);
  if (!a) return !1;
  a.deleteContents();
  const r = document.createElement("template");
  r.innerHTML = t;
  const n = r.content, o = n.lastChild;
  if (a.insertNode(n), o) {
    const s = document.createRange();
    s.setStartAfter(o), s.collapse(!0), ye(e, s);
  }
  return !0;
}
function Fe(e, t) {
  e.focus({ preventScroll: !0 });
  try {
    if (document.execCommand("insertText", !1, t))
      return !0;
  } catch {
  }
  const a = he(e);
  if (!a) return !1;
  a.deleteContents();
  const r = document.createTextNode(t);
  a.insertNode(r);
  const n = document.createRange();
  return n.setStart(r, r.length), n.collapse(!0), ye(e, n), !0;
}
function Ge(e, t) {
  if (t === e.innerHTML) return;
  const a = window.execEditorCommand || window.executeEditorCommand;
  if (typeof a == "function")
    try {
      a("recordDomTransaction", e, t, e.innerHTML);
    } catch {
    }
}
function Ue(e) {
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
}
function W(e, t, a, r, n, o) {
  return {
    source: e,
    profile: t,
    inputHtmlLength: a,
    outputHtmlLength: r,
    outputTextLength: n,
    removedElements: o.removedElements,
    removedAttributes: o.removedAttributes,
    removedComments: o.removedComments,
    normalizedStyles: o.normalizedStyles,
    createdAt: (/* @__PURE__ */ new Date()).toISOString()
  };
}
function Ye(e, t, a, r) {
  const n = Ie(e, t);
  if (a === "plain") {
    const l = t || e.replace(/<[^>]*>/g, " "), i = J(l, r);
    return {
      mode: "text",
      value: i,
      report: W(
        n,
        a,
        e.length,
        0,
        i.length,
        {
          removedElements: 0,
          removedAttributes: 0,
          removedComments: 0,
          normalizedStyles: 0
        }
      )
    };
  }
  if (!e || e.length > r.maxHtmlLength) {
    const l = J(t || e.replace(/<[^>]*>/g, " "), r);
    return {
      mode: "text",
      value: l,
      report: W(
        n,
        a,
        e.length,
        0,
        l.length,
        {
          removedElements: 0,
          removedAttributes: 0,
          removedComments: 0,
          normalizedStyles: 0
        }
      )
    };
  }
  const o = r.profileOptions[a], s = Ve(e, o, n, r, a);
  if (!s.html) {
    const l = J(t || e.replace(/<[^>]*>/g, " "), r);
    return {
      mode: "text",
      value: l,
      report: W(n, a, e.length, 0, l.length, s.counters)
    };
  }
  return {
    mode: "html",
    value: s.html,
    report: W(
      n,
      a,
      e.length,
      s.html.length,
      s.textLength,
      s.counters
    )
  };
}
function G(e, t) {
  return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
}
function ae(e) {
  return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
}
function Xe(e, t) {
  e.setAttribute("aria-label", t.labels.panelAriaLabel);
  const a = e.querySelector(".rte-smart-paste-title");
  a && (a.textContent = t.labels.panelTitle);
  const r = e.querySelector('[data-action="close"]');
  r && r.setAttribute("aria-label", t.labels.closeText);
  const n = e.querySelector('[data-action="toggle-enabled"]');
  if (n) {
    const Ee = n.getAttribute("data-enabled") === "true";
    n.textContent = Ee ? t.labels.toggleOnText : t.labels.toggleOffText;
  }
  const o = e.querySelector('[data-action="cycle-profile"]');
  o && (o.textContent = t.labels.cycleProfileText);
  const s = e.querySelector(".rte-smart-paste-profile-heading");
  s && (s.textContent = t.labels.profileLabel);
  const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
  l && l.setAttribute("aria-label", t.labels.profileLabel);
  const i = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
  i && (i.textContent = t.labels.fidelityText);
  const c = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
  c && (c.textContent = t.labels.balancedText);
  const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
  f && (f.textContent = t.labels.plainText);
  const b = e.querySelector(".rte-smart-paste-report-title");
  b && (b.textContent = t.labels.lastPasteHeading);
  const k = e.querySelector(".rte-smart-paste-empty");
  k && (k.textContent = t.labels.lastPasteEmptyText);
  const v = e.querySelector('[data-key="source-label"]');
  v && (v.textContent = t.labels.lastPasteSourceLabel);
  const U = e.querySelector('[data-key="profile-label"]');
  U && (U.textContent = t.labels.lastPasteProfileLabel);
  const M = e.querySelector('[data-key="removed-label"]');
  M && (M.textContent = t.labels.lastPasteRemovedLabel);
  const ne = e.querySelector('[data-key="chars-label"]');
  ne && (ne.textContent = t.labels.lastPasteCharsLabel);
  const se = e.querySelector(".rte-smart-paste-shortcut");
  se && (se.textContent = t.labels.shortcutText);
}
function x(e) {
  const t = g.get(e), a = d.get(e) || $, r = L.get(e);
  if (!t || !a || !r) return;
  Xe(t, a);
  const n = t.querySelector(".rte-smart-paste-status");
  n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
  const o = t.querySelector('[data-action="toggle-enabled"]');
  o && (o.setAttribute("data-enabled", r.enabled ? "true" : "false"), o.textContent = r.enabled ? a.labels.toggleOnText : a.labels.toggleOffText, o.setAttribute("aria-pressed", r.enabled ? "true" : "false")), Array.from(
    t.querySelectorAll('[data-action="set-profile"][data-profile]')
  ).forEach((v) => {
    const M = _(v.getAttribute("data-profile")) === r.profile;
    v.classList.toggle("active", M), v.setAttribute("aria-pressed", M ? "true" : "false");
  });
  const l = t.querySelector(".rte-smart-paste-empty"), i = t.querySelector(".rte-smart-paste-report"), c = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), b = t.querySelector('[data-key="removed-value"]'), k = t.querySelector('[data-key="chars-value"]');
  if (!r.lastReport) {
    l && (l.hidden = !1), i && (i.hidden = !0);
    return;
  }
  if (l && (l.hidden = !0), i && (i.hidden = !1), c && (c.textContent = r.lastReport.source), f && (f.textContent = G(r.lastReport.profile, a.labels)), b) {
    const v = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
    b.textContent = String(v);
  }
  k && (k.textContent = String(r.lastReport.outputTextLength));
}
function Q(e, t) {
  if (!t.classList.contains("show")) return;
  const a = te(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360), n = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10, a.top + 12));
  t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(240, window.innerHeight - 20)}px`;
}
function N(e, t = !1) {
  const a = g.get(e);
  a && (a.classList.remove("show"), q.set(e, !1), D(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
}
function Ze(e) {
  const t = g.get(e);
  if (t) return t;
  const a = d.get(e) || $ || K(), r = `rte-smart-paste-panel-${Me++}`, n = document.createElement("section");
  return n.className = u, n.id = r, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", a.labels.panelAriaLabel), n.innerHTML = `
    <header class="rte-smart-paste-header">
      <h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
      <button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
    </header>
    <div class="rte-smart-paste-body">
      <p class="rte-smart-paste-status"></p>
      <div class="rte-smart-paste-controls">
        <button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
        <button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
      </div>
      <div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
        <p class="rte-smart-paste-profile-heading"></p>
        <div class="rte-smart-paste-profile-grid">
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
          <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
        </div>
      </div>
      <section class="rte-smart-paste-metrics" aria-live="polite">
        <h3 class="rte-smart-paste-report-title"></h3>
        <p class="rte-smart-paste-empty"></p>
        <dl class="rte-smart-paste-report" hidden>
          <div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
          <div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
        </dl>
      </section>
      <p class="rte-smart-paste-shortcut"></p>
    </div>
    <div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
  `, n.addEventListener("click", (o) => {
    const l = o.target?.closest("[data-action]");
    if (!l) return;
    const i = l.getAttribute("data-action");
    if (i) {
      if (i === "close") {
        N(e, !0);
        return;
      }
      if (i === "toggle-enabled") {
        const c = p(e, d.get(e) || a);
        c.enabled = !c.enabled, D(e, "toggleSmartPasteEnabled", c.enabled), x(e), O(n, c.enabled ? a.labels.enabledText : a.labels.disabledText);
        return;
      }
      if (i === "cycle-profile") {
        const c = p(e, d.get(e) || a);
        c.profile = ae(c.profile), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
        return;
      }
      if (i === "set-profile") {
        const c = p(e, d.get(e) || a);
        c.profile = _(l.getAttribute("data-profile")), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
      }
    }
  }), n.addEventListener("keydown", (o) => {
    if (o.key === "Escape") {
      o.preventDefault(), N(e, !0);
      return;
    }
    if (o.key !== "ArrowRight" && o.key !== "ArrowLeft") return;
    const s = Array.from(
      n.querySelectorAll('[data-action="set-profile"][data-profile]')
    );
    if (s.length === 0) return;
    const l = s.findIndex((f) => f === document.activeElement);
    if (l < 0) return;
    const i = o.key === "ArrowRight" ? 1 : -1, c = (l + i + s.length) % s.length;
    o.preventDefault(), s[c].focus();
  }), F(n, e), document.body.appendChild(n), g.set(e, n), q.set(e, !1), x(e), n;
}
function xe(e) {
  const t = Ze(e);
  g.forEach((r, n) => {
    n !== e && N(n, !1);
  }), t.classList.add("show"), q.set(e, !0), D(e, "toggleSmartPastePanel", !0), F(t, e), Q(e, t), t.querySelector('[data-action="toggle-enabled"]')?.focus();
}
function ve(e, t) {
  const a = re(e);
  return (typeof t == "boolean" ? t : !a) ? xe(e) : N(e, !1), !0;
}
function Se(e) {
  return {
    enabled: e.enabled,
    profile: e.profile,
    lastReport: e.lastReport ? { ...e.lastReport } : null
  };
}
function Je(e, t) {
  const a = d.get(e) || $;
  if (!a) return !1;
  const r = p(e, a);
  if (!r.enabled || ue(e)) {
    const b = g.get(e);
    return b && ue(e) && O(b, a.labels.readonlyMessage), !1;
  }
  const n = t.clipboardData;
  if (!n) return !1;
  const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
  if (!o && !s) return !1;
  const l = Ye(o, s, r.profile, a);
  if (!l.value) return !1;
  const i = e.innerHTML;
  if (!(l.mode === "html" ? je(e, l.value) : Fe(e, l.value))) return !1;
  r.lastReport = { ...l.report }, L.set(e, r), Ge(e, i), Ue(e), e.dispatchEvent(
    new CustomEvent("editora:smart-paste", {
      bubbles: !0,
      detail: Se(r)
    })
  ), x(e);
  const f = g.get(e);
  if (f) {
    const b = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
    O(
      f,
      `${a.labels.panelTitle}: ${G(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${b}.`
    );
  }
  return !0;
}
function Qe(e) {
  return (t) => {
    t.defaultPrevented || t[ce] === !0 || (m = e, !Je(e, t)) || (t[ce] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
  };
}
function et(e) {
  if (j.has(e)) return;
  const t = Qe(e);
  e.addEventListener("paste", t, !0), j.set(e, t);
}
function R(e) {
  const t = L.get(e);
  D(e, "toggleSmartPastePanel", re(e)), D(e, "toggleSmartPasteEnabled", t?.enabled === !0);
}
function oe(e) {
  return typeof e.key == "string" ? e.key.toLowerCase() : "";
}
function tt(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
}
function rt(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
}
function at(e) {
  const t = oe(e);
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
}
function ot(e) {
  $ = e, A || (A = (t) => {
    V();
    const r = t.target?.closest(y);
    if (!r) return;
    const n = d.get(r) || e;
    p(r, n), d.set(r, n), m = r, R(r);
    const o = g.get(r);
    o && (F(o, r), Q(r, o), x(r));
  }, document.addEventListener("focusin", A, !0)), P || (P = (t) => {
    if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
    const r = _e(t);
    if (!r) return;
    const n = d.get(r) || $ || e;
    if (p(r, n), d.set(r, n), m = r, t.key === "Escape" && re(r)) {
      t.preventDefault(), N(r, !0);
      return;
    }
    if (tt(t)) {
      t.preventDefault(), t.stopPropagation(), ve(r);
      return;
    }
    if (rt(t)) {
      t.preventDefault(), t.stopPropagation();
      const o = p(r, n);
      o.profile = ae(o.profile), x(r);
      return;
    }
    if (at(t)) {
      t.preventDefault(), t.stopPropagation();
      const o = p(r, n);
      o.enabled = !o.enabled, R(r), x(r);
    }
  }, document.addEventListener("keydown", P, !0)), T || (T = () => {
    V(), g.forEach((t, a) => {
      !a.isConnected || !t.isConnected || (F(t, a), Q(a, t));
    });
  }, window.addEventListener("scroll", T, !0), window.addEventListener("resize", T)), !w && typeof MutationObserver < "u" && document.body && (w = new MutationObserver((t) => {
    De(t) && V();
  }), w.observe(document.body, {
    childList: !0,
    subtree: !0
  }));
}
function nt() {
  A && (document.removeEventListener("focusin", A, !0), A = null), P && (document.removeEventListener("keydown", P, !0), P = null), T && (window.removeEventListener("scroll", T, !0), window.removeEventListener("resize", T), T = null), w && (w.disconnect(), w = null), g.forEach((e) => e.remove()), g.clear(), z.forEach((e) => be(e)), z.clear(), $ = null, m = null;
}
function st() {
  if (typeof document > "u" || document.getElementById(ie)) return;
  const e = document.createElement("style");
  e.id = ie, e.textContent = `
    .rte-toolbar-group-items.${h},
    .editora-toolbar-group-items.${h},
    .rte-toolbar-group-items.${S},
    .editora-toolbar-group-items.${S} {
      display: flex;
      border: 1px solid #ccc;
      border-radius: 3px;
      background: #fff;
    }

    .rte-toolbar-group-items.${h} .rte-toolbar-button,
    .editora-toolbar-group-items.${h} .editora-toolbar-button,
    .rte-toolbar-group-items.${S} .rte-toolbar-button,
    .editora-toolbar-group-items.${S} .editora-toolbar-button {
      border: none;
      border-right: 1px solid #ccc;
      border-radius: 0;
    }

    .rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
    .editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
    .rte-toolbar-group-items.${S} .rte-toolbar-item:last-child .rte-toolbar-button,
    .editora-toolbar-group-items.${S} .editora-toolbar-item:last-child .editora-toolbar-button {
      border-right: none;
    }

    .rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
    .editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
      background-color: #ccc;
    }

    ${E} .rte-toolbar-group-items.${h},
    ${E} .editora-toolbar-group-items.${h},
    ${E} .rte-toolbar-group-items.${S},
    ${E} .editora-toolbar-group-items.${S},
    .${u}.rte-smart-paste-theme-dark {
      border-color: #566275;
    }

    ${E} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
    ${E} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
    ${E} .rte-toolbar-group-items.${S} .rte-toolbar-button svg,
    ${E} .editora-toolbar-group-items.${S} .editora-toolbar-button svg {
      fill: none;
    }

    ${E} .rte-toolbar-group-items.${h} .rte-toolbar-button,
    ${E} .editora-toolbar-group-items.${h} .editora-toolbar-button
    {
      border-color: #566275;
    }
    
    .${u} {
      position: fixed;
      z-index: 12000;
      display: none;
      width: min(360px, calc(100vw - 20px));
      max-height: calc(100vh - 20px);
      border: 1px solid #d1d5db;
      border-radius: 14px;
      background: #ffffff;
      color: #111827;
      box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
      overflow: hidden;
    }

    .${u}.show {
      display: flex;
      flex-direction: column;
    }

    .${u}.rte-smart-paste-theme-dark {
      border-color: #334155;
      background: #0f172a;
      color: #e2e8f0;
      box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
    }

    .rte-smart-paste-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 12px 14px;
      border-bottom: 1px solid #e5e7eb;
      background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
      border-color: #1e293b;
      background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    }

    .rte-smart-paste-title {
      margin: 0;
      font-size: 15px;
      line-height: 1.2;
      font-weight: 700;
    }

    .rte-smart-paste-icon-btn {
      width: 34px;
      height: 34px;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      background: #ffffff;
      color: #0f172a;
      font-size: 16px;
      line-height: 1;
      font-weight: 600;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .rte-smart-paste-icon-btn:hover,
    .rte-smart-paste-icon-btn:focus-visible {
      outline: none;
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
      background: #0f172a;
      border-color: #475569;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
      border-color: #60a5fa;
      box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
    }

    .rte-smart-paste-body {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 12px;
      overflow: auto;
    }

    .rte-smart-paste-status {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      color: #475569;
      font-weight: 600;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
      color: #94a3b8;
    }

    .rte-smart-paste-controls {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .rte-smart-paste-btn {
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      height: 34px;
      padding: 0 10px;
      background: #ffffff;
      color: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .rte-smart-paste-btn:hover,
    .rte-smart-paste-btn:focus-visible {
      border-color: #94a3b8;
      background: #f8fafc;
      outline: none;
    }

    .rte-smart-paste-btn-primary {
      border-color: #0284c7;
      background: #0ea5e9;
      color: #f8fafc;
    }

    .rte-smart-paste-btn-primary:hover,
    .rte-smart-paste-btn-primary:focus-visible {
      border-color: #0369a1;
      background: #0284c7;
      color: #ffffff;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
      border-color: #334155;
      background: #111827;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
      border-color: #475569;
      background: #1e293b;
    }

    .rte-smart-paste-profile {
      display: grid;
      gap: 6px;
    }

    .rte-smart-paste-profile-heading {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      font-weight: 700;
      color: #334155;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
      color: #cbd5e1;
    }

    .rte-smart-paste-profile-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }

    .rte-smart-paste-chip {
      height: 34px;
      border-radius: 9px;
      border: 1px solid #cbd5e1;
      background: #ffffff;
      color: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .rte-smart-paste-chip:hover,
    .rte-smart-paste-chip:focus-visible {
      border-color: #0284c7;
      outline: none;
    }

    .rte-smart-paste-chip.active {
      border-color: #0284c7;
      background: rgba(14, 165, 233, 0.14);
      color: #0c4a6e;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
      border-color: #334155;
      background: #0b1220;
      color: #e2e8f0;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
      border-color: #38bdf8;
      background: rgba(14, 165, 233, 0.2);
      color: #e0f2fe;
    }

    .rte-smart-paste-metrics {
      border: 1px solid #e2e8f0;
      border-radius: 10px;
      padding: 10px;
      background: #f8fafc;
      display: grid;
      gap: 8px;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
      border-color: #334155;
      background: #0b1220;
    }

    .rte-smart-paste-report-title {
      margin: 0;
      font-size: 12px;
      line-height: 1.3;
      font-weight: 700;
    }

    .rte-smart-paste-empty {
      margin: 0;
      font-size: 12px;
      line-height: 1.35;
      color: #475569;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
      color: #94a3b8;
    }

    .rte-smart-paste-report {
      margin: 0;
      display: grid;
      gap: 6px;
    }

    .rte-smart-paste-line {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      font-size: 12px;
      line-height: 1.3;
    }

    .rte-smart-paste-line dt {
      margin: 0;
      color: #475569;
      font-weight: 600;
    }

    .rte-smart-paste-line dd {
      margin: 0;
      font-weight: 700;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
      color: #94a3b8;
    }

    .rte-smart-paste-shortcut {
      margin: 2px 0 0;
      font-size: 11px;
      color: #64748b;
    }

    .${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
      color: #94a3b8;
    }

    .rte-smart-paste-live {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0 0 0 0);
      border: 0;
    }

    @media (max-width: 768px) {
      .${u} {
        left: 10px !important;
        right: 10px;
        top: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 20px);
      }

      .rte-smart-paste-profile-grid {
        grid-template-columns: 1fr;
      }
    }
  `, document.head.appendChild(e);
}
const lt = (e = {}) => {
  const t = K(e), a = /* @__PURE__ */ new Set();
  return st(), {
    name: "smartPaste",
    toolbar: [
      {
        id: "smartPasteGroup",
        label: "Smart Paste",
        type: "group",
        command: "smartPaste",
        items: [
          {
            id: "smartPaste",
            label: "Smart Paste Panel",
            command: "toggleSmartPastePanel",
            shortcut: "Mod-Alt-Shift-s",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
          },
          {
            id: "smartPasteProfile",
            label: "Cycle Smart Paste Profile",
            command: "cycleSmartPasteProfile",
            shortcut: "Mod-Alt-Shift-v",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'
          },
          {
            id: "smartPasteToggle",
            label: "Toggle Smart Paste",
            command: "toggleSmartPasteEnabled",
            shortcut: "Mod-Alt-Shift-g",
            icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
          }
        ]
      }
    ],
    commands: {
      smartPaste: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t;
        return p(o, s), d.set(o, s), m = o, xe(o), !0;
      },
      toggleSmartPastePanel: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t;
        return p(o, s), d.set(o, s), m = o, ve(o, typeof r == "boolean" ? r : void 0);
      },
      cycleSmartPasteProfile: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = p(o, s);
        return d.set(o, s), l.profile = ae(l.profile), x(o), !0;
      },
      setSmartPasteProfile: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = p(o, s);
        return d.set(o, s), l.profile = _(r), x(o), !0;
      },
      toggleSmartPasteEnabled: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = p(o, s);
        return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, R(o), x(o), !0;
      },
      setSmartPasteOptions: (r, n) => {
        const o = C(n, !1, !1);
        if (!o || !r || typeof r != "object") return !1;
        const s = d.get(o) || t, l = de(s), i = K({
          ...l,
          ...r,
          labels: {
            ...s.labels,
            ...r.labels || {}
          },
          profileOptions: {
            ...l.profileOptions,
            ...r.profileOptions || {},
            fidelity: {
              ...l.profileOptions?.fidelity || {},
              ...r.profileOptions?.fidelity || {}
            },
            balanced: {
              ...l.profileOptions?.balanced || {},
              ...r.profileOptions?.balanced || {}
            },
            plain: {
              ...l.profileOptions?.plain || {},
              ...r.profileOptions?.plain || {}
            }
          },
          normalizeText: r.normalizeText || s.normalizeText
        });
        d.set(o, i);
        const c = p(o, i);
        return typeof r.enabled == "boolean" && (c.enabled = r.enabled), r.defaultProfile && (c.profile = _(r.defaultProfile)), x(o), R(o), !0;
      },
      getSmartPasteState: (r, n) => {
        const o = C(n, !1, !1);
        if (!o) return !1;
        const s = d.get(o) || t, l = p(o, s), i = Se(l);
        if (typeof r == "function")
          try {
            r(i);
          } catch {
          }
        return o.__smartPasteState = i, o.dispatchEvent(
          new CustomEvent("editora:smart-paste-state", {
            bubbles: !0,
            detail: i
          })
        ), !0;
      }
    },
    keymap: {
      "Mod-Alt-Shift-s": "toggleSmartPastePanel",
      "Mod-Alt-Shift-S": "toggleSmartPastePanel",
      "Mod-Alt-Shift-v": "cycleSmartPasteProfile",
      "Mod-Alt-Shift-V": "cycleSmartPasteProfile",
      "Mod-Alt-Shift-g": "toggleSmartPasteEnabled",
      "Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
    },
    init: function(n) {
      I += 1;
      const o = this && typeof this.__pluginConfig == "object" ? K({ ...de(t), ...this.__pluginConfig }) : t;
      ot(o);
      const s = C(
        n?.editorElement ? { editorElement: n.editorElement } : void 0,
        !1,
        !1
      );
      if (!s) return;
      m = s, a.add(s);
      const l = p(s, o);
      l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), R(s);
    },
    destroy: () => {
      a.forEach((r) => ge(r)), a.clear(), I = Math.max(0, I - 1), !(I > 0) && nt();
    }
  };
};
export {
  lt as SmartPastePlugin
};
