@ryuzaki13/react-foundation-ui 3.1.7 → 3.1.8

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 (28) hide show
  1. package/dist/chunks/{TextEditorLexicalClient-C5AV8Fcu.js → TextEditorLexicalClient-C8nSoz85.js} +321 -266
  2. package/dist/chunks/TextEditorLexicalClient-C8nSoz85.js.map +1 -0
  3. package/dist/text-editor/LinkDialog.d.ts.map +1 -1
  4. package/dist/text-editor/SemanticDialog.d.ts.map +1 -1
  5. package/dist/text-editor/TextEditorDialogs.d.ts +7 -6
  6. package/dist/text-editor/TextEditorDialogs.d.ts.map +1 -1
  7. package/dist/text-editor/TimeDialog.d.ts +1 -6
  8. package/dist/text-editor/TimeDialog.d.ts.map +1 -1
  9. package/dist/text-editor/index.js +1 -1
  10. package/dist/text-editor/lib/selection/findSelectedInlineNode.d.ts +4 -0
  11. package/dist/text-editor/lib/selection/findSelectedInlineNode.d.ts.map +1 -0
  12. package/dist/text-editor/lib/selection/{restoreLinkDialogSelection.d.ts → restoreEditorDialogSelection.d.ts} +4 -4
  13. package/dist/text-editor/lib/selection/restoreEditorDialogSelection.d.ts.map +1 -0
  14. package/dist/text-editor/lib/semantic/getTimeDialogInitialState.d.ts +4 -0
  15. package/dist/text-editor/lib/semantic/getTimeDialogInitialState.d.ts.map +1 -0
  16. package/dist/text-editor/lib/semantic/isSemanticDateTime.d.ts +3 -0
  17. package/dist/text-editor/lib/semantic/isSemanticDateTime.d.ts.map +1 -0
  18. package/dist/text-editor/model/hooks/useTextEditorLexicalActions.d.ts +3 -2
  19. package/dist/text-editor/model/hooks/useTextEditorLexicalActions.d.ts.map +1 -1
  20. package/dist/text-editor/model/semanticDialogState.d.ts +6 -0
  21. package/dist/text-editor/model/semanticDialogState.d.ts.map +1 -0
  22. package/dist/text-editor/model/timeDialogState.d.ts +8 -0
  23. package/dist/text-editor/model/timeDialogState.d.ts.map +1 -0
  24. package/dist/text-editor/semanticTagConfigs.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/storybook-static/project.json +1 -1
  27. package/dist/chunks/TextEditorLexicalClient-C5AV8Fcu.js.map +0 -1
  28. package/dist/text-editor/lib/selection/restoreLinkDialogSelection.d.ts.map +0 -1
@@ -8,31 +8,31 @@ import { a as c, i as l, n as u, r as d, t as f } from "./types-D9Wj9wrg.js";
8
8
  import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
9
9
  import { cn as v } from "@ryuzaki13/react-foundation-lib/utils";
10
10
  import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
