@moontra/moonui 2.3.10 → 2.4.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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  import * as t from 'react';
4
4
  import t__default, { useState, useCallback, useEffect } from 'react';
5
5
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
6
- import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, CreditCard, Minus, Search, ChevronRight, Circle, Upload, ChevronUp, Phone, Bold, Italic, Underline, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code, Link, Image, Palette, Undo, Redo, Edit, Eye, CheckCircle, Video, Music, FileText, File, Copy, ArrowDown, ArrowUp, ArrowUpDown, ChevronLeft, Calendar as Calendar$1, Clock, Star, GitFork, ExternalLink, Crown, Lock, Zap } from 'lucide-react';
6
+ import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, CreditCard, Minus, Search, ChevronRight, Circle, Upload, ChevronUp, Phone, Bold, Italic, Underline, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code, Link, Image, Palette, Undo, Redo, Edit, Eye, Copy, ArrowDown, ArrowUp, ArrowUpDown, ChevronLeft, Calendar as Calendar$1, Clock, CheckCircle, Star, GitFork, ExternalLink, Crown, Lock, Zap, Video, Music, FileText, File } from 'lucide-react';
7
7
  export { Palette, Pipette } from 'lucide-react';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
@@ -18,7 +18,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
18
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
19
19
  import * as TabsPrimitive from '@radix-ui/react-tabs';
20
20
  import * as DialogPrimitive from '@radix-ui/react-dialog';
21
- import { isValid, format, isSameMonth, isToday, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek, subMonths, addMonths, isSameDay } from 'date-fns';
21
+ import { isValid, format, isSameMonth, isToday, subMonths, addMonths, isSameDay, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek } from 'date-fns';
22
22
  export { format } from 'date-fns';
