@baishuyun/ui-base 6.16.0 → 6.17.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 (140) hide show
  1. package/dist/Amap/Amap-CNsoge6e.js +826 -0
  2. package/dist/Amap/index.js +3 -10
  3. package/dist/Calendar/Calendar-BlsUX2vX.js +1608 -0
  4. package/dist/Calendar/index.js +10 -20
  5. package/dist/Card/index.js +2 -2
  6. package/dist/CheckBox/{CheckBox-B92dxWNo.js → CheckBox-CM24-quL.js} +1 -1
  7. package/dist/CheckBox/index.js +3 -3
  8. package/dist/ColorPicker/{ColorPicker-CPr5j6ZN.js → ColorPicker-B_wLqurt.js} +5 -5
  9. package/dist/ColorPicker/index.js +5 -5
  10. package/dist/ConfigProvider/index.js +1 -1
  11. package/dist/DatePicker/DatePicker-BRwPZeui.js +111 -0
  12. package/dist/DatePicker/{DatePickerPanel-CRnLvIwc.js → DatePickerPanel-UwjSXS-U.js} +3 -4
  13. package/dist/DatePicker/index.js +6 -8
  14. package/dist/DatePicker/pickerLocale-Brf7_Tnd.js +30 -0
  15. package/dist/DropDown/{DropDown-CvG9IFVk.js → DropDown-B_szM67V.js} +86 -82
  16. package/dist/DropDown/index.js +8 -9
  17. package/dist/Editor/index.js +2839 -880
  18. package/dist/Gantt/index.js +3055 -197
  19. package/dist/Icon/index.js +1 -1
  20. package/dist/InputTag/{InputTag-BfZycXw4.js → InputTag-C_5nm0eo.js} +2 -2
  21. package/dist/InputTag/index.js +4 -4
  22. package/dist/Loading/{Loading-DpbJSRYf.js → Loading-Cherk9Ax.js} +1 -1
  23. package/dist/Loading/index.js +3 -3
  24. package/dist/Modal/index.js +2 -2
  25. package/dist/NotFoundContent/index.js +2 -2
  26. package/dist/Overlay/index.js +1 -1
  27. package/dist/Radio/index.js +2 -2
  28. package/dist/ScrollBar/{ScrollBar-N2pOLv-8.js → ScrollBar-IMTuAOF5.js} +1 -1
  29. package/dist/ScrollBar/index.js +2 -2
  30. package/dist/Segmented/{Segmented-BCQRrc65.js → Segmented-DpmwFerw.js} +1 -1
  31. package/dist/Segmented/index.js +2 -2
  32. package/dist/Select/{Select-Bla1mQ8v.js → Select-VIy6OKEj.js} +262 -259
  33. package/dist/Select/{SelectInputSearch-CRgBcsq2.js → SelectInputSearch-MApQHnU9.js} +21 -10
  34. package/dist/Select/index.js +12 -13
  35. package/dist/Table/Table-8ac6xLZv.js +808 -0
  36. package/dist/Table/index.js +4 -8
  37. package/dist/Tabs/{Tabs-B9uCGlxM.js → Tabs-DnoZ8BO0.js} +3 -3
  38. package/dist/Tabs/index.js +4 -4
  39. package/dist/Tooltip/{Tooltip-nJU13gX4.js → Tooltip-DBrt3t2r.js} +3 -3
  40. package/dist/Tooltip/index.js +3 -3
  41. package/dist/Tree/index.js +4 -4
  42. package/dist/components/Editor/EditorHtmlPreview.d.ts +3 -0
  43. package/dist/components/Editor/Preview/HtmlPreview.d.ts +2 -3
  44. package/dist/components/Editor/__tests__/createTestEditor.d.ts +1 -0
  45. package/dist/components/Editor/constants/portableEditorStyles.d.ts +2 -0
  46. package/dist/components/Editor/hooks/useEditorFocus.d.ts +1 -0
  47. package/dist/components/Editor/hooks/useTextFormatsState.d.ts +1 -2
  48. package/dist/components/Editor/index.d.ts +1 -0
  49. package/dist/components/Editor/nodes/ExtendedLinkNode.d.ts +9 -0
  50. package/dist/components/Editor/utils/getToolbarItems.d.ts +14 -0
  51. package/dist/components/Editor/utils/placeProgrammaticCaret.d.ts +5 -0
  52. package/dist/components/Editor/utils/readTextFormats.d.ts +6 -0
  53. package/dist/components/Editor/utils/retainCodeSelection.d.ts +3 -0
  54. package/dist/components/Select/SelectInputSearch/SelectInputSearch.d.ts +2 -0
  55. package/dist/index.js +28 -50
  56. package/dist/style.css +1 -1
  57. package/dist/vendors/Tree-D0Q1IZ2D.js +267 -0
  58. package/dist/vendors/{version-CFii9VTt.js → version-CfjNx5v2.js} +1 -1
  59. package/package.json +1 -1
  60. package/dist/Amap/Amap-BLSziesG.js +0 -77
  61. package/dist/Amap/AmapCircle/index.js +0 -5
  62. package/dist/Amap/AmapCircle-2qupysHe.js +0 -55
  63. package/dist/Amap/AmapContext-CJBe6lld.js +0 -11
  64. package/dist/Amap/AmapMarker/index.js +0 -6
  65. package/dist/Amap/AmapMarker-xEqoVnFR.js +0 -153
  66. package/dist/Amap/AmapMarkerCluster/index.js +0 -6
  67. package/dist/Amap/AmapMarkerCluster-CvEQa3o9.js +0 -240
  68. package/dist/Amap/AmapProvider/index.js +0 -7
  69. package/dist/Amap/AmapProvider-B-R2DrkJ.js +0 -107
  70. package/dist/Amap/hooks/index.js +0 -4
  71. package/dist/Amap/hooks-BTcFpdd0.js +0 -121
  72. package/dist/Amap/useMarkerInfoWindowController-Cjx0xQXw.js +0 -94
  73. package/dist/Calendar/AllDaySection-pO7suGJM.js +0 -53
  74. package/dist/Calendar/Calendar-DUD4iffO.js +0 -795
  75. package/dist/Calendar/CurrentTimeIndicator-BF3_INSL.js +0 -65
  76. package/dist/Calendar/EventCard-DKEZQRTp.js +0 -155
  77. package/dist/Calendar/TimeAxis-DUc6EL-j.js +0 -13
  78. package/dist/Calendar/TimeGrid-BV8x9VnF.js +0 -47
  79. package/dist/Calendar/colorUtils-BbeSMnOs.js +0 -55
  80. package/dist/Calendar/context/index.js +0 -3
  81. package/dist/Calendar/context-CamSpkj3.js +0 -21
  82. package/dist/Calendar/layout-CpOabFQ2.js +0 -300
  83. package/dist/Calendar/subcomponents/AllDaySection/index.js +0 -11
  84. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +0 -8
  85. package/dist/Calendar/subcomponents/EventCard/index.js +0 -9
  86. package/dist/Calendar/subcomponents/TimeAxis/index.js +0 -5
  87. package/dist/Calendar/subcomponents/TimeGrid/index.js +0 -7
  88. package/dist/Calendar/theme-Dc8hjcdo.js +0 -71
  89. package/dist/Calendar/utils/index.js +0 -111
  90. package/dist/Calendar/utils/layout/index.js +0 -4
  91. package/dist/Calendar/utils/theme/index.js +0 -3
  92. package/dist/DatePicker/DatePicker-BWMmI6rl.js +0 -101
  93. package/dist/DatePicker/ensureDayjsPlugins-CSqhjLS7.js +0 -15
  94. package/dist/DatePicker/pickerLocale-CcPLUbZO.js +0 -15
  95. package/dist/DatePicker/style/index.js +0 -3
  96. package/dist/DatePicker/style-W7f5wyUb.js +0 -15
  97. package/dist/DropDown/style/index.js +0 -3
  98. package/dist/DropDown/style-DZpkarne.js +0 -9
  99. package/dist/Editor/Buttons-vt3gwedu.js +0 -1841
  100. package/dist/Editor/ToolbarPlugin/Buttons/index.js +0 -21
  101. package/dist/Editor/constants/index.js +0 -61
  102. package/dist/Gantt/GanttChart/index.js +0 -21
  103. package/dist/Gantt/GanttChart-DRzJdEm-.js +0 -2292
  104. package/dist/Gantt/GanttHighlightContext-dtyoq-oj.js +0 -12
  105. package/dist/Gantt/GanttTable/index.js +0 -13
  106. package/dist/Gantt/GanttTable-fOv1Zn2-.js +0 -84
  107. package/dist/Gantt/GanttToolBar/index.js +0 -17
  108. package/dist/Gantt/GanttToolBar-4kxZP6oS.js +0 -120
  109. package/dist/Gantt/collapseKeys-BV_8sIA-.js +0 -160
  110. package/dist/Gantt/columnResize-Bkenlbab.js +0 -46
  111. package/dist/Gantt/constants-mEGQ1U1Q.js +0 -39
  112. package/dist/Gantt/highlightTarget-D3Nf9_7S.js +0 -25
  113. package/dist/Gantt/theme-B7Iap-tZ.js +0 -31
  114. package/dist/Gantt/timelineViewConfig-DNt7yi83.js +0 -118
  115. package/dist/Gantt/utils/index.js +0 -7
  116. package/dist/Gantt/utils/theme/index.js +0 -3
  117. package/dist/Select/style/index.js +0 -3
  118. package/dist/Select/style-C4A8kUd1.js +0 -9
  119. package/dist/Table/Table-3LSO0xSH.js +0 -545
  120. package/dist/Table/constants-D7wLH8Qy.js +0 -25
  121. package/dist/Table/hooks/index.js +0 -3
  122. package/dist/Table/hooks-DSBl2e4O.js +0 -108
  123. package/dist/Table/processRowspan-B6HMqw0Q.js +0 -144
  124. package/dist/Table/style/index.js +0 -3
  125. package/dist/Table/style-B8Cw8HJe.js +0 -9
  126. package/dist/Table/utils/index.js +0 -3
  127. package/dist/Tree/utils/index.js +0 -26
  128. package/dist/vendors/Tree-DSl4lDjx.js +0 -248
  129. /package/dist/Card/{Card-rJeWgxu5.js → Card-DAz0dvA3.js} +0 -0
  130. /package/dist/CheckBox/{CheckBox-DOK5N7z6.js → CheckBox-CcHskTz_.js} +0 -0
  131. /package/dist/Modal/{Modal-CRKitOOj.js → Modal-eZijJ7CB.js} +0 -0
  132. /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-DJUQ0_2D.js} +0 -0
  133. /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-D9jhW7K6.js} +0 -0
  134. /package/dist/vendors/{animations-Dn_5xJ7B.js → animations-ISccYUE3.js} +0 -0
  135. /package/dist/vendors/{cssVars-l4-kP_14.js → cssVars-UpriQzph.js} +0 -0
  136. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-mEH9TBYV.js} +0 -0
  137. /package/dist/vendors/{useFloatingOverlay-B3M9k8nj.js → useFloatingOverlay-B66lOL8v.js} +0 -0
  138. /package/dist/vendors/{useFloatingPortal-VpzL-EPh.js → useFloatingPortal-DJ1iKmW-.js} +0 -0
  139. /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-CC6af8t-.js} +0 -0
  140. /package/dist/vendors/{useLocale-D31qCCff.js → useLocale-Be4e7Xfn.js} +0 -0
@@ -1,52 +1,53 @@
1
- import "../vendors/version-CFii9VTt.js";
1
+ import "../vendors/version-CfjNx5v2.js";
2
2
  import "../ScrollBar/style-D26azwz6.js";
3
3
  import { t as e } from "../Icon/Icon-DrdQOEJE.js";
4
4
  import "../vendors/LocaleContext-DXQoOKM2.js";
