@zero-library/common 3.0.1 → 3.0.2

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.cjs.js CHANGED
@@ -5,10 +5,11 @@ var icons = require('@ant-design/icons');
5
5
  var antd = require('antd');
6
6
  var classNames2 = require('classnames');
7
7
  var docxPreview = require('docx-preview');
8
- var React = require('react');
8
+ var React3 = require('react');
9
9
  var AES = require('crypto-js/aes');
10
10
  var encUtf8 = require('crypto-js/enc-utf8');
11
11
  var htmlToText$1 = require('html-to-text');
12
+ var jsonrepair = require('jsonrepair');
12
13
  var MarkdownIt = require('markdown-it');
13
14
  var markdownItDefList = require('markdown-it-deflist');
14
15
  var markdownItEmoji = require('markdown-it-emoji');
@@ -21,7 +22,6 @@ var relativeTime = require('dayjs/plugin/relativeTime');
21
22
  var axios = require('axios');
22
23
  var markdownItKatex = require('@traptitech/markdown-it-katex');
23
24
  var parse = require('html-react-parser');
24
- var jsonrepair = require('jsonrepair');
25
25
  require('katex/dist/katex.min.css');
26
26
  var reactVirtual = require('@tanstack/react-virtual');
27
27
  var core$1 = require('@react-pdf-viewer/core');
@@ -33,6 +33,9 @@ var zh_CN = require('@react-pdf-viewer/locales/lib/zh_CN.json');
33
33
  require('@react-pdf-viewer/page-navigation/lib/styles/index.css');
34
34
  require('@react-pdf-viewer/thumbnail/lib/styles/index.css');
35
35
  require('@react-pdf-viewer/zoom/lib/styles/index.css');
36
+ var Editor = require('@monaco-editor/react');
37
+ var monaco = require('monaco-editor');
38
+ var pdfjsLib = require('pdfjs-dist-v5/legacy/build/pdf.mjs');
36
39
  var microApp = require('@micro-zoe/micro-app');
37
40
  var jsxCustomEvent = require('@micro-zoe/micro-app/polyfill/jsx-custom-event');
38
41
  var react = require('@tiptap/react');
@@ -60,6 +63,7 @@ var reactHotkeysHook = require('react-hotkeys-hook');
60
63
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
61
64
  var throttle = require('lodash.throttle');
62
65
 
66
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
63
67
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
64
68
 
