@baishuyun/ui-base 6.16.1 → 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 (139) 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-CtLwYPmz.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-Bi0TsCc_.js → DropDown-B_szM67V.js} +86 -82
  16. package/dist/DropDown/index.js +8 -9
  17. package/dist/Editor/index.js +2825 -871
  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-CB5FqBui.js → Select-VIy6OKEj.js} +257 -253
  33. package/dist/Select/{SelectInputSearch-DUAv2vE4.js → SelectInputSearch-MApQHnU9.js} +1 -1
  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/index.js +28 -50
  55. package/dist/style.css +1 -1
  56. package/dist/vendors/Tree-D0Q1IZ2D.js +267 -0
  57. package/dist/vendors/{version-Dzs4mguZ.js → version-CfjNx5v2.js} +1 -1
  58. package/package.json +1 -1
  59. package/dist/Amap/Amap-BLSziesG.js +0 -77
  60. package/dist/Amap/AmapCircle/index.js +0 -5
  61. package/dist/Amap/AmapCircle-2qupysHe.js +0 -55
  62. package/dist/Amap/AmapContext-CJBe6lld.js +0 -11
  63. package/dist/Amap/AmapMarker/index.js +0 -6
  64. package/dist/Amap/AmapMarker-xEqoVnFR.js +0 -153
  65. package/dist/Amap/AmapMarkerCluster/index.js +0 -6
  66. package/dist/Amap/AmapMarkerCluster-CvEQa3o9.js +0 -240
  67. package/dist/Amap/AmapProvider/index.js +0 -7
  68. package/dist/Amap/AmapProvider-B-R2DrkJ.js +0 -107
  69. package/dist/Amap/hooks/index.js +0 -4
  70. package/dist/Amap/hooks-BTcFpdd0.js +0 -121
  71. package/dist/Amap/useMarkerInfoWindowController-Cjx0xQXw.js +0 -94
  72. package/dist/Calendar/AllDaySection-pO7suGJM.js +0 -53
  73. package/dist/Calendar/Calendar-Cjagi7mU.js +0 -795
  74. package/dist/Calendar/CurrentTimeIndicator-BF3_INSL.js +0 -65
  75. package/dist/Calendar/EventCard-DKEZQRTp.js +0 -155
  76. package/dist/Calendar/TimeAxis-DUc6EL-j.js +0 -13
  77. package/dist/Calendar/TimeGrid-BV8x9VnF.js +0 -47
  78. package/dist/Calendar/colorUtils-BbeSMnOs.js +0 -55
  79. package/dist/Calendar/context/index.js +0 -3
  80. package/dist/Calendar/context-CamSpkj3.js +0 -21
  81. package/dist/Calendar/layout-CpOabFQ2.js +0 -300
  82. package/dist/Calendar/subcomponents/AllDaySection/index.js +0 -11
  83. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +0 -8
  84. package/dist/Calendar/subcomponents/EventCard/index.js +0 -9
  85. package/dist/Calendar/subcomponents/TimeAxis/index.js +0 -5
  86. package/dist/Calendar/subcomponents/TimeGrid/index.js +0 -7
  87. package/dist/Calendar/theme-Dc8hjcdo.js +0 -71
  88. package/dist/Calendar/utils/index.js +0 -111
  89. package/dist/Calendar/utils/layout/index.js +0 -4
  90. package/dist/Calendar/utils/theme/index.js +0 -3
  91. package/dist/DatePicker/DatePicker-neAwNSsc.js +0 -101
  92. package/dist/DatePicker/ensureDayjsPlugins-CSqhjLS7.js +0 -15
  93. package/dist/DatePicker/pickerLocale-CcPLUbZO.js +0 -15
  94. package/dist/DatePicker/style/index.js +0 -3
  95. package/dist/DatePicker/style-W7f5wyUb.js +0 -15
  96. package/dist/DropDown/style/index.js +0 -3
  97. package/dist/DropDown/style-DZpkarne.js +0 -9
  98. package/dist/Editor/Buttons-OwLs5bxR.js +0 -1841
  99. package/dist/Editor/ToolbarPlugin/Buttons/index.js +0 -21
  100. package/dist/Editor/constants/index.js +0 -61
  101. package/dist/Gantt/GanttChart/index.js +0 -21
  102. package/dist/Gantt/GanttChart-CDnF5qcc.js +0 -2292
  103. package/dist/Gantt/GanttHighlightContext-dtyoq-oj.js +0 -12
  104. package/dist/Gantt/GanttTable/index.js +0 -13
  105. package/dist/Gantt/GanttTable-fOv1Zn2-.js +0 -84
  106. package/dist/Gantt/GanttToolBar/index.js +0 -17
  107. package/dist/Gantt/GanttToolBar-BAoiWAHI.js +0 -120
  108. package/dist/Gantt/collapseKeys-BV_8sIA-.js +0 -160
  109. package/dist/Gantt/columnResize-Bkenlbab.js +0 -46
  110. package/dist/Gantt/constants-mEGQ1U1Q.js +0 -39
  111. package/dist/Gantt/highlightTarget-D3Nf9_7S.js +0 -25
  112. package/dist/Gantt/theme-B7Iap-tZ.js +0 -31
  113. package/dist/Gantt/timelineViewConfig-DNt7yi83.js +0 -118
  114. package/dist/Gantt/utils/index.js +0 -7
  115. package/dist/Gantt/utils/theme/index.js +0 -3
  116. package/dist/Select/style/index.js +0 -3
  117. package/dist/Select/style-C4A8kUd1.js +0 -9
  118. package/dist/Table/Table-3LSO0xSH.js +0 -545
  119. package/dist/Table/constants-D7wLH8Qy.js +0 -25
  120. package/dist/Table/hooks/index.js +0 -3
  121. package/dist/Table/hooks-DSBl2e4O.js +0 -108
  122. package/dist/Table/processRowspan-B6HMqw0Q.js +0 -144
  123. package/dist/Table/style/index.js +0 -3
  124. package/dist/Table/style-B8Cw8HJe.js +0 -9
  125. package/dist/Table/utils/index.js +0 -3
  126. package/dist/Tree/utils/index.js +0 -26
  127. package/dist/vendors/Tree-DSl4lDjx.js +0 -248
  128. /package/dist/Card/{Card-rJeWgxu5.js → Card-DAz0dvA3.js} +0 -0
  129. /package/dist/CheckBox/{CheckBox-DOK5N7z6.js → CheckBox-CcHskTz_.js} +0 -0
  130. /package/dist/Modal/{Modal-CRKitOOj.js → Modal-eZijJ7CB.js} +0 -0
  131. /package/dist/NotFoundContent/{NotFoundContent-BLmzWNBi.js → NotFoundContent-DJUQ0_2D.js} +0 -0
  132. /package/dist/Radio/{Radio-CX9cUqb7.js → Radio-D9jhW7K6.js} +0 -0
  133. /package/dist/vendors/{animations-Dn_5xJ7B.js → animations-ISccYUE3.js} +0 -0
  134. /package/dist/vendors/{cssVars-l4-kP_14.js → cssVars-UpriQzph.js} +0 -0
  135. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-mEH9TBYV.js} +0 -0
  136. /package/dist/vendors/{useFloatingOverlay-B3M9k8nj.js → useFloatingOverlay-B66lOL8v.js} +0 -0
  137. /package/dist/vendors/{useFloatingPortal-VpzL-EPh.js → useFloatingPortal-DJ1iKmW-.js} +0 -0
  138. /package/dist/vendors/{useLatchedPopupPortalRoot-4fVhqVT4.js → useLatchedPopupPortalRoot-CC6af8t-.js} +0 -0
  139. /package/dist/vendors/{useLocale-D31qCCff.js → useLocale-Be4e7Xfn.js} +0 -0
@@ -1,52 +1,53 @@
1
- import "../vendors/version-Dzs4mguZ.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-DUAv2vE4.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-Bi0TsCc_.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-OwLs5bxR.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,63 @@ 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 {
183
184
  __src;
184
185
  __altText;
185
186
  __width;
@@ -233,7 +234,7 @@ var J = {
233
234
  n.__width = e, n.__height = t;
234
235
  }
