@uva-glass/component-library 3.47.6 → 3.47.7

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 (102) hide show
  1. package/dist/{Lexical.prod-nXWuyOKD.js → Lexical.prod-DBU6xTBY.js} +1397 -1279
  2. package/dist/Lexical.prod-DBU6xTBY.js.map +1 -0
  3. package/dist/LexicalClipboard.prod-CzGBnMdD.js +272 -0
  4. package/dist/LexicalClipboard.prod-CzGBnMdD.js.map +1 -0
  5. package/dist/LexicalLink.prod-DV9kT537.js +1027 -0
  6. package/dist/LexicalLink.prod-DV9kT537.js.map +1 -0
  7. package/dist/{LexicalList.prod--mkvX0uW.js → LexicalList.prod-2UfLUgO1.js} +159 -154
  8. package/dist/LexicalList.prod-2UfLUgO1.js.map +1 -0
  9. package/dist/LexicalSelection.prod-C1JYA_go.js +114 -0
  10. package/dist/LexicalSelection.prod-C1JYA_go.js.map +1 -0
  11. package/dist/LexicalTable.prod-CZ1mYUR-.js +1802 -0
  12. package/dist/LexicalTable.prod-CZ1mYUR-.js.map +1 -0
  13. package/dist/LexicalUtils.prod-C3vvQk50.js +114 -0
  14. package/dist/LexicalUtils.prod-C3vvQk50.js.map +1 -0
  15. package/dist/{TableCellResizerPlugin-Cpbankb8.js → TableCellResizerPlugin-CxFy7dbe.js} +53 -53
  16. package/dist/TableCellResizerPlugin-CxFy7dbe.js.map +1 -0
  17. package/dist/{TablePlugin-CfXPNfT8.js → TablePlugin-CfTWvWk1.js} +59 -59
  18. package/dist/{TablePlugin-CfXPNfT8.js.map → TablePlugin-CfTWvWk1.js.map} +1 -1
  19. package/dist/client--GsCJ9Up.js +27328 -0
  20. package/dist/client--GsCJ9Up.js.map +1 -0
  21. package/dist/components/Accordion/Accordion.test.js +3 -3
  22. package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
  23. package/dist/components/ActionList/ActionList.test.js +3 -3
  24. package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
  25. package/dist/components/Attention/Attention.test.js +2 -2
  26. package/dist/components/Backdrop/Backdrop.test.js +2 -2
  27. package/dist/components/Buttons/Button.test.js +2 -2
  28. package/dist/components/Buttons/LinkButton.test.js +2 -2
  29. package/dist/components/Buttons/MenuButton.test.js +2 -2
  30. package/dist/components/Card/Card.test.js +2 -2
  31. package/dist/components/Checkbox/Checkbox.test.js +3 -3
  32. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
  33. package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
  34. package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
  35. package/dist/components/FormInput/FormInput.js +1 -1
  36. package/dist/components/InputField/InputField.stories.js +1 -1
  37. package/dist/components/Label/Label.test.js +2 -2
  38. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  39. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  40. package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
  41. package/dist/components/MultiSelect/index.js +1 -1
  42. package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
  43. package/dist/components/Notification/Notification.test.js +2 -2
  44. package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
  45. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
  46. package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
  47. package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
  48. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
  49. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +7 -7
  50. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +6 -6
  51. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
  52. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +9 -9
  53. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +35 -35
  54. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +9 -5
  55. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -1
  56. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +40 -40
  57. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
  58. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +4 -4
  59. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
  60. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
  61. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +4 -4
  62. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +25 -25
  63. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  64. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +19 -19
  65. package/dist/components/RteEditor/Plugins/index.js +2 -2
  66. package/dist/components/RteEditor/RteEditor.js +671 -627
  67. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  68. package/dist/components/RteEditor/helpers.js +8 -8
  69. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +19 -19
  70. package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
  71. package/dist/components/TextArea/TextArea.test.js +2 -2
  72. package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
  73. package/dist/components/index.js +1 -1
  74. package/dist/{index-D5qpMB9d.js → index-Bf2LCbD1.js} +2 -2
  75. package/dist/{index-D5qpMB9d.js.map → index-Bf2LCbD1.js.map} +1 -1
  76. package/dist/{index-rQE9MV9y.js → index-JOHbZ4si.js} +523 -523
  77. package/dist/{index-rQE9MV9y.js.map → index-JOHbZ4si.js.map} +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/{react-18-DXfB7ZX7.js → react-18-BHQltW8V.js} +2 -2
  80. package/dist/{react-18-DXfB7ZX7.js.map → react-18-BHQltW8V.js.map} +1 -1
  81. package/dist/{react.esm-D2ppoNuM.js → react.esm-Bg7Fh9lz.js} +3 -3
  82. package/dist/{react.esm-D2ppoNuM.js.map → react.esm-Bg7Fh9lz.js.map} +1 -1
  83. package/dist/setupTests.js +1 -1
  84. package/dist/storybook__react.d.js +1 -1
  85. package/package.json +20 -20
  86. package/dist/Lexical.prod-nXWuyOKD.js.map +0 -1
  87. package/dist/LexicalClipboard.prod-pXq91TBU.js +0 -276
  88. package/dist/LexicalClipboard.prod-pXq91TBU.js.map +0 -1
  89. package/dist/LexicalLink.prod-Brzpgs_K.js +0 -285
  90. package/dist/LexicalLink.prod-Brzpgs_K.js.map +0 -1
  91. package/dist/LexicalList.prod--mkvX0uW.js.map +0 -1
  92. package/dist/LexicalSelection.prod-Ct4PZOht.js +0 -119
  93. package/dist/LexicalSelection.prod-Ct4PZOht.js.map +0 -1
  94. package/dist/LexicalTable.prod-Bexd4dGG.js +0 -1763
  95. package/dist/LexicalTable.prod-Bexd4dGG.js.map +0 -1
  96. package/dist/LexicalUtils.prod-Ckfw0Hjt.js +0 -123
  97. package/dist/LexicalUtils.prod-Ckfw0Hjt.js.map +0 -1
  98. package/dist/TableCellResizerPlugin-Cpbankb8.js.map +0 -1
  99. package/dist/client-BK9NlSVR.js +0 -25208
  100. package/dist/client-BK9NlSVR.js.map +0 -1
  101. package/dist/helpers-mE437H2Y.js +0 -164
  102. package/dist/helpers-mE437H2Y.js.map +0 -1
@@ -1,23 +1,22 @@
1
- import { jsx as h, jsxs as O, Fragment as Re } from "react/jsx-runtime";
2
- import { t as Ve, r as Ge, o as I } from "../../LexicalComposerContext.prod-DOyoZx0P.js";
3
- import { aK as Ie, ah as A, F as Qe, w as p, aL as ue, ao as U, h as j, L as Ze, Z as R, a as g, a0 as et, I as m, aM as tt, af as Me, o as rt, x as Ke, aN as nt, aO as ot, S as at, f as $, aG as st, aP as it, aQ as lt, aR as ut, n as G, aS as ct, aT as dt, a5 as ft, g as mt, k as pt, G as gt, aU as ht, aV as fe, b as me, P as vt, N as ee, O as Ct, a6 as Oe, aW as pe, C as yt, B as Et, z as wt, aX as ge, A as bt, aY as _t, aZ as St, a_ as ze, aF as kt, X as xt, U as Nt, a$ as Lt, Y as Dt, J as $t, H as Tt, u as Pt, K as he, b0 as Rt, e as It, au as W, at as Y, b1 as Mt, b2 as Kt, aw as Ot, b3 as oe, av as zt, b4 as At } from "../../Lexical.prod-nXWuyOKD.js";
4
- import * as te from "react";
5
- import { useMemo as Q, useLayoutEffect as H, useEffect as k, useState as K, Suspense as Ft, forwardRef as Ae, useCallback as Bt, useRef as Ut } from "react";
6
- import { a as jt, T as Ht } from "../../TableCellResizerPlugin-Cpbankb8.js";
7
- import { j as F, L as z, y as Jt, w as ce } from "../../LexicalUtils.prod-Ckfw0Hjt.js";
8
- import { flushSync as Wt, createPortal as Yt } from "react-dom";
9
- import { A as ve, F as Ce, m as qt, g as Xt } from "../../LexicalClipboard.prod-pXq91TBU.js";
10
- import { R as ye, Q as Ee, e as we } from "../../LexicalSelection.prod-Ct4PZOht.js";
11
- import { r as Fe, Y as Be, v as Vt, S as Gt } from "../../LexicalList.prod--mkvX0uW.js";
12
- import { g as Ue, k as be, v as re, p as Qt, m as Zt } from "../../LexicalLink.prod-Brzpgs_K.js";
13
- import { s as er, d as tr, b as je, e as rr, w as nr, S as or, y as He, O as ar } from "../../LexicalTable.prod-Bexd4dGG.js";
14
- import { a as sr, w as ir, M as lr } from "../../helpers-mE437H2Y.js";
1
+ import { jsx as m, jsxs as I, Fragment as _e } from "react/jsx-runtime";
2
+ import { t as Ye, r as je, o as D } from "../../LexicalComposerContext.prod-DOyoZx0P.js";
3
+ import { aK as Le, ah as A, M as Xe, a as p, aS as re, aM as ne, an as F, _ as oe, O as qe, e as B, f as g, Y as Ge, A as c, aW as Ve, ae as Ze, Z as Qe, v as et, aX as tt, aY as rt, S as nt, aV as T, aG as ot, aZ as at, a_ as st, a$ as it, l as ee, b0 as lt, b1 as dt, a4 as ut, y as ct, a1 as ft, E as mt, b2 as pt, b3 as le, o as de, R as gt, J as G, Q as ht, a5 as ke, b4 as ue, D as vt, B as yt, C as Ct, b5 as ce, z as bt, b6 as Et, b7 as wt, b8 as Te, aF as St, W as xt, b as De, V as Nt, b9 as _t, X as Lt, I as kt, G as Tt, p as Dt, at as W, as as J, ba as Pt, bb as $t, av as Bt, bc as te, au as Mt, bd as Rt, be as It, aQ as At } from "../../Lexical.prod-DBU6xTBY.js";
4
+ import { useMemo as X, useLayoutEffect as O, useEffect as E, useState as R, Suspense as Kt, forwardRef as Pe, useCallback as zt, Component as Ft, createElement as fe, createContext as Ot, useRef as Ut } from "react";
5
+ import { a as Ht, T as Wt } from "../../TableCellResizerPlugin-CxFy7dbe.js";
6
+ import { T as Jt, R as $e, z as Yt, a as ae, A as Be, l as jt, K as Xt, F as qt, d as Me, b as Gt } from "../../LexicalLink.prod-DV9kT537.js";
7
+ import { flushSync as Vt, createPortal as Zt } from "react-dom";
8
+ import { U, L as z, x as Qt } from "../../LexicalUtils.prod-C3vvQk50.js";
9
+ import { A as me, F as pe, g as er, x as tr } from "../../LexicalClipboard.prod-CzGBnMdD.js";
10
+ import { z as ge, Y as he, t as ve } from "../../LexicalSelection.prod-C1JYA_go.js";
11
+ import { l as Re, n as Ie, L as rr, b as nr } from "../../LexicalList.prod-2UfLUgO1.js";
12
+ import { u as or, h as ar, d as Ae, v as sr, N as ir, y as lr, T as Ke, k as dr } from "../../LexicalTable.prod-CZ1mYUR-.js";
15
13
  import { c as ur } from "../../clsx-OuTLNxxd.js";
