@flytedan/flytebot-design-system 0.96.0 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2395,11 +2395,6 @@ function useClosingAnimation(open2, onClose, durationMs) {
2395
2395
  return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
2396
2396
  }
2397
2397
 
2398
- // src/kits/inertWhen.ts
2399
- function inertWhen(on) {
2400
- return on ? { inert: "" } : {};
2401
- }
2402
-
2403
2398
  // src/kits/useLastOpenValue.ts
2404
2399
  var React11 = __toESM(require("react"), 1);
2405
2400
  function useLastOpenValue(value, open2) {
@@ -2427,8 +2422,8 @@ function Drawer({ open: open2 = true, title: titleNow, label: labelNow, onClose,
2427
2422
  if (!rendered) return null;
2428
2423
  return (0, import_react_dom3.createPortal)(
2429
2424
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(StackedLayerProvider, { layer, children: [
2430
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2, ...inertWhen(closing) }),
2431
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("aside", { ref: asideRef, className: ["fd-drawer", bare ? "is-bare" : "", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": accessibleName, "aria-labelledby": bare || label ? void 0 : titleId, ...rest, style: { zIndex }, ...inertWhen(closing), children: [
2425
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2, inert: closing }),
2426
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("aside", { ref: asideRef, className: ["fd-drawer", bare ? "is-bare" : "", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": accessibleName, "aria-labelledby": bare || label ? void 0 : titleId, ...rest, style: { zIndex }, inert: closing, children: [
2432
2427
  bare ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fd-card-head", style: { flex: "none" }, children: [
2433
2428
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: titleId, className: "fd-card-head-title", title: truncationTitle(title), children: title }),
2434
2429
  onClose ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "fd-btn-icon", "aria-label": "Close", onClick: close2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { className: "ph ph-x" }) }) : null
@@ -2458,7 +2453,7 @@ function Modal({ open: open2 = true, title: titleNow, description: descriptionNo
2458
2453
  {
2459
2454
  className: "fd-scrim" + (closing ? " is-closing" : ""),
2460
2455
  style: { zIndex: zIndex - LAYER_STEP },
2461
- ...inertWhen(closing),
2456
+ inert: closing,
2462
2457
  onClick: onClose ? (e) => {
2463
2458
  if (e.target === e.currentTarget) close2();
2464
2459
  } : void 0,
@@ -3053,7 +3048,7 @@ function SkeletonText({ lines = 3, width = ["100%", "92%", "64%"], size = 15, ga
3053
3048
  var import_jsx_runtime23 = require("react/jsx-runtime");
3054
3049
  function ReservedSkeleton({ children, shape = "block", radius, className = "", ...rest }) {
3055
3050
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: ["fd-skel-reserve", className].filter(Boolean).join(" "), ...rest, children: [
3056
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fd-skel-reserve-content", "aria-hidden": "true", ...inertWhen(true), children }),
3051
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fd-skel-reserve-content", "aria-hidden": "true", inert: true, children }),
3057
3052
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Skeleton, { className: "fd-skel-reserve-cover", shape, radius, w: "auto", h: "auto" })
3058
3053
  ] });
3059
3054
  }
@@ -3074,12 +3069,11 @@ function Spinner({ size = "md", label = "Loading", className = "", style, ...res
3074
3069
  }
3075
3070
 
3076
3071
  // src/components/navigation/SidebarNav.tsx
3077
- var React21 = __toESM(require("react"), 1);
3078
3072
  var import_jsx_runtime25 = require("react/jsx-runtime");
3079
3073
  function Tip({ label, children }) {
3080
3074
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { title: label, style: { display: "inline-flex", flex: "none" }, children });
3081
3075
  }
3082
- var SidebarNav = React21.forwardRef(function SidebarNav2({ brand, groups = [], current: current2, onNavigate, footer, open: open2 = false, className = "", ...rest }, ref) {
3076
+ function SidebarNav({ brand, groups = [], current: current2, onNavigate, footer, open: open2 = false, className = "", ref, ...rest }) {
3083
3077
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3084
3078
  "nav",
3085
3079
  {
@@ -3115,18 +3109,18 @@ var SidebarNav = React21.forwardRef(function SidebarNav2({ brand, groups = [], c
3115
3109
  ]
3116
3110
  }
3117
3111
  );
3118
- });
3112
+ }
3119
3113
 
3120
3114
  // src/components/navigation/Topbar.tsx
3121
- var React23 = __toESM(require("react"), 1);
3115
+ var React22 = __toESM(require("react"), 1);
3122
3116
 
3123
3117
  // src/kits/useIsNarrow.ts
3124
- var React22 = __toESM(require("react"), 1);
3118
+ var React21 = __toESM(require("react"), 1);
3125
3119
  function useIsNarrow(breakpoint) {
3126
- const [narrow, setNarrow] = React22.useState(
3120
+ const [narrow, setNarrow] = React21.useState(
3127
3121
  () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
3128
3122
  );
3129
- React22.useEffect(() => {
3123
+ React21.useEffect(() => {
3130
3124
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
3131
3125
  const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);
3132
3126
  const apply = () => setNarrow(mq.matches);
@@ -3150,11 +3144,11 @@ function Topbar({
3150
3144
  ...rest
3151
3145
  }) {
3152
3146
  const narrow = useIsNarrow(overflowBreakpoint);
3153
- const [moreOpen, setMoreOpen] = React23.useState(false);
3154
- const moreRef = React23.useRef(null);
3147
+ const [moreOpen, setMoreOpen] = React22.useState(false);
3148
+ const moreRef = React22.useRef(null);
3155
3149
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("header", { className: ["fd-topbar", narrow ? "is-narrow" : "", className].filter(Boolean).join(" "), ...rest, children: [
3156
3150
  onMenu ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: "fd-btn-icon", "aria-label": "Menu", onClick: onMenu, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("i", { className: "ph ph-list" }) }) : null,
3157
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(React23.Fragment, { children: [
3151
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(React22.Fragment, { children: [
3158
3152
  i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("i", { className: "ph ph-caret-right", style: { fontSize: 11, opacity: 0.6 }, "aria-hidden": "true" }) : null,
3159
3153
  i === crumbs.length - 1 ? (
3160
3154
  // MP-141: the current crumb mixes a static route label with (usually) a
@@ -3207,7 +3201,7 @@ function Topbar({
3207
3201
  }
3208
3202
 
3209
3203
  // src/kits/useResponsiveRail.ts
3210
- var React24 = __toESM(require("react"), 1);
3204
+ var React23 = __toESM(require("react"), 1);
3211
3205
 
3212
3206
  // src/kits/overlayLayout.ts
3213
3207
  var OVERLAY_BREAKPOINT = 1024;
@@ -3218,26 +3212,26 @@ function useOverlayLayout() {
3218
3212
  // src/kits/useResponsiveRail.ts
3219
3213
  function useResponsiveRail(options = {}) {
3220
3214
  const { breakpoint = OVERLAY_BREAKPOINT, initialOpen = true, onPersist } = options;
3221
- const navRef = React24.useRef(null);
3215
+ const navRef = React23.useRef(null);
3222
3216
  const overlay = useIsNarrow(breakpoint);
3223
- const [open2, setOpenRaw] = React24.useState(() => overlay ? false : initialOpen);
3224
- const setOpen = React24.useCallback(
3217
+ const [open2, setOpenRaw] = React23.useState(() => overlay ? false : initialOpen);
3218
+ const setOpen = React23.useCallback(
3225
3219
  (value) => {
3226
3220
  setOpenRaw(value);
3227
3221
  if (!overlay) onPersist?.(value);
3228
3222
  },
3229
3223
  [overlay, onPersist]
3230
3224
  );
3231
- const toggle = React24.useCallback(() => setOpen(!open2), [open2, setOpen]);
3232
- const close2 = React24.useCallback(() => setOpenRaw(false), []);
3233
- const lastOverlay = React24.useRef(overlay);
3234
- React24.useEffect(() => {
3225
+ const toggle = React23.useCallback(() => setOpen(!open2), [open2, setOpen]);
3226
+ const close2 = React23.useCallback(() => setOpenRaw(false), []);
3227
+ const lastOverlay = React23.useRef(overlay);
3228
+ React23.useEffect(() => {
3235
3229
  if (lastOverlay.current === overlay) return;
3236
3230
  lastOverlay.current = overlay;
3237
3231
  setOpenRaw(!overlay);
3238
3232
  }, [overlay]);
3239
3233
  const layer = useStackedLayer({ active: overlay && open2, containerRef: navRef, trap: true, onEscape: close2 });
3240
- React24.useEffect(() => {
3234
+ React23.useEffect(() => {
3241
3235
  if (!overlay || !open2) return;
3242
3236
  const previousOverflow = document.body.style.overflow;
3243
3237
  document.body.style.overflow = "hidden";
@@ -3249,15 +3243,15 @@ function useResponsiveRail(options = {}) {
3249
3243
  }
3250
3244
 
3251
3245
  // src/components/navigation/DockedSidePanel.tsx
3252
- var React26 = __toESM(require("react"), 1);
3246
+ var React25 = __toESM(require("react"), 1);
3253
3247
 
3254
3248
  // src/kits/useResizableWidth.ts
3255
- var React25 = __toESM(require("react"), 1);
3249
+ var React24 = __toESM(require("react"), 1);
3256
3250
  function useResizableWidth({ width, defaultWidth, minWidth, maxWidth, onChange }) {
3257
- const clamp = React25.useCallback((w) => Math.max(minWidth, Math.min(maxWidth, w)), [minWidth, maxWidth]);
3258
- const [internal, setInternal] = React25.useState(defaultWidth);
3251
+ const clamp = React24.useCallback((w) => Math.max(minWidth, Math.min(maxWidth, w)), [minWidth, maxWidth]);
3252
+ const [internal, setInternal] = React24.useState(defaultWidth);
3259
3253
  const shown = clamp(width ?? internal);
3260
- const setWidth = React25.useCallback(
3254
+ const setWidth = React24.useCallback(
3261
3255
  (requested) => {
3262
3256
  const next = clamp(requested);
3263
3257
  if (next === shown) return;
@@ -3275,12 +3269,12 @@ var KEY_STEP = 24;
3275
3269
  function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }) {
3276
3270
  const { closing, rendered } = useClosingAnimation(open2, void 0, PANEL_EXIT_MS);
3277
3271
  const children = useLastOpenValue(childrenNow, open2);
3278
- const [animateEnter, setAnimateEnter] = React26.useState(!open2);
3272
+ const [animateEnter, setAnimateEnter] = React25.useState(!open2);
3279
3273
  if (!open2 && !animateEnter) setAnimateEnter(true);
3280
3274
  const { width, setWidth } = useResizableWidth(widthOptions);
3281
- const drag = React26.useRef(null);
3282
- const [resizing, setResizing] = React26.useState(false);
3283
- const boxRef = React26.useRef(null);
3275
+ const drag = React25.useRef(null);
3276
+ const [resizing, setResizing] = React25.useState(false);
3277
+ const boxRef = React25.useRef(null);
3284
3278
  usePublishCornerStackOffset(boxRef, rendered);
3285
3279
  if (!rendered) return null;
3286
3280
  const onPointerDown = (e) => {
@@ -3309,7 +3303,7 @@ function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }
3309
3303
  className: ["fd-sidepanel", animateEnter ? "is-entering" : "", closing ? "is-closing" : "", resizing ? "is-resizing" : ""].filter(Boolean).join(" "),
3310
3304
  "data-open": open2 ? "true" : "false",
3311
3305
  style: { width },
3312
- ...inertWhen(!open2),
3306
+ inert: !open2,
3313
3307
  children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fd-sidepanel-inner", style: { width }, children: [
3314
3308
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3315
3309
  "div",
@@ -3471,20 +3465,20 @@ function installFlytedeskFavicon(url) {
3471
3465
  }
3472
3466
 
3473
3467
  // src/components/navigation/Tabs.tsx
3474
- var React27 = __toESM(require("react"), 1);
3468
+ var React26 = __toESM(require("react"), 1);
3475
3469
  var import_jsx_runtime30 = require("react/jsx-runtime");
3476
3470
  var FADE_WIDTH = 32;
3477
3471
  function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
3478
- const strip = React27.useRef(null);
3479
- const [more, setMore] = React27.useState({ start: false, end: false });
3480
- const measure = React27.useCallback(() => {
3472
+ const strip = React26.useRef(null);
3473
+ const [more, setMore] = React26.useState({ start: false, end: false });
3474
+ const measure = React26.useCallback(() => {
3481
3475
  const el = strip.current;
3482
3476
  if (!el) return;
3483
3477
  const start = el.scrollLeft > 1;
3484
3478
  const end = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
3485
3479
  setMore((m) => m.start === start && m.end === end ? m : { start, end });
3486
3480
  }, []);
3487
- React27.useLayoutEffect(() => {
3481
+ React26.useLayoutEffect(() => {
3488
3482
  const el = strip.current;
3489
3483
  measure();
3490
3484
  if (!el || typeof ResizeObserver === "undefined") return;
@@ -3492,7 +3486,7 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
3492
3486
  observer.observe(el);
3493
3487
  return () => observer.disconnect();
3494
3488
  }, [measure, tabs]);
3495
- const revealActive = React27.useCallback(() => {
3489
+ const revealActive = React26.useCallback(() => {
3496
3490
  const el = strip.current;
3497
3491
  const active = el?.querySelector('[aria-selected="true"]');
3498
3492
  if (!el || !active || el.scrollWidth <= el.clientWidth) return;
@@ -3502,9 +3496,9 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
3502
3496
  else if (tab.right > box.right - FADE_WIDTH) el.scrollLeft += tab.right - box.right + FADE_WIDTH;
3503
3497
  measure();
3504
3498
  }, [measure]);
3505
- React27.useLayoutEffect(revealActive, [value, revealActive]);
3499
+ React26.useLayoutEffect(revealActive, [value, revealActive]);
3506
3500
  const tabKeys = tabs.map((t) => typeof t === "string" ? t : t.value).join(",");
3507
- React27.useLayoutEffect(() => {
3501
+ React26.useLayoutEffect(() => {
3508
3502
  const el = strip.current;
3509
3503
  if (!el || typeof ResizeObserver === "undefined") return;
3510
3504
  const observer = new ResizeObserver(revealActive);
@@ -3793,15 +3787,15 @@ function Toast({ title, children, tone = "success", onUndo, onDismiss, className
3793
3787
  }
3794
3788
 
3795
3789
  // src/components/feedback/ToastProvider.tsx
3796
- var React28 = __toESM(require("react"), 1);
3790
+ var React27 = __toESM(require("react"), 1);
3797
3791
  var import_jsx_runtime40 = require("react/jsx-runtime");
3798
3792
  var DEFAULT_TOAST_DURATION_MS = 5e3;
3799
- var ToastContext = React28.createContext(null);
3793
+ var ToastContext = React27.createContext(null);
3800
3794
  function ToastProvider({ children }) {
3801
- const [items, setItems] = React28.useState([]);
3802
- const timers = React28.useRef(/* @__PURE__ */ new Map());
3803
- const nextId = React28.useRef(1);
3804
- const dismiss = React28.useCallback((id) => {
3795
+ const [items, setItems] = React27.useState([]);
3796
+ const timers = React27.useRef(/* @__PURE__ */ new Map());
3797
+ const nextId = React27.useRef(1);
3798
+ const dismiss = React27.useCallback((id) => {
3805
3799
  setItems((current2) => current2.filter((item2) => item2.id !== id));
3806
3800
  const timer = timers.current.get(id);
3807
3801
  if (timer !== void 0) {
@@ -3809,7 +3803,7 @@ function ToastProvider({ children }) {
3809
3803
  timers.current.delete(id);
3810
3804
  }
3811
3805
  }, []);
3812
- const show = React28.useCallback(
3806
+ const show = React27.useCallback(
3813
3807
  (title, options = {}) => {
3814
3808
  const { tone = "success", duration = DEFAULT_TOAST_DURATION_MS } = options;
3815
3809
  const id = nextId.current++;
@@ -3818,36 +3812,36 @@ function ToastProvider({ children }) {
3818
3812
  },
3819
3813
  [dismiss]
3820
3814
  );
3821
- React28.useEffect(() => {
3815
+ React27.useEffect(() => {
3822
3816
  const pending = timers.current;
3823
3817
  return () => {
3824
3818
  pending.forEach(clearTimeout);
3825
3819
  pending.clear();
3826
3820
  };
3827
3821
  }, []);
3828
- const api = React28.useMemo(() => ({ show }), [show]);
3822
+ const api = React27.useMemo(() => ({ show }), [show]);
3829
3823
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(ToastContext.Provider, { value: api, children: [
3830
3824
  children,
3831
3825
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Toast, { title: item2.title, tone: item2.tone, onDismiss: () => dismiss(item2.id) }, item2.id)) }) })
3832
3826
  ] });
3833
3827
  }
3834
3828
  function useToast() {
3835
- const api = React28.useContext(ToastContext);
3829
+ const api = React27.useContext(ToastContext);
3836
3830
  if (!api) throw new Error("useToast must be used inside a <ToastProvider>");
3837
3831
  return api;
3838
3832
  }
3839
3833
 
3840
3834
  // src/components/data/AnimNum.tsx
3841
- var React29 = __toESM(require("react"), 1);
3835
+ var React28 = __toESM(require("react"), 1);
3842
3836
  var import_jsx_runtime41 = require("react/jsx-runtime");
3843
3837
  function shouldSkipEasing() {
3844
3838
  if (typeof document !== "undefined" && document.hidden) return true;
3845
3839
  return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
3846
3840
  }
3847
3841
  function AnimNum({ value, format, duration = 550 }) {
3848
- const [display, setDisplay] = React29.useState(value);
3849
- const prev = React29.useRef(value);
3850
- React29.useEffect(() => {
3842
+ const [display, setDisplay] = React28.useState(value);
3843
+ const prev = React28.useRef(value);
3844
+ React28.useEffect(() => {
3851
3845
  const from = prev.current;
3852
3846
  const to = value;
3853
3847
  prev.current = to;
@@ -3875,14 +3869,14 @@ function AnimNum({ value, format, duration = 550 }) {
3875
3869
  }
3876
3870
 
3877
3871
  // src/components/data/TrendChart.tsx
3878
- var React32 = __toESM(require("react"), 1);
3872
+ var React31 = __toESM(require("react"), 1);
3879
3873
 
3880
3874
  // src/components/useMeasuredWidth.ts
3881
- var React30 = __toESM(require("react"), 1);
3875
+ var React29 = __toESM(require("react"), 1);
3882
3876
  function useMeasuredWidth(fallback) {
3883
- const [element, setElement] = React30.useState(null);
3884
- const [width, setWidth] = React30.useState(fallback);
3885
- React30.useLayoutEffect(() => {
3877
+ const [element, setElement] = React29.useState(null);
3878
+ const [width, setWidth] = React29.useState(fallback);
3879
+ React29.useLayoutEffect(() => {
3886
3880
  if (!element || typeof ResizeObserver === "undefined") return;
3887
3881
  const measure = () => {
3888
3882
  const measured = Math.round(element.getBoundingClientRect().width);
@@ -3897,7 +3891,7 @@ function useMeasuredWidth(fallback) {
3897
3891
  }
3898
3892
 
3899
3893
  // src/components/data/SegmentedMeter.tsx
3900
- var React31 = __toESM(require("react"), 1);
3894
+ var React30 = __toESM(require("react"), 1);
3901
3895
 
3902
3896
  // src/kits/files.ts
3903
3897
  function formatBytes(n) {
@@ -4110,7 +4104,7 @@ function SegmentedMeter({
4110
4104
  const pct = safeTotal ? Math.min(100, Math.round(used / safeTotal * 100)) : 0;
4111
4105
  const w = (v) => safeTotal ? Math.max(0, Math.min(100, Number(v) / safeTotal * 100)) : 0;
4112
4106
  const fill = (s, i) => s.color || (s.variant ? VARIANT_FILL[s.variant] : void 0) || CHART[i % CHART.length];
4113
- const generatedId = React31.useId();
4107
+ const generatedId = React30.useId();
4114
4108
  const uid2 = id || generatedId;
4115
4109
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: ["fd-segmeter", className].filter(Boolean).join(" "), onClick, children: [
4116
4110
  label || showTotal ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "fd-segmeter-head", children: [
@@ -4263,8 +4257,8 @@ function TrendChart({
4263
4257
  onRetry,
4264
4258
  className = ""
4265
4259
  }) {
4266
- const [activeId, setActiveId] = React32.useState(null);
4267
- const [pointTip, setPointTip] = React32.useState(null);
4260
+ const [activeId, setActiveId] = React31.useState(null);
4261
+ const [pointTip, setPointTip] = React31.useState(null);
4268
4262
  const isEmpty = state === "ready" && (!categories.length || !series.length || series.every((s) => !s.values.length));
4269
4263
  const effectiveState = isEmpty ? "empty" : state;
4270
4264
  const [plotRef, VBW] = useMeasuredWidth(INITIAL_WIDTH);
@@ -4378,7 +4372,7 @@ function TrendChart({
4378
4372
  }
4379
4373
 
4380
4374
  // src/components/data/DonutChart.tsx
4381
- var React33 = __toESM(require("react"), 1);
4375
+ var React32 = __toESM(require("react"), 1);
4382
4376
  var import_jsx_runtime45 = require("react/jsx-runtime");
4383
4377
  var QUIET_FILL = "var(--n-300)";
4384
4378
  function segmentColor(index, seg) {
@@ -4397,8 +4391,8 @@ function DonutChart({
4397
4391
  onRetry,
4398
4392
  className = ""
4399
4393
  }) {
4400
- const [activeId, setActiveId] = React33.useState(null);
4401
- const ringRef = React33.useRef(null);
4394
+ const [activeId, setActiveId] = React32.useState(null);
4395
+ const ringRef = React32.useRef(null);
4402
4396
  const items = segments.filter((s) => Number(s.value) > 0);
4403
4397
  const total = items.reduce((n, s) => n + Number(s.value), 0);
4404
4398
  const isEmpty = state === "ready" && (!items.length || total <= 0);
@@ -4420,7 +4414,7 @@ function DonutChart({
4420
4414
  const centerSmall = centerSubLabel != null ? centerSubLabel : dominant ? dominant.label : void 0;
4421
4415
  const active = arcs.find((a) => a.seg.id === activeId) || null;
4422
4416
  const layer = useStackedLayer({ active: activeId != null, containerRef: ringRef, onEscape: () => setActiveId(null), returnFocus: false });
4423
- React33.useEffect(() => {
4417
+ React32.useEffect(() => {
4424
4418
  if (!activeId) return;
4425
4419
  const onDown = (e) => {
4426
4420
  const t = e.target;
@@ -4529,7 +4523,7 @@ function DonutChart({
4529
4523
  }
4530
4524
 
4531
4525
  // src/components/data/BarList.tsx
4532
- var React34 = __toESM(require("react"), 1);
4526
+ var React33 = __toESM(require("react"), 1);
4533
4527
  var import_jsx_runtime46 = require("react/jsx-runtime");
4534
4528
  var wholePercent = (share) => formatPercent(Math.round(share * 100));
4535
4529
  function BarList({
@@ -4546,7 +4540,7 @@ function BarList({
4546
4540
  onRetry,
4547
4541
  className = ""
4548
4542
  }) {
4549
- const ordered = React34.useMemo(() => {
4543
+ const ordered = React33.useMemo(() => {
4550
4544
  const list = sort ? [...rows].sort((a, b) => Number(b.value) - Number(a.value)) : rows;
4551
4545
  return maxRows ? list.slice(0, maxRows) : list;
4552
4546
  }, [rows, sort, maxRows]);
@@ -4688,7 +4682,7 @@ function FunnelChart({
4688
4682
  }
4689
4683
 
4690
4684
  // src/components/data/Clamp.tsx
4691
- var React35 = __toESM(require("react"), 1);
4685
+ var React34 = __toESM(require("react"), 1);
4692
4686
  var import_jsx_runtime48 = require("react/jsx-runtime");
4693
4687
  function Clamp({
4694
4688
  children,
@@ -4700,16 +4694,16 @@ function Clamp({
4700
4694
  onToggle,
4701
4695
  className = ""
4702
4696
  }) {
4703
- const [open2, setOpen] = React35.useState(false);
4704
- const [overflows, setOverflows] = React35.useState(false);
4705
- const bodyRef = React35.useRef(null);
4706
- const charClamped = React35.useMemo(() => {
4697
+ const [open2, setOpen] = React34.useState(false);
4698
+ const [overflows, setOverflows] = React34.useState(false);
4699
+ const bodyRef = React34.useRef(null);
4700
+ const charClamped = React34.useMemo(() => {
4707
4701
  if (open2 || !maxChars || typeof text !== "string" || text.length <= maxChars) return null;
4708
4702
  const cut = text.slice(0, maxChars);
4709
4703
  const at = cut.lastIndexOf(" ");
4710
4704
  return (at > maxChars * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
4711
4705
  }, [text, maxChars, open2]);
4712
- React35.useLayoutEffect(() => {
4706
+ React34.useLayoutEffect(() => {
4713
4707
  const node = bodyRef.current;
4714
4708
  if (maxChars || !node || !maxHeight) return;
4715
4709
  const measure = () => {
@@ -4971,16 +4965,16 @@ function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort
4971
4965
  }
4972
4966
 
4973
4967
  // src/components/data/FilterBar.tsx
4974
- var React41 = __toESM(require("react"), 1);
4968
+ var React40 = __toESM(require("react"), 1);
4975
4969
 
4976
4970
  // src/components/forms/NumberInput.tsx
4977
- var React38 = __toESM(require("react"), 1);
4971
+ var React37 = __toESM(require("react"), 1);
4978
4972
 
4979
4973
  // src/components/forms/field.tsx
4980
- var React36 = __toESM(require("react"), 1);
4974
+ var React35 = __toESM(require("react"), 1);
4981
4975
  var import_jsx_runtime51 = require("react/jsx-runtime");
4982
4976
  function useFieldId(id) {
4983
- const generated = React36.useId();
4977
+ const generated = React35.useId();
4984
4978
  return id || generated;
4985
4979
  }
4986
4980
  function FieldLabel({ htmlFor, id, required = false, onClick, children }) {
@@ -4999,10 +4993,10 @@ function HiddenFieldLabel({ id, children }) {
4999
4993
  }
5000
4994
 
5001
4995
  // src/components/useLatest.ts
5002
- var React37 = __toESM(require("react"), 1);
4996
+ var React36 = __toESM(require("react"), 1);
5003
4997
  function useLatest(value) {
5004
- const ref = React37.useRef(value);
5005
- React37.useInsertionEffect(() => {
4998
+ const ref = React36.useRef(value);
4999
+ React36.useInsertionEffect(() => {
5006
5000
  ref.current = value;
5007
5001
  });
5008
5002
  return ref;
@@ -5085,20 +5079,20 @@ function NumberInput({
5085
5079
  const n = typeof v === "number" ? v : parseNumberText(v);
5086
5080
  return n == null || Number.isNaN(n) ? null : n;
5087
5081
  };
5088
- const [text, setText] = React38.useState(() => toText(value));
5089
- const [editing, setEditing] = React38.useState(false);
5082
+ const [text, setText] = React37.useState(() => toText(value));
5083
+ const [editing, setEditing] = React37.useState(false);
5090
5084
  const parsed = parseNumberText(text);
5091
5085
  const invalidMessage = parsed == null ? null : Number.isNaN(parsed) ? "Enter a number" : integer && !Number.isInteger(parsed) ? "Enter a whole number" : parsed < lo ? "Must be \u2265 " + lo : parsed > hi ? "Must be \u2264 " + hi : null;
5092
5086
  const valid = invalidMessage == null;
5093
- const committedRef = React38.useRef(toNumber(value));
5087
+ const committedRef = React37.useRef(toNumber(value));
5094
5088
  const onChangeRef = useLatest(onChange);
5095
5089
  const onValidityChangeRef = useLatest(onValidityChange);
5096
- const focusedRef = React38.useRef(false);
5097
- React38.useEffect(() => {
5090
+ const focusedRef = React37.useRef(false);
5091
+ React37.useEffect(() => {
5098
5092
  committedRef.current = toNumber(value);
5099
5093
  if (!focusedRef.current) setText(toText(value));
5100
5094
  }, [value]);
5101
- React38.useLayoutEffect(() => {
5095
+ React37.useLayoutEffect(() => {
5102
5096
  onValidityChangeRef.current?.(valid);
5103
5097
  }, [valid, onValidityChangeRef]);
5104
5098
  const fire = (n) => {
@@ -5114,7 +5108,7 @@ function NumberInput({
5114
5108
  return true;
5115
5109
  };
5116
5110
  const bumpRef = useLatest(bump);
5117
- const holdTimer = React38.useRef(null);
5111
+ const holdTimer = React37.useRef(null);
5118
5112
  const release2 = () => {
5119
5113
  if (holdTimer.current) clearTimeout(holdTimer.current);
5120
5114
  holdTimer.current = null;
@@ -5133,7 +5127,7 @@ function NumberInput({
5133
5127
  };
5134
5128
  holdTimer.current = setTimeout(tick, HOLD_DELAY_MS);
5135
5129
  };
5136
- React38.useEffect(() => () => {
5130
+ React37.useEffect(() => () => {
5137
5131
  if (holdTimer.current) clearTimeout(holdTimer.current);
5138
5132
  }, []);
5139
5133
  const current2 = committedRef.current;
@@ -5236,7 +5230,7 @@ function NumberInput({
5236
5230
  }
5237
5231
 
5238
5232
  // src/components/forms/DatePicker.tsx
5239
- var React39 = __toESM(require("react"), 1);
5233
+ var React38 = __toESM(require("react"), 1);
5240
5234
  var import_jsx_runtime53 = require("react/jsx-runtime");
5241
5235
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
5242
5236
  var DOW = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
@@ -5269,10 +5263,10 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
5269
5263
  const today = /* @__PURE__ */ new Date();
5270
5264
  const sel = range ? value || {} : { start: value, end: value };
5271
5265
  const anchor = parse(sel.start) || parse(initialMonth) || today;
5272
- const [vy, setVy] = React39.useState(anchor.getFullYear());
5273
- const [vm, setVm] = React39.useState(anchor.getMonth());
5274
- const [mode2, setMode] = React39.useState("days");
5275
- const [hover, setHover] = React39.useState(null);
5266
+ const [vy, setVy] = React38.useState(anchor.getFullYear());
5267
+ const [vm, setVm] = React38.useState(anchor.getMonth());
5268
+ const [mode2, setMode] = React38.useState("days");
5269
+ const [hover, setHover] = React38.useState(null);
5276
5270
  const s = parse(sel.start), e = parse(sel.end);
5277
5271
  const hoverEnd = range && s && !e && hover ? parse(hover) : null;
5278
5272
  const inRange = (d) => {
@@ -5283,12 +5277,12 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
5283
5277
  const isEnd = (d) => !!e && iso(d) === iso(e);
5284
5278
  const isEdge = (d) => isStart(d) || isEnd(d);
5285
5279
  const nextY = vm === 11 ? vy + 1 : vy, nextM = (vm + 1) % 12;
5286
- const [activeDate, setActiveDate] = React39.useState(() => {
5280
+ const [activeDate, setActiveDate] = React38.useState(() => {
5287
5281
  if (s) return s;
5288
5282
  if (sameMonth(today, anchor.getFullYear(), anchor.getMonth())) return today;
5289
5283
  return new Date(anchor.getFullYear(), anchor.getMonth(), 1);
5290
5284
  });
5291
- const calRef = React39.useRef(null);
5285
+ const calRef = React38.useRef(null);
5292
5286
  const pageToShow = (y, m) => {
5293
5287
  const idx = y * 12 + m, firstIdx = vy * 12 + vm, secondIdx = firstIdx + 1;
5294
5288
  if (idx === firstIdx || months > 1 && idx === secondIdx) return;
@@ -5305,7 +5299,7 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
5305
5299
  setActiveDate(next);
5306
5300
  pageToShow(next.getFullYear(), next.getMonth());
5307
5301
  };
5308
- React39.useEffect(() => {
5302
+ React38.useEffect(() => {
5309
5303
  const el = calRef.current?.querySelector('[data-iso="' + iso(activeDate) + '"]');
5310
5304
  if (el) el.focus({ preventScroll: true });
5311
5305
  }, [activeDate, vy, vm]);
@@ -5498,9 +5492,9 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
5498
5492
  }
5499
5493
  function DatePicker({ label, help, error, required = false, disabled = false, range = false, value, onChange, placeholder, id, className = "", style, "aria-label": hiddenLabel, ...rest }) {
5500
5494
  const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
5501
- const [open2, setOpen] = React39.useState(false);
5502
- const rootRef = React39.useRef(null);
5503
- const boxRef = React39.useRef(null);
5495
+ const [open2, setOpen] = React38.useState(false);
5496
+ const rootRef = React38.useRef(null);
5497
+ const boxRef = React38.useRef(null);
5504
5498
  const display = range ? value && value.start ? fmt(value.start) + (value.end ? " \u2192 " + fmt(value.end) : " \u2192 \u2026") : "" : fmt(value);
5505
5499
  const toggle = () => {
5506
5500
  if (!disabled) setOpen(!open2);
@@ -5589,9 +5583,9 @@ function Textarea({ label, help, error, required = false, rows = 4, disabled = f
5589
5583
  }
5590
5584
 
5591
5585
  // src/components/forms/listbox.ts
5592
- var React40 = __toESM(require("react"), 1);
5586
+ var React39 = __toESM(require("react"), 1);
5593
5587
  function useListboxNav({ count, onSelect }) {
5594
- const [active, setActive] = React40.useState(-1);
5588
+ const [active, setActive] = React39.useState(-1);
5595
5589
  return {
5596
5590
  active,
5597
5591
  setActive,
@@ -5604,7 +5598,7 @@ function useListboxNav({ count, onSelect }) {
5604
5598
  };
5605
5599
  }
5606
5600
  function useListboxScrollIntoView(active, listRef, enabled) {
5607
- React40.useEffect(() => {
5601
+ React39.useEffect(() => {
5608
5602
  if (!enabled || active < 0 || !listRef.current) return;
5609
5603
  const list = listRef.current;
5610
5604
  const el = list.querySelector('[data-i="' + active + '"]');
@@ -5835,13 +5829,13 @@ function MultiSelectPanel({
5835
5829
  onClose
5836
5830
  }) {
5837
5831
  const allowedOps = operatorsFor(field);
5838
- const [draftOperator, setDraftOperator] = React41.useState(value?.operator ?? allowedOps[0]);
5832
+ const [draftOperator, setDraftOperator] = React40.useState(value?.operator ?? allowedOps[0]);
5839
5833
  const operator = allowedOps.length === 1 ? allowedOps[0] : value?.operator ?? draftOperator;
5840
5834
  const selected = value?.values ?? [];
5841
5835
  const selectedRef = useLatest(selected);
5842
5836
  const operatorRef = useLatest(operator);
5843
- const mountedRef = React41.useRef(true);
5844
- React41.useEffect(() => {
5837
+ const mountedRef = React40.useRef(true);
5838
+ React40.useEffect(() => {
5845
5839
  mountedRef.current = true;
5846
5840
  return () => {
5847
5841
  mountedRef.current = false;
@@ -5855,20 +5849,20 @@ function MultiSelectPanel({
5855
5849
  if (selectedRef.current.length > 0) commit(selectedRef.current, op);
5856
5850
  else setDraftOperator(op);
5857
5851
  };
5858
- const [mode2, setMode] = React41.useState("search");
5859
- const [query, setQuery] = React41.useState("");
5860
- const [asyncState, setAsyncState] = React41.useState(
5852
+ const [mode2, setMode] = React40.useState("search");
5853
+ const [query, setQuery] = React40.useState("");
5854
+ const [asyncState, setAsyncState] = React40.useState(
5861
5855
  { options: null, loading: !!field.loadOptions, error: false }
5862
5856
  );
5863
- const [retryTick, setRetryTick] = React41.useState(0);
5864
- const inputRef = React41.useRef(null);
5865
- const listRef = React41.useRef(null);
5866
- const listId = React41.useId();
5857
+ const [retryTick, setRetryTick] = React40.useState(0);
5858
+ const inputRef = React40.useRef(null);
5859
+ const listRef = React40.useRef(null);
5860
+ const listId = React40.useId();
5867
5861
  const loadOptionsRef = useLatest(field.loadOptions);
5868
- React41.useEffect(() => {
5862
+ React40.useEffect(() => {
5869
5863
  inputRef.current?.focus();
5870
5864
  }, []);
5871
- React41.useEffect(() => {
5865
+ React40.useEffect(() => {
5872
5866
  const load = loadOptionsRef.current;
5873
5867
  if (!load) return;
5874
5868
  const controller = new AbortController();
@@ -5888,12 +5882,12 @@ function MultiSelectPanel({
5888
5882
  };
5889
5883
  }, [query, retryTick, loadOptionsRef]);
5890
5884
  const options = field.loadOptions ? asyncState.options ?? [] : (field.options ?? []).filter((o) => o.label.toLowerCase().includes(query.toLowerCase()));
5891
- const [panelWidth, setPanelWidth] = React41.useState(PANEL_WIDTH.multiSelect);
5885
+ const [panelWidth, setPanelWidth] = React40.useState(PANEL_WIDTH.multiSelect);
5892
5886
  const optionsRef = useLatest(options);
5893
5887
  const labelsKey = options.map((o) => o.label).join("\0");
5894
- const toggleRowRef = React41.useRef(null);
5895
- const toggleObserver = React41.useRef(null);
5896
- const fitToggles = React41.useCallback(() => {
5888
+ const toggleRowRef = React40.useRef(null);
5889
+ const toggleObserver = React40.useRef(null);
5890
+ const fitToggles = React40.useCallback(() => {
5897
5891
  const row = toggleRowRef.current;
5898
5892
  const surface = row?.closest("[role=dialog]");
5899
5893
  if (!row || !surface) return;
@@ -5904,7 +5898,7 @@ function MultiSelectPanel({
5904
5898
  const wanted = Math.ceil(natural + used(surface) - used(row));
5905
5899
  setPanelWidth((w) => Math.max(w, wanted));
5906
5900
  }, []);
5907
- const attachToggleRow = React41.useCallback((row) => {
5901
+ const attachToggleRow = React40.useCallback((row) => {
5908
5902
  toggleObserver.current?.disconnect();
5909
5903
  toggleObserver.current = null;
5910
5904
  toggleRowRef.current = row;
@@ -5914,7 +5908,7 @@ function MultiSelectPanel({
5914
5908
  toggleObserver.current = new ResizeObserver(fitToggles);
5915
5909
  for (const toggle2 of Array.from(row.children)) toggleObserver.current.observe(toggle2);
5916
5910
  }, [fitToggles]);
5917
- React41.useLayoutEffect(() => {
5911
+ React40.useLayoutEffect(() => {
5918
5912
  const measure = () => {
5919
5913
  const label = document.getElementById(listId)?.querySelector(".fd-opt-label");
5920
5914
  if (!label) return;
@@ -5944,17 +5938,17 @@ function MultiSelectPanel({
5944
5938
  };
5945
5939
  const nav = useListboxNav({ count: options.length, onSelect: (i) => toggle(options[i]) });
5946
5940
  useListboxScrollIntoView(nav.active, listRef, hasListbox);
5947
- React41.useEffect(() => {
5941
+ React40.useEffect(() => {
5948
5942
  nav.setActive(0);
5949
5943
  }, [query, options.length]);
5950
5944
  const activeId = hasListbox && options[nav.active] ? listId + "-opt-" + nav.active : void 0;
5951
5945
  const liveMessage = showLoading ? "Loading\u2026" : showError ? "Couldn't load options." : options.length === 0 ? query === "" && field.emptyText || "No matches" : atLimit ? "Limit reached: at most " + field.maxValues + " values" : "";
5952
- const [pasteText, setPasteText] = React41.useState("");
5953
- const [pasteLoading, setPasteLoading] = React41.useState(false);
5954
- const [unmatchedTokens, setUnmatchedTokens] = React41.useState([]);
5955
- const [pasteError, setPasteError] = React41.useState(null);
5956
- const pasteWrapRef = React41.useRef(null);
5957
- React41.useEffect(() => {
5946
+ const [pasteText, setPasteText] = React40.useState("");
5947
+ const [pasteLoading, setPasteLoading] = React40.useState(false);
5948
+ const [unmatchedTokens, setUnmatchedTokens] = React40.useState([]);
5949
+ const [pasteError, setPasteError] = React40.useState(null);
5950
+ const pasteWrapRef = React40.useRef(null);
5951
+ React40.useEffect(() => {
5958
5952
  if (mode2 === "paste") pasteWrapRef.current?.querySelector("textarea")?.focus();
5959
5953
  }, [mode2]);
5960
5954
  const doResolve = () => {
@@ -6130,8 +6124,8 @@ function MultiSelectPanel({
6130
6124
  );
6131
6125
  }
6132
6126
  function useTextValidity(onFlip) {
6133
- const invalidRef = React41.useRef(/* @__PURE__ */ new Set());
6134
- const [, rerender] = React41.useReducer((n) => n + 1, 0);
6127
+ const invalidRef = React40.useRef(/* @__PURE__ */ new Set());
6128
+ const [, rerender] = React40.useReducer((n) => n + 1, 0);
6135
6129
  const onFlipRef = useLatest(onFlip);
6136
6130
  const record = (name, valid) => {
6137
6131
  const invalid = invalidRef.current;
@@ -6174,15 +6168,15 @@ function sameValue(a, b) {
6174
6168
  return true;
6175
6169
  }
6176
6170
  function useReseedFromProps(value, applies, reseed) {
6177
- const seen = React41.useRef(value);
6178
- React41.useLayoutEffect(() => {
6171
+ const seen = React40.useRef(value);
6172
+ React40.useLayoutEffect(() => {
6179
6173
  if (seen.current === value) return;
6180
6174
  seen.current = value;
6181
6175
  if (!sameValue(value, applies())) reseed(value);
6182
6176
  }, [value, applies, reseed]);
6183
6177
  }
6184
6178
  function usePreserveFocusAcrossRemount(seed, fields) {
6185
- const pendingName = React41.useRef(null);
6179
+ const pendingName = React40.useRef(null);
6186
6180
  const fieldsRef = useLatest(fields);
6187
6181
  const capture = () => {
6188
6182
  const active = document.activeElement;
@@ -6195,7 +6189,7 @@ function usePreserveFocusAcrossRemount(seed, fields) {
6195
6189
  }
6196
6190
  }
6197
6191
  };
6198
- React41.useLayoutEffect(() => {
6192
+ React40.useLayoutEffect(() => {
6199
6193
  const name = pendingName.current;
6200
6194
  if (!name) return;
6201
6195
  pendingName.current = null;
@@ -6211,14 +6205,14 @@ function RangePanel({
6211
6205
  onCommit,
6212
6206
  onClose
6213
6207
  }) {
6214
- const [draft, setDraft] = React41.useState(() => rangeDraft(value));
6215
- const [seed, setSeed] = React41.useState(0);
6216
- const minId = React41.useId();
6217
- const maxId = React41.useId();
6218
- const minWrapRef = React41.useRef(null);
6219
- const maxWrapRef = React41.useRef(null);
6208
+ const [draft, setDraft] = React40.useState(() => rangeDraft(value));
6209
+ const [seed, setSeed] = React40.useState(0);
6210
+ const minId = React40.useId();
6211
+ const maxId = React40.useId();
6212
+ const minWrapRef = React40.useRef(null);
6213
+ const maxWrapRef = React40.useRef(null);
6220
6214
  const preserveFocus = usePreserveFocusAcrossRemount(seed, { min: minWrapRef, max: maxWrapRef });
6221
- const draftRef = React41.useRef(draft);
6215
+ const draftRef = React40.useRef(draft);
6222
6216
  const shown = () => {
6223
6217
  const { min, max } = draftRef.current;
6224
6218
  return applicable(field, min == null && max == null ? void 0 : { min, max }, validity.allValid());
@@ -6310,15 +6304,15 @@ function DatePanel({
6310
6304
  onClose
6311
6305
  }) {
6312
6306
  const maxDays = effectiveMaxDays(field);
6313
- const [initial] = React41.useState(() => dateDraft(field, value));
6314
- const [kind, setKind] = React41.useState(initial.kind);
6315
- const [daysDraft, setDaysDraft] = React41.useState(initial.days);
6316
- const daysRef = React41.useRef(daysDraft);
6317
- const daysConfirmed = React41.useRef(value?.kind === "withinDays");
6318
- const [between, setBetween] = React41.useState(initial.between);
6319
- const [seed, setSeed] = React41.useState(0);
6320
- const daysId = React41.useId();
6321
- const daysWrapRef = React41.useRef(null);
6307
+ const [initial] = React40.useState(() => dateDraft(field, value));
6308
+ const [kind, setKind] = React40.useState(initial.kind);
6309
+ const [daysDraft, setDaysDraft] = React40.useState(initial.days);
6310
+ const daysRef = React40.useRef(daysDraft);
6311
+ const daysConfirmed = React40.useRef(value?.kind === "withinDays");
6312
+ const [between, setBetween] = React40.useState(initial.between);
6313
+ const [seed, setSeed] = React40.useState(0);
6314
+ const daysId = React40.useId();
6315
+ const daysWrapRef = React40.useRef(null);
6322
6316
  const preserveFocus = usePreserveFocusAcrossRemount(seed, { days: daysWrapRef });
6323
6317
  const shownWithinDays = () => {
6324
6318
  const days = daysRef.current;
@@ -6450,11 +6444,11 @@ function FieldHelpButton({ field, onFieldHelp }) {
6450
6444
  ) });
6451
6445
  }
6452
6446
  function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, onFieldHelp, align = "left", actions, onClearAll, showActiveCount = false, loading = false, loadingLabel = "Loading the filters", className = "", ...rest }) {
6453
- const [panel, setPanel] = React41.useState(null);
6454
- const editAnchorRef = React41.useRef(null);
6455
- const addAnchorRef = React41.useRef(null);
6456
- const textInputRef = React41.useRef(null);
6457
- const optionsRef = React41.useRef(null);
6447
+ const [panel, setPanel] = React40.useState(null);
6448
+ const editAnchorRef = React40.useRef(null);
6449
+ const addAnchorRef = React40.useRef(null);
6450
+ const textInputRef = React40.useRef(null);
6451
+ const optionsRef = React40.useRef(null);
6458
6452
  if (process.env.NODE_ENV !== "production") {
6459
6453
  for (const f of fields) assertValidFieldDefinition(f);
6460
6454
  }
@@ -6477,7 +6471,7 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, onFie
6477
6471
  const editingField = panel && panel.kind === "edit" ? fields.find((f) => f.key === panel.key) : void 0;
6478
6472
  const startEditing = (key) => setPanel({ kind: "edit", key });
6479
6473
  const closeEditing = () => setPanel(null);
6480
- React41.useEffect(() => {
6474
+ React40.useEffect(() => {
6481
6475
  if (!panel || panel.kind !== "edit") return;
6482
6476
  if (editingField?.type === "text") {
6483
6477
  textInputRef.current?.focus();
@@ -6761,7 +6755,7 @@ function StatTile(props) {
6761
6755
  }
6762
6756
 
6763
6757
  // src/components/data/CodeBlock.tsx
6764
- var React42 = __toESM(require("react"), 1);
6758
+ var React41 = __toESM(require("react"), 1);
6765
6759
  var import_jsx_runtime60 = require("react/jsx-runtime");
6766
6760
  var JS_KW = /^(?:const|let|var|function|return|if|else|for|while|do|new|class|extends|import|from|export|default|await|async|try|catch|finally|throw|typeof|instanceof|of|in|switch|case|break|continue|delete|void|yield|static|get|set|this|super|interface|type|enum|implements|public|private|protected|readonly|abstract|as|satisfies|declare|namespace)$/;
6767
6761
  var RULES = {
@@ -6917,7 +6911,7 @@ function tokenize(src, lang) {
6917
6911
  return out;
6918
6912
  }
6919
6913
  function Highlighted({ code, lang }) {
6920
- const toks = React42.useMemo(() => tokenize(code, lang), [code, lang]);
6914
+ const toks = React41.useMemo(() => tokenize(code, lang), [code, lang]);
6921
6915
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: toks.map((tk, i) => tk.c ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "tok-" + tk.c, children: tk.t }, i) : tk.t) });
6922
6916
  }
6923
6917
  function CodeBlock({
@@ -6931,8 +6925,8 @@ function CodeBlock({
6931
6925
  actions,
6932
6926
  className = ""
6933
6927
  }) {
6934
- const [wrap, setWrap] = React42.useState(!!wrapDefault);
6935
- const [open2, setOpen] = React42.useState(false);
6928
+ const [wrap, setWrap] = React41.useState(!!wrapDefault);
6929
+ const [open2, setOpen] = React41.useState(false);
6936
6930
  const [copied, copy] = useCopyToClipboard();
6937
6931
  const body = String(code).replace(/\n$/, "");
6938
6932
  const lines = body.split("\n");
@@ -6961,7 +6955,7 @@ function CodeBlock({
6961
6955
  ] });
6962
6956
  }
6963
6957
  function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" }) {
6964
- const [open2, setOpen] = React42.useState(false);
6958
+ const [open2, setOpen] = React41.useState(false);
6965
6959
  const [copied, copy] = useCopyToClipboard();
6966
6960
  const raw = String(diff).replace(/\n$/, "");
6967
6961
  const all = raw.split("\n").map((line) => {
@@ -7007,7 +7001,7 @@ function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" })
7007
7001
  }
7008
7002
 
7009
7003
  // src/components/data/Markdown.tsx
7010
- var React43 = __toESM(require("react"), 1);
7004
+ var React42 = __toESM(require("react"), 1);
7011
7005
 
7012
7006
  // src/components/data/markdownEscape.ts
7013
7007
  var ESCAPABLE = /\\([!-/:-@[-`{-~])/g;
@@ -7080,7 +7074,7 @@ function hiddenInlineNodes(hidden, ctx, keyBase) {
7080
7074
  const href = safeHref(d(g(2)));
7081
7075
  out.push(href ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("a", { href, title: g(3) ? d(g(3)) : void 0, target: /^https?:/i.test(href) ? "_blank" : void 0, rel: "noopener noreferrer", onClick: ctx.onLinkClick, children: hiddenInlineNodes(g(1), ctx, key()) }, key()) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: d(g(1)) }, key()));
7082
7076
  } else if (kind === "cite") {
7083
- out.push(ctx.renderCitation ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(React43.Fragment, { children: ctx.renderCitation(d(g(1))) }, key()) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sup", { className: "fd-md-cite", children: d(g(1)) }, key()));
7077
+ out.push(ctx.renderCitation ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(React42.Fragment, { children: ctx.renderCitation(d(g(1))) }, key()) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sup", { className: "fd-md-cite", children: d(g(1)) }, key()));
7084
7078
  } else if (kind === "strongem") out.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("em", { children: hiddenInlineNodes(g(1), ctx, key()) }) }, key()));
7085
7079
  else if (kind === "strong") out.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("strong", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
7086
7080
  else if (kind === "em") out.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("em", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
@@ -7267,7 +7261,7 @@ function Markdown({
7267
7261
  tone = "default"
7268
7262
  }) {
7269
7263
  const ctx = { allowImages, headingOffset, renderCitation, onLinkClick, codeProps };
7270
- const blocks = React43.useMemo(() => parseBlocks(source), [source]);
7264
+ const blocks = React42.useMemo(() => parseBlocks(source), [source]);
7271
7265
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: mdClass("fd-md", size, tone, className), children: renderBlocks(blocks, ctx, "b") });
7272
7266
  }
7273
7267
  function MarkdownInline({ source = "", className = "", onLinkClick, size, tone }) {
@@ -7378,7 +7372,7 @@ function Pagination({
7378
7372
  }
7379
7373
 
7380
7374
  // src/components/data/RelativeTime.tsx
7381
- var React44 = __toESM(require("react"), 1);
7375
+ var React43 = __toESM(require("react"), 1);
7382
7376
  var import_jsx_runtime64 = require("react/jsx-runtime");
7383
7377
  var MIN = 6e4;
7384
7378
  var HOUR = 36e5;
@@ -7430,9 +7424,9 @@ function formatDuration(ms) {
7430
7424
  return h + "h" + (m % 60 ? " " + m % 60 + "m" : "");
7431
7425
  }
7432
7426
  function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true, ...rest }) {
7433
- const [, force] = React44.useState(0);
7427
+ const [, force] = React43.useState(0);
7434
7428
  const t = value instanceof Date ? value.getTime() : Date.parse(value);
7435
- React44.useEffect(() => {
7429
+ React43.useEffect(() => {
7436
7430
  if (!refresh2 || !t || isNaN(t)) return;
7437
7431
  const abs2 = Math.abs(t - Date.now());
7438
7432
  if (abs2 > DAY) return;
@@ -7448,7 +7442,7 @@ function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true,
7448
7442
  }
7449
7443
 
7450
7444
  // src/components/data/ScoreMeter.tsx
7451
- var React45 = __toESM(require("react"), 1);
7445
+ var React44 = __toESM(require("react"), 1);
7452
7446
  var import_jsx_runtime65 = require("react/jsx-runtime");
7453
7447
  function ScoreMeter({
7454
7448
  score,
@@ -7463,10 +7457,10 @@ function ScoreMeter({
7463
7457
  breakdownWidth = 280,
7464
7458
  className = ""
7465
7459
  }) {
7466
- const [open2, setOpen] = React45.useState(false);
7467
- const ref = React45.useRef(null);
7460
+ const [open2, setOpen] = React44.useState(false);
7461
+ const ref = React44.useRef(null);
7468
7462
  const value = Math.max(0, Math.min(100, Math.round(Number(score) || 0)));
7469
- const body = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(React45.Fragment, { children: [
7463
+ const body = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(React44.Fragment, { children: [
7470
7464
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "fd-scoremeter-rail", style: { width }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SegmentedMeter, { total: 100, segments, height, showTotal: false, showPercent: false, legend: false }) }),
7471
7465
  showScore ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "fd-scoremeter-value fd-tabular", "aria-hidden": "true", children: value }) : null
7472
7466
  ] });
@@ -7485,7 +7479,7 @@ function ScoreMeter({
7485
7479
  }
7486
7480
  );
7487
7481
  }
7488
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(React45.Fragment, { children: [
7482
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(React44.Fragment, { children: [
7489
7483
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7490
7484
  "button",
7491
7485
  {
@@ -7516,11 +7510,11 @@ function ScoreMeter({
7516
7510
  }
7517
7511
 
7518
7512
  // src/components/actions/inlinePanel.tsx
7519
- var React46 = __toESM(require("react"), 1);
7513
+ var React45 = __toESM(require("react"), 1);
7520
7514
  var import_jsx_runtime66 = require("react/jsx-runtime");
7521
7515
  function useInlinePanel() {
7522
- const [open2, setOpen] = React46.useState(false);
7523
- const ref = React46.useRef(null);
7516
+ const [open2, setOpen] = React45.useState(false);
7517
+ const ref = React45.useRef(null);
7524
7518
  return { open: open2, setOpen, ref };
7525
7519
  }
7526
7520
  function InlinePanelSurface({ panel, align = "right", ...popover }) {
@@ -7691,7 +7685,7 @@ function SortMenu({
7691
7685
  }
7692
7686
 
7693
7687
  // src/components/data/StepList.tsx
7694
- var React47 = __toESM(require("react"), 1);
7688
+ var React46 = __toESM(require("react"), 1);
7695
7689
  var import_jsx_runtime68 = require("react/jsx-runtime");
7696
7690
  var KIND_ICON = { tool: "wrench", search: "magnifying-glass", read: "file-text", write: "pencil-simple", reasoning: "brain", run: "terminal", fetch: "cloud-arrow-down" };
7697
7691
  function StepList({
@@ -7705,9 +7699,9 @@ function StepList({
7705
7699
  className = "",
7706
7700
  active = false
7707
7701
  }) {
7708
- const [openState, setOpenState] = React47.useState(defaultOpen);
7702
+ const [openState, setOpenState] = React46.useState(defaultOpen);
7709
7703
  const open2 = openProp == null ? openState : openProp;
7710
- const [expanded, setExpanded] = React47.useState({});
7704
+ const [expanded, setExpanded] = React46.useState({});
7711
7705
  if (!steps.length) return null;
7712
7706
  const running = steps.some((s) => s.status === "running");
7713
7707
  const failed = steps.filter((s) => s.status === "error").length;
@@ -7765,7 +7759,7 @@ function StepList({
7765
7759
  }
7766
7760
 
7767
7761
  // src/components/data/VirtualList.tsx
7768
- var React48 = __toESM(require("react"), 1);
7762
+ var React47 = __toESM(require("react"), 1);
7769
7763
  var import_jsx_runtime69 = require("react/jsx-runtime");
7770
7764
  var VIRTUAL_LIST_BUFFER_ROWS = 20;
7771
7765
  var VIRTUAL_LIST_ROW_GAP = 6;
@@ -7817,35 +7811,35 @@ function VirtualList({
7817
7811
  className = "",
7818
7812
  style
7819
7813
  }) {
7820
- const [scrollTop, setScrollTop] = React48.useState(0);
7821
- const loaded = React48.useMemo(
7814
+ const [scrollTop, setScrollTop] = React47.useState(0);
7815
+ const loaded = React47.useMemo(
7822
7816
  () => ({ firstItemIndex, count: items.length }),
7823
7817
  [firstItemIndex, items.length]
7824
7818
  );
7825
7819
  const total = Math.max(totalCount == null ? 0 : totalCount, firstItemIndex + items.length);
7826
7820
  const bandKey = firstItemIndex + ":" + items.length;
7827
- const win = React48.useMemo(
7821
+ const win = React47.useMemo(
7828
7822
  () => computeVirtualWindow({ scrollTop, viewportHeight: height, itemHeight, itemCount: total, loaded }),
7829
7823
  [scrollTop, height, itemHeight, total, loaded]
7830
7824
  );
7831
- const need = React48.useMemo(() => computeNeedMore(win, loaded), [win, loaded]);
7825
+ const need = React47.useMemo(() => computeNeedMore(win, loaded), [win, loaded]);
7832
7826
  const wantStart = need.start && hasMore?.start !== false;
7833
7827
  const wantEnd = need.end && hasMore?.end !== false;
7834
7828
  const bucket2 = Math.floor(win.visibleStart / VIRTUAL_LIST_BUFFER_ROWS);
7835
7829
  const askKey = bandKey + "@" + bucket2;
7836
- const asked = React48.useRef({ start: null, end: null });
7837
- React48.useEffect(() => {
7830
+ const asked = React47.useRef({ start: null, end: null });
7831
+ React47.useEffect(() => {
7838
7832
  if (loading || !wantStart || asked.current.start === askKey) return;
7839
7833
  asked.current.start = askKey;
7840
7834
  onNeedMore("start", win);
7841
7835
  }, [wantStart, loading, askKey, onNeedMore, win]);
7842
- React48.useEffect(() => {
7836
+ React47.useEffect(() => {
7843
7837
  if (loading || !wantEnd || asked.current.end === askKey) return;
7844
7838
  asked.current.end = askKey;
7845
7839
  onNeedMore("end", win);
7846
7840
  }, [wantEnd, loading, askKey, onNeedMore, win]);
7847
- const lastKeysRef = React48.useRef(null);
7848
- const newKeys = React48.useMemo(() => {
7841
+ const lastKeysRef = React47.useRef(null);
7842
+ const newKeys = React47.useMemo(() => {
7849
7843
  const prev = lastKeysRef.current;
7850
7844
  if (!prev) return /* @__PURE__ */ new Set();
7851
7845
  const fresh = /* @__PURE__ */ new Set();
@@ -7855,7 +7849,7 @@ function VirtualList({
7855
7849
  }
7856
7850
  return fresh;
7857
7851
  }, [items]);
7858
- React48.useEffect(() => {
7852
+ React47.useEffect(() => {
7859
7853
  lastKeysRef.current = new Set(items.map(keyOf));
7860
7854
  }, [items]);
7861
7855
  const gapStyle = { "--fd-vlist-gap": rowGap + "px" };
@@ -7900,7 +7894,7 @@ function VirtualList({
7900
7894
  }
7901
7895
 
7902
7896
  // src/components/data/EntityRow.tsx
7903
- var React49 = __toESM(require("react"), 1);
7897
+ var React48 = __toESM(require("react"), 1);
7904
7898
  var import_jsx_runtime70 = require("react/jsx-runtime");
7905
7899
  var ENTITY_ROW_METRIC_WIDTH = 74;
7906
7900
  var METRIC_TONE_COLOR = {
@@ -7913,7 +7907,7 @@ function EntityRowMetrics({ metrics, className = "", style }) {
7913
7907
  const key = m.id || m.label || i;
7914
7908
  const className2 = ["fd-erow-metric", m.tone && m.tone !== "default" ? "is-" + m.tone : "", m.tooltip != null ? "is-described" : ""].filter(Boolean).join(" ");
7915
7909
  const tone = { color: METRIC_TONE_COLOR[m.tone || "default"] };
7916
- const content = /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(React49.Fragment, { children: [
7910
+ const content = /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(React48.Fragment, { children: [
7917
7911
  m.icon ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("i", { className: "ph ph-" + m.icon, "aria-hidden": "true" }) : null,
7918
7912
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fd-erow-metric-value fd-tabular", children: m.value }),
7919
7913
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "fd-sr", children: " " + m.label })
@@ -8005,7 +7999,7 @@ function EntityRow({
8005
7999
  }
8006
8000
 
8007
8001
  // src/components/data/TransferList.tsx
8008
- var React50 = __toESM(require("react"), 1);
8002
+ var React49 = __toESM(require("react"), 1);
8009
8003
  var import_react_dom6 = require("react-dom");
8010
8004
 
8011
8005
  // src/components/forms/Input.tsx
@@ -8111,12 +8105,12 @@ function TransferList({
8111
8105
  listHeight = 440,
8112
8106
  className = ""
8113
8107
  }) {
8114
- const [drag, setDrag] = React50.useState(null);
8115
- const [dragOverSide, setDragOverSide] = React50.useState(null);
8116
- const dragRef = React50.useRef(null);
8117
- const armedRef = React50.useRef(null);
8118
- const sideRefs = React50.useRef({ left: null, right: null });
8119
- const hitTestSide = React50.useCallback((x, y) => {
8108
+ const [drag, setDrag] = React49.useState(null);
8109
+ const [dragOverSide, setDragOverSide] = React49.useState(null);
8110
+ const dragRef = React49.useRef(null);
8111
+ const armedRef = React49.useRef(null);
8112
+ const sideRefs = React49.useRef({ left: null, right: null });
8113
+ const hitTestSide = React49.useCallback((x, y) => {
8120
8114
  for (const side of ["left", "right"]) {
8121
8115
  const el = sideRefs.current[side];
8122
8116
  if (!el) continue;
@@ -8125,7 +8119,7 @@ function TransferList({
8125
8119
  }
8126
8120
  return null;
8127
8121
  }, []);
8128
- const findItem = React50.useCallback(
8122
+ const findItem = React49.useCallback(
8129
8123
  (side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
8130
8124
  [left.items, right.items, keyOf]
8131
8125
  );
@@ -8147,7 +8141,7 @@ function TransferList({
8147
8141
  height: rect.height
8148
8142
  };
8149
8143
  };
8150
- React50.useEffect(() => {
8144
+ React49.useEffect(() => {
8151
8145
  const onMovePointer = (e) => {
8152
8146
  const armed = armedRef.current;
8153
8147
  if (!armed || e.pointerId !== armed.pointerId) return;
@@ -8200,7 +8194,7 @@ function TransferList({
8200
8194
  window.removeEventListener("pointercancel", endDrag);
8201
8195
  };
8202
8196
  }, [hitTestSide, findItem, onMove]);
8203
- React50.useEffect(() => {
8197
+ React49.useEffect(() => {
8204
8198
  if (!drag || typeof document === "undefined") return;
8205
8199
  const prev = document.body.style.userSelect;
8206
8200
  document.body.style.userSelect = "none";
@@ -8317,7 +8311,7 @@ function FactList({ facts = [], className = "", ...rest }) {
8317
8311
  }
8318
8312
 
8319
8313
  // src/components/data/USChoropleth.tsx
8320
- var React52 = __toESM(require("react"), 1);
8314
+ var React51 = __toESM(require("react"), 1);
8321
8315
  init_usStates();
8322
8316
 
8323
8317
  // src/components/data/usChoropleth/mapBox.ts
@@ -8384,11 +8378,11 @@ function buildChoroplethModel(values, topN, givenTotal) {
8384
8378
  }
8385
8379
 
8386
8380
  // src/components/data/usChoropleth/useUsStateShapes.ts
8387
- var React51 = __toESM(require("react"), 1);
8381
+ var React50 = __toESM(require("react"), 1);
8388
8382
  function useUsStateShapes() {
8389
- const [token, setToken] = React51.useState(0);
8390
- const [settled, setSettled] = React51.useState(null);
8391
- React51.useEffect(() => {
8383
+ const [token, setToken] = React50.useState(0);
8384
+ const [settled, setSettled] = React50.useState(null);
8385
+ React50.useEffect(() => {
8392
8386
  let current2 = true;
8393
8387
  Promise.resolve().then(() => (init_usStateShapes(), usStateShapes_exports)).then(({ STATE_SHAPES: STATE_SHAPES2 }) => {
8394
8388
  if (current2) setSettled({ token, state: { status: "ready", shapes: STATE_SHAPES2 } });
@@ -8430,7 +8424,7 @@ function nextCode(key, from) {
8430
8424
  }
8431
8425
  function StateMap({ shapes, model, figures, label, formatReadout }) {
8432
8426
  const tip = useTooltip();
8433
- const [stop, setStop] = React52.useState(US_STATE_CODES[0]);
8427
+ const [stop, setStop] = React51.useState(US_STATE_CODES[0]);
8434
8428
  const onKeyDown = (event) => {
8435
8429
  const from = event.target.getAttribute("data-state");
8436
8430
  const to = from && nextCode(event.key, from);
@@ -8478,8 +8472,8 @@ function StateTable({ model, valueLabel, formatValue }) {
8478
8472
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Collapsible, { title: TABLE_TITLE, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DataTable, { columns, rows: model.rows, rowKey: "code", compact: true }) });
8479
8473
  }
8480
8474
  function USChoropleth({ values, label, valueLabel, formatValue, formatReadout, topN, total, className = "" }) {
8481
- const model = React52.useMemo(() => buildChoroplethModel(values, topN ?? 0, total), [values, topN, total]);
8482
- const figures = React52.useMemo(() => new Map(model.rows.map((row) => [row.code, row])), [model]);
8475
+ const model = React51.useMemo(() => buildChoroplethModel(values, topN ?? 0, total), [values, topN, total]);
8476
+ const figures = React51.useMemo(() => new Map(model.rows.map((row) => [row.code, row])), [model]);
8483
8477
  const { state, retry } = useUsStateShapes();
8484
8478
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: ["fd-uschoro", className].filter(Boolean).join(" "), children: [
8485
8479
  /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "fd-uschoro-layout", children: [
@@ -8517,13 +8511,13 @@ function USChoropleth({ values, label, valueLabel, formatValue, formatReadout, t
8517
8511
  init_usStates();
8518
8512
 
8519
8513
  // src/components/data/ReferenceList.tsx
8520
- var React53 = __toESM(require("react"), 1);
8514
+ var React52 = __toESM(require("react"), 1);
8521
8515
  var import_jsx_runtime76 = require("react/jsx-runtime");
8522
8516
  function textOf3(node) {
8523
8517
  if (node == null || typeof node === "boolean") return "";
8524
8518
  if (typeof node === "string" || typeof node === "number") return String(node);
8525
8519
  if (Array.isArray(node)) return node.map(textOf3).join(" ");
8526
- if (React53.isValidElement(node)) return textOf3(node.props.children);
8520
+ if (React52.isValidElement(node)) return textOf3(node.props.children);
8527
8521
  return "";
8528
8522
  }
8529
8523
  function matches(entry, needle) {
@@ -8542,9 +8536,9 @@ function Entries({ entries, mono }) {
8542
8536
  function ReferenceList(props) {
8543
8537
  const { mono = false, searchable = false, searchLabel = "Search", emptyMessage = "No matches", className = "", ...divProps } = props;
8544
8538
  const { entries, sections, ...rest } = divProps;
8545
- const [query, setQuery] = React53.useState("");
8546
- const [searchOpen, setSearchOpen] = React53.useState({});
8547
- const [uncontrolled, setUncontrolled] = React53.useState({});
8539
+ const [query, setQuery] = React52.useState("");
8540
+ const [searchOpen, setSearchOpen] = React52.useState({});
8541
+ const [uncontrolled, setUncontrolled] = React52.useState({});
8548
8542
  const needle = searchable ? query.trim().toLowerCase() : "";
8549
8543
  const searching = needle !== "";
8550
8544
  const onQuery = (value) => {
@@ -8596,11 +8590,11 @@ function ReferenceList(props) {
8596
8590
  }
8597
8591
 
8598
8592
  // src/components/forms/Checkbox.tsx
8599
- var React54 = __toESM(require("react"), 1);
8593
+ var React53 = __toESM(require("react"), 1);
8600
8594
  var import_jsx_runtime77 = require("react/jsx-runtime");
8601
8595
  function Checkbox({ label, description, card = false, indeterminate = false, className = "", ...rest }) {
8602
- const ref = React54.useRef(null);
8603
- React54.useEffect(() => {
8596
+ const ref = React53.useRef(null);
8597
+ React53.useEffect(() => {
8604
8598
  if (ref.current) ref.current.indeterminate = indeterminate;
8605
8599
  }, [indeterminate]);
8606
8600
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("label", { className: ["fd-choice", card ? "fd-choice-card" : "", className].filter(Boolean).join(" "), children: [
@@ -8647,7 +8641,7 @@ function Switch({ label, description, className = "", ...rest }) {
8647
8641
  }
8648
8642
 
8649
8643
  // src/components/forms/Select.tsx
8650
- var React55 = __toESM(require("react"), 1);
8644
+ var React54 = __toESM(require("react"), 1);
8651
8645
  var import_jsx_runtime80 = require("react/jsx-runtime");
8652
8646
  var norm = (o) => typeof o === "string" ? { value: o, label: o } : o;
8653
8647
  function Select({
@@ -8675,12 +8669,12 @@ function Select({
8675
8669
  const isOn = (v) => multiple ? vals.includes(v) : v === value;
8676
8670
  const hasSearch = searchable === void 0 ? opts.length > 8 : searchable;
8677
8671
  const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
8678
- const [open2, setOpen] = React55.useState(false);
8679
- const [q, setQ] = React55.useState("");
8680
- const rootRef = React55.useRef(null);
8681
- const boxRef = React55.useRef(null);
8682
- const listRef = React55.useRef(null);
8683
- const typeBuf = React55.useRef({ s: "", t: 0 });
8672
+ const [open2, setOpen] = React54.useState(false);
8673
+ const [q, setQ] = React54.useState("");
8674
+ const rootRef = React54.useRef(null);
8675
+ const boxRef = React54.useRef(null);
8676
+ const listRef = React54.useRef(null);
8677
+ const typeBuf = React54.useRef({ s: "", t: 0 });
8684
8678
  const selected = multiple ? null : opts.find((o) => o.value === value);
8685
8679
  const chosen = multiple ? opts.filter((o) => vals.includes(o.value)) : [];
8686
8680
  const boxText = multiple ? chosen.length === 0 ? placeholder : chosen.length === 1 ? chosen[0].label : summary ? summary(chosen.map((o) => o.value)) : chosen.length + " selected" : selected ? selected.label : placeholder;
@@ -8816,7 +8810,7 @@ function Select({
8816
8810
  ),
8817
8811
  q ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "fd-body-sm fd-muted", children: visible.length }) : null
8818
8812
  ] }) : void 0,
8819
- footer: multiple ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(React55.Fragment, { children: [
8813
+ footer: multiple ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(React54.Fragment, { children: [
8820
8814
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
8821
8815
  "button",
8822
8816
  {
@@ -8847,7 +8841,7 @@ function Select({
8847
8841
  'Nothing matches "',
8848
8842
  q,
8849
8843
  '".'
8850
- ] }) : groups.map((grp) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(React55.Fragment, { children: [
8844
+ ] }) : groups.map((grp) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(React54.Fragment, { children: [
8851
8845
  grp.g ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "fd-pop-group", children: grp.g }) : null,
8852
8846
  grp.items.map(({ o, i }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
8853
8847
  "button",
@@ -8884,7 +8878,7 @@ function Select({
8884
8878
  }
8885
8879
 
8886
8880
  // src/components/forms/TimePicker.tsx
8887
- var React56 = __toESM(require("react"), 1);
8881
+ var React55 = __toESM(require("react"), 1);
8888
8882
  var import_jsx_runtime81 = require("react/jsx-runtime");
8889
8883
  var pad = (n) => String(n).padStart(2, "0");
8890
8884
  function ClockFace({ value = "09:00", onChange }) {
@@ -8893,9 +8887,9 @@ function ClockFace({ value = "09:00", onChange }) {
8893
8887
  if (isNaN(m)) m = 0;
8894
8888
  const pm = h24 >= 12;
8895
8889
  const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
8896
- const [mode2, setMode] = React56.useState("h");
8897
- const faceRef = React56.useRef(null);
8898
- const dragging = React56.useRef(false);
8890
+ const [mode2, setMode] = React55.useState("h");
8891
+ const faceRef = React55.useRef(null);
8892
+ const dragging = React55.useRef(false);
8899
8893
  const set = (h, mm, isPm) => onChange((isPm ? h % 12 + 12 : h % 12) + ":" + pad(mm));
8900
8894
  const R = 108, NR = 80;
8901
8895
  const nums = mode2 === "h" ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 12 }, (_, i) => i * 5);
@@ -8968,9 +8962,9 @@ function ClockFace({ value = "09:00", onChange }) {
8968
8962
  }
8969
8963
  function TimePicker({ label, help, error, required = false, disabled = false, value = "", onChange, placeholder = "Pick a time", id, className = "", style }) {
8970
8964
  const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id);
8971
- const [open2, setOpen] = React56.useState(false);
8972
- const rootRef = React56.useRef(null);
8973
- const boxRef = React56.useRef(null);
8965
+ const [open2, setOpen] = React55.useState(false);
8966
+ const rootRef = React55.useRef(null);
8967
+ const boxRef = React55.useRef(null);
8974
8968
  const disp = () => {
8975
8969
  if (!value) return "";
8976
8970
  const [h, m] = value.split(":").map(Number);
@@ -9013,7 +9007,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
9013
9007
  offset: 6,
9014
9008
  width: 262,
9015
9009
  role: "presentation",
9016
- footer: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(React56.Fragment, { children: [
9010
+ footer: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(React55.Fragment, { children: [
9017
9011
  /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
9018
9012
  "button",
9019
9013
  {
@@ -9041,7 +9035,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
9041
9035
  }
9042
9036
 
9043
9037
  // src/components/forms/Slider.tsx
9044
- var React57 = __toESM(require("react"), 1);
9038
+ var React56 = __toESM(require("react"), 1);
9045
9039
  var import_jsx_runtime82 = require("react/jsx-runtime");
9046
9040
  function Slider({
9047
9041
  label,
@@ -9059,7 +9053,7 @@ function Slider({
9059
9053
  ...rest
9060
9054
  }) {
9061
9055
  const fieldId = useFieldId(id);
9062
- const [dragging, setDragging] = React57.useState(false);
9056
+ const [dragging, setDragging] = React56.useState(false);
9063
9057
  const v = value === void 0 ? min : Number(value);
9064
9058
  const pct = max === min ? 0 : (v - min) / (max - min) * 100;
9065
9059
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: ["fd-field", className].filter(Boolean).join(" "), children: [
@@ -9093,7 +9087,7 @@ function Slider({
9093
9087
  }
9094
9088
 
9095
9089
  // src/components/forms/RangeSlider.tsx
9096
- var React58 = __toESM(require("react"), 1);
9090
+ var React57 = __toESM(require("react"), 1);
9097
9091
  var import_jsx_runtime83 = require("react/jsx-runtime");
9098
9092
  function RangeSlider({
9099
9093
  label,
@@ -9113,9 +9107,9 @@ function RangeSlider({
9113
9107
  }) {
9114
9108
  const fmt2 = format || ((v) => String(v));
9115
9109
  const [a, b] = value || [min, max];
9116
- const [drag, setDrag] = React58.useState(null);
9117
- const [focus, setFocus] = React58.useState(null);
9118
- const railRef = React58.useRef(null);
9110
+ const [drag, setDrag] = React57.useState(null);
9111
+ const [focus, setFocus] = React57.useState(null);
9112
+ const railRef = React57.useRef(null);
9119
9113
  const pct = (v) => max === min ? 0 : (v - min) / (max - min) * 100;
9120
9114
  const clampPair = (i, v) => {
9121
9115
  v = Math.min(max, Math.max(min, Math.round(v / step) * step));
@@ -9130,7 +9124,7 @@ function RangeSlider({
9130
9124
  const r = railRef.current.getBoundingClientRect();
9131
9125
  return min + Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * (max - min);
9132
9126
  };
9133
- React58.useEffect(() => {
9127
+ React57.useEffect(() => {
9134
9128
  if (drag === null) return;
9135
9129
  const mv = (e) => onChange && onChange(clampPair(drag, fromEvent(e)));
9136
9130
  const upH = () => setDrag(null);
@@ -9211,7 +9205,7 @@ function RangeSlider({
9211
9205
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "fd-range" + (hasLabels ? " has-labels" : ""), onPointerDown: onRailDown, children: [
9212
9206
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "fd-range-rail", ref: railRef }),
9213
9207
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "fd-range-fill", style: { left: pct(a) + "%", width: pct(b) - pct(a) + "%" } }),
9214
- marks.map((m) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(React58.Fragment, { children: [
9208
+ marks.map((m) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(React57.Fragment, { children: [
9215
9209
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "fd-range-mark" + (m.value >= a && m.value <= b ? " is-in" : ""), style: { left: pct(m.value) + "%" } }),
9216
9210
  m.label ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "fd-range-mark-label", style: { left: pct(m.value) + "%" }, children: m.label }) : null
9217
9211
  ] }, m.value)),
@@ -9240,7 +9234,7 @@ function RangeSlider({
9240
9234
  }
9241
9235
 
9242
9236
  // src/components/forms/Dropzone.tsx
9243
- var React59 = __toESM(require("react"), 1);
9237
+ var React58 = __toESM(require("react"), 1);
9244
9238
  var import_jsx_runtime84 = require("react/jsx-runtime");
9245
9239
  function Dropzone({
9246
9240
  onFiles,
@@ -9255,8 +9249,8 @@ function Dropzone({
9255
9249
  className = "",
9256
9250
  style
9257
9251
  }) {
9258
- const [over, setOver] = React59.useState(false);
9259
- const depth = React59.useRef(0);
9252
+ const [over, setOver] = React58.useState(false);
9253
+ const depth = React58.useRef(0);
9260
9254
  const has = (e) => {
9261
9255
  const dt = e.dataTransfer;
9262
9256
  if (!dt) return false;
@@ -9320,8 +9314,8 @@ function FilePickButton({
9320
9314
  className = "",
9321
9315
  children
9322
9316
  }) {
9323
- const ref = React59.useRef(null);
9324
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(React59.Fragment, { children: [
9317
+ const ref = React58.useRef(null);
9318
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(React58.Fragment, { children: [
9325
9319
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9326
9320
  "button",
9327
9321
  {
@@ -9358,10 +9352,10 @@ function FilePickButton({
9358
9352
  }
9359
9353
  function useStagedFiles(upload, opts) {
9360
9354
  const o = opts || {};
9361
- const [items, setItems] = React59.useState([]);
9362
- const controllers = React59.useRef({});
9355
+ const [items, setItems] = React58.useState([]);
9356
+ const controllers = React58.useRef({});
9363
9357
  const patch = (id, next) => setItems((list) => list.map((f) => f.id === id ? Object.assign({}, f, next) : f));
9364
- const run = React59.useCallback((att) => {
9358
+ const run = React58.useCallback((att) => {
9365
9359
  if (!upload) return;
9366
9360
  const ac = typeof AbortController !== "undefined" ? new AbortController() : null;
9367
9361
  controllers.current[att.id] = ac;
@@ -9378,14 +9372,14 @@ function useStagedFiles(upload, opts) {
9378
9372
  delete controllers.current[att.id];
9379
9373
  });
9380
9374
  }, [upload]);
9381
- const add = React59.useCallback((files) => {
9375
+ const add = React58.useCallback((files) => {
9382
9376
  if (!upload) return [];
9383
9377
  const atts = Array.from(files).map((f) => toAttachment(f));
9384
9378
  setItems((list) => list.concat(atts));
9385
9379
  atts.forEach(run);
9386
9380
  return atts;
9387
9381
  }, [upload, run]);
9388
- const remove = React59.useCallback((att) => {
9382
+ const remove = React58.useCallback((att) => {
9389
9383
  const ac = controllers.current[att.id];
9390
9384
  if (ac) {
9391
9385
  try {
@@ -9396,10 +9390,10 @@ function useStagedFiles(upload, opts) {
9396
9390
  }
9397
9391
  setItems((list) => list.filter((f) => f.id !== att.id));
9398
9392
  }, []);
9399
- const retry = React59.useCallback((att) => {
9393
+ const retry = React58.useCallback((att) => {
9400
9394
  run(att);
9401
9395
  }, [run]);
9402
- const clear = React59.useCallback(() => {
9396
+ const clear = React58.useCallback(() => {
9403
9397
  Object.values(controllers.current).forEach((ac) => {
9404
9398
  try {
9405
9399
  ac && ac.abort();
@@ -9526,7 +9520,7 @@ function FileGrid({ files = [], onOpen, onRemove, onRetry, tiles = true, maxHeig
9526
9520
  var import_markdown_editor = require("@flytedan/markdown-editor");
9527
9521
 
9528
9522
  // src/components/forms/CodeEditor.tsx
9529
- var React60 = __toESM(require("react"), 1);
9523
+ var React59 = __toESM(require("react"), 1);
9530
9524
  var import_view = require("@codemirror/view");
9531
9525
  var import_state2 = require("@codemirror/state");
9532
9526
  var import_commands = require("@codemirror/commands");
@@ -9678,7 +9672,7 @@ function CodeEditor({
9678
9672
  autoFocus = false
9679
9673
  }) {
9680
9674
  const fieldId = useFieldId(id);
9681
- const diagnostics = React60.useMemo(
9675
+ const diagnostics = React59.useMemo(
9682
9676
  () => [
9683
9677
  ...passedDiagnostics ?? [],
9684
9678
  ...language === "json" ? jsonModeDiagnostics(value, validate) : []
@@ -9687,18 +9681,18 @@ function CodeEditor({
9687
9681
  );
9688
9682
  const descId = fieldId + "-desc";
9689
9683
  const liveId = fieldId + "-live";
9690
- const hostRef = React60.useRef(null);
9691
- const viewRef = React60.useRef(null);
9692
- const valueRef = React60.useRef(value);
9693
- const onChangeRef = React60.useRef(onChange);
9684
+ const hostRef = React59.useRef(null);
9685
+ const viewRef = React59.useRef(null);
9686
+ const valueRef = React59.useRef(value);
9687
+ const onChangeRef = React59.useRef(onChange);
9694
9688
  onChangeRef.current = onChange;
9695
- const editableCompartment = React60.useRef(new import_state2.Compartment()).current;
9696
- const languageCompartment = React60.useRef(new import_state2.Compartment()).current;
9697
- const readOnlyCompartment = React60.useRef(new import_state2.Compartment()).current;
9698
- const attributesCompartment = React60.useRef(new import_state2.Compartment()).current;
9699
- const errorRef = React60.useRef(error);
9689
+ const editableCompartment = React59.useRef(new import_state2.Compartment()).current;
9690
+ const languageCompartment = React59.useRef(new import_state2.Compartment()).current;
9691
+ const readOnlyCompartment = React59.useRef(new import_state2.Compartment()).current;
9692
+ const attributesCompartment = React59.useRef(new import_state2.Compartment()).current;
9693
+ const errorRef = React59.useRef(error);
9700
9694
  errorRef.current = error;
9701
- const diagnosticsCountRef = React60.useRef(diagnostics.length);
9695
+ const diagnosticsCountRef = React59.useRef(diagnostics.length);
9702
9696
  diagnosticsCountRef.current = diagnostics.length;
9703
9697
  function contentAttributes() {
9704
9698
  return {
@@ -9708,7 +9702,7 @@ function CodeEditor({
9708
9702
  ...label ? { "aria-label": label } : {}
9709
9703
  };
9710
9704
  }
9711
- React60.useEffect(() => {
9705
+ React59.useEffect(() => {
9712
9706
  const host2 = hostRef.current;
9713
9707
  if (!host2) return;
9714
9708
  const updateListener = import_view.EditorView.updateListener.of((update) => {
@@ -9750,7 +9744,7 @@ function CodeEditor({
9750
9744
  viewRef.current = null;
9751
9745
  };
9752
9746
  }, []);
9753
- React60.useEffect(() => {
9747
+ React59.useEffect(() => {
9754
9748
  const view = viewRef.current;
9755
9749
  if (!view) return;
9756
9750
  const current2 = view.state.doc.toString();
@@ -9759,22 +9753,22 @@ function CodeEditor({
9759
9753
  }
9760
9754
  valueRef.current = value;
9761
9755
  }, [value]);
9762
- React60.useEffect(() => {
9756
+ React59.useEffect(() => {
9763
9757
  const view = viewRef.current;
9764
9758
  if (!view) return;
9765
9759
  view.dispatch({ effects: editableCompartment.reconfigure(import_view.EditorView.editable.of(!disabled)) });
9766
9760
  }, [disabled, editableCompartment]);
9767
- React60.useEffect(() => {
9761
+ React59.useEffect(() => {
9768
9762
  const view = viewRef.current;
9769
9763
  if (!view) return;
9770
9764
  view.dispatch({ effects: languageCompartment.reconfigure(language === "json" ? (0, import_lang_json2.json)() : (0, import_lang_sql.sql)()) });
9771
9765
  }, [language, languageCompartment]);
9772
- React60.useEffect(() => {
9766
+ React59.useEffect(() => {
9773
9767
  const view = viewRef.current;
9774
9768
  if (!view) return;
9775
9769
  view.dispatch({ effects: readOnlyCompartment.reconfigure(import_state2.EditorState.readOnly.of(readOnly)) });
9776
9770
  }, [readOnly, readOnlyCompartment]);
9777
- React60.useEffect(() => {
9771
+ React59.useEffect(() => {
9778
9772
  const view = viewRef.current;
9779
9773
  if (!view) return;
9780
9774
  view.dispatch({
@@ -9901,11 +9895,11 @@ function jsonPathPosition(text, path, anchor = "value") {
9901
9895
  }
9902
9896
 
9903
9897
  // src/components/forms/RadioGroup.tsx
9904
- var React61 = __toESM(require("react"), 1);
9898
+ var React60 = __toESM(require("react"), 1);
9905
9899
  var import_jsx_runtime87 = require("react/jsx-runtime");
9906
9900
  function RadioGroup({ label, labelledBy, options, value, onChange, card = false, disabled = false, name, className = "" }) {
9907
- const autoName = React61.useId();
9908
- const labelId = React61.useId();
9901
+ const autoName = React60.useId();
9902
+ const labelId = React60.useId();
9909
9903
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { role: "radiogroup", "aria-labelledby": labelledBy ?? labelId, "aria-disabled": disabled || void 0, className: ["fd-radiogroup", className].filter(Boolean).join(" "), children: [
9910
9904
  labelledBy === void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { id: labelId, className: "fd-radiogroup-label", children: label }),
9911
9905
  options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
@@ -9933,16 +9927,16 @@ function Fieldset({ busy = false, className = "", ...rest }) {
9933
9927
  }
9934
9928
 
9935
9929
  // src/components/platform/AccountMenu.tsx
9936
- var React63 = __toESM(require("react"), 1);
9930
+ var React62 = __toESM(require("react"), 1);
9937
9931
 
9938
9932
  // src/kits/sessionContext.tsx
9939
- var React62 = __toESM(require("react"), 1);
9940
- var SessionContext = React62.createContext(null);
9933
+ var React61 = __toESM(require("react"), 1);
9934
+ var SessionContext = React61.createContext(null);
9941
9935
  function SessionProvider({ value, children }) {
9942
- return React62.createElement(SessionContext.Provider, { value }, children);
9936
+ return React61.createElement(SessionContext.Provider, { value }, children);
9943
9937
  }
9944
9938
  function useSessionContext() {
9945
- const ctx = React62.useContext(SessionContext);
9939
+ const ctx = React61.useContext(SessionContext);
9946
9940
  if (!ctx) {
9947
9941
  throw new Error(
9948
9942
  "useSessionContext() was called outside a <SessionProvider>. Wrap your app root in <SessionProvider value={...}> with your real session, or \u2014 in the docs site or a demo \u2014 in <DemoSessionProvider>, before rendering AccountMenu, Gate, ProfilePage or AppSwitcher."
@@ -9982,11 +9976,11 @@ function AccountMenu({
9982
9976
  ...rest
9983
9977
  }) {
9984
9978
  const { user, roles, can: can2, signOut: ctxSignOut, demo, pending } = useSessionContext();
9985
- const [open2, setOpen] = React63.useState(false);
9986
- const [switching, setSwitching] = React63.useState(false);
9987
- const [signingOut, setSigningOut] = React63.useState(false);
9988
- const [signOutError, setSignOutError] = React63.useState(null);
9989
- const ref = React63.useRef(null);
9979
+ const [open2, setOpen] = React62.useState(false);
9980
+ const [switching, setSwitching] = React62.useState(false);
9981
+ const [signingOut, setSigningOut] = React62.useState(false);
9982
+ const [signOutError, setSignOutError] = React62.useState(null);
9983
+ const ref = React62.useRef(null);
9990
9984
  const visibleLinks = links.filter((l) => !l.perm || !pending && can2(l.perm));
9991
9985
  const visibleGroups = groups.map((g) => ({ label: g.label, links: g.links.filter((l) => !l.perm || !pending && can2(l.perm)) })).filter((g) => g.links.length);
9992
9986
  const closeMenu = () => {
@@ -10111,13 +10105,13 @@ function AccountMenu({
10111
10105
  }
10112
10106
 
10113
10107
  // src/components/platform/AppSwitcher.tsx
10114
- var React64 = __toESM(require("react"), 1);
10108
+ var React63 = __toESM(require("react"), 1);
10115
10109
  var import_jsx_runtime90 = require("react/jsx-runtime");
10116
10110
  function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
10117
10111
  const { apps: contextApps } = useSessionContext();
10118
10112
  const apps = appsProp ?? contextApps ?? [];
10119
- const [open2, setOpen] = React64.useState(false);
10120
- const anchorRef = React64.useRef(null);
10113
+ const [open2, setOpen] = React63.useState(false);
10114
+ const anchorRef = React63.useRef(null);
10121
10115
  if (!apps.length) return null;
10122
10116
  const items = apps.map((app) => ({
10123
10117
  id: app.key,
@@ -10131,7 +10125,7 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
10131
10125
  window.location.href = app.url;
10132
10126
  }
10133
10127
  }));
10134
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(React64.Fragment, { children: [
10128
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(React63.Fragment, { children: [
10135
10129
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { ref: anchorRef, className: ["fd-appswitch-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10136
10130
  IconButton,
10137
10131
  {
@@ -10160,10 +10154,10 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
10160
10154
  }
10161
10155
 
10162
10156
  // src/components/platform/AppearanceMenu.tsx
10163
- var React67 = __toESM(require("react"), 1);
10157
+ var React66 = __toESM(require("react"), 1);
10164
10158
 
10165
10159
  // src/kits/appearance.ts
10166
- var React65 = __toESM(require("react"), 1);
10160
+ var React64 = __toESM(require("react"), 1);
10167
10161
  var DEFAULT_STORAGE_KEY = "fd-appearance";
10168
10162
  var DEFAULT_PREFS = {
10169
10163
  theme: "system",
@@ -10275,8 +10269,8 @@ function watchAppearance(store, root = document.documentElement) {
10275
10269
  };
10276
10270
  }
10277
10271
  function useAppearancePrefs(store) {
10278
- const prefs = React65.useSyncExternalStore(store.subscribe, store.getSnapshot);
10279
- const update = React65.useCallback(
10272
+ const prefs = React64.useSyncExternalStore(store.subscribe, store.getSnapshot);
10273
+ const update = React64.useCallback(
10280
10274
  (patch) => {
10281
10275
  store.write({ ...store.getSnapshot(), ...patch });
10282
10276
  },
@@ -10286,15 +10280,15 @@ function useAppearancePrefs(store) {
10286
10280
  }
10287
10281
 
10288
10282
  // src/components/platform/AppearanceProvider.tsx
10289
- var React66 = __toESM(require("react"), 1);
10283
+ var React65 = __toESM(require("react"), 1);
10290
10284
  var import_jsx_runtime91 = require("react/jsx-runtime");
10291
- var AppearanceStoreContext = React66.createContext(null);
10285
+ var AppearanceStoreContext = React65.createContext(null);
10292
10286
  function AppearanceProvider({ store, children }) {
10293
- React66.useLayoutEffect(() => watchAppearance(store), [store]);
10287
+ React65.useLayoutEffect(() => watchAppearance(store), [store]);
10294
10288
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(AppearanceStoreContext.Provider, { value: store, children });
10295
10289
  }
10296
10290
  function useAppearanceStore() {
10297
- const store = React66.useContext(AppearanceStoreContext);
10291
+ const store = React65.useContext(AppearanceStoreContext);
10298
10292
  if (!store) throw new Error("AppearanceMenu and useAppearanceStore must be rendered inside an <AppearanceProvider>.");
10299
10293
  return store;
10300
10294
  }
@@ -10314,10 +10308,10 @@ var TEXT_SCALE_OPTIONS = [
10314
10308
  ];
10315
10309
  function AppearanceMenu({ className = "" }) {
10316
10310
  const [prefs, update] = useAppearancePrefs(useAppearanceStore());
10317
- const [open2, setOpen] = React67.useState(false);
10318
- const anchorRef = React67.useRef(null);
10311
+ const [open2, setOpen] = React66.useState(false);
10312
+ const anchorRef = React66.useRef(null);
10319
10313
  const patch = (p) => update(p);
10320
- return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(React67.Fragment, { children: [
10314
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(React66.Fragment, { children: [
10321
10315
  /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { ref: anchorRef, className: ["fd-appearance-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
10322
10316
  IconButton,
10323
10317
  {
@@ -10386,14 +10380,14 @@ function AppearanceMenu({ className = "" }) {
10386
10380
  }
10387
10381
 
10388
10382
  // src/components/platform/ApiSpecBrowser.tsx
10389
- var React68 = __toESM(require("react"), 1);
10383
+ var React67 = __toESM(require("react"), 1);
10390
10384
  var import_jsx_runtime93 = require("react/jsx-runtime");
10391
10385
  var METHOD_TONE = { GET: "success", POST: "info", PATCH: "warning", PUT: "warning", DELETE: "danger" };
10392
10386
  function Json({ obj }) {
10393
10387
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("pre", { className: "fd-json", children: JSON.stringify(obj, null, 2) });
10394
10388
  }
10395
10389
  function Endpoint({ s, onRequest }) {
10396
- const [tried, setTried] = React68.useState(null);
10390
+ const [tried, setTried] = React67.useState(null);
10397
10391
  const run = async () => {
10398
10392
  setTried("busy");
10399
10393
  const t0 = (window.performance || Date).now();
@@ -10466,10 +10460,10 @@ function ApiSpecBrowser({
10466
10460
  className = "",
10467
10461
  ...rest
10468
10462
  }) {
10469
- const [q, setQ] = React68.useState("");
10470
- const [method, setMethod] = React68.useState(null);
10471
- const [mod, setMod] = React68.useState(null);
10472
- const [listOnly, setListOnly] = React68.useState(false);
10463
+ const [q, setQ] = React67.useState("");
10464
+ const [method, setMethod] = React67.useState(null);
10465
+ const [mod, setMod] = React67.useState(null);
10466
+ const [listOnly, setListOnly] = React67.useState(false);
10473
10467
  const activeModule = modules && modules.find((m) => m.id === mod);
10474
10468
  const hits = spec.filter((s) => (!method || s.method === method) && (!listOnly || s.isList) && (!activeModule || activeModule.endpoints.indexOf(s.id) >= 0) && (!q || (s.path + " " + s.title + " " + s.purpose + " " + (s.usedBy || []).join(" ")).toLowerCase().includes(q.toLowerCase())));
10475
10469
  const effGroups = groups && groups.length ? groups : [["All endpoints", spec.map((s) => s.id)]];
@@ -10548,7 +10542,7 @@ function ApiSpecBrowser({
10548
10542
  }
10549
10543
 
10550
10544
  // src/components/platform/ProfilePage.tsx
10551
- var React69 = __toESM(require("react"), 1);
10545
+ var React68 = __toESM(require("react"), 1);
10552
10546
  var import_jsx_runtime94 = require("react/jsx-runtime");
10553
10547
  function fieldInitialValue(field, user) {
10554
10548
  if (field.value) return field.value(user);
@@ -10584,21 +10578,21 @@ function ProfilePage({
10584
10578
  }) {
10585
10579
  const { user: sessionUser, roles, permissions, saveProfile: saveProfile2 } = useSessionContext();
10586
10580
  const user = userProp || sessionUser;
10587
- const initialFieldValues = React69.useMemo(() => {
10581
+ const initialFieldValues = React68.useMemo(() => {
10588
10582
  const values2 = {};
10589
10583
  for (const field of fields) values2[field.key] = fieldInitialValue(field, user);
10590
10584
  return values2;
10591
10585
  }, [user.id, fields]);
10592
- const initialNotify = React69.useMemo(() => {
10586
+ const initialNotify = React68.useMemo(() => {
10593
10587
  const values2 = {};
10594
10588
  for (const n of notifications) values2[n.key] = !!user.notify?.[n.key];
10595
10589
  return values2;
10596
10590
  }, [user.id, notifications]);
10597
- const [values, setValues] = React69.useState(initialFieldValues);
10598
- const [notify, setNotify] = React69.useState(initialNotify);
10599
- const [saving, setSaving] = React69.useState(false);
10600
- const [saved, setSaved] = React69.useState(false);
10601
- const [prevUserId, setPrevUserId] = React69.useState(user.id);
10591
+ const [values, setValues] = React68.useState(initialFieldValues);
10592
+ const [notify, setNotify] = React68.useState(initialNotify);
10593
+ const [saving, setSaving] = React68.useState(false);
10594
+ const [saved, setSaved] = React68.useState(false);
10595
+ const [prevUserId, setPrevUserId] = React68.useState(user.id);
10602
10596
  if (user.id !== prevUserId) {
10603
10597
  setPrevUserId(user.id);
10604
10598
  setValues(initialFieldValues);
@@ -10786,7 +10780,7 @@ function ProfilePage({
10786
10780
  }
10787
10781
 
10788
10782
  // src/components/platform/SessionScreen.tsx
10789
- var React70 = __toESM(require("react"), 1);
10783
+ var React69 = __toESM(require("react"), 1);
10790
10784
  var import_jsx_runtime95 = require("react/jsx-runtime");
10791
10785
  var COPY = {
10792
10786
  "signing-in": { busy: "Signing you in\u2026" },
@@ -10800,13 +10794,13 @@ function SessionScreen({ kind, error, onRetry, productName }) {
10800
10794
  const copy = COPY[kind];
10801
10795
  const busyMessage = "busy" in copy ? copy.busy : null;
10802
10796
  const failureTitle = "failure" in copy ? copy.failure : null;
10803
- const [announced, setAnnounced] = React70.useState("");
10804
- React70.useEffect(() => {
10797
+ const [announced, setAnnounced] = React69.useState("");
10798
+ React69.useEffect(() => {
10805
10799
  setAnnounced(busyMessage ?? "");
10806
10800
  }, [busyMessage]);
10807
- const titleRef = React70.useRef(null);
10801
+ const titleRef = React69.useRef(null);
10808
10802
  const failed = failureTitle !== null;
10809
- React70.useEffect(() => {
10803
+ React69.useEffect(() => {
10810
10804
  titleRef.current?.focus({ preventScroll: true });
10811
10805
  }, [failed]);
10812
10806
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("main", { className: "fd-session-screen", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "fd-session-screen-inner", children: [
@@ -10829,10 +10823,10 @@ function SessionScreen({ kind, error, onRetry, productName }) {
10829
10823
  }
10830
10824
 
10831
10825
  // src/components/platform/RoadmapTimeline.tsx
10832
- var React73 = __toESM(require("react"), 1);
10826
+ var React72 = __toESM(require("react"), 1);
10833
10827
 
10834
10828
  // src/kits/session.ts
10835
- var React71 = __toESM(require("react"), 1);
10829
+ var React70 = __toESM(require("react"), 1);
10836
10830
  var PERMISSION_CATALOG = [
10837
10831
  { group: "Plans", items: [
10838
10832
  { key: "plan.view", label: "View plans", detail: "Read any plan in the workspace." },
@@ -12399,8 +12393,8 @@ function roadmap(overrides) {
12399
12393
  };
12400
12394
  }
12401
12395
  function useSession() {
12402
- const [s, setS] = React71.useState(getSession);
12403
- React71.useEffect(() => subscribe(setS), []);
12396
+ const [s, setS] = React70.useState(getSession);
12397
+ React70.useEffect(() => subscribe(setS), []);
12404
12398
  return s;
12405
12399
  }
12406
12400
  var SessionKit = {
@@ -12433,7 +12427,7 @@ var SessionKit = {
12433
12427
  };
12434
12428
  function DemoSessionProvider({ children }) {
12435
12429
  const session = useSession();
12436
- const value = React71.useMemo(
12430
+ const value = React70.useMemo(
12437
12431
  () => ({
12438
12432
  user: session.user,
12439
12433
  roles: session.roles,
@@ -12449,11 +12443,11 @@ function DemoSessionProvider({ children }) {
12449
12443
  }),
12450
12444
  [session]
12451
12445
  );
12452
- return React71.createElement(SessionProvider, { value }, children);
12446
+ return React70.createElement(SessionProvider, { value }, children);
12453
12447
  }
12454
12448
 
12455
12449
  // src/kits/runtime.ts
12456
- var React72 = __toESM(require("react"), 1);
12450
+ var React71 = __toESM(require("react"), 1);
12457
12451
  var WIRED_ENDPOINTS = [
12458
12452
  // Nothing yet. Every id below would come from a real service:
12459
12453
  // "plan.get", "placements.list", …
@@ -12624,8 +12618,8 @@ var RuntimeKit = {
12624
12618
  };
12625
12619
  RuntimeKit.declare(FEATURE_NEEDS);
12626
12620
  function useRuntimeMode() {
12627
- const [m, setM] = React72.useState(RuntimeKit.getMode());
12628
- React72.useEffect(() => RuntimeKit.subscribe(setM), []);
12621
+ const [m, setM] = React71.useState(RuntimeKit.getMode());
12622
+ React71.useEffect(() => RuntimeKit.subscribe(setM), []);
12629
12623
  return m;
12630
12624
  }
12631
12625
  function useFeatureStatus(key) {
@@ -12708,12 +12702,12 @@ function RoadmapCard({ item: item2, byKey, onOpenFlag }) {
12708
12702
  }
12709
12703
  function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
12710
12704
  const session = SessionKit.useSession();
12711
- const [project, setProject] = React73.useState("");
12712
- const [q, setQ] = React73.useState("");
12713
- const scrollRef = React73.useRef(null);
12714
- const nowRef = React73.useRef(null);
12715
- const rm = React73.useMemo(() => SessionKit.roadmap({ isComplete: RuntimeKit.isComplete }), [session]);
12716
- const byKey = React73.useMemo(() => {
12705
+ const [project, setProject] = React72.useState("");
12706
+ const [q, setQ] = React72.useState("");
12707
+ const scrollRef = React72.useRef(null);
12708
+ const nowRef = React72.useRef(null);
12709
+ const rm = React72.useMemo(() => SessionKit.roadmap({ isComplete: RuntimeKit.isComplete }), [session]);
12710
+ const byKey = React72.useMemo(() => {
12717
12711
  const m = {};
12718
12712
  rm.items.forEach((i) => {
12719
12713
  m[i.key] = i;
@@ -12722,7 +12716,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
12722
12716
  }, [rm]);
12723
12717
  const items = rm.items.filter((i) => (!project || i.project === project) && (!q || (i.label + " " + i.description + " " + (i.backend || "") + " " + i.key).toLowerCase().includes(q.toLowerCase())));
12724
12718
  const projects = [...new Set(rm.items.map((i) => i.project))];
12725
- React73.useEffect(() => {
12719
+ React72.useEffect(() => {
12726
12720
  let raf1 = 0, raf2 = 0;
12727
12721
  const place = () => {
12728
12722
  const box = scrollRef.current, mark = nowRef.current;
@@ -12796,7 +12790,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
12796
12790
  lastPhase = item2.phase;
12797
12791
  const inPhase = items.filter((i) => i.phase === item2.phase).length;
12798
12792
  const isBoundary = n === firstPending;
12799
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(React73.Fragment, { children: [
12793
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(React72.Fragment, { children: [
12800
12794
  showPhase ? /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "fd-rm-era", children: [
12801
12795
  /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
12802
12796
  /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { style: { fontWeight: 700 }, children: item2.phase === 0 ? "Shipped" : "Phase " + item2.phase + " \u2014 " + item2.phaseName }),
@@ -12840,7 +12834,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
12840
12834
  }
12841
12835
 
12842
12836
  // src/components/platform/ComingSoon.tsx
12843
- var React74 = __toESM(require("react"), 1);
12837
+ var React73 = __toESM(require("react"), 1);
12844
12838
  var import_react_dom7 = require("react-dom");
12845
12839
  var import_jsx_runtime97 = require("react/jsx-runtime");
12846
12840
  var BYPASS_STORE = "fd.soon.bypass.v1";
@@ -12858,8 +12852,8 @@ function writeBypassed(list) {
12858
12852
  }
12859
12853
  }
12860
12854
  function useBypass(key) {
12861
- const [on, setOn] = React74.useState(() => !!key && readBypassed().indexOf(key) >= 0);
12862
- React74.useEffect(() => {
12855
+ const [on, setOn] = React73.useState(() => !!key && readBypassed().indexOf(key) >= 0);
12856
+ React73.useEffect(() => {
12863
12857
  setOn(!!key && readBypassed().indexOf(key) >= 0);
12864
12858
  }, [key]);
12865
12859
  const set = (next) => {
@@ -12906,9 +12900,9 @@ function SoonCard({ label, detail, backend, eta, effort, onRoadmap, allowed, onB
12906
12900
  ] });
12907
12901
  }
12908
12902
  function useHoverCard(open2) {
12909
- const anchor = React74.useRef(null);
12910
- const [pos, setPos] = React74.useState(null);
12911
- React74.useLayoutEffect(() => {
12903
+ const anchor = React73.useRef(null);
12904
+ const [pos, setPos] = React73.useState(null);
12905
+ React73.useLayoutEffect(() => {
12912
12906
  if (!open2 || !anchor.current) {
12913
12907
  setPos(null);
12914
12908
  return;
@@ -13017,7 +13011,7 @@ function ComingSoon({
13017
13011
  ] });
13018
13012
  }
13019
13013
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: ["fd-soon", className].filter(Boolean).join(" "), style: minHeight ? { minHeight } : void 0, ...rest, children: [
13020
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-soon-under", style: { filter: "blur(" + blur + "px) saturate(.62)" }, ...{ inert: "" }, "aria-hidden": "true", children }),
13014
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-soon-under", style: { filter: "blur(" + blur + "px) saturate(.62)" }, inert: true, "aria-hidden": "true", children }),
13021
13015
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-soon-veil" }),
13022
13016
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-soon-note", role: "note", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
13023
13017
  SoonCard,
@@ -13035,12 +13029,12 @@ function ComingSoon({
13035
13029
  ] });
13036
13030
  }
13037
13031
  function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
13038
- const [open2, setOpen] = React74.useState(false);
13032
+ const [open2, setOpen] = React73.useState(false);
13039
13033
  const [anchor, pos] = useHoverCard(open2);
13040
- const hoverCardRef = React74.useRef(null);
13034
+ const hoverCardRef = React73.useRef(null);
13041
13035
  const hoverLayer = useStackedLayer({ active: open2, containerRef: hoverCardRef, returnFocus: false });
13042
13036
  const zIndex = useLayerZIndex(hoverLayer);
13043
- const close2 = React74.useRef(null);
13037
+ const close2 = React73.useRef(null);
13044
13038
  const show = () => {
13045
13039
  if (close2.current) {
13046
13040
  clearTimeout(close2.current);
@@ -13056,7 +13050,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
13056
13050
  setOpen(false);
13057
13051
  }, 140);
13058
13052
  };
13059
- React74.useEffect(() => () => {
13053
+ React73.useEffect(() => () => {
13060
13054
  if (close2.current) clearTimeout(close2.current);
13061
13055
  }, []);
13062
13056
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
@@ -13070,7 +13064,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
13070
13064
  onBlur: hide,
13071
13065
  ...rest,
13072
13066
  children: [
13073
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-soon-under", style: { filter: "blur(" + Math.min(blur, 1.1) + "px) saturate(.66)" }, ...{ inert: "" }, "aria-hidden": "true", children }),
13067
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-soon-under", style: { filter: "blur(" + Math.min(blur, 1.1) + "px) saturate(.66)" }, inert: true, "aria-hidden": "true", children }),
13074
13068
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
13075
13069
  "button",
13076
13070
  {
@@ -13508,7 +13502,7 @@ function SaturationDistribution({ campuses = [], floorBand, floorScore, onSelect
13508
13502
  }
13509
13503
 
13510
13504
  // src/components/planner/MixGap.tsx
13511
- var React75 = __toESM(require("react"), 1);
13505
+ var React74 = __toESM(require("react"), 1);
13512
13506
  var import_jsx_runtime102 = require("react/jsx-runtime");
13513
13507
  var MIX_GAP_LAYOUT = {
13514
13508
  trackHeight: 30,
@@ -13523,7 +13517,7 @@ function mixGapOffset(value, max) {
13523
13517
  }
13524
13518
  function MixGap({ rows = [], loading = false, className = "" }) {
13525
13519
  const max = Math.max(1, ...rows.flatMap((r) => [r.target, r.realized]));
13526
- const [hover, setHover] = React75.useState(null);
13520
+ const [hover, setHover] = React74.useState(null);
13527
13521
  const toneOf = (gap) => gap >= -1 ? "ok" : gap >= -4 ? "warn" : "danger";
13528
13522
  const TONE = { ok: "var(--ok-solid)", warn: "var(--warn-solid)", danger: "var(--danger-solid)" };
13529
13523
  const { trackHeight, barHeight, targetWidth, labelGap } = MIX_GAP_LAYOUT;
@@ -13666,7 +13660,7 @@ function ChannelContribution({
13666
13660
  }
13667
13661
 
13668
13662
  // src/components/planner/BudgetReallocator.tsx
13669
- var React76 = __toESM(require("react"), 1);
13663
+ var React75 = __toESM(require("react"), 1);
13670
13664
  var import_jsx_runtime104 = require("react/jsx-runtime");
13671
13665
  var bandFor = (crp) => crp >= 200 ? "dominant" : crp >= 100 ? "strong" : crp >= 50 ? "adequate" : "weak";
13672
13666
  function BudgetReallocator({
@@ -13682,8 +13676,8 @@ function BudgetReallocator({
13682
13676
  onCancel,
13683
13677
  className = ""
13684
13678
  }) {
13685
- const [draft, setDraft] = React76.useState(spend);
13686
- React76.useEffect(() => setDraft(spend), [spend]);
13679
+ const [draft, setDraft] = React75.useState(spend);
13680
+ React75.useEffect(() => setDraft(spend), [spend]);
13687
13681
  const dirty = draft !== spend;
13688
13682
  const nextCrp = scoreFor ? scoreFor(draft) : crp;
13689
13683
  const nextBand = bandFor(nextCrp);
@@ -13698,10 +13692,10 @@ function BudgetReallocator({
13698
13692
  setDraft(spend);
13699
13693
  if (onCancel) onCancel();
13700
13694
  };
13701
- const trackRef = React76.useRef(null);
13702
- const chipRef = React76.useRef(null);
13703
- const [chipLeft, setChipLeft] = React76.useState(null);
13704
- React76.useLayoutEffect(() => {
13695
+ const trackRef = React75.useRef(null);
13696
+ const chipRef = React75.useRef(null);
13697
+ const [chipLeft, setChipLeft] = React75.useState(null);
13698
+ React75.useLayoutEffect(() => {
13705
13699
  const track = trackRef.current;
13706
13700
  if (!dirty || !track) {
13707
13701
  setChipLeft(null);
@@ -13889,7 +13883,7 @@ function ImportanceTag({ level, showLabel = true, size = "sm", className = "", d
13889
13883
  }
13890
13884
 
13891
13885
  // src/components/planner/PreferenceMeter.tsx
13892
- var React77 = __toESM(require("react"), 1);
13886
+ var React76 = __toESM(require("react"), 1);
13893
13887
  var import_jsx_runtime107 = require("react/jsx-runtime");
13894
13888
  function preferenceScore(criteria) {
13895
13889
  const earned = criteria.reduce((n, c) => n + (Number(c.earned) || 0), 0);
@@ -13919,7 +13913,7 @@ function PreferenceMeter({
13919
13913
  className = ""
13920
13914
  }) {
13921
13915
  const value = score == null ? preferenceScore(criteria) : score;
13922
- const segments = React77.useMemo(() => preferenceSegments(criteria), [criteria]);
13916
+ const segments = React76.useMemo(() => preferenceSegments(criteria), [criteria]);
13923
13917
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
13924
13918
  ScoreMeter,
13925
13919
  {
@@ -13958,13 +13952,13 @@ function PreferenceMeter({
13958
13952
  }
13959
13953
 
13960
13954
  // src/components/chat/AgentChatPanel.tsx
13961
- var React84 = __toESM(require("react"), 1);
13955
+ var React83 = __toESM(require("react"), 1);
13962
13956
 
13963
13957
  // src/components/chat/chatEngine.ts
13964
- var React79 = __toESM(require("react"), 1);
13958
+ var React78 = __toESM(require("react"), 1);
13965
13959
 
13966
13960
  // src/components/chat/chatStore.ts
13967
- var React78 = __toESM(require("react"), 1);
13961
+ var React77 = __toESM(require("react"), 1);
13968
13962
  var safeStore = {
13969
13963
  get(k) {
13970
13964
  try {
@@ -13993,13 +13987,13 @@ function useChatDraft(owner, contextType, contextId, store = safeStore) {
13993
13987
  if (owner === "") throw new Error("useChatDraft: draftOwner is an empty string; pass the signed-in user's id, or null for no owner.");
13994
13988
  const key = owner === null ? null : draftKey(owner, contextType, contextId);
13995
13989
  const read2 = (k) => k ? store.get(k) || "" : "";
13996
- const [state, setState] = React78.useState(() => ({ key, text: read2(key) }));
13990
+ const [state, setState] = React77.useState(() => ({ key, text: read2(key) }));
13997
13991
  let current2 = state;
13998
13992
  if (state.key !== key) {
13999
13993
  current2 = { key, text: read2(key) };
14000
13994
  setState(current2);
14001
13995
  }
14002
- const setText = React78.useCallback((text) => {
13996
+ const setText = React77.useCallback((text) => {
14003
13997
  if (key) {
14004
13998
  if (text) {
14005
13999
  store.set(key, text);
@@ -14058,33 +14052,33 @@ function useChatEngine(opts) {
14058
14052
  onClear,
14059
14053
  onFeedback
14060
14054
  } = opts || {};
14061
- const [status, setStatus] = React79.useState("idle");
14062
- const [threadId, setThreadId] = React79.useState(null);
14063
- const [messages, setMessages] = React79.useState([]);
14064
- const [queue, setQueue] = React79.useState([]);
14065
- const [fatal, setFatal] = React79.useState(null);
14066
- const [busy, setBusy] = React79.useState(false);
14067
- const [turnStartedAt, setTurnStartedAt] = React79.useState(null);
14068
- const listRef = React79.useRef([]);
14069
- const queueRef = React79.useRef([]);
14070
- const busyRef = React79.useRef(false);
14071
- const loadedRef = React79.useRef(false);
14072
- const stoppedRef = React79.useRef(false);
14073
- const abortRef = React79.useRef(null);
14074
- const serverCount = React79.useRef(0);
14075
- const serverIds = React79.useRef(/* @__PURE__ */ new Set());
14076
- const liveTurn = React79.useRef(null);
14077
- const lastTurnOwn = React79.useRef(/* @__PURE__ */ new Set());
14078
- const retired = React79.useRef(/* @__PURE__ */ new Set());
14079
- const threadRef = React79.useRef(null);
14080
- const mounted = React79.useRef(true);
14081
- React79.useEffect(() => {
14055
+ const [status, setStatus] = React78.useState("idle");
14056
+ const [threadId, setThreadId] = React78.useState(null);
14057
+ const [messages, setMessages] = React78.useState([]);
14058
+ const [queue, setQueue] = React78.useState([]);
14059
+ const [fatal, setFatal] = React78.useState(null);
14060
+ const [busy, setBusy] = React78.useState(false);
14061
+ const [turnStartedAt, setTurnStartedAt] = React78.useState(null);
14062
+ const listRef = React78.useRef([]);
14063
+ const queueRef = React78.useRef([]);
14064
+ const busyRef = React78.useRef(false);
14065
+ const loadedRef = React78.useRef(false);
14066
+ const stoppedRef = React78.useRef(false);
14067
+ const abortRef = React78.useRef(null);
14068
+ const serverCount = React78.useRef(0);
14069
+ const serverIds = React78.useRef(/* @__PURE__ */ new Set());
14070
+ const liveTurn = React78.useRef(null);
14071
+ const lastTurnOwn = React78.useRef(/* @__PURE__ */ new Set());
14072
+ const retired = React78.useRef(/* @__PURE__ */ new Set());
14073
+ const threadRef = React78.useRef(null);
14074
+ const mounted = React78.useRef(true);
14075
+ React78.useEffect(() => {
14082
14076
  mounted.current = true;
14083
14077
  return () => {
14084
14078
  mounted.current = false;
14085
14079
  };
14086
14080
  }, []);
14087
- const describeWaitingRef = React79.useRef(describeWaiting);
14081
+ const describeWaitingRef = React78.useRef(describeWaiting);
14088
14082
  describeWaitingRef.current = describeWaiting;
14089
14083
  const commit = (next) => {
14090
14084
  const derived = withWaiting(next, (pending) => describeWaitingRef.current(pending));
@@ -14103,7 +14097,7 @@ function useChatEngine(opts) {
14103
14097
  }
14104
14098
  return false;
14105
14099
  };
14106
- const loadThread = React79.useCallback(async (id) => {
14100
+ const loadThread = React78.useCallback(async (id) => {
14107
14101
  const data = await apiAdapter.getThread(id);
14108
14102
  const list = [...data && data.messages || []];
14109
14103
  serverCount.current = list.length;
@@ -14145,7 +14139,7 @@ function useChatEngine(opts) {
14145
14139
  packet: progress.packet ?? holder.packet
14146
14140
  });
14147
14141
  }
14148
- React79.useEffect(() => {
14142
+ React78.useEffect(() => {
14149
14143
  if (!apiAdapter) {
14150
14144
  setStatus("idle");
14151
14145
  setFatal(null);
@@ -14388,7 +14382,7 @@ function useChatEngine(opts) {
14388
14382
  await dispatchTurn(turn);
14389
14383
  }
14390
14384
  }
14391
- const send = React79.useCallback((text, attachments) => {
14385
+ const send = React78.useCallback((text, attachments) => {
14392
14386
  const body = (text || "").trim();
14393
14387
  if (!body && !(attachments && attachments.length)) return;
14394
14388
  if (status === "disconnected") return;
@@ -14398,7 +14392,7 @@ function useChatEngine(opts) {
14398
14392
  stoppedRef.current = false;
14399
14393
  drain();
14400
14394
  }, [status]);
14401
- const stop = React79.useCallback(() => {
14395
+ const stop = React78.useCallback(() => {
14402
14396
  stoppedRef.current = true;
14403
14397
  const ac = abortRef.current;
14404
14398
  if (ac) {
@@ -14417,11 +14411,11 @@ function useChatEngine(opts) {
14417
14411
  store.del(jobKey(threadRef.current));
14418
14412
  }
14419
14413
  }, [apiAdapter]);
14420
- const removeQueued = React79.useCallback((id) => {
14414
+ const removeQueued = React78.useCallback((id) => {
14421
14415
  queueRef.current = queueRef.current.filter((t) => t.id !== id);
14422
14416
  setQueue(queueRef.current.slice());
14423
14417
  }, []);
14424
- const retry = React79.useCallback(() => {
14418
+ const retry = React78.useCallback(() => {
14425
14419
  const list = listRef.current;
14426
14420
  let at = -1;
14427
14421
  for (let i = list.length - 1; i >= 0; i--) if (list[i].role === "user") {
@@ -14438,19 +14432,19 @@ function useChatEngine(opts) {
14438
14432
  setQueue(queueRef.current.slice());
14439
14433
  drain();
14440
14434
  }, []);
14441
- const clear = React79.useCallback(() => {
14435
+ const clear = React78.useCallback(() => {
14442
14436
  commit([]);
14443
14437
  serverCount.current = 0;
14444
14438
  queueRef.current = [];
14445
14439
  setQueue([]);
14446
14440
  onClear && onClear();
14447
14441
  }, [onClear]);
14448
- const setFeedback = React79.useCallback((id, value) => {
14442
+ const setFeedback = React78.useCallback((id, value) => {
14449
14443
  patch(id, (m) => ({ feedback: m.feedback === value ? null : value }));
14450
14444
  const msg = listRef.current.find((m) => m.id === id);
14451
14445
  onFeedback && onFeedback({ message: msg, feedback: msg ? msg.feedback : value });
14452
14446
  }, [onFeedback]);
14453
- const reload = React79.useCallback(async () => {
14447
+ const reload = React78.useCallback(async () => {
14454
14448
  if (!threadRef.current) return;
14455
14449
  setStatus("loading");
14456
14450
  try {
@@ -14460,7 +14454,7 @@ function useChatEngine(opts) {
14460
14454
  if (!fail(err)) setStatus("ready");
14461
14455
  }
14462
14456
  }, [loadThread]);
14463
- const refresh2 = React79.useCallback(async () => {
14457
+ const refresh2 = React78.useCallback(async () => {
14464
14458
  if (!threadRef.current) return;
14465
14459
  try {
14466
14460
  await mergeThread();
@@ -14497,10 +14491,10 @@ var ChatKit = {
14497
14491
  };
14498
14492
 
14499
14493
  // src/components/chat/ChatTranscript.tsx
14500
- var React81 = __toESM(require("react"), 1);
14494
+ var React80 = __toESM(require("react"), 1);
14501
14495
 
14502
14496
  // src/components/chat/ChatTurn.tsx
14503
- var React80 = __toESM(require("react"), 1);
14497
+ var React79 = __toESM(require("react"), 1);
14504
14498
  var import_jsx_runtime108 = require("react/jsx-runtime");
14505
14499
  function JsonView({ value }) {
14506
14500
  let text;
@@ -14512,10 +14506,10 @@ function JsonView({ value }) {
14512
14506
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CodeBlock, { code: text, language: "json", collapseAfter: 18 });
14513
14507
  }
14514
14508
  function DecisionFooter({ packet, decision, state }) {
14515
- const [pending, setPending] = React80.useState(null);
14516
- const [failure, setFailure] = React80.useState(null);
14517
- const mounted = React80.useRef(true);
14518
- React80.useEffect(() => {
14509
+ const [pending, setPending] = React79.useState(null);
14510
+ const [failure, setFailure] = React79.useState(null);
14511
+ const mounted = React79.useRef(true);
14512
+ React79.useEffect(() => {
14519
14513
  mounted.current = true;
14520
14514
  return () => {
14521
14515
  mounted.current = false;
@@ -14573,7 +14567,7 @@ function PacketCard({ packet, schema, render, onApply, applied, decision }) {
14573
14567
  ] });
14574
14568
  }
14575
14569
  function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
14576
- const [open2, setOpen] = React80.useState(defaultOpen);
14570
+ const [open2, setOpen] = React79.useState(defaultOpen);
14577
14571
  if (!text) return null;
14578
14572
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "fdc-think" + (open2 ? " is-open" : ""), children: [
14579
14573
  /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("button", { type: "button", className: "fdc-think-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
@@ -14590,7 +14584,7 @@ function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
14590
14584
  ] });
14591
14585
  }
14592
14586
  function Citations({ items = [], onOpen }) {
14593
- const [open2, setOpen] = React80.useState(false);
14587
+ const [open2, setOpen] = React79.useState(false);
14594
14588
  if (!items.length) return null;
14595
14589
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "fdc-cites", children: [
14596
14590
  /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("button", { type: "button", className: "fdc-cites-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
@@ -14616,7 +14610,7 @@ function clampText(text, max) {
14616
14610
  return (at > max * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
14617
14611
  }
14618
14612
  function MessageBody({ message: m, ctx }) {
14619
- const [expanded, setExpanded] = React80.useState(false);
14613
+ const [expanded, setExpanded] = React79.useState(false);
14620
14614
  const isUser = m.role === "user";
14621
14615
  const raw = m.text || "";
14622
14616
  const clamped = !expanded && !m.streaming ? clampText(raw, ctx.maxVisibleChars) : null;
@@ -14696,7 +14690,7 @@ function RunActions({ group, ctx }) {
14696
14690
  ] }),
14697
14691
  isAssistant && ctx.onRetry ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "fdc-act", onClick: ctx.onRetry, "aria-label": "Retry this turn", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("i", { className: "ph ph-arrow-clockwise", "aria-hidden": "true" }) }) : null,
14698
14692
  group.role === "user" && ctx.onEdit ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "fdc-act", onClick: () => ctx.onEdit(last), "aria-label": "Edit and resend", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("i", { className: "ph ph-pencil-simple", "aria-hidden": "true" }) }) : null,
14699
- isAssistant && ctx.onFeedback ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(React80.Fragment, { children: [
14693
+ isAssistant && ctx.onFeedback ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(React79.Fragment, { children: [
14700
14694
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "fdc-act" + (fb === "up" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "up"), "aria-pressed": fb === "up", "aria-label": "Good response", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("i", { className: "ph ph-thumbs-up", "aria-hidden": "true" }) }),
14701
14695
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "fdc-act" + (fb === "down" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "down"), "aria-pressed": fb === "down", "aria-label": "Bad response", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("i", { className: "ph ph-thumbs-down", "aria-hidden": "true" }) })
14702
14696
  ] }) : null,
@@ -14791,10 +14785,10 @@ function ChatTranscript({
14791
14785
  renderEmpty,
14792
14786
  className = ""
14793
14787
  }) {
14794
- const scroller = React81.useRef(null);
14795
- const stick = React81.useRef(true);
14796
- const [pill, setPill] = React81.useState(0);
14797
- const seen = React81.useRef(0);
14788
+ const scroller = React80.useRef(null);
14789
+ const stick = React80.useRef(true);
14790
+ const [pill, setPill] = React80.useState(0);
14791
+ const seen = React80.useRef(0);
14798
14792
  const toBottom = (smooth) => {
14799
14793
  const el = scroller.current;
14800
14794
  if (!el) return;
@@ -14813,7 +14807,7 @@ function ChatTranscript({
14813
14807
  seen.current = messages.length;
14814
14808
  }
14815
14809
  };
14816
- React81.useLayoutEffect(() => {
14810
+ React80.useLayoutEffect(() => {
14817
14811
  const el = scroller.current;
14818
14812
  if (!el) return;
14819
14813
  if (stick.current) {
@@ -14821,7 +14815,7 @@ function ChatTranscript({
14821
14815
  seen.current = messages.length;
14822
14816
  } else setPill(Math.max(0, messages.length - seen.current));
14823
14817
  }, [messages]);
14824
- React81.useEffect(() => {
14818
+ React80.useEffect(() => {
14825
14819
  const el = scroller.current;
14826
14820
  const inner = el && el.firstChild;
14827
14821
  if (!el || !inner || typeof ResizeObserver === "undefined") return;
@@ -14831,7 +14825,7 @@ function ChatTranscript({
14831
14825
  ro.observe(inner);
14832
14826
  return () => ro.disconnect();
14833
14827
  }, []);
14834
- const groups = React81.useMemo(() => groupMessages(messages), [messages]);
14828
+ const groups = React80.useMemo(() => groupMessages(messages), [messages]);
14835
14829
  const empty = !messages.length && status === "ready";
14836
14830
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: ["fdc-scroll", className].filter(Boolean).join(" "), ref: scroller, onScroll, children: [
14837
14831
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "fdc-log", role: "log", "aria-label": "Conversation", children: [
@@ -14855,7 +14849,7 @@ function ChatTranscript({
14855
14849
  const prev = groups[i - 1];
14856
14850
  const k = dayKey(g.messages[0].timestamp);
14857
14851
  const showDay = !!k && (!prev || dayKey(prev.messages[0].timestamp) !== k);
14858
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(React81.Fragment, { children: [
14852
+ return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(React80.Fragment, { children: [
14859
14853
  showDay ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "fdc-day", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { children: dayLabel(k) }) }) : null,
14860
14854
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChatTurn, { group: g, ctx })
14861
14855
  ] }, g.key || i);
@@ -14872,7 +14866,7 @@ function ChatTranscript({
14872
14866
  var TranscriptKit = { groupMessages };
14873
14867
 
14874
14868
  // src/components/chat/ChatComposer.tsx
14875
- var React82 = __toESM(require("react"), 1);
14869
+ var React81 = __toESM(require("react"), 1);
14876
14870
  var import_markdown_editor2 = require("@flytedan/markdown-editor");
14877
14871
  var import_jsx_runtime110 = require("react/jsx-runtime");
14878
14872
  function ChatComposer({
@@ -14901,17 +14895,17 @@ function ChatComposer({
14901
14895
  onReject,
14902
14896
  onOpenAttachment
14903
14897
  }) {
14904
- const [text, setText] = React82.useState(draft || "");
14905
- const [trigger, setTrigger] = React82.useState(null);
14906
- const [mentionItems, setMentionItems] = React82.useState([]);
14907
- const [listening, setListening] = React82.useState(false);
14908
- const [notice, setNotice] = React82.useState(null);
14909
- const editor = React82.useRef(null);
14910
- const wrap = React82.useRef(null);
14911
- const stopVoice = React82.useRef(null);
14898
+ const [text, setText] = React81.useState(draft || "");
14899
+ const [trigger, setTrigger] = React81.useState(null);
14900
+ const [mentionItems, setMentionItems] = React81.useState([]);
14901
+ const [listening, setListening] = React81.useState(false);
14902
+ const [notice, setNotice] = React81.useState(null);
14903
+ const editor = React81.useRef(null);
14904
+ const wrap = React81.useRef(null);
14905
+ const stopVoice = React81.useRef(null);
14912
14906
  const staged = useStagedFiles(fileUploadHandler, { onError: () => {
14913
14907
  } });
14914
- React82.useEffect(() => {
14908
+ React81.useEffect(() => {
14915
14909
  if (draft != null && draft !== text) setText(draft);
14916
14910
  }, [draft]);
14917
14911
  const change = (v) => {
@@ -14947,7 +14941,7 @@ function ChatComposer({
14947
14941
  e.preventDefault();
14948
14942
  staged.add(found.files);
14949
14943
  };
14950
- React82.useEffect(() => {
14944
+ React81.useEffect(() => {
14951
14945
  if (!trigger || trigger.type !== "mention" || !mentionSources) {
14952
14946
  setMentionItems([]);
14953
14947
  return;
@@ -14965,7 +14959,7 @@ function ChatComposer({
14965
14959
  const q = (trigger.query || "").toLowerCase();
14966
14960
  setMentionItems(mentionSources.filter((m) => !q || (m.label + " " + (m.description || "")).toLowerCase().includes(q)));
14967
14961
  }, [trigger, mentionSources]);
14968
- const slashItems = React82.useMemo(() => {
14962
+ const slashItems = React81.useMemo(() => {
14969
14963
  if (!trigger || trigger.type !== "slash" || !slashCommands) return [];
14970
14964
  const q = (trigger.query || "").toLowerCase();
14971
14965
  return slashCommands.filter((c) => !q || (c.id + " " + c.label + " " + (c.description || "")).toLowerCase().includes(q));
@@ -15131,12 +15125,12 @@ function ChatComposer({
15131
15125
  }
15132
15126
 
15133
15127
  // src/components/chat/ChatSessionBar.tsx
15134
- var React83 = __toESM(require("react"), 1);
15128
+ var React82 = __toESM(require("react"), 1);
15135
15129
  var import_jsx_runtime111 = require("react/jsx-runtime");
15136
15130
  var compact2 = meterFormats.compact;
15137
15131
  function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extras }) {
15138
- const [open2, setOpen] = React83.useState(false);
15139
- const anchor = React83.useRef(null);
15132
+ const [open2, setOpen] = React82.useState(false);
15133
+ const anchor = React82.useRef(null);
15140
15134
  const stats = sessionStats || null;
15141
15135
  const cu = contextUsage || null;
15142
15136
  const limits = usageLimits || null;
@@ -15151,7 +15145,7 @@ function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extr
15151
15145
  if (stats && stats.runningTasks) bits.push(stats.runningTasks + " running task" + (stats.runningTasks === 1 ? "" : "s"));
15152
15146
  if (cu) bits.push(pct + "% context");
15153
15147
  const expandable = !!(cu || limits);
15154
- return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(React83.Fragment, { children: [
15148
+ return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(React82.Fragment, { children: [
15155
15149
  /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: "fdc-bar", children: [
15156
15150
  /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
15157
15151
  "button",
@@ -15294,7 +15288,7 @@ function ModelControls({
15294
15288
  ] })
15295
15289
  });
15296
15290
  }
15297
- return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(React83.Fragment, { children: [
15291
+ return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(React82.Fragment, { children: [
15298
15292
  /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
15299
15293
  MenuButton,
15300
15294
  {
@@ -15415,7 +15409,7 @@ function AgentChatPanel({
15415
15409
  onEditMessage
15416
15410
  }) {
15417
15411
  const [panelRef, panelWidth] = useMeasuredWidth(NARROW_PANEL_WIDTH);
15418
- const [applied, setApplied] = React84.useState({});
15412
+ const [applied, setApplied] = React83.useState({});
15419
15413
  const [draft, setDraft] = useChatDraft(draftOwner, contextType, contextId);
15420
15414
  const engine = useChatEngine({
15421
15415
  contextType,
@@ -15433,8 +15427,8 @@ function AgentChatPanel({
15433
15427
  onFeedback
15434
15428
  });
15435
15429
  const { refresh: refresh2 } = engine;
15436
- const lastReloadKey = React84.useRef(reloadKey);
15437
- React84.useEffect(() => {
15430
+ const lastReloadKey = React83.useRef(reloadKey);
15431
+ React83.useEffect(() => {
15438
15432
  if (lastReloadKey.current === reloadKey) return;
15439
15433
  lastReloadKey.current = reloadKey;
15440
15434
  refresh2();
@@ -15598,7 +15592,7 @@ function AgentChatPanel({
15598
15592
  }
15599
15593
 
15600
15594
  // src/components/chat/QueryResultCard.tsx
15601
- var React85 = __toESM(require("react"), 1);
15595
+ var React84 = __toESM(require("react"), 1);
15602
15596
  var import_jsx_runtime113 = require("react/jsx-runtime");
15603
15597
  var STATUS2 = {
15604
15598
  queued: { label: "Queued", tone: "neutral" },
@@ -15609,9 +15603,9 @@ var STATUS2 = {
15609
15603
  };
15610
15604
  var QUERY_EMPTY_MESSAGE = "No rows to show.";
15611
15605
  function useElapsed(status, startedAt) {
15612
- const [now, setNow] = React85.useState(() => Date.now());
15606
+ const [now, setNow] = React84.useState(() => Date.now());
15613
15607
  const running = status === "running" && startedAt != null;
15614
- React85.useEffect(() => {
15608
+ React84.useEffect(() => {
15615
15609
  if (!running) return;
15616
15610
  const tick = setInterval(() => setNow(Date.now()), 1e3);
15617
15611
  return () => clearInterval(tick);
@@ -15647,10 +15641,10 @@ function QueryResultCard({
15647
15641
  }
15648
15642
 
15649
15643
  // src/components/chat/CsvCard.tsx
15650
- var React87 = __toESM(require("react"), 1);
15644
+ var React86 = __toESM(require("react"), 1);
15651
15645
 
15652
15646
  // src/kits/exports/exportState.ts
15653
- var React86 = __toESM(require("react"), 1);
15647
+ var React85 = __toESM(require("react"), 1);
15654
15648
 
15655
15649
  // src/kits/exports/exportJob.ts
15656
15650
  function isLiveExport(job) {
@@ -15674,9 +15668,9 @@ function exportStateOf(job, now) {
15674
15668
  }
15675
15669
  }
15676
15670
  function useExpiryClock(job) {
15677
- const [now, setNow] = React86.useState(() => Date.now());
15671
+ const [now, setNow] = React85.useState(() => Date.now());
15678
15672
  const { status, expiresAt } = job;
15679
- React86.useEffect(() => {
15673
+ React85.useEffect(() => {
15680
15674
  if (status !== "SUCCEEDED" || expiresAt === null) return;
15681
15675
  const wait = Date.parse(expiresAt) - Date.now();
15682
15676
  if (wait <= 0) return;
@@ -15686,14 +15680,14 @@ function useExpiryClock(job) {
15686
15680
  return now;
15687
15681
  }
15688
15682
  function useLastListed(listed) {
15689
- const [last, setLast] = React86.useState(listed);
15683
+ const [last, setLast] = React85.useState(listed);
15690
15684
  if (listed !== void 0 && listed !== last) setLast(listed);
15691
15685
  return listed ?? last;
15692
15686
  }
15693
15687
  function useShownExport(held, exports2, refresh2) {
15694
15688
  const lastListed = useLastListed(exports2.find((candidate) => candidate.id === held.id));
15695
15689
  const unlisted = isLiveExport(held) && lastListed === void 0;
15696
- React86.useEffect(() => {
15690
+ React85.useEffect(() => {
15697
15691
  if (unlisted) refresh2();
15698
15692
  }, [unlisted, refresh2]);
15699
15693
  return isLiveExport(held) && lastListed !== void 0 ? lastListed : held;
@@ -15710,7 +15704,7 @@ var STATE = {
15710
15704
  };
15711
15705
  var CSV_FAILED_FALLBACK = "The CSV could not be made.";
15712
15706
  function CsvCard({ job, keptNote, onDownload }) {
15713
- const [downloading, setDownloading] = React87.useState(false);
15707
+ const [downloading, setDownloading] = React86.useState(false);
15714
15708
  const now = useExpiryClock(job);
15715
15709
  const state = exportStateOf(job, now);
15716
15710
  const { label, tone } = STATE[state];
@@ -15743,7 +15737,7 @@ function CsvCard({ job, keptNote, onDownload }) {
15743
15737
  }
15744
15738
 
15745
15739
  // src/components/files/FileViewer.tsx
15746
- var React88 = __toESM(require("react"), 1);
15740
+ var React87 = __toESM(require("react"), 1);
15747
15741
  var import_jsx_runtime115 = require("react/jsx-runtime");
15748
15742
  function previewKindOf(file) {
15749
15743
  const mime = (file.mime || "").toLowerCase();
@@ -15800,13 +15794,13 @@ function parseDelimited(text, delimiter) {
15800
15794
  return rows;
15801
15795
  }
15802
15796
  function usePreview(file, kind, resolveUrl) {
15803
- const [state, setState] = React88.useState({ status: "loading" });
15804
- const [attempt, setAttempt] = React88.useState(0);
15805
- const resolveRef = React88.useRef(resolveUrl);
15806
- React88.useEffect(() => {
15797
+ const [state, setState] = React87.useState({ status: "loading" });
15798
+ const [attempt, setAttempt] = React87.useState(0);
15799
+ const resolveRef = React87.useRef(resolveUrl);
15800
+ React87.useEffect(() => {
15807
15801
  resolveRef.current = resolveUrl;
15808
15802
  }, [resolveUrl]);
15809
- React88.useEffect(() => {
15803
+ React87.useEffect(() => {
15810
15804
  if (kind === "none") {
15811
15805
  setState({ status: "ready" });
15812
15806
  return;
@@ -15836,7 +15830,7 @@ function usePreview(file, kind, resolveUrl) {
15836
15830
  if (ac) ac.abort();
15837
15831
  };
15838
15832
  }, [file.id, kind, attempt]);
15839
- return { ...state, retry: React88.useCallback(() => setAttempt((a) => a + 1), []) };
15833
+ return { ...state, retry: React87.useCallback(() => setAttempt((a) => a + 1), []) };
15840
15834
  }
15841
15835
  function PreviewBody({ file, kind, state }) {
15842
15836
  if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("img", { className: "fd-fv-image", src: state.url, alt: file.name || "Preview" });
@@ -15881,13 +15875,13 @@ function PreviewBody({ file, kind, state }) {
15881
15875
  ] });
15882
15876
  }
15883
15877
  function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", onClose, actions, className = "" }) {
15884
- const kind = React88.useMemo(() => previewKindOf(file), [file]);
15878
+ const kind = React87.useMemo(() => previewKindOf(file), [file]);
15885
15879
  const preview = usePreview(file, kind, resolveUrl);
15886
- const [tab, setTab] = React88.useState("preview");
15887
- const [downloading, setDownloading] = React88.useState(false);
15888
- const [downloadError, setDownloadError] = React88.useState(null);
15880
+ const [tab, setTab] = React87.useState("preview");
15881
+ const [downloading, setDownloading] = React87.useState(false);
15882
+ const [downloadError, setDownloadError] = React87.useState(null);
15889
15883
  const hasSide = sidePanel != null;
15890
- React88.useEffect(() => {
15884
+ React87.useEffect(() => {
15891
15885
  setTab("preview");
15892
15886
  }, [file.id]);
15893
15887
  const download = () => {
@@ -15954,7 +15948,7 @@ function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", o
15954
15948
  }
15955
15949
 
15956
15950
  // src/components/files/FileBrowser.tsx
15957
- var React89 = __toESM(require("react"), 1);
15951
+ var React88 = __toESM(require("react"), 1);
15958
15952
  var import_jsx_runtime116 = require("react/jsx-runtime");
15959
15953
  function childrenOf(folders, parentId) {
15960
15954
  return folders.filter((f) => f.parentId === parentId).sort((a, b) => a.name.localeCompare(b.name));
@@ -16064,8 +16058,8 @@ function FolderPickerMenu({
16064
16058
  ] });
16065
16059
  }
16066
16060
  function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropPayload, actions, className = "" }) {
16067
- const [over, setOver] = React89.useState(false);
16068
- const dragCounter = React89.useRef(0);
16061
+ const [over, setOver] = React88.useState(false);
16062
+ const dragCounter = React88.useRef(0);
16069
16063
  const dropHandlers = isDropTarget ? {
16070
16064
  onDragEnter: (e) => {
16071
16065
  if (!hasInternalPayload(e)) return;
@@ -16113,8 +16107,8 @@ function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropP
16113
16107
  }
16114
16108
  function TreeNode({ folder, depth, folders, currentFolderId, onNavigate, onMoveInto, canMove }) {
16115
16109
  const kids = childrenOf(folders, folder.id);
16116
- const [expanded, setExpanded] = React89.useState(() => currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId));
16117
- React89.useEffect(() => {
16110
+ const [expanded, setExpanded] = React88.useState(() => currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId));
16111
+ React88.useEffect(() => {
16118
16112
  if (currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId)) setExpanded(true);
16119
16113
  }, [currentFolderId, folder.id, folders]);
16120
16114
  const isCurrent = folder.id === currentFolderId;
@@ -16180,15 +16174,15 @@ function FileBrowser({
16180
16174
  const canUpload = perm.canUpload !== false && !!onUpload;
16181
16175
  const canRemoveFile = perm.canRemoveFile !== false && !!onRemoveFile;
16182
16176
  const canDeleteFolder = perm.canDeleteFolder !== false && !!onDeleteFolder;
16183
- const [createOpen, setCreateOpen] = React89.useState(false);
16184
- const [createName, setCreateName] = React89.useState("");
16185
- const [renameTarget, setRenameTarget] = React89.useState(null);
16186
- const [renameValue, setRenameValue] = React89.useState("");
16187
- const [deleteTarget, setDeleteTarget] = React89.useState(null);
16188
- const uploadInputRef = React89.useRef(null);
16189
- const crumbFolders = React89.useMemo(() => ancestorsOf(folders, currentFolderId), [folders, currentFolderId]);
16190
- const subfolders = React89.useMemo(() => childrenOf(folders, currentFolderId), [folders, currentFolderId]);
16191
- const currentFiles = React89.useMemo(
16177
+ const [createOpen, setCreateOpen] = React88.useState(false);
16178
+ const [createName, setCreateName] = React88.useState("");
16179
+ const [renameTarget, setRenameTarget] = React88.useState(null);
16180
+ const [renameValue, setRenameValue] = React88.useState("");
16181
+ const [deleteTarget, setDeleteTarget] = React88.useState(null);
16182
+ const uploadInputRef = React88.useRef(null);
16183
+ const crumbFolders = React88.useMemo(() => ancestorsOf(folders, currentFolderId), [folders, currentFolderId]);
16184
+ const subfolders = React88.useMemo(() => childrenOf(folders, currentFolderId), [folders, currentFolderId]);
16185
+ const currentFiles = React88.useMemo(
16192
16186
  () => files.filter((f) => f.folderId === currentFolderId).sort((a, b) => a.name.localeCompare(b.name)),
16193
16187
  [files, currentFolderId]
16194
16188
  );
@@ -16420,8 +16414,8 @@ function BreadcrumbCrumb({
16420
16414
  isDropTarget,
16421
16415
  onDropPayload
16422
16416
  }) {
16423
- const [over, setOver] = React89.useState(false);
16424
- const dragCounter = React89.useRef(0);
16417
+ const [over, setOver] = React88.useState(false);
16418
+ const dragCounter = React88.useRef(0);
16425
16419
  const dropHandlers = isDropTarget ? {
16426
16420
  onDragEnter: (e) => {
16427
16421
  if (!hasInternalPayload(e)) return;
@@ -16450,7 +16444,7 @@ function BreadcrumbCrumb({
16450
16444
  }
16451
16445
 
16452
16446
  // src/kits/sessionAdapter.ts
16453
- var React90 = __toESM(require("react"), 1);
16447
+ var React89 = __toESM(require("react"), 1);
16454
16448
  function toSwitcherEntries(apps, currentAppKey) {
16455
16449
  return apps.filter((app) => app.url != null).map((app) => ({
16456
16450
  key: app.key,
@@ -16464,7 +16458,7 @@ function useSessionContextValue(session, { currentAppKey }) {
16464
16458
  const { user, apps, signOut, status } = session;
16465
16459
  const authorized = status === "authenticated";
16466
16460
  const pending = status === "unavailable";
16467
- return React90.useMemo(
16461
+ return React89.useMemo(
16468
16462
  () => ({
16469
16463
  user: { id: user.id, name: user.name, email: user.email, sso: true },
16470
16464
  roles: user.roles.map((r) => ({ id: r.key, name: r.name })),
@@ -16485,7 +16479,7 @@ function useSessionContextValue(session, { currentAppKey }) {
16485
16479
  }
16486
16480
 
16487
16481
  // src/kits/query.ts
16488
- var React91 = __toESM(require("react"), 1);
16482
+ var React90 = __toESM(require("react"), 1);
16489
16483
 
16490
16484
  // src/kits/queryUrl.ts
16491
16485
  var historyUrlAdapter = {
@@ -16623,38 +16617,38 @@ function requestFor(params, query, paging, after) {
16623
16617
  }
16624
16618
  var toError = (e) => e instanceof Error ? e : new Error(String(e));
16625
16619
  function useServerTable({ endpoint, params, defaults, deps, prefsKey, paging = "page", url }) {
16626
- const [base] = React91.useState(() => {
16620
+ const [base] = React90.useState(() => {
16627
16621
  const store = PREFS || window.PlannerPrefs;
16628
16622
  const saved = prefsKey && store ? store.getTable(prefsKey) : {};
16629
16623
  return { ...DEFAULTS, ...defaults || {}, ...saved.pageSize ? { pageSize: saved.pageSize } : {}, ...saved.sort ? { sort: saved.sort, dir: saved.dir || "desc" } : {} };
16630
16624
  });
16631
- const [mountParams] = React91.useState(() => url ? (url.adapter ?? historyUrlAdapter).read() : null);
16632
- const address = React91.useRef(mountParams);
16633
- const [query, setQuery] = React91.useState(() => url && mountParams ? readQueryFromUrl(mountParams, url.scope, base, paging) : base);
16634
- const savePref = React91.useCallback((patch2) => {
16625
+ const [mountParams] = React90.useState(() => url ? (url.adapter ?? historyUrlAdapter).read() : null);
16626
+ const address = React90.useRef(mountParams);
16627
+ const [query, setQuery] = React90.useState(() => url && mountParams ? readQueryFromUrl(mountParams, url.scope, base, paging) : base);
16628
+ const savePref = React90.useCallback((patch2) => {
16635
16629
  const store = PREFS || window.PlannerPrefs;
16636
16630
  if (prefsKey && store) store.setTable(prefsKey, patch2);
16637
16631
  }, [prefsKey]);
16638
- const [res, setRes] = React91.useState(null);
16639
- const [loading, setLoading] = React91.useState(true);
16640
- const [loadingMore, setLoadingMore] = React91.useState(false);
16641
- const [failure, setFailure] = React91.useState(null);
16642
- const [reloadToken, setReloadToken] = React91.useState(0);
16643
- const moreController = React91.useRef(null);
16632
+ const [res, setRes] = React90.useState(null);
16633
+ const [loading, setLoading] = React90.useState(true);
16634
+ const [loadingMore, setLoadingMore] = React90.useState(false);
16635
+ const [failure, setFailure] = React90.useState(null);
16636
+ const [reloadToken, setReloadToken] = React90.useState(0);
16637
+ const moreController = React90.useRef(null);
16644
16638
  const depKey = (deps || []).join("|");
16645
16639
  const paramKey = JSON.stringify(params || {});
16646
16640
  const queryKey = JSON.stringify(query);
16647
- const lifetime = React91.useRef(null);
16648
- React91.useEffect(() => {
16641
+ const lifetime = React90.useRef(null);
16642
+ React90.useEffect(() => {
16649
16643
  const controller = new AbortController();
16650
16644
  lifetime.current = controller;
16651
16645
  return () => controller.abort();
16652
16646
  }, []);
16653
- const latest = React91.useRef({ res, loading, query, params, endpoint, url, base });
16654
- React91.useLayoutEffect(() => {
16647
+ const latest = React90.useRef({ res, loading, query, params, endpoint, url, base });
16648
+ React90.useLayoutEffect(() => {
16655
16649
  latest.current = { res, loading, query, params, endpoint, url, base };
16656
16650
  });
16657
- React91.useEffect(() => {
16651
+ React90.useEffect(() => {
16658
16652
  const controller = new AbortController();
16659
16653
  const { signal } = controller;
16660
16654
  setLoading(true);
@@ -16690,7 +16684,7 @@ function useServerTable({ endpoint, params, defaults, deps, prefsKey, paging = "
16690
16684
  };
16691
16685
  }, [endpoint, queryKey, paramKey, depKey, paging, reloadToken]);
16692
16686
  const adapter = url ? url.adapter ?? historyUrlAdapter : null;
16693
- React91.useEffect(() => {
16687
+ React90.useEffect(() => {
16694
16688
  if (!adapter) return;
16695
16689
  return adapter.subscribe((params2) => {
16696
16690
  const { url: u, base: b } = latest.current;
@@ -17040,12 +17034,12 @@ function createVersionStore(initialState, options) {
17040
17034
  }
17041
17035
 
17042
17036
  // src/kits/documentTitle.ts
17043
- var React92 = __toESM(require("react"), 1);
17037
+ var React91 = __toESM(require("react"), 1);
17044
17038
  function formatDocumentTitle(routeTitle, appName) {
17045
17039
  return [routeTitle, appName, "Flytedesk"].filter((part2) => !!part2 && part2.length > 0).join(" \xB7 ");
17046
17040
  }
17047
17041
  function useDocumentTitle(routeTitle, appName) {
17048
- React92.useEffect(() => {
17042
+ React91.useEffect(() => {
17049
17043
  if (typeof document === "undefined") return;
17050
17044
  document.title = formatDocumentTitle(routeTitle, appName);
17051
17045
  }, [routeTitle, appName]);
@@ -17148,17 +17142,17 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
17148
17142
  }
17149
17143
 
17150
17144
  // src/kits/chatTransport/useChatThreads.ts
17151
- var React93 = __toESM(require("react"), 1);
17145
+ var React92 = __toESM(require("react"), 1);
17152
17146
  var THREADS_LOAD_FAILED = "Your earlier conversations could not be loaded.";
17153
17147
  var NEW_THREAD_FAILED = "A new conversation could not be started.";
17154
17148
  function useChatThreads(transport, { deadlineMs = CHAT_CALL_DEADLINE_MS } = {}) {
17155
17149
  const toast = useToast();
17156
- const [threads, setThreads] = React93.useState([]);
17157
- const [reads, setReads] = React93.useState(0);
17150
+ const [threads, setThreads] = React92.useState([]);
17151
+ const [reads, setReads] = React92.useState(0);
17158
17152
  const transportRef = useLatest(transport);
17159
17153
  const deadlineRef = useLatest(deadlineMs);
17160
- const refresh2 = React93.useCallback(() => setReads((n) => n + 1), []);
17161
- React93.useEffect(() => {
17154
+ const refresh2 = React92.useCallback(() => setReads((n) => n + 1), []);
17155
+ React92.useEffect(() => {
17162
17156
  const controller = new AbortController();
17163
17157
  const { signal } = controller;
17164
17158
  withDeadline("listThreads", deadlineRef.current, transportRef.current.listThreads(signal)).then(
@@ -17171,7 +17165,7 @@ function useChatThreads(transport, { deadlineMs = CHAT_CALL_DEADLINE_MS } = {})
17171
17165
  );
17172
17166
  return () => controller.abort();
17173
17167
  }, [reads, toast, transportRef, deadlineRef]);
17174
- const startNewThread = React93.useCallback(
17168
+ const startNewThread = React92.useCallback(
17175
17169
  (onCreated) => withDeadline("createThread", deadlineRef.current, transportRef.current.createThread()).then(
17176
17170
  ({ thread_id }) => {
17177
17171
  onCreated(thread_id);
@@ -17199,15 +17193,15 @@ function createExportDownloader({
17199
17193
  }
17200
17194
 
17201
17195
  // src/kits/exports/useExportJobs.ts
17202
- var React94 = __toESM(require("react"), 1);
17196
+ var React93 = __toESM(require("react"), 1);
17203
17197
  var EXPORT_POLL_INTERVAL_MS = 3e3;
17204
17198
  var EXPORT_IDLE_POLL_INTERVAL_MS = 3e4;
17205
17199
  function useExportJobs({ list, acknowledge }) {
17206
- const [rows, setRows] = React94.useState([]);
17200
+ const [rows, setRows] = React93.useState([]);
17207
17201
  const listRef = useLatest(list);
17208
17202
  const acknowledgeRef = useLatest(acknowledge);
17209
- const dismissing = React94.useRef(/* @__PURE__ */ new Set());
17210
- const reload = React94.useCallback(
17203
+ const dismissing = React93.useRef(/* @__PURE__ */ new Set());
17204
+ const reload = React93.useCallback(
17211
17205
  () => listRef.current().then(
17212
17206
  (fresh) => setRows(fresh.filter((row) => !dismissing.current.has(row.id))),
17213
17207
  () => {
@@ -17215,16 +17209,16 @@ function useExportJobs({ list, acknowledge }) {
17215
17209
  ),
17216
17210
  [listRef]
17217
17211
  );
17218
- React94.useEffect(() => {
17212
+ React93.useEffect(() => {
17219
17213
  void reload();
17220
17214
  }, [reload]);
17221
17215
  const anyLive = rows.some(isLiveExport);
17222
- React94.useEffect(() => {
17216
+ React93.useEffect(() => {
17223
17217
  const timer = setInterval(() => void reload(), anyLive ? EXPORT_POLL_INTERVAL_MS : EXPORT_IDLE_POLL_INTERVAL_MS);
17224
17218
  return () => clearInterval(timer);
17225
17219
  }, [anyLive, reload]);
17226
- const refresh2 = React94.useCallback(() => void reload(), [reload]);
17227
- const ackExport = React94.useCallback(
17220
+ const refresh2 = React93.useCallback(() => void reload(), [reload]);
17221
+ const ackExport = React93.useCallback(
17228
17222
  (id) => {
17229
17223
  dismissing.current.add(id);
17230
17224
  setRows((current2) => current2.filter((row) => row.id !== id));
@@ -17246,7 +17240,7 @@ function useExportJobs({ list, acknowledge }) {
17246
17240
  }
17247
17241
 
17248
17242
  // src/kits/exports/ExportTray.tsx
17249
- var React95 = __toESM(require("react"), 1);
17243
+ var React94 = __toESM(require("react"), 1);
17250
17244
  var import_jsx_runtime117 = require("react/jsx-runtime");
17251
17245
  var EXPORT_FAILED_FALLBACK = "Unknown error.";
17252
17246
  function exportToJob(job, keptNote, onDownload) {
@@ -17265,7 +17259,7 @@ function exportToJob(job, keptNote, onDownload) {
17265
17259
  return { ...base, status: "active" };
17266
17260
  }
17267
17261
  function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17268
- const jobs2 = React95.useMemo(() => exports2.map((job) => exportToJob(job, keptNote, onDownload)), [exports2, keptNote, onDownload]);
17262
+ const jobs2 = React94.useMemo(() => exports2.map((job) => exportToJob(job, keptNote, onDownload)), [exports2, keptNote, onDownload]);
17269
17263
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(JobTray, { jobs: jobs2, onDismiss });
17270
17264
  }
17271
17265
  // Annotate the CommonJS export names for ESM import in node: