@levo-so/site-runtime 0.3.9 → 0.3.11

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.
@@ -0,0 +1,749 @@
1
+ "use client";
2
+ import { n as e, r as t, t as n } from "./CollectionField-C-6a1ud4.js";
3
+ import { r } from "./ThemeProvider-DutrjSTF.js";
4
+ import { i, n as a, r as o, t as s } from "./Tooltip-CQB0LyxK.js";
5
+ import { n as c, t as l } from "./content.cssm-XdMsTGIB.js";
6
+ import { t as u } from "./inlineRteTheme-CRPtkNXy.js";
7
+ import { t as d } from "./RteThemeProvider-BQmfSXSl.js";
8
+ import { a as f, i as p, n as m, o as h, r as g } from "./Popover-C29yJ7rz.js";
9
+ import { useController as _ } from "react-hook-form";
10
+ import { c as v } from "react/compiler-runtime";
11
+ import y from "clsx";
12
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
13
+ import { forwardRef as C, useEffect as w, useState as T } from "react";
14
+ import { IconAlignCenter as E, IconAlignJustified as D, IconAlignLeft as O, IconAlignRight as ee, IconArrowBackUp as te, IconArrowForwardUp as k, IconBold as A, IconChevronDown as j, IconCode as M, IconCornerDownLeft as ne, IconExternalLink as N, IconH1 as P, IconH2 as F, IconH3 as I, IconH4 as L, IconH5 as R, IconH6 as z, IconItalic as B, IconLink as re, IconList as V, IconListNumbers as H, IconPencil as U, IconPilcrow as W, IconRotate2 as G, IconStrikethrough as K, IconSubscript as q, IconSuperscript as J, IconTrash as Y, IconUnderline as X } from "@tabler/icons-react";
15
+ import { AllSelection as Z, NodeSelection as ie, TextSelection as Q } from "@tiptap/pm/state";
16
+ import { Subscript as ae } from "@tiptap/extension-subscript";
17
+ import { Superscript as oe } from "@tiptap/extension-superscript";
18
+ import { Typography as se } from "@tiptap/extension-typography";
19
+ import { UniqueID as ce } from "@tiptap/extension-unique-id";
20
+ import { Placeholder as le, Selection as ue } from "@tiptap/extensions";
21
+ import { StarterKit as de } from "@tiptap/starter-kit";
22
+ import { EditorContent as fe, EditorContext as pe, useCurrentEditor as me, useEditor as he, useEditorState as ge } from "@tiptap/react";
23
+ //#region ../../libraries/react-collection/dist/components/editor/extensionKit.js
24
+ var _e = (e = { placeholder: "Write something ..." }) => [
25
+ de.configure({
26
+ blockquote: !1,
27
+ codeBlock: !1,
28
+ horizontalRule: !1,
29
+ dropcursor: { width: 2 },
30
+ link: {
31
+ openOnClick: !1,
32
+ HTMLAttributes: { target: "_blank" }
33
+ }
34
+ }),
35
+ le.configure({ placeholder: e?.placeholder }),
36
+ se,
37
+ ue,
38
+ oe,
39
+ ae,
40
+ c,
41
+ ce.configure({ types: [
42
+ "paragraph",
43
+ "heading",
44
+ "bulletList",
45
+ "orderedList"
46
+ ] })
47
+ ], ve = "_261ja30", ye = "_261ja31", $ = C((e, t) => {
48
+ let n = v(27), i, c, l, u, d, f, p;
49
+ n[0] === e ? (i = n[1], c = n[2], l = n[3], u = n[4], d = n[5], f = n[6], p = n[7]) : ({label: u, Icon: i, isActive: l, iconSize: f, trailing: p, className: c, ...d} = e, n[0] = e, n[1] = i, n[2] = c, n[3] = l, n[4] = u, n[5] = d, n[6] = f, n[7] = p);
50
+ let m = f === void 0 ? 16 : f, h = l || void 0, g = l && "_1vaxhty0", _;
51
+ n[8] !== c || n[9] !== g ? (_ = y(g, c), n[8] = c, n[9] = g, n[10] = _) : _ = n[10];
52
+ let b;
53
+ n[11] !== i || n[12] !== m ? (b = /* @__PURE__ */ x(i, { size: m }), n[11] = i, n[12] = m, n[13] = b) : b = n[13];
54
+ let C;
55
+ n[14] !== u || n[15] !== d || n[16] !== t || n[17] !== h || n[18] !== _ || n[19] !== b || n[20] !== p ? (C = /* @__PURE__ */ x(a, {
56
+ onPointerDown: be,
57
+ render: /* @__PURE__ */ S(r, {
58
+ ref: t,
59
+ type: "button",
60
+ variant: "ghost",
61
+ size: "sm",
62
+ tabIndex: -1,
63
+ "aria-label": u,
64
+ "aria-pressed": h,
65
+ className: _,
66
+ ...d,
67
+ children: [b, p]
68
+ })
69
+ }), n[14] = u, n[15] = d, n[16] = t, n[17] = h, n[18] = _, n[19] = b, n[20] = p, n[21] = C) : C = n[21];
70
+ let w;
71
+ n[22] === u ? w = n[23] : (w = /* @__PURE__ */ x(o, { children: u }), n[22] = u, n[23] = w);
72
+ let T;
73
+ return n[24] !== C || n[25] !== w ? (T = /* @__PURE__ */ S(s, { children: [C, w] }), n[24] = C, n[25] = w, n[26] = T) : T = n[26], T;
74
+ });
75
+ $.displayName = "ToolbarButton";
76
+ function be(e) {
77
+ return e.preventDefault();
78
+ }
79
+ //#endregion
80
+ //#region ../../libraries/react-collection/dist/components/editor/utils.js
81
+ var xe = [
82
+ "paragraph",
83
+ "heading",
84
+ "bulletList",
85
+ "orderedList",
86
+ "taskList",
87
+ "codeBlock"
88
+ ], Se = [
89
+ "tableCell",
90
+ "tableHeader",
91
+ "quoteCaption",
92
+ "detailsSummary"
93
+ ], Ce = (e) => {
94
+ if (!e) return !1;
95
+ let { $from: t } = e.state.selection;
96
+ for (let e = t.depth; e > 0; e--) if (Se.includes(t.node(e).type.name)) return !0;
97
+ return !1;
98
+ }, we = (e, t) => {
99
+ if (!e || t.length === 0) return !1;
100
+ let { selection: n } = e.state, r = new Set(t);
101
+ if (n instanceof ie) {
102
+ let e = n.node?.type?.name;
103
+ return !!e && r.has(e);
104
+ }
105
+ if (n instanceof Q || n instanceof Z) {
106
+ let t = !0;
107
+ return e.state.doc.nodesBetween(n.from, n.to, (e) => e.isTextblock && !r.has(e.type.name) ? (t = !1, !1) : t), t;
108
+ }
109
+ return !1;
110
+ }, Te = /[\0-\x20\xA0\u1680\u180E\u2000-\u2029\u205F\u3000]/g, Ee = [
111
+ "http",
112
+ "https",
113
+ "ftp",
114
+ "ftps",
115
+ "mailto",
116
+ "tel",
117
+ "callto",
118
+ "sms"
119
+ ], De = (e, t) => {
120
+ try {
121
+ let n = new URL(e, t), r = n.href.replace(Te, ""), i = RegExp(`^(?:(?:${Ee.join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`, "i");
122
+ if (r.match(i)) return n.href;
123
+ } catch {}
124
+ return "#";
125
+ }, Oe = (e, t = []) => {
126
+ let { tr: n } = e.state, { selection: r } = n;
127
+ return r.empty ? !1 : (r.ranges.forEach((e) => {
128
+ n.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => (e.isInline && e.marks.forEach((i) => {
129
+ t.includes(i.type.name) || n.removeMark(r, r + e.nodeSize, i.type);
130
+ }), !0));
131
+ }), e.view.dispatch(n), e.commands.focus(), !0);
132
+ }, ke = (e) => {
133
+ let { selection: t } = e.state;
134
+ if (t.empty) return !1;
135
+ for (let n of t.ranges) {
136
+ let t = !1;
137
+ if (e.state.doc.nodesBetween(n.$from.pos, n.$to.pos, (e) => e.isInline && e.marks.length > 0 ? (t = !0, !1) : !0), t) return !0;
138
+ }
139
+ return !1;
140
+ }, Ae = "j67x6z0", je = "j67x6z1", Me = "_5pk5r80", Ne = (e) => {
141
+ let t = v(50), { editor: n } = e, [r, i] = T(!1), { isActive: c, currentUrl: l } = ge({
142
+ editor: n,
143
+ selector: Pe
144
+ }) ?? {
145
+ isActive: !1,
146
+ currentUrl: ""
147
+ }, [u, d] = T(l), _, y;
148
+ t[0] !== l || t[1] !== r ? (_ = () => {
149
+ r && d(l);
150
+ }, y = [r, l], t[0] = l, t[1] = r, t[2] = _, t[3] = y) : (_ = t[2], y = t[3]), w(_, y);
151
+ let b;
152
+ t[4] !== n || t[5] !== u ? (b = () => {
153
+ u && (n.chain().focus().extendMarkRange("link").setLink({ href: u }).run(), i(!1));
154
+ }, t[4] = n, t[5] = u, t[6] = b) : b = t[6];
155
+ let C = b, E;
156
+ t[7] === n ? E = t[8] : (E = () => {
157
+ n.chain().focus().extendMarkRange("link").unsetLink().run(), d(""), i(!1);
158
+ }, t[7] = n, t[8] = E);
159
+ let D = E, O;
160
+ t[9] === u ? O = t[10] : (O = () => {
161
+ let e = De(u, window.location.href);
162
+ e !== "#" && window.open(e, "_blank", "noopener,noreferrer");
163
+ }, t[9] = u, t[10] = O);
164
+ let ee = O, te;
165
+ t[11] === Symbol.for("react.memo_cache_sentinel") ? (te = (e) => {
166
+ e.preventDefault(), i(!0);
167
+ }, t[11] = te) : te = t[11];
168
+ let k;
169
+ t[12] === c ? k = t[13] : (k = /* @__PURE__ */ x(h, {
170
+ onPointerDown: Fe,
171
+ render: /* @__PURE__ */ x($, {
172
+ label: "Link",
173
+ Icon: re,
174
+ isActive: c,
175
+ onClick: te
176
+ })
177
+ }), t[12] = c, t[13] = k);
178
+ let A;
179
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (A = (e) => d(e.target.value), t[14] = A) : A = t[14];
180
+ let j;
181
+ t[15] === C ? j = t[16] : (j = (e) => {
182
+ e.key === "Enter" && (e.preventDefault(), C());
183
+ }, t[15] = C, t[16] = j);
184
+ let M;
185
+ t[17] !== j || t[18] !== u ? (M = /* @__PURE__ */ x("input", {
186
+ className: je,
187
+ value: u,
188
+ onChange: A,
189
+ onKeyDown: j,
190
+ placeholder: "Paste a link..."
191
+ }), t[17] = j, t[18] = u, t[19] = M) : M = t[19];
192
+ let P = !u && !c, F;
193
+ t[20] === Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ x(ne, { size: 16 }), t[20] = F) : F = t[20];
194
+ let I;
195
+ t[21] !== C || t[22] !== P ? (I = /* @__PURE__ */ x(a, { render: /* @__PURE__ */ x("button", {
196
+ type: "button",
197
+ className: Me,
198
+ onClick: C,
199
+ disabled: P,
200
+ "aria-label": "Apply link",
201
+ children: F
202
+ }) }), t[21] = C, t[22] = P, t[23] = I) : I = t[23];
203
+ let L;
204
+ t[24] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ x(o, { children: "Apply link" }), t[24] = L) : L = t[24];
205
+ let R;
206
+ t[25] === I ? R = t[26] : (R = /* @__PURE__ */ S(s, { children: [I, L] }), t[25] = I, t[26] = R);
207
+ let z = !u && !c, B;
208
+ t[27] === Symbol.for("react.memo_cache_sentinel") ? (B = /* @__PURE__ */ x(N, { size: 16 }), t[27] = B) : B = t[27];
209
+ let V;
210
+ t[28] !== ee || t[29] !== z ? (V = /* @__PURE__ */ x(a, { render: /* @__PURE__ */ x("button", {
211
+ type: "button",
212
+ className: Me,
213
+ onClick: ee,
214
+ disabled: z,
215
+ "aria-label": "Open in new window",
216
+ children: B
217
+ }) }), t[28] = ee, t[29] = z, t[30] = V) : V = t[30];
218
+ let H;
219
+ t[31] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ x(o, { children: "Open in new window" }), t[31] = H) : H = t[31];
220
+ let U;
221
+ t[32] === V ? U = t[33] : (U = /* @__PURE__ */ S(s, { children: [V, H] }), t[32] = V, t[33] = U);
222
+ let W = !u && !c, G;
223
+ t[34] === Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ x(Y, { size: 16 }), t[34] = G) : G = t[34];
224
+ let K;
225
+ t[35] !== D || t[36] !== W ? (K = /* @__PURE__ */ x(a, { render: /* @__PURE__ */ x("button", {
226
+ type: "button",
227
+ className: Me,
228
+ onClick: D,
229
+ disabled: W,
230
+ "aria-label": "Remove link",
231
+ children: G
232
+ }) }), t[35] = D, t[36] = W, t[37] = K) : K = t[37];
233
+ let q;
234
+ t[38] === Symbol.for("react.memo_cache_sentinel") ? (q = /* @__PURE__ */ x(o, { children: "Remove link" }), t[38] = q) : q = t[38];
235
+ let J;
236
+ t[39] === K ? J = t[40] : (J = /* @__PURE__ */ S(s, { children: [K, q] }), t[39] = K, t[40] = J);
237
+ let X;
238
+ t[41] !== M || t[42] !== R || t[43] !== U || t[44] !== J ? (X = /* @__PURE__ */ x(p, { children: /* @__PURE__ */ x(g, {
239
+ side: "bottom",
240
+ align: "center",
241
+ children: /* @__PURE__ */ S(f.Popup, {
242
+ className: Ae,
243
+ children: [
244
+ M,
245
+ R,
246
+ U,
247
+ J
248
+ ]
249
+ })
250
+ }) }), t[41] = M, t[42] = R, t[43] = U, t[44] = J, t[45] = X) : X = t[45];
251
+ let Z;
252
+ return t[46] !== r || t[47] !== X || t[48] !== k ? (Z = /* @__PURE__ */ S(m, {
253
+ open: r,
254
+ onOpenChange: i,
255
+ children: [k, X]
256
+ }), t[46] = r, t[47] = X, t[48] = k, t[49] = Z) : Z = t[49], Z;
257
+ };
258
+ function Pe(e) {
259
+ let { editor: t } = e;
260
+ return {
261
+ isActive: t.isActive("link"),
262
+ currentUrl: t.getAttributes("link")?.href ?? ""
263
+ };
264
+ }
265
+ function Fe(e) {
266
+ return e.preventDefault();
267
+ }
268
+ //#endregion
269
+ //#region ../../libraries/react-collection/dist/components/editor/menus/TurnIntoMenu.cssm.js
270
+ var Ie = "_1keigwl0", Le = "_1keigwl1 _5pk5r80", Re = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), ze = [
271
+ {
272
+ type: "paragraph",
273
+ label: "Text",
274
+ Icon: W,
275
+ isActive: (e) => e.isActive("paragraph"),
276
+ canApply: (e) => e.can().setParagraph() || e.can().clearNodes(),
277
+ apply: (e) => e.chain().focus().setParagraph().run()
278
+ },
279
+ {
280
+ type: "heading_1",
281
+ label: "Heading 1",
282
+ Icon: P,
283
+ isActive: (e) => e.isActive("heading", { level: 1 }),
284
+ canApply: (e) => e.can().setHeading({ level: 1 }) || e.can().clearNodes(),
285
+ apply: Re(1)
286
+ },
287
+ {
288
+ type: "heading_2",
289
+ label: "Heading 2",
290
+ Icon: F,
291
+ isActive: (e) => e.isActive("heading", { level: 2 }),
292
+ canApply: (e) => e.can().setHeading({ level: 2 }) || e.can().clearNodes(),
293
+ apply: Re(2)
294
+ },
295
+ {
296
+ type: "heading_3",
297
+ label: "Heading 3",
298
+ Icon: I,
299
+ isActive: (e) => e.isActive("heading", { level: 3 }),
300
+ canApply: (e) => e.can().setHeading({ level: 3 }) || e.can().clearNodes(),
301
+ apply: Re(3)
302
+ },
303
+ {
304
+ type: "heading_4",
305
+ label: "Heading 4",
306
+ Icon: L,
307
+ isActive: (e) => e.isActive("heading", { level: 4 }),
308
+ canApply: (e) => e.can().setHeading({ level: 4 }) || e.can().clearNodes(),
309
+ apply: Re(4)
310
+ },
311
+ {
312
+ type: "heading_5",
313
+ label: "Heading 5",
314
+ Icon: R,
315
+ isActive: (e) => e.isActive("heading", { level: 5 }),
316
+ canApply: (e) => e.can().setHeading({ level: 5 }) || e.can().clearNodes(),
317
+ apply: Re(5)
318
+ },
319
+ {
320
+ type: "heading_6",
321
+ label: "Heading 6",
322
+ Icon: z,
323
+ isActive: (e) => e.isActive("heading", { level: 6 }),
324
+ canApply: (e) => e.can().setHeading({ level: 6 }) || e.can().clearNodes(),
325
+ apply: Re(6)
326
+ },
327
+ {
328
+ type: "bulletList",
329
+ label: "Bullet List",
330
+ Icon: V,
331
+ isActive: (e) => e.isActive("bulletList"),
332
+ canApply: (e) => e.can().toggleBulletList() || e.can().clearNodes(),
333
+ apply: (e) => e.chain().focus().toggleBulletList().run()
334
+ },
335
+ {
336
+ type: "orderedList",
337
+ label: "Ordered List",
338
+ Icon: H,
339
+ isActive: (e) => e.isActive("orderedList"),
340
+ canApply: (e) => e.can().toggleOrderedList() || e.can().clearNodes(),
341
+ apply: (e) => e.chain().focus().toggleOrderedList().run()
342
+ }
343
+ ], Be = (e) => {
344
+ let t = v(19), { editor: n } = e, [r, i] = T(!1), { activeBlock: a, canConvert: o, structural: s } = ge({
345
+ editor: n,
346
+ selector: Ve
347
+ }) ?? {
348
+ activeBlock: null,
349
+ canConvert: !1,
350
+ structural: !1
351
+ }, c = a?.Icon ?? U, l = a?.label ?? "Turn Into", u = s || !o, d, _;
352
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ x(j, { size: 12 }), _ = (e) => {
353
+ e.preventDefault(), i(!0);
354
+ }, t[0] = d, t[1] = _) : (d = t[0], _ = t[1]);
355
+ let y;
356
+ t[2] !== c || t[3] !== u || t[4] !== l ? (y = /* @__PURE__ */ x(h, {
357
+ onPointerDown: He,
358
+ render: /* @__PURE__ */ x($, {
359
+ label: l,
360
+ Icon: c,
361
+ disabled: u,
362
+ trailing: d,
363
+ onClick: _
364
+ })
365
+ }), t[2] = c, t[3] = u, t[4] = l, t[5] = y) : y = t[5];
366
+ let b;
367
+ if (t[6] !== a?.type || t[7] !== n) {
368
+ let e;
369
+ t[9] === a?.type ? e = t[10] : (e = (e) => a?.type !== e.type, t[9] = a?.type, t[10] = e);
370
+ let r;
371
+ t[11] === n ? r = t[12] : (r = (e) => /* @__PURE__ */ S("button", {
372
+ type: "button",
373
+ className: Le,
374
+ disabled: !e.canApply(n),
375
+ onClick: () => {
376
+ e.apply(n), i(!1);
377
+ },
378
+ children: [/* @__PURE__ */ x(e.Icon, { size: 16 }), /* @__PURE__ */ x("span", { children: e.label })]
379
+ }, e.type), t[11] = n, t[12] = r), b = ze.filter(e).map(r), t[6] = a?.type, t[7] = n, t[8] = b;
380
+ } else b = t[8];
381
+ let C;
382
+ t[13] === b ? C = t[14] : (C = /* @__PURE__ */ x(p, { children: /* @__PURE__ */ x(g, {
383
+ side: "bottom",
384
+ align: "start",
385
+ children: /* @__PURE__ */ x(f.Popup, {
386
+ className: Ie,
387
+ children: b
388
+ })
389
+ }) }), t[13] = b, t[14] = C);
390
+ let w;
391
+ return t[15] !== r || t[16] !== y || t[17] !== C ? (w = /* @__PURE__ */ S(m, {
392
+ open: r,
393
+ onOpenChange: i,
394
+ children: [y, C]
395
+ }), t[15] = r, t[16] = y, t[17] = C, t[18] = w) : w = t[18], w;
396
+ };
397
+ function Ve(e) {
398
+ let { editor: t } = e;
399
+ return {
400
+ activeBlock: ze.find((e) => e.isActive(t)) ?? null,
401
+ canConvert: we(t, xe),
402
+ structural: Ce(t)
403
+ };
404
+ }
405
+ function He(e) {
406
+ return e.preventDefault();
407
+ }
408
+ //#endregion
409
+ //#region ../../libraries/react-collection/dist/components/editor/Toolbar.js
410
+ var Ue = [
411
+ {
412
+ mark: "bold",
413
+ label: "Bold",
414
+ Icon: A
415
+ },
416
+ {
417
+ mark: "italic",
418
+ label: "Italic",
419
+ Icon: B
420
+ },
421
+ {
422
+ mark: "underline",
423
+ label: "Underline",
424
+ Icon: X
425
+ },
426
+ {
427
+ mark: "strike",
428
+ label: "Strike",
429
+ Icon: K
430
+ },
431
+ {
432
+ mark: "code",
433
+ label: "Code",
434
+ Icon: M
435
+ }
436
+ ], We = [{
437
+ mark: "superscript",
438
+ label: "Superscript",
439
+ Icon: J
440
+ }, {
441
+ mark: "subscript",
442
+ label: "Subscript",
443
+ Icon: q
444
+ }], Ge = [
445
+ {
446
+ align: "left",
447
+ label: "Align left",
448
+ Icon: O
449
+ },
450
+ {
451
+ align: "center",
452
+ label: "Align center",
453
+ Icon: E
454
+ },
455
+ {
456
+ align: "right",
457
+ label: "Align right",
458
+ Icon: ee
459
+ },
460
+ {
461
+ align: "justify",
462
+ label: "Align justify",
463
+ Icon: D
464
+ }
465
+ ], Ke = (e) => {
466
+ let t = v(9), { editor: n, mark: r, label: i, Icon: a } = e, { isActive: o, canExecute: s } = ge({
467
+ editor: n,
468
+ selector: (e) => {
469
+ let { editor: t } = e;
470
+ return {
471
+ isActive: t.isActive(r),
472
+ canExecute: t.isEditable && t.can().toggleMark(r)
473
+ };
474
+ }
475
+ }) ?? {
476
+ isActive: !1,
477
+ canExecute: !1
478
+ }, c = !s, l;
479
+ t[0] !== n || t[1] !== r ? (l = () => n.chain().focus().toggleMark(r).run(), t[0] = n, t[1] = r, t[2] = l) : l = t[2];
480
+ let u;
481
+ return t[3] !== a || t[4] !== o || t[5] !== i || t[6] !== c || t[7] !== l ? (u = /* @__PURE__ */ x($, {
482
+ label: i,
483
+ Icon: a,
484
+ isActive: o,
485
+ disabled: c,
486
+ onClick: l
487
+ }), t[3] = a, t[4] = o, t[5] = i, t[6] = c, t[7] = l, t[8] = u) : u = t[8], u;
488
+ }, qe = (e) => {
489
+ let t = v(9), { editor: n, align: r, label: i, Icon: a } = e, { isActive: o, canExecute: s } = ge({
490
+ editor: n,
491
+ selector: (e) => {
492
+ let { editor: t } = e;
493
+ return {
494
+ isActive: t.isActive({ textAlign: r }),
495
+ canExecute: t.isEditable && t.can().setNodeTextAlign(r)
496
+ };
497
+ }
498
+ }) ?? {
499
+ isActive: !1,
500
+ canExecute: !1
501
+ }, c = !s, l;
502
+ t[0] !== r || t[1] !== n ? (l = () => n.chain().focus().setNodeTextAlign(r).run(), t[0] = r, t[1] = n, t[2] = l) : l = t[2];
503
+ let u;
504
+ return t[3] !== a || t[4] !== o || t[5] !== i || t[6] !== c || t[7] !== l ? (u = /* @__PURE__ */ x($, {
505
+ label: i,
506
+ Icon: a,
507
+ isActive: o,
508
+ disabled: c,
509
+ onClick: l
510
+ }), t[3] = a, t[4] = o, t[5] = i, t[6] = c, t[7] = l, t[8] = u) : u = t[8], u;
511
+ }, Je = (e) => {
512
+ let t = v(5), { editor: n } = e, r = !(ge({
513
+ editor: n,
514
+ selector: Qe
515
+ }) ?? !1), i;
516
+ t[0] === n ? i = t[1] : (i = () => n.chain().focus().undo().run(), t[0] = n, t[1] = i);
517
+ let a;
518
+ return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ x($, {
519
+ label: "Undo",
520
+ Icon: te,
521
+ disabled: r,
522
+ onClick: i
523
+ }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
524
+ }, Ye = (e) => {
525
+ let t = v(5), { editor: n } = e, r = !(ge({
526
+ editor: n,
527
+ selector: $e
528
+ }) ?? !1), i;
529
+ t[0] === n ? i = t[1] : (i = () => n.chain().focus().redo().run(), t[0] = n, t[1] = i);
530
+ let a;
531
+ return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ x($, {
532
+ label: "Redo",
533
+ Icon: k,
534
+ disabled: r,
535
+ onClick: i
536
+ }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
537
+ }, Xe = (e) => {
538
+ let t = v(5), { editor: n } = e, r = !(ge({
539
+ editor: n,
540
+ selector: et
541
+ }) ?? !1), i;
542
+ t[0] === n ? i = t[1] : (i = () => Oe(n), t[0] = n, t[1] = i);
543
+ let a;
544
+ return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ x($, {
545
+ label: "Reset formatting",
546
+ Icon: G,
547
+ disabled: r,
548
+ onClick: i
549
+ }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
550
+ }, Ze = (t) => {
551
+ let n = v(33), { children: r } = t, { editor: i } = me();
552
+ if (!i) return null;
553
+ let a;
554
+ n[0] === i ? a = n[1] : (a = /* @__PURE__ */ x("div", {
555
+ className: ye,
556
+ children: /* @__PURE__ */ x(Be, { editor: i })
557
+ }), n[0] = i, n[1] = a);
558
+ let o;
559
+ n[2] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ x(e, { orientation: "vertical" }), n[2] = o) : o = n[2];
560
+ let s;
561
+ n[3] === i ? s = n[4] : (s = Ue.map((e) => /* @__PURE__ */ x(Ke, {
562
+ editor: i,
563
+ ...e
564
+ }, e.mark)), n[3] = i, n[4] = s);
565
+ let c;
566
+ n[5] === s ? c = n[6] : (c = /* @__PURE__ */ x("div", {
567
+ className: ye,
568
+ children: s
569
+ }), n[5] = s, n[6] = c);
570
+ let l;
571
+ n[7] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ x(e, { orientation: "vertical" }), n[7] = l) : l = n[7];
572
+ let u;
573
+ n[8] === i ? u = n[9] : (u = /* @__PURE__ */ x("div", {
574
+ className: ye,
575
+ children: /* @__PURE__ */ x(Ne, { editor: i })
576
+ }), n[8] = i, n[9] = u);
577
+ let d;
578
+ n[10] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ x(e, { orientation: "vertical" }), n[10] = d) : d = n[10];
579
+ let f;
580
+ n[11] === i ? f = n[12] : (f = Ge.map((e) => /* @__PURE__ */ x(qe, {
581
+ editor: i,
582
+ ...e
583
+ }, e.align)), n[11] = i, n[12] = f);
584
+ let p;
585
+ n[13] === f ? p = n[14] : (p = /* @__PURE__ */ x("div", {
586
+ className: ye,
587
+ children: f
588
+ }), n[13] = f, n[14] = p);
589
+ let m;
590
+ n[15] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ x(e, { orientation: "vertical" }), n[15] = m) : m = n[15];
591
+ let h;
592
+ n[16] === i ? h = n[17] : (h = We.map((e) => /* @__PURE__ */ x(Ke, {
593
+ editor: i,
594
+ ...e
595
+ }, e.mark)), n[16] = i, n[17] = h);
596
+ let g;
597
+ n[18] === h ? g = n[19] : (g = /* @__PURE__ */ x("div", {
598
+ className: ye,
599
+ children: h
600
+ }), n[18] = h, n[19] = g);
601
+ let _;
602
+ n[20] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ x(e, { orientation: "vertical" }), n[20] = _) : _ = n[20];
603
+ let y;
604
+ n[21] === i ? y = n[22] : (y = /* @__PURE__ */ S("div", {
605
+ className: ye,
606
+ children: [
607
+ /* @__PURE__ */ x(Xe, { editor: i }),
608
+ /* @__PURE__ */ x(Je, { editor: i }),
609
+ /* @__PURE__ */ x(Ye, { editor: i })
610
+ ]
611
+ }), n[21] = i, n[22] = y);
612
+ let C;
613
+ n[23] === r ? C = n[24] : (C = r && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(e, { orientation: "vertical" }), /* @__PURE__ */ x("div", {
614
+ className: "_261ja31",
615
+ children: r
616
+ })] }), n[23] = r, n[24] = C);
617
+ let w;
618
+ return n[25] !== a || n[26] !== g || n[27] !== y || n[28] !== C || n[29] !== c || n[30] !== u || n[31] !== p ? (w = /* @__PURE__ */ S("div", {
619
+ className: ve,
620
+ children: [
621
+ a,
622
+ o,
623
+ c,
624
+ l,
625
+ u,
626
+ d,
627
+ p,
628
+ m,
629
+ g,
630
+ _,
631
+ y,
632
+ C
633
+ ]
634
+ }), n[25] = a, n[26] = g, n[27] = y, n[28] = C, n[29] = c, n[30] = u, n[31] = p, n[32] = w) : w = n[32], w;
635
+ };
636
+ function Qe(e) {
637
+ let { editor: t } = e;
638
+ return t.isEditable && t.can().undo();
639
+ }
640
+ function $e(e) {
641
+ let { editor: t } = e;
642
+ return t.isEditable && t.can().redo();
643
+ }
644
+ function et(e) {
645
+ let { editor: t } = e;
646
+ return t.isEditable && ke(t);
647
+ }
648
+ //#endregion
649
+ //#region ../../libraries/react-collection/dist/widgets/richTextWidget/RichTextWidget.cssm.js
650
+ var tt = "_1vx76w30", nt = "_1vx76w33", rt = "_1vx76w34", it = { style: u({ baseSpacing: ".875rem" }) }, at = (r) => {
651
+ let a = v(58), { field: o } = r, [s, c] = T(!1), { key: u, label: f, helper_text: p, readonly: m, placeholder: h } = o, g = u === void 0 ? "" : u, b = f === void 0 ? "" : f, C = p === void 0 ? "" : p, E = m === void 0 ? !1 : m, D;
652
+ a[0] === o ? D = a[1] : (D = t(o), a[0] = o, a[1] = D);
653
+ let O;
654
+ a[2] !== g || a[3] !== D ? (O = {
655
+ name: g,
656
+ rules: D
657
+ }, a[2] = g, a[3] = D, a[4] = O) : O = a[4];
658
+ let { field: ee, fieldState: te } = _(O), { value: k, onBlur: A, onChange: j, disabled: M } = ee, ne = h || "Write something ...", N;
659
+ a[5] === ne ? N = a[6] : (N = _e({ placeholder: ne }), a[5] = ne, a[6] = N);
660
+ let P = k || "", F = !M && !E, I;
661
+ a[7] === Symbol.for("react.memo_cache_sentinel") ? (I = { attributes: {
662
+ autocomplete: "off",
663
+ autocorrect: "off",
664
+ autocapitalize: "off",
665
+ class: l
666
+ } }, a[7] = I) : I = a[7];
667
+ let L;
668
+ a[8] === j ? L = a[9] : (L = (e) => {
669
+ let { editor: t } = e;
670
+ return j(t.getHTML());
671
+ }, a[8] = j, a[9] = L);
672
+ let R;
673
+ a[10] !== P || a[11] !== F || a[12] !== L || a[13] !== N ? (R = {
674
+ extensions: N,
675
+ content: P,
676
+ editable: F,
677
+ editorProps: I,
678
+ onUpdate: L,
679
+ immediatelyRender: !1
680
+ }, a[10] = P, a[11] = F, a[12] = L, a[13] = N, a[14] = R) : R = a[14];
681
+ let z = he(R), B;
682
+ a[15] !== z || a[16] !== s || a[17] !== k ? (B = () => {
683
+ z?.commands && !s && (z.commands.setContent(k || "", { emitUpdate: !1 }), c(!0));
684
+ }, a[15] = z, a[16] = s, a[17] = k, a[18] = B) : B = a[18];
685
+ let re;
686
+ a[19] === k ? re = a[20] : (re = [k], a[19] = k, a[20] = re), w(B, re);
687
+ let V, H;
688
+ a[21] !== M || a[22] !== z || a[23] !== E ? (V = () => {
689
+ z && z.setEditable(!M && !E, !1);
690
+ }, H = [
691
+ z,
692
+ M,
693
+ E
694
+ ], a[21] = M, a[22] = z, a[23] = E, a[24] = V, a[25] = H) : (V = a[24], H = a[25]), w(V, H);
695
+ let U, W;
696
+ a[26] !== z || a[27] !== A ? (U = () => {
697
+ if (z) return z.on("blur", A), () => {
698
+ z.off("blur", A);
699
+ };
700
+ }, W = [z, A], a[26] = z, a[27] = A, a[28] = U, a[29] = W) : (U = a[28], W = a[29]), w(U, W);
701
+ let G = te?.error?.message, K = !!o?.required, q = M && "_1vx76w31", J = E && "_1vx76w32", Y;
702
+ a[30] !== q || a[31] !== J ? (Y = y(tt, q, J), a[30] = q, a[31] = J, a[32] = Y) : Y = a[32];
703
+ let X;
704
+ a[33] === z ? X = a[34] : (X = { editor: z }, a[33] = z, a[34] = X);
705
+ let Z, ie;
706
+ a[35] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ x(Ze, {}), ie = /* @__PURE__ */ x(e, { orientation: "horizontal" }), a[35] = Z, a[36] = ie) : (Z = a[35], ie = a[36]);
707
+ let Q;
708
+ a[37] === z?.commands ? Q = a[38] : (Q = () => z?.commands.focus(), a[37] = z?.commands, a[38] = Q);
709
+ let ae;
710
+ a[39] === z ? ae = a[40] : (ae = /* @__PURE__ */ x(fe, { editor: z }), a[39] = z, a[40] = ae);
711
+ let oe;
712
+ a[41] !== Q || a[42] !== ae ? (oe = /* @__PURE__ */ S("div", {
713
+ className: nt,
714
+ children: [
715
+ Z,
716
+ ie,
717
+ /* @__PURE__ */ x("div", {
718
+ className: rt,
719
+ onClick: Q,
720
+ children: ae
721
+ })
722
+ ]
723
+ }), a[41] = Q, a[42] = ae, a[43] = oe) : oe = a[43];
724
+ let se;
725
+ a[44] !== X || a[45] !== oe ? (se = /* @__PURE__ */ x(d, {
726
+ theme: it,
727
+ children: /* @__PURE__ */ x(i, { children: /* @__PURE__ */ x(pe.Provider, {
728
+ value: X,
729
+ children: oe
730
+ }) })
731
+ }), a[44] = X, a[45] = oe, a[46] = se) : se = a[46];
732
+ let ce;
733
+ a[47] !== Y || a[48] !== se ? (ce = /* @__PURE__ */ x("div", {
734
+ className: Y,
735
+ children: se
736
+ }), a[47] = Y, a[48] = se, a[49] = ce) : ce = a[49];
737
+ let le;
738
+ return a[50] !== C || a[51] !== g || a[52] !== b || a[53] !== E || a[54] !== G || a[55] !== K || a[56] !== ce ? (le = /* @__PURE__ */ x(n, {
739
+ error: G,
740
+ helperText: C,
741
+ readOnly: E,
742
+ label: b,
743
+ htmlFor: g,
744
+ isRequired: K,
745
+ children: ce
746
+ }), a[50] = C, a[51] = g, a[52] = b, a[53] = E, a[54] = G, a[55] = K, a[56] = ce, a[57] = le) : le = a[57], le;
747
+ };
748
+ //#endregion
749
+ export { at as RichTextWidget, at as default };