@uva-glass/component-library 1.52.1 → 1.53.0

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.
Files changed (37) hide show
  1. package/dist/{Lexical.prod-zUeT_jIr.js → Lexical.prod-DNRTKPfN.js} +72 -66
  2. package/dist/Lexical.prod-DNRTKPfN.js.map +1 -0
  3. package/dist/{LexicalUtils.prod-DtRifALg.js → LexicalUtils.prod-D_BPEjfg.js} +2 -2
  4. package/dist/{LexicalUtils.prod-DtRifALg.js.map → LexicalUtils.prod-D_BPEjfg.js.map} +1 -1
  5. package/dist/{ListPlugin-CxyYg2bv.js → ListPlugin-CgNBzfIl.js} +4 -4
  6. package/dist/{ListPlugin-CxyYg2bv.js.map → ListPlugin-CgNBzfIl.js.map} +1 -1
  7. package/dist/RteEditor.module-BjGyWKhW.js +26 -0
  8. package/dist/RteEditor.module-BjGyWKhW.js.map +1 -0
  9. package/dist/assets/RteEditor.css +1 -1
  10. package/dist/components/Icon/icons/index.d.ts +9 -0
  11. package/dist/components/Icon/icons/index.js +52 -37
  12. package/dist/components/Icon/icons/index.js.map +1 -1
  13. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
  14. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.d.ts +1 -0
  15. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +62 -0
  16. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -0
  17. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.d.ts +1 -0
  18. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js +5 -0
  19. package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js.map +1 -0
  20. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +3 -3
  21. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  22. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
  23. package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
  24. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +22 -20
  25. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  26. package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
  27. package/dist/components/RteEditor/Plugins/index.js +10 -6
  28. package/dist/components/RteEditor/Plugins/index.js.map +1 -1
  29. package/dist/components/RteEditor/RteEditor.js +567 -462
  30. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  31. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
  32. package/dist/{helpers-DpGAANJ8.js → helpers-TSjo3aAv.js} +3 -3
  33. package/dist/{helpers-DpGAANJ8.js.map → helpers-TSjo3aAv.js.map} +1 -1
  34. package/package.json +2 -2
  35. package/dist/Lexical.prod-zUeT_jIr.js.map +0 -1
  36. package/dist/RteEditor.module--4R0Ql6Y.js +0 -26
  37. package/dist/RteEditor.module--4R0Ql6Y.js.map +0 -1
@@ -1,163 +1,178 @@
1
- import { jsx as y, jsxs as J, Fragment as Le } from "react/jsx-runtime";
2
- import { W as Ge, w as P, P as ne, I as g, e as Qe, g as et, u as R, h as F, y as b, F as tt, l as _, T as nt, X as G, i as Te, m as h, j as Pe, $ as _e, k as Re, v as rt, S as ae, b as ot, E as Q, C as le, n as ce, q as Oe, r as it, s as st, M as ke, A as at, z as lt, B as ct, D as Fe, G as ut, H as v, K as dt, c as O, N as ft, V as mt, O as pt, Q as V, R as gt, U as ht, Z as vt, a0 as wt, a1 as yt, a2 as Et, a3 as Ct, a4 as ue, a as de, a5 as bt, a6 as X, a7 as xt, a8 as fe, a9 as $t, aa as Nt, ab as Dt, ac as St, ad as Lt, ae as Tt, af as Pt, ag as _t, d as Rt, ah as Ot, ai as kt, aj as Ft, ak as At, al as It, t as Mt, L as me, am as Kt, x as Ut } from "../../Lexical.prod-zUeT_jIr.js";
3
- import * as Y from "react";
4
- import { useMemo as H, useLayoutEffect as I, useEffect as D, useRef as Bt, useState as A, Suspense as jt, forwardRef as Ae, useCallback as zt } from "react";
5
- import { i as T, L as U, e as Wt, t as re } from "../../LexicalUtils.prod-DtRifALg.js";
6
- import { r as pe } from "../../index-DsprzSCj.js";
7
- import { J as Ie, D as Me, Z as Jt } from "../../ListPlugin-CxyYg2bv.js";
8
- import { a as Ke, U as ge, m as Z, g as Vt, b as qt, F as Ht, M as Xt, f as Yt } from "../../helpers-DpGAANJ8.js";
9
- import { s as K } from "../../RteEditor.module--4R0Ql6Y.js";
10
- import { ToolBarPlugin as Zt } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
11
- import { UvaTheme as Gt } from "./UvaTheme/UvaTheme.js";
12
- const Ue = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Qt = Ue ? I : D, j = { tag: "history-merge" };
13
- function en({ initialConfig: t, children: e }) {
14
- const n = H(() => {
15
- const { theme: r, namespace: i, nodes: s, onError: o, editorState: a, html: l } = t, c = et(null, r), u = Ge({ editable: t.editable, html: l, namespace: i, nodes: s, onError: (d) => o(d, u), theme: r });
1
+ import { jsx as E, jsxs as Q, Fragment as Ie } from "react/jsx-runtime";
2
+ import { W as st, w as O, P as de, I as g, e as at, i as lt, u as T, j as I, y as _, F as ct, l as N, T as ut, X as ie, k as fe, m as h, n as Ke, q as ze, r as Ue, v as dt, S as ge, b as ft, E as se, C as he, s as ve, z as Be, A as mt, B as pt, M as je, D as gt, G as ht, H as vt, N as Je, O as yt, Q as y, R as wt, c as F, U as Ct, V as Et, Z as bt, a0 as ee, a1 as xt, a2 as $t, a3 as St, a4 as _t, a5 as Nt, a6 as Dt, a7 as kt, a8 as ye, a as we, a9 as Lt, aa as ne, ab as Tt, ac as Ce, ad as Pt, ae as Rt, af as Ot, ag as Mt, ah as Ft, ai as At, aj as It, ak as Kt, d as zt, al as Ut, am as Bt, an as jt, ao as Jt, ap as Wt, t as Vt, L as Ee, aq as qt, x as Ht, K as q, $ as H, ar as Xt, as as Yt, g as Zt, h as Gt } from "../../Lexical.prod-DNRTKPfN.js";
3
+ import * as re from "react";
4
+ import { useMemo as W, useLayoutEffect as z, useEffect as k, useRef as Qt, useState as K, Suspense as en, forwardRef as We, useCallback as tn } from "react";
5
+ import { i as R, L as U, e as nn, t as me } from "../../LexicalUtils.prod-D_BPEjfg.js";
6
+ import { r as be } from "../../index-DsprzSCj.js";
7
+ import { J as Ve, D as qe, Z as rn } from "../../ListPlugin-CgNBzfIl.js";
8
+ import { a as He, U as xe, m as oe, g as on, b as sn, F as an, M as ln, f as cn } from "../../helpers-TSjo3aAv.js";
9
+ import { s as J } from "../../RteEditor.module-BjGyWKhW.js";
10
+ import { ToolBarPlugin as un } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
11
+ import "../Buttons/Button.js";
12
+ import "../Buttons/LinkButton.js";
13
+ import "@react-aria/button";
14
+ import "@react-aria/dialog";
15
+ import "@react-aria/focus";
16
+ import "@react-aria/overlays";
17
+ import "../OverlayCloseButton/OverlayCloseButton.js";
18
+ import "../GridRow/GridRow.js";
19
+ import "../IconButton/IconButton.js";
20
+ import "../Input/Input.js";
21
+ import "../InputField/InputField.js";
22
+ import "react-router-dom";
23
+ import "../../MultiSelect-D1FnMER4.js";
24
+ import "../SelectListbox/SelectListbox.js";
25
+ import "../SelectListbox/SelectProvider.js";
26
+ import { UvaTheme as dn } from "./UvaTheme/UvaTheme.js";
27
+ const Xe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, fn = Xe ? z : k, X = { tag: "history-merge" };
28
+ function mn({ initialConfig: t, children: e }) {
29
+ const n = W(() => {
30
+ const { theme: r, namespace: s, nodes: i, onError: o, editorState: a, html: l } = t, c = lt(null, r), u = st({ editable: t.editable, html: l, namespace: s, nodes: i, onError: (d) => o(d, u), theme: r });
16
31
  return function(d, f) {
17
32
  if (f !== null) {
18
33
  if (f === void 0) d.update(() => {
19
- const p = P();
34
+ const p = O();
20
35
  if (p.isEmpty()) {
21
- const m = ne();
36
+ const m = de();
22
37
  p.append(m);
23
- const w = Ue ? document.activeElement : null;
24
- (g() !== null || w !== null && w === d.getRootElement()) && m.select();
38
+ const v = Xe ? document.activeElement : null;
39
+ (g() !== null || v !== null && v === d.getRootElement()) && m.select();
25
40
  }
26
- }, j);
41
+ }, X);
27
42
  else if (f !== null) switch (typeof f) {
28
43
  case "string": {
29
44
  const p = d.parseEditorState(f);
30
- d.setEditorState(p, j);
45
+ d.setEditorState(p, X);
31
46
  break;
32
47
  }
33
48
  case "object":
34
- d.setEditorState(f, j);
49
+ d.setEditorState(f, X);
35
50
  break;
36
51
  case "function":
37
52
  d.update(() => {
38
- P().isEmpty() && f(d);
39
- }, j);
53
+ O().isEmpty() && f(d);
54
+ }, X);
40
55
  }
41
56
  }
42
57
  }(u, a), [u, c];
43
58
  }, []);
44
- return Qt(() => {
45
- const r = t.editable, [i] = n;
46
- i.setEditable(r === void 0 || r);
47
- }, []), y(Qe.Provider, { value: n, children: e });
59
+ return fn(() => {
60
+ const r = t.editable, [s] = n;
61
+ s.setEditable(r === void 0 || r);
62
+ }, []), E(at.Provider, { value: n, children: e });
48
63
  }
