@ryzeup/richtexteditor 1.0.11 → 1.0.14

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 CHANGED
@@ -1,173 +1,173 @@
1
- var ot = Object.defineProperty, lt = Object.defineProperties;
2
- var ct = Object.getOwnPropertyDescriptors;
3
- var Le = Object.getOwnPropertySymbols;
4
- var it = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
5
- var Re = (n, c, s) => c in n ? ot(n, c, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[c] = s, re = (n, c) => {
6
- for (var s in c || (c = {}))
7
- it.call(c, s) && Re(n, s, c[s]);
8
- if (Le)
9
- for (var s of Le(c))
10
- st.call(c, s) && Re(n, s, c[s]);
11
- return n;
12
- }, ae = (n, c) => lt(n, ct(c));
13
- import * as dt from "react";
14
- import o, { useRef as P, useState as S, useEffect as I } from "react";
15
- import { createPortal as ut } from "react-dom";
16
- window.React = dt;
17
- var Ae = {
1
+ var lt = Object.defineProperty, ct = Object.defineProperties;
2
+ var it = Object.getOwnPropertyDescriptors;
3
+ var Re = Object.getOwnPropertySymbols;
4
+ var st = Object.prototype.hasOwnProperty, dt = Object.prototype.propertyIsEnumerable;
5
+ var Se = (r, c, d) => c in r ? lt(r, c, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[c] = d, ae = (r, c) => {
6
+ for (var d in c || (c = {}))
7
+ st.call(c, d) && Se(r, d, c[d]);
8
+ if (Re)
9
+ for (var d of Re(c))
10
+ dt.call(c, d) && Se(r, d, c[d]);
11
+ return r;
12
+ }, oe = (r, c) => ct(r, it(c));
13
+ import * as ut from "react";
14
+ import a, { useRef as I, useState as S, useEffect as P } from "react";
15
+ import { createPortal as mt } from "react-dom";
16
+ window.React = ut;
17
+ var Ne = {
18
18
  color: void 0,
19
19
  size: void 0,
20
20
  className: void 0,
21
21
  style: void 0,
22
22
  attr: void 0
23
- }, Se = o.createContext && /* @__PURE__ */ o.createContext(Ae), mt = ["attr", "size", "title"];
24
- function ft(n, c) {
25
- if (n == null) return {};
26
- var s = gt(n, c), u, m;
23
+ }, Me = a.createContext && /* @__PURE__ */ a.createContext(Ne), gt = ["attr", "size", "title"];
24
+ function ft(r, c) {
25
+ if (r == null) return {};
26
+ var d = ht(r, c), u, g;
27
27
  if (Object.getOwnPropertySymbols) {
28
- var y = Object.getOwnPropertySymbols(n);
29
- for (m = 0; m < y.length; m++)
30
- u = y[m], !(c.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(n, u) && (s[u] = n[u]);
28
+ var y = Object.getOwnPropertySymbols(r);
29
+ for (g = 0; g < y.length; g++)
30
+ u = y[g], !(c.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(r, u) && (d[u] = r[u]);
31
31
  }
32
- return s;
32
+ return d;
33
33
  }
34
- function gt(n, c) {
35
- if (n == null) return {};
36
- var s = {};
37
- for (var u in n)
38
- if (Object.prototype.hasOwnProperty.call(n, u)) {
34
+ function ht(r, c) {
35
+ if (r == null) return {};
36
+ var d = {};
37
+ for (var u in r)
38
+ if (Object.prototype.hasOwnProperty.call(r, u)) {
39
39
  if (c.indexOf(u) >= 0) continue;
40
- s[u] = n[u];
40
+ d[u] = r[u];
41
41
  }
42
- return s;
42
+ return d;
43
43
  }
44
- function Z() {
45
- return Z = Object.assign ? Object.assign.bind() : function(n) {
44
+ function Q() {
45
+ return Q = Object.assign ? Object.assign.bind() : function(r) {
46
46
  for (var c = 1; c < arguments.length; c++) {
47
- var s = arguments[c];
48
- for (var u in s)
49
- Object.prototype.hasOwnProperty.call(s, u) && (n[u] = s[u]);
47
+ var d = arguments[c];
48
+ for (var u in d)
49
+ Object.prototype.hasOwnProperty.call(d, u) && (r[u] = d[u]);
50
50
  }
51
- return n;
52
- }, Z.apply(this, arguments);
51
+ return r;
52
+ }, Q.apply(this, arguments);
53
53
  }
54
- function Me(n, c) {
55
- var s = Object.keys(n);
54
+ function ze(r, c) {
55
+ var d = Object.keys(r);
56
56
  if (Object.getOwnPropertySymbols) {
57
- var u = Object.getOwnPropertySymbols(n);
58
- c && (u = u.filter(function(m) {
59
- return Object.getOwnPropertyDescriptor(n, m).enumerable;
60
- })), s.push.apply(s, u);
57
+ var u = Object.getOwnPropertySymbols(r);
58
+ c && (u = u.filter(function(g) {
59
+ return Object.getOwnPropertyDescriptor(r, g).enumerable;
60
+ })), d.push.apply(d, u);
61
61
  }
62
- return s;
62
+ return d;
63
63
  }
64
- function Q(n) {
64
+ function J(r) {
65
65
  for (var c = 1; c < arguments.length; c++) {
66
- var s = arguments[c] != null ? arguments[c] : {};
67
- c % 2 ? Me(Object(s), !0).forEach(function(u) {
68
- ht(n, u, s[u]);
69
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(s)) : Me(Object(s)).forEach(function(u) {
70
- Object.defineProperty(n, u, Object.getOwnPropertyDescriptor(s, u));
66
+ var d = arguments[c] != null ? arguments[c] : {};
67
+ c % 2 ? ze(Object(d), !0).forEach(function(u) {
68
+ pt(r, u, d[u]);
69
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : ze(Object(d)).forEach(function(u) {
70
+ Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(d, u));
71
71
  });
72
72
  }
73
- return n;
73
+ return r;
74
74
  }
75
- function ht(n, c, s) {
76
- return c = pt(c), c in n ? Object.defineProperty(n, c, { value: s, enumerable: !0, configurable: !0, writable: !0 }) : n[c] = s, n;
75
+ function pt(r, c, d) {
76
+ return c = vt(c), c in r ? Object.defineProperty(r, c, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[c] = d, r;
77
77
  }
78
- function pt(n) {
79
- var c = vt(n, "string");
78
+ function vt(r) {
79
+ var c = Et(r, "string");
80
80
  return typeof c == "symbol" ? c : c + "";
81
81
  }
82
- function vt(n, c) {
83
- if (typeof n != "object" || !n) return n;
84
- var s = n[Symbol.toPrimitive];
85
- if (s !== void 0) {
86
- var u = s.call(n, c);
82
+ function Et(r, c) {
83
+ if (typeof r != "object" || !r) return r;
84
+ var d = r[Symbol.toPrimitive];
85
+ if (d !== void 0) {
86
+ var u = d.call(r, c);
87
87
  if (typeof u != "object") return u;
88
88
  throw new TypeError("@@toPrimitive must return a primitive value.");
89
89
  }
90
- return (c === "string" ? String : Number)(n);
90
+ return (c === "string" ? String : Number)(r);
91
91
  }
92
- function Ne(n) {
93
- return n && n.map((c, s) => /* @__PURE__ */ o.createElement(c.tag, Q({
94
- key: s
95
- }, c.attr), Ne(c.child)));
92
+ function Te(r) {
93
+ return r && r.map((c, d) => /* @__PURE__ */ a.createElement(c.tag, J({
94
+ key: d
95
+ }, c.attr), Te(c.child)));
96
96
  }
97
- function M(n) {
98
- return (c) => /* @__PURE__ */ o.createElement(Et, Z({
99
- attr: Q({}, n.attr)
100
- }, c), Ne(n.child));
97
+ function M(r) {
98
+ return (c) => /* @__PURE__ */ a.createElement(yt, Q({
99
+ attr: J({}, r.attr)
100
+ }, c), Te(r.child));
101
101
  }
102
- function Et(n) {
103
- var c = (s) => {
102
+ function yt(r) {
103
+ var c = (d) => {
104
104
  var {
105
105
  attr: u,
106
- size: m,
106
+ size: g,
107
107
  title: y
108
- } = n, R = ft(n, mt), b = m || s.size || "1em", E;
109
- return s.className && (E = s.className), n.className && (E = (E ? E + " " : "") + n.className), /* @__PURE__ */ o.createElement("svg", Z({
108
+ } = r, R = ft(r, gt), b = g || d.size || "1em", E;
109
+ return d.className && (E = d.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ a.createElement("svg", Q({
110
110
  stroke: "currentColor",
111
111
  fill: "currentColor",
112
112
  strokeWidth: "0"
113
- }, s.attr, u, R, {
113
+ }, d.attr, u, R, {
114
114
  className: E,
115
- style: Q(Q({
116
- color: n.color || s.color
117
- }, s.style), n.style),
115
+ style: J(J({
116
+ color: r.color || d.color
117
+ }, d.style), r.style),
118
118
  height: b,
119
119
  width: b,
120
120
  xmlns: "http://www.w3.org/2000/svg"
121
- }), y && /* @__PURE__ */ o.createElement("title", null, y), n.children);
121
+ }), y && /* @__PURE__ */ a.createElement("title", null, y), r.children);
122
122
  };
123
- return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (s) => c(s)) : c(Ae);
123
+ return Me !== void 0 ? /* @__PURE__ */ a.createElement(Me.Consumer, null, (d) => c(d)) : c(Ne);
124
124
  }
125
- function yt(n) {
126
- return M({ 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: [] }] })(n);
125
+ function wt(r) {
126
+ return M({ 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: [] }] })(r);
127
127
  }
128
- function wt(n) {
129
- return M({ 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: [] }] })(n);
128
+ function Ct(r) {
129
+ return M({ 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: [] }] })(r);
130
130
  }
131
- function Ct(n) {
132
- return M({ 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: [] }] })(n);
131
+ function bt(r) {
132
+ return M({ 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: [] }] })(r);
133
133
  }
134
- function bt(n) {
135
- return M({ 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: [] }] })(n);
134
+ function xt(r) {
135
+ return M({ 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: [] }] })(r);
136
136
  }
137
- function xt(n) {
138
- return M({ 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: [] }] })(n);
137
+ function Lt(r) {
138
+ return M({ 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: [] }] })(r);
139
139
  }
140
- function Lt(n) {
141
- return M({ 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: [] }] })(n);
140
+ function Rt(r) {
141
+ return M({ 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: [] }] })(r);
142
142
  }
143
- function Rt(n) {
144
- return M({ 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: [] }] })(n);
143
+ function St(r) {
144
+ return M({ 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: [] }] })(r);
145
145
  }
146
- function St(n) {
147
- return M({ 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: [] }] })(n);
146
+ function Mt(r) {
147
+ return M({ 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: [] }] })(r);
148
148
  }
149
- function Mt(n) {
150
- return M({ 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: [] }] })(n);
149
+ function zt(r) {
150
+ return M({ 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: [] }] })(r);
151
151
  }