16
- import { exportMap as cr, mergeBoldStrongTags as dr, cleanUpTable as fr } from "./helpers.js";
17
- import { s as P } from "../../RteEditor.module-CovRFt0S.js";
18
- import { ToolBarPlugin as mr } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
19
- import { useTranslation as pr } from "./hooks/useTranslation.js";
20
- import "../../TablePlugin-CfXPNfT8.js";
14
+ import { exportMap as cr, mergeBoldStrongTags as fr, cleanUpTable as mr } from "./helpers.js";
15
+ import { validateUrl as pr, MATCHERS as gr } from "./Plugins/LinkPlugin/helpers.js";
16
+ import { s as $ } from "../../RteEditor.module-CovRFt0S.js";
17
+ import { ToolBarPlugin as hr } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
18
+ import { useTranslation as vr } from "./hooks/useTranslation.js";
19
+ import "../../TablePlugin-CfTWvWk1.js";
21
20
  import "./Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
22
21
  import "./hooks/components/Flyout.js";
23
22
  import "../Accordion/Accordion.js";
@@ -25,7 +24,7 @@ import "../Buttons/Button.js";
25
24
  import "../Buttons/LinkButton.js";
26
25
  import "@react-aria/button";
27
26
  import "../Checkbox/Checkbox.js";
28
- import { FeedbackBox as gr } from "../FeedbackBox/FeedbackBox.js";
27
+ import { FeedbackBox as yr } from "../FeedbackBox/FeedbackBox.js";
29
28
  import "@react-aria/dialog";
30
29
  import "@react-aria/focus";
31
30
  import "@react-aria/overlays";
@@ -41,87 +40,88 @@ import "../SelectListbox/SelectProvider.js";
41
40
  import "../Sortable/components/SortableItem.js";
42
41
  import "../../SortableProvider-l8-7ClBJ.js";
43
42
  import "../WeekSelector/components/WeekSelectorOptionContainer.js";