49
- const tn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? I : D;
50
- function nn(t) {
64
+ const pn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
65
+ function gn(t) {
51
66
  return { initialValueFn: () => t.isEditable(), subscribe: (e) => t.registerEditableListener(e) };
52
67
  }
53
- function rn() {
68
+ function hn() {
54
69
  return function(t) {
55
- const [e] = R(), n = H(() => t(e), [e, t]), r = Bt(n.initialValueFn()), [i, s] = A(r.current);
56
- return tn(() => {
70
+ const [e] = T(), n = W(() => t(e), [e, t]), r = Qt(n.initialValueFn()), [s, i] = K(r.current);
71
+ return pn(() => {
57
72
  const { initialValueFn: o, subscribe: a } = n, l = o();
58
- return r.current !== l && (r.current = l, s(l)), a((c) => {
59
- r.current = c, s(c);
73
+ return r.current !== l && (r.current = l, i(l)), a((c) => {
74
+ r.current = c, i(c);
60
75
  });
61
- }, [n, t]), i;
62
- }(nn);
76
+ }, [n, t]), s;
77
+ }(gn);
63
78
  }
64
- function on() {
65
- return P().getTextContent();
79
+ function vn() {
80
+ return O().getTextContent();
66
81
  }
67
- function sn(t, e = !0) {
82
+ function yn(t, e = !0) {
68
83
  if (t) return !1;
69
- let n = on();
84
+ let n = vn();
70
85
  return e && (n = n.trim()), n === "";
71
86
  }
72
- function an(t) {
73
- if (!sn(t, !1)) return !1;
74
- const e = P().getChildren(), n = e.length;
87
+ function wn(t) {
88
+ if (!yn(t, !1)) return !1;
89
+ const e = O().getChildren(), n = e.length;
75
90
  if (n > 1) return !1;
76
91
  for (let r = 0; r < n; r++) {
77
- const i = e[r];
78
- if (F(i)) return !1;
79
- if (b(i)) {
80
- if (!tt(i) || i.__indent !== 0) return !1;
81
- const s = i.getChildren(), o = s.length;
92
+ const s = e[r];
93
+ if (I(s)) return !1;
94
+ if (_(s)) {
95
+ if (!ct(s) || s.__indent !== 0) return !1;
96
+ const i = s.getChildren(), o = i.length;
82
97
  for (let a = 0; a < o; a++) {
83
- const l = s[r];
84
- if (!_(l)) return !1;
98
+ const l = i[r];
99
+ if (!N(l)) return !1;
85
100
  }
86
101
  }
87
102
  }
88
103
  return !0;
89
104
  }
90
- function Be(t) {
91
- return () => an(t);
105
+ function Ye(t) {
106
+ return () => wn(t);
92
107
  }
93
- function ln(t) {
108
+ function Cn(t) {
94
109
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
95
110
  }
96
- ln(function(t) {
111
+ Cn(function(t) {
97
112
  const e = new URLSearchParams();
98
113
  e.append("code", t);
99
114
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
100
115
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
101
116
  });
102
- function cn(t) {
117
+ function En(t) {
103
118
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
104
119
  }
105
- cn(function(t) {
120
+ En(function(t) {
106
121
  const e = new URLSearchParams();
107
122
  e.append("code", t);
108
123
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
109
124
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
110
125
  });
111
- const un = /* @__PURE__ */ new Map();
112
- function dn(t) {
126
+ const bn = /* @__PURE__ */ new Map();
127
+ function xn(t) {
113
128
  const e = {}, n = t.split(";");
114
129
  for (const r of n) if (r !== "") {
115
- const [i, s] = r.split(/:([^]+)/);
116
- i && s && (e[i.trim()] = s.trim());
130
+ const [s, i] = r.split(/:([^]+)/);
131
+ s && i && (e[s.trim()] = i.trim());
117
132
  }
118
133
  return e;
119
134
  }
120
- function je(t, e) {
135
+ function Ze(t, e) {
121
136
  const n = t.getStartEndPoints();
122
137
  if (e.isSelected(t) && !e.isSegmented() && !e.isToken() && n !== null) {
123
- const [r, i] = n, s = t.isBackward(), o = r.getNode(), a = i.getNode(), l = e.is(o), c = e.is(a);
138
+ const [r, s] = n, i = t.isBackward(), o = r.getNode(), a = s.getNode(), l = e.is(o), c = e.is(a);
124
139
  if (l || c) {
125
- const [u, d] = nt(t), f = o.is(a), p = e.is(s ? a : o), m = e.is(s ? o : a);
126
- let w, x = 0;
127
- return f ? (x = u > d ? d : u, w = u > d ? u : d) : p ? (x = s ? d : u, w = void 0) : m && (x = 0, w = s ? u : d), e.__text = e.__text.slice(x, w), e;
140
+ const [u, d] = ut(t), f = o.is(a), p = e.is(i ? a : o), m = e.is(i ? o : a);
141
+ let v, b = 0;
142
+ return f ? (b = u > d ? d : u, v = u > d ? u : d) : p ? (b = i ? d : u, v = void 0) : m && (b = 0, v = i ? u : d), e.__text = e.__text.slice(b, v), e;
128
143
  }
129
144
  }
130
145
  return e;
131
146
  }
132
- function fn(t) {
133
- const e = t.getStyle(), n = dn(e);
134
- un.set(e, n);
147
+ function $n(t) {
148
+ const e = t.getStyle(), n = xn(e);
149
+ bn.set(e, n);
135
150
  }
136
- function he(t, e) {
137
- const n = G(t.focus, e);
138
- return F(n) && !n.isIsolated() || b(n) && !n.isInline() && !n.canBeEmpty();
151
+ function $e(t, e) {
152
+ const n = ie(t.focus, e);
153
+ return I(n) && !n.isIsolated() || _(n) && !n.isInline() && !n.canBeEmpty();
139
154
  }
140
- function mn(t, e, n, r) {
155
+ function Sn(t, e, n, r) {
141
156
  t.modify(e ? "extend" : "move", n, r);
142
157
  }
143
- function pn(t) {
158
+ function _n(t) {
144
159
  const e = t.anchor.getNode();
145
- return (Te(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
160
+ return (fe(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
146
161
  }
147
- function ve(t, e, n) {
148
- const r = pn(t);
149
- mn(t, e, n ? !r : r, "character");
162
+ function Se(t, e, n) {
163
+ const r = _n(t);
164
+ Sn(t, e, n ? !r : r, "character");
150
165
  }
151
- function gn(t) {
166
+ function Nn(t) {
152
167
  const e = window.location.origin, n = (r) => {
153
168
  if (r.origin !== e) return;
154
- const i = t.getRootElement();
155
- if (document.activeElement !== i) return;
156
- const s = r.data;
157
- if (typeof s == "string") {
169
+ const s = t.getRootElement();
170
+ if (document.activeElement !== s) return;
171
+ const i = r.data;
172
+ if (typeof i == "string") {
158
173
  let o;
159
174
  try {
160
- o = JSON.parse(s);
175
+ o = JSON.parse(i);
161
176
  } catch {
162
177
  return;
163
178
  }
@@ -168,14 +183,14 @@ function gn(t) {
168
183
  if (l) {
169
184
  const [c, u, d, f, p, m] = l;
170
185
  t.update(() => {
171
- const w = g();
172
- if (h(w)) {
173
- const x = w.anchor;
174
- let E = x.getNode(), C = 0, $ = 0;
175
- if (_(E) && c >= 0 && u >= 0 && (C = c, $ = c + u, w.setTextNodeRange(E, C, E, $)), C === $ && d === "" || (w.insertRawText(d), E = x.getNode()), _(E)) {
176
- C = f, $ = f + p;
177
- const N = E.getTextContentSize();
178
- C = C > N ? N : C, $ = $ > N ? N : $, w.setTextNodeRange(E, C, E, $);
186
+ const v = g();
187
+ if (h(v)) {
188
+ const b = v.anchor;
189
+ let w = b.getNode(), C = 0, x = 0;
190
+ if (N(w) && c >= 0 && u >= 0 && (C = c, x = c + u, v.setTextNodeRange(w, C, w, x)), C === x && d === "" || (v.insertRawText(d), w = b.getNode()), N(w)) {
191
+ C = f, x = f + p;
192
+ const $ = w.getTextContentSize();
193
+ C = C > $ ? $ : C, x = x > $ ? $ : x, v.setTextNodeRange(w, C, w, x);
179
194
  }
180
195
  r.stopImmediatePropagation();
181
196
  }
@@ -189,70 +204,70 @@ function gn(t) {
189
204
  window.removeEventListener("message", n, !0);
190
205
  };
191
206
  }
192
- function ze(t, e) {
207
+ function Ge(t, e) {
193
208
  const n = e.body ? e.body.childNodes : [];
194
209
  let r = [];
195
- const i = [];
196
- for (let s = 0; s < n.length; s++) {
197
- const o = n[s];
198
- if (!Ve.has(o.nodeName)) {
199
- const a = qe(o, t, i, !1);
210
+ const s = [];
211
+ for (let i = 0; i < n.length; i++) {
212
+ const o = n[i];
213
+ if (!tt.has(o.nodeName)) {
214
+ const a = nt(o, t, s, !1);
200
215
  a !== null && (r = r.concat(a));
201
216
  }
202
217
  }
203
- return function(s) {
204
- for (const o of s) o.getNextSibling() instanceof Pe && o.insertAfter(_e());
205
- for (const o of s) {
218
+ return function(i) {
219
+ for (const o of i) o.getNextSibling() instanceof Ke && o.insertAfter(ze());
220
+ for (const o of i) {
206
221
  const a = o.getChildren();
207
222
  for (const l of a) o.insertBefore(l);
208
223
  o.remove();
209
224
  }
210
- }(i), r;
225
+ }(s), r;
211
226
  }
212
- function We(t, e) {
227
+ function Qe(t, e) {
213
228
  if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
214
- const n = document.createElement("div"), r = P().getChildren();
215
- for (let i = 0; i < r.length; i++)
216
- Je(t, r[i], n, e);
229
+ const n = document.createElement("div"), r = O().getChildren();
230
+ for (let s = 0; s < r.length; s++)
231
+ et(t, r[s], n, e);
217
232
  return n.innerHTML;
218
233
  }
219
- function Je(t, e, n, r = null) {
220
- let i = r === null || e.isSelected(r);
221
- const s = b(e) && e.excludeFromCopy("html");
234
+ function et(t, e, n, r = null) {
235
+ let s = r === null || e.isSelected(r);
236
+ const i = _(e) && e.excludeFromCopy("html");
222
237
  let o = e;
223
238
  if (r !== null) {
224
- let p = Re(e);
225
- p = _(p) && r !== null ? je(r, p) : p, o = p;
239
+ let p = Ue(e);
240
+ p = N(p) && r !== null ? Ze(r, p) : p, o = p;
226
241
  }
227
- const a = b(o) ? o.getChildren() : [], l = t._nodes.get(o.getType());
242
+ const a = _(o) ? o.getChildren() : [], l = t._nodes.get(o.getType());
228
243
  let c;
229
244
  c = l && l.exportDOM !== void 0 ? l.exportDOM(t, o) : o.exportDOM(t);
230
245
  const { element: u, after: d } = c;
231
246
  if (!u) return !1;
232
247
  const f = document.createDocumentFragment();
233
248
  for (let p = 0; p < a.length; p++) {
234
- const m = a[p], w = Je(t, m, f, r);
235
- !i && b(e) && w && e.extractWithChild(m, r, "html") && (i = !0);
249
+ const m = a[p], v = et(t, m, f, r);
250
+ !s && _(e) && v && e.extractWithChild(m, r, "html") && (s = !0);
236
251
  }
237
- if (i && !s) {
238
- if ((rt(u) || ae(u)) && u.append(f), n.append(u), d) {
252
+ if (s && !i) {
253
+ if ((dt(u) || ge(u)) && u.append(f), n.append(u), d) {
239
254
  const p = d.call(o, u);
240
- p && (ae(u) ? u.replaceChildren(p) : u.replaceWith(p));
255
+ p && (ge(u) ? u.replaceChildren(p) : u.replaceWith(p));
241
256
  }
242
257
  } else n.append(f);
243
- return i;
258
+ return s;
244
259
  }
245
- const Ve = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
246
- function qe(t, e, n, r, i = /* @__PURE__ */ new Map(), s) {
260
+ const tt = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
261
+ function nt(t, e, n, r, s = /* @__PURE__ */ new Map(), i) {
247
262
  let o = [];
248
- if (Ve.has(t.nodeName)) return o;
263
+ if (tt.has(t.nodeName)) return o;
249
264
  let a = null;
250
- const l = function(m, w) {
251
- const { nodeName: x } = m, E = w._htmlConversions.get(x.toLowerCase());
265
+ const l = function(m, v) {
266
+ const { nodeName: b } = m, w = v._htmlConversions.get(b.toLowerCase());
252
267
  let C = null;
253
- if (E !== void 0) for (const $ of E) {
254
- const N = $(m);
255
- N !== null && (C === null || (C.priority || 0) < (N.priority || 0)) && (C = N);
268
+ if (w !== void 0) for (const x of w) {
269
+ const $ = x(m);
270
+ $ !== null && (C === null || (C.priority || 0) < ($.priority || 0)) && (C = $);
256
271
  }
257
272
  return C !== null ? C.conversion : null;
258
273
  }(t, e), c = l ? l(t) : null;
@@ -261,68 +276,68 @@ function qe(t, e, n, r, i = /* @__PURE__ */ new Map(), s) {
261
276
  u = c.after;
262
277
  const m = c.node;
263
278
  if (a = Array.isArray(m) ? m[m.length - 1] : m, a !== null) {
264
- for (const [, w] of i) if (a = w(a, s), !a) break;
279
+ for (const [, v] of s) if (a = v(a, i), !a) break;
265
280
  a && o.push(...Array.isArray(m) ? m : [a]);
266
281
  }
267
- c.forChild != null && i.set(t.nodeName, c.forChild);
282
+ c.forChild != null && s.set(t.nodeName, c.forChild);
268
283
  }
269
284
  const d = t.childNodes;
270
285
  let f = [];
271
- const p = (a == null || !ot(a)) && (a != null && Q(a) || r);
272
- for (let m = 0; m < d.length; m++) f.push(...qe(d[m], e, n, p, new Map(i), a));
273
- return u != null && (f = u(f)), le(t) && (f = hn(t, f, p ? () => {
274
- const m = new Pe();
286
+ const p = (a == null || !ft(a)) && (a != null && se(a) || r);
287
+ for (let m = 0; m < d.length; m++) f.push(...nt(d[m], e, n, p, new Map(s), a));
288
+ return u != null && (f = u(f)), he(t) && (f = Dn(t, f, p ? () => {
289
+ const m = new Ke();
275
290
  return n.push(m), m;
276
- } : ne)), a == null ? f.length > 0 ? o = o.concat(f) : le(t) && function(m) {
277
- return m.nextSibling == null || m.previousSibling == null ? !1 : ce(m.nextSibling) && ce(m.previousSibling);
278
- }(t) && (o = o.concat(_e())) : b(a) && a.append(...f), o;
291
+ } : de)), a == null ? f.length > 0 ? o = o.concat(f) : he(t) && function(m) {
292
+ return m.nextSibling == null || m.previousSibling == null ? !1 : ve(m.nextSibling) && ve(m.previousSibling);
293
+ }(t) && (o = o.concat(ze())) : _(a) && a.append(...f), o;
279
294
  }
280
- function hn(t, e, n) {
281
- const r = t.style.textAlign, i = [];
282
- let s = [];
295
+ function Dn(t, e, n) {
296
+ const r = t.style.textAlign, s = [];
297
+ let i = [];
283
298
  for (let o = 0; o < e.length; o++) {
284
299
  const a = e[o];
285
- if (Q(a)) r && !a.getFormat() && a.setFormat(r), i.push(a);
286
- else if (s.push(a), o === e.length - 1 || o < e.length - 1 && Q(e[o + 1])) {
300
+ if (se(a)) r && !a.getFormat() && a.setFormat(r), s.push(a);
301
+ else if (i.push(a), o === e.length - 1 || o < e.length - 1 && se(e[o + 1])) {
287
302
  const l = n();
288
- l.setFormat(r), l.append(...s), i.push(l), s = [];
303
+ l.setFormat(r), l.append(...i), s.push(l), i = [];
289
304
  }
290
305
  }
291
- return i;
306
+ return s;
292
307
  }
293
- function vn(t) {
308
+ function kn(t) {
294
309
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
295
310
  }
296
- var q = vn(function(t) {
311
+ var te = kn(function(t) {
297
312
  const e = new URLSearchParams();
298
313
  e.append("code", t);
299
314
  for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
300
315
  throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
301
316
  });
302
- const wn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, He = (t) => wn ? (t || window).getSelection() : null;
303
- function yn(t, e = g()) {
304
- return e == null && q(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : We(t, e);
317
+ const Ln = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, rt = (t) => Ln ? (t || window).getSelection() : null;
318
+ function Tn(t, e = g()) {
319
+ return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : Qe(t, e);
305
320
  }
306
- function En(t, e = g()) {
307
- return e == null && q(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Cn(t, e));
321
+ function Pn(t, e = g()) {
322
+ return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Rn(t, e));
308
323
  }
309
- function we(t, e, n) {
324
+ function _e(t, e, n) {
310
325
  const r = t.getData("application/x-lexical-editor");
311
326
  if (r) try {
312
327
  const o = JSON.parse(r);
313
328
  if (o.namespace === n._config.namespace && Array.isArray(o.nodes))
314
- return ye(n, bn(o.nodes), e);
329
+ return Ne(n, On(o.nodes), e);
315
330
  } catch {
316
331
  }
317
- const i = t.getData("text/html");
318
- if (i) try {
319
- const o = new DOMParser().parseFromString(i, "text/html");
320
- return ye(n, ze(n, o), e);
332
+ const s = t.getData("text/html");
333
+ if (s) try {
334
+ const o = new DOMParser().parseFromString(s, "text/html");
335
+ return Ne(n, Ge(n, o), e);
321
336
  } catch {
322
337
  }
323
- const s = t.getData("text/plain") || t.getData("text/uri-list");
324
- if (s != null) if (h(e)) {
325
- const o = s.split(/(\r?\n|\t)/);
338
+ const i = t.getData("text/plain") || t.getData("text/uri-list");
339
+ if (i != null) if (h(e)) {
340
+ const o = i.split(/(\r?\n|\t)/);
326
341
  o[o.length - 1] === "" && o.pop();
327
342
  for (let a = 0; a < o.length; a++) {
328
343
  const l = g();
@@ -330,112 +345,112 @@ function we(t, e, n) {
330
345
  const c = o[a];
331
346
  c === `
332
347
  ` || c === `\r
333
- ` ? l.insertParagraph() : c === " " ? l.insertNodes([Oe()]) : l.insertText(c);
348
+ ` ? l.insertParagraph() : c === " " ? l.insertNodes([Be()]) : l.insertText(c);
334
349
  }
335
350
  }
336
- } else e.insertRawText(s);
351
+ } else e.insertRawText(i);
337
352
  }
338
- function ye(t, e, n) {
339
- t.dispatchCommand(it, { nodes: e, selection: n }) || n.insertNodes(e);
353
+ function Ne(t, e, n) {
354
+ t.dispatchCommand(mt, { nodes: e, selection: n }) || n.insertNodes(e);
340
355
  }
341
- function Xe(t, e, n, r = []) {
342
- let i = e === null || n.isSelected(e);
343
- const s = b(n) && n.excludeFromCopy("html");
356
+ function ot(t, e, n, r = []) {
357
+ let s = e === null || n.isSelected(e);
358
+ const i = _(n) && n.excludeFromCopy("html");
344
359
  let o = n;
345
360
  if (e !== null) {
346
- let c = Re(n);
347
- c = _(c) && e !== null ? je(e, c) : c, o = c;
361
+ let c = Ue(n);
362
+ c = N(c) && e !== null ? Ze(e, c) : c, o = c;
348
363
  }
349
- const a = b(o) ? o.getChildren() : [], l = function(c) {
364
+ const a = _(o) ? o.getChildren() : [], l = function(c) {
350
365
  const u = c.exportJSON(), d = c.constructor;
351
- if (u.type !== d.getType() && q(58, d.name), b(c)) {
366
+ if (u.type !== d.getType() && te(58, d.name), _(c)) {
352
367
  const f = u.children;
353
- Array.isArray(f) || q(59, d.name);
368
+ Array.isArray(f) || te(59, d.name);
354
369
  }
355
370
  return u;
356
371
  }(o);
357
- if (_(o)) {
372
+ if (N(o)) {
358
373
  const c = o.__text;
359
- c.length > 0 ? l.text = c : i = !1;
374
+ c.length > 0 ? l.text = c : s = !1;
360
375
  }
361
376
  for (let c = 0; c < a.length; c++) {
362
- const u = a[c], d = Xe(t, e, u, l.children);
363
- !i && b(n) && d && n.extractWithChild(u, e, "clone") && (i = !0);
377
+ const u = a[c], d = ot(t, e, u, l.children);
378
+ !s && _(n) && d && n.extractWithChild(u, e, "clone") && (s = !0);
364
379
  }
365
- if (i && !s) r.push(l);
380
+ if (s && !i) r.push(l);
366
381
  else if (Array.isArray(l.children)) for (let c = 0; c < l.children.length; c++) {
367
382
  const u = l.children[c];
368
383
  r.push(u);
369
384
  }
370
- return i;
385
+ return s;
371
386
  }
372
- function Cn(t, e) {
373
- const n = [], r = P().getChildren();
374
- for (let i = 0; i < r.length; i++)
375
- Xe(t, e, r[i], n);
387
+ function Rn(t, e) {
388
+ const n = [], r = O().getChildren();
389
+ for (let s = 0; s < r.length; s++)
390
+ ot(t, e, r[s], n);
376
391
  return { namespace: t._config.namespace, nodes: n };
377
392
  }
378
- function bn(t) {
393
+ function On(t) {
379
394
  const e = [];
380
395
  for (let n = 0; n < t.length; n++) {
381
- const r = t[n], i = st(r);
382
- _(i) && fn(i), e.push(i);
396
+ const r = t[n], s = pt(r);
397
+ N(s) && $n(s), e.push(s);
383
398
  }
384
399
  return e;
385
400
  }
386
- let k = null;
387
- async function Ee(t, e, n) {
388
- if (k !== null) return !1;
401
+ let A = null;
402
+ async function De(t, e, n) {
403
+ if (A !== null) return !1;
389
404
  if (e !== null) return new Promise((l, c) => {
390
405
  t.update(() => {
391
- l(Ce(t, e, n));
406
+ l(ke(t, e, n));
392
407
  });
393
408
  });
394
- const r = t.getRootElement(), i = t._window == null ? window.document : t._window.document, s = He(t._window);
395
- if (r === null || s === null) return !1;
396
- const o = i.createElement("span");
397
- o.style.cssText = "position: fixed; top: -1000px;", o.append(i.createTextNode("#")), r.append(o);
409
+ const r = t.getRootElement(), s = t._window == null ? window.document : t._window.document, i = rt(t._window);
410
+ if (r === null || i === null) return !1;
411
+ const o = s.createElement("span");
412
+ o.style.cssText = "position: fixed; top: -1000px;", o.append(s.createTextNode("#")), r.append(o);
398
413
  const a = new Range();
399
- return a.setStart(o, 0), a.setEnd(o, 1), s.removeAllRanges(), s.addRange(a), new Promise((l, c) => {
400
- const u = t.registerCommand(ke, (d) => (T(d, ClipboardEvent) && (u(), k !== null && (window.clearTimeout(k), k = null), l(Ce(t, d, n))), !0), at);
401
- k = window.setTimeout(() => {
402
- u(), k = null, l(!1);
403
- }, 50), i.execCommand("copy"), o.remove();
414
+ return a.setStart(o, 0), a.setEnd(o, 1), i.removeAllRanges(), i.addRange(a), new Promise((l, c) => {
415
+ const u = t.registerCommand(je, (d) => (R(d, ClipboardEvent) && (u(), A !== null && (window.clearTimeout(A), A = null), l(ke(t, d, n))), !0), gt);
416
+ A = window.setTimeout(() => {
417
+ u(), A = null, l(!1);
418
+ }, 50), s.execCommand("copy"), o.remove();
404
419
  });
405
420
  }
406
- function Ce(t, e, n) {
421
+ function ke(t, e, n) {
407
422
  if (n === void 0) {
408
- const i = He(t._window);
409
- if (!i) return !1;
410
- const s = i.anchorNode, o = i.focusNode;
411
- if (s !== null && o !== null && !lt(t, s, o)) return !1;
423
+ const s = rt(t._window);
424
+ if (!s) return !1;
425
+ const i = s.anchorNode, o = s.focusNode;
426
+ if (i !== null && o !== null && !ht(t, i, o)) return !1;
412
427
  const a = g();
413
428
  if (a === null) return !1;
414
- n = $n(a);
429
+ n = Fn(a);
415
430
  }
416
431
  e.preventDefault();
417
432
  const r = e.clipboardData;
418
- return r !== null && (Nn(r, n), !0);
433
+ return r !== null && (An(r, n), !0);
419
434
  }
420
- const xn = [["text/html", yn], ["application/x-lexical-editor", En]];
421
- function $n(t = g()) {
435
+ const Mn = [["text/html", Tn], ["application/x-lexical-editor", Pn]];
436
+ function Fn(t = g()) {
422
437
  const e = { "text/plain": t ? t.getTextContent() : "" };
423
438
  if (t) {
424
- const n = ct();
425
- for (const [r, i] of xn) {
426
- const s = i(n, t);
427
- s !== null && (e[r] = s);
439
+ const n = vt();
440
+ for (const [r, s] of Mn) {
441
+ const i = s(n, t);
442
+ i !== null && (e[r] = i);
428
443
  }
429
444
  }
430
445
  return e;
431
446
  }
432
- function Nn(t, e) {
447
+ function An(t, e) {
433
448
  for (const n in e) {
434
449
  const r = e[n];
435
450
  r !== void 0 && t.setData(n, r);
436
451
  }
437
452
  }
438
- function be(t, e) {
453
+ function Le(t, e) {
439
454
  if (document.caretRangeFromPoint !== void 0) {
440
455
  const n = document.caretRangeFromPoint(t, e);
441
456
  return n === null ? null : { node: n.startContainer, offset: n.startOffset };
@@ -446,273 +461,273 @@ function be(t, e) {
446
461
  }
447
462
  return null;
448
463
  }
449
- const M = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Dn = M && "documentMode" in document ? document.documentMode : null, Sn = !(!M || !("InputEvent" in window) || Dn) && "getTargetRanges" in new window.InputEvent("input"), Ln = M && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Tn = M && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Pn = M && /^(?=.*Chrome).*/i.test(navigator.userAgent), _n = M && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Pn, xe = Mt();
450
- function z(t) {
464
+ const B = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, In = B && "documentMode" in document ? document.documentMode : null, Kn = !(!B || !("InputEvent" in window) || In) && "getTargetRanges" in new window.InputEvent("input"), zn = B && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Un = B && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Bn = B && /^(?=.*Chrome).*/i.test(navigator.userAgent), jn = B && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Bn, Te = Vt();
465
+ function Y(t) {
451
466
  let e = null;
452
- if (T(t, DragEvent) ? e = t.dataTransfer : T(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
453
- const n = e.types, r = n.includes("Files"), i = n.includes("text/html") || n.includes("text/plain");
454
- return [r, Array.from(e.files), i];
467
+ if (R(t, DragEvent) ? e = t.dataTransfer : R(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
468
+ const n = e.types, r = n.includes("Files"), s = n.includes("text/html") || n.includes("text/plain");
469
+ return [r, Array.from(e.files), s];
455
470
  }
456
- function $e(t) {
471
+ function Pe(t) {
457
472
  const e = g();
458
473
  if (!h(e)) return !1;
459
474
  const n = /* @__PURE__ */ new Set(), r = e.getNodes();
460
- for (let i = 0; i < r.length; i++) {
461
- const s = r[i], o = s.getKey();
475
+ for (let s = 0; s < r.length; s++) {
476
+ const i = r[s], o = i.getKey();
462
477
  if (n.has(o)) continue;
463
- const a = re(s, (c) => b(c) && !c.isInline());
478
+ const a = me(i, (c) => _(c) && !c.isInline());
464
479
  if (a === null) continue;
465
480
  const l = a.getKey();
466
481
  a.canIndent() && !n.has(l) && (n.add(l), t(a));
467
482
  }
468
483
  return n.size > 0;
469
484
  }
470
- function W(t) {
471
- const e = V(t);
472
- return F(e);
485
+ function Z(t) {
486
+ const e = ee(t);
487
+ return I(e);
473
488
  }
474
- function Rn(t) {
475
- return U(t.registerCommand(It, (e) => {
489
+ function Jn(t) {
490
+ return U(t.registerCommand(Wt, (e) => {
476
491
  const n = g();
477
- return !!O(n) && (n.clear(), !0);
478
- }, 0), t.registerCommand(X, (e) => {
492
+ return !!F(n) && (n.clear(), !0);
493
+ }, 0), t.registerCommand(ne, (e) => {
479
494
  const n = g();
480
495
  return !!h(n) && (n.deleteCharacter(e), !0);
481
- }, v), t.registerCommand(At, (e) => {
496
+ }, y), t.registerCommand(Jt, (e) => {
482
497
  const n = g();
483
498
  return !!h(n) && (n.deleteWord(e), !0);
484
- }, v), t.registerCommand(Ft, (e) => {
499
+ }, y), t.registerCommand(jt, (e) => {
485
500
  const n = g();
486
501
  return !!h(n) && (n.deleteLine(e), !0);
487
- }, v), t.registerCommand(kt, (e) => {
502
+ }, y), t.registerCommand(Bt, (e) => {
488
503
  const n = g();
489
504
  if (typeof e == "string") n !== null && n.insertText(e);
490
505
  else {
491
506
  if (n === null) return !1;
492
507
  const r = e.dataTransfer;
493
- if (r != null) we(r, n, t);
508
+ if (r != null) _e(r, n, t);
494
509
  else if (h(n)) {
495
- const i = e.data;
496
- return i && n.insertText(i), !0;
510
+ const s = e.data;
511
+ return s && n.insertText(s), !0;
497
512
  }
498
513
  }
499
514
  return !0;
500
- }, v), t.registerCommand(Ot, () => {
515
+ }, y), t.registerCommand(Ut, () => {
501
516
  const e = g();
502
517
  return !!h(e) && (e.removeText(), !0);
503
- }, v), t.registerCommand(Rt, (e) => {
518
+ }, y), t.registerCommand(zt, (e) => {
504
519
  const n = g();
505
520
  return !!h(n) && (n.formatText(e), !0);
506
- }, v), t.registerCommand(_t, (e) => {
521
+ }, y), t.registerCommand(Kt, (e) => {
507
522
  const n = g();
508
- if (!h(n) && !O(n)) return !1;
523
+ if (!h(n) && !F(n)) return !1;
509
524
  const r = n.getNodes();
510
- for (const i of r) {
511
- const s = re(i, (o) => b(o) && !o.isInline());
512
- s !== null && s.setFormat(e);
525
+ for (const s of r) {
526
+ const i = me(s, (o) => _(o) && !o.isInline());
527
+ i !== null && i.setFormat(e);
513
528
  }
514
529
  return !0;
515
- }, v), t.registerCommand(ue, (e) => {
530
+ }, y), t.registerCommand(ye, (e) => {
516
531
  const n = g();
517
532
  return !!h(n) && (n.insertLineBreak(e), !0);
518
- }, v), t.registerCommand(de, () => {
533
+ }, y), t.registerCommand(we, () => {
519
534
  const e = g();
520
535
  return !!h(e) && (e.insertParagraph(), !0);
521
- }, v), t.registerCommand(Tt, () => (Pt([Oe()]), !0), v), t.registerCommand(Lt, () => $e((e) => {
536
+ }, y), t.registerCommand(At, () => (It([Be()]), !0), y), t.registerCommand(Ft, () => Pe((e) => {
522
537
  const n = e.getIndent();
523
538
  e.setIndent(n + 1);
524
- }), v), t.registerCommand(fe, () => $e((e) => {
539
+ }), y), t.registerCommand(Ce, () => Pe((e) => {
525
540
  const n = e.getIndent();
526
541
  n > 0 && e.setIndent(n - 1);
527
- }), v), t.registerCommand(St, (e) => {
542
+ }), y), t.registerCommand(Mt, (e) => {
528
543
  const n = g();
529
- if (O(n) && !W(e.target)) {
544
+ if (F(n) && !Z(e.target)) {
530
545
  const r = n.getNodes();
531
546
  if (r.length > 0) return r[0].selectPrevious(), !0;
532
547
  } else if (h(n)) {
533
- const r = G(n.focus, !0);
534
- if (!e.shiftKey && F(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
548
+ const r = ie(n.focus, !0);
549
+ if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
535
550
  }
536
551
  return !1;
537
- }, v), t.registerCommand(Dt, (e) => {
552
+ }, y), t.registerCommand(Ot, (e) => {
538
553
  const n = g();
539
- if (O(n)) {
554
+ if (F(n)) {
540
555
  const r = n.getNodes();
541
556
  if (r.length > 0) return r[0].selectNext(0, 0), !0;
542
557
  } else if (h(n)) {
543
- if (function(i) {
544
- const s = i.focus;
545
- return s.key === "root" && s.offset === P().getChildrenSize();
558
+ if (function(s) {
559
+ const i = s.focus;
560
+ return i.key === "root" && i.offset === O().getChildrenSize();
546
561
  }(n)) return e.preventDefault(), !0;
547
- const r = G(n.focus, !1);
548
- if (!e.shiftKey && F(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
562
+ const r = ie(n.focus, !1);
563
+ if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
549
564
  }
550
565
  return !1;
551
- }, v), t.registerCommand(Nt, (e) => {
566
+ }, y), t.registerCommand(Rt, (e) => {
552
567
  const n = g();
553
- if (O(n)) {
568
+ if (F(n)) {
554
569
  const r = n.getNodes();
555
570
  if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
556
571
  }
557
572
  if (!h(n)) return !1;
558
- if (he(n, !0)) {
573
+ if ($e(n, !0)) {
559
574
  const r = e.shiftKey;
560
- return e.preventDefault(), ve(n, r, !0), !0;
575
+ return e.preventDefault(), Se(n, r, !0), !0;
561
576
  }
562
577
  return !1;
563
- }, v), t.registerCommand($t, (e) => {
578
+ }, y), t.registerCommand(Pt, (e) => {
564
579
  const n = g();
565
- if (O(n) && !W(e.target)) {
566
- const i = n.getNodes();
567
- if (i.length > 0) return e.preventDefault(), i[0].selectNext(0, 0), !0;
580
+ if (F(n) && !Z(e.target)) {
581
+ const s = n.getNodes();
582
+ if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
568
583
  }
569
584
  if (!h(n)) return !1;
570
585
  const r = e.shiftKey;
571
- return !!he(n, !1) && (e.preventDefault(), ve(n, r, !1), !0);
572
- }, v), t.registerCommand(xt, (e) => {
573
- if (W(e.target)) return !1;
586
+ return !!$e(n, !1) && (e.preventDefault(), Se(n, r, !1), !0);
587
+ }, y), t.registerCommand(Tt, (e) => {
588
+ if (Z(e.target)) return !1;
574
589
  const n = g();
575
590
  if (!h(n)) return !1;
576
591
  e.preventDefault();
577
- const { anchor: r } = n, i = r.getNode();
578
- return n.isCollapsed() && r.offset === 0 && !Te(i) && Wt(i).getIndent() > 0 ? t.dispatchCommand(fe, void 0) : t.dispatchCommand(X, !0);
579
- }, v), t.registerCommand(bt, (e) => {
580
- if (W(e.target)) return !1;
592
+ const { anchor: r } = n, s = r.getNode();
593
+ return n.isCollapsed() && r.offset === 0 && !fe(s) && nn(s).getIndent() > 0 ? t.dispatchCommand(Ce, void 0) : t.dispatchCommand(ne, !0);
594
+ }, y), t.registerCommand(Lt, (e) => {
595
+ if (Z(e.target)) return !1;
581
596
  const n = g();
582
- return !!h(n) && (e.preventDefault(), t.dispatchCommand(X, !1));
583
- }, v), t.registerCommand(Ct, (e) => {
597
+ return !!h(n) && (e.preventDefault(), t.dispatchCommand(ne, !1));
598
+ }, y), t.registerCommand(kt, (e) => {
584
599
  const n = g();
585
600
  if (!h(n)) return !1;
586
601
  if (e !== null) {
587
- if ((Tn || Ln || _n) && Sn) return !1;
588
- if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ue, !1);
602
+ if ((Un || zn || jn) && Kn) return !1;
603
+ if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ye, !1);
589
604
  }
590
- return t.dispatchCommand(de, void 0);
591
- }, v), t.registerCommand(Et, () => {
605
+ return t.dispatchCommand(we, void 0);
606
+ }, y), t.registerCommand(Dt, () => {
592
607
  const e = g();
593
608
  return !!h(e) && (t.blur(), !0);
594
- }, v), t.registerCommand(ht, (e) => {
595
- const [, n] = z(e);
609
+ }, y), t.registerCommand($t, (e) => {
610
+ const [, n] = Y(e);
596
611
  if (n.length > 0) {
597
- const i = be(e.clientX, e.clientY);
598
- if (i !== null) {
599
- const { offset: s, node: o } = i, a = V(o);
612
+ const s = Le(e.clientX, e.clientY);
613
+ if (s !== null) {
614
+ const { offset: i, node: o } = s, a = ee(o);
600
615
  if (a !== null) {
601
- const l = vt();
602
- if (_(a)) l.anchor.set(a.getKey(), s, "text"), l.focus.set(a.getKey(), s, "text");
616
+ const l = St();
617
+ if (N(a)) l.anchor.set(a.getKey(), i, "text"), l.focus.set(a.getKey(), i, "text");
603
618
  else {
604
619
  const u = a.getParentOrThrow().getKey(), d = a.getIndexWithinParent() + 1;
605
620
  l.anchor.set(u, d, "element"), l.focus.set(u, d, "element");
606
621
  }
607
- const c = wt(l);
608
- yt(c);
622
+ const c = _t(l);
623
+ Nt(c);
609
624
  }
610
- t.dispatchCommand(xe, n);
625
+ t.dispatchCommand(Te, n);
611
626
  }
612
627
  return e.preventDefault(), !0;
613
628
  }
614
629
  const r = g();
615
630
  return !!h(r);
616
- }, v), t.registerCommand(gt, (e) => {
617
- const [n] = z(e), r = g();
631
+ }, y), t.registerCommand(xt, (e) => {
632
+ const [n] = Y(e), r = g();
618
633
  return !(n && !h(r));
619
- }, v), t.registerCommand(pt, (e) => {
620
- const [n] = z(e), r = g();
634
+ }, y), t.registerCommand(bt, (e) => {
635
+ const [n] = Y(e), r = g();
621
636
  if (n && !h(r)) return !1;
622
- const i = be(e.clientX, e.clientY);
623
- if (i !== null) {
624
- const s = V(i.node);
625
- F(s) && e.preventDefault();
637
+ const s = Le(e.clientX, e.clientY);
638
+ if (s !== null) {
639
+ const i = ee(s.node);
640
+ I(i) && e.preventDefault();
626
641
  }
627
642
  return !0;
628
- }, v), t.registerCommand(ft, () => (mt(), !0), v), t.registerCommand(ke, (e) => (Ee(t, T(e, ClipboardEvent) ? e : null), !0), v), t.registerCommand(dt, (e) => (async function(n, r) {
629
- await Ee(r, T(n, ClipboardEvent) ? n : null), r.update(() => {
630
- const i = g();
631
- h(i) ? i.removeText() : O(i) && i.getNodes().forEach((s) => s.remove());
643
+ }, y), t.registerCommand(Ct, () => (Et(), !0), y), t.registerCommand(je, (e) => (De(t, R(e, ClipboardEvent) ? e : null), !0), y), t.registerCommand(wt, (e) => (async function(n, r) {
644
+ await De(r, R(n, ClipboardEvent) ? n : null), r.update(() => {
645
+ const s = g();
646
+ h(s) ? s.removeText() : F(s) && s.getNodes().forEach((i) => i.remove());
632
647
  });
633
- }(e, t), !0), v), t.registerCommand(Fe, (e) => {
634
- const [, n, r] = z(e);
635
- return n.length > 0 && !r ? (t.dispatchCommand(xe, n), !0) : ut(e.target) ? !1 : g() !== null && (function(i, s) {
636
- i.preventDefault(), s.update(() => {
637
- const o = g(), a = T(i, InputEvent) || T(i, KeyboardEvent) ? null : i.clipboardData;
638
- a != null && o !== null && we(a, o, s);
648
+ }(e, t), !0), y), t.registerCommand(Je, (e) => {
649
+ const [, n, r] = Y(e);
650
+ return n.length > 0 && !r ? (t.dispatchCommand(Te, n), !0) : yt(e.target) ? !1 : g() !== null && (function(s, i) {
651
+ s.preventDefault(), i.update(() => {
652
+ const o = g(), a = R(s, InputEvent) || R(s, KeyboardEvent) ? null : s.clipboardData;
653
+ a != null && o !== null && _e(a, o, i);
639
654
  }, { tag: "paste" });
640
655
  }(e, t), !0);
641
- }, v));
656
+ }, y));
642
657
  }
643
- const ee = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? I : D;
644
- function Ne(t) {
645
- return t.getEditorState().read(Be(t.isComposing()));
658
+ const ae = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
659
+ function Re(t) {
660
+ return t.getEditorState().read(Ye(t.isComposing()));
646
661
  }
647
- function On({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
648
- const [r] = R(), i = function(s, o) {
649
- const [a, l] = A(() => s.getDecorators());
650
- return ee(() => s.registerDecoratorListener((c) => {
651
- pe.flushSync(() => {
662
+ function Wn({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
663
+ const [r] = T(), s = function(i, o) {
664
+ const [a, l] = K(() => i.getDecorators());
665
+ return ae(() => i.registerDecoratorListener((c) => {
666
+ be.flushSync(() => {
652
667
  l(c);
653
668
  });
654
- }), [s]), D(() => {
655
- l(s.getDecorators());
656
- }, [s]), H(() => {
669
+ }), [i]), k(() => {
670
+ l(i.getDecorators());
671
+ }, [i]), W(() => {
657
672
  const c = [], u = Object.keys(a);
658
673
  for (let d = 0; d < u.length; d++) {
659
- const f = u[d], p = y(o, { onError: (w) => s._onError(w), children: y(jt, { fallback: null, children: a[f] }) }), m = s.getElementByKey(f);
660
- m !== null && c.push(pe.createPortal(p, m, f));
674
+ const f = u[d], p = E(o, { onError: (v) => i._onError(v), children: E(en, { fallback: null, children: a[f] }) }), m = i.getElementByKey(f);
675
+ m !== null && c.push(be.createPortal(p, m, f));
661
676
  }
662
677
  return c;
663
- }, [o, a, s]);
678
+ }, [o, a, i]);
664
679
  }(r, n);
665
- return function(s) {
666
- ee(() => U(Rn(s), gn(s)), [s]);
667
- }(r), J(Le, { children: [t, y(kn, { content: e }), i] });
668
- }
669
- function kn({ content: t }) {
670
- const [e] = R(), n = function(i) {
671
- const [s, o] = A(() => Ne(i));
672
- return ee(() => {
680
+ return function(i) {
681
+ ae(() => U(Jn(i), Nn(i)), [i]);
682
+ }(r), Q(Ie, { children: [t, E(Vn, { content: e }), s] });
683
+ }
684
+ function Vn({ content: t }) {
685
+ const [e] = T(), n = function(s) {
686
+ const [i, o] = K(() => Re(s));
687
+ return ae(() => {
673
688
  function a() {
674
- const l = Ne(i);
689
+ const l = Re(s);
675
690
  o(l);
676
691
  }
677
- return a(), U(i.registerUpdateListener(() => {
692
+ return a(), U(s.registerUpdateListener(() => {
678
693
  a();
679
- }), i.registerEditableListener(() => {
694
+ }), s.registerEditableListener(() => {
680
695
  a();
681
696
  }));
682
- }, [i]), s;
683
- }(e), r = rn();
697
+ }, [s]), i;
698
+ }(e), r = hn();
684
699
  return n ? typeof t == "function" ? t(r) : t : null;
685
700
  }
686
- const Ye = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? I : D;
687
- function Fn({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: i, ariaExpanded: s, ariaLabel: o, ariaLabelledBy: a, ariaMultiline: l, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: p, role: m = "textbox", spellCheck: w = !0, style: x, tabIndex: E, "data-testid": C, ...$ }, N) {
688
- const [S, oe] = A(t.isEditable()), ie = zt((L) => {
689
- L && L.ownerDocument && L.ownerDocument.defaultView ? t.setRootElement(L) : t.setRootElement(null);
690
- }, [t]), Ze = H(() => /* @__PURE__ */ function(...L) {
691
- return (se) => {
692
- L.forEach((B) => {
693
- typeof B == "function" ? B(se) : B != null && (B.current = se);
701
+ const it = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
702
+ function qn({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: s, ariaExpanded: i, ariaLabel: o, ariaLabelledBy: a, ariaMultiline: l, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: p, role: m = "textbox", spellCheck: v = !0, style: b, tabIndex: w, "data-testid": C, ...x }, $) {
703
+ const [S, L] = K(t.isEditable()), M = tn((P) => {
704
+ P && P.ownerDocument && P.ownerDocument.defaultView ? t.setRootElement(P) : t.setRootElement(null);
705
+ }, [t]), j = W(() => /* @__PURE__ */ function(...P) {
706
+ return (pe) => {
707
+ P.forEach((V) => {
708
+ typeof V == "function" ? V(pe) : V != null && (V.current = pe);
694
709
  });
695
710
  };
696
- }(N, ie), [ie, N]);
697
- return Ye(() => (oe(t.isEditable()), t.registerEditableListener((L) => {
698
- oe(L);
699
- })), [t]), y("div", { ...$, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": i, "aria-expanded": S && m === "combobox" ? !!s : void 0, "aria-label": o, "aria-labelledby": a, "aria-multiline": l, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": C, id: p, ref: Ze, role: S ? m : void 0, spellCheck: w, style: x, tabIndex: E });
711
+ }($, M), [M, $]);
712
+ return it(() => (L(t.isEditable()), t.registerEditableListener((P) => {
713
+ L(P);
714
+ })), [t]), E("div", { ...x, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": s, "aria-expanded": S && m === "combobox" ? !!i : void 0, "aria-label": o, "aria-labelledby": a, "aria-multiline": l, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": C, id: p, ref: j, role: S ? m : void 0, spellCheck: v, style: b, tabIndex: w });
700
715
  }
701
- const An = Ae(Fn);
702
- function De(t) {
703
- return t.getEditorState().read(Be(t.isComposing()));
716
+ const Hn = We(qn);
717
+ function Oe(t) {
718
+ return t.getEditorState().read(Ye(t.isComposing()));
704
719
  }
705
- const In = Ae(Mn);
706
- function Mn(t, e) {
707
- const { placeholder: n, ...r } = t, [i] = R();
708
- return J(Le, { children: [y(An, { editor: i, ...r, ref: e }), n != null && y(Kn, { editor: i, content: n })] });
720
+ const Xn = We(Yn);
721
+ function Yn(t, e) {
722
+ const { placeholder: n, ...r } = t, [s] = T();
723
+ return Q(Ie, { children: [E(Hn, { editor: s, ...r, ref: e }), n != null && E(Zn, { editor: s, content: n })] });
709
724
  }
710
- function Kn({ content: t, editor: e }) {
725
+ function Zn({ content: t, editor: e }) {
711
726
  const n = function(o) {
712
- const [a, l] = A(() => De(o));
713
- return Ye(() => {
727
+ const [a, l] = K(() => Oe(o));
728
+ return it(() => {
714
729
  function c() {
715
- const u = De(o);
730
+ const u = Oe(o);
716
731
  l(u);
717
732
  }
718
733
  return c(), U(o.registerUpdateListener(() => {
@@ -721,188 +736,278 @@ function Kn({ content: t, editor: e }) {
721
736
  c();
722
737
  }));
723
738
  }, [o]), a;
724
- }(e), [r, i] = A(e.isEditable());
725
- if (I(() => (i(e.isEditable()), e.registerEditableListener((o) => {
726
- i(o);
739
+ }(e), [r, s] = K(e.isEditable());
740
+ if (z(() => (s(e.isEditable()), e.registerEditableListener((o) => {
741
+ s(o);
727
742
  })), [e]), !n) return null;
728
- let s = null;
729
- return typeof t == "function" ? s = t(r) : t !== null && (s = t), s === null ? null : y("div", { "aria-hidden": !0, children: s });
743
+ let i = null;
744
+ return typeof t == "function" ? i = t(r) : t !== null && (i = t), i === null ? null : E("div", { "aria-hidden": !0, children: i });
730
745
  }
731
- function te(t, e) {
732
- return te = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
746
+ function le(t, e) {
747
+ return le = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
733
748
  return n.__proto__ = r, n;
734
- }, te(t, e);
749
+ }, le(t, e);
735
750
  }
736
- var Se = { error: null }, Un = function(t) {
751
+ var Me = { error: null }, Gn = function(t) {
737
752
  var e, n;
738
753
  function r() {
739
- for (var s, o = arguments.length, a = new Array(o), l = 0; l < o; l++) a[l] = arguments[l];
740
- return (s = t.call.apply(t, [this].concat(a)) || this).state = Se, s.resetErrorBoundary = function() {
754
+ for (var i, o = arguments.length, a = new Array(o), l = 0; l < o; l++) a[l] = arguments[l];
755
+ return (i = t.call.apply(t, [this].concat(a)) || this).state = Me, i.resetErrorBoundary = function() {
741
756
  for (var c, u = arguments.length, d = new Array(u), f = 0; f < u; f++) d[f] = arguments[f];
742
- s.props.onReset == null || (c = s.props).onReset.apply(c, d), s.reset();
743
- }, s;
757
+ i.props.onReset == null || (c = i.props).onReset.apply(c, d), i.reset();
758
+ }, i;
744
759
  }
745
- n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, te(e, n), r.getDerivedStateFromError = function(s) {
746
- return { error: s };
760
+ n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, le(e, n), r.getDerivedStateFromError = function(i) {
761
+ return { error: i };
747
762
  };
748
- var i = r.prototype;
749
- return i.reset = function() {
750
- this.setState(Se);
751
- }, i.componentDidCatch = function(s, o) {
763
+ var s = r.prototype;
764
+ return s.reset = function() {
765
+ this.setState(Me);
766
+ }, s.componentDidCatch = function(i, o) {
752
767
  var a, l;
753
- (a = (l = this.props).onError) == null || a.call(l, s, o);
754
- }, i.componentDidUpdate = function(s, o) {
768
+ (a = (l = this.props).onError) == null || a.call(l, i, o);
769
+ }, s.componentDidUpdate = function(i, o) {
755
770
  var a, l, c, u, d = this.state.error, f = this.props.resetKeys;
756
- d !== null && o.error !== null && ((c = s.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(p, m) {
771
+ d !== null && o.error !== null && ((c = i.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(p, m) {
757
772
  return !Object.is(p, u[m]);
758
- })) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, s.resetKeys, f), this.reset());
759
- }, i.render = function() {
760
- var s = this.state.error, o = this.props, a = o.fallbackRender, l = o.FallbackComponent, c = o.fallback;
761
- if (s !== null) {
762
- var u = { error: s, resetErrorBoundary: this.resetErrorBoundary };
763
- if (Y.isValidElement(c)) return c;
773
+ })) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, i.resetKeys, f), this.reset());
774
+ }, s.render = function() {
775
+ var i = this.state.error, o = this.props, a = o.fallbackRender, l = o.FallbackComponent, c = o.fallback;
776
+ if (i !== null) {
777
+ var u = { error: i, resetErrorBoundary: this.resetErrorBoundary };
778
+ if (re.isValidElement(c)) return c;
764
779
  if (typeof a == "function") return a(u);
765
- if (l) return Y.createElement(l, u);
780
+ if (l) return re.createElement(l, u);
766
781
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
767
782
  }
768
783
  return this.props.children;
769
784
  }, r;
770
- }(Y.Component);
771
- function Bn({ children: t, onError: e }) {
772
- return y(Un, { fallback: y("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
773
- }
774
- const jn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? I : D;
775
- function zn({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
776
- const [r] = R();
777
- return jn(() => {
778
- if (n) return r.registerUpdateListener(({ editorState: i, dirtyElements: s, dirtyLeaves: o, prevEditorState: a, tags: l }) => {
779
- e && s.size === 0 && o.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(i, r, l);
785
+ }(re.Component);
786
+ function Qn({ children: t, onError: e }) {
787
+ return E(Gn, { fallback: E("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
788
+ }
789
+ const er = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
790
+ function tr({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
791
+ const [r] = T();
792
+ return er(() => {
793
+ if (n) return r.registerUpdateListener(({ editorState: s, dirtyElements: i, dirtyLeaves: o, prevEditorState: a, tags: l }) => {
794
+ e && i.size === 0 && o.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(s, r, l);
780
795
  });
781
796
  }, [r, t, e, n]), null;
782
797
  }
783
- function Wn() {
784
- const [t] = R();
785
- return D(() => {
786
- if (!t.hasNodes([Ie, Me])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
798
+ function nr() {
799
+ const [t] = T();
800
+ return k(() => {
801
+ if (!t.hasNodes([Ve, qe])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
787
802
  }, [t]), function(e) {
788
- D(() => Jt(e), [e]);
803
+ k(() => rn(e), [e]);
789
804
  }(t), null;
790
805
  }
791
- function Jn({ validateUrl: t }) {
792
- const [e] = R();
793
- return D(() => {
794
- if (!e.hasNodes([Ke])) throw new Error("LinkPlugin: LinkNode not registered on editor");
795
- return U(e.registerCommand(ge, (n) => {
796
- if (n === null) return Z(n), !0;
797
- if (typeof n == "string") return !(t !== void 0 && !t(n)) && (Z(n), !0);
806
+ function rr({ validateUrl: t }) {
807
+ const [e] = T();
808
+ return k(() => {
809
+ if (!e.hasNodes([He])) throw new Error("LinkPlugin: LinkNode not registered on editor");
810
+ return U(e.registerCommand(xe, (n) => {
811
+ if (n === null) return oe(n), !0;
812
+ if (typeof n == "string") return !(t !== void 0 && !t(n)) && (oe(n), !0);
798
813
  {
799
- const { url: r, target: i, rel: s, title: o } = n;
800
- return Z(r, { rel: s, target: i, title: o }), !0;
814
+ const { url: r, target: s, rel: i, title: o } = n;
815
+ return oe(r, { rel: i, target: s, title: o }), !0;
801
816
  }
802
- }, me), t !== void 0 ? e.registerCommand(Fe, (n) => {
817
+ }, Ee), t !== void 0 ? e.registerCommand(Je, (n) => {
803
818
  const r = g();
804
- if (!h(r) || r.isCollapsed() || !T(n, ClipboardEvent)) return !1;
805
- const i = n;
806
- if (i.clipboardData === null) return !1;
807
- const s = i.clipboardData.getData("text");
808
- return !!t(s) && !r.getNodes().some((o) => b(o)) && (e.dispatchCommand(ge, s), n.preventDefault(), !0);
809
- }, me) : () => {
819
+ if (!h(r) || r.isCollapsed() || !R(n, ClipboardEvent)) return !1;
820
+ const s = n;
821
+ if (s.clipboardData === null) return !1;
822
+ const i = s.clipboardData.getData("text");
823
+ return !!t(i) && !r.getNodes().some((o) => _(o)) && (e.dispatchCommand(xe, i), n.preventDefault(), !0);
824
+ }, Ee) : () => {
810
825
  });
811
826
  }, [e, t]), null;
812
827
  }
813
- function Vn({ newTab: t = !0, disabled: e = !1 }) {
814
- const [n] = R();
815
- return D(() => {
816
- const r = (s) => {
817
- const o = s.target;
828
+ function or({ newTab: t = !0, disabled: e = !1 }) {
829
+ const [n] = T();
830
+ return k(() => {
831
+ const r = (i) => {
832
+ const o = i.target;
818
833
  if (!(o instanceof Node)) return;
819
- const a = Kt(o);
834
+ const a = qt(o);
820
835
  if (a === null) return;
821
836
  let l = null, c = null;
822
837
  if (a.update(() => {
823
- const f = V(o);
838
+ const f = ee(o);
824
839
  if (f !== null) {
825
- const p = re(f, b);
826
- if (!e) if (Vt(p)) l = p.sanitizeUrl(p.getURL()), c = p.getTarget();
840
+ const p = me(f, _);
841
+ if (!e) if (on(p)) l = p.sanitizeUrl(p.getURL()), c = p.getTarget();
827
842
  else {
828
- const m = function(w, x) {
829
- let E = w;
830
- for (; E != null; ) {
831
- if (x(E)) return E;
832
- E = E.parentNode;
843
+ const m = function(v, b) {
844
+ let w = v;
845
+ for (; w != null; ) {
846
+ if (b(w)) return w;
847
+ w = w.parentNode;
833
848
  }
834
849
  return null;
835
- }(o, Ut);
850
+ }(o, Ht);
836
851
  m !== null && (l = m.href, c = m.target);
837
852
  }
838
853
  }
839
854
  }), l === null || l === "") return;
840
855
  const u = n.getEditorState().read(g);
841
- if (h(u) && !u.isCollapsed()) return void s.preventDefault();
842
- const d = s.type === "auxclick" && s.button === 1;
843
- window.open(l, t || d || s.metaKey || s.ctrlKey || c === "_blank" ? "_blank" : "_self"), s.preventDefault();
844
- }, i = (s) => {
845
- s.button === 1 && r(s);
856
+ if (h(u) && !u.isCollapsed()) return void i.preventDefault();
857
+ const d = i.type === "auxclick" && i.button === 1;
858
+ window.open(l, t || d || i.metaKey || i.ctrlKey || c === "_blank" ? "_blank" : "_self"), i.preventDefault();
859
+ }, s = (i) => {
860
+ i.button === 1 && r(i);
846
861
  };
847
- return n.registerRootListener((s, o) => {
848
- o !== null && (o.removeEventListener("click", r), o.removeEventListener("mouseup", i)), s !== null && (s.addEventListener("click", r), s.addEventListener("mouseup", i));
862
+ return n.registerRootListener((i, o) => {
863
+ o !== null && (o.removeEventListener("click", r), o.removeEventListener("mouseup", s)), i !== null && (i.addEventListener("click", r), i.addEventListener("mouseup", s));
849
864
  });
850
865
  }, [n, t, e]), null;
851
866
  }
852
- const rr = ({
867
+ const G = 0, ce = 1, ue = 2, D = 0, ir = 1, Fe = 2, sr = 3, ar = 4;
868
+ function lr(t, e, n, r, s) {
869
+ if (t === null || n.size === 0 && r.size === 0 && !s) return D;
870
+ const i = e._selection, o = t._selection;
871
+ if (s) return ir;
872
+ if (!(h(i) && h(o) && o.isCollapsed() && i.isCollapsed())) return D;
873
+ const a = function(w, C, x) {
874
+ const $ = w._nodeMap, S = [];
875
+ for (const L of C) {
876
+ const M = $.get(L);
877
+ M !== void 0 && S.push(M);
878
+ }
879
+ for (const [L, M] of x) {
880
+ if (!M) continue;
881
+ const j = $.get(L);
882
+ j === void 0 || fe(j) || S.push(j);
883
+ }
884
+ return S;
885
+ }(e, n, r);
886
+ if (a.length === 0) return D;
887
+ if (a.length > 1) {
888
+ const w = e._nodeMap, C = w.get(i.anchor.key), x = w.get(o.anchor.key);
889
+ return C && x && !t._nodeMap.has(C.__key) && N(C) && C.__text.length === 1 && i.anchor.offset === 1 ? Fe : D;
890
+ }
891
+ const l = a[0], c = t._nodeMap.get(l.__key);
892
+ if (!N(c) || !N(l) || c.__mode !== l.__mode) return D;
893
+ const u = c.__text, d = l.__text;
894
+ if (u === d) return D;
895
+ const f = i.anchor, p = o.anchor;
896
+ if (f.key !== p.key || f.type !== "text") return D;
897
+ const m = f.offset, v = p.offset, b = d.length - u.length;
898
+ return b === 1 && v === m - 1 ? Fe : b === -1 && v === m + 1 ? sr : b === -1 && v === m ? ar : D;
899
+ }
900
+ function cr(t, e) {
901
+ let n = Date.now(), r = D;
902
+ return (s, i, o, a, l, c) => {
903
+ const u = Date.now();
904
+ if (c.has("historic")) return r = D, n = u, ue;
905
+ const d = lr(s, i, a, l, t.isComposing()), f = (() => {
906
+ const p = o === null || o.editor === t, m = c.has("history-push");
907
+ if (!m && p && c.has("history-merge")) return G;
908
+ if (s === null) return ce;
909
+ const v = i._selection;
910
+ return a.size > 0 || l.size > 0 ? m === !1 && d !== D && d === r && u < n + e && p || a.size === 1 && function(b, w, C) {
911
+ const x = w._nodeMap.get(b), $ = C._nodeMap.get(b), S = w._selection, L = C._selection;
912
+ return !(h(S) && h(L) && S.anchor.type === "element" && S.focus.type === "element" && L.anchor.type === "text" && L.focus.type === "text" || !N(x) || !N($) || x.__parent !== $.__parent) && JSON.stringify(w.read(() => x.exportJSON())) === JSON.stringify(C.read(() => $.exportJSON()));
913
+ }(Array.from(a)[0], s, i) ? G : ce : v !== null ? G : ue;
914
+ })();
915
+ return n = u, r = d, f;
916
+ };
917
+ }
918
+ function Ae(t) {
919
+ t.undoStack = [], t.redoStack = [], t.current = null;
920
+ }
921
+ function ur(t, e, n) {
922
+ const r = cr(t, n);
923
+ return U(t.registerCommand(Gt, () => (function(i, o) {
924
+ const a = o.redoStack, l = o.undoStack;
925
+ if (l.length !== 0) {
926
+ const c = o.current, u = l.pop();
927
+ c !== null && (a.push(c), i.dispatchCommand(q, !0)), l.length === 0 && i.dispatchCommand(H, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
928
+ }
929
+ }(t, e), !0), y), t.registerCommand(Zt, () => (function(i, o) {
930
+ const a = o.redoStack, l = o.undoStack;
931
+ if (a.length !== 0) {
932
+ const c = o.current;
933
+ c !== null && (l.push(c), i.dispatchCommand(H, !0));
934
+ const u = a.pop();
935
+ a.length === 0 && i.dispatchCommand(q, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
936
+ }
937
+ }(t, e), !0), y), t.registerCommand(Yt, () => (Ae(e), !1), y), t.registerCommand(Xt, () => (Ae(e), t.dispatchCommand(q, !1), t.dispatchCommand(H, !1), !0), y), t.registerUpdateListener(({ editorState: i, prevEditorState: o, dirtyLeaves: a, dirtyElements: l, tags: c }) => {
938
+ const u = e.current, d = e.redoStack, f = e.undoStack, p = u === null ? null : u.editorState;
939
+ if (u !== null && i === p) return;
940
+ const m = r(o, i, u, a, l, c);
941
+ if (m === ce) d.length !== 0 && (e.redoStack = [], t.dispatchCommand(q, !1)), u !== null && (f.push({ ...u }), t.dispatchCommand(H, !0));
942
+ else if (m === ue) return;
943
+ e.current = { editor: t, editorState: i };
944
+ }));
945
+ }
946
+ function dr() {
947
+ return { current: null, redoStack: [], undoStack: [] };
948
+ }
949
+ function fr({ delay: t, externalHistoryState: e }) {
950
+ const [n] = T();
951
+ return function(r, s, i = 1e3) {
952
+ const o = W(() => s || dr(), [s]);
953
+ k(() => ur(r, o, i), [i, r, o]);
954
+ }(n, e, t), null;
955
+ }
956
+ const Ir = ({
853
957
  namespace: t = "UvaEditor",
854
958
  initialValue: e = "",
855
959
  placeholder: n = "",
856
960
  onChange: r
857
961
  }) => {
858
- const i = {
962
+ const s = {
859
963
  namespace: t,
860
- theme: Gt,
964
+ theme: dn,
861
965
  onError(o) {
862
966
  throw o;
863
967
  },
864
- nodes: [Ie, Me, Ke, Yt],
968
+ nodes: [Ve, qe, He, cn],
865
969
  editorState: (o) => {
866
- const l = new DOMParser().parseFromString(e, "text/html"), c = ze(o, l), u = P();
970
+ const l = new DOMParser().parseFromString(e, "text/html"), c = Ge(o, l), u = O();
867
971
  u.clear();
868
- const d = ne();
972
+ const d = de();
869
973
  c.forEach((f) => d.append(f)), u.append(d);
870
974
  }
871
- }, s = (o, a) => {
975
+ }, i = (o, a) => {
872
976
  o.read(() => {
873
- const l = We(a);
977
+ const l = Qe(a);
874
978
  r(l);
875
979
  });
876
980
  };
877
- return /* @__PURE__ */ y("div", { className: K.editor__wrapper, children: /* @__PURE__ */ J(en, { initialConfig: i, children: [
878
- /* @__PURE__ */ y(Zt, {}),
879
- /* @__PURE__ */ J("div", { className: K["editor__field-wrapper"], children: [
880
- /* @__PURE__ */ y(
881
- On,
981
+ return /* @__PURE__ */ E("div", { className: J.editor__wrapper, children: /* @__PURE__ */ Q(mn, { initialConfig: s, children: [
982
+ /* @__PURE__ */ E(un, {}),
983
+ /* @__PURE__ */ Q("div", { className: J["editor__field-wrapper"], children: [
984
+ /* @__PURE__ */ E(
985
+ Wn,
882
986
  {
883
- contentEditable: /* @__PURE__ */ y(
884
- In,
987
+ contentEditable: /* @__PURE__ */ E(
988
+ Xn,
885
989
  {
886
- className: K.editor__field,
990
+ className: J.editor__field,
887
991
  "aria-label": "Rich text editor content",
888
992
  "aria-placeholder": n,
889
993
  title: "Rich text editor content",
890
- placeholder: /* @__PURE__ */ y("div", { className: K.editor__placeholder, children: n })
994
+ placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n })
891
995
  }
892
996
  ),
893
- placeholder: /* @__PURE__ */ y("div", { className: K.editor__placeholder, children: n }),
894
- ErrorBoundary: Bn
997
+ placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n }),
998
+ ErrorBoundary: Qn
895
999
  }
896
1000
  ),
897
- /* @__PURE__ */ y(Wn, {}),
898
- /* @__PURE__ */ y(Jn, { validateUrl: qt }),
899
- /* @__PURE__ */ y(Ht, { matchers: Xt }),
900
- /* @__PURE__ */ y(Vn, {}),
901
- /* @__PURE__ */ y(zn, { onChange: s })
1001
+ /* @__PURE__ */ E(fr, {}),
1002
+ /* @__PURE__ */ E(nr, {}),
1003
+ /* @__PURE__ */ E(rr, { validateUrl: sn }),
1004
+ /* @__PURE__ */ E(an, { matchers: ln }),
1005
+ /* @__PURE__ */ E(or, {}),
1006
+ /* @__PURE__ */ E(tr, { onChange: i })
902
1007
  ] })
903
1008
  ] }) });
904
1009
  };
905
1010
  export {
906
- rr as RteEditor
1011
+ Ir as RteEditor
907
1012
  };
908
1013
  //# sourceMappingURL=RteEditor.js.map