23
23
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
24
24
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -934,7 +934,26 @@ var springAnimations = {
934
934
  type: "spring",
935
935
  stiffness: 260,
936
936
  damping: 20
937
- }};
937
+ },
938
+ // Bouncy spring for playful interactions
939
+ bouncy: {
940
+ type: "spring",
941
+ stiffness: 300,
942
+ damping: 15
943
+ },
944
+ // Stiff spring for quick responses
945
+ stiff: {
946
+ type: "spring",
947
+ stiffness: 400,
948
+ damping: 25
949
+ },
950
+ // Gentle spring for subtle movements
951
+ gentle: {
952
+ type: "spring",
953
+ stiffness: 150,
954
+ damping: 15
955
+ }
956
+ };
938
957
  var hoverAnimations = {
939
958
  lift: {
940
959
  y: -2,
@@ -947,12 +966,22 @@ var hoverAnimations = {
947
966
  glow: {
948
967
  boxShadow: "0 0 20px rgba(var(--primary), 0.3)",
949
968
  transition: springAnimations.smooth
950
- }};
969
+ },
970
+ rotate: {
971
+ rotate: 2,
972
+ transition: springAnimations.bouncy
973
+ }
974
+ };
951
975
  var tapAnimations = {
952
976
  scale: {
953
977
  scale: 0.95,
954
978
  transition: { duration: 0.1 }
955
- }};
979
+ },
980
+ depress: {
981
+ y: 1,
982
+ transition: { duration: 0.1 }
983
+ }
984
+ };
956
985
  var skeletonAnimation = {
957
986
  initial: { opacity: 0.5 },
958
987
  animate: {
@@ -1077,7 +1106,8 @@ var getCardType = (number) => {
1077
1106
  jcb: /^35/
1078
1107
  };
1079
1108
  for (const [type, pattern] of Object.entries(patterns)) {
1080
- if (pattern.test(number)) return type;
1109
+ if (pattern.test(number))
1110
+ return type;
1081
1111
  }
1082
1112
  return "unknown";
1083
1113
  };
@@ -1087,8 +1117,10 @@ var formatCardNumber = (value, cardType) => {
1087
1117
  let formatted = "";
1088
1118
  let position = 0;
1089
1119
  for (const group of groups) {
1090
- if (position >= cleaned.length) break;
1091
- if (formatted) formatted += " ";
1120
+ if (position >= cleaned.length)
1121
+ break;
1122
+ if (formatted)
1123
+ formatted += " ";
1092
1124
  formatted += cleaned.slice(position, position + group);
1093
1125
  position += group;
1094
1126
  }
@@ -1414,8 +1446,10 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
1414
1446
  function useContext22(consumerName, scope) {
1415
1447
  const Context = scope?.[scopeName]?.[index] || BaseContext;
1416
1448
  const context = t.useContext(Context);
1417
- if (context) return context;
1418
- if (defaultContext !== void 0) return defaultContext;
1449
+ if (context)
1450
+ return context;
1451
+ if (defaultContext !== void 0)
1452
+ return defaultContext;
1419
1453
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
1420
1454
  }
1421
1455
  return [Provider3, useContext22];
@@ -1437,7 +1471,8 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
1437
1471
  }
1438
1472
  function composeContextScopes(...scopes) {
1439
1473
  const baseScope = scopes[0];
1440
- if (scopes.length === 1) return baseScope;
1474
+ if (scopes.length === 1)
1475
+ return baseScope;
1441
1476
  const createScope = () => {
1442
1477
  const scopeHooks = scopes.map((createScope2) => ({
1443
1478
  useScope: createScope2(),
@@ -1714,12 +1749,13 @@ var count = 0;
1714
1749
  function useId2(deterministicId) {
1715
1750
  const [id, setId] = t.useState(useReactId());
1716
1751
  useLayoutEffect2(() => {
1717
- setId((reactId) => reactId ?? String(count++));
1752
+ if (!deterministicId)
1753
+ setId((reactId) => reactId ?? String(count++));
1718
1754
  }, [deterministicId]);
1719
1755
  return deterministicId || (id ? `radix-${id}` : "");
1720
1756
  }
1721
1757
  var COLLAPSIBLE_NAME = "Collapsible";
1722
- var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
1758
+ var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
1723
1759
  var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
1724
1760
  var Collapsible = t.forwardRef(
1725
1761
  (props, forwardedRef) => {
@@ -1958,10 +1994,10 @@ var inputVariants = cva(
1958
1994
  {
1959
1995
  variants: {
1960
1996
  variant: {
1961
- standard: "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-2 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:bg-gray-900/60 dark:shadow-inner dark:shadow-gray-950/10",
1962
- filled: "border border-transparent bg-gray-100 dark:bg-gray-800/90 rounded-md px-3 py-2 hover:bg-gray-200 dark:hover:bg-gray-700/90 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 dark:shadow-inner dark:shadow-gray-950/10",
1997
+ standard: "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-2 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:bg-gray-800/80 dark:shadow-inner dark:shadow-gray-950/10",
1998
+ filled: "border border-transparent bg-gray-100 dark:bg-gray-800 rounded-md px-3 py-2 hover:bg-gray-200 dark:hover:bg-gray-700 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 dark:shadow-inner dark:shadow-gray-950/10",
1963
1999
  ghost: "border-none bg-transparent shadow-none px-1 dark:text-gray-300 dark:placeholder:text-gray-500 hover:bg-gray-100/50 dark:hover:bg-gray-800/30 focus-visible:bg-transparent",
1964
- underline: "border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 py-2 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:text-gray-300"
2000
+ underline: "border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 py-2 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:text-gray-300 dark:bg-transparent"
1965
2001
  },
1966
2002
  size: {
1967
2003
  sm: "h-8 text-xs",
@@ -2021,12 +2057,59 @@ var Input = t.forwardRef(
2021
2057
  rightIcon,
2022
2058
  rightButton,
2023
2059
  alwaysShowMessage = false,
2060
+ label,
2061
+ floatingLabel = false,
2062
+ floatingLabelClassName,
2063
+ value,
2064
+ defaultValue,
2065
+ onChange,
2066
+ onFocus,
2067
+ onBlur,
2068
+ placeholder,
2024
2069
  ...props
2025
2070
  }, ref) => {
2071
+ const [isFocused, setIsFocused] = t.useState(false);
2072
+ const [internalValue, setInternalValue] = t.useState(value || defaultValue || "");
2073
+ const hasValue = internalValue !== "" && internalValue !== null && internalValue !== void 0;
2074
+ const isLabelActive = isFocused || hasValue;
2075
+ const handleFocus = (e) => {
2076
+ setIsFocused(true);
2077
+ onFocus?.(e);
2078
+ };
2079
+ const handleBlur = (e) => {
2080
+ setIsFocused(false);
2081
+ onBlur?.(e);
2082
+ };
2083
+ const handleChange = (e) => {
2084
+ setInternalValue(e.target.value);
2085
+ onChange?.(e);
2086
+ };
2087
+ t.useEffect(() => {
2088
+ if (value !== void 0) {
2089
+ setInternalValue(value);
2090
+ }
2091
+ }, [value]);
2026
2092
  const showMessage = alwaysShowMessage || error || success;
2027
2093
  const messageType = error ? "error" : success ? "success" : "normal";
2028
2094
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 w-full", children: [
2029
2095
  /* @__PURE__ */ jsxs("div", { className: cn("moonui-theme", inputWrapperVariants({ size }), wrapperClassName), children: [
2096
+ floatingLabel && label && /* @__PURE__ */ jsx(
2097
+ "label",
2098
+ {
2099
+ htmlFor: props.id,
2100
+ className: cn(
2101
+ "absolute transition-all duration-200 pointer-events-none",
2102
+ leftIcon || loading ? "left-10" : "left-3",
2103
+ "text-gray-500 dark:text-gray-400",
2104
+ isLabelActive ? "top-0 -translate-y-1/2 text-xs bg-background dark:bg-gray-800 px-1" : "top-1/2 -translate-y-1/2 text-sm",
2105
+ isFocused && "text-primary dark:text-primary",
2106
+ !!error && "text-error",
2107
+ disabled && "opacity-50",
2108
+ floatingLabelClassName
2109
+ ),
2110
+ children: label
2111
+ }
2112
+ ),
2030
2113
  leftIcon && /* @__PURE__ */ jsx("div", { className: "absolute left-3 text-gray-500 flex items-center justify-center pointer-events-none", children: loading ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : leftIcon }),
2031
2114
  /* @__PURE__ */ jsx(
2032
2115
  "input",
@@ -2051,6 +2134,12 @@ var Input = t.forwardRef(
2051
2134
  "data-success": !!success ? "" : void 0,
2052
2135
  "aria-invalid": !!error || !!isError || void 0,
2053
2136
  "aria-describedby": error ? `${props.id || ""}-error` : success ? `${props.id || ""}-success` : void 0,
2137
+ value,
2138
+ defaultValue,
2139
+ onChange: handleChange,
2140
+ onFocus: handleFocus,
2141
+ onBlur: handleBlur,
2142
+ placeholder: floatingLabel ? isLabelActive ? placeholder : "" : placeholder,
2054
2143
  ...props
2055
2144
  }
2056
2145
  ),
@@ -2463,9 +2552,11 @@ var Slider = t.forwardRef(({
2463
2552
  }
2464
2553
  };
2465
2554
  const handleTrackClick = (event) => {
2466
- if (disabled) return;
2555
+ if (disabled)
2556
+ return;
2467
2557
  const track = trackRef.current;
2468
- if (!track) return;
2558
+ if (!track)
2559
+ return;
2469
2560
  const rect = track.getBoundingClientRect();
2470
2561
  const percent = (event.clientX - rect.left) / rect.width;
2471
2562
  const rawValue = min2 + percent * (max2 - min2);
@@ -2476,11 +2567,13 @@ var Slider = t.forwardRef(({
2476
2567
  handleValueChange(newValues);
2477
2568
  };
2478
2569
  const handleThumbMouseDown = (index) => (event) => {
2479
- if (disabled) return;
2570
+ if (disabled)
2571
+ return;
2480
2572
  event.preventDefault();
2481
2573
  const handleMouseMove = (moveEvent) => {
2482
2574
  const track = trackRef.current;
2483
- if (!track) return;
2575
+ if (!track)
2576
+ return;
2484
2577
  const rect = track.getBoundingClientRect();
2485
2578
  const percent = (moveEvent.clientX - rect.left) / rect.width;
2486
2579
  const rawValue = min2 + percent * (max2 - min2);
@@ -2597,7 +2690,8 @@ function rgbToHex(r, g, b) {
2597
2690
  }
2598
2691
  function hexToHsl(hex) {
2599
2692
  const rgb = hexToRgb(hex);
2600
- if (!rgb) return null;
2693
+ if (!rgb)
2694
+ return null;
2601
2695
  const r = rgb.r / 255;
2602
2696
  const g = rgb.g / 255;
2603
2697
  const b = rgb.b / 255;
@@ -2636,11 +2730,16 @@ function hslToHex(h, s, l) {
2636
2730
  r = g = b = l;
2637
2731
  } else {
2638
2732
  const hue2rgb = (p3, q2, t2) => {
2639
- if (t2 < 0) t2 += 1;
2640
- if (t2 > 1) t2 -= 1;
2641
- if (t2 < 1 / 6) return p3 + (q2 - p3) * 6 * t2;
2642
- if (t2 < 1 / 2) return q2;
2643
- if (t2 < 2 / 3) return p3 + (q2 - p3) * (2 / 3 - t2) * 6;
2733
+ if (t2 < 0)
2734
+ t2 += 1;
2735
+ if (t2 > 1)
2736
+ t2 -= 1;
2737
+ if (t2 < 1 / 6)
2738
+ return p3 + (q2 - p3) * 6 * t2;
2739
+ if (t2 < 1 / 2)
2740
+ return q2;
2741
+ if (t2 < 2 / 3)
2742
+ return p3 + (q2 - p3) * (2 / 3 - t2) * 6;
2644
2743
  return p3;
2645
2744
  };
2646
2745
  const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
@@ -2757,8 +2856,10 @@ function ColorPicker({
2757
2856
  }
2758
2857
  };
2759
2858
  const formatDisplay = () => {
2760
- if (format4 === "rgb") return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
2761
- if (format4 === "hsl") return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
2859
+ if (format4 === "rgb")
2860
+ return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
2861
+ if (format4 === "hsl")
2862
+ return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
2762
2863
  return color;
2763
2864
  };
2764
2865
  return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
@@ -3175,10 +3276,13 @@ var B = /[\\\/_+.#"@\[\(\{&]/g;
3175
3276
  var K = /[\s-]/;
3176
3277
  var X2 = /[\s-]/g;
3177
3278
  function G(_, C, h, P2, A, f, O) {
3178
- if (f === C.length) return A === _.length ? U : k;
3279
+ if (f === C.length)
3280
+ return A === _.length ? U : k;
3179
3281
  var T2 = `${A},${f}`;
3180
- if (O[T2] !== void 0) return O[T2];
3181
- for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; ) E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X2), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
3282
+ if (O[T2] !== void 0)
3283
+ return O[T2];
3284
+ for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; )
3285
+ E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X2), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
3182
3286
  return O[T2] = S, S;
3183
3287
  }
3184
3288
  function D(_) {
@@ -3187,6 +3291,88 @@ function D(_) {
3187
3291
  function W(_, C, h) {
3188
3292
  return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
3189
3293
  }
3294
+ var NODES2 = [
3295
+ "a",
3296
+ "button",
3297
+ "div",
3298
+ "form",
3299
+ "h2",
3300
+ "h3",
3301
+ "img",
3302
+ "input",
3303
+ "label",
3304
+ "li",
3305
+ "nav",
3306
+ "ol",
3307
+ "p",
3308
+ "select",
3309
+ "span",
3310
+ "svg",
3311
+ "ul"
3312
+ ];
3313
+ var Primitive2 = NODES2.reduce((primitive, node) => {
3314
+ const Slot = createSlot(`Primitive.${node}`);
3315
+ const Node = t.forwardRef((props, forwardedRef) => {
3316
+ const { asChild, ...primitiveProps } = props;
3317
+ const Comp = asChild ? Slot : node;
3318
+ if (typeof window !== "undefined") {
3319
+ window[Symbol.for("radix-ui")] = true;
3320
+ }
3321
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
3322
+ });
3323
+ Node.displayName = `Primitive.${node}`;
3324
+ return { ...primitive, [node]: Node };
3325
+ }, {});
3326
+ var useLayoutEffect22 = globalThis?.document ? t.useLayoutEffect : () => {
3327
+ };
3328
+
3329
+ // ../../node_modules/@radix-ui/react-id/dist/index.mjs
3330
+ var useReactId2 = t[" useId ".trim().toString()] || (() => void 0);
3331
+ var count2 = 0;
3332
+ function useId3(deterministicId) {
3333
+ const [id, setId] = t.useState(useReactId2());
3334
+ useLayoutEffect22(() => {
3335
+ if (!deterministicId)
3336
+ setId((reactId) => reactId ?? String(count2++));
3337
+ }, [deterministicId]);
3338
+ return deterministicId || (id ? `radix-${id}` : "");
3339
+ }
3340
+ function setRef2(ref, value) {
3341
+ if (typeof ref === "function") {
3342
+ return ref(value);
3343
+ } else if (ref !== null && ref !== void 0) {
3344
+ ref.current = value;
3345
+ }
3346
+ }
3347
+ function composeRefs2(...refs) {
3348
+ return (node) => {
3349
+ let hasCleanup = false;
3350
+ const cleanups = refs.map((ref) => {
3351
+ const cleanup = setRef2(ref, node);
3352
+ if (!hasCleanup && typeof cleanup == "function") {
3353
+ hasCleanup = true;
3354
+ }
3355
+ return cleanup;
3356
+ });
3357
+ if (hasCleanup) {
3358
+ return () => {
3359
+ for (let i = 0; i < cleanups.length; i++) {
3360
+ const cleanup = cleanups[i];
3361
+ if (typeof cleanup == "function") {
3362
+ cleanup();
3363
+ } else {
3364
+ setRef2(refs[i], null);
3365
+ }
3366
+ }
3367
+ };
3368
+ }
3369
+ };
3370
+ }
3371
+ function useComposedRefs2(...refs) {
3372
+ return t.useCallback(composeRefs2(...refs), refs);
3373
+ }
3374
+
3375
+ // ../../node_modules/cmdk/dist/index.mjs
3190
3376
  var N = '[cmdk-group=""]';
3191
3377
  var Y2 = '[cmdk-group-items=""]';
3192
3378
  var be = '[cmdk-group-heading=""]';
@@ -3204,7 +3390,7 @@ var me = t.forwardRef((r, o) => {
3204
3390
  let n = L(() => {
3205
3391
  var e, a;
3206
3392
  return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
3207
- }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId2(), q = useId2(), _ = useId2(), I = t.useRef(null), v = ke();
3393
+ }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId3(), q = useId3(), _ = useId3(), I = t.useRef(null), v = ke();
3208
3394
  k2(() => {
3209
3395
  if (R !== void 0) {
3210
3396
  let e = R.trim();
@@ -3216,7 +3402,8 @@ var me = t.forwardRef((r, o) => {
3216
3402
  let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
3217
3403
  var i, l, g, y;
3218
3404
  if (!Object.is(n.current[e], a)) {
3219
- if (n.current[e] = a, e === "search") J2(), z(), v(1, W2);
3405
+ if (n.current[e] = a, e === "search")
3406
+ J2(), z(), v(1, W2);
3220
3407
  else if (e === "value") {
3221
3408
  if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
3222
3409
  let h = document.getElementById(_);
@@ -3257,7 +3444,8 @@ var me = t.forwardRef((r, o) => {
3257
3444
  return e ? s(e, n.current.search, a) : 0;
3258
3445
  }
3259
3446
  function z() {
3260
- if (!n.current.search || p2.current.shouldFilter === false) return;
3447
+ if (!n.current.search || p2.current.shouldFilter === false)
3448
+ return;
3261
3449
  let e = n.current.filtered.items, a = [];
3262
3450
  n.current.filtered.groups.forEach((i) => {
3263
3451
  let l = c.current.get(i), g = 0;
@@ -3296,10 +3484,12 @@ var me = t.forwardRef((r, o) => {
3296
3484
  let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h);
3297
3485
  n.current.filtered.items.set(g, F), F > 0 && e++;
3298
3486
  }
3299
- for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
3300
- n.current.filtered.groups.add(g);
3301
- break;
3302
- }
3487
+ for (let [g, y] of c.current)
3488
+ for (let h of y)
3489
+ if (n.current.filtered.items.get(h) > 0) {
3490
+ n.current.filtered.groups.add(g);
3491
+ break;
3492
+ }
3303
3493
  n.current.filtered.count = e;
3304
3494
  }
3305
3495
  function ne() {
@@ -3326,7 +3516,8 @@ var me = t.forwardRef((r, o) => {
3326
3516
  }
3327
3517
  function re(e) {
3328
3518
  let a = M(), s = a == null ? void 0 : a.closest(N), i;
3329
- for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
3519
+ for (; s && !i; )
3520
+ s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
3330
3521
  i ? E.setState("value", i.getAttribute(T)) : Q(e);
3331
3522
  }
3332
3523
  let oe = () => X7(V().length - 1), ie = (e) => {
@@ -3334,58 +3525,61 @@ var me = t.forwardRef((r, o) => {
3334
3525
  }, se = (e) => {
3335
3526
  e.preventDefault(), e.metaKey ? X7(0) : e.altKey ? re(-1) : Q(-1);
3336
3527
  };
3337
- return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
3528
+ return t.createElement(Primitive2.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
3338
3529
  var s;
3339
3530
  (s = O.onKeyDown) == null || s.call(O, e);
3340
3531
  let a = e.nativeEvent.isComposing || e.keyCode === 229;
3341
- if (!(e.defaultPrevented || a)) switch (e.key) {
3342
- case "n":
3343
- case "j": {
3344
- j && e.ctrlKey && ie(e);
3345
- break;
3346
- }
3347
- case "ArrowDown": {
3348
- ie(e);
3349
- break;
3350
- }
3351
- case "p":
3352
- case "k": {
3353
- j && e.ctrlKey && se(e);
3354
- break;
3355
- }
3356
- case "ArrowUp": {
3357
- se(e);
3358
- break;
3359
- }
3360
- case "Home": {
3361
- e.preventDefault(), X7(0);
3362
- break;
3363
- }
3364
- case "End": {
3365
- e.preventDefault(), oe();
3366
- break;
3367
- }
3368
- case "Enter": {
3369
- e.preventDefault();
3370
- let i = M();
3371
- if (i) {
3372
- let l = new Event(Z);
3373
- i.dispatchEvent(l);
3532
+ if (!(e.defaultPrevented || a))
3533
+ switch (e.key) {
3534
+ case "n":
3535
+ case "j": {
3536
+ j && e.ctrlKey && ie(e);
3537
+ break;
3538
+ }
3539
+ case "ArrowDown": {
3540
+ ie(e);
3541
+ break;
3542
+ }
3543
+ case "p":
3544
+ case "k": {
3545
+ j && e.ctrlKey && se(e);
3546
+ break;
3547
+ }
3548
+ case "ArrowUp": {
3549
+ se(e);
3550
+ break;
3551
+ }
3552
+ case "Home": {
3553
+ e.preventDefault(), X7(0);
3554
+ break;
3555
+ }
3556
+ case "End": {
3557
+ e.preventDefault(), oe();
3558
+ break;
3559
+ }
3560
+ case "Enter": {
3561
+ e.preventDefault();
3562
+ let i = M();
3563
+ if (i) {
3564
+ let l = new Event(Z);
3565
+ i.dispatchEvent(l);
3566
+ }
3374
3567
  }
3375
3568
  }
3376
- }
3377
3569
  } }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e))));
3378
3570
  });
3379
3571
  var he = t.forwardRef((r, o) => {
3380
3572
  var _, I;
3381
- let n = useId2(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
3573
+ let n = useId3(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
3382
3574
  k2(() => {
3383
- if (!p2) return d.item(n, c == null ? void 0 : c.id);
3575
+ if (!p2)
3576
+ return d.item(n, c == null ? void 0 : c.id);
3384
3577
  }, [p2]);
3385
3578
  let b = ve(n, u2, [r.value, r.children, u2], r.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true);
3386
3579
  t.useEffect(() => {
3387
3580
  let v = u2.current;
3388
- if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
3581
+ if (!(!v || r.disabled))
3582
+ return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
3389
3583
  }, [x, r.onSelect, r.disabled]);
3390
3584
  function C() {
3391
3585
  var v, E;
@@ -3394,25 +3588,26 @@ var he = t.forwardRef((r, o) => {
3394
3588
  function S() {
3395
3589
  m2.setState("value", b.current, true);
3396
3590
  }
3397
- if (!x) return null;
3591
+ if (!x)
3592
+ return null;
3398
3593
  let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
3399
- return t.createElement(Primitive.div, { ref: composeRefs(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
3594
+ return t.createElement(Primitive2.div, { ref: composeRefs2(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
3400
3595
  });
3401
3596
  var Ee = t.forwardRef((r, o) => {
3402
- let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId2(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId2(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
3597
+ let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId3(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId3(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
3403
3598
  k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
3404
3599
  let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
3405
- return t.createElement(Primitive.div, { ref: composeRefs(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
3600
+ return t.createElement(Primitive2.div, { ref: composeRefs2(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
3406
3601
  });
3407
3602
  var ye = t.forwardRef((r, o) => {
3408
3603
  let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
3409
- return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" });
3604
+ return !n && !d ? null : t.createElement(Primitive2.div, { ref: composeRefs2(c, o), ...u2, "cmdk-separator": "", role: "separator" });
3410
3605
  });
3411
3606
  var Se = t.forwardRef((r, o) => {
3412
3607
  let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
3413
3608
  return t.useEffect(() => {
3414
3609
  r.value != null && d.setState("search", r.value);
3415
- }, [r.value]), t.createElement(Primitive.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
3610
+ }, [r.value]), t.createElement(Primitive2.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
3416
3611
  c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
3417
3612
  } });
3418
3613
  });
@@ -3430,29 +3625,31 @@ var Ce = t.forwardRef((r, o) => {
3430
3625
  cancelAnimationFrame(x), C.unobserve(m2);
3431
3626
  };
3432
3627
  }
3433
- }, []), t.createElement(Primitive.div, { ref: composeRefs(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
3628
+ }, []), t.createElement(Primitive2.div, { ref: composeRefs2(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs2(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
3434
3629
  });
3435
3630
  var xe = t.forwardRef((r, o) => {
3436
3631
  let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
3437
3632
  return t.createElement(DialogPrimitive.Root, { open: n, onOpenChange: u2 }, t.createElement(DialogPrimitive.Portal, { container: f }, t.createElement(DialogPrimitive.Overlay, { "cmdk-overlay": "", className: c }), t.createElement(DialogPrimitive.Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
3438
3633
  });
3439
- var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
3634
+ var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive2.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
3440
3635
  var Pe = t.forwardRef((r, o) => {
3441
3636
  let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
3442
- return t.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
3637
+ return t.createElement(Primitive2.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
3443
3638
  });
3444
3639
  var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
3445
3640
  function we(r, o) {
3446
3641
  let n = r.nextElementSibling;
3447
3642
  for (; n; ) {
3448
- if (n.matches(o)) return n;
3643
+ if (n.matches(o))
3644
+ return n;
3449
3645
  n = n.nextElementSibling;
3450
3646
  }
3451
3647
  }
3452
3648
  function De(r, o) {
3453
3649
  let n = r.previousElementSibling;
3454
3650
  for (; n; ) {
3455
- if (n.matches(o)) return n;
3651
+ if (n.matches(o))
3652
+ return n;
3456
3653
  n = n.previousElementSibling;
3457
3654
  }
3458
3655
  }
@@ -3478,8 +3675,10 @@ function ve(r, o, n, u2 = []) {
3478
3675
  let f = (() => {
3479
3676
  var m2;
3480
3677
  for (let R of n) {
3481
- if (typeof R == "string") return R.trim();
3482
- if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
3678
+ if (typeof R == "string")
3679
+ return R.trim();
3680
+ if (typeof R == "object" && "current" in R)
3681
+ return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
3483
3682
  }
3484
3683
  })(), p2 = u2.map((m2) => m2.trim());
3485
3684
  d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
@@ -3897,7 +4096,8 @@ function memo(getDeps, fn, opts) {
3897
4096
  let result;
3898
4097
  return (depArgs) => {
3899
4098
  let depTime;
3900
- if (opts.key && opts.debug) depTime = Date.now();
4099
+ if (opts.key && opts.debug)
4100
+ depTime = Date.now();
3901
4101
  const newDeps = getDeps(depArgs);
3902
4102
  const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
3903
4103
  if (!depsChanged) {
@@ -3905,7 +4105,8 @@ function memo(getDeps, fn, opts) {
3905
4105
  }
3906
4106
  deps = newDeps;
3907
4107
  let resultTime;
3908
- if (opts.key && opts.debug) resultTime = Date.now();
4108
+ if (opts.key && opts.debug)
4109
+ resultTime = Date.now();
3909
4110
  result = fn(...newDeps);
3910
4111
  opts == null || opts.onChange == null || opts.onChange(result);
3911
4112
  if (opts.key && opts.debug) {
@@ -4276,7 +4477,7 @@ var createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
4276
4477
  var _row$getValue;
4277
4478
  return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
4278
4479
  },
4279
- subRows: [],
4480
+ subRows: subRows != null ? subRows : [],
4280
4481
  getLeafRows: () => flattenBy(row.subRows, (d) => d.subRows),
4281
4482
  getParentRow: () => row.parentId ? table.getRow(row.parentId, true) : void 0,
4282
4483
  getParentRows: () => {
@@ -4284,7 +4485,8 @@ var createRow = (table, id, original, rowIndex, depth, subRows, parentId) => {
4284
4485
  let currentRow = row;
4285
4486
  while (true) {
4286
4487
  const parentRow = currentRow.getParentRow();
4287
- if (!parentRow) break;
4488
+ if (!parentRow)
4489
+ break;
4288
4490
  parentRows.push(parentRow);
4289
4491
  currentRow = parentRow;
4290
4492
  }
@@ -4572,25 +4774,29 @@ var extent = (columnId, _leafRows, childRows) => {
4572
4774
  const value = row.getValue(columnId);
4573
4775
  if (value != null) {
4574
4776
  if (min2 === void 0) {
4575
- if (value >= value) min2 = max2 = value;
4777
+ if (value >= value)
4778
+ min2 = max2 = value;
4576
4779
  } else {
4577
- if (min2 > value) min2 = value;
4578
- if (max2 < value) max2 = value;
4780
+ if (min2 > value)
4781
+ min2 = value;
4782
+ if (max2 < value)
4783
+ max2 = value;
4579
4784
  }
4580
4785
  }
4581
4786
  });
4582
4787
  return [min2, max2];
4583
4788
  };
4584
4789
  var mean = (columnId, leafRows) => {
4585
- let count3 = 0;
4790
+ let count4 = 0;
4586
4791
  let sum2 = 0;
4587
4792
  leafRows.forEach((row) => {
4588
4793
  let value = row.getValue(columnId);
4589
4794
  if (value != null && (value = +value) >= value) {
4590
- ++count3, sum2 += value;
4795
+ ++count4, sum2 += value;
4591
4796
  }
4592
4797
  });
4593
- if (count3) return sum2 / count3;
4798
+ if (count4)
4799
+ return sum2 / count4;
4594
4800
  return;
4595
4801
  };
4596
4802
  var median = (columnId, leafRows) => {
@@ -4614,7 +4820,7 @@ var unique = (columnId, leafRows) => {
4614
4820
  var uniqueCount = (columnId, leafRows) => {
4615
4821
  return new Set(leafRows.map((d) => d.getValue(columnId))).size;
4616
4822
  };
4617
- var count2 = (_columnId, leafRows) => {
4823
+ var count3 = (_columnId, leafRows) => {
4618
4824
  return leafRows.length;
4619
4825
  };
4620
4826
  var aggregationFns = {
@@ -4626,7 +4832,7 @@ var aggregationFns = {
4626
4832
  median,
4627
4833
  unique,
4628
4834
  uniqueCount,
4629
- count: count2
4835
+ count: count3
4630
4836
  };
4631
4837
  var ColumnGrouping = {
4632
4838
  getDefaultColumnDef: () => {
@@ -4674,7 +4880,8 @@ var ColumnGrouping = {
4674
4880
  column.getToggleGroupingHandler = () => {
4675
4881
  const canGroup = column.getCanGroup();
4676
4882
  return () => {
4677
- if (!canGroup) return;
4883
+ if (!canGroup)
4884
+ return;
4678
4885
  column.toggleGrouping();
4679
4886
  };
4680
4887
  };
@@ -5137,7 +5344,8 @@ var ColumnSizing = {
5137
5344
  };
5138
5345
  var passiveSupported = null;
5139
5346
  function passiveEventSupported() {
5140
- if (typeof passiveSupported === "boolean") return passiveSupported;
5347
+ if (typeof passiveSupported === "boolean")
5348
+ return passiveSupported;
5141
5349
  let supported = false;
5142
5350
  try {
5143
5351
  const options = {
@@ -5331,7 +5539,8 @@ var RowExpanding = {
5331
5539
  return;
5332
5540
  }
5333
5541
  if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
5334
- if (queued) return;
5542
+ if (queued)
5543
+ return;
5335
5544
  queued = true;
5336
5545
  table._queue(() => {
5337
5546
  table.resetExpanded();
@@ -5448,7 +5657,8 @@ var RowExpanding = {
5448
5657
  row.getToggleExpandedHandler = () => {
5449
5658
  const canExpand = row.getCanExpand();
5450
5659
  return () => {
5451
- if (!canExpand) return;
5660
+ if (!canExpand)
5661
+ return;
5452
5662
  row.toggleExpanded();
5453
5663
  };
5454
5664
  };
@@ -5487,7 +5697,8 @@ var RowPagination = {
5487
5697
  return;
5488
5698
  }
5489
5699
  if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
5490
- if (queued) return;
5700
+ if (queued)
5701
+ return;
5491
5702
  queued = true;
5492
5703
  table._queue(() => {
5493
5704
  table.resetPageIndex();
@@ -5680,7 +5891,8 @@ var RowPinning = {
5680
5891
  row.getPinnedIndex = () => {
5681
5892
  var _ref4, _visiblePinnedRowIds$;
5682
5893
  const position = row.getIsPinned();
5683
- if (!position) return -1;
5894
+ if (!position)
5895
+ return -1;
5684
5896
  const visiblePinnedRowIds = (_ref4 = position === "top" ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map((_ref5) => {
5685
5897
  let {
5686
5898
  id
@@ -5921,7 +6133,8 @@ var RowSelection = {
5921
6133
  const canSelect = row.getCanSelect();
5922
6134
  return (e) => {
5923
6135
  var _target;
5924
- if (!canSelect) return;
6136
+ if (!canSelect)
6137
+ return;
5925
6138
  row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
5926
6139
  };
5927
6140
  };
@@ -5979,7 +6192,8 @@ function isRowSelected(row, selection) {
5979
6192
  }
5980
6193
  function isSubRowSelected(row, selection, table) {
5981
6194
  var _row$subRows3;
5982
- if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
6195
+ if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length))
6196
+ return false;
5983
6197
  let allChildrenSelected = true;
5984
6198
  let someSelected = false;
5985
6199
  row.subRows.forEach((subRow) => {
@@ -6238,7 +6452,8 @@ var RowSorting = {
6238
6452
  column.getToggleSortingHandler = () => {
6239
6453
  const canSort = column.getCanSort();
6240
6454
  return (e) => {
6241
- if (!canSort) return;
6455
+ if (!canSort)
6456
+ return;
6242
6457
  e.persist == null || e.persist();
6243
6458
  column.toggleSorting == null || column.toggleSorting(void 0, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
6244
6459
  };
@@ -6721,7 +6936,8 @@ function getSortedRowModel() {
6721
6936
  const columnInfoById = {};
6722
6937
  availableSorting.forEach((sortEntry) => {
6723
6938
  const column = table.getColumn(sortEntry.id);
6724
- if (!column) return;
6939
+ if (!column)
6940
+ return;
6725
6941
  columnInfoById[sortEntry.id] = {
6726
6942
  sortUndefined: column.columnDef.sortUndefined,
6727
6943
  invertSorting: column.columnDef.invertSorting,
@@ -6746,8 +6962,10 @@ function getSortedRowModel() {
6746
6962
  const aUndefined = aValue === void 0;
6747
6963
  const bUndefined = bValue === void 0;
6748
6964
  if (aUndefined || bUndefined) {
6749
- if (sortUndefined === "first") return aUndefined ? -1 : 1;
6750
- if (sortUndefined === "last") return aUndefined ? 1 : -1;
6965
+ if (sortUndefined === "first")
6966
+ return aUndefined ? -1 : 1;
6967
+ if (sortUndefined === "last")
6968
+ return aUndefined ? 1 : -1;
6751
6969
  sortInt = aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;
6752
6970
  }
6753
6971
  }
@@ -6937,7 +7155,8 @@ TableRow.displayName = "TableRow";
6937
7155
  var TableHead = t.forwardRef(
6938
7156
  ({ className, sortable, sorted, onSort, align = "left", children, ...props }, ref) => {
6939
7157
  const renderSortIcon = () => {
6940
- if (!sortable) return null;
7158
+ if (!sortable)
7159
+ return null;
6941
7160
  if (sorted === "asc") {
6942
7161
  return /* @__PURE__ */ jsx(
6943
7162
  "svg",
@@ -7218,7 +7437,8 @@ function Calendar({
7218
7437
  setCurrentMonth(addMonths(currentMonth, 1));
7219
7438
  };
7220
7439
  const handleDateClick = (date) => {
7221
- if (disabled?.(date)) return;
7440
+ if (disabled?.(date))
7441
+ return;
7222
7442
  if (mode === "single") {
7223
7443
  onSelect?.(date);
7224
7444
  } else if (mode === "range") {
@@ -7235,7 +7455,8 @@ function Calendar({
7235
7455
  }
7236
7456
  };
7237
7457
  const isDateSelected = (date) => {
7238
- if (!selected) return false;
7458
+ if (!selected)
7459
+ return false;
7239
7460
  if (mode === "single") {
7240
7461
  return isSameDay(date, selected);
7241
7462
  } else if (mode === "range") {
@@ -7248,19 +7469,23 @@ function Calendar({
7248
7469
  return false;
7249
7470
  };
7250
7471
  const isRangeStart = (date) => {
7251
- if (mode !== "range" || !selected) return false;
7472
+ if (mode !== "range" || !selected)
7473
+ return false;
7252
7474
  const range = selected;
7253
7475
  return range.from ? isSameDay(date, range.from) : false;
7254
7476
  };
7255
7477
  const isRangeEnd = (date) => {
7256
- if (mode !== "range" || !selected) return false;
7478
+ if (mode !== "range" || !selected)
7479
+ return false;
7257
7480
  const range = selected;
7258
7481
  return range.to ? isSameDay(date, range.to) : false;
7259
7482
  };
7260
7483
  const isRangeMiddle = (date) => {
7261
- if (mode !== "range" || !selected) return false;
7484
+ if (mode !== "range" || !selected)
7485
+ return false;
7262
7486
  const range = selected;
7263
- if (!range.from || !range.to) return false;
7487
+ if (!range.from || !range.to)
7488
+ return false;
7264
7489
  return date > range.from && date < range.to;
7265
7490
  };
7266
7491
  const getDaysInMonth = () => {
@@ -7456,10 +7681,14 @@ function DatePicker({
7456
7681
  handleSelect(today);
7457
7682
  };
7458
7683
  const isDateDisabled = (date) => {
7459
- if (minDate && date < minDate) return true;
7460
- if (maxDate && date > maxDate) return true;
7461
- if (disabledDates?.some((d) => d.toDateString() === date.toDateString())) return true;
7462
- if (disabledDaysOfWeek?.includes(date.getDay())) return true;
7684
+ if (minDate && date < minDate)
7685
+ return true;
7686
+ if (maxDate && date > maxDate)
7687
+ return true;
7688
+ if (disabledDates?.some((d) => d.toDateString() === date.toDateString()))
7689
+ return true;
7690
+ if (disabledDaysOfWeek?.includes(date.getDay()))
7691
+ return true;
7463
7692
  return false;
7464
7693
  };
7465
7694
  const displayValue = internalDate && isValid(internalDate) ? format(internalDate, formatString) : null;
@@ -7601,7 +7830,8 @@ function DateRangePicker({
7601
7830
  }
7602
7831
  };
7603
7832
  const displayValue = t.useMemo(() => {
7604
- if (!internalRange?.from) return null;
7833
+ if (!internalRange?.from)
7834
+ return null;
7605
7835
  if (!internalRange?.to) {
7606
7836
  return format(internalRange.from, formatString);
7607
7837
  }
@@ -7835,7 +8065,8 @@ function DraggableList({
7835
8065
  }) {
7836
8066
  const [draggedIndex, setDraggedIndex] = t.useState(null);
7837
8067
  const handleDragStart = (e, index) => {
7838
- if (disabled) return;
8068
+ if (disabled)
8069
+ return;
7839
8070
  setDraggedIndex(index);
7840
8071
  e.dataTransfer.effectAllowed = "move";
7841
8072
  };
@@ -8129,14 +8360,19 @@ var Progress = t.forwardRef(({
8129
8360
  });
8130
8361
  Progress.displayName = "Progress";
8131
8362
  var getFileIcon = (type) => {
8132
- if (type.startsWith("image/")) return /* @__PURE__ */ jsx(Image, { className: "h-4 w-4" });
8133
- if (type.startsWith("video/")) return /* @__PURE__ */ jsx(Video, { className: "h-4 w-4" });
8134
- if (type.startsWith("audio/")) return /* @__PURE__ */ jsx(Music, { className: "h-4 w-4" });
8135
- if (type.includes("text") || type.includes("document")) return /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" });
8363
+ if (type.startsWith("image/"))
8364
+ return /* @__PURE__ */ jsx(Image, { className: "h-4 w-4" });
8365
+ if (type.startsWith("video/"))
8366
+ return /* @__PURE__ */ jsx(Video, { className: "h-4 w-4" });
8367
+ if (type.startsWith("audio/"))
8368
+ return /* @__PURE__ */ jsx(Music, { className: "h-4 w-4" });
8369
+ if (type.includes("text") || type.includes("document"))
8370
+ return /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" });
8136
8371
  return /* @__PURE__ */ jsx(File, { className: "h-4 w-4" });
8137
8372
  };
8138
8373
  var formatFileSize = (bytes) => {
8139
- if (bytes === 0) return "0 Bytes";
8374
+ if (bytes === 0)
8375
+ return "0 Bytes";
8140
8376
  const k3 = 1024;
8141
8377
  const sizes = ["Bytes", "KB", "MB", "GB"];
8142
8378
  const i = Math.floor(Math.log(bytes) / Math.log(k3));
@@ -8296,7 +8532,8 @@ var FileUpload = t__default.forwardRef(
8296
8532
  const handleDrop = useCallback((e) => {
8297
8533
  e.preventDefault();
8298
8534
  setIsDragOver(false);
8299
- if (disabled) return;
8535
+ if (disabled)
8536
+ return;
8300
8537
  const files = e.dataTransfer.files;
8301
8538
  if (files.length > 0) {
8302
8539
  processFiles(files);
@@ -8437,7 +8674,8 @@ var GestureDrawer = t__default.forwardRef(
8437
8674
  const motionValue = isVertical ? y : x;
8438
8675
  const opacity = useTransform(motionValue, [0, threshold], [1, 0.5]);
8439
8676
  const handleDragEnd = (event, info) => {
8440
- if (!enableSwipeToClose) return;
8677
+ if (!enableSwipeToClose)
8678
+ return;
8441
8679
  const offset = isVertical ? info.offset.y : info.offset.x;
8442
8680
  const velocity = isVertical ? info.velocity.y : info.velocity.x;
8443
8681
  let shouldClose = false;
@@ -8478,7 +8716,8 @@ var GestureDrawer = t__default.forwardRef(
8478
8716
  const getAnimatePosition = () => {
8479
8717
  return isVertical ? { y: 0 } : { x: 0 };
8480
8718
  };
8481
- if (!isOpen) return null;
8719
+ if (!isOpen)
8720
+ return null;
8482
8721
  return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50", children: [
8483
8722
  /* @__PURE__ */ jsx(
8484
8723
  motion.div,
@@ -8698,7 +8937,8 @@ function LockedComponent({
8698
8937
  const [isPreviewActive, setIsPreviewActive] = useState(false);
8699
8938
  const [previewTimeout, setPreviewTimeout] = useState(null);
8700
8939
  const handleMouseEnter = () => {
8701
- if (!showPreview) return;
8940
+ if (!showPreview)
8941
+ return;
8702
8942
  setIsPreviewActive(true);
8703
8943
  if (previewTimeout) {
8704
8944
  clearTimeout(previewTimeout);
@@ -8804,6 +9044,7 @@ function ProComponentWrapper({
8804
9044
  nodeEnv: process.env.NODE_ENV === "development",
8805
9045
  nextPublicEnv: process.env.NEXT_PUBLIC_VERCEL_ENV === "development",
8806
9046
  localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")),
9047
+ port: typeof window !== "undefined" && (window.location.port === "3000" || window.location.port === "3001" || window.location.port === "8080"),
8807
9048
  vercelEnv: !process.env.VERCEL,
8808
9049
  ciEnv: !process.env.CI,
8809
9050
  deploymentEnv: !process.env.DEPLOYMENT_ENV
@@ -8884,7 +9125,9 @@ function ProComponentWrapper({
8884
9125
  const isDevelopment = () => {
8885
9126
  const checks = {
8886
9127
  nodeEnv: process.env.NODE_ENV === "development",
8887
- localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local"))};
9128
+ localhost: typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")),
9129
+ port: typeof window !== "undefined" && (window.location.port === "3000" || window.location.port === "3001" || window.location.port === "8080")
9130
+ };
8888
9131
  if (process.env.VERCEL || process.env.NETLIFY || process.env.RENDER || process.env.RAILWAY_ENVIRONMENT || process.env.FLY_APP_NAME) {
8889
9132
  return false;
8890
9133
  }
@@ -9327,22 +9570,30 @@ var formatPhoneNumber = (value, countryCode) => {
9327
9570
  const cleaned = value.replace(/\D/g, "");
9328
9571
  switch (countryCode) {
9329
9572
  case "+1":
9330
- if (cleaned.length <= 3) return cleaned;
9331
- if (cleaned.length <= 6) return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9573
+ if (cleaned.length <= 3)
9574
+ return cleaned;
9575
+ if (cleaned.length <= 6)
9576
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9332
9577
  return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6, 10)}`;
9333
9578
  case "+44":
9334
- if (cleaned.length <= 4) return cleaned;
9335
- if (cleaned.length <= 7) return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
9579
+ if (cleaned.length <= 4)
9580
+ return cleaned;
9581
+ if (cleaned.length <= 7)
9582
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
9336
9583
  return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 7)} ${cleaned.slice(7, 11)}`;
9337
9584
  case "+90":
9338
- if (cleaned.length <= 3) return cleaned;
9339
- if (cleaned.length <= 6) return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9340
- if (cleaned.length <= 9) return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6)}`;
9585
+ if (cleaned.length <= 3)
9586
+ return cleaned;
9587
+ if (cleaned.length <= 6)
9588
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3)}`;
9589
+ if (cleaned.length <= 9)
9590
+ return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6)}`;
9341
9591
  return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)} ${cleaned.slice(6, 8)} ${cleaned.slice(8, 10)}`;
9342
9592
  default:
9343
9593
  let formatted = "";
9344
9594
  for (let i = 0; i < cleaned.length; i++) {
9345
- if (i > 0 && i % 3 === 0) formatted += " ";
9595
+ if (i > 0 && i % 3 === 0)
9596
+ formatted += " ";
9346
9597
  formatted += cleaned[i];
9347
9598
  }
9348
9599
  return formatted;
@@ -9352,13 +9603,10 @@ var getMaxLength = (countryCode) => {
9352
9603
  switch (countryCode) {
9353
9604
  case "+1":
9354
9605
  return 10;
9355
- // US/Canada
9356
9606
  case "+44":
9357
9607
  return 11;
9358
- // UK
9359
9608
  case "+90":
9360
9609
  return 10;
9361
- // Turkey
9362
9610
  default:
9363
9611
  return 15;
9364
9612
  }
@@ -9614,6 +9862,188 @@ function RichTextEditor({
9614
9862
  )
9615
9863
  ] });
9616
9864
  }
9865
+ function useStateMachine2(initialState, machine) {
9866
+ return t.useReducer((state, event) => {
9867
+ const nextState = machine[state][event];
9868
+ return nextState ?? state;
9869
+ }, initialState);
9870
+ }
9871
+ var Presence2 = (props) => {
9872
+ const { present, children } = props;
9873
+ const presence = usePresence2(present);
9874
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : t.Children.only(children);
9875
+ const ref = useComposedRefs2(presence.ref, getElementRef2(child));
9876
+ const forceMount = typeof children === "function";
9877
+ return forceMount || presence.isPresent ? t.cloneElement(child, { ref }) : null;
9878
+ };
9879
+ Presence2.displayName = "Presence";
9880
+ function usePresence2(present) {
9881
+ const [node, setNode] = t.useState();
9882
+ const stylesRef = t.useRef(null);
9883
+ const prevPresentRef = t.useRef(present);
9884
+ const prevAnimationNameRef = t.useRef("none");
9885
+ const initialState = present ? "mounted" : "unmounted";
9886
+ const [state, send] = useStateMachine2(initialState, {
9887
+ mounted: {
9888
+ UNMOUNT: "unmounted",
9889
+ ANIMATION_OUT: "unmountSuspended"
9890
+ },
9891
+ unmountSuspended: {
9892
+ MOUNT: "mounted",
9893
+ ANIMATION_END: "unmounted"
9894
+ },
9895
+ unmounted: {
9896
+ MOUNT: "mounted"
9897
+ }
9898
+ });
9899
+ t.useEffect(() => {
9900
+ const currentAnimationName = getAnimationName2(stylesRef.current);
9901
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
9902
+ }, [state]);
9903
+ useLayoutEffect22(() => {
9904
+ const styles = stylesRef.current;
9905
+ const wasPresent = prevPresentRef.current;
9906
+ const hasPresentChanged = wasPresent !== present;
9907
+ if (hasPresentChanged) {
9908
+ const prevAnimationName = prevAnimationNameRef.current;
9909
+ const currentAnimationName = getAnimationName2(styles);
9910
+ if (present) {
9911
+ send("MOUNT");
9912
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
9913
+ send("UNMOUNT");
9914
+ } else {
9915
+ const isAnimating = prevAnimationName !== currentAnimationName;
9916
+ if (wasPresent && isAnimating) {
9917
+ send("ANIMATION_OUT");
9918
+ } else {
9919
+ send("UNMOUNT");
9920
+ }
9921
+ }
9922
+ prevPresentRef.current = present;
9923
+ }
9924
+ }, [present, send]);
9925
+ useLayoutEffect22(() => {
9926
+ if (node) {
9927
+ let timeoutId;
9928
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
9929
+ const handleAnimationEnd = (event) => {
9930
+ const currentAnimationName = getAnimationName2(stylesRef.current);
9931
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
9932
+ if (event.target === node && isCurrentAnimation) {
9933
+ send("ANIMATION_END");
9934
+ if (!prevPresentRef.current) {
9935
+ const currentFillMode = node.style.animationFillMode;
9936
+ node.style.animationFillMode = "forwards";
9937
+ timeoutId = ownerWindow.setTimeout(() => {
9938
+ if (node.style.animationFillMode === "forwards") {
9939
+ node.style.animationFillMode = currentFillMode;
9940
+ }
9941
+ });
9942
+ }
9943
+ }
9944
+ };
9945
+ const handleAnimationStart = (event) => {
9946
+ if (event.target === node) {
9947
+ prevAnimationNameRef.current = getAnimationName2(stylesRef.current);
9948
+ }
9949
+ };
9950
+ node.addEventListener("animationstart", handleAnimationStart);
9951
+ node.addEventListener("animationcancel", handleAnimationEnd);
9952
+ node.addEventListener("animationend", handleAnimationEnd);
9953
+ return () => {
9954
+ ownerWindow.clearTimeout(timeoutId);
9955
+ node.removeEventListener("animationstart", handleAnimationStart);
9956
+ node.removeEventListener("animationcancel", handleAnimationEnd);
9957
+ node.removeEventListener("animationend", handleAnimationEnd);
9958
+ };
9959
+ } else {
9960
+ send("ANIMATION_END");
9961
+ }
9962
+ }, [node, send]);
9963
+ return {
9964
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
9965
+ ref: t.useCallback((node2) => {
9966
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
9967
+ setNode(node2);
9968
+ }, [])
9969
+ };
9970
+ }
9971
+ function getAnimationName2(styles) {
9972
+ return styles?.animationName || "none";
9973
+ }
9974
+ function getElementRef2(element) {
9975
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
9976
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9977
+ if (mayWarn) {
9978
+ return element.ref;
9979
+ }
9980
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
9981
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9982
+ if (mayWarn) {
9983
+ return element.props.ref;
9984
+ }
9985
+ return element.props.ref || element.ref;
9986
+ }
9987
+ function createContextScope2(scopeName, createContextScopeDeps = []) {
9988
+ let defaultContexts = [];
9989
+ function createContext32(rootComponentName, defaultContext) {
9990
+ const BaseContext = t.createContext(defaultContext);
9991
+ const index = defaultContexts.length;
9992
+ defaultContexts = [...defaultContexts, defaultContext];
9993
+ const Provider3 = (props) => {
9994
+ const { scope, children, ...context } = props;
9995
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
9996
+ const value = t.useMemo(() => context, Object.values(context));
9997
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
9998
+ };
9999
+ Provider3.displayName = rootComponentName + "Provider";
10000
+ function useContext22(consumerName, scope) {
10001
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
10002
+ const context = t.useContext(Context);
10003
+ if (context)
10004
+ return context;
10005
+ if (defaultContext !== void 0)
10006
+ return defaultContext;
10007
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
10008
+ }
10009
+ return [Provider3, useContext22];
10010
+ }
10011
+ const createScope = () => {
10012
+ const scopeContexts = defaultContexts.map((defaultContext) => {
10013
+ return t.createContext(defaultContext);
10014
+ });
10015
+ return function useScope(scope) {
10016
+ const contexts = scope?.[scopeName] || scopeContexts;
10017
+ return t.useMemo(
10018
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
10019
+ [scope, contexts]
10020
+ );
10021
+ };
10022
+ };
10023
+ createScope.scopeName = scopeName;
10024
+ return [createContext32, composeContextScopes2(createScope, ...createContextScopeDeps)];
10025
+ }
10026
+ function composeContextScopes2(...scopes) {
10027
+ const baseScope = scopes[0];
10028
+ if (scopes.length === 1)
10029
+ return baseScope;
10030
+ const createScope = () => {
10031
+ const scopeHooks = scopes.map((createScope2) => ({
10032
+ useScope: createScope2(),
10033
+ scopeName: createScope2.scopeName
10034
+ }));
10035
+ return function useComposedScopes(overrideScopes) {
10036
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
10037
+ const scopeProps = useScope(overrideScopes);
10038
+ const currentScope = scopeProps[`__scope${scopeName}`];
10039
+ return { ...nextScopes2, ...currentScope };
10040
+ }, {});
10041
+ return t.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
10042
+ };
10043
+ };
10044
+ createScope.scopeName = baseScope.scopeName;
10045
+ return createScope;
10046
+ }
9617
10047
  function useCallbackRef(callback) {
9618
10048
  const callbackRef = t.useRef(callback);
9619
10049
  t.useEffect(() => {
@@ -9631,14 +10061,22 @@ function useDirection(localDir) {
9631
10061
  function clamp(value, [min2, max2]) {
9632
10062
  return Math.min(max2, Math.max(min2, value));
9633
10063
  }
9634
- function useStateMachine2(initialState, machine) {
10064
+ function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
10065
+ return function handleEvent(event) {
10066
+ originalEventHandler?.(event);
10067
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
10068
+ return ourEventHandler?.(event);
10069
+ }
10070
+ };
10071
+ }
10072
+ function useStateMachine3(initialState, machine) {
9635
10073
  return t.useReducer((state, event) => {
9636
10074
  const nextState = machine[state][event];
9637
10075
  return nextState ?? state;
9638
10076
  }, initialState);
9639
10077
  }
9640
10078
  var SCROLL_AREA_NAME = "ScrollArea";
9641
- var [createScrollAreaContext] = createContextScope(SCROLL_AREA_NAME);
10079
+ var [createScrollAreaContext, createScrollAreaScope] = createContextScope2(SCROLL_AREA_NAME);
9642
10080
  var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
9643
10081
  var ScrollArea = t.forwardRef(
9644
10082
  (props, forwardedRef) => {
@@ -9658,7 +10096,7 @@ var ScrollArea = t.forwardRef(
9658
10096
  const [cornerHeight, setCornerHeight] = t.useState(0);
9659
10097
  const [scrollbarXEnabled, setScrollbarXEnabled] = t.useState(false);
9660
10098
  const [scrollbarYEnabled, setScrollbarYEnabled] = t.useState(false);
9661
- const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));
10099
+ const composedRefs = useComposedRefs2(forwardedRef, (node) => setScrollArea(node));
9662
10100
  const direction = useDirection(dir);
9663
10101
  return /* @__PURE__ */ jsx(
9664
10102
  ScrollAreaProvider,
@@ -9683,7 +10121,7 @@ var ScrollArea = t.forwardRef(
9683
10121
  onCornerWidthChange: setCornerWidth,
9684
10122
  onCornerHeightChange: setCornerHeight,
9685
10123
  children: /* @__PURE__ */ jsx(
9686
- Primitive.div,
10124
+ Primitive2.div,
9687
10125
  {
9688
10126
  dir: direction,
9689
10127
  ...scrollAreaProps,
@@ -9708,7 +10146,7 @@ var ScrollAreaViewport = t.forwardRef(
9708
10146
  const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
9709
10147
  const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
9710
10148
  const ref = t.useRef(null);
9711
- const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);
10149
+ const composedRefs = useComposedRefs2(forwardedRef, ref, context.onViewportChange);
9712
10150
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9713
10151
  /* @__PURE__ */ jsx(
9714
10152
  "style",
@@ -9720,7 +10158,7 @@ var ScrollAreaViewport = t.forwardRef(
9720
10158
  }
9721
10159
  ),
9722
10160
  /* @__PURE__ */ jsx(
9723
- Primitive.div,
10161
+ Primitive2.div,
9724
10162
  {
9725
10163
  "data-radix-scroll-area-viewport": "",
9726
10164
  ...viewportProps,
@@ -9789,7 +10227,7 @@ var ScrollAreaScrollbarHover = t.forwardRef((props, forwardedRef) => {
9789
10227
  };
9790
10228
  }
9791
10229
  }, [context.scrollArea, context.scrollHideDelay]);
9792
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
10230
+ return /* @__PURE__ */ jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
9793
10231
  ScrollAreaScrollbarAuto,
9794
10232
  {
9795
10233
  "data-state": visible ? "visible" : "hidden",
@@ -9803,7 +10241,7 @@ var ScrollAreaScrollbarScroll = t.forwardRef((props, forwardedRef) => {
9803
10241
  const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
9804
10242
  const isHorizontal = props.orientation === "horizontal";
9805
10243
  const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
9806
- const [state, send] = useStateMachine2("hidden", {
10244
+ const [state, send] = useStateMachine3("hidden", {
9807
10245
  hidden: {
9808
10246
  SCROLL: "scrolling"
9809
10247
  },
@@ -9845,14 +10283,14 @@ var ScrollAreaScrollbarScroll = t.forwardRef((props, forwardedRef) => {
9845
10283
  return () => viewport.removeEventListener("scroll", handleScroll);
9846
10284
  }
9847
10285
  }, [context.viewport, isHorizontal, send, debounceScrollEnd]);
9848
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx(
10286
+ return /* @__PURE__ */ jsx(Presence2, { present: forceMount || state !== "hidden", children: /* @__PURE__ */ jsx(
9849
10287
  ScrollAreaScrollbarVisible,
9850
10288
  {
9851
10289
  "data-state": state === "hidden" ? "hidden" : "visible",
9852
10290
  ...scrollbarProps,
9853
10291
  ref: forwardedRef,
9854
- onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
9855
- onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
10292
+ onPointerEnter: composeEventHandlers2(props.onPointerEnter, () => send("POINTER_ENTER")),
10293
+ onPointerLeave: composeEventHandlers2(props.onPointerLeave, () => send("POINTER_LEAVE"))
9856
10294
  }
9857
10295
  ) });
9858
10296
  });
@@ -9870,7 +10308,7 @@ var ScrollAreaScrollbarAuto = t.forwardRef((props, forwardedRef) => {
9870
10308
  }, 10);
9871
10309
  useResizeObserver(context.viewport, handleResize);
9872
10310
  useResizeObserver(context.content, handleResize);
9873
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
10311
+ return /* @__PURE__ */ jsx(Presence2, { present: forceMount || visible, children: /* @__PURE__ */ jsx(
9874
10312
  ScrollAreaScrollbarVisible,
9875
10313
  {
9876
10314
  "data-state": visible ? "visible" : "hidden",
@@ -9916,7 +10354,8 @@ var ScrollAreaScrollbarVisible = t.forwardRef((props, forwardedRef) => {
9916
10354
  }
9917
10355
  },
9918
10356
  onWheelScroll: (scrollPos) => {
9919
- if (context.viewport) context.viewport.scrollLeft = scrollPos;
10357
+ if (context.viewport)
10358
+ context.viewport.scrollLeft = scrollPos;
9920
10359
  },
9921
10360
  onDragScroll: (pointerPos) => {
9922
10361
  if (context.viewport) {
@@ -9940,10 +10379,12 @@ var ScrollAreaScrollbarVisible = t.forwardRef((props, forwardedRef) => {
9940
10379
  }
9941
10380
  },
9942
10381
  onWheelScroll: (scrollPos) => {
9943
- if (context.viewport) context.viewport.scrollTop = scrollPos;
10382
+ if (context.viewport)
10383
+ context.viewport.scrollTop = scrollPos;
9944
10384
  },
9945
10385
  onDragScroll: (pointerPos) => {
9946
- if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
10386
+ if (context.viewport)
10387
+ context.viewport.scrollTop = getScrollPosition(pointerPos);
9947
10388
  }
9948
10389
  }
9949
10390
  );
@@ -9955,16 +10396,17 @@ var ScrollAreaScrollbarX = t.forwardRef((props, forwardedRef) => {
9955
10396
  const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
9956
10397
  const [computedStyle, setComputedStyle] = t.useState();
9957
10398
  const ref = t.useRef(null);
9958
- const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
10399
+ const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarXChange);
9959
10400
  t.useEffect(() => {
9960
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
10401
+ if (ref.current)
10402
+ setComputedStyle(getComputedStyle(ref.current));
9961
10403
  }, [ref]);
9962
10404
  return /* @__PURE__ */ jsx(
9963
10405
  ScrollAreaScrollbarImpl,
9964
10406
  {
9965
10407
  "data-orientation": "horizontal",
9966
10408
  ...scrollbarProps,
9967
- ref: composeRefs2,
10409
+ ref: composeRefs3,
9968
10410
  sizes,
9969
10411
  style: {
9970
10412
  bottom: 0,
@@ -10005,16 +10447,17 @@ var ScrollAreaScrollbarY = t.forwardRef((props, forwardedRef) => {
10005
10447
  const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
10006
10448
  const [computedStyle, setComputedStyle] = t.useState();
10007
10449
  const ref = t.useRef(null);
10008
- const composeRefs2 = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
10450
+ const composeRefs3 = useComposedRefs2(forwardedRef, ref, context.onScrollbarYChange);
10009
10451
  t.useEffect(() => {
10010
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
10452
+ if (ref.current)
10453
+ setComputedStyle(getComputedStyle(ref.current));
10011
10454
  }, [ref]);
10012
10455
  return /* @__PURE__ */ jsx(
10013
10456
  ScrollAreaScrollbarImpl,
10014
10457
  {
10015
10458
  "data-orientation": "vertical",
10016
10459
  ...scrollbarProps,
10017
- ref: composeRefs2,
10460
+ ref: composeRefs3,
10018
10461
  sizes,
10019
10462
  style: {
10020
10463
  top: 0,
@@ -10068,7 +10511,7 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
10068
10511
  } = props;
10069
10512
  const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
10070
10513
  const [scrollbar, setScrollbar] = t.useState(null);
10071
- const composeRefs2 = useComposedRefs(forwardedRef, (node) => setScrollbar(node));
10514
+ const composeRefs3 = useComposedRefs2(forwardedRef, (node) => setScrollbar(node));
10072
10515
  const rectRef = t.useRef(null);
10073
10516
  const prevWebkitUserSelectRef = t.useRef("");
10074
10517
  const viewport = context.viewport;
@@ -10087,7 +10530,8 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
10087
10530
  const handleWheel = (event) => {
10088
10531
  const element = event.target;
10089
10532
  const isScrollbarWheel = scrollbar?.contains(element);
10090
- if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);
10533
+ if (isScrollbarWheel)
10534
+ handleWheelScroll(event, maxScrollPos);
10091
10535
  };
10092
10536
  document.addEventListener("wheel", handleWheel, { passive: false });
10093
10537
  return () => document.removeEventListener("wheel", handleWheel, { passive: false });
@@ -10106,12 +10550,12 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
10106
10550
  onThumbPositionChange: handleThumbPositionChange,
10107
10551
  onThumbPointerDown: useCallbackRef(onThumbPointerDown),
10108
10552
  children: /* @__PURE__ */ jsx(
10109
- Primitive.div,
10553
+ Primitive2.div,
10110
10554
  {
10111
10555
  ...scrollbarProps,
10112
- ref: composeRefs2,
10556
+ ref: composeRefs3,
10113
10557
  style: { position: "absolute", ...scrollbarProps.style },
10114
- onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
10558
+ onPointerDown: composeEventHandlers2(props.onPointerDown, (event) => {
10115
10559
  const mainPointer = 0;
10116
10560
  if (event.button === mainPointer) {
10117
10561
  const element = event.target;
@@ -10119,18 +10563,20 @@ var ScrollAreaScrollbarImpl = t.forwardRef((props, forwardedRef) => {
10119
10563
  rectRef.current = scrollbar.getBoundingClientRect();
10120
10564
  prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
10121
10565
  document.body.style.webkitUserSelect = "none";
10122
- if (context.viewport) context.viewport.style.scrollBehavior = "auto";
10566
+ if (context.viewport)
10567
+ context.viewport.style.scrollBehavior = "auto";
10123
10568
  handleDragScroll(event);
10124
10569
  }
10125
10570
  }),
10126
- onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),
10127
- onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
10571
+ onPointerMove: composeEventHandlers2(props.onPointerMove, handleDragScroll),
10572
+ onPointerUp: composeEventHandlers2(props.onPointerUp, (event) => {
10128
10573
  const element = event.target;
10129
10574
  if (element.hasPointerCapture(event.pointerId)) {
10130
10575
  element.releasePointerCapture(event.pointerId);
10131
10576
  }
10132
10577
  document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
10133
- if (context.viewport) context.viewport.style.scrollBehavior = "";
10578
+ if (context.viewport)
10579
+ context.viewport.style.scrollBehavior = "";
10134
10580
  rectRef.current = null;
10135
10581
  })
10136
10582
  }
@@ -10143,7 +10589,7 @@ var ScrollAreaThumb = t.forwardRef(
10143
10589
  (props, forwardedRef) => {
10144
10590
  const { forceMount, ...thumbProps } = props;
10145
10591
  const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
10146
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
10592
+ return /* @__PURE__ */ jsx(Presence2, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });
10147
10593
  }
10148
10594
  );
10149
10595
  var ScrollAreaThumbImpl = t.forwardRef(
@@ -10152,7 +10598,7 @@ var ScrollAreaThumbImpl = t.forwardRef(
10152
10598
  const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
10153
10599
  const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
10154
10600
  const { onThumbPositionChange } = scrollbarContext;
10155
- const composedRef = useComposedRefs(
10601
+ const composedRef = useComposedRefs2(
10156
10602
  forwardedRef,
10157
10603
  (node) => scrollbarContext.onThumbChange(node)
10158
10604
  );
@@ -10180,7 +10626,7 @@ var ScrollAreaThumbImpl = t.forwardRef(
10180
10626
  }
10181
10627
  }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);
10182
10628
  return /* @__PURE__ */ jsx(
10183
- Primitive.div,
10629
+ Primitive2.div,
10184
10630
  {
10185
10631
  "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
10186
10632
  ...thumbProps,
@@ -10190,14 +10636,14 @@ var ScrollAreaThumbImpl = t.forwardRef(
10190
10636
  height: "var(--radix-scroll-area-thumb-height)",
10191
10637
  ...style
10192
10638
  },
10193
- onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {
10639
+ onPointerDownCapture: composeEventHandlers2(props.onPointerDownCapture, (event) => {
10194
10640
  const thumb = event.target;
10195
10641
  const thumbRect = thumb.getBoundingClientRect();
10196
10642
  const x = event.clientX - thumbRect.left;
10197
10643
  const y = event.clientY - thumbRect.top;
10198
10644
  scrollbarContext.onThumbPointerDown({ x, y });
10199
10645
  }),
10200
- onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
10646
+ onPointerUp: composeEventHandlers2(props.onPointerUp, scrollbarContext.onThumbPointerUp)
10201
10647
  }
10202
10648
  );
10203
10649
  }
@@ -10230,7 +10676,7 @@ var ScrollAreaCornerImpl = t.forwardRef((props, forwardedRef) => {
10230
10676
  setWidth(width2);
10231
10677
  });
10232
10678
  return hasSize ? /* @__PURE__ */ jsx(
10233
- Primitive.div,
10679
+ Primitive2.div,
10234
10680
  {
10235
10681
  ...cornerProps,
10236
10682
  ref: forwardedRef,
@@ -10284,7 +10730,8 @@ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
10284
10730
  }
10285
10731
  function linearScale(input, output) {
10286
10732
  return (value) => {
10287
- if (input[0] === input[1] || output[0] === output[1]) return output[0];
10733
+ if (input[0] === input[1] || output[0] === output[1])
10734
+ return output[0];
10288
10735
  const ratio = (output[1] - output[0]) / (input[1] - input[0]);
10289
10736
  return output[0] + ratio * (value - input[0]);
10290
10737
  };
@@ -10300,7 +10747,8 @@ var addUnlinkedScrollListener = (node, handler = () => {
10300
10747
  const position = { left: node.scrollLeft, top: node.scrollTop };
10301
10748
  const isHorizontalScroll = prevPosition.left !== position.left;
10302
10749
  const isVerticalScroll = prevPosition.top !== position.top;
10303
- if (isHorizontalScroll || isVerticalScroll) handler();
10750
+ if (isHorizontalScroll || isVerticalScroll)
10751
+ handler();
10304
10752
  prevPosition = position;
10305
10753
  rAF = window.requestAnimationFrame(loop);
10306
10754
  })();
@@ -10317,7 +10765,7 @@ function useDebounceCallback(callback, delay) {
10317
10765
  }
10318
10766
  function useResizeObserver(element, onResize) {
10319
10767
  const handleResize = useCallbackRef(onResize);
10320
- useLayoutEffect2(() => {
10768
+ useLayoutEffect22(() => {
10321
10769
  let rAF = 0;
10322
10770
  if (element) {
10323
10771
  const resizeObserver = new ResizeObserver(() => {
@@ -10418,7 +10866,8 @@ var ScrollReveal = t.forwardRef(
10418
10866
  once: triggerOnce
10419
10867
  });
10420
10868
  const customVariants = t.useMemo(() => {
10421
- if (variants) return variants;
10869
+ if (variants)
10870
+ return variants;
10422
10871
  const baseVariants = defaultVariants[direction] || defaultVariants.up;
10423
10872
  return {
10424
10873
  hidden: {
@@ -10432,7 +10881,8 @@ var ScrollReveal = t.forwardRef(
10432
10881
  };
10433
10882
  }, [direction, distance, variants]);
10434
10883
  t.useEffect(() => {
10435
- if (!animate2) return;
10884
+ if (!animate2)
10885
+ return;
10436
10886
  if (isInView) {
10437
10887
  controls.start("visible");
10438
10888
  } else if (!triggerOnce) {
@@ -10513,7 +10963,8 @@ var ScrollRevealItem = t.forwardRef(
10513
10963
  id
10514
10964
  }, ref) => {
10515
10965
  const customVariants = t.useMemo(() => {
10516
- if (variants) return variants;
10966
+ if (variants)
10967
+ return variants;
10517
10968
  const baseVariants = defaultVariants[direction] || defaultVariants.up;
10518
10969
  return {
10519
10970
  hidden: {
@@ -10664,17 +11115,81 @@ var Separator3 = t.forwardRef(
10664
11115
  )
10665
11116
  );
10666
11117
  Separator3.displayName = SeparatorPrimitive.Root.displayName;
11118
+ var useInsertionEffect2 = t[" useInsertionEffect ".trim().toString()] || useLayoutEffect22;
11119
+ function useControllableState2({
11120
+ prop,
11121
+ defaultProp,
11122
+ onChange = () => {
11123
+ },
11124
+ caller
11125
+ }) {
11126
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState2({
11127
+ defaultProp,
11128
+ onChange
11129
+ });
11130
+ const isControlled = prop !== void 0;
11131
+ const value = isControlled ? prop : uncontrolledProp;
11132
+ {
11133
+ const isControlledRef = t.useRef(prop !== void 0);
11134
+ t.useEffect(() => {
11135
+ const wasControlled = isControlledRef.current;
11136
+ if (wasControlled !== isControlled) {
11137
+ const from = wasControlled ? "controlled" : "uncontrolled";
11138
+ const to = isControlled ? "controlled" : "uncontrolled";
11139
+ console.warn(
11140
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
11141
+ );
11142
+ }
11143
+ isControlledRef.current = isControlled;
11144
+ }, [isControlled, caller]);
11145
+ }
11146
+ const setValue = t.useCallback(
11147
+ (nextValue) => {
11148
+ if (isControlled) {
11149
+ const value2 = isFunction3(nextValue) ? nextValue(prop) : nextValue;
11150
+ if (value2 !== prop) {
11151
+ onChangeRef.current?.(value2);
11152
+ }
11153
+ } else {
11154
+ setUncontrolledProp(nextValue);
11155
+ }
11156
+ },
11157
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
11158
+ );
11159
+ return [value, setValue];
11160
+ }
11161
+ function useUncontrolledState2({
11162
+ defaultProp,
11163
+ onChange
11164
+ }) {
11165
+ const [value, setValue] = t.useState(defaultProp);
11166
+ const prevValueRef = t.useRef(value);
11167
+ const onChangeRef = t.useRef(onChange);
11168
+ useInsertionEffect2(() => {
11169
+ onChangeRef.current = onChange;
11170
+ }, [onChange]);
11171
+ t.useEffect(() => {
11172
+ if (prevValueRef.current !== value) {
11173
+ onChangeRef.current?.(value);
11174
+ prevValueRef.current = value;
11175
+ }
11176
+ }, [value, prevValueRef]);
11177
+ return [value, setValue, onChangeRef];
11178
+ }
11179
+ function isFunction3(value) {
11180
+ return typeof value === "function";
11181
+ }
10667
11182
  var NAME = "Toggle";
10668
11183
  var Toggle = t.forwardRef((props, forwardedRef) => {
10669
11184
  const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
10670
- const [pressed, setPressed] = useControllableState({
11185
+ const [pressed, setPressed] = useControllableState2({
10671
11186
  prop: pressedProp,
10672
11187
  onChange: onPressedChange,
10673
11188
  defaultProp: defaultPressed ?? false,
10674
11189
  caller: NAME
10675
11190
  });
10676
11191
  return /* @__PURE__ */ jsx(
10677
- Primitive.button,
11192
+ Primitive2.button,
10678
11193
  {
10679
11194
  type: "button",
10680
11195
  "aria-pressed": pressed,
@@ -10682,7 +11197,7 @@ var Toggle = t.forwardRef((props, forwardedRef) => {
10682
11197
  "data-disabled": props.disabled ? "" : void 0,
10683
11198
  ...buttonProps,
10684
11199
  ref: forwardedRef,
10685
- onClick: composeEventHandlers(props.onClick, () => {
11200
+ onClick: composeEventHandlers2(props.onClick, () => {
10686
11201
  if (!props.disabled) {
10687
11202
  setPressed(!pressed);
10688
11203
  }
@@ -10872,7 +11387,7 @@ var SimpleEditor = t__default.forwardRef(
10872
11387
  const [content, setContent] = useState(value);
10873
11388
  const [isPreview, setIsPreview] = useState(false);
10874
11389
  const [sourceContent, setSourceContent] = useState(value);
10875
- const [selection, setSelection] = useState(null);
11390
+ useState(null);
10876
11391
  const editorRef = t__default.useRef(null);
10877
11392
  const sourceRef = t__default.useRef(null);
10878
11393
  const [formatState, setFormatState] = useState({
@@ -10901,7 +11416,8 @@ var SimpleEditor = t__default.forwardRef(
10901
11416
  return null;
10902
11417
  }, []);
10903
11418
  useCallback((range) => {
10904
- if (!range) return;
11419
+ if (!range)
11420
+ return;
10905
11421
  const selection2 = window.getSelection();
10906
11422
  if (selection2) {
10907
11423
  selection2.removeAllRanges();
@@ -10909,7 +11425,8 @@ var SimpleEditor = t__default.forwardRef(
10909
11425
  }
10910
11426
  }, []);
10911
11427
  const executeCommand = useCallback((command, value2) => {
10912
- if (disabled) return;
11428
+ if (disabled)
11429
+ return;
10913
11430
  if (editorRef.current) {
10914
11431
  editorRef.current.focus();
10915
11432
  }
@@ -11368,7 +11885,7 @@ var SimpleEditor = t__default.forwardRef(
11368
11885
  );
11369
11886
  SimpleEditor.displayName = "SimpleEditor";
11370
11887
  var CharacterCount = ({ content }) => {
11371
- const [count3, setCount] = useState(0);
11888
+ const [count4, setCount] = useState(0);
11372
11889
  useEffect(() => {
11373
11890
  const getPlainText = (html) => {
11374
11891
  const div = document.createElement("div");
@@ -11378,7 +11895,7 @@ var CharacterCount = ({ content }) => {
11378
11895
  setCount(getPlainText(content).length);
11379
11896
  }, [content]);
11380
11897
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11381
- count3,
11898
+ count4,
11382
11899
  " characters"
11383
11900
  ] });
11384
11901
  };
@@ -11647,16 +12164,19 @@ var SwipeableCard = t.forwardRef(
11647
12164
  const [currentX, setCurrentX] = t.useState(0);
11648
12165
  const [isSwiping, setIsSwiping] = t.useState(false);
11649
12166
  const handleTouchStart = (e) => {
11650
- if (disabled) return;
12167
+ if (disabled)
12168
+ return;
11651
12169
  setStartX(e.touches[0].clientX);
11652
12170
  setIsSwiping(true);
11653
12171
  };
11654
12172
  const handleTouchMove = (e) => {
11655
- if (disabled || !isSwiping) return;
12173
+ if (disabled || !isSwiping)
12174
+ return;
11656
12175
  setCurrentX(e.touches[0].clientX);
11657
12176
  };
11658
12177
  const handleTouchEnd = () => {
11659
- if (disabled || !isSwiping) return;
12178
+ if (disabled || !isSwiping)
12179
+ return;
11660
12180
  const deltaX = currentX - startX;
11661
12181
  if (Math.abs(deltaX) > threshold) {
11662
12182
  if (deltaX > 0 && onSwipeRight) {
@@ -11760,7 +12280,8 @@ var TagsInput = t.forwardRef(
11760
12280
  };
11761
12281
  const addTag = () => {
11762
12282
  const tag = inputValue.trim();
11763
- if (!tag) return;
12283
+ if (!tag)
12284
+ return;
11764
12285
  if (!allowDuplicates && value.includes(tag)) {
11765
12286
  setError("This tag already exists");
11766
12287
  setTimeout(() => setError(""), 2e3);
@@ -11776,7 +12297,8 @@ var TagsInput = t.forwardRef(
11776
12297
  setError("");
11777
12298
  };
11778
12299
  const removeTag = (index) => {
11779
- if (disabled) return;
12300
+ if (disabled)
12301
+ return;
11780
12302
  onChange(value.filter((_, i) => i !== index));
11781
12303
  };
11782
12304
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
@@ -11839,32 +12361,147 @@ var TagsInput = t.forwardRef(
11839
12361
  }
11840
12362
  );
11841
12363
  TagsInput.displayName = "TagsInput";
12364
+ var textareaVariants = cva(
12365
+ [
12366
+ "flex w-full rounded-md px-3 py-2 text-sm transition-all duration-200",
12367
+ "text-foreground placeholder:text-muted-foreground dark:placeholder:text-gray-500",
12368
+ "disabled:cursor-not-allowed disabled:opacity-50",
12369
+ "focus-visible:outline-none dark:text-gray-200",
12370
+ "resize-none"
12371
+ // Always disable manual resize, we control it
12372
+ ],
12373
+ {
12374
+ variants: {
12375
+ variant: {
12376
+ default: "border border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-800/80 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:shadow-inner dark:shadow-gray-950/10",
12377
+ outline: "border-2 border-gray-300 dark:border-gray-700 bg-transparent hover:border-gray-400 dark:hover:border-gray-600 focus-visible:border-primary dark:focus-visible:border-primary/80",
12378
+ ghost: "border-none bg-transparent hover:bg-gray-100/50 dark:hover:bg-gray-800/30 focus-visible:bg-transparent",
12379
+ underline: "border-t-0 border-l-0 border-r-0 border-b-2 border-gray-300 dark:border-gray-600 rounded-none px-0 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-primary dark:focus-visible:border-primary/80 bg-transparent dark:bg-transparent"
12380
+ },
12381
+ size: {
12382
+ sm: "min-h-[60px] text-xs",
12383
+ md: "min-h-[80px] text-sm",
12384
+ lg: "min-h-[120px] text-base"
12385
+ },
12386
+ isError: {
12387
+ true: "border-error focus-visible:ring-error/30 focus-visible:border-error hover:border-error/80 dark:hover:border-error/80",
12388
+ false: ""
12389
+ },
12390
+ isSuccess: {
12391
+ true: "border-success focus-visible:ring-success/30 focus-visible:border-success hover:border-success/80 dark:hover:border-success/80",
12392
+ false: ""
12393
+ }
12394
+ },
12395
+ defaultVariants: {
12396
+ variant: "default",
12397
+ size: "md",
12398
+ isError: false,
12399
+ isSuccess: false
12400
+ }
12401
+ }
12402
+ );
11842
12403
  var Textarea = t.forwardRef(
11843
12404
  ({
11844
12405
  className,
11845
- // Extract enhanced props to prevent them from being passed to DOM
12406
+ wrapperClassName,
12407
+ messageClassName,
11846
12408
  variant,
11847
12409
  size,
11848
12410
  error,
11849
12411
  success,
11850
12412
  loading,
11851
- autoResize,
12413
+ autoResize = false,
11852
12414
  maxHeight,
11853
- characterCount,
12415
+ characterCount = false,
12416
+ disabled,
12417
+ maxLength,
12418
+ value,
12419
+ defaultValue,
12420
+ onChange,
11854
12421
  ...props
11855
12422
  }, ref) => {
11856
- return /* @__PURE__ */ jsx(
11857
- "textarea",
11858
- {
11859
- className: cn(
11860
- "moonui-theme",
11861
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
11862
- className
11863
- ),
11864
- ref,
11865
- ...props
12423
+ const textareaRef = t.useRef(null);
12424
+ const [internalValue, setInternalValue] = t.useState(value || defaultValue || "");
12425
+ t.useImperativeHandle(ref, () => textareaRef.current);
12426
+ const adjustHeight = t.useCallback(() => {
12427
+ const textarea = textareaRef.current;
12428
+ if (!textarea || !autoResize)
12429
+ return;
12430
+ textarea.style.height = "auto";
12431
+ const newHeight = textarea.scrollHeight;
12432
+ if (maxHeight && newHeight > maxHeight) {
12433
+ textarea.style.height = `${maxHeight}px`;
12434
+ textarea.style.overflowY = "auto";
12435
+ } else {
12436
+ textarea.style.height = `${newHeight}px`;
12437
+ textarea.style.overflowY = "hidden";
11866
12438
  }
11867
- );
12439
+ }, [autoResize, maxHeight]);
12440
+ t.useEffect(() => {
12441
+ adjustHeight();
12442
+ }, [internalValue, adjustHeight]);
12443
+ t.useEffect(() => {
12444
+ if (value !== void 0) {
12445
+ setInternalValue(value);
12446
+ }
12447
+ }, [value]);
12448
+ const handleChange = (e) => {
12449
+ setInternalValue(e.target.value);
12450
+ onChange?.(e);
12451
+ };
12452
+ const currentLength = String(internalValue).length;
12453
+ const showCharCount = characterCount && (maxLength !== void 0 || currentLength > 0);
12454
+ const errorMessage = typeof error === "string" ? error : void 0;
12455
+ const successMessage = typeof success === "string" ? success : void 0;
12456
+ const showMessage = errorMessage || successMessage;
12457
+ return /* @__PURE__ */ jsxs("div", { className: cn("moonui-theme", "space-y-1.5 w-full", wrapperClassName), children: [
12458
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
12459
+ /* @__PURE__ */ jsx(
12460
+ "textarea",
12461
+ {
12462
+ ref: textareaRef,
12463
+ className: cn(
12464
+ textareaVariants({
12465
+ variant,
12466
+ size,
12467
+ isError: !!error,
12468
+ isSuccess: !!success
12469
+ }),
12470
+ loading && "pr-10",
12471
+ className
12472
+ ),
12473
+ disabled: disabled || loading,
12474
+ value,
12475
+ defaultValue,
12476
+ onChange: handleChange,
12477
+ maxLength,
12478
+ "aria-invalid": !!error || void 0,
12479
+ "aria-describedby": errorMessage ? `${props.id || ""}-error` : successMessage ? `${props.id || ""}-success` : void 0,
12480
+ ...props
12481
+ }
12482
+ ),
12483
+ loading && /* @__PURE__ */ jsx("div", { className: "absolute top-3 right-3 text-gray-500", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) })
12484
+ ] }),
12485
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
12486
+ showMessage && /* @__PURE__ */ jsx(
12487
+ "p",
12488
+ {
12489
+ className: cn(
12490
+ "text-xs transition-all",
12491
+ errorMessage && "text-error",
12492
+ successMessage && "text-success",
12493
+ messageClassName
12494
+ ),
12495
+ id: errorMessage ? `${props.id || ""}-error` : successMessage ? `${props.id || ""}-success` : void 0,
12496
+ children: errorMessage || successMessage
12497
+ }
12498
+ ),
12499
+ showCharCount && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground dark:text-gray-500 ml-auto", children: [
12500
+ currentLength,
12501
+ maxLength !== void 0 && ` / ${maxLength}`
12502
+ ] })
12503
+ ] })
12504
+ ] });
11868
12505
  }
11869
12506
  );
11870
12507
  Textarea.displayName = "Textarea";
@@ -12040,7 +12677,8 @@ function toast({ ...props }) {
12040
12677
  id,
12041
12678
  open: true,
12042
12679
  onOpenChange: (open) => {
12043
- if (!open) dismiss();
12680
+ if (!open)
12681
+ dismiss();
12044
12682
  }
12045
12683
  }
12046
12684
  });
@@ -12111,5 +12749,5 @@ function Toaster() {
12111
12749
  */
12112
12750
 
12113
12751
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardCVCInput, CardContent, CardDescription, CardExpiryInput, CardFooter, CardHeader, CardNumberInput, CardTitle, CardZipInput, Checkbox, CheckboxGroup, CheckboxLabel, CheckboxWithLabel, Collapsible2 as Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DatePicker, DateRangePicker, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogForm, DialogHeader, DialogTitle, DialogTrigger, DraggableList, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FileUpload, FreeBadge, GestureDrawer, GitHubStarButton, GitHubStars, GradientPicker, Input, Label, LockedComponent, MonthPicker, MoonLogo, MoonLogoAnimated, MoonLogoIcon, Accordion as MoonUIAccordion, AccordionContent as MoonUIAccordionContent, AccordionItem as MoonUIAccordionItem, AccordionTrigger as MoonUIAccordionTrigger, Alert as MoonUIAlert, AlertDescription as MoonUIAlertDescription, AlertTitle as MoonUIAlertTitle, AspectRatio as MoonUIAspectRatio, Avatar as MoonUIAvatar, AvatarFallback as MoonUIAvatarFallback, AvatarGroup as MoonUIAvatarGroup, AvatarImage as MoonUIAvatarImage, Badge as MoonUIBadge, Breadcrumb as MoonUIBreadcrumb, BreadcrumbEllipsis as MoonUIBreadcrumbEllipsis, BreadcrumbItem as MoonUIBreadcrumbItem, BreadcrumbLink as MoonUIBreadcrumbLink, BreadcrumbList as MoonUIBreadcrumbList, BreadcrumbPage as MoonUIBreadcrumbPage, BreadcrumbSeparator as MoonUIBreadcrumbSeparator, Button as MoonUIButton, Card as MoonUICard, CardCVCInput as MoonUICardCVCInput, CardContent as MoonUICardContent, CardDescription as MoonUICardDescription, CardExpiryInput as MoonUICardExpiryInput, CardFooter as MoonUICardFooter, CardHeader as MoonUICardHeader, CardNumberInput as MoonUICardNumberInput, CardTitle as MoonUICardTitle, CardZipInput as MoonUICardZipInput, Checkbox as MoonUICheckbox, CheckboxGroup as MoonUICheckboxGroup, CheckboxLabel as MoonUICheckboxLabel, CheckboxWithLabel as MoonUICheckboxWithLabel, Collapsible2 as MoonUICollapsible, CollapsibleContent2 as MoonUICollapsibleContent, CollapsibleTrigger2 as MoonUICollapsibleTrigger, ColorPicker as MoonUIColorPicker, Command as MoonUICommand, CommandDialog as MoonUICommandDialog, CommandEmpty as MoonUICommandEmpty, CommandGroup as MoonUICommandGroup, CommandInput as MoonUICommandInput, CommandItem as MoonUICommandItem, CommandList as MoonUICommandList, CommandSeparator as MoonUICommandSeparator, CommandShortcut as MoonUICommandShortcut, DataTableBasic as MoonUIDataTableBasic, DatePicker as MoonUIDatePicker, DateRangePicker as MoonUIDateRangePicker, DateTimePicker as MoonUIDateTimePicker, Dialog as MoonUIDialog, DialogClose as MoonUIDialogClose, DialogContent as MoonUIDialogContent, DialogDescription as MoonUIDialogDescription, DialogFooter as MoonUIDialogFooter, DialogHeader as MoonUIDialogHeader, DialogTitle as MoonUIDialogTitle, DialogTrigger as MoonUIDialogTrigger, DraggableList as MoonUIDraggableList, DropdownMenu as MoonUIDropdownMenu, DropdownMenuCheckboxItem as MoonUIDropdownMenuCheckboxItem, DropdownMenuContent as MoonUIDropdownMenuContent, DropdownMenuGroup as MoonUIDropdownMenuGroup, DropdownMenuItem as MoonUIDropdownMenuItem, DropdownMenuLabel as MoonUIDropdownMenuLabel, DropdownMenuPortal as MoonUIDropdownMenuPortal, DropdownMenuRadioGroup as MoonUIDropdownMenuRadioGroup, DropdownMenuRadioItem as MoonUIDropdownMenuRadioItem, DropdownMenuSeparator as MoonUIDropdownMenuSeparator, DropdownMenuShortcut as MoonUIDropdownMenuShortcut, DropdownMenuSub as MoonUIDropdownMenuSub, DropdownMenuSubContent as MoonUIDropdownMenuSubContent, DropdownMenuSubTrigger as MoonUIDropdownMenuSubTrigger, DropdownMenuTrigger as MoonUIDropdownMenuTrigger, FileUpload as MoonUIFileUpload, FreeBadge as MoonUIFreeBadge, GestureDrawer as MoonUIGestureDrawer, GitHubStars as MoonUIGitHubStars, GradientPicker as MoonUIGradientPicker, Input as MoonUIInput, Label as MoonUILabel, LockedComponent as MoonUILockedComponent, MonthPicker as MoonUIMonthPicker, MoonLogo as MoonUIMoonLogo, Pagination as MoonUIPagination, PaginationContent as MoonUIPaginationContent, PaginationEllipsis as MoonUIPaginationEllipsis, PaginationItem as MoonUIPaginationItem, PaginationLink as MoonUIPaginationLink, PaginationNext as MoonUIPaginationNext, PaginationPrevious as MoonUIPaginationPrevious, PhoneInput as MoonUIPhoneInput, Popover as MoonUIPopover, PopoverContent as MoonUIPopoverContent, PopoverTrigger as MoonUIPopoverTrigger, ProBadge as MoonUIProBadge, ProComponentWrapper as MoonUIProComponentWrapper, Progress as MoonUIProgress, RadioGroup2 as MoonUIRadioGroup, RadioGroupItem as MoonUIRadioGroupItem, RadioItemWithLabel as MoonUIRadioItemWithLabel, RadioLabel as MoonUIRadioLabel, RichTextEditor as MoonUIRichTextEditor, ScrollArea2 as MoonUIScrollArea, ScrollBar as MoonUIScrollBar, ScrollReveal as MoonUIScrollReveal, ScrollRevealContainer as MoonUIScrollRevealContainer, ScrollRevealItem as MoonUIScrollRevealItem, Select as MoonUISelect, SelectContent as MoonUISelectContent, SelectGroup as MoonUISelectGroup, SelectItem as MoonUISelectItem, SelectLabel as MoonUISelectLabel, SelectScrollDownButton as MoonUISelectScrollDownButton, SelectScrollUpButton as MoonUISelectScrollUpButton, SelectSeparator as MoonUISelectSeparator, SelectTrigger as MoonUISelectTrigger, SelectValue as MoonUISelectValue, Separator3 as MoonUISeparator, SimpleColorPicker as MoonUISimpleColorPicker, SimpleEditor as MoonUISimpleEditor, Skeleton as MoonUISkeleton, SkeletonAvatar as MoonUISkeletonAvatar, SkeletonCard as MoonUISkeletonCard, SkeletonText as MoonUISkeletonText, Slider as MoonUISlider, SwipeableCard as MoonUISwipeableCard, Switch as MoonUISwitch, Table as MoonUITable, TableBody as MoonUITableBody, TableCaption as MoonUITableCaption, TableCell as MoonUITableCell, TableFooter as MoonUITableFooter, TableHead as MoonUITableHead, TableHeader as MoonUITableHeader, TableRow as MoonUITableRow, Tabs as MoonUITabs, TabsContent as MoonUITabsContent, TabsList as MoonUITabsList, TabsTrigger as MoonUITabsTrigger, TagsInput as MoonUITagsInput, Textarea as MoonUITextarea, Toast as MoonUIToast, ToastAction as MoonUIToastAction, ToastClose as MoonUIToastClose, ToastDescription as MoonUIToastDescription, ToastProvider as MoonUIToastProvider, ToastTitle as MoonUIToastTitle, ToastViewport as MoonUIToastViewport, Toaster as MoonUIToaster, Toggle2 as MoonUIToggle, Tooltip as MoonUITooltip, TooltipContent as MoonUITooltipContent, TooltipProvider as MoonUITooltipProvider, TooltipTrigger as MoonUITooltipTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PhoneInput, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverFooter, PopoverHeader, PopoverSeparator, PopoverTrigger, ProBadge, ProComponentWrapper, Progress, RadioGroup2 as RadioGroup, RadioGroupItem, RadioItemWithLabel, RadioLabel, RichTextEditor, ScrollArea2 as ScrollArea, ScrollBar, ScrollReveal, ScrollRevealContainer, ScrollRevealItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, SimpleColorPicker, SimpleEditor, SimpleTooltip, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonText, Slider, SwipeableCard, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle2 as Toggle, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, aspectRatioVariants, badgeVariants, buttonVariants, cn, collapsibleContentVariants, collapsibleTriggerVariants, badgeVariants as moonUIBadgeVariants, buttonVariants as moonUIButtonVariants, createSortableHeader as moonUICreateSortableHeader, skeletonVariants as moonUISkeletonVariants, toggleVariants as moonUIToggleVariants, popoverContentVariants, progressVariants, separatorVariants, skeletonVariants, toast, toggleVariants, tooltipVariants, useToast };
12114
- //# sourceMappingURL=index.mjs.map
12752
+ //# sourceMappingURL=out.js.map
12115
12753
  //# sourceMappingURL=index.mjs.map