152
- function zt(n) {
153
- return M({ 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: [] }] })(n);
152
+ function kt(r) {
153
+ return M({ 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: [] }] })(r);
154
154
  }
155
- function kt(n) {
156
- return M({ 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: [] }] })(n);
155
+ function At(r) {
156
+ return M({ 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: [] }] })(r);
157
157
  }
158
- function At(n) {
159
- return M({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(n);
158
+ function Nt(r) {
159
+ return M({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(r);
160
160
  }
161
- function Nt(n) {
162
- return M({ 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: [] }] })(n);
161
+ function Tt(r) {
162
+ return M({ 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: [] }] })(r);
163
163
  }
164
- function Tt(n) {
165
- return M({ 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: [] }] })(n);
164
+ function Dt(r) {
165
+ return M({ 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: [] }] })(r);
166
166
  }
167
- function Dt(n) {
168
- return M({ 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: [] }] })(n);
167
+ function Ot(r) {
168
+ return M({ 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: [] }] })(r);
169
169
  }
170
- const Ot = [
170
+ const Ht = [
171
171
  "😀",
172
172
  "😁",
173
173
  "😂",
@@ -279,35 +279,35 @@ const Ot = [
279
279
  "👏",
280
280
  "🫶",
281
281
  "👐"
282
- ], Ht = ({
283
- exec: n,
282
+ ], jt = ({
283
+ exec: r,
284
284
  saveSelection: c,
285
- handleFileChange: s,
285
+ handleFileChange: d,
286
286
  handleFontSizeChange: u,
287
- handleFontFamilyChange: m,
287
+ handleFontFamilyChange: g,
288
288
  // insertListBlock,
289
289
  insertEmoji: y,
290
290
  handleLink: R,
291
291
  removeFormatting: b,
292
292
  visibleActions: E,
293
- className: D,
294
- style: j
293
+ className: T,
294
+ style: _
295
295
  }) => {
296
- var V, N;
297
- const k = P(null), O = P(null), x = P(null), [J, U] = S(!1), [B, q] = S({
296
+ var U, N;
297
+ const k = I(null), D = I(null), x = I(null), [G, W] = S(!1), [V, B] = S({
298
298
  x: 0,
299
299
  y: 0
300
300
  });
301
- I(() => {
302
- const g = (w) => {
303
- !w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && U(!1);
301
+ P(() => {
302
+ const p = (w) => {
303
+ !w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && W(!1);
304
304
  };
305
- return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
305
+ return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
306
306
  }, []);
307
- const F = (g) => {
308
- var H;
309
- g.preventDefault();
310
- const w = g.currentTarget.dataset.command;
307
+ const F = (p) => {
308
+ var O;
309
+ p.preventDefault();
310
+ const w = p.currentTarget.dataset.command;
311
311
  if (w)
312
312
  switch (w) {
313
313
  case "bold":
@@ -316,20 +316,20 @@ const Ot = [
316
316
  case "insertUnorderedList":
317
317
  case "insertOrderedList":
318
318
  case "removeFormat":
319
- n(w);
319
+ r(w);
320
320
  break;
321
321
  case "insertImage": {
322
- (H = k.current) == null || H.click();
322
+ (O = k.current) == null || O.click();
323
323
  break;
324
324
  }
325
325
  default:
326
326
  console.warn("Unknown command:", w);
327
327
  }
328
- }, G = (g) => {
329
- n("foreColor", g.target.value);
330
- }, ee = (g) => {
331
- n("backColor", g.target.value);
332
- }, [L, _] = S({
328
+ }, ee = (p) => {
329
+ r("foreColor", p.target.value);
330
+ }, te = (p) => {
331
+ r("backColor", p.target.value);
332
+ }, [L, j] = S({
333
333
  bold: !1,
334
334
  italic: !1,
335
335
  underline: !1,
@@ -346,9 +346,9 @@ const Ot = [
346
346
  color: !1,
347
347
  highlight: !1
348
348
  });
349
- return I(() => {
350
- const g = () => {
351
- _({
349
+ return P(() => {
350
+ const p = () => {
351
+ j({
352
352
  bold: document.queryCommandState("bold"),
353
353
  italic: document.queryCommandState("italic"),
354
354
  underline: document.queryCommandState("underline"),
@@ -366,117 +366,117 @@ const Ot = [
366
366
  highlight: document.queryCommandState("backColor")
367
367
  });
368
368
  };
369
- return document.addEventListener("selectionchange", g), () => document.removeEventListener("selectionchange", g);
370
- }, []), /* @__PURE__ */ o.createElement("div", {
371
- className: `rte-toolbar ${D || ""}`,
372
- style: j
373
- }, E.bold && /* @__PURE__ */ o.createElement("button", {
369
+ return document.addEventListener("selectionchange", p), () => document.removeEventListener("selectionchange", p);
370
+ }, []), /* @__PURE__ */ a.createElement("div", {
371
+ className: `rte-toolbar ${T || ""}`,
372
+ style: _
373
+ }, E.bold && /* @__PURE__ */ a.createElement("button", {
374
374
  "data-command": "bold",
375
375
  title: "Bold",
376
376
  onMouseDown: F,
377
377
  className: L.bold ? "rte-active" : ""
378
- }, /* @__PURE__ */ o.createElement(Lt, null)), E.italic && /* @__PURE__ */ o.createElement("button", {
378
+ }, /* @__PURE__ */ a.createElement(Rt, null)), E.italic && /* @__PURE__ */ a.createElement("button", {
379
379
  "data-command": "italic",
380
380
  title: "Italic",
381
381
  onMouseDown: F,
382
382
  className: L.italic ? "rte-active" : ""
383
- }, /* @__PURE__ */ o.createElement(St, null)), E.underline && /* @__PURE__ */ o.createElement("button", {
383
+ }, /* @__PURE__ */ a.createElement(Mt, null)), E.underline && /* @__PURE__ */ a.createElement("button", {
384
384
  "data-command": "underline",
385
385
  title: "Underline",
386
386
  onMouseDown: F,
387
387
  className: L.underline ? "rte-active" : ""
388
- }, /* @__PURE__ */ o.createElement(Nt, null)), E.unorderedList && /* @__PURE__ */ o.createElement("button", {
388
+ }, /* @__PURE__ */ a.createElement(Tt, null)), E.unorderedList && /* @__PURE__ */ a.createElement("button", {
389
389
  "data-command": "insertUnorderedList",
390
390
  onMouseDown: F,
391
391
  title: "UnorderedList",
392
392
  className: L.unorderedList ? "rte-active" : ""
393
- }, /* @__PURE__ */ o.createElement(zt, null)), E.orderedList && /* @__PURE__ */ o.createElement("button", {
393
+ }, /* @__PURE__ */ a.createElement(kt, null)), E.orderedList && /* @__PURE__ */ a.createElement("button", {
394
394
  "data-command": "insertOrderedList",
395
395
  title: "OrderedList",
396
396
  onMouseDown: F,
397
397
  className: L.orderedList ? "rte-active" : ""
398
- }, /* @__PURE__ */ o.createElement(bt, null)), E.link && /* @__PURE__ */ o.createElement("button", {
398
+ }, /* @__PURE__ */ a.createElement(xt, null)), E.link && /* @__PURE__ */ a.createElement("button", {
399
399
  "data-command": "createLink",
400
400
  title: "Link",
401
401
  onClick: R,
402
402
  className: L.link ? "rte-active" : ""
403
- }, /* @__PURE__ */ o.createElement(Mt, null)), E.removeFormat && /* @__PURE__ */ o.createElement("button", {
403
+ }, /* @__PURE__ */ a.createElement(zt, null)), E.removeFormat && /* @__PURE__ */ a.createElement("button", {
404
404
  "data-command": "Remove format",
405
405
  title: "removeFormat",
406
- onMouseDown: (g) => {
407
- g.preventDefault(), c(), b();
406
+ onMouseDown: (p) => {
407
+ p.preventDefault(), c(), b();
408
408
  },
409
409
  className: L.removeFormat ? "rte-active" : ""
410
- }, /* @__PURE__ */ o.createElement(Dt, null)), E.image && /* @__PURE__ */ o.createElement("button", {
410
+ }, /* @__PURE__ */ a.createElement(Ot, null)), E.image && /* @__PURE__ */ a.createElement("button", {
411
411
  "data-command": "insertImage",
412
412
  title: "Image",
413
413
  onMouseDown: F,
414
414
  className: L.image ? "rte-active" : ""
415
- }, /* @__PURE__ */ o.createElement(Ct, null)), /* @__PURE__ */ o.createElement("input", {
415
+ }, /* @__PURE__ */ a.createElement(bt, null)), /* @__PURE__ */ a.createElement("input", {
416
416
  type: "file",
417
417
  accept: "image/*",
418
418
  ref: k,
419
419
  style: {
420
420
  display: "none"
421
421
  },
422
- onChange: s
423
- }), E.emoji && /* @__PURE__ */ o.createElement("div", {
422
+ onChange: d
423
+ }), E.emoji && /* @__PURE__ */ a.createElement("div", {
424
424
  style: {
425
425
  position: "relative"
426
426
  }
427
- }, /* @__PURE__ */ o.createElement("button", {
427
+ }, /* @__PURE__ */ a.createElement("button", {
428
428
  title: "Emoji",
429
- onMouseDown: (g) => {
430
- g.preventDefault(), c();
431
- const w = g.currentTarget.getBoundingClientRect();
432
- q({
429
+ onMouseDown: (p) => {
430
+ p.preventDefault(), c();
431
+ const w = p.currentTarget.getBoundingClientRect();
432
+ B({
433
433
  x: w.left,
434
434
  y: w.bottom + 8
435
435
  // small spacing
436
- }), U((H) => !H);
436
+ }), W((O) => !O);
437
437
  },
438
438
  className: L.emoji ? "rte-active" : ""
439
- }, /* @__PURE__ */ o.createElement(kt, null)), J && /* @__PURE__ */ ut(/* @__PURE__ */ o.createElement("div", {
439
+ }, /* @__PURE__ */ a.createElement(At, null)), G && /* @__PURE__ */ mt(/* @__PURE__ */ a.createElement("div", {
440
440
  className: "rte-emoji-popup",
441
441
  style: {
442
- top: B.y,
443
- left: B.x
442
+ top: V.y,
443
+ left: V.x
444
444
  }
445
- }, Ot.map((g, w) => /* @__PURE__ */ o.createElement("span", {
445
+ }, Ht.map((p, w) => /* @__PURE__ */ a.createElement("span", {
446
446
  key: w,
447
447
  style: {
448
448
  fontSize: "20px",
449
449
  cursor: "pointer",
450
450
  textAlign: "center"
451
451
  },
452
- onMouseDown: (H) => {
453
- H.preventDefault(), y(g), U(!1);
452
+ onMouseDown: (O) => {
453
+ O.preventDefault(), y(p), W(!1);
454
454
  }
455
- }, g))), document.body)), E.color && /* @__PURE__ */ o.createElement("div", {
455
+ }, p))), document.body)), E.color && /* @__PURE__ */ a.createElement("div", {
456
456
  style: {
457
457
  position: "relative"
458
458
  }
459
- }, /* @__PURE__ */ o.createElement("button", {
459
+ }, /* @__PURE__ */ a.createElement("button", {
460
460
  title: "Text Color",
461
- onMouseDown: (g) => {
461
+ onMouseDown: (p) => {
462
462
  var w;
463
- g.preventDefault(), c(), (w = O.current) == null || w.click();
463
+ p.preventDefault(), c(), (w = D.current) == null || w.click();
464
464
  },
465
465
  style: {
466
466
  display: "flex",
467
467
  alignItems: "center",
468
468
  justifyContent: "center",
469
- color: ((V = O.current) == null ? void 0 : V.value) || "#000",
469
+ color: ((U = D.current) == null ? void 0 : U.value) || "#000",
470
470
  fontSize: "18px"
471
471
  },
472
472
  className: L.color ? "rte-active" : ""
473
- }, /* @__PURE__ */ o.createElement(Tt, null)), /* @__PURE__ */ o.createElement("input", {
474
- ref: O,
473
+ }, /* @__PURE__ */ a.createElement(Dt, null)), /* @__PURE__ */ a.createElement("input", {
474
+ ref: D,
475
475
  type: "color",
476
476
  defaultValue: "#000000",
477
- onChange: (g) => {
477
+ onChange: (p) => {
478
478
  var w;
479
- G(g), ((w = g.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = g.target.value;
479
+ ee(p), ((w = p.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = p.target.value;
480
480
  },
481
481
  style: {
482
482
  position: "absolute",
@@ -485,15 +485,15 @@ const Ot = [
485
485
  height: 0,
486
486
  pointerEvents: "none"
487
487
  }
488
- })), E.highlight && /* @__PURE__ */ o.createElement("div", {
488
+ })), E.highlight && /* @__PURE__ */ a.createElement("div", {
489
489
  style: {
490
490
  position: "relative"
491
491
  }
492
- }, /* @__PURE__ */ o.createElement("button", {
492
+ }, /* @__PURE__ */ a.createElement("button", {
493
493
  title: "Highlight",
494
- onMouseDown: (g) => {
494
+ onMouseDown: (p) => {
495
495
  var w;
496
- g.preventDefault(), c(), (w = x.current) == null || w.click();
496
+ p.preventDefault(), c(), (w = x.current) == null || w.click();
497
497
  },
498
498
  style: {
499
499
  display: "flex",
@@ -503,12 +503,12 @@ const Ot = [
503
503
  fontSize: "18px"
504
504
  },
505
505
  className: L.highlight ? "rte-active" : ""
506
- }, /* @__PURE__ */ o.createElement(Rt, null)), /* @__PURE__ */ o.createElement("input", {
506
+ }, /* @__PURE__ */ a.createElement(St, null)), /* @__PURE__ */ a.createElement("input", {
507
507
  ref: x,
508
508
  type: "color",
509
- onChange: (g) => {
509
+ onChange: (p) => {
510
510
  var w;
511
- ee(g), ((w = g.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = g.target.value;
511
+ te(p), ((w = p.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = p.target.value;
512
512
  },
513
513
  defaultValue: "#000000",
514
514
  style: {
@@ -518,95 +518,95 @@ const Ot = [
518
518
  height: 0,
519
519
  pointerEvents: "none"
520
520
  }
521
- })), E.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
521
+ })), E.align && /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("button", {
522
522
  title: "Align Left",
523
- onMouseDown: (g) => g.preventDefault(),
524
- onClick: () => n("justifyLeft"),
523
+ onMouseDown: (p) => p.preventDefault(),
524
+ onClick: () => r("justifyLeft"),
525
525
  className: L.alignLeft ? "rte-active" : ""
526
- }, /* @__PURE__ */ o.createElement(xt, null)), /* @__PURE__ */ o.createElement("button", {
526
+ }, /* @__PURE__ */ a.createElement(Lt, null)), /* @__PURE__ */ a.createElement("button", {
527
527
  title: "Align Center",
528
- onMouseDown: (g) => g.preventDefault(),
529
- onClick: () => n("justifyCenter"),
528
+ onMouseDown: (p) => p.preventDefault(),
529
+ onClick: () => r("justifyCenter"),
530
530
  className: L.alignCenter ? "rte-active" : ""
531
- }, /* @__PURE__ */ o.createElement(yt, null)), /* @__PURE__ */ o.createElement("button", {
531
+ }, /* @__PURE__ */ a.createElement(wt, null)), /* @__PURE__ */ a.createElement("button", {
532
532
  title: "Align Right",
533
- onMouseDown: (g) => g.preventDefault(),
534
- onClick: () => n("justifyRight"),
533
+ onMouseDown: (p) => p.preventDefault(),
534
+ onClick: () => r("justifyRight"),
535
535
  className: L.alignRight ? "rte-active" : ""
536
- }, /* @__PURE__ */ o.createElement(wt, null))), E.table && /* @__PURE__ */ o.createElement("button", {
536
+ }, /* @__PURE__ */ a.createElement(Ct, null))), E.table && /* @__PURE__ */ a.createElement("button", {
537
537
  title: "Insert Table",
538
- onMouseDown: (g) => g.preventDefault(),
539
- onClick: () => n("insertTable"),
538
+ onMouseDown: (p) => p.preventDefault(),
539
+ onClick: () => r("insertTable"),
540
540
  className: L.table ? "rte-active" : ""
541
- }, /* @__PURE__ */ o.createElement(At, null)), E.fontFamily && /* @__PURE__ */ o.createElement("select", {
541
+ }, /* @__PURE__ */ a.createElement(Nt, null)), E.fontFamily && /* @__PURE__ */ a.createElement("select", {
542
542
  className: "rte-dropdown",
543
543
  defaultValue: "",
544
544
  onMouseDown: () => c(),
545
- onChange: m
546
- }, /* @__PURE__ */ o.createElement("option", {
545
+ onChange: g
546
+ }, /* @__PURE__ */ a.createElement("option", {
547
547
  value: "",
548
548
  disabled: !0
549
- }, "Font Family"), /* @__PURE__ */ o.createElement("option", {
549
+ }, "Font Family"), /* @__PURE__ */ a.createElement("option", {
550
550
  value: "Arial"
551
- }, "Arial"), /* @__PURE__ */ o.createElement("option", {
551
+ }, "Arial"), /* @__PURE__ */ a.createElement("option", {
552
552
  value: "Georgia"
553
- }, "Georgia"), /* @__PURE__ */ o.createElement("option", {
553
+ }, "Georgia"), /* @__PURE__ */ a.createElement("option", {
554
554
  value: "Times New Roman"
555
- }, "Times New Roman"), /* @__PURE__ */ o.createElement("option", {
555
+ }, "Times New Roman"), /* @__PURE__ */ a.createElement("option", {
556
556
  value: "Courier New"
557
- }, "Courier New"), /* @__PURE__ */ o.createElement("option", {
557
+ }, "Courier New"), /* @__PURE__ */ a.createElement("option", {
558
558
  value: "Verdana"
559
- }, "Verdana")), E.fontSize && /* @__PURE__ */ o.createElement("select", {
559
+ }, "Verdana")), E.fontSize && /* @__PURE__ */ a.createElement("select", {
560
560
  className: "rte-dropdown",
561
561
  defaultValue: "",
562
562
  onMouseDown: () => c(),
563
563
  onChange: u
564
- }, /* @__PURE__ */ o.createElement("option", {
564
+ }, /* @__PURE__ */ a.createElement("option", {
565
565
  value: "",
566
566
  disabled: !0
567
- }, "Font Size"), /* @__PURE__ */ o.createElement("option", {
567
+ }, "Font Size"), /* @__PURE__ */ a.createElement("option", {
568
568
  value: "2"
569
- }, "Small "), /* @__PURE__ */ o.createElement("option", {
569
+ }, "Small "), /* @__PURE__ */ a.createElement("option", {
570
570
  value: "3"
571
- }, "Normal"), /* @__PURE__ */ o.createElement("option", {
571
+ }, "Normal"), /* @__PURE__ */ a.createElement("option", {
572
572
  value: "4"
573
- }, "Medium"), /* @__PURE__ */ o.createElement("option", {
573
+ }, "Medium"), /* @__PURE__ */ a.createElement("option", {
574
574
  value: "5"
575
575
  }, "Large")));
576
- }, jt = ({
577
- show: n,
576
+ }, _t = ({
577
+ show: r,
578
578
  position: c,
579
- filtered: s,
579
+ filtered: d,
580
580
  insertMention: u,
581
- onClose: m,
581
+ onClose: g,
582
582
  query: y
583
583
  }) => {
584
- const R = P(null);
585
- return I(() => {
584
+ const R = I(null);
585
+ return P(() => {
586
586
  const b = (E) => {
587
- R.current && !R.current.contains(E.target) && m();
587
+ R.current && !R.current.contains(E.target) && g();
588
588
  };
589
- return n && document.addEventListener("mousedown", b), () => {
589
+ return r && document.addEventListener("mousedown", b), () => {
590
590
  document.removeEventListener("mousedown", b);
591
591
  };
592
- }, [n, m]), n ? /* @__PURE__ */ o.createElement("ul", {
592
+ }, [r, g]), r ? /* @__PURE__ */ a.createElement("ul", {
593
593
  ref: R,
594
594
  className: "rte-popup",
595
595
  style: {
596
596
  top: c.y,
597
597
  left: c.x
598
598
  }
599
- }, s.length > 0 ? s.map(({
599
+ }, d.length > 0 ? d.map(({
600
600
  name: b,
601
601
  value: E
602
602
  }) => {
603
- const D = b.toLowerCase(), j = y.toLowerCase(), k = D.indexOf(j);
604
- let O = b;
603
+ const T = b.toLowerCase(), _ = y.toLowerCase(), k = T.indexOf(_);
604
+ let D = b;
605
605
  if (k !== -1 && y.length > 0) {
606
606
  const x = k + y.length;
607
- O = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, x)}</span>` + b.substring(x);
607
+ D = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, x)}</span>` + b.substring(x);
608
608
  }
609
- return /* @__PURE__ */ o.createElement("li", {
609
+ return /* @__PURE__ */ a.createElement("li", {
610
610
  key: E,
611
611
  onMouseDown: (x) => {
612
612
  x.preventDefault(), u({
@@ -620,57 +620,57 @@ const Ot = [
620
620
  fontSize: "14px"
621
621
  },
622
622
  dangerouslySetInnerHTML: {
623
- __html: O
623
+ __html: D
624
624
  },
625
625
  onMouseEnter: (x) => x.currentTarget.style.background = "#f0f0f0",
626
626
  onMouseLeave: (x) => x.currentTarget.style.background = "#fff"
627
627
  });
628
- }) : /* @__PURE__ */ o.createElement("li", {
628
+ }) : /* @__PURE__ */ a.createElement("li", {
629
629
  style: {
630
630
  padding: "6px 12px",
631
631
  color: "#999"
632
632
  }
633
633
  }, "No matches")) : null;
634
634
  };
635
- function ze(n) {
636
- return M({ 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: [] }] }] }] })(n);
635
+ function ke(r) {
636
+ return M({ 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: [] }] }] }] })(r);
637
637
  }
638
- function Y(n) {
639
- return M({ 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: [] }] }] }] })(n);
638
+ function Z(r) {
639
+ return M({ 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: [] }] }] }] })(r);
640
640
  }
641
- const _t = ({
642
- visible: n,
641
+ const Ft = ({
642
+ visible: r,
643
643
  x: c,
644
- y: s,
644
+ y: d,
645
645
  onAction: u,
646
- onClose: m
646
+ onClose: g
647
647
  }) => {
648
- if (!n) return null;
648
+ if (!r) return null;
649
649
  const y = {
650
- top: s,
650
+ top: d,
651
651
  left: c
652
652
  };
653
- return /* @__PURE__ */ o.createElement("div", {
653
+ return /* @__PURE__ */ a.createElement("div", {
654
654
  style: y,
655
655
  className: "rte-table-menu",
656
- onMouseLeave: m
657
- }, /* @__PURE__ */ o.createElement("button", {
656
+ onMouseLeave: g
657
+ }, /* @__PURE__ */ a.createElement("button", {
658
658
  onClick: () => u("insertRowAbove")
659
- }, /* @__PURE__ */ o.createElement(Y, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
659
+ }, /* @__PURE__ */ a.createElement(Z, null), " Insert row above"), /* @__PURE__ */ a.createElement("button", {
660
660
  onClick: () => u("insertRowBelow")
661
- }, /* @__PURE__ */ o.createElement(Y, null), " Insert row below"), /* @__PURE__ */ o.createElement("button", {
661
+ }, /* @__PURE__ */ a.createElement(Z, null), " Insert row below"), /* @__PURE__ */ a.createElement("button", {
662
662
  onClick: () => u("insertColLeft")
663
- }, /* @__PURE__ */ o.createElement(Y, null), " Insert col left"), /* @__PURE__ */ o.createElement("button", {
663
+ }, /* @__PURE__ */ a.createElement(Z, null), " Insert col left"), /* @__PURE__ */ a.createElement("button", {
664
664
  onClick: () => u("insertColRight")
665
- }, /* @__PURE__ */ o.createElement(Y, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
665
+ }, /* @__PURE__ */ a.createElement(Z, null), " Insert col right"), /* @__PURE__ */ a.createElement("button", {
666
666
  onClick: () => u("deleteRow")
667
- }, /* @__PURE__ */ o.createElement(ze, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
667
+ }, /* @__PURE__ */ a.createElement(ke, null), " Delete row"), /* @__PURE__ */ a.createElement("button", {
668
668
  onClick: () => u("deleteCol")
669
- }, /* @__PURE__ */ o.createElement(ze, null), " Delete column"));
670
- }, Ft = ({
671
- html: n,
669
+ }, /* @__PURE__ */ a.createElement(ke, null), " Delete column"));
670
+ }, It = ({
671
+ html: r,
672
672
  className: c,
673
- style: s
673
+ style: d
674
674
  }) => {
675
675
  const u = (y) => {
676
676
  const R = y.target;
@@ -679,83 +679,83 @@ const _t = ({
679
679
  const b = R.href;
680
680
  b && window.open(b, "_blank", "noopener,noreferrer");
681
681
  }
682
- }, m = (y) => y.replace(/{{\s*(.*?)\s*}}/g, "$1");
683
- return /* @__PURE__ */ o.createElement("div", {
682
+ }, g = (y) => y.replace(/{{\s*(.*?)\s*}}/g, "$1");
683
+ return /* @__PURE__ */ a.createElement("div", {
684
684
  className: `rte-preview ${c || ""}`,
685
- style: s,
685
+ style: d,
686
686
  onClick: u,
687
687
  dangerouslySetInnerHTML: {
688
- __html: m(n)
688
+ __html: g(r)
689
689
  }
690
690
  });
691
691
  }, Pt = ({
692
- visible: n,
692
+ visible: r,
693
693
  linkData: c,
694
- onClose: s,
694
+ onClose: d,
695
695
  onInsert: u
696
696
  }) => {
697
- const [m, y] = S(""), [R, b] = S(""), [E, D] = S(""), [j, k] = S("_self");
698
- if (I(() => {
699
- n ? (y(c.url || ""), b(c.text || ""), D(c.title || ""), k(c.target || "_self")) : (y(""), b(""), D(""), k("_self"));
700
- }, [n, c]), !n) return null;
701
- const O = () => {
697
+ const [g, y] = S(""), [R, b] = S(""), [E, T] = S(""), [_, k] = S("_self");
698
+ if (P(() => {
699
+ r ? (y(c.url || ""), b(c.text || ""), T(c.title || ""), k(c.target || "_self")) : (y(""), b(""), T(""), k("_self"));
700
+ }, [r, c]), !r) return null;
701
+ const D = () => {
702
702
  u({
703
- url: m,
703
+ url: g,
704
704
  text: R,
705
705
  title: E,
706
- target: j
706
+ target: _
707
707
  });
708
708
  };
709
- return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
709
+ return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", {
710
710
  className: "rte-link-modal-overlay",
711
- onClick: s
712
- }), /* @__PURE__ */ o.createElement("div", {
711
+ onClick: d
712
+ }), /* @__PURE__ */ a.createElement("div", {
713
713
  className: "rte-link-modal"
714
- }, /* @__PURE__ */ o.createElement("h4", {
714
+ }, /* @__PURE__ */ a.createElement("h4", {
715
715
  className: "rte-link-modal__title"
716
- }, m ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
716
+ }, g ? "Edit Link" : "Insert Link"), /* @__PURE__ */ a.createElement("input", {
717
717
  type: "text",
718
718
  className: "rte-link-modal__input",
719
719
  placeholder: "URL",
720
- value: m,
720
+ value: g,
721
721
  onChange: (x) => y(x.target.value)
722
- }), /* @__PURE__ */ o.createElement("input", {
722
+ }), /* @__PURE__ */ a.createElement("input", {
723
723
  type: "text",
724
724
  className: "rte-link-modal__input",
725
725
  placeholder: "Text to Display",
726
726
  value: R,
727
727
  onChange: (x) => b(x.target.value)
728
- }), /* @__PURE__ */ o.createElement("input", {
728
+ }), /* @__PURE__ */ a.createElement("input", {
729
729
  type: "text",
730
730
  className: "rte-link-modal__input",
731
731
  placeholder: "Title",
732
732
  value: E,
733
- onChange: (x) => D(x.target.value)
734
- }), /* @__PURE__ */ o.createElement("select", {
733
+ onChange: (x) => T(x.target.value)
734
+ }), /* @__PURE__ */ a.createElement("select", {
735
735
  className: "rte-link-modal__select",
736
- value: j,
736
+ value: _,
737
737
  onChange: (x) => k(x.target.value)
738
- }, /* @__PURE__ */ o.createElement("option", {
738
+ }, /* @__PURE__ */ a.createElement("option", {
739
739
  value: "_self"
740
- }, "Same tab"), /* @__PURE__ */ o.createElement("option", {
740
+ }, "Same tab"), /* @__PURE__ */ a.createElement("option", {
741
741
  value: "_blank"
742
- }, "New tab")), /* @__PURE__ */ o.createElement("div", {
742
+ }, "New tab")), /* @__PURE__ */ a.createElement("div", {
743
743
  className: "rte-link-modal__actions"
744
- }, /* @__PURE__ */ o.createElement("button", {
744
+ }, /* @__PURE__ */ a.createElement("button", {
745
745
  className: "rte-link-modal__btn",
746
- onClick: s
747
- }, "Cancel"), /* @__PURE__ */ o.createElement("button", {
746
+ onClick: d
747
+ }, "Cancel"), /* @__PURE__ */ a.createElement("button", {
748
748
  className: "rte-link-modal__btn rte-link-modal__btn--ok",
749
- onClick: O
749
+ onClick: D
750
750
  }, "OK"))));
751
751
  };
752
- function ke(n) {
753
- return Array.from(new Map(n.map((c) => [c.value, c])).values());
752
+ function Ae(r) {
753
+ return Array.from(new Map(r.map((c) => [c.value, c])).values());
754
754
  }
755
- const Vt = ({
756
- atSuggestions: n = [],
755
+ const Ut = ({
756
+ atSuggestions: r = [],
757
757
  showOutput: c = !1,
758
- showPreview: s = !1,
758
+ showPreview: d = !1,
759
759
  toolbarConfig: u = {
760
760
  link: !1,
761
761
  image: !1,
@@ -766,32 +766,32 @@ const Vt = ({
766
766
  fontSize: !1,
767
767
  highlight: !1
768
768
  },
769
- classNames: m = {},
769
+ classNames: g = {},
770
770
  styles: y = {},
771
771
  handleGetHtml: R = () => {
772
772
  },
773
773
  onChange: b = () => {
774
774
  },
775
775
  value: E,
776
- onMentionSelect: D = () => {
776
+ onMentionSelect: T = () => {
777
777
  },
778
- handleAddAttributes: j = () => {
778
+ handleAddAttributes: _ = () => {
779
779
  }
780
780
  }) => {
781
- var he, pe, ve, Ee, ye, we, Ce, be;
782
- const k = P(null), [O, x] = S(E != null && E.length ? E : " "), [J, U] = S(""), [B, q] = S(!1), [F, G] = S({
781
+ var pe, ve, Ee, ye, we, Ce, be, xe;
782
+ const k = I(null), [D, x] = S(E != null && E.length ? E : " "), [G, W] = S(""), [V, B] = S(!1), [F, ee] = S({
783
783
  x: 0,
784
784
  y: 0
785
- }), [ee, L] = S([]), _ = P(null), V = P(null), [N, g] = S({
785
+ }), [te, L] = S([]), j = I(null), U = I(null), [N, p] = S({
786
786
  visible: !1,
787
787
  x: 0,
788
788
  y: 0
789
- }), [w, H] = S(!1), W = P(null), [Te, oe] = S({
789
+ }), [w, O] = S(!1), K = I(null), [De, le] = S({
790
790
  url: "",
791
791
  text: "",
792
792
  title: "",
793
793
  target: "_self"
794
- }), De = {
794
+ }), Oe = {
795
795
  bold: !0,
796
796
  italic: !0,
797
797
  underline: !0,
@@ -799,181 +799,198 @@ const Vt = ({
799
799
  unorderedList: !0,
800
800
  orderedList: !0,
801
801
  align: !0,
802
- link: (he = u.link) != null ? he : !1,
803
- image: (pe = u.image) != null ? pe : !1,
804
- emoji: (ve = u.emoji) != null ? ve : !1,
805
- table: (Ee = u.table) != null ? Ee : !1,
806
- color: (ye = u.color) != null ? ye : !1,
807
- fontFamily: (we = u.fontFamily) != null ? we : !1,
808
- fontSize: (Ce = u.fontSize) != null ? Ce : !1,
809
- highlight: (be = u.fontSize) != null ? be : !1
810
- }, [Oe, le] = S(""), [ce, te] = S([]), T = () => k.current, z = () => {
811
- const e = ge();
812
- U(e), R == null || R(e);
813
- const t = at(e);
802
+ link: (pe = u.link) != null ? pe : !1,
803
+ image: (ve = u.image) != null ? ve : !1,
804
+ emoji: (Ee = u.emoji) != null ? Ee : !1,
805
+ table: (ye = u.table) != null ? ye : !1,
806
+ color: (we = u.color) != null ? we : !1,
807
+ fontFamily: (Ce = u.fontFamily) != null ? Ce : !1,
808
+ fontSize: (be = u.fontSize) != null ? be : !1,
809
+ highlight: (xe = u.fontSize) != null ? xe : !1
810
+ }, [He, ce] = S(""), [ie, ne] = S([]), H = () => k.current, z = () => {
811
+ const e = fe();
812
+ W(e), R == null || R(e);
813
+ const t = ot(e);
814
814
  b(t);
815
- const r = Ve(), a = ke(r);
816
- JSON.stringify(a) !== JSON.stringify(ce) && (te(a), D(a));
817
- }, ie = () => {
815
+ const n = Ue(), o = Ae(n);
816
+ JSON.stringify(o) !== JSON.stringify(ie) && (ne(o), T(o));
817
+ }, q = () => {
818
818
  const e = window.getSelection();
819
- e != null && e.rangeCount && (_.current = e.getRangeAt(0));
819
+ if (!e || e.rangeCount === 0) return;
820
+ const t = document.getElementById("rte-editor-body");
821
+ if (!t) return;
822
+ const n = e.getRangeAt(0);
823
+ t.contains(n.startContainer) && (j.current = n.cloneRange());
820
824
  }, $ = () => {
821
825
  const e = window.getSelection();
822
- e && _.current && (e.removeAllRanges(), e.addRange(_.current));
823
- }, He = (e, t) => {
824
- const r = window.getSelection();
825
- r && r.rangeCount > 0 && (_.current = r.getRangeAt(0)), $(), document.execCommand(e, !1, t), z();
826
+ !e || !j.current || (e.removeAllRanges(), e.addRange(j.current));
827
+ }, je = (e, t) => {
828
+ const n = window.getSelection();
829
+ n && n.rangeCount > 0 && (j.current = n.getRangeAt(0)), $(), document.execCommand(e, !1, t), z();
826
830
  };
827
- I(() => {
828
- const e = T();
829
- e && !e.innerHTML && (e.innerHTML = O), z();
830
- }, []), I(() => () => {
831
+ P(() => {
832
+ const e = H();
833
+ e && !e.innerHTML && (e.innerHTML = D), z();
834
+ }, []), P(() => () => {
831
835
  document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
832
- }, []), I(() => {
833
- j && j((e) => {
834
- Be(e);
836
+ }, []), P(() => {
837
+ _ && _((e) => {
838
+ Ve(e);
835
839
  });
836
- }, []), I(() => {
837
- const e = T();
840
+ }, []), P(() => {
841
+ const e = H();
838
842
  if (!e) return;
839
- e.querySelectorAll("table").forEach((r) => {
840
- me(r), r.querySelectorAll("th, td").forEach((d) => X(d));
843
+ e.querySelectorAll("table").forEach((n) => {
844
+ me(n), n.querySelectorAll("th, td").forEach((s) => Y(s));
841
845
  });
842
- }, [E]);
846
+ }, []);
843
847
  const se = (e) => {
844
848
  for (; e && e.nodeName !== "LI"; )
845
849
  e = e.parentNode;
846
850
  return e;
847
- }, je = (e) => {
848
- let t = 0, r = e.parentElement;
849
- for (; r; )
850
- (r.tagName === "UL" || r.tagName === "OL") && t++, r = r.parentElement;
851
- return t;
852
851
  }, _e = (e) => {
853
- const t = e.querySelector("li"), r = t ? je(t) : 1;
852
+ let t = 0, n = e.parentElement;
853
+ for (; n; )
854
+ (n.tagName === "UL" || n.tagName === "OL") && t++, n = n.parentElement;
855
+ return t;
856
+ }, Fe = (e) => {
857
+ const t = e.querySelector("li"), n = t ? _e(t) : 1;
854
858
  if (e.querySelector("[data-hidden-array-start]")) return;
855
- const a = `{{#arrayData${r > 1 ? r : ""}}}`, d = `{{/arrayData${r > 1 ? r : ""}}}`, l = document.createElement("span");
856
- l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
859
+ const o = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
860
+ l.textContent = o, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
857
861
  const i = document.createElement("span");
858
- i.textContent = d, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
862
+ i.textContent = s, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
859
863
  }, de = (e) => {
860
864
  var v;
861
865
  const t = window.getSelection();
862
866
  if (!(t != null && t.rangeCount)) return;
863
- const r = t.getRangeAt(0), a = se(r.startContainer);
864
- let d, l;
865
- if (a) {
866
- let f = a.querySelector(e);
867
- f || (f = document.createElement(e), f.style.margin = "0", f.style.paddingLeft = "20px", a.appendChild(f)), l = f, d = document.createElement("li"), d.textContent = "​", l.appendChild(d);
867
+ const n = t.getRangeAt(0), o = se(n.startContainer);
868
+ let s, l;
869
+ if (o) {
870
+ let m = o.querySelector(e);
871
+ m || (m = document.createElement(e), m.style.margin = "0", m.style.paddingLeft = "20px", o.appendChild(m)), l = m, s = document.createElement("li"), s.textContent = "​", l.appendChild(s);
868
872
  } else {
869
873
  document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
870
- const f = T();
871
- if (l = f == null ? void 0 : f.querySelector(`${e}:last-child`), !l) return;
872
- d = l.querySelector("li:last-child");
874
+ const m = H();
875
+ if (l = m == null ? void 0 : m.querySelector(`${e}:last-child`), !l) return;
876
+ s = l.querySelector("li:last-child");
873
877
  }
874
- _e(l);
878
+ Fe(l);
875
879
  const i = document.createRange();
876
- i.setStart(d, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (v = T()) == null || v.focus(), z();
877
- }, K = (e, t) => {
878
- e === "insertOrderedList" ? de("ol") : e === "insertUnorderedList" ? de("ul") : He(e, t), e === "insertTable" && Ye();
879
- }, Fe = (e) => {
880
+ i.setStart(s, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (v = H()) == null || v.focus(), z();
881
+ }, X = (e, t) => {
882
+ e === "insertOrderedList" ? de("ol") : e === "insertUnorderedList" ? de("ul") : je(e, t), e === "insertTable" && Ze();
883
+ }, Ie = (e) => {
880
884
  const t = document.createElement("span");
881
885
  t.textContent = "​", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
882
- const r = t.getBoundingClientRect();
883
- t.remove(), G({
884
- x: r.left,
885
- y: r.bottom + window.scrollY
886
- }), L(n || []), q(!0), V.current = e.cloneRange();
886
+ const n = t.getBoundingClientRect();
887
+ t.remove(), ee({
888
+ x: n.left,
889
+ y: n.bottom + window.scrollY
890
+ }), L(r || []), B(!0), U.current = e.cloneRange();
887
891
  }, Pe = () => {
888
892
  const e = window.getSelection();
889
893
  if (!e || e.rangeCount === 0) return null;
890
894
  const t = e.anchorNode;
891
- let r = e.anchorOffset;
895
+ let n = e.anchorOffset;
892
896
  if (!t) return null;
893
- let a = t;
894
- for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[r] ? a = a.childNodes[r] : a = t.previousSibling); a; ) {
895
- if (a.nodeType === Node.TEXT_NODE) {
896
- const d = a.textContent || "", l = a === t ? r : d.length, i = d.lastIndexOf("@", l - 1);
897
+ let o = t;
898
+ for (o.nodeType !== Node.TEXT_NODE && (o.childNodes && o.childNodes[n] ? o = o.childNodes[n] : o = t.previousSibling); o; ) {
899
+ if (o.nodeType === Node.TEXT_NODE) {
900
+ const s = o.textContent || "", l = o === t ? n : s.length, i = s.lastIndexOf("@", l - 1);
897
901
  if (i !== -1) {
898
902
  const v = document.createRange();
899
- return v.setStart(a, i), v.setEnd(a, l), v;
903
+ return v.setStart(o, i), v.setEnd(o, l), v;
900
904
  }
901
905
  }
902
- a = a.previousSibling;
906
+ o = o.previousSibling;
903
907
  }
904
908
  return null;
905
- }, Ie = (e) => {
909
+ }, Be = (e) => {
906
910
  var l;
907
911
  const t = window.getSelection();
908
912
  if (!t) return;
909
- const r = Pe();
910
- r ? (t.removeAllRanges(), t.addRange(r)) : V.current && (t.removeAllRanges(), t.addRange(V.current));
911
- const a = document.createElement("span");
912
- a.textContent = `{{${e.name}}}`, a.style.color = "#007bff", a.style.display = "inline", a.contentEditable = "false", a.setAttribute("data-mention", e.value || e.name || "");
913
+ const n = Pe();
914
+ n ? (t.removeAllRanges(), t.addRange(n)) : U.current && (t.removeAllRanges(), t.addRange(U.current));
915
+ const o = document.createElement("span");
916
+ o.textContent = `{{${e.name}}}`, o.style.color = "#007bff", o.style.display = "inline", o.contentEditable = "false", o.setAttribute("data-mention", e.value || e.name || "");
913
917
  try {
914
918
  const i = t.rangeCount ? t.getRangeAt(0) : null;
915
919
  if (i)
916
- i.deleteContents(), i.insertNode(a);
920
+ i.deleteContents(), i.insertNode(o);
917
921
  else {
918
- const p = document.createRange(), h = T();
919
- p.selectNodeContents(h), p.collapse(!1), p.insertNode(a);
922
+ const f = document.createRange(), h = H();
923
+ f.selectNodeContents(h), f.collapse(!1), f.insertNode(o);
920
924
  }
921
925
  const v = document.createTextNode(" ");
922
- a.after(v);
923
- const f = document.createRange();
924
- f.setStartAfter(v), f.collapse(!0), t.removeAllRanges(), t.addRange(f);
926
+ o.after(v);
927
+ const m = document.createRange();
928
+ m.setStartAfter(v), m.collapse(!0), t.removeAllRanges(), t.addRange(m);
925
929
  } catch (i) {
926
930
  console.error("insertMention error:", i);
927
931
  }
928
- let d = ke([...ce, e]);
929
- te(d), D(d), q(!1), (l = T()) == null || l.focus(), z();
932
+ let s = Ae([...ie, e]);
933
+ ne(s), T(s), B(!1), (l = H()) == null || l.focus(), z();
930
934
  }, qe = (e) => {
931
- var i;
932
- $();
933
- const t = window.getSelection();
934
- if (!t || !t.rangeCount) return;
935
- const r = t.getRangeAt(0), a = document.createElement("span");
936
- a.textContent = `{{${e.name}}}`, a.style.color = "#007bff", a.style.display = "inline", a.contentEditable = "false", a.setAttribute("data-mention", e.value || e.name), r.insertNode(a);
937
- const d = document.createTextNode(" ");
938
- a.after(d);
939
- const l = document.createRange();
940
- l.setStartAfter(d), l.collapse(!0), t.removeAllRanges(), t.addRange(l), (i = T()) == null || i.focus();
941
- }, Be = (e) => {
942
- e.forEach((t) => qe(t)), te((t) => {
943
- const r = [...t, ...e], a = Array.from(new Map(r.map((d) => [d.name, d])).values());
944
- return D(a), a;
935
+ var v;
936
+ const t = document.getElementById("rte-editor-body");
937
+ if (!t) return;
938
+ t.focus();
939
+ let n = window.getSelection();
940
+ if (!he() && j.current && ($(), n = window.getSelection()), !n || !n.rangeCount || !he()) {
941
+ const m = document.createRange();
942
+ let f = t;
943
+ for (; f && f.lastChild; )
944
+ f = f.lastChild;
945
+ try {
946
+ m.setStart(f, ((v = f.textContent) == null ? void 0 : v.length) || 0);
947
+ } catch (h) {
948
+ m.setStart(t, t.childNodes.length);
949
+ }
950
+ m.collapse(!0), n = window.getSelection(), n == null || n.removeAllRanges(), n == null || n.addRange(m);
951
+ }
952
+ const o = n.getRangeAt(0), s = document.createElement("span");
953
+ s.textContent = `{{${e.name}}}`, s.setAttribute("data-mention", e.value || e.name), s.style.color = "#007bff", s.contentEditable = "false", o.insertNode(s);
954
+ const l = document.createTextNode(" ");
955
+ s.after(l);
956
+ const i = document.createRange();
957
+ i.setStartAfter(l), i.collapse(!0), n.removeAllRanges(), n.addRange(i), q(), t.focus();
958
+ }, Ve = (e) => {
959
+ e.forEach((t) => qe(t)), ne((t) => {
960
+ const n = [...t, ...e], o = Array.from(new Map(n.map((s) => [s.name, s])).values());
961
+ return T(o), o;
945
962
  }), z();
946
- }, Ve = () => {
947
- const e = T();
963
+ }, Ue = () => {
964
+ const e = H();
948
965
  if (!e) return [];
949
- const t = e.querySelectorAll("span[data-mention]"), r = [];
950
- return t.forEach((a) => {
951
- const d = a.getAttribute("data-mention") || "", i = (a.textContent || "").match(/{{(.+?)}}/);
952
- i && r.push({
966
+ const t = e.querySelectorAll("span[data-mention]"), n = [];
967
+ return t.forEach((o) => {
968
+ const s = o.getAttribute("data-mention") || "", i = (o.textContent || "").match(/{{(.+?)}}/);
969
+ i && n.push({
953
970
  name: i[1],
954
- value: d
971
+ value: s
955
972
  });
956
- }), r;
973
+ }), n;
957
974
  }, $e = (e) => {
958
- var r, a, d;
975
+ var n, o, s;
959
976
  const t = e.key.toLowerCase();
960
- if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), K(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
977
+ if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), X(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
961
978
  const l = window.getSelection(), i = l != null && l.anchorNode ? se(l.anchorNode) : null;
962
979
  if (!i) return;
963
- if (((r = i.textContent) == null ? void 0 : r.replace(/\u200B/g, "").trim()) === "") {
980
+ if (((n = i.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
964
981
  e.preventDefault();
965
- const f = i.parentElement, p = f == null ? void 0 : f.closest("li");
966
- if (p) {
967
- f == null || f.removeChild(i);
982
+ const m = i.parentElement, f = m == null ? void 0 : m.closest("li");
983
+ if (f) {
984
+ m == null || m.removeChild(i);
968
985
  const h = document.createElement("p");
969
- h.innerHTML = "<br />", (a = p.parentElement) == null || a.insertBefore(h, p.nextSibling);
986
+ h.innerHTML = "<br />", (o = f.parentElement) == null || o.insertBefore(h, f.nextSibling);
970
987
  const C = document.createRange();
971
988
  C.setStart(h, 0), C.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(C);
972
989
  } else {
973
990
  const h = i.closest("ul, ol");
974
991
  if (h) {
975
992
  const C = document.createElement("p");
976
- C.innerHTML = "<br />", (d = h.parentElement) == null || d.insertBefore(C, h.nextSibling), h.removeChild(i);
993
+ C.innerHTML = "<br />", (s = h.parentElement) == null || s.insertBefore(C, h.nextSibling), h.removeChild(i);
977
994
  const A = document.createRange();
978
995
  A.setStart(C, 0), A.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(A);
979
996
  }
@@ -981,23 +998,23 @@ const Vt = ({
981
998
  z();
982
999
  }
983
1000
  }
984
- }, Ue = (e) => {
1001
+ }, We = (e) => {
985
1002
  if (e.data === "@") {
986
- const r = window.getSelection();
987
- if (!(r != null && r.rangeCount)) return;
988
- const a = r.anchorNode;
989
- if (We(a))
1003
+ const n = window.getSelection();
1004
+ if (!(n != null && n.rangeCount)) return;
1005
+ const o = n.anchorNode;
1006
+ if (Ke(o))
990
1007
  return;
991
1008
  setTimeout(() => {
992
- Fe(r.getRangeAt(0)), le(""), L(n), q(!0);
1009
+ Ie(n.getRangeAt(0)), ce(""), L(r), B(!0);
993
1010
  }, 0);
994
1011
  return;
995
1012
  }
996
- if (B) {
1013
+ if (V) {
997
1014
  setTimeout(() => ue(), 0);
998
1015
  return;
999
1016
  }
1000
- }, We = (e) => {
1017
+ }, Ke = (e) => {
1001
1018
  if (!e) return !1;
1002
1019
  let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
1003
1020
  for (; t; ) {
@@ -1006,72 +1023,72 @@ const Vt = ({
1006
1023
  }
1007
1024
  return !1;
1008
1025
  }, ue = () => {
1009
- if (z(), !B) return;
1026
+ if (z(), !V) return;
1010
1027
  const e = window.getSelection();
1011
1028
  if (!e || !e.anchorNode) return;
1012
- const r = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
1013
- if (!r) {
1014
- q(!1);
1029
+ const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
1030
+ if (!n) {
1031
+ B(!1);
1015
1032
  return;
1016
1033
  }
1017
- const a = r[1].toLowerCase();
1018
- le(a);
1019
- const d = n.filter((l) => l.name.toLowerCase().includes(a));
1020
- L(d);
1021
- }, Ke = (e) => {
1022
- var a;
1023
- const t = (a = e.target.files) == null ? void 0 : a[0];
1034
+ const o = n[1].toLowerCase();
1035
+ ce(o);
1036
+ const s = r.filter((l) => l.name.toLowerCase().includes(o));
1037
+ L(s);
1038
+ }, Xe = (e) => {
1039
+ var o;
1040
+ const t = (o = e.target.files) == null ? void 0 : o[0];
1024
1041
  if (!t) return;
1025
- const r = new FileReader();
1026
- r.onload = (d) => {
1042
+ const n = new FileReader();
1043
+ n.onload = (s) => {
1027
1044
  var A;
1028
- const l = (A = d.target) == null ? void 0 : A.result;
1045
+ const l = (A = s.target) == null ? void 0 : A.result;
1029
1046
  $();
1030
1047
  const i = window.getSelection();
1031
1048
  let v = i && i.rangeCount ? i.getRangeAt(0) : null;
1032
- const f = document.createElement("img");
1033
- f.src = l, f.alt = t.name || "image", f.className = "rte-inserted-image", f.contentEditable = "true";
1034
- const p = T();
1035
- if (!v || !p) {
1036
- p == null || p.appendChild(f);
1037
- const xe = document.createTextNode(" ");
1038
- p == null || p.appendChild(xe);
1039
- const ne = document.createRange();
1040
- ne.setStartAfter(xe), ne.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(ne), p == null || p.focus(), z(), e.target.value = "";
1049
+ const m = document.createElement("img");
1050
+ m.src = l, m.alt = t.name || "image", m.className = "rte-inserted-image", m.contentEditable = "true";
1051
+ const f = H();
1052
+ if (!v || !f) {
1053
+ f == null || f.appendChild(m);
1054
+ const Le = document.createTextNode(" ");
1055
+ f == null || f.appendChild(Le);
1056
+ const re = document.createRange();
1057
+ re.setStartAfter(Le), re.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(re), f == null || f.focus(), z(), e.target.value = "";
1041
1058
  return;
1042
1059
  }
1043
- v.deleteContents(), v.insertNode(f);
1060
+ v.deleteContents(), v.insertNode(m);
1044
1061
  const h = document.createTextNode(" ");
1045
- f.after(h);
1062
+ m.after(h);
1046
1063
  const C = document.createRange();
1047
- C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), p.focus(), z(), e.target.value = "";
1048
- }, r.readAsDataURL(t);
1049
- }, Xe = (e) => {
1050
- var d;
1064
+ C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), f.focus(), z(), e.target.value = "";
1065
+ }, n.readAsDataURL(t);
1066
+ }, Ye = (e) => {
1067
+ var s;
1051
1068
  $();
1052
1069
  const t = window.getSelection();
1053
1070
  if (!(t != null && t.rangeCount)) return;
1054
- const r = t.getRangeAt(0), a = document.createTextNode(e);
1055
- r.insertNode(a), r.setStartAfter(a), r.collapse(!0), t.removeAllRanges(), t.addRange(r), (d = T()) == null || d.focus(), z();
1056
- }, Ye = () => {
1071
+ const n = t.getRangeAt(0), o = document.createTextNode(e);
1072
+ n.insertNode(o), n.setStartAfter(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = H()) == null || s.focus(), z();
1073
+ }, Ze = () => {
1057
1074
  $();
1058
1075
  const e = document.createElement("table");
1059
- e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", m.table && e.classList.add(m.table);
1076
+ e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", g.table && e.classList.add(g.table);
1060
1077
  const t = document.createElement("thead");
1061
- m.thead && t.classList.add(m.thead);
1062
- const r = document.createElement("tbody");
1063
- m.tbody && r.classList.add(m.tbody);
1064
- const a = document.createElement("tr");
1065
- m.tr && a.classList.add(m.tr);
1066
- const d = document.createElement("tr");
1067
- m.tr && d.classList.add(m.tr);
1078
+ g.thead && t.classList.add(g.thead);
1079
+ const n = document.createElement("tbody");
1080
+ g.tbody && n.classList.add(g.tbody);
1081
+ const o = document.createElement("tr");
1082
+ g.tr && o.classList.add(g.tr);
1083
+ const s = document.createElement("tr");
1084
+ g.tr && s.classList.add(g.tr);
1068
1085
  for (let v = 0; v < 2; v++) {
1069
- const f = document.createElement("th");
1070
- f.textContent = `Header ${v + 1}`, f.style.border = "1px solid #999", f.style.padding = "8px", f.style.position = "relative", f.style.backgroundColor = "lightgray", m.th && f.classList.add(m.th);
1071
- const p = document.createElement("td");
1072
- p.textContent = `Row 1 Col ${v + 1}`, p.style.border = "1px solid #999", p.style.padding = "8px", p.style.position = "relative", p.style.backgroundColor = "#fff", m.td && p.classList.add(m.td), X(f), X(p), a.appendChild(f), d.appendChild(p);
1086
+ const m = document.createElement("th");
1087
+ m.textContent = `Header ${v + 1}`, m.style.border = "1px solid #999", m.style.padding = "8px", m.style.position = "relative", m.style.backgroundColor = "lightgray", g.th && m.classList.add(g.th);
1088
+ const f = document.createElement("td");
1089
+ f.textContent = `Row 1 Col ${v + 1}`, f.style.border = "1px solid #999", f.style.padding = "8px", f.style.position = "relative", f.style.backgroundColor = "#fff", g.td && f.classList.add(g.td), Y(m), Y(f), o.appendChild(m), s.appendChild(f);
1073
1090
  }
1074
- t.appendChild(a), r.appendChild(d), e.appendChild(t), e.appendChild(r), Ge(e), me(e);
1091
+ t.appendChild(o), n.appendChild(s), e.appendChild(t), e.appendChild(n), et(e), me(e);
1075
1092
  const l = window.getSelection();
1076
1093
  if (!(l != null && l.rangeCount)) return;
1077
1094
  l.getRangeAt(0).insertNode(e), z();
@@ -1088,21 +1105,21 @@ const Vt = ({
1088
1105
  zIndex: "20",
1089
1106
  borderRadius: "2px"
1090
1107
  });
1091
- let r = 0, a = 0, d = 0, l = 0;
1108
+ let n = 0, o = 0, s = 0, l = 0;
1092
1109
  t.addEventListener("mousedown", (i) => {
1093
- i.preventDefault(), r = i.clientX, a = i.clientY;
1110
+ i.preventDefault(), n = i.clientX, o = i.clientY;
1094
1111
  const v = e.getBoundingClientRect();
1095
- d = v.width, l = v.height;
1096
- const f = (h) => {
1097
- const C = Math.max(100, d + (h.clientX - r)), A = Math.max(60, l + (h.clientY - a));
1112
+ s = v.width, l = v.height;
1113
+ const m = (h) => {
1114
+ const C = Math.max(100, s + (h.clientX - n)), A = Math.max(60, l + (h.clientY - o));
1098
1115
  e.style.width = `${C}px`, e.style.height = `${A}px`, z();
1099
- }, p = () => {
1100
- document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", p), z();
1116
+ }, f = () => {
1117
+ document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", f), z();
1101
1118
  };
1102
- document.addEventListener("mousemove", f), document.addEventListener("mouseup", p);
1119
+ document.addEventListener("mousemove", m), document.addEventListener("mouseup", f);
1103
1120
  }), e.appendChild(t);
1104
- }, X = (e) => {
1105
- const t = document.createElement("div"), r = document.createElement("div");
1121
+ }, Y = (e) => {
1122
+ const t = document.createElement("div"), n = document.createElement("div");
1106
1123
  Object.assign(t.style, {
1107
1124
  position: "absolute",
1108
1125
  right: "0",
@@ -1112,7 +1129,7 @@ const Vt = ({
1112
1129
  cursor: "col-resize",
1113
1130
  background: "rgba(0,0,0,0.15)",
1114
1131
  zIndex: "10"
1115
- }), Object.assign(r.style, {
1132
+ }), Object.assign(n.style, {
1116
1133
  position: "absolute",
1117
1134
  bottom: "0",
1118
1135
  left: "0",
@@ -1121,144 +1138,144 @@ const Vt = ({
1121
1138
  cursor: "row-resize",
1122
1139
  background: "rgba(0,0,0,0.15)",
1123
1140
  zIndex: "10"
1124
- }), Ze(e, t, r), e.appendChild(t), e.appendChild(r);
1125
- }, Ze = (e, t, r) => {
1126
- let a = 0, d = 0, l = 0, i = 0;
1141
+ }), Qe(e, t, n), e.appendChild(t), e.appendChild(n);
1142
+ }, Qe = (e, t, n) => {
1143
+ let o = 0, s = 0, l = 0, i = 0;
1127
1144
  t.addEventListener("mousedown", (h) => {
1128
- h.preventDefault(), a = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", p);
1129
- }), r.addEventListener("mousedown", (h) => {
1130
- h.preventDefault(), d = h.clientY, i = e.offsetHeight, document.addEventListener("mousemove", f), document.addEventListener("mouseup", p);
1145
+ h.preventDefault(), o = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", f);
1146
+ }), n.addEventListener("mousedown", (h) => {
1147
+ h.preventDefault(), s = h.clientY, i = e.offsetHeight, document.addEventListener("mousemove", m), document.addEventListener("mouseup", f);
1131
1148
  });
1132
1149
  const v = (h) => {
1133
- const C = l + (h.clientX - a);
1150
+ const C = l + (h.clientX - o);
1134
1151
  e.style.width = `${Math.max(30, C)}px`;
1135
- }, f = (h) => {
1136
- const C = i + (h.clientY - d);
1152
+ }, m = (h) => {
1153
+ const C = i + (h.clientY - s);
1137
1154
  e.style.height = `${Math.max(20, C)}px`;
1138
- }, p = () => {
1139
- document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", p);
1155
+ }, f = () => {
1156
+ document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", f);
1140
1157
  };
1141
- }, Qe = (e) => {
1142
- const r = e.target.closest("td, th");
1143
- r && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), r.classList.add("rte-cell-highlight"), g({
1158
+ }, Je = (e) => {
1159
+ const n = e.target.closest("td, th");
1160
+ n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((o) => o.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), p({
1144
1161
  visible: !0,
1145
1162
  x: e.clientX,
1146
1163
  y: e.clientY,
1147
- cell: r
1164
+ cell: n
1148
1165
  }));
1149
- }, fe = () => {
1166
+ }, ge = () => {
1150
1167
  document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
1151
- }, Je = (e) => {
1168
+ }, Ge = (e) => {
1152
1169
  if (!N.cell) return;
1153
- const t = N.cell.closest("table"), r = N.cell.cellIndex, a = N.cell.parentElement.rowIndex, d = (l) => {
1170
+ const t = N.cell.closest("table"), n = N.cell.cellIndex, o = N.cell.parentElement.rowIndex, s = (l) => {
1154
1171
  const i = l.tagName.toLowerCase(), v = document.createElement(i);
1155
- return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, X(v), v;
1172
+ return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, Y(v), v;
1156
1173
  };
1157
1174
  switch (e) {
1158
1175
  case "insertRowAbove": {
1159
- const l = t.rows[a], i = t.insertRow(a);
1176
+ const l = t.rows[o], i = t.insertRow(o);
1160
1177
  Array.from(l.cells).forEach((v) => {
1161
- i.appendChild(d(v));
1178
+ i.appendChild(s(v));
1162
1179
  });
1163
1180
  break;
1164
1181
  }
1165
1182
  case "insertRowBelow": {
1166
- const l = t.rows[a], i = t.insertRow(a + 1);
1183
+ const l = t.rows[o], i = t.insertRow(o + 1);
1167
1184
  Array.from(l.cells).forEach((v) => {
1168
- i.appendChild(d(v));
1185
+ i.appendChild(s(v));
1169
1186
  });
1170
1187
  break;
1171
1188
  }
1172
1189
  case "insertColLeft": {
1173
1190
  Array.from(t.rows).forEach((l) => {
1174
- const i = l.cells[r];
1175
- l.insertBefore(d(i), i);
1191
+ const i = l.cells[n];
1192
+ l.insertBefore(s(i), i);
1176
1193
  });
1177
1194
  break;
1178
1195
  }
1179
1196
  case "insertColRight": {
1180
1197
  Array.from(t.rows).forEach((l) => {
1181
- const i = l.cells[r];
1182
- l.insertBefore(d(i), i.nextSibling);
1198
+ const i = l.cells[n];
1199
+ l.insertBefore(s(i), i.nextSibling);
1183
1200
  });
1184
1201
  break;
1185
1202
  }
1186
1203
  case "deleteRow":
1187
- t.rows.length > 1 && t.deleteRow(a);
1204
+ t.rows.length > 1 && t.deleteRow(o);
1188
1205
  break;
1189
1206
  case "deleteCol":
1190
1207
  Array.from(t.rows).forEach((l) => {
1191
- l.cells[r] && l.deleteCell(r);
1208
+ l.cells[n] && l.deleteCell(n);
1192
1209
  });
1193
1210
  break;
1194
1211
  }
1195
- z(), g(ae(re({}, N), {
1212
+ z(), p(oe(ae({}, N), {
1196
1213
  visible: !1
1197
- })), fe();
1198
- }, Ge = (e) => {
1214
+ })), ge();
1215
+ }, et = (e) => {
1199
1216
  const t = e.querySelector("tbody");
1200
1217
  if (!t || t.querySelector("[data-hidden-table-start]")) return;
1201
- const r = document.createElement("span");
1202
- r.textContent = "{{#arrayData}}", r.style.display = "none", r.setAttribute("data-hidden-table-start", "true"), t.insertBefore(r, t.firstChild);
1203
- const a = document.createElement("span");
1204
- a.textContent = "{{/arrayData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), t.appendChild(a);
1205
- }, ge = () => {
1206
- const e = T();
1207
- if (!e) return O;
1218
+ const n = document.createElement("span");
1219
+ n.textContent = "{{#arrayData}}", n.style.display = "none", n.setAttribute("data-hidden-table-start", "true"), t.insertBefore(n, t.firstChild);
1220
+ const o = document.createElement("span");
1221
+ o.textContent = "{{/arrayData}}", o.style.display = "none", o.setAttribute("data-hidden-table-end", "true"), t.appendChild(o);
1222
+ }, fe = () => {
1223
+ const e = H();
1224
+ if (!e) return D;
1208
1225
  const t = e.cloneNode(!0);
1209
- return t.querySelectorAll("table div").forEach((r) => r.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((r) => r.classList.remove("rte-cell-highlight")), t.innerHTML;
1210
- }, et = () => {
1211
- ie(), W.current = _.current, oe({
1226
+ return t.querySelectorAll("table div").forEach((n) => n.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((n) => n.classList.remove("rte-cell-highlight")), t.innerHTML;
1227
+ }, tt = () => {
1228
+ q(), K.current = j.current, le({
1212
1229
  url: "",
1213
1230
  text: "",
1214
1231
  title: "",
1215
1232
  target: "_self"
1216
- }), H(!0);
1217
- }, tt = (e) => {
1233
+ }), O(!0);
1234
+ }, nt = (e) => {
1218
1235
  const t = window.getSelection();
1219
- if (!t || !W.current) return;
1220
- t.removeAllRanges(), t.addRange(W.current);
1221
- let r = e.url.trim();
1222
- /^https?:\/\//i.test(r) || (r = "https://" + r);
1223
- const a = document.createElement("a");
1224
- a.href = r, a.style.cursor = "pointer", a.style.outline = "none", a.textContent = e.text || r, a.title = e.title, a.target = e.target, a.contentEditable = "true";
1225
- const d = t.getRangeAt(0);
1226
- d.deleteContents(), d.insertNode(a);
1236
+ if (!t || !K.current) return;
1237
+ t.removeAllRanges(), t.addRange(K.current);
1238
+ let n = e.url.trim();
1239
+ /^https?:\/\//i.test(n) || (n = "https://" + n);
1240
+ const o = document.createElement("a");
1241
+ o.href = n, o.style.cursor = "pointer", o.style.outline = "none", o.textContent = e.text || n, o.title = e.title, o.target = e.target, o.contentEditable = "true";
1242
+ const s = t.getRangeAt(0);
1243
+ s.deleteContents(), s.insertNode(o);
1227
1244
  const l = document.createTextNode(" ");
1228
- a.after(l);
1245
+ o.after(l);
1229
1246
  const i = document.createRange();
1230
- i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), H(!1), z();
1231
- }, nt = (e) => {
1247
+ i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), O(!1), z();
1248
+ }, rt = (e) => {
1232
1249
  const t = e.target;
1233
1250
  if (t.tagName === "A") {
1234
- const r = t;
1251
+ const n = t;
1235
1252
  if (e.ctrlKey || e.metaKey) {
1236
- window.open(r.href, "_blank", "noopener,noreferrer");
1253
+ window.open(n.href, "_blank", "noopener,noreferrer");
1237
1254
  return;
1238
1255
  }
1239
1256
  e.preventDefault();
1240
- const a = document.createRange();
1241
- a.selectNode(r), W.current = a, oe({
1242
- url: r.href,
1243
- text: r.textContent || r.href,
1244
- title: r.title,
1245
- target: r.target
1246
- }), H(!0);
1257
+ const o = document.createRange();
1258
+ o.selectNode(n), K.current = o, le({
1259
+ url: n.href,
1260
+ text: n.textContent || n.href,
1261
+ title: n.title,
1262
+ target: n.target
1263
+ }), O(!0);
1247
1264
  }
1248
- }, rt = () => {
1249
- const e = T();
1265
+ }, at = () => {
1266
+ const e = H();
1250
1267
  if (!e) return;
1251
1268
  const t = window.getSelection();
1252
- if ((!t || t.rangeCount === 0) && _.current) {
1269
+ if ((!t || t.rangeCount === 0) && j.current) {
1253
1270
  const h = window.getSelection();
1254
- h == null || h.removeAllRanges(), h == null || h.addRange(_.current);
1271
+ h == null || h.removeAllRanges(), h == null || h.addRange(j.current);
1255
1272
  }
1256
- const r = window.getSelection();
1257
- if (!r || r.rangeCount === 0) return;
1258
- const a = r.getRangeAt(0);
1273
+ const n = window.getSelection();
1274
+ if (!n || n.rangeCount === 0) return;
1275
+ const o = n.getRangeAt(0);
1259
1276
  $(), document.execCommand("removeFormat", !1);
1260
- const d = a.cloneContents(), l = document.createElement("div");
1261
- l.appendChild(d);
1277
+ const s = o.cloneContents(), l = document.createElement("div");
1278
+ l.appendChild(s);
1262
1279
  const i = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
1263
1280
  for (; i.nextNode(); ) {
1264
1281
  const h = i.currentNode, C = h.tagName.toUpperCase(), A = h.getAttribute && h.getAttribute("data-mention") !== null;
@@ -1271,93 +1288,107 @@ const Vt = ({
1271
1288
  A.removeChild(C);
1272
1289
  }
1273
1290
  }
1274
- l.querySelectorAll("[style]").forEach((h) => h.removeAttribute("style")), a.deleteContents();
1275
- const f = document.createDocumentFragment();
1276
- for (; l.firstChild; ) f.appendChild(l.firstChild);
1277
- a.insertNode(f);
1278
- const p = document.createRange();
1279
- p.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), p.collapse(!0), r.removeAllRanges(), r.addRange(p), e.normalize(), z();
1280
- }, at = (e) => {
1281
- var a;
1291
+ l.querySelectorAll("[style]").forEach((h) => h.removeAttribute("style")), o.deleteContents();
1292
+ const m = document.createDocumentFragment();
1293
+ for (; l.firstChild; ) m.appendChild(l.firstChild);
1294
+ o.insertNode(m);
1295
+ const f = document.createRange();
1296
+ f.setStartAfter(o.endContainer.nodeType === Node.TEXT_NODE ? o.endContainer : o.startContainer), f.collapse(!0), n.removeAllRanges(), n.addRange(f), e.normalize(), z();
1297
+ }, ot = (e) => {
1298
+ var o;
1282
1299
  let t = e;
1283
1300
  t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
1284
- const r = document.createElement("div");
1285
- return r.innerHTML = t, r.querySelectorAll("br").forEach((d) => {
1286
- d.replaceWith(`
1301
+ const n = document.createElement("div");
1302
+ return n.innerHTML = t, n.querySelectorAll("br").forEach((s) => {
1303
+ s.replaceWith(`
1287
1304
  `);
1288
- }), r.querySelectorAll("p, div, tr").forEach((d) => {
1289
- d.insertAdjacentText("afterend", `
1305
+ }), n.querySelectorAll("p, div, tr").forEach((s) => {
1306
+ s.insertAdjacentText("afterend", `
1290
1307
  `);
1291
- }), r.querySelectorAll("table").forEach((d) => {
1292
- d.insertAdjacentText("afterend", `
1308
+ }), n.querySelectorAll("table").forEach((s) => {
1309
+ s.insertAdjacentText("afterend", `
1293
1310
  `);
1294
- }), ((a = r.textContent) == null ? void 0 : a.replace(/\n{3,}/g, `
1311
+ }), ((o = n.textContent) == null ? void 0 : o.replace(/\n{3,}/g, `
1295
1312
 
1296
1313
  `).trim()) || "";
1314
+ }, he = () => {
1315
+ const e = window.getSelection();
1316
+ if (!e || e.rangeCount === 0) return !1;
1317
+ const t = document.getElementById("rte-editor-body");
1318
+ if (!t) return !1;
1319
+ const n = e.getRangeAt(0);
1320
+ return t.contains(n.startContainer);
1297
1321
  };
1298
- return /* @__PURE__ */ o.createElement("div", {
1299
- className: `rte-wrapper ${(m == null ? void 0 : m.wrapper) || ""}`,
1322
+ return /* @__PURE__ */ a.createElement("div", {
1323
+ className: `rte-wrapper ${(g == null ? void 0 : g.wrapper) || ""}`,
1300
1324
  style: y.wrapper
1301
- }, /* @__PURE__ */ o.createElement("div", {
1325
+ }, /* @__PURE__ */ a.createElement("div", {
1302
1326
  style: {
1303
1327
  flex: 1
1304
1328
  }
1305
- }, /* @__PURE__ */ o.createElement(Ht, {
1306
- exec: K,
1307
- saveSelection: ie,
1308
- handleFileChange: Ke,
1309
- handleFontSizeChange: (e) => K("fontSize", e.target.value),
1310
- handleFontFamilyChange: (e) => K("fontName", e.target.value),
1311
- insertEmoji: Xe,
1312
- handleLink: et,
1313
- removeFormatting: rt,
1314
- visibleActions: De,
1315
- className: m.toolbar,
1329
+ }, /* @__PURE__ */ a.createElement(jt, {
1330
+ exec: X,
1331
+ saveSelection: q,
1332
+ handleFileChange: Xe,
1333
+ handleFontSizeChange: (e) => X("fontSize", e.target.value),
1334
+ handleFontFamilyChange: (e) => X("fontName", e.target.value),
1335
+ insertEmoji: Ye,
1336
+ handleLink: tt,
1337
+ removeFormatting: at,
1338
+ visibleActions: Oe,
1339
+ className: g.toolbar,
1316
1340
  style: y.toolbar
1317
- }), /* @__PURE__ */ o.createElement("div", {
1341
+ }), /* @__PURE__ */ a.createElement("div", {
1318
1342
  ref: k,
1319
- className: `rte-editor ${(m == null ? void 0 : m.editor) || ""}`,
1343
+ id: "rte-editor-body",
1344
+ className: `rte-editor ${(g == null ? void 0 : g.editor) || ""}`,
1320
1345
  style: y.editor,
1321
1346
  contentEditable: !0,
1322
1347
  suppressContentEditableWarning: !0,
1323
- onInput: ue,
1348
+ onKeyUp: q,
1349
+ onMouseUp: q,
1350
+ onInput: () => {
1351
+ q(), ue();
1352
+ },
1324
1353
  onKeyDown: $e,
1325
- onBeforeInput: Ue,
1326
- onContextMenu: Qe,
1327
- onClick: nt
1328
- }), /* @__PURE__ */ o.createElement(jt, {
1329
- show: B,
1354
+ onBeforeInput: We,
1355
+ onContextMenu: Je,
1356
+ onClick: (e) => {
1357
+ q(), rt(e);
1358
+ }
1359
+ }), /* @__PURE__ */ a.createElement(_t, {
1360
+ show: V,
1330
1361
  position: F,
1331
- filtered: ee,
1332
- insertMention: Ie,
1333
- onClose: () => q(!1),
1334
- query: Oe
1335
- }), c && /* @__PURE__ */ o.createElement("div", {
1336
- className: `rte-output ${(m == null ? void 0 : m.output) || ""}`,
1362
+ filtered: te,
1363
+ insertMention: Be,
1364
+ onClose: () => B(!1),
1365
+ query: He
1366
+ }), c && /* @__PURE__ */ a.createElement("div", {
1367
+ className: `rte-output ${(g == null ? void 0 : g.output) || ""}`,
1337
1368
  style: y.output
1338
- }, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, J)), /* @__PURE__ */ o.createElement(_t, {
1369
+ }, /* @__PURE__ */ a.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ a.createElement("p", null, G)), /* @__PURE__ */ a.createElement(Ft, {
1339
1370
  visible: N.visible,
1340
1371
  x: N.x,
1341
1372
  y: N.y,
1342
- onAction: Je,
1373
+ onAction: Ge,
1343
1374
  onClose: () => {
1344
- g(ae(re({}, N), {
1375
+ p(oe(ae({}, N), {
1345
1376
  visible: !1
1346
- })), fe();
1377
+ })), ge();
1347
1378
  }
1348
- }), /* @__PURE__ */ o.createElement(Pt, {
1379
+ }), /* @__PURE__ */ a.createElement(Pt, {
1349
1380
  visible: w,
1350
- linkData: Te,
1351
- onClose: () => H(!1),
1352
- onInsert: tt
1353
- })), s ? /* @__PURE__ */ o.createElement(Ft, {
1354
- className: m.preview,
1381
+ linkData: De,
1382
+ onClose: () => O(!1),
1383
+ onInsert: nt
1384
+ })), d ? /* @__PURE__ */ a.createElement(It, {
1385
+ className: g.preview,
1355
1386
  style: y.preview,
1356
- html: ge()
1387
+ html: fe()
1357
1388
  }) : null);
1358
1389
  };
1359
1390
  export {
1360
- Vt as RichTextEditor,
1361
- Ft as RtePreview,
1362
- Ht as RteToolbar
1391
+ Ut as RichTextEditor,
1392
+ It as RtePreview,
1393
+ jt as RteToolbar
1363
1394
  };