@uva-glass/component-library 2.6.1 → 2.6.3

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 (126) hide show
  1. package/dist/Lexical.prod-sR6tW7N6.js +4236 -0
  2. package/dist/Lexical.prod-sR6tW7N6.js.map +1 -0
  3. package/dist/LexicalClipboard.prod-BbRoaXo6.js +258 -0
  4. package/dist/LexicalClipboard.prod-BbRoaXo6.js.map +1 -0
  5. package/dist/{LexicalComposerContext.prod-Dyvim1tK.js → LexicalComposerContext.prod-DxxjdrXB.js} +2 -2
  6. package/dist/{LexicalComposerContext.prod-Dyvim1tK.js.map → LexicalComposerContext.prod-DxxjdrXB.js.map} +1 -1
  7. package/dist/LexicalLink.prod-iDKxtfCF.js +263 -0
  8. package/dist/LexicalLink.prod-iDKxtfCF.js.map +1 -0
  9. package/dist/LexicalList.prod-ywkx7SnO.js +576 -0
  10. package/dist/LexicalList.prod-ywkx7SnO.js.map +1 -0
  11. package/dist/LexicalSelection.prod-mYXylG1z.js +86 -0
  12. package/dist/LexicalSelection.prod-mYXylG1z.js.map +1 -0
  13. package/dist/LexicalTable.prod-XN7avk7R.js +1447 -0
  14. package/dist/LexicalTable.prod-XN7avk7R.js.map +1 -0
  15. package/dist/LexicalUtils.prod-DnFLi0Ww.js +122 -0
  16. package/dist/LexicalUtils.prod-DnFLi0Ww.js.map +1 -0
  17. package/dist/{SortableProvider-BUsvniX7.js → SortableProvider-RaH_ZXB3.js} +20 -20
  18. package/dist/{SortableProvider-BUsvniX7.js.map → SortableProvider-RaH_ZXB3.js.map} +1 -1
  19. package/dist/{TablePlugin-E6UFlCgy.js → TablePlugin-5Cs2F_co.js} +75 -74
  20. package/dist/{TablePlugin-E6UFlCgy.js.map → TablePlugin-5Cs2F_co.js.map} +1 -1
  21. package/dist/components/Buttons/Button.stories.js +1 -1
  22. package/dist/components/Buttons/LinkButton.stories.js +1 -1
  23. package/dist/components/Buttons/MenuButton.stories.js +1 -1
  24. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  25. package/dist/components/Checkbox/Checkbox.js +6 -5
  26. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  27. package/dist/components/Checkbox/Checkbox.stories.js +1 -1
  28. package/dist/components/CheckboxButton/CheckboxButton.stories.js +1 -1
  29. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
  30. package/dist/components/CheckboxTree/CheckboxTree.d.ts +2 -2
  31. package/dist/components/CheckboxTree/CheckboxTree.js +110 -74
  32. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  33. package/dist/components/CheckboxTree/CheckboxTree.stories.d.ts +2 -1
  34. package/dist/components/CheckboxTree/CheckboxTree.stories.js +121 -31
  35. package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
  36. package/dist/components/Chip/Chip.stories.js +1 -1
  37. package/dist/components/Drawer/Drawer.stories.js +1 -1
  38. package/dist/components/FormInput/FormInput.js +14 -13
  39. package/dist/components/FormInput/FormInput.js.map +1 -1
  40. package/dist/components/FormInput/FormInput.stories.js +1 -1
  41. package/dist/components/IconButton/IconButton.stories.js +1 -1
  42. package/dist/components/InputField/InputField.js +17 -17
  43. package/dist/components/InputField/InputField.stories.js +17 -16
  44. package/dist/components/InputField/InputField.stories.js.map +1 -1
  45. package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
  46. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  47. package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
  48. package/dist/components/MultiSelect/components/MultiSelectHeader.js +5 -4
  49. package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
  50. package/dist/components/MultiSelect/index.js +1 -1
  51. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +4 -4
  52. package/dist/components/OverlayStepBar/OverlayStepBar.js +13 -12
  53. package/dist/components/OverlayStepBar/OverlayStepBar.js.map +1 -1
  54. package/dist/components/PeriodSelector/PeriodSelector.js +15 -14
  55. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
  56. package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
  57. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +11 -10
  58. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  59. package/dist/components/RadioButton/RadioButton.js +3 -3
  60. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +6 -5
  61. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  62. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +4 -4
  63. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +15 -14
  64. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  65. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +6 -5
  66. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
  67. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  68. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +43 -42
  69. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  70. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  71. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +42 -42
  72. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +15 -15
  73. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +5 -4
  74. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
  75. package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +1 -1
  76. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +8 -7
  77. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  78. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +29 -29
  79. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  80. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +18 -18
  81. package/dist/components/RteEditor/Plugins/index.js +1 -1
  82. package/dist/components/RteEditor/Providers/LanguageProvider.js +7 -7
  83. package/dist/components/RteEditor/RteEditor.js +608 -663
  84. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  85. package/dist/components/RteEditor/helpers.js +11 -11
  86. package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
  87. package/dist/components/SelectListbox/SelectProvider.js +10 -10
  88. package/dist/components/Sortable/Sortable.js +1 -1
  89. package/dist/components/Sortable/Sortable.stories.js +7 -7
  90. package/dist/components/Sortable/SortableProvider.js +1 -1
  91. package/dist/components/Sortable/components/SortableContainer.js +1 -1
  92. package/dist/components/Sortable/components/SortableItem.js +15 -15
  93. package/dist/components/Sortable/sortableReducer.js +21 -21
  94. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +5 -5
  95. package/dist/components/Tooltip/Tooltip.js +22 -22
  96. package/dist/components/index.js +1 -1
  97. package/dist/{helpers-BVGma1u6.js → helpers-BpqX-Lj3.js} +32 -32
  98. package/dist/helpers-BpqX-Lj3.js.map +1 -0
  99. package/dist/{index-0wq-B7do.js → index-B3c5pcHk.js} +22 -22
  100. package/dist/{index-0wq-B7do.js.map → index-B3c5pcHk.js.map} +1 -1
  101. package/dist/{index-B9BWML6P.js → index-BpZ8v2ye.js} +7088 -7092
  102. package/dist/{index-B9BWML6P.js.map → index-BpZ8v2ye.js.map} +1 -1
  103. package/dist/index-CHX1d9_A.js +21922 -0
  104. package/dist/{index-DWzkl4aY.js.map → index-CHX1d9_A.js.map} +1 -1
  105. package/dist/index.js +1 -1
  106. package/dist/{react-18-BIqxBxbW.js → react-18-CT6mjea2.js} +2 -2
  107. package/dist/{react-18-BIqxBxbW.js.map → react-18-CT6mjea2.js.map} +1 -1
  108. package/dist/storybook__react.d.js +510 -510
  109. package/dist/storybook__react.d.js.map +1 -1
  110. package/package.json +14 -14
  111. package/dist/Lexical.prod-Bzma_w4s.js +0 -4216
  112. package/dist/Lexical.prod-Bzma_w4s.js.map +0 -1
  113. package/dist/LexicalClipboard.prod-Dg23ixPD.js +0 -258
  114. package/dist/LexicalClipboard.prod-Dg23ixPD.js.map +0 -1
  115. package/dist/LexicalLink.prod-C1RDJLfo.js +0 -208
  116. package/dist/LexicalLink.prod-C1RDJLfo.js.map +0 -1
  117. package/dist/LexicalList.prod-BGzfDPU0.js +0 -568
  118. package/dist/LexicalList.prod-BGzfDPU0.js.map +0 -1
  119. package/dist/LexicalSelection.prod-CNWFGVlh.js +0 -86
  120. package/dist/LexicalSelection.prod-CNWFGVlh.js.map +0 -1
  121. package/dist/LexicalTable.prod-D-4NN9o5.js +0 -1366
  122. package/dist/LexicalTable.prod-D-4NN9o5.js.map +0 -1
  123. package/dist/LexicalUtils.prod-Cg2siy-c.js +0 -94
  124. package/dist/LexicalUtils.prod-Cg2siy-c.js.map +0 -1
  125. package/dist/helpers-BVGma1u6.js.map +0 -1
  126. package/dist/index-DWzkl4aY.js +0 -21915
@@ -1,32 +1,33 @@
1
- import { jsx as y, jsxs as F, Fragment as Ke } from "react/jsx-runtime";
2
- import { l as Ze, o as Ge, u as R } from "../../LexicalComposerContext.prod-Dyvim1tK.js";
3
- import { ao as Fe, u as z, z as me, R as v, E as W, b as J, W as Qe, h as P, a as C, a0 as Ae, ap as et, a6 as g, B as tt, an as K, al as nt, aq as rt, ar as ot, as as it, f as ie, at as st, au as at, A as lt, V as ct, F as dt, l as ut, av as ft, aw as ge, o as he, M as mt, J as se, L as pt, a4 as ze, ax as ve, y as gt, x as ht, S as vt, a3 as Ce, w as Ct, ay as yt, az as Et, aA as wt, aj as bt, O as St, m as $t, aB as _t, n as xt, H as kt, D as Nt, a7 as Lt, e as Dt, K as ye, aC as Pt, C as Rt, a9 as Y, a8 as Z, aD as Tt, aE as Mt, ab as Ot, aa as It } from "../../Lexical.prod-Bzma_w4s.js";
4
- import * as ae from "react";
5
- import { useMemo as q, useLayoutEffect as H, useEffect as x, useState as O, useRef as Be, Suspense as Kt, forwardRef as Ue, useCallback as Ft } from "react";
6
- import { N as B, u as A, n as At, o as pe, i as zt, d as Bt } from "../../LexicalUtils.prod-Cg2siy-c.js";
7
- import { r as Ut } from "../../index-B9BWML6P.js";
8
- import { N as Ee, O as we, h as Ht, m as jt } from "../../LexicalClipboard.prod-Dg23ixPD.js";
9
- import { L as be, $ as Se } from "../../LexicalSelection.prod-CNWFGVlh.js";
10
- import { J as He, I as je, Z as Wt } from "../../LexicalList.prod-BGzfDPU0.js";
11
- import { a as We, U as $e, m as le, g as Jt, f as qt } from "../../LexicalLink.prod-C1RDJLfo.js";
12
- import { k as Vt, K as re, r as oe, f as Je, P as Xt, s as _e, c as Yt, S as Zt, X as Gt, B as Qt, H as en, C as xe, i as tn, V as nn, n as rn } from "../../LexicalTable.prod-D-4NN9o5.js";
13
- import { a as on, F as sn, M as an } from "../../helpers-BVGma1u6.js";
14
- import { c as ln } from "../../clsx-OuTLNxxd.js";
15
- import { exportMap as cn, isStartingWithHtmlTag as dn, mergeBoldStrongTags as un } from "./helpers.js";
16
- import { s as M } from "../../RteEditor.module-oFMKEW6f.js";
17
- import { ToolBarPlugin as fn } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
18
- import { useTranslation as mn } from "./hooks/useTranslation.js";
19
- import "../../TablePlugin-E6UFlCgy.js";
1
+ import { jsx as h, jsxs as K, Fragment as Te } from "react/jsx-runtime";
2
+ import { l as Je, o as Xe, u as P } from "../../LexicalComposerContext.prod-DxxjdrXB.js";
3
+ import { ap as Re, a2 as A, V as Me, H as p, I as H, L as V, j as Ge, v as M, a as g, N as Ye, f as m, aq as Ze, a1 as Ie, F as Oe, ar as Qe, B as et, ao as F, am as tt, as as nt, at as rt, au as ot, d as ne, av as at, aw as st, w as it, i as lt, M as ut, k as ct, ax as dt, ay as fe, o as me, U as ft, R as re, T as mt, a6 as Fe, az as pe, D as pt, C as gt, S as ht, a5 as ge, z as Ct, aA as yt, aB as Et, aC as vt, ak as wt, m as bt, l as $t, aD as St, p as _t, K as kt, G as xt, a8 as Nt, e as Lt, q as he, aE as Dt, E as Pt, aa as G, a9 as Y, aF as Tt, aG as Rt, ac as Mt, ab as It } from "../../Lexical.prod-sR6tW7N6.js";
4
+ import * as oe from "react";
5
+ import { useMemo as W, useLayoutEffect as j, useEffect as _, useState as I, useRef as Ke, Suspense as Ot, forwardRef as ze, useCallback as Ft } from "react";
6
+ import { N as U, c as z, o as Kt, r as de } from "../../LexicalUtils.prod-DnFLi0Ww.js";
7
+ import { r as zt } from "../../index-BpZ8v2ye.js";
8
+ import { N as Ce, O as ye, h as At, m as Bt } from "../../LexicalClipboard.prod-BbRoaXo6.js";
9
+ import { M as Ee, j as ve } from "../../LexicalSelection.prod-mYXylG1z.js";
10
+ import { V as Ae, I as Be, Z as jt } from "../../LexicalList.prod-ywkx7SnO.js";
11
+ import { f as je, N as we, x as ae, m as Ut, O as qt } from "../../LexicalLink.prod-iDKxtfCF.js";
12
+ import { a as Ht, j as Vt, X as Wt, q as Jt, u as Ue, S as Xt, P as Gt } from "../../LexicalTable.prod-XN7avk7R.js";
13
+ import { a as Yt, F as Zt, M as Qt } from "../../helpers-BpqX-Lj3.js";
14
+ import { c as en } from "../../clsx-OuTLNxxd.js";
15
+ import { exportMap as tn, isStartingWithHtmlTag as nn, mergeBoldStrongTags as rn } from "./helpers.js";
16
+ import { s as R } from "../../RteEditor.module-oFMKEW6f.js";
17
+ import { ToolBarPlugin as on } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
18
+ import { useTranslation as an } from "./hooks/useTranslation.js";
19
+ import "../../TablePlugin-5Cs2F_co.js";
20
20
  import "./Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js";
