@ryzeup/richtexteditor 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +55 -52
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -302,8 +302,8 @@ const tn = [
|
|
|
302
302
|
className: S,
|
|
303
303
|
style: R
|
|
304
304
|
}) => {
|
|
305
|
-
var
|
|
306
|
-
const N = Z(null), $ = Z(null), b = Z(null), [A, _] = H(!1), [
|
|
305
|
+
var B, Y;
|
|
306
|
+
const N = Z(null), $ = Z(null), b = Z(null), [A, _] = H(!1), [F, O] = H({
|
|
307
307
|
x: 0,
|
|
308
308
|
y: 0
|
|
309
309
|
});
|
|
@@ -313,7 +313,7 @@ const tn = [
|
|
|
313
313
|
};
|
|
314
314
|
return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
|
|
315
315
|
}, []);
|
|
316
|
-
const
|
|
316
|
+
const I = (g) => {
|
|
317
317
|
var X;
|
|
318
318
|
g.preventDefault();
|
|
319
319
|
const y = g.currentTarget.dataset.command;
|
|
@@ -356,7 +356,7 @@ const tn = [
|
|
|
356
356
|
table: !1,
|
|
357
357
|
color: !1,
|
|
358
358
|
highlight: !1
|
|
359
|
-
}),
|
|
359
|
+
}), q = Z(null), j = Z(null);
|
|
360
360
|
return U(() => {
|
|
361
361
|
const g = () => {
|
|
362
362
|
const y = window.getSelection();
|
|
@@ -364,9 +364,9 @@ const tn = [
|
|
|
364
364
|
let X = y.anchorNode.nodeType === Node.ELEMENT_NODE ? y.anchorNode : y.anchorNode.parentElement;
|
|
365
365
|
if (!X) return;
|
|
366
366
|
const J = window.getComputedStyle(X), le = J.fontFamily.replace(/['"]/g, "").split(",")[0], de = parseInt(J.fontSize, 10);
|
|
367
|
-
if (
|
|
368
|
-
const ee = Array.from(
|
|
369
|
-
|
|
367
|
+
if (q.current) {
|
|
368
|
+
const ee = Array.from(q.current.options).some((oe) => oe.value === le);
|
|
369
|
+
q.current.value = ee ? le : "";
|
|
370
370
|
}
|
|
371
371
|
j.current && (j.current.value = String(de));
|
|
372
372
|
};
|
|
@@ -398,32 +398,32 @@ const tn = [
|
|
|
398
398
|
}, w.bold && /* @__PURE__ */ r.createElement("button", {
|
|
399
399
|
"data-command": "bold",
|
|
400
400
|
title: "Bold",
|
|
401
|
-
onMouseDown:
|
|
401
|
+
onMouseDown: I,
|
|
402
402
|
className: x.bold ? "rte-active" : ""
|
|
403
403
|
}, /* @__PURE__ */ r.createElement(Bt, null)), w.italic && /* @__PURE__ */ r.createElement("button", {
|
|
404
404
|
"data-command": "italic",
|
|
405
405
|
title: "Italic",
|
|
406
|
-
onMouseDown:
|
|
406
|
+
onMouseDown: I,
|
|
407
407
|
className: x.italic ? "rte-active" : ""
|
|
408
408
|
}, /* @__PURE__ */ r.createElement(Ut, null)), w.underline && /* @__PURE__ */ r.createElement("button", {
|
|
409
409
|
"data-command": "underline",
|
|
410
410
|
title: "Underline",
|
|
411
|
-
onMouseDown:
|
|
411
|
+
onMouseDown: I,
|
|
412
412
|
className: x.underline ? "rte-active" : ""
|
|
413
413
|
}, /* @__PURE__ */ r.createElement(Zt, null)), w.unorderedList && /* @__PURE__ */ r.createElement("button", {
|
|
414
414
|
"data-command": "insertUnorderedList",
|
|
415
|
-
onMouseDown:
|
|
415
|
+
onMouseDown: I,
|
|
416
416
|
title: "UnorderedList",
|
|
417
417
|
className: x.unorderedList ? "rte-active" : ""
|
|
418
418
|
}, /* @__PURE__ */ r.createElement(Yt, null)), w.staticUnorderedList && /* @__PURE__ */ r.createElement("button", {
|
|
419
419
|
"data-command": "insertStaticUnorderedList",
|
|
420
|
-
onMouseDown:
|
|
420
|
+
onMouseDown: I,
|
|
421
421
|
title: "StaticUnorderedList",
|
|
422
422
|
className: x.unorderedList ? "rte-active" : ""
|
|
423
423
|
}, /* @__PURE__ */ r.createElement(Wt, null)), w.orderedList && /* @__PURE__ */ r.createElement("button", {
|
|
424
424
|
"data-command": "insertOrderedList",
|
|
425
425
|
title: "OrderedList",
|
|
426
|
-
onMouseDown:
|
|
426
|
+
onMouseDown: I,
|
|
427
427
|
className: x.orderedList ? "rte-active" : "",
|
|
428
428
|
style: {
|
|
429
429
|
fontSize: "medium"
|
|
@@ -431,7 +431,7 @@ const tn = [
|
|
|
431
431
|
}, /* @__PURE__ */ r.createElement(Kt, null)), w.staticOrderedList && /* @__PURE__ */ r.createElement("button", {
|
|
432
432
|
"data-command": "insertStaticOrderedList",
|
|
433
433
|
title: "StaticOrderedList",
|
|
434
|
-
onMouseDown:
|
|
434
|
+
onMouseDown: I,
|
|
435
435
|
className: x.orderedList ? "rte-active" : ""
|
|
436
436
|
}, /* @__PURE__ */ r.createElement(It, null)), w.link && /* @__PURE__ */ r.createElement("button", {
|
|
437
437
|
"data-command": "createLink",
|
|
@@ -448,7 +448,7 @@ const tn = [
|
|
|
448
448
|
}, /* @__PURE__ */ r.createElement(en, null)), w.image && /* @__PURE__ */ r.createElement("button", {
|
|
449
449
|
"data-command": "insertImage",
|
|
450
450
|
title: "Image",
|
|
451
|
-
onMouseDown:
|
|
451
|
+
onMouseDown: I,
|
|
452
452
|
className: x.image ? "rte-active" : ""
|
|
453
453
|
}, /* @__PURE__ */ r.createElement(Ft, null)), /* @__PURE__ */ r.createElement("input", {
|
|
454
454
|
type: "file",
|
|
@@ -477,8 +477,8 @@ const tn = [
|
|
|
477
477
|
}, /* @__PURE__ */ r.createElement(Xt, null)), A && /* @__PURE__ */ At(/* @__PURE__ */ r.createElement("div", {
|
|
478
478
|
className: "rte-emoji-popup",
|
|
479
479
|
style: {
|
|
480
|
-
top:
|
|
481
|
-
left:
|
|
480
|
+
top: F.y,
|
|
481
|
+
left: F.x
|
|
482
482
|
}
|
|
483
483
|
}, tn.map((g, y) => /* @__PURE__ */ r.createElement("span", {
|
|
484
484
|
key: y,
|
|
@@ -504,7 +504,7 @@ const tn = [
|
|
|
504
504
|
display: "flex",
|
|
505
505
|
alignItems: "center",
|
|
506
506
|
justifyContent: "center",
|
|
507
|
-
color: ((
|
|
507
|
+
color: ((B = $.current) == null ? void 0 : B.value) || "#000",
|
|
508
508
|
fontSize: "18px"
|
|
509
509
|
},
|
|
510
510
|
className: x.color ? "rte-active" : ""
|
|
@@ -588,7 +588,7 @@ const tn = [
|
|
|
588
588
|
fontSize: "medium"
|
|
589
589
|
}
|
|
590
590
|
}, /* @__PURE__ */ r.createElement(Gt, null)), w.fontFamily && /* @__PURE__ */ r.createElement("select", {
|
|
591
|
-
ref:
|
|
591
|
+
ref: q,
|
|
592
592
|
className: "rte-dropdown",
|
|
593
593
|
defaultValue: "",
|
|
594
594
|
onMouseDown: () => d(),
|
|
@@ -670,13 +670,13 @@ const tn = [
|
|
|
670
670
|
const $ = S.toLowerCase(), b = L.toLowerCase(), A = $.indexOf(b);
|
|
671
671
|
let _ = S;
|
|
672
672
|
if (A !== -1 && L.length > 0) {
|
|
673
|
-
const
|
|
674
|
-
_ = S.substring(0, A) + `<span class="rte-highlight">${S.substring(A,
|
|
673
|
+
const F = A + L.length;
|
|
674
|
+
_ = S.substring(0, A) + `<span class="rte-highlight">${S.substring(A, F)}</span>` + S.substring(F);
|
|
675
675
|
}
|
|
676
676
|
return /* @__PURE__ */ r.createElement("li", {
|
|
677
677
|
key: R,
|
|
678
|
-
onMouseDown: (
|
|
679
|
-
|
|
678
|
+
onMouseDown: (F) => {
|
|
679
|
+
F.preventDefault(), h({
|
|
680
680
|
name: S,
|
|
681
681
|
value: R
|
|
682
682
|
});
|
|
@@ -819,14 +819,14 @@ const ln = ({
|
|
|
819
819
|
}, S = (b) => b === "rgb(0, 0, 0)" || b === "rgba(0, 0, 0, 1)" || b === "#000" || b === "#000000" || b === "black", R = (b) => {
|
|
820
820
|
const A = document.createElement("div");
|
|
821
821
|
A.innerHTML = b;
|
|
822
|
-
const _ = document.createTreeWalker(A, NodeFilter.SHOW_TEXT, null),
|
|
822
|
+
const _ = document.createTreeWalker(A, NodeFilter.SHOW_TEXT, null), F = [];
|
|
823
823
|
for (; _.nextNode(); ) {
|
|
824
824
|
const O = _.currentNode;
|
|
825
|
-
O.nodeValue && /{{\s*[\s\S]*?\s*}}/.test(O.nodeValue) &&
|
|
825
|
+
O.nodeValue && /{{\s*[\s\S]*?\s*}}/.test(O.nodeValue) && F.push(O);
|
|
826
826
|
}
|
|
827
|
-
return
|
|
827
|
+
return F.forEach((O) => {
|
|
828
828
|
var j;
|
|
829
|
-
const
|
|
829
|
+
const I = O.nodeValue || "", K = O.parentElement;
|
|
830
830
|
if (!K) return;
|
|
831
831
|
let W = K, x = !1;
|
|
832
832
|
for (; W; ) {
|
|
@@ -834,8 +834,8 @@ const ln = ({
|
|
|
834
834
|
x = !0;
|
|
835
835
|
break;
|
|
836
836
|
}
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
837
|
+
const B = (j = W.style) == null ? void 0 : j.color;
|
|
838
|
+
if (B && !S(B)) {
|
|
839
839
|
x = !0;
|
|
840
840
|
break;
|
|
841
841
|
}
|
|
@@ -847,16 +847,16 @@ const ln = ({
|
|
|
847
847
|
W = W.parentElement;
|
|
848
848
|
}
|
|
849
849
|
const D = document.createDocumentFragment();
|
|
850
|
-
let
|
|
851
|
-
|
|
852
|
-
if (g >
|
|
853
|
-
D.appendChild(document.createTextNode(
|
|
850
|
+
let q = 0;
|
|
851
|
+
I.replace(/{{\s*([\s\S]*?)\s*}}/g, (B, Y, g) => {
|
|
852
|
+
if (g > q && D.appendChild(document.createTextNode(I.slice(q, g))), x)
|
|
853
|
+
D.appendChild(document.createTextNode(B));
|
|
854
854
|
else {
|
|
855
855
|
const y = document.createElement("span");
|
|
856
|
-
y.style.color = "blue", y.textContent =
|
|
856
|
+
y.style.color = "blue", y.textContent = B, D.appendChild(y);
|
|
857
857
|
}
|
|
858
|
-
return
|
|
859
|
-
}),
|
|
858
|
+
return q = g + B.length, B;
|
|
859
|
+
}), q < I.length && D.appendChild(document.createTextNode(I.slice(q))), K.replaceChild(D, O);
|
|
860
860
|
}), A.innerHTML = A.innerHTML.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""), A.innerHTML;
|
|
861
861
|
}, N = () => (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
862
862
|
month: "short",
|
|
@@ -963,10 +963,13 @@ const ln = ({
|
|
|
963
963
|
className: "rte-attr-name"
|
|
964
964
|
}, `{{${b}}}`), /* @__PURE__ */ r.createElement("span", null, " : "), /* @__PURE__ */ r.createElement("input", {
|
|
965
965
|
className: "rte-attr-input",
|
|
966
|
-
value: h[b],
|
|
967
|
-
onChange: (A) =>
|
|
968
|
-
|
|
969
|
-
|
|
966
|
+
value: h[b] || "",
|
|
967
|
+
onChange: (A) => {
|
|
968
|
+
const _ = A.target.value;
|
|
969
|
+
v((F) => ae(re({}, F), {
|
|
970
|
+
[b]: _
|
|
971
|
+
}));
|
|
972
|
+
},
|
|
970
973
|
placeholder: "Enter value"
|
|
971
974
|
}))))));
|
|
972
975
|
}, on = ({
|
|
@@ -1070,10 +1073,10 @@ const un = ({
|
|
|
1070
1073
|
}
|
|
1071
1074
|
}) => {
|
|
1072
1075
|
var xe, Se, Re, Ne, Me, Ae, Te, ke, ze, De, He, Oe;
|
|
1073
|
-
const N = Z(null), [$, b] = H(w != null && w.length ? w : " "), [A, _] = H(""), [
|
|
1076
|
+
const N = Z(null), [$, b] = H(w != null && w.length ? w : " "), [A, _] = H(""), [F, O] = H(!1), [I, K] = H({
|
|
1074
1077
|
x: 0,
|
|
1075
1078
|
y: 0
|
|
1076
|
-
}), [W, x] = H([]), D = Z(null),
|
|
1079
|
+
}), [W, x] = H([]), D = Z(null), q = Z(null), [j, B] = H({
|
|
1077
1080
|
visible: !1,
|
|
1078
1081
|
x: 0,
|
|
1079
1082
|
y: 0
|
|
@@ -1103,7 +1106,7 @@ const un = ({
|
|
|
1103
1106
|
}, [de, ee] = H(""), [oe, ue] = H([]), [fe, pe] = H({}), V = () => N.current, M = () => {
|
|
1104
1107
|
const e = We(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
|
|
1105
1108
|
let n = e;
|
|
1106
|
-
t || (n = `<div style="font-size:12px">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (i, p, E) => {
|
|
1109
|
+
t || (n = `<div style="font-size: 12px; color: #4f5055;">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (i, p, E) => {
|
|
1107
1110
|
if (/list-type=["']static["']/.test(E) || i.includes("data-hidden-array-start") || i.includes("data-hidden-array-end")) return i;
|
|
1108
1111
|
const m = `<${p}${E}>`, s = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', f = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', C = `</${p}>`, T = i.replace(new RegExp(`^${m}`), "").replace(new RegExp(`${C}$`), "");
|
|
1109
1112
|
return `${m}${s}${T}${f}${C}`;
|
|
@@ -1191,7 +1194,7 @@ const un = ({
|
|
|
1191
1194
|
t.remove(), K({
|
|
1192
1195
|
x: n.left,
|
|
1193
1196
|
y: n.bottom + window.scrollY
|
|
1194
|
-
}), x(a || []), O(!0),
|
|
1197
|
+
}), x(a || []), O(!0), q.current = e.cloneRange();
|
|
1195
1198
|
}, Ye = () => {
|
|
1196
1199
|
const e = window.getSelection();
|
|
1197
1200
|
if (!e || e.rangeCount === 0) return null;
|
|
@@ -1215,7 +1218,7 @@ const un = ({
|
|
|
1215
1218
|
const t = window.getSelection();
|
|
1216
1219
|
if (!t) return;
|
|
1217
1220
|
const n = Ye();
|
|
1218
|
-
n ? (t.removeAllRanges(), t.addRange(n)) :
|
|
1221
|
+
n ? (t.removeAllRanges(), t.addRange(n)) : q.current && (t.removeAllRanges(), t.addRange(q.current));
|
|
1219
1222
|
const l = document.createElement("span");
|
|
1220
1223
|
l.textContent = `{{${e.name}}}`, l.style.display = "inline", l.setAttribute("data-mention", e.value || e.name || ""), l.title = `{{${e.name}}}`;
|
|
1221
1224
|
try {
|
|
@@ -1315,7 +1318,7 @@ const un = ({
|
|
|
1315
1318
|
}, 0);
|
|
1316
1319
|
return;
|
|
1317
1320
|
}
|
|
1318
|
-
if (
|
|
1321
|
+
if (F) {
|
|
1319
1322
|
setTimeout(() => ye(), 0);
|
|
1320
1323
|
return;
|
|
1321
1324
|
}
|
|
@@ -1481,7 +1484,7 @@ const un = ({
|
|
|
1481
1484
|
};
|
|
1482
1485
|
}, ot = (e) => {
|
|
1483
1486
|
const n = e.target.closest("td, th");
|
|
1484
|
-
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((l) => l.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"),
|
|
1487
|
+
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((l) => l.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), B({
|
|
1485
1488
|
visible: !0,
|
|
1486
1489
|
x: e.clientX,
|
|
1487
1490
|
y: e.clientY,
|
|
@@ -1533,7 +1536,7 @@ const un = ({
|
|
|
1533
1536
|
});
|
|
1534
1537
|
break;
|
|
1535
1538
|
}
|
|
1536
|
-
M(),
|
|
1539
|
+
M(), B(ae(re({}, j), {
|
|
1537
1540
|
visible: !1
|
|
1538
1541
|
})), Ce();
|
|
1539
1542
|
}, ct = () => {
|
|
@@ -1745,7 +1748,7 @@ const un = ({
|
|
|
1745
1748
|
y: c.bottom + window.scrollY
|
|
1746
1749
|
}), ee(n.toLowerCase());
|
|
1747
1750
|
const o = a.filter((i) => i.name.toLowerCase().includes(n.toLowerCase()));
|
|
1748
|
-
x(o), O(!0),
|
|
1751
|
+
x(o), O(!0), q.current = t.cloneRange();
|
|
1749
1752
|
};
|
|
1750
1753
|
function wt() {
|
|
1751
1754
|
const e = N.current;
|
|
@@ -1826,8 +1829,8 @@ const un = ({
|
|
|
1826
1829
|
},
|
|
1827
1830
|
onDoubleClick: yt
|
|
1828
1831
|
}), /* @__PURE__ */ r.createElement(rn, {
|
|
1829
|
-
show:
|
|
1830
|
-
position:
|
|
1832
|
+
show: F,
|
|
1833
|
+
position: I,
|
|
1831
1834
|
filtered: W,
|
|
1832
1835
|
insertMention: Qe,
|
|
1833
1836
|
onClose: () => O(!1),
|
|
@@ -1841,7 +1844,7 @@ const un = ({
|
|
|
1841
1844
|
y: j.y,
|
|
1842
1845
|
onAction: it,
|
|
1843
1846
|
onClose: () => {
|
|
1844
|
-
|
|
1847
|
+
B(ae(re({}, j), {
|
|
1845
1848
|
visible: !1
|
|
1846
1849
|
})), Ce();
|
|
1847
1850
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Ct=Object.defineProperty,Lt=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var De=Object.getOwnPropertySymbols;var xt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var Oe=(a,c,u)=>c in a?Ct(a,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[c]=u,ee=(a,c)=>{for(var u in c||(c={}))xt.call(c,u)&&Oe(a,u,c[u]);if(De)for(var u of De(c))Rt.call(c,u)&&Oe(a,u,c[u]);return a},te=(a,c)=>Lt(a,St(c));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),Nt=require("react-dom");function Mt(a){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(c,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return c.default=a,Object.freeze(c)}const Tt=Mt(n);window.React=Tt;var qe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},He=n.createContext&&n.createContext(qe),At=["attr","size","title"];function kt(a,c){if(a==null)return{};var u=zt(a,c),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(c.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function zt(a,c){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(c.indexOf(m)>=0)continue;u[m]=a[m]}return u}function le(){return le=Object.assign?Object.assign.bind():function(a){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},le.apply(this,arguments)}function Pe(a,c){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function oe(a){for(var c=1;c<arguments.length;c++){var u=arguments[c]!=null?arguments[c]:{};c%2?Pe(Object(u),!0).forEach(function(m){Dt(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):Pe(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Dt(a,c,u){return c=Ot(c),c in a?Object.defineProperty(a,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[c]=u,a}function Ot(a){var c=Ht(a,"string");return typeof c=="symbol"?c:c+""}function Ht(a,c){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,c);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(a)}function Be(a){return a&&a.map((c,u)=>n.createElement(c.tag,oe({key:u},c.attr),Be(c.child)))}function k(a){return c=>n.createElement(Pt,le({attr:oe({},a.attr)},c),Be(a.child))}function Pt(a){var c=u=>{var{attr:m,size:v,title:L}=a,H=kt(a,At),z=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),n.createElement("svg",le({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,H,{className:w,style:oe(oe({color:a.color||u.color},u.style),a.style),height:z,width:z,xmlns:"http://www.w3.org/2000/svg"}),L&&n.createElement("title",null,L),a.children)};return He!==void 0?n.createElement(He.Consumer,null,u=>c(u)):c(qe)}function jt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function _t(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function Ft(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function It(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function qt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Bt(a){return k({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function Vt(a){return k({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function Ut(a){return k({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function $t(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function Wt(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Xt(a){return k({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function Zt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Kt(a){return k({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function Yt(a){return k({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function Qt(a){return k({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function Gt(a){return k({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function Jt(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function en(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const tn=["😀","😁","😂","🤣","😃","😄","😅","😉","😊","😍","😘","😜","😎","😢","😭","😡","🤔","🙄","😇","🥰","🤩","🤗","😴","😋","😬","🤤","😶🌫️","😷","🤕","🤑","🤠","😈","👻","💀","🤖","🐶","🐱","🐼","🐸","🦄","🐷","🐵","🐰","🐯","🦁","🐮","🌞","🌙","⭐","🌈","🔥","💧","❄️","⚡","☀️","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","🥭","🥑","🎉","🎂","🎁","🎈","🎶","🎵","🏆","⚽","🏀","🏸","🏏","🕹️","👋","🤚","🖐️","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","☝️","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","✍️","💅","🤲","👏","🫶","👐"],Ve=({exec:a,saveSelection:c,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:H,removeFormatting:z,visibleActions:w,className:x,style:R})=>{var I,X;const N=n.useRef(null),V=n.useRef(null),b=n.useRef(null),[T,P]=n.useState(!1),[q,O]=n.useState({x:0,y:0});n.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&P(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const _=f=>{var $;f.preventDefault();const y=f.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{($=N.current)==null||$.click();break}default:console.warn("Unknown command:",y)}},W=f=>{a("foreColor",f.target.value)},U=f=>{a("backColor",f.target.value)},[S,D]=n.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),F=n.useRef(null),j=n.useRef(null);return n.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let $=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!$)return;const Y=window.getComputedStyle($),ne=Y.fontFamily.replace(/['"]/g,"").split(",")[0],ie=parseInt(Y.fontSize,10);if(F.current){const Q=Array.from(F.current.options).some(re=>re.value===ne);F.current.value=Q?ne:""}j.current&&(j.current.value=String(ie))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),n.useEffect(()=>{const f=()=>{D({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),n.createElement("div",{className:`rte-toolbar ${x||""}`,style:R},w.bold&&n.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:_,className:S.bold?"rte-active":""},n.createElement(Bt,null)),w.italic&&n.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:_,className:S.italic?"rte-active":""},n.createElement(Ut,null)),w.underline&&n.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:_,className:S.underline?"rte-active":""},n.createElement(Zt,null)),w.unorderedList&&n.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:_,title:"UnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Yt,null)),w.staticUnorderedList&&n.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:_,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Wt,null)),w.orderedList&&n.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:_,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Kt,null)),w.staticOrderedList&&n.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:_,className:S.orderedList?"rte-active":""},n.createElement(It,null)),w.link&&n.createElement("button",{"data-command":"createLink",title:"Link",onClick:H,className:S.link?"rte-active":""},n.createElement($t,null)),w.removeFormat&&n.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),c(),z()},className:S.removeFormat?"rte-active":""},n.createElement(en,null)),w.image&&n.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:_,className:S.image?"rte-active":""},n.createElement(Ft,null)),n.createElement("input",{type:"file",accept:"image/*",ref:N,style:{display:"none"},onChange:u}),w.emoji&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),c();const y=f.currentTarget.getBoundingClientRect();O({x:y.left,y:y.bottom+8}),P($=>!$)},className:S.emoji?"rte-active":""},n.createElement(Xt,null)),T&&Nt.createPortal(n.createElement("div",{className:"rte-emoji-popup",style:{top:q.y,left:q.x}},tn.map((f,y)=>n.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:$=>{$.preventDefault(),L(f),P(!1)}},f))),document.body)),w.color&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=V.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((I=V.current)==null?void 0:I.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},n.createElement(Jt,null)),n.createElement("input",{ref:V,type:"color",defaultValue:"#000000",onChange:f=>{var y;W(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.highlight&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((X=b.current)==null?void 0:X.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},n.createElement(Vt,null)),n.createElement("input",{ref:b,type:"color",onChange:f=>{var y;U(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.align&&n.createElement(n.Fragment,null,n.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},n.createElement(qt,null)),n.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},n.createElement(jt,null)),n.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},n.createElement(_t,null))),w.table&&n.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Qt,null)),w.table&&n.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Gt,null)),w.fontFamily&&n.createElement("select",{ref:F,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:v},n.createElement("option",{value:"",disabled:!0},"Font Family"),n.createElement("option",{value:"Arial"},"Arial"),n.createElement("option",{value:"Georgia"},"Georgia"),n.createElement("option",{value:"Times New Roman"},"Times New Roman"),n.createElement("option",{value:"Courier New"},"Courier New"),n.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&n.createElement("select",{ref:j,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:m},n.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>n.createElement("option",{key:f,value:f},f,"px"))))},nn=({show:a,position:c,filtered:u,insertMention:m,onClose:v,query:L})=>{const H=n.useRef(null),[z,w]=n.useState(0);return n.useEffect(()=>{a&&w(0)},[a]),n.useEffect(()=>{const x=R=>{H.current&&!H.current.contains(R.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),n.useEffect(()=>{if(!a)return;const x=R=>{if(!(!a||u.length===0)&&(R.key==="ArrowDown"&&(R.preventDefault(),w(N=>Math.min(N+1,u.length-1))),R.key==="ArrowUp"&&(R.preventDefault(),w(N=>Math.max(N-1,0))),R.key==="Enter")){R.preventDefault();const N=u[z];N&&m(N)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,z]),n.useEffect(()=>{if(!H.current)return;const R=H.current.querySelectorAll("li")[z];R&&R.scrollIntoView({block:"nearest",behavior:"smooth"})},[z]),a?n.createElement("ul",{ref:H,className:"rte-popup",style:{top:c.y,left:c.x}},u.length>0?u.map(({name:x,value:R},N)=>{const V=x.toLowerCase(),b=L.toLowerCase(),T=V.indexOf(b);let P=x;if(T!==-1&&L.length>0){const q=T+L.length;P=x.substring(0,T)+`<span class="rte-highlight">${x.substring(T,q)}</span>`+x.substring(q)}return n.createElement("li",{key:R,onMouseDown:q=>{q.preventDefault(),m({name:x,value:R})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:N===z?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:P},onMouseEnter:()=>w(N)})}):n.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function je(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function ae(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const rn=({visible:a,x:c,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:c};return n.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},n.createElement("button",{onClick:()=>m("insertRowAbove")},n.createElement(ae,null)," Insert row above"),n.createElement("button",{onClick:()=>m("insertRowBelow")},n.createElement(ae,null)," Insert row below"),n.createElement("button",{onClick:()=>m("insertColLeft")},n.createElement(ae,null)," Insert col left"),n.createElement("button",{onClick:()=>m("insertColRight")},n.createElement(ae,null)," Insert col right"),n.createElement("button",{onClick:()=>m("deleteRow")},n.createElement(je,null)," Delete row"),n.createElement("button",{onClick:()=>m("deleteCol")},n.createElement(je,null)," Delete column"))};function _e(a){return k({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function Fe(a){return k({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ue=({html:a,className:c,style:u,attributes:m,setAttributes:v})=>{const[L,H]=n.useState("web"),z={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},w=b=>{const T=b.target;if(T.tagName==="A"){b.preventDefault();const P=T.href;P&&window.open(P,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",R=b=>{const T=document.createElement("div");T.innerHTML=b;const P=document.createTreeWalker(T,NodeFilter.SHOW_TEXT,null),q=[];for(;P.nextNode();){const O=P.currentNode;O.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(O.nodeValue)&&q.push(O)}return q.forEach(O=>{var j;const _=O.nodeValue||"",W=O.parentElement;if(!W)return;let U=W,S=!1;for(;U;){if(U.tagName==="FONT"&&U.getAttribute("color")){S=!0;break}const I=(j=U.style)==null?void 0:j.color;if(I&&!x(I)){S=!0;break}const X=window.getComputedStyle(U);if(X.color&&!x(X.color)){S=!0;break}U=U.parentElement}const D=document.createDocumentFragment();let F=0;_.replace(/{{\s*([\s\S]*?)\s*}}/g,(I,X,f)=>{if(f>F&&D.appendChild(document.createTextNode(_.slice(F,f))),S)D.appendChild(document.createTextNode(I));else{const y=document.createElement("span");y.style.color="blue",y.textContent=I,D.appendChild(y)}return F=f+I.length,I}),F<_.length&&D.appendChild(document.createTextNode(_.slice(F))),W.replaceChild(D,O)}),T.innerHTML=T.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),T.innerHTML},N=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),V=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return n.createElement("div",{className:`rte-preview ${c||""}`,style:te(ee({},u),{position:"relative"}),onClick:w},n.createElement("div",{className:"rte-preview-device-picker"},n.createElement("select",{value:L,onChange:b=>H(b.target.value)},Object.entries(z).map(([b,T])=>n.createElement("option",{key:b,value:b},T.label)))),L==="web"&&n.createElement("div",{className:"rte-preview-web-wrapper"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&n.createElement("div",{className:"rte-preview-mobile-overlay"},n.createElement("div",{className:"rte-preview-mobile-frame",style:{width:z[L].width,height:z[L].height}},n.createElement("div",{className:"rte-preview-mobile-header"},n.createElement("div",{className:"rte-preview-logo"},"A"),n.createElement("div",{className:"rte-preview-bell"},"🔔",n.createElement("span",{className:"rte-preview-badge"},"99+"))),n.createElement("div",{className:"rte-preview-tabs-wrapper"},n.createElement("div",{className:"rte-preview-tabs"},n.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),n.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),n.createElement("div",{className:"rte-preview-mobile-body"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",N()),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},V())))))),n.createElement("div",null,n.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),n.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>n.createElement("div",{key:b,className:"rte-attr-row"},n.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),n.createElement("span",null," : "),n.createElement("input",{className:"rte-attr-input",value:m[b],onChange:T=>v(P=>te(ee({},P),{[b]:T.target.value})),placeholder:"Enter value"}))))))},an=({visible:a,linkData:c,onClose:u,onInsert:m})=>{const[v,L]=n.useState(""),[H,z]=n.useState(""),[w,x]=n.useState(""),[R,N]=n.useState("_self");if(n.useEffect(()=>{a?(L(c.url||""),z(c.text||""),x(c.title||""),N(c.target||"_self")):(L(""),z(""),x(""),N("_self"))},[a,c]),!a)return null;const V=()=>{m({url:v,text:H,title:w,target:R})};return n.createElement(n.Fragment,null,n.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),n.createElement("div",{className:"rte-link-modal"},n.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:H,onChange:b=>z(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),n.createElement("select",{className:"rte-link-modal__select",value:R,onChange:b=>N(b.target.value)},n.createElement("option",{value:"_self"},"Same tab"),n.createElement("option",{value:"_blank"},"New tab")),n.createElement("div",{className:"rte-link-modal__actions"},n.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),n.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:V},"OK"))))};function Ie(a){const c=new Map;return a.forEach(u=>{c.set(u.name,u.value)}),Array.from(c.entries()).map(([u,m])=>({name:u,value:m}))}const ln=({atSuggestions:a=[],showOutput:c=!1,showPreview:u=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:L={},handleGetHtml:H=()=>{},onChange:z=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:R=()=>{}})=>{var be,Ce,Le,Se,xe,Re,Ne,Me,Te,Ae,ke,ze;const N=n.useRef(null),[V,b]=n.useState(w!=null&&w.length?w:" "),[T,P]=n.useState(""),[q,O]=n.useState(!1),[_,W]=n.useState({x:0,y:0}),[U,S]=n.useState([]),D=n.useRef(null),F=n.useRef(null),[j,I]=n.useState({visible:!1,x:0,y:0}),[X,f]=n.useState(!1),y=n.useRef(null),[$,Y]=n.useState({url:"",text:"",title:"",target:"_self"}),ne={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(be=m.unorderedList)!=null?be:!0,orderedList:(Ce=m.orderedList)!=null?Ce:!0,staticUnorderedList:(Le=m.staticUnorderedList)!=null?Le:!0,staticOrderedList:(Se=m.staticOrderedList)!=null?Se:!0,align:!0,link:(xe=m.link)!=null?xe:!1,image:(Re=m.image)!=null?Re:!1,emoji:(Ne=m.emoji)!=null?Ne:!1,table:(Me=m.table)!=null?Me:!1,color:(Te=m.color)!=null?Te:!1,fontFamily:(Ae=m.fontFamily)!=null?Ae:!1,fontSize:(ke=m.fontSize)!=null?ke:!1,highlight:(ze=m.fontSize)!=null?ze:!1},[ie,Q]=n.useState(""),[re,ce]=n.useState([]),[me,he]=n.useState({}),B=()=>N.current,M=()=>{const e=$e(),t=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());let r=e;t||(r=`<div style="font-size:12px">${e}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(i,p,E)=>{if(/list-type=["']static["']/.test(E)||i.includes("data-hidden-array-start")||i.includes("data-hidden-array-end"))return i;const h=`<${p}${E}>`,d='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',g='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',C=`</${p}>`,A=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${d}${A}${g}${C}`}),P(r),H==null||H(r);const l=ut(e);z(l);const s=Je(),o=Ie(s);JSON.stringify(o)!==JSON.stringify(re)&&(ce(o),x(o),yt(o))},$e=()=>{const e=B();if(!e)return V;const t=e.cloneNode(!0);t.querySelectorAll("table div").forEach(l=>l.remove()),t.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),t.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=t.innerHTML;return r=We(r),r},We=e=>{const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),t.innerHTML},Z=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=document.getElementById("rte-editor-body");if(!t)return;const r=e.getRangeAt(0);t.contains(r.startContainer)&&(D.current=r.cloneRange())},K=()=>{const e=window.getSelection();!e||!D.current||(e.removeAllRanges(),e.addRange(D.current))},fe=(e,t)=>{const r=window.getSelection();r&&r.rangeCount>0&&(D.current=r.getRangeAt(0)),K(),document.execCommand(e,!1,t),M()};n.useEffect(()=>{const e=B();if(!e||!w)return;const t=Xe(w);e.innerHTML=t,M()},[]);const Xe=e=>e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,t=>t.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));n.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),n.useEffect(()=>{R&&R(e=>{Ge(e)})},[]),n.useEffect(()=>{const e=B();if(!e)return;e.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(ue(r),r.querySelectorAll("th, td").forEach(s=>G(s)))})},[]);const ge=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},pe=(e,t)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=ge(l.startContainer);let o,i;const p=t==="insertStaticUnorderedList"||t==="insertStaticOrderedList";if(s){let d=s.querySelector(e);d||(d=document.createElement(e),d.style.margin="0",d.style.paddingLeft="20px",s.appendChild(d)),i=d,o=document.createElement("li"),o.textContent="",i.appendChild(o)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const d=B();if(i=d==null?void 0:d.querySelector(`${e}:last-child`),!i)return;p&&i.setAttribute("list-type","static"),o=i.querySelector("li:last-child")}const E=document.createRange();E.setStart(o,0),E.collapse(!0),r.removeAllRanges(),r.addRange(E),(h=B())==null||h.focus(),M()},se=(e,t)=>{e==="insertOrderedList"||e==="insertStaticOrderedList"?pe("ol",e):e==="insertUnorderedList"||e==="insertStaticUnorderedList"?pe("ul",e):e.startsWith("justify")?ht(e):fe(e,t),e==="insertTable"&&Ee(),e==="insertStaticTable"&&Ee("insertStaticTable")},Ze=e=>{const t=document.createElement("span");t.textContent="",e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const r=t.getBoundingClientRect();t.remove(),W({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),O(!0),F.current=e.cloneRange()},Ke=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.anchorNode;let r=e.anchorOffset;if(!t)return null;let l=t;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=t.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===t?r:s.length,i=s.lastIndexOf("@",o-1);if(i!==-1){const p=document.createRange();return p.setStart(l,i),p.setEnd(l,o),p}}l=l.previousSibling}return null},Ye=e=>{var o;const t=window.getSelection();if(!t)return;const r=Ke();r?(t.removeAllRanges(),t.addRange(r)):F.current&&(t.removeAllRanges(),t.addRange(F.current));const l=document.createElement("span");l.textContent=`{{${e.name}}}`,l.style.display="inline",l.setAttribute("data-mention",e.value||e.name||""),l.title=`{{${e.name}}}`;try{const i=t.rangeCount?t.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),d=B();h.selectNodeContents(d),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),t.removeAllRanges(),t.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Ie([...re,e]);ce(s),x(s),O(!1),(o=B())==null||o.focus(),M()},Qe=e=>{const t=B();if(!t)return;let r=null;D.current&&t.contains(D.current.startContainer)?r=D.current.cloneRange():(r=document.createRange(),r.selectNodeContents(t),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${e.name}}}`,s.style.display="inline",s.setAttribute("data-mention",e.value||e.name),s.title=`{{${e.name}}}`,r.insertNode(s);const o=document.createTextNode(" ");s.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),l.removeAllRanges(),l.addRange(i),D.current=i.cloneRange(),t.focus()},Ge=e=>{e.forEach(t=>Qe(t)),ce(t=>{const r=[...t,...e],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),M()},Je=()=>{const e=B();if(!e)return[];const t=e.querySelectorAll("span[data-mention]"),r=[];return t.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},et=e=>{var r,l,s;const t=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t)&&(e.preventDefault(),se(t==="b"?"bold":t==="i"?"italic":t==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?ge(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){e.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const d=document.createElement("p");d.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(d,h.nextSibling);const g=document.createRange();g.setStart(d,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const d=i.closest("ul, ol");if(d){const g=document.createElement("p");g.innerHTML="<br />",(s=d.parentElement)==null||s.insertBefore(g,d.nextSibling),d.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}M()}}if(t==="backspace"||t==="delete"){const o=window.getSelection();if(!o||o.rangeCount===0)return;const i=o.getRangeAt(0);if(i.cloneContents().querySelector("table"))return;if(i.cloneContents().querySelectorAll(".rte-resize-handle").length>0){e.preventDefault(),e.stopPropagation();return}}},tt=e=>{if(e.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(de(l))return;setTimeout(()=>{Ze(r.getRangeAt(0)),Q(""),S(a),O(!0)},0);return}if(q){setTimeout(()=>ve(),0);return}},de=e=>{if(!e)return!1;let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){if(t.tagName==="TH")return!0;t=t.parentElement}return!1},ve=()=>{M();const e=window.getSelection();if(!e||!e.anchorNode)return;if(de(e.anchorNode)){O(!1);return}let t=e.anchorNode.textContent||"";t=t.replace(/\u00A0/g," ");const r=t.match(/@([^\n]*)$/);if(!r){O(!1);return}const l=r[1].trim().toLowerCase();Q(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),O(!0)):O(!1)},nt=e=>{var l;const t=(l=e.target.files)==null?void 0:l[0];if(!t)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;K();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=t.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=B();if(!p||!h){h==null||h.appendChild(E);const A=document.createTextNode(" ");h==null||h.appendChild(A);const J=document.createRange();J.setStartAfter(A),J.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(J),h==null||h.focus(),M(),e.target.value="";return}p.deleteContents(),p.insertNode(E);const d=document.createTextNode(" ");E.after(d);const g=document.createRange();g.setStartAfter(d),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),M(),e.target.value=""},r.readAsDataURL(t)},rt=e=>{var s;K();const t=window.getSelection();if(!(t!=null&&t.rangeCount))return;const r=t.getRangeAt(0),l=document.createTextNode(e);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),t.removeAllRanges(),t.addRange(r),(s=B())==null||s.focus(),M()},Ee=e=>{var d;Et(),K();const t=document.createElement("table");t.style.borderCollapse="collapse",t.style.width="310px",t.style.border="1px solid #ccc",t.style.margin="8px 0",t.style.position="relative",t.style.textAlign="center",v.table&&t.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),e==="insertStaticTable"&&l.setAttribute("table-type","static");const s=document.createElement("tr");v.tr&&s.classList.add(v.tr);const o=document.createElement("tr");v.tr&&o.classList.add(v.tr);for(let g=0;g<2;g++){const C=document.createElement("th");C.textContent="",C.style.border="1px solid #999",C.style.padding="4px",C.style.position="relative",C.style.backgroundColor="lightgray",C.style.height="20px",v.th&&C.classList.add(v.th);const A=document.createElement("td");A.textContent="",A.style.border="1px solid #999",A.style.padding="4px",A.style.position="relative",A.style.backgroundColor="#fff",A.style.minHeight="20px",A.style.height="20px",A.style.whiteSpace="normal",A.style.wordBreak="break-word",A.style.overflowWrap="anywhere",A.style.lineHeight="20px",A.style.minWidth="20px",v.td&&A.classList.add(v.td),G(C),G(A),s.appendChild(C),o.appendChild(A)}r.appendChild(s),l.appendChild(o),t.appendChild(r),t.appendChild(l),ue(t);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(t);const E=document.createElement("p");E.innerHTML="<br/>",t.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(d=B())==null||d.focus(),M()},ue=e=>{if(e.dataset.hasResizeHandle==="true")return;const t=document.createElement("div");Object.assign(t.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),t.contentEditable="false",t.dataset.hasResizeHandle="true",t.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;t.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=e.getBoundingClientRect();s=p.width,o=p.height;const E=d=>{const g=Math.max(100,s+(d.clientX-r)),C=Math.max(20,o+(d.clientY-l));e.style.width=`${g}px`,e.style.height=`${C}px`,M()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),e.appendChild(t)},G=e=>{const t=document.createElement("div"),r=document.createElement("div");Object.assign(t.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),t.contentEditable="false",t.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),at(e,t,r),e.appendChild(t),e.appendChild(r)},at=(e,t,r)=>{let l=0,s=0,o=0,i=0;t.addEventListener("mousedown",d=>{d.preventDefault(),l=d.clientX,o=e.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",d=>{d.preventDefault(),s=d.clientY,i=e.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=d=>{const g=o+(d.clientX-l);e.style.width=`${Math.max(30,g)}px`,M()},E=d=>{const g=i+(d.clientY-s);e.style.height=`${Math.max(20,g)}px`,M()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()}},lt=e=>{const r=e.target.closest("td, th");r&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),I({visible:!0,x:e.clientX,y:e.clientY,cell:r}))},we=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},ot=e=>{if(!j.cell)return;const t=j.cell.closest("table"),r=j.cell.cellIndex,l=j.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,G(p),p};switch(e){case"insertRowAbove":{const o=t.rows[l],i=t.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=t.rows[l],i=t.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":t.rows.length>1&&t.deleteRow(l);break;case"deleteCol":Array.from(t.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}M(),I(te(ee({},j),{visible:!1})),we()},it=()=>{Z(),y.current=D.current,Y({url:"",text:"",title:"",target:"_self"}),f(!0)},ct=e=>{const t=window.getSelection();if(!t||!y.current)return;t.removeAllRanges(),t.addRange(y.current);let r=e.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=e.text||r,l.title=e.title,l.target=e.target,l.contentEditable="true";const s=t.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),t.removeAllRanges(),t.addRange(i),f(!1),M()},st=e=>{const t=e.target;if(t.tagName==="A"){const r=t;if(e.ctrlKey||e.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,Y({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},dt=()=>{const e=B();if(!e)return;const t=window.getSelection();if((!t||t.rangeCount===0)&&D.current){const d=window.getSelection();d==null||d.removeAllRanges(),d==null||d.addRange(D.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);K(),document.execCommand("removeFormat",!1);const s=l.cloneContents(),o=document.createElement("div");o.appendChild(s);const i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,null),p=[];for(;i.nextNode();){const d=i.currentNode,g=d.tagName.toUpperCase(),C=d.getAttribute&&d.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(d)}for(let d=p.length-1;d>=0;d--){const g=p[d],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(d=>d.removeAttribute("style")),l.deleteContents();const E=document.createDocumentFragment();for(;o.firstChild;)E.appendChild(o.firstChild);l.insertNode(E);const h=document.createRange();h.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),h.collapse(!0),r.removeAllRanges(),r.addRange(h),e.normalize(),M()},ut=e=>{var l;let t=e;t=t.replace(/{{#arrayData\d*}}/g,""),t=t.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=t,r.querySelectorAll("br").forEach(s=>{s.replaceWith(`
|
|
1
|
+
"use strict";var Ct=Object.defineProperty,Lt=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var De=Object.getOwnPropertySymbols;var xt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var Oe=(a,c,u)=>c in a?Ct(a,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[c]=u,ee=(a,c)=>{for(var u in c||(c={}))xt.call(c,u)&&Oe(a,u,c[u]);if(De)for(var u of De(c))Rt.call(c,u)&&Oe(a,u,c[u]);return a},te=(a,c)=>Lt(a,St(c));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),Nt=require("react-dom");function Mt(a){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(c,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return c.default=a,Object.freeze(c)}const Tt=Mt(n);window.React=Tt;var qe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},He=n.createContext&&n.createContext(qe),At=["attr","size","title"];function kt(a,c){if(a==null)return{};var u=zt(a,c),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(c.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function zt(a,c){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(c.indexOf(m)>=0)continue;u[m]=a[m]}return u}function le(){return le=Object.assign?Object.assign.bind():function(a){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},le.apply(this,arguments)}function Pe(a,c){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function oe(a){for(var c=1;c<arguments.length;c++){var u=arguments[c]!=null?arguments[c]:{};c%2?Pe(Object(u),!0).forEach(function(m){Dt(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):Pe(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Dt(a,c,u){return c=Ot(c),c in a?Object.defineProperty(a,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[c]=u,a}function Ot(a){var c=Ht(a,"string");return typeof c=="symbol"?c:c+""}function Ht(a,c){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,c);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(a)}function Be(a){return a&&a.map((c,u)=>n.createElement(c.tag,oe({key:u},c.attr),Be(c.child)))}function k(a){return c=>n.createElement(Pt,le({attr:oe({},a.attr)},c),Be(a.child))}function Pt(a){var c=u=>{var{attr:m,size:v,title:L}=a,H=kt(a,At),z=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),n.createElement("svg",le({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,H,{className:w,style:oe(oe({color:a.color||u.color},u.style),a.style),height:z,width:z,xmlns:"http://www.w3.org/2000/svg"}),L&&n.createElement("title",null,L),a.children)};return He!==void 0?n.createElement(He.Consumer,null,u=>c(u)):c(qe)}function jt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function _t(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function Ft(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function It(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function qt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Bt(a){return k({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function Vt(a){return k({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function Ut(a){return k({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function $t(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function Wt(a){return k({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Xt(a){return k({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function Zt(a){return k({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function Kt(a){return k({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function Yt(a){return k({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function Qt(a){return k({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function Gt(a){return k({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function Jt(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function en(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const tn=["😀","😁","😂","🤣","😃","😄","😅","😉","😊","😍","😘","😜","😎","😢","😭","😡","🤔","🙄","😇","🥰","🤩","🤗","😴","😋","😬","🤤","😶🌫️","😷","🤕","🤑","🤠","😈","👻","💀","🤖","🐶","🐱","🐼","🐸","🦄","🐷","🐵","🐰","🐯","🦁","🐮","🌞","🌙","⭐","🌈","🔥","💧","❄️","⚡","☀️","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","🥭","🥑","🎉","🎂","🎁","🎈","🎶","🎵","🏆","⚽","🏀","🏸","🏏","🕹️","👋","🤚","🖐️","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","☝️","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","✍️","💅","🤲","👏","🫶","👐"],Ve=({exec:a,saveSelection:c,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:H,removeFormatting:z,visibleActions:w,className:x,style:R})=>{var q,X;const N=n.useRef(null),V=n.useRef(null),b=n.useRef(null),[T,P]=n.useState(!1),[_,O]=n.useState({x:0,y:0});n.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&P(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const F=f=>{var $;f.preventDefault();const y=f.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{($=N.current)==null||$.click();break}default:console.warn("Unknown command:",y)}},W=f=>{a("foreColor",f.target.value)},U=f=>{a("backColor",f.target.value)},[S,D]=n.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),I=n.useRef(null),j=n.useRef(null);return n.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let $=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!$)return;const Y=window.getComputedStyle($),ne=Y.fontFamily.replace(/['"]/g,"").split(",")[0],ie=parseInt(Y.fontSize,10);if(I.current){const Q=Array.from(I.current.options).some(re=>re.value===ne);I.current.value=Q?ne:""}j.current&&(j.current.value=String(ie))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),n.useEffect(()=>{const f=()=>{D({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),n.createElement("div",{className:`rte-toolbar ${x||""}`,style:R},w.bold&&n.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:F,className:S.bold?"rte-active":""},n.createElement(Bt,null)),w.italic&&n.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:F,className:S.italic?"rte-active":""},n.createElement(Ut,null)),w.underline&&n.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:F,className:S.underline?"rte-active":""},n.createElement(Zt,null)),w.unorderedList&&n.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:F,title:"UnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Yt,null)),w.staticUnorderedList&&n.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:F,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Wt,null)),w.orderedList&&n.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:F,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Kt,null)),w.staticOrderedList&&n.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:F,className:S.orderedList?"rte-active":""},n.createElement(It,null)),w.link&&n.createElement("button",{"data-command":"createLink",title:"Link",onClick:H,className:S.link?"rte-active":""},n.createElement($t,null)),w.removeFormat&&n.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),c(),z()},className:S.removeFormat?"rte-active":""},n.createElement(en,null)),w.image&&n.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:F,className:S.image?"rte-active":""},n.createElement(Ft,null)),n.createElement("input",{type:"file",accept:"image/*",ref:N,style:{display:"none"},onChange:u}),w.emoji&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),c();const y=f.currentTarget.getBoundingClientRect();O({x:y.left,y:y.bottom+8}),P($=>!$)},className:S.emoji?"rte-active":""},n.createElement(Xt,null)),T&&Nt.createPortal(n.createElement("div",{className:"rte-emoji-popup",style:{top:_.y,left:_.x}},tn.map((f,y)=>n.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:$=>{$.preventDefault(),L(f),P(!1)}},f))),document.body)),w.color&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=V.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((q=V.current)==null?void 0:q.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},n.createElement(Jt,null)),n.createElement("input",{ref:V,type:"color",defaultValue:"#000000",onChange:f=>{var y;W(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.highlight&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((X=b.current)==null?void 0:X.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},n.createElement(Vt,null)),n.createElement("input",{ref:b,type:"color",onChange:f=>{var y;U(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.align&&n.createElement(n.Fragment,null,n.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},n.createElement(qt,null)),n.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},n.createElement(jt,null)),n.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},n.createElement(_t,null))),w.table&&n.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Qt,null)),w.table&&n.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Gt,null)),w.fontFamily&&n.createElement("select",{ref:I,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:v},n.createElement("option",{value:"",disabled:!0},"Font Family"),n.createElement("option",{value:"Arial"},"Arial"),n.createElement("option",{value:"Georgia"},"Georgia"),n.createElement("option",{value:"Times New Roman"},"Times New Roman"),n.createElement("option",{value:"Courier New"},"Courier New"),n.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&n.createElement("select",{ref:j,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:m},n.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>n.createElement("option",{key:f,value:f},f,"px"))))},nn=({show:a,position:c,filtered:u,insertMention:m,onClose:v,query:L})=>{const H=n.useRef(null),[z,w]=n.useState(0);return n.useEffect(()=>{a&&w(0)},[a]),n.useEffect(()=>{const x=R=>{H.current&&!H.current.contains(R.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),n.useEffect(()=>{if(!a)return;const x=R=>{if(!(!a||u.length===0)&&(R.key==="ArrowDown"&&(R.preventDefault(),w(N=>Math.min(N+1,u.length-1))),R.key==="ArrowUp"&&(R.preventDefault(),w(N=>Math.max(N-1,0))),R.key==="Enter")){R.preventDefault();const N=u[z];N&&m(N)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,z]),n.useEffect(()=>{if(!H.current)return;const R=H.current.querySelectorAll("li")[z];R&&R.scrollIntoView({block:"nearest",behavior:"smooth"})},[z]),a?n.createElement("ul",{ref:H,className:"rte-popup",style:{top:c.y,left:c.x}},u.length>0?u.map(({name:x,value:R},N)=>{const V=x.toLowerCase(),b=L.toLowerCase(),T=V.indexOf(b);let P=x;if(T!==-1&&L.length>0){const _=T+L.length;P=x.substring(0,T)+`<span class="rte-highlight">${x.substring(T,_)}</span>`+x.substring(_)}return n.createElement("li",{key:R,onMouseDown:_=>{_.preventDefault(),m({name:x,value:R})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:N===z?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:P},onMouseEnter:()=>w(N)})}):n.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function je(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function ae(a){return k({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const rn=({visible:a,x:c,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:c};return n.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},n.createElement("button",{onClick:()=>m("insertRowAbove")},n.createElement(ae,null)," Insert row above"),n.createElement("button",{onClick:()=>m("insertRowBelow")},n.createElement(ae,null)," Insert row below"),n.createElement("button",{onClick:()=>m("insertColLeft")},n.createElement(ae,null)," Insert col left"),n.createElement("button",{onClick:()=>m("insertColRight")},n.createElement(ae,null)," Insert col right"),n.createElement("button",{onClick:()=>m("deleteRow")},n.createElement(je,null)," Delete row"),n.createElement("button",{onClick:()=>m("deleteCol")},n.createElement(je,null)," Delete column"))};function _e(a){return k({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function Fe(a){return k({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ue=({html:a,className:c,style:u,attributes:m,setAttributes:v})=>{const[L,H]=n.useState("web"),z={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},w=b=>{const T=b.target;if(T.tagName==="A"){b.preventDefault();const P=T.href;P&&window.open(P,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",R=b=>{const T=document.createElement("div");T.innerHTML=b;const P=document.createTreeWalker(T,NodeFilter.SHOW_TEXT,null),_=[];for(;P.nextNode();){const O=P.currentNode;O.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(O.nodeValue)&&_.push(O)}return _.forEach(O=>{var j;const F=O.nodeValue||"",W=O.parentElement;if(!W)return;let U=W,S=!1;for(;U;){if(U.tagName==="FONT"&&U.getAttribute("color")){S=!0;break}const q=(j=U.style)==null?void 0:j.color;if(q&&!x(q)){S=!0;break}const X=window.getComputedStyle(U);if(X.color&&!x(X.color)){S=!0;break}U=U.parentElement}const D=document.createDocumentFragment();let I=0;F.replace(/{{\s*([\s\S]*?)\s*}}/g,(q,X,f)=>{if(f>I&&D.appendChild(document.createTextNode(F.slice(I,f))),S)D.appendChild(document.createTextNode(q));else{const y=document.createElement("span");y.style.color="blue",y.textContent=q,D.appendChild(y)}return I=f+q.length,q}),I<F.length&&D.appendChild(document.createTextNode(F.slice(I))),W.replaceChild(D,O)}),T.innerHTML=T.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),T.innerHTML},N=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),V=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return n.createElement("div",{className:`rte-preview ${c||""}`,style:te(ee({},u),{position:"relative"}),onClick:w},n.createElement("div",{className:"rte-preview-device-picker"},n.createElement("select",{value:L,onChange:b=>H(b.target.value)},Object.entries(z).map(([b,T])=>n.createElement("option",{key:b,value:b},T.label)))),L==="web"&&n.createElement("div",{className:"rte-preview-web-wrapper"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&n.createElement("div",{className:"rte-preview-mobile-overlay"},n.createElement("div",{className:"rte-preview-mobile-frame",style:{width:z[L].width,height:z[L].height}},n.createElement("div",{className:"rte-preview-mobile-header"},n.createElement("div",{className:"rte-preview-logo"},"A"),n.createElement("div",{className:"rte-preview-bell"},"🔔",n.createElement("span",{className:"rte-preview-badge"},"99+"))),n.createElement("div",{className:"rte-preview-tabs-wrapper"},n.createElement("div",{className:"rte-preview-tabs"},n.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),n.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),n.createElement("div",{className:"rte-preview-mobile-body"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",N()),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},V())))))),n.createElement("div",null,n.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),n.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>n.createElement("div",{key:b,className:"rte-attr-row"},n.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),n.createElement("span",null," : "),n.createElement("input",{className:"rte-attr-input",value:m[b]||"",onChange:T=>{const P=T.target.value;v(_=>te(ee({},_),{[b]:P}))},placeholder:"Enter value"}))))))},an=({visible:a,linkData:c,onClose:u,onInsert:m})=>{const[v,L]=n.useState(""),[H,z]=n.useState(""),[w,x]=n.useState(""),[R,N]=n.useState("_self");if(n.useEffect(()=>{a?(L(c.url||""),z(c.text||""),x(c.title||""),N(c.target||"_self")):(L(""),z(""),x(""),N("_self"))},[a,c]),!a)return null;const V=()=>{m({url:v,text:H,title:w,target:R})};return n.createElement(n.Fragment,null,n.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),n.createElement("div",{className:"rte-link-modal"},n.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:H,onChange:b=>z(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),n.createElement("select",{className:"rte-link-modal__select",value:R,onChange:b=>N(b.target.value)},n.createElement("option",{value:"_self"},"Same tab"),n.createElement("option",{value:"_blank"},"New tab")),n.createElement("div",{className:"rte-link-modal__actions"},n.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),n.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:V},"OK"))))};function Ie(a){const c=new Map;return a.forEach(u=>{c.set(u.name,u.value)}),Array.from(c.entries()).map(([u,m])=>({name:u,value:m}))}const ln=({atSuggestions:a=[],showOutput:c=!1,showPreview:u=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:L={},handleGetHtml:H=()=>{},onChange:z=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:R=()=>{}})=>{var be,Ce,Le,Se,xe,Re,Ne,Me,Te,Ae,ke,ze;const N=n.useRef(null),[V,b]=n.useState(w!=null&&w.length?w:" "),[T,P]=n.useState(""),[_,O]=n.useState(!1),[F,W]=n.useState({x:0,y:0}),[U,S]=n.useState([]),D=n.useRef(null),I=n.useRef(null),[j,q]=n.useState({visible:!1,x:0,y:0}),[X,f]=n.useState(!1),y=n.useRef(null),[$,Y]=n.useState({url:"",text:"",title:"",target:"_self"}),ne={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(be=m.unorderedList)!=null?be:!0,orderedList:(Ce=m.orderedList)!=null?Ce:!0,staticUnorderedList:(Le=m.staticUnorderedList)!=null?Le:!0,staticOrderedList:(Se=m.staticOrderedList)!=null?Se:!0,align:!0,link:(xe=m.link)!=null?xe:!1,image:(Re=m.image)!=null?Re:!1,emoji:(Ne=m.emoji)!=null?Ne:!1,table:(Me=m.table)!=null?Me:!1,color:(Te=m.color)!=null?Te:!1,fontFamily:(Ae=m.fontFamily)!=null?Ae:!1,fontSize:(ke=m.fontSize)!=null?ke:!1,highlight:(ze=m.fontSize)!=null?ze:!1},[ie,Q]=n.useState(""),[re,ce]=n.useState([]),[me,he]=n.useState({}),B=()=>N.current,M=()=>{const e=$e(),t=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());let r=e;t||(r=`<div style="font-size: 12px; color: #4f5055;">${e}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(i,p,E)=>{if(/list-type=["']static["']/.test(E)||i.includes("data-hidden-array-start")||i.includes("data-hidden-array-end"))return i;const h=`<${p}${E}>`,d='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',g='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',C=`</${p}>`,A=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${d}${A}${g}${C}`}),P(r),H==null||H(r);const l=ut(e);z(l);const s=Je(),o=Ie(s);JSON.stringify(o)!==JSON.stringify(re)&&(ce(o),x(o),yt(o))},$e=()=>{const e=B();if(!e)return V;const t=e.cloneNode(!0);t.querySelectorAll("table div").forEach(l=>l.remove()),t.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),t.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=t.innerHTML;return r=We(r),r},We=e=>{const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),t.innerHTML},Z=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=document.getElementById("rte-editor-body");if(!t)return;const r=e.getRangeAt(0);t.contains(r.startContainer)&&(D.current=r.cloneRange())},K=()=>{const e=window.getSelection();!e||!D.current||(e.removeAllRanges(),e.addRange(D.current))},fe=(e,t)=>{const r=window.getSelection();r&&r.rangeCount>0&&(D.current=r.getRangeAt(0)),K(),document.execCommand(e,!1,t),M()};n.useEffect(()=>{const e=B();if(!e||!w)return;const t=Xe(w);e.innerHTML=t,M()},[]);const Xe=e=>e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,t=>t.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));n.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),n.useEffect(()=>{R&&R(e=>{Ge(e)})},[]),n.useEffect(()=>{const e=B();if(!e)return;e.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(ue(r),r.querySelectorAll("th, td").forEach(s=>G(s)))})},[]);const ge=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},pe=(e,t)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=ge(l.startContainer);let o,i;const p=t==="insertStaticUnorderedList"||t==="insertStaticOrderedList";if(s){let d=s.querySelector(e);d||(d=document.createElement(e),d.style.margin="0",d.style.paddingLeft="20px",s.appendChild(d)),i=d,o=document.createElement("li"),o.textContent="",i.appendChild(o)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const d=B();if(i=d==null?void 0:d.querySelector(`${e}:last-child`),!i)return;p&&i.setAttribute("list-type","static"),o=i.querySelector("li:last-child")}const E=document.createRange();E.setStart(o,0),E.collapse(!0),r.removeAllRanges(),r.addRange(E),(h=B())==null||h.focus(),M()},se=(e,t)=>{e==="insertOrderedList"||e==="insertStaticOrderedList"?pe("ol",e):e==="insertUnorderedList"||e==="insertStaticUnorderedList"?pe("ul",e):e.startsWith("justify")?ht(e):fe(e,t),e==="insertTable"&&Ee(),e==="insertStaticTable"&&Ee("insertStaticTable")},Ze=e=>{const t=document.createElement("span");t.textContent="",e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const r=t.getBoundingClientRect();t.remove(),W({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),O(!0),I.current=e.cloneRange()},Ke=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.anchorNode;let r=e.anchorOffset;if(!t)return null;let l=t;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=t.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===t?r:s.length,i=s.lastIndexOf("@",o-1);if(i!==-1){const p=document.createRange();return p.setStart(l,i),p.setEnd(l,o),p}}l=l.previousSibling}return null},Ye=e=>{var o;const t=window.getSelection();if(!t)return;const r=Ke();r?(t.removeAllRanges(),t.addRange(r)):I.current&&(t.removeAllRanges(),t.addRange(I.current));const l=document.createElement("span");l.textContent=`{{${e.name}}}`,l.style.display="inline",l.setAttribute("data-mention",e.value||e.name||""),l.title=`{{${e.name}}}`;try{const i=t.rangeCount?t.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),d=B();h.selectNodeContents(d),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),t.removeAllRanges(),t.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Ie([...re,e]);ce(s),x(s),O(!1),(o=B())==null||o.focus(),M()},Qe=e=>{const t=B();if(!t)return;let r=null;D.current&&t.contains(D.current.startContainer)?r=D.current.cloneRange():(r=document.createRange(),r.selectNodeContents(t),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${e.name}}}`,s.style.display="inline",s.setAttribute("data-mention",e.value||e.name),s.title=`{{${e.name}}}`,r.insertNode(s);const o=document.createTextNode(" ");s.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),l.removeAllRanges(),l.addRange(i),D.current=i.cloneRange(),t.focus()},Ge=e=>{e.forEach(t=>Qe(t)),ce(t=>{const r=[...t,...e],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),M()},Je=()=>{const e=B();if(!e)return[];const t=e.querySelectorAll("span[data-mention]"),r=[];return t.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},et=e=>{var r,l,s;const t=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t)&&(e.preventDefault(),se(t==="b"?"bold":t==="i"?"italic":t==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?ge(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){e.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const d=document.createElement("p");d.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(d,h.nextSibling);const g=document.createRange();g.setStart(d,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const d=i.closest("ul, ol");if(d){const g=document.createElement("p");g.innerHTML="<br />",(s=d.parentElement)==null||s.insertBefore(g,d.nextSibling),d.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}M()}}if(t==="backspace"||t==="delete"){const o=window.getSelection();if(!o||o.rangeCount===0)return;const i=o.getRangeAt(0);if(i.cloneContents().querySelector("table"))return;if(i.cloneContents().querySelectorAll(".rte-resize-handle").length>0){e.preventDefault(),e.stopPropagation();return}}},tt=e=>{if(e.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(de(l))return;setTimeout(()=>{Ze(r.getRangeAt(0)),Q(""),S(a),O(!0)},0);return}if(_){setTimeout(()=>ve(),0);return}},de=e=>{if(!e)return!1;let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){if(t.tagName==="TH")return!0;t=t.parentElement}return!1},ve=()=>{M();const e=window.getSelection();if(!e||!e.anchorNode)return;if(de(e.anchorNode)){O(!1);return}let t=e.anchorNode.textContent||"";t=t.replace(/\u00A0/g," ");const r=t.match(/@([^\n]*)$/);if(!r){O(!1);return}const l=r[1].trim().toLowerCase();Q(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),O(!0)):O(!1)},nt=e=>{var l;const t=(l=e.target.files)==null?void 0:l[0];if(!t)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;K();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=t.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=B();if(!p||!h){h==null||h.appendChild(E);const A=document.createTextNode(" ");h==null||h.appendChild(A);const J=document.createRange();J.setStartAfter(A),J.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(J),h==null||h.focus(),M(),e.target.value="";return}p.deleteContents(),p.insertNode(E);const d=document.createTextNode(" ");E.after(d);const g=document.createRange();g.setStartAfter(d),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),M(),e.target.value=""},r.readAsDataURL(t)},rt=e=>{var s;K();const t=window.getSelection();if(!(t!=null&&t.rangeCount))return;const r=t.getRangeAt(0),l=document.createTextNode(e);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),t.removeAllRanges(),t.addRange(r),(s=B())==null||s.focus(),M()},Ee=e=>{var d;Et(),K();const t=document.createElement("table");t.style.borderCollapse="collapse",t.style.width="310px",t.style.border="1px solid #ccc",t.style.margin="8px 0",t.style.position="relative",t.style.textAlign="center",v.table&&t.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),e==="insertStaticTable"&&l.setAttribute("table-type","static");const s=document.createElement("tr");v.tr&&s.classList.add(v.tr);const o=document.createElement("tr");v.tr&&o.classList.add(v.tr);for(let g=0;g<2;g++){const C=document.createElement("th");C.textContent="",C.style.border="1px solid #999",C.style.padding="4px",C.style.position="relative",C.style.backgroundColor="lightgray",C.style.height="20px",v.th&&C.classList.add(v.th);const A=document.createElement("td");A.textContent="",A.style.border="1px solid #999",A.style.padding="4px",A.style.position="relative",A.style.backgroundColor="#fff",A.style.minHeight="20px",A.style.height="20px",A.style.whiteSpace="normal",A.style.wordBreak="break-word",A.style.overflowWrap="anywhere",A.style.lineHeight="20px",A.style.minWidth="20px",v.td&&A.classList.add(v.td),G(C),G(A),s.appendChild(C),o.appendChild(A)}r.appendChild(s),l.appendChild(o),t.appendChild(r),t.appendChild(l),ue(t);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(t);const E=document.createElement("p");E.innerHTML="<br/>",t.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(d=B())==null||d.focus(),M()},ue=e=>{if(e.dataset.hasResizeHandle==="true")return;const t=document.createElement("div");Object.assign(t.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),t.contentEditable="false",t.dataset.hasResizeHandle="true",t.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;t.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=e.getBoundingClientRect();s=p.width,o=p.height;const E=d=>{const g=Math.max(100,s+(d.clientX-r)),C=Math.max(20,o+(d.clientY-l));e.style.width=`${g}px`,e.style.height=`${C}px`,M()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),e.appendChild(t)},G=e=>{const t=document.createElement("div"),r=document.createElement("div");Object.assign(t.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),t.contentEditable="false",t.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),at(e,t,r),e.appendChild(t),e.appendChild(r)},at=(e,t,r)=>{let l=0,s=0,o=0,i=0;t.addEventListener("mousedown",d=>{d.preventDefault(),l=d.clientX,o=e.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",d=>{d.preventDefault(),s=d.clientY,i=e.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=d=>{const g=o+(d.clientX-l);e.style.width=`${Math.max(30,g)}px`,M()},E=d=>{const g=i+(d.clientY-s);e.style.height=`${Math.max(20,g)}px`,M()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()}},lt=e=>{const r=e.target.closest("td, th");r&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),q({visible:!0,x:e.clientX,y:e.clientY,cell:r}))},we=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},ot=e=>{if(!j.cell)return;const t=j.cell.closest("table"),r=j.cell.cellIndex,l=j.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,G(p),p};switch(e){case"insertRowAbove":{const o=t.rows[l],i=t.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=t.rows[l],i=t.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":t.rows.length>1&&t.deleteRow(l);break;case"deleteCol":Array.from(t.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}M(),q(te(ee({},j),{visible:!1})),we()},it=()=>{Z(),y.current=D.current,Y({url:"",text:"",title:"",target:"_self"}),f(!0)},ct=e=>{const t=window.getSelection();if(!t||!y.current)return;t.removeAllRanges(),t.addRange(y.current);let r=e.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=e.text||r,l.title=e.title,l.target=e.target,l.contentEditable="true";const s=t.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),t.removeAllRanges(),t.addRange(i),f(!1),M()},st=e=>{const t=e.target;if(t.tagName==="A"){const r=t;if(e.ctrlKey||e.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,Y({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},dt=()=>{const e=B();if(!e)return;const t=window.getSelection();if((!t||t.rangeCount===0)&&D.current){const d=window.getSelection();d==null||d.removeAllRanges(),d==null||d.addRange(D.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);K(),document.execCommand("removeFormat",!1);const s=l.cloneContents(),o=document.createElement("div");o.appendChild(s);const i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,null),p=[];for(;i.nextNode();){const d=i.currentNode,g=d.tagName.toUpperCase(),C=d.getAttribute&&d.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(d)}for(let d=p.length-1;d>=0;d--){const g=p[d],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(d=>d.removeAttribute("style")),l.deleteContents();const E=document.createDocumentFragment();for(;o.firstChild;)E.appendChild(o.firstChild);l.insertNode(E);const h=document.createRange();h.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),h.collapse(!0),r.removeAllRanges(),r.addRange(h),e.normalize(),M()},ut=e=>{var l;let t=e;t=t.replace(/{{#arrayData\d*}}/g,""),t=t.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=t,r.querySelectorAll("br").forEach(s=>{s.replaceWith(`
|
|
2
2
|
`)}),r.querySelectorAll("p, div, tr").forEach(s=>{s.insertAdjacentText("afterend",`
|
|
3
3
|
`)}),r.querySelectorAll("table").forEach(s=>{s.insertAdjacentText("afterend",`
|
|
4
4
|
`)}),((l=r.textContent)==null?void 0:l.replace(/\n{3,}/g,`
|
|
5
5
|
|
|
6
|
-
`).trim())||""};function mt(){const e=window.getSelection();if(!e||e.rangeCount===0)return[];const t=e.getRangeAt(0);if(t.collapsed){let o=t.startContainer,i=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;const p=i==null?void 0:i.closest("td, th");return p?[p]:[]}const r=t.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(o=>{const i=document.createRange();return i.selectNodeContents(o),t.compareBoundaryPoints(Range.END_TO_START,i)<0&&t.compareBoundaryPoints(Range.START_TO_END,i)>0})}function ht(e){const t=mt();if(t.length===0){fe(e);return}let r="left";e==="justifyCenter"&&(r="center"),e==="justifyRight"&&(r="right"),t.forEach(l=>{l.style.textAlign=r}),M()}const ft=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return!1;let t=e.anchorNode.nodeType===Node.ELEMENT_NODE?e.anchorNode:e.anchorNode.parentElement;for(;t;){if(t.tagName==="TABLE")return!0;t=t.parentElement}return!1},gt=e=>{if(ft()){e.preventDefault();const h=e.clipboardData.getData("text/plain");if(!h)return;const d=window.getSelection();if(!d||!d.rangeCount)return;const g=d.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((A,J)=>{g.insertNode(document.createTextNode(A)),J<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),d.removeAllRanges(),d.addRange(g),M();return}const t=e.clipboardData.getData("text/html")||"";if(!t)return;const r=document.createElement("div");if(r.innerHTML=t,r.querySelector("img")){e.preventDefault();return}e.preventDefault();const l=document.createElement("div");l.innerHTML=t;const s=h=>{h.hasAttribute("data-has-resize-handle")||(h.style.borderCollapse="collapse",h.style.width="100%",h.style.border="1px solid #ccc",h.style.margin="8px 0",h.style.position="relative",h.style.textAlign="center",h.querySelectorAll("th").forEach(d=>{const g=d;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="lightgray",g.style.height="20px"}),h.querySelectorAll("td").forEach(d=>{const g=d;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="#fff",g.style.height="20px"}))};l.querySelectorAll("table").forEach(h=>s(h));const o=window.getSelection();if(!o||!o.rangeCount)return;const i=o.getRangeAt(0);i.deleteContents();const p=document.createDocumentFragment();for(;l.firstChild;)p.appendChild(l.firstChild);i.insertNode(p),i.collapse(!1),o.removeAllRanges(),o.addRange(i);const E=N.current;E&&(E.querySelectorAll("table").forEach(h=>{const d=h;d.hasAttribute("data-has-resize-handle")||(ue(d),d.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||G(C)}))}),M())},pt=e=>{K();const t=window.getSelection();if(!t||!t.rangeCount)return;const r=t.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${e}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),t.removeAllRanges(),t.addRange(s),M()},vt=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return null;const t=e.anchorNode;if(de(t)||t.nodeType!==Node.TEXT_NODE)return null;const r=t.textContent||"",l=e.anchorOffset,s=r.lastIndexOf("@",l-1);if(s===-1)return null;const o=r.substring(s+1,l);if(o.includes(" ")||o.includes(" "))return null;const i=document.createRange();return i.setStart(t,s),i.setEnd(t,l),{range:i,query:o}},ye=()=>{const e=vt();if(!e)return;const{range:t,query:r}=e,l=document.createElement("span");l.textContent="",t.insertNode(l);const s=l.getBoundingClientRect();l.remove(),W({x:s.left,y:s.bottom+window.scrollY}),Q(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),O(!0),
|
|
6
|
+
`).trim())||""};function mt(){const e=window.getSelection();if(!e||e.rangeCount===0)return[];const t=e.getRangeAt(0);if(t.collapsed){let o=t.startContainer,i=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;const p=i==null?void 0:i.closest("td, th");return p?[p]:[]}const r=t.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(o=>{const i=document.createRange();return i.selectNodeContents(o),t.compareBoundaryPoints(Range.END_TO_START,i)<0&&t.compareBoundaryPoints(Range.START_TO_END,i)>0})}function ht(e){const t=mt();if(t.length===0){fe(e);return}let r="left";e==="justifyCenter"&&(r="center"),e==="justifyRight"&&(r="right"),t.forEach(l=>{l.style.textAlign=r}),M()}const ft=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return!1;let t=e.anchorNode.nodeType===Node.ELEMENT_NODE?e.anchorNode:e.anchorNode.parentElement;for(;t;){if(t.tagName==="TABLE")return!0;t=t.parentElement}return!1},gt=e=>{if(ft()){e.preventDefault();const h=e.clipboardData.getData("text/plain");if(!h)return;const d=window.getSelection();if(!d||!d.rangeCount)return;const g=d.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((A,J)=>{g.insertNode(document.createTextNode(A)),J<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),d.removeAllRanges(),d.addRange(g),M();return}const t=e.clipboardData.getData("text/html")||"";if(!t)return;const r=document.createElement("div");if(r.innerHTML=t,r.querySelector("img")){e.preventDefault();return}e.preventDefault();const l=document.createElement("div");l.innerHTML=t;const s=h=>{h.hasAttribute("data-has-resize-handle")||(h.style.borderCollapse="collapse",h.style.width="100%",h.style.border="1px solid #ccc",h.style.margin="8px 0",h.style.position="relative",h.style.textAlign="center",h.querySelectorAll("th").forEach(d=>{const g=d;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="lightgray",g.style.height="20px"}),h.querySelectorAll("td").forEach(d=>{const g=d;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="#fff",g.style.height="20px"}))};l.querySelectorAll("table").forEach(h=>s(h));const o=window.getSelection();if(!o||!o.rangeCount)return;const i=o.getRangeAt(0);i.deleteContents();const p=document.createDocumentFragment();for(;l.firstChild;)p.appendChild(l.firstChild);i.insertNode(p),i.collapse(!1),o.removeAllRanges(),o.addRange(i);const E=N.current;E&&(E.querySelectorAll("table").forEach(h=>{const d=h;d.hasAttribute("data-has-resize-handle")||(ue(d),d.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||G(C)}))}),M())},pt=e=>{K();const t=window.getSelection();if(!t||!t.rangeCount)return;const r=t.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${e}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),t.removeAllRanges(),t.addRange(s),M()},vt=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return null;const t=e.anchorNode;if(de(t)||t.nodeType!==Node.TEXT_NODE)return null;const r=t.textContent||"",l=e.anchorOffset,s=r.lastIndexOf("@",l-1);if(s===-1)return null;const o=r.substring(s+1,l);if(o.includes(" ")||o.includes(" "))return null;const i=document.createRange();return i.setStart(t,s),i.setEnd(t,l),{range:i,query:o}},ye=()=>{const e=vt();if(!e)return;const{range:t,query:r}=e,l=document.createElement("span");l.textContent="",t.insertNode(l);const s=l.getBoundingClientRect();l.remove(),W({x:s.left,y:s.bottom+window.scrollY}),Q(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),O(!0),I.current=t.cloneRange()};function Et(){const e=N.current;if(!e)return;const t=window.getSelection();if(!t||t.rangeCount>0&&e.contains(t.anchorNode))return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),t.removeAllRanges(),t.addRange(r),D.current=r.cloneRange()}const wt=e=>{const t=e.target;if(!t||!(t.textContent||"").match(/{{([\s\S]+?)}}/)||!N.current)return;let o=t.firstChild;if((!o||o.nodeType!==Node.TEXT_NODE)&&(o=t.childNodes[0]),!o||o.nodeType!==Node.TEXT_NODE)return;const i=o.textContent||"",p=i.indexOf("{{"),E=i.indexOf("}}");if(p===-1||E===-1)return;const h=window.getSelection();if(!h)return;const d=document.createRange();d.setStart(o,p),d.setEnd(o,E+2),h.removeAllRanges(),h.addRange(d)},yt=e=>{he(t=>{const r={};return e.forEach(l=>{var s;r[l.name]=(s=t[l.name])!=null?s:""}),r})},bt=()=>{let e=T;return Object.entries(me).forEach(([t,r])=>{if(r.trim()){const l=new RegExp(`{{\\s*${t}\\s*}}`,"g");e=e.replace(l,r)}}),e};return n.createElement("div",{className:`rte-wrapper ${(v==null?void 0:v.wrapper)||""}`,style:L.wrapper},n.createElement("div",{style:{flex:1}},n.createElement(Ve,{exec:se,saveSelection:Z,handleFileChange:nt,handleFontSizeChange:e=>pt(e.target.value),handleFontFamilyChange:e=>se("fontName",e.target.value),insertEmoji:rt,handleLink:it,removeFormatting:dt,visibleActions:ne,className:v.toolbar,style:L.toolbar}),n.createElement("div",{ref:N,id:"rte-editor-body",className:`rte-editor ${(v==null?void 0:v.editor)||""}`,style:L.editor,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:gt,onKeyUp:()=>{Z(),ye()},onMouseUp:Z,onInput:()=>{ve(),Z()},onKeyDown:et,onBeforeInput:tt,onContextMenu:lt,onClick:e=>{st(e),Z(),ye()},onDoubleClick:wt}),n.createElement(nn,{show:_,position:F,filtered:U,insertMention:Ye,onClose:()=>O(!1),query:ie}),c&&n.createElement("div",{className:`rte-output ${(v==null?void 0:v.output)||""}`,style:L.output},n.createElement("h4",null,"Output HTML:"),n.createElement("p",null,T)),n.createElement(rn,{visible:j.visible,x:j.x,y:j.y,onAction:ot,onClose:()=>{q(te(ee({},j),{visible:!1})),we()}}),n.createElement(an,{visible:X,linkData:$,onClose:()=>f(!1),onInsert:ct})),u?n.createElement(Ue,{className:v.preview,style:L.preview,html:bt(),attributes:me,setAttributes:he}):null)};exports.RichTextEditor=ln;exports.RtePreview=Ue;exports.RteToolbar=Ve;
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(D,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],e):(D=typeof globalThis!="undefined"?globalThis:D||self,e(D.RichTextEditor={},D.React,D.ReactDOM))})(this,(function(D,e,$){"use strict";var nn=Object.defineProperty,rn=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable;var Xe=(D,e,$)=>e in D?nn(D,e,{enumerable:!0,configurable:!0,writable:!0,value:$}):D[e]=$,ne=(D,e)=>{for(var $ in e||(e={}))ln.call(e,$)&&Xe(D,$,e[$]);if(We)for(var $ of We(e))on.call(e,$)&&Xe(D,$,e[$]);return D},re=(D,e)=>rn(D,an(e));function Ze(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(d,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return d.default=a,Object.freeze(d)}const Ke=Ze(e);window.React=Ke;var fe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ge=e.createContext&&e.createContext(fe),Ye=["attr","size","title"];function Qe(a,d){if(a==null)return{};var u=Re(a,d),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(d.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function Re(a,d){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(d.indexOf(m)>=0)continue;u[m]=a[m]}return u}function ae(){return ae=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},ae.apply(this,arguments)}function pe(a,d){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);d&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function le(a){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?pe(Object(u),!0).forEach(function(m){Ge(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):pe(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Ge(a,d,u){return d=Je(d),d in a?Object.defineProperty(a,d,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[d]=u,a}function Je(a){var d=et(a,"string");return typeof d=="symbol"?d:d+""}function et(a,d){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,d);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(a)}function ve(a){return a&&a.map((d,u)=>e.createElement(d.tag,le({key:u},d.attr),ve(d.child)))}function A(a){return d=>e.createElement(tt,ae({attr:le({},a.attr)},d),ve(a.child))}function tt(a){var d=u=>{var{attr:m,size:v,title:L}=a,j=Qe(a,Ye),O=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),e.createElement("svg",ae({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,j,{className:w,style:le(le({color:a.color||u.color},u.style),a.style),height:O,width:O,xmlns:"http://www.w3.org/2000/svg"}),L&&e.createElement("title",null,L),a.children)};return ge!==void 0?e.createElement(ge.Consumer,null,u=>d(u)):d(fe)}function nt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function rt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function at(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function lt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function ot(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function it(a){return A({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function st(a){return A({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function ct(a){return A({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function dt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function ut(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function mt(a){return A({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function ht(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function ft(a){return A({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function gt(a){return A({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function pt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function vt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function Et(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function wt(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const yt=["😀","😁","😂","🤣","😃","😄","😅","😉","😊","😍","😘","😜","😎","😢","😭","😡","🤔","🙄","😇","🥰","🤩","🤗","😴","😋","😬","🤤","😶🌫️","😷","🤕","🤑","🤠","😈","👻","💀","🤖","🐶","🐱","🐼","🐸","🦄","🐷","🐵","🐰","🐯","🦁","🐮","🌞","🌙","⭐","🌈","🔥","💧","❄️","⚡","☀️","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","🥭","🥑","🎉","🎂","🎁","🎈","🎶","🎵","🏆","⚽","🏀","🏸","🏏","🕹️","👋","🤚","🖐️","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","☝️","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","✍️","💅","🤲","👏","🫶","👐"],Ee=({exec:a,saveSelection:d,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:j,removeFormatting:O,visibleActions:w,className:x,style:N})=>{var B,Y;const M=e.useRef(null),W=e.useRef(null),b=e.useRef(null),[k,_]=e.useState(!1),[V,P]=e.useState({x:0,y:0});e.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&_(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const I=f=>{var Z;f.preventDefault();const y=f.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{(Z=M.current)==null||Z.click();break}default:console.warn("Unknown command:",y)}},K=f=>{a("foreColor",f.target.value)},X=f=>{a("backColor",f.target.value)},[S,H]=e.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),q=e.useRef(null),F=e.useRef(null);return e.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let Z=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!Z)return;const G=window.getComputedStyle(Z),ie=G.fontFamily.replace(/['"]/g,"").split(",")[0],ce=parseInt(G.fontSize,10);if(q.current){const J=Array.from(q.current.options).some(se=>se.value===ie);q.current.value=J?ie:""}F.current&&(F.current.value=String(ce))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.useEffect(()=>{const f=()=>{H({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.createElement("div",{className:`rte-toolbar ${x||""}`,style:N},w.bold&&e.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:I,className:S.bold?"rte-active":""},e.createElement(it,null)),w.italic&&e.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:I,className:S.italic?"rte-active":""},e.createElement(ct,null)),w.underline&&e.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:I,className:S.underline?"rte-active":""},e.createElement(ht,null)),w.unorderedList&&e.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:I,title:"UnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(gt,null)),w.staticUnorderedList&&e.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:I,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(ut,null)),w.orderedList&&e.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:I,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},e.createElement(ft,null)),w.staticOrderedList&&e.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:I,className:S.orderedList?"rte-active":""},e.createElement(lt,null)),w.link&&e.createElement("button",{"data-command":"createLink",title:"Link",onClick:j,className:S.link?"rte-active":""},e.createElement(dt,null)),w.removeFormat&&e.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),d(),O()},className:S.removeFormat?"rte-active":""},e.createElement(wt,null)),w.image&&e.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:I,className:S.image?"rte-active":""},e.createElement(at,null)),e.createElement("input",{type:"file",accept:"image/*",ref:M,style:{display:"none"},onChange:u}),w.emoji&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),d();const y=f.currentTarget.getBoundingClientRect();P({x:y.left,y:y.bottom+8}),_(Z=>!Z)},className:S.emoji?"rte-active":""},e.createElement(mt,null)),k&&$.createPortal(e.createElement("div",{className:"rte-emoji-popup",style:{top:V.y,left:V.x}},yt.map((f,y)=>e.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:Z=>{Z.preventDefault(),L(f),_(!1)}},f))),document.body)),w.color&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=W.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((B=W.current)==null?void 0:B.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},e.createElement(Et,null)),e.createElement("input",{ref:W,type:"color",defaultValue:"#000000",onChange:f=>{var y;K(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.highlight&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((Y=b.current)==null?void 0:Y.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},e.createElement(st,null)),e.createElement("input",{ref:b,type:"color",onChange:f=>{var y;X(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.align&&e.createElement(e.Fragment,null,e.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},e.createElement(ot,null)),e.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},e.createElement(nt,null)),e.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},e.createElement(rt,null))),w.table&&e.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(pt,null)),w.table&&e.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(vt,null)),w.fontFamily&&e.createElement("select",{ref:q,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:v},e.createElement("option",{value:"",disabled:!0},"Font Family"),e.createElement("option",{value:"Arial"},"Arial"),e.createElement("option",{value:"Georgia"},"Georgia"),e.createElement("option",{value:"Times New Roman"},"Times New Roman"),e.createElement("option",{value:"Courier New"},"Courier New"),e.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&e.createElement("select",{ref:F,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:m},e.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>e.createElement("option",{key:f,value:f},f,"px"))))},bt=({show:a,position:d,filtered:u,insertMention:m,onClose:v,query:L})=>{const j=e.useRef(null),[O,w]=e.useState(0);return e.useEffect(()=>{a&&w(0)},[a]),e.useEffect(()=>{const x=N=>{j.current&&!j.current.contains(N.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),e.useEffect(()=>{if(!a)return;const x=N=>{if(!(!a||u.length===0)&&(N.key==="ArrowDown"&&(N.preventDefault(),w(M=>Math.min(M+1,u.length-1))),N.key==="ArrowUp"&&(N.preventDefault(),w(M=>Math.max(M-1,0))),N.key==="Enter")){N.preventDefault();const M=u[O];M&&m(M)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,O]),e.useEffect(()=>{if(!j.current)return;const N=j.current.querySelectorAll("li")[O];N&&N.scrollIntoView({block:"nearest",behavior:"smooth"})},[O]),a?e.createElement("ul",{ref:j,className:"rte-popup",style:{top:d.y,left:d.x}},u.length>0?u.map(({name:x,value:N},M)=>{const W=x.toLowerCase(),b=L.toLowerCase(),k=W.indexOf(b);let _=x;if(k!==-1&&L.length>0){const V=k+L.length;_=x.substring(0,k)+`<span class="rte-highlight">${x.substring(k,V)}</span>`+x.substring(V)}return e.createElement("li",{key:N,onMouseDown:V=>{V.preventDefault(),m({name:x,value:N})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:M===O?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:_},onMouseEnter:()=>w(M)})}):e.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function we(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function oe(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const Ct=({visible:a,x:d,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:d};return e.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},e.createElement("button",{onClick:()=>m("insertRowAbove")},e.createElement(oe,null)," Insert row above"),e.createElement("button",{onClick:()=>m("insertRowBelow")},e.createElement(oe,null)," Insert row below"),e.createElement("button",{onClick:()=>m("insertColLeft")},e.createElement(oe,null)," Insert col left"),e.createElement("button",{onClick:()=>m("insertColRight")},e.createElement(oe,null)," Insert col right"),e.createElement("button",{onClick:()=>m("deleteRow")},e.createElement(we,null)," Delete row"),e.createElement("button",{onClick:()=>m("deleteCol")},e.createElement(we,null)," Delete column"))};function ye(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function be(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ce=({html:a,className:d,style:u,attributes:m,setAttributes:v})=>{const[L,j]=e.useState("web"),O={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},w=b=>{const k=b.target;if(k.tagName==="A"){b.preventDefault();const _=k.href;_&&window.open(_,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",N=b=>{const k=document.createElement("div");k.innerHTML=b;const _=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,null),V=[];for(;_.nextNode();){const P=_.currentNode;P.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(P.nodeValue)&&V.push(P)}return V.forEach(P=>{var F;const I=P.nodeValue||"",K=P.parentElement;if(!K)return;let X=K,S=!1;for(;X;){if(X.tagName==="FONT"&&X.getAttribute("color")){S=!0;break}const B=(F=X.style)==null?void 0:F.color;if(B&&!x(B)){S=!0;break}const Y=window.getComputedStyle(X);if(Y.color&&!x(Y.color)){S=!0;break}X=X.parentElement}const H=document.createDocumentFragment();let q=0;I.replace(/{{\s*([\s\S]*?)\s*}}/g,(B,Y,f)=>{if(f>q&&H.appendChild(document.createTextNode(I.slice(q,f))),S)H.appendChild(document.createTextNode(B));else{const y=document.createElement("span");y.style.color="blue",y.textContent=B,H.appendChild(y)}return q=f+B.length,B}),q<I.length&&H.appendChild(document.createTextNode(I.slice(q))),K.replaceChild(H,P)}),k.innerHTML=k.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),k.innerHTML},M=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),W=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return e.createElement("div",{className:`rte-preview ${d||""}`,style:re(ne({},u),{position:"relative"}),onClick:w},e.createElement("div",{className:"rte-preview-device-picker"},e.createElement("select",{value:L,onChange:b=>j(b.target.value)},Object.entries(O).map(([b,k])=>e.createElement("option",{key:b,value:b},k.label)))),L==="web"&&e.createElement("div",{className:"rte-preview-web-wrapper"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&e.createElement("div",{className:"rte-preview-mobile-overlay"},e.createElement("div",{className:"rte-preview-mobile-frame",style:{width:O[L].width,height:O[L].height}},e.createElement("div",{className:"rte-preview-mobile-header"},e.createElement("div",{className:"rte-preview-logo"},"A"),e.createElement("div",{className:"rte-preview-bell"},"🔔",e.createElement("span",{className:"rte-preview-badge"},"99+"))),e.createElement("div",{className:"rte-preview-tabs-wrapper"},e.createElement("div",{className:"rte-preview-tabs"},e.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),e.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),e.createElement("div",{className:"rte-preview-mobile-body"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",M()),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},W())))))),e.createElement("div",null,e.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),e.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>e.createElement("div",{key:b,className:"rte-attr-row"},e.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),e.createElement("span",null," : "),e.createElement("input",{className:"rte-attr-input",value:m[b],onChange:k=>v(_=>re(ne({},_),{[b]:k.target.value})),placeholder:"Enter value"}))))))},Lt=({visible:a,linkData:d,onClose:u,onInsert:m})=>{const[v,L]=e.useState(""),[j,O]=e.useState(""),[w,x]=e.useState(""),[N,M]=e.useState("_self");if(e.useEffect(()=>{a?(L(d.url||""),O(d.text||""),x(d.title||""),M(d.target||"_self")):(L(""),O(""),x(""),M("_self"))},[a,d]),!a)return null;const W=()=>{m({url:v,text:j,title:w,target:N})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),e.createElement("div",{className:"rte-link-modal"},e.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:j,onChange:b=>O(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),e.createElement("select",{className:"rte-link-modal__select",value:N,onChange:b=>M(b.target.value)},e.createElement("option",{value:"_self"},"Same tab"),e.createElement("option",{value:"_blank"},"New tab")),e.createElement("div",{className:"rte-link-modal__actions"},e.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),e.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:W},"OK"))))};function Le(a){const d=new Map;return a.forEach(u=>{d.set(u.name,u.value)}),Array.from(d.entries()).map(([u,m])=>({name:u,value:m}))}const St=({atSuggestions:a=[],showOutput:d=!1,showPreview:u=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:L={},handleGetHtml:j=()=>{},onChange:O=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:N=()=>{}})=>{var Oe,He,Pe,je,_e,Fe,Ie,qe,Be,Ve,Ue,$e;const M=e.useRef(null),[W,b]=e.useState(w!=null&&w.length?w:" "),[k,_]=e.useState(""),[V,P]=e.useState(!1),[I,K]=e.useState({x:0,y:0}),[X,S]=e.useState([]),H=e.useRef(null),q=e.useRef(null),[F,B]=e.useState({visible:!1,x:0,y:0}),[Y,f]=e.useState(!1),y=e.useRef(null),[Z,G]=e.useState({url:"",text:"",title:"",target:"_self"}),ie={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(Oe=m.unorderedList)!=null?Oe:!0,orderedList:(He=m.orderedList)!=null?He:!0,staticUnorderedList:(Pe=m.staticUnorderedList)!=null?Pe:!0,staticOrderedList:(je=m.staticOrderedList)!=null?je:!0,align:!0,link:(_e=m.link)!=null?_e:!1,image:(Fe=m.image)!=null?Fe:!1,emoji:(Ie=m.emoji)!=null?Ie:!1,table:(qe=m.table)!=null?qe:!1,color:(Be=m.color)!=null?Be:!1,fontFamily:(Ve=m.fontFamily)!=null?Ve:!1,fontSize:(Ue=m.fontSize)!=null?Ue:!1,highlight:($e=m.fontSize)!=null?$e:!1},[ce,J]=e.useState(""),[se,de]=e.useState([]),[Se,xe]=e.useState({}),U=()=>M.current,T=()=>{const t=xt(),n=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(t.trim());let r=t;n||(r=`<div style="font-size:12px">${t}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(i,p,E)=>{if(/list-type=["']static["']/.test(E)||i.includes("data-hidden-array-start")||i.includes("data-hidden-array-end"))return i;const h=`<${p}${E}>`,c='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',g='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',C=`</${p}>`,z=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${c}${z}${g}${C}`}),_(r),j==null||j(r);const l=Wt(t);O(l);const s=Ot(),o=Le(s);JSON.stringify(o)!==JSON.stringify(se)&&(de(o),x(o),en(o))},xt=()=>{const t=U();if(!t)return W;const n=t.cloneNode(!0);n.querySelectorAll("table div").forEach(l=>l.remove()),n.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),n.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=n.innerHTML;return r=Nt(r),r},Nt=t=>{const n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),n.innerHTML},Q=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=document.getElementById("rte-editor-body");if(!n)return;const r=t.getRangeAt(0);n.contains(r.startContainer)&&(H.current=r.cloneRange())},R=()=>{const t=window.getSelection();!t||!H.current||(t.removeAllRanges(),t.addRange(H.current))},Ne=(t,n)=>{const r=window.getSelection();r&&r.rangeCount>0&&(H.current=r.getRangeAt(0)),R(),document.execCommand(t,!1,n),T()};e.useEffect(()=>{const t=U();if(!t||!w)return;const n=Mt(w);t.innerHTML=n,T()},[]);const Mt=t=>t.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,n=>n.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));e.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),e.useEffect(()=>{N&&N(t=>{Dt(t)})},[]),e.useEffect(()=>{const t=U();if(!t)return;t.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(he(r),r.querySelectorAll("th, td").forEach(s=>ee(s)))})},[]);const Me=t=>{for(;t&&t.nodeName!=="LI";)t=t.parentNode;return t},Te=(t,n)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=Me(l.startContainer);let o,i;const p=n==="insertStaticUnorderedList"||n==="insertStaticOrderedList";if(s){let c=s.querySelector(t);c||(c=document.createElement(t),c.style.margin="0",c.style.paddingLeft="20px",s.appendChild(c)),i=c,o=document.createElement("li"),o.textContent="",i.appendChild(o)}else{document.execCommand(t==="ul"?"insertUnorderedList":"insertOrderedList");const c=U();if(i=c==null?void 0:c.querySelector(`${t}:last-child`),!i)return;p&&i.setAttribute("list-type","static"),o=i.querySelector("li:last-child")}const E=document.createRange();E.setStart(o,0),E.collapse(!0),r.removeAllRanges(),r.addRange(E),(h=U())==null||h.focus(),T()},ue=(t,n)=>{t==="insertOrderedList"||t==="insertStaticOrderedList"?Te("ol",t):t==="insertUnorderedList"||t==="insertStaticUnorderedList"?Te("ul",t):t.startsWith("justify")?Zt(t):Ne(t,n),t==="insertTable"&&ke(),t==="insertStaticTable"&&ke("insertStaticTable")},Tt=t=>{const n=document.createElement("span");n.textContent="",t.insertNode(n),t.setStartAfter(n),t.collapse(!0);const r=n.getBoundingClientRect();n.remove(),K({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),P(!0),q.current=t.cloneRange()},At=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.anchorNode;let r=t.anchorOffset;if(!n)return null;let l=n;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=n.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===n?r:s.length,i=s.lastIndexOf("@",o-1);if(i!==-1){const p=document.createRange();return p.setStart(l,i),p.setEnd(l,o),p}}l=l.previousSibling}return null},kt=t=>{var o;const n=window.getSelection();if(!n)return;const r=At();r?(n.removeAllRanges(),n.addRange(r)):q.current&&(n.removeAllRanges(),n.addRange(q.current));const l=document.createElement("span");l.textContent=`{{${t.name}}}`,l.style.display="inline",l.setAttribute("data-mention",t.value||t.name||""),l.title=`{{${t.name}}}`;try{const i=n.rangeCount?n.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),c=U();h.selectNodeContents(c),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),n.removeAllRanges(),n.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Le([...se,t]);de(s),x(s),P(!1),(o=U())==null||o.focus(),T()},zt=t=>{const n=U();if(!n)return;let r=null;H.current&&n.contains(H.current.startContainer)?r=H.current.cloneRange():(r=document.createRange(),r.selectNodeContents(n),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${t.name}}}`,s.style.display="inline",s.setAttribute("data-mention",t.value||t.name),s.title=`{{${t.name}}}`,r.insertNode(s);const o=document.createTextNode(" ");s.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),l.removeAllRanges(),l.addRange(i),H.current=i.cloneRange(),n.focus()},Dt=t=>{t.forEach(n=>zt(n)),de(n=>{const r=[...n,...t],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),T()},Ot=()=>{const t=U();if(!t)return[];const n=t.querySelectorAll("span[data-mention]"),r=[];return n.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},Ht=t=>{var r,l,s;const n=t.key.toLowerCase();if((t.ctrlKey||t.metaKey)&&["b","i","u"].includes(n)&&(t.preventDefault(),ue(n==="b"?"bold":n==="i"?"italic":n==="u"?"underline":"")),t.shiftKey&&t.key==="2"&&t.preventDefault(),t.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?Me(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){t.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const c=document.createElement("p");c.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(c,h.nextSibling);const g=document.createRange();g.setStart(c,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const c=i.closest("ul, ol");if(c){const g=document.createElement("p");g.innerHTML="<br />",(s=c.parentElement)==null||s.insertBefore(g,c.nextSibling),c.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}T()}}if(n==="backspace"||n==="delete"){const o=window.getSelection();if(!o||o.rangeCount===0)return;const i=o.getRangeAt(0);if(i.cloneContents().querySelector("table"))return;if(i.cloneContents().querySelectorAll(".rte-resize-handle").length>0){t.preventDefault(),t.stopPropagation();return}}},Pt=t=>{if(t.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(me(l))return;setTimeout(()=>{Tt(r.getRangeAt(0)),J(""),S(a),P(!0)},0);return}if(V){setTimeout(()=>Ae(),0);return}},me=t=>{if(!t)return!1;let n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;n;){if(n.tagName==="TH")return!0;n=n.parentElement}return!1},Ae=()=>{T();const t=window.getSelection();if(!t||!t.anchorNode)return;if(me(t.anchorNode)){P(!1);return}let n=t.anchorNode.textContent||"";n=n.replace(/\u00A0/g," ");const r=n.match(/@([^\n]*)$/);if(!r){P(!1);return}const l=r[1].trim().toLowerCase();J(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),P(!0)):P(!1)},jt=t=>{var l;const n=(l=t.target.files)==null?void 0:l[0];if(!n)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;R();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=n.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=U();if(!p||!h){h==null||h.appendChild(E);const z=document.createTextNode(" ");h==null||h.appendChild(z);const te=document.createRange();te.setStartAfter(z),te.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(te),h==null||h.focus(),T(),t.target.value="";return}p.deleteContents(),p.insertNode(E);const c=document.createTextNode(" ");E.after(c);const g=document.createRange();g.setStartAfter(c),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),T(),t.target.value=""},r.readAsDataURL(n)},_t=t=>{var s;R();const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const r=n.getRangeAt(0),l=document.createTextNode(t);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),n.removeAllRanges(),n.addRange(r),(s=U())==null||s.focus(),T()},ke=t=>{var c;Gt(),R();const n=document.createElement("table");n.style.borderCollapse="collapse",n.style.width="310px",n.style.border="1px solid #ccc",n.style.margin="8px 0",n.style.position="relative",n.style.textAlign="center",v.table&&n.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),t==="insertStaticTable"&&l.setAttribute("table-type","static");const s=document.createElement("tr");v.tr&&s.classList.add(v.tr);const o=document.createElement("tr");v.tr&&o.classList.add(v.tr);for(let g=0;g<2;g++){const C=document.createElement("th");C.textContent="",C.style.border="1px solid #999",C.style.padding="4px",C.style.position="relative",C.style.backgroundColor="lightgray",C.style.height="20px",v.th&&C.classList.add(v.th);const z=document.createElement("td");z.textContent="",z.style.border="1px solid #999",z.style.padding="4px",z.style.position="relative",z.style.backgroundColor="#fff",z.style.minHeight="20px",z.style.height="20px",z.style.whiteSpace="normal",z.style.wordBreak="break-word",z.style.overflowWrap="anywhere",z.style.lineHeight="20px",z.style.minWidth="20px",v.td&&z.classList.add(v.td),ee(C),ee(z),s.appendChild(C),o.appendChild(z)}r.appendChild(s),l.appendChild(o),n.appendChild(r),n.appendChild(l),he(n);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(n);const E=document.createElement("p");E.innerHTML="<br/>",n.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(c=U())==null||c.focus(),T()},he=t=>{if(t.dataset.hasResizeHandle==="true")return;const n=document.createElement("div");Object.assign(n.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),n.contentEditable="false",n.dataset.hasResizeHandle="true",n.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;n.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=t.getBoundingClientRect();s=p.width,o=p.height;const E=c=>{const g=Math.max(100,s+(c.clientX-r)),C=Math.max(20,o+(c.clientY-l));t.style.width=`${g}px`,t.style.height=`${C}px`,T()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),t.appendChild(n)},ee=t=>{const n=document.createElement("div"),r=document.createElement("div");Object.assign(n.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),n.contentEditable="false",n.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),Ft(t,n,r),t.appendChild(n),t.appendChild(r)},Ft=(t,n,r)=>{let l=0,s=0,o=0,i=0;n.addEventListener("mousedown",c=>{c.preventDefault(),l=c.clientX,o=t.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",c=>{c.preventDefault(),s=c.clientY,i=t.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=c=>{const g=o+(c.clientX-l);t.style.width=`${Math.max(30,g)}px`,T()},E=c=>{const g=i+(c.clientY-s);t.style.height=`${Math.max(20,g)}px`,T()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()}},It=t=>{const r=t.target.closest("td, th");r&&(t.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),B({visible:!0,x:t.clientX,y:t.clientY,cell:r}))},ze=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(t=>t.classList.remove("rte-cell-highlight"))},qt=t=>{if(!F.cell)return;const n=F.cell.closest("table"),r=F.cell.cellIndex,l=F.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,ee(p),p};switch(t){case"insertRowAbove":{const o=n.rows[l],i=n.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=n.rows[l],i=n.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":n.rows.length>1&&n.deleteRow(l);break;case"deleteCol":Array.from(n.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}T(),B(re(ne({},F),{visible:!1})),ze()},Bt=()=>{Q(),y.current=H.current,G({url:"",text:"",title:"",target:"_self"}),f(!0)},Vt=t=>{const n=window.getSelection();if(!n||!y.current)return;n.removeAllRanges(),n.addRange(y.current);let r=t.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=t.text||r,l.title=t.title,l.target=t.target,l.contentEditable="true";const s=n.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),n.removeAllRanges(),n.addRange(i),f(!1),T()},Ut=t=>{const n=t.target;if(n.tagName==="A"){const r=n;if(t.ctrlKey||t.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}t.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,G({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},$t=()=>{const t=U();if(!t)return;const n=window.getSelection();if((!n||n.rangeCount===0)&&H.current){const c=window.getSelection();c==null||c.removeAllRanges(),c==null||c.addRange(H.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);R(),document.execCommand("removeFormat",!1);const s=l.cloneContents(),o=document.createElement("div");o.appendChild(s);const i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,null),p=[];for(;i.nextNode();){const c=i.currentNode,g=c.tagName.toUpperCase(),C=c.getAttribute&&c.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(c)}for(let c=p.length-1;c>=0;c--){const g=p[c],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(c=>c.removeAttribute("style")),l.deleteContents();const E=document.createDocumentFragment();for(;o.firstChild;)E.appendChild(o.firstChild);l.insertNode(E);const h=document.createRange();h.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),h.collapse(!0),r.removeAllRanges(),r.addRange(h),t.normalize(),T()},Wt=t=>{var l;let n=t;n=n.replace(/{{#arrayData\d*}}/g,""),n=n.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("br").forEach(s=>{s.replaceWith(`
|
|
1
|
+
(function(D,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],e):(D=typeof globalThis!="undefined"?globalThis:D||self,e(D.RichTextEditor={},D.React,D.ReactDOM))})(this,(function(D,e,$){"use strict";var nn=Object.defineProperty,rn=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable;var Xe=(D,e,$)=>e in D?nn(D,e,{enumerable:!0,configurable:!0,writable:!0,value:$}):D[e]=$,ne=(D,e)=>{for(var $ in e||(e={}))ln.call(e,$)&&Xe(D,$,e[$]);if(We)for(var $ of We(e))on.call(e,$)&&Xe(D,$,e[$]);return D},re=(D,e)=>rn(D,an(e));function Ze(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(d,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return d.default=a,Object.freeze(d)}const Ke=Ze(e);window.React=Ke;var fe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ge=e.createContext&&e.createContext(fe),Ye=["attr","size","title"];function Qe(a,d){if(a==null)return{};var u=Re(a,d),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(d.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function Re(a,d){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(d.indexOf(m)>=0)continue;u[m]=a[m]}return u}function ae(){return ae=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},ae.apply(this,arguments)}function pe(a,d){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);d&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function le(a){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?pe(Object(u),!0).forEach(function(m){Ge(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):pe(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Ge(a,d,u){return d=Je(d),d in a?Object.defineProperty(a,d,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[d]=u,a}function Je(a){var d=et(a,"string");return typeof d=="symbol"?d:d+""}function et(a,d){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,d);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(a)}function ve(a){return a&&a.map((d,u)=>e.createElement(d.tag,le({key:u},d.attr),ve(d.child)))}function A(a){return d=>e.createElement(tt,ae({attr:le({},a.attr)},d),ve(a.child))}function tt(a){var d=u=>{var{attr:m,size:v,title:L}=a,j=Qe(a,Ye),O=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),e.createElement("svg",ae({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,j,{className:w,style:le(le({color:a.color||u.color},u.style),a.style),height:O,width:O,xmlns:"http://www.w3.org/2000/svg"}),L&&e.createElement("title",null,L),a.children)};return ge!==void 0?e.createElement(ge.Consumer,null,u=>d(u)):d(fe)}function nt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function rt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function at(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function lt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function ot(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function it(a){return A({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function st(a){return A({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function ct(a){return A({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function dt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function ut(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function mt(a){return A({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function ht(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function ft(a){return A({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function gt(a){return A({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function pt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function vt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function Et(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function wt(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const yt=["😀","😁","😂","🤣","😃","😄","😅","😉","😊","😍","😘","😜","😎","😢","😭","😡","🤔","🙄","😇","🥰","🤩","🤗","😴","😋","😬","🤤","😶🌫️","😷","🤕","🤑","🤠","😈","👻","💀","🤖","🐶","🐱","🐼","🐸","🦄","🐷","🐵","🐰","🐯","🦁","🐮","🌞","🌙","⭐","🌈","🔥","💧","❄️","⚡","☀️","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","🥭","🥑","🎉","🎂","🎁","🎈","🎶","🎵","🏆","⚽","🏀","🏸","🏏","🕹️","👋","🤚","🖐️","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","☝️","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","✍️","💅","🤲","👏","🫶","👐"],Ee=({exec:a,saveSelection:d,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:j,removeFormatting:O,visibleActions:w,className:x,style:N})=>{var V,Y;const M=e.useRef(null),W=e.useRef(null),b=e.useRef(null),[k,_]=e.useState(!1),[I,P]=e.useState({x:0,y:0});e.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&_(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const q=f=>{var Z;f.preventDefault();const y=f.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{(Z=M.current)==null||Z.click();break}default:console.warn("Unknown command:",y)}},K=f=>{a("foreColor",f.target.value)},X=f=>{a("backColor",f.target.value)},[S,H]=e.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),B=e.useRef(null),F=e.useRef(null);return e.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let Z=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!Z)return;const G=window.getComputedStyle(Z),ie=G.fontFamily.replace(/['"]/g,"").split(",")[0],ce=parseInt(G.fontSize,10);if(B.current){const J=Array.from(B.current.options).some(se=>se.value===ie);B.current.value=J?ie:""}F.current&&(F.current.value=String(ce))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.useEffect(()=>{const f=()=>{H({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.createElement("div",{className:`rte-toolbar ${x||""}`,style:N},w.bold&&e.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:q,className:S.bold?"rte-active":""},e.createElement(it,null)),w.italic&&e.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:q,className:S.italic?"rte-active":""},e.createElement(ct,null)),w.underline&&e.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:q,className:S.underline?"rte-active":""},e.createElement(ht,null)),w.unorderedList&&e.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:q,title:"UnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(gt,null)),w.staticUnorderedList&&e.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:q,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(ut,null)),w.orderedList&&e.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:q,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},e.createElement(ft,null)),w.staticOrderedList&&e.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:q,className:S.orderedList?"rte-active":""},e.createElement(lt,null)),w.link&&e.createElement("button",{"data-command":"createLink",title:"Link",onClick:j,className:S.link?"rte-active":""},e.createElement(dt,null)),w.removeFormat&&e.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),d(),O()},className:S.removeFormat?"rte-active":""},e.createElement(wt,null)),w.image&&e.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:q,className:S.image?"rte-active":""},e.createElement(at,null)),e.createElement("input",{type:"file",accept:"image/*",ref:M,style:{display:"none"},onChange:u}),w.emoji&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),d();const y=f.currentTarget.getBoundingClientRect();P({x:y.left,y:y.bottom+8}),_(Z=>!Z)},className:S.emoji?"rte-active":""},e.createElement(mt,null)),k&&$.createPortal(e.createElement("div",{className:"rte-emoji-popup",style:{top:I.y,left:I.x}},yt.map((f,y)=>e.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:Z=>{Z.preventDefault(),L(f),_(!1)}},f))),document.body)),w.color&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=W.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((V=W.current)==null?void 0:V.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},e.createElement(Et,null)),e.createElement("input",{ref:W,type:"color",defaultValue:"#000000",onChange:f=>{var y;K(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.highlight&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((Y=b.current)==null?void 0:Y.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},e.createElement(st,null)),e.createElement("input",{ref:b,type:"color",onChange:f=>{var y;X(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.align&&e.createElement(e.Fragment,null,e.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},e.createElement(ot,null)),e.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},e.createElement(nt,null)),e.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},e.createElement(rt,null))),w.table&&e.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(pt,null)),w.table&&e.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(vt,null)),w.fontFamily&&e.createElement("select",{ref:B,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:v},e.createElement("option",{value:"",disabled:!0},"Font Family"),e.createElement("option",{value:"Arial"},"Arial"),e.createElement("option",{value:"Georgia"},"Georgia"),e.createElement("option",{value:"Times New Roman"},"Times New Roman"),e.createElement("option",{value:"Courier New"},"Courier New"),e.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&e.createElement("select",{ref:F,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:m},e.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>e.createElement("option",{key:f,value:f},f,"px"))))},bt=({show:a,position:d,filtered:u,insertMention:m,onClose:v,query:L})=>{const j=e.useRef(null),[O,w]=e.useState(0);return e.useEffect(()=>{a&&w(0)},[a]),e.useEffect(()=>{const x=N=>{j.current&&!j.current.contains(N.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),e.useEffect(()=>{if(!a)return;const x=N=>{if(!(!a||u.length===0)&&(N.key==="ArrowDown"&&(N.preventDefault(),w(M=>Math.min(M+1,u.length-1))),N.key==="ArrowUp"&&(N.preventDefault(),w(M=>Math.max(M-1,0))),N.key==="Enter")){N.preventDefault();const M=u[O];M&&m(M)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,O]),e.useEffect(()=>{if(!j.current)return;const N=j.current.querySelectorAll("li")[O];N&&N.scrollIntoView({block:"nearest",behavior:"smooth"})},[O]),a?e.createElement("ul",{ref:j,className:"rte-popup",style:{top:d.y,left:d.x}},u.length>0?u.map(({name:x,value:N},M)=>{const W=x.toLowerCase(),b=L.toLowerCase(),k=W.indexOf(b);let _=x;if(k!==-1&&L.length>0){const I=k+L.length;_=x.substring(0,k)+`<span class="rte-highlight">${x.substring(k,I)}</span>`+x.substring(I)}return e.createElement("li",{key:N,onMouseDown:I=>{I.preventDefault(),m({name:x,value:N})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:M===O?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:_},onMouseEnter:()=>w(M)})}):e.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function we(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function oe(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const Ct=({visible:a,x:d,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:d};return e.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},e.createElement("button",{onClick:()=>m("insertRowAbove")},e.createElement(oe,null)," Insert row above"),e.createElement("button",{onClick:()=>m("insertRowBelow")},e.createElement(oe,null)," Insert row below"),e.createElement("button",{onClick:()=>m("insertColLeft")},e.createElement(oe,null)," Insert col left"),e.createElement("button",{onClick:()=>m("insertColRight")},e.createElement(oe,null)," Insert col right"),e.createElement("button",{onClick:()=>m("deleteRow")},e.createElement(we,null)," Delete row"),e.createElement("button",{onClick:()=>m("deleteCol")},e.createElement(we,null)," Delete column"))};function ye(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function be(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ce=({html:a,className:d,style:u,attributes:m,setAttributes:v})=>{const[L,j]=e.useState("web"),O={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},w=b=>{const k=b.target;if(k.tagName==="A"){b.preventDefault();const _=k.href;_&&window.open(_,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",N=b=>{const k=document.createElement("div");k.innerHTML=b;const _=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,null),I=[];for(;_.nextNode();){const P=_.currentNode;P.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(P.nodeValue)&&I.push(P)}return I.forEach(P=>{var F;const q=P.nodeValue||"",K=P.parentElement;if(!K)return;let X=K,S=!1;for(;X;){if(X.tagName==="FONT"&&X.getAttribute("color")){S=!0;break}const V=(F=X.style)==null?void 0:F.color;if(V&&!x(V)){S=!0;break}const Y=window.getComputedStyle(X);if(Y.color&&!x(Y.color)){S=!0;break}X=X.parentElement}const H=document.createDocumentFragment();let B=0;q.replace(/{{\s*([\s\S]*?)\s*}}/g,(V,Y,f)=>{if(f>B&&H.appendChild(document.createTextNode(q.slice(B,f))),S)H.appendChild(document.createTextNode(V));else{const y=document.createElement("span");y.style.color="blue",y.textContent=V,H.appendChild(y)}return B=f+V.length,V}),B<q.length&&H.appendChild(document.createTextNode(q.slice(B))),K.replaceChild(H,P)}),k.innerHTML=k.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),k.innerHTML},M=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),W=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return e.createElement("div",{className:`rte-preview ${d||""}`,style:re(ne({},u),{position:"relative"}),onClick:w},e.createElement("div",{className:"rte-preview-device-picker"},e.createElement("select",{value:L,onChange:b=>j(b.target.value)},Object.entries(O).map(([b,k])=>e.createElement("option",{key:b,value:b},k.label)))),L==="web"&&e.createElement("div",{className:"rte-preview-web-wrapper"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&e.createElement("div",{className:"rte-preview-mobile-overlay"},e.createElement("div",{className:"rte-preview-mobile-frame",style:{width:O[L].width,height:O[L].height}},e.createElement("div",{className:"rte-preview-mobile-header"},e.createElement("div",{className:"rte-preview-logo"},"A"),e.createElement("div",{className:"rte-preview-bell"},"🔔",e.createElement("span",{className:"rte-preview-badge"},"99+"))),e.createElement("div",{className:"rte-preview-tabs-wrapper"},e.createElement("div",{className:"rte-preview-tabs"},e.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),e.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),e.createElement("div",{className:"rte-preview-mobile-body"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",M()),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},W())))))),e.createElement("div",null,e.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),e.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>e.createElement("div",{key:b,className:"rte-attr-row"},e.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),e.createElement("span",null," : "),e.createElement("input",{className:"rte-attr-input",value:m[b]||"",onChange:k=>{const _=k.target.value;v(I=>re(ne({},I),{[b]:_}))},placeholder:"Enter value"}))))))},Lt=({visible:a,linkData:d,onClose:u,onInsert:m})=>{const[v,L]=e.useState(""),[j,O]=e.useState(""),[w,x]=e.useState(""),[N,M]=e.useState("_self");if(e.useEffect(()=>{a?(L(d.url||""),O(d.text||""),x(d.title||""),M(d.target||"_self")):(L(""),O(""),x(""),M("_self"))},[a,d]),!a)return null;const W=()=>{m({url:v,text:j,title:w,target:N})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),e.createElement("div",{className:"rte-link-modal"},e.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:j,onChange:b=>O(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),e.createElement("select",{className:"rte-link-modal__select",value:N,onChange:b=>M(b.target.value)},e.createElement("option",{value:"_self"},"Same tab"),e.createElement("option",{value:"_blank"},"New tab")),e.createElement("div",{className:"rte-link-modal__actions"},e.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),e.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:W},"OK"))))};function Le(a){const d=new Map;return a.forEach(u=>{d.set(u.name,u.value)}),Array.from(d.entries()).map(([u,m])=>({name:u,value:m}))}const St=({atSuggestions:a=[],showOutput:d=!1,showPreview:u=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:L={},handleGetHtml:j=()=>{},onChange:O=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:N=()=>{}})=>{var Oe,He,Pe,je,_e,Fe,Ie,qe,Be,Ve,Ue,$e;const M=e.useRef(null),[W,b]=e.useState(w!=null&&w.length?w:" "),[k,_]=e.useState(""),[I,P]=e.useState(!1),[q,K]=e.useState({x:0,y:0}),[X,S]=e.useState([]),H=e.useRef(null),B=e.useRef(null),[F,V]=e.useState({visible:!1,x:0,y:0}),[Y,f]=e.useState(!1),y=e.useRef(null),[Z,G]=e.useState({url:"",text:"",title:"",target:"_self"}),ie={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(Oe=m.unorderedList)!=null?Oe:!0,orderedList:(He=m.orderedList)!=null?He:!0,staticUnorderedList:(Pe=m.staticUnorderedList)!=null?Pe:!0,staticOrderedList:(je=m.staticOrderedList)!=null?je:!0,align:!0,link:(_e=m.link)!=null?_e:!1,image:(Fe=m.image)!=null?Fe:!1,emoji:(Ie=m.emoji)!=null?Ie:!1,table:(qe=m.table)!=null?qe:!1,color:(Be=m.color)!=null?Be:!1,fontFamily:(Ve=m.fontFamily)!=null?Ve:!1,fontSize:(Ue=m.fontSize)!=null?Ue:!1,highlight:($e=m.fontSize)!=null?$e:!1},[ce,J]=e.useState(""),[se,de]=e.useState([]),[Se,xe]=e.useState({}),U=()=>M.current,T=()=>{const t=xt(),n=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(t.trim());let r=t;n||(r=`<div style="font-size: 12px; color: #4f5055;">${t}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(i,p,E)=>{if(/list-type=["']static["']/.test(E)||i.includes("data-hidden-array-start")||i.includes("data-hidden-array-end"))return i;const h=`<${p}${E}>`,c='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',g='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',C=`</${p}>`,z=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${c}${z}${g}${C}`}),_(r),j==null||j(r);const l=Wt(t);O(l);const s=Ot(),o=Le(s);JSON.stringify(o)!==JSON.stringify(se)&&(de(o),x(o),en(o))},xt=()=>{const t=U();if(!t)return W;const n=t.cloneNode(!0);n.querySelectorAll("table div").forEach(l=>l.remove()),n.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),n.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=n.innerHTML;return r=Nt(r),r},Nt=t=>{const n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),n.innerHTML},Q=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=document.getElementById("rte-editor-body");if(!n)return;const r=t.getRangeAt(0);n.contains(r.startContainer)&&(H.current=r.cloneRange())},R=()=>{const t=window.getSelection();!t||!H.current||(t.removeAllRanges(),t.addRange(H.current))},Ne=(t,n)=>{const r=window.getSelection();r&&r.rangeCount>0&&(H.current=r.getRangeAt(0)),R(),document.execCommand(t,!1,n),T()};e.useEffect(()=>{const t=U();if(!t||!w)return;const n=Mt(w);t.innerHTML=n,T()},[]);const Mt=t=>t.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,n=>n.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));e.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),e.useEffect(()=>{N&&N(t=>{Dt(t)})},[]),e.useEffect(()=>{const t=U();if(!t)return;t.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(he(r),r.querySelectorAll("th, td").forEach(s=>ee(s)))})},[]);const Me=t=>{for(;t&&t.nodeName!=="LI";)t=t.parentNode;return t},Te=(t,n)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=Me(l.startContainer);let o,i;const p=n==="insertStaticUnorderedList"||n==="insertStaticOrderedList";if(s){let c=s.querySelector(t);c||(c=document.createElement(t),c.style.margin="0",c.style.paddingLeft="20px",s.appendChild(c)),i=c,o=document.createElement("li"),o.textContent="",i.appendChild(o)}else{document.execCommand(t==="ul"?"insertUnorderedList":"insertOrderedList");const c=U();if(i=c==null?void 0:c.querySelector(`${t}:last-child`),!i)return;p&&i.setAttribute("list-type","static"),o=i.querySelector("li:last-child")}const E=document.createRange();E.setStart(o,0),E.collapse(!0),r.removeAllRanges(),r.addRange(E),(h=U())==null||h.focus(),T()},ue=(t,n)=>{t==="insertOrderedList"||t==="insertStaticOrderedList"?Te("ol",t):t==="insertUnorderedList"||t==="insertStaticUnorderedList"?Te("ul",t):t.startsWith("justify")?Zt(t):Ne(t,n),t==="insertTable"&&ke(),t==="insertStaticTable"&&ke("insertStaticTable")},Tt=t=>{const n=document.createElement("span");n.textContent="",t.insertNode(n),t.setStartAfter(n),t.collapse(!0);const r=n.getBoundingClientRect();n.remove(),K({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),P(!0),B.current=t.cloneRange()},At=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.anchorNode;let r=t.anchorOffset;if(!n)return null;let l=n;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=n.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===n?r:s.length,i=s.lastIndexOf("@",o-1);if(i!==-1){const p=document.createRange();return p.setStart(l,i),p.setEnd(l,o),p}}l=l.previousSibling}return null},kt=t=>{var o;const n=window.getSelection();if(!n)return;const r=At();r?(n.removeAllRanges(),n.addRange(r)):B.current&&(n.removeAllRanges(),n.addRange(B.current));const l=document.createElement("span");l.textContent=`{{${t.name}}}`,l.style.display="inline",l.setAttribute("data-mention",t.value||t.name||""),l.title=`{{${t.name}}}`;try{const i=n.rangeCount?n.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),c=U();h.selectNodeContents(c),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),n.removeAllRanges(),n.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Le([...se,t]);de(s),x(s),P(!1),(o=U())==null||o.focus(),T()},zt=t=>{const n=U();if(!n)return;let r=null;H.current&&n.contains(H.current.startContainer)?r=H.current.cloneRange():(r=document.createRange(),r.selectNodeContents(n),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${t.name}}}`,s.style.display="inline",s.setAttribute("data-mention",t.value||t.name),s.title=`{{${t.name}}}`,r.insertNode(s);const o=document.createTextNode(" ");s.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),l.removeAllRanges(),l.addRange(i),H.current=i.cloneRange(),n.focus()},Dt=t=>{t.forEach(n=>zt(n)),de(n=>{const r=[...n,...t],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),T()},Ot=()=>{const t=U();if(!t)return[];const n=t.querySelectorAll("span[data-mention]"),r=[];return n.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},Ht=t=>{var r,l,s;const n=t.key.toLowerCase();if((t.ctrlKey||t.metaKey)&&["b","i","u"].includes(n)&&(t.preventDefault(),ue(n==="b"?"bold":n==="i"?"italic":n==="u"?"underline":"")),t.shiftKey&&t.key==="2"&&t.preventDefault(),t.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?Me(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){t.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const c=document.createElement("p");c.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(c,h.nextSibling);const g=document.createRange();g.setStart(c,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const c=i.closest("ul, ol");if(c){const g=document.createElement("p");g.innerHTML="<br />",(s=c.parentElement)==null||s.insertBefore(g,c.nextSibling),c.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}T()}}if(n==="backspace"||n==="delete"){const o=window.getSelection();if(!o||o.rangeCount===0)return;const i=o.getRangeAt(0);if(i.cloneContents().querySelector("table"))return;if(i.cloneContents().querySelectorAll(".rte-resize-handle").length>0){t.preventDefault(),t.stopPropagation();return}}},Pt=t=>{if(t.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(me(l))return;setTimeout(()=>{Tt(r.getRangeAt(0)),J(""),S(a),P(!0)},0);return}if(I){setTimeout(()=>Ae(),0);return}},me=t=>{if(!t)return!1;let n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;n;){if(n.tagName==="TH")return!0;n=n.parentElement}return!1},Ae=()=>{T();const t=window.getSelection();if(!t||!t.anchorNode)return;if(me(t.anchorNode)){P(!1);return}let n=t.anchorNode.textContent||"";n=n.replace(/\u00A0/g," ");const r=n.match(/@([^\n]*)$/);if(!r){P(!1);return}const l=r[1].trim().toLowerCase();J(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),P(!0)):P(!1)},jt=t=>{var l;const n=(l=t.target.files)==null?void 0:l[0];if(!n)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;R();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=n.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=U();if(!p||!h){h==null||h.appendChild(E);const z=document.createTextNode(" ");h==null||h.appendChild(z);const te=document.createRange();te.setStartAfter(z),te.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(te),h==null||h.focus(),T(),t.target.value="";return}p.deleteContents(),p.insertNode(E);const c=document.createTextNode(" ");E.after(c);const g=document.createRange();g.setStartAfter(c),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),T(),t.target.value=""},r.readAsDataURL(n)},_t=t=>{var s;R();const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const r=n.getRangeAt(0),l=document.createTextNode(t);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),n.removeAllRanges(),n.addRange(r),(s=U())==null||s.focus(),T()},ke=t=>{var c;Gt(),R();const n=document.createElement("table");n.style.borderCollapse="collapse",n.style.width="310px",n.style.border="1px solid #ccc",n.style.margin="8px 0",n.style.position="relative",n.style.textAlign="center",v.table&&n.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),t==="insertStaticTable"&&l.setAttribute("table-type","static");const s=document.createElement("tr");v.tr&&s.classList.add(v.tr);const o=document.createElement("tr");v.tr&&o.classList.add(v.tr);for(let g=0;g<2;g++){const C=document.createElement("th");C.textContent="",C.style.border="1px solid #999",C.style.padding="4px",C.style.position="relative",C.style.backgroundColor="lightgray",C.style.height="20px",v.th&&C.classList.add(v.th);const z=document.createElement("td");z.textContent="",z.style.border="1px solid #999",z.style.padding="4px",z.style.position="relative",z.style.backgroundColor="#fff",z.style.minHeight="20px",z.style.height="20px",z.style.whiteSpace="normal",z.style.wordBreak="break-word",z.style.overflowWrap="anywhere",z.style.lineHeight="20px",z.style.minWidth="20px",v.td&&z.classList.add(v.td),ee(C),ee(z),s.appendChild(C),o.appendChild(z)}r.appendChild(s),l.appendChild(o),n.appendChild(r),n.appendChild(l),he(n);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(n);const E=document.createElement("p");E.innerHTML="<br/>",n.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(c=U())==null||c.focus(),T()},he=t=>{if(t.dataset.hasResizeHandle==="true")return;const n=document.createElement("div");Object.assign(n.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),n.contentEditable="false",n.dataset.hasResizeHandle="true",n.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;n.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=t.getBoundingClientRect();s=p.width,o=p.height;const E=c=>{const g=Math.max(100,s+(c.clientX-r)),C=Math.max(20,o+(c.clientY-l));t.style.width=`${g}px`,t.style.height=`${C}px`,T()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),t.appendChild(n)},ee=t=>{const n=document.createElement("div"),r=document.createElement("div");Object.assign(n.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),n.contentEditable="false",n.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),Ft(t,n,r),t.appendChild(n),t.appendChild(r)},Ft=(t,n,r)=>{let l=0,s=0,o=0,i=0;n.addEventListener("mousedown",c=>{c.preventDefault(),l=c.clientX,o=t.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",c=>{c.preventDefault(),s=c.clientY,i=t.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=c=>{const g=o+(c.clientX-l);t.style.width=`${Math.max(30,g)}px`,T()},E=c=>{const g=i+(c.clientY-s);t.style.height=`${Math.max(20,g)}px`,T()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()}},It=t=>{const r=t.target.closest("td, th");r&&(t.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),V({visible:!0,x:t.clientX,y:t.clientY,cell:r}))},ze=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(t=>t.classList.remove("rte-cell-highlight"))},qt=t=>{if(!F.cell)return;const n=F.cell.closest("table"),r=F.cell.cellIndex,l=F.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,ee(p),p};switch(t){case"insertRowAbove":{const o=n.rows[l],i=n.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=n.rows[l],i=n.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":n.rows.length>1&&n.deleteRow(l);break;case"deleteCol":Array.from(n.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}T(),V(re(ne({},F),{visible:!1})),ze()},Bt=()=>{Q(),y.current=H.current,G({url:"",text:"",title:"",target:"_self"}),f(!0)},Vt=t=>{const n=window.getSelection();if(!n||!y.current)return;n.removeAllRanges(),n.addRange(y.current);let r=t.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=t.text||r,l.title=t.title,l.target=t.target,l.contentEditable="true";const s=n.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),n.removeAllRanges(),n.addRange(i),f(!1),T()},Ut=t=>{const n=t.target;if(n.tagName==="A"){const r=n;if(t.ctrlKey||t.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}t.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,G({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},$t=()=>{const t=U();if(!t)return;const n=window.getSelection();if((!n||n.rangeCount===0)&&H.current){const c=window.getSelection();c==null||c.removeAllRanges(),c==null||c.addRange(H.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);R(),document.execCommand("removeFormat",!1);const s=l.cloneContents(),o=document.createElement("div");o.appendChild(s);const i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,null),p=[];for(;i.nextNode();){const c=i.currentNode,g=c.tagName.toUpperCase(),C=c.getAttribute&&c.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(c)}for(let c=p.length-1;c>=0;c--){const g=p[c],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(c=>c.removeAttribute("style")),l.deleteContents();const E=document.createDocumentFragment();for(;o.firstChild;)E.appendChild(o.firstChild);l.insertNode(E);const h=document.createRange();h.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),h.collapse(!0),r.removeAllRanges(),r.addRange(h),t.normalize(),T()},Wt=t=>{var l;let n=t;n=n.replace(/{{#arrayData\d*}}/g,""),n=n.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("br").forEach(s=>{s.replaceWith(`
|
|
2
2
|
`)}),r.querySelectorAll("p, div, tr").forEach(s=>{s.insertAdjacentText("afterend",`
|
|
3
3
|
`)}),r.querySelectorAll("table").forEach(s=>{s.insertAdjacentText("afterend",`
|
|
4
4
|
`)}),((l=r.textContent)==null?void 0:l.replace(/\n{3,}/g,`
|
|
5
5
|
|
|
6
|
-
`).trim())||""};function Xt(){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(n.collapsed){let o=n.startContainer,i=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;const p=i==null?void 0:i.closest("td, th");return p?[p]:[]}const r=n.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(o=>{const i=document.createRange();return i.selectNodeContents(o),n.compareBoundaryPoints(Range.END_TO_START,i)<0&&n.compareBoundaryPoints(Range.START_TO_END,i)>0})}function Zt(t){const n=Xt();if(n.length===0){Ne(t);return}let r="left";t==="justifyCenter"&&(r="center"),t==="justifyRight"&&(r="right"),n.forEach(l=>{l.style.textAlign=r}),T()}const Kt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return!1;let n=t.anchorNode.nodeType===Node.ELEMENT_NODE?t.anchorNode:t.anchorNode.parentElement;for(;n;){if(n.tagName==="TABLE")return!0;n=n.parentElement}return!1},Yt=t=>{if(Kt()){t.preventDefault();const h=t.clipboardData.getData("text/plain");if(!h)return;const c=window.getSelection();if(!c||!c.rangeCount)return;const g=c.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((z,te)=>{g.insertNode(document.createTextNode(z)),te<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),c.removeAllRanges(),c.addRange(g),T();return}const n=t.clipboardData.getData("text/html")||"";if(!n)return;const r=document.createElement("div");if(r.innerHTML=n,r.querySelector("img")){t.preventDefault();return}t.preventDefault();const l=document.createElement("div");l.innerHTML=n;const s=h=>{h.hasAttribute("data-has-resize-handle")||(h.style.borderCollapse="collapse",h.style.width="100%",h.style.border="1px solid #ccc",h.style.margin="8px 0",h.style.position="relative",h.style.textAlign="center",h.querySelectorAll("th").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="lightgray",g.style.height="20px"}),h.querySelectorAll("td").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="#fff",g.style.height="20px"}))};l.querySelectorAll("table").forEach(h=>s(h));const o=window.getSelection();if(!o||!o.rangeCount)return;const i=o.getRangeAt(0);i.deleteContents();const p=document.createDocumentFragment();for(;l.firstChild;)p.appendChild(l.firstChild);i.insertNode(p),i.collapse(!1),o.removeAllRanges(),o.addRange(i);const E=M.current;E&&(E.querySelectorAll("table").forEach(h=>{const c=h;c.hasAttribute("data-has-resize-handle")||(he(c),c.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||ee(C)}))}),T())},Qt=t=>{R();const n=window.getSelection();if(!n||!n.rangeCount)return;const r=n.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${t}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),n.removeAllRanges(),n.addRange(s),T()},Rt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return null;const n=t.anchorNode;if(me(n)||n.nodeType!==Node.TEXT_NODE)return null;const r=n.textContent||"",l=t.anchorOffset,s=r.lastIndexOf("@",l-1);if(s===-1)return null;const o=r.substring(s+1,l);if(o.includes(" ")||o.includes(" "))return null;const i=document.createRange();return i.setStart(n,s),i.setEnd(n,l),{range:i,query:o}},De=()=>{const t=Rt();if(!t)return;const{range:n,query:r}=t,l=document.createElement("span");l.textContent="",n.insertNode(l);const s=l.getBoundingClientRect();l.remove(),K({x:s.left,y:s.bottom+window.scrollY}),J(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),P(!0),
|
|
6
|
+
`).trim())||""};function Xt(){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(n.collapsed){let o=n.startContainer,i=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;const p=i==null?void 0:i.closest("td, th");return p?[p]:[]}const r=n.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(o=>{const i=document.createRange();return i.selectNodeContents(o),n.compareBoundaryPoints(Range.END_TO_START,i)<0&&n.compareBoundaryPoints(Range.START_TO_END,i)>0})}function Zt(t){const n=Xt();if(n.length===0){Ne(t);return}let r="left";t==="justifyCenter"&&(r="center"),t==="justifyRight"&&(r="right"),n.forEach(l=>{l.style.textAlign=r}),T()}const Kt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return!1;let n=t.anchorNode.nodeType===Node.ELEMENT_NODE?t.anchorNode:t.anchorNode.parentElement;for(;n;){if(n.tagName==="TABLE")return!0;n=n.parentElement}return!1},Yt=t=>{if(Kt()){t.preventDefault();const h=t.clipboardData.getData("text/plain");if(!h)return;const c=window.getSelection();if(!c||!c.rangeCount)return;const g=c.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((z,te)=>{g.insertNode(document.createTextNode(z)),te<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),c.removeAllRanges(),c.addRange(g),T();return}const n=t.clipboardData.getData("text/html")||"";if(!n)return;const r=document.createElement("div");if(r.innerHTML=n,r.querySelector("img")){t.preventDefault();return}t.preventDefault();const l=document.createElement("div");l.innerHTML=n;const s=h=>{h.hasAttribute("data-has-resize-handle")||(h.style.borderCollapse="collapse",h.style.width="100%",h.style.border="1px solid #ccc",h.style.margin="8px 0",h.style.position="relative",h.style.textAlign="center",h.querySelectorAll("th").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="lightgray",g.style.height="20px"}),h.querySelectorAll("td").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="#fff",g.style.height="20px"}))};l.querySelectorAll("table").forEach(h=>s(h));const o=window.getSelection();if(!o||!o.rangeCount)return;const i=o.getRangeAt(0);i.deleteContents();const p=document.createDocumentFragment();for(;l.firstChild;)p.appendChild(l.firstChild);i.insertNode(p),i.collapse(!1),o.removeAllRanges(),o.addRange(i);const E=M.current;E&&(E.querySelectorAll("table").forEach(h=>{const c=h;c.hasAttribute("data-has-resize-handle")||(he(c),c.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||ee(C)}))}),T())},Qt=t=>{R();const n=window.getSelection();if(!n||!n.rangeCount)return;const r=n.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${t}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),n.removeAllRanges(),n.addRange(s),T()},Rt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return null;const n=t.anchorNode;if(me(n)||n.nodeType!==Node.TEXT_NODE)return null;const r=n.textContent||"",l=t.anchorOffset,s=r.lastIndexOf("@",l-1);if(s===-1)return null;const o=r.substring(s+1,l);if(o.includes(" ")||o.includes(" "))return null;const i=document.createRange();return i.setStart(n,s),i.setEnd(n,l),{range:i,query:o}},De=()=>{const t=Rt();if(!t)return;const{range:n,query:r}=t,l=document.createElement("span");l.textContent="",n.insertNode(l);const s=l.getBoundingClientRect();l.remove(),K({x:s.left,y:s.bottom+window.scrollY}),J(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),P(!0),B.current=n.cloneRange()};function Gt(){const t=M.current;if(!t)return;const n=window.getSelection();if(!n||n.rangeCount>0&&t.contains(n.anchorNode))return;const r=document.createRange();r.selectNodeContents(t),r.collapse(!1),n.removeAllRanges(),n.addRange(r),H.current=r.cloneRange()}const Jt=t=>{const n=t.target;if(!n||!(n.textContent||"").match(/{{([\s\S]+?)}}/)||!M.current)return;let o=n.firstChild;if((!o||o.nodeType!==Node.TEXT_NODE)&&(o=n.childNodes[0]),!o||o.nodeType!==Node.TEXT_NODE)return;const i=o.textContent||"",p=i.indexOf("{{"),E=i.indexOf("}}");if(p===-1||E===-1)return;const h=window.getSelection();if(!h)return;const c=document.createRange();c.setStart(o,p),c.setEnd(o,E+2),h.removeAllRanges(),h.addRange(c)},en=t=>{xe(n=>{const r={};return t.forEach(l=>{var s;r[l.name]=(s=n[l.name])!=null?s:""}),r})},tn=()=>{let t=k;return Object.entries(Se).forEach(([n,r])=>{if(r.trim()){const l=new RegExp(`{{\\s*${n}\\s*}}`,"g");t=t.replace(l,r)}}),t};return e.createElement("div",{className:`rte-wrapper ${(v==null?void 0:v.wrapper)||""}`,style:L.wrapper},e.createElement("div",{style:{flex:1}},e.createElement(Ee,{exec:ue,saveSelection:Q,handleFileChange:jt,handleFontSizeChange:t=>Qt(t.target.value),handleFontFamilyChange:t=>ue("fontName",t.target.value),insertEmoji:_t,handleLink:Bt,removeFormatting:$t,visibleActions:ie,className:v.toolbar,style:L.toolbar}),e.createElement("div",{ref:M,id:"rte-editor-body",className:`rte-editor ${(v==null?void 0:v.editor)||""}`,style:L.editor,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:Yt,onKeyUp:()=>{Q(),De()},onMouseUp:Q,onInput:()=>{Ae(),Q()},onKeyDown:Ht,onBeforeInput:Pt,onContextMenu:It,onClick:t=>{Ut(t),Q(),De()},onDoubleClick:Jt}),e.createElement(bt,{show:I,position:q,filtered:X,insertMention:kt,onClose:()=>P(!1),query:ce}),d&&e.createElement("div",{className:`rte-output ${(v==null?void 0:v.output)||""}`,style:L.output},e.createElement("h4",null,"Output HTML:"),e.createElement("p",null,k)),e.createElement(Ct,{visible:F.visible,x:F.x,y:F.y,onAction:qt,onClose:()=>{V(re(ne({},F),{visible:!1})),ze()}}),e.createElement(Lt,{visible:Y,linkData:Z,onClose:()=>f(!1),onInsert:Vt})),u?e.createElement(Ce,{className:v.preview,style:L.preview,html:tn(),attributes:Se,setAttributes:xe}):null)};D.RichTextEditor=St,D.RtePreview=Ce,D.RteToolbar=Ee,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
|