@sia.soul/sia-react-ui 0.1.39 → 0.1.41

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
@@ -2531,38 +2531,66 @@ var activeTooltipClose;
2531
2531
  function clampFloating(value, min, max) {
2532
2532
  return Math.min(Math.max(value, min), Math.max(min, max));
2533
2533
  }
2534
- function resolveFloatingPosition(trigger, overlay, placement) {
2534
+ function normalizeFloatingPlacement(placement) {
2535
+ const aliases = {
2536
+ topLeft: "top-start",
2537
+ topRight: "top-end",
2538
+ bottomLeft: "bottom-start",
2539
+ bottomRight: "bottom-end",
2540
+ leftTop: "left-start",
2541
+ leftBottom: "left-end",
2542
+ rightTop: "right-start",
2543
+ rightBottom: "right-end"
2544
+ };
2545
+ return aliases[placement] ?? placement;
2546
+ }
2547
+ function resolveFloatingPosition(trigger, overlay, placement, pointAtCenter, adjust) {
2535
2548
  const viewportWidth = document.documentElement.clientWidth;
2536
2549
  const viewportHeight = document.documentElement.clientHeight;
2537
- let resolvedPlacement = placement;
2538
- if (placement.startsWith("top") && trigger.top - overlay.height - FLOATING_GAP < FLOATING_VIEWPORT_PADDING && trigger.bottom + overlay.height + FLOATING_GAP <= viewportHeight - FLOATING_VIEWPORT_PADDING) {
2539
- resolvedPlacement = placement.replace("top", "bottom");
2540
- } else if (placement.startsWith("bottom") && trigger.bottom + overlay.height + FLOATING_GAP > viewportHeight - FLOATING_VIEWPORT_PADDING && trigger.top - overlay.height - FLOATING_GAP >= FLOATING_VIEWPORT_PADDING) {
2541
- resolvedPlacement = placement.replace("bottom", "top");
2542
- } else if (placement === "left" && trigger.left - overlay.width - FLOATING_GAP < FLOATING_VIEWPORT_PADDING && trigger.right + overlay.width + FLOATING_GAP <= viewportWidth - FLOATING_VIEWPORT_PADDING) {
2543
- resolvedPlacement = "right";
2544
- } else if (placement === "right" && trigger.right + overlay.width + FLOATING_GAP > viewportWidth - FLOATING_VIEWPORT_PADDING && trigger.left - overlay.width - FLOATING_GAP >= FLOATING_VIEWPORT_PADDING) {
2545
- resolvedPlacement = "left";
2546
- }
2547
- let top = trigger.top;
2548
- let left = trigger.left;
2549
- if (resolvedPlacement.startsWith("top") || resolvedPlacement.startsWith("bottom")) {
2550
- top = resolvedPlacement.startsWith("top") ? trigger.top - overlay.height - FLOATING_GAP : trigger.bottom + FLOATING_GAP;
2551
- left = resolvedPlacement.endsWith("-start") ? trigger.left : resolvedPlacement.endsWith("-end") ? trigger.right - overlay.width : trigger.left + (trigger.width - overlay.width) / 2;
2552
- } else {
2553
- top = trigger.top + (trigger.height - overlay.height) / 2;
2554
- left = resolvedPlacement === "left" ? trigger.left - overlay.width - FLOATING_GAP : trigger.right + FLOATING_GAP;
2550
+ let resolvedPlacement = normalizeFloatingPlacement(placement);
2551
+ const side = resolvedPlacement.split("-")[0];
2552
+ const available = { top: trigger.top, bottom: viewportHeight - trigger.bottom, left: trigger.left, right: viewportWidth - trigger.right };
2553
+ const opposite = { top: "bottom", bottom: "top", left: "right", right: "left" };
2554
+ const preferred = side;
2555
+ const other = opposite[preferred];
2556
+ const needed = (side === "top" || side === "bottom" ? overlay.height : overlay.width) + FLOATING_GAP + FLOATING_VIEWPORT_PADDING;
2557
+ if (adjust && available[preferred] < needed && available[other] > available[preferred]) {
2558
+ resolvedPlacement = resolvedPlacement.replace(preferred, other);
2559
+ }
2560
+ const vertical = resolvedPlacement.startsWith("top") || resolvedPlacement.startsWith("bottom");
2561
+ const start = resolvedPlacement.endsWith("-start");
2562
+ const end = resolvedPlacement.endsWith("-end");
2563
+ let top = vertical ? resolvedPlacement.startsWith("top") ? trigger.top - overlay.height - FLOATING_GAP : trigger.bottom + FLOATING_GAP : start ? trigger.top : end ? trigger.bottom - overlay.height : trigger.top + (trigger.height - overlay.height) / 2;
2564
+ let left = vertical ? start ? trigger.left : end ? trigger.right - overlay.width : trigger.left + (trigger.width - overlay.width) / 2 : resolvedPlacement.startsWith("left") ? trigger.left - overlay.width - FLOATING_GAP : trigger.right + FLOATING_GAP;
2565
+ if (adjust) {
2566
+ if (vertical) left = clampFloating(left, FLOATING_VIEWPORT_PADDING, viewportWidth - overlay.width - FLOATING_VIEWPORT_PADDING);
2567
+ else top = clampFloating(top, FLOATING_VIEWPORT_PADDING, viewportHeight - overlay.height - FLOATING_VIEWPORT_PADDING);
2555
2568
  }
2556
- top = clampFloating(top, FLOATING_VIEWPORT_PADDING, viewportHeight - overlay.height - FLOATING_VIEWPORT_PADDING);
2557
- left = clampFloating(left, FLOATING_VIEWPORT_PADDING, viewportWidth - overlay.width - FLOATING_VIEWPORT_PADDING);
2558
2569
  const result = { top, left, placement: resolvedPlacement };
2559
- if (resolvedPlacement.startsWith("top") || resolvedPlacement.startsWith("bottom")) {
2560
- result.arrowX = resolvedPlacement.endsWith("-start") ? clampFloating(FLOATING_ARROW_EDGE_OFFSET, 8, overlay.width - 16) : resolvedPlacement.endsWith("-end") ? clampFloating(overlay.width - FLOATING_ARROW_EDGE_OFFSET - 8, 8, overlay.width - 16) : clampFloating(trigger.left + trigger.width / 2 - left - 4, 8, overlay.width - 16);
2561
- } else {
2562
- result.arrowY = clampFloating(trigger.top + trigger.height / 2 - top - 4, 8, overlay.height - 16);
2563
- }
2570
+ const size = vertical ? trigger.width : trigger.height;
2571
+ const anchorStart = vertical ? trigger.left : trigger.top;
2572
+ const edge = Math.min(size / 2, FLOATING_ARROW_EDGE_OFFSET + 4);
2573
+ const target = anchorStart + (pointAtCenter || !start && !end ? size / 2 : start ? edge : size - edge);
2574
+ if (vertical) result.arrowX = clampFloating(target - left - 4, 8, overlay.width - 16);
2575
+ else result.arrowY = clampFloating(target - top - 4, 8, overlay.height - 16);
2564
2576
  return result;
2565
2577
  }
2578
+ function isFloatingAnchorHidden(anchor, rect) {
2579
+ let left = 0, top = 0, right = document.documentElement.clientWidth, bottom = document.documentElement.clientHeight;
2580
+ for (let parent = anchor.parentElement; parent; parent = parent.parentElement) {
2581
+ const css = getComputedStyle(parent);
2582
+ const bounds = parent.getBoundingClientRect();
2583
+ if (/(auto|scroll|hidden|clip)/.test(css.overflowX)) {
2584
+ left = Math.max(left, bounds.left);
2585
+ right = Math.min(right, bounds.right);
2586
+ }
2587
+ if (/(auto|scroll|hidden|clip)/.test(css.overflowY)) {
2588
+ top = Math.max(top, bounds.top);
2589
+ bottom = Math.min(bottom, bounds.bottom);
2590
+ }
2591
+ }
2592
+ return rect.right <= left || rect.left >= right || rect.bottom <= top || rect.top >= bottom;
2593
+ }
2566
2594
  function Floating({
2567
2595
  children,
2568
2596
  content,
@@ -2573,6 +2601,7 @@ function Floating({
2573
2601
  mouseEnterDelay = 0.1,
2574
2602
  mouseLeaveDelay = 0.1,
2575
2603
  arrow = true,
2604
+ autoAdjustOverflow = true,
2576
2605
  color,
2577
2606
  className = "",
2578
2607
  overlayClassName = "",
@@ -2580,6 +2609,7 @@ function Floating({
2580
2609
  onOpenChange
2581
2610
  }) {
2582
2611
  const rootRef = (0, import_react14.useRef)(null);
2612
+ const triggerElementRef = (0, import_react14.useRef)(null);
2583
2613
  const overlayRef = (0, import_react14.useRef)(null);
2584
2614
  const enterTimer = (0, import_react14.useRef)();
2585
2615
  const leaveTimer = (0, import_react14.useRef)();
@@ -2631,28 +2661,42 @@ function Floating({
2631
2661
  setPosition(void 0);
2632
2662
  return;
2633
2663
  }
2664
+ const getAnchor = () => {
2665
+ const root = rootRef.current;
2666
+ const target = triggerElementRef.current;
2667
+ return target && root?.contains(target) ? target : root?.firstElementChild ?? root;
2668
+ };
2634
2669
  const update = () => {
2635
2670
  if (!rootRef.current || !overlayRef.current) return;
2636
- setPosition(resolveFloatingPosition(rootRef.current.getBoundingClientRect(), overlayRef.current.getBoundingClientRect(), placement));
2671
+ const anchor2 = getAnchor();
2672
+ if (anchor2) {
2673
+ const rect = anchor2.getBoundingClientRect();
2674
+ const next = resolveFloatingPosition(rect, overlayRef.current.getBoundingClientRect(), placement, typeof arrow === "object" && !!arrow.pointAtCenter, autoAdjustOverflow);
2675
+ next.hidden = isFloatingAnchorHidden(anchor2, rect);
2676
+ setPosition(next);
2677
+ }
2637
2678
  };
2638
2679
  update();
2639
2680
  window.addEventListener("resize", update);
2640
2681
  window.addEventListener("scroll", update, true);
2641
2682
  const observer = new ResizeObserver(update);
2642
2683
  if (rootRef.current) observer.observe(rootRef.current);
2684
+ const anchor = getAnchor();
2685
+ if (anchor) observer.observe(anchor);
2643
2686
  if (overlayRef.current) observer.observe(overlayRef.current);
2644
2687
  return () => {
2645
2688
  window.removeEventListener("resize", update);
2646
2689
  window.removeEventListener("scroll", update, true);
2647
2690
  observer.disconnect();
2648
2691
  };
2649
- }, [children, content, placement, visible]);
2692
+ }, [children, content, placement, visible, autoAdjustOverflow, typeof arrow === "object" && arrow.pointAtCenter]);
2650
2693
  (0, import_react14.useEffect)(() => () => {
2651
2694
  clearTimers();
2652
2695
  if (activeTooltipClose === closeSelfRef.current) activeTooltipClose = void 0;
2653
2696
  }, []);
2654
2697
  const child = (0, import_react14.cloneElement)(children, {
2655
2698
  ...triggers.includes("hover") ? { onMouseEnter: (event) => {
2699
+ triggerElementRef.current = event.currentTarget;
2656
2700
  children.props.onMouseEnter?.(event);
2657
2701
  show(mouseEnterDelay);
2658
2702
  }, onMouseLeave: (event) => {
@@ -2660,6 +2704,7 @@ function Floating({
2660
2704
  hide(mouseLeaveDelay);
2661
2705
  } } : {},
2662
2706
  ...triggers.includes("focus") ? { onFocus: (event) => {
2707
+ triggerElementRef.current = event.currentTarget;
2663
2708
  children.props.onFocus?.(event);
2664
2709
  show();
2665
2710
  }, onBlur: (event) => {
@@ -2667,6 +2712,7 @@ function Floating({
2667
2712
  hide();
2668
2713
  } } : {},
2669
2714
  ...triggers.includes("click") ? { onClick: (event) => {
2715
+ triggerElementRef.current = event.currentTarget;
2670
2716
  children.props.onClick?.(event);
2671
2717
  if (visible) closeNow();
2672
2718
  else openNow();
@@ -2681,14 +2727,14 @@ function Floating({
2681
2727
  id: contentId,
2682
2728
  role,
2683
2729
  "data-custom-color": color ? "" : void 0,
2684
- className: `sia-floating__overlay sia-floating__overlay--${position?.placement ?? placement} ${overlayClassName}`.trim(),
2730
+ className: `sia-floating__overlay sia-floating__overlay--${position?.placement ?? normalizeFloatingPlacement(placement)} ${overlayClassName}`.trim(),
2685
2731
  style: {
2686
2732
  "--sia-floating-color": color,
2687
2733
  "--sia-floating-arrow-x": position?.arrowX == null ? void 0 : `${position.arrowX}px`,
2688
2734
  "--sia-floating-arrow-y": position?.arrowY == null ? void 0 : `${position.arrowY}px`,
2689
2735
  top: position?.top ?? 0,
2690
2736
  left: position?.left ?? 0,
2691
- visibility: position ? "visible" : "hidden"
2737
+ visibility: position && !position.hidden ? "visible" : "hidden"
2692
2738
  },
2693
2739
  onMouseEnter: triggers.includes("hover") ? () => show() : void 0,
2694
2740
  onMouseLeave: triggers.includes("hover") ? () => hide(mouseLeaveDelay) : void 0,
@@ -4737,11 +4783,53 @@ function Popconfirm({
4737
4783
  showCancel = true,
4738
4784
  icon = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: "question", variant: "filled" }),
4739
4785
  onConfirm,
4786
+ onConfirmError,
4740
4787
  onCancel,
4741
- onOpenChange
4788
+ onOpenChange,
4789
+ arrow = true,
4790
+ autoAdjustOverflow = true,
4791
+ skipConfirm = false
4742
4792
  }) {
4743
4793
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
4744
4794
  const [loading, setLoading] = (0, import_react23.useState)(false);
4795
+ const pendingRef = (0, import_react23.useRef)(false);
4796
+ const requestRef = (0, import_react23.useRef)(0);
4797
+ function changeVisible(next) {
4798
+ if (!next) {
4799
+ requestRef.current++;
4800
+ pendingRef.current = false;
4801
+ setLoading(false);
4802
+ }
4803
+ setVisible(next);
4804
+ }
4805
+ (0, import_react23.useEffect)(() => {
4806
+ if (!visible) {
4807
+ requestRef.current++;
4808
+ pendingRef.current = false;
4809
+ setLoading(false);
4810
+ }
4811
+ return () => {
4812
+ requestRef.current++;
4813
+ };
4814
+ }, [visible]);
4815
+ async function confirm(event) {
4816
+ if (disabled || pendingRef.current || okButtonProps?.loading || okButtonProps?.disabled) return;
4817
+ pendingRef.current = true;
4818
+ const request = ++requestRef.current;
4819
+ try {
4820
+ const result = onConfirm?.(event);
4821
+ if (result && typeof result === "object" && typeof result.then === "function") setLoading(true);
4822
+ const resolved = await result;
4823
+ if (request === requestRef.current && resolved !== false && visible) changeVisible(false);
4824
+ } catch (error) {
4825
+ if (request === requestRef.current) onConfirmError?.(error);
4826
+ } finally {
4827
+ if (request === requestRef.current) {
4828
+ pendingRef.current = false;
4829
+ setLoading(false);
4830
+ }
4831
+ }
4832
+ }
4745
4833
  const content = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "sia-popconfirm", children: [
4746
4834
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "sia-popconfirm__message", children: [
4747
4835
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: icon }),
@@ -4753,24 +4841,21 @@ function Popconfirm({
4753
4841
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "sia-popconfirm__actions", children: [
4754
4842
  showCancel ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { size: "small", ...cancelButtonProps, onClick: (event) => {
4755
4843
  cancelButtonProps?.onClick?.(event);
4844
+ if (event.defaultPrevented) return;
4756
4845
  onCancel?.(event);
4757
- setVisible(false);
4846
+ changeVisible(false);
4758
4847
  }, children: cancelText }) : null,
4759
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { size: "small", variant: "primary", ...okButtonProps, loading: loading || okButtonProps?.loading, onClick: async (event) => {
4848
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { size: "small", variant: "primary", ...okButtonProps, loading: loading || okButtonProps?.loading, onClick: (event) => {
4760
4849
  okButtonProps?.onClick?.(event);
4761
- const result = onConfirm?.(event);
4762
- if (result instanceof Promise) {
4763
- setLoading(true);
4764
- try {
4765
- if (await result !== false) setVisible(false);
4766
- } finally {
4767
- setLoading(false);
4768
- }
4769
- } else if (result !== false) setVisible(false);
4850
+ if (!event.defaultPrevented) void confirm(event);
4770
4851
  }, children: okText })
4771
4852
  ] })
4772
4853
  ] });
4773
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Popover, { content, placement, trigger: disabled ? [] : trigger, open: visible, onOpenChange: setVisible, children });
4854
+ const target = skipConfirm ? (0, import_react23.cloneElement)(children, { onClick: (event) => {
4855
+ children.props.onClick?.(event);
4856
+ if (!event.defaultPrevented) void confirm(event);
4857
+ } }) : children;
4858
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Popover, { content, placement, arrow, autoAdjustOverflow, trigger: disabled || skipConfirm ? [] : trigger, open: visible && !skipConfirm && !disabled, onOpenChange: changeVisible, children: target });
4774
4859
  }
4775
4860
  function Progress({
4776
4861
  percent: percent2 = 0,
@@ -7345,11 +7430,12 @@ function DateRangePicker({
7345
7430
  const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
7346
7431
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
7347
7432
  const [draftValue, setDraftValue] = (0, import_react34.useState)(currentValue);
7348
- const [activeIndex, setActiveIndex] = (0, import_react34.useState)(currentValue[0] && !currentValue[1] ? 1 : 0);
7433
+ const [activeIndex, setActiveIndex] = (0, import_react34.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
7434
+ const [confirmedIndex, setConfirmedIndex] = (0, import_react34.useState)(null);
7435
+ const [presetSelected, setPresetSelected] = (0, import_react34.useState)(false);
7349
7436
  const [hoverDate, setHoverDate] = (0, import_react34.useState)("");
7350
7437
  const [viewMonth, setViewMonth] = (0, import_react34.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
7351
7438
  const [endViewMonth, setEndViewMonth] = (0, import_react34.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
7352
- const [compactDateTime, setCompactDateTime] = (0, import_react34.useState)(false);
7353
7439
  const showSecond = showSecondFrom(showTime);
7354
7440
  const defaultTime = defaultTimeFrom(showTime);
7355
7441
  const defaultEndTime = defaultTimeFrom(showTime, 1);
@@ -7360,51 +7446,46 @@ function DateRangePicker({
7360
7446
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
7361
7447
  const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
7362
7448
  const invalidDateTimeRange = Boolean(showTime && draftValue[0] && draftValue[1] && draftValue[0] > draftValue[1]);
7363
- (0, import_react34.useEffect)(() => {
7364
- if (!showTime || typeof document === "undefined") {
7365
- setCompactDateTime(false);
7366
- return void 0;
7367
- }
7368
- const updateLayout = () => {
7369
- const pairedPanelWidth = 2 * (280 + (showSecond ? 144 : 96) + 1) + 3;
7370
- setCompactDateTime(document.documentElement.clientWidth < pairedPanelWidth + 16);
7371
- };
7372
- updateLayout();
7373
- window.addEventListener("resize", updateLayout);
7374
- return () => window.removeEventListener("resize", updateLayout);
7375
- }, [showSecond, showTime]);
7376
7449
  (0, import_react34.useEffect)(() => {
7377
7450
  if (!visible) return void 0;
7378
7451
  const close = (event) => {
7379
7452
  const target = event.target;
7380
- if (!rootRef.current?.contains(target) && !popupRef.current?.contains(target)) setVisible(false);
7453
+ if (!rootRef.current?.contains(target) && !popupRef.current?.contains(target)) dismissPanel();
7381
7454
  };
7382
7455
  document.addEventListener("pointerdown", close);
7383
7456
  return () => document.removeEventListener("pointerdown", close);
7384
- }, [setVisible, visible]);
7385
- function changeOpen(next) {
7386
- if (next) {
7457
+ });
7458
+ function dismissPanel() {
7459
+ setVisible(false);
7460
+ }
7461
+ function changeOpen(next, endpoint) {
7462
+ if (next && !visible) {
7463
+ setConfirmedIndex(null);
7464
+ setPresetSelected(false);
7387
7465
  setDraftValue(currentValue);
7388
7466
  setTimes([timePart(currentValue[0], defaultTime), timePart(currentValue[1], defaultEndTime)]);
7389
- setActiveIndex(endpointDisabled[0] ? 1 : endpointDisabled[1] ? 0 : currentValue[0] && !currentValue[1] ? 1 : 0);
7467
+ setActiveIndex(endpointDisabled[0] ? 1 : endpointDisabled[1] ? 0 : endpoint ?? (currentValue[0] && !currentValue[1] ? 1 : 0));
7390
7468
  const nextStartMonth = startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date());
7391
7469
  setViewMonth(nextStartMonth);
7392
7470
  setEndViewMonth(startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(nextStartMonth, 1)));
7393
7471
  }
7472
+ if (next && endpoint !== void 0 && !endpointDisabled[endpoint]) setActiveIndex(endpoint);
7394
7473
  setVisible(next);
7395
7474
  }
7396
- function isDisabled(day, index = activeIndex, pairedDateTime = false) {
7475
+ function isDisabled(day, index = activeIndex, dateTimeStep = false) {
7397
7476
  if (endpointDisabled[index]) return true;
7398
7477
  const minimum = minDate ?? props.min;
7399
7478
  const maximum = maxDate ?? props.max;
7400
7479
  if (minimum && day < String(minimum).slice(0, 10)) return true;
7401
7480
  if (maximum && day > String(maximum).slice(0, 10)) return true;
7402
7481
  const from = index === 1 ? rangeDates[0] : void 0;
7403
- if (pairedDateTime) {
7404
- const otherEndpoint = index === 0 ? rangeDates[1] : rangeDates[0];
7405
- if (index === 0 && otherEndpoint && day > otherEndpoint) return true;
7406
- if (index === 1 && otherEndpoint && day < otherEndpoint) return true;
7407
- if (otherEndpoint && maxRangeDays && Math.abs(daysBetween(otherEndpoint, day)) >= maxRangeDays) return true;
7482
+ if (dateTimeStep) {
7483
+ const otherIndex2 = index === 0 ? 1 : 0;
7484
+ const otherEndpoint = rangeDates[otherIndex2];
7485
+ if (otherEndpoint && (endpointDisabled[otherIndex2] || confirmedIndex === otherIndex2)) {
7486
+ if (index === 0 && day > otherEndpoint || index === 1 && day < otherEndpoint) return true;
7487
+ if (maxRangeDays && Math.abs(daysBetween(otherEndpoint, day)) >= maxRangeDays) return true;
7488
+ }
7408
7489
  } else if (from && maxRangeDays && Math.abs(daysBetween(from, day)) >= maxRangeDays) return true;
7409
7490
  return disabledDate?.(day, { from, type: "date" }) ?? false;
7410
7491
  }
@@ -7412,8 +7493,12 @@ function DateRangePicker({
7412
7493
  return showTime ? withTime(day, times[index], showSecond) : day;
7413
7494
  }
7414
7495
  function updateDraft(next) {
7496
+ setPresetSelected(false);
7415
7497
  setDraftValue(next);
7416
7498
  onCalendarChange?.(next);
7499
+ if (!showTime && isValidRange(next) && (next[0] !== currentValue[0] || next[1] !== currentValue[1])) {
7500
+ setCurrentValue(next);
7501
+ }
7417
7502
  }
7418
7503
  function selectDate(day) {
7419
7504
  if (isDisabled(day)) return;
@@ -7423,7 +7508,6 @@ function DateRangePicker({
7423
7508
  next[index] = buildRangeValue(day, index);
7424
7509
  updateDraft(next);
7425
7510
  if (!resolvedNeedConfirm && isValidRange(next)) {
7426
- setCurrentValue(next);
7427
7511
  changeOpen(false);
7428
7512
  }
7429
7513
  return;
@@ -7441,7 +7525,6 @@ function DateRangePicker({
7441
7525
  setActiveIndex(0);
7442
7526
  setHoverDate("");
7443
7527
  if (!resolvedNeedConfirm) {
7444
- setCurrentValue(ordered);
7445
7528
  changeOpen(false);
7446
7529
  }
7447
7530
  }
@@ -7451,16 +7534,7 @@ function DateRangePicker({
7451
7534
  nextValue[index] = buildRangeValue(day, index);
7452
7535
  updateDraft(nextValue);
7453
7536
  setHoverDate("");
7454
- if (!resolvedNeedConfirm && compactDateTime && index === 0) {
7455
- setActiveIndex(1);
7456
- setEndViewMonth(startOfMonth(parseDate2(day) ?? /* @__PURE__ */ new Date()));
7457
- return;
7458
- }
7459
7537
  setActiveIndex(index);
7460
- if (!resolvedNeedConfirm && nextValue[0] && nextValue[1] && nextValue[0] <= nextValue[1]) {
7461
- setCurrentValue(nextValue);
7462
- changeOpen(false);
7463
- }
7464
7538
  }
7465
7539
  function changeTime(index, nextTime) {
7466
7540
  if (endpointDisabled[index]) return;
@@ -7496,11 +7570,16 @@ function DateRangePicker({
7496
7570
  }
7497
7571
  return true;
7498
7572
  }
7573
+ const otherIndex = activeIndex === 0 ? 1 : 0;
7574
+ const needsOtherConfirmation = Boolean(showTime && !presetSelected && !endpointDisabled[otherIndex] && confirmedIndex !== otherIndex);
7499
7575
  function confirm() {
7500
- if (compactDateTime && showTime && activeIndex === 0) {
7501
- if (!draftValue[0]) return;
7502
- setActiveIndex(1);
7503
- setEndViewMonth(startOfMonth(parseDate2(dayFromValue(draftValue[1] || draftValue[0])) ?? /* @__PURE__ */ new Date()));
7576
+ if (needsOtherConfirmation) {
7577
+ if (!draftValue[activeIndex] && !allowEmpty[activeIndex]) return;
7578
+ setConfirmedIndex(activeIndex);
7579
+ setActiveIndex(otherIndex);
7580
+ const month = startOfMonth(parseDate2(dayFromValue(draftValue[activeIndex])) ?? /* @__PURE__ */ new Date());
7581
+ if (otherIndex === 0) setViewMonth(month);
7582
+ else setEndViewMonth(month);
7504
7583
  setHoverDate("");
7505
7584
  return;
7506
7585
  }
@@ -7516,12 +7595,13 @@ function DateRangePicker({
7516
7595
  ];
7517
7596
  if (!isValidRange(next)) return;
7518
7597
  updateDraft(next);
7598
+ setConfirmedIndex(null);
7599
+ setPresetSelected(true);
7519
7600
  setTimes([timePart(next[0], defaultTime), timePart(next[1], defaultEndTime)]);
7520
7601
  const nextStartMonth = startOfMonth(parseDate2(dayFromValue(next[0] || next[1])) ?? /* @__PURE__ */ new Date());
7521
7602
  setViewMonth(nextStartMonth);
7522
7603
  setEndViewMonth(startOfMonth(parseDate2(dayFromValue(next[1])) ?? addMonths(nextStartMonth, 1)));
7523
- if (!resolvedNeedConfirm) {
7524
- setCurrentValue(next);
7604
+ if (!showTime && !resolvedNeedConfirm) {
7525
7605
  changeOpen(false);
7526
7606
  }
7527
7607
  }
@@ -7571,6 +7651,7 @@ function DateRangePicker({
7571
7651
  value: times[index],
7572
7652
  showSecond,
7573
7653
  ariaLabel: `${endpointLabel}\u65F6\u95F4`,
7654
+ disabledTime: endpointDisabled[index] ? () => true : void 0,
7574
7655
  onChange: (nextTime) => changeTime(index, nextTime)
7575
7656
  }
7576
7657
  )
@@ -7579,8 +7660,9 @@ function DateRangePicker({
7579
7660
  endpointLabel
7580
7661
  );
7581
7662
  }
7582
- const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(currentValue[0]), active: visible });
7583
- const endFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[1], filled: Boolean(currentValue[1]), active: visible });
7663
+ const displayValue = visible && allowEmpty.some(Boolean) ? draftValue : currentValue;
7664
+ const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(displayValue[0]), active: visible });
7665
+ const endFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[1], filled: Boolean(displayValue[1]), active: visible });
7584
7666
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { ref: rootRef, className: `sia-picker sia-picker-range-control sia-picker--${size} sia-picker--${status}${visible ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
7585
7667
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7586
7668
  "button",
@@ -7596,66 +7678,68 @@ function DateRangePicker({
7596
7678
  "aria-describedby": props["aria-describedby"],
7597
7679
  "aria-errormessage": props["aria-errormessage"],
7598
7680
  disabled,
7599
- onClick: () => changeOpen(!visible),
7681
+ onClick: (event) => {
7682
+ const field = event.target.closest("[data-range-endpoint]");
7683
+ const endpoint = field?.dataset.rangeEndpoint;
7684
+ if (showTime && (endpoint === "0" || endpoint === "1")) {
7685
+ const index = Number(endpoint);
7686
+ if (!endpointDisabled[index]) changeOpen(true, index);
7687
+ } else if (visible) dismissPanel();
7688
+ else changeOpen(true);
7689
+ },
7600
7690
  children: [
7601
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: `sia-picker-range-control__field${startFloating.className}`, children: [
7602
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] ? formatValue2(currentValue[0]) : placeholder[0] }),
7691
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { "data-range-endpoint": "0", className: `sia-picker-range-control__field${startFloating.className}${visible && activeIndex === 0 ? " is-active" : ""}`, children: [
7692
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `sia-picker-range-control__value${displayValue[0] ? "" : " is-placeholder"}`, children: displayValue[0] ? formatValue2(displayValue[0]) : placeholder[0] }),
7603
7693
  startFloating.label
7604
7694
  ] }),
7605
7695
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sia-picker-range-control__separator", children: separator }),
7606
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: `sia-picker-range-control__field${endFloating.className}`, children: [
7607
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] ? formatValue2(currentValue[1]) : placeholder[1] }),
7696
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { "data-range-endpoint": "1", className: `sia-picker-range-control__field${endFloating.className}${visible && activeIndex === 1 ? " is-active" : ""}`, children: [
7697
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `sia-picker-range-control__value${displayValue[1] ? "" : " is-placeholder"}`, children: displayValue[1] ? formatValue2(displayValue[1]) : placeholder[1] }),
7608
7698
  endFloating.label
7609
7699
  ] }),
7610
7700
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "calendar", size: 16 }) })
7611
7701
  ]
7612
7702
  }
7613
7703
  ),
7614
- allowClear && (currentValue[0] || currentValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
7615
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel sia-date-panel--range${showTime ? ` sia-date-panel--with-time sia-date-panel--range-time-${compactDateTime ? "compact" : "paired"}` : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F", children: [
7616
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "sia-date-panel__body", children: showTime ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "sia-date-panel__range-date-time", children: compactDateTime ? renderDateTimeGroup(activeIndex) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7617
- renderDateTimeGroup(0),
7618
- renderDateTimeGroup(1)
7619
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-date-panel__range-calendars", children: [
7620
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "sia-date-panel__calendar", children: [
7621
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7622
- CalendarHeader,
7623
- {
7624
- month: viewMonth,
7625
- range: true,
7626
- onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
7627
- onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1))
7628
- }
7629
- ),
7630
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendarMonth, { month: viewMonth, range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
7631
- ] }),
7632
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "sia-date-panel__calendar", children: [
7633
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7634
- CalendarHeader,
7635
- {
7636
- month: addMonths(viewMonth, 1),
7637
- range: true,
7638
- onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
7639
- onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
7640
- }
7641
- ),
7642
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendarMonth, { month: addMonths(viewMonth, 1), range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
7704
+ allowClear && (displayValue[0] || displayValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
7705
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel sia-date-panel--range${showTime ? " sia-date-panel--with-time sia-date-panel--range-time-compact" : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F", children: [
7706
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-date-panel__body", children: [
7707
+ presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("aside", { className: "sia-date-panel__presets", "aria-label": "\u5FEB\u6377\u65E5\u671F\u8303\u56F4", children: presets.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", onClick: () => applyPreset(preset2), children: preset2.label }, index)) }) : null,
7708
+ showTime ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "sia-date-panel__range-date-time", children: renderDateTimeGroup(activeIndex) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sia-date-panel__range-calendars", children: [
7709
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "sia-date-panel__calendar", children: [
7710
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7711
+ CalendarHeader,
7712
+ {
7713
+ month: viewMonth,
7714
+ range: true,
7715
+ onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
7716
+ onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1))
7717
+ }
7718
+ ),
7719
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendarMonth, { month: viewMonth, range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
7720
+ ] }),
7721
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "sia-date-panel__calendar", children: [
7722
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7723
+ CalendarHeader,
7724
+ {
7725
+ month: addMonths(viewMonth, 1),
7726
+ range: true,
7727
+ onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
7728
+ onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
7729
+ }
7730
+ ),
7731
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CalendarMonth, { month: addMonths(viewMonth, 1), range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
7732
+ ] })
7643
7733
  ] })
7644
- ] }) }),
7734
+ ] }),
7645
7735
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7646
7736
  DatePanelFooter,
7647
7737
  {
7648
7738
  showToday: showToday && !presets?.length,
7649
- needConfirm: resolvedNeedConfirm || allowEmpty.some(Boolean),
7650
- disabledConfirm: compactDateTime && showTime && activeIndex === 0 ? !draftValue[0] : !isValidRange(draftValue),
7651
- confirmText: compactDateTime && showTime && activeIndex === 0 ? "\u4E0B\u4E00\u6B65" : "\u786E\u5B9A",
7739
+ needConfirm: Boolean(showTime) || resolvedNeedConfirm || allowEmpty.some(Boolean),
7740
+ disabledConfirm: needsOtherConfirmation ? !draftValue[activeIndex] && !allowEmpty[activeIndex] : !isValidRange(draftValue),
7652
7741
  extra: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
7653
7742
  renderExtraFooter?.(),
7654
- presets?.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", onClick: () => applyPreset(preset2), children: preset2.label }, index)),
7655
- compactDateTime && showTime && activeIndex === 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", onClick: () => {
7656
- setActiveIndex(0);
7657
- setViewMonth(startOfMonth(parseDate2(dayFromValue(draftValue[0])) ?? /* @__PURE__ */ new Date()));
7658
- }, children: "\u4E0A\u4E00\u6B65" }) : null,
7659
7743
  invalidDateTimeRange ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("small", { className: "sia-date-panel__range-error", children: "\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F00\u59CB\u65F6\u95F4" }) : maxRangeDays ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("small", { children: [
7660
7744
  "\u6700\u591A\u9009\u62E9 ",
7661
7745
  maxRangeDays,
@@ -11011,6 +11095,7 @@ function Tag({
11011
11095
  // src/components/Tabs.tsx
11012
11096
  var import_react45 = require("react");
11013
11097
  var import_jsx_runtime47 = require("react/jsx-runtime");
11098
+ var import_react46 = require("react");
11014
11099
  function Tabs({
11015
11100
  items,
11016
11101
  activeKey,
@@ -11045,6 +11130,42 @@ function Tabs({
11045
11130
  const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
11046
11131
  const listRef = (0, import_react45.useRef)(null);
11047
11132
  const indicatorRef = (0, import_react45.useRef)(null);
11133
+ const moreRef = (0, import_react45.useRef)(null);
11134
+ const [overflow, setOverflow] = (0, import_react45.useState)({ count: items.length, width: 0 });
11135
+ const [moreOpen, setMoreOpen] = (0, import_react45.useState)(false);
11136
+ const visibleCount = resolvedOrientation === "horizontal" ? overflow.count : items.length;
11137
+ const hiddenItems = items.slice(visibleCount);
11138
+ (0, import_react45.useLayoutEffect)(() => {
11139
+ const list = listRef.current;
11140
+ if (!list || resolvedOrientation !== "horizontal") return;
11141
+ const entries = Array.from(list.children).filter((node) => node instanceof HTMLElement && node.hasAttribute("data-tab-entry"));
11142
+ const measure = () => {
11143
+ const css = getComputedStyle(list);
11144
+ const gap = parseFloat(css.columnGap) || 0;
11145
+ const padding = (parseFloat(css.paddingLeft) || 0) + (parseFloat(css.paddingRight) || 0);
11146
+ const widths = entries.map((node) => node.getBoundingClientRect().width);
11147
+ const total = widths.reduce((sum, width2) => sum + width2, 0) + gap * Math.max(0, widths.length - 1);
11148
+ const available = Math.max(0, list.clientWidth - padding);
11149
+ let count = widths.length;
11150
+ if (total > available + 0.5) {
11151
+ const moreWidth = moreRef.current?.getBoundingClientRect().width ?? 36;
11152
+ let used = moreWidth;
11153
+ count = 0;
11154
+ for (const width2 of widths) {
11155
+ if (used + gap + width2 > available + 0.5) break;
11156
+ used += gap + width2;
11157
+ count++;
11158
+ }
11159
+ }
11160
+ const width = Math.ceil(total + padding + (parseFloat(css.borderLeftWidth) || 0) + (parseFloat(css.borderRightWidth) || 0));
11161
+ setOverflow((previous) => previous.count === count && previous.width === width ? previous : { count, width });
11162
+ };
11163
+ measure();
11164
+ const observer = new ResizeObserver(measure);
11165
+ observer.observe(list);
11166
+ entries.forEach((entry) => observer.observe(entry));
11167
+ return () => observer.disconnect();
11168
+ }, [items, type, size, closable, resolvedOrientation, tabBarTitle, tabBarExtraContent]);
11048
11169
  const [contentState, setContentState] = (0, import_react45.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
11049
11170
  const settledKeyRef = (0, import_react45.useRef)(selectedKey);
11050
11171
  const afterChangeRef = (0, import_react45.useRef)(onAfterChange);
@@ -11059,16 +11180,12 @@ function Tabs({
11059
11180
  function updateIndicator() {
11060
11181
  if (!list || !indicator) return;
11061
11182
  const active = list.querySelector('[role="tab"][aria-selected="true"]');
11062
- if (!active) {
11183
+ if (!active || active.closest('[data-tab-hidden="true"]')) {
11063
11184
  indicator.style.visibility = "hidden";
11064
11185
  return;
11065
11186
  }
11066
11187
  const listRect = list.getBoundingClientRect();
11067
11188
  const rect = active.getBoundingClientRect();
11068
- if (type === "tech-line" && resolvedOrientation === "horizontal") {
11069
- if (rect.left < listRect.left) list.scrollLeft += rect.left - listRect.left;
11070
- else if (rect.right > listRect.right) list.scrollLeft += rect.right - listRect.right;
11071
- }
11072
11189
  const currentRect = active.getBoundingClientRect();
11073
11190
  indicator.style.transform = `translate(${currentRect.left - listRect.left - list.clientLeft + list.scrollLeft}px, ${currentRect.top - listRect.top - list.clientTop + list.scrollTop}px)`;
11074
11191
  indicator.style.width = `${rect.width}px`;
@@ -11084,7 +11201,7 @@ function Tabs({
11084
11201
  observer.observe(list);
11085
11202
  list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
11086
11203
  return () => observer.disconnect();
11087
- }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable]);
11204
+ }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount]);
11088
11205
  (0, import_react45.useEffect)(() => {
11089
11206
  let cancelled = false;
11090
11207
  let frame = 0;
@@ -11118,7 +11235,8 @@ function Tabs({
11118
11235
  }
11119
11236
  function focusAndSelect(key) {
11120
11237
  selectTab(key);
11121
- document.getElementById(`${baseId}-tab-${key}`)?.focus();
11238
+ if (items.findIndex((item) => item.key === key) >= visibleCount) moreRef.current?.focus();
11239
+ else document.getElementById(`${baseId}-tab-${key}`)?.focus();
11122
11240
  }
11123
11241
  function handleKeyDown(event, key) {
11124
11242
  const previousKey = resolvedOrientation === "horizontal" ? "ArrowLeft" : "ArrowUp";
@@ -11140,54 +11258,53 @@ function Tabs({
11140
11258
  ...withTitleTooltip(props),
11141
11259
  children: [
11142
11260
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-tabs__header", children: [
11143
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FloatingScrollbarProvider, { targetRef: listRef, disabled: type !== "tech-line" || resolvedOrientation !== "horizontal" }),
11144
11261
  tabBarTitle ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-tabs__title", children: [
11145
11262
  tabBarTitle,
11146
11263
  type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { className: "sia-tabs__title-connector", viewBox: "0 0 32 40", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M0 39.25 H5 Q8 39.25 10 35.25 L28 3.75 Q29 1.75 32 1.75", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round" }) }) : null
11147
11264
  ] }) : null,
11148
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { ref: listRef, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
11265
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { ref: listRef, style: resolvedOrientation === "horizontal" && overflow.width ? { width: overflow.width } : void 0, className: `sia-tabs__list${sliding ? " sia-tabs__list--sliding" : ""}`, role: "tablist", "aria-orientation": resolvedOrientation, children: [
11149
11266
  sliding ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { ref: indicatorRef, className: `sia-tabs__indicator${type === "capsule" ? " sia-tabs__capsule-indicator" : ""}`, "aria-hidden": "true", children: type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__indicator-shape", "aria-hidden": "true" }) : null }, type) : null,
11150
- items.map((item) => {
11267
+ items.map((item, index) => {
11151
11268
  const selected = item.key === selectedKey;
11152
11269
  const canClose = item.closable ?? closable;
11153
- const tabNode = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, children: [
11154
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
11155
- "button",
11156
- {
11157
- id: `${baseId}-tab-${item.key}`,
11158
- type: "button",
11159
- className: "sia-tabs__tab",
11160
- role: "tab",
11161
- "aria-selected": selected,
11162
- "aria-controls": hasPanels ? `${baseId}-panel-${item.key}` : void 0,
11163
- tabIndex: selected ? 0 : -1,
11164
- disabled: item.disabled,
11165
- onClick: () => selectTab(item.key),
11166
- onKeyDown: (event) => handleKeyDown(event, item.key),
11167
- children: [
11168
- type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__tab-shape", "aria-hidden": "true" }) : null,
11169
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__icon", children: item.icon }) : null,
11170
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: item.label })
11171
- ]
11172
- }
11173
- ),
11174
- canClose ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11175
- "button",
11176
- {
11177
- type: "button",
11178
- className: "sia-tabs__close",
11179
- "aria-label": `\u5173\u95ED${typeof item.label === "string" ? item.label : "\u6807\u7B7E\u9875"}`,
11180
- disabled: item.disabled,
11181
- onClick: () => onEdit?.(item.key, "remove"),
11182
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "close", size: 12 })
11183
- }
11184
- ) : null
11185
- ] }, item.key);
11186
11270
  const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
11271
+ const entryProps = { "data-tab-entry": "", "data-tab-hidden": index >= visibleCount, "aria-hidden": index >= visibleCount || void 0 };
11272
+ const tabNode = /* @__PURE__ */ (0, import_react46.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
11273
+ "button",
11274
+ {
11275
+ id: `${baseId}-tab-${item.key}`,
11276
+ type: "button",
11277
+ className: "sia-tabs__tab",
11278
+ role: "tab",
11279
+ "aria-selected": selected,
11280
+ "aria-controls": hasPanels ? `${baseId}-panel-${item.key}` : void 0,
11281
+ tabIndex: selected ? 0 : -1,
11282
+ disabled: item.disabled,
11283
+ onClick: () => selectTab(item.key),
11284
+ onKeyDown: (event) => handleKeyDown(event, item.key),
11285
+ children: [
11286
+ type === "tech-line" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__tab-shape", "aria-hidden": "true" }) : null,
11287
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-tabs__icon", children: item.icon }) : null,
11288
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: item.label })
11289
+ ]
11290
+ }
11291
+ ), canClose ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11292
+ "button",
11293
+ {
11294
+ type: "button",
11295
+ className: "sia-tabs__close",
11296
+ "aria-label": `\u5173\u95ED${typeof item.label === "string" ? item.label : "\u6807\u7B7E\u9875"}`,
11297
+ disabled: item.disabled,
11298
+ onClick: () => onEdit?.(item.key, "remove"),
11299
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "close", size: 12 })
11300
+ }
11301
+ ) : null);
11187
11302
  if (!contextMenuItems?.length) return tabNode;
11188
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11303
+ return /* @__PURE__ */ (0, import_react46.createElement)(
11189
11304
  Dropdown,
11190
11305
  {
11306
+ ...entryProps,
11307
+ key: item.key,
11191
11308
  className: "sia-tabs__tab-context-trigger",
11192
11309
  popupClassName: "sia-tabs__tab-context-menu",
11193
11310
  trigger: ["contextMenu"],
@@ -11196,12 +11313,26 @@ function Tabs({
11196
11313
  items: contextMenuItems,
11197
11314
  selectable: false,
11198
11315
  onClick: (info) => onTabContextMenuClick?.({ ...info, tabKey: item.key, tab: item })
11199
- },
11200
- children: tabNode
11316
+ }
11201
11317
  },
11202
- item.key
11318
+ tabNode
11203
11319
  );
11204
- })
11320
+ }),
11321
+ resolvedOrientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11322
+ Dropdown,
11323
+ {
11324
+ className: "sia-tabs__more",
11325
+ "data-tab-hidden": !hiddenItems.length,
11326
+ trigger: ["hover", "click"],
11327
+ placement: "bottomRight",
11328
+ showTriggerIcon: false,
11329
+ autoFocus: true,
11330
+ open: moreOpen && hiddenItems.length > 0,
11331
+ onOpenChange: setMoreOpen,
11332
+ menu: { items: hiddenItems.map((item) => ({ key: item.key, label: item.label, icon: item.icon, disabled: item.disabled })), selectedKeys: [selectedKey], onClick: (info) => selectTab(info.key) },
11333
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { ref: moreRef, variant: "text", icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "more-horizontal" }), "aria-label": "\u66F4\u591A\u9009\u9879\u5361", onKeyDown: (event) => handleKeyDown(event, selectedKey), className: hiddenItems.some((item) => item.key === selectedKey) ? "is-active" : void 0 })
11334
+ }
11335
+ ) : null
11205
11336
  ] }),
11206
11337
  tabBarExtraContent ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "sia-tabs__extra", children: tabBarExtraContent }) : null
11207
11338
  ] }),
@@ -11232,9 +11363,9 @@ function Tabs({
11232
11363
  }
11233
11364
 
11234
11365
  // src/components/Treemap.tsx
11235
- var import_react46 = require("react");
11236
- var import_jsx_runtime48 = require("react/jsx-runtime");
11237
11366
  var import_react47 = require("react");
11367
+ var import_jsx_runtime48 = require("react/jsx-runtime");
11368
+ var import_react48 = require("react");
11238
11369
  function positiveValue(value) {
11239
11370
  return Number.isFinite(value) && value > 0 ? value : 1;
11240
11371
  }
@@ -11520,19 +11651,19 @@ function Treemap({
11520
11651
  style,
11521
11652
  ...props
11522
11653
  }) {
11523
- const containerRef = (0, import_react46.useRef)(null);
11524
- const [size, setSize] = (0, import_react46.useState)({ width: 0, height: 0 });
11525
- const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react46.useState)(() => [...defaultExpandedKeys]);
11526
- const [internalFocusedKey, setInternalFocusedKey] = (0, import_react46.useState)(defaultFocusedKey);
11654
+ const containerRef = (0, import_react47.useRef)(null);
11655
+ const [size, setSize] = (0, import_react47.useState)({ width: 0, height: 0 });
11656
+ const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react47.useState)(() => [...defaultExpandedKeys]);
11657
+ const [internalFocusedKey, setInternalFocusedKey] = (0, import_react47.useState)(defaultFocusedKey);
11527
11658
  const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
11528
11659
  const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
11529
- const expandedSet = (0, import_react46.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
11530
- const focusedNode = (0, import_react46.useMemo)(
11660
+ const expandedSet = (0, import_react47.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
11661
+ const focusedNode = (0, import_react47.useMemo)(
11531
11662
  () => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
11532
11663
  [currentFocusedKey, data]
11533
11664
  );
11534
11665
  const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
11535
- const positions = (0, import_react46.useMemo)(
11666
+ const positions = (0, import_react47.useMemo)(
11536
11667
  () => collectPositions(
11537
11668
  effectiveFocusedNode ? [effectiveFocusedNode] : data,
11538
11669
  { x: 0, y: 0, ...size },
@@ -11547,7 +11678,7 @@ function Treemap({
11547
11678
  ),
11548
11679
  [activeKey, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
11549
11680
  );
11550
- (0, import_react46.useEffect)(() => {
11681
+ (0, import_react47.useEffect)(() => {
11551
11682
  const element = containerRef.current;
11552
11683
  if (!element) return void 0;
11553
11684
  const updateSize = () => {
@@ -11559,7 +11690,7 @@ function Treemap({
11559
11690
  observer.observe(element);
11560
11691
  return () => observer.disconnect();
11561
11692
  }, []);
11562
- (0, import_react46.useEffect)(() => {
11693
+ (0, import_react47.useEffect)(() => {
11563
11694
  if (!currentFocusedKey || effectiveFocusedNode) return;
11564
11695
  if (focusedKey === void 0) setInternalFocusedKey(null);
11565
11696
  onFocusedChange?.(null);
@@ -11607,7 +11738,7 @@ function Treemap({
11607
11738
  const hasChildren = Boolean(node.hasChildren || node.children?.length);
11608
11739
  const title = `${node.label} \xB7 ${String(valueFormatter(node.value, node))}`;
11609
11740
  if (expanded) {
11610
- return /* @__PURE__ */ (0, import_react47.createElement)(
11741
+ return /* @__PURE__ */ (0, import_react48.createElement)(
11611
11742
  "div",
11612
11743
  {
11613
11744
  className: `sia-treemap__tile sia-treemap__tile--directory is-expanded${effectiveFocusedNode?.key === node.key ? " is-focused" : ""}${active ? " is-active" : ""}`,
@@ -11646,7 +11777,7 @@ function Treemap({
11646
11777
  ] })
11647
11778
  );
11648
11779
  }
11649
- return /* @__PURE__ */ (0, import_react47.createElement)(
11780
+ return /* @__PURE__ */ (0, import_react48.createElement)(
11650
11781
  "button",
11651
11782
  {
11652
11783
  type: "button",
@@ -11672,13 +11803,13 @@ function Treemap({
11672
11803
  }
11673
11804
 
11674
11805
  // src/components/Table/TableCellContent.tsx
11675
- var import_react48 = require("react");
11806
+ var import_react49 = require("react");
11676
11807
  var import_jsx_runtime49 = require("react/jsx-runtime");
11677
11808
  function TableCellContent({ children, ellipsis, title }) {
11678
- const ref = (0, import_react48.useRef)(null);
11679
- const [overflowing, setOverflowing] = (0, import_react48.useState)(false);
11809
+ const ref = (0, import_react49.useRef)(null);
11810
+ const [overflowing, setOverflowing] = (0, import_react49.useState)(false);
11680
11811
  const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
11681
- (0, import_react48.useLayoutEffect)(() => {
11812
+ (0, import_react49.useLayoutEffect)(() => {
11682
11813
  const element = ref.current;
11683
11814
  if (!element || !ellipsis || !customContent) return;
11684
11815
  const layouts = [];
@@ -11710,10 +11841,10 @@ function TableCellContent({ children, ellipsis, title }) {
11710
11841
  }
11711
11842
 
11712
11843
  // src/components/Table/Table.tsx
11713
- var import_react50 = require("react");
11844
+ var import_react51 = require("react");
11714
11845
 
11715
11846
  // src/components/Table/plugins.tsx
11716
- var import_react49 = require("react");
11847
+ var import_react50 = require("react");
11717
11848
 
11718
11849
  // src/components/Table/utils.ts
11719
11850
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -12391,7 +12522,7 @@ function TableSelectedItemsPanel({
12391
12522
  onRemove,
12392
12523
  onClear
12393
12524
  }) {
12394
- const [showAll, setShowAll] = (0, import_react49.useState)(false);
12525
+ const [showAll, setShowAll] = (0, import_react50.useState)(false);
12395
12526
  const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
12396
12527
  const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
12397
12528
  const baseColumnMap = new Map(
@@ -12790,10 +12921,10 @@ function TableFilterControl({
12790
12921
  placeholder,
12791
12922
  onApply
12792
12923
  }) {
12793
- const [open, setOpen] = (0, import_react49.useState)(false);
12794
- const [draft, setDraft] = (0, import_react49.useState)(value);
12924
+ const [open, setOpen] = (0, import_react50.useState)(false);
12925
+ const [draft, setDraft] = (0, import_react50.useState)(value);
12795
12926
  const label = getColumnLabel(column);
12796
- (0, import_react49.useEffect)(() => {
12927
+ (0, import_react50.useEffect)(() => {
12797
12928
  if (open) setDraft(value);
12798
12929
  }, [open, value]);
12799
12930
  const apply = (nextValue) => {
@@ -13218,17 +13349,17 @@ function EditableTableCell({
13218
13349
  trigger
13219
13350
  }) {
13220
13351
  const config = typeof editable === "object" ? editable : { type: "input" };
13221
- const [editValue, setEditValue] = (0, import_react49.useState)(value);
13222
- const [saving, setSaving] = (0, import_react49.useState)(false);
13223
- const inputRef = (0, import_react49.useRef)(null);
13224
- const editorRef = (0, import_react49.useRef)(null);
13225
- const editValueRef = (0, import_react49.useRef)(value);
13226
- const savingRef = (0, import_react49.useRef)(false);
13227
- const saveRef = (0, import_react49.useRef)(
13352
+ const [editValue, setEditValue] = (0, import_react50.useState)(value);
13353
+ const [saving, setSaving] = (0, import_react50.useState)(false);
13354
+ const inputRef = (0, import_react50.useRef)(null);
13355
+ const editorRef = (0, import_react50.useRef)(null);
13356
+ const editValueRef = (0, import_react50.useRef)(value);
13357
+ const savingRef = (0, import_react50.useRef)(false);
13358
+ const saveRef = (0, import_react50.useRef)(
13228
13359
  async () => {
13229
13360
  }
13230
13361
  );
13231
- (0, import_react49.useEffect)(() => {
13362
+ (0, import_react50.useEffect)(() => {
13232
13363
  if (!active) return;
13233
13364
  editValueRef.current = value;
13234
13365
  setEditValue(value);
@@ -13259,7 +13390,7 @@ function EditableTableCell({
13259
13390
  }
13260
13391
  }
13261
13392
  saveRef.current = save;
13262
- (0, import_react49.useEffect)(() => {
13393
+ (0, import_react50.useEffect)(() => {
13263
13394
  if (!active || config.type === "select" || config.type === "custom") return;
13264
13395
  const handleOutsidePointerDown = (event) => {
13265
13396
  const target = event.target;
@@ -13560,15 +13691,15 @@ function ColumnSettingPanel({
13560
13691
  onClose,
13561
13692
  onApply
13562
13693
  }) {
13563
- const [draft, setDraft] = (0, import_react49.useState)(items);
13564
- const listRef = (0, import_react49.useRef)(null);
13565
- const cancelDrag = (0, import_react49.useRef)(null);
13566
- const [preview, setPreview] = (0, import_react49.useState)(null);
13567
- (0, import_react49.useEffect)(() => {
13694
+ const [draft, setDraft] = (0, import_react50.useState)(items);
13695
+ const listRef = (0, import_react50.useRef)(null);
13696
+ const cancelDrag = (0, import_react50.useRef)(null);
13697
+ const [preview, setPreview] = (0, import_react50.useState)(null);
13698
+ (0, import_react50.useEffect)(() => {
13568
13699
  cancelDrag.current?.();
13569
13700
  if (open) setDraft(orderColumnSettings(items));
13570
13701
  }, [items, open]);
13571
- (0, import_react49.useEffect)(() => () => cancelDrag.current?.(), []);
13702
+ (0, import_react50.useEffect)(() => () => cancelDrag.current?.(), []);
13572
13703
  const labels = new Map(
13573
13704
  flattenTableColumns(columns).map((column) => [
13574
13705
  column.key,
@@ -14086,7 +14217,7 @@ function tableExportText(node) {
14086
14217
  if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
14087
14218
  return String(node);
14088
14219
  if (Array.isArray(node)) return node.map(tableExportText).join("");
14089
- if ((0, import_react49.isValidElement)(node))
14220
+ if ((0, import_react50.isValidElement)(node))
14090
14221
  return tableExportText(node.props.children);
14091
14222
  return "";
14092
14223
  }
@@ -14185,7 +14316,7 @@ var SIZE_ROW_HEIGHT = { small: 28, medium: 36, large: 46 };
14185
14316
  function getHeaderTitleText(content) {
14186
14317
  if (typeof content === "string" || typeof content === "number") return String(content);
14187
14318
  if (Array.isArray(content)) return content.map(getHeaderTitleText).join("");
14188
- if ((0, import_react50.isValidElement)(content)) return getHeaderTitleText(content.props.children);
14319
+ if ((0, import_react51.isValidElement)(content)) return getHeaderTitleText(content.props.children);
14189
14320
  return "";
14190
14321
  }
14191
14322
  function getColumnDepth(columns) {
@@ -14269,7 +14400,7 @@ function getTableHorizontalMetrics(viewport, table) {
14269
14400
  const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
14270
14401
  return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
14271
14402
  }
14272
- var TableBodyRow = (0, import_react50.memo)(function TableBodyRow2({
14403
+ var TableBodyRow = (0, import_react51.memo)(function TableBodyRow2({
14273
14404
  row,
14274
14405
  rowIndex,
14275
14406
  columns,
@@ -14372,22 +14503,22 @@ function TableInner(props, ref) {
14372
14503
  style,
14373
14504
  ...htmlProps
14374
14505
  } = props;
14375
- const rootRef = (0, import_react50.useRef)(null);
14376
- const scrollRef = (0, import_react50.useRef)(null);
14377
- const tableRef = (0, import_react50.useRef)(null);
14506
+ const rootRef = (0, import_react51.useRef)(null);
14507
+ const scrollRef = (0, import_react51.useRef)(null);
14508
+ const tableRef = (0, import_react51.useRef)(null);
14378
14509
  useScrollbarProximity();
14379
- const scrollbarDragRef = (0, import_react50.useRef)(null);
14380
- const [internalLoading, setInternalLoading] = (0, import_react50.useState)(false);
14381
- const [scrollTop, setScrollTop] = (0, import_react50.useState)(0);
14382
- const [viewportHeight, setViewportHeight] = (0, import_react50.useState)(420);
14383
- const [viewportWidth, setViewportWidth] = (0, import_react50.useState)(0);
14384
- const [autoColumnWidths, setAutoColumnWidths] = (0, import_react50.useState)({});
14385
- const getRowKey = (0, import_react50.useCallback)((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
14386
- const builtInResizePlugin = (0, import_react50.useMemo)(() => createResizePlugin(), []);
14387
- const builtInHighlightPlugin = (0, import_react50.useMemo)(() => createHighlightPlugin(), []);
14388
- const builtInCellSelectionPlugin = (0, import_react50.useMemo)(() => createCellSelectionPlugin(), []);
14389
- const builtInIndexPlugin = (0, import_react50.useMemo)(() => createIndexPlugin(), []);
14390
- const activePlugins = (0, import_react50.useMemo)(() => {
14510
+ const scrollbarDragRef = (0, import_react51.useRef)(null);
14511
+ const [internalLoading, setInternalLoading] = (0, import_react51.useState)(false);
14512
+ const [scrollTop, setScrollTop] = (0, import_react51.useState)(0);
14513
+ const [viewportHeight, setViewportHeight] = (0, import_react51.useState)(420);
14514
+ const [viewportWidth, setViewportWidth] = (0, import_react51.useState)(0);
14515
+ const [autoColumnWidths, setAutoColumnWidths] = (0, import_react51.useState)({});
14516
+ const getRowKey = (0, import_react51.useCallback)((record, index) => typeof rowKey === "function" ? rowKey(record, index) : record[String(rowKey)] ?? index, [rowKey]);
14517
+ const builtInResizePlugin = (0, import_react51.useMemo)(() => createResizePlugin(), []);
14518
+ const builtInHighlightPlugin = (0, import_react51.useMemo)(() => createHighlightPlugin(), []);
14519
+ const builtInCellSelectionPlugin = (0, import_react51.useMemo)(() => createCellSelectionPlugin(), []);
14520
+ const builtInIndexPlugin = (0, import_react51.useMemo)(() => createIndexPlugin(), []);
14521
+ const activePlugins = (0, import_react51.useMemo)(() => {
14391
14522
  const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
14392
14523
  if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
14393
14524
  if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
@@ -14395,19 +14526,19 @@ function TableInner(props, ref) {
14395
14526
  if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
14396
14527
  return plugins;
14397
14528
  }, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
14398
- const sortedPlugins = (0, import_react50.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
14399
- const pluginsByIdRef = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
14529
+ const sortedPlugins = (0, import_react51.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
14530
+ const pluginsByIdRef = (0, import_react51.useRef)(/* @__PURE__ */ new Map());
14400
14531
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
14401
- const [pluginStates, setPluginStates] = (0, import_react50.useState)(() => Object.fromEntries(
14532
+ const [pluginStates, setPluginStates] = (0, import_react51.useState)(() => Object.fromEntries(
14402
14533
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
14403
14534
  ));
14404
- const pluginApisRef = (0, import_react50.useRef)({});
14405
- const contextsRef = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
14406
- const mountedPluginsRef = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
14535
+ const pluginApisRef = (0, import_react51.useRef)({});
14536
+ const contextsRef = (0, import_react51.useRef)(/* @__PURE__ */ new Map());
14537
+ const mountedPluginsRef = (0, import_react51.useRef)(/* @__PURE__ */ new Map());
14407
14538
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
14408
14539
  const nextApis = {};
14409
14540
  const contexts = /* @__PURE__ */ new Map();
14410
- const setPluginState = (0, import_react50.useCallback)((pluginId, next) => {
14541
+ const setPluginState = (0, import_react51.useCallback)((pluginId, next) => {
14411
14542
  setPluginStates((previous) => {
14412
14543
  const plugin = pluginsByIdRef.current.get(pluginId);
14413
14544
  const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
@@ -14460,7 +14591,7 @@ function TableInner(props, ref) {
14460
14591
  });
14461
14592
  pluginApisRef.current = nextApis;
14462
14593
  contextsRef.current = contexts;
14463
- (0, import_react50.useEffect)(() => {
14594
+ (0, import_react51.useEffect)(() => {
14464
14595
  const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
14465
14596
  for (const [pluginId, mounted] of mountedPluginsRef.current) {
14466
14597
  if (activePlugins2.get(pluginId) === mounted.plugin) continue;
@@ -14472,11 +14603,11 @@ function TableInner(props, ref) {
14472
14603
  mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
14473
14604
  }
14474
14605
  }, [sortedPlugins]);
14475
- (0, import_react50.useEffect)(() => () => {
14606
+ (0, import_react51.useEffect)(() => () => {
14476
14607
  for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
14477
14608
  mountedPluginsRef.current.clear();
14478
14609
  }, []);
14479
- const updateScrollMetrics = (0, import_react50.useCallback)(() => {
14610
+ const updateScrollMetrics = (0, import_react51.useCallback)(() => {
14480
14611
  const root = rootRef.current;
14481
14612
  const element = scrollRef.current;
14482
14613
  if (!root || !element) return;
@@ -14512,7 +14643,7 @@ function TableInner(props, ref) {
14512
14643
  root.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
14513
14644
  root.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
14514
14645
  }, []);
14515
- (0, import_react50.useEffect)(() => {
14646
+ (0, import_react51.useEffect)(() => {
14516
14647
  const element = scrollRef.current;
14517
14648
  if (!element || typeof ResizeObserver === "undefined") return;
14518
14649
  const observer = new ResizeObserver(() => {
@@ -14525,13 +14656,13 @@ function TableInner(props, ref) {
14525
14656
  updateScrollMetrics();
14526
14657
  return () => observer.disconnect();
14527
14658
  }, [updateScrollMetrics]);
14528
- (0, import_react50.useEffect)(() => {
14659
+ (0, import_react51.useEffect)(() => {
14529
14660
  updateScrollMetrics();
14530
14661
  });
14531
- const orderedColumns = (0, import_react50.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
14532
- const leafColumns = (0, import_react50.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
14533
- const headerRows = (0, import_react50.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
14534
- (0, import_react50.useEffect)(() => {
14662
+ const orderedColumns = (0, import_react51.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
14663
+ const leafColumns = (0, import_react51.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
14664
+ const headerRows = (0, import_react51.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
14665
+ (0, import_react51.useEffect)(() => {
14535
14666
  const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
14536
14667
  const root = rootRef.current;
14537
14668
  if (!root || autoWidthColumns.length === 0) return;
@@ -14601,20 +14732,20 @@ function TableInner(props, ref) {
14601
14732
  const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
14602
14733
  const toolbarStart = sortedPlugins.map((plugin) => {
14603
14734
  const content = plugin.renderToolbarStart?.(getContext(plugin));
14604
- return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react50.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
14735
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react51.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
14605
14736
  }).filter(Boolean);
14606
14737
  const toolbarEnd = sortedPlugins.map((plugin) => {
14607
14738
  const content = plugin.renderToolbarEnd?.(getContext(plugin));
14608
- return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react50.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
14739
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react51.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
14609
14740
  }).filter(Boolean);
14610
14741
  const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
14611
14742
  const footers = sortedPlugins.map((plugin) => {
14612
14743
  const content = plugin.renderFooter?.(getContext(plugin));
14613
- return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react50.Fragment, { children: content }, `footer-${plugin.id}`) : null;
14744
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react51.Fragment, { children: content }, `footer-${plugin.id}`) : null;
14614
14745
  }).filter(Boolean);
14615
14746
  const overlays = sortedPlugins.map((plugin) => {
14616
14747
  const content = plugin.renderOverlay?.(getContext(plugin));
14617
- return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react50.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
14748
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react51.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
14618
14749
  }).filter(Boolean);
14619
14750
  const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
14620
14751
  const effectiveHeight = height ?? tableHeight ?? (shouldVirtualize ? 420 : void 0);
@@ -14623,12 +14754,12 @@ function TableInner(props, ref) {
14623
14754
  height: effectiveHeight,
14624
14755
  "--sia-table-header-height": `${headerRows.length * rowHeight}px`
14625
14756
  };
14626
- const handleScroll = (0, import_react50.useCallback)((event) => {
14757
+ const handleScroll = (0, import_react51.useCallback)((event) => {
14627
14758
  const element = event.currentTarget;
14628
14759
  if (shouldVirtualize) setScrollTop(element.scrollTop);
14629
14760
  updateScrollMetrics();
14630
14761
  }, [shouldVirtualize, updateScrollMetrics]);
14631
- const handleScrollbarPointerDown = (0, import_react50.useCallback)((axis, event, track = event.currentTarget) => {
14762
+ const handleScrollbarPointerDown = (0, import_react51.useCallback)((axis, event, track = event.currentTarget) => {
14632
14763
  const element = scrollRef.current;
14633
14764
  const thumb = track.firstElementChild;
14634
14765
  if (!element || !thumb || event.button !== 0) return;
@@ -14657,7 +14788,7 @@ function TableInner(props, ref) {
14657
14788
  };
14658
14789
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
14659
14790
  }, []);
14660
- const handleScrollbarPointerMove = (0, import_react50.useCallback)((event) => {
14791
+ const handleScrollbarPointerMove = (0, import_react51.useCallback)((event) => {
14661
14792
  const drag = scrollbarDragRef.current;
14662
14793
  const element = scrollRef.current;
14663
14794
  if (!drag || !element || drag.pointerId !== event.pointerId) return;
@@ -14666,12 +14797,12 @@ function TableInner(props, ref) {
14666
14797
  if (drag.axis === "x") element.scrollLeft = nextScroll;
14667
14798
  else element.scrollTop = nextScroll;
14668
14799
  }, []);
14669
- const handleScrollbarPointerEnd = (0, import_react50.useCallback)((event) => {
14800
+ const handleScrollbarPointerEnd = (0, import_react51.useCallback)((event) => {
14670
14801
  if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
14671
14802
  scrollbarDragRef.current = null;
14672
14803
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
14673
14804
  }, []);
14674
- (0, import_react50.useImperativeHandle)(ref, () => ({
14805
+ (0, import_react51.useImperativeHandle)(ref, () => ({
14675
14806
  getRows: () => pipeline.rows.map((row) => row.record),
14676
14807
  getColumns: () => pipeline.columns,
14677
14808
  getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
@@ -14942,12 +15073,12 @@ function TableInner(props, ref) {
14942
15073
  }
14943
15074
  );
14944
15075
  }
14945
- var Table2 = (0, import_react50.forwardRef)(TableInner);
15076
+ var Table2 = (0, import_react51.forwardRef)(TableInner);
14946
15077
 
14947
15078
  // src/components/ThemeSwitch.tsx
14948
- var import_react51 = require("react");
15079
+ var import_react52 = require("react");
14949
15080
  var import_jsx_runtime52 = require("react/jsx-runtime");
14950
- var ThemeSwitch = (0, import_react51.forwardRef)(function ThemeSwitch2({
15081
+ var ThemeSwitch = (0, import_react52.forwardRef)(function ThemeSwitch2({
14951
15082
  checked,
14952
15083
  onCheckedChange,
14953
15084
  lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
@@ -15007,8 +15138,8 @@ var SIA_THEME = {
15007
15138
  controlHeight: 32,
15008
15139
  /** 默认布局间距,单位为像素。 */
15009
15140
  spacing: 16,
15010
- /** 默认字号,单位为像素。 */
15011
- fontSize: 16,
15141
+ /** 默认基础字号为 13 像素,对应 --sia-font-size;业务可通过 CSS 变量覆盖。 */
15142
+ fontSize: 13,
15012
15143
  /** 默认小号文字尺寸为 13 像素,对应 --sia-font-size-small;业务可通过 CSS 变量覆盖。 */
15013
15144
  fontSizeSmall: 13,
15014
15145
  /** 大号文字尺寸,单位为像素。 */
@@ -15041,7 +15172,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
15041
15172
  }
15042
15173
 
15043
15174
  // src/components/Typography.tsx
15044
- var import_react52 = require("react");
15175
+ var import_react53 = require("react");
15045
15176
  var import_jsx_runtime54 = require("react/jsx-runtime");
15046
15177
  function TypographyContent({
15047
15178
  as: Tag2 = "span",
@@ -15061,26 +15192,26 @@ function TypographyContent({
15061
15192
  className = "",
15062
15193
  ...props
15063
15194
  }) {
15064
- const contentRef = (0, import_react52.useRef)(null);
15065
- const editRef = (0, import_react52.useRef)(null);
15066
- const timer = (0, import_react52.useRef)();
15067
- const [localText, setLocalText] = (0, import_react52.useState)();
15068
- const [draft, setDraft] = (0, import_react52.useState)("");
15069
- const [editing, setEditing] = (0, import_react52.useState)(false);
15070
- const [copied, setCopied] = (0, import_react52.useState)(false);
15071
- const [copyError, setCopyError] = (0, import_react52.useState)(false);
15072
- const [expanded, setExpanded] = (0, import_react52.useState)(false);
15073
- const [overflow, setOverflow] = (0, import_react52.useState)(false);
15195
+ const contentRef = (0, import_react53.useRef)(null);
15196
+ const editRef = (0, import_react53.useRef)(null);
15197
+ const timer = (0, import_react53.useRef)();
15198
+ const [localText, setLocalText] = (0, import_react53.useState)();
15199
+ const [draft, setDraft] = (0, import_react53.useState)("");
15200
+ const [editing, setEditing] = (0, import_react53.useState)(false);
15201
+ const [copied, setCopied] = (0, import_react53.useState)(false);
15202
+ const [copyError, setCopyError] = (0, import_react53.useState)(false);
15203
+ const [expanded, setExpanded] = (0, import_react53.useState)(false);
15204
+ const [overflow, setOverflow] = (0, import_react53.useState)(false);
15074
15205
  const editConfig = typeof editable === "object" ? editable : void 0;
15075
15206
  const content = editConfig?.text ?? localText ?? children;
15076
15207
  const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
15077
15208
  const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
15078
15209
  const expandable = typeof ellipsis === "object" && ellipsis.expandable;
15079
- (0, import_react52.useEffect)(() => {
15210
+ (0, import_react53.useEffect)(() => {
15080
15211
  setLocalText(void 0);
15081
15212
  }, [children]);
15082
- (0, import_react52.useEffect)(() => () => clearTimeout(timer.current), []);
15083
- (0, import_react52.useLayoutEffect)(() => {
15213
+ (0, import_react53.useEffect)(() => () => clearTimeout(timer.current), []);
15214
+ (0, import_react53.useLayoutEffect)(() => {
15084
15215
  const element = contentRef.current;
15085
15216
  if (!element || !ellipsis || editing || expanded) return;
15086
15217
  const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
@@ -15198,10 +15329,10 @@ var Typography = Object.assign(TypographyRoot, {
15198
15329
  });
15199
15330
 
15200
15331
  // src/components/FloatButton.tsx
15201
- var import_react53 = require("react");
15332
+ var import_react54 = require("react");
15202
15333
  var import_jsx_runtime55 = require("react/jsx-runtime");
15203
- var GroupShape = (0, import_react53.createContext)(void 0);
15204
- var FloatButtonRoot = (0, import_react53.forwardRef)(function FloatButton({
15334
+ var GroupShape = (0, import_react54.createContext)(void 0);
15335
+ var FloatButtonRoot = (0, import_react54.forwardRef)(function FloatButton({
15205
15336
  icon,
15206
15337
  description,
15207
15338
  tooltip,
@@ -15214,7 +15345,7 @@ var FloatButtonRoot = (0, import_react53.forwardRef)(function FloatButton({
15214
15345
  children,
15215
15346
  ...props
15216
15347
  }, ref) {
15217
- const groupShape = (0, import_react53.useContext)(GroupShape);
15348
+ const groupShape = (0, import_react54.useContext)(GroupShape);
15218
15349
  const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
15219
15350
  const button = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
15220
15351
  "button",
@@ -15252,10 +15383,10 @@ function FloatButtonGroup({
15252
15383
  ...props
15253
15384
  }) {
15254
15385
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
15255
- const rootRef = (0, import_react53.useRef)(null);
15256
- const triggerRef = (0, import_react53.useRef)(null);
15257
- const id = (0, import_react53.useId)();
15258
- (0, import_react53.useEffect)(() => {
15386
+ const rootRef = (0, import_react54.useRef)(null);
15387
+ const triggerRef = (0, import_react54.useRef)(null);
15388
+ const id = (0, import_react54.useId)();
15389
+ (0, import_react54.useEffect)(() => {
15259
15390
  if (!trigger || !visible) return;
15260
15391
  const close = (event) => {
15261
15392
  if (!rootRef.current?.contains(event.target)) setVisible(false);
@@ -15309,8 +15440,8 @@ function FloatButtonGroup({
15309
15440
  ) });
15310
15441
  }
15311
15442
  function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
15312
- const [visible, setVisible] = (0, import_react53.useState)(false);
15313
- (0, import_react53.useEffect)(() => {
15443
+ const [visible, setVisible] = (0, import_react54.useState)(false);
15444
+ (0, import_react54.useEffect)(() => {
15314
15445
  const element = target ? target() : window;
15315
15446
  if (!element) return;
15316
15447
  const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
@@ -15334,11 +15465,11 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
15334
15465
  });
15335
15466
 
15336
15467
  // src/components/ChartWhirlingLoading.tsx
15337
- var import_react54 = require("react");
15468
+ var import_react55 = require("react");
15338
15469
  var import_jsx_runtime56 = require("react/jsx-runtime");
15339
15470
  function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
15340
- const [tick, setTick] = (0, import_react54.useState)(0);
15341
- (0, import_react54.useEffect)(() => {
15471
+ const [tick, setTick] = (0, import_react55.useState)(0);
15472
+ (0, import_react55.useEffect)(() => {
15342
15473
  if (frame != null) return;
15343
15474
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
15344
15475
  let timer;
@@ -15369,20 +15500,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
15369
15500
  }
15370
15501
 
15371
15502
  // src/components/SvgMapPlot.tsx
15372
- var import_react66 = require("react");
15503
+ var import_react67 = require("react");
15373
15504
 
15374
15505
  // src/components/ChartBrush.tsx
15375
- var import_react55 = require("react");
15506
+ var import_react56 = require("react");
15376
15507
  var import_jsx_runtime57 = require("react/jsx-runtime");
15377
15508
  function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
15378
- const [vertical, setVertical] = (0, import_react55.useState)(null);
15379
- const startY = (0, import_react55.useRef)(0);
15509
+ const [vertical, setVertical] = (0, import_react56.useState)(null);
15510
+ const startY = (0, import_react56.useRef)(0);
15380
15511
  const y = (event) => {
15381
15512
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
15382
15513
  return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
15383
15514
  };
15384
- const drag = (0, import_react55.useRef)(null);
15385
- const [selection, setSelection] = (0, import_react55.useState)(null);
15515
+ const drag = (0, import_react56.useRef)(null);
15516
+ const [selection, setSelection] = (0, import_react56.useState)(null);
15386
15517
  const x = (event) => {
15387
15518
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
15388
15519
  if (!matrix) return null;
@@ -15505,7 +15636,7 @@ function appendChartExportHeadings(original, clone, host) {
15505
15636
  }
15506
15637
 
15507
15638
  // src/components/ChartNodeTimeline.tsx
15508
- var import_react57 = require("react");
15639
+ var import_react58 = require("react");
15509
15640
 
15510
15641
  // src/components/timelinePositions.ts
15511
15642
  function timelineRatios(count, dates) {
@@ -15531,7 +15662,7 @@ function nearestTimelineIndex(ratios, ratio) {
15531
15662
  }
15532
15663
 
15533
15664
  // src/components/ChartPointMotion.tsx
15534
- var import_react56 = require("react");
15665
+ var import_react57 = require("react");
15535
15666
 
15536
15667
  // src/components/chartMotion.ts
15537
15668
  function chartMotionBaseline(points, horizontal = false) {
@@ -15552,11 +15683,11 @@ function interpolateChartPoints(from, to, progress) {
15552
15683
  var import_jsx_runtime58 = require("react/jsx-runtime");
15553
15684
  function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
15554
15685
  const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
15555
- const [frame, setFrame] = (0, import_react56.useState)(() => enabled && animateInitial ? baseline(points) : points);
15556
- const displayed = (0, import_react56.useRef)(frame);
15557
- const initialized = (0, import_react56.useRef)(!animateInitial);
15686
+ const [frame, setFrame] = (0, import_react57.useState)(() => enabled && animateInitial ? baseline(points) : points);
15687
+ const displayed = (0, import_react57.useRef)(frame);
15688
+ const initialized = (0, import_react57.useRef)(!animateInitial);
15558
15689
  const signature = JSON.stringify(points);
15559
- (0, import_react56.useEffect)(() => {
15690
+ (0, import_react57.useEffect)(() => {
15560
15691
  const target = points;
15561
15692
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
15562
15693
  if (!enabled || progress != null || reduced.matches) {
@@ -15595,8 +15726,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
15595
15726
  // src/components/ChartNodeTimeline.tsx
15596
15727
  var import_jsx_runtime59 = require("react/jsx-runtime");
15597
15728
  function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
15598
- const [playing, setPlaying] = (0, import_react57.useState)(autoPlay), dragging = (0, import_react57.useRef)();
15599
- const [draft, setDraft] = (0, import_react57.useState)(), pending = (0, import_react57.useRef)(), draftRef = (0, import_react57.useRef)();
15729
+ const [playing, setPlaying] = (0, import_react58.useState)(autoPlay), dragging = (0, import_react58.useRef)();
15730
+ const [draft, setDraft] = (0, import_react58.useState)(), pending = (0, import_react58.useRef)(), draftRef = (0, import_react58.useRef)();
15600
15731
  const shown = draft ?? value;
15601
15732
  const cancelPending = () => {
15602
15733
  clearTimeout(pending.current);
@@ -15604,8 +15735,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
15604
15735
  draftRef.current = void 0;
15605
15736
  setDraft(void 0);
15606
15737
  };
15607
- (0, import_react57.useEffect)(() => () => clearTimeout(pending.current), []);
15608
- (0, import_react57.useEffect)(() => {
15738
+ (0, import_react58.useEffect)(() => () => clearTimeout(pending.current), []);
15739
+ (0, import_react58.useEffect)(() => {
15609
15740
  cancelPending();
15610
15741
  }, [value]);
15611
15742
  const preview = (index) => {
@@ -15620,8 +15751,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
15620
15751
  draftRef.current = void 0;
15621
15752
  }, 200);
15622
15753
  };
15623
- (0, import_react57.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
15624
- (0, import_react57.useEffect)(() => {
15754
+ (0, import_react58.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
15755
+ (0, import_react58.useEffect)(() => {
15625
15756
  if (!playing || labels.length < 2) return;
15626
15757
  const timer = window.setTimeout(() => {
15627
15758
  if (value + 1 < labels.length) onChange(value + 1);
@@ -15730,7 +15861,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
15730
15861
  }
15731
15862
 
15732
15863
  // src/components/ChartVerticalRange.tsx
15733
- var import_react58 = require("react");
15864
+ var import_react59 = require("react");
15734
15865
 
15735
15866
  // src/components/chartColorRamp.ts
15736
15867
  function chartColorRamp(colors, ratio) {
@@ -15750,16 +15881,16 @@ function chartColorRamp(colors, ratio) {
15750
15881
  // src/components/ChartVerticalRange.tsx
15751
15882
  var import_jsx_runtime60 = require("react/jsx-runtime");
15752
15883
  function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
15753
- const id = (0, import_react58.useId)().replaceAll(":", "");
15754
- const drag = (0, import_react58.useRef)();
15755
- const [draft, setDraft] = (0, import_react58.useState)();
15756
- const pending = (0, import_react58.useRef)();
15884
+ const id = (0, import_react59.useId)().replaceAll(":", "");
15885
+ const drag = (0, import_react59.useRef)();
15886
+ const [draft, setDraft] = (0, import_react59.useState)();
15887
+ const pending = (0, import_react59.useRef)();
15757
15888
  const cancel = () => {
15758
15889
  drag.current = void 0;
15759
15890
  pending.current = void 0;
15760
15891
  setDraft(void 0);
15761
15892
  };
15762
- (0, import_react58.useEffect)(() => {
15893
+ (0, import_react59.useEffect)(() => {
15763
15894
  if (!realtime) cancel();
15764
15895
  }, [range[0], range[1], min, max, realtime]);
15765
15896
  const shown = draft ?? range;
@@ -15840,18 +15971,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
15840
15971
  }
15841
15972
 
15842
15973
  // src/components/ChartHorizontalRange.tsx
15843
- var import_react59 = require("react");
15974
+ var import_react60 = require("react");
15844
15975
  var import_jsx_runtime61 = require("react/jsx-runtime");
15845
15976
  function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
15846
- const id = (0, import_react59.useId)().replaceAll(":", ""), span = max - min;
15847
- const drag = (0, import_react59.useRef)();
15848
- const [draft, setDraft] = (0, import_react59.useState)(), pending = (0, import_react59.useRef)();
15977
+ const id = (0, import_react60.useId)().replaceAll(":", ""), span = max - min;
15978
+ const drag = (0, import_react60.useRef)();
15979
+ const [draft, setDraft] = (0, import_react60.useState)(), pending = (0, import_react60.useRef)();
15849
15980
  const cancel = () => {
15850
15981
  drag.current = void 0;
15851
15982
  pending.current = void 0;
15852
15983
  setDraft(void 0);
15853
15984
  };
15854
- (0, import_react59.useEffect)(() => {
15985
+ (0, import_react60.useEffect)(() => {
15855
15986
  if (!realtime) cancel();
15856
15987
  }, [range[0], range[1], min, max, realtime]);
15857
15988
  const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
@@ -15929,7 +16060,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
15929
16060
  }
15930
16061
 
15931
16062
  // src/components/Chart.tsx
15932
- var import_react60 = require("react");
16063
+ var import_react61 = require("react");
15933
16064
 
15934
16065
  // src/components/chartCompositeExport.ts
15935
16066
  function serializeChartComposite(host) {
@@ -16053,20 +16184,20 @@ var DEFAULT_CHART_PALETTE = [
16053
16184
  "#2f54eb",
16054
16185
  "#a0d911"
16055
16186
  ];
16056
- var ChartContext = (0, import_react60.createContext)(null);
16187
+ var ChartContext = (0, import_react61.createContext)(null);
16057
16188
  function toCssSize(value, fallback) {
16058
16189
  if (typeof value === "number") return `${value}px`;
16059
16190
  return value ?? fallback;
16060
16191
  }
16061
- var ChartComposite = (0, import_react60.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
16062
- const host = (0, import_react60.useRef)(null);
16063
- (0, import_react60.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
16192
+ var ChartComposite = (0, import_react61.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
16193
+ const host = (0, import_react61.useRef)(null);
16194
+ (0, import_react61.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
16064
16195
  return /* @__PURE__ */ (0, import_jsx_runtime62.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_runtime62.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)) });
16065
16196
  });
16066
- var useTooltipLayoutEffect = typeof window === "undefined" ? import_react60.useEffect : import_react60.useLayoutEffect;
16197
+ var useTooltipLayoutEffect = typeof window === "undefined" ? import_react61.useEffect : import_react61.useLayoutEffect;
16067
16198
  function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
16068
- const elementRef = (0, import_react60.useRef)(null);
16069
- const [position, setPosition] = (0, import_react60.useState)([left, top]);
16199
+ const elementRef = (0, import_react61.useRef)(null);
16200
+ const [position, setPosition] = (0, import_react61.useState)([left, top]);
16070
16201
  useTooltipLayoutEffect(() => {
16071
16202
  const element = elementRef.current, host = element?.parentElement;
16072
16203
  if (!open || placement !== "axis" || !element || !host) return;
@@ -16190,7 +16321,7 @@ function ChartToolbox({
16190
16321
  ))
16191
16322
  ] });
16192
16323
  }
16193
- var SiaChart = (0, import_react60.forwardRef)(function SiaChart2({
16324
+ var SiaChart = (0, import_react61.forwardRef)(function SiaChart2({
16194
16325
  children,
16195
16326
  width = "100%",
16196
16327
  height = 320,
@@ -16217,19 +16348,19 @@ var SiaChart = (0, import_react60.forwardRef)(function SiaChart2({
16217
16348
  style,
16218
16349
  ...rest
16219
16350
  }, ref) {
16220
- const hostRef = (0, import_react60.useRef)(null);
16221
- const svgRef = (0, import_react60.useRef)(null);
16222
- const titleId = (0, import_react60.useId)();
16223
- const descriptionId = (0, import_react60.useId)();
16224
- const [tooltip, setTooltip] = (0, import_react60.useState)(null);
16225
- const tooltipHideTimer = (0, import_react60.useRef)();
16226
- const tooltipHeld = (0, import_react60.useRef)(false);
16351
+ const hostRef = (0, import_react61.useRef)(null);
16352
+ const svgRef = (0, import_react61.useRef)(null);
16353
+ const titleId = (0, import_react61.useId)();
16354
+ const descriptionId = (0, import_react61.useId)();
16355
+ const [tooltip, setTooltip] = (0, import_react61.useState)(null);
16356
+ const tooltipHideTimer = (0, import_react61.useRef)();
16357
+ const tooltipHeld = (0, import_react61.useRef)(false);
16227
16358
  const cancelTooltipHide = () => {
16228
16359
  clearTimeout(tooltipHideTimer.current);
16229
16360
  };
16230
- (0, import_react60.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
16231
- const [linkedPosition, setLinkedPosition] = (0, import_react60.useState)({ left: 0, top: 0 });
16232
- (0, import_react60.useEffect)(() => {
16361
+ (0, import_react61.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
16362
+ const [linkedPosition, setLinkedPosition] = (0, import_react61.useState)({ left: 0, top: 0 });
16363
+ (0, import_react61.useEffect)(() => {
16233
16364
  const host = hostRef.current, svg = svgRef.current;
16234
16365
  if (!controlledTooltip || !host || !svg) return;
16235
16366
  const position = () => {
@@ -16244,12 +16375,12 @@ var SiaChart = (0, import_react60.forwardRef)(function SiaChart2({
16244
16375
  observer.observe(host);
16245
16376
  return () => observer.disconnect();
16246
16377
  }, [controlledTooltip]);
16247
- const [dataViewOpen, setDataViewOpen] = (0, import_react60.useState)(false);
16248
- const [markMode, setMarkMode] = (0, import_react60.useState)(false);
16249
- const [markStart, setMarkStart] = (0, import_react60.useState)(null);
16250
- const [userMarks, setUserMarks] = (0, import_react60.useState)([]);
16378
+ const [dataViewOpen, setDataViewOpen] = (0, import_react61.useState)(false);
16379
+ const [markMode, setMarkMode] = (0, import_react61.useState)(false);
16380
+ const [markStart, setMarkStart] = (0, import_react61.useState)(null);
16381
+ const [userMarks, setUserMarks] = (0, import_react61.useState)([]);
16251
16382
  const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
16252
- const rootStyle = (0, import_react60.useMemo)(() => ({
16383
+ const rootStyle = (0, import_react61.useMemo)(() => ({
16253
16384
  ...style,
16254
16385
  width: toCssSize(width, "100%"),
16255
16386
  height: toCssSize(height, "320px"),
@@ -16307,13 +16438,13 @@ var SiaChart = (0, import_react60.forwardRef)(function SiaChart2({
16307
16438
  anchor.href = canvas.toDataURL("image/png");
16308
16439
  anchor.click();
16309
16440
  }
16310
- (0, import_react60.useImperativeHandle)(ref, () => ({
16441
+ (0, import_react61.useImperativeHandle)(ref, () => ({
16311
16442
  getElement: () => svgRef.current,
16312
16443
  focus: () => svgRef.current?.focus(),
16313
16444
  toSvgString: serializeSvg,
16314
16445
  toDataUrl: svgDataUrl
16315
16446
  }), []);
16316
- const context = (0, import_react60.useMemo)(() => ({
16447
+ const context = (0, import_react61.useMemo)(() => ({
16317
16448
  palette,
16318
16449
  showTooltip: (event, content, point) => {
16319
16450
  cancelTooltipHide();
@@ -16500,7 +16631,7 @@ var SiaChart = (0, import_react60.forwardRef)(function SiaChart2({
16500
16631
  ) });
16501
16632
  });
16502
16633
  function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
16503
- const context = (0, import_react60.useContext)(ChartContext);
16634
+ const context = (0, import_react61.useContext)(ChartContext);
16504
16635
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
16505
16636
  "g",
16506
16637
  {
@@ -16529,7 +16660,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
16529
16660
  );
16530
16661
  }
16531
16662
  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 }) {
16532
- const paintId = (0, import_react60.useId)().replaceAll(":", "");
16663
+ const paintId = (0, import_react61.useId)().replaceAll(":", "");
16533
16664
  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))));
16534
16665
  const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
16535
16666
  const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
@@ -16658,7 +16789,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
16658
16789
  ] });
16659
16790
  }
16660
16791
  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 }) {
16661
- const id = (0, import_react60.useId)().replaceAll(":", "");
16792
+ const id = (0, import_react61.useId)().replaceAll(":", "");
16662
16793
  const vertical = orientation === "vertical";
16663
16794
  if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
16664
16795
  if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
@@ -16686,8 +16817,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
16686
16817
  ] });
16687
16818
  }
16688
16819
  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 }) {
16689
- const [activeHandle, setActiveHandle] = (0, import_react60.useState)(null);
16690
- const pan = (0, import_react60.useRef)();
16820
+ const [activeHandle, setActiveHandle] = (0, import_react61.useState)(null);
16821
+ const pan = (0, import_react61.useRef)();
16691
16822
  const start = Math.min(value[0], value[1]);
16692
16823
  const end = Math.max(value[0], value[1]);
16693
16824
  const startPercent = (start - min) / Math.max(1, max - min) * 100;
@@ -16761,9 +16892,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
16761
16892
  ] });
16762
16893
  }
16763
16894
  function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
16764
- const [playing, setPlaying] = (0, import_react60.useState)(autoPlay);
16765
- (0, import_react60.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
16766
- (0, import_react60.useEffect)(() => {
16895
+ const [playing, setPlaying] = (0, import_react61.useState)(autoPlay);
16896
+ (0, import_react61.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
16897
+ (0, import_react61.useEffect)(() => {
16767
16898
  if (!playing || labels.length <= 1) return void 0;
16768
16899
  const timer = window.setInterval(() => {
16769
16900
  const next = value + 1;
@@ -16873,7 +17004,7 @@ function parseSvgMapPaths(source) {
16873
17004
  }
16874
17005
 
16875
17006
  // src/components/useMapRoam.ts
16876
- var import_react61 = require("react");
17007
+ var import_react62 = require("react");
16877
17008
 
16878
17009
  // src/components/chartRoam.ts
16879
17010
  function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
@@ -16890,14 +17021,14 @@ var initial = { x: 0, y: 0, scale: 1 };
16890
17021
  function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
16891
17022
  const [zoomIn, zoomOut] = wheelFactors;
16892
17023
  const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
16893
- const host = (0, import_react61.useRef)(null);
16894
- const [view, setView] = (0, import_react61.useState)(initial);
16895
- const drag = (0, import_react61.useRef)();
17024
+ const host = (0, import_react62.useRef)(null);
17025
+ const [view, setView] = (0, import_react62.useState)(initial);
17026
+ const drag = (0, import_react62.useRef)();
16896
17027
  const local = (x, y) => {
16897
17028
  const matrix = host.current?.ownerSVGElement?.getScreenCTM();
16898
17029
  return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
16899
17030
  };
16900
- (0, import_react61.useEffect)(() => {
17031
+ (0, import_react62.useEffect)(() => {
16901
17032
  const node = host.current;
16902
17033
  if (!node || !mode || mode === "move") return;
16903
17034
  const wheel = (event) => {
@@ -16959,7 +17090,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
16959
17090
  }
16960
17091
 
16961
17092
  // src/components/ChartMapLineReveal.tsx
16962
- var import_react62 = require("react");
17093
+ var import_react63 = require("react");
16963
17094
 
16964
17095
  // src/components/mapLineGeometry.ts
16965
17096
  function mapLineControl(source, target, curveness) {
@@ -16976,9 +17107,9 @@ function mapLineDuration(source, target, period) {
16976
17107
  // src/components/ChartMapLineReveal.tsx
16977
17108
  var import_jsx_runtime63 = require("react/jsx-runtime");
16978
17109
  function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
16979
- const signature = JSON.stringify([source, control, target]), initialized = (0, import_react62.useRef)(false);
16980
- const [frame, setFrame] = (0, import_react62.useState)({ signature, progress: enabled ? 0 : 1 });
16981
- (0, import_react62.useEffect)(() => {
17110
+ const signature = JSON.stringify([source, control, target]), initialized = (0, import_react63.useRef)(false);
17111
+ const [frame, setFrame] = (0, import_react63.useState)({ signature, progress: enabled ? 0 : 1 });
17112
+ (0, import_react63.useEffect)(() => {
16982
17113
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
16983
17114
  const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
16984
17115
  if (!enabled || reduced.matches) {
@@ -17011,15 +17142,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
17011
17142
  }
17012
17143
 
17013
17144
  // src/components/ChartMapLineEffect.tsx
17014
- var import_react63 = require("react");
17145
+ var import_react64 = require("react");
17015
17146
  var import_jsx_runtime64 = require("react/jsx-runtime");
17016
17147
  function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
17017
- const ref = (0, import_react63.useRef)(null);
17018
- const trails = (0, import_react63.useRef)([]);
17148
+ const ref = (0, import_react64.useRef)(null);
17149
+ const trails = (0, import_react64.useRef)([]);
17019
17150
  const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
17020
17151
  const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
17021
17152
  const duration = mapLineDuration(source, target, period);
17022
- (0, import_react63.useEffect)(() => {
17153
+ (0, import_react64.useEffect)(() => {
17023
17154
  const started = performance.now();
17024
17155
  let frame = 0;
17025
17156
  const history = [];
@@ -17052,7 +17183,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
17052
17183
  }
17053
17184
 
17054
17185
  // src/components/ChartMapPointPulse.tsx
17055
- var import_react64 = require("react");
17186
+ var import_react65 = require("react");
17056
17187
 
17057
17188
  // src/components/mapPointPulse.ts
17058
17189
  function mapPointPulseDuration(period, random = Math.random) {
@@ -17062,7 +17193,7 @@ function mapPointPulseDuration(period, random = Math.random) {
17062
17193
  // src/components/ChartMapPointPulse.tsx
17063
17194
  var import_jsx_runtime65 = require("react/jsx-runtime");
17064
17195
  function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
17065
- const [duration] = (0, import_react64.useState)(() => mapPointPulseDuration(period));
17196
+ const [duration] = (0, import_react65.useState)(() => mapPointPulseDuration(period));
17066
17197
  return /* @__PURE__ */ (0, import_jsx_runtime65.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: [
17067
17198
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
17068
17199
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
@@ -17070,11 +17201,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
17070
17201
  }
17071
17202
 
17072
17203
  // src/components/ChartMapPointEntrance.tsx
17073
- var import_react65 = require("react");
17204
+ var import_react66 = require("react");
17074
17205
  var import_jsx_runtime66 = require("react/jsx-runtime");
17075
17206
  function ChartMapPointEntrance({ enabled, x, y, children }) {
17076
- const [progress, setProgress] = (0, import_react65.useState)(enabled ? 0.01 : 1);
17077
- (0, import_react65.useEffect)(() => {
17207
+ const [progress, setProgress] = (0, import_react66.useState)(enabled ? 0.01 : 1);
17208
+ (0, import_react66.useEffect)(() => {
17078
17209
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
17079
17210
  if (!enabled || reduced.matches) {
17080
17211
  setProgress(1);
@@ -17117,8 +17248,8 @@ function mapLineEndLabel(source, target) {
17117
17248
  // src/components/SvgMapPlot.tsx
17118
17249
  var import_jsx_runtime67 = require("react/jsx-runtime");
17119
17250
  function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
17120
- const path = (0, import_react66.useRef)(null), [center, setCenter] = (0, import_react66.useState)([0, 0]);
17121
- (0, import_react66.useLayoutEffect)(() => {
17251
+ const path = (0, import_react67.useRef)(null), [center, setCenter] = (0, import_react67.useState)([0, 0]);
17252
+ (0, import_react67.useLayoutEffect)(() => {
17122
17253
  const box = path.current?.getBBox();
17123
17254
  if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
17124
17255
  }, [d]);
@@ -17136,9 +17267,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
17136
17267
  ] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
17137
17268
  }
17138
17269
  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" }) {
17139
- const map = (0, import_react66.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react66.useState)();
17140
- const [hoveredLine, setHoveredLine] = (0, import_react66.useState)();
17141
- (0, import_react66.useEffect)(() => {
17270
+ const map = (0, import_react67.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react67.useState)();
17271
+ const [hoveredLine, setHoveredLine] = (0, import_react67.useState)();
17272
+ (0, import_react67.useEffect)(() => {
17142
17273
  control.reset();
17143
17274
  setHovered(void 0);
17144
17275
  }, [resetKey]);
@@ -17201,16 +17332,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
17201
17332
  }
17202
17333
 
17203
17334
  // src/components/ChartRoamController.tsx
17204
- var import_react67 = require("react");
17335
+ var import_react68 = require("react");
17205
17336
  var import_jsx_runtime68 = require("react/jsx-runtime");
17206
17337
  function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
17207
- const [hovered, setHovered] = (0, import_react67.useState)(), [focused, setFocused] = (0, import_react67.useState)();
17208
- const timer = (0, import_react67.useRef)();
17338
+ const [hovered, setHovered] = (0, import_react68.useState)(), [focused, setFocused] = (0, import_react68.useState)();
17339
+ const timer = (0, import_react68.useRef)();
17209
17340
  const stop = () => {
17210
17341
  if (timer.current !== void 0) clearInterval(timer.current);
17211
17342
  timer.current = void 0;
17212
17343
  };
17213
- (0, import_react67.useEffect)(() => {
17344
+ (0, import_react68.useEffect)(() => {
17214
17345
  window.addEventListener("blur", stop);
17215
17346
  return () => {
17216
17347
  stop();
@@ -17249,13 +17380,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
17249
17380
  }
17250
17381
 
17251
17382
  // src/components/LineShareChart.tsx
17252
- var import_react87 = require("react");
17383
+ var import_react88 = require("react");
17253
17384
 
17254
17385
  // src/components/Charts.tsx
17255
- var import_react85 = require("react");
17386
+ var import_react86 = require("react");
17256
17387
 
17257
17388
  // src/components/ChartScatterMotion.tsx
17258
- var import_react68 = require("react");
17389
+ var import_react69 = require("react");
17259
17390
 
17260
17391
  // src/components/scatterMotion.ts
17261
17392
  function scatterMotionEase(progress) {
@@ -17267,9 +17398,9 @@ function scatterMotionEase(progress) {
17267
17398
  var import_jsx_runtime69 = require("react/jsx-runtime");
17268
17399
  function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
17269
17400
  const target = { x, y, radius };
17270
- const [frame, setFrame] = (0, import_react68.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
17271
- const displayed = (0, import_react68.useRef)(frame), started = (0, import_react68.useRef)(false);
17272
- (0, import_react68.useEffect)(() => {
17401
+ const [frame, setFrame] = (0, import_react69.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
17402
+ const displayed = (0, import_react69.useRef)(frame), started = (0, import_react69.useRef)(false);
17403
+ (0, import_react69.useEffect)(() => {
17273
17404
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
17274
17405
  let request = 0;
17275
17406
  const publish = (next) => {
@@ -17380,12 +17511,12 @@ function layoutEventRiver(series, tailLength, area) {
17380
17511
  }
17381
17512
 
17382
17513
  // src/components/EventRiverBubble.tsx
17383
- var import_react69 = require("react");
17514
+ var import_react70 = require("react");
17384
17515
  var import_jsx_runtime70 = require("react/jsx-runtime");
17385
17516
  function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
17386
- const [offset, setOffset] = (0, import_react69.useState)(0);
17387
- const drag = (0, import_react69.useRef)();
17388
- (0, import_react69.useEffect)(() => {
17517
+ const [offset, setOffset] = (0, import_react70.useState)(0);
17518
+ const drag = (0, import_react70.useRef)();
17519
+ (0, import_react70.useEffect)(() => {
17389
17520
  setOffset(0);
17390
17521
  drag.current = void 0;
17391
17522
  }, [resetKey]);
@@ -17436,13 +17567,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
17436
17567
  }
17437
17568
 
17438
17569
  // src/components/EventRiverMotion.tsx
17439
- var import_react70 = require("react");
17570
+ var import_react71 = require("react");
17440
17571
  var import_jsx_runtime71 = require("react/jsx-runtime");
17441
17572
  function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
17442
- const [frame, setFrame] = (0, import_react70.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
17443
- const displayed = (0, import_react70.useRef)(frame), started = (0, import_react70.useRef)(false);
17573
+ const [frame, setFrame] = (0, import_react71.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
17574
+ const displayed = (0, import_react71.useRef)(frame), started = (0, import_react71.useRef)(false);
17444
17575
  const signature = JSON.stringify(geometry);
17445
- (0, import_react70.useEffect)(() => {
17576
+ (0, import_react71.useEffect)(() => {
17446
17577
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
17447
17578
  const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
17448
17579
  let request = 0;
@@ -17559,7 +17690,7 @@ function transferPieValue(series, source, target, connector = " & ") {
17559
17690
  }
17560
17691
 
17561
17692
  // src/components/ChartValueIsland.tsx
17562
- var import_react71 = require("react");
17693
+ var import_react72 = require("react");
17563
17694
 
17564
17695
  // src/components/cartesianTransfer.ts
17565
17696
  function addValues(a, b) {
@@ -17624,13 +17755,13 @@ function findCompositeValueTarget(element, x, y) {
17624
17755
  // src/components/ChartValueIsland.tsx
17625
17756
  var import_jsx_runtime72 = require("react/jsx-runtime");
17626
17757
  function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
17627
- const drag = (0, import_react71.useRef)(null);
17628
- const [offset, setOffset] = (0, import_react71.useState)([0, 0]);
17758
+ const drag = (0, import_react72.useRef)(null);
17759
+ const [offset, setOffset] = (0, import_react72.useState)([0, 0]);
17629
17760
  const cancel = () => {
17630
17761
  drag.current = null;
17631
17762
  setOffset([0, 0]);
17632
17763
  };
17633
- (0, import_react71.useEffect)(cancel, [x, y]);
17764
+ (0, import_react72.useEffect)(cancel, [x, y]);
17634
17765
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
17635
17766
  ChartMark,
17636
17767
  {
@@ -17683,12 +17814,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
17683
17814
  }
17684
17815
 
17685
17816
  // src/components/ChartPulseRing.tsx
17686
- var import_react72 = require("react");
17817
+ var import_react73 = require("react");
17687
17818
  var import_jsx_runtime73 = require("react/jsx-runtime");
17688
17819
  function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
17689
- const id = (0, import_react72.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react72.useState)(0);
17690
- const [reduced, setReduced] = (0, import_react72.useState)(false);
17691
- (0, import_react72.useEffect)(() => {
17820
+ const id = (0, import_react73.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react73.useState)(0);
17821
+ const [reduced, setReduced] = (0, import_react73.useState)(false);
17822
+ (0, import_react73.useEffect)(() => {
17692
17823
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
17693
17824
  setReduced(preference.matches);
17694
17825
  let frame = 0;
@@ -17832,7 +17963,7 @@ function chartMarkerPath(kind, x, y, size) {
17832
17963
  }
17833
17964
 
17834
17965
  // src/components/ChartLargeMapPointCanvas.tsx
17835
- var import_react73 = require("react");
17966
+ var import_react74 = require("react");
17836
17967
 
17837
17968
  // src/components/largeMapPointPulse.ts
17838
17969
  function largeMapPointPulse(elapsed, period, initial3, delay) {
@@ -17848,8 +17979,8 @@ function largeMapPointSize(size, pulse) {
17848
17979
  // src/components/ChartLargeMapPointCanvas.tsx
17849
17980
  var import_jsx_runtime74 = require("react/jsx-runtime");
17850
17981
  function ChartLargeMapPointCanvas({ groups, width, height }) {
17851
- const canvas = (0, import_react73.useRef)(null), key = JSON.stringify(groups);
17852
- (0, import_react73.useEffect)(() => {
17982
+ const canvas = (0, import_react74.useRef)(null), key = JSON.stringify(groups);
17983
+ (0, import_react74.useEffect)(() => {
17853
17984
  const element = canvas.current, context = element?.getContext("2d");
17854
17985
  if (!element || !context) return;
17855
17986
  const ratio = window.devicePixelRatio || 1;
@@ -17908,12 +18039,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
17908
18039
  }
17909
18040
 
17910
18041
  // src/components/ChartCrosshair.tsx
17911
- var import_react74 = require("react");
18042
+ var import_react75 = require("react");
17912
18043
  var import_jsx_runtime75 = require("react/jsx-runtime");
17913
18044
  function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
17914
- const ref = (0, import_react74.useRef)(null);
17915
- const [point, setPoint] = (0, import_react74.useState)(null);
17916
- (0, import_react74.useEffect)(() => {
18045
+ const ref = (0, import_react75.useRef)(null);
18046
+ const [point, setPoint] = (0, import_react75.useState)(null);
18047
+ (0, import_react75.useEffect)(() => {
17917
18048
  const svg = ref.current?.ownerSVGElement;
17918
18049
  if (!svg) return;
17919
18050
  const clear = () => setPoint(null);
@@ -17933,7 +18064,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
17933
18064
  svg.removeEventListener("pointercancel", clear);
17934
18065
  };
17935
18066
  }, [bounds.x, bounds.y, bounds.width, bounds.height]);
17936
- (0, import_react74.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
18067
+ (0, import_react75.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
17937
18068
  const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
17938
18069
  const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
17939
18070
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
@@ -17950,7 +18081,7 @@ function decimal(value) {
17950
18081
  }
17951
18082
 
17952
18083
  // src/components/HeatmapRasterLayer.tsx
17953
- var import_react75 = require("react");
18084
+ var import_react76 = require("react");
17954
18085
 
17955
18086
  // src/components/heatmapRaster.ts
17956
18087
  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] }];
@@ -17997,9 +18128,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
17997
18128
  // src/components/HeatmapRasterLayer.tsx
17998
18129
  var import_jsx_runtime76 = require("react/jsx-runtime");
17999
18130
  function HeatmapRaster({ width, height, points, options }) {
18000
- const [url, setUrl] = (0, import_react75.useState)();
18131
+ const [url, setUrl] = (0, import_react76.useState)();
18001
18132
  const optionsKey = JSON.stringify(options);
18002
- (0, import_react75.useEffect)(() => {
18133
+ (0, import_react76.useEffect)(() => {
18003
18134
  const canvas = document.createElement("canvas");
18004
18135
  canvas.width = width;
18005
18136
  canvas.height = height;
@@ -18099,10 +18230,10 @@ function chordMatrixLayout(matrix, options = {}) {
18099
18230
  }
18100
18231
 
18101
18232
  // src/components/MatrixChordPlot.tsx
18102
- var import_react76 = require("react");
18233
+ var import_react77 = require("react");
18103
18234
  var import_jsx_runtime77 = require("react/jsx-runtime");
18104
18235
  function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
18105
- const [hoveredLink, setHoveredLink] = (0, import_react76.useState)(null);
18236
+ const [hoveredLink, setHoveredLink] = (0, import_react77.useState)(null);
18106
18237
  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;
18107
18238
  const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
18108
18239
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
@@ -18449,13 +18580,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
18449
18580
  }
18450
18581
 
18451
18582
  // src/components/ChartRoamGroup.tsx
18452
- var import_react77 = require("react");
18583
+ var import_react78 = require("react");
18453
18584
  var import_jsx_runtime79 = require("react/jsx-runtime");
18454
18585
  var initial2 = { x: 0, y: 0, scale: 1 };
18455
18586
  function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
18456
- const group = (0, import_react77.useRef)(null), drag = (0, import_react77.useRef)();
18457
- const [view, setView] = (0, import_react77.useState)(initial2);
18458
- (0, import_react77.useEffect)(() => {
18587
+ const group = (0, import_react78.useRef)(null), drag = (0, import_react78.useRef)();
18588
+ const [view, setView] = (0, import_react78.useState)(initial2);
18589
+ (0, import_react78.useEffect)(() => {
18459
18590
  setView(initial2);
18460
18591
  drag.current = void 0;
18461
18592
  }, [resetSignal]);
@@ -18465,7 +18596,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
18465
18596
  const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
18466
18597
  return [local.x, local.y];
18467
18598
  };
18468
- (0, import_react77.useEffect)(() => {
18599
+ (0, import_react78.useEffect)(() => {
18469
18600
  const target = group.current;
18470
18601
  if (!target || !enabled || !zoomEnabled) return;
18471
18602
  const wheel = (event) => {
@@ -18526,11 +18657,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
18526
18657
  }
18527
18658
 
18528
18659
  // src/components/TreeNodeGlyph.tsx
18529
- var import_react78 = require("react");
18660
+ var import_react79 = require("react");
18530
18661
  var import_jsx_runtime80 = require("react/jsx-runtime");
18531
18662
  function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
18532
- const [failed, setFailed] = (0, import_react78.useState)(false);
18533
- (0, import_react78.useEffect)(() => setFailed(false), [symbol]);
18663
+ const [failed, setFailed] = (0, import_react79.useState)(false);
18664
+ (0, import_react79.useEffect)(() => setFailed(false), [symbol]);
18534
18665
  const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
18535
18666
  if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
18536
18667
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
@@ -18819,7 +18950,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
18819
18950
  }
18820
18951
 
18821
18952
  // src/components/ChartBundledMapCanvas.tsx
18822
- var import_react79 = require("react");
18953
+ var import_react80 = require("react");
18823
18954
 
18824
18955
  // src/components/edgeBundling.ts
18825
18956
  var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
@@ -18963,9 +19094,9 @@ function sampleBundledPath(curves, progress) {
18963
19094
  var import_jsx_runtime81 = require("react/jsx-runtime");
18964
19095
  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 }) {
18965
19096
  const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
18966
- const paths = (0, import_react79.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
18967
- const base = (0, import_react79.useRef)(null), moving = (0, import_react79.useRef)(null);
18968
- (0, import_react79.useEffect)(() => {
19097
+ const paths = (0, import_react80.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
19098
+ const base = (0, import_react80.useRef)(null), moving = (0, import_react80.useRef)(null);
19099
+ (0, import_react80.useEffect)(() => {
18969
19100
  const node = base.current, ctx = node?.getContext("2d");
18970
19101
  if (!node || !ctx) return;
18971
19102
  const ratio = window.devicePixelRatio || 1;
@@ -18991,7 +19122,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
18991
19122
  ctx.fill();
18992
19123
  }
18993
19124
  }, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
18994
- (0, import_react79.useEffect)(() => {
19125
+ (0, import_react80.useEffect)(() => {
18995
19126
  const node = moving.current, ctx = node?.getContext("2d");
18996
19127
  if (!node || !ctx) return;
18997
19128
  const ratio = window.devicePixelRatio || 1;
@@ -19053,11 +19184,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
19053
19184
  }
19054
19185
 
19055
19186
  // src/components/ChartMapEffectCanvas.tsx
19056
- var import_react80 = require("react");
19187
+ var import_react81 = require("react");
19057
19188
  var import_jsx_runtime82 = require("react/jsx-runtime");
19058
19189
  function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
19059
- const canvas = (0, import_react80.useRef)(null), key = JSON.stringify(effects);
19060
- (0, import_react80.useEffect)(() => {
19190
+ const canvas = (0, import_react81.useRef)(null), key = JSON.stringify(effects);
19191
+ (0, import_react81.useEffect)(() => {
19061
19192
  const element = canvas.current;
19062
19193
  if (!element) return;
19063
19194
  const context = element.getContext("2d");
@@ -19203,12 +19334,12 @@ function layoutTreeNodes(root, options = {}) {
19203
19334
  }
19204
19335
 
19205
19336
  // src/components/ChartDataEditor.tsx
19206
- var import_react81 = require("react");
19337
+ var import_react82 = require("react");
19207
19338
  var import_jsx_runtime83 = require("react/jsx-runtime");
19208
19339
  function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
19209
- const [draft, setDraft] = (0, import_react81.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
19210
- const [error, setError] = (0, import_react81.useState)("");
19211
- const [applied, setApplied] = (0, import_react81.useState)(false);
19340
+ const [draft, setDraft] = (0, import_react82.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
19341
+ const [error, setError] = (0, import_react82.useState)("");
19342
+ const [applied, setApplied] = (0, import_react82.useState)(false);
19212
19343
  function apply() {
19213
19344
  try {
19214
19345
  const values = JSON.parse(draft);
@@ -19239,11 +19370,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
19239
19370
  }
19240
19371
 
19241
19372
  // src/components/ChartBarStatistics.tsx
19242
- var import_react82 = require("react");
19373
+ var import_react83 = require("react");
19243
19374
  var import_jsx_runtime84 = require("react/jsx-runtime");
19244
19375
  function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
19245
- const id = (0, import_react82.useId)().replaceAll(":", "");
19246
- const [active, setActive] = (0, import_react82.useState)();
19376
+ const id = (0, import_react83.useId)().replaceAll(":", "");
19377
+ const [active, setActive] = (0, import_react83.useState)();
19247
19378
  const paint = gradient ? `url(#${id})` : color;
19248
19379
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("g", { children: [
19249
19380
  gradient ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime84.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_runtime84.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
@@ -19298,7 +19429,7 @@ function lineSegments(points) {
19298
19429
  }
19299
19430
 
19300
19431
  // src/components/useBarMagicState.ts
19301
- var import_react83 = require("react");
19432
+ var import_react84 = require("react");
19302
19433
 
19303
19434
  // src/components/cartesianMagicState.ts
19304
19435
  function changeCartesianMagic(state, action) {
@@ -19313,8 +19444,8 @@ function changeCartesianMagic(state, action) {
19313
19444
  function useBarMagicState(toolbox, shape = "bar") {
19314
19445
  const initial3 = { shape, layout: "original" };
19315
19446
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
19316
- const [state, setState] = (0, import_react83.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
19317
- (0, import_react83.useEffect)(() => {
19447
+ const [state, setState] = (0, import_react84.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
19448
+ (0, import_react84.useEffect)(() => {
19318
19449
  if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
19319
19450
  }, [options?.activeMagicType]);
19320
19451
  const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
@@ -19328,7 +19459,7 @@ function useBarMagicState(toolbox, shape = "bar") {
19328
19459
  }
19329
19460
 
19330
19461
  // src/components/useBarValueTransfer.ts
19331
- var import_react84 = require("react");
19462
+ var import_react85 = require("react");
19332
19463
 
19333
19464
  // src/components/barTransfer.ts
19334
19465
  function transferBarValue(series, source, target, categories) {
@@ -19345,10 +19476,10 @@ function transferBarValue(series, source, target, categories) {
19345
19476
 
19346
19477
  // src/components/useBarValueTransfer.ts
19347
19478
  function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
19348
- const [islands, setIslands] = (0, import_react84.useState)([]);
19349
- const drag = (0, import_react84.useRef)();
19350
- const [offset, setOffset] = (0, import_react84.useState)();
19351
- (0, import_react84.useEffect)(() => {
19479
+ const [islands, setIslands] = (0, import_react85.useState)([]);
19480
+ const drag = (0, import_react85.useRef)();
19481
+ const [offset, setOffset] = (0, import_react85.useState)();
19482
+ (0, import_react85.useEffect)(() => {
19352
19483
  setIslands([]);
19353
19484
  drag.current = void 0;
19354
19485
  setOffset(void 0);
@@ -19449,12 +19580,12 @@ function logarithmicValueAt(progress, domain) {
19449
19580
 
19450
19581
  // src/components/Charts.tsx
19451
19582
  var import_jsx_runtime85 = require("react/jsx-runtime");
19452
- var import_react86 = require("react");
19583
+ var import_react87 = require("react");
19453
19584
  var PLOT = { x: 62, y: 48, width: 628, height: 250 };
19454
19585
  var PLOT_BOTTOM = PLOT.y + PLOT.height;
19455
19586
  function useLegendSelection(names, controlled, onChange) {
19456
- const [internal, setInternal] = (0, import_react85.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
19457
- (0, import_react85.useEffect)(() => {
19587
+ const [internal, setInternal] = (0, import_react86.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
19588
+ (0, import_react86.useEffect)(() => {
19458
19589
  setInternal((current) => {
19459
19590
  const next = { ...current };
19460
19591
  names.forEach((name) => {
@@ -19554,7 +19685,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
19554
19685
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
19555
19686
  }
19556
19687
  function useZoom(value, defaultValue, onChange) {
19557
- const [internal, setInternal] = (0, import_react85.useState)([...defaultValue ?? [0, 100]]);
19688
+ const [internal, setInternal] = (0, import_react86.useState)([...defaultValue ?? [0, 100]]);
19558
19689
  const current = value ?? internal;
19559
19690
  const update = (next) => {
19560
19691
  if (!value) setInternal(next);
@@ -19564,8 +19695,8 @@ function useZoom(value, defaultValue, onChange) {
19564
19695
  }
19565
19696
  function useToolboxMagicType(toolbox, fallback) {
19566
19697
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
19567
- const [internal, setInternal] = (0, import_react85.useState)(options?.activeMagicType ?? fallback);
19568
- (0, import_react85.useEffect)(() => {
19698
+ const [internal, setInternal] = (0, import_react86.useState)(options?.activeMagicType ?? fallback);
19699
+ (0, import_react86.useEffect)(() => {
19569
19700
  if (options?.activeMagicType) setInternal(options.activeMagicType);
19570
19701
  }, [options?.activeMagicType]);
19571
19702
  const active = options?.activeMagicType ?? internal;
@@ -19583,15 +19714,15 @@ function useToolboxMagicType(toolbox, fallback) {
19583
19714
  } : toolbox;
19584
19715
  return [active, resolved];
19585
19716
  }
19586
- var LineChart = (0, import_react85.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) {
19587
- const [hoverIndex, setHoverIndex] = (0, import_react85.useState)(null);
19588
- const [editableSeries, setEditableSeries] = (0, import_react85.useState)(sourceSeries);
19589
- const [dragPoint, setDragPoint] = (0, import_react85.useState)(null);
19590
- const linePaintId = (0, import_react85.useId)().replaceAll(":", "");
19591
- const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react85.useState)();
19592
- (0, import_react85.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
19717
+ var LineChart = (0, import_react86.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) {
19718
+ const [hoverIndex, setHoverIndex] = (0, import_react86.useState)(null);
19719
+ const [editableSeries, setEditableSeries] = (0, import_react86.useState)(sourceSeries);
19720
+ const [dragPoint, setDragPoint] = (0, import_react86.useState)(null);
19721
+ const linePaintId = (0, import_react86.useId)().replaceAll(":", "");
19722
+ const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react86.useState)();
19723
+ (0, import_react86.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
19593
19724
  const series = externalValueTransfer ? sourceSeries : editableSeries;
19594
- const initialTransferSeries = (0, import_react85.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
19725
+ const initialTransferSeries = (0, import_react86.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
19595
19726
  const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
19596
19727
  const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
19597
19728
  const value = barDatum(nextBars[row].data[index]).value;
@@ -19608,8 +19739,8 @@ var LineChart = (0, import_react85.forwardRef)(function LineChart2({ calculableM
19608
19739
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
19609
19740
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
19610
19741
  const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime85.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;
19611
- const [zoomBrushActive, setZoomBrushActive] = (0, import_react85.useState)(false);
19612
- const [zoomHistory, setZoomHistory] = (0, import_react85.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
19742
+ const [zoomBrushActive, setZoomBrushActive] = (0, import_react86.useState)(false);
19743
+ const [zoomHistory, setZoomHistory] = (0, import_react86.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
19613
19744
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
19614
19745
  const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
19615
19746
  const next = [start + range[0] * span, start + range[1] * span];
@@ -19996,17 +20127,17 @@ function ChartPin({ point, color, label }) {
19996
20127
  function barDatum(datum) {
19997
20128
  return typeof datum === "number" ? { value: datum } : datum;
19998
20129
  }
19999
- var BarChart = (0, import_react85.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) {
20000
- const [editableSeries, setEditableSeries] = (0, import_react85.useState)(sourceSeries);
20001
- const [dragBar, setDragBar] = (0, import_react85.useState)(null);
20002
- const [hoveredBar, setHoveredBar] = (0, import_react85.useState)();
20003
- const barPaintId = (0, import_react85.useId)().replaceAll(":", "");
20130
+ var BarChart = (0, import_react86.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) {
20131
+ const [editableSeries, setEditableSeries] = (0, import_react86.useState)(sourceSeries);
20132
+ const [dragBar, setDragBar] = (0, import_react86.useState)(null);
20133
+ const [hoveredBar, setHoveredBar] = (0, import_react86.useState)();
20134
+ const barPaintId = (0, import_react86.useId)().replaceAll(":", "");
20004
20135
  const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
20005
20136
  setEditableSeries(next);
20006
20137
  onDataChange?.(next);
20007
20138
  }, onTransferError);
20008
20139
  const transfer = externalValueTransfer ?? localTransfer;
20009
- (0, import_react85.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
20140
+ (0, import_react86.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
20010
20141
  const series = externalValueTransfer ? sourceSeries : editableSeries;
20011
20142
  const legacy = appearance === "macarons";
20012
20143
  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 };
@@ -20253,17 +20384,17 @@ var BarChart = (0, import_react85.forwardRef)(function BarChart2({ valueTransfer
20253
20384
  ] }, `bar-island-${index}`)) : null
20254
20385
  ] });
20255
20386
  });
20256
- var ScatterChart = (0, import_react85.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) {
20257
- const [data, setData] = (0, import_react85.useState)(initialData);
20258
- const [emphasizedPoint, setEmphasizedPoint] = (0, import_react85.useState)(null);
20259
- const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react85.useState)();
20260
- (0, import_react85.useEffect)(() => setData(initialData), [initialData]);
20387
+ var ScatterChart = (0, import_react86.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) {
20388
+ const [data, setData] = (0, import_react86.useState)(initialData);
20389
+ const [emphasizedPoint, setEmphasizedPoint] = (0, import_react86.useState)(null);
20390
+ const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react86.useState)();
20391
+ (0, import_react86.useEffect)(() => setData(initialData), [initialData]);
20261
20392
  const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
20262
20393
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
20263
20394
  const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
20264
20395
  const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
20265
20396
  const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
20266
- const sorted = (0, import_react85.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
20397
+ const sorted = (0, import_react86.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
20267
20398
  const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
20268
20399
  const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
20269
20400
  const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
@@ -20278,10 +20409,10 @@ var ScatterChart = (0, import_react85.forwardRef)(function ScatterChart2({ symbo
20278
20409
  const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
20279
20410
  const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
20280
20411
  const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
20281
- const [selectedPieces, setSelectedPieces] = (0, import_react85.useState)([]);
20282
- const [visualRange, setVisualRange] = (0, import_react85.useState)();
20412
+ const [selectedPieces, setSelectedPieces] = (0, import_react86.useState)([]);
20413
+ const [visualRange, setVisualRange] = (0, import_react86.useState)();
20283
20414
  const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
20284
- (0, import_react85.useEffect)(() => setSelectedPieces([]), [piecesKey]);
20415
+ (0, import_react86.useEffect)(() => setSelectedPieces([]), [piecesKey]);
20285
20416
  const statistics = scatterStatistics(visibleData, markByCategory);
20286
20417
  const plotted = visibleData.map((item, index) => {
20287
20418
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
@@ -20439,8 +20570,8 @@ var ScatterChart = (0, import_react85.forwardRef)(function ScatterChart2({ symbo
20439
20570
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
20440
20571
  ] }) : content;
20441
20572
  });
20442
- var CandlestickChart = (0, import_react85.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) {
20443
- const [data, setData] = (0, import_react85.useState)(initialData), [internalActive, setInternalActive] = (0, import_react85.useState)(null), [internalVisible, setInternalVisible] = (0, import_react85.useState)(true);
20573
+ var CandlestickChart = (0, import_react86.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) {
20574
+ const [data, setData] = (0, import_react86.useState)(initialData), [internalActive, setInternalActive] = (0, import_react86.useState)(null), [internalVisible, setInternalVisible] = (0, import_react86.useState)(true);
20444
20575
  const active = activeIndex === void 0 ? internalActive : activeIndex;
20445
20576
  const seriesVisible = controlledVisible ?? internalVisible;
20446
20577
  const setActive = (index) => {
@@ -20451,7 +20582,7 @@ var CandlestickChart = (0, import_react85.forwardRef)(function CandlestickChart2
20451
20582
  if (controlledVisible === void 0) setInternalVisible(visible);
20452
20583
  onSeriesVisibilityChange?.(visible);
20453
20584
  };
20454
- (0, import_react85.useEffect)(() => {
20585
+ (0, import_react86.useEffect)(() => {
20455
20586
  setData(initialData);
20456
20587
  }, [initialData]);
20457
20588
  const legacy = appearance === "macarons";
@@ -20542,20 +20673,20 @@ var CandlestickChart = (0, import_react85.forwardRef)(function CandlestickChart2
20542
20673
  ] }) : content;
20543
20674
  });
20544
20675
  var EMPTY_PIE_DATA = [];
20545
- var PieChart = (0, import_react85.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) {
20546
- const pieGradientId = (0, import_react85.useId)().replace(/:/g, "");
20547
- const [pieIslands, setPieIslands] = (0, import_react85.useState)([]);
20548
- const sourceRings = (0, import_react85.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
20549
- const [editableRings, setEditableRings] = (0, import_react85.useState)(sourceRings);
20550
- const valueDrag = (0, import_react85.useRef)(null);
20551
- const [valueOffset, setValueOffset] = (0, import_react85.useState)();
20552
- (0, import_react85.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
20676
+ var PieChart = (0, import_react86.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) {
20677
+ const pieGradientId = (0, import_react86.useId)().replace(/:/g, "");
20678
+ const [pieIslands, setPieIslands] = (0, import_react86.useState)([]);
20679
+ const sourceRings = (0, import_react86.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
20680
+ const [editableRings, setEditableRings] = (0, import_react86.useState)(sourceRings);
20681
+ const valueDrag = (0, import_react86.useRef)(null);
20682
+ const [valueOffset, setValueOffset] = (0, import_react86.useState)();
20683
+ (0, import_react86.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
20553
20684
  const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
20554
20685
  const names = [...new Set(allData.map((item) => item.name))];
20555
20686
  const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
20556
20687
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
20557
- const [hovered, setHovered] = (0, import_react85.useState)();
20558
- const [internalSelected, setInternalSelected] = (0, import_react85.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
20688
+ const [hovered, setHovered] = (0, import_react86.useState)();
20689
+ const [internalSelected, setInternalSelected] = (0, import_react86.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
20559
20690
  const selectedNames = selected ?? internalSelected;
20560
20691
  const legacy = appearance === "macarons";
20561
20692
  const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
@@ -20775,15 +20906,15 @@ var PieChart = (0, import_react85.forwardRef)(function PieChart2({ pulseRing, ca
20775
20906
  });
20776
20907
  var EMPTY_RADAR_INDICATORS = [];
20777
20908
  var EMPTY_RADAR_SERIES = [];
20778
- var RadarChart = (0, import_react85.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) {
20909
+ var RadarChart = (0, import_react86.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) {
20779
20910
  const legacy = appearance === "macarons";
20780
- const initialPanels = (0, import_react85.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
20781
- const [sourcePanels, setSourcePanels] = (0, import_react85.useState)(initialPanels);
20782
- const [hoveredRadar, setHoveredRadar] = (0, import_react85.useState)(null);
20783
- const radarPaintId = `sia-radar-${(0, import_react85.useId)().replaceAll(":", "")}`;
20784
- const radarDrag = (0, import_react85.useRef)(null);
20785
- const [radarOffset, setRadarOffset] = (0, import_react85.useState)(null);
20786
- (0, import_react85.useEffect)(() => {
20911
+ const initialPanels = (0, import_react86.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
20912
+ const [sourcePanels, setSourcePanels] = (0, import_react86.useState)(initialPanels);
20913
+ const [hoveredRadar, setHoveredRadar] = (0, import_react86.useState)(null);
20914
+ const radarPaintId = `sia-radar-${(0, import_react86.useId)().replaceAll(":", "")}`;
20915
+ const radarDrag = (0, import_react86.useRef)(null);
20916
+ const [radarOffset, setRadarOffset] = (0, import_react86.useState)(null);
20917
+ (0, import_react86.useEffect)(() => {
20787
20918
  setSourcePanels(initialPanels);
20788
20919
  radarDrag.current = null;
20789
20920
  setRadarOffset(null);
@@ -20937,7 +21068,7 @@ var RadarChart = (0, import_react85.forwardRef)(function RadarChart2({ indicator
20937
21068
  })
20938
21069
  ] });
20939
21070
  });
20940
- var ChordChart = (0, import_react85.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) {
21071
+ var ChordChart = (0, import_react86.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) {
20941
21072
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
20942
21073
  if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
20943
21074
  GraphChart,
@@ -21010,11 +21141,11 @@ var ChordChart = (0, import_react85.forwardRef)(function ChordChart2({ nodes, li
21010
21141
  })
21011
21142
  ] });
21012
21143
  });
21013
- var GraphChart = (0, import_react85.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) {
21144
+ var GraphChart = (0, import_react86.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) {
21014
21145
  const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
21015
21146
  const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
21016
21147
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
21017
- const [roamReset, setRoamReset] = (0, import_react85.useState)(0);
21148
+ const [roamReset, setRoamReset] = (0, import_react86.useState)(0);
21018
21149
  const chartToolbox = typeof resolvedToolbox === "object" ? {
21019
21150
  ...resolvedToolbox,
21020
21151
  onRestore: () => {
@@ -21023,23 +21154,23 @@ var GraphChart = (0, import_react85.forwardRef)(function GraphChart2({ nodes, li
21023
21154
  resolvedToolbox.onRestore?.();
21024
21155
  }
21025
21156
  } : resolvedToolbox;
21026
- const activeNodes = (0, import_react85.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
21027
- const activeLinks = (0, import_react85.useMemo)(() => {
21157
+ const activeNodes = (0, import_react86.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
21158
+ const activeLinks = (0, import_react86.useMemo)(() => {
21028
21159
  const activeIds = new Set(activeNodes.map((node) => node.id));
21029
21160
  return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
21030
21161
  }, [activeNodes, links]);
21031
21162
  const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
21032
- const calculatedPositions = (0, import_react85.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
21033
- const [positions, setPositions] = (0, import_react85.useState)(calculatedPositions);
21034
- const [dragging, setDragging] = (0, import_react85.useState)(null);
21035
- const heldNode = (0, import_react85.useRef)(null);
21036
- const [forceRestart, setForceRestart] = (0, import_react85.useState)(0);
21037
- (0, import_react85.useEffect)(() => {
21163
+ const calculatedPositions = (0, import_react86.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
21164
+ const [positions, setPositions] = (0, import_react86.useState)(calculatedPositions);
21165
+ const [dragging, setDragging] = (0, import_react86.useState)(null);
21166
+ const heldNode = (0, import_react86.useRef)(null);
21167
+ const [forceRestart, setForceRestart] = (0, import_react86.useState)(0);
21168
+ (0, import_react86.useEffect)(() => {
21038
21169
  setPositions(calculatedPositions);
21039
21170
  setDragging(null);
21040
21171
  heldNode.current = null;
21041
21172
  }, [calculatedPositions, roamReset]);
21042
- (0, import_react85.useEffect)(() => {
21173
+ (0, import_react86.useEffect)(() => {
21043
21174
  if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
21044
21175
  let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
21045
21176
  const tick = (time) => {
@@ -21157,7 +21288,7 @@ var GraphChart = (0, import_react85.forwardRef)(function GraphChart2({ nodes, li
21157
21288
  ] })
21158
21289
  ] });
21159
21290
  });
21160
- var ForceGraphChart = (0, import_react85.forwardRef)(function ForceGraphChart2(props, ref) {
21291
+ var ForceGraphChart = (0, import_react86.forwardRef)(function ForceGraphChart2(props, ref) {
21161
21292
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(GraphChart, { ...props, layout: "force", ref });
21162
21293
  });
21163
21294
  var ForceChart = ForceGraphChart;
@@ -21186,12 +21317,12 @@ function colorBetween(start, end, ratio) {
21186
21317
  const to = read(end);
21187
21318
  return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
21188
21319
  }
21189
- var MapChart = (0, import_react85.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) {
21190
- const [internalSelected, setInternalSelected] = (0, import_react85.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
21320
+ var MapChart = (0, import_react86.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) {
21321
+ const [internalSelected, setInternalSelected] = (0, import_react86.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
21191
21322
  const selectedNames = selected ?? internalSelected;
21192
- const [hoveredRegion, setHoveredRegion] = (0, import_react85.useState)();
21193
- const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react85.useState)();
21194
- const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react85.useState)();
21323
+ const [hoveredRegion, setHoveredRegion] = (0, import_react86.useState)();
21324
+ const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react86.useState)();
21325
+ const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react86.useState)();
21195
21326
  const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
21196
21327
  const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
21197
21328
  const { view } = roamControl;
@@ -21206,8 +21337,8 @@ var MapChart = (0, import_react85.forwardRef)(function MapChart2({ overlayProjec
21206
21337
  const values = data.map((item) => item.value);
21207
21338
  const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
21208
21339
  const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
21209
- const [internalVisualRange, setInternalVisualRange] = (0, import_react85.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
21210
- (0, import_react85.useEffect)(() => {
21340
+ const [internalVisualRange, setInternalVisualRange] = (0, import_react86.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
21341
+ (0, import_react86.useEffect)(() => {
21211
21342
  if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
21212
21343
  }, [defaultVisualRange, maximum, minimum, visualRange]);
21213
21344
  const currentVisualRange = visualRange ?? internalVisualRange;
@@ -21383,7 +21514,7 @@ var MapChart = (0, import_react85.forwardRef)(function MapChart2({ overlayProjec
21383
21514
  roamController ? /* @__PURE__ */ (0, import_jsx_runtime85.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
21384
21515
  ] });
21385
21516
  });
21386
- var GaugeChart = (0, import_react85.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) {
21517
+ var GaugeChart = (0, import_react86.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) {
21387
21518
  const count = Math.max(1, data.length);
21388
21519
  const legacy = appearance === "macarons";
21389
21520
  return /* @__PURE__ */ (0, import_jsx_runtime85.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) => {
@@ -21466,12 +21597,12 @@ var GaugeChart = (0, import_react85.forwardRef)(function GaugeChart2({ tooltipFo
21466
21597
  ] }, `${item.name}-${index}`);
21467
21598
  }) });
21468
21599
  });
21469
- var FunnelChart = (0, import_react85.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) {
21600
+ var FunnelChart = (0, import_react86.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) {
21470
21601
  const legacy = appearance === "macarons";
21471
- const [activeFunnel, setActiveFunnel] = (0, import_react85.useState)(null);
21472
- const initialFunnels = (0, import_react85.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
21473
- const [sourceFunnels, setSourceFunnels] = (0, import_react85.useState)(initialFunnels);
21474
- (0, import_react85.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
21602
+ const [activeFunnel, setActiveFunnel] = (0, import_react86.useState)(null);
21603
+ const initialFunnels = (0, import_react86.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
21604
+ const [sourceFunnels, setSourceFunnels] = (0, import_react86.useState)(initialFunnels);
21605
+ (0, import_react86.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
21475
21606
  const allData = sourceFunnels.flatMap((funnel) => funnel.data);
21476
21607
  const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
21477
21608
  const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -21562,7 +21693,7 @@ var FunnelChart = (0, import_react85.forwardRef)(function FunnelChart2({ data =
21562
21693
  })
21563
21694
  ] });
21564
21695
  });
21565
- var HeatmapChart = (0, import_react85.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) {
21696
+ var HeatmapChart = (0, import_react86.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) {
21566
21697
  const pointMode = points.length > 0;
21567
21698
  const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
21568
21699
  const minimum = values.length ? Math.min(...values) : 0;
@@ -21571,7 +21702,7 @@ var HeatmapChart = (0, import_react85.forwardRef)(function HeatmapChart2({ raste
21571
21702
  const cellHeight = PLOT.height / Math.max(1, yLabels.length);
21572
21703
  const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
21573
21704
  const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
21574
- const filterId = `sia-heat-${(0, import_react85.useId)().replaceAll(":", "")}`;
21705
+ const filterId = `sia-heat-${(0, import_react86.useId)().replaceAll(":", "")}`;
21575
21706
  if (raster) return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
21576
21707
  raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
21577
21708
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
@@ -21607,7 +21738,7 @@ var HeatmapChart = (0, import_react85.forwardRef)(function HeatmapChart2({ raste
21607
21738
  ] })
21608
21739
  ] });
21609
21740
  });
21610
- var ThemeRiverChart = (0, import_react85.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
21741
+ var ThemeRiverChart = (0, import_react86.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
21611
21742
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
21612
21743
  const activeSeries = series.filter((item) => legend.isSelected(item.name));
21613
21744
  const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
@@ -21645,8 +21776,8 @@ function eventTime(value) {
21645
21776
  if (typeof value === "number") return value;
21646
21777
  return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
21647
21778
  }
21648
- var EventRiverChart = (0, import_react85.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) {
21649
- const [restoreVersion, setRestoreVersion] = (0, import_react85.useState)(0);
21779
+ var EventRiverChart = (0, import_react86.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) {
21780
+ const [restoreVersion, setRestoreVersion] = (0, import_react86.useState)(0);
21650
21781
  const area = plot;
21651
21782
  palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
21652
21783
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -21719,9 +21850,9 @@ function vennDistance(radiusA, radiusB, overlap) {
21719
21850
  }
21720
21851
  return (low + high) / 2;
21721
21852
  }
21722
- var VennChart = (0, import_react85.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
21723
- const [sets, setSets] = (0, import_react85.useState)(initialSets), [intersection, setIntersection] = (0, import_react85.useState)(initialIntersection), [active, setActive] = (0, import_react85.useState)();
21724
- (0, import_react85.useEffect)(() => {
21853
+ var VennChart = (0, import_react86.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
21854
+ const [sets, setSets] = (0, import_react86.useState)(initialSets), [intersection, setIntersection] = (0, import_react86.useState)(initialIntersection), [active, setActive] = (0, import_react86.useState)();
21855
+ (0, import_react86.useEffect)(() => {
21725
21856
  setSets(initialSets);
21726
21857
  setIntersection(initialIntersection);
21727
21858
  }, [initialSets, initialIntersection]);
@@ -21784,17 +21915,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
21784
21915
  });
21785
21916
  return result;
21786
21917
  }
21787
- var TreemapChart = (0, import_react85.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) {
21788
- const [path, setPath] = (0, import_react85.useState)([]);
21789
- const [sourceData, setSourceData] = (0, import_react85.useState)(data);
21790
- const [active, setActive] = (0, import_react85.useState)();
21791
- (0, import_react85.useEffect)(() => {
21918
+ var TreemapChart = (0, import_react86.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) {
21919
+ const [path, setPath] = (0, import_react86.useState)([]);
21920
+ const [sourceData, setSourceData] = (0, import_react86.useState)(data);
21921
+ const [active, setActive] = (0, import_react86.useState)();
21922
+ (0, import_react86.useEffect)(() => {
21792
21923
  setSourceData(data);
21793
21924
  setPath([]);
21794
21925
  }, [data]);
21795
21926
  const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
21796
21927
  const top = drilldown && showBreadcrumb ? 52 : 28;
21797
- const rectangles = (0, import_react85.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
21928
+ const rectangles = (0, import_react86.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
21798
21929
  const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
21799
21930
  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);
21800
21931
  setSourceData(update(sourceData, 0));
@@ -21862,15 +21993,15 @@ function flattenTree2(root, collapsed) {
21862
21993
  visit(root, 0);
21863
21994
  return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
21864
21995
  }
21865
- var TreeChart = (0, import_react85.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) {
21866
- const [sourceData, setSourceData] = (0, import_react85.useState)(data);
21867
- const [roamReset, setRoamReset] = (0, import_react85.useState)(0);
21868
- const [active, setActive] = (0, import_react85.useState)();
21869
- (0, import_react85.useEffect)(() => {
21996
+ var TreeChart = (0, import_react86.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) {
21997
+ const [sourceData, setSourceData] = (0, import_react86.useState)(data);
21998
+ const [roamReset, setRoamReset] = (0, import_react86.useState)(0);
21999
+ const [active, setActive] = (0, import_react86.useState)();
22000
+ (0, import_react86.useEffect)(() => {
21870
22001
  setSourceData(data);
21871
22002
  setActive(void 0);
21872
22003
  }, [data]);
21873
- const [collapsed, setCollapsed] = (0, import_react85.useState)(() => {
22004
+ const [collapsed, setCollapsed] = (0, import_react86.useState)(() => {
21874
22005
  const result = /* @__PURE__ */ new Set();
21875
22006
  const visit = (node) => {
21876
22007
  if (node.collapsed) result.add(node.name);
@@ -21879,8 +22010,8 @@ var TreeChart = (0, import_react85.forwardRef)(function TreeChart2({ data, itemS
21879
22010
  visit(data);
21880
22011
  return result;
21881
22012
  });
21882
- const layout = (0, import_react85.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
21883
- const fixedLayout = (0, import_react85.useMemo)(() => {
22013
+ const layout = (0, import_react86.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
22014
+ const fixedLayout = (0, import_react86.useMemo)(() => {
21884
22015
  const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
21885
22016
  return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
21886
22017
  }, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
@@ -21950,15 +22081,15 @@ var TreeChart = (0, import_react85.forwardRef)(function TreeChart2({ data, itemS
21950
22081
  })
21951
22082
  ] }) });
21952
22083
  });
21953
- var WordCloudChart = (0, import_react85.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) {
21954
- const placements = (0, import_react85.useMemo)(() => {
22084
+ var WordCloudChart = (0, import_react86.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) {
22085
+ const placements = (0, import_react86.useMemo)(() => {
21955
22086
  const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
21956
22087
  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) => {
21957
22088
  context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
21958
22089
  return context.measureText(word.name).width;
21959
22090
  } : void 0 });
21960
22091
  }, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
21961
- (0, import_react85.useEffect)(() => {
22092
+ (0, import_react86.useEffect)(() => {
21962
22093
  const present = new Set(placements.map((p) => p.index));
21963
22094
  onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
21964
22095
  }, [placements, data, onLayout]);
@@ -21967,30 +22098,30 @@ var WordCloudChart = (0, import_react85.forwardRef)(function WordCloudChart2({ d
21967
22098
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime85.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_runtime85.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}`);
21968
22099
  }) });
21969
22100
  });
21970
- var MixedChart = (0, import_react85.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) {
21971
- const plotClipId = `sia-mixed-plot-${(0, import_react85.useId)().replaceAll(":", "")}`;
21972
- const [editableSeries, setEditableSeries] = (0, import_react85.useState)(sourceSeries);
21973
- const [geometry, setGeometry] = (0, import_react85.useState)();
21974
- const [pointerIndex, setPointerIndex] = (0, import_react85.useState)(null);
21975
- const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react85.useState)(0);
21976
- const [motionRevision, setMotionRevision] = (0, import_react85.useState)(0);
21977
- const [stackMode, setStackMode] = (0, import_react85.useState)();
21978
- const lastPublished = (0, import_react85.useRef)(null);
22101
+ var MixedChart = (0, import_react86.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) {
22102
+ const plotClipId = `sia-mixed-plot-${(0, import_react86.useId)().replaceAll(":", "")}`;
22103
+ const [editableSeries, setEditableSeries] = (0, import_react86.useState)(sourceSeries);
22104
+ const [geometry, setGeometry] = (0, import_react86.useState)();
22105
+ const [pointerIndex, setPointerIndex] = (0, import_react86.useState)(null);
22106
+ const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react86.useState)(0);
22107
+ const [motionRevision, setMotionRevision] = (0, import_react86.useState)(0);
22108
+ const [stackMode, setStackMode] = (0, import_react86.useState)();
22109
+ const lastPublished = (0, import_react86.useRef)(null);
21979
22110
  const publishData = (next) => {
21980
22111
  lastPublished.current = next;
21981
22112
  onDataChange?.(next);
21982
22113
  };
21983
- const [islands, setIslands] = (0, import_react85.useState)([]);
21984
- const drag = (0, import_react85.useRef)(null);
21985
- const [dragOffset, setDragOffset] = (0, import_react85.useState)();
21986
- (0, import_react85.useEffect)(() => {
22114
+ const [islands, setIslands] = (0, import_react86.useState)([]);
22115
+ const drag = (0, import_react86.useRef)(null);
22116
+ const [dragOffset, setDragOffset] = (0, import_react86.useState)();
22117
+ (0, import_react86.useEffect)(() => {
21987
22118
  if (sourceSeries === lastPublished.current) return;
21988
22119
  setEditableSeries(sourceSeries);
21989
22120
  setIslands([]);
21990
22121
  drag.current = null;
21991
22122
  setDragOffset(void 0);
21992
22123
  }, [sourceSeries]);
21993
- const series = (0, import_react85.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
22124
+ const series = (0, import_react86.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
21994
22125
  const stacked = stackMode ?? sourceStacked;
21995
22126
  const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
21996
22127
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -22154,7 +22285,7 @@ var MixedChart = (0, import_react85.forwardRef)(function MixedChart2({ axisPoint
22154
22285
  })
22155
22286
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
22156
22287
  activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime85.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,
22157
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react86.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_runtime85.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,
22288
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react87.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_runtime85.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,
22158
22289
  calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime85.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_runtime85.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,
22159
22290
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
22160
22291
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
@@ -22193,7 +22324,7 @@ var MixedChart = (0, import_react85.forwardRef)(function MixedChart2({ axisPoint
22193
22324
  const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
22194
22325
  const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
22195
22326
  const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
22196
- return /* @__PURE__ */ (0, import_jsx_runtime85.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_react86.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_runtime85.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
22327
+ return /* @__PURE__ */ (0, import_jsx_runtime85.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_react87.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_runtime85.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
22197
22328
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
22198
22329
  } }, /* @__PURE__ */ (0, import_jsx_runtime85.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}`);
22199
22330
  })
@@ -22222,7 +22353,7 @@ var MixedChart = (0, import_react85.forwardRef)(function MixedChart2({ axisPoint
22222
22353
  if (!placements[index]) return null;
22223
22354
  const name = categoryName(index, item.categoryAxisIndex);
22224
22355
  const value = item.data[index] ?? 0;
22225
- return /* @__PURE__ */ (0, import_react86.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_runtime85.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
22356
+ return /* @__PURE__ */ (0, import_react87.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_runtime85.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
22226
22357
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
22227
22358
  } }, /* @__PURE__ */ (0, import_jsx_runtime85.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 }));
22228
22359
  })
@@ -22263,9 +22394,9 @@ var KLineChart = CandlestickChart;
22263
22394
 
22264
22395
  // src/components/LineShareChart.tsx
22265
22396
  var import_jsx_runtime86 = require("react/jsx-runtime");
22266
- var LineShareChart = (0, import_react87.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
22267
- const [selected, setSelected] = (0, import_react87.useState)(null);
22268
- const [maskHovered, setMaskHovered] = (0, import_react87.useState)(false);
22397
+ var LineShareChart = (0, import_react88.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
22398
+ const [selected, setSelected] = (0, import_react88.useState)(null);
22399
+ const [maskHovered, setMaskHovered] = (0, import_react88.useState)(false);
22269
22400
  const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
22270
22401
  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;
22271
22402
  const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
@@ -22343,16 +22474,16 @@ function paddedValueExtent(values, padding = 0.05) {
22343
22474
  }
22344
22475
 
22345
22476
  // src/components/XYChart.tsx
22346
- var import_react88 = require("react");
22477
+ var import_react89 = require("react");
22347
22478
  var import_jsx_runtime87 = require("react/jsx-runtime");
22348
- var XYChart = (0, import_react88.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
22349
- const [series, setSeries] = (0, import_react88.useState)(source);
22350
- const [hidden, setHidden] = (0, import_react88.useState)([]);
22351
- const [crosshair, setCrosshair] = (0, import_react88.useState)();
22352
- const [drag, setDrag] = (0, import_react88.useState)();
22353
- const [geometry, setGeometry] = (0, import_react88.useState)();
22354
- const [zoom, setZoom] = (0, import_react88.useState)(defaultZoom);
22355
- (0, import_react88.useEffect)(() => setSeries(source), [source]);
22479
+ var XYChart = (0, import_react89.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
22480
+ const [series, setSeries] = (0, import_react89.useState)(source);
22481
+ const [hidden, setHidden] = (0, import_react89.useState)([]);
22482
+ const [crosshair, setCrosshair] = (0, import_react89.useState)();
22483
+ const [drag, setDrag] = (0, import_react89.useState)();
22484
+ const [geometry, setGeometry] = (0, import_react89.useState)();
22485
+ const [zoom, setZoom] = (0, import_react89.useState)(defaultZoom);
22486
+ (0, import_react89.useEffect)(() => setSeries(source), [source]);
22356
22487
  const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
22357
22488
  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 }));
22358
22489
  const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
@@ -22481,7 +22612,7 @@ var XYChart = (0, import_react88.forwardRef)(function XYChart2({ series: source,
22481
22612
  });
22482
22613
 
22483
22614
  // src/components/ChartMapOverlay.tsx
22484
- var import_react89 = require("react");
22615
+ var import_react90 = require("react");
22485
22616
 
22486
22617
  // src/components/mapOverlayHost.ts
22487
22618
  function observeMapOverlayHost(host, onChange) {
@@ -22520,11 +22651,11 @@ function observeMapOverlayHost(host, onChange) {
22520
22651
  // src/components/ChartMapOverlay.tsx
22521
22652
  var import_jsx_runtime88 = require("react/jsx-runtime");
22522
22653
  function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
22523
- const container = (0, import_react89.useRef)(null);
22524
- const errorHandler = (0, import_react89.useRef)(onError);
22654
+ const container = (0, import_react90.useRef)(null);
22655
+ const errorHandler = (0, import_react90.useRef)(onError);
22525
22656
  errorHandler.current = onError;
22526
- const [snapshot, setSnapshot] = (0, import_react89.useState)();
22527
- (0, import_react89.useEffect)(() => {
22657
+ const [snapshot, setSnapshot] = (0, import_react90.useState)();
22658
+ (0, import_react90.useEffect)(() => {
22528
22659
  setSnapshot(void 0);
22529
22660
  if (!container.current) return;
22530
22661
  try {
@@ -22601,9 +22732,9 @@ function createBaiduMapHost(element, sdk, options) {
22601
22732
  }
22602
22733
 
22603
22734
  // src/components/InputSelect.tsx
22604
- var import_react90 = require("react");
22735
+ var import_react91 = require("react");
22605
22736
  var import_jsx_runtime89 = require("react/jsx-runtime");
22606
- var InputSelect = (0, import_react90.forwardRef)(function InputSelect2({
22737
+ var InputSelect = (0, import_react91.forwardRef)(function InputSelect2({
22607
22738
  options,
22608
22739
  value,
22609
22740
  defaultValue,
@@ -22629,22 +22760,22 @@ var InputSelect = (0, import_react90.forwardRef)(function InputSelect2({
22629
22760
  ...inputProps
22630
22761
  }, forwardedRef) {
22631
22762
  const size = useControlSize(sizeProp);
22632
- const [internal, setInternal] = (0, import_react90.useState)(defaultValue);
22763
+ const [internal, setInternal] = (0, import_react91.useState)(defaultValue);
22633
22764
  const current = value !== void 0 ? value : internal;
22634
22765
  const values = current == null ? [] : Array.isArray(current) ? current : [current];
22635
22766
  const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
22636
- const [draft, setDraft] = (0, import_react90.useState)(text);
22637
- (0, import_react90.useEffect)(() => {
22767
+ const [draft, setDraft] = (0, import_react91.useState)(text);
22768
+ (0, import_react91.useEffect)(() => {
22638
22769
  setDraft(text);
22639
22770
  }, [text, current]);
22640
- const [open, setOpen] = (0, import_react90.useState)(false);
22641
- const [search, setSearch] = (0, import_react90.useState)("");
22642
- const [modalOpen, setModalOpen] = (0, import_react90.useState)(false);
22643
- const [modalValues, setModalValues] = (0, import_react90.useState)([]);
22644
- const [selectedOnly, setSelectedOnly] = (0, import_react90.useState)(false);
22645
- const rootRef = (0, import_react90.useRef)(null);
22646
- const popupRef = (0, import_react90.useRef)(null);
22647
- const inputRef = (0, import_react90.useRef)(null);
22771
+ const [open, setOpen] = (0, import_react91.useState)(false);
22772
+ const [search, setSearch] = (0, import_react91.useState)("");
22773
+ const [modalOpen, setModalOpen] = (0, import_react91.useState)(false);
22774
+ const [modalValues, setModalValues] = (0, import_react91.useState)([]);
22775
+ const [selectedOnly, setSelectedOnly] = (0, import_react91.useState)(false);
22776
+ const rootRef = (0, import_react91.useRef)(null);
22777
+ const popupRef = (0, import_react91.useRef)(null);
22778
+ const inputRef = (0, import_react91.useRef)(null);
22648
22779
  const config = typeof enableModal === "object" ? enableModal : {};
22649
22780
  function changeOpen(next) {
22650
22781
  if (next && (disabled || loading)) return;
@@ -22664,7 +22795,7 @@ var InputSelect = (0, import_react90.forwardRef)(function InputSelect2({
22664
22795
  inputRef.current?.focus();
22665
22796
  }
22666
22797
  }
22667
- (0, import_react90.useEffect)(() => {
22798
+ (0, import_react91.useEffect)(() => {
22668
22799
  if (!open) return;
22669
22800
  const outside = (event) => {
22670
22801
  if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
@@ -22672,7 +22803,7 @@ var InputSelect = (0, import_react90.forwardRef)(function InputSelect2({
22672
22803
  document.addEventListener("pointerdown", outside);
22673
22804
  return () => document.removeEventListener("pointerdown", outside);
22674
22805
  }, [open, onOpenChange]);
22675
- (0, import_react90.useEffect)(() => {
22806
+ (0, import_react91.useEffect)(() => {
22676
22807
  if (disabled || loading) {
22677
22808
  changeOpen(false);
22678
22809
  setModalOpen(false);
@@ -22805,7 +22936,7 @@ var InputSelect = (0, import_react90.forwardRef)(function InputSelect2({
22805
22936
  });
22806
22937
 
22807
22938
  // src/components/QueryForm.tsx
22808
- var import_react91 = require("react");
22939
+ var import_react92 = require("react");
22809
22940
  var import_jsx_runtime90 = require("react/jsx-runtime");
22810
22941
  function QueryForm({
22811
22942
  fields,
@@ -22839,29 +22970,29 @@ function QueryForm({
22839
22970
  ...formProps
22840
22971
  }) {
22841
22972
  const [form] = useForm(providedForm);
22842
- const [internalCollapsed, setInternalCollapsed] = (0, import_react91.useState)(defaultCollapsed);
22973
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react92.useState)(defaultCollapsed);
22843
22974
  const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
22844
- const [searching, setSearching] = (0, import_react91.useState)(false);
22845
- const [saving, setSaving] = (0, import_react91.useState)(false);
22846
- const [removing, setRemoving] = (0, import_react91.useState)(false);
22847
- const [saveOpen, setSaveOpen] = (0, import_react91.useState)(false);
22848
- const [saveName, setSaveName] = (0, import_react91.useState)("");
22849
- const [saveError, setSaveError] = (0, import_react91.useState)("");
22850
- const [error, setError] = (0, import_react91.useState)("");
22851
- const [activeShortcut, setActiveShortcut] = (0, import_react91.useState)("");
22852
- const source = (0, import_react91.useRef)({ source: "submit" });
22853
- const searchLock = (0, import_react91.useRef)(false);
22854
- const saveLock = (0, import_react91.useRef)(false);
22855
- const removeLock = (0, import_react91.useRef)(false);
22856
- const snapshot = (0, import_react91.useRef)();
22975
+ const [searching, setSearching] = (0, import_react92.useState)(false);
22976
+ const [saving, setSaving] = (0, import_react92.useState)(false);
22977
+ const [removing, setRemoving] = (0, import_react92.useState)(false);
22978
+ const [saveOpen, setSaveOpen] = (0, import_react92.useState)(false);
22979
+ const [saveName, setSaveName] = (0, import_react92.useState)("");
22980
+ const [saveError, setSaveError] = (0, import_react92.useState)("");
22981
+ const [error, setError] = (0, import_react92.useState)("");
22982
+ const [activeShortcut, setActiveShortcut] = (0, import_react92.useState)("");
22983
+ const source = (0, import_react92.useRef)({ source: "submit" });
22984
+ const searchLock = (0, import_react92.useRef)(false);
22985
+ const saveLock = (0, import_react92.useRef)(false);
22986
+ const removeLock = (0, import_react92.useRef)(false);
22987
+ const snapshot = (0, import_react92.useRef)();
22857
22988
  const busy = disabled || loading || searching;
22858
22989
  const shortcutBusy = busy || shortcutsLoading || saving || removing;
22859
- const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Form.Item, { noStyle: true, ...item }) })) : import_react91.Children.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
22990
+ const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Form.Item, { noStyle: true, ...item }) })) : import_react92.Children.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
22860
22991
  const limit = Math.max(1, Math.floor(collapsedCount));
22861
- const rowRef = (0, import_react91.useRef)(null);
22862
- const actionsRef = (0, import_react91.useRef)(null);
22863
- const [fittingCount, setFittingCount] = (0, import_react91.useState)(limit);
22864
- (0, import_react91.useLayoutEffect)(() => {
22992
+ const rowRef = (0, import_react92.useRef)(null);
22993
+ const actionsRef = (0, import_react92.useRef)(null);
22994
+ const [fittingCount, setFittingCount] = (0, import_react92.useState)(limit);
22995
+ (0, import_react92.useLayoutEffect)(() => {
22865
22996
  if (!collapsed) return;
22866
22997
  const row = rowRef.current;
22867
22998
  const actions = actionsRef.current;