{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "funnel-chart",
  "type": "registry:component",
  "title": "Conversion stages",
  "description": "Follow work through successive stages and see where the biggest drop occurs.",
  "categories": [
    "charts"
  ],
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/funnel-chart.tsx",
      "type": "registry:component",
      "target": "components/overtrue/funnel-chart.tsx",
      "content": "/** Adapted from dashboardcn (MIT), copyright 2026 dashboardcn contributors.\n * Source: https://github.com/NoahGdev/dashboardcn/tree/b1ffacbca0f7a0be60135c8665b9e8c267205c48\n *\n * MIT License\n *\n * Copyright (c) 2026 dashboardcn contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * ---\n *\n * Portions of this project are derived from shadcn/ui and shadcn/registry-template\n * (https://github.com/shadcn-ui/ui), Copyright (c) 2023 shadcn, licensed under the\n * MIT License. The notice above applies to those portions as well.\n */\n\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { formatNumber } from \"./metric-format\";\n\nexport interface FunnelStep {\n  name: string;\n  value: number;\n  /** Any CSS color for this step in the flow variant. Defaults to chart-1 through chart-5 in order. */\n  color?: string;\n}\n\nexport interface FunnelChartProps extends React.ComponentProps<\"div\"> {\n  steps: FunnelStep[];\n  valueFormatter?: (value: number) => string;\n  /**\n   * Any CSS color. \"bars\" fades it step by step. \"flow\" paints every stage in\n   * it, in place of the per-stage palette.\n   */\n  color?: string;\n  /** Show the drop-off between consecutive steps. Bars only. */\n  showDropoff?: boolean;\n  /** \"bars\" stacks one bar per step; \"flow\" runs the steps left to right, each tapering into the next. */\n  variant?: \"bars\" | \"flow\";\n  /** Flow only. \"eased\" curves each neck; \"sharp\" draws straight trapezoids. */\n  shape?: \"eased\" | \"sharp\";\n  /** Flow only. Height of the stages in pixels. */\n  height?: number;\n  /** Flow only. Width of the neck between stages in pixels. */\n  neckWidth?: number;\n  /** Flow only. Show the share of the first step as a pill on each stage. */\n  showPercentages?: boolean;\n  /** Flow only. Show a tile with the name and value under each stage. */\n  showLabels?: boolean;\n  /** Flow only. Stage drawn at full strength while the rest dim. */\n  activeIndex?: number | null;\n  onActiveIndexChange?: (index: number | null) => void;\n}\n\nconst defaultColors = [\n  \"var(--color-chart-1)\",\n  \"var(--color-chart-2)\",\n  \"var(--color-chart-3)\",\n  \"var(--color-chart-4)\",\n  \"var(--color-chart-5)\",\n];\n\nconst EASE = \"cubic-bezier(0.22,1,0.36,1)\";\nconst keyframes = `@keyframes funnel-grow-x{from{transform:scaleX(0)}to{transform:scaleX(1)}}@keyframes funnel-grow-y{from{transform:scaleY(0)}to{transform:scaleY(1)}}@keyframes funnel-fade{from{opacity:0}to{opacity:1}}`;\n\n// Round so server and client render identical path strings.\nconst round = (n: number) => Math.round(n * 1000) / 1000;\n\n/** Path for the neck between two stages, in a 1x1 box stretched to fit. */\nfunction neckPath(from: number, to: number, shape: \"eased\" | \"sharp\") {\n  const t0 = round((1 - from) / 2);\n  const b0 = round(1 - t0);\n  const t1 = round((1 - to) / 2);\n  const b1 = round(1 - t1);\n  if (shape === \"sharp\") return `M0,${t0} L1,${t1} L1,${b1} L0,${b0} Z`;\n  return `M0,${t0} C0.5,${t0} 0.5,${t1} 1,${t1} L1,${b1} C0.5,${b1} 0.5,${b0} 0,${b0} Z`;\n}\n\nfunction DropoffIcon() {\n  return (\n    <svg\n      aria-hidden=\"true\"\n      viewBox=\"0 0 12 12\"\n      className=\"size-3 shrink-0\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth={1.5}\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <path d=\"M3.5 3.5 8.5 8.5M8.5 4.5v4h-4\" />\n    </svg>\n  );\n}\n\nfunction FunnelBars({\n  steps,\n  valueFormatter,\n  color,\n  showDropoff,\n}: {\n  steps: FunnelStep[];\n  valueFormatter: (value: number) => string;\n  color: string;\n  showDropoff: boolean;\n}) {\n  const first = steps[0]?.value ?? 0;\n  const last = steps[steps.length - 1]?.value ?? 0;\n  const overall = first > 0 ? last / first : 0;\n  const dropoffs = steps.map((step, index) => {\n    const previous = index > 0 ? steps[index - 1]!.value : step.value;\n    return index > 0 && previous > 0 ? 1 - step.value / previous : 0;\n  });\n  // The biggest loss between two steps earns the attention tint.\n  const largest = steps.length > 2 ? Math.max(...dropoffs) : -1;\n\n  return (\n    <>\n      {steps.map((step, index) => {\n        const previous = index > 0 ? steps[index - 1]!.value : step.value;\n        const ofFirst = first > 0 ? Math.min(1, step.value / first) : 0;\n        const previousOfFirst = first > 0 ? Math.min(1, previous / first) : 0;\n        const ofPrevious = previous > 0 ? step.value / previous : 0;\n        const dropoff = 1 - ofPrevious;\n        const fade = 1 - index * (0.45 / Math.max(steps.length - 1, 1));\n        const worst = index > 0 && dropoffs[index] === largest && largest > 0;\n\n        return (\n          <React.Fragment key={step.name}>\n            {showDropoff && index > 0 ? (\n              <div\n                data-slot=\"funnel-dropoff\"\n                data-largest={worst || undefined}\n                className=\"flex items-center py-1.5 pl-[3px] text-xs\"\n              >\n                <span\n                  className={cn(\n                    \"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 tabular-nums\",\n                    worst\n                      ? \"bg-amber-500/10 text-amber-700 dark:text-amber-400\"\n                      : \"bg-muted/70 text-muted-foreground\",\n                  )}\n                >\n                  {worst ? (\n                    <span\n                      aria-hidden=\"true\"\n                      className=\"size-1.5 shrink-0 rounded-full bg-current\"\n                    />\n                  ) : (\n                    <DropoffIcon />\n                  )}\n                  {formatNumber(dropoff, { format: \"percent\" })} drop-off\n                </span>\n              </div>\n            ) : null}\n            <div data-slot=\"funnel-step\" className=\"group/step flex flex-col gap-1.5\">\n              <div className=\"flex items-baseline justify-between gap-4 text-sm\">\n                <span className=\"flex min-w-0 items-center gap-2 truncate\">\n                  <span className=\"text-muted-foreground w-4 shrink-0 font-mono text-xs tabular-nums\">\n                    {index + 1}\n                  </span>\n                  <span className=\"truncate font-medium\">{step.name}</span>\n                </span>\n                <span className=\"flex shrink-0 items-baseline gap-3 tabular-nums\">\n                  <span className=\"font-semibold tracking-[-0.01em]\">\n                    {valueFormatter(step.value)}\n                  </span>\n                  <span className=\"text-muted-foreground w-12 text-right text-xs\">\n                    {formatNumber(ofFirst, { format: \"percent\" })}\n                  </span>\n                </span>\n              </div>\n              <div\n                data-slot=\"funnel-track\"\n                className=\"relative h-4 w-full overflow-hidden rounded-[4px] bg-muted/50 ring-1 ring-inset ring-border/40\"\n              >\n                {index > 0 && previousOfFirst > ofFirst ? (\n                  <div\n                    aria-hidden=\"true\"\n                    data-slot=\"funnel-loss\"\n                    className=\"absolute inset-y-0 rounded-r-[4px] transition-[left,width] duration-500 motion-reduce:transition-none\"\n                    style={{\n                      left: `${ofFirst * 100}%`,\n                      width: `${(previousOfFirst - ofFirst) * 100}%`,\n                      backgroundColor: `color-mix(in oklab, ${color} 6%, transparent)`,\n                      backgroundImage: `repeating-linear-gradient(-45deg, color-mix(in oklab, ${color} 22%, transparent) 0 1px, transparent 1px 5px)`,\n                    }}\n                  />\n                ) : null}\n                <div\n                  aria-hidden=\"true\"\n                  data-slot=\"funnel-bar\"\n                  className=\"absolute inset-y-0 left-0 origin-left rounded-[4px] transition-[width] duration-500 motion-safe:animate-[funnel-grow-x_700ms_cubic-bezier(0.22,1,0.36,1)_both] motion-reduce:transition-none dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]\"\n                  style={{\n                    width: `${ofFirst * 100}%`,\n                    minWidth: ofFirst > 0 ? 4 : 0,\n                    opacity: fade,\n                    backgroundImage: `linear-gradient(90deg, color-mix(in oklab, ${color} 72%, transparent), ${color})`,\n                    animationDelay: `${index * 60}ms`,\n                    transitionTimingFunction: EASE,\n                  }}\n                />\n              </div>\n            </div>\n          </React.Fragment>\n        );\n      })}\n      {steps.length > 1 ? (\n        <div className=\"mt-3 flex items-center justify-between border-t border-border/60 pt-3 text-sm\">\n          <span className=\"text-muted-foreground\">Overall conversion</span>\n          <span className=\"text-base font-semibold tracking-[-0.02em] tabular-nums\">\n            {formatNumber(overall, { format: \"percent\" })}\n          </span>\n        </div>\n      ) : null}\n    </>\n  );\n}\n\nfunction FunnelFlow({\n  steps,\n  valueFormatter,\n  color,\n  shape,\n  height,\n  neckWidth,\n  showPercentages,\n  showLabels,\n  activeIndex,\n  onActiveIndexChange,\n}: {\n  steps: FunnelStep[];\n  valueFormatter: (value: number) => string;\n  color?: string;\n  shape: \"eased\" | \"sharp\";\n  height: number;\n  neckWidth: number;\n  showPercentages: boolean;\n  showLabels: boolean;\n  activeIndex?: number | null;\n  onActiveIndexChange?: (index: number | null) => void;\n}) {\n  const id = React.useId().replace(/:/g, \"\");\n  const [activeState, setActiveState] = React.useState<number | null>(null);\n  const active = activeIndex === undefined ? activeState : activeIndex;\n  const setActive = (index: number | null) => {\n    setActiveState(index);\n    onActiveIndexChange?.(index);\n  };\n\n  const first = steps[0]?.value ?? 0;\n  const stages = steps.map((step, index) => ({\n    ...step,\n    share: first > 0 ? Math.min(1, Math.max(0, step.value / first)) : 0,\n    fill: step.color ?? color ?? defaultColors[index % defaultColors.length]!,\n    // A single color fades toward the end of the funnel so stages stay distinct.\n    opacity:\n      color && !step.color\n        ? 1 - index * (0.6 / Math.max(steps.length - 1, 1))\n        : 1,\n  }));\n\n  return (\n    <>\n      <div\n        data-slot=\"funnel-flow\"\n        className=\"flex w-full items-stretch\"\n        style={{ height }}\n        onMouseLeave={() => setActive(null)}\n      >\n        {stages.map((stage, index) => {\n          const next = stages[index + 1];\n          const dimmed = active !== null && active !== index;\n          const neckDimmed =\n            active !== null && active !== index && active !== index + 1;\n          const gradient = `${id}-${index}`;\n          return (\n            <React.Fragment key={stage.name}>\n              <div\n                data-slot=\"funnel-stage\"\n                data-active={active === index || undefined}\n                onMouseEnter={() => setActive(index)}\n                className=\"relative flex min-w-0 flex-1 items-center transition-opacity duration-150 motion-reduce:transition-none\"\n                style={{ opacity: dimmed ? 0.4 : 1 }}\n              >\n                <div\n                  className={cn(\n                    \"w-full transition-[height] duration-500 motion-safe:animate-[funnel-grow-y_700ms_cubic-bezier(0.22,1,0.36,1)_both] motion-reduce:transition-none dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]\",\n                    index === 0 && \"rounded-l-xl\",\n                    index === stages.length - 1 && \"rounded-r-xl\",\n                  )}\n                  style={{\n                    height: `${round(stage.share * 100)}%`,\n                    minHeight: 4,\n                    backgroundImage: `linear-gradient(180deg, ${stage.fill}, color-mix(in oklab, ${stage.fill} 80%, transparent))`,\n                    opacity: stage.opacity,\n                    animationDelay: `${index * 70}ms`,\n                    transitionTimingFunction: EASE,\n                  }}\n                />\n                {showPercentages ? (\n                  <span className=\"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-popover/85 px-2 py-0.5 text-[11px] font-medium text-popover-foreground tabular-nums shadow-sm ring-1 ring-border/70 backdrop-blur-md motion-safe:animate-[funnel-fade_400ms_ease-out_both] [animation-delay:450ms]\">\n                    {formatNumber(stage.share, {\n                      format: \"percent\",\n                      maximumFractionDigits: 0,\n                    })}\n                  </span>\n                ) : null}\n              </div>\n              {next ? (\n                <svg\n                  aria-hidden=\"true\"\n                  data-slot=\"funnel-neck\"\n                  viewBox=\"0 0 1 1\"\n                  preserveAspectRatio=\"none\"\n                  className=\"h-full shrink-0 transition-opacity duration-150 motion-safe:animate-[funnel-fade_500ms_ease-out_both] motion-reduce:transition-none\"\n                  style={{\n                    width: neckWidth,\n                    opacity: neckDimmed ? 0.4 : 1,\n                    animationDelay: `${index * 70 + 250}ms`,\n                  }}\n                >\n                  <defs>\n                    <linearGradient id={gradient} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n                      <stop\n                        offset=\"0\"\n                        stopColor={stage.fill}\n                        stopOpacity={stage.opacity * 0.85}\n                      />\n                      <stop\n                        offset=\"1\"\n                        stopColor={next.fill}\n                        stopOpacity={next.opacity * 0.85}\n                      />\n                    </linearGradient>\n                  </defs>\n                  <path\n                    d={neckPath(stage.share, next.share, shape)}\n                    fill={`url(#${gradient})`}\n                    className=\"transition-[d] duration-500 ease-out\"\n                  />\n                </svg>\n              ) : null}\n            </React.Fragment>\n          );\n        })}\n      </div>\n      {showLabels ? (\n        <div\n          data-slot=\"funnel-labels\"\n          className=\"grid gap-2\"\n          style={{\n            gridTemplateColumns: `repeat(${stages.length}, minmax(0, 1fr))`,\n          }}\n        >\n          {stages.map((stage, index) => {\n            const previous = stages[index - 1];\n            const kept =\n              previous && previous.value > 0\n                ? stage.value / previous.value\n                : null;\n            return (\n              <div\n                key={stage.name}\n                data-active={active === index || undefined}\n                onMouseEnter={() => setActive(index)}\n                onMouseLeave={() => setActive(null)}\n                className={cn(\n                  \"flex min-w-0 flex-col gap-0.5 rounded-xl bg-muted/40 px-2.5 py-2 ring-1 ring-inset ring-border/60 transition-[opacity,box-shadow,background-color] duration-150 motion-reduce:transition-none\",\n                  active !== null && active !== index && \"opacity-50\",\n                  active === index && \"bg-muted/70 ring-foreground/15\",\n                )}\n              >\n                <span className=\"text-muted-foreground flex items-center gap-1.5 text-xs\">\n                  <span\n                    aria-hidden=\"true\"\n                    className=\"size-2 shrink-0 rounded-full\"\n                    style={{\n                      backgroundColor: stage.fill,\n                      opacity: stage.opacity,\n                    }}\n                  />\n                  <span className=\"truncate\">{stage.name}</span>\n                </span>\n                <span className=\"flex min-w-0 flex-wrap items-baseline gap-x-1.5\">\n                  <span className=\"min-w-0 truncate text-sm font-semibold tracking-[-0.01em] tabular-nums\">\n                    {valueFormatter(stage.value)}\n                  </span>\n                  {kept !== null ? (\n                    <span\n                      data-slot=\"funnel-stage-dropoff\"\n                      className=\"text-muted-foreground ml-auto shrink-0 text-[11px] tabular-nums\"\n                    >\n                      −\n                      {formatNumber(1 - kept, {\n                        format: \"percent\",\n                        maximumFractionDigits: 0,\n                      })}\n                    </span>\n                  ) : null}\n                </span>\n              </div>\n            );\n          })}\n        </div>\n      ) : null}\n    </>\n  );\n}\n\n/** Step-by-step conversion, as stacked bars with drop-off or as a flow of tapering stages. */\nfunction FunnelChart({\n  steps,\n  valueFormatter = (value) => formatNumber(value),\n  color,\n  showDropoff = true,\n  variant = \"bars\",\n  shape = \"eased\",\n  height = 160,\n  neckWidth = 24,\n  showPercentages = true,\n  showLabels = true,\n  activeIndex,\n  onActiveIndexChange,\n  className,\n  ...props\n}: FunnelChartProps) {\n  return (\n    <div\n      data-slot=\"funnel-chart\"\n      data-variant={variant}\n      className={cn(\n        \"flex flex-col\",\n        variant === \"flow\" ? \"gap-3\" : \"gap-1\",\n        className,\n      )}\n      {...props}\n    >\n      <style href=\"overtrue-funnel-chart\" precedence=\"default\">\n        {keyframes}\n      </style>\n      {variant === \"flow\" ? (\n        <FunnelFlow\n          steps={steps}\n          valueFormatter={valueFormatter}\n          color={color}\n          shape={shape}\n          height={height}\n          neckWidth={neckWidth}\n          showPercentages={showPercentages}\n          showLabels={showLabels}\n          activeIndex={activeIndex}\n          onActiveIndexChange={onActiveIndexChange}\n        />\n      ) : (\n        <FunnelBars\n          steps={steps}\n          valueFormatter={valueFormatter}\n          color={color ?? \"var(--color-chart-1)\"}\n          showDropoff={showDropoff}\n        />\n      )}\n    </div>\n  );\n}\n\nexport { FunnelChart };\n"
    },
    {
      "path": "src/registry/overtrue/metric-format.tsx",
      "type": "registry:component",
      "target": "components/overtrue/metric-format.tsx",
      "content": "/** Adapted from dashboardcn (MIT), copyright 2026 dashboardcn contributors.\n * Source: https://github.com/NoahGdev/dashboardcn/tree/b1ffacbca0f7a0be60135c8665b9e8c267205c48\n *\n * MIT License\n *\n * Copyright (c) 2026 dashboardcn contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * ---\n *\n * Portions of this project are derived from shadcn/ui and shadcn/registry-template\n * (https://github.com/shadcn-ui/ui), Copyright (c) 2023 shadcn, licensed under the\n * MIT License. The notice above applies to those portions as well.\n */\nexport type NumberFormat = \"number\" | \"compact\" | \"currency\" | \"percent\";\n\nexport interface FormatNumberOptions {\n  format?: NumberFormat;\n  /** ISO 4217 code, used when format is \"currency\". Defaults to USD. */\n  currency?: string;\n  locale?: string;\n  maximumFractionDigits?: number;\n  /** Abbreviate large values, e.g. \"$158K\" instead of \"$158,143\". */\n  compact?: boolean;\n}\n\nconst formatterCache = new Map<string, Intl.NumberFormat>();\n\nfunction getFormatter(locale: string, options: Intl.NumberFormatOptions) {\n  const key = locale + JSON.stringify(options);\n  let formatter = formatterCache.get(key);\n  if (!formatter) {\n    formatter = new Intl.NumberFormat(locale, options);\n    formatterCache.set(key, formatter);\n  }\n  return formatter;\n}\n\n/**\n * Format a metric value for display.\n *\n * formatNumber(1234567)                          -> \"1,234,567\"\n * formatNumber(1234567, { format: \"compact\" })   -> \"1.2M\"\n * formatNumber(48.2, { format: \"currency\" })     -> \"$48.20\"\n * formatNumber(158143, { format: \"currency\", compact: true }) -> \"$158K\"\n * formatNumber(0.124, { format: \"percent\" })     -> \"12.4%\"\n */\nexport function formatNumber(\n  value: number,\n  {\n    format = \"number\",\n    currency = \"USD\",\n    locale = \"en-US\",\n    maximumFractionDigits,\n    compact = false,\n  }: FormatNumberOptions = {},\n): string {\n  if (!Number.isFinite(value)) return \"—\";\n\n  // Compact values keep three significant digits: $158K, $1.23M, 41.2K.\n  const compactOptions: Intl.NumberFormatOptions = compact\n    ? maximumFractionDigits === undefined\n      ? { notation: \"compact\", maximumSignificantDigits: 3 }\n      : { notation: \"compact\", maximumFractionDigits }\n    : {};\n  switch (format) {\n    case \"compact\":\n      return getFormatter(locale, {\n        notation: \"compact\",\n        maximumFractionDigits: maximumFractionDigits ?? 1,\n      }).format(value);\n    case \"currency\":\n      return getFormatter(locale, {\n        style: \"currency\",\n        currency,\n        maximumFractionDigits: maximumFractionDigits ?? 2,\n        ...compactOptions,\n      }).format(value);\n    case \"percent\":\n      return getFormatter(locale, {\n        style: \"percent\",\n        maximumFractionDigits: maximumFractionDigits ?? 1,\n      }).format(value);\n    default:\n      return getFormatter(locale, {\n        maximumFractionDigits: maximumFractionDigits ?? 0,\n        ...compactOptions,\n      }).format(value);\n  }\n}\n\n/**\n * Format a fractional change as a signed percentage.\n *\n * formatDelta(0.124)  -> \"+12.4%\"\n * formatDelta(-0.03)  -> \"-3.0%\"\n * formatDelta(0)      -> \"0.0%\"\n */\nexport function formatDelta(delta: number, locale = \"en-US\"): string {\n  if (!Number.isFinite(delta)) return \"—\";\n  return getFormatter(locale, {\n    style: \"percent\",\n    signDisplay: \"exceptZero\",\n    maximumFractionDigits: 1,\n    minimumFractionDigits: 1,\n  }).format(delta);\n}\n\n/**\n * Fractional change between two values. Returns 0 when there is no baseline.\n */\nexport function computeDelta(current: number, previous: number): number {\n  if (!previous) return 0;\n  return (current - previous) / Math.abs(previous);\n}\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/components/funnel-chart. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