21
21
  import "./hooks/components/Flyout.js";
22
22
  import "../Buttons/Button.js";
23
23
  import "../Buttons/LinkButton.js";
24
24
  import "@react-aria/button";
25
+ import "../Checkbox/Checkbox.js";
25
26
  import "@react-aria/dialog";
26
27
  import "@react-aria/focus";
27
28
  import "@react-aria/overlays";
28
29
  import "../OverlayCloseButton/OverlayCloseButton.js";
29
- import { FeedbackBox as pn } from "../FeedbackBox/FeedbackBox.js";
30
+ import { FeedbackBox as sn } from "../FeedbackBox/FeedbackBox.js";
30
31
  import "../GridRow/GridRow.js";
31
32
  import "../IconButton/IconButton.js";
32
33
  import "../Input/Input.js";
@@ -35,107 +36,107 @@ import "react-router";
35
36
  import "../SelectListbox/SelectListbox.js";
36
37
  import "../SelectListbox/SelectProvider.js";
37
38
  import "../Sortable/components/SortableItem.js";
38
- import "../../SortableProvider-BUsvniX7.js";
39
- import { UvaTheme as gn } from "./UvaTheme/UvaTheme.js";
40
- import { EditorHeader as hn } from "./EditorHeader/EditorHeader.js";
41
- import { useLanguage as vn, LanguageProvider as Cn } from "./Providers/LanguageProvider.js";
42
- import { PasteHandlerPlugin as yn } from "./Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js";
43
- const qe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, En = qe ? H : x, G = { tag: "history-merge" };
44
- function wn({ initialConfig: t, children: e }) {
45
- const n = q(() => {
46
- const { theme: o, namespace: i, nodes: r, onError: s, editorState: a, html: l } = t, c = Ge(null, o), d = Fe({ editable: t.editable, html: l, namespace: i, nodes: r, onError: (f) => s(f, d), theme: o });
47
- return function(f, u) {
48
- if (u !== null) {
49
- if (u === void 0) f.update(() => {
50
- const m = z();
51
- if (m.isEmpty()) {
52
- const p = me();
53
- m.append(p);
54
- const E = qe ? document.activeElement : null;
55
- (v() !== null || E !== null && E === f.getRootElement()) && p.select();
39
+ import "../../SortableProvider-RaH_ZXB3.js";
40
+ import { UvaTheme as ln } from "./UvaTheme/UvaTheme.js";
41
+ import { EditorHeader as un } from "./EditorHeader/EditorHeader.js";
42
+ import { useLanguage as cn, LanguageProvider as dn } from "./Providers/LanguageProvider.js";
43
+ import { PasteHandlerPlugin as fn } from "./Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js";
44
+ const qe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, mn = qe ? j : _, Z = { tag: "history-merge" };
45
+ function pn({ initialConfig: n, children: e }) {
46
+ const t = W(() => {
47
+ const { theme: o, namespace: a, nodes: r, onError: s, editorState: i, html: l } = n, u = Xe(null, o), c = Re({ editable: n.editable, html: l, namespace: a, nodes: r, onError: (d) => s(d, c), theme: o });
48
+ return function(d, f) {
49
+ if (f !== null) {
50
+ if (f === void 0) d.update(() => {
51
+ const C = A();
52
+ if (C.isEmpty()) {
53
+ const y = Me();
54
+ C.append(y);
55
+ const w = qe ? document.activeElement : null;
56
+ (p() !== null || w !== null && w === d.getRootElement()) && y.select();
56
57
  }
57
- }, G);
58
- else if (u !== null) switch (typeof u) {
58
+ }, Z);
59
+ else if (f !== null) switch (typeof f) {
59
60
  case "string": {
60
- const m = f.parseEditorState(u);
61
- f.setEditorState(m, G);
61
+ const C = d.parseEditorState(f);
62
+ d.setEditorState(C, Z);
62
63
  break;
63
64
  }
64
65
  case "object":
65
- f.setEditorState(u, G);
66
+ d.setEditorState(f, Z);
66
67
  break;
67
68
  case "function":
68
- f.update(() => {
69
- z().isEmpty() && u(f);
70
- }, G);
69
+ d.update(() => {
70
+ A().isEmpty() && f(d);
71
+ }, Z);
71
72
  }
72
73
  }
73
- }(d, a), [d, c];
74
+ }(c, i), [c, u];
74
75
  }, []);
75
- return En(() => {
76
- const o = t.editable, [i] = n;
77
- i.setEditable(o === void 0 || o);
78
- }, []), y(Ze.Provider, { value: n, children: e });
79
- }
80
- const bn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : x;
81
- function Sn(t) {
82
- return { initialValueFn: () => t.isEditable(), subscribe: (e) => t.registerEditableListener(e) };
83
- }
84
- function $n() {
85
- return function(t) {
86
- const [e] = R(), n = q(() => t(e), [e, t]), [o, i] = O(() => n.initialValueFn()), r = Be(o);
87
- return bn(() => {
88
- const { initialValueFn: s, subscribe: a } = n, l = s();
89
- return r.current !== l && (r.current = l, i(l)), a((c) => {
90
- r.current = c, i(c);
76
+ return mn(() => {
77
+ const o = n.editable, [a] = t;
78
+ a.setEditable(o === void 0 || o);
79
+ }, []), h(Je.Provider, { value: t, children: e });
80
+ }
81
+ const gn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
82
+ function hn(n) {
83
+ return { initialValueFn: () => n.isEditable(), subscribe: (e) => n.registerEditableListener(e) };
84
+ }
85
+ function Cn() {
86
+ return function(n) {
87
+ const [e] = P(), t = W(() => n(e), [e, n]), [o, a] = I(() => t.initialValueFn()), r = Ke(o);
88
+ return gn(() => {
89
+ const { initialValueFn: s, subscribe: i } = t, l = s();
90
+ return r.current !== l && (r.current = l, a(l)), i((u) => {
91
+ r.current = u, a(u);
91
92
  });
92
- }, [n, t]), o;
93
- }(Sn);
94
- }
95
- function _n() {
96
- return z().getTextContent();
97
- }
98
- function xn(t, e = !0) {
99
- if (t) return !1;
100
- let n = _n();
101
- return e && (n = n.trim()), n === "";
102
- }
103
- function kn(t) {
104
- if (!xn(t, !1)) return !1;
105
- const e = z().getChildren(), n = e.length;
106
- if (n > 1) return !1;
107
- for (let o = 0; o < n; o++) {
108
- const i = e[o];
109
- if (W(i)) return !1;
110
- if (J(i)) {
111
- if (!Qe(i) || i.__indent !== 0) return !1;
112
- const r = i.getChildren(), s = r.length;
113
- for (let a = 0; a < s; a++) {
93
+ }, [t, n]), o;
94
+ }(hn);
95
+ }
96
+ function yn() {
97
+ return A().getTextContent();
98
+ }
99
+ function En(n, e = !0) {
100
+ if (n) return !1;
101
+ let t = yn();
102
+ return e && (t = t.trim()), t === "";
103
+ }
104
+ function vn(n) {
105
+ if (!En(n, !1)) return !1;
106
+ const e = A().getChildren(), t = e.length;
107
+ if (t > 1) return !1;
108
+ for (let o = 0; o < t; o++) {
109
+ const a = e[o];
110
+ if (H(a)) return !1;
111
+ if (V(a)) {
112
+ if (!Ge(a) || a.__indent !== 0) return !1;
113
+ const r = a.getChildren(), s = r.length;
114
+ for (let i = 0; i < s; i++) {
114
115
  const l = r[o];
115
- if (!P(l)) return !1;
116
+ if (!M(l)) return !1;
116
117
  }
117
118
  }
118
119
  }
119
120
  return !0;
120
121
  }
121
- function Ve(t) {
122
- return () => kn(t);
122
+ function He(n) {
123
+ return () => vn(n);
123
124
  }
124
- function Nn(t) {
125
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
125
+ function wn(n) {
126
+ return n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
126
127
  }
127
- Nn(function(t) {
128
+ wn(function(n) {
128
129
  const e = new URLSearchParams();
129
- e.append("code", t);
130
- for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
131
- 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.`);
130
+ e.append("code", n);
131
+ for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
132
+ throw Error(`Minified Lexical error #${n}; 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.`);
132
133
  });
133
- var ke = Ut();
134
- function Ln(t) {
135
- const e = window.location.origin, n = (o) => {
134
+ var be = zt();
135
+ function bn(n) {
136
+ const e = window.location.origin, t = (o) => {
136
137
  if (o.origin !== e) return;
137
- const i = t.getRootElement();
138
- if (document.activeElement !== i) return;
138
+ const a = n.getRootElement();
139
+ if (document.activeElement !== a) return;
139
140
  const r = o.data;
140
141
  if (typeof r == "string") {
141
142
  let s;
@@ -145,20 +146,20 @@ function Ln(t) {
145
146
  return;
146
147
  }
147
148
  if (s && s.protocol === "nuanria_messaging" && s.type === "request") {
148
- const a = s.payload;
149
- if (a && a.functionId === "makeChanges") {
150
- const l = a.args;
149
+ const i = s.payload;
150
+ if (i && i.functionId === "makeChanges") {
151
+ const l = i.args;
151
152
  if (l) {
152
- const [c, d, f, u, m, p] = l;
153
- t.update(() => {
154
- const E = v();
155
- if (C(E)) {
156
- const w = E.anchor;
157
- let h = w.getNode(), b = 0, $ = 0;
158
- if (P(h) && c >= 0 && d >= 0 && (b = c, $ = c + d, E.setTextNodeRange(h, b, h, $)), b === $ && f === "" || (E.insertRawText(f), h = w.getNode()), P(h)) {
159
- b = u, $ = u + m;
160
- const k = h.getTextContentSize();
161
- b = b > k ? k : b, $ = $ > k ? k : $, E.setTextNodeRange(h, b, h, $);
153
+ const [u, c, d, f, C, y] = l;
154
+ n.update(() => {
155
+ const w = p();
156
+ if (g(w)) {
157
+ const k = w.anchor;
158
+ let E = k.getNode(), v = 0, $ = 0;
159
+ if (M(E) && u >= 0 && c >= 0 && (v = u, $ = u + c, w.setTextNodeRange(E, v, E, $)), v === $ && d === "" || (w.insertRawText(d), E = k.getNode()), M(E)) {
160
+ v = f, $ = f + C;
161
+ const x = E.getTextContentSize();
162
+ v = v > x ? x : v, $ = $ > x ? x : $, w.setTextNodeRange(E, v, E, $);
162
163
  }
163
164
  o.stopImmediatePropagation();
164
165
  }
@@ -168,708 +169,652 @@ function Ln(t) {
168
169
  }
169
170
  }
170
171
  };
171
- return window.addEventListener("message", n, !0), () => {
172
- window.removeEventListener("message", n, !0);
172
+ return window.addEventListener("message", t, !0), () => {
173
+ window.removeEventListener("message", t, !0);
173
174
  };
174
175
  }
175
- function Ne(t, e) {
176
+ function $e(n, e) {
176
177
  if (document.caretRangeFromPoint !== void 0) {
177
- const n = document.caretRangeFromPoint(t, e);
178
- return n === null ? null : { node: n.startContainer, offset: n.startOffset };
178
+ const t = document.caretRangeFromPoint(n, e);
179
+ return t === null ? null : { node: t.startContainer, offset: t.startOffset };
179
180
  }
180
181
  if (document.caretPositionFromPoint !== "undefined") {
181
- const n = document.caretPositionFromPoint(t, e);
182
- return n === null ? null : { node: n.offsetNode, offset: n.offset };
182
+ const t = document.caretPositionFromPoint(n, e);
183
+ return t === null ? null : { node: t.offsetNode, offset: t.offset };
183
184
  }
184
185
  return null;
185
186
  }
186
- const j = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Dn = j && "documentMode" in document ? document.documentMode : null, Pn = !(!j || !("InputEvent" in window) || Dn) && "getTargetRanges" in new window.InputEvent("input"), Rn = j && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Le = j && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Tn = j && /^(?=.*Chrome).*/i.test(navigator.userAgent), Mn = j && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Tn, De = Dt();
187
- function Q(t) {
187
+ const q = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, $n = q && "documentMode" in document ? document.documentMode : null, Sn = !(!q || !("InputEvent" in window) || $n) && "getTargetRanges" in new window.InputEvent("input"), _n = q && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Se = q && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, kn = q && /^(?=.*Chrome).*/i.test(navigator.userAgent), xn = q && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !kn, _e = Lt();
188
+ function Q(n) {
188
189
  let e = null;
189
- if (A(t, DragEvent) ? e = t.dataTransfer : A(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
190
- const n = e.types, o = n.includes("Files"), i = n.includes("text/html") || n.includes("text/plain");
191
- return [o, Array.from(e.files), i];
192
- }
193
- function Pe(t) {
194
- const e = v();
195
- if (!C(e)) return !1;
196
- const n = /* @__PURE__ */ new Set(), o = e.getNodes();
197
- for (let i = 0; i < o.length; i++) {
198
- const r = o[i], s = r.getKey();
199
- if (n.has(s)) continue;
200
- const a = pe(r, (c) => J(c) && !c.isInline());
201
- if (a === null) continue;
202
- const l = a.getKey();
203
- a.canIndent() && !n.has(l) && (n.add(l), t(a));
190
+ if (z(n, DragEvent) ? e = n.dataTransfer : z(n, ClipboardEvent) && (e = n.clipboardData), e === null) return [!1, [], !1];
191
+ const t = e.types, o = t.includes("Files"), a = t.includes("text/html") || t.includes("text/plain");
192
+ return [o, Array.from(e.files), a];
193
+ }
194
+ function ke(n) {
195
+ const e = p();
196
+ if (!g(e)) return !1;
197
+ const t = /* @__PURE__ */ new Set(), o = e.getNodes();
198
+ for (let a = 0; a < o.length; a++) {
199
+ const r = o[a], s = r.getKey();
200
+ if (t.has(s)) continue;
201
+ const i = de(r, (u) => V(u) && !u.isInline());
202
+ if (i === null) continue;
203
+ const l = i.getKey();
204
+ i.canIndent() && !t.has(l) && (t.add(l), n(i));
204
205
  }
205
- return n.size > 0;
206
- }
207
- function ee(t) {
208
- const e = ie(t);
209
- return W(e);
210
- }
211
- function On(t) {
212
- return B(t.registerCommand(Lt, (e) => {
213
- const n = v();
214
- return !!K(n) && (n.clear(), !0);
215
- }, 0), t.registerCommand(se, (e) => {
216
- const n = v();
217
- return !!C(n) && (n.deleteCharacter(e), !0);
218
- }, g), t.registerCommand(Nt, (e) => {
219
- const n = v();
220
- return !!C(n) && (n.deleteWord(e), !0);
221
- }, g), t.registerCommand(kt, (e) => {
222
- const n = v();
223
- return !!C(n) && (n.deleteLine(e), !0);
224
- }, g), t.registerCommand(xt, (e) => {
225
- const n = v();
226
- if (typeof e == "string") n !== null && n.insertText(e);
206
+ return t.size > 0;
207
+ }
208
+ function ee(n) {
209
+ const e = ne(n);
210
+ return H(e);
211
+ }
212
+ function se(n) {
213
+ for (const e of ["lowercase", "uppercase", "capitalize"]) n.hasFormat(e) && n.toggleFormat(e);
214
+ }
215
+ function Nn(n) {
216
+ return U(n.registerCommand(Nt, (e) => {
217
+ const t = p();
218
+ return !!F(t) && (t.clear(), !0);
219
+ }, 0), n.registerCommand(re, (e) => {
220
+ const t = p();
221
+ return !!g(t) && (t.deleteCharacter(e), !0);
222
+ }, m), n.registerCommand(xt, (e) => {
223
+ const t = p();
224
+ return !!g(t) && (t.deleteWord(e), !0);
225
+ }, m), n.registerCommand(kt, (e) => {
226
+ const t = p();
227
+ return !!g(t) && (t.deleteLine(e), !0);
228
+ }, m), n.registerCommand(_t, (e) => {
229
+ const t = p();
230
+ if (typeof e == "string") t !== null && t.insertText(e);
227
231
  else {
228
- if (n === null) return !1;
232
+ if (t === null) return !1;
229
233
  const o = e.dataTransfer;
230
- if (o != null) Ee(o, n, t);
231
- else if (C(n)) {
232
- const i = e.data;
233
- return i && n.insertText(i), !0;
234
+ if (o != null) Ce(o, t, n);
235
+ else if (g(t)) {
236
+ const a = e.data;
237
+ return a && t.insertText(a), !0;
234
238
  }
235
239
  }
236
240
  return !0;
237
- }, g), t.registerCommand(_t, () => {
238
- const e = v();
239
- return !!C(e) && (e.removeText(), !0);
240
- }, g), t.registerCommand($t, (e) => {
241
- const n = v();
242
- return !!C(n) && (n.formatText(e), !0);
243
- }, g), t.registerCommand(St, (e) => {
244
- const n = v();
245
- if (!C(n) && !K(n)) return !1;
246
- const o = n.getNodes();
247
- for (const i of o) {
248
- const r = pe(i, (s) => J(s) && !s.isInline());
241
+ }, m), n.registerCommand(St, () => {
242
+ const e = p();
243
+ return !!g(e) && (e.removeText(), !0);
244
+ }, m), n.registerCommand($t, (e) => {
245
+ const t = p();
246
+ return !!g(t) && (t.formatText(e), !0);
247
+ }, m), n.registerCommand(bt, (e) => {
248
+ const t = p();
249
+ if (!g(t) && !F(t)) return !1;
250
+ const o = t.getNodes();
251
+ for (const a of o) {
252
+ const r = de(a, (s) => V(s) && !s.isInline());
249
253
  r !== null && r.setFormat(e);
250
254
  }
251
255
  return !0;
252
- }, g), t.registerCommand(ge, (e) => {
253
- const n = v();
254
- return !!C(n) && (n.insertLineBreak(e), !0);
255
- }, g), t.registerCommand(he, () => {
256
- const e = v();
257
- return !!C(e) && (e.insertParagraph(), !0);
258
- }, g), t.registerCommand(Et, () => (wt([bt()]), !0), g), t.registerCommand(yt, () => Pe((e) => {
259
- const n = e.getIndent();
260
- e.setIndent(n + 1);
261
- }), g), t.registerCommand(ve, () => Pe((e) => {
262
- const n = e.getIndent();
263
- n > 0 && e.setIndent(n - 1);
264
- }), g), t.registerCommand(Ct, (e) => {
265
- const n = v();
266
- if (K(n) && !ee(e.target)) {
267
- const o = n.getNodes();
256
+ }, m), n.registerCommand(fe, (e) => {
257
+ const t = p();
258
+ return !!g(t) && (t.insertLineBreak(e), !0);
259
+ }, m), n.registerCommand(me, () => {
260
+ const e = p();
261
+ return !!g(e) && (e.insertParagraph(), !0);
262
+ }, m), n.registerCommand(Et, () => (vt([wt()]), !0), m), n.registerCommand(yt, () => ke((e) => {
263
+ const t = e.getIndent();
264
+ e.setIndent(t + 1);
265
+ }), m), n.registerCommand(pe, () => ke((e) => {
266
+ const t = e.getIndent();
267
+ t > 0 && e.setIndent(t - 1);
268
+ }), m), n.registerCommand(Ct, (e) => {
269
+ const t = p();
270
+ if (F(t) && !ee(e.target)) {
271
+ const o = t.getNodes();
268
272
  if (o.length > 0) return o[0].selectPrevious(), !0;
269
- } else if (C(n)) {
270
- const o = Ce(n.focus, !0);
271
- if (!e.shiftKey && W(o) && !o.isIsolated() && !o.isInline()) return o.selectPrevious(), e.preventDefault(), !0;
273
+ } else if (g(t)) {
274
+ const o = ge(t.focus, !0);
275
+ if (!e.shiftKey && H(o) && !o.isIsolated() && !o.isInline()) return o.selectPrevious(), e.preventDefault(), !0;
272
276
  }
273
277
  return !1;
274
- }, g), t.registerCommand(vt, (e) => {
275
- const n = v();
276
- if (K(n)) {
277
- const o = n.getNodes();
278
+ }, m), n.registerCommand(ht, (e) => {
279
+ const t = p();
280
+ if (F(t)) {
281
+ const o = t.getNodes();
278
282
  if (o.length > 0) return o[0].selectNext(0, 0), !0;
279
- } else if (C(n)) {
280
- if (function(i) {
281
- const r = i.focus;
282
- return r.key === "root" && r.offset === z().getChildrenSize();
283
- }(n)) return e.preventDefault(), !0;
284
- const o = Ce(n.focus, !1);
285
- if (!e.shiftKey && W(o) && !o.isIsolated() && !o.isInline()) return o.selectNext(), e.preventDefault(), !0;
283
+ } else if (g(t)) {
284
+ if (function(a) {
285
+ const r = a.focus;
286
+ return r.key === "root" && r.offset === A().getChildrenSize();
287
+ }(t)) return e.preventDefault(), !0;
288
+ const o = ge(t.focus, !1);
289
+ if (!e.shiftKey && H(o) && !o.isIsolated() && !o.isInline()) return o.selectNext(), e.preventDefault(), !0;
286
290
  }
287
291
  return !1;
288
- }, g), t.registerCommand(ht, (e) => {
289
- const n = v();
290
- if (K(n)) {
291
- const o = n.getNodes();
292
+ }, m), n.registerCommand(gt, (e) => {
293
+ const t = p();
294
+ if (F(t)) {
295
+ const o = t.getNodes();
292
296
  if (o.length > 0) return e.preventDefault(), o[0].selectPrevious(), !0;
293
297
  }
294
- if (!C(n)) return !1;
295
- if (be(n, !0)) {
298
+ if (!g(t)) return !1;
299
+ if (Ee(t, !0)) {
296
300
  const o = e.shiftKey;
297
- return e.preventDefault(), Se(n, o, !0), !0;
301
+ return e.preventDefault(), ve(t, o, !0), !0;
298
302
  }
299
303
  return !1;
300
- }, g), t.registerCommand(gt, (e) => {
301
- const n = v();
302
- if (K(n) && !ee(e.target)) {
303
- const i = n.getNodes();
304
- if (i.length > 0) return e.preventDefault(), i[0].selectNext(0, 0), !0;
304
+ }, m), n.registerCommand(pt, (e) => {
305
+ const t = p();
306
+ if (F(t) && !ee(e.target)) {
307
+ const a = t.getNodes();
308
+ if (a.length > 0) return e.preventDefault(), a[0].selectNext(0, 0), !0;
305
309
  }
306
- if (!C(n)) return !1;
310
+ if (!g(t)) return !1;
307
311
  const o = e.shiftKey;
308
- return !!be(n, !1) && (e.preventDefault(), Se(n, o, !1), !0);
309
- }, g), t.registerCommand(pt, (e) => {
312
+ return !!Ee(t, !1) && (e.preventDefault(), ve(t, o, !1), !0);
313
+ }, m), n.registerCommand(mt, (e) => {
310
314
  if (ee(e.target)) return !1;
311
- const n = v();
312
- if (!C(n)) return !1;
313
- const { anchor: o } = n, i = o.getNode();
314
- return n.isCollapsed() && o.offset === 0 && !ze(i) && At(i).getIndent() > 0 ? (e.preventDefault(), t.dispatchCommand(ve, void 0)) : (!Le || navigator.language !== "ko-KR") && (e.preventDefault(), t.dispatchCommand(se, !0));
315
- }, g), t.registerCommand(mt, (e) => {
315
+ const t = p();
316
+ if (!g(t)) return !1;
317
+ const { anchor: o } = t, a = o.getNode();
318
+ return t.isCollapsed() && o.offset === 0 && !Fe(a) && Kt(a).getIndent() > 0 ? (e.preventDefault(), n.dispatchCommand(pe, void 0)) : (!Se || navigator.language !== "ko-KR") && (e.preventDefault(), n.dispatchCommand(re, !0));
319
+ }, m), n.registerCommand(ft, (e) => {
316
320
  if (ee(e.target)) return !1;
317
- const n = v();
318
- return !!C(n) && (e.preventDefault(), t.dispatchCommand(se, !1));
319
- }, g), t.registerCommand(ft, (e) => {
320
- const n = v();
321
- if (!C(n)) return !1;
322
- if (e !== null) {
323
- if ((Le || Rn || Mn) && Pn) return !1;
324
- if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ge, !1);
321
+ const t = p();
322
+ return !!g(t) && (e.preventDefault(), n.dispatchCommand(re, !1));
323
+ }, m), n.registerCommand(dt, (e) => {
324
+ const t = p();
325
+ if (!g(t)) return !1;
326
+ if (se(t), e !== null) {
327
+ if ((Se || _n || xn) && Sn) return !1;
328
+ if (e.preventDefault(), e.shiftKey) return n.dispatchCommand(fe, !1);
325
329
  }
326
- return t.dispatchCommand(he, void 0);
327
- }, g), t.registerCommand(ut, () => {
328
- const e = v();
329
- return !!C(e) && (t.blur(), !0);
330
- }, g), t.registerCommand(at, (e) => {
331
- const [, n] = Q(e);
332
- if (n.length > 0) {
333
- const i = Ne(e.clientX, e.clientY);
334
- if (i !== null) {
335
- const { offset: r, node: s } = i, a = ie(s);
336
- if (a !== null) {
337
- const l = lt();
338
- if (P(a)) l.anchor.set(a.getKey(), r, "text"), l.focus.set(a.getKey(), r, "text");
330
+ return n.dispatchCommand(me, void 0);
331
+ }, m), n.registerCommand(ct, () => {
332
+ const e = p();
333
+ return !!g(e) && (n.blur(), !0);
334
+ }, m), n.registerCommand(st, (e) => {
335
+ const [, t] = Q(e);
336
+ if (t.length > 0) {
337
+ const a = $e(e.clientX, e.clientY);
338
+ if (a !== null) {
339
+ const { offset: r, node: s } = a, i = ne(s);
340
+ if (i !== null) {
341
+ const l = it();
342
+ if (M(i)) l.anchor.set(i.getKey(), r, "text"), l.focus.set(i.getKey(), r, "text");
339
343
  else {
340
- const d = a.getParentOrThrow().getKey(), f = a.getIndexWithinParent() + 1;
341
- l.anchor.set(d, f, "element"), l.focus.set(d, f, "element");
344
+ const c = i.getParentOrThrow().getKey(), d = i.getIndexWithinParent() + 1;
345
+ l.anchor.set(c, d, "element"), l.focus.set(c, d, "element");
342
346
  }
343
- const c = ct(l);
344
- dt(c);
347
+ const u = lt(l);
348
+ ut(u);
345
349
  }
346
- t.dispatchCommand(De, n);
350
+ n.dispatchCommand(_e, t);
347
351
  }
348
352
  return e.preventDefault(), !0;
349
353
  }
350
- const o = v();
351
- return !!C(o);
352
- }, g), t.registerCommand(st, (e) => {
353
- const [n] = Q(e), o = v();
354
- return !(n && !C(o));
355
- }, g), t.registerCommand(it, (e) => {
356
- const [n] = Q(e), o = v();
357
- if (n && !C(o)) return !1;
358
- const i = Ne(e.clientX, e.clientY);
359
- if (i !== null) {
360
- const r = ie(i.node);
361
- W(r) && e.preventDefault();
354
+ const o = p();
355
+ return !!g(o);
356
+ }, m), n.registerCommand(at, (e) => {
357
+ const [t] = Q(e), o = p();
358
+ return !(t && !g(o));
359
+ }, m), n.registerCommand(ot, (e) => {
360
+ const [t] = Q(e), o = p();
361
+ if (t && !g(o)) return !1;
362
+ const a = $e(e.clientX, e.clientY);
363
+ if (a !== null) {
364
+ const r = ne(a.node);
365
+ H(r) && e.preventDefault();
362
366
  }
363
367
  return !0;
364
- }, g), t.registerCommand(rt, () => (ot(), !0), g), t.registerCommand(nt, (e) => (we(t, A(e, ClipboardEvent) ? e : null), !0), g), t.registerCommand(tt, (e) => (async function(n, o) {
365
- await we(o, A(n, ClipboardEvent) ? n : null), o.update(() => {
366
- const i = v();
367
- C(i) ? i.removeText() : K(i) && i.getNodes().forEach((r) => r.remove());
368
+ }, m), n.registerCommand(nt, () => (rt(), !0), m), n.registerCommand(tt, (e) => (ye(n, z(e, ClipboardEvent) ? e : null), !0), m), n.registerCommand(et, (e) => (async function(t, o) {
369
+ await ye(o, z(t, ClipboardEvent) ? t : null), o.update(() => {
370
+ const a = p();
371
+ g(a) ? a.removeText() : F(a) && a.getNodes().forEach((r) => r.remove());
368
372
  });
369
- }(e, t), !0), g), t.registerCommand(Ae, (e) => {
370
- const [, n, o] = Q(e);
371
- return n.length > 0 && !o ? (t.dispatchCommand(De, n), !0) : et(e.target) ? !1 : v() !== null && (function(i, r) {
372
- i.preventDefault(), r.update(() => {
373
- const s = v(), a = A(i, InputEvent) || A(i, KeyboardEvent) ? null : i.clipboardData;
374
- a != null && s !== null && Ee(a, s, r);
373
+ }(e, n), !0), m), n.registerCommand(Ie, (e) => {
374
+ const [, t, o] = Q(e);
375
+ return t.length > 0 && !o ? (n.dispatchCommand(_e, t), !0) : Oe(e.target) && Qe(e.target) ? !1 : p() !== null && (function(a, r) {
376
+ a.preventDefault(), r.update(() => {
377
+ const s = p(), i = z(a, InputEvent) || z(a, KeyboardEvent) ? null : a.clipboardData;
378
+ i != null && s !== null && Ce(i, s, r);
375
379
  }, { tag: "paste" });
376
- }(e, t), !0);
377
- }, g));
378
- }
379
- const ce = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : x;
380
- function Re(t) {
381
- return t.getEditorState().read(Ve(t.isComposing()));
382
- }
383
- function In({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
384
- const [o] = R(), i = function(r, s) {
385
- const [a, l] = O(() => r.getDecorators());
386
- return ce(() => r.registerDecoratorListener((c) => {
387
- ke.flushSync(() => {
388
- l(c);
380
+ }(e, n), !0);
381
+ }, m), n.registerCommand(Ze, (e) => {
382
+ const t = p();
383
+ return g(t) && se(t), !1;
384
+ }, m), n.registerCommand(Ye, (e) => {
385
+ const t = p();
386
+ return g(t) && se(t), !1;
387
+ }, m));
388
+ }
389
+ const ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
390
+ function xe(n) {
391
+ return n.getEditorState().read(He(n.isComposing()));
392
+ }
393
+ function Ln({ contentEditable: n, placeholder: e = null, ErrorBoundary: t }) {
394
+ const [o] = P(), a = function(r, s) {
395
+ const [i, l] = I(() => r.getDecorators());
396
+ return ie(() => r.registerDecoratorListener((u) => {
397
+ be.flushSync(() => {
398
+ l(u);
389
399
  });
390
- }), [r]), x(() => {
400
+ }), [r]), _(() => {
391
401
  l(r.getDecorators());
392
- }, [r]), q(() => {
393
- const c = [], d = Object.keys(a);
394
- for (let f = 0; f < d.length; f++) {
395
- const u = d[f], m = y(s, { onError: (E) => r._onError(E), children: y(Kt, { fallback: null, children: a[u] }) }), p = r.getElementByKey(u);
396
- p !== null && c.push(ke.createPortal(m, p, u));
402
+ }, [r]), W(() => {
403
+ const u = [], c = Object.keys(i);
404
+ for (let d = 0; d < c.length; d++) {
405
+ const f = c[d], C = h(s, { onError: (w) => r._onError(w), children: h(Ot, { fallback: null, children: i[f] }) }), y = r.getElementByKey(f);
406
+ y !== null && u.push(be.createPortal(C, y, f));
397
407
  }
398
- return c;
399
- }, [s, a, r]);
400
- }(o, n);
408
+ return u;
409
+ }, [s, i, r]);
410
+ }(o, t);
401
411
  return function(r) {
402
- ce(() => B(On(r), Ln(r)), [r]);
403
- }(o), F(Ke, { children: [t, y(Kn, { content: e }), i] });
404
- }
405
- function Kn({ content: t }) {
406
- const [e] = R(), n = function(i) {
407
- const [r, s] = O(() => Re(i));
408
- return ce(() => {
409
- function a() {
410
- const l = Re(i);
412
+ ie(() => U(Nn(r), bn(r)), [r]);
413
+ }(o), K(Te, { children: [n, h(Dn, { content: e }), a] });
414
+ }
415
+ function Dn({ content: n }) {
416
+ const [e] = P(), t = function(a) {
417
+ const [r, s] = I(() => xe(a));
418
+ return ie(() => {
419
+ function i() {
420
+ const l = xe(a);
411
421
  s(l);
412
422
  }
413
- return a(), B(i.registerUpdateListener(() => {
414
- a();
415
- }), i.registerEditableListener(() => {
416
- a();
423
+ return i(), U(a.registerUpdateListener(() => {
424
+ i();
425
+ }), a.registerEditableListener(() => {
426
+ i();
417
427
  }));
418
- }, [i]), r;
419
- }(e), o = $n();
420
- return n ? typeof t == "function" ? t(o) : t : null;
421
- }
422
- const Xe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : x;
423
- function Fn({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: o, ariaDescribedBy: i, ariaErrorMessage: r, ariaExpanded: s, ariaInvalid: a, ariaLabel: l, ariaLabelledBy: c, ariaMultiline: d, ariaOwns: f, ariaRequired: u, autoCapitalize: m, className: p, id: E, role: w = "textbox", spellCheck: h = !0, style: b, tabIndex: $, "data-testid": k, ...S }, N) {
424
- const [_, T] = O(t.isEditable()), I = Ft((L) => {
425
- L && L.ownerDocument && L.ownerDocument.defaultView ? t.setRootElement(L) : t.setRootElement(null);
426
- }, [t]), U = q(() => /* @__PURE__ */ function(...L) {
427
- return (V) => {
428
+ }, [a]), r;
429
+ }(e), o = Cn();
430
+ return t ? typeof n == "function" ? n(o) : n : null;
431
+ }
432
+ const Ve = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
433
+ function Pn({ editor: n, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: o, ariaDescribedBy: a, ariaErrorMessage: r, ariaExpanded: s, ariaInvalid: i, ariaLabel: l, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: C, className: y, id: w, role: k = "textbox", spellCheck: E = !0, style: v, tabIndex: $, "data-testid": x, ...b }, N) {
434
+ const [S, T] = I(n.isEditable()), O = Ft((L) => {
435
+ L && L.ownerDocument && L.ownerDocument.defaultView ? n.setRootElement(L) : n.setRootElement(null);
436
+ }, [n]), B = W(() => /* @__PURE__ */ function(...L) {
437
+ return (J) => {
428
438
  L.forEach((X) => {
429
- typeof X == "function" ? X(V) : X != null && (X.current = V);
439
+ typeof X == "function" ? X(J) : X != null && (X.current = J);
430
440
  });
431
441
  };
432
- }(N, I), [I, N]);
433
- return Xe(() => (T(t.isEditable()), t.registerEditableListener((L) => {
442
+ }(N, O), [O, N]);
443
+ return Ve(() => (T(n.isEditable()), n.registerEditableListener((L) => {
434
444
  T(L);
435
- })), [t]), y("div", { "aria-activedescendant": _ ? e : void 0, "aria-autocomplete": _ ? n : "none", "aria-controls": _ ? o : void 0, "aria-describedby": i, ...r != null ? { "aria-errormessage": r } : {}, "aria-expanded": _ && w === "combobox" ? !!s : void 0, ...a != null ? { "aria-invalid": a } : {}, "aria-label": l, "aria-labelledby": c, "aria-multiline": d, "aria-owns": _ ? f : void 0, "aria-readonly": !_ || void 0, "aria-required": u, autoCapitalize: m, className: p, contentEditable: _, "data-testid": k, id: E, ref: U, role: _ ? w : void 0, spellCheck: h, style: b, tabIndex: $, ...S });
436
- }
437
- const An = Ue(Fn);
438
- function Te(t) {
439
- return t.getEditorState().read(Ve(t.isComposing()));
440
- }
441
- const zn = Ue(Bn);
442
- function Bn(t, e) {
443
- const { placeholder: n, ...o } = t, [i] = R();
444
- return F(Ke, { children: [y(An, { editor: i, ...o, ref: e }), n != null && y(Un, { editor: i, content: n })] });
445
- }
446
- function Un({ content: t, editor: e }) {
447
- const n = function(s) {
448
- const [a, l] = O(() => Te(s));
449
- return Xe(() => {
450
- function c() {
451
- const d = Te(s);
452
- l(d);
445
+ })), [n]), h("div", { "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? t : "none", "aria-controls": S ? o : void 0, "aria-describedby": a, ...r != null ? { "aria-errormessage": r } : {}, "aria-expanded": S && k === "combobox" ? !!s : void 0, ...i != null ? { "aria-invalid": i } : {}, "aria-label": l, "aria-labelledby": u, "aria-multiline": c, "aria-owns": S ? d : void 0, "aria-readonly": !S || void 0, "aria-required": f, autoCapitalize: C, className: y, contentEditable: S, "data-testid": x, id: w, ref: B, role: S ? k : void 0, spellCheck: E, style: v, tabIndex: $, ...b });
446
+ }
447
+ const Tn = ze(Pn);
448
+ function Ne(n) {
449
+ return n.getEditorState().read(He(n.isComposing()));
450
+ }
451
+ const Rn = ze(Mn);
452
+ function Mn(n, e) {
453
+ const { placeholder: t, ...o } = n, [a] = P();
454
+ return K(Te, { children: [h(Tn, { editor: a, ...o, ref: e }), t != null && h(In, { editor: a, content: t })] });
455
+ }
456
+ function In({ content: n, editor: e }) {
457
+ const t = function(s) {
458
+ const [i, l] = I(() => Ne(s));
459
+ return Ve(() => {
460
+ function u() {
461
+ const c = Ne(s);
462
+ l(c);
453
463
  }
454
- return c(), B(s.registerUpdateListener(() => {
455
- c();
464
+ return u(), U(s.registerUpdateListener(() => {
465
+ u();
456
466
  }), s.registerEditableListener(() => {
457
- c();
467
+ u();
458
468
  }));
459
- }, [s]), a;
460
- }(e), [o, i] = O(e.isEditable());
461
- if (H(() => (i(e.isEditable()), e.registerEditableListener((s) => {
462
- i(s);
463
- })), [e]), !n) return null;
469
+ }, [s]), i;
470
+ }(e), [o, a] = I(e.isEditable());
471
+ if (j(() => (a(e.isEditable()), e.registerEditableListener((s) => {
472
+ a(s);
473
+ })), [e]), !t) return null;
464
474
  let r = null;
465
- return typeof t == "function" ? r = t(o) : t !== null && (r = t), r === null ? null : y("div", { "aria-hidden": !0, children: r });
475
+ return typeof n == "function" ? r = n(o) : n !== null && (r = n), r === null ? null : h("div", { "aria-hidden": !0, children: r });
466
476
  }
467
- function de(t, e) {
468
- return de = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, o) {
469
- return n.__proto__ = o, n;
470
- }, de(t, e);
477
+ function le(n, e) {
478
+ return le = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, o) {
479
+ return t.__proto__ = o, t;
480
+ }, le(n, e);
471
481
  }
472
- var Me = { error: null }, Hn = function(t) {
473
- var e, n;
482
+ var Le = { error: null }, On = function(n) {
483
+ var e, t;
474
484
  function o() {
475
- for (var r, s = arguments.length, a = new Array(s), l = 0; l < s; l++) a[l] = arguments[l];
476
- return (r = t.call.apply(t, [this].concat(a)) || this).state = Me, r.resetErrorBoundary = function() {
477
- for (var c, d = arguments.length, f = new Array(d), u = 0; u < d; u++) f[u] = arguments[u];
478
- r.props.onReset == null || (c = r.props).onReset.apply(c, f), r.reset();
485
+ for (var r, s = arguments.length, i = new Array(s), l = 0; l < s; l++) i[l] = arguments[l];
486
+ return (r = n.call.apply(n, [this].concat(i)) || this).state = Le, r.resetErrorBoundary = function() {
487
+ for (var u, c = arguments.length, d = new Array(c), f = 0; f < c; f++) d[f] = arguments[f];
488
+ r.props.onReset == null || (u = r.props).onReset.apply(u, d), r.reset();
479
489
  }, r;
480
490
  }
481
- n = t, (e = o).prototype = Object.create(n.prototype), e.prototype.constructor = e, de(e, n), o.getDerivedStateFromError = function(r) {
491
+ t = n, (e = o).prototype = Object.create(t.prototype), e.prototype.constructor = e, le(e, t), o.getDerivedStateFromError = function(r) {
482
492
  return { error: r };
483
493
  };
484
- var i = o.prototype;
485
- return i.reset = function() {
486
- this.setState(Me);
487
- }, i.componentDidCatch = function(r, s) {
488
- var a, l;
489
- (a = (l = this.props).onError) == null || a.call(l, r, s);
490
- }, i.componentDidUpdate = function(r, s) {
491
- var a, l, c, d, f = this.state.error, u = this.props.resetKeys;
492
- f !== null && s.error !== null && ((c = r.resetKeys) === void 0 && (c = []), (d = u) === void 0 && (d = []), c.length !== d.length || c.some(function(m, p) {
493
- return !Object.is(m, d[p]);
494
- })) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, r.resetKeys, u), this.reset());
495
- }, i.render = function() {
496
- var r = this.state.error, s = this.props, a = s.fallbackRender, l = s.FallbackComponent, c = s.fallback;
494
+ var a = o.prototype;
495
+ return a.reset = function() {
496
+ this.setState(Le);
497
+ }, a.componentDidCatch = function(r, s) {
498
+ var i, l;
499
+ (i = (l = this.props).onError) == null || i.call(l, r, s);
500
+ }, a.componentDidUpdate = function(r, s) {
501
+ var i, l, u, c, d = this.state.error, f = this.props.resetKeys;
502
+ d !== null && s.error !== null && ((u = r.resetKeys) === void 0 && (u = []), (c = f) === void 0 && (c = []), u.length !== c.length || u.some(function(C, y) {
503
+ return !Object.is(C, c[y]);
504
+ })) && ((i = (l = this.props).onResetKeysChange) == null || i.call(l, r.resetKeys, f), this.reset());
505
+ }, a.render = function() {
506
+ var r = this.state.error, s = this.props, i = s.fallbackRender, l = s.FallbackComponent, u = s.fallback;
497
507
  if (r !== null) {
498
- var d = { error: r, resetErrorBoundary: this.resetErrorBoundary };
499
- if (ae.isValidElement(c)) return c;
500
- if (typeof a == "function") return a(d);
501
- if (l) return ae.createElement(l, d);
508
+ var c = { error: r, resetErrorBoundary: this.resetErrorBoundary };
509
+ if (oe.isValidElement(u)) return u;
510
+ if (typeof i == "function") return i(c);
511
+ if (l) return oe.createElement(l, c);
502
512
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
503
513
  }
504
514
  return this.props.children;
505
515
  }, o;
506
- }(ae.Component);
507
- function jn({ children: t, onError: e }) {
508
- return y(Hn, { fallback: y("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
509
- }
510
- const Wn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? H : x;
511
- function Jn({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
512
- const [o] = R();
513
- return Wn(() => {
514
- if (n) return o.registerUpdateListener(({ editorState: i, dirtyElements: r, dirtyLeaves: s, prevEditorState: a, tags: l }) => {
515
- e && r.size === 0 && s.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(i, o, l);
516
+ }(oe.Component);
517
+ function Fn({ children: n, onError: e }) {
518
+ return h(On, { fallback: h("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: n });
519
+ }
520
+ const Kn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? j : _;
521
+ function zn({ ignoreHistoryMergeTagChange: n = !0, ignoreSelectionChange: e = !1, onChange: t }) {
522
+ const [o] = P();
523
+ return Kn(() => {
524
+ if (t) return o.registerUpdateListener(({ editorState: a, dirtyElements: r, dirtyLeaves: s, prevEditorState: i, tags: l }) => {
525
+ e && r.size === 0 && s.size === 0 || n && l.has("history-merge") || i.isEmpty() || t(a, o, l);
516
526
  });
517
- }, [o, t, e, n]), null;
518
- }
519
- function qn() {
520
- const [t] = R();
521
- return x(() => {
522
- if (!t.hasNodes([He, je])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
523
- }, [t]), function(e) {
524
- x(() => Wt(e), [e]);
525
- }(t), null;
526
- }
527
- function Vn({ validateUrl: t, attributes: e }) {
528
- const [n] = R();
529
- return x(() => {
530
- if (!n.hasNodes([We])) throw new Error("LinkPlugin: LinkNode not registered on editor");
531
- return B(n.registerCommand($e, (o) => {
532
- if (o === null) return le(o), !0;
533
- if (typeof o == "string") return !(t !== void 0 && !t(o)) && (le(o, e), !0);
527
+ }, [o, n, e, t]), null;
528
+ }
529
+ function An() {
530
+ const [n] = P();
531
+ return _(() => {
532
+ if (!n.hasNodes([Ae, Be])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
533
+ }, [n]), function(e) {
534
+ _(() => jt(e), [e]);
535
+ }(n), null;
536
+ }
537
+ function Bn({ validateUrl: n, attributes: e }) {
538
+ const [t] = P();
539
+ return _(() => {
540
+ if (!t.hasNodes([je])) throw new Error("LinkPlugin: LinkNode not registered on editor");
541
+ return U(t.registerCommand(we, (o) => {
542
+ if (o === null) return ae(o), !0;
543
+ if (typeof o == "string") return !(n !== void 0 && !n(o)) && (ae(o, e), !0);
534
544
  {
535
- const { url: i, target: r, rel: s, title: a } = o;
536
- return le(i, { ...e, rel: s, target: r, title: a }), !0;
545
+ const { url: a, target: r, rel: s, title: i } = o;
546
+ return ae(a, { ...e, rel: s, target: r, title: i }), !0;
537
547
  }
538
- }, ye), t !== void 0 ? n.registerCommand(Ae, (o) => {
539
- const i = v();
540
- if (!C(i) || i.isCollapsed() || !A(o, ClipboardEvent)) return !1;
548
+ }, he), n !== void 0 ? t.registerCommand(Ie, (o) => {
549
+ const a = p();
550
+ if (!g(a) || a.isCollapsed() || !z(o, ClipboardEvent)) return !1;
541
551
  const r = o;
542
552
  if (r.clipboardData === null) return !1;
543
553
  const s = r.clipboardData.getData("text");
544
- return !!t(s) && !i.getNodes().some((a) => J(a)) && (n.dispatchCommand($e, { ...e, url: s }), o.preventDefault(), !0);
545
- }, ye) : () => {
554
+ return !!n(s) && !a.getNodes().some((i) => V(i)) && (t.dispatchCommand(we, { ...e, url: s }), o.preventDefault(), !0);
555
+ }, he) : () => {
546
556
  });
547
- }, [n, t, e]), null;
557
+ }, [t, n, e]), null;
548
558
  }
549
- function Xn({ newTab: t = !0, disabled: e = !1 }) {
550
- const [n] = R();
551
- return x(() => {
559
+ function jn({ newTab: n = !0, disabled: e = !1 }) {
560
+ const [t] = P();
561
+ return _(() => {
552
562
  const o = (r) => {
553
563
  const s = r.target;
554
- if (!(s instanceof Node)) return;
555
- const a = Pt(s);
556
- if (a === null) return;
557
- let l = null, c = null;
558
- if (a.update(() => {
559
- const u = ie(s);
560
- if (u !== null) {
561
- const m = pe(u, J);
562
- if (!e) if (Jt(m)) l = m.sanitizeUrl(m.getURL()), c = m.getTarget();
564
+ if (!Oe(s)) return;
565
+ const i = Dt(s);
566
+ if (i === null) return;
567
+ let l = null, u = null;
568
+ if (i.update(() => {
569
+ const f = ne(s);
570
+ if (f !== null) {
571
+ const C = de(f, V);
572
+ if (!e) if (Ut(C)) l = C.sanitizeUrl(C.getURL()), u = C.getTarget();
563
573
  else {
564
- const p = function(E, w) {
565
- let h = E;
566
- for (; h != null; ) {
567
- if (w(h)) return h;
568
- h = h.parentNode;
574
+ const y = function(w, k) {
575
+ let E = w;
576
+ for (; E != null; ) {
577
+ if (k(E)) return E;
578
+ E = E.parentNode;
569
579
  }
570
580
  return null;
571
- }(s, Rt);
572
- p !== null && (l = p.href, c = p.target);
581
+ }(s, Pt);
582
+ y !== null && (l = y.href, u = y.target);
573
583
  }
574
584
  }
575
585
  }), l === null || l === "") return;
576
- const d = n.getEditorState().read(v);
577
- if (C(d) && !d.isCollapsed()) return void r.preventDefault();
578
- const f = r.type === "auxclick" && r.button === 1;
579
- window.open(l, t || f || r.metaKey || r.ctrlKey || c === "_blank" ? "_blank" : "_self"), r.preventDefault();
580
- }, i = (r) => {
586
+ const c = t.getEditorState().read(p);
587
+ if (g(c) && !c.isCollapsed()) return void r.preventDefault();
588
+ const d = r.type === "auxclick" && r.button === 1;
589
+ window.open(l, n || d || r.metaKey || r.ctrlKey || u === "_blank" ? "_blank" : "_self"), r.preventDefault();
590
+ }, a = (r) => {
581
591
  r.button === 1 && o(r);
582
592
  };
583
- return n.registerRootListener((r, s) => {
584
- s !== null && (s.removeEventListener("click", o), s.removeEventListener("mouseup", i)), r !== null && (r.addEventListener("click", o), r.addEventListener("mouseup", i));
593
+ return t.registerRootListener((r, s) => {
594
+ s !== null && (s.removeEventListener("click", o), s.removeEventListener("mouseup", a)), r !== null && (r.addEventListener("click", o), r.addEventListener("mouseup", a));
585
595
  });
586
- }, [n, t, e]), null;
587
- }
588
- const te = 0, ue = 1, fe = 2, D = 0, Yn = 1, Oe = 2, Zn = 3, Gn = 4;
589
- function Qn(t, e, n, o, i) {
590
- if (t === null || n.size === 0 && o.size === 0 && !i) return D;
591
- const r = e._selection, s = t._selection;
592
- if (i) return Yn;
593
- if (!(C(r) && C(s) && s.isCollapsed() && r.isCollapsed())) return D;
594
- const a = function(h, b, $) {
595
- const k = h._nodeMap, S = [];
596
- for (const N of b) {
597
- const _ = k.get(N);
598
- _ !== void 0 && S.push(_);
596
+ }, [t, n, e]), null;
597
+ }
598
+ const te = 0, ue = 1, ce = 2, D = 0, Un = 1, De = 2, qn = 3, Hn = 4;
599
+ function Vn(n, e, t, o, a) {
600
+ if (n === null || t.size === 0 && o.size === 0 && !a) return D;
601
+ const r = e._selection, s = n._selection;
602
+ if (a) return Un;
603
+ if (!(g(r) && g(s) && s.isCollapsed() && r.isCollapsed())) return D;
604
+ const i = function(E, v, $) {
605
+ const x = E._nodeMap, b = [];
606
+ for (const N of v) {
607
+ const S = x.get(N);
608
+ S !== void 0 && b.push(S);
599
609
  }
600
- for (const [N, _] of $) {
601
- if (!_) continue;
602
- const T = k.get(N);
603
- T === void 0 || ze(T) || S.push(T);
610
+ for (const [N, S] of $) {
611
+ if (!S) continue;
612
+ const T = x.get(N);
613
+ T === void 0 || Fe(T) || b.push(T);
604
614
  }
605
- return S;
606
- }(e, n, o);
607
- if (a.length === 0) return D;
608
- if (a.length > 1) {
609
- const h = e._nodeMap, b = h.get(r.anchor.key), $ = h.get(s.anchor.key);
610
- return b && $ && !t._nodeMap.has(b.__key) && P(b) && b.__text.length === 1 && r.anchor.offset === 1 ? Oe : D;
615
+ return b;
616
+ }(e, t, o);
617
+ if (i.length === 0) return D;
618
+ if (i.length > 1) {
619
+ const E = e._nodeMap, v = E.get(r.anchor.key), $ = E.get(s.anchor.key);
620
+ return v && $ && !n._nodeMap.has(v.__key) && M(v) && v.__text.length === 1 && r.anchor.offset === 1 ? De : D;
611
621
  }
612
- const l = a[0], c = t._nodeMap.get(l.__key);
613
- if (!P(c) || !P(l) || c.__mode !== l.__mode) return D;
614
- const d = c.__text, f = l.__text;
615
- if (d === f) return D;
616
- const u = r.anchor, m = s.anchor;
617
- if (u.key !== m.key || u.type !== "text") return D;
618
- const p = u.offset, E = m.offset, w = f.length - d.length;
619
- return w === 1 && E === p - 1 ? Oe : w === -1 && E === p + 1 ? Zn : w === -1 && E === p ? Gn : D;
620
- }
621
- function er(t, e) {
622
- let n = Date.now(), o = D;
623
- return (i, r, s, a, l, c) => {
624
- const d = Date.now();
625
- if (c.has("historic")) return o = D, n = d, fe;
626
- const f = Qn(i, r, a, l, t.isComposing()), u = (() => {
627
- const m = s === null || s.editor === t, p = c.has("history-push");
628
- if (!p && m && c.has("history-merge")) return te;
629
- if (i === null) return ue;
630
- const E = r._selection;
631
- return a.size > 0 || l.size > 0 ? p === !1 && f !== D && f === o && d < n + e && m || a.size === 1 && function(w, h, b) {
632
- const $ = h._nodeMap.get(w), k = b._nodeMap.get(w), S = h._selection, N = b._selection;
633
- return !(C(S) && C(N) && S.anchor.type === "element" && S.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text" || !P($) || !P(k) || $.__parent !== k.__parent) && JSON.stringify(h.read(() => $.exportJSON())) === JSON.stringify(b.read(() => k.exportJSON()));
634
- }(Array.from(a)[0], i, r) ? te : ue : E !== null ? te : fe;
622
+ const l = i[0], u = n._nodeMap.get(l.__key);
623
+ if (!M(u) || !M(l) || u.__mode !== l.__mode) return D;
624
+ const c = u.__text, d = l.__text;
625
+ if (c === d) return D;
626
+ const f = r.anchor, C = s.anchor;
627
+ if (f.key !== C.key || f.type !== "text") return D;
628
+ const y = f.offset, w = C.offset, k = d.length - c.length;
629
+ return k === 1 && w === y - 1 ? De : k === -1 && w === y + 1 ? qn : k === -1 && w === y ? Hn : D;
630
+ }
631
+ function Wn(n, e) {
632
+ let t = Date.now(), o = D;
633
+ return (a, r, s, i, l, u) => {
634
+ const c = Date.now();
635
+ if (u.has("historic")) return o = D, t = c, ce;
636
+ const d = Vn(a, r, i, l, n.isComposing()), f = (() => {
637
+ const C = s === null || s.editor === n, y = u.has("history-push");
638
+ if (!y && C && u.has("history-merge")) return te;
639
+ if (a === null) return ue;
640
+ const w = r._selection;
641
+ return i.size > 0 || l.size > 0 ? y === !1 && d !== D && d === o && c < t + e && C || i.size === 1 && function(k, E, v) {
642
+ const $ = E._nodeMap.get(k), x = v._nodeMap.get(k), b = E._selection, N = v._selection;
643
+ return !(g(b) && g(N) && b.anchor.type === "element" && b.focus.type === "element" && N.anchor.type === "text" && N.focus.type === "text" || !M($) || !M(x) || $.__parent !== x.__parent) && JSON.stringify(E.read(() => $.exportJSON())) === JSON.stringify(v.read(() => x.exportJSON()));
644
+ }(Array.from(i)[0], a, r) ? te : ue : w !== null ? te : ce;
635
645
  })();
636
- return n = d, o = f, u;
646
+ return t = c, o = d, f;
637
647
  };
638
648
  }
639
- function Ie(t) {
640
- t.undoStack = [], t.redoStack = [], t.current = null;
649
+ function Pe(n) {
650
+ n.undoStack = [], n.redoStack = [], n.current = null;
641
651
  }
642
- function tr(t, e, n) {
643
- const o = er(t, n);
644
- return B(t.registerCommand(It, () => (function(r, s) {
645
- const a = s.redoStack, l = s.undoStack;
652
+ function Jn(n, e, t) {
653
+ const o = Wn(n, t);
654
+ return U(n.registerCommand(It, () => (function(r, s) {
655
+ const i = s.redoStack, l = s.undoStack;
646
656
  if (l.length !== 0) {
647
- const c = s.current, d = l.pop();
648
- c !== null && (a.push(c), r.dispatchCommand(Y, !0)), l.length === 0 && r.dispatchCommand(Z, !1), s.current = d || null, d && d.editor.setEditorState(d.editorState, { tag: "historic" });
657
+ const u = s.current, c = l.pop();
658
+ u !== null && (i.push(u), r.dispatchCommand(G, !0)), l.length === 0 && r.dispatchCommand(Y, !1), s.current = c || null, c && c.editor.setEditorState(c.editorState, { tag: "historic" });
649
659
  }
650
- }(t, e), !0), g), t.registerCommand(Ot, () => (function(r, s) {
651
- const a = s.redoStack, l = s.undoStack;
652
- if (a.length !== 0) {
653
- const c = s.current;
654
- c !== null && (l.push(c), r.dispatchCommand(Z, !0));
655
- const d = a.pop();
656
- a.length === 0 && r.dispatchCommand(Y, !1), s.current = d || null, d && d.editor.setEditorState(d.editorState, { tag: "historic" });
660
+ }(n, e), !0), m), n.registerCommand(Mt, () => (function(r, s) {
661
+ const i = s.redoStack, l = s.undoStack;
662
+ if (i.length !== 0) {
663
+ const u = s.current;
664
+ u !== null && (l.push(u), r.dispatchCommand(Y, !0));
665
+ const c = i.pop();
666
+ i.length === 0 && r.dispatchCommand(G, !1), s.current = c || null, c && c.editor.setEditorState(c.editorState, { tag: "historic" });
657
667
  }
658
- }(t, e), !0), g), t.registerCommand(Mt, () => (Ie(e), !1), g), t.registerCommand(Tt, () => (Ie(e), t.dispatchCommand(Y, !1), t.dispatchCommand(Z, !1), !0), g), t.registerUpdateListener(({ editorState: r, prevEditorState: s, dirtyLeaves: a, dirtyElements: l, tags: c }) => {
659
- const d = e.current, f = e.redoStack, u = e.undoStack, m = d === null ? null : d.editorState;
660
- if (d !== null && r === m) return;
661
- const p = o(s, r, d, a, l, c);
662
- if (p === ue) f.length !== 0 && (e.redoStack = [], t.dispatchCommand(Y, !1)), d !== null && (u.push({ ...d }), t.dispatchCommand(Z, !0));
663
- else if (p === fe) return;
664
- e.current = { editor: t, editorState: r };
668
+ }(n, e), !0), m), n.registerCommand(Rt, () => (Pe(e), !1), m), n.registerCommand(Tt, () => (Pe(e), n.dispatchCommand(G, !1), n.dispatchCommand(Y, !1), !0), m), n.registerUpdateListener(({ editorState: r, prevEditorState: s, dirtyLeaves: i, dirtyElements: l, tags: u }) => {
669
+ const c = e.current, d = e.redoStack, f = e.undoStack, C = c === null ? null : c.editorState;
670
+ if (c !== null && r === C) return;
671
+ const y = o(s, r, c, i, l, u);
672
+ if (y === ue) d.length !== 0 && (e.redoStack = [], n.dispatchCommand(G, !1)), c !== null && (f.push({ ...c }), n.dispatchCommand(Y, !0));
673
+ else if (y === ce) return;
674
+ e.current = { editor: n, editorState: r };
665
675
  }));
666
676
  }
667
- function nr() {
677
+ function Xn() {
668
678
  return { current: null, redoStack: [], undoStack: [] };
669
679
  }
670
- function rr({ delay: t, externalHistoryState: e }) {
671
- const [n] = R();
672
- return function(o, i, r = 1e3) {
673
- const s = q(() => i || nr(), [i]);
674
- x(() => tr(o, s, r), [r, o, s]);
675
- }(n, e, t), null;
676
- }
677
- function or(t) {
678
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
679
- }
680
- var ne = or(function(t) {
681
- const e = new URLSearchParams();
682
- e.append("code", t);
683
- for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
684
- 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.`);
685
- });
686
- function ir({ hasCellMerge: t = !0, hasCellBackgroundColor: e = !0, hasTabHandler: n = !0, hasHorizontalScroll: o = !1 }) {
687
- const [i] = R();
688
- return x(() => {
689
- Vt(i, o);
690
- }, [i, o]), x(() => (i.hasNodes([re, oe, Je]) || ne(10), B(i.registerCommand(Yt, ({ columns: r, rows: s, includeHeaders: a }) => {
691
- const l = Zt(Number(s), Number(r), a);
692
- zt(l);
693
- const c = l.getFirstDescendant();
694
- return P(c) && c.select(), !0;
695
- }, g), i.registerNodeTransform(re, (r) => {
696
- const [s] = Xt(r, null, null), a = s.reduce((c, d) => Math.max(c, d.length), 0), l = r.getChildren();
697
- for (let c = 0; c < s.length; ++c) {
698
- const d = l[c];
699
- if (!d) continue;
700
- const f = s[c].reduce((u, m) => m ? 1 + u : u, 0);
701
- if (f !== a) for (let u = f; u < a; ++u) {
702
- const m = _e(0);
703
- m.append(me()), d.append(m);
704
- }
705
- }
706
- }))), [i]), x(() => {
707
- const r = /* @__PURE__ */ new Map(), s = (l, c, d) => {
708
- const f = nn(l, d), u = rn(l, f, i, n);
709
- r.set(c, [u, f]);
710
- }, a = i.registerMutationListener(re, (l) => {
711
- i.getEditorState().read(() => {
712
- for (const [c, d] of l) {
713
- const f = r.get(c);
714
- if (d === "created" || d === "updated") {
715
- const { tableNode: u, tableElement: m } = Gt(c);
716
- f === void 0 ? s(u, c, m) : m !== f[1] && (f[0].removeListeners(), r.delete(c), s(u, c, m));
717
- } else d === "destroyed" && f !== void 0 && (f[0].removeListeners(), r.delete(c));
718
- }
719
- }, { editor: i });
720
- }, { skipInitialization: !1 });
721
- return () => {
722
- a();
723
- for (const [, [l]] of r) l.removeListeners();
724
- };
725
- }, [i, n]), x(() => {
726
- if (!t) return i.registerNodeTransform(oe, (r) => {
727
- if (r.getColSpan() > 1 || r.getRowSpan() > 1) {
728
- const [, , s] = Qt(r), [a] = en(s, r, r), l = a.length, c = a[0].length;
729
- let d = s.getFirstChild();
730
- xe(d) || ne(175);
731
- const f = [];
732
- for (let u = 0; u < l; u++) {
733
- u !== 0 && (d = d.getNextSibling(), xe(d) || ne(175));
734
- let m = null;
735
- for (let p = 0; p < c; p++) {
736
- const E = a[u][p], w = E.cell;
737
- if (E.startRow === u && E.startColumn === p) m = w, f.push(w);
738
- else if (w.getColSpan() > 1 || w.getRowSpan() > 1) {
739
- tn(w) || ne(176);
740
- const h = _e(w.__headerState);
741
- m !== null ? m.insertAfter(h) : Bt(d, h);
742
- }
743
- }
744
- }
745
- for (const u of f) u.setColSpan(1), u.setRowSpan(1);
746
- }
747
- });
748
- }, [i, t]), x(() => {
749
- if (!e) return i.registerNodeTransform(oe, (r) => {
680
+ function Gn({ delay: n, externalHistoryState: e }) {
681
+ const [t] = P();
682
+ return function(o, a, r = 1e3) {
683
+ const s = W(() => a || Xn(), [a]);
684
+ _(() => Jn(o, s, r), [r, o, s]);
685
+ }(t, e, n), null;
686
+ }
687
+ function Yn({ hasCellMerge: n = !0, hasCellBackgroundColor: e = !0, hasTabHandler: t = !0, hasHorizontalScroll: o = !1 }) {
688
+ const [a] = P();
689
+ return _(() => {
690
+ Ht(a, o);
691
+ }, [a, o]), _(() => Vt(a), [a]), _(() => Wt(a, t), [a, t]), _(() => {
692
+ if (!n) return Jt(a);
693
+ }, [a, n]), _(() => {
694
+ if (!e) return a.registerNodeTransform(Ue, (r) => {
750
695
  r.getBackgroundColor() !== null && r.setBackgroundColor(null);
751
696
  });
752
- }, [i, e, t]), null;
697
+ }, [a, e, n]), null;
753
698
  }
754
- const Ye = 200, sr = ({
755
- currentLanguage: t = "NL",
699
+ const We = 200, Zn = ({
700
+ currentLanguage: n = "NL",
756
701
  initialValue: e = "",
757
- placeholder: n = "",
702
+ placeholder: t = "",
758
703
  label: o = "",
759
- info: i = "",
704
+ info: a = "",
760
705
  required: r = !1,
761
706
  notValidatedText: s = "",
762
- maxHeightInRem: a = "20rem",
763
- maxWords: l = Ye,
764
- onChange: c
707
+ maxHeightInRem: i = "20rem",
708
+ maxWords: l = We,
709
+ onChange: u
765
710
  }) => {
766
- const { switchLanguage: d } = vn(), f = mn(), [u] = O(() => Fe()), [m, p] = O(0), [E, w] = O(0), h = Be(null), b = {
711
+ const { switchLanguage: c } = cn(), d = an(), [f] = I(() => Re()), [C, y] = I(0), [w, k] = I(0), E = Ke(null), v = {
767
712
  html: {
768
- export: cn
713
+ export: tn
769
714
  },
770
715
  namespace: "UvaRte",
771
- editor: u,
772
- theme: gn,
773
- onError(S) {
774
- throw S;
716
+ editor: f,
717
+ theme: ln,
718
+ onError(b) {
719
+ throw b;
775
720
  },
776
- nodes: [He, je, We, qt, oe, Je, re],
777
- editorState: (S) => {
778
- const _ = new DOMParser().parseFromString(e, "text/html"), T = Ht(S, _), I = z();
779
- if (I.clear(), dn(e))
780
- T.forEach((U) => {
781
- I.append(U);
721
+ nodes: [Ae, Be, je, qt, Ue, Xt, Gt],
722
+ editorState: (b) => {
723
+ const S = new DOMParser().parseFromString(e, "text/html"), T = At(b, S), O = A();
724
+ if (O.clear(), nn(e))
725
+ T.forEach((B) => {
726
+ O.append(B);
782
727
  });
783
728
  else {
784
- const U = me();
785
- T.forEach((L, V) => {
786
- V === 0 ? (U.append(L), I.append(U)) : I.append(L);
729
+ const B = Me();
730
+ T.forEach((L, J) => {
731
+ J === 0 ? (B.append(L), O.append(B)) : O.append(L);
787
732
  });
788
733
  }
789
734
  }
790
- }, $ = (S) => S.trim().length === 0 ? 0 : S.split(" ").length, k = (S, N) => {
791
- S.read(() => {
792
- let _ = "";
793
- p($(z().getTextContent().replace(/\s+/g, " ").trim())), _ = un(jt(N)), c(_);
735
+ }, $ = (b) => b.trim().length === 0 ? 0 : b.split(" ").length, x = (b, N) => {
736
+ b.read(() => {
737
+ let S = "";
738
+ y($(A().getTextContent().replace(/\s+/g, " ").trim())), S = rn(Bt(N)), u(S);
794
739
  });
795
740
  };
796
- return x(() => {
797
- d(t.toLocaleLowerCase());
798
- }, [t, d]), x(() => {
799
- const S = e.replace(/<br\s*\/?>|&nbsp;/gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
800
- p($(S));
801
- }, []), /* @__PURE__ */ F("div", { className: M.editor__container, children: [
802
- /* @__PURE__ */ F("div", { className: M.editor__header, children: [
803
- /* @__PURE__ */ y(hn, { label: o, info: i, required: r }),
804
- /* @__PURE__ */ F("div", { className: M["editor__header-word-count"], children: [
805
- /* @__PURE__ */ y("span", { className: ln({ [M["editor__header-word-count--alert"]]: m > l }), children: m }),
741
+ return _(() => {
742
+ c(n.toLocaleLowerCase());
743
+ }, [n, c]), _(() => {
744
+ const b = e.replace(/<br\s*\/?>|&nbsp;/gi, " ").replace(/<\/?[^>]+(>|$)|&[a-z]+;/g, "").replace(/\s+/g, " ").trim();
745
+ y($(b));
746
+ }, []), /* @__PURE__ */ K("div", { className: R.editor__container, children: [
747
+ /* @__PURE__ */ K("div", { className: R.editor__header, children: [
748
+ /* @__PURE__ */ h(un, { label: o, info: a, required: r }),
749
+ /* @__PURE__ */ K("div", { className: R["editor__header-word-count"], children: [
750
+ /* @__PURE__ */ h("span", { className: en({ [R["editor__header-word-count--alert"]]: C > l }), children: C }),
806
751
  " / ",
807
752
  l
808
753
  ] })
809
754
  ] }),
810
- /* @__PURE__ */ y("div", { className: M.editor, children: /* @__PURE__ */ F(wn, { initialConfig: b, children: [
811
- /* @__PURE__ */ y(fn, { editorScrollPosition: E }),
812
- /* @__PURE__ */ F("div", { className: M["editor__field-wrapper"], children: [
813
- /* @__PURE__ */ y(
814
- In,
755
+ /* @__PURE__ */ h("div", { className: R.editor, children: /* @__PURE__ */ K(pn, { initialConfig: v, children: [
756
+ /* @__PURE__ */ h(on, { editorScrollPosition: w }),
757
+ /* @__PURE__ */ K("div", { className: R["editor__field-wrapper"], children: [
758
+ /* @__PURE__ */ h(
759
+ Ln,
815
760
  {
816
- contentEditable: /* @__PURE__ */ y(
817
- zn,
761
+ contentEditable: /* @__PURE__ */ h(
762
+ Rn,
818
763
  {
819
- className: M.editor__field,
820
- "aria-label": f.common.rteAriaLabel,
821
- "aria-placeholder": n,
822
- title: f.common.rteTitle,
823
- placeholder: /* @__PURE__ */ y("div", { className: M.editor__placeholder, children: n }),
764
+ className: R.editor__field,
765
+ "aria-label": d.common.rteAriaLabel,
766
+ "aria-placeholder": t,
767
+ title: d.common.rteTitle,
768
+ placeholder: /* @__PURE__ */ h("div", { className: R.editor__placeholder, children: t }),
824
769
  spellCheck: !1,
825
770
  id: "rteEditor",
826
- style: { height: `${a}`, maxHeight: `${a}` },
827
- onScroll: (S) => w(S.currentTarget.scrollTop),
828
- ref: h
771
+ style: { height: `${i}`, maxHeight: `${i}` },
772
+ onScroll: (b) => k(b.currentTarget.scrollTop),
773
+ ref: E
829
774
  }
830
775
  ),
831
- placeholder: /* @__PURE__ */ y("div", { className: M.editor__placeholder, children: n }),
832
- ErrorBoundary: jn
776
+ placeholder: /* @__PURE__ */ h("div", { className: R.editor__placeholder, children: t }),
777
+ ErrorBoundary: Fn
833
778
  }
834
779
  ),
835
- /* @__PURE__ */ y(ir, {}),
836
- /* @__PURE__ */ y(rr, {}),
837
- /* @__PURE__ */ y(qn, {}),
838
- /* @__PURE__ */ y(Vn, { validateUrl: on }),
839
- /* @__PURE__ */ y(sn, { matchers: an }),
840
- /* @__PURE__ */ y(Xn, {}),
841
- /* @__PURE__ */ y(Jn, { onChange: k }),
842
- /* @__PURE__ */ y(yn, {})
780
+ /* @__PURE__ */ h(Yn, {}),
781
+ /* @__PURE__ */ h(Gn, {}),
782
+ /* @__PURE__ */ h(An, {}),
783
+ /* @__PURE__ */ h(Bn, { validateUrl: Yt }),
784
+ /* @__PURE__ */ h(Zt, { matchers: Qt }),
785
+ /* @__PURE__ */ h(jn, {}),
786
+ /* @__PURE__ */ h(zn, { onChange: x }),
787
+ /* @__PURE__ */ h(fn, {})
843
788
  ] })
844
789
  ] }) }),
845
- s !== "" && /* @__PURE__ */ y(pn, { level: "error", feedback: s })
790
+ s !== "" && /* @__PURE__ */ h(sn, { level: "error", feedback: s })
846
791
  ] });
847
- }, Vr = ({
848
- currentLanguage: t = "NL",
792
+ }, Br = ({
793
+ currentLanguage: n = "NL",
849
794
  initialValue: e = "",
850
- placeholder: n = "",
795
+ placeholder: t = "",
851
796
  label: o = "",
852
- info: i = "",
797
+ info: a = "",
853
798
  required: r = !1,
854
799
  notValidatedText: s = "",
855
- maxWords: a = Ye,
800
+ maxWords: i = We,
856
801
  onChange: l
857
- }) => /* @__PURE__ */ y(Cn, { children: /* @__PURE__ */ y(
858
- sr,
802
+ }) => /* @__PURE__ */ h(dn, { children: /* @__PURE__ */ h(
803
+ Zn,
859
804
  {
860
- currentLanguage: t,
805
+ currentLanguage: n,
861
806
  initialValue: e,
862
- placeholder: n,
807
+ placeholder: t,
863
808
  label: o,
864
- info: i,
809
+ info: a,
865
810
  required: r,
866
811
  notValidatedText: s,
867
- maxWords: a,
812
+ maxWords: i,
868
813
  onChange: l
869
814
  }
870
815
  ) });
871
816
  export {
872
- sr as Rte,
873
- Vr as RteEditor
817
+ Zn as Rte,
818
+ Br as RteEditor
874
819
  };
875
820
  //# sourceMappingURL=RteEditor.js.map