@huahaharis/ui 0.1.0 → 0.1.1

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.js CHANGED
@@ -1,36 +1,13 @@
1
- 'use strict';
1
+ import * as React2 from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { cva } from 'class-variance-authority';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
7
+ import { ChevronDownIcon } from 'lucide-react';
8
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
2
9
 
3
- var React25 = require('react');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var clsx = require('clsx');
6
- var tailwindMerge = require('tailwind-merge');
7
- var AccordionPrimitive = require('@radix-ui/react-accordion');
8
- var lucideReact = require('lucide-react');
9
- var ReactDOM = require('react-dom');
10
-
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () { return e[k]; }
21
- });
22
- }
23
- });
24
- }
25
- n.default = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
30
- var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
31
- var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
32
-
33
- // ../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs
10
+ // ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs
34
11
  function setRef(ref, value) {
35
12
  if (typeof ref === "function") {
36
13
  return ref(value);
@@ -62,11 +39,8 @@ function composeRefs(...refs) {
62
39
  }
63
40
  };
64
41
  }
65
- function useComposedRefs(...refs) {
66
- return React25__namespace.useCallback(composeRefs(...refs), refs);
67
- }
68
42
  var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
69
- var use = React25__namespace[" use ".trim().toString()];
43
+ var use = React2[" use ".trim().toString()];
70
44
  function isPromiseLike(value) {
71
45
  return typeof value === "object" && value !== null && "then" in value;
72
46
  }