11
- import { AlignCenter as S, AlignJustify as C, AlignLeft as w, AlignRight as T, AtSign as E, BookType as D, BrushCleaning as O, Clock as k, ExternalLink as A, Languages as ee, Link as te, MessageSquareQuote as ne, Phone as re, PictureInPicture as ie, Redo as ae, Shredder as oe, Undo as se } from "lucide-react";
12
- import { formatPhone as ce } from "@ryuzaki13/react-foundation-lib/formatters";
13
- import { isSafe as j, validateUrl as le } from "@ryuzaki13/react-foundation-lib/validators";
14
- import { $generateHtmlFromNodes as ue, $generateNodesFromDOM as de } from "@lexical/html";
15
- import { $isListItemNode as fe, $isListNode as M, INSERT_ORDERED_LIST_COMMAND as pe, INSERT_UNORDERED_LIST_COMMAND as me, ListItemNode as he, ListNode as ge, REMOVE_LIST_COMMAND as N } from "@lexical/list";
16
- import { LexicalComposer as _e } from "@lexical/react/LexicalComposer";
17
- import { ContentEditable as ve } from "@lexical/react/LexicalContentEditable";
18
- import { LexicalErrorBoundary as ye } from "@lexical/react/LexicalErrorBoundary";
19
- import { HistoryPlugin as be } from "@lexical/react/LexicalHistoryPlugin";
20
- import { ListPlugin as xe } from "@lexical/react/LexicalListPlugin";
21
- import { OnChangePlugin as Se } from "@lexical/react/LexicalOnChangePlugin";
22
- import { RichTextPlugin as Ce } from "@lexical/react/LexicalRichTextPlugin";
23
- import { $createHeadingNode as we, $createQuoteNode as Te, $isHeadingNode as Ee, $isQuoteNode as De, HeadingNode as Oe, QuoteNode as ke } from "@lexical/rich-text";
24
- import { useLexicalComposerContext as P } from "@lexical/react/LexicalComposerContext";
25
- import { $applyNodeReplacement as F, $createParagraphNode as I, $createTextNode as L, $getNodeByKey as Ae, $getRoot as R, $getSelection as z, $isElementNode as je, $isRangeSelection as B, $isTextNode as Me, $setSelection as Ne, ElementNode as Pe, FORMAT_ELEMENT_COMMAND as Fe, FORMAT_TEXT_COMMAND as Ie, HISTORY_MERGE_TAG as Le, HISTORY_PUSH_TAG as Re, REDO_COMMAND as ze, SKIP_DOM_SELECTION_TAG as Be, UNDO_COMMAND as Ve } from "lexical";
26
- import { $isLinkNode as V, LinkNode as He } from "@lexical/link";
27
- import { $setBlocksType as H } from "@lexical/selection";
28
- import { $findMatchingParent as Ue } from "@lexical/utils";
29
- var U = {
11
+ import { AlignCenter as S, AlignJustify as C, AlignLeft as w, AlignRight as T, AtSign as E, BookType as D, BrushCleaning as O, Clock as k, ExternalLink as ee, Languages as te, Link as ne, MessageSquareQuote as re, Phone as ie, PictureInPicture as ae, Redo as oe, Shredder as se, Undo as ce } from "lucide-react";
12
+ import { formatPhone as le, parseDate as A } from "@ryuzaki13/react-foundation-lib/formatters";
13
+ import { isSafe as j, validateUrl as ue } from "@ryuzaki13/react-foundation-lib/validators";
14
+ import { $generateHtmlFromNodes as de, $generateNodesFromDOM as fe } from "@lexical/html";
15
+ import { $isListItemNode as pe, $isListNode as me, INSERT_ORDERED_LIST_COMMAND as he, INSERT_UNORDERED_LIST_COMMAND as ge, ListItemNode as _e, ListNode as ve, REMOVE_LIST_COMMAND as ye } from "@lexical/list";
16
+ import { LexicalComposer as be } from "@lexical/react/LexicalComposer";
17
+ import { ContentEditable as xe } from "@lexical/react/LexicalContentEditable";
18
+ import { LexicalErrorBoundary as Se } from "@lexical/react/LexicalErrorBoundary";
19
+ import { HistoryPlugin as Ce } from "@lexical/react/LexicalHistoryPlugin";
20
+ import { ListPlugin as we } from "@lexical/react/LexicalListPlugin";
21
+ import { OnChangePlugin as Te } from "@lexical/react/LexicalOnChangePlugin";
22
+ import { RichTextPlugin as Ee } from "@lexical/react/LexicalRichTextPlugin";
23
+ import { $createHeadingNode as De, $createQuoteNode as Oe, $isHeadingNode as ke, $isQuoteNode as Ae, HeadingNode as je, QuoteNode as Me } from "@lexical/rich-text";
24
+ import { useLexicalComposerContext as Ne } from "@lexical/react/LexicalComposerContext";
25
+ import { $applyNodeReplacement as Pe, $createParagraphNode as M, $createTextNode as N, $getNodeByKey as P, $getRoot as F, $getSelection as I, $isElementNode as Fe, $isRangeSelection as L, $isTextNode as Ie, $setSelection as Le, ElementNode as Re, FORMAT_ELEMENT_COMMAND as ze, FORMAT_TEXT_COMMAND as Be, HISTORY_MERGE_TAG as R, HISTORY_PUSH_TAG as z, REDO_COMMAND as Ve, SKIP_DOM_SELECTION_TAG as B, UNDO_COMMAND as He } from "lexical";
26
+ import { $isLinkNode as Ue, LinkNode as We } from "@lexical/link";
27
+ import { $setBlocksType as V } from "@lexical/selection";
28
+ import { $findMatchingParent as Ge } from "@lexical/utils";
29
+ var H = {
30
30
  toolbar: "shIOqq",
31
31
  groupControls: "YM-4Dq"
32
32
  };
33
33
  //#endregion
34
34
  //#region src/text-editor/toolbar/ToolbarControl.tsx
35
- function W({ isActive: t, disabled: n, style: r, title: i, icon: a, onClick: o }) {
35
+ function U({ isActive: t, disabled: n, style: r, title: i, icon: a, onClick: o }) {
36
36
  return /* @__PURE__ */ b(e, {
37
37
  title: i,
38
38
  disabled: n,
@@ -47,29 +47,29 @@ function W({ isActive: t, disabled: n, style: r, title: i, icon: a, onClick: o }
47
47
  }
48
48
  //#endregion
49
49
  //#region src/text-editor/toolbar/AlignmentControls.tsx
50
- function We({ onAlignmentChange: e, activeAlignment: t }) {
50
+ function Ke({ onAlignmentChange: e, activeAlignment: t }) {
51
51
  return /* @__PURE__ */ x("div", {
52
- className: U.groupControls,
52
+ className: H.groupControls,
53
53
  children: [
54
- /* @__PURE__ */ b(W, {
54
+ /* @__PURE__ */ b(U, {
55
55
  title: "По левому краю",
56
56
  icon: /* @__PURE__ */ b(w, {}),
57
57
  isActive: t === "left",
58
58
  onClick: () => e("left")
59
59
  }),
60
- /* @__PURE__ */ b(W, {
60
+ /* @__PURE__ */ b(U, {
61
61
  title: "По центру",
62
62
  icon: /* @__PURE__ */ b(S, {}),
63
63
  isActive: t === "center",
64
64
  onClick: () => e("center")
65
65
  }),
66
- /* @__PURE__ */ b(W, {
66
+ /* @__PURE__ */ b(U, {
67
67
  title: "По правому краю",
68
68
  icon: /* @__PURE__ */ b(T, {}),
69
69
  isActive: t === "right",
70
70
  onClick: () => e("right")
71
71
  }),
72
- /* @__PURE__ */ b(W, {
72
+ /* @__PURE__ */ b(U, {
73
73
  title: "По ширине",
74
74
  icon: /* @__PURE__ */ b(C, {}),
75
75
  isActive: t === "justify",
@@ -80,44 +80,44 @@ function We({ onAlignmentChange: e, activeAlignment: t }) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/text-editor/toolbar/HistoryControls.tsx
83
- function Ge({ onUndo: e, onRedo: t }) {
83
+ function qe({ onUndo: e, onRedo: t }) {
84
84
  return /* @__PURE__ */ x("div", {
85
- className: U.groupControls,
86
- children: [/* @__PURE__ */ b(W, {
85
+ className: H.groupControls,
86
+ children: [/* @__PURE__ */ b(U, {
87
87
  title: "Отменить последнее действие",
88
- icon: /* @__PURE__ */ b(se, {}),
88
+ icon: /* @__PURE__ */ b(ce, {}),
89
89
  onClick: e
90
- }), /* @__PURE__ */ b(W, {
90
+ }), /* @__PURE__ */ b(U, {
91
91
  title: "Повторить предыдущее действие",
92
- icon: /* @__PURE__ */ b(ae, {}),
92
+ icon: /* @__PURE__ */ b(oe, {}),
93
93
  onClick: t
94
94
  })]
95
95
  });
96
96
  }
97
97
  //#endregion
98
98
  //#region src/text-editor/toolbar/LinkButtons.tsx
99
- function Ke({ disabled: e, onClick: t }) {
99
+ function Je({ disabled: e, onClick: t }) {
100
100
  return /* @__PURE__ */ x("div", {
101
- className: U.groupControls,
101
+ className: H.groupControls,
102
102
  children: [
103
- /* @__PURE__ */ b(W, {
103
+ /* @__PURE__ */ b(U, {
104
104
  title: "Добавить ссылку на статью",
105
- icon: /* @__PURE__ */ b(te, {}),
105
+ icon: /* @__PURE__ */ b(ne, {}),
106
106
  onClick: () => t(f.LOCAL_LINK)
107
107
  }),
108
- /* @__PURE__ */ b(W, {
108
+ /* @__PURE__ */ b(U, {
109
109
  title: "Добавить ссылку",
110
110
  disabled: e,
111
- icon: /* @__PURE__ */ b(A, {}),
111
+ icon: /* @__PURE__ */ b(ee, {}),
112
112
  onClick: () => t(f.LINK)
113
113
  }),
114
- /* @__PURE__ */ b(W, {
114
+ /* @__PURE__ */ b(U, {
115
115
  title: "Добавить телефон",
116
116
  disabled: e,
117
- icon: /* @__PURE__ */ b(re, {}),
117
+ icon: /* @__PURE__ */ b(ie, {}),
118
118
  onClick: () => t(f.PHONE)
119
119
  }),
120
- /* @__PURE__ */ b(W, {
120
+ /* @__PURE__ */ b(U, {
121
121
  title: "Добавить email",
122
122
  disabled: e,
123
123
  icon: /* @__PURE__ */ b(E, {}),
@@ -128,38 +128,38 @@ function Ke({ disabled: e, onClick: t }) {
128
128
  }
129
129
  //#endregion
130
130
  //#region src/text-editor/toolbar/TagButtons.tsx
131
- function qe({ onClick: e }) {
131
+ function Ye({ onClick: e }) {
132
132
  return /* @__PURE__ */ x("div", {
133
- className: U.groupControls,
133
+ className: H.groupControls,
134
134
  children: [
135
- /* @__PURE__ */ b(W, {
135
+ /* @__PURE__ */ b(U, {
136
136
  title: "Вставить Аббревиатуру",
137
137
  icon: /* @__PURE__ */ b(D, {}),
138
138
  onClick: () => e(u.abbr)
139
139
  }),
140
- /* @__PURE__ */ b(W, {
140
+ /* @__PURE__ */ b(U, {
141
141
  title: "Вставить Код языка",
142
- icon: /* @__PURE__ */ b(ee, {}),
142
+ icon: /* @__PURE__ */ b(te, {}),
143
143
  onClick: () => e(u.lang)
144
144
  }),
145
- /* @__PURE__ */ b(W, {
145
+ /* @__PURE__ */ b(U, {
146
146
  title: "Вставить Дату/время",
147
147
  icon: /* @__PURE__ */ b(k, {}),
148
148
  onClick: () => e(u.time)
149
149
  }),
150
- /* @__PURE__ */ b(W, {
150
+ /* @__PURE__ */ b(U, {
151
151
  title: "Вставить Ссылку на источник",
152
- icon: /* @__PURE__ */ b(ne, {}),
152
+ icon: /* @__PURE__ */ b(re, {}),
153
153
  onClick: () => e(u.cite)
154
154
  }),
155
- /* @__PURE__ */ b(W, {
155
+ /* @__PURE__ */ b(U, {
156
156
  title: "Вставить Удалённый фрагмент",
157
- icon: /* @__PURE__ */ b(oe, {}),
157
+ icon: /* @__PURE__ */ b(se, {}),
158
158
  onClick: () => e(u.del)
159
159
  }),
160
- /* @__PURE__ */ b(W, {
160
+ /* @__PURE__ */ b(U, {
161
161
  title: "Вставить Добавленный фрагмент",
162
- icon: /* @__PURE__ */ b(ie, {}),
162
+ icon: /* @__PURE__ */ b(ae, {}),
163
163
  onClick: () => e(u.ins)
164
164
  })
165
165
  ]
@@ -167,17 +167,17 @@ function qe({ onClick: e }) {
167
167
  }
168
168
  //#endregion
169
169
  //#region src/text-editor/toolbar/TextEditorToolbarLexical.tsx
170
- function Je({ toolbarComponents: e, state: t, onBlockStyleToggle: n, onInlineStyleToggle: r, onAlignmentChange: i, onLinkClick: a, onTagClick: o, onUndo: s, onRedo: c, onCleanTag: u }) {
170
+ function Xe({ toolbarComponents: e, state: t, onBlockStyleToggle: n, onInlineStyleToggle: r, onAlignmentChange: i, onLinkClick: a, onTagClick: o, onUndo: s, onRedo: c, onCleanTag: u }) {
171
171
  let f = {
172
172
  history: !0,
173
173
  ...e || {}
174
174
  };
175
175
  return /* @__PURE__ */ x("div", {
176
- className: U.toolbar,
176
+ className: H.toolbar,
177
177
  children: [
178
178
  f.blocks && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
179
- className: U.groupControls,
180
- children: d.map((e) => /* @__PURE__ */ b(W, {
179
+ className: H.groupControls,
180
+ children: d.map((e) => /* @__PURE__ */ b(U, {
181
181
  isActive: e.style === t.blockType,
182
182
  style: e.style,
183
183
  title: e.label,
@@ -186,8 +186,8 @@ function Je({ toolbarComponents: e, state: t, onBlockStyleToggle: n, onInlineSty
186
186
  }, e.style))
187
187
  }), /* @__PURE__ */ b("hr", {})] }),
188
188
  f.inline && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
189
- className: U.groupControls,
190
- children: l.map((e) => /* @__PURE__ */ b(W, {
189
+ className: H.groupControls,
190
+ children: l.map((e) => /* @__PURE__ */ b(U, {
191
191
  isActive: !!t.activeInlineStyles[e.style],
192
192
  title: e.label,
193
193
  style: e.style,
@@ -196,20 +196,20 @@ function Je({ toolbarComponents: e, state: t, onBlockStyleToggle: n, onInlineSty
196
196
  onClick: r
197
197
  }, e.style))
198
198
  }), /* @__PURE__ */ b("hr", {})] }),
199
- f.alignment && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(We, {
199
+ f.alignment && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Ke, {
200
200
  activeAlignment: t.activeAlignment,
201
201
  onAlignmentChange: i
202
202
  }), /* @__PURE__ */ b("hr", {})] }),
203
- f.links && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Ke, {
203
+ f.links && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Je, {
204
204
  disabled: t.isTextUnselected,
205
205
  onClick: a
206
206
  }), /* @__PURE__ */ b("hr", {})] }),
207
- f.tags && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(qe, { onClick: o }), /* @__PURE__ */ b("hr", {})] }),
208
- f.history && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Ge, {
207
+ f.tags && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Ye, { onClick: o }), /* @__PURE__ */ b("hr", {})] }),
208
+ f.history && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(qe, {
209
209
  onUndo: s,
210
210
  onRedo: c
211
211
  }), /* @__PURE__ */ b("hr", {})] }),
212
- /* @__PURE__ */ b(W, {
212
+ /* @__PURE__ */ b(U, {
213
213
  disabled: t.isTextUnselected,
214
214
  title: "Очистить выбранный тег",
215
215
  icon: /* @__PURE__ */ b(O, {}),
@@ -220,13 +220,13 @@ function Je({ toolbarComponents: e, state: t, onBlockStyleToggle: n, onInlineSty
220
220
  }
221
221
  //#endregion
222
222
  //#region src/text-editor/lexical/plugins/InitialHtmlPlugin.tsx
223
- function Ye({ initialHTML: e, shouldSkip: t }) {
224
- let [n] = P(), r = g(!1);
223
+ function Ze({ initialHTML: e, shouldSkip: t }) {
224
+ let [n] = Ne(), r = g(!1);
225
225
  return m(() => {
226
226
  t || !e || r.current || typeof window > "u" || (r.current = !0, n.update(() => {
227
- let t = R(), r = new DOMParser().parseFromString(e, "text/html"), i = de(n, r);
227
+ let t = F(), r = new DOMParser().parseFromString(e, "text/html"), i = fe(n, r);
228
228
  if (t.clear(), i.length === 0) {
229
- t.append(I());
229
+ t.append(M());
230
230
  return;
231
231
  }
232
232
  t.append(...i);
@@ -239,7 +239,7 @@ function Ye({ initialHTML: e, shouldSkip: t }) {
239
239
  }
240
240
  //#endregion
241
241
  //#region src/text-editor/model/textEditorTypes.ts
242
- var G = {
242
+ var Qe = {
243
243
  blockType: "unstyled",
244
244
  isTextUnselected: !0,
245
245
  activeInlineStyles: {
@@ -251,7 +251,7 @@ var G = {
251
251
  CODE: !1
252
252
  },
253
253
  activeAlignment: null
254
- }, Xe = (e) => {
254
+ }, $e = (e) => {
255
255
  switch (e) {
256
256
  case "h3": return "header-three";
257
257
  case "h4": return "header-four";
@@ -259,7 +259,7 @@ var G = {
259
259
  case "h6": return "header-six";
260
260
  default: return "unstyled";
261
261
  }
262
- }, Ze = (e) => {
262
+ }, et = (e) => {
263
263
  switch (e) {
264
264
  case "header-three": return "h3";
265
265
  case "header-four": return "h4";
@@ -267,7 +267,7 @@ var G = {
267
267
  case "header-six": return "h6";
268
268
  default: return null;
269
269
  }
270
- }, Qe = (e) => {
270
+ }, tt = (e) => {
271
271
  switch (e) {
272
272
  case "BOLD": return "bold";
273
273
  case "ITALIC": return "italic";
@@ -277,18 +277,18 @@ var G = {
277
277
  case "CODE": return "code";
278
278
  default: return null;
279
279
  }
280
- }, $e = () => {
281
- let e = z();
282
- if (!B(e)) return "unstyled";
280
+ }, nt = () => {
281
+ let e = I();
282
+ if (!L(e)) return "unstyled";
283
283
  let t = e.anchor.getNode().getTopLevelElementOrThrow();
284
- if (fe(t)) {
284
+ if (pe(t)) {
285
285
  let e = t.getParent();
286
- if (M(e)) return e.getListType() === "bullet" ? "unordered-list-item" : "ordered-list-item";
286
+ if (me(e)) return e.getListType() === "bullet" ? "unordered-list-item" : "ordered-list-item";
287
287
  }
288
- return M(t) ? t.getListType() === "bullet" ? "unordered-list-item" : "ordered-list-item" : Ee(t) ? Xe(t.getTag()) : De(t) ? "blockquote" : t.getType() === "paragraph" ? "unstyled" : t.getType();
289
- }, et = () => {
290
- let e = z();
291
- if (!B(e)) return null;
288
+ return me(t) ? t.getListType() === "bullet" ? "unordered-list-item" : "ordered-list-item" : ke(t) ? $e(t.getTag()) : Ae(t) ? "blockquote" : t.getType() === "paragraph" ? "unstyled" : t.getType();
289
+ }, rt = () => {
290
+ let e = I();
291
+ if (!L(e)) return null;
292
292
  let t = e.anchor.getNode().getTopLevelElementOrThrow().getFormatType();
293
293
  switch (t) {
294
294
  case "left":
@@ -297,10 +297,10 @@ var G = {
297
297
  case "justify": return t;
298
298
  default: return null;
299
299
  }
300
- }, tt = () => {
301
- let e = z();
302
- return B(e) ? {
303
- blockType: $e(),
300
+ }, it = () => {
301
+ let e = I();
302
+ return L(e) ? {
303
+ blockType: nt(),
304
304
  isTextUnselected: e.isCollapsed(),
305
305
  activeInlineStyles: {
306
306
  BOLD: e.hasFormat("bold"),
@@ -310,16 +310,16 @@ var G = {
310
310
  HIGHLIGHT: e.hasFormat("highlight"),
311
311
  CODE: e.hasFormat("code")
312
312
  },
313
- activeAlignment: et()
314
- } : G;
313
+ activeAlignment: rt()
314
+ } : Qe;
315
315
  };
316
316
  //#endregion
317
317
  //#region src/text-editor/lexical/plugins/SelectionStatePlugin.tsx
318
- function nt({ onEditorReady: e, onStateChange: t }) {
319
- let [n] = P();
318
+ function at({ onEditorReady: e, onStateChange: t }) {
319
+ let [n] = Ne();
320
320
  return m(() => (e(n), n.registerUpdateListener(({ editorState: e }) => {
321
321
  e.read(() => {
322
- t(tt());
322
+ t(it());
323
323
  });
324
324
  })), [
325
325
  n,
@@ -329,34 +329,42 @@ function nt({ onEditorReady: e, onStateChange: t }) {
329
329
  }
330
330
  //#endregion
331
331
  //#region src/text-editor/lib/serialization/createLexicalRaw.ts
332
- var rt = (e) => ({
332
+ var ot = (e) => ({
333
333
  format: "lexical",
334
334
  version: 1,
335
335
  editorState: e.toJSON()
336
336
  });
337
337
  //#endregion
338
- //#region src/text-editor/lib/selection/restoreLinkDialogSelection.ts
339
- function it(e) {
338
+ //#region src/text-editor/lib/selection/findSelectedInlineNode.ts
339
+ function W(e) {
340
+ let t = I();
341
+ if (!L(t)) return null;
342
+ let n = Ge(t.anchor.getNode(), e), r = Ge(t.focus.getNode(), e);
343
+ return n && r && n.is(r) && e(n) ? n : null;
344
+ }
345
+ //#endregion
346
+ //#region src/text-editor/lib/selection/restoreEditorDialogSelection.ts
347
+ function st(e) {
340
348
  if (e && [e.anchor, e.focus].every((e) => {
341
- let t = Ae(e.key);
342
- return !t?.isAttached() || e.offset < 0 ? !1 : e.type === "text" ? Me(t) && e.offset <= t.getTextContentSize() : je(t) && e.offset <= t.getChildrenSize();
349
+ let t = P(e.key);
350
+ return !t?.isAttached() || e.offset < 0 ? !1 : e.type === "text" ? Ie(t) && e.offset <= t.getTextContentSize() : Fe(t) && e.offset <= t.getChildrenSize();
343
351
  })) {
344
352
  let t = e.clone();
345
- return Ne(t), t;
353
+ return Le(t), t;
346
354
  }
347
- let t = R();
348
- return t.isEmpty() && t.append(I()), t.selectEnd();
355
+ let t = F();
356
+ return t.isEmpty() && t.append(M()), t.selectEnd();
349
357
  }
350
358
  //#endregion
351
359
  //#region src/text-editor/lib/semantic/getSemanticTagDepth.ts
352
- var K = (e) => {
360
+ var ct = (e) => {
353
361
  let t = 0, n = e;
354
362
  for (; n;) t += 1, n = n.getParent();
355
363
  return t;
356
- }, at = (e) => {
364
+ }, lt = (e) => {
357
365
  if (!(e instanceof HTMLAnchorElement)) return { node: null };
358
366
  let t = e.textContent;
359
- return (t === null || t === "") && e.children.length === 0 ? { node: null } : { node: J(e.getAttribute("href") || "", {
367
+ return (t === null || t === "") && e.children.length === 0 ? { node: null } : { node: K(e.getAttribute("href") || "", {
360
368
  rel: e.getAttribute("rel"),
361
369
  target: e.getAttribute("target"),
362
370
  title: e.getAttribute("title"),
@@ -365,7 +373,7 @@ var K = (e) => {
365
373
  add: null,
366
374
  text: t
367
375
  }) };
368
- }, q = class e extends He {
376
+ }, G = class e extends We {
369
377
  __ariaLabel;
370
378
  __qrCode;
371
379
  __add;
@@ -391,12 +399,12 @@ var K = (e) => {
391
399
  }
392
400
  static importDOM() {
393
401
  return { a: () => ({
394
- conversion: at,
402
+ conversion: lt,
395
403
  priority: 2
396
404
  }) };
397
405
  }
398
406
  static importJSON(e) {
399
- return J().updateFromJSON(e);
407
+ return K().updateFromJSON(e);
400
408
  }
401
409
  updateFromJSON(e) {
402
410
  return super.updateFromJSON(e).setAriaLabel(e.ariaLabel || null).setQrCode(!!e.qrCode).setAdd(e.add || null).setText(e.text || null);
@@ -424,7 +432,7 @@ var K = (e) => {
424
432
  t instanceof HTMLAnchorElement && ((!e || e.__ariaLabel !== this.__ariaLabel) && (this.__ariaLabel ? t.setAttribute("aria-label", this.__ariaLabel) : t.removeAttribute("aria-label")), (!e || e.__qrCode !== this.__qrCode) && t.setAttribute("data-qr-code", this.__qrCode ? "true" : "false"));
425
433
  }
426
434
  insertNewAfter(e, t = !0) {
427
- let n = J(this.__url, {
435
+ let n = K(this.__url, {
428
436
  rel: this.__rel,
429
437
  target: this.__target,
430
438
  title: this.__title,
@@ -463,12 +471,12 @@ var K = (e) => {
463
471
  let t = this.getWritable();
464
472
  return t.__text = e, this;
465
473
  }
466
- }, J = (e = "", t) => F(new q(e, t)), Y = (e) => e instanceof q, ot = (e) => {
474
+ }, K = (e = "", t) => Pe(new G(e, t)), q = (e) => e instanceof G, ut = (e) => {
467
475
  let t = {};
468
476
  return Array.from(e.attributes).forEach((e) => {
469
477
  e.name !== "class" && (t[e.name] = e.value);
470
478
  }), t;
471
- }, X = (e) => {
479
+ }, J = (e) => {
472
480
  if (!(e instanceof HTMLElement)) return { node: null };
473
481
  let t = e.tagName.toLowerCase();
474
482
  if (![
@@ -480,8 +488,8 @@ var K = (e) => {
480
488
  "ins"
481
489
  ].includes(t)) return { node: null };
482
490
  let n = e.textContent;
483
- return (n === null || n === "") && e.children.length === 0 ? { node: null } : { node: Q(t, ot(e), n) };
484
- }, Z = class e extends Pe {
491
+ return (n === null || n === "") && e.children.length === 0 ? { node: null } : { node: X(t, ut(e), n) };
492
+ }, Y = class e extends Re {
485
493
  __tag;
486
494
  __attributes;
487
495
  __text;
@@ -497,33 +505,33 @@ var K = (e) => {
497
505
  static importDOM() {
498
506
  return {
499
507
  abbr: () => ({
500
- conversion: X,
508
+ conversion: J,
501
509
  priority: 2
502
510
  }),
503
511
  span: () => ({
504
- conversion: X,
512
+ conversion: J,
505
513
  priority: 2
506
514
  }),
507
515
  time: () => ({
508
- conversion: X,
516
+ conversion: J,
509
517
  priority: 2
510
518
  }),
511
519
  cite: () => ({
512
- conversion: X,
520
+ conversion: J,
513
521
  priority: 2
514
522
  }),
515
523
  del: () => ({
516
- conversion: X,
524
+ conversion: J,
517
525
  priority: 2
518
526
  }),
519
527
  ins: () => ({
520
- conversion: X,
528
+ conversion: J,
521
529
  priority: 2
522
530
  })
523
531
  };
524
532
  }
525
533
  static importJSON(e) {
526
- return Q(e.tag, e.attributes, e.text).updateFromJSON(e);
534
+ return X(e.tag, e.attributes, e.text).updateFromJSON(e);
527
535
  }
528
536
  updateFromJSON(e) {
529
537
  return super.updateFromJSON(e).setTag(e.tag).setAttributes(e.attributes || {}).setText(e.text || null);
@@ -559,7 +567,7 @@ var K = (e) => {
559
567
  });
560
568
  }
561
569
  insertNewAfter(e, t = !0) {
562
- let n = Q(this.__tag, this.__attributes, this.__text);
570
+ let n = X(this.__tag, this.__attributes, this.__text);
563
571
  return this.insertAfter(n, t), n;
564
572
  }
565
573
  canInsertTextBefore() {
@@ -595,123 +603,125 @@ var K = (e) => {
595
603
  let t = this.getWritable();
596
604
  return t.__text = e, this;
597
605
  }
598
- }, Q = (e, t = {}, n = null) => F(new Z(e, t, n)), st = (e) => e instanceof Z;
606
+ }, X = (e, t = {}, n = null) => Pe(new Y(e, t, n)), Z = (e) => e instanceof Y;
599
607
  //#endregion
600
608
  //#region src/text-editor/model/hooks/useTextEditorLexicalActions.ts
601
- function ct({ editor: e, toolbarState: t, hasLocalLinkDialog: n, onOpenLinkDialog: r, onOpenTagDialog: i }) {
602
- let a = g(null), o = p((n) => {
609
+ function dt({ editor: e, toolbarState: t, hasLocalLinkDialog: n, onOpenLinkDialog: r, onOpenTagDialog: i }) {
610
+ let a = g(null), o = g(null), [s, c] = _(""), [l, d] = _({
611
+ text: "",
612
+ attributes: {}
613
+ }), m = p((n) => {
603
614
  if (e) {
604
615
  if (n === "unordered-list-item") {
605
616
  if (t.blockType === "unordered-list-item") {
606
- e.dispatchCommand(N, void 0);
617
+ e.dispatchCommand(ye, void 0);
607
618
  return;
608
619
  }
609
- e.dispatchCommand(me, void 0);
620
+ e.dispatchCommand(ge, void 0);
610
621
  return;
611
622
  }
612
623
  if (n === "ordered-list-item") {
613
624
  if (t.blockType === "ordered-list-item") {
614
- e.dispatchCommand(N, void 0);
625
+ e.dispatchCommand(ye, void 0);
615
626
  return;
616
627
  }
617
- e.dispatchCommand(pe, void 0);
628
+ e.dispatchCommand(he, void 0);
618
629
  return;
619
630
  }
620
631
  e.update(() => {
621
- let e = z();
622
- if (!B(e)) return;
632
+ let e = I();
633
+ if (!L(e)) return;
623
634
  if (n === "unstyled" || n === "paragraph") {
624
- H(e, () => I());
635
+ V(e, () => M());
625
636
  return;
626
637
  }
627
638
  if (n === "blockquote") {
628
- H(e, () => Te());
639
+ V(e, () => Oe());
629
640
  return;
630
641
  }
631
- let t = Ze(n);
632
- t && H(e, () => we(t));
642
+ let t = et(n);
643
+ t && V(e, () => De(t));
633
644
  });
634
645
  }
635
- }, [e, t.blockType]), s = p((t) => {
646
+ }, [e, t.blockType]), h = p((t) => {
636
647
  if (!e) return;
637
- let n = Qe(t);
638
- n && e.dispatchCommand(Ie, n);
639
- }, [e]), c = p((t) => {
640
- e && e.dispatchCommand(Fe, t);
641
- }, [e]), l = p(() => {
648
+ let n = tt(t);
649
+ n && e.dispatchCommand(Be, n);
650
+ }, [e]), v = p((t) => {
651
+ e && e.dispatchCommand(ze, t);
652
+ }, [e]), y = p(() => {
653
+ e && e.dispatchCommand(He, void 0);
654
+ }, [e]), b = p(() => {
642
655
  e && e.dispatchCommand(Ve, void 0);
643
- }, [e]), u = p(() => {
644
- e && e.dispatchCommand(ze, void 0);
645
- }, [e]), d = p(() => {
646
- if (!e) return "";
647
- let t = "";
648
- return e.getEditorState().read(() => {
649
- let e = z();
650
- B(e) && (t = e.getTextContent());
651
- }), t;
652
- }, [e]), m = p((t) => {
653
- e && (e.update(() => {
654
- let t = a.current;
655
- it(t?.editor === e ? t.selection : null), a.current = null;
656
+ }, [e]), x = p((t) => {
657
+ if (!e) return;
658
+ let n = a.current;
659
+ a.current = null, e.update(() => {
660
+ st(n?.editor === e ? n.selection : null);
656
661
  }, {
657
662
  discrete: !0,
658
- tag: [Le, Be]
663
+ tag: [R, B]
659
664
  }), e.update(() => {
660
- let e = z();
661
- if (!B(e)) return;
662
- let n = e.getTextContent(), r = t.text.length > 0 ? t.text : n;
663
- if (!r.trim()) return;
664
- let i = J(t.url, {
665
+ let r = I();
666
+ if (!L(r)) return;
667
+ let i = n?.editor === e && n.key ? P(n.key) : null;
668
+ if (q(i) && i.isAttached()) {
669
+ i.setURL(t.url).setAriaLabel(t.ariaLabel).setQrCode(t.qrCode).setAdd(t.add || null), n?.local && t.text !== i.getTextContent() && i.clear().append(N(t.text)), i.setText(i.getTextContent()), i.selectEnd();
670
+ return;
671
+ }
672
+ let a = r.getTextContent(), o = t.text.length > 0 ? t.text : a;
673
+ if (!o.trim()) return;
674
+ let s = K(t.url, {
665
675
  target: "_blank",
666
676
  rel: "noopener noreferrer",
667
- ariaLabel: t.ariaLabel || n || r,
677
+ ariaLabel: t.ariaLabel || a || o,
668
678
  qrCode: t.qrCode,
669
679
  add: t.add || null,
670
- text: r
671
- }), a = L(r);
672
- i.append(a), e.insertNodes([i]);
673
- }, { tag: Re }), requestAnimationFrame(() => {
680
+ text: o
681
+ }), c = N(o);
682
+ s.append(c), r.insertNodes([s]);
683
+ }, { tag: z }), requestAnimationFrame(() => {
674
684
  e.focus();
675
- }));
676
- }, [e]), h = p((e, t, n, r, i) => {
677
- m({
685
+ });
686
+ }, [e]), S = p((e, t, n, r, i) => {
687
+ x({
678
688
  url: e,
679
689
  text: t,
680
690
  add: n,
681
691
  ariaLabel: r,
682
692
  qrCode: i
683
693
  });
684
- }, [m]), _ = p((e, t) => {
685
- m({
694
+ }, [x]), C = p((e, t) => {
695
+ x({
686
696
  url: e,
687
697
  text: t,
688
698
  add: "",
689
699
  ariaLabel: "Внутренняя ссылка на статью: " + t,
690
700
  qrCode: !1
691
701
  });
692
- }, [m]), v = p(() => {
702
+ }, [x]), w = p(() => {
693
703
  if (!e) return "";
694
704
  let t = "";
695
705
  return e.getEditorState().read(() => {
696
- let e = z();
697
- if (!B(e)) {
706
+ let e = I();
707
+ if (!L(e)) {
698
708
  t = "";
699
709
  return;
700
710
  }
701
- let n = e.getTextContent(), r = e.anchor.getNode(), i = Ue(r, (e) => Y(e) || V(e));
702
- if (Y(i)) {
711
+ let n = e.getTextContent(), r = W(Ue);
712
+ if (q(r)) {
703
713
  t = {
704
- url: i.getURL(),
705
- ariaLabel: i.getAriaLabel() || "",
706
- text: i.getText() || n,
707
- add: i.getAdd() || "",
708
- qrCode: i.getQrCode()
714
+ url: r.getURL(),
715
+ ariaLabel: r.getAriaLabel() || "",
716
+ text: r.getText() || n,
717
+ add: r.getAdd() || "",
718
+ qrCode: r.getQrCode()
709
719
  };
710
720
  return;
711
721
  }
712
- if (V(i)) {
722
+ if (Ue(r)) {
713
723
  t = {
714
- url: i.getURL(),
724
+ url: r.getURL(),
715
725
  ariaLabel: "",
716
726
  text: n,
717
727
  add: "",
@@ -721,61 +731,81 @@ function ct({ editor: e, toolbarState: t, hasLocalLinkDialog: n, onOpenLinkDialo
721
731
  }
722
732
  t = n;
723
733
  }), t;
724
- }, [e]), y = p((t) => {
734
+ }, [e]), T = p((t) => {
725
735
  t === f.LOCAL_LINK && !n || e && (e.getEditorState().read(() => {
726
- let t = z();
736
+ let n = I();
727
737
  a.current = {
728
738
  editor: e,
729
- selection: B(t) ? t.clone() : null
739
+ selection: L(n) ? n.clone() : null,
740
+ key: W(q)?.getKey() ?? null,
741
+ local: t === f.LOCAL_LINK
730
742
  };
731
- }), r(t));
743
+ }), c(w()), r(t));
732
744
  }, [
733
745
  e,
734
746
  n,
735
- r
736
- ]), b = p((t, n, r) => {
737
- e && (e.update(() => {
738
- let e = z();
739
- if (!B(e)) return;
740
- let i = e.getTextContent().trim(), a = n || i || r.title || r["aria-label"] || Object.values(r).join(" ") || t;
741
- if (!a.trim()) return;
742
- let o = Q(t, r, a);
743
- o.append(L(a)), e.insertNodes([o]);
744
- }), requestAnimationFrame(() => {
745
- e.focus();
746
- }));
747
+ r,
748
+ w
749
+ ]), E = p((t, n, r) => {
750
+ if (!e) return;
751
+ let i = o.current;
752
+ o.current = null, e.update(() => {
753
+ st(i?.editor === e ? i.selection : null);
754
+ }, {
755
+ discrete: !0,
756
+ tag: [R, B]
757
+ }), e.update(() => {
758
+ let a = I();
759
+ if (!L(a) || !n.trim()) return;
760
+ let o = i?.editor === e && i.key ? P(i.key) : null;
761
+ if (Z(o) && o.isAttached() && o.getTag() === t) o.setAttributes(r).setText(n), n !== o.getTextContent() && o.clear().append(N(n)), o.selectEnd();
762
+ else {
763
+ let e = X(t, r, n), i = N(n);
764
+ i.setFormat(a.format).setStyle(a.style), e.append(i), a.insertNodes([e]);
765
+ }
766
+ }, { tag: z }), requestAnimationFrame(() => e.focus());
747
767
  }, [e]);
748
768
  return {
749
- handleAddLink: h,
750
- handleAddLocalLink: _,
751
- handleAlignmentChange: c,
752
- handleBlockStyleToggle: o,
769
+ handleAddLink: S,
770
+ handleAddLocalLink: C,
771
+ handleAlignmentChange: v,
772
+ handleBlockStyleToggle: m,
753
773
  handleCleanSemanticTag: p(() => {
754
774
  e && e.update(() => {
755
- let e = z();
756
- if (!B(e) || e.isCollapsed()) return;
775
+ let e = I();
776
+ if (!L(e) || e.isCollapsed()) return;
757
777
  let t = e.getNodes(), n = /* @__PURE__ */ new Set();
758
778
  t.forEach((e) => {
759
779
  let t = e;
760
- for (; t;) st(t) && n.add(t), t = t.getParent();
761
- }), Array.from(n).sort((e, t) => K(t) - K(e)).forEach((e) => {
780
+ for (; t;) Z(t) && n.add(t), t = t.getParent();
781
+ }), Array.from(n).sort((e, t) => ct(t) - ct(e)).forEach((e) => {
762
782
  e.isAttached() && (e.getChildren().forEach((t) => e.insertBefore(t)), e.remove());
763
783
  });
764
784
  });
765
785
  }, [e]),
766
- handleInlineStyleToggle: s,
767
- handleLinkClick: y,
768
- handleRedo: u,
769
- handleTagClick: p((e) => {
770
- i(e);
771
- }, [i]),
772
- handleUndo: l,
773
- getCurrentSelectionText: d,
774
- getSelectedLinkState: v,
775
- insertSemanticTagAtSelection: b
786
+ handleInlineStyleToggle: h,
787
+ handleLinkClick: T,
788
+ handleRedo: b,
789
+ handleTagClick: p((t) => {
790
+ e && (e.getEditorState().read(() => {
791
+ let n = I(), r = W(Z), i = r?.getTag() === (t === u.lang ? "span" : t) ? r : null;
792
+ o.current = {
793
+ editor: e,
794
+ selection: L(n) ? n.clone() : null,
795
+ key: i?.getKey() ?? null
796
+ }, d({
797
+ text: i?.getTextContent() ?? (L(n) ? n.getTextContent() : ""),
798
+ attributes: { ...i?.getAttributes() }
799
+ });
800
+ }), i(t));
801
+ }, [e, i]),
802
+ handleUndo: y,
803
+ semanticDialogState: l,
804
+ linkDialogState: s,
805
+ insertSemanticTagAtSelection: E
776
806
  };
777
807
  }
778
- var $ = {
808
+ var Q = {
779
809
  textEditor: "_75LW3N",
780
810
  textEditorContent: "PLiHsN",
781
811
  focused: "m-jmCu",
@@ -783,13 +813,13 @@ var $ = {
783
813
  };
784
814
  //#endregion
785
815
  //#region src/text-editor/EmailDialog.tsx
786
- function lt({ onClose: t, onConfirm: o, initialState: s }) {
816
+ function ft({ onClose: t, onConfirm: o, initialState: s }) {
787
817
  let c = j(s) && typeof s == "string" ? {
788
818
  text: "",
789
819
  add: "",
790
820
  ariaLabel: "",
791
821
  url: s
792
- } : s, [l, u] = _(() => j(c) ? c.url ?? "" : ""), [d, f] = _(() => j(c) ? c.ariaLabel ?? "" : ""), [p, m] = _(null), h = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) ? !0 : (m("Некорректный email адрес"), !1), g = (e) => {
822
+ } : s, [l, u] = _(() => j(c) ? (c.url ?? "").replace(/^mailto:/i, "") : ""), [d, f] = _(() => j(c) ? c.ariaLabel ?? "" : ""), [p, m] = _(null), h = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) ? !0 : (m("Некорректный email адрес"), !1), g = (e) => {
793
823
  if (e.preventDefault(), h(l)) {
794
824
  if (!d) {
795
825
  m("Добавьте описание для email");
@@ -847,18 +877,29 @@ function lt({ onClose: t, onConfirm: o, initialState: s }) {
847
877
  });
848
878
  }
849
879
  //#endregion
880
+ //#region src/text-editor/lib/semantic/getTimeDialogInitialState.ts
881
+ function pt(e) {
882
+ if (!e) return {};
883
+ let [t, n] = e.split("/"), r = t.includes("T") ? "datetime" : t.includes(":") ? "time" : "date";
884
+ return {
885
+ mode: n ? `range-${r}` : r,
886
+ from: t,
887
+ to: n ?? ""
888
+ };
889
+ }
890
+ //#endregion
850
891
  //#region src/text-editor/LinkDialog.tsx
851
- function ut({ onClose: s, onConfirm: c, initialState: l }) {
892
+ function mt({ onClose: s, onConfirm: c, initialState: l }) {
852
893
  let u = j(l) && typeof l == "string" ? {
853
894
  text: "",
854
895
  add: "",
855
896
  ariaLabel: "",
856
897
  url: l
857
- } : l, [d, f] = _(() => j(u) ? u.url ?? "" : ""), [p, m] = _(() => j(u) ? u.ariaLabel ?? "" : ""), [h, g] = _(null), [v, y] = _(!1), S = (e) => {
898
+ } : l, [d, f] = _(() => j(u) ? u.url ?? "" : ""), [p, m] = _(() => j(u) ? u.ariaLabel ?? "" : ""), [h, g] = _(null), [v, y] = _(() => typeof l == "object" && l ? l.qrCode ?? !1 : !1), S = (e) => {
858
899
  f(e), h && g(null);
859
900
  }, C = (e) => {
860
901
  e.preventDefault();
861
- let t = le(d);
902
+ let t = ue(d);
862
903
  if (!t.isValid) {
863
904
  g(t.error);
864
905
  return;
@@ -924,7 +965,7 @@ function ut({ onClose: s, onConfirm: c, initialState: l }) {
924
965
  }
925
966
  //#endregion
926
967
  //#region src/text-editor/PhoneDialog.tsx
927
- function dt({ onClose: o, onConfirm: s, initialState: c }) {
968
+ function ht({ onClose: o, onConfirm: s, initialState: c }) {
928
969
  let l = j(c) && typeof c == "string" ? {
929
970
  text: "",
930
971
  add: "",
@@ -938,7 +979,7 @@ function dt({ onClose: o, onConfirm: s, initialState: c }) {
938
979
  C("добавьте описание для телефона");
939
980
  return;
940
981
  }
941
- let t = ce(f);
982
+ let t = le(f);
942
983
  s(`tel:${`+7${f}`}`, m ? `${t} доб. ${m}` : t, m, g, !1), D();
943
984
  }, D = () => {
944
985
  p(""), y(""), C(null), o();
@@ -1002,7 +1043,7 @@ function dt({ onClose: o, onConfirm: s, initialState: c }) {
1002
1043
  }
1003
1044
  //#endregion
1004
1045
  //#region src/text-editor/SemanticDialog.tsx
1005
- function ft({ onClose: o, onConfirm: s, config: c, initialText: l = "", initialState: u = {} }) {
1046
+ function gt({ onClose: o, onConfirm: s, config: c, initialText: l = "", initialState: u = {} }) {
1006
1047
  let [d, f] = _(l), [p, m] = _(() => c.fields.reduce((e, t) => (e[t.name] = u[t.name] ?? "", e), {})), [h, g] = _({}), v = (e, t) => {
1007
1048
  m((n) => ({
1008
1049
  ...n,
@@ -1069,15 +1110,24 @@ function ft({ onClose: o, onConfirm: s, config: c, initialText: l = "", initialS
1069
1110
  appearance: "solid",
1070
1111
  tone: "success",
1071
1112
  onClick: () => {
1072
- y() && (s(c.tagName, d.trim(), p), o());
1113
+ y() && (s(c.tagName, d.trim(), {
1114
+ ...u,
1115
+ ...p
1116
+ }), o());
1073
1117
  },
1074
1118
  children: "Подтвердить"
1075
1119
  })] })]
1076
1120
  });
1077
1121
  }
1078
1122
  //#endregion
1123
+ //#region src/text-editor/lib/semantic/isSemanticDateTime.ts
1124
+ function $(e) {
1125
+ let t = e.split("/");
1126
+ return t.length <= 2 && t.every((e) => /^\d{2}:\d{2}(?::\d{2})?$/.test(e) ? A(`2000-01-01T${e}`) !== null : /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)?)?$/.test(e) && A(e) !== null);
1127
+ }
1128
+ //#endregion
1079
1129
  //#region src/text-editor/semanticTagConfigs.tsx
1080
- var pt = {
1130
+ var _t = {
1081
1131
  [u.abbr]: {
1082
1132
  tagName: "abbr",
1083
1133
  title: "Аббревиатура",
@@ -1171,6 +1221,7 @@ var pt = {
1171
1221
  fields: [{
1172
1222
  name: "datetime",
1173
1223
  label: "Когда был удалён",
1224
+ validate: (e) => !e || $(e) ? null : "Укажите существующую дату и время в формате ISO 8601",
1174
1225
  description: "Формат ISO 8601: 2025-05-18T14:30",
1175
1226
  placeholder: "например: 2025-05-18T14:30",
1176
1227
  required: !1
@@ -1199,6 +1250,7 @@ var pt = {
1199
1250
  fields: [{
1200
1251
  name: "datetime",
1201
1252
  label: "Когда был добавлен",
1253
+ validate: (e) => !e || $(e) ? null : "Укажите существующую дату и время в формате ISO 8601",
1202
1254
  description: "Формат ISO 8601: 2025-05-18T14:30",
1203
1255
  placeholder: "например: 2025-05-18T14:30",
1204
1256
  required: !1
@@ -1213,13 +1265,14 @@ var pt = {
1213
1265
  };
1214
1266
  //#endregion
1215
1267
  //#region src/text-editor/TimeDialog.tsx
1216
- function mt({ onClose: o, onConfirm: c, initialState: l }) {
1268
+ function vt({ onClose: o, onConfirm: c, initialState: l }) {
1217
1269
  let [u, d] = _(() => l?.mode ?? "date"), [f, p] = _(() => l?.from ?? ""), [m, h] = _(() => l?.to ?? ""), [g, v] = _({}), S = () => {
1218
1270
  let e = {}, t = (e) => /^\d{4}-\d{2}-\d{2}$/.test(e), n = (e) => /^\d{2}:\d{2}$/.test(e), r = (e) => /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e), i = (e, i, a) => {
1219
1271
  if (!i) return `${e} обязательно`;
1220
1272
  if (a === "date" && !t(i)) return "Неверный формат даты (ГГГГ-ММ-ДД)";
1221
1273
  if (a === "time" && !n(i)) return "Неверный формат времени (ЧЧ:ММ)";
1222
1274
  if (a === "datetime" && !r(i)) return "Неверный формат даты и времени (ГГГГ-ММ-ДДTЧЧ:ММ)";
1275
+ if (!$(i)) return "Укажите существующую дату и корректное время";
1223
1276
  };
1224
1277
  switch (u) {
1225
1278
  case "date":
@@ -1319,7 +1372,7 @@ function mt({ onClose: o, onConfirm: c, initialState: l }) {
1319
1372
  tone: "success",
1320
1373
  onClick: () => {
1321
1374
  if (!S()) return;
1322
- let e = m ? `${f}/${m}` : f;
1375
+ let e = u?.startsWith("range-") ? `${f}/${m}` : f;
1323
1376
  c("time", e, { datetime: e }), o();
1324
1377
  },
1325
1378
  children: "Подтвердить"
@@ -1328,7 +1381,7 @@ function mt({ onClose: o, onConfirm: c, initialState: l }) {
1328
1381
  }
1329
1382
  //#endregion
1330
1383
  //#region src/text-editor/TextEditorDialogs.tsx
1331
- function ht({ linkTypeDialog: e, tagTypeDialog: t, localLinkDialogComponent: n, onCloseLinkDialog: r, onCloseTagDialog: i, onAddLink: a, onAddLocalLink: o, onInsertSemanticTag: s, getCurrentSelectionText: c, getSelectedLinkState: l }) {
1384
+ function yt({ linkTypeDialog: e, tagTypeDialog: t, localLinkDialogComponent: n, onCloseLinkDialog: r, onCloseTagDialog: i, onAddLink: a, onAddLocalLink: o, onInsertSemanticTag: s, semanticDialogState: c, linkDialogState: l }) {
1332
1385
  let d = n;
1333
1386
  return /* @__PURE__ */ x(y, { children: [
1334
1387
  e === f.LOCAL_LINK && d ? /* @__PURE__ */ b(d, {
@@ -1336,58 +1389,60 @@ function ht({ linkTypeDialog: e, tagTypeDialog: t, localLinkDialogComponent: n,
1336
1389
  onClose: r,
1337
1390
  onConfirm: o
1338
1391
  }) : null,
1339
- e === f.LINK ? /* @__PURE__ */ b(ut, {
1340
- initialState: l(),
1392
+ e === f.LINK ? /* @__PURE__ */ b(mt, {
1393
+ initialState: l,
1341
1394
  onClose: r,
1342
1395
  onConfirm: a
1343
1396
  }) : null,
1344
- e === f.PHONE ? /* @__PURE__ */ b(dt, {
1345
- initialState: l(),
1397
+ e === f.PHONE ? /* @__PURE__ */ b(ht, {
1398
+ initialState: l,
1346
1399
  onClose: r,
1347
1400
  onConfirm: a
1348
1401
  }) : null,
1349
- e === f.EMAIL ? /* @__PURE__ */ b(lt, {
1350
- initialState: l(),
1402
+ e === f.EMAIL ? /* @__PURE__ */ b(ft, {
1403
+ initialState: l,
1351
1404
  onClose: r,
1352
1405
  onConfirm: a
1353
1406
  }) : null,
1354
- t && (t === u.time ? /* @__PURE__ */ b(mt, {
1407
+ t && (t === u.time ? /* @__PURE__ */ b(vt, {
1355
1408
  onClose: i,
1356
- onConfirm: s
1357
- }) : /* @__PURE__ */ b(ft, {
1409
+ onConfirm: s,
1410
+ initialState: pt(c.attributes.datetime)
1411
+ }) : /* @__PURE__ */ b(gt, {
1358
1412
  onClose: i,
1359
1413
  onConfirm: s,
1360
- config: pt[t],
1361
- initialText: c()
1414
+ config: _t[t],
1415
+ initialText: c.text,
1416
+ initialState: c.attributes
1362
1417
  }))
1363
1418
  ] });
1364
1419
  }
1365
1420
  //#endregion
1366
1421
  //#region src/text-editor/TextEditorLexicalClient.tsx
1367
- function gt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapters: r }) {
1368
- let i = r?.LocalLinkDialogComponent, [a, o] = _(!1), [s, l] = _(G), [u, d] = _(null), [f, m] = _(null), [g, y] = _(null), S = c(e?.raw) ? e.raw : null, C = !!S, w = h(() => {
1422
+ function bt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapters: r }) {
1423
+ let i = r?.LocalLinkDialogComponent, [a, o] = _(!1), [s, l] = _(Qe), [u, d] = _(null), [f, m] = _(null), [g, y] = _(null), S = c(e?.raw) ? e.raw : null, C = !!S, w = h(() => {
1369
1424
  if (S) return JSON.stringify(S.editorState);
1370
1425
  }, [S]), T = p((e) => {
1371
1426
  console.error("Ошибка редактора Lexical", e);
1372
1427
  }, []), E = p((e, n) => {
1373
1428
  let r = "";
1374
1429
  e.read(() => {
1375
- r = ue(n, null);
1430
+ r = de(n, null);
1376
1431
  }), t({
1377
- raw: rt(e),
1432
+ raw: ot(e),
1378
1433
  html: r
1379
1434
  });
1380
1435
  }, [t]), D = p((e) => {
1381
1436
  m(e);
1382
1437
  }, []), O = p((e) => {
1383
1438
  y(e);
1384
- }, []), k = ct({
1439
+ }, []), k = dt({
1385
1440
  editor: u,
1386
1441
  toolbarState: s,
1387
1442
  hasLocalLinkDialog: !!i,
1388
1443
  onOpenLinkDialog: D,
1389
1444
  onOpenTagDialog: O
1390
- }), A = h(() => ({
1445
+ }), ee = h(() => ({
1391
1446
  namespace: "KtkTextEditorLexical",
1392
1447
  onError: T,
1393
1448
  theme: {
@@ -1400,23 +1455,23 @@ function gt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapter
1400
1455
  }
1401
1456
  },
1402
1457
  nodes: [
1403
- Oe,
1404
- ke,
1405
- ge,
1406
- he,
1407
- q,
1408
- Z
1458
+ je,
1459
+ Me,
1460
+ ve,
1461
+ _e,
1462
+ G,
1463
+ Y
1409
1464
  ],
1410
1465
  editorState: w
1411
1466
  }), [T, w]);
1412
1467
  return /* @__PURE__ */ x("div", {
1413
- className: $.textEditor,
1468
+ className: Q.textEditor,
1414
1469
  children: [/* @__PURE__ */ b("div", {
1415
- className: v($.textEditorContent, { [$.focused]: a }),
1416
- children: /* @__PURE__ */ x(_e, {
1417
- initialConfig: A,
1470
+ className: v(Q.textEditorContent, { [Q.focused]: a }),
1471
+ children: /* @__PURE__ */ x(be, {
1472
+ initialConfig: ee,
1418
1473
  children: [
1419
- /* @__PURE__ */ b(Je, {
1474
+ /* @__PURE__ */ b(Xe, {
1420
1475
  toolbarComponents: n,
1421
1476
  state: s,
1422
1477
  onBlockStyleToggle: k.handleBlockStyleToggle,
@@ -1428,8 +1483,8 @@ function gt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapter
1428
1483
  onRedo: k.handleRedo,
1429
1484
  onCleanTag: k.handleCleanSemanticTag
1430
1485
  }),
1431
- /* @__PURE__ */ b(Ce, {
1432
- contentEditable: /* @__PURE__ */ b(ve, {
1486
+ /* @__PURE__ */ b(Ee, {
1487
+ contentEditable: /* @__PURE__ */ b(xe, {
1433
1488
  className: "lexicalEditorContentEditable",
1434
1489
  onFocus: () => o(!0),
1435
1490
  onBlur: () => o(!1)
@@ -1438,25 +1493,25 @@ function gt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapter
1438
1493
  className: "lexicalEditorPlaceholder",
1439
1494
  children: "Введите текст..."
1440
1495
  }),
1441
- ErrorBoundary: ye
1496
+ ErrorBoundary: Se
1442
1497
  }),
1443
- /* @__PURE__ */ b(be, {}),
1444
- /* @__PURE__ */ b(xe, {}),
1445
- /* @__PURE__ */ b(nt, {
1498
+ /* @__PURE__ */ b(Ce, {}),
1499
+ /* @__PURE__ */ b(we, {}),
1500
+ /* @__PURE__ */ b(at, {
1446
1501
  onEditorReady: d,
1447
1502
  onStateChange: l
1448
1503
  }),
1449
- /* @__PURE__ */ b(Ye, {
1504
+ /* @__PURE__ */ b(Ze, {
1450
1505
  initialHTML: e?.html,
1451
1506
  shouldSkip: C
1452
1507
  }),
1453
- /* @__PURE__ */ b(Se, {
1508
+ /* @__PURE__ */ b(Te, {
1454
1509
  onChange: E,
1455
1510
  ignoreSelectionChange: !0
1456
1511
  })
1457
1512
  ]
1458
1513
  })
1459
- }), /* @__PURE__ */ b(ht, {
1514
+ }), /* @__PURE__ */ b(yt, {
1460
1515
  linkTypeDialog: f,
1461
1516
  tagTypeDialog: g,
1462
1517
  localLinkDialogComponent: i,
@@ -1465,12 +1520,12 @@ function gt({ initialData: e, onChange: t, toolbarComponents: n, businessAdapter
1465
1520
  onAddLink: k.handleAddLink,
1466
1521
  onAddLocalLink: k.handleAddLocalLink,
1467
1522
  onInsertSemanticTag: k.insertSemanticTagAtSelection,
1468
- getCurrentSelectionText: k.getCurrentSelectionText,
1469
- getSelectedLinkState: k.getSelectedLinkState
1523
+ semanticDialogState: k.semanticDialogState,
1524
+ linkDialogState: k.linkDialogState
1470
1525
  })]
1471
1526
  });
1472
1527
  }
1473
1528
  //#endregion
1474
- export { gt as TextEditorLexicalClient };
1529
+ export { bt as TextEditorLexicalClient };
1475
1530
 
1476
- //# sourceMappingURL=TextEditorLexicalClient-C5AV8Fcu.js.map
1531
+ //# sourceMappingURL=TextEditorLexicalClient-C8nSoz85.js.map