{"slug":"loading-states","name":"Agent Loading States","description":"Three thoughtful loading states for AI interfaces: shimmering status text, live agent progress, and cycling reasoning phrases.","category":"agents","source_url":"https:\/\/beui.dev\/r\/loading-states\/raw","detail_url":"https:\/\/beui.dev\/r\/loading-states","raw_url":"https:\/\/beui.dev\/r\/loading-states\/raw","page_url":"https:\/\/beui.dev\/components\/agents\/loading-states","markdown_url":"https:\/\/beui.dev\/components\/agents\/loading-states.md","published_at":"2026-07-30","updated_at":"2026-11-25","dependencies":["clsx","motion","react","tailwind-merge"],"internal":[".\/agent-progress",".\/messages",".\/reasoning-text",".\/thinking-shimmer","@\/components\/motion\/loader","@\/components\/motion\/text-scramble","@\/components\/motion\/text-shimmer","@\/lib\/ease","@\/lib\/i18n","@\/lib\/text-shimmer","@\/lib\/utils"],"install_slugs":["reasoning-text","thinking-shimmer","agent-progress"],"requires_theme":false,"props":[{"displayName":"AgentProgress","props":[{"name":"label","type":"string","required":false,"defaultValue":null,"description":"Verb describing the agent's current activity."},{"name":"elapsedSeconds","type":"number","required":false,"defaultValue":null,"description":"Controlled elapsed time in seconds."},{"name":"initialSeconds","type":"number","required":false,"defaultValue":"0","description":"Starting time for the internal timer, in seconds."},{"name":"running","type":"boolean","required":false,"defaultValue":"true","description":"Whether the internal timer should advance. Ignored when elapsedSeconds is provided."},{"name":"labels","type":"Partial<{ thinking: string; churning: string; inProgress: string; reasoning: string; phraseThinking: string; phraseReading: string; phraseConnecting: string; phraseForming: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string. `{label}` fills `inProgress`."},{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."}]},{"displayName":"ReasoningText","props":[{"name":"phrases","type":"string[]","required":false,"defaultValue":null,"description":"Phrases cycled through while the agent works."},{"name":"variant","type":"\"cascade\" | \"scramble\" | \"swap\"","required":false,"defaultValue":"cascade","description":"Animation used when the active phrase changes."},{"name":"interval","type":"number","required":false,"defaultValue":"1800","description":"Milliseconds each phrase remains visible."},{"name":"shimmerDuration","type":"number","required":false,"defaultValue":"2.2","description":"Seconds taken for one shimmer pass."},{"name":"indicator","type":"ReactNode","required":false,"defaultValue":null,"description":"Optional leading visual. Defaults to a terminal-style ASCII loader."},{"name":"labels","type":"Partial<{ thinking: string; churning: string; inProgress: string; reasoning: string; phraseThinking: string; phraseReading: string; phraseConnecting: string; phraseForming: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string, including the default phrases."},{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the root element."}]},{"displayName":"ThinkingShimmer","props":[{"name":"children","type":"ReactNode","required":false,"defaultValue":null,"description":"Loading message shown to the user."},{"name":"duration","type":"number","required":false,"defaultValue":"1.8","description":"Seconds taken for one shimmer pass."},{"name":"labels","type":"Partial<{ thinking: string; churning: string; inProgress: string; reasoning: string; phraseThinking: string; phraseReading: string; phraseConnecting: string; phraseForming: string; }>","required":false,"defaultValue":null,"description":"Override any built-in string."},{"name":"className","type":"string","required":false,"defaultValue":null,"description":"Classes merged onto the shimmering text."}]}],"types":[],"files":[{"path":"components\/agents\/loading-states\/index.ts","type":"component","content":"\/\/ beui.dev\/components\/agents\/loading-states\nexport {\n  AgentProgress,\n  type AgentProgressProps,\n} from \".\/agent-progress\";\nexport {\n  type LoadingStatesMessages,\n  loadingStatesMessages,\n} from \".\/messages\";\nexport {\n  ReasoningText,\n  type ReasoningTextProps,\n  type ReasoningTextVariant,\n} from \".\/reasoning-text\";\nexport {\n  ThinkingShimmer,\n  type ThinkingShimmerProps,\n} from \".\/thinking-shimmer\";\n"},{"path":"components\/agents\/loading-states\/thinking-shimmer.tsx","type":"component","content":"\"use client\";\n\/\/ beui.dev\/components\/agents\/loading-states\n\nimport type { ReactNode } from \"react\";\nimport { TextShimmer } from \"@\/components\/motion\/text-shimmer\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\nimport { type LoadingStatesMessages, loadingStatesMessages } from \".\/messages\";\n\nexport interface ThinkingShimmerProps {\n  \/** Loading message shown to the user. *\/\n  children?: ReactNode;\n  \/** Seconds taken for one shimmer pass. *\/\n  duration?: number;\n  \/** Override any built-in string. *\/\n  labels?: Partial<LoadingStatesMessages>;\n  \/** Classes merged onto the shimmering text. *\/\n  className?: string;\n}\n\nexport function ThinkingShimmer({\n  children,\n  duration = 1.8,\n  labels,\n  className,\n}: ThinkingShimmerProps) {\n  const t = useMessages(\"loadingStates\", loadingStatesMessages, labels);\n\n  return (\n    <TextShimmer\n      as=\"span\"\n      duration={duration}\n      className={cn(\"font-medium\", className)}\n    >\n      {children ?? t(\"thinking\")}\n    <\/TextShimmer>\n  );\n}\n"},{"path":"components\/agents\/loading-states\/agent-progress.tsx","type":"component","content":"\"use client\";\n\/\/ beui.dev\/components\/agents\/loading-states\n\nimport { motion, useReducedMotion } from \"motion\/react\";\nimport { useEffect, useState } from \"react\";\nimport { EASE_IN_OUT } from \"@\/lib\/ease\";\nimport { useLocale, useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\nimport { type LoadingStatesMessages, loadingStatesMessages } from \".\/messages\";\n\nconst GRID_CELLS = [\n  { id: \"top-left\", delay: 0 },\n  { id: \"top-center\", delay: 0.14 },\n  { id: \"top-right\", delay: 0.28 },\n  { id: \"middle-left\", delay: 0.42 },\n  { id: \"middle-center\", delay: 0.56 },\n  { id: \"middle-right\", delay: 0.7 },\n  { id: \"bottom-left\", delay: 0.84 },\n  { id: \"bottom-center\", delay: 0.98 },\n  { id: \"bottom-right\", delay: 1.12 },\n];\n\nexport interface AgentProgressProps {\n  \/** Verb describing the agent's current activity. *\/\n  label?: string;\n  \/** Controlled elapsed time in seconds. *\/\n  elapsedSeconds?: number;\n  \/** Starting time for the internal timer, in seconds. *\/\n  initialSeconds?: number;\n  \/** Whether the internal timer should advance. Ignored when elapsedSeconds is provided. *\/\n  running?: boolean;\n  \/** Override any built-in string. `{label}` fills `inProgress`. *\/\n  labels?: Partial<LoadingStatesMessages>;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n}\n\nfunction formatElapsed(totalSeconds: number, locale?: string) {\n  const safeSeconds = Math.max(0, totalSeconds);\n  const minutes = Math.floor(safeSeconds \/ 60);\n  const remainder = safeSeconds % 60;\n\n  \/\/ Without a locale keep the exact English text so server and client match.\n  if (!locale) {\n    const seconds = remainder.toFixed(1);\n    return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;\n  }\n\n  const seconds = new Intl.NumberFormat(locale, {\n    style: \"unit\",\n    unit: \"second\",\n    unitDisplay: \"narrow\",\n    minimumFractionDigits: 1,\n    maximumFractionDigits: 1,\n  }).format(remainder);\n  if (minutes === 0) return seconds;\n  const minuteText = new Intl.NumberFormat(locale, {\n    style: \"unit\",\n    unit: \"minute\",\n    unitDisplay: \"narrow\",\n  }).format(minutes);\n  return `${minuteText} ${seconds}`;\n}\n\nexport function AgentProgress({\n  label: labelProp,\n  elapsedSeconds,\n  initialSeconds = 0,\n  running = true,\n  labels,\n  className,\n}: AgentProgressProps) {\n  const t = useMessages(\"loadingStates\", loadingStatesMessages, labels);\n  const { locale } = useLocale();\n  const label = labelProp ?? t(\"churning\");\n  const reduce = useReducedMotion() ?? false;\n  const [internalSeconds, setInternalSeconds] = useState(initialSeconds);\n\n  useEffect(() => {\n    if (elapsedSeconds !== undefined || !running) return;\n\n    const startedAt = performance.now() - initialSeconds * 1000;\n    const timer = window.setInterval(() => {\n      setInternalSeconds((performance.now() - startedAt) \/ 1000);\n    }, 100);\n\n    return () => window.clearInterval(timer);\n  }, [elapsedSeconds, initialSeconds, running]);\n\n  const elapsed = elapsedSeconds ?? internalSeconds;\n\n  return (\n    <span\n      role=\"status\"\n      aria-label={t(\"inProgress\", { label })}\n      className={cn(\n        \"inline-flex items-center gap-3 font-mono text-sm text-muted-foreground\",\n        className,\n      )}\n    >\n      <span\n        aria-hidden=\"true\"\n        className=\"grid size-5 shrink-0 grid-cols-3 gap-[2px]\"\n      >\n        {GRID_CELLS.map(({ id, delay }) => (\n          <motion.span\n            key={id}\n            className=\"rounded-[1px] bg-current\"\n            animate={\n              reduce\n                ? { opacity: [0.35, 0.8, 0.35] }\n                : {\n                    opacity: [0.28, 1, 0.28],\n                    scale: [0.72, 1, 0.72],\n                  }\n            }\n            transition={{\n              duration: 1.55,\n              ease: EASE_IN_OUT,\n              repeat: Infinity,\n              delay,\n            }}\n          \/>\n        ))}\n      <\/span>\n      <span className=\"font-sans font-medium\">{label}<\/span>\n      <span\n        aria-hidden=\"true\"\n        className=\"tabular-nums text-muted-foreground\/70\"\n      >\n        {formatElapsed(elapsed, locale)}\n      <\/span>\n    <\/span>\n  );\n}\n"},{"path":"components\/agents\/loading-states\/reasoning-text.tsx","type":"component","content":"\"use client\";\n\/\/ beui.dev\/components\/agents\/loading-states\n\nimport { AnimatePresence, motion, useReducedMotion } from \"motion\/react\";\nimport { type ReactNode, useEffect, useId, useState } from \"react\";\nimport { Loader } from \"@\/components\/motion\/loader\";\nimport { TextScramble } from \"@\/components\/motion\/text-scramble\";\nimport { EASE_OUT, SPRING_SWAP } from \"@\/lib\/ease\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport {\n  TEXT_SHIMMER_CLASS_NAME,\n  TEXT_SHIMMER_HIGHLIGHT_CLASS_NAME,\n  TEXT_SHIMMER_KEYFRAMES,\n  textShimmerStyle,\n} from \"@\/lib\/text-shimmer\";\nimport { cn } from \"@\/lib\/utils\";\nimport { type LoadingStatesMessages, loadingStatesMessages } from \".\/messages\";\n\nconst CASCADE_STAGGER = 0.025;\n\nexport type ReasoningTextVariant = \"cascade\" | \"swap\" | \"scramble\";\n\nexport interface ReasoningTextProps {\n  \/** Phrases cycled through while the agent works. *\/\n  phrases?: string[];\n  \/** Animation used when the active phrase changes. *\/\n  variant?: ReasoningTextVariant;\n  \/** Milliseconds each phrase remains visible. *\/\n  interval?: number;\n  \/** Seconds taken for one shimmer pass. *\/\n  shimmerDuration?: number;\n  \/** Optional leading visual. Defaults to a terminal-style ASCII loader. *\/\n  indicator?: ReactNode;\n  \/** Override any built-in string, including the default phrases. *\/\n  labels?: Partial<LoadingStatesMessages>;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n}\n\ntype PhraseProps = {\n  phrase: string;\n  reduce: boolean;\n  shimmerDuration: number;\n};\n\nfunction CascadePhrase({\n  phrase,\n  reduce,\n  shimmerDuration,\n}: PhraseProps) {\n  const text = `${phrase}\u2026`;\n\n  if (reduce) {\n    return (\n      <span\n        className={cn(\n          \"col-start-1 row-start-1 inline-block justify-self-start whitespace-pre\",\n          TEXT_SHIMMER_CLASS_NAME,\n        )}\n        style={textShimmerStyle(shimmerDuration)}\n      >\n        {text}\n      <\/span>\n    );\n  }\n\n  \/\/ The letters land plain; one highlight layer over the whole phrase carries\n  \/\/ the shimmer, so it sweeps across instead of every letter pulsing at once.\n  \/\/ It fades in as the last letter settles.\n  const settle = text.length * CASCADE_STAGGER + 0.2;\n\n  return (\n    <AnimatePresence initial={false}>\n      <motion.span\n        key={phrase}\n        className=\"relative col-start-1 row-start-1 inline-block justify-self-start whitespace-pre [font-kerning:none] [font-variant-ligatures:none]\"\n        initial=\"initial\"\n        animate=\"animate\"\n        exit=\"exit\"\n      >\n        {text.split(\"\").map((character, characterIndex) => (\n          <motion.span\n            \/\/ biome-ignore lint\/suspicious\/noArrayIndexKey: position is the stable cascade slot identity.\n            key={characterIndex}\n            custom={characterIndex * CASCADE_STAGGER}\n            \/\/ Own states: a phrase that cycles back re-enters mid-exit, and\n            \/\/ only owned targets are restored.\n            initial=\"initial\"\n            animate=\"animate\"\n            exit=\"exit\"\n            variants={{\n              initial: { opacity: 0, y: \"100%\" },\n              animate: (delay: number) => ({\n                opacity: 1,\n                y: \"0%\",\n                transition: { ...SPRING_SWAP, delay },\n              }),\n              exit: (delay: number) => ({\n                opacity: 0,\n                y: \"-100%\",\n                transition: {\n                  duration: 0.14,\n                  ease: EASE_OUT,\n                  delay: delay * 0.45,\n                },\n              }),\n            }}\n            className=\"inline-block whitespace-pre text-muted-foreground will-change-[opacity,transform]\"\n          >\n            {character}\n          <\/motion.span>\n        ))}\n        <motion.span\n          aria-hidden=\"true\"\n          variants={{\n            initial: { opacity: 0 },\n            animate: { opacity: 1, transition: { duration: 0.3, ease: EASE_OUT, delay: settle } },\n            exit: { opacity: 0, transition: { duration: 0.1, ease: EASE_OUT } },\n          }}\n          className={cn(\n            \"pointer-events-none absolute inset-0 whitespace-pre\",\n            TEXT_SHIMMER_HIGHLIGHT_CLASS_NAME,\n          )}\n          style={textShimmerStyle(shimmerDuration)}\n        >\n          {text}\n        <\/motion.span>\n      <\/motion.span>\n    <\/AnimatePresence>\n  );\n}\n\nfunction SwapPhrase({ phrase, reduce, shimmerDuration }: PhraseProps) {\n  return (\n    <AnimatePresence initial={false}>\n      <motion.span\n        key={phrase}\n        className={cn(\n          \"col-start-1 row-start-1 inline-block justify-self-start whitespace-nowrap will-change-[opacity,transform]\",\n          TEXT_SHIMMER_CLASS_NAME,\n        )}\n        style={textShimmerStyle(shimmerDuration)}\n        initial={reduce ? { opacity: 0 } : { opacity: 0, y: 3 }}\n        animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0 }}\n        exit={reduce ? { opacity: 0 } : { opacity: 0, y: -3 }}\n        transition={{\n          duration: reduce ? 0.12 : 0.2,\n          ease: EASE_OUT,\n        }}\n      >\n        {phrase}\u2026\n      <\/motion.span>\n    <\/AnimatePresence>\n  );\n}\n\nfunction ScramblePhrase({\n  phrase,\n  shimmerDuration,\n}: PhraseProps) {\n  const target = `${phrase}\u2026`;\n\n  return (\n    <TextScramble\n      text={target}\n      className={cn(\n        \"col-start-1 row-start-1 justify-self-start tabular-nums\",\n        TEXT_SHIMMER_CLASS_NAME,\n      )}\n      style={textShimmerStyle(shimmerDuration)}\n    \/>\n  );\n}\n\nexport function ReasoningText({\n  phrases,\n  variant = \"cascade\",\n  interval = 1800,\n  shimmerDuration = 2.2,\n  indicator,\n  labels,\n  className,\n}: ReasoningTextProps) {\n  const t = useMessages(\"loadingStates\", loadingStatesMessages, labels);\n  const reduce = useReducedMotion() ?? false;\n  const [index, setIndex] = useState(0);\n  const statusId = useId();\n  const safePhrases =\n    phrases && phrases.length > 0\n      ? phrases\n      : [\n          t(\"phraseThinking\"),\n          t(\"phraseReading\"),\n          t(\"phraseConnecting\"),\n          t(\"phraseForming\"),\n        ];\n  const phrase = safePhrases[index % safePhrases.length];\n  const longestPhrase = safePhrases.reduce((longest, current) =>\n    current.length > longest.length ? current : longest,\n  );\n  const phraseProps = { phrase, reduce, shimmerDuration };\n\n  useEffect(() => {\n    if (safePhrases.length < 2) return;\n\n    const timer = window.setInterval(() => {\n      setIndex((current) => (current + 1) % safePhrases.length);\n    }, Math.max(600, interval));\n\n    return () => window.clearInterval(timer);\n  }, [interval, safePhrases.length]);\n\n  return (\n    <>\n      <style>{TEXT_SHIMMER_KEYFRAMES}<\/style>\n      <span\n        role=\"status\"\n        aria-live=\"polite\"\n        aria-labelledby={statusId}\n        className={cn(\n          \"inline-flex items-center gap-2 text-sm font-medium text-muted-foreground\",\n          className,\n        )}\n      >\n        <span aria-hidden=\"true\" className=\"inline-flex size-3 shrink-0 items-center justify-center\">\n          {indicator ?? (\n            <Loader\n              variant=\"ascii-line\"\n              size={14}\n              speed={0.8}\n              label={t(\"reasoning\")}\n            \/>\n          )}\n        <\/span>\n\n        <span aria-hidden=\"true\" className=\"grid overflow-hidden text-left\">\n          <span className=\"invisible col-start-1 row-start-1 whitespace-nowrap\">\n            {longestPhrase}\u2026\n          <\/span>\n          {variant === \"cascade\" ? (\n            <CascadePhrase {...phraseProps} \/>\n          ) : variant === \"scramble\" ? (\n            <ScramblePhrase {...phraseProps} \/>\n          ) : (\n            <SwapPhrase {...phraseProps} \/>\n          )}\n        <\/span>\n\n        <span id={statusId} className=\"sr-only\">\n          {phrase}\n        <\/span>\n      <\/span>\n    <\/>\n  );\n}\n"},{"path":"components\/agents\/loading-states\/messages.ts","type":"util","content":"\/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. *\/\nexport const loadingStatesMessages = {\n  thinking: \"Thinking\u2026\",\n  churning: \"Churning\",\n  inProgress: \"{label}, in progress\",\n  reasoning: \"Reasoning\",\n  phraseThinking: \"Thinking\",\n  phraseReading: \"Reading the context\",\n  phraseConnecting: \"Connecting the details\",\n  phraseForming: \"Forming a response\",\n};\n\nexport type LoadingStatesMessages = typeof loadingStatesMessages;\n"},{"path":"components\/motion\/text-shimmer.tsx","type":"util","content":"import { cn } from \"@\/lib\/utils\";\nimport type { ElementType, ReactNode } from \"react\";\nimport {\n  TEXT_SHIMMER_CLASS_NAME,\n  TEXT_SHIMMER_KEYFRAMES,\n  textShimmerStyle,\n} from \"@\/lib\/text-shimmer\";\n\nexport interface TextShimmerProps {\n  children: ReactNode;\n  \/** Element to render the text as. Default: \"span\" *\/\n  as?: ElementType;\n  \/** Length of one shimmer sweep (s). Default: 2.5 *\/\n  duration?: number;\n  \/** Classes merged onto the text element. *\/\n  className?: string;\n}\n\nexport function TextShimmer({ children, as: Comp = \"span\", duration = 2.5, className }: TextShimmerProps) {\n  return (\n    <>\n      <style>\n        {TEXT_SHIMMER_KEYFRAMES}\n      <\/style>\n      <Comp\n        style={textShimmerStyle(duration)}\n        className={cn(\n          \"inline-block\",\n          TEXT_SHIMMER_CLASS_NAME,\n          className,\n        )}\n      >\n        {children}\n      <\/Comp>\n    <\/>\n  );\n}\n"},{"path":"lib\/i18n.tsx","type":"util","content":"\"use client\";\n\nimport {\n  createContext,\n  type ReactNode,\n  useCallback,\n  useContext,\n  useMemo,\n} from \"react\";\n\n\/**\n * A component's messages. Plain strings with `{name}` placeholders, so a\n * dictionary stays JSON-serializable and can be passed from a server layout.\n * There are no plural forms: write messages that read correctly for any count.\n *\/\nexport type Messages = Record<string, string>;\n\n\/** A language file: component namespace \u2192 any subset of that component's messages. *\/\nexport type LocaleMessages = Record<string, Partial<Messages>>;\n\ntype LocaleContextValue = {\n  locale?: string;\n  messages: LocaleMessages;\n};\n\nconst NO_MESSAGES: LocaleMessages = {};\n\nconst LocaleContext = createContext<LocaleContextValue>({ messages: NO_MESSAGES });\n\n\/** Without a locale, digits stay plain so server and client render the same text. *\/\nexport function formatNumber(value: number, locale?: string) {\n  return locale ? new Intl.NumberFormat(locale).format(value) : String(value);\n}\n\nexport interface LocaleProviderProps {\n  \/** BCP 47 tag, e.g. `de`, `pt-BR`. Drives `Intl` number formatting. *\/\n  locale: string;\n  \/**\n   * Component namespace \u2192 translated strings. Missing keys fall back to English.\n   * Pass a stable object (a module constant, imported JSON or a memoized value):\n   * a new object each render gives every translated component a new `t`.\n   *\/\n  messages?: LocaleMessages;\n  children: ReactNode;\n}\n\nexport function LocaleProvider({ locale, messages = NO_MESSAGES, children }: LocaleProviderProps) {\n  const value = useMemo(() => ({ locale, messages }), [locale, messages]);\n  return <LocaleContext.Provider value={value}>{children}<\/LocaleContext.Provider>;\n}\n\nexport function useLocale(): { locale?: string } {\n  return { locale: useContext(LocaleContext).locale };\n}\n\n\/**\n * Resolves a component's strings: `labels` prop, then the provider's\n * messages for `namespace`, then the component's English `defaults`.\n * Numbers passed as values are formatted for the provider's locale.\n *\/\nexport function useMessages<T extends Messages>(\n  namespace: string,\n  defaults: T,\n  labels?: Partial<T>,\n) {\n  const { locale, messages } = useContext(LocaleContext);\n  const provided = messages[namespace];\n  \/\/ Inline `labels={{ \u2026 }}` is a new object every render. Keying it by content\n  \/\/ keeps `t` one identity until a label changes, so effects and memos that\n  \/\/ depend on `t` don't re-run per render, and render-time reads never lag.\n  const labelsKey = labels ? JSON.stringify(labels) : \"\";\n  const stableLabels = useMemo(\n    () => (labelsKey ? (JSON.parse(labelsKey) as Partial<T>) : undefined),\n    [labelsKey],\n  );\n\n  return useCallback(\n    (key: keyof T & string, values?: Record<string, string | number>) => {\n      const template = stableLabels?.[key] ?? provided?.[key] ?? defaults[key];\n      if (!values) return template;\n      return template.replace(\/\\{(\\w+)\\}\/g, (match, name: string) => {\n        const value = values[name];\n        if (value === undefined) return match;\n        return typeof value === \"number\" ? formatNumber(value, locale) : value;\n      });\n    },\n    [defaults, stableLabels, locale, provided],\n  );\n}\n"},{"path":"lib\/utils.ts","type":"util","content":"import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"},{"path":"lib\/ease.ts","type":"util","content":"\/\/ Shared motion tokens. Easing curves mirror the CSS custom properties in\n\/\/ globals.css; springs are the canonical physics used across components.\n\/\/ Strong custom variants - defaults like `ease-in`\/`ease-out` feel weak.\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\n\/** Accelerating curve for things that fall (a dropped ball, a toppled block). Not for UI entrances. *\/\nexport const EASE_IN = [0.55, 0, 1, 0.45] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n\/** CSS string form of EASE_OUT for inline style transitions. *\/\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n\/** Press feedback on buttons and other tappable surfaces. *\/\nexport const SPRING_PRESS = {\n  type: \"spring\",\n  stiffness: 500,\n  damping: 30,\n  mass: 0.6,\n} as const;\n\n\/** Content swaps - label\/icon slots trading places inside a control. *\/\nexport const SPRING_SWAP = {\n  type: \"spring\",\n  stiffness: 460,\n  damping: 30,\n  mass: 0.55,\n} as const;\n\n\/** Overlay panel entrances - modals and sheets summoned by pointer. *\/\nexport const SPRING_PANEL = {\n  type: \"spring\",\n  stiffness: 420,\n  damping: 40,\n  mass: 0.5,\n} as const;\n\n\/** Shared-layout glides - pills, indicators and panels morphing between positions. *\/\nexport const SPRING_LAYOUT = {\n  type: \"spring\",\n  stiffness: 360,\n  damping: 32,\n  mass: 0.6,\n} as const;\n\n\/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). *\/\nexport const SPRING_MOUSE = {\n  stiffness: 200,\n  damping: 15,\n  mass: 0.3,\n} as const;\n\n\/** Dragged handles and fills (sliders) - critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. *\/\nexport const SPRING_GLIDE = {\n  stiffness: 700,\n  damping: 50,\n  mass: 0.5,\n} as const;\n\n\/** Shared-surface morphs: a trigger growing into its panel and back on one\n * weighted spring, so opening and closing travel the same path. *\/\nexport const SPRING_MORPH = {\n  type: \"spring\",\n  duration: 0.5,\n  bounce: 0.22,\n} as const;\n"},{"path":"components\/motion\/loader.tsx","type":"util","content":"\"use client\";\n\nimport { motion, useReducedMotion } from \"motion\/react\";\nimport { useEffect, useId, useState } from \"react\";\nimport { EASE_IN_OUT } from \"@\/lib\/ease\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\n\nexport type LoaderVariant =\n  | \"spinner\"\n  | \"dots\"\n  | \"bars\"\n  | \"dot-matrix\"\n  | \"dither\"\n  | \"ascii\"\n  | \"ascii-line\"\n  | \"ascii-braille\"\n  | \"ascii-blocks\"\n  | \"ascii-bounce\"\n  | \"morph\"\n  | \"comet\"\n  | \"scramble\"\n  | \"metaballs\"\n  | \"newton\"\n  | \"helix\"\n  | \"percent\";\n\n\/\/ Terminal-style frame sets - the loaders CLI AI agents cycle through.\nconst ASCII_SETS: Record<string, string[]> = {\n  ascii: [\"\u280b\", \"\u2819\", \"\u2839\", \"\u2838\", \"\u283c\", \"\u2834\", \"\u2826\", \"\u2827\", \"\u2807\", \"\u280f\"],\n  \"ascii-line\": [\"|\", \"\/\", \"-\", \"\\\\\"],\n  \"ascii-braille\": [\"\u28fe\", \"\u28fd\", \"\u28fb\", \"\u28bf\", \"\u287f\", \"\u28df\", \"\u28ef\", \"\u28f7\"],\n  \"ascii-blocks\": [\"\u2581\", \"\u2582\", \"\u2583\", \"\u2584\", \"\u2585\", \"\u2586\", \"\u2587\", \"\u2588\", \"\u2587\", \"\u2586\", \"\u2585\", \"\u2584\", \"\u2583\", \"\u2582\"],\n  \"ascii-bounce\": [\"\u2801\", \"\u2802\", \"\u2804\", \"\u2840\", \"\u2880\", \"\u2820\", \"\u2810\", \"\u2808\"],\n};\n\n\/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. *\/\nexport const loaderMessages = {\n  label: \"Loading\",\n  \/** The word the `scramble` variant resolves to. *\/\n  scramble: \"LOADING\",\n};\n\nexport type LoaderMessages = typeof loaderMessages;\n\nexport interface LoaderProps {\n  \/** Which animation to render. *\/\n  variant?: LoaderVariant;\n  \/** Base square size in px. Everything scales from this. *\/\n  size?: number;\n  \/** Seconds per animation cycle. *\/\n  speed?: number;\n  \/** Accessible label announced to screen readers. *\/\n  label?: string;\n  \/** Override any built-in string. *\/\n  labels?: Partial<LoaderMessages>;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n}\n\n\/\/ Reduced motion keeps a calm opacity pulse and drops every transform.\nconst REDUCED = {\n  animate: { opacity: [1, 0.4, 1] },\n  transition: { duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity },\n};\n\nexport function Loader({\n  variant = \"spinner\",\n  size = 32,\n  speed = 1,\n  label: labelProp,\n  labels,\n  className,\n}: LoaderProps) {\n  const t = useMessages(\"loader\", loaderMessages, labels);\n  const label = labelProp ?? t(\"label\");\n  const reduce = useReducedMotion() ?? false;\n\n  return (\n    <span\n      role=\"status\"\n      aria-label={label}\n      className={cn(\n        \"inline-flex items-center justify-center text-foreground\",\n        className,\n      )}\n    >\n      {variant === \"spinner\" && <Spinner size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"dots\" && <Dots size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"bars\" && <Bars size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"dot-matrix\" && (\n        <DotMatrix size={size} speed={speed} reduce={reduce} \/>\n      )}\n      {variant === \"dither\" && <Dither size={size} speed={speed} reduce={reduce} \/>}\n      {ASCII_SETS[variant] && (\n        <Ascii frames={ASCII_SETS[variant]} size={size} speed={speed} reduce={reduce} \/>\n      )}\n      {variant === \"morph\" && (\n        <Morph size={size} speed={speed} reduce={reduce} label={label} \/>\n      )}\n      {variant === \"comet\" && <Comet size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"scramble\" && (\n        <Scramble\n          size={size}\n          speed={speed}\n          reduce={reduce}\n          target={t(\"scramble\")}\n        \/>\n      )}\n      {variant === \"metaballs\" && (\n        <Metaballs size={size} speed={speed} reduce={reduce} label={label} \/>\n      )}\n      {variant === \"newton\" && <Newton size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"helix\" && <Helix size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"percent\" && (\n        <Percent size={size} speed={speed} reduce={reduce} \/>\n      )}\n      <span className=\"sr-only\">{label}<\/span>\n    <\/span>\n  );\n}\n\ninterface PartProps {\n  size: number;\n  speed: number;\n  reduce: boolean;\n}\n\nfunction Spinner({ size, speed, reduce }: PartProps) {\n  const stroke = Math.max(2, size * 0.09);\n  const r = (size - stroke) \/ 2;\n  return (\n    <motion.svg\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      animate={reduce ? REDUCED.animate : { rotate: 360 }}\n      transition={\n        reduce\n          ? REDUCED.transition\n          : { duration: speed, ease: \"linear\", repeat: Infinity }\n      }\n    >\n      <circle\n        cx={size \/ 2}\n        cy={size \/ 2}\n        r={r}\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeOpacity={0.2}\n        strokeWidth={stroke}\n      \/>\n      <path\n        d={`M ${size \/ 2} ${size \/ 2 - r} A ${r} ${r} 0 0 1 ${size \/ 2 + r} ${size \/ 2}`}\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeWidth={stroke}\n        strokeLinecap=\"round\"\n      \/>\n    <\/motion.svg>\n  );\n}\n\nfunction Dots({ size, speed, reduce }: PartProps) {\n  const dot = size * 0.24;\n  return (\n    <span className=\"flex items-center\" style={{ gap: size * 0.14 }}>\n      {[0, 1, 2].map((i) => (\n        <motion.span\n          key={i}\n          className=\"rounded-full bg-current\"\n          style={{ width: dot, height: dot }}\n          animate={\n            reduce\n              ? { opacity: [0.4, 1, 0.4] }\n              : { y: [0, -size * 0.3, 0], opacity: [0.5, 1, 0.5] }\n          }\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: i * speed * 0.16,\n          }}\n        \/>\n      ))}\n    <\/span>\n  );\n}\n\nfunction Ascii({\n  frames,\n  size,\n  speed,\n  reduce,\n}: PartProps & { frames: string[] }) {\n  const [frame, setFrame] = useState(0);\n  useEffect(() => {\n    \/\/ Reduced motion slows the cycle rather than stopping it - it's a glyph\n    \/\/ swap, not on-screen movement.\n    const step = ((reduce ? speed * 2.5 : speed) \/ frames.length) * 1000;\n    const id = setInterval(\n      () => setFrame((f) => (f + 1) % frames.length),\n      step,\n    );\n    return () => clearInterval(id);\n  }, [frames.length, speed, reduce]);\n\n  return (\n    <span\n      className=\"font-mono leading-none tabular-nums\"\n      style={{ fontSize: size, lineHeight: 1 }}\n    >\n      {frames[frame % frames.length]}\n    <\/span>\n  );\n}\n\n\/\/ Each shape is sampled at the same number of points and emitted as an SVG\n\/\/ path with identical command structure, so framer tweens the `d` attribute\n\/\/ point-to-point - a real morph, not a snap. (clip-path polygon strings don't\n\/\/ interpolate reliably in framer, which left the shapes broken.)\nconst MORPH_POINTS = 24;\n\nfunction ngonRadius(ang: number, n: number, phase = 0) {\n  const seg = (2 * Math.PI) \/ n;\n  const a = ang - phase;\n  const local = (((a % seg) + seg) % seg) - seg \/ 2;\n  return Math.cos(Math.PI \/ n) \/ Math.cos(local);\n}\n\nfunction morphPath(radiusAt: (ang: number) => number) {\n  const parts: string[] = [];\n  for (let i = 0; i < MORPH_POINTS; i++) {\n    const ang = (i \/ MORPH_POINTS) * 2 * Math.PI - Math.PI \/ 2;\n    const r = Math.min(1.05, radiusAt(ang));\n    const x = (50 + Math.cos(ang) * 46 * r).toFixed(2);\n    const y = (50 + Math.sin(ang) * 46 * r).toFixed(2);\n    parts.push(`${i === 0 ? \"M\" : \"L\"}${x} ${y}`);\n  }\n  return `${parts.join(\" \")} Z`;\n}\n\nconst MORPH_PATHS = [\n  morphPath(() => 1), \/\/ circle\n  morphPath((a) => ngonRadius(a, 4, Math.PI \/ 4)), \/\/ square\n  morphPath((a) => ngonRadius(a, 3)), \/\/ triangle\n  morphPath((a) => ngonRadius(a, 6)), \/\/ hexagon\n  morphPath((a) => ngonRadius(a, 4)), \/\/ diamond\n];\n\n\/\/ Each shape appears twice in a row so it fully forms and HOLDS before the\n\/\/ next morph. Even keyframe spacing then alternates hold \/ morph segments.\nconst MORPH_SEQ = [...MORPH_PATHS.flatMap((p) => [p, p]), MORPH_PATHS[0]];\n\/\/ Rotation and scale only change across the morph segments, staying put on the\n\/\/ holds, so a settled shape sits still.\nconst MORPH_ROT = [0, 0, 72, 72, 144, 144, 216, 216, 288, 288, 360];\nconst MORPH_SCALE = [1, 1, 0.88, 0.88, 1, 1, 0.88, 0.88, 1, 1, 1];\n\nfunction Morph({ size, speed, reduce, label }: PartProps & { label: string }) {\n  return (\n    <motion.svg\n      width={size}\n      height={size}\n      viewBox=\"0 0 100 100\"\n      role=\"img\"\n      animate={\n        reduce\n          ? { opacity: [1, 0.4, 1] }\n          : { rotate: MORPH_ROT, scale: MORPH_SCALE }\n      }\n      transition={\n        reduce\n          ? { duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity }\n          : { duration: speed * 5, ease: EASE_IN_OUT, repeat: Infinity }\n      }\n    >\n      <title>{label}<\/title>\n      <motion.path\n        fill=\"currentColor\"\n        d={MORPH_PATHS[0]}\n        \/\/ Seeds the motion value; without it motion writes d=\"undefined\"\n        \/\/ before the keyframes start.\n        initial={{ d: MORPH_PATHS[0] }}\n        animate={reduce ? undefined : { d: MORPH_SEQ }}\n        transition={\n          reduce\n            ? undefined\n            : { duration: speed * 5, ease: EASE_IN_OUT, repeat: Infinity }\n        }\n      \/>\n    <\/motion.svg>\n  );\n}\n\nconst COMET_TRAIL = [0, 1, 2, 3, 4, 5];\n\nfunction Comet({ size, speed, reduce }: PartProps) {\n  const head = size * 0.2;\n  const r = size \/ 2 - head \/ 2;\n  return (\n    <span className=\"relative\" style={{ width: size, height: size }}>\n      <motion.span\n        className=\"absolute inset-0\"\n        animate={reduce ? REDUCED.animate : { rotate: 360 }}\n        transition={\n          reduce\n            ? REDUCED.transition\n            : { duration: speed, ease: \"linear\", repeat: Infinity }\n        }\n      >\n        {COMET_TRAIL.map((i) => {\n          const scale = 1 - i * 0.13;\n          const sz = head * scale;\n          return (\n            <span\n              key={i}\n              className=\"absolute top-1\/2 left-1\/2 rounded-full bg-current\"\n              style={{\n                width: sz,\n                height: sz,\n                marginLeft: -sz \/ 2,\n                marginTop: -sz \/ 2,\n                opacity: 1 - i * 0.16,\n                transform: `rotate(${-i * 15}deg) translateY(${-r}px)`,\n              }}\n            \/>\n          );\n        })}\n      <\/motion.span>\n    <\/span>\n  );\n}\n\nconst SCRAMBLE_GLYPHS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<>\/*#@\";\n\nfunction Scramble({ size, speed, reduce, target }: PartProps & { target: string }) {\n  const [text, setText] = useState(target);\n  useEffect(() => {\n    if (reduce) {\n      setText(target);\n      return;\n    }\n    let tick = 0;\n    const total = target.length + 4;\n    const id = setInterval(\n      () => {\n        const reveal = tick % total;\n        let s = \"\";\n        for (let i = 0; i < target.length; i++) {\n          s +=\n            i < reveal\n              ? target[i]\n              : SCRAMBLE_GLYPHS[\n                  Math.floor(Math.random() * SCRAMBLE_GLYPHS.length)\n                ];\n        }\n        setText(s);\n        tick++;\n      },\n      (speed \/ target.length) * 1000 * 0.55,\n    );\n    return () => clearInterval(id);\n  }, [speed, reduce, target]);\n\n  return (\n    <span\n      className=\"font-mono font-medium tracking-[0.2em] tabular-nums\"\n      style={{ fontSize: size * 0.42 }}\n    >\n      {text}\n    <\/span>\n  );\n}\n\nfunction Metaballs({ size, speed, reduce, label }: PartProps & { label: string }) {\n  const id = useId().replace(\/:\/g, \"\");\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 100 100\" role=\"img\">\n      <title>{label}<\/title>\n      <defs>\n        <filter id={id}>\n          <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"5\" result=\"b\" \/>\n          <feColorMatrix\n            in=\"b\"\n            values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 20 -8\"\n          \/>\n        <\/filter>\n      <\/defs>\n      <g filter={`url(#${id})`} fill=\"currentColor\">\n        <motion.circle\n          cy=\"50\"\n          r=\"15\"\n          \/\/ Seeds the motion value; without it motion writes cx=\"undefined\"\n          \/\/ before the keyframes start.\n          initial={{ cx: reduce ? 40 : 30 }}\n          animate={reduce ? { opacity: [0.4, 1, 0.4] } : { cx: [30, 70, 30] }}\n          transition={{ duration: speed * 1.6, ease: EASE_IN_OUT, repeat: Infinity }}\n        \/>\n        <motion.circle\n          cy=\"50\"\n          r=\"15\"\n          initial={{ cx: reduce ? 60 : 70 }}\n          animate={reduce ? { opacity: [0.4, 1, 0.4] } : { cx: [70, 30, 70] }}\n          transition={{ duration: speed * 1.6, ease: EASE_IN_OUT, repeat: Infinity }}\n        \/>\n      <\/g>\n    <\/svg>\n  );\n}\n\nconst NEWTON_BALLS = [0, 1, 2, 3, 4];\n\nfunction Newton({ size, speed, reduce }: PartProps) {\n  const d = size * 0.2;\n  const out = d * 1.1;\n  \/\/ Only the end balls move: the left slides out and back on the first half,\n  \/\/ then the right on the second half - the impact appears to jump the three\n  \/\/ still middle balls. Pure horizontal slide, no swing, no strings.\n  const moves: Record<number, { x: number[]; times: number[] }> = {\n    0: { x: [0, -out, 0, 0], times: [0, 0.28, 0.5, 1] },\n    4: { x: [0, 0, out, 0], times: [0, 0.5, 0.78, 1] },\n  };\n\n  return (\n    <span className=\"flex items-center justify-center\" style={{ height: d }}>\n      {NEWTON_BALLS.map((i) => {\n        const move = moves[i];\n        return (\n          <motion.span\n            key={i}\n            className=\"rounded-full bg-current\"\n            style={{ width: d, height: d }}\n            animate={reduce || !move ? undefined : { x: move.x }}\n            transition={\n              reduce || !move\n                ? undefined\n                : {\n                    duration: speed * 1.5,\n                    ease: EASE_IN_OUT,\n                    repeat: Infinity,\n                    times: move.times,\n                  }\n            }\n          \/>\n        );\n      })}\n    <\/span>\n  );\n}\n\nfunction Helix({ size, speed, reduce }: PartProps) {\n  const rows = 7;\n  const dot = size * 0.14;\n  const amp = size * 0.32;\n  return (\n    <span className=\"relative\" style={{ width: size, height: size }}>\n      {Array.from({ length: rows }, (_, r) => {\n        const top = (r \/ (rows - 1)) * (size - dot);\n        const delay = (r \/ rows) * speed;\n        return (\n          <span key={`row-${top}`}>\n            <motion.span\n              className=\"absolute rounded-full bg-current\"\n              style={{ width: dot, height: dot, left: size \/ 2 - dot \/ 2, top }}\n              animate={\n                reduce\n                  ? { opacity: [0.4, 1, 0.4] }\n                  : {\n                      x: [amp, -amp, amp],\n                      scale: [1, 0.5, 1],\n                      opacity: [1, 0.45, 1],\n                    }\n              }\n              transition={{\n                duration: speed,\n                ease: EASE_IN_OUT,\n                repeat: Infinity,\n                delay,\n              }}\n            \/>\n            <motion.span\n              className=\"absolute rounded-full bg-current\"\n              style={{ width: dot, height: dot, left: size \/ 2 - dot \/ 2, top }}\n              animate={\n                reduce\n                  ? { opacity: [0.4, 1, 0.4] }\n                  : {\n                      x: [-amp, amp, -amp],\n                      scale: [0.5, 1, 0.5],\n                      opacity: [0.45, 1, 0.45],\n                    }\n              }\n              transition={{\n                duration: speed,\n                ease: EASE_IN_OUT,\n                repeat: Infinity,\n                delay,\n              }}\n            \/>\n          <\/span>\n        );\n      })}\n    <\/span>\n  );\n}\n\nfunction Percent({ size, speed, reduce }: PartProps) {\n  const [p, setP] = useState(0);\n  useEffect(() => {\n    const dur = (reduce ? speed * 2 : speed) * 1000;\n    const start = { t: 0 };\n    const tickMs = 40;\n    const id = setInterval(() => {\n      start.t += tickMs;\n      const next = Math.min(100, Math.round((start.t \/ dur) * 100));\n      setP(next);\n      if (next >= 100) start.t = 0;\n    }, tickMs);\n    return () => clearInterval(id);\n  }, [speed, reduce]);\n\n  return (\n    <span\n      className=\"flex flex-col items-center\"\n      style={{ gap: size * 0.14, width: size * 1.4 }}\n    >\n      <span\n        className=\"font-mono font-medium tabular-nums\"\n        style={{ fontSize: size * 0.42, lineHeight: 1 }}\n      >\n        {p}%\n      <\/span>\n      <span\n        className=\"w-full overflow-hidden rounded-full bg-current\/15\"\n        style={{ height: Math.max(3, size * 0.1) }}\n      >\n        <span\n          className=\"block h-full rounded-full bg-current\"\n          style={{ width: `${p}%` }}\n        \/>\n      <\/span>\n    <\/span>\n  );\n}\n\nfunction Bars({ size, speed, reduce }: PartProps) {\n  const bar = size * 0.16;\n  return (\n    <span className=\"flex items-center\" style={{ gap: size * 0.1, height: size }}>\n      {[0, 1, 2, 3].map((i) => (\n        <motion.span\n          key={i}\n          className=\"rounded-full bg-current\"\n          style={{ width: bar, height: size, originY: 1 }}\n          animate={\n            reduce ? { opacity: [0.4, 1, 0.4] } : { scaleY: [0.3, 1, 0.3] }\n          }\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: i * speed * 0.12,\n          }}\n        \/>\n      ))}\n    <\/span>\n  );\n}\n\nfunction DotMatrix({ size, speed, reduce }: PartProps) {\n  const n = 3;\n  const gap = size * 0.14;\n  const dot = (size - gap * (n - 1)) \/ n;\n  const cells = Array.from({ length: n * n }, (_, idx) => idx);\n  return (\n    <span\n      className=\"grid\"\n      style={{\n        gap,\n        gridTemplateColumns: `repeat(${n}, ${dot}px)`,\n      }}\n    >\n      {cells.map((idx) => {\n        const x = idx % n;\n        const y = Math.floor(idx \/ n);\n        \/\/ Diagonal wave: cells light in order of their distance from the corner.\n        const delay = ((x + y) \/ (2 * (n - 1))) * speed;\n        return (\n          <motion.span\n            key={idx}\n            className=\"rounded-full bg-current\"\n            style={{ width: dot, height: dot }}\n            animate={\n              reduce\n                ? { opacity: [0.3, 1, 0.3] }\n                : { opacity: [0.2, 1, 0.2], scale: [0.7, 1, 0.7] }\n            }\n            transition={{\n              duration: speed,\n              ease: EASE_IN_OUT,\n              repeat: Infinity,\n              delay,\n            }}\n          \/>\n        );\n      })}\n    <\/span>\n  );\n}\n\n\/\/ Ordered Bayer 4x4 matrix - the classic dithering threshold pattern. Cells\n\/\/ light in this order, so the fill shimmers like a dissolving halftone.\nconst BAYER_4 = [\n  0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5,\n];\n\nfunction Dither({ size, speed, reduce }: PartProps) {\n  const n = 4;\n  const gap = Math.max(1, size * 0.05);\n  const cell = (size - gap * (n - 1)) \/ n;\n  return (\n    <span\n      className=\"grid\"\n      style={{ gap, gridTemplateColumns: `repeat(${n}, ${cell}px)` }}\n    >\n      {BAYER_4.map((order, idx) => (\n        <motion.span\n          \/\/ biome-ignore lint\/suspicious\/noArrayIndexKey: fixed matrix cells, order never changes\n          key={idx}\n          className=\"bg-current\"\n          style={{ width: cell, height: cell }}\n          animate={reduce ? { opacity: [0.3, 1, 0.3] } : { opacity: [0.1, 1, 0.1] }}\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: (order \/ BAYER_4.length) * speed,\n          }}\n        \/>\n      ))}\n    <\/span>\n  );\n}\n"},{"path":"components\/motion\/text-scramble.tsx","type":"util","content":"\"use client\";\n\nimport { useReducedMotion } from \"motion\/react\";\nimport {\n  useEffect,\n  useRef,\n  useState,\n  type CSSProperties,\n} from \"react\";\nimport { cn } from \"@\/lib\/utils\";\n\nconst DEFAULT_GLYPHS = \"ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?\/\";\n\nexport interface TextScrambleProps {\n  \/** Final text revealed by the scramble animation. *\/\n  text: string;\n  \/** Maximum animation duration in milliseconds. *\/\n  duration?: number;\n  \/** Characters sampled while unresolved positions are scrambling. *\/\n  glyphs?: string;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n  \/** Inline styles for the root element. *\/\n  style?: CSSProperties;\n}\n\n\/** Character scramble that resolves to `text` and respects reduced motion. *\/\nexport function TextScramble({\n  text,\n  duration,\n  glyphs = DEFAULT_GLYPHS,\n  className,\n  style,\n}: TextScrambleProps) {\n  const reduce = useReducedMotion() ?? false;\n  const [display, setDisplay] = useState(text);\n  const mounted = useRef(false);\n\n  useEffect(() => {\n    if (!mounted.current) {\n      mounted.current = true;\n      setDisplay(text);\n      return;\n    }\n\n    if (reduce || !glyphs) {\n      setDisplay(text);\n      return;\n    }\n\n    const characters = text.split(\"\");\n    const startedAt = performance.now();\n    const animationDuration = duration\n      ?? Math.min(760, Math.max(420, characters.length * 32));\n    let frame = 0;\n    let lastUpdate = 0;\n\n    const animate = (now: number) => {\n      if (now - lastUpdate >= 40) {\n        lastUpdate = now;\n        const progress = Math.min((now - startedAt) \/ animationDuration, 1);\n        const settled = Math.floor(progress * characters.length);\n        setDisplay(characters.map((character, index) => {\n          if (index < settled || character === \" \") return character;\n          return glyphs[Math.floor(Math.random() * glyphs.length)];\n        }).join(\"\"));\n      }\n\n      if (now - startedAt < animationDuration) {\n        frame = requestAnimationFrame(animate);\n      } else {\n        setDisplay(text);\n      }\n    };\n\n    frame = requestAnimationFrame(animate);\n    return () => cancelAnimationFrame(frame);\n  }, [duration, glyphs, reduce, text]);\n\n  return (\n    <span className={cn(\"inline-block whitespace-pre\", className)} style={style}>\n      <span className=\"sr-only\">{text}<\/span>\n      <span aria-hidden=\"true\">{reduce ? text : display}<\/span>\n    <\/span>\n  );\n}\n"},{"path":"lib\/text-shimmer.ts","type":"util","content":"import type { CSSProperties } from \"react\";\n\n\/\/ The reduced-motion rule travels with the component. The site's globals.css calms CSS\n\/\/ animation globally, but the registry bundles imports only, so an installed\n\/\/ copy never receives that reset.\n\/\/\n\/\/ `!important` because the sweep is an inline style, which outranks a plain rule\n\/\/ in a media query. It selects a marker class carried by TEXT_SHIMMER_CLASS_NAME\n\/\/ so it also reaches consumers that build their own span out of these exports.\nexport const TEXT_SHIMMER_KEYFRAMES =\n  \"@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}\" +\n  \"@media (prefers-reduced-motion: reduce){.beui-text-shimmer{animation:none !important}}\";\n\nexport const TEXT_SHIMMER_CLASS_NAME =\n  \"beui-text-shimmer bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]\";\n\n\/**\n * Only the moving highlight band, transparent elsewhere. Laid over text drawn\n * in pieces (a letter cascade), so one band sweeps the whole phrase instead\n * of every piece carrying, and flashing, its own gradient.\n *\/\nexport const TEXT_SHIMMER_HIGHLIGHT_CLASS_NAME =\n  \"beui-text-shimmer bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,transparent_30%,var(--foreground)_50%,transparent_70%)]\";\n\nexport function textShimmerStyle(duration: number): CSSProperties {\n  return {\n    animation: `beui-text-shimmer ${duration}s linear infinite`,\n  };\n}\n"}]}