@zero-library/common 2.4.4 → 3.0.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.
package/dist/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined, MessageOutlined, BookOutlined, EditOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons';
3
- import { Spin, Input, Typography, Tooltip as Tooltip$1, Button, message, Flex, Alert, Skeleton, Result, Splitter, Empty, Image, Drawer, Avatar, notification, Modal, Form, Card, List, Space, Popconfirm } from 'antd';
2
+ import { MessageOutlined, BookOutlined, EditOutlined, DeleteOutlined, CloseOutlined, MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined } from '@ant-design/icons';
3
+ import { Spin, Input, Typography, Tooltip as Tooltip$1, Button, Flex, Form, Card, List, Space, Popconfirm, Empty, Modal, message, Alert, Skeleton, Result, Splitter, Image as Image$1, Drawer, Avatar, notification } from 'antd';
4
4
  import classNames2 from 'classnames';
5
5
  import { renderAsync } from 'docx-preview';
6
6
  import * as React from 'react';
7
- import React__default, { forwardRef, useState, useMemo, useEffect, useRef, useCallback, createContext, isValidElement, version, cloneElement, memo, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
7
+ import React__default, { forwardRef, useState, useMemo, useEffect, useRef, useCallback, createContext, isValidElement, version, cloneElement, memo, useImperativeHandle, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
8
8
  import AES from 'crypto-js/aes';
9
9
  import encUtf8 from 'crypto-js/enc-utf8';
10
10
  import { convert } from 'html-to-text';
@@ -32,20 +32,22 @@ import zh_CN from '@react-pdf-viewer/locales/lib/zh_CN.json';
32
32
  import '@react-pdf-viewer/page-navigation/lib/styles/index.css';
33
33
  import '@react-pdf-viewer/thumbnail/lib/styles/index.css';
34
34
  import '@react-pdf-viewer/zoom/lib/styles/index.css';
35
- import { mergeAttributes, isNodeSelection, posToDOMRect, useCurrentEditor, useEditorState, isTextSelection, useEditor, EditorContext, EditorContent } from '@tiptap/react';
35
+ import microApp from '@micro-zoe/micro-app';
36
+ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event';
37
+ import { mergeAttributes, useEditor, EditorContext, EditorContent, isNodeSelection, posToDOMRect, useCurrentEditor, useEditorState, isTextSelection } from '@tiptap/react';
36
38
  import { Highlight } from '@tiptap/extension-highlight';
37
- import { Image as Image$1 } from '@tiptap/extension-image';
39
+ import { Image } from '@tiptap/extension-image';
38
40
  import { TaskList, TaskItem } from '@tiptap/extension-list';
39
41
  import { Subscript } from '@tiptap/extension-subscript';
40
42
  import { Superscript } from '@tiptap/extension-superscript';
41
43
  import { TextAlign } from '@tiptap/extension-text-align';
42
44
  import { Typography as Typography$1 } from '@tiptap/extension-typography';
43
- import { Selection as Selection$1 } from '@tiptap/extensions';
45
+ import { Selection } from '@tiptap/extensions';
44
46
  import { StarterKit } from '@tiptap/starter-kit';
45
47
  import { TableHeader, TableRow, TableCell, Table } from '@tiptap/extension-table';
46
48
  import TiptapHorizontalRule from '@tiptap/extension-horizontal-rule';
47
49
  import { Node as Node$1, mergeAttributes as mergeAttributes$1, Extension, Mark } from '@tiptap/core';
48
- import { PluginKey, Plugin, TextSelection, Selection, NodeSelection, AllSelection } from '@tiptap/pm/state';
50
+ import { PluginKey, Plugin, TextSelection, Selection as Selection$1, NodeSelection, AllSelection } from '@tiptap/pm/state';
49
51
  import { shift, flip, offset, useMergeRefs, FloatingPortal, useFloating, autoUpdate, useTransitionStyles, useDismiss, useInteractions, FloatingDelayGroup, useHover, useFocus, useRole } from '@floating-ui/react';
50
52
  import { CellSelection } from '@tiptap/pm/tables';
51
53
  import { createPortal } from 'react-dom';
@@ -1075,6 +1077,10 @@ function createRequest(config) {
1075
1077
  // 默认基础URL
1076
1078
  timeout: 6e4,
1077
1079
  // 请求超时时间设为60秒
1080
+ paramsSerializer: {
1081
+ // 自定义序列化参数,处理数组格式为 key=value&key=value
1082
+ serialize: (params) => buildUrlParams(params)
1083
+ },
1078
1084
  ...config
1079
1085
  // 合并传入的配置项
1080
1086
  });
@@ -1103,6 +1109,9 @@ function createRequest(config) {
1103
1109
  return response;
1104
1110
  },
1105
1111
  function(err) {
1112
+ if (axios.isCancel(err)) {
1113
+ return Promise.reject(err);
1114
+ }
1106
1115
  if (!err.response) {
1107
1116
  if (showError(err?.config?.showError)) cachedMessage({ content: "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC", type: "error" });
1108
1117
  } else {
@@ -1351,7 +1360,7 @@ var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }
1351
1360
  lazyCache.set(type, component);
1352
1361
  return component;
1353
1362
  }, [loader]);
