@sia.soul/sia-react-ui 0.1.114 → 0.1.116

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 CHANGED
@@ -2100,7 +2100,7 @@ function ImagePreview({ open, src, alt = "", onOpenChange }) {
2100
2100
  ] })
2101
2101
  ] }), document.body);
2102
2102
  }
2103
- function Image2({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onError, style, ...props }) {
2103
+ function Image2({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onLoad, onError, style, ...props }) {
2104
2104
  const config = typeof preview === "object" ? preview : {};
2105
2105
  const controlled = typeof preview === "object" && preview.open !== void 0;
2106
2106
  const [internalOpen, setInternalOpen] = (0, import_react7.useState)(false);
@@ -2119,7 +2119,10 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
2119
2119
  }
2120
2120
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: `sia-image ${rootClassName}`.trim(), style: rootStyle, children: [
2121
2121
  !loaded && placeholder ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sia-image__placeholder", children: placeholder }) : null,
2122
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: () => setLoaded(true), onError: (event) => {
2122
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { ...withTitleTooltip(props), src: displaySrc, alt, className, onLoad: (event) => {
2123
+ setLoaded(true);
2124
+ onLoad?.(event);
2125
+ }, onError: (event) => {
2123
2126
  if (!failed && fallback) setFailed(true);
2124
2127
  onError?.(event);
2125
2128
  } }),
@@ -2133,13 +2136,44 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
2133
2136
 
2134
2137
  // src/components/CursorPreview.tsx
2135
2138
  var import_jsx_runtime8 = require("react/jsx-runtime");
2136
- function CursorPreview({ frames, size = 48, playing = true, followPointer = true, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerMove, onPointerLeave, ...props }) {
2139
+ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
2140
+ const rootRef = (0, import_react8.useRef)(null);
2141
+ const [bounds, setBounds] = (0, import_react8.useState)({ width: 0, height: 0 });
2142
+ const [hovered, setHovered] = (0, import_react8.useState)(false);
2137
2143
  const [index, setIndex] = (0, import_react8.useState)(0);
2138
2144
  const [point, setPoint] = (0, import_react8.useState)(null);
2139
2145
  const [reduced, setReduced] = (0, import_react8.useState)(false);
2140
2146
  const [failed, setFailed] = (0, import_react8.useState)(false);
2141
- const safeSize = Math.max(8, Number.isFinite(size) ? size : 48);
2147
+ const [density, setDensity] = (0, import_react8.useState)(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
2148
+ const scale = sizeUnit === "device" ? density : 1;
2149
+ const safeSize = Math.max(8, Number.isFinite(size) ? size : 48) / scale;
2150
+ (0, import_react8.useEffect)(() => {
2151
+ if (sizeUnit !== "device") return;
2152
+ let media;
2153
+ const update = () => {
2154
+ media?.removeEventListener("change", update);
2155
+ const next = window.devicePixelRatio || 1;
2156
+ setDensity(next);
2157
+ media = window.matchMedia(`(resolution: ${next}dppx)`);
2158
+ media.addEventListener("change", update);
2159
+ };
2160
+ update();
2161
+ window.addEventListener("resize", update);
2162
+ return () => {
2163
+ media.removeEventListener("change", update);
2164
+ window.removeEventListener("resize", update);
2165
+ };
2166
+ }, [sizeUnit]);
2142
2167
  const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
2168
+ (0, import_react8.useLayoutEffect)(() => {
2169
+ const root = rootRef.current;
2170
+ if (!showHotspot && sizeUnit !== "device" || !root) return;
2171
+ const measure = () => setBounds({ width: root.clientWidth, height: root.clientHeight });
2172
+ measure();
2173
+ const observer = new ResizeObserver(measure);
2174
+ observer.observe(root);
2175
+ return () => observer.disconnect();
2176
+ }, [showHotspot, sizeUnit]);
2143
2177
  (0, import_react8.useEffect)(() => {
2144
2178
  setIndex(0);
2145
2179
  }, [frames]);
@@ -2158,18 +2192,50 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
2158
2192
  }, [playing, reduced, frames, index, frame]);
2159
2193
  function move(event) {
2160
2194
  const rect = event.currentTarget.getBoundingClientRect();
2195
+ if (event.pointerType !== "touch") setHovered(true);
2161
2196
  if (followPointer && event.pointerType !== "touch") setPoint({ x: event.clientX - rect.left, y: event.clientY - rect.top });
2162
2197
  onPointerMove?.(event);
2163
2198
  }
2164
2199
  const following = !!point && followPointer && !!frame && !failed;
2165
2200
  const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
2166
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ...props, className: `sia-cursor-preview${following ? " is-following" : ""} ${className}`.trim(), style: { height, ...style }, onPointerMove: move, onPointerLeave: (event) => {
2167
- setPoint(null);
2168
- onPointerLeave?.(event);
2169
- }, children: [
2170
- frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: following ? point.x - offset(frame.hotspotX) : "50%", top: following ? point.y - offset(frame.hotspotY) : "50%", transform: following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Image2, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__empty", children: empty }),
2171
- children ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-cursor-preview__caption", children }) : null
2172
- ] });
2201
+ const origin = rootRef.current?.getBoundingClientRect();
2202
+ const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
2203
+ const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
2204
+ const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
2205
+ const hotspotX = bitmapX + offset(frame?.hotspotX);
2206
+ const hotspotY = bitmapY + offset(frame?.hotspotY);
2207
+ const direction = bounds.width - hotspotX >= 130 ? 1 : -1;
2208
+ const lineY = Math.max(18, hotspotY - 42);
2209
+ const elbowX = hotspotX + direction * 28;
2210
+ const endX = direction === 1 ? Math.min(bounds.width - 58, hotspotX + 82) : Math.max(58, hotspotX - 82);
2211
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2212
+ "div",
2213
+ {
2214
+ ...props,
2215
+ ref: rootRef,
2216
+ className: `sia-cursor-preview${following ? " is-following" : ""} ${className}`.trim(),
2217
+ style: { height, ...style },
2218
+ onPointerEnter: (event) => {
2219
+ if (event.pointerType !== "touch") setHovered(true);
2220
+ onPointerEnter?.(event);
2221
+ },
2222
+ onPointerMove: move,
2223
+ onPointerLeave: (event) => {
2224
+ setHovered(false);
2225
+ setPoint(null);
2226
+ onPointerLeave?.(event);
2227
+ },
2228
+ children: [
2229
+ frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: sizeUnit === "device" || following ? bitmapX : "50%", top: sizeUnit === "device" || following ? bitmapY : "50%", transform: sizeUnit === "device" || following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Image2, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__empty", children: empty }),
2230
+ showHotspot && !hovered && frame && !failed && bounds.width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { className: "sia-cursor-preview__hotspot", width: "100%", height: "100%", role: "img", "aria-label": "\u6307\u9488\u70B9\uFF1A\u9F20\u6807\u70B9\u51FB\u7684\u5B9E\u9645\u4F4D\u7F6E", children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: `${hotspotX},${hotspotY} ${elbowX},${lineY} ${endX},${lineY}` }),
2232
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: hotspotX, cy: hotspotY, r: 2.5 }),
2233
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("text", { x: endX + direction * 8, y: lineY, textAnchor: direction === 1 ? "start" : "end", dominantBaseline: "central", children: "\u6307\u9488\u70B9" })
2234
+ ] }) : null,
2235
+ children ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-cursor-preview__caption", children }) : null
2236
+ ]
2237
+ }
2238
+ );
2173
2239
  }
2174
2240
 
2175
2241
  // src/components/UtilityLayout.tsx