@@ -76,54 +50,54 @@ function isLazyComponent(element) {
76
50
  // @__NO_SIDE_EFFECTS__
77
51
  function createSlot(ownerName) {
78
52
  const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
79
- const Slot22 = React25__namespace.forwardRef((props, forwardedRef) => {
53
+ const Slot2 = React2.forwardRef((props, forwardedRef) => {
80
54
  let { children, ...slotProps } = props;
81
55
  if (isLazyComponent(children) && typeof use === "function") {
82
56
  children = use(children._payload);
83
57
  }
84
- const childrenArray = React25__namespace.Children.toArray(children);
58
+ const childrenArray = React2.Children.toArray(children);
85
59
  const slottable = childrenArray.find(isSlottable);
86
60
  if (slottable) {
87
61
  const newElement = slottable.props.children;
88
62
  const newChildren = childrenArray.map((child) => {
89
63
  if (child === slottable) {
90
- if (React25__namespace.Children.count(newElement) > 1) return React25__namespace.Children.only(null);
91
- return React25__namespace.isValidElement(newElement) ? newElement.props.children : null;
64
+ if (React2.Children.count(newElement) > 1) return React2.Children.only(null);
65
+ return React2.isValidElement(newElement) ? newElement.props.children : null;
92
66
  } else {
93
67
  return child;
94
68
  }
95
69
  });
96
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React25__namespace.isValidElement(newElement) ? React25__namespace.cloneElement(newElement, void 0, newChildren) : null });
70
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
97
71
  }
98
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
72
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
99
73
  });
100
- Slot22.displayName = `${ownerName}.Slot`;
101
- return Slot22;
74
+ Slot2.displayName = `${ownerName}.Slot`;
75
+ return Slot2;
102
76
  }
103
77
  var Slot = /* @__PURE__ */ createSlot("Slot");
104
78
  // @__NO_SIDE_EFFECTS__
105
79
  function createSlotClone(ownerName) {
106
- const SlotClone = React25__namespace.forwardRef((props, forwardedRef) => {
80
+ const SlotClone = React2.forwardRef((props, forwardedRef) => {
107
81
  let { children, ...slotProps } = props;
108
82
  if (isLazyComponent(children) && typeof use === "function") {
109
83
  children = use(children._payload);
110
84
  }
111
- if (React25__namespace.isValidElement(children)) {
85
+ if (React2.isValidElement(children)) {
112
86
  const childrenRef = getElementRef(children);
113
87
  const props2 = mergeProps(slotProps, children.props);
114
- if (children.type !== React25__namespace.Fragment) {
88
+ if (children.type !== React2.Fragment) {
115
89
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
116
90
  }
117
- return React25__namespace.cloneElement(children, props2);
91
+ return React2.cloneElement(children, props2);
118
92
  }
119
- return React25__namespace.Children.count(children) > 1 ? React25__namespace.Children.only(null) : null;
93
+ return React2.Children.count(children) > 1 ? React2.Children.only(null) : null;
120
94
  });
121
95
  SlotClone.displayName = `${ownerName}.SlotClone`;
122
96
  return SlotClone;
123
97
  }
124
98
  var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
125
99
  function isSlottable(child) {
126
- return React25__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
100
+ return React2.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
127
101
  }
128
102
  function mergeProps(slotProps, childProps) {
129
103
  const overrideProps = { ...childProps };
@@ -162,48 +136,8 @@ function getElementRef(element) {
162
136
  }
163
137
  return element.props.ref || element.ref;
164
138
  }
165
- var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
166
- var cx = clsx.clsx;
167
- var cva = (base, config) => (props) => {
168
- var _config_compoundVariants;
169
- if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
170
- const { variants, defaultVariants } = config;
171
- const getVariantClassNames = Object.keys(variants).map((variant) => {
172
- const variantProp = props === null || props === void 0 ? void 0 : props[variant];
173
- const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
174
- if (variantProp === null) return null;
175
- const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
176
- return variants[variant][variantKey];
177
- });
178
- const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
179
- let [key, value] = param;
180
- if (value === void 0) {
181
- return acc;
182
- }
183
- acc[key] = value;
184
- return acc;
185
- }, {});
186
- const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
187
- let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
188
- return Object.entries(compoundVariantOptions).every((param2) => {
189
- let [key, value] = param2;
190
- return Array.isArray(value) ? value.includes({
191
- ...defaultVariants,
192
- ...propsWithoutUndefined
193
- }[key]) : {
194
- ...defaultVariants,
195
- ...propsWithoutUndefined
196
- }[key] === value;
197
- }) ? [
198
- ...acc,
199
- cvClass,
200
- cvClassName
201
- ] : acc;
202
- }, []);
203
- return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
204
- };
205
139
  function cn(...inputs) {
206
- return tailwindMerge.twMerge(clsx.clsx(inputs));
140
+ return twMerge(clsx(inputs));
207
141
  }
208
142
  var buttonVariants = cva(
209
143
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
@@ -240,7 +174,7 @@ function Button({
240
174
  ...props
241
175
  }) {
242
176
  const Comp = asChild ? Slot : "button";
243
- return /* @__PURE__ */ jsxRuntime.jsx(
177
+ return /* @__PURE__ */ jsx(
244
178
  Comp,
245
179
  {
246
180
  "data-slot": "button",
@@ -252,14 +186,14 @@ function Button({
252
186
  function Accordion({
253
187
  ...props
254
188
  }) {
255
- return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Root, { "data-slot": "accordion", ...props });
189
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
256
190
  }
257
191
  function AccordionItem({
258
192
  className,
259
193
  ...props
260
194
  }) {
261
- return /* @__PURE__ */ jsxRuntime.jsx(
262
- AccordionPrimitive__namespace.Item,
195
+ return /* @__PURE__ */ jsx(
196
+ AccordionPrimitive.Item,
263
197
  {
264
198
  "data-slot": "accordion-item",
265
199
  className: cn("border-b last:border-b-0", className),
@@ -272,8 +206,8 @@ function AccordionTrigger({
272
206
  children,
273
207
  ...props
274
208
  }) {
275
- return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { className: "flex", children: /* @__PURE__ */ jsxRuntime.jsxs(
276
- AccordionPrimitive__namespace.Trigger,
209
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
210
+ AccordionPrimitive.Trigger,
277
211
  {
278
212
  "data-slot": "accordion-trigger",
279
213
  className: cn(
@@ -283,7 +217,7 @@ function AccordionTrigger({
283
217
  ...props,
284
218
  children: [
285
219
  children,
286
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
220
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
287
221
  ]
288
222
  }
289
223
  ) });
@@ -293,2146 +227,37 @@ function AccordionContent({
293
227
  children,
294
228
  ...props
295
229
  }) {
296
- return /* @__PURE__ */ jsxRuntime.jsx(
297
- AccordionPrimitive__namespace.Content,
230
+ return /* @__PURE__ */ jsx(
231
+ AccordionPrimitive.Content,
298
232
  {
299
233
  "data-slot": "accordion-content",
300
234
  className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
301
235
  ...props,
302
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("pt-0 pb-4", className), children })
303
- }
304
- );
305
- }
306
- function createContext2(rootComponentName, defaultContext) {
307
- const Context = React25__namespace.createContext(defaultContext);
308
- const Provider = (props) => {
309
- const { children, ...context } = props;
310
- const value = React25__namespace.useMemo(() => context, Object.values(context));
311
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
312
- };
313
- Provider.displayName = rootComponentName + "Provider";
314
- function useContext22(consumerName) {
315
- const context = React25__namespace.useContext(Context);
316
- if (context) return context;
317
- if (defaultContext !== void 0) return defaultContext;
318
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
319
- }
320
- return [Provider, useContext22];
321
- }
322
- function createContextScope(scopeName, createContextScopeDeps = []) {
323
- let defaultContexts = [];
324
- function createContext32(rootComponentName, defaultContext) {
325
- const BaseContext = React25__namespace.createContext(defaultContext);
326
- const index = defaultContexts.length;
327
- defaultContexts = [...defaultContexts, defaultContext];
328
- const Provider = (props) => {
329
- const { scope, children, ...context } = props;
330
- const Context = scope?.[scopeName]?.[index] || BaseContext;
331
- const value = React25__namespace.useMemo(() => context, Object.values(context));
332
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
333
- };
334
- Provider.displayName = rootComponentName + "Provider";
335
- function useContext22(consumerName, scope) {
336
- const Context = scope?.[scopeName]?.[index] || BaseContext;
337
- const context = React25__namespace.useContext(Context);
338
- if (context) return context;
339
- if (defaultContext !== void 0) return defaultContext;
340
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
341
- }
342
- return [Provider, useContext22];
343
- }
344
- const createScope = () => {
345
- const scopeContexts = defaultContexts.map((defaultContext) => {
346
- return React25__namespace.createContext(defaultContext);
347
- });
348
- return function useScope(scope) {
349
- const contexts = scope?.[scopeName] || scopeContexts;
350
- return React25__namespace.useMemo(
351
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
352
- [scope, contexts]
353
- );
354
- };
355
- };
356
- createScope.scopeName = scopeName;
357
- return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
358
- }
359
- function composeContextScopes(...scopes) {
360
- const baseScope = scopes[0];
361
- if (scopes.length === 1) return baseScope;
362
- const createScope = () => {
363
- const scopeHooks = scopes.map((createScope2) => ({
364
- useScope: createScope2(),
365
- scopeName: createScope2.scopeName
366
- }));
367
- return function useComposedScopes(overrideScopes) {
368
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
369
- const scopeProps = useScope(overrideScopes);
370
- const currentScope = scopeProps[`__scope${scopeName}`];
371
- return { ...nextScopes2, ...currentScope };
372
- }, {});
373
- return React25__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
374
- };
375
- };
376
- createScope.scopeName = baseScope.scopeName;
377
- return createScope;
378
- }
379
- function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
380
- return function handleEvent(event) {
381
- originalEventHandler?.(event);
382
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
383
- return ourEventHandler?.(event);
384
- }
385
- };
386
- }
387
- var useLayoutEffect2 = globalThis?.document ? React25__namespace.useLayoutEffect : () => {
388
- };
389
-
390
- // ../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-id/dist/index.mjs
391
- var useReactId = React25__namespace[" useId ".trim().toString()] || (() => void 0);
392
- var count = 0;
393
- function useId(deterministicId) {
394
- const [id, setId] = React25__namespace.useState(useReactId());
395
- useLayoutEffect2(() => {
396
- setId((reactId) => reactId ?? String(count++));
397
- }, [deterministicId]);
398
- return deterministicId || (id ? `radix-${id}` : "");
399
- }
400
- var useInsertionEffect = React25__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
401
- function useControllableState({
402
- prop,
403
- defaultProp,
404
- onChange = () => {
405
- },
406
- caller
407
- }) {
408
- const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
409
- defaultProp,
410
- onChange
411
- });
412
- const isControlled = prop !== void 0;
413
- const value = isControlled ? prop : uncontrolledProp;
414
- {
415
- const isControlledRef = React25__namespace.useRef(prop !== void 0);
416
- React25__namespace.useEffect(() => {
417
- const wasControlled = isControlledRef.current;
418
- if (wasControlled !== isControlled) {
419
- const from = wasControlled ? "controlled" : "uncontrolled";
420
- const to = isControlled ? "controlled" : "uncontrolled";
421
- console.warn(
422
- `${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.`
423
- );
424
- }
425
- isControlledRef.current = isControlled;
426
- }, [isControlled, caller]);
427
- }
428
- const setValue = React25__namespace.useCallback(
429
- (nextValue) => {
430
- if (isControlled) {
431
- const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
432
- if (value2 !== prop) {
433
- onChangeRef.current?.(value2);
434
- }
435
- } else {
436
- setUncontrolledProp(nextValue);
437
- }
438
- },
439
- [isControlled, prop, setUncontrolledProp, onChangeRef]
440
- );
441
- return [value, setValue];
442
- }
443
- function useUncontrolledState({
444
- defaultProp,
445
- onChange
446
- }) {
447
- const [value, setValue] = React25__namespace.useState(defaultProp);
448
- const prevValueRef = React25__namespace.useRef(value);
449
- const onChangeRef = React25__namespace.useRef(onChange);
450
- useInsertionEffect(() => {
451
- onChangeRef.current = onChange;
452
- }, [onChange]);
453
- React25__namespace.useEffect(() => {
454
- if (prevValueRef.current !== value) {
455
- onChangeRef.current?.(value);
456
- prevValueRef.current = value;
457
- }
458
- }, [value, prevValueRef]);
459
- return [value, setValue, onChangeRef];
460
- }
461
- function isFunction(value) {
462
- return typeof value === "function";
463
- }
464
- // @__NO_SIDE_EFFECTS__
465
- function createSlot2(ownerName) {
466
- const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName);
467
- const Slot22 = React25__namespace.forwardRef((props, forwardedRef) => {
468
- const { children, ...slotProps } = props;
469
- const childrenArray = React25__namespace.Children.toArray(children);
470
- const slottable = childrenArray.find(isSlottable2);
471
- if (slottable) {
472
- const newElement = slottable.props.children;
473
- const newChildren = childrenArray.map((child) => {
474
- if (child === slottable) {
475
- if (React25__namespace.Children.count(newElement) > 1) return React25__namespace.Children.only(null);
476
- return React25__namespace.isValidElement(newElement) ? newElement.props.children : null;
477
- } else {
478
- return child;
479
- }
480
- });
481
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React25__namespace.isValidElement(newElement) ? React25__namespace.cloneElement(newElement, void 0, newChildren) : null });
482
- }
483
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
484
- });
485
- Slot22.displayName = `${ownerName}.Slot`;
486
- return Slot22;
487
- }
488
- // @__NO_SIDE_EFFECTS__
489
- function createSlotClone2(ownerName) {
490
- const SlotClone = React25__namespace.forwardRef((props, forwardedRef) => {
491
- const { children, ...slotProps } = props;
492
- if (React25__namespace.isValidElement(children)) {
493
- const childrenRef = getElementRef2(children);
494
- const props2 = mergeProps2(slotProps, children.props);
495
- if (children.type !== React25__namespace.Fragment) {
496
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
497
- }
498
- return React25__namespace.cloneElement(children, props2);
499
- }
500
- return React25__namespace.Children.count(children) > 1 ? React25__namespace.Children.only(null) : null;
501
- });
502
- SlotClone.displayName = `${ownerName}.SlotClone`;
503
- return SlotClone;
504
- }
505
- var SLOTTABLE_IDENTIFIER2 = /* @__PURE__ */ Symbol("radix.slottable");
506
- // @__NO_SIDE_EFFECTS__
507
- function createSlottable(ownerName) {
508
- const Slottable2 = ({ children }) => {
509
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
510
- };
511
- Slottable2.displayName = `${ownerName}.Slottable`;
512
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER2;
513
- return Slottable2;
514
- }
515
- function isSlottable2(child) {
516
- return React25__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2;
517
- }
518
- function mergeProps2(slotProps, childProps) {
519
- const overrideProps = { ...childProps };
520
- for (const propName in childProps) {
521
- const slotPropValue = slotProps[propName];
522
- const childPropValue = childProps[propName];
523
- const isHandler = /^on[A-Z]/.test(propName);
524
- if (isHandler) {
525
- if (slotPropValue && childPropValue) {
526
- overrideProps[propName] = (...args) => {
527
- const result = childPropValue(...args);
528
- slotPropValue(...args);
529
- return result;
530
- };
531
- } else if (slotPropValue) {
532
- overrideProps[propName] = slotPropValue;
533
- }
534
- } else if (propName === "style") {
535
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
536
- } else if (propName === "className") {
537
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
538
- }
539
- }
540
- return { ...slotProps, ...overrideProps };
541
- }
542
- function getElementRef2(element) {
543
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
544
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
545
- if (mayWarn) {
546
- return element.ref;
547
- }
548
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
549
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
550
- if (mayWarn) {
551
- return element.props.ref;
552
- }
553
- return element.props.ref || element.ref;
554
- }
555
- var NODES = [
556
- "a",
557
- "button",
558
- "div",
559
- "form",
560
- "h2",
561
- "h3",
562
- "img",
563
- "input",
564
- "label",
565
- "li",
566
- "nav",
567
- "ol",
568
- "p",
569
- "select",
570
- "span",
571
- "svg",
572
- "ul"
573
- ];
574
- var Primitive = NODES.reduce((primitive, node) => {
575
- const Slot3 = createSlot2(`Primitive.${node}`);
576
- const Node2 = React25__namespace.forwardRef((props, forwardedRef) => {
577
- const { asChild, ...primitiveProps } = props;
578
- const Comp = asChild ? Slot3 : node;
579
- if (typeof window !== "undefined") {
580
- window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
581
- }
582
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
583
- });
584
- Node2.displayName = `Primitive.${node}`;
585
- return { ...primitive, [node]: Node2 };
586
- }, {});
587
- function dispatchDiscreteCustomEvent(target, event) {
588
- if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
589
- }
590
- function useCallbackRef(callback) {
591
- const callbackRef = React25__namespace.useRef(callback);
592
- React25__namespace.useEffect(() => {
593
- callbackRef.current = callback;
594
- });
595
- return React25__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
596
- }
597
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
598
- const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
599
- React25__namespace.useEffect(() => {
600
- const handleKeyDown = (event) => {
601
- if (event.key === "Escape") {
602
- onEscapeKeyDown(event);
603
- }
604
- };
605
- ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
606
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
607
- }, [onEscapeKeyDown, ownerDocument]);
608
- }
609
- var DISMISSABLE_LAYER_NAME = "DismissableLayer";
610
- var CONTEXT_UPDATE = "dismissableLayer.update";
611
- var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
612
- var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
613
- var originalBodyPointerEvents;
614
- var DismissableLayerContext = React25__namespace.createContext({
615
- layers: /* @__PURE__ */ new Set(),
616
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
617
- branches: /* @__PURE__ */ new Set()
618
- });
619
- var DismissableLayer = React25__namespace.forwardRef(
620
- (props, forwardedRef) => {
621
- const {
622
- disableOutsidePointerEvents = false,
623
- onEscapeKeyDown,
624
- onPointerDownOutside,
625
- onFocusOutside,
626
- onInteractOutside,
627
- onDismiss,
628
- ...layerProps
629
- } = props;
630
- const context = React25__namespace.useContext(DismissableLayerContext);
631
- const [node, setNode] = React25__namespace.useState(null);
632
- const ownerDocument = node?.ownerDocument ?? globalThis?.document;
633
- const [, force] = React25__namespace.useState({});
634
- const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
635
- const layers = Array.from(context.layers);
636
- const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
637
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
638
- const index = node ? layers.indexOf(node) : -1;
639
- const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
640
- const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
641
- const pointerDownOutside = usePointerDownOutside((event) => {
642
- const target = event.target;
643
- const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
644
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
645
- onPointerDownOutside?.(event);
646
- onInteractOutside?.(event);
647
- if (!event.defaultPrevented) onDismiss?.();
648
- }, ownerDocument);
649
- const focusOutside = useFocusOutside((event) => {
650
- const target = event.target;
651
- const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
652
- if (isFocusInBranch) return;
653
- onFocusOutside?.(event);
654
- onInteractOutside?.(event);
655
- if (!event.defaultPrevented) onDismiss?.();
656
- }, ownerDocument);
657
- useEscapeKeydown((event) => {
658
- const isHighestLayer = index === context.layers.size - 1;
659
- if (!isHighestLayer) return;
660
- onEscapeKeyDown?.(event);
661
- if (!event.defaultPrevented && onDismiss) {
662
- event.preventDefault();
663
- onDismiss();
664
- }
665
- }, ownerDocument);
666
- React25__namespace.useEffect(() => {
667
- if (!node) return;
668
- if (disableOutsidePointerEvents) {
669
- if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
670
- originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
671
- ownerDocument.body.style.pointerEvents = "none";
672
- }
673
- context.layersWithOutsidePointerEventsDisabled.add(node);
674
- }
675
- context.layers.add(node);
676
- dispatchUpdate();
677
- return () => {
678
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
679
- ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
680
- }
681
- };
682
- }, [node, ownerDocument, disableOutsidePointerEvents, context]);
683
- React25__namespace.useEffect(() => {
684
- return () => {
685
- if (!node) return;
686
- context.layers.delete(node);
687
- context.layersWithOutsidePointerEventsDisabled.delete(node);
688
- dispatchUpdate();
689
- };
690
- }, [node, context]);
691
- React25__namespace.useEffect(() => {
692
- const handleUpdate = () => force({});
693
- document.addEventListener(CONTEXT_UPDATE, handleUpdate);
694
- return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
695
- }, []);
696
- return /* @__PURE__ */ jsxRuntime.jsx(
697
- Primitive.div,
698
- {
699
- ...layerProps,
700
- ref: composedRefs,
701
- style: {
702
- pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
703
- ...props.style
704
- },
705
- onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
706
- onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
707
- onPointerDownCapture: composeEventHandlers(
708
- props.onPointerDownCapture,
709
- pointerDownOutside.onPointerDownCapture
710
- )
711
- }
712
- );
713
- }
714
- );
715
- DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
716
- var BRANCH_NAME = "DismissableLayerBranch";
717
- var DismissableLayerBranch = React25__namespace.forwardRef((props, forwardedRef) => {
718
- const context = React25__namespace.useContext(DismissableLayerContext);
719
- const ref = React25__namespace.useRef(null);
720
- const composedRefs = useComposedRefs(forwardedRef, ref);
721
- React25__namespace.useEffect(() => {
722
- const node = ref.current;
723
- if (node) {
724
- context.branches.add(node);
725
- return () => {
726
- context.branches.delete(node);
727
- };
728
- }
729
- }, [context.branches]);
730
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
731
- });
732
- DismissableLayerBranch.displayName = BRANCH_NAME;
733
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
734
- const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
735
- const isPointerInsideReactTreeRef = React25__namespace.useRef(false);
736
- const handleClickRef = React25__namespace.useRef(() => {
737
- });
738
- React25__namespace.useEffect(() => {
739
- const handlePointerDown = (event) => {
740
- if (event.target && !isPointerInsideReactTreeRef.current) {
741
- let handleAndDispatchPointerDownOutsideEvent2 = function() {
742
- handleAndDispatchCustomEvent(
743
- POINTER_DOWN_OUTSIDE,
744
- handlePointerDownOutside,
745
- eventDetail,
746
- { discrete: true }
747
- );
748
- };
749
- const eventDetail = { originalEvent: event };
750
- if (event.pointerType === "touch") {
751
- ownerDocument.removeEventListener("click", handleClickRef.current);
752
- handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
753
- ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
754
- } else {
755
- handleAndDispatchPointerDownOutsideEvent2();
756
- }
757
- } else {
758
- ownerDocument.removeEventListener("click", handleClickRef.current);
759
- }
760
- isPointerInsideReactTreeRef.current = false;
761
- };
762
- const timerId = window.setTimeout(() => {
763
- ownerDocument.addEventListener("pointerdown", handlePointerDown);
764
- }, 0);
765
- return () => {
766
- window.clearTimeout(timerId);
767
- ownerDocument.removeEventListener("pointerdown", handlePointerDown);
768
- ownerDocument.removeEventListener("click", handleClickRef.current);
769
- };
770
- }, [ownerDocument, handlePointerDownOutside]);
771
- return {
772
- // ensures we check React component tree (not just DOM tree)
773
- onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
774
- };
775
- }
776
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
777
- const handleFocusOutside = useCallbackRef(onFocusOutside);
778
- const isFocusInsideReactTreeRef = React25__namespace.useRef(false);
779
- React25__namespace.useEffect(() => {
780
- const handleFocus = (event) => {
781
- if (event.target && !isFocusInsideReactTreeRef.current) {
782
- const eventDetail = { originalEvent: event };
783
- handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
784
- discrete: false
785
- });
786
- }
787
- };
788
- ownerDocument.addEventListener("focusin", handleFocus);
789
- return () => ownerDocument.removeEventListener("focusin", handleFocus);
790
- }, [ownerDocument, handleFocusOutside]);
791
- return {
792
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
793
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
794
- };
795
- }
796
- function dispatchUpdate() {
797
- const event = new CustomEvent(CONTEXT_UPDATE);
798
- document.dispatchEvent(event);
799
- }
800
- function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
801
- const target = detail.originalEvent.target;
802
- const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
803
- if (handler) target.addEventListener(name, handler, { once: true });
804
- if (discrete) {
805
- dispatchDiscreteCustomEvent(target, event);
806
- } else {
807
- target.dispatchEvent(event);
808
- }
809
- }
810
- var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
811
- var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
812
- var EVENT_OPTIONS = { bubbles: false, cancelable: true };
813
- var FOCUS_SCOPE_NAME = "FocusScope";
814
- var FocusScope = React25__namespace.forwardRef((props, forwardedRef) => {
815
- const {
816
- loop = false,
817
- trapped = false,
818
- onMountAutoFocus: onMountAutoFocusProp,
819
- onUnmountAutoFocus: onUnmountAutoFocusProp,
820
- ...scopeProps
821
- } = props;
822
- const [container, setContainer] = React25__namespace.useState(null);
823
- const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
824
- const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
825
- const lastFocusedElementRef = React25__namespace.useRef(null);
826
- const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
827
- const focusScope = React25__namespace.useRef({
828
- paused: false,
829
- pause() {
830
- this.paused = true;
831
- },
832
- resume() {
833
- this.paused = false;
834
- }
835
- }).current;
836
- React25__namespace.useEffect(() => {
837
- if (trapped) {
838
- let handleFocusIn2 = function(event) {
839
- if (focusScope.paused || !container) return;
840
- const target = event.target;
841
- if (container.contains(target)) {
842
- lastFocusedElementRef.current = target;
843
- } else {
844
- focus(lastFocusedElementRef.current, { select: true });
845
- }
846
- }, handleFocusOut2 = function(event) {
847
- if (focusScope.paused || !container) return;
848
- const relatedTarget = event.relatedTarget;
849
- if (relatedTarget === null) return;
850
- if (!container.contains(relatedTarget)) {
851
- focus(lastFocusedElementRef.current, { select: true });
852
- }
853
- }, handleMutations2 = function(mutations) {
854
- const focusedElement = document.activeElement;
855
- if (focusedElement !== document.body) return;
856
- for (const mutation of mutations) {
857
- if (mutation.removedNodes.length > 0) focus(container);
858
- }
859
- };
860
- document.addEventListener("focusin", handleFocusIn2);
861
- document.addEventListener("focusout", handleFocusOut2);
862
- const mutationObserver = new MutationObserver(handleMutations2);
863
- if (container) mutationObserver.observe(container, { childList: true, subtree: true });
864
- return () => {
865
- document.removeEventListener("focusin", handleFocusIn2);
866
- document.removeEventListener("focusout", handleFocusOut2);
867
- mutationObserver.disconnect();
868
- };
869
- }
870
- }, [trapped, container, focusScope.paused]);
871
- React25__namespace.useEffect(() => {
872
- if (container) {
873
- focusScopesStack.add(focusScope);
874
- const previouslyFocusedElement = document.activeElement;
875
- const hasFocusedCandidate = container.contains(previouslyFocusedElement);
876
- if (!hasFocusedCandidate) {
877
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
878
- container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
879
- container.dispatchEvent(mountEvent);
880
- if (!mountEvent.defaultPrevented) {
881
- focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
882
- if (document.activeElement === previouslyFocusedElement) {
883
- focus(container);
884
- }
885
- }
886
- }
887
- return () => {
888
- container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
889
- setTimeout(() => {
890
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
891
- container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
892
- container.dispatchEvent(unmountEvent);
893
- if (!unmountEvent.defaultPrevented) {
894
- focus(previouslyFocusedElement ?? document.body, { select: true });
895
- }
896
- container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
897
- focusScopesStack.remove(focusScope);
898
- }, 0);
899
- };
900
- }
901
- }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
902
- const handleKeyDown = React25__namespace.useCallback(
903
- (event) => {
904
- if (!loop && !trapped) return;
905
- if (focusScope.paused) return;
906
- const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
907
- const focusedElement = document.activeElement;
908
- if (isTabKey && focusedElement) {
909
- const container2 = event.currentTarget;
910
- const [first, last] = getTabbableEdges(container2);
911
- const hasTabbableElementsInside = first && last;
912
- if (!hasTabbableElementsInside) {
913
- if (focusedElement === container2) event.preventDefault();
914
- } else {
915
- if (!event.shiftKey && focusedElement === last) {
916
- event.preventDefault();
917
- if (loop) focus(first, { select: true });
918
- } else if (event.shiftKey && focusedElement === first) {
919
- event.preventDefault();
920
- if (loop) focus(last, { select: true });
921
- }
922
- }
923
- }
924
- },
925
- [loop, trapped, focusScope.paused]
926
- );
927
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
928
- });
929
- FocusScope.displayName = FOCUS_SCOPE_NAME;
930
- function focusFirst(candidates, { select = false } = {}) {
931
- const previouslyFocusedElement = document.activeElement;
932
- for (const candidate of candidates) {
933
- focus(candidate, { select });
934
- if (document.activeElement !== previouslyFocusedElement) return;
935
- }
936
- }
937
- function getTabbableEdges(container) {
938
- const candidates = getTabbableCandidates(container);
939
- const first = findVisible(candidates, container);
940
- const last = findVisible(candidates.reverse(), container);
941
- return [first, last];
942
- }
943
- function getTabbableCandidates(container) {
944
- const nodes = [];
945
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
946
- acceptNode: (node) => {
947
- const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
948
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
949
- return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
950
- }
951
- });
952
- while (walker.nextNode()) nodes.push(walker.currentNode);
953
- return nodes;
954
- }
955
- function findVisible(elements, container) {
956
- for (const element of elements) {
957
- if (!isHidden(element, { upTo: container })) return element;
958
- }
959
- }
960
- function isHidden(node, { upTo }) {
961
- if (getComputedStyle(node).visibility === "hidden") return true;
962
- while (node) {
963
- if (upTo !== void 0 && node === upTo) return false;
964
- if (getComputedStyle(node).display === "none") return true;
965
- node = node.parentElement;
966
- }
967
- return false;
968
- }
969
- function isSelectableInput(element) {
970
- return element instanceof HTMLInputElement && "select" in element;
971
- }
972
- function focus(element, { select = false } = {}) {
973
- if (element && element.focus) {
974
- const previouslyFocusedElement = document.activeElement;
975
- element.focus({ preventScroll: true });
976
- if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
977
- element.select();
978
- }
979
- }
980
- var focusScopesStack = createFocusScopesStack();
981
- function createFocusScopesStack() {
982
- let stack = [];
983
- return {
984
- add(focusScope) {
985
- const activeFocusScope = stack[0];
986
- if (focusScope !== activeFocusScope) {
987
- activeFocusScope?.pause();
988
- }
989
- stack = arrayRemove(stack, focusScope);
990
- stack.unshift(focusScope);
991
- },
992
- remove(focusScope) {
993
- stack = arrayRemove(stack, focusScope);
994
- stack[0]?.resume();
995
- }
996
- };
997
- }
998
- function arrayRemove(array, item) {
999
- const updatedArray = [...array];
1000
- const index = updatedArray.indexOf(item);
1001
- if (index !== -1) {
1002
- updatedArray.splice(index, 1);
1003
- }
1004
- return updatedArray;
1005
- }
1006
- function removeLinks(items) {
1007
- return items.filter((item) => item.tagName !== "A");
1008
- }
1009
- var PORTAL_NAME = "Portal";
1010
- var Portal = React25__namespace.forwardRef((props, forwardedRef) => {
1011
- const { container: containerProp, ...portalProps } = props;
1012
- const [mounted, setMounted] = React25__namespace.useState(false);
1013
- useLayoutEffect2(() => setMounted(true), []);
1014
- const container = containerProp || mounted && globalThis?.document?.body;
1015
- return container ? ReactDOM__namespace.default.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
1016
- });
1017
- Portal.displayName = PORTAL_NAME;
1018
- function useStateMachine(initialState, machine) {
1019
- return React25__namespace.useReducer((state, event) => {
1020
- const nextState = machine[state][event];
1021
- return nextState ?? state;
1022
- }, initialState);
1023
- }
1024
- var Presence = (props) => {
1025
- const { present, children } = props;
1026
- const presence = usePresence(present);
1027
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React25__namespace.Children.only(children);
1028
- const ref = useComposedRefs(presence.ref, getElementRef3(child));
1029
- const forceMount = typeof children === "function";
1030
- return forceMount || presence.isPresent ? React25__namespace.cloneElement(child, { ref }) : null;
1031
- };
1032
- Presence.displayName = "Presence";
1033
- function usePresence(present) {
1034
- const [node, setNode] = React25__namespace.useState();
1035
- const stylesRef = React25__namespace.useRef(null);
1036
- const prevPresentRef = React25__namespace.useRef(present);
1037
- const prevAnimationNameRef = React25__namespace.useRef("none");
1038
- const initialState = present ? "mounted" : "unmounted";
1039
- const [state, send] = useStateMachine(initialState, {
1040
- mounted: {
1041
- UNMOUNT: "unmounted",
1042
- ANIMATION_OUT: "unmountSuspended"
1043
- },
1044
- unmountSuspended: {
1045
- MOUNT: "mounted",
1046
- ANIMATION_END: "unmounted"
1047
- },
1048
- unmounted: {
1049
- MOUNT: "mounted"
1050
- }
1051
- });
1052
- React25__namespace.useEffect(() => {
1053
- const currentAnimationName = getAnimationName(stylesRef.current);
1054
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
1055
- }, [state]);
1056
- useLayoutEffect2(() => {
1057
- const styles = stylesRef.current;
1058
- const wasPresent = prevPresentRef.current;
1059
- const hasPresentChanged = wasPresent !== present;
1060
- if (hasPresentChanged) {
1061
- const prevAnimationName = prevAnimationNameRef.current;
1062
- const currentAnimationName = getAnimationName(styles);
1063
- if (present) {
1064
- send("MOUNT");
1065
- } else if (currentAnimationName === "none" || styles?.display === "none") {
1066
- send("UNMOUNT");
1067
- } else {
1068
- const isAnimating = prevAnimationName !== currentAnimationName;
1069
- if (wasPresent && isAnimating) {
1070
- send("ANIMATION_OUT");
1071
- } else {
1072
- send("UNMOUNT");
1073
- }
1074
- }
1075
- prevPresentRef.current = present;
1076
- }
1077
- }, [present, send]);
1078
- useLayoutEffect2(() => {
1079
- if (node) {
1080
- let timeoutId;
1081
- const ownerWindow = node.ownerDocument.defaultView ?? window;
1082
- const handleAnimationEnd = (event) => {
1083
- const currentAnimationName = getAnimationName(stylesRef.current);
1084
- const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
1085
- if (event.target === node && isCurrentAnimation) {
1086
- send("ANIMATION_END");
1087
- if (!prevPresentRef.current) {
1088
- const currentFillMode = node.style.animationFillMode;
1089
- node.style.animationFillMode = "forwards";
1090
- timeoutId = ownerWindow.setTimeout(() => {
1091
- if (node.style.animationFillMode === "forwards") {
1092
- node.style.animationFillMode = currentFillMode;
1093
- }
1094
- });
1095
- }
1096
- }
1097
- };
1098
- const handleAnimationStart = (event) => {
1099
- if (event.target === node) {
1100
- prevAnimationNameRef.current = getAnimationName(stylesRef.current);
1101
- }
1102
- };
1103
- node.addEventListener("animationstart", handleAnimationStart);
1104
- node.addEventListener("animationcancel", handleAnimationEnd);
1105
- node.addEventListener("animationend", handleAnimationEnd);
1106
- return () => {
1107
- ownerWindow.clearTimeout(timeoutId);
1108
- node.removeEventListener("animationstart", handleAnimationStart);
1109
- node.removeEventListener("animationcancel", handleAnimationEnd);
1110
- node.removeEventListener("animationend", handleAnimationEnd);
1111
- };
1112
- } else {
1113
- send("ANIMATION_END");
1114
- }
1115
- }, [node, send]);
1116
- return {
1117
- isPresent: ["mounted", "unmountSuspended"].includes(state),
1118
- ref: React25__namespace.useCallback((node2) => {
1119
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
1120
- setNode(node2);
1121
- }, [])
1122
- };
1123
- }
1124
- function getAnimationName(styles) {
1125
- return styles?.animationName || "none";
1126
- }
1127
- function getElementRef3(element) {
1128
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1129
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1130
- if (mayWarn) {
1131
- return element.ref;
1132
- }
1133
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1134
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1135
- if (mayWarn) {
1136
- return element.props.ref;
1137
- }
1138
- return element.props.ref || element.ref;
1139
- }
1140
- var count2 = 0;
1141
- function useFocusGuards() {
1142
- React25__namespace.useEffect(() => {
1143
- const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
1144
- document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
1145
- document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
1146
- count2++;
1147
- return () => {
1148
- if (count2 === 1) {
1149
- document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
1150
- }
1151
- count2--;
1152
- };
1153
- }, []);
1154
- }
1155
- function createFocusGuard() {
1156
- const element = document.createElement("span");
1157
- element.setAttribute("data-radix-focus-guard", "");
1158
- element.tabIndex = 0;
1159
- element.style.outline = "none";
1160
- element.style.opacity = "0";
1161
- element.style.position = "fixed";
1162
- element.style.pointerEvents = "none";
1163
- return element;
1164
- }
1165
-
1166
- // ../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
1167
- var __assign = function() {
1168
- __assign = Object.assign || function __assign2(t) {
1169
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1170
- s = arguments[i];
1171
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1172
- }
1173
- return t;
1174
- };
1175
- return __assign.apply(this, arguments);
1176
- };
1177
- function __rest(s, e) {
1178
- var t = {};
1179
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1180
- t[p] = s[p];
1181
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1182
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1183
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1184
- t[p[i]] = s[p[i]];
236
+ children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
1185
237
  }
