@ryzeup/richtexteditor 1.0.10 → 1.0.12

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 rt = Object.defineProperty, at = Object.defineProperties;
2
- var ot = Object.getOwnPropertyDescriptors;
3
- var be = Object.getOwnPropertySymbols;
4
- var lt = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable;
5
- var xe = (n, c, s) => c in n ? rt(n, c, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[c] = s, re = (n, c) => {
6
- for (var s in c || (c = {}))
7
- lt.call(c, s) && xe(n, s, c[s]);
8
- if (be)
9
- for (var s of be(c))
10
- ct.call(c, s) && xe(n, s, c[s]);
11
- return n;
12
- }, ae = (n, c) => at(n, ot(c));
13
- import * as it from "react";
14
- import o, { useRef as I, useState as z, useEffect as B } from "react";
15
- import { createPortal as st } from "react-dom";
16
- window.React = it;
17
- var ze = {
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
- }, Le = o.createContext && /* @__PURE__ */ o.createContext(ze), dt = ["attr", "size", "title"];
24
- function ut(n, c) {
25
- if (n == null) return {};
26
- var s = mt(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, m;
27
27
  if (Object.getOwnPropertySymbols) {
28
- var w = Object.getOwnPropertySymbols(n);
29
- for (m = 0; m < w.length; m++)
30
- u = w[m], !(c.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(n, u) && (s[u] = n[u]);
28
+ var y = Object.getOwnPropertySymbols(r);
29
+ for (m = 0; m < y.length; m++)
30
+ u = y[m], !(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 mt(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
44
  function Z() {
45
- return Z = Object.assign ? Object.assign.bind() : function(n) {
45
+ return Z = 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;
51
+ return r;
52
52
  }, Z.apply(this, arguments);
53
53
  }
54
- function Re(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);
57
+ var u = Object.getOwnPropertySymbols(r);
58
58
  c && (u = u.filter(function(m) {
59
- return Object.getOwnPropertyDescriptor(n, m).enumerable;
60
- })), s.push.apply(s, u);
59
+ return Object.getOwnPropertyDescriptor(r, m).enumerable;
60
+ })), d.push.apply(d, u);
61
61
  }
62
- return s;
62
+ return d;
63
63
  }
64
- function Q(n) {
64
+ function Q(r) {
65
65
  for (var c = 1; c < arguments.length; c++) {
66
- var s = arguments[c] != null ? arguments[c] : {};
67
- c % 2 ? Re(Object(s), !0).forEach(function(u) {
68
- gt(n, u, s[u]);
69
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(s)) : Re(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 gt(n, c, s) {
76
- return c = ft(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 ft(n) {
79
- var c = ht(n, "string");
78
+ function vt(r) {
79
+ var c = Et(r, "string");
80
80
  return typeof c == "symbol" ? c : c + "";
81
81
  }
82
- function ht(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 ke(n) {
93
- return n && n.map((c, s) => /* @__PURE__ */ o.createElement(c.tag, Q({
94
- key: s
95
- }, c.attr), ke(c.child)));
92
+ function Te(r) {
93
+ return r && r.map((c, d) => /* @__PURE__ */ a.createElement(c.tag, Q({
94
+ key: d
95
+ }, c.attr), Te(c.child)));
96
96
  }
97
- function S(n) {
98
- return (c) => /* @__PURE__ */ o.createElement(pt, Z({
99
- attr: Q({}, n.attr)
100
- }, c), ke(n.child));
97
+ function M(r) {
98
+ return (c) => /* @__PURE__ */ a.createElement(yt, Z({
99
+ attr: Q({}, r.attr)
100
+ }, c), Te(r.child));
101
101
  }
102
- function pt(n) {
103
- var c = (s) => {
102
+ function yt(r) {
103
+ var c = (d) => {
104
104
  var {
105
105
  attr: u,
106
106
  size: m,
107
- title: w
108
- } = n, R = ut(n, dt), 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({
107
+ title: y
108
+ } = r, R = ft(r, gt), b = m || d.size || "1em", E;
109
+ return d.className && (E = d.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ a.createElement("svg", Z({
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
115
  style: Q(Q({
116
- color: n.color || s.color
117
- }, s.style), n.style),
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
- }), w && /* @__PURE__ */ o.createElement("title", null, w), n.children);
121
+ }), y && /* @__PURE__ */ a.createElement("title", null, y), r.children);
122
122
  };
123
- return Le !== void 0 ? /* @__PURE__ */ o.createElement(Le.Consumer, null, (s) => c(s)) : c(ze);
123
+ return Me !== void 0 ? /* @__PURE__ */ a.createElement(Me.Consumer, null, (d) => c(d)) : c(Ne);
124
124
  }
125
- function vt(n) {
126
- return S({ 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 Et(n) {
129
- return S({ 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 yt(n) {
132
- return S({ 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 wt(n) {
135
- return S({ 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 Ct(n) {
138
- return S({ 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 bt(n) {
141
- return S({ 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 xt(n) {
144
- return S({ 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 Lt(n) {
147
- return S({ 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 Rt(n) {
150
- return S({ 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 St(n) {
153
- return S({ 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 Mt(n) {
156
- return S({ 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 zt(n) {
159
- return S({ 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 kt(n) {
162
- return S({ 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 At(n) {
165
- return S({ 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 Nt(n) {
168
- return S({ 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 Tt = [
170
+ const Ht = [
171
171
  "😀",
172
172
  "😁",
173
173
  "😂",
@@ -279,57 +279,57 @@ const Tt = [
279
279
  "👏",
280
280
  "🫶",
281
281
  "👐"
282
- ], Dt = ({
283
- exec: n,
282
+ ], jt = ({
283
+ exec: r,
284
284
  saveSelection: c,
285
- handleFileChange: s,
285
+ handleFileChange: d,
286
286
  handleFontSizeChange: u,
287
287
  handleFontFamilyChange: m,
288
288
  // insertListBlock,
289
- insertEmoji: w,
289
+ insertEmoji: y,
290
290
  handleLink: R,
291
291
  removeFormatting: b,
292
292
  visibleActions: E,
293
- className: T,
294
- style: H
293
+ className: D,
294
+ style: _
295
295
  }) => {
296
- var q, K;
297
- const k = I(null), N = I(null), x = I(null), [$, j] = z(!1), [W, J] = z({
296
+ var V, N;
297
+ const k = I(null), O = I(null), x = I(null), [J, U] = S(!1), [q, B] = S({
298
298
  x: 0,
299
299
  y: 0
300
300
  });
301
- B(() => {
302
- const f = (y) => {
303
- !y.target.closest(".rte-emoji-popup") && !y.target.closest("button[title='Emoji']") && j(!1);
301
+ P(() => {
302
+ const f = (w) => {
303
+ !w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && U(!1);
304
304
  };
305
305
  return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
306
306
  }, []);
307
307
  const F = (f) => {
308
- var P;
308
+ var H;
309
309
  f.preventDefault();
310
- const y = f.currentTarget.dataset.command;
311
- if (y)
312
- switch (y) {
310
+ const w = f.currentTarget.dataset.command;
311
+ if (w)
312
+ switch (w) {
313
313
  case "bold":
314
314
  case "italic":
315
315
  case "underline":
316
316
  case "insertUnorderedList":
317
317
  case "insertOrderedList":
318
318
  case "removeFormat":
319
- n(y);
319
+ r(w);
320
320
  break;
321
321
  case "insertImage": {
322
- (P = k.current) == null || P.click();
322
+ (H = k.current) == null || H.click();
323
323
  break;
324
324
  }
325
325
  default:
326
- console.warn("Unknown command:", y);
326
+ console.warn("Unknown command:", w);
327
327
  }
328
- }, U = (f) => {
329
- n("foreColor", f.target.value);
330
- }, _ = (f) => {
331
- n("backColor", f.target.value);
332
- }, [L, D] = z({
328
+ }, G = (f) => {
329
+ r("foreColor", f.target.value);
330
+ }, ee = (f) => {
331
+ r("backColor", f.target.value);
332
+ }, [L, j] = S({
333
333
  bold: !1,
334
334
  italic: !1,
335
335
  underline: !1,
@@ -346,9 +346,9 @@ const Tt = [
346
346
  color: !1,
347
347
  highlight: !1
348
348
  });
349
- return B(() => {
349
+ return P(() => {
350
350
  const f = () => {
351
- D({
351
+ j({
352
352
  bold: document.queryCommandState("bold"),
353
353
  italic: document.queryCommandState("italic"),
354
354
  underline: document.queryCommandState("underline"),
@@ -367,116 +367,116 @@ const Tt = [
367
367
  });
368
368
  };
369
369
  return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
370
- }, []), /* @__PURE__ */ o.createElement("div", {
371
- className: `rte-toolbar ${T || ""}`,
372
- style: H
373
- }, E.bold && /* @__PURE__ */ o.createElement("button", {
370
+ }, []), /* @__PURE__ */ a.createElement("div", {
371
+ className: `rte-toolbar ${D || ""}`,
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(bt, 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(Lt, 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(kt, 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(St, 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(wt, 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(Rt, 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
406
  onMouseDown: (f) => {
407
407
  f.preventDefault(), c(), b();
408
408
  },
409
409
  className: L.removeFormat ? "rte-active" : ""
410
- }, /* @__PURE__ */ o.createElement(Nt, 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(yt, 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
429
  onMouseDown: (f) => {
430
430
  f.preventDefault(), c();
431
- const y = f.currentTarget.getBoundingClientRect();
432
- J({
433
- x: y.left,
434
- y: y.bottom + 8
431
+ const w = f.currentTarget.getBoundingClientRect();
432
+ B({
433
+ x: w.left,
434
+ y: w.bottom + 8
435
435
  // small spacing
436
- }), j((P) => !P);
436
+ }), U((H) => !H);
437
437
  },
438
438
  className: L.emoji ? "rte-active" : ""
439
- }, /* @__PURE__ */ o.createElement(Mt, null)), $ && /* @__PURE__ */ st(/* @__PURE__ */ o.createElement("div", {
439
+ }, /* @__PURE__ */ a.createElement(At, null)), J && /* @__PURE__ */ mt(/* @__PURE__ */ a.createElement("div", {
440
440
  className: "rte-emoji-popup",
441
441
  style: {
442
- top: W.y,
443
- left: W.x
442
+ top: q.y,
443
+ left: q.x
444
444
  }
445
- }, Tt.map((f, y) => /* @__PURE__ */ o.createElement("span", {
446
- key: y,
445
+ }, Ht.map((f, w) => /* @__PURE__ */ a.createElement("span", {
446
+ key: w,
447
447
  style: {
448
448
  fontSize: "20px",
449
449
  cursor: "pointer",
450
450
  textAlign: "center"
451
451
  },
452
- onMouseDown: (P) => {
453
- P.preventDefault(), w(f), j(!1);
452
+ onMouseDown: (H) => {
453
+ H.preventDefault(), y(f), U(!1);
454
454
  }
455
- }, f))), document.body)), E.color && /* @__PURE__ */ o.createElement("div", {
455
+ }, f))), 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
461
  onMouseDown: (f) => {
462
- var y;
463
- f.preventDefault(), c(), (y = N.current) == null || y.click();
462
+ var w;
463
+ f.preventDefault(), c(), (w = O.current) == null || w.click();
464
464
  },
465
465
  style: {
466
466
  display: "flex",
467
467
  alignItems: "center",
468
468
  justifyContent: "center",
469
- color: ((q = N.current) == null ? void 0 : q.value) || "#000",
469
+ color: ((V = O.current) == null ? void 0 : V.value) || "#000",
470
470
  fontSize: "18px"
471
471
  },
472
472
  className: L.color ? "rte-active" : ""
473
- }, /* @__PURE__ */ o.createElement(At, null)), /* @__PURE__ */ o.createElement("input", {
474
- ref: N,
473
+ }, /* @__PURE__ */ a.createElement(Dt, null)), /* @__PURE__ */ a.createElement("input", {
474
+ ref: O,
475
475
  type: "color",
476
476
  defaultValue: "#000000",
477
477
  onChange: (f) => {
478
- var y;
479
- U(f), ((y = f.target.parentElement) == null ? void 0 : y.querySelector("button")).style.color = f.target.value;
478
+ var w;
479
+ G(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
480
480
  },
481
481
  style: {
482
482
  position: "absolute",
@@ -485,30 +485,30 @@ const Tt = [
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
494
  onMouseDown: (f) => {
495
- var y;
496
- f.preventDefault(), c(), (y = x.current) == null || y.click();
495
+ var w;
496
+ f.preventDefault(), c(), (w = x.current) == null || w.click();
497
497
  },
498
498
  style: {
499
499
  display: "flex",
500
500
  alignItems: "center",
501
501
  justifyContent: "center",
502
- color: ((K = x.current) == null ? void 0 : K.value) || "#000",
502
+ color: ((N = x.current) == null ? void 0 : N.value) || "#000",
503
503
  fontSize: "18px"
504
504
  },
505
505
  className: L.highlight ? "rte-active" : ""
506
- }, /* @__PURE__ */ o.createElement(xt, null)), /* @__PURE__ */ o.createElement("input", {
506
+ }, /* @__PURE__ */ a.createElement(St, null)), /* @__PURE__ */ a.createElement("input", {
507
507
  ref: x,
508
508
  type: "color",
509
509
  onChange: (f) => {
510
- var y;
511
- _(f), ((y = f.target.parentElement) == null ? void 0 : y.querySelector("button")).style.color = f.target.value;
510
+ var w;
511
+ ee(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
512
512
  },
513
513
  defaultValue: "#000000",
514
514
  style: {
@@ -518,95 +518,95 @@ const Tt = [
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
523
  onMouseDown: (f) => f.preventDefault(),
524
- onClick: () => n("justifyLeft"),
524
+ onClick: () => r("justifyLeft"),
525
525
  className: L.alignLeft ? "rte-active" : ""
526
- }, /* @__PURE__ */ o.createElement(Ct, null)), /* @__PURE__ */ o.createElement("button", {
526
+ }, /* @__PURE__ */ a.createElement(Lt, null)), /* @__PURE__ */ a.createElement("button", {
527
527
  title: "Align Center",
528
528
  onMouseDown: (f) => f.preventDefault(),
529
- onClick: () => n("justifyCenter"),
529
+ onClick: () => r("justifyCenter"),
530
530
  className: L.alignCenter ? "rte-active" : ""
531
- }, /* @__PURE__ */ o.createElement(vt, null)), /* @__PURE__ */ o.createElement("button", {
531
+ }, /* @__PURE__ */ a.createElement(wt, null)), /* @__PURE__ */ a.createElement("button", {
532
532
  title: "Align Right",
533
533
  onMouseDown: (f) => f.preventDefault(),
534
- onClick: () => n("justifyRight"),
534
+ onClick: () => r("justifyRight"),
535
535
  className: L.alignRight ? "rte-active" : ""
536
- }, /* @__PURE__ */ o.createElement(Et, 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
538
  onMouseDown: (f) => f.preventDefault(),
539
- onClick: () => n("insertTable"),
539
+ onClick: () => r("insertTable"),
540
540
  className: L.table ? "rte-active" : ""
541
- }, /* @__PURE__ */ o.createElement(zt, 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
545
  onChange: m
546
- }, /* @__PURE__ */ o.createElement("option", {
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
- }, Ot = ({
577
- show: n,
576
+ }, _t = ({
577
+ show: r,
578
578
  position: c,
579
- filtered: s,
579
+ filtered: d,
580
580
  insertMention: u,
581
581
  onClose: m,
582
- query: w
582
+ query: y
583
583
  }) => {
584
584
  const R = I(null);
585
- return B(() => {
585
+ return P(() => {
586
586
  const b = (E) => {
587
587
  R.current && !R.current.contains(E.target) && m();
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, m]), 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 T = b.toLowerCase(), H = w.toLowerCase(), k = T.indexOf(H);
604
- let N = b;
605
- if (k !== -1 && w.length > 0) {
606
- const x = k + w.length;
607
- N = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, x)}</span>` + b.substring(x);
603
+ const D = b.toLowerCase(), _ = y.toLowerCase(), k = D.indexOf(_);
604
+ let O = b;
605
+ if (k !== -1 && y.length > 0) {
606
+ const x = k + y.length;
607
+ O = 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,142 +620,142 @@ const Tt = [
620
620
  fontSize: "14px"
621
621
  },
622
622
  dangerouslySetInnerHTML: {
623
- __html: N
623
+ __html: O
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 Se(n) {
636
- return S({ 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 S({ 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 Y(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 Ht = ({
642
- visible: n,
641
+ const Ft = ({
642
+ visible: r,
643
643
  x: c,
644
- y: s,
644
+ y: d,
645
645
  onAction: u,
646
646
  onClose: m
647
647
  }) => {
648
- if (!n) return null;
649
- const w = {
650
- top: s,
648
+ if (!r) return null;
649
+ const y = {
650
+ top: d,
651
651
  left: c
652
652
  };
653
- return /* @__PURE__ */ o.createElement("div", {
654
- style: w,
653
+ return /* @__PURE__ */ a.createElement("div", {
654
+ style: y,
655
655
  className: "rte-table-menu",
656
656
  onMouseLeave: m
657
- }, /* @__PURE__ */ o.createElement("button", {
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(Y, 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(Y, 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(Y, 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(Y, null), " Insert col right"), /* @__PURE__ */ a.createElement("button", {
666
666
  onClick: () => u("deleteRow")
667
- }, /* @__PURE__ */ o.createElement(Se, 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(Se, null), " Delete column"));
670
- }, jt = ({
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
- const u = (w) => {
676
- const R = w.target;
675
+ const u = (y) => {
676
+ const R = y.target;
677
677
  if (R.tagName === "A") {
678
- w.preventDefault();
678
+ y.preventDefault();
679
679
  const b = R.href;
680
680
  b && window.open(b, "_blank", "noopener,noreferrer");
681
681
  }
682
- }, m = (w) => w.replace(/{{\s*(.*?)\s*}}/g, "$1");
683
- return /* @__PURE__ */ o.createElement("div", {
682
+ }, m = (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: m(r)
689
689
  }
690
690
  });
691
- }, _t = ({
692
- visible: n,
691
+ }, Pt = ({
692
+ visible: r,
693
693
  linkData: c,
694
- onClose: s,
694
+ onClose: d,
695
695
  onInsert: u
696
696
  }) => {
697
- const [m, w] = z(""), [R, b] = z(""), [E, T] = z(""), [H, k] = z("_self");
698
- if (B(() => {
699
- n ? (w(c.url || ""), b(c.text || ""), T(c.title || ""), k(c.target || "_self")) : (w(""), b(""), T(""), k("_self"));
700
- }, [n, c]), !n) return null;
701
- const N = () => {
697
+ const [m, y] = S(""), [R, b] = S(""), [E, D] = S(""), [_, k] = S("_self");
698
+ if (P(() => {
699
+ r ? (y(c.url || ""), b(c.text || ""), D(c.title || ""), k(c.target || "_self")) : (y(""), b(""), D(""), k("_self"));
700
+ }, [r, c]), !r) return null;
701
+ const O = () => {
702
702
  u({
703
703
  url: m,
704
704
  text: R,
705
705
  title: E,
706
- target: H
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
+ }, m ? "Edit Link" : "Insert Link"), /* @__PURE__ */ a.createElement("input", {
717
717
  type: "text",
718
718
  className: "rte-link-modal__input",
719
719
  placeholder: "URL",
720
720
  value: m,
721
- onChange: (x) => w(x.target.value)
722
- }), /* @__PURE__ */ o.createElement("input", {
721
+ onChange: (x) => y(x.target.value)
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) => T(x.target.value)
734
- }), /* @__PURE__ */ o.createElement("select", {
733
+ onChange: (x) => D(x.target.value)
734
+ }), /* @__PURE__ */ a.createElement("select", {
735
735
  className: "rte-link-modal__select",
736
- value: H,
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: N
749
+ onClick: O
750
750
  }, "OK"))));
751
751
  };
752
- function Me(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 Bt = ({
756
- atSuggestions: n = [],
755
+ const $t = ({
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,
@@ -767,31 +767,31 @@ const Bt = ({
767
767
  highlight: !1
768
768
  },
769
769
  classNames: m = {},
770
- styles: w = {},
770
+ styles: y = {},
771
771
  handleGetHtml: R = () => {
772
772
  },
773
773
  onChange: b = () => {
774
774
  },
775
775
  value: E,
776
- onMentionSelect: T = () => {
776
+ onMentionSelect: D = () => {
777
777
  },
778
- handleAddAttributes: H = () => {
778
+ handleAddAttributes: _ = () => {
779
779
  }
780
780
  }) => {
781
- var ge, fe, he, pe, ve, Ee, ye, we;
782
- const k = I(null), [N, x] = z(E != null && E.length ? E : " "), [$, j] = z(!1), [W, J] = z({
781
+ var pe, ve, Ee, ye, we, Ce, be, xe;
782
+ const k = I(null), [O, x] = S(E != null && E.length ? E : " "), [J, U] = S(""), [q, B] = S(!1), [F, G] = S({
783
783
  x: 0,
784
784
  y: 0
785
- }), [F, U] = z([]), _ = I(null), L = I(null), [D, q] = z({
785
+ }), [ee, L] = S([]), j = I(null), V = I(null), [N, f] = S({
786
786
  visible: !1,
787
787
  x: 0,
788
788
  y: 0
789
- }), [K, f] = z(!1), y = I(null), [P, oe] = z({
789
+ }), [w, H] = S(!1), W = I(null), [De, le] = S({
790
790
  url: "",
791
791
  text: "",
792
792
  title: "",
793
793
  target: "_self"
794
- }), Ae = {
794
+ }), Oe = {
795
795
  bold: !0,
796
796
  italic: !0,
797
797
  underline: !0,
@@ -799,198 +799,209 @@ const Bt = ({
799
799
  unorderedList: !0,
800
800
  orderedList: !0,
801
801
  align: !0,
802
- link: (ge = u.link) != null ? ge : !1,
803
- image: (fe = u.image) != null ? fe : !1,
804
- emoji: (he = u.emoji) != null ? he : !1,
805
- table: (pe = u.table) != null ? pe : !1,
806
- color: (ve = u.color) != null ? ve : !1,
807
- fontFamily: (Ee = u.fontFamily) != null ? Ee : !1,
808
- fontSize: (ye = u.fontSize) != null ? ye : !1,
809
- highlight: (we = u.fontSize) != null ? we : !1
810
- }, [Ne, le] = z(""), [G, ee] = z([]), O = () => k.current, M = () => {
811
- const e = me();
812
- x(e), R == null || R(e);
813
- const t = nt(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, te] = S([]), T = () => k.current, z = () => {
811
+ const e = he();
812
+ U(e), R == null || R(e);
813
+ const t = ot(e);
814
814
  b(t);
815
- const r = Ie(), a = Me(r);
816
- JSON.stringify(a) !== JSON.stringify(G) && (ee(a), T(a));
817
- }, ce = () => {
815
+ const n = $e(), o = Ae(n);
816
+ JSON.stringify(o) !== JSON.stringify(ie) && (te(o), D(o));
817
+ }, se = () => {
818
818
  const e = window.getSelection();
819
- e != null && e.rangeCount && (_.current = e.getRangeAt(0));
820
- }, V = () => {
819
+ !e || e.rangeCount === 0 || ne() && (j.current = e.getRangeAt(0).cloneRange());
820
+ }, $ = () => {
821
821
  const e = window.getSelection();
822
- e && _.current && (e.removeAllRanges(), e.addRange(_.current));
823
- }, Te = (e, t) => {
824
- const r = window.getSelection();
825
- r && r.rangeCount > 0 && (_.current = r.getRangeAt(0)), V(), document.execCommand(e, !1, t), M();
822
+ e && j.current && (e.removeAllRanges(), e.addRange(j.current));
823
+ }, je = (e, t) => {
824
+ const n = window.getSelection();
825
+ n && n.rangeCount > 0 && (j.current = n.getRangeAt(0)), $(), document.execCommand(e, !1, t), z();
826
826
  };
827
- B(() => {
828
- const e = O();
829
- e && !e.innerHTML && (e.innerHTML = N), M();
830
- }, []), B(() => () => {
827
+ P(() => {
828
+ const e = T();
829
+ e && !e.innerHTML && (e.innerHTML = O), z();
830
+ }, []), P(() => () => {
831
831
  document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
832
- }, []), B(() => {
833
- H && H((e) => {
834
- Pe(e);
832
+ }, []), P(() => {
833
+ _ && _((e) => {
834
+ Ve(e);
835
+ });
836
+ }, []), P(() => {
837
+ const e = T();
838
+ if (!e) return;
839
+ e.querySelectorAll("table").forEach((n) => {
840
+ ge(n), n.querySelectorAll("th, td").forEach((s) => X(s));
835
841
  });
836
842
  }, []);
837
- const ie = (e) => {
843
+ const de = (e) => {
838
844
  for (; e && e.nodeName !== "LI"; )
839
845
  e = e.parentNode;
840
846
  return e;
841
- }, De = (e) => {
842
- let t = 0, r = e.parentElement;
843
- for (; r; )
844
- (r.tagName === "UL" || r.tagName === "OL") && t++, r = r.parentElement;
847
+ }, _e = (e) => {
848
+ let t = 0, n = e.parentElement;
849
+ for (; n; )
850
+ (n.tagName === "UL" || n.tagName === "OL") && t++, n = n.parentElement;
845
851
  return t;
846
- }, Oe = (e) => {
847
- const t = e.querySelector("li"), r = t ? De(t) : 1;
852
+ }, Fe = (e) => {
853
+ const t = e.querySelector("li"), n = t ? _e(t) : 1;
848
854
  if (e.querySelector("[data-hidden-array-start]")) return;
849
- const a = `{{#arrayData${r > 1 ? r : ""}}}`, d = `{{/arrayData${r > 1 ? r : ""}}}`, l = document.createElement("span");
850
- l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
855
+ const o = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
856
+ l.textContent = o, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
851
857
  const i = document.createElement("span");
852
- i.textContent = d, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
853
- }, se = (e) => {
854
- var v;
858
+ i.textContent = s, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
859
+ }, ue = (e) => {
860
+ var p;
855
861
  const t = window.getSelection();
856
862
  if (!(t != null && t.rangeCount)) return;
857
- const r = t.getRangeAt(0), a = ie(r.startContainer);
858
- let d, l;
859
- if (a) {
860
- let g = a.querySelector(e);
861
- g || (g = document.createElement(e), g.style.margin = "0", g.style.paddingLeft = "20px", a.appendChild(g)), l = g, d = document.createElement("li"), d.textContent = "​", l.appendChild(d);
863
+ const n = t.getRangeAt(0), o = de(n.startContainer);
864
+ let s, l;
865
+ if (o) {
866
+ let g = o.querySelector(e);
867
+ g || (g = document.createElement(e), g.style.margin = "0", g.style.paddingLeft = "20px", o.appendChild(g)), l = g, s = document.createElement("li"), s.textContent = "​", l.appendChild(s);
862
868
  } else {
863
869
  document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
864
- const g = O();
870
+ const g = T();
865
871
  if (l = g == null ? void 0 : g.querySelector(`${e}:last-child`), !l) return;
866
- d = l.querySelector("li:last-child");
872
+ s = l.querySelector("li:last-child");
867
873
  }
868
- Oe(l);
874
+ Fe(l);
869
875
  const i = document.createRange();
870
- i.setStart(d, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (v = O()) == null || v.focus(), M();
871
- }, X = (e, t) => {
872
- e === "insertOrderedList" ? se("ol") : e === "insertUnorderedList" ? se("ul") : Te(e, t), e === "insertTable" && We();
873
- }, He = (e) => {
876
+ i.setStart(s, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (p = T()) == null || p.focus(), z();
877
+ }, K = (e, t) => {
878
+ e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : je(e, t), e === "insertTable" && Ze();
879
+ }, Ie = (e) => {
874
880
  const t = document.createElement("span");
875
881
  t.textContent = "​", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
876
- const r = t.getBoundingClientRect();
877
- t.remove(), J({
878
- x: r.left,
879
- y: r.bottom + window.scrollY
880
- }), U(n || []), j(!0), L.current = e.cloneRange();
881
- }, je = () => {
882
+ const n = t.getBoundingClientRect();
883
+ t.remove(), G({
884
+ x: n.left,
885
+ y: n.bottom + window.scrollY
886
+ }), L(r || []), B(!0), V.current = e.cloneRange();
887
+ }, Pe = () => {
882
888
  const e = window.getSelection();
883
889
  if (!e || e.rangeCount === 0) return null;
884
890
  const t = e.anchorNode;
885
- let r = e.anchorOffset;
891
+ let n = e.anchorOffset;
886
892
  if (!t) return null;
887
- let a = t;
888
- for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[r] ? a = a.childNodes[r] : a = t.previousSibling); a; ) {
889
- if (a.nodeType === Node.TEXT_NODE) {
890
- const d = a.textContent || "", l = a === t ? r : d.length, i = d.lastIndexOf("@", l - 1);
893
+ let o = t;
894
+ for (o.nodeType !== Node.TEXT_NODE && (o.childNodes && o.childNodes[n] ? o = o.childNodes[n] : o = t.previousSibling); o; ) {
895
+ if (o.nodeType === Node.TEXT_NODE) {
896
+ const s = o.textContent || "", l = o === t ? n : s.length, i = s.lastIndexOf("@", l - 1);
891
897
  if (i !== -1) {
892
- const v = document.createRange();
893
- return v.setStart(a, i), v.setEnd(a, l), v;
898
+ const p = document.createRange();
899
+ return p.setStart(o, i), p.setEnd(o, l), p;
894
900
  }
895
901
  }
896
- a = a.previousSibling;
902
+ o = o.previousSibling;
897
903
  }
898
904
  return null;
899
- }, _e = (e) => {
905
+ }, Be = (e) => {
900
906
  var l;
901
907
  const t = window.getSelection();
902
908
  if (!t) return;
903
- const r = je();
904
- r ? (t.removeAllRanges(), t.addRange(r)) : L.current && (t.removeAllRanges(), t.addRange(L.current));
905
- const a = document.createElement("span");
906
- a.textContent = `{{${e.name}}}`, a.style.color = "#007bff", a.style.display = "inline", a.contentEditable = "false", a.setAttribute("data-mention", e.value || e.name || "");
909
+ const n = Pe();
910
+ n ? (t.removeAllRanges(), t.addRange(n)) : V.current && (t.removeAllRanges(), t.addRange(V.current));
911
+ const o = document.createElement("span");
912
+ o.textContent = `{{${e.name}}}`, o.style.color = "#007bff", o.style.display = "inline", o.contentEditable = "false", o.setAttribute("data-mention", e.value || e.name || "");
907
913
  try {
908
914
  const i = t.rangeCount ? t.getRangeAt(0) : null;
909
915
  if (i)
910
- i.deleteContents(), i.insertNode(a);
916
+ i.deleteContents(), i.insertNode(o);
911
917
  else {
912
- const p = document.createRange(), h = O();
913
- p.selectNodeContents(h), p.collapse(!1), p.insertNode(a);
918
+ const v = document.createRange(), h = T();
919
+ v.selectNodeContents(h), v.collapse(!1), v.insertNode(o);
914
920
  }
915
- const v = document.createTextNode(" ");
916
- a.after(v);
921
+ const p = document.createTextNode(" ");
922
+ o.after(p);
917
923
  const g = document.createRange();
918
- g.setStartAfter(v), g.collapse(!0), t.removeAllRanges(), t.addRange(g);
924
+ g.setStartAfter(p), g.collapse(!0), t.removeAllRanges(), t.addRange(g);
919
925
  } catch (i) {
920
926
  console.error("insertMention error:", i);
921
927
  }
922
- let d = Me([...G, e]);
923
- ee(d), T(d), j(!1), (l = O()) == null || l.focus(), M();
924
- }, Fe = (e) => {
925
- var i;
926
- V();
927
- const t = window.getSelection();
928
- if (!t || !t.rangeCount) return;
929
- const r = t.getRangeAt(0), a = document.createElement("span");
930
- 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);
931
- const d = document.createTextNode(" ");
932
- a.after(d);
933
- const l = document.createRange();
934
- l.setStartAfter(d), l.collapse(!0), t.removeAllRanges(), t.addRange(l), (i = O()) == null || i.focus();
935
- }, Pe = (e) => {
936
- e.forEach((a) => Fe(a));
937
- const t = [...G, ...e], r = Array.from(new Map(t.map((a) => [a.name, a])).values());
938
- ee(r), T(r), M();
939
- }, Ie = () => {
940
- const e = O();
928
+ let s = Ae([...ie, e]);
929
+ te(s), D(s), B(!1), (l = T()) == null || l.focus(), z();
930
+ }, qe = (e) => {
931
+ const t = T();
932
+ if (!t) return;
933
+ t.focus(), !ne() && j.current && $();
934
+ const n = window.getSelection();
935
+ if (!n || !n.rangeCount || !ne()) {
936
+ const p = document.createRange();
937
+ p.selectNodeContents(t), p.collapse(!1), n == null || n.removeAllRanges(), n == null || n.addRange(p);
938
+ }
939
+ const o = n.getRangeAt(0), s = document.createElement("span");
940
+ s.textContent = `{{${e.name}}}`, s.style.color = "#007bff", s.contentEditable = "false", s.setAttribute("data-mention", e.value || e.name), o.insertNode(s);
941
+ const l = document.createTextNode(" ");
942
+ s.after(l);
943
+ const i = document.createRange();
944
+ i.setStartAfter(l), i.collapse(!0), n.removeAllRanges(), n.addRange(i), t.focus();
945
+ }, Ve = (e) => {
946
+ e.forEach((t) => qe(t)), te((t) => {
947
+ const n = [...t, ...e], o = Array.from(new Map(n.map((s) => [s.name, s])).values());
948
+ return D(o), o;
949
+ }), z();
950
+ }, $e = () => {
951
+ const e = T();
941
952
  if (!e) return [];
942
- const t = e.querySelectorAll("span[data-mention]"), r = [];
943
- return t.forEach((a) => {
944
- const d = a.getAttribute("data-mention") || "", i = (a.textContent || "").match(/{{(.+?)}}/);
945
- i && r.push({
953
+ const t = e.querySelectorAll("span[data-mention]"), n = [];
954
+ return t.forEach((o) => {
955
+ const s = o.getAttribute("data-mention") || "", i = (o.textContent || "").match(/{{(.+?)}}/);
956
+ i && n.push({
946
957
  name: i[1],
947
- value: d
958
+ value: s
948
959
  });
949
- }), r;
950
- }, Be = (e) => {
951
- var r, a, d;
960
+ }), n;
961
+ }, Ue = (e) => {
962
+ var n, o, s;
952
963
  const t = e.key.toLowerCase();
953
- 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") {
954
- const l = window.getSelection(), i = l != null && l.anchorNode ? ie(l.anchorNode) : null;
964
+ 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") {
965
+ const l = window.getSelection(), i = l != null && l.anchorNode ? de(l.anchorNode) : null;
955
966
  if (!i) return;
956
- if (((r = i.textContent) == null ? void 0 : r.replace(/\u200B/g, "").trim()) === "") {
967
+ if (((n = i.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
957
968
  e.preventDefault();
958
- const g = i.parentElement, p = g == null ? void 0 : g.closest("li");
959
- if (p) {
969
+ const g = i.parentElement, v = g == null ? void 0 : g.closest("li");
970
+ if (v) {
960
971
  g == null || g.removeChild(i);
961
972
  const h = document.createElement("p");
962
- h.innerHTML = "<br />", (a = p.parentElement) == null || a.insertBefore(h, p.nextSibling);
973
+ h.innerHTML = "<br />", (o = v.parentElement) == null || o.insertBefore(h, v.nextSibling);
963
974
  const C = document.createRange();
964
975
  C.setStart(h, 0), C.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(C);
965
976
  } else {
966
977
  const h = i.closest("ul, ol");
967
978
  if (h) {
968
979
  const C = document.createElement("p");
969
- C.innerHTML = "<br />", (d = h.parentElement) == null || d.insertBefore(C, h.nextSibling), h.removeChild(i);
980
+ C.innerHTML = "<br />", (s = h.parentElement) == null || s.insertBefore(C, h.nextSibling), h.removeChild(i);
970
981
  const A = document.createRange();
971
982
  A.setStart(C, 0), A.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(A);
972
983
  }
973
984
  }
974
- M();
985
+ z();
975
986
  }
976
987
  }
977
- }, qe = (e) => {
988
+ }, We = (e) => {
978
989
  if (e.data === "@") {
979
- const r = window.getSelection();
980
- if (!(r != null && r.rangeCount)) return;
981
- const a = r.anchorNode;
982
- if (Ve(a))
990
+ const n = window.getSelection();
991
+ if (!(n != null && n.rangeCount)) return;
992
+ const o = n.anchorNode;
993
+ if (Ke(o))
983
994
  return;
984
995
  setTimeout(() => {
985
- He(r.getRangeAt(0)), le(""), U(n), j(!0);
996
+ Ie(n.getRangeAt(0)), ce(""), L(r), B(!0);
986
997
  }, 0);
987
998
  return;
988
999
  }
989
- if ($) {
990
- setTimeout(() => de(), 0);
1000
+ if (q) {
1001
+ setTimeout(() => me(), 0);
991
1002
  return;
992
1003
  }
993
- }, Ve = (e) => {
1004
+ }, Ke = (e) => {
994
1005
  if (!e) return !1;
995
1006
  let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
996
1007
  for (; t; ) {
@@ -998,77 +1009,77 @@ const Bt = ({
998
1009
  t = t.parentElement;
999
1010
  }
1000
1011
  return !1;
1001
- }, de = () => {
1002
- if (M(), !$) return;
1012
+ }, me = () => {
1013
+ if (z(), !q) return;
1003
1014
  const e = window.getSelection();
1004
1015
  if (!e || !e.anchorNode) return;
1005
- const r = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
1006
- if (!r) {
1007
- j(!1);
1016
+ const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
1017
+ if (!n) {
1018
+ B(!1);
1008
1019
  return;
1009
1020
  }
1010
- const a = r[1].toLowerCase();
1011
- le(a);
1012
- const d = n.filter((l) => l.name.toLowerCase().includes(a));
1013
- U(d);
1014
- }, $e = (e) => {
1015
- var a;
1016
- const t = (a = e.target.files) == null ? void 0 : a[0];
1021
+ const o = n[1].toLowerCase();
1022
+ ce(o);
1023
+ const s = r.filter((l) => l.name.toLowerCase().includes(o));
1024
+ L(s);
1025
+ }, Xe = (e) => {
1026
+ var o;
1027
+ const t = (o = e.target.files) == null ? void 0 : o[0];
1017
1028
  if (!t) return;
1018
- const r = new FileReader();
1019
- r.onload = (d) => {
1029
+ const n = new FileReader();
1030
+ n.onload = (s) => {
1020
1031
  var A;
1021
- const l = (A = d.target) == null ? void 0 : A.result;
1022
- V();
1032
+ const l = (A = s.target) == null ? void 0 : A.result;
1033
+ $();
1023
1034
  const i = window.getSelection();
1024
- let v = i && i.rangeCount ? i.getRangeAt(0) : null;
1035
+ let p = i && i.rangeCount ? i.getRangeAt(0) : null;
1025
1036
  const g = document.createElement("img");
1026
1037
  g.src = l, g.alt = t.name || "image", g.className = "rte-inserted-image", g.contentEditable = "true";
1027
- const p = O();
1028
- if (!v || !p) {
1029
- p == null || p.appendChild(g);
1030
- const Ce = document.createTextNode(" ");
1031
- p == null || p.appendChild(Ce);
1032
- const ne = document.createRange();
1033
- ne.setStartAfter(Ce), ne.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(ne), p == null || p.focus(), M(), e.target.value = "";
1038
+ const v = T();
1039
+ if (!p || !v) {
1040
+ v == null || v.appendChild(g);
1041
+ const Le = document.createTextNode(" ");
1042
+ v == null || v.appendChild(Le);
1043
+ const re = document.createRange();
1044
+ re.setStartAfter(Le), re.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(re), v == null || v.focus(), z(), e.target.value = "";
1034
1045
  return;
1035
1046
  }
1036
- v.deleteContents(), v.insertNode(g);
1047
+ p.deleteContents(), p.insertNode(g);
1037
1048
  const h = document.createTextNode(" ");
1038
1049
  g.after(h);
1039
1050
  const C = document.createRange();
1040
- C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), p.focus(), M(), e.target.value = "";
1041
- }, r.readAsDataURL(t);
1042
- }, Ue = (e) => {
1043
- var d;
1044
- V();
1051
+ C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), v.focus(), z(), e.target.value = "";
1052
+ }, n.readAsDataURL(t);
1053
+ }, Ye = (e) => {
1054
+ var s;
1055
+ $();
1045
1056
  const t = window.getSelection();
1046
1057
  if (!(t != null && t.rangeCount)) return;
1047
- const r = t.getRangeAt(0), a = document.createTextNode(e);
1048
- r.insertNode(a), r.setStartAfter(a), r.collapse(!0), t.removeAllRanges(), t.addRange(r), (d = O()) == null || d.focus(), M();
1049
- }, We = () => {
1050
- V();
1058
+ const n = t.getRangeAt(0), o = document.createTextNode(e);
1059
+ n.insertNode(o), n.setStartAfter(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = T()) == null || s.focus(), z();
1060
+ }, Ze = () => {
1061
+ $();
1051
1062
  const e = document.createElement("table");
1052
1063
  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);
1053
1064
  const t = document.createElement("thead");
1054
1065
  m.thead && t.classList.add(m.thead);
1055
- const r = document.createElement("tbody");
1056
- m.tbody && r.classList.add(m.tbody);
1057
- const a = document.createElement("tr");
1058
- m.tr && a.classList.add(m.tr);
1059
- const d = document.createElement("tr");
1060
- m.tr && d.classList.add(m.tr);
1061
- for (let v = 0; v < 2; v++) {
1066
+ const n = document.createElement("tbody");
1067
+ m.tbody && n.classList.add(m.tbody);
1068
+ const o = document.createElement("tr");
1069
+ m.tr && o.classList.add(m.tr);
1070
+ const s = document.createElement("tr");
1071
+ m.tr && s.classList.add(m.tr);
1072
+ for (let p = 0; p < 2; p++) {
1062
1073
  const g = document.createElement("th");
1063
- g.textContent = `Header ${v + 1}`, g.style.border = "1px solid #999", g.style.padding = "8px", g.style.position = "relative", g.style.backgroundColor = "lightgray", m.th && g.classList.add(m.th);
1064
- const p = document.createElement("td");
1065
- 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), te(g), te(p), a.appendChild(g), d.appendChild(p);
1074
+ g.textContent = `Header ${p + 1}`, g.style.border = "1px solid #999", g.style.padding = "8px", g.style.position = "relative", g.style.backgroundColor = "lightgray", m.th && g.classList.add(m.th);
1075
+ const v = document.createElement("td");
1076
+ v.textContent = `Row 1 Col ${p + 1}`, v.style.border = "1px solid #999", v.style.padding = "8px", v.style.position = "relative", v.style.backgroundColor = "#fff", m.td && v.classList.add(m.td), X(g), X(v), o.appendChild(g), s.appendChild(v);
1066
1077
  }
1067
- t.appendChild(a), r.appendChild(d), e.appendChild(t), e.appendChild(r), Qe(e), Ke(e);
1078
+ t.appendChild(o), n.appendChild(s), e.appendChild(t), e.appendChild(n), et(e), ge(e);
1068
1079
  const l = window.getSelection();
1069
1080
  if (!(l != null && l.rangeCount)) return;
1070
- l.getRangeAt(0).insertNode(e), M();
1071
- }, Ke = (e) => {
1081
+ l.getRangeAt(0).insertNode(e), z();
1082
+ }, ge = (e) => {
1072
1083
  const t = document.createElement("div");
1073
1084
  Object.assign(t.style, {
1074
1085
  position: "absolute",
@@ -1081,21 +1092,21 @@ const Bt = ({
1081
1092
  zIndex: "20",
1082
1093
  borderRadius: "2px"
1083
1094
  });
1084
- let r = 0, a = 0, d = 0, l = 0;
1095
+ let n = 0, o = 0, s = 0, l = 0;
1085
1096
  t.addEventListener("mousedown", (i) => {
1086
- i.preventDefault(), r = i.clientX, a = i.clientY;
1087
- const v = e.getBoundingClientRect();
1088
- d = v.width, l = v.height;
1097
+ i.preventDefault(), n = i.clientX, o = i.clientY;
1098
+ const p = e.getBoundingClientRect();
1099
+ s = p.width, l = p.height;
1089
1100
  const g = (h) => {
1090
- const C = Math.max(100, d + (h.clientX - r)), A = Math.max(60, l + (h.clientY - a));
1091
- e.style.width = `${C}px`, e.style.height = `${A}px`, M();
1092
- }, p = () => {
1093
- document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p), M();
1101
+ const C = Math.max(100, s + (h.clientX - n)), A = Math.max(60, l + (h.clientY - o));
1102
+ e.style.width = `${C}px`, e.style.height = `${A}px`, z();
1103
+ }, v = () => {
1104
+ document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", v), z();
1094
1105
  };
1095
- document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
1106
+ document.addEventListener("mousemove", g), document.addEventListener("mouseup", v);
1096
1107
  }), e.appendChild(t);
1097
- }, te = (e) => {
1098
- const t = document.createElement("div"), r = document.createElement("div");
1108
+ }, X = (e) => {
1109
+ const t = document.createElement("div"), n = document.createElement("div");
1099
1110
  Object.assign(t.style, {
1100
1111
  position: "absolute",
1101
1112
  right: "0",
@@ -1105,7 +1116,7 @@ const Bt = ({
1105
1116
  cursor: "col-resize",
1106
1117
  background: "rgba(0,0,0,0.15)",
1107
1118
  zIndex: "10"
1108
- }), Object.assign(r.style, {
1119
+ }), Object.assign(n.style, {
1109
1120
  position: "absolute",
1110
1121
  bottom: "0",
1111
1122
  left: "0",
@@ -1114,243 +1125,249 @@ const Bt = ({
1114
1125
  cursor: "row-resize",
1115
1126
  background: "rgba(0,0,0,0.15)",
1116
1127
  zIndex: "10"
1117
- }), Xe(e, t, r), e.appendChild(t), e.appendChild(r);
1118
- }, Xe = (e, t, r) => {
1119
- let a = 0, d = 0, l = 0, i = 0;
1128
+ }), Qe(e, t, n), e.appendChild(t), e.appendChild(n);
1129
+ }, Qe = (e, t, n) => {
1130
+ let o = 0, s = 0, l = 0, i = 0;
1120
1131
  t.addEventListener("mousedown", (h) => {
1121
- h.preventDefault(), a = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", p);
1122
- }), r.addEventListener("mousedown", (h) => {
1123
- h.preventDefault(), d = h.clientY, i = e.offsetHeight, document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
1132
+ h.preventDefault(), o = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", p), document.addEventListener("mouseup", v);
1133
+ }), n.addEventListener("mousedown", (h) => {
1134
+ h.preventDefault(), s = h.clientY, i = e.offsetHeight, document.addEventListener("mousemove", g), document.addEventListener("mouseup", v);
1124
1135
  });
1125
- const v = (h) => {
1126
- const C = l + (h.clientX - a);
1136
+ const p = (h) => {
1137
+ const C = l + (h.clientX - o);
1127
1138
  e.style.width = `${Math.max(30, C)}px`;
1128
1139
  }, g = (h) => {
1129
- const C = i + (h.clientY - d);
1140
+ const C = i + (h.clientY - s);
1130
1141
  e.style.height = `${Math.max(20, C)}px`;
1131
- }, p = () => {
1132
- document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p);
1142
+ }, v = () => {
1143
+ document.removeEventListener("mousemove", p), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", v);
1133
1144
  };
1134
- }, Ye = (e) => {
1135
- const r = e.target.closest("td, th");
1136
- r && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), r.classList.add("rte-cell-highlight"), q({
1145
+ }, Je = (e) => {
1146
+ const n = e.target.closest("td, th");
1147
+ n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((o) => o.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), f({
1137
1148
  visible: !0,
1138
1149
  x: e.clientX,
1139
1150
  y: e.clientY,
1140
- cell: r
1151
+ cell: n
1141
1152
  }));
1142
- }, ue = () => {
1153
+ }, fe = () => {
1143
1154
  document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
1144
- }, Ze = (e) => {
1145
- if (!D.cell) return;
1146
- const t = D.cell.closest("table"), r = D.cell.cellIndex, a = D.cell.parentElement.rowIndex, d = (l) => {
1147
- const i = l.tagName.toLowerCase(), v = document.createElement(i);
1148
- return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, te(v), v;
1155
+ }, Ge = (e) => {
1156
+ if (!N.cell) return;
1157
+ const t = N.cell.closest("table"), n = N.cell.cellIndex, o = N.cell.parentElement.rowIndex, s = (l) => {
1158
+ const i = l.tagName.toLowerCase(), p = document.createElement(i);
1159
+ return p.textContent = l.textContent || "", p.style.cssText = l.style.cssText, X(p), p;
1149
1160
  };
1150
1161
  switch (e) {
1151
1162
  case "insertRowAbove": {
1152
- const l = t.rows[a], i = t.insertRow(a);
1153
- Array.from(l.cells).forEach((v) => {
1154
- i.appendChild(d(v));
1163
+ const l = t.rows[o], i = t.insertRow(o);
1164
+ Array.from(l.cells).forEach((p) => {
1165
+ i.appendChild(s(p));
1155
1166
  });
1156
1167
  break;
1157
1168
  }
1158
1169
  case "insertRowBelow": {
1159
- const l = t.rows[a], i = t.insertRow(a + 1);
1160
- Array.from(l.cells).forEach((v) => {
1161
- i.appendChild(d(v));
1170
+ const l = t.rows[o], i = t.insertRow(o + 1);
1171
+ Array.from(l.cells).forEach((p) => {
1172
+ i.appendChild(s(p));
1162
1173
  });
1163
1174
  break;
1164
1175
  }
1165
1176
  case "insertColLeft": {
1166
1177
  Array.from(t.rows).forEach((l) => {
1167
- const i = l.cells[r];
1168
- l.insertBefore(d(i), i);
1178
+ const i = l.cells[n];
1179
+ l.insertBefore(s(i), i);
1169
1180
  });
1170
1181
  break;
1171
1182
  }
1172
1183
  case "insertColRight": {
1173
1184
  Array.from(t.rows).forEach((l) => {
1174
- const i = l.cells[r];
1175
- l.insertBefore(d(i), i.nextSibling);
1185
+ const i = l.cells[n];
1186
+ l.insertBefore(s(i), i.nextSibling);
1176
1187
  });
1177
1188
  break;
1178
1189
  }
1179
1190
  case "deleteRow":
1180
- t.rows.length > 1 && t.deleteRow(a);
1191
+ t.rows.length > 1 && t.deleteRow(o);
1181
1192
  break;
1182
1193
  case "deleteCol":
1183
1194
  Array.from(t.rows).forEach((l) => {
1184
- l.cells[r] && l.deleteCell(r);
1195
+ l.cells[n] && l.deleteCell(n);
1185
1196
  });
1186
1197
  break;
1187
1198
  }
1188
- M(), q(ae(re({}, D), {
1199
+ z(), f(oe(ae({}, N), {
1189
1200
  visible: !1
1190
- })), ue();
1191
- }, Qe = (e) => {
1201
+ })), fe();
1202
+ }, et = (e) => {
1192
1203
  const t = e.querySelector("tbody");
1193
1204
  if (!t || t.querySelector("[data-hidden-table-start]")) return;
1194
- const r = document.createElement("span");
1195
- r.textContent = "{{#arrayData}}", r.style.display = "none", r.setAttribute("data-hidden-table-start", "true"), t.insertBefore(r, t.firstChild);
1196
- const a = document.createElement("span");
1197
- a.textContent = "{{/arrayData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), t.appendChild(a);
1198
- }, me = () => {
1199
- const e = O();
1200
- if (!e) return N;
1205
+ const n = document.createElement("span");
1206
+ n.textContent = "{{#arrayData}}", n.style.display = "none", n.setAttribute("data-hidden-table-start", "true"), t.insertBefore(n, t.firstChild);
1207
+ const o = document.createElement("span");
1208
+ o.textContent = "{{/arrayData}}", o.style.display = "none", o.setAttribute("data-hidden-table-end", "true"), t.appendChild(o);
1209
+ }, he = () => {
1210
+ const e = T();
1211
+ if (!e) return O;
1201
1212
  const t = e.cloneNode(!0);
1202
- return t.querySelectorAll("table div").forEach((r) => r.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((r) => r.classList.remove("rte-cell-highlight")), t.innerHTML;
1203
- }, Je = () => {
1204
- ce(), y.current = _.current, oe({
1213
+ return t.querySelectorAll("table div").forEach((n) => n.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((n) => n.classList.remove("rte-cell-highlight")), t.innerHTML;
1214
+ }, tt = () => {
1215
+ se(), W.current = j.current, le({
1205
1216
  url: "",
1206
1217
  text: "",
1207
1218
  title: "",
1208
1219
  target: "_self"
1209
- }), f(!0);
1210
- }, Ge = (e) => {
1220
+ }), H(!0);
1221
+ }, nt = (e) => {
1211
1222
  const t = window.getSelection();
1212
- if (!t || !y.current) return;
1213
- t.removeAllRanges(), t.addRange(y.current);
1214
- let r = e.url.trim();
1215
- /^https?:\/\//i.test(r) || (r = "https://" + r);
1216
- const a = document.createElement("a");
1217
- 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";
1218
- const d = t.getRangeAt(0);
1219
- d.deleteContents(), d.insertNode(a);
1223
+ if (!t || !W.current) return;
1224
+ t.removeAllRanges(), t.addRange(W.current);
1225
+ let n = e.url.trim();
1226
+ /^https?:\/\//i.test(n) || (n = "https://" + n);
1227
+ const o = document.createElement("a");
1228
+ 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";
1229
+ const s = t.getRangeAt(0);
1230
+ s.deleteContents(), s.insertNode(o);
1220
1231
  const l = document.createTextNode(" ");
1221
- a.after(l);
1232
+ o.after(l);
1222
1233
  const i = document.createRange();
1223
- i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), f(!1), M();
1224
- }, et = (e) => {
1234
+ i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), H(!1), z();
1235
+ }, rt = (e) => {
1225
1236
  const t = e.target;
1226
1237
  if (t.tagName === "A") {
1227
- const r = t;
1238
+ const n = t;
1228
1239
  if (e.ctrlKey || e.metaKey) {
1229
- window.open(r.href, "_blank", "noopener,noreferrer");
1240
+ window.open(n.href, "_blank", "noopener,noreferrer");
1230
1241
  return;
1231
1242
  }
1232
1243
  e.preventDefault();
1233
- const a = document.createRange();
1234
- a.selectNode(r), y.current = a, oe({
1235
- url: r.href,
1236
- text: r.textContent || r.href,
1237
- title: r.title,
1238
- target: r.target
1239
- }), f(!0);
1244
+ const o = document.createRange();
1245
+ o.selectNode(n), W.current = o, le({
1246
+ url: n.href,
1247
+ text: n.textContent || n.href,
1248
+ title: n.title,
1249
+ target: n.target
1250
+ }), H(!0);
1240
1251
  }
1241
- }, tt = () => {
1242
- const e = O();
1252
+ }, at = () => {
1253
+ const e = T();
1243
1254
  if (!e) return;
1244
1255
  const t = window.getSelection();
1245
- if ((!t || t.rangeCount === 0) && _.current) {
1256
+ if ((!t || t.rangeCount === 0) && j.current) {
1246
1257
  const h = window.getSelection();
1247
- h == null || h.removeAllRanges(), h == null || h.addRange(_.current);
1258
+ h == null || h.removeAllRanges(), h == null || h.addRange(j.current);
1248
1259
  }
1249
- const r = window.getSelection();
1250
- if (!r || r.rangeCount === 0) return;
1251
- const a = r.getRangeAt(0);
1252
- V(), document.execCommand("removeFormat", !1);
1253
- const d = a.cloneContents(), l = document.createElement("div");
1254
- l.appendChild(d);
1255
- const i = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
1260
+ const n = window.getSelection();
1261
+ if (!n || n.rangeCount === 0) return;
1262
+ const o = n.getRangeAt(0);
1263
+ $(), document.execCommand("removeFormat", !1);
1264
+ const s = o.cloneContents(), l = document.createElement("div");
1265
+ l.appendChild(s);
1266
+ const i = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), p = [];
1256
1267
  for (; i.nextNode(); ) {
1257
1268
  const h = i.currentNode, C = h.tagName.toUpperCase(), A = h.getAttribute && h.getAttribute("data-mention") !== null;
1258
- C !== "A" && !A && v.push(h);
1269
+ C !== "A" && !A && p.push(h);
1259
1270
  }
1260
- for (let h = v.length - 1; h >= 0; h--) {
1261
- const C = v[h], A = C.parentNode;
1271
+ for (let h = p.length - 1; h >= 0; h--) {
1272
+ const C = p[h], A = C.parentNode;
1262
1273
  if (A) {
1263
1274
  for (; C.firstChild; ) A.insertBefore(C.firstChild, C);
1264
1275
  A.removeChild(C);
1265
1276
  }
1266
1277
  }
1267
- l.querySelectorAll("[style]").forEach((h) => h.removeAttribute("style")), a.deleteContents();
1278
+ l.querySelectorAll("[style]").forEach((h) => h.removeAttribute("style")), o.deleteContents();
1268
1279
  const g = document.createDocumentFragment();
1269
1280
  for (; l.firstChild; ) g.appendChild(l.firstChild);
1270
- a.insertNode(g);
1271
- const p = document.createRange();
1272
- p.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), p.collapse(!0), r.removeAllRanges(), r.addRange(p), e.normalize(), M();
1273
- }, nt = (e) => {
1274
- var a;
1281
+ o.insertNode(g);
1282
+ const v = document.createRange();
1283
+ v.setStartAfter(o.endContainer.nodeType === Node.TEXT_NODE ? o.endContainer : o.startContainer), v.collapse(!0), n.removeAllRanges(), n.addRange(v), e.normalize(), z();
1284
+ }, ot = (e) => {
1285
+ var o;
1275
1286
  let t = e;
1276
1287
  t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
1277
- const r = document.createElement("div");
1278
- return r.innerHTML = t, r.querySelectorAll("br").forEach((d) => {
1279
- d.replaceWith(`
1288
+ const n = document.createElement("div");
1289
+ return n.innerHTML = t, n.querySelectorAll("br").forEach((s) => {
1290
+ s.replaceWith(`
1280
1291
  `);
1281
- }), r.querySelectorAll("p, div, tr").forEach((d) => {
1282
- d.insertAdjacentText("afterend", `
1292
+ }), n.querySelectorAll("p, div, tr").forEach((s) => {
1293
+ s.insertAdjacentText("afterend", `
1283
1294
  `);
1284
- }), r.querySelectorAll("table").forEach((d) => {
1285
- d.insertAdjacentText("afterend", `
1295
+ }), n.querySelectorAll("table").forEach((s) => {
1296
+ s.insertAdjacentText("afterend", `
1286
1297
  `);
1287
- }), ((a = r.textContent) == null ? void 0 : a.replace(/\n{3,}/g, `
1298
+ }), ((o = n.textContent) == null ? void 0 : o.replace(/\n{3,}/g, `
1288
1299
 
1289
1300
  `).trim()) || "";
1301
+ }, ne = () => {
1302
+ const e = window.getSelection();
1303
+ if (!e || e.rangeCount === 0) return !1;
1304
+ const t = e.getRangeAt(0), n = document.getElementById("rte-editor-body");
1305
+ return (n == null ? void 0 : n.contains(t.startContainer)) || !1;
1290
1306
  };
1291
- return /* @__PURE__ */ o.createElement("div", {
1307
+ return /* @__PURE__ */ a.createElement("div", {
1292
1308
  className: `rte-wrapper ${(m == null ? void 0 : m.wrapper) || ""}`,
1293
- style: w.wrapper
1294
- }, /* @__PURE__ */ o.createElement("div", {
1309
+ style: y.wrapper
1310
+ }, /* @__PURE__ */ a.createElement("div", {
1295
1311
  style: {
1296
1312
  flex: 1
1297
1313
  }
1298
- }, /* @__PURE__ */ o.createElement(Dt, {
1299
- exec: X,
1300
- saveSelection: ce,
1301
- handleFileChange: $e,
1302
- handleFontSizeChange: (e) => X("fontSize", e.target.value),
1303
- handleFontFamilyChange: (e) => X("fontName", e.target.value),
1304
- insertEmoji: Ue,
1305
- handleLink: Je,
1306
- removeFormatting: tt,
1307
- visibleActions: Ae,
1314
+ }, /* @__PURE__ */ a.createElement(jt, {
1315
+ exec: K,
1316
+ saveSelection: se,
1317
+ handleFileChange: Xe,
1318
+ handleFontSizeChange: (e) => K("fontSize", e.target.value),
1319
+ handleFontFamilyChange: (e) => K("fontName", e.target.value),
1320
+ insertEmoji: Ye,
1321
+ handleLink: tt,
1322
+ removeFormatting: at,
1323
+ visibleActions: Oe,
1308
1324
  className: m.toolbar,
1309
- style: w.toolbar
1310
- }), /* @__PURE__ */ o.createElement("div", {
1325
+ style: y.toolbar
1326
+ }), /* @__PURE__ */ a.createElement("div", {
1311
1327
  ref: k,
1328
+ id: "rte-editor-body",
1312
1329
  className: `rte-editor ${(m == null ? void 0 : m.editor) || ""}`,
1313
- style: w.editor,
1330
+ style: y.editor,
1314
1331
  contentEditable: !0,
1315
1332
  suppressContentEditableWarning: !0,
1316
- onInput: de,
1317
- onKeyDown: Be,
1318
- onBeforeInput: qe,
1319
- onContextMenu: Ye,
1320
- onClick: et
1321
- }), /* @__PURE__ */ o.createElement(Ot, {
1322
- show: $,
1323
- position: W,
1324
- filtered: F,
1325
- insertMention: _e,
1326
- onClose: () => j(!1),
1327
- query: Ne
1328
- }), c && /* @__PURE__ */ o.createElement("div", {
1333
+ onInput: me,
1334
+ onKeyDown: Ue,
1335
+ onBeforeInput: We,
1336
+ onContextMenu: Je,
1337
+ onClick: rt
1338
+ }), /* @__PURE__ */ a.createElement(_t, {
1339
+ show: q,
1340
+ position: F,
1341
+ filtered: ee,
1342
+ insertMention: Be,
1343
+ onClose: () => B(!1),
1344
+ query: He
1345
+ }), c && /* @__PURE__ */ a.createElement("div", {
1329
1346
  className: `rte-output ${(m == null ? void 0 : m.output) || ""}`,
1330
- style: w.output
1331
- }, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, N)), /* @__PURE__ */ o.createElement(Ht, {
1332
- visible: D.visible,
1333
- x: D.x,
1334
- y: D.y,
1335
- onAction: Ze,
1347
+ style: y.output
1348
+ }, /* @__PURE__ */ a.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ a.createElement("p", null, J)), /* @__PURE__ */ a.createElement(Ft, {
1349
+ visible: N.visible,
1350
+ x: N.x,
1351
+ y: N.y,
1352
+ onAction: Ge,
1336
1353
  onClose: () => {
1337
- q(ae(re({}, D), {
1354
+ f(oe(ae({}, N), {
1338
1355
  visible: !1
1339
- })), ue();
1356
+ })), fe();
1340
1357
  }
1341
- }), /* @__PURE__ */ o.createElement(_t, {
1342
- visible: K,
1343
- linkData: P,
1344
- onClose: () => f(!1),
1345
- onInsert: Ge
1346
- })), s ? /* @__PURE__ */ o.createElement(jt, {
1358
+ }), /* @__PURE__ */ a.createElement(Pt, {
1359
+ visible: w,
1360
+ linkData: De,
1361
+ onClose: () => H(!1),
1362
+ onInsert: nt
1363
+ })), d ? /* @__PURE__ */ a.createElement(It, {
1347
1364
  className: m.preview,
1348
- style: w.preview,
1349
- html: me()
1365
+ style: y.preview,
1366
+ html: he()
1350
1367
  }) : null);
1351
1368
  };
1352
1369
  export {
1353
- Bt as RichTextEditor,
1354
- jt as RtePreview,
1355
- Dt as RteToolbar
1370
+ $t as RichTextEditor,
1371
+ It as RtePreview,
1372
+ jt as RteToolbar
1356
1373
  };