{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"add-to-cart","type":"registry:component","title":"Add to cart","description":"One call throws the product into the cart on a real arc; it drops in below the rim and the cart dips with the weight.","author":"Hairline UI","dependencies":[],"files":[{"path":"registry/add-to-cart.tsx","type":"registry:component","content":"// Hairline UI · add-to-cart · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\n/* ─────────────────────────────────────────────────────────\n * ADD TO CART: throw it in\n *\n * One call: `await throwToCart(productImage, cartButton)`. A\n * copy of the image lifts off as a small rounded print and is\n * tossed on a real arc (even sideways speed, gravity on the way\n * down), tilting with its speed. Over the cart it drops in\n * below the rim, as into a bag, and the cart takes the weight:\n * it dips the way it was hit and springs back. The promise\n * resolves as the print disappears into it, while the cart is\n * still dipping, so your count goes up as the item lands.\n *\n * Your page is untouched: the product stays where it is, the\n * cart's state and badge are yours, and quick repeat throws\n * just stack (each dip adds to the last). Works for anything\n * thrown somewhere: save to a collection, add to a playlist,\n * move to a folder.\n * ───────────────────────────────────────────────────────── */\n\nimport { springFrames } from \"./ui-interaction-motion\";\nimport { playSound } from \"./ui-sounds\";\n\nexport interface ThrowToCartOptions {\n  /** Size of the print in flight, on its longer side, in px. Default: fits the cart, between 44 and 72. */\n  size?: number;\n  /** Where the cart's opening is, as a share of its height from the top. The print drops in below this line. */\n  rim?: number;\n  /** Play a soft knock when it lands (synthesised, no files). */\n  sound?: boolean;\n}\n\ntype Point = { x: number; y: number };\n\nconst clamp = (n: number, lo: number, hi: number) => (n < lo ? lo : n > hi ? hi : n);\nconst easeOut = (t: number) => 1 - (1 - clamp(t, 0, 1)) ** 3;\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\nlet layer: HTMLDivElement | null = null;\nfunction topLayer() {\n  if (layer && layer.isConnected) return layer;\n  layer = document.createElement(\"div\");\n  layer.setAttribute(\"aria-hidden\", \"true\");\n  layer.style.cssText = \"position:fixed;inset:0;pointer-events:none;z-index:2147483000;contain:layout style;\";\n  document.body.appendChild(layer);\n  return layer;\n}\n\nfunction reducedMotion() {\n  return !!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n/** The cart takes the weight: a dip along the throw's direction that springs back, added to whatever else it's doing. */\nfunction dip(target: HTMLElement, direction: Point) {\n  const length = Math.hypot(direction.x, direction.y) || 1;\n  const dx = (direction.x / length) * 0.45, dy = Math.max(0.55, direction.y / length);\n  const frames = springFrames(0, 0, 0.13, 760, { omega: 19, damping: 0.4, steps: 48 });\n  target.animate(\n    frames.map(({ value, offset }) => ({\n      offset,\n      transform: `translate(${(value * dx).toFixed(2)}px, ${(value * dy).toFixed(2)}px) scale(${(1 - value * 0.012).toFixed(4)}, ${(1 - value * 0.016).toFixed(4)})`,\n    })),\n    { duration: 760, composite: \"add\" },\n  );\n}\n\n/**\n * Throws a copy of `source` (a product image, a card) into `target` (the cart button). Resolves when it lands in the\n * cart; update your count then.\n */\nexport function throwToCart(source: HTMLElement | null | undefined, target: HTMLElement | null | undefined, options: ThrowToCartOptions = {}): Promise<void> {\n  if (!source || !target || typeof window === \"undefined\" || reducedMotion()) return Promise.resolve();\n\n  const S = source.getBoundingClientRect();\n  const T0 = target.getBoundingClientRect();\n  const rimShare = options.rim ?? 0.38;\n  const W = source.offsetWidth || S.width, H = source.offsetHeight || S.height;\n  const long = Math.max(W, H);\n  const print = options.size ?? clamp(Math.min(T0.width, T0.height) * 1.5, 44, 72);\n  const small = print / long; // scale of the print in flight\n  const sx = window.scrollX, sy = window.scrollY;\n  const computed = getComputedStyle(source);\n  const corner = parseFloat(computed.borderTopLeftRadius) || 0;\n\n  // The print: a copy of the element, kept at its own size and scaled, so it stays sharp at every step.\n  const clip = document.createElement(\"div\"); // a full-screen window whose bottom is the cart's rim, once it's dropping in\n  clip.style.cssText = \"position:absolute;inset:0;\";\n  const card = document.createElement(\"div\");\n  card.style.cssText = `position:absolute;left:0;top:0;width:${W}px;height:${H}px;overflow:hidden;transform-origin:50% 50%;will-change:transform;`;\n  const copy = source.cloneNode(true) as HTMLElement;\n  copy.removeAttribute(\"id\");\n  copy.querySelectorAll(\"[id]\").forEach((n) => n.removeAttribute(\"id\"));\n  copy.setAttribute(\"inert\", \"\");\n  copy.style.cssText += \";position:absolute;inset:0;width:100%;height:100%;margin:0;transform:none;translate:none;scale:none;rotate:none;opacity:1;visibility:visible;animation:none;transition:none;\";\n  const edge = document.createElement(\"div\");\n  edge.style.cssText = \"position:absolute;inset:0;border-radius:inherit;pointer-events:none;\";\n  card.append(copy, edge);\n  clip.appendChild(card);\n  topLayer().appendChild(clip);\n\n  const start: Point = { x: S.left + S.width / 2, y: S.top + S.height / 2 };\n  const distance = Math.hypot(T0.left + T0.width / 2 - start.x, T0.top + T0.height / 2 - start.y);\n  const total = clamp(600 + distance * 0.42, 680, 1000);\n  const shrinkEnd = 0.36 * total; // the print comes off the page...\n  const flyStart = 0.16 * total; // ...and is already on its way before it's done\n\n  return new Promise<void>((resolve) => {\n    const began = performance.now();\n    let caught = false, dropping = false, last: Point | null = null, angle = 0;\n\n    const frame = (now: number) => {\n      const t = now - began;\n      // Everything follows the page: the throw starts where the product is now and lands where the cart is now.\n      const T = target.getBoundingClientRect();\n      const ox = sx - window.scrollX, oy = sy - window.scrollY;\n      const lift = easeOut(t / shrinkEnd);\n      const from: Point = { x: start.x + ox, y: start.y + oy - 12 * lift };\n      const rimY = T.top + T.height * rimShare;\n      const landScale = small * clamp((T.width * 0.7) / print, 0.45, 1);\n      const to: Point = { x: T.left + T.width / 2, y: rimY + (H * landScale) * 0.62 };\n      // A projectile: a parabola with even sideways speed, peaking just above the higher end, so it stays on screen even\n      // when the cart sits at the top of the page.\n      const apex = Math.min(from.y, to.y) - clamp(Math.abs(to.x - from.x) * 0.12 + 22, 28, 72);\n      const control: Point = { x: (from.x + to.x) / 2, y: 2 * apex - (from.y + to.y) / 2 };\n      const u = clamp((t - flyStart) / (total - flyStart), 0, 1);\n      const pos: Point = {\n        x: (1 - u) ** 2 * from.x + 2 * (1 - u) * u * control.x + u * u * to.x,\n        y: (1 - u) ** 2 * from.y + 2 * (1 - u) * u * control.y + u * u * to.y,\n      };\n      const scale = lerp(lerp(1, small, lift), landScale, easeOut((u - 0.45) / 0.55));\n      // The print leans with its speed: nose up as it rises, tipping over as it falls.\n      if (last) {\n        const vx = pos.x - last.x, vy = pos.y - last.y;\n        if (Math.hypot(vx, vy) > 0.4) {\n          const heading = (Math.atan2(vy, Math.abs(vx) + 0.001) * 180) / Math.PI;\n          angle = lerp(angle, clamp(heading * 0.32 * Math.sign(to.x - from.x || 1), -24, 24), 0.35);\n          // No lean while it is still big over the product: only once it has come off as a print.\n        }\n      }\n      const lean = angle * lift * lift;\n      const s = Math.max(scale, 0.01);\n      card.style.borderRadius = `${(lerp(corner, Math.min(10, print * 0.18), lift) / s).toFixed(2)}px`;\n      // A thin paper edge, like a photo print, so it reads as an object, not a hole in the page.\n      edge.style.boxShadow = `inset 0 0 0 ${((2 * lift) / s).toFixed(2)}px rgb(255 255 255 / 0.92)`;\n      card.style.transform = `translate3d(${(pos.x - W / 2).toFixed(2)}px, ${(pos.y - H / 2).toFixed(2)}px, 0) rotate(${lean.toFixed(2)}deg) scale(${scale.toFixed(4)})`;\n\n      // On the way down, once the whole print is above the cart's rim, the rim starts hiding what passes below it.\n      const descending = last !== null && pos.y > last.y;\n      if (!dropping && descending && pos.y + (H * scale) / 2 < rimY && u > 0.5) dropping = true;\n      if (dropping) clip.style.clipPath = `inset(0 0 ${Math.max(0, window.innerHeight - rimY).toFixed(2)}px 0)`;\n      if (!caught && (dropping || u > 0.9) && pos.y >= rimY) {\n        caught = true;\n        if (options.sound) playSound(\"drop\", 0.45);\n        dip(target, { x: to.x - control.x, y: to.y - control.y });\n      }\n      last = pos;\n      if (u < 1) {\n        requestAnimationFrame(frame);\n        return;\n      }\n      clip.remove();\n      if (layer && !layer.childElementCount) {\n        layer.remove();\n        layer = null;\n      }\n      // Resolve once it is all the way in, with the dip already playing, so whatever your app renders next can never\n      // freeze a half-sunk print on screen.\n      resolve();\n    };\n    requestAnimationFrame(frame);\n  });\n}\n"},{"path":"registry/ui-interaction-motion.ts","type":"registry:component","content":"// Hairline UI · add-to-cart · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n'use client';\n\nimport * as React from 'react';\n\nexport const EASE_OUT = 'cubic-bezier(0.16, 1, 0.3, 1)';\nexport const EASE_SETTLE = 'cubic-bezier(0.22, 1.18, 0.36, 1)';\n/** Thrown things (indicators, thumbs): a slight overshoot on transform only. */\nexport const EASE_THROW = 'cubic-bezier(0.34, 1.36, 0.64, 1)';\n/**\n * The press every button primitive shares: a 3% give that eases in and settles back.\n * Tailwind v4's scale-* writes the `scale` property, so `scale` has to be in the list\n * or the press snaps.\n */\nexport const INTERACTION_PRESS =\n  'transition-[background-color,color,box-shadow,opacity,scale] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)] active:scale-[0.97] motion-reduce:transition-none motion-reduce:active:scale-100';\nexport const INTERACTION_FOCUS ='focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background';\n\nconst query = '(prefers-reduced-motion: reduce)';\nconst subscribe = (notify: () => void) => {\n  const media = window.matchMedia(query);\n  media.addEventListener('change', notify);\n  return () => media.removeEventListener('change', notify);\n};\nexport const useInteractionReducedMotion = () => React.useSyncExternalStore(subscribe, () => window.matchMedia(query).matches, () => false);\n\nexport function useInteractionActivity<T extends Element>() {\n  const ref = React.useRef<T>(null);\n  const [visible, setVisible] = React.useState(false);\n  const [hidden, setHidden] = React.useState(false);\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const observer = new IntersectionObserver(([entry]) => setVisible(entry.isIntersecting));\n    observer.observe(el);\n    const visibility = () => setHidden(document.hidden);\n    visibility(); document.addEventListener('visibilitychange', visibility);\n    return () => { observer.disconnect(); document.removeEventListener('visibilitychange', visibility); };\n  }, []);\n  return { ref, active: visible && !hidden };\n}\n\nexport function interactionIcon(on: boolean, reduced: boolean): React.CSSProperties {\n  return { opacity: on ? 1 : 0, transform: on ? 'none' : 'scale(0.6)', filter: on ? 'blur(0px)' : 'blur(3px)', transition: reduced ? 'none' : `opacity 220ms ${EASE_OUT}, transform 380ms ${EASE_OUT}, filter 220ms ${EASE_OUT}` };\n}\n\n/** A raised object: one tight contact shadow, one short ambient, a hairline of light on its top edge. */\nexport const MATERIAL_LIFT =\n  'shadow-[0_1px_1.5px_rgb(0_0_0/0.07),0_3px_8px_-2px_rgb(0_0_0/0.1),inset_0_0.5px_0_rgb(255_255_255/0.8)] dark:shadow-[0_1px_2px_rgb(0_0_0/0.5),0_4px_10px_-2px_rgb(0_0_0/0.35),inset_0_0.5px_0_rgb(255_255_255/0.1)]';\n/** A trough something sits in, shaded from above, lit along its bottom edge. */\nexport const MATERIAL_RECESS =\n  'shadow-[inset_0_1px_2.5px_rgb(0_0_0/0.09),inset_0_-0.5px_0_rgb(255_255_255/0.7)] dark:shadow-[inset_0_1px_3px_rgb(0_0_0/0.45),inset_0_-0.5px_0_rgb(255_255_255/0.07)]';\n\nexport type SpringConfig = { stiffness: number; damping: number; mass?: number };\nexport interface Spring {\n  get(): number;\n  getVelocity(): number;\n  getTarget(): number;\n  /** Aim somewhere new from wherever it is now, keeping its speed. */\n  set(target: number): void;\n  /** Add speed (units per second), on top of what it already has. */\n  push(velocity: number): void;\n  /** Be there now, at rest. */\n  jump(value: number): void;\n  configure(config: SpringConfig): void;\n  stop(): void;\n}\n\n// Every moving spring on the page shares one frame loop, which sleeps when the last one rests. Each spring's onFrame runs\n// once per frame after all of them have stepped, so several springs that draw one shape paint it once.\nconst SPRING_STEP = 1 / 240;\ntype Running = { step: () => void };\nconst runningSprings = new Set<Running>();\nconst springPainters = new Set<() => void>();\nlet springFrame = 0;\nlet springLast = 0;\nlet springSpare = 0;\n\nfunction springTick(now: number) {\n  // A hidden tab stops the frames, so the first one back must not count the whole gap as time passed.\n  springSpare += Math.min((now - springLast) / 1000, 0.05);\n  springLast = now;\n  while (springSpare >= SPRING_STEP) {\n    runningSprings.forEach((spring) => spring.step());\n    springSpare -= SPRING_STEP;\n  }\n  const painters = [...springPainters];\n  springPainters.clear();\n  painters.forEach((paint) => paint());\n  springFrame = runningSprings.size ? requestAnimationFrame(springTick) : 0;\n}\n\nfunction wakeSprings(spring: Running) {\n  runningSprings.add(spring);\n  if (springFrame) return;\n  springSpare = 0;\n  springFrame = requestAnimationFrame((now) => {\n    springLast = now - 1000 / 60;\n    springTick(now);\n  });\n}\n\n/**\n * A spring that carries its speed: re-aim it mid-flight and it curves on from where it is, push it while it swings and the\n * push adds to the swing. Use it for anything that can be interrupted; a curve restarts from a standstill every time.\n * `onFrame` should write straight to the DOM. `precision` is how close counts as there, in the value's own units.\n */\nexport function createSpring(initial: number, config: SpringConfig, onFrame: () => void, precision = 0.01): Spring {\n  let value = initial;\n  let velocity = 0;\n  let target = initial;\n  let { stiffness, damping, mass = 1 } = config;\n  const running: Running = {\n    step() {\n      velocity += ((-stiffness * (value - target) - damping * velocity) / mass) * SPRING_STEP;\n      value += velocity * SPRING_STEP;\n      if (Math.abs(value - target) < precision && Math.abs(velocity) < precision * 10) {\n        value = target;\n        velocity = 0;\n        runningSprings.delete(running);\n      }\n      springPainters.add(onFrame);\n    },\n  };\n  return {\n    get: () => value,\n    getVelocity: () => velocity,\n    getTarget: () => target,\n    set(next) {\n      if (next === target && !runningSprings.has(running)) return;\n      target = next;\n      wakeSprings(running);\n    },\n    push(speed) {\n      velocity += speed;\n      wakeSprings(running);\n    },\n    jump(next) {\n      value = next;\n      target = next;\n      velocity = 0;\n      runningSprings.delete(running);\n      onFrame();\n    },\n    configure(next) {\n      ({ stiffness, damping, mass = 1 } = next);\n    },\n    stop() {\n      runningSprings.delete(running);\n    },\n  };\n}\n\n/** Sample recent movement rather than averaging a long drag and losing its release velocity. */\nexport type PointerSample = { x: number; time: number };\nexport function samplePointer(samples: PointerSample[], x: number, time: number) {\n  samples.push({ x, time });\n  while (samples.length > 2 && time - samples[0].time > 100) samples.shift();\n}\nexport function releaseVelocity(samples: PointerSample[], now: number) {\n  if (samples.length < 2 || now - samples[samples.length - 1].time > 100) return 0;\n  const first = samples[0], last = samples[samples.length - 1];\n  return (last.x - first.x) / Math.max(1, last.time - first.time);\n}\n\n/** Smooth Apple/rational rubber-band curve: continuous exponential-like resistance without linear kinks. */\nexport function rubberBand(overshoot: number, dimension = 320, constant = 0.55): number {\n  const d = dimension || 320;\n  const abs = Math.abs(overshoot);\n  return Math.sign(overshoot) * (1 - 1 / ((abs * constant) / d + 1)) * d;\n}\n\n/** Projects resting travel from release velocity (velocity in px/ms; time in seconds). */\nexport function projectInertia(distance: number, velocity: number, time = 0.12): number {\n  return distance + velocity * 1000 * time;\n}\n\n/** Smooths incoming release velocity toward a boundary so springs don't slam or clip into walls. */\nexport function softenVelocity(velocity: number, distanceToTarget: number, factor = 10): number {\n  const maxAllowed = Math.abs(distanceToTarget) * factor;\n  return Math.sign(velocity) * Math.min(Math.abs(velocity), maxAllowed);\n}\n\n/** A damped spring sampled by WAAPI: tuned for organic lightness with a hint of life (3% breath). */\nexport function springFrames(\n  from: number,\n  to: number,\n  velocity = 0,\n  duration = 480,\n  config: { omega?: number; damping?: number; steps?: number } = {},\n) {\n  const { omega = 16, damping = 0.74, steps = 36 } = config;\n  const damped = omega * Math.sqrt(Math.max(0.001, 1 - damping * damping));\n  const displacement = from - to;\n  const coefficient = (velocity * 1000 + damping * omega * displacement) / damped;\n  return Array.from({ length: steps + 1 }, (_, i) => {\n    const t = (i / steps) * (duration / 1000);\n    const value = to + Math.exp(-damping * omega * t) * (displacement * Math.cos(damped * t) + coefficient * Math.sin(damped * t));\n    return { value: i === steps ? to : value, offset: i / steps };\n  });\n}\n\n"},{"path":"registry/ui-sounds.ts","type":"registry:component","content":"// Hairline UI · add-to-cart · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n/* ─────────────────────────────────────────────────────────\n * UI SOUNDS: small interface sounds, made in code\n *\n * No files and nothing to license: every sound is built from a\n * tone or a burst of noise with the Web Audio API the moment it\n * plays. They're short and quiet, made to sit under an interface,\n * and components only play them when you pass `sound`.\n *\n *   fold     paper creasing: two short crisp bursts\n *   unfold   paper opening: a soft rising sweep\n *   drop     something small landing: a low, soft knock\n *   tick     a light click\n *   pop      a quick bright blip\n *   success  two soft rising notes\n *   error    two low falling notes\n *\n * Browsers only start audio after the visitor has pressed\n * something on the page, so a sound before that stays silent.\n * ───────────────────────────────────────────────────────── */\n\nexport type UiSound = \"fold\" | \"unfold\" | \"drop\" | \"tick\" | \"pop\" | \"success\" | \"error\";\n\nlet context: AudioContext | null = null;\nlet noise: AudioBuffer | null = null;\n\nfunction audio() {\n  if (typeof window === \"undefined\") return null;\n  if (!context) {\n    const Ctx = window.AudioContext ?? (window as unknown as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n    if (!Ctx) return null;\n    context = new Ctx();\n  }\n  if (context.state === \"suspended\") void context.resume().catch(() => {});\n  return context;\n}\n\nfunction noiseBuffer(ctx: AudioContext) {\n  if (noise && noise.sampleRate === ctx.sampleRate) return noise;\n  noise = ctx.createBuffer(1, Math.floor(ctx.sampleRate * 0.5), ctx.sampleRate);\n  const data = noise.getChannelData(0);\n  for (let i = 0; i < data.length; i++) data[i] = Math.random() * 2 - 1;\n  return noise;\n}\n\n/** A burst of filtered noise. */\nfunction burst(ctx: AudioContext, out: AudioNode, at: number, length: number, { type = \"bandpass\", from = 2000, to = from, q = 0.9, level = 0.5 }: { type?: BiquadFilterType; from?: number; to?: number; q?: number; level?: number }) {\n  const src = ctx.createBufferSource();\n  src.buffer = noiseBuffer(ctx);\n  const filter = ctx.createBiquadFilter();\n  filter.type = type;\n  filter.Q.value = q;\n  filter.frequency.setValueAtTime(from, at);\n  filter.frequency.exponentialRampToValueAtTime(Math.max(40, to), at + length);\n  const gain = ctx.createGain();\n  gain.gain.setValueAtTime(0.0001, at);\n  gain.gain.exponentialRampToValueAtTime(level, at + Math.min(0.012, length / 3));\n  gain.gain.exponentialRampToValueAtTime(0.0001, at + length);\n  src.connect(filter).connect(gain).connect(out);\n  src.start(at, Math.random() * 0.3, length + 0.02);\n}\n\n/** A tone that glides from one pitch to another. */\nfunction tone(ctx: AudioContext, out: AudioNode, at: number, length: number, { type = \"sine\", from, to = from, level = 0.4 }: { type?: OscillatorType; from: number; to?: number; level?: number }) {\n  const osc = ctx.createOscillator();\n  osc.type = type;\n  osc.frequency.setValueAtTime(from, at);\n  osc.frequency.exponentialRampToValueAtTime(Math.max(20, to), at + length);\n  const gain = ctx.createGain();\n  gain.gain.setValueAtTime(0.0001, at);\n  gain.gain.exponentialRampToValueAtTime(level, at + 0.006);\n  gain.gain.exponentialRampToValueAtTime(0.0001, at + length);\n  osc.connect(gain).connect(out);\n  osc.start(at);\n  osc.stop(at + length + 0.02);\n}\n\n/** Plays one sound. `volume` is 0 to 1; the default sits quietly under an interface. */\nexport function playSound(name: UiSound, volume = 0.5) {\n  const ctx = audio();\n  if (!ctx) return;\n  const out = ctx.createGain();\n  out.gain.value = Math.max(0, Math.min(1, volume)) * 0.5;\n  out.connect(ctx.destination);\n  const t = ctx.currentTime + 0.005;\n  switch (name) {\n    case \"fold\":\n      burst(ctx, out, t, 0.05, { type: \"highpass\", from: 2600, q: 0.7, level: 0.45 });\n      burst(ctx, out, t + 0.07, 0.07, { type: \"bandpass\", from: 3200, to: 1800, q: 1.2, level: 0.35 });\n      break;\n    case \"unfold\":\n      burst(ctx, out, t, 0.16, { type: \"bandpass\", from: 900, to: 2800, q: 0.8, level: 0.3 });\n      break;\n    case \"drop\":\n      tone(ctx, out, t, 0.12, { from: 180, to: 70, level: 0.55 });\n      burst(ctx, out, t, 0.03, { type: \"lowpass\", from: 1200, q: 0.5, level: 0.2 });\n      break;\n    case \"tick\":\n      tone(ctx, out, t, 0.025, { type: \"triangle\", from: 1900, to: 1500, level: 0.25 });\n      break;\n    case \"pop\":\n      tone(ctx, out, t, 0.06, { from: 620, to: 980, level: 0.3 });\n      break;\n    case \"success\":\n      tone(ctx, out, t, 0.11, { from: 660, level: 0.22 });\n      tone(ctx, out, t + 0.09, 0.16, { from: 990, level: 0.22 });\n      break;\n    case \"error\":\n      tone(ctx, out, t, 0.12, { type: \"triangle\", from: 330, level: 0.25 });\n      tone(ctx, out, t + 0.1, 0.18, { type: \"triangle\", from: 247, level: 0.25 });\n      break;\n  }\n  window.setTimeout(() => out.disconnect(), 600);\n}\n"}],"css":{},"docs":"Docs and live preview: https://hairlineui.com/ui/add-to-cart. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}