44
- import { PasteHandlerPlugin as hr } from "./Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js";
45
- import { UvaTheme as vr } from "./UvaTheme/UvaTheme.js";
46
- import { EditorHeader as Cr } from "./EditorHeader/EditorHeader.js";
47
- import { LanguageProvider as yr, useLanguage as Er } from "./Providers/LanguageProvider.js";
48
- import { TableWrapperNode as wr } from "./nodes/TableWrapperNode/TableWrapperNode.js";
49
- const Je = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, br = Je ? H : k, q = { tag: ue };
50
- function _r({ initialConfig: r, children: e }) {
51
- const t = Q((() => {
52
- const { theme: o, namespace: a, nodes: n, onError: s, editorState: i, html: l } = r, c = Ve(null, o), u = Ie({ editable: r.editable, html: l, namespace: a, nodes: n, onError: (d) => s(d, u), theme: o });
53
- return (function(d, f) {
54
- if (f !== null) {
55
- if (f === void 0) d.update((() => {
56
- const v = A();
57
- if (v.isEmpty()) {
58
- const C = Qe();
59
- v.append(C);
60
- const w = Je ? document.activeElement : null;
61
- (p() !== null || w !== null && w === d.getRootElement()) && C.select();
43
+ import { PasteHandlerPlugin as Cr } from "./Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js";
44
+ import { UvaTheme as br } from "./UvaTheme/UvaTheme.js";
45
+ import { EditorHeader as Er } from "./EditorHeader/EditorHeader.js";
46
+ import { LanguageProvider as wr, useLanguage as Sr } from "./Providers/LanguageProvider.js";
47
+ import { TableWrapperNode as xr } from "./nodes/TableWrapperNode/TableWrapperNode.js";
48
+ const ze = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Nr = ze ? O : E, Y = { tag: re };
49
+ function _r({ initialConfig: r, children: t }) {
50
+ const e = X(() => {
51
+ const { theme: n, namespace: o, nodes: a, onError: s, editorState: i, html: l } = r, u = Ye(null, n), d = Le({ editable: r.editable, html: l, namespace: o, nodes: a, onError: (f) => s(f, d), theme: n });
52
+ return (function(f, h) {
53
+ if (h !== null) {
54
+ if (h === void 0) f.update(() => {
55
+ const S = A();
56
+ if (S.isEmpty()) {
57
+ const v = Xe();
58
+ S.append(v);
59
+ const _ = ze ? document.activeElement : null;
60
+ (p() !== null || _ !== null && _ === f.getRootElement()) && v.select();
62
61
  }
63
- }), q);
64
- else if (f !== null) switch (typeof f) {
62
+ }, Y);
63
+ else if (h !== null) switch (typeof h) {
65
64
  case "string": {
66
- const v = d.parseEditorState(f);
67
- d.setEditorState(v, q);
65
+ const S = f.parseEditorState(h);
66
+ f.setEditorState(S, Y);
68
67
  break;
69
68
  }
70
69
  case "object":
71
- d.setEditorState(f, q);
70
+ f.setEditorState(h, Y);
72
71
  break;
73
72
  case "function":
74
- d.update((() => {
75
- A().isEmpty() && f(d);
76
- }), q);
73
+ f.update(() => {
74
+ A().isEmpty() && h(f);
75
+ }, Y);
77
76
  }
78
77
  }
79
- })(u, i), [u, c];
80
- }), []);
81
- return br((() => {
82
- const o = r.editable, [a] = t;
83
- a.setEditable(o === void 0 || o);
84
- }), []), h(Ge.Provider, { value: t, children: e });
85
- }
86
- function Sr() {
78
+ })(d, i), [d, u];
79
+ }, []);
80
+ return Nr(() => {
81
+ const n = r.editable, [o] = e;
82
+ o.setEditable(n === void 0 || n);
83
+ }, []), m(je.Provider, { value: e, children: t });
84
+ }
85
+ const Lr = ne({ name: "@lexical/react/ReactProvider" });
86
+ function kr() {
87
87
  return A().getTextContent();
88
88
  }
89
- function kr(r, e = !0) {
89
+ function Tr(r, t = !0) {
90
90
  if (r) return !1;
91
- let t = Sr();
92
- return e && (t = t.trim()), t === "";
93
- }
94
- function xr(r) {
95
- if (!kr(r, !1)) return !1;
96
- const e = A().getChildren(), t = e.length;
97
- if (t > 1) return !1;
98
- for (let o = 0; o < t; o++) {
99
- const a = e[o];
100
- if (U(a)) return !1;
101
- if (j(a)) {
102
- if (!Ze(a) || a.__indent !== 0) return !1;
103
- const n = a.getChildren(), s = n.length;
91
+ let e = kr();
92
+ return t && (e = e.trim()), e === "";
93
+ }
94
+ function Dr(r) {
95
+ if (!Tr(r, !1)) return !1;
96
+ const t = A().getChildren(), e = t.length;
97
+ if (e > 1) return !1;
98
+ for (let n = 0; n < e; n++) {
99
+ const o = t[n];
100
+ if (F(o)) return !1;
101
+ if (oe(o)) {
102
+ if (!qe(o) || o.__indent !== 0) return !1;
103
+ const a = o.getChildren(), s = a.length;
104
104
  for (let i = 0; i < s; i++) {
105
- const l = n[o];
106
- if (!R(l)) return !1;
105
+ const l = a[n];
106
+ if (!B(l)) return !1;
107
107
  }
108
108
  }
109
109
  }
110
110
  return !0;
111
111
  }
112
- function We(r) {
113
- return () => xr(r);
112
+ function Fe(r) {
113
+ return () => Dr(r);
114
114
  }
115
- function Nr(r) {
116
- const e = window.location.origin, t = (o) => {
117
- if (o.origin !== e) return;
118
- const a = r.getRootElement();
119
- if (document.activeElement !== a) return;
120
- const n = o.data;
121
- if (typeof n == "string") {
115
+ function Pr(r) {
116
+ const t = window.location.origin, e = (n) => {
117
+ if (n.origin !== t) return;
118
+ const o = r.getRootElement();
119
+ if (document.activeElement !== o) return;
120
+ const a = n.data;
121
+ if (typeof a == "string") {
122
122
  let s;
123
123
  try {
124
- s = JSON.parse(n);
124
+ s = JSON.parse(a);
125
125
  } catch {
126
126
  return;
127
127
  }
@@ -130,674 +130,718 @@ function Nr(r) {
130
130
  if (i && i.functionId === "makeChanges") {
131
131
  const l = i.args;
132
132
  if (l) {
133
- const [c, u, d, f, v, C] = l;
134
- r.update((() => {
135
- const w = p();
136
- if (g(w)) {
137
- const x = w.anchor;
138
- let y = x.getNode(), E = 0, _ = 0;
139
- if (R(y) && c >= 0 && u >= 0 && (E = c, _ = c + u, w.setTextNodeRange(y, E, y, _)), E === _ && d === "" || (w.insertRawText(d), y = x.getNode()), R(y)) {
140
- E = f, _ = f + v;
141
- const N = y.getTextContentSize();
142
- E = E > N ? N : E, _ = _ > N ? N : _, w.setTextNodeRange(y, E, y, _);
133
+ const [u, d, f, h, S] = l;
134
+ r.update(() => {
135
+ const v = p();
136
+ if (g(v)) {
137
+ const _ = v.anchor;
138
+ let x = _.getNode(), w = 0, y = 0;
139
+ if (B(x) && u >= 0 && d >= 0 && (w = u, y = u + d, v.setTextNodeRange(x, w, x, y)), w === y && f === "" || (v.insertRawText(f), x = _.getNode()), B(x)) {
140
+ w = h, y = h + S;
141
+ const N = x.getTextContentSize();
142
+ w = w > N ? N : w, y = y > N ? N : y, v.setTextNodeRange(x, w, x, y);
143
143
  }
144
- o.stopImmediatePropagation();
144
+ n.stopImmediatePropagation();
145
145
  }
146
- }));
146
+ });
147
147
  }
148
148
  }
149
149
  }
150
150
  }
151
151
  };
152
- return window.addEventListener("message", t, !0), () => {
153
- window.removeEventListener("message", t, !0);
152
+ return window.addEventListener("message", e, !0), () => {
153
+ window.removeEventListener("message", e, !0);
154
154
  };
155
155
  }
156
- function _e(r, e) {
156
+ function ye(r, t) {
157
157
  if (document.caretRangeFromPoint !== void 0) {
158
- const t = document.caretRangeFromPoint(r, e);
159
- return t === null ? null : { node: t.startContainer, offset: t.startOffset };
158
+ const e = document.caretRangeFromPoint(r, t);
159
+ return e === null ? null : { node: e.startContainer, offset: e.startOffset };
160
160
  }
161
161
  if (document.caretPositionFromPoint !== "undefined") {
162
- const t = document.caretPositionFromPoint(r, e);
163
- return t === null ? null : { node: t.offsetNode, offset: t.offset };
162
+ const e = document.caretPositionFromPoint(r, t);
163
+ return e === null ? null : { node: e.offsetNode, offset: e.offset };
164
164
  }
165
165
  return null;
166
166
  }
167
- const B = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Lr = B && "documentMode" in document ? document.documentMode : null, Dr = !(!B || !("InputEvent" in window) || Lr) && "getTargetRanges" in new window.InputEvent("input"), $r = B && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Se = B && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Tr = B && /^(?=.*Chrome).*/i.test(navigator.userAgent), Pr = B && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Tr, ke = rt("DRAG_DROP_PASTE_FILE");
168
- function X(r) {
169
- let e = null;
170
- if (z(r, DragEvent) ? e = r.dataTransfer : z(r, ClipboardEvent) && (e = r.clipboardData), e === null) return [!1, [], !1];
171
- const t = e.types, o = t.includes("Files"), a = t.includes("text/html") || t.includes("text/plain");
172
- return [o, Array.from(e.files), a];
173
- }
174
- function xe(r) {
175
- const e = p();
176
- if (!g(e)) return !1;
177
- const t = /* @__PURE__ */ new Set(), o = e.getNodes();
178
- for (let a = 0; a < o.length; a++) {
179
- const n = o[a], s = n.getKey();
180
- if (t.has(s)) continue;
181
- const i = ce(n, ((c) => j(c) && !c.isInline()));
167
+ const K = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, $r = K && "documentMode" in document ? document.documentMode : null, Br = K && /Mac|iPod|iPhone|iPad/.test(navigator.platform), Mr = !(!K || !("InputEvent" in window) || $r) && "getTargetRanges" in new window.InputEvent("input"), Rr = K && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Ce = K && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Ir = K && /^(?=.*Chrome).*/i.test(navigator.userAgent), Ar = K && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && Br && !Ir, be = Qe("DRAG_DROP_PASTE_FILE");
168
+ function j(r) {
169
+ let t = null;
170
+ if (z(r, DragEvent) ? t = r.dataTransfer : z(r, ClipboardEvent) && (t = r.clipboardData), t === null) return [!1, [], !1];
171
+ const e = t.types, n = e.includes("Files"), o = e.includes("text/html") || e.includes("text/plain");
172
+ return [n, Array.from(t.files), o];
173
+ }
174
+ function Ee(r) {
175
+ const t = p();
176
+ if (!g(t)) return !1;
177
+ const e = /* @__PURE__ */ new Set(), n = t.getNodes();
178
+ for (let o = 0; o < n.length; o++) {
179
+ const a = n[o], s = a.getKey();
180
+ if (e.has(s)) continue;
181
+ const i = De(a, (u) => oe(u) && !u.isInline());
182
182
  if (i === null) continue;
183
183
  const l = i.getKey();
184
- i.canIndent() && !t.has(l) && (t.add(l), r(i));
184
+ i.canIndent() && !e.has(l) && (e.add(l), r(i));
185
185
  }
186
- return t.size > 0;
186
+ return e.size > 0;
187
187
  }
188
- function Ne(r) {
189
- const e = G(r);
190
- return U(e);
188
+ function we(r) {
189
+ const t = ee(r);
190
+ return F(t);
191
191
  }
192
- function ne(r) {
193
- for (const e of ["lowercase", "uppercase", "capitalize"]) r.hasFormat(e) && r.toggleFormat(e);
192
+ function V(r) {
193
+ for (const t of ["lowercase", "uppercase", "capitalize"]) r.hasFormat(t) && r.toggleFormat(t);
194
194
  }
195
- function Rr(r) {
196
- return F(r.registerCommand(Pt, ((e) => {
197
- const t = p();
198
- return !!$(t) && (t.clear(), !0);
199
- }), m), r.registerCommand(ee, ((e) => {
200
- const t = p();
201
- return g(t) ? (t.deleteCharacter(e), !0) : !!$(t) && (t.deleteNodes(), !0);
202
- }), m), r.registerCommand(Tt, ((e) => {
203
- const t = p();
204
- return !!g(t) && (t.deleteWord(e), !0);
205
- }), m), r.registerCommand($t, ((e) => {
206
- const t = p();
207
- return !!g(t) && (t.deleteLine(e), !0);
208
- }), m), r.registerCommand(Dt, ((e) => {
209
- const t = p();
210
- if (typeof e == "string") t !== null && t.insertText(e);
195
+ function Kr(r) {
196
+ return U(r.registerCommand(Dt, (t) => {
197
+ const e = p();
198
+ return !!T(e) && (e.clear(), !0);
199
+ }, c), r.registerCommand(G, (t) => {
200
+ const e = p();
201
+ return g(e) ? (e.deleteCharacter(t), !0) : !!T(e) && (e.deleteNodes(), !0);
202
+ }, c), r.registerCommand(Tt, (t) => {
203
+ const e = p();
204
+ return !!g(e) && (e.deleteWord(t), !0);
205
+ }, c), r.registerCommand(kt, (t) => {
206
+ const e = p();
207
+ return !!g(e) && (e.deleteLine(t), !0);
208
+ }, c), r.registerCommand(Lt, (t) => {
209
+ const e = p();
210
+ if (typeof t == "string") e !== null && e.insertText(t);
211
211
  else {
212
- if (t === null) return !1;
213
- const o = e.dataTransfer;
214
- if (o != null) ve(o, t, r);
215
- else if (g(t)) {
216
- const a = e.data;
217
- return a && t.insertText(a), !0;
212
+ if (e === null) return !1;
213
+ const n = t.dataTransfer;
214
+ if (n != null) me(n, e, r);
215
+ else if (g(e)) {
216
+ const o = t.data;
217
+ return o && e.insertText(o), !0;
218
218
  }
219
219
  }
220
220
  return !0;
221
- }), m), r.registerCommand(Lt, (() => {
222
- const e = p();
223
- return !!g(e) && (e.removeText(), !0);
224
- }), m), r.registerCommand(Nt, ((e) => {
225
- const t = p();
226
- return !!g(t) && (t.formatText(e), !0);
227
- }), m), r.registerCommand(xt, ((e) => {
221
+ }, c), r.registerCommand(_t, () => {
228
222
  const t = p();
229
- if (!g(t) && !$(t)) return !1;
230
- const o = t.getNodes();
231
- for (const a of o) {
232
- const n = ce(a, ((s) => j(s) && !s.isInline()));
233
- n !== null && n.setFormat(e);
223
+ return !!g(t) && (t.removeText(), !0);
224
+ }, c), r.registerCommand(Nt, (t) => {
225
+ const e = p();
226
+ return !!g(e) && (e.formatText(t), !0);
227
+ }, c), r.registerCommand(xt, (t) => {
228
+ const e = p();
229
+ if (!g(e) && !T(e)) return !1;
230
+ const n = e.getNodes();
231
+ for (const o of n) {
232
+ const a = De(o, (s) => oe(s) && !s.isInline());
233
+ a !== null && a.setFormat(t);
234
234
  }
235
235
  return !0;
236
- }), m), r.registerCommand(fe, ((e) => {
237
- const t = p();
238
- return !!g(t) && (t.insertLineBreak(e), !0);
239
- }), m), r.registerCommand(me, (() => {
236
+ }, c), r.registerCommand(le, (t) => {
240
237
  const e = p();
241
- return !!g(e) && (e.insertParagraph(), !0);
242
- }), m), r.registerCommand(St, (() => (ze([kt()]), !0)), m), r.registerCommand(_t, (() => xe(((e) => {
243
- const t = e.getIndent();
244
- e.setIndent(t + 1);
245
- }))), m), r.registerCommand(pe, (() => xe(((e) => {
246
- const t = e.getIndent();
247
- t > 0 && e.setIndent(Math.max(0, t - 1));
248
- }))), m), r.registerCommand(bt, ((e) => {
238
+ return !!g(e) && (e.insertLineBreak(t), !0);
239
+ }, c), r.registerCommand(de, () => {
249
240
  const t = p();
250
- if ($(t)) {
251
- const o = t.getNodes();
252
- if (o.length > 0) return o[0].selectPrevious(), !0;
253
- } else if (g(t)) {
254
- const o = ge(t.focus, !0);
255
- if (!e.shiftKey && U(o) && !o.isIsolated() && !o.isInline()) return o.selectPrevious(), e.preventDefault(), !0;
241
+ return !!g(t) && (t.insertParagraph(), !0);
242
+ }, c), r.registerCommand(wt, () => (Te([St()]), !0), c), r.registerCommand(Et, () => Ee((t) => {
243
+ const e = t.getIndent();
244
+ t.setIndent(e + 1);
245
+ }), c), r.registerCommand(ue, () => Ee((t) => {
246
+ const e = t.getIndent();
247
+ e > 0 && t.setIndent(Math.max(0, e - 1));
248
+ }), c), r.registerCommand(bt, (t) => {
249
+ const e = p();
250
+ if (T(e)) {
251
+ const n = e.getNodes();
252
+ if (n.length > 0) return n[0].selectPrevious(), !0;
253
+ } else if (g(e)) {
254
+ const n = ce(e.focus, !0);
255
+ if (!t.shiftKey && F(n) && !n.isIsolated() && !n.isInline()) return n.selectPrevious(), t.preventDefault(), !0;
256
256
  }
257
257
  return !1;
258
- }), m), r.registerCommand(wt, ((e) => {
259
- const t = p();
260
- if ($(t)) {
261
- const o = t.getNodes();
262
- if (o.length > 0) return o[0].selectNext(0, 0), !0;
263
- } else if (g(t)) {
264
- if ((function(a) {
265
- const n = a.focus;
266
- return n.key === "root" && n.offset === A().getChildrenSize();
267
- })(t)) return e.preventDefault(), !0;
268
- const o = ge(t.focus, !1);
269
- if (!e.shiftKey && U(o) && !o.isIsolated() && !o.isInline()) return o.selectNext(), e.preventDefault(), !0;
258
+ }, c), r.registerCommand(Ct, (t) => {
259
+ const e = p();
260
+ if (T(e)) {
261
+ const n = e.getNodes();
262
+ if (n.length > 0) return n[0].selectNext(0, 0), !0;
263
+ } else if (g(e)) {
264
+ if ((function(o) {
265
+ const a = o.focus;
266
+ return a.key === "root" && a.offset === A().getChildrenSize();
267
+ })(e)) return t.preventDefault(), !0;
268
+ const n = ce(e.focus, !1);
269
+ if (!t.shiftKey && F(n) && !n.isIsolated() && !n.isInline()) return n.selectNext(), t.preventDefault(), !0;
270
270
  }
271
271
  return !1;
272
- }), m), r.registerCommand(Et, ((e) => {
273
- const t = p();
274
- if ($(t)) {
275
- const o = t.getNodes();
276
- if (o.length > 0) return e.preventDefault(), ye(o[0]) ? o[0].selectNext(0, 0) : o[0].selectPrevious(), !0;
272
+ }, c), r.registerCommand(yt, (t) => {
273
+ const e = p();
274
+ if (T(e)) {
275
+ const n = e.getNodes();
276
+ if (n.length > 0) return t.preventDefault(), ge(n[0]) ? n[0].selectNext(0, 0) : n[0].selectPrevious(), !0;
277
277
  }
278
- if (!g(t)) return !1;
279
- if (Ee(t, !0)) {
280
- const o = e.shiftKey;
281
- return e.preventDefault(), we(t, o, !0), !0;
278
+ if (!g(e)) return !1;
279
+ if (he(e, !0)) {
280
+ const n = t.shiftKey;
281
+ return t.preventDefault(), ve(e, n, !0), !0;
282
282
  }
283
283
  return !1;
284
- }), m), r.registerCommand(yt, ((e) => {
285
- const t = p();
286
- if ($(t)) {
287
- const a = t.getNodes();
288
- if (a.length > 0) return e.preventDefault(), ye(a[0]) ? a[0].selectPrevious() : a[0].selectNext(0, 0), !0;
289
- }
290
- if (!g(t)) return !1;
291
- const o = e.shiftKey;
292
- return !!Ee(t, !1) && (e.preventDefault(), we(t, o, !1), !0);
293
- }), m), r.registerCommand(Ct, ((e) => {
294
- if (Ne(e.target)) return !1;
295
- const t = p();
296
- if (g(t)) {
297
- if ((function(o) {
298
- if (!o.isCollapsed()) return !1;
299
- const { anchor: a } = o;
300
- if (a.offset !== 0) return !1;
301
- const n = a.getNode();
302
- if (Oe(n)) return !1;
303
- const s = Jt(n);
304
- return s.getIndent() > 0 && (s.is(n) || n.is(s.getFirstDescendant()));
305
- })(t)) return e.preventDefault(), r.dispatchCommand(pe, void 0);
306
- if (Se && navigator.language === "ko-KR") return !1;
307
- } else if (!$(t)) return !1;
308
- return e.preventDefault(), r.dispatchCommand(ee, !0);
309
- }), m), r.registerCommand(vt, ((e) => {
310
- if (Ne(e.target)) return !1;
311
- const t = p();
312
- return !(!g(t) && !$(t)) && (e.preventDefault(), r.dispatchCommand(ee, !1));
313
- }), m), r.registerCommand(ht, ((e) => {
314
- const t = p();
315
- if (!g(t)) return !1;
316
- if (ne(t), e !== null) {
317
- if ((Se || $r || Pr) && Dr) return !1;
318
- if (e.preventDefault(), e.shiftKey) return r.dispatchCommand(fe, !1);
284
+ }, c), r.registerCommand(vt, (t) => {
285
+ const e = p();
286
+ if (T(e)) {
287
+ const o = e.getNodes();
288
+ if (o.length > 0) return t.preventDefault(), ge(o[0]) ? o[0].selectPrevious() : o[0].selectNext(0, 0), !0;
319
289
  }
320
- return r.dispatchCommand(me, void 0);
321
- }), m), r.registerCommand(gt, (() => {
290
+ if (!g(e)) return !1;
291
+ const n = t.shiftKey;
292
+ return !!he(e, !1) && (t.preventDefault(), ve(e, n, !1), !0);
293
+ }, c), r.registerCommand(ht, (t) => {
294
+ if (we(t.target)) return !1;
295
+ const e = p();
296
+ if (g(e)) {
297
+ if ((function(n) {
298
+ if (!n.isCollapsed()) return !1;
299
+ const { anchor: o } = n;
300
+ if (o.offset !== 0) return !1;
301
+ const a = o.getNode();
302
+ if (ke(a)) return !1;
303
+ const s = Qt(a);
304
+ return s.getIndent() > 0 && (s.is(a) || a.is(s.getFirstDescendant()));
305
+ })(e)) return t.preventDefault(), r.dispatchCommand(ue, void 0);
306
+ if (Ce && navigator.language === "ko-KR") return !1;
307
+ } else if (!T(e)) return !1;
308
+ return t.preventDefault(), r.dispatchCommand(G, !0);
309
+ }, c), r.registerCommand(gt, (t) => {
310
+ if (we(t.target)) return !1;
311
+ const e = p();
312
+ return !(!g(e) && !T(e)) && (t.preventDefault(), r.dispatchCommand(G, !1));
313
+ }, c), r.registerCommand(pt, (t) => {
322
314
  const e = p();
323
- return !!g(e) && (r.blur(), !0);
324
- }), m), r.registerCommand(dt, ((e) => {
325
- const [, t] = X(e);
326
- if (t.length > 0) {
327
- const a = _e(e.clientX, e.clientY);
328
- if (a !== null) {
329
- const { offset: n, node: s } = a, i = G(s);
315
+ if (!g(e)) return !1;
316
+ if (V(e), t !== null) {
317
+ if ((Ce || Rr || Ar) && Mr) return !1;
318
+ if (t.preventDefault(), t.shiftKey) return r.dispatchCommand(le, !1);
319
+ }
320
+ return r.dispatchCommand(de, void 0);
321
+ }, c), r.registerCommand(mt, () => {
322
+ const t = p();
323
+ return !!g(t) && (r.blur(), !0);
324
+ }, c), r.registerCommand(dt, (t) => {
325
+ const [, e] = j(t);
326
+ if (e.length > 0) {
327
+ const o = ye(t.clientX, t.clientY);
328
+ if (o !== null) {
329
+ const { offset: a, node: s } = o, i = ee(s);
330
330
  if (i !== null) {
331
- const l = ft();
332
- if (R(i)) l.anchor.set(i.getKey(), n, "text"), l.focus.set(i.getKey(), n, "text");
331
+ const l = ut();
332
+ if (B(i)) l.anchor.set(i.getKey(), a, "text"), l.focus.set(i.getKey(), a, "text");
333
333
  else {
334
- const u = i.getParentOrThrow().getKey(), d = i.getIndexWithinParent() + 1;
335
- l.anchor.set(u, d, "element"), l.focus.set(u, d, "element");
334
+ const d = i.getParentOrThrow().getKey(), f = i.getIndexWithinParent() + 1;
335
+ l.anchor.set(d, f, "element"), l.focus.set(d, f, "element");
336
336
  }
337
- const c = mt(l);
338
- pt(c);
337
+ const u = ct(l);
338
+ ft(u);
339
339
  }
340
- r.dispatchCommand(ke, t);
340
+ r.dispatchCommand(be, e);
341
341
  }
342
- return e.preventDefault(), !0;
342
+ return t.preventDefault(), !0;
343
343
  }
344
- const o = p();
345
- return !!g(o);
346
- }), m), r.registerCommand(ct, ((e) => {
347
- const [t] = X(e), o = p();
348
- return !(t && !g(o));
349
- }), m), r.registerCommand(ut, ((e) => {
350
- const [t] = X(e), o = p();
351
- if (t && !g(o)) return !1;
352
- const a = _e(e.clientX, e.clientY);
353
- if (a !== null) {
354
- const n = G(a.node);
355
- U(n) && e.preventDefault();
344
+ const n = p();
345
+ return !!g(n);
346
+ }, c), r.registerCommand(lt, (t) => {
347
+ const [e] = j(t), n = p();
348
+ return !(e && !g(n));
349
+ }, c), r.registerCommand(it, (t) => {
350
+ const [e] = j(t), n = p();
351
+ if (e && !g(n)) return !1;
352
+ const o = ye(t.clientX, t.clientY);
353
+ if (o !== null) {
354
+ const a = ee(o.node);
355
+ F(a) && t.preventDefault();
356
356
  }
357
357
  return !0;
358
- }), m), r.registerCommand(it, (() => (lt(), !0)), m), r.registerCommand(st, ((e) => (Ce(r, z(e, ClipboardEvent) ? e : null), !0)), m), r.registerCommand(at, ((e) => ((async function(t, o) {
359
- await Ce(o, z(t, ClipboardEvent) ? t : null), o.update((() => {
360
- const a = p();
361
- g(a) ? a.removeText() : $(a) && a.getNodes().forEach(((n) => n.remove()));
362
- }));
363
- })(e, r), !0)), m), r.registerCommand(Me, ((e) => {
364
- const [, t, o] = X(e);
365
- return t.length > 0 && !o ? (r.dispatchCommand(ke, t), !0) : Ke(e.target) && nt(e.target) ? !1 : p() !== null && ((function(a, n) {
366
- a.preventDefault(), n.update((() => {
367
- const s = p(), i = z(a, InputEvent) || z(a, KeyboardEvent) ? null : a.clipboardData;
368
- i != null && s !== null && ve(i, s, n);
369
- }), { tag: ot });
370
- })(e, r), !0);
371
- }), m), r.registerCommand(tt, ((e) => {
372
- const t = p();
373
- return g(t) && ne(t), !1;
374
- }), m), r.registerCommand(et, ((e) => {
375
- const t = p();
376
- return g(t) && ne(t), !1;
377
- }), m));
378
- }
379
- const ae = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : k;
380
- function Le(r) {
381
- return r.getEditorState().read(We(r.isComposing()));
382
- }
383
- function Ir({ contentEditable: r, placeholder: e = null, ErrorBoundary: t }) {
384
- const [o] = I(), a = (function(n, s) {
385
- const [i, l] = K((() => n.getDecorators()));
386
- return ae((() => n.registerDecoratorListener(((c) => {
387
- Wt((() => {
388
- l(c);
389
- }));
390
- }))), [n]), k((() => {
391
- l(n.getDecorators());
392
- }), [n]), Q((() => {
393
- const c = [], u = Object.keys(i);
394
- for (let d = 0; d < u.length; d++) {
395
- const f = u[d], v = h(s, { onError: (w) => n._onError(w), children: h(Ft, { fallback: null, children: i[f] }) }), C = n.getElementByKey(f);
396
- C !== null && c.push(Yt(v, C, f));
358
+ }, c), r.registerCommand(at, () => (st(), !0), c), r.registerCommand(ot, (t) => (pe(r, z(t, ClipboardEvent) ? t : null), !0), c), r.registerCommand(nt, (t) => ((async function(e, n) {
359
+ await pe(n, z(e, ClipboardEvent) ? e : null), n.update(() => {
360
+ const o = p();
361
+ g(o) ? o.removeText() : T(o) && o.getNodes().forEach((a) => a.remove());
362
+ });
363
+ })(t, r), !0), c), r.registerCommand(Ze, (t) => {
364
+ const [, e, n] = j(t);
365
+ return e.length > 0 && !n ? (r.dispatchCommand(be, e), !0) : et(t.target) && tt(t.target) ? !1 : p() !== null && ((function(o, a) {
366
+ o.preventDefault(), a.update(() => {
367
+ const s = p(), i = z(o, InputEvent) || z(o, KeyboardEvent) ? null : o.clipboardData;
368
+ i != null && s !== null && me(i, s, a);
369
+ }, { tag: rt });
370
+ })(t, r), !0);
371
+ }, c), r.registerCommand(Ve, (t) => {
372
+ const e = p();
373
+ return g(e) && V(e), !1;
374
+ }, c), r.registerCommand(Ge, (t) => {
375
+ const e = p();
376
+ return g(e) && V(e), !1;
377
+ }, c));
378
+ }
379
+ function zr(r, ...t) {
380
+ const e = new URL("https://lexical.dev/docs/error"), n = new URLSearchParams();
381
+ n.append("code", r);
382
+ for (const o of t) n.append("v", o);
383
+ throw e.search = n.toString(), Error(`Minified Lexical error #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
384
+ }
385
+ const se = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : E;
386
+ function Fr({ editor: r, ErrorBoundary: t }) {
387
+ return (function(e, n) {
388
+ const [o, a] = R(() => e.getDecorators());
389
+ return se(() => e.registerDecoratorListener((s) => {
390
+ Vt(() => {
391
+ a(s);
392
+ });
393
+ }), [e]), E(() => {
394
+ a(e.getDecorators());
395
+ }, [e]), X(() => {
396
+ const s = [], i = Object.keys(o);
397
+ for (let l = 0; l < i.length; l++) {
398
+ const u = i[l], d = m(n, { onError: (h) => e._onError(h), children: m(Kt, { fallback: null, children: o[u] }) }), f = e.getElementByKey(u);
399
+ f !== null && s.push(Zt(d, f, u));
397
400
  }
398
- return c;
399
- }), [s, i, n]);
400
- })(o, t);
401
- return (function(n) {
402
- ae((() => F(Rr(n), Nr(n))), [n]);
403
- })(o), O(Re, { children: [r, h(Mr, { content: e }), a] });
404
- }
405
- function Mr({ content: r }) {
406
- const [e] = I(), t = (function(a) {
407
- const [n, s] = K((() => Le(a)));
408
- return ae((() => {
401
+ return s;
402
+ }, [n, o, e]);
403
+ })(r, t);
404
+ }
405
+ function Or({ editor: r, ErrorBoundary: t }) {
406
+ return (function(e) {
407
+ const n = Jt.maybeFromEditor(e);
408
+ if (n && n.hasExtensionByName(Lr.name)) {
409
+ for (const o of ["@lexical/plain-text", "@lexical/rich-text"]) n.hasExtensionByName(o) && zr(320, o);
410
+ return !0;
411
+ }
412
+ return !1;
413
+ })(r) ? null : m(Fr, { editor: r, ErrorBoundary: t });
414
+ }
415
+ function Se(r) {
416
+ return r.getEditorState().read(Fe(r.isComposing()));
417
+ }
418
+ function Ur({ contentEditable: r, placeholder: t = null, ErrorBoundary: e }) {
419
+ const [n] = D();
420
+ return (function(o) {
421
+ se(() => U(Kr(o), Pr(o)), [o]);
422
+ })(n), I(_e, { children: [r, m(Hr, { content: t }), m(Or, { editor: n, ErrorBoundary: e })] });
423
+ }
424
+ function Hr({ content: r }) {
425
+ const [t] = D(), e = (function(o) {
426
+ const [a, s] = R(() => Se(o));
427
+ return se(() => {
409
428
  function i() {
410
- const l = Le(a);
429
+ const l = Se(o);
411
430
  s(l);
412
431
  }
413
- return i(), F(a.registerUpdateListener((() => {
432
+ return i(), U(o.registerUpdateListener(() => {
414
433
  i();
415
- })), a.registerEditableListener((() => {
434
+ }), o.registerEditableListener(() => {
416
435
  i();
417
- })));
418
- }), [a]), n;
419
- })(e), o = jt();
420
- return t ? typeof r == "function" ? r(o) : r : null;
421
- }
422
- const Ye = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : k;
423
- function Kr({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: o, ariaDescribedBy: a, ariaErrorMessage: n, ariaExpanded: s, ariaInvalid: i, ariaLabel: l, ariaLabelledBy: c, ariaMultiline: u, ariaOwns: d, ariaRequired: f, autoCapitalize: v, className: C, id: w, role: x = "textbox", spellCheck: y = !0, style: E, tabIndex: _, "data-testid": N, ...b }, L) {
424
- const [S, T] = K(r.isEditable()), Z = Bt(((M) => {
425
- M && M.ownerDocument && M.ownerDocument.defaultView ? r.setRootElement(M) : r.setRootElement(null);
426
- }), [r]), Xe = Q((() => /* @__PURE__ */ (function(...M) {
427
- return (de) => {
428
- M.forEach(((J) => {
429
- typeof J == "function" ? J(de) : J != null && (J.current = de);
430
436
  }));
437
+ }, [o]), a;
438
+ })(t), n = Ht();
439
+ return e ? typeof r == "function" ? r(n) : r : null;
440
+ }
441
+ const Oe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : E;
442
+ function Wr({ editor: r, ariaActiveDescendant: t, ariaAutoComplete: e, ariaControls: n, ariaDescribedBy: o, ariaErrorMessage: a, ariaExpanded: s, ariaInvalid: i, ariaLabel: l, ariaLabelledBy: u, ariaMultiline: d, ariaOwns: f, ariaRequired: h, autoCapitalize: S, className: v, id: _, role: x = "textbox", spellCheck: w = !0, style: y, tabIndex: N, "data-testid": k, ...b }, L) {
443
+ const [C, P] = R(r.isEditable()), q = zt((M) => {
444
+ M && M.ownerDocument && M.ownerDocument.defaultView ? r.setRootElement(M) : r.setRootElement(null);
445
+ }, [r]), Je = X(() => /* @__PURE__ */ (function(...M) {
446
+ return (ie) => {
447
+ for (const H of M) typeof H == "function" ? H(ie) : H != null && (H.current = ie);
431
448
  };
432
- })(L, Z)), [Z, L]);
433
- return Ye((() => (T(r.isEditable()), r.registerEditableListener(((M) => {
434
- T(M);
435
- })))), [r]), h("div", { "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? t : "none", "aria-controls": S ? o : void 0, "aria-describedby": a, ...n != null ? { "aria-errormessage": n } : {}, "aria-expanded": S && x === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": c, "aria-multiline": u, "aria-owns": S ? d : void 0, "aria-readonly": !S || void 0, "aria-required": f, autoCapitalize: v, className: C, contentEditable: S, "data-testid": N, id: w, ref: Xe, role: x, spellCheck: y, style: E, tabIndex: _, ...b });
436
- }
437
- const Or = Ae(Kr);
438
- function De(r) {
439
- return r.getEditorState().read(We(r.isComposing()));
440
- }
441
- const zr = Ae(Ar);
442
- function Ar(r, e) {
443
- const { placeholder: t, ...o } = r, [a] = I();
444
- return O(Re, { children: [h(Or, { editor: a, ...o, ref: e }), t != null && h(Fr, { editor: a, content: t })] });
445
- }
446
- function Fr({ content: r, editor: e }) {
447
- const t = (function(s) {
448
- const [i, l] = K((() => De(s)));
449
- return Ye((() => {
450
- function c() {
451
- const u = De(s);
452
- l(u);
449
+ })(L, q), [q, L]);
450
+ return Oe(() => (P(r.isEditable()), r.registerEditableListener((M) => {
451
+ P(M);
452
+ })), [r]), m("div", { "aria-activedescendant": C ? t : void 0, "aria-autocomplete": C ? e : "none", "aria-controls": C ? n : void 0, "aria-describedby": o, ...a != null ? { "aria-errormessage": a } : {}, "aria-expanded": C && x === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": u, "aria-multiline": d, "aria-owns": C ? f : void 0, "aria-readonly": !C || void 0, "aria-required": h, autoCapitalize: S, className: v, contentEditable: C, "data-testid": k, id: _, ref: Je, role: x, spellCheck: w, style: y, tabIndex: N, ...b });
453
+ }
454
+ const Jr = Pe(Wr);
455
+ function xe(r) {
456
+ return r.getEditorState().read(Fe(r.isComposing()));
457
+ }
458
+ const Yr = Pe(jr);
459
+ function jr(r, t) {
460
+ const { placeholder: e, ...n } = r, [o] = D();
461
+ return I(_e, { children: [m(Jr, { editor: o, ...n, ref: t }), e != null && m(Xr, { editor: o, content: e })] });
462
+ }
463
+ function Xr({ content: r, editor: t }) {
464
+ const e = (function(s) {
465
+ const [i, l] = R(() => xe(s));
466
+ return Oe(() => {
467
+ function u() {
468
+ const d = xe(s);
469
+ l(d);
453
470
  }
454
- return c(), F(s.registerUpdateListener((() => {
455
- c();
456
- })), s.registerEditableListener((() => {
457
- c();
458
- })));
459
- }), [s]), i;
460
- })(e), [o, a] = K(e.isEditable());
461
- if (H((() => (a(e.isEditable()), e.registerEditableListener(((s) => {
462
- a(s);
463
- })))), [e]), !t) return null;
464
- let n = null;
465
- return typeof r == "function" ? n = r(o) : r !== null && (n = r), n === null ? null : h("div", { "aria-hidden": !0, children: n });
466
- }
467
- function se(r, e) {
468
- return se = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, o) {
469
- return t.__proto__ = o, t;
470
- }, se(r, e);
471
- }
472
- var $e = { error: null }, Br = (function(r) {
473
- var e, t;
474
- function o() {
475
- for (var n, s = arguments.length, i = new Array(s), l = 0; l < s; l++) i[l] = arguments[l];
476
- return (n = r.call.apply(r, [this].concat(i)) || this).state = $e, n.resetErrorBoundary = function() {
477
- for (var c, u = arguments.length, d = new Array(u), f = 0; f < u; f++) d[f] = arguments[f];
478
- n.props.onReset == null || (c = n.props).onReset.apply(c, d), n.reset();
479
- }, n;
471
+ return u(), U(s.registerUpdateListener(() => {
472
+ u();
473
+ }), s.registerEditableListener(() => {
474
+ u();
475
+ }));
476
+ }, [s]), i;
477
+ })(t), [n, o] = R(t.isEditable());
478
+ if (O(() => (o(t.isEditable()), t.registerEditableListener((s) => {
479
+ o(s);
480
+ })), [t]), !e) return null;
481
+ let a = null;
482
+ return typeof r == "function" ? a = r(n) : r !== null && (a = r), a === null ? null : m("div", { "aria-hidden": !0, children: a });
483
+ }
484
+ const qr = Ot(null), Z = {
485
+ didCatch: !1,
486
+ error: null
487
+ };
488
+ class Gr extends Ft {
489
+ constructor(t) {
490
+ super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = Z;
480
491
  }
481
- t = r, (e = o).prototype = Object.create(t.prototype), e.prototype.constructor = e, se(e, t), o.getDerivedStateFromError = function(n) {
482
- return { error: n };
483
- };
484
- var a = o.prototype;
485
- return a.reset = function() {
486
- this.setState($e);
487
- }, a.componentDidCatch = function(n, s) {
488
- var i, l;
489
- (i = (l = this.props).onError) == null || i.call(l, n, s);
490
- }, a.componentDidUpdate = function(n, s) {
491
- var i, l, c, u, d = this.state.error, f = this.props.resetKeys;
492
- d !== null && s.error !== null && ((c = n.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some((function(v, C) {
493
- return !Object.is(v, u[C]);
494
- }))) && ((i = (l = this.props).onResetKeysChange) == null || i.call(l, n.resetKeys, f), this.reset());
495
- }, a.render = function() {
496
- var n = this.state.error, s = this.props, i = s.fallbackRender, l = s.FallbackComponent, c = s.fallback;
497
- if (n !== null) {
498
- var u = { error: n, resetErrorBoundary: this.resetErrorBoundary };
499
- if (te.isValidElement(c)) return c;
500
- if (typeof i == "function") return i(u);
501
- if (l) return te.createElement(l, u);
502
- throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
492
+ static getDerivedStateFromError(t) {
493
+ return {
494
+ didCatch: !0,
495
+ error: t
496
+ };
497
+ }
498
+ resetErrorBoundary() {
499
+ const {
500
+ error: t
501
+ } = this.state;
502
+ if (t !== null) {
503
+ for (var e, n, o = arguments.length, a = new Array(o), s = 0; s < o; s++)
504
+ a[s] = arguments[s];
505
+ (e = (n = this.props).onReset) === null || e === void 0 || e.call(n, {
506
+ args: a,
507
+ reason: "imperative-api"
508
+ }), this.setState(Z);
503
509
  }
504
- return this.props.children;
505
- }, o;
506
- })(te.Component);
507
- function Ur({ children: r, onError: e }) {
508
- return h(Br, { fallback: h("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: r });
509
- }
510
- const jr = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : k;
511
- function Hr({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: e = !1, onChange: t }) {
512
- const [o] = I();
513
- return jr((() => {
514
- if (t) return o.registerUpdateListener((({ editorState: a, dirtyElements: n, dirtyLeaves: s, prevEditorState: i, tags: l }) => {
515
- e && n.size === 0 && s.size === 0 || r && l.has(ue) || i.isEmpty() || t(a, o, l);
516
- }));
517
- }), [o, r, e, t]), null;
518
- }
519
- function Jr({ hasStrictIndent: r = !1 }) {
520
- const [e] = I();
521
- return k((() => {
522
- if (!e.hasNodes([Fe, Be])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
523
- }), [e]), k((() => {
524
- if (r) return Vt(e);
525
- }), [e, r]), (function(t) {
526
- k((() => Gt(t)), [t]);
527
- })(e), null;
528
- }
529
- function Wr({ validateUrl: r, attributes: e }) {
530
- const [t] = I();
531
- return k((() => {
532
- if (!t.hasNodes([Ue])) throw new Error("LinkPlugin: LinkNode not registered on editor");
533
- return F(t.registerCommand(be, ((o) => {
534
- if (o === null) return re(o), !0;
535
- if (typeof o == "string") return !(r !== void 0 && !r(o)) && (re(o, e), !0);
536
- {
537
- const { url: a, target: n, rel: s, title: i } = o;
538
- return re(a, { ...e, rel: s, target: n, title: i }), !0;
510
+ }
511
+ componentDidCatch(t, e) {
512
+ var n, o;
513
+ (n = (o = this.props).onError) === null || n === void 0 || n.call(o, t, e);
514
+ }
515
+ componentDidUpdate(t, e) {
516
+ const {
517
+ didCatch: n
518
+ } = this.state, {
519
+ resetKeys: o
520
+ } = this.props;
521
+ if (n && e.error !== null && Vr(t.resetKeys, o)) {
522
+ var a, s;
523
+ (a = (s = this.props).onReset) === null || a === void 0 || a.call(s, {
524
+ next: o,
525
+ prev: t.resetKeys,
526
+ reason: "keys"
527
+ }), this.setState(Z);
528
+ }
529
+ }
530
+ render() {
531
+ const {
532
+ children: t,
533
+ fallbackRender: e,
534
+ FallbackComponent: n,
535
+ fallback: o
536
+ } = this.props, {
537
+ didCatch: a,
538
+ error: s
539
+ } = this.state;
540
+ let i = t;
541
+ if (a) {
542
+ const l = {
543
+ error: s,
544
+ resetErrorBoundary: this.resetErrorBoundary
545
+ };
546
+ if (typeof e == "function")
547
+ i = e(l);
548
+ else if (n)
549
+ i = fe(n, l);
550
+ else if (o !== void 0)
551
+ i = o;
552
+ else
553
+ throw s;
554
+ }
555
+ return fe(qr.Provider, {
556
+ value: {
557
+ didCatch: a,
558
+ error: s,
559
+ resetErrorBoundary: this.resetErrorBoundary
539
560
  }
540
- }), he), r !== void 0 ? t.registerCommand(Me, ((o) => {
541
- const a = p();
542
- if (!g(a) || a.isCollapsed() || !z(o, ClipboardEvent) || o.clipboardData === null) return !1;
543
- const n = o.clipboardData.getData("text");
544
- return !!r(n) && !a.getNodes().some(((s) => j(s))) && (t.dispatchCommand(be, { ...e, url: n }), o.preventDefault(), !0);
545
- }), he) : () => {
561
+ }, i);
562
+ }
563
+ }
564
+ function Vr() {
565
+ let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
566
+ return r.length !== t.length || r.some((e, n) => !Object.is(e, t[n]));
567
+ }
568
+ function Zr({ children: r, onError: t }) {
569
+ return m(Gr, { fallback: m("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: t, children: r });
570
+ }
571
+ const Qr = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? O : E;
572
+ function en({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: t = !1, onChange: e }) {
573
+ const [n] = D();
574
+ return Qr(() => {
575
+ if (e) return n.registerUpdateListener(({ editorState: o, dirtyElements: a, dirtyLeaves: s, prevEditorState: i, tags: l }) => {
576
+ t && a.size === 0 && s.size === 0 || r && l.has(re) || i.isEmpty() || e(o, n, l);
546
577
  });
547
- }), [t, r, e]), null;
548
- }
549
- function Yr({ newTab: r = !0, disabled: e = !1 }) {
550
- const [t] = I();
551
- return k((() => {
552
- const o = (n) => {
553
- const s = n.target;
554
- if (!Ke(s)) return;
555
- const i = Rt(s);
556
- if (i === null) return;
557
- let l = null, c = null;
558
- if (i.update((() => {
559
- const f = G(s);
560
- if (f !== null) {
561
- const v = ce(f, j);
562
- if (!e) if (Qt(v)) l = v.sanitizeUrl(v.getURL()), c = v.getTarget();
563
- else {
564
- const C = (function(w, x) {
565
- let y = w;
566
- for (; y != null; ) {
567
- if (x(y)) return y;
568
- y = y.parentNode;
569
- }
570
- return null;
571
- })(s, It);
572
- C !== null && (l = C.href, c = C.target);
573
- }
574
- }
575
- })), l === null || l === "") return;
576
- const u = t.getEditorState().read(p);
577
- if (g(u) && !u.isCollapsed()) return void n.preventDefault();
578
- const d = n.type === "auxclick" && n.button === 1;
579
- window.open(l, r || d || n.metaKey || n.ctrlKey || c === "_blank" ? "_blank" : "_self"), n.preventDefault();
580
- }, a = (n) => {
581
- n.button === 1 && o(n);
582
- };
583
- return t.registerRootListener(((n, s) => {
584
- s !== null && (s.removeEventListener("click", o), s.removeEventListener("mouseup", a)), n !== null && (n.addEventListener("click", o), n.addEventListener("mouseup", a));
585
- }));
586
- }), [t, r, e]), null;
587
- }
588
- const V = 0, ie = 1, le = 2, D = 0, qr = 1, Te = 2, Xr = 3, Vr = 4;
589
- function Gr(r, e, t, o, a) {
590
- if (r === null || t.size === 0 && o.size === 0 && !a) return D;
591
- const n = e._selection, s = r._selection;
592
- if (a) return qr;
593
- if (!(g(n) && g(s) && s.isCollapsed() && n.isCollapsed())) return D;
594
- const i = (function(y, E, _) {
595
- const N = y._nodeMap, b = [];
596
- for (const L of E) {
597
- const S = N.get(L);
598
- S !== void 0 && b.push(S);
578
+ }, [n, r, t, e]), null;
579
+ }
580
+ function tn({ hasStrictIndent: r = !1 }) {
581
+ const [t] = D();
582
+ return E(() => {
583
+ if (!t.hasNodes([Re, Ie])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
584
+ }, [t]), E(() => {
585
+ if (r) return rr(t);
586
+ }, [t, r]), (function(e) {
587
+ E(() => nr(e), [e]);
588
+ })(t), null;
589
+ }
590
+ function rn({ validateUrl: r, attributes: t }) {
591
+ const [e] = D();
592
+ return E(() => {
593
+ if (!e.hasNodes([$e])) throw new Error("LinkPlugin: LinkNode not registered on editor");
594
+ }), E(() => Yt(e, ae({ attributes: t, validateUrl: r })), [e, r, t]), null;
595
+ }
596
+ function nn(r, t, e) {
597
+ E(() => {
598
+ r.hasNodes([Be]) || (function(n, ...o) {
599
+ const a = new URL("https://lexical.dev/docs/error"), s = new URLSearchParams();
600
+ s.append("code", n);
601
+ for (const i of o) s.append("v", i);
602
+ throw a.search = s.toString(), Error(`Minified Lexical error #${n}; visit ${a.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
603
+ })(77);
604
+ }), E(() => jt(r, { changeHandlers: e ? [e] : [], matchers: t }), [r, t, e]);
605
+ }
606
+ function on({ matchers: r, onChange: t }) {
607
+ const [e] = D();
608
+ return nn(e, r, t), null;
609
+ }
610
+ function an({ newTab: r = !0, disabled: t = !1 }) {
611
+ const [e] = D();
612
+ return E(() => Xt(e, ae({ disabled: t, newTab: r })), [e, r, t]), null;
613
+ }
614
+ function sn(r, t, e, n, o) {
615
+ if (r === null || e.size === 0 && n.size === 0 && !o) return 0;
616
+ const a = t._selection, s = r._selection;
617
+ if (o) return 1;
618
+ if (!(g(a) && g(s) && s.isCollapsed() && a.isCollapsed())) return 0;
619
+ const i = (function(w, y, N) {
620
+ const k = w._nodeMap, b = [];
621
+ for (const L of y) {
622
+ const C = k.get(L);
623
+ C !== void 0 && b.push(C);
599
624
  }
600
- for (const [L, S] of _) {
601
- if (!S) continue;
602
- const T = N.get(L);
603
- T === void 0 || Oe(T) || b.push(T);
625
+ for (const [L, C] of N) {
626
+ if (!C) continue;
627
+ const P = k.get(L);
628
+ P === void 0 || ke(P) || b.push(P);
604
629
  }
605
630
  return b;
606
- })(e, t, o);
607
- if (i.length === 0) return D;
631
+ })(t, e, n);
632
+ if (i.length === 0) return 0;
608
633
  if (i.length > 1) {
609
- const y = e._nodeMap, E = y.get(n.anchor.key), _ = y.get(s.anchor.key);
610
- return E && _ && !r._nodeMap.has(E.__key) && R(E) && E.__text.length === 1 && n.anchor.offset === 1 ? Te : D;
634
+ const w = t._nodeMap, y = w.get(a.anchor.key), N = w.get(s.anchor.key);
635
+ return y && N && !r._nodeMap.has(y.__key) && B(y) && y.__text.length === 1 && a.anchor.offset === 1 ? 2 : 0;
611
636
  }
612
- const l = i[0], c = r._nodeMap.get(l.__key);
613
- if (!R(c) || !R(l) || c.__mode !== l.__mode) return D;
614
- const u = c.__text, d = l.__text;
615
- if (u === d) return D;
616
- const f = n.anchor, v = s.anchor;
617
- if (f.key !== v.key || f.type !== "text") return D;
618
- const C = f.offset, w = v.offset, x = d.length - u.length;
619
- return x === 1 && w === C - 1 ? Te : x === -1 && w === C + 1 ? Xr : x === -1 && w === C ? Vr : D;
620
- }
621
- function Qr(r, e) {
622
- let t = Date.now(), o = D;
623
- return (a, n, s, i, l, c) => {
624
- const u = Date.now();
625
- if (c.has(oe)) return o = D, t = u, le;
626
- const d = Gr(a, n, i, l, r.isComposing()), f = (() => {
627
- const v = s === null || s.editor === r, C = c.has(At);
628
- if (!C && v && c.has(ue)) return V;
629
- if (a === null) return ie;
630
- const w = n._selection;
631
- return i.size > 0 || l.size > 0 ? C === !1 && d !== D && d === o && u < t + e && v || i.size === 1 && (function(x, y, E) {
632
- const _ = y._nodeMap.get(x), N = E._nodeMap.get(x), b = y._selection, L = E._selection;
633
- return !(g(b) && g(L) && b.anchor.type === "element" && b.focus.type === "element" && L.anchor.type === "text" && L.focus.type === "text" || !R(_) || !R(N) || _.__parent !== N.__parent) && JSON.stringify(y.read((() => _.exportJSON()))) === JSON.stringify(E.read((() => N.exportJSON())));
634
- })(Array.from(i)[0], a, n) ? V : ie : w !== null ? V : le;
637
+ const l = i[0], u = r._nodeMap.get(l.__key);
638
+ if (!B(u) || !B(l) || u.__mode !== l.__mode) return 0;
639
+ const d = u.__text, f = l.__text;
640
+ if (d === f) return 0;
641
+ const h = a.anchor, S = s.anchor;
642
+ if (h.key !== S.key || h.type !== "text") return 0;
643
+ const v = h.offset, _ = S.offset, x = f.length - d.length;
644
+ return x === 1 && _ === v - 1 ? 2 : x === -1 && _ === v + 1 ? 3 : x === -1 && _ === v ? 4 : 0;
645
+ }
646
+ function ln(r, t) {
647
+ let e = Date.now(), n = 0;
648
+ return (o, a, s, i, l, u) => {
649
+ const d = Date.now();
650
+ if (u.has(te)) return n = 0, e = d, 2;
651
+ const f = sn(o, a, i, l, r.isComposing()), h = (() => {
652
+ const S = s === null || s.editor === r, v = u.has(Rt);
653
+ if (!v && S && u.has(re)) return 0;
654
+ if (o === null) return 1;
655
+ const _ = a._selection;
656
+ if (!(i.size > 0 || l.size > 0)) return _ !== null ? 0 : 2;
657
+ const x = typeof t == "number" ? t : t.peek();
658
+ return v === !1 && f !== 0 && f === n && d < e + x && S || i.size === 1 && (function(w, y, N) {
659
+ const k = y._nodeMap.get(w), b = N._nodeMap.get(w), L = y._selection, C = N._selection;
660
+ return !(g(L) && g(C) && L.anchor.type === "element" && L.focus.type === "element" && C.anchor.type === "text" && C.focus.type === "text" || !B(k) || !B(b) || k.__parent !== b.__parent) && JSON.stringify(y.read(() => k.exportJSON())) === JSON.stringify(N.read(() => b.exportJSON()));
661
+ })(Array.from(i)[0], o, a) ? 0 : 1;
635
662
  })();
636
- return t = u, o = d, f;
663
+ return e = d, n = f, h;
637
664
  };
638
665
  }
639
- function Pe(r) {
666
+ function Ne(r) {
640
667
  r.undoStack = [], r.redoStack = [], r.current = null;
641
668
  }
642
- function Zr(r, e, t) {
643
- const o = Qr(r, t);
644
- return F(r.registerCommand(zt, (() => ((function(n, s) {
669
+ function Ue(r, t, e) {
670
+ const n = ln(r, e);
671
+ return U(r.registerCommand(Mt, () => ((function(a, s) {
645
672
  const i = s.redoStack, l = s.undoStack;
646
673
  if (l.length !== 0) {
647
- const c = s.current, u = l.pop();
648
- c !== null && (i.push(c), n.dispatchCommand(W, !0)), l.length === 0 && n.dispatchCommand(Y, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: oe });
674
+ const u = s.current, d = l.pop();
675
+ u !== null && (i.push(u), a.dispatchCommand(W, !0)), l.length === 0 && a.dispatchCommand(J, !1), s.current = d || null, d && d.editor.setEditorState(d.editorState, { tag: te });
649
676
  }
650
- })(r, e), !0)), m), r.registerCommand(Ot, (() => ((function(n, s) {
677
+ })(r, t), !0), c), r.registerCommand(Bt, () => ((function(a, s) {
651
678
  const i = s.redoStack, l = s.undoStack;
652
679
  if (i.length !== 0) {
653
- const c = s.current;
654
- c !== null && (l.push(c), n.dispatchCommand(Y, !0));
655
- const u = i.pop();
656
- i.length === 0 && n.dispatchCommand(W, !1), s.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: oe });
680
+ const u = s.current;
681
+ u !== null && (l.push(u), a.dispatchCommand(J, !0));
682
+ const d = i.pop();
683
+ i.length === 0 && a.dispatchCommand(W, !1), s.current = d || null, d && d.editor.setEditorState(d.editorState, { tag: te });
657
684
  }
658
- })(r, e), !0)), m), r.registerCommand(Kt, (() => (Pe(e), !1)), m), r.registerCommand(Mt, (() => (Pe(e), r.dispatchCommand(W, !1), r.dispatchCommand(Y, !1), !0)), m), r.registerUpdateListener((({ editorState: n, prevEditorState: s, dirtyLeaves: i, dirtyElements: l, tags: c }) => {
659
- const u = e.current, d = e.redoStack, f = e.undoStack, v = u === null ? null : u.editorState;
660
- if (u !== null && n === v) return;
661
- const C = o(s, n, u, i, l, c);
662
- if (C === ie) d.length !== 0 && (e.redoStack = [], r.dispatchCommand(W, !1)), u !== null && (f.push({ ...u }), r.dispatchCommand(Y, !0));
663
- else if (C === le) return;
664
- e.current = { editor: r, editorState: n };
665
- })));
666
- }
667
- function en() {
685
+ })(r, t), !0), c), r.registerCommand($t, () => (Ne(t), !1), c), r.registerCommand(Pt, () => (Ne(t), r.dispatchCommand(W, !1), r.dispatchCommand(J, !1), !0), c), r.registerUpdateListener(({ editorState: a, prevEditorState: s, dirtyLeaves: i, dirtyElements: l, tags: u }) => {
686
+ const d = t.current, f = t.redoStack, h = t.undoStack, S = d === null ? null : d.editorState;
687
+ if (d !== null && a === S) return;
688
+ const v = n(s, a, d, i, l, u);
689
+ if (v === 1) f.length !== 0 && (t.redoStack = [], r.dispatchCommand(W, !1)), d !== null && (h.push({ ...d }), r.dispatchCommand(J, !0));
690
+ else if (v === 2) return;
691
+ t.current = { editor: r, editorState: a };
692
+ }));
693
+ }
694
+ function He() {
668
695
  return { current: null, redoStack: [], undoStack: [] };
669
696
  }
670
- function tn({ delay: r, externalHistoryState: e }) {
671
- const [t] = I();
672
- return (function(o, a, n = 1e3) {
673
- const s = Q((() => a || en()), [a]);
674
- k((() => Zr(o, s, n)), [n, o, s]);
675
- })(t, e, r), null;
676
- }
677
- function rn({ hasCellMerge: r = !0, hasCellBackgroundColor: e = !0, hasTabHandler: t = !0, hasHorizontalScroll: o = !1 }) {
678
- const [a] = I();
679
- return k((() => {
680
- er(a) !== o && (tr(a, o), a.registerNodeTransform(je, (() => {
681
- }))());
682
- }), [a, o]), k((() => rr(a)), [a]), k((() => nr(a, t)), [a, t]), k((() => {
683
- if (!r) return or(a);
684
- }), [a, r]), k((() => {
685
- if (!e) return a.registerNodeTransform(He, ((n) => {
686
- n.getBackgroundColor() !== null && n.setBackgroundColor(null);
687
- }));
688
- }), [a, e, r]), null;
689
- }
690
- const qe = 200, nn = ({
697
+ const Q = ne({ build: (r, { delay: t, createInitialHistoryState: e, disabled: n }) => ae({ delay: t, disabled: n, historyState: e(r) }), config: At({ createInitialHistoryState: He, delay: 300, disabled: typeof window > "u" }), name: "@lexical/history/History", register: (r, t, e) => {
698
+ const n = e.getOutput();
699
+ return Me(() => n.disabled.value ? void 0 : Ue(r, n.historyState.value, n.delay));
700
+ } });
701
+ ne({ dependencies: [It(Q, { createInitialHistoryState: () => {
702
+ throw new Error("SharedHistory did not inherit parent history");
703
+ }, disabled: !0 })], name: "@lexical/history/SharedHistory", register(r, t, e) {
704
+ const { output: n } = e.getDependency(Q), o = (function(s) {
705
+ return s ? qt(s, Q.name) : null;
706
+ })(r._parentEditor);
707
+ if (!o) return () => {
708
+ };
709
+ const a = o.output;
710
+ return Me(() => Gt(() => {
711
+ n.delay.value = a.delay.value, n.historyState.value = a.historyState.value, n.disabled.value = a.disabled.value;
712
+ }));
713
+ } });
714
+ function dn({ delay: r, externalHistoryState: t }) {
715
+ const [e] = D();
716
+ return (function(n, o, a = 1e3) {
717
+ const s = X(() => o || He(), [o]);
718
+ E(() => Ue(n, s, a), [a, n, s]);
719
+ })(e, t, r), null;
720
+ }
721
+ function un({ hasCellMerge: r = !0, hasCellBackgroundColor: t = !0, hasTabHandler: e = !0, hasHorizontalScroll: n = !1 }) {
722
+ const [o] = D();
723
+ return E(() => {
724
+ or(o) !== n && (ar(o, n), o.registerNodeTransform(Ae, () => {
725
+ })());
726
+ }, [o, n]), E(() => sr(o), [o]), E(() => ir(o, e), [o, e]), E(() => {
727
+ if (!r) return lr(o);
728
+ }, [o, r]), E(() => {
729
+ if (!t) return o.registerNodeTransform(Ke, (a) => {
730
+ a.getBackgroundColor() !== null && a.setBackgroundColor(null);
731
+ });
732
+ }, [o, t, r]), null;
733
+ }
734
+ const We = 200, cn = ({
691
735
  currentLanguage: r = "NL",
692
- initialValue: e = "",
693
- placeholder: t = "",
694
- label: o = "",
695
- info: a = "",
696
- required: n = !1,
736
+ initialValue: t = "",
737
+ placeholder: e = "",
738
+ label: n = "",
739
+ info: o = "",
740
+ required: a = !1,
697
741
  notValidatedText: s = "",
698
742
  maxHeightInRem: i = "20rem",
699
- maxWords: l = qe,
700
- onChange: c
743
+ maxWords: l = We,
744
+ onChange: u
701
745
  }) => {
702
- const { switchLanguage: u } = Er(), d = pr(), [f] = K(() => Ie()), [v, C] = K(0), [w, x] = K(0), y = Ut(null), E = {
746
+ const { switchLanguage: d } = Sr(), f = vr(), [h] = R(() => Le()), [S, v] = R(0), [_, x] = R(0), w = Ut(null), y = {
703
747
  html: {
704
748
  export: cr
705
749
  },
706
750
  namespace: "UvaRte",
707
- editor: f,
708
- theme: vr,
751
+ editor: h,
752
+ theme: br,
709
753
  onError(b) {
710
754
  throw b;
711
755
  },
712
- nodes: [Fe, Be, Ue, Zt, He, ar, je, wr],
756
+ nodes: [Re, Ie, $e, Be, Ke, dr, Ae, xr],
713
757
  editorState: (b) => {
714
- const S = new DOMParser().parseFromString(e, "text/html"), T = qt(b, S);
715
- A().clear(), console.log(T), ze(T);
758
+ const C = new DOMParser().parseFromString(t, "text/html"), P = er(b, C);
759
+ A().clear(), console.log(P), Te(P);
716
760
  }
717
- }, _ = (b) => b.trim().length === 0 ? 0 : b.split(" ").length, N = (b, L) => {
761
+ }, N = (b) => b.trim().length === 0 ? 0 : b.split(" ").length, k = (b, L) => {
718
762
  b.read(() => {
719
- let S = "";
720
- C(_(A().getTextContent().replace(/\s+/g, " ").trim())), S = dr(Xt(L)), S = fr(S), c(S);
763
+ let C = "";
764
+ v(N(A().getTextContent().replace(/\s+/g, " ").trim())), C = fr(tr(L)), C = mr(C), u(C);
721
765
  });
722
766
  };
723
- return k(() => {
724
- u(r.toLocaleLowerCase());
725
- }, [r, u]), k(() => {
726
- const b = e.replace(/<br\s*\/?>|&nbsp;/gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
727
- C(_(b));
728
- }, []), /* @__PURE__ */ O("div", { className: P.editor__container, children: [
729
- /* @__PURE__ */ O("div", { className: P.editor__header, children: [
730
- /* @__PURE__ */ h(Cr, { label: o, info: a, required: n }),
731
- /* @__PURE__ */ O("div", { className: P["editor__header-word-count"], children: [
732
- /* @__PURE__ */ h("span", { className: ur({ [P["editor__header-word-count--alert"]]: v > l }), children: v }),
767
+ return E(() => {
768
+ d(r.toLocaleLowerCase());
769
+ }, [r, d]), E(() => {
770
+ const b = t.replace(/<br\s*\/?>|&nbsp;/gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
771
+ v(N(b));
772
+ }, []), /* @__PURE__ */ I("div", { className: $.editor__container, children: [
773
+ /* @__PURE__ */ I("div", { className: $.editor__header, children: [
774
+ /* @__PURE__ */ m(Er, { label: n, info: o, required: a }),
775
+ /* @__PURE__ */ I("div", { className: $["editor__header-word-count"], children: [
776
+ /* @__PURE__ */ m("span", { className: ur({ [$["editor__header-word-count--alert"]]: S > l }), children: S }),
733
777
  " / ",
734
778
  l
735
779
  ] })
736
780
  ] }),
737
- /* @__PURE__ */ h("div", { className: P.editor, children: /* @__PURE__ */ O(_r, { initialConfig: E, children: [
738
- /* @__PURE__ */ h(mr, { editorScrollPosition: w }),
739
- /* @__PURE__ */ O("div", { className: P["editor__field-wrapper"], children: [
740
- /* @__PURE__ */ h(
741
- Ir,
781
+ /* @__PURE__ */ m("div", { className: $.editor, children: /* @__PURE__ */ I(_r, { initialConfig: y, children: [
782
+ /* @__PURE__ */ m(hr, { editorScrollPosition: _ }),
783
+ /* @__PURE__ */ I("div", { className: $["editor__field-wrapper"], children: [
784
+ /* @__PURE__ */ m(
785
+ Ur,
742
786
  {
743
- contentEditable: /* @__PURE__ */ h(
744
- zr,
787
+ contentEditable: /* @__PURE__ */ m(
788
+ Yr,
745
789
  {
746
- className: P.editor__field,
747
- "aria-label": d.common.rteAriaLabel,
748
- "aria-placeholder": t,
749
- title: d.common.rteTitle,
750
- placeholder: /* @__PURE__ */ h("div", { className: P.editor__placeholder, children: t }),
790
+ className: $.editor__field,
791
+ "aria-label": f.common.rteAriaLabel,
792
+ "aria-placeholder": e,
793
+ title: f.common.rteTitle,
794
+ placeholder: /* @__PURE__ */ m("div", { className: $.editor__placeholder, children: e }),
751
795
  spellCheck: !1,
752
796
  id: "rteEditor",
753
797
  style: { height: `${i}`, maxHeight: `${i}` },
754
798
  onScroll: (b) => x(b.currentTarget.scrollTop),
755
- ref: y
799
+ ref: w
756
800
  }
757
801
  ),
758
- placeholder: /* @__PURE__ */ h("div", { className: P.editor__placeholder, children: t }),
759
- ErrorBoundary: Ur
802
+ placeholder: /* @__PURE__ */ m("div", { className: $.editor__placeholder, children: e }),
803
+ ErrorBoundary: Zr
760
804
  }
761
805
  ),
762
- /* @__PURE__ */ h(rn, {}),
763
- /* @__PURE__ */ h(Ht, {}),
764
- /* @__PURE__ */ h(tn, {}),
765
- /* @__PURE__ */ h(Jr, {}),
766
- /* @__PURE__ */ h(Wr, { validateUrl: sr }),
767
- /* @__PURE__ */ h(ir, { matchers: lr }),
768
- /* @__PURE__ */ h(Yr, {}),
769
- /* @__PURE__ */ h(Hr, { onChange: N }),
770
- /* @__PURE__ */ h(hr, {})
806
+ /* @__PURE__ */ m(un, {}),
807
+ /* @__PURE__ */ m(Wt, {}),
808
+ /* @__PURE__ */ m(dn, {}),
809
+ /* @__PURE__ */ m(tn, {}),
810
+ /* @__PURE__ */ m(rn, { validateUrl: pr }),
811
+ /* @__PURE__ */ m(on, { matchers: gr }),
812
+ /* @__PURE__ */ m(an, {}),
813
+ /* @__PURE__ */ m(en, { onChange: k }),
814
+ /* @__PURE__ */ m(Cr, {})
771
815
  ] })
772
816
  ] }) }),
773
- s !== "" && /* @__PURE__ */ h(gr, { level: "error", feedback: s })
817
+ s !== "" && /* @__PURE__ */ m(yr, { level: "error", feedback: s })
774
818
  ] });
775
- }, Qn = ({
819
+ }, ao = ({
776
820
  currentLanguage: r = "NL",
777
- initialValue: e = "",
778
- placeholder: t = "",
779
- label: o = "",
780
- info: a = "",
781
- required: n = !1,
821
+ initialValue: t = "",
822
+ placeholder: e = "",
823
+ label: n = "",
824
+ info: o = "",
825
+ required: a = !1,
782
826
  notValidatedText: s = "",
783
- maxWords: i = qe,
827
+ maxWords: i = We,
784
828
  onChange: l
785
- }) => /* @__PURE__ */ h(yr, { children: /* @__PURE__ */ h(
786
- nn,
829
+ }) => /* @__PURE__ */ m(wr, { children: /* @__PURE__ */ m(
830
+ cn,
787
831
  {
788
832
  currentLanguage: r,
789
- initialValue: e,
790
- placeholder: t,
791
- label: o,
792
- info: a,
793
- required: n,
833
+ initialValue: t,
834
+ placeholder: e,
835
+ label: n,
836
+ info: o,
837
+ required: a,
794
838
  notValidatedText: s,
795
839
  maxWords: i,
796
840
  onChange: l
797
841
  }
798
842
  ) });
799
843
  export {
800
- nn as Rte,
801
- Qn as RteEditor
844
+ cn as Rte,
845
+ ao as RteEditor
802
846
  };
803
847
  //# sourceMappingURL=RteEditor.js.map