@baishuyun/ui-base 6.12.0 → 6.13.0

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 (153) hide show
  1. package/dist/Amap/AmapCircle/index.js +1 -1
  2. package/dist/Amap/AmapMarker/index.js +1 -1
  3. package/dist/Amap/AmapMarkerCluster/index.js +1 -1
  4. package/dist/Amap/AmapProvider/index.js +4 -4
  5. package/dist/Amap/{AmapProvider-CvRHhN42.js → AmapProvider-BwyzXpEj.js} +1 -1
  6. package/dist/Amap/hooks/index.js +1 -1
  7. package/dist/Amap/index.js +4 -4
  8. package/dist/Calendar/{AllDaySection-CTaXpCmK.js → AllDaySection-D9YHhwIa.js} +1 -1
  9. package/dist/Calendar/{Calendar-BOLbbip1.js → Calendar-DEjopu9G.js} +5 -5
  10. package/dist/Calendar/{TimeGrid-Ci8Dfama.js → TimeGrid-5zMy9Hks.js} +1 -1
  11. package/dist/Calendar/context/index.js +1 -1
  12. package/dist/Calendar/index.js +8 -8
  13. package/dist/Calendar/subcomponents/AllDaySection/index.js +3 -3
  14. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
  15. package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
  16. package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
  17. package/dist/Calendar/subcomponents/TimeGrid/index.js +3 -3
  18. package/dist/Calendar/utils/index.js +1 -1
  19. package/dist/Calendar/utils/layout/index.js +1 -1
  20. package/dist/Calendar/utils/theme/index.js +1 -1
  21. package/dist/Card/{Card-C8A4XaJZ.js → Card-DDbQQsCc.js} +1 -1
  22. package/dist/Card/index.js +3 -3
  23. package/dist/CheckBox/{CheckBox-DBzTOuRy.js → CheckBox-CwfrMEFb.js} +1 -1
  24. package/dist/CheckBox/{CheckBox-Dt4x6IqH.js → CheckBox-DFfNiPGM.js} +1 -1
  25. package/dist/CheckBox/index.js +4 -4
  26. package/dist/ColorPicker/{ColorPicker-Buku806Y.js → ColorPicker-Cm_-e0Hz.js} +34 -31
  27. package/dist/ColorPicker/index.js +5 -5
  28. package/dist/ConfigProvider/index.js +3 -3
  29. package/dist/DatePicker/{DatePicker-Vi3wfsfz.js → DatePicker-BUvDkVjx.js} +9 -9
  30. package/dist/DatePicker/{DatePickerPanel-Cwmb-4UR.js → DatePickerPanel-BHTPcE6R.js} +4 -4
  31. package/dist/DatePicker/index.js +4 -4
  32. package/dist/DatePicker/style/index.js +1 -1
  33. package/dist/DropDown/DropDown-DV1IuuQD.js +290 -0
  34. package/dist/DropDown/index.js +7 -7
  35. package/dist/DropDown/style/index.js +1 -1
  36. package/dist/Editor/Buttons-BUC9qQY1.js +1732 -0
  37. package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -12
  38. package/dist/Editor/constants/index.js +10 -3
  39. package/dist/Editor/index.js +1572 -909
  40. package/dist/Gantt/GanttChart/index.js +9 -9
  41. package/dist/Gantt/{GanttChart-WIrD6Z7O.js → GanttChart-DEGOIgRD.js} +3 -3
  42. package/dist/Gantt/GanttTable/index.js +5 -5
  43. package/dist/Gantt/{GanttTable-CdXhMHF6.js → GanttTable-Dwb00N8Z.js} +1 -1
  44. package/dist/Gantt/GanttToolBar/index.js +8 -8
  45. package/dist/Gantt/{GanttToolBar-C1gAS9v2.js → GanttToolBar-BcJB6sKY.js} +3 -3
  46. package/dist/Gantt/index.js +11 -11
  47. package/dist/Gantt/utils/index.js +1 -1
  48. package/dist/Gantt/utils/theme/index.js +1 -1
  49. package/dist/Icon/{Icon-oQ_uBooE.js → Icon-DDHx0R18.js} +1 -1
  50. package/dist/Icon/index.js +2 -2
  51. package/dist/InputTag/{InputTag-BQpIRPtc.js → InputTag-CBnG1R7g.js} +2 -2
  52. package/dist/InputTag/index.js +5 -5
  53. package/dist/Loading/{Loading-CiRe7i2R.js → Loading-DYayeRbT.js} +1 -1
  54. package/dist/Loading/index.js +4 -4
  55. package/dist/Modal/{Modal-17rLsxN4.js → Modal-BnF6CUrn.js} +20 -17
  56. package/dist/Modal/index.js +3 -3
  57. package/dist/NotFoundContent/index.js +1 -1
  58. package/dist/Overlay/index.js +1 -1
  59. package/dist/Radio/index.js +1 -1
  60. package/dist/ScrollBar/index.js +1 -1
  61. package/dist/Segmented/index.js +1 -1
  62. package/dist/Select/{Select-p_ly7xmz.js → Select-CG5wFTL4.js} +13 -13
  63. package/dist/Select/{SelectInputSearch-BBwVIb8u.js → SelectInputSearch-DiuwwOWz.js} +2 -2
  64. package/dist/Select/index.js +10 -10
  65. package/dist/Table/{Table-CSPdFGYn.js → Table-B7J-IK2_.js} +1 -1
  66. package/dist/Table/hooks/index.js +1 -1
  67. package/dist/Table/index.js +4 -4
  68. package/dist/Table/style/index.js +1 -1
  69. package/dist/Table/utils/index.js +1 -1
  70. package/dist/Tabs/{Tabs-D2A8nJl8.js → Tabs-CObQtF37.js} +7 -7
  71. package/dist/Tabs/index.js +6 -6
  72. package/dist/Tooltip/index.js +1 -1
  73. package/dist/Tree/index.js +4 -4
  74. package/dist/Tree/utils/index.js +1 -1
  75. package/dist/components/ColorPicker/ColorPicker.type.d.ts +2 -0
  76. package/dist/components/ColorPicker/useFloatingColorPicker.d.ts +1 -1
  77. package/dist/components/DropDown/DropDownOpenContext.d.ts +4 -0
  78. package/dist/components/DropDown/MenuItem/MenuItem.d.ts +4 -0
  79. package/dist/components/DropDown/interface.d.ts +5 -1
  80. package/dist/components/Editor/Preview/EditorPreview.d.ts +9 -0
  81. package/dist/components/Editor/Preview/HtmlPreview.d.ts +5 -0
  82. package/dist/components/Editor/Preview/PolishModal.d.ts +14 -0
  83. package/dist/components/Editor/Preview/Thinking.d.ts +23 -0
  84. package/dist/components/Editor/Preview/TypesetModal.d.ts +12 -0
  85. package/dist/components/Editor/ToolbarPlugin/BaseButton/BaseButton.d.ts +5 -1
  86. package/dist/components/Editor/ToolbarPlugin/Buttons/AiButton.d.ts +3 -0
  87. package/dist/components/Editor/ToolbarPlugin/Buttons/AlignButton.d.ts +2 -1
  88. package/dist/components/Editor/ToolbarPlugin/Buttons/BoldButton.d.ts +2 -1
  89. package/dist/components/Editor/ToolbarPlugin/Buttons/BulletListButton.d.ts +2 -1
  90. package/dist/components/Editor/ToolbarPlugin/Buttons/ClearFormatButton.d.ts +3 -0
  91. package/dist/components/Editor/ToolbarPlugin/Buttons/CodeButton.d.ts +2 -1
  92. package/dist/components/Editor/ToolbarPlugin/Buttons/FillButton.d.ts +2 -1
  93. package/dist/components/Editor/ToolbarPlugin/Buttons/FontColorButton.d.ts +2 -1
  94. package/dist/components/Editor/ToolbarPlugin/Buttons/FontSizeButton.d.ts +2 -1
  95. package/dist/components/Editor/ToolbarPlugin/Buttons/HeadingButton.d.ts +2 -1
  96. package/dist/components/Editor/ToolbarPlugin/Buttons/IndentButton.d.ts +2 -1
  97. package/dist/components/Editor/ToolbarPlugin/Buttons/ItalicButton.d.ts +2 -1
  98. package/dist/components/Editor/ToolbarPlugin/Buttons/LinkButton.d.ts +2 -1
  99. package/dist/components/Editor/ToolbarPlugin/Buttons/NumberListButton.d.ts +2 -1
  100. package/dist/components/Editor/ToolbarPlugin/Buttons/OutdentButton.d.ts +2 -1
  101. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/PictureButton.d.ts +2 -1
  102. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.d.ts +1 -0
  103. package/dist/components/Editor/ToolbarPlugin/Buttons/RedoButton.d.ts +2 -1
  104. package/dist/components/Editor/ToolbarPlugin/Buttons/SourceButton.d.ts +2 -1
  105. package/dist/components/Editor/ToolbarPlugin/Buttons/StrikeThroughButton.d.ts +2 -1
  106. package/dist/components/Editor/ToolbarPlugin/Buttons/SubscriptButton.d.ts +2 -1
  107. package/dist/components/Editor/ToolbarPlugin/Buttons/SuperscriptButton.d.ts +2 -1
  108. package/dist/components/Editor/ToolbarPlugin/Buttons/TableButton.d.ts +2 -1
  109. package/dist/components/Editor/ToolbarPlugin/Buttons/UnLinkButton.d.ts +2 -1
  110. package/dist/components/Editor/ToolbarPlugin/Buttons/UnderLineButton.d.ts +2 -1
  111. package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -1
  112. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +26 -23
  113. package/dist/components/Editor/ToolbarPlugin/Buttons/registry.d.ts +4 -1
  114. package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +1 -0
  115. package/dist/components/Editor/ToolbarPlugin/interface.d.ts +2 -2
  116. package/dist/components/Editor/constants/ai.d.ts +12 -0
  117. package/dist/components/Editor/constants/index.d.ts +3 -0
  118. package/dist/components/Editor/constants/portableEditorStyles.d.ts +11 -0
  119. package/dist/components/Editor/constants/toolbarSize.d.ts +12 -0
  120. package/dist/components/Editor/context/EditorContainerContext.d.ts +27 -1
  121. package/dist/components/Editor/index.d.ts +2 -2
  122. package/dist/components/Editor/interface.d.ts +60 -13
  123. package/dist/components/Editor/utils/applyAiPolish.d.ts +8 -0
  124. package/dist/components/Editor/utils/applyAiTypeset.d.ts +5 -0
  125. package/dist/components/Editor/utils/clearInlineTextFormat.d.ts +1 -0
  126. package/dist/components/Editor/utils/computeToolbarOverflowSplit.d.ts +12 -0
  127. package/dist/components/Editor/utils/extractCodePlaceholders.d.ts +6 -0
  128. package/dist/components/Editor/utils/formatEditorHtml.d.ts +1 -1
  129. package/dist/components/Editor/utils/htmlText.d.ts +2 -0
  130. package/dist/components/Editor/utils/prepareTypesetProposed.d.ts +2 -0
  131. package/dist/components/Editor/utils/readEditorAiSnapshot.d.ts +9 -0
  132. package/dist/components/Editor/utils/resolveEditorAlign.d.ts +3 -0
  133. package/dist/components/Editor/utils/resolveEditorImageUpload.d.ts +8 -0
  134. package/dist/components/Editor/utils/resolveEditorToolbarThemeVars.d.ts +5 -5
  135. package/dist/components/Editor/utils/stitchCodePlaceholders.d.ts +6 -0
  136. package/dist/components/Editor/utils/toPortableEditorHtml.d.ts +1 -0
  137. package/dist/components/Editor/utils/unwrapTypesetFence.d.ts +5 -0
  138. package/dist/components/Modal/Modal.type.d.ts +1 -0
  139. package/dist/hooks/useFloatingPortal.d.ts +2 -0
  140. package/dist/index.js +24 -24
  141. package/dist/locale/lang/en-US.json.d.ts +22 -2
  142. package/dist/locale/lang/zh-CN.json.d.ts +22 -2
  143. package/dist/locale/lang/zh-TW.json.d.ts +22 -2
  144. package/dist/style.css +1 -1
  145. package/dist/vendors/{ConfigProvider-4xHyyeop.js → ConfigProvider-BDyxjj6K.js} +45 -5
  146. package/dist/vendors/{LocaleContext-I4PW9j4M.js → LocaleContext-w5ODGcJX.js} +22 -2
  147. package/dist/vendors/{Tree-B8cR9y6U.js → Tree-B7XeC9Mi.js} +2 -2
  148. package/dist/vendors/{useFloatingPortal-CmVJbuRm.js → useFloatingPortal-B3N1viK2.js} +8 -7
  149. package/dist/vendors/{useLocale-FGYsRWSe.js → useLocale-CEDl6cUK.js} +1 -1
  150. package/dist/vendors/{version-CJyzNHuS.js → version-B14EcH7v.js} +1 -1
  151. package/package.json +2 -3
  152. package/dist/DropDown/DropDown-CuL1Qq25.js +0 -178
  153. package/dist/Editor/Buttons-CMkFTv6y.js +0 -1016