65
69
  function _interopNamespace(e) {
@@ -81,7 +85,7 @@ function _interopNamespace(e) {
81
85
  }
82
86
 
83
87
  var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
84
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
88
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
85
89
  var AES__default = /*#__PURE__*/_interopDefault(AES);
86
90
  var encUtf8__default = /*#__PURE__*/_interopDefault(encUtf8);
87
91
  var MarkdownIt__default = /*#__PURE__*/_interopDefault(MarkdownIt);
@@ -96,6 +100,9 @@ var axios__default = /*#__PURE__*/_interopDefault(axios);
96
100
  var markdownItKatex__default = /*#__PURE__*/_interopDefault(markdownItKatex);
97
101
  var parse__default = /*#__PURE__*/_interopDefault(parse);
98
102
  var zh_CN__default = /*#__PURE__*/_interopDefault(zh_CN);
103
+ var Editor__default = /*#__PURE__*/_interopDefault(Editor);
104
+ var monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
105
+ var pdfjsLib__namespace = /*#__PURE__*/_interopNamespace(pdfjsLib);
99
106
  var microApp__default = /*#__PURE__*/_interopDefault(microApp);
100
107
  var jsxCustomEvent__default = /*#__PURE__*/_interopDefault(jsxCustomEvent);
101
108
  var TiptapHorizontalRule__default = /*#__PURE__*/_interopDefault(TiptapHorizontalRule);
@@ -126,7 +133,14 @@ var styles_module_default = {
126
133
  nsPreviewAudio: "styles_module_nsPreviewAudio",
127
134
  nsPreviewDocx: "styles_module_nsPreviewDocx",
128
135
  docxToolbar: "styles_module_docxToolbar",
129
- docxContent: "styles_module_docxContent"
136
+ docxContent: "styles_module_docxContent",
137
+ stateBody: "styles_module_stateBody",
138
+ pdfContainer: "styles_module_pdfContainer",
139
+ floatingToolbar: "styles_module_floatingToolbar",
140
+ divider: "styles_module_divider",
141
+ pdfBody: "styles_module_pdfBody",
142
+ pdfDocument: "styles_module_pdfDocument",
143
+ pdfPage: "styles_module_pdfPage"
130
144
  };
131
145
  var AudioPlayer_default = ({ fileUrl }) => {
132
146
  return /* @__PURE__ */ jsxRuntime.jsxs("audio", { controls: true, className: styles_module_default.nsPreviewAudio, children: [
@@ -914,6 +928,21 @@ var findTreeNodesByIds = (tree, ids, formatFn, options = {}) => {
914
928
  dfs(tree);
915
929
  return result;
916
930
  };
931
+ function safeParseJson(raw, options = {}) {
932
+ const shouldRepair = options.repair ?? false;
933
+ const fallbackMode = options.fallback ?? "raw";
934
+ const getFallbackValue = () => fallbackMode === "raw" ? raw : null;
935
+ try {
936
+ return JSON.parse(raw);
937
+ } catch {
938
+ if (!shouldRepair) return getFallbackValue();
939
+ }
940
+ try {
941
+ return JSON.parse(jsonrepair.jsonrepair(raw));
942
+ } catch {
943
+ return getFallbackValue();
944
+ }
945
+ }
917
946
  dayjs__default.default.extend(relativeTime__default.default);
918
947
  var DEFAULT_DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
919
948
  var DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
@@ -1280,9 +1309,9 @@ function createTokenManager({ key, storage = localStorage }) {
1280
1309
  };
1281
1310
  }
1282
1311
  var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
1283
- const containerRef = React.useRef(null);
1284
- const [zoomRatio, setZoomRatio] = React.useState(scale);
1285
- React.useEffect(() => {
1312
+ const containerRef = React3.useRef(null);
1313
+ const [zoomRatio, setZoomRatio] = React3.useState(scale);
1314
+ React3.useEffect(() => {
1286
1315
  if (!fileUrl || !containerRef.current) return;
1287
1316
  containerRef.current.innerHTML = "";
1288
1317
  fetch(fileUrl).then((res) => res.arrayBuffer()).then(async (arrayBuffer) => {
@@ -1330,7 +1359,7 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
1330
1359
  };
1331
1360
  var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1332
1361
  const styles = { fontSize, color: "var(--ant-color-primary)" };
1333
- const Icon = React.useMemo(() => {
1362
+ const Icon = React3.useMemo(() => {
1334
1363
  switch (suffix?.toUpperCase()) {
1335
1364
  case "TXT":
1336
1365
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileTextOutlined, {});
@@ -1395,18 +1424,18 @@ var baseComponentMap = {
1395
1424
  };
1396
1425
  var lazyCache = /* @__PURE__ */ new Map();
1397
1426
  var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }) => {
1398
- const loader = customComponents?.[type] || baseComponentMap[type];
1399
- const LazyComponent = React.useMemo(() => {
1400
- if (!loader) return null;
1427
+ const loader2 = customComponents?.[type] || baseComponentMap[type];
1428
+ const LazyComponent = React3.useMemo(() => {
1429
+ if (!loader2) return null;
1401
1430
  const cached = lazyCache.get(type);
1402
1431
  if (cached) return cached;
1403
- const component = React.lazy(loader);
1432
+ const component = React3.lazy(loader2);
1404
1433
  lazyCache.set(type, component);
1405
1434
  return component;
1406
- }, [loader]);
1435
+ }, [loader2]);
1407
1436
  if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { title: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1408
1437
  return /* @__PURE__ */ jsxRuntime.jsx(
1409
- React.Suspense,
1438
+ React3.Suspense,
1410
1439
  {
1411
1440
  fallback: /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default2.skeleton, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", children: "\u7EC4\u4EF6\u52A0\u8F7D\u4E2D..." }) }),
1412
1441
  children: /* @__PURE__ */ jsxRuntime.jsx(LazyComponent, { ...rest })
@@ -1419,19 +1448,6 @@ md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
1419
1448
  token.attrPush(["target", "_blank"]);
1420
1449
  return self.renderToken(tokens, idx, options);
1421
1450
  };
1422
- function parseData(raw) {
1423
- let obj = {};
1424
- try {
1425
- obj = JSON.parse(raw);
1426
- } catch {
1427
- try {
1428
- obj = JSON.parse(jsonrepair.jsonrepair(raw));
1429
- } catch {
1430
- obj = { _raw: raw };
1431
- }
1432
- }
1433
- return obj;
1434
- }
1435
1451
  function highlightKeywords(html, keywords) {
1436
1452
  const escaped = keywords.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
1437
1453
  const regex = new RegExp(`(${escaped.join("|")})`, "gi");
@@ -1506,7 +1522,7 @@ var filterMarkdown = (content = "") => {
1506
1522
  return content.replace(/<!--[\s\S]*?(?:-->|$)/g, "");
1507
1523
  };
1508
1524
  var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...rest }) => {
1509
- const reactContent = React.useMemo(() => {
1525
+ const reactContent = React3.useMemo(() => {
1510
1526
  if (!content) return null;
1511
1527
  const { text: preprocessed, placeholders } = alertMarkClean(filterMarkdown(content));
1512
1528
  let rawHtml = md.render(preprocessed);
@@ -1523,7 +1539,7 @@ var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...
1523
1539
  let data = {};
1524
1540
  if (/^__ALERT_DATA_\d+__$/.test(dataAttr)) {
1525
1541
  const raw = placeholders.get(dataAttr) ?? "";
1526
- data = parseData(raw);
1542
+ data = safeParseJson(raw, { repair: true, fallback: "null" }) ?? { _raw: raw };
1527
1543
  }
1528
1544
  return /* @__PURE__ */ jsxRuntime.jsx(LazyComponent_default, { customComponents, type, data, loading, ...rest }, `${type}${lazyIndex}`);
1529
1545
  }
@@ -1533,8 +1549,8 @@ var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...
1533
1549
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ns-markdown", children: reactContent });
1534
1550
  };
1535
1551
  var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1536
- const [content, setContent] = React.useState("");
1537
- const [error, setError] = React.useState("");
1552
+ const [content, setContent] = React3.useState("");
1553
+ const [error, setError] = React3.useState("");
1538
1554
  const fetchMarkdown = async () => {
1539
1555
  const res = await fetch(fileUrl);
1540
1556
  if (res.status !== 200) {
@@ -1560,7 +1576,7 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1560
1576
  setError("\u6587\u4EF6\u5730\u5740\u9519\u8BEF");
1561
1577
  }
1562
1578
  };
1563
- React.useEffect(() => {
1579
+ React3.useEffect(() => {
1564
1580
  init();
1565
1581
  }, [fileUrl]);
1566
1582
  const wrapInCodeFence = (text) => {
@@ -1571,7 +1587,7 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1571
1587
  ${text}
1572
1588
  ${fence}`;
1573
1589
  };
1574
- const newContent = React.useMemo(() => {
1590
+ const newContent = React3.useMemo(() => {
1575
1591
  return content ? asPlainText ? wrapInCodeFence(content) : content : "";
1576
1592
  }, [content, asPlainText]);
1577
1593
  return error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "height-full width-full", children: /* @__PURE__ */ jsxRuntime.jsx(RenderMarkdown_default, { content: newContent, searchValue }) });
@@ -1659,34 +1675,34 @@ if (window) {
1659
1675
  window.addEventListener("message", handleGlobalMessage);
1660
1676
  }
1661
1677
  var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
1662
- const ctxRef = React.useRef({
1678
+ const ctxRef = React3.useRef({
1663
1679
  handlers: {},
1664
1680
  allowedOrigins
1665
1681
  });
1666
1682
  ctxRef.current.allowedOrigins = allowedOrigins;
1667
- React.useEffect(() => {
1683
+ React3.useEffect(() => {
1668
1684
  const ctx = ctxRef.current;
1669
1685
  hookInstances.add(ctx);
1670
1686
  return () => {
1671
1687
  hookInstances.delete(ctx);
1672
1688
  };
1673
1689
  }, []);
1674
- const on = React.useCallback((type, handler) => {
1690
+ const on = React3.useCallback((type, handler) => {
1675
1691
  const handlers = ctxRef.current.handlers;
1676
1692
  handlers[type] = handlers[type] || [];
1677
1693
  handlers[type].push(handler);
1678
1694
  }, []);
1679
- const off = React.useCallback((type, handler) => {
1695
+ const off = React3.useCallback((type, handler) => {
1680
1696
  const handlers = ctxRef.current.handlers;
1681
1697
  if (handlers[type]) {
1682
1698
  handlers[type] = handlers[type].filter((fn) => fn !== handler);
1683
1699
  }
1684
1700
  }, []);
1685
- return React.useMemo(() => ({ on, off }), [on, off]);
1701
+ return React3.useMemo(() => ({ on, off }), [on, off]);
1686
1702
  };
1687
1703
  var useRefState_default = (init) => {
1688
- const [state, setState] = React.useState(init);
1689
- const stateRef = React.useRef(init);
1704
+ const [state, setState] = React3.useState(init);
1705
+ const stateRef = React3.useRef(init);
1690
1706
  const setProxy = (newVal) => {
1691
1707
  stateRef.current = newVal;
1692
1708
  setState(newVal);
@@ -1697,19 +1713,19 @@ var useRefState_default = (init) => {
1697
1713
 
1698
1714
  // src/hooks/useAsyncQueue.ts
1699
1715
  var useAsyncQueue_default = () => {
1700
- const [queue, setQueue] = React.useState([]);
1701
- const [enabled, setEnabled] = React.useState(true);
1716
+ const [queue, setQueue] = React3.useState([]);
1717
+ const [enabled, setEnabled] = React3.useState(true);
1702
1718
  const [running, setRunning, getRunning] = useRefState_default(false);
1703
- const addToQueue = React.useCallback((func, ...args) => {
1719
+ const addToQueue = React3.useCallback((func, ...args) => {
1704
1720
  setQueue((prevQueue) => [...prevQueue, { func, args }]);
1705
1721
  }, []);
1706
- const executeQueue = React.useCallback((nextEnabled) => {
1722
+ const executeQueue = React3.useCallback((nextEnabled) => {
1707
1723
  setEnabled(nextEnabled);
1708
1724
  }, []);
1709
- const clearQueue = React.useCallback(() => {
1725
+ const clearQueue = React3.useCallback(() => {
1710
1726
  setQueue([]);
1711
1727
  }, []);
1712
- React.useEffect(() => {
1728
+ React3.useEffect(() => {
1713
1729
  if (!enabled) return;
1714
1730
  if (getRunning()) return;
1715
1731
  if (queue.length === 0) return;
@@ -1734,15 +1750,15 @@ var useAsyncQueue_default = () => {
1734
1750
  };
1735
1751
  };
1736
1752
  var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4) => {
1737
- const timerRef = React.useRef(null);
1738
- const shouldRefreshRef = React.useRef(shouldRefresh);
1739
- const callbackRef = React.useRef(callback);
1740
- const [num, setNum] = React.useState(0);
1741
- React.useEffect(() => {
1753
+ const timerRef = React3.useRef(null);
1754
+ const shouldRefreshRef = React3.useRef(shouldRefresh);
1755
+ const callbackRef = React3.useRef(callback);
1756
+ const [num, setNum] = React3.useState(0);
1757
+ React3.useEffect(() => {
1742
1758
  shouldRefreshRef.current = shouldRefresh;
1743
1759
  callbackRef.current = callback;
1744
1760
  }, [shouldRefresh, callback]);
1745
- React.useEffect(() => {
1761
+ React3.useEffect(() => {
1746
1762
  if (timerRef.current) {
1747
1763
  clearTimeout(timerRef.current);
1748
1764
  timerRef.current = null;
@@ -1761,9 +1777,9 @@ var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4)
1761
1777
  }, [listenValue, delay, num]);
1762
1778
  };
1763
1779
  var useCountDown_default = (callback) => {
1764
- const [count, setCount] = React.useState(0);
1765
- const [startCount, setStartCount] = React.useState(0);
1766
- const timer = React.useRef(null);
1780
+ const [count, setCount] = React3.useState(0);
1781
+ const [startCount, setStartCount] = React3.useState(0);
1782
+ const timer = React3.useRef(null);
1767
1783
  const pause = () => {
1768
1784
  clearInterval(timer.current);
1769
1785
  timer.current = null;
@@ -1776,12 +1792,12 @@ var useCountDown_default = (callback) => {
1776
1792
  setCount((count2) => count2 - 1);
1777
1793
  }, 1e3);
1778
1794
  };
1779
- React.useEffect(() => {
1795
+ React3.useEffect(() => {
1780
1796
  return () => {
1781
1797
  pause();
1782
1798
  };
1783
1799
  }, []);
1784
- React.useEffect(() => {
1800
+ React3.useEffect(() => {
1785
1801
  if (count === 0 && startCount !== 0) {
1786
1802
  pause();
1787
1803
  callback?.();
@@ -1790,10 +1806,10 @@ var useCountDown_default = (callback) => {
1790
1806
  return { count, start, pause, startCount };
1791
1807
  };
1792
1808
  var useCreateValtioContext_default = () => {
1793
- const Context = React.createContext(null);
1809
+ const Context = React3.createContext(null);
1794
1810
  const ValtioProvider = ({ store, children }) => /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value: store, children });
1795
1811
  const useValtioStore = () => {
1796
- const store = React.useContext(Context);
1812
+ const store = React3.useContext(Context);
1797
1813
  if (!store) throw new Error("useStore must be used within Provider");
1798
1814
  return store;
1799
1815
  };
@@ -1805,8 +1821,8 @@ var useCreateValtioContext_default = () => {
1805
1821
  };
1806
1822
  };
1807
1823
  var useDebounce_default = (func, wait = 400) => {
1808
- const { current } = React.useRef({ func, timeOut: null });
1809
- React.useEffect(() => {
1824
+ const { current } = React3.useRef({ func, timeOut: null });
1825
+ React3.useEffect(() => {
1810
1826
  current.func = func;
1811
1827
  }, [func]);
1812
1828
  let args;
@@ -1838,12 +1854,12 @@ var useDebounce_default = (func, wait = 400) => {
1838
1854
  }
1839
1855
  debounce.flush = flush;
1840
1856
  debounce.cancel = cancel;
1841
- return React.useCallback(debounce, []);
1857
+ return React3.useCallback(debounce, []);
1842
1858
  };
1843
1859
  var useDeepEffect_default = (effect, deps) => {
1844
- const prevDepsRef = React.useRef();
1860
+ const prevDepsRef = React3.useRef();
1845
1861
  const depsChanged = !prevDepsRef.current || deps.length !== prevDepsRef.current.length || deps.some((dep, i) => !deepEqual(dep, prevDepsRef.current[i]));
1846
- React.useEffect(() => {
1862
+ React3.useEffect(() => {
1847
1863
  if (depsChanged) {
1848
1864
  prevDepsRef.current = deps;
1849
1865
  return effect();
@@ -1851,8 +1867,8 @@ var useDeepEffect_default = (effect, deps) => {
1851
1867
  }, [depsChanged, effect, ...deps]);
1852
1868
  };
1853
1869
  var useSyncInput_default = (storeValue, setStoreValue) => {
1854
- const [inputValue, setInputValue] = React.useState(storeValue);
1855
- React.useEffect(() => {
1870
+ const [inputValue, setInputValue] = React3.useState(storeValue);
1871
+ React3.useEffect(() => {
1856
1872
  if (storeValue !== inputValue) {
1857
1873
  setInputValue(storeValue);
1858
1874
  }
@@ -1867,8 +1883,8 @@ var useSyncInput_default = (storeValue, setStoreValue) => {
1867
1883
  };
1868
1884
  };
1869
1885
  var useThrottle_default = (func, wait) => {
1870
- const { current } = React.useRef({ func, timeOut: null });
1871
- React.useEffect(() => {
1886
+ const { current } = React3.useRef({ func, timeOut: null });
1887
+ React3.useEffect(() => {
1872
1888
  current.func = func;
1873
1889
  }, [func]);
1874
1890
  let args;
@@ -1899,7 +1915,7 @@ var useThrottle_default = (func, wait) => {
1899
1915
  }
1900
1916
  throttle2.flush = flush;
1901
1917
  throttle2.cancel = cancel;
1902
- return React.useCallback(throttle2, []);
1918
+ return React3.useCallback(throttle2, []);
1903
1919
  };
1904
1920
 
1905
1921
  // src/hooks/webSocket/WebSocketManager.ts
@@ -2182,17 +2198,17 @@ var useWebSocket_default = ({
2182
2198
  maxReconnectAttempts,
2183
2199
  isReconnect = true
2184
2200
  }) => {
2185
- const [socketReadyState, setSocketReadyState] = React.useState(null);
2186
- const onMessageRef = React.useRef(onMessage);
2187
- React.useEffect(() => {
2201
+ const [socketReadyState, setSocketReadyState] = React3.useState(null);
2202
+ const onMessageRef = React3.useRef(onMessage);
2203
+ React3.useEffect(() => {
2188
2204
  onMessageRef.current = onMessage;
2189
2205
  }, [onMessage]);
2190
- const onCloseRef = React.useRef(onClose);
2191
- React.useEffect(() => {
2206
+ const onCloseRef = React3.useRef(onClose);
2207
+ React3.useEffect(() => {
2192
2208
  onCloseRef.current = onClose;
2193
2209
  }, [onClose]);
2194
- const managerRef = React.useRef(null);
2195
- React.useEffect(() => {
2210
+ const managerRef = React3.useRef(null);
2211
+ React3.useEffect(() => {
2196
2212
  if (!url) return;
2197
2213
  const manager = WebSocketManager.getInstance({
2198
2214
  url,
@@ -2215,7 +2231,7 @@ var useWebSocket_default = ({
2215
2231
  managerRef.current = null;
2216
2232
  };
2217
2233
  }, [url]);
2218
- const sendMessage = React.useCallback((message3) => {
2234
+ const sendMessage = React3.useCallback((message3) => {
2219
2235
  managerRef.current?.sendMessage(message3);
2220
2236
  }, []);
2221
2237
  return {
@@ -2227,9 +2243,9 @@ var THUMB_IMG_HEIGHT = 514;
2227
2243
  var MAIN_IMG_HEIGHT = 800;
2228
2244
  var MAIN_IMG_WIDTH = 600;
2229
2245
  var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = true, onSetPageNo }) => {
2230
- const [images, setImages] = React.useState([]);
2246
+ const [images, setImages] = React3.useState([]);
2231
2247
  const [currentIndex, setCurrentIndex, getCurrentIndex] = useRefState_default(0);
2232
- const [error, setError] = React.useState("");
2248
+ const [error, setError] = React3.useState("");
2233
2249
  const fetchPdfImages = async () => {
2234
2250
  const res = await fetch(fileUrl);
2235
2251
  if (res.status !== 200) {
@@ -2255,14 +2271,14 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2255
2271
  setError("pdf\u5730\u5740\u9519\u8BEF");
2256
2272
  }
2257
2273
  };
2258
- React.useEffect(() => {
2274
+ React3.useEffect(() => {
2259
2275
  init();
2260
2276
  }, [fileUrl]);
2261
2277
  const handlePageNoChange = (index) => {
2262
2278
  setCurrentIndex(index);
2263
2279
  onSetPageNo?.(images[index]?.pageNum);
2264
2280
  };
2265
- const thumbsParentRef = React.useRef(null);
2281
+ const thumbsParentRef = React3.useRef(null);
2266
2282
  const thumbsVirtualizer = reactVirtual.useVirtualizer({
2267
2283
  count: images.length,
2268
2284
  getScrollElement: () => thumbsParentRef.current,
@@ -2270,14 +2286,14 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2270
2286
  // 缩略图高度(含 margin)
2271
2287
  overscan: 3
2272
2288
  });
2273
- const containerRef = React.useRef(null);
2289
+ const containerRef = React3.useRef(null);
2274
2290
  const virtualizer = reactVirtual.useVirtualizer({
2275
2291
  count: images.length,
2276
2292
  getScrollElement: () => containerRef.current,
2277
2293
  estimateSize: () => MAIN_IMG_HEIGHT * zoom,
2278
2294
  overscan: 2
2279
2295
  });
2280
- const rAFRef = React.useRef(null);
2296
+ const rAFRef = React3.useRef(null);
2281
2297
  const onScroll = useDebounce_default(() => {
2282
2298
  if (rAFRef.current) cancelAnimationFrame(rAFRef.current);
2283
2299
  rAFRef.current = requestAnimationFrame(() => {
@@ -2302,7 +2318,7 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2302
2318
  }
2303
2319
  });
2304
2320
  }, 300);
2305
- React.useEffect(() => {
2321
+ React3.useEffect(() => {
2306
2322
  const el = containerRef.current;
2307
2323
  if (!el) return;
2308
2324
  el.addEventListener("scroll", onScroll, { passive: true });
@@ -2321,13 +2337,13 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2321
2337
  }
2322
2338
  return getCurrentIndex() ?? 0;
2323
2339
  };
2324
- React.useEffect(() => {
2340
+ React3.useEffect(() => {
2325
2341
  const index = getIndex(pageNo);
2326
2342
  if (index !== getCurrentIndex()) {
2327
2343
  virtualizer.scrollToIndex(index);
2328
2344
  }
2329
2345
  }, [images, pageNo, virtualizer, thumbsVirtualizer]);
2330
- const [zoom, setZoom] = React.useState(1);
2346
+ const [zoom, setZoom] = React3.useState(1);
2331
2347
  const zoomIn = () => setZoom((z) => Math.min(z + 0.2, 3));
2332
2348
  const zoomOut = () => setZoom((z) => Math.max(z - 0.2, 0.4));
2333
2349
  const zoomFitWidth = () => {
@@ -2338,12 +2354,12 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2338
2354
  const nextZoom = (containerWidth - 24) / MAIN_IMG_WIDTH;
2339
2355
  setZoom(Math.max(0.4, Math.min(nextZoom, 3)));
2340
2356
  };
2341
- React.useEffect(() => {
2357
+ React3.useEffect(() => {
2342
2358
  if (scale) {
2343
2359
  setZoom(scale);
2344
2360
  }
2345
2361
  }, [scale]);
2346
- React.useEffect(() => {
2362
+ React3.useEffect(() => {
2347
2363
  if (zoom) {
2348
2364
  virtualizer.measure();
2349
2365
  setTimeout(() => {
@@ -2474,12 +2490,12 @@ var openLinksNewTabPlugin = () => {
2474
2490
  };
2475
2491
  };
2476
2492
  var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumbnails = true, onSetPassword, onSetPageNo }) => {
2477
- const embedRef = React.useRef(null);
2478
- const [sizes, setSizes] = React.useState([0]);
2493
+ const embedRef = React3.useRef(null);
2494
+ const [sizes, setSizes] = React3.useState([0]);
2479
2495
  const [docLoaded, setDocLoaded, getDocLoaded] = useRefState_default(false);
2480
2496
  const [, setCurrentPage, getCurrentPage] = useRefState_default(void 0);
2481
- const [temporaryPassword, setTemporaryPassword] = React.useState("");
2482
- const jumpToPageNo = React.useRef();
2497
+ const [temporaryPassword, setTemporaryPassword] = React3.useState("");
2498
+ const jumpToPageNo = React3.useRef();
2483
2499
  const onVerifyPasswordEnd = (password2) => {
2484
2500
  setTemporaryPassword(password2);
2485
2501
  };
@@ -2533,12 +2549,12 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2533
2549
  setTemporaryPassword("");
2534
2550
  }
2535
2551
  };
2536
- React.useEffect(() => {
2552
+ React3.useEffect(() => {
2537
2553
  setCurrentPage(void 0);
2538
2554
  setDocLoaded(false);
2539
2555
  setSizes([0]);
2540
2556
  }, [fileUrl]);
2541
- React.useEffect(() => {
2557
+ React3.useEffect(() => {
2542
2558
  setTimeout(() => {
2543
2559
  onJumpToPage(pageNo);
2544
2560
  }, 0);
@@ -2630,7 +2646,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2630
2646
  ] }) }) });
2631
2647
  };
2632
2648
  var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }) => {
2633
- const Preview = React.useMemo(() => {
2649
+ const Preview = React3.useMemo(() => {
2634
2650
  if (!fileUrl) {
2635
2651
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { ...emptyProps });
2636
2652
  }
@@ -2664,6 +2680,533 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
2664
2680
  }, [suffix, fileUrl, pdfParams]);
2665
2681
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
2666
2682
  };
2683
+ Editor.loader.config({ monaco: monaco__namespace });
2684
+ var getLanguage = (suffix) => {
2685
+ switch (suffix.toLowerCase()) {
2686
+ case "ts":
2687
+ case "tsx":
2688
+ return "typescript";
2689
+ case "js":
2690
+ case "jsx":
2691
+ return "javascript";
2692
+ case "json":
2693
+ return "json";
2694
+ case "css":
2695
+ return "css";
2696
+ case "less":
2697
+ return "less";
2698
+ case "scss":
2699
+ return "scss";
2700
+ case "html":
2701
+ case "htm":
2702
+ return "html";
2703
+ case "xml":
2704
+ return "xml";
2705
+ case "py":
2706
+ return "python";
2707
+ case "java":
2708
+ return "java";
2709
+ case "go":
2710
+ return "go";
2711
+ case "yaml":
2712
+ case "yml":
2713
+ return "yaml";
2714
+ case "md":
2715
+ case "markdown":
2716
+ return "markdown";
2717
+ default:
2718
+ return "plaintext";
2719
+ }
2720
+ };
2721
+ var CodePreview = ({ fileUrl, suffix }) => {
2722
+ const [content, setContent] = React3.useState("");
2723
+ const [error, setError] = React3.useState("");
2724
+ const [loading, setLoading] = React3.useState(false);
2725
+ const fetchContent = async (signal) => {
2726
+ const headers = {
2727
+ "Content-Type": "application/json"
2728
+ };
2729
+ const res = await fetch(fileUrl, { headers, signal });
2730
+ if (res.status !== 200) {
2731
+ throw new Error(`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${res.status}`);
2732
+ }
2733
+ const buffer = await res.arrayBuffer();
2734
+ let text = "";
2735
+ try {
2736
+ const decoder = new TextDecoder("utf-8", { fatal: true });
2737
+ text = decoder.decode(buffer);
2738
+ } catch (e) {
2739
+ const gbkDecoder = new TextDecoder("gbk");
2740
+ text = gbkDecoder.decode(buffer);
2741
+ }
2742
+ setContent(text);
2743
+ };
2744
+ React3.useEffect(() => {
2745
+ const controller = new AbortController();
2746
+ const init = async () => {
2747
+ setContent("");
2748
+ setError("");
2749
+ if (fileUrl) {
2750
+ try {
2751
+ setLoading(true);
2752
+ await fetchContent(controller.signal);
2753
+ } catch (error2) {
2754
+ if (!controller.signal.aborted) {
2755
+ setError("\u52A0\u8F7D\u6587\u4EF6\u5931\u8D25");
2756
+ }
2757
+ } finally {
2758
+ if (!controller.signal.aborted) {
2759
+ setLoading(false);
2760
+ }
2761
+ }
2762
+ }
2763
+ };
2764
+ init();
2765
+ return () => {
2766
+ controller.abort();
2767
+ };
2768
+ }, [fileUrl]);
2769
+ if (error) {
2770
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error });
2771
+ }
2772
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", width: "100%", position: "relative" }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(
2773
+ Editor__default.default,
2774
+ {
2775
+ height: "100%",
2776
+ defaultLanguage: getLanguage(suffix || ""),
2777
+ value: content,
2778
+ options: {
2779
+ readOnly: true,
2780
+ minimap: { enabled: false },
2781
+ lineNumbers: "on",
2782
+ wordWrap: "on",
2783
+ fontSize: 14,
2784
+ unicodeHighlight: {
2785
+ invisibleCharacters: false,
2786
+ ambiguousCharacters: false
2787
+ }
2788
+ }
2789
+ }
2790
+ ) });
2791
+ };
2792
+ var CodePreview_default = CodePreview;
2793
+ var { Text } = antd.Typography;
2794
+ pdfjsLib__namespace.GlobalWorkerOptions.workerSrc = new URL("./pdf.worker.min.mjs", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs.js', document.baseURI).href))).toString();
2795
+ var MIN_SCALE = 0.6;
2796
+ var MAX_SCALE = 1.5;
2797
+ var SCALE_STEP = 0.1;
2798
+ var PdfPage = React3__namespace.default.memo(({ pdf, pageNumber, scale, scrollContainerRef, defaultSize }) => {
2799
+ const canvasRef = React3.useRef(null);
2800
+ const containerRef = React3.useRef(null);
2801
+ const [loading, setLoading] = React3.useState(false);
2802
+ const renderTaskRef = React3.useRef(null);
2803
+ const [dimensions, setDimensions] = React3.useState(null);
2804
+ const [shouldRender2, setShouldRender] = React3.useState(false);
2805
+ React3.useEffect(() => {
2806
+ const el = containerRef.current;
2807
+ if (!el) return;
2808
+ const renderObserver = new IntersectionObserver(
2809
+ ([entry]) => {
2810
+ setShouldRender(entry.isIntersecting);
2811
+ },
2812
+ {
2813
+ root: scrollContainerRef.current,
2814
+ rootMargin: "100% 0px"
2815
+ }
2816
+ );
2817
+ renderObserver.observe(el);
2818
+ return () => {
2819
+ renderObserver.disconnect();
2820
+ };
2821
+ }, [scrollContainerRef]);
2822
+ React3.useEffect(() => {
2823
+ setDimensions(null);
2824
+ }, [scale]);
2825
+ React3.useEffect(() => {
2826
+ if (!shouldRender2 || !pdf || !canvasRef.current) return;
2827
+ const render = async () => {
2828
+ if (renderTaskRef.current) {
2829
+ renderTaskRef.current.cancel();
2830
+ }
2831
+ try {
2832
+ setLoading(true);
2833
+ const page = await pdf.getPage(pageNumber);
2834
+ const dpr = window.devicePixelRatio || 1;
2835
+ const viewport = page.getViewport({ scale });
2836
+ const nextDimensions = { width: viewport.width, height: viewport.height };
2837
+ setDimensions(nextDimensions);
2838
+ const canvas = canvasRef.current;
2839
+ if (!canvas) return;
2840
+ const ctx = canvas.getContext("2d");
2841
+ if (!ctx) return;
2842
+ canvas.width = Math.floor(viewport.width * dpr);
2843
+ canvas.height = Math.floor(viewport.height * dpr);
2844
+ canvas.style.width = `${viewport.width}px`;
2845
+ canvas.style.height = `${viewport.height}px`;
2846
+ const renderTask = page.render({
2847
+ canvasContext: ctx,
2848
+ viewport,
2849
+ transform: [dpr, 0, 0, dpr, 0, 0]
2850
+ });
2851
+ renderTaskRef.current = renderTask;
2852
+ await renderTask.promise;
2853
+ setLoading(false);
2854
+ } catch (error) {
2855
+ if (error.name !== "RenderingCancelledException") {
2856
+ console.error(`Error rendering page ${pageNumber}:`, error);
2857
+ }
2858
+ setLoading(false);
2859
+ }
2860
+ };
2861
+ render();
2862
+ return () => {
2863
+ if (renderTaskRef.current) {
2864
+ renderTaskRef.current.cancel();
2865
+ }
2866
+ };
2867
+ }, [shouldRender2, pdf, pageNumber, scale]);
2868
+ const width = dimensions?.width || defaultSize?.width || "100%";
2869
+ const height = dimensions?.height || defaultSize?.height || 800;
2870
+ return /* @__PURE__ */ jsxRuntime.jsx(
2871
+ "div",
2872
+ {
2873
+ ref: containerRef,
2874
+ className: styles_module_default.pdfPage,
2875
+ id: `pdf-page-${pageNumber}`,
2876
+ style: {
2877
+ width,
2878
+ height,
2879
+ position: "relative"
2880
+ },
2881
+ children: shouldRender2 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2882
+ /* @__PURE__ */ jsxRuntime.jsx("canvas", { ref: canvasRef, style: { display: "block" } }),
2883
+ loading && /* @__PURE__ */ jsxRuntime.jsx(
2884
+ "div",
2885
+ {
2886
+ style: {
2887
+ position: "absolute",
2888
+ top: 0,
2889
+ left: 0,
2890
+ right: 0,
2891
+ bottom: 0,
2892
+ display: "flex",
2893
+ alignItems: "center",
2894
+ justifyContent: "center",
2895
+ background: "rgba(255,255,255,0.8)"
2896
+ },
2897
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {})
2898
+ }
2899
+ )
2900
+ ] })
2901
+ }
2902
+ );
2903
+ });
2904
+ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
2905
+ const [loading, setLoading] = React3.useState(false);
2906
+ const [pdf, setPdf] = React3.useState(null);
2907
+ const [numPages, setNumPages] = React3.useState(0);
2908
+ const [pageNumber, setPageNumber] = React3.useState(1);
2909
+ const [scale, setScale] = React3.useState(1);
2910
+ const [error, setError] = React3.useState(null);
2911
+ const containerRef = React3.useRef(null);
2912
+ const pdfLoadingTaskRef = React3.useRef(null);
2913
+ const [defaultSize, setDefaultSize] = React3.useState(void 0);
2914
+ React3.useEffect(() => {
2915
+ let aborted = false;
2916
+ const load = async () => {
2917
+ if (pdfLoadingTaskRef.current) {
2918
+ try {
2919
+ pdfLoadingTaskRef.current.destroy();
2920
+ } catch (e) {
2921
+ }
2922
+ pdfLoadingTaskRef.current = null;
2923
+ }
2924
+ setError(null);
2925
+ setPdf(null);
2926
+ setNumPages(0);
2927
+ setPageNumber(1);
2928
+ setDefaultSize(void 0);
2929
+ if (!previewEnabled || !fileUrl) {
2930
+ return;
2931
+ }
2932
+ setLoading(true);
2933
+ try {
2934
+ const loadingTask = pdfjsLib__namespace.getDocument({
2935
+ url: fileUrl,
2936
+ disableFontFace: true,
2937
+ // 强制将所有字体转换为路径绘制,解决浏览器字体加载拦截/失败导致的文字空白问题
2938
+ disableAutoFetch: true,
2939
+ disableStream: true,
2940
+ rangeChunkSize: 1024 * 512
2941
+ });
2942
+ pdfLoadingTaskRef.current = loadingTask;
2943
+ const doc = await loadingTask.promise;
2944
+ if (aborted) return;
2945
+ setPdf(doc);
2946
+ setNumPages(doc.numPages);
2947
+ setPageNumber(1);
2948
+ if (containerRef.current) {
2949
+ containerRef.current.scrollTop = 0;
2950
+ }
2951
+ try {
2952
+ const page1 = await doc.getPage(1);
2953
+ const viewport = page1.getViewport({ scale: 1 });
2954
+ if (!aborted) {
2955
+ setDefaultSize({ width: viewport.width, height: viewport.height });
2956
+ }
2957
+ } catch (e) {
2958
+ console.warn("Failed to get page 1 size", e);
2959
+ }
2960
+ } catch (e) {
2961
+ if (aborted) return;
2962
+ const message3 = e?.message;
2963
+ if (typeof message3 === "string" && message3.includes("cancelled")) ; else if (typeof message3 === "string" && message3.includes("(903)")) {
2964
+ setError("\u9884\u89C8\u6587\u4EF6\u6B63\u5728\u751F\u6210\u4E2D...");
2965
+ } else {
2966
+ setError(message3 || "PDF \u52A0\u8F7D\u5931\u8D25");
2967
+ }
2968
+ } finally {
2969
+ if (!aborted) {
2970
+ setLoading(false);
2971
+ }
2972
+ }
2973
+ };
2974
+ load();
2975
+ return () => {
2976
+ aborted = true;
2977
+ if (pdfLoadingTaskRef.current) {
2978
+ try {
2979
+ pdfLoadingTaskRef.current.destroy();
2980
+ } catch (e) {
2981
+ }
2982
+ pdfLoadingTaskRef.current = null;
2983
+ }
2984
+ };
2985
+ }, [fileUrl, previewEnabled]);
2986
+ React3.useEffect(() => {
2987
+ const container = containerRef.current;
2988
+ if (!container || numPages === 0) return;
2989
+ let rafId = 0;
2990
+ const onScroll = () => {
2991
+ if (rafId) return;
2992
+ rafId = window.requestAnimationFrame(() => {
2993
+ rafId = 0;
2994
+ const { scrollTop, clientHeight, scrollHeight } = container;
2995
+ if (scrollTop <= 10) {
2996
+ setPageNumber(1);
2997
+ return;
2998
+ }
2999
+ if (scrollTop + clientHeight >= scrollHeight - 10) {
3000
+ setPageNumber(numPages);
3001
+ return;
3002
+ }
3003
+ const containerRect = container.getBoundingClientRect();
3004
+ const centerY = containerRect.top + clientHeight / 2;
3005
+ let closestPage = 1;
3006
+ let closestDistance = Number.POSITIVE_INFINITY;
3007
+ for (let i = 1; i <= numPages; i++) {
3008
+ const el = window.document.getElementById(`pdf-page-${i}`);
3009
+ if (!el) continue;
3010
+ const rect = el.getBoundingClientRect();
3011
+ const pageCenter = rect.top + rect.height / 2;
3012
+ const distance = Math.abs(pageCenter - centerY);
3013
+ if (distance < closestDistance) {
3014
+ closestDistance = distance;
3015
+ closestPage = i;
3016
+ }
3017
+ }
3018
+ setPageNumber(closestPage);
3019
+ });
3020
+ };
3021
+ container.addEventListener("scroll", onScroll, { passive: true });
3022
+ return () => {
3023
+ if (rafId) window.cancelAnimationFrame(rafId);
3024
+ container.removeEventListener("scroll", onScroll);
3025
+ };
3026
+ }, [numPages]);
3027
+ const scrollToPage = (pageNum) => {
3028
+ const container = containerRef.current;
3029
+ const el = window.document.getElementById(`pdf-page-${pageNum}`);
3030
+ if (container && el) {
3031
+ el.scrollIntoView({ behavior: "smooth" });
3032
+ setPageNumber(pageNum);
3033
+ }
3034
+ };
3035
+ const onPrev = () => {
3036
+ scrollToPage(Math.max(1, pageNumber - 1));
3037
+ };
3038
+ const onNext = () => {
3039
+ scrollToPage(Math.min(numPages, pageNumber + 1));
3040
+ };
3041
+ const onZoomOut = () => {
3042
+ setScale((s) => Math.max(MIN_SCALE, parseFloat((s - SCALE_STEP).toFixed(2))));
3043
+ };
3044
+ const onZoomIn = () => {
3045
+ setScale((s) => Math.min(MAX_SCALE, parseFloat((s + SCALE_STEP).toFixed(2))));
3046
+ };
3047
+ const currentDefaultSize = React3.useMemo(() => {
3048
+ if (!defaultSize) return void 0;
3049
+ return {
3050
+ width: defaultSize.width * scale,
3051
+ height: defaultSize.height * scale
3052
+ };
3053
+ }, [defaultSize, scale]);
3054
+ const toolbar = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.floatingToolbar, children: [
3055
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LeftOutlined, {}), size: "small", onClick: onPrev, disabled: pageNumber <= 1 }),
3056
+ /* @__PURE__ */ jsxRuntime.jsxs(Text, { children: [
3057
+ Math.min(pageNumber, numPages),
3058
+ " / ",
3059
+ numPages || 0
3060
+ ] }),
3061
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.RightOutlined, {}), size: "small", onClick: onNext, disabled: pageNumber >= numPages || numPages === 0 }),
3062
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.divider }),
3063
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusOutlined, {}), size: "small", onClick: onZoomOut, disabled: scale <= MIN_SCALE }),
3064
+ /* @__PURE__ */ jsxRuntime.jsxs(Text, { children: [
3065
+ Math.round(scale * 100),
3066
+ "%"
3067
+ ] }),
3068
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), size: "small", onClick: onZoomIn, disabled: scale >= MAX_SCALE })
3069
+ ] });
3070
+ if (!previewEnabled) {
3071
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default.stateBody, children: "\u5173\u95ED\u9884\u89C8" });
3072
+ }
3073
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.pdfContainer, children: [
3074
+ toolbar,
3075
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.pdfBody, ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default.pdfDocument, "width-full"), children: loading && !pdf ? /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: true }) : error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default.stateBody, children: error }) : Array.from({ length: numPages }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(PdfPage, { pdf, pageNumber: i + 1, scale, scrollContainerRef: containerRef, defaultSize: currentDefaultSize }, i + 1)) }) })
3076
+ ] });
3077
+ };
3078
+ var DocumentPreview_default = DocumentPreview;
3079
+ var HtmlPreview = ({ fileUrl }) => {
3080
+ const [content, setContent] = React3.useState("");
3081
+ const [error, setError] = React3.useState("");
3082
+ const [loading, setLoading] = React3.useState(false);
3083
+ const fetchHtml = async (signal) => {
3084
+ const headers = {
3085
+ "Content-Type": "application/json"
3086
+ };
3087
+ const res = await fetch(fileUrl, {
3088
+ headers,
3089
+ signal
3090
+ });
3091
+ if (res.status !== 200) {
3092
+ throw new Error(`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${res.status}`);
3093
+ }
3094
+ const buffer = await res.arrayBuffer();
3095
+ let htmlText = "";
3096
+ try {
3097
+ const decoder = new TextDecoder("utf-8", { fatal: true });
3098
+ htmlText = decoder.decode(buffer);
3099
+ } catch (e) {
3100
+ const gbkDecoder = new TextDecoder("gbk");
3101
+ htmlText = gbkDecoder.decode(buffer);
3102
+ }
3103
+ if (!htmlText) {
3104
+ throw new Error("\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A");
3105
+ }
3106
+ setContent(htmlText);
3107
+ };
3108
+ React3.useEffect(() => {
3109
+ const controller = new AbortController();
3110
+ const init = async () => {
3111
+ setContent("");
3112
+ setError("");
3113
+ if (fileUrl) {
3114
+ try {
3115
+ setLoading(true);
3116
+ await fetchHtml(controller.signal);
3117
+ } catch (error2) {
3118
+ if (!controller.signal.aborted) {
3119
+ setError("\u52A0\u8F7D\u6216\u89E3\u6790 HTML \u5931\u8D25");
3120
+ }
3121
+ } finally {
3122
+ if (!controller.signal.aborted) {
3123
+ setLoading(false);
3124
+ }
3125
+ }
3126
+ }
3127
+ };
3128
+ init();
3129
+ return () => {
3130
+ controller.abort();
3131
+ };
3132
+ }, [fileUrl]);
3133
+ return error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", width: "100%", position: "relative" }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {}) }) : content ? /* @__PURE__ */ jsxRuntime.jsx(
3134
+ "iframe",
3135
+ {
3136
+ srcDoc: content,
3137
+ style: { width: "100%", height: "100%", border: "none" },
3138
+ sandbox: "allow-scripts allow-same-origin allow-popups allow-forms",
3139
+ title: "HTML Preview"
3140
+ }
3141
+ ) : null });
3142
+ };
3143
+ var HtmlPreview_default = HtmlPreview;
3144
+ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
3145
+ const extension = suffix ? suffix : getFileSuffixName(fileName || "");
3146
+ const Preview = React3.useMemo(() => {
3147
+ if (!fileUrl) {
3148
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { ...emptyProps });
3149
+ }
3150
+ switch (extension?.toUpperCase()) {
3151
+ case "PNG":
3152
+ case "JPG":
3153
+ case "JPEG":
3154
+ case "GIF":
3155
+ case "BMP":
3156
+ case "WEBP":
3157
+ case "SVG":
3158
+ case "ICO":
3159
+ case "TIFF":
3160
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Image, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
3161
+ case "DOC":
3162
+ case "DOCX":
3163
+ case "PDF":
3164
+ case "XLS":
3165
+ case "XLSX":
3166
+ case "PPT":
3167
+ case "PPTX":
3168
+ case "CSV":
3169
+ return /* @__PURE__ */ jsxRuntime.jsx(DocumentPreview_default, { fileUrl });
3170
+ case "MP4":
3171
+ return /* @__PURE__ */ jsxRuntime.jsx(VideoPlayer_default, { fileUrl });
3172
+ case "MP3":
3173
+ case "WAV":
3174
+ case "M4A":
3175
+ case "AAC":
3176
+ case "ACC":
3177
+ return /* @__PURE__ */ jsxRuntime.jsx(AudioPlayer_default, { fileUrl });
3178
+ case "HTML":
3179
+ case "HTM":
3180
+ return /* @__PURE__ */ jsxRuntime.jsx(HtmlPreview_default, { fileUrl });
3181
+ case "MD":
3182
+ case "MARKDOWN":
3183
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl });
3184
+ case "TS":
3185
+ case "TSX":
3186
+ case "JS":
3187
+ case "JSX":
3188
+ case "JSON":
3189
+ case "CSS":
3190
+ case "LESS":
3191
+ case "SCSS":
3192
+ case "XML":
3193
+ case "PY":
3194
+ case "JAVA":
3195
+ case "GO":
3196
+ case "YAML":
3197
+ case "YML":
3198
+ case "ENV":
3199
+ case "CONF":
3200
+ case "CONFIG":
3201
+ return /* @__PURE__ */ jsxRuntime.jsx(CodePreview_default, { fileUrl, suffix: extension });
3202
+ case "TXT":
3203
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl, asPlainText: true });
3204
+ default:
3205
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { subTitle: `\u6682\u4E0D\u652F\u6301 ${suffix || ""} \u6587\u4EF6\u7684\u9884\u89C8` });
3206
+ }
3207
+ }, [suffix, fileUrl, fileName]);
3208
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
3209
+ };
2667
3210
  var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
2668
3211
  return /* @__PURE__ */ jsxRuntime.jsx(
2669
3212
  antd.Drawer,
@@ -2683,8 +3226,8 @@ var styles_module_default3 = {
2683
3226
  microApp: "styles_module_microApp"
2684
3227
  };
2685
3228
  var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
2686
- const [loading, setLoading] = React.useState(false);
2687
- React.useEffect(() => {
3229
+ const [loading, setLoading] = React3.useState(false);
3230
+ React3.useEffect(() => {
2688
3231
  setLoading(true);
2689
3232
  }, [url]);
2690
3233
  const handleLoad = () => {
@@ -2695,7 +3238,7 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
2695
3238
  setLoading(false);
2696
3239
  onError?.(e);
2697
3240
  };
2698
- const microAppData = React.useMemo(() => {
3241
+ const microAppData = React3.useMemo(() => {
2699
3242
  const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
2700
3243
  return { mainSource: [...parentMainSource, name], ...data };
2701
3244
  }, [data, name]);
@@ -2714,19 +3257,19 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
2714
3257
  ));
2715
3258
  };
2716
3259
  var Drawer_default = ({ name: podName }) => {
2717
- const [currentPod, setCurrentPod] = React.useState({ title: "", url: "" });
2718
- const [fullPodOpen, setFullPodOpen] = React.useState(false);
3260
+ const [currentPod, setCurrentPod] = React3.useState({ title: "", url: "" });
3261
+ const [fullPodOpen, setFullPodOpen] = React3.useState(false);
2719
3262
  const { on, off } = useIframeRelayBridge_default();
2720
- const openPod = React.useCallback(({ title, url, name }) => {
3263
+ const openPod = React3.useCallback(({ title, url, name }) => {
2721
3264
  if (name === podName) {
2722
3265
  setCurrentPod({ title, url });
2723
3266
  setFullPodOpen(true);
2724
3267
  }
2725
3268
  }, []);
2726
- const onClosePod = React.useCallback(() => {
3269
+ const onClosePod = React3.useCallback(() => {
2727
3270
  setFullPodOpen(false);
2728
3271
  }, []);
2729
- React.useEffect(() => {
3272
+ React3.useEffect(() => {
2730
3273
  on("openPod", openPod);
2731
3274
  on("onClosePod", onClosePod);
2732
3275
  return () => {
@@ -2751,14 +3294,14 @@ var Drawer_default = ({ name: podName }) => {
2751
3294
  );
2752
3295
  };
2753
3296
  var Window_default = ({ defaultUrl, name: appName }) => {
2754
- const [windowUrl, setWindowUrl] = React.useState("");
3297
+ const [windowUrl, setWindowUrl] = React3.useState("");
2755
3298
  const [windowUrlKey, setWindowUrlKey, getWindowUrlKey] = useRefState_default(0);
2756
3299
  const { on, off } = useIframeRelayBridge_default();
2757
3300
  const onWindowUrlChange = (url) => {
2758
3301
  setWindowUrl(url);
2759
3302
  setWindowUrlKey(getWindowUrlKey() + 1);
2760
3303
  };
2761
- React.useEffect(() => {
3304
+ React3.useEffect(() => {
2762
3305
  const urlParams = getAllUrlParams(location.href);
2763
3306
  if (urlParams[appName]) {
2764
3307
  const url = microApp__default.default.router.decode(urlParams[appName]);
@@ -2767,7 +3310,7 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2767
3310
  onWindowUrlChange(defaultUrl);
2768
3311
  }
2769
3312
  }, [defaultUrl, appName]);
2770
- const openWindow = React.useCallback(
3313
+ const openWindow = React3.useCallback(
2771
3314
  ({ url, name }) => {
2772
3315
  if (appName === name) {
2773
3316
  onWindowUrlChange(url);
@@ -2775,7 +3318,7 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2775
3318
  },
2776
3319
  [appName]
2777
3320
  );
2778
- React.useEffect(() => {
3321
+ React3.useEffect(() => {
2779
3322
  on("openWindow", openWindow);
2780
3323
  return () => {
2781
3324
  off("openWindow", openWindow);
@@ -2788,16 +3331,16 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2788
3331
  var styles_module_default4 = {
2789
3332
  iframe: "styles_module_iframe"
2790
3333
  };
2791
- var Iframe_default = React.forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
2792
- const [loading, setLoading] = React.useState(false);
2793
- const finalSrc = React.useMemo(() => {
3334
+ var Iframe_default = React3.forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
3335
+ const [loading, setLoading] = React3.useState(false);
3336
+ const finalSrc = React3.useMemo(() => {
2794
3337
  return buildUrlParams({ v: Date.now() }, addUrlLastSlash(setUrlMainSource(src, location.href, defaultMainSource)));
2795
3338
  }, [src]);
2796
3339
  const onHandleLoad = () => {
2797
3340
  setLoading(false);
2798
3341
  onLoad?.();
2799
3342
  };
2800
- React.useEffect(() => {
3343
+ React3.useEffect(() => {
2801
3344
  setLoading(true);
2802
3345
  }, [src]);
2803
3346
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3000,7 +3543,7 @@ var PageNoExtension = core.Extension.create({
3000
3543
  });
3001
3544
  function useTiptapEditor(providedEditor) {
3002
3545
  const { editor: coreEditor } = react.useCurrentEditor();
3003
- const mainEditor = React.useMemo(() => providedEditor || coreEditor, [providedEditor, coreEditor]);
3546
+ const mainEditor = React3.useMemo(() => providedEditor || coreEditor, [providedEditor, coreEditor]);
3004
3547
  const editorState = react.useEditorState({
3005
3548
  editor: mainEditor,
3006
3549
  selector(context) {
@@ -3033,7 +3576,7 @@ function useFloatingElement(show, reference, zIndex, options, autoUpdateOptions)
3033
3576
  const { isMounted, styles } = react$1.useTransitionStyles(context);
3034
3577
  const dismiss = react$1.useDismiss(context, dismissOptions);
3035
3578
  const { getReferenceProps, getFloatingProps } = react$1.useInteractions([dismiss]);
3036
- React.useEffect(() => {
3579
+ React3.useEffect(() => {
3037
3580
  if (reference === null) {
3038
3581
  refs.setReference(null);
3039
3582
  return;
@@ -3050,7 +3593,7 @@ function useFloatingElement(show, reference, zIndex, options, autoUpdateOptions)
3050
3593
  getBoundingClientRect
3051
3594
  });
3052
3595
  }, [reference, refs]);
3053
- return React.useMemo(
3596
+ return React3.useMemo(
3054
3597
  () => ({
3055
3598
  isMounted,
3056
3599
  ref: refs.setFloating,
@@ -3268,7 +3811,7 @@ function sanitizeUrl(inputUrl, baseUrl, protocols) {
3268
3811
  }
3269
3812
  return "#";
3270
3813
  }
3271
- var FloatingElement = React.forwardRef(
3814
+ var FloatingElement = React3.forwardRef(
3272
3815
  ({
3273
3816
  editor: providedEditor,
3274
3817
  shouldShow = void 0,
@@ -3283,20 +3826,20 @@ var FloatingElement = React.forwardRef(
3283
3826
  style: propStyle,
3284
3827
  ...props
3285
3828
  }, forwardedRef) => {
3286
- const [open, setOpen] = React.useState(
3829
+ const [open, setOpen] = React3.useState(
3287
3830
  shouldShow !== void 0 ? shouldShow : false
3288
3831
  );
3289
- const floatingElementRef = React.useRef(null);
3290
- const preventHideRef = React.useRef(false);
3291
- const preventShowRef = React.useRef(false);
3292
- const editorRef = React.useRef(null);
3293
- const getBoundingClientRectRef = React.useRef(getBoundingClientRect);
3832
+ const floatingElementRef = React3.useRef(null);
3833
+ const preventHideRef = React3.useRef(false);
3834
+ const preventShowRef = React3.useRef(false);
3835
+ const editorRef = React3.useRef(null);
3836
+ const getBoundingClientRectRef = React3.useRef(getBoundingClientRect);
3294
3837
  const { editor } = useTiptapEditor(providedEditor);
3295
- React.useEffect(() => {
3838
+ React3.useEffect(() => {
3296
3839
  editorRef.current = editor;
3297
3840
  getBoundingClientRectRef.current = getBoundingClientRect;
3298
3841
  }, [editor, getBoundingClientRect]);
3299
- const handleOpenChange = React.useCallback(
3842
+ const handleOpenChange = React3.useCallback(
3300
3843
  (newOpen) => {
3301
3844
  onOpenChange?.(newOpen);
3302
3845
  setOpen(newOpen);
@@ -3312,7 +3855,7 @@ var FloatingElement = React.forwardRef(
3312
3855
  }
3313
3856
  handleOpenChange(open2);
3314
3857
  };
3315
- const reference = React.useMemo(() => {
3858
+ const reference = React3.useMemo(() => {
3316
3859
  if (referenceElement) {
3317
3860
  return referenceElement;
3318
3861
  }
@@ -3341,7 +3884,7 @@ var FloatingElement = React.forwardRef(
3341
3884
  ...floatingOptions
3342
3885
  }
3343
3886
  );
3344
- const updateSelectionState = React.useCallback(() => {
3887
+ const updateSelectionState = React3.useCallback(() => {
3345
3888
  if (!editor) return;
3346
3889
  const newRect = getBoundingClientRect(editor);
3347
3890
  if (newRect && shouldShow !== void 0 && !preventShowRef.current) {
@@ -3355,7 +3898,7 @@ var FloatingElement = React.forwardRef(
3355
3898
  handleOpenChange(false);
3356
3899
  }
3357
3900
  }, [editor, getBoundingClientRect, handleOpenChange, shouldShow]);
3358
- React.useEffect(() => {
3901
+ React3.useEffect(() => {
3359
3902
  if (!editor || !closeOnEscape) return;
3360
3903
  const handleKeyDown = (event) => {
3361
3904
  if (event.key === "Escape" && open) {
@@ -3369,7 +3912,7 @@ var FloatingElement = React.forwardRef(
3369
3912
  editor.view.dom.removeEventListener("keydown", handleKeyDown);
3370
3913
  };
3371
3914
  }, [editor, open, closeOnEscape, handleOpenChange]);
3372
- React.useEffect(() => {
3915
+ React3.useEffect(() => {
3373
3916
  if (!editor) return;
3374
3917
  const handleBlur = (event) => {
3375
3918
  if (preventHideRef.current) {
@@ -3390,7 +3933,7 @@ var FloatingElement = React.forwardRef(
3390
3933
  editor.view.dom.removeEventListener("blur", handleBlur);
3391
3934
  };
3392
3935
  }, [editor, handleOpenChange, open]);
3393
- React.useEffect(() => {
3936
+ React3.useEffect(() => {
3394
3937
  if (!editor) return;
3395
3938
  const handleDrag = () => {
3396
3939
  if (open) {
@@ -3404,7 +3947,7 @@ var FloatingElement = React.forwardRef(
3404
3947
  editor.view.dom.removeEventListener("dragover", handleDrag);
3405
3948
  };
3406
3949
  }, [editor, open, handleOpenChange]);
3407
- React.useEffect(() => {
3950
+ React3.useEffect(() => {
3408
3951
  if (!editor) return;
3409
3952
  const handleMouseDown = (event) => {
3410
3953
  if (event.button !== 0) return;
@@ -3436,18 +3979,18 @@ var FloatingElement = React.forwardRef(
3436
3979
  editor.view.root.removeEventListener("mouseup", handleMouseUp);
3437
3980
  };
3438
3981
  }, [editor, updateSelectionState]);
3439
- React.useEffect(() => {
3982
+ React3.useEffect(() => {
3440
3983
  if (!editor) return;
3441
3984
  editor.on("selectionUpdate", updateSelectionState);
3442
3985
  return () => {
3443
3986
  editor.off("selectionUpdate", updateSelectionState);
3444
3987
  };
3445
3988
  }, [editor, updateSelectionState]);
3446
- React.useEffect(() => {
3989
+ React3.useEffect(() => {
3447
3990
  if (!editor) return;
3448
3991
  updateSelectionState();
3449
3992
  }, [editor, updateSelectionState]);
3450
- const finalStyle = React.useMemo(
3993
+ const finalStyle = React3.useMemo(
3451
3994
  () => propStyle && Object.keys(propStyle).length > 0 ? propStyle : style,
3452
3995
  [propStyle, style]
3453
3996
  );
@@ -3467,8 +4010,8 @@ var FloatingElement = React.forwardRef(
3467
4010
  );
3468
4011
  FloatingElement.displayName = "FloatingElement";
3469
4012
  function useIsBreakpoint(mode = "max", breakpoint = 768) {
3470
- const [matches, setMatches] = React.useState(void 0);
3471
- React.useEffect(() => {
4013
+ const [matches, setMatches] = React3.useState(void 0);
4014
+ React3.useEffect(() => {
3472
4015
  const query = mode === "min" ? `(min-width: ${breakpoint}px)` : `(max-width: ${breakpoint - 1}px)`;
3473
4016
  const mql = window.matchMedia(query);
3474
4017
  const onChange = (e) => setMatches(e.matches);
@@ -3511,7 +4054,7 @@ var styles_module_default6 = {
3511
4054
  annotationItemSelected: "styles_module_annotationItemSelected"
3512
4055
  };
3513
4056
  var { TextArea: TextArea2 } = antd.Input;
3514
- var { Text } = antd.Typography;
4057
+ var { Text: Text2 } = antd.Typography;
3515
4058
  var AnnotationSidebar_default = ({
3516
4059
  disabled,
3517
4060
  annotations,
@@ -3523,8 +4066,8 @@ var AnnotationSidebar_default = ({
3523
4066
  onClose
3524
4067
  }) => {
3525
4068
  const [form] = antd.Form.useForm();
3526
- const [editingId, setEditingId] = React.useState();
3527
- const itemRefs = React.useRef({});
4069
+ const [editingId, setEditingId] = React3.useState();
4070
+ const itemRefs = React3.useRef({});
3528
4071
  const handleEdit = (annotation) => {
3529
4072
  setEditingId(annotation[ANNOTATION_ATTRS[0]]);
3530
4073
  form.setFieldsValue({ content: annotation.content });
@@ -3537,7 +4080,7 @@ var AnnotationSidebar_default = ({
3537
4080
  onEditAnnotation(editingId, values.content);
3538
4081
  handleCancelEdit();
3539
4082
  };
3540
- React.useEffect(() => {
4083
+ React3.useEffect(() => {
3541
4084
  handleCancelEdit();
3542
4085
  if (selectedAnnotationId) {
3543
4086
  const element = itemRefs.current[selectedAnnotationId];
@@ -3584,8 +4127,8 @@ var AnnotationSidebar_default = ({
3584
4127
  },
3585
4128
  children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, flex: 1, children: [
3586
4129
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default6.annotationMeta, children: [
3587
- /* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, type: "secondary", children: annotation["user-name"] }),
3588
- /* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", children: formatDate(annotation["update-time"]) })
4130
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, type: "secondary", children: annotation["user-name"] }),
4131
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", children: formatDate(annotation["update-time"]) })
3589
4132
  ] }),
3590
4133
  !disabled && (editingId === annotation[ANNOTATION_ATTRS[0]] ? /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, children: [
3591
4134
  /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3604,7 +4147,7 @@ var AnnotationSidebar_default = ({
3604
4147
  /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", onClick: handleCancelEdit, children: "\u53D6\u6D88" })
3605
4148
  ] })
3606
4149
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, vertical: true, children: [
3607
- /* @__PURE__ */ jsxRuntime.jsx(Text, { children: annotation.content }),
4150
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { children: annotation.content }),
3608
4151
  selectedAnnotationId === annotation[ANNOTATION_ATTRS[0]] && /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
3609
4152
  /* @__PURE__ */ jsxRuntime.jsx(
3610
4153
  antd.Button,
@@ -3644,7 +4187,7 @@ var AnnotationSidebar_default = ({
3644
4187
  }
3645
4188
  return reactDom.createPortal(sidebarContent, container);
3646
4189
  };
3647
- var createHtmlMark = (markName, ATTRS, classNames8) => {
4190
+ var createHtmlMark = (markName, ATTRS, classNames9) => {
3648
4191
  return core.Mark.create({
3649
4192
  name: markName,
3650
4193
  priority: 1e3,
@@ -3673,7 +4216,7 @@ var createHtmlMark = (markName, ATTRS, classNames8) => {
3673
4216
  return [
3674
4217
  "div",
3675
4218
  core.mergeAttributes(attrs, {
3676
- class: classNames8
4219
+ class: classNames9
3677
4220
  }),
3678
4221
  0
3679
4222
  ];
@@ -3890,10 +4433,10 @@ var AnnotationPlugin = core.Extension.create({
3890
4433
  }
3891
4434
  });
3892
4435
  var useAnnotations = (annotationConfig) => {
3893
- const [annotations, setAnnotations] = React.useState([]);
3894
- const [selectedAnnotationId, setSelectedAnnotationId] = React.useState(null);
3895
- const [showAnnotationModal, setShowAnnotationModal] = React.useState(false);
3896
- const [internalShowAnnotation, setInternalShowAnnotation] = React.useState(false);
4436
+ const [annotations, setAnnotations] = React3.useState([]);
4437
+ const [selectedAnnotationId, setSelectedAnnotationId] = React3.useState(null);
4438
+ const [showAnnotationModal, setShowAnnotationModal] = React3.useState(false);
4439
+ const [internalShowAnnotation, setInternalShowAnnotation] = React3.useState(false);
3897
4440
  const isControlled = isBoolean(annotationConfig?.visible);
3898
4441
  const showAnnotation = isControlled ? annotationConfig?.visible : internalShowAnnotation;
3899
4442
  const setShowAnnotation = (visible) => {
@@ -3902,7 +4445,7 @@ var useAnnotations = (annotationConfig) => {
3902
4445
  }
3903
4446
  annotationConfig?.onVisibleChange?.(visible);
3904
4447
  };
3905
- const editor = React.useRef();
4448
+ const editor = React3.useRef();
3906
4449
  const setAnnotationEditor = (newEditor) => {
3907
4450
  editor.current = newEditor;
3908
4451
  };
@@ -4192,7 +4735,7 @@ var styles_module_default7 = {
4192
4735
  collectionItem: "styles_module_collectionItem",
4193
4736
  collectionItemSelected: "styles_module_collectionItemSelected"
4194
4737
  };
4195
- var { Text: Text2 } = antd.Typography;
4738
+ var { Text: Text3 } = antd.Typography;
4196
4739
  var collectionSidebar_default = ({
4197
4740
  disabled,
4198
4741
  collections,
@@ -4202,8 +4745,8 @@ var collectionSidebar_default = ({
4202
4745
  collectionConfig,
4203
4746
  onClose
4204
4747
  }) => {
4205
- const itemRefs = React.useRef({});
4206
- React.useEffect(() => {
4748
+ const itemRefs = React3.useRef({});
4749
+ React3.useEffect(() => {
4207
4750
  if (selectedCollectionId) {
4208
4751
  const element = itemRefs.current[selectedCollectionId];
4209
4752
  element?.scrollIntoView({ behavior: "smooth", block: "center" });
@@ -4258,11 +4801,11 @@ var collectionSidebar_default = ({
4258
4801
  },
4259
4802
  children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, flex: 1, children: [
4260
4803
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default7.collectionMeta, children: [
4261
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, type: "secondary", children: collection["user-name"] }),
4262
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", children: formatDate(collection["update-time"]) })
4804
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { strong: true, type: "secondary", children: collection["user-name"] }),
4805
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { type: "secondary", children: formatDate(collection["update-time"]) })
4263
4806
  ] }),
4264
4807
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, vertical: true, children: [
4265
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { children: collection.text }),
4808
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { children: collection.text }),
4266
4809
  !disabled && selectedCollectionId === collection[COLLECTION_ATTRS[0]] && /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { children: /* @__PURE__ */ jsxRuntime.jsx(
4267
4810
  antd.Popconfirm,
4268
4811
  {
@@ -4290,9 +4833,9 @@ var collectionSidebar_default = ({
4290
4833
  return reactDom.createPortal(sidebarContent, container);
4291
4834
  };
4292
4835
  var useCollections = (collectionConfig) => {
4293
- const [collections, setCollections] = React.useState([]);
4294
- const [selectedCollectionId, setSelectedCollectionId] = React.useState(null);
4295
- const [internalShowCollection, setInternalShowCollection] = React.useState(false);
4836
+ const [collections, setCollections] = React3.useState([]);
4837
+ const [selectedCollectionId, setSelectedCollectionId] = React3.useState(null);
4838
+ const [internalShowCollection, setInternalShowCollection] = React3.useState(false);
4296
4839
  const isControlled = isBoolean(collectionConfig?.visible);
4297
4840
  const showCollection = isControlled ? collectionConfig?.visible : internalShowCollection;
4298
4841
  const setShowCollection = (visible) => {
@@ -4301,7 +4844,7 @@ var useCollections = (collectionConfig) => {
4301
4844
  }
4302
4845
  collectionConfig?.onVisibleChange?.(visible);
4303
4846
  };
4304
- const editor = React.useRef();
4847
+ const editor = React3.useRef();
4305
4848
  const setCollectionEditor = (newEditor) => {
4306
4849
  editor.current = newEditor;
4307
4850
  };
@@ -4364,7 +4907,7 @@ function useTooltip({
4364
4907
  delay = 600,
4365
4908
  closeDelay = 0
4366
4909
  } = {}) {
4367
- const [uncontrolledOpen, setUncontrolledOpen] = React.useState(initialOpen);
4910
+ const [uncontrolledOpen, setUncontrolledOpen] = React3.useState(initialOpen);
4368
4911
  const open = controlledOpen ?? uncontrolledOpen;
4369
4912
  const setOpen = setControlledOpen ?? setUncontrolledOpen;
4370
4913
  const data = react$1.useFloating({
@@ -4398,7 +4941,7 @@ function useTooltip({
4398
4941
  const dismiss = react$1.useDismiss(context);
4399
4942
  const role = react$1.useRole(context, { role: "tooltip" });
4400
4943
  const interactions = react$1.useInteractions([hover, focus, dismiss, role]);
4401
- return React.useMemo(
4944
+ return React3.useMemo(
4402
4945
  () => ({
4403
4946
  open,
4404
4947
  setOpen,
@@ -4408,9 +4951,9 @@ function useTooltip({
4408
4951
  [open, setOpen, interactions, data]
4409
4952
  );
4410
4953
  }
4411
- var TooltipContext = React.createContext(null);
4954
+ var TooltipContext = React3.createContext(null);
4412
4955
  function useTooltipContext() {
4413
- const context = React.useContext(TooltipContext);
4956
+ const context = React3.useContext(TooltipContext);
4414
4957
  if (context == null) {
4415
4958
  throw new Error("Tooltip components must be wrapped in <TooltipProvider />");
4416
4959
  }
@@ -4430,10 +4973,10 @@ function Tooltip({ children, ...props }) {
4430
4973
  }
4431
4974
  );
4432
4975
  }
4433
- var TooltipTrigger = React.forwardRef(
4976
+ var TooltipTrigger = React3.forwardRef(
4434
4977
  function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
4435
4978
  const context = useTooltipContext();
4436
- const childrenRef = React.isValidElement(children) ? parseInt(React.version, 10) >= 19 ? (
4979
+ const childrenRef = React3.isValidElement(children) ? parseInt(React3.version, 10) >= 19 ? (
4437
4980
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4438
4981
  children.props.ref
4439
4982
  ) : (
@@ -4441,11 +4984,11 @@ var TooltipTrigger = React.forwardRef(
4441
4984
  children.ref
4442
4985
  ) : void 0;
4443
4986
  const ref = react$1.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
4444
- if (asChild && React.isValidElement(children)) {
4987
+ if (asChild && React3.isValidElement(children)) {
4445
4988
  const dataAttributes = {
4446
4989
  "data-tooltip-state": context.open ? "open" : "closed"
4447
4990
  };
4448
- return React.cloneElement(
4991
+ return React3.cloneElement(
4449
4992
  children,
4450
4993
  context.getReferenceProps({
4451
4994
  ref,
@@ -4466,7 +5009,7 @@ var TooltipTrigger = React.forwardRef(
4466
5009
  );
4467
5010
  }
4468
5011
  );
4469
- var TooltipContent = React.forwardRef(
5012
+ var TooltipContent = React3.forwardRef(
4470
5013
  function TooltipContent2({ style, children, portal = true, portalProps = {}, ...props }, propRef) {
4471
5014
  const context = useTooltipContext();
4472
5015
  const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
@@ -4497,12 +5040,12 @@ var ShortcutDisplay = ({
4497
5040
  shortcuts
4498
5041
  }) => {
4499
5042
  if (shortcuts.length === 0) return null;
4500
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: shortcuts.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
5043
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: shortcuts.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs(React3.Fragment, { children: [
4501
5044
  index > 0 && /* @__PURE__ */ jsxRuntime.jsx("kbd", { children: "+" }),
4502
5045
  /* @__PURE__ */ jsxRuntime.jsx("kbd", { children: key })
4503
5046
  ] }, index)) });
4504
5047
  };
4505
- var Button6 = React.forwardRef(
5048
+ var Button7 = React3.forwardRef(
4506
5049
  ({
4507
5050
  className,
4508
5051
  children,
@@ -4512,7 +5055,7 @@ var Button6 = React.forwardRef(
4512
5055
  "aria-label": ariaLabel,
4513
5056
  ...props
4514
5057
  }, ref) => {
4515
- const shortcuts = React.useMemo(
5058
+ const shortcuts = React3.useMemo(
4516
5059
  () => parseShortcutKeys({ shortcutKeys }),
4517
5060
  [shortcutKeys]
4518
5061
  );
@@ -4546,8 +5089,8 @@ var Button6 = React.forwardRef(
4546
5089
  ] });
4547
5090
  }
4548
5091
  );
4549
- Button6.displayName = "Button";
4550
- var ButtonGroup = React.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
5092
+ Button7.displayName = "Button";
5093
+ var ButtonGroup = React3.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
4551
5094
  return /* @__PURE__ */ jsxRuntime.jsx(
4552
5095
  "div",
4553
5096
  {
@@ -4577,7 +5120,7 @@ function Spacer({
4577
5120
  };
4578
5121
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, style: computedStyle });
4579
5122
  }
4580
- var Separator = React.forwardRef(
5123
+ var Separator = React3.forwardRef(
4581
5124
  ({ decorative, orientation = "vertical", className, ...divProps }, ref) => {
4582
5125
  const ariaOrientation = orientation === "vertical" ? orientation : void 0;
4583
5126
  const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
@@ -4604,8 +5147,8 @@ function useMenuNavigation({
4604
5147
  orientation = "vertical",
4605
5148
  autoSelectFirstItem = true
4606
5149
  }) {
4607
- const [selectedIndex, setSelectedIndex] = React.useState(autoSelectFirstItem ? 0 : -1);
4608
- React.useEffect(() => {
5150
+ const [selectedIndex, setSelectedIndex] = React3.useState(autoSelectFirstItem ? 0 : -1);
5151
+ React3.useEffect(() => {
4609
5152
  const handleKeyboardNavigation = (event) => {
4610
5153
  if (!items.length) return false;
4611
5154
  const moveNext = () => setSelectedIndex((currentIndex) => {
@@ -4691,7 +5234,7 @@ function useMenuNavigation({
4691
5234
  }
4692
5235
  return void 0;
4693
5236
  }, [editor, containerRef, items, selectedIndex, onSelect, onClose, orientation]);
4694
- React.useEffect(() => {
5237
+ React3.useEffect(() => {
4695
5238
  if (query) {
4696
5239
  setSelectedIndex(autoSelectFirstItem ? 0 : -1);
4697
5240
  }
@@ -4709,8 +5252,8 @@ var updateRef = (ref, value) => {
4709
5252
  }
4710
5253
  };
4711
5254
  var useComposedRef = (libRef, userRef) => {
4712
- const prevUserRef = React.useRef(null);
4713
- return React.useCallback(
5255
+ const prevUserRef = React3.useRef(null);
5256
+ return React3.useCallback(
4714
5257
  (instance) => {
4715
5258
  if (libRef && "current" in libRef) {
4716
5259
  libRef.current = instance;
@@ -4727,8 +5270,8 @@ var useComposedRef = (libRef, userRef) => {
4727
5270
  );
4728
5271
  };
4729
5272
  var useToolbarNavigation = (toolbarRef) => {
4730
- const [items, setItems] = React.useState([]);
4731
- const collectItems = React.useCallback(() => {
5273
+ const [items, setItems] = React3.useState([]);
5274
+ const collectItems = React3.useCallback(() => {
4732
5275
  if (!toolbarRef.current) return [];
4733
5276
  return Array.from(
4734
5277
  toolbarRef.current.querySelectorAll(
@@ -4736,7 +5279,7 @@ var useToolbarNavigation = (toolbarRef) => {
4736
5279
  )
4737
5280
  );
4738
5281
  }, [toolbarRef]);
4739
- React.useEffect(() => {
5282
+ React3.useEffect(() => {
4740
5283
  const toolbar = toolbarRef.current;
4741
5284
  if (!toolbar) return;
4742
5285
  const updateItems = () => setItems(collectItems());
@@ -4752,7 +5295,7 @@ var useToolbarNavigation = (toolbarRef) => {
4752
5295
  onSelect: (el) => el.click(),
4753
5296
  autoSelectFirstItem: false
4754
5297
  });
4755
- React.useEffect(() => {
5298
+ React3.useEffect(() => {
4756
5299
  const toolbar = toolbarRef.current;
4757
5300
  if (!toolbar) return;
4758
5301
  const handleFocus = (e) => {
@@ -4771,15 +5314,15 @@ var useToolbarNavigation = (toolbarRef) => {
4771
5314
  toolbar.removeEventListener("blur", handleBlur, true);
4772
5315
  };
4773
5316
  }, [toolbarRef]);
4774
- React.useEffect(() => {
5317
+ React3.useEffect(() => {
4775
5318
  if (selectedIndex !== void 0 && items[selectedIndex]) {
4776
5319
  items[selectedIndex].focus();
4777
5320
  }
4778
5321
  }, [selectedIndex, items]);
4779
5322
  };
4780
- var Toolbar = React.forwardRef(
5323
+ var Toolbar = React3.forwardRef(
4781
5324
  ({ children, className, variant = "fixed", ...props }, ref) => {
4782
- const toolbarRef = React.useRef(null);
5325
+ const toolbarRef = React3.useRef(null);
4783
5326
  const composedRef = useComposedRef(toolbarRef, ref);
4784
5327
  useToolbarNavigation(toolbarRef);
4785
5328
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4797,7 +5340,7 @@ var Toolbar = React.forwardRef(
4797
5340
  }
4798
5341
  );
4799
5342
  Toolbar.displayName = "Toolbar";
4800
- var ToolbarGroup = React.forwardRef(
5343
+ var ToolbarGroup = React3.forwardRef(
4801
5344
  ({ children, className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4802
5345
  "div",
4803
5346
  {
@@ -4810,11 +5353,11 @@ var ToolbarGroup = React.forwardRef(
4810
5353
  )
4811
5354
  );
4812
5355
  ToolbarGroup.displayName = "ToolbarGroup";
4813
- var ToolbarSeparator = React.forwardRef(
5356
+ var ToolbarSeparator = React3.forwardRef(
4814
5357
  ({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(Separator, { ref, orientation: "vertical", decorative: true, ...props })
4815
5358
  );
4816
5359
  ToolbarSeparator.displayName = "ToolbarSeparator";
4817
- var Badge = React.forwardRef(
5360
+ var Badge = React3.forwardRef(
4818
5361
  ({
4819
5362
  variant,
4820
5363
  size = "default",
@@ -4845,7 +5388,7 @@ function BlockquoteShortcutBadge({
4845
5388
  }) {
4846
5389
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
4847
5390
  }
4848
- var BlockquoteButton = React.forwardRef(
5391
+ var BlockquoteButton = React3.forwardRef(
4849
5392
  ({
4850
5393
  editor: providedEditor,
4851
5394
  text,
@@ -4870,7 +5413,7 @@ var BlockquoteButton = React.forwardRef(
4870
5413
  hideWhenUnavailable,
4871
5414
  onToggled
4872
5415
  });
4873
- const handleClick = React.useCallback(
5416
+ const handleClick = React3.useCallback(
4874
5417
  (event) => {
4875
5418
  onClick?.(event);
4876
5419
  if (event.defaultPrevented) return;
@@ -4882,7 +5425,7 @@ var BlockquoteButton = React.forwardRef(
4882
5425
  return null;
4883
5426
  }
4884
5427
  return /* @__PURE__ */ jsxRuntime.jsx(
4885
- Button6,
5428
+ Button7,
4886
5429
  {
4887
5430
  type: "button",
4888
5431
  "data-style": "ghost",
@@ -4907,7 +5450,7 @@ var BlockquoteButton = React.forwardRef(
4907
5450
  }
4908
5451
  );
4909
5452
  BlockquoteButton.displayName = "BlockquoteButton";
4910
- var BlockquoteIcon = React.memo(({ className, ...props }) => {
5453
+ var BlockquoteIcon = React3.memo(({ className, ...props }) => {
4911
5454
  return /* @__PURE__ */ jsxRuntime.jsxs(
4912
5455
  "svg",
4913
5456
  {
@@ -5034,10 +5577,10 @@ function useBlockquote(config) {
5034
5577
  onToggled
5035
5578
  } = config || {};
5036
5579
  const { editor } = useTiptapEditor(providedEditor);
5037
- const [isVisible, setIsVisible] = React.useState(true);
5580
+ const [isVisible, setIsVisible] = React3.useState(true);
5038
5581
  const canToggle3 = canToggleBlockquote(editor);
5039
5582
  const isActive = editor?.isActive("blockquote") || false;
5040
- React.useEffect(() => {
5583
+ React3.useEffect(() => {
5041
5584
  if (!editor) return;
5042
5585
  const handleSelectionUpdate = () => {
5043
5586
  setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
@@ -5048,7 +5591,7 @@ function useBlockquote(config) {
5048
5591
  editor.off("selectionUpdate", handleSelectionUpdate);
5049
5592
  };
5050
5593
  }, [editor, hideWhenUnavailable]);
5051
- const handleToggle = React.useCallback(() => {
5594
+ const handleToggle = React3.useCallback(() => {
5052
5595
  if (!editor) return false;
5053
5596
  const success = toggleBlockquote(editor);
5054
5597
  if (success) {
@@ -5071,7 +5614,7 @@ function CodeBlockShortcutBadge({
5071
5614
  }) {
5072
5615
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5073
5616
  }
5074
- var CodeBlockButton = React.forwardRef(
5617
+ var CodeBlockButton = React3.forwardRef(
5075
5618
  ({
5076
5619
  editor: providedEditor,
5077
5620
  text,
@@ -5096,7 +5639,7 @@ var CodeBlockButton = React.forwardRef(
5096
5639
  hideWhenUnavailable,
5097
5640
  onToggled
5098
5641
  });
5099
- const handleClick = React.useCallback(
5642
+ const handleClick = React3.useCallback(
5100
5643
  (event) => {
5101
5644
  onClick?.(event);
5102
5645
  if (event.defaultPrevented) return;
@@ -5108,7 +5651,7 @@ var CodeBlockButton = React.forwardRef(
5108
5651
  return null;
5109
5652
  }
5110
5653
  return /* @__PURE__ */ jsxRuntime.jsx(
5111
- Button6,
5654
+ Button7,
5112
5655
  {
5113
5656
  type: "button",
5114
5657
  "data-style": "ghost",
@@ -5133,7 +5676,7 @@ var CodeBlockButton = React.forwardRef(
5133
5676
  }
5134
5677
  );
5135
5678
  CodeBlockButton.displayName = "CodeBlockButton";
5136
- var CodeBlockIcon = React.memo(({ className, ...props }) => {
5679
+ var CodeBlockIcon = React3.memo(({ className, ...props }) => {
5137
5680
  return /* @__PURE__ */ jsxRuntime.jsxs(
5138
5681
  "svg",
5139
5682
  {
@@ -5251,10 +5794,10 @@ function useCodeBlock(config) {
5251
5794
  onToggled
5252
5795
  } = config || {};
5253
5796
  const { editor } = useTiptapEditor(providedEditor);
5254
- const [isVisible, setIsVisible] = React.useState(true);
5797
+ const [isVisible, setIsVisible] = React3.useState(true);
5255
5798
  const canToggleState = canToggle(editor);
5256
5799
  const isActive = editor?.isActive("codeBlock") || false;
5257
- React.useEffect(() => {
5800
+ React3.useEffect(() => {
5258
5801
  if (!editor) return;
5259
5802
  const handleSelectionUpdate = () => {
5260
5803
  setIsVisible(shouldShowButton2({ editor, hideWhenUnavailable }));
@@ -5265,7 +5808,7 @@ function useCodeBlock(config) {
5265
5808
  editor.off("selectionUpdate", handleSelectionUpdate);
5266
5809
  };
5267
5810
  }, [editor, hideWhenUnavailable]);
5268
- const handleToggle = React.useCallback(() => {
5811
+ const handleToggle = React3.useCallback(() => {
5269
5812
  if (!editor) return false;
5270
5813
  const success = toggleCodeBlock(editor);
5271
5814
  if (success) {
@@ -5283,7 +5826,7 @@ function useCodeBlock(config) {
5283
5826
  Icon: CodeBlockIcon
5284
5827
  };
5285
5828
  }
5286
- var BanIcon = React.memo(({ className, ...props }) => {
5829
+ var BanIcon = React3.memo(({ className, ...props }) => {
5287
5830
  return /* @__PURE__ */ jsxRuntime.jsx(
5288
5831
  "svg",
5289
5832
  {
@@ -5307,7 +5850,7 @@ var BanIcon = React.memo(({ className, ...props }) => {
5307
5850
  );
5308
5851
  });
5309
5852
  BanIcon.displayName = "BanIcon";
5310
- var HighlighterIcon = React.memo(({ className, ...props }) => {
5853
+ var HighlighterIcon = React3.memo(({ className, ...props }) => {
5311
5854
  return /* @__PURE__ */ jsxRuntime.jsx(
5312
5855
  "svg",
5313
5856
  {
@@ -5357,13 +5900,13 @@ function PopoverContent({
5357
5900
  }
5358
5901
  ) });
5359
5902
  }
5360
- var Card3 = React.forwardRef(
5903
+ var Card3 = React3.forwardRef(
5361
5904
  ({ className, ...props }, ref) => {
5362
5905
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("tiptap-card", className), ...props });
5363
5906
  }
5364
5907
  );
5365
5908
  Card3.displayName = "Card";
5366
- var CardHeader = React.forwardRef(
5909
+ var CardHeader = React3.forwardRef(
5367
5910
  ({ className, ...props }, ref) => {
5368
5911
  return /* @__PURE__ */ jsxRuntime.jsx(
5369
5912
  "div",
@@ -5376,13 +5919,13 @@ var CardHeader = React.forwardRef(
5376
5919
  }
5377
5920
  );
5378
5921
  CardHeader.displayName = "CardHeader";
5379
- var CardBody = React.forwardRef(
5922
+ var CardBody = React3.forwardRef(
5380
5923
  ({ className, ...props }, ref) => {
5381
5924
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("tiptap-card-body", className), ...props });
5382
5925
  }
5383
5926
  );
5384
5927
  CardBody.displayName = "CardBody";
5385
- var CardItemGroup = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
5928
+ var CardItemGroup = React3.forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
5386
5929
  return /* @__PURE__ */ jsxRuntime.jsx(
5387
5930
  "div",
5388
5931
  {
@@ -5394,7 +5937,7 @@ var CardItemGroup = React.forwardRef(({ className, orientation = "vertical", ...
5394
5937
  );
5395
5938
  });
5396
5939
  CardItemGroup.displayName = "CardItemGroup";
5397
- var CardGroupLabel = React.forwardRef(
5940
+ var CardGroupLabel = React3.forwardRef(
5398
5941
  ({ className, ...props }, ref) => {
5399
5942
  return /* @__PURE__ */ jsxRuntime.jsx(
5400
5943
  "div",
@@ -5407,7 +5950,7 @@ var CardGroupLabel = React.forwardRef(
5407
5950
  }
5408
5951
  );
5409
5952
  CardGroupLabel.displayName = "CardGroupLabel";
5410
- var CardFooter = React.forwardRef(
5953
+ var CardFooter = React3.forwardRef(
5411
5954
  ({ className, ...props }, ref) => {
5412
5955
  return /* @__PURE__ */ jsxRuntime.jsx(
5413
5956
  "div",
@@ -5425,7 +5968,7 @@ function ColorHighlightShortcutBadge({
5425
5968
  }) {
5426
5969
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5427
5970
  }
5428
- var ColorHighlightButton = React.forwardRef(
5971
+ var ColorHighlightButton = React3.forwardRef(
5429
5972
  ({
5430
5973
  editor: providedEditor,
5431
5974
  highlightColor,
@@ -5455,7 +5998,7 @@ var ColorHighlightButton = React.forwardRef(
5455
5998
  mode,
5456
5999
  onApplied
5457
6000
  });
5458
- const handleClick = React.useCallback(
6001
+ const handleClick = React3.useCallback(
5459
6002
  (event) => {
5460
6003
  onClick?.(event);
5461
6004
  if (event.defaultPrevented) return;
@@ -5463,7 +6006,7 @@ var ColorHighlightButton = React.forwardRef(
5463
6006
  },
5464
6007
  [handleColorHighlight, onClick]
5465
6008
  );
5466
- const buttonStyle = React.useMemo(
6009
+ const buttonStyle = React3.useMemo(
5467
6010
  () => ({
5468
6011
  ...style,
5469
6012
  "--highlight-color": highlightColor
@@ -5474,7 +6017,7 @@ var ColorHighlightButton = React.forwardRef(
5474
6017
  return null;
5475
6018
  }
5476
6019
  return /* @__PURE__ */ jsxRuntime.jsx(
5477
- Button6,
6020
+ Button7,
5478
6021
  {
5479
6022
  type: "button",
5480
6023
  "data-style": "ghost",
@@ -5635,10 +6178,10 @@ function useColorHighlight(config) {
5635
6178
  } = config;
5636
6179
  const { editor } = useTiptapEditor(providedEditor);
5637
6180
  const isMobile = useIsBreakpoint();
5638
- const [isVisible, setIsVisible] = React.useState(true);
6181
+ const [isVisible, setIsVisible] = React3.useState(true);
5639
6182
  const canColorHighlightState = canColorHighlight(editor, mode);
5640
6183
  const isActive = isColorHighlightActive(editor, highlightColor, mode);
5641
- React.useEffect(() => {
6184
+ React3.useEffect(() => {
5642
6185
  if (!editor) return;
5643
6186
  const handleSelectionUpdate = () => {
5644
6187
  setIsVisible(shouldShowButton3({ editor, hideWhenUnavailable, mode }));
@@ -5649,7 +6192,7 @@ function useColorHighlight(config) {
5649
6192
  editor.off("selectionUpdate", handleSelectionUpdate);
5650
6193
  };
5651
6194
  }, [editor, hideWhenUnavailable, mode]);
5652
- const handleColorHighlight = React.useCallback(() => {
6195
+ const handleColorHighlight = React3.useCallback(() => {
5653
6196
  if (!editor || !canColorHighlightState || !highlightColor || !label)
5654
6197
  return false;
5655
6198
  if (mode === "mark") {
@@ -5677,7 +6220,7 @@ function useColorHighlight(config) {
5677
6220
  return success;
5678
6221
  }
5679
6222
  }, [canColorHighlightState, highlightColor, editor, label, onApplied, mode]);
5680
- const handleRemoveHighlight = React.useCallback(() => {
6223
+ const handleRemoveHighlight = React3.useCallback(() => {
5681
6224
  const success = removeHighlight(editor, mode);
5682
6225
  if (success) {
5683
6226
  onApplied?.({ color: "", label: "\u79FB\u9664\u80CC\u666F", mode });
@@ -5708,8 +6251,8 @@ function useColorHighlight(config) {
5708
6251
  mode
5709
6252
  };
5710
6253
  }
5711
- var ColorHighlightPopoverButton = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5712
- Button6,
6254
+ var ColorHighlightPopoverButton = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
6255
+ Button7,
5713
6256
  {
5714
6257
  type: "button",
5715
6258
  className,
@@ -5737,8 +6280,8 @@ function ColorHighlightPopoverContent({
5737
6280
  }) {
5738
6281
  const { handleRemoveHighlight } = useColorHighlight({ editor });
5739
6282
  const isMobile = useIsBreakpoint();
5740
- const containerRef = React.useRef(null);
5741
- const menuItems = React.useMemo(
6283
+ const containerRef = React3.useRef(null);
6284
+ const menuItems = React3.useMemo(
5742
6285
  () => [...colors, { label: "\u79FB\u9664\u9AD8\u4EAE", value: "none" }],
5743
6286
  [colors]
5744
6287
  );
@@ -5778,7 +6321,7 @@ function ColorHighlightPopoverContent({
5778
6321
  )) }),
5779
6322
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
5780
6323
  /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { orientation: "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(
5781
- Button6,
6324
+ Button7,
5782
6325
  {
5783
6326
  onClick: handleRemoveHighlight,
5784
6327
  "aria-label": "\u79FB\u9664\u80CC\u666F",
@@ -5809,7 +6352,7 @@ function ColorHighlightPopover({
5809
6352
  ...props
5810
6353
  }) {
5811
6354
  const { editor } = useTiptapEditor(providedEditor);
5812
- const [isOpen, setIsOpen] = React.useState(false);
6355
+ const [isOpen, setIsOpen] = React3.useState(false);
5813
6356
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
5814
6357
  editor,
5815
6358
  hideWhenUnavailable,
@@ -5833,7 +6376,7 @@ function ColorHighlightPopover({
5833
6376
  /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "aria-label": "\u80CC\u666F\u8272", children: /* @__PURE__ */ jsxRuntime.jsx(ColorHighlightPopoverContent, { editor, colors }) })
5834
6377
  ] });
5835
6378
  }
5836
- var ChevronDownIcon = React.memo(({ className, ...props }) => {
6379
+ var ChevronDownIcon = React3.memo(({ className, ...props }) => {
5837
6380
  return /* @__PURE__ */ jsxRuntime.jsx(
5838
6381
  "svg",
5839
6382
  {
@@ -5863,7 +6406,7 @@ function HeadingShortcutBadge({
5863
6406
  }) {
5864
6407
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5865
6408
  }
5866
- var HeadingButton = React.forwardRef(
6409
+ var HeadingButton = React3.forwardRef(
5867
6410
  ({
5868
6411
  editor: providedEditor,
5869
6412
  level,
@@ -5890,7 +6433,7 @@ var HeadingButton = React.forwardRef(
5890
6433
  hideWhenUnavailable,
5891
6434
  onToggled
5892
6435
  });
5893
- const handleClick = React.useCallback(
6436
+ const handleClick = React3.useCallback(
5894
6437
  (event) => {
5895
6438
  onClick?.(event);
5896
6439
  if (event.defaultPrevented) return;
@@ -5902,7 +6445,7 @@ var HeadingButton = React.forwardRef(
5902
6445
  return null;
5903
6446
  }
5904
6447
  return /* @__PURE__ */ jsxRuntime.jsx(
5905
- Button6,
6448
+ Button7,
5906
6449
  {
5907
6450
  type: "button",
5908
6451
  "data-style": "ghost",
@@ -5927,7 +6470,7 @@ var HeadingButton = React.forwardRef(
5927
6470
  }
5928
6471
  );
5929
6472
  HeadingButton.displayName = "HeadingButton";
5930
- var HeadingOneIcon = React.memo(({ className, ...props }) => {
6473
+ var HeadingOneIcon = React3.memo(({ className, ...props }) => {
5931
6474
  return /* @__PURE__ */ jsxRuntime.jsxs(
5932
6475
  "svg",
5933
6476
  {
@@ -5958,7 +6501,7 @@ var HeadingOneIcon = React.memo(({ className, ...props }) => {
5958
6501
  );
5959
6502
  });
5960
6503
  HeadingOneIcon.displayName = "HeadingOneIcon";
5961
- var HeadingTwoIcon = React.memo(({ className, ...props }) => {
6504
+ var HeadingTwoIcon = React3.memo(({ className, ...props }) => {
5962
6505
  return /* @__PURE__ */ jsxRuntime.jsxs(
5963
6506
  "svg",
5964
6507
  {
@@ -5989,7 +6532,7 @@ var HeadingTwoIcon = React.memo(({ className, ...props }) => {
5989
6532
  );
5990
6533
  });
5991
6534
  HeadingTwoIcon.displayName = "HeadingTwoIcon";
5992
- var HeadingThreeIcon = React.memo(({ className, ...props }) => {
6535
+ var HeadingThreeIcon = React3.memo(({ className, ...props }) => {
5993
6536
  return /* @__PURE__ */ jsxRuntime.jsxs(
5994
6537
  "svg",
5995
6538
  {
@@ -6031,7 +6574,7 @@ var HeadingThreeIcon = React.memo(({ className, ...props }) => {
6031
6574
  );
6032
6575
  });
6033
6576
  HeadingThreeIcon.displayName = "HeadingThreeIcon";
6034
- var HeadingFourIcon = React.memo(({ className, ...props }) => {
6577
+ var HeadingFourIcon = React3.memo(({ className, ...props }) => {
6035
6578
  return /* @__PURE__ */ jsxRuntime.jsxs(
6036
6579
  "svg",
6037
6580
  {
@@ -6062,7 +6605,7 @@ var HeadingFourIcon = React.memo(({ className, ...props }) => {
6062
6605
  );
6063
6606
  });
6064
6607
  HeadingFourIcon.displayName = "HeadingFourIcon";
6065
- var HeadingFiveIcon = React.memo(({ className, ...props }) => {
6608
+ var HeadingFiveIcon = React3.memo(({ className, ...props }) => {
6066
6609
  return /* @__PURE__ */ jsxRuntime.jsxs(
6067
6610
  "svg",
6068
6611
  {
@@ -6093,7 +6636,7 @@ var HeadingFiveIcon = React.memo(({ className, ...props }) => {
6093
6636
  );
6094
6637
  });
6095
6638
  HeadingFiveIcon.displayName = "HeadingFiveIcon";
6096
- var HeadingSixIcon = React.memo(({ className, ...props }) => {
6639
+ var HeadingSixIcon = React3.memo(({ className, ...props }) => {
6097
6640
  return /* @__PURE__ */ jsxRuntime.jsxs(
6098
6641
  "svg",
6099
6642
  {
@@ -6231,10 +6774,10 @@ function useHeading(config) {
6231
6774
  onToggled
6232
6775
  } = config;
6233
6776
  const { editor } = useTiptapEditor(providedEditor);
6234
- const [isVisible, setIsVisible] = React.useState(true);
6777
+ const [isVisible, setIsVisible] = React3.useState(true);
6235
6778
  const canToggleState = canToggle2(editor, level);
6236
6779
  const isActive = isHeadingActive(editor, level);
6237
- React.useEffect(() => {
6780
+ React3.useEffect(() => {
6238
6781
  if (!editor) return;
6239
6782
  const handleSelectionUpdate = () => {
6240
6783
  setIsVisible(shouldShowButton4({ editor, level, hideWhenUnavailable }));
@@ -6245,7 +6788,7 @@ function useHeading(config) {
6245
6788
  editor.off("selectionUpdate", handleSelectionUpdate);
6246
6789
  };
6247
6790
  }, [editor, level, hideWhenUnavailable]);
6248
- const handleToggle = React.useCallback(() => {
6791
+ const handleToggle = React3.useCallback(() => {
6249
6792
  if (!editor) return false;
6250
6793
  const success = toggleHeading(editor, level);
6251
6794
  if (success) {
@@ -6273,10 +6816,10 @@ function DropdownMenuPortal({
6273
6816
  }) {
6274
6817
  return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { ...props });
6275
6818
  }
6276
- var DropdownMenuTrigger = React.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { ref, ...props }));
6819
+ var DropdownMenuTrigger = React3.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { ref, ...props }));
6277
6820
  DropdownMenuTrigger.displayName = DropdownMenuPrimitive__namespace.Trigger.displayName;
6278
6821
  var DropdownMenuItem = DropdownMenuPrimitive__namespace.Item;
6279
- var DropdownMenuSubContent = React.forwardRef(({ className, portal = true, ...props }, ref) => {
6822
+ var DropdownMenuSubContent = React3.forwardRef(({ className, portal = true, ...props }, ref) => {
6280
6823
  const content = /* @__PURE__ */ jsxRuntime.jsx(
6281
6824
  DropdownMenuPrimitive__namespace.SubContent,
6282
6825
  {
@@ -6288,7 +6831,7 @@ var DropdownMenuSubContent = React.forwardRef(({ className, portal = true, ...pr
6288
6831
  return portal ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPortal, { ...typeof portal === "object" ? portal : {}, children: content }) : content;
6289
6832
  });
6290
6833
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
6291
- var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
6834
+ var DropdownMenuContent = React3.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
6292
6835
  const content = /* @__PURE__ */ jsxRuntime.jsx(
6293
6836
  DropdownMenuPrimitive__namespace.Content,
6294
6837
  {
@@ -6302,7 +6845,7 @@ var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, portal
6302
6845
  return portal ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPortal, { ...typeof portal === "object" ? portal : {}, children: content }) : content;
6303
6846
  });
6304
6847
  DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
6305
- var HeadingDropdownMenu = React.forwardRef(
6848
+ var HeadingDropdownMenu = React3.forwardRef(
6306
6849
  ({
6307
6850
  editor: providedEditor,
6308
6851
  levels = [1, 2, 3, 4, 5, 6],
@@ -6312,13 +6855,13 @@ var HeadingDropdownMenu = React.forwardRef(
6312
6855
  ...buttonProps
6313
6856
  }, ref) => {
6314
6857
  const { editor } = useTiptapEditor(providedEditor);
6315
- const [isOpen, setIsOpen] = React.useState(false);
6858
+ const [isOpen, setIsOpen] = React3.useState(false);
6316
6859
  const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
6317
6860
  editor,
6318
6861
  levels,
6319
6862
  hideWhenUnavailable
6320
6863
  });
6321
- const handleOpenChange = React.useCallback(
6864
+ const handleOpenChange = React3.useCallback(
6322
6865
  (open) => {
6323
6866
  if (!editor || !canToggle3) return;
6324
6867
  setIsOpen(open);
@@ -6331,7 +6874,7 @@ var HeadingDropdownMenu = React.forwardRef(
6331
6874
  }
6332
6875
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: true, open: isOpen, onOpenChange: handleOpenChange, children: [
6333
6876
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6334
- Button6,
6877
+ Button7,
6335
6878
  {
6336
6879
  type: "button",
6337
6880
  "data-style": "ghost",
@@ -6364,7 +6907,7 @@ var HeadingDropdownMenu = React.forwardRef(
6364
6907
  }
6365
6908
  );
6366
6909
  HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
6367
- var HeadingIcon = React.memo(({ className, ...props }) => {
6910
+ var HeadingIcon = React3.memo(({ className, ...props }) => {
6368
6911
  return /* @__PURE__ */ jsxRuntime.jsx(
6369
6912
  "svg",
6370
6913
  {
@@ -6399,11 +6942,11 @@ function useHeadingDropdownMenu(config) {
6399
6942
  hideWhenUnavailable = false
6400
6943
  } = config || {};
6401
6944
  const { editor } = useTiptapEditor(providedEditor);
6402
- const [isVisible, setIsVisible] = React.useState(true);
6945
+ const [isVisible, setIsVisible] = React3.useState(true);
6403
6946
  const activeLevel = getActiveHeadingLevel(editor, levels);
6404
6947
  const isActive = isHeadingActive(editor);
6405
6948
  const canToggleState = canToggle2(editor);
6406
- React.useEffect(() => {
6949
+ React3.useEffect(() => {
6407
6950
  if (!editor) return;
6408
6951
  const handleSelectionUpdate = () => {
6409
6952
  setIsVisible(
@@ -6426,7 +6969,7 @@ function useHeadingDropdownMenu(config) {
6426
6969
  Icon: activeLevel ? headingIcons[activeLevel] : HeadingIcon
6427
6970
  };
6428
6971
  }
6429
- var CornerDownLeftIcon = React.memo(({ className, ...props }) => {
6972
+ var CornerDownLeftIcon = React3.memo(({ className, ...props }) => {
6430
6973
  return /* @__PURE__ */ jsxRuntime.jsx(
6431
6974
  "svg",
6432
6975
  {
@@ -6450,7 +6993,7 @@ var CornerDownLeftIcon = React.memo(({ className, ...props }) => {
6450
6993
  );
6451
6994
  });
6452
6995
  CornerDownLeftIcon.displayName = "CornerDownLeftIcon";
6453
- var ExternalLinkIcon = React.memo(({ className, ...props }) => {
6996
+ var ExternalLinkIcon = React3.memo(({ className, ...props }) => {
6454
6997
  return /* @__PURE__ */ jsxRuntime.jsxs(
6455
6998
  "svg",
6456
6999
  {
@@ -6481,7 +7024,7 @@ var ExternalLinkIcon = React.memo(({ className, ...props }) => {
6481
7024
  );
6482
7025
  });
6483
7026
  ExternalLinkIcon.displayName = "ExternalLinkIcon";
6484
- var LinkIcon = React.memo(({ className, ...props }) => {
7027
+ var LinkIcon = React3.memo(({ className, ...props }) => {
6485
7028
  return /* @__PURE__ */ jsxRuntime.jsxs(
6486
7029
  "svg",
6487
7030
  {
@@ -6512,7 +7055,7 @@ var LinkIcon = React.memo(({ className, ...props }) => {
6512
7055
  );
6513
7056
  });
6514
7057
  LinkIcon.displayName = "LinkIcon";
6515
- var TrashIcon = React.memo(({ className, ...props }) => {
7058
+ var TrashIcon = React3.memo(({ className, ...props }) => {
6516
7059
  return /* @__PURE__ */ jsxRuntime.jsx(
6517
7060
  "svg",
6518
7061
  {
@@ -6546,10 +7089,10 @@ function InputGroup({
6546
7089
  }) {
6547
7090
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("tiptap-input-group", className), ...props, children });
6548
7091
  }
6549
- var LinkButton = React.forwardRef(
7092
+ var LinkButton = React3.forwardRef(
6550
7093
  ({ className, children, ...props }, ref) => {
6551
7094
  return /* @__PURE__ */ jsxRuntime.jsx(
6552
- Button6,
7095
+ Button7,
6553
7096
  {
6554
7097
  type: "button",
6555
7098
  className,
@@ -6609,7 +7152,7 @@ var LinkMain = ({
6609
7152
  }
6610
7153
  ) }),
6611
7154
  /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { orientation: "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(
6612
- Button6,
7155
+ Button7,
6613
7156
  {
6614
7157
  type: "button",
6615
7158
  onClick: setLink,
@@ -6622,7 +7165,7 @@ var LinkMain = ({
6622
7165
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
6623
7166
  /* @__PURE__ */ jsxRuntime.jsxs(ButtonGroup, { orientation: "horizontal", children: [
6624
7167
  /* @__PURE__ */ jsxRuntime.jsx(
6625
- Button6,
7168
+ Button7,
6626
7169
  {
6627
7170
  type: "button",
6628
7171
  onClick: openLink,
@@ -6633,7 +7176,7 @@ var LinkMain = ({
6633
7176
  }
6634
7177
  ),
6635
7178
  /* @__PURE__ */ jsxRuntime.jsx(
6636
- Button6,
7179
+ Button7,
6637
7180
  {
6638
7181
  type: "button",
6639
7182
  onClick: removeLink,
@@ -6656,7 +7199,7 @@ var LinkContent = ({ editor }) => {
6656
7199
  });
6657
7200
  return /* @__PURE__ */ jsxRuntime.jsx(LinkMain, { ...linkPopover });
6658
7201
  };
6659
- var LinkPopover = React.forwardRef(
7202
+ var LinkPopover = React3.forwardRef(
6660
7203
  ({
6661
7204
  editor: providedEditor,
6662
7205
  hideWhenUnavailable = false,
@@ -6668,7 +7211,7 @@ var LinkPopover = React.forwardRef(
6668
7211
  ...buttonProps
6669
7212
  }, ref) => {
6670
7213
  const { editor } = useTiptapEditor(providedEditor);
6671
- const [isOpen, setIsOpen] = React.useState(false);
7214
+ const [isOpen, setIsOpen] = React3.useState(false);
6672
7215
  const {
6673
7216
  isVisible,
6674
7217
  canSet,
@@ -6685,18 +7228,18 @@ var LinkPopover = React.forwardRef(
6685
7228
  hideWhenUnavailable,
6686
7229
  onSetLink
6687
7230
  });
6688
- const handleOnOpenChange = React.useCallback(
7231
+ const handleOnOpenChange = React3.useCallback(
6689
7232
  (nextIsOpen) => {
6690
7233
  setIsOpen(nextIsOpen);
6691
7234
  onOpenChange?.(nextIsOpen);
6692
7235
  },
6693
7236
  [onOpenChange]
6694
7237
  );
6695
- const handleSetLink = React.useCallback(() => {
7238
+ const handleSetLink = React3.useCallback(() => {
6696
7239
  setLink();
6697
7240
  setIsOpen(false);
6698
7241
  }, [setLink]);
6699
- const handleClick = React.useCallback(
7242
+ const handleClick = React3.useCallback(
6700
7243
  (event) => {
6701
7244
  onClick?.(event);
6702
7245
  if (event.defaultPrevented) return;
@@ -6704,7 +7247,7 @@ var LinkPopover = React.forwardRef(
6704
7247
  },
6705
7248
  [onClick, isOpen]
6706
7249
  );
6707
- React.useEffect(() => {
7250
+ React3.useEffect(() => {
6708
7251
  if (autoOpenOnLinkActive && isActive) {
6709
7252
  setIsOpen(true);
6710
7253
  }
@@ -6764,15 +7307,15 @@ function shouldShowLinkButton(props) {
6764
7307
  }
6765
7308
  function useLinkHandler(props) {
6766
7309
  const { editor, onSetLink } = props;
6767
- const [url, setUrl] = React.useState(null);
6768
- React.useEffect(() => {
7310
+ const [url, setUrl] = React3.useState(null);
7311
+ React3.useEffect(() => {
6769
7312
  if (!editor) return;
6770
7313
  const { href } = editor.getAttributes("link");
6771
7314
  if (isLinkActive(editor) && url === null) {
6772
7315
  setUrl(href || "");
6773
7316
  }
6774
7317
  }, [editor, url]);
6775
- React.useEffect(() => {
7318
+ React3.useEffect(() => {
6776
7319
  if (!editor) return;
6777
7320
  const updateLinkState = () => {
6778
7321
  const { href } = editor.getAttributes("link");
@@ -6783,7 +7326,7 @@ function useLinkHandler(props) {
6783
7326
  editor.off("selectionUpdate", updateLinkState);
6784
7327
  };
6785
7328
  }, [editor]);
6786
- const setLink = React.useCallback(() => {
7329
+ const setLink = React3.useCallback(() => {
6787
7330
  if (!url || !editor) return;
6788
7331
  const { selection } = editor.state;
6789
7332
  const isEmpty2 = selection.empty;
@@ -6796,12 +7339,12 @@ function useLinkHandler(props) {
6796
7339
  setUrl(null);
6797
7340
  onSetLink?.();
6798
7341
  }, [editor, onSetLink, url]);
6799
- const removeLink = React.useCallback(() => {
7342
+ const removeLink = React3.useCallback(() => {
6800
7343
  if (!editor) return;
6801
7344
  editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
6802
7345
  setUrl("");
6803
7346
  }, [editor]);
6804
- const openLink = React.useCallback(
7347
+ const openLink = React3.useCallback(
6805
7348
  (target = "_blank", features = "noopener,noreferrer") => {
6806
7349
  if (!url) return;
6807
7350
  const safeUrl = sanitizeUrl(url, window.location.href);
@@ -6823,8 +7366,8 @@ function useLinkState(props) {
6823
7366
  const { editor, hideWhenUnavailable = false } = props;
6824
7367
  const canSet = canSetLink(editor);
6825
7368
  const isActive = isLinkActive(editor);
6826
- const [isVisible, setIsVisible] = React.useState(true);
6827
- React.useEffect(() => {
7369
+ const [isVisible, setIsVisible] = React3.useState(true);
7370
+ React3.useEffect(() => {
6828
7371
  if (!editor) return;
6829
7372
  const handleSelectionUpdate = () => {
6830
7373
  setIsVisible(
@@ -6876,7 +7419,7 @@ function ListShortcutBadge({
6876
7419
  }) {
6877
7420
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
6878
7421
  }
6879
- var ListButton = React.forwardRef(
7422
+ var ListButton = React3.forwardRef(
6880
7423
  ({
6881
7424
  editor: providedEditor,
6882
7425
  type,
@@ -6903,7 +7446,7 @@ var ListButton = React.forwardRef(
6903
7446
  hideWhenUnavailable,
6904
7447
  onToggled
6905
7448
  });
6906
- const handleClick = React.useCallback(
7449
+ const handleClick = React3.useCallback(
6907
7450
  (event) => {
6908
7451
  onClick?.(event);
6909
7452
  if (event.defaultPrevented) return;
@@ -6915,7 +7458,7 @@ var ListButton = React.forwardRef(
6915
7458
  return null;
6916
7459
  }
6917
7460
  return /* @__PURE__ */ jsxRuntime.jsx(
6918
- Button6,
7461
+ Button7,
6919
7462
  {
6920
7463
  type: "button",
6921
7464
  "data-style": "ghost",
@@ -6940,7 +7483,7 @@ var ListButton = React.forwardRef(
6940
7483
  }
6941
7484
  );
6942
7485
  ListButton.displayName = "ListButton";
6943
- var ListIcon = React.memo(({ className, ...props }) => {
7486
+ var ListIcon = React3.memo(({ className, ...props }) => {
6944
7487
  return /* @__PURE__ */ jsxRuntime.jsxs(
6945
7488
  "svg",
6946
7489
  {
@@ -7011,7 +7554,7 @@ var ListIcon = React.memo(({ className, ...props }) => {
7011
7554
  );
7012
7555
  });
7013
7556
  ListIcon.displayName = "ListIcon";
7014
- var ListOrderedIcon = React.memo(({ className, ...props }) => {
7557
+ var ListOrderedIcon = React3.memo(({ className, ...props }) => {
7015
7558
  return /* @__PURE__ */ jsxRuntime.jsxs(
7016
7559
  "svg",
7017
7560
  {
@@ -7082,7 +7625,7 @@ var ListOrderedIcon = React.memo(({ className, ...props }) => {
7082
7625
  );
7083
7626
  });
7084
7627
  ListOrderedIcon.displayName = "ListOrderedIcon";
7085
- var ListTodoIcon = React.memo(({ className, ...props }) => {
7628
+ var ListTodoIcon = React3.memo(({ className, ...props }) => {
7086
7629
  return /* @__PURE__ */ jsxRuntime.jsxs(
7087
7630
  "svg",
7088
7631
  {
@@ -7274,10 +7817,10 @@ function useList(config) {
7274
7817
  onToggled
7275
7818
  } = config;
7276
7819
  const { editor } = useTiptapEditor(providedEditor);
7277
- const [isVisible, setIsVisible] = React.useState(true);
7820
+ const [isVisible, setIsVisible] = React3.useState(true);
7278
7821
  const canToggle3 = canToggleList(editor, type);
7279
7822
  const isActive = isListActive(editor, type);
7280
- React.useEffect(() => {
7823
+ React3.useEffect(() => {
7281
7824
  if (!editor) return;
7282
7825
  const handleSelectionUpdate = () => {
7283
7826
  setIsVisible(shouldShowButton5({ editor, type, hideWhenUnavailable }));
@@ -7288,7 +7831,7 @@ function useList(config) {
7288
7831
  editor.off("selectionUpdate", handleSelectionUpdate);
7289
7832
  };
7290
7833
  }, [editor, type, hideWhenUnavailable]);
7291
- const handleToggle = React.useCallback(() => {
7834
+ const handleToggle = React3.useCallback(() => {
7292
7835
  if (!editor) return false;
7293
7836
  const success = toggleList(editor, type);
7294
7837
  if (success) {
@@ -7357,14 +7900,14 @@ function useListDropdownMenu(config) {
7357
7900
  hideWhenUnavailable = false
7358
7901
  } = config || {};
7359
7902
  const { editor } = useTiptapEditor(providedEditor);
7360
- const [isVisible, setIsVisible] = React.useState(true);
7903
+ const [isVisible, setIsVisible] = React3.useState(true);
7361
7904
  const listInSchema = types.some((type) => isNodeInSchema(type, editor));
7362
- const filteredLists = React.useMemo(() => getFilteredListOptions(types), [types]);
7905
+ const filteredLists = React3.useMemo(() => getFilteredListOptions(types), [types]);
7363
7906
  const canToggleAny = canToggleAnyList(editor, types);
7364
7907
  const isAnyActive = isAnyListActive(editor, types);
7365
7908
  const activeType = getActiveListType(editor, types);
7366
7909
  const activeList = filteredLists.find((option) => option.type === activeType);
7367
- React.useEffect(() => {
7910
+ React3.useEffect(() => {
7368
7911
  if (!editor) return;
7369
7912
  const handleSelectionUpdate = () => {
7370
7913
  setIsVisible(
@@ -7402,13 +7945,13 @@ function ListDropdownMenu({
7402
7945
  ...props
7403
7946
  }) {
7404
7947
  const { editor } = useTiptapEditor(providedEditor);
7405
- const [isOpen, setIsOpen] = React.useState(false);
7948
+ const [isOpen, setIsOpen] = React3.useState(false);
7406
7949
  const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
7407
7950
  editor,
7408
7951
  types,
7409
7952
  hideWhenUnavailable
7410
7953
  });
7411
- const handleOnOpenChange = React.useCallback(
7954
+ const handleOnOpenChange = React3.useCallback(
7412
7955
  (open) => {
7413
7956
  setIsOpen(open);
7414
7957
  onOpenChange?.(open);
@@ -7420,7 +7963,7 @@ function ListDropdownMenu({
7420
7963
  }
7421
7964
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
7422
7965
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7423
- Button6,
7966
+ Button7,
7424
7967
  {
7425
7968
  type: "button",
7426
7969
  "data-style": "ghost",
@@ -7455,7 +7998,7 @@ function MarkShortcutBadge({
7455
7998
  }) {
7456
7999
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
7457
8000
  }
7458
- var MarkButton = React.forwardRef(
8001
+ var MarkButton = React3.forwardRef(
7459
8002
  ({
7460
8003
  editor: providedEditor,
7461
8004
  type,
@@ -7482,7 +8025,7 @@ var MarkButton = React.forwardRef(
7482
8025
  hideWhenUnavailable,
7483
8026
  onToggled
7484
8027
  });
7485
- const handleClick = React.useCallback(
8028
+ const handleClick = React3.useCallback(
7486
8029
  (event) => {
7487
8030
  onClick?.(event);
7488
8031
  if (event.defaultPrevented) return;
@@ -7494,7 +8037,7 @@ var MarkButton = React.forwardRef(
7494
8037
  return null;
7495
8038
  }
7496
8039
  return /* @__PURE__ */ jsxRuntime.jsx(
7497
- Button6,
8040
+ Button7,
7498
8041
  {
7499
8042
  type: "button",
7500
8043
  disabled: !canToggle3,
@@ -7519,7 +8062,7 @@ var MarkButton = React.forwardRef(
7519
8062
  }
7520
8063
  );
7521
8064
  MarkButton.displayName = "MarkButton";
7522
- var BoldIcon = React.memo(({ className, ...props }) => {
8065
+ var BoldIcon = React3.memo(({ className, ...props }) => {
7523
8066
  return /* @__PURE__ */ jsxRuntime.jsx(
7524
8067
  "svg",
7525
8068
  {
@@ -7543,7 +8086,7 @@ var BoldIcon = React.memo(({ className, ...props }) => {
7543
8086
  );
7544
8087
  });
7545
8088
  BoldIcon.displayName = "BoldIcon";
7546
- var Code2Icon = React.memo(({ className, ...props }) => {
8089
+ var Code2Icon = React3.memo(({ className, ...props }) => {
7547
8090
  return /* @__PURE__ */ jsxRuntime.jsxs(
7548
8091
  "svg",
7549
8092
  {
@@ -7581,7 +8124,7 @@ var Code2Icon = React.memo(({ className, ...props }) => {
7581
8124
  );
7582
8125
  });
7583
8126
  Code2Icon.displayName = "Code2Icon";
7584
- var ItalicIcon = React.memo(({ className, ...props }) => {
8127
+ var ItalicIcon = React3.memo(({ className, ...props }) => {
7585
8128
  return /* @__PURE__ */ jsxRuntime.jsx(
7586
8129
  "svg",
7587
8130
  {
@@ -7603,7 +8146,7 @@ var ItalicIcon = React.memo(({ className, ...props }) => {
7603
8146
  );
7604
8147
  });
7605
8148
  ItalicIcon.displayName = "ItalicIcon";
7606
- var StrikeIcon = React.memo(({ className, ...props }) => {
8149
+ var StrikeIcon = React3.memo(({ className, ...props }) => {
7607
8150
  return /* @__PURE__ */ jsxRuntime.jsxs(
7608
8151
  "svg",
7609
8152
  {
@@ -7634,7 +8177,7 @@ var StrikeIcon = React.memo(({ className, ...props }) => {
7634
8177
  );
7635
8178
  });
7636
8179
  StrikeIcon.displayName = "StrikeIcon";
7637
- var SubscriptIcon = React.memo(({ className, ...props }) => {
8180
+ var SubscriptIcon = React3.memo(({ className, ...props }) => {
7638
8181
  return /* @__PURE__ */ jsxRuntime.jsxs(
7639
8182
  "svg",
7640
8183
  {
@@ -7678,7 +8221,7 @@ var SubscriptIcon = React.memo(({ className, ...props }) => {
7678
8221
  );
7679
8222
  });
7680
8223
  SubscriptIcon.displayName = "SubscriptIcon";
7681
- var SuperscriptIcon = React.memo(({ className, ...props }) => {
8224
+ var SuperscriptIcon = React3.memo(({ className, ...props }) => {
7682
8225
  return /* @__PURE__ */ jsxRuntime.jsxs(
7683
8226
  "svg",
7684
8227
  {
@@ -7722,7 +8265,7 @@ var SuperscriptIcon = React.memo(({ className, ...props }) => {
7722
8265
  );
7723
8266
  });
7724
8267
  SuperscriptIcon.displayName = "SuperscriptIcon";
7725
- var UnderlineIcon = React.memo(({ className, ...props }) => {
8268
+ var UnderlineIcon = React3.memo(({ className, ...props }) => {
7726
8269
  return /* @__PURE__ */ jsxRuntime.jsx(
7727
8270
  "svg",
7728
8271
  {
@@ -7810,10 +8353,10 @@ function useMark(config) {
7810
8353
  onToggled
7811
8354
  } = config;
7812
8355
  const { editor } = useTiptapEditor(providedEditor);
7813
- const [isVisible, setIsVisible] = React.useState(true);
8356
+ const [isVisible, setIsVisible] = React3.useState(true);
7814
8357
  const canToggle3 = canToggleMark(editor, type);
7815
8358
  const isActive = isMarkActive(editor, type);
7816
- React.useEffect(() => {
8359
+ React3.useEffect(() => {
7817
8360
  if (!editor) return;
7818
8361
  const handleSelectionUpdate = () => {
7819
8362
  setIsVisible(shouldShowButton6({ editor, type, hideWhenUnavailable }));
@@ -7824,7 +8367,7 @@ function useMark(config) {
7824
8367
  editor.off("selectionUpdate", handleSelectionUpdate);
7825
8368
  };
7826
8369
  }, [editor, type, hideWhenUnavailable]);
7827
- const handleMark = React.useCallback(() => {
8370
+ const handleMark = React3.useCallback(() => {
7828
8371
  if (!editor) return false;
7829
8372
  const success = toggleMark(editor, type);
7830
8373
  if (success) {
@@ -7848,7 +8391,7 @@ function TextAlignShortcutBadge({
7848
8391
  }) {
7849
8392
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
7850
8393
  }
7851
- var TextAlignButton = React.forwardRef(
8394
+ var TextAlignButton = React3.forwardRef(
7852
8395
  ({
7853
8396
  editor: providedEditor,
7854
8397
  align,
@@ -7876,7 +8419,7 @@ var TextAlignButton = React.forwardRef(
7876
8419
  hideWhenUnavailable,
7877
8420
  onAligned
7878
8421
  });
7879
- const handleClick = React.useCallback(
8422
+ const handleClick = React3.useCallback(
7880
8423
  (event) => {
7881
8424
  onClick?.(event);
7882
8425
  if (event.defaultPrevented) return;
@@ -7889,7 +8432,7 @@ var TextAlignButton = React.forwardRef(
7889
8432
  }
7890
8433
  const RenderIcon = CustomIcon ?? Icon;
7891
8434
  return /* @__PURE__ */ jsxRuntime.jsx(
7892
- Button6,
8435
+ Button7,
7893
8436
  {
7894
8437
  type: "button",
7895
8438
  disabled: !canAlign,
@@ -7920,7 +8463,7 @@ var TextAlignButton = React.forwardRef(
7920
8463
  }
7921
8464
  );
7922
8465
  TextAlignButton.displayName = "TextAlignButton";
7923
- var AlignCenterIcon = React.memo(({ className, ...props }) => {
8466
+ var AlignCenterIcon = React3.memo(({ className, ...props }) => {
7924
8467
  return /* @__PURE__ */ jsxRuntime.jsxs(
7925
8468
  "svg",
7926
8469
  {
@@ -7964,7 +8507,7 @@ var AlignCenterIcon = React.memo(({ className, ...props }) => {
7964
8507
  );
7965
8508
  });
7966
8509
  AlignCenterIcon.displayName = "AlignCenterIcon";
7967
- var AlignJustifyIcon = React.memo(({ className, ...props }) => {
8510
+ var AlignJustifyIcon = React3.memo(({ className, ...props }) => {
7968
8511
  return /* @__PURE__ */ jsxRuntime.jsxs(
7969
8512
  "svg",
7970
8513
  {
@@ -8008,7 +8551,7 @@ var AlignJustifyIcon = React.memo(({ className, ...props }) => {
8008
8551
  );
8009
8552
  });
8010
8553
  AlignJustifyIcon.displayName = "AlignJustifyIcon";
8011
- var AlignLeftIcon = React.memo(({ className, ...props }) => {
8554
+ var AlignLeftIcon = React3.memo(({ className, ...props }) => {
8012
8555
  return /* @__PURE__ */ jsxRuntime.jsxs(
8013
8556
  "svg",
8014
8557
  {
@@ -8052,7 +8595,7 @@ var AlignLeftIcon = React.memo(({ className, ...props }) => {
8052
8595
  );
8053
8596
  });
8054
8597
  AlignLeftIcon.displayName = "AlignLeftIcon";
8055
- var AlignRightIcon = React.memo(({ className, ...props }) => {
8598
+ var AlignRightIcon = React3.memo(({ className, ...props }) => {
8056
8599
  return /* @__PURE__ */ jsxRuntime.jsxs(
8057
8600
  "svg",
8058
8601
  {
@@ -8155,10 +8698,10 @@ function useTextAlign(config) {
8155
8698
  onAligned
8156
8699
  } = config;
8157
8700
  const { editor } = useTiptapEditor(providedEditor);
8158
- const [isVisible, setIsVisible] = React.useState(true);
8701
+ const [isVisible, setIsVisible] = React3.useState(true);
8159
8702
  const canAlign = canSetTextAlign(editor, align);
8160
8703
  const isActive = isTextAlignActive(editor, align);
8161
- React.useEffect(() => {
8704
+ React3.useEffect(() => {
8162
8705
  if (!editor) return;
8163
8706
  const handleSelectionUpdate = () => {
8164
8707
  setIsVisible(shouldShowButton7({ editor, align, hideWhenUnavailable }));
@@ -8169,7 +8712,7 @@ function useTextAlign(config) {
8169
8712
  editor.off("selectionUpdate", handleSelectionUpdate);
8170
8713
  };
8171
8714
  }, [editor, hideWhenUnavailable, align]);
8172
- const handleTextAlign = React.useCallback(() => {
8715
+ const handleTextAlign = React3.useCallback(() => {
8173
8716
  if (!editor) return false;
8174
8717
  const success = setTextAlign(editor, align);
8175
8718
  if (success) {
@@ -8193,7 +8736,7 @@ function HistoryShortcutBadge({
8193
8736
  }) {
8194
8737
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
8195
8738
  }
8196
- var UndoRedoButton = React.forwardRef(
8739
+ var UndoRedoButton = React3.forwardRef(
8197
8740
  ({
8198
8741
  editor: providedEditor,
8199
8742
  action,
@@ -8212,7 +8755,7 @@ var UndoRedoButton = React.forwardRef(
8212
8755
  hideWhenUnavailable,
8213
8756
  onExecuted
8214
8757
  });
8215
- const handleClick = React.useCallback(
8758
+ const handleClick = React3.useCallback(
8216
8759
  (event) => {
8217
8760
  onClick?.(event);
8218
8761
  if (event.defaultPrevented) return;
@@ -8224,7 +8767,7 @@ var UndoRedoButton = React.forwardRef(
8224
8767
  return null;
8225
8768
  }
8226
8769
  return /* @__PURE__ */ jsxRuntime.jsx(
8227
- Button6,
8770
+ Button7,
8228
8771
  {
8229
8772
  type: "button",
8230
8773
  disabled: !canExecute,
@@ -8253,7 +8796,7 @@ var UndoRedoButton = React.forwardRef(
8253
8796
  }
8254
8797
  );
8255
8798
  UndoRedoButton.displayName = "UndoRedoButton";
8256
- var Redo2Icon = React.memo(({ className, ...props }) => {
8799
+ var Redo2Icon = React3.memo(({ className, ...props }) => {
8257
8800
  return /* @__PURE__ */ jsxRuntime.jsx(
8258
8801
  "svg",
8259
8802
  {
@@ -8277,7 +8820,7 @@ var Redo2Icon = React.memo(({ className, ...props }) => {
8277
8820
  );
8278
8821
  });
8279
8822
  Redo2Icon.displayName = "Redo2Icon";
8280
- var Undo2Icon = React.memo(({ className, ...props }) => {
8823
+ var Undo2Icon = React3.memo(({ className, ...props }) => {
8281
8824
  return /* @__PURE__ */ jsxRuntime.jsx(
8282
8825
  "svg",
8283
8826
  {
@@ -8342,9 +8885,9 @@ function useUndoRedo(config) {
8342
8885
  onExecuted
8343
8886
  } = config;
8344
8887
  const { editor } = useTiptapEditor(providedEditor);
8345
- const [isVisible, setIsVisible] = React.useState(true);
8888
+ const [isVisible, setIsVisible] = React3.useState(true);
8346
8889
  const canExecute = canExecuteUndoRedoAction(editor, action);
8347
- React.useEffect(() => {
8890
+ React3.useEffect(() => {
8348
8891
  if (!editor) return;
8349
8892
  const handleUpdate = () => {
8350
8893
  setIsVisible(shouldShowButton8({ editor, hideWhenUnavailable, action }));
@@ -8355,7 +8898,7 @@ function useUndoRedo(config) {
8355
8898
  editor.off("transaction", handleUpdate);
8356
8899
  };
8357
8900
  }, [editor, hideWhenUnavailable, action]);
8358
- const handleAction = React.useCallback(() => {
8901
+ const handleAction = React3.useCallback(() => {
8359
8902
  if (!editor) return false;
8360
8903
  const success = executeUndoRedoAction(editor, action);
8361
8904
  if (success) {
@@ -8372,7 +8915,7 @@ function useUndoRedo(config) {
8372
8915
  Icon: historyIcons[action]
8373
8916
  };
8374
8917
  }
8375
- var ArrowLeftIcon = React.memo(({ className, ...props }) => {
8918
+ var ArrowLeftIcon = React3.memo(({ className, ...props }) => {
8376
8919
  return /* @__PURE__ */ jsxRuntime.jsx(
8377
8920
  "svg",
8378
8921
  {
@@ -8395,17 +8938,17 @@ var ArrowLeftIcon = React.memo(({ className, ...props }) => {
8395
8938
  });
8396
8939
  ArrowLeftIcon.displayName = "ArrowLeftIcon";
8397
8940
  function useSelect(editor, disabled = false, hideWhenUnavailable = false) {
8398
- const selectionAvailable = React__namespace.default.useMemo(() => hasSelection(editor), [editor?.state.selection]);
8399
- const blockMathSelected = React__namespace.default.useMemo(() => selectionHasBlockMath(editor), [editor?.state.selection]);
8400
- const isDisabled = React__namespace.default.useMemo(() => !selectionAvailable || disabled, [selectionAvailable, disabled]);
8401
- const shouldShow = React__namespace.default.useMemo(() => {
8941
+ const selectionAvailable = React3__namespace.default.useMemo(() => hasSelection(editor), [editor?.state.selection]);
8942
+ const blockMathSelected = React3__namespace.default.useMemo(() => selectionHasBlockMath(editor), [editor?.state.selection]);
8943
+ const isDisabled = React3__namespace.default.useMemo(() => !selectionAvailable || disabled, [selectionAvailable, disabled]);
8944
+ const shouldShow = React3__namespace.default.useMemo(() => {
8402
8945
  if (!editor?.isEditable) return false;
8403
8946
  if (hideWhenUnavailable && !selectionAvailable) return false;
8404
8947
  if (blockMathSelected) return false;
8405
8948
  return true;
8406
8949
  }, [editor, hideWhenUnavailable, selectionAvailable, blockMathSelected]);
8407
- const getText = React__namespace.default.useCallback(() => getSelectedText(editor), [editor]);
8408
- const getMarkdown = React__namespace.default.useCallback(() => getSelectedMarkdown(editor), [editor]);
8950
+ const getText = React3__namespace.default.useCallback(() => getSelectedText(editor), [editor]);
8951
+ const getMarkdown = React3__namespace.default.useCallback(() => getSelectedMarkdown(editor), [editor]);
8409
8952
  return {
8410
8953
  isDisabled,
8411
8954
  shouldShow,
@@ -8413,11 +8956,11 @@ function useSelect(editor, disabled = false, hideWhenUnavailable = false) {
8413
8956
  getMarkdown
8414
8957
  };
8415
8958
  }
8416
- var SelectButton = React__namespace.default.forwardRef(
8959
+ var SelectButton = React3__namespace.default.forwardRef(
8417
8960
  ({ editor: providedEditor, disabled = false, hideWhenUnavailable = false, onClick, children, icon, tooltip, ...buttonProps }, ref) => {
8418
8961
  const { editor } = useTiptapEditor(providedEditor);
8419
8962
  const { isDisabled, shouldShow, getText, getMarkdown } = useSelect(editor, disabled, hideWhenUnavailable);
8420
- const handleClick = React__namespace.default.useCallback(
8963
+ const handleClick = React3__namespace.default.useCallback(
8421
8964
  (e) => {
8422
8965
  if (e.defaultPrevented || isDisabled || !editor) return;
8423
8966
  const selectedText = getText();
@@ -8432,9 +8975,9 @@ var SelectButton = React__namespace.default.forwardRef(
8432
8975
  );
8433
8976
  SelectButton.displayName = "SelectButton";
8434
8977
  var useUnmount = (callback) => {
8435
- const ref = React.useRef(callback);
8978
+ const ref = React3.useRef(callback);
8436
8979
  ref.current = callback;
8437
- React.useEffect(
8980
+ React3.useEffect(
8438
8981
  () => () => {
8439
8982
  ref.current();
8440
8983
  },
@@ -8448,7 +8991,7 @@ var defaultOptions = {
8448
8991
  trailing: true
8449
8992
  };
8450
8993
  function useThrottledCallback(fn, wait = 250, dependencies = [], options = defaultOptions) {
8451
- const handler = React.useMemo(() => throttle__default.default(fn, wait, options), dependencies);
8994
+ const handler = React3.useMemo(() => throttle__default.default(fn, wait, options), dependencies);
8452
8995
  useUnmount(() => {
8453
8996
  handler.cancel();
8454
8997
  });
@@ -8470,8 +9013,8 @@ var isSSR = typeof window === "undefined";
8470
9013
  var hasResizeObserver = !isSSR && typeof ResizeObserver !== "undefined";
8471
9014
  var isClientSide = () => !isSSR;
8472
9015
  function useElementRect({ element, enabled = true, throttleMs = 100, useResizeObserver = true } = {}) {
8473
- const [rect, setRect] = React.useState(initialRect);
8474
- const getTargetElement = React.useCallback(() => {
9016
+ const [rect, setRect] = React3.useState(initialRect);
9017
+ const getTargetElement = React3.useCallback(() => {
8475
9018
  if (!enabled || !isClientSide()) return null;
8476
9019
  if (!element) {
8477
9020
  return document.body;
@@ -8508,7 +9051,7 @@ function useElementRect({ element, enabled = true, throttleMs = 100, useResizeOb
8508
9051
  [enabled, getTargetElement],
8509
9052
  { leading: true, trailing: true }
8510
9053
  );
8511
- React.useEffect(() => {
9054
+ React3.useEffect(() => {
8512
9055
  if (!enabled || !isClientSide()) {
8513
9056
  setRect(initialRect);
8514
9057
  return;
@@ -8545,7 +9088,7 @@ function useBodyRect(options = {}) {
8545
9088
  });
8546
9089
  }
8547
9090
  function useWindowSize() {
8548
- const [windowSize, setWindowSize] = React.useState({
9091
+ const [windowSize, setWindowSize] = React3.useState({
8549
9092
  width: 0,
8550
9093
  height: 0,
8551
9094
  offsetTop: 0,
@@ -8564,7 +9107,7 @@ function useWindowSize() {
8564
9107
  return { width, height, offsetTop, offsetLeft, scale };
8565
9108
  });
8566
9109
  }, 200);
8567
- React.useEffect(() => {
9110
+ React3.useEffect(() => {
8568
9111
  const visualViewport = window.visualViewport;
8569
9112
  if (!visualViewport) return;
8570
9113
  visualViewport.addEventListener("resize", handleViewportChange);
@@ -8584,7 +9127,7 @@ function useCursorVisibility({ editor, overlayHeight = 0 }) {
8584
9127
  throttleMs: 100,
8585
9128
  useResizeObserver: true
8586
9129
  });
8587
- React.useEffect(() => {
9130
+ React3.useEffect(() => {
8588
9131
  const ensureCursorVisibility = () => {
8589
9132
  if (!editor) return;
8590
9133
  const { state, view } = editor;
@@ -8609,7 +9152,7 @@ function useCursorVisibility({ editor, overlayHeight = 0 }) {
8609
9152
  }, [editor, overlayHeight, windowHeight, rect.height]);
8610
9153
  return rect;
8611
9154
  }
8612
- var QuoteIcon = React__namespace.memo(({ ...props }) => {
9155
+ var QuoteIcon = React3__namespace.memo(({ ...props }) => {
8613
9156
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "anticon", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 1024 1024", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
8614
9157
  "path",
8615
9158
  {
@@ -8682,7 +9225,7 @@ var MainToolbarContent = ({
8682
9225
  ] });
8683
9226
  };
8684
9227
  var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8685
- /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button6, { "data-style": "ghost", onClick: onBack, children: [
9228
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button7, { "data-style": "ghost", onClick: onBack, children: [
8686
9229
  /* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, { className: "tiptap-button-icon" }),
8687
9230
  type === "highlighter" ? /* @__PURE__ */ jsxRuntime.jsx(HighlighterIcon, { className: "tiptap-button-icon" }) : /* @__PURE__ */ jsxRuntime.jsx(LinkIcon, { className: "tiptap-button-icon" })
8688
9231
  ] }) }),
@@ -8693,13 +9236,13 @@ var EditorToolbar = ({ tools, isBubble = false, onQuote, onCreateAnnotation, onC
8693
9236
  const isMobile = useIsBreakpoint();
8694
9237
  const { height } = useWindowSize();
8695
9238
  const { editor } = react.useCurrentEditor();
8696
- const toolbarRef = React.useRef(null);
9239
+ const toolbarRef = React3.useRef(null);
8697
9240
  const rect = useCursorVisibility({
8698
9241
  editor,
8699
9242
  overlayHeight: toolbarRef.current?.getBoundingClientRect().height ?? 0
8700
9243
  });
8701
- const [mobileView, setMobileView] = React.useState("main");
8702
- React.useEffect(() => {
9244
+ const [mobileView, setMobileView] = React3.useState("main");
9245
+ React3.useEffect(() => {
8703
9246
  if (!isMobile && mobileView !== "main") {
8704
9247
  setMobileView("main");
8705
9248
  }
@@ -8922,8 +9465,8 @@ var SearchAndReplace = core.Extension.create({
8922
9465
  });
8923
9466
  var searchAndReplace_default = SearchAndReplace;
8924
9467
  var usePageNo = (pageNoConfig) => {
8925
- const [editor, setEditor] = React.useState(null);
8926
- const lastScrollToPageNoRef = React.useRef(void 0);
9468
+ const [editor, setEditor] = React3.useState(null);
9469
+ const lastScrollToPageNoRef = React3.useRef(void 0);
8927
9470
  const setPageNoEditor = (newEditor) => {
8928
9471
  setEditor(newEditor);
8929
9472
  };
@@ -8931,7 +9474,7 @@ var usePageNo = (pageNoConfig) => {
8931
9474
  lastScrollToPageNoRef.current = pageNo;
8932
9475
  pageNoConfig?.onScrollPage?.(pageNo);
8933
9476
  }, 300);
8934
- React.useEffect(() => {
9477
+ React3.useEffect(() => {
8935
9478
  if (!editor) return;
8936
9479
  if (!pageNoConfig?.enabled) return;
8937
9480
  const targetPageNo = pageNoConfig?.pageNo;
@@ -8970,7 +9513,7 @@ var usePageNo = (pageNoConfig) => {
8970
9513
  onPageChange
8971
9514
  };
8972
9515
  };
8973
- var MarkdownEditor_default = React.forwardRef(
9516
+ var MarkdownEditor_default = React3.forwardRef(
8974
9517
  ({
8975
9518
  value = ``,
8976
9519
  onChange,
@@ -8986,7 +9529,7 @@ var MarkdownEditor_default = React.forwardRef(
8986
9529
  pageNoConfig
8987
9530
  }, ref) => {
8988
9531
  const isMobile = useIsBreakpoint();
8989
- const lastContentRef = React.useRef("");
9532
+ const lastContentRef = React3.useRef("");
8990
9533
  const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
8991
9534
  const {
8992
9535
  setAnnotationEditor,
@@ -9119,7 +9662,7 @@ var MarkdownEditor_default = React.forwardRef(
9119
9662
  if (editor.isEmpty) return "";
9120
9663
  return editor.getMarkdown();
9121
9664
  };
9122
- React.useImperativeHandle(
9665
+ React3.useImperativeHandle(
9123
9666
  ref,
9124
9667
  () => ({
9125
9668
  getEditor: () => editor,
@@ -9139,30 +9682,30 @@ var MarkdownEditor_default = React.forwardRef(
9139
9682
  }),
9140
9683
  [editor]
9141
9684
  );
9142
- React.useEffect(() => {
9685
+ React3.useEffect(() => {
9143
9686
  if (!editor) return;
9144
9687
  setAnnotationEditor(editor);
9145
9688
  setCollectionEditor(editor);
9146
9689
  setPageNoEditor(editor);
9147
9690
  }, [editor]);
9148
- React.useEffect(() => {
9691
+ React3.useEffect(() => {
9149
9692
  if (!editor) return;
9150
9693
  if (lastContentRef.current === value) return;
9151
9694
  editor?.commands.setContent(value, { contentType: "markdown" });
9152
9695
  editor?.commands.focus("start");
9153
9696
  lastContentRef.current = value;
9154
9697
  }, [value, editor]);
9155
- React.useEffect(() => {
9698
+ React3.useEffect(() => {
9156
9699
  editor?.commands.setSearchTerm(searchValue || "");
9157
9700
  }, [searchValue, value, editor]);
9158
- React.useEffect(() => {
9701
+ React3.useEffect(() => {
9159
9702
  editor?.setEditable(!disabled);
9160
9703
  }, [disabled, editor]);
9161
9704
  const downloadFile2 = () => {
9162
9705
  onDownloadFile?.(getMarkdown(), "docx");
9163
9706
  };
9164
- const fixedTools = React.useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
9165
- const floatTools = React.useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
9707
+ const fixedTools = React3.useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
9708
+ const floatTools = React3.useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
9166
9709
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "height-full width-full", children: [
9167
9710
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default("height-full", "flex-1", styles_module_default5.editorParent), children: /* @__PURE__ */ jsxRuntime.jsxs(react.EditorContext.Provider, { value: { editor }, children: [
9168
9711
  /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -9265,12 +9808,12 @@ var styles_module_default8 = {
9265
9808
  score: "styles_module_score"
9266
9809
  };
9267
9810
  var MarkDrawing_default = ({ children, detections, originalSize, scopeRender }) => {
9268
- const containerRef = React.useRef(null);
9269
- const [containerSize, setContainerSize] = React.useState({
9811
+ const containerRef = React3.useRef(null);
9812
+ const [containerSize, setContainerSize] = React3.useState({
9270
9813
  width: originalSize.width,
9271
9814
  height: originalSize.height
9272
9815
  });
9273
- React.useEffect(() => {
9816
+ React3.useEffect(() => {
9274
9817
  const obs = new ResizeObserver((entries) => {
9275
9818
  const entry = entries[0];
9276
9819
  if (entry) {
@@ -9291,7 +9834,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
9291
9834
  const top = y1 * scaleY;
9292
9835
  const width = (x2 - x1) * scaleX;
9293
9836
  const height = (y2 - y1) * scaleY;
9294
- return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [
9837
+ return /* @__PURE__ */ jsxRuntime.jsxs(React3__namespace.default.Fragment, { children: [
9295
9838
  /* @__PURE__ */ jsxRuntime.jsx(
9296
9839
  "div",
9297
9840
  {
@@ -9326,7 +9869,7 @@ function renderDefault(DefaultComponent, ref, props) {
9326
9869
  if (!DefaultComponent) return null;
9327
9870
  return isRenderFn(DefaultComponent) ? /* @__PURE__ */ jsxRuntime.jsx(DefaultComponent, { ref, ...props }) : DefaultComponent;
9328
9871
  }
9329
- var RenderWrapper_default = React.forwardRef(function RenderWrapper({ control = true, ctx, DefaultComponent }, ref) {
9872
+ var RenderWrapper_default = React3.forwardRef(function RenderWrapper({ control = true, ctx, DefaultComponent }, ref) {
9330
9873
  if (control === false || isNull(control)) return null;
9331
9874
  if (control === true || control === void 0) {
9332
9875
  return renderDefault(DefaultComponent, ref);
@@ -9372,6 +9915,7 @@ exports.FilePreviewDrawer = FilePreviewDrawer_default;
9372
9915
  exports.HttpStatus = HttpStatus;
9373
9916
  exports.Iframe = Iframe_default;
9374
9917
  exports.LazyComponent = LazyComponent_default;
9918
+ exports.LuyaFilePreview = luyaFilePreview_default;
9375
9919
  exports.MarkDrawing = MarkDrawing_default;
9376
9920
  exports.MarkdownEditor = MarkdownEditor_default;
9377
9921
  exports.MarkdownPreview = MarkdownPreview_default;
@@ -9478,6 +10022,7 @@ exports.plus = plus;
9478
10022
  exports.precision = precision;
9479
10023
  exports.processItemList = processItemList;
9480
10024
  exports.propsMerge = propsMerge;
10025
+ exports.safeParseJson = safeParseJson;
9481
10026
  exports.setInterval = setInterval2;
9482
10027
  exports.setUrlMainSource = setUrlMainSource;
9483
10028
  exports.shouldRender = shouldRender;