@@ -2385,12 +2451,13 @@ function MenuEntry({
2385
2451
  ...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
2386
2452
  disabled: item.disabled,
2387
2453
  "aria-current": isSelected ? "page" : void 0,
2454
+ "data-menu-key": item.key,
2388
2455
  "data-applied": item.applied || void 0,
2389
2456
  "aria-expanded": hasChildren ? isOpen : void 0,
2390
2457
  onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
2391
2458
  children: [
2392
2459
  reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
2393
- item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", size: 32 }) }) : null,
2460
+ item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
2394
2461
  !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
2395
2462
  !collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
2396
2463
  !collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
@@ -2436,8 +2503,10 @@ function MenuLevel({
2436
2503
  function Menu({
2437
2504
  items,
2438
2505
  mode = "vertical",
2506
+ gridColumns = 2,
2439
2507
  theme = "light",
2440
2508
  selectedKeys,
2509
+ autoScrollSelected = false,
2441
2510
  defaultSelectedKeys = [],
2442
2511
  openKeys,
2443
2512
  defaultOpenKeys = [],
@@ -2451,12 +2520,37 @@ function Menu({
2451
2520
  onDeselect,
2452
2521
  onOpenChange,
2453
2522
  className = "",
2523
+ style,
2454
2524
  ...rest
2455
2525
  }) {
2456
2526
  const menuId = (0, import_react10.useId)();
2457
2527
  const rootRef = (0, import_react10.useRef)(null);
2458
2528
  const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
2459
2529
  const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
2530
+ const revealedKey = (0, import_react10.useRef)();
2531
+ const firstSelected = selected[0];
2532
+ (0, import_react10.useLayoutEffect)(() => {
2533
+ if (!autoScrollSelected || firstSelected === void 0) {
2534
+ revealedKey.current = void 0;
2535
+ return;
2536
+ }
2537
+ const root = rootRef.current;
2538
+ if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
2539
+ const reveal = () => {
2540
+ if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
2541
+ const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
2542
+ if (!target) return;
2543
+ const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
2544
+ const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
2545
+ if (item.top < top || item.bottom > bottom)
2546
+ root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
2547
+ revealedKey.current = firstSelected;
2548
+ };
2549
+ reveal();
2550
+ const observer = new ResizeObserver(reveal);
2551
+ observer.observe(root);
2552
+ return () => observer.disconnect();
2553
+ }, [autoScrollSelected, firstSelected, items, mode]);
2460
2554
  (0, import_react10.useEffect)(() => {
2461
2555
  if (mode === "inline" || !open.length) return void 0;
2462
2556
  const closeOutside = (event) => {
@@ -2483,7 +2577,8 @@ function Menu({
2483
2577
  else onSelect?.({ ...info, selectedKeys: [...next] });
2484
2578
  if (mode !== "inline") setOpen([]);
2485
2579
  }
2486
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
2580
+ const gridStyle = mode === "grid" ? { "--sia-menu-grid-columns": gridColumns === "auto" ? "repeat(auto-fill, minmax(88px, 1fr))" : `repeat(${Number.isFinite(gridColumns) ? Math.max(1, Math.floor(Number(gridColumns))) : 2}, minmax(0, 1fr))` } : {};
2581
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
2487
2582
  }
2488
2583
  function Steps({ items, current = 0, initial: initial3 = 0, direction = "horizontal", type = "default", size = "default", status = "process", progressDot = false, onChange, className = "", ...props }) {
2489
2584
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `sia-steps sia-steps--${direction} sia-steps--${type} sia-steps--${size} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item, rawIndex) => {
@@ -5060,8 +5155,15 @@ var Select = (0, import_react24.forwardRef)(function Select2({
5060
5155
  function clearSelection() {
5061
5156
  setCurrentValue(multiple ? [] : null);
5062
5157
  }
5158
+ function handleDropdownEscape(event) {
5159
+ if (event.key !== "Escape" || !open || popupMode !== "dropdown") return false;
5160
+ event.preventDefault();
5161
+ event.stopPropagation();
5162
+ closeDropdown();
5163
+ return true;
5164
+ }
5063
5165
  function handleInteractionKeyDown(event, fromSearch = false) {
5064
- if (popupMode === "modal" && open) return;
5166
+ if (handleDropdownEscape(event) || popupMode === "modal" && open) return;
5065
5167
  if (event.key === "ArrowDown" || event.key === "ArrowUp") {
5066
5168
  event.preventDefault();
5067
5169
  if (!open) openDropdown();
@@ -5166,7 +5268,7 @@ var Select = (0, import_react24.forwardRef)(function Select2({
5166
5268
  }
5167
5269
  ),
5168
5270
  allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { className: "sia-select__clear", type: "button", "aria-label": "\u6E05\u7A7A\u9009\u62E9", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
5169
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && popupMode === "dropdown", style: { fontSize: dropdownFontSize }, className: `sia-select__dropdown${filteredOptions.length === 0 && !canSubmitInput ? " sia-select__dropdown--empty" : ""}`, children: [
5271
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(PopupPortal, { ref: popupRef, onKeyDown: handleDropdownEscape, anchorRef: rootRef, open: open && popupMode === "dropdown", style: { fontSize: dropdownFontSize }, className: `sia-select__dropdown${filteredOptions.length === 0 && !canSubmitInput ? " sia-select__dropdown--empty" : ""}`, children: [
5170
5272
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FloatingScrollbarProvider, { targetRef: listRef }),
5171
5273
  showSearch || allowInput ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "sia-select__search", children: [
5172
5274
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "search", size: 15 }),
@@ -6570,6 +6672,7 @@ function ToolPanel({
6570
6672
  }
6571
6673
 
6572
6674
  // src/components/WindowFrame.tsx
6675
+ var import_react32 = require("react");
6573
6676
  var import_jsx_runtime30 = require("react/jsx-runtime");
6574
6677
  var DEFAULT_LABELS = {
6575
6678
  minimize: "\u6700\u5C0F\u5316",
@@ -6693,13 +6796,40 @@ function WindowTitleBar({
6693
6796
  onMouseDown,
6694
6797
  ...props
6695
6798
  }) {
6799
+ const cancelDrag = (0, import_react32.useRef)(null);
6800
+ (0, import_react32.useEffect)(() => () => cancelDrag.current?.(), [draggable]);
6696
6801
  function handleMouseDown(event) {
6802
+ cancelDrag.current?.();
6697
6803
  onMouseDown?.(event);
6698
6804
  if (event.defaultPrevented || !draggable || !onWindowAction || event.button !== 0) return;
6699
6805
  const target = event.target;
6700
6806
  if (!(target instanceof Element) || target.closest(NON_DRAG_SELECTOR)) return;
6701
6807
  event.preventDefault();
6702
- void onWindowAction(event.detail > 1 ? "toggle-maximize" : "start-dragging");
6808
+ if (event.detail > 1) {
6809
+ void onWindowAction("toggle-maximize");
6810
+ return;
6811
+ }
6812
+ const origin = { x: event.clientX, y: event.clientY };
6813
+ const run = onWindowAction;
6814
+ function cancel() {
6815
+ document.removeEventListener("mousemove", move);
6816
+ document.removeEventListener("mouseup", cancel, true);
6817
+ window.removeEventListener("blur", cancel);
6818
+ cancelDrag.current = null;
6819
+ }
6820
+ function move(next) {
6821
+ if ((next.buttons & 1) === 0) {
6822
+ cancel();
6823
+ return;
6824
+ }
6825
+ if (Math.hypot(next.clientX - origin.x, next.clientY - origin.y) < 2) return;
6826
+ cancel();
6827
+ void run("start-dragging");
6828
+ }
6829
+ cancelDrag.current = cancel;
6830
+ document.addEventListener("mousemove", move);
6831
+ document.addEventListener("mouseup", cancel, true);
6832
+ window.addEventListener("blur", cancel);
6703
6833
  }
6704
6834
  const renderedControls = controls === true ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6705
6835
  WindowControls,
@@ -6731,20 +6861,20 @@ function WindowTitleBar({
6731
6861
  }
6732
6862
 
6733
6863
  // src/components/Drawer.tsx
6734
- var import_react32 = require("react");
6864
+ var import_react33 = require("react");
6735
6865
  var import_client4 = require("react-dom/client");
6736
6866
  var import_jsx_runtime31 = require("react/jsx-runtime");
6737
6867
  var drawerHandles = /* @__PURE__ */ new Set();
6738
6868
  var DRAWER_MOTION_DURATION = 400;
6739
6869
  var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
6740
- var DrawerStackContext = (0, import_react32.createContext)(null);
6870
+ var DrawerStackContext = (0, import_react33.createContext)(null);
6741
6871
  function createPushOffset(distance3, depth, negative) {
6742
6872
  if (depth <= 0) return "0px";
6743
6873
  if (typeof distance3 === "number") return `${(negative ? -1 : 1) * distance3 * depth}px`;
6744
6874
  const operator = negative ? " - " : " + ";
6745
6875
  return `calc(0px${operator}${Array.from({ length: depth }, () => distance3).join(operator)})`;
6746
6876
  }
6747
- var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6877
+ var DrawerRoot = (0, import_react33.forwardRef)(function Drawer({
6748
6878
  open,
6749
6879
  title,
6750
6880
  children,
@@ -6767,19 +6897,19 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6767
6897
  style,
6768
6898
  ...props
6769
6899
  }, forwardedRef) {
6770
- const localRef = (0, import_react32.useRef)(null);
6771
- const bodyRef = (0, import_react32.useRef)(null);
6772
- const titleId = (0, import_react32.useId)();
6773
- const drawerId = (0, import_react32.useId)();
6774
- const parentStack = (0, import_react32.useContext)(DrawerStackContext);
6775
- const afterOpenRef = (0, import_react32.useRef)(afterOpen);
6776
- const afterCloseRef = (0, import_react32.useRef)(afterClose);
6900
+ const localRef = (0, import_react33.useRef)(null);
6901
+ const bodyRef = (0, import_react33.useRef)(null);
6902
+ const titleId = (0, import_react33.useId)();
6903
+ const drawerId = (0, import_react33.useId)();
6904
+ const parentStack = (0, import_react33.useContext)(DrawerStackContext);
6905
+ const afterOpenRef = (0, import_react33.useRef)(afterOpen);
6906
+ const afterCloseRef = (0, import_react33.useRef)(afterClose);
6777
6907
  afterOpenRef.current = afterOpen;
6778
6908
  afterCloseRef.current = afterClose;
6779
- const [rendered, setRendered] = (0, import_react32.useState)(open);
6780
- const [closing, setClosing] = (0, import_react32.useState)(false);
6781
- const [openChildIds, setOpenChildIds] = (0, import_react32.useState)(() => /* @__PURE__ */ new Set());
6782
- const setChildOpen = (0, import_react32.useCallback)((id, childOpen) => {
6909
+ const [rendered, setRendered] = (0, import_react33.useState)(open);
6910
+ const [closing, setClosing] = (0, import_react33.useState)(false);
6911
+ const [openChildIds, setOpenChildIds] = (0, import_react33.useState)(() => /* @__PURE__ */ new Set());
6912
+ const setChildOpen = (0, import_react33.useCallback)((id, childOpen) => {
6783
6913
  setOpenChildIds((current) => {
6784
6914
  const hasId = current.has(id);
6785
6915
  if (hasId === childOpen) return current;
@@ -6789,8 +6919,8 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6789
6919
  return next;
6790
6920
  });
6791
6921
  }, []);
6792
- const stackContextValue = (0, import_react32.useMemo)(() => ({ setChildOpen }), [setChildOpen]);
6793
- (0, import_react32.useEffect)(() => {
6922
+ const stackContextValue = (0, import_react33.useMemo)(() => ({ setChildOpen }), [setChildOpen]);
6923
+ (0, import_react33.useEffect)(() => {
6794
6924
  if (open) {
6795
6925
  setRendered(true);
6796
6926
  setClosing(false);
@@ -6805,12 +6935,12 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6805
6935
  }, DRAWER_MOTION_DURATION);
6806
6936
  return () => window.clearTimeout(timer);
6807
6937
  }, [open, rendered]);
6808
- (0, import_react32.useEffect)(() => {
6938
+ (0, import_react33.useEffect)(() => {
6809
6939
  if (!open || !rendered) return void 0;
6810
6940
  const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
6811
6941
  return () => window.clearTimeout(timer);
6812
6942
  }, [open, rendered]);
6813
- (0, import_react32.useEffect)(() => {
6943
+ (0, import_react33.useEffect)(() => {
6814
6944
  if (!parentStack) return void 0;
6815
6945
  parentStack.setChildOpen(drawerId, open);
6816
6946
  return () => parentStack.setChildOpen(drawerId, false);
@@ -6936,9 +7066,9 @@ var Drawer2 = Object.assign(DrawerRoot, {
6936
7066
  });
6937
7067
 
6938
7068
  // src/components/Form.tsx
6939
- var import_react33 = require("react");
7069
+ var import_react34 = require("react");
6940
7070
  var import_jsx_runtime32 = require("react/jsx-runtime");
6941
- var Switch = (0, import_react33.forwardRef)(function Switch2({
7071
+ var Switch = (0, import_react34.forwardRef)(function Switch2({
6942
7072
  label,
6943
7073
  variant = "standard",
6944
7074
  size: sizeProp,
@@ -7167,9 +7297,9 @@ var FormStore = class {
7167
7297
  window.requestAnimationFrame(() => focusTarget?.focus({ preventScroll: true }));
7168
7298
  };
7169
7299
  };
7170
- var FormContext = (0, import_react33.createContext)(null);
7300
+ var FormContext = (0, import_react34.createContext)(null);
7171
7301
  function useForm(form) {
7172
- const ref = (0, import_react33.useRef)(form ?? new FormStore());
7302
+ const ref = (0, import_react34.useRef)(form ?? new FormStore());
7173
7303
  return [ref.current];
7174
7304
  }
7175
7305
  function FormRoot({
@@ -7192,9 +7322,9 @@ function FormRoot({
7192
7322
  const [internalForm] = useForm(form);
7193
7323
  const instance = internalForm;
7194
7324
  instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
7195
- const context = (0, import_react33.useMemo)(() => instance, [instance]);
7196
- const formRef = (0, import_react33.useRef)(null);
7197
- (0, import_react33.useLayoutEffect)(() => {
7325
+ const context = (0, import_react34.useMemo)(() => instance, [instance]);
7326
+ const formRef = (0, import_react34.useRef)(null);
7327
+ (0, import_react34.useLayoutEffect)(() => {
7198
7328
  const root = formRef.current;
7199
7329
  if (!root) return;
7200
7330
  let frame = 0;
@@ -7258,6 +7388,7 @@ function defaultEventValue(valuePropName, args) {
7258
7388
  function FormItem({
7259
7389
  name,
7260
7390
  label,
7391
+ align = "start",
7261
7392
  rules = [],
7262
7393
  required,
7263
7394
  extra,
@@ -7271,11 +7402,11 @@ function FormItem({
7271
7402
  children,
7272
7403
  className = ""
7273
7404
  }) {
7274
- const form = (0, import_react33.useContext)(FormContext);
7275
- const id = (0, import_react33.useId)();
7276
- const itemRef = (0, import_react33.useRef)(null);
7405
+ const form = (0, import_react34.useContext)(FormContext);
7406
+ const id = (0, import_react34.useId)();
7407
+ const itemRef = (0, import_react34.useRef)(null);
7277
7408
  if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
7278
- (0, import_react33.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7409
+ (0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7279
7410
  const path = name === void 0 ? void 0 : pathArray(name);
7280
7411
  const key = path ? pathKey2(path) : "";
7281
7412
  const ruleRequired = required ?? rules.some((rule) => rule.required);
@@ -7284,7 +7415,7 @@ function FormItem({
7284
7415
  const helpContent = help ?? errors[0];
7285
7416
  const labelId = label && !noStyle ? `${id}-label` : void 0;
7286
7417
  const errorId = `${id}-error`;
7287
- (0, import_react33.useEffect)(() => {
7418
+ (0, import_react34.useEffect)(() => {
7288
7419
  if (!path) return void 0;
7289
7420
  return form.registerField({
7290
7421
  name: path,
@@ -7296,13 +7427,13 @@ function FormItem({
7296
7427
  if (typeof children === "function") {
7297
7428
  content = children(form);
7298
7429
  } else {
7299
- const childArray = import_react33.Children.toArray(children);
7300
- const child = childArray.length === 1 && (0, import_react33.isValidElement)(childArray[0]) ? childArray[0] : null;
7430
+ const childArray = import_react34.Children.toArray(children);
7431
+ const child = childArray.length === 1 && (0, import_react34.isValidElement)(childArray[0]) ? childArray[0] : null;
7301
7432
  if (child && path) {
7302
7433
  const childProps = child.props;
7303
7434
  const originalTrigger = childProps[trigger];
7304
7435
  const validationEvents = Array.isArray(validateTrigger) ? validateTrigger : [validateTrigger];
7305
- content = (0, import_react33.cloneElement)(child, {
7436
+ content = (0, import_react34.cloneElement)(child, {
7306
7437
  id: childProps.id ?? id,
7307
7438
  [valuePropName]: form.getFieldValue(path) ?? (valuePropName === "checked" ? false : ""),
7308
7439
  [trigger]: (...args) => {
@@ -7330,7 +7461,7 @@ function FormItem({
7330
7461
  if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: content });
7331
7462
  const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-form-item__input-wrap", children: content });
7332
7463
  const hasError = status === "error" && Boolean(helpContent);
7333
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
7464
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
7334
7465
  label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "sia-form-item__label-content", children: [
7335
7466
  ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
7336
7467
  label
@@ -7358,9 +7489,9 @@ function FormItem({
7358
7489
  ] });
7359
7490
  }
7360
7491
  function FormList({ name, children }) {
7361
- const form = (0, import_react33.useContext)(FormContext);
7492
+ const form = (0, import_react34.useContext)(FormContext);
7362
7493
  if (!form) throw new Error("Form.List \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
7363
- (0, import_react33.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7494
+ (0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7364
7495
  const current = form.getFieldValue(name);
7365
7496
  const values = Array.isArray(current) ? current : [];
7366
7497
  const operations = {
@@ -7397,13 +7528,13 @@ var Form = Object.assign(FormRoot, {
7397
7528
  });
7398
7529
 
7399
7530
  // src/components/Radio.tsx
7400
- var import_react34 = require("react");
7531
+ var import_react35 = require("react");
7401
7532
  var import_jsx_runtime33 = require("react/jsx-runtime");
7402
- var RadioContext = (0, import_react34.createContext)(null);
7403
- var RadioRoot = (0, import_react34.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
7533
+ var RadioContext = (0, import_react35.createContext)(null);
7534
+ var RadioRoot = (0, import_react35.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
7404
7535
  const size = useControlSize(sizeProp);
7405
- const group = (0, import_react34.useContext)(RadioContext);
7406
- const fallbackId = (0, import_react34.useId)();
7536
+ const group = (0, import_react35.useContext)(RadioContext);
7537
+ const fallbackId = (0, import_react35.useId)();
7407
7538
  const grouped = group !== null;
7408
7539
  const currentChecked = grouped ? group.value === value : checked;
7409
7540
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
@@ -7447,7 +7578,7 @@ function RadioGroup({
7447
7578
  onChange
7448
7579
  }) {
7449
7580
  const size = useControlSize(sizeProp);
7450
- const fallbackName = (0, import_react34.useId)();
7581
+ const fallbackName = (0, import_react35.useId)();
7451
7582
  const [currentValue, setValue2] = useControllableState({
7452
7583
  value,
7453
7584
  defaultValue,
@@ -7455,7 +7586,7 @@ function RadioGroup({
7455
7586
  if (next !== void 0) onChange?.(next);
7456
7587
  }
7457
7588
  });
7458
- const context = (0, import_react34.useMemo)(() => ({
7589
+ const context = (0, import_react35.useMemo)(() => ({
7459
7590
  value: currentValue,
7460
7591
  name: name ?? fallbackName,
7461
7592
  disabled,
@@ -7479,7 +7610,7 @@ var Radio2 = Object.assign(RadioRoot, {
7479
7610
  });
7480
7611
 
7481
7612
  // src/components/Slider.tsx
7482
- var import_react35 = require("react");
7613
+ var import_react36 = require("react");
7483
7614
  var import_jsx_runtime34 = require("react/jsx-runtime");
7484
7615
  function percent(value, min, max) {
7485
7616
  return (value - min) / (max - min) * 100;
@@ -7503,7 +7634,7 @@ function Slider({
7503
7634
  }) {
7504
7635
  const fallback = defaultValue ?? (range ? [min, max] : min);
7505
7636
  const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
7506
- const [activeThumb, setActiveThumb] = (0, import_react35.useState)(null);
7637
+ const [activeThumb, setActiveThumb] = (0, import_react36.useState)(null);
7507
7638
  const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
7508
7639
  const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
7509
7640
  const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
@@ -7600,7 +7731,7 @@ function Slider({
7600
7731
  }
7601
7732
 
7602
7733
  // src/components/ColorPicker.tsx
7603
- var import_react36 = require("react");
7734
+ var import_react37 = require("react");
7604
7735
  var import_jsx_runtime35 = require("react/jsx-runtime");
7605
7736
  var DEFAULT_MODES = ["solid", "gradient"];
7606
7737
  var gradientStopSeed = 0;
@@ -7691,12 +7822,12 @@ function ColorPicker({
7691
7822
  ...props
7692
7823
  }) {
7693
7824
  const size = useControlSize(sizeProp);
7694
- const rootRef = (0, import_react36.useRef)(null);
7695
- const popupRef = (0, import_react36.useRef)(null);
7696
- const lastEmittedValue = (0, import_react36.useRef)();
7825
+ const rootRef = (0, import_react37.useRef)(null);
7826
+ const popupRef = (0, import_react37.useRef)(null);
7827
+ const lastEmittedValue = (0, import_react37.useRef)();
7697
7828
  const initialGradient = parseGradient(value ?? defaultValue);
7698
7829
  const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
7699
- const [open, setOpen] = (0, import_react36.useState)(false);
7830
+ const [open, setOpen] = (0, import_react37.useState)(false);
7700
7831
  const [color, setColor] = useControllableState({
7701
7832
  value,
7702
7833
  defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
@@ -7707,17 +7838,17 @@ function ColorPicker({
7707
7838
  defaultValue: initialGradient ? "gradient" : defaultMode,
7708
7839
  onChange: onModeChange
7709
7840
  });
7710
- const [solidColor, setSolidColor] = (0, import_react36.useState)(initialSolid);
7711
- const [gradientAngle, setGradientAngle] = (0, import_react36.useState)(initialGradient?.angle ?? 90);
7712
- const [gradientStops, setGradientStops] = (0, import_react36.useState)(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
7713
- const [activeStopId, setActiveStopId] = (0, import_react36.useState)(() => gradientStops[0]?.id ?? 0);
7841
+ const [solidColor, setSolidColor] = (0, import_react37.useState)(initialSolid);
7842
+ const [gradientAngle, setGradientAngle] = (0, import_react37.useState)(initialGradient?.angle ?? 90);
7843
+ const [gradientStops, setGradientStops] = (0, import_react37.useState)(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
7844
+ const [activeStopId, setActiveStopId] = (0, import_react37.useState)(() => gradientStops[0]?.id ?? 0);
7714
7845
  const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
7715
7846
  const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
7716
7847
  const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
7717
7848
  const hsv = rgbToHsv(rgba);
7718
- const [hexDraft, setHexDraft] = (0, import_react36.useState)(editingColor);
7849
+ const [hexDraft, setHexDraft] = (0, import_react37.useState)(editingColor);
7719
7850
  const gradientValue = formatGradient(gradientAngle, gradientStops);
7720
- (0, import_react36.useEffect)(() => {
7851
+ (0, import_react37.useEffect)(() => {
7721
7852
  if (!open) return void 0;
7722
7853
  const close = (event) => {
7723
7854
  const target = event.target;
@@ -7726,10 +7857,10 @@ function ColorPicker({
7726
7857
  document.addEventListener("pointerdown", close);
7727
7858
  return () => document.removeEventListener("pointerdown", close);
7728
7859
  }, [open]);
7729
- (0, import_react36.useEffect)(() => {
7860
+ (0, import_react37.useEffect)(() => {
7730
7861
  setHexDraft(editingColor);
7731
7862
  }, [editingColor]);
7732
- (0, import_react36.useEffect)(() => {
7863
+ (0, import_react37.useEffect)(() => {
7733
7864
  if (value === void 0 || value === lastEmittedValue.current) return;
7734
7865
  const parsed = parseGradient(value);
7735
7866
  if (parsed) {
@@ -7916,10 +8047,10 @@ function ColorPicker({
7916
8047
  }
7917
8048
 
7918
8049
  // src/components/DatePicker.tsx
7919
- var import_react38 = require("react");
8050
+ var import_react39 = require("react");
7920
8051
 
7921
8052
  // src/components/DatePickerPanel.tsx
7922
- var import_react37 = require("react");
8053
+ var import_react38 = require("react");
7923
8054
  var import_jsx_runtime36 = require("react/jsx-runtime");
7924
8055
  function pad2(value) {
7925
8056
  return String(value).padStart(2, "0");
@@ -8063,12 +8194,12 @@ function TimePanel({
8063
8194
  onChange
8064
8195
  }) {
8065
8196
  const [hour = "00", minute = "00", second = "00"] = value.split(":");
8066
- const columnsRef = (0, import_react37.useRef)(null);
8067
- const hourRef = (0, import_react37.useRef)(null);
8068
- const minuteRef = (0, import_react37.useRef)(null);
8069
- const secondRef = (0, import_react37.useRef)(null);
8197
+ const columnsRef = (0, import_react38.useRef)(null);
8198
+ const hourRef = (0, import_react38.useRef)(null);
8199
+ const minuteRef = (0, import_react38.useRef)(null);
8200
+ const secondRef = (0, import_react38.useRef)(null);
8070
8201
  const columnRefs = [hourRef, minuteRef, secondRef];
8071
- (0, import_react37.useLayoutEffect)(() => {
8202
+ (0, import_react38.useLayoutEffect)(() => {
8072
8203
  for (const column of columnsRef.current?.children ?? []) {
8073
8204
  const selected = column.querySelector('[aria-selected="true"]');
8074
8205
  const first = column.firstElementChild;
@@ -8209,23 +8340,23 @@ function DatePicker({
8209
8340
  ...props
8210
8341
  }) {
8211
8342
  const size = useControlSize(sizeProp);
8212
- const id = (0, import_react38.useId)();
8213
- const rootRef = (0, import_react38.useRef)(null);
8214
- const popupRef = (0, import_react38.useRef)(null);
8343
+ const id = (0, import_react39.useId)();
8344
+ const rootRef = (0, import_react39.useRef)(null);
8345
+ const popupRef = (0, import_react39.useRef)(null);
8215
8346
  const initialValue = defaultValue ?? (multiple ? [] : "");
8216
8347
  const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue: initialValue, onChange });
8217
8348
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
8218
- const [draftValue, setDraftValue] = (0, import_react38.useState)(currentValue);
8349
+ const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
8219
8350
  const firstCurrent = Array.isArray(currentValue) ? currentValue[0] : currentValue;
8220
- const [viewMonth, setViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
8221
- const [draftTime, setDraftTime] = (0, import_react38.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
8351
+ const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
8352
+ const [draftTime, setDraftTime] = (0, import_react39.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
8222
8353
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
8223
8354
  const showSecond = showSecondFrom(showTime);
8224
- const selectedDates = (0, import_react38.useMemo)(() => {
8355
+ const selectedDates = (0, import_react39.useMemo)(() => {
8225
8356
  const values = Array.isArray(draftValue) ? draftValue : draftValue ? [draftValue] : [];
8226
8357
  return values.map(dayFromValue).filter(Boolean);
8227
8358
  }, [draftValue]);
8228
- (0, import_react38.useEffect)(() => {
8359
+ (0, import_react39.useEffect)(() => {
8229
8360
  if (!visible) return void 0;
8230
8361
  const close = (event) => {
8231
8362
  const target = event.target;
@@ -8399,15 +8530,15 @@ function DateRangePicker({
8399
8530
  ...props
8400
8531
  }) {
8401
8532
  const size = useControlSize(sizeProp);
8402
- const id = (0, import_react38.useId)();
8403
- const rootRef = (0, import_react38.useRef)(null);
8404
- const popupRef = (0, import_react38.useRef)(null);
8533
+ const id = (0, import_react39.useId)();
8534
+ const rootRef = (0, import_react39.useRef)(null);
8535
+ const popupRef = (0, import_react39.useRef)(null);
8405
8536
  const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
8406
8537
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
8407
- const [draftValue, setDraftValue] = (0, import_react38.useState)(currentValue);
8408
- const [activeIndex, setActiveIndex] = (0, import_react38.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
8409
- const indicatorRef = (0, import_react38.useRef)(null);
8410
- (0, import_react38.useLayoutEffect)(() => {
8538
+ const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
8539
+ const [activeIndex, setActiveIndex] = (0, import_react39.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
8540
+ const indicatorRef = (0, import_react39.useRef)(null);
8541
+ (0, import_react39.useLayoutEffect)(() => {
8411
8542
  const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
8412
8543
  const indicator = indicatorRef.current;
8413
8544
  if (!field || !indicator) return;
@@ -8424,22 +8555,22 @@ function DateRangePicker({
8424
8555
  }
8425
8556
  return () => observer.disconnect();
8426
8557
  });
8427
- const [confirmedIndex, setConfirmedIndex] = (0, import_react38.useState)(null);
8428
- const [presetSelected, setPresetSelected] = (0, import_react38.useState)(false);
8429
- const [hoverDate, setHoverDate] = (0, import_react38.useState)("");
8430
- const [viewMonth, setViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
8431
- const [endViewMonth, setEndViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
8558
+ const [confirmedIndex, setConfirmedIndex] = (0, import_react39.useState)(null);
8559
+ const [presetSelected, setPresetSelected] = (0, import_react39.useState)(false);
8560
+ const [hoverDate, setHoverDate] = (0, import_react39.useState)("");
8561
+ const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
8562
+ const [endViewMonth, setEndViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
8432
8563
  const showSecond = showSecondFrom(showTime);
8433
8564
  const defaultTime = defaultTimeFrom(showTime);
8434
8565
  const defaultEndTime = defaultTimeFrom(showTime, 1);
8435
- const [times, setTimes] = (0, import_react38.useState)([
8566
+ const [times, setTimes] = (0, import_react39.useState)([
8436
8567
  timePart(currentValue[0], defaultTime),
8437
8568
  timePart(currentValue[1], defaultEndTime)
8438
8569
  ]);
8439
8570
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
8440
8571
  const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
8441
8572
  const invalidDateTimeRange = Boolean(showTime && draftValue[0] && draftValue[1] && draftValue[0] > draftValue[1]);
8442
- (0, import_react38.useEffect)(() => {
8573
+ (0, import_react39.useEffect)(() => {
8443
8574
  if (!visible) return void 0;
8444
8575
  const close = (event) => {
8445
8576
  const target = event.target;
@@ -8828,7 +8959,7 @@ function SelectDateRange({
8828
8959
  }
8829
8960
 
8830
8961
  // src/components/TimePicker.tsx
8831
- var import_react39 = require("react");
8962
+ var import_react40 = require("react");
8832
8963
  var import_jsx_runtime39 = require("react/jsx-runtime");
8833
8964
  function seconds(value) {
8834
8965
  const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
@@ -8858,14 +8989,14 @@ function TimePicker({
8858
8989
  ...props
8859
8990
  }) {
8860
8991
  const size = useControlSize(sizeProp);
8861
- const id = (0, import_react39.useId)();
8862
- const rootRef = (0, import_react39.useRef)(null);
8863
- const inputRef = (0, import_react39.useRef)(null);
8864
- const popupRef = (0, import_react39.useRef)(null);
8865
- const focusPanel = (0, import_react39.useRef)(false);
8992
+ const id = (0, import_react40.useId)();
8993
+ const rootRef = (0, import_react40.useRef)(null);
8994
+ const inputRef = (0, import_react40.useRef)(null);
8995
+ const popupRef = (0, import_react40.useRef)(null);
8996
+ const focusPanel = (0, import_react40.useRef)(false);
8866
8997
  const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
8867
- const [open, setOpen] = (0, import_react39.useState)(false);
8868
- const [draft, setDraft] = (0, import_react39.useState)("00:00:00");
8998
+ const [open, setOpen] = (0, import_react40.useState)(false);
8999
+ const [draft, setDraft] = (0, import_react40.useState)("00:00:00");
8869
9000
  const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
8870
9001
  const unavailable = (time) => {
8871
9002
  const normalized = normalize(time);
@@ -8883,7 +9014,7 @@ function TimePicker({
8883
9014
  setOpen(next);
8884
9015
  onOpenChange?.(next);
8885
9016
  }
8886
- (0, import_react39.useEffect)(() => {
9017
+ (0, import_react40.useEffect)(() => {
8887
9018
  if (!open) return;
8888
9019
  if (focusPanel.current) {
8889
9020
  popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
@@ -9002,7 +9133,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
9002
9133
  })(TimePicker || (TimePicker = {}));
9003
9134
 
9004
9135
  // src/components/TreeSelect.tsx
9005
- var import_react40 = require("react");
9136
+ var import_react41 = require("react");
9006
9137
  var import_jsx_runtime40 = require("react/jsx-runtime");
9007
9138
  function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
9008
9139
  const result = [];
@@ -9065,9 +9196,9 @@ function TreeSelect({
9065
9196
  ...props
9066
9197
  }) {
9067
9198
  const size = useControlSize(sizeProp);
9068
- const rootRef = (0, import_react40.useRef)(null);
9069
- const popupRef = (0, import_react40.useRef)(null);
9070
- const nodeIndex = (0, import_react40.useMemo)(() => {
9199
+ const rootRef = (0, import_react41.useRef)(null);
9200
+ const popupRef = (0, import_react41.useRef)(null);
9201
+ const nodeIndex = (0, import_react41.useMemo)(() => {
9071
9202
  const index = /* @__PURE__ */ new Map();
9072
9203
  const visit = (nodes) => nodes.forEach((node) => {
9073
9204
  index.set(node.value, node);
@@ -9086,7 +9217,7 @@ function TreeSelect({
9086
9217
  });
9087
9218
  const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
9088
9219
  const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
9089
- const [expanded, setExpanded] = (0, import_react40.useState)(() => {
9220
+ const [expanded, setExpanded] = (0, import_react41.useState)(() => {
9090
9221
  if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
9091
9222
  const values = [];
9092
9223
  const collect = (nodes) => nodes.forEach((node) => {
@@ -9102,7 +9233,7 @@ function TreeSelect({
9102
9233
  const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
9103
9234
  const selectedNodes = resolveNodes(selectedValues);
9104
9235
  const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
9105
- (0, import_react40.useEffect)(() => {
9236
+ (0, import_react41.useEffect)(() => {
9106
9237
  if (!open || treeExpandedKeys) return;
9107
9238
  const keys = new Set(expanded);
9108
9239
  const walk = (nodes, parents) => nodes.forEach((node) => {
@@ -9162,7 +9293,7 @@ function TreeSelect({
9162
9293
  setCurrentValue(multi ? [] : void 0);
9163
9294
  onClear?.();
9164
9295
  }
9165
- (0, import_react40.useEffect)(() => {
9296
+ (0, import_react41.useEffect)(() => {
9166
9297
  if (!open) return void 0;
9167
9298
  const close = (event) => {
9168
9299
  const target = event.target;
@@ -9321,7 +9452,7 @@ function buildFlatTree(items, options = {}) {
9321
9452
  }
9322
9453
 
9323
9454
  // src/components/Upload.tsx
9324
- var import_react41 = require("react");
9455
+ var import_react42 = require("react");
9325
9456
 
9326
9457
  // src/components/uploadFiles.ts
9327
9458
  function acceptsUploadFile(file, accept) {
@@ -9560,8 +9691,8 @@ var message = {
9560
9691
  var import_jsx_runtime42 = require("react/jsx-runtime");
9561
9692
  var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
9562
9693
  function useThumbnail(file, accept) {
9563
- const [local, setLocal] = (0, import_react41.useState)();
9564
- (0, import_react41.useEffect)(() => {
9694
+ const [local, setLocal] = (0, import_react42.useState)();
9695
+ (0, import_react42.useEffect)(() => {
9565
9696
  if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
9566
9697
  const url = URL.createObjectURL(file.originFileObj);
9567
9698
  setLocal(url);
@@ -9573,9 +9704,9 @@ function useThumbnail(file, accept) {
9573
9704
  }
9574
9705
  function UploadItem({ file, files, props, actions }) {
9575
9706
  const source = useThumbnail(file, props.accept);
9576
- const [failed, setFailed] = (0, import_react41.useState)(false);
9577
- const [downloading, setDownloading] = (0, import_react41.useState)(false);
9578
- const downloadingRef = (0, import_react41.useRef)(false);
9707
+ const [failed, setFailed] = (0, import_react42.useState)(false);
9708
+ const [downloading, setDownloading] = (0, import_react42.useState)(false);
9709
+ const downloadingRef = (0, import_react42.useRef)(false);
9579
9710
  const canPreview = !!(source || file.url || file.originFileObj || props.onPreview);
9580
9711
  const canDownload = !!(file.url || file.originFileObj || props.downloadRequest);
9581
9712
  async function download() {
@@ -9591,7 +9722,7 @@ function UploadItem({ file, files, props, actions }) {
9591
9722
  setDownloading(false);
9592
9723
  }
9593
9724
  }
9594
- (0, import_react41.useEffect)(() => setFailed(false), [source]);
9725
+ (0, import_react42.useEffect)(() => setFailed(false), [source]);
9595
9726
  const node = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
9596
9727
  props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8\u7F29\u7565\u56FE ${file.name}`, onClick: actions.preview, disabled: !canPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__file-icon", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 24 }) }),
9597
9728
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
@@ -9613,7 +9744,7 @@ function UploadItem({ file, files, props, actions }) {
9613
9744
  ] });
9614
9745
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
9615
9746
  }
9616
- var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9747
+ var UploadRoot = (0, import_react42.forwardRef)(function UploadRoot2({
9617
9748
  accept,
9618
9749
  multiple = false,
9619
9750
  directory = false,
@@ -9652,19 +9783,19 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9652
9783
  const cardWidth = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.width);
9653
9784
  const cardHeight = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.height);
9654
9785
  const compactCard = listType === "picture-card" && (cardWidth < 88 || cardHeight < 88);
9655
- const inputRef = (0, import_react41.useRef)(null);
9656
- const [internalFiles, setInternalFiles] = (0, import_react41.useState)(defaultFileList);
9786
+ const inputRef = (0, import_react42.useRef)(null);
9787
+ const [internalFiles, setInternalFiles] = (0, import_react42.useState)(defaultFileList);
9657
9788
  const files = fileList ?? internalFiles;
9658
- const filesRef = (0, import_react41.useRef)(files);
9789
+ const filesRef = (0, import_react42.useRef)(files);
9659
9790
  filesRef.current = files;
9660
- const tasks = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
9661
- const mounted = (0, import_react41.useRef)(true);
9662
- const [dragging, setDragging] = (0, import_react41.useState)(false);
9663
- const [preview, setPreview] = (0, import_react41.useState)();
9791
+ const tasks = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
9792
+ const mounted = (0, import_react42.useRef)(true);
9793
+ const [dragging, setDragging] = (0, import_react42.useState)(false);
9794
+ const [preview, setPreview] = (0, import_react42.useState)();
9664
9795
  const previewSource = useThumbnail(preview, accept);
9665
9796
  const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
9666
9797
  const full = files.length >= limit;
9667
- const current = (0, import_react41.useRef)({ disabled, directory, recursive });
9798
+ const current = (0, import_react42.useRef)({ disabled, directory, recursive });
9668
9799
  current.current = { disabled, directory, recursive };
9669
9800
  function cancel(uid) {
9670
9801
  const task = tasks.current.get(uid);
@@ -9676,14 +9807,14 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9676
9807
  }
9677
9808
  task?.finish();
9678
9809
  }
9679
- (0, import_react41.useEffect)(() => {
9810
+ (0, import_react42.useEffect)(() => {
9680
9811
  mounted.current = true;
9681
9812
  return () => {
9682
9813
  mounted.current = false;
9683
9814
  [...tasks.current.keys()].forEach(cancel);
9684
9815
  };
9685
9816
  }, []);
9686
- (0, import_react41.useEffect)(() => {
9817
+ (0, import_react42.useEffect)(() => {
9687
9818
  for (const uid of tasks.current.keys()) if (!files.some((file) => file.uid === uid)) cancel(uid);
9688
9819
  if (preview && !files.some((file) => file.uid === preview.uid)) setPreview(void 0);
9689
9820
  }, [files, preview]);
@@ -9789,7 +9920,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9789
9920
  } catch {
9790
9921
  }
9791
9922
  }
9792
- (0, import_react41.useImperativeHandle)(ref, () => ({
9923
+ (0, import_react42.useImperativeHandle)(ref, () => ({
9793
9924
  upload: async (uid) => {
9794
9925
  await Promise.all(filesRef.current.filter((file) => (!uid || file.uid === uid) && file.status !== "done").map(start));
9795
9926
  },
@@ -9917,7 +10048,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9917
10048
  }
9918
10049
  );
9919
10050
  });
9920
- var UploadDragger = (0, import_react41.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
10051
+ var UploadDragger = (0, import_react42.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
9921
10052
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "sia-upload-dragger__content", children: [
9922
10053
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "upload", size: 32 }),
9923
10054
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("strong", { children: [
@@ -9937,7 +10068,7 @@ var Upload = Object.assign(UploadRoot, {
9937
10068
  });
9938
10069
 
9939
10070
  // src/components/RichTextEditor.tsx
9940
- var import_react42 = require("react");
10071
+ var import_react43 = require("react");
9941
10072
  var import_dompurify = __toESM(require("dompurify"), 1);
9942
10073
  var import_core = require("@tiptap/core");
9943
10074
  var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
@@ -9966,7 +10097,7 @@ function sanitizeContent(value) {
9966
10097
  }).replace(/<img\b/giu, '<img loading="lazy" decoding="async"');
9967
10098
  }
9968
10099
  function RichTextContent({ content, emptyText = "\u6682\u65E0\u5185\u5BB9", className = "", ...props }) {
9969
- const html = (0, import_react42.useMemo)(() => sanitizeContent(content), [content]);
10100
+ const html = (0, import_react43.useMemo)(() => sanitizeContent(content), [content]);
9970
10101
  if (!html.trim()) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `sia-rich-text-content sia-rich-text-content--empty ${className}`.trim(), children: emptyText });
9971
10102
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("article", { className: `sia-rich-text-content ${className}`.trim(), dangerouslySetInnerHTML: { __html: html }, ...withTitleTooltip(props) });
9972
10103
  }
@@ -9989,31 +10120,31 @@ function RichTextEditor({
9989
10120
  "aria-label": ariaLabel,
9990
10121
  ...props
9991
10122
  }) {
9992
- const initialValueRef = (0, import_react42.useRef)(value ?? defaultValue);
9993
- const lastEmittedValueRef = (0, import_react42.useRef)(value ?? defaultValue);
9994
- const onChangeRef = (0, import_react42.useRef)(onChange);
9995
- const onPasteImageRef = (0, import_react42.useRef)(onPasteImage);
9996
- const saveShortcutRef = (0, import_react42.useRef)(saveShortcut);
9997
- const contentFormatRef = (0, import_react42.useRef)(contentFormat);
9998
- const editorElementRef = (0, import_react42.useRef)(null);
9999
- const editorRef = (0, import_react42.useRef)(null);
10000
- const [editor, setEditor] = (0, import_react42.useState)(null);
10001
- const [linkEditorOpen, setLinkEditorOpen] = (0, import_react42.useState)(false);
10002
- const [linkHref, setLinkHref] = (0, import_react42.useState)("");
10003
- const [, setEditorRevision] = (0, import_react42.useState)(0);
10004
- (0, import_react42.useEffect)(() => {
10123
+ const initialValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10124
+ const lastEmittedValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10125
+ const onChangeRef = (0, import_react43.useRef)(onChange);
10126
+ const onPasteImageRef = (0, import_react43.useRef)(onPasteImage);
10127
+ const saveShortcutRef = (0, import_react43.useRef)(saveShortcut);
10128
+ const contentFormatRef = (0, import_react43.useRef)(contentFormat);
10129
+ const editorElementRef = (0, import_react43.useRef)(null);
10130
+ const editorRef = (0, import_react43.useRef)(null);
10131
+ const [editor, setEditor] = (0, import_react43.useState)(null);
10132
+ const [linkEditorOpen, setLinkEditorOpen] = (0, import_react43.useState)(false);
10133
+ const [linkHref, setLinkHref] = (0, import_react43.useState)("");
10134
+ const [, setEditorRevision] = (0, import_react43.useState)(0);
10135
+ (0, import_react43.useEffect)(() => {
10005
10136
  onChangeRef.current = onChange;
10006
10137
  }, [onChange]);
10007
- (0, import_react42.useEffect)(() => {
10138
+ (0, import_react43.useEffect)(() => {
10008
10139
  onPasteImageRef.current = onPasteImage;
10009
10140
  }, [onPasteImage]);
10010
- (0, import_react42.useEffect)(() => {
10141
+ (0, import_react43.useEffect)(() => {
10011
10142
  saveShortcutRef.current = saveShortcut;
10012
10143
  }, [saveShortcut]);
10013
- (0, import_react42.useEffect)(() => {
10144
+ (0, import_react43.useEffect)(() => {
10014
10145
  contentFormatRef.current = contentFormat;
10015
10146
  }, [contentFormat]);
10016
- const extensions = (0, import_react42.useMemo)(() => [
10147
+ const extensions = (0, import_react43.useMemo)(() => [
10017
10148
  import_starter_kit.default.configure({
10018
10149
  heading: { levels: [1, 2, 3, 4, 5, 6] },
10019
10150
  link: { openOnClick: false, autolink: true, linkOnPaste: true },
@@ -10029,7 +10160,7 @@ function RichTextEditor({
10029
10160
  import_extension_task_item.default.configure({ nested: true }),
10030
10161
  import_markdown.Markdown.configure({ markedOptions: { gfm: true } })
10031
10162
  ], [placeholder]);
10032
- (0, import_react42.useEffect)(() => {
10163
+ (0, import_react43.useEffect)(() => {
10033
10164
  const element = editorElementRef.current;
10034
10165
  if (!element) return;
10035
10166
  const nextEditor = new import_core.Editor({
@@ -10086,10 +10217,10 @@ function RichTextEditor({
10086
10217
  nextEditor.destroy();
10087
10218
  };
10088
10219
  }, [ariaLabel, extensions]);
10089
- (0, import_react42.useEffect)(() => {
10220
+ (0, import_react43.useEffect)(() => {
10090
10221
  editor?.setEditable(!disabled);
10091
10222
  }, [disabled, editor]);
10092
- (0, import_react42.useEffect)(() => {
10223
+ (0, import_react43.useEffect)(() => {
10093
10224
  if (!editor || value === void 0 || value === lastEmittedValueRef.current) return;
10094
10225
  editor.commands.setContent(value, { emitUpdate: false, contentType: contentFormat });
10095
10226
  lastEmittedValueRef.current = value;
@@ -10224,7 +10355,7 @@ function RichTextEditor({
10224
10355
  }
10225
10356
 
10226
10357
  // src/components/MarkdownEditor.tsx
10227
- var import_react43 = require("react");
10358
+ var import_react44 = require("react");
10228
10359
  var import_dist = require("vditor/dist/index.css");
10229
10360
 
10230
10361
  // src/components/markdownPaste.ts
@@ -10451,21 +10582,21 @@ function MarkdownEditor({
10451
10582
  style,
10452
10583
  ...props
10453
10584
  }) {
10454
- const mountRef = (0, import_react43.useRef)(null);
10455
- const editorRef = (0, import_react43.useRef)(null);
10456
- const onChangeRef = (0, import_react43.useRef)(onChange);
10457
- const saveShortcutRef = (0, import_react43.useRef)(saveShortcut);
10458
- const uploadImageRef = (0, import_react43.useRef)(onUploadImage);
10459
- const disabledRef = (0, import_react43.useRef)(disabled);
10460
- const smartMarkdownPasteRef = (0, import_react43.useRef)(smartMarkdownPaste);
10461
- const valueRef = (0, import_react43.useRef)(value ?? defaultValue);
10462
- const lastEmittedValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10463
- const [hasContent, setHasContent] = (0, import_react43.useState)(Boolean((value ?? defaultValue).trim()));
10585
+ const mountRef = (0, import_react44.useRef)(null);
10586
+ const editorRef = (0, import_react44.useRef)(null);
10587
+ const onChangeRef = (0, import_react44.useRef)(onChange);
10588
+ const saveShortcutRef = (0, import_react44.useRef)(saveShortcut);
10589
+ const uploadImageRef = (0, import_react44.useRef)(onUploadImage);
10590
+ const disabledRef = (0, import_react44.useRef)(disabled);
10591
+ const smartMarkdownPasteRef = (0, import_react44.useRef)(smartMarkdownPaste);
10592
+ const valueRef = (0, import_react44.useRef)(value ?? defaultValue);
10593
+ const lastEmittedValueRef = (0, import_react44.useRef)(value ?? defaultValue);
10594
+ const [hasContent, setHasContent] = (0, import_react44.useState)(Boolean((value ?? defaultValue).trim()));
10464
10595
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: hasContent });
10465
- const [ready, setReady] = (0, import_react43.useState)(false);
10466
- const [loadError, setLoadError] = (0, import_react43.useState)("");
10596
+ const [ready, setReady] = (0, import_react44.useState)(false);
10597
+ const [loadError, setLoadError] = (0, import_react44.useState)("");
10467
10598
  const hasImageUpload = Boolean(onUploadImage);
10468
- (0, import_react43.useEffect)(() => {
10599
+ (0, import_react44.useEffect)(() => {
10469
10600
  if (value !== void 0) setHasContent(Boolean(value.trim()));
10470
10601
  }, [value]);
10471
10602
  onChangeRef.current = onChange;
@@ -10474,7 +10605,7 @@ function MarkdownEditor({
10474
10605
  disabledRef.current = disabled;
10475
10606
  smartMarkdownPasteRef.current = smartMarkdownPaste;
10476
10607
  valueRef.current = value ?? valueRef.current;
10477
- (0, import_react43.useEffect)(() => {
10608
+ (0, import_react44.useEffect)(() => {
10478
10609
  const mount = mountRef.current;
10479
10610
  if (!mount) return;
10480
10611
  let disposed = false;
@@ -10576,14 +10707,14 @@ function MarkdownEditor({
10576
10707
  if (editorInitialized) createdEditor?.destroy();
10577
10708
  };
10578
10709
  }, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder, floating.enabled]);
10579
- (0, import_react43.useEffect)(() => {
10710
+ (0, import_react44.useEffect)(() => {
10580
10711
  const editor = editorRef.current;
10581
10712
  if (!editor || value === void 0) return;
10582
10713
  if (value === lastEmittedValueRef.current || editor.getValue() === value) return;
10583
10714
  lastEmittedValueRef.current = value;
10584
10715
  editor.setValue(value, true);
10585
10716
  }, [ready, value]);
10586
- (0, import_react43.useEffect)(() => {
10717
+ (0, import_react44.useEffect)(() => {
10587
10718
  const editor = editorRef.current;
10588
10719
  if (!editor) return;
10589
10720
  if (disabled) editor.disabled();
@@ -10615,7 +10746,7 @@ function MarkdownEditor({
10615
10746
  }
10616
10747
 
10617
10748
  // src/components/Editor.tsx
10618
- var import_react44 = require("react");
10749
+ var import_react45 = require("react");
10619
10750
  var import_editor_worker = __toESM(require("monaco-editor/editor/editor.worker.js?worker"), 1);
10620
10751
 
10621
10752
  // src/components/jsonLanguage.ts
@@ -11290,30 +11421,30 @@ function Editor({
11290
11421
  ariaLabel = "\u4EE3\u7801\u7F16\u8F91\u5668",
11291
11422
  loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
11292
11423
  }) {
11293
- const generatedId = (0, import_react44.useId)();
11294
- const containerRef = (0, import_react44.useRef)(null);
11295
- const rangeHighlightRef = (0, import_react44.useRef)(null);
11296
- const editorRef = (0, import_react44.useRef)(null);
11297
- const modelRef = (0, import_react44.useRef)(null);
11298
- const apiRef = (0, import_react44.useRef)(null);
11299
- const applyingControlledValueRef = (0, import_react44.useRef)(false);
11300
- const updateHighlightRef = (0, import_react44.useRef)(() => void 0);
11301
- const changeHandlerRef = (0, import_react44.useRef)(onChange);
11302
- const readyHandlerRef = (0, import_react44.useRef)(onReady);
11303
- const selectionHandlerRef = (0, import_react44.useRef)(onSelectionChange);
11304
- const keyDownHandlerRef = (0, import_react44.useRef)(onKeyDown);
11305
- const highlightRangeRef = (0, import_react44.useRef)(highlightRange);
11306
- const markersRef = (0, import_react44.useRef)(markers);
11307
- const contextMenuItemsRef = (0, import_react44.useRef)(contextMenuItems);
11308
- const completionProviderRef = (0, import_react44.useRef)(completionProvider);
11309
- const refreshSuggestionOnSpaceRef = (0, import_react44.useRef)(refreshSuggestionOnSpace);
11310
- const initialValueRef = (0, import_react44.useRef)(value);
11311
- const initialLanguageRef = (0, import_react44.useRef)(language);
11312
- const initialPathRef = (0, import_react44.useRef)(path);
11313
- const initialThemeRef = (0, import_react44.useRef)(theme);
11314
- const initialOptionsRef = (0, import_react44.useRef)(options);
11315
- const [loading, setLoading] = (0, import_react44.useState)(true);
11316
- const [, setSelectionVersion] = (0, import_react44.useState)(0);
11424
+ const generatedId = (0, import_react45.useId)();
11425
+ const containerRef = (0, import_react45.useRef)(null);
11426
+ const rangeHighlightRef = (0, import_react45.useRef)(null);
11427
+ const editorRef = (0, import_react45.useRef)(null);
11428
+ const modelRef = (0, import_react45.useRef)(null);
11429
+ const apiRef = (0, import_react45.useRef)(null);
11430
+ const applyingControlledValueRef = (0, import_react45.useRef)(false);
11431
+ const updateHighlightRef = (0, import_react45.useRef)(() => void 0);
11432
+ const changeHandlerRef = (0, import_react45.useRef)(onChange);
11433
+ const readyHandlerRef = (0, import_react45.useRef)(onReady);
11434
+ const selectionHandlerRef = (0, import_react45.useRef)(onSelectionChange);
11435
+ const keyDownHandlerRef = (0, import_react45.useRef)(onKeyDown);
11436
+ const highlightRangeRef = (0, import_react45.useRef)(highlightRange);
11437
+ const markersRef = (0, import_react45.useRef)(markers);
11438
+ const contextMenuItemsRef = (0, import_react45.useRef)(contextMenuItems);
11439
+ const completionProviderRef = (0, import_react45.useRef)(completionProvider);
11440
+ const refreshSuggestionOnSpaceRef = (0, import_react45.useRef)(refreshSuggestionOnSpace);
11441
+ const initialValueRef = (0, import_react45.useRef)(value);
11442
+ const initialLanguageRef = (0, import_react45.useRef)(language);
11443
+ const initialPathRef = (0, import_react45.useRef)(path);
11444
+ const initialThemeRef = (0, import_react45.useRef)(theme);
11445
+ const initialOptionsRef = (0, import_react45.useRef)(options);
11446
+ const [loading, setLoading] = (0, import_react45.useState)(true);
11447
+ const [, setSelectionVersion] = (0, import_react45.useState)(0);
11317
11448
  initialValueRef.current = value;
11318
11449
  initialLanguageRef.current = language;
11319
11450
  initialPathRef.current = path;
@@ -11328,7 +11459,7 @@ function Editor({
11328
11459
  contextMenuItemsRef.current = contextMenuItems;
11329
11460
  completionProviderRef.current = completionProvider;
11330
11461
  refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
11331
- (0, import_react44.useEffect)(() => {
11462
+ (0, import_react45.useEffect)(() => {
11332
11463
  let disposed = false;
11333
11464
  const subscriptions = [];
11334
11465
  async function mountEditor() {
@@ -11672,7 +11803,7 @@ function Editor({
11672
11803
  updateHighlightRef.current = () => void 0;
11673
11804
  };
11674
11805
  }, [generatedId]);
11675
- (0, import_react44.useEffect)(() => {
11806
+ (0, import_react45.useEffect)(() => {
11676
11807
  const model = modelRef.current;
11677
11808
  if (!model || model.getValue() === value) return;
11678
11809
  applyingControlledValueRef.current = true;
@@ -11682,7 +11813,7 @@ function Editor({
11682
11813
  applyingControlledValueRef.current = false;
11683
11814
  }
11684
11815
  }, [loading, value]);
11685
- (0, import_react44.useEffect)(() => {
11816
+ (0, import_react45.useEffect)(() => {
11686
11817
  if (loading) return;
11687
11818
  void loadMonaco().then((monaco) => {
11688
11819
  const model = modelRef.current;
@@ -11691,7 +11822,7 @@ function Editor({
11691
11822
  }, [language, loading]);
11692
11823
  const completionEnabled = Boolean(completionProvider);
11693
11824
  const completionTriggerKey = completionTriggerCharacters.join("\0");
11694
- (0, import_react44.useEffect)(() => {
11825
+ (0, import_react45.useEffect)(() => {
11695
11826
  if (loading || !completionEnabled) return void 0;
11696
11827
  let disposed = false;
11697
11828
  let subscription;
@@ -11765,23 +11896,23 @@ function Editor({
11765
11896
  subscription?.dispose();
11766
11897
  };
11767
11898
  }, [completionEnabled, completionTriggerKey, language, loading]);
11768
- (0, import_react44.useEffect)(() => {
11899
+ (0, import_react45.useEffect)(() => {
11769
11900
  if (loading) return;
11770
11901
  void loadMonaco().then((monaco) => {
11771
11902
  if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
11772
11903
  });
11773
11904
  }, [loading, theme]);
11774
- (0, import_react44.useEffect)(() => {
11905
+ (0, import_react45.useEffect)(() => {
11775
11906
  if (loading) return;
11776
11907
  editorRef.current?.updateOptions({
11777
11908
  ...options ?? {},
11778
11909
  contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
11779
11910
  });
11780
11911
  }, [contextMenuItems.length, loading, options]);
11781
- (0, import_react44.useEffect)(() => {
11912
+ (0, import_react45.useEffect)(() => {
11782
11913
  updateHighlightRef.current();
11783
11914
  }, [highlightRange]);
11784
- (0, import_react44.useEffect)(() => {
11915
+ (0, import_react45.useEffect)(() => {
11785
11916
  if (loading) return;
11786
11917
  void loadMonaco().then((monaco) => {
11787
11918
  const model = modelRef.current;
@@ -11849,19 +11980,19 @@ function Editor({
11849
11980
  }
11850
11981
 
11851
11982
  // src/components/Markdown.tsx
11852
- var import_react45 = require("react");
11983
+ var import_react46 = require("react");
11853
11984
  var import_dompurify2 = __toESM(require("dompurify"), 1);
11854
11985
  var import_marked = require("marked");
11855
11986
  var import_jsx_runtime46 = require("react/jsx-runtime");
11856
11987
  function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
11857
- const rootRef = (0, import_react45.useRef)(null);
11858
- const [previewImage, setPreviewImage] = (0, import_react45.useState)(null);
11859
- const html = (0, import_react45.useMemo)(() => {
11988
+ const rootRef = (0, import_react46.useRef)(null);
11989
+ const [previewImage, setPreviewImage] = (0, import_react46.useState)(null);
11990
+ const html = (0, import_react46.useMemo)(() => {
11860
11991
  const rendered = import_marked.marked.parse(content, { breaks: true, gfm: true });
11861
11992
  const sanitized = import_dompurify2.default.sanitize(rendered, { USE_PROFILES: { html: true } });
11862
11993
  return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
11863
11994
  }, [content]);
11864
- (0, import_react45.useEffect)(() => {
11995
+ (0, import_react46.useEffect)(() => {
11865
11996
  const root = rootRef.current;
11866
11997
  if (!root) return void 0;
11867
11998
  let cancelled = false;
@@ -11929,13 +12060,13 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
11929
12060
  }
11930
12061
 
11931
12062
  // src/components/InputNumber.tsx
11932
- var import_react46 = require("react");
12063
+ var import_react47 = require("react");
11933
12064
  var import_jsx_runtime47 = require("react/jsx-runtime");
11934
12065
  function formatValue(value, precision) {
11935
12066
  if (value === null || !Number.isFinite(value)) return "";
11936
12067
  return precision === void 0 ? String(value) : value.toFixed(precision);
11937
12068
  }
11938
- var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
12069
+ var InputNumber = (0, import_react47.forwardRef)(function InputNumber2({
11939
12070
  value,
11940
12071
  defaultValue = null,
11941
12072
  onChange,
@@ -11961,16 +12092,16 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
11961
12092
  ...props
11962
12093
  }, forwardedRef) {
11963
12094
  const size = useControlSize(sizeProp);
11964
- const fallbackId = (0, import_react46.useId)();
12095
+ const fallbackId = (0, import_react47.useId)();
11965
12096
  const inputId = id ?? fallbackId;
11966
- const localRef = (0, import_react46.useRef)(null);
12097
+ const localRef = (0, import_react47.useRef)(null);
11967
12098
  const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
11968
12099
  const displayValue = (next) => {
11969
12100
  const plain = formatValue(next, precision);
11970
12101
  return plain && formatter ? formatter(plain) : plain;
11971
12102
  };
11972
- const [text, setText] = (0, import_react46.useState)(() => displayValue(currentValue));
11973
- (0, import_react46.useEffect)(() => {
12103
+ const [text, setText] = (0, import_react47.useState)(() => displayValue(currentValue));
12104
+ (0, import_react47.useEffect)(() => {
11974
12105
  setText(displayValue(currentValue));
11975
12106
  }, [currentValue, precision, formatter]);
11976
12107
  function setRef(node) {
@@ -12076,11 +12207,11 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
12076
12207
  });
12077
12208
 
12078
12209
  // src/components/SelectModal.tsx
12079
- var import_react47 = require("react");
12210
+ var import_react48 = require("react");
12080
12211
  var import_jsx_runtime48 = require("react/jsx-runtime");
12081
12212
  function SelectModalBody({ config, values, disabled, onChange }) {
12082
- const [query, setQuery] = (0, import_react47.useState)("");
12083
- const [selectedOnly, setSelectedOnly] = (0, import_react47.useState)(false);
12213
+ const [query, setQuery] = (0, import_react48.useState)("");
12214
+ const [selectedOnly, setSelectedOnly] = (0, import_react48.useState)(false);
12084
12215
  const multiple = config.mode === "multiple";
12085
12216
  const search = query.trim();
12086
12217
  const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
@@ -12254,9 +12385,9 @@ function Tag({
12254
12385
  }
12255
12386
 
12256
12387
  // src/components/Tabs.tsx
12257
- var import_react48 = require("react");
12258
- var import_jsx_runtime50 = require("react/jsx-runtime");
12259
12388
  var import_react49 = require("react");
12389
+ var import_jsx_runtime50 = require("react/jsx-runtime");
12390
+ var import_react50 = require("react");
12260
12391
  function Tabs({
12261
12392
  items,
12262
12393
  activeKey,
@@ -12281,22 +12412,22 @@ function Tabs({
12281
12412
  ...props
12282
12413
  }) {
12283
12414
  const firstEnabledKey = items.find((item) => !item.disabled)?.key ?? "";
12284
- const [internalActiveKey, setInternalActiveKey] = (0, import_react48.useState)(defaultActiveKey ?? firstEnabledKey);
12415
+ const [internalActiveKey, setInternalActiveKey] = (0, import_react49.useState)(defaultActiveKey ?? firstEnabledKey);
12285
12416
  const currentKey = activeKey ?? internalActiveKey;
12286
12417
  const selectedKey = items.some((item) => item.key === currentKey && !item.disabled) ? currentKey : firstEnabledKey;
12287
- const baseId = (0, import_react48.useId)().replace(/:/g, "");
12288
- const enabledItems = (0, import_react48.useMemo)(() => items.filter((item) => !item.disabled), [items]);
12418
+ const baseId = (0, import_react49.useId)().replace(/:/g, "");
12419
+ const enabledItems = (0, import_react49.useMemo)(() => items.filter((item) => !item.disabled), [items]);
12289
12420
  const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
12290
12421
  const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
12291
12422
  const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
12292
- const listRef = (0, import_react48.useRef)(null);
12293
- const indicatorRef = (0, import_react48.useRef)(null);
12294
- const moreRef = (0, import_react48.useRef)(null);
12295
- const [overflow, setOverflow] = (0, import_react48.useState)({ count: items.length, width: 0 });
12296
- const [moreOpen, setMoreOpen] = (0, import_react48.useState)(false);
12423
+ const listRef = (0, import_react49.useRef)(null);
12424
+ const indicatorRef = (0, import_react49.useRef)(null);
12425
+ const moreRef = (0, import_react49.useRef)(null);
12426
+ const [overflow, setOverflow] = (0, import_react49.useState)({ count: items.length, width: 0 });
12427
+ const [moreOpen, setMoreOpen] = (0, import_react49.useState)(false);
12297
12428
  const visibleCount = resolvedOrientation === "horizontal" ? overflow.count : items.length;
12298
12429
  const hiddenItems = items.slice(visibleCount);
12299
- (0, import_react48.useLayoutEffect)(() => {
12430
+ (0, import_react49.useLayoutEffect)(() => {
12300
12431
  const list = listRef.current;
12301
12432
  if (!list || resolvedOrientation !== "horizontal") return;
12302
12433
  const entries = Array.from(list.children).filter((node) => node instanceof HTMLElement && node.hasAttribute("data-tab-entry"));
@@ -12327,13 +12458,13 @@ function Tabs({
12327
12458
  entries.forEach((entry) => observer.observe(entry));
12328
12459
  return () => observer.disconnect();
12329
12460
  }, [items, type, size, closable, resolvedOrientation, tabBarTitle, tabBarExtraContent]);
12330
- const [contentState, setContentState] = (0, import_react48.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
12331
- const settledKeyRef = (0, import_react48.useRef)(selectedKey);
12332
- const afterChangeRef = (0, import_react48.useRef)(onAfterChange);
12333
- (0, import_react48.useLayoutEffect)(() => {
12461
+ const [contentState, setContentState] = (0, import_react49.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
12462
+ const settledKeyRef = (0, import_react49.useRef)(selectedKey);
12463
+ const afterChangeRef = (0, import_react49.useRef)(onAfterChange);
12464
+ (0, import_react49.useLayoutEffect)(() => {
12334
12465
  afterChangeRef.current = onAfterChange;
12335
12466
  }, [onAfterChange]);
12336
- (0, import_react48.useLayoutEffect)(() => {
12467
+ (0, import_react49.useLayoutEffect)(() => {
12337
12468
  if (!sliding) return;
12338
12469
  const list = listRef.current;
12339
12470
  const indicator = indicatorRef.current;
@@ -12363,7 +12494,7 @@ function Tabs({
12363
12494
  list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
12364
12495
  return () => observer.disconnect();
12365
12496
  }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount]);
12366
- (0, import_react48.useEffect)(() => {
12497
+ (0, import_react49.useEffect)(() => {
12367
12498
  let cancelled = false;
12368
12499
  let frame = 0;
12369
12500
  frame = requestAnimationFrame(() => {
@@ -12430,7 +12561,7 @@ function Tabs({
12430
12561
  const canClose = item.closable ?? closable;
12431
12562
  const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
12432
12563
  const entryProps = { "data-tab-entry": "", "data-tab-hidden": index >= visibleCount, "aria-hidden": index >= visibleCount || void 0 };
12433
- const tabNode = /* @__PURE__ */ (0, import_react49.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
12564
+ const tabNode = /* @__PURE__ */ (0, import_react50.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
12434
12565
  "button",
12435
12566
  {
12436
12567
  id: `${baseId}-tab-${item.key}`,
@@ -12461,7 +12592,7 @@ function Tabs({
12461
12592
  }
12462
12593
  ) : null);
12463
12594
  if (!contextMenuItems?.length) return tabNode;
12464
- return /* @__PURE__ */ (0, import_react49.createElement)(
12595
+ return /* @__PURE__ */ (0, import_react50.createElement)(
12465
12596
  Dropdown,
12466
12597
  {
12467
12598
  ...entryProps,
@@ -12524,9 +12655,9 @@ function Tabs({
12524
12655
  }
12525
12656
 
12526
12657
  // src/components/Treemap.tsx
12527
- var import_react50 = require("react");
12528
- var import_jsx_runtime51 = require("react/jsx-runtime");
12529
12658
  var import_react51 = require("react");
12659
+ var import_jsx_runtime51 = require("react/jsx-runtime");
12660
+ var import_react52 = require("react");
12530
12661
  function positiveValue(value) {
12531
12662
  return Number.isFinite(value) && value > 0 ? value : 1;
12532
12663
  }
@@ -12897,19 +13028,19 @@ function Treemap({
12897
13028
  style,
12898
13029
  ...props
12899
13030
  }) {
12900
- const containerRef = (0, import_react50.useRef)(null);
12901
- const [size, setSize] = (0, import_react50.useState)({ width: 0, height: 0 });
12902
- const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react50.useState)(() => [...defaultExpandedKeys]);
12903
- const [internalFocusedKey, setInternalFocusedKey] = (0, import_react50.useState)(defaultFocusedKey);
13031
+ const containerRef = (0, import_react51.useRef)(null);
13032
+ const [size, setSize] = (0, import_react51.useState)({ width: 0, height: 0 });
13033
+ const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react51.useState)(() => [...defaultExpandedKeys]);
13034
+ const [internalFocusedKey, setInternalFocusedKey] = (0, import_react51.useState)(defaultFocusedKey);
12904
13035
  const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
12905
13036
  const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
12906
- const expandedSet = (0, import_react50.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
12907
- const focusedNode = (0, import_react50.useMemo)(
13037
+ const expandedSet = (0, import_react51.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
13038
+ const focusedNode = (0, import_react51.useMemo)(
12908
13039
  () => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
12909
13040
  [currentFocusedKey, data]
12910
13041
  );
12911
13042
  const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
12912
- const positions = (0, import_react50.useMemo)(
13043
+ const positions = (0, import_react51.useMemo)(
12913
13044
  () => collectPositions(
12914
13045
  effectiveFocusedNode ? [effectiveFocusedNode] : data,
12915
13046
  { x: 0, y: 0, ...size },
@@ -12925,7 +13056,7 @@ function Treemap({
12925
13056
  ),
12926
13057
  [activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
12927
13058
  );
12928
- (0, import_react50.useEffect)(() => {
13059
+ (0, import_react51.useEffect)(() => {
12929
13060
  const element = containerRef.current;
12930
13061
  if (!element) return void 0;
12931
13062
  const updateSize = () => {
@@ -12937,7 +13068,7 @@ function Treemap({
12937
13068
  observer.observe(element);
12938
13069
  return () => observer.disconnect();
12939
13070
  }, []);
12940
- (0, import_react50.useEffect)(() => {
13071
+ (0, import_react51.useEffect)(() => {
12941
13072
  if (!currentFocusedKey || effectiveFocusedNode) return;
12942
13073
  if (focusedKey === void 0) setInternalFocusedKey(null);
12943
13074
  onFocusedChange?.(null);
@@ -12985,7 +13116,7 @@ function Treemap({
12985
13116
  const hasChildren = Boolean(node.hasChildren || node.children?.length);
12986
13117
  const title = `${node.label} \xB7 ${String(valueFormatter(node.value, node))}`;
12987
13118
  if (expanded) {
12988
- return /* @__PURE__ */ (0, import_react51.createElement)(
13119
+ return /* @__PURE__ */ (0, import_react52.createElement)(
12989
13120
  "div",
12990
13121
  {
12991
13122
  className: `sia-treemap__tile sia-treemap__tile--directory is-expanded${effectiveFocusedNode?.key === node.key ? " is-focused" : ""}${active ? " is-active" : ""}`,
@@ -13024,7 +13155,7 @@ function Treemap({
13024
13155
  ] })
13025
13156
  );
13026
13157
  }
13027
- return /* @__PURE__ */ (0, import_react51.createElement)(
13158
+ return /* @__PURE__ */ (0, import_react52.createElement)(
13028
13159
  "button",
13029
13160
  {
13030
13161
  type: "button",
@@ -13050,7 +13181,7 @@ function Treemap({
13050
13181
  }
13051
13182
 
13052
13183
  // src/components/Table/TableCellContent.tsx
13053
- var import_react52 = require("react");
13184
+ var import_react53 = require("react");
13054
13185
  var import_jsx_runtime52 = require("react/jsx-runtime");
13055
13186
  var pendingLayouts = /* @__PURE__ */ new Map();
13056
13187
  var layoutFrame;
@@ -13069,10 +13200,10 @@ function scheduleLayout(element, task) {
13069
13200
  });
13070
13201
  }
13071
13202
  function TableCellContent({ children, ellipsis, title }) {
13072
- const ref = (0, import_react52.useRef)(null);
13073
- const [overflowing, setOverflowing] = (0, import_react52.useState)(false);
13203
+ const ref = (0, import_react53.useRef)(null);
13204
+ const [overflowing, setOverflowing] = (0, import_react53.useState)(false);
13074
13205
  const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
13075
- (0, import_react52.useLayoutEffect)(() => {
13206
+ (0, import_react53.useLayoutEffect)(() => {
13076
13207
  const element = ref.current;
13077
13208
  if (!element || !ellipsis || !customContent) return;
13078
13209
  const normalizeLayouts = (parent, layouts) => {
@@ -13108,14 +13239,14 @@ function TableCellContent({ children, ellipsis, title }) {
13108
13239
  }
13109
13240
 
13110
13241
  // src/components/Table/useRemainingHeight.ts
13111
- var import_react53 = require("react");
13242
+ var import_react54 = require("react");
13112
13243
  function useRemainingHeight(rootRef, options) {
13113
- const [height, setHeight] = (0, import_react53.useState)();
13244
+ const [height, setHeight] = (0, import_react54.useState)();
13114
13245
  const enabled = !!options;
13115
13246
  const container = typeof options === "object" ? options.container : void 0;
13116
13247
  const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
13117
13248
  const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
13118
- (0, import_react53.useLayoutEffect)(() => {
13249
+ (0, import_react54.useLayoutEffect)(() => {
13119
13250
  const root = rootRef.current;
13120
13251
  if (!enabled || !root) return;
13121
13252
  const win = root.ownerDocument.defaultView;
@@ -13186,7 +13317,7 @@ function useRemainingHeight(rootRef, options) {
13186
13317
  }
13187
13318
 
13188
13319
  // src/components/Table/TableCanvasLayer.tsx
13189
- var import_react54 = require("react");
13320
+ var import_react55 = require("react");
13190
13321
 
13191
13322
  // src/components/Table/utils.ts
13192
13323
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -13241,8 +13372,8 @@ function toTablePageParams(current, pageSize) {
13241
13372
  // src/components/Table/TableCanvasLayer.tsx
13242
13373
  var import_jsx_runtime53 = require("react/jsx-runtime");
13243
13374
  function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
13244
- const canvasRef = (0, import_react54.useRef)(null);
13245
- (0, import_react54.useLayoutEffect)(() => {
13375
+ const canvasRef = (0, import_react55.useRef)(null);
13376
+ (0, import_react55.useLayoutEffect)(() => {
13246
13377
  const canvas = canvasRef.current;
13247
13378
  const scroller = viewport.current;
13248
13379
  if (!canvas || !scroller) return;
@@ -13385,10 +13516,10 @@ function createRowIdentity() {
13385
13516
  }
13386
13517
 
13387
13518
  // src/components/Table/Table.tsx
13388
- var import_react56 = require("react");
13519
+ var import_react57 = require("react");
13389
13520
 
13390
13521
  // src/components/Table/plugins.tsx
13391
- var import_react55 = require("react");
13522
+ var import_react56 = require("react");
13392
13523
 
13393
13524
  // src/components/Table/columnSettings.ts
13394
13525
  function reconcileColumnSettings(columns, defaults, saved) {
@@ -14101,7 +14232,7 @@ function TableSelectedItemsPanel({
14101
14232
  onRemove,
14102
14233
  onClear
14103
14234
  }) {
14104
- const [showAll, setShowAll] = (0, import_react55.useState)(false);
14235
+ const [showAll, setShowAll] = (0, import_react56.useState)(false);
14105
14236
  const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
14106
14237
  const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
14107
14238
  const baseColumnMap = new Map(
@@ -14507,10 +14638,10 @@ function TableFilterControl({
14507
14638
  placeholder,
14508
14639
  onApply
14509
14640
  }) {
14510
- const [open, setOpen] = (0, import_react55.useState)(false);
14511
- const [draft, setDraft] = (0, import_react55.useState)(value);
14641
+ const [open, setOpen] = (0, import_react56.useState)(false);
14642
+ const [draft, setDraft] = (0, import_react56.useState)(value);
14512
14643
  const label = getColumnLabel(column);
14513
- (0, import_react55.useEffect)(() => {
14644
+ (0, import_react56.useEffect)(() => {
14514
14645
  if (open) setDraft(value);
14515
14646
  }, [open, value]);
14516
14647
  const apply = (nextValue) => {
@@ -14948,17 +15079,17 @@ function EditableTableCell({
14948
15079
  trigger
14949
15080
  }) {
14950
15081
  const config = typeof editable === "object" ? editable : { type: "input" };
14951
- const [editValue, setEditValue] = (0, import_react55.useState)(value);
14952
- const [saving, setSaving] = (0, import_react55.useState)(false);
14953
- const inputRef = (0, import_react55.useRef)(null);
14954
- const editorRef = (0, import_react55.useRef)(null);
14955
- const editValueRef = (0, import_react55.useRef)(value);
14956
- const savingRef = (0, import_react55.useRef)(false);
14957
- const saveRef = (0, import_react55.useRef)(
15082
+ const [editValue, setEditValue] = (0, import_react56.useState)(value);
15083
+ const [saving, setSaving] = (0, import_react56.useState)(false);
15084
+ const inputRef = (0, import_react56.useRef)(null);
15085
+ const editorRef = (0, import_react56.useRef)(null);
15086
+ const editValueRef = (0, import_react56.useRef)(value);
15087
+ const savingRef = (0, import_react56.useRef)(false);
15088
+ const saveRef = (0, import_react56.useRef)(
14958
15089
  async () => {
14959
15090
  }
14960
15091
  );
14961
- (0, import_react55.useEffect)(() => {
15092
+ (0, import_react56.useEffect)(() => {
14962
15093
  if (!active) return;
14963
15094
  editValueRef.current = value;
14964
15095
  setEditValue(value);
@@ -14989,7 +15120,7 @@ function EditableTableCell({
14989
15120
  }
14990
15121
  }
14991
15122
  saveRef.current = save;
14992
- (0, import_react55.useEffect)(() => {
15123
+ (0, import_react56.useEffect)(() => {
14993
15124
  if (!active || config.type === "select" || config.type === "custom") return;
14994
15125
  const handleOutsidePointerDown = (event) => {
14995
15126
  const target = event.target;
@@ -15294,15 +15425,15 @@ function ColumnSettingPanel({
15294
15425
  onClose,
15295
15426
  onApply
15296
15427
  }) {
15297
- const [draft, setDraft] = (0, import_react55.useState)(items);
15298
- const listRef = (0, import_react55.useRef)(null);
15299
- const cancelDrag = (0, import_react55.useRef)(null);
15300
- const [preview, setPreview] = (0, import_react55.useState)(null);
15301
- (0, import_react55.useEffect)(() => {
15428
+ const [draft, setDraft] = (0, import_react56.useState)(items);
15429
+ const listRef = (0, import_react56.useRef)(null);
15430
+ const cancelDrag = (0, import_react56.useRef)(null);
15431
+ const [preview, setPreview] = (0, import_react56.useState)(null);
15432
+ (0, import_react56.useEffect)(() => {
15302
15433
  cancelDrag.current?.();
15303
15434
  if (open) setDraft(orderColumnSettings(items));
15304
15435
  }, [items, open]);
15305
- (0, import_react55.useEffect)(() => () => cancelDrag.current?.(), []);
15436
+ (0, import_react56.useEffect)(() => () => cancelDrag.current?.(), []);
15306
15437
  const labels = new Map(
15307
15438
  flattenTableColumns(columns).map((column) => [
15308
15439
  column.key,
@@ -15829,7 +15960,7 @@ function tableExportText(node) {
15829
15960
  if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
15830
15961
  return String(node);
15831
15962
  if (Array.isArray(node)) return node.map(tableExportText).join("");
15832
- if ((0, import_react55.isValidElement)(node))
15963
+ if ((0, import_react56.isValidElement)(node))
15833
15964
  return tableExportText(node.props.children);
15834
15965
  return "";
15835
15966
  }
@@ -15928,7 +16059,7 @@ var SIZE_ROW_HEIGHT = { small: 28, medium: 36, large: 46 };
15928
16059
  function getHeaderTitleText(content) {
15929
16060
  if (typeof content === "string" || typeof content === "number") return String(content);
15930
16061
  if (Array.isArray(content)) return content.map(getHeaderTitleText).join("");
15931
- if ((0, import_react56.isValidElement)(content)) return getHeaderTitleText(content.props.children);
16062
+ if ((0, import_react57.isValidElement)(content)) return getHeaderTitleText(content.props.children);
15932
16063
  return "";
15933
16064
  }
15934
16065
  function getColumnDepth(columns) {
@@ -16008,7 +16139,7 @@ function getTableHorizontalMetrics(viewport, table) {
16008
16139
  const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
16009
16140
  return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
16010
16141
  }
16011
- var TableBodyRow = (0, import_react56.memo)(function TableBodyRow2({
16142
+ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
16012
16143
  canvas,
16013
16144
  visibleColumns,
16014
16145
  row,
@@ -16125,25 +16256,25 @@ function TableInner(props, ref) {
16125
16256
  style,
16126
16257
  ...htmlProps
16127
16258
  } = props;
16128
- const rootRef = (0, import_react56.useRef)(null);
16259
+ const rootRef = (0, import_react57.useRef)(null);
16129
16260
  const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
16130
- const scrollRef = (0, import_react56.useRef)(null);
16131
- const tableRef = (0, import_react56.useRef)(null);
16261
+ const scrollRef = (0, import_react57.useRef)(null);
16262
+ const tableRef = (0, import_react57.useRef)(null);
16132
16263
  useScrollbarProximity();
16133
- const scrollbarDragRef = (0, import_react56.useRef)(null);
16134
- const [internalLoading, setInternalLoading] = (0, import_react56.useState)(false);
16135
- const [scrollTop, setScrollTop] = (0, import_react56.useState)(0);
16136
- const [scrollLeft, setScrollLeft] = (0, import_react56.useState)(0);
16137
- const [viewportHeight, setViewportHeight] = (0, import_react56.useState)(420);
16138
- const [viewportWidth, setViewportWidth] = (0, import_react56.useState)(0);
16139
- const [autoColumnWidths, setAutoColumnWidths] = (0, import_react56.useState)({});
16140
- const [resolveRowIdentity] = (0, import_react56.useState)(createRowIdentity);
16141
- const getRowKey = (0, import_react56.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
16142
- const builtInResizePlugin = (0, import_react56.useMemo)(() => createResizePlugin(), []);
16143
- const builtInHighlightPlugin = (0, import_react56.useMemo)(() => createHighlightPlugin(), []);
16144
- const builtInCellSelectionPlugin = (0, import_react56.useMemo)(() => createCellSelectionPlugin(), []);
16145
- const builtInIndexPlugin = (0, import_react56.useMemo)(() => createIndexPlugin(), []);
16146
- const activePlugins = (0, import_react56.useMemo)(() => {
16264
+ const scrollbarDragRef = (0, import_react57.useRef)(null);
16265
+ const [internalLoading, setInternalLoading] = (0, import_react57.useState)(false);
16266
+ const [scrollTop, setScrollTop] = (0, import_react57.useState)(0);
16267
+ const [scrollLeft, setScrollLeft] = (0, import_react57.useState)(0);
16268
+ const [viewportHeight, setViewportHeight] = (0, import_react57.useState)(420);
16269
+ const [viewportWidth, setViewportWidth] = (0, import_react57.useState)(0);
16270
+ const [autoColumnWidths, setAutoColumnWidths] = (0, import_react57.useState)({});
16271
+ const [resolveRowIdentity] = (0, import_react57.useState)(createRowIdentity);
16272
+ const getRowKey = (0, import_react57.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
16273
+ const builtInResizePlugin = (0, import_react57.useMemo)(() => createResizePlugin(), []);
16274
+ const builtInHighlightPlugin = (0, import_react57.useMemo)(() => createHighlightPlugin(), []);
16275
+ const builtInCellSelectionPlugin = (0, import_react57.useMemo)(() => createCellSelectionPlugin(), []);
16276
+ const builtInIndexPlugin = (0, import_react57.useMemo)(() => createIndexPlugin(), []);
16277
+ const activePlugins = (0, import_react57.useMemo)(() => {
16147
16278
  const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
16148
16279
  if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
16149
16280
  if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
@@ -16151,19 +16282,19 @@ function TableInner(props, ref) {
16151
16282
  if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
16152
16283
  return plugins;
16153
16284
  }, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
16154
- const sortedPlugins = (0, import_react56.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
16155
- const pluginsByIdRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16285
+ const sortedPlugins = (0, import_react57.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
16286
+ const pluginsByIdRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16156
16287
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
16157
- const [pluginStates, setPluginStates] = (0, import_react56.useState)(() => Object.fromEntries(
16288
+ const [pluginStates, setPluginStates] = (0, import_react57.useState)(() => Object.fromEntries(
16158
16289
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
16159
16290
  ));
16160
- const pluginApisRef = (0, import_react56.useRef)({});
16161
- const contextsRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16162
- const mountedPluginsRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16291
+ const pluginApisRef = (0, import_react57.useRef)({});
16292
+ const contextsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16293
+ const mountedPluginsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16163
16294
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
16164
16295
  const nextApis = {};
16165
16296
  const contexts = /* @__PURE__ */ new Map();
16166
- const setPluginState = (0, import_react56.useCallback)((pluginId, next) => {
16297
+ const setPluginState = (0, import_react57.useCallback)((pluginId, next) => {
16167
16298
  setPluginStates((previous) => {
16168
16299
  const plugin = pluginsByIdRef.current.get(pluginId);
16169
16300
  const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
@@ -16216,7 +16347,7 @@ function TableInner(props, ref) {
16216
16347
  });
16217
16348
  pluginApisRef.current = nextApis;
16218
16349
  contextsRef.current = contexts;
16219
- (0, import_react56.useEffect)(() => {
16350
+ (0, import_react57.useEffect)(() => {
16220
16351
  const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
16221
16352
  for (const [pluginId, mounted] of mountedPluginsRef.current) {
16222
16353
  if (activePlugins2.get(pluginId) === mounted.plugin) continue;
@@ -16228,11 +16359,11 @@ function TableInner(props, ref) {
16228
16359
  mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
16229
16360
  }
16230
16361
  }, [sortedPlugins]);
16231
- (0, import_react56.useEffect)(() => () => {
16362
+ (0, import_react57.useEffect)(() => () => {
16232
16363
  for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
16233
16364
  mountedPluginsRef.current.clear();
16234
16365
  }, []);
16235
- const updateScrollMetrics = (0, import_react56.useCallback)(() => {
16366
+ const updateScrollMetrics = (0, import_react57.useCallback)(() => {
16236
16367
  const root = rootRef.current;
16237
16368
  const element = scrollRef.current;
16238
16369
  if (!root || !element) return;
@@ -16272,7 +16403,7 @@ function TableInner(props, ref) {
16272
16403
  verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
16273
16404
  verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
16274
16405
  }, []);
16275
- (0, import_react56.useEffect)(() => {
16406
+ (0, import_react57.useEffect)(() => {
16276
16407
  const element = scrollRef.current;
16277
16408
  if (!element || typeof ResizeObserver === "undefined") return;
16278
16409
  const observer = new ResizeObserver(() => {
@@ -16285,19 +16416,19 @@ function TableInner(props, ref) {
16285
16416
  updateScrollMetrics();
16286
16417
  return () => observer.disconnect();
16287
16418
  }, [updateScrollMetrics]);
16288
- (0, import_react56.useEffect)(() => {
16419
+ (0, import_react57.useEffect)(() => {
16289
16420
  updateScrollMetrics();
16290
16421
  });
16291
- const orderedColumns = (0, import_react56.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
16292
- const leafColumns = (0, import_react56.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
16293
- const headerRows = (0, import_react56.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
16294
- const measuredCells = (0, import_react56.useRef)(/* @__PURE__ */ new WeakSet());
16422
+ const orderedColumns = (0, import_react57.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
16423
+ const leafColumns = (0, import_react57.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
16424
+ const headerRows = (0, import_react57.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
16425
+ const measuredCells = (0, import_react57.useRef)(/* @__PURE__ */ new WeakSet());
16295
16426
  const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
16296
- (0, import_react56.useEffect)(() => {
16427
+ (0, import_react57.useEffect)(() => {
16297
16428
  measuredCells.current = /* @__PURE__ */ new WeakSet();
16298
16429
  setAutoColumnWidths({});
16299
16430
  }, [dataSource, baseColumns, size, autoWidthSignature]);
16300
- (0, import_react56.useEffect)(() => {
16431
+ (0, import_react57.useEffect)(() => {
16301
16432
  const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
16302
16433
  const root = rootRef.current;
16303
16434
  if (!root || autoWidthColumns.length === 0) return;
@@ -16381,7 +16512,7 @@ function TableInner(props, ref) {
16381
16512
  }
16382
16513
  const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
16383
16514
  const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
16384
- const rowElements = (0, import_react56.useMemo)(() => /* @__PURE__ */ new Map(), [
16515
+ const rowElements = (0, import_react57.useMemo)(() => /* @__PURE__ */ new Map(), [
16385
16516
  dataSource,
16386
16517
  baseColumns,
16387
16518
  sortedPlugins,
@@ -16401,20 +16532,20 @@ function TableInner(props, ref) {
16401
16532
  ]);
16402
16533
  const toolbarStart = sortedPlugins.map((plugin) => {
16403
16534
  const content = plugin.renderToolbarStart?.(getContext(plugin));
16404
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
16535
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
16405
16536
  }).filter(Boolean);
16406
16537
  const toolbarEnd = sortedPlugins.map((plugin) => {
16407
16538
  const content = plugin.renderToolbarEnd?.(getContext(plugin));
16408
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
16539
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
16409
16540
  }).filter(Boolean);
16410
16541
  const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
16411
16542
  const footers = sortedPlugins.map((plugin) => {
16412
16543
  const content = plugin.renderFooter?.(getContext(plugin));
16413
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `footer-${plugin.id}`) : null;
16544
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `footer-${plugin.id}`) : null;
16414
16545
  }).filter(Boolean);
16415
16546
  const overlays = sortedPlugins.map((plugin) => {
16416
16547
  const content = plugin.renderOverlay?.(getContext(plugin));
16417
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
16548
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
16418
16549
  }).filter(Boolean);
16419
16550
  const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
16420
16551
  const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
@@ -16425,13 +16556,13 @@ function TableInner(props, ref) {
16425
16556
  // 空态占位只覆盖内容区,必须给仍有业务意义的合计行留出空间。
16426
16557
  "--sia-table-summary-height": `${summaries.length * rowHeight}px`
16427
16558
  };
16428
- const handleScroll = (0, import_react56.useCallback)((event) => {
16559
+ const handleScroll = (0, import_react57.useCallback)((event) => {
16429
16560
  const element = event.currentTarget;
16430
16561
  if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
16431
16562
  if (canvas) setScrollLeft(element.scrollLeft);
16432
16563
  updateScrollMetrics();
16433
16564
  }, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
16434
- const handleScrollbarPointerDown = (0, import_react56.useCallback)((axis, event, track = event.currentTarget) => {
16565
+ const handleScrollbarPointerDown = (0, import_react57.useCallback)((axis, event, track = event.currentTarget) => {
16435
16566
  const element = scrollRef.current;
16436
16567
  const thumb = track.firstElementChild;
16437
16568
  if (!element || !thumb || event.button !== 0) return;
@@ -16460,7 +16591,7 @@ function TableInner(props, ref) {
16460
16591
  };
16461
16592
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
16462
16593
  }, []);
16463
- const handleScrollbarPointerMove = (0, import_react56.useCallback)((event) => {
16594
+ const handleScrollbarPointerMove = (0, import_react57.useCallback)((event) => {
16464
16595
  const drag = scrollbarDragRef.current;
16465
16596
  const element = scrollRef.current;
16466
16597
  if (!drag || !element || drag.pointerId !== event.pointerId) return;
@@ -16469,12 +16600,12 @@ function TableInner(props, ref) {
16469
16600
  if (drag.axis === "x") element.scrollLeft = nextScroll;
16470
16601
  else element.scrollTop = nextScroll;
16471
16602
  }, []);
16472
- const handleScrollbarPointerEnd = (0, import_react56.useCallback)((event) => {
16603
+ const handleScrollbarPointerEnd = (0, import_react57.useCallback)((event) => {
16473
16604
  if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
16474
16605
  scrollbarDragRef.current = null;
16475
16606
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
16476
16607
  }, []);
16477
- (0, import_react56.useImperativeHandle)(ref, () => ({
16608
+ (0, import_react57.useImperativeHandle)(ref, () => ({
16478
16609
  getRows: () => pipeline.rows.map((row) => row.record),
16479
16610
  getColumns: () => pipeline.columns,
16480
16611
  getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
@@ -16756,12 +16887,12 @@ function TableInner(props, ref) {
16756
16887
  }
16757
16888
  );
16758
16889
  }
16759
- var Table2 = (0, import_react56.forwardRef)(TableInner);
16890
+ var Table2 = (0, import_react57.forwardRef)(TableInner);
16760
16891
 
16761
16892
  // src/components/ThemeSwitch.tsx
16762
- var import_react57 = require("react");
16893
+ var import_react58 = require("react");
16763
16894
  var import_jsx_runtime56 = require("react/jsx-runtime");
16764
- var ThemeSwitch = (0, import_react57.forwardRef)(function ThemeSwitch2({
16895
+ var ThemeSwitch = (0, import_react58.forwardRef)(function ThemeSwitch2({
16765
16896
  checked,
16766
16897
  onCheckedChange,
16767
16898
  lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
@@ -16855,7 +16986,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
16855
16986
  }
16856
16987
 
16857
16988
  // src/components/Typography.tsx
16858
- var import_react58 = require("react");
16989
+ var import_react59 = require("react");
16859
16990
  var import_jsx_runtime58 = require("react/jsx-runtime");
16860
16991
  function TypographyContent({
16861
16992
  as: Tag2 = "span",
@@ -16875,26 +17006,26 @@ function TypographyContent({
16875
17006
  className = "",
16876
17007
  ...props
16877
17008
  }) {
16878
- const contentRef = (0, import_react58.useRef)(null);
16879
- const editRef = (0, import_react58.useRef)(null);
16880
- const timer = (0, import_react58.useRef)();
16881
- const [localText, setLocalText] = (0, import_react58.useState)();
16882
- const [draft, setDraft] = (0, import_react58.useState)("");
16883
- const [editing, setEditing] = (0, import_react58.useState)(false);
16884
- const [copied, setCopied] = (0, import_react58.useState)(false);
16885
- const [copyError, setCopyError] = (0, import_react58.useState)(false);
16886
- const [expanded, setExpanded] = (0, import_react58.useState)(false);
16887
- const [overflow, setOverflow] = (0, import_react58.useState)(false);
17009
+ const contentRef = (0, import_react59.useRef)(null);
17010
+ const editRef = (0, import_react59.useRef)(null);
17011
+ const timer = (0, import_react59.useRef)();
17012
+ const [localText, setLocalText] = (0, import_react59.useState)();
17013
+ const [draft, setDraft] = (0, import_react59.useState)("");
17014
+ const [editing, setEditing] = (0, import_react59.useState)(false);
17015
+ const [copied, setCopied] = (0, import_react59.useState)(false);
17016
+ const [copyError, setCopyError] = (0, import_react59.useState)(false);
17017
+ const [expanded, setExpanded] = (0, import_react59.useState)(false);
17018
+ const [overflow, setOverflow] = (0, import_react59.useState)(false);
16888
17019
  const editConfig = typeof editable === "object" ? editable : void 0;
16889
17020
  const content = editConfig?.text ?? localText ?? children;
16890
17021
  const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
16891
17022
  const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
16892
17023
  const expandable = typeof ellipsis === "object" && ellipsis.expandable;
16893
- (0, import_react58.useEffect)(() => {
17024
+ (0, import_react59.useEffect)(() => {
16894
17025
  setLocalText(void 0);
16895
17026
  }, [children]);
16896
- (0, import_react58.useEffect)(() => () => clearTimeout(timer.current), []);
16897
- (0, import_react58.useLayoutEffect)(() => {
17027
+ (0, import_react59.useEffect)(() => () => clearTimeout(timer.current), []);
17028
+ (0, import_react59.useLayoutEffect)(() => {
16898
17029
  const element = contentRef.current;
16899
17030
  if (!element || !ellipsis || !expandable || editing || expanded) return;
16900
17031
  const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
@@ -17012,10 +17143,10 @@ var Typography = Object.assign(TypographyRoot, {
17012
17143
  });
17013
17144
 
17014
17145
  // src/components/FloatButton.tsx
17015
- var import_react59 = require("react");
17146
+ var import_react60 = require("react");
17016
17147
  var import_jsx_runtime59 = require("react/jsx-runtime");
17017
- var GroupShape = (0, import_react59.createContext)(void 0);
17018
- var FloatButtonRoot = (0, import_react59.forwardRef)(function FloatButton({
17148
+ var GroupShape = (0, import_react60.createContext)(void 0);
17149
+ var FloatButtonRoot = (0, import_react60.forwardRef)(function FloatButton({
17019
17150
  icon,
17020
17151
  description,
17021
17152
  tooltip,
@@ -17028,7 +17159,7 @@ var FloatButtonRoot = (0, import_react59.forwardRef)(function FloatButton({
17028
17159
  children,
17029
17160
  ...props
17030
17161
  }, ref) {
17031
- const groupShape = (0, import_react59.useContext)(GroupShape);
17162
+ const groupShape = (0, import_react60.useContext)(GroupShape);
17032
17163
  const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
17033
17164
  const button = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
17034
17165
  "button",
@@ -17066,10 +17197,10 @@ function FloatButtonGroup({
17066
17197
  ...props
17067
17198
  }) {
17068
17199
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
17069
- const rootRef = (0, import_react59.useRef)(null);
17070
- const triggerRef = (0, import_react59.useRef)(null);
17071
- const id = (0, import_react59.useId)();
17072
- (0, import_react59.useEffect)(() => {
17200
+ const rootRef = (0, import_react60.useRef)(null);
17201
+ const triggerRef = (0, import_react60.useRef)(null);
17202
+ const id = (0, import_react60.useId)();
17203
+ (0, import_react60.useEffect)(() => {
17073
17204
  if (!trigger || !visible) return;
17074
17205
  const close = (event) => {
17075
17206
  if (!rootRef.current?.contains(event.target)) setVisible(false);
@@ -17123,8 +17254,8 @@ function FloatButtonGroup({
17123
17254
  ) });
17124
17255
  }
17125
17256
  function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
17126
- const [visible, setVisible] = (0, import_react59.useState)(false);
17127
- (0, import_react59.useEffect)(() => {
17257
+ const [visible, setVisible] = (0, import_react60.useState)(false);
17258
+ (0, import_react60.useEffect)(() => {
17128
17259
  const element = target ? target() : window;
17129
17260
  if (!element) return;
17130
17261
  const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
@@ -17148,11 +17279,11 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
17148
17279
  });
17149
17280
 
17150
17281
  // src/components/ChartWhirlingLoading.tsx
17151
- var import_react60 = require("react");
17282
+ var import_react61 = require("react");
17152
17283
  var import_jsx_runtime60 = require("react/jsx-runtime");
17153
17284
  function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
17154
- const [tick, setTick] = (0, import_react60.useState)(0);
17155
- (0, import_react60.useEffect)(() => {
17285
+ const [tick, setTick] = (0, import_react61.useState)(0);
17286
+ (0, import_react61.useEffect)(() => {
17156
17287
  if (frame != null) return;
17157
17288
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
17158
17289
  let timer;
@@ -17183,20 +17314,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
17183
17314
  }
17184
17315
 
17185
17316
  // src/components/SvgMapPlot.tsx
17186
- var import_react72 = require("react");
17317
+ var import_react73 = require("react");
17187
17318
 
17188
17319
  // src/components/ChartBrush.tsx
17189
- var import_react61 = require("react");
17320
+ var import_react62 = require("react");
17190
17321
  var import_jsx_runtime61 = require("react/jsx-runtime");
17191
17322
  function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
17192
- const [vertical, setVertical] = (0, import_react61.useState)(null);
17193
- const startY = (0, import_react61.useRef)(0);
17323
+ const [vertical, setVertical] = (0, import_react62.useState)(null);
17324
+ const startY = (0, import_react62.useRef)(0);
17194
17325
  const y = (event) => {
17195
17326
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
17196
17327
  return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
17197
17328
  };
17198
- const drag = (0, import_react61.useRef)(null);
17199
- const [selection, setSelection] = (0, import_react61.useState)(null);
17329
+ const drag = (0, import_react62.useRef)(null);
17330
+ const [selection, setSelection] = (0, import_react62.useState)(null);
17200
17331
  const x = (event) => {
17201
17332
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
17202
17333
  if (!matrix) return null;
@@ -17319,7 +17450,7 @@ function appendChartExportHeadings(original, clone, host) {
17319
17450
  }
17320
17451
 
17321
17452
  // src/components/ChartNodeTimeline.tsx
17322
- var import_react63 = require("react");
17453
+ var import_react64 = require("react");
17323
17454
 
17324
17455
  // src/components/timelinePositions.ts
17325
17456
  function timelineRatios(count, dates) {
@@ -17345,7 +17476,7 @@ function nearestTimelineIndex(ratios, ratio) {
17345
17476
  }
17346
17477
 
17347
17478
  // src/components/ChartPointMotion.tsx
17348
- var import_react62 = require("react");
17479
+ var import_react63 = require("react");
17349
17480
 
17350
17481
  // src/components/chartMotion.ts
17351
17482
  function chartMotionBaseline(points, horizontal = false) {
@@ -17366,11 +17497,11 @@ function interpolateChartPoints(from, to, progress) {
17366
17497
  var import_jsx_runtime62 = require("react/jsx-runtime");
17367
17498
  function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
17368
17499
  const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
17369
- const [frame, setFrame] = (0, import_react62.useState)(() => enabled && animateInitial ? baseline(points) : points);
17370
- const displayed = (0, import_react62.useRef)(frame);
17371
- const initialized = (0, import_react62.useRef)(!animateInitial);
17500
+ const [frame, setFrame] = (0, import_react63.useState)(() => enabled && animateInitial ? baseline(points) : points);
17501
+ const displayed = (0, import_react63.useRef)(frame);
17502
+ const initialized = (0, import_react63.useRef)(!animateInitial);
17372
17503
  const signature = JSON.stringify(points);
17373
- (0, import_react62.useEffect)(() => {
17504
+ (0, import_react63.useEffect)(() => {
17374
17505
  const target = points;
17375
17506
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
17376
17507
  if (!enabled || progress != null || reduced.matches) {
@@ -17409,8 +17540,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
17409
17540
  // src/components/ChartNodeTimeline.tsx
17410
17541
  var import_jsx_runtime63 = require("react/jsx-runtime");
17411
17542
  function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
17412
- const [playing, setPlaying] = (0, import_react63.useState)(autoPlay), dragging = (0, import_react63.useRef)();
17413
- const [draft, setDraft] = (0, import_react63.useState)(), pending = (0, import_react63.useRef)(), draftRef = (0, import_react63.useRef)();
17543
+ const [playing, setPlaying] = (0, import_react64.useState)(autoPlay), dragging = (0, import_react64.useRef)();
17544
+ const [draft, setDraft] = (0, import_react64.useState)(), pending = (0, import_react64.useRef)(), draftRef = (0, import_react64.useRef)();
17414
17545
  const shown = draft ?? value;
17415
17546
  const cancelPending = () => {
17416
17547
  clearTimeout(pending.current);
@@ -17418,8 +17549,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17418
17549
  draftRef.current = void 0;
17419
17550
  setDraft(void 0);
17420
17551
  };
17421
- (0, import_react63.useEffect)(() => () => clearTimeout(pending.current), []);
17422
- (0, import_react63.useEffect)(() => {
17552
+ (0, import_react64.useEffect)(() => () => clearTimeout(pending.current), []);
17553
+ (0, import_react64.useEffect)(() => {
17423
17554
  cancelPending();
17424
17555
  }, [value]);
17425
17556
  const preview = (index) => {
@@ -17434,8 +17565,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17434
17565
  draftRef.current = void 0;
17435
17566
  }, 200);
17436
17567
  };
17437
- (0, import_react63.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
17438
- (0, import_react63.useEffect)(() => {
17568
+ (0, import_react64.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
17569
+ (0, import_react64.useEffect)(() => {
17439
17570
  if (!playing || labels.length < 2) return;
17440
17571
  const timer = window.setTimeout(() => {
17441
17572
  if (value + 1 < labels.length) onChange(value + 1);
@@ -17544,7 +17675,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17544
17675
  }
17545
17676
 
17546
17677
  // src/components/ChartVerticalRange.tsx
17547
- var import_react64 = require("react");
17678
+ var import_react65 = require("react");
17548
17679
 
17549
17680
  // src/components/chartColorRamp.ts
17550
17681
  function chartColorRamp(colors, ratio) {
@@ -17564,16 +17695,16 @@ function chartColorRamp(colors, ratio) {
17564
17695
  // src/components/ChartVerticalRange.tsx
17565
17696
  var import_jsx_runtime64 = require("react/jsx-runtime");
17566
17697
  function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
17567
- const id = (0, import_react64.useId)().replaceAll(":", "");
17568
- const drag = (0, import_react64.useRef)();
17569
- const [draft, setDraft] = (0, import_react64.useState)();
17570
- const pending = (0, import_react64.useRef)();
17698
+ const id = (0, import_react65.useId)().replaceAll(":", "");
17699
+ const drag = (0, import_react65.useRef)();
17700
+ const [draft, setDraft] = (0, import_react65.useState)();
17701
+ const pending = (0, import_react65.useRef)();
17571
17702
  const cancel = () => {
17572
17703
  drag.current = void 0;
17573
17704
  pending.current = void 0;
17574
17705
  setDraft(void 0);
17575
17706
  };
17576
- (0, import_react64.useEffect)(() => {
17707
+ (0, import_react65.useEffect)(() => {
17577
17708
  if (!realtime) cancel();
17578
17709
  }, [range[0], range[1], min, max, realtime]);
17579
17710
  const shown = draft ?? range;
@@ -17654,18 +17785,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
17654
17785
  }
17655
17786
 
17656
17787
  // src/components/ChartHorizontalRange.tsx
17657
- var import_react65 = require("react");
17788
+ var import_react66 = require("react");
17658
17789
  var import_jsx_runtime65 = require("react/jsx-runtime");
17659
17790
  function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
17660
- const id = (0, import_react65.useId)().replaceAll(":", ""), span = max - min;
17661
- const drag = (0, import_react65.useRef)();
17662
- const [draft, setDraft] = (0, import_react65.useState)(), pending = (0, import_react65.useRef)();
17791
+ const id = (0, import_react66.useId)().replaceAll(":", ""), span = max - min;
17792
+ const drag = (0, import_react66.useRef)();
17793
+ const [draft, setDraft] = (0, import_react66.useState)(), pending = (0, import_react66.useRef)();
17663
17794
  const cancel = () => {
17664
17795
  drag.current = void 0;
17665
17796
  pending.current = void 0;
17666
17797
  setDraft(void 0);
17667
17798
  };
17668
- (0, import_react65.useEffect)(() => {
17799
+ (0, import_react66.useEffect)(() => {
17669
17800
  if (!realtime) cancel();
17670
17801
  }, [range[0], range[1], min, max, realtime]);
17671
17802
  const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
@@ -17743,7 +17874,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
17743
17874
  }
17744
17875
 
17745
17876
  // src/components/Chart.tsx
17746
- var import_react66 = require("react");
17877
+ var import_react67 = require("react");
17747
17878
 
17748
17879
  // src/components/chartCompositeExport.ts
17749
17880
  function serializeChartComposite(host) {
@@ -17867,20 +17998,20 @@ var DEFAULT_CHART_PALETTE = [
17867
17998
  "#2f54eb",
17868
17999
  "#a0d911"
17869
18000
  ];
17870
- var ChartContext = (0, import_react66.createContext)(null);
18001
+ var ChartContext = (0, import_react67.createContext)(null);
17871
18002
  function toCssSize(value, fallback) {
17872
18003
  if (typeof value === "number") return `${value}px`;
17873
18004
  return value ?? fallback;
17874
18005
  }
17875
- var ChartComposite = (0, import_react66.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
17876
- const host = (0, import_react66.useRef)(null);
17877
- (0, import_react66.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
18006
+ var ChartComposite = (0, import_react67.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
18007
+ const host = (0, import_react67.useRef)(null);
18008
+ (0, import_react67.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
17878
18009
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ...withTitleTooltip(props), ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "sia-chart-composite__layer", style: { left: layer.left ?? 0, top: layer.top ?? 0, width: layer.width ?? "100%", height: layer.height ?? "100%", zIndex: layer.zIndex ?? index, pointerEvents: layer.pointerEvents }, children: layer.content }, layer.key ?? index)) });
17879
18010
  });
17880
- var useTooltipLayoutEffect = typeof window === "undefined" ? import_react66.useEffect : import_react66.useLayoutEffect;
18011
+ var useTooltipLayoutEffect = typeof window === "undefined" ? import_react67.useEffect : import_react67.useLayoutEffect;
17881
18012
  function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
17882
- const elementRef = (0, import_react66.useRef)(null);
17883
- const [position, setPosition] = (0, import_react66.useState)([left, top]);
18013
+ const elementRef = (0, import_react67.useRef)(null);
18014
+ const [position, setPosition] = (0, import_react67.useState)([left, top]);
17884
18015
  useTooltipLayoutEffect(() => {
17885
18016
  const element = elementRef.current, host = element?.parentElement;
17886
18017
  if (!open || placement !== "axis" || !element || !host) return;
@@ -18004,7 +18135,7 @@ function ChartToolbox({
18004
18135
  ))
18005
18136
  ] });
18006
18137
  }
18007
- var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18138
+ var SiaChart = (0, import_react67.forwardRef)(function SiaChart2({
18008
18139
  children,
18009
18140
  width = "100%",
18010
18141
  height = 320,
@@ -18031,19 +18162,19 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18031
18162
  style,
18032
18163
  ...rest
18033
18164
  }, ref) {
18034
- const hostRef = (0, import_react66.useRef)(null);
18035
- const svgRef = (0, import_react66.useRef)(null);
18036
- const titleId = (0, import_react66.useId)();
18037
- const descriptionId = (0, import_react66.useId)();
18038
- const [tooltip, setTooltip] = (0, import_react66.useState)(null);
18039
- const tooltipHideTimer = (0, import_react66.useRef)();
18040
- const tooltipHeld = (0, import_react66.useRef)(false);
18165
+ const hostRef = (0, import_react67.useRef)(null);
18166
+ const svgRef = (0, import_react67.useRef)(null);
18167
+ const titleId = (0, import_react67.useId)();
18168
+ const descriptionId = (0, import_react67.useId)();
18169
+ const [tooltip, setTooltip] = (0, import_react67.useState)(null);
18170
+ const tooltipHideTimer = (0, import_react67.useRef)();
18171
+ const tooltipHeld = (0, import_react67.useRef)(false);
18041
18172
  const cancelTooltipHide = () => {
18042
18173
  clearTimeout(tooltipHideTimer.current);
18043
18174
  };
18044
- (0, import_react66.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
18045
- const [linkedPosition, setLinkedPosition] = (0, import_react66.useState)({ left: 0, top: 0 });
18046
- (0, import_react66.useEffect)(() => {
18175
+ (0, import_react67.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
18176
+ const [linkedPosition, setLinkedPosition] = (0, import_react67.useState)({ left: 0, top: 0 });
18177
+ (0, import_react67.useEffect)(() => {
18047
18178
  const host = hostRef.current, svg = svgRef.current;
18048
18179
  if (!controlledTooltip || !host || !svg) return;
18049
18180
  const position = () => {
@@ -18058,12 +18189,12 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18058
18189
  observer.observe(host);
18059
18190
  return () => observer.disconnect();
18060
18191
  }, [controlledTooltip]);
18061
- const [dataViewOpen, setDataViewOpen] = (0, import_react66.useState)(false);
18062
- const [markMode, setMarkMode] = (0, import_react66.useState)(false);
18063
- const [markStart, setMarkStart] = (0, import_react66.useState)(null);
18064
- const [userMarks, setUserMarks] = (0, import_react66.useState)([]);
18192
+ const [dataViewOpen, setDataViewOpen] = (0, import_react67.useState)(false);
18193
+ const [markMode, setMarkMode] = (0, import_react67.useState)(false);
18194
+ const [markStart, setMarkStart] = (0, import_react67.useState)(null);
18195
+ const [userMarks, setUserMarks] = (0, import_react67.useState)([]);
18065
18196
  const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
18066
- const rootStyle = (0, import_react66.useMemo)(() => ({
18197
+ const rootStyle = (0, import_react67.useMemo)(() => ({
18067
18198
  ...style,
18068
18199
  width: toCssSize(width, "100%"),
18069
18200
  height: toCssSize(height, "320px"),
@@ -18121,13 +18252,13 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18121
18252
  anchor.href = canvas.toDataURL("image/png");
18122
18253
  anchor.click();
18123
18254
  }
18124
- (0, import_react66.useImperativeHandle)(ref, () => ({
18255
+ (0, import_react67.useImperativeHandle)(ref, () => ({
18125
18256
  getElement: () => svgRef.current,
18126
18257
  focus: () => svgRef.current?.focus(),
18127
18258
  toSvgString: serializeSvg,
18128
18259
  toDataUrl: svgDataUrl
18129
18260
  }), []);
18130
- const context = (0, import_react66.useMemo)(() => ({
18261
+ const context = (0, import_react67.useMemo)(() => ({
18131
18262
  palette,
18132
18263
  showTooltip: (event, content, point) => {
18133
18264
  cancelTooltipHide();
@@ -18314,7 +18445,7 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18314
18445
  ) });
18315
18446
  });
18316
18447
  function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
18317
- const context = (0, import_react66.useContext)(ChartContext);
18448
+ const context = (0, import_react67.useContext)(ChartContext);
18318
18449
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
18319
18450
  "g",
18320
18451
  {
@@ -18343,7 +18474,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
18343
18474
  );
18344
18475
  }
18345
18476
  function ChartLegend({ items, symbol = "rect", x = CHART_VIEWBOX_WIDTH / 2, y = 20, align = "center", itemGap = 18, orientation = "horizontal", selected, onItemClick, maxWidth, rowGap = 24, iconWidth, iconHeight = 14, textGap = 5, textStyle, inactiveColor, background }) {
18346
- const paintId = (0, import_react66.useId)().replaceAll(":", "");
18477
+ const paintId = (0, import_react67.useId)().replaceAll(":", "");
18347
18478
  const widths = items.map((item) => (iconWidth == null ? 18 : iconWidth + textGap) + (item.textWidth ?? Math.max(30, Array.from(item.name).reduce((width, character) => width + (character.charCodeAt(0) > 255 ? 13 : 7), 0))));
18348
18479
  const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
18349
18480
  const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
@@ -18472,7 +18603,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
18472
18603
  ] });
18473
18604
  }
18474
18605
  function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y = 284, width = 110, height = 9, label, endLabels, indicatorValue, onHoverRange, realtime = true, svgHandles = false, orientation = "horizontal", calculable = false, value = max, onChange, range, onRangeChange, pieces, selectedPieces, onPieceToggle }) {
18475
- const id = (0, import_react66.useId)().replaceAll(":", "");
18606
+ const id = (0, import_react67.useId)().replaceAll(":", "");
18476
18607
  const vertical = orientation === "vertical";
18477
18608
  if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
18478
18609
  if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
@@ -18500,8 +18631,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
18500
18631
  ] });
18501
18632
  }
18502
18633
  function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u53EF\u89C1\u8303\u56F4", orientation = "horizontal", dataShadow = [], showDetail = false, minSpan = 1, formatter, onChange, panEnabled = false, shadowBounds, handleLabels }) {
18503
- const [activeHandle, setActiveHandle] = (0, import_react66.useState)(null);
18504
- const pan = (0, import_react66.useRef)();
18634
+ const [activeHandle, setActiveHandle] = (0, import_react67.useState)(null);
18635
+ const pan = (0, import_react67.useRef)();
18505
18636
  const start = Math.min(value[0], value[1]);
18506
18637
  const end = Math.max(value[0], value[1]);
18507
18638
  const startPercent = (start - min) / Math.max(1, max - min) * 100;
@@ -18575,9 +18706,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
18575
18706
  ] });
18576
18707
  }
18577
18708
  function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
18578
- const [playing, setPlaying] = (0, import_react66.useState)(autoPlay);
18579
- (0, import_react66.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
18580
- (0, import_react66.useEffect)(() => {
18709
+ const [playing, setPlaying] = (0, import_react67.useState)(autoPlay);
18710
+ (0, import_react67.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
18711
+ (0, import_react67.useEffect)(() => {
18581
18712
  if (!playing || labels.length <= 1) return void 0;
18582
18713
  const timer = window.setInterval(() => {
18583
18714
  const next = value + 1;
@@ -18687,7 +18818,7 @@ function parseSvgMapPaths(source) {
18687
18818
  }
18688
18819
 
18689
18820
  // src/components/useMapRoam.ts
18690
- var import_react67 = require("react");
18821
+ var import_react68 = require("react");
18691
18822
 
18692
18823
  // src/components/chartRoam.ts
18693
18824
  function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
@@ -18704,14 +18835,14 @@ var initial = { x: 0, y: 0, scale: 1 };
18704
18835
  function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
18705
18836
  const [zoomIn, zoomOut] = wheelFactors;
18706
18837
  const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
18707
- const host = (0, import_react67.useRef)(null);
18708
- const [view, setView] = (0, import_react67.useState)(initial);
18709
- const drag = (0, import_react67.useRef)();
18838
+ const host = (0, import_react68.useRef)(null);
18839
+ const [view, setView] = (0, import_react68.useState)(initial);
18840
+ const drag = (0, import_react68.useRef)();
18710
18841
  const local = (x, y) => {
18711
18842
  const matrix = host.current?.ownerSVGElement?.getScreenCTM();
18712
18843
  return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
18713
18844
  };
18714
- (0, import_react67.useEffect)(() => {
18845
+ (0, import_react68.useEffect)(() => {
18715
18846
  const node = host.current;
18716
18847
  if (!node || !mode || mode === "move") return;
18717
18848
  const wheel = (event) => {
@@ -18773,7 +18904,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
18773
18904
  }
18774
18905
 
18775
18906
  // src/components/ChartMapLineReveal.tsx
18776
- var import_react68 = require("react");
18907
+ var import_react69 = require("react");
18777
18908
 
18778
18909
  // src/components/mapLineGeometry.ts
18779
18910
  function mapLineControl(source, target, curveness) {
@@ -18790,9 +18921,9 @@ function mapLineDuration(source, target, period) {
18790
18921
  // src/components/ChartMapLineReveal.tsx
18791
18922
  var import_jsx_runtime67 = require("react/jsx-runtime");
18792
18923
  function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
18793
- const signature = JSON.stringify([source, control, target]), initialized = (0, import_react68.useRef)(false);
18794
- const [frame, setFrame] = (0, import_react68.useState)({ signature, progress: enabled ? 0 : 1 });
18795
- (0, import_react68.useEffect)(() => {
18924
+ const signature = JSON.stringify([source, control, target]), initialized = (0, import_react69.useRef)(false);
18925
+ const [frame, setFrame] = (0, import_react69.useState)({ signature, progress: enabled ? 0 : 1 });
18926
+ (0, import_react69.useEffect)(() => {
18796
18927
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
18797
18928
  const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
18798
18929
  if (!enabled || reduced.matches) {
@@ -18825,15 +18956,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
18825
18956
  }
18826
18957
 
18827
18958
  // src/components/ChartMapLineEffect.tsx
18828
- var import_react69 = require("react");
18959
+ var import_react70 = require("react");
18829
18960
  var import_jsx_runtime68 = require("react/jsx-runtime");
18830
18961
  function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
18831
- const ref = (0, import_react69.useRef)(null);
18832
- const trails = (0, import_react69.useRef)([]);
18962
+ const ref = (0, import_react70.useRef)(null);
18963
+ const trails = (0, import_react70.useRef)([]);
18833
18964
  const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
18834
18965
  const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
18835
18966
  const duration = mapLineDuration(source, target, period);
18836
- (0, import_react69.useEffect)(() => {
18967
+ (0, import_react70.useEffect)(() => {
18837
18968
  const started = performance.now();
18838
18969
  let frame = 0;
18839
18970
  const history = [];
@@ -18866,7 +18997,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
18866
18997
  }
18867
18998
 
18868
18999
  // src/components/ChartMapPointPulse.tsx
18869
- var import_react70 = require("react");
19000
+ var import_react71 = require("react");
18870
19001
 
18871
19002
  // src/components/mapPointPulse.ts
18872
19003
  function mapPointPulseDuration(period, random = Math.random) {
@@ -18876,7 +19007,7 @@ function mapPointPulseDuration(period, random = Math.random) {
18876
19007
  // src/components/ChartMapPointPulse.tsx
18877
19008
  var import_jsx_runtime69 = require("react/jsx-runtime");
18878
19009
  function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
18879
- const [duration] = (0, import_react70.useState)(() => mapPointPulseDuration(period));
19010
+ const [duration] = (0, import_react71.useState)(() => mapPointPulseDuration(period));
18880
19011
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("circle", { "data-svg-map-pulse": duration, cx: x, cy: y, r: size * scaleSize * 0.1, fill: "none", stroke: color, strokeWidth: 0.1, pointerEvents: "none", style: { filter: `drop-shadow(0 0 2px ${color})` }, children: [
18881
19012
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
18882
19013
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
@@ -18884,11 +19015,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
18884
19015
  }
18885
19016
 
18886
19017
  // src/components/ChartMapPointEntrance.tsx
18887
- var import_react71 = require("react");
19018
+ var import_react72 = require("react");
18888
19019
  var import_jsx_runtime70 = require("react/jsx-runtime");
18889
19020
  function ChartMapPointEntrance({ enabled, x, y, children }) {
18890
- const [progress, setProgress] = (0, import_react71.useState)(enabled ? 0.01 : 1);
18891
- (0, import_react71.useEffect)(() => {
19021
+ const [progress, setProgress] = (0, import_react72.useState)(enabled ? 0.01 : 1);
19022
+ (0, import_react72.useEffect)(() => {
18892
19023
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
18893
19024
  if (!enabled || reduced.matches) {
18894
19025
  setProgress(1);
@@ -18931,8 +19062,8 @@ function mapLineEndLabel(source, target) {
18931
19062
  // src/components/SvgMapPlot.tsx
18932
19063
  var import_jsx_runtime71 = require("react/jsx-runtime");
18933
19064
  function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
18934
- const path = (0, import_react72.useRef)(null), [center, setCenter] = (0, import_react72.useState)([0, 0]);
18935
- (0, import_react72.useLayoutEffect)(() => {
19065
+ const path = (0, import_react73.useRef)(null), [center, setCenter] = (0, import_react73.useState)([0, 0]);
19066
+ (0, import_react73.useLayoutEffect)(() => {
18936
19067
  const box = path.current?.getBBox();
18937
19068
  if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
18938
19069
  }, [d]);
@@ -18950,9 +19081,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
18950
19081
  ] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
18951
19082
  }
18952
19083
  function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = domain, colors, labelOffsets, hoverRange, onHoverValue, roam = true, resetKey = 0, children, markPoints = [], markLines = [], lineAnimation = false, tooltipNameOnly = false, showLabels = true, pointAnimation = false, pointEntrance = false, pointAnimationEasing = "linear" }) {
18953
- const map = (0, import_react72.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react72.useState)();
18954
- const [hoveredLine, setHoveredLine] = (0, import_react72.useState)();
18955
- (0, import_react72.useEffect)(() => {
19084
+ const map = (0, import_react73.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react73.useState)();
19085
+ const [hoveredLine, setHoveredLine] = (0, import_react73.useState)();
19086
+ (0, import_react73.useEffect)(() => {
18956
19087
  control.reset();
18957
19088
  setHovered(void 0);
18958
19089
  }, [resetKey]);
@@ -19015,16 +19146,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
19015
19146
  }
19016
19147
 
19017
19148
  // src/components/ChartRoamController.tsx
19018
- var import_react73 = require("react");
19149
+ var import_react74 = require("react");
19019
19150
  var import_jsx_runtime72 = require("react/jsx-runtime");
19020
19151
  function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
19021
- const [hovered, setHovered] = (0, import_react73.useState)(), [focused, setFocused] = (0, import_react73.useState)();
19022
- const timer = (0, import_react73.useRef)();
19152
+ const [hovered, setHovered] = (0, import_react74.useState)(), [focused, setFocused] = (0, import_react74.useState)();
19153
+ const timer = (0, import_react74.useRef)();
19023
19154
  const stop = () => {
19024
19155
  if (timer.current !== void 0) clearInterval(timer.current);
19025
19156
  timer.current = void 0;
19026
19157
  };
19027
- (0, import_react73.useEffect)(() => {
19158
+ (0, import_react74.useEffect)(() => {
19028
19159
  window.addEventListener("blur", stop);
19029
19160
  return () => {
19030
19161
  stop();
@@ -19063,13 +19194,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
19063
19194
  }
19064
19195
 
19065
19196
  // src/components/LineShareChart.tsx
19066
- var import_react93 = require("react");
19197
+ var import_react94 = require("react");
19067
19198
 
19068
19199
  // src/components/Charts.tsx
19069
- var import_react91 = require("react");
19200
+ var import_react92 = require("react");
19070
19201
 
19071
19202
  // src/components/ChartScatterMotion.tsx
19072
- var import_react74 = require("react");
19203
+ var import_react75 = require("react");
19073
19204
 
19074
19205
  // src/components/scatterMotion.ts
19075
19206
  function scatterMotionEase(progress) {
@@ -19081,9 +19212,9 @@ function scatterMotionEase(progress) {
19081
19212
  var import_jsx_runtime73 = require("react/jsx-runtime");
19082
19213
  function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
19083
19214
  const target = { x, y, radius };
19084
- const [frame, setFrame] = (0, import_react74.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
19085
- const displayed = (0, import_react74.useRef)(frame), started = (0, import_react74.useRef)(false);
19086
- (0, import_react74.useEffect)(() => {
19215
+ const [frame, setFrame] = (0, import_react75.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
19216
+ const displayed = (0, import_react75.useRef)(frame), started = (0, import_react75.useRef)(false);
19217
+ (0, import_react75.useEffect)(() => {
19087
19218
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
19088
19219
  let request = 0;
19089
19220
  const publish = (next) => {
@@ -19194,12 +19325,12 @@ function layoutEventRiver(series, tailLength, area) {
19194
19325
  }
19195
19326
 
19196
19327
  // src/components/EventRiverBubble.tsx
19197
- var import_react75 = require("react");
19328
+ var import_react76 = require("react");
19198
19329
  var import_jsx_runtime74 = require("react/jsx-runtime");
19199
19330
  function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
19200
- const [offset, setOffset] = (0, import_react75.useState)(0);
19201
- const drag = (0, import_react75.useRef)();
19202
- (0, import_react75.useEffect)(() => {
19331
+ const [offset, setOffset] = (0, import_react76.useState)(0);
19332
+ const drag = (0, import_react76.useRef)();
19333
+ (0, import_react76.useEffect)(() => {
19203
19334
  setOffset(0);
19204
19335
  drag.current = void 0;
19205
19336
  }, [resetKey]);
@@ -19250,13 +19381,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
19250
19381
  }
19251
19382
 
19252
19383
  // src/components/EventRiverMotion.tsx
19253
- var import_react76 = require("react");
19384
+ var import_react77 = require("react");
19254
19385
  var import_jsx_runtime75 = require("react/jsx-runtime");
19255
19386
  function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
19256
- const [frame, setFrame] = (0, import_react76.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
19257
- const displayed = (0, import_react76.useRef)(frame), started = (0, import_react76.useRef)(false);
19387
+ const [frame, setFrame] = (0, import_react77.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
19388
+ const displayed = (0, import_react77.useRef)(frame), started = (0, import_react77.useRef)(false);
19258
19389
  const signature = JSON.stringify(geometry);
19259
- (0, import_react76.useEffect)(() => {
19390
+ (0, import_react77.useEffect)(() => {
19260
19391
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
19261
19392
  const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
19262
19393
  let request = 0;
@@ -19374,7 +19505,7 @@ function transferPieValue(series, source, target, connector = " & ") {
19374
19505
  }
19375
19506
 
19376
19507
  // src/components/ChartValueIsland.tsx
19377
- var import_react77 = require("react");
19508
+ var import_react78 = require("react");
19378
19509
 
19379
19510
  // src/components/cartesianTransfer.ts
19380
19511
  function addValues(a, b) {
@@ -19440,13 +19571,13 @@ function findCompositeValueTarget(element, x, y) {
19440
19571
  // src/components/ChartValueIsland.tsx
19441
19572
  var import_jsx_runtime76 = require("react/jsx-runtime");
19442
19573
  function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
19443
- const drag = (0, import_react77.useRef)(null);
19444
- const [offset, setOffset] = (0, import_react77.useState)([0, 0]);
19574
+ const drag = (0, import_react78.useRef)(null);
19575
+ const [offset, setOffset] = (0, import_react78.useState)([0, 0]);
19445
19576
  const cancel = () => {
19446
19577
  drag.current = null;
19447
19578
  setOffset([0, 0]);
19448
19579
  };
19449
- (0, import_react77.useEffect)(cancel, [x, y]);
19580
+ (0, import_react78.useEffect)(cancel, [x, y]);
19450
19581
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
19451
19582
  ChartMark,
19452
19583
  {
@@ -19499,12 +19630,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
19499
19630
  }
19500
19631
 
19501
19632
  // src/components/ChartPulseRing.tsx
19502
- var import_react78 = require("react");
19633
+ var import_react79 = require("react");
19503
19634
  var import_jsx_runtime77 = require("react/jsx-runtime");
19504
19635
  function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
19505
- const id = (0, import_react78.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react78.useState)(0);
19506
- const [reduced, setReduced] = (0, import_react78.useState)(false);
19507
- (0, import_react78.useEffect)(() => {
19636
+ const id = (0, import_react79.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react79.useState)(0);
19637
+ const [reduced, setReduced] = (0, import_react79.useState)(false);
19638
+ (0, import_react79.useEffect)(() => {
19508
19639
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
19509
19640
  setReduced(preference.matches);
19510
19641
  let frame = 0;
@@ -19648,7 +19779,7 @@ function chartMarkerPath(kind, x, y, size) {
19648
19779
  }
19649
19780
 
19650
19781
  // src/components/ChartLargeMapPointCanvas.tsx
19651
- var import_react79 = require("react");
19782
+ var import_react80 = require("react");
19652
19783
 
19653
19784
  // src/components/largeMapPointPulse.ts
19654
19785
  function largeMapPointPulse(elapsed, period, initial3, delay) {
@@ -19664,8 +19795,8 @@ function largeMapPointSize(size, pulse) {
19664
19795
  // src/components/ChartLargeMapPointCanvas.tsx
19665
19796
  var import_jsx_runtime78 = require("react/jsx-runtime");
19666
19797
  function ChartLargeMapPointCanvas({ groups, width, height }) {
19667
- const canvas = (0, import_react79.useRef)(null), key = JSON.stringify(groups);
19668
- (0, import_react79.useEffect)(() => {
19798
+ const canvas = (0, import_react80.useRef)(null), key = JSON.stringify(groups);
19799
+ (0, import_react80.useEffect)(() => {
19669
19800
  const element = canvas.current, context = element?.getContext("2d");
19670
19801
  if (!element || !context) return;
19671
19802
  const ratio = window.devicePixelRatio || 1;
@@ -19724,12 +19855,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
19724
19855
  }
19725
19856
 
19726
19857
  // src/components/ChartCrosshair.tsx
19727
- var import_react80 = require("react");
19858
+ var import_react81 = require("react");
19728
19859
  var import_jsx_runtime79 = require("react/jsx-runtime");
19729
19860
  function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
19730
- const ref = (0, import_react80.useRef)(null);
19731
- const [point, setPoint] = (0, import_react80.useState)(null);
19732
- (0, import_react80.useEffect)(() => {
19861
+ const ref = (0, import_react81.useRef)(null);
19862
+ const [point, setPoint] = (0, import_react81.useState)(null);
19863
+ (0, import_react81.useEffect)(() => {
19733
19864
  const svg = ref.current?.ownerSVGElement;
19734
19865
  if (!svg) return;
19735
19866
  const clear = () => setPoint(null);
@@ -19749,7 +19880,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
19749
19880
  svg.removeEventListener("pointercancel", clear);
19750
19881
  };
19751
19882
  }, [bounds.x, bounds.y, bounds.width, bounds.height]);
19752
- (0, import_react80.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
19883
+ (0, import_react81.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
19753
19884
  const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
19754
19885
  const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
19755
19886
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
@@ -19766,7 +19897,7 @@ function decimal(value) {
19766
19897
  }
19767
19898
 
19768
19899
  // src/components/HeatmapRasterLayer.tsx
19769
- var import_react81 = require("react");
19900
+ var import_react82 = require("react");
19770
19901
 
19771
19902
  // src/components/heatmapRaster.ts
19772
19903
  var defaultGradient = [{ offset: 0.2, color: [0, 0, 255] }, { offset: 0.4, color: [0, 255, 255] }, { offset: 0.6, color: [0, 255, 0] }, { offset: 0.8, color: [255, 255, 0] }, { offset: 1, color: [255, 0, 0] }];
@@ -19813,9 +19944,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
19813
19944
  // src/components/HeatmapRasterLayer.tsx
19814
19945
  var import_jsx_runtime80 = require("react/jsx-runtime");
19815
19946
  function HeatmapRaster({ width, height, points, options }) {
19816
- const [url, setUrl] = (0, import_react81.useState)();
19947
+ const [url, setUrl] = (0, import_react82.useState)();
19817
19948
  const optionsKey = JSON.stringify(options);
19818
- (0, import_react81.useEffect)(() => {
19949
+ (0, import_react82.useEffect)(() => {
19819
19950
  const canvas = document.createElement("canvas");
19820
19951
  canvas.width = width;
19821
19952
  canvas.height = height;
@@ -19915,10 +20046,10 @@ function chordMatrixLayout(matrix, options = {}) {
19915
20046
  }
19916
20047
 
19917
20048
  // src/components/MatrixChordPlot.tsx
19918
- var import_react82 = require("react");
20049
+ var import_react83 = require("react");
19919
20050
  var import_jsx_runtime81 = require("react/jsx-runtime");
19920
20051
  function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
19921
- const [hoveredLink, setHoveredLink] = (0, import_react82.useState)(null);
20052
+ const [hoveredLink, setHoveredLink] = (0, import_react83.useState)(null);
19922
20053
  const layout = series ? chordMultiMatrixLayout(series.map((s) => s.matrix), { padAngle, clockwise, startAngle: geometry?.startAngle }) : chordMatrixLayout(matrix, { sort, sortSub, padAngle, clockwise, legacySubSort, startAngle: geometry?.startAngle }), cx = geometry?.center[0] ?? 360, cy = geometry?.center[1] ?? 182, r = geometry?.innerRadius ?? 108, outer = geometry?.outerRadius ?? 128;
19923
20054
  const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
19924
20055
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
@@ -20265,13 +20396,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
20265
20396
  }
20266
20397
 
20267
20398
  // src/components/ChartRoamGroup.tsx
20268
- var import_react83 = require("react");
20399
+ var import_react84 = require("react");
20269
20400
  var import_jsx_runtime83 = require("react/jsx-runtime");
20270
20401
  var initial2 = { x: 0, y: 0, scale: 1 };
20271
20402
  function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
20272
- const group = (0, import_react83.useRef)(null), drag = (0, import_react83.useRef)();
20273
- const [view, setView] = (0, import_react83.useState)(initial2);
20274
- (0, import_react83.useEffect)(() => {
20403
+ const group = (0, import_react84.useRef)(null), drag = (0, import_react84.useRef)();
20404
+ const [view, setView] = (0, import_react84.useState)(initial2);
20405
+ (0, import_react84.useEffect)(() => {
20275
20406
  setView(initial2);
20276
20407
  drag.current = void 0;
20277
20408
  }, [resetSignal]);
@@ -20281,7 +20412,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
20281
20412
  const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
20282
20413
  return [local.x, local.y];
20283
20414
  };
20284
- (0, import_react83.useEffect)(() => {
20415
+ (0, import_react84.useEffect)(() => {
20285
20416
  const target = group.current;
20286
20417
  if (!target || !enabled || !zoomEnabled) return;
20287
20418
  const wheel = (event) => {
@@ -20342,11 +20473,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
20342
20473
  }
20343
20474
 
20344
20475
  // src/components/TreeNodeGlyph.tsx
20345
- var import_react84 = require("react");
20476
+ var import_react85 = require("react");
20346
20477
  var import_jsx_runtime84 = require("react/jsx-runtime");
20347
20478
  function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
20348
- const [failed, setFailed] = (0, import_react84.useState)(false);
20349
- (0, import_react84.useEffect)(() => setFailed(false), [symbol]);
20479
+ const [failed, setFailed] = (0, import_react85.useState)(false);
20480
+ (0, import_react85.useEffect)(() => setFailed(false), [symbol]);
20350
20481
  const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
20351
20482
  if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
20352
20483
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
@@ -20635,7 +20766,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
20635
20766
  }
20636
20767
 
20637
20768
  // src/components/ChartBundledMapCanvas.tsx
20638
- var import_react85 = require("react");
20769
+ var import_react86 = require("react");
20639
20770
 
20640
20771
  // src/components/edgeBundling.ts
20641
20772
  var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
@@ -20779,9 +20910,9 @@ function sampleBundledPath(curves, progress) {
20779
20910
  var import_jsx_runtime85 = require("react/jsx-runtime");
20780
20911
  function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "rgba(2,166,253,0.05)", opacity = 0.2, lineWidth = 0.5, pointColor = "rgba(255,0,0,0.5)", pointRadius = 1.5, effect, width, height }) {
20781
20912
  const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
20782
- const paths = (0, import_react85.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
20783
- const base = (0, import_react85.useRef)(null), moving = (0, import_react85.useRef)(null);
20784
- (0, import_react85.useEffect)(() => {
20913
+ const paths = (0, import_react86.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
20914
+ const base = (0, import_react86.useRef)(null), moving = (0, import_react86.useRef)(null);
20915
+ (0, import_react86.useEffect)(() => {
20785
20916
  const node = base.current, ctx = node?.getContext("2d");
20786
20917
  if (!node || !ctx) return;
20787
20918
  const ratio = window.devicePixelRatio || 1;
@@ -20807,7 +20938,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
20807
20938
  ctx.fill();
20808
20939
  }
20809
20940
  }, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
20810
- (0, import_react85.useEffect)(() => {
20941
+ (0, import_react86.useEffect)(() => {
20811
20942
  const node = moving.current, ctx = node?.getContext("2d");
20812
20943
  if (!node || !ctx) return;
20813
20944
  const ratio = window.devicePixelRatio || 1;
@@ -20869,11 +21000,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
20869
21000
  }
20870
21001
 
20871
21002
  // src/components/ChartMapEffectCanvas.tsx
20872
- var import_react86 = require("react");
21003
+ var import_react87 = require("react");
20873
21004
  var import_jsx_runtime86 = require("react/jsx-runtime");
20874
21005
  function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
20875
- const canvas = (0, import_react86.useRef)(null), key = JSON.stringify(effects);
20876
- (0, import_react86.useEffect)(() => {
21006
+ const canvas = (0, import_react87.useRef)(null), key = JSON.stringify(effects);
21007
+ (0, import_react87.useEffect)(() => {
20877
21008
  const element = canvas.current;
20878
21009
  if (!element) return;
20879
21010
  const context = element.getContext("2d");
@@ -21019,12 +21150,12 @@ function layoutTreeNodes(root, options = {}) {
21019
21150
  }
21020
21151
 
21021
21152
  // src/components/ChartDataEditor.tsx
21022
- var import_react87 = require("react");
21153
+ var import_react88 = require("react");
21023
21154
  var import_jsx_runtime87 = require("react/jsx-runtime");
21024
21155
  function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
21025
- const [draft, setDraft] = (0, import_react87.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
21026
- const [error, setError] = (0, import_react87.useState)("");
21027
- const [applied, setApplied] = (0, import_react87.useState)(false);
21156
+ const [draft, setDraft] = (0, import_react88.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
21157
+ const [error, setError] = (0, import_react88.useState)("");
21158
+ const [applied, setApplied] = (0, import_react88.useState)(false);
21028
21159
  function apply() {
21029
21160
  try {
21030
21161
  const values = JSON.parse(draft);
@@ -21055,11 +21186,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
21055
21186
  }
21056
21187
 
21057
21188
  // src/components/ChartBarStatistics.tsx
21058
- var import_react88 = require("react");
21189
+ var import_react89 = require("react");
21059
21190
  var import_jsx_runtime88 = require("react/jsx-runtime");
21060
21191
  function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
21061
- const id = (0, import_react88.useId)().replaceAll(":", "");
21062
- const [active, setActive] = (0, import_react88.useState)();
21192
+ const id = (0, import_react89.useId)().replaceAll(":", "");
21193
+ const [active, setActive] = (0, import_react89.useState)();
21063
21194
  const paint = gradient ? `url(#${id})` : color;
21064
21195
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("g", { children: [
21065
21196
  gradient ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
@@ -21114,7 +21245,7 @@ function lineSegments(points) {
21114
21245
  }
21115
21246
 
21116
21247
  // src/components/useBarMagicState.ts
21117
- var import_react89 = require("react");
21248
+ var import_react90 = require("react");
21118
21249
 
21119
21250
  // src/components/cartesianMagicState.ts
21120
21251
  function changeCartesianMagic(state, action) {
@@ -21129,8 +21260,8 @@ function changeCartesianMagic(state, action) {
21129
21260
  function useBarMagicState(toolbox, shape = "bar") {
21130
21261
  const initial3 = { shape, layout: "original" };
21131
21262
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
21132
- const [state, setState] = (0, import_react89.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
21133
- (0, import_react89.useEffect)(() => {
21263
+ const [state, setState] = (0, import_react90.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
21264
+ (0, import_react90.useEffect)(() => {
21134
21265
  if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
21135
21266
  }, [options?.activeMagicType]);
21136
21267
  const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
@@ -21144,7 +21275,7 @@ function useBarMagicState(toolbox, shape = "bar") {
21144
21275
  }
21145
21276
 
21146
21277
  // src/components/useBarValueTransfer.ts
21147
- var import_react90 = require("react");
21278
+ var import_react91 = require("react");
21148
21279
 
21149
21280
  // src/components/barTransfer.ts
21150
21281
  function transferBarValue(series, source, target, categories) {
@@ -21161,10 +21292,10 @@ function transferBarValue(series, source, target, categories) {
21161
21292
 
21162
21293
  // src/components/useBarValueTransfer.ts
21163
21294
  function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
21164
- const [islands, setIslands] = (0, import_react90.useState)([]);
21165
- const drag = (0, import_react90.useRef)();
21166
- const [offset, setOffset] = (0, import_react90.useState)();
21167
- (0, import_react90.useEffect)(() => {
21295
+ const [islands, setIslands] = (0, import_react91.useState)([]);
21296
+ const drag = (0, import_react91.useRef)();
21297
+ const [offset, setOffset] = (0, import_react91.useState)();
21298
+ (0, import_react91.useEffect)(() => {
21168
21299
  setIslands([]);
21169
21300
  drag.current = void 0;
21170
21301
  setOffset(void 0);
@@ -21265,12 +21396,12 @@ function logarithmicValueAt(progress, domain) {
21265
21396
 
21266
21397
  // src/components/Charts.tsx
21267
21398
  var import_jsx_runtime89 = require("react/jsx-runtime");
21268
- var import_react92 = require("react");
21399
+ var import_react93 = require("react");
21269
21400
  var PLOT = { x: 62, y: 48, width: 628, height: 250 };
21270
21401
  var PLOT_BOTTOM = PLOT.y + PLOT.height;
21271
21402
  function useLegendSelection(names, controlled, onChange) {
21272
- const [internal, setInternal] = (0, import_react91.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
21273
- (0, import_react91.useEffect)(() => {
21403
+ const [internal, setInternal] = (0, import_react92.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
21404
+ (0, import_react92.useEffect)(() => {
21274
21405
  setInternal((current) => {
21275
21406
  const next = { ...current };
21276
21407
  names.forEach((name) => {
@@ -21370,7 +21501,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
21370
21501
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
21371
21502
  }
21372
21503
  function useZoom(value, defaultValue, onChange) {
21373
- const [internal, setInternal] = (0, import_react91.useState)([...defaultValue ?? [0, 100]]);
21504
+ const [internal, setInternal] = (0, import_react92.useState)([...defaultValue ?? [0, 100]]);
21374
21505
  const current = value ?? internal;
21375
21506
  const update = (next) => {
21376
21507
  if (!value) setInternal(next);
@@ -21380,8 +21511,8 @@ function useZoom(value, defaultValue, onChange) {
21380
21511
  }
21381
21512
  function useToolboxMagicType(toolbox, fallback) {
21382
21513
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
21383
- const [internal, setInternal] = (0, import_react91.useState)(options?.activeMagicType ?? fallback);
21384
- (0, import_react91.useEffect)(() => {
21514
+ const [internal, setInternal] = (0, import_react92.useState)(options?.activeMagicType ?? fallback);
21515
+ (0, import_react92.useEffect)(() => {
21385
21516
  if (options?.activeMagicType) setInternal(options.activeMagicType);
21386
21517
  }, [options?.activeMagicType]);
21387
21518
  const active = options?.activeMagicType ?? internal;
@@ -21399,15 +21530,15 @@ function useToolboxMagicType(toolbox, fallback) {
21399
21530
  } : toolbox;
21400
21531
  return [active, resolved];
21401
21532
  }
21402
- var LineChart = (0, import_react91.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
21403
- const [hoverIndex, setHoverIndex] = (0, import_react91.useState)(null);
21404
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
21405
- const [dragPoint, setDragPoint] = (0, import_react91.useState)(null);
21406
- const linePaintId = (0, import_react91.useId)().replaceAll(":", "");
21407
- const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react91.useState)();
21408
- (0, import_react91.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21533
+ var LineChart = (0, import_react92.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
21534
+ const [hoverIndex, setHoverIndex] = (0, import_react92.useState)(null);
21535
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
21536
+ const [dragPoint, setDragPoint] = (0, import_react92.useState)(null);
21537
+ const linePaintId = (0, import_react92.useId)().replaceAll(":", "");
21538
+ const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react92.useState)();
21539
+ (0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21409
21540
  const series = externalValueTransfer ? sourceSeries : editableSeries;
21410
- const initialTransferSeries = (0, import_react91.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
21541
+ const initialTransferSeries = (0, import_react92.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
21411
21542
  const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
21412
21543
  const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
21413
21544
  const value = barDatum(nextBars[row].data[index]).value;
@@ -21424,8 +21555,8 @@ var LineChart = (0, import_react91.forwardRef)(function LineChart2({ calculableM
21424
21555
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
21425
21556
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
21426
21557
  const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
21427
- const [zoomBrushActive, setZoomBrushActive] = (0, import_react91.useState)(false);
21428
- const [zoomHistory, setZoomHistory] = (0, import_react91.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
21558
+ const [zoomBrushActive, setZoomBrushActive] = (0, import_react92.useState)(false);
21559
+ const [zoomHistory, setZoomHistory] = (0, import_react92.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
21429
21560
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
21430
21561
  const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
21431
21562
  const next = [start + range[0] * span, start + range[1] * span];
@@ -21812,17 +21943,17 @@ function ChartPin({ point, color, label }) {
21812
21943
  function barDatum(datum) {
21813
21944
  return typeof datum === "number" ? { value: datum } : datum;
21814
21945
  }
21815
- var BarChart = (0, import_react91.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
21816
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
21817
- const [dragBar, setDragBar] = (0, import_react91.useState)(null);
21818
- const [hoveredBar, setHoveredBar] = (0, import_react91.useState)();
21819
- const barPaintId = (0, import_react91.useId)().replaceAll(":", "");
21946
+ var BarChart = (0, import_react92.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
21947
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
21948
+ const [dragBar, setDragBar] = (0, import_react92.useState)(null);
21949
+ const [hoveredBar, setHoveredBar] = (0, import_react92.useState)();
21950
+ const barPaintId = (0, import_react92.useId)().replaceAll(":", "");
21820
21951
  const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
21821
21952
  setEditableSeries(next);
21822
21953
  onDataChange?.(next);
21823
21954
  }, onTransferError);
21824
21955
  const transfer = externalValueTransfer ?? localTransfer;
21825
- (0, import_react91.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21956
+ (0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21826
21957
  const series = externalValueTransfer ? sourceSeries : editableSeries;
21827
21958
  const legacy = appearance === "macarons";
21828
21959
  const PLOT2 = legacy ? { x: grid?.left ?? 80, y: grid?.top ?? 60, width: (props.viewBoxSize?.[0] ?? 720) - (grid?.left ?? 80) - (grid?.right ?? 80), height: (props.viewBoxSize?.[1] ?? 360) - (grid?.top ?? 60) - (grid?.bottom ?? 70) } : { x: 62, y: 48, width: 628, height: 250 };
@@ -22069,17 +22200,17 @@ var BarChart = (0, import_react91.forwardRef)(function BarChart2({ valueTransfer
22069
22200
  ] }, `bar-island-${index}`)) : null
22070
22201
  ] });
22071
22202
  });
22072
- var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
22073
- const [data, setData] = (0, import_react91.useState)(initialData);
22074
- const [emphasizedPoint, setEmphasizedPoint] = (0, import_react91.useState)(null);
22075
- const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react91.useState)();
22076
- (0, import_react91.useEffect)(() => setData(initialData), [initialData]);
22203
+ var ScatterChart = (0, import_react92.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
22204
+ const [data, setData] = (0, import_react92.useState)(initialData);
22205
+ const [emphasizedPoint, setEmphasizedPoint] = (0, import_react92.useState)(null);
22206
+ const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react92.useState)();
22207
+ (0, import_react92.useEffect)(() => setData(initialData), [initialData]);
22077
22208
  const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
22078
22209
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
22079
22210
  const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
22080
22211
  const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
22081
22212
  const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
22082
- const sorted = (0, import_react91.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
22213
+ const sorted = (0, import_react92.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
22083
22214
  const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
22084
22215
  const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
22085
22216
  const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
@@ -22094,10 +22225,10 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
22094
22225
  const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
22095
22226
  const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
22096
22227
  const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
22097
- const [selectedPieces, setSelectedPieces] = (0, import_react91.useState)([]);
22098
- const [visualRange, setVisualRange] = (0, import_react91.useState)();
22228
+ const [selectedPieces, setSelectedPieces] = (0, import_react92.useState)([]);
22229
+ const [visualRange, setVisualRange] = (0, import_react92.useState)();
22099
22230
  const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
22100
- (0, import_react91.useEffect)(() => setSelectedPieces([]), [piecesKey]);
22231
+ (0, import_react92.useEffect)(() => setSelectedPieces([]), [piecesKey]);
22101
22232
  const statistics = scatterStatistics(visibleData, markByCategory);
22102
22233
  const plotted = visibleData.map((item, index) => {
22103
22234
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
@@ -22255,8 +22386,8 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
22255
22386
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
22256
22387
  ] }) : content;
22257
22388
  });
22258
- var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
22259
- const [data, setData] = (0, import_react91.useState)(initialData), [internalActive, setInternalActive] = (0, import_react91.useState)(null), [internalVisible, setInternalVisible] = (0, import_react91.useState)(true);
22389
+ var CandlestickChart = (0, import_react92.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
22390
+ const [data, setData] = (0, import_react92.useState)(initialData), [internalActive, setInternalActive] = (0, import_react92.useState)(null), [internalVisible, setInternalVisible] = (0, import_react92.useState)(true);
22260
22391
  const active = activeIndex === void 0 ? internalActive : activeIndex;
22261
22392
  const seriesVisible = controlledVisible ?? internalVisible;
22262
22393
  const setActive = (index) => {
@@ -22267,7 +22398,7 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
22267
22398
  if (controlledVisible === void 0) setInternalVisible(visible);
22268
22399
  onSeriesVisibilityChange?.(visible);
22269
22400
  };
22270
- (0, import_react91.useEffect)(() => {
22401
+ (0, import_react92.useEffect)(() => {
22271
22402
  setData(initialData);
22272
22403
  }, [initialData]);
22273
22404
  const legacy = appearance === "macarons";
@@ -22358,20 +22489,20 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
22358
22489
  ] }) : content;
22359
22490
  });
22360
22491
  var EMPTY_PIE_DATA = [];
22361
- var PieChart = (0, import_react91.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
22362
- const pieGradientId = (0, import_react91.useId)().replace(/:/g, "");
22363
- const [pieIslands, setPieIslands] = (0, import_react91.useState)([]);
22364
- const sourceRings = (0, import_react91.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
22365
- const [editableRings, setEditableRings] = (0, import_react91.useState)(sourceRings);
22366
- const valueDrag = (0, import_react91.useRef)(null);
22367
- const [valueOffset, setValueOffset] = (0, import_react91.useState)();
22368
- (0, import_react91.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
22492
+ var PieChart = (0, import_react92.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
22493
+ const pieGradientId = (0, import_react92.useId)().replace(/:/g, "");
22494
+ const [pieIslands, setPieIslands] = (0, import_react92.useState)([]);
22495
+ const sourceRings = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
22496
+ const [editableRings, setEditableRings] = (0, import_react92.useState)(sourceRings);
22497
+ const valueDrag = (0, import_react92.useRef)(null);
22498
+ const [valueOffset, setValueOffset] = (0, import_react92.useState)();
22499
+ (0, import_react92.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
22369
22500
  const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
22370
22501
  const names = [...new Set(allData.map((item) => item.name))];
22371
22502
  const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
22372
22503
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
22373
- const [hovered, setHovered] = (0, import_react91.useState)();
22374
- const [internalSelected, setInternalSelected] = (0, import_react91.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
22504
+ const [hovered, setHovered] = (0, import_react92.useState)();
22505
+ const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
22375
22506
  const selectedNames = selected ?? internalSelected;
22376
22507
  const legacy = appearance === "macarons";
22377
22508
  const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
@@ -22591,15 +22722,15 @@ var PieChart = (0, import_react91.forwardRef)(function PieChart2({ pulseRing, ca
22591
22722
  });
22592
22723
  var EMPTY_RADAR_INDICATORS = [];
22593
22724
  var EMPTY_RADAR_SERIES = [];
22594
- var RadarChart = (0, import_react91.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
22725
+ var RadarChart = (0, import_react92.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
22595
22726
  const legacy = appearance === "macarons";
22596
- const initialPanels = (0, import_react91.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
22597
- const [sourcePanels, setSourcePanels] = (0, import_react91.useState)(initialPanels);
22598
- const [hoveredRadar, setHoveredRadar] = (0, import_react91.useState)(null);
22599
- const radarPaintId = `sia-radar-${(0, import_react91.useId)().replaceAll(":", "")}`;
22600
- const radarDrag = (0, import_react91.useRef)(null);
22601
- const [radarOffset, setRadarOffset] = (0, import_react91.useState)(null);
22602
- (0, import_react91.useEffect)(() => {
22727
+ const initialPanels = (0, import_react92.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
22728
+ const [sourcePanels, setSourcePanels] = (0, import_react92.useState)(initialPanels);
22729
+ const [hoveredRadar, setHoveredRadar] = (0, import_react92.useState)(null);
22730
+ const radarPaintId = `sia-radar-${(0, import_react92.useId)().replaceAll(":", "")}`;
22731
+ const radarDrag = (0, import_react92.useRef)(null);
22732
+ const [radarOffset, setRadarOffset] = (0, import_react92.useState)(null);
22733
+ (0, import_react92.useEffect)(() => {
22603
22734
  setSourcePanels(initialPanels);
22604
22735
  radarDrag.current = null;
22605
22736
  setRadarOffset(null);
@@ -22753,7 +22884,7 @@ var RadarChart = (0, import_react91.forwardRef)(function RadarChart2({ indicator
22753
22884
  })
22754
22885
  ] });
22755
22886
  });
22756
- var ChordChart = (0, import_react91.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
22887
+ var ChordChart = (0, import_react92.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
22757
22888
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
22758
22889
  if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
22759
22890
  GraphChart,
@@ -22826,11 +22957,11 @@ var ChordChart = (0, import_react91.forwardRef)(function ChordChart2({ nodes, li
22826
22957
  })
22827
22958
  ] });
22828
22959
  });
22829
- var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
22960
+ var GraphChart = (0, import_react92.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
22830
22961
  const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
22831
22962
  const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
22832
22963
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
22833
- const [roamReset, setRoamReset] = (0, import_react91.useState)(0);
22964
+ const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
22834
22965
  const chartToolbox = typeof resolvedToolbox === "object" ? {
22835
22966
  ...resolvedToolbox,
22836
22967
  onRestore: () => {
@@ -22839,23 +22970,23 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
22839
22970
  resolvedToolbox.onRestore?.();
22840
22971
  }
22841
22972
  } : resolvedToolbox;
22842
- const activeNodes = (0, import_react91.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
22843
- const activeLinks = (0, import_react91.useMemo)(() => {
22973
+ const activeNodes = (0, import_react92.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
22974
+ const activeLinks = (0, import_react92.useMemo)(() => {
22844
22975
  const activeIds = new Set(activeNodes.map((node) => node.id));
22845
22976
  return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
22846
22977
  }, [activeNodes, links]);
22847
22978
  const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
22848
- const calculatedPositions = (0, import_react91.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
22849
- const [positions, setPositions] = (0, import_react91.useState)(calculatedPositions);
22850
- const [dragging, setDragging] = (0, import_react91.useState)(null);
22851
- const heldNode = (0, import_react91.useRef)(null);
22852
- const [forceRestart, setForceRestart] = (0, import_react91.useState)(0);
22853
- (0, import_react91.useEffect)(() => {
22979
+ const calculatedPositions = (0, import_react92.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
22980
+ const [positions, setPositions] = (0, import_react92.useState)(calculatedPositions);
22981
+ const [dragging, setDragging] = (0, import_react92.useState)(null);
22982
+ const heldNode = (0, import_react92.useRef)(null);
22983
+ const [forceRestart, setForceRestart] = (0, import_react92.useState)(0);
22984
+ (0, import_react92.useEffect)(() => {
22854
22985
  setPositions(calculatedPositions);
22855
22986
  setDragging(null);
22856
22987
  heldNode.current = null;
22857
22988
  }, [calculatedPositions, roamReset]);
22858
- (0, import_react91.useEffect)(() => {
22989
+ (0, import_react92.useEffect)(() => {
22859
22990
  if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
22860
22991
  let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
22861
22992
  const tick = (time) => {
@@ -22973,7 +23104,7 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
22973
23104
  ] })
22974
23105
  ] });
22975
23106
  });
22976
- var ForceGraphChart = (0, import_react91.forwardRef)(function ForceGraphChart2(props, ref) {
23107
+ var ForceGraphChart = (0, import_react92.forwardRef)(function ForceGraphChart2(props, ref) {
22977
23108
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(GraphChart, { ...props, layout: "force", ref });
22978
23109
  });
22979
23110
  var ForceChart = ForceGraphChart;
@@ -23002,12 +23133,12 @@ function colorBetween(start, end, ratio) {
23002
23133
  const to = read(end);
23003
23134
  return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
23004
23135
  }
23005
- var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
23006
- const [internalSelected, setInternalSelected] = (0, import_react91.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
23136
+ var MapChart = (0, import_react92.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
23137
+ const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
23007
23138
  const selectedNames = selected ?? internalSelected;
23008
- const [hoveredRegion, setHoveredRegion] = (0, import_react91.useState)();
23009
- const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react91.useState)();
23010
- const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react91.useState)();
23139
+ const [hoveredRegion, setHoveredRegion] = (0, import_react92.useState)();
23140
+ const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react92.useState)();
23141
+ const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react92.useState)();
23011
23142
  const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
23012
23143
  const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
23013
23144
  const { view } = roamControl;
@@ -23022,8 +23153,8 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
23022
23153
  const values = data.map((item) => item.value);
23023
23154
  const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
23024
23155
  const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
23025
- const [internalVisualRange, setInternalVisualRange] = (0, import_react91.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
23026
- (0, import_react91.useEffect)(() => {
23156
+ const [internalVisualRange, setInternalVisualRange] = (0, import_react92.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
23157
+ (0, import_react92.useEffect)(() => {
23027
23158
  if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
23028
23159
  }, [defaultVisualRange, maximum, minimum, visualRange]);
23029
23160
  const currentVisualRange = visualRange ?? internalVisualRange;
@@ -23199,7 +23330,7 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
23199
23330
  roamController ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartRoamController, { x: (props.viewBoxSize?.[0] ?? 720) - 90, y: 5, onPan: roamControl.pan, onZoom: (factor) => roamControl.zoom(factor, [(props.viewBoxSize?.[0] ?? 720) / 2, (props.viewBoxSize?.[1] ?? 360) / 2]) }) : null
23200
23331
  ] });
23201
23332
  });
23202
- var GaugeChart = (0, import_react91.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
23333
+ var GaugeChart = (0, import_react92.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
23203
23334
  const count = Math.max(1, data.length);
23204
23335
  const legacy = appearance === "macarons";
23205
23336
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: !data.length, ariaLabel: props.ariaLabel ?? "\u4EEA\u8868\u76D8", children: [...data].sort((a, b) => (a.zIndex ?? 0) - (b.zIndex ?? 0)).map((item, index) => {
@@ -23282,12 +23413,12 @@ var GaugeChart = (0, import_react91.forwardRef)(function GaugeChart2({ tooltipFo
23282
23413
  ] }, `${item.name}-${index}`);
23283
23414
  }) });
23284
23415
  });
23285
- var FunnelChart = (0, import_react91.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
23416
+ var FunnelChart = (0, import_react92.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
23286
23417
  const legacy = appearance === "macarons";
23287
- const [activeFunnel, setActiveFunnel] = (0, import_react91.useState)(null);
23288
- const initialFunnels = (0, import_react91.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
23289
- const [sourceFunnels, setSourceFunnels] = (0, import_react91.useState)(initialFunnels);
23290
- (0, import_react91.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
23418
+ const [activeFunnel, setActiveFunnel] = (0, import_react92.useState)(null);
23419
+ const initialFunnels = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
23420
+ const [sourceFunnels, setSourceFunnels] = (0, import_react92.useState)(initialFunnels);
23421
+ (0, import_react92.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
23291
23422
  const allData = sourceFunnels.flatMap((funnel) => funnel.data);
23292
23423
  const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
23293
23424
  const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -23378,7 +23509,7 @@ var FunnelChart = (0, import_react91.forwardRef)(function FunnelChart2({ data =
23378
23509
  })
23379
23510
  ] });
23380
23511
  });
23381
- var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
23512
+ var HeatmapChart = (0, import_react92.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
23382
23513
  const pointMode = points.length > 0;
23383
23514
  const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
23384
23515
  const minimum = values.length ? Math.min(...values) : 0;
@@ -23387,7 +23518,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
23387
23518
  const cellHeight = PLOT.height / Math.max(1, yLabels.length);
23388
23519
  const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
23389
23520
  const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
23390
- const filterId = `sia-heat-${(0, import_react91.useId)().replaceAll(":", "")}`;
23521
+ const filterId = `sia-heat-${(0, import_react92.useId)().replaceAll(":", "")}`;
23391
23522
  if (raster) return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
23392
23523
  raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
23393
23524
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
@@ -23423,7 +23554,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
23423
23554
  ] })
23424
23555
  ] });
23425
23556
  });
23426
- var ThemeRiverChart = (0, import_react91.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23557
+ var ThemeRiverChart = (0, import_react92.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23427
23558
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
23428
23559
  const activeSeries = series.filter((item) => legend.isSelected(item.name));
23429
23560
  const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
@@ -23461,8 +23592,8 @@ function eventTime(value) {
23461
23592
  if (typeof value === "number") return value;
23462
23593
  return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
23463
23594
  }
23464
- var EventRiverChart = (0, import_react91.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23465
- const [restoreVersion, setRestoreVersion] = (0, import_react91.useState)(0);
23595
+ var EventRiverChart = (0, import_react92.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23596
+ const [restoreVersion, setRestoreVersion] = (0, import_react92.useState)(0);
23466
23597
  const area = plot;
23467
23598
  palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
23468
23599
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -23535,9 +23666,9 @@ function vennDistance(radiusA, radiusB, overlap) {
23535
23666
  }
23536
23667
  return (low + high) / 2;
23537
23668
  }
23538
- var VennChart = (0, import_react91.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
23539
- const [sets, setSets] = (0, import_react91.useState)(initialSets), [intersection, setIntersection] = (0, import_react91.useState)(initialIntersection), [active, setActive] = (0, import_react91.useState)();
23540
- (0, import_react91.useEffect)(() => {
23669
+ var VennChart = (0, import_react92.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
23670
+ const [sets, setSets] = (0, import_react92.useState)(initialSets), [intersection, setIntersection] = (0, import_react92.useState)(initialIntersection), [active, setActive] = (0, import_react92.useState)();
23671
+ (0, import_react92.useEffect)(() => {
23541
23672
  setSets(initialSets);
23542
23673
  setIntersection(initialIntersection);
23543
23674
  }, [initialSets, initialIntersection]);
@@ -23600,17 +23731,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
23600
23731
  });
23601
23732
  return result;
23602
23733
  }
23603
- var TreemapChart = (0, import_react91.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
23604
- const [path, setPath] = (0, import_react91.useState)([]);
23605
- const [sourceData, setSourceData] = (0, import_react91.useState)(data);
23606
- const [active, setActive] = (0, import_react91.useState)();
23607
- (0, import_react91.useEffect)(() => {
23734
+ var TreemapChart = (0, import_react92.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
23735
+ const [path, setPath] = (0, import_react92.useState)([]);
23736
+ const [sourceData, setSourceData] = (0, import_react92.useState)(data);
23737
+ const [active, setActive] = (0, import_react92.useState)();
23738
+ (0, import_react92.useEffect)(() => {
23608
23739
  setSourceData(data);
23609
23740
  setPath([]);
23610
23741
  }, [data]);
23611
23742
  const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
23612
23743
  const top = drilldown && showBreadcrumb ? 52 : 28;
23613
- const rectangles = (0, import_react91.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
23744
+ const rectangles = (0, import_react92.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
23614
23745
  const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
23615
23746
  const update = (nodes, depth) => nodes.map((node, i) => depth === path.length ? { ...node, value: values[i][0] } : node.name === path[depth] ? { ...node, children: update(node.children ?? [], depth + 1) } : node);
23616
23747
  setSourceData(update(sourceData, 0));
@@ -23678,15 +23809,15 @@ function flattenTree2(root, collapsed) {
23678
23809
  visit(root, 0);
23679
23810
  return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
23680
23811
  }
23681
- var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
23682
- const [sourceData, setSourceData] = (0, import_react91.useState)(data);
23683
- const [roamReset, setRoamReset] = (0, import_react91.useState)(0);
23684
- const [active, setActive] = (0, import_react91.useState)();
23685
- (0, import_react91.useEffect)(() => {
23812
+ var TreeChart = (0, import_react92.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
23813
+ const [sourceData, setSourceData] = (0, import_react92.useState)(data);
23814
+ const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
23815
+ const [active, setActive] = (0, import_react92.useState)();
23816
+ (0, import_react92.useEffect)(() => {
23686
23817
  setSourceData(data);
23687
23818
  setActive(void 0);
23688
23819
  }, [data]);
23689
- const [collapsed, setCollapsed] = (0, import_react91.useState)(() => {
23820
+ const [collapsed, setCollapsed] = (0, import_react92.useState)(() => {
23690
23821
  const result = /* @__PURE__ */ new Set();
23691
23822
  const visit = (node) => {
23692
23823
  if (node.collapsed) result.add(node.name);
@@ -23695,8 +23826,8 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
23695
23826
  visit(data);
23696
23827
  return result;
23697
23828
  });
23698
- const layout = (0, import_react91.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
23699
- const fixedLayout = (0, import_react91.useMemo)(() => {
23829
+ const layout = (0, import_react92.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
23830
+ const fixedLayout = (0, import_react92.useMemo)(() => {
23700
23831
  const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
23701
23832
  return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
23702
23833
  }, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
@@ -23766,15 +23897,15 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
23766
23897
  })
23767
23898
  ] }) });
23768
23899
  });
23769
- var WordCloudChart = (0, import_react91.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
23770
- const placements = (0, import_react91.useMemo)(() => {
23900
+ var WordCloudChart = (0, import_react92.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
23901
+ const placements = (0, import_react92.useMemo)(() => {
23771
23902
  const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
23772
23903
  return layoutCloudWords(data, { bounds: bounds ?? { x: 18, y: 18, width: 684, height: 324 }, minFontSize, maxFontSize, rotations, spiralStep, shape, padding, autoFit, areaSizing, measure: context ? (word, size) => {
23773
23904
  context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
23774
23905
  return context.measureText(word.name).width;
23775
23906
  } : void 0 });
23776
23907
  }, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
23777
- (0, import_react91.useEffect)(() => {
23908
+ (0, import_react92.useEffect)(() => {
23778
23909
  const present = new Set(placements.map((p) => p.index));
23779
23910
  onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
23780
23911
  }, [placements, data, onLayout]);
@@ -23783,30 +23914,30 @@ var WordCloudChart = (0, import_react91.forwardRef)(function WordCloudChart2({ d
23783
23914
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name: placement.item.name, value: placement.item.value }), tooltipPoint: [placement.x, placement.y], transform: `rotate(${placement.rotation} ${placement.x} ${placement.y})`, onPointerUp: (event) => onDataClick?.({ name: placement.item.name, value: placement.item.value, data: placement.item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("text", { x: placement.x, y: placement.y + placement.fontSize * 0.34, textAnchor: "middle", fill: color, style: { fontSize: placement.fontSize, fontFamily: placement.item.fontFamily ?? fontFamily, fontWeight: placement.item.fontWeight ?? fontWeight }, className: "sia-chart__word", children: placement.item.name }) }, `${placement.item.name}-${placement.index}`);
23784
23915
  }) });
23785
23916
  });
23786
- var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
23787
- const plotClipId = `sia-mixed-plot-${(0, import_react91.useId)().replaceAll(":", "")}`;
23788
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
23789
- const [geometry, setGeometry] = (0, import_react91.useState)();
23790
- const [pointerIndex, setPointerIndex] = (0, import_react91.useState)(null);
23791
- const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react91.useState)(0);
23792
- const [motionRevision, setMotionRevision] = (0, import_react91.useState)(0);
23793
- const [stackMode, setStackMode] = (0, import_react91.useState)();
23794
- const lastPublished = (0, import_react91.useRef)(null);
23917
+ var MixedChart = (0, import_react92.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
23918
+ const plotClipId = `sia-mixed-plot-${(0, import_react92.useId)().replaceAll(":", "")}`;
23919
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
23920
+ const [geometry, setGeometry] = (0, import_react92.useState)();
23921
+ const [pointerIndex, setPointerIndex] = (0, import_react92.useState)(null);
23922
+ const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react92.useState)(0);
23923
+ const [motionRevision, setMotionRevision] = (0, import_react92.useState)(0);
23924
+ const [stackMode, setStackMode] = (0, import_react92.useState)();
23925
+ const lastPublished = (0, import_react92.useRef)(null);
23795
23926
  const publishData = (next) => {
23796
23927
  lastPublished.current = next;
23797
23928
  onDataChange?.(next);
23798
23929
  };
23799
- const [islands, setIslands] = (0, import_react91.useState)([]);
23800
- const drag = (0, import_react91.useRef)(null);
23801
- const [dragOffset, setDragOffset] = (0, import_react91.useState)();
23802
- (0, import_react91.useEffect)(() => {
23930
+ const [islands, setIslands] = (0, import_react92.useState)([]);
23931
+ const drag = (0, import_react92.useRef)(null);
23932
+ const [dragOffset, setDragOffset] = (0, import_react92.useState)();
23933
+ (0, import_react92.useEffect)(() => {
23803
23934
  if (sourceSeries === lastPublished.current) return;
23804
23935
  setEditableSeries(sourceSeries);
23805
23936
  setIslands([]);
23806
23937
  drag.current = null;
23807
23938
  setDragOffset(void 0);
23808
23939
  }, [sourceSeries]);
23809
- const series = (0, import_react91.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
23940
+ const series = (0, import_react92.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
23810
23941
  const stacked = stackMode ?? sourceStacked;
23811
23942
  const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
23812
23943
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -23970,7 +24101,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
23970
24101
  })
23971
24102
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
23972
24103
  activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { "data-mixed-active-index": activeIndex, x: Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(activeIndex) + band / 2) - Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), height: PLOT2.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
23973
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
24104
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
23974
24105
  calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { ...dragProps(series.indexOf(item), index), label: `${item.name}\uFF0C${categories[index]}\uFF0C\u7A7A\u69FD`, tooltip: "\u62D6\u5165\u6570\u636E\u4EE5\u586B\u5145", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x + index * band + band * activeSeries.indexOf(item) / Math.max(1, activeSeries.length), y: PLOT_BOTTOM2 - 14, width: Math.max(4, band / Math.max(1, activeSeries.length) - 2), height: 14, fill: "transparent", stroke: getColor(series.indexOf(item), item.color, palette), strokeDasharray: "3 2" }) }, `empty-${item.name}-${index}`) : null)) : null,
23975
24106
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
23976
24107
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
@@ -24009,7 +24140,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
24009
24140
  const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
24010
24141
  const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
24011
24142
  const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
24012
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
24143
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
24013
24144
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
24014
24145
  } }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { style: { animation: coordinateAnimation ? "none" : void 0 }, x: frame[1][0], y: Math.min(frame[1][1], frame[2][1]), width: Math.max(0, frame[2][0] - frame[1][0]), height: Math.abs(frame[2][1] - frame[1][1]), rx: item.barRadius ?? 4, fill: item.pointColors?.[index] ?? color, className: "sia-chart__bar" })) }, `${item.name}-${index}-${motionRevision}`);
24015
24146
  })
@@ -24038,7 +24169,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
24038
24169
  if (!placements[index]) return null;
24039
24170
  const name = categoryName(index, item.categoryAxisIndex);
24040
24171
  const value = item.data[index] ?? 0;
24041
- return /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
24172
+ return /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
24042
24173
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
24043
24174
  } }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { className: item.hollowSymbol ? "sia-chart__mixed-hollow-symbol" : void 0, cx: point[0], cy: point[1], r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 2 }));
24044
24175
  })
@@ -24079,9 +24210,9 @@ var KLineChart = CandlestickChart;
24079
24210
 
24080
24211
  // src/components/LineShareChart.tsx
24081
24212
  var import_jsx_runtime90 = require("react/jsx-runtime");
24082
- var LineShareChart = (0, import_react93.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
24083
- const [selected, setSelected] = (0, import_react93.useState)(null);
24084
- const [maskHovered, setMaskHovered] = (0, import_react93.useState)(false);
24213
+ var LineShareChart = (0, import_react94.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
24214
+ const [selected, setSelected] = (0, import_react94.useState)(null);
24215
+ const [maskHovered, setMaskHovered] = (0, import_react94.useState)(false);
24085
24216
  const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
24086
24217
  const total = data.reduce((sum, item2) => sum + item2.value, 0), gap = data.length ? Math.round(Math.max(...data.map((item2) => item2.value)) - Math.min(...data.map((item2) => item2.value))) : 0;
24087
24218
  const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
@@ -24159,16 +24290,16 @@ function paddedValueExtent(values, padding = 0.05) {
24159
24290
  }
24160
24291
 
24161
24292
  // src/components/XYChart.tsx
24162
- var import_react94 = require("react");
24293
+ var import_react95 = require("react");
24163
24294
  var import_jsx_runtime91 = require("react/jsx-runtime");
24164
- var XYChart = (0, import_react94.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
24165
- const [series, setSeries] = (0, import_react94.useState)(source);
24166
- const [hidden, setHidden] = (0, import_react94.useState)([]);
24167
- const [crosshair, setCrosshair] = (0, import_react94.useState)();
24168
- const [drag, setDrag] = (0, import_react94.useState)();
24169
- const [geometry, setGeometry] = (0, import_react94.useState)();
24170
- const [zoom, setZoom] = (0, import_react94.useState)(defaultZoom);
24171
- (0, import_react94.useEffect)(() => setSeries(source), [source]);
24295
+ var XYChart = (0, import_react95.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
24296
+ const [series, setSeries] = (0, import_react95.useState)(source);
24297
+ const [hidden, setHidden] = (0, import_react95.useState)([]);
24298
+ const [crosshair, setCrosshair] = (0, import_react95.useState)();
24299
+ const [drag, setDrag] = (0, import_react95.useState)();
24300
+ const [geometry, setGeometry] = (0, import_react95.useState)();
24301
+ const [zoom, setZoom] = (0, import_react95.useState)(defaultZoom);
24302
+ (0, import_react95.useEffect)(() => setSeries(source), [source]);
24172
24303
  const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
24173
24304
  const active = series.filter((item) => !hidden.includes(item.name)).map((item) => ({ ...item, data: window2 ? item.data.filter((point) => point[0] >= window2[0] && point[0] <= window2[1]) : item.data }));
24174
24305
  const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
@@ -24297,7 +24428,7 @@ var XYChart = (0, import_react94.forwardRef)(function XYChart2({ series: source,
24297
24428
  });
24298
24429
 
24299
24430
  // src/components/ChartMapOverlay.tsx
24300
- var import_react95 = require("react");
24431
+ var import_react96 = require("react");
24301
24432
 
24302
24433
  // src/components/mapOverlayHost.ts
24303
24434
  function observeMapOverlayHost(host, onChange) {
@@ -24336,11 +24467,11 @@ function observeMapOverlayHost(host, onChange) {
24336
24467
  // src/components/ChartMapOverlay.tsx
24337
24468
  var import_jsx_runtime92 = require("react/jsx-runtime");
24338
24469
  function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
24339
- const container = (0, import_react95.useRef)(null);
24340
- const errorHandler = (0, import_react95.useRef)(onError);
24470
+ const container = (0, import_react96.useRef)(null);
24471
+ const errorHandler = (0, import_react96.useRef)(onError);
24341
24472
  errorHandler.current = onError;
24342
- const [snapshot, setSnapshot] = (0, import_react95.useState)();
24343
- (0, import_react95.useEffect)(() => {
24473
+ const [snapshot, setSnapshot] = (0, import_react96.useState)();
24474
+ (0, import_react96.useEffect)(() => {
24344
24475
  setSnapshot(void 0);
24345
24476
  if (!container.current) return;
24346
24477
  try {
@@ -24417,9 +24548,9 @@ function createBaiduMapHost(element, sdk, options) {
24417
24548
  }
24418
24549
 
24419
24550
  // src/components/InputSelect.tsx
24420
- var import_react96 = require("react");
24551
+ var import_react97 = require("react");
24421
24552
  var import_jsx_runtime93 = require("react/jsx-runtime");
24422
- var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24553
+ var InputSelect = (0, import_react97.forwardRef)(function InputSelect2({
24423
24554
  options,
24424
24555
  value,
24425
24556
  defaultValue,
@@ -24445,22 +24576,22 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24445
24576
  ...inputProps
24446
24577
  }, forwardedRef) {
24447
24578
  const size = useControlSize(sizeProp);
24448
- const [internal, setInternal] = (0, import_react96.useState)(defaultValue);
24579
+ const [internal, setInternal] = (0, import_react97.useState)(defaultValue);
24449
24580
  const current = value !== void 0 ? value : internal;
24450
24581
  const values = current == null ? [] : Array.isArray(current) ? current : [current];
24451
24582
  const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
24452
- const [draft, setDraft] = (0, import_react96.useState)(text);
24453
- (0, import_react96.useEffect)(() => {
24583
+ const [draft, setDraft] = (0, import_react97.useState)(text);
24584
+ (0, import_react97.useEffect)(() => {
24454
24585
  setDraft(text);
24455
24586
  }, [text, current]);
24456
- const [open, setOpen] = (0, import_react96.useState)(false);
24457
- const [search, setSearch] = (0, import_react96.useState)("");
24458
- const [modalOpen, setModalOpen] = (0, import_react96.useState)(false);
24459
- const [modalValues, setModalValues] = (0, import_react96.useState)([]);
24460
- const [selectedOnly, setSelectedOnly] = (0, import_react96.useState)(false);
24461
- const rootRef = (0, import_react96.useRef)(null);
24462
- const popupRef = (0, import_react96.useRef)(null);
24463
- const inputRef = (0, import_react96.useRef)(null);
24587
+ const [open, setOpen] = (0, import_react97.useState)(false);
24588
+ const [search, setSearch] = (0, import_react97.useState)("");
24589
+ const [modalOpen, setModalOpen] = (0, import_react97.useState)(false);
24590
+ const [modalValues, setModalValues] = (0, import_react97.useState)([]);
24591
+ const [selectedOnly, setSelectedOnly] = (0, import_react97.useState)(false);
24592
+ const rootRef = (0, import_react97.useRef)(null);
24593
+ const popupRef = (0, import_react97.useRef)(null);
24594
+ const inputRef = (0, import_react97.useRef)(null);
24464
24595
  const config = typeof enableModal === "object" ? enableModal : {};
24465
24596
  function changeOpen(next) {
24466
24597
  if (next && (disabled || loading)) return;
@@ -24480,7 +24611,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24480
24611
  inputRef.current?.focus();
24481
24612
  }
24482
24613
  }
24483
- (0, import_react96.useEffect)(() => {
24614
+ (0, import_react97.useEffect)(() => {
24484
24615
  if (!open) return;
24485
24616
  const outside = (event) => {
24486
24617
  if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
@@ -24488,7 +24619,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24488
24619
  document.addEventListener("pointerdown", outside);
24489
24620
  return () => document.removeEventListener("pointerdown", outside);
24490
24621
  }, [open, onOpenChange]);
24491
- (0, import_react96.useEffect)(() => {
24622
+ (0, import_react97.useEffect)(() => {
24492
24623
  if (disabled || loading) {
24493
24624
  changeOpen(false);
24494
24625
  setModalOpen(false);
@@ -24621,13 +24752,13 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24621
24752
  });
24622
24753
 
24623
24754
  // src/components/QueryForm.tsx
24624
- var import_react99 = require("react");
24755
+ var import_react100 = require("react");
24625
24756
 
24626
24757
  // src/components/QueryFormSettings.tsx
24627
- var import_react98 = require("react");
24758
+ var import_react99 = require("react");
24628
24759
 
24629
24760
  // src/components/useQueryFieldSort.ts
24630
- var import_react97 = require("react");
24761
+ var import_react98 = require("react");
24631
24762
  function getQuerySortPreview(keys, rects, from, dy, gap) {
24632
24763
  const center = rects[from].top + rects[from].height / 2 + dy;
24633
24764
  const rest = keys.map((_, index) => index).filter((index) => index !== from);
@@ -24646,13 +24777,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
24646
24777
  return { ordered, offsets };
24647
24778
  }
24648
24779
  function useQueryFieldSort(keys, enabled, onCommit) {
24649
- const listRef = (0, import_react97.useRef)(null);
24650
- const cancelRef = (0, import_react97.useRef)();
24651
- const commitRef = (0, import_react97.useRef)(onCommit);
24780
+ const listRef = (0, import_react98.useRef)(null);
24781
+ const cancelRef = (0, import_react98.useRef)();
24782
+ const commitRef = (0, import_react98.useRef)(onCommit);
24652
24783
  commitRef.current = onCommit;
24653
- const [preview, setPreview] = (0, import_react97.useState)();
24784
+ const [preview, setPreview] = (0, import_react98.useState)();
24654
24785
  const signature = JSON.stringify(keys);
24655
- (0, import_react97.useEffect)(() => {
24786
+ (0, import_react98.useEffect)(() => {
24656
24787
  cancelRef.current?.();
24657
24788
  return () => cancelRef.current?.();
24658
24789
  }, [enabled, signature]);
@@ -24777,16 +24908,16 @@ function countQueryFieldRows(centers) {
24777
24908
  // src/components/QueryFormSettings.tsx
24778
24909
  var import_jsx_runtime94 = require("react/jsx-runtime");
24779
24910
  function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
24780
- const [snapshot, setSnapshot] = (0, import_react98.useState)();
24781
- const [draft, setDraft] = (0, import_react98.useState)({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
24782
- const [open, setOpen] = (0, import_react98.useState)(false);
24783
- const [loading, setLoading] = (0, import_react98.useState)(false);
24784
- const [saving, setSaving] = (0, import_react98.useState)(false);
24785
- const [error, setError] = (0, import_react98.useState)("");
24786
- const [loadFailed, setLoadFailed] = (0, import_react98.useState)(false);
24787
- const token = (0, import_react98.useRef)(0);
24788
- const saveLock = (0, import_react98.useRef)(false);
24789
- const latest = (0, import_react98.useRef)({ config, fields, defaultCollapsed, applyCollapsed });
24911
+ const [snapshot, setSnapshot] = (0, import_react99.useState)();
24912
+ const [draft, setDraft] = (0, import_react99.useState)({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
24913
+ const [open, setOpen] = (0, import_react99.useState)(false);
24914
+ const [loading, setLoading] = (0, import_react99.useState)(false);
24915
+ const [saving, setSaving] = (0, import_react99.useState)(false);
24916
+ const [error, setError] = (0, import_react99.useState)("");
24917
+ const [loadFailed, setLoadFailed] = (0, import_react99.useState)(false);
24918
+ const token = (0, import_react99.useRef)(0);
24919
+ const saveLock = (0, import_react99.useRef)(false);
24920
+ const latest = (0, import_react99.useRef)({ config, fields, defaultCollapsed, applyCollapsed });
24790
24921
  latest.current = { config, fields, defaultCollapsed, applyCollapsed };
24791
24922
  const moduleName = config?.scope.moduleName;
24792
24923
  const businessKey = config?.scope.businessKey;
@@ -24814,7 +24945,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
24814
24945
  if (request === token.current) setLoading(false);
24815
24946
  }
24816
24947
  }
24817
- (0, import_react98.useEffect)(() => {
24948
+ (0, import_react99.useEffect)(() => {
24818
24949
  setSnapshot(void 0);
24819
24950
  setOpen(false);
24820
24951
  setError("");
@@ -24972,27 +25103,27 @@ function QueryForm({
24972
25103
  ...formProps
24973
25104
  }) {
24974
25105
  const [form] = useForm(providedForm);
24975
- const [internalCollapsed, setInternalCollapsed] = (0, import_react99.useState)(defaultCollapsed);
24976
- const [expandedRows, setExpandedRows] = (0, import_react99.useState)(0);
24977
- const [needsCollapse, setNeedsCollapse] = (0, import_react99.useState)(false);
25106
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react100.useState)(defaultCollapsed);
25107
+ const [expandedRows, setExpandedRows] = (0, import_react100.useState)(0);
25108
+ const [needsCollapse, setNeedsCollapse] = (0, import_react100.useState)(false);
24978
25109
  const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
24979
- const [searching, setSearching] = (0, import_react99.useState)(false);
24980
- const [saving, setSaving] = (0, import_react99.useState)(false);
24981
- const [removing, setRemoving] = (0, import_react99.useState)(false);
24982
- const [saveOpen, setSaveOpen] = (0, import_react99.useState)(false);
24983
- const [saveName, setSaveName] = (0, import_react99.useState)("");
24984
- const [saveError, setSaveError] = (0, import_react99.useState)("");
24985
- const [error, setError] = (0, import_react99.useState)("");
24986
- const [activeShortcut, setActiveShortcut] = (0, import_react99.useState)("");
24987
- const source = (0, import_react99.useRef)({ source: "submit" });
24988
- const searchLock = (0, import_react99.useRef)(false);
24989
- const saveLock = (0, import_react99.useRef)(false);
24990
- const removeLock = (0, import_react99.useRef)(false);
24991
- const snapshot = (0, import_react99.useRef)();
25110
+ const [searching, setSearching] = (0, import_react100.useState)(false);
25111
+ const [saving, setSaving] = (0, import_react100.useState)(false);
25112
+ const [removing, setRemoving] = (0, import_react100.useState)(false);
25113
+ const [saveOpen, setSaveOpen] = (0, import_react100.useState)(false);
25114
+ const [saveName, setSaveName] = (0, import_react100.useState)("");
25115
+ const [saveError, setSaveError] = (0, import_react100.useState)("");
25116
+ const [error, setError] = (0, import_react100.useState)("");
25117
+ const [activeShortcut, setActiveShortcut] = (0, import_react100.useState)("");
25118
+ const source = (0, import_react100.useRef)({ source: "submit" });
25119
+ const searchLock = (0, import_react100.useRef)(false);
25120
+ const saveLock = (0, import_react100.useRef)(false);
25121
+ const removeLock = (0, import_react100.useRef)(false);
25122
+ const snapshot = (0, import_react100.useRef)();
24992
25123
  const busy = disabled || loading || searching;
24993
25124
  const shortcutBusy = busy || shortcutsLoading || saving || removing;
24994
25125
  const fieldLabel = (content) => {
24995
- if (!(0, import_react99.isValidElement)(content)) return void 0;
25126
+ if (!(0, import_react100.isValidElement)(content)) return void 0;
24996
25127
  return content.props.label ?? content.props.placeholder ?? fieldLabel(content.props.children);
24997
25128
  };
24998
25129
  const sourceEntries = fields ? fields.map(({ key, width, settingsLabel, settingsHideDisabled, ...item }) => ({
@@ -25001,8 +25132,8 @@ function QueryForm({
25001
25132
  hideDisabled: settingsHideDisabled,
25002
25133
  label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
25003
25134
  content: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Form.Item, { noStyle: true, ...item })
25004
- })) : import_react99.Children.toArray(children).map((content, index) => ({
25005
- key: (0, import_react99.isValidElement)(content) && content.key != null ? String(content.key) : String(index),
25135
+ })) : import_react100.Children.toArray(children).map((content, index) => ({
25136
+ key: (0, import_react100.isValidElement)(content) && content.key != null ? String(content.key) : String(index),
25006
25137
  width: void 0,
25007
25138
  hideDisabled: false,
25008
25139
  label: fieldLabel(content) ?? `\u6761\u4EF6 ${index + 1}`,
@@ -25015,12 +25146,12 @@ function QueryForm({
25015
25146
  const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
25016
25147
  const layoutKey = JSON.stringify(configured);
25017
25148
  const limit = Math.max(1, Math.floor(collapsedCount));
25018
- const rowRef = (0, import_react99.useRef)(null);
25019
- const actionsRef = (0, import_react99.useRef)(null);
25020
- const toggleRef = (0, import_react99.useRef)(null);
25021
- const [fittingCount, setFittingCount] = (0, import_react99.useState)(limit);
25022
- const [settingsRows, setSettingsRows] = (0, import_react99.useState)(0);
25023
- (0, import_react99.useLayoutEffect)(() => {
25149
+ const rowRef = (0, import_react100.useRef)(null);
25150
+ const actionsRef = (0, import_react100.useRef)(null);
25151
+ const toggleRef = (0, import_react100.useRef)(null);
25152
+ const [fittingCount, setFittingCount] = (0, import_react100.useState)(limit);
25153
+ const [settingsRows, setSettingsRows] = (0, import_react100.useState)(0);
25154
+ (0, import_react100.useLayoutEffect)(() => {
25024
25155
  const row = rowRef.current;
25025
25156
  const actions = actionsRef.current;
25026
25157
  if (!row || !actions) return;
@@ -25364,9 +25495,9 @@ function QueryForm({
25364
25495
  }
25365
25496
 
25366
25497
  // src/components/NumberRange.tsx
25367
- var import_react100 = require("react");
25498
+ var import_react101 = require("react");
25368
25499
  var import_jsx_runtime96 = require("react/jsx-runtime");
25369
- var NumberRange = (0, import_react100.forwardRef)(function NumberRange2({
25500
+ var NumberRange = (0, import_react101.forwardRef)(function NumberRange2({
25370
25501
  value,
25371
25502
  defaultValue = [null, null],
25372
25503
  onChange,