@@ -0,0 +1,1732 @@
1
+ import { t as e } from "../Icon/Icon-DDHx0R18.js";
2
+ import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
3
+ import { t as r } from "../Modal/Modal-BnF6CUrn.js";
4
+ import { t as i } from "../ColorPicker/ColorPicker-Cm_-e0Hz.js";
5
+ import { t as a } from "../vendors/useLocale-CEDl6cUK.js";
6
+ import { n as o } from "../vendors/animations-rwUbyoT0.js";
7
+ import { t as s } from "../CheckBox/CheckBox-CwfrMEFb.js";
8
+ import { t as c } from "../ScrollBar/ScrollBar-N2pOLv-8.js";
9
+ import { t as l } from "../vendors/useFloatingPortal-B3N1viK2.js";
10
+ import { t as u } from "../DropDown/DropDown-DV1IuuQD.js";
11
+ import { EDITOR_IMAGE_ACCEPT as d, EDITOR_IMAGE_FILE_TYPES as f, FONT_SIZES as p } from "./constants/index.js";
12
+ import { keyBy as m, range as h } from "lodash-es";
13
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import y, { createContext as b, forwardRef as x, useCallback as S, useContext as C, useEffect as w, useImperativeHandle as ee, useLayoutEffect as T, useMemo as te, useRef as E, useState as D } from "react";
15
+ import { Button as O, Form as ne, Input as re, message as k } from "antd";
16
+ import A from "clsx";
17
+ import { AnimatePresence as ie, motion as ae } from "motion/react";
18
+ import { FloatingPortal as oe } from "@floating-ui/react";
19
+ import { $generateHtmlFromNodes as se, $generateNodesFromDOM as ce } from "@lexical/html";
20
+ import { $createParagraphNode as j, $createTextNode as le, $getRoot as ue, $getSelection as M, $insertNodes as de, $isElementNode as fe, $isRangeSelection as N, $isTextNode as pe, $setSelection as me, CAN_REDO_COMMAND as he, CAN_UNDO_COMMAND as ge, COMMAND_PRIORITY_CRITICAL as _e, FORMAT_ELEMENT_COMMAND as ve, FORMAT_TEXT_COMMAND as P, INDENT_CONTENT_COMMAND as ye, OUTDENT_CONTENT_COMMAND as be, REDO_COMMAND as xe, UNDO_COMMAND as Se, createCommand as Ce, mergeRegister as we } from "lexical";
21
+ import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext";
22
+ import { $patchStyleText as I, $setBlocksType as Te } from "@lexical/selection";
23
+ import { $createLinkNode as Ee, $toggleLink as De, TOGGLE_LINK_COMMAND as Oe } from "@lexical/link";
24
+ import { INSERT_ORDERED_LIST_COMMAND as ke, INSERT_UNORDERED_LIST_COMMAND as Ae, REMOVE_LIST_COMMAND as je } from "@lexical/list";
25
+ import { $createCodeNode as Me } from "@lexical/code-core";
26
+ import { INSERT_TABLE_COMMAND as Ne } from "@lexical/table";
27
+ import { $createHeadingNode as Pe } from "@lexical/rich-text";
28
+ import Fe from "dompurify";
29
+ //#region src/components/Editor/constants/toolbarSize.ts
30
+ var Ie = "default", L = {
31
+ x: 0,
32
+ y: 5
33
+ }, Le = {
34
+ small: {
35
+ itemHeight: 20,
36
+ iconSize: 14
37
+ },
38
+ default: {
39
+ itemHeight: 30,
40
+ iconSize: 16
41
+ }
42
+ }, R = {
43
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_8z8w3_1",
44
+ "bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_8z8w3_14",
45
+ "bsy-lexical__toolbar-stack": "_bsy-lexical__toolbar-stack_8z8w3_20",
46
+ "bsy-lexical__toolbar-items": "_bsy-lexical__toolbar-items_8z8w3_30",
47
+ "bsy-lexical__toolbar-item": "_bsy-lexical__toolbar-item_8z8w3_30",
48
+ "bsy-lexical__toolbar-item--disabled": "_bsy-lexical__toolbar-item--disabled_8z8w3_45",
49
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_8z8w3_49",
50
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_8z8w3_55",
51
+ "bsy-lexical__toolbar-select": "_bsy-lexical__toolbar-select_8z8w3_62",
52
+ "bsy-lexical__toolbar-select-label": "_bsy-lexical__toolbar-select-label_8z8w3_80",
53
+ "bsy-lexical__toolbar-select-arrow": "_bsy-lexical__toolbar-select-arrow_8z8w3_90",
54
+ "bsy-lexical__toolbar-select--ai": "_bsy-lexical__toolbar-select--ai_8z8w3_94",
55
+ "bsy-lexical__toolbar-more-sizer": "_bsy-lexical__toolbar-more-sizer_8z8w3_100",
56
+ "bsy-lexical__toolbar-overflow": "_bsy-lexical__toolbar-overflow_8z8w3_108",
57
+ "bsy-lexical__toolbar-overflow-row": "_bsy-lexical__toolbar-overflow-row_8z8w3_112",
58
+ "bsy-lexical__toolbar-overflow-row--open": "_bsy-lexical__toolbar-overflow-row--open_8z8w3_120",
59
+ "bsy-lexical__toolbar-overflow-row--instant": "_bsy-lexical__toolbar-overflow-row--instant_8z8w3_124",
60
+ "bsy-lexical__toolbar-overflow-inner": "_bsy-lexical__toolbar-overflow-inner_8z8w3_128",
61
+ "bsy-lexical__toolbar-with-divider": "_bsy-lexical__toolbar-with-divider_8z8w3_136"
62
+ }, Re = b(null), ze = "plaintext", Be = "github-light", Ve = [
63
+ {
64
+ id: "plaintext",
65
+ label: "Plain text"
66
+ },
67
+ {
68
+ id: "css",
69
+ label: "CSS"
70
+ },
71
+ {
72
+ id: "html",
73
+ label: "HTML"
74
+ },
75
+ {
76
+ id: "xml",
77
+ label: "XML"
78
+ },
79
+ {
80
+ id: "javascript",
81
+ label: "JavaScript"
82
+ },
83
+ {
84
+ id: "typescript",
85
+ label: "TypeScript"
86
+ },
87
+ {
88
+ id: "jsx",
89
+ label: "JSX"
90
+ },
91
+ {
92
+ id: "go",
93
+ label: "Go"
94
+ },
95
+ {
96
+ id: "php",
97
+ label: "PHP"
98
+ },
99
+ {
100
+ id: "c",
101
+ label: "C"
102
+ },
103
+ {
104
+ id: "python",
105
+ label: "Python"
106
+ },
107
+ {
108
+ id: "java",
109
+ label: "Java"
110
+ },
111
+ {
112
+ id: "cpp",
113
+ label: "C++"
114
+ },
115
+ {
116
+ id: "csharp",
117
+ label: "C#"
118
+ },
119
+ {
120
+ id: "vb",
121
+ label: "Visual Basic"
122
+ },
123
+ {
124
+ id: "sql",
125
+ label: "SQL"
126
+ },
127
+ {
128
+ id: "ruby",
129
+ label: "Ruby"
130
+ },
131
+ {
132
+ id: "swift",
133
+ label: "Swift"
134
+ },
135
+ {
136
+ id: "bash",
137
+ label: "Bash"
138
+ },
139
+ {
140
+ id: "lua",
141
+ label: "Lua"
142
+ },
143
+ {
144
+ id: "markdown",
145
+ label: "Markdown"
146
+ }
147
+ ], He = m(Ve, "id"), Ue = (e) => e && He[e] ? e : ze, We = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", Ge = b(null), Ke = () => {
148
+ let e = C(Ge);
149
+ if (!e) throw Error("useHistoryStateContext must be used within HistoryStateProvider");
150
+ return e;
151
+ }, qe = ({ children: e }) => {
152
+ let [t] = F(), [n, r] = D({
153
+ canUndo: !1,
154
+ canRedo: !1
155
+ });
156
+ return w(() => we(t.registerCommand(ge, (e) => (r((t) => t.canUndo === e ? t : {
157
+ ...t,
158
+ canUndo: e
159
+ }), !1), _e), t.registerCommand(he, (e) => (r((t) => t.canRedo === e ? t : {
160
+ ...t,
161
+ canRedo: e
162
+ }), !1), _e)), [t]), /* @__PURE__ */ _(Ge.Provider, {
163
+ value: n,
164
+ children: e
165
+ });
166
+ }, Je = b({ iconSize: Le.default.iconSize }), Ye = Je.Provider, z = () => C(Je), B = {
167
+ "lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_123xc_1",
168
+ "lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_123xc_26",
169
+ "lexical-editor__toolbar-button-highlight": "_lexical-editor__toolbar-button-highlight_123xc_30"
170
+ }, V = (t) => {
171
+ let { icon: n, tooltip: r, onClick: i, disabled: a = !1, active: o = !1, highlight: s = !1, size: c } = t, { iconSize: l } = z(), u = c ?? l;
172
+ return /* @__PURE__ */ _("button", {
173
+ className: A(B["lexical-editor__toolbar-button"], {
174
+ [B["lexical-editor__toolbar-button-active"]]: o,
175
+ [B["lexical-editor__toolbar-button-highlight"]]: s
176
+ }),
177
+ type: "button",
178
+ onClick: i,
179
+ onMouseDown: (e) => e.preventDefault(),
180
+ disabled: a,
181
+ title: r,
182
+ children: y.isValidElement(n) ? n : /* @__PURE__ */ _(e, {
183
+ name: n,
184
+ size: u
185
+ })
186
+ });
187
+ }, H = () => {
188
+ let e = C(Re);
189
+ if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
190
+ return e;
191
+ }, Xe = ({ disabled: e }) => {
192
+ let [t] = F(), n = H(), { t: r } = a(), i = n.bold;
193
+ return /* @__PURE__ */ _(V, {
194
+ icon: "bold",
195
+ tooltip: r("editor.bold"),
196
+ active: i,
197
+ disabled: e,
198
+ onClick: () => {
199
+ t.dispatchCommand(P, "bold");
200
+ }
201
+ });
202
+ }, Ze = ({ disabled: e }) => {
203
+ let [t] = F(), n = H(), { t: r } = a(), i = n.underline;
204
+ return /* @__PURE__ */ _(V, {
205
+ icon: "underline",
206
+ tooltip: r("editor.underline"),
207
+ active: i,
208
+ disabled: e,
209
+ onClick: () => {
210
+ t.dispatchCommand(P, "underline");
211
+ }
212
+ });
213
+ }, Qe = ({ disabled: e }) => {
214
+ let [t] = F(), n = H(), { t: r } = a(), i = n.italic;
215
+ return /* @__PURE__ */ _(V, {
216
+ icon: "italic",
217
+ tooltip: r("editor.italic"),
218
+ active: i,
219
+ disabled: e,
220
+ onClick: () => {
221
+ t.dispatchCommand(P, "italic");
222
+ }
223
+ });
224
+ }, $e = ({ disabled: e }) => {
225
+ let [t] = F(), { t: n } = a(), { fontSize: r, headingTag: i } = H(), o = te(() => p.map((e) => ({
226
+ key: e.value,
227
+ label: e.label
228
+ })), []), s = S((e) => {
229
+ let n = e.key;
230
+ t.update(() => {
231
+ let e = M();
232
+ N(e) && I(e, { "font-size": n });
233
+ });
234
+ }, [t]);
235
+ return i || e ? /* @__PURE__ */ _(V, {
236
+ icon: "fontsize",
237
+ tooltip: n("editor.fontSize"),
238
+ disabled: !0
239
+ }) : /* @__PURE__ */ _(u, {
240
+ menus: o,
241
+ onClick: s,
242
+ activeKey: [r],
243
+ showSearch: !1,
244
+ offset: L,
245
+ style: {
246
+ width: "60px",
247
+ minWidth: "60px"
248
+ },
249
+ children: /* @__PURE__ */ _("div", {
250
+ className: "dropdown__trigger inline-flex",
251
+ children: /* @__PURE__ */ _(V, {
252
+ icon: "fontsize",
253
+ tooltip: n("editor.fontSize"),
254
+ active: !1
255
+ })
256
+ })
257
+ });
258
+ }, et = ({ disabled: e }) => {
259
+ let [t] = F(), n = H(), { t: r } = a(), o = S((e) => {
260
+ t.update(() => {
261
+ let t = M();
262
+ N(t) && I(t, { color: e });
263
+ });
264
+ }, [t]);
265
+ return /* @__PURE__ */ _(i, {
266
+ value: n.fontColor,
267
+ onChange: o,
268
+ placement: "bottom-start",
269
+ offset: L.y,
270
+ presetColors: "basic",
271
+ disabled: e,
272
+ children: /* @__PURE__ */ _("div", {
273
+ className: "trigger-picker inline-flex",
274
+ children: /* @__PURE__ */ _(V, {
275
+ icon: "fontcolor",
276
+ tooltip: r("editor.fontColor"),
277
+ onClick: () => {},
278
+ active: !1,
279
+ disabled: e
280
+ })
281
+ })
282
+ });
283
+ }, tt = ({ disabled: e }) => {
284
+ let [t] = F(), n = H(), { t: r } = a(), o = S((e) => {
285
+ t.update(() => {
286
+ let t = M();
287
+ N(t) && I(t, { "background-color": e });
288
+ });
289
+ }, [t]);
290
+ return /* @__PURE__ */ _(i, {
291
+ value: n.backgroundColor,
292
+ onChange: o,
293
+ placement: "bottom-start",
294
+ offset: L.y,
295
+ presetColors: "basic",
296
+ disabled: e,
297
+ children: /* @__PURE__ */ _("div", {
298
+ className: "trigger-picker inline-flex",
299
+ children: /* @__PURE__ */ _(V, {
300
+ icon: "fill",
301
+ tooltip: r("editor.fill"),
302
+ onClick: () => {},
303
+ active: !1,
304
+ disabled: e
305
+ })
306
+ })
307
+ });
308
+ }, U = {
309
+ left: "paragraph",
310
+ center: "paragraphmiddle",
311
+ right: "paragraphright"
312
+ }, nt = ({ disabled: t }) => {
313
+ let [n] = F(), { align: r } = H(), { iconSize: i } = z(), { t: o } = a();
314
+ return /* @__PURE__ */ _(u, {
315
+ menus: te(() => [
316
+ {
317
+ key: "left",
318
+ label: o("leftAlign"),
319
+ icon: /* @__PURE__ */ _(e, {
320
+ name: U.left,
321
+ size: i
322
+ })
323
+ },
324
+ {
325
+ key: "center",
326
+ label: o("editor.centerAlign"),
327
+ icon: /* @__PURE__ */ _(e, {
328
+ name: U.center,
329
+ size: i
330
+ })
331
+ },
332
+ {
333
+ key: "right",
334
+ label: o("editor.rightAlign"),
335
+ icon: /* @__PURE__ */ _(e, {
336
+ name: U.right,
337
+ size: i
338
+ })
339
+ }
340
+ ], [i, o]),
341
+ onClick: S((e) => {
342
+ n.dispatchCommand(ve, e.key);
343
+ }, [n]),
344
+ showSearch: !1,
345
+ activeKey: [r],
346
+ offset: L,
347
+ style: {
348
+ width: "110px",
349
+ minWidth: "110px"
350
+ },
351
+ children: /* @__PURE__ */ _("div", {
352
+ className: "trigger-dropdown inline-flex text-sm",
353
+ children: /* @__PURE__ */ _(V, {
354
+ icon: U[We(r)],
355
+ tooltip: o("editor.alignment"),
356
+ disabled: t
357
+ })
358
+ })
359
+ });
360
+ };
361
+ //#endregion
362
+ //#region src/components/Editor/ToolbarPlugin/Buttons/LinkButton.tsx
363
+ function rt(e) {
364
+ return e ? e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}` : "";
365
+ }
366
+ var it = ({ disabled: e }) => {
367
+ let [t] = F(), { link: n } = H(), { t: i } = a(), [o, c] = D(!1), [l, u] = D(""), [d, f] = D(""), [p, m] = D(!0), [h, y] = k.useMessage(), b = E(null), x = S((e) => {
368
+ c(e), e || t.setEditable(!0);
369
+ }, [t]), C = () => {
370
+ if (!l) {
371
+ h.warning(i("editor.linkAddressEmpty"));
372
+ return;
373
+ }
374
+ let e = rt(l);
375
+ t.setEditable(!0), t.update(() => {
376
+ let t = p ? {
377
+ target: "_blank",
378
+ rel: "noopener noreferrer",
379
+ title: l
380
+ } : { title: l }, n = b.current;
381
+ n !== null && me(n);
382
+ let r = M();
383
+ if (N(r)) {
384
+ let n = d || l, i = r.getTextContent();
385
+ if (!r.isCollapsed() && n === i) De(e, t);
386
+ else {
387
+ let i = r.anchor.getNode(), a = pe(i) ? i : null, o = r.style || r.getNodes().find(pe)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = Ee(e, t), l = le(n);
388
+ l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
389
+ }
390
+ } else {
391
+ let n = Ee(e, t);
392
+ n.append(le(d || l));
393
+ let r = ue(), i = r.getLastChild();
394
+ if (fe(i) && i.isEmpty()) i.append(n);
395
+ else {
396
+ let e = j();
397
+ e.append(n), r.append(e);
398
+ }
399
+ }
400
+ }), b.current = null, u(""), f(""), x(!1);
401
+ }, w = S(() => {
402
+ let e = "";
403
+ t.getEditorState().read(() => {
404
+ let t = M();
405
+ b.current = t ? t.clone() : null, N(t) && !t.isCollapsed() && (e = t.getTextContent());
406
+ }), t.setEditable(!1), t.update(() => {
407
+ me(null);
408
+ }), window.getSelection()?.removeAllRanges(), t.getRootElement()?.blur(), n ? (u(n.link === "javascript:void(0);" ? "" : n.link ?? ""), f(n.linkText ?? "")) : (u(""), f(e)), c(!0);
409
+ }, [n, t]);
410
+ return /* @__PURE__ */ v(g, { children: [
411
+ /* @__PURE__ */ _(V, {
412
+ icon: "Insertlink",
413
+ tooltip: i("link"),
414
+ onClick: w,
415
+ disabled: e,
416
+ active: !!n?.link
417
+ }),
418
+ y,
419
+ /* @__PURE__ */ _(r, {
420
+ title: i("link"),
421
+ open: o,
422
+ onOpenChange: x,
423
+ children: /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("div", {
424
+ className: "px-[20px] pb-[60px] pt-[40px]",
425
+ children: [/* @__PURE__ */ v("div", {
426
+ className: "flex items-center relative",
427
+ children: [
428
+ /* @__PURE__ */ _("label", {
429
+ className: "w-[80px] shrink-0",
430
+ children: i("linkAddress")
431
+ }),
432
+ /* @__PURE__ */ _(re, {
433
+ value: l,
434
+ onChange: (e) => u(e.target.value),
435
+ placeholder: i("editor.linkTip")
436
+ }),
437
+ /* @__PURE__ */ _("div", {
438
+ className: "absolute bottom-[-30px] left-[80px]",
439
+ children: /* @__PURE__ */ _("p", {
440
+ className: "text-[#999]",
441
+ children: i("editor.linkAliasTip")
442
+ })
443
+ })
444
+ ]
445
+ }), /* @__PURE__ */ v("div", {
446
+ className: "flex items-center mt-[40px]",
447
+ children: [/* @__PURE__ */ _("label", {
448
+ className: "w-[80px] shrink-0",
449
+ children: i("showContent")
450
+ }), /* @__PURE__ */ _(re, {
451
+ value: d,
452
+ onChange: (e) => f(e.target.value)
453
+ })]
454
+ })]
455
+ }), /* @__PURE__ */ v("div", {
456
+ className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
457
+ children: [/* @__PURE__ */ _("div", { children: /* @__PURE__ */ _(s, {
458
+ checked: p,
459
+ onChange: (e) => m(e),
460
+ children: i("openInNewTab")
461
+ }) }), /* @__PURE__ */ v("div", {
462
+ className: "flex gap-[15px]",
463
+ children: [/* @__PURE__ */ _(O, {
464
+ onClick: () => x(!1),
465
+ children: i("cancel")
466
+ }), /* @__PURE__ */ _(O, {
467
+ type: "primary",
468
+ onClick: C,
469
+ children: i("confirm")
470
+ })]
471
+ })]
472
+ })] })
473
+ })
474
+ ] });
475
+ }, at = ({ disabled: e }) => {
476
+ let [t] = F(), { link: n } = H(), { t: r } = a();
477
+ return /* @__PURE__ */ _(V, {
478
+ icon: "cancellink",
479
+ tooltip: r("cancelLink"),
480
+ disabled: e,
481
+ onClick: () => {
482
+ n && t.dispatchCommand(Oe, null);
483
+ }
484
+ });
485
+ }, W = {
486
+ "picture-modal__container": "_picture-modal__container_1067t_1",
487
+ "picture-modal__sidebar": "_picture-modal__sidebar_1067t_4",
488
+ "picture-modal__menu-list": "_picture-modal__menu-list_1067t_8",
489
+ "picture-modal__menu-item": "_picture-modal__menu-item_1067t_13",
490
+ "picture-modal__menu-item--active": "_picture-modal__menu-item--active_1067t_22",
491
+ "picture-modal__content": "_picture-modal__content_1067t_25",
492
+ "picture-modal__content-body": "_picture-modal__content-body_1067t_31",
493
+ "picture-modal__ops": "_picture-modal__ops_1067t_34",
494
+ "picture-modal__content-title": "_picture-modal__content-title_1067t_42",
495
+ "picture-modal__upload-area": "_picture-modal__upload-area_1067t_53",
496
+ "picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_1067t_69",
497
+ "picture-modal__preview-list": "_picture-modal__preview-list_1067t_75",
498
+ "picture-modal__preview": "_picture-modal__preview_1067t_75",
499
+ "picture-modal__preview--error": "_picture-modal__preview--error_1067t_89",
500
+ "picture-modal__preview-image": "_picture-modal__preview-image_1067t_92",
501
+ "picture-modal__preview-mask": "_picture-modal__preview-mask_1067t_106",
502
+ "picture-modal__preview-spinner": "_picture-modal__preview-spinner_1067t_116",
503
+ "picture-modal-spin": "_picture-modal-spin_1067t_1",
504
+ "picture-modal__preview-info": "_picture-modal__preview-info_1067t_124",
505
+ "picture-modal__preview-filename": "_picture-modal__preview-filename_1067t_128",
506
+ "picture-modal__preview-filename--error": "_picture-modal__preview-filename--error_1067t_136",
507
+ "picture-modal__preview-size": "_picture-modal__preview-size_1067t_139",
508
+ "picture-modal__preview-delete": "_picture-modal__preview-delete_1067t_143",
509
+ "picture-modal__upload-text": "_picture-modal__upload-text_1067t_151",
510
+ "picture-modal__footer": "_picture-modal__footer_1067t_155"
511
+ }, ot = x((e, t) => {
512
+ let [n] = ne.useForm(), [r, i] = D(""), { t: o } = a(), s = (e) => /^https?:\/\/.+/i.test(e);
513
+ return ee(t, () => ({ getValue: async () => {
514
+ try {
515
+ return await n.validateFields(), r;
516
+ } catch {
517
+ throw Error("URL validation failed");
518
+ }
519
+ } })), /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
520
+ className: W["picture-modal__content-title"],
521
+ "data-title": o("editor.imageUrlNote"),
522
+ children: o("editor.enterImageUrl")
523
+ }), /* @__PURE__ */ _(ne, {
524
+ form: n,
525
+ children: /* @__PURE__ */ _(ne.Item, {
526
+ name: "url",
527
+ rules: [{
528
+ required: !0,
529
+ message: o("editor.pleaseEnterImageUrl")
530
+ }, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
531
+ children: /* @__PURE__ */ _(re, {
532
+ placeholder: o("editor.pleaseEnterImageUrl"),
533
+ value: r,
534
+ onChange: (e) => i(e.target.value)
535
+ })
536
+ })
537
+ })] });
538
+ });
539
+ ot.displayName = "LinkInput";
540
+ //#endregion
541
+ //#region src/components/Editor/utils/formatTruncatedFilename.ts
542
+ var st = "......", ct = (e, t, n) => {
543
+ if (t <= 0 || n(e) <= t) return {
544
+ display: e,
545
+ truncated: !1
546
+ };
547
+ let r = e.lastIndexOf("."), i = r > 0 && r < e.length - 1, a = i ? e.slice(0, r) : e, o = i ? e.slice(r) : "", s = a.slice(-2), c = a.slice(0, -2), l = (e) => `${e}${st}${s}${o}`, u = (e) => n(e) <= t;
548
+ if (!u(l(""))) {
549
+ let t = `${st}${o}`;
550
+ return {
551
+ display: u(t) ? t : e,
552
+ truncated: !0
553
+ };
554
+ }
555
+ let d = 0, f = c.length, p = 0;
556
+ for (; d <= f;) {
557
+ let e = d + f >> 1;
558
+ u(l(c.slice(0, e))) ? (p = e, d = e + 1) : f = e - 1;
559
+ }
560
+ return {
561
+ display: l(c.slice(0, p)),
562
+ truncated: !0
563
+ };
564
+ }, lt = b(null), ut = b({ text: "" }), G = () => {
565
+ let e = C(lt);
566
+ if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
567
+ return e;
568
+ }, dt = () => C(ut), ft = "EditorImageUploadingError";
569
+ function pt(e) {
570
+ if (!e || typeof e != "object" || !("name" in e)) return !1;
571
+ let t = String(e.name);
572
+ return t === "AbortError" || t === "CanceledError";
573
+ }
574
+ function mt(e) {
575
+ return f.includes(e.name.split(".").pop()?.toLowerCase() ?? "");
576
+ }
577
+ function ht(e) {
578
+ if (Number.isFinite(e)) return Math.min(100, Math.max(0, e));
579
+ }
580
+ function gt(e) {
581
+ return e === void 0 ? .55 : .55 * (1 - e / 100);
582
+ }
583
+ //#endregion
584
+ //#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
585
+ var _t = {
586
+ duration: .2,
587
+ ease: [
588
+ .4,
589
+ 0,
590
+ .2,
591
+ 1
592
+ ]
593
+ }, vt = ({ name: e, error: t }) => {
594
+ let n = E(null), [r, i] = D(e), [a, o] = D(!1);
595
+ return T(() => {
596
+ let t = n.current, r = document.createElement("canvas").getContext("2d");
597
+ if (!t || !r) return;
598
+ let a = () => {
599
+ r.font = getComputedStyle(t).font;
600
+ let n = ct(e, t.clientWidth, (e) => r.measureText(e).width);
601
+ i(n.display), o(n.truncated);
602
+ };
603
+ a();
604
+ let s = new ResizeObserver(a);
605
+ return s.observe(t), () => s.disconnect();
606
+ }, [e]), /* @__PURE__ */ _("div", {
607
+ ref: n,
608
+ className: A(W["picture-modal__preview-filename"], t && W["picture-modal__preview-filename--error"]),
609
+ title: a ? e : void 0,
610
+ children: r
611
+ });
612
+ }, yt = (e) => new Promise((t, n) => {
613
+ let r = new FileReader();
614
+ r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
615
+ }), bt = x((t, n) => {
616
+ let { upload: r } = G(), [i, o] = D(!1), [s, c] = D([]), l = E(s);
617
+ l.current = s;
618
+ let u = E(null), f = E(/* @__PURE__ */ new Map()), p = r?.customRequest, [m, h] = k.useMessage(), { t: g } = a(), y = (e) => (e / 1024).toFixed(1) + "kb", b = (e, t) => {
619
+ c((n) => n.map((n) => n.id === e ? {
620
+ ...n,
621
+ ...t
622
+ } : n));
623
+ }, x = (e, t) => {
624
+ if (!p) {
625
+ b(e, { status: "success" });
626
+ return;
627
+ }
628
+ let n = new AbortController();
629
+ f.current.set(e, n), p(t, {
630
+ signal: n.signal,
631
+ onProgress: (t) => {
632
+ let n = ht(t);
633
+ n !== void 0 && b(e, { percent: n });
634
+ }
635
+ }).then((t) => {
636
+ n.signal.aborted || b(e, {
637
+ status: "success",
638
+ src: typeof t == "string" ? t : t.url,
639
+ percent: 100,
640
+ attachment: typeof t == "string" ? void 0 : t.attachment
641
+ });
642
+ }).catch((t) => {
643
+ n.signal.aborted || pt(t) || b(e, { status: "error" });
644
+ }).finally(() => {
645
+ f.current.delete(e);
646
+ });
647
+ }, S = (e) => mt(e) ? e.size > 5242880 ? (m.warning(g("editor.imageSizeNote")), !1) : !0 : (m.warning(g("editor.onlyImageFormatsSupported")), !1), C = (e) => {
648
+ let t = 10 - l.current.length;
649
+ if (t <= 0) {
650
+ m.warning(g("editor.imageCountNote", { count: 10 }));
651
+ return;
652
+ }
653
+ let n = Array.from(e).filter(S), r = n.slice(0, t);
654
+ if (n.length > t && m.warning(g("editor.imageCountNote", { count: 10 })), !r.length) return;
655
+ let i = r.map((e) => ({
656
+ id: `${e.name}-${e.size}-${e.lastModified}-${Math.random()}`,
657
+ file: e,
658
+ url: URL.createObjectURL(e),
659
+ status: p ? "uploading" : "success"
660
+ }));
661
+ c((e) => [...e, ...i]), i.forEach((e) => {
662
+ x(e.id, e.file);
663
+ });
664
+ }, T = (e) => {
665
+ f.current.get(e)?.abort(), f.current.delete(e), c((t) => {
666
+ let n = t.find((t) => t.id === e);
667
+ return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
668
+ });
669
+ }, te = () => {
670
+ u.current?.click();
671
+ }, O = (e) => {
672
+ e.target.files?.length && C(e.target.files), e.target.value = "";
673
+ };
674
+ return w(() => () => {
675
+ f.current.forEach((e) => e.abort()), f.current.clear(), l.current.forEach((e) => URL.revokeObjectURL(e.url));
676
+ }, []), ee(n, () => ({ getValue: async () => {
677
+ if (s.some((e) => e.status === "uploading")) {
678
+ let e = Error(g("editor.imageUploading"));
679
+ throw e.name = ft, e;
680
+ }
681
+ let e = s.filter((e) => e.status === "success");
682
+ if (!e.length) throw m.warning(g("editor.pleaseUploadImageFirst")), Error(g("editor.pleaseUploadImageFirst"));
683
+ try {
684
+ return await Promise.all(e.map(async (e) => ({
685
+ src: e.src ?? await yt(e.file),
686
+ fileName: e.file.name,
687
+ attachment: e.attachment
688
+ })));
689
+ } catch {
690
+ throw Error(g("editor.operationFailed"));
691
+ }
692
+ } }), [
693
+ s,
694
+ m,
695
+ g
696
+ ]), /* @__PURE__ */ v("div", {
697
+ onDragOver: (e) => {
698
+ e.preventDefault(), o(!0);
699
+ },
700
+ onDragLeave: (e) => {
701
+ e.preventDefault(), o(!1);
702
+ },
703
+ onDrop: (e) => {
704
+ e.preventDefault(), o(!1), e.dataTransfer.files.length && C(e.dataTransfer.files);
705
+ },
706
+ children: [
707
+ /* @__PURE__ */ v("div", {
708
+ className: W["picture-modal__ops"],
709
+ children: [/* @__PURE__ */ _("div", {
710
+ className: W["picture-modal__content-title"],
711
+ "data-title": g("editor.imageSizeNote"),
712
+ children: g("editor.uploadImage")
713
+ }), /* @__PURE__ */ v("div", {
714
+ className: `${W["picture-modal__upload-area"]} ${i ? W["picture-modal__upload-area--dragging"] : ""}`,
715
+ onClick: te,
716
+ children: [/* @__PURE__ */ _(e, { name: "upload" }), /* @__PURE__ */ _("span", {
717
+ className: W["picture-modal__upload-text"],
718
+ children: g("editor.clickOrDragToUpload")
719
+ })]
720
+ })]
721
+ }),
722
+ s.length > 0 ? /* @__PURE__ */ _("div", {
723
+ className: W["picture-modal__preview-list"],
724
+ children: /* @__PURE__ */ _(ie, {
725
+ mode: "popLayout",
726
+ children: s.map((t) => /* @__PURE__ */ v(ae.div, {
727
+ layout: "position",
728
+ className: A(W["picture-modal__preview"], t.status === "error" && W["picture-modal__preview--error"]),
729
+ initial: {
730
+ opacity: 0,
731
+ y: 12
732
+ },
733
+ animate: {
734
+ opacity: 1,
735
+ y: 0
736
+ },
737
+ exit: {
738
+ opacity: 0,
739
+ y: -8
740
+ },
741
+ transition: _t,
742
+ children: [
743
+ /* @__PURE__ */ v("div", {
744
+ className: W["picture-modal__preview-image"],
745
+ children: [/* @__PURE__ */ _("img", {
746
+ src: t.url,
747
+ alt: g("editor.previewImage")
748
+ }), t.status === "uploading" ? /* @__PURE__ */ _("div", {
749
+ className: W["picture-modal__preview-mask"],
750
+ style: { opacity: gt(t.percent) },
751
+ children: t.percent === void 0 ? /* @__PURE__ */ _("span", { className: W["picture-modal__preview-spinner"] }) : null
752
+ }) : null]
753
+ }),
754
+ /* @__PURE__ */ v("div", {
755
+ className: W["picture-modal__preview-info"],
756
+ children: [/* @__PURE__ */ _(vt, {
757
+ name: t.file.name,
758
+ error: t.status === "error"
759
+ }), /* @__PURE__ */ _("div", {
760
+ className: W["picture-modal__preview-size"],
761
+ children: y(t.file.size)
762
+ })]
763
+ }),
764
+ /* @__PURE__ */ _("div", {
765
+ className: W["picture-modal__preview-delete"],
766
+ role: "button",
767
+ onClick: () => T(t.id),
768
+ children: /* @__PURE__ */ _(e, { name: "delete" })
769
+ })
770
+ ]
771
+ }, t.id))
772
+ })
773
+ }) : null,
774
+ /* @__PURE__ */ _("input", {
775
+ ref: u,
776
+ type: "file",
777
+ accept: d,
778
+ multiple: !0,
779
+ style: { display: "none" },
780
+ onChange: O
781
+ }),
782
+ h
783
+ ]
784
+ });
785
+ });
786
+ bt.displayName = "UploadImage";
787
+ //#endregion
788
+ //#region src/components/Editor/commands/ImageCommands.ts
789
+ var xt = Ce("INSERT_INLINE_IMAGE_COMMAND"), St = ({ disabled: t }) => {
790
+ let { t: n } = a(), [i] = F(), { attachmentsBySrcRef: o } = G(), [s, l] = D(!1), u = E(null), d = E(null), f = [{
791
+ key: "upload",
792
+ title: n("editor.uploadImage"),
793
+ icon: /* @__PURE__ */ _(e, { name: "picture" })
794
+ }, {
795
+ key: "url",
796
+ title: n("editor.imageUrl"),
797
+ icon: /* @__PURE__ */ _(e, { name: "Insertlink" })
798
+ }], [p, m] = D(f[0].key), h = async () => {
799
+ try {
800
+ if (p === "upload" && d.current) (await d.current.getValue()).forEach((e) => {
801
+ e.attachment !== void 0 && o.current.set(e.src, e.attachment), i.dispatchCommand(xt, {
802
+ src: e.src,
803
+ altText: e.fileName
804
+ });
805
+ });
806
+ else if (u.current) {
807
+ let e = await u.current.getValue();
808
+ i.dispatchCommand(xt, {
809
+ src: e,
810
+ altText: e
811
+ });
812
+ }
813
+ l(!1);
814
+ } catch (e) {
815
+ let t = e instanceof Error ? e.message : n("editor.operationFailed");
816
+ if (e instanceof Error && e.name === "EditorImageUploadingError") {
817
+ k.warning(t);
818
+ return;
819
+ }
820
+ k.error(t);
821
+ }
822
+ }, y = {
823
+ upload: /* @__PURE__ */ _(bt, { ref: d }),
824
+ url: /* @__PURE__ */ _(ot, { ref: u })
825
+ };
826
+ return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(V, {
827
+ icon: "picture",
828
+ tooltip: n("picture"),
829
+ disabled: t,
830
+ onClick: () => l(!0)
831
+ }), /* @__PURE__ */ v(r, {
832
+ title: n("addPicture"),
833
+ open: s,
834
+ onOpenChange: l,
835
+ width: "620px",
836
+ children: [/* @__PURE__ */ v("div", {
837
+ className: W["picture-modal__container"],
838
+ children: [/* @__PURE__ */ _("div", {
839
+ className: W["picture-modal__sidebar"],
840
+ children: /* @__PURE__ */ _("ul", {
841
+ className: W["picture-modal__menu-list"],
842
+ children: f.map((e) => /* @__PURE__ */ v("li", {
843
+ className: `${W["picture-modal__menu-item"]} ${p === e.key ? W["picture-modal__menu-item--active"] : ""}`,
844
+ onClick: () => m(e.key),
845
+ children: [/* @__PURE__ */ _("span", {
846
+ className: W["picture-modal__menu-icon"],
847
+ children: e.icon
848
+ }), /* @__PURE__ */ _("span", { children: e.title })]
849
+ }, e.title))
850
+ })
851
+ }), /* @__PURE__ */ _(c, {
852
+ className: W["picture-modal__content"],
853
+ contentClassName: W["picture-modal__content-body"],
854
+ children: y[p]
855
+ })]
856
+ }), /* @__PURE__ */ v("div", {
857
+ className: W["picture-modal__footer"],
858
+ children: [/* @__PURE__ */ _(O, {
859
+ onClick: () => l(!1),
860
+ children: n("cancel")
861
+ }), /* @__PURE__ */ _(O, {
862
+ type: "primary",
863
+ onClick: h,
864
+ children: n("confirm")
865
+ })]
866
+ })]
867
+ })] });
868
+ }, Ct = ({ disabled: e }) => {
869
+ let [t] = F(), { canUndo: n } = Ke(), { t: r } = a();
870
+ return /* @__PURE__ */ _(V, {
871
+ icon: "chexiao",
872
+ tooltip: r("editor.undo"),
873
+ disabled: e || !n,
874
+ onClick: () => {
875
+ t.dispatchCommand(Se, void 0);
876
+ }
877
+ });
878
+ }, wt = ({ disabled: e }) => {
879
+ let [t] = F(), { canRedo: n } = Ke(), { t: r } = a();
880
+ return /* @__PURE__ */ _(V, {
881
+ icon: "fanhui",
882
+ tooltip: r("editor.redo"),
883
+ disabled: e || !n,
884
+ onClick: () => t.dispatchCommand(xe, void 0)
885
+ });
886
+ }, Tt = ({ disabled: e }) => {
887
+ let [t] = F(), { strikethrough: n } = H(), { t: r } = a();
888
+ return /* @__PURE__ */ _(V, {
889
+ icon: "shanchuxian",
890
+ tooltip: r("editor.strikethrough"),
891
+ active: n,
892
+ disabled: e,
893
+ onClick: () => t.dispatchCommand(P, "strikethrough")
894
+ });
895
+ }, Et = ({ disabled: e }) => {
896
+ let [t] = F(), { superscript: n } = H(), { t: r } = a();
897
+ return /* @__PURE__ */ _(V, {
898
+ icon: "shangbiao",
899
+ tooltip: r("editor.superscript"),
900
+ active: n,
901
+ disabled: e,
902
+ onClick: () => t.dispatchCommand(P, "superscript")
903
+ });
904
+ }, Dt = ({ disabled: e }) => {
905
+ let [t] = F(), { subscript: n } = H(), { t: r } = a();
906
+ return /* @__PURE__ */ _(V, {
907
+ icon: "xiabiao",
908
+ tooltip: r("editor.subscript"),
909
+ active: n,
910
+ disabled: e,
911
+ onClick: () => t.dispatchCommand(P, "subscript")
912
+ });
913
+ }, Ot = ({ disabled: e }) => {
914
+ let [t] = F(), { t: n } = a();
915
+ return /* @__PURE__ */ _(V, {
916
+ icon: "zengjiasuojin",
917
+ tooltip: n("editor.indent"),
918
+ disabled: e,
919
+ onClick: () => t.dispatchCommand(ye, void 0)
920
+ });
921
+ }, kt = ({ disabled: e }) => {
922
+ let [t] = F(), { canOutdent: n } = H(), { t: r } = a();
923
+ return /* @__PURE__ */ v("div", {
924
+ className: R["bsy-lexical__toolbar-with-divider"],
925
+ children: [/* @__PURE__ */ _("div", { className: R["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ _(V, {
926
+ icon: "jianshaosuojin",
927
+ tooltip: r("editor.outdent"),
928
+ disabled: e || !n,
929
+ onClick: () => t.dispatchCommand(be, void 0)
930
+ })]
931
+ });
932
+ }, At = ({ disabled: e }) => {
933
+ let [t] = F(), { listType: n } = H(), { t: r } = a(), i = n === "bullet";
934
+ return /* @__PURE__ */ _(V, {
935
+ icon: "xuhaoliebiao",
936
+ tooltip: r("editor.bulletList"),
937
+ active: i,
938
+ disabled: e,
939
+ onClick: () => {
940
+ t.dispatchCommand(i ? je : Ae, void 0);
941
+ }
942
+ });
943
+ }, jt = ({ disabled: e }) => {
944
+ let [t] = F(), { listType: n } = H(), { t: r } = a(), i = n === "number";
945
+ return /* @__PURE__ */ _(V, {
946
+ icon: "bianhaoliebiao",
947
+ tooltip: r("editor.numberList"),
948
+ active: i,
949
+ disabled: e,
950
+ onClick: () => {
951
+ t.dispatchCommand(i ? je : ke, void 0);
952
+ }
953
+ });
954
+ }, Mt = ({ disabled: e }) => {
955
+ let [t] = F(), { isCodeBlock: n } = H(), { t: r } = a();
956
+ return /* @__PURE__ */ _(V, {
957
+ icon: "daima",
958
+ tooltip: r("editor.codeBlock"),
959
+ active: n,
960
+ disabled: e,
961
+ onClick: () => {
962
+ t.update(() => {
963
+ Te(M(), () => n ? j() : Me(ze));
964
+ });
965
+ }
966
+ });
967
+ }, K = {
968
+ "bsy-lexical__table-picker": "_bsy-lexical__table-picker_mv0nn_1",
969
+ "bsy-lexical__table-picker-grid": "_bsy-lexical__table-picker-grid_mv0nn_9",
970
+ "bsy-lexical__table-picker-cell": "_bsy-lexical__table-picker-cell_mv0nn_15",
971
+ "bsy-lexical__table-picker-cell--active": "_bsy-lexical__table-picker-cell--active_mv0nn_24",
972
+ "bsy-lexical__table-picker-label": "_bsy-lexical__table-picker-label_mv0nn_28"
973
+ }, Nt = h(1, 11), Pt = ({ disabled: e }) => {
974
+ let [r] = F(), { isInTable: i } = H(), { t: s } = a(), c = t(), [u, d] = D(!1), [f, p] = D({
975
+ rows: 0,
976
+ cols: 0
977
+ });
978
+ w(() => {
979
+ i && d(!1);
980
+ }, [i]);
981
+ let m = () => {
982
+ d(!1), p({
983
+ rows: 0,
984
+ cols: 0
985
+ });
986
+ }, { refs: h, floatingStyles: y, getReferenceProps: b, getFloatingProps: x } = l({
987
+ isOpen: u,
988
+ close: m,
989
+ showMask: !1,
990
+ zIndex: c,
991
+ popupMinWidth: "220px",
992
+ offset: L
993
+ });
994
+ return i ? /* @__PURE__ */ _(V, {
995
+ icon: "charubiaoge",
996
+ tooltip: s("editor.table"),
997
+ disabled: !0
998
+ }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
999
+ className: "inline-flex",
1000
+ ref: h.setReference,
1001
+ ...b({ onClick: () => d((e) => !e) }),
1002
+ children: /* @__PURE__ */ _(V, {
1003
+ icon: "charubiaoge",
1004
+ tooltip: s("editor.table"),
1005
+ disabled: e
1006
+ })
1007
+ }), /* @__PURE__ */ _(oe, { children: /* @__PURE__ */ _(n, {
1008
+ zIndex: c,
1009
+ children: /* @__PURE__ */ _(ie, { children: u ? /* @__PURE__ */ _(ae.div, {
1010
+ ref: h.setFloating,
1011
+ ...x(),
1012
+ style: {
1013
+ ...y,
1014
+ zIndex: c
1015
+ },
1016
+ ...o,
1017
+ children: /* @__PURE__ */ v("div", {
1018
+ className: K["bsy-lexical__table-picker"],
1019
+ onMouseDown: (e) => e.preventDefault(),
1020
+ onMouseLeave: () => p({
1021
+ rows: 0,
1022
+ cols: 0
1023
+ }),
1024
+ children: [/* @__PURE__ */ _("div", {
1025
+ className: K["bsy-lexical__table-picker-grid"],
1026
+ children: Nt.map((e) => Nt.map((t) => /* @__PURE__ */ _("button", {
1027
+ type: "button",
1028
+ className: A(K["bsy-lexical__table-picker-cell"], f.rows >= e && f.cols >= t && K["bsy-lexical__table-picker-cell--active"]),
1029
+ onMouseEnter: () => p({
1030
+ rows: e,
1031
+ cols: t
1032
+ }),
1033
+ onClick: () => {
1034
+ r.dispatchCommand(Ne, {
1035
+ rows: String(e),
1036
+ columns: String(t),
1037
+ includeHeaders: !1
1038
+ }), m();
1039
+ }
1040
+ }, `${e}-${t}`)))
1041
+ }), /* @__PURE__ */ v("div", {
1042
+ className: K["bsy-lexical__table-picker-label"],
1043
+ children: [
1044
+ f.rows,
1045
+ " × ",
1046
+ f.cols
1047
+ ]
1048
+ })]
1049
+ })
1050
+ }, "bsy-lexical-table-picker") : null })
1051
+ }) })] });
1052
+ }, Ft = b(null), It = () => {
1053
+ let e = C(Ft);
1054
+ if (!e) throw Error("useSourceMode must be used within SourceModeProvider");
1055
+ return e;
1056
+ }, Lt = ({ disabled: e }) => {
1057
+ let { t } = a(), { isSourceMode: n, toggleSourceMode: r } = It();
1058
+ return /* @__PURE__ */ _(V, {
1059
+ icon: "yuanmamoshi",
1060
+ tooltip: t("editor.sourceMode"),
1061
+ active: n,
1062
+ disabled: e,
1063
+ onClick: r
1064
+ });
1065
+ }, Rt = ({ disabled: t }) => {
1066
+ let [n] = F(), { headingTag: r, isInTable: i } = H(), { t: o } = a(), { iconSize: s } = z(), c = r || "paragraph", l = [
1067
+ {
1068
+ key: "paragraph",
1069
+ label: o("editor.paragraph")
1070
+ },
1071
+ {
1072
+ key: "h1",
1073
+ label: o("editor.heading1")
1074
+ },
1075
+ {
1076
+ key: "h2",
1077
+ label: o("editor.heading2")
1078
+ },
1079
+ {
1080
+ key: "h3",
1081
+ label: o("editor.heading3")
1082
+ }
1083
+ ], d = l.find((e) => e.key === c)?.label, f = S((e) => {
1084
+ let t = e.key;
1085
+ n.update(() => {
1086
+ Te(M(), () => t === "paragraph" ? j() : Pe(t));
1087
+ });
1088
+ }, [n]), p = /* @__PURE__ */ _("div", {
1089
+ className: R["bsy-lexical__toolbar-select"],
1090
+ style: { width: 78 },
1091
+ children: /* @__PURE__ */ _(V, {
1092
+ icon: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
1093
+ className: R["bsy-lexical__toolbar-select-label"],
1094
+ children: d
1095
+ }), /* @__PURE__ */ _(e, {
1096
+ name: "arrow-down",
1097
+ size: s,
1098
+ className: R["bsy-lexical__toolbar-select-arrow"]
1099
+ })] }),
1100
+ tooltip: o("editor.heading"),
1101
+ disabled: t || i
1102
+ })
1103
+ });
1104
+ return t || i ? p : /* @__PURE__ */ _(u, {
1105
+ menus: l,
1106
+ onClick: f,
1107
+ showSearch: !1,
1108
+ activeKey: [c],
1109
+ offset: L,
1110
+ style: {
1111
+ width: "110px",
1112
+ minWidth: "110px"
1113
+ },
1114
+ children: p
1115
+ });
1116
+ };
1117
+ //#endregion
1118
+ //#region src/components/Editor/utils/clearInlineTextFormat.ts
1119
+ function zt() {
1120
+ let e = M();
1121
+ if (N(e)) {
1122
+ I(e, {
1123
+ "font-size": null,
1124
+ color: null,
1125
+ "background-color": null
1126
+ });
1127
+ for (let t of e.getNodes()) pe(t) && t.setFormat(0);
1128
+ e.setFormat(0);
1129
+ }
1130
+ }
1131
+ //#endregion
1132
+ //#region src/components/Editor/ToolbarPlugin/Buttons/ClearFormatButton.tsx
1133
+ var Bt = ({ disabled: e }) => {
1134
+ let [t] = F(), { t: n } = a();
1135
+ return /* @__PURE__ */ _(V, {
1136
+ icon: "clearTree",
1137
+ tooltip: n("editor.clearFormat"),
1138
+ disabled: e,
1139
+ onClick: () => {
1140
+ t.update(() => {
1141
+ zt();
1142
+ });
1143
+ }
1144
+ });
1145
+ }, Vt = /<!--bsy-code-(\d+)-->/g, Ht = [
1146
+ "quick",
1147
+ "formal",
1148
+ "colloquial",
1149
+ "lively",
1150
+ "literary",
1151
+ "retro"
1152
+ ], Ut = {
1153
+ quick: "editor.aiPresetQuick",
1154
+ formal: "editor.aiPresetFormal",
1155
+ colloquial: "editor.aiPresetColloquial",
1156
+ lively: "editor.aiPresetLively",
1157
+ literary: "editor.aiPresetLiterary",
1158
+ retro: "editor.aiPresetRetro"
1159
+ };
1160
+ //#endregion
1161
+ //#region src/components/Editor/utils/htmlText.ts
1162
+ function Wt(e) {
1163
+ return /<[^>]*$/.test(e.trim());
1164
+ }
1165
+ function Gt(e) {
1166
+ return e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "";
1167
+ }
1168
+ //#endregion
1169
+ //#region src/components/Editor/utils/fillRootFromHtml.ts
1170
+ var Kt = [
1171
+ "color",
1172
+ "background-color",
1173
+ "font-size",
1174
+ "font-family",
1175
+ "font-weight",
1176
+ "text-decoration"
1177
+ ], qt = (e) => {
1178
+ let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
1179
+ for (let n of Array.from(t)) {
1180
+ let t = n, r = [];
1181
+ for (let e of Kt) {
1182
+ let n = t.style.getPropertyValue(e);
1183
+ n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
1184
+ }
1185
+ if (!r.length) continue;
1186
+ let i = r.join("; ");
1187
+ for (let n of Array.from(t.childNodes)) {
1188
+ if (n.nodeType === Node.TEXT_NODE && n.textContent) {
1189
+ let r = e.createElement("span");
1190
+ r.setAttribute("style", i), t.insertBefore(r, n), r.appendChild(n);
1191
+ continue;
1192
+ }
1193
+ if (n.nodeType === Node.ELEMENT_NODE) {
1194
+ let e = n, t = e.getAttribute("style");
1195
+ e.setAttribute("style", t ? `${t}; ${i}` : i);
1196
+ }
1197
+ }
1198
+ }
1199
+ };
1200
+ function Jt(e, t) {
1201
+ let n = ue();
1202
+ if (n.clear(), !t.trim()) return;
1203
+ let r = new DOMParser().parseFromString(t, "text/html");
1204
+ qt(r);
1205
+ let i = ce(e, r);
1206
+ i.length && (n.select(), de(i));
1207
+ }
1208
+ //#endregion
1209
+ //#region src/components/Editor/utils/isEmptyEditorHtml.ts
1210
+ function Yt(e, t) {
1211
+ return !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e));
1212
+ }
1213
+ //#endregion
1214
+ //#region src/components/Editor/utils/sanitizeEditorHtml.ts
1215
+ var Xt = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), Zt = [
1216
+ "href",
1217
+ "src",
1218
+ "alt",
1219
+ "target",
1220
+ "rel",
1221
+ "colspan",
1222
+ "rowspan",
1223
+ "data-language",
1224
+ "class",
1225
+ "style",
1226
+ "width",
1227
+ "height"
1228
+ ], Qt = new Set(/* @__PURE__ */ "color.background-color.font-size.font-family.font-weight.font-style.text-decoration.text-align.max-width.display.vertical-align.width.height.border.margin.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), $t = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, en = new Set([
1229
+ "pre",
1230
+ "code",
1231
+ "td",
1232
+ "th"
1233
+ ]), tn = new Set(["pre", "code"]), nn = (e, t) => Qt.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? en.has(t) : e === "border-radius" ? tn.has(t) : !0 : !1, rn = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
1234
+ let n = e.indexOf(":");
1235
+ if (n === -1) return null;
1236
+ let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
1237
+ if (r === "background") {
1238
+ if (/url\s*\(/i.test(i)) return null;
1239
+ r = "background-color";
1240
+ }
1241
+ return !nn(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
1242
+ }).filter((e) => e !== null).join("; "), an = !1, on = () => {
1243
+ an ||= (Fe.addHook("uponSanitizeAttribute", (e, t) => {
1244
+ if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
1245
+ t.keepAttr = !1;
1246
+ return;
1247
+ }
1248
+ t.attrName === "style" && (t.attrValue = rn(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
1249
+ }), !0);
1250
+ };
1251
+ function q(e) {
1252
+ return e ? (on(), Fe.sanitize(e, {
1253
+ ALLOWED_TAGS: Xt,
1254
+ ALLOWED_ATTR: Zt,
1255
+ ALLOW_DATA_ATTR: !1,
1256
+ ADD_ATTR: ["data-language"],
1257
+ ALLOWED_URI_REGEXP: $t
1258
+ })) : "";
1259
+ }
1260
+ //#endregion
1261
+ //#region src/components/Editor/utils/stitchCodePlaceholders.ts
1262
+ var sn = "bsy-html-root";
1263
+ function J(e) {
1264
+ return new DOMParser().parseFromString(`<${sn}>${e}</${sn}>`, "text/html").body.querySelector(sn);
1265
+ }
1266
+ function cn(e, t) {
1267
+ if (!t.length) return e;
1268
+ let n = /* @__PURE__ */ new Set(), r = e.replace(Vt, (e, r) => {
1269
+ let i = Number(r), a = t[i];
1270
+ return a === void 0 ? "" : (n.add(i), a);
1271
+ }), i = t.filter((e, t) => !n.has(t)).join("");
1272
+ return i ? `${r}${i}` : r;
1273
+ }
1274
+ function ln(e, t) {
1275
+ return cn(un(e), t);
1276
+ }
1277
+ function un(e) {
1278
+ if (!/<pre[\s>/]/i.test(e)) return e;
1279
+ let t = J(e);
1280
+ if (!t) return e;
1281
+ let n = t.ownerDocument;
1282
+ for (let e of Array.from(t.querySelectorAll("pre"))) {
1283
+ let t = n.createComment("bsy-code-dropped");
1284
+ e.replaceWith(t);
1285
+ }
1286
+ return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
1287
+ }
1288
+ //#endregion
1289
+ //#region src/components/Editor/constants/portableEditorStyles.ts
1290
+ var Y = {
1291
+ margin: "0.6em 0 0.4em",
1292
+ "font-weight": "600",
1293
+ "line-height": "1.35"
1294
+ }, dn = {
1295
+ h1: {
1296
+ ...Y,
1297
+ "font-size": "2em"
1298
+ },
1299
+ h2: {
1300
+ ...Y,
1301
+ "font-size": "1.5em"
1302
+ },
1303
+ h3: {
1304
+ ...Y,
1305
+ "font-size": "1.25em"
1306
+ },
1307
+ h4: {
1308
+ ...Y,
1309
+ "font-size": "1.125em"
1310
+ },
1311
+ h5: {
1312
+ ...Y,
1313
+ "font-size": "1em"
1314
+ },
1315
+ h6: {
1316
+ ...Y,
1317
+ "font-size": "0.875em"
1318
+ }
1319
+ }, fn = {
1320
+ color: "#0269ff",
1321
+ cursor: "pointer"
1322
+ }, pn = {
1323
+ margin: "0",
1324
+ "padding-inline-start": "24px",
1325
+ "list-style-position": "outside"
1326
+ }, mn = [
1327
+ "disc",
1328
+ "circle",
1329
+ "square"
1330
+ ], hn = {
1331
+ margin: "0",
1332
+ "list-style": "inherit"
1333
+ }, gn = {
1334
+ margin: "0",
1335
+ "list-style-type": "none"
1336
+ }, _n = {
1337
+ display: "block",
1338
+ "box-sizing": "border-box",
1339
+ "max-width": "100%",
1340
+ margin: "8px 0",
1341
+ padding: "8px 12px",
1342
+ "overflow-x": "auto",
1343
+ "font-family": "Menlo, Consolas, Monaco, monospace",
1344
+ "font-size": "13px",
1345
+ "line-height": "1.53",
1346
+ "white-space": "pre",
1347
+ "tab-size": "2",
1348
+ "border-radius": "4px",
1349
+ "background-color": "rgb(240, 242, 245)",
1350
+ color: "#1f2328"
1351
+ }, vn = {
1352
+ "border-collapse": "collapse",
1353
+ "table-layout": "fixed",
1354
+ width: "100%",
1355
+ "overflow-x": "auto",
1356
+ margin: "8px 0"
1357
+ }, yn = {
1358
+ "box-sizing": "border-box",
1359
+ "min-width": "75px",
1360
+ "min-height": "32px",
1361
+ padding: "4px 8px",
1362
+ border: "1px solid #d9d9d9",
1363
+ "vertical-align": "top"
1364
+ }, bn = {
1365
+ "font-weight": "600",
1366
+ "background-color": "#f2f3f5"
1367
+ }, X = (e, t) => {
1368
+ for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
1369
+ }, xn = (e) => {
1370
+ let t = 0, n = e;
1371
+ for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
1372
+ return t;
1373
+ }, Sn = (e) => {
1374
+ for (let t of Array.from(e.querySelectorAll("*"))) {
1375
+ if (!(t instanceof HTMLElement)) continue;
1376
+ let e = t.tagName.toLowerCase(), n = dn[e];
1377
+ if (n && X(t, n), e === "a" && X(t, fn), e === "ul") {
1378
+ let e = Math.min(Math.max(xn(t), 1), mn.length);
1379
+ X(t, {
1380
+ ...pn,
1381
+ "list-style-type": mn[e - 1]
1382
+ });
1383
+ }
1384
+ e === "ol" && X(t, {
1385
+ ...pn,
1386
+ "list-style-type": "decimal"
1387
+ }), e === "li" && X(t, t.classList.contains("editor-nested-listitem") ? gn : hn), e === "pre" && X(t, _n), e === "table" && X(t, vn), (e === "td" || e === "th") && (X(t, yn), (e === "th" || t.classList.contains("editor-table-cell-header")) && X(t, bn)), t.classList.contains("editor-text-underline-strikethrough") ? X(t, { "text-decoration": "underline line-through" }) : t.classList.contains("editor-text-underline") ? X(t, { "text-decoration": "underline" }) : t.classList.contains("editor-text-strikethrough") && X(t, { "text-decoration": "line-through" });
1388
+ for (let e of Array.from(t.classList)) e.startsWith("editor-") && t.classList.remove(e);
1389
+ t.classList.length === 0 && t.removeAttribute("class");
1390
+ }
1391
+ }, Cn = (e) => {
1392
+ let t = e.parentNode;
1393
+ if (t) {
1394
+ for (; e.firstChild;) t.insertBefore(e.firstChild, e);
1395
+ t.removeChild(e);
1396
+ }
1397
+ }, wn = (e) => {
1398
+ let t = !0;
1399
+ for (; t;) {
1400
+ t = !1;
1401
+ for (let n of Array.from(e.querySelectorAll("span, b, i"))) {
1402
+ if (n.attributes.length > 0) continue;
1403
+ let e = n.tagName.toLowerCase();
1404
+ if (e === "span") {
1405
+ Cn(n), t = !0;
1406
+ continue;
1407
+ }
1408
+ if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
1409
+ let r = n.firstElementChild;
1410
+ (e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (Cn(n), t = !0);
1411
+ }
1412
+ }
1413
+ };
1414
+ function Tn(e) {
1415
+ if (!e.trim()) return e;
1416
+ let t = new DOMParser().parseFromString(e, "text/html");
1417
+ return Sn(t.body), wn(t.body), t.body.innerHTML;
1418
+ }
1419
+ //#endregion
1420
+ //#region src/components/Editor/utils/applyAiPolish.ts
1421
+ var En = "<!--bsy-block-->";
1422
+ function Dn(e) {
1423
+ return e.join(`\n\n${En}\n\n`);
1424
+ }
1425
+ function On(e) {
1426
+ return e.includes("<!--bsy-block-->") ? e.split(En).map((e) => e.trim()) : [e];
1427
+ }
1428
+ function kn(e) {
1429
+ return e.split(En).join("").trim().length > 0;
1430
+ }
1431
+ function An(e, t) {
1432
+ let n = e.map(() => "");
1433
+ if (e.length === 0) return n;
1434
+ let r = [], i = [];
1435
+ if (e.forEach((e, t) => {
1436
+ for (let n of Array.from(e)) i.push(n), r.push(t);
1437
+ }), i.length === 0) return n[0] = t, n;
1438
+ let a = i, o = Array.from(t), s = a.length, c = o.length, l = Array.from({ length: s + 1 }, () => Array(c + 1).fill(0));
1439
+ for (let e = s - 1; e >= 0; e--) for (let t = c - 1; t >= 0; t--) l[e][t] = a[e] === o[t] ? l[e + 1][t + 1] + 1 : Math.max(l[e + 1][t], l[e][t + 1]);
1440
+ let u = 0, d = 0, f = r[0];
1441
+ for (; u < s && d < c;) a[u] === o[d] ? (f = r[u], n[f] += o[d], u += 1, d += 1) : l[u + 1][d] >= l[u][d + 1] ? (f = r[u], u += 1) : (n[f] += o[d], d += 1);
1442
+ for (; d < c;) n[n.length - 1] += o[d], d += 1;
1443
+ return n;
1444
+ }
1445
+ var jn = new Set(["PRE"]), Mn = new Set([
1446
+ "PRE",
1447
+ "TABLE",
1448
+ "THEAD",
1449
+ "TBODY",
1450
+ "TR",
1451
+ "TD",
1452
+ "TH",
1453
+ "IMG",
1454
+ "BR"
1455
+ ]);
1456
+ function Nn(e) {
1457
+ let t = [], n = (e) => {
1458
+ if (e.nodeType === Node.ELEMENT_NODE) {
1459
+ let t = e.tagName;
1460
+ if (jn.has(t)) return;
1461
+ for (let t of Array.from(e.childNodes)) n(t);
1462
+ return;
1463
+ }
1464
+ e.nodeType === Node.TEXT_NODE && t.push(e);
1465
+ };
1466
+ return n(e), t;
1467
+ }
1468
+ function Pn(e, t) {
1469
+ let n = e;
1470
+ for (; n && n !== t && !Mn.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, pre, table, br");) {
1471
+ let e = n.parentElement;
1472
+ n.remove(), n = e;
1473
+ }
1474
+ }
1475
+ function Fn(e) {
1476
+ let t = e.tagName;
1477
+ return t === "PRE" || t === "IMG" || t === "TABLE";
1478
+ }
1479
+ function In(e) {
1480
+ let t = J(e);
1481
+ return t ? Array.from(t.children).filter((e) => !Fn(e)).map((e) => e.textContent ?? "") : [];
1482
+ }
1483
+ function Ln(e) {
1484
+ return e.includes("<!--bsy-block-->") ? e : Gt(e) || e;
1485
+ }
1486
+ function Rn(e, t) {
1487
+ let n = Nn(e);
1488
+ if (n.length === 0) {
1489
+ t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
1490
+ return;
1491
+ }
1492
+ let r = An(n.map((e) => e.textContent ?? ""), t);
1493
+ for (let t = 0; t < n.length; t++) {
1494
+ let i = r[t], a = n[t];
1495
+ if (i) {
1496
+ a.textContent = i;
1497
+ continue;
1498
+ }
1499
+ let o = a.parentElement;
1500
+ a.remove(), Pn(o, e);
1501
+ }
1502
+ }
1503
+ function zn(e, t) {
1504
+ let n = Ln(t);
1505
+ if (!kn(n) || !e.trim()) return "";
1506
+ let r = J(e);
1507
+ if (!r) return "";
1508
+ let i = Array.from(r.children).filter((e) => !Fn(e));
1509
+ if (i.length === 0) return "";
1510
+ let a = On(n), o = a.length === i.length ? a : An(i.map((e) => e.textContent ?? ""), a.join(""));
1511
+ for (let e = 0; e < i.length; e++) Rn(i[e], o[e] ?? "");
1512
+ return r.innerHTML;
1513
+ }
1514
+ function Bn(e, t) {
1515
+ let n = "";
1516
+ e.getEditorState().read(() => {
1517
+ n = Tn(q(se(e, null)));
1518
+ }, { editor: e });
1519
+ let r = q(zn(n, t));
1520
+ return !r.trim() || Yt(r, Gt(r)) ? !1 : (e.update(() => {
1521
+ Jt(e, r);
1522
+ }, { discrete: !0 }), !0);
1523
+ }
1524
+ //#endregion
1525
+ //#region src/components/Editor/utils/extractCodePlaceholders.ts
1526
+ function Vn(e) {
1527
+ if (!e.trim()) return {
1528
+ html: e,
1529
+ blocks: []
1530
+ };
1531
+ let t = new DOMParser().parseFromString(e, "text/html"), n = [], r = Array.from(t.body.querySelectorAll("pre"));
1532
+ for (let e of r) {
1533
+ n.push(e.outerHTML);
1534
+ let r = t.createComment(`bsy-code-${n.length - 1}`);
1535
+ e.replaceWith(r);
1536
+ }
1537
+ return {
1538
+ html: t.body.innerHTML,
1539
+ blocks: n
1540
+ };
1541
+ }
1542
+ //#endregion
1543
+ //#region src/components/Editor/utils/readEditorAiSnapshot.ts
1544
+ function Hn(e) {
1545
+ let t = "", n = "", r = "";
1546
+ e.getEditorState().read(() => {
1547
+ n = ue().getTextContent(), t = Tn(q(se(e, null))), r = Dn(In(t));
1548
+ }, { editor: e });
1549
+ let i = Vn(t);
1550
+ return {
1551
+ html: t,
1552
+ text: n,
1553
+ polishText: r,
1554
+ htmlWithoutCode: i.html,
1555
+ codeBlocks: i.blocks
1556
+ };
1557
+ }
1558
+ //#endregion
1559
+ //#region src/components/Editor/Preview/preview.module.scss
1560
+ var Z = {
1561
+ "bsy-lexical-ai__trigger": "_bsy-lexical-ai__trigger_1ke2e_1",
1562
+ "bsy-lexical-ai__icon": "_bsy-lexical-ai__icon_1ke2e_4",
1563
+ "bsy-lexical-ai__dialog": "_bsy-lexical-ai__dialog_1ke2e_11",
1564
+ "bsy-lexical-ai__pane": "_bsy-lexical-ai__pane_1ke2e_16",
1565
+ "bsy-lexical-ai__column": "_bsy-lexical-ai__column_1ke2e_22",
1566
+ "bsy-lexical-ai__column-head": "_bsy-lexical-ai__column-head_1ke2e_32",
1567
+ "bsy-lexical-ai__column-title": "_bsy-lexical-ai__column-title_1ke2e_39",
1568
+ "bsy-lexical-ai__column-title--before": "_bsy-lexical-ai__column-title--before_1ke2e_53",
1569
+ "bsy-lexical-ai__column-dot": "_bsy-lexical-ai__column-dot_1ke2e_57",
1570
+ "bsy-lexical-ai__column-title--after": "_bsy-lexical-ai__column-title--after_1ke2e_60",
1571
+ "bsy-lexical-ai__column-stack": "_bsy-lexical-ai__column-stack_1ke2e_73",
1572
+ "bsy-lexical-ai__column-body": "_bsy-lexical-ai__column-body_1ke2e_79",
1573
+ "bsy-lexical-ai__think-pin": "_bsy-lexical-ai__think-pin_1ke2e_86",
1574
+ "bsy-lexical-ai__think-head": "_bsy-lexical-ai__think-head_1ke2e_90",
1575
+ "bsy-lexical-ai__think-label": "_bsy-lexical-ai__think-label_1ke2e_109",
1576
+ "bsy-lexical-ai__think-label--shimmer": "_bsy-lexical-ai__think-label--shimmer_1ke2e_113",
1577
+ "bsy-lexical-ai-think-shimmer": "_bsy-lexical-ai-think-shimmer_1ke2e_1",
1578
+ "bsy-lexical-ai__think-arrow": "_bsy-lexical-ai__think-arrow_1ke2e_124",
1579
+ "bsy-lexical-ai__think-arrow--open": "_bsy-lexical-ai__think-arrow--open_1ke2e_131",
1580
+ "bsy-lexical-ai__think-icon": "_bsy-lexical-ai__think-icon_1ke2e_134",
1581
+ "bsy-lexical-ai-think": "_bsy-lexical-ai-think_1ke2e_1",
1582
+ "bsy-lexical-ai__think-collapse": "_bsy-lexical-ai__think-collapse_1ke2e_146",
1583
+ "bsy-lexical-ai__think-collapse--grown": "_bsy-lexical-ai__think-collapse--grown_1ke2e_151",
1584
+ "bsy-lexical-ai__think-body": "_bsy-lexical-ai__think-body_1ke2e_155",
1585
+ "bsy-lexical-ai__html": "_bsy-lexical-ai__html_1ke2e_165",
1586
+ "bsy-lexical-ai__footer": "_bsy-lexical-ai__footer_1ke2e_175",
1587
+ "bsy-lexical-ai__error": "_bsy-lexical-ai__error_1ke2e_183",
1588
+ "bsy-lexical-ai__preset": "_bsy-lexical-ai__preset_1ke2e_188"
1589
+ }, Un = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA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ryWzQSZJh+J7y/vNAaHwMncIDaOHwedyAHyd5x/3JbvO4bK9/+x81+uH6gGaCzd5oQqhTfJbpa0L6jN9IuR3Z7nmkS+L4MKfykqOH9ToJ1LrZ81YfHJ+KzxUBAg8edtf2std5fDavtbvZPGDBdga508P7dGeVYeaQ5yxcndavPp1cEhjJVHWou5h4YAjbeIinyoPSP2nue/yFlpf9b/euXJ69DujDD/iy+1JkqHjoBeIfOMPtYElswTzq6av2s+//OHWwk4UCe4H5DJUqofpVwONXaEgo8YzOHqsYH4EtlnTgM0+COFl26gyD5hiLPIizPicP2fKkc4whGOcCjwKViIGaRSStOhAAAAAElFTkSuQmCC", Q = 16, Gn = ({ disabled: t }) => {
1590
+ let [n] = F(), { typeset: r, polish: i, canTypeset: o, canPolish: s, aiOpen: c, setAiOpen: l, aiSessionRef: d } = G(), { hasEditorText: f } = H(), { t: p } = a(), { iconSize: m } = z(), h = t || !o || !f, y = t || !s || !f, b = t || !!c, x = S(() => {
1591
+ if (t || !o || !r) return;
1592
+ let e = Hn(n);
1593
+ e.text.trim() && (d.current = {
1594
+ originalHtml: e.html,
1595
+ codeBlocks: e.codeBlocks
1596
+ }, l("typeset"), r({
1597
+ text: e.text,
1598
+ html: e.htmlWithoutCode
1599
+ }));
1600
+ }, [
1601
+ d,
1602
+ o,
1603
+ t,
1604
+ n,
1605
+ l,
1606
+ r
1607
+ ]), C = S((e) => {
1608
+ if (t || !s || !i) return;
1609
+ let r = Hn(n);
1610
+ kn(r.polishText) && (d.current = {
1611
+ originalHtml: r.html,
1612
+ originalText: r.polishText,
1613
+ preset: e
1614
+ }, l("polish"), i({
1615
+ text: r.polishText,
1616
+ preset: e
1617
+ }));
1618
+ }, [
1619
+ d,
1620
+ s,
1621
+ t,
1622
+ n,
1623
+ i,
1624
+ l
1625
+ ]), w = S((e) => {
1626
+ if (e.key === "typeset") {
1627
+ x();
1628
+ return;
1629
+ }
1630
+ Ht.includes(e.key) && C(e.key);
1631
+ }, [C, x]), ee = [{
1632
+ key: "typeset",
1633
+ label: p("editor.aiTypeset"),
1634
+ disabled: h,
1635
+ icon: /* @__PURE__ */ _("img", {
1636
+ src: Un,
1637
+ alt: "",
1638
+ width: Q,
1639
+ height: Q,
1640
+ className: Z["bsy-lexical-ai__icon"],
1641
+ draggable: !1
1642
+ })
1643
+ }, {
1644
+ key: "polish",
1645
+ label: p("editor.aiPolish"),
1646
+ disabled: y,
1647
+ icon: /* @__PURE__ */ _("img", {
1648
+ src: Wn,
1649
+ alt: "",
1650
+ width: Q,
1651
+ height: Q,
1652
+ className: Z["bsy-lexical-ai__icon"],
1653
+ draggable: !1
1654
+ }),
1655
+ children: Ht.map((e) => ({
1656
+ key: e,
1657
+ label: p(Ut[e])
1658
+ }))
1659
+ }], T = /* @__PURE__ */ _("div", {
1660
+ className: A(R["bsy-lexical__toolbar-select"], R["bsy-lexical__toolbar-select--ai"], Z["bsy-lexical-ai__trigger"]),
1661
+ children: /* @__PURE__ */ _(V, {
1662
+ tooltip: p("editor.aiTypeset"),
1663
+ disabled: b,
1664
+ icon: /* @__PURE__ */ v(g, { children: [
1665
+ /* @__PURE__ */ _("img", {
1666
+ src: Un,
1667
+ alt: "",
1668
+ width: Q,
1669
+ height: Q,
1670
+ className: Z["bsy-lexical-ai__icon"],
1671
+ draggable: !1
1672
+ }),
1673
+ /* @__PURE__ */ _("span", {
1674
+ className: R["bsy-lexical__toolbar-select-label"],
1675
+ children: p("editor.aiTypeset")
1676
+ }),
1677
+ /* @__PURE__ */ _(e, {
1678
+ name: "arrow-down",
1679
+ size: m,
1680
+ className: R["bsy-lexical__toolbar-select-arrow"]
1681
+ })
1682
+ ] })
1683
+ })
1684
+ });
1685
+ return b ? T : /* @__PURE__ */ _(u, {
1686
+ menus: ee,
1687
+ onClick: w,
1688
+ showSearch: !1,
1689
+ offset: L,
1690
+ style: {
1691
+ width: 147,
1692
+ minWidth: 147
1693
+ },
1694
+ children: T
1695
+ });
1696
+ }, $ = /* @__PURE__ */ new Map(), Kn = (e, t) => {
1697
+ if (!e) throw Error("registerToolbarButton: name is required");
1698
+ $.set(e, t);
1699
+ }, qn = (e) => {
1700
+ $.delete(e);
1701
+ }, Jn = (e) => $.get(e), Yn = () => Array.from($.keys()), Xn = {
1702
+ undo: Ct,
1703
+ redo: wt,
1704
+ bold: Xe,
1705
+ underline: Ze,
1706
+ italic: Qe,
1707
+ strikethrough: Tt,
1708
+ superscript: Et,
1709
+ subscript: Dt,
1710
+ heading: Rt,
1711
+ fontSize: $e,
1712
+ fontColor: et,
1713
+ fill: tt,
1714
+ clearFormat: Bt,
1715
+ bullet: At,
1716
+ number: jt,
1717
+ outdent: kt,
1718
+ indent: Ot,
1719
+ align: nt,
1720
+ link: it,
1721
+ unLink: at,
1722
+ picture: St,
1723
+ code: Mt,
1724
+ table: Pt,
1725
+ source: Lt,
1726
+ ai: Gn
1727
+ };
1728
+ Object.entries(Xn).forEach(([e, t]) => {
1729
+ Kn(e, t);
1730
+ });
1731
+ //#endregion
1732
+ export { We as A, Le as B, dt as C, Ye as D, V as E, Ue as F, Re as I, R as L, Ve as M, He as N, z as O, ze as P, Ie as R, lt as S, H as T, Ut as _, qn as a, xt as b, zn as c, ln as d, q as f, Ht as g, Wt as h, Kn as i, Be as j, qe as k, Tn as l, Jt as m, Jn as n, Z as o, Yt as p, Yn as r, Bn as s, Xn as t, J as u, Ft as v, G as w, ut as x, It as y, L as z };