@neuctra/ui
Version:
A modern, responsive, customizable React UI component library powered by Tailwind CSS and Vite.
1 lines • 1.19 MB
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../src/components/basic/Text.tsx","../src/lib/cn.ts","../src/components/basic/Button.tsx","../src/components/basic/Image.tsx","../src/components/basic/Container.tsx","../src/components/basic/Avatar.tsx","../src/components/basic/Badge.tsx","../src/components/basic/List.tsx","../node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs","../node_modules/framer-motion/dist/es/utils/use-constant.mjs","../node_modules/framer-motion/dist/es/utils/is-browser.mjs","../node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs","../node_modules/framer-motion/dist/es/context/PresenceContext.mjs","../node_modules/motion-utils/dist/es/array.mjs","../node_modules/motion-utils/dist/es/clamp.mjs","../node_modules/motion-utils/dist/es/format-error-message.mjs","../node_modules/motion-utils/dist/es/errors.mjs","../node_modules/motion-utils/dist/es/global-config.mjs","../node_modules/motion-utils/dist/es/is-numerical-string.mjs","../node_modules/motion-utils/dist/es/is-object.mjs","../node_modules/motion-utils/dist/es/is-zero-value-string.mjs","../node_modules/motion-utils/dist/es/memo.mjs","../node_modules/motion-utils/dist/es/noop.mjs","../node_modules/motion-utils/dist/es/pipe.mjs","../node_modules/motion-utils/dist/es/progress.mjs","../node_modules/motion-utils/dist/es/subscription-manager.mjs","../node_modules/motion-utils/dist/es/time-conversion.mjs","../node_modules/motion-utils/dist/es/velocity-per-second.mjs","../node_modules/motion-utils/dist/es/warn-once.mjs","../node_modules/motion-utils/dist/es/easing/cubic-bezier.mjs","../node_modules/motion-utils/dist/es/easing/modifiers/mirror.mjs","../node_modules/motion-utils/dist/es/easing/modifiers/reverse.mjs","../node_modules/motion-utils/dist/es/easing/back.mjs","../node_modules/motion-utils/dist/es/easing/anticipate.mjs","../node_modules/motion-utils/dist/es/easing/circ.mjs","../node_modules/motion-utils/dist/es/easing/ease.mjs","../node_modules/motion-utils/dist/es/easing/utils/is-easing-array.mjs","../node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs","../node_modules/motion-utils/dist/es/easing/utils/map.mjs","../node_modules/motion-dom/dist/es/frameloop/order.mjs","../node_modules/motion-dom/dist/es/frameloop/render-step.mjs","../node_modules/motion-dom/dist/es/frameloop/batcher.mjs","../node_modules/motion-dom/dist/es/frameloop/frame.mjs","../node_modules/motion-dom/dist/es/frameloop/sync-time.mjs","../node_modules/motion-dom/dist/es/animation/utils/is-css-variable.mjs","../node_modules/motion-dom/dist/es/value/types/numbers/index.mjs","../node_modules/motion-dom/dist/es/value/types/utils/sanitize.mjs","../node_modules/motion-dom/dist/es/value/types/utils/float-regex.mjs","../node_modules/motion-dom/dist/es/value/types/utils/is-nullish.mjs","../node_modules/motion-dom/dist/es/value/types/utils/single-color-regex.mjs","../node_modules/motion-dom/dist/es/value/types/color/utils.mjs","../node_modules/motion-dom/dist/es/value/types/color/rgba.mjs","../node_modules/motion-dom/dist/es/value/types/color/hex.mjs","../node_modules/motion-dom/dist/es/value/types/numbers/units.mjs","../node_modules/motion-dom/dist/es/value/types/color/hsla.mjs","../node_modules/motion-dom/dist/es/value/types/color/index.mjs","../node_modules/motion-dom/dist/es/value/types/utils/color-regex.mjs","../node_modules/motion-dom/dist/es/value/types/complex/index.mjs","../node_modules/motion-dom/dist/es/value/types/color/hsla-to-rgba.mjs","../node_modules/motion-dom/dist/es/utils/mix/immediate.mjs","../node_modules/motion-dom/dist/es/utils/mix/number.mjs","../node_modules/motion-dom/dist/es/utils/mix/color.mjs","../node_modules/motion-dom/dist/es/utils/mix/visibility.mjs","../node_modules/motion-dom/dist/es/utils/mix/complex.mjs","../node_modules/motion-dom/dist/es/utils/mix/index.mjs","../node_modules/motion-dom/dist/es/animation/drivers/frame.mjs","../node_modules/motion-dom/dist/es/animation/waapi/utils/linear.mjs","../node_modules/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs","../node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs","../node_modules/motion-dom/dist/es/animation/generators/spring.mjs","../node_modules/motion-dom/dist/es/animation/generators/utils/velocity.mjs","../node_modules/motion-dom/dist/es/animation/generators/inertia.mjs","../node_modules/motion-dom/dist/es/utils/interpolate.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/offsets/fill.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/offsets/default.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/offsets/time.mjs","../node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs","../node_modules/motion-dom/dist/es/animation/utils/replace-transition-type.mjs","../node_modules/motion-dom/dist/es/animation/utils/WithPromise.mjs","../node_modules/motion-dom/dist/es/animation/JSAnimation.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs","../node_modules/motion-dom/dist/es/render/dom/parse-transform.mjs","../node_modules/motion-dom/dist/es/render/utils/keys-transform.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs","../node_modules/motion-dom/dist/es/render/dom/is-css-var.mjs","../node_modules/motion-dom/dist/es/render/dom/style-set.mjs","../node_modules/motion-dom/dist/es/utils/supports/flags.mjs","../node_modules/motion-dom/dist/es/utils/supports/memo.mjs","../node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.mjs","../node_modules/motion-dom/dist/es/utils/supports/linear-easing.mjs","../node_modules/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs","../node_modules/motion-dom/dist/es/animation/waapi/easing/supported.mjs","../node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs","../node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs","../node_modules/motion-dom/dist/es/animation/generators/utils/is-generator.mjs","../node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs","../node_modules/motion-dom/dist/es/animation/NativeAnimation.mjs","../node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs","../node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.mjs","../node_modules/motion-dom/dist/es/animation/utils/is-animatable.mjs","../node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs","../node_modules/motion-dom/dist/es/animation/utils/make-animation-instant.mjs","../node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs","../node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.mjs","../node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs","../node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs","../node_modules/motion-dom/dist/es/animation/utils/calc-child-stagger.mjs","../node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs","../node_modules/motion-dom/dist/es/animation/utils/default-transitions.mjs","../node_modules/motion-dom/dist/es/animation/utils/resolve-transition.mjs","../node_modules/motion-dom/dist/es/animation/utils/get-value-transition.mjs","../node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs","../node_modules/motion-dom/dist/es/animation/interfaces/motion-value.mjs","../node_modules/motion-dom/dist/es/render/utils/resolve-variants.mjs","../node_modules/motion-dom/dist/es/render/utils/resolve-dynamic-variants.mjs","../node_modules/motion-dom/dist/es/render/utils/keys-position.mjs","../node_modules/motion-dom/dist/es/value/index.mjs","../node_modules/motion-dom/dist/es/render/utils/is-keyframes-target.mjs","../node_modules/motion-dom/dist/es/render/utils/setters.mjs","../node_modules/motion-dom/dist/es/value/utils/is-motion-value.mjs","../node_modules/motion-dom/dist/es/value/will-change/is.mjs","../node_modules/motion-dom/dist/es/value/will-change/add-will-change.mjs","../node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.mjs","../node_modules/motion-dom/dist/es/animation/optimized-appear/data-id.mjs","../node_modules/motion-dom/dist/es/animation/optimized-appear/get-appear-id.mjs","../node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs","../node_modules/motion-dom/dist/es/animation/interfaces/visual-element-variant.mjs","../node_modules/motion-dom/dist/es/animation/interfaces/visual-element.mjs","../node_modules/motion-dom/dist/es/value/types/auto.mjs","../node_modules/motion-dom/dist/es/value/types/test.mjs","../node_modules/motion-dom/dist/es/value/types/dimensions.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/utils/is-none.mjs","../node_modules/motion-dom/dist/es/value/types/complex/filter.mjs","../node_modules/motion-dom/dist/es/value/types/complex/mask.mjs","../node_modules/motion-dom/dist/es/value/types/int.mjs","../node_modules/motion-dom/dist/es/value/types/maps/transform.mjs","../node_modules/motion-dom/dist/es/value/types/maps/number.mjs","../node_modules/motion-dom/dist/es/value/types/maps/defaults.mjs","../node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.mjs","../node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs","../node_modules/motion-dom/dist/es/utils/resolve-elements.mjs","../node_modules/motion-dom/dist/es/value/types/utils/get-as-type.mjs","../node_modules/motion-dom/dist/es/utils/is-html-element.mjs","../node_modules/motion-dom/dist/es/frameloop/microtask.mjs","../node_modules/motion-dom/dist/es/gestures/drag/state/is-active.mjs","../node_modules/motion-dom/dist/es/gestures/drag/state/set-active.mjs","../node_modules/motion-dom/dist/es/gestures/utils/setup.mjs","../node_modules/motion-dom/dist/es/gestures/hover.mjs","../node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs","../node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs","../node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs","../node_modules/motion-dom/dist/es/gestures/press/utils/state.mjs","../node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs","../node_modules/motion-dom/dist/es/gestures/press/index.mjs","../node_modules/motion-dom/dist/es/utils/is-svg-element.mjs","../node_modules/motion-dom/dist/es/resize/handle-element.mjs","../node_modules/motion-dom/dist/es/resize/handle-window.mjs","../node_modules/motion-dom/dist/es/resize/index.mjs","../node_modules/motion-dom/dist/es/utils/is-svg-svg-element.mjs","../node_modules/motion-dom/dist/es/value/types/utils/find.mjs","../node_modules/motion-dom/dist/es/projection/geometry/models.mjs","../node_modules/motion-dom/dist/es/render/store.mjs","../node_modules/motion-dom/dist/es/render/utils/is-animation-controls.mjs","../node_modules/motion-dom/dist/es/render/utils/is-variant-label.mjs","../node_modules/motion-dom/dist/es/render/utils/variant-props.mjs","../node_modules/motion-dom/dist/es/render/utils/is-controlling-variants.mjs","../node_modules/motion-dom/dist/es/render/utils/motion-values.mjs","../node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.mjs","../node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.mjs","../node_modules/motion-dom/dist/es/render/VisualElement.mjs","../node_modules/motion-dom/dist/es/render/dom/DOMVisualElement.mjs","../node_modules/motion-dom/dist/es/render/Feature.mjs","../node_modules/motion-dom/dist/es/projection/geometry/conversion.mjs","../node_modules/motion-dom/dist/es/projection/utils/has-transform.mjs","../node_modules/motion-dom/dist/es/projection/geometry/delta-apply.mjs","../node_modules/motion-dom/dist/es/projection/utils/measure.mjs","../node_modules/motion-dom/dist/es/render/html/utils/build-transform.mjs","../node_modules/motion-dom/dist/es/render/html/utils/build-styles.mjs","../node_modules/motion-dom/dist/es/render/html/utils/render.mjs","../node_modules/motion-dom/dist/es/projection/styles/scale-border-radius.mjs","../node_modules/motion-dom/dist/es/projection/styles/scale-box-shadow.mjs","../node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs","../node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.mjs","../node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.mjs","../node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/path.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/camel-case-attrs.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/is-svg-tag.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/render.mjs","../node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.mjs","../node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.mjs","../node_modules/motion-dom/dist/es/render/utils/get-variant-context.mjs","../node_modules/motion-dom/dist/es/render/utils/shallow-compare.mjs","../node_modules/motion-dom/dist/es/render/utils/animation-state.mjs","../node_modules/motion-dom/dist/es/projection/geometry/copy.mjs","../node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs","../node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs","../node_modules/motion-dom/dist/es/projection/geometry/utils.mjs","../node_modules/motion-dom/dist/es/projection/utils/each-axis.mjs","../node_modules/motion-dom/dist/es/projection/styles/transform.mjs","../node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs","../node_modules/motion-dom/dist/es/animation/animate/single-value.mjs","../node_modules/motion-dom/dist/es/events/add-dom-event.mjs","../node_modules/motion-dom/dist/es/projection/utils/compare-by-depth.mjs","../node_modules/motion-dom/dist/es/projection/utils/flat-tree.mjs","../node_modules/motion-dom/dist/es/utils/delay.mjs","../node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.mjs","../node_modules/motion-dom/dist/es/projection/shared/stack.mjs","../node_modules/motion-dom/dist/es/projection/node/state.mjs","../node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs","../node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs","../node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs","../node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs","../node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../node_modules/framer-motion/dist/es/context/LazyContext.mjs","../node_modules/framer-motion/dist/es/motion/features/definitions.mjs","../node_modules/framer-motion/dist/es/motion/features/load-features.mjs","../node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs","../node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs","../node_modules/framer-motion/dist/es/context/MotionContext/index.mjs","../node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs","../node_modules/framer-motion/dist/es/context/MotionContext/create.mjs","../node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs","../node_modules/framer-motion/dist/es/render/html/use-props.mjs","../node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs","../node_modules/framer-motion/dist/es/render/svg/use-props.mjs","../node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs","../node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs","../node_modules/framer-motion/dist/es/render/dom/use-render.mjs","../node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs","../node_modules/framer-motion/dist/es/render/html/use-html-visual-state.mjs","../node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.mjs","../node_modules/framer-motion/dist/es/motion/utils/symbol.mjs","../node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs","../node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs","../node_modules/framer-motion/dist/es/utils/is-ref-object.mjs","../node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs","../node_modules/framer-motion/dist/es/motion/index.mjs","../node_modules/framer-motion/dist/es/render/components/create-proxy.mjs","../node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs","../node_modules/framer-motion/dist/es/motion/features/animation/index.mjs","../node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs","../node_modules/framer-motion/dist/es/motion/features/animations.mjs","../node_modules/framer-motion/dist/es/events/event-info.mjs","../node_modules/framer-motion/dist/es/events/add-pointer-event.mjs","../node_modules/framer-motion/dist/es/utils/get-context-window.mjs","../node_modules/framer-motion/dist/es/utils/distance.mjs","../node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs","../node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs","../node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs","../node_modules/framer-motion/dist/es/gestures/drag/index.mjs","../node_modules/framer-motion/dist/es/gestures/pan/index.mjs","../node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs","../node_modules/framer-motion/dist/es/motion/features/drag.mjs","../node_modules/framer-motion/dist/es/gestures/hover.mjs","../node_modules/framer-motion/dist/es/gestures/focus.mjs","../node_modules/framer-motion/dist/es/gestures/press.mjs","../node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs","../node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs","../node_modules/framer-motion/dist/es/motion/features/gestures.mjs","../node_modules/framer-motion/dist/es/motion/features/layout.mjs","../node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.mjs","../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs","../src/components/basic/Dropdown.tsx","../src/components/basic/Alert.tsx","../src/components/basic/Accordion.tsx","../src/components/basic/Checkbox.tsx","../src/components/basic/RadioGroup.tsx","../src/components/basic/Switch.tsx","../src/lib/useScrollLock.ts","../src/lib/useFocusTrap.ts","../src/components/basic/Drawer.tsx","../src/components/basic/Select.tsx","../src/components/basic/Input.tsx","../src/components/basic/Textarea.tsx","../src/components/basic/Modal.tsx","../src/components/basic/Table.tsx","../src/components/basic/Tabs.tsx","../src/components/basic/ThemeToggleButton.tsx","../src/components/basic/Card.tsx","../src/components/basic/Divider.tsx","../src/components/basic/Chip.tsx","../src/components/basic/Kbd.tsx","../src/components/basic/Skeleton.tsx","../src/components/basic/Spinner.tsx","../src/components/basic/Progress.tsx","../src/components/basic/Stat.tsx","../src/components/basic/EmptyState.tsx","../src/components/basic/Timeline.tsx","../src/components/basic/Breadcrumb.tsx","../src/components/basic/Pagination.tsx","../src/components/basic/Stepper.tsx","../src/components/basic/Tooltip.tsx","../src/components/basic/Popover.tsx","../src/components/basic/Slider.tsx","../src/components/basic/NumberInput.tsx","../src/components/basic/Rating.tsx","../src/components/basic/TagInput.tsx","../src/components/basic/PinInput.tsx","../src/components/basic/FileUpload.tsx","../src/components/basic/Callout.tsx","../src/components/basic/Toggle.tsx","../src/components/basic/ToggleGroup.tsx","../src/components/basic/CopyButton.tsx","../src/components/basic/AvatarGroup.tsx","../src/components/basic/Calendar.tsx","../src/components/basic/DatePicker.tsx","../src/components/basic/Carousel.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport clsx from \"clsx\";\n\ntype HTMLElementTag = keyof HTMLElementTagNameMap;\n\nexport type TextProps<T extends HTMLElementTag = \"span\"> = {\n as?: T;\n children: React.ReactNode;\n\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n truncate?: boolean;\n\n color?: \"default\" | \"muted\" | \"primary\" | string;\n\n className?: string;\n} & Omit<React.ComponentPropsWithoutRef<T>, \"className\">;\n\n/* ------------------ MAPS ------------------ */\n\nconst transformMap = {\n uppercase: \"uppercase\",\n lowercase: \"lowercase\",\n capitalize: \"capitalize\",\n};\n\nconst colorMap: Record<string, string> = {\n default: \"text-foreground\",\n primary: \"text-primary\",\n muted: \"text-muted-foreground\",\n};\n\n/* ------------------ COMPONENT ------------------ */\n\nexport function Text<T extends HTMLElementTag = \"span\">({\n as,\n children,\n transform,\n italic,\n underline,\n strikethrough,\n truncate,\n color = \"default\",\n className,\n ...rest\n}: TextProps<T>) {\n const Element = (as || \"p\") as any;\n const isAnchor = Element === \"a\";\n\n return (\n <Element\n className={clsx(\n className,\n\n transform && transformMap[transform],\n\n italic && \"italic\",\n underline && \"underline\",\n strikethrough && \"line-through\",\n\n truncate && \"truncate\",\n\n isAnchor && \"text-primary hover:opacity-80 underline\",\n\n colorMap[color] || color,\n )}\n {...(isAnchor && { rel: \"noopener noreferrer\" })}\n {...rest}\n >\n {children}\n </Element>\n );\n}\n\nexport default Text;","import clsx, { type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names, resolving Tailwind conflicts by argument order.\n *\n * `clsx` alone only concatenates, so `clsx(\"px-5\", \"px-2\")` emits both and the\n * winner is decided by stylesheet order rather than intent. `twMerge` drops the\n * losing utility, which is what makes a consumer's `className` actually\n * override a component's defaults — pass it LAST.\n */\nexport const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Optional so icon-only buttons are possible — pair with `aria-label`. */\n children?: React.ReactNode;\n\n iconBefore?: React.ReactNode;\n iconAfter?: React.ReactNode;\n\n loading?: boolean;\n loadingText?: string;\n\n fullWidth?: boolean;\n\n variant?:\n | \"default\"\n | \"outline\"\n | \"ghost\"\n | \"secondary\"\n | \"destructive\"\n | \"success\"\n | \"warning\"\n | \"info\";\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n /** 🔥 Full Customization */\n contentClassName?: string;\n iconClassName?: string;\n loaderClassName?: string;\n textClassName?: string;\n\n contentStyle?: React.CSSProperties;\n iconStyle?: React.CSSProperties;\n loaderStyle?: React.CSSProperties;\n textStyle?: React.CSSProperties;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🔘 Button */\n/* -------------------------------------------------------------------------- */\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n children,\n iconBefore,\n iconAfter,\n loading = false,\n loadingText = \"Loading...\",\n fullWidth = false,\n variant = \"default\",\n size = \"sm\",\n disabled,\n\n className,\n contentClassName,\n iconClassName,\n loaderClassName,\n textClassName,\n\n style,\n contentStyle,\n iconStyle,\n loaderStyle,\n textStyle,\n\n type = \"button\",\n ...rest\n },\n ref,\n ) {\n const isDisabled = disabled || loading;\n\n /* 📏 Sizes */\n const sizeClasses = {\n xs: \"px-3 py-1.5 text-xs min-h-[28px] rounded-md\",\n sm: \"px-4 py-2 text-sm min-h-[32px] rounded-md\",\n md: \"px-6 py-2.5 text-[15px] min-h-[40px] rounded-lg\",\n lg: \"px-8 py-3 text-base min-h-[48px] rounded-xl\",\n xl: \"px-10 py-3.5 text-lg min-h-[56px] rounded-2xl\",\n } as const;\n\n /* ↔️ Gap between icon and label, scaled with the size */\n const gapClasses = {\n xs: \"gap-1.5\",\n sm: \"gap-2\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n } as const;\n\n /* 🌀 Spinner stroke, so it doesn't look solid at xs */\n const loaderBorder = {\n xs: \"border\",\n sm: \"border-2\",\n md: \"border-2\",\n lg: \"border-2\",\n xl: \"border-[3px]\",\n } as const;\n\n /* 🎨 VARIANTS (SHADCN STYLE) */\n const variantClasses: Record<\n NonNullable<ButtonProps[\"variant\"]>,\n string\n > = {\n default: \"bg-primary text-primary-foreground hover:opacity-90\",\n outline:\n \"border border-border bg-background text-foreground hover:bg-accent\",\n ghost: \"bg-transparent text-foreground hover:bg-accent\",\n secondary: \"bg-muted text-muted-foreground hover:opacity-90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:opacity-90\",\n success: \"bg-success text-success-foreground hover:opacity-90\",\n warning: \"bg-warning text-warning-foreground hover:opacity-90\",\n info: \"bg-info text-info-foreground hover:opacity-90\",\n };\n\n /* 🔘 Icon sizes */\n const iconSizes = {\n xs: 14,\n sm: 16,\n md: 20,\n lg: 24,\n xl: 28,\n } as const;\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled}\n aria-busy={loading || undefined}\n className={cn(\n \"inline-flex items-center justify-center transition-all duration-200\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n sizeClasses[size] ?? sizeClasses.md,\n variantClasses[variant] ?? variantClasses.default,\n fullWidth && \"w-full\",\n isDisabled && \"opacity-60 cursor-not-allowed\",\n className,\n )}\n style={style}\n {...rest}\n >\n {/* 🔥 CONTENT WRAPPER */}\n <span\n className={cn(\n \"inline-flex items-center\",\n gapClasses[size] ?? gapClasses.md,\n contentClassName,\n )}\n style={contentStyle}\n >\n {loading ? (\n <>\n {/* Loader */}\n <span\n aria-hidden=\"true\"\n className={cn(\n \"border-current border-t-transparent rounded-full animate-spin\",\n loaderBorder[size] ?? loaderBorder.md,\n loaderClassName,\n )}\n style={{\n width: iconSizes[size],\n height: iconSizes[size],\n flexShrink: 0,\n ...loaderStyle,\n }}\n />\n\n {/* Loading Text */}\n <span\n className={cn(\n \"whitespace-nowrap text-current\",\n textClassName,\n )}\n style={textStyle}\n >\n {loadingText}\n </span>\n </>\n ) : (\n <>\n {iconBefore && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"inline-flex items-center justify-center shrink-0 text-current\",\n // Size the SVG itself, not just its wrapper — otherwise a\n // default 24px lucide icon spills out of a 14px xs box.\n \"[&_svg]:w-full [&_svg]:h-full\",\n iconClassName,\n )}\n style={{\n width: iconSizes[size],\n height: iconSizes[size],\n ...iconStyle,\n }}\n >\n {iconBefore}\n </span>\n )}\n\n {children !== undefined && children !== null && (\n <span\n className={cn(\"whitespace-nowrap text-current\", textClassName)}\n style={textStyle}\n >\n {children}\n </span>\n )}\n\n {iconAfter && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"inline-flex items-center justify-center shrink-0 text-current\",\n \"[&_svg]:w-full [&_svg]:h-full\",\n iconClassName,\n )}\n style={{\n width: iconSizes[size],\n height: iconSizes[size],\n ...iconStyle,\n }}\n >\n {iconAfter}\n </span>\n )}\n </>\n )}\n </span>\n </button>\n );\n },\n);\n\nButton.displayName = \"Button\";\n","\"use client\";\n\nimport React, { forwardRef, useMemo } from \"react\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\ntype Responsive<T> =\n | T\n | {\n base?: T;\n sm?: T;\n md?: T;\n lg?: T;\n xl?: T;\n };\n\nexport interface ImageProps extends React.HTMLAttributes<HTMLDivElement> {\n src?: string;\n alt?: string;\n title?: string;\n\n /** Layout */\n width?: Responsive<number | string>;\n height?: Responsive<number | string>;\n aspectRatio?: number;\n\n /** Styling */\n radius?: number | string;\n border?: string;\n shadow?: boolean;\n opacity?: number;\n objectFit?: React.CSSProperties[\"objectFit\"];\n\n /** Overlay */\n overlay?: React.ReactNode;\n overlayColor?: string;\n\n /** Interaction */\n clickable?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n\n /** States */\n fallback?: React.ReactNode;\n\n /** Behavior */\n loading?: \"lazy\" | \"eager\";\n\n /** 🔥 Full Customization */\n className?: string;\n imageClassName?: string;\n overlayClassName?: string;\n fallbackClassName?: string;\n\n style?: React.CSSProperties;\n imageStyle?: React.CSSProperties;\n overlayStyle?: React.CSSProperties;\n fallbackStyle?: React.CSSProperties;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🛠 Utility */\n/* -------------------------------------------------------------------------- */\n\nconst resolveResponsive = <T,>(\n value: Responsive<T> | undefined\n): T | undefined => {\n if (!value) return undefined;\n if (typeof value !== \"object\" || !(\"base\" in value)) return value as T;\n return value.base;\n};\n\n/* -------------------------------------------------------------------------- */\n/* 🖼 Image Component */\n/* -------------------------------------------------------------------------- */\n\nexport const Image = forwardRef<HTMLDivElement, ImageProps>(\n (props, ref) => {\n const {\n src,\n alt = \"\",\n title,\n width = \"100%\",\n height,\n aspectRatio,\n radius,\n border,\n shadow,\n opacity = 1,\n objectFit = \"cover\",\n\n overlay,\n overlayColor = \"color-mix(in srgb, var(--background) 60%, transparent)\",\n\n clickable,\n onClick,\n\n fallback,\n loading = \"lazy\",\n\n className,\n imageClassName,\n overlayClassName,\n fallbackClassName,\n\n style,\n imageStyle,\n overlayStyle,\n fallbackStyle,\n\n ...rest\n } = props;\n\n const resolvedWidth = resolveResponsive(width);\n const resolvedHeight = resolveResponsive(height);\n\n /* Wrapper styles */\n const wrapperStyles: React.CSSProperties = useMemo(\n () => ({\n width: resolvedWidth,\n height: resolvedHeight,\n aspectRatio,\n borderRadius: radius,\n border,\n overflow: \"hidden\",\n position: \"relative\",\n display: \"inline-block\",\n cursor: clickable ? \"pointer\" : undefined,\n boxShadow: shadow ? \"0 4px 12px color-mix(in srgb, var(--foreground) 15%, transparent)\" : undefined,\n backgroundColor: \"var(--background)\",\n ...style,\n }),\n [\n resolvedWidth,\n resolvedHeight,\n aspectRatio,\n radius,\n border,\n shadow,\n clickable,\n style,\n ]\n );\n\n /* Image styles */\n const imageStyles: React.CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n objectFit,\n opacity,\n display: \"block\",\n ...imageStyle,\n };\n\n /* Overlay styles */\n const overlayStyles: React.CSSProperties = {\n position: \"absolute\",\n inset: 0,\n background: overlayColor,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"var(--primary-foreground)\",\n ...overlayStyle,\n };\n\n /* Fallback styles */\n const fallbackStyles: React.CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: 16,\n color: \"var(--muted-foreground)\",\n backgroundColor: \"var(--muted)\",\n ...fallbackStyle,\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!clickable) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick?.(e as any);\n }\n };\n\n return (\n <div\n ref={ref}\n role={clickable ? \"button\" : undefined}\n tabIndex={clickable ? 0 : undefined}\n aria-label={alt}\n title={title}\n onClick={clickable ? onClick : undefined}\n onKeyDown={handleKeyDown}\n style={wrapperStyles}\n className={className}\n {...rest}\n >\n {src ? (\n <img\n src={src}\n alt={alt}\n loading={loading}\n style={imageStyles}\n className={imageClassName}\n />\n ) : (\n <div style={fallbackStyles} className={fallbackClassName}>\n {fallback || \"No Image\"}\n </div>\n )}\n\n {overlay && (\n <div style={overlayStyles} className={overlayClassName}>\n {overlay}\n </div>\n )}\n </div>\n );\n }\n);\n\nImage.displayName = \"Image\";","\"use client\";\n\nimport React from \"react\";\nimport clsx from \"clsx\";\n\ntype ContainerSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"full\";\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n size?: ContainerSize;\n padding?: \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n center?: boolean;\n\n /** Custom styles (framework independent) */\n style?: React.CSSProperties;\n\n className?: string;\n children?: React.ReactNode;\n}\n\n/** Max width mapping (Tailwind-friendly but optional) */\nconst sizeMap: Record<ContainerSize, string> = {\n sm: \"max-w-sm\",\n md: \"max-w-md\",\n lg: \"max-w-lg\",\n xl: \"max-w-xl\",\n \"2xl\": \"max-w-2xl\",\n full: \"w-full\",\n};\n\n/** Padding mapping */\nconst paddingMap: Record<NonNullable<ContainerProps[\"padding\"]>, string> = {\n none: \"p-0\",\n sm: \"p-4\",\n md: \"p-6\",\n lg: \"p-8\",\n xl: \"p-12\",\n};\n\n/**\n * 🧱 Container Component\n * - Works with Tailwind OR plain CSS\n * - Controls width & horizontal spacing only\n * - Layout should be handled via className or style\n */\nexport const Container = React.forwardRef<HTMLDivElement, ContainerProps>(\n (\n {\n size = \"full\",\n padding = \"none\",\n center = true,\n className,\n style,\n children,\n ...rest\n },\n ref,\n ) => {\n const classes = clsx(\n className,\n \"w-full box-border\",\n sizeMap[size],\n paddingMap[padding],\n center && \"mx-auto\",\n );\n\n return (\n <div ref={ref} className={classes} style={{ ...style }} {...rest}>\n {children}\n </div>\n );\n },\n);\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","\"use client\";\n\nimport React, { useState, CSSProperties } from \"react\";\nimport { User } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\ntype AvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"responsive\";\ntype AvatarVariant = \"circular\" | \"rounded\" | \"square\";\ntype StatusPosition = \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n\nexport interface AvatarProps {\n src?: string;\n alt?: string;\n size?: AvatarSize;\n variant?: AvatarVariant;\n isOnline?: boolean;\n isOffline?: boolean;\n ring?: boolean;\n fallback?: string;\n onClick?: () => void;\n statusPosition?: StatusPosition;\n className?: string;\n statusClassName?: string;\n style?: CSSProperties;\n statusStyle?: CSSProperties;\n\n /** 🔥 Full Customization */\n imageClassName?: string;\n fallbackClassName?: string;\n iconClassName?: string;\n}\n\n// Size maps with proper pixel values for status dots\nconst sizeMap: Record<Exclude<AvatarSize, \"responsive\">, number> = {\n xs: 24,\n sm: 32,\n md: 40,\n lg: 48,\n xl: 56,\n \"2xl\": 64,\n};\n\nconst fontSizeMap: Record<Exclude<AvatarSize, \"responsive\">, string> = {\n xs: \"text-xs\",\n sm: \"text-sm\",\n md: \"text-base\",\n lg: \"text-lg\",\n xl: \"text-xl\",\n \"2xl\": \"text-2xl\",\n};\n\nconst dimensionMap: Record<Exclude<AvatarSize, \"responsive\">, string> = {\n xs: \"w-6 h-6\",\n sm: \"w-8 h-8\",\n md: \"w-10 h-10\",\n lg: \"w-12 h-12\",\n xl: \"w-14 h-14\",\n \"2xl\": \"w-16 h-16\",\n};\n\nconst variantMap: Record<AvatarVariant, string> = {\n circular: \"rounded-full\",\n rounded: \"rounded-lg\",\n square: \"rounded-none\",\n};\n\nconst statusPositionMap: Record<StatusPosition, string> = {\n \"top-left\": \"-top-0.5 -left-0.5\",\n \"top-right\": \"-top-0.5 -right-0.5\",\n \"bottom-left\": \"-bottom-0.5 -left-0.5\",\n \"bottom-right\": \"-bottom-0.5 -right-0.5\",\n};\n\n// Get status dot size based on avatar size\nconst getStatusDotSize = (size: Exclude<AvatarSize, \"responsive\">): string => {\n const sizes: Record<Exclude<AvatarSize, \"responsive\">, string> = {\n xs: \"w-2 h-2\",\n sm: \"w-2.5 h-2.5\",\n md: \"w-3 h-3\",\n lg: \"w-3.5 h-3.5\",\n xl: \"w-4 h-4\",\n \"2xl\": \"w-4.5 h-4.5\",\n };\n return sizes[size];\n};\n\n// Get status border width based on avatar size\nconst getStatusBorderWidth = (\n size: Exclude<AvatarSize, \"responsive\">,\n): string => {\n const borders: Record<Exclude<AvatarSize, \"responsive\">, string> = {\n xs: \"border\",\n sm: \"border\",\n md: \"border-2\",\n lg: \"border-2\",\n xl: \"border-[3px]\",\n \"2xl\": \"border-[3px]\",\n };\n return borders[size];\n};\n\nexport const Avatar: React.FC<AvatarProps> = ({\n src,\n alt = \"User avatar\",\n size = \"md\",\n variant = \"circular\",\n isOnline = false,\n isOffline = false,\n fallback,\n ring = false,\n onClick,\n statusPosition = \"bottom-right\",\n className = \"\",\n statusClassName = \"\",\n style,\n statusStyle,\n imageClassName = \"\",\n fallbackClassName = \"\",\n iconClassName = \"\",\n}) => {\n const [imageError, setImageError] = useState(false);\n const clickable = !!onClick;\n const resolvedSize = size === \"responsive\" ? \"md\" : size;\n\n const initials =\n fallback ||\n alt\n .split(\" \")\n .map((n) => n[0])\n .join(\"\")\n .toUpperCase()\n .slice(0, 2);\n\n // Presence uses the status palette: success = online, muted = offline —\n // not the brand primary, which may be any hue the theme defines. Border\n // width/color are applied once by the dot itself.\n const statusColor = isOnline\n ? \"bg-success\"\n : isOffline\n ? \"bg-muted-foreground\"\n : \"\";\n\n const statusDotSize = getStatusDotSize(resolvedSize);\n const statusBorderWidth = getStatusBorderWidth(resolvedSize);\n\n return (\n <div\n role={clickable ? \"button\" : \"img\"}\n tabIndex={clickable ? 0 : -1}\n aria-label={alt}\n onClick={onClick}\n className={`relative inline-flex items-center justify-center \n ${dimensionMap[resolvedSize]} \n ${variantMap[variant]} \n bg-background text-foreground\n transition-all duration-200 \n ${clickable ? \"cursor-pointer hover:scale-105 active:scale-95\" : \"\"} \n ${ring ? \"ring-2 ring-border ring-offset-2\" : \"\"} \n ${className}`}\n style={{\n ...style,\n ...(ring ? { ringColor: \"var(--border)\" } : {}),\n }}\n onKeyDown={(e) => {\n if (clickable && (e.key === \"Enter\" || e.key === \" \")) {\n e.preventDefault();\n onClick?.();\n }\n }}\n >\n {src && !imageError ? (\n <img\n src={src}\n alt={alt}\n onError={() => setImageError(true)}\n className={cn(\n \"w-full h-full object-cover\",\n variantMap[variant],\n imageClassName,\n )}\n />\n ) : (\n <div\n className={cn(\n \"w-full h-full flex items-center justify-center bg-muted text-foreground font-semibold\",\n fontSizeMap[resolvedSize],\n variantMap[variant],\n fallbackClassName,\n )}\n >\n {initials || (\n <User\n className={cn(\"w-1/2 h-1/2 text-muted-foreground\", iconClassName)}\n />\n )}\n </div>\n )}\n\n {/* Status Dot - Now properly visible */}\n {(isOnline || isOffline) && (\n <span\n aria-label={isOnline ? \"Online\" : \"Offline\"}\n title={isOnline ? \"Online\" : \"Offline\"}\n className={`\n absolute\n ${statusPositionMap[statusPosition]}\n ${statusColor}\n ${statusDotSize}\n ${statusBorderWidth}\n border-background\n rounded-full\n shadow-md\n z-10\n ${statusClassName}\n `}\n style={{\n ...statusStyle,\n }}\n />\n )}\n </div>\n );\n};\n\n// Export additional helper for responsive sizing\nexport const getAvatarSize = (size: AvatarSize): number => {\n if (size === \"responsive\") return 40;\n return sizeMap[size];\n};\n","\"use client\";\n\nimport React, { memo, CSSProperties } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\nexport interface BadgeProps {\n text?: string;\n\n variant?: \"solid\" | \"outline\" | \"soft\";\n\n icon?: React.ReactNode;\n iconPosition?: \"left\" | \"right\";\n\n size?: \"sm\" | \"md\" | \"lg\";\n\n rounded?: boolean;\n\n notificationDot?: boolean;\n dotColor?: string;\n count?: number | string;\n pulse?: boolean;\n\n className?: string;\n style?: CSSProperties;\n dotClassName?: string;\n dotStyle?: CSSProperties;\n countClassName?: string;\n countStyle?: CSSProperties;\n iconClassName?: string;\n iconStyle?: CSSProperties;\n textClassName?: string;\n textStyle?: CSSProperties;\n\n onClick?: () => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🏷 Badge */\n/* -------------------------------------------------------------------------- */\n\nexport const Badge: React.FC<BadgeProps> = memo(\n ({\n text,\n icon,\n iconPosition = \"left\",\n variant = \"solid\",\n size = \"sm\",\n rounded = true,\n\n notificationDot = false,\n count,\n pulse = false,\n\n className,\n style,\n dotClassName,\n dotStyle,\n countClassName,\n countStyle,\n iconClassName,\n iconStyle,\n textClassName,\n textStyle,\n\n onClick,\n }) => {\n const sizes = {\n sm: \"px-2.5 py-0.5 text-[11px] gap-1\",\n md: \"px-3 py-1 text-xs gap-1.5\",\n lg: \"px-4 py-1.5 text-sm gap-2\",\n } as const;\n\n // The icon slot has to scale with the size too — otherwise a `lg` badge\n // renders the same icon box as an `sm` one.\n const iconSizes = {\n sm: \"w-3 h-3\",\n md: \"w-3.5 h-3.5\",\n lg: \"w-4 h-4\",\n } as const;\n\n const variants = {\n // text-primary-foreground, not text-white — a light --primary (the\n // README's own example is a bright green) fails contrast against white.\n solid: \"bg-primary text-primary-foreground\",\n outline: \"border border-primary text-primary bg-transparent\",\n soft: \"bg-primary/10 text-primary\",\n } as const;\n\n const isInteractive = Boolean(onClick);\n\n return (\n <span\n onClick={onClick}\n // A clickable badge has to be reachable and operable by keyboard.\n role={isInteractive ? \"button\" : undefined}\n tabIndex={isInteractive ? 0 : undefined}\n onKeyDown={\n isInteractive\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick?.();\n }\n }\n : undefined\n }\n style={style}\n className={cn(\n \"relative inline-flex items-center justify-center font-medium\",\n \"transition-all duration-200 select-none\",\n\n variants[variant] ?? variants.solid,\n\n rounded ? \"rounded-full\" : \"rounded-md\",\n sizes[size] ?? sizes.sm,\n\n isInteractive &&\n \"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background \" +\n // Hover stays within the variant's own color ramp.\n (variant === \"solid\"\n ? \"hover:bg-primary/90\"\n : variant === \"outline\"\n ? \"hover:bg-primary/10\"\n : \"hover:bg-primary/20\"),\n\n className,\n )}\n >\n {/* Dot — suppressed when a count is shown, since both sit in the same\n corner and would overlap. */}\n {notificationDot && count === undefined && (\n <span\n aria-hidden=\"true\"\n style={dotStyle}\n className={cn(\n \"absolute -top-1 -right-1 w-2 h-2 rounded-full bg-destructive\",\n // animate-ping scales the dot to 2x and fades it out, so on its\n // own the dot vanishes. Render the ping as a sibling ring and\n // keep a solid dot underneath.\n pulse &&\n \"before:absolute before:inset-0 before:rounded-full before:bg-destructive before:animate-ping motion-reduce:before:animate-none\",\n dotClassName,\n )}\n />\n )}\n\n {/* Count */}\n {count !== undefined && (\n <span\n role=\"status\"\n style={countStyle}\n className={cn(\n \"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 text-[10px]\",\n \"flex items-center justify-center rounded-full\",\n \"bg-destructive text-destructive-foreground\",\n countClassName,\n )}\n >\n {count}\n </span>\n )}\n\n {/* Icon Left */}\n {icon && iconPosition === \"left\" && (\n <span\n aria-hidden=\"true\"\n style={iconStyle}\n className={cn(\n \"flex items-center shrink-0 [&_svg]:w-full [&_svg]:h-full\",\n iconSizes[size] ?? iconSizes.sm,\n iconClassName,\n )}\n >\n {icon}\n </span>\n )}\n\n {/* Text */}\n {text && (\n <span style={textStyle} className={cn(textClassName)}>\n {text}\n </span>\n )}\n\n {/* Icon Right */}\n {icon && iconPosition === \"right\" && (\n <span\n aria-hidden=\"true\"\n style={iconStyle}\n className={cn(\n \"flex items-center shrink-0 [&_svg]:w-full [&_svg]:h-full\",\n iconSizes[size] ?? iconSizes.sm,\n iconClassName,\n )}\n >\n {icon}\n </span>\n )}\n </span>\n );\n },\n);\n\nBadge.displayName = \"Badge\";\n","\"use client\";\n\nimport React, {\n CSSProperties,\n ElementType,\n MouseEvent,\n ReactNode,\n useMemo,\n useState,\n} from \"react\";\nimport clsx from \"clsx\";\nimport { ChevronDown, ChevronRight, ExternalLink } from \"lucide-react\";\n\nexport type ListType = \"unordered\" | \"ordered\" | \"inline\";\nexport type ListVariant = \"default\" | \"nav\" | \"menu\" | \"card\" | \"ghost\";\nexport type ListSize = \"sm\" | \"md\" | \"lg\";\nexport type ListDensity = \"compact\" | \"normal\" | \"comfortable\";\nexport type NestedMode = \"always\" | \"collapse\";\nexport type BulletVariant = \"dot\" | \"line\" | \"number\" | \"none\";\n\nexport interface ListItemType {\n id?: string | number;\n text?: ReactNode;\n label?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n leading?: ReactNode;\n trailing?: ReactNode;\n badge?: ReactNode;\n shortcut?: ReactNode;\n\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n download?: boolean | string;\n onClick?: (\n event: MouseEvent<HTMLElement>,\n item: ListItemType,\n ) => void;\n\n subItems?: ListItemType[];\n items?: ListItemType[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n collapsible?: boolean;\n\n active?: boolean;\n disabled?: boolean;\n danger?: boolean;\n separator?: boolean;\n hidden?: boolean;\n\n title?: string;\n ariaLabel?: string;\n role?: string;\n\n className?: string;\n contentClassName?: string;\n iconClassName?: string;\n textClassName?: string;\n descriptionClassName?: string;\n badgeClassName?: string;\n subListClassName?: string;\n\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n iconStyle?: CSSProperties;\n textStyle?: CSSProperties;\n descriptionStyle?: CSSProperties;\n badgeStyle?: CSSProperties;\n subListStyle?: CSSProperties;\n}\n\nexport interface ListRenderItemParams {\n item: ListItemType;\n index: number;\n depth: number;\n active: boolean;\n expanded: boolean;\n disabled: boolean;\n hasChildren: boolean;\n toggle: () => void;\n select: (event: MouseEvent<HTMLElement>) => void;\n}\n\nexport interface ListProps {\n title?: ReactNode;\n titleIcon?: ReactNode;\n description?: ReactNode;\n items: ListItemType[];\n\n type?: ListType;\n variant?: ListVariant;\n size?: ListSize;\n density?: ListDensity;\n nestedMode?: NestedMode;\n bulletVariant?: BulletVariant;\n\n showTree?: boolean;\n showBullets?: boolean;\n showDividers?: boolean;\n interactive?: boolean;\n fullWidth?: boolean;\n disabled?: boolean;\n\n activeItemId?: string | number;\n defaultActiveItemId?: string | number;\n onActiveChange?: (id: string | number, item: ListItemType) => void;\n\n expandedIds?: Array<string | number>;\n defaultExpandedIds?: Array<string | number>;\n onExpandedChange?: (ids: Array<string | number>) => void;\n\n role?: string;\n ariaLabel?: string;\n emptyState?: ReactNode;\n linkComponent?: ElementType;\n renderItem?: (params: ListRenderItemParams) => ReactNode;\n\n className?: string;\n headerClassName?: string;\n listClassName?: string;\n itemClassName?: string;\n itemContentClassName?: string;\n titleClassName?: string;\n descriptionClassName?: string;\n bulletClassName?: string;\n textClassName?: string;\n iconClassName?: string;\n badgeClassName?: string;\n shortcutClassName?: string;\n trailingClassName?: string;\n subListClassName?: string;\n separatorClassName?: string;\n chevronClassName?: string;\n externalIconClassName?: string;\n emptyStateClassName?: string;\n\n style?: CSSProperties;\n headerStyle?: CSSProperties;\n listStyle?: CSSProperties;\n itemStyle?: CSSProperties;\n itemContentStyle?: CSSProperties;\n titleStyle?: CSSProperties;\n descriptionStyle?: CSSProperties;\n bulletStyle?: CSSProperties;\n textStyle?: CSSProperties;\n iconStyle?: CSSProperties;\n badgeStyle?: CSSProperties;\n shortcutStyle?: CSSProperties;\n trailingStyle?: CSSProperties;\n subListStyle?: CSSProperties;\n separatorStyle?: CSSProperties;\n}\n\nexport interface ListItemProps {\n item?: ListItemType;\n index?: number;\n depth?: number;\n isInline?: boolean;\n isOrdered?: boolean;\n showTree?: boolean;\n showBullets?: boolean;\n showDividers?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n variant?: ListVariant;\n size?: ListSize;\n density?: ListDensity;\n nestedMode?: NestedMode;\n bulletVariant?: BulletVariant;\n activeItemId?: string | number;\n expandedIds?: Set<string | number>;\n toggleExpanded?: (id: string | number, item: ListItemType) => void;\n selectItem?: (id: string | number, item: ListItemType) => void;\n linkComponent?: ElementType;\n renderItem?: (params: ListRenderItemParams) => ReactNode;\n\n itemClassName?: string;\n itemContentClassName?: string;\n bulletClassName?: string;\n textClassName?: string;\n iconClassName?: string;\n badgeClassName?: string;\n shortcutClassName?: string;\n trailingClassName?: string;\n subListClassName?: string;\n separatorClassName?: string;\n chevronClassName?: string;\n externalIconClassName?: string;\n\n itemStyle?: CSSProperties;\n itemContentStyle?: CSSProperties;\n bulletStyle?: CSSProperties;\n textStyle?: CSSProperties;\n iconStyle?: CSSProperties;\n badgeStyle?: CSSProperties;\n shortcutStyle?: CSSProperties;\n trailingStyle?: CSSProperties;\n subListStyle?: CSSProperties;\n separatorStyle?: CSSProperties;\n}\n\nconst sizeClasses: Record<ListSize, string> = {\n sm: \"text-xs\",\n md: \"text-sm\",\n lg: \"text-base\",\n};\n\nconst paddingClasses: Record<ListDensity, Record<ListSize, string>> = {\n compact: {\n sm: \"px-2 py-1\",\n md: \"px-2.5 py-1.5\",\n lg: \"px-3 py-2\",\n },\n normal: {\n sm: \"px-2.5 py-1.5\",\n md: \"px-3 py-2\",\n lg: \"px-3.5 py-2.5\",\n },\n comfortable: {\n sm: \"px-3 py-2\",\n md: \"px-3.5 py-2.5\",\n lg: \"px-4 py-3\",\n },\n};\n\nconst variantClasses: Record<ListVariant, string> = {\n default: \"rounded-md hover:bg-accent\",\n nav: \"rounded-lg hover:bg-accent hover:text-foreground\",\n menu: \"rounded-md hover:bg-accent\",\n card: \"rounded-lg border border-border bg-card hover:bg-accent\",\n ghost: \"rounded-md hover:bg-accent/70\",\n};\n\nconst activeClasses: Record<ListVariant, string> = {\n default: \"bg-accent text-foreground\",\n nav: \"bg-primary text-foreground\",\n menu: \"bg-accent text-foreground\",\n card: \"border-primary bg-primary/10 text-foreground\",\n ghost: \"bg-accent text-foreground\",\n};\n\nconst getItemId = (item: ListItemType, index: number, depth: number) =>\n item.id ?? `${depth}-${index}-${String(item.text ?? item.label ?? \"item\")}`;\n\nconst getChildren = (item: ListItemType) => item.subItems ?? item.items ?? [];\n\nconst getLabel = (item: ListItemType) => item.text ?? item.label;\n\nconst shouldUseRel = (target?: React.HTMLAttributeAnchorTarget, rel?: string) =>\n rel ?? (target === \"_blank\" ? \"noreferrer\" : undefined);\n\nexport const ListItem: React.FC<ListItemProps & Partial<ListItemType>> = (\n props,\n) => {\n const item = props.item ?? {\n id: props.id,\n text: props.text,\n label: props.label,\n description: props.description,\n icon: props.icon,\n leading: props.leading,\n trailing: props.trailing,\n badge: props.badge,\n shortcut: props.shortcut,\n href: props.href,\n target: props.target,\n rel: props.rel,\n download: props.download,\n onClick: props.onClick,\n subItems: props.subItems,\n items: props.items,\n expanded: props.expanded,\n defaultExpanded: props.defaultExpanded,\n collapsible: props.collapsible,\n active: props.active,\n disabled: props.disabled,\n danger: props.danger,\n separator: props.separator,\n hidden: props.hidden,\n title: props.title,\n ariaLabel: props.ariaLabel,\n role: props.role,\n className: props.className,\n contentClassName: props.contentClassName,\n iconClassName: props.iconClassName,\n textClassName: props.textClassName,\n descriptionClassName: props.descriptionClassName,\n badgeClassName: props.badgeClassName,\n subListClassName: props.subListClassName,\n style: props.style,\n contentStyle: props.contentStyle,\n iconStyle: props.iconStyle,\n textStyle: props.textStyle,\n descriptionStyle: props.descriptionStyle,\n badgeStyle: props.badgeStyle,\n subListStyle: props.subListStyle,\n };\n\n const {\n index = 0,\n depth = 0,\n isInline = false,\n isOrdered = false,\n showTree = false,\n showBullets = false,\n showDividers = false,\n interactive = true,\n disabled: listDisabled = false,\n variant = \"default\",\n size = \"md\",\n density = \"normal\",\n nestedMode = \"collapse\",\n bulletVariant = \"dot\",\n activeItemId,\n expandedIds,\n toggleExpanded,\n selectItem,\n linkComponent,\n renderItem,\n itemClassName,\n itemContentClassName,\n bulletClassName,\n textClassName,\n iconClassName,\n badgeClassName,\n shortcutClassName,\n trailingClassName,\n subListClassName,\n separatorClassName,\n chevronClassName,\n externalIconClassName,\n itemStyle,\n itemContentStyle,\n bulletStyle,\n textStyle,\n iconStyle,\n badgeStyle,\n shortcutStyle,\n trailingStyle,\n subListStyle,\n separatorStyle,\n } = props;\n\n if (item.hidden) return null;\n\n const id = getItemId(item, index, depth);\n const children = getChildren(item);\n const hasChildren = children.length > 0;\n const itemDisabled = listDisabled || !!item.disabled;\n const itemActive = item.active || activeItemId === id;\n const controlledExpanded = item.expanded;\n const setExpanded = expandedIds?.has(id);\n const expanded =\n controlledExpanded ?? setExpanded ?? item.defaultExpanded ?? nestedMode === \"always\";\n const collapsible = item.collapsible ?? nestedMode === \"collapse\";\n const label = getLabel(item);\n const LeadingIcon = item.leading ?? item.icon;\n const LinkComponent = linkComponent ?? \"a\";\n const hasAction = !!item.href || !!item.onClick || hasChildren;\n const isClickable = interactive && hasAction && !itemDisabled;\n const isExternal = item.target === \"_blank\";\n\n const toggle = () => {\n if (!hasChildren || itemDisabled) return;\n toggleExpanded?.(id, item);\n };\n\n const handleSelect = (event: MouseEvent<HTMLElement>) => {\n if (itemDisabled) {\n event.preventDefault();\n return;\n }\n\n if (hasChildren && (!item.href || collapsible)) {\n toggle();\n }\n\n item.onClick?.(event, item);\n selectItem?.(id, item);\n };\n\n if (item.separator) {\n return (\n <li\n role=\"separator\"\n className={clsx(\"my-1 h-px bg-border\", separatorClassName)}\n style={separatorStyle}\n />\n );\n }\n\n const marker =\n showBullets &&\n !isOrdered &&\n !isInline &&\n !LeadingIcon &&\n bulletVariant !== \"none\";\n\n const content = (\n <>\n {marker && (\n <span\n aria-hidden=\"true\"\n className={clsx(\n \"shrink-0\",\n bulletVariant === \"line\" && \"mt-1.5 h-px w-4 bg-current opacity-50\",\n bulletVariant === \"number\" &&\n \"flex h-5 min-w-5 items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-foreground\",\n bulletVariant === \"dot\" && \"mt-1.5 h-2 w-2 rounded-full bg-primary\",\n bulletClassName,\n )}\n style={bulletStyle}\n >\n {bulletVariant === \"number\" ? index + 1 : null}\n </span>\n )}\n\n {LeadingIcon && (\n <span\n className={clsx(\n \"shrink-0 text-foreground/70\",\n item.iconClassName,\n iconClassName,\n )}\n style={{ ...iconStyle, ...item.iconStyle }}\n >\n {LeadingIcon}\n </span>\n )}\n\n <span className=\"min-w-0 flex-1\">\n <span\n className={clsx(\n \"block truncate\",\n item.textClassName,\n textClassName,\n )}\n style={{ ...textStyle, ...item.textStyle }}\n >\n {label}\n </span>\n\n {item.description && (\n <span\n className={clsx(\n \"mt-0.5 block truncate text-xs text-foreground/70\",\n item.descriptionClassName,\n )}\n style={item.descriptionStyle}\n >\n {item.description}\n </span>\n )}\n </span>\n\n {item.badge && (\n <span\n className={clsx(\n \"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-foreground\",\n item.badgeClassName,\n badgeClassName,\n )}\n style={{ ...badgeStyle, ...item.badgeStyle }}\n >\n {item.badge}\n </span>\n )}\n\n {item.shortcut && (\n <kbd\n className={clsx(\n \"shrink-0 rounded border border-border bg-muted px-1.5 py-0.5 text-[11px] text-foreground/60\",\n shortcutClassName,\n )}\n style={props.shortcutStyle}\n >\n {item.shortcut}\n </kbd>\n )}\n\n {item.trailing && (\n <span\n className={clsx(\"shrink-0 text-foreground/70\", trailingClassName)}\n style={trailingStyle}\n >\n {item.trailing}\n </span>\n )}\n\n {isExternal && (\n <ExternalLink\n aria-hidden=\"true\"\n className={clsx(\"h-3.5 w-3.5 shrink-0 text-foreground/60\", externalIconClassName)}\n />\n )}\n\n {hasChildren && collapsible && !item.trailing && (\n <span className={clsx(\"shrink-0 text-foreground/60\", chevronClassName)}>\n {expanded ? <ChevronDown size={16} /> : <ChevronRight size={16} />}\n </span>\n )}\n </>\n );\n\n const contentClassName = clsx(\n \"group/list-item flex min-w-0 items-center gap-2.5 transition-all\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n sizeClasses[size],\n paddingClasses[density][size],\n variantClasses[variant],\n itemActive && activeClasses[variant],\n item.danger && \"text-foreground hover:bg-destructive/10\",\n itemDisabled && \"pointer-events-none opacity-50\",\n isClickable && \"cursor-pointer\",\n !isClickable && \"cursor-default\",\n item.contentClassName,\n itemContentClassName,\n );\n\n const sharedElementProps = {\n title: item.title,\n \"aria-label\": item.ariaLabel,\n \"aria-current\": itemActive ? (\"page\" as const) : undefined,\n \"aria-expanded\": hasChildren && collapsible ? expanded : undefined,\n className: contentClassName,\n style: { ...itemContentStyle, ...item.contentStyle },\n };\n\n const defaultItem = (\n <>\n {item.href ? (\n <LinkComponent\n {...sharedElementProps}\n href={item.href}\n target={item.target}\n rel={shouldUseRel(item.target, item.rel)}\n download={item.download}\n onClick={handleSelect}\n >\n {content}\n </LinkComponent>\n ) : (\n <>\n {isClickable ? (\n <button\n {...sharedElementProps}\n type=\"button\"\n disabled={itemDisabled}\n onClick={handleSelect}\n >\n {content}\n </button>\n ) : (\n <div {...sharedElementProps}>{content}</div>\n )}\n </>\n )}\n </>\n );\n\n return (\n <li\n role={item.role}\n className={clsx(\n \"relative\",\n showDividers && \"border-b border-border last:border-b-0\",\n showTree && depth > 0 && !isInline && \"pl-4\",\n isInline && \"shrink-0\",\n item.className,\n itemClassName,\n )}\n style={{ ...itemStyle, ...item.style }}\n >\n {showTree && depth > 0 && !isInline && (\n <>\n <span className=\"absolute left-1.5 top-0 h-full w-px bg-border\" />\n <span className=\"absolute left-1.5 top-5 h-px w-3 bg-border\" />\n </>\n )}\n\n {renderItem\n ? renderItem({\n item,\n index,\n depth,\n active: itemActive,\n expanded,\n disabled: itemDisabled,\n hasChildren,\n toggle,\n select: handleSelect,\n })\n : defaultItem}\n\n {hasChildren && !isInline && expanded && (\n <ul\n role=\"group\"\n className={clsx(\n \"mt-1 list-none space-y-1 pl-3\",\n showTree && \"pl-4\",\n item.subListClassName,\n subListClassName,\n )}\n style={{ ...subListStyle, ...item.subListStyle }}\n >\n {children.map((child, childIndex) => (\n <ListItem\n key={getItemId(child, childIndex, depth + 1)}\n item={child}\n index={childIndex}\n depth={depth + 1}\n isOrdered={isOrdered}\n showTree={showTree}\n showBullets={showBullets}\n showDividers={showDividers}\n interactive={interactive}\n disabled={listDisabled}\n variant={variant}\n size={size}\n density={density}\n nestedMode={nestedMode}\n bulletVariant={bulletVariant}\n activeItemId={activeItemId}\n expandedIds={expandedIds}\n toggleExpanded={toggleExpanded}\n selectItem={selectItem}\n linkComponent={linkComponent}\n renderItem={renderItem}\n itemClassName={itemClassName}\n itemContentClassName={itemContentClassName}\n bulletClassName={bulletClassName}\n textClassName={textClassName}\n iconClassName={iconClassName}\n badgeClassName={badgeClassName}\n shortcutClassName={shortcutClassName}\n trailingClassName={trailingClassName}\n subListClassName={subListClassName}\n separatorClassName={separatorClassName}\n chevronClassName={chevronClassName}\n externalIconClassName={externalIconClassName}\n itemStyle={itemStyle}\n itemContentStyle={itemContentStyle}\n bulletStyle={bulletStyle}\n textStyle={textStyle}\n iconStyle={iconStyle}\n badgeStyle={badgeStyle}\n shortcutStyle={shortcutStyle}\n trailingStyle={trailingStyle}\n subListStyle={subListStyle}\n separatorStyle={separatorStyle}\n />\n ))}\n </ul>\n )}\n </li>\n );\n};\n\nexport const List: React.FC<ListProps> = ({\n title,\n titleIcon,\n description,\n items,\n type = \"unordered\",\n variant = \"default\",\n size = \"md\",\n density = \"normal\",\n nestedMode = \"collapse\",\n bulletVariant = \"dot\",\n showTree = false,\n showBullets = false,\n showDividers = false,\n interactive = true,\n fullWidth = true,\n disabled = false,\n activeItemId,\n defaultActiveItemId,\n onActiveChange,\n expandedIds,\n defaultExpandedIds = [],\n onExpandedChange,\n role,\n ariaLabel,\n emptyState,\n linkComponent,\n renderItem,\n className,\n headerClassName,\n listClassName,\n itemClassName,\n itemContentClassName,\n titleClassName,\n descriptionClassName,\n bulletClassName,\n textClassName,\n iconClassName,\n badgeClassName,\n shortcutClassName,\n trailingClassName,\n subListClassName,\n separatorClassName,\n chevronClassName,\n externalIconClassName,\n emptyStateClassName,\n style,\n headerStyle,\n listStyle,\n itemStyle,\n itemContentStyle,\n titleStyle,\n descriptionStyle,\n bulletStyle,\n textStyle,\n iconStyle,\n badgeStyle,\n shortcutStyle,\n trailingStyle,\n subListStyle,\n separatorStyle,\n}) => {\n const isOrdered = type === \"ordered\";\n const isInline = type === \"inline\";\n const ListTag = isOrdered ? \"ol\" : \"ul\";\n const [internalActiveId, setInternalActiveId] = useState<\n string | number | undefined\n >(defaultActiveItemId);\n const [internalExpandedIds, setInternalExpandedIds] = useState<\n Array<string | number>\n >(defaultExpandedIds);\n\n const resolvedActiveId = activeItemId ?? internalActiveId;\n const resolvedExpandedIds = expandedIds ?? internalExpandedIds;\n const expandedSet = useMemo(\n () => new Set<string | number>(resolvedExpandedIds),\n [resolvedExpandedIds],\n );\n\n const visibleItems = items.filter((item) => !item.hidden);\n\n const updateExpanded = (id: string | number) => {\n const next = expandedSet.has(id)\n ? resolvedExpandedIds.filter((expandedId) => expandedId !== id)\n : [...resolvedExpandedIds, id];\n\n if (!expandedIds) setInternalExpandedIds(next);\n onExpandedChange?.(next);\n };\n\n const selectItem = (id: string | number, item: ListItemType) => {\n if (activeItemId === undefined) setInternalActiveId(id);\n onActiveChange?.(id, item);\n };\n\n return (\n <div\n className={clsx(\n \"text-foreground\",\n fullWidth ? \"w-full\" : \"inline-block\",\n className,\n )}\n style={style}\n >\n {(title || description) && (\n <div\n className={clsx(\"mb-3 flex items-start gap-2\", headerClassName)}\n style={headerStyle}\n >\n {titleIcon && (\n <span\n className={clsx(\n \"mt-0.5 shrink-0 text-foreground/70\",\n iconClassName,\n )}\n style={iconStyle}\n >\n {titleIcon}\n </span>\n )}\n\n <div className=\"min-w-0\">\n {title && (\n <div\n className={clsx(\n \"truncate text-base font-semibold text-foreground\",\n titleClassName,\n )}\n style={titleStyle}\n >\n {title}\n </div>\n )}\n\n {description && (\n <p\n className={clsx(\n \"mt-0.5 text-sm text-foreground/70\",\n descriptionClassName,\n )}\n style={descriptionStyle}\n >\n {description}\n </p>\n )}\n </div>\n </div>\n )}\n\n {visibleItems.length === 0 ? (\n <div\n className={clsx(\n \"rounded-md border border-dashed border-border px-3 py-4 text-sm text-foreground/70\",\n emptyStateClassName,\n )}\n >\n {emptyState ?? \"No items to show.\"}\n </div>\n ) : (\n <ListTag\n role={role}\n aria-label={ariaLabel}\n className={clsx(\n isInline\n ? \"flex list-none flex-wrap gap-2 p-0\"\n : isOrdered\n ? \"list-decimal space-y-1 pl-5\"\n : \"list-none space-y-1 p-0\",\n variant === \"menu\" && \"rounded-lg border border-border bg-popover p-1\",\n variant === \"card\" && !isOrdered && !isInline && \"space-y-2\",\n listClassName,\n )}\n style={listStyle}\n >\n {visibleItems.map((item, index) => (\n <ListItem\n key={getItemId(item, index, 0)}\n item={item}\n index={index}\n depth={0}\n isInline={isInline}\n isOrdered={isOrdered}\n showTree={showTree}\n showBullets={showBullets}\n showDividers={showDividers}\n interactive={interactive}\n disabled={disabled}\n variant={variant}\n size={size}\n density={density}\n nestedMode={nestedMode}\n bulletVariant={bulletVariant}\n activeItemId={resolvedActiveId}\n expandedIds={expandedSet}\n toggleExpanded={updateExpanded}\n selectItem={selectItem}\n linkComponent={linkComponent}\n renderItem={renderItem}\n itemClassName={itemClassName}\n itemContentClassName={itemContentClassName}\n bulletClassName={bulletClassName}\n textClassName={textClassName}\n iconClassName={iconClassName}\n badgeClassName={badgeClassName}\n shortcutClassName={shortcutClassName}\n trailingClassName={trailingClassName}\n subListClassName={subListClassName}\n separatorClassName={separatorClassName}\n chevronClassName={chevronClassName}\n externalIconClassName={externalIconClassName}\n itemStyle={itemStyle}\n itemContentStyle={itemContentStyle}\n bulletStyle={bulletStyle}\n textStyle={textStyle}\n iconStyle={iconStyle}\n badgeStyle={badgeStyle}\n shortcutStyle={shortcutStyle}\n trailingStyle={trailingStyle}\n subListStyle={subListStyle}\n separatorStyle={separatorStyle}\n />\n ))}\n </ListTag>\n )}\n </div>\n );\n};\n","\"use client\";\nimport { createContext } from 'react';\n\nconst LayoutGroupContext = createContext({});\n\nexport { LayoutGroupContext };\n//# sourceMappingURL=LayoutGroupContext.mjs.map\n","\"use client\";\nimport { useRef } from 'react';\n\n/**\n * Creates a constant value over the lifecycle of a component.\n *\n * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer\n * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`\n * you can ensure that initialisers don't execute twice or more.\n */\nfunction useConstant(init) {\n const ref = useRef(null);\n if (ref.current === null) {\n ref.current = init();\n }\n return ref.current;\n}\n\nexport { useConstant };\n//# sourceMappingURL=use-constant.mjs.map\n","const isBrowser = typeof window !== \"undefined\";\n\nexport { isBrowser };\n//# sourceMappingURL=is-browser.mjs.map\n","\"use client\";\nimport { useLayoutEffect, useEffect } from 'react';\nimport { isBrowser } from './is-browser.mjs';\n\nconst useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;\n\nexport { useIsomorphicLayoutEffect };\n//# sourceMappingURL=use-isomorphic-effect.mjs.map\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * @public\n */\nconst PresenceContext = \n/* @__PURE__ */ createContext(null);\n\nexport { PresenceContext };\n//# sourceMappingURL=PresenceContext.mjs.map\n","function addUniqueItem(arr, item) {\n if (arr.indexOf(item) === -1)\n arr.push(item);\n}\nfunction removeItem(arr, item) {\n const index = arr.indexOf(item);\n if (index > -1)\n arr.splice(index, 1);\n}\n// Adapted from array-move\nfunction moveItem([...arr], fromIndex, toIndex) {\n const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;\n if (startIndex >= 0 && startIndex < arr.length) {\n const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;\n const [item] = arr.splice(fromIndex, 1);\n arr.splice(endIndex, 0, item);\n }\n return arr;\n}\n\nexport { addUniqueItem, moveItem, removeItem };\n//# sourceMappingURL=array.mjs.map\n","const clamp = (min, max, v) => {\n if (v > max)\n return max;\n if (v < min)\n return min;\n return v;\n};\n\nexport { clamp };\n//# sourceMappingURL=clamp.mjs.map\n","function formatErrorMessage(message, errorCode) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message;\n}\n\nexport { formatErrorMessage };\n//# sourceMappingURL=format-error-message.mjs.map\n","import { formatErrorMessage } from './format-error-message.mjs';\n\nlet warning = () => { };\nlet invariant = () => { };\nif (typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\") {\n warning = (check, message, errorCode) => {\n if (!check && typeof console !== \"undefined\") {\n console.warn(formatErrorMessage(message, errorCode));\n }\n };\n invariant = (check, message, errorCode) => {\n if (!check) {\n throw new Error(formatErrorMessage(message, errorCode));\n }\n };\n}\n\nexport { invariant, warning };\n//# sourceMappingURL=errors.mjs.map\n","const MotionGlobalConfig = {};\n\nexport { MotionGlobalConfig };\n//# sourceMappingURL=global-config.mjs.map\n","/**\n * Check if value is a numerical string, ie a string that is purely a number eg \"100\" or \"-100.1\"\n */\nconst isNumericalString = (v) => /^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$/u.test(v);\n\nexport { isNumericalString };\n//# sourceMappingURL=is-numerical-string.mjs.map\n","function isObject(value) {\n return typeof value === \"object\" && value !== null;\n}\n\nexport { isObject };\n//# sourceMappingURL=is-object.mjs.map\n","/**\n * Check if the value is a zero value string like \"0px\" or \"0%\"\n */\nconst isZeroValueString = (v) => /^0[^.\\s]+$/u.test(v);\n\nexport { isZeroValueString };\n//# sourceMappingURL=is-zero-value-string.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nfunction memo(callback) {\n let result;\n return () => {\n if (result === undefined)\n result = callback();\n return result;\n };\n}\n\nexport { memo };\n//# sourceMappingURL=memo.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n//# sourceMappingURL=noop.mjs.map\n","/**\n * Pipe\n * Compose other transformers to run linearily\n * pipe(min(20), max(40))\n * @param {...functions} transformers\n * @return {function}\n */\nconst combineFunctions = (a, b) => (v) => b(a(v));\nconst pipe = (...transformers) => transformers.reduce(combineFunctions);\n\nexport { pipe };\n//# sourceMappingURL=pipe.mjs.map\n","/*\n Progress within given range\n\n Given a lower limit and an upper limit, we return the progress\n (expressed as a number 0-1) represented by the given value, and\n limit that progress to within 0-1.\n\n @param [number]: Lower limit\n @param [number]: Upper limit\n @param [number]: Value to find progress within given range\n @return [number]: Progress of value within range as expressed 0-1\n*/\n/*#__NO_SIDE_EFFECTS__*/\nconst progress = (from, to, value) => {\n const toFromDifference = to - from;\n return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;\n};\n\nexport { progress };\n//# sourceMappingURL=progress.mjs.map\n","import { addUniqueItem, removeItem } from './array.mjs';\n\nclass SubscriptionManager {\n constructor() {\n this.subscriptions = [];\n }\n add(handler) {\n addUniqueItem(this.subscriptions, handler);\n return () => removeItem(this.subscriptions, handler);\n }\n notify(a, b, c) {\n const numSubscriptions = this.subscriptions.length;\n if (!numSubscriptions)\n return;\n if (numSubscriptions === 1) {\n /**\n * If there's only a single handler we can just call it without invoking a loop.\n */\n this.subscriptions[0](a, b, c);\n }\n else {\n for (let i = 0; i < numSubscriptions; i++) {\n /**\n * Check whether the handler exists before firing as it's possible\n * the subscriptions were modified during this loop running.\n */\n const handler = this.subscriptions[i];\n handler && handler(a, b, c);\n }\n }\n }\n getSize() {\n return this.subscriptions.length;\n }\n clear() {\n this.subscriptions.length = 0;\n }\n}\n\nexport { SubscriptionManager };\n//# sourceMappingURL=subscription-manager.mjs.map\n","/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\n/*#__NO_SIDE_EFFECTS__*/\nconst secondsToMilliseconds = (seconds) => seconds * 1000;\n/*#__NO_SIDE_EFFECTS__*/\nconst millisecondsToSeconds = (milliseconds) => milliseconds / 1000;\n\nexport { millisecondsToSeconds, secondsToMilliseconds };\n//# sourceMappingURL=time-conversion.mjs.map\n","/*\n Convert velocity into velocity per second\n\n @param [number]: Unit per frame\n @param [number]: Frame duration in ms\n*/\nfunction velocityPerSecond(velocity, frameDuration) {\n return frameDuration ? velocity * (1000 / frameDuration) : 0;\n}\n\nexport { velocityPerSecond };\n//# sourceMappingURL=velocity-per-second.mjs.map\n","import { formatErrorMessage } from './format-error-message.mjs';\n\nconst warned = new Set();\nfunction hasWarned(message) {\n return warned.has(message);\n}\nfunction warnOnce(condition, message, errorCode) {\n if (condition || warned.has(message))\n return;\n console.warn(formatErrorMessage(message, errorCode));\n warned.add(message);\n}\n\nexport { hasWarned, warnOnce };\n//# sourceMappingURL=warn-once.mjs.map\n","import { noop } from '../noop.mjs';\n\n/*\n Bezier function generator\n This has been modified from Gaëtan Renaudeau's BezierEasing\n https://github.com/gre/bezier-easing/blob/master/src/index.js\n https://github.com/gre/bezier-easing/blob/master/LICENSE\n \n I've removed the newtonRaphsonIterate algo because in benchmarking it\n wasn't noticeably faster than binarySubdivision, indeed removing it\n usually improved times, depending on the curve.\n I also removed the lookup table, as for the added bundle size and loop we're\n only cutting ~4 or so subdivision iterations. I bumped the max iterations up\n to 12 to compensate and this still tended to be faster for no perceivable\n loss in accuracy.\n Usage\n const easeOut = cubicBezier(.17,.67,.83,.67);\n const x = easeOut(0.5); // returns 0.627...\n*/\n// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\nconst calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *\n t;\nconst subdivisionPrecision = 0.0000001;\nconst subdivisionMaxIterations = 12;\nfunction binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {\n let currentX;\n let currentT;\n let i = 0;\n do {\n currentT = lowerBound + (upperBound - lowerBound) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - x;\n if (currentX > 0.0) {\n upperBound = currentT;\n }\n else {\n lowerBound = currentT;\n }\n } while (Math.abs(currentX) > subdivisionPrecision &&\n ++i < subdivisionMaxIterations);\n return currentT;\n}\nfunction cubicBezier(mX1, mY1, mX2, mY2) {\n // If this is a linear gradient, return linear easing\n if (mX1 === mY1 && mX2 === mY2)\n return noop;\n const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);\n // If animation is at start/end, return t without easing\n return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);\n}\n\nexport { cubicBezier };\n//# sourceMappingURL=cubic-bezier.mjs.map\n","// Accepts an easing function and returns a new one that outputs mirrored values for\n// the second half of the animation. Turns easeIn into easeInOut.\nconst mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;\n\nexport { mirrorEasing };\n//# sourceMappingURL=mirror.mjs.map\n","// Accepts an easing function and returns a new one that outputs reversed values.\n// Turns easeIn into easeOut.\nconst reverseEasing = (easing) => (p) => 1 - easing(1 - p);\n\nexport { reverseEasing };\n//# sourceMappingURL=reverse.mjs.map\n","import { cubicBezier } from './cubic-bezier.mjs';\nimport { mirrorEasing } from './modifiers/mirror.mjs';\nimport { reverseEasing } from './modifiers/reverse.mjs';\n\nconst backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99);\nconst backIn = /*@__PURE__*/ reverseEasing(backOut);\nconst backInOut = /*@__PURE__*/ mirrorEasing(backIn);\n\nexport { backIn, backInOut, backOut };\n//# sourceMappingURL=back.mjs.map\n","import { backIn } from './back.mjs';\n\nconst anticipate = (p) => p >= 1\n ? 1\n : (p *= 2) < 1\n ? 0.5 * backIn(p)\n : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));\n\nexport { anticipate };\n//# sourceMappingURL=anticipate.mjs.map\n","import { mirrorEasing } from './modifiers/mirror.mjs';\nimport { reverseEasing } from './modifiers/reverse.mjs';\n\nconst circIn = (p) => 1 - Math.sin(Math.acos(p));\nconst circOut = reverseEasing(circIn);\nconst circInOut = mirrorEasing(circIn);\n\nexport { circIn, circInOut, circOut };\n//# sourceMappingURL=circ.mjs.map\n","import { cubicBezier } from './cubic-bezier.mjs';\n\nconst easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1);\nconst easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1);\nconst easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1);\n\nexport { easeIn, easeInOut, easeOut };\n//# sourceMappingURL=ease.mjs.map\n","const isEasingArray = (ease) => {\n return Array.isArray(ease) && typeof ease[0] !== \"number\";\n};\n\nexport { isEasingArray };\n//# sourceMappingURL=is-easing-array.mjs.map\n","const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === \"number\";\n\nexport { isBezierDefinition };\n//# sourceMappingURL=is-bezier-definition.mjs.map\n","import { invariant } from '../../errors.mjs';\nimport { noop } from '../../noop.mjs';\nimport { anticipate } from '../anticipate.mjs';\nimport { backOut, backInOut, backIn } from '../back.mjs';\nimport { circOut, circInOut, circIn } from '../circ.mjs';\nimport { cubicBezier } from '../cubic-bezier.mjs';\nimport { easeOut, easeInOut, easeIn } from '../ease.mjs';\nimport { isBezierDefinition } from './is-bezier-definition.mjs';\n\nconst easingLookup = {\n linear: noop,\n easeIn,\n easeInOut,\n easeOut,\n circIn,\n circInOut,\n circOut,\n backIn,\n backInOut,\n backOut,\n anticipate,\n};\nconst isValidEasing = (easing) => {\n return typeof easing === \"string\";\n};\nconst easingDefinitionToFunction = (definition) => {\n if (isBezierDefinition(definition)) {\n // If cubic bezier definition, create bezier curve\n invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`, \"cubic-bezier-length\");\n const [x1, y1, x2, y2] = definition;\n return cubicBezier(x1, y1, x2, y2);\n }\n else if (isValidEasing(definition)) {\n // Else lookup from table\n invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`, \"invalid-easing-type\");\n return easingLookup[definition];\n }\n return definition;\n};\n\nexport { easingDefinitionToFunction };\n//# sourceMappingURL=map.mjs.map\n","const stepsOrder = [\n \"setup\", // Compute\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"preUpdate\", // Compute\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n];\n\nexport { stepsOrder };\n//# sourceMappingURL=order.mjs.map\n","import { statsBuffer } from '../stats/buffer.mjs';\n\nfunction createRenderStep(runNextFrame, stepName) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n let numCalls = 0;\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n numCalls++;\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n // Swap this frame and the next to avoid GC\n const prevFrame = thisFrame;\n thisFrame = nextFrame;\n nextFrame = prevFrame;\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n /**\n * If we're recording stats then\n */\n if (stepName && statsBuffer.value) {\n statsBuffer.value.frameloop[stepName].push(numCalls);\n }\n numCalls = 0;\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n//# sourceMappingURL=render-step.mjs.map\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { stepsOrder } from './order.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);\n return acc;\n }, {});\n const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;\n const processBatch = () => {\n const useManualTiming = MotionGlobalConfig.useManualTiming;\n const timestamp = useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n if (!useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n }\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n setup.process(state);\n read.process(state);\n resolveKeyframes.process(state);\n preUpdate.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher };\n//# sourceMappingURL=batcher.mjs.map\n","import { noop } from 'motion-utils';\nimport { createRenderBatcher } from './batcher.mjs';\n\nconst { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop, true);\n\nexport { cancelFrame, frame, frameData, frameSteps };\n//# sourceMappingURL=frame.mjs.map\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { frameData } from './frame.mjs';\n\nlet now;\nfunction clearTime() {\n now = undefined;\n}\n/**\n * An eventloop-synchronous alternative to performance.now().\n *\n * Ensures that time measurements remain consistent within a synchronous context.\n * Usually calling performance.now() twice within the same synchronous context\n * will return different values which isn't useful for animations when we're usually\n * trying to sync animations to the same frame.\n */\nconst time = {\n now: () => {\n if (now === undefined) {\n time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming\n ? frameData.timestamp\n : performance.now());\n }\n return now;\n },\n set: (newTime) => {\n now = newTime;\n queueMicrotask(clearTime);\n },\n};\n\nexport { time };\n//# sourceMappingURL=sync-time.mjs.map\n","const checkStringStartsWith = (token) => (key) => typeof key === \"string\" && key.startsWith(token);\nconst isCSSVariableName = \n/*@__PURE__*/ checkStringStartsWith(\"--\");\nconst startsAsVariableToken = \n/*@__PURE__*/ checkStringStartsWith(\"var(--\");\nconst isCSSVariableToken = (value) => {\n const startsWithToken = startsAsVariableToken(value);\n if (!startsWithToken)\n return false;\n // Ensure any comments are stripped from the value as this can harm performance of the regex.\n return singleCssVariableRegex.test(value.split(\"/*\")[0].trim());\n};\nconst singleCssVariableRegex = /var\\(--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)$/iu;\n/**\n * Check if a value contains a CSS variable anywhere (e.g. inside calc()).\n * Unlike isCSSVariableToken which checks if the value IS a var() token,\n * this checks if the value CONTAINS var() somewhere in the string.\n */\nfunction containsCSSVariable(value) {\n if (typeof value !== \"string\")\n return false;\n // Strip comments to avoid false positives\n return value.split(\"/*\")[0].includes(\"var(--\");\n}\n\nexport { containsCSSVariable, isCSSVariableName, isCSSVariableToken };\n//# sourceMappingURL=is-css-variable.mjs.map\n","import { clamp } from 'motion-utils';\n\nconst number = {\n test: (v) => typeof v === \"number\",\n parse: parseFloat,\n transform: (v) => v,\n};\nconst alpha = {\n ...number,\n transform: (v) => clamp(0, 1, v),\n};\nconst scale = {\n ...number,\n default: 1,\n};\n\nexport { alpha, number, scale };\n//# sourceMappingURL=index.mjs.map\n","// If this number is a decimal, make it just five decimal places\n// to avoid exponents\nconst sanitize = (v) => Math.round(v * 100000) / 100000;\n\nexport { sanitize };\n//# sourceMappingURL=sanitize.mjs.map\n","const floatRegex = /-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/gu;\n\nexport { floatRegex };\n//# sourceMappingURL=float-regex.mjs.map\n","function isNullish(v) {\n return v == null;\n}\n\nexport { isNullish };\n//# sourceMappingURL=is-nullish.mjs.map\n","const singleColorRegex = /^(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))$/iu;\n\nexport { singleColorRegex };\n//# sourceMappingURL=single-color-regex.mjs.map\n","import { floatRegex } from '../utils/float-regex.mjs';\nimport { isNullish } from '../utils/is-nullish.mjs';\nimport { singleColorRegex } from '../utils/single-color-regex.mjs';\n\n/**\n * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,\n * but false if a number or multiple colors\n */\nconst isColorString = (type, testProp) => (v) => {\n return Boolean((typeof v === \"string\" &&\n singleColorRegex.test(v) &&\n v.startsWith(type)) ||\n (testProp &&\n !isNullish(v) &&\n Object.prototype.hasOwnProperty.call(v, testProp)));\n};\nconst splitColor = (aName, bName, cName) => (v) => {\n if (typeof v !== \"string\")\n return v;\n const [a, b, c, alpha] = v.match(floatRegex);\n return {\n [aName]: parseFloat(a),\n [bName]: parseFloat(b),\n [cName]: parseFloat(c),\n alpha: alpha !== undefined ? parseFloat(alpha) : 1,\n };\n};\n\nexport { isColorString, splitColor };\n//# sourceMappingURL=utils.mjs.map\n","import { clamp } from 'motion-utils';\nimport { number, alpha } from '../numbers/index.mjs';\nimport { sanitize } from '../utils/sanitize.mjs';\nimport { splitColor, isColorString } from './utils.mjs';\n\nconst clampRgbUnit = (v) => clamp(0, 255, v);\nconst rgbUnit = {\n ...number,\n transform: (v) => Math.round(clampRgbUnit(v)),\n};\nconst rgba = {\n test: /*@__PURE__*/ isColorString(\"rgb\", \"red\"),\n parse: /*@__PURE__*/ splitColor(\"red\", \"green\", \"blue\"),\n transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => \"rgba(\" +\n rgbUnit.transform(red) +\n \", \" +\n rgbUnit.transform(green) +\n \", \" +\n rgbUnit.transform(blue) +\n \", \" +\n sanitize(alpha.transform(alpha$1)) +\n \")\",\n};\n\nexport { rgbUnit, rgba };\n//# sourceMappingURL=rgba.mjs.map\n","import { rgba } from './rgba.mjs';\nimport { isColorString } from './utils.mjs';\n\nfunction parseHex(v) {\n let r = \"\";\n let g = \"\";\n let b = \"\";\n let a = \"\";\n // If we have 6 characters, ie #FF0000\n if (v.length > 5) {\n r = v.substring(1, 3);\n g = v.substring(3, 5);\n b = v.substring(5, 7);\n a = v.substring(7, 9);\n // Or we have 3 characters, ie #F00\n }\n else {\n r = v.substring(1, 2);\n g = v.substring(2, 3);\n b = v.substring(3, 4);\n a = v.substring(4, 5);\n r += r;\n g += g;\n b += b;\n a += a;\n }\n return {\n red: parseInt(r, 16),\n green: parseInt(g, 16),\n blue: parseInt(b, 16),\n alpha: a ? parseInt(a, 16) / 255 : 1,\n };\n}\nconst hex = {\n test: /*@__PURE__*/ isColorString(\"#\"),\n parse: parseHex,\n transform: rgba.transform,\n};\n\nexport { hex };\n//# sourceMappingURL=hex.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nconst createUnitType = (unit) => ({\n test: (v) => typeof v === \"string\" && v.endsWith(unit) && v.split(\" \").length === 1,\n parse: parseFloat,\n transform: (v) => `${v}${unit}`,\n});\nconst degrees = /*@__PURE__*/ createUnitType(\"deg\");\nconst percent = /*@__PURE__*/ createUnitType(\"%\");\nconst px = /*@__PURE__*/ createUnitType(\"px\");\nconst vh = /*@__PURE__*/ createUnitType(\"vh\");\nconst vw = /*@__PURE__*/ createUnitType(\"vw\");\nconst progressPercentage = /*@__PURE__*/ (() => ({\n ...percent,\n parse: (v) => percent.parse(v) / 100,\n transform: (v) => percent.transform(v * 100),\n}))();\n\nexport { degrees, percent, progressPercentage, px, vh, vw };\n//# sourceMappingURL=units.mjs.map\n","import { alpha } from '../numbers/index.mjs';\nimport { percent } from '../numbers/units.mjs';\nimport { sanitize } from '../utils/sanitize.mjs';\nimport { splitColor, isColorString } from './utils.mjs';\n\nconst hsla = {\n test: /*@__PURE__*/ isColorString(\"hsl\", \"hue\"),\n parse: /*@__PURE__*/ splitColor(\"hue\", \"saturation\", \"lightness\"),\n transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {\n return (\"hsla(\" +\n Math.round(hue) +\n \", \" +\n percent.transform(sanitize(saturation)) +\n \", \" +\n percent.transform(sanitize(lightness)) +\n \", \" +\n sanitize(alpha.transform(alpha$1)) +\n \")\");\n },\n};\n\nexport { hsla };\n//# sourceMappingURL=hsla.mjs.map\n","import { hex } from './hex.mjs';\nimport { hsla } from './hsla.mjs';\nimport { rgba } from './rgba.mjs';\n\nconst color = {\n test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),\n parse: (v) => {\n if (rgba.test(v)) {\n return rgba.parse(v);\n }\n else if (hsla.test(v)) {\n return hsla.parse(v);\n }\n else {\n return hex.parse(v);\n }\n },\n transform: (v) => {\n return typeof v === \"string\"\n ? v\n : v.hasOwnProperty(\"red\")\n ? rgba.transform(v)\n : hsla.transform(v);\n },\n getAnimatableNone: (v) => {\n const parsed = color.parse(v);\n parsed.alpha = 0;\n return color.transform(parsed);\n },\n};\n\nexport { color };\n//# sourceMappingURL=index.mjs.map\n","const colorRegex = /(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))/giu;\n\nexport { colorRegex };\n//# sourceMappingURL=color-regex.mjs.map\n","import { color } from '../color/index.mjs';\nimport { colorRegex } from '../utils/color-regex.mjs';\nimport { floatRegex } from '../utils/float-regex.mjs';\nimport { sanitize } from '../utils/sanitize.mjs';\n\nfunction test(v) {\n return (isNaN(v) &&\n typeof v === \"string\" &&\n (v.match(floatRegex)?.length || 0) +\n (v.match(colorRegex)?.length || 0) >\n 0);\n}\nconst NUMBER_TOKEN = \"number\";\nconst COLOR_TOKEN = \"color\";\nconst VAR_TOKEN = \"var\";\nconst VAR_FUNCTION_TOKEN = \"var(\";\nconst SPLIT_TOKEN = \"${}\";\n// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`\nconst complexRegex = /var\\s*\\(\\s*--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)|#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\)|-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/giu;\nfunction analyseComplexValue(value) {\n const originalValue = value.toString();\n const values = [];\n const indexes = {\n color: [],\n number: [],\n var: [],\n };\n const types = [];\n let i = 0;\n const tokenised = originalValue.replace(complexRegex, (parsedValue) => {\n if (color.test(parsedValue)) {\n indexes.color.push(i);\n types.push(COLOR_TOKEN);\n values.push(color.parse(parsedValue));\n }\n else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {\n indexes.var.push(i);\n types.push(VAR_TOKEN);\n values.push(parsedValue);\n }\n else {\n indexes.number.push(i);\n types.push(NUMBER_TOKEN);\n values.push(parseFloat(parsedValue));\n }\n ++i;\n return SPLIT_TOKEN;\n });\n const split = tokenised.split(SPLIT_TOKEN);\n return { values, split, indexes, types };\n}\nfunction parseComplexValue(v) {\n return analyseComplexValue(v).values;\n}\nfunction buildTransformer({ split, types }) {\n const numSections = split.length;\n return (v) => {\n let output = \"\";\n for (let i = 0; i < numSections; i++) {\n output += split[i];\n if (v[i] !== undefined) {\n const type = types[i];\n if (type === NUMBER_TOKEN) {\n output += sanitize(v[i]);\n }\n else if (type === COLOR_TOKEN) {\n output += color.transform(v[i]);\n }\n else {\n output += v[i];\n }\n }\n }\n return output;\n };\n}\nfunction createTransformer(source) {\n return buildTransformer(analyseComplexValue(source));\n}\nconst convertNumbersToZero = (v) => typeof v === \"number\" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v;\n/**\n * Convert a parsed value to its zero equivalent, but preserve numbers\n * that act as divisors in CSS calc() expressions.\n *\n * analyseComplexValue extracts numbers from CSS strings and puts the\n * surrounding text into a `split` template array. For example:\n * \"calc(var(--gap) / 5)\" → values: [var(--gap), 5]\n * split: [\"calc(\", \" / \", \")\"]\n *\n * When building a zero-equivalent for animation, naively zeroing all\n * numbers turns the divisor into 0 → \"calc(var(--gap) / 0)\" → NaN.\n * We detect this by checking whether the text preceding a number\n * (split[i]) ends with \"/\" — the CSS calc division operator.\n */\nconst convertToZero = (value, splitBefore) => {\n if (typeof value === \"number\") {\n return splitBefore?.trim().endsWith(\"/\") ? value : 0;\n }\n return convertNumbersToZero(value);\n};\nfunction getAnimatableNone(v) {\n const info = analyseComplexValue(v);\n const transformer = buildTransformer(info);\n return transformer(info.values.map((value, i) => convertToZero(value, info.split[i])));\n}\nconst complex = {\n test,\n parse: parseComplexValue,\n createTransformer,\n getAnimatableNone,\n};\n\nexport { analyseComplexValue, complex };\n//# sourceMappingURL=index.mjs.map\n","// Adapted from https://gist.github.com/mjackson/5311256\nfunction hueToRgb(p, q, t) {\n if (t < 0)\n t += 1;\n if (t > 1)\n t -= 1;\n if (t < 1 / 6)\n return p + (q - p) * 6 * t;\n if (t < 1 / 2)\n return q;\n if (t < 2 / 3)\n return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\nfunction hslaToRgba({ hue, saturation, lightness, alpha }) {\n hue /= 360;\n saturation /= 100;\n lightness /= 100;\n let red = 0;\n let green = 0;\n let blue = 0;\n if (!saturation) {\n red = green = blue = lightness;\n }\n else {\n const q = lightness < 0.5\n ? lightness * (1 + saturation)\n : lightness + saturation - lightness * saturation;\n const p = 2 * lightness - q;\n red = hueToRgb(p, q, hue + 1 / 3);\n green = hueToRgb(p, q, hue);\n blue = hueToRgb(p, q, hue - 1 / 3);\n }\n return {\n red: Math.round(red * 255),\n green: Math.round(green * 255),\n blue: Math.round(blue * 255),\n alpha,\n };\n}\n\nexport { hslaToRgba };\n//# sourceMappingURL=hsla-to-rgba.mjs.map\n","function mixImmediate(a, b) {\n return (p) => (p > 0 ? b : a);\n}\n\nexport { mixImmediate };\n//# sourceMappingURL=immediate.mjs.map\n","/*\n Value in range from progress\n\n Given a lower limit and an upper limit, we return the value within\n that range as expressed by progress (usually a number from 0 to 1)\n\n So progress = 0.5 would change\n\n from -------- to\n\n to\n\n from ---- to\n\n E.g. from = 10, to = 20, progress = 0.5 => 15\n\n @param [number]: Lower limit of range\n @param [number]: Upper limit of range\n @param [number]: The progress between lower and upper limits expressed 0-1\n @return [number]: Value as calculated from progress within range (not limited within range)\n*/\nconst mixNumber = (from, to, progress) => {\n return from + (to - from) * progress;\n};\n\nexport { mixNumber };\n//# sourceMappingURL=number.mjs.map\n","import { warning } from 'motion-utils';\nimport { hex } from '../../value/types/color/hex.mjs';\nimport { hsla } from '../../value/types/color/hsla.mjs';\nimport { hslaToRgba } from '../../value/types/color/hsla-to-rgba.mjs';\nimport { rgba } from '../../value/types/color/rgba.mjs';\nimport { mixImmediate } from './immediate.mjs';\nimport { mixNumber } from './number.mjs';\n\n// Linear color space blending\n// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw\n// Demonstrated http://codepen.io/osublake/pen/xGVVaN\nconst mixLinearColor = (from, to, v) => {\n const fromExpo = from * from;\n const expo = v * (to * to - fromExpo) + fromExpo;\n return expo < 0 ? 0 : Math.sqrt(expo);\n};\nconst colorTypes = [hex, rgba, hsla];\nconst getColorType = (v) => colorTypes.find((type) => type.test(v));\nfunction asRGBA(color) {\n const type = getColorType(color);\n warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`, \"color-not-animatable\");\n if (!Boolean(type))\n return false;\n let model = type.parse(color);\n if (type === hsla) {\n // TODO Remove this cast - needed since Motion's stricter typing\n model = hslaToRgba(model);\n }\n return model;\n}\nconst mixColor = (from, to) => {\n const fromRGBA = asRGBA(from);\n const toRGBA = asRGBA(to);\n if (!fromRGBA || !toRGBA) {\n return mixImmediate(from, to);\n }\n const blended = { ...fromRGBA };\n return (v) => {\n blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);\n blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);\n blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);\n blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v);\n return rgba.transform(blended);\n };\n};\n\nexport { mixColor, mixLinearColor };\n//# sourceMappingURL=color.mjs.map\n","const invisibleValues = new Set([\"none\", \"hidden\"]);\n/**\n * Returns a function that, when provided a progress value between 0 and 1,\n * will return the \"none\" or \"hidden\" string only when the progress is that of\n * the origin or target.\n */\nfunction mixVisibility(origin, target) {\n if (invisibleValues.has(origin)) {\n return (p) => (p <= 0 ? origin : target);\n }\n else {\n return (p) => (p >= 1 ? target : origin);\n }\n}\n\nexport { invisibleValues, mixVisibility };\n//# sourceMappingURL=visibility.mjs.map\n","import { pipe, warning } from 'motion-utils';\nimport { isCSSVariableToken } from '../../animation/utils/is-css-variable.mjs';\nimport { color } from '../../value/types/color/index.mjs';\nimport { complex, analyseComplexValue } from '../../value/types/complex/index.mjs';\nimport { mixColor } from './color.mjs';\nimport { mixImmediate } from './immediate.mjs';\nimport { mixNumber as mixNumber$1 } from './number.mjs';\nimport { invisibleValues, mixVisibility } from './visibility.mjs';\n\nfunction mixNumber(a, b) {\n return (p) => mixNumber$1(a, b, p);\n}\nfunction getMixer(a) {\n if (typeof a === \"number\") {\n return mixNumber;\n }\n else if (typeof a === \"string\") {\n return isCSSVariableToken(a)\n ? mixImmediate\n : color.test(a)\n ? mixColor\n : mixComplex;\n }\n else if (Array.isArray(a)) {\n return mixArray;\n }\n else if (typeof a === \"object\") {\n return color.test(a) ? mixColor : mixObject;\n }\n return mixImmediate;\n}\nfunction mixArray(a, b) {\n const output = [...a];\n const numValues = output.length;\n const blendValue = a.map((v, i) => getMixer(v)(v, b[i]));\n return (p) => {\n for (let i = 0; i < numValues; i++) {\n output[i] = blendValue[i](p);\n }\n return output;\n };\n}\nfunction mixObject(a, b) {\n const output = { ...a, ...b };\n const blendValue = {};\n for (const key in output) {\n if (a[key] !== undefined && b[key] !== undefined) {\n blendValue[key] = getMixer(a[key])(a[key], b[key]);\n }\n }\n return (v) => {\n for (const key in blendValue) {\n output[key] = blendValue[key](v);\n }\n return output;\n };\n}\nfunction matchOrder(origin, target) {\n const orderedOrigin = [];\n const pointers = { color: 0, var: 0, number: 0 };\n for (let i = 0; i < target.values.length; i++) {\n const type = target.types[i];\n const originIndex = origin.indexes[type][pointers[type]];\n const originValue = origin.values[originIndex] ?? 0;\n orderedOrigin[i] = originValue;\n pointers[type]++;\n }\n return orderedOrigin;\n}\nconst mixComplex = (origin, target) => {\n const template = complex.createTransformer(target);\n const originStats = analyseComplexValue(origin);\n const targetStats = analyseComplexValue(target);\n const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length &&\n originStats.indexes.color.length === targetStats.indexes.color.length &&\n originStats.indexes.number.length >= targetStats.indexes.number.length;\n if (canInterpolate) {\n if ((invisibleValues.has(origin) &&\n !targetStats.values.length) ||\n (invisibleValues.has(target) &&\n !originStats.values.length)) {\n return mixVisibility(origin, target);\n }\n return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);\n }\n else {\n warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, \"complex-values-different\");\n return mixImmediate(origin, target);\n }\n};\n\nexport { getMixer, mixArray, mixComplex, mixObject };\n//# sourceMappingURL=complex.mjs.map\n","import { getMixer } from './complex.mjs';\nimport { mixNumber } from './number.mjs';\n\nfunction mix(from, to, p) {\n if (typeof from === \"number\" &&\n typeof to === \"number\" &&\n typeof p === \"number\") {\n return mixNumber(from, to, p);\n }\n const mixer = getMixer(from);\n return mixer(from, to);\n}\n\nexport { mix };\n//# sourceMappingURL=index.mjs.map\n","import { time } from '../../frameloop/sync-time.mjs';\nimport { frameData, cancelFrame, frame } from '../../frameloop/frame.mjs';\n\nconst frameloopDriver = (update) => {\n const passTimestamp = ({ timestamp }) => update(timestamp);\n return {\n start: (keepAlive = true) => frame.update(passTimestamp, keepAlive),\n stop: () => cancelFrame(passTimestamp),\n /**\n * If we're processing this frame we can use the\n * framelocked timestamp to keep things in sync.\n */\n now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),\n };\n};\n\nexport { frameloopDriver };\n//# sourceMappingURL=frame.mjs.map\n","const generateLinearEasing = (easing, duration, // as milliseconds\nresolution = 10 // as milliseconds\n) => {\n let points = \"\";\n const numPoints = Math.max(Math.round(duration / resolution), 2);\n for (let i = 0; i < numPoints; i++) {\n points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + \", \";\n }\n return `linear(${points.substring(0, points.length - 2)})`;\n};\n\nexport { generateLinearEasing };\n//# sourceMappingURL=linear.mjs.map\n","/**\n * Implement a practical max duration for keyframe generation\n * to prevent infinite loops\n */\nconst maxGeneratorDuration = 20000;\nfunction calcGeneratorDuration(generator) {\n let duration = 0;\n const timeStep = 50;\n let state = generator.next(duration);\n while (!state.done && duration < maxGeneratorDuration) {\n duration += timeStep;\n state = generator.next(duration);\n }\n return duration >= maxGeneratorDuration ? Infinity : duration;\n}\n\nexport { calcGeneratorDuration, maxGeneratorDuration };\n//# sourceMappingURL=calc-duration.mjs.map\n","import { millisecondsToSeconds } from 'motion-utils';\nimport { calcGeneratorDuration, maxGeneratorDuration } from './calc-duration.mjs';\n\n/**\n * Create a progress => progress easing function from a generator.\n */\nfunction createGeneratorEasing(options, scale = 100, createGenerator) {\n const generator = createGenerator({ ...options, keyframes: [0, scale] });\n const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);\n return {\n type: \"keyframes\",\n ease: (progress) => {\n return generator.next(duration * progress).value / scale;\n },\n duration: millisecondsToSeconds(duration),\n };\n}\n\nexport { createGeneratorEasing };\n//# sourceMappingURL=create-generator-easing.mjs.map\n","import { millisecondsToSeconds, clamp, secondsToMilliseconds, warning } from 'motion-utils';\nimport { generateLinearEasing } from '../waapi/utils/linear.mjs';\nimport { calcGeneratorDuration, maxGeneratorDuration } from './utils/calc-duration.mjs';\nimport { createGeneratorEasing } from './utils/create-generator-easing.mjs';\n\nconst springDefaults = {\n // Default spring physics\n stiffness: 100,\n damping: 10,\n mass: 1.0,\n velocity: 0.0,\n // Default duration/bounce-based options\n duration: 800, // in ms\n bounce: 0.3,\n visualDuration: 0.3, // in seconds\n // Rest thresholds\n restSpeed: {\n granular: 0.01,\n default: 2,\n },\n restDelta: {\n granular: 0.005,\n default: 0.5,\n },\n // Limits\n minDuration: 0.01, // in seconds\n maxDuration: 10.0, // in seconds\n minDamping: 0.05,\n maxDamping: 1,\n};\nfunction calcAngularFreq(undampedFreq, dampingRatio) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);\n}\nconst rootIterations = 12;\nfunction approximateRoot(envelope, derivative, initialGuess) {\n let result = initialGuess;\n for (let i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result);\n }\n return result;\n}\n/**\n * This is ported from the Framer implementation of duration-based spring resolution.\n */\nconst safeMin = 0.001;\nfunction findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {\n let envelope;\n let derivative;\n warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), \"Spring duration must be 10 seconds or less\", \"spring-duration-limit\");\n let dampingRatio = 1 - bounce;\n /**\n * Restrict dampingRatio and duration to within acceptable ranges.\n */\n dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);\n duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration));\n if (dampingRatio < 1) {\n /**\n * Underdamped spring\n */\n envelope = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const a = exponentialDecay - velocity;\n const b = calcAngularFreq(undampedFreq, dampingRatio);\n const c = Math.exp(-delta);\n return safeMin - (a / b) * c;\n };\n derivative = (undampedFreq) => {\n const exponentialDecay = undampedFreq * dampingRatio;\n const delta = exponentialDecay * duration;\n const d = delta * velocity + velocity;\n const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;\n const f = Math.exp(-delta);\n const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);\n const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;\n return (factor * ((d - e) * f)) / g;\n };\n }\n else {\n /**\n * Critically-damped spring\n */\n envelope = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = (undampedFreq - velocity) * duration + 1;\n return -safeMin + a * b;\n };\n derivative = (undampedFreq) => {\n const a = Math.exp(-undampedFreq * duration);\n const b = (velocity - undampedFreq) * (duration * duration);\n return a * b;\n };\n }\n const initialGuess = 5 / duration;\n const undampedFreq = approximateRoot(envelope, derivative, initialGuess);\n duration = secondsToMilliseconds(duration);\n if (isNaN(undampedFreq)) {\n return {\n stiffness: springDefaults.stiffness,\n damping: springDefaults.damping,\n duration,\n };\n }\n else {\n const stiffness = Math.pow(undampedFreq, 2) * mass;\n return {\n stiffness,\n damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),\n duration,\n };\n }\n}\nconst durationKeys = [\"duration\", \"bounce\"];\nconst physicsKeys = [\"stiffness\", \"damping\", \"mass\"];\nfunction isSpringType(options, keys) {\n return keys.some((key) => options[key] !== undefined);\n}\nfunction getSpringOptions(options) {\n let springOptions = {\n velocity: springDefaults.velocity,\n stiffness: springDefaults.stiffness,\n damping: springDefaults.damping,\n mass: springDefaults.mass,\n isResolvedFromDuration: false,\n ...options,\n };\n // stiffness/damping/mass overrides duration/bounce\n if (!isSpringType(options, physicsKeys) &&\n isSpringType(options, durationKeys)) {\n // Time-defined springs should ignore inherited velocity.\n // Velocity from interrupted animations can cause findSpring()\n // to compute wildly different spring parameters, leading to\n // massive oscillation on small-range animations.\n springOptions.velocity = 0;\n if (options.visualDuration) {\n const visualDuration = options.visualDuration;\n const root = (2 * Math.PI) / (visualDuration * 1.2);\n const stiffness = root * root;\n const damping = 2 *\n clamp(0.05, 1, 1 - (options.bounce || 0)) *\n Math.sqrt(stiffness);\n springOptions = {\n ...springOptions,\n mass: springDefaults.mass,\n stiffness,\n damping,\n };\n }\n else {\n const derived = findSpring({ ...options, velocity: 0 });\n springOptions = {\n ...springOptions,\n ...derived,\n mass: springDefaults.mass,\n };\n springOptions.isResolvedFromDuration = true;\n }\n }\n return springOptions;\n}\nfunction spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {\n const options = typeof optionsOrVisualDuration !== \"object\"\n ? {\n visualDuration: optionsOrVisualDuration,\n keyframes: [0, 1],\n bounce,\n }\n : optionsOrVisualDuration;\n let { restSpeed, restDelta } = options;\n const origin = options.keyframes[0];\n const target = options.keyframes[options.keyframes.length - 1];\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = { done: false, value: origin };\n const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({\n ...options,\n velocity: -millisecondsToSeconds(options.velocity || 0),\n });\n const initialVelocity = velocity || 0.0;\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n const initialDelta = target - origin;\n const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));\n /**\n * If we're working on a granular scale, use smaller defaults for determining\n * when the spring is finished.\n *\n * These defaults have been selected emprically based on what strikes a good\n * ratio between feeling good and finishing as soon as changes are imperceptible.\n */\n const isGranularScale = Math.abs(initialDelta) < 5;\n restSpeed || (restSpeed = isGranularScale\n ? springDefaults.restSpeed.granular\n : springDefaults.restSpeed.default);\n restDelta || (restDelta = isGranularScale\n ? springDefaults.restDelta.granular\n : springDefaults.restDelta.default);\n let resolveSpring;\n let resolveVelocity;\n // Underdamped coefficients, hoisted for use in the inlined next() hot path\n let angularFreq;\n let A;\n let sinCoeff;\n let cosCoeff;\n if (dampingRatio < 1) {\n angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);\n A =\n (initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n angularFreq;\n // Underdamped spring\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (target -\n envelope *\n (A * Math.sin(angularFreq * t) +\n initialDelta * Math.cos(angularFreq * t)));\n };\n // Analytical derivative of underdamped spring (px/ms)\n sinCoeff =\n dampingRatio * undampedAngularFreq * A + initialDelta * angularFreq;\n cosCoeff =\n dampingRatio * undampedAngularFreq * initialDelta - A * angularFreq;\n resolveVelocity = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return envelope *\n (sinCoeff * Math.sin(angularFreq * t) +\n cosCoeff * Math.cos(angularFreq * t));\n };\n }\n else if (dampingRatio === 1) {\n // Critically damped spring\n resolveSpring = (t) => target -\n Math.exp(-undampedAngularFreq * t) *\n (initialDelta +\n (initialVelocity + undampedAngularFreq * initialDelta) * t);\n // Analytical derivative of critically damped spring (px/ms)\n const C = initialVelocity + undampedAngularFreq * initialDelta;\n resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) *\n (undampedAngularFreq * C * t - initialVelocity);\n }\n else {\n // Overdamped spring\n const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n // When performing sinh or cosh values can hit Infinity so we cap them here\n const freqForT = Math.min(dampedAngularFreq * t, 300);\n return (target -\n (envelope *\n ((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) *\n Math.sinh(freqForT) +\n dampedAngularFreq *\n initialDelta *\n Math.cosh(freqForT))) /\n dampedAngularFreq);\n };\n // Analytical derivative of overdamped spring (px/ms)\n const P = (initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n dampedAngularFreq;\n const sinhCoeff = dampingRatio * undampedAngularFreq * P - initialDelta * dampedAngularFreq;\n const coshCoeff = dampingRatio * undampedAngularFreq * initialDelta - P * dampedAngularFreq;\n resolveVelocity = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n const freqForT = Math.min(dampedAngularFreq * t, 300);\n return envelope *\n (sinhCoeff * Math.sinh(freqForT) +\n coshCoeff * Math.cosh(freqForT));\n };\n }\n const generator = {\n calculatedDuration: isResolvedFromDuration ? duration || null : null,\n velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),\n next: (t) => {\n /**\n * For underdamped physics springs we need both position and\n * velocity each tick. Compute shared trig values once to avoid\n * duplicate Math.exp/sin/cos calls on the hot path.\n */\n if (!isResolvedFromDuration && dampingRatio < 1) {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n const sin = Math.sin(angularFreq * t);\n const cos = Math.cos(angularFreq * t);\n const current = target -\n envelope *\n (A * sin + initialDelta * cos);\n const currentVelocity = secondsToMilliseconds(envelope *\n (sinCoeff * sin + cosCoeff * cos));\n state.done =\n Math.abs(currentVelocity) <= restSpeed &&\n Math.abs(target - current) <= restDelta;\n state.value = state.done ? target : current;\n return state;\n }\n const current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n const currentVelocity = secondsToMilliseconds(resolveVelocity(t));\n state.done =\n Math.abs(currentVelocity) <= restSpeed &&\n Math.abs(target - current) <= restDelta;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? target : current;\n return state;\n },\n toString: () => {\n const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);\n const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);\n return calculatedDuration + \"ms \" + easing;\n },\n toTransition: () => { },\n };\n return generator;\n}\nspring.applyToOptions = (options) => {\n const generatorOptions = createGeneratorEasing(options, 100, spring);\n options.ease = generatorOptions.ease;\n options.duration = secondsToMilliseconds(generatorOptions.duration);\n options.type = \"keyframes\";\n return options;\n};\n\nexport { spring };\n//# sourceMappingURL=spring.mjs.map\n","import { velocityPerSecond } from 'motion-utils';\n\nconst velocitySampleDuration = 5; // ms\nfunction getGeneratorVelocity(resolveValue, t, current) {\n const prevT = Math.max(t - velocitySampleDuration, 0);\n return velocityPerSecond(current - resolveValue(prevT), t - prevT);\n}\n\nexport { getGeneratorVelocity };\n//# sourceMappingURL=velocity.mjs.map\n","import { spring } from './spring.mjs';\nimport { getGeneratorVelocity } from './utils/velocity.mjs';\n\nfunction inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {\n const origin = keyframes[0];\n const state = {\n done: false,\n value: origin,\n };\n const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max);\n const nearestBoundary = (v) => {\n if (min === undefined)\n return max;\n if (max === undefined)\n return min;\n return Math.abs(min - v) < Math.abs(max - v) ? min : max;\n };\n let amplitude = power * velocity;\n const ideal = origin + amplitude;\n const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);\n /**\n * If the target has changed we need to re-calculate the amplitude, otherwise\n * the animation will start from the wrong position.\n */\n if (target !== ideal)\n amplitude = target - origin;\n const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);\n const calcLatest = (t) => target + calcDelta(t);\n const applyFriction = (t) => {\n const delta = calcDelta(t);\n const latest = calcLatest(t);\n state.done = Math.abs(delta) <= restDelta;\n state.value = state.done ? target : latest;\n };\n /**\n * Ideally this would resolve for t in a stateless way, we could\n * do that by always precalculating the animation but as we know\n * this will be done anyway we can assume that spring will\n * be discovered during that.\n */\n let timeReachedBoundary;\n let spring$1;\n const checkCatchBoundary = (t) => {\n if (!isOutOfBounds(state.value))\n return;\n timeReachedBoundary = t;\n spring$1 = spring({\n keyframes: [state.value, nearestBoundary(state.value)],\n velocity: getGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000\n damping: bounceDamping,\n stiffness: bounceStiffness,\n restDelta,\n restSpeed,\n });\n };\n checkCatchBoundary(0);\n return {\n calculatedDuration: null,\n next: (t) => {\n /**\n * We need to resolve the friction to figure out if we need a\n * spring but we don't want to do this twice per frame. So here\n * we flag if we updated for this frame and later if we did\n * we can skip doing it again.\n */\n let hasUpdatedFrame = false;\n if (!spring$1 && timeReachedBoundary === undefined) {\n hasUpdatedFrame = true;\n applyFriction(t);\n checkCatchBoundary(t);\n }\n /**\n * If we have a spring and the provided t is beyond the moment the friction\n * animation crossed the min/max boundary, use the spring.\n */\n if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) {\n return spring$1.next(t - timeReachedBoundary);\n }\n else {\n !hasUpdatedFrame && applyFriction(t);\n return state;\n }\n },\n };\n}\n\nexport { inertia };\n//# sourceMappingURL=inertia.mjs.map\n","import { invariant, clamp, MotionGlobalConfig, noop, pipe, progress } from 'motion-utils';\nimport { mix } from './mix/index.mjs';\n\nfunction createMixers(output, ease, customMixer) {\n const mixers = [];\n const mixerFactory = customMixer || MotionGlobalConfig.mix || mix;\n const numMixers = output.length - 1;\n for (let i = 0; i < numMixers; i++) {\n let mixer = mixerFactory(output[i], output[i + 1]);\n if (ease) {\n const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease;\n mixer = pipe(easingFunction, mixer);\n }\n mixers.push(mixer);\n }\n return mixers;\n}\n/**\n * Create a function that maps from a numerical input array to a generic output array.\n *\n * Accepts:\n * - Numbers\n * - Colors (hex, hsl, hsla, rgb, rgba)\n * - Complex (combinations of one or more numbers or strings)\n *\n * ```jsx\n * const mixColor = interpolate([0, 1], ['#fff', '#000'])\n *\n * mixColor(0.5) // 'rgba(128, 128, 128, 1)'\n * ```\n *\n * TODO Revisit this approach once we've moved to data models for values,\n * probably not needed to pregenerate mixer functions.\n *\n * @public\n */\nfunction interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {\n const inputLength = input.length;\n invariant(inputLength === output.length, \"Both input and output ranges must be the same length\", \"range-length\");\n /**\n * If we're only provided a single input, we can just make a function\n * that returns the output.\n */\n if (inputLength === 1)\n return () => output[0];\n if (inputLength === 2 && output[0] === output[1])\n return () => output[1];\n const isZeroDeltaRange = input[0] === input[1];\n // If input runs highest -> lowest, reverse both arrays\n if (input[0] > input[inputLength - 1]) {\n input = [...input].reverse();\n output = [...output].reverse();\n }\n const mixers = createMixers(output, ease, mixer);\n const numMixers = mixers.length;\n const interpolator = (v) => {\n if (isZeroDeltaRange && v < input[0])\n return output[0];\n let i = 0;\n if (numMixers > 1) {\n for (; i < input.length - 2; i++) {\n if (v < input[i + 1])\n break;\n }\n }\n const progressInRange = progress(input[i], input[i + 1], v);\n return mixers[i](progressInRange);\n };\n return isClamp\n ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v))\n : interpolator;\n}\n\nexport { interpolate };\n//# sourceMappingURL=interpolate.mjs.map\n","import { progress } from 'motion-utils';\nimport { mixNumber } from '../../../utils/mix/number.mjs';\n\nfunction fillOffset(offset, remaining) {\n const min = offset[offset.length - 1];\n for (let i = 1; i <= remaining; i++) {\n const offsetProgress = progress(0, remaining, i);\n offset.push(mixNumber(min, 1, offsetProgress));\n }\n}\n\nexport { fillOffset };\n//# sourceMappingURL=fill.mjs.map\n","import { fillOffset } from './fill.mjs';\n\nfunction defaultOffset(arr) {\n const offset = [0];\n fillOffset(offset, arr.length - 1);\n return offset;\n}\n\nexport { defaultOffset };\n//# sourceMappingURL=default.mjs.map\n","function convertOffsetToTimes(offset, duration) {\n return offset.map((o) => o * duration);\n}\n\nexport { convertOffsetToTimes };\n//# sourceMappingURL=time.mjs.map\n","import { easeInOut, isEasingArray, easingDefinitionToFunction } from 'motion-utils';\nimport { interpolate } from '../../utils/interpolate.mjs';\nimport { defaultOffset } from '../keyframes/offsets/default.mjs';\nimport { convertOffsetToTimes } from '../keyframes/offsets/time.mjs';\n\nfunction defaultEasing(values, easing) {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1);\n}\nfunction keyframes({ duration = 300, keyframes: keyframeValues, times, ease = \"easeInOut\", }) {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease);\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state = {\n done: false,\n value: keyframeValues[0],\n };\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length\n ? times\n : defaultOffset(keyframeValues), duration);\n const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions)\n ? easingFunctions\n : defaultEasing(keyframeValues, easingFunctions),\n });\n return {\n calculatedDuration: duration,\n next: (t) => {\n state.value = mapTimeToKeyframe(t);\n state.done = t >= duration;\n return state;\n },\n };\n}\n\nexport { defaultEasing, keyframes };\n//# sourceMappingURL=keyframes.mjs.map\n","const isNotNull = (value) => value !== null;\nfunction getFinalKeyframe(keyframes, { repeat, repeatType = \"loop\" }, finalKeyframe, speed = 1) {\n const resolvedKeyframes = keyframes.filter(isNotNull);\n const useFirstKeyframe = speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1);\n const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1;\n return !index || finalKeyframe === undefined\n ? resolvedKeyframes[index]\n : finalKeyframe;\n}\n\nexport { getFinalKeyframe };\n//# sourceMappingURL=get-final.mjs.map\n","import { inertia } from '../generators/inertia.mjs';\nimport { keyframes } from '../generators/keyframes.mjs';\nimport { spring } from '../generators/spring.mjs';\n\nconst transitionTypeMap = {\n decay: inertia,\n inertia,\n tween: keyframes,\n keyframes: keyframes,\n spring,\n};\nfunction replaceTransitionType(transition) {\n if (typeof transition.type === \"string\") {\n transition.type = transitionTypeMap[transition.type];\n }\n}\n\nexport { replaceTransitionType };\n//# sourceMappingURL=replace-transition-type.mjs.map\n","class WithPromise {\n constructor() {\n this.updateFinished();\n }\n get finished() {\n return this._finished;\n }\n updateFinished() {\n this._finished = new Promise((resolve) => {\n this.resolve = resolve;\n });\n }\n notifyFinished() {\n this.resolve();\n }\n /**\n * Allows the animation to be awaited.\n *\n * @deprecated Use `finished` instead.\n */\n then(onResolve, onReject) {\n return this.finished.then(onResolve, onReject);\n }\n}\n\nexport { WithPromise };\n//# sourceMappingURL=WithPromise.mjs.map\n","import { invariant, pipe, clamp, millisecondsToSeconds, secondsToMilliseconds } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { activeAnimations } from '../stats/animation-count.mjs';\nimport { mix } from '../utils/mix/index.mjs';\nimport { frameloopDriver } from './drivers/frame.mjs';\nimport { inertia } from './generators/inertia.mjs';\nimport { keyframes } from './generators/keyframes.mjs';\nimport { calcGeneratorDuration } from './generators/utils/calc-duration.mjs';\nimport { getGeneratorVelocity } from './generators/utils/velocity.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { replaceTransitionType } from './utils/replace-transition-type.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\n\nconst percentToProgress = (percent) => percent / 100;\nclass JSAnimation extends WithPromise {\n constructor(options) {\n super();\n this.state = \"idle\";\n this.startTime = null;\n this.isStopped = false;\n /**\n * The current time of the animation.\n */\n this.currentTime = 0;\n /**\n * The time at which the animation was paused.\n */\n this.holdTime = null;\n /**\n * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.\n */\n this.playbackSpeed = 1;\n /**\n * Reusable state object for the delay phase to avoid\n * allocating a new object every frame.\n */\n this.delayState = {\n done: false,\n value: undefined,\n };\n /**\n * This method is bound to the instance to fix a pattern where\n * animation.stop is returned as a reference from a useEffect.\n */\n this.stop = () => {\n const { motionValue } = this.options;\n if (motionValue && motionValue.updatedAt !== time.now()) {\n this.tick(time.now());\n }\n this.isStopped = true;\n if (this.state === \"idle\")\n return;\n this.teardown();\n this.options.onStop?.();\n };\n activeAnimations.mainThread++;\n this.options = options;\n this.initAnimation();\n this.play();\n if (options.autoplay === false)\n this.pause();\n }\n initAnimation() {\n const { options } = this;\n replaceTransitionType(options);\n const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = options;\n let { keyframes: keyframes$1 } = options;\n const generatorFactory = type || keyframes;\n if (process.env.NODE_ENV !== \"production\" &&\n generatorFactory !== keyframes) {\n invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, \"spring-two-frames\");\n }\n if (generatorFactory !== keyframes &&\n typeof keyframes$1[0] !== \"number\") {\n this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));\n keyframes$1 = [0, 100];\n }\n const generator = generatorFactory({ ...options, keyframes: keyframes$1 });\n /**\n * If we have a mirror repeat type we need to create a second generator that outputs the\n * mirrored (not reversed) animation and later ping pong between the two generators.\n */\n if (repeatType === \"mirror\") {\n this.mirroredGenerator = generatorFactory({\n ...options,\n keyframes: [...keyframes$1].reverse(),\n velocity: -velocity,\n });\n }\n /**\n * If duration is undefined and we have repeat options,\n * we need to calculate a duration from the generator.\n *\n * We set it to the generator itself to cache the duration.\n * Any timeline resolver will need to have already precalculated\n * the duration by this step.\n */\n if (generator.calculatedDuration === null) {\n generator.calculatedDuration = calcGeneratorDuration(generator);\n }\n const { calculatedDuration } = generator;\n this.calculatedDuration = calculatedDuration;\n this.resolvedDuration = calculatedDuration + repeatDelay;\n this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay;\n this.generator = generator;\n }\n updateTime(timestamp) {\n const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed;\n // Update currentTime\n if (this.holdTime !== null) {\n this.currentTime = this.holdTime;\n }\n else {\n // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =\n // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for\n // example.\n this.currentTime = animationTime;\n }\n }\n tick(timestamp, sample = false) {\n const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration, } = this;\n if (this.startTime === null)\n return generator.next(0);\n const { delay = 0, keyframes, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe, } = this.options;\n /**\n * requestAnimationFrame timestamps can come through as lower than\n * the startTime as set by performance.now(). Here we prevent this,\n * though in the future it could be possible to make setting startTime\n * a pending operation that gets resolved here.\n */\n if (this.speed > 0) {\n this.startTime = Math.min(this.startTime, timestamp);\n }\n else if (this.speed < 0) {\n this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);\n }\n if (sample) {\n this.currentTime = timestamp;\n }\n else {\n this.updateTime(timestamp);\n }\n // Rebase on delay\n const timeWithoutDelay = this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1);\n const isInDelayPhase = this.playbackSpeed >= 0\n ? timeWithoutDelay < 0\n : timeWithoutDelay > totalDuration;\n this.currentTime = Math.max(timeWithoutDelay, 0);\n // If this animation has finished, set the current time to the total duration.\n if (this.state === \"finished\" && this.holdTime === null) {\n this.currentTime = totalDuration;\n }\n let elapsed = this.currentTime;\n let frameGenerator = generator;\n if (repeat) {\n /**\n * Get the current progress (0-1) of the animation. If t is >\n * than duration we'll get values like 2.5 (midway through the\n * third iteration)\n */\n const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;\n /**\n * Get the current iteration (0 indexed). For instance the floor of\n * 2.5 is 2.\n */\n let currentIteration = Math.floor(progress);\n /**\n * Get the current progress of the iteration by taking the remainder\n * so 2.5 is 0.5 through iteration 2\n */\n let iterationProgress = progress % 1.0;\n /**\n * If iteration progress is 1 we count that as the end\n * of the previous iteration.\n */\n if (!iterationProgress && progress >= 1) {\n iterationProgress = 1;\n }\n iterationProgress === 1 && currentIteration--;\n currentIteration = Math.min(currentIteration, repeat + 1);\n /**\n * Reverse progress if we're not running in \"normal\" direction\n */\n const isOddIteration = Boolean(currentIteration % 2);\n if (isOddIteration) {\n if (repeatType === \"reverse\") {\n iterationProgress = 1 - iterationProgress;\n if (repeatDelay) {\n iterationProgress -= repeatDelay / resolvedDuration;\n }\n }\n else if (repeatType === \"mirror\") {\n frameGenerator = mirroredGenerator;\n }\n }\n elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;\n }\n /**\n * If we're in negative time, set state as the initial keyframe.\n * This prevents delay: x, duration: 0 animations from finishing\n * instantly.\n */\n let state;\n if (isInDelayPhase) {\n this.delayState.value = keyframes[0];\n state = this.delayState;\n }\n else {\n state = frameGenerator.next(elapsed);\n }\n if (mixKeyframes && !isInDelayPhase) {\n state.value = mixKeyframes(state.value);\n }\n let { done } = state;\n if (!isInDelayPhase && calculatedDuration !== null) {\n done =\n this.playbackSpeed >= 0\n ? this.currentTime >= totalDuration\n : this.currentTime <= 0;\n }\n const isAnimationFinished = this.holdTime === null &&\n (this.state === \"finished\" || (this.state === \"running\" && done));\n // TODO: The exception for inertia could be cleaner here\n if (isAnimationFinished && type !== inertia) {\n state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n }\n if (onUpdate) {\n onUpdate(state.value);\n }\n if (isAnimationFinished) {\n this.finish();\n }\n return state;\n }\n /**\n * Allows the returned animation to be awaited or promise-chained. Currently\n * resolves when the animation finishes at all but in a future update could/should\n * reject if its cancels.\n */\n then(resolve, reject) {\n return this.finished.then(resolve, reject);\n }\n get duration() {\n return millisecondsToSeconds(this.calculatedDuration);\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(this.currentTime);\n }\n set time(newTime) {\n newTime = secondsToMilliseconds(newTime);\n this.currentTime = newTime;\n if (this.startTime === null ||\n this.holdTime !== null ||\n this.playbackSpeed === 0) {\n this.holdTime = newTime;\n }\n else if (this.driver) {\n this.startTime = this.driver.now() - newTime / this.playbackSpeed;\n }\n if (this.driver) {\n this.driver.start(false);\n }\n else {\n this.startTime = 0;\n this.state = \"paused\";\n this.holdTime = newTime;\n this.tick(newTime);\n }\n }\n /**\n * Returns the generator's velocity at the current time in units/second.\n * Uses the analytical derivative when available (springs), avoiding\n * the MotionValue's frame-dependent velocity estimation.\n */\n getGeneratorVelocity() {\n const t = this.currentTime;\n if (t <= 0)\n return this.options.velocity || 0;\n if (this.generator.velocity) {\n return this.generator.velocity(t);\n }\n // Fallback: finite difference\n const current = this.generator.next(t).value;\n return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);\n }\n get speed() {\n return this.playbackSpeed;\n }\n set speed(newSpeed) {\n const hasChanged = this.playbackSpeed !== newSpeed;\n if (hasChanged && this.driver) {\n this.updateTime(time.now());\n }\n this.playbackSpeed = newSpeed;\n if (hasChanged && this.driver) {\n this.time = millisecondsToSeconds(this.currentTime);\n }\n }\n play() {\n if (this.isStopped)\n return;\n const { driver = frameloopDriver, startTime } = this.options;\n if (!this.driver) {\n this.driver = driver((timestamp) => this.tick(timestamp));\n }\n this.options.onPlay?.();\n const now = this.driver.now();\n if (this.state === \"finished\") {\n this.updateFinished();\n this.startTime = now;\n }\n else if (this.holdTime !== null) {\n this.startTime = now - this.holdTime;\n }\n else if (!this.startTime) {\n this.startTime = startTime ?? now;\n }\n if (this.state === \"finished\" && this.speed < 0) {\n this.startTime += this.calculatedDuration;\n }\n this.holdTime = null;\n /**\n * Set playState to running only after we've used it in\n * the previous logic.\n */\n this.state = \"running\";\n this.driver.start();\n }\n pause() {\n this.state = \"paused\";\n this.updateTime(time.now());\n this.holdTime = this.currentTime;\n }\n complete() {\n if (this.state !== \"running\") {\n this.play();\n }\n this.state = \"finished\";\n this.holdTime = null;\n }\n finish() {\n this.notifyFinished();\n this.teardown();\n this.state = \"finished\";\n this.options.onComplete?.();\n }\n cancel() {\n this.holdTime = null;\n this.startTime = 0;\n this.tick(0);\n this.teardown();\n this.options.onCancel?.();\n }\n teardown() {\n this.state = \"idle\";\n this.stopDriver();\n this.startTime = this.holdTime = null;\n activeAnimations.mainThread--;\n }\n stopDriver() {\n if (!this.driver)\n return;\n this.driver.stop();\n this.driver = undefined;\n }\n sample(sampleTime) {\n this.startTime = 0;\n return this.tick(sampleTime, true);\n }\n attachTimeline(timeline) {\n if (this.options.allowFlatten) {\n this.options.type = \"keyframes\";\n this.options.ease = \"linear\";\n this.initAnimation();\n }\n this.driver?.stop();\n return timeline.observe(this);\n }\n}\n// Legacy function support\nfunction animateValue(options) {\n return new JSAnimation(options);\n}\n\nexport { JSAnimation, animateValue };\n//# sourceMappingURL=JSAnimation.mjs.map\n","function fillWildcards(keyframes) {\n for (let i = 1; i < keyframes.length; i++) {\n keyframes[i] ?? (keyframes[i] = keyframes[i - 1]);\n }\n}\n\nexport { fillWildcards };\n//# sourceMappingURL=fill-wildcards.mjs.map\n","const radToDeg = (rad) => (rad * 180) / Math.PI;\nconst rotate = (v) => {\n const angle = radToDeg(Math.atan2(v[1], v[0]));\n return rebaseAngle(angle);\n};\nconst matrix2dParsers = {\n x: 4,\n y: 5,\n translateX: 4,\n translateY: 5,\n scaleX: 0,\n scaleY: 3,\n scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,\n rotate,\n rotateZ: rotate,\n skewX: (v) => radToDeg(Math.atan(v[1])),\n skewY: (v) => radToDeg(Math.atan(v[2])),\n skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2,\n};\nconst rebaseAngle = (angle) => {\n angle = angle % 360;\n if (angle < 0)\n angle += 360;\n return angle;\n};\nconst rotateZ = rotate;\nconst scaleX = (v) => Math.sqrt(v[0] * v[0] + v[1] * v[1]);\nconst scaleY = (v) => Math.sqrt(v[4] * v[4] + v[5] * v[5]);\nconst matrix3dParsers = {\n x: 12,\n y: 13,\n z: 14,\n translateX: 12,\n translateY: 13,\n translateZ: 14,\n scaleX,\n scaleY,\n scale: (v) => (scaleX(v) + scaleY(v)) / 2,\n rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),\n rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),\n rotateZ,\n rotate: rotateZ,\n skewX: (v) => radToDeg(Math.atan(v[4])),\n skewY: (v) => radToDeg(Math.atan(v[1])),\n skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2,\n};\nfunction defaultTransformValue(name) {\n return name.includes(\"scale\") ? 1 : 0;\n}\nfunction parseValueFromTransform(transform, name) {\n if (!transform || transform === \"none\") {\n return defaultTransformValue(name);\n }\n const matrix3dMatch = transform.match(/^matrix3d\\(([-\\d.e\\s,]+)\\)$/u);\n let parsers;\n let match;\n if (matrix3dMatch) {\n parsers = matrix3dParsers;\n match = matrix3dMatch;\n }\n else {\n const matrix2dMatch = transform.match(/^matrix\\(([-\\d.e\\s,]+)\\)$/u);\n parsers = matrix2dParsers;\n match = matrix2dMatch;\n }\n if (!match) {\n return defaultTransformValue(name);\n }\n const valueParser = parsers[name];\n const values = match[1].split(\",\").map(convertTransformToNumber);\n return typeof valueParser === \"function\"\n ? valueParser(values)\n : values[valueParser];\n}\nconst readTransformValue = (instance, name) => {\n const { transform = \"none\" } = getComputedStyle(instance);\n return parseValueFromTransform(transform, name);\n};\nfunction convertTransformToNumber(value) {\n return parseFloat(value.trim());\n}\n\nexport { defaultTransformValue, parseValueFromTransform, readTransformValue };\n//# sourceMappingURL=parse-transform.mjs.map\n","/**\n * Generate a list of every possible transform key.\n */\nconst transformPropOrder = [\n \"transformPerspective\",\n \"x\",\n \"y\",\n \"z\",\n \"translateX\",\n \"translateY\",\n \"translateZ\",\n \"scale\",\n \"scaleX\",\n \"scaleY\",\n \"rotate\",\n \"rotateX\",\n \"rotateY\",\n \"rotateZ\",\n \"skew\",\n \"skewX\",\n \"skewY\",\n];\n/**\n * A quick lookup for transform props.\n */\nconst transformProps = /*@__PURE__*/ (() => new Set(transformPropOrder))();\n\nexport { transformPropOrder, transformProps };\n//# sourceMappingURL=keys-transform.mjs.map\n","import { parseValueFromTransform } from '../../../render/dom/parse-transform.mjs';\nimport { transformPropOrder } from '../../../render/utils/keys-transform.mjs';\nimport { number } from '../../../value/types/numbers/index.mjs';\nimport { px } from '../../../value/types/numbers/units.mjs';\n\nconst isNumOrPxType = (v) => v === number || v === px;\nconst transformKeys = new Set([\"x\", \"y\", \"z\"]);\nconst nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));\nfunction removeNonTranslationalTransform(visualElement) {\n const removedTransforms = [];\n nonTranslationalTransformKeys.forEach((key) => {\n const value = visualElement.getValue(key);\n if (value !== undefined) {\n removedTransforms.push([key, value.get()]);\n value.set(key.startsWith(\"scale\") ? 1 : 0);\n }\n });\n return removedTransforms;\n}\nconst positionalValues = {\n // Dimensions\n width: ({ x }, { paddingLeft = \"0\", paddingRight = \"0\", boxSizing }) => {\n const width = x.max - x.min;\n return boxSizing === \"border-box\"\n ? width\n : width - parseFloat(paddingLeft) - parseFloat(paddingRight);\n },\n height: ({ y }, { paddingTop = \"0\", paddingBottom = \"0\", boxSizing }) => {\n const height = y.max - y.min;\n return boxSizing === \"border-box\"\n ? height\n : height - parseFloat(paddingTop) - parseFloat(paddingBottom);\n },\n top: (_bbox, { top }) => parseFloat(top),\n left: (_bbox, { left }) => parseFloat(left),\n bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),\n right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),\n // Transform\n x: (_bbox, { transform }) => parseValueFromTransform(transform, \"x\"),\n y: (_bbox, { transform }) => parseValueFromTransform(transform, \"y\"),\n};\n// Alias translate longform names\npositionalValues.translateX = positionalValues.x;\npositionalValues.translateY = positionalValues.y;\n\nexport { isNumOrPxType, positionalValues, removeNonTranslationalTransform };\n//# sourceMappingURL=unit-conversion.mjs.map\n","import { fillWildcards } from './utils/fill-wildcards.mjs';\nimport { removeNonTranslationalTransform } from './utils/unit-conversion.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst toResolve = new Set();\nlet isScheduled = false;\nlet anyNeedsMeasurement = false;\nlet isForced = false;\nfunction measureAllKeyframes() {\n if (anyNeedsMeasurement) {\n const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement);\n const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element));\n const transformsToRestore = new Map();\n /**\n * Write pass\n * If we're measuring elements we want to remove bounding box-changing transforms.\n */\n elementsToMeasure.forEach((element) => {\n const removedTransforms = removeNonTranslationalTransform(element);\n if (!removedTransforms.length)\n return;\n transformsToRestore.set(element, removedTransforms);\n element.render();\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureInitialState());\n // Write\n elementsToMeasure.forEach((element) => {\n element.render();\n const restore = transformsToRestore.get(element);\n if (restore) {\n restore.forEach(([key, value]) => {\n element.getValue(key)?.set(value);\n });\n }\n });\n // Read\n resolversToMeasure.forEach((resolver) => resolver.measureEndState());\n // Write\n resolversToMeasure.forEach((resolver) => {\n if (resolver.suspendedScrollY !== undefined) {\n window.scrollTo(0, resolver.suspendedScrollY);\n }\n });\n }\n anyNeedsMeasurement = false;\n isScheduled = false;\n toResolve.forEach((resolver) => resolver.complete(isForced));\n toResolve.clear();\n}\nfunction readAllKeyframes() {\n toResolve.forEach((resolver) => {\n resolver.readKeyframes();\n if (resolver.needsMeasurement) {\n anyNeedsMeasurement = true;\n }\n });\n}\nfunction flushKeyframeResolvers() {\n isForced = true;\n readAllKeyframes();\n measureAllKeyframes();\n isForced = false;\n}\nclass KeyframeResolver {\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {\n this.state = \"pending\";\n /**\n * Track whether this resolver is async. If it is, it'll be added to the\n * resolver queue and flushed in the next frame. Resolvers that aren't going\n * to trigger read/write thrashing don't need to be async.\n */\n this.isAsync = false;\n /**\n * Track whether this resolver needs to perform a measurement\n * to resolve its keyframes.\n */\n this.needsMeasurement = false;\n this.unresolvedKeyframes = [...unresolvedKeyframes];\n this.onComplete = onComplete;\n this.name = name;\n this.motionValue = motionValue;\n this.element = element;\n this.isAsync = isAsync;\n }\n scheduleResolve() {\n this.state = \"scheduled\";\n if (this.isAsync) {\n toResolve.add(this);\n if (!isScheduled) {\n isScheduled = true;\n frame.read(readAllKeyframes);\n frame.resolveKeyframes(measureAllKeyframes);\n }\n }\n else {\n this.readKeyframes();\n this.complete();\n }\n }\n readKeyframes() {\n const { unresolvedKeyframes, name, element, motionValue } = this;\n // If initial keyframe is null we need to read it from the DOM\n if (unresolvedKeyframes[0] === null) {\n const currentValue = motionValue?.get();\n // TODO: This doesn't work if the final keyframe is a wildcard\n const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (currentValue !== undefined) {\n unresolvedKeyframes[0] = currentValue;\n }\n else if (element && name) {\n const valueAsRead = element.readValue(name, finalKeyframe);\n if (valueAsRead !== undefined && valueAsRead !== null) {\n unresolvedKeyframes[0] = valueAsRead;\n }\n }\n if (unresolvedKeyframes[0] === undefined) {\n unresolvedKeyframes[0] = finalKeyframe;\n }\n if (motionValue && currentValue === undefined) {\n motionValue.set(unresolvedKeyframes[0]);\n }\n }\n fillWildcards(unresolvedKeyframes);\n }\n setFinalKeyframe() { }\n measureInitialState() { }\n renderEndStyles() { }\n measureEndState() { }\n complete(isForcedComplete = false) {\n this.state = \"complete\";\n this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, isForcedComplete);\n toResolve.delete(this);\n }\n cancel() {\n if (this.state === \"scheduled\") {\n toResolve.delete(this);\n this.state = \"pending\";\n }\n }\n resume() {\n if (this.state === \"pending\")\n this.scheduleResolve();\n }\n}\n\nexport { KeyframeResolver, flushKeyframeResolvers };\n//# sourceMappingURL=KeyframesResolver.mjs.map\n","const isCSSVar = (name) => name.startsWith(\"--\");\n\nexport { isCSSVar };\n//# sourceMappingURL=is-css-var.mjs.map\n","import { isCSSVar } from './is-css-var.mjs';\n\nfunction setStyle(element, name, value) {\n isCSSVar(name)\n ? element.style.setProperty(name, value)\n : (element.style[name] = value);\n}\n\nexport { setStyle };\n//# sourceMappingURL=style-set.mjs.map\n","/**\n * Add the ability for test suites to manually set support flags\n * to better test more environments.\n */\nconst supportsFlags = {};\n\nexport { supportsFlags };\n//# sourceMappingURL=flags.mjs.map\n","import { memo } from 'motion-utils';\nimport { supportsFlags } from './flags.mjs';\n\nfunction memoSupports(callback, supportsFlag) {\n const memoized = memo(callback);\n return () => supportsFlags[supportsFlag] ?? memoized();\n}\n\nexport { memoSupports };\n//# sourceMappingURL=memo.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, \"scrollTimeline\");\nconst supportsViewTimeline = /* @__PURE__ */ memoSupports(() => window.ViewTimeline !== undefined, \"viewTimeline\");\n\nexport { supportsScrollTimeline, supportsViewTimeline };\n//# sourceMappingURL=scroll-timeline.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {\n try {\n document\n .createElement(\"div\")\n .animate({ opacity: 0 }, { easing: \"linear(0, 1)\" });\n }\n catch (e) {\n return false;\n }\n return true;\n}, \"linearEasing\");\n\nexport { supportsLinearEasing };\n//# sourceMappingURL=linear-easing.mjs.map\n","const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;\n\nexport { cubicBezierAsString };\n//# sourceMappingURL=cubic-bezier.mjs.map\n","import { cubicBezierAsString } from './cubic-bezier.mjs';\n\nconst supportedWaapiEasing = {\n linear: \"linear\",\n ease: \"ease\",\n easeIn: \"ease-in\",\n easeOut: \"ease-out\",\n easeInOut: \"ease-in-out\",\n circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),\n circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),\n backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),\n backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),\n};\n\nexport { supportedWaapiEasing };\n//# sourceMappingURL=supported.mjs.map\n","import { isBezierDefinition } from 'motion-utils';\nimport { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { generateLinearEasing } from '../utils/linear.mjs';\nimport { cubicBezierAsString } from './cubic-bezier.mjs';\nimport { supportedWaapiEasing } from './supported.mjs';\n\nfunction mapEasingToNativeEasing(easing, duration) {\n if (!easing) {\n return undefined;\n }\n else if (typeof easing === \"function\") {\n return supportsLinearEasing()\n ? generateLinearEasing(easing, duration)\n : \"ease-out\";\n }\n else if (isBezierDefinition(easing)) {\n return cubicBezierAsString(easing);\n }\n else if (Array.isArray(easing)) {\n return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||\n supportedWaapiEasing.easeOut);\n }\n else {\n return supportedWaapiEasing[easing];\n }\n}\n\nexport { mapEasingToNativeEasing };\n//# sourceMappingURL=map-easing.mjs.map\n","import { activeAnimations } from '../../stats/animation-count.mjs';\nimport { statsBuffer } from '../../stats/buffer.mjs';\nimport { mapEasingToNativeEasing } from './easing/map-easing.mjs';\n\nfunction startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = \"loop\", ease = \"easeOut\", times, } = {}, pseudoElement = undefined) {\n const keyframeOptions = {\n [valueName]: keyframes,\n };\n if (times)\n keyframeOptions.offset = times;\n const easing = mapEasingToNativeEasing(ease, duration);\n /**\n * If this is an easing array, apply to keyframes, not animation as a whole\n */\n if (Array.isArray(easing))\n keyframeOptions.easing = easing;\n if (statsBuffer.value) {\n activeAnimations.waapi++;\n }\n const options = {\n delay,\n duration,\n easing: !Array.isArray(easing) ? easing : \"linear\",\n fill: \"both\",\n iterations: repeat + 1,\n direction: repeatType === \"reverse\" ? \"alternate\" : \"normal\",\n };\n if (pseudoElement)\n options.pseudoElement = pseudoElement;\n const animation = element.animate(keyframeOptions, options);\n if (statsBuffer.value) {\n animation.finished.finally(() => {\n activeAnimations.waapi--;\n });\n }\n return animation;\n}\n\nexport { startWaapiAnimation };\n//# sourceMappingURL=start-waapi-animation.mjs.map\n","function isGenerator(type) {\n return typeof type === \"function\" && \"applyToOptions\" in type;\n}\n\nexport { isGenerator };\n//# sourceMappingURL=is-generator.mjs.map\n","import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { isGenerator } from '../../generators/utils/is-generator.mjs';\n\nfunction applyGeneratorOptions({ type, ...options }) {\n if (isGenerator(type) && supportsLinearEasing()) {\n return type.applyToOptions(options);\n }\n else {\n options.duration ?? (options.duration = 300);\n options.ease ?? (options.ease = \"easeOut\");\n }\n return options;\n}\n\nexport { applyGeneratorOptions };\n//# sourceMappingURL=apply-generator.mjs.map\n","import { invariant, millisecondsToSeconds, secondsToMilliseconds, noop } from 'motion-utils';\nimport { setStyle } from '../render/dom/style-set.mjs';\nimport { supportsScrollTimeline } from '../utils/supports/scroll-timeline.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\nimport { startWaapiAnimation } from './waapi/start-waapi-animation.mjs';\nimport { applyGeneratorOptions } from './waapi/utils/apply-generator.mjs';\n\n/**\n * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.\n */\nclass NativeAnimation extends WithPromise {\n constructor(options) {\n super();\n this.finishedTime = null;\n this.isStopped = false;\n /**\n * Tracks a manually-set start time that takes precedence over WAAPI's\n * dynamic startTime. This is cleared when play() or time setter is called,\n * allowing WAAPI to take over timing.\n */\n this.manualStartTime = null;\n if (!options)\n return;\n const { element, name, keyframes, pseudoElement, allowFlatten = false, finalKeyframe, onComplete, } = options;\n this.isPseudoElement = Boolean(pseudoElement);\n this.allowFlatten = allowFlatten;\n this.options = options;\n invariant(typeof options.type !== \"string\", `Mini animate() doesn't support \"type\" as a string.`, \"mini-spring\");\n const transition = applyGeneratorOptions(options);\n this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement);\n if (transition.autoplay === false) {\n this.animation.pause();\n }\n this.animation.onfinish = () => {\n this.finishedTime = this.time;\n if (!pseudoElement) {\n const keyframe = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n if (this.updateMotionValue) {\n this.updateMotionValue(keyframe);\n }\n /**\n * If we can, we want to commit the final style as set by the user,\n * rather than the computed keyframe value supplied by the animation.\n * We always do this, even when a motion value is present, to prevent\n * a visual flash in Firefox where the WAAPI animation's fill is removed\n * during cancel() before the scheduled render can apply the correct value.\n */\n setStyle(element, name, keyframe);\n this.animation.cancel();\n }\n onComplete?.();\n this.notifyFinished();\n };\n }\n play() {\n if (this.isStopped)\n return;\n this.manualStartTime = null;\n this.animation.play();\n if (this.state === \"finished\") {\n this.updateFinished();\n }\n }\n pause() {\n this.animation.pause();\n }\n complete() {\n this.animation.finish?.();\n }\n cancel() {\n try {\n this.animation.cancel();\n }\n catch (e) { }\n }\n stop() {\n if (this.isStopped)\n return;\n this.isStopped = true;\n const { state } = this;\n if (state === \"idle\" || state === \"finished\") {\n return;\n }\n if (this.updateMotionValue) {\n this.updateMotionValue();\n }\n else {\n this.commitStyles();\n }\n if (!this.isPseudoElement)\n this.cancel();\n }\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * In this method, we commit styles back to the DOM before cancelling\n * the animation.\n *\n * This is designed to be overridden by NativeAnimationExtended, which\n * will create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to also correctly calculate velocity for any subsequent animation\n * while deferring the commit until the next animation frame.\n */\n commitStyles() {\n const element = this.options?.element;\n if (!this.isPseudoElement && element?.isConnected) {\n this.animation.commitStyles?.();\n }\n }\n get duration() {\n const duration = this.animation.effect?.getComputedTiming?.().duration || 0;\n return millisecondsToSeconds(Number(duration));\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(Number(this.animation.currentTime) || 0);\n }\n set time(newTime) {\n const wasFinished = this.finishedTime !== null;\n this.manualStartTime = null;\n this.finishedTime = null;\n this.animation.currentTime = secondsToMilliseconds(newTime);\n if (wasFinished) {\n this.animation.pause();\n }\n }\n /**\n * The playback speed of the animation.\n * 1 = normal speed, 2 = double speed, 0.5 = half speed.\n */\n get speed() {\n return this.animation.playbackRate;\n }\n set speed(newSpeed) {\n // Allow backwards playback after finishing\n if (newSpeed < 0)\n this.finishedTime = null;\n this.animation.playbackRate = newSpeed;\n }\n get state() {\n return this.finishedTime !== null\n ? \"finished\"\n : this.animation.playState;\n }\n get startTime() {\n return this.manualStartTime ?? Number(this.animation.startTime);\n }\n set startTime(newStartTime) {\n this.manualStartTime = this.animation.startTime = newStartTime;\n }\n /**\n * Attaches a timeline to the animation, for instance the `ScrollTimeline`.\n */\n attachTimeline({ timeline, rangeStart, rangeEnd, observe, }) {\n if (this.allowFlatten) {\n this.animation.effect?.updateTiming({ easing: \"linear\" });\n }\n this.animation.onfinish = null;\n if (timeline && supportsScrollTimeline()) {\n this.animation.timeline = timeline;\n if (rangeStart)\n this.animation.rangeStart = rangeStart;\n if (rangeEnd)\n this.animation.rangeEnd = rangeEnd;\n return noop;\n }\n else {\n return observe(this);\n }\n }\n}\n\nexport { NativeAnimation };\n//# sourceMappingURL=NativeAnimation.mjs.map\n","import { circInOut, backInOut, anticipate } from 'motion-utils';\n\nconst unsupportedEasingFunctions = {\n anticipate,\n backInOut,\n circInOut,\n};\nfunction isUnsupportedEase(key) {\n return key in unsupportedEasingFunctions;\n}\nfunction replaceStringEasing(transition) {\n if (typeof transition.ease === \"string\" &&\n isUnsupportedEase(transition.ease)) {\n transition.ease = unsupportedEasingFunctions[transition.ease];\n }\n}\n\nexport { replaceStringEasing };\n//# sourceMappingURL=unsupported-easing.mjs.map\n","import { clamp } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { setStyle } from '../render/dom/style-set.mjs';\nimport { JSAnimation } from './JSAnimation.mjs';\nimport { NativeAnimation } from './NativeAnimation.mjs';\nimport { replaceTransitionType } from './utils/replace-transition-type.mjs';\nimport { replaceStringEasing } from './waapi/utils/unsupported-easing.mjs';\n\n/**\n * 10ms is chosen here as it strikes a balance between smooth\n * results (more than one keyframe per frame at 60fps) and\n * keyframe quantity.\n */\nconst sampleDelta = 10; //ms\nclass NativeAnimationExtended extends NativeAnimation {\n constructor(options) {\n /**\n * The base NativeAnimation function only supports a subset\n * of Motion easings, and WAAPI also only supports some\n * easing functions via string/cubic-bezier definitions.\n *\n * This function replaces those unsupported easing functions\n * with a JS easing function. This will later get compiled\n * to a linear() easing function.\n */\n replaceStringEasing(options);\n /**\n * Ensure we replace the transition type with a generator function\n * before passing to WAAPI.\n *\n * TODO: Does this have a better home? It could be shared with\n * JSAnimation.\n */\n replaceTransitionType(options);\n super(options);\n /**\n * Only set startTime when the animation should autoplay.\n * Setting startTime on a paused WAAPI animation unpauses it\n * (per the WAAPI spec), which breaks autoplay: false.\n */\n if (options.startTime !== undefined && options.autoplay !== false) {\n this.startTime = options.startTime;\n }\n this.options = options;\n }\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * Rather than read committed styles back out of the DOM, we can\n * create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to calculate velocity for any subsequent animation.\n */\n updateMotionValue(value) {\n const { motionValue, onUpdate, onComplete, element, ...options } = this.options;\n if (!motionValue)\n return;\n if (value !== undefined) {\n motionValue.set(value);\n return;\n }\n const sampleAnimation = new JSAnimation({\n ...options,\n autoplay: false,\n });\n /**\n * Use wall-clock elapsed time for sampling.\n * Under CPU load, WAAPI's currentTime may not reflect actual\n * elapsed time, causing incorrect sampling and visual jumps.\n */\n const sampleTime = Math.max(sampleDelta, time.now() - this.startTime);\n const delta = clamp(0, sampleDelta, sampleTime - sampleDelta);\n const current = sampleAnimation.sample(sampleTime).value;\n /**\n * Write the estimated value to inline style so it persists\n * after cancel(), covering the async gap before the next\n * animation starts.\n */\n const { name } = this.options;\n if (element && name)\n setStyle(element, name, current);\n motionValue.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current, delta);\n sampleAnimation.stop();\n }\n}\n\nexport { NativeAnimationExtended };\n//# sourceMappingURL=NativeAnimationExtended.mjs.map\n","import { complex } from '../../value/types/complex/index.mjs';\n\n/**\n * Check if a value is animatable. Examples:\n *\n * ✅: 100, \"100px\", \"#fff\"\n * ❌: \"block\", \"url(2.jpg)\"\n * @param value\n *\n * @internal\n */\nconst isAnimatable = (value, name) => {\n // If the list of keys that might be non-animatable grows, replace with Set\n if (name === \"zIndex\")\n return false;\n // If it's a number or a keyframes array, we can animate it. We might at some point\n // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,\n // but for now lets leave it like this for performance reasons\n if (typeof value === \"number\" || Array.isArray(value))\n return true;\n if (typeof value === \"string\" && // It's animatable if we have a string\n (complex.test(value) || value === \"0\") && // And it contains numbers and/or colors\n !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n ) {\n return true;\n }\n return false;\n};\n\nexport { isAnimatable };\n//# sourceMappingURL=is-animatable.mjs.map\n","import { warning } from 'motion-utils';\nimport { isGenerator } from '../generators/utils/is-generator.mjs';\nimport { isAnimatable } from './is-animatable.mjs';\n\nfunction hasKeyframesChanged(keyframes) {\n const current = keyframes[0];\n if (keyframes.length === 1)\n return true;\n for (let i = 0; i < keyframes.length; i++) {\n if (keyframes[i] !== current)\n return true;\n }\n}\nfunction canAnimate(keyframes, name, type, velocity) {\n /**\n * Check if we're able to animate between the start and end keyframes,\n * and throw a warning if we're attempting to animate between one that's\n * animatable and another that isn't.\n */\n const originKeyframe = keyframes[0];\n if (originKeyframe === null) {\n return false;\n }\n /**\n * These aren't traditionally animatable but we do support them.\n * In future we could look into making this more generic or replacing\n * this function with mix() === mixImmediate\n */\n if (name === \"display\" || name === \"visibility\")\n return true;\n const targetKeyframe = keyframes[keyframes.length - 1];\n const isOriginAnimatable = isAnimatable(originKeyframe, name);\n const isTargetAnimatable = isAnimatable(targetKeyframe, name);\n warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${isOriginAnimatable ? targetKeyframe : originKeyframe}\" is not an animatable value.`, \"value-not-animatable\");\n // Always skip if any of these are true\n if (!isOriginAnimatable || !isTargetAnimatable) {\n return false;\n }\n return (hasKeyframesChanged(keyframes) ||\n ((type === \"spring\" || isGenerator(type)) && velocity));\n}\n\nexport { canAnimate };\n//# sourceMappingURL=can-animate.mjs.map\n","function makeAnimationInstant(options) {\n options.duration = 0;\n options.type = \"keyframes\";\n}\n\nexport { makeAnimationInstant };\n//# sourceMappingURL=make-animation-instant.mjs.map\n","/**\n * A list of values that can be hardware-accelerated.\n */\nconst acceleratedValues = new Set([\n \"opacity\",\n \"clipPath\",\n \"filter\",\n \"transform\",\n // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved\n // or until we implement support for linear() easing.\n // \"background-color\"\n]);\n\nexport { acceleratedValues };\n//# sourceMappingURL=accelerated-values.mjs.map\n","const browserColorFunctions = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\\(/;\nfunction hasBrowserOnlyColors(keyframes) {\n for (let i = 0; i < keyframes.length; i++) {\n if (typeof keyframes[i] === \"string\" &&\n browserColorFunctions.test(keyframes[i])) {\n return true;\n }\n }\n return false;\n}\n\nexport { hasBrowserOnlyColors };\n//# sourceMappingURL=is-browser-color.mjs.map\n","import { memo } from 'motion-utils';\nimport { acceleratedValues } from '../utils/accelerated-values.mjs';\nimport { hasBrowserOnlyColors } from '../utils/is-browser-color.mjs';\n\nconst colorProperties = new Set([\n \"color\",\n \"backgroundColor\",\n \"outlineColor\",\n \"fill\",\n \"stroke\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n]);\nconst supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, \"animate\"));\nfunction supportsBrowserAnimation(options) {\n const { motionValue, name, repeatDelay, repeatType, damping, type, keyframes, } = options;\n const subject = motionValue?.owner?.current;\n /**\n * We use this check instead of isHTMLElement() because we explicitly\n * **don't** want elements in different timing contexts (i.e. popups)\n * to be accelerated, as it's not possible to sync these animations\n * properly with those driven from the main window frameloop.\n */\n if (!(subject instanceof HTMLElement)) {\n return false;\n }\n const { onUpdate, transformTemplate } = motionValue.owner.getProps();\n return (supportsWaapi() &&\n name &&\n /**\n * Force WAAPI for color properties with browser-only color formats\n * (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.\n */\n (acceleratedValues.has(name) ||\n (colorProperties.has(name) &&\n hasBrowserOnlyColors(keyframes))) &&\n (name !== \"transform\" || !transformTemplate) &&\n /**\n * If we're outputting values to onUpdate then we can't use WAAPI as there's\n * no way to read the value from WAAPI every frame.\n */\n !onUpdate &&\n !repeatDelay &&\n repeatType !== \"mirror\" &&\n damping !== 0 &&\n type !== \"inertia\");\n}\n\nexport { supportsBrowserAnimation };\n//# sourceMappingURL=waapi.mjs.map\n","import { MotionGlobalConfig, noop } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { JSAnimation } from './JSAnimation.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { KeyframeResolver, flushKeyframeResolvers } from './keyframes/KeyframesResolver.mjs';\nimport { NativeAnimationExtended } from './NativeAnimationExtended.mjs';\nimport { canAnimate } from './utils/can-animate.mjs';\nimport { makeAnimationInstant } from './utils/make-animation-instant.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\nimport { supportsBrowserAnimation } from './waapi/supports/waapi.mjs';\n\n/**\n * Maximum time allowed between an animation being created and it being\n * resolved for us to use the latter as the start time.\n *\n * This is to ensure that while we prefer to \"start\" an animation as soon\n * as it's triggered, we also want to avoid a visual jump if there's a big delay\n * between these two moments.\n */\nconst MAX_RESOLVE_DELAY = 40;\nclass AsyncMotionValueAnimation extends WithPromise {\n constructor({ autoplay = true, delay = 0, type = \"keyframes\", repeat = 0, repeatDelay = 0, repeatType = \"loop\", keyframes, name, motionValue, element, ...options }) {\n super();\n /**\n * Bound to support return animation.stop pattern\n */\n this.stop = () => {\n if (this._animation) {\n this._animation.stop();\n this.stopTimeline?.();\n }\n this.keyframeResolver?.cancel();\n };\n this.createdAt = time.now();\n const optionsWithDefaults = {\n autoplay,\n delay,\n type,\n repeat,\n repeatDelay,\n repeatType,\n name,\n motionValue,\n element,\n ...options,\n };\n const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;\n this.keyframeResolver = new KeyframeResolver$1(keyframes, (resolvedKeyframes, finalKeyframe, forced) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe, optionsWithDefaults, !forced), name, motionValue, element);\n this.keyframeResolver?.scheduleResolve();\n }\n onKeyframesResolved(keyframes, finalKeyframe, options, sync) {\n this.keyframeResolver = undefined;\n const { name, type, velocity, delay, isHandoff, onUpdate } = options;\n this.resolvedAt = time.now();\n /**\n * If we can't animate this value with the resolved keyframes\n * then we should complete it immediately.\n */\n let canAnimateValue = true;\n if (!canAnimate(keyframes, name, type, velocity)) {\n canAnimateValue = false;\n if (MotionGlobalConfig.instantAnimations || !delay) {\n onUpdate?.(getFinalKeyframe(keyframes, options, finalKeyframe));\n }\n keyframes[0] = keyframes[keyframes.length - 1];\n makeAnimationInstant(options);\n options.repeat = 0;\n }\n /**\n * Resolve startTime for the animation.\n *\n * This method uses the createdAt and resolvedAt to calculate the\n * animation startTime. *Ideally*, we would use the createdAt time as t=0\n * as the following frame would then be the first frame of the animation in\n * progress, which would feel snappier.\n *\n * However, if there's a delay (main thread work) between the creation of\n * the animation and the first committed frame, we prefer to use resolvedAt\n * to avoid a sudden jump into the animation.\n */\n const startTime = sync\n ? !this.resolvedAt\n ? this.createdAt\n : this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY\n ? this.resolvedAt\n : this.createdAt\n : undefined;\n const resolvedOptions = {\n startTime,\n finalKeyframe,\n ...options,\n keyframes,\n };\n /**\n * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via\n * WAAPI. Therefore, this animation must be JS to ensure it runs \"under\" the\n * optimised animation.\n *\n * Also skip WAAPI when keyframes aren't animatable, as the resolved\n * values may not be valid CSS and would trigger browser warnings.\n */\n const useWaapi = canAnimateValue &&\n !isHandoff &&\n supportsBrowserAnimation(resolvedOptions);\n const element = resolvedOptions.motionValue?.owner?.current;\n let animation;\n if (useWaapi) {\n try {\n animation = new NativeAnimationExtended({\n ...resolvedOptions,\n element,\n });\n }\n catch {\n animation = new JSAnimation(resolvedOptions);\n }\n }\n else {\n animation = new JSAnimation(resolvedOptions);\n }\n animation.finished.then(() => {\n this.notifyFinished();\n }).catch(noop);\n if (this.pendingTimeline) {\n this.stopTimeline = animation.attachTimeline(this.pendingTimeline);\n this.pendingTimeline = undefined;\n }\n this._animation = animation;\n }\n get finished() {\n if (!this._animation) {\n return this._finished;\n }\n else {\n return this.animation.finished;\n }\n }\n then(onResolve, _onReject) {\n return this.finished.finally(onResolve).then(() => { });\n }\n get animation() {\n if (!this._animation) {\n this.keyframeResolver?.resume();\n flushKeyframeResolvers();\n }\n return this._animation;\n }\n get duration() {\n return this.animation.duration;\n }\n get iterationDuration() {\n return this.animation.iterationDuration;\n }\n get time() {\n return this.animation.time;\n }\n set time(newTime) {\n this.animation.time = newTime;\n }\n get speed() {\n return this.animation.speed;\n }\n get state() {\n return this.animation.state;\n }\n set speed(newSpeed) {\n this.animation.speed = newSpeed;\n }\n get startTime() {\n return this.animation.startTime;\n }\n attachTimeline(timeline) {\n if (this._animation) {\n this.stopTimeline = this.animation.attachTimeline(timeline);\n }\n else {\n this.pendingTimeline = timeline;\n }\n return () => this.stop();\n }\n play() {\n this.animation.play();\n }\n pause() {\n this.animation.pause();\n }\n complete() {\n this.animation.complete();\n }\n cancel() {\n if (this._animation) {\n this.animation.cancel();\n }\n this.keyframeResolver?.cancel();\n }\n}\n\nexport { AsyncMotionValueAnimation };\n//# sourceMappingURL=AsyncMotionValueAnimation.mjs.map\n","function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {\n const index = Array.from(children)\n .sort((a, b) => a.sortNodePosition(b))\n .indexOf(child);\n const numChildren = children.size;\n const maxStaggerDuration = (numChildren - 1) * staggerChildren;\n const delayIsFunction = typeof delayChildren === \"function\";\n return delayIsFunction\n ? delayChildren(index, numChildren)\n : staggerDirection === 1\n ? index * staggerChildren\n : maxStaggerDuration - index * staggerChildren;\n}\n\nexport { calcChildStagger };\n//# sourceMappingURL=calc-child-stagger.mjs.map\n","import { invariant, isNumericalString } from 'motion-utils';\nimport { isCSSVariableToken } from './is-css-variable.mjs';\n\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\nconst splitCSSVariableRegex = \n// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words\n/^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)/u;\nfunction parseCSSVariable(current) {\n const match = splitCSSVariableRegex.exec(current);\n if (!match)\n return [,];\n const [, token1, token2, fallback] = match;\n return [`--${token1 ?? token2}`, fallback];\n}\nconst maxDepth = 4;\nfunction getVariableValue(current, element, depth = 1) {\n invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property \"${current}\". This may indicate a circular fallback dependency.`, \"max-css-var-depth\");\n const [token, fallback] = parseCSSVariable(current);\n // No CSS variable detected\n if (!token)\n return;\n // Attempt to read this CSS variable off the element\n const resolved = window.getComputedStyle(element).getPropertyValue(token);\n if (resolved) {\n const trimmed = resolved.trim();\n return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;\n }\n return isCSSVariableToken(fallback)\n ? getVariableValue(fallback, element, depth + 1)\n : fallback;\n}\n\nexport { getVariableValue, parseCSSVariable };\n//# sourceMappingURL=css-variables-conversion.mjs.map\n","import { transformProps } from '../../render/utils/keys-transform.mjs';\n\nconst underDampedSpring = {\n type: \"spring\",\n stiffness: 500,\n damping: 25,\n restSpeed: 10,\n};\nconst criticallyDampedSpring = (target) => ({\n type: \"spring\",\n stiffness: 550,\n damping: target === 0 ? 2 * Math.sqrt(550) : 30,\n restSpeed: 10,\n});\nconst keyframesTransition = {\n type: \"keyframes\",\n duration: 0.8,\n};\n/**\n * Default easing curve is a slightly shallower version of\n * the default browser easing curve.\n */\nconst ease = {\n type: \"keyframes\",\n ease: [0.25, 0.1, 0.35, 1],\n duration: 0.3,\n};\nconst getDefaultTransition = (valueKey, { keyframes }) => {\n if (keyframes.length > 2) {\n return keyframesTransition;\n }\n else if (transformProps.has(valueKey)) {\n return valueKey.startsWith(\"scale\")\n ? criticallyDampedSpring(keyframes[1])\n : underDampedSpring;\n }\n return ease;\n};\n\nexport { getDefaultTransition };\n//# sourceMappingURL=default-transitions.mjs.map\n","/**\n * If `transition` has `inherit: true`, shallow-merge it with\n * `parentTransition` (child keys win) and strip the `inherit` key.\n * Otherwise return `transition` unchanged.\n */\nfunction resolveTransition(transition, parentTransition) {\n if (transition?.inherit && parentTransition) {\n const { inherit: _, ...rest } = transition;\n return { ...parentTransition, ...rest };\n }\n return transition;\n}\n\nexport { resolveTransition };\n//# sourceMappingURL=resolve-transition.mjs.map\n","import { resolveTransition } from './resolve-transition.mjs';\n\nfunction getValueTransition(transition, key) {\n const valueTransition = transition?.[key] ??\n transition?.[\"default\"] ??\n transition;\n if (valueTransition !== transition) {\n return resolveTransition(valueTransition, transition);\n }\n return valueTransition;\n}\n\nexport { getValueTransition };\n//# sourceMappingURL=get-value-transition.mjs.map\n","const orchestrationKeys = new Set([\n \"when\",\n \"delay\",\n \"delayChildren\",\n \"staggerChildren\",\n \"staggerDirection\",\n \"repeat\",\n \"repeatType\",\n \"repeatDelay\",\n \"from\",\n \"elapsed\",\n]);\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nfunction isTransitionDefined(transition) {\n for (const key in transition) {\n if (!orchestrationKeys.has(key))\n return true;\n }\n return false;\n}\n\nexport { isTransitionDefined };\n//# sourceMappingURL=is-transition-defined.mjs.map\n","import { secondsToMilliseconds, MotionGlobalConfig } from 'motion-utils';\nimport { AsyncMotionValueAnimation } from '../AsyncMotionValueAnimation.mjs';\nimport { JSAnimation } from '../JSAnimation.mjs';\nimport { getValueTransition } from '../utils/get-value-transition.mjs';\nimport { makeAnimationInstant } from '../utils/make-animation-instant.mjs';\nimport { getDefaultTransition } from '../utils/default-transitions.mjs';\nimport { getFinalKeyframe } from '../keyframes/get-final.mjs';\nimport { isTransitionDefined } from '../utils/is-transition-defined.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\nconst animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {\n const valueTransition = getValueTransition(transition, name) || {};\n /**\n * Most transition values are currently completely overwritten by value-specific\n * transitions. In the future it'd be nicer to blend these transitions. But for now\n * delay actually does inherit from the root transition if not value-specific.\n */\n const delay = valueTransition.delay || transition.delay || 0;\n /**\n * Elapsed isn't a public transition option but can be passed through from\n * optimized appear effects in milliseconds.\n */\n let { elapsed = 0 } = transition;\n elapsed = elapsed - secondsToMilliseconds(delay);\n const options = {\n keyframes: Array.isArray(target) ? target : [null, target],\n ease: \"easeOut\",\n velocity: value.getVelocity(),\n ...valueTransition,\n delay: -elapsed,\n onUpdate: (v) => {\n value.set(v);\n valueTransition.onUpdate && valueTransition.onUpdate(v);\n },\n onComplete: () => {\n onComplete();\n valueTransition.onComplete && valueTransition.onComplete();\n },\n name,\n motionValue: value,\n element: isHandoff ? undefined : element,\n };\n /**\n * If there's no transition defined for this value, we can generate\n * unique transition settings for this value.\n */\n if (!isTransitionDefined(valueTransition)) {\n Object.assign(options, getDefaultTransition(name, options));\n }\n /**\n * Both WAAPI and our internal animation functions use durations\n * as defined by milliseconds, while our external API defines them\n * as seconds.\n */\n options.duration && (options.duration = secondsToMilliseconds(options.duration));\n options.repeatDelay && (options.repeatDelay = secondsToMilliseconds(options.repeatDelay));\n /**\n * Support deprecated way to set initial value. Prefer keyframe syntax.\n */\n if (options.from !== undefined) {\n options.keyframes[0] = options.from;\n }\n let shouldSkip = false;\n if (options.type === false ||\n (options.duration === 0 && !options.repeatDelay)) {\n makeAnimationInstant(options);\n if (options.delay === 0) {\n shouldSkip = true;\n }\n }\n if (MotionGlobalConfig.instantAnimations ||\n MotionGlobalConfig.skipAnimations ||\n element?.shouldSkipAnimations) {\n shouldSkip = true;\n makeAnimationInstant(options);\n options.delay = 0;\n }\n /**\n * If the transition type or easing has been explicitly set by the user\n * then we don't want to allow flattening the animation.\n */\n options.allowFlatten = !valueTransition.type && !valueTransition.ease;\n /**\n * If we can or must skip creating the animation, and apply only\n * the final keyframe, do so. We also check once keyframes are resolved but\n * this early check prevents the need to create an animation at all.\n */\n if (shouldSkip && !isHandoff && value.get() !== undefined) {\n const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);\n if (finalKeyframe !== undefined) {\n frame.update(() => {\n options.onUpdate(finalKeyframe);\n options.onComplete();\n });\n return;\n }\n }\n return valueTransition.isSync\n ? new JSAnimation(options)\n : new AsyncMotionValueAnimation(options);\n};\n\nexport { animateMotionValue };\n//# sourceMappingURL=motion-value.mjs.map\n","function getValueState(visualElement) {\n const state = [{}, {}];\n visualElement?.values.forEach((value, key) => {\n state[0][key] = value.get();\n state[1][key] = value.getVelocity();\n });\n return state;\n}\nfunction resolveVariantFromProps(props, definition, custom, visualElement) {\n /**\n * If the variant definition is a function, resolve.\n */\n if (typeof definition === \"function\") {\n const [current, velocity] = getValueState(visualElement);\n definition = definition(custom !== undefined ? custom : props.custom, current, velocity);\n }\n /**\n * If the variant definition is a variant label, or\n * the function returned a variant label, resolve.\n */\n if (typeof definition === \"string\") {\n definition = props.variants && props.variants[definition];\n }\n /**\n * At this point we've resolved both functions and variant labels,\n * but the resolved variant label might itself have been a function.\n * If so, resolve. This can only have returned a valid target object.\n */\n if (typeof definition === \"function\") {\n const [current, velocity] = getValueState(visualElement);\n definition = definition(custom !== undefined ? custom : props.custom, current, velocity);\n }\n return definition;\n}\n\nexport { resolveVariantFromProps };\n//# sourceMappingURL=resolve-variants.mjs.map\n","import { resolveVariantFromProps } from './resolve-variants.mjs';\n\nfunction resolveVariant(visualElement, definition, custom) {\n const props = visualElement.getProps();\n return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);\n}\n\nexport { resolveVariant };\n//# sourceMappingURL=resolve-dynamic-variants.mjs.map\n","import { transformPropOrder } from './keys-transform.mjs';\n\nconst positionalKeys = new Set([\n \"width\",\n \"height\",\n \"top\",\n \"left\",\n \"right\",\n \"bottom\",\n ...transformPropOrder,\n]);\n\nexport { positionalKeys };\n//# sourceMappingURL=keys-position.mjs.map\n","import { warnOnce, SubscriptionManager, velocityPerSecond } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { frame } from '../frameloop/frame.mjs';\n\n/**\n * Maximum time between the value of two frames, beyond which we\n * assume the velocity has since been 0.\n */\nconst MAX_VELOCITY_DELTA = 30;\nconst isFloat = (value) => {\n return !isNaN(parseFloat(value));\n};\nconst collectMotionValues = {\n current: undefined,\n};\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nclass MotionValue {\n /**\n * @param init - The initiating value\n * @param config - Optional configuration options\n *\n * - `transformer`: A function to transform incoming values with.\n */\n constructor(init, options = {}) {\n /**\n * Tracks whether this value can output a velocity. Currently this is only true\n * if the value is numerical, but we might be able to widen the scope here and support\n * other value types.\n *\n * @internal\n */\n this.canTrackVelocity = null;\n /**\n * An object containing a SubscriptionManager for each active event.\n */\n this.events = {};\n this.updateAndNotify = (v) => {\n const currentTime = time.now();\n /**\n * If we're updating the value during another frame or eventloop\n * than the previous frame, then the we set the previous frame value\n * to current.\n */\n if (this.updatedAt !== currentTime) {\n this.setPrevFrameValue();\n }\n this.prev = this.current;\n this.setCurrent(v);\n // Update update subscribers\n if (this.current !== this.prev) {\n this.events.change?.notify(this.current);\n if (this.dependents) {\n for (const dependent of this.dependents) {\n dependent.dirty();\n }\n }\n }\n };\n this.hasAnimated = false;\n this.setCurrent(init);\n this.owner = options.owner;\n }\n setCurrent(current) {\n this.current = current;\n this.updatedAt = time.now();\n if (this.canTrackVelocity === null && current !== undefined) {\n this.canTrackVelocity = isFloat(this.current);\n }\n }\n setPrevFrameValue(prevFrameValue = this.current) {\n this.prevFrameValue = prevFrameValue;\n this.prevUpdatedAt = this.updatedAt;\n }\n /**\n * Adds a function that will be notified when the `MotionValue` is updated.\n *\n * It returns a function that, when called, will cancel the subscription.\n *\n * When calling `onChange` inside a React component, it should be wrapped with the\n * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n * from the `useEffect` function to ensure you don't add duplicate subscribers..\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.on(\"change\", updateOpacity)\n * const unsubscribeY = y.on(\"change\", updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return <motion.div style={{ x }} />\n * }\n * ```\n *\n * @param subscriber - A function that receives the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @deprecated\n */\n onChange(subscription) {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback).`);\n }\n return this.on(\"change\", subscription);\n }\n on(eventName, callback) {\n if (!this.events[eventName]) {\n this.events[eventName] = new SubscriptionManager();\n }\n const unsubscribe = this.events[eventName].add(callback);\n if (eventName === \"change\") {\n return () => {\n unsubscribe();\n /**\n * If we have no more change listeners by the start\n * of the next frame, stop active animations.\n */\n frame.read(() => {\n if (!this.events.change.getSize()) {\n this.stop();\n }\n });\n };\n }\n return unsubscribe;\n }\n clearListeners() {\n for (const eventManagers in this.events) {\n this.events[eventManagers].clear();\n }\n }\n /**\n * Attaches a passive effect to the `MotionValue`.\n */\n attach(passiveEffect, stopPassiveEffect) {\n this.passiveEffect = passiveEffect;\n this.stopPassiveEffect = stopPassiveEffect;\n }\n /**\n * Sets the state of the `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useMotionValue(0)\n * x.set(10)\n * ```\n *\n * @param latest - Latest value to set.\n * @param render - Whether to notify render subscribers. Defaults to `true`\n *\n * @public\n */\n set(v) {\n if (!this.passiveEffect) {\n this.updateAndNotify(v);\n }\n else {\n this.passiveEffect(v, this.updateAndNotify);\n }\n }\n setWithVelocity(prev, current, delta) {\n this.set(current);\n this.prev = undefined;\n this.prevFrameValue = prev;\n this.prevUpdatedAt = this.updatedAt - delta;\n }\n /**\n * Set the state of the `MotionValue`, stopping any active animations,\n * effects, and resets velocity to `0`.\n */\n jump(v, endAnimation = true) {\n this.updateAndNotify(v);\n this.prev = v;\n this.prevUpdatedAt = this.prevFrameValue = undefined;\n endAnimation && this.stop();\n if (this.stopPassiveEffect)\n this.stopPassiveEffect();\n }\n dirty() {\n this.events.change?.notify(this.current);\n }\n addDependent(dependent) {\n if (!this.dependents) {\n this.dependents = new Set();\n }\n this.dependents.add(dependent);\n }\n removeDependent(dependent) {\n if (this.dependents) {\n this.dependents.delete(dependent);\n }\n }\n /**\n * Returns the latest state of `MotionValue`\n *\n * @returns - The latest state of `MotionValue`\n *\n * @public\n */\n get() {\n if (collectMotionValues.current) {\n collectMotionValues.current.push(this);\n }\n return this.current;\n }\n /**\n * @public\n */\n getPrevious() {\n return this.prev;\n }\n /**\n * Returns the latest velocity of `MotionValue`\n *\n * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n *\n * @public\n */\n getVelocity() {\n const currentTime = time.now();\n if (!this.canTrackVelocity ||\n this.prevFrameValue === undefined ||\n currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {\n return 0;\n }\n const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);\n // Casts because of parseFloat's poor typing\n return velocityPerSecond(parseFloat(this.current) -\n parseFloat(this.prevFrameValue), delta);\n }\n /**\n * Registers a new animation to control this `MotionValue`. Only one\n * animation can drive a `MotionValue` at one time.\n *\n * ```jsx\n * value.start()\n * ```\n *\n * @param animation - A function that starts the provided animation\n */\n start(startAnimation) {\n this.stop();\n return new Promise((resolve) => {\n this.hasAnimated = true;\n this.animation = startAnimation(resolve);\n if (this.events.animationStart) {\n this.events.animationStart.notify();\n }\n }).then(() => {\n if (this.events.animationComplete) {\n this.events.animationComplete.notify();\n }\n this.clearAnimation();\n });\n }\n /**\n * Stop the currently active animation.\n *\n * @public\n */\n stop() {\n if (this.animation) {\n this.animation.stop();\n if (this.events.animationCancel) {\n this.events.animationCancel.notify();\n }\n }\n this.clearAnimation();\n }\n /**\n * Returns `true` if this value is currently animating.\n *\n * @public\n */\n isAnimating() {\n return !!this.animation;\n }\n clearAnimation() {\n delete this.animation;\n }\n /**\n * Destroy and clean up subscribers to this `MotionValue`.\n *\n * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n * created a `MotionValue` via the `motionValue` function.\n *\n * @public\n */\n destroy() {\n this.dependents?.clear();\n this.events.destroy?.notify();\n this.clearListeners();\n this.stop();\n if (this.stopPassiveEffect) {\n this.stopPassiveEffect();\n }\n }\n}\nfunction motionValue(init, options) {\n return new MotionValue(init, options);\n}\n\nexport { MotionValue, collectMotionValues, motionValue };\n//# sourceMappingURL=index.mjs.map\n","const isKeyframesTarget = (v) => {\n return Array.isArray(v);\n};\n\nexport { isKeyframesTarget };\n//# sourceMappingURL=is-keyframes-target.mjs.map\n","import { motionValue } from '../../value/index.mjs';\nimport { resolveVariant } from './resolve-dynamic-variants.mjs';\nimport { isKeyframesTarget } from './is-keyframes-target.mjs';\n\n/**\n * Set VisualElement's MotionValue, creating a new MotionValue for it if\n * it doesn't exist.\n */\nfunction setMotionValue(visualElement, key, value) {\n if (visualElement.hasValue(key)) {\n visualElement.getValue(key).set(value);\n }\n else {\n visualElement.addValue(key, motionValue(value));\n }\n}\nfunction resolveFinalValueInKeyframes(v) {\n // TODO maybe throw if v.length - 1 is placeholder token?\n return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;\n}\nfunction setTarget(visualElement, definition) {\n const resolved = resolveVariant(visualElement, definition);\n let { transitionEnd = {}, transition = {}, ...target } = resolved || {};\n target = { ...target, ...transitionEnd };\n for (const key in target) {\n const value = resolveFinalValueInKeyframes(target[key]);\n setMotionValue(visualElement, key, value);\n }\n}\n\nexport { setTarget };\n//# sourceMappingURL=setters.mjs.map\n","const isMotionValue = (value) => Boolean(value && value.getVelocity);\n\nexport { isMotionValue };\n//# sourceMappingURL=is-motion-value.mjs.map\n","import { isMotionValue } from '../utils/is-motion-value.mjs';\n\nfunction isWillChangeMotionValue(value) {\n return Boolean(isMotionValue(value) && value.add);\n}\n\nexport { isWillChangeMotionValue };\n//# sourceMappingURL=is.mjs.map\n","import { MotionGlobalConfig } from 'motion-utils';\nimport { isWillChangeMotionValue } from './is.mjs';\n\nfunction addValueToWillChange(visualElement, key) {\n const willChange = visualElement.getValue(\"willChange\");\n /**\n * It could be that a user has set willChange to a regular MotionValue,\n * in which case we can't add the value to it.\n */\n if (isWillChangeMotionValue(willChange)) {\n return willChange.add(key);\n }\n else if (!willChange && MotionGlobalConfig.WillChange) {\n const newWillChange = new MotionGlobalConfig.WillChange(\"auto\");\n visualElement.addValue(\"willChange\", newWillChange);\n newWillChange.add(key);\n }\n}\n\nexport { addValueToWillChange };\n//# sourceMappingURL=add-will-change.mjs.map\n","function camelToDash(str) {\n return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);\n}\n\nexport { camelToDash };\n//# sourceMappingURL=camel-to-dash.mjs.map\n","import { camelToDash } from '../../render/dom/utils/camel-to-dash.mjs';\n\nconst optimizedAppearDataId = \"framerAppearId\";\nconst optimizedAppearDataAttribute = \"data-\" + camelToDash(optimizedAppearDataId);\n\nexport { optimizedAppearDataAttribute, optimizedAppearDataId };\n//# sourceMappingURL=data-id.mjs.map\n","import { optimizedAppearDataAttribute } from './data-id.mjs';\n\nfunction getOptimisedAppearId(visualElement) {\n return visualElement.props[optimizedAppearDataAttribute];\n}\n\nexport { getOptimisedAppearId };\n//# sourceMappingURL=get-appear-id.mjs.map\n","import { getValueTransition } from '../utils/get-value-transition.mjs';\nimport { resolveTransition } from '../utils/resolve-transition.mjs';\nimport { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { setTarget } from '../../render/utils/setters.mjs';\nimport { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';\nimport { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';\nimport { animateMotionValue } from './motion-value.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\n\n/**\n * Decide whether we should block this animation. Previously, we achieved this\n * just by checking whether the key was listed in protectedKeys, but this\n * posed problems if an animation was triggered by afterChildren and protectedKeys\n * had been set to true in the meantime.\n */\nfunction shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {\n const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;\n needsAnimating[key] = false;\n return shouldBlock;\n}\nfunction animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {\n let { transition, transitionEnd, ...target } = targetAndTransition;\n const defaultTransition = visualElement.getDefaultTransition();\n transition = transition\n ? resolveTransition(transition, defaultTransition)\n : defaultTransition;\n const reduceMotion = transition?.reduceMotion;\n if (transitionOverride)\n transition = transitionOverride;\n const animations = [];\n const animationTypeState = type &&\n visualElement.animationState &&\n visualElement.animationState.getState()[type];\n for (const key in target) {\n const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);\n const valueTarget = target[key];\n if (valueTarget === undefined ||\n (animationTypeState &&\n shouldBlockAnimation(animationTypeState, key))) {\n continue;\n }\n const valueTransition = {\n delay,\n ...getValueTransition(transition || {}, key),\n };\n /**\n * If the value is already at the defined target, skip the animation.\n * We still re-assert the value via frame.update to take precedence\n * over any stale transitionEnd callbacks from previous animations.\n */\n const currentValue = value.get();\n if (currentValue !== undefined &&\n !value.isAnimating() &&\n !Array.isArray(valueTarget) &&\n valueTarget === currentValue &&\n !valueTransition.velocity) {\n frame.update(() => value.set(valueTarget));\n continue;\n }\n /**\n * If this is the first time a value is being animated, check\n * to see if we're handling off from an existing animation.\n */\n let isHandoff = false;\n if (window.MotionHandoffAnimation) {\n const appearId = getOptimisedAppearId(visualElement);\n if (appearId) {\n const startTime = window.MotionHandoffAnimation(appearId, key, frame);\n if (startTime !== null) {\n valueTransition.startTime = startTime;\n isHandoff = true;\n }\n }\n }\n addValueToWillChange(visualElement, key);\n const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion;\n value.start(animateMotionValue(key, value, valueTarget, shouldReduceMotion && positionalKeys.has(key)\n ? { type: false }\n : valueTransition, visualElement, isHandoff));\n const animation = value.animation;\n if (animation) {\n animations.push(animation);\n }\n }\n if (transitionEnd) {\n const applyTransitionEnd = () => frame.update(() => {\n transitionEnd && setTarget(visualElement, transitionEnd);\n });\n if (animations.length) {\n Promise.all(animations).then(applyTransitionEnd);\n }\n else {\n applyTransitionEnd();\n }\n }\n return animations;\n}\n\nexport { animateTarget };\n//# sourceMappingURL=visual-element-target.mjs.map\n","import { resolveVariant } from '../../render/utils/resolve-dynamic-variants.mjs';\nimport { calcChildStagger } from '../utils/calc-child-stagger.mjs';\nimport { animateTarget } from './visual-element-target.mjs';\n\nfunction animateVariant(visualElement, variant, options = {}) {\n const resolved = resolveVariant(visualElement, variant, options.type === \"exit\"\n ? visualElement.presenceContext?.custom\n : undefined);\n let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};\n if (options.transitionOverride) {\n transition = options.transitionOverride;\n }\n /**\n * If we have a variant, create a callback that runs it as an animation.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n const getAnimation = resolved\n ? () => Promise.all(animateTarget(visualElement, resolved, options))\n : () => Promise.resolve();\n /**\n * If we have children, create a callback that runs all their animations.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size\n ? (forwardDelay = 0) => {\n const { delayChildren = 0, staggerChildren, staggerDirection, } = transition;\n return animateChildren(visualElement, variant, forwardDelay, delayChildren, staggerChildren, staggerDirection, options);\n }\n : () => Promise.resolve();\n /**\n * If the transition explicitly defines a \"when\" option, we need to resolve either\n * this animation or all children animations before playing the other.\n */\n const { when } = transition;\n if (when) {\n const [first, last] = when === \"beforeChildren\"\n ? [getAnimation, getChildAnimations]\n : [getChildAnimations, getAnimation];\n return first().then(() => last());\n }\n else {\n return Promise.all([getAnimation(), getChildAnimations(options.delay)]);\n }\n}\nfunction animateChildren(visualElement, variant, delay = 0, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {\n const animations = [];\n for (const child of visualElement.variantChildren) {\n child.notify(\"AnimationStart\", variant);\n animations.push(animateVariant(child, variant, {\n ...options,\n delay: delay +\n (typeof delayChildren === \"function\" ? 0 : delayChildren) +\n calcChildStagger(visualElement.variantChildren, child, delayChildren, staggerChildren, staggerDirection),\n }).then(() => child.notify(\"AnimationComplete\", variant)));\n }\n return Promise.all(animations);\n}\n\nexport { animateVariant };\n//# sourceMappingURL=visual-element-variant.mjs.map\n","import { resolveVariant } from '../../render/utils/resolve-dynamic-variants.mjs';\nimport { animateTarget } from './visual-element-target.mjs';\nimport { animateVariant } from './visual-element-variant.mjs';\n\nfunction animateVisualElement(visualElement, definition, options = {}) {\n visualElement.notify(\"AnimationStart\", definition);\n let animation;\n if (Array.isArray(definition)) {\n const animations = definition.map((variant) => animateVariant(visualElement, variant, options));\n animation = Promise.all(animations);\n }\n else if (typeof definition === \"string\") {\n animation = animateVariant(visualElement, definition, options);\n }\n else {\n const resolvedDefinition = typeof definition === \"function\"\n ? resolveVariant(visualElement, definition, options.custom)\n : definition;\n animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));\n }\n return animation.then(() => {\n visualElement.notify(\"AnimationComplete\", definition);\n });\n}\n\nexport { animateVisualElement };\n//# sourceMappingURL=visual-element.mjs.map\n","/**\n * ValueType for \"auto\"\n */\nconst auto = {\n test: (v) => v === \"auto\",\n parse: (v) => v,\n};\n\nexport { auto };\n//# sourceMappingURL=auto.mjs.map\n","/**\n * Tests a provided value against a ValueType\n */\nconst testValueType = (v) => (type) => type.test(v);\n\nexport { testValueType };\n//# sourceMappingURL=test.mjs.map\n","import { auto } from './auto.mjs';\nimport { number } from './numbers/index.mjs';\nimport { px, percent, degrees, vw, vh } from './numbers/units.mjs';\nimport { testValueType } from './test.mjs';\n\n/**\n * A list of value types commonly used for dimensions\n */\nconst dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nconst findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));\n\nexport { dimensionValueTypes, findDimensionValueType };\n//# sourceMappingURL=dimensions.mjs.map\n","import { isZeroValueString } from 'motion-utils';\n\nfunction isNone(value) {\n if (typeof value === \"number\") {\n return value === 0;\n }\n else if (value !== null) {\n return value === \"none\" || value === \"0\" || isZeroValueString(value);\n }\n else {\n return true;\n }\n}\n\nexport { isNone };\n//# sourceMappingURL=is-none.mjs.map\n","import { complex } from './index.mjs';\nimport { floatRegex } from '../utils/float-regex.mjs';\n\n/**\n * Properties that should default to 1 or 100%\n */\nconst maxDefaults = new Set([\"brightness\", \"contrast\", \"saturate\", \"opacity\"]);\nfunction applyDefaultFilter(v) {\n const [name, value] = v.slice(0, -1).split(\"(\");\n if (name === \"drop-shadow\")\n return v;\n const [number] = value.match(floatRegex) || [];\n if (!number)\n return v;\n const unit = value.replace(number, \"\");\n let defaultValue = maxDefaults.has(name) ? 1 : 0;\n if (number !== value)\n defaultValue *= 100;\n return name + \"(\" + defaultValue + unit + \")\";\n}\nconst functionRegex = /\\b([a-z-]*)\\(.*?\\)/gu;\nconst filter = {\n ...complex,\n getAnimatableNone: (v) => {\n const functions = v.match(functionRegex);\n return functions ? functions.map(applyDefaultFilter).join(\" \") : v;\n },\n};\n\nexport { filter };\n//# sourceMappingURL=filter.mjs.map\n","import { complex } from './index.mjs';\n\nconst mask = {\n ...complex,\n getAnimatableNone: (v) => {\n const parsed = complex.parse(v);\n const transformer = complex.createTransformer(v);\n return transformer(parsed.map((v) => typeof v === \"number\" ? 0 : typeof v === \"object\" ? { ...v, alpha: 1 } : v));\n },\n};\n\nexport { mask };\n//# sourceMappingURL=mask.mjs.map\n","import { number } from './numbers/index.mjs';\n\nconst int = {\n ...number,\n transform: Math.round,\n};\n\nexport { int };\n//# sourceMappingURL=int.mjs.map\n","import { alpha, scale } from '../numbers/index.mjs';\nimport { px, progressPercentage, degrees } from '../numbers/units.mjs';\n\nconst transformValueTypes = {\n rotate: degrees,\n rotateX: degrees,\n rotateY: degrees,\n rotateZ: degrees,\n scale,\n scaleX: scale,\n scaleY: scale,\n scaleZ: scale,\n skew: degrees,\n skewX: degrees,\n skewY: degrees,\n distance: px,\n translateX: px,\n translateY: px,\n translateZ: px,\n x: px,\n y: px,\n z: px,\n perspective: px,\n transformPerspective: px,\n opacity: alpha,\n originX: progressPercentage,\n originY: progressPercentage,\n originZ: px,\n};\n\nexport { transformValueTypes };\n//# sourceMappingURL=transform.mjs.map\n","import { int } from '../int.mjs';\nimport { alpha } from '../numbers/index.mjs';\nimport { px } from '../numbers/units.mjs';\nimport { transformValueTypes } from './transform.mjs';\n\nconst numberValueTypes = {\n // Border props\n borderWidth: px,\n borderTopWidth: px,\n borderRightWidth: px,\n borderBottomWidth: px,\n borderLeftWidth: px,\n borderRadius: px,\n borderTopLeftRadius: px,\n borderTopRightRadius: px,\n borderBottomRightRadius: px,\n borderBottomLeftRadius: px,\n // Positioning props\n width: px,\n maxWidth: px,\n height: px,\n maxHeight: px,\n top: px,\n right: px,\n bottom: px,\n left: px,\n inset: px,\n insetBlock: px,\n insetBlockStart: px,\n insetBlockEnd: px,\n insetInline: px,\n insetInlineStart: px,\n insetInlineEnd: px,\n // Spacing props\n padding: px,\n paddingTop: px,\n paddingRight: px,\n paddingBottom: px,\n paddingLeft: px,\n paddingBlock: px,\n paddingBlockStart: px,\n paddingBlockEnd: px,\n paddingInline: px,\n paddingInlineStart: px,\n paddingInlineEnd: px,\n margin: px,\n marginTop: px,\n marginRight: px,\n marginBottom: px,\n marginLeft: px,\n marginBlock: px,\n marginBlockStart: px,\n marginBlockEnd: px,\n marginInline: px,\n marginInlineStart: px,\n marginInlineEnd: px,\n // Typography\n fontSize: px,\n // Misc\n backgroundPositionX: px,\n backgroundPositionY: px,\n ...transformValueTypes,\n zIndex: int,\n // SVG\n fillOpacity: alpha,\n strokeOpacity: alpha,\n numOctaves: int,\n};\n\nexport { numberValueTypes };\n//# sourceMappingURL=number.mjs.map\n","import { color } from '../color/index.mjs';\nimport { filter } from '../complex/filter.mjs';\nimport { mask } from '../complex/mask.mjs';\nimport { numberValueTypes } from './number.mjs';\n\n/**\n * A map of default value types for common values\n */\nconst defaultValueTypes = {\n ...numberValueTypes,\n // Color props\n color,\n backgroundColor: color,\n outlineColor: color,\n fill: color,\n stroke: color,\n // Border props\n borderColor: color,\n borderTopColor: color,\n borderRightColor: color,\n borderBottomColor: color,\n borderLeftColor: color,\n filter,\n WebkitFilter: filter,\n mask,\n WebkitMask: mask,\n};\n/**\n * Gets the default ValueType for the provided value key\n */\nconst getDefaultValueType = (key) => defaultValueTypes[key];\n\nexport { defaultValueTypes, getDefaultValueType };\n//# sourceMappingURL=defaults.mjs.map\n","import { complex } from '../complex/index.mjs';\nimport { filter } from '../complex/filter.mjs';\nimport { mask } from '../complex/mask.mjs';\nimport { getDefaultValueType } from '../maps/defaults.mjs';\n\nconst customTypes = /*@__PURE__*/ new Set([filter, mask]);\nfunction getAnimatableNone(key, value) {\n let defaultValueType = getDefaultValueType(key);\n if (!customTypes.has(defaultValueType))\n defaultValueType = complex;\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n return defaultValueType.getAnimatableNone\n ? defaultValueType.getAnimatableNone(value)\n : undefined;\n}\n\nexport { getAnimatableNone };\n//# sourceMappingURL=animatable-none.mjs.map\n","import { analyseComplexValue } from '../../../value/types/complex/index.mjs';\nimport { getAnimatableNone } from '../../../value/types/utils/animatable-none.mjs';\n\n/**\n * If we encounter keyframes like \"none\" or \"0\" and we also have keyframes like\n * \"#fff\" or \"200px 200px\" we want to find a keyframe to serve as a template for\n * the \"none\" keyframes. In this case \"#fff\" or \"200px 200px\" - then these get turned into\n * zero equivalents, i.e. \"#fff0\" or \"0px 0px\".\n */\nconst invalidTemplates = new Set([\"auto\", \"none\", \"0\"]);\nfunction makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {\n let i = 0;\n let animatableTemplate = undefined;\n while (i < unresolvedKeyframes.length && !animatableTemplate) {\n const keyframe = unresolvedKeyframes[i];\n if (typeof keyframe === \"string\" &&\n !invalidTemplates.has(keyframe) &&\n analyseComplexValue(keyframe).values.length) {\n animatableTemplate = unresolvedKeyframes[i];\n }\n i++;\n }\n if (animatableTemplate && name) {\n for (const noneIndex of noneKeyframeIndexes) {\n unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate);\n }\n }\n}\n\nexport { makeNoneKeyframesAnimatable };\n//# sourceMappingURL=make-none-animatable.mjs.map\n","import { positionalKeys } from '../../render/utils/keys-position.mjs';\nimport { findDimensionValueType } from '../../value/types/dimensions.mjs';\nimport { getVariableValue } from '../utils/css-variables-conversion.mjs';\nimport { isCSSVariableToken, containsCSSVariable } from '../utils/is-css-variable.mjs';\nimport { KeyframeResolver } from './KeyframesResolver.mjs';\nimport { isNone } from './utils/is-none.mjs';\nimport { makeNoneKeyframesAnimatable } from './utils/make-none-animatable.mjs';\nimport { positionalValues, isNumOrPxType } from './utils/unit-conversion.mjs';\n\nclass DOMKeyframesResolver extends KeyframeResolver {\n constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {\n super(unresolvedKeyframes, onComplete, name, motionValue, element, true);\n }\n readKeyframes() {\n const { unresolvedKeyframes, element, name } = this;\n if (!element || !element.current)\n return;\n super.readKeyframes();\n /**\n * If any keyframe is a CSS variable, we need to find its value by sampling the element\n */\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n let keyframe = unresolvedKeyframes[i];\n if (typeof keyframe === \"string\") {\n keyframe = keyframe.trim();\n if (isCSSVariableToken(keyframe)) {\n const resolved = getVariableValue(keyframe, element.current);\n if (resolved !== undefined) {\n unresolvedKeyframes[i] = resolved;\n }\n if (i === unresolvedKeyframes.length - 1) {\n this.finalKeyframe = keyframe;\n }\n }\n }\n }\n /**\n * Resolve \"none\" values. We do this potentially twice - once before and once after measuring keyframes.\n * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which\n * have a far bigger performance impact.\n */\n this.resolveNoneKeyframes();\n /**\n * Check to see if unit type has changed. If so schedule jobs that will\n * temporarily set styles to the destination keyframes.\n * Skip if we have more than two keyframes or this isn't a positional value.\n * TODO: We can throw if there are multiple keyframes and the value type changes.\n */\n if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {\n return;\n }\n const [origin, target] = unresolvedKeyframes;\n const originType = findDimensionValueType(origin);\n const targetType = findDimensionValueType(target);\n /**\n * If one keyframe contains embedded CSS variables (e.g. in calc()) and the other\n * doesn't, we need to measure to convert to pixels. This handles GitHub issue #3410.\n */\n const originHasVar = containsCSSVariable(origin);\n const targetHasVar = containsCSSVariable(target);\n if (originHasVar !== targetHasVar && positionalValues[name]) {\n this.needsMeasurement = true;\n return;\n }\n /**\n * Either we don't recognise these value types or we can animate between them.\n */\n if (originType === targetType)\n return;\n /**\n * If both values are numbers or pixels, we can animate between them by\n * converting them to numbers.\n */\n if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n const value = unresolvedKeyframes[i];\n if (typeof value === \"string\") {\n unresolvedKeyframes[i] = parseFloat(value);\n }\n }\n }\n else if (positionalValues[name]) {\n /**\n * Else, the only way to resolve this is by measuring the element.\n */\n this.needsMeasurement = true;\n }\n }\n resolveNoneKeyframes() {\n const { unresolvedKeyframes, name } = this;\n const noneKeyframeIndexes = [];\n for (let i = 0; i < unresolvedKeyframes.length; i++) {\n if (unresolvedKeyframes[i] === null ||\n isNone(unresolvedKeyframes[i])) {\n noneKeyframeIndexes.push(i);\n }\n }\n if (noneKeyframeIndexes.length) {\n makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);\n }\n }\n measureInitialState() {\n const { element, unresolvedKeyframes, name } = this;\n if (!element || !element.current)\n return;\n if (name === \"height\") {\n this.suspendedScrollY = window.pageYOffset;\n }\n this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));\n unresolvedKeyframes[0] = this.measuredOrigin;\n // Set final key frame to measure after next render\n const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];\n if (measureKeyframe !== undefined) {\n element.getValue(name, measureKeyframe).jump(measureKeyframe, false);\n }\n }\n measureEndState() {\n const { element, name, unresolvedKeyframes } = this;\n if (!element || !element.current)\n return;\n const value = element.getValue(name);\n value && value.jump(this.measuredOrigin, false);\n const finalKeyframeIndex = unresolvedKeyframes.length - 1;\n const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];\n unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));\n if (finalKeyframe !== null && this.finalKeyframe === undefined) {\n this.finalKeyframe = finalKeyframe;\n }\n // If we removed transform values, reapply them before the next render\n if (this.removedTransforms?.length) {\n this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {\n element\n .getValue(unsetTransformName)\n .set(unsetTransformValue);\n });\n }\n this.resolveNoneKeyframes();\n }\n}\n\nexport { DOMKeyframesResolver };\n//# sourceMappingURL=DOMKeyframesResolver.mjs.map\n","function resolveElements(elementOrSelector, scope, selectorCache) {\n if (elementOrSelector == null) {\n return [];\n }\n if (elementOrSelector instanceof EventTarget) {\n return [elementOrSelector];\n }\n else if (typeof elementOrSelector === \"string\") {\n let root = document;\n if (scope) {\n root = scope.current;\n }\n const elements = selectorCache?.[elementOrSelector] ??\n root.querySelectorAll(elementOrSelector);\n return elements ? Array.from(elements) : [];\n }\n return Array.from(elementOrSelector).filter((element) => element != null);\n}\n\nexport { resolveElements };\n//# sourceMappingURL=resolve-elements.mjs.map\n","/**\n * Provided a value and a ValueType, returns the value as that value type.\n */\nconst getValueAsType = (value, type) => {\n return type && typeof value === \"number\"\n ? type.transform(value)\n : value;\n};\n\nexport { getValueAsType };\n//# sourceMappingURL=get-as-type.mjs.map\n","import { isObject } from 'motion-utils';\n\n/**\n * Checks if an element is an HTML element in a way\n * that works across iframes\n */\nfunction isHTMLElement(element) {\n return (isObject(element) &&\n \"offsetHeight\" in element &&\n !(\"ownerSVGElement\" in element));\n}\n\nexport { isHTMLElement };\n//# sourceMappingURL=is-html-element.mjs.map\n","import { createRenderBatcher } from './batcher.mjs';\n\nconst { schedule: microtask, cancel: cancelMicrotask } = \n/* @__PURE__ */ createRenderBatcher(queueMicrotask, false);\n\nexport { cancelMicrotask, microtask };\n//# sourceMappingURL=microtask.mjs.map\n","const isDragging = {\n x: false,\n y: false,\n};\nfunction isDragActive() {\n return isDragging.x || isDragging.y;\n}\n\nexport { isDragActive, isDragging };\n//# sourceMappingURL=is-active.mjs.map\n","import { isDragging } from './is-active.mjs';\n\nfunction setDragLock(axis) {\n if (axis === \"x\" || axis === \"y\") {\n if (isDragging[axis]) {\n return null;\n }\n else {\n isDragging[axis] = true;\n return () => {\n isDragging[axis] = false;\n };\n }\n }\n else {\n if (isDragging.x || isDragging.y) {\n return null;\n }\n else {\n isDragging.x = isDragging.y = true;\n return () => {\n isDragging.x = isDragging.y = false;\n };\n }\n }\n}\n\nexport { setDragLock };\n//# sourceMappingURL=set-active.mjs.map\n","import { resolveElements } from '../../utils/resolve-elements.mjs';\n\nfunction setupGesture(elementOrSelector, options) {\n const elements = resolveElements(elementOrSelector);\n const gestureAbortController = new AbortController();\n const eventOptions = {\n passive: true,\n ...options,\n signal: gestureAbortController.signal,\n };\n const cancel = () => gestureAbortController.abort();\n return [elements, eventOptions, cancel];\n}\n\nexport { setupGesture };\n//# sourceMappingURL=setup.mjs.map\n","import { isDragActive } from './drag/state/is-active.mjs';\nimport { setupGesture } from './utils/setup.mjs';\n\nfunction isValidHover(event) {\n return !(event.pointerType === \"touch\" || isDragActive());\n}\n/**\n * Create a hover gesture. hover() is different to .addEventListener(\"pointerenter\")\n * in that it has an easier syntax, filters out polyfilled touch events, interoperates\n * with drag gestures, and automatically removes the \"pointerennd\" event listener when the hover ends.\n *\n * @public\n */\nfunction hover(elementOrSelector, onHoverStart, options = {}) {\n const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);\n elements.forEach((element) => {\n let isPressed = false;\n let deferredHoverEnd = false;\n let hoverEndCallback;\n const removePointerLeave = () => {\n element.removeEventListener(\"pointerleave\", onPointerLeave);\n };\n const endHover = (event) => {\n if (hoverEndCallback) {\n hoverEndCallback(event);\n hoverEndCallback = undefined;\n }\n removePointerLeave();\n };\n const onPointerUp = (event) => {\n isPressed = false;\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerUp);\n if (deferredHoverEnd) {\n deferredHoverEnd = false;\n endHover(event);\n }\n };\n const onPointerDown = () => {\n isPressed = true;\n window.addEventListener(\"pointerup\", onPointerUp, eventOptions);\n window.addEventListener(\"pointercancel\", onPointerUp, eventOptions);\n };\n const onPointerLeave = (leaveEvent) => {\n if (leaveEvent.pointerType === \"touch\")\n return;\n if (isPressed) {\n deferredHoverEnd = true;\n return;\n }\n endHover(leaveEvent);\n };\n const onPointerEnter = (enterEvent) => {\n if (!isValidHover(enterEvent))\n return;\n deferredHoverEnd = false;\n const onHoverEnd = onHoverStart(element, enterEvent);\n if (typeof onHoverEnd !== \"function\")\n return;\n hoverEndCallback = onHoverEnd;\n element.addEventListener(\"pointerleave\", onPointerLeave, eventOptions);\n };\n element.addEventListener(\"pointerenter\", onPointerEnter, eventOptions);\n element.addEventListener(\"pointerdown\", onPointerDown, eventOptions);\n });\n return cancel;\n}\n\nexport { hover };\n//# sourceMappingURL=hover.mjs.map\n","/**\n * Recursively traverse up the tree to check whether the provided child node\n * is the parent or a descendant of it.\n *\n * @param parent - Element to find\n * @param child - Element to test against parent\n */\nconst isNodeOrChild = (parent, child) => {\n if (!child) {\n return false;\n }\n else if (parent === child) {\n return true;\n }\n else {\n return isNodeOrChild(parent, child.parentElement);\n }\n};\n\nexport { isNodeOrChild };\n//# sourceMappingURL=is-node-or-child.mjs.map\n","const isPrimaryPointer = (event) => {\n if (event.pointerType === \"mouse\") {\n return typeof event.button !== \"number\" || event.button <= 0;\n }\n else {\n /**\n * isPrimary is true for all mice buttons, whereas every touch point\n * is regarded as its own input. So subsequent concurrent touch points\n * will be false.\n *\n * Specifically match against false here as incomplete versions of\n * PointerEvents in very old browser might have it set as undefined.\n */\n return event.isPrimary !== false;\n }\n};\n\nexport { isPrimaryPointer };\n//# sourceMappingURL=is-primary-pointer.mjs.map\n","const keyboardAccessibleElements = new Set([\n \"BUTTON\",\n \"INPUT\",\n \"SELECT\",\n \"TEXTAREA\",\n \"A\",\n]);\n/**\n * Checks if an element is natively keyboard accessible (focusable).\n * Used by the press gesture to determine if we need to add tabIndex.\n */\nfunction isElementKeyboardAccessible(element) {\n return (keyboardAccessibleElements.has(element.tagName) ||\n element.isContentEditable === true);\n}\nconst textInputElements = new Set([\"INPUT\", \"SELECT\", \"TEXTAREA\"]);\n/**\n * Checks if an element has text selection or direct interaction behavior\n * that should block drag gestures from starting.\n *\n * This specifically targets form controls where the user might want to select\n * text or interact with the control (e.g., sliders, dropdowns).\n *\n * Buttons and links are NOT included because they don't have click-and-move\n * actions of their own - they only respond to click events, so dragging\n * should still work when initiated from these elements.\n */\nfunction isElementTextInput(element) {\n return (textInputElements.has(element.tagName) ||\n element.isContentEditable === true);\n}\n\nexport { isElementKeyboardAccessible, isElementTextInput };\n//# sourceMappingURL=is-keyboard-accessible.mjs.map\n","const isPressing = new WeakSet();\n\nexport { isPressing };\n//# sourceMappingURL=state.mjs.map\n","import { isPressing } from './state.mjs';\n\n/**\n * Filter out events that are not \"Enter\" keys.\n */\nfunction filterEvents(callback) {\n return (event) => {\n if (event.key !== \"Enter\")\n return;\n callback(event);\n };\n}\nfunction firePointerEvent(target, type) {\n target.dispatchEvent(new PointerEvent(\"pointer\" + type, { isPrimary: true, bubbles: true }));\n}\nconst enableKeyboardPress = (focusEvent, eventOptions) => {\n const element = focusEvent.currentTarget;\n if (!element)\n return;\n const handleKeydown = filterEvents(() => {\n if (isPressing.has(element))\n return;\n firePointerEvent(element, \"down\");\n const handleKeyup = filterEvents(() => {\n firePointerEvent(element, \"up\");\n });\n const handleBlur = () => firePointerEvent(element, \"cancel\");\n element.addEventListener(\"keyup\", handleKeyup, eventOptions);\n element.addEventListener(\"blur\", handleBlur, eventOptions);\n });\n element.addEventListener(\"keydown\", handleKeydown, eventOptions);\n /**\n * Add an event listener that fires on blur to remove the keydown events.\n */\n element.addEventListener(\"blur\", () => element.removeEventListener(\"keydown\", handleKeydown), eventOptions);\n};\n\nexport { enableKeyboardPress };\n//# sourceMappingURL=keyboard.mjs.map\n","import { isHTMLElement } from '../../utils/is-html-element.mjs';\nimport { isDragActive } from '../drag/state/is-active.mjs';\nimport { isNodeOrChild } from '../utils/is-node-or-child.mjs';\nimport { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';\nimport { setupGesture } from '../utils/setup.mjs';\nimport { isElementKeyboardAccessible } from './utils/is-keyboard-accessible.mjs';\nimport { enableKeyboardPress } from './utils/keyboard.mjs';\nimport { isPressing } from './utils/state.mjs';\n\n/**\n * Filter out events that are not primary pointer events, or are triggering\n * while a Motion gesture is active.\n */\nfunction isValidPressEvent(event) {\n return isPrimaryPointer(event) && !isDragActive();\n}\nconst claimedPointerDownEvents = new WeakSet();\n/**\n * Create a press gesture.\n *\n * Press is different to `\"pointerdown\"`, `\"pointerup\"` in that it\n * automatically filters out secondary pointer events like right\n * click and multitouch.\n *\n * It also adds accessibility support for keyboards, where\n * an element with a press gesture will receive focus and\n * trigger on Enter `\"keydown\"` and `\"keyup\"` events.\n *\n * This is different to a browser's `\"click\"` event, which does\n * respond to keyboards but only for the `\"click\"` itself, rather\n * than the press start and end/cancel. The element also needs\n * to be focusable for this to work, whereas a press gesture will\n * make an element focusable by default.\n *\n * @public\n */\nfunction press(targetOrSelector, onPressStart, options = {}) {\n const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);\n const startPress = (startEvent) => {\n const target = startEvent.currentTarget;\n if (!isValidPressEvent(startEvent))\n return;\n if (claimedPointerDownEvents.has(startEvent))\n return;\n isPressing.add(target);\n if (options.stopPropagation) {\n claimedPointerDownEvents.add(startEvent);\n }\n const onPressEnd = onPressStart(target, startEvent);\n const onPointerEnd = (endEvent, success) => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n if (isPressing.has(target)) {\n isPressing.delete(target);\n }\n if (!isValidPressEvent(endEvent)) {\n return;\n }\n if (typeof onPressEnd === \"function\") {\n onPressEnd(endEvent, { success });\n }\n };\n const onPointerUp = (upEvent) => {\n onPointerEnd(upEvent, target === window ||\n target === document ||\n options.useGlobalTarget ||\n isNodeOrChild(target, upEvent.target));\n };\n const onPointerCancel = (cancelEvent) => {\n onPointerEnd(cancelEvent, false);\n };\n window.addEventListener(\"pointerup\", onPointerUp, eventOptions);\n window.addEventListener(\"pointercancel\", onPointerCancel, eventOptions);\n };\n targets.forEach((target) => {\n const pointerDownTarget = options.useGlobalTarget ? window : target;\n pointerDownTarget.addEventListener(\"pointerdown\", startPress, eventOptions);\n if (isHTMLElement(target)) {\n target.addEventListener(\"focus\", (event) => enableKeyboardPress(event, eventOptions));\n if (!isElementKeyboardAccessible(target) &&\n !target.hasAttribute(\"tabindex\")) {\n target.tabIndex = 0;\n }\n }\n });\n return cancelEvents;\n}\n\nexport { press };\n//# sourceMappingURL=index.mjs.map\n","import { isObject } from 'motion-utils';\n\n/**\n * Checks if an element is an SVG element in a way\n * that works across iframes\n */\nfunction isSVGElement(element) {\n return isObject(element) && \"ownerSVGElement\" in element;\n}\n\nexport { isSVGElement };\n//# sourceMappingURL=is-svg-element.mjs.map\n","import { isSVGElement } from '../utils/is-svg-element.mjs';\nimport { resolveElements } from '../utils/resolve-elements.mjs';\n\nconst resizeHandlers = new WeakMap();\nlet observer;\nconst getSize = (borderBoxAxis, svgAxis, htmlAxis) => (target, borderBoxSize) => {\n if (borderBoxSize && borderBoxSize[0]) {\n return borderBoxSize[0][(borderBoxAxis + \"Size\")];\n }\n else if (isSVGElement(target) && \"getBBox\" in target) {\n return target.getBBox()[svgAxis];\n }\n else {\n return target[htmlAxis];\n }\n};\nconst getWidth = /*@__PURE__*/ getSize(\"inline\", \"width\", \"offsetWidth\");\nconst getHeight = /*@__PURE__*/ getSize(\"block\", \"height\", \"offsetHeight\");\nfunction notifyTarget({ target, borderBoxSize }) {\n resizeHandlers.get(target)?.forEach((handler) => {\n handler(target, {\n get width() {\n return getWidth(target, borderBoxSize);\n },\n get height() {\n return getHeight(target, borderBoxSize);\n },\n });\n });\n}\nfunction notifyAll(entries) {\n entries.forEach(notifyTarget);\n}\nfunction createResizeObserver() {\n if (typeof ResizeObserver === \"undefined\")\n return;\n observer = new ResizeObserver(notifyAll);\n}\nfunction resizeElement(target, handler) {\n if (!observer)\n createResizeObserver();\n const elements = resolveElements(target);\n elements.forEach((element) => {\n let elementHandlers = resizeHandlers.get(element);\n if (!elementHandlers) {\n elementHandlers = new Set();\n resizeHandlers.set(element, elementHandlers);\n }\n elementHandlers.add(handler);\n observer?.observe(element);\n });\n return () => {\n elements.forEach((element) => {\n const elementHandlers = resizeHandlers.get(element);\n elementHandlers?.delete(handler);\n if (!elementHandlers?.size) {\n observer?.unobserve(element);\n }\n });\n };\n}\n\nexport { resizeElement };\n//# sourceMappingURL=handle-element.mjs.map\n","const windowCallbacks = new Set();\nlet windowResizeHandler;\nfunction createWindowResizeHandler() {\n windowResizeHandler = () => {\n const info = {\n get width() {\n return window.innerWidth;\n },\n get height() {\n return window.innerHeight;\n },\n };\n windowCallbacks.forEach((callback) => callback(info));\n };\n window.addEventListener(\"resize\", windowResizeHandler);\n}\nfunction resizeWindow(callback) {\n windowCallbacks.add(callback);\n if (!windowResizeHandler)\n createWindowResizeHandler();\n return () => {\n windowCallbacks.delete(callback);\n if (!windowCallbacks.size &&\n typeof windowResizeHandler === \"function\") {\n window.removeEventListener(\"resize\", windowResizeHandler);\n windowResizeHandler = undefined;\n }\n };\n}\n\nexport { resizeWindow };\n//# sourceMappingURL=handle-window.mjs.map\n","import { resizeElement } from './handle-element.mjs';\nimport { resizeWindow } from './handle-window.mjs';\n\nfunction resize(a, b) {\n return typeof a === \"function\" ? resizeWindow(a) : resizeElement(a, b);\n}\n\nexport { resize };\n//# sourceMappingURL=index.mjs.map\n","import { isSVGElement } from './is-svg-element.mjs';\n\n/**\n * Checks if an element is specifically an SVGSVGElement (the root SVG element)\n * in a way that works across iframes\n */\nfunction isSVGSVGElement(element) {\n return isSVGElement(element) && element.tagName === \"svg\";\n}\n\nexport { isSVGSVGElement };\n//# sourceMappingURL=is-svg-svg-element.mjs.map\n","import { color } from '../color/index.mjs';\nimport { complex } from '../complex/index.mjs';\nimport { dimensionValueTypes } from '../dimensions.mjs';\nimport { testValueType } from '../test.mjs';\n\n/**\n * A list of all ValueTypes\n */\nconst valueTypes = [...dimensionValueTypes, color, complex];\n/**\n * Tests a value against the list of ValueTypes\n */\nconst findValueType = (v) => valueTypes.find(testValueType(v));\n\nexport { findValueType };\n//# sourceMappingURL=find.mjs.map\n","const createAxisDelta = () => ({\n translate: 0,\n scale: 1,\n origin: 0,\n originPoint: 0,\n});\nconst createDelta = () => ({\n x: createAxisDelta(),\n y: createAxisDelta(),\n});\nconst createAxis = () => ({ min: 0, max: 0 });\nconst createBox = () => ({\n x: createAxis(),\n y: createAxis(),\n});\n\nexport { createAxis, createAxisDelta, createBox, createDelta };\n//# sourceMappingURL=models.mjs.map\n","const visualElementStore = new WeakMap();\n\nexport { visualElementStore };\n//# sourceMappingURL=store.mjs.map\n","function isAnimationControls(v) {\n return (v !== null &&\n typeof v === \"object\" &&\n typeof v.start === \"function\");\n}\n\nexport { isAnimationControls };\n//# sourceMappingURL=is-animation-controls.mjs.map\n","/**\n * Decides if the supplied variable is variant label\n */\nfunction isVariantLabel(v) {\n return typeof v === \"string\" || Array.isArray(v);\n}\n\nexport { isVariantLabel };\n//# sourceMappingURL=is-variant-label.mjs.map\n","const variantPriorityOrder = [\n \"animate\",\n \"whileInView\",\n \"whileFocus\",\n \"whileHover\",\n \"whileTap\",\n \"whileDrag\",\n \"exit\",\n];\nconst variantProps = [\"initial\", ...variantPriorityOrder];\n\nexport { variantPriorityOrder, variantProps };\n//# sourceMappingURL=variant-props.mjs.map\n","import { isAnimationControls } from './is-animation-controls.mjs';\nimport { isVariantLabel } from './is-variant-label.mjs';\nimport { variantProps } from './variant-props.mjs';\n\nfunction isControllingVariants(props) {\n return (isAnimationControls(props.animate) ||\n variantProps.some((name) => isVariantLabel(props[name])));\n}\nfunction isVariantNode(props) {\n return Boolean(isControllingVariants(props) || props.variants);\n}\n\nexport { isControllingVariants, isVariantNode };\n//# sourceMappingURL=is-controlling-variants.mjs.map\n","import { motionValue } from '../../value/index.mjs';\nimport { isMotionValue } from '../../value/utils/is-motion-value.mjs';\n\n/**\n * Updates motion values from props changes.\n * Uses `any` type for element to avoid circular dependencies with VisualElement.\n */\nfunction updateMotionValuesFromProps(element, next, prev) {\n for (const key in next) {\n const nextValue = next[key];\n const prevValue = prev[key];\n if (isMotionValue(nextValue)) {\n /**\n * If this is a motion value found in props or style, we want to add it\n * to our visual element's motion value map.\n */\n element.addValue(key, nextValue);\n }\n else if (isMotionValue(prevValue)) {\n /**\n * If we're swapping from a motion value to a static value,\n * create a new motion value from that\n */\n element.addValue(key, motionValue(nextValue, { owner: element }));\n }\n else if (prevValue !== nextValue) {\n /**\n * If this is a flat value that has changed, update the motion value\n * or create one if it doesn't exist. We only want to do this if we're\n * not handling the value with our animation state.\n */\n if (element.hasValue(key)) {\n const existingValue = element.getValue(key);\n if (existingValue.liveStyle === true) {\n existingValue.jump(nextValue);\n }\n else if (!existingValue.hasAnimated) {\n existingValue.set(nextValue);\n }\n }\n else {\n const latestValue = element.getStaticValue(key);\n element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));\n }\n }\n }\n // Handle removed values\n for (const key in prev) {\n if (next[key] === undefined)\n element.removeValue(key);\n }\n return next;\n}\n\nexport { updateMotionValuesFromProps };\n//# sourceMappingURL=motion-values.mjs.map\n","// Does this device prefer reduced motion? Returns `null` server-side.\nconst prefersReducedMotion = { current: null };\nconst hasReducedMotionListener = { current: false };\n\nexport { hasReducedMotionListener, prefersReducedMotion };\n//# sourceMappingURL=state.mjs.map\n","import { hasReducedMotionListener, prefersReducedMotion } from './state.mjs';\n\nconst isBrowser = typeof window !== \"undefined\";\nfunction initPrefersReducedMotion() {\n hasReducedMotionListener.current = true;\n if (!isBrowser)\n return;\n if (window.matchMedia) {\n const motionMediaQuery = window.matchMedia(\"(prefers-reduced-motion)\");\n const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);\n motionMediaQuery.addEventListener(\"change\", setReducedMotionPreferences);\n setReducedMotionPreferences();\n }\n else {\n prefersReducedMotion.current = false;\n }\n}\n\nexport { hasReducedMotionListener, initPrefersReducedMotion, prefersReducedMotion };\n//# sourceMappingURL=index.mjs.map\n","import { warnOnce, secondsToMilliseconds, isNumericalString, isZeroValueString, SubscriptionManager } from 'motion-utils';\nimport { KeyframeResolver } from '../animation/keyframes/KeyframesResolver.mjs';\nimport { NativeAnimation } from '../animation/NativeAnimation.mjs';\nimport { acceleratedValues } from '../animation/waapi/utils/accelerated-values.mjs';\nimport { microtask } from '../frameloop/microtask.mjs';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { createBox } from '../projection/geometry/models.mjs';\nimport { motionValue } from '../value/index.mjs';\nimport { complex } from '../value/types/complex/index.mjs';\nimport { getAnimatableNone } from '../value/types/utils/animatable-none.mjs';\nimport { findValueType } from '../value/types/utils/find.mjs';\nimport { isMotionValue } from '../value/utils/is-motion-value.mjs';\nimport { visualElementStore } from './store.mjs';\nimport { isControllingVariants, isVariantNode } from './utils/is-controlling-variants.mjs';\nimport { transformProps } from './utils/keys-transform.mjs';\nimport { updateMotionValuesFromProps } from './utils/motion-values.mjs';\nimport { initPrefersReducedMotion } from './utils/reduced-motion/index.mjs';\nimport { resolveVariantFromProps } from './utils/resolve-variants.mjs';\nimport { hasReducedMotionListener, prefersReducedMotion } from './utils/reduced-motion/state.mjs';\nimport { frame, cancelFrame } from '../frameloop/frame.mjs';\n\nconst propEventHandlers = [\n \"AnimationStart\",\n \"AnimationComplete\",\n \"Update\",\n \"BeforeLayoutMeasure\",\n \"LayoutMeasure\",\n \"LayoutAnimationStart\",\n \"LayoutAnimationComplete\",\n];\n/**\n * Static feature definitions - can be injected by framework layer\n */\nlet featureDefinitions = {};\n/**\n * Set feature definitions for all VisualElements.\n * This should be called by the framework layer (e.g., framer-motion) during initialization.\n */\nfunction setFeatureDefinitions(definitions) {\n featureDefinitions = definitions;\n}\n/**\n * Get the current feature definitions\n */\nfunction getFeatureDefinitions() {\n return featureDefinitions;\n}\n/**\n * A VisualElement is an imperative abstraction around UI elements such as\n * HTMLElement, SVGElement, Three.Object3D etc.\n */\nclass VisualElement {\n /**\n * This method takes React props and returns found MotionValues. For example, HTML\n * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.\n *\n * This isn't an abstract method as it needs calling in the constructor, but it is\n * intended to be one.\n */\n scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {\n return {};\n }\n constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState, }, options = {}) {\n /**\n * A reference to the current underlying Instance, e.g. a HTMLElement\n * or Three.Mesh etc.\n */\n this.current = null;\n /**\n * A set containing references to this VisualElement's children.\n */\n this.children = new Set();\n /**\n * Determine what role this visual element should take in the variant tree.\n */\n this.isVariantNode = false;\n this.isControllingVariants = false;\n /**\n * Decides whether this VisualElement should animate in reduced motion\n * mode.\n *\n * TODO: This is currently set on every individual VisualElement but feels\n * like it could be set globally.\n */\n this.shouldReduceMotion = null;\n /**\n * Decides whether animations should be skipped for this VisualElement.\n * Useful for E2E tests and visual regression testing.\n */\n this.shouldSkipAnimations = false;\n /**\n * A map of all motion values attached to this visual element. Motion\n * values are source of truth for any given animated value. A motion\n * value might be provided externally by the component via props.\n */\n this.values = new Map();\n this.KeyframeResolver = KeyframeResolver;\n /**\n * Cleanup functions for active features (hover/tap/exit etc)\n */\n this.features = {};\n /**\n * A map of every subscription that binds the provided or generated\n * motion values onChange listeners to this visual element.\n */\n this.valueSubscriptions = new Map();\n /**\n * A reference to the previously-provided motion values as returned\n * from scrapeMotionValuesFromProps. We use the keys in here to determine\n * if any motion values need to be removed after props are updated.\n */\n this.prevMotionValues = {};\n /**\n * Track whether this element has been mounted before, to detect\n * remounts after Suspense unmount/remount cycles.\n */\n this.hasBeenMounted = false;\n /**\n * An object containing a SubscriptionManager for each active event.\n */\n this.events = {};\n /**\n * An object containing an unsubscribe function for each prop event subscription.\n * For example, every \"Update\" event can have multiple subscribers via\n * VisualElement.on(), but only one of those can be defined via the onUpdate prop.\n */\n this.propEventSubscriptions = {};\n this.notifyUpdate = () => this.notify(\"Update\", this.latestValues);\n this.render = () => {\n if (!this.current)\n return;\n this.triggerBuild();\n this.renderInstance(this.current, this.renderState, this.props.style, this.projection);\n };\n this.renderScheduledAt = 0.0;\n this.scheduleRender = () => {\n const now = time.now();\n if (this.renderScheduledAt < now) {\n this.renderScheduledAt = now;\n frame.render(this.render, false, true);\n }\n };\n const { latestValues, renderState } = visualState;\n this.latestValues = latestValues;\n this.baseTarget = { ...latestValues };\n this.initialValues = props.initial ? { ...latestValues } : {};\n this.renderState = renderState;\n this.parent = parent;\n this.props = props;\n this.presenceContext = presenceContext;\n this.depth = parent ? parent.depth + 1 : 0;\n this.reducedMotionConfig = reducedMotionConfig;\n this.skipAnimationsConfig = skipAnimations;\n this.options = options;\n this.blockInitialAnimation = Boolean(blockInitialAnimation);\n this.isControllingVariants = isControllingVariants(props);\n this.isVariantNode = isVariantNode(props);\n if (this.isVariantNode) {\n this.variantChildren = new Set();\n }\n this.manuallyAnimateOnMount = Boolean(parent && parent.current);\n /**\n * Any motion values that are provided to the element when created\n * aren't yet bound to the element, as this would technically be impure.\n * However, we iterate through the motion values and set them to the\n * initial values for this component.\n *\n * TODO: This is impure and we should look at changing this to run on mount.\n * Doing so will break some tests but this isn't necessarily a breaking change,\n * more a reflection of the test.\n */\n const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);\n for (const key in initialMotionValues) {\n const value = initialMotionValues[key];\n if (latestValues[key] !== undefined && isMotionValue(value)) {\n value.set(latestValues[key]);\n }\n }\n }\n mount(instance) {\n /**\n * If this element has been mounted before (e.g. after a Suspense\n * unmount/remount), reset motion values to their initial state\n * so animations replay correctly from initial → animate.\n */\n if (this.hasBeenMounted) {\n for (const key in this.initialValues) {\n this.values.get(key)?.jump(this.initialValues[key]);\n this.latestValues[key] = this.initialValues[key];\n }\n }\n this.current = instance;\n visualElementStore.set(instance, this);\n if (this.projection && !this.projection.instance) {\n this.projection.mount(instance);\n }\n if (this.parent && this.isVariantNode && !this.isControllingVariants) {\n this.removeFromVariantTree = this.parent.addVariantChild(this);\n }\n this.values.forEach((value, key) => this.bindToMotionValue(key, value));\n /**\n * Determine reduced motion preference. Only initialize the matchMedia\n * listener if we actually need the dynamic value (i.e., when config\n * is neither \"never\" nor \"always\").\n */\n if (this.reducedMotionConfig === \"never\") {\n this.shouldReduceMotion = false;\n }\n else if (this.reducedMotionConfig === \"always\") {\n this.shouldReduceMotion = true;\n }\n else {\n if (!hasReducedMotionListener.current) {\n initPrefersReducedMotion();\n }\n this.shouldReduceMotion = prefersReducedMotion.current;\n }\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(this.shouldReduceMotion !== true, \"You have Reduced Motion enabled on your device. Animations may not appear as expected.\", \"reduced-motion-disabled\");\n }\n /**\n * Set whether animations should be skipped based on the config.\n */\n this.shouldSkipAnimations = this.skipAnimationsConfig ?? false;\n this.parent?.addChild(this);\n this.update(this.props, this.presenceContext);\n this.hasBeenMounted = true;\n }\n unmount() {\n this.projection && this.projection.unmount();\n cancelFrame(this.notifyUpdate);\n cancelFrame(this.render);\n this.valueSubscriptions.forEach((remove) => remove());\n this.valueSubscriptions.clear();\n this.removeFromVariantTree && this.removeFromVariantTree();\n this.parent?.removeChild(this);\n for (const key in this.events) {\n this.events[key].clear();\n }\n for (const key in this.features) {\n const feature = this.features[key];\n if (feature) {\n feature.unmount();\n feature.isMounted = false;\n }\n }\n this.current = null;\n }\n addChild(child) {\n this.children.add(child);\n this.enteringChildren ?? (this.enteringChildren = new Set());\n this.enteringChildren.add(child);\n }\n removeChild(child) {\n this.children.delete(child);\n this.enteringChildren && this.enteringChildren.delete(child);\n }\n bindToMotionValue(key, value) {\n if (this.valueSubscriptions.has(key)) {\n this.valueSubscriptions.get(key)();\n }\n if (value.accelerate &&\n acceleratedValues.has(key) &&\n this.current instanceof HTMLElement) {\n const { factory, keyframes, times, ease, duration } = value.accelerate;\n const animation = new NativeAnimation({\n element: this.current,\n name: key,\n keyframes,\n times,\n ease,\n duration: secondsToMilliseconds(duration),\n });\n const cleanup = factory(animation);\n this.valueSubscriptions.set(key, () => {\n cleanup();\n animation.cancel();\n });\n return;\n }\n const valueIsTransform = transformProps.has(key);\n if (valueIsTransform && this.onBindTransform) {\n this.onBindTransform();\n }\n const removeOnChange = value.on(\"change\", (latestValue) => {\n this.latestValues[key] = latestValue;\n this.props.onUpdate && frame.preRender(this.notifyUpdate);\n if (valueIsTransform && this.projection) {\n this.projection.isTransformDirty = true;\n }\n this.scheduleRender();\n });\n let removeSyncCheck;\n if (typeof window !== \"undefined\" &&\n window.MotionCheckAppearSync) {\n removeSyncCheck = window.MotionCheckAppearSync(this, key, value);\n }\n this.valueSubscriptions.set(key, () => {\n removeOnChange();\n if (removeSyncCheck)\n removeSyncCheck();\n if (value.owner)\n value.stop();\n });\n }\n sortNodePosition(other) {\n /**\n * If these nodes aren't even of the same type we can't compare their depth.\n */\n if (!this.current ||\n !this.sortInstanceNodePosition ||\n this.type !== other.type) {\n return 0;\n }\n return this.sortInstanceNodePosition(this.current, other.current);\n }\n updateFeatures() {\n let key = \"animation\";\n for (key in featureDefinitions) {\n const featureDefinition = featureDefinitions[key];\n if (!featureDefinition)\n continue;\n const { isEnabled, Feature: FeatureConstructor } = featureDefinition;\n /**\n * If this feature is enabled but not active, make a new instance.\n */\n if (!this.features[key] &&\n FeatureConstructor &&\n isEnabled(this.props)) {\n this.features[key] = new FeatureConstructor(this);\n }\n /**\n * If we have a feature, mount or update it.\n */\n if (this.features[key]) {\n const feature = this.features[key];\n if (feature.isMounted) {\n feature.update();\n }\n else {\n feature.mount();\n feature.isMounted = true;\n }\n }\n }\n }\n triggerBuild() {\n this.build(this.renderState, this.latestValues, this.props);\n }\n /**\n * Measure the current viewport box with or without transforms.\n * Only measures axis-aligned boxes, rotate and skew must be manually\n * removed with a re-render to work.\n */\n measureViewportBox() {\n return this.current\n ? this.measureInstanceViewportBox(this.current, this.props)\n : createBox();\n }\n getStaticValue(key) {\n return this.latestValues[key];\n }\n setStaticValue(key, value) {\n this.latestValues[key] = value;\n }\n /**\n * Update the provided props. Ensure any newly-added motion values are\n * added to our map, old ones removed, and listeners updated.\n */\n update(props, presenceContext) {\n if (props.transformTemplate || this.props.transformTemplate) {\n this.scheduleRender();\n }\n this.prevProps = this.props;\n this.props = props;\n this.prevPresenceContext = this.presenceContext;\n this.presenceContext = presenceContext;\n /**\n * Update prop event handlers ie onAnimationStart, onAnimationComplete\n */\n for (let i = 0; i < propEventHandlers.length; i++) {\n const key = propEventHandlers[i];\n if (this.propEventSubscriptions[key]) {\n this.propEventSubscriptions[key]();\n delete this.propEventSubscriptions[key];\n }\n const listenerName = (\"on\" + key);\n const listener = props[listenerName];\n if (listener) {\n this.propEventSubscriptions[key] = this.on(key, listener);\n }\n }\n this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps || {}, this), this.prevMotionValues);\n if (this.handleChildMotionValue) {\n this.handleChildMotionValue();\n }\n }\n getProps() {\n return this.props;\n }\n /**\n * Returns the variant definition with a given name.\n */\n getVariant(name) {\n return this.props.variants ? this.props.variants[name] : undefined;\n }\n /**\n * Returns the defined default transition on this component.\n */\n getDefaultTransition() {\n return this.props.transition;\n }\n getTransformPagePoint() {\n return this.props.transformPagePoint;\n }\n getClosestVariantNode() {\n return this.isVariantNode\n ? this\n : this.parent\n ? this.parent.getClosestVariantNode()\n : undefined;\n }\n /**\n * Add a child visual element to our set of children.\n */\n addVariantChild(child) {\n const closestVariantNode = this.getClosestVariantNode();\n if (closestVariantNode) {\n closestVariantNode.variantChildren &&\n closestVariantNode.variantChildren.add(child);\n return () => closestVariantNode.variantChildren.delete(child);\n }\n }\n /**\n * Add a motion value and bind it to this visual element.\n */\n addValue(key, value) {\n // Remove existing value if it exists\n const existingValue = this.values.get(key);\n if (value !== existingValue) {\n if (existingValue)\n this.removeValue(key);\n this.bindToMotionValue(key, value);\n this.values.set(key, value);\n this.latestValues[key] = value.get();\n }\n }\n /**\n * Remove a motion value and unbind any active subscriptions.\n */\n removeValue(key) {\n this.values.delete(key);\n const unsubscribe = this.valueSubscriptions.get(key);\n if (unsubscribe) {\n unsubscribe();\n this.valueSubscriptions.delete(key);\n }\n delete this.latestValues[key];\n this.removeValueFromRenderState(key, this.renderState);\n }\n /**\n * Check whether we have a motion value for this key\n */\n hasValue(key) {\n return this.values.has(key);\n }\n getValue(key, defaultValue) {\n if (this.props.values && this.props.values[key]) {\n return this.props.values[key];\n }\n let value = this.values.get(key);\n if (value === undefined && defaultValue !== undefined) {\n value = motionValue(defaultValue === null ? undefined : defaultValue, { owner: this });\n this.addValue(key, value);\n }\n return value;\n }\n /**\n * If we're trying to animate to a previously unencountered value,\n * we need to check for it in our state and as a last resort read it\n * directly from the instance (which might have performance implications).\n */\n readValue(key, target) {\n let value = this.latestValues[key] !== undefined || !this.current\n ? this.latestValues[key]\n : this.getBaseTargetFromProps(this.props, key) ??\n this.readValueFromInstance(this.current, key, this.options);\n if (value !== undefined && value !== null) {\n if (typeof value === \"string\" &&\n (isNumericalString(value) || isZeroValueString(value))) {\n // If this is a number read as a string, ie \"0\" or \"200\", convert it to a number\n value = parseFloat(value);\n }\n else if (!findValueType(value) && complex.test(target)) {\n value = getAnimatableNone(key, target);\n }\n this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);\n }\n return isMotionValue(value) ? value.get() : value;\n }\n /**\n * Set the base target to later animate back to. This is currently\n * only hydrated on creation and when we first read a value.\n */\n setBaseTarget(key, value) {\n this.baseTarget[key] = value;\n }\n /**\n * Find the base target for a value thats been removed from all animation\n * props.\n */\n getBaseTarget(key) {\n const { initial } = this.props;\n let valueFromInitial;\n if (typeof initial === \"string\" || typeof initial === \"object\") {\n const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);\n if (variant) {\n valueFromInitial = variant[key];\n }\n }\n /**\n * If this value still exists in the current initial variant, read that.\n */\n if (initial && valueFromInitial !== undefined) {\n return valueFromInitial;\n }\n /**\n * Alternatively, if this VisualElement config has defined a getBaseTarget\n * so we can read the value from an alternative source, try that.\n */\n const target = this.getBaseTargetFromProps(this.props, key);\n if (target !== undefined && !isMotionValue(target))\n return target;\n /**\n * If the value was initially defined on initial, but it doesn't any more,\n * return undefined. Otherwise return the value as initially read from the DOM.\n */\n return this.initialValues[key] !== undefined &&\n valueFromInitial === undefined\n ? undefined\n : this.baseTarget[key];\n }\n on(eventName, callback) {\n if (!this.events[eventName]) {\n this.events[eventName] = new SubscriptionManager();\n }\n return this.events[eventName].add(callback);\n }\n notify(eventName, ...args) {\n if (this.events[eventName]) {\n this.events[eventName].notify(...args);\n }\n }\n scheduleRenderMicrotask() {\n microtask.render(this.render);\n }\n}\n\nexport { VisualElement, getFeatureDefinitions, setFeatureDefinitions };\n//# sourceMappingURL=VisualElement.mjs.map\n","import { isMotionValue } from '../../value/utils/is-motion-value.mjs';\nimport { DOMKeyframesResolver } from '../../animation/keyframes/DOMKeyframesResolver.mjs';\nimport { VisualElement } from '../VisualElement.mjs';\n\nclass DOMVisualElement extends VisualElement {\n constructor() {\n super(...arguments);\n this.KeyframeResolver = DOMKeyframesResolver;\n }\n sortInstanceNodePosition(a, b) {\n /**\n * compareDocumentPosition returns a bitmask, by using the bitwise &\n * we're returning true if 2 in that bitmask is set to true. 2 is set\n * to true if b preceeds a.\n */\n return a.compareDocumentPosition(b) & 2 ? 1 : -1;\n }\n getBaseTargetFromProps(props, key) {\n const style = props.style;\n return style ? style[key] : undefined;\n }\n removeValueFromRenderState(key, { vars, style }) {\n delete vars[key];\n delete style[key];\n }\n handleChildMotionValue() {\n if (this.childSubscription) {\n this.childSubscription();\n delete this.childSubscription;\n }\n const { children } = this.props;\n if (isMotionValue(children)) {\n this.childSubscription = children.on(\"change\", (latest) => {\n if (this.current) {\n this.current.textContent = `${latest}`;\n }\n });\n }\n }\n}\n\nexport { DOMVisualElement };\n//# sourceMappingURL=DOMVisualElement.mjs.map\n","/**\n * Feature base class for extending VisualElement functionality.\n * Features are plugins that can be mounted/unmounted to add behavior\n * like gestures, animations, or layout tracking.\n */\nclass Feature {\n constructor(node) {\n this.isMounted = false;\n this.node = node;\n }\n update() { }\n}\n\nexport { Feature };\n//# sourceMappingURL=Feature.mjs.map\n","/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nfunction convertBoundingBoxToBox({ top, left, right, bottom, }) {\n return {\n x: { min: left, max: right },\n y: { min: top, max: bottom },\n };\n}\nfunction convertBoxToBoundingBox({ x, y }) {\n return { top: y.min, right: x.max, bottom: y.max, left: x.min };\n}\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nfunction transformBoxPoints(point, transformPoint) {\n if (!transformPoint)\n return point;\n const topLeft = transformPoint({ x: point.left, y: point.top });\n const bottomRight = transformPoint({ x: point.right, y: point.bottom });\n return {\n top: topLeft.y,\n left: topLeft.x,\n bottom: bottomRight.y,\n right: bottomRight.x,\n };\n}\n\nexport { convertBoundingBoxToBox, convertBoxToBoundingBox, transformBoxPoints };\n//# sourceMappingURL=conversion.mjs.map\n","function isIdentityScale(scale) {\n return scale === undefined || scale === 1;\n}\nfunction hasScale({ scale, scaleX, scaleY }) {\n return (!isIdentityScale(scale) ||\n !isIdentityScale(scaleX) ||\n !isIdentityScale(scaleY));\n}\nfunction hasTransform(values) {\n return (hasScale(values) ||\n has2DTranslate(values) ||\n values.z ||\n values.rotate ||\n values.rotateX ||\n values.rotateY ||\n values.skewX ||\n values.skewY);\n}\nfunction has2DTranslate(values) {\n return is2DTranslate(values.x) || is2DTranslate(values.y);\n}\nfunction is2DTranslate(value) {\n return value && value !== \"0%\";\n}\n\nexport { has2DTranslate, hasScale, hasTransform };\n//# sourceMappingURL=has-transform.mjs.map\n","import { mixNumber } from '../../utils/mix/number.mjs';\nimport { hasTransform } from '../utils/has-transform.mjs';\n\n/**\n * Scales a point based on a factor and an originPoint\n */\nfunction scalePoint(point, scale, originPoint) {\n const distanceFromOrigin = point - originPoint;\n const scaled = scale * distanceFromOrigin;\n return originPoint + scaled;\n}\n/**\n * Applies a translate/scale delta to a point\n */\nfunction applyPointDelta(point, translate, scale, originPoint, boxScale) {\n if (boxScale !== undefined) {\n point = scalePoint(point, boxScale, originPoint);\n }\n return scalePoint(point, scale, originPoint) + translate;\n}\n/**\n * Applies a translate/scale delta to an axis\n */\nfunction applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {\n axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);\n axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Applies a translate/scale delta to a box\n */\nfunction applyBoxDelta(box, { x, y }) {\n applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);\n applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);\n}\nconst TREE_SCALE_SNAP_MIN = 0.999999999999;\nconst TREE_SCALE_SNAP_MAX = 1.0000000000001;\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within updateLayoutDelta for future refactoring\n */\nfunction applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {\n const treeLength = treePath.length;\n if (!treeLength)\n return;\n // Reset the treeScale\n treeScale.x = treeScale.y = 1;\n let node;\n let delta;\n for (let i = 0; i < treeLength; i++) {\n node = treePath[i];\n delta = node.projectionDelta;\n /**\n * TODO: Prefer to remove this, but currently we have motion components with\n * display: contents in Framer.\n */\n const { visualElement } = node.options;\n if (visualElement &&\n visualElement.props.style &&\n visualElement.props.style.display === \"contents\") {\n continue;\n }\n if (isSharedTransition &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root) {\n translateAxis(box.x, -node.scroll.offset.x);\n translateAxis(box.y, -node.scroll.offset.y);\n }\n if (delta) {\n // Incoporate each ancestor's scale into a cumulative treeScale for this component\n treeScale.x *= delta.x.scale;\n treeScale.y *= delta.y.scale;\n // Apply each ancestor's calculated delta into this component's recorded layout box\n applyBoxDelta(box, delta);\n }\n if (isSharedTransition && hasTransform(node.latestValues)) {\n transformBox(box, node.latestValues, node.layout?.layoutBox);\n }\n }\n /**\n * Snap tree scale back to 1 if it's within a non-perceivable threshold.\n * This will help reduce useless scales getting rendered.\n */\n if (treeScale.x < TREE_SCALE_SNAP_MAX &&\n treeScale.x > TREE_SCALE_SNAP_MIN) {\n treeScale.x = 1.0;\n }\n if (treeScale.y < TREE_SCALE_SNAP_MAX &&\n treeScale.y > TREE_SCALE_SNAP_MIN) {\n treeScale.y = 1.0;\n }\n}\nfunction translateAxis(axis, distance) {\n axis.min += distance;\n axis.max += distance;\n}\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nfunction transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {\n const originPoint = mixNumber(axis.min, axis.max, axisOrigin);\n // Apply the axis delta to the final axis\n applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);\n}\nfunction resolveAxisTranslate(value, axis) {\n if (typeof value === \"string\") {\n return (parseFloat(value) / 100) * (axis.max - axis.min);\n }\n return value;\n}\n/**\n * Apply a transform to a box from the latest resolved motion values.\n */\nfunction transformBox(box, transform, sourceBox) {\n const resolveBox = sourceBox ?? box;\n transformAxis(box.x, resolveAxisTranslate(transform.x, resolveBox.x), transform.scaleX, transform.scale, transform.originX);\n transformAxis(box.y, resolveAxisTranslate(transform.y, resolveBox.y), transform.scaleY, transform.scale, transform.originY);\n}\n\nexport { applyAxisDelta, applyBoxDelta, applyPointDelta, applyTreeDeltas, scalePoint, transformAxis, transformBox, translateAxis };\n//# sourceMappingURL=delta-apply.mjs.map\n","import { convertBoundingBoxToBox, transformBoxPoints } from '../geometry/conversion.mjs';\nimport { translateAxis } from '../geometry/delta-apply.mjs';\n\nfunction measureViewportBox(instance, transformPoint) {\n return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));\n}\nfunction measurePageBox(element, rootProjectionNode, transformPagePoint) {\n const viewportBox = measureViewportBox(element, transformPagePoint);\n const { scroll } = rootProjectionNode;\n if (scroll) {\n translateAxis(viewportBox.x, scroll.offset.x);\n translateAxis(viewportBox.y, scroll.offset.y);\n }\n return viewportBox;\n}\n\nexport { measurePageBox, measureViewportBox };\n//# sourceMappingURL=measure.mjs.map\n","import { getValueAsType } from '../../../value/types/utils/get-as-type.mjs';\nimport { numberValueTypes } from '../../../value/types/maps/number.mjs';\nimport { transformPropOrder } from '../../utils/keys-transform.mjs';\n\nconst translateAlias = {\n x: \"translateX\",\n y: \"translateY\",\n z: \"translateZ\",\n transformPerspective: \"perspective\",\n};\nconst numTransforms = transformPropOrder.length;\n/**\n * Build a CSS transform style from individual x/y/scale etc properties.\n *\n * This outputs with a default order of transforms/scales/rotations, this can be customised by\n * providing a transformTemplate function.\n */\nfunction buildTransform(latestValues, transform, transformTemplate) {\n // The transform string we're going to build into.\n let transformString = \"\";\n let transformIsDefault = true;\n /**\n * Loop over all possible transforms in order, adding the ones that\n * are present to the transform string.\n */\n for (let i = 0; i < numTransforms; i++) {\n const key = transformPropOrder[i];\n const value = latestValues[key];\n if (value === undefined)\n continue;\n let valueIsDefault = true;\n if (typeof value === \"number\") {\n valueIsDefault = value === (key.startsWith(\"scale\") ? 1 : 0);\n }\n else {\n const parsed = parseFloat(value);\n valueIsDefault = key.startsWith(\"scale\") ? parsed === 1 : parsed === 0;\n }\n if (!valueIsDefault || transformTemplate) {\n const valueAsType = getValueAsType(value, numberValueTypes[key]);\n if (!valueIsDefault) {\n transformIsDefault = false;\n const transformName = translateAlias[key] || key;\n transformString += `${transformName}(${valueAsType}) `;\n }\n if (transformTemplate) {\n transform[key] = valueAsType;\n }\n }\n }\n transformString = transformString.trim();\n // If we have a custom `transform` template, pass our transform values and\n // generated transformString to that before returning\n if (transformTemplate) {\n transformString = transformTemplate(transform, transformIsDefault ? \"\" : transformString);\n }\n else if (transformIsDefault) {\n transformString = \"none\";\n }\n return transformString;\n}\n\nexport { buildTransform };\n//# sourceMappingURL=build-transform.mjs.map\n","import { getValueAsType } from '../../../value/types/utils/get-as-type.mjs';\nimport { numberValueTypes } from '../../../value/types/maps/number.mjs';\nimport { transformProps } from '../../utils/keys-transform.mjs';\nimport { isCSSVariableName } from '../../../animation/utils/is-css-variable.mjs';\nimport { buildTransform } from './build-transform.mjs';\n\nfunction buildHTMLStyles(state, latestValues, transformTemplate) {\n const { style, vars, transformOrigin } = state;\n // Track whether we encounter any transform or transformOrigin values.\n let hasTransform = false;\n let hasTransformOrigin = false;\n /**\n * Loop over all our latest animated values and decide whether to handle them\n * as a style or CSS variable.\n *\n * Transforms and transform origins are kept separately for further processing.\n */\n for (const key in latestValues) {\n const value = latestValues[key];\n if (transformProps.has(key)) {\n // If this is a transform, flag to enable further transform processing\n hasTransform = true;\n continue;\n }\n else if (isCSSVariableName(key)) {\n vars[key] = value;\n continue;\n }\n else {\n // Convert the value to its default value type, ie 0 -> \"0px\"\n const valueAsType = getValueAsType(value, numberValueTypes[key]);\n if (key.startsWith(\"origin\")) {\n // If this is a transform origin, flag and enable further transform-origin processing\n hasTransformOrigin = true;\n transformOrigin[key] =\n valueAsType;\n }\n else {\n style[key] = valueAsType;\n }\n }\n }\n if (!latestValues.transform) {\n if (hasTransform || transformTemplate) {\n style.transform = buildTransform(latestValues, state.transform, transformTemplate);\n }\n else if (style.transform) {\n /**\n * If we have previously created a transform but currently don't have any,\n * reset transform style to none.\n */\n style.transform = \"none\";\n }\n }\n /**\n * Build a transformOrigin style. Uses the same defaults as the browser for\n * undefined origins.\n */\n if (hasTransformOrigin) {\n const { originX = \"50%\", originY = \"50%\", originZ = 0, } = transformOrigin;\n style.transformOrigin = `${originX} ${originY} ${originZ}`;\n }\n}\n\nexport { buildHTMLStyles };\n//# sourceMappingURL=build-styles.mjs.map\n","function renderHTML(element, { style, vars }, styleProp, projection) {\n const elementStyle = element.style;\n let key;\n for (key in style) {\n // CSSStyleDeclaration has [index: number]: string; in the types, so we use that as key type.\n elementStyle[key] = style[key];\n }\n // Write projection styles directly to element style\n projection?.applyProjectionStyles(elementStyle, styleProp);\n for (key in vars) {\n // Loop over any CSS variables and assign those.\n // They can only be assigned using `setProperty`.\n elementStyle.setProperty(key, vars[key]);\n }\n}\n\nexport { renderHTML };\n//# sourceMappingURL=render.mjs.map\n","import { px } from '../../value/types/numbers/units.mjs';\n\nfunction pixelsToPercent(pixels, axis) {\n if (axis.max === axis.min)\n return 0;\n return (pixels / (axis.max - axis.min)) * 100;\n}\n/**\n * We always correct borderRadius as a percentage rather than pixels to reduce paints.\n * For example, if you are projecting a box that is 100px wide with a 10px borderRadius\n * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%\n * borderRadius in both states. If we animate between the two in pixels that will trigger\n * a paint each time. If we animate between the two in percentage we'll avoid a paint.\n */\nconst correctBorderRadius = {\n correct: (latest, node) => {\n if (!node.target)\n return latest;\n /**\n * If latest is a string, if it's a percentage we can return immediately as it's\n * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.\n */\n if (typeof latest === \"string\") {\n if (px.test(latest)) {\n latest = parseFloat(latest);\n }\n else {\n return latest;\n }\n }\n /**\n * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that\n * pixel value as a percentage of each axis\n */\n const x = pixelsToPercent(latest, node.target.x);\n const y = pixelsToPercent(latest, node.target.y);\n return `${x}% ${y}%`;\n },\n};\n\nexport { correctBorderRadius, pixelsToPercent };\n//# sourceMappingURL=scale-border-radius.mjs.map\n","import { complex } from '../../value/types/complex/index.mjs';\nimport { mixNumber } from '../../utils/mix/number.mjs';\n\nconst correctBoxShadow = {\n correct: (latest, { treeScale, projectionDelta }) => {\n const original = latest;\n const shadow = complex.parse(latest);\n // TODO: Doesn't support multiple shadows\n if (shadow.length > 5)\n return original;\n const template = complex.createTransformer(latest);\n const offset = typeof shadow[0] !== \"number\" ? 1 : 0;\n // Calculate the overall context scale\n const xScale = projectionDelta.x.scale * treeScale.x;\n const yScale = projectionDelta.y.scale * treeScale.y;\n shadow[0 + offset] /= xScale;\n shadow[1 + offset] /= yScale;\n /**\n * Ideally we'd correct x and y scales individually, but because blur and\n * spread apply to both we have to take a scale average and apply that instead.\n * We could potentially improve the outcome of this by incorporating the ratio between\n * the two scales.\n */\n const averageScale = mixNumber(xScale, yScale, 0.5);\n // Blur\n if (typeof shadow[2 + offset] === \"number\")\n shadow[2 + offset] /= averageScale;\n // Spread\n if (typeof shadow[3 + offset] === \"number\")\n shadow[3 + offset] /= averageScale;\n return template(shadow);\n },\n};\n\nexport { correctBoxShadow };\n//# sourceMappingURL=scale-box-shadow.mjs.map\n","import { isCSSVariableName } from '../../animation/utils/is-css-variable.mjs';\nimport { correctBorderRadius } from './scale-border-radius.mjs';\nimport { correctBoxShadow } from './scale-box-shadow.mjs';\n\nconst scaleCorrectors = {\n borderRadius: {\n ...correctBorderRadius,\n applyTo: [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n ],\n },\n borderTopLeftRadius: correctBorderRadius,\n borderTopRightRadius: correctBorderRadius,\n borderBottomLeftRadius: correctBorderRadius,\n borderBottomRightRadius: correctBorderRadius,\n boxShadow: correctBoxShadow,\n};\nfunction addScaleCorrector(correctors) {\n for (const key in correctors) {\n scaleCorrectors[key] = correctors[key];\n if (isCSSVariableName(key)) {\n scaleCorrectors[key].isCSSVariable = true;\n }\n }\n}\n\nexport { addScaleCorrector, scaleCorrectors };\n//# sourceMappingURL=scale-correction.mjs.map\n","import { transformProps } from './keys-transform.mjs';\nimport { scaleCorrectors } from '../../projection/styles/scale-correction.mjs';\nexport { addScaleCorrector } from '../../projection/styles/scale-correction.mjs';\n\nfunction isForcedMotionValue(key, { layout, layoutId }) {\n return (transformProps.has(key) ||\n key.startsWith(\"origin\") ||\n ((layout || layoutId !== undefined) &&\n (!!scaleCorrectors[key] || key === \"opacity\")));\n}\n\nexport { isForcedMotionValue, scaleCorrectors };\n//# sourceMappingURL=is-forced-motion-value.mjs.map\n","import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';\nimport { isForcedMotionValue } from '../../utils/is-forced-motion-value.mjs';\n\nfunction scrapeMotionValuesFromProps(props, prevProps, visualElement) {\n const style = props.style;\n const prevStyle = prevProps?.style;\n const newValues = {};\n if (!style)\n return newValues;\n for (const key in style) {\n if (isMotionValue(style[key]) ||\n (prevStyle && isMotionValue(prevStyle[key])) ||\n isForcedMotionValue(key, props) ||\n visualElement?.getValue(key)?.liveStyle !== undefined) {\n newValues[key] = style[key];\n }\n }\n return newValues;\n}\n\nexport { scrapeMotionValuesFromProps };\n//# sourceMappingURL=scrape-motion-values.mjs.map\n","import { isCSSVariableName } from '../../animation/utils/is-css-variable.mjs';\nimport { transformProps } from '../utils/keys-transform.mjs';\nimport { defaultTransformValue, readTransformValue } from '../dom/parse-transform.mjs';\nimport { measureViewportBox } from '../../projection/utils/measure.mjs';\nimport { DOMVisualElement } from '../dom/DOMVisualElement.mjs';\nimport { buildHTMLStyles } from './utils/build-styles.mjs';\nimport { renderHTML } from './utils/render.mjs';\nimport { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';\n\nfunction getComputedStyle(element) {\n return window.getComputedStyle(element);\n}\nclass HTMLVisualElement extends DOMVisualElement {\n constructor() {\n super(...arguments);\n this.type = \"html\";\n this.renderInstance = renderHTML;\n }\n readValueFromInstance(instance, key) {\n if (transformProps.has(key)) {\n return this.projection?.isProjecting\n ? defaultTransformValue(key)\n : readTransformValue(instance, key);\n }\n else {\n const computedStyle = getComputedStyle(instance);\n const value = (isCSSVariableName(key)\n ? computedStyle.getPropertyValue(key)\n : computedStyle[key]) || 0;\n return typeof value === \"string\" ? value.trim() : value;\n }\n }\n measureInstanceViewportBox(instance, { transformPagePoint }) {\n return measureViewportBox(instance, transformPagePoint);\n }\n build(renderState, latestValues, props) {\n buildHTMLStyles(renderState, latestValues, props.transformTemplate);\n }\n scrapeMotionValuesFromProps(props, prevProps, visualElement) {\n return scrapeMotionValuesFromProps(props, prevProps, visualElement);\n }\n}\n\nexport { HTMLVisualElement, getComputedStyle };\n//# sourceMappingURL=HTMLVisualElement.mjs.map\n","const dashKeys = {\n offset: \"stroke-dashoffset\",\n array: \"stroke-dasharray\",\n};\nconst camelKeys = {\n offset: \"strokeDashoffset\",\n array: \"strokeDasharray\",\n};\n/**\n * Build SVG path properties. Uses the path's measured length to convert\n * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset\n * and stroke-dasharray attributes.\n *\n * This function is mutative to reduce per-frame GC.\n *\n * Note: We use unitless values for stroke-dasharray and stroke-dashoffset\n * because Safari incorrectly scales px values when the page is zoomed.\n */\nfunction buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {\n // Normalise path length by setting SVG attribute pathLength to 1\n attrs.pathLength = 1;\n // We use dash case when setting attributes directly to the DOM node and camel case\n // when defining props on a React component.\n const keys = useDashCase ? dashKeys : camelKeys;\n // Build the dash offset (unitless to avoid Safari zoom bug)\n attrs[keys.offset] = `${-offset}`;\n // Build the dash array (unitless to avoid Safari zoom bug)\n attrs[keys.array] = `${length} ${spacing}`;\n}\n\nexport { buildSVGPath };\n//# sourceMappingURL=path.mjs.map\n","import { buildHTMLStyles } from '../../html/utils/build-styles.mjs';\nimport { buildSVGPath } from './path.mjs';\n\n/**\n * CSS Motion Path properties that should remain as CSS styles on SVG elements.\n */\nconst cssMotionPathProperties = [\n \"offsetDistance\",\n \"offsetPath\",\n \"offsetRotate\",\n \"offsetAnchor\",\n];\n/**\n * Build SVG visual attributes, like cx and style.transform\n */\nfunction buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing = 1, pathOffset = 0, \n// This is object creation, which we try to avoid per-frame.\n...latest }, isSVGTag, transformTemplate, styleProp) {\n buildHTMLStyles(state, latest, transformTemplate);\n /**\n * For svg tags we just want to make sure viewBox is animatable and treat all the styles\n * as normal HTML tags.\n */\n if (isSVGTag) {\n if (state.style.viewBox) {\n state.attrs.viewBox = state.style.viewBox;\n }\n return;\n }\n state.attrs = state.style;\n state.style = {};\n const { attrs, style } = state;\n /**\n * However, we apply transforms as CSS transforms.\n * So if we detect a transform, transformOrigin we take it from attrs and copy it into style.\n */\n if (attrs.transform) {\n style.transform = attrs.transform;\n delete attrs.transform;\n }\n if (style.transform || attrs.transformOrigin) {\n style.transformOrigin = attrs.transformOrigin ?? \"50% 50%\";\n delete attrs.transformOrigin;\n }\n if (style.transform) {\n /**\n * SVG's element transform-origin uses its own median as a reference.\n * Therefore, transformBox becomes a fill-box\n */\n style.transformBox = styleProp?.transformBox ?? \"fill-box\";\n delete attrs.transformBox;\n }\n for (const key of cssMotionPathProperties) {\n if (attrs[key] !== undefined) {\n style[key] = attrs[key];\n delete attrs[key];\n }\n }\n // Render attrX/attrY/attrScale as attributes\n if (attrX !== undefined)\n attrs.x = attrX;\n if (attrY !== undefined)\n attrs.y = attrY;\n if (attrScale !== undefined)\n attrs.scale = attrScale;\n // Build SVG path if one has been defined\n if (pathLength !== undefined) {\n buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);\n }\n}\n\nexport { buildSVGAttrs };\n//# sourceMappingURL=build-attrs.mjs.map\n","/**\n * A set of attribute names that are always read/written as camel case.\n */\nconst camelCaseAttributes = new Set([\n \"baseFrequency\",\n \"diffuseConstant\",\n \"kernelMatrix\",\n \"kernelUnitLength\",\n \"keySplines\",\n \"keyTimes\",\n \"limitingConeAngle\",\n \"markerHeight\",\n \"markerWidth\",\n \"numOctaves\",\n \"targetX\",\n \"targetY\",\n \"surfaceScale\",\n \"specularConstant\",\n \"specularExponent\",\n \"stdDeviation\",\n \"tableValues\",\n \"viewBox\",\n \"gradientTransform\",\n \"pathLength\",\n \"startOffset\",\n \"textLength\",\n \"lengthAdjust\",\n]);\n\nexport { camelCaseAttributes };\n//# sourceMappingURL=camel-case-attrs.mjs.map\n","const isSVGTag = (tag) => typeof tag === \"string\" && tag.toLowerCase() === \"svg\";\n\nexport { isSVGTag };\n//# sourceMappingURL=is-svg-tag.mjs.map\n","import { camelToDash } from '../../dom/utils/camel-to-dash.mjs';\nimport { renderHTML } from '../../html/utils/render.mjs';\nimport { camelCaseAttributes } from './camel-case-attrs.mjs';\n\nfunction renderSVG(element, renderState, _styleProp, projection) {\n renderHTML(element, renderState, undefined, projection);\n for (const key in renderState.attrs) {\n element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);\n }\n}\n\nexport { renderSVG };\n//# sourceMappingURL=render.mjs.map\n","import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';\nimport { transformPropOrder } from '../../utils/keys-transform.mjs';\nimport { scrapeMotionValuesFromProps as scrapeMotionValuesFromProps$1 } from '../../html/utils/scrape-motion-values.mjs';\n\nfunction scrapeMotionValuesFromProps(props, prevProps, visualElement) {\n const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);\n for (const key in props) {\n if (isMotionValue(props[key]) ||\n isMotionValue(prevProps[key])) {\n const targetKey = transformPropOrder.indexOf(key) !== -1\n ? \"attr\" + key.charAt(0).toUpperCase() + key.substring(1)\n : key;\n newValues[targetKey] = props[key];\n }\n }\n return newValues;\n}\n\nexport { scrapeMotionValuesFromProps };\n//# sourceMappingURL=scrape-motion-values.mjs.map\n","import { transformProps } from '../utils/keys-transform.mjs';\nimport { getDefaultValueType } from '../../value/types/maps/defaults.mjs';\nimport { createBox } from '../../projection/geometry/models.mjs';\nimport { DOMVisualElement } from '../dom/DOMVisualElement.mjs';\nimport { camelToDash } from '../dom/utils/camel-to-dash.mjs';\nimport { buildSVGAttrs } from './utils/build-attrs.mjs';\nimport { camelCaseAttributes } from './utils/camel-case-attrs.mjs';\nimport { isSVGTag } from './utils/is-svg-tag.mjs';\nimport { renderSVG } from './utils/render.mjs';\nimport { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';\n\nclass SVGVisualElement extends DOMVisualElement {\n constructor() {\n super(...arguments);\n this.type = \"svg\";\n this.isSVGTag = false;\n this.measureInstanceViewportBox = createBox;\n }\n getBaseTargetFromProps(props, key) {\n return props[key];\n }\n readValueFromInstance(instance, key) {\n if (transformProps.has(key)) {\n const defaultType = getDefaultValueType(key);\n return defaultType ? defaultType.default || 0 : 0;\n }\n key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;\n return instance.getAttribute(key);\n }\n scrapeMotionValuesFromProps(props, prevProps, visualElement) {\n return scrapeMotionValuesFromProps(props, prevProps, visualElement);\n }\n build(renderState, latestValues, props) {\n buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate, props.style);\n }\n renderInstance(instance, renderState, styleProp, projection) {\n renderSVG(instance, renderState, styleProp, projection);\n }\n mount(instance) {\n this.isSVGTag = isSVGTag(instance.tagName);\n super.mount(instance);\n }\n}\n\nexport { SVGVisualElement };\n//# sourceMappingURL=SVGVisualElement.mjs.map\n","import { isVariantLabel } from './is-variant-label.mjs';\nimport { variantProps } from './variant-props.mjs';\n\nconst numVariantProps = variantProps.length;\n/**\n * Get variant context from a visual element's parent chain.\n * Uses `any` type for visualElement to avoid circular dependencies.\n */\nfunction getVariantContext(visualElement) {\n if (!visualElement)\n return undefined;\n if (!visualElement.isControllingVariants) {\n const context = visualElement.parent\n ? getVariantContext(visualElement.parent) || {}\n : {};\n if (visualElement.props.initial !== undefined) {\n context.initial = visualElement.props.initial;\n }\n return context;\n }\n const context = {};\n for (let i = 0; i < numVariantProps; i++) {\n const name = variantProps[i];\n const prop = visualElement.props[name];\n if (isVariantLabel(prop) || prop === false) {\n context[name] = prop;\n }\n }\n return context;\n}\n\nexport { getVariantContext };\n//# sourceMappingURL=get-variant-context.mjs.map\n","function shallowCompare(next, prev) {\n if (!Array.isArray(prev))\n return false;\n const prevLength = prev.length;\n if (prevLength !== next.length)\n return false;\n for (let i = 0; i < prevLength; i++) {\n if (prev[i] !== next[i])\n return false;\n }\n return true;\n}\n\nexport { shallowCompare };\n//# sourceMappingURL=shallow-compare.mjs.map\n","import { animateVisualElement } from '../../animation/interfaces/visual-element.mjs';\nimport { calcChildStagger } from '../../animation/utils/calc-child-stagger.mjs';\nimport { getVariantContext } from './get-variant-context.mjs';\nimport { isAnimationControls } from './is-animation-controls.mjs';\nimport { isKeyframesTarget } from './is-keyframes-target.mjs';\nimport { isVariantLabel } from './is-variant-label.mjs';\nimport { resolveVariant } from './resolve-dynamic-variants.mjs';\nimport { shallowCompare } from './shallow-compare.mjs';\nimport { variantPriorityOrder } from './variant-props.mjs';\n\nconst reversePriorityOrder = [...variantPriorityOrder].reverse();\nconst numAnimationTypes = variantPriorityOrder.length;\nfunction createAnimateFunction(visualElement) {\n return (animations) => {\n return Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));\n };\n}\nfunction createAnimationState(visualElement) {\n let animate = createAnimateFunction(visualElement);\n let state = createState();\n let isInitialRender = true;\n /**\n * Track whether the animation state has been reset (e.g. via StrictMode\n * double-invocation or Suspense unmount/remount). On the first\n * animateChanges() call after a reset we need to behave like the initial\n * render for variant-inheritance checks, even though isInitialRender is\n * already false.\n */\n let wasReset = false;\n /**\n * This function will be used to reduce the animation definitions for\n * each active animation type into an object of resolved values for it.\n */\n const buildResolvedTypeValues = (type) => (acc, definition) => {\n const resolved = resolveVariant(visualElement, definition, type === \"exit\"\n ? visualElement.presenceContext?.custom\n : undefined);\n if (resolved) {\n const { transition, transitionEnd, ...target } = resolved;\n acc = { ...acc, ...target, ...transitionEnd };\n }\n return acc;\n };\n /**\n * This just allows us to inject mocked animation functions\n * @internal\n */\n function setAnimateFunction(makeAnimator) {\n animate = makeAnimator(visualElement);\n }\n /**\n * When we receive new props, we need to:\n * 1. Create a list of protected keys for each type. This is a directory of\n * value keys that are currently being \"handled\" by types of a higher priority\n * so that whenever an animation is played of a given type, these values are\n * protected from being animated.\n * 2. Determine if an animation type needs animating.\n * 3. Determine if any values have been removed from a type and figure out\n * what to animate those to.\n */\n function animateChanges(changedActiveType) {\n const { props } = visualElement;\n const context = getVariantContext(visualElement.parent) || {};\n /**\n * A list of animations that we'll build into as we iterate through the animation\n * types. This will get executed at the end of the function.\n */\n const animations = [];\n /**\n * Keep track of which values have been removed. Then, as we hit lower priority\n * animation types, we can check if they contain removed values and animate to that.\n */\n const removedKeys = new Set();\n /**\n * A dictionary of all encountered keys. This is an object to let us build into and\n * copy it without iteration. Each time we hit an animation type we set its protected\n * keys - the keys its not allowed to animate - to the latest version of this object.\n */\n let encounteredKeys = {};\n /**\n * If a variant has been removed at a given index, and this component is controlling\n * variant animations, we want to ensure lower-priority variants are forced to animate.\n */\n let removedVariantIndex = Infinity;\n /**\n * Iterate through all animation types in reverse priority order. For each, we want to\n * detect which values it's handling and whether or not they've changed (and therefore\n * need to be animated). If any values have been removed, we want to detect those in\n * lower priority props and flag for animation.\n */\n for (let i = 0; i < numAnimationTypes; i++) {\n const type = reversePriorityOrder[i];\n const typeState = state[type];\n const prop = props[type] !== undefined\n ? props[type]\n : context[type];\n const propIsVariant = isVariantLabel(prop);\n /**\n * If this type has *just* changed isActive status, set activeDelta\n * to that status. Otherwise set to null.\n */\n const activeDelta = type === changedActiveType ? typeState.isActive : null;\n if (activeDelta === false)\n removedVariantIndex = i;\n /**\n * If this prop is an inherited variant, rather than been set directly on the\n * component itself, we want to make sure we allow the parent to trigger animations.\n *\n * TODO: Can probably change this to a !isControllingVariants check\n */\n let isInherited = prop === context[type] &&\n prop !== props[type] &&\n propIsVariant;\n if (isInherited &&\n (isInitialRender || wasReset) &&\n visualElement.manuallyAnimateOnMount) {\n isInherited = false;\n }\n /**\n * Set all encountered keys so far as the protected keys for this type. This will\n * be any key that has been animated or otherwise handled by active, higher-priortiy types.\n */\n typeState.protectedKeys = { ...encounteredKeys };\n // Check if we can skip analysing this prop early\n if (\n // If it isn't active and hasn't *just* been set as inactive\n (!typeState.isActive && activeDelta === null) ||\n // If we didn't and don't have any defined prop for this animation type\n (!prop && !typeState.prevProp) ||\n // Or if the prop doesn't define an animation\n isAnimationControls(prop) ||\n typeof prop === \"boolean\") {\n continue;\n }\n /**\n * If exit is already active and wasn't just activated, skip\n * re-processing to prevent interrupting running exit animations.\n * Re-resolving exit with a changed custom value can start new\n * value animations that stop the originals, leaving the exit\n * animation promise unresolved and the component stuck in the DOM.\n */\n if (type === \"exit\" && typeState.isActive && activeDelta !== true) {\n if (typeState.prevResolvedValues) {\n encounteredKeys = {\n ...encounteredKeys,\n ...typeState.prevResolvedValues,\n };\n }\n continue;\n }\n /**\n * As we go look through the values defined on this type, if we detect\n * a changed value or a value that was removed in a higher priority, we set\n * this to true and add this prop to the animation list.\n */\n const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);\n let shouldAnimateType = variantDidChange ||\n // If we're making this variant active, we want to always make it active\n (type === changedActiveType &&\n typeState.isActive &&\n !isInherited &&\n propIsVariant) ||\n // If we removed a higher-priority variant (i is in reverse order)\n (i > removedVariantIndex && propIsVariant);\n let handledRemovedValues = false;\n /**\n * As animations can be set as variant lists, variants or target objects, we\n * coerce everything to an array if it isn't one already\n */\n const definitionList = Array.isArray(prop) ? prop : [prop];\n /**\n * Build an object of all the resolved values. We'll use this in the subsequent\n * animateChanges calls to determine whether a value has changed.\n */\n let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});\n if (activeDelta === false)\n resolvedValues = {};\n /**\n * Now we need to loop through all the keys in the prev prop and this prop,\n * and decide:\n * 1. If the value has changed, and needs animating\n * 2. If it has been removed, and needs adding to the removedKeys set\n * 3. If it has been removed in a higher priority type and needs animating\n * 4. If it hasn't been removed in a higher priority but hasn't changed, and\n * needs adding to the type's protectedKeys list.\n */\n const { prevResolvedValues = {} } = typeState;\n const allKeys = {\n ...prevResolvedValues,\n ...resolvedValues,\n };\n const markToAnimate = (key) => {\n shouldAnimateType = true;\n if (removedKeys.has(key)) {\n handledRemovedValues = true;\n removedKeys.delete(key);\n }\n typeState.needsAnimating[key] = true;\n const motionValue = visualElement.getValue(key);\n if (motionValue)\n motionValue.liveStyle = false;\n };\n for (const key in allKeys) {\n const next = resolvedValues[key];\n const prev = prevResolvedValues[key];\n // If we've already handled this we can just skip ahead\n if (encounteredKeys.hasOwnProperty(key))\n continue;\n /**\n * If the value has changed, we probably want to animate it.\n */\n let valueHasChanged = false;\n if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {\n valueHasChanged = !shallowCompare(next, prev);\n }\n else {\n valueHasChanged = next !== prev;\n }\n if (valueHasChanged) {\n if (next !== undefined && next !== null) {\n // If next is defined and doesn't equal prev, it needs animating\n markToAnimate(key);\n }\n else {\n // If it's undefined, it's been removed.\n removedKeys.add(key);\n }\n }\n else if (next !== undefined && removedKeys.has(key)) {\n /**\n * If next hasn't changed and it isn't undefined, we want to check if it's\n * been removed by a higher priority\n */\n markToAnimate(key);\n }\n else {\n /**\n * If it hasn't changed, we add it to the list of protected values\n * to ensure it doesn't get animated.\n */\n typeState.protectedKeys[key] = true;\n }\n }\n /**\n * Update the typeState so next time animateChanges is called we can compare the\n * latest prop and resolvedValues to these.\n */\n typeState.prevProp = prop;\n typeState.prevResolvedValues = resolvedValues;\n if (typeState.isActive) {\n encounteredKeys = { ...encounteredKeys, ...resolvedValues };\n }\n if ((isInitialRender || wasReset) &&\n visualElement.blockInitialAnimation) {\n shouldAnimateType = false;\n }\n /**\n * If this is an inherited prop we want to skip this animation\n * unless the inherited variants haven't changed on this render.\n */\n const willAnimateViaParent = isInherited && variantDidChange;\n const needsAnimating = !willAnimateViaParent || handledRemovedValues;\n if (shouldAnimateType && needsAnimating) {\n animations.push(...definitionList.map((animation) => {\n const options = { type };\n /**\n * If we're performing the initial animation, but we're not\n * rendering at the same time as the variant-controlling parent,\n * we want to use the parent's transition to calculate the stagger.\n */\n if (typeof animation === \"string\" &&\n (isInitialRender || wasReset) &&\n !willAnimateViaParent &&\n visualElement.manuallyAnimateOnMount &&\n visualElement.parent) {\n const { parent } = visualElement;\n const parentVariant = resolveVariant(parent, animation);\n if (parent.enteringChildren && parentVariant) {\n const { delayChildren } = parentVariant.transition || {};\n options.delay = calcChildStagger(parent.enteringChildren, visualElement, delayChildren);\n }\n }\n return {\n animation: animation,\n options,\n };\n }));\n }\n }\n /**\n * If there are some removed value that haven't been dealt with,\n * we need to create a new animation that falls back either to the value\n * defined in the style prop, or the last read value.\n */\n if (removedKeys.size) {\n const fallbackAnimation = {};\n /**\n * If the initial prop contains a transition we can use that, otherwise\n * allow the animation function to use the visual element's default.\n */\n if (typeof props.initial !== \"boolean\") {\n const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial)\n ? props.initial[0]\n : props.initial);\n if (initialTransition && initialTransition.transition) {\n fallbackAnimation.transition = initialTransition.transition;\n }\n }\n removedKeys.forEach((key) => {\n const fallbackTarget = visualElement.getBaseTarget(key);\n const motionValue = visualElement.getValue(key);\n if (motionValue)\n motionValue.liveStyle = true;\n // @ts-expect-error - @mattgperry to figure if we should do something here\n fallbackAnimation[key] = fallbackTarget ?? null;\n });\n animations.push({ animation: fallbackAnimation });\n }\n let shouldAnimate = Boolean(animations.length);\n if (isInitialRender &&\n (props.initial === false || props.initial === props.animate) &&\n !visualElement.manuallyAnimateOnMount) {\n shouldAnimate = false;\n }\n isInitialRender = false;\n wasReset = false;\n return shouldAnimate ? animate(animations) : Promise.resolve();\n }\n /**\n * Change whether a certain animation type is active.\n */\n function setActive(type, isActive) {\n // If the active state hasn't changed, we can safely do nothing here\n if (state[type].isActive === isActive)\n return Promise.resolve();\n // Propagate active change to children\n visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));\n state[type].isActive = isActive;\n const animations = animateChanges(type);\n for (const key in state) {\n state[key].protectedKeys = {};\n }\n return animations;\n }\n return {\n animateChanges,\n setActive,\n setAnimateFunction,\n getState: () => state,\n reset: () => {\n state = createState();\n wasReset = true;\n },\n };\n}\nfunction checkVariantsDidChange(prev, next) {\n if (typeof next === \"string\") {\n return next !== prev;\n }\n else if (Array.isArray(next)) {\n return !shallowCompare(next, prev);\n }\n return false;\n}\nfunction createTypeState(isActive = false) {\n return {\n isActive,\n protectedKeys: {},\n needsAnimating: {},\n prevResolvedValues: {},\n };\n}\nfunction createState() {\n return {\n animate: createTypeState(true),\n whileInView: createTypeState(),\n whileHover: createTypeState(),\n whileTap: createTypeState(),\n whileDrag: createTypeState(),\n whileFocus: createTypeState(),\n exit: createTypeState(),\n };\n}\n\nexport { checkVariantsDidChange, createAnimationState };\n//# sourceMappingURL=animation-state.mjs.map\n","/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction copyAxisInto(axis, originAxis) {\n axis.min = originAxis.min;\n axis.max = originAxis.max;\n}\n/**\n * Reset a box to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction copyBoxInto(box, originBox) {\n copyAxisInto(box.x, originBox.x);\n copyAxisInto(box.y, originBox.y);\n}\n/**\n * Reset a delta to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction copyAxisDeltaInto(delta, originDelta) {\n delta.translate = originDelta.translate;\n delta.scale = originDelta.scale;\n delta.originPoint = originDelta.originPoint;\n delta.origin = originDelta.origin;\n}\n\nexport { copyAxisDeltaInto, copyAxisInto, copyBoxInto };\n//# sourceMappingURL=copy.mjs.map\n","import { mixNumber } from '../../utils/mix/number.mjs';\n\nconst SCALE_PRECISION = 0.0001;\nconst SCALE_MIN = 1 - SCALE_PRECISION;\nconst SCALE_MAX = 1 + SCALE_PRECISION;\nconst TRANSLATE_PRECISION = 0.01;\nconst TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;\nconst TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;\nfunction calcLength(axis) {\n return axis.max - axis.min;\n}\nfunction isNear(value, target, maxDistance) {\n return Math.abs(value - target) <= maxDistance;\n}\nfunction calcAxisDelta(delta, source, target, origin = 0.5) {\n delta.origin = origin;\n delta.originPoint = mixNumber(source.min, source.max, delta.origin);\n delta.scale = calcLength(target) / calcLength(source);\n delta.translate =\n mixNumber(target.min, target.max, delta.origin) - delta.originPoint;\n if ((delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) ||\n isNaN(delta.scale)) {\n delta.scale = 1.0;\n }\n if ((delta.translate >= TRANSLATE_MIN &&\n delta.translate <= TRANSLATE_MAX) ||\n isNaN(delta.translate)) {\n delta.translate = 0.0;\n }\n}\nfunction calcBoxDelta(delta, source, target, origin) {\n calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined);\n calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined);\n}\nfunction calcRelativeAxis(target, relative, parent, anchor = 0) {\n const anchorPoint = anchor\n ? mixNumber(parent.min, parent.max, anchor)\n : parent.min;\n target.min = anchorPoint + relative.min;\n target.max = target.min + calcLength(relative);\n}\nfunction calcRelativeBox(target, relative, parent, anchor) {\n calcRelativeAxis(target.x, relative.x, parent.x, anchor?.x);\n calcRelativeAxis(target.y, relative.y, parent.y, anchor?.y);\n}\nfunction calcRelativeAxisPosition(target, layout, parent, anchor = 0) {\n const anchorPoint = anchor\n ? mixNumber(parent.min, parent.max, anchor)\n : parent.min;\n target.min = layout.min - anchorPoint;\n target.max = target.min + calcLength(layout);\n}\nfunction calcRelativePosition(target, layout, parent, anchor) {\n calcRelativeAxisPosition(target.x, layout.x, parent.x, anchor?.x);\n calcRelativeAxisPosition(target.y, layout.y, parent.y, anchor?.y);\n}\n\nexport { calcAxisDelta, calcBoxDelta, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, isNear };\n//# sourceMappingURL=delta-calc.mjs.map\n","import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent } from '../../value/types/numbers/units.mjs';\nimport { scalePoint } from './delta-apply.mjs';\n\n/**\n * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse\n */\nfunction removePointDelta(point, translate, scale, originPoint, boxScale) {\n point -= translate;\n point = scalePoint(point, 1 / scale, originPoint);\n if (boxScale !== undefined) {\n point = scalePoint(point, 1 / boxScale, originPoint);\n }\n return point;\n}\n/**\n * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse\n */\nfunction removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {\n if (percent.test(translate)) {\n translate = parseFloat(translate);\n const relativeProgress = mixNumber(sourceAxis.min, sourceAxis.max, translate / 100);\n translate = relativeProgress - sourceAxis.min;\n }\n if (typeof translate !== \"number\")\n return;\n let originPoint = mixNumber(originAxis.min, originAxis.max, origin);\n if (axis === originAxis)\n originPoint -= translate;\n axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);\n axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) {\n removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);\n}\n/**\n * The names of the motion values we want to apply as translation, scale and origin.\n */\nconst xKeys = [\"x\", \"scaleX\", \"originX\"];\nconst yKeys = [\"y\", \"scaleY\", \"originY\"];\n/**\n * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeBoxTransforms(box, transforms, originBox, sourceBox) {\n removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined);\n removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined);\n}\n\nexport { removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta };\n//# sourceMappingURL=delta-remove.mjs.map\n","import { calcLength } from './delta-calc.mjs';\n\nfunction isAxisDeltaZero(delta) {\n return delta.translate === 0 && delta.scale === 1;\n}\nfunction isDeltaZero(delta) {\n return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);\n}\nfunction axisEquals(a, b) {\n return a.min === b.min && a.max === b.max;\n}\nfunction boxEquals(a, b) {\n return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);\n}\nfunction axisEqualsRounded(a, b) {\n return (Math.round(a.min) === Math.round(b.min) &&\n Math.round(a.max) === Math.round(b.max));\n}\nfunction boxEqualsRounded(a, b) {\n return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);\n}\nfunction aspectRatio(box) {\n return calcLength(box.x) / calcLength(box.y);\n}\nfunction axisDeltaEquals(a, b) {\n return (a.translate === b.translate &&\n a.scale === b.scale &&\n a.originPoint === b.originPoint);\n}\n\nexport { aspectRatio, axisDeltaEquals, axisEquals, axisEqualsRounded, boxEquals, boxEqualsRounded, isDeltaZero };\n//# sourceMappingURL=utils.mjs.map\n","function eachAxis(callback) {\n return [callback(\"x\"), callback(\"y\")];\n}\n\nexport { eachAxis };\n//# sourceMappingURL=each-axis.mjs.map\n","function buildProjectionTransform(delta, treeScale, latestTransform) {\n let transform = \"\";\n /**\n * The translations we use to calculate are always relative to the viewport coordinate space.\n * But when we apply scales, we also scale the coordinate space of an element and its children.\n * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need\n * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.\n */\n const xTranslate = delta.x.translate / treeScale.x;\n const yTranslate = delta.y.translate / treeScale.y;\n const zTranslate = latestTransform?.z || 0;\n if (xTranslate || yTranslate || zTranslate) {\n transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;\n }\n /**\n * Apply scale correction for the tree transform.\n * This will apply scale to the screen-orientated axes.\n */\n if (treeScale.x !== 1 || treeScale.y !== 1) {\n transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;\n }\n if (latestTransform) {\n const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform;\n if (transformPerspective)\n transform = `perspective(${transformPerspective}px) ${transform}`;\n if (rotate)\n transform += `rotate(${rotate}deg) `;\n if (rotateX)\n transform += `rotateX(${rotateX}deg) `;\n if (rotateY)\n transform += `rotateY(${rotateY}deg) `;\n if (skewX)\n transform += `skewX(${skewX}deg) `;\n if (skewY)\n transform += `skewY(${skewY}deg) `;\n }\n /**\n * Apply scale to match the size of the element to the size we want it.\n * This will apply scale to the element-orientated axes.\n */\n const elementScaleX = delta.x.scale * treeScale.x;\n const elementScaleY = delta.y.scale * treeScale.y;\n if (elementScaleX !== 1 || elementScaleY !== 1) {\n transform += `scale(${elementScaleX}, ${elementScaleY})`;\n }\n return transform || \"none\";\n}\n\nexport { buildProjectionTransform };\n//# sourceMappingURL=transform.mjs.map\n","import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent, px } from '../../value/types/numbers/units.mjs';\nimport { progress, circOut, noop } from 'motion-utils';\n\nconst borderLabels = [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n];\nconst numBorders = borderLabels.length;\nconst asNumber = (value) => typeof value === \"string\" ? parseFloat(value) : value;\nconst isPx = (value) => typeof value === \"number\" || px.test(value);\nfunction mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress));\n target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress));\n }\n else if (isOnlyMember) {\n target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress);\n }\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = borderLabels[i];\n let followRadius = getRadius(follow, borderLabel);\n let leadRadius = getRadius(lead, borderLabel);\n if (followRadius === undefined && leadRadius === undefined)\n continue;\n followRadius || (followRadius = 0);\n leadRadius || (leadRadius = 0);\n const canMix = followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius);\n if (canMix) {\n target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0);\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\";\n }\n }\n else {\n target[borderLabel] = leadRadius;\n }\n }\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress);\n }\n}\nfunction getRadius(values, radiusName) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius;\n}\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut);\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop);\nfunction compress(min, max, easing) {\n return (p) => {\n // Could replace ifs with clamp\n if (p < min)\n return 0;\n if (p > max)\n return 1;\n return easing(progress(min, max, p));\n };\n}\n\nexport { mixValues };\n//# sourceMappingURL=mix-values.mjs.map\n","import { animateMotionValue } from '../interfaces/motion-value.mjs';\nimport { motionValue } from '../../value/index.mjs';\nimport { isMotionValue } from '../../value/utils/is-motion-value.mjs';\n\nfunction animateSingleValue(value, keyframes, options) {\n const motionValue$1 = isMotionValue(value) ? value : motionValue(value);\n motionValue$1.start(animateMotionValue(\"\", motionValue$1, keyframes, options));\n return motionValue$1.animation;\n}\n\nexport { animateSingleValue };\n//# sourceMappingURL=single-value.mjs.map\n","function addDomEvent(target, eventName, handler, options = { passive: true }) {\n target.addEventListener(eventName, handler, options);\n return () => target.removeEventListener(eventName, handler);\n}\n\nexport { addDomEvent };\n//# sourceMappingURL=add-dom-event.mjs.map\n","const compareByDepth = (a, b) => a.depth - b.depth;\n\nexport { compareByDepth };\n//# sourceMappingURL=compare-by-depth.mjs.map\n","import { addUniqueItem, removeItem } from 'motion-utils';\nimport { compareByDepth } from './compare-by-depth.mjs';\n\nclass FlatTree {\n constructor() {\n this.children = [];\n this.isDirty = false;\n }\n add(child) {\n addUniqueItem(this.children, child);\n this.isDirty = true;\n }\n remove(child) {\n removeItem(this.children, child);\n this.isDirty = true;\n }\n forEach(callback) {\n this.isDirty && this.children.sort(compareByDepth);\n this.isDirty = false;\n this.children.forEach(callback);\n }\n}\n\nexport { FlatTree };\n//# sourceMappingURL=flat-tree.mjs.map\n","import { time } from '../frameloop/sync-time.mjs';\nimport { secondsToMilliseconds } from 'motion-utils';\nimport { frame, cancelFrame } from '../frameloop/frame.mjs';\n\n/**\n * Timeout defined in ms\n */\nfunction delay(callback, timeout) {\n const start = time.now();\n const checkElapsed = ({ timestamp }) => {\n const elapsed = timestamp - start;\n if (elapsed >= timeout) {\n cancelFrame(checkElapsed);\n callback(elapsed - timeout);\n }\n };\n frame.setup(checkElapsed, true);\n return () => cancelFrame(checkElapsed);\n}\nfunction delayInSeconds(callback, timeout) {\n return delay(callback, secondsToMilliseconds(timeout));\n}\n\nexport { delay, delayInSeconds };\n//# sourceMappingURL=delay.mjs.map\n","import { isMotionValue } from './is-motion-value.mjs';\n\n/**\n * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself\n */\nfunction resolveMotionValue(value) {\n return isMotionValue(value) ? value.get() : value;\n}\n\nexport { resolveMotionValue };\n//# sourceMappingURL=resolve-motion-value.mjs.map\n","import { addUniqueItem, removeItem } from 'motion-utils';\n\nclass NodeStack {\n constructor() {\n this.members = [];\n }\n add(node) {\n addUniqueItem(this.members, node);\n for (let i = this.members.length - 1; i >= 0; i--) {\n const member = this.members[i];\n if (member === node || member === this.lead || member === this.prevLead)\n continue;\n const inst = member.instance;\n if ((!inst || inst.isConnected === false) && !member.snapshot) {\n removeItem(this.members, member);\n member.unmount();\n }\n }\n node.scheduleRender();\n }\n remove(node) {\n removeItem(this.members, node);\n if (node === this.prevLead)\n this.prevLead = undefined;\n if (node === this.lead) {\n const prevLead = this.members[this.members.length - 1];\n if (prevLead)\n this.promote(prevLead);\n }\n }\n relegate(node) {\n for (let i = this.members.indexOf(node) - 1; i >= 0; i--) {\n const member = this.members[i];\n if (member.isPresent !== false && member.instance?.isConnected !== false) {\n this.promote(member);\n return true;\n }\n }\n return false;\n }\n promote(node, preserveFollowOpacity) {\n const prevLead = this.lead;\n if (node === prevLead)\n return;\n this.prevLead = prevLead;\n this.lead = node;\n node.show();\n if (prevLead) {\n prevLead.updateSnapshot();\n node.scheduleRender();\n const { layoutDependency: prevDep } = prevLead.options;\n const { layoutDependency: nextDep } = node.options;\n if (prevDep === undefined || prevDep !== nextDep) {\n node.resumeFrom = prevLead;\n if (preserveFollowOpacity)\n prevLead.preserveOpacity = true;\n if (prevLead.snapshot) {\n node.snapshot = prevLead.snapshot;\n node.snapshot.latestValues =\n prevLead.animationValues || prevLead.latestValues;\n }\n if (node.root?.isUpdating)\n node.isLayoutDirty = true;\n }\n if (node.options.crossfade === false)\n prevLead.hide();\n }\n }\n exitAnimationComplete() {\n this.members.forEach((member) => {\n member.options.onExitComplete?.();\n member.resumingFrom?.options.onExitComplete?.();\n });\n }\n scheduleRender() {\n this.members.forEach((member) => member.instance && member.scheduleRender(false));\n }\n removeLeadSnapshot() {\n if (this.lead?.snapshot)\n this.lead.snapshot = undefined;\n }\n}\n\nexport { NodeStack };\n//# sourceMappingURL=stack.mjs.map\n","/**\n * This should only ever be modified on the client otherwise it'll\n * persist through server requests. If we need instanced states we\n * could lazy-init via root.\n */\nconst globalProjectionState = {\n /**\n * Global flag as to whether the tree has animated since the last time\n * we resized the window\n */\n hasAnimatedSinceResize: true,\n /**\n * We set this to true once, on the first update. Any nodes added to the tree beyond that\n * update will be given a `data-projection-id` attribute.\n */\n hasEverUpdated: false,\n};\n\nexport { globalProjectionState };\n//# sourceMappingURL=state.mjs.map\n","import { SubscriptionManager, clamp, noop } from 'motion-utils';\nimport { animateSingleValue } from '../../animation/animate/single-value.mjs';\nimport { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';\nimport { getValueTransition } from '../../animation/utils/get-value-transition.mjs';\nimport { microtask } from '../../frameloop/microtask.mjs';\nimport { time } from '../../frameloop/sync-time.mjs';\nimport { scaleCorrectors } from '../styles/scale-correction.mjs';\nimport { activeAnimations } from '../../stats/animation-count.mjs';\nimport { statsBuffer } from '../../stats/buffer.mjs';\nimport { delay } from '../../utils/delay.mjs';\nimport { isSVGElement } from '../../utils/is-svg-element.mjs';\nimport { isSVGSVGElement } from '../../utils/is-svg-svg-element.mjs';\nimport { mixNumber } from '../../utils/mix/number.mjs';\nimport { motionValue } from '../../value/index.mjs';\nimport { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';\nimport { mixValues } from '../animation/mix-values.mjs';\nimport { copyBoxInto, copyAxisDeltaInto, copyAxisInto } from '../geometry/copy.mjs';\nimport { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../geometry/delta-apply.mjs';\nimport { calcLength, calcRelativeBox, calcRelativePosition, calcBoxDelta, isNear } from '../geometry/delta-calc.mjs';\nimport { removeBoxTransforms } from '../geometry/delta-remove.mjs';\nimport { createBox, createDelta } from '../geometry/models.mjs';\nimport { boxEqualsRounded, isDeltaZero, axisDeltaEquals, boxEquals, aspectRatio } from '../geometry/utils.mjs';\nimport { NodeStack } from '../shared/stack.mjs';\nimport { buildProjectionTransform } from '../styles/transform.mjs';\nimport { eachAxis } from '../utils/each-axis.mjs';\nimport { FlatTree } from '../utils/flat-tree.mjs';\nimport { hasTransform, hasScale, has2DTranslate } from '../utils/has-transform.mjs';\nimport { globalProjectionState } from './state.mjs';\nimport { frame, cancelFrame, frameData, frameSteps } from '../../frameloop/frame.mjs';\n\nconst metrics = {\n nodes: 0,\n calculatedTargetDeltas: 0,\n calculatedProjections: 0,\n};\nconst transformAxes = [\"\", \"X\", \"Y\", \"Z\"];\n/**\n * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1\n * which has a noticeable difference in spring animations\n */\nconst animationTarget = 1000;\nlet id = 0;\nfunction resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {\n const { latestValues } = visualElement;\n // Record the distorting transform and then temporarily set it to 0\n if (latestValues[key]) {\n values[key] = latestValues[key];\n visualElement.setStaticValue(key, 0);\n if (sharedAnimationValues) {\n sharedAnimationValues[key] = 0;\n }\n }\n}\nfunction cancelTreeOptimisedTransformAnimations(projectionNode) {\n projectionNode.hasCheckedOptimisedAppear = true;\n if (projectionNode.root === projectionNode)\n return;\n const { visualElement } = projectionNode.options;\n if (!visualElement)\n return;\n const appearId = getOptimisedAppearId(visualElement);\n if (window.MotionHasOptimisedAnimation(appearId, \"transform\")) {\n const { layout, layoutId } = projectionNode.options;\n window.MotionCancelOptimisedAnimation(appearId, \"transform\", frame, !(layout || layoutId));\n }\n const { parent } = projectionNode;\n if (parent && !parent.hasCheckedOptimisedAppear) {\n cancelTreeOptimisedTransformAnimations(parent);\n }\n}\nfunction createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {\n return class ProjectionNode {\n constructor(latestValues = {}, parent = defaultParent?.()) {\n /**\n * A unique ID generated for every projection node.\n */\n this.id = id++;\n /**\n * An id that represents a unique session instigated by startUpdate.\n */\n this.animationId = 0;\n this.animationCommitId = 0;\n /**\n * A Set containing all this component's children. This is used to iterate\n * through the children.\n *\n * TODO: This could be faster to iterate as a flat array stored on the root node.\n */\n this.children = new Set();\n /**\n * Options for the node. We use this to configure what kind of layout animations\n * we should perform (if any).\n */\n this.options = {};\n /**\n * We use this to detect when its safe to shut down part of a projection tree.\n * We have to keep projecting children for scale correction and relative projection\n * until all their parents stop performing layout animations.\n */\n this.isTreeAnimating = false;\n this.isAnimationBlocked = false;\n /**\n * Flag to true if we think this layout has been changed. We can't always know this,\n * currently we set it to true every time a component renders, or if it has a layoutDependency\n * if that has changed between renders. Additionally, components can be grouped by LayoutGroup\n * and if one node is dirtied, they all are.\n */\n this.isLayoutDirty = false;\n /**\n * Flag to true if we think the projection calculations for this node needs\n * recalculating as a result of an updated transform or layout animation.\n */\n this.isProjectionDirty = false;\n /**\n * Flag to true if the layout *or* transform has changed. This then gets propagated\n * throughout the projection tree, forcing any element below to recalculate on the next frame.\n */\n this.isSharedProjectionDirty = false;\n /**\n * Flag transform dirty. This gets propagated throughout the whole tree but is only\n * respected by shared nodes.\n */\n this.isTransformDirty = false;\n /**\n * Block layout updates for instant layout transitions throughout the tree.\n */\n this.updateManuallyBlocked = false;\n this.updateBlockedByResize = false;\n /**\n * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`\n * call.\n */\n this.isUpdating = false;\n /**\n * If this is an SVG element we currently disable projection transforms\n */\n this.isSVG = false;\n /**\n * Flag to true (during promotion) if a node doing an instant layout transition needs to reset\n * its projection styles.\n */\n this.needsReset = false;\n /**\n * Flags whether this node should have its transform reset prior to measuring.\n */\n this.shouldResetTransform = false;\n /**\n * Store whether this node has been checked for optimised appear animations. As\n * effects fire bottom-up, and we want to look up the tree for appear animations,\n * this makes sure we only check each path once, stopping at nodes that\n * have already been checked.\n */\n this.hasCheckedOptimisedAppear = false;\n /**\n * An object representing the calculated contextual/accumulated/tree scale.\n * This will be used to scale calculcated projection transforms, as these are\n * calculated in screen-space but need to be scaled for elements to layoutly\n * make it to their calculated destinations.\n *\n * TODO: Lazy-init\n */\n this.treeScale = { x: 1, y: 1 };\n /**\n *\n */\n this.eventHandlers = new Map();\n this.hasTreeAnimated = false;\n this.layoutVersion = 0;\n // Note: Currently only running on root node\n this.updateScheduled = false;\n this.scheduleUpdate = () => this.update();\n this.projectionUpdateScheduled = false;\n this.checkUpdateFailed = () => {\n if (this.isUpdating) {\n this.isUpdating = false;\n this.clearAllSnapshots();\n }\n };\n /**\n * This is a multi-step process as shared nodes might be of different depths. Nodes\n * are sorted by depth order, so we need to resolve the entire tree before moving to\n * the next step.\n */\n this.updateProjection = () => {\n this.projectionUpdateScheduled = false;\n /**\n * Reset debug counts. Manually resetting rather than creating a new\n * object each frame.\n */\n if (statsBuffer.value) {\n metrics.nodes =\n metrics.calculatedTargetDeltas =\n metrics.calculatedProjections =\n 0;\n }\n this.nodes.forEach(propagateDirtyNodes);\n this.nodes.forEach(resolveTargetDelta);\n this.nodes.forEach(calcProjection);\n this.nodes.forEach(cleanDirtyNodes);\n if (statsBuffer.addProjectionMetrics) {\n statsBuffer.addProjectionMetrics(metrics);\n }\n };\n /**\n * Frame calculations\n */\n this.resolvedRelativeTargetAt = 0.0;\n this.linkedParentVersion = 0;\n this.hasProjected = false;\n this.isVisible = true;\n this.animationProgress = 0;\n /**\n * Shared layout\n */\n // TODO Only running on root node\n this.sharedNodes = new Map();\n this.latestValues = latestValues;\n this.root = parent ? parent.root || parent : this;\n this.path = parent ? [...parent.path, parent] : [];\n this.parent = parent;\n this.depth = parent ? parent.depth + 1 : 0;\n for (let i = 0; i < this.path.length; i++) {\n this.path[i].shouldResetTransform = true;\n }\n if (this.root === this)\n this.nodes = new FlatTree();\n }\n addEventListener(name, handler) {\n if (!this.eventHandlers.has(name)) {\n this.eventHandlers.set(name, new SubscriptionManager());\n }\n return this.eventHandlers.get(name).add(handler);\n }\n notifyListeners(name, ...args) {\n const subscriptionManager = this.eventHandlers.get(name);\n subscriptionManager && subscriptionManager.notify(...args);\n }\n hasListeners(name) {\n return this.eventHandlers.has(name);\n }\n /**\n * Lifecycles\n */\n mount(instance) {\n if (this.instance)\n return;\n this.isSVG = isSVGElement(instance) && !isSVGSVGElement(instance);\n this.instance = instance;\n const { layoutId, layout, visualElement } = this.options;\n if (visualElement && !visualElement.current) {\n visualElement.mount(instance);\n }\n this.root.nodes.add(this);\n this.parent && this.parent.children.add(this);\n if (this.root.hasTreeAnimated && (layout || layoutId)) {\n this.isLayoutDirty = true;\n }\n if (attachResizeListener) {\n let cancelDelay;\n let innerWidth = 0;\n const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false);\n // Set initial innerWidth in a frame.read callback to batch the read\n frame.read(() => {\n innerWidth = window.innerWidth;\n });\n attachResizeListener(instance, () => {\n const newInnerWidth = window.innerWidth;\n if (newInnerWidth === innerWidth)\n return;\n innerWidth = newInnerWidth;\n this.root.updateBlockedByResize = true;\n cancelDelay && cancelDelay();\n cancelDelay = delay(resizeUnblockUpdate, 250);\n if (globalProjectionState.hasAnimatedSinceResize) {\n globalProjectionState.hasAnimatedSinceResize = false;\n this.nodes.forEach(finishAnimation);\n }\n });\n }\n if (layoutId) {\n this.root.registerSharedNode(layoutId, this);\n }\n // Only register the handler if it requires layout animation\n if (this.options.animate !== false &&\n visualElement &&\n (layoutId || layout)) {\n this.addEventListener(\"didUpdate\", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout, }) => {\n if (this.isTreeAnimationBlocked()) {\n this.target = undefined;\n this.relativeTarget = undefined;\n return;\n }\n // TODO: Check here if an animation exists\n const layoutTransition = this.options.transition ||\n visualElement.getDefaultTransition() ||\n defaultLayoutTransition;\n const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps();\n /**\n * The target layout of the element might stay the same,\n * but its position relative to its parent has changed.\n */\n const hasTargetChanged = !this.targetLayout ||\n !boxEqualsRounded(this.targetLayout, newLayout);\n /*\n * Note: Disabled to fix relative animations always triggering new\n * layout animations. If this causes further issues, we can try\n * a different approach to detecting relative target changes.\n */\n // || hasRelativeLayoutChanged\n /**\n * If the layout hasn't seemed to have changed, it might be that the\n * element is visually in the same place in the document but its position\n * relative to its parent has indeed changed. So here we check for that.\n */\n const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged;\n if (this.options.layoutRoot ||\n this.resumeFrom ||\n hasOnlyRelativeTargetChanged ||\n (hasLayoutChanged &&\n (hasTargetChanged || !this.currentAnimation))) {\n if (this.resumeFrom) {\n this.resumingFrom = this.resumeFrom;\n this.resumingFrom.resumingFrom = undefined;\n }\n const animationOptions = {\n ...getValueTransition(layoutTransition, \"layout\"),\n onPlay: onLayoutAnimationStart,\n onComplete: onLayoutAnimationComplete,\n };\n if (visualElement.shouldReduceMotion ||\n this.options.layoutRoot) {\n animationOptions.delay = 0;\n animationOptions.type = false;\n }\n this.startAnimation(animationOptions);\n /**\n * Set animation origin after starting animation to avoid layout jump\n * caused by stopping previous layout animation\n */\n this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);\n }\n else {\n /**\n * If the layout hasn't changed and we have an animation that hasn't started yet,\n * finish it immediately. Otherwise it will be animating from a location\n * that was probably never committed to screen and look like a jumpy box.\n */\n if (!hasLayoutChanged) {\n finishAnimation(this);\n }\n if (this.isLead() && this.options.onExitComplete) {\n this.options.onExitComplete();\n }\n }\n this.targetLayout = newLayout;\n });\n }\n }\n unmount() {\n this.options.layoutId && this.willUpdate();\n this.root.nodes.remove(this);\n const stack = this.getStack();\n stack && stack.remove(this);\n this.parent && this.parent.children.delete(this);\n this.instance = undefined;\n this.eventHandlers.clear();\n cancelFrame(this.updateProjection);\n }\n // only on the root\n blockUpdate() {\n this.updateManuallyBlocked = true;\n }\n unblockUpdate() {\n this.updateManuallyBlocked = false;\n }\n isUpdateBlocked() {\n return this.updateManuallyBlocked || this.updateBlockedByResize;\n }\n isTreeAnimationBlocked() {\n return (this.isAnimationBlocked ||\n (this.parent && this.parent.isTreeAnimationBlocked()) ||\n false);\n }\n // Note: currently only running on root node\n startUpdate() {\n if (this.isUpdateBlocked())\n return;\n this.isUpdating = true;\n this.nodes && this.nodes.forEach(resetSkewAndRotation);\n this.animationId++;\n }\n getTransformTemplate() {\n const { visualElement } = this.options;\n return visualElement && visualElement.getProps().transformTemplate;\n }\n willUpdate(shouldNotifyListeners = true) {\n this.root.hasTreeAnimated = true;\n if (this.root.isUpdateBlocked()) {\n this.options.onExitComplete && this.options.onExitComplete();\n return;\n }\n /**\n * If we're running optimised appear animations then these must be\n * cancelled before measuring the DOM. This is so we can measure\n * the true layout of the element rather than the WAAPI animation\n * which will be unaffected by the resetSkewAndRotate step.\n *\n * Note: This is a DOM write. Worst case scenario is this is sandwiched\n * between other snapshot reads which will cause unnecessary style recalculations.\n * This has to happen here though, as we don't yet know which nodes will need\n * snapshots in startUpdate(), but we only want to cancel optimised animations\n * if a layout animation measurement is actually going to be affected by them.\n */\n if (window.MotionCancelOptimisedAnimation &&\n !this.hasCheckedOptimisedAppear) {\n cancelTreeOptimisedTransformAnimations(this);\n }\n !this.root.isUpdating && this.root.startUpdate();\n if (this.isLayoutDirty)\n return;\n this.isLayoutDirty = true;\n for (let i = 0; i < this.path.length; i++) {\n const node = this.path[i];\n node.shouldResetTransform = true;\n /**\n * Percentage translates resolve against layoutBox dimensions,\n * so ancestors with them must be re-measured after transform reset.\n */\n if (typeof node.latestValues.x === \"string\" ||\n typeof node.latestValues.y === \"string\") {\n node.isLayoutDirty = true;\n }\n node.updateScroll(\"snapshot\");\n if (node.options.layoutRoot) {\n node.willUpdate(false);\n }\n }\n const { layoutId, layout } = this.options;\n if (layoutId === undefined && !layout)\n return;\n const transformTemplate = this.getTransformTemplate();\n this.prevTransformTemplateValue = transformTemplate\n ? transformTemplate(this.latestValues, \"\")\n : undefined;\n this.updateSnapshot();\n shouldNotifyListeners && this.notifyListeners(\"willUpdate\");\n }\n update() {\n this.updateScheduled = false;\n const updateWasBlocked = this.isUpdateBlocked();\n // When doing an instant transition, we skip the layout update,\n // but should still clean up the measurements so that the next\n // snapshot could be taken correctly.\n if (updateWasBlocked) {\n const wasBlockedByResize = this.updateBlockedByResize;\n this.unblockUpdate();\n this.updateBlockedByResize = false;\n this.clearAllSnapshots();\n /**\n * When blocked by resize, still measure layouts so\n * callbacks like onLayoutMeasure fire (e.g. Reorder).\n * Skip notifyLayoutUpdate to prevent animations.\n */\n if (wasBlockedByResize) {\n this.nodes.forEach(forceLayoutMeasure);\n }\n this.nodes.forEach(clearMeasurements);\n return;\n }\n /**\n * If this is a repeat of didUpdate then ignore the animation.\n */\n if (this.animationId <= this.animationCommitId) {\n this.nodes.forEach(clearIsLayoutDirty);\n return;\n }\n this.animationCommitId = this.animationId;\n if (!this.isUpdating) {\n this.nodes.forEach(clearIsLayoutDirty);\n }\n else {\n this.isUpdating = false;\n /**\n * Ensure animation-blocked nodes (e.g. during drag)\n * get measured even when memoized (willUpdate skipped).\n */\n this.nodes.forEach(ensureDraggedNodesSnapshotted);\n /**\n * Write\n */\n this.nodes.forEach(resetTransformStyle);\n /**\n * Read ==================\n */\n // Update layout measurements of updated children\n this.nodes.forEach(updateLayout);\n /**\n * Write\n */\n // Notify listeners that the layout is updated\n this.nodes.forEach(notifyLayoutUpdate);\n }\n this.clearAllSnapshots();\n /**\n * Manually flush any pending updates. Ideally\n * we could leave this to the following requestAnimationFrame but this seems\n * to leave a flash of incorrectly styled content.\n */\n const now = time.now();\n frameData.delta = clamp(0, 1000 / 60, now - frameData.timestamp);\n frameData.timestamp = now;\n frameData.isProcessing = true;\n frameSteps.update.process(frameData);\n frameSteps.preRender.process(frameData);\n frameSteps.render.process(frameData);\n frameData.isProcessing = false;\n }\n didUpdate() {\n if (!this.updateScheduled) {\n this.updateScheduled = true;\n microtask.read(this.scheduleUpdate);\n }\n }\n clearAllSnapshots() {\n this.nodes.forEach(clearSnapshot);\n this.sharedNodes.forEach(removeLeadSnapshots);\n }\n scheduleUpdateProjection() {\n if (!this.projectionUpdateScheduled) {\n this.projectionUpdateScheduled = true;\n frame.preRender(this.updateProjection, false, true);\n }\n }\n scheduleCheckAfterUnmount() {\n /**\n * If the unmounting node is in a layoutGroup and did trigger a willUpdate,\n * we manually call didUpdate to give a chance to the siblings to animate.\n * Otherwise, cleanup all snapshots to prevents future nodes from reusing them.\n */\n frame.postRender(() => {\n if (this.isLayoutDirty) {\n this.root.didUpdate();\n }\n else {\n this.root.checkUpdateFailed();\n }\n });\n }\n /**\n * Update measurements\n */\n updateSnapshot() {\n if (this.snapshot || !this.instance)\n return;\n this.snapshot = this.measure();\n if (this.snapshot &&\n !calcLength(this.snapshot.measuredBox.x) &&\n !calcLength(this.snapshot.measuredBox.y)) {\n this.snapshot = undefined;\n }\n }\n updateLayout() {\n if (!this.instance)\n return;\n this.updateScroll();\n if (!(this.options.alwaysMeasureLayout && this.isLead()) &&\n !this.isLayoutDirty) {\n return;\n }\n /**\n * When a node is mounted, it simply resumes from the prevLead's\n * snapshot instead of taking a new one, but the ancestors scroll\n * might have updated while the prevLead is unmounted. We need to\n * update the scroll again to make sure the layout we measure is\n * up to date.\n */\n if (this.resumeFrom && !this.resumeFrom.instance) {\n for (let i = 0; i < this.path.length; i++) {\n const node = this.path[i];\n node.updateScroll();\n }\n }\n const prevLayout = this.layout;\n this.layout = this.measure(false);\n this.layoutVersion++;\n if (!this.layoutCorrected)\n this.layoutCorrected = createBox();\n this.isLayoutDirty = false;\n this.projectionDelta = undefined;\n this.notifyListeners(\"measure\", this.layout.layoutBox);\n const { visualElement } = this.options;\n visualElement &&\n visualElement.notify(\"LayoutMeasure\", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined);\n }\n updateScroll(phase = \"measure\") {\n let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);\n if (this.scroll &&\n this.scroll.animationId === this.root.animationId &&\n this.scroll.phase === phase) {\n needsMeasurement = false;\n }\n if (needsMeasurement && this.instance) {\n const isRoot = checkIsScrollRoot(this.instance);\n this.scroll = {\n animationId: this.root.animationId,\n phase,\n isRoot,\n offset: measureScroll(this.instance),\n wasRoot: this.scroll ? this.scroll.isRoot : isRoot,\n };\n }\n }\n resetTransform() {\n if (!resetTransform)\n return;\n const isResetRequested = this.isLayoutDirty ||\n this.shouldResetTransform ||\n this.options.alwaysMeasureLayout;\n const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);\n const transformTemplate = this.getTransformTemplate();\n const transformTemplateValue = transformTemplate\n ? transformTemplate(this.latestValues, \"\")\n : undefined;\n const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;\n if (isResetRequested &&\n this.instance &&\n (hasProjection ||\n hasTransform(this.latestValues) ||\n transformTemplateHasChanged)) {\n resetTransform(this.instance, transformTemplateValue);\n this.shouldResetTransform = false;\n this.scheduleRender();\n }\n }\n measure(removeTransform = true) {\n const pageBox = this.measurePageBox();\n let layoutBox = this.removeElementScroll(pageBox);\n /**\n * Measurements taken during the pre-render stage\n * still have transforms applied so we remove them\n * via calculation.\n */\n if (removeTransform) {\n layoutBox = this.removeTransform(layoutBox);\n }\n roundBox(layoutBox);\n return {\n animationId: this.root.animationId,\n measuredBox: pageBox,\n layoutBox,\n latestValues: {},\n source: this.id,\n };\n }\n measurePageBox() {\n const { visualElement } = this.options;\n if (!visualElement)\n return createBox();\n const box = visualElement.measureViewportBox();\n const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot);\n if (!wasInScrollRoot) {\n // Remove viewport scroll to give page-relative coordinates\n const { scroll } = this.root;\n if (scroll) {\n translateAxis(box.x, scroll.offset.x);\n translateAxis(box.y, scroll.offset.y);\n }\n }\n return box;\n }\n removeElementScroll(box) {\n const boxWithoutScroll = createBox();\n copyBoxInto(boxWithoutScroll, box);\n if (this.scroll?.wasRoot) {\n return boxWithoutScroll;\n }\n /**\n * Performance TODO: Keep a cumulative scroll offset down the tree\n * rather than loop back up the path.\n */\n for (let i = 0; i < this.path.length; i++) {\n const node = this.path[i];\n const { scroll, options } = node;\n if (node !== this.root && scroll && options.layoutScroll) {\n /**\n * If this is a new scroll root, we want to remove all previous scrolls\n * from the viewport box.\n */\n if (scroll.wasRoot) {\n copyBoxInto(boxWithoutScroll, box);\n }\n translateAxis(boxWithoutScroll.x, scroll.offset.x);\n translateAxis(boxWithoutScroll.y, scroll.offset.y);\n }\n }\n return boxWithoutScroll;\n }\n applyTransform(box, transformOnly = false, output) {\n const withTransforms = output || createBox();\n copyBoxInto(withTransforms, box);\n for (let i = 0; i < this.path.length; i++) {\n const node = this.path[i];\n if (!transformOnly &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root) {\n translateAxis(withTransforms.x, -node.scroll.offset.x);\n translateAxis(withTransforms.y, -node.scroll.offset.y);\n }\n if (!hasTransform(node.latestValues))\n continue;\n transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);\n }\n if (hasTransform(this.latestValues)) {\n transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);\n }\n return withTransforms;\n }\n removeTransform(box) {\n const boxWithoutTransform = createBox();\n copyBoxInto(boxWithoutTransform, box);\n for (let i = 0; i < this.path.length; i++) {\n const node = this.path[i];\n if (!hasTransform(node.latestValues))\n continue;\n let sourceBox;\n if (node.instance) {\n hasScale(node.latestValues) && node.updateSnapshot();\n sourceBox = createBox();\n copyBoxInto(sourceBox, node.measurePageBox());\n }\n removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox);\n }\n if (hasTransform(this.latestValues)) {\n removeBoxTransforms(boxWithoutTransform, this.latestValues);\n }\n return boxWithoutTransform;\n }\n setTargetDelta(delta) {\n this.targetDelta = delta;\n this.root.scheduleUpdateProjection();\n this.isProjectionDirty = true;\n }\n setOptions(options) {\n this.options = {\n ...this.options,\n ...options,\n crossfade: options.crossfade !== undefined ? options.crossfade : true,\n };\n }\n clearMeasurements() {\n this.scroll = undefined;\n this.layout = undefined;\n this.snapshot = undefined;\n this.prevTransformTemplateValue = undefined;\n this.targetDelta = undefined;\n this.target = undefined;\n this.isLayoutDirty = false;\n }\n forceRelativeParentToResolveTarget() {\n if (!this.relativeParent)\n return;\n /**\n * If the parent target isn't up-to-date, force it to update.\n * This is an unfortunate de-optimisation as it means any updating relative\n * projection will cause all the relative parents to recalculate back\n * up the tree.\n */\n if (this.relativeParent.resolvedRelativeTargetAt !==\n frameData.timestamp) {\n this.relativeParent.resolveTargetDelta(true);\n }\n }\n resolveTargetDelta(forceRecalculation = false) {\n /**\n * Once the dirty status of nodes has been spread through the tree, we also\n * need to check if we have a shared node of a different depth that has itself\n * been dirtied.\n */\n const lead = this.getLead();\n this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);\n this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);\n this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);\n const isShared = Boolean(this.resumingFrom) || this !== lead;\n /**\n * We don't use transform for this step of processing so we don't\n * need to check whether any nodes have changed transform.\n */\n const canSkip = !(forceRecalculation ||\n (isShared && this.isSharedProjectionDirty) ||\n this.isProjectionDirty ||\n this.parent?.isProjectionDirty ||\n this.attemptToResolveRelativeTarget ||\n this.root.updateBlockedByResize);\n if (canSkip)\n return;\n const { layout, layoutId } = this.options;\n /**\n * If we have no layout, we can't perform projection, so early return\n */\n if (!this.layout || !(layout || layoutId))\n return;\n this.resolvedRelativeTargetAt = frameData.timestamp;\n const relativeParent = this.getClosestProjectingParent();\n if (relativeParent &&\n this.linkedParentVersion !== relativeParent.layoutVersion &&\n !relativeParent.options.layoutRoot) {\n this.removeRelativeTarget();\n }\n /**\n * If we don't have a targetDelta but do have a layout, we can attempt to resolve\n * a relativeParent. This will allow a component to perform scale correction\n * even if no animation has started.\n */\n if (!this.targetDelta && !this.relativeTarget) {\n if (this.options.layoutAnchor !== false &&\n relativeParent &&\n relativeParent.layout) {\n this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);\n }\n else {\n this.removeRelativeTarget();\n }\n }\n /**\n * If we have no relative target or no target delta our target isn't valid\n * for this frame.\n */\n if (!this.relativeTarget && !this.targetDelta)\n return;\n /**\n * Lazy-init target data structure\n */\n if (!this.target) {\n this.target = createBox();\n this.targetWithTransforms = createBox();\n }\n /**\n * If we've got a relative box for this component, resolve it into a target relative to the parent.\n */\n if (this.relativeTarget &&\n this.relativeTargetOrigin &&\n this.relativeParent &&\n this.relativeParent.target) {\n this.forceRelativeParentToResolveTarget();\n calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || undefined);\n /**\n * If we've only got a targetDelta, resolve it into a target\n */\n }\n else if (this.targetDelta) {\n if (Boolean(this.resumingFrom)) {\n this.applyTransform(this.layout.layoutBox, false, this.target);\n }\n else {\n copyBoxInto(this.target, this.layout.layoutBox);\n }\n applyBoxDelta(this.target, this.targetDelta);\n }\n else {\n /**\n * If no target, use own layout as target\n */\n copyBoxInto(this.target, this.layout.layoutBox);\n }\n /**\n * If we've been told to attempt to resolve a relative target, do so.\n */\n if (this.attemptToResolveRelativeTarget) {\n this.attemptToResolveRelativeTarget = false;\n if (this.options.layoutAnchor !== false &&\n relativeParent &&\n Boolean(relativeParent.resumingFrom) ===\n Boolean(this.resumingFrom) &&\n !relativeParent.options.layoutScroll &&\n relativeParent.target &&\n this.animationProgress !== 1) {\n this.createRelativeTarget(relativeParent, this.target, relativeParent.target);\n }\n else {\n this.relativeParent = this.relativeTarget = undefined;\n }\n }\n /**\n * Increase debug counter for resolved target deltas\n */\n if (statsBuffer.value) {\n metrics.calculatedTargetDeltas++;\n }\n }\n getClosestProjectingParent() {\n if (!this.parent ||\n hasScale(this.parent.latestValues) ||\n has2DTranslate(this.parent.latestValues)) {\n return undefined;\n }\n if (this.parent.isProjecting()) {\n return this.parent;\n }\n else {\n return this.parent.getClosestProjectingParent();\n }\n }\n isProjecting() {\n return Boolean((this.relativeTarget ||\n this.targetDelta ||\n this.options.layoutRoot) &&\n this.layout);\n }\n createRelativeTarget(relativeParent, layout, parentLayout) {\n this.relativeParent = relativeParent;\n this.linkedParentVersion = relativeParent.layoutVersion;\n this.forceRelativeParentToResolveTarget();\n this.relativeTarget = createBox();\n this.relativeTargetOrigin = createBox();\n calcRelativePosition(this.relativeTargetOrigin, layout, parentLayout, this.options.layoutAnchor || undefined);\n copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);\n }\n removeRelativeTarget() {\n this.relativeParent = this.relativeTarget = undefined;\n }\n calcProjection() {\n const lead = this.getLead();\n const isShared = Boolean(this.resumingFrom) || this !== lead;\n let canSkip = true;\n /**\n * If this is a normal layout animation and neither this node nor its nearest projecting\n * is dirty then we can't skip.\n */\n if (this.isProjectionDirty || this.parent?.isProjectionDirty) {\n canSkip = false;\n }\n /**\n * If this is a shared layout animation and this node's shared projection is dirty then\n * we can't skip.\n */\n if (isShared &&\n (this.isSharedProjectionDirty || this.isTransformDirty)) {\n canSkip = false;\n }\n /**\n * If we have resolved the target this frame we must recalculate the\n * projection to ensure it visually represents the internal calculations.\n */\n if (this.resolvedRelativeTargetAt === frameData.timestamp) {\n canSkip = false;\n }\n if (canSkip)\n return;\n const { layout, layoutId } = this.options;\n /**\n * If this section of the tree isn't animating we can\n * delete our target sources for the following frame.\n */\n this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) ||\n this.currentAnimation ||\n this.pendingAnimation);\n if (!this.isTreeAnimating) {\n this.targetDelta = this.relativeTarget = undefined;\n }\n if (!this.layout || !(layout || layoutId))\n return;\n /**\n * Reset the corrected box with the latest values from box, as we're then going\n * to perform mutative operations on it.\n */\n copyBoxInto(this.layoutCorrected, this.layout.layoutBox);\n /**\n * Record previous tree scales before updating.\n */\n const prevTreeScaleX = this.treeScale.x;\n const prevTreeScaleY = this.treeScale.y;\n /**\n * Apply all the parent deltas to this box to produce the corrected box. This\n * is the layout box, as it will appear on screen as a result of the transforms of its parents.\n */\n applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);\n /**\n * If this layer needs to perform scale correction but doesn't have a target,\n * use the layout as the target.\n */\n if (lead.layout &&\n !lead.target &&\n (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {\n lead.target = lead.layout.layoutBox;\n lead.targetWithTransforms = createBox();\n }\n const { target } = lead;\n if (!target) {\n /**\n * If we don't have a target to project into, but we were previously\n * projecting, we want to remove the stored transform and schedule\n * a render to ensure the elements reflect the removed transform.\n */\n if (this.prevProjectionDelta) {\n this.createProjectionDeltas();\n this.scheduleRender();\n }\n return;\n }\n if (!this.projectionDelta || !this.prevProjectionDelta) {\n this.createProjectionDeltas();\n }\n else {\n copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);\n copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);\n }\n /**\n * Update the delta between the corrected box and the target box before user-set transforms were applied.\n * This will allow us to calculate the corrected borderRadius and boxShadow to compensate\n * for our layout reprojection, but still allow them to be scaled correctly by the user.\n * It might be that to simplify this we may want to accept that user-set scale is also corrected\n * and we wouldn't have to keep and calc both deltas, OR we could support a user setting\n * to allow people to choose whether these styles are corrected based on just the\n * layout reprojection or the final bounding box.\n */\n calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);\n if (this.treeScale.x !== prevTreeScaleX ||\n this.treeScale.y !== prevTreeScaleY ||\n !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) ||\n !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {\n this.hasProjected = true;\n this.scheduleRender();\n this.notifyListeners(\"projectionUpdate\", target);\n }\n /**\n * Increase debug counter for recalculated projections\n */\n if (statsBuffer.value) {\n metrics.calculatedProjections++;\n }\n }\n hide() {\n this.isVisible = false;\n // TODO: Schedule render\n }\n show() {\n this.isVisible = true;\n // TODO: Schedule render\n }\n scheduleRender(notifyAll = true) {\n this.options.visualElement?.scheduleRender();\n if (notifyAll) {\n const stack = this.getStack();\n stack && stack.scheduleRender();\n }\n if (this.resumingFrom && !this.resumingFrom.instance) {\n this.resumingFrom = undefined;\n }\n }\n createProjectionDeltas() {\n this.prevProjectionDelta = createDelta();\n this.projectionDelta = createDelta();\n this.projectionDeltaWithTransform = createDelta();\n }\n setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {\n const snapshot = this.snapshot;\n const snapshotLatestValues = snapshot ? snapshot.latestValues : {};\n const mixedValues = { ...this.latestValues };\n const targetDelta = createDelta();\n if (!this.relativeParent ||\n !this.relativeParent.options.layoutRoot) {\n this.relativeTarget = this.relativeTargetOrigin = undefined;\n }\n this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;\n const relativeLayout = createBox();\n const snapshotSource = snapshot ? snapshot.source : undefined;\n const layoutSource = this.layout ? this.layout.source : undefined;\n const isSharedLayoutAnimation = snapshotSource !== layoutSource;\n const stack = this.getStack();\n const isOnlyMember = !stack || stack.members.length <= 1;\n const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&\n !isOnlyMember &&\n this.options.crossfade === true &&\n !this.path.some(hasOpacityCrossfade));\n this.animationProgress = 0;\n let prevRelativeTarget;\n this.mixTargetDelta = (latest) => {\n const progress = latest / 1000;\n mixAxisDelta(targetDelta.x, delta.x, progress);\n mixAxisDelta(targetDelta.y, delta.y, progress);\n this.setTargetDelta(targetDelta);\n if (this.relativeTarget &&\n this.relativeTargetOrigin &&\n this.layout &&\n this.relativeParent &&\n this.relativeParent.layout) {\n calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || undefined);\n mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);\n /**\n * If this is an unchanged relative target we can consider the\n * projection not dirty.\n */\n if (prevRelativeTarget &&\n boxEquals(this.relativeTarget, prevRelativeTarget)) {\n this.isProjectionDirty = false;\n }\n if (!prevRelativeTarget)\n prevRelativeTarget = createBox();\n copyBoxInto(prevRelativeTarget, this.relativeTarget);\n }\n if (isSharedLayoutAnimation) {\n this.animationValues = mixedValues;\n mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);\n }\n this.root.scheduleUpdateProjection();\n this.scheduleRender();\n this.animationProgress = progress;\n };\n this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0);\n }\n startAnimation(options) {\n this.notifyListeners(\"animationStart\");\n this.currentAnimation?.stop();\n this.resumingFrom?.currentAnimation?.stop();\n if (this.pendingAnimation) {\n cancelFrame(this.pendingAnimation);\n this.pendingAnimation = undefined;\n }\n /**\n * Start the animation in the next frame to have a frame with progress 0,\n * where the target is the same as when the animation started, so we can\n * calculate the relative positions correctly for instant transitions.\n */\n this.pendingAnimation = frame.update(() => {\n globalProjectionState.hasAnimatedSinceResize = true;\n activeAnimations.layout++;\n this.motionValue || (this.motionValue = motionValue(0));\n this.motionValue.jump(0, false);\n this.currentAnimation = animateSingleValue(this.motionValue, [0, 1000], {\n ...options,\n velocity: 0,\n isSync: true,\n onUpdate: (latest) => {\n this.mixTargetDelta(latest);\n options.onUpdate && options.onUpdate(latest);\n },\n onStop: () => {\n activeAnimations.layout--;\n },\n onComplete: () => {\n activeAnimations.layout--;\n options.onComplete && options.onComplete();\n this.completeAnimation();\n },\n });\n if (this.resumingFrom) {\n this.resumingFrom.currentAnimation = this.currentAnimation;\n }\n this.pendingAnimation = undefined;\n });\n }\n completeAnimation() {\n if (this.resumingFrom) {\n this.resumingFrom.currentAnimation = undefined;\n this.resumingFrom.preserveOpacity = undefined;\n }\n const stack = this.getStack();\n stack && stack.exitAnimationComplete();\n this.resumingFrom =\n this.currentAnimation =\n this.animationValues =\n undefined;\n this.notifyListeners(\"animationComplete\");\n }\n finishAnimation() {\n if (this.currentAnimation) {\n this.mixTargetDelta && this.mixTargetDelta(animationTarget);\n this.currentAnimation.stop();\n }\n this.completeAnimation();\n }\n applyTransformsToTarget() {\n const lead = this.getLead();\n let { targetWithTransforms, target, layout, latestValues } = lead;\n if (!targetWithTransforms || !target || !layout)\n return;\n /**\n * If we're only animating position, and this element isn't the lead element,\n * then instead of projecting into the lead box we instead want to calculate\n * a new target that aligns the two boxes but maintains the layout shape.\n */\n if (this !== lead &&\n this.layout &&\n layout &&\n shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {\n target = this.target || createBox();\n const xLength = calcLength(this.layout.layoutBox.x);\n target.x.min = lead.target.x.min;\n target.x.max = target.x.min + xLength;\n const yLength = calcLength(this.layout.layoutBox.y);\n target.y.min = lead.target.y.min;\n target.y.max = target.y.min + yLength;\n }\n copyBoxInto(targetWithTransforms, target);\n /**\n * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.\n * This is the final box that we will then project into by calculating a transform delta and\n * applying it to the corrected box.\n */\n transformBox(targetWithTransforms, latestValues);\n /**\n * Update the delta between the corrected box and the final target box, after\n * user-set transforms are applied to it. This will be used by the renderer to\n * create a transform style that will reproject the element from its layout layout\n * into the desired bounding box.\n */\n calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);\n }\n registerSharedNode(layoutId, node) {\n if (!this.sharedNodes.has(layoutId)) {\n this.sharedNodes.set(layoutId, new NodeStack());\n }\n const stack = this.sharedNodes.get(layoutId);\n stack.add(node);\n const config = node.options.initialPromotionConfig;\n node.promote({\n transition: config ? config.transition : undefined,\n preserveFollowOpacity: config && config.shouldPreserveFollowOpacity\n ? config.shouldPreserveFollowOpacity(node)\n : undefined,\n });\n }\n isLead() {\n const stack = this.getStack();\n return stack ? stack.lead === this : true;\n }\n getLead() {\n const { layoutId } = this.options;\n return layoutId ? this.getStack()?.lead || this : this;\n }\n getPrevLead() {\n const { layoutId } = this.options;\n return layoutId ? this.getStack()?.prevLead : undefined;\n }\n getStack() {\n const { layoutId } = this.options;\n if (layoutId)\n return this.root.sharedNodes.get(layoutId);\n }\n promote({ needsReset, transition, preserveFollowOpacity, } = {}) {\n const stack = this.getStack();\n if (stack)\n stack.promote(this, preserveFollowOpacity);\n if (needsReset) {\n this.projectionDelta = undefined;\n this.needsReset = true;\n }\n if (transition)\n this.setOptions({ transition });\n }\n relegate() {\n const stack = this.getStack();\n if (stack) {\n return stack.relegate(this);\n }\n else {\n return false;\n }\n }\n resetSkewAndRotation() {\n const { visualElement } = this.options;\n if (!visualElement)\n return;\n // If there's no detected skew or rotation values, we can early return without a forced render.\n let hasDistortingTransform = false;\n /**\n * An unrolled check for rotation values. Most elements don't have any rotation and\n * skipping the nested loop and new object creation is 50% faster.\n */\n const { latestValues } = visualElement;\n if (latestValues.z ||\n latestValues.rotate ||\n latestValues.rotateX ||\n latestValues.rotateY ||\n latestValues.rotateZ ||\n latestValues.skewX ||\n latestValues.skewY) {\n hasDistortingTransform = true;\n }\n // If there's no distorting values, we don't need to do any more.\n if (!hasDistortingTransform)\n return;\n const resetValues = {};\n if (latestValues.z) {\n resetDistortingTransform(\"z\", visualElement, resetValues, this.animationValues);\n }\n // Check the skew and rotate value of all axes and reset to 0\n for (let i = 0; i < transformAxes.length; i++) {\n resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);\n resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);\n }\n // Force a render of this element to apply the transform with all skews and rotations\n // set to 0.\n visualElement.render();\n // Put back all the values we reset\n for (const key in resetValues) {\n visualElement.setStaticValue(key, resetValues[key]);\n if (this.animationValues) {\n this.animationValues[key] = resetValues[key];\n }\n }\n // Schedule a render for the next frame. This ensures we won't visually\n // see the element with the reset rotate value applied.\n visualElement.scheduleRender();\n }\n applyProjectionStyles(targetStyle, // CSSStyleDeclaration - doesn't allow numbers to be assigned to properties\n styleProp) {\n if (!this.instance || this.isSVG)\n return;\n if (!this.isVisible) {\n targetStyle.visibility = \"hidden\";\n return;\n }\n const transformTemplate = this.getTransformTemplate();\n if (this.needsReset) {\n this.needsReset = false;\n targetStyle.visibility = \"\";\n targetStyle.opacity = \"\";\n targetStyle.pointerEvents =\n resolveMotionValue(styleProp?.pointerEvents) || \"\";\n targetStyle.transform = transformTemplate\n ? transformTemplate(this.latestValues, \"\")\n : \"none\";\n return;\n }\n const lead = this.getLead();\n if (!this.projectionDelta || !this.layout || !lead.target) {\n if (this.options.layoutId) {\n targetStyle.opacity =\n this.latestValues.opacity !== undefined\n ? this.latestValues.opacity\n : 1;\n targetStyle.pointerEvents =\n resolveMotionValue(styleProp?.pointerEvents) || \"\";\n }\n if (this.hasProjected && !hasTransform(this.latestValues)) {\n targetStyle.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n this.hasProjected = false;\n }\n return;\n }\n targetStyle.visibility = \"\";\n const valuesToRender = lead.animationValues || lead.latestValues;\n this.applyTransformsToTarget();\n let transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);\n if (transformTemplate) {\n transform = transformTemplate(valuesToRender, transform);\n }\n targetStyle.transform = transform;\n const { x, y } = this.projectionDelta;\n targetStyle.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;\n if (lead.animationValues) {\n /**\n * If the lead component is animating, assign this either the entering/leaving\n * opacity\n */\n targetStyle.opacity =\n lead === this\n ? valuesToRender.opacity ??\n this.latestValues.opacity ??\n 1\n : this.preserveOpacity\n ? this.latestValues.opacity\n : valuesToRender.opacityExit;\n }\n else {\n /**\n * Or we're not animating at all, set the lead component to its layout\n * opacity and other components to hidden.\n */\n targetStyle.opacity =\n lead === this\n ? valuesToRender.opacity !== undefined\n ? valuesToRender.opacity\n : \"\"\n : valuesToRender.opacityExit !== undefined\n ? valuesToRender.opacityExit\n : 0;\n }\n /**\n * Apply scale correction\n */\n for (const key in scaleCorrectors) {\n if (valuesToRender[key] === undefined)\n continue;\n const { correct, applyTo, isCSSVariable } = scaleCorrectors[key];\n /**\n * Only apply scale correction to the value if we have an\n * active projection transform. Otherwise these values become\n * vulnerable to distortion if the element changes size without\n * a corresponding layout animation.\n */\n const corrected = transform === \"none\"\n ? valuesToRender[key]\n : correct(valuesToRender[key], lead);\n if (applyTo) {\n const num = applyTo.length;\n for (let i = 0; i < num; i++) {\n targetStyle[applyTo[i]] = corrected;\n }\n }\n else {\n // If this is a CSS variable, set it directly on the instance.\n // Replacing this function from creating styles to setting them\n // would be a good place to remove per frame object creation\n if (isCSSVariable) {\n this.options.visualElement.renderState.vars[key] = corrected;\n }\n else {\n targetStyle[key] = corrected;\n }\n }\n }\n /**\n * Disable pointer events on follow components. This is to ensure\n * that if a follow component covers a lead component it doesn't block\n * pointer events on the lead.\n */\n if (this.options.layoutId) {\n targetStyle.pointerEvents =\n lead === this\n ? resolveMotionValue(styleProp?.pointerEvents) || \"\"\n : \"none\";\n }\n }\n clearSnapshot() {\n this.resumeFrom = this.snapshot = undefined;\n }\n // Only run on root\n resetTree() {\n this.root.nodes.forEach((node) => node.currentAnimation?.stop());\n this.root.nodes.forEach(clearMeasurements);\n this.root.sharedNodes.clear();\n }\n };\n}\nfunction updateLayout(node) {\n node.updateLayout();\n}\nfunction notifyLayoutUpdate(node) {\n const snapshot = node.resumeFrom?.snapshot || node.snapshot;\n if (node.isLead() &&\n node.layout &&\n snapshot &&\n node.hasListeners(\"didUpdate\")) {\n const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;\n const { animationType } = node.options;\n const isShared = snapshot.source !== node.layout.source;\n // TODO Maybe we want to also resize the layout snapshot so we don't trigger\n // animations for instance if layout=\"size\" and an element has only changed position\n if (animationType === \"size\") {\n eachAxis((axis) => {\n const axisSnapshot = isShared\n ? snapshot.measuredBox[axis]\n : snapshot.layoutBox[axis];\n const length = calcLength(axisSnapshot);\n axisSnapshot.min = layout[axis].min;\n axisSnapshot.max = axisSnapshot.min + length;\n });\n }\n else if (animationType === \"x\" || animationType === \"y\") {\n const snapAxis = animationType === \"x\" ? \"y\" : \"x\";\n copyAxisInto(isShared\n ? snapshot.measuredBox[snapAxis]\n : snapshot.layoutBox[snapAxis], layout[snapAxis]);\n }\n else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {\n eachAxis((axis) => {\n const axisSnapshot = isShared\n ? snapshot.measuredBox[axis]\n : snapshot.layoutBox[axis];\n const length = calcLength(layout[axis]);\n axisSnapshot.max = axisSnapshot.min + length;\n /**\n * Ensure relative target gets resized and rerendererd\n */\n if (node.relativeTarget && !node.currentAnimation) {\n node.isProjectionDirty = true;\n node.relativeTarget[axis].max =\n node.relativeTarget[axis].min + length;\n }\n });\n }\n const layoutDelta = createDelta();\n calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);\n const visualDelta = createDelta();\n if (isShared) {\n calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);\n }\n else {\n calcBoxDelta(visualDelta, layout, snapshot.layoutBox);\n }\n const hasLayoutChanged = !isDeltaZero(layoutDelta);\n let hasRelativeLayoutChanged = false;\n if (!node.resumeFrom) {\n const relativeParent = node.getClosestProjectingParent();\n /**\n * If the relativeParent is itself resuming from a different element then\n * the relative snapshot is not relavent\n */\n if (relativeParent && !relativeParent.resumeFrom) {\n const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;\n if (parentSnapshot && parentLayout) {\n const anchor = node.options.layoutAnchor || undefined;\n const relativeSnapshot = createBox();\n calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox, anchor);\n const relativeLayout = createBox();\n calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox, anchor);\n if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {\n hasRelativeLayoutChanged = true;\n }\n if (relativeParent.options.layoutRoot) {\n node.relativeTarget = relativeLayout;\n node.relativeTargetOrigin = relativeSnapshot;\n node.relativeParent = relativeParent;\n }\n }\n }\n }\n node.notifyListeners(\"didUpdate\", {\n layout,\n snapshot,\n delta: visualDelta,\n layoutDelta,\n hasLayoutChanged,\n hasRelativeLayoutChanged,\n });\n }\n else if (node.isLead()) {\n const { onExitComplete } = node.options;\n onExitComplete && onExitComplete();\n }\n /**\n * Clearing transition\n * TODO: Investigate why this transition is being passed in as {type: false } from Framer\n * and why we need it at all\n */\n node.options.transition = undefined;\n}\nfunction propagateDirtyNodes(node) {\n /**\n * Increase debug counter for nodes encountered this frame\n */\n if (statsBuffer.value) {\n metrics.nodes++;\n }\n if (!node.parent)\n return;\n /**\n * If this node isn't projecting, propagate isProjectionDirty. It will have\n * no performance impact but it will allow the next child that *is* projecting\n * but *isn't* dirty to just check its parent to see if *any* ancestor needs\n * correcting.\n */\n if (!node.isProjecting()) {\n node.isProjectionDirty = node.parent.isProjectionDirty;\n }\n /**\n * Propagate isSharedProjectionDirty and isTransformDirty\n * throughout the whole tree. A future revision can take another look at\n * this but for safety we still recalcualte shared nodes.\n */\n node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||\n node.parent.isProjectionDirty ||\n node.parent.isSharedProjectionDirty));\n node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);\n}\nfunction cleanDirtyNodes(node) {\n node.isProjectionDirty =\n node.isSharedProjectionDirty =\n node.isTransformDirty =\n false;\n}\nfunction clearSnapshot(node) {\n node.clearSnapshot();\n}\nfunction clearMeasurements(node) {\n node.clearMeasurements();\n}\nfunction forceLayoutMeasure(node) {\n node.isLayoutDirty = true;\n node.updateLayout();\n}\nfunction clearIsLayoutDirty(node) {\n node.isLayoutDirty = false;\n}\n/**\n * When a node is animation-blocked (e.g. during drag) and its component\n * didn't re-render (memoized), willUpdate() is never called so there's\n * no snapshot. Use the previous layout as a snapshot and mark dirty so\n * resetTransform/updateLayout/notifyLayoutUpdate process it normally.\n */\nfunction ensureDraggedNodesSnapshotted(node) {\n if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) {\n node.snapshot = node.layout;\n node.isLayoutDirty = true;\n }\n}\nfunction resetTransformStyle(node) {\n const { visualElement } = node.options;\n if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {\n visualElement.notify(\"BeforeLayoutMeasure\");\n }\n node.resetTransform();\n}\nfunction finishAnimation(node) {\n node.finishAnimation();\n node.targetDelta = node.relativeTarget = node.target = undefined;\n node.isProjectionDirty = true;\n}\nfunction resolveTargetDelta(node) {\n node.resolveTargetDelta();\n}\nfunction calcProjection(node) {\n node.calcProjection();\n}\nfunction resetSkewAndRotation(node) {\n node.resetSkewAndRotation();\n}\nfunction removeLeadSnapshots(stack) {\n stack.removeLeadSnapshot();\n}\nfunction mixAxisDelta(output, delta, p) {\n output.translate = mixNumber(delta.translate, 0, p);\n output.scale = mixNumber(delta.scale, 1, p);\n output.origin = delta.origin;\n output.originPoint = delta.originPoint;\n}\nfunction mixAxis(output, from, to, p) {\n output.min = mixNumber(from.min, to.min, p);\n output.max = mixNumber(from.max, to.max, p);\n}\nfunction mixBox(output, from, to, p) {\n mixAxis(output.x, from.x, to.x, p);\n mixAxis(output.y, from.y, to.y, p);\n}\nfunction hasOpacityCrossfade(node) {\n return (node.animationValues && node.animationValues.opacityExit !== undefined);\n}\nconst defaultLayoutTransition = {\n duration: 0.45,\n ease: [0.4, 0, 0.1, 1],\n};\nconst userAgentContains = (string) => typeof navigator !== \"undefined\" &&\n navigator.userAgent &&\n navigator.userAgent.toLowerCase().includes(string);\n/**\n * Measured bounding boxes must be rounded in Safari and\n * left untouched in Chrome, otherwise non-integer layouts within scaled-up elements\n * can appear to jump.\n */\nconst roundPoint = userAgentContains(\"applewebkit/\") && !userAgentContains(\"chrome/\")\n ? Math.round\n : noop;\nfunction roundAxis(axis) {\n // Round to the nearest .5 pixels to support subpixel layouts\n axis.min = roundPoint(axis.min);\n axis.max = roundPoint(axis.max);\n}\nfunction roundBox(box) {\n roundAxis(box.x);\n roundAxis(box.y);\n}\nfunction shouldAnimatePositionOnly(animationType, snapshot, layout) {\n return (animationType === \"position\" ||\n (animationType === \"preserve-aspect\" &&\n !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));\n}\nfunction checkNodeWasScrollRoot(node) {\n return node !== node.root && node.scroll?.wasRoot;\n}\n\nexport { cleanDirtyNodes, createProjectionNode, mixAxis, mixAxisDelta, mixBox, propagateDirtyNodes };\n//# sourceMappingURL=create-projection-node.mjs.map\n","import { addDomEvent } from '../../events/add-dom-event.mjs';\nimport { createProjectionNode } from './create-projection-node.mjs';\n\nconst DocumentProjectionNode = createProjectionNode({\n attachResizeListener: (ref, notify) => addDomEvent(ref, \"resize\", notify),\n measureScroll: () => ({\n x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,\n y: document.documentElement.scrollTop || document.body?.scrollTop || 0,\n }),\n checkIsScrollRoot: () => true,\n});\n\nexport { DocumentProjectionNode };\n//# sourceMappingURL=DocumentProjectionNode.mjs.map\n","import { createProjectionNode } from './create-projection-node.mjs';\nimport { DocumentProjectionNode } from './DocumentProjectionNode.mjs';\n\nconst rootProjectionNode = {\n current: undefined,\n};\nconst HTMLProjectionNode = createProjectionNode({\n measureScroll: (instance) => ({\n x: instance.scrollLeft,\n y: instance.scrollTop,\n }),\n defaultParent: () => {\n if (!rootProjectionNode.current) {\n const documentNode = new DocumentProjectionNode({});\n documentNode.mount(window);\n documentNode.setOptions({ layoutScroll: true });\n rootProjectionNode.current = documentNode;\n }\n return rootProjectionNode.current;\n },\n resetTransform: (instance, value) => {\n instance.style.transform = value !== undefined ? value : \"none\";\n },\n checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === \"fixed\"),\n});\n\nexport { HTMLProjectionNode, rootProjectionNode };\n//# sourceMappingURL=HTMLProjectionNode.mjs.map\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * @public\n */\nconst MotionConfigContext = createContext({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n});\n\nexport { MotionConfigContext };\n//# sourceMappingURL=MotionConfigContext.mjs.map\n","import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const x = anchorX === \"left\" ? `left: ${left}` : `right: ${right}`;\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => presenceChildren.delete(childId);\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","\"use client\";\nimport { useContext, useId, useEffect, useCallback } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\n\n/**\n * When a component is the child of `AnimatePresence`, it can use `usePresence`\n * to access information about whether it's still present in the React tree.\n *\n * ```jsx\n * import { usePresence } from \"framer-motion\"\n *\n * export const Component = () => {\n * const [isPresent, safeToRemove] = usePresence()\n *\n * useEffect(() => {\n * !isPresent && setTimeout(safeToRemove, 1000)\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * If `isPresent` is `false`, it means that a component has been removed from the tree,\n * but `AnimatePresence` won't really remove it until `safeToRemove` has been called.\n *\n * @public\n */\nfunction usePresence(subscribe = true) {\n const context = useContext(PresenceContext);\n if (context === null)\n return [true, null];\n const { isPresent, onExitComplete, register } = context;\n // It's safe to call the following hooks conditionally (after an early return) because the context will always\n // either be null or non-null for the lifespan of the component.\n const id = useId();\n useEffect(() => {\n if (subscribe) {\n return register(id);\n }\n }, [subscribe]);\n const safeToRemove = useCallback(() => subscribe && onExitComplete && onExitComplete(id), [id, onExitComplete, subscribe]);\n return !isPresent && onExitComplete ? [false, safeToRemove] : [true];\n}\n/**\n * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.\n * There is no `safeToRemove` function.\n *\n * ```jsx\n * import { useIsPresent } from \"framer-motion\"\n *\n * export const Component = () => {\n * const isPresent = useIsPresent()\n *\n * useEffect(() => {\n * !isPresent && console.log(\"I've been removed!\")\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * @public\n */\nfunction useIsPresent() {\n return isPresent(useContext(PresenceContext));\n}\nfunction isPresent(context) {\n return context === null ? true : context.isPresent;\n}\n\nexport { isPresent, useIsPresent, usePresence };\n//# sourceMappingURL=use-presence.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\nimport { createContext } from 'react';\n\nconst LazyContext = createContext({ strict: false });\n\nexport { LazyContext };\n//# sourceMappingURL=LazyContext.mjs.map\n","import { getFeatureDefinitions, setFeatureDefinitions } from 'motion-dom';\n\nconst featureProps = {\n animation: [\n \"animate\",\n \"variants\",\n \"whileHover\",\n \"whileTap\",\n \"exit\",\n \"whileInView\",\n \"whileFocus\",\n \"whileDrag\",\n ],\n exit: [\"exit\"],\n drag: [\"drag\", \"dragControls\"],\n focus: [\"whileFocus\"],\n hover: [\"whileHover\", \"onHoverStart\", \"onHoverEnd\"],\n tap: [\"whileTap\", \"onTap\", \"onTapStart\", \"onTapCancel\"],\n pan: [\"onPan\", \"onPanStart\", \"onPanSessionStart\", \"onPanEnd\"],\n inView: [\"whileInView\", \"onViewportEnter\", \"onViewportLeave\"],\n layout: [\"layout\", \"layoutId\"],\n};\nlet isInitialized = false;\n/**\n * Initialize feature definitions with isEnabled checks.\n * This must be called before any motion components are rendered.\n */\nfunction initFeatureDefinitions() {\n if (isInitialized)\n return;\n const initialFeatureDefinitions = {};\n for (const key in featureProps) {\n initialFeatureDefinitions[key] = {\n isEnabled: (props) => featureProps[key].some((name) => !!props[name]),\n };\n }\n setFeatureDefinitions(initialFeatureDefinitions);\n isInitialized = true;\n}\n/**\n * Get the current feature definitions, initializing if needed.\n */\nfunction getInitializedFeatureDefinitions() {\n initFeatureDefinitions();\n return getFeatureDefinitions();\n}\n\nexport { getInitializedFeatureDefinitions, initFeatureDefinitions };\n//# sourceMappingURL=definitions.mjs.map\n","import { setFeatureDefinitions } from 'motion-dom';\nimport { getInitializedFeatureDefinitions } from './definitions.mjs';\n\nfunction loadFeatures(features) {\n const featureDefinitions = getInitializedFeatureDefinitions();\n for (const key in features) {\n featureDefinitions[key] = {\n ...featureDefinitions[key],\n ...features[key],\n };\n }\n setFeatureDefinitions(featureDefinitions);\n}\n\nexport { loadFeatures };\n//# sourceMappingURL=load-features.mjs.map\n","/**\n * A list of all valid MotionProps.\n *\n * @privateRemarks\n * This doesn't throw if a `MotionProp` name is missing - it should.\n */\nconst validMotionProps = new Set([\n \"animate\",\n \"exit\",\n \"variants\",\n \"initial\",\n \"style\",\n \"values\",\n \"variants\",\n \"transition\",\n \"transformTemplate\",\n \"custom\",\n \"inherit\",\n \"onBeforeLayoutMeasure\",\n \"onAnimationStart\",\n \"onAnimationComplete\",\n \"onUpdate\",\n \"onDragStart\",\n \"onDrag\",\n \"onDragEnd\",\n \"onMeasureDragConstraints\",\n \"onDirectionLock\",\n \"onDragTransitionEnd\",\n \"_dragX\",\n \"_dragY\",\n \"onHoverStart\",\n \"onHoverEnd\",\n \"onViewportEnter\",\n \"onViewportLeave\",\n \"globalTapTarget\",\n \"propagate\",\n \"ignoreStrict\",\n \"viewport\",\n]);\n/**\n * Check whether a prop name is a valid `MotionProp` key.\n *\n * @param key - Name of the property to check\n * @returns `true` is key is a valid `MotionProp`.\n *\n * @public\n */\nfunction isValidMotionProp(key) {\n return (key.startsWith(\"while\") ||\n (key.startsWith(\"drag\") && key !== \"draggable\") ||\n key.startsWith(\"layout\") ||\n key.startsWith(\"onTap\") ||\n key.startsWith(\"onPan\") ||\n key.startsWith(\"onLayout\") ||\n validMotionProps.has(key));\n}\n\nexport { isValidMotionProp };\n//# sourceMappingURL=valid-prop.mjs.map\n","import { isMotionValue } from 'motion-dom';\nimport { isValidMotionProp } from '../../../motion/utils/valid-prop.mjs';\n\nlet shouldForward = (key) => !isValidMotionProp(key);\nfunction loadExternalIsValidProp(isValidProp) {\n if (typeof isValidProp !== \"function\")\n return;\n // Explicitly filter our events\n shouldForward = (key) => key.startsWith(\"on\") ? !isValidMotionProp(key) : isValidProp(key);\n}\n/**\n * Emotion and Styled Components both allow users to pass through arbitrary props to their components\n * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which\n * of these should be passed to the underlying DOM node.\n *\n * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props\n * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props\n * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of\n * `@emotion/is-prop-valid`, however to fix this problem we need to use it.\n *\n * By making it an optionalDependency we can offer this functionality only in the situations where it's\n * actually required.\n */\ntry {\n /**\n * We attempt to import this package but require won't be defined in esm environments, in that case\n * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed\n * in favour of explicit injection.\n *\n * String concatenation prevents bundlers like webpack (e.g. Storybook)\n * from statically resolving this optional dependency at build time.\n */\n const emotionPkg = \"@emotion/is-prop-\" + \"valid\";\n loadExternalIsValidProp(require(emotionPkg).default);\n}\ncatch {\n // We don't need to actually do anything here - the fallback is the existing `isPropValid`.\n}\nfunction filterProps(props, isDom, forwardMotionProps) {\n const filteredProps = {};\n for (const key in props) {\n /**\n * values is considered a valid prop by Emotion, so if it's present\n * this will be rendered out to the DOM unless explicitly filtered.\n *\n * We check the type as it could be used with the `feColorMatrix`\n * element, which we support.\n */\n if (key === \"values\" && typeof props.values === \"object\")\n continue;\n if (isMotionValue(props[key]))\n continue;\n if (shouldForward(key) ||\n (forwardMotionProps === true && isValidMotionProp(key)) ||\n (!isDom && !isValidMotionProp(key)) ||\n // If trying to use native HTML drag events, forward drag listeners\n (props[\"draggable\"] &&\n key.startsWith(\"onDrag\"))) {\n filteredProps[key] =\n props[key];\n }\n }\n return filteredProps;\n}\n\nexport { filterProps, loadExternalIsValidProp };\n//# sourceMappingURL=filter-props.mjs.map\n","\"use client\";\nimport { createContext } from 'react';\n\nconst MotionContext = /* @__PURE__ */ createContext({});\n\nexport { MotionContext };\n//# sourceMappingURL=index.mjs.map\n","import { isControllingVariants, isVariantLabel } from 'motion-dom';\n\nfunction getCurrentTreeVariants(props, context) {\n if (isControllingVariants(props)) {\n const { initial, animate } = props;\n return {\n initial: initial === false || isVariantLabel(initial)\n ? initial\n : undefined,\n animate: isVariantLabel(animate) ? animate : undefined,\n };\n }\n return props.inherit !== false ? context : {};\n}\n\nexport { getCurrentTreeVariants };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { useContext, useMemo } from 'react';\nimport { MotionContext } from './index.mjs';\nimport { getCurrentTreeVariants } from './utils.mjs';\n\nfunction useCreateMotionContext(props) {\n const { initial, animate } = getCurrentTreeVariants(props, useContext(MotionContext));\n return useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);\n}\nfunction variantLabelsAsDependency(prop) {\n return Array.isArray(prop) ? prop.join(\" \") : prop;\n}\n\nexport { useCreateMotionContext };\n//# sourceMappingURL=create.mjs.map\n","const createHtmlRenderState = () => ({\n style: {},\n transform: {},\n transformOrigin: {},\n vars: {},\n});\n\nexport { createHtmlRenderState };\n//# sourceMappingURL=create-render-state.mjs.map\n","\"use client\";\nimport { isMotionValue, isForcedMotionValue, buildHTMLStyles } from 'motion-dom';\nimport { useMemo } from 'react';\nimport { createHtmlRenderState } from './utils/create-render-state.mjs';\n\nfunction copyRawValuesOnly(target, source, props) {\n for (const key in source) {\n if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {\n target[key] = source[key];\n }\n }\n}\nfunction useInitialMotionValues({ transformTemplate }, visualState) {\n return useMemo(() => {\n const state = createHtmlRenderState();\n buildHTMLStyles(state, visualState, transformTemplate);\n return Object.assign({}, state.vars, state.style);\n }, [visualState]);\n}\nfunction useStyle(props, visualState) {\n const styleProp = props.style || {};\n const style = {};\n /**\n * Copy non-Motion Values straight into style\n */\n copyRawValuesOnly(style, styleProp, props);\n Object.assign(style, useInitialMotionValues(props, visualState));\n return style;\n}\nfunction useHTMLProps(props, visualState) {\n // The `any` isn't ideal but it is the type of createElement props argument\n const htmlProps = {};\n const style = useStyle(props, visualState);\n if (props.drag && props.dragListener !== false) {\n // Disable the ghost element when a user drags\n htmlProps.draggable = false;\n // Disable text selection\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\";\n // Disable scrolling on the draggable direction\n style.touchAction =\n props.drag === true\n ? \"none\"\n : `pan-${props.drag === \"x\" ? \"y\" : \"x\"}`;\n }\n if (props.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)) {\n htmlProps.tabIndex = 0;\n }\n htmlProps.style = style;\n return htmlProps;\n}\n\nexport { copyRawValuesOnly, useHTMLProps };\n//# sourceMappingURL=use-props.mjs.map\n","import { createHtmlRenderState } from '../../html/utils/create-render-state.mjs';\n\nconst createSvgRenderState = () => ({\n ...createHtmlRenderState(),\n attrs: {},\n});\n\nexport { createSvgRenderState };\n//# sourceMappingURL=create-render-state.mjs.map\n","\"use client\";\nimport { buildSVGAttrs, isSVGTag } from 'motion-dom';\nimport { useMemo } from 'react';\nimport { copyRawValuesOnly } from '../html/use-props.mjs';\nimport { createSvgRenderState } from './utils/create-render-state.mjs';\n\nfunction useSVGProps(props, visualState, _isStatic, Component) {\n const visualProps = useMemo(() => {\n const state = createSvgRenderState();\n buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate, props.style);\n return {\n ...state.attrs,\n style: { ...state.style },\n };\n }, [visualState]);\n if (props.style) {\n const rawStyles = {};\n copyRawValuesOnly(rawStyles, props.style, props);\n visualProps.style = { ...rawStyles, ...visualProps.style };\n }\n return visualProps;\n}\n\nexport { useSVGProps };\n//# sourceMappingURL=use-props.mjs.map\n","/**\n * We keep these listed separately as we use the lowercase tag names as part\n * of the runtime bundle to detect SVG components\n */\nconst lowercaseSVGElements = [\n \"animate\",\n \"circle\",\n \"defs\",\n \"desc\",\n \"ellipse\",\n \"g\",\n \"image\",\n \"line\",\n \"filter\",\n \"marker\",\n \"mask\",\n \"metadata\",\n \"path\",\n \"pattern\",\n \"polygon\",\n \"polyline\",\n \"rect\",\n \"stop\",\n \"switch\",\n \"symbol\",\n \"svg\",\n \"text\",\n \"tspan\",\n \"use\",\n \"view\",\n];\n\nexport { lowercaseSVGElements };\n//# sourceMappingURL=lowercase-elements.mjs.map\n","import { lowercaseSVGElements } from '../../svg/lowercase-elements.mjs';\n\nfunction isSVGComponent(Component) {\n if (\n /**\n * If it's not a string, it's a custom React component. Currently we only support\n * HTML custom React components.\n */\n typeof Component !== \"string\" ||\n /**\n * If it contains a dash, the element is a custom HTML webcomponent.\n */\n Component.includes(\"-\")) {\n return false;\n }\n else if (\n /**\n * If it's in our list of lowercase SVG tags, it's an SVG component\n */\n lowercaseSVGElements.indexOf(Component) > -1 ||\n /**\n * If it contains a capital letter, it's an SVG component\n */\n /[A-Z]/u.test(Component)) {\n return true;\n }\n return false;\n}\n\nexport { isSVGComponent };\n//# sourceMappingURL=is-svg-component.mjs.map\n","\"use client\";\nimport { isMotionValue } from 'motion-dom';\nimport { Fragment, useMemo, createElement } from 'react';\nimport { useHTMLProps } from '../html/use-props.mjs';\nimport { useSVGProps } from '../svg/use-props.mjs';\nimport { filterProps } from './utils/filter-props.mjs';\nimport { isSVGComponent } from './utils/is-svg-component.mjs';\n\nfunction useRender(Component, props, ref, { latestValues, }, isStatic, forwardMotionProps = false, isSVG) {\n const useVisualProps = (isSVG ?? isSVGComponent(Component)) ? useSVGProps : useHTMLProps;\n const visualProps = useVisualProps(props, latestValues, isStatic, Component);\n const filteredProps = filterProps(props, typeof Component === \"string\", forwardMotionProps);\n const elementProps = Component !== Fragment ? { ...filteredProps, ...visualProps, ref } : {};\n /**\n * If component has been handed a motion value as its child,\n * memoise its initial value and render that. Subsequent updates\n * will be handled by the onChange handler\n */\n const { children } = props;\n const renderedChildren = useMemo(() => (isMotionValue(children) ? children.get() : children), [children]);\n return createElement(Component, {\n ...elementProps,\n children: renderedChildren,\n });\n}\n\nexport { useRender };\n//# sourceMappingURL=use-render.mjs.map\n","\"use client\";\nimport { resolveMotionValue, isControllingVariants, isVariantNode, isAnimationControls, resolveVariantFromProps } from 'motion-dom';\nimport { useContext } from 'react';\nimport { MotionContext } from '../../context/MotionContext/index.mjs';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\n\nfunction makeState({ scrapeMotionValuesFromProps, createRenderState, }, props, context, presenceContext) {\n const state = {\n latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),\n renderState: createRenderState(),\n };\n return state;\n}\nfunction makeLatestValues(props, context, presenceContext, scrapeMotionValues) {\n const values = {};\n const motionValues = scrapeMotionValues(props, {});\n for (const key in motionValues) {\n values[key] = resolveMotionValue(motionValues[key]);\n }\n let { initial, animate } = props;\n const isControllingVariants$1 = isControllingVariants(props);\n const isVariantNode$1 = isVariantNode(props);\n if (context &&\n isVariantNode$1 &&\n !isControllingVariants$1 &&\n props.inherit !== false) {\n if (initial === undefined)\n initial = context.initial;\n if (animate === undefined)\n animate = context.animate;\n }\n let isInitialAnimationBlocked = presenceContext\n ? presenceContext.initial === false\n : false;\n isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;\n const variantToSet = isInitialAnimationBlocked ? animate : initial;\n if (variantToSet &&\n typeof variantToSet !== \"boolean\" &&\n !isAnimationControls(variantToSet)) {\n const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];\n for (let i = 0; i < list.length; i++) {\n const resolved = resolveVariantFromProps(props, list[i]);\n if (resolved) {\n const { transitionEnd, transition, ...target } = resolved;\n for (const key in target) {\n let valueTarget = target[key];\n if (Array.isArray(valueTarget)) {\n /**\n * Take final keyframe if the initial animation is blocked because\n * we want to initialise at the end of that blocked animation.\n */\n const index = isInitialAnimationBlocked\n ? valueTarget.length - 1\n : 0;\n valueTarget = valueTarget[index];\n }\n if (valueTarget !== null) {\n values[key] = valueTarget;\n }\n }\n for (const key in transitionEnd) {\n values[key] = transitionEnd[key];\n }\n }\n }\n }\n return values;\n}\nconst makeUseVisualState = (config) => (props, isStatic) => {\n const context = useContext(MotionContext);\n const presenceContext = useContext(PresenceContext);\n const make = () => makeState(config, props, context, presenceContext);\n return isStatic ? make() : useConstant(make);\n};\n\nexport { makeUseVisualState };\n//# sourceMappingURL=use-visual-state.mjs.map\n","\"use client\";\nimport { scrapeHTMLMotionValuesFromProps } from 'motion-dom';\nimport { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';\nimport { createHtmlRenderState } from './utils/create-render-state.mjs';\n\nconst useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,\n createRenderState: createHtmlRenderState,\n});\n\nexport { useHTMLVisualState };\n//# sourceMappingURL=use-html-visual-state.mjs.map\n","\"use client\";\nimport { scrapeSVGMotionValuesFromProps } from 'motion-dom';\nimport { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';\nimport { createSvgRenderState } from './utils/create-render-state.mjs';\n\nconst useSVGVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,\n createRenderState: createSvgRenderState,\n});\n\nexport { useSVGVisualState };\n//# sourceMappingURL=use-svg-visual-state.mjs.map\n","const motionComponentSymbol = Symbol.for(\"motionComponentSymbol\");\n\nexport { motionComponentSymbol };\n//# sourceMappingURL=symbol.mjs.map\n","\"use client\";\nimport { useRef, useInsertionEffect, useCallback } from 'react';\n\n/**\n * Creates a ref function that, when called, hydrates the provided\n * external ref and VisualElement.\n */\nfunction useMotionRef(visualState, visualElement, externalRef) {\n /**\n * Store externalRef in a ref to avoid including it in the useCallback\n * dependency array. Including externalRef in dependencies causes issues\n * with libraries like Radix UI that create new callback refs on each render\n * when using asChild - this would cause the callback to be recreated,\n * triggering element remounts and breaking AnimatePresence exit animations.\n */\n const externalRefContainer = useRef(externalRef);\n useInsertionEffect(() => {\n externalRefContainer.current = externalRef;\n });\n // Store cleanup function returned by callback refs (React 19 feature)\n const refCleanup = useRef(null);\n return useCallback((instance) => {\n if (instance) {\n visualState.onMount?.(instance);\n }\n const ref = externalRefContainer.current;\n if (typeof ref === \"function\") {\n if (instance) {\n const cleanup = ref(instance);\n if (typeof cleanup === \"function\") {\n refCleanup.current = cleanup;\n }\n }\n else if (refCleanup.current) {\n refCleanup.current();\n refCleanup.current = null;\n }\n else {\n ref(instance);\n }\n }\n else if (ref) {\n ref.current = instance;\n }\n if (visualElement) {\n instance ? visualElement.mount(instance) : visualElement.unmount();\n }\n }, [visualElement]);\n}\n\nexport { useMotionRef };\n//# sourceMappingURL=use-motion-ref.mjs.map\n","\"use client\";\nimport { createContext } from 'react';\n\n/**\n * Internal, exported only for usage in Framer\n */\nconst SwitchLayoutGroupContext = createContext({});\n\nexport { SwitchLayoutGroupContext };\n//# sourceMappingURL=SwitchLayoutGroupContext.mjs.map\n","function isRefObject(ref) {\n return (ref &&\n typeof ref === \"object\" &&\n Object.prototype.hasOwnProperty.call(ref, \"current\"));\n}\n\nexport { isRefObject };\n//# sourceMappingURL=is-ref-object.mjs.map\n","\"use client\";\nimport { optimizedAppearDataAttribute } from 'motion-dom';\nimport { useContext, useRef, useInsertionEffect, useEffect } from 'react';\nimport { LazyContext } from '../../context/LazyContext.mjs';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { MotionContext } from '../../context/MotionContext/index.mjs';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { SwitchLayoutGroupContext } from '../../context/SwitchLayoutGroupContext.mjs';\nimport { isRefObject } from '../../utils/is-ref-object.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\n\nfunction useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) {\n const { visualElement: parent } = useContext(MotionContext);\n const lazyContext = useContext(LazyContext);\n const presenceContext = useContext(PresenceContext);\n const motionConfig = useContext(MotionConfigContext);\n const reducedMotionConfig = motionConfig.reducedMotion;\n const skipAnimations = motionConfig.skipAnimations;\n const visualElementRef = useRef(null);\n /**\n * Track whether the component has been through React's commit phase.\n * Used to detect when LazyMotion features load after the component has mounted.\n */\n const hasMountedOnce = useRef(false);\n /**\n * If we haven't preloaded a renderer, check to see if we have one lazy-loaded\n */\n createVisualElement =\n createVisualElement ||\n lazyContext.renderer;\n if (!visualElementRef.current && createVisualElement) {\n visualElementRef.current = createVisualElement(Component, {\n visualState,\n parent,\n props,\n presenceContext,\n blockInitialAnimation: presenceContext\n ? presenceContext.initial === false\n : false,\n reducedMotionConfig,\n skipAnimations,\n isSVG,\n });\n /**\n * If the component has already mounted before features loaded (e.g. via\n * LazyMotion with async feature loading), we need to force the initial\n * animation to run. Otherwise state changes that occurred before features\n * loaded will be lost and the element will snap to its final state.\n */\n if (hasMountedOnce.current && visualElementRef.current) {\n visualElementRef.current.manuallyAnimateOnMount = true;\n }\n }\n const visualElement = visualElementRef.current;\n /**\n * Load Motion gesture and animation features. These are rendered as renderless\n * components so each feature can optionally make use of React lifecycle methods.\n */\n const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);\n if (visualElement &&\n !visualElement.projection &&\n ProjectionNodeConstructor &&\n (visualElement.type === \"html\" || visualElement.type === \"svg\")) {\n createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);\n }\n const isMounted = useRef(false);\n useInsertionEffect(() => {\n /**\n * Check the component has already mounted before calling\n * `update` unnecessarily. This ensures we skip the initial update.\n */\n if (visualElement && isMounted.current) {\n visualElement.update(props, presenceContext);\n }\n });\n /**\n * Cache this value as we want to know whether HandoffAppearAnimations\n * was present on initial render - it will be deleted after this.\n */\n const optimisedAppearId = props[optimizedAppearDataAttribute];\n const wantsHandoff = useRef(Boolean(optimisedAppearId) &&\n typeof window !== \"undefined\" &&\n !window.MotionHandoffIsComplete?.(optimisedAppearId) &&\n window.MotionHasOptimisedAnimation?.(optimisedAppearId));\n useIsomorphicLayoutEffect(() => {\n /**\n * Track that this component has mounted. This is used to detect when\n * LazyMotion features load after the component has already committed.\n */\n hasMountedOnce.current = true;\n if (!visualElement)\n return;\n isMounted.current = true;\n window.MotionIsMounted = true;\n visualElement.updateFeatures();\n visualElement.scheduleRenderMicrotask();\n /**\n * Ideally this function would always run in a useEffect.\n *\n * However, if we have optimised appear animations to handoff from,\n * it needs to happen synchronously to ensure there's no flash of\n * incorrect styles in the event of a hydration error.\n *\n * So if we detect a situtation where optimised appear animations\n * are running, we use useLayoutEffect to trigger animations.\n */\n if (wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges();\n }\n });\n useEffect(() => {\n if (!visualElement)\n return;\n if (!wantsHandoff.current && visualElement.animationState) {\n visualElement.animationState.animateChanges();\n }\n if (wantsHandoff.current) {\n // This ensures all future calls to animateChanges() in this component will run in useEffect\n queueMicrotask(() => {\n window.MotionHandoffMarkAsComplete?.(optimisedAppearId);\n });\n wantsHandoff.current = false;\n }\n /**\n * Now we've finished triggering animations for this element we\n * can wipe the enteringChildren set for the next render.\n */\n visualElement.enteringChildren = undefined;\n });\n return visualElement;\n}\nfunction createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {\n const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutAnchor, layoutCrossfade, } = props;\n visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props[\"data-framer-portal-id\"]\n ? undefined\n : getClosestProjectingNode(visualElement.parent));\n visualElement.projection.setOptions({\n layoutId,\n layout,\n alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),\n visualElement,\n /**\n * TODO: Update options in an effect. This could be tricky as it'll be too late\n * to update by the time layout animations run.\n * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,\n * ensuring it gets called if there's no potential layout animations.\n *\n */\n animationType: typeof layout === \"string\" ? layout : \"both\",\n initialPromotionConfig,\n crossfade: layoutCrossfade,\n layoutScroll,\n layoutRoot,\n layoutAnchor,\n });\n}\nfunction getClosestProjectingNode(visualElement) {\n if (!visualElement)\n return undefined;\n return visualElement.options.allowProjection !== false\n ? visualElement.projection\n : getClosestProjectingNode(visualElement.parent);\n}\n\nexport { useVisualElement };\n//# sourceMappingURL=use-visual-element.mjs.map\n","\"use client\";\nimport { jsxs, jsx } from 'react/jsx-runtime';\nimport { warning, invariant } from 'motion-utils';\nimport { forwardRef, useContext } from 'react';\nimport { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';\nimport { LazyContext } from '../context/LazyContext.mjs';\nimport { MotionConfigContext } from '../context/MotionConfigContext.mjs';\nimport { MotionContext } from '../context/MotionContext/index.mjs';\nimport { useCreateMotionContext } from '../context/MotionContext/create.mjs';\nimport { useRender } from '../render/dom/use-render.mjs';\nimport { isSVGComponent } from '../render/dom/utils/is-svg-component.mjs';\nimport { useHTMLVisualState } from '../render/html/use-html-visual-state.mjs';\nimport { useSVGVisualState } from '../render/svg/use-svg-visual-state.mjs';\nimport { getInitializedFeatureDefinitions } from './features/definitions.mjs';\nimport { loadFeatures } from './features/load-features.mjs';\nimport { motionComponentSymbol } from './utils/symbol.mjs';\nimport { useMotionRef } from './utils/use-motion-ref.mjs';\nimport { useVisualElement } from './utils/use-visual-element.mjs';\n\n/**\n * Create a `motion` component.\n *\n * This function accepts a Component argument, which can be either a string (ie \"div\"\n * for `motion.div`), or an actual React component.\n *\n * Alongside this is a config option which provides a way of rendering the provided\n * component \"offline\", or outside the React render cycle.\n */\nfunction createMotionComponent(Component, { forwardMotionProps = false, type } = {}, preloadedFeatures, createVisualElement) {\n preloadedFeatures && loadFeatures(preloadedFeatures);\n /**\n * Determine whether to use SVG or HTML rendering based on:\n * 1. Explicit `type` option (highest priority)\n * 2. Auto-detection via `isSVGComponent`\n */\n const isSVG = type ? type === \"svg\" : isSVGComponent(Component);\n const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState;\n function MotionDOMComponent(props, externalRef) {\n /**\n * If we need to measure the element we load this functionality in a\n * separate class component in order to gain access to getSnapshotBeforeUpdate.\n */\n let MeasureLayout;\n const configAndProps = {\n ...useContext(MotionConfigContext),\n ...props,\n layoutId: useLayoutId(props),\n };\n const { isStatic } = configAndProps;\n const context = useCreateMotionContext(props);\n const visualState = useVisualState(props, isStatic);\n if (!isStatic && typeof window !== \"undefined\") {\n useStrictMode(configAndProps, preloadedFeatures);\n const layoutProjection = getProjectionFunctionality(configAndProps);\n MeasureLayout = layoutProjection.MeasureLayout;\n /**\n * Create a VisualElement for this component. A VisualElement provides a common\n * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as\n * providing a way of rendering to these APIs outside of the React render loop\n * for more performant animations and interactions\n */\n context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG);\n }\n /**\n * The mount order and hierarchy is specific to ensure our element ref\n * is hydrated by the time features fire their effects.\n */\n return (jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)] }));\n }\n MotionDOMComponent.displayName = `motion.${typeof Component === \"string\"\n ? Component\n : `create(${Component.displayName ?? Component.name ?? \"\"})`}`;\n const ForwardRefMotionComponent = forwardRef(MotionDOMComponent);\n ForwardRefMotionComponent[motionComponentSymbol] = Component;\n return ForwardRefMotionComponent;\n}\nfunction useLayoutId({ layoutId }) {\n const layoutGroupId = useContext(LayoutGroupContext).id;\n return layoutGroupId && layoutId !== undefined\n ? layoutGroupId + \"-\" + layoutId\n : layoutId;\n}\nfunction useStrictMode(configAndProps, preloadedFeatures) {\n const isStrict = useContext(LazyContext).strict;\n /**\n * If we're in development mode, check to make sure we're not rendering a motion component\n * as a child of LazyMotion, as this will break the file-size benefits of using it.\n */\n if (process.env.NODE_ENV !== \"production\" &&\n preloadedFeatures &&\n isStrict) {\n const strictMessage = \"You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.\";\n configAndProps.ignoreStrict\n ? warning(false, strictMessage, \"lazy-strict-mode\")\n : invariant(false, strictMessage, \"lazy-strict-mode\");\n }\n}\nfunction getProjectionFunctionality(props) {\n const featureDefinitions = getInitializedFeatureDefinitions();\n const { drag, layout } = featureDefinitions;\n if (!drag && !layout)\n return {};\n const combined = { ...drag, ...layout };\n return {\n MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props)\n ? combined.MeasureLayout\n : undefined,\n ProjectionNode: combined.ProjectionNode,\n };\n}\n\nexport { createMotionComponent };\n//# sourceMappingURL=index.mjs.map\n","import { warnOnce } from 'motion-utils';\nimport { createMotionComponent } from '../../motion/index.mjs';\n\nfunction createMotionProxy(preloadedFeatures, createVisualElement) {\n if (typeof Proxy === \"undefined\") {\n return createMotionComponent;\n }\n /**\n * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.\n * Rather than generating them anew every render.\n */\n const componentCache = new Map();\n const factory = (Component, options) => {\n return createMotionComponent(Component, options, preloadedFeatures, createVisualElement);\n };\n /**\n * Support for deprecated`motion(Component)` pattern\n */\n const deprecatedFactoryFunction = (Component, options) => {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(false, \"motion() is deprecated. Use motion.create() instead.\");\n }\n return factory(Component, options);\n };\n return new Proxy(deprecatedFactoryFunction, {\n /**\n * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.\n * The prop name is passed through as `key` and we can use that to generate a `motion`\n * DOM component with that name.\n */\n get: (_target, key) => {\n if (key === \"create\")\n return factory;\n /**\n * If this element doesn't exist in the component cache, create it and cache.\n */\n if (!componentCache.has(key)) {\n componentCache.set(key, createMotionComponent(key, undefined, preloadedFeatures, createVisualElement));\n }\n return componentCache.get(key);\n },\n });\n}\n\nexport { createMotionProxy };\n//# sourceMappingURL=create-proxy.mjs.map\n","import { SVGVisualElement, HTMLVisualElement } from 'motion-dom';\nimport { Fragment } from 'react';\nimport { isSVGComponent } from './utils/is-svg-component.mjs';\n\nconst createDomVisualElement = (Component, options) => {\n /**\n * Use explicit isSVG override if provided, otherwise auto-detect\n */\n const isSVG = options.isSVG ?? isSVGComponent(Component);\n return isSVG\n ? new SVGVisualElement(options)\n : new HTMLVisualElement(options, {\n allowProjection: Component !== Fragment,\n });\n};\n\nexport { createDomVisualElement };\n//# sourceMappingURL=create-visual-element.mjs.map\n","import { Feature, createAnimationState, isAnimationControls } from 'motion-dom';\n\nclass AnimationFeature extends Feature {\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n constructor(node) {\n super(node);\n node.animationState || (node.animationState = createAnimationState(node));\n }\n updateAnimationControlsSubscription() {\n const { animate } = this.node.getProps();\n if (isAnimationControls(animate)) {\n this.unmountControls = animate.subscribe(this.node);\n }\n }\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n mount() {\n this.updateAnimationControlsSubscription();\n }\n update() {\n const { animate } = this.node.getProps();\n const { animate: prevAnimate } = this.node.prevProps || {};\n if (animate !== prevAnimate) {\n this.updateAnimationControlsSubscription();\n }\n }\n unmount() {\n this.node.animationState.reset();\n this.unmountControls?.();\n }\n}\n\nexport { AnimationFeature };\n//# sourceMappingURL=index.mjs.map\n","import { Feature, resolveVariant } from 'motion-dom';\n\nlet id = 0;\nclass ExitAnimationFeature extends Feature {\n constructor() {\n super(...arguments);\n this.id = id++;\n this.isExitComplete = false;\n }\n update() {\n if (!this.node.presenceContext)\n return;\n const { isPresent, onExitComplete } = this.node.presenceContext;\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return;\n }\n if (isPresent && prevIsPresent === false) {\n /**\n * When re-entering, if the exit animation already completed\n * (element is at rest), reset to initial values so the enter\n * animation replays from the correct position.\n */\n if (this.isExitComplete) {\n const { initial, custom } = this.node.getProps();\n if (typeof initial === \"string\") {\n const resolved = resolveVariant(this.node, initial, custom);\n if (resolved) {\n const { transition, transitionEnd, ...target } = resolved;\n for (const key in target) {\n this.node\n .getValue(key)\n ?.jump(target[key]);\n }\n }\n }\n this.node.animationState.reset();\n this.node.animationState.animateChanges();\n }\n else {\n this.node.animationState.setActive(\"exit\", false);\n }\n this.isExitComplete = false;\n return;\n }\n const exitAnimation = this.node.animationState.setActive(\"exit\", !isPresent);\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n this.isExitComplete = true;\n onExitComplete(this.id);\n });\n }\n }\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {};\n if (onExitComplete) {\n onExitComplete(this.id);\n }\n if (register) {\n this.unmount = register(this.id);\n }\n }\n unmount() { }\n}\n\nexport { ExitAnimationFeature };\n//# sourceMappingURL=exit.mjs.map\n","import { AnimationFeature } from './animation/index.mjs';\nimport { ExitAnimationFeature } from './animation/exit.mjs';\n\nconst animations = {\n animation: {\n Feature: AnimationFeature,\n },\n exit: {\n Feature: ExitAnimationFeature,\n },\n};\n\nexport { animations };\n//# sourceMappingURL=animations.mjs.map\n","import { isPrimaryPointer } from 'motion-dom';\n\nfunction extractEventInfo(event) {\n return {\n point: {\n x: event.pageX,\n y: event.pageY,\n },\n };\n}\nconst addPointerInfo = (handler) => (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));\n\nexport { addPointerInfo, extractEventInfo };\n//# sourceMappingURL=event-info.mjs.map\n","import { addDomEvent } from 'motion-dom';\nimport { addPointerInfo } from './event-info.mjs';\n\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, eventName, addPointerInfo(handler), options);\n}\n\nexport { addPointerEvent };\n//# sourceMappingURL=add-pointer-event.mjs.map\n","// Fixes https://github.com/motiondivision/motion/issues/2270\nconst getContextWindow = ({ current }) => {\n return current ? current.ownerDocument.defaultView : null;\n};\n\nexport { getContextWindow };\n//# sourceMappingURL=get-context-window.mjs.map\n","const distance = (a, b) => Math.abs(a - b);\nfunction distance2D(a, b) {\n // Multi-dimensional\n const xDelta = distance(a.x, b.x);\n const yDelta = distance(a.y, b.y);\n return Math.sqrt(xDelta ** 2 + yDelta ** 2);\n}\n\nexport { distance, distance2D };\n//# sourceMappingURL=distance.mjs.map\n","import { frameData, frame, isPrimaryPointer, cancelFrame } from 'motion-dom';\nimport { pipe, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';\nimport { addPointerEvent } from '../../events/add-pointer-event.mjs';\nimport { extractEventInfo } from '../../events/event-info.mjs';\nimport { distance2D } from '../../utils/distance.mjs';\n\nconst overflowStyles = /*#__PURE__*/ new Set([\"auto\", \"scroll\"]);\n/**\n * @internal\n */\nclass PanSession {\n constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element, } = {}) {\n /**\n * @internal\n */\n this.startEvent = null;\n /**\n * @internal\n */\n this.lastMoveEvent = null;\n /**\n * @internal\n */\n this.lastMoveEventInfo = null;\n /**\n * Raw (untransformed) event info, re-transformed each frame\n * so transformPagePoint sees the current parent matrix.\n * @internal\n */\n this.lastRawMoveEventInfo = null;\n /**\n * @internal\n */\n this.handlers = {};\n /**\n * @internal\n */\n this.contextWindow = window;\n /**\n * Scroll positions of scrollable ancestors and window.\n * @internal\n */\n this.scrollPositions = new Map();\n /**\n * Cleanup function for scroll listeners.\n * @internal\n */\n this.removeScrollListeners = null;\n this.onElementScroll = (event) => {\n this.handleScroll(event.target);\n };\n this.onWindowScroll = () => {\n this.handleScroll(window);\n };\n this.updatePoint = () => {\n if (!(this.lastMoveEvent && this.lastMoveEventInfo))\n return;\n // Re-transform raw point through current transformPagePoint so\n // animated parent transforms (e.g. rotation) are picked up each frame\n if (this.lastRawMoveEventInfo) {\n this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint);\n }\n const info = getPanInfo(this.lastMoveEventInfo, this.history);\n const isPanStarted = this.startEvent !== null;\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursor.\n const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold;\n if (!isPanStarted && !isDistancePastThreshold)\n return;\n const { point } = info;\n const { timestamp } = frameData;\n this.history.push({ ...point, timestamp });\n const { onStart, onMove } = this.handlers;\n if (!isPanStarted) {\n onStart && onStart(this.lastMoveEvent, info);\n this.startEvent = this.lastMoveEvent;\n }\n onMove && onMove(this.lastMoveEvent, info);\n };\n this.handlePointerMove = (event, info) => {\n this.lastMoveEvent = event;\n this.lastRawMoveEventInfo = info;\n this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);\n // Throttle mouse move event to once per frame\n frame.update(this.updatePoint, true);\n };\n this.handlePointerUp = (event, info) => {\n this.end();\n const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;\n // Resume animation if dragSnapToOrigin is set OR if no drag started (user just clicked)\n // This ensures constraint animations continue when interrupted by a click\n if (this.dragSnapToOrigin || !this.startEvent) {\n resumeAnimation && resumeAnimation();\n }\n if (!(this.lastMoveEvent && this.lastMoveEventInfo))\n return;\n const panInfo = getPanInfo(event.type === \"pointercancel\"\n ? this.lastMoveEventInfo\n : transformPoint(info, this.transformPagePoint), this.history);\n if (this.startEvent && onEnd) {\n onEnd(event, panInfo);\n }\n onSessionEnd && onSessionEnd(event, panInfo);\n };\n // If we have more than one touch, don't start detecting this gesture\n if (!isPrimaryPointer(event))\n return;\n this.dragSnapToOrigin = dragSnapToOrigin;\n this.handlers = handlers;\n this.transformPagePoint = transformPagePoint;\n this.distanceThreshold = distanceThreshold;\n this.contextWindow = contextWindow || window;\n const info = extractEventInfo(event);\n const initialInfo = transformPoint(info, this.transformPagePoint);\n const { point } = initialInfo;\n const { timestamp } = frameData;\n this.history = [{ ...point, timestamp }];\n const { onSessionStart } = handlers;\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history));\n this.removeListeners = pipe(addPointerEvent(this.contextWindow, \"pointermove\", this.handlePointerMove), addPointerEvent(this.contextWindow, \"pointerup\", this.handlePointerUp), addPointerEvent(this.contextWindow, \"pointercancel\", this.handlePointerUp));\n // Start scroll tracking if element provided\n if (element) {\n this.startScrollTracking(element);\n }\n }\n /**\n * Start tracking scroll on ancestors and window.\n */\n startScrollTracking(element) {\n // Store initial scroll positions for scrollable ancestors\n let current = element.parentElement;\n while (current) {\n const style = getComputedStyle(current);\n if (overflowStyles.has(style.overflowX) ||\n overflowStyles.has(style.overflowY)) {\n this.scrollPositions.set(current, {\n x: current.scrollLeft,\n y: current.scrollTop,\n });\n }\n current = current.parentElement;\n }\n // Track window scroll\n this.scrollPositions.set(window, {\n x: window.scrollX,\n y: window.scrollY,\n });\n // Capture listener catches element scroll events as they bubble\n window.addEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n });\n // Direct window scroll listener (window scroll doesn't bubble)\n window.addEventListener(\"scroll\", this.onWindowScroll);\n this.removeScrollListeners = () => {\n window.removeEventListener(\"scroll\", this.onElementScroll, {\n capture: true,\n });\n window.removeEventListener(\"scroll\", this.onWindowScroll);\n };\n }\n /**\n * Handle scroll compensation during drag.\n *\n * For element scroll: adjusts history origin since pageX/pageY doesn't change.\n * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.\n */\n handleScroll(target) {\n const initial = this.scrollPositions.get(target);\n if (!initial)\n return;\n const isWindow = target === window;\n const current = isWindow\n ? { x: window.scrollX, y: window.scrollY }\n : {\n x: target.scrollLeft,\n y: target.scrollTop,\n };\n const delta = { x: current.x - initial.x, y: current.y - initial.y };\n if (delta.x === 0 && delta.y === 0)\n return;\n if (isWindow) {\n // Window scroll: pageX/pageY changes, so update lastMoveEventInfo\n if (this.lastMoveEventInfo) {\n this.lastMoveEventInfo.point.x += delta.x;\n this.lastMoveEventInfo.point.y += delta.y;\n }\n }\n else {\n // Element scroll: pageX/pageY unchanged, so adjust history origin\n if (this.history.length > 0) {\n this.history[0].x -= delta.x;\n this.history[0].y -= delta.y;\n }\n }\n this.scrollPositions.set(target, current);\n frame.update(this.updatePoint, true);\n }\n updateHandlers(handlers) {\n this.handlers = handlers;\n }\n end() {\n this.removeListeners && this.removeListeners();\n this.removeScrollListeners && this.removeScrollListeners();\n this.scrollPositions.clear();\n cancelFrame(this.updatePoint);\n }\n}\nfunction transformPoint(info, transformPagePoint) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info;\n}\nfunction subtractPoint(a, b) {\n return { x: a.x - b.x, y: a.y - b.y };\n}\nfunction getPanInfo({ point }, history) {\n return {\n point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n };\n}\nfunction startDevicePoint(history) {\n return history[0];\n}\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return { x: 0, y: 0 };\n }\n let i = history.length - 1;\n let timestampedPoint = null;\n const lastPoint = lastDevicePoint(history);\n while (i >= 0) {\n timestampedPoint = history[i];\n if (lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)) {\n break;\n }\n i--;\n }\n if (!timestampedPoint) {\n return { x: 0, y: 0 };\n }\n /**\n * If the selected point is the pointer-down origin (history[0]),\n * there are better movement points available, and the time gap\n * is suspiciously large (>2x timeDelta), use the next point instead.\n * This prevents stale pointer-down points from diluting velocity\n * in hold-then-flick gestures.\n */\n if (timestampedPoint === history[0] &&\n history.length > 2 &&\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta) * 2) {\n timestampedPoint = history[1];\n }\n const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);\n if (time === 0) {\n return { x: 0, y: 0 };\n }\n const currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n };\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n return currentVelocity;\n}\n\nexport { PanSession };\n//# sourceMappingURL=PanSession.mjs.map\n","import { mixNumber, calcLength } from 'motion-dom';\nimport { progress, clamp } from 'motion-utils';\n\n/**\n * Apply constraints to a point. These constraints are both physical along an\n * axis, and an elastic factor that determines how much to constrain the point\n * by if it does lie outside the defined parameters.\n */\nfunction applyConstraints(point, { min, max }, elastic) {\n if (min !== undefined && point < min) {\n // If we have a min point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(min, point, elastic.min)\n : Math.max(point, min);\n }\n else if (max !== undefined && point > max) {\n // If we have a max point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(max, point, elastic.max)\n : Math.min(point, max);\n }\n return point;\n}\n/**\n * Calculate constraints in terms of the viewport when defined relatively to the\n * measured axis. This is measured from the nearest edge, so a max constraint of 200\n * on an axis with a max value of 300 would return a constraint of 500 - axis length\n */\nfunction calcRelativeAxisConstraints(axis, min, max) {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max: max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n };\n}\n/**\n * Calculate constraints in terms of the viewport when\n * defined relatively to the measured bounding box.\n */\nfunction calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {\n return {\n x: calcRelativeAxisConstraints(layoutBox.x, left, right),\n y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),\n };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative axis\n */\nfunction calcViewportAxisConstraints(layoutAxis, constraintsAxis) {\n let min = constraintsAxis.min - layoutAxis.min;\n let max = constraintsAxis.max - layoutAxis.max;\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min) {\n [min, max] = [max, min];\n }\n return { min, max };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative box\n */\nfunction calcViewportConstraints(layoutBox, constraintsBox) {\n return {\n x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),\n y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),\n };\n}\n/**\n * Calculate a transform origin relative to the source axis, between 0-1, that results\n * in an asthetically pleasing scale/transform needed to project from source to target.\n */\nfunction calcOrigin(source, target) {\n let origin = 0.5;\n const sourceLength = calcLength(source);\n const targetLength = calcLength(target);\n if (targetLength > sourceLength) {\n origin = progress(target.min, target.max - sourceLength, source.min);\n }\n else if (sourceLength > targetLength) {\n origin = progress(source.min, source.max - targetLength, target.min);\n }\n return clamp(0, 1, origin);\n}\n/**\n * Rebase the calculated viewport constraints relative to the layout.min point.\n */\nfunction rebaseAxisConstraints(layout, constraints) {\n const relativeConstraints = {};\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min;\n }\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min;\n }\n return relativeConstraints;\n}\nconst defaultElastic = 0.35;\n/**\n * Accepts a dragElastic prop and returns resolved elastic values for each axis.\n */\nfunction resolveDragElastic(dragElastic = defaultElastic) {\n if (dragElastic === false) {\n dragElastic = 0;\n }\n else if (dragElastic === true) {\n dragElastic = defaultElastic;\n }\n return {\n x: resolveAxisElastic(dragElastic, \"left\", \"right\"),\n y: resolveAxisElastic(dragElastic, \"top\", \"bottom\"),\n };\n}\nfunction resolveAxisElastic(dragElastic, minLabel, maxLabel) {\n return {\n min: resolvePointElastic(dragElastic, minLabel),\n max: resolvePointElastic(dragElastic, maxLabel),\n };\n}\nfunction resolvePointElastic(dragElastic, label) {\n return typeof dragElastic === \"number\"\n ? dragElastic\n : dragElastic[label] || 0;\n}\n\nexport { applyConstraints, calcOrigin, calcRelativeAxisConstraints, calcRelativeConstraints, calcViewportAxisConstraints, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, resolveAxisElastic, resolveDragElastic, resolvePointElastic };\n//# sourceMappingURL=constraints.mjs.map\n","import { createBox, frame, eachAxis, measurePageBox, convertBoxToBoundingBox, convertBoundingBoxToBox, addValueToWillChange, animateMotionValue, mixNumber, addDomEvent, setDragLock, percent, calcLength, resize, isElementTextInput } from 'motion-dom';\nimport { invariant } from 'motion-utils';\nimport { addPointerEvent } from '../../events/add-pointer-event.mjs';\nimport { extractEventInfo } from '../../events/event-info.mjs';\nimport { getContextWindow } from '../../utils/get-context-window.mjs';\nimport { isRefObject } from '../../utils/is-ref-object.mjs';\nimport { PanSession } from '../pan/PanSession.mjs';\nimport { applyConstraints, calcRelativeConstraints, resolveDragElastic, rebaseAxisConstraints, calcViewportConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';\n\nconst elementDragControls = new WeakMap();\nclass VisualElementDragControls {\n constructor(visualElement) {\n this.openDragLock = null;\n this.isDragging = false;\n this.currentDirection = null;\n this.originPoint = { x: 0, y: 0 };\n /**\n * The permitted boundaries of travel, in pixels.\n */\n this.constraints = false;\n this.hasMutatedConstraints = false;\n /**\n * The per-axis resolved elastic values.\n */\n this.elastic = createBox();\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPointerEvent = null;\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPanInfo = null;\n this.visualElement = visualElement;\n }\n start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement;\n if (presenceContext && presenceContext.isPresent === false)\n return;\n const onSessionStart = (event) => {\n if (snapToCursor) {\n this.snapToCursor(extractEventInfo(event).point);\n }\n this.stopAnimation();\n };\n const onStart = (event, info) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps();\n if (drag && !dragPropagation) {\n if (this.openDragLock)\n this.openDragLock();\n this.openDragLock = setDragLock(drag);\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock)\n return;\n }\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.isDragging = true;\n this.currentDirection = null;\n this.resolveConstraints();\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true;\n this.visualElement.projection.target = undefined;\n }\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0;\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n const { projection } = this.visualElement;\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis];\n if (measuredAxis) {\n const length = calcLength(measuredAxis);\n current = length * (parseFloat(current) / 100);\n }\n }\n }\n this.originPoint[axis] = current;\n });\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true);\n }\n addValueToWillChange(this.visualElement, \"transform\");\n const { animationState } = this.visualElement;\n animationState && animationState.setActive(\"whileDrag\", true);\n };\n const onMove = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock)\n return;\n const { offset } = info;\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset);\n // If we've successfully set a direction, notify listener\n if (this.currentDirection !== null) {\n onDirectionLock && onDirectionLock(this.currentDirection);\n }\n return;\n }\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset);\n this.updateAxis(\"y\", info.point, offset);\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render();\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true);\n }\n };\n const onSessionEnd = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.stop(event, info);\n this.latestPointerEvent = null;\n this.latestPanInfo = null;\n };\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps();\n if (snap || this.constraints) {\n this.startAnimation({ x: 0, y: 0 });\n }\n };\n const { dragSnapToOrigin } = this.getProps();\n this.panSession = new PanSession(originEvent, {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n }, {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: getContextWindow(this.visualElement),\n element: this.visualElement.current,\n });\n }\n /**\n * @internal\n */\n stop(event, panInfo) {\n const finalEvent = event || this.latestPointerEvent;\n const finalPanInfo = panInfo || this.latestPanInfo;\n const isDragging = this.isDragging;\n this.cancel();\n if (!isDragging || !finalPanInfo || !finalEvent)\n return;\n const { velocity } = finalPanInfo;\n this.startAnimation(velocity);\n const { onDragEnd } = this.getProps();\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));\n }\n }\n /**\n * @internal\n */\n cancel() {\n this.isDragging = false;\n const { projection, animationState } = this.visualElement;\n if (projection) {\n projection.isAnimationBlocked = false;\n }\n this.endPanSession();\n const { dragPropagation } = this.getProps();\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock();\n this.openDragLock = null;\n }\n animationState && animationState.setActive(\"whileDrag\", false);\n }\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n * @internal\n */\n endPanSession() {\n this.panSession && this.panSession.end();\n this.panSession = undefined;\n }\n updateAxis(axis, _point, offset) {\n const { drag } = this.getProps();\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection))\n return;\n const axisValue = this.getAxisMotionValue(axis);\n let next = this.originPoint[axis] + offset[axis];\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);\n }\n axisValue.set(next);\n }\n resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps();\n const layout = this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout;\n const prevConstraints = this.constraints;\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints();\n }\n }\n else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);\n }\n else {\n this.constraints = false;\n }\n }\n this.elastic = resolveDragElastic(dragElastic);\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (prevConstraints !== this.constraints &&\n !isRefObject(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints) {\n eachAxis((axis) => {\n if (this.constraints !== false &&\n this.getAxisMotionValue(axis)) {\n this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);\n }\n });\n }\n }\n resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();\n if (!constraints || !isRefObject(constraints))\n return false;\n const constraintsElement = constraints.current;\n invariant(constraintsElement !== null, \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\", \"drag-constraints-ref\");\n const { projection } = this.visualElement;\n // TODO\n if (!projection || !projection.layout)\n return false;\n const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());\n let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));\n this.hasMutatedConstraints = !!userConstraints;\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints);\n }\n }\n return measuredConstraints;\n }\n startAnimation(velocity) {\n const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();\n const constraints = this.constraints || {};\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection)) {\n return;\n }\n let transition = (constraints && constraints[axis]) || {};\n if (dragSnapToOrigin === true ||\n dragSnapToOrigin === axis)\n transition = { min: 0, max: 0 };\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000;\n const bounceDamping = dragElastic ? 40 : 10000000;\n const inertia = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n };\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia);\n });\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd);\n }\n startAxisValueAnimation(axis, transition) {\n const axisValue = this.getAxisMotionValue(axis);\n addValueToWillChange(this.visualElement, axis);\n return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));\n }\n stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop());\n }\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n getAxisMotionValue(axis) {\n const dragKey = `_drag${axis.toUpperCase()}`;\n const props = this.visualElement.getProps();\n const externalMotionValue = props[dragKey];\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(axis, (props.initial\n ? props.initial[axis]\n : undefined) || 0);\n }\n snapToCursor(point) {\n eachAxis((axis) => {\n const { drag } = this.getProps();\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, this.currentDirection))\n return;\n const { projection } = this.visualElement;\n const axisValue = this.getAxisMotionValue(axis);\n if (projection && projection.layout) {\n const { min, max } = projection.layout.layoutBox[axis];\n /**\n * The layout measurement includes the current transform value,\n * so we need to add it back to get the correct snap position.\n * This fixes an issue where elements with initial coordinates\n * would snap to the wrong position on the first drag.\n */\n const current = axisValue.get() || 0;\n axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current);\n }\n });\n }\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current)\n return;\n const { drag, dragConstraints } = this.getProps();\n const { projection } = this.visualElement;\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return;\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation();\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const boxProgress = { x: 0, y: 0 };\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis);\n if (axisValue && this.constraints !== false) {\n const latest = axisValue.get();\n boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]);\n }\n });\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps();\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n projection.root && projection.root.updateScroll();\n projection.updateLayout();\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false;\n this.resolveConstraints();\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, null))\n return;\n /**\n * Calculate a new transform based on the previous box progress\n */\n const axisValue = this.getAxisMotionValue(axis);\n const { min, max } = this.constraints[axis];\n axisValue.set(mixNumber(min, max, boxProgress[axis]));\n });\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render();\n }\n addListeners() {\n if (!this.visualElement.current)\n return;\n elementDragControls.set(this.visualElement, this);\n const element = this.visualElement.current;\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(element, \"pointerdown\", (event) => {\n const { drag, dragListener = true } = this.getProps();\n const target = event.target;\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild = target !== element && isElementTextInput(target);\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event);\n }\n });\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers;\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps();\n if (isRefObject(dragConstraints) && dragConstraints.current) {\n this.constraints = this.resolveRefConstraints();\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints());\n }\n }\n };\n const { projection } = this.visualElement;\n const stopMeasureLayoutListener = projection.addEventListener(\"measure\", measureDragConstraints);\n if (projection && !projection.layout) {\n projection.root && projection.root.updateScroll();\n projection.updateLayout();\n }\n frame.read(measureDragConstraints);\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () => this.scalePositionWithinConstraints());\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection.addEventListener(\"didUpdate\", (({ delta, hasLayoutChanged }) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n const motionValue = this.getAxisMotionValue(axis);\n if (!motionValue)\n return;\n this.originPoint[axis] += delta[axis].translate;\n motionValue.set(motionValue.get() + delta[axis].translate);\n });\n this.visualElement.render();\n }\n }));\n return () => {\n stopResizeListener();\n stopPointerListener();\n stopMeasureLayoutListener();\n stopLayoutUpdateListener && stopLayoutUpdateListener();\n stopResizeObservers && stopResizeObservers();\n };\n }\n getProps() {\n const props = this.visualElement.getProps();\n const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n };\n }\n}\nfunction skipFirstCall(callback) {\n let isFirst = true;\n return () => {\n if (isFirst) {\n isFirst = false;\n return;\n }\n callback();\n };\n}\nfunction startResizeObservers(element, constraintsElement, onResize) {\n const stopElement = resize(element, skipFirstCall(onResize));\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize));\n return () => {\n stopElement();\n stopContainer();\n };\n}\nfunction shouldDrag(direction, drag, currentDirection) {\n return ((drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction));\n}\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(offset, lockThreshold = 10) {\n let direction = null;\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\";\n }\n else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\";\n }\n return direction;\n}\n\nexport { VisualElementDragControls, elementDragControls };\n//# sourceMappingURL=VisualElementDragControls.mjs.map\n","import { Feature } from 'motion-dom';\nimport { noop } from 'motion-utils';\nimport { VisualElementDragControls } from './VisualElementDragControls.mjs';\n\nclass DragGesture extends Feature {\n constructor(node) {\n super(node);\n this.removeGroupControls = noop;\n this.removeListeners = noop;\n this.controls = new VisualElementDragControls(node);\n }\n mount() {\n // If we've been provided a DragControls for manual control over the drag gesture,\n // subscribe this component to it on mount.\n const { dragControls } = this.node.getProps();\n if (dragControls) {\n this.removeGroupControls = dragControls.subscribe(this.controls);\n }\n this.removeListeners = this.controls.addListeners() || noop;\n }\n update() {\n const { dragControls } = this.node.getProps();\n const { dragControls: prevDragControls } = this.node.prevProps || {};\n if (dragControls !== prevDragControls) {\n this.removeGroupControls();\n if (dragControls) {\n this.removeGroupControls = dragControls.subscribe(this.controls);\n }\n }\n }\n unmount() {\n this.removeGroupControls();\n this.removeListeners();\n /**\n * In React 19, during list reorder reconciliation, components may\n * briefly unmount and remount while the drag is still active. If we're\n * actively dragging, we should NOT end the pan session - it will\n * continue tracking pointer events via its window-level listeners.\n *\n * The pan session will be properly cleaned up when:\n * 1. The drag ends naturally (pointerup/pointercancel)\n * 2. The component is truly removed from the DOM\n */\n if (!this.controls.isDragging) {\n this.controls.endPanSession();\n }\n }\n}\n\nexport { DragGesture };\n//# sourceMappingURL=index.mjs.map\n","import { Feature, frame } from 'motion-dom';\nimport { noop } from 'motion-utils';\nimport { addPointerEvent } from '../../events/add-pointer-event.mjs';\nimport { getContextWindow } from '../../utils/get-context-window.mjs';\nimport { PanSession } from './PanSession.mjs';\n\nconst asyncHandler = (handler) => (event, info) => {\n if (handler) {\n frame.update(() => handler(event, info), false, true);\n }\n};\nclass PanGesture extends Feature {\n constructor() {\n super(...arguments);\n this.removePointerDownListener = noop;\n }\n onPointerDown(pointerDownEvent) {\n this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {\n transformPagePoint: this.node.getTransformPagePoint(),\n contextWindow: getContextWindow(this.node),\n });\n }\n createPanHandlers() {\n const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();\n return {\n onSessionStart: asyncHandler(onPanSessionStart),\n onStart: asyncHandler(onPanStart),\n onMove: asyncHandler(onPan),\n onEnd: (event, info) => {\n delete this.session;\n if (onPanEnd) {\n frame.postRender(() => onPanEnd(event, info));\n }\n },\n };\n }\n mount() {\n this.removePointerDownListener = addPointerEvent(this.node.current, \"pointerdown\", (event) => this.onPointerDown(event));\n }\n update() {\n this.session && this.session.updateHandlers(this.createPanHandlers());\n }\n unmount() {\n this.removePointerDownListener();\n this.session && this.session.end();\n }\n}\n\nexport { PanGesture };\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { globalProjectionState, frame, microtask } from 'motion-dom';\nimport { useContext, Component } from 'react';\nimport { usePresence } from '../../../components/AnimatePresence/use-presence.mjs';\nimport { LayoutGroupContext } from '../../../context/LayoutGroupContext.mjs';\nimport { SwitchLayoutGroupContext } from '../../../context/SwitchLayoutGroupContext.mjs';\n\n/**\n * Track whether we've taken any snapshots yet. If not,\n * we can safely skip notification of didUpdate.\n *\n * Difficult to capture in a test but to prevent flickering\n * we must set this to true either on update or unmount.\n * Running `next-env/layout-id` in Safari will show this behaviour if broken.\n */\nlet hasTakenAnySnapshot = false;\nclass MeasureLayoutWithContext extends Component {\n /**\n * This only mounts projection nodes for components that\n * need measuring, we might want to do it for all components\n * in order to incorporate transforms\n */\n componentDidMount() {\n const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;\n const { projection } = visualElement;\n if (projection) {\n if (layoutGroup.group)\n layoutGroup.group.add(projection);\n if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {\n switchLayoutGroup.register(projection);\n }\n if (hasTakenAnySnapshot) {\n projection.root.didUpdate();\n }\n projection.addEventListener(\"animationComplete\", () => {\n this.safeToRemove();\n });\n projection.setOptions({\n ...projection.options,\n layoutDependency: this.props.layoutDependency,\n onExitComplete: () => this.safeToRemove(),\n });\n }\n globalProjectionState.hasEverUpdated = true;\n }\n getSnapshotBeforeUpdate(prevProps) {\n const { layoutDependency, visualElement, drag, isPresent } = this.props;\n const { projection } = visualElement;\n if (!projection)\n return null;\n /**\n * TODO: We use this data in relegate to determine whether to\n * promote a previous element. There's no guarantee its presence data\n * will have updated by this point - if a bug like this arises it will\n * have to be that we markForRelegation and then find a new lead some other way,\n * perhaps in didUpdate\n */\n projection.isPresent = isPresent;\n if (prevProps.layoutDependency !== layoutDependency) {\n projection.setOptions({\n ...projection.options,\n layoutDependency,\n });\n }\n hasTakenAnySnapshot = true;\n if (drag ||\n prevProps.layoutDependency !== layoutDependency ||\n layoutDependency === undefined ||\n prevProps.isPresent !== isPresent) {\n projection.willUpdate();\n }\n else {\n this.safeToRemove();\n }\n if (prevProps.isPresent !== isPresent) {\n if (isPresent) {\n projection.promote();\n }\n else if (!projection.relegate()) {\n /**\n * If there's another stack member taking over from this one,\n * it's in charge of the exit animation and therefore should\n * be in charge of the safe to remove. Otherwise we call it here.\n */\n frame.postRender(() => {\n const stack = projection.getStack();\n if (!stack || !stack.members.length) {\n this.safeToRemove();\n }\n });\n }\n }\n return null;\n }\n componentDidUpdate() {\n const { visualElement, layoutAnchor } = this.props;\n const { projection } = visualElement;\n if (projection) {\n projection.options.layoutAnchor = layoutAnchor;\n projection.root.didUpdate();\n microtask.postRender(() => {\n if (!projection.currentAnimation && projection.isLead()) {\n this.safeToRemove();\n }\n });\n }\n }\n componentWillUnmount() {\n const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;\n const { projection } = visualElement;\n hasTakenAnySnapshot = true;\n if (projection) {\n projection.scheduleCheckAfterUnmount();\n if (layoutGroup && layoutGroup.group)\n layoutGroup.group.remove(projection);\n if (promoteContext && promoteContext.deregister)\n promoteContext.deregister(projection);\n }\n }\n safeToRemove() {\n const { safeToRemove } = this.props;\n safeToRemove && safeToRemove();\n }\n render() {\n return null;\n }\n}\nfunction MeasureLayout(props) {\n const [isPresent, safeToRemove] = usePresence();\n const layoutGroup = useContext(LayoutGroupContext);\n return (jsx(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove }));\n}\n\nexport { MeasureLayout };\n//# sourceMappingURL=MeasureLayout.mjs.map\n","import { DragGesture } from '../../gestures/drag/index.mjs';\nimport { PanGesture } from '../../gestures/pan/index.mjs';\nimport { MeasureLayout } from './layout/MeasureLayout.mjs';\nimport { HTMLProjectionNode } from 'motion-dom';\n\nconst drag = {\n pan: {\n Feature: PanGesture,\n },\n drag: {\n Feature: DragGesture,\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n};\n\nexport { drag };\n//# sourceMappingURL=drag.mjs.map\n","import { Feature, hover, frame } from 'motion-dom';\nimport { extractEventInfo } from '../events/event-info.mjs';\n\nfunction handleHoverEvent(node, event, lifecycle) {\n const { props } = node;\n if (node.animationState && props.whileHover) {\n node.animationState.setActive(\"whileHover\", lifecycle === \"Start\");\n }\n const eventName = (\"onHover\" + lifecycle);\n const callback = props[eventName];\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)));\n }\n}\nclass HoverGesture extends Feature {\n mount() {\n const { current } = this.node;\n if (!current)\n return;\n this.unmount = hover(current, (_element, startEvent) => {\n handleHoverEvent(this.node, startEvent, \"Start\");\n return (endEvent) => handleHoverEvent(this.node, endEvent, \"End\");\n });\n }\n unmount() { }\n}\n\nexport { HoverGesture };\n//# sourceMappingURL=hover.mjs.map\n","import { Feature, addDomEvent } from 'motion-dom';\nimport { pipe } from 'motion-utils';\n\nclass FocusGesture extends Feature {\n constructor() {\n super(...arguments);\n this.isActive = false;\n }\n onFocus() {\n let isFocusVisible = false;\n /**\n * If this element doesn't match focus-visible then don't\n * apply whileHover. But, if matches throws that focus-visible\n * is not a valid selector then in that browser outline styles will be applied\n * to the element by default and we want to match that behaviour with whileFocus.\n */\n try {\n isFocusVisible = this.node.current.matches(\":focus-visible\");\n }\n catch (e) {\n isFocusVisible = true;\n }\n if (!isFocusVisible || !this.node.animationState)\n return;\n this.node.animationState.setActive(\"whileFocus\", true);\n this.isActive = true;\n }\n onBlur() {\n if (!this.isActive || !this.node.animationState)\n return;\n this.node.animationState.setActive(\"whileFocus\", false);\n this.isActive = false;\n }\n mount() {\n this.unmount = pipe(addDomEvent(this.node.current, \"focus\", () => this.onFocus()), addDomEvent(this.node.current, \"blur\", () => this.onBlur()));\n }\n unmount() { }\n}\n\nexport { FocusGesture };\n//# sourceMappingURL=focus.mjs.map\n","import { Feature, press, frame } from 'motion-dom';\nimport { extractEventInfo } from '../events/event-info.mjs';\n\nfunction handlePressEvent(node, event, lifecycle) {\n const { props } = node;\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return;\n }\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\");\n }\n const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle));\n const callback = props[eventName];\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)));\n }\n}\nclass PressGesture extends Feature {\n mount() {\n const { current } = this.node;\n if (!current)\n return;\n const { globalTapTarget, propagate } = this.node.props;\n this.unmount = press(current, (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\");\n return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? \"End\" : \"Cancel\");\n }, {\n useGlobalTarget: globalTapTarget,\n stopPropagation: propagate?.tap === false,\n });\n }\n unmount() { }\n}\n\nexport { PressGesture };\n//# sourceMappingURL=press.mjs.map\n","/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap();\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap();\nconst fireObserverCallback = (entry) => {\n const callback = observerCallbacks.get(entry.target);\n callback && callback(entry);\n};\nconst fireAllObserverCallbacks = (entries) => {\n entries.forEach(fireObserverCallback);\n};\nfunction initIntersectionObserver({ root, ...options }) {\n const lookupRoot = root || document;\n /**\n * If we don't have an observer lookup map for this root, create one.\n */\n if (!observers.has(lookupRoot)) {\n observers.set(lookupRoot, {});\n }\n const rootObservers = observers.get(lookupRoot);\n const key = JSON.stringify(options);\n /**\n * If we don't have an observer for this combination of root and settings,\n * create one.\n */\n if (!rootObservers[key]) {\n rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options });\n }\n return rootObservers[key];\n}\nfunction observeIntersection(element, options, callback) {\n const rootInteresectionObserver = initIntersectionObserver(options);\n observerCallbacks.set(element, callback);\n rootInteresectionObserver.observe(element);\n return () => {\n observerCallbacks.delete(element);\n rootInteresectionObserver.unobserve(element);\n };\n}\n\nexport { observeIntersection };\n//# sourceMappingURL=observers.mjs.map\n","import { Feature } from 'motion-dom';\nimport { observeIntersection } from './observers.mjs';\n\nconst thresholdNames = {\n some: 0,\n all: 1,\n};\nclass InViewFeature extends Feature {\n constructor() {\n super(...arguments);\n this.hasEnteredView = false;\n this.isInView = false;\n }\n startObserver() {\n this.stopObserver?.();\n const { viewport = {} } = this.node.getProps();\n const { root, margin: rootMargin, amount = \"some\", once } = viewport;\n const options = {\n root: root ? root.current : undefined,\n rootMargin,\n threshold: typeof amount === \"number\" ? amount : thresholdNames[amount],\n };\n const onIntersectionUpdate = (entry) => {\n const { isIntersecting } = entry;\n /**\n * If there's been no change in the viewport state, early return.\n */\n if (this.isInView === isIntersecting)\n return;\n this.isInView = isIntersecting;\n /**\n * Handle hasEnteredView. If this is only meant to run once, and\n * element isn't visible, early return. Otherwise set hasEnteredView to true.\n */\n if (once && !isIntersecting && this.hasEnteredView) {\n return;\n }\n else if (isIntersecting) {\n this.hasEnteredView = true;\n }\n if (this.node.animationState) {\n this.node.animationState.setActive(\"whileInView\", isIntersecting);\n }\n /**\n * Use the latest committed props rather than the ones in scope\n * when this observer is created\n */\n const { onViewportEnter, onViewportLeave } = this.node.getProps();\n const callback = isIntersecting ? onViewportEnter : onViewportLeave;\n callback && callback(entry);\n };\n this.stopObserver = observeIntersection(this.node.current, options, onIntersectionUpdate);\n }\n mount() {\n this.startObserver();\n }\n update() {\n if (typeof IntersectionObserver === \"undefined\")\n return;\n const { props, prevProps } = this.node;\n const hasOptionsChanged = [\"amount\", \"margin\", \"root\"].some(hasViewportOptionChanged(props, prevProps));\n if (hasOptionsChanged) {\n this.startObserver();\n }\n }\n unmount() {\n this.stopObserver?.();\n this.hasEnteredView = false;\n this.isInView = false;\n }\n}\nfunction hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {\n return (name) => viewport[name] !== prevViewport[name];\n}\n\nexport { InViewFeature };\n//# sourceMappingURL=index.mjs.map\n","import { HoverGesture } from '../../gestures/hover.mjs';\nimport { FocusGesture } from '../../gestures/focus.mjs';\nimport { PressGesture } from '../../gestures/press.mjs';\nimport { InViewFeature } from './viewport/index.mjs';\n\nconst gestureAnimations = {\n inView: {\n Feature: InViewFeature,\n },\n tap: {\n Feature: PressGesture,\n },\n focus: {\n Feature: FocusGesture,\n },\n hover: {\n Feature: HoverGesture,\n },\n};\n\nexport { gestureAnimations };\n//# sourceMappingURL=gestures.mjs.map\n","import { HTMLProjectionNode } from 'motion-dom';\nimport { MeasureLayout } from './layout/MeasureLayout.mjs';\n\nconst layout = {\n layout: {\n ProjectionNode: HTMLProjectionNode,\n MeasureLayout,\n },\n};\n\nexport { layout };\n//# sourceMappingURL=layout.mjs.map\n","import { animations } from '../../../motion/features/animations.mjs';\nimport { drag } from '../../../motion/features/drag.mjs';\nimport { gestureAnimations } from '../../../motion/features/gestures.mjs';\nimport { layout } from '../../../motion/features/layout.mjs';\n\nconst featureBundle = {\n ...animations,\n ...gestureAnimations,\n ...drag,\n ...layout,\n};\n\nexport { featureBundle };\n//# sourceMappingURL=feature-bundle.mjs.map\n","import { createDomVisualElement } from '../../dom/create-visual-element.mjs';\nimport { createMotionProxy } from '../create-proxy.mjs';\nimport { featureBundle } from './feature-bundle.mjs';\n\nconst motion = /*@__PURE__*/ createMotionProxy(featureBundle, createDomVisualElement);\n\nexport { motion };\n//# sourceMappingURL=proxy.mjs.map\n","\"use client\";\n\nimport React, {\n useState,\n useRef,\n useEffect,\n useId,\n forwardRef,\n useLayoutEffect,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\nexport interface DropdownItem {\n label?: React.ReactNode;\n icon?: React.ReactNode;\n\n onClick?: () => void;\n href?: string;\n\n danger?: boolean;\n disabled?: boolean;\n\n separator?: boolean;\n\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport interface DropdownProps {\n trigger: React.ReactNode;\n items: DropdownItem[];\n\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n align?: \"left\" | \"right\";\n width?: number;\n\n closeOnClick?: boolean;\n\n className?: string;\n menuClassName?: string;\n itemClassName?: string;\n\n /** Applied to the wrapper around the `trigger` node. */\n triggerClassName?: string;\n /** Applied to the inner `role=\"menu\"` list container. */\n menuListClassName?: string;\n /** Applied to each separator row (`item.separator`). */\n separatorClassName?: string;\n /** Applied to an item's leading icon wrapper. */\n itemIconClassName?: string;\n /** Applied to an item's label text. */\n itemLabelClassName?: string;\n\n style?: React.CSSProperties;\n menuStyle?: React.CSSProperties;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🔽 Dropdown */\n/* -------------------------------------------------------------------------- */\n\nexport const Dropdown = forwardRef<HTMLDivElement, DropdownProps>(\n function Dropdown(\n {\n trigger,\n items,\n\n open: controlledOpen,\n onOpenChange,\n\n align = \"right\",\n width = 220,\n closeOnClick = true,\n\n className,\n menuClassName,\n itemClassName,\n\n triggerClassName,\n menuListClassName,\n separatorClassName,\n itemIconClassName,\n itemLabelClassName,\n\n style,\n menuStyle,\n },\n ref,\n ) {\n const [internalOpen, setInternalOpen] = useState(false);\n const [coords, setCoords] = useState({ top: 0, left: 0 });\n\n const [position, setPosition] = useState<\"top\" | \"bottom\">(\"bottom\");\n\n const isControlled = controlledOpen !== undefined;\n\n const open = isControlled ? controlledOpen : internalOpen;\n\n const dropdownRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const menuId = useId();\n\n // Kept in a ref so the listener below can stay subscribed without going\n // stale on onOpenChange, which consumers usually pass as an inline arrow.\n const setOpenRef = useRef((val: boolean) => {\n if (!isControlled) setInternalOpen(val);\n onOpenChange?.(val);\n });\n setOpenRef.current = (val: boolean) => {\n if (!isControlled) setInternalOpen(val);\n onOpenChange?.(val);\n };\n\n const setOpen = (val: boolean) => setOpenRef.current(val);\n\n /* ---------------------------------------------------------------------- */\n /* 🔒 Outside Click */\n /* ---------------------------------------------------------------------- */\n\n useEffect(() => {\n // Gate on `open`. Previously this was mounted for the component's whole\n // life with `[]` deps, so in controlled mode every mousedown anywhere on\n // the page called onOpenChange(false) — and the empty deps froze the\n // first render's handler.\n if (!open) return;\n\n const handleOutside = (e: MouseEvent) => {\n const target = e.target as Node;\n if (\n dropdownRef.current &&\n !dropdownRef.current.contains(target) &&\n !menuRef.current?.contains(target)\n ) {\n setOpenRef.current(false);\n }\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpenRef.current(false);\n };\n\n document.addEventListener(\"mousedown\", handleOutside);\n document.addEventListener(\"keydown\", handleEscape);\n\n return () => {\n document.removeEventListener(\"mousedown\", handleOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n };\n }, [open]);\n\n /* ---------------------------------------------------------------------- */\n /* 📍 Smart Positioning */\n /* ---------------------------------------------------------------------- */\n\n useLayoutEffect(() => {\n if (!open || !dropdownRef.current || !menuRef.current) return;\n\n const updatePosition = () => {\n const triggerRect = dropdownRef.current!.getBoundingClientRect();\n const menuHeight = menuRef.current!.offsetHeight;\n\n const spaceBottom = window.innerHeight - triggerRect.bottom;\n const spaceTop = triggerRect.top;\n\n const shouldOpenTop =\n spaceBottom < menuHeight + 10 && spaceTop > menuHeight;\n\n const top = shouldOpenTop\n ? triggerRect.top - menuHeight - 8\n : triggerRect.bottom + 8;\n\n let left =\n align === \"right\" ? triggerRect.right - width : triggerRect.left;\n\n // prevent overflow horizontally\n const maxLeft = window.innerWidth - width - 8;\n left = Math.max(8, Math.min(left, maxLeft));\n\n setPosition(shouldOpenTop ? \"top\" : \"bottom\");\n setCoords({ top, left });\n };\n\n updatePosition();\n\n window.addEventListener(\"scroll\", updatePosition, true);\n window.addEventListener(\"resize\", updatePosition);\n\n return () => {\n window.removeEventListener(\"scroll\", updatePosition, true);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [open, align, width]);\n\n /* ---------------------------------------------------------------------- */\n /* 🔗 Merge Refs */\n /* ---------------------------------------------------------------------- */\n\n const setRefs = (node: HTMLDivElement | null) => {\n dropdownRef.current = node;\n\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n // Rendered via a portal to document.body (below), not as a child here:\n // `position: fixed` is only viewport-relative when no ancestor has a\n // transform/filter/perspective. A hover-lift card (`hover:-translate-y-*`\n // and similar) around the trigger would otherwise make that card the\n // menu's containing block instead of the viewport, misplacing it while\n // hovered — which looks like \"the dropdown doesn't open.\"\n const menu = (\n <AnimatePresence>\n {open && (\n <motion.div\n ref={menuRef}\n initial={{\n opacity: 0,\n y: position === \"bottom\" ? 8 : -8,\n scale: 0.96,\n }}\n animate={{\n opacity: 1,\n y: 0,\n scale: 1,\n }}\n exit={{\n opacity: 0,\n y: position === \"bottom\" ? 8 : -8,\n scale: 0.96,\n }}\n transition={{\n duration: 0.16,\n ease: \"easeOut\",\n }}\n onClick={(e) => e.stopPropagation()}\n className={clsx(\n \"fixed z-[9999] overflow-hidden rounded-2xl border border-border\",\n \"bg-background shadow-2xl backdrop-blur-xl\",\n \"min-w-[180px]\",\n menuClassName,\n )}\n style={{\n width,\n top: coords.top,\n left: coords.left,\n ...menuStyle,\n }}\n >\n <div\n id={menuId}\n role=\"menu\"\n className={clsx(\"text-sm text-foreground\", menuListClassName)}\n >\n {items.map((item, i) => {\n if (item.separator) {\n return (\n <div\n key={`separator-${i}`}\n role=\"separator\"\n className={clsx(\"my-1 h-px bg-border\", separatorClassName)}\n />\n );\n }\n\n return (\n <button\n // Prefer a stable identity over the array index so\n // reordering or filtering `items` doesn't reuse the wrong\n // DOM node (and its hover/disabled state).\n key={typeof item.label === \"string\" ? item.label : i}\n type=\"button\"\n role=\"menuitem\"\n disabled={item.disabled}\n onClick={() => {\n if (item.disabled) return;\n\n item.onClick?.();\n\n if (closeOnClick) {\n setOpen(false);\n }\n }}\n className={clsx(\n \"flex w-full items-center gap-3 px-4 py-2.5 text-left\",\n \"transition-all duration-150\",\n \"hover:bg-accent\",\n // focus:outline-none with no replacement left keyboard\n // users with no visible focus at all.\n \"focus:outline-none focus-visible:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n item.danger &&\n \"text-destructive hover:bg-destructive/10\",\n item.disabled && \"opacity-50\",\n itemClassName,\n item.className,\n )}\n style={item.style}\n >\n {item.icon && (\n <span className={clsx(\"shrink-0 text-current\", itemIconClassName)}>\n {item.icon}\n </span>\n )}\n\n <span className={clsx(\"truncate\", itemLabelClassName)}>{item.label}</span>\n </button>\n );\n })}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n );\n\n return (\n <>\n <div\n ref={setRefs}\n className={clsx(\"inline-flex\", className)}\n style={style}\n >\n {/* -------------------------------------------------------------- */}\n {/* 🔘 Trigger */}\n {/* -------------------------------------------------------------- */}\n\n <div\n className={clsx(\"flex\", triggerClassName)}\n // A plain <div> is not focusable and has no Enter/Space activation,\n // so give it button semantics and the popup wiring screen readers\n // need. (A real <button> would nest illegally if `trigger` is one.)\n role=\"button\"\n tabIndex={0}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n e.stopPropagation();\n setOpen(!open);\n }\n }}\n onClick={(e) => {\n e.stopPropagation();\n setOpen(!open);\n }}\n >\n {trigger}\n </div>\n </div>\n\n {/* -------------------------------------------------------------- */}\n {/* 📦 Menu — portaled to <body>, see comment above `menu` */}\n {/* -------------------------------------------------------------- */}\n {typeof document !== \"undefined\" && createPortal(menu, document.body)}\n </>\n );\n },\n);\n\nDropdown.displayName = \"Dropdown\";\n","\"use client\";\n\nimport React, {\n ReactNode,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n X,\n Info,\n CheckCircle,\n AlertCircle,\n AlertTriangle,\n Loader2,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type AlertType = \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\";\nexport type ToastVariant = \"soft\" | \"light\" | \"dark\";\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport interface Toast {\n id: string;\n title?: string;\n description?: string;\n type?: AlertType;\n variant?: ToastVariant;\n duration?: number;\n /** Overrides the default type icon (success/error/etc). Pass any node, or `null` to render no icon at all. */\n icon?: ReactNode;\n\n className?: string;\n style?: React.CSSProperties;\n\n titleClassName?: string;\n descriptionClassName?: string;\n iconClassName?: string;\n contentClassName?: string;\n closeButtonClassName?: string;\n}\n\nexport interface ToastContextProps {\n toast: ToastFunction;\n dismiss: (id?: string) => void;\n}\n\nexport type ToastFunction = {\n /** Returns the toast's id, so it can be updated (pass the same `id` back in) or dismissed later. */\n (input: Omit<Toast, \"id\"> | string): string;\n success: (message: string, options?: Partial<Toast>) => string;\n error: (message: string, options?: Partial<Toast>) => string;\n warning: (message: string, options?: Partial<Toast>) => string;\n info: (message: string, options?: Partial<Toast>) => string;\n /** Persists until dismissed or replaced — pair with `.promise()` or dismiss it manually once the async work finishes. */\n loading: (message: string, options?: Partial<Toast>) => string;\n /**\n * Shows a loading toast, then morphs it in place into a success or error\n * toast once `promise` settles — the react-hot-toast async pattern.\n */\n promise: <T>(\n promise: Promise<T>,\n messages: {\n loading: string;\n success: string | ((data: T) => string);\n error: string | ((error: unknown) => string);\n },\n options?: Partial<Toast>,\n ) => Promise<T>;\n dismiss: (id?: string) => void;\n};\n\n/* -------------------------------------------------------------------------- */\n/* 🌍 Global toast store */\n/* */\n/* Toasts are NOT React context state — they live in a module-level store, */\n/* the same architecture react-hot-toast uses. That's what makes `toast()` */\n/* callable from anywhere (event handlers, API clients, utils outside any */\n/* component) instead of only from inside a component that called a hook. */\n/* `<ToastProvider>` just subscribes to this store and renders what's in it. */\n/* -------------------------------------------------------------------------- */\n\ntype Listener = (toasts: Toast[]) => void;\n\nclass ToastStore {\n private toasts: Toast[] = [];\n private listeners = new Set<Listener>();\n private timers = new Map<string, ReturnType<typeof setTimeout>>();\n private counter = 0;\n private maxToasts = 5;\n\n subscribe = (listener: Listener) => {\n this.listeners.add(listener);\n listener(this.toasts);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n setMaxToasts(max: number) {\n this.maxToasts = max;\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener(this.toasts));\n }\n\n private clearTimer(id: string) {\n const handle = this.timers.get(id);\n if (handle) {\n clearTimeout(handle);\n this.timers.delete(id);\n }\n }\n\n dismiss = (id?: string) => {\n if (id) {\n this.clearTimer(id);\n this.toasts = this.toasts.filter((t) => t.id !== id);\n } else {\n this.timers.forEach((handle) => clearTimeout(handle));\n this.timers.clear();\n this.toasts = [];\n }\n this.emit();\n };\n\n create(options: Omit<Toast, \"id\"> & { id?: string }) {\n // A supplied id lets a caller update a toast in place (e.g. loading -> success),\n // matching the same toast's position in the stack instead of appending a new one.\n const id = options.id ?? `toast-${++this.counter}`;\n this.clearTimer(id);\n\n const toastData: Toast = {\n ...options,\n id,\n type: options.type ?? \"info\",\n variant: options.variant ?? \"light\",\n duration: options.duration ?? 4000,\n };\n\n const existingIndex = this.toasts.findIndex((t) => t.id === id);\n if (existingIndex >= 0) {\n const next = [...this.toasts];\n next[existingIndex] = toastData;\n this.toasts = next;\n } else {\n const next = [...this.toasts, toastData];\n // Cap the stack so a loop or a repeated click can't push toasts off-screen indefinitely.\n this.toasts =\n next.length > this.maxToasts ? next.slice(next.length - this.maxToasts) : next;\n }\n\n if (toastData.duration && toastData.duration > 0) {\n this.timers.set(id, setTimeout(() => this.dismiss(id), toastData.duration));\n }\n\n this.emit();\n return id;\n }\n}\n\nconst store = new ToastStore();\n\nconst base = ((input: Omit<Toast, \"id\"> | string) => {\n if (typeof input === \"string\") {\n return store.create({ description: input });\n }\n return store.create(input);\n}) as ToastFunction;\n\nbase.success = (message, options) =>\n store.create({ title: message, type: \"success\", ...options });\n\nbase.error = (message, options) =>\n store.create({ title: message, type: \"error\", ...options });\n\nbase.warning = (message, options) =>\n store.create({ title: message, type: \"warning\", ...options });\n\nbase.info = (message, options) =>\n store.create({ title: message, type: \"info\", ...options });\n\nbase.loading = (message, options) =>\n store.create({ title: message, type: \"loading\", duration: 0, ...options });\n\nbase.dismiss = (id) => store.dismiss(id);\n\nbase.promise = (promise, messages, options) => {\n const id = store.create({\n title: messages.loading,\n type: \"loading\",\n duration: 0,\n ...options,\n });\n\n return promise.then(\n (data) => {\n const resolved =\n typeof messages.success === \"function\" ? messages.success(data) : messages.success;\n store.create({ id, title: resolved, type: \"success\", duration: 4000, ...options });\n return data;\n },\n (error) => {\n const resolved =\n typeof messages.error === \"function\" ? messages.error(error) : messages.error;\n store.create({ id, title: resolved, type: \"error\", duration: 4000, ...options });\n throw error;\n },\n );\n};\n\n/** Standalone toast trigger — import and call from anywhere, no hook or provider lookup required. */\nexport const toast: ToastFunction = base;\n\n/**\n * Kept for consumers who prefer a hook — returns the exact same global\n * `toast`/`dismiss`, so mixing `useToast()` and the standalone `toast` import\n * in the same app is always in sync. No longer throws if called without a\n * mounted `<ToastProvider>` (matches react-hot-toast: toasts just won't be\n * visible until a provider is rendered somewhere in the tree).\n */\nexport const useToast = (): ToastContextProps =>\n useMemo(() => ({ toast, dismiss: store.dismiss }), []);\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** Maximum toasts kept on screen at once. Oldest are dropped first. */\n maxToasts?: number;\n /** Customize the fixed toast viewport that hosts all toasts. */\n containerClassName?: string;\n /** Corner (or edge-center) the toast stack anchors to. */\n position?: ToastPosition;\n}\n\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n \"top-left\": \"top-4 left-4 sm:top-6 sm:left-6 items-start\",\n \"top-center\": \"top-4 left-1/2 -translate-x-1/2 sm:top-6 items-center\",\n \"top-right\": \"top-4 right-4 sm:top-6 sm:right-6 items-end\",\n \"bottom-left\": \"bottom-4 left-4 sm:bottom-6 sm:left-6 items-start\",\n \"bottom-center\": \"bottom-4 left-1/2 -translate-x-1/2 sm:bottom-6 items-center\",\n \"bottom-right\": \"bottom-4 right-4 sm:bottom-6 sm:right-6 items-end\",\n};\n\n/**\n * Renders the toast viewport for the whole app. Mount this ONCE near your\n * root — every `toast()` call (standalone import or `useToast()`) renders\n * into whichever `<ToastProvider>` is mounted, the same way there should\n * only be one `<Toaster />` in a react-hot-toast app.\n */\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n children,\n maxToasts = 5,\n containerClassName,\n position = \"bottom-right\",\n}) => {\n const [toasts, setToasts] = useState<Toast[]>([]);\n\n useEffect(() => {\n store.setMaxToasts(maxToasts);\n }, [maxToasts]);\n\n useEffect(() => store.subscribe(setToasts), []);\n\n return (\n <>\n {children}\n <div\n // The container is the live region, established up-front — role=\"alert\"\n // on a node inserted at the same moment is frequently missed by\n // screen readers.\n role=\"region\"\n aria-label=\"Notifications\"\n aria-live=\"polite\"\n className={cn(\n \"fixed z-60 flex flex-col gap-2\",\n POSITION_CLASSES[position],\n containerClassName,\n )}\n >\n {toasts.map((t) => (\n <ToastItem key={t.id} toast={t} onClose={() => store.dismiss(t.id)} />\n ))}\n </div>\n </>\n );\n};\n\n/*\n * All colors come from the theme's status tokens (--success / --destructive /\n * --warning / --info + their foregrounds), so toasts follow whatever palette\n * the consumer defines — in BOTH modes, with no dark: overrides needed: the\n * token values themselves change when .dark is active.\n *\n * light → the default: a clean neutral card (like react-hot-toast) — only\n * the icon carries the status color, title/description stay neutral\n * soft → tinted translucent surface, for when the whole toast should read\n * as \"this status\" at a glance\n * dark → solid status surface, for high-emphasis alerts\n */\nconst variantStyles = {\n light: {\n success: { bg: \"bg-popover\", border: \"border-border\", text: \"text-popover-foreground\", icon: \"text-success\" },\n error: { bg: \"bg-popover\", border: \"border-border\", text: \"text-popover-foreground\", icon: \"text-destructive\" },\n warning: { bg: \"bg-popover\", border: \"border-border\", text: \"text-popover-foreground\", icon: \"text-warning\" },\n info: { bg: \"bg-popover\", border: \"border-border\", text: \"text-popover-foreground\", icon: \"text-info\" },\n loading: { bg: \"bg-popover\", border: \"border-border\", text: \"text-popover-foreground\", icon: \"text-muted-foreground\" },\n },\n\n soft: {\n success: { bg: \"bg-success/10\", border: \"border-success/30\", text: \"text-success\", icon: \"text-success\" },\n error: { bg: \"bg-destructive/10\", border: \"border-destructive/30\", text: \"text-destructive\", icon: \"text-destructive\" },\n warning: { bg: \"bg-warning/10\", border: \"border-warning/30\", text: \"text-warning\", icon: \"text-warning\" },\n info: { bg: \"bg-info/10\", border: \"border-info/30\", text: \"text-info\", icon: \"text-info\" },\n loading: { bg: \"bg-muted\", border: \"border-border\", text: \"text-foreground\", icon: \"text-muted-foreground\" },\n },\n\n dark: {\n success: { bg: \"bg-success text-success-foreground\", border: \"border-success\", text: \"text-success-foreground\", icon: \"text-success-foreground\" },\n error: { bg: \"bg-destructive text-destructive-foreground\", border: \"border-destructive\", text: \"text-destructive-foreground\", icon: \"text-destructive-foreground\" },\n warning: { bg: \"bg-warning text-warning-foreground\", border: \"border-warning\", text: \"text-warning-foreground\", icon: \"text-warning-foreground\" },\n info: { bg: \"bg-info text-info-foreground\", border: \"border-info\", text: \"text-info-foreground\", icon: \"text-info-foreground\" },\n loading: { bg: \"bg-muted text-foreground\", border: \"border-border\", text: \"text-foreground\", icon: \"text-muted-foreground\" },\n },\n};\n\nconst IconMap = {\n success: CheckCircle,\n error: AlertCircle,\n warning: AlertTriangle,\n info: Info,\n loading: Loader2,\n};\n\nconst ToastItem: React.FC<{ toast: Toast; onClose: () => void }> = ({\n toast: t,\n onClose,\n}) => {\n const {\n title,\n description,\n type = \"info\",\n variant = \"light\",\n icon,\n className,\n style,\n titleClassName,\n descriptionClassName,\n iconClassName,\n contentClassName,\n closeButtonClassName,\n } = t;\n\n // Guard the double lookup — an unexpected variant/type used to throw\n // \"Cannot read properties of undefined\" and take down the provider subtree.\n const config = variantStyles[variant]?.[type] ?? variantStyles.light.info;\n\n const DefaultIcon = IconMap[type] ?? Info;\n\n return (\n <div\n className={cn(\n \"group relative flex w-full sm:min-w-[200px] sm:max-w-sm md:max-w-md lg:max-w-lg items-start gap-2 rounded-xl\",\n \"border p-4 pr-10\",\n config.border,\n config.bg,\n \"shadow-md dark:shadow-black/40\",\n \"transition-shadow duration-300 ease-out\",\n // Only one animation-name class — `fade-in` and\n // `slide-in-from-right-full` have the same specificity, so the later\n // one in the stylesheet won and the slide never played.\n \"animate-in slide-in-from-right-full\",\n // hover:scale on a stacked flex column made toasts overlap their\n // neighbours; a shadow change reads as interactive without reflowing.\n \"hover:shadow-lg\",\n className,\n )}\n style={style}\n // Errors interrupt; everything else waits for a pause.\n role={type === \"error\" ? \"alert\" : \"status\"}\n >\n {icon !== undefined ? (\n icon !== null && (\n <span\n aria-hidden=\"true\"\n className={cn(\"inline-flex h-5 w-5 shrink-0 items-center justify-center\", config.icon, iconClassName)}\n >\n {icon}\n </span>\n )\n ) : (\n <DefaultIcon\n aria-hidden=\"true\"\n className={cn(\"h-5 w-5 shrink-0\", config.icon, type === \"loading\" && \"animate-spin\", iconClassName)}\n />\n )}\n\n <div className={cn(\"flex-1\", contentClassName)}>\n {title && (\n <div className={cn(\"text-sm font-medium\", config.text, titleClassName)}>\n {title}\n </div>\n )}\n\n {description && (\n <div\n className={cn(\n \"text-sm text-muted-foreground\",\n descriptionClassName,\n )}\n >\n {description}\n </div>\n )}\n </div>\n\n {/* The container already reserved pr-10 for this button, but it was\n never rendered — leaving a dead gutter and no way to dismiss by\n pointer. */}\n <button\n type=\"button\"\n aria-label=\"Dismiss notification\"\n onClick={onClose}\n className={cn(\n // text-current: inherits the toast's own text color, so the button\n // stays readable on soft, card and solid status surfaces alike.\n \"absolute right-2 top-2 rounded-md p-1.5 transition-opacity\",\n \"text-current opacity-60 hover:opacity-100\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n closeButtonClassName,\n )}\n >\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n </div>\n );\n};\n\nexport default ToastItem;\n","\"use client\";\n\nimport React, { useState, useId, memo, ReactNode, CSSProperties } from \"react\";\nimport clsx from \"clsx\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\n/* ---------------- Types ---------------- */\nexport interface AccordionItem {\n title: string | ReactNode;\n content: ReactNode;\n}\n\nexport interface AccordionProps {\n items: AccordionItem[];\n\n allowMultiple?: boolean;\n defaultOpen?: number[];\n\n /* Root */\n className?: string;\n style?: CSSProperties;\n\n /* Item */\n itemClassName?: string;\n itemStyle?: CSSProperties;\n\n /* Header */\n headerClassName?: string;\n headerStyle?: CSSProperties;\n\n /* Title */\n titleClassName?: string;\n titleStyle?: CSSProperties;\n\n /* Icon */\n iconClassName?: string;\n iconStyle?: CSSProperties;\n\n /* Content wrapper */\n contentWrapperClassName?: string;\n contentWrapperStyle?: CSSProperties;\n\n /* Content */\n contentClassName?: string;\n contentStyle?: CSSProperties;\n\n /* Hover (optional override) */\n hoverClassName?: string;\n hoverStyle?: CSSProperties;\n\n /* Defaults (fallback design system) */\n borderColor?: string;\n radius?: string | number;\n shadow?: string;\n\n /* Motion */\n duration?: number;\n\n /* Icon */\n iconOpen?: ReactNode;\n iconClose?: ReactNode;\n\n /* Render override */\n renderItem?: (params: {\n item: AccordionItem;\n index: number;\n open: boolean;\n toggle: () => void;\n }) => ReactNode;\n}\n\n/* ---------------- Component ---------------- */\nexport const Accordion: React.FC<AccordionProps> = memo(\n ({\n items,\n allowMultiple = false,\n defaultOpen = [],\n\n className,\n style,\n\n itemClassName,\n itemStyle,\n\n headerClassName,\n headerStyle,\n\n titleClassName,\n titleStyle,\n\n iconClassName,\n iconStyle,\n\n contentWrapperClassName,\n contentWrapperStyle,\n\n contentClassName,\n contentStyle,\n\n hoverClassName,\n hoverStyle,\n\n borderColor = \"var(--border)\",\n radius = \"0.5rem\",\n shadow = \"none\",\n\n duration = 300,\n\n iconOpen,\n iconClose,\n\n renderItem,\n }) => {\n const [openIndexes, setOpenIndexes] = useState<number[]>(defaultOpen);\n const accordionId = useId();\n\n const toggle = (i: number) => {\n setOpenIndexes((prev) =>\n allowMultiple\n ? prev.includes(i)\n ? prev.filter((x) => x !== i)\n : [...prev, i]\n : prev.includes(i)\n ? []\n : [i],\n );\n };\n\n return (\n <div\n className={clsx(className, \"w-full space-y-2 text-foreground\")}\n style={style}\n >\n {items.map((item, index) => {\n const open = openIndexes.includes(index);\n\n if (renderItem) {\n return (\n <React.Fragment key={index}>\n {renderItem({\n item,\n index,\n open,\n toggle: () => toggle(index),\n })}\n </React.Fragment>\n );\n }\n\n return (\n <div\n key={index}\n className={clsx(\n itemClassName,\n \"overflow-hidden transition-all bg-accent text-foreground\",\n \"rounded-md\",\n )}\n style={{\n ...itemStyle,\n }}\n >\n {/* Header */}\n <button\n type=\"button\"\n id={`${accordionId}-trigger-${index}`}\n aria-expanded={open}\n aria-controls={`${accordionId}-panel-${index}`}\n onClick={() => toggle(index)}\n className={cn(\n \"w-full flex items-center justify-between\",\n \"px-4 py-3.5 text-left transition-colors\",\n // The item wrapper is already bg-accent, so hover:bg-accent\n // was a guaranteed no-op — there was no hover feedback at all.\n \"hover:bg-accent-foreground/5\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n headerClassName,\n // hoverClassName is merged last so it can actually win, but\n // note it applies at rest too — see the note on hoverStyle.\n hoverClassName,\n )}\n style={{\n // hoverStyle is an inline style and so cannot express :hover;\n // it has always applied unconditionally. Kept for\n // compatibility, but prefer hoverClassName.\n ...headerStyle,\n ...hoverStyle,\n }}\n >\n <span\n className={cn(\"text-sm text-foreground\", titleClassName)}\n style={titleStyle}\n >\n {item.title}\n </span>\n\n <span\n aria-hidden=\"true\"\n className={cn(\"text-muted-foreground\", iconClassName)}\n style={iconStyle}\n >\n {open\n ? iconOpen || <ChevronUp size={18} />\n : iconClose || <ChevronDown size={18} />}\n </span>\n </button>\n\n {/* Content Wrapper.\n Uses a grid-rows 0fr→1fr transition instead of measuring\n scrollHeight. The old approach had two sources of truth (an\n effect writing el.style.maxHeight and a render reading the ref)\n which fought each other: defaultOpen items rendered collapsed,\n and any unrelated re-render snapped open panels shut. */}\n <div\n id={`${accordionId}-panel-${index}`}\n role=\"region\"\n aria-labelledby={`${accordionId}-trigger-${index}`}\n className={cn(\n \"grid overflow-hidden\",\n open ? \"grid-rows-[1fr]\" : \"grid-rows-[0fr]\",\n contentWrapperClassName,\n )}\n style={{\n transition: `grid-template-rows ${duration}ms ease`,\n ...contentWrapperStyle,\n }}\n >\n {/* min-h-0 lets the grid row actually collapse to 0fr. */}\n <div className=\"min-h-0 overflow-hidden\">\n {/* Content — `inert` while collapsed so its links and buttons\n don't stay in the tab order behind a 0-height box. */}\n <div\n inert={!open ? true : undefined}\n className={cn(\n \"px-4 py-3.5 text-sm border-t border-border text-accent-foreground bg-background\",\n contentClassName,\n )}\n style={contentStyle}\n >\n {item.content}\n </div>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nAccordion.displayName = \"Accordion\";\n","\"use client\";\n\nimport React, { useState, useId, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { cn } from \"../../lib/cn\";\n\n/* =========================\n Types\n========================= */\nexport interface Option {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nexport interface CheckboxGroupProps {\n mode?: \"single\" | \"group\";\n\n name?: string;\n\n /* ---------- GROUP MODE ---------- */\n options?: Option[];\n selectedValues?: string[];\n onChange?: (values: string[]) => void;\n\n /* ---------- SINGLE MODE ---------- */\n label?: string;\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n error?: string;\n\n /* ---------- Styling ---------- */\n className?: string;\n containerClassName?: string;\n itemClassName?: string;\n labelClassName?: string;\n textClassName?: string;\n iconClassName?: string;\n checkClassName?: string;\n errorClassName?: string;\n\n style?: React.CSSProperties;\n containerStyle?: React.CSSProperties;\n itemStyle?: React.CSSProperties;\n labelStyle?: React.CSSProperties;\n textStyle?: React.CSSProperties;\n iconStyle?: React.CSSProperties;\n errorStyle?: React.CSSProperties;\n\n /* ---------- Icon ---------- */\n customIcon?: (checked: boolean, option?: Option) => React.ReactNode;\n iconSize?: number;\n\n /* ---------- Advanced ---------- */\n renderItem?: (params: {\n option?: Option;\n checked: boolean;\n focused: boolean;\n toggle: () => void;\n }) => React.ReactNode;\n}\n\n/* =========================\n Component\n========================= */\nexport const Checkbox: React.FC<CheckboxGroupProps> = ({\n mode = \"single\",\n\n name,\n\n options = [],\n selectedValues = [],\n onChange,\n\n label,\n checked = false,\n onCheckedChange,\n\n disabled = false,\n readOnly = false,\n required = false,\n error,\n\n className,\n containerClassName,\n itemClassName,\n labelClassName,\n textClassName,\n iconClassName,\n checkClassName,\n errorClassName,\n\n style,\n containerStyle,\n itemStyle,\n labelStyle,\n textStyle,\n iconStyle,\n errorStyle,\n\n customIcon,\n iconSize = 20,\n\n renderItem,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n\n const generatedId = useId();\n const errorId = error ? `${generatedId}-error` : undefined;\n\n /* =========================\n Handlers\n ========================= */\n const handleGroupChange = (value: string) => {\n if (!onChange || disabled || readOnly) return;\n // The click path runs through the <label>, so a per-option `disabled` has\n // to be re-checked here — the input's own `disabled` attribute alone let\n // disabled options stay toggleable.\n if (options.find((o) => o.value === value)?.disabled) return;\n\n const updated = selectedValues.includes(value)\n ? selectedValues.filter((v) => v !== value)\n : [...selectedValues, value];\n\n onChange(updated);\n };\n\n const handleSingleChange = () => {\n if (!onCheckedChange || disabled || readOnly) return;\n onCheckedChange(!checked);\n };\n\n /*\n * The old group keyboard handler lived here. It was unreachable: it bailed on\n * `focusedIndex === null`, and the only thing that set focusedIndex was\n * onFocus on a <label> whose input was display:none — so nothing was ever\n * focusable. Now that each input is `sr-only` rather than `hidden`, Tab and\n * Space work natively, which is the expected behavior for a checkbox group\n * (unlike radios, checkboxes are not arrow-navigable by spec).\n */\n\n /* =========================\n Default Icon\n ========================= */\n const DefaultIcon = (isChecked: boolean) => (\n <span\n className={cn(\n \"inline-flex items-center justify-center rounded border transition-colors shrink-0\",\n isChecked\n ? \"border-primary bg-primary\"\n : \"border-border bg-transparent\",\n // The real input is sr-only, so the focus ring has to be rendered here.\n \"peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background\",\n iconClassName,\n )}\n style={{\n width: iconSize,\n height: iconSize,\n ...iconStyle,\n }}\n >\n {isChecked && (\n <svg\n viewBox=\"0 0 24 24\"\n // Pairs with bg-primary, so a light --primary keeps a readable tick.\n className={cn(\"text-primary-foreground\", checkClassName)}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n style={{ width: iconSize * 0.6, height: iconSize * 0.6 }}\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n )}\n </span>\n );\n\n /* =========================\n Render Single\n ========================= */\n if (mode === \"single\") {\n const toggle = handleSingleChange;\n\n if (renderItem) {\n return (\n <div className={className} style={style}>\n {renderItem({\n checked,\n focused: false,\n toggle,\n })}\n </div>\n );\n }\n\n return (\n <div className={className} style={style}>\n <label\n className={cn(\n \"flex items-center justify-between\",\n disabled ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\",\n itemClassName,\n labelClassName,\n )}\n style={{ ...itemStyle, ...labelStyle }}\n >\n <span\n className={cn(\"text-sm text-foreground\", textClassName)}\n style={textStyle}\n >\n {label}\n </span>\n\n <input\n type=\"checkbox\"\n // `hidden` (display:none) took this out of the tab order and the\n // a11y tree, and made `required` block form submission. `sr-only`\n // + `peer` keeps it invisible but focusable and announced.\n className=\"sr-only peer\"\n name={name}\n checked={checked}\n disabled={disabled || readOnly}\n required={required}\n aria-invalid={error ? true : undefined}\n aria-describedby={errorId}\n onChange={toggle}\n />\n\n {customIcon ? customIcon(checked) : DefaultIcon(checked)}\n </label>\n\n {error && (\n <p\n id={errorId}\n role=\"alert\"\n className={cn(\"text-sm text-destructive mt-1\", errorClassName)}\n style={errorStyle}\n >\n {error}\n </p>\n )}\n </div>\n );\n }\n\n /* =========================\n Render Group\n ========================= */\n return (\n <div\n ref={containerRef}\n role=\"group\"\n aria-invalid={error ? true : undefined}\n aria-describedby={errorId}\n className={cn(\"flex flex-col gap-2\", containerClassName || className)}\n style={containerStyle || style}\n >\n {options.map((option, index) => {\n const isChecked = selectedValues.includes(option.value);\n const focused = focusedIndex === index;\n\n const toggle = () => handleGroupChange(option.value);\n\n if (renderItem) {\n return (\n <React.Fragment key={option.value}>\n {renderItem({\n option,\n checked: isChecked,\n focused,\n toggle,\n })}\n </React.Fragment>\n );\n }\n\n const itemDisabled = disabled || option.disabled;\n\n return (\n <label\n key={option.value}\n onFocus={() => setFocusedIndex(index)}\n className={cn(\n \"flex items-center justify-between\",\n itemDisabled\n ? \"opacity-50 cursor-not-allowed\"\n : \"cursor-pointer\",\n itemClassName,\n labelClassName,\n )}\n style={{ ...itemStyle, ...labelStyle }}\n >\n <span\n className={cn(\"text-sm text-foreground\", textClassName)}\n style={textStyle}\n >\n {option.label}\n </span>\n\n <input\n type=\"checkbox\"\n className=\"sr-only peer\"\n name={name}\n value={option.value}\n checked={isChecked}\n disabled={itemDisabled || readOnly}\n onChange={toggle}\n />\n\n {customIcon\n ? customIcon(isChecked, option)\n : DefaultIcon(isChecked)}\n </label>\n );\n })}\n\n {error && (\n <p\n id={errorId}\n role=\"alert\"\n className={cn(\"text-sm text-destructive mt-1\", errorClassName)}\n style={errorStyle}\n >\n {error}\n </p>\n )}\n </div>\n );\n};","\"use client\";\n\nimport React, { useState, useId, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { motion, AnimatePresence } from \"framer-motion\";\nimport { cn } from \"../../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\nexport interface Option {\n label: string;\n value: string;\n description?: string;\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps {\n name?: string;\n options: Option[];\n selectedValue?: string;\n onChange?: (value: string) => void;\n\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n error?: string;\n\n /** 🎨 Root Container */\n className?: string;\n style?: React.CSSProperties;\n\n /** 🎨 Item Container */\n itemClassName?: string;\n itemStyle?: React.CSSProperties;\n\n /** 🎨 Label Text */\n labelClassName?: string;\n labelStyle?: React.CSSProperties;\n\n /** 🎨 Description Text */\n descriptionClassName?: string;\n descriptionStyle?: React.CSSProperties;\n\n /** 🎨 Icon Wrapper */\n iconWrapperClassName?: string;\n iconWrapperStyle?: React.CSSProperties;\n\n /** 🎨 Radio Indicator */\n indicatorClassName?: string;\n indicatorStyle?: React.CSSProperties;\n\n /** 🎨 Inner Dot */\n dotClassName?: string;\n dotStyle?: React.CSSProperties;\n\n /** 🎨 Error Message */\n errorClassName?: string;\n errorStyle?: React.CSSProperties;\n\n /** ⚙️ Configuration */\n size?: \"sm\" | \"md\" | \"lg\";\n orientation?: \"vertical\" | \"horizontal\";\n\n animationDuration?: number;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🔘 RadioGroup */\n/* -------------------------------------------------------------------------- */\n\nexport const RadioGroup: React.FC<RadioGroupProps> = ({\n name,\n options,\n selectedValue,\n onChange,\n\n disabled = false,\n readOnly = false,\n required = false,\n error,\n\n className,\n style,\n\n itemClassName,\n itemStyle,\n\n labelClassName,\n labelStyle,\n\n descriptionClassName,\n descriptionStyle,\n\n iconWrapperClassName,\n iconWrapperStyle,\n\n indicatorClassName,\n indicatorStyle,\n\n dotClassName,\n dotStyle,\n\n errorClassName,\n errorStyle,\n\n size = \"md\",\n orientation = \"vertical\",\n\n animationDuration = 0.2,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n\n /* 📏 Size configurations */\n const sizeConfig = {\n sm: {\n item: \"px-3 py-2\",\n indicator: \"w-4 h-4\",\n dot: \"w-2 h-2\",\n text: \"text-xs\",\n desc: \"text-xs\",\n icon: \"w-3.5 h-3.5\",\n outerGap: \"gap-3\",\n innerGap: \"gap-2\",\n },\n md: {\n item: \"px-4 py-3\",\n indicator: \"w-5 h-5\",\n dot: \"w-2.5 h-2.5\",\n text: \"text-sm\",\n desc: \"text-xs\",\n icon: \"w-4 h-4\",\n outerGap: \"gap-4\",\n innerGap: \"gap-3\",\n },\n lg: {\n item: \"px-5 py-4\",\n indicator: \"w-6 h-6\",\n dot: \"w-3 h-3\",\n text: \"text-base\",\n desc: \"text-sm\",\n icon: \"w-5 h-5\",\n outerGap: \"gap-4\",\n innerGap: \"gap-3\",\n },\n } as const;\n\n const currentSize = sizeConfig[size];\n\n const generatedId = useId();\n const groupName = name ?? generatedId;\n const errorId = error ? `${generatedId}-error` : undefined;\n\n /*\n * Keyboard navigation is intentionally NOT hand-rolled. Now that the radios\n * are real focusable inputs sharing a `name`, the browser gives us arrow-key\n * roving, disabled-option skipping and a single tab stop for free. The old\n * hand-rolled handler ran off a `focusedIndex` that could never change (its\n * only setter was onFocus on a non-focusable <label>), and would now\n * double-fire against the native behavior.\n */\n\n return (\n <div\n ref={containerRef}\n role=\"radiogroup\"\n aria-required={required}\n aria-invalid={!!error}\n aria-describedby={errorId}\n className={cn(\n \"outline-none\",\n orientation === \"vertical\"\n ? \"flex flex-col gap-2\"\n : \"flex flex-row gap-2 flex-wrap\",\n className,\n )}\n style={style}\n >\n {options.map((option, i) => {\n const checked = selectedValue === option.value;\n const itemDisabled = disabled || option.disabled;\n\n const handleSelect = () => {\n if (itemDisabled || readOnly) return;\n onChange?.(option.value);\n setFocusedIndex(i);\n };\n\n return (\n <label\n key={option.value}\n className={cn(\n \"relative flex items-center justify-between rounded-xl border transition-all\",\n currentSize.outerGap,\n currentSize.item,\n \"bg-background border-border\",\n // Checked comes after hover so the selected tint isn't lost while\n // the pointer is over the item.\n !itemDisabled && \"hover:bg-accent/60 cursor-pointer\",\n checked && \"border-primary bg-primary/5\",\n itemDisabled && \"opacity-50 cursor-not-allowed\",\n \"has-focus-visible:ring-2 has-focus-visible:ring-ring has-focus-visible:ring-offset-2 has-focus-visible:ring-offset-background\",\n itemClassName,\n )}\n style={itemStyle}\n >\n {/* Left Content */}\n <div\n className={cn(\n \"flex items-center min-w-0 flex-1\",\n currentSize.innerGap,\n )}\n >\n {option.icon && (\n <div\n className={cn(\n \"text-muted-foreground shrink-0 [&_svg]:w-full [&_svg]:h-full\",\n currentSize.icon,\n iconWrapperClassName,\n )}\n style={iconWrapperStyle}\n >\n {option.icon}\n </div>\n )}\n\n <div className=\"min-w-0 flex-1\">\n <p\n className={clsx(\n labelClassName,\n \"font-medium text-foreground truncate\",\n currentSize.text,\n )}\n style={labelStyle}\n >\n {option.label}\n </p>\n\n {option.description && (\n <p\n className={clsx(\n descriptionClassName,\n \"text-muted-foreground truncate\",\n currentSize.desc,\n )}\n style={descriptionStyle}\n >\n {option.description}\n </p>\n )}\n </div>\n </div>\n\n {/* Hidden input for form compatibility */}\n <input\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={checked}\n onChange={handleSelect}\n disabled={itemDisabled}\n readOnly={readOnly}\n required={required && i === 0} // Only first radio needs required\n // `hidden`/`display:none` removed the control from the tab order\n // AND the accessibility tree, and made `required` block form\n // submission (\"invalid form control is not focusable\").\n // sr-only keeps it invisible but real.\n className=\"sr-only\"\n aria-describedby={errorId}\n />\n\n {/* Radio Indicator */}\n <div\n className={clsx(\n indicatorClassName,\n \"relative flex items-center justify-center rounded-full border transition-all shrink-0\",\n currentSize.indicator,\n checked\n ? \"border-primary bg-primary\"\n : \"border-muted-foreground/40\",\n )}\n style={indicatorStyle}\n >\n <AnimatePresence>\n {checked && (\n <motion.div\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n exit={{ scale: 0 }}\n transition={{ duration: animationDuration }}\n className={clsx(\n dotClassName,\n \"rounded-full bg-background\",\n currentSize.dot,\n )}\n style={dotStyle}\n />\n )}\n </AnimatePresence>\n </div>\n </label>\n );\n })}\n\n {/* Error Message */}\n {error && (\n <motion.p\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n className={clsx(\n errorClassName,\n \"text-destructive mt-1\",\n currentSize.desc,\n )}\n style={errorStyle}\n id={errorId}\n >\n {error}\n </motion.p>\n )}\n </div>\n );\n};\n","\"use client\";\nimport React, { useState, useId, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface Option {\n label: string;\n value: string;\n}\n\nexport interface SwitchGroupProps {\n mode?: \"single\" | \"group\";\n name?: string;\n // For group mode\n options?: Option[];\n selectedValues?: string[];\n onChange?: (values: string[]) => void;\n // For single mode\n label?: string;\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n error?: string;\n\n /** 🎨 Customization */\n className?: string;\n itemClassName?: string;\n labelClassName?: string;\n textClassName?: string;\n switchClassName?: string;\n thumbClassName?: string;\n errorClassName?: string;\n\n style?: React.CSSProperties;\n itemStyle?: React.CSSProperties;\n labelStyle?: React.CSSProperties;\n textStyle?: React.CSSProperties;\n switchStyle?: React.CSSProperties;\n thumbStyle?: React.CSSProperties;\n errorStyle?: React.CSSProperties;\n\n /** ⚙️ Config */\n iconSize?: number;\n}\n\nexport const Switch: React.FC<SwitchGroupProps> = ({\n mode = \"single\",\n name,\n options,\n selectedValues = [],\n onChange,\n label,\n checked = false,\n onCheckedChange,\n\n disabled = false,\n readOnly = false,\n required = false,\n error,\n\n className,\n itemClassName,\n labelClassName,\n textClassName,\n switchClassName,\n thumbClassName,\n errorClassName,\n\n style,\n itemStyle,\n labelStyle,\n textStyle,\n switchStyle,\n thumbStyle,\n errorStyle,\n\n iconSize = 20,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n\n const generatedId = useId();\n const errorId = error ? `${generatedId}-error` : undefined;\n\n // Track/thumb geometry, derived once so the thumb stays centered and its\n // travel always matches the track width.\n const trackWidth = iconSize * 2;\n const trackHeight = Math.round(iconSize * 1.1);\n const thumbInset = 2;\n const thumbSize = trackHeight - thumbInset * 2;\n\n const handleGroupChange = (value: string) => {\n if (!onChange || disabled || readOnly || !options) return;\n\n const updated = selectedValues.includes(value)\n ? selectedValues.filter((v) => v !== value)\n : [...selectedValues, value];\n\n onChange(updated);\n };\n\n const handleSingleChange = () => {\n if (!onCheckedChange || disabled || readOnly) return;\n onCheckedChange(!checked);\n };\n\n /*\n * The group keyboard handler that lived here was unreachable — it bailed on\n * `focusedIndex === null`, and focusedIndex was only ever set by onFocus on a\n * <label> whose input was display:none, so nothing could focus. With the\n * inputs now `sr-only`, Tab + Space work natively, which is the correct\n * interaction model for a list of switches.\n */\n\n const renderSwitch = (\n isChecked: boolean,\n onToggle: () => void,\n inputValue?: string,\n isRequired = false,\n ) => (\n <>\n <input\n type=\"checkbox\"\n // `hidden` removed this from the tab order and the a11y tree, so the\n // switch was unreachable by keyboard and `required` blocked submits.\n className=\"sr-only peer\"\n role=\"switch\"\n aria-checked={isChecked}\n name={name}\n value={inputValue}\n checked={isChecked}\n disabled={disabled || readOnly}\n required={isRequired}\n aria-describedby={errorId}\n onChange={onToggle}\n />\n\n {/* SWITCH */}\n <span\n className={cn(\n \"relative inline-flex shrink-0 rounded-full transition-colors\",\n isChecked ? \"bg-primary\" : \"bg-muted\",\n \"peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background\",\n switchClassName,\n )}\n style={{\n width: trackWidth,\n height: trackHeight,\n ...switchStyle,\n }}\n >\n {/* THUMB */}\n <span\n className={cn(\n \"absolute top-1/2 rounded-full shadow bg-background\",\n thumbClassName,\n )}\n style={{\n // Animate transform, not `left`, and keep the offsets symmetric so\n // the thumb is actually centered in the track.\n left: 0,\n width: thumbSize,\n height: thumbSize,\n transform: `translate(${\n isChecked ? trackWidth - thumbSize - thumbInset : thumbInset\n }px, -50%)`,\n transition: \"transform 0.25s ease\",\n ...thumbStyle,\n }}\n />\n </span>\n </>\n );\n\n return (\n <div\n ref={containerRef}\n // role=\"switch\" used to sit here, on a <div> wrapping the label, the\n // control and the error text — and without aria-checked. The role now\n // lives on the real input, where it belongs.\n role={mode === \"group\" ? \"group\" : undefined}\n aria-invalid={!!error}\n aria-describedby={errorId}\n className={cn(\"flex flex-col gap-2 text-foreground\", className)}\n style={style}\n >\n {mode === \"single\" ? (\n <label\n className={clsx(\n \"flex items-center justify-between cursor-pointer transition-colors\",\n \"text-foreground\",\n disabled && \"opacity-50 cursor-not-allowed\",\n itemClassName,\n labelClassName,\n )}\n style={{ ...itemStyle, ...labelStyle }}\n >\n {/* TEXT */}\n <span\n className={clsx(\"text-sm text-foreground\", textClassName)}\n style={textStyle}\n >\n {label}\n </span>\n\n {renderSwitch(checked, handleSingleChange, undefined, required)}\n </label>\n ) : (\n options?.map((option, index) => {\n const isChecked = selectedValues.includes(option.value);\n\n return (\n <label\n key={option.value}\n onFocus={() => setFocusedIndex(index)}\n className={clsx(\n \"flex items-center justify-between cursor-pointer transition-colors\",\n \"text-foreground\",\n disabled && \"opacity-50 cursor-not-allowed\",\n itemClassName,\n labelClassName,\n )}\n style={{ ...itemStyle, ...labelStyle }}\n >\n {/* TEXT */}\n <span\n className={clsx(\"text-sm text-foreground\", textClassName)}\n style={textStyle}\n >\n {option.label}\n </span>\n\n {renderSwitch(\n isChecked,\n () => handleGroupChange(option.value),\n option.value,\n )}\n </label>\n );\n })\n )}\n\n {error && (\n <p\n id={errorId}\n role=\"alert\"\n className={cn(\"text-sm text-destructive\", errorClassName)}\n style={errorStyle}\n >\n {error}\n </p>\n )}\n </div>\n );\n};\n","\"use client\";\n\nimport { useEffect } from \"react\";\n\n/*\n * Reference-counted body scroll lock, shared by every overlay in the library.\n *\n * A naive per-component implementation (\"save the current overflow, restore it\n * on unmount\") corrupts itself as soon as two overlays are open at once: the\n * second one saves `overflow: hidden` as the value to restore, so closing both\n * leaves the page permanently unscrollable. Counting locks fixes that — the\n * original value is captured once, by the first locker, and restored once, by\n * the last.\n */\nlet lockCount = 0;\nlet previousOverflow = \"\";\nlet previousPaddingRight = \"\";\n\nconst lock = () => {\n if (typeof document === \"undefined\") return;\n\n if (lockCount === 0) {\n const { body, documentElement } = document;\n previousOverflow = body.style.overflow;\n previousPaddingRight = body.style.paddingRight;\n\n // Removing the scrollbar reflows the page; pad by its width so the content\n // behind the overlay doesn't visibly jump.\n const scrollbarWidth = window.innerWidth - documentElement.clientWidth;\n if (scrollbarWidth > 0) {\n const current = parseFloat(getComputedStyle(body).paddingRight) || 0;\n body.style.paddingRight = `${current + scrollbarWidth}px`;\n }\n\n body.style.overflow = \"hidden\";\n }\n lockCount += 1;\n};\n\nconst unlock = () => {\n if (typeof document === \"undefined\") return;\n\n lockCount = Math.max(0, lockCount - 1);\n if (lockCount === 0) {\n document.body.style.overflow = previousOverflow;\n document.body.style.paddingRight = previousPaddingRight;\n }\n};\n\n/** Locks body scroll while `active` is true. */\nexport const useScrollLock = (active: boolean) => {\n useEffect(() => {\n if (!active) return;\n lock();\n return unlock;\n }, [active]);\n};\n","\"use client\";\n\nimport { useEffect, type RefObject } from \"react\";\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\n/*\n * Keeps Tab focus inside `containerRef` while `active`, moves focus into the\n * container on open, and returns it to whatever was focused before on close.\n *\n * Without this, Tab from inside a dialog walks straight out into the page\n * behind the overlay — the content is visually covered but still reachable.\n */\nexport const useFocusTrap = (\n containerRef: RefObject<HTMLElement | null>,\n active: boolean,\n) => {\n useEffect(() => {\n if (!active) return;\n\n const container = containerRef.current;\n const previouslyFocused = document.activeElement as HTMLElement | null;\n\n const focusFirst = () => {\n const node = containerRef.current;\n if (!node) return;\n const target =\n node.querySelector<HTMLElement>(FOCUSABLE) ??\n // Nothing focusable inside: focus the container itself so the dialog\n // is at least the starting point for the next Tab.\n node;\n target.focus?.();\n };\n\n const frame = requestAnimationFrame(focusFirst);\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n\n const node = containerRef.current;\n if (!node) return;\n\n const focusable = Array.from(\n node.querySelectorAll<HTMLElement>(FOCUSABLE),\n ).filter((el) => el.offsetParent !== null || el === document.activeElement);\n\n if (focusable.length === 0) {\n e.preventDefault();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const activeEl = document.activeElement;\n\n if (e.shiftKey && (activeEl === first || !node.contains(activeEl))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && activeEl === last) {\n e.preventDefault();\n first.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n cancelAnimationFrame(frame);\n document.removeEventListener(\"keydown\", handleKeyDown);\n // Only restore if focus is still somewhere inside the closing dialog —\n // otherwise we'd steal it from wherever the user has since moved.\n if (!container || container.contains(document.activeElement)) {\n previouslyFocused?.focus?.();\n }\n };\n }, [active, containerRef]);\n};\n","\"use client\";\n\nimport React, {\n ReactNode,\n CSSProperties,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport clsx from \"clsx\";\nimport { X } from \"lucide-react\";\nimport { Button, ButtonProps } from \"./Button\";\nimport { cn } from \"../../lib/cn\";\nimport { useScrollLock } from \"../../lib/useScrollLock\";\nimport { useFocusTrap } from \"../../lib/useFocusTrap\";\n\nexport interface DrawerProps {\n isOpen: boolean;\n onClose: () => void;\n children?: ReactNode;\n renderContent?: (close: () => void) => ReactNode;\n\n position?: \"left\" | \"right\" | \"top\" | \"bottom\";\n size?: string;\n\n disableOverlayClose?: boolean;\n /** Also block Escape. Defaults to `disableOverlayClose`. */\n disableEscapeClose?: boolean;\n /** Accessible name for the dialog when no DrawerHeader is used. */\n ariaLabel?: string;\n\n overlayClassName?: string;\n overlayStyle?: CSSProperties;\n /** Applied to the sliding panel that hosts the drawer content. */\n panelClassName?: string;\n}\n\nexport function Drawer({\n isOpen,\n onClose,\n children,\n renderContent,\n position = \"right\",\n size = \"320px\",\n disableOverlayClose = false,\n disableEscapeClose,\n ariaLabel,\n overlayClassName,\n overlayStyle,\n panelClassName,\n}: DrawerProps) {\n const panelRef = useRef<HTMLDivElement>(null);\n const escapeDisabled = disableEscapeClose ?? disableOverlayClose;\n\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n if (!isOpen || escapeDisabled) return;\n const handleEsc = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onCloseRef.current();\n };\n document.addEventListener(\"keydown\", handleEsc);\n return () => document.removeEventListener(\"keydown\", handleEsc);\n }, [isOpen, escapeDisabled]);\n\n // Drawer previously had no scroll lock at all, so the page scrolled behind it.\n useScrollLock(isOpen);\n useFocusTrap(panelRef, isOpen);\n\n const getMotion = () => {\n switch (position) {\n case \"left\":\n return {\n initial: { x: \"-100%\" },\n animate: { x: 0 },\n exit: { x: \"-100%\" },\n };\n case \"right\":\n return {\n initial: { x: \"100%\" },\n animate: { x: 0 },\n exit: { x: \"100%\" },\n };\n case \"top\":\n return {\n initial: { y: \"-100%\" },\n animate: { y: 0 },\n exit: { y: \"-100%\" },\n };\n case \"bottom\":\n return {\n initial: { y: \"100%\" },\n animate: { y: 0 },\n exit: { y: \"100%\" },\n };\n }\n };\n\n const getSizeStyle = (): CSSProperties => {\n switch (position) {\n case \"left\":\n case \"right\":\n // Clamp to the viewport: an unclamped size=\"400px\" overflowed a 320px\n // phone and created a horizontal scrollbar.\n return { width: `min(${size}, 100vw)`, height: \"100%\" };\n case \"top\":\n case \"bottom\":\n return { height: `min(${size}, 100vh)`, width: \"100%\" };\n default:\n return { width: `min(${size}, 100vw)`, height: \"100%\" };\n }\n };\n\n const handleOverlayClick = () => {\n if (!disableOverlayClose) onClose();\n };\n\n const motionProps = getMotion();\n\n return (\n <AnimatePresence>\n {isOpen && (\n <div key=\"drawer-root\" className=\"fixed inset-0 z-50\">\n {/* Overlay */}\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n onClick={handleOverlayClick}\n className={cn(\n \"absolute inset-0 bg-background/80 backdrop-blur-sm\",\n overlayClassName,\n )}\n style={overlayStyle}\n />\n\n {/* Panel */}\n <motion.div\n {...motionProps}\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n tabIndex={-1}\n transition={{ duration: 0.25 }}\n className={cn(\n // `absolute`, not `fixed`: the parent is already a fixed,\n // full-viewport layer, and a nested fixed element competed with\n // its own parent's z-50.\n \"absolute flex flex-col bg-background border-border shadow-2xl outline-none\",\n \"border\",\n position === \"right\" && \"right-0 top-0\",\n position === \"left\" && \"left-0 top-0\",\n position === \"top\" && \"top-0 left-0 right-0\",\n position === \"bottom\" && \"bottom-0 left-0 right-0\",\n panelClassName,\n )}\n style={getSizeStyle()}\n >\n {renderContent ? renderContent(onClose) : children}\n </motion.div>\n </div>\n )}\n </AnimatePresence>\n );\n}\n\nexport interface DrawerContentProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function DrawerContent({\n children,\n className,\n style,\n}: DrawerContentProps) {\n return (\n <div className={clsx(\"flex flex-col h-full\", className)} style={style}>\n {children}\n </div>\n );\n}\n\nexport function DrawerBody({\n children,\n className,\n style,\n}: {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n}) {\n return (\n <div className={cn(\"flex-1 p-6 overflow-auto\", className)} style={style}>\n {children}\n </div>\n );\n}\n\nexport interface DrawerHeaderProps {\n title?: string;\n icon?: ReactNode;\n onClose?: () => void;\n className?: string;\n style?: CSSProperties;\n titleWrapperClassName?: string;\n titleClassName?: string;\n closeButtonClassName?: string;\n}\n\nexport function DrawerHeader({\n title,\n icon,\n onClose,\n className,\n style,\n titleWrapperClassName,\n titleClassName,\n closeButtonClassName,\n}: DrawerHeaderProps) {\n return (\n <div\n className={cn(\n \"flex items-center justify-between px-6 py-4 border-b border-border\",\n className,\n )}\n style={style}\n >\n <div className={cn(\"flex items-center gap-2 font-semibold\", titleWrapperClassName)}>\n {icon}\n {title && <h3 className={cn(\"text-sm\", titleClassName)}>{title}</h3>}\n </div>\n\n {onClose && (\n <button\n type=\"button\"\n aria-label=\"Close drawer\"\n onClick={onClose}\n className={cn(\n \"p-2 rounded-lg hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n closeButtonClassName,\n )}\n >\n <X size={18} aria-hidden=\"true\" />\n </button>\n )}\n </div>\n );\n}\n\nexport function DrawerFooter({\n children,\n className,\n style,\n}: {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n}) {\n return (\n <div\n className={cn(\n \"flex justify-end gap-3 px-6 py-3 border-t border-border bg-accent/60\",\n className,\n )}\n style={style}\n >\n {children}\n </div>\n );\n}\n\nexport interface DrawerTriggerProps extends ButtonProps {\n children: React.ReactNode;\n drawerContent: (props: { close: () => void }) => React.ReactNode;\n /** Forwarded to the underlying <Drawer />. */\n drawerProps?: Omit<DrawerProps, \"isOpen\" | \"onClose\" | \"children\">;\n}\n\nexport function DrawerTriggerButton({\n children,\n drawerContent,\n drawerProps,\n onClick,\n ...props\n}: DrawerTriggerProps) {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Button\n {...props}\n // Chain rather than replace — this used to drop a consumer's onClick.\n onClick={(e) => {\n onClick?.(e);\n setOpen(true);\n }}\n >\n {children}\n </Button>\n\n <Drawer {...drawerProps} isOpen={open} onClose={() => setOpen(false)}>\n {drawerContent({ close: () => setOpen(false) })}\n </Drawer>\n </>\n );\n}\n\n/* ---------------- 🧩 Drawer Button ---------------- */\nexport interface DrawerButtonProps {\n label?: string;\n icon?: ReactNode;\n iconPosition?: \"left\" | \"right\";\n onClick?: () => void;\n className?: string;\n style?: React.CSSProperties;\n labelClassName?: string;\n iconClassName?: string;\n}\n\nexport const DrawerButton: React.FC<DrawerButtonProps> = ({\n label = \"\",\n icon,\n iconPosition = \"left\",\n onClick,\n className,\n style,\n labelClassName,\n iconClassName,\n}) => (\n <button\n type=\"button\"\n onClick={onClick}\n style={style}\n className={clsx(\n // Missing space here fused these into \"justify-centertransition-all\",\n // a class that doesn't exist — both utilities were silently lost.\n \"inline-flex items-center justify-center transition-all\",\n className,\n )}\n >\n {icon && iconPosition === \"left\" && (\n <span className={iconClassName}>{icon}</span>\n )}\n <span className={labelClassName}>{label}</span>\n {icon && iconPosition === \"right\" && (\n <span className={iconClassName}>{icon}</span>\n )}\n </button>\n);\n","\"use client\";\n\nimport React, {\n useEffect,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n useCallback,\n useMemo,\n useId,\n useLayoutEffect,\n} from \"react\";\nimport clsx from \"clsx\";\nimport { motion, AnimatePresence } from \"framer-motion\";\nimport { ChevronDown, Check } from \"lucide-react\";\n\nexport interface SelectOption {\n label: string;\n value: string;\n icon?: React.ReactNode;\n description?: string;\n onClick?: (option: SelectOption, event: React.MouseEvent) => void;\n}\n\nexport interface SelectProps {\n label?: string;\n name?: string;\n value?: string | string[];\n showDescription?: boolean;\n showCheckIcon?: boolean;\n defaultValue?: string | string[];\n onValueChange?: (value: string | string[], name?: string) => void;\n options?: SelectOption[];\n placeholder?: string;\n required?: boolean;\n disabled?: boolean;\n error?: string | boolean;\n success?: boolean;\n helperText?: string;\n multiple?: boolean;\n\n /** Icons */\n labelIcon?: React.ElementType;\n prefixIcon?: React.ElementType;\n dropdownIcon?: React.ElementType;\n\n /** Configuration */\n size?: \"sm\" | \"md\" | \"lg\";\n maxDropdownHeight?: string | number;\n\n searchable?: boolean;\n searchPlaceholder?: string;\n searchClassName?: string;\n searchStyle?: React.CSSProperties;\n\n /** Customization */\n className?: string;\n containerClassName?: string;\n labelClassName?: string;\n triggerClassName?: string;\n valueClassName?: string;\n dropdownClassName?: string;\n itemClassName?: string;\n iconClassName?: string;\n helperClassName?: string;\n /** The label icon rendered before `label`. */\n labelIconClassName?: string;\n /** The wrapper around the search input, when `searchable` is set. */\n searchWrapperClassName?: string;\n /** The \"No options available\" empty state. */\n emptyClassName?: string;\n /** An option's label text. */\n itemLabelClassName?: string;\n /** An option's description text, when `showDescription` is set. */\n itemDescriptionClassName?: string;\n\n /** Item Icon Styling */\n itemIconClassName?: string;\n itemIconStyle?: React.CSSProperties;\n\n /** Check Icon Styling */\n checkIconClassName?: string;\n checkIconStyle?: React.CSSProperties;\n\n style?: React.CSSProperties;\n triggerStyle?: React.CSSProperties;\n dropdownStyle?: React.CSSProperties;\n itemStyle?: React.CSSProperties;\n}\n\nexport const Select = forwardRef<HTMLDivElement, SelectProps>((props, ref) => {\n const {\n label,\n name,\n value,\n defaultValue,\n onValueChange,\n options = [],\n placeholder = \"Select...\",\n required,\n disabled,\n error,\n success,\n helperText,\n multiple = false,\n showDescription = false,\n showCheckIcon = true,\n\n labelIcon: LabelIcon,\n prefixIcon: PrefixIcon,\n dropdownIcon: DropdownIcon = ChevronDown,\n\n searchClassName,\n searchStyle,\n searchPlaceholder,\n searchable = false,\n\n size = \"md\",\n maxDropdownHeight = \"240px\",\n\n className,\n containerClassName,\n labelClassName,\n triggerClassName,\n valueClassName,\n dropdownClassName,\n itemClassName,\n iconClassName,\n helperClassName,\n labelIconClassName,\n searchWrapperClassName,\n emptyClassName,\n itemLabelClassName,\n itemDescriptionClassName,\n\n itemIconClassName,\n itemIconStyle,\n\n checkIconClassName,\n checkIconStyle,\n\n style,\n triggerStyle,\n dropdownStyle,\n itemStyle,\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => containerRef.current!);\n const generatedHelperTextId = useId();\n const [coords, setCoords] = useState({ top: 0, left: 0, width: 0 });\n const [position, setPosition] = useState<\"top\" | \"bottom\">(\"bottom\");\n\n const [open, setOpen] = useState(false);\n const [search, setSearch] = useState(\"\");\n const [internalValue, setInternalValue] = useState<\n string | string[] | undefined\n >(defaultValue);\n const [focusedIndex, setFocusedIndex] = useState(-1);\n\n const isControlled = value !== undefined;\n const currentValue = isControlled ? value : internalValue;\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n\n // Size configuration. `triggerWithPrefix` has to reserve exactly\n // inset + icon width + gap, so it is defined per size alongside the icon it\n // makes room for rather than as one fixed `pl-9` for every size.\n const sizeConfig = {\n sm: {\n trigger: \"px-2.5 py-1.5 text-xs\",\n triggerWithPrefix: \"pl-7 pr-2.5 py-1.5 text-xs\",\n prefixInset: \"left-2\",\n item: \"px-2.5 py-1.5 text-xs\",\n icon: \"w-3 h-3\",\n checkIcon: \"w-3 h-3\",\n search: \"px-2 py-1 text-xs\",\n empty: \"px-2.5 py-1.5 text-xs\",\n },\n md: {\n trigger: \"px-3 py-2 text-sm\",\n triggerWithPrefix: \"pl-9 pr-3 py-2 text-sm\",\n prefixInset: \"left-3\",\n item: \"px-3 py-2 text-sm\",\n icon: \"w-4 h-4\",\n checkIcon: \"w-4 h-4\",\n search: \"px-2 py-1.5 text-sm\",\n empty: \"px-3 py-2 text-sm\",\n },\n lg: {\n trigger: \"px-4 py-3 text-base\",\n triggerWithPrefix: \"pl-11 pr-4 py-3 text-base\",\n prefixInset: \"left-3.5\",\n item: \"px-4 py-3 text-base\",\n icon: \"w-5 h-5\",\n checkIcon: \"w-5 h-5\",\n search: \"px-2.5 py-2 text-base\",\n empty: \"px-4 py-3 text-base\",\n },\n } as const;\n\n // Rebuilt every render if left inline, which re-fires the effects below that\n // depend on it — including the one that calls trigger.focus().\n const selectedValues: string[] = useMemo(\n () =>\n multiple\n ? Array.isArray(currentValue)\n ? currentValue\n : currentValue\n ? [currentValue]\n : []\n : currentValue\n ? [currentValue as string]\n : [],\n [multiple, currentValue],\n );\n\n const filteredOptions = useMemo(\n () =>\n options.filter((opt) =>\n opt.label.toLowerCase().includes(search.toLowerCase()),\n ),\n [options, search],\n );\n\n useLayoutEffect(() => {\n if (!open || !triggerRef.current || !listRef.current) return;\n\n const updatePosition = () => {\n const rect = triggerRef.current!.getBoundingClientRect();\n const menuHeight = listRef.current!.offsetHeight || 240;\n\n const spaceBottom = window.innerHeight - rect.bottom;\n const spaceTop = rect.top;\n\n const shouldOpenTop =\n spaceBottom < menuHeight + 10 && spaceTop > menuHeight;\n\n const top = shouldOpenTop ? rect.top - menuHeight - 8 : rect.bottom + 8;\n\n const left = rect.left;\n\n const width = rect.width;\n\n setPosition(shouldOpenTop ? \"top\" : \"bottom\");\n\n setCoords({\n top,\n left,\n width,\n });\n };\n\n updatePosition();\n\n window.addEventListener(\"scroll\", updatePosition, true);\n window.addEventListener(\"resize\", updatePosition);\n\n return () => {\n window.removeEventListener(\"scroll\", updatePosition, true);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [open]);\n\n // Close on outside click\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, []);\n\n useEffect(() => {\n if (!open) return;\n\n const selectedIndex = filteredOptions.findIndex((opt) =>\n selectedValues.includes(opt.value),\n );\n\n setFocusedIndex(selectedIndex >= 0 ? selectedIndex : 0);\n\n requestAnimationFrame(() => {\n const el = listRef.current?.children?.[\n selectedIndex >= 0 ? selectedIndex : 0\n ] as HTMLElement;\n\n el?.scrollIntoView({ block: \"nearest\" });\n });\n }, [open]);\n\n useEffect(() => {\n if (!open) return;\n\n if (filteredOptions.length === 0) {\n setFocusedIndex(-1);\n return;\n }\n\n setFocusedIndex((prev) => {\n if (prev < 0) return 0;\n return prev >= filteredOptions.length ? filteredOptions.length - 1 : prev;\n });\n }, [filteredOptions, open]);\n\n // NOTE: a third effect used to live here that called triggerRef.focus() with\n // `selectedValues` in its deps. Because that array was rebuilt every render,\n // the effect re-ran on every render while open and continuously yanked focus\n // out of the search box, making `searchable` impossible to type in. The two\n // effects above already cover setting and clamping focusedIndex.\n\n // Move real focus into the search box when the menu opens, so typing works.\n useEffect(() => {\n if (!open || !searchable) return;\n const id = requestAnimationFrame(() => searchRef.current?.focus());\n return () => cancelAnimationFrame(id);\n }, [open, searchable]);\n\n const handleSelect = useCallback(\n (opt: SelectOption, e?: React.MouseEvent) => {\n if (disabled) return;\n\n opt.onClick?.(opt, e!);\n\n let newValue: string | string[];\n\n if (multiple) {\n const exists = selectedValues.includes(opt.value);\n newValue = exists\n ? selectedValues.filter((v) => v !== opt.value)\n : [...selectedValues, opt.value];\n } else {\n newValue = opt.value;\n setOpen(false);\n setFocusedIndex(-1);\n }\n\n if (!isControlled) setInternalValue(newValue);\n onValueChange?.(newValue, name);\n },\n [disabled, selectedValues, multiple, isControlled, name, onValueChange],\n );\n\n const handleKeyDown = useCallback(\n // Shared by the trigger button and the search input.\n (e: React.KeyboardEvent<HTMLButtonElement | HTMLInputElement>) => {\n if (!open) {\n if (e.key === \"Enter\" || e.key === \" \" || e.key === \"ArrowDown\") {\n e.preventDefault();\n if (!disabled) {\n setOpen(true);\n setFocusedIndex(0);\n }\n }\n return;\n }\n\n // Handle navigation when dropdown is open\n if (filteredOptions.length === 0) {\n if (e.key === \"Escape\") {\n e.preventDefault();\n setOpen(false);\n setFocusedIndex(-1);\n }\n return;\n }\n\n switch (e.key) {\n case \"Escape\":\n e.preventDefault();\n setOpen(false);\n setFocusedIndex(-1);\n break;\n case \"Enter\":\n case \" \":\n e.preventDefault();\n if (focusedIndex >= 0 && focusedIndex < filteredOptions.length) {\n handleSelect(filteredOptions[focusedIndex]);\n }\n break;\n case \"ArrowDown\":\n e.preventDefault();\n setFocusedIndex((prev) =>\n prev < filteredOptions.length - 1 ? prev + 1 : prev,\n );\n break;\n case \"ArrowUp\":\n e.preventDefault();\n setFocusedIndex((prev) => (prev > 0 ? prev - 1 : prev));\n break;\n case \"Home\":\n e.preventDefault();\n setFocusedIndex(0);\n break;\n case \"End\":\n e.preventDefault();\n setFocusedIndex(filteredOptions.length - 1);\n break;\n case \"PageUp\":\n e.preventDefault();\n setFocusedIndex((prev) => Math.max(0, prev - 5));\n break;\n case \"PageDown\":\n e.preventDefault();\n setFocusedIndex((prev) =>\n Math.min(filteredOptions.length - 1, prev + 5),\n );\n break;\n }\n },\n [open, disabled, focusedIndex, filteredOptions, handleSelect],\n );\n\n const selectedLabels = useMemo(\n () =>\n options\n .filter((o) => selectedValues.includes(o.value))\n .map((o) => o.label),\n [options, selectedValues],\n );\n\n const hasError = Boolean(error);\n const hasValue = selectedLabels.length > 0;\n // Derived from useId, never from `name` — two <Select name=\"country\" /> on one\n // page would otherwise emit duplicate DOM ids.\n const helperTextId =\n helperText || error ? `${generatedHelperTextId}-description` : undefined;\n const triggerId = `${generatedHelperTextId}-trigger`;\n const labelId = `${generatedHelperTextId}-label`;\n\n const dropdownListStyle = useMemo(() => {\n if (typeof maxDropdownHeight === \"number\") {\n return { maxHeight: `${maxDropdownHeight}px` };\n }\n return { maxHeight: maxDropdownHeight };\n }, [maxDropdownHeight]);\n\n return (\n <div\n ref={containerRef}\n className={clsx(\"w-full space-y-1.5\", className, containerClassName)}\n style={style}\n >\n {label && (\n <label\n id={labelId}\n htmlFor={triggerId}\n className={clsx(\n \"flex items-center gap-1.5 text-[13px] font-medium leading-none text-foreground\",\n labelClassName,\n )}\n >\n {LabelIcon && (\n <LabelIcon\n className={clsx(sizeConfig[size].icon, \"shrink-0\", labelIconClassName)}\n />\n )}\n {label}\n {required && <span className=\"text-destructive\">*</span>}\n </label>\n )}\n\n <div className=\"relative\">\n {PrefixIcon && (\n <div\n className={clsx(\n \"pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground\",\n sizeConfig[size].prefixInset,\n iconClassName,\n )}\n >\n <PrefixIcon className={sizeConfig[size].icon} />\n </div>\n )}\n\n <button\n type=\"button\"\n ref={triggerRef}\n id={triggerId}\n disabled={disabled}\n onClick={() => !disabled && setOpen((p) => !p)}\n onKeyDown={handleKeyDown}\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-required={required}\n aria-invalid={hasError}\n aria-describedby={helperTextId}\n aria-labelledby={label ? labelId : undefined}\n className={clsx(\n \"w-full flex items-center justify-between gap-2\",\n \"rounded-lg transition-all outline-none\",\n \"border border-border bg-input/30 text-foreground\",\n \"hover:bg-accent/10\",\n // A ring color with no ring width renders nothing — set both.\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-ring\",\n disabled && \"opacity-50 cursor-not-allowed\",\n hasError &&\n \"border-destructive focus-visible:ring-destructive/50\",\n success && \"border-success focus-visible:ring-success/50\",\n PrefixIcon\n ? sizeConfig[size].triggerWithPrefix\n : sizeConfig[size].trigger,\n triggerClassName,\n )}\n style={{\n ...triggerStyle,\n }}\n >\n <span\n className={clsx(\n \"truncate flex-1 text-left\",\n hasValue ? \"text-foreground\" : \"text-muted-foreground\",\n valueClassName,\n )}\n >\n {hasValue\n ? multiple\n ? selectedLabels.join(\", \")\n : selectedLabels[0]\n : placeholder}\n </span>\n\n <DropdownIcon\n className={clsx(\n \"transition-transform text-muted-foreground\",\n open && \"rotate-180\",\n sizeConfig[size].icon,\n iconClassName,\n )}\n />\n </button>\n\n <AnimatePresence>\n {open && (\n <motion.div\n initial={{\n opacity: 0,\n y: position === \"bottom\" ? -6 : 6,\n scale: 0.98,\n }}\n animate={{\n opacity: 1,\n y: 0,\n scale: 1,\n }}\n exit={{\n opacity: 0,\n y: position === \"bottom\" ? -6 : 6,\n scale: 0.98,\n }}\n transition={{ duration: 0.12 }}\n className={clsx(\n dropdownClassName,\n \"fixed z-[9999] rounded-lg p-[5px] overflow-hidden\",\n \"bg-background border border-border\",\n )}\n style={{\n top: coords.top,\n left: coords.left,\n width: coords.width,\n ...dropdownStyle,\n }}\n role=\"listbox\"\n aria-label=\"Options\"\n >\n {searchable && (\n <div className={clsx(\"p-2 border-b border-border\", searchWrapperClassName)}>\n <input\n ref={searchRef}\n type=\"text\"\n value={search}\n onChange={(e) => {\n setSearch(e.target.value);\n setFocusedIndex(0);\n }}\n onKeyDown={handleKeyDown}\n placeholder={searchPlaceholder || \"Search...\"}\n aria-label={searchPlaceholder || \"Search options\"}\n className={clsx(\n \"w-full rounded-md outline-none\",\n \"bg-background border border-border text-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n sizeConfig[size].search,\n searchClassName,\n )}\n style={searchStyle}\n />\n </div>\n )}\n\n <ul\n ref={listRef}\n className=\"overflow-y-auto\"\n style={dropdownListStyle}\n >\n {filteredOptions.length === 0 ? (\n <li\n role=\"option\"\n aria-disabled\n aria-selected={false}\n className={clsx(\n \"text-muted-foreground text-center\",\n sizeConfig[size].empty,\n emptyClassName,\n )}\n >\n No options available\n </li>\n ) : (\n filteredOptions.map((opt, index) => {\n const active = selectedValues.includes(opt.value);\n\n return (\n <li\n key={opt.value}\n onClick={(e) => handleSelect(opt, e)}\n role=\"option\"\n aria-selected={active}\n className={clsx(\n itemClassName,\n \"flex items-center justify-between rounded-md cursor-pointer transition-all relative hover:bg-accent\",\n sizeConfig[size].item,\n active && \"bg-accent\",\n )}\n style={{\n ...itemStyle,\n }}\n >\n <div className=\"flex flex-col truncate\">\n <div className=\"flex items-center gap-2\">\n {opt.icon && (\n <span\n className={clsx(\n sizeConfig[size].icon,\n itemIconClassName,\n )}\n style={itemIconStyle}\n >\n {opt.icon}\n </span>\n )}\n\n <span className={clsx(\"font-medium\", itemLabelClassName)}>\n {opt.label}\n </span>\n </div>\n\n {showDescription && opt.description && (\n <span\n className={clsx(\n \"text-xs text-muted-foreground mt-0.5\",\n itemDescriptionClassName,\n )}\n >\n {opt.description}\n </span>\n )}\n </div>\n\n {showCheckIcon && active && (\n <div>\n <Check\n className={clsx(\n sizeConfig[size].checkIcon,\n checkIconClassName,\n \"text-primary\",\n )}\n style={{\n ...checkIconStyle,\n }}\n />\n </div>\n )}\n </li>\n );\n })\n )}\n </ul>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n\n {(helperText || error) && (\n <p\n id={helperTextId}\n className={clsx(\n \"text-xs\",\n hasError\n ? \"text-destructive\"\n : success\n ? \"text-primary\"\n : \"text-muted-foreground\",\n helperClassName,\n )}\n >\n {typeof error === \"string\" ? error : helperText}\n </p>\n )}\n </div>\n );\n});\n\nSelect.displayName = \"Select\";\n","\"use client\";\n\nimport React, {\n forwardRef,\n useState,\n useId,\n useImperativeHandle,\n useRef,\n CSSProperties,\n} from \"react\";\nimport { Eye, EyeOff } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Per-size layout values. The prefix/suffix slots are absolutely positioned, so\n * the input's horizontal padding has to reserve exactly the space the icon\n * occupies at that size — inset + icon width + gap. Keeping all of it in one\n * table is what stops padding and icon size from drifting apart.\n *\n * Every class here is a complete literal so Tailwind's scanner still sees it.\n */\nconst SIZE_CONFIG = {\n sm: {\n base: \"py-1.5 text-xs\",\n padLeft: { none: \"pl-3\", icon: \"pl-8\", text: \"pl-8\", both: \"pl-12\" },\n padRight: { none: \"pr-3\", suffix: \"pr-8\" },\n iconSize: 14,\n prefixInset: \"left-2.5\",\n suffixInset: \"right-2.5\",\n gap: \"gap-1\",\n labelIconSize: 14,\n textSize: \"text-[11px]\",\n },\n md: {\n base: \"py-2 text-sm\",\n padLeft: { none: \"pl-4\", icon: \"pl-10\", text: \"pl-9\", both: \"pl-14\" },\n padRight: { none: \"pr-4\", suffix: \"pr-10\" },\n iconSize: 16,\n prefixInset: \"left-3\",\n suffixInset: \"right-3\",\n gap: \"gap-1.5\",\n labelIconSize: 16,\n textSize: \"text-xs\",\n },\n lg: {\n base: \"py-2.5 text-base\",\n padLeft: { none: \"pl-4\", icon: \"pl-11\", text: \"pl-10\", both: \"pl-16\" },\n padRight: { none: \"pr-4\", suffix: \"pr-11\" },\n iconSize: 20,\n prefixInset: \"left-3.5\",\n suffixInset: \"right-3.5\",\n gap: \"gap-2\",\n labelIconSize: 18,\n textSize: \"text-sm\",\n },\n} as const;\n\nexport interface InputFieldProps {\n label?: string;\n name?: string;\n id?: string;\n type?:\n | \"text\"\n | \"password\"\n | \"email\"\n | \"number\"\n | \"url\"\n | \"tel\"\n | \"search\"\n | \"textarea\";\n placeholder?: string;\n description?: string;\n\n value?: string;\n defaultValue?: string;\n onChange?: (\n e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,\n ) => void;\n onFocus?: (\n e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>,\n ) => void;\n onBlur?: (\n e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>,\n ) => void;\n\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n\n error?: string | boolean;\n success?: boolean;\n helperText?: string;\n\n icon?: React.ElementType;\n prefix?: string;\n prefixIcon?: React.ElementType;\n suffixIcon?: React.ReactNode;\n\n min?: number;\n max?: number;\n step?: number;\n maxLength?: number;\n\n rows?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n\n wrapperClassName?: string;\n labelClassName?: string;\n inputClassName?: string;\n textareaClassName?: string;\n prefixClassName?: string;\n suffixClassName?: string;\n helperTextClassName?: string;\n descriptionClassName?: string;\n\n wrapperStyle?: CSSProperties;\n inputStyle?: CSSProperties;\n labelStyle?: CSSProperties;\n}\n\nexport const Input = forwardRef<\n HTMLInputElement | HTMLTextAreaElement,\n InputFieldProps\n>(function InputField(props, ref) {\n const {\n label,\n name = \"\",\n id,\n type = \"text\",\n placeholder = \"\",\n description,\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n required,\n disabled,\n readOnly,\n\n error,\n success,\n helperText,\n\n icon: LabelIcon,\n prefix,\n prefixIcon: PrefixIcon,\n suffixIcon,\n\n min,\n max,\n step,\n maxLength,\n\n rows = 4,\n size = \"md\",\n\n wrapperClassName = \"\",\n labelClassName = \"\",\n inputClassName = \"\",\n textareaClassName = \"\",\n prefixClassName = \"\",\n suffixClassName = \"\",\n helperTextClassName = \"\",\n descriptionClassName = \"\",\n\n wrapperStyle,\n inputStyle,\n labelStyle,\n } = props;\n\n const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n useImperativeHandle(ref, () => inputRef.current as any);\n\n // `id` is optional, but without one `htmlFor` points at nothing and clicking\n // the label does nothing. Fall back to a generated id.\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const describedBy = helperText || error ? `${fieldId}-description` : undefined;\n\n const [localValue, setLocalValue] = useState(defaultValue || \"\");\n const [visible, setVisible] = useState(false);\n\n const hasPrefixIcon = Boolean(PrefixIcon);\n const hasPrefixText = Boolean(prefix);\n const hasPrefix = hasPrefixIcon || hasPrefixText;\n\n const currentValue = value !== undefined ? value : localValue;\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,\n ) => {\n if (value === undefined) setLocalValue(e.target.value);\n onChange?.(e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (type === \"number\" && e.key === \"-\" && !e.metaKey && !e.ctrlKey) {\n e.preventDefault();\n }\n };\n\n const sizes = SIZE_CONFIG[size];\n\n const hasSuffix = Boolean(suffixIcon) || type === \"password\";\n\n // Every value that has to scale together lives in SIZE_CONFIG, so a size can\n // never scale its padding without also scaling the icon it makes room for.\n const getPadding = () => {\n const left = !hasPrefix\n ? sizes.padLeft.none\n : hasPrefixIcon && hasPrefixText\n ? sizes.padLeft.both\n : hasPrefixText\n ? sizes.padLeft.text\n : sizes.padLeft.icon;\n const right = hasSuffix ? sizes.padRight.suffix : sizes.padRight.none;\n return `${sizes.base} ${left} ${right}`;\n };\n\n const baseInputStyles =\n \"w-full min-w-0 rounded-lg border border-input bg-transparent \" +\n \"text-foreground outline-none transition-colors \" +\n \"placeholder:text-muted-foreground \" +\n \"disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 \" +\n \"dark:bg-input/30 dark:disabled:bg-input/80 \" +\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:border-ring\";\n\n return (\n <div\n className={cn(\"w-full space-y-1.5\", wrapperClassName)}\n style={wrapperStyle}\n >\n {label && (\n <div className=\"flex items-baseline justify-between gap-2\">\n <label\n htmlFor={fieldId}\n className={cn(\n \"flex items-center gap-1.5 text-[13px] font-medium leading-none\",\n labelClassName,\n )}\n style={labelStyle}\n >\n {LabelIcon && (\n <LabelIcon size={sizes.labelIconSize} strokeWidth={1.5} />\n )}\n {label}\n {required && <span className=\"ml-1 text-destructive\">*</span>}\n </label>\n\n {description && (\n <span className={cn(\"text-xs text-muted-foreground\", descriptionClassName)}>\n {description}\n </span>\n )}\n </div>\n )}\n\n <div className=\"relative\">\n {hasPrefix && (\n <div\n className={cn(\n \"absolute inset-y-0 flex items-center text-muted-foreground pointer-events-none\",\n sizes.prefixInset,\n sizes.gap,\n prefixClassName,\n )}\n >\n {PrefixIcon && (\n <PrefixIcon size={sizes.iconSize} strokeWidth={1.5} />\n )}\n {hasPrefixText && (\n <span className={cn(\"font-medium\", sizes.textSize)}>{prefix}</span>\n )}\n </div>\n )}\n\n {type === \"textarea\" ? (\n <textarea\n ref={inputRef as React.RefObject<HTMLTextAreaElement>}\n id={fieldId}\n name={name}\n value={currentValue}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n placeholder={placeholder}\n rows={rows}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n maxLength={maxLength}\n aria-invalid={error ? true : undefined}\n aria-describedby={describedBy}\n style={inputStyle}\n className={cn(\n baseInputStyles,\n getPadding(),\n \"resize-none\",\n error && \"border-destructive focus-visible:ring-destructive/50\",\n success && \"border-success focus-visible:ring-success/50\",\n textareaClassName,\n )}\n />\n ) : (\n <input\n ref={inputRef as React.RefObject<HTMLInputElement>}\n id={fieldId}\n type={type === \"password\" ? (visible ? \"text\" : \"password\") : type}\n name={name}\n value={currentValue}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n min={type === \"number\" ? min : undefined}\n max={type === \"number\" ? max : undefined}\n step={type === \"number\" ? step : undefined}\n maxLength={maxLength}\n aria-invalid={error ? true : undefined}\n aria-describedby={describedBy}\n style={inputStyle}\n className={cn(\n baseInputStyles,\n getPadding(),\n error && \"border-destructive focus-visible:ring-destructive/50\",\n success && \"border-success focus-visible:ring-success/50\",\n inputClassName,\n )}\n />\n )}\n\n {type === \"password\" && (\n <button\n type=\"button\"\n aria-label={visible ? \"Hide password\" : \"Show password\"}\n aria-pressed={visible}\n onClick={() => setVisible(!visible)}\n disabled={disabled}\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 rounded text-muted-foreground transition-colors\",\n \"hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40\",\n sizes.suffixInset,\n suffixClassName,\n )}\n >\n {visible ? (\n <EyeOff size={sizes.iconSize} />\n ) : (\n <Eye size={sizes.iconSize} />\n )}\n </button>\n )}\n\n {suffixIcon && type !== \"password\" && (\n <span\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 flex items-center text-muted-foreground pointer-events-none\",\n sizes.suffixInset,\n suffixClassName,\n )}\n >\n {suffixIcon}\n </span>\n )}\n </div>\n\n {(helperText || error) && (\n <p\n id={describedBy}\n role={error ? \"alert\" : undefined}\n className={cn(\n \"text-xs font-medium\",\n error\n ? \"text-destructive\"\n : success\n ? \"text-success\"\n : \"text-muted-foreground\",\n helperTextClassName,\n )}\n >\n {error && typeof error === \"string\" ? error : helperText}\n </p>\n )}\n </div>\n );\n});\n","\"use client\";\n\nimport React, {\n forwardRef,\n useState,\n useEffect,\n useRef,\n CSSProperties,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n label?: string;\n icon?: React.ElementType;\n error?: boolean;\n success?: boolean;\n helperText?: string;\n maxLength?: number;\n\n /** Auto resize */\n autoResize?: boolean;\n minRows?: number;\n maxRows?: number;\n\n /** Chat-like behavior */\n submitOnEnter?: boolean; // Enter submits\n onSubmit?: () => void;\n\n /** Customization */\n className?: string;\n containerClassName?: string;\n labelClassName?: string;\n iconClassName?: string;\n helperClassName?: string;\n countClassName?: string;\n\n style?: CSSProperties;\n containerStyle?: CSSProperties;\n labelStyle?: CSSProperties;\n helperStyle?: CSSProperties;\n countStyle?: CSSProperties;\n}\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n label,\n name,\n icon: Icon,\n value,\n onChange,\n placeholder,\n required,\n disabled,\n error,\n success,\n helperText,\n maxLength,\n\n autoResize = true,\n minRows = 3,\n maxRows = 6,\n\n submitOnEnter,\n onSubmit,\n\n className = \"\",\n containerClassName = \"\",\n labelClassName = \"\",\n iconClassName = \"\",\n helperClassName = \"\",\n countClassName = \"\",\n\n style,\n containerStyle,\n labelStyle,\n helperStyle,\n countStyle,\n\n ...props\n },\n ref,\n ) => {\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n\n // Merge refs\n const setRefs = (el: HTMLTextAreaElement) => {\n innerRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) (ref as any).current = el;\n };\n\n /** 🔥 Auto resize logic */\n const resizeTextarea = () => {\n const el = innerRef.current;\n if (!el || !autoResize) return;\n\n el.style.height = \"auto\";\n\n const lineHeight = 24; // approx\n const minHeight = minRows * lineHeight;\n const maxHeight = maxRows * lineHeight;\n\n const newHeight = Math.min(\n Math.max(el.scrollHeight, minHeight),\n maxHeight,\n );\n\n el.style.height = newHeight + \"px\";\n el.style.overflowY = el.scrollHeight > maxHeight ? \"auto\" : \"hidden\";\n };\n\n useEffect(() => {\n resizeTextarea();\n }, [value]);\n\n /** ⌨️ ChatGPT-like enter behavior */\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (submitOnEnter && e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n onSubmit?.();\n }\n };\n\n const currentLength =\n typeof value === \"string\"\n ? value.length\n : innerRef.current?.value?.length || 0;\n\n const showCount = typeof maxLength === \"number\" && maxLength > 0;\n\n return (\n <div\n className={`w-full space-y-1.5 ${containerClassName}`}\n style={containerStyle}\n >\n {label && (\n <label\n htmlFor={name}\n className={`flex items-center gap-2 text-[13px] leading-none font-medium ${labelClassName}`}\n style={labelStyle}\n >\n {Icon && <Icon size={14} className={iconClassName || undefined} />}\n {label}\n {required && <span className=\"text-destructive\">*</span>}\n </label>\n )}\n\n <div className=\"relative group\">\n <textarea\n ref={setRefs}\n id={name}\n name={name}\n value={value}\n onChange={(e) => {\n onChange?.(e);\n resizeTextarea();\n }}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n maxLength={maxLength}\n rows={minRows}\n className={cn(\n \"w-full px-4 py-3 text-sm rounded-lg\",\n // Reserve room for the character counter so typed text never\n // runs underneath it.\n showCount && \"pb-8\",\n \"resize-none transition-all duration-200 ease-out\",\n \"outline-none border\",\n \"bg-input/30 text-foreground\",\n \"placeholder:text-muted-foreground\",\n \"border-border\",\n // A 1px ring in the border color was invisible — use the shared\n // focus treatment so keyboard focus is actually indicated.\n \"focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:border-ring\",\n \"hover:border-muted-foreground/40\",\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n error &&\n \"border-destructive focus-visible:ring-destructive/50\",\n success && \"border-success\",\n className,\n )}\n style={{\n ...style,\n }}\n {...props}\n />\n\n {showCount && (\n <span\n // pointer-events-none: the counter must not block click-to-place\n // in the corner of the field.\n className={cn(\n \"pointer-events-none absolute bottom-2.5 right-3 text-[11px] tabular-nums text-muted-foreground\",\n countClassName,\n )}\n style={countStyle}\n >\n {currentLength}/{maxLength}\n </span>\n )}\n </div>\n\n {helperText && (\n <p\n className={`text-xs ${\n error\n ? \"text-destructive\"\n : success\n ? \"text-primary\"\n : \"text-muted-foreground\"\n } ${helperClassName}`}\n style={helperStyle}\n >\n {helperText}\n </p>\n )}\n </div>\n );\n },\n);\n\nTextarea.displayName = \"Textarea\";\n","\"use client\";\n\nimport React, {\n useEffect,\n useCallback,\n useRef,\n type ReactNode,\n CSSProperties,\n useState,\n} from \"react\";\nimport { X } from \"lucide-react\";\nimport clsx from \"clsx\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport { cn } from \"../../lib/cn\";\nimport { useScrollLock } from \"../../lib/useScrollLock\";\nimport { useFocusTrap } from \"../../lib/useFocusTrap\";\n\n/* =========================\n Modal Root\n========================= */\nexport interface ModalProps {\n isOpen: boolean;\n onClose: () => void;\n children: ReactNode;\n disableOverlayClose?: boolean;\n /** Also block Escape. Defaults to `disableOverlayClose`. */\n disableEscapeClose?: boolean;\n /** Accessible name for the dialog when no ModalHeader is used. */\n ariaLabel?: string;\n\n overlayClassName?: string;\n overlayStyle?: CSSProperties;\n style?: CSSProperties;\n /** The `role=\"dialog\"` wrapper around `children`. */\n dialogClassName?: string;\n}\n\nexport function Modal({\n isOpen,\n onClose,\n children,\n disableOverlayClose = false,\n disableEscapeClose,\n ariaLabel,\n overlayClassName,\n overlayStyle,\n style,\n dialogClassName,\n}: ModalProps) {\n const dialogRef = useRef<HTMLDivElement>(null);\n // A \"forced choice\" modal that blocks the overlay should not be dismissible\n // with Escape either, unless the consumer says otherwise.\n const escapeDisabled = disableEscapeClose ?? disableOverlayClose;\n\n // Keep onClose in a ref so the listener doesn't resubscribe on every parent\n // render — consumers almost always pass an inline arrow.\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n\n useEffect(() => {\n if (!isOpen || escapeDisabled) return;\n const handleEsc = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onCloseRef.current();\n };\n document.addEventListener(\"keydown\", handleEsc);\n return () => document.removeEventListener(\"keydown\", handleEsc);\n }, [isOpen, escapeDisabled]);\n\n useScrollLock(isOpen);\n useFocusTrap(dialogRef, isOpen);\n\n // Compare the mousedown target with the click target: otherwise selecting\n // text inside the modal and releasing over the overlay closes it.\n const pressedOnOverlay = useRef(false);\n\n const handleOverlayClick = useCallback(() => {\n if (!disableOverlayClose && pressedOnOverlay.current) onClose();\n pressedOnOverlay.current = false;\n }, [disableOverlayClose, onClose]);\n\n return (\n <AnimatePresence>\n {isOpen && (\n <motion.div\n key=\"modal-overlay\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n onMouseDown={(e) => {\n pressedOnOverlay.current = e.target === e.currentTarget;\n }}\n onClick={handleOverlayClick}\n className={cn(\n \"fixed inset-0 z-50 flex items-center justify-center\",\n \"bg-background/80 backdrop-blur-sm p-4\",\n overlayClassName,\n )}\n style={{ ...overlayStyle, ...style }}\n >\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n tabIndex={-1}\n className={cn(\"contents outline-none\", dialogClassName)}\n >\n {children}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n/* =========================\n Modal Content (Card)\n========================= */\nexport interface ModalContentProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n maxWidth?: string;\n onClose?: () => void;\n showCloseButton?: boolean;\n closeButtonClassName?: string;\n closeButtonStyle?: CSSProperties;\n}\n\nexport function ModalContent({\n children,\n className,\n style,\n maxWidth = \"max-w-md\",\n onClose,\n showCloseButton = false,\n closeButtonClassName,\n closeButtonStyle,\n}: ModalContentProps) {\n const hasCloseButton = showCloseButton && typeof onClose === \"function\";\n\n return (\n <motion.div\n initial={{ y: 20, scale: 0.96 }}\n animate={{ y: 0, scale: 1 }}\n exit={{ y: 20, scale: 0.96 }}\n transition={{ duration: 0.2 }}\n onClick={(e) => e.stopPropagation()}\n className={clsx(\n \"relative w-full rounded-2xl border border-border bg-background shadow-2xl overflow-hidden\",\n maxWidth,\n className,\n )}\n style={style}\n >\n {hasCloseButton && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close modal\"\n className={clsx(\n \"absolute top-4 right-4 z-10 p-2 rounded-full transition-colors\",\n \"hover:bg-accent/20 focus:outline-none \",\n closeButtonClassName,\n )}\n style={closeButtonStyle}\n >\n <X size={18} />\n </button>\n )}\n\n {children}\n </motion.div>\n );\n}\n\n/* =========================\n Header\n========================= */\nexport interface ModalHeaderProps {\n title?: string;\n icon?: ReactNode;\n onClose?: () => void;\n\n className?: string;\n style?: CSSProperties;\n\n /** Wrapper around `icon` + `title`. */\n titleWrapperClassName?: string;\n iconClassName?: string;\n titleClassName?: string;\n closeButtonClassName?: string;\n}\n\nexport function ModalHeader({\n title,\n icon,\n onClose,\n className,\n style,\n titleWrapperClassName,\n iconClassName,\n titleClassName,\n closeButtonClassName,\n}: ModalHeaderProps) {\n return (\n <div\n className={clsx(\n className,\n \"flex items-center justify-between px-6 py-4 border-b border-border\",\n )}\n style={style}\n >\n <div\n className={cn(\n \"flex items-center gap-2 font-semibold text-foreground\",\n titleWrapperClassName,\n )}\n >\n {icon && <span className={iconClassName}>{icon}</span>}\n {title && <h3 className={cn(\"text-sm\", titleClassName)}>{title}</h3>}\n </div>\n\n {onClose && (\n <button\n // Without type=\"button\" this submits any enclosing <form>, and with\n // no aria-label screen readers announce an empty button.\n type=\"button\"\n aria-label=\"Close modal\"\n onClick={onClose}\n className={cn(\n \"p-2 rounded-lg hover:bg-accent transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n closeButtonClassName,\n )}\n >\n <X size={18} aria-hidden=\"true\" />\n </button>\n )}\n </div>\n );\n}\n\n/* =========================\n Body\n========================= */\nexport interface ModalBodyProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ModalBody({ children, className, style }: ModalBodyProps) {\n return (\n <div className={clsx(className, \"p-6 text-foreground space-y-4\")} style={style}>\n {children}\n </div>\n );\n}\n\n/* =========================\n Footer\n========================= */\nexport interface ModalFooterProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ModalFooter({ children, className, style }: ModalFooterProps) {\n return (\n <div\n className={clsx(\n \"flex justify-end gap-3 px-6 py-3 border-t border-border bg-accent/60\",\n className,\n )}\n style={style}\n >\n {children}\n </div>\n );\n}\n\n/* =========================\n Modal Button\n========================= */\nexport interface ModalButtonProps extends ButtonProps {\n onClose?: () => void;\n closeOnClick?: boolean;\n action?: () => void | Promise<void>;\n}\n\nexport function ModalButton({\n onClose,\n closeOnClick,\n action,\n onClick,\n disabled,\n ...rest\n}: ModalButtonProps) {\n const [pending, setPending] = useState(false);\n\n const handleClick = async (e: React.MouseEvent<HTMLButtonElement>) => {\n if (onClick) onClick(e);\n\n if (action) {\n setPending(true);\n try {\n await action();\n } catch (err) {\n // Surface the failure instead of leaving an unhandled rejection, and\n // leave the modal open so the user can retry.\n setPending(false);\n throw err;\n }\n setPending(false);\n }\n\n if (closeOnClick && onClose) onClose();\n };\n\n return (\n <Button\n size=\"sm\"\n {...rest}\n // Guard against double-submit while `action` is in flight.\n disabled={disabled || pending}\n loading={rest.loading || pending}\n onClick={handleClick}\n />\n );\n}\n\n/* =========================\n Trigger\n========================= */\nexport interface ModalTriggerButtonProps extends ButtonProps {\n children: React.ReactNode;\n modalContent: (props: { close: () => void }) => React.ReactNode;\n /** Forwarded to the underlying <Modal />. */\n modalProps?: Omit<ModalProps, \"isOpen\" | \"onClose\" | \"children\">;\n}\n\nexport function ModalTriggerButton({\n children,\n modalContent,\n modalProps,\n onClick,\n ...props\n}: ModalTriggerButtonProps) {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Button\n {...props}\n // Chain rather than replace — placing this after {...props} used to\n // silently drop a consumer-supplied onClick.\n onClick={(e) => {\n onClick?.(e);\n setOpen(true);\n }}\n >\n {children}\n </Button>\n\n <Modal {...modalProps} isOpen={open} onClose={() => setOpen(false)}>\n {modalContent({ close: () => setOpen(false) })}\n </Modal>\n </>\n );\n}\n","\"use client\";\n\nimport React, { ReactNode, CSSProperties } from \"react\";\nimport clsx from \"clsx\";\n\n/* =========================\n Table Root\n========================= */\nexport interface TableProps {\n children: ReactNode;\n\n /** Wrapper */\n className?: string;\n style?: CSSProperties;\n\n /** Table */\n tableClassName?: string;\n tableStyle?: CSSProperties;\n\n /** Behavior */\n responsive?: boolean;\n striped?: boolean;\n hoverable?: boolean;\n bordered?: boolean;\n dense?: boolean;\n}\n\nexport function Table({\n children,\n className,\n style,\n tableClassName,\n tableStyle,\n responsive = true,\n striped = false,\n hoverable = true,\n bordered = false,\n dense = false,\n}: TableProps) {\n return (\n <div\n className={clsx(\n \"w-full rounded-2xl border bg-background text-foreground shadow-sm\",\n \"border-border\",\n responsive && \"overflow-x-auto\",\n className,\n )}\n style={style}\n >\n <table\n className={clsx(\n \"w-full border-collapse text-sm\",\n dense ? \"text-xs\" : \"text-sm\",\n tableClassName,\n )}\n style={{\n borderSpacing: 0,\n ...tableStyle,\n }}\n >\n {React.Children.map(children, (child) =>\n React.isValidElement(child)\n ? React.cloneElement(child as any, {\n striped,\n hoverable,\n bordered,\n dense,\n })\n : child,\n )}\n </table>\n </div>\n );\n}\n\n/* =========================\n Head\n========================= */\nexport interface TableSectionProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n\n striped?: boolean;\n hoverable?: boolean;\n bordered?: boolean;\n dense?: boolean;\n}\n\nexport function THead({\n children,\n className,\n style,\n bordered,\n}: TableSectionProps) {\n return (\n <thead\n className={clsx(\n \"bg-accent text-foreground\",\n className,\n )}\n style={style}\n >\n {React.Children.map(children, (child) =>\n React.isValidElement(child)\n ? React.cloneElement(child as any, { bordered })\n : child,\n )}\n </thead>\n );\n}\n\n/* =========================\n Body\n========================= */\nexport function TBody({\n children,\n className,\n style,\n striped,\n hoverable,\n bordered,\n}: TableSectionProps) {\n return (\n <tbody className={clsx(\"bg-background\", className)} style={style}>\n {React.Children.map(children, (child, index) =>\n React.isValidElement(child)\n ? React.cloneElement(child as any, {\n striped,\n hoverable,\n bordered,\n index,\n })\n : child,\n )}\n </tbody>\n );\n}\n\n/* =========================\n Row\n========================= */\nexport interface TRowProps extends TableSectionProps {\n onClick?: () => void;\n index?: number;\n}\n\nexport function TRow({\n children,\n className,\n style,\n onClick,\n striped,\n hoverable,\n bordered,\n index = 0,\n}: TRowProps) {\n return (\n <tr\n onClick={onClick}\n className={clsx(\n className,\n bordered && \"border-b border-border\",\n striped && index % 2 === 0 && \"bg-accent/30\",\n hoverable && \"hover:bg-accent/60\",\n onClick && \"cursor-pointer\",\n \"transition-all duration-200\",\n )}\n style={style}\n >\n {children}\n </tr>\n );\n}\n\n/* =========================\n Header Cell\n========================= */\nexport interface TableCellProps {\n children: ReactNode;\n className?: string;\n style?: CSSProperties;\n\n bordered?: boolean;\n dense?: boolean;\n}\n\nexport function TH({\n children,\n className,\n style,\n bordered,\n dense,\n}: TableCellProps) {\n return (\n <th\n className={clsx(\n className,\n \"text-left font-medium text-foreground\",\n dense ? \"px-3 py-2\" : \"px-5 py-3\",\n bordered && \"border-b border-border\",\n )}\n style={style}\n >\n {children}\n </th>\n );\n}\n\n/* =========================\n Data Cell\n========================= */\nexport function TD({ children, className, style, dense }: TableCellProps) {\n return (\n <td\n className={clsx(\n className,\n \"text-accent-foreground\",\n dense ? \"px-3 py-2\" : \"px-5 py-3\",\n )}\n style={style}\n >\n {children}\n </td>\n );\n}\n","\"use client\";\nimport React, {\n ReactNode,\n CSSProperties,\n createContext,\n useContext,\n useState,\n useEffect,\n useRef,\n KeyboardEvent,\n} from \"react\";\nimport clsx from \"clsx\";\nimport { cn } from \"../../lib/cn\";\n\n/* ------------------------------------------------------------------ */\n/* Responsive hook */\n/* ------------------------------------------------------------------ */\n\nfunction useBreakpoint(breakpoint = 768) {\n const [isMobile, setIsMobile] = useState(false);\n useEffect(() => {\n const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);\n const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);\n setIsMobile(mq.matches);\n mq.addEventListener(\"change\", handler);\n return () => mq.removeEventListener(\"change\", handler);\n }, [breakpoint]);\n return isMobile;\n}\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\ntype Position = \"top\" | \"bottom\" | \"left\" | \"right\";\ntype Variant = \"solid\" | \"outline\" | \"underline\" | \"pill\";\n\n/**\n * mobileVariant — how <TabList> behaves on small screens:\n * \"drawer\" → collapses into an animated dropdown (hamburger-style)\n * \"scroll\" → horizontal scrollable strip with snap (default)\n * \"stack\" → forced full-width vertical column\n * \"collapse\" → left/right positions collapse to top row\n */\ntype MobileVariant = \"drawer\" | \"scroll\" | \"stack\" | \"collapse\";\n\ninterface TabsContextValue {\n active: number;\n setActive: (i: number) => void;\n variant: Variant;\n position: Position;\n primaryColor: string;\n activeColor: string;\n textColor: string;\n hoverColor: string;\n borderColor: string;\n disabledColor: string;\n radius: number;\n transitionDuration: number;\n fullWidth: boolean;\n tabCount: number;\n isMobile: boolean;\n mobileVariant: MobileVariant;\n drawerOpen: boolean;\n setDrawerOpen: (v: boolean) => void;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext() {\n const ctx = useContext(TabsContext);\n if (!ctx)\n throw new Error(\"<Tab>, <TabList>, <TabPanel> must be inside <Tabs>\");\n return ctx;\n}\n\n/* ------------------------------------------------------------------ */\n/* <Tabs> — root provider */\n/* ------------------------------------------------------------------ */\n\nexport interface TabsProps {\n children: ReactNode;\n defaultActive?: number;\n position?: Position;\n variant?: Variant;\n fullWidth?: boolean;\n radius?: number;\n transitionDuration?: number;\n bordered?: boolean;\n\n /** Responsive */\n mobileBreakpoint?: number;\n mobileVariant?: MobileVariant;\n\n /** Colors */\n primaryColor?: string;\n activeColor?: string;\n textColor?: string;\n hoverColor?: string;\n borderColor?: string;\n disabledColor?: string;\n backgroundColor?: string;\n\n onTabChange?: (index: number) => void;\n tabCount?: number;\n style?: CSSProperties;\n className?: string;\n}\n\nexport const Tabs: React.FC<TabsProps> = ({\n children,\n defaultActive = 0,\n position = \"top\",\n variant = \"solid\",\n fullWidth = false,\n radius = 8,\n transitionDuration = 200,\n bordered = false,\n\n mobileBreakpoint = 768,\n mobileVariant = \"scroll\",\n\n backgroundColor,\n\n primaryColor = \"var(--primary)\",\n activeColor = \"var(--foreground)\",\n textColor = \"\",\n hoverColor = \"var(--primary)\",\n borderColor = \"var(--border)\",\n disabledColor = \"var(--muted-foreground)\",\n\n onTabChange,\n tabCount = 0,\n style,\n className,\n}) => {\n const [active, setActive] = useState(defaultActive);\n const [resolvedCount, setResolvedCount] = useState(tabCount);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const isMobile = useBreakpoint(mobileBreakpoint);\n\n useEffect(() => {\n if (!tabCount && containerRef.current) {\n setResolvedCount(\n containerRef.current.querySelectorAll(\"[data-tab-button]\").length,\n );\n }\n // Previously had NO dependency array while calling setState, so it re-ran\n // and re-queried the DOM after every render of the whole subtree.\n }, [tabCount, children]);\n\n useEffect(() => {\n if (!isMobile) setDrawerOpen(false);\n }, [isMobile]);\n\n const handleSetActive = (i: number) => {\n setActive(i);\n onTabChange?.(i);\n if (isMobile && mobileVariant === \"drawer\") setDrawerOpen(false);\n };\n\n const effectivePosition: Position =\n isMobile && (position === \"left\" || position === \"right\")\n ? \"top\"\n : position;\n\n const isVertical =\n effectivePosition === \"left\" || effectivePosition === \"right\";\n\n return (\n <TabsContext.Provider\n value={{\n active,\n setActive: handleSetActive,\n variant,\n position: effectivePosition,\n primaryColor,\n activeColor,\n textColor,\n hoverColor,\n borderColor,\n disabledColor,\n radius,\n transitionDuration,\n fullWidth,\n tabCount: resolvedCount,\n isMobile,\n mobileVariant,\n drawerOpen,\n setDrawerOpen,\n }}\n >\n <div\n ref={containerRef}\n className={clsx(\n \"modern-tabs\",\n \"text-foreground\",\n isVertical ? \"flex flex-row\" : \"flex flex-col\",\n effectivePosition === \"right\" && \"flex-row-reverse\",\n effectivePosition === \"bottom\" && \"flex-col-reverse\",\n bordered && \"border border-border\",\n className,\n )}\n style={{\n // This was `background: \"bg-background\"` — a Tailwind class name in a\n // CSS property, which the browser silently drops, so the root had no\n // background at all. The `backgroundColor` prop belongs here.\n background: backgroundColor ?? \"var(--background)\",\n borderRadius: radius,\n overflow: \"hidden\",\n ...style,\n }}\n >\n <style>{`\n @keyframes tab-fade-in {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes tab-drawer-open {\n from { opacity: 0; transform: translateY(-6px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .tab-panel-active {\n animation: tab-fade-in ${transitionDuration}ms ease;\n }\n .tab-drawer-menu {\n animation: tab-drawer-open ${transitionDuration}ms ease;\n }\n .tab-scroll-strip {\n overflow-x: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n scroll-snap-type: x mandatory;\n -webkit-overflow-scrolling: touch;\n }\n .tab-scroll-strip::-webkit-scrollbar { display: none; }\n .tab-scroll-strip [data-tab-button] {\n scroll-snap-align: start;\n flex-shrink: 0;\n }\n `}</style>\n {children}\n </div>\n </TabsContext.Provider>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* <TabList> */\n/* ------------------------------------------------------------------ */\n\nexport interface TabListProps {\n children: ReactNode;\n gap?: number;\n /** Label shown in drawer trigger when no tab is active (fallback) */\n drawerLabel?: ReactNode;\n /** Icon for the drawer chevron area */\n drawerIcon?: ReactNode;\n style?: CSSProperties;\n className?: string;\n /** The drawer trigger `<button>` (mobileVariant=\"drawer\" only). */\n triggerClassName?: string;\n /** The dropdown menu panel (mobileVariant=\"drawer\" only). */\n menuClassName?: string;\n}\n\nconst ChevronIcon = ({ open }: { open: boolean }) => (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{\n transform: open ? \"rotate(180deg)\" : \"rotate(0deg)\",\n transition: \"transform 200ms ease\",\n display: \"flex\",\n flexShrink: 0,\n }}\n >\n <polyline points=\"6 9 12 15 18 9\" />\n </svg>\n);\n\nexport const TabList: React.FC<TabListProps> = ({\n children,\n gap = 8,\n drawerLabel = \"Select tab\",\n style,\n className,\n triggerClassName,\n menuClassName,\n}) => {\n const {\n position,\n isMobile,\n mobileVariant,\n drawerOpen,\n setDrawerOpen,\n radius,\n active,\n } = useTabsContext();\n\n const isVertical = position === \"left\" || position === \"right\";\n\n /* ---- MOBILE: Drawer ---- */\n if (isMobile && mobileVariant === \"drawer\") {\n const tabArray = React.Children.toArray(children);\n const activeTabEl = tabArray[active] as\n | React.ReactElement<TabProps>\n | undefined;\n const activeLabel = activeTabEl?.props?.children ?? drawerLabel;\n\n return (\n <div\n className={clsx(\n \"relative w-full bg-background text-foreground\",\n className,\n )}\n style={{ padding: 8, ...style }}\n >\n {/* Trigger */}\n <button\n onClick={() => setDrawerOpen(!drawerOpen)}\n className={cn(\n \"flex items-center justify-between w-full font-medium border border-border bg-background text-foreground hover:bg-accent transition-colors\",\n triggerClassName,\n )}\n style={{\n padding: \"10px 16px\",\n borderRadius: radius,\n cursor: \"pointer\",\n fontSize: 14,\n }}\n >\n <span>{activeLabel}</span>\n <ChevronIcon open={drawerOpen} />\n </button>\n\n {/* Dropdown */}\n {drawerOpen && (\n <div\n className={cn(\n \"tab-drawer-menu absolute left-0 right-0 z-50 flex flex-col bg-background text-foreground border border-border\",\n menuClassName,\n )}\n style={{\n top: \"calc(100% + 4px)\",\n borderRadius: radius,\n boxShadow: \"0 8px 24px rgba(0,0,0,0.12)\",\n gap: 4,\n padding: 6,\n }}\n >\n {children}\n </div>\n )}\n </div>\n );\n }\n\n /* ---- MOBILE: Horizontal scroll strip ---- */\n if (isMobile && mobileVariant === \"scroll\") {\n return (\n <div\n role=\"tablist\"\n className={clsx(\n \"tab-scroll-strip flex flex-row w-full bg-background text-foreground\",\n className,\n )}\n style={{ gap, padding: 8, ...style }}\n >\n {children}\n </div>\n );\n }\n\n /* ---- MOBILE: Stacked vertical ---- */\n if (isMobile && mobileVariant === \"stack\") {\n return (\n <div\n role=\"tablist\"\n className={clsx(\n \"flex flex-col w-full bg-background text-foreground\",\n className,\n )}\n style={{ gap, padding: 8, ...style }}\n >\n {children}\n </div>\n );\n }\n\n /* ---- MOBILE: Collapse (fix) ---- */\n if (isMobile && mobileVariant === \"collapse\") {\n return (\n <div\n role=\"tablist\"\n className={clsx(\n \"flex flex-row flex-wrap w-full bg-background text-foreground\",\n className,\n )}\n style={{\n gap,\n padding: 8,\n ...style,\n }}\n >\n {children}\n </div>\n );\n }\n\n /* ---- Default: desktop / collapse ---- */\n return (\n <div\n role=\"tablist\"\n className={clsx(\n \"flex text-foreground\",\n isVertical ? \"flex-col\" : \"flex-row\",\n isVertical ? \"min-w-40\" : \"w-full\",\n className,\n )}\n style={{ gap, padding: 8, ...style }}\n >\n {children}\n </div>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* <Tab> */\n/* ------------------------------------------------------------------ */\n\nexport interface TabProps {\n children: ReactNode;\n index?: number;\n icon?: ReactNode;\n disabled?: boolean;\n ariaLabel?: string;\n style?: CSSProperties;\n className?: string;\n activeStyle?: CSSProperties;\n inactiveStyle?: CSSProperties;\n /** Wraps the `icon` node. */\n iconClassName?: string;\n}\n\nexport const Tab: React.FC<TabProps> = ({\n children,\n index,\n icon,\n disabled = false,\n ariaLabel,\n className,\n iconClassName,\n}) => {\n const { active, setActive, variant, tabCount, isMobile, mobileVariant } =\n useTabsContext();\n\n const selfIndexRef = useRef<number | undefined>(index);\n const buttonRef = useRef<HTMLButtonElement>(null);\n\n const resolvedIndex = (): number => {\n if (selfIndexRef.current !== undefined) return selfIndexRef.current;\n if (!buttonRef.current) return 0;\n\n const list = buttonRef.current\n .closest(\"[role=tablist], .tab-drawer-menu\")\n ?.querySelectorAll(\"[data-tab-button]\");\n\n if (!list) return 0;\n return Array.from(list).indexOf(buttonRef.current);\n };\n\n const isActive = resolvedIndex() === active;\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n const count = tabCount || 1;\n const idx = resolvedIndex();\n\n if (e.key === \"ArrowRight\" || e.key === \"ArrowDown\") {\n e.preventDefault();\n setActive((idx + 1) % count);\n } else if (e.key === \"ArrowLeft\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n setActive((idx - 1 + count) % count);\n }\n };\n\n const forceFullWidth =\n isMobile &&\n (mobileVariant === \"stack\" ||\n mobileVariant === \"drawer\" ||\n mobileVariant === \"collapse\");\n\n // -----------------------------\n // VARIANT CLASSES (TAILWIND ONLY)\n // -----------------------------\n\n const baseVariant =\n variant === \"outline\"\n ? \"border border-border bg-transparent\"\n : variant === \"underline\"\n ? \"!border-b-2 border-transparent rounded-none\"\n : variant === \"pill\"\n ? \"!rounded-full\"\n : \"border-none\";\n\n const activeVariant =\n variant === \"solid\" || variant === \"pill\"\n ? \"bg-primary text-primary-foreground\"\n : variant === \"outline\"\n ? \"border-primary text-primary !bg-primary/5\"\n : variant === \"underline\"\n ? \"!border-primary !text-primary\"\n : \"\";\n\n const hoverVariant =\n variant === \"underline\"\n ? \"hover:text-foreground\"\n : \"hover:bg-accent hover:text-foreground\";\n\n return (\n <button\n ref={buttonRef}\n data-tab-button\n role=\"tab\"\n aria-selected={isActive}\n aria-label={ariaLabel}\n disabled={disabled}\n onClick={() => !disabled && setActive(resolvedIndex())}\n onKeyDown={handleKeyDown}\n className={clsx(\n \"flex items-center rounded-lg justify-center gap-2 font-medium select-none transition-all\",\n \"text-muted-foreground text-sm whitespace-nowrap\",\n !disabled && \"cursor-pointer\",\n disabled && \"opacity-60 cursor-not-allowed\",\n forceFullWidth && \"w-full\",\n\n baseVariant,\n !disabled && hoverVariant,\n isActive && \"text-foreground\",\n isActive && activeVariant,\n\n className,\n )}\n style={{\n padding: \"10px 16px\", // kept minimal inline (safe, not theme-related)\n }}\n >\n {icon && <span className={cn(\"shrink-0\", iconClassName)}>{icon}</span>}\n {children}\n </button>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* <TabPanels> */\n/* ------------------------------------------------------------------ */\n\nexport interface TabPanelsProps {\n children: ReactNode;\n style?: CSSProperties;\n className?: string;\n}\n\nexport const TabPanels: React.FC<TabPanelsProps> = ({\n children,\n style,\n className,\n}) => {\n return (\n <div\n className={clsx(\"flex-1 min-w-0 text-foreground\", className)}\n style={{\n ...style,\n }}\n >\n {children}\n </div>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* <TabPanel> */\n/* ------------------------------------------------------------------ */\n\nexport interface TabPanelProps {\n children: ReactNode;\n index: number;\n keepMounted?: boolean;\n style?: CSSProperties;\n className?: string;\n}\n\nexport const TabPanel: React.FC<TabPanelProps> = ({\n children,\n index,\n keepMounted = false,\n style,\n className,\n}) => {\n const { active } = useTabsContext();\n const isActive = index === active;\n\n if (!keepMounted && !isActive) return null;\n\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n className={clsx(\n isActive && \"tab-panel-active\",\n \"text-foreground\",\n className,\n )}\n style={{ display: isActive ? undefined : \"none\", ...style }}\n >\n {children}\n </div>\n );\n};\n","\"use client\";\n\nimport React from \"react\";\nimport { Sun, Moon } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type ThemeToggleContext = {\n isDark: boolean;\n toggleTheme: () => void;\n};\n\nexport type ThemeToggleProps = {\n context: ThemeToggleContext;\n className?: string;\n /** The sun icon (shown in dark mode). */\n sunClassName?: string;\n /** The moon icon (shown in light mode). */\n moonClassName?: string;\n};\n\nexport const ThemeToggleButton: React.FC<ThemeToggleProps> = ({\n context,\n className = \"\",\n sunClassName,\n moonClassName,\n}) => {\n const { isDark, toggleTheme } = context;\n\n return (\n <button\n onClick={toggleTheme}\n type=\"button\"\n aria-label={isDark ? \"Switch to light mode\" : \"Switch to dark mode\"}\n className={cn(\n \"relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full\",\n \"text-foreground transition-colors duration-200 hover:bg-accent\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n >\n {/* Only one icon is ever visible: it rotates and scales in as the other\n rotates and scales out, instead of sliding a thumb along a track. */}\n <Sun\n size={18}\n aria-hidden=\"true\"\n className={cn(\n \"absolute text-warning transition-all duration-300\",\n isDark ? \"rotate-0 scale-100 opacity-100\" : \"-rotate-90 scale-0 opacity-0\",\n sunClassName,\n )}\n />\n <Moon\n size={18}\n aria-hidden=\"true\"\n className={cn(\n \"absolute text-info transition-all duration-300\",\n isDark ? \"rotate-90 scale-0 opacity-0\" : \"rotate-0 scale-100 opacity-100\",\n moonClassName,\n )}\n />\n </button>\n );\n};\n\nexport default ThemeToggleButton;\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/* -------------------------------------------------------------------------- */\n/* 🧩 Types */\n/* -------------------------------------------------------------------------- */\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual style of the card surface. */\n variant?: \"default\" | \"outline\" | \"elevated\" | \"ghost\";\n /** Inner padding scale applied by the sub-components. */\n padding?: \"none\" | \"sm\" | \"md\" | \"lg\";\n /** Lift the card slightly on hover. */\n hoverable?: boolean;\n}\n\nexport interface CardSectionProps\n extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n}\n\nexport interface CardHeaderProps\n // `title` here is a ReactNode slot, not the native tooltip attribute.\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n title?: React.ReactNode;\n description?: React.ReactNode;\n icon?: React.ReactNode;\n /** Slot rendered at the far right of the header (menu, action button…). */\n action?: React.ReactNode;\n\n /** 🔥 Full Customization */\n iconClassName?: string;\n titleClassName?: string;\n descriptionClassName?: string;\n actionClassName?: string;\n}\n\n/* -------------------------------------------------------------------------- */\n/* 🃏 Card */\n/* -------------------------------------------------------------------------- */\n\nconst paddingContext = React.createContext<\"none\" | \"sm\" | \"md\" | \"lg\">(\"md\");\n\nconst SECTION_PADDING = {\n none: \"\",\n sm: \"px-4 py-3\",\n md: \"px-6 py-4\",\n lg: \"px-8 py-6\",\n} as const;\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n { variant = \"default\", padding = \"md\", hoverable = false, className, children, ...rest },\n ref,\n) {\n const variants = {\n default: \"bg-card text-card-foreground border border-border\",\n outline: \"bg-transparent text-foreground border border-border\",\n elevated:\n \"bg-card text-card-foreground border border-border shadow-lg shadow-black/5\",\n ghost: \"bg-muted/50 text-foreground border border-transparent\",\n } as const;\n\n return (\n <paddingContext.Provider value={padding}>\n <div\n ref={ref}\n className={cn(\n // No overflow-hidden: it clipped any Popover/Dropdown/DatePicker\n // rendered inside the card. The footer rounds itself instead.\n \"rounded-xl transition-shadow\",\n variants[variant] ?? variants.default,\n hoverable && \"hover:shadow-lg hover:shadow-black/10\",\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n </paddingContext.Provider>\n );\n});\n\nCard.displayName = \"Card\";\n\n/* -------------------------------------------------------------------------- */\n/* Sub-components */\n/* -------------------------------------------------------------------------- */\n\nexport const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(\n function CardHeader(\n {\n title,\n description,\n icon,\n action,\n className,\n iconClassName,\n titleClassName,\n descriptionClassName,\n actionClassName,\n children,\n ...rest\n },\n ref,\n ) {\n const padding = React.useContext(paddingContext);\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-start justify-between gap-3 border-b border-border\",\n SECTION_PADDING[padding],\n className,\n )}\n {...rest}\n >\n <div className=\"flex min-w-0 items-start gap-3\">\n {icon && (\n <span\n aria-hidden=\"true\"\n // h-6 matches the title's leading-6, so the icon is optically\n // centered on the title line whether or not a description exists\n // (a fixed mt nudge previously left it visibly high).\n className={cn(\n \"flex h-6 shrink-0 items-center text-primary [&_svg]:h-5 [&_svg]:w-5\",\n iconClassName,\n )}\n >\n {icon}\n </span>\n )}\n <div className=\"min-w-0\">\n {title && (\n <h3\n className={cn(\n \"text-sm font-semibold leading-6 text-foreground\",\n titleClassName,\n )}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n className={cn(\n \"text-xs text-muted-foreground\",\n descriptionClassName,\n )}\n >\n {description}\n </p>\n )}\n {children}\n </div>\n </div>\n {action && (\n <div className={cn(\"shrink-0\", actionClassName)}>{action}</div>\n )}\n </div>\n );\n },\n);\n\nCardHeader.displayName = \"CardHeader\";\n\nexport const CardBody = forwardRef<HTMLDivElement, CardSectionProps>(\n function CardBody({ className, children, ...rest }, ref) {\n const padding = React.useContext(paddingContext);\n return (\n <div ref={ref} className={cn(SECTION_PADDING[padding], className)} {...rest}>\n {children}\n </div>\n );\n },\n);\n\nCardBody.displayName = \"CardBody\";\n\nexport const CardFooter = forwardRef<HTMLDivElement, CardSectionProps>(\n function CardFooter({ className, children, ...rest }, ref) {\n const padding = React.useContext(paddingContext);\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center justify-end gap-3 border-t border-border bg-accent/40\",\n // The card no longer clips its children, so the tinted footer\n // rounds its own bottom corners to match the card radius.\n \"rounded-b-[inherit]\",\n SECTION_PADDING[padding],\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nCardFooter.displayName = \"CardFooter\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n /** Optional centered label — horizontal orientation only. */\n label?: React.ReactNode;\n dashed?: boolean;\n /** Vertical spacing (horizontal) or horizontal spacing (vertical). */\n spacing?: \"none\" | \"sm\" | \"md\" | \"lg\";\n\n /** 🔥 Full Customization (labeled horizontal variant only) */\n lineClassName?: string;\n labelClassName?: string;\n}\n\nconst H_SPACING = { none: \"my-0\", sm: \"my-2\", md: \"my-4\", lg: \"my-8\" } as const;\nconst V_SPACING = { none: \"mx-0\", sm: \"mx-2\", md: \"mx-4\", lg: \"mx-8\" } as const;\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n function Divider(\n {\n orientation = \"horizontal\",\n label,\n dashed = false,\n spacing = \"md\",\n className,\n lineClassName,\n labelClassName,\n ...rest\n },\n ref,\n ) {\n if (orientation === \"vertical\") {\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={cn(\n \"inline-block self-stretch w-px min-h-4 bg-border\",\n dashed && \"bg-transparent border-l border-dashed border-border\",\n V_SPACING[spacing],\n className,\n )}\n {...rest}\n />\n );\n }\n\n if (label) {\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n \"flex items-center gap-3 text-xs text-muted-foreground\",\n H_SPACING[spacing],\n className,\n )}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"h-px flex-1 bg-border\",\n dashed && \"bg-transparent border-t border-dashed border-border\",\n lineClassName,\n )}\n />\n <span className={cn(\"shrink-0\", labelClassName)}>{label}</span>\n <span\n aria-hidden=\"true\"\n className={cn(\n \"h-px flex-1 bg-border\",\n dashed && \"bg-transparent border-t border-dashed border-border\",\n lineClassName,\n )}\n />\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className={cn(\n \"h-px w-full bg-border\",\n dashed && \"bg-transparent border-t border-dashed border-border\",\n H_SPACING[spacing],\n className,\n )}\n {...rest}\n />\n );\n },\n);\n\nDivider.displayName = \"Divider\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface ChipProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> {\n label: React.ReactNode;\n variant?: \"solid\" | \"soft\" | \"outline\";\n color?: \"primary\" | \"neutral\" | \"destructive\" | \"success\";\n size?: \"sm\" | \"md\" | \"lg\";\n icon?: React.ReactNode;\n /** Renders a remove button and makes the chip dismissible. */\n onRemove?: () => void;\n disabled?: boolean;\n\n /** 🔥 Full Customization */\n iconClassName?: string;\n labelClassName?: string;\n removeButtonClassName?: string;\n removeIconClassName?: string;\n}\n\nconst SIZES = {\n sm: { root: \"h-6 px-2 text-[11px] gap-1\", icon: \"w-3 h-3\", remove: \"w-3 h-3\" },\n md: { root: \"h-7 px-2.5 text-xs gap-1.5\", icon: \"w-3.5 h-3.5\", remove: \"w-3.5 h-3.5\" },\n lg: { root: \"h-8 px-3 text-sm gap-2\", icon: \"w-4 h-4\", remove: \"w-4 h-4\" },\n} as const;\n\nconst COLORS = {\n primary: {\n solid: \"bg-primary text-primary-foreground\",\n soft: \"bg-primary/10 text-primary\",\n outline: \"border border-primary text-primary\",\n },\n neutral: {\n solid: \"bg-foreground text-background\",\n soft: \"bg-muted text-foreground\",\n outline: \"border border-border text-foreground\",\n },\n destructive: {\n solid: \"bg-destructive text-destructive-foreground\",\n soft: \"bg-destructive/10 text-destructive\",\n outline: \"border border-destructive text-destructive\",\n },\n success: {\n solid: \"bg-success text-success-foreground\",\n soft: \"bg-success/10 text-success\",\n outline: \"border border-success text-success\",\n },\n} as const;\n\nexport const Chip = forwardRef<HTMLSpanElement, ChipProps>(function Chip(\n {\n label,\n variant = \"soft\",\n color = \"primary\",\n size = \"md\",\n icon,\n onRemove,\n disabled = false,\n className,\n iconClassName,\n labelClassName,\n removeButtonClassName,\n removeIconClassName,\n ...rest\n },\n ref,\n) {\n const sizes = SIZES[size] ?? SIZES.md;\n const palette = COLORS[color] ?? COLORS.primary;\n\n return (\n <span\n ref={ref}\n className={cn(\n // max-w-full lets the label actually truncate inside narrow parents.\n \"inline-flex max-w-full items-center rounded-full font-medium select-none\",\n sizes.root,\n palette[variant] ?? palette.soft,\n disabled && \"opacity-50\",\n className,\n )}\n {...rest}\n >\n {icon && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"shrink-0 [&_svg]:w-full [&_svg]:h-full\",\n sizes.icon,\n iconClassName,\n )}\n >\n {icon}\n </span>\n )}\n <span className={cn(\"min-w-0 truncate\", labelClassName)}>{label}</span>\n {onRemove && (\n <button\n type=\"button\"\n aria-label={typeof label === \"string\" ? `Remove ${label}` : \"Remove\"}\n disabled={disabled}\n onClick={onRemove}\n className={cn(\n \"shrink-0 -mr-0.5 rounded-full opacity-70 transition-opacity\",\n \"hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n disabled && \"cursor-not-allowed\",\n removeButtonClassName,\n )}\n >\n <X aria-hidden=\"true\" className={cn(sizes.remove, removeIconClassName)} />\n </button>\n )}\n </span>\n );\n});\n\nChip.displayName = \"Chip\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface KbdProps extends React.HTMLAttributes<HTMLElement> {\n children: React.ReactNode;\n size?: \"sm\" | \"md\";\n}\n\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(function Kbd(\n { children, size = \"md\", className, ...rest },\n ref,\n) {\n return (\n <kbd\n ref={ref}\n className={cn(\n // align-middle: an inline-flex box otherwise sits on the text\n // baseline and hangs visibly low next to the surrounding words.\n \"inline-flex items-center justify-center align-middle whitespace-nowrap select-none\",\n \"rounded-md border border-border bg-muted font-mono font-medium leading-none text-muted-foreground\",\n // Key-cap depth: a solid bottom shadow instead of border-b-2, which in\n // the same color as the other borders just looked lopsided.\n \"shadow-[0_2px_0_0_var(--border)]\",\n size === \"sm\" ? \"min-w-5 h-5 px-1 text-[10px]\" : \"min-w-6 h-6 px-1.5 text-xs\",\n className,\n )}\n {...rest}\n >\n {children}\n </kbd>\n );\n});\n\nKbd.displayName = \"Kbd\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: \"text\" | \"circular\" | \"rectangular\";\n width?: number | string;\n height?: number | string;\n /** For variant=\"text\": number of stacked lines (last one is shorter). */\n lines?: number;\n /** Disable the pulse animation. */\n animated?: boolean;\n /** Applied to each individual line when variant=\"text\" and lines > 1. */\n lineClassName?: string;\n}\n\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n function Skeleton(\n {\n variant = \"text\",\n width,\n height,\n lines = 1,\n animated = true,\n className,\n lineClassName,\n style,\n ...rest\n },\n ref,\n ) {\n const base = cn(\n \"bg-muted\",\n animated && \"animate-pulse motion-reduce:animate-none\",\n );\n\n if (variant === \"text\" && lines > 1) {\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\"w-full space-y-2\", className)}\n style={{ width, ...style }}\n {...rest}\n >\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className={cn(\n base,\n \"h-4 rounded\",\n // Shorter last line reads as a paragraph, not a block.\n i === lines - 1 ? \"w-3/5\" : \"w-full\",\n lineClassName,\n )}\n />\n ))}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n base,\n variant === \"circular\" && \"rounded-full\",\n variant === \"rectangular\" && \"rounded-lg\",\n variant === \"text\" && \"h-4 rounded\",\n className,\n )}\n style={{\n width: width ?? (variant === \"circular\" ? 40 : \"100%\"),\n height:\n height ?? (variant === \"circular\" ? 40 : variant === \"rectangular\" ? 96 : undefined),\n ...style,\n }}\n {...rest}\n />\n );\n },\n);\n\nSkeleton.displayName = \"Skeleton\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Accessible label announced to screen readers. */\n label?: string;\n /** Stroke color class; defaults to the current text color. */\n colorClassName?: string;\n /** Applied to the visually-hidden (sr-only) accessible label. */\n labelClassName?: string;\n}\n\nconst SIZES = {\n xs: \"w-3 h-3 border-2\",\n sm: \"w-4 h-4 border-2\",\n md: \"w-6 h-6 border-2\",\n lg: \"w-8 h-8 border-[3px]\",\n xl: \"w-12 h-12 border-4\",\n} as const;\n\nexport const Spinner = forwardRef<HTMLSpanElement, SpinnerProps>(\n function Spinner(\n {\n size = \"md\",\n label = \"Loading…\",\n colorClassName,\n labelClassName,\n className,\n ...rest\n },\n ref,\n ) {\n return (\n <span\n ref={ref}\n role=\"status\"\n className={cn(\"inline-flex items-center justify-center\", className)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"inline-block rounded-full border-current border-t-transparent animate-spin motion-reduce:animate-[spin_1.5s_linear_infinite]\",\n SIZES[size] ?? SIZES.md,\n colorClassName ?? \"text-primary\",\n )}\n />\n <span className={cn(\"sr-only\", labelClassName)}>{label}</span>\n </span>\n );\n },\n);\n\nSpinner.displayName = \"Spinner\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface ProgressProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** 0–max. Omit (undefined) for an indeterminate bar. */\n value?: number;\n max?: number;\n variant?: \"linear\" | \"circular\";\n size?: \"sm\" | \"md\" | \"lg\";\n /** Show the percentage next to (linear) or inside (circular) the track. */\n showValue?: boolean;\n /** Accessible label for the progress bar. */\n label?: string;\n colorClassName?: string;\n /** The track behind the fill/indicator (the muted background). */\n trackClassName?: string;\n /** The filled portion (linear bar or circular arc), alongside `colorClassName`. */\n fillClassName?: string;\n /** The percentage text shown when `showValue` is set. */\n valueClassName?: string;\n}\n\nconst LINEAR_SIZES = { sm: \"h-1\", md: \"h-2\", lg: \"h-3\" } as const;\nconst CIRCULAR_SIZES = { sm: 32, md: 48, lg: 64 } as const;\n\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n function Progress(\n {\n value,\n max = 100,\n variant = \"linear\",\n size = \"md\",\n showValue = false,\n label,\n colorClassName,\n trackClassName,\n fillClassName,\n valueClassName,\n className,\n ...rest\n },\n ref,\n ) {\n const indeterminate = value === undefined || value === null;\n const clamped = indeterminate ? 0 : Math.min(Math.max(value, 0), max);\n const percent = indeterminate ? 0 : Math.round((clamped / max) * 100);\n\n const ariaProps = {\n role: \"progressbar\" as const,\n \"aria-label\": label,\n \"aria-valuemin\": 0,\n \"aria-valuemax\": max,\n \"aria-valuenow\": indeterminate ? undefined : clamped,\n };\n\n if (variant === \"circular\") {\n const box = CIRCULAR_SIZES[size] ?? CIRCULAR_SIZES.md;\n const stroke = size === \"sm\" ? 3 : 4;\n const radius = (box - stroke) / 2;\n const circumference = 2 * Math.PI * radius;\n const offset = circumference * (1 - percent / 100);\n\n return (\n <div\n ref={ref}\n {...ariaProps}\n className={cn(\n \"relative inline-flex items-center justify-center\",\n className,\n )}\n {...rest}\n >\n <svg\n width={box}\n height={box}\n viewBox={`0 0 ${box} ${box}`}\n className={cn(indeterminate && \"animate-spin\")}\n aria-hidden=\"true\"\n >\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n strokeWidth={stroke}\n className={cn(\"stroke-muted\", trackClassName)}\n />\n <circle\n cx={box / 2}\n cy={box / 2}\n r={radius}\n fill=\"none\"\n strokeWidth={stroke}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : offset}\n transform={`rotate(-90 ${box / 2} ${box / 2})`}\n className={cn(\n \"transition-[stroke-dashoffset] duration-300\",\n colorClassName ?? \"stroke-primary\",\n fillClassName,\n )}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className={cn(\n \"absolute font-semibold tabular-nums text-foreground\",\n size === \"lg\" ? \"text-xs\" : \"text-[10px]\",\n valueClassName,\n )}\n >\n {percent}%\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n className={cn(\"flex w-full items-center gap-3\", className)}\n {...rest}\n >\n <div\n {...ariaProps}\n className={cn(\n \"w-full overflow-hidden rounded-full bg-muted\",\n LINEAR_SIZES[size] ?? LINEAR_SIZES.md,\n trackClassName,\n )}\n >\n <div\n className={cn(\n \"h-full rounded-full transition-[width] duration-300\",\n colorClassName ?? \"bg-primary\",\n indeterminate &&\n \"w-1/3 animate-[progress-indeterminate_1.2s_ease-in-out_infinite] motion-reduce:animate-none\",\n fillClassName,\n )}\n style={indeterminate ? undefined : { width: `${percent}%` }}\n />\n </div>\n {showValue && !indeterminate && (\n <span\n className={cn(\n \"shrink-0 text-xs font-medium tabular-nums text-muted-foreground\",\n valueClassName,\n )}\n >\n {percent}%\n </span>\n )}\n </div>\n );\n },\n);\n\nProgress.displayName = \"Progress\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { TrendingUp, TrendingDown, Minus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface StatProps extends React.HTMLAttributes<HTMLDivElement> {\n label: React.ReactNode;\n value: React.ReactNode;\n icon?: React.ReactNode;\n /** Direction of the change indicator. */\n trend?: \"up\" | \"down\" | \"neutral\";\n /** e.g. \"+12.5%\" — rendered next to the trend arrow. */\n trendValue?: React.ReactNode;\n /** Small helper line under the value (e.g. \"vs last month\"). */\n description?: React.ReactNode;\n /** Renders the stat inside a bordered card surface. */\n bordered?: boolean;\n\n /** 🔥 Full Customization */\n headerClassName?: string;\n labelClassName?: string;\n iconClassName?: string;\n valueClassName?: string;\n footerClassName?: string;\n trendClassName?: string;\n trendIconClassName?: string;\n descriptionClassName?: string;\n}\n\nexport const Stat = forwardRef<HTMLDivElement, StatProps>(function Stat(\n {\n label,\n value,\n icon,\n trend,\n trendValue,\n description,\n bordered = true,\n className,\n headerClassName,\n labelClassName,\n iconClassName,\n valueClassName,\n footerClassName,\n trendClassName,\n trendIconClassName,\n descriptionClassName,\n ...rest\n },\n ref,\n) {\n const TrendIcon =\n trend === \"up\" ? TrendingUp : trend === \"down\" ? TrendingDown : Minus;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"min-w-0\",\n bordered && \"rounded-xl border border-border bg-card p-5\",\n className,\n )}\n {...rest}\n >\n <div className={cn(\"flex items-start justify-between gap-3\", headerClassName)}>\n <p\n className={cn(\n \"text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n labelClassName,\n )}\n >\n {label}\n </p>\n {icon && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"shrink-0 rounded-lg bg-primary/10 p-2 text-primary [&_svg]:h-4 [&_svg]:w-4\",\n iconClassName,\n )}\n >\n {icon}\n </span>\n )}\n </div>\n\n <p\n className={cn(\n \"mt-2 truncate text-2xl font-bold tabular-nums text-foreground\",\n valueClassName,\n )}\n >\n {value}\n </p>\n\n {(trend || description) && (\n <div\n className={cn(\n \"mt-2 flex flex-wrap items-center gap-2 text-xs\",\n footerClassName,\n )}\n >\n {trend && (\n <span\n className={cn(\n \"inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 font-medium\",\n trend === \"up\" && \"bg-success/10 text-success\",\n trend === \"down\" && \"bg-destructive/10 text-destructive\",\n trend === \"neutral\" && \"bg-muted text-muted-foreground\",\n trendClassName,\n )}\n >\n <TrendIcon aria-hidden=\"true\" className={cn(\"h-3 w-3\", trendIconClassName)} />\n {trendValue}\n </span>\n )}\n {description && (\n <span className={cn(\"text-muted-foreground\", descriptionClassName)}>\n {description}\n </span>\n )}\n </div>\n )}\n </div>\n );\n});\n\nStat.displayName = \"Stat\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { Inbox } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface EmptyStateProps\n // `title` here is a ReactNode slot, not the native tooltip attribute.\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n icon?: React.ReactNode;\n title: React.ReactNode;\n description?: React.ReactNode;\n /** Call-to-action slot (usually a <Button />). */\n action?: React.ReactNode;\n size?: \"sm\" | \"md\" | \"lg\";\n\n iconClassName?: string;\n titleClassName?: string;\n descriptionClassName?: string;\n actionClassName?: string;\n}\n\nconst SIZES = {\n sm: { root: \"py-8 px-4\", icon: \"h-10 w-10 [&_svg]:h-5 [&_svg]:w-5\", title: \"text-sm\", desc: \"text-xs max-w-xs\" },\n md: { root: \"py-12 px-6\", icon: \"h-12 w-12 [&_svg]:h-6 [&_svg]:w-6\", title: \"text-base\", desc: \"text-sm max-w-sm\" },\n lg: { root: \"py-16 px-8\", icon: \"h-14 w-14 [&_svg]:h-7 [&_svg]:w-7\", title: \"text-lg\", desc: \"text-sm max-w-md\" },\n} as const;\n\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(\n function EmptyState(\n {\n icon,\n title,\n description,\n action,\n size = \"md\",\n className,\n iconClassName,\n titleClassName,\n descriptionClassName,\n actionClassName,\n ...rest\n },\n ref,\n ) {\n const sizes = SIZES[size] ?? SIZES.md;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex w-full flex-col items-center justify-center text-center\",\n sizes.root,\n className,\n )}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"mb-4 inline-flex items-center justify-center rounded-full bg-muted text-muted-foreground\",\n sizes.icon,\n iconClassName,\n )}\n >\n {icon ?? <Inbox />}\n </span>\n\n <h3 className={cn(\"font-semibold text-foreground\", sizes.title, titleClassName)}>\n {title}\n </h3>\n\n {description && (\n <p className={cn(\"mt-1 text-muted-foreground\", sizes.desc, descriptionClassName)}>\n {description}\n </p>\n )}\n\n {action && <div className={cn(\"mt-5\", actionClassName)}>{action}</div>}\n </div>\n );\n },\n);\n\nEmptyState.displayName = \"EmptyState\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TimelineItem {\n title: React.ReactNode;\n description?: React.ReactNode;\n /** Timestamp or meta text shown next to the title. */\n time?: React.ReactNode;\n icon?: React.ReactNode;\n status?: \"done\" | \"active\" | \"pending\";\n}\n\nexport interface TimelineProps\n extends Omit<React.HTMLAttributes<HTMLOListElement>, \"children\"> {\n items: TimelineItem[];\n size?: \"sm\" | \"md\";\n\n /** Each `<li>` row. */\n itemClassName?: string;\n /** The vertical connector line between dots. */\n connectorClassName?: string;\n /** The status dot/icon bubble. */\n dotClassName?: string;\n /** Wrapper around the title/time/description block. */\n contentClassName?: string;\n /** Item title. */\n titleClassName?: string;\n /** Timestamp/meta text next to the title. */\n timeClassName?: string;\n /** Item description. */\n descriptionClassName?: string;\n}\n\nconst DOT = {\n done: \"bg-primary text-primary-foreground border-primary\",\n active: \"bg-primary/15 text-primary border-primary\",\n pending: \"bg-muted text-muted-foreground border-border\",\n} as const;\n\nexport const Timeline = forwardRef<HTMLOListElement, TimelineProps>(\n function Timeline(\n {\n items,\n size = \"md\",\n className,\n itemClassName,\n connectorClassName,\n dotClassName,\n contentClassName,\n titleClassName,\n timeClassName,\n descriptionClassName,\n ...rest\n },\n ref,\n ) {\n const compact = size === \"sm\";\n\n return (\n <ol ref={ref} className={cn(\"relative\", className)} {...rest}>\n {items.map((item, i) => {\n const status = item.status ?? \"pending\";\n const isLast = i === items.length - 1;\n\n return (\n <li\n key={i}\n className={cn(\n \"relative flex gap-4\",\n !isLast && (compact ? \"pb-6\" : \"pb-8\"),\n itemClassName,\n )}\n >\n {/* Connector line */}\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute top-8 bottom-0 w-px bg-border\",\n // left = half the dot width, so the line runs through the\n // dot's center at both sizes.\n compact ? \"left-3.5 top-7\" : \"left-4\",\n connectorClassName,\n )}\n />\n )}\n\n {/* Dot */}\n <span\n aria-hidden=\"true\"\n className={cn(\n \"relative z-10 flex shrink-0 items-center justify-center rounded-full border\",\n compact ? \"h-7 w-7 [&_svg]:h-3 [&_svg]:w-3\" : \"h-8 w-8 [&_svg]:h-3.5 [&_svg]:w-3.5\",\n DOT[status],\n dotClassName,\n )}\n >\n {item.icon ?? (status === \"done\" ? <Check /> : (\n <span\n className={cn(\n \"rounded-full\",\n compact ? \"h-1.5 w-1.5\" : \"h-2 w-2\",\n status === \"active\" ? \"bg-primary\" : \"bg-muted-foreground/50\",\n )}\n />\n ))}\n </span>\n\n {/* Content */}\n <div className={cn(\"min-w-0 flex-1 pt-1\", contentClassName)}>\n <div className=\"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5\">\n <h4\n className={cn(\n \"font-medium\",\n compact ? \"text-sm\" : \"text-sm\",\n status === \"pending\"\n ? \"text-muted-foreground\"\n : \"text-foreground\",\n titleClassName,\n )}\n >\n {item.title}\n </h4>\n {item.time && (\n <span\n className={cn(\n \"text-xs text-muted-foreground\",\n timeClassName,\n )}\n >\n {item.time}\n </span>\n )}\n </div>\n {item.description && (\n <p\n className={cn(\n \"mt-1 text-xs leading-relaxed text-muted-foreground\",\n descriptionClassName,\n )}\n >\n {item.description}\n </p>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n );\n },\n);\n\nTimeline.displayName = \"Timeline\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface BreadcrumbItem {\n label: React.ReactNode;\n href?: string;\n icon?: React.ReactNode;\n /** SPA navigation hook — called instead of full page loads when provided. */\n onClick?: (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;\n}\n\nexport interface BreadcrumbProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n items: BreadcrumbItem[];\n separator?: React.ReactNode;\n /** Collapse the middle into an ellipsis when there are more items than this. */\n maxItems?: number;\n size?: \"sm\" | \"md\";\n\n /** 🔥 Full Customization */\n listClassName?: string;\n itemClassName?: string;\n activeItemClassName?: string;\n triggerClassName?: string;\n iconClassName?: string;\n labelClassName?: string;\n separatorClassName?: string;\n ellipsisClassName?: string;\n}\n\nconst SIZES = {\n sm: { text: \"text-xs\", icon: \"[&_svg]:h-3 [&_svg]:w-3\", sep: \"h-3 w-3\" },\n md: { text: \"text-sm\", icon: \"[&_svg]:h-3.5 [&_svg]:w-3.5\", sep: \"h-3.5 w-3.5\" },\n} as const;\n\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(\n function Breadcrumb(\n {\n items,\n separator,\n maxItems,\n size = \"md\",\n className,\n listClassName,\n itemClassName,\n activeItemClassName,\n triggerClassName,\n iconClassName,\n labelClassName,\n separatorClassName,\n ellipsisClassName,\n ...rest\n },\n ref,\n ) {\n const sizes = SIZES[size] ?? SIZES.md;\n\n // Keep the first item and the trailing (maxItems - 1); an ellipsis marks\n // the collapsed middle.\n let visible: (BreadcrumbItem | \"ellipsis\")[] = items;\n if (maxItems && maxItems >= 2 && items.length > maxItems) {\n visible = [\n items[0],\n \"ellipsis\",\n ...items.slice(items.length - (maxItems - 1)),\n ];\n }\n\n return (\n <nav\n ref={ref}\n aria-label=\"Breadcrumb\"\n className={cn(\"min-w-0\", className)}\n {...rest}\n >\n <ol\n className={cn(\n \"flex flex-wrap items-center gap-1.5\",\n sizes.text,\n listClassName,\n )}\n >\n {visible.map((item, i) => {\n if (item === \"ellipsis\") {\n return (\n <li\n key=\"ellipsis\"\n className={cn(\n \"flex items-center gap-1.5 text-muted-foreground\",\n ellipsisClassName,\n )}\n >\n <MoreHorizontal\n aria-hidden=\"true\"\n className={sizes.sep}\n />\n <ChevronRight aria-hidden=\"true\" className={cn(sizes.sep, \"opacity-60\")} />\n </li>\n );\n }\n\n const isLast = i === visible.length - 1;\n const content = (\n <>\n {item.icon && (\n <span\n aria-hidden=\"true\"\n className={cn(\"shrink-0\", sizes.icon, iconClassName)}\n >\n {item.icon}\n </span>\n )}\n <span className={cn(\"truncate\", labelClassName)}>\n {item.label}\n </span>\n </>\n );\n\n return (\n <li\n key={`${i}-${typeof item.label === \"string\" ? item.label : \"item\"}`}\n className={cn(\"flex min-w-0 items-center gap-1.5\", itemClassName)}\n >\n {isLast ? (\n <span\n aria-current=\"page\"\n className={cn(\n \"flex min-w-0 items-center gap-1.5 font-medium text-foreground\",\n activeItemClassName,\n )}\n >\n {content}\n </span>\n ) : item.href ? (\n <a\n href={item.href}\n onClick={item.onClick}\n className={cn(\n \"flex min-w-0 items-center gap-1.5 rounded text-muted-foreground transition-colors\",\n \"hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n triggerClassName,\n )}\n >\n {content}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={item.onClick}\n className={cn(\n \"flex min-w-0 items-center gap-1.5 rounded text-muted-foreground transition-colors\",\n \"hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n triggerClassName,\n )}\n >\n {content}\n </button>\n )}\n\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"shrink-0 text-muted-foreground/60\",\n separatorClassName,\n )}\n >\n {separator ?? <ChevronRight className={sizes.sep} />}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n },\n);\n\nBreadcrumb.displayName = \"Breadcrumb\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface PaginationProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"onChange\"> {\n /** Current page, 1-based. */\n page: number;\n totalPages: number;\n onPageChange?: (page: number) => void;\n /** How many pages to show on each side of the current page. */\n siblingCount?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n prevButtonClassName?: string;\n nextButtonClassName?: string;\n /** Applied to every numbered page button, in addition to the active/inactive styling. */\n pageButtonClassName?: string;\n activePageButtonClassName?: string;\n ellipsisClassName?: string;\n}\n\nconst SIZES = {\n sm: \"h-7 min-w-7 px-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\",\n md: \"h-9 min-w-9 px-1.5 text-sm [&_svg]:h-4 [&_svg]:w-4\",\n lg: \"h-11 min-w-11 px-2 text-base [&_svg]:h-5 [&_svg]:w-5\",\n} as const;\n\n/** Builds the visible page list: 1 … siblings around current … last. */\nconst buildRange = (\n page: number,\n totalPages: number,\n siblingCount: number,\n): (number | \"ellipsis-l\" | \"ellipsis-r\")[] => {\n // Everything fits without ellipses.\n const maxVisible = siblingCount * 2 + 5;\n if (totalPages <= maxVisible) {\n return Array.from({ length: totalPages }, (_, i) => i + 1);\n }\n\n const start = Math.max(page - siblingCount, 1);\n const end = Math.min(page + siblingCount, totalPages);\n const showLeftEllipsis = start > 2;\n const showRightEllipsis = end < totalPages - 1;\n\n const middle: number[] = [];\n for (\n let i = showLeftEllipsis ? start : 1;\n i <= (showRightEllipsis ? end : totalPages);\n i++\n ) {\n middle.push(i);\n }\n\n return [\n ...(showLeftEllipsis ? [1, \"ellipsis-l\" as const] : []),\n ...middle,\n ...(showRightEllipsis ? [\"ellipsis-r\" as const, totalPages] : []),\n ];\n};\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n function Pagination(\n {\n page,\n totalPages,\n onPageChange,\n siblingCount = 1,\n size = \"md\",\n disabled = false,\n className,\n prevButtonClassName,\n nextButtonClassName,\n pageButtonClassName,\n activePageButtonClassName,\n ellipsisClassName,\n ...rest\n },\n ref,\n ) {\n if (totalPages < 1) return null;\n\n const clampedPage = Math.min(Math.max(page, 1), totalPages);\n const items = buildRange(clampedPage, totalPages, Math.max(siblingCount, 0));\n const sizeClasses = SIZES[size] ?? SIZES.md;\n\n const go = (next: number) => {\n if (disabled) return;\n const target = Math.min(Math.max(next, 1), totalPages);\n if (target !== clampedPage) onPageChange?.(target);\n };\n\n const baseButton = cn(\n \"inline-flex items-center justify-center rounded-lg font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-40\",\n sizeClasses,\n );\n\n return (\n <nav\n ref={ref}\n aria-label=\"Pagination\"\n // flex-wrap: long ranges fold to a second row on narrow screens\n // instead of overflowing the container.\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...rest}\n >\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n disabled={disabled || clampedPage <= 1}\n onClick={() => go(clampedPage - 1)}\n className={cn(\n baseButton,\n \"text-muted-foreground hover:bg-accent hover:text-foreground\",\n prevButtonClassName,\n )}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </button>\n\n {items.map((item) =>\n typeof item !== \"number\" ? (\n <span\n key={item}\n aria-hidden=\"true\"\n className={cn(\n \"inline-flex items-center justify-center text-muted-foreground\",\n sizeClasses,\n ellipsisClassName,\n )}\n >\n <MoreHorizontal />\n </span>\n ) : (\n <button\n key={item}\n type=\"button\"\n aria-label={`Page ${item}`}\n aria-current={item === clampedPage ? \"page\" : undefined}\n disabled={disabled}\n onClick={() => go(item)}\n className={cn(\n baseButton,\n \"tabular-nums\",\n item === clampedPage\n ? \"bg-primary text-primary-foreground\"\n : \"text-muted-foreground hover:bg-accent hover:text-foreground\",\n pageButtonClassName,\n item === clampedPage && activePageButtonClassName,\n )}\n >\n {item}\n </button>\n ),\n )}\n\n <button\n type=\"button\"\n aria-label=\"Next page\"\n disabled={disabled || clampedPage >= totalPages}\n onClick={() => go(clampedPage + 1)}\n className={cn(\n baseButton,\n \"text-muted-foreground hover:bg-accent hover:text-foreground\",\n nextButtonClassName,\n )}\n >\n <ChevronRight aria-hidden=\"true\" />\n </button>\n </nav>\n );\n },\n);\n\nPagination.displayName = \"Pagination\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface StepperStep {\n label: React.ReactNode;\n description?: React.ReactNode;\n icon?: React.ReactNode;\n}\n\nexport interface StepperProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n steps: StepperStep[];\n /** Index of the current step (0-based). Steps before it render as done. */\n activeStep: number;\n /** Makes completed steps clickable for navigation. */\n onStepClick?: (index: number) => void;\n orientation?: \"horizontal\" | \"vertical\";\n size?: \"sm\" | \"md\";\n\n /** 🔥 Full Customization */\n /** Wraps each individual step (indicator + content). */\n itemClassName?: string;\n /** The circular step indicator/dot. */\n dotClassName?: string;\n /** The `<button>` wrapping a clickable (completed) dot. */\n dotButtonClassName?: string;\n /** The connector line between steps. */\n connectorClassName?: string;\n /** Wraps a step's label + description. */\n contentClassName?: string;\n labelClassName?: string;\n descriptionClassName?: string;\n}\n\nconst SIZES = {\n sm: { dot: \"h-7 w-7 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\", label: \"text-xs\", desc: \"text-[11px]\" },\n md: { dot: \"h-9 w-9 text-sm [&_svg]:h-4 [&_svg]:w-4\", label: \"text-sm\", desc: \"text-xs\" },\n} as const;\n\nexport const Stepper = forwardRef<HTMLDivElement, StepperProps>(\n function Stepper(\n {\n steps,\n activeStep,\n onStepClick,\n orientation = \"horizontal\",\n size = \"md\",\n className,\n itemClassName,\n dotClassName,\n dotButtonClassName,\n connectorClassName,\n contentClassName,\n labelClassName,\n descriptionClassName,\n ...rest\n },\n ref,\n ) {\n const sizes = SIZES[size] ?? SIZES.md;\n const vertical = orientation === \"vertical\";\n\n const renderDot = (index: number, step: StepperStep) => {\n const done = index < activeStep;\n const active = index === activeStep;\n const clickable = Boolean(onStepClick) && done;\n\n const dot = (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-full border-2 font-semibold transition-colors\",\n sizes.dot,\n done && \"border-primary bg-primary text-primary-foreground\",\n active && \"border-primary bg-primary/10 text-primary\",\n !done && !active && \"border-border bg-transparent text-muted-foreground\",\n dotClassName,\n )}\n >\n {done ? <Check /> : step.icon ?? index + 1}\n </span>\n );\n\n if (!clickable) return dot;\n return (\n <button\n type=\"button\"\n onClick={() => onStepClick?.(index)}\n aria-label={\n typeof step.label === \"string\" ? `Go to step: ${step.label}` : `Go to step ${index + 1}`\n }\n className={cn(\n \"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n dotButtonClassName,\n )}\n >\n {dot}\n </button>\n );\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n vertical ? \"flex flex-col\" : \"flex w-full items-start\",\n className,\n )}\n {...rest}\n >\n {steps.map((step, i) => {\n const done = i < activeStep;\n const active = i === activeStep;\n const isLast = i === steps.length - 1;\n\n if (vertical) {\n return (\n <div key={i} className={cn(\"flex gap-3\", itemClassName)}>\n <div className=\"flex flex-col items-center\">\n {renderDot(i, step)}\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"my-1 w-0.5 flex-1 min-h-6 rounded-full\",\n done ? \"bg-primary\" : \"bg-border\",\n connectorClassName,\n )}\n />\n )}\n </div>\n <div\n className={cn(\n \"min-w-0 pb-6 pt-1\",\n isLast && \"pb-0\",\n contentClassName,\n )}\n >\n <p\n aria-current={active ? \"step\" : undefined}\n className={cn(\n \"font-medium\",\n sizes.label,\n active || done ? \"text-foreground\" : \"text-muted-foreground\",\n labelClassName,\n )}\n >\n {step.label}\n </p>\n {step.description && (\n <p\n className={cn(\n \"mt-0.5 text-muted-foreground\",\n sizes.desc,\n descriptionClassName,\n )}\n >\n {step.description}\n </p>\n )}\n </div>\n </div>\n );\n }\n\n return (\n <React.Fragment key={i}>\n <div\n className={cn(\n \"flex min-w-0 flex-col items-center gap-2 text-center\",\n itemClassName,\n )}\n >\n {renderDot(i, step)}\n <div className={cn(\"min-w-0\", contentClassName)}>\n <p\n aria-current={active ? \"step\" : undefined}\n className={cn(\n \"font-medium\",\n sizes.label,\n active || done ? \"text-foreground\" : \"text-muted-foreground\",\n labelClassName,\n )}\n >\n {step.label}\n </p>\n {step.description && (\n <p\n className={cn(\n \"mt-0.5 text-muted-foreground\",\n sizes.desc,\n descriptionClassName,\n )}\n >\n {step.description}\n </p>\n )}\n </div>\n </div>\n\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"mx-2 mt-4 h-0.5 flex-1 rounded-full\",\n size === \"sm\" && \"mt-3.5\",\n done ? \"bg-primary\" : \"bg-border\",\n connectorClassName,\n )}\n />\n )}\n </React.Fragment>\n );\n })}\n </div>\n );\n },\n);\n\nStepper.displayName = \"Stepper\";\n","\"use client\";\n\nimport React, { useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TooltipProps {\n /** Tooltip text/content. */\n content: React.ReactNode;\n children: React.ReactNode;\n position?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** Delay before showing, in ms. */\n delay?: number;\n disabled?: boolean;\n className?: string;\n contentClassName?: string;\n /** The small triangular pointer on the tooltip bubble. */\n arrowClassName?: string;\n}\n\nconst POSITIONS = {\n top: \"bottom-full left-1/2 -translate-x-1/2 mb-2\",\n bottom: \"top-full left-1/2 -translate-x-1/2 mt-2\",\n left: \"right-full top-1/2 -translate-y-1/2 mr-2\",\n right: \"left-full top-1/2 -translate-y-1/2 ml-2\",\n} as const;\n\nconst ARROWS = {\n top: \"top-full left-1/2 -translate-x-1/2 border-t-foreground border-x-transparent border-b-transparent\",\n bottom: \"bottom-full left-1/2 -translate-x-1/2 border-b-foreground border-x-transparent border-t-transparent\",\n left: \"left-full top-1/2 -translate-y-1/2 border-l-foreground border-y-transparent border-r-transparent\",\n right: \"right-full top-1/2 -translate-y-1/2 border-r-foreground border-y-transparent border-l-transparent\",\n} as const;\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n content,\n children,\n position = \"top\",\n delay = 150,\n disabled = false,\n className,\n contentClassName,\n arrowClassName,\n}) => {\n const tooltipId = useId();\n const [visible, setVisible] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const show = () => {\n if (disabled) return;\n timer.current = setTimeout(() => setVisible(true), delay);\n };\n\n const hide = () => {\n if (timer.current) clearTimeout(timer.current);\n setVisible(false);\n };\n\n // Clear the pending show-timer on unmount, and let Escape dismiss an open\n // tooltip (a WCAG 1.4.13 requirement).\n useEffect(() => {\n if (!visible) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") hide();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [visible]);\n\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n return (\n <span\n className={cn(\"relative inline-flex\", className)}\n onMouseEnter={show}\n onMouseLeave={hide}\n onFocus={show}\n onBlur={hide}\n aria-describedby={visible ? tooltipId : undefined}\n >\n {children}\n\n {visible && !disabled && (\n <span\n id={tooltipId}\n role=\"tooltip\"\n className={cn(\n \"pointer-events-none absolute z-50 w-max max-w-60 rounded-md px-2.5 py-1.5\",\n // break-words: a long unbroken token (URL, hash) wraps instead of\n // stretching the bubble past max-w.\n \"bg-foreground text-background text-xs font-medium shadow-lg wrap-break-word\",\n \"animate-in fade-in\",\n POSITIONS[position] ?? POSITIONS.top,\n contentClassName,\n )}\n >\n {content}\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute border-4\",\n ARROWS[position] ?? ARROWS.top,\n arrowClassName,\n )}\n />\n </span>\n )}\n </span>\n );\n};\n\nTooltip.displayName = \"Tooltip\";\n","\"use client\";\n\nimport React, {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface PopoverProps {\n /** Element that toggles the popover. */\n trigger: React.ReactNode;\n children: React.ReactNode;\n position?: \"top\" | \"bottom\" | \"left\" | \"right\";\n align?: \"start\" | \"center\" | \"end\";\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeOnClickOutside?: boolean;\n closeOnEscape?: boolean;\n disabled?: boolean;\n className?: string;\n /** The wrapper around `trigger` that handles open/close interactions. */\n triggerClassName?: string;\n contentClassName?: string;\n contentStyle?: React.CSSProperties;\n}\n\nconst POSITIONS = {\n top: { start: \"bottom-full left-0 mb-2\", center: \"bottom-full left-1/2 -translate-x-1/2 mb-2\", end: \"bottom-full right-0 mb-2\" },\n bottom: { start: \"top-full left-0 mt-2\", center: \"top-full left-1/2 -translate-x-1/2 mt-2\", end: \"top-full right-0 mt-2\" },\n left: { start: \"right-full top-0 mr-2\", center: \"right-full top-1/2 -translate-y-1/2 mr-2\", end: \"right-full bottom-0 mr-2\" },\n right: { start: \"left-full top-0 ml-2\", center: \"left-full top-1/2 -translate-y-1/2 ml-2\", end: \"left-full bottom-0 ml-2\" },\n} as const;\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(\n function Popover(\n {\n trigger,\n children,\n position = \"bottom\",\n align = \"center\",\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n closeOnClickOutside = true,\n closeOnEscape = true,\n disabled = false,\n className,\n triggerClassName,\n contentClassName,\n contentStyle,\n },\n ref,\n ) {\n const panelId = useId();\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : internalOpen;\n\n // Ref-routed setter so document listeners never hold a stale onOpenChange.\n const setOpenRef = useRef((next: boolean) => {\n if (!isControlled) setInternalOpen(next);\n onOpenChange?.(next);\n });\n setOpenRef.current = (next: boolean) => {\n if (!isControlled) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n useEffect(() => {\n if (!open) return;\n\n const onMouseDown = (e: MouseEvent) => {\n if (!closeOnClickOutside) return;\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) {\n setOpenRef.current(false);\n }\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (closeOnEscape && e.key === \"Escape\") setOpenRef.current(false);\n };\n\n document.addEventListener(\"mousedown\", onMouseDown);\n document.addEventListener(\"keydown\", onKeyDown);\n return () => {\n document.removeEventListener(\"mousedown\", onMouseDown);\n document.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [open, closeOnClickOutside, closeOnEscape]);\n\n return (\n <div\n ref={(el) => {\n rootRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n }}\n className={cn(\"relative inline-flex\", className)}\n >\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? panelId : undefined}\n onClick={() => !disabled && setOpenRef.current(!open)}\n onKeyDown={(e) => {\n if (disabled) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n setOpenRef.current(!open);\n }\n }}\n className={cn(\n \"inline-flex rounded-lg\",\n disabled && \"cursor-not-allowed opacity-50\",\n triggerClassName,\n )}\n >\n {trigger}\n </div>\n\n {open && (\n <div\n id={panelId}\n role=\"dialog\"\n className={cn(\n \"absolute z-50 min-w-48 rounded-xl border border-border bg-popover p-4\",\n \"text-sm text-popover-foreground shadow-xl\",\n \"animate-in fade-in\",\n POSITIONS[position]?.[align] ?? POSITIONS.bottom.center,\n contentClassName,\n )}\n style={contentStyle}\n >\n {children}\n </div>\n )}\n </div>\n );\n },\n);\n\nPopover.displayName = \"Popover\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface SliderProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"defaultValue\" | \"onChange\" | \"size\" | \"type\"\n > {\n value?: number;\n defaultValue?: number;\n onChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n label?: string;\n /** Show the current value at the right edge of the label row. */\n showValue?: boolean;\n /** Format the displayed value (e.g. v => `${v}%`). */\n formatValue?: (value: number) => React.ReactNode;\n /** Tick labels rendered under the track. */\n marks?: { value: number; label?: React.ReactNode }[];\n size?: \"sm\" | \"md\" | \"lg\";\n wrapperClassName?: string;\n /** Row wrapping the label and the current-value text. */\n labelRowClassName?: string;\n labelClassName?: string;\n valueClassName?: string;\n /** Wrapper around the tick marks rendered under the track. */\n marksClassName?: string;\n /** Applied to each individual tick mark. */\n markClassName?: string;\n}\n\nconst TRACK = {\n sm: \"h-1 [&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5\",\n md: \"h-1.5 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4\",\n lg: \"h-2 [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5\",\n} as const;\n\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(\n function Slider(\n {\n value,\n defaultValue,\n onChange,\n min = 0,\n max = 100,\n step = 1,\n label,\n showValue = false,\n formatValue,\n marks,\n size = \"md\",\n disabled,\n id,\n className,\n wrapperClassName,\n labelRowClassName,\n labelClassName,\n valueClassName,\n marksClassName,\n markClassName,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const sliderId = id ?? generatedId;\n\n const [internal, setInternal] = useState(defaultValue ?? min);\n const current = value !== undefined ? value : internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = Number(e.target.value);\n if (value === undefined) setInternal(next);\n onChange?.(next);\n };\n\n return (\n <div className={cn(\"w-full\", wrapperClassName)}>\n {(label || showValue) && (\n <div\n className={cn(\n \"mb-2 flex items-baseline justify-between gap-2\",\n labelRowClassName,\n )}\n >\n {label && (\n <label\n htmlFor={sliderId}\n className={cn(\n \"text-[13px] font-medium leading-none text-foreground\",\n labelClassName,\n )}\n >\n {label}\n </label>\n )}\n {showValue && (\n <span\n className={cn(\n \"text-xs font-medium tabular-nums text-muted-foreground\",\n valueClassName,\n )}\n >\n {formatValue ? formatValue(current) : current}\n </span>\n )}\n </div>\n )}\n\n <input\n ref={ref}\n id={sliderId}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n onChange={handleChange}\n disabled={disabled}\n // The filled part of the track is painted with a two-stop gradient;\n // native range tracks can't otherwise show progress cross-browser.\n style={{\n background: `linear-gradient(to right, var(--primary) ${percent}%, var(--muted) ${percent}%)`,\n }}\n className={cn(\n \"w-full cursor-pointer appearance-none rounded-full outline-none transition-opacity\",\n TRACK[size] ?? TRACK.md,\n // Thumb (WebKit + Firefox)\n \"[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full\",\n \"[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary\",\n \"[&::-webkit-slider-thumb]:bg-background [&::-webkit-slider-thumb]:shadow\",\n \"[&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110\",\n \"[&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full\",\n \"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary\",\n \"[&::-moz-range-thumb]:bg-background [&::-moz-range-thumb]:shadow\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...rest}\n />\n\n {marks && marks.length > 0 && (\n <div\n className={cn(\n \"relative mt-1.5 h-4 text-[10px] text-muted-foreground\",\n marksClassName,\n )}\n >\n {marks.map((mark) => {\n const markPercent =\n max === min ? 0 : ((mark.value - min) / (max - min)) * 100;\n return (\n <span\n key={mark.value}\n className={cn(\n \"absolute whitespace-nowrap\",\n // Edge marks align inward so they aren't half-clipped\n // outside the track.\n markPercent <= 0\n ? \"translate-x-0\"\n : markPercent >= 100\n ? \"-translate-x-full\"\n : \"-translate-x-1/2\",\n markClassName,\n )}\n style={{ left: `${markPercent}%` }}\n >\n {mark.label ?? mark.value}\n </span>\n );\n })}\n </div>\n )}\n </div>\n );\n },\n);\n\nSlider.displayName = \"Slider\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useState } from \"react\";\nimport { Minus, Plus } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface NumberInputProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"defaultValue\" | \"onChange\" | \"size\" | \"type\"\n > {\n value?: number | null;\n defaultValue?: number;\n /** Fired with the parsed number, or null when the field is empty. */\n onChange?: (value: number | null) => void;\n min?: number;\n max?: number;\n step?: number;\n label?: string;\n error?: string;\n helperText?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n wrapperClassName?: string;\n labelClassName?: string;\n /** The bordered control wrapping the decrement button, input, and increment button. */\n inputWrapperClassName?: string;\n decrementButtonClassName?: string;\n incrementButtonClassName?: string;\n helperTextClassName?: string;\n}\n\nconst SIZES = {\n sm: { input: \"h-8 text-xs\", button: \"w-8 [&_svg]:h-3 [&_svg]:w-3\" },\n md: { input: \"h-10 text-sm\", button: \"w-10 [&_svg]:h-3.5 [&_svg]:w-3.5\" },\n lg: { input: \"h-12 text-base\", button: \"w-12 [&_svg]:h-4 [&_svg]:w-4\" },\n} as const;\n\nconst clamp = (n: number, min?: number, max?: number) => {\n if (min !== undefined && n < min) return min;\n if (max !== undefined && n > max) return max;\n return n;\n};\n\nexport const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(\n function NumberInput(\n {\n value,\n defaultValue,\n onChange,\n min,\n max,\n step = 1,\n label,\n error,\n helperText,\n size = \"md\",\n disabled,\n id,\n className,\n wrapperClassName,\n labelClassName,\n inputWrapperClassName,\n decrementButtonClassName,\n incrementButtonClassName,\n helperTextClassName,\n ...rest\n },\n ref,\n ) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const describedBy = helperText || error ? `${fieldId}-description` : undefined;\n const sizes = SIZES[size] ?? SIZES.md;\n\n // The raw string is kept so intermediate states (\"-\", \"1.\", \"\") don't get\n // eaten while typing; the parsed number is what consumers receive.\n const [raw, setRaw] = useState(\n defaultValue !== undefined ? String(defaultValue) : \"\",\n );\n const isControlled = value !== undefined;\n const displayed = isControlled ? (value === null ? \"\" : String(value)) : raw;\n const parsed = displayed === \"\" ? null : Number(displayed);\n\n const commit = (next: number | null) => {\n if (!isControlled) setRaw(next === null ? \"\" : String(next));\n onChange?.(next);\n };\n\n const nudge = (direction: 1 | -1) => {\n const base = parsed !== null && !Number.isNaN(parsed) ? parsed : min ?? 0;\n commit(clamp(base + direction * step, min, max));\n };\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n const text = e.target.value;\n if (!/^-?\\d*\\.?\\d*$/.test(text)) return;\n if (!isControlled) setRaw(text);\n const n = text === \"\" || text === \"-\" ? null : Number(text);\n onChange?.(n !== null && Number.isNaN(n) ? null : n);\n };\n\n const handleBlur = () => {\n if (parsed === null || Number.isNaN(parsed)) return;\n const clamped = clamp(parsed, min, max);\n if (clamped !== parsed) commit(clamped);\n };\n\n const stepperButton =\n \"flex shrink-0 items-center justify-center text-muted-foreground transition-colors \" +\n \"hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-40 \" +\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\";\n\n return (\n <div className={cn(\"w-full\", wrapperClassName)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn(\n \"mb-1.5 block text-[13px] font-medium leading-none text-foreground\",\n labelClassName,\n )}\n >\n {label}\n </label>\n )}\n\n <div\n className={cn(\n \"flex w-full items-stretch overflow-hidden rounded-lg border bg-transparent transition-colors\",\n \"dark:bg-input/30\",\n error ? \"border-destructive\" : \"border-input\",\n \"focus-within:ring-2 focus-within:ring-ring/40 focus-within:border-ring\",\n disabled && \"opacity-50\",\n inputWrapperClassName,\n )}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Decrease value\"\n disabled={disabled || (parsed !== null && min !== undefined && parsed <= min)}\n onClick={() => nudge(-1)}\n className={cn(stepperButton, sizes.button, \"border-r border-input\", decrementButtonClassName)}\n >\n <Minus aria-hidden=\"true\" />\n </button>\n\n <input\n ref={ref}\n id={fieldId}\n type=\"text\"\n inputMode=\"decimal\"\n role=\"spinbutton\"\n aria-valuenow={parsed ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-invalid={error ? true : undefined}\n aria-describedby={describedBy}\n value={displayed}\n onChange={handleInput}\n onBlur={handleBlur}\n onKeyDown={(e) => {\n if (e.key === \"ArrowUp\") {\n e.preventDefault();\n nudge(1);\n } else if (e.key === \"ArrowDown\") {\n e.preventDefault();\n nudge(-1);\n }\n }}\n disabled={disabled}\n className={cn(\n \"w-full min-w-0 flex-1 bg-transparent text-center text-foreground outline-none\",\n \"placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n sizes.input,\n className,\n )}\n {...rest}\n />\n\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Increase value\"\n disabled={disabled || (parsed !== null && max !== undefined && parsed >= max)}\n onClick={() => nudge(1)}\n className={cn(stepperButton, sizes.button, \"border-l border-input\", incrementButtonClassName)}\n >\n <Plus aria-hidden=\"true\" />\n </button>\n </div>\n\n {(helperText || error) && (\n <p\n id={describedBy}\n role={error ? \"alert\" : undefined}\n className={cn(\n \"mt-1.5 text-xs font-medium\",\n error ? \"text-destructive\" : \"text-muted-foreground\",\n helperTextClassName,\n )}\n >\n {error || helperText}\n </p>\n )}\n </div>\n );\n },\n);\n\nNumberInput.displayName = \"NumberInput\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useState } from \"react\";\nimport { Star } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface RatingProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Current rating. Supports fractions when readOnly (e.g. 4.3). */\n value?: number;\n defaultValue?: number;\n onChange?: (value: number) => void;\n /** Number of stars. */\n max?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n readOnly?: boolean;\n disabled?: boolean;\n /** Clicking the current value again resets the rating to 0. */\n allowClear?: boolean;\n label?: string;\n /** Show the numeric value next to the stars. */\n showValue?: boolean;\n /** Color class of filled stars; defaults to the theme's warning (amber). */\n colorClassName?: string;\n /** Applied to every star icon, in addition to size/color/state classes. */\n starClassName?: string;\n /** The unfilled star color/class. */\n emptyStarClassName?: string;\n /** The clickable wrapper around each star, in interactive mode. */\n starWrapperClassName?: string;\n /** The numeric value shown when `showValue` is set. */\n valueClassName?: string;\n}\n\nconst SIZES = { sm: \"h-4 w-4\", md: \"h-5 w-5\", lg: \"h-6 w-6\" } as const;\n\nexport const Rating = forwardRef<HTMLDivElement, RatingProps>(function Rating(\n {\n value,\n defaultValue = 0,\n onChange,\n max = 5,\n size = \"md\",\n readOnly = false,\n disabled = false,\n allowClear = true,\n label = \"Rating\",\n showValue = false,\n colorClassName = \"text-warning\",\n starClassName,\n emptyStarClassName,\n starWrapperClassName,\n valueClassName,\n className,\n ...rest\n },\n ref,\n) {\n const groupName = useId();\n const [internal, setInternal] = useState(defaultValue);\n const [hovered, setHovered] = useState<number | null>(null);\n\n const current = value !== undefined ? value : internal;\n const active = hovered ?? current;\n const starSize = SIZES[size] ?? SIZES.md;\n\n const select = (next: number) => {\n if (readOnly || disabled) return;\n const resolved = allowClear && next === current ? 0 : next;\n if (value === undefined) setInternal(resolved);\n onChange?.(resolved);\n };\n\n /* Read-only display supports fractional values via a clipped overlay. */\n if (readOnly) {\n const percent = Math.min(Math.max(current / max, 0), 1) * 100;\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={`${label}: ${current} out of ${max}`}\n className={cn(\"inline-flex items-center gap-2\", className)}\n {...rest}\n >\n <span className=\"relative inline-flex\" aria-hidden=\"true\">\n <span className={cn(\"flex gap-0.5 text-muted-foreground/40\", emptyStarClassName)}>\n {Array.from({ length: max }, (_, i) => (\n <Star key={i} className={cn(starSize, starClassName)} fill=\"currentColor\" strokeWidth={0} />\n ))}\n </span>\n <span\n className={cn(\"absolute inset-0 flex gap-0.5 overflow-hidden\", colorClassName)}\n style={{ width: `${percent}%` }}\n >\n {Array.from({ length: max }, (_, i) => (\n <Star\n key={i}\n className={cn(starSize, \"shrink-0\", starClassName)}\n fill=\"currentColor\"\n strokeWidth={0}\n />\n ))}\n </span>\n </span>\n {showValue && (\n <span className={cn(\"text-sm font-medium tabular-nums text-foreground\", valueClassName)}>\n {current}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label={label}\n onMouseLeave={() => setHovered(null)}\n className={cn(\n \"inline-flex items-center gap-2\",\n disabled && \"opacity-50\",\n className,\n )}\n {...rest}\n >\n <span className=\"flex gap-0.5\">\n {Array.from({ length: max }, (_, i) => {\n const starValue = i + 1;\n const filled = starValue <= active;\n return (\n <label\n key={starValue}\n onMouseEnter={() => !disabled && setHovered(starValue)}\n className={cn(!disabled && \"cursor-pointer\", starWrapperClassName)}\n >\n <input\n type=\"radio\"\n name={groupName}\n value={starValue}\n checked={current === starValue}\n onChange={() => select(starValue)}\n disabled={disabled}\n className=\"sr-only peer\"\n aria-label={`${starValue} of ${max}`}\n />\n <Star\n aria-hidden=\"true\"\n className={cn(\n starSize,\n \"transition-colors\",\n filled ? colorClassName : cn(\"text-muted-foreground/40\", emptyStarClassName),\n \"peer-focus-visible:rounded peer-focus-visible:ring-2 peer-focus-visible:ring-ring\",\n starClassName,\n )}\n fill={filled ? \"currentColor\" : \"none\"}\n strokeWidth={filled ? 0 : 1.5}\n />\n </label>\n );\n })}\n </span>\n {showValue && (\n <span className={cn(\"text-sm font-medium tabular-nums text-foreground\", valueClassName)}>\n {current}\n </span>\n )}\n </div>\n );\n});\n\nRating.displayName = \"Rating\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TagInputProps {\n value?: string[];\n defaultValue?: string[];\n onChange?: (tags: string[]) => void;\n label?: string;\n placeholder?: string;\n /** Maximum number of tags; further entries are ignored. */\n maxTags?: number;\n /** Return false to reject a tag before it is added. */\n validate?: (tag: string) => boolean;\n /** Also commit the pending text when the field loses focus. */\n addOnBlur?: boolean;\n error?: string;\n helperText?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n id?: string;\n className?: string;\n wrapperClassName?: string;\n /** Field label. */\n labelClassName?: string;\n /** Tag chip wrapper. */\n chipClassName?: string;\n /** Remove (\"x\") button inside a chip. */\n chipRemoveClassName?: string;\n /** The text input itself. */\n inputClassName?: string;\n /** Helper text / error message. */\n helperClassName?: string;\n /** Tag count indicator (e.g. \"2/5\"). */\n countClassName?: string;\n}\n\nconst SIZES = {\n sm: { root: \"min-h-8 px-2 py-1 gap-1\", chip: \"h-5 px-1.5 text-[11px]\", input: \"text-xs h-5\" },\n md: { root: \"min-h-10 px-2.5 py-1.5 gap-1.5\", chip: \"h-6 px-2 text-xs\", input: \"text-sm h-6\" },\n lg: { root: \"min-h-12 px-3 py-2 gap-2\", chip: \"h-7 px-2.5 text-sm\", input: \"text-base h-7\" },\n} as const;\n\nexport const TagInput = forwardRef<HTMLInputElement, TagInputProps>(\n function TagInput(\n {\n value,\n defaultValue = [],\n onChange,\n label,\n placeholder = \"Add a tag…\",\n maxTags,\n validate,\n addOnBlur = true,\n error,\n helperText,\n size = \"md\",\n disabled = false,\n id,\n className,\n wrapperClassName,\n labelClassName,\n chipClassName,\n chipRemoveClassName,\n inputClassName,\n helperClassName,\n countClassName,\n },\n ref,\n ) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const describedBy = helperText || error ? `${fieldId}-description` : undefined;\n const sizes = SIZES[size] ?? SIZES.md;\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [internal, setInternal] = useState<string[]>(defaultValue);\n const [draft, setDraft] = useState(\"\");\n\n const tags = value !== undefined ? value : internal;\n const atLimit = maxTags !== undefined && tags.length >= maxTags;\n\n const commit = (next: string[]) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n };\n\n const addTag = (text: string) => {\n const tag = text.trim();\n if (!tag || disabled || atLimit) return;\n if (tags.includes(tag)) {\n setDraft(\"\");\n return;\n }\n if (validate && !validate(tag)) return;\n commit([...tags, tag]);\n setDraft(\"\");\n };\n\n const removeTag = (index: number) => {\n if (disabled) return;\n commit(tags.filter((_, i) => i !== index));\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" || e.key === \",\") {\n e.preventDefault();\n addTag(draft);\n } else if (e.key === \"Backspace\" && draft === \"\" && tags.length > 0) {\n removeTag(tags.length - 1);\n }\n };\n\n return (\n <div className={cn(\"w-full\", wrapperClassName)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn(\n \"mb-1.5 block text-[13px] font-medium leading-none text-foreground\",\n labelClassName,\n )}\n >\n {label}\n </label>\n )}\n\n <div\n onClick={() => inputRef.current?.focus()}\n className={cn(\n \"flex w-full cursor-text flex-wrap items-center rounded-lg border bg-transparent transition-colors\",\n \"dark:bg-input/30\",\n error ? \"border-destructive\" : \"border-input\",\n \"focus-within:ring-2 focus-within:ring-ring/40 focus-within:border-ring\",\n disabled && \"cursor-not-allowed opacity-50\",\n sizes.root,\n className,\n )}\n >\n {tags.map((tag, i) => (\n <span\n key={`${tag}-${i}`}\n className={cn(\n \"inline-flex items-center gap-1 rounded-full bg-primary/10 font-medium text-primary\",\n sizes.chip,\n chipClassName,\n )}\n >\n <span className=\"max-w-40 truncate\">{tag}</span>\n <button\n type=\"button\"\n aria-label={`Remove ${tag}`}\n disabled={disabled}\n onClick={(e) => {\n e.stopPropagation();\n removeTag(i);\n }}\n className={cn(\n \"rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n chipRemoveClassName,\n )}\n >\n <X aria-hidden=\"true\" className=\"h-3 w-3\" />\n </button>\n </span>\n ))}\n\n <input\n ref={(el) => {\n inputRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n }}\n id={fieldId}\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={() => addOnBlur && addTag(draft)}\n placeholder={atLimit ? \"\" : placeholder}\n disabled={disabled || atLimit}\n aria-invalid={error ? true : undefined}\n aria-describedby={describedBy}\n className={cn(\n \"min-w-20 flex-1 bg-transparent text-foreground outline-none\",\n \"placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n sizes.input,\n inputClassName,\n )}\n />\n </div>\n\n {(helperText || error || maxTags !== undefined) && (\n <div className=\"mt-1.5 flex items-baseline justify-between gap-2\">\n <p\n id={describedBy}\n role={error ? \"alert\" : undefined}\n className={cn(\n \"text-xs font-medium\",\n error ? \"text-destructive\" : \"text-muted-foreground\",\n helperClassName,\n )}\n >\n {error || helperText}\n </p>\n {maxTags !== undefined && (\n <span\n className={cn(\n \"shrink-0 text-[11px] tabular-nums text-muted-foreground\",\n countClassName,\n )}\n >\n {tags.length}/{maxTags}\n </span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nTagInput.displayName = \"TagInput\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface PinInputProps {\n /** Number of character boxes. */\n length?: number;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Fired once every box is filled. */\n onComplete?: (value: string) => void;\n /** Restrict accepted characters. */\n type?: \"numeric\" | \"alphanumeric\";\n /** Render dots instead of the typed characters. */\n mask?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n error?: boolean;\n autoFocus?: boolean;\n label?: string;\n id?: string;\n className?: string;\n /** Applied to each individual character box, in addition to the size/state styling. */\n boxClassName?: string;\n}\n\nconst SIZES = {\n sm: \"h-9 w-9 text-sm rounded-md\",\n md: \"h-11 w-11 text-base rounded-lg\",\n // h-12 keeps lg on the same height scale as the other form controls\n // (and six lg boxes still fit a 360px viewport).\n lg: \"h-12 w-12 text-lg rounded-lg\",\n} as const;\n\nexport const PinInput = forwardRef<HTMLDivElement, PinInputProps>(\n function PinInput(\n {\n length = 4,\n value,\n defaultValue = \"\",\n onChange,\n onComplete,\n type = \"numeric\",\n mask = false,\n size = \"md\",\n disabled = false,\n error = false,\n autoFocus = false,\n label = \"PIN input\",\n id,\n className,\n boxClassName,\n },\n ref,\n ) {\n const generatedId = useId();\n const groupId = id ?? generatedId;\n const inputsRef = useRef<(HTMLInputElement | null)[]>([]);\n const [internal, setInternal] = useState(defaultValue.slice(0, length));\n\n const current = (value !== undefined ? value : internal).slice(0, length);\n const chars = Array.from({ length }, (_, i) => current[i] ?? \"\");\n\n const allowed = type === \"numeric\" ? /^[0-9]$/ : /^[a-zA-Z0-9]$/;\n\n const commit = (next: string) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n if (next.length === length) onComplete?.(next);\n };\n\n const setChar = (index: number, char: string) => {\n const next = chars.slice();\n next[index] = char;\n commit(next.join(\"\").slice(0, length));\n };\n\n const focusBox = (index: number) => {\n inputsRef.current[Math.min(Math.max(index, 0), length - 1)]?.focus();\n };\n\n const handleChange = (\n index: number,\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n // Take the last typed character so overwriting a filled box works.\n const char = e.target.value.slice(-1);\n if (char === \"\") {\n setChar(index, \"\");\n return;\n }\n if (!allowed.test(char)) return;\n setChar(index, char);\n focusBox(index + 1);\n };\n\n const handleKeyDown = (\n index: number,\n e: React.KeyboardEvent<HTMLInputElement>,\n ) => {\n if (e.key === \"Backspace\") {\n if (chars[index]) {\n setChar(index, \"\");\n } else {\n focusBox(index - 1);\n setChar(index - 1, \"\");\n }\n e.preventDefault();\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n focusBox(index - 1);\n } else if (e.key === \"ArrowRight\") {\n e.preventDefault();\n focusBox(index + 1);\n }\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n const text = e.clipboardData\n .getData(\"text\")\n .split(\"\")\n .filter((c) => allowed.test(c))\n .slice(0, length)\n .join(\"\");\n if (!text) return;\n commit(text);\n focusBox(text.length - 1);\n };\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={label}\n className={cn(\"inline-flex items-center gap-2\", className)}\n >\n {chars.map((char, i) => (\n <input\n key={i}\n ref={(el) => {\n inputsRef.current[i] = el;\n }}\n id={i === 0 ? groupId : undefined}\n type={mask ? \"password\" : \"text\"}\n inputMode={type === \"numeric\" ? \"numeric\" : \"text\"}\n autoComplete={i === 0 ? \"one-time-code\" : \"off\"}\n aria-label={`Character ${i + 1} of ${length}`}\n value={char}\n onChange={(e) => handleChange(i, e)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={handlePaste}\n onFocus={(e) => e.target.select()}\n disabled={disabled}\n autoFocus={autoFocus && i === 0}\n className={cn(\n \"border bg-transparent text-center font-semibold text-foreground outline-none transition-colors\",\n \"dark:bg-input/30 caret-primary\",\n SIZES[size] ?? SIZES.md,\n error ? \"border-destructive\" : \"border-input\",\n \"focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:border-ring\",\n disabled && \"cursor-not-allowed opacity-50\",\n boxClassName,\n )}\n />\n ))}\n </div>\n );\n },\n);\n\nPinInput.displayName = \"PinInput\";\n","\"use client\";\n\nimport React, { forwardRef, useId, useRef, useState } from \"react\";\nimport { UploadCloud, File as FileIcon, X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface FileUploadProps {\n /** Fired with the full current file list on every change. */\n onFilesChange?: (files: File[]) => void;\n /** Fired for each rejected file with the reason. */\n onError?: (message: string, file: File) => void;\n multiple?: boolean;\n /** Native accept string, e.g. \"image/*,.pdf\". */\n accept?: string;\n maxSizeMB?: number;\n maxFiles?: number;\n label?: string;\n description?: string;\n disabled?: boolean;\n /** Hide the built-in selected-files list. */\n hideFileList?: boolean;\n id?: string;\n className?: string;\n\n dropzoneClassName?: string;\n iconClassName?: string;\n labelClassName?: string;\n descriptionClassName?: string;\n errorClassName?: string;\n listClassName?: string;\n fileItemClassName?: string;\n fileIconClassName?: string;\n fileNameClassName?: string;\n fileSizeClassName?: string;\n removeButtonClassName?: string;\n}\n\nconst formatBytes = (bytes: number) => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n};\n\nexport const FileUpload = forwardRef<HTMLInputElement, FileUploadProps>(\n function FileUpload(\n {\n onFilesChange,\n onError,\n multiple = false,\n accept,\n maxSizeMB,\n maxFiles,\n label = \"Click to upload or drag and drop\",\n description,\n disabled = false,\n hideFileList = false,\n id,\n className,\n\n dropzoneClassName,\n iconClassName,\n labelClassName,\n descriptionClassName,\n errorClassName,\n listClassName,\n fileItemClassName,\n fileIconClassName,\n fileNameClassName,\n fileSizeClassName,\n removeButtonClassName,\n },\n ref,\n ) {\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [files, setFiles] = useState<File[]>([]);\n const [dragging, setDragging] = useState(false);\n const [message, setMessage] = useState<string | null>(null);\n\n const addFiles = (incoming: FileList | File[]) => {\n if (disabled) return;\n setMessage(null);\n\n let next = multiple ? [...files] : [];\n for (const file of Array.from(incoming)) {\n if (maxSizeMB && file.size > maxSizeMB * 1024 * 1024) {\n const msg = `\"${file.name}\" exceeds the ${maxSizeMB} MB limit`;\n setMessage(msg);\n onError?.(msg, file);\n continue;\n }\n if (maxFiles && next.length >= maxFiles) {\n const msg = `Maximum of ${maxFiles} files`;\n setMessage(msg);\n onError?.(msg, file);\n break;\n }\n // Skip duplicates by name + size.\n if (next.some((f) => f.name === file.name && f.size === file.size)) {\n continue;\n }\n next.push(file);\n if (!multiple) break;\n }\n\n setFiles(next);\n onFilesChange?.(next);\n };\n\n const removeFile = (index: number) => {\n const next = files.filter((_, i) => i !== index);\n setFiles(next);\n onFilesChange?.(next);\n };\n\n return (\n <div className={cn(\"w-full\", className)}>\n <label\n htmlFor={inputId}\n onDragOver={(e) => {\n e.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(e) => {\n e.preventDefault();\n setDragging(false);\n addFiles(e.dataTransfer.files);\n }}\n className={cn(\n \"flex w-full flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-6 py-10 text-center transition-colors\",\n dragging\n ? \"border-primary bg-primary/5\"\n : \"border-border bg-transparent hover:border-muted-foreground/50 hover:bg-accent/30\",\n disabled ? \"cursor-not-allowed opacity-50\" : \"cursor-pointer\",\n \"focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background\",\n dropzoneClassName,\n )}\n >\n <input\n ref={(el) => {\n inputRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n }}\n id={inputId}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n onChange={(e) => {\n if (e.target.files) addFiles(e.target.files);\n // Allow re-selecting the same file.\n e.target.value = \"\";\n }}\n className=\"sr-only\"\n />\n\n <span\n aria-hidden=\"true\"\n className={cn(\"rounded-full bg-muted p-3 text-muted-foreground\", iconClassName)}\n >\n <UploadCloud className=\"h-6 w-6\" />\n </span>\n\n <p className={cn(\"text-sm font-medium text-foreground\", labelClassName)}>{label}</p>\n\n <p className={cn(\"text-xs text-muted-foreground\", descriptionClassName)}>\n {description ??\n [\n accept ? `Accepted: ${accept}` : null,\n maxSizeMB ? `Max ${maxSizeMB} MB` : null,\n maxFiles ? `Up to ${maxFiles} files` : null,\n ]\n .filter(Boolean)\n .join(\" · \")}\n </p>\n </label>\n\n {message && (\n <p role=\"alert\" className={cn(\"mt-2 text-xs font-medium text-destructive\", errorClassName)}>\n {message}\n </p>\n )}\n\n {!hideFileList && files.length > 0 && (\n <ul className={cn(\"mt-3 space-y-2\", listClassName)}>\n {files.map((file, i) => (\n <li\n key={`${file.name}-${file.size}-${i}`}\n className={cn(\n \"flex items-center gap-3 rounded-lg border border-border bg-card px-3 py-2\",\n fileItemClassName,\n )}\n >\n <FileIcon\n aria-hidden=\"true\"\n className={cn(\"h-4 w-4 shrink-0 text-muted-foreground\", fileIconClassName)}\n />\n <div className=\"min-w-0 flex-1\">\n <p className={cn(\"truncate text-sm font-medium text-foreground\", fileNameClassName)}>\n {file.name}\n </p>\n <p className={cn(\"text-xs text-muted-foreground\", fileSizeClassName)}>\n {formatBytes(file.size)}\n </p>\n </div>\n <button\n type=\"button\"\n aria-label={`Remove ${file.name}`}\n onClick={() => removeFile(i)}\n className={cn(\n \"shrink-0 rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n removeButtonClassName,\n )}\n >\n <X aria-hidden=\"true\" className=\"h-4 w-4\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n },\n);\n\nFileUpload.displayName = \"FileUpload\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport {\n Info,\n CheckCircle,\n AlertTriangle,\n AlertCircle,\n X,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Static inline alert / banner. Unlike the toast system (ToastProvider),\n * a Callout lives in the page flow and stays until dismissed.\n */\nexport interface CalloutProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n type?: \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n variant?: \"soft\" | \"outline\";\n title?: React.ReactNode;\n children?: React.ReactNode;\n /** Override the default type icon; pass null to hide it. */\n icon?: React.ReactNode | null;\n /** Renders a close button; the callout removes itself unless controlled. */\n dismissible?: boolean;\n onDismiss?: () => void;\n\n /** 🔥 Full Customization */\n iconClassName?: string;\n contentClassName?: string;\n titleClassName?: string;\n descriptionClassName?: string;\n closeButtonClassName?: string;\n}\n\n/* Every color is a theme status token, so callouts follow the user-defined\n palette in both modes — no raw palette values, no dark: overrides. */\nconst STYLES = {\n info: {\n soft: \"border-info/30 bg-info/10 text-info\",\n outline: \"border-info/50 text-info\",\n icon: Info,\n },\n success: {\n soft: \"border-success/30 bg-success/10 text-success\",\n outline: \"border-success/50 text-success\",\n icon: CheckCircle,\n },\n warning: {\n soft: \"border-warning/30 bg-warning/10 text-warning\",\n outline: \"border-warning/50 text-warning\",\n icon: AlertTriangle,\n },\n error: {\n soft: \"border-destructive/30 bg-destructive/10 text-destructive\",\n outline: \"border-destructive/50 text-destructive\",\n icon: AlertCircle,\n },\n neutral: {\n soft: \"border-border bg-muted text-foreground\",\n outline: \"border-border text-foreground\",\n icon: Info,\n },\n} as const;\n\nexport const Callout = forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n type = \"info\",\n variant = \"soft\",\n title,\n children,\n icon,\n dismissible = false,\n onDismiss,\n className,\n iconClassName,\n contentClassName,\n titleClassName,\n descriptionClassName,\n closeButtonClassName,\n ...rest\n },\n ref,\n ) {\n const [hidden, setHidden] = useState(false);\n if (hidden) return null;\n\n const config = STYLES[type] ?? STYLES.info;\n const DefaultIcon = config.icon;\n\n return (\n <div\n ref={ref}\n // Errors interrupt; the rest is informational.\n role={type === \"error\" ? \"alert\" : \"status\"}\n className={cn(\n \"flex w-full items-start gap-3 rounded-xl border p-4\",\n config[variant] ?? config.soft,\n className,\n )}\n {...rest}\n >\n {icon !== null && (\n <span\n aria-hidden=\"true\"\n // h-5 matches the title's text-sm line-height, so the icon centers\n // on the first line instead of hanging low from an mt nudge.\n className={cn(\n \"flex h-5 shrink-0 items-center [&_svg]:h-5 [&_svg]:w-5\",\n iconClassName,\n )}\n >\n {icon ?? <DefaultIcon />}\n </span>\n )}\n\n <div className={cn(\"min-w-0 flex-1\", contentClassName)}>\n {title && (\n <p className={cn(\"text-sm font-semibold\", titleClassName)}>\n {title}\n </p>\n )}\n {children && (\n <div\n className={cn(\n \"text-sm text-foreground/80\",\n title && \"mt-1\",\n descriptionClassName,\n )}\n >\n {children}\n </div>\n )}\n </div>\n\n {dismissible && (\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n onClick={() => {\n onDismiss?.();\n setHidden(true);\n }}\n className={cn(\n \"shrink-0 rounded-md p-1 opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n closeButtonClassName,\n )}\n >\n <X aria-hidden=\"true\" className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n );\n },\n);\n\nCallout.displayName = \"Callout\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface ToggleProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onChange\"> {\n pressed?: boolean;\n defaultPressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n variant?: \"default\" | \"outline\";\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\n// Heights match ToggleGroup, so a standalone Toggle sits flush next to a\n// group in the same toolbar.\nconst SIZES = {\n sm: \"h-8 px-2.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\",\n md: \"h-9 px-3 text-sm [&_svg]:h-4 [&_svg]:w-4\",\n lg: \"h-11 px-4 text-base [&_svg]:h-5 [&_svg]:w-5\",\n} as const;\n\n/** Two-state button (e.g. bold in a text editor, filter chips). */\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(\n function Toggle(\n {\n pressed,\n defaultPressed = false,\n onPressedChange,\n variant = \"default\",\n size = \"md\",\n className,\n children,\n onClick,\n disabled,\n ...rest\n },\n ref,\n ) {\n const [internal, setInternal] = useState(defaultPressed);\n const isPressed = pressed !== undefined ? pressed : internal;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-pressed={isPressed}\n disabled={disabled}\n onClick={(e) => {\n onClick?.(e);\n if (pressed === undefined) setInternal(!isPressed);\n onPressedChange?.(!isPressed);\n }}\n className={cn(\n \"inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n SIZES[size] ?? SIZES.md,\n variant === \"outline\" && \"border border-border\",\n isPressed\n ? \"bg-accent text-foreground\"\n : \"bg-transparent text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n className,\n )}\n {...rest}\n >\n {children}\n </button>\n );\n },\n);\n\nToggle.displayName = \"Toggle\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface ToggleGroupOption {\n value: string;\n label?: React.ReactNode;\n icon?: React.ReactNode;\n disabled?: boolean;\n /** Accessible name when the option is icon-only. */\n ariaLabel?: string;\n}\n\nexport interface ToggleGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n options: ToggleGroupOption[];\n /** \"single\" behaves like a segmented control; \"multiple\" like toolbar toggles. */\n type?: \"single\" | \"multiple\";\n value?: string | string[];\n defaultValue?: string | string[];\n onChange?: (value: string | string[]) => void;\n size?: \"sm\" | \"md\" | \"lg\";\n fullWidth?: boolean;\n disabled?: boolean;\n /** Each option's `<button>`. */\n itemClassName?: string;\n /** Wrapper around an option's icon. */\n iconClassName?: string;\n}\n\nconst SIZES = {\n sm: \"h-8 px-2.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\",\n md: \"h-9 px-3 text-sm [&_svg]:h-4 [&_svg]:w-4\",\n lg: \"h-11 px-4 text-base [&_svg]:h-5 [&_svg]:w-5\",\n} as const;\n\nexport const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(\n function ToggleGroup(\n {\n options,\n type = \"single\",\n value,\n defaultValue,\n onChange,\n size = \"md\",\n fullWidth = false,\n disabled = false,\n className,\n itemClassName,\n iconClassName,\n ...rest\n },\n ref,\n ) {\n const [internal, setInternal] = useState<string | string[]>(\n defaultValue ?? (type === \"multiple\" ? [] : \"\"),\n );\n const current = value !== undefined ? value : internal;\n\n const isSelected = (v: string) =>\n type === \"multiple\"\n ? Array.isArray(current) && current.includes(v)\n : current === v;\n\n const select = (v: string) => {\n let next: string | string[];\n if (type === \"multiple\") {\n const list = Array.isArray(current) ? current : [];\n next = list.includes(v) ? list.filter((x) => x !== v) : [...list, v];\n } else {\n next = current === v ? \"\" : v;\n }\n if (value === undefined) setInternal(next);\n onChange?.(next);\n };\n\n return (\n <div\n ref={ref}\n role=\"group\"\n className={cn(\n \"inline-flex items-stretch overflow-hidden rounded-lg border border-border bg-transparent\",\n fullWidth && \"flex w-full\",\n disabled && \"opacity-50\",\n className,\n )}\n {...rest}\n >\n {options.map((option, i) => {\n const selected = isSelected(option.value);\n const itemDisabled = disabled || option.disabled;\n\n return (\n <button\n key={option.value}\n type=\"button\"\n aria-pressed={selected}\n aria-label={option.ariaLabel}\n disabled={itemDisabled}\n onClick={() => select(option.value)}\n className={cn(\n \"inline-flex items-center justify-center gap-2 font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n SIZES[size] ?? SIZES.md,\n fullWidth && \"flex-1\",\n i > 0 && \"border-l border-border\",\n selected\n ? \"bg-primary/10 text-primary\"\n : \"bg-transparent text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n itemClassName,\n )}\n >\n {option.icon && (\n <span\n aria-hidden=\"true\"\n className={cn(\"shrink-0\", iconClassName)}\n >\n {option.icon}\n </span>\n )}\n {option.label}\n </button>\n );\n })}\n </div>\n );\n },\n);\n\nToggleGroup.displayName = \"ToggleGroup\";\n","\"use client\";\n\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Copy, Check } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface CopyButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"value\"> {\n /** Text placed on the clipboard. */\n value: string;\n /** Optional visible label next to the icon. */\n label?: React.ReactNode;\n /** How long the \"copied\" state shows, in ms. */\n feedbackDuration?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n onCopied?: (value: string) => void;\n\n /** 🔥 Full Customization */\n iconClassName?: string;\n labelClassName?: string;\n}\n\nconst SIZES = {\n sm: \"h-7 px-1.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\",\n md: \"h-9 px-2 text-sm [&_svg]:h-4 [&_svg]:w-4\",\n lg: \"h-11 px-3 text-base [&_svg]:h-5 [&_svg]:w-5\",\n} as const;\n\n/* Icon-only buttons render as squares instead of narrow rectangles. */\nconst ICON_ONLY = {\n sm: \"w-7 px-0 justify-center\",\n md: \"w-9 px-0 justify-center\",\n lg: \"w-11 px-0 justify-center\",\n} as const;\n\nexport const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(\n function CopyButton(\n {\n value,\n label,\n feedbackDuration = 1500,\n size = \"md\",\n onCopied,\n className,\n iconClassName,\n labelClassName,\n onClick,\n ...rest\n },\n ref,\n ) {\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n const copy = async (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n try {\n if (navigator.clipboard && window.isSecureContext) {\n await navigator.clipboard.writeText(value);\n } else {\n // Fallback for non-secure contexts.\n const textarea = document.createElement(\"textarea\");\n textarea.value = value;\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.select();\n document.execCommand(\"copy\");\n document.body.removeChild(textarea);\n }\n setCopied(true);\n onCopied?.(value);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), feedbackDuration);\n } catch {\n // Clipboard access denied — leave the state unchanged.\n }\n };\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label={copied ? \"Copied\" : \"Copy to clipboard\"}\n aria-live=\"polite\"\n onClick={copy}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-lg font-medium transition-colors\",\n \"text-muted-foreground hover:bg-accent hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n SIZES[size] ?? SIZES.md,\n !label && (ICON_ONLY[size] ?? ICON_ONLY.md),\n className,\n )}\n {...rest}\n >\n {copied ? (\n <Check aria-hidden=\"true\" className={cn(\"text-success\", iconClassName)} />\n ) : (\n <Copy aria-hidden=\"true\" className={cn(iconClassName)} />\n )}\n {label && (\n <span className={cn(labelClassName)}>{copied ? \"Copied\" : label}</span>\n )}\n </button>\n );\n },\n);\n\nCopyButton.displayName = \"CopyButton\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface AvatarGroupProps\n extends React.HTMLAttributes<HTMLDivElement> {\n /** Avatar elements (or any circular content). */\n children: React.ReactNode;\n /** Show at most this many; the rest collapse into a \"+N\" counter. */\n max?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n /** Overlap amount between items. */\n spacing?: \"tight\" | \"normal\";\n /** Customize the wrapper span around each visible avatar item. */\n itemClassName?: string;\n /** Customize the \"+N\" overflow counter. */\n counterClassName?: string;\n}\n\nconst COUNTER_SIZES = {\n sm: \"h-8 w-8 text-[10px]\",\n md: \"h-10 w-10 text-xs\",\n lg: \"h-12 w-12 text-sm\",\n} as const;\n\nexport const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(\n function AvatarGroup(\n {\n children,\n max,\n size = \"md\",\n spacing = \"normal\",\n className,\n itemClassName,\n counterClassName,\n ...rest\n },\n ref,\n ) {\n const items = React.Children.toArray(children);\n const visible = max && max > 0 ? items.slice(0, max) : items;\n const overflow = items.length - visible.length;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center\",\n spacing === \"tight\" ? \"-space-x-3\" : \"-space-x-2\",\n className,\n )}\n {...rest}\n >\n {visible.map((child, i) => (\n <span\n key={i}\n // Ring separates overlapping avatars from each other.\n className={cn(\n \"relative inline-flex rounded-full ring-2 ring-background\",\n itemClassName,\n )}\n style={{ zIndex: visible.length - i }}\n >\n {child}\n </span>\n ))}\n\n {overflow > 0 && (\n <span\n aria-label={`${overflow} more`}\n className={cn(\n \"relative z-0 inline-flex items-center justify-center rounded-full\",\n \"bg-muted font-semibold text-muted-foreground ring-2 ring-background\",\n COUNTER_SIZES[size] ?? COUNTER_SIZES.md,\n counterClassName,\n )}\n >\n +{overflow}\n </span>\n )}\n </div>\n );\n },\n);\n\nAvatarGroup.displayName = \"AvatarGroup\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface CalendarProps\n extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n \"onChange\" | \"defaultValue\"\n > {\n /** Selected day. */\n value?: Date | null;\n defaultValue?: Date | null;\n onChange?: (date: Date) => void;\n /** Month shown first (defaults to the selected day or today). */\n defaultMonth?: Date;\n minDate?: Date;\n maxDate?: Date;\n /** Return true to disable a specific day. */\n isDateDisabled?: (date: Date) => boolean;\n /** 0 = Sunday, 1 = Monday. */\n weekStartsOn?: 0 | 1;\n locale?: string;\n\n /** 🔥 Full Customization */\n headerClassName?: string;\n navButtonClassName?: string;\n monthLabelClassName?: string;\n weekdaysClassName?: string;\n weekdayClassName?: string;\n daysClassName?: string;\n dayClassName?: string;\n}\n\nconst isSameDay = (a: Date | null | undefined, b: Date | null | undefined) =>\n !!a &&\n !!b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate();\n\nconst stripTime = (d: Date) =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate());\n\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(\n function Calendar(\n {\n value,\n defaultValue = null,\n onChange,\n defaultMonth,\n minDate,\n maxDate,\n isDateDisabled,\n weekStartsOn = 1,\n locale,\n className,\n headerClassName,\n navButtonClassName,\n monthLabelClassName,\n weekdaysClassName,\n weekdayClassName,\n daysClassName,\n dayClassName,\n ...rest\n },\n ref,\n ) {\n const [internalValue, setInternalValue] = useState<Date | null>(defaultValue);\n const selected = value !== undefined ? value : internalValue;\n\n const [viewMonth, setViewMonth] = useState<Date>(() => {\n const base = selected ?? defaultMonth ?? new Date();\n return new Date(base.getFullYear(), base.getMonth(), 1);\n });\n\n const today = stripTime(new Date());\n const min = minDate ? stripTime(minDate) : null;\n const max = maxDate ? stripTime(maxDate) : null;\n\n const isDisabled = (date: Date) => {\n if (min && date < min) return true;\n if (max && date > max) return true;\n return isDateDisabled?.(date) ?? false;\n };\n\n const select = (date: Date) => {\n if (value === undefined) setInternalValue(date);\n onChange?.(date);\n // Selecting an adjacent-month day snaps the view to that month.\n if (date.getMonth() !== viewMonth.getMonth()) {\n setViewMonth(new Date(date.getFullYear(), date.getMonth(), 1));\n }\n };\n\n const shiftMonth = (delta: number) =>\n setViewMonth(\n (m) => new Date(m.getFullYear(), m.getMonth() + delta, 1),\n );\n\n /* 42 cells: always six rows, so the panel height never jumps. */\n const firstOffset =\n (viewMonth.getDay() - weekStartsOn + 7) % 7;\n const cells = Array.from({ length: 42 }, (_, i) => {\n const d = new Date(\n viewMonth.getFullYear(),\n viewMonth.getMonth(),\n 1 - firstOffset + i,\n );\n return stripTime(d);\n });\n\n // Localized weekday header, anchored on a known Sunday (2023-01-01).\n const weekdays = Array.from({ length: 7 }, (_, i) =>\n new Date(2023, 0, 1 + ((i + weekStartsOn) % 7)).toLocaleDateString(\n locale,\n { weekday: \"narrow\" },\n ),\n );\n\n const monthLabel = viewMonth.toLocaleDateString(locale, {\n month: \"long\",\n year: \"numeric\",\n });\n\n return (\n <div\n ref={ref}\n className={cn(\"w-64 select-none\", className)}\n {...rest}\n >\n {/* Month header */}\n <div className={cn(\"mb-2 flex items-center justify-between\", headerClassName)}>\n <button\n type=\"button\"\n aria-label=\"Previous month\"\n onClick={() => shiftMonth(-1)}\n className={cn(\n \"rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n navButtonClassName,\n )}\n >\n <ChevronLeft aria-hidden=\"true\" className=\"h-4 w-4\" />\n </button>\n\n <span\n aria-live=\"polite\"\n className={cn(\"text-sm font-semibold text-foreground\", monthLabelClassName)}\n >\n {monthLabel}\n </span>\n\n <button\n type=\"button\"\n aria-label=\"Next month\"\n onClick={() => shiftMonth(1)}\n className={cn(\n \"rounded-lg p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n navButtonClassName,\n )}\n >\n <ChevronRight aria-hidden=\"true\" className=\"h-4 w-4\" />\n </button>\n </div>\n\n {/* Weekday header */}\n <div className={cn(\"grid grid-cols-7 text-center\", weekdaysClassName)}>\n {weekdays.map((day, i) => (\n <span\n key={i}\n aria-hidden=\"true\"\n className={cn(\n \"py-1 text-[11px] font-medium text-muted-foreground\",\n weekdayClassName,\n )}\n >\n {day}\n </span>\n ))}\n </div>\n\n {/* Day grid */}\n <div className={cn(\"grid grid-cols-7\", daysClassName)}>\n {cells.map((date) => {\n const outside = date.getMonth() !== viewMonth.getMonth();\n const disabled = isDisabled(date);\n const isSelected = isSameDay(date, selected);\n const isToday = isSameDay(date, today);\n\n return (\n <button\n key={date.toISOString()}\n type=\"button\"\n disabled={disabled}\n aria-label={date.toLocaleDateString(locale, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n })}\n aria-pressed={isSelected}\n aria-current={isToday ? \"date\" : undefined}\n onClick={() => select(date)}\n className={cn(\n \"m-0.5 flex h-8 items-center justify-center rounded-lg text-xs tabular-nums transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-30\",\n isSelected\n ? \"bg-primary font-semibold text-primary-foreground\"\n : cn(\n \"hover:bg-accent\",\n outside ? \"text-muted-foreground/50\" : \"text-foreground\",\n isToday && \"border border-primary/50 font-semibold text-primary\",\n ),\n dayClassName,\n )}\n >\n {date.getDate()}\n </button>\n );\n })}\n </div>\n </div>\n );\n },\n);\n\nCalendar.displayName = \"Calendar\";\n","\"use client\";\n\nimport React, {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { Calendar as CalendarIcon, X } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Calendar, type CalendarProps } from \"./Calendar\";\n\nexport interface DatePickerProps {\n value?: Date | null;\n defaultValue?: Date | null;\n onChange?: (date: Date | null) => void;\n placeholder?: string;\n /** Format the displayed date; defaults to the locale date string. */\n formatDate?: (date: Date) => string;\n label?: string;\n error?: string;\n helperText?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n /** Show an inline clear button while a date is selected. */\n clearable?: boolean;\n /** Forwarded to the inner <Calendar />. */\n calendarProps?: Omit<\n CalendarProps,\n \"value\" | \"defaultValue\" | \"onChange\" | \"className\"\n >;\n id?: string;\n className?: string;\n wrapperClassName?: string;\n\n /** 🔥 Full Customization */\n labelClassName?: string;\n iconClassName?: string;\n textClassName?: string;\n clearButtonClassName?: string;\n clearIconClassName?: string;\n panelClassName?: string;\n helperClassName?: string;\n}\n\nconst SIZES = {\n sm: \"h-8 px-2.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5\",\n md: \"h-10 px-3 text-sm [&_svg]:h-4 [&_svg]:w-4\",\n lg: \"h-12 px-4 text-base [&_svg]:h-5 [&_svg]:w-5\",\n} as const;\n\nexport const DatePicker = forwardRef<HTMLButtonElement, DatePickerProps>(\n function DatePicker(\n {\n value,\n defaultValue = null,\n onChange,\n placeholder = \"Pick a date\",\n formatDate,\n label,\n error,\n helperText,\n size = \"md\",\n disabled = false,\n clearable = false,\n calendarProps,\n id,\n className,\n wrapperClassName,\n labelClassName,\n iconClassName,\n textClassName,\n clearButtonClassName,\n clearIconClassName,\n panelClassName,\n helperClassName,\n },\n ref,\n ) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const panelId = `${generatedId}-panel`;\n const describedBy = helperText || error ? `${fieldId}-description` : undefined;\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState<Date | null>(defaultValue);\n const selected = value !== undefined ? value : internal;\n\n const commit = (next: Date | null) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n };\n\n // Outside-click + Escape, attached only while open.\n useEffect(() => {\n if (!open) return;\n const onMouseDown = (e: MouseEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n };\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n document.addEventListener(\"mousedown\", onMouseDown);\n document.addEventListener(\"keydown\", onKeyDown);\n return () => {\n document.removeEventListener(\"mousedown\", onMouseDown);\n document.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [open]);\n\n const display = selected\n ? formatDate\n ? formatDate(selected)\n : selected.toLocaleDateString()\n : null;\n\n return (\n <div ref={rootRef} className={cn(\"relative w-full\", wrapperClassName)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn(\n \"mb-1.5 block text-[13px] font-medium leading-none text-foreground\",\n labelClassName,\n )}\n >\n {label}\n </label>\n )}\n\n <div className=\"relative\">\n <button\n ref={ref}\n id={fieldId}\n type=\"button\"\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? panelId : undefined}\n aria-invalid={error ? true : undefined}\n aria-describedby={describedBy}\n onClick={() => setOpen((p) => !p)}\n className={cn(\n \"flex w-full items-center gap-2 rounded-lg border bg-transparent text-left transition-colors\",\n \"dark:bg-input/30\",\n error ? \"border-destructive\" : \"border-input\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:border-ring\",\n disabled && \"cursor-not-allowed opacity-50\",\n SIZES[size] ?? SIZES.md,\n // Reserve room for the clear button.\n clearable && selected && \"pr-9\",\n className,\n )}\n >\n <CalendarIcon\n aria-hidden=\"true\"\n className={cn(\"shrink-0 text-muted-foreground\", iconClassName)}\n />\n <span\n className={cn(\n \"truncate\",\n display ? \"text-foreground\" : \"text-muted-foreground\",\n textClassName,\n )}\n >\n {display ?? placeholder}\n </span>\n </button>\n\n {clearable && selected && !disabled && (\n <button\n type=\"button\"\n aria-label=\"Clear date\"\n onClick={() => commit(null)}\n className={cn(\n \"absolute right-2 top-1/2 -translate-y-1/2 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n clearButtonClassName,\n )}\n >\n <X aria-hidden=\"true\" className={cn(\"h-3.5 w-3.5\", clearIconClassName)} />\n </button>\n )}\n </div>\n\n {open && (\n <div\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose date\"\n className={cn(\n \"absolute left-0 z-50 mt-2 rounded-xl border border-border bg-popover p-3 shadow-xl\",\n \"animate-in fade-in\",\n panelClassName,\n )}\n >\n <Calendar\n {...calendarProps}\n value={selected}\n onChange={(date) => {\n commit(date);\n setOpen(false);\n }}\n />\n </div>\n )}\n\n {(helperText || error) && (\n <p\n id={describedBy}\n role={error ? \"alert\" : undefined}\n className={cn(\n \"mt-1.5 text-xs font-medium\",\n error ? \"text-destructive\" : \"text-muted-foreground\",\n helperClassName,\n )}\n >\n {error || helperText}\n </p>\n )}\n </div>\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n","\"use client\";\n\nimport React, {\n forwardRef,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface CarouselProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n children: React.ReactNode;\n defaultIndex?: number;\n onIndexChange?: (index: number) => void;\n /** Auto-advance interval in ms; 0 disables. Pauses on hover/focus. */\n autoPlay?: number;\n /** Wrap from the last slide back to the first. */\n loop?: boolean;\n showArrows?: boolean;\n showDots?: boolean;\n /** Accessible name for the carousel region. */\n label?: string;\n\n /** 🔥 Full Customization */\n trackClassName?: string;\n slidesClassName?: string;\n slideClassName?: string;\n arrowClassName?: string;\n prevArrowClassName?: string;\n nextArrowClassName?: string;\n arrowIconClassName?: string;\n dotsClassName?: string;\n dotClassName?: string;\n}\n\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(\n function Carousel(\n {\n children,\n defaultIndex = 0,\n onIndexChange,\n autoPlay = 0,\n loop = true,\n showArrows = true,\n showDots = true,\n label = \"Carousel\",\n className,\n trackClassName,\n slidesClassName,\n slideClassName,\n arrowClassName,\n prevArrowClassName,\n nextArrowClassName,\n arrowIconClassName,\n dotsClassName,\n dotClassName,\n ...rest\n },\n ref,\n ) {\n const slides = React.Children.toArray(children);\n const count = slides.length;\n\n const [index, setIndex] = useState(() =>\n Math.min(Math.max(defaultIndex, 0), Math.max(count - 1, 0)),\n );\n const [paused, setPaused] = useState(false);\n const touchStartX = useRef<number | null>(null);\n\n const goTo = (next: number) => {\n let target = next;\n if (loop) {\n target = (next + count) % count;\n } else {\n target = Math.min(Math.max(next, 0), count - 1);\n }\n setIndex(target);\n onIndexChange?.(target);\n };\n\n // Auto-play with cleanup; paused on hover/focus for readability and a11y.\n useEffect(() => {\n if (!autoPlay || paused || count <= 1) return;\n const handle = setInterval(() => {\n setIndex((prev) => {\n const next = loop ? (prev + 1) % count : Math.min(prev + 1, count - 1);\n onIndexChange?.(next);\n return next;\n });\n }, autoPlay);\n return () => clearInterval(handle);\n // onIndexChange intentionally omitted — consumers pass inline arrows.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [autoPlay, paused, count, loop]);\n\n if (count === 0) return null;\n\n const arrowClasses = cn(\n \"absolute top-1/2 z-10 -translate-y-1/2 rounded-full border border-border bg-background/80 p-2\",\n \"text-foreground backdrop-blur transition-colors hover:bg-accent\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-40\",\n arrowClassName,\n );\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={label}\n onMouseEnter={() => setPaused(true)}\n onMouseLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={() => setPaused(false)}\n onKeyDown={(e) => {\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n goTo(index - 1);\n } else if (e.key === \"ArrowRight\") {\n e.preventDefault();\n goTo(index + 1);\n }\n }}\n className={cn(\"relative w-full\", className)}\n {...rest}\n >\n {/* Track */}\n <div\n className={cn(\"overflow-hidden rounded-xl\", trackClassName)}\n onTouchStart={(e) => {\n touchStartX.current = e.touches[0].clientX;\n }}\n onTouchEnd={(e) => {\n if (touchStartX.current === null) return;\n const delta = e.changedTouches[0].clientX - touchStartX.current;\n touchStartX.current = null;\n if (Math.abs(delta) > 40) goTo(delta < 0 ? index + 1 : index - 1);\n }}\n >\n <div\n className={cn(\n \"flex transition-transform duration-300 ease-out motion-reduce:transition-none\",\n slidesClassName,\n )}\n style={{ transform: `translateX(-${index * 100}%)` }}\n >\n {slides.map((slide, i) => (\n <div\n key={i}\n role=\"group\"\n aria-roledescription=\"slide\"\n aria-label={`Slide ${i + 1} of ${count}`}\n aria-hidden={i !== index}\n // Hidden slides shouldn't be tabbable.\n inert={i !== index ? true : undefined}\n className={cn(\"w-full shrink-0\", slideClassName)}\n >\n {slide}\n </div>\n ))}\n </div>\n </div>\n\n {/* Arrows */}\n {showArrows && count > 1 && (\n <>\n <button\n type=\"button\"\n aria-label=\"Previous slide\"\n disabled={!loop && index === 0}\n onClick={() => goTo(index - 1)}\n className={cn(arrowClasses, \"left-3\", prevArrowClassName)}\n >\n <ChevronLeft\n aria-hidden=\"true\"\n className={cn(\"h-4 w-4\", arrowIconClassName)}\n />\n </button>\n <button\n type=\"button\"\n aria-label=\"Next slide\"\n disabled={!loop && index === count - 1}\n onClick={() => goTo(index + 1)}\n className={cn(arrowClasses, \"right-3\", nextArrowClassName)}\n >\n <ChevronRight\n aria-hidden=\"true\"\n className={cn(\"h-4 w-4\", arrowIconClassName)}\n />\n </button>\n </>\n )}\n\n {/* Dots */}\n {showDots && count > 1 && (\n <div className={cn(\"mt-3 flex justify-center gap-1.5\", dotsClassName)}>\n {slides.map((_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Go to slide ${i + 1}`}\n aria-current={i === index ? \"true\" : undefined}\n onClick={() => goTo(i)}\n className={cn(\n \"h-2 rounded-full transition-all\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n i === index\n ? \"w-5 bg-primary\"\n : \"w-2 bg-muted-foreground/40 hover:bg-muted-foreground/70\",\n dotClassName,\n )}\n />\n ))}\n </div>\n )}\n </div>\n );\n },\n);\n\nCarousel.displayName = \"Carousel\";\n"],"names":["transformMap","colorMap","Text","as","children","transform","italic","underline","strikethrough","truncate","color","className","rest","Element","isAnchor","jsx","clsx","cn","inputs","twMerge","Button","forwardRef","iconBefore","iconAfter","loading","loadingText","fullWidth","variant","size","disabled","contentClassName","iconClassName","loaderClassName","textClassName","style","contentStyle","iconStyle","loaderStyle","textStyle","type","ref","isDisabled","sizeClasses","gapClasses","loaderBorder","variantClasses","iconSizes","jsxs","Fragment","resolveResponsive","value","Image","props","src","alt","title","width","height","aspectRatio","radius","border","shadow","opacity","objectFit","overlay","overlayColor","clickable","onClick","fallback","imageClassName","overlayClassName","fallbackClassName","imageStyle","overlayStyle","fallbackStyle","resolvedWidth","resolvedHeight","wrapperStyles","useMemo","imageStyles","overlayStyles","fallbackStyles","handleKeyDown","e","sizeMap","paddingMap","Container","React","padding","center","classes","fontSizeMap","dimensionMap","variantMap","statusPositionMap","getStatusDotSize","getStatusBorderWidth","Avatar","isOnline","isOffline","ring","statusPosition","statusClassName","statusStyle","imageError","setImageError","useState","resolvedSize","initials","n","statusColor","statusDotSize","statusBorderWidth","User","Badge","memo","text","icon","iconPosition","rounded","notificationDot","count","pulse","dotClassName","dotStyle","countClassName","countStyle","sizes","variants","isInteractive","paddingClasses","activeClasses","getItemId","item","index","depth","getChildren","getLabel","shouldUseRel","target","rel","ListItem","isInline","isOrdered","showTree","showBullets","showDividers","interactive","listDisabled","density","nestedMode","bulletVariant","activeItemId","expandedIds","toggleExpanded","selectItem","linkComponent","renderItem","itemClassName","itemContentClassName","bulletClassName","badgeClassName","shortcutClassName","trailingClassName","subListClassName","separatorClassName","chevronClassName","externalIconClassName","itemStyle","itemContentStyle","bulletStyle","badgeStyle","shortcutStyle","trailingStyle","subListStyle","separatorStyle","id","hasChildren","itemDisabled","itemActive","controlledExpanded","setExpanded","expanded","collapsible","label","LeadingIcon","LinkComponent","hasAction","isClickable","isExternal","toggle","handleSelect","event","marker","content","ExternalLink","ChevronDown","ChevronRight","sharedElementProps","defaultItem","child","childIndex","List","titleIcon","description","items","defaultActiveItemId","onActiveChange","defaultExpandedIds","onExpandedChange","role","ariaLabel","emptyState","headerClassName","listClassName","titleClassName","descriptionClassName","emptyStateClassName","headerStyle","listStyle","titleStyle","descriptionStyle","ListTag","internalActiveId","setInternalActiveId","internalExpandedIds","setInternalExpandedIds","resolvedActiveId","resolvedExpandedIds","expandedSet","visibleItems","updateExpanded","next","expandedId","LayoutGroupContext","createContext","useConstant","init","useRef","isBrowser","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","PresenceContext","addUniqueItem","arr","removeItem","clamp","min","max","v","formatErrorMessage","message","errorCode","warning","invariant","check","MotionGlobalConfig","isNumericalString","isObject","isZeroValueString","callback","result","noop","any","combineFunctions","a","b","pipe","transformers","progress","from","to","toFromDifference","SubscriptionManager","handler","c","numSubscriptions","i","secondsToMilliseconds","seconds","millisecondsToSeconds","milliseconds","velocityPerSecond","velocity","frameDuration","warned","warnOnce","condition","calcBezier","t","a1","a2","subdivisionPrecision","subdivisionMaxIterations","binarySubdivide","x","lowerBound","upperBound","mX1","mX2","currentX","currentT","cubicBezier","mY1","mY2","getTForX","aX","mirrorEasing","easing","p","reverseEasing","backOut","backIn","backInOut","anticipate","circIn","circOut","circInOut","easeIn","easeOut","easeInOut","isEasingArray","ease","isBezierDefinition","easingLookup","isValidEasing","easingDefinitionToFunction","definition","x1","y1","x2","y2","stepsOrder","createRenderStep","runNextFrame","stepName","thisFrame","nextFrame","isProcessing","flushNextFrame","toKeepAlive","latestFrameData","triggerCallback","step","keepAlive","immediate","queue","frameData","prevFrame","maxElapsed","createRenderBatcher","scheduleNextBatch","allowKeepAlive","useDefaultElapsed","state","flagRunNextFrame","steps","acc","key","setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender","processBatch","useManualTiming","timestamp","wake","process","frame","cancelFrame","frameSteps","now","clearTime","time","newTime","checkStringStartsWith","token","isCSSVariableName","startsAsVariableToken","isCSSVariableToken","singleCssVariableRegex","containsCSSVariable","number","alpha","scale","sanitize","floatRegex","isNullish","singleColorRegex","isColorString","testProp","splitColor","aName","bName","cName","clampRgbUnit","rgbUnit","rgba","red","green","blue","alpha$1","parseHex","r","g","hex","createUnitType","unit","degrees","percent","px","vh","vw","progressPercentage","hsla","hue","saturation","lightness","parsed","colorRegex","test","NUMBER_TOKEN","COLOR_TOKEN","VAR_TOKEN","VAR_FUNCTION_TOKEN","SPLIT_TOKEN","complexRegex","analyseComplexValue","originalValue","values","indexes","types","split","parsedValue","parseComplexValue","buildTransformer","numSections","output","createTransformer","source","convertNumbersToZero","convertToZero","splitBefore","getAnimatableNone","info","complex","hueToRgb","q","hslaToRgba","mixImmediate","mixNumber","mixLinearColor","fromExpo","expo","colorTypes","getColorType","asRGBA","model","mixColor","fromRGBA","toRGBA","blended","invisibleValues","mixVisibility","origin","mixNumber$1","getMixer","mixComplex","mixArray","mixObject","numValues","blendValue","matchOrder","orderedOrigin","pointers","originIndex","originValue","template","originStats","targetStats","mix","frameloopDriver","passTimestamp","generateLinearEasing","duration","resolution","points","numPoints","maxGeneratorDuration","calcGeneratorDuration","generator","timeStep","createGeneratorEasing","options","createGenerator","springDefaults","calcAngularFreq","undampedFreq","dampingRatio","rootIterations","approximateRoot","envelope","derivative","initialGuess","safeMin","findSpring","bounce","mass","exponentialDecay","delta","d","f","stiffness","durationKeys","physicsKeys","isSpringType","keys","getSpringOptions","springOptions","visualDuration","root","damping","derived","spring","optionsOrVisualDuration","restSpeed","restDelta","isResolvedFromDuration","initialVelocity","initialDelta","undampedAngularFreq","isGranularScale","resolveSpring","resolveVelocity","angularFreq","A","sinCoeff","cosCoeff","C","dampedAngularFreq","freqForT","P","sinhCoeff","coshCoeff","sin","cos","current","currentVelocity","calculatedDuration","generatorOptions","velocitySampleDuration","getGeneratorVelocity","resolveValue","prevT","inertia","keyframes","power","timeConstant","bounceDamping","bounceStiffness","modifyTarget","isOutOfBounds","nearestBoundary","amplitude","ideal","calcDelta","calcLatest","applyFriction","latest","timeReachedBoundary","spring$1","checkCatchBoundary","hasUpdatedFrame","createMixers","customMixer","mixers","mixerFactory","numMixers","mixer","easingFunction","interpolate","input","isClamp","inputLength","isZeroDeltaRange","interpolator","progressInRange","fillOffset","offset","remaining","offsetProgress","defaultOffset","convertOffsetToTimes","o","defaultEasing","keyframeValues","times","easingFunctions","absoluteTimes","mapTimeToKeyframe","isNotNull","getFinalKeyframe","repeat","repeatType","finalKeyframe","speed","resolvedKeyframes","transitionTypeMap","replaceTransitionType","transition","WithPromise","resolve","onResolve","onReject","percentToProgress","JSAnimation","motionValue","repeatDelay","keyframes$1","generatorFactory","animationTime","sample","totalDuration","mixKeyframes","mirroredGenerator","resolvedDuration","delay","onUpdate","timeWithoutDelay","isInDelayPhase","elapsed","frameGenerator","currentIteration","iterationProgress","done","isAnimationFinished","reject","newSpeed","hasChanged","driver","startTime","sampleTime","timeline","fillWildcards","radToDeg","rad","rotate","angle","rebaseAngle","matrix2dParsers","rotateZ","scaleX","scaleY","matrix3dParsers","defaultTransformValue","name","parseValueFromTransform","matrix3dMatch","parsers","match","matrix2dMatch","valueParser","convertTransformToNumber","readTransformValue","instance","transformPropOrder","transformProps","isNumOrPxType","transformKeys","nonTranslationalTransformKeys","removeNonTranslationalTransform","visualElement","removedTransforms","positionalValues","paddingLeft","paddingRight","boxSizing","y","paddingTop","paddingBottom","_bbox","top","left","toResolve","isScheduled","anyNeedsMeasurement","isForced","measureAllKeyframes","resolversToMeasure","resolver","elementsToMeasure","transformsToRestore","element","restore","readAllKeyframes","flushKeyframeResolvers","KeyframeResolver","unresolvedKeyframes","onComplete","isAsync","currentValue","valueAsRead","isForcedComplete","isCSSVar","setStyle","supportsFlags","memoSupports","supportsFlag","memoized","supportsScrollTimeline","supportsLinearEasing","cubicBezierAsString","supportedWaapiEasing","mapEasingToNativeEasing","segmentEasing","startWaapiAnimation","valueName","pseudoElement","keyframeOptions","isGenerator","applyGeneratorOptions","NativeAnimation","allowFlatten","keyframe","wasFinished","newStartTime","rangeStart","rangeEnd","observe","unsupportedEasingFunctions","isUnsupportedEase","replaceStringEasing","sampleDelta","NativeAnimationExtended","sampleAnimation","isAnimatable","hasKeyframesChanged","canAnimate","originKeyframe","targetKeyframe","isOriginAnimatable","isTargetAnimatable","makeAnimationInstant","acceleratedValues","browserColorFunctions","hasBrowserOnlyColors","colorProperties","supportsWaapi","supportsBrowserAnimation","transformTemplate","MAX_RESOLVE_DELAY","AsyncMotionValueAnimation","autoplay","optionsWithDefaults","KeyframeResolver$1","forced","sync","isHandoff","canAnimateValue","resolvedOptions","useWaapi","animation","_onReject","calcChildStagger","delayChildren","staggerChildren","staggerDirection","numChildren","maxStaggerDuration","splitCSSVariableRegex","parseCSSVariable","token1","token2","maxDepth","getVariableValue","resolved","trimmed","underDampedSpring","criticallyDampedSpring","keyframesTransition","getDefaultTransition","valueKey","resolveTransition","parentTransition","_","getValueTransition","valueTransition","orchestrationKeys","isTransitionDefined","animateMotionValue","shouldSkip","getValueState","resolveVariantFromProps","custom","resolveVariant","positionalKeys","MAX_VELOCITY_DELTA","isFloat","MotionValue","currentTime","dependent","prevFrameValue","subscription","eventName","unsubscribe","eventManagers","passiveEffect","stopPassiveEffect","prev","endAnimation","startAnimation","isKeyframesTarget","setMotionValue","resolveFinalValueInKeyframes","setTarget","transitionEnd","isMotionValue","isWillChangeMotionValue","addValueToWillChange","willChange","newWillChange","camelToDash","str","optimizedAppearDataId","optimizedAppearDataAttribute","getOptimisedAppearId","shouldBlockAnimation","protectedKeys","needsAnimating","shouldBlock","animateTarget","targetAndTransition","transitionOverride","defaultTransition","reduceMotion","animations","animationTypeState","valueTarget","appearId","shouldReduceMotion","applyTransitionEnd","animateVariant","getAnimation","getChildAnimations","forwardDelay","animateChildren","when","first","last","animateVisualElement","resolvedDefinition","auto","testValueType","dimensionValueTypes","findDimensionValueType","isNone","maxDefaults","applyDefaultFilter","defaultValue","functionRegex","filter","functions","mask","int","transformValueTypes","numberValueTypes","defaultValueTypes","getDefaultValueType","customTypes","defaultValueType","invalidTemplates","makeNoneKeyframesAnimatable","noneKeyframeIndexes","animatableTemplate","noneIndex","DOMKeyframesResolver","originType","targetType","originHasVar","targetHasVar","measureKeyframe","finalKeyframeIndex","unsetTransformName","unsetTransformValue","resolveElements","elementOrSelector","scope","selectorCache","elements","getValueAsType","isHTMLElement","microtask","isDragging","isDragActive","setDragLock","axis","setupGesture","gestureAbortController","eventOptions","isValidHover","hover","onHoverStart","cancel","isPressed","deferredHoverEnd","hoverEndCallback","removePointerLeave","onPointerLeave","endHover","onPointerUp","onPointerDown","leaveEvent","onPointerEnter","enterEvent","onHoverEnd","isNodeOrChild","parent","isPrimaryPointer","keyboardAccessibleElements","isElementKeyboardAccessible","textInputElements","isElementTextInput","isPressing","filterEvents","firePointerEvent","enableKeyboardPress","focusEvent","handleKeydown","handleKeyup","handleBlur","isValidPressEvent","claimedPointerDownEvents","press","targetOrSelector","onPressStart","targets","cancelEvents","startPress","startEvent","onPressEnd","onPointerEnd","endEvent","success","onPointerCancel","upEvent","cancelEvent","isSVGElement","resizeHandlers","observer","getSize","borderBoxAxis","svgAxis","htmlAxis","borderBoxSize","getWidth","getHeight","notifyTarget","notifyAll","entries","createResizeObserver","resizeElement","elementHandlers","windowCallbacks","windowResizeHandler","createWindowResizeHandler","resizeWindow","resize","isSVGSVGElement","valueTypes","findValueType","createAxisDelta","createDelta","createAxis","createBox","visualElementStore","isAnimationControls","isVariantLabel","variantPriorityOrder","variantProps","isControllingVariants","isVariantNode","updateMotionValuesFromProps","nextValue","prevValue","existingValue","latestValue","prefersReducedMotion","hasReducedMotionListener","initPrefersReducedMotion","motionMediaQuery","setReducedMotionPreferences","propEventHandlers","featureDefinitions","setFeatureDefinitions","definitions","getFeatureDefinitions","VisualElement","_props","_prevProps","_visualElement","presenceContext","reducedMotionConfig","skipAnimations","blockInitialAnimation","visualState","latestValues","renderState","initialMotionValues","remove","feature","factory","cleanup","valueIsTransform","removeOnChange","removeSyncCheck","other","featureDefinition","isEnabled","FeatureConstructor","listenerName","listener","closestVariantNode","initial","valueFromInitial","args","DOMVisualElement","vars","Feature","node","convertBoundingBoxToBox","right","bottom","convertBoxToBoundingBox","transformBoxPoints","point","transformPoint","topLeft","bottomRight","isIdentityScale","hasScale","hasTransform","has2DTranslate","is2DTranslate","scalePoint","originPoint","distanceFromOrigin","scaled","applyPointDelta","translate","boxScale","applyAxisDelta","applyBoxDelta","box","TREE_SCALE_SNAP_MIN","TREE_SCALE_SNAP_MAX","applyTreeDeltas","treeScale","treePath","isSharedTransition","treeLength","translateAxis","transformBox","distance","transformAxis","axisTranslate","axisScale","axisOrigin","resolveAxisTranslate","sourceBox","resolveBox","measureViewportBox","measurePageBox","rootProjectionNode","transformPagePoint","viewportBox","scroll","translateAlias","numTransforms","buildTransform","transformString","transformIsDefault","valueIsDefault","valueAsType","transformName","buildHTMLStyles","transformOrigin","hasTransformOrigin","originX","originY","originZ","renderHTML","styleProp","projection","elementStyle","pixelsToPercent","pixels","correctBorderRadius","correctBoxShadow","projectionDelta","original","xScale","yScale","averageScale","scaleCorrectors","isForcedMotionValue","layout","layoutId","scrapeMotionValuesFromProps","prevProps","prevStyle","newValues","getComputedStyle","HTMLVisualElement","computedStyle","dashKeys","camelKeys","buildSVGPath","attrs","length","spacing","useDashCase","cssMotionPathProperties","buildSVGAttrs","attrX","attrY","attrScale","pathLength","pathSpacing","pathOffset","isSVGTag","camelCaseAttributes","tag","renderSVG","_styleProp","scrapeMotionValuesFromProps$1","targetKey","SVGVisualElement","defaultType","numVariantProps","getVariantContext","context","prop","shallowCompare","prevLength","reversePriorityOrder","numAnimationTypes","createAnimateFunction","createAnimationState","animate","createState","isInitialRender","wasReset","buildResolvedTypeValues","setAnimateFunction","makeAnimator","animateChanges","changedActiveType","removedKeys","encounteredKeys","removedVariantIndex","typeState","propIsVariant","activeDelta","isInherited","variantDidChange","checkVariantsDidChange","shouldAnimateType","handledRemovedValues","definitionList","resolvedValues","prevResolvedValues","allKeys","markToAnimate","valueHasChanged","willAnimateViaParent","parentVariant","fallbackAnimation","initialTransition","fallbackTarget","shouldAnimate","setActive","isActive","createTypeState","copyAxisInto","originAxis","copyBoxInto","originBox","copyAxisDeltaInto","originDelta","SCALE_PRECISION","SCALE_MIN","SCALE_MAX","TRANSLATE_PRECISION","TRANSLATE_MIN","TRANSLATE_MAX","calcLength","isNear","maxDistance","calcAxisDelta","calcBoxDelta","calcRelativeAxis","relative","anchor","anchorPoint","calcRelativeBox","calcRelativeAxisPosition","calcRelativePosition","removePointDelta","removeAxisDelta","sourceAxis","removeAxisTransforms","transforms","scaleKey","originKey","xKeys","yKeys","removeBoxTransforms","isAxisDeltaZero","isDeltaZero","axisEquals","boxEquals","axisEqualsRounded","boxEqualsRounded","axisDeltaEquals","eachAxis","buildProjectionTransform","latestTransform","xTranslate","yTranslate","zTranslate","transformPerspective","rotateX","rotateY","skewX","skewY","elementScaleX","elementScaleY","borderLabels","numBorders","asNumber","isPx","mixValues","follow","lead","shouldCrossfadeOpacity","isOnlyMember","easeCrossfadeIn","easeCrossfadeOut","borderLabel","followRadius","getRadius","leadRadius","radiusName","compress","animateSingleValue","motionValue$1","addDomEvent","compareByDepth","FlatTree","timeout","start","checkElapsed","resolveMotionValue","NodeStack","member","inst","prevLead","preserveFollowOpacity","prevDep","nextDep","globalProjectionState","transformAxes","animationTarget","resetDistortingTransform","sharedAnimationValues","cancelTreeOptimisedTransformAnimations","projectionNode","createProjectionNode","attachResizeListener","defaultParent","measureScroll","checkIsScrollRoot","resetTransform","propagateDirtyNodes","resolveTargetDelta","calcProjection","cleanDirtyNodes","subscriptionManager","cancelDelay","innerWidth","resizeUnblockUpdate","newInnerWidth","finishAnimation","hasLayoutChanged","hasRelativeLayoutChanged","newLayout","layoutTransition","defaultLayoutTransition","onLayoutAnimationStart","onLayoutAnimationComplete","hasTargetChanged","hasOnlyRelativeTargetChanged","animationOptions","stack","resetSkewAndRotation","shouldNotifyListeners","wasBlockedByResize","forceLayoutMeasure","clearMeasurements","clearIsLayoutDirty","ensureDraggedNodesSnapshotted","resetTransformStyle","updateLayout","notifyLayoutUpdate","clearSnapshot","removeLeadSnapshots","prevLayout","phase","needsMeasurement","isRoot","isResetRequested","hasProjection","transformTemplateValue","transformTemplateHasChanged","removeTransform","pageBox","layoutBox","roundBox","checkNodeWasScrollRoot","boxWithoutScroll","transformOnly","withTransforms","boxWithoutTransform","forceRecalculation","isShared","relativeParent","parentLayout","canSkip","prevTreeScaleX","prevTreeScaleY","snapshot","snapshotLatestValues","mixedValues","targetDelta","relativeLayout","snapshotSource","layoutSource","isSharedLayoutAnimation","hasOpacityCrossfade","prevRelativeTarget","mixAxisDelta","mixBox","targetWithTransforms","shouldAnimatePositionOnly","xLength","yLength","config","needsReset","hasDistortingTransform","resetValues","targetStyle","valuesToRender","correct","applyTo","isCSSVariable","corrected","num","measuredLayout","animationType","axisSnapshot","snapAxis","layoutDelta","visualDelta","parentSnapshot","relativeSnapshot","onExitComplete","mixAxis","userAgentContains","string","roundPoint","roundAxis","DocumentProjectionNode","notify","HTMLProjectionNode","documentNode","MotionConfigContext","setRef","composeRefs","refs","hasCleanup","cleanups","useComposedRefs","PopChildMeasure","parentWidth","parentHeight","PopChild","isPresent","anchorX","anchorY","pop","useId","nonce","useContext","childRef","composedRef","useInsertionEffect","PresenceChild","presenceAffectsLayout","mode","presenceChildren","newChildrenMap","isReusedContext","childId","isComplete","usePresence","subscribe","register","safeToRemove","useCallback","getChildKey","onlyElements","filtered","Children","isValidElement","AnimatePresence","propagate","isParentPresent","presentChildren","presentKeys","pendingPresentChildren","exitComplete","exitingComponents","diffedChildren","setDiffedChildren","renderedChildren","setRenderedChildren","exitingChildren","nextChildren","forceRender","onExit","isEveryExitComplete","isExitComplete","LazyContext","featureProps","isInitialized","initFeatureDefinitions","initialFeatureDefinitions","getInitializedFeatureDefinitions","loadFeatures","features","validMotionProps","isValidMotionProp","shouldForward","loadExternalIsValidProp","isValidProp","filterProps","isDom","forwardMotionProps","filteredProps","MotionContext","getCurrentTreeVariants","useCreateMotionContext","variantLabelsAsDependency","createHtmlRenderState","copyRawValuesOnly","useInitialMotionValues","useStyle","useHTMLProps","htmlProps","createSvgRenderState","useSVGProps","_isStatic","Component","visualProps","rawStyles","lowercaseSVGElements","isSVGComponent","useRender","isStatic","isSVG","elementProps","createElement","makeState","createRenderState","makeLatestValues","scrapeMotionValues","motionValues","isControllingVariants$1","isVariantNode$1","isInitialAnimationBlocked","variantToSet","list","makeUseVisualState","make","useHTMLVisualState","scrapeHTMLMotionValuesFromProps","useSVGVisualState","scrapeSVGMotionValuesFromProps","motionComponentSymbol","useMotionRef","externalRef","externalRefContainer","refCleanup","SwitchLayoutGroupContext","isRefObject","useVisualElement","createVisualElement","ProjectionNodeConstructor","lazyContext","motionConfig","visualElementRef","hasMountedOnce","initialLayoutGroupConfig","isMounted","optimisedAppearId","wantsHandoff","initialPromotionConfig","drag","dragConstraints","layoutScroll","layoutRoot","layoutAnchor","layoutCrossfade","getClosestProjectingNode","createMotionComponent","preloadedFeatures","useVisualState","MotionDOMComponent","MeasureLayout","configAndProps","useLayoutId","useStrictMode","layoutProjection","getProjectionFunctionality","ForwardRefMotionComponent","layoutGroupId","isStrict","strictMessage","combined","createMotionProxy","componentCache","deprecatedFactoryFunction","_target","createDomVisualElement","AnimationFeature","prevAnimate","ExitAnimationFeature","prevIsPresent","exitAnimation","extractEventInfo","addPointerInfo","addPointerEvent","getContextWindow","distance2D","xDelta","yDelta","overflowStyles","PanSession","handlers","contextWindow","dragSnapToOrigin","distanceThreshold","getPanInfo","isPanStarted","isDistancePastThreshold","onStart","onMove","onEnd","onSessionEnd","resumeAnimation","panInfo","initialInfo","onSessionStart","isWindow","subtractPoint","history","lastDevicePoint","startDevicePoint","getVelocity","timeDelta","timestampedPoint","lastPoint","applyConstraints","elastic","calcRelativeAxisConstraints","calcRelativeConstraints","calcViewportAxisConstraints","layoutAxis","constraintsAxis","calcViewportConstraints","constraintsBox","calcOrigin","sourceLength","targetLength","rebaseAxisConstraints","constraints","relativeConstraints","defaultElastic","resolveDragElastic","dragElastic","resolveAxisElastic","minLabel","maxLabel","resolvePointElastic","elementDragControls","VisualElementDragControls","originEvent","snapToCursor","dragPropagation","onDragStart","measuredAxis","animationState","dragDirectionLock","onDirectionLock","onDrag","getCurrentDirection","snap","finalEvent","finalPanInfo","onDragEnd","_point","shouldDrag","axisValue","prevConstraints","onMeasureDragConstraints","constraintsElement","measuredConstraints","userConstraints","dragMomentum","dragTransition","onDragTransitionEnd","momentumAnimations","dragKey","externalMotionValue","boxProgress","stopPointerListener","dragListener","isClickingTextInputChild","stopResizeObservers","measureDragConstraints","startResizeObservers","stopMeasureLayoutListener","stopResizeListener","stopLayoutUpdateListener","skipFirstCall","isFirst","onResize","stopElement","stopContainer","direction","currentDirection","lockThreshold","DragGesture","dragControls","prevDragControls","asyncHandler","PanGesture","pointerDownEvent","onPanSessionStart","onPanStart","onPan","onPanEnd","hasTakenAnySnapshot","MeasureLayoutWithContext","layoutGroup","switchLayoutGroup","layoutDependency","promoteContext","handleHoverEvent","lifecycle","HoverGesture","_element","FocusGesture","isFocusVisible","handlePressEvent","PressGesture","globalTapTarget","observerCallbacks","observers","fireObserverCallback","entry","fireAllObserverCallbacks","initIntersectionObserver","lookupRoot","rootObservers","observeIntersection","rootInteresectionObserver","thresholdNames","InViewFeature","viewport","rootMargin","amount","once","onIntersectionUpdate","isIntersecting","onViewportEnter","onViewportLeave","hasViewportOptionChanged","prevViewport","gestureAnimations","featureBundle","motion","Dropdown","trigger","controlledOpen","onOpenChange","align","closeOnClick","menuClassName","triggerClassName","menuListClassName","itemIconClassName","itemLabelClassName","menuStyle","internalOpen","setInternalOpen","coords","setCoords","position","setPosition","isControlled","open","dropdownRef","menuRef","menuId","setOpenRef","val","setOpen","handleOutside","handleEscape","updatePosition","triggerRect","menuHeight","spaceBottom","spaceTop","shouldOpenTop","maxLeft","setRefs","menu","createPortal","ToastStore","handle","toastData","existingIndex","store","base","promise","messages","data","error","toast","useToast","POSITION_CLASSES","ToastProvider","maxToasts","containerClassName","toasts","setToasts","ToastItem","variantStyles","IconMap","CheckCircle","AlertCircle","AlertTriangle","Info","Loader2","onClose","closeButtonClassName","DefaultIcon","X","Accordion","allowMultiple","defaultOpen","contentWrapperClassName","contentWrapperStyle","hoverClassName","hoverStyle","borderColor","iconOpen","iconClose","openIndexes","setOpenIndexes","accordionId","ChevronUp","Checkbox","selectedValues","onChange","checked","onCheckedChange","readOnly","required","labelClassName","checkClassName","errorClassName","containerStyle","labelStyle","errorStyle","customIcon","iconSize","containerRef","focusedIndex","setFocusedIndex","generatedId","errorId","handleGroupChange","updated","handleSingleChange","isChecked","option","focused","RadioGroup","selectedValue","iconWrapperClassName","iconWrapperStyle","indicatorClassName","indicatorStyle","orientation","animationDuration","currentSize","groupName","Switch","switchClassName","thumbClassName","switchStyle","thumbStyle","trackWidth","trackHeight","thumbInset","thumbSize","renderSwitch","onToggle","inputValue","isRequired","lockCount","previousOverflow","previousPaddingRight","lock","body","documentElement","scrollbarWidth","unlock","useScrollLock","active","FOCUSABLE","useFocusTrap","container","previouslyFocused","focusable","el","activeEl","Drawer","isOpen","renderContent","disableOverlayClose","disableEscapeClose","panelClassName","panelRef","escapeDisabled","onCloseRef","handleEsc","getMotion","getSizeStyle","handleOverlayClick","motionProps","DrawerContent","DrawerBody","DrawerHeader","titleWrapperClassName","DrawerFooter","DrawerTriggerButton","drawerContent","drawerProps","DrawerButton","Select","onValueChange","placeholder","helperText","multiple","showDescription","showCheckIcon","LabelIcon","PrefixIcon","DropdownIcon","searchClassName","searchStyle","searchPlaceholder","searchable","maxDropdownHeight","valueClassName","dropdownClassName","helperClassName","labelIconClassName","searchWrapperClassName","emptyClassName","itemDescriptionClassName","itemIconStyle","checkIconClassName","checkIconStyle","triggerStyle","dropdownStyle","useImperativeHandle","generatedHelperTextId","search","setSearch","internalValue","setInternalValue","triggerRef","listRef","searchRef","sizeConfig","filteredOptions","opt","rect","selectedIndex","newValue","selectedLabels","hasError","hasValue","helperTextId","triggerId","labelId","dropdownListStyle","Check","SIZE_CONFIG","Input","onFocus","onBlur","prefix","suffixIcon","maxLength","rows","wrapperClassName","inputClassName","textareaClassName","prefixClassName","suffixClassName","helperTextClassName","wrapperStyle","inputStyle","inputRef","fieldId","describedBy","localValue","setLocalValue","visible","setVisible","hasPrefixIcon","hasPrefixText","hasPrefix","handleChange","hasSuffix","getPadding","baseInputStyles","EyeOff","Eye","Textarea","Icon","autoResize","minRows","maxRows","submitOnEnter","onSubmit","helperStyle","innerRef","resizeTextarea","lineHeight","minHeight","maxHeight","newHeight","currentLength","showCount","Modal","dialogClassName","dialogRef","pressedOnOverlay","ModalContent","maxWidth","showCloseButton","closeButtonStyle","hasCloseButton","ModalHeader","ModalBody","ModalFooter","ModalButton","action","pending","setPending","handleClick","err","ModalTriggerButton","modalContent","modalProps","Table","tableClassName","tableStyle","responsive","striped","hoverable","bordered","dense","THead","TBody","TRow","TH","TD","useBreakpoint","breakpoint","isMobile","setIsMobile","mq","TabsContext","useTabsContext","ctx","Tabs","defaultActive","transitionDuration","mobileBreakpoint","mobileVariant","backgroundColor","primaryColor","activeColor","textColor","hoverColor","disabledColor","onTabChange","tabCount","resolvedCount","setResolvedCount","drawerOpen","setDrawerOpen","handleSetActive","effectivePosition","isVertical","ChevronIcon","TabList","gap","drawerLabel","activeLabel","Tab","selfIndexRef","buttonRef","resolvedIndex","idx","forceFullWidth","baseVariant","activeVariant","hoverVariant","TabPanels","TabPanel","keepMounted","ThemeToggleButton","sunClassName","moonClassName","isDark","toggleTheme","Sun","Moon","paddingContext","SECTION_PADDING","Card","CardHeader","actionClassName","CardBody","CardFooter","H_SPACING","V_SPACING","Divider","dashed","lineClassName","SIZES","COLORS","Chip","onRemove","removeButtonClassName","removeIconClassName","palette","Kbd","Skeleton","lines","animated","Spinner","colorClassName","LINEAR_SIZES","CIRCULAR_SIZES","Progress","showValue","trackClassName","fillClassName","indeterminate","clamped","ariaProps","stroke","circumference","Stat","trend","trendValue","footerClassName","trendClassName","trendIconClassName","TrendIcon","TrendingUp","TrendingDown","Minus","EmptyState","Inbox","DOT","Timeline","connectorClassName","timeClassName","compact","status","isLast","Breadcrumb","separator","maxItems","activeItemClassName","ellipsisClassName","MoreHorizontal","buildRange","page","totalPages","siblingCount","maxVisible","end","showLeftEllipsis","showRightEllipsis","middle","Pagination","onPageChange","prevButtonClassName","nextButtonClassName","pageButtonClassName","activePageButtonClassName","clampedPage","go","baseButton","ChevronLeft","Stepper","activeStep","onStepClick","dotButtonClassName","vertical","renderDot","dot","POSITIONS","ARROWS","Tooltip","arrowClassName","tooltipId","timer","show","hide","onKey","Popover","closeOnClickOutside","closeOnEscape","panelId","rootRef","onMouseDown","onKeyDown","TRACK","Slider","formatValue","marks","labelRowClassName","marksClassName","markClassName","sliderId","internal","setInternal","mark","markPercent","NumberInput","inputWrapperClassName","decrementButtonClassName","incrementButtonClassName","raw","setRaw","displayed","commit","nudge","handleInput","stepperButton","Plus","Rating","allowClear","starClassName","emptyStarClassName","starWrapperClassName","hovered","setHovered","starSize","select","Star","starValue","filled","TagInput","maxTags","validate","addOnBlur","chipClassName","chipRemoveClassName","draft","setDraft","tags","atLimit","addTag","removeTag","PinInput","autoFocus","boxClassName","groupId","inputsRef","chars","allowed","setChar","char","focusBox","handlePaste","formatBytes","bytes","FileUpload","onFilesChange","onError","accept","maxSizeMB","maxFiles","hideFileList","dropzoneClassName","fileItemClassName","fileIconClassName","fileNameClassName","fileSizeClassName","inputId","files","setFiles","dragging","setDragging","setMessage","addFiles","incoming","file","msg","removeFile","UploadCloud","FileIcon","STYLES","Callout","dismissible","onDismiss","hidden","setHidden","Toggle","pressed","defaultPressed","onPressedChange","ToggleGroup","isSelected","selected","ICON_ONLY","CopyButton","feedbackDuration","onCopied","copied","setCopied","copy","textarea","Copy","COUNTER_SIZES","AvatarGroup","counterClassName","overflow","isSameDay","stripTime","Calendar","defaultMonth","minDate","maxDate","isDateDisabled","weekStartsOn","locale","navButtonClassName","monthLabelClassName","weekdaysClassName","weekdayClassName","daysClassName","dayClassName","viewMonth","setViewMonth","today","date","shiftMonth","m","firstOffset","cells","weekdays","monthLabel","day","outside","isToday","DatePicker","formatDate","clearable","calendarProps","clearButtonClassName","clearIconClassName","display","CalendarIcon","Carousel","defaultIndex","onIndexChange","autoPlay","loop","showArrows","showDots","slidesClassName","slideClassName","prevArrowClassName","nextArrowClassName","arrowIconClassName","dotsClassName","slides","setIndex","paused","setPaused","touchStartX","goTo","arrowClasses","slide"],"mappings":"mhBAyBMA,GAAe,CACnB,UAAW,YACX,UAAW,YACX,WAAY,YACd,EAEMC,GAAmC,CACvC,QAAS,kBACT,QAAS,eACT,MAAO,uBACT,EAIO,SAASC,GAAwC,CACtD,GAAAC,EACA,SAAAC,EACA,UAAAC,EACA,OAAAC,EACA,UAAAC,EACA,cAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,UACR,UAAAC,EACA,GAAGC,CACL,EAAiB,CACf,MAAMC,EAAWV,GAAM,IACjBW,EAAWD,IAAY,IAE7B,OACEE,EAAAA,IAACF,EAAA,CACC,UAAWG,EACTL,EAEAN,GAAaL,GAAaK,CAAS,EAEnCC,GAAU,SACVC,GAAa,YACbC,GAAiB,eAEjBC,GAAY,WAEZK,GAAY,0CAEZb,GAASS,CAAK,GAAKA,CAAA,EAEpB,GAAII,GAAY,CAAE,IAAK,qBAAA,EACvB,GAAGF,EAEH,SAAAR,CAAA,CAAA,CAGP,CClEO,MAAMa,EAAK,IAAIC,IAAyBC,GAAAA,QAAQH,EAAKE,CAAM,CAAC,ECsCtDE,GAASC,EAAAA,WACpB,SACE,CACE,SAAAjB,EACA,WAAAkB,EACA,UAAAC,EACA,QAAAC,EAAU,GACV,YAAAC,EAAc,aACd,UAAAC,EAAY,GACZ,QAAAC,EAAU,UACV,KAAAC,EAAO,KACP,SAAAC,EAEA,UAAAlB,EACA,iBAAAmB,EACA,cAAAC,EACA,gBAAAC,EACA,cAAAC,EAEA,MAAAC,EACA,aAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EAEA,KAAAC,EAAO,SACP,GAAG3B,CAAA,EAEL4B,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AG,mCAAoCowE,CAAa,EACjE,SAAAC,EAAO,IAAI,CAACjgD,EAAG/f,IACdvQ,EAAAA,IAAC,SAAA,CAEC,KAAK,SACL,aAAY,eAAeuQ,EAAI,CAAC,GAChC,eAAcA,IAAMhJ,EAAQ,OAAS,OACrC,QAAS,IAAMqpE,EAAKrgE,CAAC,EACrB,UAAWrQ,EACT,kCACA,0EACAqQ,IAAMhJ,EACF,iBACA,0DACJX,CAAA,CACF,EAZK2J,CAAA,CAcR,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,CACF,EAEAm/D,GAAS,YAAc","x_google_ignoreList":[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271]}