{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-plan",
  "title": "Pricing Plan",
  "author": "AlgorizeTech",
  "description": "Three pricing layouts in one item — basic cards, a feature table and a usage slider that recalculates price. Use the slider variant for consumption-based products.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/ui-badge.json",
    "https://avaraui.com/r/ui-button.json",
    "https://avaraui.com/r/ui-card.json",
    "https://avaraui.com/r/ui-slider.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/Pricing-plan.tsx",
      "content": "\"use client\";\n\nimport { Badge } from \"@/components/custom/ui/badge\";\nimport { Button } from \"@/components/custom/ui/button\";\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\nimport { Slider } from \"@/components/custom/ui/slider\";\nimport { cn } from \"@/lib/utils\";\nimport {\n  ArrowRight,\n  Building,\n  Calendar,\n  CalendarCog,\n  Check,\n  Minus,\n  Rocket,\n  Users,\n  Zap,\n} from \"lucide-react\";\nimport { useState, useEffect } from \"react\";\n\n// ==========================================\n// ICON MAP FOR MDX COMPATIBILITY\n// ==========================================\nconst ICON_MAP: Record<string, React.ElementType> = {\n  Calendar,\n  Users,\n  Rocket,\n  Building,\n  Zap,\n  CalendarCog,\n  ArrowRight,\n};\n\n/** A cell in the comparison table: a tick, a cross, or a value. */\nexport type PricingCellValue = string | number | boolean | null;\n\n/** One row of the comparison table, with a value per plan column. */\nexport interface PricingComparisonFeature {\n  name: string;\n  values: PricingCellValue[];\n}\n\nexport interface PricingFeatureSection {\n  title: string;\n  features: PricingComparisonFeature[];\n}\n\nexport interface PricingPlan {\n  id: string | number;\n  title: string;\n  subtitle?: string;\n  price: string | number;\n  period?: string;\n  /** A key of the block’s ICON_MAP, or a component. */\n  icon?: string | React.ElementType;\n  features?: string[];\n  popular?: boolean;\n  popularText?: string;\n  featured?: boolean;\n  active?: boolean;\n  buttonText?: string;\n  buttonClassName?: string;\n  rootClassName?: string;\n}\n\nexport interface PricingPlanTab {\n  id: string;\n  label: string;\n  icon?: string | React.ElementType;\n  plans?: PricingPlan[];\n  featureSections?: PricingFeatureSection[];\n}\n\nexport interface PricingPlanData {\n  tabs: PricingPlanTab[];\n}\n\nexport interface BasicPricingPlanProps {\n  data?: PricingPlanData;\n  variant?: string;\n  tabStyle?: \"default\" | \"toggle\" | string;\n  counting?: boolean;\n  tabClassName?: string;\n  cardClassName?: string;\n  popularBadgeClassName?: string;\n  buttonClassName?: string;\n}\n\nexport interface TablePricingPlanProps {\n  data?: PricingPlanData;\n  counting?: boolean;\n  className?: string;\n  headerClassName?: string;\n  rowClassName?: string;\n  buttonClassName?: string;\n}\n\nexport interface PricingBillingPeriod {\n  id: string;\n  label: string;\n  period?: string;\n  /** Percent off, applied to the tier price. */\n  discount?: number;\n  badgeText?: string;\n  badgeClassName?: string;\n}\n\nexport interface PricingSliderTier {\n  /** Shown in the tier label and substituted into `{tier}` in features. */\n  label?: string;\n  price: number | string;\n  /** Overrides `price` for a given billing period id. */\n  customPricing?: Record<string, number | string>;\n  [key: string]: unknown;\n}\n\nexport interface PricingSliderConfig {\n  min?: number;\n  max?: number;\n  step?: number;\n  defaultValue?: number;\n  minLabel?: string;\n  maxLabel?: string;\n}\n\nexport interface SliderPricingPlanProps {\n  pricingTiers?: PricingSliderTier[];\n  features?: string[];\n  billingPeriods?: PricingBillingPeriod[];\n  sliderConfig?: PricingSliderConfig;\n  ctaText?: string;\n  ctaIcon?: string | React.ElementType;\n  footerText?: string;\n  counting?: boolean;\n  /** Per-element class overrides. */\n  classNames?: Record<string, string>;\n  className?: string;\n  /** Fired with the newly selected tier and its slider index. */\n  onTierChange?: (tier: PricingSliderTier | undefined, index: number) => void;\n  /** Fired with the billing period id. */\n  onBillingChange?: (id: string) => void;\n  /** Fired with the current tier and billing period id. */\n  onCtaClick?: (tier: PricingSliderTier | undefined, billingPeriod: string) => void;\n}\n\n/** Class bundles per visual variant. */\nconst pricingVariants: Record<string, Record<string, string>> = {\n  default: {\n    container: \"w-full p-6\",\n    card: \"relative transition-all duration-200 hover:shadow-lg dark:hover:shadow-xl\",\n    cardPopular:\n      \"border-primary/30 shadow-lg scale-105 dark:shadow-primary/20\",\n    cardHeader: \"text-center pb-4\",\n    price: \"text-3xl font-semibold text-foreground\",\n    button: \"w-full mb-6\",\n    buttonPopular:\n      \"bg-primary hover:bg-primary/90\",\n    featuresTitle:\n      \"font-semibold text-sm text-muted-foreground uppercase tracking-wide\",\n    featureIcon: \"rounded-full p-0.5 mr-3 mt-0.5\",\n    featureIconPopular: \"bg-primary\",\n    featureIconDefault: \"bg-muted\",\n  },\n  premium: {\n    container: \"w-full p-8\",\n    card: \"relative transition-all duration-300 hover:shadow-2xl border-2 dark:hover:shadow-2xl dark:hover:shadow-slate-900/50\",\n    cardPopular:\n      \"border-gradient-to-r from-primary to-primary/70 shadow-2xl scale-110 bg-gradient-to-br from-background to-primary/5 dark:to-primary/10 dark:border-primary/30 dark:shadow-primary/20\",\n    cardHeader: \"text-center pb-6\",\n    price:\n      \"text-4xl font-extrabold bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent dark:from-primary dark:to-primary/80\",\n    button: \"w-full mb-8\",\n    buttonPopular:\n      \"bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary/70 shadow-lg dark:from-primary dark:to-primary/80 dark:hover:from-primary/90 dark:hover:to-primary/70\",\n    featuresTitle:\n      \"font-semibold text-sm text-foreground uppercase tracking-wide border-b border-border pb-2\",\n    featureIcon: \"rounded-lg p-1 mr-3 mt-0.5 shadow-sm dark:shadow-slate-800\",\n    featureIconPopular:\n      \"bg-gradient-to-br from-primary to-primary/80 dark:from-primary dark:to-primary/80\",\n    featureIconDefault:\n      \"bg-gradient-to-br from-muted to-muted/70\",\n  },\n  elegant: {\n    container: \"w-full p-8\",\n    card: \"relative transition-all duration-500 bg-gradient-to-b from-muted/50 to-card border border-border/60 hover:shadow-xl hover:shadow-slate-200/40 hover:-translate-y-1 dark:hover:shadow-xl dark:hover:shadow-slate-900/40\",\n    cardPopular:\n      \"border-foreground/20 shadow-xl shadow-slate-200/60 scale-105 bg-gradient-to-b from-muted to-card dark:shadow-slate-900/60\",\n    cardHeader:\n      \"text-center pb-6 border-b border-border/60 mb-6\",\n    price:\n      \"text-3xl font-light text-foreground tracking-tight\",\n    button: \"w-full mb-8 font-medium tracking-wide transition-all duration-300\",\n    buttonPopular:\n      \"bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg hover:shadow-xl\",\n    featuresTitle:\n      \"font-medium text-xs text-muted-foreground uppercase tracking-[0.1em] border-b border-border/60 pb-3 mb-4\",\n    featureIcon: \"rounded-full p-1 mr-3 mt-0.5 transition-all duration-200\",\n    featureIconPopular:\n      \"bg-primary shadow-sm dark:shadow-slate-800\",\n    featureIconDefault: \"bg-muted\",\n  },\n};\n\nconst AnimatedPrice = ({\n  value,\n  counting = true,\n}: {\n  value: number | string;\n  counting?: boolean;\n}) => {\n  const cleanValue = String(value);\n  const numericValue = parseFloat(cleanValue.replace(/[^0-9.]/g, \"\"));\n  const [displayValue, setDisplayValue] = useState(counting ? 0 : numericValue);\n\n  useEffect(() => {\n    // Both cases render the value directly, without reading state.\n    if (!counting || isNaN(numericValue)) return;\n    let startTime: number;\n    const duration = 600;\n    const startValue = 0;\n\n    const animate = (time: number) => {\n      if (!startTime) startTime = time;\n      const progress = Math.min((time - startTime) / duration, 1);\n      const easeProgress = 1 - Math.pow(1 - progress, 5);\n      setDisplayValue(startValue + (numericValue - startValue) * easeProgress);\n      if (progress < 1) requestAnimationFrame(animate);\n      else setDisplayValue(numericValue);\n    };\n    requestAnimationFrame(animate);\n  }, [numericValue, value, counting]);\n\n  if (isNaN(numericValue)) return <span>{cleanValue}</span>;\n  if (!counting) return <span>{cleanValue.replace(/[^0-9.]/g, \"\")}</span>;\n\n  const isDecimal = cleanValue.includes(\".\");\n  return (\n    <span>\n      {isDecimal\n        ? displayValue.toFixed(2)\n        : Math.round(displayValue).toLocaleString()}\n    </span>\n  );\n};\n\nexport function BasicPricingPlan({\n  data,\n  variant = \"default\",\n  tabStyle = \"default\",\n  counting = true,\n  tabClassName,\n  cardClassName,\n  popularBadgeClassName,\n  buttonClassName,\n}: BasicPricingPlanProps) {\n  const [activeTab, setActiveTab] = useState(data?.tabs?.[0]?.id || \"\");\n  const [isTransitioning, setIsTransitioning] = useState(false);\n\n  if (!data || !data.tabs || data.tabs.length === 0) return null;\n  const activeTabData = data.tabs.find((tab: PricingPlanTab) => tab.id === activeTab);\n  const variantStyles = pricingVariants[variant] || pricingVariants.default;\n\n  const handleTabChange = (tabId: string) => {\n    if (tabStyle === \"toggle\" && tabId !== activeTab) {\n      setIsTransitioning(true);\n      setTimeout(() => {\n        setActiveTab(tabId);\n        setIsTransitioning(false);\n      }, 150);\n    } else {\n      setActiveTab(tabId);\n    }\n  };\n\n  return (\n    <div className='w-full'>\n      <div className=\"flex justify-center mb-18\">\n        {tabStyle === \"toggle\" ? (\n          <div\n            className={cn(\n              \"relative inline-flex items-center justify-center rounded-full bg-muted p-1\",\n              tabClassName,\n            )}\n          >\n            <div\n              className=\"absolute top-1 bottom-1 bg-primary rounded-full transition-all duration-300 ease-in-out shadow-sm\"\n              style={{\n                width: `calc(${100 / data.tabs.length}% - 8px)`,\n                left: `calc(${(data.tabs.findIndex((tab: PricingPlanTab) => tab.id === activeTab) * 100) / data.tabs.length}% + 4px)`,\n              }}\n            />\n            {data.tabs.map((tab: PricingPlanTab) => {\n              const TabIcon =\n                typeof tab.icon === \"string\" ? ICON_MAP[tab.icon] : tab.icon;\n              return (\n                <button\n                  key={tab.id}\n                  onClick={() => handleTabChange(tab.id)}\n                  className={cn(\n                    \"relative z-10 inline-flex items-center justify-center whitespace-nowrap rounded-full px-6 py-2 text-sm font-medium transition-all duration-300 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n                    activeTab === tab.id\n                      ? \"text-primary-foreground\"\n                      : \"text-muted-foreground hover:text-foreground\",\n                  )}\n                >\n                  {TabIcon && <TabIcon className=\"w-4 h-4 mr-2\" />}\n                  {tab.label}\n                </button>\n              );\n            })}\n          </div>\n        ) : (\n          <div\n            className={cn(\n              \"inline-flex items-center justify-center rounded-full bg-muted p-1\",\n              tabClassName,\n            )}\n          >\n            {data.tabs.map((tab: PricingPlanTab) => {\n              const TabIcon =\n                typeof tab.icon === \"string\" ? ICON_MAP[tab.icon] : tab.icon;\n              return (\n                <button\n                  key={tab.id}\n                  onClick={() => handleTabChange(tab.id)}\n                  className={cn(\n                    \"inline-flex items-center justify-center whitespace-nowrap rounded-full px-6 py-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n                    activeTab === tab.id\n                      ? \"bg-primary text-primary-foreground shadow-sm\"\n                      : \"text-muted-foreground hover:bg-background hover:text-foreground\",\n                  )}\n                >\n                  {TabIcon && <TabIcon className=\"w-4 h-4 mr-2\" />}\n                  {tab.label}\n                </button>\n              );\n            })}\n          </div>\n        )}\n      </div>\n\n      <div\n        className={cn(\n          \"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6\",\n          tabStyle === \"toggle\" && \"transition-all duration-300 ease-in-out\",\n          tabStyle === \"toggle\" && isTransitioning && \"opacity-0 scale-95\",\n        )}\n      >\n        {activeTabData?.plans?.map((plan: PricingPlan) => {\n          const PlanIcon =\n            typeof plan.icon === \"string\" ? ICON_MAP[plan.icon] : plan.icon;\n          return (\n            <Card\n              key={plan.id}\n              className={cn(\n                variantStyles.card,\n                plan.popular && variantStyles.cardPopular,\n                plan.active && \"ring-2 ring-primary/30\",\n                cardClassName,\n                plan.rootClassName,\n                tabStyle === \"toggle\" &&\n                  \"transition-all duration-300 ease-in-out\",\n                tabStyle === \"toggle\" &&\n                  !isTransitioning &&\n                  \"animate-in slide-in-from-bottom-4 fade-in\",\n              )}\n            >\n              {plan.popular && (\n                <div className=\"absolute -top-3 left-1/2 transform -translate-x-1/2\">\n                  <Badge\n                    variant=\"default\"\n                    className={cn(\n                      \"bg-primary text-primary-foreground\",\n                      popularBadgeClassName,\n                    )}\n                  >\n                    {plan.popularText || \"Most popular\"}\n                  </Badge>\n                </div>\n              )}\n              <CardHeader className={variantStyles.cardHeader}>\n                <div className=\"flex items-center justify-center mb-2\">\n                  {PlanIcon && (\n                    <PlanIcon className=\"w-6 h-6 mr-2 text-primary\" />\n                  )}\n                  <CardTitle\n                    className={cn(\n                      \"text-xl font-semibold\",\n                      plan.active && \"text-primary\",\n                    )}\n                  >\n                    {plan.title}\n                  </CardTitle>\n                </div>\n                <CardDescription\n                  className={cn(\n                    \"text-sm\",\n                    variant === \"elegant\"\n                      ? \"text-muted-foreground\"\n                      : \"text-muted-foreground\",\n                  )}\n                >\n                  {plan.subtitle}\n                </CardDescription>\n                <div className=\"mt-4\">\n                  <span className={cn(variantStyles.price)}>\n                    {typeof plan.price === \"string\" && plan.price.startsWith(\"$\") ? \"$\" : \"\"}\n                    <AnimatedPrice value={plan.price} counting={counting} />\n                  </span>\n                  {plan.period && (\n                    <span\n                      className={cn(\n                        \"ml-1\",\n                        variant === \"elegant\"\n                          ? \"text-muted-foreground\"\n                          : \"text-muted-foreground\",\n                      )}\n                    >\n                      /{plan.period}\n                    </span>\n                  )}\n                </div>\n              </CardHeader>\n              <CardContent className=\"pt-0\">\n                <Button\n                  className={cn(\n                    variantStyles.button,\n                    plan.popular ? variantStyles.buttonPopular : \"\",\n                    buttonClassName,\n                    plan.buttonClassName,\n                  )}\n                  variant={plan.popular ? \"default\" : \"outline\"}\n                >\n                  {plan.buttonText || \"Buy plan\"}\n                </Button>\n                <div className=\"space-y-4\">\n                  <h4 className={variantStyles.featuresTitle}>\n                    What&apos;s included:\n                  </h4>\n                  <ul className=\"space-y-3\">\n                    {plan.features?.map((feature: string, featureIndex: number) => (\n                      <li key={featureIndex} className=\"flex items-start\">\n                        <div\n                          className={cn(\n                            variantStyles.featureIcon,\n                            plan.popular\n                              ? variantStyles.featureIconPopular\n                              : variantStyles.featureIconDefault,\n                          )}\n                        >\n                          <Check\n                            className={cn(\n                              \"w-3 h-3\",\n                              variant === \"elegant\"\n                                ? plan.popular\n                                  ? \"text-primary-foreground\"\n                                  : \"text-muted-foreground\"\n                                : plan.popular\n                                  ? \"text-primary-foreground\"\n                                  : \"text-foreground\",\n                            )}\n                          />\n                        </div>\n                        <span\n                          className={cn(\n                            \"text-sm leading-relaxed\",\n                            variant === \"elegant\"\n                              ? \"text-foreground\"\n                              : \"\",\n                          )}\n                        >\n                          {feature}\n                        </span>\n                      </li>\n                    ))}\n                  </ul>\n                </div>\n              </CardContent>\n            </Card>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n\nexport function TablePricingPlan({\n  data,\n  counting = true,\n  className,\n  headerClassName,\n  rowClassName,\n  buttonClassName,\n}: TablePricingPlanProps) {\n  const [activeTab, setActiveTab] = useState(data?.tabs?.[0]?.id || \"\");\n\n  if (!data || !data.tabs || data.tabs.length === 0) return null;\n  const activeTabData = data.tabs.find((tab: PricingPlanTab) => tab.id === activeTab);\n\n  const renderFeatureValue = (value: PricingCellValue, planIndex: number) => {\n    if (value === true)\n      return <Check className=\"w-5 h-5 text-primary mx-auto\" />;\n    if (value === false || value === null || value === undefined)\n      return <Minus className=\"w-5 h-5 text-muted-foreground mx-auto\" />;\n    if (typeof value === \"string\" || typeof value === \"number\")\n      return (\n        <span\n          className={cn(\n            \"text-sm\",\n            planIndex === 1 ? \"font-medium\" : \"text-muted-foreground\",\n          )}\n        >\n          {value}\n        </span>\n      );\n    return <Minus className=\"w-5 h-5 text-muted-foreground mx-auto\" />;\n  };\n\n  return (\n    <div className={cn(\"w-full\", className)}>\n      {data.tabs.length > 1 && (\n        <div className=\"flex justify-center mb-8\">\n          <div className=\"inline-flex items-center justify-center rounded-full bg-muted p-1\">\n            {data.tabs.map((tab: PricingPlanTab) => {\n              const TabIcon =\n                typeof tab.icon === \"string\" ? ICON_MAP[tab.icon] : tab.icon;\n              return (\n                <button\n                  key={tab.id}\n                  onClick={() => setActiveTab(tab.id)}\n                  className={cn(\n                    \"inline-flex items-center justify-center whitespace-nowrap rounded-full px-6 py-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n                    activeTab === tab.id\n                      ? \"bg-primary text-primary-foreground shadow-sm\"\n                      : \"text-muted-foreground hover:bg-background hover:text-foreground\",\n                  )}\n                >\n                  {TabIcon && <TabIcon className=\"w-4 h-4 mr-2\" />}\n                  {tab.label}\n                </button>\n              );\n            })}\n          </div>\n        </div>\n      )}\n\n      <div className=\"border rounded-lg overflow-hidden bg-background\">\n        <div\n          className={cn(\n            \"grid grid-cols-4 border-b bg-muted/30\",\n            headerClassName,\n          )}\n        >\n          <div className=\"p-6\"></div>\n          {activeTabData?.plans?.map((plan: PricingPlan) => (\n            <div\n              key={plan.id}\n              className={cn(\n                \"p-6 text-center border-l\",\n                plan.featured && \"bg-primary/5 border-primary/20\",\n              )}\n            >\n              <h3\n                className={cn(\n                  \"text-lg font-semibold mb-2\",\n                  plan.featured && \"text-primary\",\n                )}\n              >\n                {plan.title}\n              </h3>\n              <div className=\"mb-4\">\n                <span className=\"text-3xl font-semibold\">\n                  {typeof plan.price === \"string\" && plan.price.startsWith(\"$\") ? \"$\" : \"\"}\n                  <AnimatedPrice value={plan.price} counting={counting} />\n                </span>\n                {plan.period && (\n                  <span className=\"text-muted-foreground ml-1\">\n                    /{plan.period}\n                  </span>\n                )}\n              </div>\n              <Button\n                className={cn(\n                  \"w-full\",\n                  plan.featured ? \"bg-primary hover:bg-primary/90\" : \"\",\n                  buttonClassName,\n                  plan.buttonClassName,\n                )}\n                variant={plan.featured ? \"default\" : \"outline\"}\n              >\n                {plan.buttonText || \"Buy plan\"}\n              </Button>\n            </div>\n          ))}\n        </div>\n\n        {activeTabData?.featureSections?.map((section: PricingFeatureSection) => (\n          <div key={section.title}>\n            <div\n              className={cn(\n                \"grid grid-cols-4 border-b bg-muted/50\",\n                rowClassName,\n              )}\n            >\n              <div className=\"p-4 font-semibold text-sm\">{section.title}</div>\n              <div className=\"border-l\"></div>\n              <div className=\"border-l\"></div>\n              <div className=\"border-l\"></div>\n            </div>\n            {section.features.map((feature: PricingComparisonFeature) => (\n              <div\n                key={feature.name}\n                className={cn(\n                  \"grid grid-cols-4 border-b last:border-b-0 hover:bg-muted/30 transition-colors\",\n                  rowClassName,\n                )}\n              >\n                <div className=\"p-4 text-sm font-medium\">{feature.name}</div>\n                {activeTabData?.plans?.map((plan: PricingPlan, planIndex: number) => (\n                  <div\n                    key={plan.id}\n                    className={cn(\n                      \"p-4 text-center border-l flex items-center justify-center\",\n                      plan.featured && \"bg-primary/5 border-primary/20\",\n                    )}\n                  >\n                    {renderFeatureValue(feature.values[planIndex], planIndex)}\n                  </div>\n                ))}\n              </div>\n            ))}\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n}\n\nexport function SliderPricingPlan({\n  pricingTiers = [],\n  features = [],\n  billingPeriods = [\n    { id: \"monthly\", label: \"Monthly\", period: \"month\" },\n    {\n      id: \"yearly\",\n      label: \"Yearly\",\n      period: \"year\",\n      discount: 10,\n      badgeText: \"2 months free\",\n      badgeClassName: \"bg-primary\",\n    },\n  ],\n  sliderConfig = {\n    min: 0,\n    max: pricingTiers.length - 1,\n    step: 1,\n    defaultValue: Math.floor(pricingTiers.length / 2),\n    minLabel: \"10k\",\n    maxLabel: \"10M+\",\n  },\n  ctaText = \"Start 14-day free trial\",\n  ctaIcon = \"ArrowRight\", // FIX: Changed default to string\n  footerText = \"$0.00 due today. No credit card required.\",\n  counting = true,\n  classNames = {},\n  className,\n  onTierChange,\n  onBillingChange,\n  onCtaClick,\n}: SliderPricingPlanProps) {\n  const [sliderValue, setSliderValue] = useState([\n    sliderConfig.defaultValue || 0,\n  ]);\n  const [billingPeriod, setBillingPeriod] = useState(\n    billingPeriods[0]?.id || \"monthly\",\n  );\n\n  if (!pricingTiers.length) return <div>No pricing tiers provided</div>;\n\n  const currentTier = pricingTiers[sliderValue[0]];\n  const currentBilling = billingPeriods.find(\n    (bp: PricingBillingPeriod) => bp.id === billingPeriod,\n  );\n\n  // Resolve string icon to component\n  const CtaIcon = typeof ctaIcon === \"string\" ? ICON_MAP[ctaIcon] : ctaIcon;\n\n  const getPrice = (): number => {\n    if (!currentTier) return 0;\n    const raw = currentTier.customPricing?.[billingPeriod] ?? currentTier.price;\n    const value = typeof raw === \"string\" ? parseFloat(raw.replace(/[^0-9.]/g, \"\")) : raw;\n    return Number.isFinite(value) ? value : 0;\n  };\n\n  const getCurrentPrice = () => getPrice();\n\n  const getYearlyTotal = () => {\n    const monthlyPrice = getPrice();\n    return currentBilling?.discount\n      ? monthlyPrice * currentBilling.discount\n      : monthlyPrice * 12;\n  };\n\n  const getSavings = () => {\n    if (billingPeriod === \"yearly\" && currentBilling?.discount) {\n      return getCurrentPrice() * (12 - currentBilling.discount);\n    }\n    return 0;\n  };\n\n  const handleSliderChange = (value: number[]) => {\n    setSliderValue(value);\n    const tier = pricingTiers[value[0]];\n    onTierChange?.(tier, value[0]);\n  };\n\n  const handleBillingChange = (period: string) => {\n    setBillingPeriod(period);\n    onBillingChange?.(period);\n  };\n\n  const handleCtaClick = () => {\n    onCtaClick?.(currentTier, billingPeriod);\n  };\n\n  const processedFeatures = features.map((feature: string) =>\n    feature.replace(\"{tier}\", currentTier?.label || \"\"),\n  );\n\n  return (\n    <div\n      className={cn(\n        \"w-full max-w-2xl mx-auto p-6 bg-muted\",\n        classNames.container,\n        className,\n      )}\n    >\n      <div className=\"mb-8\">\n        <div className=\"flex justify-center mb-6\">\n          <div\n            className={cn(\n              \"bg-primary text-primary-foreground px-4 py-2 rounded-lg text-sm font-medium\",\n              classNames.eventBadge,\n            )}\n          >\n            Up to {currentTier?.label} monthly events\n          </div>\n        </div>\n\n        <div className=\"relative mb-8\">\n          <div\n            className={cn(\n              \"flex justify-between text-sm text-muted-foreground mb-4 px-2\",\n              classNames.sliderLabels,\n            )}\n          >\n            <span>{sliderConfig.minLabel}</span>\n            <span>{sliderConfig.maxLabel}</span>\n          </div>\n          <div className=\"relative\">\n            <Slider\n              value={sliderValue}\n              onValueChange={handleSliderChange}\n              min={sliderConfig.min}\n              max={sliderConfig.max}\n              step={sliderConfig.step}\n              className={cn(\n                \"w-full [&_[role=slider]]:h-6 [&_[role=slider]]:w-6 [&_[role=slider]]:border-4 [&_[role=slider]]:border-background [&_[role=slider]]:bg-primary [&_[role=slider]]:shadow-lg [&>.relative]:bg-foreground/20 [&_[role=slider]]:ring-2 [&_[role=slider]]:ring-background\",\n                classNames.slider,\n              )}\n            />\n          </div>\n        </div>\n      </div>\n\n      <Card\n        className={cn(\n          \"bg-card border-border text-foreground rounded-2xl overflow-hidden\",\n          classNames.card,\n        )}\n      >\n        {billingPeriods.length > 1 && (\n          <div className=\"flex justify-center pt-8 pb-6\">\n            <div\n              className={cn(\n                \"inline-flex items-center justify-center rounded-xl bg-muted p-1.5 gap-1\",\n                classNames.tabContainer,\n              )}\n            >\n              {billingPeriods.map((period: PricingBillingPeriod) => (\n                <button\n                  key={period.id}\n                  onClick={() => handleBillingChange(period.id)}\n                  className={cn(\n                    \"inline-flex items-center justify-center whitespace-nowrap rounded-lg px-6 py-2.5 text-sm font-medium transition-all\",\n                    billingPeriod === period.id\n                      ? cn(\n                          \"bg-card text-foreground shadow-sm\",\n                          classNames.tabButtonActive,\n                        )\n                      : cn(\n                          \"text-muted-foreground hover:text-foreground\",\n                          classNames.tabButton,\n                        ),\n                  )}\n                >\n                  {period.label}\n                  {period.badgeText && (\n                    <Badge\n                      className={cn(\n                        \"ml-2 text-primary-foreground text-xs px-2 py-0.5 rounded-md\",\n                        period.badgeClassName || \"bg-primary\",\n                      )}\n                    >\n                      {period.badgeText}\n                    </Badge>\n                  )}\n                </button>\n              ))}\n            </div>\n          </div>\n        )}\n\n        <CardContent className=\"px-8 pb-8\">\n          <div className=\"mb-8\">\n            <div className=\"flex items-baseline justify-start mb-2\">\n              <span\n                className={cn(\n                  \"text-5xl font-semibold text-foreground\",\n                  classNames.price,\n                )}\n              >\n                $<AnimatedPrice value={getCurrentPrice()} counting={counting} />\n              </span>\n            </div>\n            <div\n              className={cn(\n                \"text-sm text-muted-foreground\",\n                classNames.pricePeriod,\n              )}\n            >\n              {billingPeriod === \"monthly\" || !currentBilling?.discount\n                ? `/${currentBilling?.period || \"month\"}`\n                : `/${currentBilling?.period || \"month\"} billed as $${getYearlyTotal()} per year`}\n            </div>\n            {billingPeriod === \"yearly\" && getSavings() > 0 && (\n              <div\n                className={cn(\n                  \"text-orange-500 text-sm font-medium flex items-center mt-3\",\n                  classNames.savingsText,\n                )}\n              >\n                <Check className=\"w-4 h-4 mr-2\" />\n                Save ${getSavings()}\n              </div>\n            )}\n          </div>\n\n          <div className={cn(\"space-y-4 mb-8\", classNames.featuresList)}>\n            {processedFeatures.map((feature: string, index: number) => (\n              <div\n                key={index}\n                className={cn(\"flex items-center\", classNames.featureItem)}\n              >\n                <div\n                  className={cn(\n                    \"rounded-full bg-primary p-1 mr-4 flex-shrink-0\",\n                    classNames.featureIcon,\n                  )}\n                >\n                  <Check className=\"w-3 h-3 text-primary-foreground\" />\n                </div>\n                <span\n                  className={cn(\n                    \"text-sm text-foreground\",\n                    classNames.featureText,\n                  )}\n                >\n                  {feature}\n                </span>\n              </div>\n            ))}\n          </div>\n\n          <Button\n            onClick={handleCtaClick}\n            className={cn(\n              \"w-full bg-primary hover:bg-primary/90 text-primary-foreground font-medium py-4 rounded-xl text-base mb-4 transition-colors\",\n              classNames.ctaButton,\n            )}\n          >\n            {ctaText}\n            {CtaIcon && <CtaIcon className=\"w-4 h-4 ml-2\" />}\n          </Button>\n\n          {footerText && (\n            <p\n              className={cn(\n                \"text-center text-sm text-muted-foreground\",\n                classNames.footerText,\n              )}\n            >\n              {footerText}\n            </p>\n          )}\n        </CardContent>\n      </Card>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/custom/blocks/Pricing-plan.tsx"
    }
  ],
  "docs": "Named exports: BasicPricingPlan, TablePricingPlan, SliderPricingPlan. The heaviest dependency graph in the registry: pulls `ui-badge`, `ui-button`, `ui-card` and `ui-slider`. Note `ui-card` installs to components/ui/card.tsx and will overwrite an existing shadcn card — review before adding to an established project.",
  "categories": [
    "commerce",
    "marketing"
  ],
  "type": "registry:component"
}