1186
- return t;
1187
- }
1188
- function __spreadArray(to, from, pack) {
1189
- for (var i = 0, l = from.length, ar; i < l; i++) {
1190
- if (ar || !(i in from)) {
1191
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1192
- ar[i] = from[i];
1193
- }
1194
- }
1195
- return to.concat(ar || Array.prototype.slice.call(from));
1196
- }
1197
-
1198
- // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/constants.js
1199
- var zeroRightClassName = "right-scroll-bar-position";
1200
- var fullWidthClassName = "width-before-scroll-bar";
1201
- var noScrollbarsClassName = "with-scroll-bars-hidden";
1202
- var removedBarSizeVariable = "--removed-body-scroll-bar-size";
1203
-
1204
- // ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.2.8_react@19.2.3/node_modules/use-callback-ref/dist/es2015/assignRef.js
1205
- function assignRef(ref, value) {
1206
- if (typeof ref === "function") {
1207
- ref(value);
1208
- } else if (ref) {
1209
- ref.current = value;
1210
- }
1211
- return ref;
1212
- }
1213
- function useCallbackRef2(initialValue, callback) {
1214
- var ref = React25.useState(function() {
1215
- return {
1216
- // value
1217
- value: initialValue,
1218
- // last callback
1219
- callback,
1220
- // "memoized" public interface
1221
- facade: {
1222
- get current() {
1223
- return ref.value;
1224
- },
1225
- set current(value) {
1226
- var last = ref.value;
1227
- if (last !== value) {
1228
- ref.value = value;
1229
- ref.callback(value, last);
1230
- }
1231
- }
1232
- }
1233
- };
1234
- })[0];
1235
- ref.callback = callback;
1236
- return ref.facade;
1237
- }
1238
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25__namespace.useLayoutEffect : React25__namespace.useEffect;
1239
- var currentValues = /* @__PURE__ */ new WeakMap();
1240
- function useMergeRefs(refs, defaultValue) {
1241
- var callbackRef = useCallbackRef2(null, function(newValue) {
1242
- return refs.forEach(function(ref) {
1243
- return assignRef(ref, newValue);
1244
- });
1245
- });
1246
- useIsomorphicLayoutEffect(function() {
1247
- var oldValue = currentValues.get(callbackRef);
1248
- if (oldValue) {
1249
- var prevRefs_1 = new Set(oldValue);
1250
- var nextRefs_1 = new Set(refs);
1251
- var current_1 = callbackRef.current;
1252
- prevRefs_1.forEach(function(ref) {
1253
- if (!nextRefs_1.has(ref)) {
1254
- assignRef(ref, null);
1255
- }
1256
- });
1257
- nextRefs_1.forEach(function(ref) {
1258
- if (!prevRefs_1.has(ref)) {
1259
- assignRef(ref, current_1);
1260
- }
1261
- });
1262
- }
1263
- currentValues.set(callbackRef, refs);
1264
- }, [refs]);
1265
- return callbackRef;
1266
- }
1267
-
1268
- // ../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@19.2.8_react@19.2.3/node_modules/use-sidecar/dist/es2015/medium.js
1269
- function ItoI(a) {
1270
- return a;
1271
- }
1272
- function innerCreateMedium(defaults, middleware) {
1273
- if (middleware === void 0) {
1274
- middleware = ItoI;
1275
- }
1276
- var buffer = [];
1277
- var assigned = false;
1278
- var medium = {
1279
- read: function() {
1280
- if (assigned) {
1281
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
1282
- }
1283
- if (buffer.length) {
1284
- return buffer[buffer.length - 1];
1285
- }
1286
- return defaults;
1287
- },
1288
- useMedium: function(data) {
1289
- var item = middleware(data, assigned);
1290
- buffer.push(item);
1291
- return function() {
1292
- buffer = buffer.filter(function(x) {
1293
- return x !== item;
1294
- });
1295
- };
1296
- },
1297
- assignSyncMedium: function(cb) {
1298
- assigned = true;
1299
- while (buffer.length) {
1300
- var cbs = buffer;
1301
- buffer = [];
1302
- cbs.forEach(cb);
1303
- }
1304
- buffer = {
1305
- push: function(x) {
1306
- return cb(x);
1307
- },
1308
- filter: function() {
1309
- return buffer;
1310
- }
1311
- };
1312
- },
1313
- assignMedium: function(cb) {
1314
- assigned = true;
1315
- var pendingQueue = [];
1316
- if (buffer.length) {
1317
- var cbs = buffer;
1318
- buffer = [];
1319
- cbs.forEach(cb);
1320
- pendingQueue = buffer;
1321
- }
1322
- var executeQueue = function() {
1323
- var cbs2 = pendingQueue;
1324
- pendingQueue = [];
1325
- cbs2.forEach(cb);
1326
- };
1327
- var cycle = function() {
1328
- return Promise.resolve().then(executeQueue);
1329
- };
1330
- cycle();
1331
- buffer = {
1332
- push: function(x) {
1333
- pendingQueue.push(x);
1334
- cycle();
1335
- },
1336
- filter: function(filter) {
1337
- pendingQueue = pendingQueue.filter(filter);
1338
- return buffer;
1339
- }
1340
- };
1341
- }
1342
- };
1343
- return medium;
1344
- }
1345
- function createSidecarMedium(options) {
1346
- if (options === void 0) {
1347
- options = {};
1348
- }
1349
- var medium = innerCreateMedium(null);
1350
- medium.options = __assign({ async: true, ssr: false }, options);
1351
- return medium;
1352
- }
1353
- var SideCar = function(_a) {
1354
- var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
1355
- if (!sideCar) {
1356
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1357
- }
1358
- var Target = sideCar.read();
1359
- if (!Target) {
1360
- throw new Error("Sidecar medium not found");
1361
- }
1362
- return React25__namespace.createElement(Target, __assign({}, rest));
1363
- };
1364
- SideCar.isSideCarExport = true;
1365
- function exportSidecar(medium, exported) {
1366
- medium.useMedium(exported);
1367
- return SideCar;
1368
- }
1369
-
1370
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/medium.js
1371
- var effectCar = createSidecarMedium();
1372
-
1373
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/UI.js
1374
- var nothing = function() {
1375
- return;
1376
- };
1377
- var RemoveScroll = React25__namespace.forwardRef(function(props, parentRef) {
1378
- var ref = React25__namespace.useRef(null);
1379
- var _a = React25__namespace.useState({
1380
- onScrollCapture: nothing,
1381
- onWheelCapture: nothing,
1382
- onTouchMoveCapture: nothing
1383
- }), callbacks = _a[0], setCallbacks = _a[1];
1384
- var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1385
- var SideCar2 = sideCar;
1386
- var containerRef = useMergeRefs([ref, parentRef]);
1387
- var containerProps = __assign(__assign({}, rest), callbacks);
1388
- return React25__namespace.createElement(
1389
- React25__namespace.Fragment,
1390
- null,
1391
- enabled && React25__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
1392
- forwardProps ? React25__namespace.cloneElement(React25__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React25__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
1393
238
  );
1394
- });
1395
- RemoveScroll.defaultProps = {
1396
- enabled: true,
1397
- removeScrollBar: true,
1398
- inert: false
1399
- };
1400
- RemoveScroll.classNames = {
1401
- fullWidth: fullWidthClassName,
1402
- zeroRight: zeroRightClassName
1403
- };
1404
- var getNonce = function() {
1405
- if (typeof __webpack_nonce__ !== "undefined") {
1406
- return __webpack_nonce__;
1407
- }
1408
- return void 0;
1409
- };
1410
-
1411
- // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/singleton.js
1412
- function makeStyleTag() {
1413
- if (!document)
1414
- return null;
1415
- var tag = document.createElement("style");
1416
- tag.type = "text/css";
1417
- var nonce = getNonce();
1418
- if (nonce) {
1419
- tag.setAttribute("nonce", nonce);
1420
- }
1421
- return tag;
1422
- }
1423
- function injectStyles(tag, css) {
1424
- if (tag.styleSheet) {
1425
- tag.styleSheet.cssText = css;
1426
- } else {
1427
- tag.appendChild(document.createTextNode(css));
1428
- }
1429
- }
1430
- function insertStyleTag(tag) {
1431
- var head = document.head || document.getElementsByTagName("head")[0];
1432
- head.appendChild(tag);
1433
239
  }
1434
- var stylesheetSingleton = function() {
1435
- var counter = 0;
1436
- var stylesheet = null;
1437
- return {
1438
- add: function(style) {
1439
- if (counter == 0) {
1440
- if (stylesheet = makeStyleTag()) {
1441
- injectStyles(stylesheet, style);
1442
- insertStyleTag(stylesheet);
1443
- }
1444
- }
1445
- counter++;
1446
- },
1447
- remove: function() {
1448
- counter--;
1449
- if (!counter && stylesheet) {
1450
- stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
1451
- stylesheet = null;
1452
- }
1453
- }
1454
- };
1455
- };
1456
-
1457
- // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/hook.js
1458
- var styleHookSingleton = function() {
1459
- var sheet = stylesheetSingleton();
1460
- return function(styles, isDynamic) {
1461
- React25__namespace.useEffect(function() {
1462
- sheet.add(styles);
1463
- return function() {
1464
- sheet.remove();
1465
- };
1466
- }, [styles && isDynamic]);
1467
- };
1468
- };
1469
-
1470
- // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/component.js
1471
- var styleSingleton = function() {
1472
- var useStyle = styleHookSingleton();
1473
- var Sheet = function(_a) {
1474
- var styles = _a.styles, dynamic = _a.dynamic;
1475
- useStyle(styles, dynamic);
1476
- return null;
1477
- };
1478
- return Sheet;
1479
- };
1480
-
1481
- // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/utils.js
1482
- var zeroGap = {
1483
- left: 0,
1484
- top: 0,
1485
- right: 0,
1486
- gap: 0
1487
- };
1488
- var parse = function(x) {
1489
- return parseInt(x || "", 10) || 0;
1490
- };
1491
- var getOffset = function(gapMode) {
1492
- var cs = window.getComputedStyle(document.body);
1493
- var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
1494
- var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
1495
- var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
1496
- return [parse(left), parse(top), parse(right)];
1497
- };
1498
- var getGapWidth = function(gapMode) {
1499
- if (gapMode === void 0) {
1500
- gapMode = "margin";
1501
- }
1502
- if (typeof window === "undefined") {
1503
- return zeroGap;
1504
- }
1505
- var offsets = getOffset(gapMode);
1506
- var documentWidth = document.documentElement.clientWidth;
1507
- var windowWidth = window.innerWidth;
1508
- return {
1509
- left: offsets[0],
1510
- top: offsets[1],
1511
- right: offsets[2],
1512
- gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
1513
- };
1514
- };
1515
-
1516
- // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/component.js
1517
- var Style = styleSingleton();
1518
- var lockAttribute = "data-scroll-locked";
1519
- var getStyles = function(_a, allowRelative, gapMode, important) {
1520
- var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
1521
- if (gapMode === void 0) {
1522
- gapMode = "margin";
1523
- }
1524
- return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
1525
- allowRelative && "position: relative ".concat(important, ";"),
1526
- gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
1527
- gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
1528
- ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
1529
- };
1530
- var getCurrentUseCounter = function() {
1531
- var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
1532
- return isFinite(counter) ? counter : 0;
1533
- };
1534
- var useLockAttribute = function() {
1535
- React25__namespace.useEffect(function() {
1536
- document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
1537
- return function() {
1538
- var newCounter = getCurrentUseCounter() - 1;
1539
- if (newCounter <= 0) {
1540
- document.body.removeAttribute(lockAttribute);
1541
- } else {
1542
- document.body.setAttribute(lockAttribute, newCounter.toString());
1543
- }
1544
- };
1545
- }, []);
1546
- };
1547
- var RemoveScrollBar = function(_a) {
1548
- var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1549
- useLockAttribute();
1550
- var gap = React25__namespace.useMemo(function() {
1551
- return getGapWidth(gapMode);
1552
- }, [gapMode]);
1553
- return React25__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
1554
- };
1555
-
1556
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
1557
- var passiveSupported = false;
1558
- if (typeof window !== "undefined") {
1559
- try {
1560
- options = Object.defineProperty({}, "passive", {
1561
- get: function() {
1562
- passiveSupported = true;
1563
- return true;
1564
- }
1565
- });
1566
- window.addEventListener("test", options, options);
1567
- window.removeEventListener("test", options, options);
1568
- } catch (err) {
1569
- passiveSupported = false;
1570
- }
1571
- }
1572
- var options;
1573
- var nonPassive = passiveSupported ? { passive: false } : false;
1574
-
1575
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
1576
- var alwaysContainsScroll = function(node) {
1577
- return node.tagName === "TEXTAREA";
1578
- };
1579
- var elementCanBeScrolled = function(node, overflow) {
1580
- if (!(node instanceof Element)) {
1581
- return false;
1582
- }
1583
- var styles = window.getComputedStyle(node);
1584
- return (
1585
- // not-not-scrollable
1586
- styles[overflow] !== "hidden" && // contains scroll inside self
1587
- !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
1588
- );
1589
- };
1590
- var elementCouldBeVScrolled = function(node) {
1591
- return elementCanBeScrolled(node, "overflowY");
1592
- };
1593
- var elementCouldBeHScrolled = function(node) {
1594
- return elementCanBeScrolled(node, "overflowX");
1595
- };
1596
- var locationCouldBeScrolled = function(axis, node) {
1597
- var ownerDocument = node.ownerDocument;
1598
- var current = node;
1599
- do {
1600
- if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
1601
- current = current.host;
1602
- }
1603
- var isScrollable = elementCouldBeScrolled(axis, current);
1604
- if (isScrollable) {
1605
- var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
1606
- if (scrollHeight > clientHeight) {
1607
- return true;
1608
- }
1609
- }
1610
- current = current.parentNode;
1611
- } while (current && current !== ownerDocument.body);
1612
- return false;
1613
- };
1614
- var getVScrollVariables = function(_a) {
1615
- var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
1616
- return [
1617
- scrollTop,
1618
- scrollHeight,
1619
- clientHeight
1620
- ];
1621
- };
1622
- var getHScrollVariables = function(_a) {
1623
- var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
1624
- return [
1625
- scrollLeft,
1626
- scrollWidth,
1627
- clientWidth
1628
- ];
1629
- };
1630
- var elementCouldBeScrolled = function(axis, node) {
1631
- return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
1632
- };
1633
- var getScrollVariables = function(axis, node) {
1634
- return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
1635
- };
1636
- var getDirectionFactor = function(axis, direction) {
1637
- return axis === "h" && direction === "rtl" ? -1 : 1;
1638
- };
1639
- var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1640
- var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
1641
- var delta = directionFactor * sourceDelta;
1642
- var target = event.target;
1643
- var targetInLock = endTarget.contains(target);
1644
- var shouldCancelScroll = false;
1645
- var isDeltaPositive = delta > 0;
1646
- var availableScroll = 0;
1647
- var availableScrollTop = 0;
1648
- do {
1649
- if (!target) {
1650
- break;
1651
- }
1652
- var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
1653
- var elementScroll = scroll_1 - capacity - directionFactor * position;
1654
- if (position || elementScroll) {
1655
- if (elementCouldBeScrolled(axis, target)) {
1656
- availableScroll += elementScroll;
1657
- availableScrollTop += position;
1658
- }
1659
- }
1660
- var parent_1 = target.parentNode;
1661
- target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
1662
- } while (
1663
- // portaled content
1664
- !targetInLock && target !== document.body || // self content
1665
- targetInLock && (endTarget.contains(target) || endTarget === target)
1666
- );
1667
- if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
1668
- shouldCancelScroll = true;
1669
- } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
1670
- shouldCancelScroll = true;
1671
- }
1672
- return shouldCancelScroll;
1673
- };
1674
-
1675
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
1676
- var getTouchXY = function(event) {
1677
- return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
1678
- };
1679
- var getDeltaXY = function(event) {
1680
- return [event.deltaX, event.deltaY];
1681
- };
1682
- var extractRef = function(ref) {
1683
- return ref && "current" in ref ? ref.current : ref;
1684
- };
1685
- var deltaCompare = function(x, y) {
1686
- return x[0] === y[0] && x[1] === y[1];
1687
- };
1688
- var generateStyle = function(id) {
1689
- return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
1690
- };
1691
- var idCounter = 0;
1692
- var lockStack = [];
1693
- function RemoveScrollSideCar(props) {
1694
- var shouldPreventQueue = React25__namespace.useRef([]);
1695
- var touchStartRef = React25__namespace.useRef([0, 0]);
1696
- var activeAxis = React25__namespace.useRef();
1697
- var id = React25__namespace.useState(idCounter++)[0];
1698
- var Style2 = React25__namespace.useState(styleSingleton)[0];
1699
- var lastProps = React25__namespace.useRef(props);
1700
- React25__namespace.useEffect(function() {
1701
- lastProps.current = props;
1702
- }, [props]);
1703
- React25__namespace.useEffect(function() {
1704
- if (props.inert) {
1705
- document.body.classList.add("block-interactivity-".concat(id));
1706
- var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef)).filter(Boolean);
1707
- allow_1.forEach(function(el) {
1708
- return el.classList.add("allow-interactivity-".concat(id));
1709
- });
1710
- return function() {
1711
- document.body.classList.remove("block-interactivity-".concat(id));
1712
- allow_1.forEach(function(el) {
1713
- return el.classList.remove("allow-interactivity-".concat(id));
1714
- });
1715
- };
1716
- }
1717
- return;
1718
- }, [props.inert, props.lockRef.current, props.shards]);
1719
- var shouldCancelEvent = React25__namespace.useCallback(function(event, parent) {
1720
- if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
1721
- return !lastProps.current.allowPinchZoom;
1722
- }
1723
- var touch = getTouchXY(event);
1724
- var touchStart = touchStartRef.current;
1725
- var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
1726
- var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
1727
- var currentAxis;
1728
- var target = event.target;
1729
- var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
1730
- if ("touches" in event && moveDirection === "h" && target.type === "range") {
1731
- return false;
1732
- }
1733
- var selection = window.getSelection();
1734
- var anchorNode = selection && selection.anchorNode;
1735
- var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
1736
- if (isTouchingSelection) {
1737
- return false;
1738
- }
1739
- var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1740
- if (!canBeScrolledInMainDirection) {
1741
- return true;
1742
- }
1743
- if (canBeScrolledInMainDirection) {
1744
- currentAxis = moveDirection;
1745
- } else {
1746
- currentAxis = moveDirection === "v" ? "h" : "v";
1747
- canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1748
- }
1749
- if (!canBeScrolledInMainDirection) {
1750
- return false;
1751
- }
1752
- if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
1753
- activeAxis.current = currentAxis;
1754
- }
1755
- if (!currentAxis) {
1756
- return true;
1757
- }
1758
- var cancelingAxis = activeAxis.current || currentAxis;
1759
- return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
1760
- }, []);
1761
- var shouldPrevent = React25__namespace.useCallback(function(_event) {
1762
- var event = _event;
1763
- if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
1764
- return;
1765
- }
1766
- var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
1767
- var sourceEvent = shouldPreventQueue.current.filter(function(e) {
1768
- return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
1769
- })[0];
1770
- if (sourceEvent && sourceEvent.should) {
1771
- if (event.cancelable) {
1772
- event.preventDefault();
1773
- }
1774
- return;
1775
- }
1776
- if (!sourceEvent) {
1777
- var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
1778
- return node.contains(event.target);
1779
- });
1780
- var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
1781
- if (shouldStop) {
1782
- if (event.cancelable) {
1783
- event.preventDefault();
1784
- }
1785
- }
1786
- }
1787
- }, []);
1788
- var shouldCancel = React25__namespace.useCallback(function(name, delta, target, should) {
1789
- var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
1790
- shouldPreventQueue.current.push(event);
1791
- setTimeout(function() {
1792
- shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
1793
- return e !== event;
1794
- });
1795
- }, 1);
1796
- }, []);
1797
- var scrollTouchStart = React25__namespace.useCallback(function(event) {
1798
- touchStartRef.current = getTouchXY(event);
1799
- activeAxis.current = void 0;
1800
- }, []);
1801
- var scrollWheel = React25__namespace.useCallback(function(event) {
1802
- shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1803
- }, []);
1804
- var scrollTouchMove = React25__namespace.useCallback(function(event) {
1805
- shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1806
- }, []);
1807
- React25__namespace.useEffect(function() {
1808
- lockStack.push(Style2);
1809
- props.setCallbacks({
1810
- onScrollCapture: scrollWheel,
1811
- onWheelCapture: scrollWheel,
1812
- onTouchMoveCapture: scrollTouchMove
1813
- });
1814
- document.addEventListener("wheel", shouldPrevent, nonPassive);
1815
- document.addEventListener("touchmove", shouldPrevent, nonPassive);
1816
- document.addEventListener("touchstart", scrollTouchStart, nonPassive);
1817
- return function() {
1818
- lockStack = lockStack.filter(function(inst) {
1819
- return inst !== Style2;
1820
- });
1821
- document.removeEventListener("wheel", shouldPrevent, nonPassive);
1822
- document.removeEventListener("touchmove", shouldPrevent, nonPassive);
1823
- document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
1824
- };
1825
- }, []);
1826
- var removeScrollBar = props.removeScrollBar, inert = props.inert;
1827
- return React25__namespace.createElement(
1828
- React25__namespace.Fragment,
1829
- null,
1830
- inert ? React25__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
1831
- removeScrollBar ? React25__namespace.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
1832
- );
1833
- }
1834
- function getOutermostShadowParent(node) {
1835
- var shadowParent = null;
1836
- while (node !== null) {
1837
- if (node instanceof ShadowRoot) {
1838
- shadowParent = node.host;
1839
- node = node.host;
1840
- }
1841
- node = node.parentNode;
1842
- }
1843
- return shadowParent;
1844
- }
1845
-
1846
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/sidecar.js
1847
- var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
1848
-
1849
- // ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/Combination.js
1850
- var ReactRemoveScroll = React25__namespace.forwardRef(function(props, ref) {
1851
- return React25__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
1852
- });
1853
- ReactRemoveScroll.classNames = RemoveScroll.classNames;
1854
- var Combination_default = ReactRemoveScroll;
1855
-
1856
- // ../node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js
1857
- var getDefaultParent = function(originalTarget) {
1858
- if (typeof document === "undefined") {
1859
- return null;
1860
- }
1861
- var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
1862
- return sampleTarget.ownerDocument.body;
1863
- };
1864
- var counterMap = /* @__PURE__ */ new WeakMap();
1865
- var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1866
- var markerMap = {};
1867
- var lockCount = 0;
1868
- var unwrapHost = function(node) {
1869
- return node && (node.host || unwrapHost(node.parentNode));
1870
- };
1871
- var correctTargets = function(parent, targets) {
1872
- return targets.map(function(target) {
1873
- if (parent.contains(target)) {
1874
- return target;
1875
- }
1876
- var correctedTarget = unwrapHost(target);
1877
- if (correctedTarget && parent.contains(correctedTarget)) {
1878
- return correctedTarget;
1879
- }
1880
- console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1881
- return null;
1882
- }).filter(function(x) {
1883
- return Boolean(x);
1884
- });
1885
- };
1886
- var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1887
- var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1888
- if (!markerMap[markerName]) {
1889
- markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1890
- }
1891
- var markerCounter = markerMap[markerName];
1892
- var hiddenNodes = [];
1893
- var elementsToKeep = /* @__PURE__ */ new Set();
1894
- var elementsToStop = new Set(targets);
1895
- var keep = function(el) {
1896
- if (!el || elementsToKeep.has(el)) {
1897
- return;
1898
- }
1899
- elementsToKeep.add(el);
1900
- keep(el.parentNode);
1901
- };
1902
- targets.forEach(keep);
1903
- var deep = function(parent) {
1904
- if (!parent || elementsToStop.has(parent)) {
1905
- return;
1906
- }
1907
- Array.prototype.forEach.call(parent.children, function(node) {
1908
- if (elementsToKeep.has(node)) {
1909
- deep(node);
1910
- } else {
1911
- try {
1912
- var attr = node.getAttribute(controlAttribute);
1913
- var alreadyHidden = attr !== null && attr !== "false";
1914
- var counterValue = (counterMap.get(node) || 0) + 1;
1915
- var markerValue = (markerCounter.get(node) || 0) + 1;
1916
- counterMap.set(node, counterValue);
1917
- markerCounter.set(node, markerValue);
1918
- hiddenNodes.push(node);
1919
- if (counterValue === 1 && alreadyHidden) {
1920
- uncontrolledNodes.set(node, true);
1921
- }
1922
- if (markerValue === 1) {
1923
- node.setAttribute(markerName, "true");
1924
- }
1925
- if (!alreadyHidden) {
1926
- node.setAttribute(controlAttribute, "true");
1927
- }
1928
- } catch (e) {
1929
- console.error("aria-hidden: cannot operate on ", node, e);
1930
- }
1931
- }
1932
- });
1933
- };
1934
- deep(parentNode);
1935
- elementsToKeep.clear();
1936
- lockCount++;
1937
- return function() {
1938
- hiddenNodes.forEach(function(node) {
1939
- var counterValue = counterMap.get(node) - 1;
1940
- var markerValue = markerCounter.get(node) - 1;
1941
- counterMap.set(node, counterValue);
1942
- markerCounter.set(node, markerValue);
1943
- if (!counterValue) {
1944
- if (!uncontrolledNodes.has(node)) {
1945
- node.removeAttribute(controlAttribute);
1946
- }
1947
- uncontrolledNodes.delete(node);
1948
- }
1949
- if (!markerValue) {
1950
- node.removeAttribute(markerName);
1951
- }
1952
- });
1953
- lockCount--;
1954
- if (!lockCount) {
1955
- counterMap = /* @__PURE__ */ new WeakMap();
1956
- counterMap = /* @__PURE__ */ new WeakMap();
1957
- uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1958
- markerMap = {};
1959
- }
1960
- };
1961
- };
1962
- var hideOthers = function(originalTarget, parentNode, markerName) {
1963
- if (markerName === void 0) {
1964
- markerName = "data-aria-hidden";
1965
- }
1966
- var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1967
- var activeParentNode = getDefaultParent(originalTarget);
1968
- if (!activeParentNode) {
1969
- return function() {
1970
- return null;
1971
- };
1972
- }
1973
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
1974
- return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1975
- };
1976
- var DIALOG_NAME = "Dialog";
1977
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
1978
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
1979
- var Dialog = (props) => {
1980
- const {
1981
- __scopeDialog,
1982
- children,
1983
- open: openProp,
1984
- defaultOpen,
1985
- onOpenChange,
1986
- modal = true
1987
- } = props;
1988
- const triggerRef = React25__namespace.useRef(null);
1989
- const contentRef = React25__namespace.useRef(null);
1990
- const [open, setOpen] = useControllableState({
1991
- prop: openProp,
1992
- defaultProp: defaultOpen ?? false,
1993
- onChange: onOpenChange,
1994
- caller: DIALOG_NAME
1995
- });
1996
- return /* @__PURE__ */ jsxRuntime.jsx(
1997
- DialogProvider,
1998
- {
1999
- scope: __scopeDialog,
2000
- triggerRef,
2001
- contentRef,
2002
- contentId: useId(),
2003
- titleId: useId(),
2004
- descriptionId: useId(),
2005
- open,
2006
- onOpenChange: setOpen,
2007
- onOpenToggle: React25__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
2008
- modal,
2009
- children
2010
- }
2011
- );
2012
- };
2013
- Dialog.displayName = DIALOG_NAME;
2014
- var TRIGGER_NAME = "DialogTrigger";
2015
- var DialogTrigger = React25__namespace.forwardRef(
2016
- (props, forwardedRef) => {
2017
- const { __scopeDialog, ...triggerProps } = props;
2018
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
2019
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
2020
- return /* @__PURE__ */ jsxRuntime.jsx(
2021
- Primitive.button,
2022
- {
2023
- type: "button",
2024
- "aria-haspopup": "dialog",
2025
- "aria-expanded": context.open,
2026
- "aria-controls": context.contentId,
2027
- "data-state": getState(context.open),
2028
- ...triggerProps,
2029
- ref: composedTriggerRef,
2030
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
2031
- }
2032
- );
2033
- }
2034
- );
2035
- DialogTrigger.displayName = TRIGGER_NAME;
2036
- var PORTAL_NAME2 = "DialogPortal";
2037
- var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
2038
- forceMount: void 0
2039
- });
2040
- var DialogPortal = (props) => {
2041
- const { __scopeDialog, forceMount, children, container } = props;
2042
- const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
2043
- return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React25__namespace.Children.map(children, (child) => /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal, { asChild: true, container, children: child }) })) });
2044
- };
2045
- DialogPortal.displayName = PORTAL_NAME2;
2046
- var OVERLAY_NAME = "DialogOverlay";
2047
- var DialogOverlay = React25__namespace.forwardRef(
2048
- (props, forwardedRef) => {
2049
- const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
2050
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
2051
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
2052
- return context.modal ? /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
2053
- }
2054
- );
2055
- DialogOverlay.displayName = OVERLAY_NAME;
2056
- var Slot2 = createSlot2("DialogOverlay.RemoveScroll");
2057
- var DialogOverlayImpl = React25__namespace.forwardRef(
2058
- (props, forwardedRef) => {
2059
- const { __scopeDialog, ...overlayProps } = props;
2060
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
2061
- return (
2062
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2063
- // ie. when `Overlay` and `Content` are siblings
2064
- /* @__PURE__ */ jsxRuntime.jsx(Combination_default, { as: Slot2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntime.jsx(
2065
- Primitive.div,
2066
- {
2067
- "data-state": getState(context.open),
2068
- ...overlayProps,
2069
- ref: forwardedRef,
2070
- style: { pointerEvents: "auto", ...overlayProps.style }
2071
- }
2072
- ) })
2073
- );
2074
- }
2075
- );
2076
- var CONTENT_NAME = "DialogContent";
2077
- var DialogContent = React25__namespace.forwardRef(
2078
- (props, forwardedRef) => {
2079
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
2080
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
2081
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2082
- return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntime.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
2083
- }
2084
- );
2085
- DialogContent.displayName = CONTENT_NAME;
2086
- var DialogContentModal = React25__namespace.forwardRef(
2087
- (props, forwardedRef) => {
2088
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2089
- const contentRef = React25__namespace.useRef(null);
2090
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
2091
- React25__namespace.useEffect(() => {
2092
- const content = contentRef.current;
2093
- if (content) return hideOthers(content);
2094
- }, []);
2095
- return /* @__PURE__ */ jsxRuntime.jsx(
2096
- DialogContentImpl,
2097
- {
2098
- ...props,
2099
- ref: composedRefs,
2100
- trapFocus: context.open,
2101
- disableOutsidePointerEvents: true,
2102
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
2103
- event.preventDefault();
2104
- context.triggerRef.current?.focus();
2105
- }),
2106
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
2107
- const originalEvent = event.detail.originalEvent;
2108
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2109
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2110
- if (isRightClick) event.preventDefault();
2111
- }),
2112
- onFocusOutside: composeEventHandlers(
2113
- props.onFocusOutside,
2114
- (event) => event.preventDefault()
2115
- )
2116
- }
2117
- );
2118
- }
2119
- );
2120
- var DialogContentNonModal = React25__namespace.forwardRef(
2121
- (props, forwardedRef) => {
2122
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2123
- const hasInteractedOutsideRef = React25__namespace.useRef(false);
2124
- const hasPointerDownOutsideRef = React25__namespace.useRef(false);
2125
- return /* @__PURE__ */ jsxRuntime.jsx(
2126
- DialogContentImpl,
2127
- {
2128
- ...props,
2129
- ref: forwardedRef,
2130
- trapFocus: false,
2131
- disableOutsidePointerEvents: false,
2132
- onCloseAutoFocus: (event) => {
2133
- props.onCloseAutoFocus?.(event);
2134
- if (!event.defaultPrevented) {
2135
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
2136
- event.preventDefault();
2137
- }
2138
- hasInteractedOutsideRef.current = false;
2139
- hasPointerDownOutsideRef.current = false;
2140
- },
2141
- onInteractOutside: (event) => {
2142
- props.onInteractOutside?.(event);
2143
- if (!event.defaultPrevented) {
2144
- hasInteractedOutsideRef.current = true;
2145
- if (event.detail.originalEvent.type === "pointerdown") {
2146
- hasPointerDownOutsideRef.current = true;
2147
- }
2148
- }
2149
- const target = event.target;
2150
- const targetIsTrigger = context.triggerRef.current?.contains(target);
2151
- if (targetIsTrigger) event.preventDefault();
2152
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2153
- event.preventDefault();
2154
- }
2155
- }
2156
- }
2157
- );
2158
- }
2159
- );
2160
- var DialogContentImpl = React25__namespace.forwardRef(
2161
- (props, forwardedRef) => {
2162
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
2163
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
2164
- const contentRef = React25__namespace.useRef(null);
2165
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
2166
- useFocusGuards();
2167
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2168
- /* @__PURE__ */ jsxRuntime.jsx(
2169
- FocusScope,
2170
- {
2171
- asChild: true,
2172
- loop: true,
2173
- trapped: trapFocus,
2174
- onMountAutoFocus: onOpenAutoFocus,
2175
- onUnmountAutoFocus: onCloseAutoFocus,
2176
- children: /* @__PURE__ */ jsxRuntime.jsx(
2177
- DismissableLayer,
2178
- {
2179
- role: "dialog",
2180
- id: context.contentId,
2181
- "aria-describedby": context.descriptionId,
2182
- "aria-labelledby": context.titleId,
2183
- "data-state": getState(context.open),
2184
- ...contentProps,
2185
- ref: composedRefs,
2186
- onDismiss: () => context.onOpenChange(false)
2187
- }
2188
- )
2189
- }
2190
- ),
2191
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2192
- /* @__PURE__ */ jsxRuntime.jsx(TitleWarning, { titleId: context.titleId }),
2193
- /* @__PURE__ */ jsxRuntime.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
2194
- ] })
2195
- ] });
2196
- }
2197
- );
2198
- var TITLE_NAME = "DialogTitle";
2199
- var DialogTitle = React25__namespace.forwardRef(
2200
- (props, forwardedRef) => {
2201
- const { __scopeDialog, ...titleProps } = props;
2202
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
2203
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2204
- }
2205
- );
2206
- DialogTitle.displayName = TITLE_NAME;
2207
- var DESCRIPTION_NAME = "DialogDescription";
2208
- var DialogDescription = React25__namespace.forwardRef(
2209
- (props, forwardedRef) => {
2210
- const { __scopeDialog, ...descriptionProps } = props;
2211
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2212
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2213
- }
2214
- );
2215
- DialogDescription.displayName = DESCRIPTION_NAME;
2216
- var CLOSE_NAME = "DialogClose";
2217
- var DialogClose = React25__namespace.forwardRef(
2218
- (props, forwardedRef) => {
2219
- const { __scopeDialog, ...closeProps } = props;
2220
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
2221
- return /* @__PURE__ */ jsxRuntime.jsx(
2222
- Primitive.button,
2223
- {
2224
- type: "button",
2225
- ...closeProps,
2226
- ref: forwardedRef,
2227
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
2228
- }
2229
- );
2230
- }
2231
- );
2232
- DialogClose.displayName = CLOSE_NAME;
2233
- function getState(open) {
2234
- return open ? "open" : "closed";
2235
- }
2236
- var TITLE_WARNING_NAME = "DialogTitleWarning";
2237
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
2238
- contentName: CONTENT_NAME,
2239
- titleName: TITLE_NAME,
2240
- docsSlug: "dialog"
2241
- });
2242
- var TitleWarning = ({ titleId }) => {
2243
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
2244
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
2245
-
2246
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
2247
-
2248
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
2249
- React25__namespace.useEffect(() => {
2250
- if (titleId) {
2251
- const hasTitle = document.getElementById(titleId);
2252
- if (!hasTitle) console.error(MESSAGE);
2253
- }
2254
- }, [MESSAGE, titleId]);
2255
- return null;
2256
- };
2257
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
2258
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
2259
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
2260
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
2261
- React25__namespace.useEffect(() => {
2262
- const describedById = contentRef.current?.getAttribute("aria-describedby");
2263
- if (descriptionId && describedById) {
2264
- const hasDescription = document.getElementById(descriptionId);
2265
- if (!hasDescription) console.warn(MESSAGE);
2266
- }
2267
- }, [MESSAGE, contentRef, descriptionId]);
2268
- return null;
2269
- };
2270
- var Root2 = Dialog;
2271
- var Trigger2 = DialogTrigger;
2272
- var Portal2 = DialogPortal;
2273
- var Overlay = DialogOverlay;
2274
- var Content2 = DialogContent;
2275
- var Title = DialogTitle;
2276
- var Description = DialogDescription;
2277
- var Close = DialogClose;
2278
- var ROOT_NAME = "AlertDialog";
2279
- var [createAlertDialogContext] = createContextScope(ROOT_NAME, [
2280
- createDialogScope
2281
- ]);
2282
- var useDialogScope = createDialogScope();
2283
- var AlertDialog = (props) => {
2284
- const { __scopeAlertDialog, ...alertDialogProps } = props;
2285
- const dialogScope = useDialogScope(__scopeAlertDialog);
2286
- return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...dialogScope, ...alertDialogProps, modal: true });
2287
- };
2288
- AlertDialog.displayName = ROOT_NAME;
2289
- var TRIGGER_NAME2 = "AlertDialogTrigger";
2290
- var AlertDialogTrigger = React25__namespace.forwardRef(
2291
- (props, forwardedRef) => {
2292
- const { __scopeAlertDialog, ...triggerProps } = props;
2293
- const dialogScope = useDialogScope(__scopeAlertDialog);
2294
- return /* @__PURE__ */ jsxRuntime.jsx(Trigger2, { ...dialogScope, ...triggerProps, ref: forwardedRef });
2295
- }
2296
- );
2297
- AlertDialogTrigger.displayName = TRIGGER_NAME2;
2298
- var PORTAL_NAME3 = "AlertDialogPortal";
2299
- var AlertDialogPortal = (props) => {
2300
- const { __scopeAlertDialog, ...portalProps } = props;
2301
- const dialogScope = useDialogScope(__scopeAlertDialog);
2302
- return /* @__PURE__ */ jsxRuntime.jsx(Portal2, { ...dialogScope, ...portalProps });
2303
- };
2304
- AlertDialogPortal.displayName = PORTAL_NAME3;
2305
- var OVERLAY_NAME2 = "AlertDialogOverlay";
2306
- var AlertDialogOverlay = React25__namespace.forwardRef(
2307
- (props, forwardedRef) => {
2308
- const { __scopeAlertDialog, ...overlayProps } = props;
2309
- const dialogScope = useDialogScope(__scopeAlertDialog);
2310
- return /* @__PURE__ */ jsxRuntime.jsx(Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
2311
- }
2312
- );
2313
- AlertDialogOverlay.displayName = OVERLAY_NAME2;
2314
- var CONTENT_NAME2 = "AlertDialogContent";
2315
- var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME2);
2316
- var Slottable = createSlottable("AlertDialogContent");
2317
- var AlertDialogContent = React25__namespace.forwardRef(
2318
- (props, forwardedRef) => {
2319
- const { __scopeAlertDialog, children, ...contentProps } = props;
2320
- const dialogScope = useDialogScope(__scopeAlertDialog);
2321
- const contentRef = React25__namespace.useRef(null);
2322
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
2323
- const cancelRef = React25__namespace.useRef(null);
2324
- return /* @__PURE__ */ jsxRuntime.jsx(
2325
- WarningProvider,
2326
- {
2327
- contentName: CONTENT_NAME2,
2328
- titleName: TITLE_NAME2,
2329
- docsSlug: "alert-dialog",
2330
- children: /* @__PURE__ */ jsxRuntime.jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxRuntime.jsxs(
2331
- Content2,
2332
- {
2333
- role: "alertdialog",
2334
- ...dialogScope,
2335
- ...contentProps,
2336
- ref: composedRefs,
2337
- onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
2338
- event.preventDefault();
2339
- cancelRef.current?.focus({ preventScroll: true });
2340
- }),
2341
- onPointerDownOutside: (event) => event.preventDefault(),
2342
- onInteractOutside: (event) => event.preventDefault(),
2343
- children: [
2344
- /* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
2345
- /* @__PURE__ */ jsxRuntime.jsx(DescriptionWarning2, { contentRef })
2346
- ]
2347
- }
2348
- ) })
2349
- }
2350
- );
2351
- }
2352
- );
2353
- AlertDialogContent.displayName = CONTENT_NAME2;
2354
- var TITLE_NAME2 = "AlertDialogTitle";
2355
- var AlertDialogTitle = React25__namespace.forwardRef(
2356
- (props, forwardedRef) => {
2357
- const { __scopeAlertDialog, ...titleProps } = props;
2358
- const dialogScope = useDialogScope(__scopeAlertDialog);
2359
- return /* @__PURE__ */ jsxRuntime.jsx(Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
2360
- }
2361
- );
2362
- AlertDialogTitle.displayName = TITLE_NAME2;
2363
- var DESCRIPTION_NAME2 = "AlertDialogDescription";
2364
- var AlertDialogDescription = React25__namespace.forwardRef((props, forwardedRef) => {
2365
- const { __scopeAlertDialog, ...descriptionProps } = props;
2366
- const dialogScope = useDialogScope(__scopeAlertDialog);
2367
- return /* @__PURE__ */ jsxRuntime.jsx(Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
2368
- });
2369
- AlertDialogDescription.displayName = DESCRIPTION_NAME2;
2370
- var ACTION_NAME = "AlertDialogAction";
2371
- var AlertDialogAction = React25__namespace.forwardRef(
2372
- (props, forwardedRef) => {
2373
- const { __scopeAlertDialog, ...actionProps } = props;
2374
- const dialogScope = useDialogScope(__scopeAlertDialog);
2375
- return /* @__PURE__ */ jsxRuntime.jsx(Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
2376
- }
2377
- );
2378
- AlertDialogAction.displayName = ACTION_NAME;
2379
- var CANCEL_NAME = "AlertDialogCancel";
2380
- var AlertDialogCancel = React25__namespace.forwardRef(
2381
- (props, forwardedRef) => {
2382
- const { __scopeAlertDialog, ...cancelProps } = props;
2383
- const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
2384
- const dialogScope = useDialogScope(__scopeAlertDialog);
2385
- const ref = useComposedRefs(forwardedRef, cancelRef);
2386
- return /* @__PURE__ */ jsxRuntime.jsx(Close, { ...dialogScope, ...cancelProps, ref });
2387
- }
2388
- );
2389
- AlertDialogCancel.displayName = CANCEL_NAME;
2390
- var DescriptionWarning2 = ({ contentRef }) => {
2391
- const MESSAGE = `\`${CONTENT_NAME2}\` requires a description for the component to be accessible for screen reader users.
2392
-
2393
- You can add a description to the \`${CONTENT_NAME2}\` by passing a \`${DESCRIPTION_NAME2}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
2394
-
2395
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME2}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
2396
-
2397
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
2398
- React25__namespace.useEffect(() => {
2399
- const hasDescription = document.getElementById(
2400
- contentRef.current?.getAttribute("aria-describedby")
2401
- );
2402
- if (!hasDescription) console.warn(MESSAGE);
2403
- }, [MESSAGE, contentRef]);
2404
- return null;
2405
- };
2406
- var Root22 = AlertDialog;
2407
- var Trigger22 = AlertDialogTrigger;
2408
- var Portal22 = AlertDialogPortal;
2409
- var Overlay2 = AlertDialogOverlay;
2410
- var Content22 = AlertDialogContent;
2411
- var Action = AlertDialogAction;
2412
- var Cancel = AlertDialogCancel;
2413
- var Title2 = AlertDialogTitle;
2414
- var Description2 = AlertDialogDescription;
2415
- function AlertDialog2({
240
+ function AlertDialog({
2416
241
  ...props
2417
242
  }) {
2418
- return /* @__PURE__ */ jsxRuntime.jsx(Root22, { "data-slot": "alert-dialog", ...props });
243
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
2419
244
  }
2420
- function AlertDialogTrigger2({
245
+ function AlertDialogTrigger({
2421
246
  ...props
2422
247
  }) {
2423
- return /* @__PURE__ */ jsxRuntime.jsx(Trigger22, { "data-slot": "alert-dialog-trigger", ...props });
248
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
2424
249
  }
2425
- function AlertDialogPortal2({
250
+ function AlertDialogPortal({
2426
251
  ...props
2427
252
  }) {
2428
- return /* @__PURE__ */ jsxRuntime.jsx(Portal22, { "data-slot": "alert-dialog-portal", ...props });
253
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
2429
254
  }
2430
- function AlertDialogOverlay2({
255
+ function AlertDialogOverlay({
2431
256
  className,
2432
257
  ...props
2433
258
  }) {
2434
- return /* @__PURE__ */ jsxRuntime.jsx(
2435
- Overlay2,
259
+ return /* @__PURE__ */ jsx(
260
+ AlertDialogPrimitive.Overlay,
2436
261
  {
2437
262
  "data-slot": "alert-dialog-overlay",
2438
263
  className: cn(
@@ -2443,14 +268,14 @@ function AlertDialogOverlay2({
2443
268
  }
2444
269
  );
2445
270
  }
2446
- function AlertDialogContent2({
271
+ function AlertDialogContent({
2447
272
  className,
2448
273
  ...props
2449
274
  }) {
2450
- return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal2, { children: [
2451
- /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay2, {}),
2452
- /* @__PURE__ */ jsxRuntime.jsx(
2453
- Content22,
275
+ return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
276
+ /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
277
+ /* @__PURE__ */ jsx(
278
+ AlertDialogPrimitive.Content,
2454
279
  {
2455
280
  "data-slot": "alert-dialog-content",
2456
281
  className: cn(
@@ -2466,7 +291,7 @@ function AlertDialogHeader({
2466
291
  className,
2467
292
  ...props
2468
293
  }) {
2469
- return /* @__PURE__ */ jsxRuntime.jsx(
294
+ return /* @__PURE__ */ jsx(
2470
295
  "div",
2471
296
  {
2472
297
  "data-slot": "alert-dialog-header",
@@ -2479,7 +304,7 @@ function AlertDialogFooter({
2479
304
  className,
2480
305
  ...props
2481
306
  }) {
2482
- return /* @__PURE__ */ jsxRuntime.jsx(
307
+ return /* @__PURE__ */ jsx(
2483
308
  "div",
2484
309
  {
2485
310
  "data-slot": "alert-dialog-footer",
@@ -2491,12 +316,12 @@ function AlertDialogFooter({
2491
316
  }
2492
317
  );
2493
318
  }
2494
- function AlertDialogTitle2({
319
+ function AlertDialogTitle({
2495
320
  className,
2496
321
  ...props
2497
322
  }) {
2498
- return /* @__PURE__ */ jsxRuntime.jsx(
2499
- Title2,
323
+ return /* @__PURE__ */ jsx(
324
+ AlertDialogPrimitive.Title,
2500
325
  {
2501
326
  "data-slot": "alert-dialog-title",
2502
327
  className: cn("text-lg font-semibold", className),
@@ -2504,12 +329,12 @@ function AlertDialogTitle2({
2504
329
  }
2505
330
  );
2506
331
  }
2507
- function AlertDialogDescription2({
332
+ function AlertDialogDescription({
2508
333
  className,
2509
334
  ...props
2510
335
  }) {
2511
- return /* @__PURE__ */ jsxRuntime.jsx(
2512
- Description2,
336
+ return /* @__PURE__ */ jsx(
337
+ AlertDialogPrimitive.Description,
2513
338
  {
2514
339
  "data-slot": "alert-dialog-description",
2515
340
  className: cn("text-muted-foreground text-sm", className),
@@ -2517,24 +342,24 @@ function AlertDialogDescription2({
2517
342
  }
2518
343
  );
2519
344
  }
2520
- function AlertDialogAction2({
345
+ function AlertDialogAction({
2521
346
  className,
2522
347
  ...props
2523
348
  }) {
2524
- return /* @__PURE__ */ jsxRuntime.jsx(
2525
- Action,
349
+ return /* @__PURE__ */ jsx(
350
+ AlertDialogPrimitive.Action,
2526
351
  {
2527
352
  className: cn(buttonVariants(), className),
2528
353
  ...props
2529
354
  }
2530
355
  );
2531
356
  }
2532
- function AlertDialogCancel2({
357
+ function AlertDialogCancel({
2533
358
  className,
2534
359
  ...props
2535
360
  }) {
2536
- return /* @__PURE__ */ jsxRuntime.jsx(
2537
- Cancel,
361
+ return /* @__PURE__ */ jsx(
362
+ AlertDialogPrimitive.Cancel,
2538
363
  {
2539
364
  className: cn(buttonVariants({ variant: "outline" }), className),
2540
365
  ...props
@@ -2542,26 +367,9 @@ function AlertDialogCancel2({
2542
367
  );
2543
368
  }
2544
369
  function cn2(...inputs) {
2545
- return tailwindMerge.twMerge(clsx.clsx(inputs));
370
+ return twMerge(clsx(inputs));
2546
371
  }
2547
372
 
2548
- exports.Accordion = Accordion;
2549
- exports.AccordionContent = AccordionContent;
2550
- exports.AccordionItem = AccordionItem;
2551
- exports.AccordionTrigger = AccordionTrigger;
2552
- exports.AlertDialog = AlertDialog2;
2553
- exports.AlertDialogAction = AlertDialogAction2;
2554
- exports.AlertDialogCancel = AlertDialogCancel2;
2555
- exports.AlertDialogContent = AlertDialogContent2;
2556
- exports.AlertDialogDescription = AlertDialogDescription2;
2557
- exports.AlertDialogFooter = AlertDialogFooter;
2558
- exports.AlertDialogHeader = AlertDialogHeader;
2559
- exports.AlertDialogOverlay = AlertDialogOverlay2;
2560
- exports.AlertDialogPortal = AlertDialogPortal2;
2561
- exports.AlertDialogTitle = AlertDialogTitle2;
2562
- exports.AlertDialogTrigger = AlertDialogTrigger2;
2563
- exports.Button = Button;
2564
- exports.buttonVariants = buttonVariants;
2565
- exports.cn = cn2;
373
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Button, buttonVariants, cn2 as cn };
2566
374
  //# sourceMappingURL=index.js.map
2567
375
  //# sourceMappingURL=index.js.map