1354
- if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { message: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1363
+ if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsx(Alert, { title: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1355
1364
  return /* @__PURE__ */ jsx(
1356
1365
  Suspense,
1357
1366
  {
@@ -1528,9 +1537,9 @@ ${fence}`;
1528
1537
  function emit(type, data, to = "top") {
1529
1538
  const payload = { type, data, to };
1530
1539
  try {
1531
- window.parent.postMessage(payload, "*");
1540
+ window.postMessage(payload, "*");
1532
1541
  } catch (err) {
1533
- console.warn("emit parent failed", err);
1542
+ console.warn("emit failed", err);
1534
1543
  }
1535
1544
  }
1536
1545
  function emitToChild(iframeWindow, type, data, origin = "*") {
@@ -1545,33 +1554,91 @@ function emitToChild(iframeWindow, type, data, origin = "*") {
1545
1554
  console.warn("emit to child failed", err);
1546
1555
  }
1547
1556
  }
1548
- var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
1549
- const handlers = useRef({});
1550
- useEffect(() => {
1551
- const onMessage = (evt) => {
1552
- const { data, source, origin } = evt;
1553
- if (!data || !isObject(data) || !data.type) return;
1554
- if (allowedOrigins[0] !== "*" && !allowedOrigins.includes(origin)) return;
1555
- const { type, data: params, to = "parent" } = data;
1556
- const isTop = window.parent === window;
1557
- if (to === "top" && !isTop) {
1558
- window.parent.postMessage(data, allowedOrigins[0] === "*" ? "*" : origin);
1559
- return;
1557
+ var hookInstances = /* @__PURE__ */ new Set();
1558
+ var handleGlobalMessage = (evt) => {
1559
+ const { data, source, origin } = evt;
1560
+ if (!data || !isObject(data) || !data.type) return;
1561
+ const { type, data: params, to = "top" } = data;
1562
+ const safeOrigin = origin || "*";
1563
+ const fns = [];
1564
+ let isAllowed = hookInstances.size === 0;
1565
+ hookInstances.forEach((ctx) => {
1566
+ const isMatch = ctx.allowedOrigins[0] === "*" || ctx.allowedOrigins.includes(safeOrigin);
1567
+ if (isMatch) {
1568
+ isAllowed = true;
1569
+ if (ctx.handlers[type]) {
1570
+ fns.push(...ctx.handlers[type]);
1560
1571
  }
1561
- const fns = handlers.current[type] || [];
1562
- fns.forEach((fn) => fn(params, source, origin));
1563
- };
1564
- window.addEventListener("message", onMessage);
1565
- return () => window.removeEventListener("message", onMessage);
1566
- }, [allowedOrigins]);
1567
- function on(type, handler) {
1568
- handlers.current[type] = handlers.current[type] || [];
1569
- handlers.current[type].push(handler);
1572
+ }
1573
+ });
1574
+ if (!isAllowed) return;
1575
+ const isTop = window.parent === window;
1576
+ const hasHandler = fns.length > 0;
1577
+ let shouldExecute = false;
1578
+ let shouldForward = false;
1579
+ switch (to) {
1580
+ case "nearest":
1581
+ shouldExecute = hasHandler;
1582
+ shouldForward = !hasHandler && !isTop;
1583
+ break;
1584
+ case "broadcast":
1585
+ shouldExecute = true;
1586
+ shouldForward = !isTop;
1587
+ break;
1588
+ case "top":
1589
+ shouldExecute = isTop;
1590
+ shouldForward = !isTop;
1591
+ break;
1592
+ case "parent":
1593
+ shouldExecute = true;
1594
+ shouldForward = source === window && !isTop;
1595
+ break;
1596
+ case "sibling":
1597
+ case "child":
1598
+ default:
1599
+ shouldExecute = true;
1600
+ shouldForward = false;
1601
+ break;
1570
1602
  }
1571
- function off(type, handler) {
1572
- handlers.current[type] = (handlers.current[type] || []).filter((fn) => fn !== handler);
1603
+ if (shouldExecute && hasHandler) {
1604
+ fns.forEach((fn) => fn(params, source, origin));
1605
+ }
1606
+ if (shouldForward && !isTop && window.parent !== window) {
1607
+ try {
1608
+ window.parent.postMessage(data, "*");
1609
+ } catch (err) {
1610
+ console.warn("IframeRelayBridge forward failed:", err);
1611
+ }
1573
1612
  }
1574
- return { on, off };
1613
+ };
1614
+ if (window) {
1615
+ window.addEventListener("message", handleGlobalMessage);
1616
+ }
1617
+ var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
1618
+ const ctxRef = useRef({
1619
+ handlers: {},
1620
+ allowedOrigins
1621
+ });
1622
+ ctxRef.current.allowedOrigins = allowedOrigins;
1623
+ useEffect(() => {
1624
+ const ctx = ctxRef.current;
1625
+ hookInstances.add(ctx);
1626
+ return () => {
1627
+ hookInstances.delete(ctx);
1628
+ };
1629
+ }, []);
1630
+ const on = useCallback((type, handler) => {
1631
+ const handlers = ctxRef.current.handlers;
1632
+ handlers[type] = handlers[type] || [];
1633
+ handlers[type].push(handler);
1634
+ }, []);
1635
+ const off = useCallback((type, handler) => {
1636
+ const handlers = ctxRef.current.handlers;
1637
+ if (handlers[type]) {
1638
+ handlers[type] = handlers[type].filter((fn) => fn !== handler);
1639
+ }
1640
+ }, []);
1641
+ return useMemo(() => ({ on, off }), [on, off]);
1575
1642
  };
1576
1643
  var useRefState_default = (init) => {
1577
1644
  const [state, setState] = useState(init);
@@ -1790,140 +1857,325 @@ var useThrottle_default = (func, wait) => {
1790
1857
  throttle2.cancel = cancel;
1791
1858
  return useCallback(throttle2, []);
1792
1859
  };
1793
- var useWebSocket_default = ({
1794
- url,
1795
- onMessage,
1796
- onClose,
1797
- heartbeatInterval = 3e4,
1798
- heartbeatMessage = "ping",
1799
- clientHeartbeat = true,
1800
- reconnectInterval = 5e3,
1801
- maxReconnectAttempts,
1802
- isReconnect = true
1803
- }) => {
1804
- const socketRef = useRef(null);
1805
- const heartbeatIntervalRef = useRef(null);
1806
- const [socketReadyState, setSocketReadyState] = useState(null);
1807
- const reconnectIntervalRef = useRef(null);
1808
- const reconnectAttempts = useRef(0);
1809
- const documentHide = useRef(document.visibilityState === "hidden");
1810
- const isDestroy = useRef(false);
1811
- const onMessageEctype = useCallback(onMessage, [onMessage]);
1812
- const startHeartbeat = (currentSocket) => {
1813
- if (!clientHeartbeat) {
1814
- return;
1815
- }
1860
+
1861
+ // src/hooks/webSocket/WebSocketManager.ts
1862
+ var WebSocketManager = class _WebSocketManager {
1863
+ /** 存储不同 URL 对应的 WebSocketManager 单例实例 */
1864
+ static instances = /* @__PURE__ */ new Map();
1865
+ /** 当前 WebSocket 的服务器地址 */
1866
+ url;
1867
+ /** WebSocket 原生实例 */
1868
+ socket = null;
1869
+ /** 当前连接状态 */
1870
+ readyState = null;
1871
+ /** 当前连接的所有订阅者(监听器)集合 */
1872
+ listeners = /* @__PURE__ */ new Set();
1873
+ // --- 配置参数 ---
1874
+ heartbeatInterval;
1875
+ heartbeatMessage;
1876
+ clientHeartbeat;
1877
+ reconnectInterval;
1878
+ maxReconnectAttempts;
1879
+ isReconnect;
1880
+ // --- 内部状态与定时器 ---
1881
+ /** 心跳定时器引用 */
1882
+ heartbeatIntervalRef = null;
1883
+ /** 重连定时器引用 */
1884
+ reconnectIntervalRef = null;
1885
+ /** 销毁防抖定时器引用(用于避免 React StrictMode 导致的连接抖动) */
1886
+ destroyTimeoutRef = null;
1887
+ /** 当前已尝试重连的次数 */
1888
+ reconnectAttempts = 0;
1889
+ /** 记录页面是否处于隐藏状态 */
1890
+ documentHide = document.visibilityState === "hidden";
1891
+ /** 标记实例是否已被销毁,防止销毁后继续重连 */
1892
+ isDestroy = false;
1893
+ /**
1894
+ * 私有构造函数,确保只能通过 getInstance 获取实例
1895
+ */
1896
+ constructor(props) {
1897
+ this.url = props.url;
1898
+ this.heartbeatInterval = props.heartbeatInterval ?? 3e4;
1899
+ this.heartbeatMessage = props.heartbeatMessage ?? "ping";
1900
+ this.clientHeartbeat = props.clientHeartbeat ?? true;
1901
+ this.reconnectInterval = props.reconnectInterval ?? 5e3;
1902
+ this.maxReconnectAttempts = props.maxReconnectAttempts;
1903
+ this.isReconnect = props.isReconnect ?? true;
1904
+ window.addEventListener("visibilitychange", this.handleVisibilityChange);
1905
+ this.createAndListenWebSocket();
1906
+ }
1907
+ /**
1908
+ * 获取指定 URL 的 WebSocketManager 单例
1909
+ * @param props WebSocket 配置参数
1910
+ * @returns WebSocketManager 实例
1911
+ */
1912
+ static getInstance(props) {
1913
+ if (!_WebSocketManager.instances.has(props.url)) {
1914
+ _WebSocketManager.instances.set(props.url, new _WebSocketManager(props));
1915
+ }
1916
+ return _WebSocketManager.instances.get(props.url);
1917
+ }
1918
+ /**
1919
+ * 添加监听器(组件挂载时调用)
1920
+ * @param listener 组件级别的监听器
1921
+ */
1922
+ addListener(listener) {
1923
+ this.listeners.add(listener);
1924
+ if (this.destroyTimeoutRef) {
1925
+ clearTimeout(this.destroyTimeoutRef);
1926
+ this.destroyTimeoutRef = null;
1927
+ }
1928
+ listener.onStateChange(this.readyState);
1929
+ }
1930
+ /**
1931
+ * 移除监听器(组件卸载时调用)
1932
+ * @param listener 组件级别的监听器
1933
+ */
1934
+ removeListener(listener) {
1935
+ this.listeners.delete(listener);
1936
+ if (this.listeners.size === 0) {
1937
+ this.destroyTimeoutRef = setTimeout(() => {
1938
+ this.destroy();
1939
+ _WebSocketManager.instances.delete(this.url);
1940
+ }, 200);
1941
+ }
1942
+ }
1943
+ /**
1944
+ * 更新连接状态并广播给所有监听器
1945
+ */
1946
+ setSocketReadyState(state) {
1947
+ this.readyState = state;
1948
+ this.listeners.forEach((l) => l.onStateChange(state));
1949
+ }
1950
+ /**
1951
+ * 启动心跳机制
1952
+ */
1953
+ startHeartbeat = (currentSocket) => {
1954
+ if (!this.clientHeartbeat) return;
1955
+ this.stopHeartbeat();
1816
1956
  const intervalId = setInterval(() => {
1817
1957
  if (currentSocket.readyState === WebSocket.OPEN) {
1818
- currentSocket.send(heartbeatMessage);
1958
+ currentSocket.send(this.heartbeatMessage);
1819
1959
  }
1820
- }, heartbeatInterval);
1821
- heartbeatIntervalRef.current = intervalId;
1960
+ }, this.heartbeatInterval);
1961
+ this.heartbeatIntervalRef = intervalId;
1962
+ };
1963
+ /**
1964
+ * 停止心跳机制
1965
+ */
1966
+ stopHeartbeat = () => {
1967
+ if (this.heartbeatIntervalRef !== null) {
1968
+ clearInterval(this.heartbeatIntervalRef);
1969
+ this.heartbeatIntervalRef = null;
1970
+ }
1822
1971
  };
1823
- const stopHeartbeat = () => {
1824
- if (heartbeatIntervalRef.current) {
1825
- clearInterval(heartbeatIntervalRef.current);
1826
- heartbeatIntervalRef.current = null;
1972
+ /**
1973
+ * 停止重连定时器
1974
+ */
1975
+ stopReconnectTimer = () => {
1976
+ if (this.reconnectIntervalRef !== null) {
1977
+ clearTimeout(this.reconnectIntervalRef);
1978
+ this.reconnectIntervalRef = null;
1827
1979
  }
1828
1980
  };
1829
- const stopReconnectTimer = () => {
1830
- if (reconnectIntervalRef.current) {
1831
- clearTimeout(reconnectIntervalRef.current);
1832
- reconnectIntervalRef.current = null;
1981
+ /**
1982
+ * 重置心跳定时器
1983
+ */
1984
+ resetHeartbeat = (currentSocket = this.socket) => {
1985
+ if (!currentSocket) return;
1986
+ this.startHeartbeat(currentSocket);
1987
+ };
1988
+ /**
1989
+ * 广播消息给所有订阅者
1990
+ */
1991
+ emitMessage = (message3) => {
1992
+ this.listeners.forEach((listener) => listener.onMessage(message3));
1993
+ };
1994
+ /**
1995
+ * 解析消息内容,JSON 解析失败时回退为原始字符串
1996
+ */
1997
+ parseMessage = (data) => {
1998
+ try {
1999
+ return JSON.parse(data);
2000
+ } catch {
2001
+ return data;
1833
2002
  }
1834
2003
  };
1835
- const tryReconnect = () => {
1836
- if (isDestroy.current) return;
1837
- if (isReconnect && !documentHide.current) {
1838
- if ((!isNumber(maxReconnectAttempts) || reconnectAttempts.current < maxReconnectAttempts) && isNullOrUnDef(reconnectIntervalRef.current)) {
1839
- reconnectIntervalRef.current = setTimeout(() => {
1840
- console.log(`\u5C1D\u8BD5\u7B2C ${reconnectAttempts.current + 1} \u6B21\u91CD\u8FDE...`, url);
1841
- reconnectAttempts.current = reconnectAttempts.current + 1;
1842
- createAndListenWebSocket();
1843
- stopReconnectTimer();
1844
- }, reconnectInterval);
2004
+ /**
2005
+ * 尝试重新连接
2006
+ */
2007
+ tryReconnect = () => {
2008
+ if (this.isDestroy || this.listeners.size === 0) return;
2009
+ if (this.isReconnect && !this.documentHide) {
2010
+ if ((!isNumber(this.maxReconnectAttempts) || this.reconnectAttempts < this.maxReconnectAttempts) && this.reconnectIntervalRef === null) {
2011
+ this.reconnectIntervalRef = setTimeout(() => {
2012
+ this.reconnectIntervalRef = null;
2013
+ console.log(`\u5C1D\u8BD5\u7B2C ${this.reconnectAttempts + 1} \u6B21\u91CD\u8FDE...`, this.url);
2014
+ this.reconnectAttempts++;
2015
+ this.createAndListenWebSocket();
2016
+ }, this.reconnectInterval);
1845
2017
  } else {
1846
- if (isNumber(maxReconnectAttempts)) {
2018
+ if (isNumber(this.maxReconnectAttempts) && this.reconnectAttempts >= this.maxReconnectAttempts) {
1847
2019
  console.log("\u8FBE\u5230\u6700\u5927\u91CD\u8FDE\u5C1D\u8BD5\u6B21\u6570\uFF0C\u505C\u6B62\u91CD\u8FDE");
1848
2020
  }
1849
2021
  }
1850
2022
  }
1851
2023
  };
1852
- const handleOpen = (newSocket) => {
2024
+ /**
2025
+ * WebSocket onopen 事件处理
2026
+ */
2027
+ handleOpen = (newSocket) => {
1853
2028
  console.log("WebSocket \u8FDE\u63A5\u5DF2\u6253\u5F00");
1854
- setSocketReadyState(newSocket.readyState);
1855
- startHeartbeat(newSocket);
1856
- reconnectAttempts.current = 0;
2029
+ this.stopReconnectTimer();
2030
+ this.setSocketReadyState(newSocket.readyState);
2031
+ this.resetHeartbeat(newSocket);
2032
+ this.reconnectAttempts = 0;
1857
2033
  };
1858
- const handleMessage = (event) => {
1859
- if (isString(event.data)) {
1860
- try {
1861
- const parsedData = JSON.parse(event.data);
1862
- onMessageEctype?.(parsedData);
1863
- stopHeartbeat();
1864
- startHeartbeat(socketRef.current);
1865
- } catch (error) {
1866
- console.error("\u89E3\u6790\u6D88\u606F\u6570\u636E\u65F6\u51FA\u9519:", error);
1867
- }
1868
- }
2034
+ /**
2035
+ * WebSocket onmessage 事件处理
2036
+ */
2037
+ handleMessage = (event) => {
2038
+ const message3 = this.parseMessage(event.data);
2039
+ this.emitMessage(message3);
2040
+ this.resetHeartbeat();
1869
2041
  };
1870
- const handleClose = (event) => {
2042
+ /**
2043
+ * WebSocket onclose 事件处理
2044
+ */
2045
+ handleClose = (event) => {
1871
2046
  console.log("WebSocket \u8FDE\u63A5\u5DF2\u5173\u95ED", event.code, event.reason);
1872
- setSocketReadyState(event.code);
1873
- stopHeartbeat();
1874
- onClose?.();
1875
- tryReconnect();
2047
+ this.setSocketReadyState(WebSocket.CLOSED);
2048
+ this.stopHeartbeat();
2049
+ this.listeners.forEach((l) => l.onClose?.());
2050
+ this.tryReconnect();
1876
2051
  };
1877
- const handleError = (error) => {
2052
+ /**
2053
+ * WebSocket onerror 事件处理
2054
+ */
2055
+ handleError = (error) => {
1878
2056
  console.error("WebSocket \u53D1\u751F\u9519\u8BEF:", error);
1879
- setSocketReadyState(null);
1880
- stopHeartbeat();
1881
- tryReconnect();
2057
+ this.setSocketReadyState(null);
2058
+ this.stopHeartbeat();
2059
+ this.tryReconnect();
2060
+ };
2061
+ /**
2062
+ * 清理当前的 WebSocket 实例,取消所有事件绑定并关闭连接
2063
+ */
2064
+ cleanupSocket = (notifyClose = false) => {
2065
+ this.stopHeartbeat();
2066
+ if (this.socket) {
2067
+ this.socket.onopen = null;
2068
+ this.socket.onmessage = null;
2069
+ this.socket.onerror = null;
2070
+ if (!notifyClose) {
2071
+ this.socket.onclose = null;
2072
+ }
2073
+ if (this.socket.readyState === WebSocket.OPEN || this.socket.readyState === WebSocket.CONNECTING) {
2074
+ this.socket.close();
2075
+ }
2076
+ }
1882
2077
  };
1883
- const createAndListenWebSocket = () => {
1884
- const newSocket = new WebSocket(url);
1885
- socketRef.current = newSocket;
1886
- setSocketReadyState(newSocket.readyState);
1887
- newSocket.onopen = () => handleOpen(newSocket);
1888
- newSocket.onmessage = handleMessage;
1889
- newSocket.onclose = handleClose;
1890
- newSocket.onerror = handleError;
2078
+ /**
2079
+ * 创建新的 WebSocket 实例并绑定事件
2080
+ */
2081
+ createAndListenWebSocket = () => {
2082
+ this.cleanupSocket();
2083
+ const newSocket = new WebSocket(this.url);
2084
+ this.socket = newSocket;
2085
+ this.setSocketReadyState(newSocket.readyState);
2086
+ newSocket.onopen = () => this.handleOpen(newSocket);
2087
+ newSocket.onmessage = this.handleMessage;
2088
+ newSocket.onclose = this.handleClose;
2089
+ newSocket.onerror = this.handleError;
1891
2090
  };
1892
- const handleVisibilityChange = () => {
1893
- documentHide.current = document.visibilityState === "hidden";
1894
- if (socketRef.current?.readyState !== WebSocket.OPEN) {
1895
- tryReconnect();
2091
+ /**
2092
+ * 处理页面可见性变化
2093
+ * 页面隐藏时暂停部分活动,重新显示且断开时尝试重连
2094
+ */
2095
+ handleVisibilityChange = () => {
2096
+ this.documentHide = document.visibilityState === "hidden";
2097
+ if (!this.documentHide && (this.readyState === WebSocket.CLOSED || this.readyState === null)) {
2098
+ this.tryReconnect();
1896
2099
  }
1897
2100
  };
2101
+ /**
2102
+ * 供外部调用的发送消息方法
2103
+ * @param message 要发送的消息内容(字符串)
2104
+ */
2105
+ sendMessage = (message3) => {
2106
+ if (this.socket?.readyState === WebSocket.OPEN) {
2107
+ this.socket.send(message3);
2108
+ this.resetHeartbeat(this.socket);
2109
+ } else {
2110
+ console.warn("WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
2111
+ }
2112
+ };
2113
+ /**
2114
+ * 销毁当前实例,清理所有资源
2115
+ */
2116
+ destroy = () => {
2117
+ this.isDestroy = true;
2118
+ window.removeEventListener("visibilitychange", this.handleVisibilityChange);
2119
+ if (this.destroyTimeoutRef) {
2120
+ clearTimeout(this.destroyTimeoutRef);
2121
+ this.destroyTimeoutRef = null;
2122
+ }
2123
+ this.cleanupSocket(true);
2124
+ this.stopHeartbeat();
2125
+ this.stopReconnectTimer();
2126
+ };
2127
+ };
2128
+
2129
+ // src/hooks/webSocket/useWebSocket.ts
2130
+ var useWebSocket_default = ({
2131
+ url,
2132
+ onMessage,
2133
+ onClose,
2134
+ heartbeatInterval = 3e4,
2135
+ heartbeatMessage = "ping",
2136
+ clientHeartbeat = true,
2137
+ reconnectInterval = 5e3,
2138
+ maxReconnectAttempts,
2139
+ isReconnect = true
2140
+ }) => {
2141
+ const [socketReadyState, setSocketReadyState] = useState(null);
2142
+ const onMessageRef = useRef(onMessage);
2143
+ useEffect(() => {
2144
+ onMessageRef.current = onMessage;
2145
+ }, [onMessage]);
2146
+ const onCloseRef = useRef(onClose);
2147
+ useEffect(() => {
2148
+ onCloseRef.current = onClose;
2149
+ }, [onClose]);
2150
+ const managerRef = useRef(null);
1898
2151
  useEffect(() => {
1899
2152
  if (!url) return;
1900
- isDestroy.current = false;
1901
- createAndListenWebSocket();
1902
- window.addEventListener("visibilitychange", handleVisibilityChange);
2153
+ const manager = WebSocketManager.getInstance({
2154
+ url,
2155
+ heartbeatInterval,
2156
+ heartbeatMessage,
2157
+ clientHeartbeat,
2158
+ reconnectInterval,
2159
+ maxReconnectAttempts,
2160
+ isReconnect
2161
+ });
2162
+ managerRef.current = manager;
2163
+ const listener = {
2164
+ onMessage: (msg) => onMessageRef.current?.(msg),
2165
+ onClose: () => onCloseRef.current?.(),
2166
+ onStateChange: (state) => setSocketReadyState(state)
2167
+ };
2168
+ manager.addListener(listener);
1903
2169
  return () => {
1904
- window.removeEventListener("visibilitychange", handleVisibilityChange);
1905
- isDestroy.current = true;
1906
- if (socketRef.current) {
1907
- socketRef.current.close();
1908
- return;
1909
- }
1910
- stopHeartbeat();
1911
- stopReconnectTimer();
2170
+ manager.removeListener(listener);
2171
+ managerRef.current = null;
1912
2172
  };
1913
2173
  }, [url]);
1914
- const sendMessage = (message3) => {
1915
- if (socketRef.current?.readyState === WebSocket.OPEN) {
1916
- socketRef.current.send(message3);
1917
- stopHeartbeat();
1918
- startHeartbeat(socketRef.current);
1919
- } else {
1920
- console.warn("WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
1921
- }
1922
- };
2174
+ const sendMessage = useCallback((message3) => {
2175
+ managerRef.current?.sendMessage(message3);
2176
+ }, []);
1923
2177
  return {
1924
- /** 发送消息方法 */
1925
2178
  sendMessage,
1926
- /** Socket 连接状态 */
1927
2179
  socketReadyState
1928
2180
  };
1929
2181
  };
@@ -2156,7 +2408,7 @@ var ProtectedView = ({
2156
2408
  });
2157
2409
  };
2158
2410
  return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "height-full", children: /* @__PURE__ */ jsxs("div", { style: { width: 300 }, children: [
2159
- passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { message: "\u5BC6\u7801\u65E0\u6548\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\uFF01", type: "error" }),
2411
+ passwordStatus === PasswordStatus.WrongPassword && /* @__PURE__ */ jsx(Alert, { title: "\u5BC6\u7801\u65E0\u6548\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\uFF01", type: "error" }),
2160
2412
  /* @__PURE__ */ jsxs(Form, { form, size: "large", className: "m-t-24", children: [
2161
2413
  /* @__PURE__ */ jsx(Form.Item, { name: "password", rules: [{ required: true, message: "\u8BF7\u8F93\u5165\u5BC6\u7801" }], children: /* @__PURE__ */ jsx(Input.Password, { autoComplete: "new-password", placeholder: "\u8BF7\u8F93\u5165\u5BC6\u7801" }) }),
2162
2414
  /* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: onSubmit, children: "\u63D0 \u4EA4" }) })
@@ -2266,7 +2518,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2266
2518
  message3 = "\u65E0\u6CD5\u52A0\u8F7D\u6587\u6863";
2267
2519
  break;
2268
2520
  }
2269
- return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { message: message3, type: "error", showIcon: true }) });
2521
+ return /* @__PURE__ */ jsx(Flex, { className: "height-full", justify: "center", align: "center", children: /* @__PURE__ */ jsx(Alert, { title: message3, type: "error", showIcon: true }) });
2270
2522
  };
2271
2523
  const onPageChange = (e) => {
2272
2524
  let newCurrentPage = e.currentPage;
@@ -2343,7 +2595,7 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
2343
2595
  case "JPG":
2344
2596
  case "JPEG":
2345
2597
  case "GIF":
2346
- return /* @__PURE__ */ jsx(Image, { rootClassName: styles_module_default.nsPreviewImage, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
2598
+ return /* @__PURE__ */ jsx(Image$1, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
2347
2599
  case "PDF":
2348
2600
  return /* @__PURE__ */ jsx(PdfPreview_default, { fileUrl, ...pdfParams, password, onSetPassword });
2349
2601
  case "PDF_IMG":
@@ -2374,7 +2626,7 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
2374
2626
  {
2375
2627
  title,
2376
2628
  push: false,
2377
- width: "100%",
2629
+ size: "100%",
2378
2630
  open,
2379
2631
  onClose,
2380
2632
  children: /* @__PURE__ */ jsx(FilePreview_default, { ...props })
@@ -2382,8 +2634,114 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
2382
2634
  );
2383
2635
  };
2384
2636
 
2385
- // src/components/Iframe/styles.module.less
2637
+ // src/components/MicroApp/styles.module.less
2386
2638
  var styles_module_default3 = {
2639
+ microApp: "styles_module_microApp"
2640
+ };
2641
+ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
2642
+ const [loading, setLoading] = useState(false);
2643
+ useEffect(() => {
2644
+ setLoading(true);
2645
+ }, [url]);
2646
+ const handleLoad = () => {
2647
+ setLoading(false);
2648
+ onMounted?.();
2649
+ };
2650
+ const handleError = (e) => {
2651
+ setLoading(false);
2652
+ onError?.(e);
2653
+ };
2654
+ const microAppData = useMemo(() => {
2655
+ const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
2656
+ return { mainSource: [...parentMainSource, name], ...data };
2657
+ }, [data, name]);
2658
+ const TagName = microApp.tagName || "micro-app";
2659
+ return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D..." }, /* @__PURE__ */ jsxCustomEvent(
2660
+ TagName,
2661
+ {
2662
+ name,
2663
+ url,
2664
+ data: microAppData,
2665
+ class: classNames2(styles_module_default3.microApp, className),
2666
+ onMounted: handleLoad,
2667
+ onError: handleError,
2668
+ ...rest
2669
+ }
2670
+ ));
2671
+ };
2672
+ var Drawer_default = ({ name: podName }) => {
2673
+ const [currentPod, setCurrentPod] = useState({ title: "", url: "" });
2674
+ const [fullPodOpen, setFullPodOpen] = useState(false);
2675
+ const { on, off } = useIframeRelayBridge_default();
2676
+ const openPod = useCallback(({ title, url, name }) => {
2677
+ if (name === podName) {
2678
+ setCurrentPod({ title, url });
2679
+ setFullPodOpen(true);
2680
+ }
2681
+ }, []);
2682
+ const onClosePod = useCallback(() => {
2683
+ setFullPodOpen(false);
2684
+ }, []);
2685
+ useEffect(() => {
2686
+ on("openPod", openPod);
2687
+ on("onClosePod", onClosePod);
2688
+ return () => {
2689
+ off("openPod", openPod);
2690
+ off("onClosePod", onClosePod);
2691
+ };
2692
+ }, [openPod, onClosePod]);
2693
+ return /* @__PURE__ */ jsx(
2694
+ Drawer,
2695
+ {
2696
+ className: "no-padding-drawer",
2697
+ destroyOnHidden: true,
2698
+ title: currentPod.title,
2699
+ classNames: {
2700
+ header: currentPod.title === false ? "hidden" : ""
2701
+ },
2702
+ size: "100%",
2703
+ open: fullPodOpen,
2704
+ onClose: () => setFullPodOpen(false),
2705
+ children: /* @__PURE__ */ jsx(MicroApp_default, { iframe: true, name: podName, url: currentPod.url, "router-mode": "pure" }, currentPod.url)
2706
+ }
2707
+ );
2708
+ };
2709
+ var Window_default = ({ defaultUrl, name: appName }) => {
2710
+ const [windowUrl, setWindowUrl] = useState("");
2711
+ const [windowUrlKey, setWindowUrlKey, getWindowUrlKey] = useRefState_default(0);
2712
+ const { on, off } = useIframeRelayBridge_default();
2713
+ const onWindowUrlChange = (url) => {
2714
+ setWindowUrl(url);
2715
+ setWindowUrlKey(getWindowUrlKey() + 1);
2716
+ };
2717
+ useEffect(() => {
2718
+ const urlParams = getAllUrlParams(location.href);
2719
+ if (urlParams[appName]) {
2720
+ const url = microApp.router.decode(urlParams[appName]);
2721
+ onWindowUrlChange(url);
2722
+ } else {
2723
+ onWindowUrlChange(defaultUrl);
2724
+ }
2725
+ }, [defaultUrl, appName]);
2726
+ const openWindow = useCallback(
2727
+ ({ url, name }) => {
2728
+ if (appName === name) {
2729
+ onWindowUrlChange(url);
2730
+ }
2731
+ },
2732
+ [appName]
2733
+ );
2734
+ useEffect(() => {
2735
+ on("openWindow", openWindow);
2736
+ return () => {
2737
+ off("openWindow", openWindow);
2738
+ };
2739
+ }, [openWindow]);
2740
+ return windowUrl ? /* @__PURE__ */ jsx(MicroApp_default, { name: appName, url: windowUrl }, windowUrlKey) : null;
2741
+ };
2742
+
2743
+ // src/components/Iframe/styles.module.less
2744
+ var styles_module_default4 = {
2387
2745
  iframe: "styles_module_iframe"
2388
2746
  };
2389
2747
  var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
@@ -2398,13 +2756,13 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
2398
2756
  useEffect(() => {
2399
2757
  setLoading(true);
2400
2758
  }, [src]);
2401
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsx(
2759
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsx(
2402
2760
  "iframe",
2403
2761
  {
2404
2762
  id,
2405
2763
  ref,
2406
2764
  src: finalSrc,
2407
- className: classNames2(styles_module_default3.iframe, className),
2765
+ className: classNames2(styles_module_default4.iframe, className),
2408
2766
  onLoad: onHandleLoad,
2409
2767
  allow: "clipboard-write"
2410
2768
  }
@@ -2412,7 +2770,7 @@ var Iframe_default = forwardRef(({ defaultMainSource, id, src, className, onLoad
2412
2770
  });
2413
2771
 
2414
2772
  // src/components/MarkdownEditor/styles.module.less
2415
- var styles_module_default4 = {
2773
+ var styles_module_default5 = {
2416
2774
  editorParent: "styles_module_editorParent",
2417
2775
  extraToolbar: "styles_module_extraToolbar",
2418
2776
  editorFloatingToolbar: "styles_module_editorFloatingToolbar",
@@ -2904,7 +3262,7 @@ var FloatingElement = forwardRef(
2904
3262
  const handleFloatingOpenChange = (open2) => {
2905
3263
  if (!open2 && editor && resetTextSelectionOnClose) {
2906
3264
  const tr = editor.state.tr.setSelection(
2907
- Selection.near(editor.state.doc.resolve(0))
3265
+ Selection$1.near(editor.state.doc.resolve(0))
2908
3266
  );
2909
3267
  editor.view.dispatch(tr);
2910
3268
  }
@@ -3017,7 +3375,7 @@ var FloatingElement = forwardRef(
3017
3375
  const nodeBefore = $pos.nodeBefore;
3018
3376
  if (!nodeBefore || nodeBefore.isBlock) return;
3019
3377
  const tr = state.tr.setSelection(
3020
- Selection.near(state.doc.resolve(posCoords.pos))
3378
+ Selection$1.near(state.doc.resolve(posCoords.pos))
3021
3379
  );
3022
3380
  view.dispatch(tr);
3023
3381
  };
@@ -3103,7 +3461,7 @@ var ANNOTATION_KEY = "annotation";
3103
3461
  var ANNOTATION_ATTRS = ["annotation-id", "user-name", "user-id", "update-time", "content"];
3104
3462
 
3105
3463
  // src/components/MarkdownEditor/annotation/styles.module.less
3106
- var styles_module_default5 = {
3464
+ var styles_module_default6 = {
3107
3465
  annotations: "styles_module_annotations",
3108
3466
  annotationItem: "styles_module_annotationItem",
3109
3467
  annotationItemSelected: "styles_module_annotationItemSelected"
@@ -3166,7 +3524,7 @@ var AnnotationSidebar_default = ({
3166
3524
  children: annotations.length > 0 ? /* @__PURE__ */ jsx(
3167
3525
  List,
3168
3526
  {
3169
- className: classNames2(styles_module_default5.annotations, "height-full", "scroll-fade-in"),
3527
+ className: classNames2(styles_module_default6.annotations, "height-full", "scroll-fade-in"),
3170
3528
  dataSource: annotations,
3171
3529
  renderItem: (annotation) => /* @__PURE__ */ jsx(
3172
3530
  List.Item,
@@ -3174,14 +3532,14 @@ var AnnotationSidebar_default = ({
3174
3532
  ref: (el) => {
3175
3533
  itemRefs.current[annotation[ANNOTATION_ATTRS[0]]] = el;
3176
3534
  },
3177
- className: classNames2(styles_module_default5.annotationItem, {
3178
- [styles_module_default5.annotationItemSelected]: annotation[ANNOTATION_ATTRS[0]] === selectedAnnotationId
3535
+ className: classNames2(styles_module_default6.annotationItem, {
3536
+ [styles_module_default6.annotationItemSelected]: annotation[ANNOTATION_ATTRS[0]] === selectedAnnotationId
3179
3537
  }),
3180
3538
  onClick: () => {
3181
3539
  handleSelectAnnotation(annotation[ANNOTATION_ATTRS[0]]);
3182
3540
  },
3183
3541
  children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, flex: 1, children: [
3184
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default5.annotationMeta, children: [
3542
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default6.annotationMeta, children: [
3185
3543
  /* @__PURE__ */ jsx(Text, { strong: true, type: "secondary", children: annotation["user-name"] }),
3186
3544
  /* @__PURE__ */ jsx(Text, { type: "secondary", children: formatDate(annotation["update-time"]) })
3187
3545
  ] }),
@@ -3242,7 +3600,7 @@ var AnnotationSidebar_default = ({
3242
3600
  }
3243
3601
  return createPortal(sidebarContent, container);
3244
3602
  };
3245
- var createHtmlMark = (markName, ATTRS, classNames7) => {
3603
+ var createHtmlMark = (markName, ATTRS, classNames8) => {
3246
3604
  return Mark.create({
3247
3605
  name: markName,
3248
3606
  priority: 1e3,
@@ -3271,7 +3629,7 @@ var createHtmlMark = (markName, ATTRS, classNames7) => {
3271
3629
  return [
3272
3630
  "div",
3273
3631
  mergeAttributes$1(attrs, {
3274
- class: classNames7
3632
+ class: classNames8
3275
3633
  }),
3276
3634
  0
3277
3635
  ];
@@ -3785,7 +4143,7 @@ var CollectionPlugin = Extension.create({
3785
4143
  });
3786
4144
 
3787
4145
  // src/components/MarkdownEditor/collection/styles.module.less
3788
- var styles_module_default6 = {
4146
+ var styles_module_default7 = {
3789
4147
  collections: "styles_module_collections",
3790
4148
  collectionItem: "styles_module_collectionItem",
3791
4149
  collectionItemSelected: "styles_module_collectionItemSelected"
@@ -3831,7 +4189,7 @@ var collectionSidebar_default = ({
3831
4189
  children: collections.length > 0 ? /* @__PURE__ */ jsx(
3832
4190
  List,
3833
4191
  {
3834
- className: classNames2(styles_module_default6.collections, "height-full", "scroll-fade-in"),
4192
+ className: classNames2(styles_module_default7.collections, "height-full", "scroll-fade-in"),
3835
4193
  dataSource: collections,
3836
4194
  renderItem: (collection) => {
3837
4195
  if (collectionConfig?.renderItem) {
@@ -3848,14 +4206,14 @@ var collectionSidebar_default = ({
3848
4206
  ref: (el) => {
3849
4207
  itemRefs.current[collection[COLLECTION_ATTRS[0]]] = el;
3850
4208
  },
3851
- className: classNames2(styles_module_default6.collectionItem, {
3852
- [styles_module_default6.collectionItemSelected]: collection[COLLECTION_ATTRS[0]] === selectedCollectionId
4209
+ className: classNames2(styles_module_default7.collectionItem, {
4210
+ [styles_module_default7.collectionItemSelected]: collection[COLLECTION_ATTRS[0]] === selectedCollectionId
3853
4211
  }),
3854
4212
  onClick: () => {
3855
4213
  handleSelectCollection?.(collection[COLLECTION_ATTRS[0]]);
3856
4214
  },
3857
4215
  children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, flex: 1, children: [
3858
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default6.collectionMeta, children: [
4216
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "space-between", className: styles_module_default7.collectionMeta, children: [
3859
4217
  /* @__PURE__ */ jsx(Text2, { strong: true, type: "secondary", children: collection["user-name"] }),
3860
4218
  /* @__PURE__ */ jsx(Text2, { type: "secondary", children: formatDate(collection["update-time"]) })
3861
4219
  ] }),
@@ -8568,274 +8926,296 @@ var usePageNo = (pageNoConfig) => {
8568
8926
  onPageChange
8569
8927
  };
8570
8928
  };
8571
- var MarkdownEditor_default = ({
8572
- value = ``,
8573
- onChange,
8574
- searchValue,
8575
- disabled,
8576
- extraNav,
8577
- fixedToolbar = true,
8578
- floatToolbar = true,
8579
- onQuote,
8580
- onDownloadFile,
8581
- annotationConfig,
8582
- collectionConfig,
8583
- pageNoConfig
8584
- }) => {
8585
- const isMobile = useIsBreakpoint();
8586
- const lastContentRef = useRef("");
8587
- const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
8588
- const {
8589
- setAnnotationEditor,
8590
- annotations,
8591
- setAnnotations,
8592
- selectedAnnotationId,
8593
- handleSelectAnnotation,
8594
- showAnnotationModal,
8595
- showAnnotation,
8596
- onCreateAnnotation,
8597
- closeAnnotationCreateModal,
8598
- onCreateAnnotationConfirm,
8599
- handleDeleteAnnotation,
8600
- handleEditAnnotation,
8601
- setShowAnnotation
8602
- } = useAnnotations(annotationConfig);
8603
- const {
8604
- setCollectionEditor,
8605
- collections,
8606
- setCollections,
8607
- selectedCollectionId,
8608
- handleSelectCollection,
8609
- showCollection,
8610
- setShowCollection,
8611
- onCreateCollection,
8612
- handleDeleteCollection
8613
- } = useCollections(collectionConfig);
8614
- const editor = useEditor({
8615
- immediatelyRender: false,
8616
- editorProps: {
8617
- attributes: {
8618
- autocomplete: "off",
8619
- autocorrect: "off",
8620
- autocapitalize: "off",
8621
- "aria-label": "\u4E3B\u5185\u5BB9\u533A\u57DF\uFF0C\u5F00\u59CB\u8F93\u5165\u6587\u672C..."
8622
- }
8623
- },
8624
- extensions: [
8625
- Markdown,
8626
- Mathematics.configure({
8627
- // 可选:KaTeX 自定义配置
8628
- katexOptions: {
8629
- throwOnError: false
8630
- }
8631
- // 可选:内联公式点击回调
8632
- // inlineOptions: {
8633
- // onClick: (node, pos) => {
8634
- // const newLaTeX = prompt('编辑公式 LaTeX:', node.attrs.latex)
8635
- // if (newLaTeX) {
8636
- // editor?.chain().setNodeSelection(pos).updateInlineMath({ latex: newLaTeX }).run()
8637
- // }
8638
- // }
8639
- // }
8640
- }),
8641
- StarterKit.configure({
8642
- horizontalRule: false,
8643
- link: {
8644
- openOnClick: false,
8645
- enableClickSelection: true
8929
+ var MarkdownEditor_default = forwardRef(
8930
+ ({
8931
+ value = ``,
8932
+ onChange,
8933
+ searchValue,
8934
+ disabled,
8935
+ extraNav,
8936
+ fixedToolbar = true,
8937
+ floatToolbar = true,
8938
+ onQuote,
8939
+ onDownloadFile,
8940
+ annotationConfig,
8941
+ collectionConfig,
8942
+ pageNoConfig
8943
+ }, ref) => {
8944
+ const isMobile = useIsBreakpoint();
8945
+ const lastContentRef = useRef("");
8946
+ const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
8947
+ const {
8948
+ setAnnotationEditor,
8949
+ annotations,
8950
+ setAnnotations,
8951
+ selectedAnnotationId,
8952
+ handleSelectAnnotation,
8953
+ showAnnotationModal,
8954
+ showAnnotation,
8955
+ onCreateAnnotation,
8956
+ closeAnnotationCreateModal,
8957
+ onCreateAnnotationConfirm,
8958
+ handleDeleteAnnotation,
8959
+ handleEditAnnotation,
8960
+ setShowAnnotation
8961
+ } = useAnnotations(annotationConfig);
8962
+ const {
8963
+ setCollectionEditor,
8964
+ collections,
8965
+ setCollections,
8966
+ selectedCollectionId,
8967
+ handleSelectCollection,
8968
+ showCollection,
8969
+ setShowCollection,
8970
+ onCreateCollection,
8971
+ handleDeleteCollection
8972
+ } = useCollections(collectionConfig);
8973
+ const editor = useEditor({
8974
+ immediatelyRender: false,
8975
+ editorProps: {
8976
+ attributes: {
8977
+ autocomplete: "off",
8978
+ autocorrect: "off",
8979
+ autocapitalize: "off",
8980
+ "aria-label": "\u4E3B\u5185\u5BB9\u533A\u57DF\uFF0C\u5F00\u59CB\u8F93\u5165\u6587\u672C..."
8646
8981
  }
8647
- }),
8648
- HorizontalRule,
8649
- TextAlign.configure({ types: ["heading", "paragraph"] }),
8650
- TaskList,
8651
- TaskItem.configure({ nested: true }),
8652
- Highlight.configure({ multicolor: true }),
8653
- Image$1,
8654
- Typography$1,
8655
- Superscript,
8656
- Subscript,
8657
- Selection$1,
8658
- Table.configure({
8659
- resizable: true
8660
- // 可选,允许调整表格大小
8661
- }),
8662
- TableHeader,
8663
- TableRow,
8664
- TableCell,
8665
- // ImageUploadNode.configure({
8666
- // accept: 'image/*',
8667
- // maxSize: MAX_FILE_SIZE,
8668
- // limit: 3,
8669
- // upload: handleImageUpload,
8670
- // onError: (error) => console.error('上传失败:', error)
8671
- // }),
8672
- ...pageNoConfig?.enabled ? [
8673
- pageNoMark_default,
8674
- PageNoExtension.configure({
8675
- onPageChange,
8676
- containerSelector: "#contentWrapper"
8677
- })
8678
- ] : [],
8679
- searchAndReplace_default.configure({
8680
- searchResultClass: "cube-hl",
8681
- // class to give to found items. default 'cube-hl'
8682
- disableRegex: false
8683
- // also no need to explain
8684
- }),
8685
- ...annotationConfig?.enabled ? [
8686
- AnnotationMark,
8687
- AnnotationPlugin.configure({
8688
- onAnnotationsChange: setAnnotations,
8689
- onSelectAnnotation: (annotation) => {
8690
- handleSelectAnnotation(annotation?.[ANNOTATION_ATTRS[0]]);
8982
+ },
8983
+ extensions: [
8984
+ Markdown,
8985
+ Mathematics.configure({
8986
+ // 可选:KaTeX 自定义配置
8987
+ katexOptions: {
8988
+ throwOnError: false
8691
8989
  }
8692
- })
8693
- ] : [],
8694
- // 摘录功能扩展
8695
- ...collectionConfig?.enabled ? [
8696
- CollectionMark,
8697
- CollectionPlugin.configure({
8698
- onCollectionsChange: setCollections,
8699
- onSelectCollection: (collection) => {
8700
- handleSelectCollection(collection?.[COLLECTION_ATTRS[0]]);
8990
+ // 可选:内联公式点击回调
8991
+ // inlineOptions: {
8992
+ // onClick: (node, pos) => {
8993
+ // const newLaTeX = prompt('编辑公式 LaTeX:', node.attrs.latex)
8994
+ // if (newLaTeX) {
8995
+ // editor?.chain().setNodeSelection(pos).updateInlineMath({ latex: newLaTeX }).run()
8996
+ // }
8997
+ // }
8998
+ // }
8999
+ }),
9000
+ StarterKit.configure({
9001
+ horizontalRule: false,
9002
+ link: {
9003
+ openOnClick: false,
9004
+ enableClickSelection: true
8701
9005
  }
8702
- })
8703
- ] : []
8704
- ],
8705
- content: value,
8706
- contentType: "markdown",
8707
- onUpdate: () => {
8708
- const markdownOutput = getMarkdown();
8709
- if (markdownOutput === lastContentRef.current) return;
8710
- lastContentRef.current = markdownOutput;
8711
- onChange?.(markdownOutput);
8712
- }
8713
- });
8714
- const getMarkdown = () => {
8715
- if (!editor) return "";
8716
- if (editor.isEmpty) return "";
8717
- return editor.getMarkdown();
8718
- };
8719
- useEffect(() => {
8720
- if (!editor) return;
8721
- setAnnotationEditor(editor);
8722
- setCollectionEditor(editor);
8723
- setPageNoEditor(editor);
8724
- }, [editor]);
8725
- useEffect(() => {
8726
- if (!editor) return;
8727
- if (lastContentRef.current === value) return;
8728
- editor?.commands.setContent(value, { contentType: "markdown" });
8729
- editor?.commands.focus("start");
8730
- lastContentRef.current = value;
8731
- }, [value, editor]);
8732
- useEffect(() => {
8733
- editor?.commands.setSearchTerm(searchValue || "");
8734
- }, [searchValue, value, editor]);
8735
- useEffect(() => {
8736
- editor?.setEditable(!disabled);
8737
- }, [disabled, editor]);
8738
- const downloadFile2 = () => {
8739
- onDownloadFile?.(getMarkdown(), "docx");
8740
- };
8741
- const fixedTools = useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
8742
- const floatTools = useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
8743
- return /* @__PURE__ */ jsxs(Flex, { className: "height-full width-full", children: [
8744
- /* @__PURE__ */ jsx("div", { className: classNames2("height-full", "flex-1", styles_module_default4.editorParent), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
8745
- /* @__PURE__ */ jsxs(Fragment, { children: [
8746
- /* @__PURE__ */ jsxs(Flex, { justify: "end", align: "center", children: [
8747
- fixedToolbar !== false && /* @__PURE__ */ jsx(
9006
+ }),
9007
+ HorizontalRule,
9008
+ TextAlign.configure({ types: ["heading", "paragraph"] }),
9009
+ TaskList,
9010
+ TaskItem.configure({ nested: true }),
9011
+ Highlight.configure({ multicolor: true }),
9012
+ Image,
9013
+ Typography$1,
9014
+ Superscript,
9015
+ Subscript,
9016
+ Selection,
9017
+ Table.configure({
9018
+ resizable: true
9019
+ // 可选,允许调整表格大小
9020
+ }),
9021
+ TableHeader,
9022
+ TableRow,
9023
+ TableCell,
9024
+ // ImageUploadNode.configure({
9025
+ // accept: 'image/*',
9026
+ // maxSize: MAX_FILE_SIZE,
9027
+ // limit: 3,
9028
+ // upload: handleImageUpload,
9029
+ // onError: (error) => console.error('上传失败:', error)
9030
+ // }),
9031
+ ...pageNoConfig?.enabled ? [
9032
+ pageNoMark_default,
9033
+ PageNoExtension.configure({
9034
+ onPageChange,
9035
+ containerSelector: "#contentWrapper"
9036
+ })
9037
+ ] : [],
9038
+ searchAndReplace_default.configure({
9039
+ searchResultClass: "cube-hl",
9040
+ // class to give to found items. default 'cube-hl'
9041
+ disableRegex: false
9042
+ // also no need to explain
9043
+ }),
9044
+ ...annotationConfig?.enabled ? [
9045
+ AnnotationMark,
9046
+ AnnotationPlugin.configure({
9047
+ onAnnotationsChange: setAnnotations,
9048
+ onSelectAnnotation: (annotation) => {
9049
+ handleSelectAnnotation(annotation?.[ANNOTATION_ATTRS[0]]);
9050
+ }
9051
+ })
9052
+ ] : [],
9053
+ // 摘录功能扩展
9054
+ ...collectionConfig?.enabled ? [
9055
+ CollectionMark,
9056
+ CollectionPlugin.configure({
9057
+ onCollectionsChange: setCollections,
9058
+ onSelectCollection: (collection) => {
9059
+ handleSelectCollection(collection?.[COLLECTION_ATTRS[0]]);
9060
+ }
9061
+ })
9062
+ ] : []
9063
+ ],
9064
+ content: value,
9065
+ contentType: "markdown",
9066
+ onUpdate: () => {
9067
+ const markdownOutput = getMarkdown();
9068
+ if (markdownOutput === lastContentRef.current) return;
9069
+ lastContentRef.current = markdownOutput;
9070
+ onChange?.(markdownOutput);
9071
+ }
9072
+ });
9073
+ const getMarkdown = () => {
9074
+ if (!editor) return "";
9075
+ if (editor.isEmpty) return "";
9076
+ return editor.getMarkdown();
9077
+ };
9078
+ useImperativeHandle(
9079
+ ref,
9080
+ () => ({
9081
+ getEditor: () => editor,
9082
+ getMarkdown,
9083
+ focus: (pos) => {
9084
+ if (!editor) return;
9085
+ editor.commands.focus(pos);
9086
+ },
9087
+ insertContent: (value2, options) => {
9088
+ if (!editor) return;
9089
+ editor.chain().focus().insertContent(value2, options).run();
9090
+ },
9091
+ insertContentAt: (position, value2, options) => {
9092
+ if (!editor) return;
9093
+ editor.chain().focus().insertContentAt(position, value2, options).run();
9094
+ }
9095
+ }),
9096
+ [editor]
9097
+ );
9098
+ useEffect(() => {
9099
+ if (!editor) return;
9100
+ setAnnotationEditor(editor);
9101
+ setCollectionEditor(editor);
9102
+ setPageNoEditor(editor);
9103
+ }, [editor]);
9104
+ useEffect(() => {
9105
+ if (!editor) return;
9106
+ if (lastContentRef.current === value) return;
9107
+ editor?.commands.setContent(value, { contentType: "markdown" });
9108
+ editor?.commands.focus("start");
9109
+ lastContentRef.current = value;
9110
+ }, [value, editor]);
9111
+ useEffect(() => {
9112
+ editor?.commands.setSearchTerm(searchValue || "");
9113
+ }, [searchValue, value, editor]);
9114
+ useEffect(() => {
9115
+ editor?.setEditable(!disabled);
9116
+ }, [disabled, editor]);
9117
+ const downloadFile2 = () => {
9118
+ onDownloadFile?.(getMarkdown(), "docx");
9119
+ };
9120
+ const fixedTools = useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
9121
+ const floatTools = useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
9122
+ return /* @__PURE__ */ jsxs(Flex, { className: "height-full width-full", children: [
9123
+ /* @__PURE__ */ jsx("div", { className: classNames2("height-full", "flex-1", styles_module_default5.editorParent), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
9124
+ /* @__PURE__ */ jsxs(Fragment, { children: [
9125
+ /* @__PURE__ */ jsxs(Flex, { justify: "end", align: "center", children: [
9126
+ fixedToolbar !== false && /* @__PURE__ */ jsx(
9127
+ EditorToolbar,
9128
+ {
9129
+ isBubble: false,
9130
+ onQuote,
9131
+ onCreateAnnotation: annotationConfig?.enabled ? onCreateAnnotation : void 0,
9132
+ onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
9133
+ tools: fixedTools
9134
+ }
9135
+ ),
9136
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default5.extraToolbar), children: [
9137
+ annotationConfig?.enabled && annotationConfig?.showListButton !== false && /* @__PURE__ */ jsx(
9138
+ Button,
9139
+ {
9140
+ size: "small",
9141
+ title: "\u6279\u6CE8\u5217\u8868",
9142
+ icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
9143
+ color: "primary",
9144
+ variant: "text",
9145
+ onClick: () => setShowAnnotation(!showAnnotation)
9146
+ }
9147
+ ),
9148
+ collectionConfig?.enabled && collectionConfig?.showListButton !== false && /* @__PURE__ */ jsx(
9149
+ Button,
9150
+ {
9151
+ style: { gap: "2px" },
9152
+ size: "small",
9153
+ title: "\u6458\u5F55\u5217\u8868",
9154
+ icon: /* @__PURE__ */ jsx(BookOutlined, {}),
9155
+ color: "primary",
9156
+ variant: "text",
9157
+ onClick: () => setShowCollection(!showCollection),
9158
+ children: "\u6458\u5F55"
9159
+ }
9160
+ ),
9161
+ onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
9162
+ extraNav
9163
+ ] })
9164
+ ] }),
9165
+ !isMobile && floatToolbar !== false && /* @__PURE__ */ jsx(FloatingElement, { editor, zIndex: 188, resetTextSelectionOnClose: false, className: styles_module_default5.editorFloatingToolbar, children: /* @__PURE__ */ jsx(
8748
9166
  EditorToolbar,
8749
9167
  {
8750
- isBubble: false,
9168
+ isBubble: true,
8751
9169
  onQuote,
8752
9170
  onCreateAnnotation: annotationConfig?.enabled ? onCreateAnnotation : void 0,
8753
9171
  onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
8754
- tools: fixedTools
9172
+ tools: floatTools
8755
9173
  }
8756
- ),
8757
- /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default4.extraToolbar), children: [
8758
- annotationConfig?.enabled && annotationConfig?.showListButton !== false && /* @__PURE__ */ jsx(
8759
- Button,
8760
- {
8761
- size: "small",
8762
- title: "\u6279\u6CE8\u5217\u8868",
8763
- icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
8764
- color: "primary",
8765
- variant: "text",
8766
- onClick: () => setShowAnnotation(!showAnnotation)
8767
- }
8768
- ),
8769
- collectionConfig?.enabled && collectionConfig?.showListButton !== false && /* @__PURE__ */ jsx(
8770
- Button,
8771
- {
8772
- style: { gap: "2px" },
8773
- size: "small",
8774
- title: "\u6458\u5F55\u5217\u8868",
8775
- icon: /* @__PURE__ */ jsx(BookOutlined, {}),
8776
- color: "primary",
8777
- variant: "text",
8778
- onClick: () => setShowCollection(!showCollection),
8779
- children: "\u6458\u5F55"
8780
- }
8781
- ),
8782
- onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
8783
- extraNav
8784
- ] })
9174
+ ) })
8785
9175
  ] }),
8786
- !isMobile && floatToolbar !== false && /* @__PURE__ */ jsx(FloatingElement, { editor, zIndex: 188, resetTextSelectionOnClose: false, className: styles_module_default4.editorFloatingToolbar, children: /* @__PURE__ */ jsx(
8787
- EditorToolbar,
9176
+ /* @__PURE__ */ jsx("div", { id: "contentWrapper", className: classNames2(styles_module_default5.contentWrapper, "scroll-fade-in"), children: /* @__PURE__ */ jsx(
9177
+ EditorContent,
8788
9178
  {
8789
- isBubble: true,
8790
- onQuote,
8791
- onCreateAnnotation: annotationConfig?.enabled ? onCreateAnnotation : void 0,
8792
- onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
8793
- tools: floatTools
9179
+ editor,
9180
+ role: "presentation",
9181
+ className: classNames2(styles_module_default5.simpleEditorContent, "ns-markdown", { [styles_module_default5.noToolbar]: fixedToolbar === false })
8794
9182
  }
8795
9183
  ) })
9184
+ ] }) }),
9185
+ annotationConfig?.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
9186
+ showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default5.extraSidebarParent), children: /* @__PURE__ */ jsx(
9187
+ AnnotationSidebar_default,
9188
+ {
9189
+ disabled,
9190
+ annotations,
9191
+ selectedAnnotationId,
9192
+ handleSelectAnnotation: (id) => handleSelectAnnotation(id, "sidebar"),
9193
+ onEditAnnotation: handleEditAnnotation,
9194
+ onDeleteAnnotation: handleDeleteAnnotation,
9195
+ annotationConfig,
9196
+ onClose: () => setShowAnnotation(false)
9197
+ }
9198
+ ) }),
9199
+ showAnnotationModal && /* @__PURE__ */ jsx(AnnotationModal_default, { visible: showAnnotationModal, onCancel: closeAnnotationCreateModal, onConfirm: onCreateAnnotationConfirm })
8796
9200
  ] }),
8797
- /* @__PURE__ */ jsx("div", { id: "contentWrapper", className: classNames2(styles_module_default4.contentWrapper, "scroll-fade-in"), children: /* @__PURE__ */ jsx(
8798
- EditorContent,
8799
- {
8800
- editor,
8801
- role: "presentation",
8802
- className: classNames2(styles_module_default4.simpleEditorContent, "ns-markdown", { [styles_module_default4.noToolbar]: fixedToolbar === false })
8803
- }
8804
- ) })
8805
- ] }) }),
8806
- annotationConfig?.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
8807
- showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
8808
- AnnotationSidebar_default,
9201
+ collectionConfig?.enabled && showCollection && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default5.extraSidebarParent), children: /* @__PURE__ */ jsx(
9202
+ collectionSidebar_default,
8809
9203
  {
8810
9204
  disabled,
8811
- annotations,
8812
- selectedAnnotationId,
8813
- handleSelectAnnotation: (id) => handleSelectAnnotation(id, "sidebar"),
8814
- onEditAnnotation: handleEditAnnotation,
8815
- onDeleteAnnotation: handleDeleteAnnotation,
8816
- annotationConfig,
8817
- onClose: () => setShowAnnotation(false)
9205
+ collections,
9206
+ selectedCollectionId,
9207
+ handleSelectCollection: (id) => handleSelectCollection(id, "sidebar"),
9208
+ onDeleteCollection: handleDeleteCollection,
9209
+ collectionConfig,
9210
+ onClose: () => setShowCollection(false)
8818
9211
  }
8819
- ) }),
8820
- showAnnotationModal && /* @__PURE__ */ jsx(AnnotationModal_default, { visible: showAnnotationModal, onCancel: closeAnnotationCreateModal, onConfirm: onCreateAnnotationConfirm })
8821
- ] }),
8822
- collectionConfig?.enabled && showCollection && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
8823
- collectionSidebar_default,
8824
- {
8825
- disabled,
8826
- collections,
8827
- selectedCollectionId,
8828
- handleSelectCollection: (id) => handleSelectCollection(id, "sidebar"),
8829
- onDeleteCollection: handleDeleteCollection,
8830
- collectionConfig,
8831
- onClose: () => setShowCollection(false)
8832
- }
8833
- ) })
8834
- ] });
8835
- };
9212
+ ) })
9213
+ ] });
9214
+ }
9215
+ );
8836
9216
 
8837
9217
  // src/components/MarkDrawing/styles.module.less
8838
- var styles_module_default7 = {
9218
+ var styles_module_default8 = {
8839
9219
  container: "styles_module_container",
8840
9220
  rect: "styles_module_rect",
8841
9221
  score: "styles_module_score"
@@ -8859,7 +9239,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
8859
9239
  }, []);
8860
9240
  const scaleX = containerSize.width / originalSize.width;
8861
9241
  const scaleY = containerSize.height / originalSize.height;
8862
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: styles_module_default7.container, children: [
9242
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: styles_module_default8.container, children: [
8863
9243
  children,
8864
9244
  detections?.map((det, idx) => {
8865
9245
  const [x1, y1, x2, y2] = det.bbox;
@@ -8871,7 +9251,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
8871
9251
  /* @__PURE__ */ jsx(
8872
9252
  "div",
8873
9253
  {
8874
- className: styles_module_default7.rect,
9254
+ className: styles_module_default8.rect,
8875
9255
  style: {
8876
9256
  left,
8877
9257
  top,
@@ -8883,7 +9263,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
8883
9263
  /* @__PURE__ */ jsx(
8884
9264
  "div",
8885
9265
  {
8886
- className: styles_module_default7.score,
9266
+ className: styles_module_default8.score,
8887
9267
  style: {
8888
9268
  left,
8889
9269
  top: Math.max(top - 20, 0)
@@ -8935,6 +9315,6 @@ var UserAvatar_default = ({ size, avatarSrc, userName }) => {
8935
9315
  return avatarSrc ? /* @__PURE__ */ jsx(Avatar, { size, src: avatarSrc }) : /* @__PURE__ */ jsx(Avatar, { size, className: "cursor-pointer", style: { backgroundColor: "var(--ant-color-primary)" }, children: userName?.slice(0, 1)?.toLocaleUpperCase() });
8936
9316
  };
8937
9317
 
8938
- export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
9318
+ export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MicroApp_default as MicroApp, Drawer_default as MicroAppDrawer, Window_default as MicroAppWindow, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
8939
9319
  //# sourceMappingURL=index.esm.js.map
8940
9320
  //# sourceMappingURL=index.esm.js.map