235
236
  decorate() {
236
- return /* @__PURE__ */ M(nn, {
237
+ return /* @__PURE__ */ y(en, {
237
238
  src: this.__src,
238
239
  altText: this.__altText,
239
240
  width: this.__width,
@@ -244,13 +245,13 @@ var J = {
244
245
  }
245
246
  static importDOM() {
246
247
  return { img: () => ({
247
- conversion: sn,
248
+ conversion: an,
248
249
  priority: 0
249
250
  }) };
250
251
  }
251
252
  static importJSON(e) {
252
253
  let { src: t, altText: n, width: r, height: i, dataId: a } = e;
253
- return an({
254
+ return nn({
254
255
  src: t,
255
256
  altText: n,
256
257
  width: r,
@@ -273,13 +274,13 @@ var J = {
273
274
  return !0;
274
275
  }
275
276
  };
276
- function an({ src: e, altText: t, width: n, height: r, dataId: i, key: a }) {
277
- 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);
278
279
  }
279
- function on(e) {
280
- return e instanceof rn;
280
+ function rn(e) {
281
+ return e instanceof tn;
281
282
  }
282
- function sn(e) {
283
+ function an(e) {
283
284
  if (e instanceof HTMLImageElement) {
284
285
  let { src: t, alt: n, style: r } = e, i, a;
285
286
  if (r.width) {
@@ -292,7 +293,7 @@ function sn(e) {
292
293
  }
293
294
  i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height);
294
295
  let o = e.getAttribute("data-id") || void 0;
295
- return { node: an({
296
+ return { node: nn({
296
297
  src: t,
297
298
  altText: n,
298
299
  width: i,
@@ -303,25 +304,37 @@ function sn(e) {
303
304
  return null;
304
305
  }
305
306
  //#endregion
306
- //#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
307
- 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) => {
308
321
  if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
309
- }, cn = (e, t = v) => {
310
- let n = s[t], i = Y(e?.itemHeight) ?? `${n.itemHeight}px`, a = Y(e?.iconSize) ?? `${n.iconSize}px`, o = {
311
- "--bsy-editor-toolbar-item-height": i,
312
- "--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,
313
326
  "--bsy-editor-toolbar-divider-color": "#e0e0e0",
314
327
  "--bsy-editor-toolbar-item-highlight-color": "#0265ff"
315
328
  };
316
- 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;
317
- }, 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) => {
318
331
  if (typeof e == "number" && Number.isFinite(e)) return e;
319
332
  if (typeof e == "string") {
320
333
  let t = Number.parseFloat(e);
321
334
  if (Number.isFinite(t)) return t;
322
335
  }
323
- return s[t].iconSize;
324
- }, un = (e) => {
336
+ return sn[t].iconSize;
337
+ }, dn = (e) => {
325
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 = {
326
339
  position: "absolute",
327
340
  [a ? "bottom" : "top"]: "100%",
@@ -331,7 +344,7 @@ var Y = (e) => {
331
344
  width: "100%"
332
345
  };
333
346
  return r && (o.transform = `translateX(${r}px)`), o;
334
- }, dn = (e, t, n, r) => {
347
+ }, fn = (e, t, n, r) => {
335
348
  if (e.length === 0 || t <= 0 || e.reduce((e, t, n) => e + t.width + (n > 0 ? r : 0), 0) <= t) return e.length;
336
349
  let i = 0, a = 0;
337
350
  for (let o = 0; o < e.length; o++) {
@@ -341,153 +354,1994 @@ var Y = (e) => {
341
354
  }
342
355
  for (; a > 0 && e[a - 1]?.isDivider;) --a;
343
356
  return a;
344
- }, fn = (e, t) => {
357
+ }, pn = (e, t) => {
345
358
  let n = (e) => e.kind === "divider";
346
359
  return {
347
360
  visible: e.slice(0, t),
348
- overflow: ge(_e(e.slice(t), n), n)
361
+ overflow: p(m(e.slice(t), n), n)
349
362
  };
350
- };
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
+ }
351
1146
  //#endregion
352
- //#region src/components/Editor/hooks/useTextFormatsState.ts
353
- function pn() {
354
- let [e] = W(), [t, n] = R({
355
- bold: !1,
356
- italic: !1,
357
- underline: !1,
358
- strikethrough: !1,
359
- superscript: !1,
360
- subscript: !1,
361
- fontSize: he,
362
- fontColor: me,
363
- backgroundColor: pe,
364
- align: "left",
365
- listType: !1,
366
- canOutdent: !1,
367
- isCodeBlock: !1,
368
- isInTable: !1,
369
- headingTag: !1,
370
- codeLanguage: _,
371
- hasEditorText: !1,
372
- 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
373
1174
  });
374
- return F(() => e.registerUpdateListener(({ editorState: e }) => {
375
- e.read(() => {
376
- let e = H(), t = !!V().getTextContent().trim();
377
- if (Ut(e)) {
378
- n((e) => ({
379
- ...e,
380
- isCodeBlock: !1,
381
- isInTable: !0,
382
- headingTag: !1,
383
- hasEditorText: t
384
- }));
385
- 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 });
386
1197
  }
387
- if (U(e)) {
388
- 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) => {
389
- let t = e.getParent();
390
- 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
391
1368
  });
392
- c === null && (c = s.getTopLevelElementOrThrow());
393
- let l = {}, u = G(s, Et);
394
- u ? (l.link = u.getURL(), l.linkText = u.getTextContent(), l.newBlank = u.getTarget() === "_blank") : l.linkText = e.getTextContent();
395
- let f = G(s, K), p = !1, m = Ye(c) ? c.getIndent() : 0;
396
- if (K(f)) {
397
- m = f.getIndent();
398
- let e = f.getParent();
399
- if (kt(e)) {
400
- let t = e.getListType();
401
- p = t === "number" || t === "bullet" ? t : !1;
402
- }
403
- }
404
- let h = G(s, q), g = G(s, Zt), _ = Zt(g) ? g.getTag() : void 0;
405
- n({
406
- bold: e.hasFormat("bold"),
407
- italic: e.hasFormat("italic"),
408
- underline: e.hasFormat("underline"),
409
- strikethrough: e.hasFormat("strikethrough"),
410
- superscript: e.hasFormat("superscript"),
411
- subscript: e.hasFormat("subscript"),
412
- fontSize: r,
413
- fontColor: i,
414
- backgroundColor: a,
415
- align: o(Ye(c) ? c.getFormatType() : ""),
416
- listType: p,
417
- canOutdent: m > 0 || p !== !1,
418
- isCodeBlock: !!h,
419
- isInTable: !!G(s, Bt),
420
- headingTag: _ === "h1" || _ === "h2" || _ === "h3" ? _ : !1,
421
- codeLanguage: d(h?.getLanguage()),
422
- hasEditorText: t,
423
- 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
424
1375
  });
425
- } else n((e) => ({
426
- ...e,
427
- hasEditorText: t
428
- }));
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
429
1572
  });
430
- }), [e]), t;
431
- }
432
- //#endregion
433
- //#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
434
- var mn = (e) => {
435
- let t = pn();
436
- return /* @__PURE__ */ M(f.Provider, {
437
- value: t,
438
- 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
439
1580
  });
440
- }, hn = m.map((e) => ({
441
- key: e.id,
442
- label: e.label
443
- })), gn = () => {
444
- let [t] = W(), { codeLanguage: r } = b(), { t: i } = n(), { iconSize: o } = g(), s = P((e) => {
445
- let n = e.key;
446
- t.update(() => {
447
- let e = H();
448
- 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));
449
1677
  });
450
- }, [t]), c = h[r].label;
451
- return /* @__PURE__ */ M(a, {
452
- menus: hn,
453
- onClick: s,
454
- 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,
455
1698
  showSearch: !1,
456
- offset: fe,
1699
+ activeKey: [u],
1700
+ offset: W,
457
1701
  style: {
458
- width: 120,
459
- minWidth: 120
1702
+ width: "62px",
1703
+ minWidth: "62px"
460
1704
  },
461
- children: /* @__PURE__ */ M("div", {
462
- className: p["bsy-lexical__toolbar-select"],
463
- style: { width: 120 },
464
- children: /* @__PURE__ */ M(u, {
465
- icon: /* @__PURE__ */ N(ye, { children: [/* @__PURE__ */ M("span", {
466
- className: p["bsy-lexical__toolbar-select-label"],
467
- children: c
468
- }), /* @__PURE__ */ M(e, {
469
- name: "arrow-down",
470
- size: o,
471
- className: p["bsy-lexical__toolbar-select-arrow"]
472
- })] }),
473
- tooltip: i("editor.codeLanguage")
474
- })
475
- })
1705
+ children: h
476
1706
  });
477
- }, _n = {
478
- initial: {
479
- opacity: 0,
480
- 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"
481
1897
  },
482
- animate: {
483
- opacity: 1,
484
- x: 0
1898
+ h2: {
1899
+ ..._i,
1900
+ "font-size": "1.5em"
485
1901
  },
486
- exit: {
487
- opacity: 0,
488
- 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);
489
2112
  }
490
- }, 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) => {
491
2345
  if (n) return [
492
2346
  {
493
2347
  kind: "button",
@@ -545,130 +2399,180 @@ var mn = (e) => {
545
2399
  key: `divider-${t.key}`
546
2400
  });
547
2401
  }), r;
548
- }, yn = (e) => {
549
- if (e.kind === "divider") return /* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] });
550
- if (e.kind === "language") return /* @__PURE__ */ M(gn, {});
551
- let t = re(e.name);
552
- return t ? /* @__PURE__ */ M(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
553
- }, bn = xe(function({ item: e, motionProps: t, transition: n }, r) {
554
- let i = yn(e);
555
- 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, {
556
2460
  ref: r,
557
2461
  "data-toolbar-item-key": e.key,
558
- 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"]),
559
2463
  layout: "position",
560
2464
  transition: n,
561
2465
  ...t,
562
2466
  children: i
563
2467
  }, e.key);
564
- }), xn = ({ config: e, sizeToken: t }) => {
565
- 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), [
566
2470
  e,
567
- r,
568
- i
569
- ]), 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({
570
2474
  keys: s,
571
2475
  count: o.length
572
2476
  });
573
- h.keys !== s && g({
2477
+ p.keys !== s && m({
574
2478
  keys: s,
575
2479
  count: o.length
576
2480
  });
577
- let _ = h.keys === s ? h.count : o.length, v = L(_);
578
- v.current = _;
579
- let [y, x] = R(!1), S = {
580
- 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,
581
2485
  ease: "easeOut"
582
- }, C = a ? {} : _n, w = P(() => {
2486
+ }, S = i ? {} : la, C = T(() => {
583
2487
  let e = l.current;
584
- if (!e || m.current && v.current !== o.length) return;
2488
+ if (!e || f.current && g.current !== o.length) return;
585
2489
  let t = getComputedStyle(e), n = Number.parseFloat(t.columnGap || t.gap) || 0, r = e.clientWidth, i = new Set(o.map((e) => e.key));
586
2490
  e.querySelectorAll("[data-toolbar-item-key]").forEach((e) => {
587
2491
  let t = e.dataset.toolbarItemKey;
588
2492
  if (!t || !i.has(t)) return;
589
2493
  let n = e.getBoundingClientRect().width;
590
- (n > 0 || m.current) && (d.current[t] = n);
2494
+ (n > 0 || f.current) && (u.current[t] = n);
591
2495
  });
592
- let a = f.current?.offsetWidth ?? 0, c = o.map((e) => ({
593
- width: d.current[e.key] ?? 0,
2496
+ let a = d.current?.offsetWidth ?? 0, c = o.map((e) => ({
2497
+ width: u.current[e.key] ?? 0,
594
2498
  isDivider: e.kind === "divider"
595
2499
  }));
596
- 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({
597
2501
  keys: s,
598
- count: dn(c, r, a, n)
2502
+ count: fn(c, r, a, n)
599
2503
  }));
600
2504
  }, [s, o]);
601
- Te(() => {
602
- m.current = !0, d.current = {};
2505
+ j(() => {
2506
+ f.current = !0, u.current = {};
603
2507
  }, [
604
2508
  s,
605
2509
  o.length,
606
2510
  t
607
- ]), Te(() => {
608
- w();
2511
+ ]), j(() => {
2512
+ C();
609
2513
  let e = l.current;
610
2514
  if (!e || typeof ResizeObserver > "u") return;
611
- let t = new ResizeObserver(() => w());
2515
+ let t = new ResizeObserver(() => C());
612
2516
  return t.observe(e), () => t.disconnect();
613
2517
  }, [
614
- w,
2518
+ C,
615
2519
  s,
616
2520
  t
617
2521
  ]);
618
- let { visible: ee, overflow: T } = fn(o, _), E = T.length > 0, D = L(T);
619
- T.length > 0 && (D.current = T);
620
- let O = y && E, k = E || y && D.current.length > 0, A = E ? T : D.current;
621
- return /* @__PURE__ */ N("div", {
622
- className: z(p["bsy-lexical__toolbar-stack"], a && p["bsy-lexical__toolbar-stack--instant"]),
623
- 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", {
624
2528
  ref: l,
625
- className: p["bsy-lexical__toolbar-items"],
2529
+ className: G["bsy-lexical__toolbar-items"],
626
2530
  children: [
627
- /* @__PURE__ */ M(Ae, {
2531
+ /* @__PURE__ */ y(ae, {
628
2532
  initial: !1,
629
2533
  mode: "popLayout",
630
- children: ee.map((e) => /* @__PURE__ */ M(bn, {
2534
+ children: w.map((e) => /* @__PURE__ */ y(da, {
631
2535
  item: e,
632
- motionProps: C,
633
- transition: S
2536
+ motionProps: S,
2537
+ transition: x
634
2538
  }, e.key))
635
2539
  }),
636
- E ? /* @__PURE__ */ N("div", {
637
- className: z(p["bsy-lexical__toolbar-overflow"], p["bsy-lexical__toolbar-with-divider"]),
638
- children: [/* @__PURE__ */ M("div", { className: p["bsy-lexical__toolbar-divider"] }), /* @__PURE__ */ M(u, {
639
- icon: O ? "packupeverything" : "expandall",
640
- tooltip: c(O ? "editor.collapse" : "editor.expand"),
641
- highlight: O,
642
- 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)
643
2547
  })]
644
2548
  }) : null,
645
- /* @__PURE__ */ N("div", {
646
- ref: f,
647
- 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"]),
648
2552
  "aria-hidden": !0,
649
- 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, {
650
2554
  icon: "expandall",
651
2555
  tooltip: ""
652
2556
  })]
653
2557
  })
654
2558
  ]
655
- }), k ? /* @__PURE__ */ M("div", {
656
- className: z(p["bsy-lexical__toolbar-overflow-row"], O && p["bsy-lexical__toolbar-overflow-row--open"], a && p["bsy-lexical__toolbar-overflow-row--instant"]),
657
- children: /* @__PURE__ */ M("div", {
658
- className: p["bsy-lexical__toolbar-overflow-inner"],
659
- 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, {
660
2564
  item: e,
661
2565
  motionProps: {},
662
- transition: S
2566
+ transition: x
663
2567
  }, `overflow-${e.key}`))
664
2568
  })
665
2569
  }) : null]
666
2570
  });
667
- }, Sn = (e) => {
668
- 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 = {
669
- 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,
670
2574
  ease: "easeOut"
671
- }, 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, [
672
2576
  "position",
673
2577
  "left",
674
2578
  "top",
@@ -679,26 +2583,26 @@ var mn = (e) => {
679
2583
  "marginTop",
680
2584
  "marginBottom"
681
2585
  ]) : n;
682
- return /* @__PURE__ */ M(l, {
683
- value: g,
684
- 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, {
685
2589
  ref: c,
686
- layout: f || d ? !1 : "position",
687
- transition: m,
688
- 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"]),
689
2593
  style: {
2594
+ ...p,
2595
+ ...u ? { top: o } : null,
690
2596
  ...h,
691
- ...d ? { top: o } : null,
692
- ..._,
693
- ...y
2597
+ ..._
694
2598
  },
695
- children: /* @__PURE__ */ M(xn, {
2599
+ children: /* @__PURE__ */ y(fa, {
696
2600
  config: t,
697
2601
  sizeToken: `${s}|${r?.itemHeight ?? ""}|${r?.iconSize ?? ""}`
698
2602
  })
699
2603
  }) }) })
700
2604
  });
701
- }, X = {
2605
+ }, $ = {
702
2606
  "bsy-lexical-editor": "_bsy-lexical-editor_1l05x_1",
703
2607
  "bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_1l05x_8",
704
2608
  "bsy-lexical-editor--sticky-toolbar": "_bsy-lexical-editor--sticky-toolbar_1l05x_8",
@@ -708,12 +2612,12 @@ var mn = (e) => {
708
2612
  "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1l05x_28",
709
2613
  "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1l05x_41",
710
2614
  "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1l05x_53"
711
- }, Cn = (e) => {
2615
+ }, ma = (e) => {
712
2616
  if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
713
- }, wn = (e) => {
2617
+ }, ha = (e) => {
714
2618
  let t = {};
715
- 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;
716
- }, 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 {
717
2621
  constructor(e, t) {
718
2622
  super(e, t);
719
2623
  }
@@ -724,46 +2628,46 @@ var mn = (e) => {
724
2628
  return new e(t.__text, t.__key);
725
2629
  }
726
2630
  static importDOM() {
727
- let e = _t.importDOM();
2631
+ let e = nt.importDOM();
728
2632
  return {
729
2633
  ...e,
730
2634
  code: () => ({
731
- conversion: Q(e?.code),
2635
+ conversion: va(e?.code),
732
2636
  priority: 1
733
2637
  }),
734
2638
  em: () => ({
735
- conversion: Q(e?.em),
2639
+ conversion: va(e?.em),
736
2640
  priority: 1
737
2641
  }),
738
2642
  span: () => ({
739
- conversion: Q(e?.span),
2643
+ conversion: va(e?.span),
740
2644
  priority: 1
741
2645
  }),
742
2646
  strong: () => ({
743
- conversion: Q(e?.strong),
2647
+ conversion: va(e?.strong),
744
2648
  priority: 1
745
2649
  }),
746
2650
  sub: () => ({
747
- conversion: Q(e?.sub),
2651
+ conversion: va(e?.sub),
748
2652
  priority: 1
749
2653
  }),
750
2654
  sup: () => ({
751
- conversion: Q(e?.sup),
2655
+ conversion: va(e?.sup),
752
2656
  priority: 1
753
2657
  })
754
2658
  };
755
2659
  }
756
2660
  static importJSON(e) {
757
- return Tn().updateFromJSON(e);
2661
+ return _a().updateFromJSON(e);
758
2662
  }
759
2663
  isSimpleText() {
760
2664
  return this.__type === "extended-text" && this.__mode === 0;
761
2665
  }
762
2666
  };
763
- function Tn(e = "") {
764
- return Ve(new Z(e));
2667
+ function _a(e = "") {
2668
+ return _e(new ga(e));
765
2669
  }
766
- function Q(e) {
2670
+ function va(e) {
767
2671
  return (t) => {
768
2672
  let n = e?.(t);
769
2673
  if (!n) return null;
@@ -774,7 +2678,7 @@ function Q(e) {
774
2678
  ...r,
775
2679
  forChild: (e, t) => {
776
2680
  let n = (r?.forChild ?? ((e) => e))(e, t);
777
- if ($e(n)) {
2681
+ if (Ae(n)) {
778
2682
  let e = [
779
2683
  i ? `background-color: ${i}` : null,
780
2684
  a ? `color: ${a}` : null,
@@ -792,81 +2696,81 @@ function Q(e) {
792
2696
  }
793
2697
  //#endregion
794
2698
  //#region src/components/Editor/utils/stripInlineStyleProperty.ts
795
- function En(e, t) {
2699
+ function ya(e, t) {
796
2700
  return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
797
2701
  }
798
2702
  //#endregion
799
2703
  //#region src/components/Editor/plugins/LinkColorPlugin.tsx
800
- function Dn(e) {
801
- if (!G(e, Et)) return;
2704
+ function ba(e) {
2705
+ if (!H(e, lt)) return;
802
2706
  let t = e.getStyle();
803
2707
  if (!t) return;
804
- let n = En(t, "color");
2708
+ let n = ya(t, "color");
805
2709
  n !== t && e.setStyle(n);
806
2710
  }
807
- function On() {
808
- let [e] = W();
809
- return F(() => e.registerNodeTransform(Z, Dn), [e]), null;
2711
+ function xa() {
2712
+ let [e] = B();
2713
+ return O(() => e.registerNodeTransform(ga, ba), [e]), null;
810
2714
  }
811
2715
  //#endregion
812
2716
  //#region src/components/Editor/plugins/ImagePlugin.tsx
813
- function kn() {
814
- let [e] = W();
815
- 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;
816
2720
  }
817
2721
  //#endregion
818
2722
  //#region src/components/Editor/utils/stripImagesFromHtml.ts
819
- function An(e) {
2723
+ function Ca(e) {
820
2724
  let t = new DOMParser().parseFromString(e, "text/html");
821
2725
  return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
822
2726
  }
823
2727
  //#endregion
824
2728
  //#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
825
- var jn = /<img\b|<picture\b/i;
826
- function Mn() {
827
- let [e] = W(), { isSourceModeRef: t } = de();
828
- return F(() => {
2729
+ var wa = /<img\b|<picture\b/i;
2730
+ function Ta() {
2731
+ let [e] = B(), { isSourceModeRef: t } = Vr();
2732
+ return O(() => {
829
2733
  let n = (n) => {
830
2734
  if (t.current) return !1;
831
2735
  let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
832
2736
  if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
833
2737
  let i = r.getData("text/html");
834
- 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;
835
2739
  n.preventDefault();
836
2740
  let a = r.getData("text/plain");
837
- return !jn.test(i) && !a || e.update(() => {
838
- let t = H();
2741
+ return !wa.test(i) && !a || e.update(() => {
2742
+ let t = R();
839
2743
  if (t === null) return;
840
- let n = i ? An(i) : "", r = document.createElement("div");
2744
+ let n = i ? Ca(i) : "", r = document.createElement("div");
841
2745
  if (r.innerHTML = n, n && r.textContent?.trim()) {
842
- let t = Be(e, new DOMParser().parseFromString(n, "text/html"));
2746
+ let t = ge(e, new DOMParser().parseFromString(n, "text/html"));
843
2747
  if (t.length) {
844
- Je(t);
2748
+ Te(t);
845
2749
  return;
846
2750
  }
847
2751
  }
848
2752
  a && t.insertRawText(a);
849
- }, { tag: ht }), !0;
2753
+ }, { tag: $e }), !0;
850
2754
  };
851
- 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));
852
2756
  }, [e, t]), null;
853
2757
  }
854
2758
  //#endregion
855
2759
  //#region src/components/Editor/plugins/EnterKeyPlugin.tsx
856
- function Nn() {
857
- let [e] = W(), t = L(0);
858
- return F(() => e.registerCommand(ft, (n) => {
2760
+ function Ea() {
2761
+ let [e] = B(), t = N(0);
2762
+ return O(() => e.registerCommand(Ye, (n) => {
859
2763
  let r = Date.now(), i = r - t.current;
860
2764
  return t.current = r, i < 250 && i > 0 ? e.getEditorState().read(() => {
861
- let e = H();
862
- 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;
863
2767
  }, { editor: e }) ? !1 : (e.update(() => {
864
- let e = H();
865
- if (U(e)) {
2768
+ let e = R();
2769
+ if (z(e)) {
866
2770
  let t = e.anchor.getNode().getTopLevelElement();
867
2771
  if (t && t.getTextContent().trim() === "") {
868
- let n = Ue();
869
- St(e, {
2772
+ let n = ye();
2773
+ kt(e, {
870
2774
  "background-color": "",
871
2775
  color: "",
872
2776
  "font-size": "",
@@ -879,11 +2783,11 @@ function Nn() {
879
2783
  }
880
2784
  }
881
2785
  }), n?.preventDefault(), !0) : !1;
882
- }, st), [e]), null;
2786
+ }, Ve), [e]), null;
883
2787
  }
884
2788
  //#endregion
885
2789
  //#region src/components/Editor/utils/codeHighlighter.ts
886
- var Pn = {
2790
+ var Da = {
887
2791
  css: () => import("@shikijs/langs/css"),
888
2792
  html: () => import("@shikijs/langs/html"),
889
2793
  xml: () => import("@shikijs/langs/xml"),
@@ -904,65 +2808,70 @@ var Pn = {
904
2808
  bash: () => import("@shikijs/langs/shellscript"),
905
2809
  lua: () => import("@shikijs/langs/lua"),
906
2810
  markdown: () => import("@shikijs/langs/markdown")
907
- }, 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({
908
2812
  engine: t(),
909
2813
  langs: [],
910
2814
  themes: []
911
2815
  })).catch((e) => {
912
- throw Ln = null, e;
913
- }), Ln), Vn = (e, t) => In(t) && e.getLoadedLanguages().includes(Fn(t)), Hn = (e) => {
914
- let t = zn.get(e);
915
- return t || (t = Bn().then(async (t) => {
916
- 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);
917
2821
  if (!t.getLoadedLanguages().includes(n)) {
918
- let n = await Pn[e]();
2822
+ let n = await Da[e]();
919
2823
  await t.loadLanguage(n.default);
920
2824
  }
921
2825
  return t;
922
2826
  }).catch((t) => {
923
- throw zn.delete(e), t;
924
- }), zn.set(e, t)), t;
925
- }, 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) => {
926
2830
  if (!e.getLoadedThemes().includes("github-light")) {
927
2831
  let t = await import("@shikijs/themes/github-light");
928
2832
  await e.loadTheme(t.default);
929
2833
  }
930
2834
  return e;
931
2835
  }).catch((e) => {
932
- throw Rn = null, e;
933
- }), Rn), Wn = (e, t, n) => {
2836
+ throw ja = null, e;
2837
+ }), ja), La = (e, t, n) => {
934
2838
  let r = e.getTextContent();
935
- if (e.getStyle() && e.setStyle(""), !n || !Vn(n, t)) return Ft(r);
936
- 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, {
937
2841
  lang: i,
938
- theme: k
2842
+ theme: Sn
939
2843
  }), o = [];
940
2844
  return a.tokens.forEach((e, t) => {
941
- t && o.push(He()), e.forEach((e) => {
2845
+ t && o.push(ve()), e.forEach((e) => {
942
2846
  e.content.split(" ").forEach((t, n) => {
943
- if (n && o.push(We()), t === "") return;
944
- 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}` : "";
945
2849
  i && r.setStyle(i), o.push(r);
946
2850
  });
947
2851
  });
948
2852
  }), o;
949
- }, Gn = (e, t) => {
950
- let n = B(e);
951
- if (!q(n) || !n.isAttached()) return;
952
- let r = H();
953
- 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)) {
954
2858
  t();
955
2859
  return;
956
2860
  }
957
- 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;
958
2867
  if (o || (s = a + i.getNode().getPreviousSiblings().reduce((e, t) => e + t.getTextContentSize(), 0)), t()) {
959
2868
  if (o) {
960
2869
  i.getNode().select(a, a);
961
2870
  return;
962
2871
  }
963
2872
  n.getChildren().some((e) => {
964
- let t = $e(e);
965
- if (t || Xe(e)) {
2873
+ let t = Ae(e);
2874
+ if (t || De(e)) {
966
2875
  let n = e.getTextContentSize();
967
2876
  if (t && n >= s) return e.select(s, s), !0;
968
2877
  s -= n;
@@ -970,11 +2879,11 @@ var Pn = {
970
2879
  return !1;
971
2880
  });
972
2881
  }
973
- }, 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) => {
974
2883
  let n = 0;
975
- for (; n < e.length && Kn(e[n], t[n]);) n++;
2884
+ for (; n < e.length && za(e[n], t[n]);) n++;
976
2885
  let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
977
- 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])) {
978
2887
  o--;
979
2888
  break;
980
2889
  }
@@ -983,21 +2892,21 @@ var Pn = {
983
2892
  to: r - o,
984
2893
  nodesForReplacement: t.slice(n, i - o)
985
2894
  };
986
- }, Jn = (e, t, n, r, i) => {
987
- let a = i.getKey(), o = d(i.getLanguage());
2895
+ }, Va = (e, t, n, r, i) => {
2896
+ let a = i.getKey(), o = Tn(i.getLanguage());
988
2897
  if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
989
2898
  else {
990
- i.getTheme() !== "github-light" && i.setTheme(k);
991
- 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();
992
2901
  if (s) {
993
2902
  i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
994
2903
  r(t);
995
2904
  let i = [...n.pendingKeys];
996
2905
  n.pendingKeys.clear(), n.loading = null, e.update(() => {
997
2906
  i.forEach((e) => {
998
- B(e)?.markDirty();
2907
+ Ce(e)?.markDirty();
999
2908
  });
1000
- }, { tag: ut });
2909
+ }, { tag: qe });
1001
2910
  }, () => {
1002
2911
  n.pendingKeys.clear(), n.loading = null;
1003
2912
  }));
@@ -1005,22 +2914,22 @@ var Pn = {
1005
2914
  }
1006
2915
  i.getIsSyntaxHighlightSupported() || i.setIsSyntaxHighlightSupported(!0);
1007
2916
  }
1008
- 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(() => {
1009
2918
  n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
1010
- })), Gn(a, () => {
1011
- let e = B(a);
1012
- if (!q(e) || !e.isAttached()) return !1;
1013
- 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);
1014
2923
  return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
1015
2924
  }));
1016
- }, Yn = (e, t, n, r, i) => {
2925
+ }, Ha = (e, t, n, r, i) => {
1017
2926
  let a = i.getParent();
1018
- 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));
1019
2928
  };
1020
- function Xn() {
1021
- let [e] = W();
1022
- return F(() => {
1023
- 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");
1024
2933
  let t = null, n = {
1025
2934
  didTransform: !1,
1026
2935
  nodesCurrentlyHighlighting: /* @__PURE__ */ new Set(),
@@ -1029,16 +2938,16 @@ function Xn() {
1029
2938
  }, r = (e) => {
1030
2939
  t = e;
1031
2940
  }, i = (e) => {
1032
- let t = B(e);
1033
- if (!q(t)) return;
2941
+ let t = Ce(e);
2942
+ if (!V(t)) return;
1034
2943
  let n = t.getChildrenSize();
1035
2944
  n === 0 ? t.selectStart() : t.select(0, n);
1036
2945
  }, a = (t) => {
1037
2946
  if (!(t instanceof Node) || !e.getRootElement()?.contains(t)) return null;
1038
2947
  let n = null;
1039
2948
  return e.getEditorState().read(() => {
1040
- let e = Ke(t), r = e ? G(e, q) : null;
1041
- q(r) && (n = r.getKey());
2949
+ let e = Se(t), r = e ? H(e, V) : null;
2950
+ V(r) && (n = r.getKey());
1042
2951
  }, { editor: e }), n;
1043
2952
  }, o = null, s = (t, n, r) => {
1044
2953
  t.preventDefault(), r && (o = n), e.update(() => {
@@ -1060,12 +2969,12 @@ function Xn() {
1060
2969
  }, d = (e, t) => {
1061
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);
1062
2971
  };
1063
- return yt(Rt(e), e.registerNodeTransform(Lt, (i) => {
1064
- Jn(e, t, n, r, i);
1065
- }), e.registerNodeTransform(_t, (i) => {
1066
- Yn(e, t, n, r, i);
1067
- }), e.registerNodeTransform(It, (i) => {
1068
- 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);
1069
2978
  }), e.registerRootListener(d), () => {
1070
2979
  d(null, e.getRootElement());
1071
2980
  });
@@ -1073,23 +2982,23 @@ function Xn() {
1073
2982
  }
1074
2983
  //#endregion
1075
2984
  //#region src/components/Editor/plugins/TablePlugin.tsx
1076
- function Zn() {
1077
- let [e] = W();
1078
- 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) => {
1079
2988
  e.getBackgroundColor() !== null && e.setBackgroundColor(null);
1080
- }), e.registerCommand(pt, (e) => {
1081
- let t = H();
1082
- if (!U(t) || !t.isCollapsed()) return !1;
1083
- 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());
1084
2993
  if (n === null) return !1;
1085
2994
  let r = e.shiftKey ? "previous" : "next", i = r === "next" ? "getNextSibling" : "getPreviousSibling", a = r === "next" ? "getFirstChild" : "getLastChild", o = n[i](), s = null;
1086
- if (Bt(o)) s = o;
2995
+ if (Nt(o)) s = o;
1087
2996
  else {
1088
- let e = G(n, Ht);
2997
+ let e = H(n, Ft);
1089
2998
  if (e !== null) for (let t = e[i](); t !== null; t = t[i]()) {
1090
- if (!Ht(t)) continue;
2999
+ if (!Ft(t)) continue;
1091
3000
  let e = t[a]();
1092
- if (Bt(e)) {
3001
+ if (Nt(e)) {
1093
3002
  s = e;
1094
3003
  break;
1095
3004
  }
@@ -1099,60 +3008,60 @@ function Zn() {
1099
3008
  let e = s.getFirstDescendant();
1100
3009
  e ? e.selectStart() : s.selectStart();
1101
3010
  } else {
1102
- let e = G(n, Vt);
3011
+ let e = H(n, Pt);
1103
3012
  e && (r === "next" ? e.selectNext() : e.selectPrevious());
1104
3013
  }
1105
3014
  return !0;
1106
- }, ot))), [e]), null;
3015
+ }, Be))), [e]), null;
1107
3016
  }
1108
3017
  //#endregion
1109
3018
  //#region src/components/Editor/plugins/TabIndentPlugin.tsx
1110
- var Qn = "\xA0".repeat(4);
1111
- function $n() {
1112
- let [e] = W();
1113
- 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) => {
1114
3023
  if (t.shiftKey) return !1;
1115
- let n = H();
1116
- if (!U(n)) return !1;
3024
+ let n = R();
3025
+ if (!z(n)) return !1;
1117
3026
  let r = n.anchor.getNode();
1118
- if (zt(r) !== null || G(r, q)) return !1;
3027
+ if (Mt(r) !== null || H(r, V)) return !1;
1119
3028
  t.preventDefault();
1120
- let i = G(r, K);
1121
- if (K(i)) {
3029
+ let i = H(r, mt);
3030
+ if (mt(i)) {
1122
3031
  let e = new Set([i]);
1123
3032
  for (let t of n.getNodes()) {
1124
- let n = G(t, K);
1125
- K(n) && e.add(n);
3033
+ let n = H(t, mt);
3034
+ mt(n) && e.add(n);
1126
3035
  }
1127
3036
  for (let t of e) t.setIndent(t.getIndent() + 1);
1128
3037
  return !0;
1129
3038
  }
1130
3039
  let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
1131
- return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(dt, void 0) : (n.insertText(Qn), !0);
1132
- }, at), [e]), null;
3040
+ return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(Je, void 0) : (n.insertText(Ga), !0);
3041
+ }, ze), [e]), null;
1133
3042
  }
1134
3043
  //#endregion
1135
3044
  //#region src/components/Editor/plugins/MaxLengthPlugin.tsx
1136
- function er({ maxLength: e, onMaxLengthExceed: t }) {
1137
- let [n] = W(), { isSourceModeRef: r } = de(), i = L(t);
1138
- 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(() => {
1139
3048
  let t = null;
1140
- return n.registerNodeTransform(gt, (a) => {
3049
+ return n.registerNodeTransform(tt, (a) => {
1141
3050
  if (r.current) return;
1142
3051
  let o = a.getTextContentSize();
1143
3052
  if (o <= e) return;
1144
- 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();
1145
3054
  if (c === e && t !== s) {
1146
- t = s, wt(n, s), i.current?.();
3055
+ t = s, Jt(n, s), i.current?.();
1147
3056
  return;
1148
3057
  }
1149
- if (U(u) && u.isCollapsed()) {
1150
- Ct(n, u.anchor, l), i.current?.();
3058
+ if (z(u) && u.isCollapsed()) {
3059
+ jt(n, u.anchor, l), i.current?.();
1151
3060
  return;
1152
3061
  }
1153
3062
  a.selectEnd();
1154
- let d = H();
1155
- U(d) && (Ct(n, d.anchor, l), i.current?.());
3063
+ let d = R();
3064
+ z(d) && (jt(n, d.anchor, l), i.current?.());
1156
3065
  });
1157
3066
  }, [
1158
3067
  n,
@@ -1162,19 +3071,19 @@ function er({ maxLength: e, onMaxLengthExceed: t }) {
1162
3071
  }
1163
3072
  //#endregion
1164
3073
  //#region src/components/Editor/utils/textLength.ts
1165
- function tr(e) {
3074
+ function Ja(e) {
1166
3075
  return typeof e == "number" && Number.isFinite(e) && e > 0;
1167
3076
  }
1168
- function nr(e, t) {
1169
- let n = V(), r = n.getTextContentSize();
3077
+ function Ya(e, t) {
3078
+ let n = L(), r = n.getTextContentSize();
1170
3079
  if (r <= t) return !1;
1171
3080
  let i = r - t;
1172
3081
  n.selectEnd();
1173
- let a = H();
1174
- 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;
1175
3084
  }
1176
- function rr(e) {
1177
- let t = e, n = V().getAllTextNodes();
3085
+ function Xa(e) {
3086
+ let t = e, n = L().getAllTextNodes();
1178
3087
  for (let e = n.length - 1; e >= 0 && t > 0; e--) {
1179
3088
  let r = n[e], i = r.getTextContent();
1180
3089
  i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
@@ -1182,7 +3091,7 @@ function rr(e) {
1182
3091
  }
1183
3092
  //#endregion
1184
3093
  //#region src/components/Editor/utils/formatEditorHtml.ts
1185
- var ir = new Set([
3094
+ var Za = new Set([
1186
3095
  "area",
1187
3096
  "base",
1188
3097
  "br",
@@ -1197,73 +3106,73 @@ var ir = new Set([
1197
3106
  "source",
1198
3107
  "track",
1199
3108
  "wbr"
1200
- ]), 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) => {
1201
- let r = e.tagName.toLowerCase(), i = `<${r}${lr(e)}>`;
1202
- if (ir.has(r)) return i;
1203
- let a = n || r === "pre", o = fr(e, t + 1, a), s = `</${r}>`;
1204
- 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}`;
1205
- }, 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) => {
1206
3115
  let i = [];
1207
3116
  for (let r of Array.from(e.childNodes)) {
1208
3117
  if (r.nodeType === Node.TEXT_NODE) {
1209
3118
  let e = r.textContent ?? "";
1210
3119
  if (n) {
1211
- i.push(cr(e));
3120
+ i.push(to(e));
1212
3121
  continue;
1213
3122
  }
1214
- e.trim() && i.push(cr(e));
3123
+ e.trim() && i.push(to(e));
1215
3124
  continue;
1216
3125
  }
1217
3126
  if (r.nodeType === Node.COMMENT_NODE) {
1218
3127
  i.push(`<!--${r.data}-->`);
1219
3128
  continue;
1220
3129
  }
1221
- r.nodeType === Node.ELEMENT_NODE && i.push(dr(r, t, n));
3130
+ r.nodeType === Node.ELEMENT_NODE && i.push(io(r, t, n));
1222
3131
  }
1223
- 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");
1224
3133
  };
1225
- function pr(e) {
1226
- 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;
1227
3136
  }
1228
3137
  //#endregion
1229
3138
  //#region src/components/Editor/utils/writeHtmlSource.ts
1230
- function mr(e) {
1231
- V().clear();
1232
- let t = Nt("html");
1233
- 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;
1234
3143
  t.select();
1235
- let n = H();
1236
- U(n) && n.insertRawText(e);
3144
+ let n = R();
3145
+ z(n) && n.insertRawText(e);
1237
3146
  }
1238
3147
  //#endregion
1239
3148
  //#region src/components/Editor/plugins/SourceModePlugin.tsx
1240
- function hr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
1241
- 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);
1242
3151
  s.current = n;
1243
- let c = tr(t) ? t : void 0, l = P(() => {
3152
+ let c = Ja(t) ? t : void 0, l = T(() => {
1244
3153
  if (o.current) return;
1245
3154
  let e = "", t = "";
1246
3155
  r.getEditorState().read(() => {
1247
- t = V().getTextContent(), e = ze(r, null);
3156
+ t = L().getTextContent(), e = he(r, null);
1248
3157
  }, { editor: r });
1249
- let n = ie(e, t) ? "" : T(e);
3158
+ let n = ei(e, t) ? "" : X(e);
1250
3159
  o.current = !0, a(!0), r.update(() => {
1251
- mr(pr(n));
1252
- }), r.dispatchCommand(rt, void 0);
1253
- }, [r]), u = P(() => {
3160
+ so(oo(n));
3161
+ }), r.dispatchCommand(Le, void 0);
3162
+ }, [r]), u = T(() => {
1254
3163
  if (!o.current) return;
1255
3164
  let e = !1;
1256
3165
  o.current = !1, r.update(() => {
1257
- ne(r, T(V().getTextContent())), c !== void 0 && (e = nr(r, c));
1258
- }), a(!1), r.dispatchCommand(rt, void 0), e && s.current?.();
1259
- }, [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(() => {
1260
3169
  if (o.current) {
1261
3170
  u();
1262
3171
  return;
1263
3172
  }
1264
3173
  l();
1265
3174
  }, [l, u]);
1266
- F(() => {
3175
+ O(() => {
1267
3176
  let e = (e) => {
1268
3177
  if (!o.current) return !1;
1269
3178
  let t = "clipboardData" in e ? e.clipboardData : "dataTransfer" in e ? e.dataTransfer : null;
@@ -1271,53 +3180,53 @@ function hr({ children: e, maxLength: t, onMaxLengthExceed: n }) {
1271
3180
  e.preventDefault();
1272
3181
  let n = t.getData("text/html") || t.getData("text/plain");
1273
3182
  if (!n) return !0;
1274
- let i = T(n);
3183
+ let i = X(n);
1275
3184
  return r.update(() => {
1276
- let e = H();
1277
- U(e) && i && e.insertRawText(i);
1278
- }, { tag: ht }), !0;
3185
+ let e = R();
3186
+ z(e) && i && e.insertRawText(i);
3187
+ }, { tag: $e }), !0;
1279
3188
  };
1280
- return Tt(r.registerNodeTransform(gt, () => {
3189
+ return Yt(r.registerNodeTransform(tt, () => {
1281
3190
  if (!o.current) return;
1282
- let e = V(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
1283
- q(t) && t.getLanguage() === "html" || mr(e.getTextContent());
1284
- }), 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));
1285
3194
  }, [r]);
1286
- let f = I(() => ({
3195
+ let f = M(() => ({
1287
3196
  isSourceMode: i,
1288
3197
  isSourceModeRef: o,
1289
3198
  toggleSourceMode: d
1290
3199
  }), [i, d]);
1291
- return /* @__PURE__ */ M(ce.Provider, {
3200
+ return /* @__PURE__ */ y(Br.Provider, {
1292
3201
  value: f,
1293
3202
  children: e
1294
3203
  });
1295
3204
  }
1296
3205
  //#endregion
1297
3206
  //#region src/components/Editor/plugins/HeadingPlugin.tsx
1298
- function gr(e) {
3207
+ function lo(e) {
1299
3208
  let t = e.getTag();
1300
3209
  if (t === "h4" || t === "h5" || t === "h6") {
1301
- e.replace(Ue(), !0);
3210
+ e.replace(ye(), !0);
1302
3211
  return;
1303
3212
  }
1304
3213
  for (let t of e.getAllTextNodes()) {
1305
3214
  let e = t.getStyle();
1306
3215
  if (!e) continue;
1307
- let n = En(e, "font-size");
3216
+ let n = ya(e, "font-size");
1308
3217
  n !== e && t.setStyle(n);
1309
3218
  }
1310
3219
  }
1311
- function _r() {
1312
- let [e] = W();
1313
- return F(() => e.registerNodeTransform(Qt, gr), [e]), null;
3220
+ function uo() {
3221
+ let [e] = B();
3222
+ return O(() => e.registerNodeTransform(qt, lo), [e]), null;
1314
3223
  }
1315
3224
  //#endregion
1316
3225
  //#region src/components/Editor/LengthBadge.tsx
1317
- var vr = ({ current: e, maxLength: t }) => {
3226
+ var fo = ({ current: e, maxLength: t }) => {
1318
3227
  let n = e > t;
1319
- return /* @__PURE__ */ N("div", {
1320
- 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"]),
1321
3230
  "aria-live": "polite",
1322
3231
  children: [
1323
3232
  e,
@@ -1326,33 +3235,33 @@ var vr = ({ current: e, maxLength: t }) => {
1326
3235
  ]
1327
3236
  });
1328
3237
  };
1329
- vr.displayName = "BsyLexicalEditorLengthBadge";
3238
+ fo.displayName = "BsyLexicalEditorLengthBadge";
1330
3239
  //#endregion
1331
3240
  //#region src/components/Editor/utils/unwrapTypesetFence.ts
1332
- 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) => {
1333
3242
  let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
1334
- return br.test(r) ? {
3243
+ return mo.test(r) ? {
1335
3244
  text: n === -1 ? "" : t.slice(0, n),
1336
3245
  withheld: !0
1337
3246
  } : {
1338
3247
  text: e,
1339
3248
  withheld: !1
1340
3249
  };
1341
- }, kr = (e) => {
1342
- let t = xr.exec(e);
3250
+ }, Co = (e) => {
3251
+ let t = ho.exec(e);
1343
3252
  return t ? { sameLineBody: t[4] ?? "" } : null;
1344
- }, Ar = (e) => {
3253
+ }, wo = (e) => {
1345
3254
  let t = e.replace(/[ \t]*```[ \t]*$/, "");
1346
3255
  return t === e ? e : t;
1347
- }, jr = (e) => Tr(e) ? e.replace(/^\n/, "") : "", Mr = (e) => {
3256
+ }, To = (e) => yo(e) ? e.replace(/^\n/, "") : "", Eo = (e) => {
1348
3257
  let t = e.split("\n"), n = [], r = 0;
1349
3258
  for (; r < t.length;) {
1350
- let e = t[r], i = kr(e);
3259
+ let e = t[r], i = Co(e);
1351
3260
  if (i) {
1352
3261
  let e = i.sameLineBody;
1353
- if (e !== Ar(e)) {
1354
- e = Ar(e);
1355
- 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"));
1356
3265
  return [
1357
3266
  ...n,
1358
3267
  e,
@@ -1360,38 +3269,38 @@ var yr = /^\uFEFF/, br = /^ {0,3}`{1,3}[A-Za-z]*$/, xr = /^( {0,3})([^`<]*?)```[
1360
3269
  ].filter(Boolean).join("\n");
1361
3270
  }
1362
3271
  let a = [];
1363
- for (e && a.push(e), r += 1; r < t.length && !Sr.test(t[r]);) a.push(t[r]), r += 1;
1364
- 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")) : "";
1365
3274
  return [
1366
3275
  ...n,
1367
3276
  a.join("\n"),
1368
3277
  o
1369
3278
  ].filter(Boolean).join("\n");
1370
3279
  }
1371
- if (Er(e)) return Nr([...n, ...t.slice(r)].join("\n"));
1372
- 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;
1373
3282
  }
1374
3283
  return n.length ? n.join("\n") : null;
1375
- }, Nr = (e) => {
3284
+ }, Do = (e) => {
1376
3285
  let t = e.split("\n");
1377
3286
  if (!t.length) return e;
1378
- let n = kr(t[0]);
1379
- 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");
1380
3289
  };
1381
- function Pr(e) {
3290
+ function Oo(e) {
1382
3291
  if (!e) return {
1383
3292
  html: "",
1384
3293
  pending: !1
1385
3294
  };
1386
- let { text: t, withheld: n } = Or(Dr(e));
3295
+ let { text: t, withheld: n } = So(xo(e));
1387
3296
  if (!t.trim()) return {
1388
3297
  html: "",
1389
- pending: n || br.test(Dr(e).trim())
3298
+ pending: n || mo.test(xo(e).trim())
1390
3299
  };
1391
- let r = Mr(t) ?? t, i = Mr(r);
3300
+ let r = Eo(t) ?? t, i = Eo(r);
1392
3301
  i !== null && i !== r && (r = i);
1393
3302
  let a = r.trim();
1394
- return Tr(a) ? {
3303
+ return yo(a) ? {
1395
3304
  html: a,
1396
3305
  pending: !1
1397
3306
  } : {
@@ -1401,32 +3310,32 @@ function Pr(e) {
1401
3310
  }
1402
3311
  //#endregion
1403
3312
  //#region src/components/Editor/utils/prepareTypesetProposed.ts
1404
- var Fr = "p, h1, h2, h3, li", Ir = /background(-color)?\s*:/i;
1405
- function Lr(e) {
1406
- if (!e.trim() || !Ir.test(e)) return e;
1407
- 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);
1408
3317
  if (!t) return e;
1409
- for (let e of Array.from(t.querySelectorAll(Fr))) {
3318
+ for (let e of Array.from(t.querySelectorAll(ko))) {
1410
3319
  let t = e;
1411
3320
  t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
1412
3321
  }
1413
3322
  return t.innerHTML;
1414
3323
  }
1415
- function Rr(e, t) {
1416
- let { html: n } = Pr(e);
1417
- return n ? Lr(ee(n, t)) : "";
3324
+ function Mo(e, t) {
3325
+ let { html: n } = Oo(e);
3326
+ return n ? jo(hi(n, t)) : "";
1418
3327
  }
1419
3328
  //#endregion
1420
3329
  //#region src/components/Editor/utils/applyAiTypeset.ts
1421
- function zr(e, t, n, r) {
1422
- let i = T(Rr(t, n));
1423
- 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 {
1424
3333
  applied: !1,
1425
3334
  truncated: !1
1426
3335
  };
1427
3336
  let a = !1;
1428
3337
  return e.update(() => {
1429
- ne(e, i), tr(r) && (a = nr(e, r));
3338
+ $r(e, i), Ja(r) && (a = Ya(e, r)), Dn(!0);
1430
3339
  }, { discrete: !0 }), {
1431
3340
  applied: !0,
1432
3341
  truncated: a
@@ -1434,26 +3343,26 @@ function zr(e, t, n, r) {
1434
3343
  }
1435
3344
  //#endregion
1436
3345
  //#region src/components/Editor/Preview/Thinking.tsx
1437
- var Br = [
3346
+ var Po = [
1438
3347
  .26,
1439
3348
  .02,
1440
3349
  .23,
1441
3350
  .94
1442
- ], Vr = () => {
1443
- let e = `${we().replace(/:/g, "")}g`;
1444
- return /* @__PURE__ */ M("span", {
1445
- 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"],
1446
3355
  "aria-hidden": "true",
1447
- children: /* @__PURE__ */ N("svg", {
3356
+ children: /* @__PURE__ */ b("svg", {
1448
3357
  xmlns: "http://www.w3.org/2000/svg",
1449
3358
  width: "16",
1450
3359
  height: "16",
1451
3360
  viewBox: "0 0 16 16",
1452
3361
  fill: "none",
1453
- children: [/* @__PURE__ */ M("path", {
3362
+ children: [/* @__PURE__ */ y("path", {
1454
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",
1455
3364
  fill: `url(#${e})`
1456
- }), /* @__PURE__ */ M("defs", { children: /* @__PURE__ */ N("linearGradient", {
3365
+ }), /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ b("linearGradient", {
1457
3366
  id: e,
1458
3367
  x1: "8.00059",
1459
3368
  y1: "1",
@@ -1461,12 +3370,12 @@ var Br = [
1461
3370
  y2: "14.8072",
1462
3371
  gradientUnits: "userSpaceOnUse",
1463
3372
  children: [
1464
- /* @__PURE__ */ M("stop", { stopColor: "#0265FF" }),
1465
- /* @__PURE__ */ M("stop", {
3373
+ /* @__PURE__ */ y("stop", { stopColor: "#0265FF" }),
3374
+ /* @__PURE__ */ y("stop", {
1466
3375
  offset: "1",
1467
3376
  stopColor: "#A6FFFF"
1468
3377
  }),
1469
- /* @__PURE__ */ M("animateTransform", {
3378
+ /* @__PURE__ */ y("animateTransform", {
1470
3379
  attributeName: "gradientTransform",
1471
3380
  type: "rotate",
1472
3381
  from: "0 8 8",
@@ -1479,15 +3388,15 @@ var Br = [
1479
3388
  })
1480
3389
  });
1481
3390
  };
1482
- function Hr(e, t, r) {
1483
- 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) => {
1484
3393
  !e || !p.current || (p.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (f.current = !0));
1485
- }, v = P(() => r?.current ?? void 0, [r]), y = P(() => {
3394
+ }, v = T(() => n?.current ?? void 0, [n]), y = T(() => {
1486
3395
  let e = v();
1487
3396
  return e?.closest("[data-overlayscrollbars]") ?? e;
1488
3397
  }, [v]);
1489
- return F(() => {
1490
- if (!a) {
3398
+ return O(() => {
3399
+ if (!i) {
1491
3400
  d.current === null && (d.current = Math.max(1, Math.round((Date.now() - u.current) / 1e3)), l(d.current)), s(!1);
1492
3401
  return;
1493
3402
  }
@@ -1496,62 +3405,62 @@ function Hr(e, t, r) {
1496
3405
  l(Math.max(1, Math.round((Date.now() - u.current) / 1e3)));
1497
3406
  }, 500);
1498
3407
  return () => window.clearInterval(e);
1499
- }, [a]), F(() => {
3408
+ }, [i]), O(() => {
1500
3409
  p.current = !1;
1501
- }, [Oe()]), ke("wheel", () => {
3410
+ }, [re()]), ie("wheel", () => {
1502
3411
  p.current = !0;
1503
3412
  }, {
1504
3413
  target: y,
1505
3414
  passive: !0,
1506
- enable: a
1507
- }), ke("pointerdown", (e) => {
3415
+ enable: i
3416
+ }), ie("pointerdown", (e) => {
1508
3417
  let t = e.target;
1509
3418
  t instanceof Element && t.closest(".os-scrollbar") && (p.current = !0);
1510
3419
  }, {
1511
3420
  target: y,
1512
3421
  passive: !0,
1513
- enable: a
1514
- }), ke("scroll", () => _(v()), {
3422
+ enable: i
3423
+ }), ie("scroll", () => _(v()), {
1515
3424
  target: v,
1516
3425
  passive: !0,
1517
- enable: a
1518
- }), F(() => {
1519
- if (!a || f.current || !r?.current) return;
3426
+ enable: i
3427
+ }), O(() => {
3428
+ if (!i || f.current || !n?.current) return;
1520
3429
  let e = window.requestAnimationFrame(() => {
1521
3430
  if (f.current) return;
1522
- let e = r?.current;
3431
+ let e = n?.current;
1523
3432
  e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
1524
3433
  });
1525
3434
  return () => window.cancelAnimationFrame(e);
1526
3435
  }, [
1527
3436
  m,
1528
- r,
1529
- a
3437
+ n,
3438
+ i
1530
3439
  ]), {
1531
3440
  visible: g,
1532
- thinking: a,
3441
+ thinking: i,
1533
3442
  open: h,
1534
- label: a ? i("editor.aiThinking") : i("editor.aiThoughtSeconds", { seconds: c }),
3443
+ label: i ? r("editor.aiThinking") : r("editor.aiThoughtSeconds", { seconds: c }),
1535
3444
  reasoning: m,
1536
3445
  toggle: () => s((e) => !e),
1537
- onViewportScroll: () => _(r?.current)
3446
+ onViewportScroll: () => _(n?.current)
1538
3447
  };
1539
3448
  }
1540
- var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
3449
+ var Lo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
1541
3450
  type: "button",
1542
- className: j["bsy-lexical-ai__think-head"],
3451
+ className: Q["bsy-lexical-ai__think-head"],
1543
3452
  disabled: t.thinking,
1544
3453
  onClick: t.toggle,
1545
- children: [t.thinking ? /* @__PURE__ */ M(Vr, {}) : /* @__PURE__ */ M(e, {
3454
+ children: [t.thinking ? /* @__PURE__ */ y(Fo, {}) : /* @__PURE__ */ y(e, {
1546
3455
  name: "arrow-down",
1547
3456
  size: 12,
1548
- className: z(j["bsy-lexical-ai__think-arrow"], t.open && j["bsy-lexical-ai__think-arrow--open"])
1549
- }), /* @__PURE__ */ M("span", {
1550
- className: j["bsy-lexical-ai__think-label"],
1551
- 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, {
1552
3461
  mode: "popLayout",
1553
3462
  initial: !1,
1554
- children: /* @__PURE__ */ M(je.span, {
3463
+ children: /* @__PURE__ */ y(oe.span, {
1555
3464
  initial: {
1556
3465
  opacity: 0,
1557
3466
  y: 6
@@ -1566,30 +3475,30 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1566
3475
  },
1567
3476
  transition: {
1568
3477
  duration: .22,
1569
- ease: Br
3478
+ ease: Po
1570
3479
  },
1571
- children: /* @__PURE__ */ M("span", {
1572
- 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,
1573
3482
  children: t.label
1574
3483
  })
1575
3484
  }, t.label)
1576
3485
  })
1577
3486
  })]
1578
- }) : null, Wr = ({ model: e }) => {
1579
- let [t, n] = R(!0), r = Ce(e.reasoning);
1580
- if (F(() => {
3487
+ }) : null, Ro = ({ model: e }) => {
3488
+ let [t, n] = P(!0), r = D(e.reasoning);
3489
+ if (O(() => {
1581
3490
  e.open || n(!0);
1582
3491
  }, [e.open]), !e.visible) return null;
1583
- let i = /* @__PURE__ */ M("div", {
1584
- className: j["bsy-lexical-ai__think-body"],
3492
+ let i = /* @__PURE__ */ y("div", {
3493
+ className: Q["bsy-lexical-ai__think-body"],
1585
3494
  children: r
1586
3495
  });
1587
- return !t && e.open && e.reasoning ? /* @__PURE__ */ M("div", {
1588
- 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"]),
1589
3498
  children: i
1590
- }) : /* @__PURE__ */ M(Ae, {
3499
+ }) : /* @__PURE__ */ y(ae, {
1591
3500
  initial: !1,
1592
- children: e.open && e.reasoning ? /* @__PURE__ */ M(je.div, {
3501
+ children: e.open && e.reasoning ? /* @__PURE__ */ y(oe.div, {
1593
3502
  initial: {
1594
3503
  height: 0,
1595
3504
  opacity: 0
@@ -1613,64 +3522,80 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1613
3522
  onAnimationComplete: () => {
1614
3523
  e.open && n(!1);
1615
3524
  },
1616
- className: j["bsy-lexical-ai__think-collapse"],
3525
+ className: Q["bsy-lexical-ai__think-collapse"],
1617
3526
  children: i
1618
3527
  }, "think-body") : null
1619
3528
  });
1620
- }, Gr = ({ html: e }) => {
1621
- let [t, n] = R(() => e && !D(e) ? T(e) : "");
1622
- return F(() => {
1623
- !e || D(e) || n(T(e));
1624
- }, [e]), t ? /* @__PURE__ */ M("div", {
1625
- className: z("bsy-lexical-editor", j["bsy-lexical-ai__html"]),
1626
- dangerouslySetInnerHTML: { __html: t }
1627
- }) : null;
1628
- }, 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 = {
1629
3554
  paddingAbsolute: !0,
1630
3555
  overflow: {
1631
3556
  x: "hidden",
1632
3557
  y: "scroll"
1633
3558
  }
1634
- }, qr = ({ status: r, reasoning: o, errorMessage: s, originalHtml: c, proposedHtml: l, preset: u, onPresetChange: d, onCancel: f, onApply: p }) => {
1635
- let { t: m } = n(), [h, g] = R(!0), _ = L(null), v = !!l.trim(), y = r === "ready" && v, b = Hr({
1636
- status: r,
1637
- reasoning: o
1638
- }, 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) => ({
1639
3564
  key: e,
1640
- label: m(x[e])
3565
+ label: m(Jr[e])
1641
3566
  }));
1642
- return /* @__PURE__ */ M(t, {
3567
+ return /* @__PURE__ */ y(r, {
1643
3568
  title: m("editor.aiPolish"),
1644
3569
  open: h,
1645
3570
  width: "800px",
1646
3571
  fullSwitch: !0,
1647
- afterClose: f,
3572
+ afterClose: d,
1648
3573
  onOpenChange: g,
1649
- children: /* @__PURE__ */ N("div", {
1650
- className: j["bsy-lexical-ai__dialog"],
1651
- children: [/* @__PURE__ */ N("div", {
1652
- className: j["bsy-lexical-ai__pane"],
1653
- children: [/* @__PURE__ */ N("div", {
1654
- className: j["bsy-lexical-ai__column"],
1655
- children: [/* @__PURE__ */ N("div", {
1656
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
1657
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOriginal")]
1658
- }), /* @__PURE__ */ M(i, {
1659
- className: j["bsy-lexical-ai__column-body"],
1660
- options: Kr,
1661
- 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 })
1662
3587
  })]
1663
- }), /* @__PURE__ */ N("div", {
1664
- className: j["bsy-lexical-ai__column"],
1665
- children: [/* @__PURE__ */ N("div", {
1666
- className: j["bsy-lexical-ai__column-head"],
1667
- children: [/* @__PURE__ */ N("div", {
1668
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
1669
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), m("editor.aiOptimized")]
1670
- }), /* @__PURE__ */ M(a, {
1671
- 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,
1672
3597
  showSearch: !1,
1673
- activeKey: [u],
3598
+ activeKey: [c],
1674
3599
  offset: {
1675
3600
  x: 0,
1676
3601
  y: 4
@@ -1679,119 +3604,119 @@ var Ur = ({ model: t }) => t.visible ? /* @__PURE__ */ N("button", {
1679
3604
  width: 90,
1680
3605
  minWidth: 90
1681
3606
  },
1682
- onClick: (e) => d(e.key),
1683
- children: /* @__PURE__ */ N("button", {
3607
+ onClick: (e) => l(e.key),
3608
+ children: /* @__PURE__ */ b("button", {
1684
3609
  type: "button",
1685
- className: j["bsy-lexical-ai__preset"],
3610
+ className: Q["bsy-lexical-ai__preset"],
1686
3611
  title: m("editor.aiPolish"),
1687
- children: [m(x[u]), /* @__PURE__ */ M(e, {
3612
+ children: [m(Jr[c]), /* @__PURE__ */ y(e, {
1688
3613
  name: "arrow-down",
1689
3614
  size: 16
1690
3615
  })]
1691
3616
  })
1692
3617
  })]
1693
- }), /* @__PURE__ */ N("div", {
1694
- className: j["bsy-lexical-ai__column-stack"],
1695
- children: [b.visible ? /* @__PURE__ */ M("div", {
1696
- className: j["bsy-lexical-ai__think-pin"],
1697
- children: /* @__PURE__ */ M(Ur, { model: b })
1698
- }) : null, /* @__PURE__ */ N(i, {
1699
- className: j["bsy-lexical-ai__column-body"],
1700
- 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,
1701
3626
  viewportRef: _,
1702
- onScroll: b.onViewportScroll,
1703
- children: [r === "error" ? /* @__PURE__ */ M("div", {
1704
- className: j["bsy-lexical-ai__error"],
1705
- children: s || m("editor.aiError")
1706
- }) : /* @__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]
1707
3632
  })]
1708
3633
  })]
1709
3634
  })]
1710
- }), /* @__PURE__ */ N("div", {
1711
- className: j["bsy-lexical-ai__footer"],
1712
- children: [/* @__PURE__ */ M(Ee, {
3635
+ }), /* @__PURE__ */ b("div", {
3636
+ className: Q["bsy-lexical-ai__footer"],
3637
+ children: [/* @__PURE__ */ y(F, {
1713
3638
  onClick: () => g(!1),
1714
3639
  children: m("editor.aiAbandon")
1715
- }), /* @__PURE__ */ M(Ee, {
3640
+ }), /* @__PURE__ */ y(F, {
1716
3641
  type: "primary",
1717
- disabled: !y,
3642
+ disabled: !x,
1718
3643
  onClick: () => p() && g(!1),
1719
3644
  children: m("editor.aiApply")
1720
3645
  })]
1721
3646
  })]
1722
3647
  })
1723
3648
  });
1724
- }, Jr = {
3649
+ }, Wo = {
1725
3650
  paddingAbsolute: !0,
1726
3651
  overflow: {
1727
3652
  x: "hidden",
1728
3653
  y: "scroll"
1729
3654
  }
1730
- }, Yr = ({ status: e, reasoning: r, errorMessage: a, originalHtml: o, proposedHtml: s, onCancel: c, onApply: l }) => {
1731
- 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({
1732
3657
  status: e,
1733
- reasoning: r
3658
+ reasoning: t
1734
3659
  }, m, p);
1735
- return /* @__PURE__ */ M(t, {
1736
- title: u("editor.aiPreview"),
3660
+ return /* @__PURE__ */ y(r, {
3661
+ title: l("editor.aiPreview"),
1737
3662
  open: d,
1738
3663
  width: "800px",
1739
3664
  fullSwitch: !0,
1740
- afterClose: c,
3665
+ afterClose: s,
1741
3666
  onOpenChange: f,
1742
- children: /* @__PURE__ */ N("div", {
1743
- className: j["bsy-lexical-ai__dialog"],
1744
- children: [/* @__PURE__ */ N("div", {
1745
- className: j["bsy-lexical-ai__pane"],
1746
- children: [/* @__PURE__ */ N("div", {
1747
- className: j["bsy-lexical-ai__column"],
1748
- children: [/* @__PURE__ */ N("div", {
1749
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--before"]),
1750
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOriginal")]
1751
- }), /* @__PURE__ */ M(i, {
1752
- className: j["bsy-lexical-ai__column-body"],
1753
- options: Jr,
1754
- 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 })
1755
3680
  })]
1756
- }), /* @__PURE__ */ N("div", {
1757
- className: j["bsy-lexical-ai__column"],
1758
- children: [/* @__PURE__ */ N("div", {
1759
- className: z(j["bsy-lexical-ai__column-title"], j["bsy-lexical-ai__column-title--after"]),
1760
- children: [/* @__PURE__ */ M("span", { className: j["bsy-lexical-ai__column-dot"] }), u("editor.aiOptimized")]
1761
- }), /* @__PURE__ */ N("div", {
1762
- className: j["bsy-lexical-ai__column-stack"],
1763
- children: [g.visible ? /* @__PURE__ */ M("div", {
1764
- className: j["bsy-lexical-ai__think-pin"],
1765
- children: /* @__PURE__ */ M(Ur, { model: g })
1766
- }) : null, /* @__PURE__ */ N(i, {
1767
- className: j["bsy-lexical-ai__column-body"],
1768
- 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,
1769
3694
  viewportRef: p,
1770
3695
  onScroll: g.onViewportScroll,
1771
- children: [e === "error" ? /* @__PURE__ */ M("div", {
1772
- className: j["bsy-lexical-ai__error"],
1773
- children: a || u("editor.aiError")
1774
- }) : /* @__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]
1775
3700
  })]
1776
3701
  })]
1777
3702
  })]
1778
- }), /* @__PURE__ */ N("div", {
1779
- className: j["bsy-lexical-ai__footer"],
1780
- children: [/* @__PURE__ */ M(Ee, {
3703
+ }), /* @__PURE__ */ b("div", {
3704
+ className: Q["bsy-lexical-ai__footer"],
3705
+ children: [/* @__PURE__ */ y(F, {
1781
3706
  onClick: () => f(!1),
1782
- children: u("editor.aiAbandon")
1783
- }), /* @__PURE__ */ M(Ee, {
3707
+ children: l("editor.aiAbandon")
3708
+ }), /* @__PURE__ */ y(F, {
1784
3709
  type: "primary",
1785
3710
  disabled: !h,
1786
- onClick: () => l() && f(!1),
1787
- children: u("editor.aiApply")
3711
+ onClick: () => c() && f(!1),
3712
+ children: l("editor.aiApply")
1788
3713
  })]
1789
3714
  })]
1790
3715
  })
1791
3716
  });
1792
- }, $ = (e) => !e || D(e) ? e : te(T(e));
1793
- function Xr(e, t, n, r) {
1794
- 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({
1795
3720
  originalHtml: t,
1796
3721
  text: n
1797
3722
  });
@@ -1799,8 +3724,8 @@ function Xr(e, t, n, r) {
1799
3724
  originalHtml: t,
1800
3725
  text: n
1801
3726
  };
1802
- let s = L(null);
1803
- return Te(() => {
3727
+ let s = N(null);
3728
+ return j(() => {
1804
3729
  let t = () => {
1805
3730
  s.current !== null && (cancelAnimationFrame(s.current), s.current = null);
1806
3731
  };
@@ -1811,7 +3736,7 @@ function Xr(e, t, n, r) {
1811
3736
  let n = () => {
1812
3737
  s.current = null;
1813
3738
  let e = o.current;
1814
- a($(w(e.originalHtml, e.text)));
3739
+ a(Ko(qi(e.originalHtml, e.text)));
1815
3740
  };
1816
3741
  if (r === "ready" || r === "error") {
1817
3742
  t(), n();
@@ -1823,112 +3748,112 @@ function Xr(e, t, n, r) {
1823
3748
  t,
1824
3749
  r,
1825
3750
  n
1826
- ]), F(() => () => {
3751
+ ]), O(() => () => {
1827
3752
  s.current !== null && cancelAnimationFrame(s.current);
1828
3753
  }, []), i;
1829
3754
  }
1830
- var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1831
- 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);
1832
- F(() => {
1833
- if (i) return r.setEditable(!1), r.update(() => {
1834
- nt(null);
1835
- }), window.getSelection()?.removeAllRanges(), r.getRootElement()?.blur(), () => {
1836
- 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);
1837
3762
  };
1838
- }, [i, r]);
1839
- let w = P(() => {
1840
- s?.(), o.current = null, a(null);
3763
+ }, [r, n]);
3764
+ let D = T(() => {
3765
+ s?.(), o.current = null, i(null);
1841
3766
  }, [
1842
3767
  o,
1843
- a,
3768
+ i,
1844
3769
  s
1845
- ]), ee = P(() => {
1846
- if (i !== "typeset" || v !== "ready") return !1;
1847
- r.setEditable(!0);
1848
- let { applied: n, truncated: a } = zr(r, y, o.current?.codeBlocks ?? [], e);
1849
- 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);
1850
3775
  }, [
1851
- i,
1852
- o,
1853
3776
  r,
3777
+ o,
3778
+ n,
1854
3779
  e,
1855
- d,
1856
- t,
1857
- v,
1858
3780
  u,
1859
- y
1860
- ]), T = P(() => i !== "polish" || v !== "ready" ? !1 : oe(r, y) ? !0 : (d.warning(u("editor.aiApplyEmpty")), !1), [
1861
- 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), [
1862
3786
  r,
1863
- d,
1864
- v,
3787
+ n,
1865
3788
  u,
1866
- y
1867
- ]), E = P((e) => {
3789
+ _,
3790
+ l,
3791
+ x
3792
+ ]), j = T((e) => {
1868
3793
  let t = o.current;
1869
- !t?.originalText || !l || (t.preset = e, s?.(), l({
3794
+ !t?.originalText || !c || (t.preset = e, s?.(), c({
1870
3795
  text: t.originalText,
1871
3796
  preset: e
1872
3797
  }));
1873
3798
  }, [
1874
3799
  o,
1875
- l,
3800
+ c,
1876
3801
  s
1877
3802
  ]);
1878
- return i ? /* @__PURE__ */ N(ye, { children: [f, i === "typeset" ? /* @__PURE__ */ M(Yr, {
1879
- status: v,
1880
- reasoning: h,
1881
- errorMessage: _,
1882
- originalHtml: x,
1883
- proposedHtml: b,
1884
- onCancel: w,
1885
- onApply: ee
1886
- }) : /* @__PURE__ */ M(qr, {
1887
- status: v,
1888
- reasoning: h,
1889
- errorMessage: _,
1890
- originalHtml: S,
1891
- proposedHtml: C,
1892
- preset: p?.preset ?? "quick",
1893
- onPresetChange: E,
1894
- onCancel: w,
1895
- onApply: T
1896
- })] }) : f;
1897
- }, Qr = [], $r = (e) => {
1898
- 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);
1899
3824
  v.current = s;
1900
- 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);
1901
- D.current = l;
1902
- let O = L(r);
1903
- O.current = r;
1904
- let k = P((e) => {
1905
- D.current?.typeset?.(e);
1906
- }, []), A = P((e) => {
1907
- D.current?.polish?.(e);
1908
- }, []), re = P(() => {
1909
- D.current?.stop?.();
1910
- }, []), 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(() => ({
1911
3836
  containerRef: p,
1912
3837
  toolbarRef: m,
1913
3838
  upload: c,
1914
- aiOpen: C,
1915
- setAiOpen: w,
3839
+ aiOpen: w,
3840
+ setAiOpen: E,
1916
3841
  aiSessionRef: g,
1917
3842
  attachmentsBySrcRef: h,
1918
- typeset: k,
1919
- polish: A,
1920
- stop: re,
1921
- canTypeset: j,
1922
- canPolish: ae
3843
+ typeset: F,
3844
+ polish: ee,
3845
+ stop: te,
3846
+ canTypeset: ne,
3847
+ canPolish: I
1923
3848
  }), [
1924
- C,
1925
- ae,
1926
- j,
1927
- A,
1928
- re,
1929
- k,
3849
+ w,
3850
+ I,
3851
+ ne,
3852
+ ee,
3853
+ te,
3854
+ F,
1930
3855
  c
1931
- ]), se = I(() => ({
3856
+ ]), ie = M(() => ({
1932
3857
  text: l?.text ?? "",
1933
3858
  reasoning: l?.reasoning,
1934
3859
  status: l?.status,
@@ -1938,12 +3863,12 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1938
3863
  l?.reasoning,
1939
3864
  l?.status,
1940
3865
  l?.errorMessage
1941
- ]), ce = P((e) => {
3866
+ ]), ae = T((e) => {
1942
3867
  f.current || e.read(() => {
1943
- let t = V().getTextContent(), n = te(T(ze(u, null))), r = ie(n, t) ? null : n;
1944
- _.current = r, b !== void 0 && S(t.length);
1945
- let i = et(rn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
1946
- 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({
1947
3872
  text: t,
1948
3873
  html: r,
1949
3874
  attachments: i
@@ -1951,47 +3876,47 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
1951
3876
  }, { editor: u });
1952
3877
  }, [
1953
3878
  u,
1954
- b,
3879
+ x,
1955
3880
  f
1956
3881
  ]);
1957
- F(() => {
1958
- b === void 0 || d || u.getEditorState().read(() => {
1959
- S(V().getTextContentSize());
3882
+ O(() => {
3883
+ x === void 0 || d || u.getEditorState().read(() => {
3884
+ C(L().getTextContentSize());
1960
3885
  }, { editor: u });
1961
3886
  }, [
1962
3887
  u,
1963
- b,
3888
+ x,
1964
3889
  d
1965
- ]), F(() => {
3890
+ ]), O(() => {
1966
3891
  if (e.value === void 0 || e.value === _.current) return;
1967
3892
  if (f.current) {
1968
- let t = e.value?.trim() ? T(e.value) : "";
3893
+ let t = e.value?.trim() ? X(e.value) : "";
1969
3894
  _.current = e.value, u.update(() => {
1970
- mr(pr(t));
3895
+ so(oo(t));
1971
3896
  });
1972
3897
  return;
1973
3898
  }
1974
- let t = !1;
3899
+ let t = !1, n = _.current === null;
1975
3900
  u.update(() => {
1976
- ne(u, e.value?.trim() ? T(e.value) : ""), b !== void 0 && (t = nr(u, b));
1977
- }), 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?.();
1978
3903
  }, [
1979
3904
  e.value,
1980
3905
  u,
1981
- b,
3906
+ x,
1982
3907
  f
1983
3908
  ]);
1984
- let le = i?.config?.length ? i.config : Qr, fe = P(() => {
3909
+ let oe = i?.config?.length ? i.config : Yo, se = T(() => {
1985
3910
  v.current?.();
1986
3911
  }, []);
1987
- return /* @__PURE__ */ M(y.Provider, {
1988
- value: oe,
1989
- children: /* @__PURE__ */ N(ue.Provider, {
1990
- value: se,
1991
- 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, {
1992
3917
  containerRef: p,
1993
- isFloating: ee,
1994
- toolbarConfig: le,
3918
+ isFloating: D,
3919
+ toolbarConfig: oe,
1995
3920
  toolbarTheme: a?.toolbar,
1996
3921
  containerTheme: a?.container,
1997
3922
  toolbarStyle: i?.style,
@@ -2001,98 +3926,118 @@ var Zr = ({ maxLength: e, onMaxLengthExceed: t }) => {
2001
3926
  toolbarStickyOffset: i?.stickyOffset,
2002
3927
  height: t,
2003
3928
  minHeight: n,
2004
- showLengthBadge: E,
2005
- textLength: x,
2006
- validMaxLength: b,
2007
- onMaxLengthExceed: fe,
2008
- onChange: ce
2009
- }), /* @__PURE__ */ M(Zr, {
2010
- maxLength: b,
2011
- 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
2012
3937
  })]
2013
3938
  })
2014
3939
  });
2015
- }, 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 }) {
2016
- let [_] = W(), v = $t(), y = typeof u == "number" ? u : void 0, b = !t && y === void 0 && l !== void 0, x = L(!1);
2017
- F(() => {
2018
- 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());
2019
3944
  }, [v, _]);
2020
- let S = I(() => wn(i), [i]);
2021
- return /* @__PURE__ */ N("div", {
3945
+ let w = M(() => ha(i), [i]);
3946
+ return /* @__PURE__ */ b("div", {
2022
3947
  ref: e,
2023
- className: z("bsy-lexical-editor", X["bsy-lexical-editor"], t && X["bsy-lexical-editor--floating"], b && X["bsy-lexical-editor--sticky-toolbar"]),
2024
- 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,
2025
3950
  onClick: (e) => {
2026
3951
  let t = _.getRootElement(), n = e.target;
2027
- !t || !n || !t.contains(n) || _.isEditable() || (x.current = !0, _.setEditable(!0));
3952
+ !t || !n || !t.contains(n) || _.isEditable() || (C.current = !0, _.setEditable(!0));
2028
3953
  },
2029
3954
  children: [
2030
- n && n.length > 0 ? /* @__PURE__ */ M(Sn, {
3955
+ n && n.length > 0 ? /* @__PURE__ */ y(pa, {
2031
3956
  config: n,
2032
3957
  theme: r,
2033
3958
  style: a,
2034
3959
  size: o,
2035
3960
  mode: s,
2036
3961
  floating: c,
2037
- stickyOffset: b ? l : void 0
3962
+ stickyOffset: S ? l : void 0
2038
3963
  }) : null,
2039
- /* @__PURE__ */ N("div", {
2040
- className: z(X["bsy-lexical-editor__body"], y !== void 0 && X["bsy-lexical-editor__body--fixed"]),
2041
- style: { height: y },
2042
- children: [/* @__PURE__ */ M("div", {
2043
- className: X["bsy-lexical-editor__editable-wrap"],
2044
- children: /* @__PURE__ */ M(Pe, {
2045
- contentEditable: /* @__PURE__ */ M(Fe, {
2046
- 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"],
2047
3972
  style: {
2048
- minHeight: y === void 0 ? d : void 0,
3973
+ minHeight: x === void 0 ? d : void 0,
2049
3974
  cursor: v ? "auto" : "text"
2050
3975
  }
2051
3976
  }),
2052
- ErrorBoundary: Re
3977
+ ErrorBoundary: me
2053
3978
  })
2054
- }), f && m !== void 0 ? /* @__PURE__ */ M(vr, {
3979
+ }), f && m !== void 0 ? /* @__PURE__ */ y(fo, {
2055
3980
  current: p,
2056
3981
  maxLength: m
2057
3982
  }) : null]
2058
3983
  }),
2059
- /* @__PURE__ */ M(en, {}),
2060
- /* @__PURE__ */ M(tn, {}),
2061
- /* @__PURE__ */ M(On, {}),
2062
- /* @__PURE__ */ M(_r, {}),
2063
- /* @__PURE__ */ M(kn, {}),
2064
- /* @__PURE__ */ M(Mn, {}),
2065
- /* @__PURE__ */ M(Nn, {}),
2066
- /* @__PURE__ */ M(Xn, {}),
2067
- /* @__PURE__ */ M(Zn, {}),
2068
- /* @__PURE__ */ M($n, {}),
2069
- 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, {
2070
3995
  maxLength: m,
2071
3996
  onMaxLengthExceed: h
2072
3997
  }) : null,
2073
- /* @__PURE__ */ M(Ie, {}),
2074
- /* @__PURE__ */ M(Le, {
3998
+ /* @__PURE__ */ y(fe, {}),
3999
+ /* @__PURE__ */ y(pe, {
2075
4000
  onChange: g,
2076
4001
  ignoreSelectionChange: !0,
2077
4002
  ignoreHistoryMergeTagChange: !1
2078
4003
  })
2079
4004
  ]
2080
4005
  });
2081
- }), ti = (e) => /* @__PURE__ */ M(hr, {
4006
+ }), Qo = (e) => /* @__PURE__ */ y(co, {
2082
4007
  maxLength: e.maxLength,
2083
4008
  onMaxLengthExceed: e.onMaxLengthExceed,
2084
- children: /* @__PURE__ */ M($r, { ...e })
4009
+ children: /* @__PURE__ */ y(Xo, { ...e })
2085
4010
  });
2086
- ti.displayName = "BsyLexicalEditorCore";
4011
+ Qo.displayName = "BsyLexicalEditorCore";
2087
4012
  //#endregion
2088
- //#region src/components/Editor/htmlConfig.ts
2089
- 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) => {
2090
4035
  let n = t.exportDOM(e);
2091
- return vt(n.element) && (n.element.style.border = ni), n;
2092
- }]]) }, ii = (e) => {
4036
+ return at(n.element) && (n.element.style.border = ts), n;
4037
+ }]]) }, rs = (e) => {
2093
4038
  let { autoFocus: t = !1 } = e;
2094
- return /* @__PURE__ */ M(Ne, {
2095
- initialConfig: I(() => ({
4039
+ return /* @__PURE__ */ y(le, {
4040
+ initialConfig: M(() => ({
2096
4041
  namespace: "bsyLexicalEditor",
2097
4042
  onError: (e) => {
2098
4043
  console.error("Lexical error", e);
@@ -2128,30 +4073,39 @@ var ni = "1px solid #d9d9d9", ri = { export: new Map([[Wt, (e, t) => {
2128
4073
  tableRow: "editor-table-row",
2129
4074
  tableScrollableWrapper: "editor-table-scrollable-wrapper"
2130
4075
  },
2131
- html: ri,
4076
+ html: ns,
2132
4077
  nodes: [
2133
- Ot,
2134
- Dt,
2135
- jt,
2136
- At,
2137
- Qt,
2138
- Lt,
2139
- It,
2140
- Gt,
2141
- Kt,
2142
- Wt,
2143
- rn,
2144
- 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,
2145
4099
  {
2146
- replace: _t,
2147
- with: (e) => new Z(e.__text),
2148
- withKlass: Z
4100
+ replace: nt,
4101
+ with: (e) => new ga(e.__text),
4102
+ withKlass: ga
2149
4103
  }
2150
4104
  ]
2151
4105
  }), [t]),
2152
- children: /* @__PURE__ */ M(ti, { ...e })
4106
+ children: /* @__PURE__ */ y(Qo, { ...e })
2153
4107
  });
2154
4108
  };
2155
- ii.displayName = "BsyLexicalEditor";
4109
+ rs.displayName = "BsyLexicalEditor";
2156
4110
  //#endregion
2157
- 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 };