{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "comparison-calculator",
  "type": "registry:component",
  "title": "Comparison Calculator",
  "description": "A light pricing calculator where sliders for seats and contacts and a monthly or yearly switch update a bar chart of your price against competitors, with the yearly savings counting to the new value.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "comparison",
    "pricing calculator",
    "sliders",
    "savings",
    "bar chart",
    "competitors",
    "light"
  ],
  "docs": "https://hyperblur.dev/effects/comparison-calculator",
  "files": [
    {
      "path": "registry/hyperblur/comparison-calculator.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/comparison-calculator.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ComparisonCalculatorPlan {\n  name: string;\n  base: number;\n  perSeat: number;\n  perThousand: number;\n  annualDiscount?: number;\n}\n\nexport interface ComparisonCalculatorValue {\n  seats: number;\n  contacts: number;\n  annual: boolean;\n}\n\nexport interface ComparisonCalculatorProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onChange\" | \"defaultValue\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  product?: ComparisonCalculatorPlan;\n  competitors?: ComparisonCalculatorPlan[];\n  value?: ComparisonCalculatorValue;\n  defaultValue?: ComparisonCalculatorValue;\n  onChange?: (value: ComparisonCalculatorValue, yearlySavings: number) => void;\n  maxSeats?: number;\n  maxContacts?: number;\n  cta?: { label: string; href: string } | null;\n  accent?: string;\n}\n\nconst css = `\n.hb-yh3 {\n  --hb-yh3-accent: #ff5a36;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  overflow: hidden;\n  padding: clamp(64px, 9cqi, 112px) 20px;\n  background: #f7f5ef;\n  color: #141414;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-yh3 *, .hb-yh3 *::before, .hb-yh3 *::after { box-sizing: border-box; }\n.hb-yh3::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background-image: radial-gradient(rgba(20,20,20,.07) 1px, transparent 1px);\n  background-size: 22px 22px;\n  -webkit-mask-image: radial-gradient(70% 60% at 50% 0%, #000, transparent);\n  mask-image: radial-gradient(70% 60% at 50% 0%, #000, transparent);\n  pointer-events: none;\n}\n.hb-yh3-in { position: relative; max-width: 1120px; margin: 0 auto; }\n.hb-yh3-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }\n.hb-yh3-eyebrow { display: inline-block; color: var(--hb-yh3-accent); font-size: 13px; font-weight: 650; }\n.hb-yh3-title { margin: 10px 0 0; max-width: 560px; font-size: clamp(30px, 4.4cqi, 46px); font-weight: 650; letter-spacing: -.035em; line-height: 1.05; }\n.hb-yh3-sub { margin: 0; max-width: 360px; color: #6b6b6b; font-size: 15px; line-height: 1.6; }\n.hb-yh3-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }\n.hb-yh3-card { min-width: 0; padding: 28px; border: 1px solid rgba(20,20,20,.08); border-radius: 22px; background: #fff; box-shadow: 0 1px 0 rgba(20,20,20,.03), 0 20px 50px -30px rgba(20,20,20,.25); }\n.hb-yh3-field + .hb-yh3-field { margin-top: 28px; }\n.hb-yh3-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }\n.hb-yh3-lab label { font-size: 14px; font-weight: 600; }\n.hb-yh3-out { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }\n.hb-yh3-out small { margin-left: 4px; color: #8a8a8a; font-size: 12.5px; font-weight: 500; letter-spacing: 0; }\n.hb-yh3-hint { margin: 4px 0 0; color: #8a8a8a; font-size: 12.5px; }\n.hb-yh3-range {\n  -webkit-appearance: none;\n  appearance: none;\n  display: block;\n  width: 100%;\n  height: 28px;\n  margin: 12px 0 0;\n  background: transparent;\n  cursor: pointer;\n}\n.hb-yh3-range::-webkit-slider-runnable-track {\n  height: 8px;\n  border-radius: 99px;\n  background: linear-gradient(90deg, var(--hb-yh3-accent) 0 calc(var(--hb-yh3-p) * 1%), #ebe8df calc(var(--hb-yh3-p) * 1%) 100%);\n}\n.hb-yh3-range::-moz-range-track { height: 8px; border-radius: 99px; background: #ebe8df; }\n.hb-yh3-range::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--hb-yh3-accent); }\n.hb-yh3-range::-webkit-slider-thumb {\n  -webkit-appearance: none;\n  width: 24px;\n  height: 24px;\n  margin-top: -8px;\n  border: 0;\n  border-radius: 50%;\n  background: #fff;\n  box-shadow: 0 0 0 1px rgba(20,20,20,.12), 0 4px 10px -2px rgba(20,20,20,.3), inset 0 0 0 6px var(--hb-yh3-accent);\n  transition: transform .15s ease;\n}\n.hb-yh3-range::-moz-range-thumb {\n  width: 24px;\n  height: 24px;\n  border: 0;\n  border-radius: 50%;\n  background: #fff;\n  box-shadow: 0 0 0 1px rgba(20,20,20,.12), 0 4px 10px -2px rgba(20,20,20,.3), inset 0 0 0 6px var(--hb-yh3-accent);\n}\n.hb-yh3-range:active::-webkit-slider-thumb { transform: scale(1.12); }\n.hb-yh3-range:focus-visible { outline: none; }\n.hb-yh3-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-yh3-accent) 30%, transparent), inset 0 0 0 6px var(--hb-yh3-accent); }\n.hb-yh3-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-yh3-accent) 30%, transparent), inset 0 0 0 6px var(--hb-yh3-accent); }\n.hb-yh3-ticks { display: flex; justify-content: space-between; margin-top: 4px; color: #a3a3a3; font-size: 11px; font-variant-numeric: tabular-nums; }\n.hb-yh3-seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-top: 30px; padding: 4px; border-radius: 999px; background: #f1eee6; }\n.hb-yh3-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(20,20,20,.12), 0 4px 12px -4px rgba(20,20,20,.18); transition: transform .35s cubic-bezier(.3,1.3,.5,1); }\n.hb-yh3-seg[data-annual=\"true\"] .hb-yh3-pill { transform: translateX(100%); }\n.hb-yh3-opt { position: relative; z-index: 1; height: 38px; border: 0; border-radius: 999px; background: transparent; color: #6b6b6b; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: color .2s ease; }\n.hb-yh3-opt[aria-pressed=\"true\"] { color: #141414; }\n.hb-yh3-opt em { margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--hb-yh3-accent) 14%, #fff); color: var(--hb-yh3-accent); font-size: 11px; font-style: normal; }\n.hb-yh3-opt:focus-visible, .hb-yh3 a:focus-visible { outline: 2px solid var(--hb-yh3-accent); outline-offset: 2px; }\n.hb-yh3-res { display: flex; flex-direction: column; }\n.hb-yh3-save { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid rgba(20,20,20,.07); }\n.hb-yh3-sl { color: #6b6b6b; font-size: 13.5px; }\n.hb-yh3-sv { margin-top: 6px; font-size: clamp(36px, 5.4cqi, 56px); font-weight: 700; letter-spacing: -.045em; line-height: 1; font-variant-numeric: tabular-nums; }\n.hb-yh3-sv span { color: var(--hb-yh3-accent); }\n.hb-yh3-cta {\n  display: inline-flex;\n  align-items: center;\n  flex: none;\n  height: 42px;\n  padding: 0 18px;\n  border-radius: 999px;\n  background: #141414;\n  color: #fff;\n  font-size: 14px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: background-color .2s ease, transform .15s ease;\n}\n.hb-yh3-cta:hover { background: #2a2a2a; }\n.hb-yh3-cta:active { transform: scale(.98); }\n.hb-yh3-chart { position: relative; display: grid; grid-template-columns: repeat(var(--hb-yh3-n), minmax(0, 1fr)); gap: 18px; align-items: end; height: 250px; margin-top: 24px; padding-top: 10px; }\n.hb-yh3-chart::before {\n  content: \"\";\n  position: absolute;\n  inset: 10px 0 34px;\n  background: repeating-linear-gradient(180deg, rgba(20,20,20,.06) 0 1px, transparent 1px 25%);\n  pointer-events: none;\n}\n.hb-yh3-col { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }\n.hb-yh3-amt { margin-bottom: 8px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }\n.hb-yh3-amt small { color: #8a8a8a; font-size: 11.5px; font-weight: 500; }\n.hb-yh3-bar {\n  position: relative;\n  width: min(100%, 92px);\n  height: calc((100% - 64px) * var(--hb-yh3-h) / 100);\n  min-height: 6px;\n  border-radius: 12px 12px 4px 4px;\n  background: repeating-linear-gradient(135deg, #e7e3d9 0 6px, #efece4 6px 12px);\n  box-shadow: inset 0 0 0 1px rgba(20,20,20,.06);\n  transition: height .55s cubic-bezier(.3,1.2,.4,1);\n}\n.hb-yh3-col[data-us=\"true\"] .hb-yh3-bar { background: linear-gradient(180deg, color-mix(in srgb, var(--hb-yh3-accent) 85%, #fff), var(--hb-yh3-accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 14px 30px -12px color-mix(in srgb, var(--hb-yh3-accent) 80%, transparent); }\n.hb-yh3-name { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; color: #6b6b6b; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }\n.hb-yh3-col[data-us=\"true\"] .hb-yh3-name { color: #141414; }\n.hb-yh3-name i { width: 8px; height: 8px; flex: none; border-radius: 2px; background: #d6d1c4; }\n.hb-yh3-col[data-us=\"true\"] .hb-yh3-name i { background: var(--hb-yh3-accent); }\n.hb-yh3-note { margin: 14px 0 0; color: #8a8a8a; font-size: 12px; line-height: 1.5; }\n@container (max-width: 860px) {\n  .hb-yh3-head { flex-direction: column; align-items: flex-start; }\n  .hb-yh3-grid { grid-template-columns: minmax(0, 1fr); }\n}\n@container (max-width: 480px) {\n  .hb-yh3-card { padding: 22px; }\n  .hb-yh3-save { flex-direction: column; }\n  .hb-yh3-chart { gap: 10px; height: 220px; }\n  .hb-yh3-amt { font-size: 12.5px; }\n  .hb-yh3-amt small { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-yh3 *, .hb-yh3 *::before, .hb-yh3 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultProduct: ComparisonCalculatorPlan = { name: \"Relay\", base: 0, perSeat: 12, perThousand: 4, annualDiscount: 0.2 };\n\nconst defaultCompetitors: ComparisonCalculatorPlan[] = [\n  { name: \"Beacon Desk\", base: 0, perSeat: 39, perThousand: 6, annualDiscount: 0.1 },\n  { name: \"Parcel HQ\", base: 99, perSeat: 29, perThousand: 9, annualDiscount: 0.15 },\n  { name: \"Switchyard\", base: 49, perSeat: 45, perThousand: 3, annualDiscount: 0 },\n];\n\nfunction money(n: number) {\n  const s = Math.round(n).toString();\n  return `$${s.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`;\n}\n\nfunction monthly(plan: ComparisonCalculatorPlan, v: ComparisonCalculatorValue) {\n  const raw = plan.base + v.seats * plan.perSeat + v.contacts * plan.perThousand;\n  return v.annual ? raw * (1 - (plan.annualDiscount ?? 0)) : raw;\n}\n\nfunction useTween(target: number, ms = 450) {\n  const [shown, setShown] = React.useState(target);\n  const from = React.useRef(target);\n  React.useEffect(() => {\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      from.current = target;\n      const id = window.requestAnimationFrame(() => setShown(target));\n      return () => window.cancelAnimationFrame(id);\n    }\n    const start = from.current;\n    let raf = 0;\n    let t0 = 0;\n    const tick = (t: number) => {\n      if (!t0) t0 = t;\n      const k = Math.min(1, (t - t0) / ms);\n      const e = 1 - Math.pow(1 - k, 3);\n      const v = start + (target - start) * e;\n      from.current = v;\n      setShown(v);\n      if (k < 1) raf = window.requestAnimationFrame(tick);\n    };\n    raf = window.requestAnimationFrame(tick);\n    return () => window.cancelAnimationFrame(raf);\n  }, [target, ms]);\n  return shown;\n}\n\nexport function ComparisonCalculator({\n  eyebrow = \"Pricing calculator\",\n  title = \"See what your support stack really costs\",\n  subtitle = \"Move the sliders to match your team. Competitor prices come from their public pricing pages in October 2026.\",\n  product = defaultProduct,\n  competitors = defaultCompetitors,\n  value,\n  defaultValue = { seats: 24, contacts: 60, annual: true },\n  onChange,\n  maxSeats = 200,\n  maxContacts = 250,\n  cta = { label: \"Start a free trial\", href: \"#\" },\n  accent = \"#ff5a36\",\n  className = \"\",\n  style,\n  ...rest\n}: ComparisonCalculatorProps) {\n  const uid = React.useId();\n  const [inner, setInner] = React.useState(defaultValue);\n  const v = value ?? inner;\n\n  const ours = monthly(product, v);\n  const theirs = competitors.map((c) => monthly(c, v));\n  const cheapest = theirs.length ? Math.min(...theirs) : ours;\n  const savings = Math.max(0, (cheapest - ours) * 12);\n  const max = Math.max(ours, ...theirs, 1);\n  const shownSavings = useTween(savings);\n\n  function update(patch: Partial<ComparisonCalculatorValue>) {\n    const next = { ...v, ...patch };\n    if (value === undefined) setInner(next);\n    const nOurs = monthly(product, next);\n    const nTheirs = competitors.map((c) => monthly(c, next));\n    const nCheap = nTheirs.length ? Math.min(...nTheirs) : nOurs;\n    onChange?.(next, Math.max(0, (nCheap - nOurs) * 12));\n  }\n\n  const cols = [{ plan: product, cost: ours, us: true }, ...competitors.map((c, i) => ({ plan: c, cost: theirs[i]!, us: false }))];\n\n  return (\n    <section className={`hb-yh3 ${className}`} style={{ \"--hb-yh3-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-comparison-calculator\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"hb-yh3-in\">\n        <header className=\"hb-yh3-head\">\n          <div>\n            <span className=\"hb-yh3-eyebrow\">{eyebrow}</span>\n            <h2 className=\"hb-yh3-title\">{title}</h2>\n          </div>\n          {subtitle && <p className=\"hb-yh3-sub\">{subtitle}</p>}\n        </header>\n        <div className=\"hb-yh3-grid\">\n          <div className=\"hb-yh3-card\">\n            <div className=\"hb-yh3-field\">\n              <div className=\"hb-yh3-lab\">\n                <label htmlFor={`${uid}-seats`}>Support agents</label>\n                <span className=\"hb-yh3-out\" aria-hidden=\"true\">\n                  {v.seats}\n                  <small>seats</small>\n                </span>\n              </div>\n              <p className=\"hb-yh3-hint\">People who answer conversations</p>\n              <input\n                id={`${uid}-seats`}\n                className=\"hb-yh3-range\"\n                type=\"range\"\n                min={1}\n                max={maxSeats}\n                value={v.seats}\n                aria-valuetext={`${v.seats} seats`}\n                onChange={(e) => update({ seats: Number(e.target.value) })}\n                style={{ \"--hb-yh3-p\": (((v.seats - 1) / Math.max(1, maxSeats - 1)) * 100).toFixed(2) } as React.CSSProperties}\n              />\n              <div className=\"hb-yh3-ticks\" aria-hidden=\"true\">\n                <span>1</span>\n                <span>{Math.round(maxSeats / 2)}</span>\n                <span>{maxSeats}</span>\n              </div>\n            </div>\n            <div className=\"hb-yh3-field\">\n              <div className=\"hb-yh3-lab\">\n                <label htmlFor={`${uid}-contacts`}>Monthly active contacts</label>\n                <span className=\"hb-yh3-out\" aria-hidden=\"true\">\n                  {v.contacts}k\n                  <small>contacts</small>\n                </span>\n              </div>\n              <p className=\"hb-yh3-hint\">Customers who start a conversation</p>\n              <input\n                id={`${uid}-contacts`}\n                className=\"hb-yh3-range\"\n                type=\"range\"\n                min={1}\n                max={maxContacts}\n                value={v.contacts}\n                aria-valuetext={`${v.contacts} thousand contacts`}\n                onChange={(e) => update({ contacts: Number(e.target.value) })}\n                style={{ \"--hb-yh3-p\": (((v.contacts - 1) / Math.max(1, maxContacts - 1)) * 100).toFixed(2) } as React.CSSProperties}\n              />\n              <div className=\"hb-yh3-ticks\" aria-hidden=\"true\">\n                <span>1k</span>\n                <span>{Math.round(maxContacts / 2)}k</span>\n                <span>{maxContacts}k</span>\n              </div>\n            </div>\n            <div className=\"hb-yh3-seg\" role=\"group\" aria-label=\"Billing period\" data-annual={v.annual ? \"true\" : \"false\"}>\n              <span className=\"hb-yh3-pill\" aria-hidden=\"true\" />\n              <button type=\"button\" className=\"hb-yh3-opt\" aria-pressed={!v.annual} onClick={() => update({ annual: false })}>\n                Monthly\n              </button>\n              <button type=\"button\" className=\"hb-yh3-opt\" aria-pressed={v.annual} onClick={() => update({ annual: true })}>\n                Yearly<em>save {Math.round((product.annualDiscount ?? 0) * 100)}%</em>\n              </button>\n            </div>\n          </div>\n          <div className=\"hb-yh3-card hb-yh3-res\">\n            <div className=\"hb-yh3-save\">\n              <div>\n                <div className=\"hb-yh3-sl\">You save at least, per year</div>\n                <div className=\"hb-yh3-sv\" aria-live=\"polite\">\n                  <span>{money(shownSavings)}</span>\n                </div>\n              </div>\n              {cta && (\n                <a href={cta.href} className=\"hb-yh3-cta\">\n                  {cta.label}\n                </a>\n              )}\n            </div>\n            <div className=\"hb-yh3-chart\" style={{ \"--hb-yh3-n\": cols.length } as React.CSSProperties} role=\"list\" aria-label=\"Monthly cost by product\">\n              {cols.map((c) => (\n                <div key={c.plan.name} className=\"hb-yh3-col\" data-us={c.us ? \"true\" : \"false\"} role=\"listitem\">\n                  <span className=\"hb-yh3-amt\">\n                    {money(c.cost)}\n                    <small> /mo</small>\n                  </span>\n                  <span className=\"hb-yh3-bar\" style={{ \"--hb-yh3-h\": ((c.cost / max) * 100).toFixed(2) } as React.CSSProperties} aria-hidden=\"true\" />\n                  <span className=\"hb-yh3-name\">\n                    <i aria-hidden=\"true\" />\n                    {c.plan.name}\n                  </span>\n                </div>\n              ))}\n            </div>\n            <p className=\"hb-yh3-note\">Compared with the cheapest alternative for the same seats and contacts. Taxes not included.</p>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}