5
- import "../Overlay/OverlayContext-CVSFoyqN.js";
6
- import { t } from "../Modal/Modal-CRKitOOj.js";
7
- import "../ColorPicker/ColorPicker-CPr5j6ZN.js";
8
- import "../vendors/useFloatingOverlay-B3M9k8nj.js";
9
- import { t as n } from "../vendors/useLocale-D31qCCff.js";
10
- import "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
11
- import { t as r } from "../vendors/cssVars-l4-kP_14.js";
12
- import "../Tooltip/Tooltip-nJU13gX4.js";
13
- import "../Select/SelectInputSearch-CRgBcsq2.js";
14
- import "../CheckBox/CheckBox-DOK5N7z6.js";
15
- import "../CheckBox/CheckBox-B92dxWNo.js";
16
- import "../NotFoundContent/NotFoundContent-BLmzWNBi.js";
17
- import { t as i } from "../ScrollBar/ScrollBar-N2pOLv-8.js";
18
- import "../vendors/useFloatingPortal-VpzL-EPh.js";
19
- import { t as a } from "../DropDown/DropDown-CvG9IFVk.js";
20
- import "../DropDown/style-DZpkarne.js";
21
- import { A as o, B as s, C as c, D as l, E as u, F as d, I as f, L as p, M as m, N as h, O as g, P as _, R as v, S as y, T as b, _ as x, a as S, b as C, c as w, d as ee, f as T, g as E, h as D, i as O, j as k, k as A, l as te, m as ne, n as re, o as j, p as ie, r as ae, s as oe, u as se, v as ce, w as le, x as ue, y as de, z as fe } from "./Buttons-vt3gwedu.js";
22
- import { DEFAULT_BACKGROUND_COLOR as pe, DEFAULT_FONT_COLOR as me, DEFAULT_FONT_SIZE as he } from "./constants/index.js";
23
- import { dropRightWhile as ge, dropWhile as _e, omit as ve } from "lodash-es";
24
- import { Fragment as ye, jsx as M, jsxs as N } from "react/jsx-runtime";
25
- import be, { forwardRef as xe, memo as Se, useCallback as P, useDeferredValue as Ce, useEffect as F, useId as we, useLayoutEffect as Te, useMemo as I, useRef as L, useState as R } from "react";
26
- import { Button as Ee, message as De } from "antd";
27
- import z from "clsx";
28
- import { useDocumentVisibility as Oe, useEventListener as ke } from "ahooks";
29
- import { AnimatePresence as Ae, motion as je, useReducedMotion as Me } from "motion/react";
30
- import { LexicalComposer as Ne } from "@lexical/react/LexicalComposer";
31
- import { RichTextPlugin as Pe } from "@lexical/react/LexicalRichTextPlugin";
32
- import { ContentEditable as Fe } from "@lexical/react/LexicalContentEditable";
33
- import { HistoryPlugin as Ie } from "@lexical/react/LexicalHistoryPlugin";
34
- import { OnChangePlugin as Le } from "@lexical/react/LexicalOnChangePlugin";
35
- import { LexicalErrorBoundary as Re } from "@lexical/react/LexicalErrorBoundary";
36
- import { $generateHtmlFromNodes as ze, $generateNodesFromDOM as Be } from "@lexical/html";
37
- import { $applyNodeReplacement as Ve, $createLineBreakNode as He, $createParagraphNode as Ue, $createTabNode as We, $createTextNode as Ge, $getNearestNodeFromDOMNode as Ke, $getNodeByKey as B, $getRoot as qe, $getRoot as V, $getSelection as H, $insertNodes as Je, $isElementNode as Ye, $isLineBreakNode as Xe, $isRangeSelection as U, $isRootOrShadowRoot as Ze, $isTabNode as Qe, $isTextNode as $e, $nodesOfType as et, $onUpdate as tt, $setSelection as nt, CLEAR_HISTORY_COMMAND as rt, COMMAND_PRIORITY_CRITICAL as it, COMMAND_PRIORITY_EDITOR as at, COMMAND_PRIORITY_HIGH as ot, COMMAND_PRIORITY_LOW as st, DROP_COMMAND as ct, DecoratorNode as lt, HISTORY_MERGE_TAG as ut, INDENT_CONTENT_COMMAND as dt, KEY_ENTER_COMMAND as ft, KEY_TAB_COMMAND as pt, PASTE_COMMAND as mt, PASTE_TAG as ht, RootNode as gt, TextNode as _t, isHTMLElement as vt, mergeRegister as yt } from "lexical";
38
- import { useLexicalComposerContext as bt, useLexicalComposerContext as W } from "@lexical/react/LexicalComposerContext";
39
- import { $getSelectionStyleValueForProperty as xt, $patchStyleText as St, $trimTextContentFromAnchor as Ct } from "@lexical/selection";
40
- import { $findMatchingParent as G, $restoreEditorState as wt, mergeRegister as Tt } from "@lexical/utils";
41
- import { $isLinkNode as Et, AutoLinkNode as Dt, LinkNode as Ot } from "@lexical/link";
42
- import { $isListItemNode as K, $isListNode as kt, ListItemNode as At, ListNode as jt } from "@lexical/list";
43
- import { $createCodeHighlightNode as Mt, $createCodeNode as Nt, $isCodeHighlightNode as Pt, $isCodeNode as q, $plainifyCodeContent as Ft, CodeHighlightNode as It, CodeNode as Lt, registerCodeIndentation as Rt } from "@lexical/code-core";
44
- import { $findCellNode as zt, $isTableCellNode as Bt, $isTableNode as Vt, $isTableRowNode as Ht, $isTableSelection as Ut, TableCellNode as Wt, TableNode as Gt, TableRowNode as Kt, registerTableCellUnmergeTransform as qt, registerTablePlugin as Jt, registerTableSelectionObserver as Yt, setScrollableTablesActive as Xt } from "@lexical/table";
45
- import { $isHeadingNode as Zt, HeadingNode as Qt } from "@lexical/rich-text";
46
- import { useLexicalEditable as $t } from "@lexical/react/useLexicalEditable";
47
- import { LinkPlugin as en } from "@lexical/react/LexicalLinkPlugin";
48
- import { ListPlugin as tn } from "@lexical/react/LexicalListPlugin";
49
- var J = {
5
+ import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
6
+ import "../Overlay/index.js";
7
+ import { t as r } from "../Modal/Modal-eZijJ7CB.js";
8
+ import { t as i } from "../ColorPicker/ColorPicker-B_wLqurt.js";
9
+ import "../vendors/useFloatingOverlay-B66lOL8v.js";
10
+ import { t as a } from "../vendors/useLocale-Be4e7Xfn.js";
11
+ import { r as o } from "../vendors/animations-ISccYUE3.js";
12
+ import "../vendors/useLatchedPopupPortalRoot-CC6af8t-.js";
13
+ import { t as s } from "../vendors/cssVars-UpriQzph.js";
14
+ import { t as c } from "../Tooltip/Tooltip-DBrt3t2r.js";
15
+ import "../Select/SelectInputSearch-MApQHnU9.js";
16
+ import "../CheckBox/CheckBox-CcHskTz_.js";
17
+ import { t as l } from "../CheckBox/CheckBox-CM24-quL.js";
18
+ import "../NotFoundContent/NotFoundContent-DJUQ0_2D.js";
19
+ import { t as u } from "../ScrollBar/ScrollBar-IMTuAOF5.js";
20
+ import { t as d } from "../vendors/useFloatingPortal-DJ1iKmW-.js";
21
+ import { t as f } from "../DropDown/DropDown-B_szM67V.js";
22
+ import { dropRightWhile as p, dropWhile as m, keyBy as h, omit as g, range as _ } from "lodash-es";
23
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
24
+ import x, { createContext as S, forwardRef as C, memo as w, useCallback as T, useContext as E, useDeferredValue as D, useEffect as O, useId as k, useImperativeHandle as A, useLayoutEffect as j, useMemo as M, useRef as N, useState as P } from "react";
25
+ import { Button as F, Form as ee, Input as te, message as ne } from "antd";
26
+ import I from "clsx";
27
+ import { useDocumentVisibility as re, useEventListener as ie } from "ahooks";
28
+ import { AnimatePresence as ae, motion as oe, useReducedMotion as se } from "motion/react";
29
+ import { FloatingPortal as ce } from "@floating-ui/react";
30
+ import { LexicalComposer as le } from "@lexical/react/LexicalComposer";
31
+ import { RichTextPlugin as ue } from "@lexical/react/LexicalRichTextPlugin";
32
+ import { ContentEditable as de } from "@lexical/react/LexicalContentEditable";
33
+ import { HistoryPlugin as fe } from "@lexical/react/LexicalHistoryPlugin";
34
+ import { OnChangePlugin as pe } from "@lexical/react/LexicalOnChangePlugin";
35
+ import { LexicalErrorBoundary as me } from "@lexical/react/LexicalErrorBoundary";
36
+ import { $generateHtmlFromNodes as he, $generateNodesFromDOM as ge } from "@lexical/html";
37
+ import { $applyNodeReplacement as _e, $createLineBreakNode as ve, $createParagraphNode as ye, $createTabNode as be, $createTextNode as xe, $getNearestNodeFromDOMNode as Se, $getNodeByKey as Ce, $getRoot as we, $getRoot as L, $getSelection as R, $insertNodes as Te, $isElementNode as Ee, $isLineBreakNode as De, $isRangeSelection as z, $isRootOrShadowRoot as Oe, $isTabNode as ke, $isTextNode as Ae, $nodesOfType as je, $onUpdate as Me, $setSelection as Ne, BLUR_COMMAND as Pe, CAN_REDO_COMMAND as Fe, CAN_UNDO_COMMAND as Ie, CLEAR_HISTORY_COMMAND as Le, COMMAND_PRIORITY_CRITICAL as Re, COMMAND_PRIORITY_EDITOR as ze, COMMAND_PRIORITY_HIGH as Be, COMMAND_PRIORITY_LOW as Ve, DROP_COMMAND as He, DecoratorNode as Ue, FOCUS_COMMAND as We, FORMAT_ELEMENT_COMMAND as Ge, FORMAT_TEXT_COMMAND as Ke, HISTORY_MERGE_TAG as qe, INDENT_CONTENT_COMMAND as Je, KEY_ENTER_COMMAND as Ye, KEY_TAB_COMMAND as Xe, OUTDENT_CONTENT_COMMAND as Ze, PASTE_COMMAND as Qe, PASTE_TAG as $e, REDO_COMMAND as et, RootNode as tt, TextNode as nt, UNDO_COMMAND as rt, createCommand as it, isHTMLElement as at, mergeRegister as ot } from "lexical";
38
+ import { useLexicalComposerContext as st, useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
39
+ import { $createLinkNode as ct, $isLinkNode as lt, $toggleLink as ut, AutoLinkNode as dt, LinkNode as ft, TOGGLE_LINK_COMMAND as pt } from "@lexical/link";
40
+ import { $isListItemNode as mt, $isListNode as ht, INSERT_ORDERED_LIST_COMMAND as gt, INSERT_UNORDERED_LIST_COMMAND as _t, ListItemNode as vt, ListNode as yt, REMOVE_LIST_COMMAND as bt } from "@lexical/list";
41
+ import { $createCodeHighlightNode as xt, $createCodeNode as St, $isCodeHighlightNode as Ct, $isCodeNode as V, $plainifyCodeContent as wt, CodeHighlightNode as Tt, CodeNode as Et, registerCodeIndentation as Dt } from "@lexical/code-core";
42
+ import { $getSelectionStyleValueForProperty as Ot, $patchStyleText as kt, $setBlocksType as At, $trimTextContentFromAnchor as jt } from "@lexical/selection";
43
+ import { $findCellNode as Mt, $isTableCellNode as Nt, $isTableNode as Pt, $isTableRowNode as Ft, $isTableSelection as It, INSERT_TABLE_COMMAND as Lt, TableCellNode as Rt, TableNode as zt, TableRowNode as Bt, registerTableCellUnmergeTransform as Vt, registerTablePlugin as Ht, registerTableSelectionObserver as Ut, setScrollableTablesActive as Wt } from "@lexical/table";
44
+ import { $createHeadingNode as Gt, $isHeadingNode as Kt, HeadingNode as qt } from "@lexical/rich-text";
45
+ import { $findMatchingParent as H, $restoreEditorState as Jt, mergeRegister as Yt } from "@lexical/utils";
46
+ import Xt from "dompurify";
47
+ import { useLexicalEditable as Zt } from "@lexical/react/useLexicalEditable";
48
+ import { LinkPlugin as Qt } from "@lexical/react/LexicalLinkPlugin";
49
+ import { ListPlugin as $t } from "@lexical/react/LexicalListPlugin";
50
+ var U = {
50
51
  imageWrapper: "_imageWrapper_y06h3_1",
51
52
  selected: "_selected_y06h3_8",
52
53
  resizing: "_resizing_y06h3_12",
@@ -56,16 +57,16 @@ var J = {
56
57
  topRight: "_topRight_y06h3_49",
57
58
  bottomLeft: "_bottomLeft_y06h3_54",
58
59
  bottomRight: "_bottomRight_y06h3_59"
59
- }, nn = ({ src: e, altText: t, width: n, height: r, dataId: i, nodeKey: a }) => {
60
- let [o] = W(), [s, c] = R(!1), [l, u] = R(null), d = L(null), [f, p] = R({
60
+ }, en = ({ src: e, altText: t, width: n, height: r, dataId: i, nodeKey: a }) => {
61
+ let [o] = B(), [s, c] = P(!1), [l, u] = P(null), d = N(null), [f, p] = P({
61
62
  width: n || void 0,
62
63
  height: r || void 0
63
- }), m = P(() => {
64
+ }), m = T(() => {
64
65
  n && r && p({
65
66
  width: n,
66
67
  height: r
67
68
  });
68
- }, [n, r]), h = P((e, t) => {
69
+ }, [n, r]), h = T((e, t) => {
69
70
  if (e.preventDefault(), e.stopPropagation(), !d.current) return;
70
71
  let n = f.width || d.current.offsetWidth, r = f.height || d.current.offsetHeight, i = n / r;
71
72
  (!f.width || !f.height) && p({
@@ -80,7 +81,7 @@ var J = {
80
81
  aspectRatio: i,
81
82
  direction: t
82
83
  });
83
- }, [f]), g = P((e) => {
84
+ }, [f]), g = T((e) => {
84
85
  if (!l?.isResizing) return;
85
86
  let t = e.clientX - l.startX, n;
86
87
  switch (l.direction) {
@@ -103,10 +104,10 @@ var J = {
103
104
  width: n,
104
105
  height: r
105
106
  });
106
- }, [l]), _ = P(() => {
107
+ }, [l]), _ = T(() => {
107
108
  l?.isResizing && (o.update(() => {
108
- let e = B(a);
109
- on(e) && e.setWidthAndHeight(f.width, f.height);
109
+ let e = Ce(a);
110
+ rn(e) && e.setWidthAndHeight(f.width, f.height);
110
111
  }), u(null));
111
112
  }, [
112
113
  o,
@@ -114,7 +115,7 @@ var J = {
114
115
  f,
115
116
  l
116
117
  ]);
117
- be.useEffect(() => {
118
+ x.useEffect(() => {
118
119
  if (l?.isResizing) return document.addEventListener("mousemove", g), document.addEventListener("mouseup", _), () => {
119
120
  document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", _);
120
121
  };
@@ -123,63 +124,68 @@ var J = {
123
124
  g,
124
125
  _
125
126
  ]);
126
- let v = P(() => {
127
+ let S = T(() => {
127
128
  c(!0);
128
129
  }, []);
129
- return F(() => o.registerUpdateListener(({ editorState: e }) => {
130
+ return O(() => o.registerUpdateListener(({ editorState: e }) => {
130
131
  e.read(() => {
131
- let e = H();
132
- U(e) && !e.getNodes().some((e) => e.getKey() === a || e.getParent() && e.getParent()?.getKey() === a) && s && c(!1);
132
+ let e = R();
133
+ z(e) && !e.getNodes().some((e) => e.getKey() === a || e.getParent() && e.getParent()?.getKey() === a) && s && c(!1);
133
134
  });
134
135
  }), [
135
136
  o,
136
137
  a,
137
138
  s
138
- ]), F(() => {
139
+ ]), O(() => {
139
140
  let e = (e) => {
140
141
  s && d.current && !d.current.contains(e.target) && c(!1);
141
142
  };
142
143
  if (s) return document.addEventListener("mousedown", e), () => {
143
144
  document.removeEventListener("mousedown", e);
144
145
  };
145
- }, [s]), /* @__PURE__ */ N("div", {
146
- className: z(J.imageWrapper, {
147
- [J.selected]: s,
148
- [J.resizing]: l?.isResizing
146
+ }, [s]), /* @__PURE__ */ b("div", {
147
+ className: I(U.imageWrapper, {
148
+ [U.selected]: s,
149
+ [U.resizing]: l?.isResizing
149
150
  }),
150
- children: [/* @__PURE__ */ M("img", {
151
+ children: [/* @__PURE__ */ y("img", {
151
152
  ref: d,
152
153
  src: e,
153
154
  alt: t,
154
155
  "data-id": i,
155
- className: J.image,
156
+ className: U.image,
156
157
  style: {
157
158
  width: f.width,
158
159
  height: f.height
159
160
  },
160
161
  onLoad: m,
161
- onClick: v,
162
+ onClick: S,
162
163
  draggable: !1
163
- }), s && /* @__PURE__ */ N(ye, { children: [
164
- /* @__PURE__ */ M("div", {
165
- className: z(J.resizeHandle, J.bottomRight),
164
+ }), s && /* @__PURE__ */ b(v, { children: [
165
+ /* @__PURE__ */ y("div", {
166
+ className: I(U.resizeHandle, U.bottomRight),
166
167
  onMouseDown: (e) => h(e, "bottom-right")
167
168
  }),
168
- /* @__PURE__ */ M("div", {
169
- className: z(J.resizeHandle, J.bottomLeft),
169
+ /* @__PURE__ */ y("div", {
170
+ className: I(U.resizeHandle, U.bottomLeft),
170
171
  onMouseDown: (e) => h(e, "bottom-left")
171
172
  }),
172
- /* @__PURE__ */ M("div", {
173
- className: z(J.resizeHandle, J.topRight),
173
+ /* @__PURE__ */ y("div", {
174
+ className: I(U.resizeHandle, U.topRight),
174
175
  onMouseDown: (e) => h(e, "top-right")
175
176
  }),
176
- /* @__PURE__ */ M("div", {
177
- className: z(J.resizeHandle, J.topLeft),
177
+ /* @__PURE__ */ y("div", {
178
+ className: I(U.resizeHandle, U.topLeft),
178
179
  onMouseDown: (e) => h(e, "top-left")
179
180
  })
180
181
  ] })]
181
182
  });
182
- }, rn = class e extends lt {
183
+ }, tn = class e extends Ue {
184
+ __src;
185
+ __altText;
186
+ __width;
187
+ __height;
188
+ __dataId;
183
189
  static getType() {
184
190
  return "image";
185
191
  }
@@ -228,7 +234,7 @@ var J = {
228
234
  n.__width = e, n.__height = t;
229
235
  }
230
236
  decorate() {
231
- return /* @__PURE__ */ M(nn, {
237
+ return /* @__PURE__ */ y(en, {
232
238
  src: this.__src,
233
239
  altText: this.__altText,
234
240
  width: this.__width,
@@ -239,13 +245,13 @@ var J = {
239
245
  }
240
246
  static importDOM() {
241
247
  return { img: () => ({
242
- conversion: sn,
248
+ conversion: an,
243
249
  priority: 0
244
250
  }) };
245
251
  }
246
252
  static importJSON(e) {
247
253
  let { src: t, altText: n, width: r, height: i, dataId: a } = e;
248
- return an({
254
+ return nn({
249
255
  src: t,
250
256
  altText: n,
251
257
  width: r,
@@ -268,13 +274,13 @@ var J = {
268
274
  return !0;
269
275
  }
270
276
  };
271
- function an({ src: e, altText: t, width: n, height: r, dataId: i, key: a }) {
272
- return new rn(e, t, n, r, a, i);
277
+ function nn({ src: e, altText: t, width: n, height: r, dataId: i, key: a }) {
278
+ return new tn(e, t, n, r, a, i);
273
279
  }
274
- function on(e) {
275
- return e instanceof rn;
280
+ function rn(e) {
281
+ return e instanceof tn;
276
282
  }
277
- function sn(e) {
283
+ function an(e) {
278
284
  if (e instanceof HTMLImageElement) {
279
285
  let { src: t, alt: n, style: r } = e, i, a;
280
286
  if (r.width) {
@@ -287,7 +293,7 @@ function sn(e) {
287
293
  }
288
294
  i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height);
289
295
  let o = e.getAttribute("data-id") || void 0;
290
- return { node: an({
296
+ return { node: nn({
291
297
  src: t,
292
298
  altText: n,
293
299
  width: i,
@@ -298,25 +304,37 @@ function sn(e) {
298
304
  return null;
299
305
  }
300
306
  //#endregion
301
- //#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
302
- var Y = (e) => {
307
+ //#region src/components/Editor/constants/toolbarSize.ts
308
+ var on = "default", W = {
309
+ x: 0,
310
+ y: 5
311
+ }, sn = {
312
+ small: {
313
+ itemHeight: 20,
314
+ iconSize: 14
315
+ },
316
+ default: {
317
+ itemHeight: 30,
318
+ iconSize: 16
319
+ }
320
+ }, cn = (e) => {
303
321
  if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
304
- }, cn = (e, t = v) => {
305
- let n = s[t], i = Y(e?.itemHeight) ?? `${n.itemHeight}px`, a = Y(e?.iconSize) ?? `${n.iconSize}px`, o = {
306
- "--bsy-editor-toolbar-item-height": i,
307
- "--bsy-editor-toolbar-icon-size": a,
322
+ }, ln = (e, t = on) => {
323
+ let n = sn[t], r = cn(e?.itemHeight) ?? `${n.itemHeight}px`, i = cn(e?.iconSize) ?? `${n.iconSize}px`, a = {
324
+ "--bsy-editor-toolbar-item-height": r,
325
+ "--bsy-editor-toolbar-icon-size": i,
308
326
  "--bsy-editor-toolbar-divider-color": "#e0e0e0",
309
327
  "--bsy-editor-toolbar-item-highlight-color": "#0265ff"
310
328
  };
311
- return e ? (r(o, "--bsy-editor-toolbar-bg", e.bg), r(o, "--bsy-editor-toolbar-border-color", e.borderColor), r(o, "--bsy-editor-toolbar-padding", e.padding), r(o, "--bsy-editor-toolbar-gap", Y(e.gap)), r(o, "--bsy-editor-toolbar-group-gap", Y(e.groupGap)), r(o, "--bsy-editor-toolbar-divider-color", e.dividerColor), r(o, "--bsy-editor-toolbar-divider-margin", Y(e.dividerMargin)), r(o, "--bsy-editor-toolbar-color-icon", e.colorIcon), r(o, "--bsy-editor-toolbar-item-hover-bg", e.itemHoverBg), r(o, "--bsy-editor-toolbar-item-hover-color", e.itemHoverColor), r(o, "--bsy-editor-toolbar-item-active-bg", e.itemActiveBg), r(o, "--bsy-editor-toolbar-item-active-color", e.itemActiveColor), r(o, "--bsy-editor-toolbar-item-highlight-color", e.itemHighlightColor), r(o, "--bsy-editor-toolbar-item-padding", Y(e.itemPadding)), r(o, "--bsy-editor-toolbar-item-border-radius", Y(e.itemBorderRadius)), o) : o;
312
- }, ln = (e, t = v) => {
329
+ return e ? (s(a, "--bsy-editor-toolbar-bg", e.bg), s(a, "--bsy-editor-toolbar-border-color", e.borderColor), s(a, "--bsy-editor-toolbar-padding", e.padding), s(a, "--bsy-editor-toolbar-gap", cn(e.gap)), s(a, "--bsy-editor-toolbar-group-gap", cn(e.groupGap)), s(a, "--bsy-editor-toolbar-divider-color", e.dividerColor), s(a, "--bsy-editor-toolbar-divider-margin", cn(e.dividerMargin)), s(a, "--bsy-editor-toolbar-color-icon", e.colorIcon), s(a, "--bsy-editor-toolbar-item-hover-bg", e.itemHoverBg), s(a, "--bsy-editor-toolbar-item-hover-color", e.itemHoverColor), s(a, "--bsy-editor-toolbar-item-active-bg", e.itemActiveBg), s(a, "--bsy-editor-toolbar-item-active-color", e.itemActiveColor), s(a, "--bsy-editor-toolbar-item-highlight-color", e.itemHighlightColor), s(a, "--bsy-editor-toolbar-item-padding", cn(e.itemPadding)), s(a, "--bsy-editor-toolbar-item-border-radius", cn(e.itemBorderRadius)), a) : a;
330
+ }, un = (e, t = on) => {
313
331
  if (typeof e == "number" && Number.isFinite(e)) return e;
314
332
  if (typeof e == "string") {
315
333
  let t = Number.parseFloat(e);
316
334
  if (Number.isFinite(t)) return t;
317
335
  }
318
- return s[t].iconSize;
319
- }, un = (e) => {
336
+ return sn[t].iconSize;
337
+ }, dn = (e) => {
320
338
  let t = e?.placement ?? "top", n = e?.offset, r = typeof n == "number" ? 0 : n?.x ?? 0, i = typeof n == "number" ? n : n?.y ?? 0, a = t === "top", o = {
321
339
  position: "absolute",
322
340
  [a ? "bottom" : "top"]: "100%",
@@ -326,7 +344,7 @@ var Y = (e) => {
326
344
  width: "100%"
327
345
  };
328
346
  return r && (o.transform = `translateX(${r}px)`), o;
329
- }, dn = (e, t, n, r) => {
347
+ }, fn = (e, t, n, r) => {
330
348
  if (e.length === 0 || t <= 0 || e.reduce((e, t, n) => e + t.width + (n > 0 ? r : 0), 0) <= t) return e.length;
331
349
  let i = 0, a = 0;
332
350
  for (let o = 0; o < e.length; o++) {
@@ -336,153 +354,1994 @@ var Y = (e) => {
336
354
  }
337
355
  for (; a > 0 && e[a - 1]?.isDivider;) --a;
338
356
  return a;
339
- }, fn = (e, t) => {
357
+ }, pn = (e, t) => {
340
358
  let n = (e) => e.kind === "divider";
341
359
  return {
342
360
  visible: e.slice(0, t),
343
- overflow: ge(_e(e.slice(t), n), n)
361
+ overflow: p(m(e.slice(t), n), n)
344
362
  };
345
- };
363
+ }, G = {
364
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_1wqto_1",
365
+ "bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_1wqto_14",
366
+ "bsy-lexical__toolbar--sticky": "_bsy-lexical__toolbar--sticky_1wqto_19",
367
+ "bsy-lexical__toolbar-stack": "_bsy-lexical__toolbar-stack_1wqto_24",
368
+ "bsy-lexical__toolbar-items": "_bsy-lexical__toolbar-items_1wqto_34",
369
+ "bsy-lexical__toolbar-item": "_bsy-lexical__toolbar-item_1wqto_34",
370
+ "bsy-lexical__toolbar-item--disabled": "_bsy-lexical__toolbar-item--disabled_1wqto_49",
371
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_1wqto_53",
372
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_1wqto_59",
373
+ "bsy-lexical__toolbar-select": "_bsy-lexical__toolbar-select_1wqto_66",
374
+ "bsy-lexical__toolbar-select-label": "_bsy-lexical__toolbar-select-label_1wqto_84",
375
+ "bsy-lexical__toolbar-select-arrow": "_bsy-lexical__toolbar-select-arrow_1wqto_94",
376
+ "bsy-lexical__toolbar-select--ai": "_bsy-lexical__toolbar-select--ai_1wqto_98",
377
+ "bsy-lexical__toolbar-more-sizer": "_bsy-lexical__toolbar-more-sizer_1wqto_104",
378
+ "bsy-lexical__toolbar-overflow": "_bsy-lexical__toolbar-overflow_1wqto_112",
379
+ "bsy-lexical__toolbar-overflow-row": "_bsy-lexical__toolbar-overflow-row_1wqto_116",
380
+ "bsy-lexical__toolbar-overflow-row--open": "_bsy-lexical__toolbar-overflow-row--open_1wqto_124",
381
+ "bsy-lexical__toolbar-overflow-row--instant": "_bsy-lexical__toolbar-overflow-row--instant_1wqto_128",
382
+ "bsy-lexical__toolbar-overflow-inner": "_bsy-lexical__toolbar-overflow-inner_1wqto_132",
383
+ "bsy-lexical__toolbar-with-divider": "_bsy-lexical__toolbar-with-divider_1wqto_140"
384
+ }, mn = S(null), hn = [
385
+ {
386
+ label: "12",
387
+ value: "12px"
388
+ },
389
+ {
390
+ label: "14",
391
+ value: "14px"
392
+ },
393
+ {
394
+ label: "16",
395
+ value: "16px"
396
+ },
397
+ {
398
+ label: "18",
399
+ value: "18px"
400
+ },
401
+ {
402
+ label: "20",
403
+ value: "20px"
404
+ },
405
+ {
406
+ label: "22",
407
+ value: "22px"
408
+ },
409
+ {
410
+ label: "24",
411
+ value: "24px"
412
+ },
413
+ {
414
+ label: "28",
415
+ value: "28px"
416
+ },
417
+ {
418
+ label: "32",
419
+ value: "32px"
420
+ },
421
+ {
422
+ label: "36",
423
+ value: "36px"
424
+ },
425
+ {
426
+ label: "64",
427
+ value: "64px"
428
+ },
429
+ {
430
+ label: "128",
431
+ value: "128px"
432
+ }
433
+ ], gn = "16px", _n = "#000", vn = "transparent", yn = [
434
+ "jpg",
435
+ "jpeg",
436
+ "png",
437
+ "gif",
438
+ "bmp",
439
+ "tif"
440
+ ], bn = yn.map((e) => `.${e}`).join(","), xn = "plaintext", Sn = "github-light", Cn = [
441
+ {
442
+ id: "plaintext",
443
+ label: "Plain text"
444
+ },
445
+ {
446
+ id: "css",
447
+ label: "CSS"
448
+ },
449
+ {
450
+ id: "html",
451
+ label: "HTML"
452
+ },
453
+ {
454
+ id: "xml",
455
+ label: "XML"
456
+ },
457
+ {
458
+ id: "javascript",
459
+ label: "JavaScript"
460
+ },
461
+ {
462
+ id: "typescript",
463
+ label: "TypeScript"
464
+ },
465
+ {
466
+ id: "jsx",
467
+ label: "JSX"
468
+ },
469
+ {
470
+ id: "go",
471
+ label: "Go"
472
+ },
473
+ {
474
+ id: "php",
475
+ label: "PHP"
476
+ },
477
+ {
478
+ id: "c",
479
+ label: "C"
480
+ },
481
+ {
482
+ id: "python",
483
+ label: "Python"
484
+ },
485
+ {
486
+ id: "java",
487
+ label: "Java"
488
+ },
489
+ {
490
+ id: "cpp",
491
+ label: "C++"
492
+ },
493
+ {
494
+ id: "csharp",
495
+ label: "C#"
496
+ },
497
+ {
498
+ id: "vb",
499
+ label: "Visual Basic"
500
+ },
501
+ {
502
+ id: "sql",
503
+ label: "SQL"
504
+ },
505
+ {
506
+ id: "ruby",
507
+ label: "Ruby"
508
+ },
509
+ {
510
+ id: "swift",
511
+ label: "Swift"
512
+ },
513
+ {
514
+ id: "bash",
515
+ label: "Bash"
516
+ },
517
+ {
518
+ id: "lua",
519
+ label: "Lua"
520
+ },
521
+ {
522
+ id: "markdown",
523
+ label: "Markdown"
524
+ }
525
+ ], wn = h(Cn, "id"), Tn = (e) => e && wn[e] ? e : xn, En = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", Dn = (e) => {
526
+ if (e) {
527
+ L().selectStart();
528
+ return;
529
+ }
530
+ Ne(null);
531
+ }, On = (e) => {
532
+ let t = e.getRootElement();
533
+ Dn(!!(t && document.activeElement && t.contains(document.activeElement)));
534
+ }, kn = () => {
535
+ R() === null && L().selectStart();
536
+ }, K = (e) => {
537
+ e.isEditable() || e.setEditable(!0), e.update(() => {
538
+ kn();
539
+ }), e.focus(void 0, { defaultSelection: "rootStart" });
540
+ }, An = {
541
+ bold: !1,
542
+ italic: !1,
543
+ underline: !1,
544
+ strikethrough: !1,
545
+ superscript: !1,
546
+ subscript: !1,
547
+ fontSize: gn,
548
+ fontColor: _n,
549
+ backgroundColor: vn,
550
+ align: "left",
551
+ listType: !1,
552
+ canOutdent: !1,
553
+ isCodeBlock: !1,
554
+ isInTable: !1,
555
+ headingTag: !1,
556
+ codeLanguage: xn,
557
+ hasEditorText: !1,
558
+ link: void 0
559
+ }, jn = (e) => {
560
+ let t = !!L().getTextContent().trim(), n = {
561
+ ...An,
562
+ hasEditorText: t
563
+ };
564
+ if (!e) return n;
565
+ let r = R();
566
+ if (It(r)) return {
567
+ ...n,
568
+ isInTable: !0
569
+ };
570
+ if (!z(r)) return n;
571
+ let i = Ot(r, "font-size", gn), a = Ot(r, "color", _n), o = Ot(r, "background-color", vn), s = r.anchor.getNode(), c = s.getKey() === "root" ? s : H(s, (e) => {
572
+ let t = e.getParent();
573
+ return t !== null && Oe(t);
574
+ });
575
+ c === null && (c = s.getTopLevelElementOrThrow());
576
+ let l = {}, u = H(s, lt);
577
+ u ? (l.link = u.getURL(), l.linkText = u.getTextContent(), l.newBlank = u.getTarget() === "_blank") : l.linkText = r.getTextContent();
578
+ let d = H(s, mt), f = !1, p = Ee(c) ? c.getIndent() : 0;
579
+ if (mt(d)) {
580
+ p = d.getIndent();
581
+ let e = d.getParent();
582
+ if (ht(e)) {
583
+ let t = e.getListType();
584
+ f = t === "number" || t === "bullet" ? t : !1;
585
+ }
586
+ }
587
+ let m = H(s, V), h = H(s, Kt), g = Kt(h) ? h.getTag() : void 0;
588
+ return {
589
+ bold: r.hasFormat("bold"),
590
+ italic: r.hasFormat("italic"),
591
+ underline: r.hasFormat("underline"),
592
+ strikethrough: r.hasFormat("strikethrough"),
593
+ superscript: r.hasFormat("superscript"),
594
+ subscript: r.hasFormat("subscript"),
595
+ fontSize: i,
596
+ fontColor: a,
597
+ backgroundColor: o,
598
+ align: En(Ee(c) ? c.getFormatType() : ""),
599
+ listType: f,
600
+ canOutdent: p > 0 || f !== !1,
601
+ isCodeBlock: !!m,
602
+ isInTable: !!H(s, Nt),
603
+ headingTag: g === "h1" || g === "h2" || g === "h3" ? g : !1,
604
+ codeLanguage: Tn(m?.getLanguage()),
605
+ hasEditorText: t,
606
+ link: l
607
+ };
608
+ }, Mn = (e, t) => {
609
+ e.isEditable() || e.setEditable(!0), e.update(() => {
610
+ kn(), t(jn(!0));
611
+ }), e.focus(void 0, { defaultSelection: "rootStart" });
612
+ }, Nn = (e) => {
613
+ let t = An;
614
+ return Mn(e, (e) => {
615
+ t = e;
616
+ }), t;
617
+ }, Pn = () => {
618
+ let [e] = B(), [t, n] = P(!1);
619
+ return O(() => Yt(e.registerCommand(We, () => (n(!0), !1), Ve), e.registerCommand(Pe, () => (n(!1), !1), Ve)), [e]), t;
620
+ }, Fn = () => {
621
+ let [e] = B(), t = Pn(), [n, r] = P(An);
622
+ return O(() => (e.getEditorState().read(() => {
623
+ r(jn(t));
624
+ }, { editor: e }), e.registerUpdateListener(({ editorState: n }) => {
625
+ n.read(() => {
626
+ r(jn(t));
627
+ }, { editor: e });
628
+ })), [e, t]), n;
629
+ }, In = (e) => {
630
+ let t = Fn();
631
+ return /* @__PURE__ */ y(mn.Provider, {
632
+ value: t,
633
+ children: e.children
634
+ });
635
+ }, Ln = S(null), Rn = () => {
636
+ let e = E(Ln);
637
+ if (!e) throw Error("useHistoryStateContext must be used within HistoryStateProvider");
638
+ return e;
639
+ }, zn = ({ children: e }) => {
640
+ let [t] = B(), [n, r] = P({
641
+ canUndo: !1,
642
+ canRedo: !1
643
+ });
644
+ return O(() => ot(t.registerCommand(Ie, (e) => (r((t) => t.canUndo === e ? t : {
645
+ ...t,
646
+ canUndo: e
647
+ }), !1), Re), t.registerCommand(Fe, (e) => (r((t) => t.canRedo === e ? t : {
648
+ ...t,
649
+ canRedo: e
650
+ }), !1), Re)), [t]), /* @__PURE__ */ y(Ln.Provider, {
651
+ value: n,
652
+ children: e
653
+ });
654
+ }, Bn = S({ iconSize: sn.default.iconSize }), Vn = Bn.Provider, Hn = () => E(Bn), Un = {
655
+ "lexical-editor__toolbar-button": "_lexical-editor__toolbar-button_dp4a1_1",
656
+ "lexical-editor__toolbar-button-active": "_lexical-editor__toolbar-button-active_dp4a1_26",
657
+ "lexical-editor__toolbar-button-highlight": "_lexical-editor__toolbar-button-highlight_dp4a1_30",
658
+ "lexical-editor__toolbar-button-tooltip-trigger": "_lexical-editor__toolbar-button-tooltip-trigger_dp4a1_36"
659
+ }, q = ({ icon: t, tooltip: n, onClick: r, disabled: i, showDisabledTooltip: a, active: o, highlight: s, size: l }) => {
660
+ let { iconSize: u } = Hn(), d = /* @__PURE__ */ y("button", {
661
+ className: I(Un["lexical-editor__toolbar-button"], {
662
+ [Un["lexical-editor__toolbar-button-active"]]: o,
663
+ [Un["lexical-editor__toolbar-button-highlight"]]: s
664
+ }),
665
+ type: "button",
666
+ onClick: r,
667
+ onMouseDown: (e) => e.preventDefault(),
668
+ disabled: i,
669
+ children: x.isValidElement(t) ? t : /* @__PURE__ */ y(e, {
670
+ name: t,
671
+ size: l ?? u
672
+ })
673
+ });
674
+ return !n || i && !a ? d : /* @__PURE__ */ y(c, {
675
+ content: n,
676
+ minWidth: "auto",
677
+ children: i ? /* @__PURE__ */ y("span", {
678
+ className: Un["lexical-editor__toolbar-button-tooltip-trigger"],
679
+ children: d
680
+ }) : d
681
+ });
682
+ }, J = () => {
683
+ let e = E(mn);
684
+ if (!e) throw Error("useTextFormatsContext must be used within TextFormatsProvider");
685
+ return e;
686
+ }, Wn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
687
+ let [r] = B(), i = J(), { t: o } = a(), s = i.bold;
688
+ return /* @__PURE__ */ y(q, {
689
+ icon: "bold",
690
+ tooltip: t ?? o("editor.bold"),
691
+ showDisabledTooltip: n,
692
+ active: s,
693
+ disabled: e,
694
+ onClick: () => {
695
+ K(r), r.dispatchCommand(Ke, "bold");
696
+ }
697
+ });
698
+ }, Gn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
699
+ let [r] = B(), i = J(), { t: o } = a(), s = i.underline;
700
+ return /* @__PURE__ */ y(q, {
701
+ icon: "underline",
702
+ tooltip: t ?? o("editor.underline"),
703
+ showDisabledTooltip: n,
704
+ active: s,
705
+ disabled: e,
706
+ onClick: () => {
707
+ K(r), r.dispatchCommand(Ke, "underline");
708
+ }
709
+ });
710
+ }, Kn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
711
+ let [r] = B(), i = J(), { t: o } = a(), s = i.italic;
712
+ return /* @__PURE__ */ y(q, {
713
+ icon: "italic",
714
+ tooltip: t ?? o("editor.italic"),
715
+ showDisabledTooltip: n,
716
+ active: s,
717
+ disabled: e,
718
+ onClick: () => {
719
+ K(r), r.dispatchCommand(Ke, "italic");
720
+ }
721
+ });
722
+ }, qn = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
723
+ let [r] = B(), { t: i } = a(), { fontSize: o, headingTag: s } = J(), c = M(() => hn.map((e) => ({
724
+ key: e.value,
725
+ label: e.label
726
+ })), []), l = T((e) => {
727
+ let t = e.key;
728
+ K(r), r.update(() => {
729
+ let e = R();
730
+ z(e) && kt(e, { "font-size": t });
731
+ });
732
+ }, [r]);
733
+ return s || e ? /* @__PURE__ */ y(q, {
734
+ icon: "fontsize",
735
+ tooltip: t ?? i("editor.fontSize"),
736
+ showDisabledTooltip: n,
737
+ disabled: !0
738
+ }) : /* @__PURE__ */ y(f, {
739
+ menus: c,
740
+ onClick: l,
741
+ activeKey: [o],
742
+ showSearch: !1,
743
+ offset: W,
744
+ style: {
745
+ width: "60px",
746
+ minWidth: "60px"
747
+ },
748
+ children: /* @__PURE__ */ y("div", {
749
+ className: "dropdown__trigger inline-flex",
750
+ children: /* @__PURE__ */ y(q, {
751
+ icon: "fontsize",
752
+ tooltip: t ?? i("editor.fontSize"),
753
+ showDisabledTooltip: n,
754
+ active: !1
755
+ })
756
+ })
757
+ });
758
+ }, Jn = "M896 860.48V960H128v-99.52h768zM578.944 128l251.648 655.936h-115.2l-59.904-164.48H379.904L320 784H204.8L456.384 128h122.56z m-58.944 115.776h-3.712L412.16 531.2h211.072L520 243.84z", Yn = "M766.4 744.32c43.712 0 79.36-36.224 79.36-80.512 0-53.504-79.36-140.8-79.36-140.8s-79.36 87.296-79.36 140.8c0 44.288 35.648 80.512 79.36 80.512z m-377.088-44.16c7.04 7.168 18.56 7.168 25.6 0l256.064-256c7.104-7.04 7.104-18.56 0-25.6l-256-256a16.32 16.32 0 0 0-1.92-1.664L334.72 82.688a9.088 9.088 0 0 0-12.8 0l-48 48a9.088 9.088 0 0 0 0 12.8l67.2 67.2-207.808 207.936c-7.04 7.04-7.04 18.56 0 25.6l255.936 256z m12.864-448.576L581.12 430.528H223.36L402.24 251.52z m501.824 564.416H120a8 8 0 0 0-8 8v80c0 4.416 3.584 8 8 8h784a8 8 0 0 0 8-8v-80a8 8 0 0 0-8-8z", Xn = 860.48, Zn = 99.52, Qn = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, $n = {
759
+ fontColor: {
760
+ path: Jn,
761
+ clipHeight: Xn,
762
+ x: 128,
763
+ width: 768,
764
+ rx: 0
765
+ },
766
+ fill: {
767
+ path: Yn,
768
+ clipHeight: 816,
769
+ x: 112,
770
+ width: 800,
771
+ rx: 8
772
+ }
773
+ }, er = (e, t) => {
774
+ let n = t.trim().toLowerCase();
775
+ if (e === "fill") return !n || n === "transparent" || Qn.test(n);
776
+ let r = n.replace(/\s+/g, "");
777
+ return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
778
+ }, tr = ({ variant: e, barColor: t, size: n }) => {
779
+ let r = `${k().replace(/:/g, "")}clip`, i = $n[e];
780
+ return /* @__PURE__ */ b("svg", {
781
+ width: n,
782
+ height: n,
783
+ viewBox: "0 0 1024 1024",
784
+ "aria-hidden": "true",
785
+ children: [
786
+ /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ y("clipPath", {
787
+ id: r,
788
+ children: /* @__PURE__ */ y("rect", {
789
+ x: 0,
790
+ y: 0,
791
+ width: 1024,
792
+ height: i.clipHeight
793
+ })
794
+ }) }),
795
+ /* @__PURE__ */ y("path", {
796
+ d: i.path,
797
+ fill: "currentColor",
798
+ clipPath: `url(#${r})`
799
+ }),
800
+ /* @__PURE__ */ y("rect", {
801
+ x: i.x,
802
+ y: Xn,
803
+ width: i.width,
804
+ height: Zn,
805
+ rx: i.rx,
806
+ fill: er(e, t) ? "currentColor" : t
807
+ })
808
+ ]
809
+ });
810
+ }, nr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
811
+ let [r] = B(), o = J(), { iconSize: s } = Hn(), { t: c } = a(), l = T((e) => {
812
+ K(r), r.update(() => {
813
+ let t = R();
814
+ z(t) && kt(t, { color: e });
815
+ });
816
+ }, [r]);
817
+ return /* @__PURE__ */ y(i, {
818
+ value: o.fontColor,
819
+ onChange: l,
820
+ placement: "bottom-start",
821
+ offset: W.y,
822
+ presetColors: "basic",
823
+ disabled: e,
824
+ children: /* @__PURE__ */ y("div", {
825
+ className: "trigger-picker inline-flex",
826
+ children: /* @__PURE__ */ y(q, {
827
+ icon: /* @__PURE__ */ y(tr, {
828
+ variant: "fontColor",
829
+ barColor: o.fontColor,
830
+ size: s
831
+ }),
832
+ tooltip: t ?? c("editor.fontColor"),
833
+ showDisabledTooltip: n,
834
+ disabled: e
835
+ })
836
+ })
837
+ });
838
+ }, rr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
839
+ let [r] = B(), o = J(), { iconSize: s } = Hn(), { t: c } = a(), l = T((e) => {
840
+ K(r), r.update(() => {
841
+ let t = R();
842
+ z(t) && kt(t, { "background-color": e });
843
+ });
844
+ }, [r]);
845
+ return /* @__PURE__ */ y(i, {
846
+ value: o.backgroundColor,
847
+ onChange: l,
848
+ placement: "bottom-start",
849
+ offset: W.y,
850
+ presetColors: "basic",
851
+ disabled: e,
852
+ children: /* @__PURE__ */ y("div", {
853
+ className: "trigger-picker inline-flex",
854
+ children: /* @__PURE__ */ y(q, {
855
+ icon: /* @__PURE__ */ y(tr, {
856
+ variant: "fill",
857
+ barColor: o.backgroundColor,
858
+ size: s
859
+ }),
860
+ tooltip: t ?? c("editor.fill"),
861
+ showDisabledTooltip: n,
862
+ disabled: e
863
+ })
864
+ })
865
+ });
866
+ }, ir = {
867
+ left: "paragraph",
868
+ center: "paragraphmiddle",
869
+ right: "paragraphright"
870
+ }, ar = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
871
+ let [i] = B(), { align: o } = J(), { iconSize: s } = Hn(), { t: c } = a(), l = M(() => [
872
+ {
873
+ key: "left",
874
+ label: c("leftAlign"),
875
+ icon: /* @__PURE__ */ y(e, {
876
+ name: ir.left,
877
+ size: s
878
+ })
879
+ },
880
+ {
881
+ key: "center",
882
+ label: c("editor.centerAlign"),
883
+ icon: /* @__PURE__ */ y(e, {
884
+ name: ir.center,
885
+ size: s
886
+ })
887
+ },
888
+ {
889
+ key: "right",
890
+ label: c("editor.rightAlign"),
891
+ icon: /* @__PURE__ */ y(e, {
892
+ name: ir.right,
893
+ size: s
894
+ })
895
+ }
896
+ ], [s, c]), u = T((e) => {
897
+ K(i), i.dispatchCommand(Ge, e.key);
898
+ }, [i]), d = /* @__PURE__ */ y("div", {
899
+ className: G["bsy-lexical__toolbar-select"],
900
+ style: { width: 50 },
901
+ children: /* @__PURE__ */ y(q, {
902
+ icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(e, {
903
+ name: ir[En(o)],
904
+ size: s
905
+ }), /* @__PURE__ */ y(e, {
906
+ name: "arrow-down",
907
+ size: s,
908
+ className: G["bsy-lexical__toolbar-select-arrow"]
909
+ })] }),
910
+ tooltip: n ?? c("editor.alignment"),
911
+ showDisabledTooltip: r,
912
+ disabled: t
913
+ })
914
+ });
915
+ return t ? d : /* @__PURE__ */ y(f, {
916
+ menus: l,
917
+ onClick: u,
918
+ showSearch: !1,
919
+ activeKey: [o],
920
+ offset: W,
921
+ style: {
922
+ width: "110px",
923
+ minWidth: "110px"
924
+ },
925
+ children: d
926
+ });
927
+ }, or = (e) => e ? e.startsWith("@") || e.match(/^https?:\/\//) ? e : `http://${e}` : "", sr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
928
+ let [i] = B(), { link: o } = J(), { t: s } = a(), [c, u] = P(!1), [d, f] = P(""), [p, m] = P(""), [h, g] = P(!0), [_, x] = ne.useMessage(), S = N(null), C = T((e) => {
929
+ u(e), e || i.setEditable(!0);
930
+ }, [i]), w = () => {
931
+ if (!d) {
932
+ _.warning(s("editor.linkAddressEmpty"));
933
+ return;
934
+ }
935
+ let e = or(d);
936
+ i.setEditable(!0), i.update(() => {
937
+ let t = h ? {
938
+ target: "_blank",
939
+ rel: "noopener noreferrer",
940
+ title: d
941
+ } : { title: d }, n = S.current;
942
+ n !== null && Ne(n);
943
+ let r = R();
944
+ if (z(r)) {
945
+ let n = p || d, i = r.getTextContent();
946
+ if (!r.isCollapsed() && n === i) ut(e, t);
947
+ else {
948
+ let i = r.anchor.getNode(), a = Ae(i) ? i : null, o = r.style || r.getNodes().find(Ae)?.getStyle() || a?.getStyle() || "", s = r.format || a?.getFormat() || 0, c = ct(e, t), l = xe(n);
949
+ l.setFormat(s), l.setStyle(o), c.append(l), r.insertNodes([c]);
950
+ }
951
+ } else {
952
+ let n = ct(e, t);
953
+ n.append(xe(p || d));
954
+ let r = L(), i = r.getLastChild();
955
+ if (Ee(i) && i.isEmpty()) i.append(n);
956
+ else {
957
+ let e = ye();
958
+ e.append(n), r.append(e);
959
+ }
960
+ }
961
+ }), S.current = null, f(""), m(""), C(!1);
962
+ }, E = T(() => {
963
+ let e = "";
964
+ i.getEditorState().read(() => {
965
+ let t = R();
966
+ S.current = t ? t.clone() : null, z(t) && !t.isCollapsed() && (e = t.getTextContent());
967
+ }), i.setEditable(!1), i.update(() => {
968
+ Ne(null);
969
+ }), window.getSelection()?.removeAllRanges(), i.getRootElement()?.blur(), o ? (f(o.link ?? ""), m(o.linkText ?? "")) : (f(""), m(e)), u(!0);
970
+ }, [o, i]);
971
+ return /* @__PURE__ */ b(v, { children: [
972
+ /* @__PURE__ */ y(q, {
973
+ icon: "Insertlink",
974
+ tooltip: t ?? s("link"),
975
+ showDisabledTooltip: n,
976
+ onClick: E,
977
+ disabled: e,
978
+ active: !!o?.link
979
+ }),
980
+ x,
981
+ /* @__PURE__ */ y(r, {
982
+ title: s("link"),
983
+ open: c,
984
+ onOpenChange: C,
985
+ children: /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("div", {
986
+ className: "px-[20px] pb-[60px] pt-[40px]",
987
+ children: [/* @__PURE__ */ b("div", {
988
+ className: "flex items-center relative",
989
+ children: [
990
+ /* @__PURE__ */ y("label", {
991
+ className: "w-[80px] shrink-0",
992
+ children: s("linkAddress")
993
+ }),
994
+ /* @__PURE__ */ y(te, {
995
+ value: d,
996
+ onChange: (e) => f(e.target.value),
997
+ placeholder: s("editor.linkTip")
998
+ }),
999
+ /* @__PURE__ */ y("div", {
1000
+ className: "absolute bottom-[-30px] left-[80px]",
1001
+ children: /* @__PURE__ */ y("p", {
1002
+ className: "text-[#999]",
1003
+ children: s("editor.linkAliasTip")
1004
+ })
1005
+ })
1006
+ ]
1007
+ }), /* @__PURE__ */ b("div", {
1008
+ className: "flex items-center mt-[40px]",
1009
+ children: [/* @__PURE__ */ y("label", {
1010
+ className: "w-[80px] shrink-0",
1011
+ children: s("showContent")
1012
+ }), /* @__PURE__ */ y(te, {
1013
+ value: p,
1014
+ onChange: (e) => m(e.target.value)
1015
+ })]
1016
+ })]
1017
+ }), /* @__PURE__ */ b("div", {
1018
+ className: "py-[14px] px-[20px] flex justify-between items-center border-t-[1px] border-solid border-[#e0e0e0]",
1019
+ children: [/* @__PURE__ */ y("div", { children: /* @__PURE__ */ y(l, {
1020
+ checked: h,
1021
+ onChange: (e) => g(e),
1022
+ children: s("openInNewTab")
1023
+ }) }), /* @__PURE__ */ b("div", {
1024
+ className: "flex gap-[15px]",
1025
+ children: [/* @__PURE__ */ y(F, {
1026
+ onClick: () => C(!1),
1027
+ children: s("cancel")
1028
+ }), /* @__PURE__ */ y(F, {
1029
+ type: "primary",
1030
+ onClick: w,
1031
+ children: s("confirm")
1032
+ })]
1033
+ })]
1034
+ })] })
1035
+ })
1036
+ ] });
1037
+ }, cr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1038
+ let [r] = B(), { link: i } = J(), { t: o } = a();
1039
+ return /* @__PURE__ */ y(q, {
1040
+ icon: "cancellink",
1041
+ tooltip: t ?? o("cancelLink"),
1042
+ showDisabledTooltip: n,
1043
+ disabled: e,
1044
+ onClick: () => {
1045
+ i && (K(r), r.dispatchCommand(pt, null));
1046
+ }
1047
+ });
1048
+ }, Y = {
1049
+ "picture-modal__container": "_picture-modal__container_1067t_1",
1050
+ "picture-modal__sidebar": "_picture-modal__sidebar_1067t_4",
1051
+ "picture-modal__menu-list": "_picture-modal__menu-list_1067t_8",
1052
+ "picture-modal__menu-item": "_picture-modal__menu-item_1067t_13",
1053
+ "picture-modal__menu-item--active": "_picture-modal__menu-item--active_1067t_22",
1054
+ "picture-modal__content": "_picture-modal__content_1067t_25",
1055
+ "picture-modal__content-body": "_picture-modal__content-body_1067t_31",
1056
+ "picture-modal__ops": "_picture-modal__ops_1067t_34",
1057
+ "picture-modal__content-title": "_picture-modal__content-title_1067t_42",
1058
+ "picture-modal__upload-area": "_picture-modal__upload-area_1067t_53",
1059
+ "picture-modal__upload-area--dragging": "_picture-modal__upload-area--dragging_1067t_69",
1060
+ "picture-modal__preview-list": "_picture-modal__preview-list_1067t_75",
1061
+ "picture-modal__preview": "_picture-modal__preview_1067t_75",
1062
+ "picture-modal__preview--error": "_picture-modal__preview--error_1067t_89",
1063
+ "picture-modal__preview-image": "_picture-modal__preview-image_1067t_92",
1064
+ "picture-modal__preview-mask": "_picture-modal__preview-mask_1067t_106",
1065
+ "picture-modal__preview-spinner": "_picture-modal__preview-spinner_1067t_116",
1066
+ "picture-modal-spin": "_picture-modal-spin_1067t_1",
1067
+ "picture-modal__preview-info": "_picture-modal__preview-info_1067t_124",
1068
+ "picture-modal__preview-filename": "_picture-modal__preview-filename_1067t_128",
1069
+ "picture-modal__preview-filename--error": "_picture-modal__preview-filename--error_1067t_136",
1070
+ "picture-modal__preview-size": "_picture-modal__preview-size_1067t_139",
1071
+ "picture-modal__preview-delete": "_picture-modal__preview-delete_1067t_143",
1072
+ "picture-modal__upload-text": "_picture-modal__upload-text_1067t_151",
1073
+ "picture-modal__footer": "_picture-modal__footer_1067t_155"
1074
+ }, lr = C((e, t) => {
1075
+ let [n] = ee.useForm(), [r, i] = P(""), { t: o } = a(), s = (e) => /^https?:\/\/.+/i.test(e);
1076
+ return A(t, () => ({ getValue: async () => {
1077
+ try {
1078
+ return await n.validateFields(), r;
1079
+ } catch {
1080
+ throw Error("URL validation failed");
1081
+ }
1082
+ } })), /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("div", {
1083
+ className: Y["picture-modal__content-title"],
1084
+ "data-title": o("editor.imageUrlNote"),
1085
+ children: o("editor.enterImageUrl")
1086
+ }), /* @__PURE__ */ y(ee, {
1087
+ form: n,
1088
+ children: /* @__PURE__ */ y(ee.Item, {
1089
+ name: "url",
1090
+ rules: [{
1091
+ required: !0,
1092
+ message: o("editor.pleaseEnterImageUrl")
1093
+ }, { validator: (e, t) => !t || s(t) ? Promise.resolve() : Promise.reject(Error(o("editor.pleaseEnterValidImageUrl"))) }],
1094
+ children: /* @__PURE__ */ y(te, {
1095
+ placeholder: o("editor.pleaseEnterImageUrl"),
1096
+ value: r,
1097
+ onChange: (e) => i(e.target.value)
1098
+ })
1099
+ })
1100
+ })] });
1101
+ });
1102
+ lr.displayName = "LinkInput";
1103
+ //#endregion
1104
+ //#region src/components/Editor/utils/formatTruncatedFilename.ts
1105
+ var ur = "......", dr = (e, t, n) => {
1106
+ if (t <= 0 || n(e) <= t) return {
1107
+ display: e,
1108
+ truncated: !1
1109
+ };
1110
+ 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}${ur}${s}${o}`, u = (e) => n(e) <= t;
1111
+ if (!u(l(""))) {
1112
+ let t = `${ur}${o}`;
1113
+ return {
1114
+ display: u(t) ? t : e,
1115
+ truncated: !0
1116
+ };
1117
+ }
1118
+ let d = 0, f = c.length, p = 0;
1119
+ for (; d <= f;) {
1120
+ let e = d + f >> 1;
1121
+ u(l(c.slice(0, e))) ? (p = e, d = e + 1) : f = e - 1;
1122
+ }
1123
+ return {
1124
+ display: l(c.slice(0, p)),
1125
+ truncated: !0
1126
+ };
1127
+ }, fr = S(null), pr = S({ text: "" }), mr = () => {
1128
+ let e = E(fr);
1129
+ if (!e) throw Error("useEditorContainer must be used within EditorContainerProvider");
1130
+ return e;
1131
+ }, hr = () => E(pr), gr = "EditorImageUploadingError";
1132
+ function _r(e) {
1133
+ if (!e || typeof e != "object" || !("name" in e)) return !1;
1134
+ let t = String(e.name);
1135
+ return t === "AbortError" || t === "CanceledError";
1136
+ }
1137
+ function vr(e) {
1138
+ return yn.includes(e.name.split(".").pop()?.toLowerCase() ?? "");
1139
+ }
1140
+ function yr(e) {
1141
+ if (Number.isFinite(e)) return Math.min(100, Math.max(0, e));
1142
+ }
1143
+ function br(e) {
1144
+ return e === void 0 ? .55 : .55 * (1 - e / 100);
1145
+ }
346
1146
  //#endregion
347
- //#region src/components/Editor/hooks/useTextFormatsState.ts
348
- function pn() {
349
- let [e] = W(), [t, n] = R({
350
- bold: !1,
351
- italic: !1,
352
- underline: !1,
353
- strikethrough: !1,
354
- superscript: !1,
355
- subscript: !1,
356
- fontSize: he,
357
- fontColor: me,
358
- backgroundColor: pe,
359
- align: "left",
360
- listType: !1,
361
- canOutdent: !1,
362
- isCodeBlock: !1,
363
- isInTable: !1,
364
- headingTag: !1,
365
- codeLanguage: _,
366
- hasEditorText: !1,
367
- link: void 0
1147
+ //#region src/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.tsx
1148
+ var xr = {
1149
+ duration: .2,
1150
+ ease: [
1151
+ .4,
1152
+ 0,
1153
+ .2,
1154
+ 1
1155
+ ]
1156
+ }, Sr = ({ name: e, error: t }) => {
1157
+ let n = N(null), [r, i] = P(e), [a, o] = P(!1);
1158
+ return j(() => {
1159
+ let t = n.current, r = document.createElement("canvas").getContext("2d");
1160
+ if (!t || !r) return;
1161
+ let a = () => {
1162
+ r.font = getComputedStyle(t).font;
1163
+ let n = dr(e, t.clientWidth, (e) => r.measureText(e).width);
1164
+ i(n.display), o(n.truncated);
1165
+ };
1166
+ a();
1167
+ let s = new ResizeObserver(a);
1168
+ return s.observe(t), () => s.disconnect();
1169
+ }, [e]), /* @__PURE__ */ y("div", {
1170
+ ref: n,
1171
+ className: I(Y["picture-modal__preview-filename"], t && Y["picture-modal__preview-filename--error"]),
1172
+ title: a ? e : void 0,
1173
+ children: r
368
1174
  });
369
- return F(() => e.registerUpdateListener(({ editorState: e }) => {
370
- e.read(() => {
371
- let e = H(), t = !!V().getTextContent().trim();
372
- if (Ut(e)) {
373
- n((e) => ({
374
- ...e,
375
- isCodeBlock: !1,
376
- isInTable: !0,
377
- headingTag: !1,
378
- hasEditorText: t
379
- }));
380
- return;
1175
+ }, Cr = (e) => new Promise((t, n) => {
1176
+ let r = new FileReader();
1177
+ r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
1178
+ }), wr = C((t, n) => {
1179
+ let { upload: r } = mr(), [i, o] = P(!1), [s, c] = P([]), l = N(s);
1180
+ l.current = s;
1181
+ let u = N(null), d = N(/* @__PURE__ */ new Map()), f = r?.customRequest, [p, m] = ne.useMessage(), { t: h } = a(), g = (e) => (e / 1024).toFixed(1) + "kb", _ = (e, t) => {
1182
+ c((n) => n.map((n) => n.id === e ? {
1183
+ ...n,
1184
+ ...t
1185
+ } : n));
1186
+ }, v = (e, t) => {
1187
+ if (!f) {
1188
+ _(e, { status: "success" });
1189
+ return;
1190
+ }
1191
+ let n = new AbortController();
1192
+ d.current.set(e, n), f(t, {
1193
+ signal: n.signal,
1194
+ onProgress: (t) => {
1195
+ let n = yr(t);
1196
+ n !== void 0 && _(e, { percent: n });
381
1197
  }
382
- if (U(e)) {
383
- let r = xt(e, "font-size", he), i = xt(e, "color", me), a = xt(e, "background-color", pe), s = e.anchor.getNode(), c = s.getKey() === "root" ? s : G(s, (e) => {
384
- let t = e.getParent();
385
- return t !== null && Ze(t);
1198
+ }).then((t) => {
1199
+ n.signal.aborted || _(e, {
1200
+ status: "success",
1201
+ src: typeof t == "string" ? t : t.url,
1202
+ percent: 100,
1203
+ attachment: typeof t == "string" ? void 0 : t.attachment
1204
+ });
1205
+ }).catch((t) => {
1206
+ n.signal.aborted || _r(t) || _(e, { status: "error" });
1207
+ }).finally(() => {
1208
+ d.current.delete(e);
1209
+ });
1210
+ }, x = (e) => vr(e) ? e.size > 5242880 ? (p.warning(h("editor.imageSizeNote")), !1) : !0 : (p.warning(h("editor.onlyImageFormatsSupported")), !1), S = (e) => {
1211
+ let t = 10 - l.current.length;
1212
+ if (t <= 0) {
1213
+ p.warning(h("editor.imageCountNote", { count: 10 }));
1214
+ return;
1215
+ }
1216
+ let n = Array.from(e).filter(x), r = n.slice(0, t);
1217
+ if (n.length > t && p.warning(h("editor.imageCountNote", { count: 10 })), !r.length) return;
1218
+ let i = r.map((e) => ({
1219
+ id: `${e.name}-${e.size}-${e.lastModified}-${Math.random()}`,
1220
+ file: e,
1221
+ url: URL.createObjectURL(e),
1222
+ status: f ? "uploading" : "success"
1223
+ }));
1224
+ c((e) => [...e, ...i]), i.forEach((e) => {
1225
+ v(e.id, e.file);
1226
+ });
1227
+ }, C = (e) => {
1228
+ d.current.get(e)?.abort(), d.current.delete(e), c((t) => {
1229
+ let n = t.find((t) => t.id === e);
1230
+ return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
1231
+ });
1232
+ }, w = () => {
1233
+ u.current?.click();
1234
+ }, T = (e) => {
1235
+ e.target.files?.length && S(e.target.files), e.target.value = "";
1236
+ };
1237
+ return O(() => () => {
1238
+ d.current.forEach((e) => e.abort()), d.current.clear(), l.current.forEach((e) => URL.revokeObjectURL(e.url));
1239
+ }, []), A(n, () => ({ getValue: async () => {
1240
+ if (s.some((e) => e.status === "uploading")) {
1241
+ let e = Error(h("editor.imageUploading"));
1242
+ throw e.name = gr, e;
1243
+ }
1244
+ let e = s.filter((e) => e.status === "success");
1245
+ if (!e.length) throw p.warning(h("editor.pleaseUploadImageFirst")), Error(h("editor.pleaseUploadImageFirst"));
1246
+ try {
1247
+ return await Promise.all(e.map(async (e) => ({
1248
+ src: e.src ?? await Cr(e.file),
1249
+ fileName: e.file.name,
1250
+ attachment: e.attachment
1251
+ })));
1252
+ } catch {
1253
+ throw Error(h("editor.operationFailed"));
1254
+ }
1255
+ } }), [
1256
+ s,
1257
+ p,
1258
+ h
1259
+ ]), /* @__PURE__ */ b("div", {
1260
+ onDragOver: (e) => {
1261
+ e.preventDefault(), o(!0);
1262
+ },
1263
+ onDragLeave: (e) => {
1264
+ e.preventDefault(), o(!1);
1265
+ },
1266
+ onDrop: (e) => {
1267
+ e.preventDefault(), o(!1), e.dataTransfer.files.length && S(e.dataTransfer.files);
1268
+ },
1269
+ children: [
1270
+ /* @__PURE__ */ b("div", {
1271
+ className: Y["picture-modal__ops"],
1272
+ children: [/* @__PURE__ */ y("div", {
1273
+ className: Y["picture-modal__content-title"],
1274
+ "data-title": h("editor.imageSizeNote"),
1275
+ children: h("editor.uploadImage")
1276
+ }), /* @__PURE__ */ b("div", {
1277
+ className: `${Y["picture-modal__upload-area"]} ${i ? Y["picture-modal__upload-area--dragging"] : ""}`,
1278
+ onClick: w,
1279
+ children: [/* @__PURE__ */ y(e, { name: "upload" }), /* @__PURE__ */ y("span", {
1280
+ className: Y["picture-modal__upload-text"],
1281
+ children: h("editor.clickOrDragToUpload")
1282
+ })]
1283
+ })]
1284
+ }),
1285
+ s.length > 0 ? /* @__PURE__ */ y("div", {
1286
+ className: Y["picture-modal__preview-list"],
1287
+ children: /* @__PURE__ */ y(ae, {
1288
+ mode: "popLayout",
1289
+ children: s.map((t) => /* @__PURE__ */ b(oe.div, {
1290
+ layout: "position",
1291
+ className: I(Y["picture-modal__preview"], t.status === "error" && Y["picture-modal__preview--error"]),
1292
+ initial: {
1293
+ opacity: 0,
1294
+ y: 12
1295
+ },
1296
+ animate: {
1297
+ opacity: 1,
1298
+ y: 0
1299
+ },
1300
+ exit: {
1301
+ opacity: 0,
1302
+ y: -8
1303
+ },
1304
+ transition: xr,
1305
+ children: [
1306
+ /* @__PURE__ */ b("div", {
1307
+ className: Y["picture-modal__preview-image"],
1308
+ children: [/* @__PURE__ */ y("img", {
1309
+ src: t.url,
1310
+ alt: h("editor.previewImage")
1311
+ }), t.status === "uploading" ? /* @__PURE__ */ y("div", {
1312
+ className: Y["picture-modal__preview-mask"],
1313
+ style: { opacity: br(t.percent) },
1314
+ children: t.percent === void 0 ? /* @__PURE__ */ y("span", { className: Y["picture-modal__preview-spinner"] }) : null
1315
+ }) : null]
1316
+ }),
1317
+ /* @__PURE__ */ b("div", {
1318
+ className: Y["picture-modal__preview-info"],
1319
+ children: [/* @__PURE__ */ y(Sr, {
1320
+ name: t.file.name,
1321
+ error: t.status === "error"
1322
+ }), /* @__PURE__ */ y("div", {
1323
+ className: Y["picture-modal__preview-size"],
1324
+ children: g(t.file.size)
1325
+ })]
1326
+ }),
1327
+ /* @__PURE__ */ y("div", {
1328
+ className: Y["picture-modal__preview-delete"],
1329
+ role: "button",
1330
+ onClick: () => C(t.id),
1331
+ children: /* @__PURE__ */ y(e, { name: "delete" })
1332
+ })
1333
+ ]
1334
+ }, t.id))
1335
+ })
1336
+ }) : null,
1337
+ /* @__PURE__ */ y("input", {
1338
+ ref: u,
1339
+ type: "file",
1340
+ accept: bn,
1341
+ multiple: !0,
1342
+ style: { display: "none" },
1343
+ onChange: T
1344
+ }),
1345
+ m
1346
+ ]
1347
+ });
1348
+ });
1349
+ wr.displayName = "UploadImage";
1350
+ //#endregion
1351
+ //#region src/components/Editor/commands/ImageCommands.ts
1352
+ var Tr = it("INSERT_INLINE_IMAGE_COMMAND"), Er = ({ disabled: t, tooltip: n, showDisabledTooltip: i }) => {
1353
+ let { t: o } = a(), [s] = B(), { attachmentsBySrcRef: c } = mr(), [l, d] = P(!1), f = N(null), p = N(null), m = [{
1354
+ key: "upload",
1355
+ title: o("editor.uploadImage"),
1356
+ icon: /* @__PURE__ */ y(e, { name: "picture" })
1357
+ }, {
1358
+ key: "url",
1359
+ title: o("editor.imageUrl"),
1360
+ icon: /* @__PURE__ */ y(e, { name: "Insertlink" })
1361
+ }], [h, g] = P(m[0].key), _ = async () => {
1362
+ try {
1363
+ if (h === "upload" && p.current) (await p.current.getValue()).forEach((e) => {
1364
+ e.attachment !== void 0 && c.current.set(e.src, e.attachment), s.dispatchCommand(Tr, {
1365
+ src: e.src,
1366
+ altText: e.fileName,
1367
+ dataId: e.attachment?._id
386
1368
  });
387
- c === null && (c = s.getTopLevelElementOrThrow());
388
- let l = {}, u = G(s, Et);
389
- u ? (l.link = u.getURL(), l.linkText = u.getTextContent(), l.newBlank = u.getTarget() === "_blank") : l.linkText = e.getTextContent();
390
- let f = G(s, K), p = !1, m = Ye(c) ? c.getIndent() : 0;
391
- if (K(f)) {
392
- m = f.getIndent();
393
- let e = f.getParent();
394
- if (kt(e)) {
395
- let t = e.getListType();
396
- p = t === "number" || t === "bullet" ? t : !1;
397
- }
398
- }
399
- let h = G(s, q), g = G(s, Zt), _ = Zt(g) ? g.getTag() : void 0;
400
- n({
401
- bold: e.hasFormat("bold"),
402
- italic: e.hasFormat("italic"),
403
- underline: e.hasFormat("underline"),
404
- strikethrough: e.hasFormat("strikethrough"),
405
- superscript: e.hasFormat("superscript"),
406
- subscript: e.hasFormat("subscript"),
407
- fontSize: r,
408
- fontColor: i,
409
- backgroundColor: a,
410
- align: o(Ye(c) ? c.getFormatType() : ""),
411
- listType: p,
412
- canOutdent: m > 0 || p !== !1,
413
- isCodeBlock: !!h,
414
- isInTable: !!G(s, Bt),
415
- headingTag: _ === "h1" || _ === "h2" || _ === "h3" ? _ : !1,
416
- codeLanguage: d(h?.getLanguage()),
417
- hasEditorText: t,
418
- link: l
1369
+ });
1370
+ else if (f.current) {
1371
+ let e = await f.current.getValue();
1372
+ s.dispatchCommand(Tr, {
1373
+ src: e,
1374
+ altText: e
419
1375
  });
420
- } else n((e) => ({
421
- ...e,
422
- hasEditorText: t
423
- }));
1376
+ }
1377
+ d(!1);
1378
+ } catch (e) {
1379
+ let t = e instanceof Error ? e.message : o("editor.operationFailed");
1380
+ if (e instanceof Error && e.name === "EditorImageUploadingError") {
1381
+ ne.warning(t);
1382
+ return;
1383
+ }
1384
+ ne.error(t);
1385
+ }
1386
+ }, x = {
1387
+ upload: /* @__PURE__ */ y(wr, { ref: p }),
1388
+ url: /* @__PURE__ */ y(lr, { ref: f })
1389
+ };
1390
+ return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(q, {
1391
+ icon: "picture",
1392
+ tooltip: n ?? o("picture"),
1393
+ showDisabledTooltip: i,
1394
+ disabled: t,
1395
+ onClick: () => d(!0)
1396
+ }), /* @__PURE__ */ b(r, {
1397
+ title: o("addPicture"),
1398
+ open: l,
1399
+ onOpenChange: d,
1400
+ width: "620px",
1401
+ children: [/* @__PURE__ */ b("div", {
1402
+ className: Y["picture-modal__container"],
1403
+ children: [/* @__PURE__ */ y("div", {
1404
+ className: Y["picture-modal__sidebar"],
1405
+ children: /* @__PURE__ */ y("ul", {
1406
+ className: Y["picture-modal__menu-list"],
1407
+ children: m.map((e) => /* @__PURE__ */ b("li", {
1408
+ className: `${Y["picture-modal__menu-item"]} ${h === e.key ? Y["picture-modal__menu-item--active"] : ""}`,
1409
+ onClick: () => g(e.key),
1410
+ children: [/* @__PURE__ */ y("span", {
1411
+ className: Y["picture-modal__menu-icon"],
1412
+ children: e.icon
1413
+ }), /* @__PURE__ */ y("span", { children: e.title })]
1414
+ }, e.title))
1415
+ })
1416
+ }), /* @__PURE__ */ y(u, {
1417
+ className: Y["picture-modal__content"],
1418
+ contentClassName: Y["picture-modal__content-body"],
1419
+ children: x[h]
1420
+ })]
1421
+ }), /* @__PURE__ */ b("div", {
1422
+ className: Y["picture-modal__footer"],
1423
+ children: [/* @__PURE__ */ y(F, {
1424
+ onClick: () => d(!1),
1425
+ children: o("cancel")
1426
+ }), /* @__PURE__ */ y(F, {
1427
+ type: "primary",
1428
+ onClick: _,
1429
+ children: o("confirm")
1430
+ })]
1431
+ })]
1432
+ })] });
1433
+ }, Dr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1434
+ let [r] = B(), { canUndo: i } = Rn(), { t: o } = a();
1435
+ return /* @__PURE__ */ y(q, {
1436
+ icon: "chexiao",
1437
+ tooltip: t ?? o("editor.undo"),
1438
+ showDisabledTooltip: n,
1439
+ disabled: e || !i,
1440
+ onClick: () => {
1441
+ r.dispatchCommand(rt, void 0);
1442
+ }
1443
+ });
1444
+ }, Or = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1445
+ let [r] = B(), { canRedo: i } = Rn(), { t: o } = a();
1446
+ return /* @__PURE__ */ y(q, {
1447
+ icon: "fanhui",
1448
+ tooltip: t ?? o("editor.redo"),
1449
+ showDisabledTooltip: n,
1450
+ disabled: e || !i,
1451
+ onClick: () => r.dispatchCommand(et, void 0)
1452
+ });
1453
+ }, kr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1454
+ let [r] = B(), { strikethrough: i } = J(), { t: o } = a();
1455
+ return /* @__PURE__ */ y(q, {
1456
+ icon: "shanchuxian",
1457
+ tooltip: t ?? o("editor.strikethrough"),
1458
+ showDisabledTooltip: n,
1459
+ active: i,
1460
+ disabled: e,
1461
+ onClick: () => {
1462
+ K(r), r.dispatchCommand(Ke, "strikethrough");
1463
+ }
1464
+ });
1465
+ }, Ar = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1466
+ let [r] = B(), { superscript: i } = J(), { t: o } = a();
1467
+ return /* @__PURE__ */ y(q, {
1468
+ icon: "shangbiao",
1469
+ tooltip: t ?? o("editor.superscript"),
1470
+ showDisabledTooltip: n,
1471
+ active: i,
1472
+ disabled: e,
1473
+ onClick: () => {
1474
+ K(r), r.dispatchCommand(Ke, "superscript");
1475
+ }
1476
+ });
1477
+ }, jr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1478
+ let [r] = B(), { subscript: i } = J(), { t: o } = a();
1479
+ return /* @__PURE__ */ y(q, {
1480
+ icon: "xiabiao",
1481
+ tooltip: t ?? o("editor.subscript"),
1482
+ showDisabledTooltip: n,
1483
+ active: i,
1484
+ disabled: e,
1485
+ onClick: () => {
1486
+ K(r), r.dispatchCommand(Ke, "subscript");
1487
+ }
1488
+ });
1489
+ }, Mr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1490
+ let [r] = B(), { t: i } = a();
1491
+ return /* @__PURE__ */ y(q, {
1492
+ icon: "zengjiasuojin",
1493
+ tooltip: t ?? i("editor.indent"),
1494
+ showDisabledTooltip: n,
1495
+ disabled: e,
1496
+ onClick: () => {
1497
+ K(r), r.dispatchCommand(Je, void 0);
1498
+ }
1499
+ });
1500
+ }, Nr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1501
+ let [r] = B(), { canOutdent: i } = J(), o = Pn(), { t: s } = a();
1502
+ return /* @__PURE__ */ b("div", {
1503
+ className: G["bsy-lexical__toolbar-with-divider"],
1504
+ children: [/* @__PURE__ */ y("div", { className: G["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
1505
+ icon: "jianshaosuojin",
1506
+ tooltip: t ?? s("editor.outdent"),
1507
+ showDisabledTooltip: n,
1508
+ disabled: e || o && !i,
1509
+ onClick: () => {
1510
+ K(r), r.dispatchCommand(Ze, void 0);
1511
+ }
1512
+ })]
1513
+ });
1514
+ }, Pr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1515
+ let [r] = B(), { listType: i } = J(), { t: o } = a(), s = i === "bullet";
1516
+ return /* @__PURE__ */ y(q, {
1517
+ icon: "xuhaoliebiao",
1518
+ tooltip: t ?? o("editor.bulletList"),
1519
+ showDisabledTooltip: n,
1520
+ active: s,
1521
+ disabled: e,
1522
+ onClick: () => {
1523
+ let e = Nn(r);
1524
+ r.dispatchCommand(e.listType === "bullet" ? bt : _t, void 0);
1525
+ }
1526
+ });
1527
+ }, Fr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1528
+ let [r] = B(), { listType: i } = J(), { t: o } = a(), s = i === "number";
1529
+ return /* @__PURE__ */ y(q, {
1530
+ icon: "bianhaoliebiao",
1531
+ tooltip: t ?? o("editor.numberList"),
1532
+ showDisabledTooltip: n,
1533
+ active: s,
1534
+ disabled: e,
1535
+ onClick: () => {
1536
+ let e = Nn(r);
1537
+ r.dispatchCommand(e.listType === "number" ? bt : gt, void 0);
1538
+ }
1539
+ });
1540
+ }, Ir = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1541
+ let [r] = B(), { isCodeBlock: i } = J(), { t: o } = a();
1542
+ return /* @__PURE__ */ y(q, {
1543
+ icon: "daima",
1544
+ tooltip: t ?? o("editor.codeBlock"),
1545
+ showDisabledTooltip: n,
1546
+ active: i,
1547
+ disabled: e,
1548
+ onClick: () => {
1549
+ Mn(r, (e) => {
1550
+ At(R(), () => e.isCodeBlock ? ye() : St(xn));
1551
+ });
1552
+ }
1553
+ });
1554
+ }, Lr = {
1555
+ "bsy-lexical__table-picker": "_bsy-lexical__table-picker_mv0nn_1",
1556
+ "bsy-lexical__table-picker-grid": "_bsy-lexical__table-picker-grid_mv0nn_9",
1557
+ "bsy-lexical__table-picker-cell": "_bsy-lexical__table-picker-cell_mv0nn_15",
1558
+ "bsy-lexical__table-picker-cell--active": "_bsy-lexical__table-picker-cell--active_mv0nn_24",
1559
+ "bsy-lexical__table-picker-label": "_bsy-lexical__table-picker-label_mv0nn_28"
1560
+ }, Rr = _(1, 11), zr = ({ disabled: e, tooltip: r, showDisabledTooltip: i }) => {
1561
+ let [s] = B(), { isInTable: c } = J(), { t: l } = a(), u = t(), [f, p] = P(!1), [m, h] = P({
1562
+ rows: 0,
1563
+ cols: 0
1564
+ });
1565
+ O(() => {
1566
+ c && p(!1);
1567
+ }, [c]);
1568
+ let g = () => {
1569
+ p(!1), h({
1570
+ rows: 0,
1571
+ cols: 0
424
1572
  });
425
- }), [e]), t;
426
- }
427
- //#endregion
428
- //#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
429
- var mn = (e) => {
430
- let t = pn();
431
- return /* @__PURE__ */ M(f.Provider, {
432
- value: t,
433
- children: e.children
1573
+ }, { refs: _, floatingStyles: x, getReferenceProps: S, getFloatingProps: C } = d({
1574
+ isOpen: f,
1575
+ close: g,
1576
+ showMask: !1,
1577
+ zIndex: u,
1578
+ popupMinWidth: "220px",
1579
+ offset: W
434
1580
  });
435
- }, hn = m.map((e) => ({
436
- key: e.id,
437
- label: e.label
438
- })), gn = () => {
439
- let [t] = W(), { codeLanguage: r } = b(), { t: i } = n(), { iconSize: o } = g(), s = P((e) => {
440
- let n = e.key;
441
- t.update(() => {
442
- let e = H();
443
- U(e) && G(e.anchor.getNode(), q)?.setLanguage(n);
1581
+ return c ? /* @__PURE__ */ y(q, {
1582
+ icon: "charubiaoge",
1583
+ tooltip: r ?? l("editor.table"),
1584
+ showDisabledTooltip: i,
1585
+ disabled: !0
1586
+ }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("div", {
1587
+ className: "inline-flex",
1588
+ ref: _.setReference,
1589
+ ...S({ onClick: () => p((e) => !e) }),
1590
+ children: /* @__PURE__ */ y(q, {
1591
+ icon: "charubiaoge",
1592
+ tooltip: r ?? l("editor.table"),
1593
+ showDisabledTooltip: i,
1594
+ disabled: e
1595
+ })
1596
+ }), /* @__PURE__ */ y(ce, { children: /* @__PURE__ */ y(n, {
1597
+ zIndex: u,
1598
+ children: /* @__PURE__ */ y(ae, { children: f ? /* @__PURE__ */ y(oe.div, {
1599
+ ref: _.setFloating,
1600
+ ...C(),
1601
+ style: {
1602
+ ...x,
1603
+ zIndex: u
1604
+ },
1605
+ ...o,
1606
+ children: /* @__PURE__ */ b("div", {
1607
+ className: Lr["bsy-lexical__table-picker"],
1608
+ onMouseDown: (e) => e.preventDefault(),
1609
+ onMouseLeave: () => h({
1610
+ rows: 0,
1611
+ cols: 0
1612
+ }),
1613
+ children: [/* @__PURE__ */ y("div", {
1614
+ className: Lr["bsy-lexical__table-picker-grid"],
1615
+ children: Rr.map((e) => Rr.map((t) => /* @__PURE__ */ y("button", {
1616
+ type: "button",
1617
+ className: I(Lr["bsy-lexical__table-picker-cell"], m.rows >= e && m.cols >= t && Lr["bsy-lexical__table-picker-cell--active"]),
1618
+ onMouseEnter: () => h({
1619
+ rows: e,
1620
+ cols: t
1621
+ }),
1622
+ onClick: () => {
1623
+ s.dispatchCommand(Lt, {
1624
+ rows: String(e),
1625
+ columns: String(t),
1626
+ includeHeaders: !1
1627
+ }), g();
1628
+ }
1629
+ }, `${e}-${t}`)))
1630
+ }), /* @__PURE__ */ b("div", {
1631
+ className: Lr["bsy-lexical__table-picker-label"],
1632
+ children: [
1633
+ m.rows,
1634
+ " × ",
1635
+ m.cols
1636
+ ]
1637
+ })]
1638
+ })
1639
+ }, "bsy-lexical-table-picker") : null })
1640
+ }) })] });
1641
+ }, Br = S(null), Vr = () => {
1642
+ let e = E(Br);
1643
+ if (!e) throw Error("useSourceMode must be used within SourceModeProvider");
1644
+ return e;
1645
+ }, Hr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1646
+ let { t: r } = a(), { isSourceMode: i, toggleSourceMode: o } = Vr();
1647
+ return /* @__PURE__ */ y(q, {
1648
+ icon: "yuanmamoshi",
1649
+ tooltip: t ?? r("editor.sourceMode"),
1650
+ showDisabledTooltip: n,
1651
+ active: i,
1652
+ disabled: e,
1653
+ onClick: o
1654
+ });
1655
+ }, Ur = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
1656
+ let [i] = B(), { headingTag: o, isInTable: s } = J(), { t: c } = a(), { iconSize: l } = Hn(), u = o || "paragraph", d = [
1657
+ {
1658
+ key: "paragraph",
1659
+ label: c("editor.paragraph")
1660
+ },
1661
+ {
1662
+ key: "h1",
1663
+ label: c("editor.heading1")
1664
+ },
1665
+ {
1666
+ key: "h2",
1667
+ label: c("editor.heading2")
1668
+ },
1669
+ {
1670
+ key: "h3",
1671
+ label: c("editor.heading3")
1672
+ }
1673
+ ], p = d.find((e) => e.key === u)?.label, m = T((e) => {
1674
+ let t = e.key;
1675
+ K(i), i.update(() => {
1676
+ At(R(), () => t === "paragraph" ? ye() : Gt(t));
444
1677
  });
445
- }, [t]), c = h[r].label;
446
- return /* @__PURE__ */ M(a, {
447
- menus: hn,
448
- onClick: s,
449
- activeKey: [r],
1678
+ }, [i]), h = /* @__PURE__ */ y("div", {
1679
+ className: G["bsy-lexical__toolbar-select"],
1680
+ style: { width: 62 },
1681
+ children: /* @__PURE__ */ y(q, {
1682
+ icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("span", {
1683
+ className: G["bsy-lexical__toolbar-select-label"],
1684
+ children: p
1685
+ }), /* @__PURE__ */ y(e, {
1686
+ name: "arrow-down",
1687
+ size: l,
1688
+ className: G["bsy-lexical__toolbar-select-arrow"]
1689
+ })] }),
1690
+ tooltip: n,
1691
+ showDisabledTooltip: r,
1692
+ disabled: t || s
1693
+ })
1694
+ });
1695
+ return t || s ? h : /* @__PURE__ */ y(f, {
1696
+ menus: d,
1697
+ onClick: m,
450
1698
  showSearch: !1,
451
- offset: fe,
1699
+ activeKey: [u],
1700
+ offset: W,
452
1701
  style: {
453
- width: 120,
454
- minWidth: 120
1702
+ width: "62px",
1703
+ minWidth: "62px"
455
1704
  },
456
- children: /* @__PURE__ */ M("div", {
457
- className: p["bsy-lexical__toolbar-select"],
458
- style: { width: 120 },
459
- children: /* @__PURE__ */ M(u, {
460
- icon: /* @__PURE__ */ N(ye, { children: [/* @__PURE__ */ M("span", {
461
- className: p["bsy-lexical__toolbar-select-label"],
462
- children: c
463
- }), /* @__PURE__ */ M(e, {
464
- name: "arrow-down",
465
- size: o,
466
- className: p["bsy-lexical__toolbar-select-arrow"]
467
- })] }),
468
- tooltip: i("editor.codeLanguage")
469
- })
470
- })
1705
+ children: h
471
1706
  });
472
- }, _n = {
473
- initial: {
474
- opacity: 0,
475
- x: 6
1707
+ };
1708
+ //#endregion
1709
+ //#region src/components/Editor/utils/clearInlineTextFormat.ts
1710
+ function Wr() {
1711
+ let e = R();
1712
+ if (z(e)) {
1713
+ kt(e, {
1714
+ "font-size": null,
1715
+ color: null,
1716
+ "background-color": null
1717
+ });
1718
+ for (let t of e.getNodes()) Ae(t) && t.setFormat(0);
1719
+ e.setFormat(0);
1720
+ }
1721
+ }
1722
+ //#endregion
1723
+ //#region src/components/Editor/ToolbarPlugin/Buttons/ClearFormatButton.tsx
1724
+ var Gr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
1725
+ let [r] = B(), { t: i } = a();
1726
+ return /* @__PURE__ */ y(q, {
1727
+ icon: "clearTree",
1728
+ tooltip: t ?? i("editor.clearFormat"),
1729
+ showDisabledTooltip: n,
1730
+ disabled: e,
1731
+ onClick: () => {
1732
+ K(r), r.update(() => {
1733
+ Wr();
1734
+ });
1735
+ }
1736
+ });
1737
+ }, Kr = /<!--bsy-code-(\d+)-->/g, qr = [
1738
+ "quick",
1739
+ "formal",
1740
+ "colloquial",
1741
+ "lively",
1742
+ "literary",
1743
+ "retro"
1744
+ ], Jr = {
1745
+ quick: "editor.aiPresetQuick",
1746
+ formal: "editor.aiPresetFormal",
1747
+ colloquial: "editor.aiPresetColloquial",
1748
+ lively: "editor.aiPresetLively",
1749
+ literary: "editor.aiPresetLiterary",
1750
+ retro: "editor.aiPresetRetro"
1751
+ };
1752
+ //#endregion
1753
+ //#region src/components/Editor/utils/htmlText.ts
1754
+ function Yr(e) {
1755
+ return /<[^>]*$/.test(e.trim());
1756
+ }
1757
+ function Xr(e) {
1758
+ return e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "";
1759
+ }
1760
+ //#endregion
1761
+ //#region src/components/Editor/utils/fillRootFromHtml.ts
1762
+ var Zr = [
1763
+ "color",
1764
+ "background-color",
1765
+ "font-size",
1766
+ "font-family",
1767
+ "font-weight",
1768
+ "text-decoration"
1769
+ ], Qr = (e) => {
1770
+ let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
1771
+ for (let n of Array.from(t)) {
1772
+ let t = n, r = [];
1773
+ for (let e of Zr) {
1774
+ let n = t.style.getPropertyValue(e);
1775
+ n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
1776
+ }
1777
+ if (!r.length) continue;
1778
+ let i = r.join("; ");
1779
+ for (let n of Array.from(t.childNodes)) {
1780
+ if (n.nodeType === Node.TEXT_NODE && n.textContent) {
1781
+ let r = e.createElement("span");
1782
+ r.setAttribute("style", i), t.insertBefore(r, n), r.appendChild(n);
1783
+ continue;
1784
+ }
1785
+ if (n.nodeType === Node.ELEMENT_NODE) {
1786
+ let e = n, t = e.getAttribute("style");
1787
+ e.setAttribute("style", t ? `${t}; ${i}` : i);
1788
+ }
1789
+ }
1790
+ }
1791
+ }, $r = (e, t) => {
1792
+ let n = L();
1793
+ if (n.clear(), t.trim()) {
1794
+ let r = new DOMParser().parseFromString(t, "text/html");
1795
+ Qr(r);
1796
+ let i = ge(e, r);
1797
+ if (i.length) {
1798
+ n.select(), Te(i), Ne(null);
1799
+ return;
1800
+ }
1801
+ }
1802
+ let r = ye();
1803
+ n.append(r), Ne(null);
1804
+ };
1805
+ //#endregion
1806
+ //#region src/components/Editor/utils/isEmptyEditorHtml.ts
1807
+ function ei(e, t) {
1808
+ return !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e));
1809
+ }
1810
+ //#endregion
1811
+ //#region src/components/Editor/utils/sanitizeEditorHtml.ts
1812
+ var ti = /* @__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("."), ni = [
1813
+ "href",
1814
+ "src",
1815
+ "alt",
1816
+ "title",
1817
+ "target",
1818
+ "rel",
1819
+ "colspan",
1820
+ "rowspan",
1821
+ "data-language",
1822
+ "data-id",
1823
+ "class",
1824
+ "style",
1825
+ "width",
1826
+ "height"
1827
+ ], ri = 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.position.top.bottom.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), ii = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, ai = new Set([
1828
+ "pre",
1829
+ "code",
1830
+ "td",
1831
+ "th"
1832
+ ]), oi = new Set(["pre", "code"]), si = new Set(["sup", "sub"]), ci = (e, t) => ri.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? ai.has(t) : e === "border-radius" ? oi.has(t) : e === "position" || e === "top" || e === "bottom" ? si.has(t) : !0 : !1, li = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
1833
+ let n = e.indexOf(":");
1834
+ if (n === -1) return null;
1835
+ let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
1836
+ if (r === "background") {
1837
+ if (/url\s*\(/i.test(i)) return null;
1838
+ r = "background-color";
1839
+ }
1840
+ return !ci(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
1841
+ }).filter((e) => e !== null).join("; "), ui = !1, di = () => {
1842
+ ui ||= (Xt.addHook("uponSanitizeAttribute", (e, t) => {
1843
+ if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
1844
+ t.keepAttr = !1;
1845
+ return;
1846
+ }
1847
+ t.attrName === "style" && (t.attrValue = li(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
1848
+ }), !0);
1849
+ };
1850
+ function X(e) {
1851
+ return e ? (di(), Xt.sanitize(e, {
1852
+ ALLOWED_TAGS: ti,
1853
+ ALLOWED_ATTR: ni,
1854
+ ALLOW_DATA_ATTR: !1,
1855
+ ADD_ATTR: ["data-language", "data-id"],
1856
+ ALLOWED_URI_REGEXP: ii
1857
+ })) : "";
1858
+ }
1859
+ //#endregion
1860
+ //#region src/components/Editor/utils/stitchCodePlaceholders.ts
1861
+ var fi = "bsy-html-root";
1862
+ function pi(e) {
1863
+ return new DOMParser().parseFromString(`<${fi}>${e}</${fi}>`, "text/html").body.querySelector(fi);
1864
+ }
1865
+ function mi(e, t) {
1866
+ if (!t.length) return e;
1867
+ let n = /* @__PURE__ */ new Set(), r = e.replace(Kr, (e, r) => {
1868
+ let i = Number(r), a = t[i];
1869
+ return a === void 0 ? "" : (n.add(i), a);
1870
+ }), i = t.filter((e, t) => !n.has(t)).join("");
1871
+ return i ? `${r}${i}` : r;
1872
+ }
1873
+ function hi(e, t) {
1874
+ return mi(gi(e), t);
1875
+ }
1876
+ function gi(e) {
1877
+ if (!/<pre[\s>/]/i.test(e)) return e;
1878
+ let t = pi(e);
1879
+ if (!t) return e;
1880
+ let n = t.ownerDocument;
1881
+ for (let e of Array.from(t.querySelectorAll("pre"))) {
1882
+ let t = n.createComment("bsy-code-dropped");
1883
+ e.replaceWith(t);
1884
+ }
1885
+ return t.innerHTML.replace(/<!--bsy-code-dropped-->/g, "");
1886
+ }
1887
+ //#endregion
1888
+ //#region src/components/Editor/constants/portableEditorStyles.ts
1889
+ var _i = {
1890
+ margin: "0.6em 0 0.4em",
1891
+ "font-weight": "600",
1892
+ "line-height": "1.35"
1893
+ }, vi = {
1894
+ h1: {
1895
+ ..._i,
1896
+ "font-size": "2em"
476
1897
  },
477
- animate: {
478
- opacity: 1,
479
- x: 0
1898
+ h2: {
1899
+ ..._i,
1900
+ "font-size": "1.5em"
480
1901
  },
481
- exit: {
482
- opacity: 0,
483
- x: -6
1902
+ h3: {
1903
+ ..._i,
1904
+ "font-size": "1.25em"
1905
+ },
1906
+ h4: {
1907
+ ..._i,
1908
+ "font-size": "1.125em"
1909
+ },
1910
+ h5: {
1911
+ ..._i,
1912
+ "font-size": "1em"
1913
+ },
1914
+ h6: {
1915
+ ..._i,
1916
+ "font-size": "0.875em"
1917
+ }
1918
+ }, yi = {
1919
+ color: "#0269ff",
1920
+ cursor: "pointer"
1921
+ }, bi = {
1922
+ margin: "0",
1923
+ "padding-inline-start": "24px",
1924
+ "list-style-position": "outside"
1925
+ }, xi = [
1926
+ "disc",
1927
+ "circle",
1928
+ "square"
1929
+ ], Si = {
1930
+ margin: "0",
1931
+ "list-style": "inherit"
1932
+ }, Ci = {
1933
+ margin: "0",
1934
+ "list-style-type": "none"
1935
+ }, wi = {
1936
+ display: "block",
1937
+ "box-sizing": "border-box",
1938
+ "max-width": "100%",
1939
+ margin: "8px 0",
1940
+ padding: "8px 12px",
1941
+ "overflow-x": "auto",
1942
+ "font-family": "Menlo, Consolas, Monaco, monospace",
1943
+ "font-size": "13px",
1944
+ "line-height": "1.53",
1945
+ "white-space": "pre",
1946
+ "tab-size": "2",
1947
+ "border-radius": "4px",
1948
+ "background-color": "rgb(240, 242, 245)",
1949
+ color: "#1f2328"
1950
+ }, Ti = {
1951
+ "border-collapse": "collapse",
1952
+ "table-layout": "fixed",
1953
+ width: "100%",
1954
+ "overflow-x": "auto",
1955
+ margin: "8px 0"
1956
+ }, Ei = {
1957
+ "box-sizing": "border-box",
1958
+ "min-width": "75px",
1959
+ "min-height": "32px",
1960
+ padding: "4px 8px",
1961
+ border: "1px solid #d9d9d9",
1962
+ "vertical-align": "top"
1963
+ }, Di = {
1964
+ "font-weight": "600",
1965
+ "background-color": "#f2f3f5"
1966
+ }, Oi = {
1967
+ display: "inline-block",
1968
+ position: "static",
1969
+ top: "auto",
1970
+ bottom: "auto",
1971
+ "font-size": "0.75em",
1972
+ "line-height": "1"
1973
+ }, Z = (e, t) => {
1974
+ for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
1975
+ }, ki = (e) => {
1976
+ let t = 0, n = e;
1977
+ for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
1978
+ return t;
1979
+ }, Ai = (e) => {
1980
+ for (let t of Array.from(e.querySelectorAll("*"))) {
1981
+ if (!(t instanceof HTMLElement)) continue;
1982
+ let e = t.tagName.toLowerCase(), n = vi[e];
1983
+ if (n && Z(t, n), e === "a" && Z(t, yi), e === "ul") {
1984
+ let e = Math.min(Math.max(ki(t), 1), xi.length);
1985
+ Z(t, {
1986
+ ...bi,
1987
+ "list-style-type": xi[e - 1]
1988
+ });
1989
+ }
1990
+ e === "ol" && Z(t, {
1991
+ ...bi,
1992
+ "list-style-type": "decimal"
1993
+ }), e === "li" && Z(t, t.classList.contains("editor-nested-listitem") ? Ci : Si), e === "pre" && Z(t, wi), (e === "sup" || e === "sub") && Z(t, {
1994
+ ...Oi,
1995
+ "vertical-align": e === "sup" ? "super" : "sub"
1996
+ }), e === "table" && Z(t, Ti), (e === "td" || e === "th") && (Z(t, Ei), (e === "th" || t.classList.contains("editor-table-cell-header")) && Z(t, Di)), t.classList.contains("editor-text-underline-strikethrough") ? Z(t, { "text-decoration": "underline line-through" }) : t.classList.contains("editor-text-underline") ? Z(t, { "text-decoration": "underline" }) : t.classList.contains("editor-text-strikethrough") && Z(t, { "text-decoration": "line-through" });
1997
+ for (let e of Array.from(t.classList)) e.startsWith("editor-") && t.classList.remove(e);
1998
+ t.classList.length === 0 && t.removeAttribute("class");
1999
+ }
2000
+ }, ji = (e) => {
2001
+ let t = e.parentNode;
2002
+ if (t) {
2003
+ for (; e.firstChild;) t.insertBefore(e.firstChild, e);
2004
+ t.removeChild(e);
2005
+ }
2006
+ }, Mi = (e) => {
2007
+ let t = !0;
2008
+ for (; t;) {
2009
+ t = !1;
2010
+ for (let n of Array.from(e.querySelectorAll("span, b, i"))) {
2011
+ if (n.attributes.length > 0) continue;
2012
+ let e = n.tagName.toLowerCase();
2013
+ if (e === "span") {
2014
+ ji(n), t = !0;
2015
+ continue;
2016
+ }
2017
+ if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
2018
+ let r = n.firstElementChild;
2019
+ (e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (ji(n), t = !0);
2020
+ }
2021
+ }
2022
+ };
2023
+ function Ni(e) {
2024
+ if (!e.trim()) return e;
2025
+ let t = new DOMParser().parseFromString(e, "text/html");
2026
+ Ai(t.body), Mi(t.body);
2027
+ for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
2028
+ return t.body.innerHTML;
2029
+ }
2030
+ //#endregion
2031
+ //#region src/components/Editor/utils/applyAiPolish.ts
2032
+ var Pi = "<!--bsy-block-->";
2033
+ function Fi(e) {
2034
+ return e.join(`\n\n${Pi}\n\n`);
2035
+ }
2036
+ function Ii(e) {
2037
+ return e.includes("<!--bsy-block-->") ? e.split(Pi).map((e) => e.trim()) : [e];
2038
+ }
2039
+ function Li(e) {
2040
+ return e.split(Pi).join("").trim().length > 0;
2041
+ }
2042
+ function Ri(e, t) {
2043
+ let n = e.map(() => "");
2044
+ if (e.length === 0) return n;
2045
+ let r = [], i = [];
2046
+ if (e.forEach((e, t) => {
2047
+ for (let n of Array.from(e)) i.push(n), r.push(t);
2048
+ }), i.length === 0) return n[0] = t, n;
2049
+ let a = i, o = Array.from(t), s = a.length, c = o.length, l = Array.from({ length: s + 1 }, () => Array(c + 1).fill(0));
2050
+ 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]);
2051
+ let u = 0, d = 0, f = r[0];
2052
+ 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);
2053
+ for (; d < c;) n[n.length - 1] += o[d], d += 1;
2054
+ return n;
2055
+ }
2056
+ var zi = new Set(["PRE"]), Bi = new Set([
2057
+ "PRE",
2058
+ "TABLE",
2059
+ "THEAD",
2060
+ "TBODY",
2061
+ "TR",
2062
+ "TD",
2063
+ "TH",
2064
+ "IMG",
2065
+ "BR"
2066
+ ]);
2067
+ function Vi(e) {
2068
+ let t = [], n = (e) => {
2069
+ if (e.nodeType === Node.ELEMENT_NODE) {
2070
+ let t = e.tagName;
2071
+ if (zi.has(t)) return;
2072
+ for (let t of Array.from(e.childNodes)) n(t);
2073
+ return;
2074
+ }
2075
+ e.nodeType === Node.TEXT_NODE && t.push(e);
2076
+ };
2077
+ return n(e), t;
2078
+ }
2079
+ function Hi(e, t) {
2080
+ let n = e;
2081
+ for (; n && n !== t && !Bi.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, pre, table, br");) {
2082
+ let e = n.parentElement;
2083
+ n.remove(), n = e;
2084
+ }
2085
+ }
2086
+ function Ui(e) {
2087
+ let t = e.tagName;
2088
+ return t === "PRE" || t === "IMG" || t === "TABLE";
2089
+ }
2090
+ function Wi(e) {
2091
+ let t = pi(e);
2092
+ return t ? Array.from(t.children).filter((e) => !Ui(e)).map((e) => e.textContent ?? "") : [];
2093
+ }
2094
+ function Gi(e) {
2095
+ return e.includes("<!--bsy-block-->") ? e : Xr(e) || e;
2096
+ }
2097
+ function Ki(e, t) {
2098
+ let n = Vi(e);
2099
+ if (n.length === 0) {
2100
+ t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
2101
+ return;
2102
+ }
2103
+ let r = Ri(n.map((e) => e.textContent ?? ""), t);
2104
+ for (let t = 0; t < n.length; t++) {
2105
+ let i = r[t], a = n[t];
2106
+ if (i) {
2107
+ a.textContent = i;
2108
+ continue;
2109
+ }
2110
+ let o = a.parentElement;
2111
+ a.remove(), Hi(o, e);
484
2112
  }
485
- }, vn = (e, t, n) => {
2113
+ }
2114
+ function qi(e, t) {
2115
+ let n = Gi(t);
2116
+ if (!Li(n) || !e.trim()) return "";
2117
+ let r = pi(e);
2118
+ if (!r) return "";
2119
+ let i = Array.from(r.children).filter((e) => !Ui(e));
2120
+ if (i.length === 0) return "";
2121
+ let a = Ii(n), o = a.length === i.length ? a : Ri(i.map((e) => e.textContent ?? ""), a.join(""));
2122
+ for (let e = 0; e < i.length; e++) Ki(i[e], o[e] ?? "");
2123
+ return r.innerHTML;
2124
+ }
2125
+ function Ji(e, t) {
2126
+ let n = "";
2127
+ e.getEditorState().read(() => {
2128
+ n = Ni(X(he(e, null)));
2129
+ }, { editor: e });
2130
+ let r = X(qi(n, t));
2131
+ return !r.trim() || ei(r, Xr(r)) ? !1 : (e.update(() => {
2132
+ $r(e, r), Dn(!0);
2133
+ }, { discrete: !0 }), !0);
2134
+ }
2135
+ //#endregion
2136
+ //#region src/components/Editor/utils/extractCodePlaceholders.ts
2137
+ function Yi(e) {
2138
+ if (!e.trim()) return {
2139
+ html: e,
2140
+ blocks: []
2141
+ };
2142
+ let t = new DOMParser().parseFromString(e, "text/html"), n = [], r = Array.from(t.body.querySelectorAll("pre"));
2143
+ for (let e of r) {
2144
+ n.push(e.outerHTML);
2145
+ let r = t.createComment(`bsy-code-${n.length - 1}`);
2146
+ e.replaceWith(r);
2147
+ }
2148
+ return {
2149
+ html: t.body.innerHTML,
2150
+ blocks: n
2151
+ };
2152
+ }
2153
+ //#endregion
2154
+ //#region src/components/Editor/utils/readEditorAiSnapshot.ts
2155
+ function Xi(e) {
2156
+ let t = "", n = "", r = "";
2157
+ e.getEditorState().read(() => {
2158
+ n = L().getTextContent(), t = Ni(X(he(e, null))), r = Fi(Wi(t));
2159
+ }, { editor: e });
2160
+ let i = Yi(t);
2161
+ return {
2162
+ html: t,
2163
+ text: n,
2164
+ polishText: r,
2165
+ htmlWithoutCode: i.html,
2166
+ codeBlocks: i.blocks
2167
+ };
2168
+ }
2169
+ //#endregion
2170
+ //#region src/components/Editor/Preview/preview.module.scss
2171
+ var Q = {
2172
+ "bsy-lexical-ai__trigger": "_bsy-lexical-ai__trigger_p7v4i_1",
2173
+ "bsy-lexical-ai__icon": "_bsy-lexical-ai__icon_p7v4i_4",
2174
+ "bsy-lexical-ai__dialog": "_bsy-lexical-ai__dialog_p7v4i_11",
2175
+ "bsy-lexical-ai__pane": "_bsy-lexical-ai__pane_p7v4i_16",
2176
+ "bsy-lexical-ai__column": "_bsy-lexical-ai__column_p7v4i_22",
2177
+ "bsy-lexical-ai__column-head": "_bsy-lexical-ai__column-head_p7v4i_32",
2178
+ "bsy-lexical-ai__column-title": "_bsy-lexical-ai__column-title_p7v4i_39",
2179
+ "bsy-lexical-ai__column-title--before": "_bsy-lexical-ai__column-title--before_p7v4i_53",
2180
+ "bsy-lexical-ai__column-dot": "_bsy-lexical-ai__column-dot_p7v4i_57",
2181
+ "bsy-lexical-ai__column-title--after": "_bsy-lexical-ai__column-title--after_p7v4i_60",
2182
+ "bsy-lexical-ai__column-stack": "_bsy-lexical-ai__column-stack_p7v4i_73",
2183
+ "bsy-lexical-ai__column-body": "_bsy-lexical-ai__column-body_p7v4i_79",
2184
+ "bsy-lexical-ai__think-pin": "_bsy-lexical-ai__think-pin_p7v4i_86",
2185
+ "bsy-lexical-ai__think-head": "_bsy-lexical-ai__think-head_p7v4i_90",
2186
+ "bsy-lexical-ai__think-label": "_bsy-lexical-ai__think-label_p7v4i_109",
2187
+ "bsy-lexical-ai__think-label--shimmer": "_bsy-lexical-ai__think-label--shimmer_p7v4i_113",
2188
+ "bsy-lexical-ai-think-shimmer": "_bsy-lexical-ai-think-shimmer_p7v4i_1",
2189
+ "bsy-lexical-ai__think-arrow": "_bsy-lexical-ai__think-arrow_p7v4i_124",
2190
+ "bsy-lexical-ai__think-arrow--open": "_bsy-lexical-ai__think-arrow--open_p7v4i_131",
2191
+ "bsy-lexical-ai__think-icon": "_bsy-lexical-ai__think-icon_p7v4i_134",
2192
+ "bsy-lexical-ai-think": "_bsy-lexical-ai-think_p7v4i_1",
2193
+ "bsy-lexical-ai__think-collapse": "_bsy-lexical-ai__think-collapse_p7v4i_146",
2194
+ "bsy-lexical-ai__think-collapse--grown": "_bsy-lexical-ai__think-collapse--grown_p7v4i_151",
2195
+ "bsy-lexical-ai__think-body": "_bsy-lexical-ai__think-body_p7v4i_155",
2196
+ "bsy-lexical-ai__footer": "_bsy-lexical-ai__footer_p7v4i_165",
2197
+ "bsy-lexical-ai__error": "_bsy-lexical-ai__error_p7v4i_173",
2198
+ "bsy-lexical-ai__preset": "_bsy-lexical-ai__preset_p7v4i_178"
2199
+ }, Zi = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAADNBJREFUeAG1WuuvXUUV/619dqEPaG+pUFqg3AKFIoFWkKeKLWLRaKD6vVGMMcYQC8EPmBge/4A0fpEQEkmMz0QjH8CoIa3WUGwQ2oAiFWiFthb77qXvy1nOY83MWrP3qY2hk3vu3mfPzJr1+K3HzD6EqrXf5GVg3MPASncdd4+YCMTsvgHk7sEcx/r71Hy/H6e+Q49Nj/00RTPTSfOreXpNPcfw4q6b3GXTFMJjx56gbXrBzNDY/Tx2+DgecQ9WG96psCVCJqZILcqum1gtDM7CyMOusJlhP5ZEcKFDijdGpYg4prCmFD1krJlxNh47sIYOZAG9cCcmsdbdLmVYZhMj2jJ9FqkE1yPYjCCQ0pkhZHSalFdWybIwzH1RmAjeNM6aDZZ7IVvfM8l4ZDBwwhVN6sVIM8MVsTQm94UV4q2MISWoZaorhFkXfQqoeSx0tcWXDoFH3O0DNPYQj+MEtnJli5GQUlTo1LA1nDIsbS1TR0AF77BGZ7CaXrmD4sUrennbfOAkbawzF9ag2LKISg+bbh80Y1QGm2DVO54z04R+VzBT9H+1jqa5sh00WIKu9JSALjSowj1Vy3egXXOiAkUdlCLBJgwzUdKyFAKIiQfod2VtmLu9gB8zXgLLKidpklblv4mgKrqpcX1yjn5mwmI/jabHimHtYQw8SXjlXgvbZiAdrMhDBEkCa7xnETOMyOiMsmJ0yC/jOM8K9wILUgpSdi0jb10IumUceHxtXioruGmFTzb8h2vbtpFRkZqyNQvDQVC3OhNLkJF7pQSlU9T2CHSzDqgOlpEtE5alLyd991lwHvDgHSEFYM26KECA+DDAOyqKuyhpGxvSI+NNWDZpkwzrKH1h/QbqcRSYipropoXgFYuAFYuBmVPDhw4dA/6+C/jVZuD3W4BDR8Xv+3wqrkULZscHDywDbh0HXvwXsP0AaMdB4C/vyMweWLftIFtCR4OSU1hhmjKMsuUYHSjmtvgC4Oerulr1gnq4+c/qg6C7nwImjlfrWrp0zbwyP8317fl/gl/artZIiJN5Psj0O7fygGxZJRwL6qkISkRKKe76tZvxP9vFs4C7nHV//ZogSSOGol6/cgNw55Xdud56Dz0LckUKS64MXAmqgpDtoBViSnVJg6HDwjQLYkI9ST5nRcJ9u2kBCKfRvnwd8MzrJWcSFZ+aPxO475PdOd7iX/0FcORk8EuSSG8QFywYoigkwGgRSWnTLyhBxVgMJiea2HrP1aCLZuG02o2XALOngQSmkWZECn/2KtCWPcC5ZwNXnV/m7DwE7HrfCTdArxaTkiNEJbAkhqkqU9hcJJAACb5pgRT1wvUzi9Db3thtGU1t5bXAT142/h7az1wg+umm+H2mE/KxFcDyy5yAEy6ADExg08KVwtsHGYfhMNhfHWR9XnEd7jqIYTmMaeI4GYPU5xXkx+a57vslY46Jy7tCeAt9fz16m2e6bYXmoFpziqPvnh+eBH/nWeDJjc56E4W3NvLDmT/3zH8Pff4GXKCltJGgKPYpkTNYmoolWRcBrt24oF+IP24FXtkVBfWQ081bdda0HE1LoxILkls89RIw/9xswRzsuOLNP2+8loL1/FU01pQPi2U5aLMRK8n4NDYhIKHgi4v7BfztlkjruS3dPi+wt3peL1kjoUS+J7T854iymkJXGEfyvfGW7E5mESiZGlq4rJAieCbs5180Br5+flcAHxA2vxdp/vmdfgV84arMS2a4LfdRGMqKjUoXnhutkDbzB58m2FQtVMFDp4iqnNKb1QTVZeP9zL/y77igb2/vB94/AZxzlh2zaI6D6dTYp3kQ6OXdvL93FVosuBx/D90OPP2KU+Jhy6+/81HUpnkuohLMxjWVdJ19V6Lg/z63qD/3/eHtKKAnevQD4C0n5JK5dowX+Mrzg6X1QUeptNID71vpi2ufujR+3twHenitVVDKgzlYJA11ONQJXwUkPeTy2aArzuvMDAu+ujtCPDm/E5hqAROzr+1W1Yy6+n9DDpVKprPqWlBCwgvbnfKGAbKZr3YwsAWgG0wP3x79ZYObcMEM4LoLYkh+4q/KvigKTdPvugK9bcOO6BthrJwe+Gd9bYVLF0++jJHZu4lU8lbt+W1gr5AHb3FF9868ThzNPoUMLLNHZSPrNAP/Se3xjdG5Aw5lB+JrAwnJ4cFtF/fDc6uD47yZGd7Zz992B3uXjdmx3hpL50WLK/UVR0G+81sl2u12JnvcbuS7Dpp7jhXrsaS7DFGp/QIJr4lrq2pj464YtToLSQ5cOBs8dwZ62zeuj5/TbR66f9tniu8+xREGJTc64UIE1rWjb23blISeSq6m6VJLuUaXQZrQnZf2W+//abdcBPzyDVU66EDHvfFBnz4UHn0t6oVJu+Z0CnTzvP5F171bIKZwHabePB8fWls4Kyb+I5PWyTkGmLKjS+ZTwVEHST8u5EHZ6gTGp09xgWU68NxWt+veB8xw/R+/EOR9Zf0OKYMAFcNBH5ka53yY7Y5LIw/ZXFqj8Xssz0jtVTVjMitCVBn9uMugq/9UCHkB1u+M96FuVduotJCz3kh4bjsULTGqnT8tfup2k0PR795VfkjqVEGOMXQ+1gpn9T0W21D5TR8QpUveD+Womed4gjfO7WfeR7fvvaiUX4ri7Md3ucJ8VU/tOj5TYHrSKE+vm9EEFGtajqWSUeeIlGoiVo5bCpWOwjyE6eqe5O7b6/ul4re+Au0rm/a6ZN0TJae7evKymaDXD4hQmj+UfSAA8yoAFar9sWHpFEY4aaGRLoEEbJUTIPLRORjZHPNQ27G0DBVAgPefAPkQ7/24bjc4ZGyZKMwyYM/Qk0TU6csBp/EMpI1r2rCmyr1t1FZE7n1/05StyoyzRgv41oTaVjVS/cfKP60ZdgMb3uuf/4kLy06mqXkpOxrbJxtdatLOxx7YJD3nkkqtZyJ2eviqg+FeZ4E5lQW2uBMv9zhUFvlQWXm7Cna01m2Cb5vbpeFbShc1N8mHEz8J+pBU0iTi39rAw9xZZndfWxbJuIF9QTrnbNB17mD2Eqlk9rpd+WaXYrYfiVMUMwZieQEOwvHyeaDpsqVyc/lFV2M64QwPOc/ppC9lW3YvxRvdt5GHVPaDOdLB5pO+94WnbtV89B/zj6pMimKsijtR0tDq3iHnwZ63Q2xYTeGdBB5JVZQDj5nF9fsLfeqjAlVHEUrwhBbTI9wILHTl0ksrF9uAYYFQEy4LpCzIPFTvIaQvHbgqRAT9wVYd/Y2qlyhabWxgWaAJdBWkBZT9IDMbZplVjsnVkaogwnFFk8s8KIYoi6tZl//M6JxjpjVhgaiLykitKX0yOq5dbQ5y3uX08sWSNxjKBLgLQ5A2UhyjIFsUg55CAnYcwSpXH10qxs3bLDUXnUApi7eDemuk4JDgFi5yTCDZ3hToU91n8bmKQuHM/p4FnbiVU4XhQP75s5utR2J9nPnuK7Lt266iKcjLF/n5SHLasCNJRc2wrEg90MEsN/9e925hrMUZaQfcy5Wnd7iK52Q5N8oKE/8eshEqu7//3oZXT2yzgH47Y19P5HyWNf6lC8+ccL6Nue3byrmgH+8quVmEzOhokOOCxKisBXeYTYL3FDwgWmpKoEHlCxpq49NwxptfY6BgJS3xR0YwVS0hQHSQmY7zBYgqimpBkZ6lMQcnI0zPZPNrND4YDov/JJdJ/KV3F7DFBWUBUZzb5JgsKAruff6TaMgvTIA+PxtntK2biIWzHFeQYphR3CkHSB1ofJowL0UJlWCDnNCzbrgpaeEfJ8B73YnyNa5QPkvZuYqYJpLWbVSedufF/OYx0LvH5cgSJWcrGGoCpHOiH9s2JQ/q1GzCtvxMg1SyyXD2i+110Fl/pDCrI5oRRPuQzR8ZHNzDhxz5Z9LGErDKzBFUihJvwW3sf/iqy6BuEVz7Zgk+KeF1fffUxbk1cZmD8lze1RfB1VhDqvihDTyMzd4Hn3FEVhPMIY7RlGKYKsYN6nRfJzilGhYg4w9KCX58I3iSV+FlL2mNhFFCKp783E30wwle5jaHa1PQ0D9GUEKl43nSYmn/1s9HNaHfx2Q9M+8bNU8mDnA13io6zBlOYmF4+NQEr3HH4N9WNWBK/lDs6A0mdGJVkMLQ5iq7eNfviu/XfWn3UI+B6pd7sTybgmaIH3z9HLo/ZLDBOXiUTuDTbsQSIVUzFIMAqWCjRVeaa6xKyj1B66YewyaPFTat8F216ViRBXb/N2MaHoWe9iPmscFk+Bnw/Yp9eywAVRKp/VmPcxiWSogcna/UOP3GGXWq6RAvqog3znLDKXj0XlI/StfNCTo+ZegEJSx11lhSa1XxmbYpdDoJT+/RRlqlh/+6PFPQpaITbBsSfsOTeGbVFFqnif0XGylI3w1jW9QAAAAASUVORK5CYII=", Qi = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACb9JREFUeAHtW09sHFcZ/739Y9nxJt4WQv8g1WO1ICQOXquiqAeU3Z6QENhWhUThYPsCpAVsl1RqeiBrCQhIiBqlLVWRakccegDJTi8gkLobLkTlYPuAesObXJB6aDZq0rSOd79+b+b9m9lZe707jp3Kv3Y7M2/evHnf733/3jcucIQjHOEIR0gO/XPk4R5CCgkiz8Ify6Jy8gUq4B5BsgR8Dt6JHLzBHNYe+yXN4R5ABgkiz8JDmMvfP36Bxvlyk8+vpdJY3/oE1fV5UcchQrIE5DEqj8T/suCCj6cgf8S0CFTffVas4pAhMQK+u0KFTwizUmqG1gPBTBD/U9vawkzcc4NzVMgCtfriwWhGIgT8+N/kfXQLKwPygiI3pfANPPX206IW9+wXT2JCZDD+2AWaFynU//OcWMddRM8ElNcof72BSvY4PCHC9yQX7GUv/+GJeOElHn0U440GCqwz72zdwQI33WMEjIk6kzC2NQCv2USeSSiww5tNpTCsCLja7tlnr9BsYxsFyVuzgY03TokF3GUI7APOb5KX6cMKq3SB1WDyzMPtnV95k/I8ibm+NApnHxET0fucW+Q/vIUJJnOI+1z6+PX22tQN9oUAjTc+pMVGBqunB0R1t75Lt8mbGbDCScE/2sIsn86BNcu6VZS3XktOU/aVgG4x8DOaTRHKRCx4AD+Q8jWxiQk2sdLNxd1J7QSJ5gES+TLlUeeJ83/r5b2FtvwZKlIDSyyo5zS7cUUvmDSVKhJAogTc/wLN4ibKPGqej/J6nVesxgJVedU2cv1Yr8WQ8vkXfcHPcb8i0n6TFNoXltSZo6oyrxhCQkjMBB58iabZk78pR5STlqrqT1UYQUjJUWfnKEOdH+6awCgnT6XQYEZ8dUmBFqgxJdbf/60YQwJITAPSKQ59QosLq7gCwZpZSLsucntR6G4BYWa1o8/6zcLvgiZf83s8JITENGC4TNdlqJJrLtPfYNk7GF+vqdPXf16PE+gQ6Z56bM4v7q+Ve0+fk9OANGp8KKgFjBfcGoXViHiSRNxRaYBgEyLOCaQmHR4CMhls8CFaCIlYM6xn6BJpNU4z5b+rhh6RpAassZFOmQYW1HeGWnnlygV2bvyEr9H22vUAliCj/GpU3UwYRgJIjgCBDQ51UWdmVVgJ6du2fUyEhFPRg1yhgzFEyDkGGEECiCUg9xMqiiyG04TLvE+vyTZZ7+OQNcHOZ1W3hQbKYD2Viax0K9w2TZNw7lKINDiERu5z+ygSQKwtemXyKChlyRfJeJ2X2Rn/6tcWxH3tBnviVdqEClHRBVPXRhRXMO3hjKARzxGNrPo+h8PSldO9pcSxGsDhpfb116gmheFJjQqlgNTE5Ws7DZb1yfJgZ06c6ZiVlAeKukUJx0+o54JW5zpEgjWRpeISlaoz3e8Q2/qAB76AS/ySWbihiFDBToNleO9vJxc8l47x+jGxPySk9gWw/Rzfos1MkilrEO8wCU91S0JbAh56EKMU9sByUjs6HukHEKkJwjlxEhwYZ6gF0vVDuGkPoiS5PkCblCcX5ptvUenvz+ydhJ004JSaiJkQz3gccn/eBhwKh4Q7UWG9vrA8+EeXDMAhAY647lhBgxmLwg5TmmpXJMQS8PotGt/ewo3GHVzkguYqhzePOxa5yvOdP14n7/R98S/JZv0KkJmpWeGmUmFlvZoMirg7x3GafuSwQqIljNp9BPy8oDKxQqXVyc5JiI0CK0T5SRGfZ/NmPT8Tc49fLO3xf8KJ/+GwHU6DtckbEtwV1dFBhLMjZyRjKNEIwdc1TpUnmYSOiqsCCeHpt0kWMqbUoCaZEW72pg/KqcXlfmrrK/Sz5NqEGzrtthtW2YL+3FbnnKT0l2/tTkIimeD3/uav/pTrrY2au4JE9gEtSQ4C5yiPWvUp2q5vOeSq0OhGiiHu/zKflXabeyIEcBp8jv1ESJuieQyFnRmCOYd8QFgprHTCURRy/IvbX7hEqXtFdICeCZiucNbYwDShRd1tJHBSXrOCStGDDAvGKfjnvN0VTfNZTZhM0QptVd6OJ4Q1I98MOpl/zwTw6i/JUSji4JRamqwuNFl1T0RVQSiLCPb81i/AFkhAlkzYwot9lSWhow+xPRHww3/RBE+6qK9JRQA1EWOfQll4JOaHbAFO9uj4Ba0Vtn84TsZslP2iSXVwG/PoAD0RwHmBdDQkqDXB8Sdp7dJENv2faL/QM2RzBfd9rtKYNjdT5e+QnLss/OkbnW+QuiZg7l0qkFOcpHCaGlbV6KSDg7Fnx5uRm0O4TtF9T6heGNyu8jfGhVee3PvOsGsCOOuTJW04zs+dp4gIE05+nKX0fUfK72sSG4ostXURamwYYnzBF7/W/Za4awLucMbFhcm6H3NhHRWM9ZukJJgsOTmBGzHshdufRMgrWGVQ0eVSqoH534z1/qFUoAe89B5N84yW9EiOl7d22WY3F2oD3DqxGQuRnZ9PImHh118VZSSEngiQKL/HeUDarxsUeJLyU7epDIugMLrrO0L9AgadZDKE5YUvixl5Ir8e397CFHt8Ly0/m7/SnRn0TEAc+Jt/AdvIpzNct2tCltBG2c5HeRlHIl3DPs5qCLmJjSYow/WIsyOqRvk8rfDD48Fj/MU4hfkPficWsUfsCwHt8KtNmuaJnuNTb4c3682SLRkGNC2ffSRYfa5ZFhpNrJlIoU4yaUzXzomL2APuKgES5/9PHlebK8L5BK6EDRwdRdyewnaKV/+hYPW/cp48keaiLUX68TkTPP3fM52TcNcJkHiZSeBaYQWKBC2HIcLdIQaErM4/ICbdMR6/QMv8QXZKxddQbsBb4ekrP+qMhAMhQEKSwJnkGmD+CsSgxXk2UfrpyVYnx8XQZV7xKUB7DqMPN9j/lP75g93rAQdGgMSrN6kgGmwO8P/gIZTwGScoUD19QpTajfHtv1KF+50CQTgjyHB8oy/FRZFdKkOJ/rH0XvFcTqxnuXzF1WTBP/g//ryWzQSZJh+J7y/vNAaHwMncIDaOHwedyAHyd5x/3JbvO4bK9/+x81+uH6gGaCzd5oQqhTfJbpa0L6jN9IuR3Z7nmkS+L4MKfykqOH9ToJ1LrZ81YfHJ+KzxUBAg8edtf2std5fDavtbvZPGDBdga508P7dGeVYeaQ5yxcndavPp1cEhjJVHWou5h4YAjbeIinyoPSP2nue/yFlpf9b/euXJ69DujDD/iy+1JkqHjoBeIfOMPtYElswTzq6av2s+//OHWwk4UCe4H5DJUqofpVwONXaEgo8YzOHqsYH4EtlnTgM0+COFl26gyD5hiLPIizPicP2fKkc4whGOcCjwKViIGaRSStOhAAAAAElFTkSuQmCC", $i = 16, ea = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
2200
+ let [i] = B(), { typeset: o, polish: s, canTypeset: c, canPolish: l, aiOpen: u, setAiOpen: d, aiSessionRef: p } = mr(), { hasEditorText: m } = J(), { t: h } = a(), { iconSize: g } = Hn(), _ = t || !c || !m, x = t || !l || !m, S = t || !!u, C = T(() => {
2201
+ if (t || !c || !o) return;
2202
+ let e = Xi(i);
2203
+ e.text.trim() && (p.current = {
2204
+ originalHtml: e.html,
2205
+ codeBlocks: e.codeBlocks
2206
+ }, d("typeset"), o({
2207
+ text: e.text,
2208
+ html: e.htmlWithoutCode
2209
+ }));
2210
+ }, [
2211
+ p,
2212
+ c,
2213
+ t,
2214
+ i,
2215
+ d,
2216
+ o
2217
+ ]), w = T((e) => {
2218
+ if (t || !l || !s) return;
2219
+ let n = Xi(i);
2220
+ Li(n.polishText) && (p.current = {
2221
+ originalHtml: n.html,
2222
+ originalText: n.polishText,
2223
+ preset: e
2224
+ }, d("polish"), s({
2225
+ text: n.polishText,
2226
+ preset: e
2227
+ }));
2228
+ }, [
2229
+ p,
2230
+ l,
2231
+ t,
2232
+ i,
2233
+ s,
2234
+ d
2235
+ ]), E = T((e) => {
2236
+ if (e.key === "typeset") {
2237
+ C();
2238
+ return;
2239
+ }
2240
+ qr.includes(e.key) && w(e.key);
2241
+ }, [w, C]), D = [{
2242
+ key: "typeset",
2243
+ label: h("editor.aiTypeset"),
2244
+ disabled: _,
2245
+ icon: /* @__PURE__ */ y("img", {
2246
+ src: Zi,
2247
+ alt: "",
2248
+ width: $i,
2249
+ height: $i,
2250
+ className: Q["bsy-lexical-ai__icon"],
2251
+ draggable: !1
2252
+ })
2253
+ }, {
2254
+ key: "polish",
2255
+ label: h("editor.aiPolish"),
2256
+ disabled: x,
2257
+ icon: /* @__PURE__ */ y("img", {
2258
+ src: Qi,
2259
+ alt: "",
2260
+ width: $i,
2261
+ height: $i,
2262
+ className: Q["bsy-lexical-ai__icon"],
2263
+ draggable: !1
2264
+ }),
2265
+ children: qr.map((e) => ({
2266
+ key: e,
2267
+ label: h(Jr[e])
2268
+ }))
2269
+ }], O = /* @__PURE__ */ y("div", {
2270
+ className: I(G["bsy-lexical__toolbar-select"], G["bsy-lexical__toolbar-select--ai"], Q["bsy-lexical-ai__trigger"]),
2271
+ children: /* @__PURE__ */ y(q, {
2272
+ tooltip: n,
2273
+ showDisabledTooltip: r,
2274
+ disabled: S,
2275
+ icon: /* @__PURE__ */ b(v, { children: [
2276
+ /* @__PURE__ */ y("img", {
2277
+ src: Zi,
2278
+ alt: "",
2279
+ width: $i,
2280
+ height: $i,
2281
+ className: Q["bsy-lexical-ai__icon"],
2282
+ draggable: !1
2283
+ }),
2284
+ /* @__PURE__ */ y("span", {
2285
+ className: G["bsy-lexical__toolbar-select-label"],
2286
+ children: h("editor.aiTypeset")
2287
+ }),
2288
+ /* @__PURE__ */ y(e, {
2289
+ name: "arrow-down",
2290
+ size: g,
2291
+ className: G["bsy-lexical__toolbar-select-arrow"]
2292
+ })
2293
+ ] })
2294
+ })
2295
+ });
2296
+ return S ? O : /* @__PURE__ */ y(f, {
2297
+ menus: D,
2298
+ onClick: E,
2299
+ showSearch: !1,
2300
+ offset: W,
2301
+ style: {
2302
+ width: 147,
2303
+ minWidth: 147
2304
+ },
2305
+ children: O
2306
+ });
2307
+ }, ta = /* @__PURE__ */ new Map(), na = (e, t) => {
2308
+ if (!e) throw Error("registerToolbarButton: name is required");
2309
+ ta.set(e, t);
2310
+ }, ra = (e) => {
2311
+ ta.delete(e);
2312
+ }, ia = (e) => ta.get(e), aa = () => Array.from(ta.keys());
2313
+ Object.entries({
2314
+ undo: Dr,
2315
+ redo: Or,
2316
+ bold: Wn,
2317
+ underline: Gn,
2318
+ italic: Kn,
2319
+ strikethrough: kr,
2320
+ superscript: Ar,
2321
+ subscript: jr,
2322
+ heading: Ur,
2323
+ fontSize: qn,
2324
+ fontColor: nr,
2325
+ fill: rr,
2326
+ clearFormat: Gr,
2327
+ bullet: Pr,
2328
+ number: Fr,
2329
+ outdent: Nr,
2330
+ indent: Mr,
2331
+ align: ar,
2332
+ link: sr,
2333
+ unLink: cr,
2334
+ picture: Er,
2335
+ code: Ir,
2336
+ table: zr,
2337
+ source: Hr,
2338
+ ai: ea
2339
+ }).forEach(([e, t]) => {
2340
+ na(e, t);
2341
+ });
2342
+ //#endregion
2343
+ //#region src/components/Editor/utils/getToolbarItems.ts
2344
+ var oa = (e, t, n) => {
486
2345
  if (n) return [
487
2346
  {
488
2347
  kind: "button",
@@ -540,130 +2399,180 @@ var mn = (e) => {
540
2399
  key: `divider-${t.key}`
541
2400
  });
542
2401
  }), r;
543
- }, yn = (e) => {
544
- if (e.kind === "divider") return /* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] });
545
- if (e.kind === "language") return /* @__PURE__ */ M(gn, {});
546
- let t = re(e.name);
547
- return t ? /* @__PURE__ */ M(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
548
- }, bn = xe(function({ item: e, motionProps: t, transition: n }, r) {
549
- let i = yn(e);
550
- return i === null ? null : /* @__PURE__ */ M(je.div, {
2402
+ }, sa = Cn.map((e) => ({
2403
+ key: e.id,
2404
+ label: e.label
2405
+ })), ca = () => {
2406
+ let [t] = B(), { codeLanguage: n } = J(), { t: r } = a(), { iconSize: i } = Hn(), o = T((e) => {
2407
+ let n = e.key;
2408
+ K(t), t.update(() => {
2409
+ let e = R();
2410
+ z(e) && H(e.anchor.getNode(), V)?.setLanguage(n);
2411
+ });
2412
+ }, [t]), s = wn[n].label;
2413
+ return /* @__PURE__ */ y(f, {
2414
+ menus: sa,
2415
+ onClick: o,
2416
+ activeKey: [n],
2417
+ showSearch: !1,
2418
+ offset: W,
2419
+ style: {
2420
+ width: 120,
2421
+ minWidth: 120
2422
+ },
2423
+ children: /* @__PURE__ */ y("div", {
2424
+ className: G["bsy-lexical__toolbar-select"],
2425
+ style: { width: 120 },
2426
+ children: /* @__PURE__ */ y(q, {
2427
+ icon: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("span", {
2428
+ className: G["bsy-lexical__toolbar-select-label"],
2429
+ children: s
2430
+ }), /* @__PURE__ */ y(e, {
2431
+ name: "arrow-down",
2432
+ size: i,
2433
+ className: G["bsy-lexical__toolbar-select-arrow"]
2434
+ })] }),
2435
+ tooltip: r("editor.codeLanguage")
2436
+ })
2437
+ })
2438
+ });
2439
+ }, la = {
2440
+ initial: {
2441
+ opacity: 0,
2442
+ x: 6
2443
+ },
2444
+ animate: {
2445
+ opacity: 1,
2446
+ x: 0
2447
+ },
2448
+ exit: {
2449
+ opacity: 0,
2450
+ x: -6
2451
+ }
2452
+ }, ua = (e) => {
2453
+ if (e.kind === "divider") return /* @__PURE__ */ y("div", { className: G["bsy-lexical__toolbar-divider"] });
2454
+ if (e.kind === "language") return /* @__PURE__ */ y(ca, {});
2455
+ let t = ia(e.name);
2456
+ return t ? /* @__PURE__ */ y(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
2457
+ }, da = C(function({ item: e, motionProps: t, transition: n }, r) {
2458
+ let i = ua(e);
2459
+ return i === null ? null : /* @__PURE__ */ y(oe.div, {
551
2460
  ref: r,
552
2461
  "data-toolbar-item-key": e.key,
553
- className: z(p["bsy-lexical__toolbar-item"], e.kind === "button" && e.props?.disabled && p["bsy-lexical__toolbar-item--disabled"]),
2462
+ className: I(G["bsy-lexical__toolbar-item"], e.kind === "button" && e.props?.disabled && G["bsy-lexical__toolbar-item--disabled"]),
554
2463
  layout: "position",
555
2464
  transition: n,
556
2465
  ...t,
557
2466
  children: i
558
2467
  }, e.key);
559
- }), xn = ({ config: e, sizeToken: t }) => {
560
- let { isCodeBlock: r } = b(), { isSourceMode: i } = de(), a = Me(), o = I(() => vn(e, r, i), [
2468
+ }), fa = ({ config: e, sizeToken: t }) => {
2469
+ let { isCodeBlock: n } = J(), { isSourceMode: r } = Vr(), i = se(), o = M(() => oa(e, n, r), [
561
2470
  e,
562
- r,
563
- i
564
- ]), s = o.map((e) => e.key).join("|"), { t: c } = n(), l = L(null), d = L({}), f = L(null), m = L(!0), [h, g] = R({
2471
+ n,
2472
+ r
2473
+ ]), s = o.map((e) => e.key).join("|"), { t: c } = a(), l = N(null), u = N({}), d = N(null), f = N(!0), [p, m] = P({
565
2474
  keys: s,
566
2475
  count: o.length
567
2476
  });
568
- h.keys !== s && g({
2477
+ p.keys !== s && m({
569
2478
  keys: s,
570
2479
  count: o.length
571
2480
  });
572
- let _ = h.keys === s ? h.count : o.length, v = L(_);
573
- v.current = _;
574
- let [y, x] = R(!1), S = {
575
- duration: a ? 0 : .16,
2481
+ let h = p.keys === s ? p.count : o.length, g = N(h);
2482
+ g.current = h;
2483
+ let [_, v] = P(!1), x = {
2484
+ duration: i ? 0 : .16,
576
2485
  ease: "easeOut"
577
- }, C = a ? {} : _n, w = P(() => {
2486
+ }, S = i ? {} : la, C = T(() => {
578
2487
  let e = l.current;
579
- if (!e || m.current && v.current !== o.length) return;
2488
+ if (!e || f.current && g.current !== o.length) return;
580
2489
  let t = getComputedStyle(e), n = Number.parseFloat(t.columnGap || t.gap) || 0, r = e.clientWidth, i = new Set(o.map((e) => e.key));
581
2490
  e.querySelectorAll("[data-toolbar-item-key]").forEach((e) => {
582
2491
  let t = e.dataset.toolbarItemKey;
583
2492
  if (!t || !i.has(t)) return;
584
2493
  let n = e.getBoundingClientRect().width;
585
- (n > 0 || m.current) && (d.current[t] = n);
2494
+ (n > 0 || f.current) && (u.current[t] = n);
586
2495
  });
587
- let a = f.current?.offsetWidth ?? 0, c = o.map((e) => ({
588
- width: d.current[e.key] ?? 0,
2496
+ let a = d.current?.offsetWidth ?? 0, c = o.map((e) => ({
2497
+ width: u.current[e.key] ?? 0,
589
2498
  isDivider: e.kind === "divider"
590
2499
  }));
591
- m.current && o.length > 0 && c.every((e) => e.width <= 0) || (m.current = !1, g({
2500
+ f.current && o.length > 0 && c.every((e) => e.width <= 0) || (f.current = !1, m({
592
2501
  keys: s,
593
- count: dn(c, r, a, n)
2502
+ count: fn(c, r, a, n)
594
2503
  }));
595
2504
  }, [s, o]);
596
- Te(() => {
597
- m.current = !0, d.current = {};
2505
+ j(() => {
2506
+ f.current = !0, u.current = {};
598
2507
  }, [
599
2508
  s,
600
2509
  o.length,
601
2510
  t
602
- ]), Te(() => {
603
- w();
2511
+ ]), j(() => {
2512
+ C();
604
2513
  let e = l.current;
605
2514
  if (!e || typeof ResizeObserver > "u") return;
606
- let t = new ResizeObserver(() => w());
2515
+ let t = new ResizeObserver(() => C());
607
2516
  return t.observe(e), () => t.disconnect();
608
2517
  }, [
609
- w,
2518
+ C,
610
2519
  s,
611
2520
  t
612
2521
  ]);
613
- let { visible: ee, overflow: T } = fn(o, _), E = T.length > 0, D = L(T);
614
- T.length > 0 && (D.current = T);
615
- let O = y && E, k = E || y && D.current.length > 0, A = E ? T : D.current;
616
- return /* @__PURE__ */ N("div", {
617
- className: z(p["bsy-lexical__toolbar-stack"], a && p["bsy-lexical__toolbar-stack--instant"]),
618
- children: [/* @__PURE__ */ N("div", {
2522
+ let { visible: w, overflow: E } = pn(o, h), D = E.length > 0, O = N(E);
2523
+ E.length > 0 && (O.current = E);
2524
+ let k = _ && D, A = D || _ && O.current.length > 0, F = D ? E : O.current;
2525
+ return /* @__PURE__ */ b("div", {
2526
+ className: I(G["bsy-lexical__toolbar-stack"], i && G["bsy-lexical__toolbar-stack--instant"]),
2527
+ children: [/* @__PURE__ */ b("div", {
619
2528
  ref: l,
620
- className: p["bsy-lexical__toolbar-items"],
2529
+ className: G["bsy-lexical__toolbar-items"],
621
2530
  children: [
622
- /* @__PURE__ */ M(Ae, {
2531
+ /* @__PURE__ */ y(ae, {
623
2532
  initial: !1,
624
2533
  mode: "popLayout",
625
- children: ee.map((e) => /* @__PURE__ */ M(bn, {
2534
+ children: w.map((e) => /* @__PURE__ */ y(da, {
626
2535
  item: e,
627
- motionProps: C,
628
- transition: S
2536
+ motionProps: S,
2537
+ transition: x
629
2538
  }, e.key))
630
2539
  }),
631
- E ? /* @__PURE__ */ N("div", {
632
- className: z(p["bsy-lexical__toolbar-overflow"], p["bsy-lexical__toolbar-with-divider"]),
633
- children: [/* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ M(u, {
634
- icon: O ? "packupeverything" : "expandall",
635
- tooltip: c(O ? "editor.collapse" : "editor.expand"),
636
- highlight: O,
637
- onClick: () => x((e) => !e)
2540
+ D ? /* @__PURE__ */ b("div", {
2541
+ className: I(G["bsy-lexical__toolbar-overflow"], G["bsy-lexical__toolbar-with-divider"]),
2542
+ children: [/* @__PURE__ */ y("div", { className: G["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
2543
+ icon: k ? "packupeverything" : "expandall",
2544
+ tooltip: c(k ? "editor.collapse" : "editor.expand"),
2545
+ highlight: k,
2546
+ onClick: () => v((e) => !e)
638
2547
  })]
639
2548
  }) : null,
640
- /* @__PURE__ */ N("div", {
641
- ref: f,
642
- className: z(p["bsy-lexical__toolbar-more-sizer"], p["bsy-lexical__toolbar-with-divider"]),
2549
+ /* @__PURE__ */ b("div", {
2550
+ ref: d,
2551
+ className: I(G["bsy-lexical__toolbar-more-sizer"], G["bsy-lexical__toolbar-with-divider"]),
643
2552
  "aria-hidden": !0,
644
- children: [/* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ M(u, {
2553
+ children: [/* @__PURE__ */ y("div", { className: G["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ y(q, {
645
2554
  icon: "expandall",
646
2555
  tooltip: ""
647
2556
  })]
648
2557
  })
649
2558
  ]
650
- }), k ? /* @__PURE__ */ M("div", {
651
- className: z(p["bsy-lexical__toolbar-overflow-row"], O && p["bsy-lexical__toolbar-overflow-row--open"], a && p["bsy-lexical__toolbar-overflow-row--instant"]),
652
- children: /* @__PURE__ */ M("div", {
653
- className: p["bsy-lexical__toolbar-overflow-inner"],
654
- children: A.map((e) => /* @__PURE__ */ M(bn, {
2559
+ }), A ? /* @__PURE__ */ y("div", {
2560
+ className: I(G["bsy-lexical__toolbar-overflow-row"], k && G["bsy-lexical__toolbar-overflow-row--open"], i && G["bsy-lexical__toolbar-overflow-row--instant"]),
2561
+ children: /* @__PURE__ */ y("div", {
2562
+ className: G["bsy-lexical__toolbar-overflow-inner"],
2563
+ children: F.map((e) => /* @__PURE__ */ y(da, {
655
2564
  item: e,
656
2565
  motionProps: {},
657
- transition: S
2566
+ transition: x
658
2567
  }, `overflow-${e.key}`))
659
2568
  })
660
2569
  }) : null]
661
2570
  });
662
- }, Sn = (e) => {
663
- let { config: t = [], style: n, theme: r, mode: i, floating: a, stickyOffset: o, size: s = v } = e, { toolbarRef: c } = le(), u = i === "floating", d = o !== void 0, f = Me(), m = {
664
- duration: f ? 0 : .16,
2571
+ }, pa = (e) => {
2572
+ let { config: t = [], style: n, theme: r, mode: i, floating: a, stickyOffset: o, size: s = on } = e, { toolbarRef: c } = mr(), l = i === "floating", u = o !== void 0, d = se(), f = {
2573
+ duration: d ? 0 : .16,
665
2574
  ease: "easeOut"
666
- }, h = I(() => cn(r, s), [r, s]), g = I(() => ({ iconSize: ln(r?.iconSize, s) }), [r?.iconSize, s]), _ = u ? un(a) : void 0, y = u ? ve(n, [
2575
+ }, p = M(() => ln(r, s), [r, s]), m = M(() => ({ iconSize: un(r?.iconSize, s) }), [r?.iconSize, s]), h = l ? dn(a) : void 0, _ = l ? g(n, [
667
2576
  "position",
668
2577
  "left",
669
2578
  "top",
@@ -674,41 +2583,41 @@ var mn = (e) => {
674
2583
  "marginTop",
675
2584
  "marginBottom"
676
2585
  ]) : n;
677
- return /* @__PURE__ */ M(l, {
678
- value: g,
679
- children: /* @__PURE__ */ M(A, { children: /* @__PURE__ */ M(mn, { children: /* @__PURE__ */ M(je.div, {
2586
+ return /* @__PURE__ */ y(Vn, {
2587
+ value: m,
2588
+ children: /* @__PURE__ */ y(zn, { children: /* @__PURE__ */ y(In, { children: /* @__PURE__ */ y(oe.div, {
680
2589
  ref: c,
681
- layout: f || d ? !1 : "position",
682
- transition: m,
683
- className: z(p["bsy-lexical__toolbar"], u && p["bsy-lexical__toolbar--floating"], d && p["bsy-lexical__toolbar--sticky"]),
2590
+ layout: d || u ? !1 : "position",
2591
+ transition: f,
2592
+ className: I(G["bsy-lexical__toolbar"], l && G["bsy-lexical__toolbar--floating"], u && G["bsy-lexical__toolbar--sticky"]),
684
2593
  style: {
2594
+ ...p,
2595
+ ...u ? { top: o } : null,
685
2596
  ...h,
686
- ...d ? { top: o } : null,
687
- ..._,
688
- ...y
2597
+ ..._
689
2598
  },
690
- children: /* @__PURE__ */ M(xn, {
2599
+ children: /* @__PURE__ */ y(fa, {
691
2600
  config: t,
692
2601
  sizeToken: `${s}|${r?.itemHeight ?? ""}|${r?.iconSize ?? ""}`
693
2602
  })
694
2603
  }) }) })
695
2604
  });
696
- }, X = {
697
- "bsy-lexical-editor": "_bsy-lexical-editor_3yq2d_1",
698
- "bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_3yq2d_8",
699
- "bsy-lexical-editor--sticky-toolbar": "_bsy-lexical-editor--sticky-toolbar_3yq2d_8",
700
- "bsy-lexical-editor__body": "_bsy-lexical-editor__body_3yq2d_11",
701
- "bsy-lexical-editor__body--fixed": "_bsy-lexical-editor__body--fixed_3yq2d_16",
702
- "bsy-lexical-editor__editable-wrap": "_bsy-lexical-editor__editable-wrap_3yq2d_19",
703
- "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_3yq2d_28",
704
- "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_3yq2d_38",
705
- "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_3yq2d_50"
706
- }, Cn = (e) => {
2605
+ }, $ = {
2606
+ "bsy-lexical-editor": "_bsy-lexical-editor_1l05x_1",
2607
+ "bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_1l05x_8",
2608
+ "bsy-lexical-editor--sticky-toolbar": "_bsy-lexical-editor--sticky-toolbar_1l05x_8",
2609
+ "bsy-lexical-editor__body": "_bsy-lexical-editor__body_1l05x_11",
2610
+ "bsy-lexical-editor__body--fixed": "_bsy-lexical-editor__body--fixed_1l05x_16",
2611
+ "bsy-lexical-editor__editable-wrap": "_bsy-lexical-editor__editable-wrap_1l05x_19",
2612
+ "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1l05x_28",
2613
+ "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1l05x_41",
2614
+ "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1l05x_53"
2615
+ }, ma = (e) => {
707
2616
  if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
708
- }, wn = (e) => {
2617
+ }, ha = (e) => {
709
2618
  let t = {};
710
- return e ? (r(t, "--bsy-editor-container-border-color", e.borderColor), r(t, "--bsy-editor-container-border-width", Cn(e.borderWidth)), r(t, "--bsy-editor-container-border-radius", Cn(e.borderRadius)), t) : t;
711
- }, Z = class e extends _t {
2619
+ return e ? (s(t, "--bsy-editor-container-border-color", e.borderColor), s(t, "--bsy-editor-container-border-width", ma(e.borderWidth)), s(t, "--bsy-editor-container-border-radius", ma(e.borderRadius)), t) : t;
2620
+ }, ga = class e extends nt {
712
2621
  constructor(e, t) {
713
2622
  super(e, t);
714
2623
  }
@@ -719,46 +2628,46 @@ var mn = (e) => {
719
2628
  return new e(t.__text, t.__key);
720
2629
  }
721
2630
  static importDOM() {
722
- let e = _t.importDOM();
2631
+ let e = nt.importDOM();
723
2632
  return {
724
2633
  ...e,
725
2634
  code: () => ({
726
- conversion: Q(e?.code),
2635
+ conversion: va(e?.code),
727
2636
  priority: 1
728
2637
  }),
729
2638
  em: () => ({
730
- conversion: Q(e?.em),
2639
+ conversion: va(e?.em),
731
2640
  priority: 1
732
2641
  }),
733
2642
  span: () => ({
734
- conversion: Q(e?.span),
2643
+ conversion: va(e?.span),
735
2644
  priority: 1
736
2645
  }),
737
2646
  strong: () => ({
738
- conversion: Q(e?.strong),
2647
+ conversion: va(e?.strong),
739
2648
  priority: 1
740
2649
  }),
741
2650
  sub: () => ({
742
- conversion: Q(e?.sub),
2651
+ conversion: va(e?.sub),
743
2652
  priority: 1
744
2653
  }),
745
2654
  sup: () => ({
746
- conversion: Q(e?.sup),
2655
+ conversion: va(e?.sup),
747
2656
  priority: 1
748
2657
  })
749
2658
  };
750
2659
  }
751
2660
  static importJSON(e) {
752
- return Tn().updateFromJSON(e);
2661
+ return _a().updateFromJSON(e);
753
2662
  }
754
2663
  isSimpleText() {
755
2664
  return this.__type === "extended-text" && this.__mode === 0;
756
2665
  }
757
2666
  };
758
- function Tn(e = "") {
759
- return Ve(new Z(e));
2667
+ function _a(e = "") {
2668
+ return _e(new ga(e));
760
2669
  }
761
- function Q(e) {
2670
+ function va(e) {
762
2671
  return (t) => {
763
2672
  let n = e?.(t);
764
2673
  if (!n) return null;
@@ -769,7 +2678,7 @@ function Q(e) {
769
2678
  ...r,
770
2679
  forChild: (e, t) => {
771
2680
  let n = (r?.forChild ?? ((e) => e))(e, t);
772
- if ($e(n)) {
2681
+ if (Ae(n)) {
773
2682
  let e = [
774
2683
  i ? `background-color: ${i}` : null,
775
2684
  a ? `color: ${a}` : null,
@@ -787,81 +2696,81 @@ function Q(e) {
787
2696
  }
788
2697
  //#endregion
789
2698
  //#region src/components/Editor/utils/stripInlineStyleProperty.ts
790
- function En(e, t) {
2699
+ function ya(e, t) {
791
2700
  return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
792
2701
  }
793
2702
  //#endregion
794
2703
  //#region src/components/Editor/plugins/LinkColorPlugin.tsx
795
- function Dn(e) {
796
- if (!G(e, Et)) return;
2704
+ function ba(e) {
2705
+ if (!H(e, lt)) return;
797
2706
  let t = e.getStyle();
798
2707
  if (!t) return;
799
- let n = En(t, "color");
2708
+ let n = ya(t, "color");
800
2709
  n !== t && e.setStyle(n);
801
2710
  }
802
- function On() {
803
- let [e] = W();
804
- return F(() => e.registerNodeTransform(Z, Dn), [e]), null;
2711
+ function xa() {
2712
+ let [e] = B();
2713
+ return O(() => e.registerNodeTransform(ga, ba), [e]), null;
805
2714
  }
806
2715
  //#endregion
807
2716
  //#region src/components/Editor/plugins/ImagePlugin.tsx
808
- function kn() {
809
- let [e] = W();
810
- return F(() => e.registerCommand(C, (e) => (Je([an(e)]), !0), at), [e]), null;
2717
+ function Sa() {
2718
+ let [e] = B();
2719
+ return O(() => e.registerCommand(Tr, (e) => (Te([nn(e)]), !0), ze), [e]), null;
811
2720
  }
812
2721
  //#endregion
813
2722
  //#region src/components/Editor/utils/stripImagesFromHtml.ts
814
- function An(e) {
2723
+ function Ca(e) {
815
2724
  let t = new DOMParser().parseFromString(e, "text/html");
816
2725
  return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
817
2726
  }
818
2727
  //#endregion
819
2728
  //#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
820
- var jn = /<img\b|<picture\b/i;
821
- function Mn() {
822
- let [e] = W(), { isSourceModeRef: t } = de();
823
- return F(() => {
2729
+ var wa = /<img\b|<picture\b/i;
2730
+ function Ta() {
2731
+ let [e] = B(), { isSourceModeRef: t } = Vr();
2732
+ return O(() => {
824
2733
  let n = (n) => {
825
2734
  if (t.current) return !1;
826
2735
  let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
827
2736
  if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
828
2737
  let i = r.getData("text/html");
829
- if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || jn.test(i))) return !1;
2738
+ if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || wa.test(i))) return !1;
830
2739
  n.preventDefault();
831
2740
  let a = r.getData("text/plain");
832
- return !jn.test(i) && !a || e.update(() => {
833
- let t = H();
2741
+ return !wa.test(i) && !a || e.update(() => {
2742
+ let t = R();
834
2743
  if (t === null) return;
835
- let n = i ? An(i) : "", r = document.createElement("div");
2744
+ let n = i ? Ca(i) : "", r = document.createElement("div");
836
2745
  if (r.innerHTML = n, n && r.textContent?.trim()) {
837
- let t = Be(e, new DOMParser().parseFromString(n, "text/html"));
2746
+ let t = ge(e, new DOMParser().parseFromString(n, "text/html"));
838
2747
  if (t.length) {
839
- Je(t);
2748
+ Te(t);
840
2749
  return;
841
2750
  }
842
2751
  }
843
2752
  a && t.insertRawText(a);
844
- }, { tag: ht }), !0;
2753
+ }, { tag: $e }), !0;
845
2754
  };
846
- return Tt(e.registerCommand(mt, (e) => n(e), ot), e.registerCommand(ct, (e) => n(e), ot));
2755
+ return Yt(e.registerCommand(Qe, (e) => n(e), Be), e.registerCommand(He, (e) => n(e), Be));
847
2756
  }, [e, t]), null;
848
2757
  }
849
2758
  //#endregion
850
2759
  //#region src/components/Editor/plugins/EnterKeyPlugin.tsx
851
- function Nn() {
852
- let [e] = W(), t = L(0);
853
- return F(() => e.registerCommand(ft, (n) => {
2760
+ function Ea() {
2761
+ let [e] = B(), t = N(0);
2762
+ return O(() => e.registerCommand(Ye, (n) => {
854
2763
  let r = Date.now(), i = r - t.current;
855
2764
  return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
856
- let e = H();
857
- return U(e) ? !!G(e.anchor.getNode(), (e) => K(e) || q(e) || Bt(e)) : !1;
2765
+ let e = R();
2766
+ return z(e) ? !!H(e.anchor.getNode(), (e) => mt(e) || V(e) || Nt(e)) : !1;
858
2767
  }, { editor: e }) ? !1 : (e.update(() => {
859
- let e = H();
860
- if (U(e)) {
2768
+ let e = R();
2769
+ if (z(e)) {
861
2770
  let t = e.anchor.getNode().getTopLevelElement();
862
2771
  if (t && t.getTextContent().trim() === "") {
863
- let n = Ue();
864
- St(e, {
2772
+ let n = ye();
2773
+ kt(e, {
865
2774
  "background-color": "",
866
2775
  color: "",
867
2776
  "font-size": "",
@@ -874,11 +2783,11 @@ function Nn() {
874
2783
  }
875
2784
  }
876
2785
  }), n?.preventDefault(), !0) : !1;
877
- }, st), [e]), null;
2786
+ }, Ve), [e]), null;
878
2787
  }
879
2788
  //#endregion
880
2789
  //#region src/components/Editor/utils/codeHighlighter.ts
881
- var Pn = {
2790
+ var Da = {
882
2791
  css: () => import("@shikijs/langs/css"),
883
2792
  html: () => import("@shikijs/langs/html"),
884
2793
  xml: () => import("@shikijs/langs/xml"),
@@ -899,65 +2808,70 @@ var Pn = {
899
2808
  bash: () => import("@shikijs/langs/shellscript"),
900
2809
  lua: () => import("@shikijs/langs/lua"),
901
2810
  markdown: () => import("@shikijs/langs/markdown")
902
- }, Fn = (e) => e === "bash" ? "shellscript" : e, In = (e) => e in Pn, Ln = null, Rn = null, zn = /* @__PURE__ */ new Map(), Bn = () => (Ln ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
2811
+ }, Oa = (e) => e === "bash" ? "shellscript" : e, ka = (e) => e in Da, Aa = null, ja = null, Ma = /* @__PURE__ */ new Map(), Na = () => (Aa ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
903
2812
  engine: t(),
904
2813
  langs: [],
905
2814
  themes: []
906
2815
  })).catch((e) => {
907
- throw Ln = null, e;
908
- }), Ln), Vn = (e, t) => In(t) && e.getLoadedLanguages().includes(Fn(t)), Hn = (e) => {
909
- let t = zn.get(e);
910
- return t || (t = Bn().then(async (t) => {
911
- let n = Fn(e);
2816
+ throw Aa = null, e;
2817
+ }), Aa), Pa = (e, t) => ka(t) && e.getLoadedLanguages().includes(Oa(t)), Fa = (e) => {
2818
+ let t = Ma.get(e);
2819
+ return t || (t = Na().then(async (t) => {
2820
+ let n = Oa(e);
912
2821
  if (!t.getLoadedLanguages().includes(n)) {
913
- let n = await Pn[e]();
2822
+ let n = await Da[e]();
914
2823
  await t.loadLanguage(n.default);
915
2824
  }
916
2825
  return t;
917
2826
  }).catch((t) => {
918
- throw zn.delete(e), t;
919
- }), zn.set(e, t)), t;
920
- }, Un = () => (Rn ||= Bn().then(async (e) => {
2827
+ throw Ma.delete(e), t;
2828
+ }), Ma.set(e, t)), t;
2829
+ }, Ia = () => (ja ||= Na().then(async (e) => {
921
2830
  if (!e.getLoadedThemes().includes("github-light")) {
922
2831
  let t = await import("@shikijs/themes/github-light");
923
2832
  await e.loadTheme(t.default);
924
2833
  }
925
2834
  return e;
926
2835
  }).catch((e) => {
927
- throw Rn = null, e;
928
- }), Rn), Wn = (e, t, n) => {
2836
+ throw ja = null, e;
2837
+ }), ja), La = (e, t, n) => {
929
2838
  let r = e.getTextContent();
930
- if (e.getStyle() && e.setStyle(""), !n || !Vn(n, t)) return Ft(r);
931
- let i = Fn(t), a = n.codeToTokens(r, {
2839
+ if (e.getStyle() && e.setStyle(""), !n || !Pa(n, t)) return wt(r);
2840
+ let i = Oa(t), a = n.codeToTokens(r, {
932
2841
  lang: i,
933
- theme: k
2842
+ theme: Sn
934
2843
  }), o = [];
935
2844
  return a.tokens.forEach((e, t) => {
936
- t && o.push(He()), e.forEach((e) => {
2845
+ t && o.push(ve()), e.forEach((e) => {
937
2846
  e.content.split(" ").forEach((t, n) => {
938
- if (n && o.push(We()), t === "") return;
939
- let r = Mt(t), i = typeof e.htmlStyle == "string" ? e.htmlStyle : e.htmlStyle ? Object.entries(e.htmlStyle).map(([e, t]) => `${e}:${t}`).join(";") : e.color ? `color: ${e.color}` : "";
2847
+ if (n && o.push(be()), t === "") return;
2848
+ let r = xt(t), i = typeof e.htmlStyle == "string" ? e.htmlStyle : e.htmlStyle ? Object.entries(e.htmlStyle).map(([e, t]) => `${e}:${t}`).join(";") : e.color ? `color: ${e.color}` : "";
940
2849
  i && r.setStyle(i), o.push(r);
941
2850
  });
942
2851
  });
943
2852
  }), o;
944
- }, Gn = (e, t) => {
945
- let n = B(e);
946
- if (!q(n) || !n.isAttached()) return;
947
- let r = H();
948
- if (!U(r)) {
2853
+ }, Ra = (e, t) => {
2854
+ let n = Ce(e);
2855
+ if (!V(n) || !n.isAttached()) return;
2856
+ let r = R();
2857
+ if (!z(r)) {
949
2858
  t();
950
2859
  return;
951
2860
  }
952
- let { anchor: i } = r, a = i.offset, o = i.type === "element" && Xe(n.getChildAtIndex(i.offset - 1)), s = 0;
2861
+ let { anchor: i } = r;
2862
+ if (H(i.getNode(), V) !== n) {
2863
+ t();
2864
+ return;
2865
+ }
2866
+ let a = i.offset, o = i.type === "element" && De(n.getChildAtIndex(i.offset - 1)), s = 0;
953
2867
  if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
954
2868
  if (o) {
955
2869
  i.getNode().select(a, a);
956
2870
  return;
957
2871
  }
958
2872
  n.getChildren().some((e) => {
959
- let t = $e(e);
960
- if (t || Xe(e)) {
2873
+ let t = Ae(e);
2874
+ if (t || De(e)) {
961
2875
  let n = e.getTextContentSize();
962
2876
  if (t && n >= s) return e.select(s, s), !0;
963
2877
  s -= n;
@@ -965,11 +2879,11 @@ var Pn = {
965
2879
  return !1;
966
2880
  });
967
2881
  }
968
- }, Kn = (e, t) => Pt(e) && Pt(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || Qe(e) && Qe(t) || Xe(e) && Xe(t), qn = (e, t) => {
2882
+ }, za = (e, t) => Ct(e) && Ct(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || ke(e) && ke(t) || De(e) && De(t), Ba = (e, t) => {
969
2883
  let n = 0;
970
- for (; n < e.length && Kn(e[n], t[n]);) n++;
2884
+ for (; n < e.length && za(e[n], t[n]);) n++;
971
2885
  let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
972
- for (; o < a;) if (o++, !Kn(e[r - o], t[i - o])) {
2886
+ for (; o < a;) if (o++, !za(e[r - o], t[i - o])) {
973
2887
  o--;
974
2888
  break;
975
2889
  }
@@ -978,21 +2892,21 @@ var Pn = {
978
2892
  to: r - o,
979
2893
  nodesForReplacement: t.slice(n, i - o)
980
2894
  };
981
- }, Jn = (e, t, n, r, i) => {
982
- let a = i.getKey(), o = d(i.getLanguage());
2895
+ }, Va = (e, t, n, r, i) => {
2896
+ let a = i.getKey(), o = Tn(i.getLanguage());
983
2897
  if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
984
2898
  else {
985
- i.getTheme() !== "github-light" && i.setTheme(k);
986
- let s = t ? t.getLoadedThemes().includes("github-light") ? In(o) && !Vn(t, o) ? Hn(o) : null : Un() : Bn();
2899
+ i.getTheme() !== "github-light" && i.setTheme(Sn);
2900
+ let s = t ? t.getLoadedThemes().includes("github-light") ? ka(o) && !Pa(t, o) ? Fa(o) : null : Ia() : Na();
987
2901
  if (s) {
988
2902
  i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
989
2903
  r(t);
990
2904
  let i = [...n.pendingKeys];
991
2905
  n.pendingKeys.clear(), n.loading = null, e.update(() => {
992
2906
  i.forEach((e) => {
993
- B(e)?.markDirty();
2907
+ Ce(e)?.markDirty();
994
2908
  });
995
- }, { tag: ut });
2909
+ }, { tag: qe });
996
2910
  }, () => {
997
2911
  n.pendingKeys.clear(), n.loading = null;
998
2912
  }));
@@ -1000,22 +2914,22 @@ var Pn = {
1000
2914
  }
1001
2915
  i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
1002
2916
  }
1003
- n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, tt(() => {
2917
+ n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, Me(() => {
1004
2918
  n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
1005
- })), Gn(a, () => {
1006
- let e = B(a);
1007
- if (!q(e) || !e.isAttached()) return !1;
1008
- let n = Wn(e, d(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = qn(e.getChildren(), n);
2919
+ })), Ra(a, () => {
2920
+ let e = Ce(a);
2921
+ if (!V(e) || !e.isAttached()) return !1;
2922
+ let n = La(e, Tn(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = Ba(e.getChildren(), n);
1009
2923
  return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
1010
2924
  }));
1011
- }, Yn = (e, t, n, r, i) => {
2925
+ }, Ha = (e, t, n, r, i) => {
1012
2926
  let a = i.getParent();
1013
- q(a) ? Jn(e, t, n, r, a) : Pt(i) && i.replace(Ge(i.__text));
2927
+ V(a) ? Va(e, t, n, r, a) : Ct(i) && i.replace(xe(i.__text));
1014
2928
  };
1015
- function Xn() {
1016
- let [e] = W();
1017
- return F(() => {
1018
- if (!e.hasNodes([Lt, It])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
2929
+ function Ua() {
2930
+ let [e] = B();
2931
+ return O(() => {
2932
+ if (!e.hasNodes([Et, Tt])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
1019
2933
  let t = null, n = {
1020
2934
  didTransform: !1,
1021
2935
  nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
@@ -1024,16 +2938,16 @@ function Xn() {
1024
2938
  }, r = (e) => {
1025
2939
  t = e;
1026
2940
  }, i = (e) => {
1027
- let t = B(e);
1028
- if (!q(t)) return;
2941
+ let t = Ce(e);
2942
+ if (!V(t)) return;
1029
2943
  let n = t.getChildrenSize();
1030
2944
  n === 0 ? t.selectStart() : t.select(0, n);
1031
2945
  }, a = (t) => {
1032
2946
  if (!(t instanceof Node) || !e.getRootElement()?.contains(t)) return null;
1033
2947
  let n = null;
1034
2948
  return e.getEditorState().read(() => {
1035
- let e = Ke(t), r = e ? G(e, q) : null;
1036
- q(r) && (n = r.getKey());
2949
+ let e = Se(t), r = e ? H(e, V) : null;
2950
+ V(r) && (n = r.getKey());
1037
2951
  }, { editor: e }), n;
1038
2952
  }, o = null, s = (t, n, r) => {
1039
2953
  t.preventDefault(), r && (o = n), e.update(() => {
@@ -1055,12 +2969,12 @@ function Xn() {
1055
2969
  }, d = (e, t) => {
1056
2970
  t?.removeEventListener("mousedown", c, !0), t?.removeEventListener("mouseup", u, !0), t?.removeEventListener("dblclick", l, !0), e?.addEventListener("mousedown", c, !0), e?.addEventListener("mouseup", u, !0), e?.addEventListener("dblclick", l, !0);
1057
2971
  };
1058
- return yt(Rt(e), e.registerNodeTransform(Lt, (i) => {
1059
- Jn(e, t, n, r, i);
1060
- }), e.registerNodeTransform(_t, (i) => {
1061
- Yn(e, t, n, r, i);
1062
- }), e.registerNodeTransform(It, (i) => {
1063
- Yn(e, t, n, r, i);
2972
+ return ot(Dt(e), e.registerNodeTransform(Et, (i) => {
2973
+ Va(e, t, n, r, i);
2974
+ }), e.registerNodeTransform(nt, (i) => {
2975
+ Ha(e, t, n, r, i);
2976
+ }), e.registerNodeTransform(Tt, (i) => {
2977
+ Ha(e, t, n, r, i);
1064
2978
  }), e.registerRootListener(d), () => {
1065
2979
  d(null, e.getRootElement());
1066
2980
  });
@@ -1068,23 +2982,23 @@ function Xn() {
1068
2982
  }
1069
2983
  //#endregion
1070
2984
  //#region src/components/Editor/plugins/TablePlugin.tsx
1071
- function Zn() {
1072
- let [e] = W();
1073
- return F(() => (Xt(e, !0), Tt(Jt(e), Yt(e, !1), qt(e), e.registerNodeTransform(Wt, (e) => {
2985
+ function Wa() {
2986
+ let [e] = B();
2987
+ return O(() => (Wt(e, !0), Yt(Ht(e), Ut(e, !1), Vt(e), e.registerNodeTransform(Rt, (e) => {
1074
2988
  e.getBackgroundColor() !== null && e.setBackgroundColor(null);
1075
- }), e.registerCommand(pt, (e) => {
1076
- let t = H();
1077
- if (!U(t) || !t.isCollapsed()) return !1;
1078
- let n = zt(t.anchor.getNode());
2989
+ }), e.registerCommand(Xe, (e) => {
2990
+ let t = R();
2991
+ if (!z(t) || !t.isCollapsed()) return !1;
2992
+ let n = Mt(t.anchor.getNode());
1079
2993
  if (n === null) return !1;
1080
2994
  let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
1081
- if (Bt(o)) s = o;
2995
+ if (Nt(o)) s = o;
1082
2996
  else {
1083
- let e = G(n, Ht);
2997
+ let e = H(n, Ft);
1084
2998
  if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
1085
- if (!Ht(t)) continue;
2999
+ if (!Ft(t)) continue;
1086
3000
  let e = t[a]();
1087
- if (Bt(e)) {
3001
+ if (Nt(e)) {
1088
3002
  s = e;
1089
3003
  break;
1090
3004
  }
@@ -1094,60 +3008,60 @@ function Zn() {
1094
3008
  let e = s.getFirstDescendant();
1095
3009
  e ? e.selectStart() : s.selectStart();
1096
3010
  } else {
1097
- let e = G(n, Vt);
3011
+ let e = H(n, Pt);
1098
3012
  e && (r === "next" ? e.selectNext() : e.selectPrevious());
1099
3013
  }
1100
3014
  return !0;
1101
- }, ot))), [e]), null;
3015
+ }, Be))), [e]), null;
1102
3016
  }
1103
3017
  //#endregion
1104
3018
  //#region src/components/Editor/plugins/TabIndentPlugin.tsx
1105
- var Qn = "\xA0".repeat(4);
1106
- function $n() {
1107
- let [e] = W();
1108
- return F(() => e.registerCommand(pt, (t) => {
3019
+ var Ga = "\xA0".repeat(4);
3020
+ function Ka() {
3021
+ let [e] = B();
3022
+ return O(() => e.registerCommand(Xe, (t) => {
1109
3023
  if (t.shiftKey) return !1;
1110
- let n = H();
1111
- if (!U(n)) return !1;
3024
+ let n = R();
3025
+ if (!z(n)) return !1;
1112
3026
  let r = n.anchor.getNode();
1113
- if (zt(r) !== null || G(r, q)) return !1;
3027
+ if (Mt(r) !== null || H(r, V)) return !1;
1114
3028
  t.preventDefault();
1115
- let i = G(r, K);
1116
- if (K(i)) {
3029
+ let i = H(r, mt);
3030
+ if (mt(i)) {
1117
3031
  let e = new Set([i]);
1118
3032
  for (let t of n.getNodes()) {
1119
- let n = G(t, K);
1120
- K(n) && e.add(n);
3033
+ let n = H(t, mt);
3034
+ mt(n) && e.add(n);
1121
3035
  }
1122
3036
  for (let t of e) t.setIndent(t.getIndent() + 1);
1123
3037
  return !0;
1124
3038
  }
1125
3039
  let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
1126
- return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(dt, void 0) : (n.insertText(Qn), !0);
1127
- }, at), [e]), null;
3040
+ return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(Je, void 0) : (n.insertText(Ga), !0);
3041
+ }, ze), [e]), null;
1128
3042
  }
1129
3043
  //#endregion
1130
3044
  //#region src/components/Editor/plugins/MaxLengthPlugin.tsx
1131
- function er({ maxLength: e, onMaxLengthExceed: t }) {
1132
- let [n] = W(), { isSourceModeRef: r } = de(), i = L(t);
1133
- return i.current = t, F(() => {
3045
+ function qa({ maxLength: e, onMaxLengthExceed: t }) {
3046
+ let [n] = B(), { isSourceModeRef: r } = Vr(), i = N(t);
3047
+ return i.current = t, O(() => {
1134
3048
  let t = null;
1135
- return n.registerNodeTransform(gt, (a) => {
3049
+ return n.registerNodeTransform(tt, (a) => {
1136
3050
  if (r.current) return;
1137
3051
  let o = a.getTextContentSize();
1138
3052
  if (o <= e) return;
1139
- let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u = H();
3053
+ let s = n.getEditorState(), c = s.read(() => a.getTextContentSize()), l = o - e, u = R();
1140
3054
  if (c === e && t !== s) {
1141
- t = s, wt(n, s), i.current?.();
3055
+ t = s, Jt(n, s), i.current?.();
1142
3056
  return;
1143
3057
  }
1144
- if (U(u) && u.isCollapsed()) {
1145
- Ct(n, u.anchor, l), i.current?.();
3058
+ if (z(u) && u.isCollapsed()) {
3059
+ jt(n, u.anchor, l), i.current?.();
1146
3060
  return;
1147
3061
  }
1148
3062
  a.selectEnd();
1149
- let d = H();
1150
- U(d) && (Ct(n, d.anchor, l), i.current?.());
3063
+ let d = R();
3064
+ z(d) && (jt(n, d.anchor, l), i.current?.());
1151
3065
  });
1152
3066
  }, [
1153
3067
  n,
@@ -1157,19 +3071,19 @@ function er({ maxLength: e, onMaxLengthExceed: t }) {
1157
3071
  }
1158
3072
  //#endregion
1159
3073
  //#region src/components/Editor/utils/textLength.ts
1160
- function tr(e) {
3074
+ function Ja(e) {
1161
3075
  return typeof e == "number" && Number.isFinite(e) && e > 0;
1162
3076
  }
1163
- function nr(e, t) {
1164
- let n = V(), r = n.getTextContentSize();
3077
+ function Ya(e, t) {
3078
+ let n = L(), r = n.getTextContentSize();
1165
3079
  if (r <= t) return !1;
1166
3080
  let i = r - t;
1167
3081
  n.selectEnd();
1168
- let a = H();
1169
- return U(a) ? Ct(e, a.anchor, i) : rr(i), !0;
3082
+ let a = R();
3083
+ return z(a) ? jt(e, a.anchor, i) : Xa(i), !0;
1170
3084
  }
1171
- function rr(e) {
1172
- let t = e, n = V().getAllTextNodes();
3085
+ function Xa(e) {
3086
+ let t = e, n = L().getAllTextNodes();
1173
3087
  for (let e = n.length - 1; e >= 0 && t > 0; e--) {
1174
3088
  let r = n[e], i = r.getTextContent();
1175
3089
  i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
@@ -1177,7 +3091,7 @@ function rr(e) {
1177
3091
  }
1178
3092
  //#endregion
1179
3093
  //#region src/components/Editor/utils/formatEditorHtml.ts
1180
- var ir = new Set([
3094
+ var Za = new Set([
1181
3095
  "area",
1182
3096
  "base",
1183
3097
  "br",
@@ -1192,73 +3106,73 @@ var ir = new Set([
1192
3106
  "source",
1193
3107
  "track",
1194
3108
  "wbr"
1195
- ]), ar = new Set(/* @__PURE__ */ "address.article.aside.blockquote.div.dl.dt.dd.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.tbody.td.tfoot.th.thead.tr.ul".split(".")), or = 80, sr = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), cr = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), lr = (e) => Array.from(e.attributes).map((e) => ` ${e.name}="${sr(e.value)}"`).join(""), ur = (e) => " ".repeat(e), dr = (e, t, n) => {
1196
- let r = e.tagName.toLowerCase(), i = `<${r}${lr(e)}>`;
1197
- if (ir.has(r)) return i;
1198
- let a = n || r === "pre", o = fr(e, t + 1, a), s = `</${r}>`;
1199
- return a || !ar.has(r) ? `${i}${o}${s}` : Array.from(e.children).some((e) => ar.has(e.tagName.toLowerCase())) ? `${i}\n${fr(e, t + 1, !1, !0)}\n${ur(t)}${s}` : i.length + o.length + s.length > or ? `${i}\n${ur(t + 1)}${o}\n${ur(t)}${s}` : `${i}${o}${s}`;
1200
- }, fr = (e, t, n, r = !1) => {
3109
+ ]), Qa = new Set(/* @__PURE__ */ "address.article.aside.blockquote.div.dl.dt.dd.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.tbody.td.tfoot.th.thead.tr.ul".split(".")), $a = 80, eo = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;"), to = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), no = (e) => Array.from(e.attributes).map((e) => ` ${e.name}="${eo(e.value)}"`).join(""), ro = (e) => " ".repeat(e), io = (e, t, n) => {
3110
+ let r = e.tagName.toLowerCase(), i = `<${r}${no(e)}>`;
3111
+ if (Za.has(r)) return i;
3112
+ let a = n || r === "pre", o = ao(e, t + 1, a), s = `</${r}>`;
3113
+ return a || !Qa.has(r) ? `${i}${o}${s}` : Array.from(e.children).some((e) => Qa.has(e.tagName.toLowerCase())) ? `${i}\n${ao(e, t + 1, !1, !0)}\n${ro(t)}${s}` : i.length + o.length + s.length > $a ? `${i}\n${ro(t + 1)}${o}\n${ro(t)}${s}` : `${i}${o}${s}`;
3114
+ }, ao = (e, t, n, r = !1) => {
1201
3115
  let i = [];
1202
3116
  for (let r of Array.from(e.childNodes)) {
1203
3117
  if (r.nodeType === Node.TEXT_NODE) {
1204
3118
  let e = r.textContent ?? "";
1205
3119
  if (n) {
1206
- i.push(cr(e));
3120
+ i.push(to(e));
1207
3121
  continue;
1208
3122
  }
1209
- e.trim() && i.push(cr(e));
3123
+ e.trim() && i.push(to(e));
1210
3124
  continue;
1211
3125
  }
1212
3126
  if (r.nodeType === Node.COMMENT_NODE) {
1213
3127
  i.push(`<!--${r.data}-->`);
1214
3128
  continue;
1215
3129
  }
1216
- r.nodeType === Node.ELEMENT_NODE && i.push(dr(r, t, n));
3130
+ r.nodeType === Node.ELEMENT_NODE && i.push(io(r, t, n));
1217
3131
  }
1218
- return n || !r ? i.join("") : i.map((e) => `${ur(t)}${e}`).join("\n");
3132
+ return n || !r ? i.join("") : i.map((e) => `${ro(t)}${e}`).join("\n");
1219
3133
  };
1220
- function pr(e) {
1221
- return e.trim() ? fr(new DOMParser().parseFromString(te(e), "text/html").body, 0, !1, !0).trimEnd() : e;
3134
+ function oo(e) {
3135
+ return e.trim() ? ao(new DOMParser().parseFromString(Ni(e), "text/html").body, 0, !1, !0).trimEnd() : e;
1222
3136
  }
1223
3137
  //#endregion
1224
3138
  //#region src/components/Editor/utils/writeHtmlSource.ts
1225
- function mr(e) {
1226
- V().clear();
1227
- let t = Nt("html");
1228
- if (V().append(t), !e) return;
3139
+ function so(e) {
3140
+ L().clear();
3141
+ let t = St("html");
3142
+ if (L().append(t), !e) return;
1229
3143
  t.select();
1230
- let n = H();
1231
- U(n) && n.insertRawText(e);
3144
+ let n = R();
3145
+ z(n) && n.insertRawText(e);
1232
3146
  }
1233
3147
  //#endregion
1234
3148
  //#region src/components/Editor/plugins/SourceModePlugin.tsx
1235
- function hr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
1236
- let [r] = W(), [i, a] = R(!1), o = L(!1), s = L(n);
3149
+ function co({ children: e, maxLength: t, onMaxLengthExceed: n }) {
3150
+ let [r] = B(), [i, a] = P(!1), o = N(!1), s = N(n);
1237
3151
  s.current = n;
1238
- let c = tr(t) ? t : void 0, l = P(() => {
3152
+ let c = Ja(t) ? t : void 0, l = T(() => {
1239
3153
  if (o.current) return;
1240
3154
  let e = "", t = "";
1241
3155
  r.getEditorState().read(() => {
1242
- t = V().getTextContent(), e = ze(r, null);
3156
+ t = L().getTextContent(), e = he(r, null);
1243
3157
  }, { editor: r });
1244
- let n = ie(e, t) ? "" : T(e);
3158
+ let n = ei(e, t) ? "" : X(e);
1245
3159
  o.current = !0, a(!0), r.update(() => {
1246
- mr(pr(n));
1247
- }), r.dispatchCommand(rt, void 0);
1248
- }, [r]), u = P(() => {
3160
+ so(oo(n));
3161
+ }), r.dispatchCommand(Le, void 0);
3162
+ }, [r]), u = T(() => {
1249
3163
  if (!o.current) return;
1250
3164
  let e = !1;
1251
3165
  o.current = !1, r.update(() => {
1252
- ne(r, T(V().getTextContent())), c !== void 0 && (e = nr(r, c));
1253
- }), a(!1), r.dispatchCommand(rt, void 0), e && s.current?.();
1254
- }, [r, c]), d = P(() => {
3166
+ $r(r, X(L().getTextContent())), c !== void 0 && (e = Ya(r, c)), Dn(!0);
3167
+ }), a(!1), r.dispatchCommand(Le, void 0), e && s.current?.();
3168
+ }, [r, c]), d = T(() => {
1255
3169
  if (o.current) {
1256
3170
  u();
1257
3171
  return;
1258
3172
  }
1259
3173
  l();
1260
3174
  }, [l, u]);
1261
- F(() => {
3175
+ O(() => {
1262
3176
  let e = (e) => {
1263
3177
  if (!o.current) return !1;
1264
3178
  let t = "clipboardData" in e ? e.clipboardData : "dataTransfer" in e ? e.dataTransfer : null;
@@ -1266,53 +3180,53 @@ function hr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
1266
3180
  e.preventDefault();
1267
3181
  let n = t.getData("text/html") || t.getData("text/plain");
1268
3182
  if (!n) return !0;
1269
- let i = T(n);
3183
+ let i = X(n);
1270
3184
  return r.update(() => {
1271
- let e = H();
1272
- U(e) && i && e.insertRawText(i);
1273
- }, { tag: ht }), !0;
3185
+ let e = R();
3186
+ z(e) && i && e.insertRawText(i);
3187
+ }, { tag: $e }), !0;
1274
3188
  };
1275
- return Tt(r.registerNodeTransform(gt, () => {
3189
+ return Yt(r.registerNodeTransform(tt, () => {
1276
3190
  if (!o.current) return;
1277
- let e = V(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
1278
- q(t) && t.getLanguage() === "html" || mr(e.getTextContent());
1279
- }), r.registerCommand(mt, e, it), r.registerCommand(ct, e, it));
3191
+ let e = L(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
3192
+ V(t) && t.getLanguage() === "html" || so(e.getTextContent());
3193
+ }), r.registerCommand(Qe, e, Re), r.registerCommand(He, e, Re));
1280
3194
  }, [r]);
1281
- let f = I(() => ({
3195
+ let f = M(() => ({
1282
3196
  isSourceMode: i,
1283
3197
  isSourceModeRef: o,
1284
3198
  toggleSourceMode: d
1285
3199
  }), [i, d]);
1286
- return /* @__PURE__ */ M(ce.Provider, {
3200
+ return /* @__PURE__ */ y(Br.Provider, {
1287
3201
  value: f,
1288
3202
  children: e
1289
3203
  });
1290
3204
  }
1291
3205
  //#endregion
1292
3206
  //#region src/components/Editor/plugins/HeadingPlugin.tsx
1293
- function gr(e) {
3207
+ function lo(e) {
1294
3208
  let t = e.getTag();
1295
3209
  if (t === "h4" || t === "h5" || t === "h6") {
1296
- e.replace(Ue(), !0);
3210
+ e.replace(ye(), !0);
1297
3211
  return;
1298
3212
  }
1299
3213
  for (let t of e.getAllTextNodes()) {
1300
3214
  let e = t.getStyle();
1301
3215
  if (!e) continue;
1302
- let n = En(e, "font-size");
3216
+ let n = ya(e, "font-size");
1303
3217
  n !== e && t.setStyle(n);
1304
3218
  }
1305
3219
  }
1306
- function _r() {
1307
- let [e] = W();
1308
- return F(() => e.registerNodeTransform(Qt, gr), [e]), null;
3220
+ function uo() {
3221
+ let [e] = B();
3222
+ return O(() => e.registerNodeTransform(qt, lo), [e]), null;
1309
3223
  }
1310
3224
  //#endregion
1311
3225
  //#region src/components/Editor/LengthBadge.tsx
1312
- var vr = ({ current: e, maxLength: t }) => {
3226
+ var fo = ({ current: e, maxLength: t }) => {
1313
3227
  let n = e > t;
1314
- return /* @__PURE__ */ N("div", {
1315
- className: z(X["bsy-lexical-editor__length-badge"], n && X["bsy-lexical-editor__length-badge--exceeded"]),
3228
+ return /* @__PURE__ */ b("div", {
3229
+ className: I($["bsy-lexical-editor__length-badge"], n && $["bsy-lexical-editor__length-badge--exceeded"]),
1316
3230
  "aria-live": "polite",
1317
3231
  children: [
1318
3232
  e,
@@ -1321,33 +3235,33 @@ var vr = ({ current: e, maxLength: t }) => {
1321
3235
  ]
1322
3236
  });
1323
3237
  };
1324
- vr.displayName = "BsyLexicalEditorLengthBadge";
3238
+ fo.displayName = "BsyLexicalEditorLengthBadge";
1325
3239
  //#endregion
1326
3240
  //#region src/components/Editor/utils/unwrapTypesetFence.ts
1327
- var yr = /^\uFEFF/, br = /^ {0,3}`{1,3}[A-Za-z]*$/, xr = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Sr = /^ {0,3}```[ \t]*$/, Cr = /<\/?[a-zA-Z]/, wr = /<[a-zA-Z!]/, Tr = (e) => wr.test(e), Er = (e) => Cr.test(e), Dr = (e) => e.replace(yr, "").replace(/\r\n/g, "\n"), Or = (e) => {
3241
+ var po = /^\uFEFF/, mo = /^ {0,3}`{1,3}[A-Za-z]*$/, ho = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, go = /^ {0,3}```[ \t]*$/, _o = /<\/?[a-zA-Z]/, vo = /<[a-zA-Z!]/, yo = (e) => vo.test(e), bo = (e) => _o.test(e), xo = (e) => e.replace(po, "").replace(/\r\n/g, "\n"), So = (e) => {
1328
3242
  let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
1329
- return br.test(r) ? {
3243
+ return mo.test(r) ? {
1330
3244
  text: n === -1 ? "" : t.slice(0, n),
1331
3245
  withheld: !0
1332
3246
  } : {
1333
3247
  text: e,
1334
3248
  withheld: !1
1335
3249
  };
1336
- }, kr = (e) => {
1337
- let t = xr.exec(e);
3250
+ }, Co = (e) => {
3251
+ let t = ho.exec(e);
1338
3252
  return t ? { sameLineBody: t[4] ?? "" } : null;
1339
- }, Ar = (e) => {
3253
+ }, wo = (e) => {
1340
3254
  let t = e.replace(/[ \t]*```[ \t]*$/, "");
1341
3255
  return t === e ? e : t;
1342
- }, jr = (e) => Tr(e) ? e.replace(/^\n/, "") : "", Mr = (e) => {
3256
+ }, To = (e) => yo(e) ? e.replace(/^\n/, "") : "", Eo = (e) => {
1343
3257
  let t = e.split("\n"), n = [], r = 0;
1344
3258
  for (; r < t.length;) {
1345
- let e = t[r], i = kr(e);
3259
+ let e = t[r], i = Co(e);
1346
3260
  if (i) {
1347
3261
  let e = i.sameLineBody;
1348
- if (e !== Ar(e)) {
1349
- e = Ar(e);
1350
- let i = jr(t.slice(r + 1).join("\n"));
3262
+ if (e !== wo(e)) {
3263
+ e = wo(e);
3264
+ let i = To(t.slice(r + 1).join("\n"));
1351
3265
  return [
1352
3266
  ...n,
1353
3267
  e,
@@ -1355,38 +3269,38 @@ var yr = /^\uFEFF/, br = /^ {0,3}`{1,3}[A-Za-z]*$/, xr = /^( {0,3})([^`<]*?)```[
1355
3269
  ].filter(Boolean).join("\n");
1356
3270
  }
1357
3271
  let a = [];
1358
- for (e && a.push(e), r += 1; r < t.length && !Sr.test(t[r]);) a.push(t[r]), r += 1;
1359
- let o = r < t.length ? jr(t.slice(r + 1).join("\n")) : "";
3272
+ for (e && a.push(e), r += 1; r < t.length && !go.test(t[r]);) a.push(t[r]), r += 1;
3273
+ let o = r < t.length ? To(t.slice(r + 1).join("\n")) : "";
1360
3274
  return [
1361
3275
  ...n,
1362
3276
  a.join("\n"),
1363
3277
  o
1364
3278
  ].filter(Boolean).join("\n");
1365
3279
  }
1366
- if (Er(e)) return Nr([...n, ...t.slice(r)].join("\n"));
1367
- Tr(e) && n.push(e), r += 1;
3280
+ if (bo(e)) return Do([...n, ...t.slice(r)].join("\n"));
3281
+ yo(e) && n.push(e), r += 1;
1368
3282
  }
1369
3283
  return n.length ? n.join("\n") : null;
1370
- }, Nr = (e) => {
3284
+ }, Do = (e) => {
1371
3285
  let t = e.split("\n");
1372
3286
  if (!t.length) return e;
1373
- let n = kr(t[0]);
1374
- return n && !Er(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Ar(n.sameLineBody))), t.length && Sr.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
3287
+ let n = Co(t[0]);
3288
+ return n && !bo(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(wo(n.sameLineBody))), t.length && go.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
1375
3289
  };
1376
- function Pr(e) {
3290
+ function Oo(e) {
1377
3291
  if (!e) return {
1378
3292
  html: "",
1379
3293
  pending: !1
1380
3294
  };
1381
- let { text: t, withheld: n } = Or(Dr(e));
3295
+ let { text: t, withheld: n } = So(xo(e));
1382
3296
  if (!t.trim()) return {
1383
3297
  html: "",
1384
- pending: n || br.test(Dr(e).trim())
3298
+ pending: n || mo.test(xo(e).trim())
1385
3299
  };
1386
- let r = Mr(t) ?? t, i = Mr(r);
3300
+ let r = Eo(t) ?? t, i = Eo(r);
1387
3301
  i !== null && i !== r && (r = i);
1388
3302
  let a = r.trim();
1389
- return Tr(a) ? {
3303
+ return yo(a) ? {
1390
3304
  html: a,
1391
3305
  pending: !1
1392
3306
  } : {
@@ -1396,32 +3310,32 @@ function Pr(e) {
1396
3310
  }
1397
3311
  //#endregion
1398
3312
  //#region src/components/Editor/utils/prepareTypesetProposed.ts
1399
- var Fr = "p, h1, h2, h3, li", Ir = /background(-color)?\s*:/i;
1400
- function Lr(e) {
1401
- if (!e.trim() || !Ir.test(e)) return e;
1402
- let t = se(e);
3313
+ var ko = "p, h1, h2, h3, li", Ao = /background(-color)?\s*:/i;
3314
+ function jo(e) {
3315
+ if (!e.trim() || !Ao.test(e)) return e;
3316
+ let t = pi(e);
1403
3317
  if (!t) return e;
1404
- for (let e of Array.from(t.querySelectorAll(Fr))) {
3318
+ for (let e of Array.from(t.querySelectorAll(ko))) {
1405
3319
  let t = e;
1406
3320
  t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
1407
3321
  }
1408
3322
  return t.innerHTML;
1409
3323
  }
1410
- function Rr(e, t) {
1411
- let { html: n } = Pr(e);
1412
- return n ? Lr(ee(n, t)) : "";
3324
+ function Mo(e, t) {
3325
+ let { html: n } = Oo(e);
3326
+ return n ? jo(hi(n, t)) : "";
1413
3327
  }
1414
3328
  //#endregion
1415
3329
  //#region src/components/Editor/utils/applyAiTypeset.ts
1416
- function zr(e, t, n, r) {
1417
- let i = T(Rr(t, n));
1418
- if (!i.trim() || ie(i, "")) return {
3330
+ function No(e, t, n, r) {
3331
+ let i = X(Mo(t, n));
3332
+ if (!i.trim() || ei(i, "")) return {
1419
3333
  applied: !1,
1420
3334
  truncated: !1
1421
3335
  };
1422
3336
  let a = !1;
1423
3337
  return e.update(() => {
1424
- ne(e, i), tr(r) && (a = nr(e, r));
3338
+ $r(e, i), Ja(r) && (a = Ya(e, r)), Dn(!0);
1425
3339
  }, { discrete: !0 }), {
1426
3340
  applied: !0,
1427
3341
  truncated: a
@@ -1429,26 +3343,26 @@ function zr(e, t, n, r) {
1429
3343
  }
1430
3344
  //#endregion
1431
3345
  //#region src/components/Editor/Preview/Thinking.tsx
1432
- var Br = [
3346
+ var Po = [
1433
3347
  .26,
1434
3348
  .02,
1435
3349
  .23,
1436
3350
  .94
1437
- ], Vr = () => {
1438
- let e = `${we().replace(/:/g, "")}g`;
1439
- return /* @__PURE__ */ M("span", {
1440
- className: j["bsy-lexical-ai__think-icon"],
3351
+ ], Fo = () => {
3352
+ let e = `${k().replace(/:/g, "")}g`;
3353
+ return /* @__PURE__ */ y("span", {
3354
+ className: Q["bsy-lexical-ai__think-icon"],
1441
3355
  "aria-hidden": "true",
1442
- children: /* @__PURE__ */ N("svg", {
3356
+ children: /* @__PURE__ */ b("svg", {
1443
3357
  xmlns: "http://www.w3.org/2000/svg",
1444
3358
  width: "16",
1445
3359
  height: "16",
1446
3360
  viewBox: "0 0 16 16",
1447
3361
  fill: "none",
1448
- children: [/* @__PURE__ */ M("path", {
3362
+ children: [/* @__PURE__ */ y("path", {
1449
3363
  d: "M6.33965 13.3C6.27366 13.4143 6.23082 13.5404 6.21357 13.6712C6.19633 13.802 6.20502 13.9349 6.23914 14.0624C6.30806 14.3198 6.47641 14.5392 6.70715 14.6725C6.93788 14.8058 7.21211 14.8419 7.46951 14.773C7.59696 14.7389 7.71644 14.68 7.82112 14.5997C7.92581 14.5194 8.01366 14.4193 8.07965 14.305C8.21292 14.0743 8.24907 13.8 8.18015 13.5426C8.11123 13.2852 7.94288 13.0658 7.71215 12.9325C7.48141 12.7992 7.20718 12.7631 6.94978 12.832C6.69239 12.9009 6.47292 13.0693 6.33965 13.3ZM8.97265 1C7.44126 0.999778 5.95165 1.4994 4.73011 2.42295C3.69009 3.20927 2.89277 4.26631 2.4213 5.47246C2.33326 5.69768 2.00678 5.72579 1.89765 5.51L1.80165 5.356C1.64959 5.15708 1.42869 5.02215 1.18228 4.97769C0.935881 4.93323 0.681756 4.98244 0.469763 5.11567C0.25777 5.24891 0.103209 5.45654 0.0364008 5.69785C-0.0304072 5.93915 -0.00464041 6.19671 0.108646 6.42L1.34765 8.852L1.45565 9.032C1.86065 9.598 2.61765 9.782 3.23665 9.467L5.62665 8.25L5.78165 8.153C5.98057 8.00094 6.11549 7.78004 6.15995 7.53364C6.20442 7.28723 6.1552 7.03311 6.02197 6.82112C5.88874 6.60912 5.68111 6.45456 5.4398 6.38775C5.19849 6.32095 4.94093 6.34671 4.71765 6.46C4.48237 6.579 4.22662 6.36717 4.32655 6.12317C4.56067 5.55153 4.899 5.02613 5.32623 4.57461C5.90933 3.95836 6.63902 3.49984 7.44723 3.24183C8.25544 2.98382 9.11583 2.93472 9.94815 3.09912C10.7805 3.26352 11.5576 3.63606 12.207 4.18198C12.8564 4.7279 13.357 5.42942 13.662 6.22109C13.967 7.01276 14.0665 7.86879 13.9512 8.70932C13.836 9.54985 13.5097 10.3475 13.0028 11.0278C12.496 11.7082 11.8251 12.249 11.0526 12.6C10.9326 12.654 10.7796 12.71 10.5976 12.766C10.3241 12.8507 10.0934 13.0371 9.95295 13.2867C9.81252 13.5363 9.77305 13.8302 9.84265 14.108C9.90673 14.3421 10.0611 14.5412 10.2718 14.6615C10.4826 14.7819 10.7325 14.8137 10.9666 14.75C11.2736 14.666 11.5226 14.584 11.7136 14.503C13.2066 13.8705 14.435 12.7413 15.1908 11.3067C15.9466 9.87221 16.1832 8.22052 15.8607 6.63149C15.5381 5.04246 14.6762 3.61377 13.4209 2.58747C12.1656 1.56117 10.5941 1.00034 8.97265 1ZM4.16665 10.876C3.90024 10.876 3.64474 10.9818 3.45636 11.1702C3.26798 11.3586 3.16215 11.6141 3.16215 11.8805C3.16215 12.1469 3.26798 12.4024 3.45636 12.5908C3.64474 12.7792 3.90024 12.885 4.16665 12.885C4.43306 12.885 4.68855 12.7792 4.87694 12.5908C5.06532 12.4024 5.17115 12.1469 5.17115 11.8805C5.17115 11.6141 5.06532 11.3586 4.87694 11.1702C4.68855 10.9818 4.43306 10.876 4.16665 10.876Z",
1450
3364
  fill: `url(#${e})`
1451
- }), /* @__PURE__ */ M("defs", { children: /* @__PURE__ */ N("linearGradient", {
3365
+ }), /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ b("linearGradient", {
1452
3366
  id: e,
1453
3367
  x1: "8.00059",
1454
3368
  y1: "1",
@@ -1456,12 +3370,12 @@ var Br = [
1456
3370
  y2: "14.8072",
1457
3371
  gradientUnits: "userSpaceOnUse",
1458
3372
  children: [
1459
- /* @__PURE__ */ M("stop", { stopColor: "#0265FF" }),
1460
- /* @__PURE__ */ M("stop", {
3373
+ /* @__PURE__ */ y("stop", { stopColor: "#0265FF" }),
3374
+ /* @__PURE__ */ y("stop", {
1461
3375
  offset: "1",
1462
3376
  stopColor: "#A6FFFF"
1463
3377
  }),
1464
- /* @__PURE__ */ M("animateTransform", {
3378
+ /* @__PURE__ */ y("animateTransform", {
1465
3379
  attributeName: "gradientTransform",
1466
3380
  type: "rotate",
1467
3381
  from: "0 8 8",
@@ -1474,15 +3388,15 @@ var Br = [
1474
3388
  })
1475
3389
  });
1476
3390
  };
1477
- function Hr(e, t, r) {
1478
- let { t: i } = n(), a = e.status === "loading" && !t, [o, s] = R(!0), [c, l] = R(0), u = L(Date.now()), d = L(null), f = L(!1), p = L(!1), m = e.reasoning ?? "", h = a || o, g = (a || !!m) && !(e.status === "error" && !m), _ = (e) => {
3391
+ function Io(e, t, n) {
3392
+ let { t: r } = a(), i = e.status === "loading" && !t, [o, s] = P(!0), [c, l] = P(0), u = N(Date.now()), d = N(null), f = N(!1), p = N(!1), m = e.reasoning ?? "", h = i || o, g = (i || !!m) && !(e.status === "error" && !m), _ = (e) => {
1479
3393
  !e || !p.current || (p.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (f.current = !0));
1480
- }, v = P(() => r?.current ?? void 0, [r]), y = P(() => {
3394
+ }, v = T(() => n?.current ?? void 0, [n]), y = T(() => {
1481
3395
  let e = v();
1482
3396
  return e?.closest("[data-overlayscrollbars]") ?? e;
1483
3397
  }, [v]);
1484
- return F(() => {
1485
- if (!a) {
3398
+ return O(() => {
3399
+ if (!i) {
1486
3400
  d.current === null && (d.current = Math.max(1, Math.round((Date.now() - u.current) / 1e3)), l(d.current)), s(!1);
1487
3401
  return;
1488
3402
  }
@@ -1491,62 +3405,62 @@ function Hr(e, t, r) {
1491
3405
  l(Math.max(1, Math.round((Date.now() - u.current) / 1e3)));
1492
3406
  }, 500);
1493
3407
  return () => window.clearInterval(e);
1494
- }, [a]), F(() => {
3408
+ }, [i]), O(() => {
1495
3409
  p.current = !1;
1496
- }, [Oe()]), ke("wheel", () => {
3410
+ }, [re()]), ie("wheel", () => {
1497
3411
  p.current = !0;
1498
3412
  }, {
1499
3413
  target: y,
1500
3414
  passive: !0,
1501
- enable: a
1502
- }), ke("pointerdown", (e) => {
3415
+ enable: i
3416
+ }), ie("pointerdown", (e) => {
1503
3417
  let t = e.target;
1504
3418
  t instanceof Element && t.closest(".os-scrollbar") && (p.current = !0);
1505
3419
  }, {
1506
3420
  target: y,
1507
3421
  passive: !0,
1508
- enable: a
1509
- }), ke("scroll", () => _(v()), {
3422
+ enable: i
3423
+ }), ie("scroll", () => _(v()), {
1510
3424
  target: v,
1511
3425
  passive: !0,
1512
- enable: a
1513
- }), F(() => {
1514
- if (!a || f.current || !r?.current) return;
3426
+ enable: i
3427
+ }), O(() => {
3428
+ if (!i || f.current || !n?.current) return;
1515
3429
  let e = window.requestAnimationFrame(() => {
1516
3430
  if (f.current) return;
1517
- let e = r?.current;
3431
+ let e = n?.current;
1518
3432
  e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
1519
3433
  });
1520
3434
  return () => window.cancelAnimationFrame(e);
1521
3435
  }, [
1522
3436
  m,
1523
- r,
1524
- a
3437
+ n,
3438
+ i
1525
3439
  ]), {
1526
3440
  visible: g,
1527
- thinking: a,
3441
+ thinking: i,
1528
3442
  open: h,
1529
- label: a ? i("editor.aiThinking") : i("editor.aiThoughtSeconds", { seconds: c }),
3443
+ label: i ? r("editor.aiThinking") : r("editor.aiThoughtSeconds", { seconds: c }),
1530
3444
  reasoning: m,
1531
3445
  toggle: () => s((e) => !e),
1532
- onViewportScroll: () => _(r?.current)
3446
+ onViewportScroll: () => _(n?.current)
1533
3447
  };
1534
3448
  }
1535
- var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
3449
+ var Lo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
1536
3450
  type: "button",
1537
- className: j["bsy-lexical-ai__think-head"],
3451
+ className: Q["bsy-lexical-ai__think-head"],
1538
3452
  disabled: t.thinking,
1539
3453
  onClick: t.toggle,
1540
- children: [t.thinking ? /* @__PURE__ */ M(Vr, {}) : /* @__PURE__ */ M(e, {
3454
+ children: [t.thinking ? /* @__PURE__ */ y(Fo, {}) : /* @__PURE__ */ y(e, {
1541
3455
  name: "arrow-down",
1542
3456
  size: 12,
1543
- className: z(j["bsy-lexical-ai__think-arrow"], t.open && j["bsy-lexical-ai__think-arrow--open"])
1544
- }), /* @__PURE__ */ M("span", {
1545
- className: j["bsy-lexical-ai__think-label"],
1546
- children: /* @__PURE__ */ M(Ae, {
3457
+ className: I(Q["bsy-lexical-ai__think-arrow"], t.open && Q["bsy-lexical-ai__think-arrow--open"])
3458
+ }), /* @__PURE__ */ y("span", {
3459
+ className: Q["bsy-lexical-ai__think-label"],
3460
+ children: /* @__PURE__ */ y(ae, {
1547
3461
  mode: "popLayout",
1548
3462
  initial: !1,
1549
- children: /* @__PURE__ */ M(je.span, {
3463
+ children: /* @__PURE__ */ y(oe.span, {
1550
3464
  initial: {
1551
3465
  opacity: 0,
1552
3466
  y: 6
@@ -1561,30 +3475,30 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1561
3475
  },
1562
3476
  transition: {
1563
3477
  duration: .22,
1564
- ease: Br
3478
+ ease: Po
1565
3479
  },
1566
- children: /* @__PURE__ */ M("span", {
1567
- className: t.thinking ? j["bsy-lexical-ai__think-label--shimmer"] : void 0,
3480
+ children: /* @__PURE__ */ y("span", {
3481
+ className: t.thinking ? Q["bsy-lexical-ai__think-label--shimmer"] : void 0,
1568
3482
  children: t.label
1569
3483
  })
1570
3484
  }, t.label)
1571
3485
  })
1572
3486
  })]
1573
- }) : null, Wr = ({ model: e }) => {
1574
- let [t, n] = R(!0), r = Ce(e.reasoning);
1575
- if (F(() => {
3487
+ }) : null, Ro = ({ model: e }) => {
3488
+ let [t, n] = P(!0), r = D(e.reasoning);
3489
+ if (O(() => {
1576
3490
  e.open || n(!0);
1577
3491
  }, [e.open]), !e.visible) return null;
1578
- let i = /* @__PURE__ */ M("div", {
1579
- className: j["bsy-lexical-ai__think-body"],
3492
+ let i = /* @__PURE__ */ y("div", {
3493
+ className: Q["bsy-lexical-ai__think-body"],
1580
3494
  children: r
1581
3495
  });
1582
- return !t && e.open && e.reasoning ? /* @__PURE__ */ M("div", {
1583
- className: z(j["bsy-lexical-ai__think-collapse"], j["bsy-lexical-ai__think-collapse--grown"]),
3496
+ return !t && e.open && e.reasoning ? /* @__PURE__ */ y("div", {
3497
+ className: I(Q["bsy-lexical-ai__think-collapse"], Q["bsy-lexical-ai__think-collapse--grown"]),
1584
3498
  children: i
1585
- }) : /* @__PURE__ */ M(Ae, {
3499
+ }) : /* @__PURE__ */ y(ae, {
1586
3500
  initial: !1,
1587
- children: e.open && e.reasoning ? /* @__PURE__ */ M(je.div, {
3501
+ children: e.open && e.reasoning ? /* @__PURE__ */ y(oe.div, {
1588
3502
  initial: {
1589
3503
  height: 0,
1590
3504
  opacity: 0
@@ -1608,64 +3522,80 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1608
3522
  onAnimationComplete: () => {
1609
3523
  e.open && n(!1);
1610
3524
  },
1611
- className: j["bsy-lexical-ai__think-collapse"],
3525
+ className: Q["bsy-lexical-ai__think-collapse"],
1612
3526
  children: i
1613
3527
  }, "think-body") : null
1614
3528
  });
1615
- }, Gr = ({ html: e }) => {
1616
- let [t, n] = R(() => e && !D(e) ? T(e) : "");
1617
- return F(() => {
1618
- !e || D(e) || n(T(e));
1619
- }, [e]), t ? /* @__PURE__ */ M("div", {
1620
- className: z("bsy-lexical-editor", j["bsy-lexical-ai__html"]),
1621
- dangerouslySetInnerHTML: { __html: t }
1622
- }) : null;
1623
- }, Kr = {
3529
+ }, zo = "\n:host {\n all: initial;\n display: block;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n}\n.bsy-editor-html-preview__body {\n color: #030303;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;\n font-size: 15px;\n line-height: 1.6;\n word-break: break-word;\n}\n.bsy-editor-html-preview__body p {\n margin: 0;\n}\n.bsy-editor-html-preview__body .editor-text-bold {\n font-weight: 700;\n}\n.bsy-editor-html-preview__body .editor-text-italic {\n font-style: italic;\n}\n.bsy-editor-html-preview__body .editor-text-underline {\n text-decoration: underline;\n}\n.bsy-editor-html-preview__body .editor-text-strikethrough {\n text-decoration: line-through;\n}\n.bsy-editor-html-preview__body .editor-text-underline-strikethrough {\n text-decoration: underline line-through;\n}\n.bsy-editor-html-preview__body sup,\n.bsy-editor-html-preview__body sub {\n display: inline-block;\n position: static;\n top: auto;\n bottom: auto;\n font-size: 0.75em;\n line-height: 1;\n}\n.bsy-editor-html-preview__body sup {\n vertical-align: super;\n}\n.bsy-editor-html-preview__body sub {\n vertical-align: sub;\n}\n.bsy-editor-html-preview__body .editor-heading-h1,\n.bsy-editor-html-preview__body .editor-heading-h2,\n.bsy-editor-html-preview__body .editor-heading-h3,\n.bsy-editor-html-preview__body .editor-heading-h4,\n.bsy-editor-html-preview__body .editor-heading-h5,\n.bsy-editor-html-preview__body .editor-heading-h6 {\n margin: 0.6em 0 0.4em;\n font-weight: 600;\n line-height: 1.35;\n}\n.bsy-editor-html-preview__body .editor-heading-h1 {\n font-size: 2em;\n}\n.bsy-editor-html-preview__body .editor-heading-h2 {\n font-size: 1.5em;\n}\n.bsy-editor-html-preview__body .editor-heading-h3 {\n font-size: 1.25em;\n}\n.bsy-editor-html-preview__body .editor-heading-h4 {\n font-size: 1.125em;\n}\n.bsy-editor-html-preview__body .editor-heading-h5 {\n font-size: 1em;\n}\n.bsy-editor-html-preview__body .editor-heading-h6 {\n font-size: 0.875em;\n}\n.bsy-editor-html-preview__body .editor-list-ul,\n.bsy-editor-html-preview__body .editor-list-ol {\n margin: 0;\n padding-inline-start: 24px;\n list-style-position: outside;\n}\n.bsy-editor-html-preview__body .editor-list-ul {\n list-style-type: disc;\n}\n.bsy-editor-html-preview__body .editor-list-ol {\n list-style-type: decimal;\n}\n.bsy-editor-html-preview__body .editor-listitem {\n margin: 0;\n list-style: inherit;\n}\n.bsy-editor-html-preview__body .editor-nested-listitem {\n list-style-type: none;\n}\n.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul {\n list-style-type: circle;\n}\n.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul .editor-list-ul {\n list-style-type: square;\n}\n.bsy-editor-html-preview__body .editor-link,\n.bsy-editor-html-preview__body .editor-link:link,\n.bsy-editor-html-preview__body .editor-link:visited,\n.bsy-editor-html-preview__body .editor-link:hover,\n.bsy-editor-html-preview__body .editor-link:active,\n.bsy-editor-html-preview__body .editor-link:focus {\n color: #0269ff;\n cursor: pointer;\n}\n.bsy-editor-html-preview__body .editor-link * {\n color: #0269ff !important;\n}\n.bsy-editor-html-preview__body pre,\n.bsy-editor-html-preview__body .editor-code {\n display: block;\n box-sizing: border-box;\n max-width: 100%;\n margin: 8px 0;\n padding: 8px 12px;\n overflow-x: auto;\n border-radius: 4px;\n background: rgb(240, 242, 245);\n color: #1f2328;\n font-family: Menlo, Consolas, Monaco, monospace;\n font-size: 13px;\n line-height: 1.53;\n tab-size: 2;\n white-space: pre;\n}\n.bsy-editor-html-preview__body .editor-table-scrollable-wrapper {\n max-width: 100%;\n margin: 8px 0;\n overflow-x: auto;\n}\n.bsy-editor-html-preview__body table {\n width: max-content;\n min-width: 100%;\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n}\n.bsy-editor-html-preview__body td,\n.bsy-editor-html-preview__body th {\n box-sizing: border-box;\n min-width: 75px;\n min-height: 32px;\n padding: 4px 8px;\n border: 1px solid #d9d9d9;\n vertical-align: top;\n}\n.bsy-editor-html-preview__body th {\n background: #f2f3f5;\n font-weight: 600;\n}\n.bsy-editor-html-preview__body img {\n max-width: 100%;\n height: auto;\n vertical-align: baseline;\n}\n", Bo = ({ html: e }) => {
3530
+ let t = N(null);
3531
+ return j(() => {
3532
+ let n = t.current;
3533
+ if (!n) return;
3534
+ let r = n.shadowRoot ?? n.attachShadow({ mode: "open" }), i = document.createElement("div");
3535
+ i.className = "bsy-editor-html-preview__body", i.innerHTML = X(e);
3536
+ for (let e of Array.from(i.querySelectorAll("table"))) {
3537
+ if (e.parentElement?.classList.contains("editor-table-scrollable-wrapper")) continue;
3538
+ let t = document.createElement("div");
3539
+ t.className = "editor-table-scrollable-wrapper", e.replaceWith(t), t.append(e);
3540
+ }
3541
+ r.replaceChildren();
3542
+ let a = document.createElement("style");
3543
+ a.textContent = zo, r.append(a, i);
3544
+ }, [e]), /* @__PURE__ */ y("div", {
3545
+ ref: t,
3546
+ className: "bsy-editor-html-preview"
3547
+ });
3548
+ }, Vo = ({ html: e }) => {
3549
+ let [t, n] = P(() => e && !Yr(e) ? e : "");
3550
+ return O(() => {
3551
+ !e || Yr(e) || n(e);
3552
+ }, [e]), t ? /* @__PURE__ */ y(Bo, { html: t }) : null;
3553
+ }, Ho = {
1624
3554
  paddingAbsolute: !0,
1625
3555
  overflow: {
1626
3556
  x: "hidden",
1627
3557
  y: "scroll"
1628
3558
  }
1629
- }, qr = ({ status: r, reasoning: o, errorMessage: s, originalHtml: c, proposedHtml: l, preset: u, onPresetChange: d, onCancel: f, onApply: p }) => {
1630
- let { t: m } = n(), [h, g] = R(!0), _ = L(null), v = !!l.trim(), y = r === "ready" && v, b = Hr({
1631
- status: r,
1632
- reasoning: o
1633
- }, v, _), S = E.map((e) => ({
3559
+ }, Uo = ({ status: t, reasoning: n, errorMessage: i, originalHtml: o, proposedHtml: s, preset: c, onPresetChange: l, onCancel: d, onApply: p }) => {
3560
+ let { t: m } = a(), [h, g] = P(!0), _ = N(null), v = !!s.trim(), x = t === "ready" && v, S = Io({
3561
+ status: t,
3562
+ reasoning: n
3563
+ }, v, _), C = qr.map((e) => ({
1634
3564
  key: e,
1635
- label: m(x[e])
3565
+ label: m(Jr[e])
1636
3566
  }));
1637
- return /* @__PURE__ */ M(t, {
3567
+ return /* @__PURE__ */ y(r, {
1638
3568
  title: m("editor.aiPolish"),
1639
3569
  open: h,
1640
3570
  width: "800px",
1641
3571
  fullSwitch: !0,
1642
- afterClose: f,
3572
+ afterClose: d,
1643
3573
  onOpenChange: g,
1644
- children: /* @__PURE__ */ N("div", {
1645
- className: j["bsy-lexical-ai__dialog"],
1646
- children: [/* @__PURE__ */ N("div", {
1647
- className: j["bsy-lexical-ai__pane"],
1648
- children: [/* @__PURE__ */ N("div", {
1649
- className: j["bsy-lexical-ai__column"],
1650
- children: [/* @__PURE__ */ N("div", {
1651
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
1652
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOriginal")]
1653
- }), /* @__PURE__ */ M(i, {
1654
- className: j["bsy-lexical-ai__column-body"],
1655
- options: Kr,
1656
- children: /* @__PURE__ */ M(Gr, { html: c })
3574
+ children: /* @__PURE__ */ b("div", {
3575
+ className: Q["bsy-lexical-ai__dialog"],
3576
+ children: [/* @__PURE__ */ b("div", {
3577
+ className: Q["bsy-lexical-ai__pane"],
3578
+ children: [/* @__PURE__ */ b("div", {
3579
+ className: Q["bsy-lexical-ai__column"],
3580
+ children: [/* @__PURE__ */ b("div", {
3581
+ className: I(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--before"]),
3582
+ children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), m("editor.aiOriginal")]
3583
+ }), /* @__PURE__ */ y(u, {
3584
+ className: Q["bsy-lexical-ai__column-body"],
3585
+ options: Ho,
3586
+ children: /* @__PURE__ */ y(Vo, { html: o })
1657
3587
  })]
1658
- }), /* @__PURE__ */ N("div", {
1659
- className: j["bsy-lexical-ai__column"],
1660
- children: [/* @__PURE__ */ N("div", {
1661
- className: j["bsy-lexical-ai__column-head"],
1662
- children: [/* @__PURE__ */ N("div", {
1663
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
1664
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOptimized")]
1665
- }), /* @__PURE__ */ M(a, {
1666
- menus: S,
3588
+ }), /* @__PURE__ */ b("div", {
3589
+ className: Q["bsy-lexical-ai__column"],
3590
+ children: [/* @__PURE__ */ b("div", {
3591
+ className: Q["bsy-lexical-ai__column-head"],
3592
+ children: [/* @__PURE__ */ b("div", {
3593
+ className: I(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--after"]),
3594
+ children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), m("editor.aiOptimized")]
3595
+ }), /* @__PURE__ */ y(f, {
3596
+ menus: C,
1667
3597
  showSearch: !1,
1668
- activeKey: [u],
3598
+ activeKey: [c],
1669
3599
  offset: {
1670
3600
  x: 0,
1671
3601
  y: 4
@@ -1674,119 +3604,119 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1674
3604
  width: 90,
1675
3605
  minWidth: 90
1676
3606
  },
1677
- onClick: (e) => d(e.key),
1678
- children: /* @__PURE__ */ N("button", {
3607
+ onClick: (e) => l(e.key),
3608
+ children: /* @__PURE__ */ b("button", {
1679
3609
  type: "button",
1680
- className: j["bsy-lexical-ai__preset"],
3610
+ className: Q["bsy-lexical-ai__preset"],
1681
3611
  title: m("editor.aiPolish"),
1682
- children: [m(x[u]), /* @__PURE__ */ M(e, {
3612
+ children: [m(Jr[c]), /* @__PURE__ */ y(e, {
1683
3613
  name: "arrow-down",
1684
3614
  size: 16
1685
3615
  })]
1686
3616
  })
1687
3617
  })]
1688
- }), /* @__PURE__ */ N("div", {
1689
- className: j["bsy-lexical-ai__column-stack"],
1690
- children: [b.visible ? /* @__PURE__ */ M("div", {
1691
- className: j["bsy-lexical-ai__think-pin"],
1692
- children: /* @__PURE__ */ M(Ur, { model: b })
1693
- }) : null, /* @__PURE__ */ N(i, {
1694
- className: j["bsy-lexical-ai__column-body"],
1695
- options: Kr,
3618
+ }), /* @__PURE__ */ b("div", {
3619
+ className: Q["bsy-lexical-ai__column-stack"],
3620
+ children: [S.visible ? /* @__PURE__ */ y("div", {
3621
+ className: Q["bsy-lexical-ai__think-pin"],
3622
+ children: /* @__PURE__ */ y(Lo, { model: S })
3623
+ }) : null, /* @__PURE__ */ b(u, {
3624
+ className: Q["bsy-lexical-ai__column-body"],
3625
+ options: Ho,
1696
3626
  viewportRef: _,
1697
- onScroll: b.onViewportScroll,
1698
- children: [r === "error" ? /* @__PURE__ */ M("div", {
1699
- className: j["bsy-lexical-ai__error"],
1700
- children: s || m("editor.aiError")
1701
- }) : /* @__PURE__ */ M(Wr, { model: b }), v ? /* @__PURE__ */ M(Gr, { html: l }) : null]
3627
+ onScroll: S.onViewportScroll,
3628
+ children: [t === "error" ? /* @__PURE__ */ y("div", {
3629
+ className: Q["bsy-lexical-ai__error"],
3630
+ children: i || m("editor.aiError")
3631
+ }) : /* @__PURE__ */ y(Ro, { model: S }), v ? /* @__PURE__ */ y(Vo, { html: s }) : null]
1702
3632
  })]
1703
3633
  })]
1704
3634
  })]
1705
- }), /* @__PURE__ */ N("div", {
1706
- className: j["bsy-lexical-ai__footer"],
1707
- children: [/* @__PURE__ */ M(Ee, {
3635
+ }), /* @__PURE__ */ b("div", {
3636
+ className: Q["bsy-lexical-ai__footer"],
3637
+ children: [/* @__PURE__ */ y(F, {
1708
3638
  onClick: () => g(!1),
1709
3639
  children: m("editor.aiAbandon")
1710
- }), /* @__PURE__ */ M(Ee, {
3640
+ }), /* @__PURE__ */ y(F, {
1711
3641
  type: "primary",
1712
- disabled: !y,
3642
+ disabled: !x,
1713
3643
  onClick: () => p() && g(!1),
1714
3644
  children: m("editor.aiApply")
1715
3645
  })]
1716
3646
  })]
1717
3647
  })
1718
3648
  });
1719
- }, Jr = {
3649
+ }, Wo = {
1720
3650
  paddingAbsolute: !0,
1721
3651
  overflow: {
1722
3652
  x: "hidden",
1723
3653
  y: "scroll"
1724
3654
  }
1725
- }, Yr = ({ status: e, reasoning: r, errorMessage: a, originalHtml: o, proposedHtml: s, onCancel: c, onApply: l }) => {
1726
- let { t: u } = n(), [d, f] = R(!0), p = L(null), m = !!s.trim(), h = e === "ready" && m, g = Hr({
3655
+ }, Go = ({ status: e, reasoning: t, errorMessage: n, originalHtml: i, proposedHtml: o, onCancel: s, onApply: c }) => {
3656
+ let { t: l } = a(), [d, f] = P(!0), p = N(null), m = !!o.trim(), h = e === "ready" && m, g = Io({
1727
3657
  status: e,
1728
- reasoning: r
3658
+ reasoning: t
1729
3659
  }, m, p);
1730
- return /* @__PURE__ */ M(t, {
1731
- title: u("editor.aiPreview"),
3660
+ return /* @__PURE__ */ y(r, {
3661
+ title: l("editor.aiPreview"),
1732
3662
  open: d,
1733
3663
  width: "800px",
1734
3664
  fullSwitch: !0,
1735
- afterClose: c,
3665
+ afterClose: s,
1736
3666
  onOpenChange: f,
1737
- children: /* @__PURE__ */ N("div", {
1738
- className: j["bsy-lexical-ai__dialog"],
1739
- children: [/* @__PURE__ */ N("div", {
1740
- className: j["bsy-lexical-ai__pane"],
1741
- children: [/* @__PURE__ */ N("div", {
1742
- className: j["bsy-lexical-ai__column"],
1743
- children: [/* @__PURE__ */ N("div", {
1744
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
1745
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOriginal")]
1746
- }), /* @__PURE__ */ M(i, {
1747
- className: j["bsy-lexical-ai__column-body"],
1748
- options: Jr,
1749
- children: /* @__PURE__ */ M(Gr, { html: o })
3667
+ children: /* @__PURE__ */ b("div", {
3668
+ className: Q["bsy-lexical-ai__dialog"],
3669
+ children: [/* @__PURE__ */ b("div", {
3670
+ className: Q["bsy-lexical-ai__pane"],
3671
+ children: [/* @__PURE__ */ b("div", {
3672
+ className: Q["bsy-lexical-ai__column"],
3673
+ children: [/* @__PURE__ */ b("div", {
3674
+ className: I(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--before"]),
3675
+ children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), l("editor.aiOriginal")]
3676
+ }), /* @__PURE__ */ y(u, {
3677
+ className: Q["bsy-lexical-ai__column-body"],
3678
+ options: Wo,
3679
+ children: /* @__PURE__ */ y(Vo, { html: i })
1750
3680
  })]
1751
- }), /* @__PURE__ */ N("div", {
1752
- className: j["bsy-lexical-ai__column"],
1753
- children: [/* @__PURE__ */ N("div", {
1754
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
1755
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOptimized")]
1756
- }), /* @__PURE__ */ N("div", {
1757
- className: j["bsy-lexical-ai__column-stack"],
1758
- children: [g.visible ? /* @__PURE__ */ M("div", {
1759
- className: j["bsy-lexical-ai__think-pin"],
1760
- children: /* @__PURE__ */ M(Ur, { model: g })
1761
- }) : null, /* @__PURE__ */ N(i, {
1762
- className: j["bsy-lexical-ai__column-body"],
1763
- options: Jr,
3681
+ }), /* @__PURE__ */ b("div", {
3682
+ className: Q["bsy-lexical-ai__column"],
3683
+ children: [/* @__PURE__ */ b("div", {
3684
+ className: I(Q["bsy-lexical-ai__column-title"], Q["bsy-lexical-ai__column-title--after"]),
3685
+ children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), l("editor.aiOptimized")]
3686
+ }), /* @__PURE__ */ b("div", {
3687
+ className: Q["bsy-lexical-ai__column-stack"],
3688
+ children: [g.visible ? /* @__PURE__ */ y("div", {
3689
+ className: Q["bsy-lexical-ai__think-pin"],
3690
+ children: /* @__PURE__ */ y(Lo, { model: g })
3691
+ }) : null, /* @__PURE__ */ b(u, {
3692
+ className: Q["bsy-lexical-ai__column-body"],
3693
+ options: Wo,
1764
3694
  viewportRef: p,
1765
3695
  onScroll: g.onViewportScroll,
1766
- children: [e === "error" ? /* @__PURE__ */ M("div", {
1767
- className: j["bsy-lexical-ai__error"],
1768
- children: a || u("editor.aiError")
1769
- }) : /* @__PURE__ */ M(Wr, { model: g }), m ? /* @__PURE__ */ M(Gr, { html: s }) : null]
3696
+ children: [e === "error" ? /* @__PURE__ */ y("div", {
3697
+ className: Q["bsy-lexical-ai__error"],
3698
+ children: n || l("editor.aiError")
3699
+ }) : /* @__PURE__ */ y(Ro, { model: g }), m ? /* @__PURE__ */ y(Vo, { html: o }) : null]
1770
3700
  })]
1771
3701
  })]
1772
3702
  })]
1773
- }), /* @__PURE__ */ N("div", {
1774
- className: j["bsy-lexical-ai__footer"],
1775
- children: [/* @__PURE__ */ M(Ee, {
3703
+ }), /* @__PURE__ */ b("div", {
3704
+ className: Q["bsy-lexical-ai__footer"],
3705
+ children: [/* @__PURE__ */ y(F, {
1776
3706
  onClick: () => f(!1),
1777
- children: u("editor.aiAbandon")
1778
- }), /* @__PURE__ */ M(Ee, {
3707
+ children: l("editor.aiAbandon")
3708
+ }), /* @__PURE__ */ y(F, {
1779
3709
  type: "primary",
1780
3710
  disabled: !h,
1781
- onClick: () => l() && f(!1),
1782
- children: u("editor.aiApply")
3711
+ onClick: () => c() && f(!1),
3712
+ children: l("editor.aiApply")
1783
3713
  })]
1784
3714
  })]
1785
3715
  })
1786
3716
  });
1787
- }, $ = (e) => !e || D(e) ? e : te(T(e));
1788
- function Xr(e, t, n, r) {
1789
- let [i, a] = R(""), o = L({
3717
+ }, Ko = (e) => !e || Yr(e) ? e : Ni(X(e));
3718
+ function qo(e, t, n, r) {
3719
+ let [i, a] = P(""), o = N({
1790
3720
  originalHtml: t,
1791
3721
  text: n
1792
3722
  });
@@ -1794,8 +3724,8 @@ function Xr(e, t, n, r) {
1794
3724
  originalHtml: t,
1795
3725
  text: n
1796
3726
  };
1797
- let s = L(null);
1798
- return Te(() => {
3727
+ let s = N(null);
3728
+ return j(() => {
1799
3729
  let t = () => {
1800
3730
  s.current !== null && (cancelAnimationFrame(s.current), s.current = null);
1801
3731
  };
@@ -1806,7 +3736,7 @@ function Xr(e, t, n, r) {
1806
3736
  let n = () => {
1807
3737
  s.current = null;
1808
3738
  let e = o.current;
1809
- a($(w(e.originalHtml, e.text)));
3739
+ a(Ko(qi(e.originalHtml, e.text)));
1810
3740
  };
1811
3741
  if (r === "ready" || r === "error") {
1812
3742
  t(), n();
@@ -1818,112 +3748,112 @@ function Xr(e, t, n, r) {
1818
3748
  t,
1819
3749
  r,
1820
3750
  n
1821
- ]), F(() => () => {
3751
+ ]), O(() => () => {
1822
3752
  s.current !== null && cancelAnimationFrame(s.current);
1823
3753
  }, []), i;
1824
3754
  }
1825
- var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1826
- let [r] = W(), { aiOpen: i, setAiOpen: a, aiSessionRef: o, stop: s, polish: l } = le(), { t: u } = n(), [d, f] = De.useMessage(), p = o.current, { text: m, reasoning: h, status: g, errorMessage: _ } = c(), v = !g || g === "idle" ? "loading" : g, y = m, b = $(i === "typeset" ? Rr(y, p?.codeBlocks ?? []) : ""), x = $(p?.originalHtml || ""), S = i === "polish" ? $(p?.originalHtml || "") : "", C = Xr(i === "polish", p?.originalHtml || "", y, v);
1827
- F(() => {
1828
- if (i) return r.setEditable(!1), r.update(() => {
1829
- nt(null);
1830
- }), window.getSelection()?.removeAllRanges(), r.getRootElement()?.blur(), () => {
1831
- r.setEditable(!0);
3755
+ var Jo = ({ maxLength: e, onMaxLengthExceed: t }) => {
3756
+ let [n] = B(), { aiOpen: r, setAiOpen: i, aiSessionRef: o, stop: s, polish: c } = mr(), { t: l } = a(), [u, d] = ne.useMessage(), f = o.current, { text: p, reasoning: m, status: h, errorMessage: g } = hr(), _ = !h || h === "idle" ? "loading" : h, x = p, S = Ko(r === "typeset" ? Mo(x, f?.codeBlocks ?? []) : ""), C = Ko(f?.originalHtml || ""), w = r === "polish" ? Ko(f?.originalHtml || "") : "", E = qo(r === "polish", f?.originalHtml || "", x, _);
3757
+ O(() => {
3758
+ if (r) return n.setEditable(!1), n.update(() => {
3759
+ Ne(null);
3760
+ }), window.getSelection()?.removeAllRanges(), n.getRootElement()?.blur(), () => {
3761
+ n.setEditable(!0);
1832
3762
  };
1833
- }, [i, r]);
1834
- let w = P(() => {
1835
- s?.(), o.current = null, a(null);
3763
+ }, [r, n]);
3764
+ let D = T(() => {
3765
+ s?.(), o.current = null, i(null);
1836
3766
  }, [
1837
3767
  o,
1838
- a,
3768
+ i,
1839
3769
  s
1840
- ]), ee = P(() => {
1841
- if (i !== "typeset" || v !== "ready") return !1;
1842
- r.setEditable(!0);
1843
- let { applied: n, truncated: a } = zr(r, y, o.current?.codeBlocks ?? [], e);
1844
- return n ? (a && t?.(), !0) : (r.setEditable(!1), d.warning(u("editor.aiApplyEmpty")), !1);
3770
+ ]), k = T(() => {
3771
+ if (r !== "typeset" || _ !== "ready") return !1;
3772
+ n.setEditable(!0);
3773
+ let { applied: i, truncated: a } = No(n, x, o.current?.codeBlocks ?? [], e);
3774
+ return i ? (a && t?.(), !0) : (n.setEditable(!1), u.warning(l("editor.aiApplyEmpty")), !1);
1845
3775
  }, [
1846
- i,
1847
- o,
1848
3776
  r,
3777
+ o,
3778
+ n,
1849
3779
  e,
1850
- d,
1851
- t,
1852
- v,
1853
3780
  u,
1854
- y
1855
- ]), T = P(() => i !== "polish" || v !== "ready" ? !1 : oe(r, y) ? !0 : (d.warning(u("editor.aiApplyEmpty")), !1), [
1856
- i,
3781
+ t,
3782
+ _,
3783
+ l,
3784
+ x
3785
+ ]), A = T(() => r !== "polish" || _ !== "ready" ? !1 : Ji(n, x) ? !0 : (u.warning(l("editor.aiApplyEmpty")), !1), [
1857
3786
  r,
1858
- d,
1859
- v,
3787
+ n,
1860
3788
  u,
1861
- y
1862
- ]), E = P((e) => {
3789
+ _,
3790
+ l,
3791
+ x
3792
+ ]), j = T((e) => {
1863
3793
  let t = o.current;
1864
- !t?.originalText || !l || (t.preset = e, s?.(), l({
3794
+ !t?.originalText || !c || (t.preset = e, s?.(), c({
1865
3795
  text: t.originalText,
1866
3796
  preset: e
1867
3797
  }));
1868
3798
  }, [
1869
3799
  o,
1870
- l,
3800
+ c,
1871
3801
  s
1872
3802
  ]);
1873
- return i ? /* @__PURE__ */ N(ye, { children: [f, i === "typeset" ? /* @__PURE__ */ M(Yr, {
1874
- status: v,
1875
- reasoning: h,
1876
- errorMessage: _,
1877
- originalHtml: x,
1878
- proposedHtml: b,
1879
- onCancel: w,
1880
- onApply: ee
1881
- }) : /* @__PURE__ */ M(qr, {
1882
- status: v,
1883
- reasoning: h,
1884
- errorMessage: _,
1885
- originalHtml: S,
1886
- proposedHtml: C,
1887
- preset: p?.preset ?? "quick",
1888
- onPresetChange: E,
1889
- onCancel: w,
1890
- onApply: T
1891
- })] }) : f;
1892
- }, Qr = [], $r = (e) => {
1893
- let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] = W(), { isSourceMode: d, isSourceModeRef: f } = de(), p = L(null), m = L(null), h = L(/* @__PURE__ */ new Map()), g = L(null), _ = L(null), v = L(s);
3803
+ return r ? /* @__PURE__ */ b(v, { children: [d, r === "typeset" ? /* @__PURE__ */ y(Go, {
3804
+ status: _,
3805
+ reasoning: m,
3806
+ errorMessage: g,
3807
+ originalHtml: C,
3808
+ proposedHtml: S,
3809
+ onCancel: D,
3810
+ onApply: k
3811
+ }) : /* @__PURE__ */ y(Uo, {
3812
+ status: _,
3813
+ reasoning: m,
3814
+ errorMessage: g,
3815
+ originalHtml: w,
3816
+ proposedHtml: E,
3817
+ preset: f?.preset ?? "quick",
3818
+ onPresetChange: j,
3819
+ onCancel: D,
3820
+ onApply: A
3821
+ })] }) : d;
3822
+ }, Yo = [], Xo = (e) => {
3823
+ let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] = B(), { isSourceMode: d, isSourceModeRef: f } = Vr(), p = N(null), m = N(null), h = N(/* @__PURE__ */ new Map()), g = N(null), _ = N(null), v = N(s);
1894
3824
  v.current = s;
1895
- let b = tr(o) ? o : void 0, [x, S] = R(0), [C, w] = R(null), ee = i?.mode === "floating", E = b !== void 0 && !d, D = L(l);
1896
- D.current = l;
1897
- let O = L(r);
1898
- O.current = r;
1899
- let k = P((e) => {
1900
- D.current?.typeset?.(e);
1901
- }, []), A = P((e) => {
1902
- D.current?.polish?.(e);
1903
- }, []), re = P(() => {
1904
- D.current?.stop?.();
1905
- }, []), j = !!l?.typeset, ae = !!l?.polish, oe = I(() => ({
3825
+ let x = Ja(o) ? o : void 0, [S, C] = P(0), [w, E] = P(null), D = i?.mode === "floating", k = x !== void 0 && !d, A = N(l);
3826
+ A.current = l;
3827
+ let j = N(r);
3828
+ j.current = r;
3829
+ let F = T((e) => {
3830
+ A.current?.typeset?.(e);
3831
+ }, []), ee = T((e) => {
3832
+ A.current?.polish?.(e);
3833
+ }, []), te = T(() => {
3834
+ A.current?.stop?.();
3835
+ }, []), ne = !!l?.typeset, I = !!l?.polish, re = M(() => ({
1906
3836
  containerRef: p,
1907
3837
  toolbarRef: m,
1908
3838
  upload: c,
1909
- aiOpen: C,
1910
- setAiOpen: w,
3839
+ aiOpen: w,
3840
+ setAiOpen: E,
1911
3841
  aiSessionRef: g,
1912
3842
  attachmentsBySrcRef: h,
1913
- typeset: k,
1914
- polish: A,
1915
- stop: re,
1916
- canTypeset: j,
1917
- canPolish: ae
3843
+ typeset: F,
3844
+ polish: ee,
3845
+ stop: te,
3846
+ canTypeset: ne,
3847
+ canPolish: I
1918
3848
  }), [
1919
- C,
1920
- ae,
1921
- j,
1922
- A,
1923
- re,
1924
- k,
3849
+ w,
3850
+ I,
3851
+ ne,
3852
+ ee,
3853
+ te,
3854
+ F,
1925
3855
  c
1926
- ]), se = I(() => ({
3856
+ ]), ie = M(() => ({
1927
3857
  text: l?.text ?? "",
1928
3858
  reasoning: l?.reasoning,
1929
3859
  status: l?.status,
@@ -1933,12 +3863,12 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1933
3863
  l?.reasoning,
1934
3864
  l?.status,
1935
3865
  l?.errorMessage
1936
- ]), ce = P((e) => {
3866
+ ]), ae = T((e) => {
1937
3867
  f.current || e.read(() => {
1938
- let t = V().getTextContent(), n = te(T(ze(u, null))), r = ie(n, t) ? null : n;
1939
- _.current = r, b !== void 0 && S(t.length);
1940
- let i = et(rn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
1941
- O.current({
3868
+ let t = L().getTextContent(), n = Ni(X(he(u, null))), r = ei(n, t) ? null : n;
3869
+ _.current = r, x !== void 0 && C(t.length);
3870
+ let i = je(tn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
3871
+ j.current({
1942
3872
  text: t,
1943
3873
  html: r,
1944
3874
  attachments: i
@@ -1946,47 +3876,47 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1946
3876
  }, { editor: u });
1947
3877
  }, [
1948
3878
  u,
1949
- b,
3879
+ x,
1950
3880
  f
1951
3881
  ]);
1952
- F(() => {
1953
- b === void 0 || d || u.getEditorState().read(() => {
1954
- S(V().getTextContentSize());
3882
+ O(() => {
3883
+ x === void 0 || d || u.getEditorState().read(() => {
3884
+ C(L().getTextContentSize());
1955
3885
  }, { editor: u });
1956
3886
  }, [
1957
3887
  u,
1958
- b,
3888
+ x,
1959
3889
  d
1960
- ]), F(() => {
3890
+ ]), O(() => {
1961
3891
  if (e.value === void 0 || e.value === _.current) return;
1962
3892
  if (f.current) {
1963
- let t = e.value?.trim() ? T(e.value) : "";
3893
+ let t = e.value?.trim() ? X(e.value) : "";
1964
3894
  _.current = e.value, u.update(() => {
1965
- mr(pr(t));
3895
+ so(oo(t));
1966
3896
  });
1967
3897
  return;
1968
3898
  }
1969
- let t = !1;
3899
+ let t = !1, n = _.current === null;
1970
3900
  u.update(() => {
1971
- ne(u, e.value?.trim() ? T(e.value) : ""), b !== void 0 && (t = nr(u, b));
1972
- }), t && v.current?.();
3901
+ $r(u, e.value?.trim() ? X(e.value) : ""), x !== void 0 && (t = Ya(u, x)), On(u);
3902
+ }), n && u.dispatchCommand(Le, void 0), t && v.current?.();
1973
3903
  }, [
1974
3904
  e.value,
1975
3905
  u,
1976
- b,
3906
+ x,
1977
3907
  f
1978
3908
  ]);
1979
- let le = i?.config?.length ? i.config : Qr, fe = P(() => {
3909
+ let oe = i?.config?.length ? i.config : Yo, se = T(() => {
1980
3910
  v.current?.();
1981
3911
  }, []);
1982
- return /* @__PURE__ */ M(y.Provider, {
1983
- value: oe,
1984
- children: /* @__PURE__ */ N(ue.Provider, {
1985
- value: se,
1986
- children: [/* @__PURE__ */ M(ei, {
3912
+ return /* @__PURE__ */ y(fr.Provider, {
3913
+ value: re,
3914
+ children: /* @__PURE__ */ b(pr.Provider, {
3915
+ value: ie,
3916
+ children: [/* @__PURE__ */ y(Zo, {
1987
3917
  containerRef: p,
1988
- isFloating: ee,
1989
- toolbarConfig: le,
3918
+ isFloating: D,
3919
+ toolbarConfig: oe,
1990
3920
  toolbarTheme: a?.toolbar,
1991
3921
  containerTheme: a?.container,
1992
3922
  toolbarStyle: i?.style,
@@ -1996,98 +3926,118 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1996
3926
  toolbarStickyOffset: i?.stickyOffset,
1997
3927
  height: t,
1998
3928
  minHeight: n,
1999
- showLengthBadge: E,
2000
- textLength: x,
2001
- validMaxLength: b,
2002
- onMaxLengthExceed: fe,
2003
- onChange: ce
2004
- }), /* @__PURE__ */ M(Zr, {
2005
- maxLength: b,
2006
- onMaxLengthExceed: fe
3929
+ showLengthBadge: k,
3930
+ textLength: S,
3931
+ validMaxLength: x,
3932
+ onMaxLengthExceed: se,
3933
+ onChange: ae
3934
+ }), /* @__PURE__ */ y(Jo, {
3935
+ maxLength: x,
3936
+ onMaxLengthExceed: se
2007
3937
  })]
2008
3938
  })
2009
3939
  });
2010
- }, ei = Se(function({ containerRef: e, isFloating: t, toolbarConfig: n, toolbarTheme: r, containerTheme: i, toolbarStyle: a, toolbarSize: o, toolbarMode: s, toolbarFloating: c, toolbarStickyOffset: l, height: u, minHeight: d, showLengthBadge: f, textLength: p, validMaxLength: m, onMaxLengthExceed: h, onChange: g }) {
2011
- let [_] = W(), v = $t(), y = typeof u == "number" ? u : void 0, b = !t && y === void 0 && l !== void 0, x = L(!1);
2012
- F(() => {
2013
- v && x.current && (x.current = !1, _.focus());
3940
+ }, Zo = w(function({ containerRef: e, isFloating: t, toolbarConfig: n, toolbarTheme: r, containerTheme: i, toolbarStyle: a, toolbarSize: o, toolbarMode: s, toolbarFloating: c, toolbarStickyOffset: l, height: u, minHeight: d, showLengthBadge: f, textLength: p, validMaxLength: m, onMaxLengthExceed: h, onChange: g }) {
3941
+ let [_] = B(), v = Zt(), x = typeof u == "number" ? u : void 0, S = !t && x === void 0 && l !== void 0, C = N(!1);
3942
+ O(() => {
3943
+ v && C.current && (C.current = !1, _.focus());
2014
3944
  }, [v, _]);
2015
- let S = I(() => wn(i), [i]);
2016
- return /* @__PURE__ */ N("div", {
3945
+ let w = M(() => ha(i), [i]);
3946
+ return /* @__PURE__ */ b("div", {
2017
3947
  ref: e,
2018
- className: z("bsy-lexical-editor", X["bsy-lexical-editor"], t && X["bsy-lexical-editor--floating"], b && X["bsy-lexical-editor--sticky-toolbar"]),
2019
- style: S,
3948
+ className: I("bsy-lexical-editor", $["bsy-lexical-editor"], t && $["bsy-lexical-editor--floating"], S && $["bsy-lexical-editor--sticky-toolbar"]),
3949
+ style: w,
2020
3950
  onClick: (e) => {
2021
3951
  let t = _.getRootElement(), n = e.target;
2022
- !t || !n || !t.contains(n) || _.isEditable() || (x.current = !0, _.setEditable(!0));
3952
+ !t || !n || !t.contains(n) || _.isEditable() || (C.current = !0, _.setEditable(!0));
2023
3953
  },
2024
3954
  children: [
2025
- n && n.length > 0 ? /* @__PURE__ */ M(Sn, {
3955
+ n && n.length > 0 ? /* @__PURE__ */ y(pa, {
2026
3956
  config: n,
2027
3957
  theme: r,
2028
3958
  style: a,
2029
3959
  size: o,
2030
3960
  mode: s,
2031
3961
  floating: c,
2032
- stickyOffset: b ? l : void 0
3962
+ stickyOffset: S ? l : void 0
2033
3963
  }) : null,
2034
- /* @__PURE__ */ N("div", {
2035
- className: z(X["bsy-lexical-editor__body"], y !== void 0 && X["bsy-lexical-editor__body--fixed"]),
2036
- style: { height: y },
2037
- children: [/* @__PURE__ */ M("div", {
2038
- className: X["bsy-lexical-editor__editable-wrap"],
2039
- children: /* @__PURE__ */ M(Pe, {
2040
- contentEditable: /* @__PURE__ */ M(Fe, {
2041
- className: X["bsy-lexical-editor__content-editable"],
3964
+ /* @__PURE__ */ b("div", {
3965
+ className: I($["bsy-lexical-editor__body"], x !== void 0 && $["bsy-lexical-editor__body--fixed"]),
3966
+ style: { height: x },
3967
+ children: [/* @__PURE__ */ y("div", {
3968
+ className: $["bsy-lexical-editor__editable-wrap"],
3969
+ children: /* @__PURE__ */ y(ue, {
3970
+ contentEditable: /* @__PURE__ */ y(de, {
3971
+ className: $["bsy-lexical-editor__content-editable"],
2042
3972
  style: {
2043
- minHeight: y === void 0 ? d : void 0,
3973
+ minHeight: x === void 0 ? d : void 0,
2044
3974
  cursor: v ? "auto" : "text"
2045
3975
  }
2046
3976
  }),
2047
- ErrorBoundary: Re
3977
+ ErrorBoundary: me
2048
3978
  })
2049
- }), f && m !== void 0 ? /* @__PURE__ */ M(vr, {
3979
+ }), f && m !== void 0 ? /* @__PURE__ */ y(fo, {
2050
3980
  current: p,
2051
3981
  maxLength: m
2052
3982
  }) : null]
2053
3983
  }),
2054
- /* @__PURE__ */ M(en, {}),
2055
- /* @__PURE__ */ M(tn, {}),
2056
- /* @__PURE__ */ M(On, {}),
2057
- /* @__PURE__ */ M(_r, {}),
2058
- /* @__PURE__ */ M(kn, {}),
2059
- /* @__PURE__ */ M(Mn, {}),
2060
- /* @__PURE__ */ M(Nn, {}),
2061
- /* @__PURE__ */ M(Xn, {}),
2062
- /* @__PURE__ */ M(Zn, {}),
2063
- /* @__PURE__ */ M($n, {}),
2064
- f && m !== void 0 ? /* @__PURE__ */ M(er, {
3984
+ /* @__PURE__ */ y(Qt, {}),
3985
+ /* @__PURE__ */ y($t, {}),
3986
+ /* @__PURE__ */ y(xa, {}),
3987
+ /* @__PURE__ */ y(uo, {}),
3988
+ /* @__PURE__ */ y(Sa, {}),
3989
+ /* @__PURE__ */ y(Ta, {}),
3990
+ /* @__PURE__ */ y(Ea, {}),
3991
+ /* @__PURE__ */ y(Ua, {}),
3992
+ /* @__PURE__ */ y(Wa, {}),
3993
+ /* @__PURE__ */ y(Ka, {}),
3994
+ f && m !== void 0 ? /* @__PURE__ */ y(qa, {
2065
3995
  maxLength: m,
2066
3996
  onMaxLengthExceed: h
2067
3997
  }) : null,
2068
- /* @__PURE__ */ M(Ie, {}),
2069
- /* @__PURE__ */ M(Le, {
3998
+ /* @__PURE__ */ y(fe, {}),
3999
+ /* @__PURE__ */ y(pe, {
2070
4000
  onChange: g,
2071
4001
  ignoreSelectionChange: !0,
2072
4002
  ignoreHistoryMergeTagChange: !1
2073
4003
  })
2074
4004
  ]
2075
4005
  });
2076
- }), ti = (e) => /* @__PURE__ */ M(hr, {
4006
+ }), Qo = (e) => /* @__PURE__ */ y(co, {
2077
4007
  maxLength: e.maxLength,
2078
4008
  onMaxLengthExceed: e.onMaxLengthExceed,
2079
- children: /* @__PURE__ */ M($r, { ...e })
4009
+ children: /* @__PURE__ */ y(Xo, { ...e })
2080
4010
  });
2081
- ti.displayName = "BsyLexicalEditorCore";
4011
+ Qo.displayName = "BsyLexicalEditorCore";
2082
4012
  //#endregion
2083
- //#region src/components/Editor/htmlConfig.ts
2084
- var ni = "1px solid #d9d9d9", ri = { export: new Map([[Wt, (e, t) => {
4013
+ //#region src/components/Editor/nodes/ExtendedLinkNode.ts
4014
+ var $o = class e extends ft {
4015
+ constructor(e = "", t = {}, n) {
4016
+ super(e, t, n);
4017
+ }
4018
+ static getType() {
4019
+ return "extended-link";
4020
+ }
4021
+ static clone(t) {
4022
+ return new e(t.__url, {
4023
+ rel: t.__rel,
4024
+ target: t.__target,
4025
+ title: t.__title
4026
+ }, t.__key);
4027
+ }
4028
+ static importJSON(e) {
4029
+ return es().updateFromJSON(e);
4030
+ }
4031
+ sanitizeUrl(e) {
4032
+ return e.startsWith("@") ? e : super.sanitizeUrl(e);
4033
+ }
4034
+ }, es = (e = "", t = {}) => _e(new $o(e, t)), ts = "1px solid #d9d9d9", ns = { export: new Map([[Rt, (e, t) => {
2085
4035
  let n = t.exportDOM(e);
2086
- return vt(n.element) && (n.element.style.border = ni), n;
2087
- }]]) }, ii = (e) => {
4036
+ return at(n.element) && (n.element.style.border = ts), n;
4037
+ }]]) }, rs = (e) => {
2088
4038
  let { autoFocus: t = !1 } = e;
2089
- return /* @__PURE__ */ M(Ne, {
2090
- initialConfig: I(() => ({
4039
+ return /* @__PURE__ */ y(le, {
4040
+ initialConfig: M(() => ({
2091
4041
  namespace: "bsyLexicalEditor",
2092
4042
  onError: (e) => {
2093
4043
  console.error("Lexical error", e);
@@ -2123,30 +4073,39 @@ var ni = "1px solid #d9d9d9", ri = { export: new Map([[Wt, (e, t) => {
2123
4073
  tableRow: "editor-table-row",
2124
4074
  tableScrollableWrapper: "editor-table-scrollable-wrapper"
2125
4075
  },
2126
- html: ri,
4076
+ html: ns,
2127
4077
  nodes: [
2128
- Ot,
2129
- Dt,
2130
- jt,
2131
- At,
2132
- Qt,
2133
- Lt,
2134
- It,
2135
- Gt,
2136
- Kt,
2137
- Wt,
2138
- rn,
2139
- Z,
4078
+ $o,
4079
+ {
4080
+ replace: ft,
4081
+ with: (e) => new $o(e.__url, {
4082
+ rel: e.__rel,
4083
+ target: e.__target,
4084
+ title: e.__title
4085
+ }),
4086
+ withKlass: $o
4087
+ },
4088
+ dt,
4089
+ yt,
4090
+ vt,
4091
+ qt,
4092
+ Et,
4093
+ Tt,
4094
+ zt,
4095
+ Bt,
4096
+ Rt,
4097
+ tn,
4098
+ ga,
2140
4099
  {
2141
- replace: _t,
2142
- with: (e) => new Z(e.__text),
2143
- withKlass: Z
4100
+ replace: nt,
4101
+ with: (e) => new ga(e.__text),
4102
+ withKlass: ga
2144
4103
  }
2145
4104
  ]
2146
4105
  }), [t]),
2147
- children: /* @__PURE__ */ M(ti, { ...e })
4106
+ children: /* @__PURE__ */ y(Qo, { ...e })
2148
4107
  });
2149
4108
  };
2150
- ii.displayName = "BsyLexicalEditor";
4109
+ rs.displayName = "BsyLexicalEditor";
2151
4110
  //#endregion
2152
- export { qe as $getRoot, u as BaseButton, ii as default, ae as listRegisteredToolbarButtons, O as registerToolbarButton, S as unregisterToolbarButton, bt as useLexicalComposerContext };
4111
+ export { we as $getRoot, q as BaseButton, Bo as EditorHtmlPreview, rs as default, aa as listRegisteredToolbarButtons, na as registerToolbarButton, ra as unregisterToolbarButton, st as useLexicalComposerContext };