@uva-glass/component-library 1.50.0 → 1.50.1

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