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