{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "application-15",
  "title": "CRM overview",
  "description": "A Pebblecrest CRM start page: three figures that count up once, accounts and contacts as one graph whose nodes glide between five layouts (cluster, rings, grid, orbit, radial), the agent's recent runs with a request that waits for Allow or Deny, a to-do list, a pipeline funnel that reshapes when the agent qualifies leads, the trend of new leads and the next 14 days, with sections that open from the sidebar, a sheet on phones. Plug your CRM into onTaskChange, onApprove and onDeny.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/checkbox.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/inline-sheet.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/run-session.json",
    "https://ui.ndekocode.dev/r/seeded.json",
    "https://ui.ndekocode.dev/r/segments.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-is-narrow.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json",
    "https://ui.ndekocode.dev/r/words.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/templates/dashboards/application-15/index.tsx",
      "content": "'use client';\n\nimport { useRef, useState } from 'react';\n\nimport { useIsNarrow } from '@/registry/ndeko/hooks/use-is-narrow';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { InlineSheet } from '@/registry/ndeko/ui/inline-sheet';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\n\nimport { AccountGraph } from './account-graph';\nimport { AgentRuns } from './agent-runs';\nimport { AppSidebar } from './app-sidebar';\nimport type { RunId, SectionId } from './data';\nimport { DayStrip } from './day-strip';\nimport { FigureBand } from './figure-band';\nimport type { LayoutId } from './graph-layouts';\nimport { LeadTrend } from './lead-trend';\nimport { PageHeader } from './page-header';\nimport { PipelineFunnel } from './pipeline-funnel';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  openTaskCount,\n  reducer,\n  RESTING,\n  SCRIPT,\n  type Decision,\n} from './session';\nimport { TodoList } from './todo-list';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** The width of the `@3xl` container variant: under it the sections live in a sheet. */\nconst SHEET_BELOW_REM = 48;\n\nconst SCROLL_MARGIN_PX = 16;\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\n/** Nothing calls a network. A real CRM plugs in here: a task a person ticks, and their answer to a request of the agent. */\nexport type Application15Props = {\n  onTaskChange?: (id: string, isDone: boolean) => void;\n  onApprove?: () => void;\n  onDeny?: () => void;\n};\n\nexport default function Application15({\n  onTaskChange,\n  onApprove,\n  onDeny,\n}: Application15Props) {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const scrollerRef = useRef<HTMLDivElement>(null);\n  const [activeId, setActiveId] = useState<SectionId>('overview');\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const isNarrow = useIsNarrow(ref, SHEET_BELOW_REM);\n  const isSheetShown = isNarrow && state.isSidebarOpen;\n  const canReplay = isFinished && !isAutoplaying;\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const openCount = openTaskCount(state);\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  function scrollToSection(id: SectionId) {\n    const scroller = scrollerRef.current;\n    const target = ref.current?.querySelector<HTMLElement>(\n      `[data-section=\"${id}\"]`\n    );\n    if (!scroller || !target) {\n      return;\n    }\n    const scrollerTop = scroller.getBoundingClientRect().top;\n    const targetTop = target.getBoundingClientRect().top;\n    const offset = targetTop - scrollerTop + scroller.scrollTop;\n    const top = Math.max(offset - SCROLL_MARGIN_PX, 0);\n    const behavior = scrollBehaviorOf(shouldReduceMotion);\n    scroller.scrollTo({ top, behavior });\n  }\n\n  function navigate(id: SectionId) {\n    setActiveId(id);\n    scrollToSection(id);\n    if (isSheetShown) {\n      closeSidebar();\n    }\n  }\n\n  function openSidebar() {\n    act({ type: 'sidebar', isOpen: true });\n    focusLater('[data-sheet-close=\"sections\"]');\n  }\n\n  function closeSidebar() {\n    act({ type: 'sidebar', isOpen: false });\n    focusLater('[data-menu-open]');\n  }\n\n  function changeLayout(layout: LayoutId) {\n    act({ type: 'layoutSet', layout });\n  }\n\n  function selectNode(id: string) {\n    if (state.selectedId === id) {\n      act({ type: 'nodeSelected', id: null });\n      return;\n    }\n    act({ type: 'nodeSelected', id });\n  }\n\n  function clearNode() {\n    act({ type: 'nodeSelected', id: null });\n  }\n\n  function selectDay(index: number) {\n    if (state.dayIndex === index) {\n      act({ type: 'daySelected', index: null });\n      return;\n    }\n    act({ type: 'daySelected', index });\n  }\n\n  function toggleTask(id: string) {\n    const wasDone = state.doneTaskIds.includes(id);\n    act({ type: 'taskToggled', id });\n    onTaskChange?.(id, !wasDone);\n  }\n\n  /** The two buttons leave the row, so the focus goes to the row, which now says what was decided. */\n  function decide(id: RunId, decision: Decision) {\n    act({ type: 'decided', id, decision });\n    focusLater(`[data-run=\"${id}\"]`);\n    if (decision === 'denied') {\n      onDeny?.();\n      return;\n    }\n    onApprove?.();\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-sidebar text-foreground @container min-h-dvh w-full'\n      >\n        <div className='relative flex h-dvh min-h-[40rem] overflow-hidden'>\n          <div inert={isSheetShown} className='flex min-w-0 flex-1 @3xl:p-2'>\n            <aside\n              aria-label='Sections'\n              className='hidden w-56 shrink-0 pe-2 @3xl:flex'\n            >\n              {!isNarrow && (\n                <AppSidebar activeId={activeId} onNavigate={navigate} />\n              )}\n            </aside>\n            <main className='bg-background @3xl:hairline-ring @3xl:ring-border flex min-w-0 flex-1 flex-col overflow-hidden @3xl:rounded-xl @3xl:shadow-[0_1px_2px_rgb(0_0_0/0.04)]'>\n              <PageHeader\n                canReplay={canReplay}\n                onReplay={restart}\n                onOpenMenu={openSidebar}\n              />\n              <div\n                ref={scrollerRef}\n                className='@container/page min-h-0 flex-1 overflow-y-auto'\n              >\n                <div className='mx-auto flex w-full max-w-6xl flex-col gap-4 px-3 pt-1 pb-6 @3xl/page:px-4'>\n                  <div className='grid gap-4 @4xl/page:grid-cols-[minmax(0,1fr)_21rem]'>\n                    <div className='flex min-w-0 flex-col gap-4'>\n                      <FigureBand isLoaded={state.isLoaded} />\n                      <AccountGraph\n                        layout={state.layout}\n                        selectedId={state.selectedId}\n                        pressed={pressed}\n                        isActive={isInView}\n                        onLayoutChange={changeLayout}\n                        onSelect={selectNode}\n                        onClear={clearNode}\n                      />\n                    </div>\n                    <div className='flex min-w-0 flex-col gap-4'>\n                      <AgentRuns\n                        runs={state.runs}\n                        pressed={pressed}\n                        onDecide={decide}\n                      />\n                      <TodoList\n                        taskIds={state.taskIds}\n                        doneTaskIds={state.doneTaskIds}\n                        openCount={openCount}\n                        pressed={pressed}\n                        onToggle={toggleTask}\n                      />\n                    </div>\n                  </div>\n                  <div className='grid gap-4 @2xl/page:grid-cols-2'>\n                    <PipelineFunnel counts={state.stageCounts} />\n                    <LeadTrend />\n                  </div>\n                  <DayStrip\n                    dayIndex={state.dayIndex}\n                    pressed={pressed}\n                    onSelect={selectDay}\n                  />\n                </div>\n              </div>\n            </main>\n          </div>\n\n          <InlineSheet\n            name='sections'\n            label='Sections of the overview'\n            closeLabel='Close the sections'\n            side='start'\n            isOpen={isSheetShown}\n            className='@3xl:hidden'\n            panelClassName='bg-sidebar gap-1 p-3'\n            onClose={closeSidebar}\n          >\n            {isNarrow && (\n              <AppSidebar activeId={activeId} onNavigate={navigate} />\n            )}\n          </InlineSheet>\n          <LiveRegion message={message} />\n        </div>\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/index.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/account-graph.tsx",
      "content": "'use client';\n\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { countOf } from '@/registry/ndeko/lib/words';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { Segments } from '@/registry/ndeko/ui/segments';\n\nimport {\n  ACCOUNTS,\n  CONTACTS,\n  contactOf,\n  contactsOf,\n  detailsOf,\n  GRAPH_NODES,\n} from './data';\nimport { createGraphEngine, type GraphEngine } from './graph-engine';\nimport { LAYOUT_OPTIONS, type LayoutId } from './graph-layouts';\nimport { GraphNodeButton } from './graph-node';\nimport { rovingTargetOf } from './roving';\n\nfunction groupOf(id: string | null) {\n  if (id === null) {\n    return null;\n  }\n  const contact = contactOf(id);\n  if (contact) {\n    return new Set([contact.id, contact.accountId]);\n  }\n  const members = contactsOf(id).map((member) => member.id);\n  return new Set([id, ...members]);\n}\n\nfunction isDimmedIn(group: Set<string> | null, id: string) {\n  if (group === null) {\n    return false;\n  }\n  return !group.has(id);\n}\n\nfunction tabIndexOf(id: string, owner: string): 0 | -1 {\n  if (id === owner) {\n    return 0;\n  }\n  return -1;\n}\n\nfunction detailsOfShown(id: string | null) {\n  if (id === null) {\n    return null;\n  }\n  return detailsOf(id);\n}\n\ntype CaptionProps = {\n  shownId: string | null;\n};\n\nfunction Caption({ shownId }: CaptionProps) {\n  const details = detailsOfShown(shownId);\n\n  return (\n    <div className='flex min-h-11 items-center px-1'>\n      {details && (\n        <Swap swapKey={details.id} className='min-w-0'>\n          <span className='flex min-w-0 flex-col leading-tight'>\n            <span className='truncate text-[13px] font-medium'>\n              {details.title}\n            </span>\n            <span className='text-muted-foreground truncate text-xs'>\n              {details.meta}\n            </span>\n          </span>\n        </Swap>\n      )}\n      {!details && (\n        <p className='text-muted-foreground text-xs'>\n          Select an account or a person to see who they work with\n        </p>\n      )}\n    </div>\n  );\n}\n\ntype AccountGraphProps = {\n  layout: LayoutId;\n  selectedId: string | null;\n  pressed: string | null;\n  isActive: boolean;\n  onLayoutChange: (layout: LayoutId) => void;\n  onSelect: (id: string) => void;\n  onClear: () => void;\n};\n\nexport function AccountGraph({\n  layout,\n  selectedId,\n  pressed,\n  isActive,\n  onLayoutChange,\n  onSelect,\n  onClear,\n}: AccountGraphProps) {\n  const titleId = useId();\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n  const planeRef = useRef<HTMLDivElement>(null);\n  const engineRef = useRef<GraphEngine | null>(null);\n  const layoutRef = useRef(layout);\n  const [previewId, setPreviewId] = useState<string | null>(null);\n  const [focusId, setFocusId] = useState<string | null>(null);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const isLive = isActive && !shouldReduceMotion;\n  const group = groupOf(selectedId);\n  const owner = focusId ?? selectedId ?? GRAPH_NODES[0].id;\n  const shownId = previewId ?? selectedId;\n\n  useEffect(() => {\n    layoutRef.current = layout;\n  });\n\n  useEffect(() => {\n    const canvas = canvasRef.current;\n    const plane = planeRef.current;\n    if (!canvas || !plane) {\n      return;\n    }\n    const engine = createGraphEngine(canvas, plane, layoutRef.current);\n    engineRef.current = engine;\n    return () => {\n      engine?.dispose();\n      engineRef.current = null;\n    };\n  }, []);\n\n  useEffect(() => {\n    engineRef.current?.setLive(isLive);\n  }, [isLive]);\n\n  useEffect(() => {\n    engineRef.current?.setLayout(layout, true);\n  }, [layout]);\n\n  useEffect(() => {\n    engineRef.current?.setHighlight(selectedId, previewId);\n  }, [selectedId, previewId]);\n\n  function focusNode(id: string) {\n    const selector = `[data-node=\"${id}\"]`;\n    const element = planeRef.current?.querySelector<HTMLElement>(selector);\n    element?.focus();\n  }\n\n  function walk(event: React.KeyboardEvent<HTMLDivElement>) {\n    if (event.key === 'Escape' && selectedId !== null) {\n      onClear();\n      return;\n    }\n    const target = event.target;\n    if (!(target instanceof HTMLElement)) {\n      return;\n    }\n    const currentId = target.dataset.node;\n    if (currentId === undefined) {\n      return;\n    }\n    const current = GRAPH_NODES.findIndex((node) => node.id === currentId);\n    const next = rovingTargetOf(event.key, current, GRAPH_NODES.length);\n    if (next === null || next === current) {\n      return;\n    }\n    event.preventDefault();\n    focusNode(GRAPH_NODES[next].id);\n  }\n\n  return (\n    <section\n      data-section='accounts'\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex scroll-mt-4 flex-col gap-3 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex flex-wrap items-center gap-x-3 gap-y-2'>\n        <div className='flex min-w-40 flex-1 flex-col leading-tight'>\n          <h2 id={titleId} className='text-sm font-medium'>\n            Accounts and contacts\n          </h2>\n          <p className='text-muted-foreground text-xs'>\n            {countOf(ACCOUNTS.length, 'account')} and{' '}\n            {countOf(CONTACTS.length, 'contact')}\n          </p>\n        </div>\n        <Segments\n          value={layout}\n          segments={LAYOUT_OPTIONS}\n          onValueChange={onLayoutChange}\n          label='Layout of the map'\n          className='w-full @lg/page:w-auto'\n          itemClassName='px-2'\n        />\n      </header>\n      <div className='bg-foreground/[0.03] relative h-72 overflow-hidden rounded-lg @lg/page:h-80'>\n        <canvas\n          ref={canvasRef}\n          aria-hidden='true'\n          className='text-foreground pointer-events-none absolute inset-0 size-full'\n        />\n        <div\n          ref={planeRef}\n          role='group'\n          aria-label='Accounts and contacts. The arrow keys move between them'\n          onKeyDown={walk}\n          className='absolute inset-0'\n        >\n          {GRAPH_NODES.map((node) => (\n            <GraphNodeButton\n              key={node.id}\n              node={node}\n              isSelected={node.id === selectedId}\n              isDimmed={isDimmedIn(group, node.id)}\n              isPressed={pressed === `node-${node.id}`}\n              tabIndex={tabIndexOf(node.id, owner)}\n              onSelect={onSelect}\n              onPreview={setPreviewId}\n              onFocusNode={setFocusId}\n            />\n          ))}\n        </div>\n      </div>\n      <Caption shownId={shownId} />\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/account-graph.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/agent-runs.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { pressedSolidOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { AGENT, RUNS, type RunId, type RunStatus } from './data';\nimport type { Decision, RunLive } from './session';\n\nconst STATUS_WORD: Record<RunStatus, string> = {\n  queued: 'Queued',\n  running: 'Running',\n  waiting: 'Waiting on you',\n  done: 'Done',\n  failed: 'Failed',\n};\n\nconst STATUS_WORDS = Object.values(STATUS_WORD);\n\nconst DOT_TONE: Record<RunStatus, string> = {\n  queued: 'bg-muted-foreground/45',\n  running: 'bg-info',\n  waiting: 'bg-warning',\n  done: 'bg-success',\n  failed: 'bg-destructive',\n};\n\nconst WORD_TONE: Record<RunStatus, string> = {\n  queued: 'text-muted-foreground',\n  running: 'text-foreground',\n  waiting: 'text-warning-foreground',\n  done: 'text-muted-foreground',\n  failed: 'text-destructive-ink',\n};\n\n/** Only a run that is really running breathes. */\nfunction pulseOf(status: RunStatus) {\n  if (status === 'running') {\n    return 'animate-pulse';\n  }\n  return undefined;\n}\n\ntype AgentStatus = 'Waiting on you' | 'Working' | 'Idle';\n\nconst AGENT_WORDS: AgentStatus[] = ['Waiting on you', 'Working', 'Idle'];\n\nfunction agentStatusOf(runs: Record<RunId, RunLive>): AgentStatus {\n  const lives = Object.values(runs);\n  const isWaiting = lives.some((live) => live.status === 'waiting');\n  if (isWaiting) {\n    return 'Waiting on you';\n  }\n  const isRunning = lives.some((live) => live.status === 'running');\n  if (isRunning) {\n    return 'Working';\n  }\n  return 'Idle';\n}\n\nconst AGENT_DOT: Record<AgentStatus, string> = {\n  'Waiting on you': 'bg-warning',\n  Working: 'bg-info',\n  Idle: 'bg-success',\n};\n\nfunction agentPulseOf(status: AgentStatus) {\n  if (status === 'Working') {\n    return 'animate-pulse';\n  }\n  return undefined;\n}\n\ntype RunRowProps = {\n  id: RunId;\n  title: string;\n  request?: string;\n  live: RunLive;\n  isAllowPressed: boolean;\n  onDecide: (id: RunId, decision: Decision) => void;\n};\n\nfunction RunRow({\n  id,\n  title,\n  request,\n  live,\n  isAllowPressed,\n  onDecide,\n}: RunRowProps) {\n  const isWaiting = live.status === 'waiting';\n  const hasNote = live.note !== '';\n  const showsNote = hasNote && !isWaiting;\n\n  function allow() {\n    onDecide(id, 'approved');\n  }\n\n  function deny() {\n    onDecide(id, 'denied');\n  }\n\n  return (\n    <div\n      data-run={id}\n      tabIndex={-1}\n      className='flex flex-col gap-0.5 px-2 py-2 outline-none'\n    >\n      <p className='flex items-baseline gap-3'>\n        <span className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n          {title}\n        </span>\n        <span\n          className={cn(\n            'flex shrink-0 items-center gap-1.5 text-xs transition-colors duration-200',\n            WORD_TONE[live.status]\n          )}\n        >\n          <span\n            aria-hidden='true'\n            className={cn(\n              'size-1.5 shrink-0 rounded-full transition-colors duration-200',\n              DOT_TONE[live.status],\n              pulseOf(live.status)\n            )}\n          />\n          <WordRoll text={STATUS_WORD[live.status]} labels={STATUS_WORDS} />\n        </span>\n      </p>\n      {showsNote && (\n        <p\n          key={live.note}\n          className='text-muted-foreground text-xs transition-opacity duration-300 starting:opacity-0'\n        >\n          {live.note}\n        </p>\n      )}\n      {isWaiting && (\n        <div className='flex flex-wrap items-center gap-2 pt-1.5'>\n          <span className='text-foreground/85 min-w-0 flex-1 text-xs'>\n            {request}\n          </span>\n          <Button\n            type='button'\n            size='sm'\n            aria-label={`Allow: ${request}`}\n            onClick={allow}\n            className={pressedSolidOf(isAllowPressed)}\n          >\n            Allow\n          </Button>\n          <Button\n            type='button'\n            size='sm'\n            variant='outline'\n            aria-label={`Deny: ${request}`}\n            onClick={deny}\n          >\n            Deny\n          </Button>\n        </div>\n      )}\n    </div>\n  );\n}\n\ntype AgentRunsProps = {\n  runs: Record<RunId, RunLive>;\n  pressed: string | null;\n  onDecide: (id: RunId, decision: Decision) => void;\n};\n\nexport function AgentRuns({ runs, pressed, onDecide }: AgentRunsProps) {\n  const titleId = useId();\n  const status = agentStatusOf(runs);\n\n  return (\n    <section\n      data-section='agent'\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex scroll-mt-4 flex-col gap-3 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex items-center gap-2.5'>\n        <MeshTile\n          seed={AGENT.name}\n          color={seriesColorOf(AGENT.series)}\n          size='lg'\n        />\n        <div className='flex min-w-0 flex-col leading-tight'>\n          <h2 id={titleId} className='truncate text-sm font-medium'>\n            {AGENT.name}\n          </h2>\n          <p className='text-muted-foreground flex items-center gap-1.5 text-xs'>\n            <span\n              aria-hidden='true'\n              className={cn(\n                'size-1.5 shrink-0 rounded-full transition-colors duration-200',\n                AGENT_DOT[status],\n                agentPulseOf(status)\n              )}\n            />\n            <WordRoll text={status} labels={AGENT_WORDS} />\n          </p>\n        </div>\n      </header>\n      <AnimatedSize>\n        <ul aria-label='Recent runs' className='-mx-2 flex flex-col'>\n          {RUNS.map((seed) => (\n            <li key={seed.id}>\n              <RunRow\n                id={seed.id}\n                title={seed.title}\n                request={seed.request}\n                live={runs[seed.id]}\n                isAllowPressed={pressed === 'allow'}\n                onDecide={onDecide}\n              />\n            </li>\n          ))}\n        </ul>\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/agent-runs.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/app-sidebar.tsx",
      "content": "'use client';\n\nimport { motion } from 'motion/react';\nimport { useId } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { springOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\n\nimport { BRAND, NAV, SALES_LEAD, type NavItem, type SectionId } from './data';\n\nconst NAV_ROW =\n  \"relative flex h-7 w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2 text-start text-[13px] font-medium outline-none transition-colors duration-150 hover:bg-foreground/5 focus-visible:ring-[3px] focus-visible:ring-ring/25 [&_svg]:pointer-events-none [&_svg]:relative [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\";\n\nfunction currentOf(isActive: boolean) {\n  if (isActive) {\n    return 'location';\n  }\n  return undefined;\n}\n\nfunction ActiveIndicator({ layoutId }: { layoutId: string }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <motion.span\n      aria-hidden='true'\n      layoutId={layoutId}\n      transition={springOf(shouldReduceMotion)}\n      className='bg-foreground/[0.07] absolute inset-0 rounded-md'\n    />\n  );\n}\n\ntype NavRowProps = {\n  item: NavItem;\n  isActive: boolean;\n  indicatorId: string;\n  onNavigate: (id: SectionId) => void;\n};\n\nfunction NavRow({ item, isActive, indicatorId, onNavigate }: NavRowProps) {\n  const ItemIcon = item.icon;\n\n  function navigate() {\n    onNavigate(item.id);\n  }\n\n  return (\n    <li>\n      <button\n        type='button'\n        aria-current={currentOf(isActive)}\n        onClick={navigate}\n        className={NAV_ROW}\n      >\n        {isActive && <ActiveIndicator layoutId={indicatorId} />}\n        <ItemIcon />\n        <span className='relative min-w-0 flex-1 truncate'>{item.label}</span>\n      </button>\n    </li>\n  );\n}\n\ntype AppSidebarProps = {\n  activeId: SectionId;\n  onNavigate: (id: SectionId) => void;\n  className?: string;\n};\n\nexport function AppSidebar({\n  activeId,\n  onNavigate,\n  className,\n}: AppSidebarProps) {\n  const indicatorId = useId();\n\n  return (\n    <div className={cn('flex min-h-0 w-full flex-col gap-3', className)}>\n      <div className='flex h-9 items-center gap-2 px-1.5'>\n        <CompanyMark seed={BRAND.name} className='size-6 rounded-md' />\n        <span className='text-[13px] font-semibold'>{BRAND.name}</span>\n      </div>\n      <nav aria-label='Sections of the overview' className='flex-1'>\n        <ul className='flex flex-col gap-px'>\n          {NAV.map((item) => (\n            <NavRow\n              key={item.id}\n              item={item}\n              isActive={item.id === activeId}\n              indicatorId={indicatorId}\n              onNavigate={onNavigate}\n            />\n          ))}\n        </ul>\n      </nav>\n      <div className='flex items-center gap-2 px-1.5 py-1'>\n        <Avatar className='size-7' seed={SALES_LEAD.name} />\n        <div className='flex min-w-0 flex-col leading-tight'>\n          <span className='truncate text-[13px] font-medium'>\n            {SALES_LEAD.name}\n          </span>\n          <span className='text-muted-foreground truncate text-xs'>\n            {SALES_LEAD.role}\n          </span>\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/app-sidebar.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/count-up.tsx",
      "content": "'use client';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nconst COUNT_MS = 1000;\n\nfunction easeOut(progress: number) {\n  const rest = 1 - progress;\n  return 1 - rest * rest * rest;\n}\n\nfunction textOf(isFinal: boolean, finalText: string, restText: string) {\n  if (isFinal) {\n    return finalText;\n  }\n  return restText;\n}\n\ntype CountUpProps = {\n  value: number;\n  format: Intl.NumberFormatOptions;\n  suffix?: string;\n  /** False until the figure is loaded: it reads zero, then counts up to its value once. */\n  isLoaded: boolean;\n  className?: string;\n};\n\n/**\n * A figure that counts up once. The text is written to the element on each frame, so no render\n * happens while it counts, and the final text is laid out invisibly so the figure never changes width.\n */\nexport function CountUp({\n  value,\n  format,\n  suffix = '',\n  isLoaded,\n  className,\n}: CountUpProps) {\n  const liveRef = useRef<HTMLSpanElement>(null);\n  const [hasCounted, setHasCounted] = useState(false);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const formatter = useMemo(\n    () => new Intl.NumberFormat('en-US', format),\n    [format]\n  );\n  const finalText = `${formatter.format(value)}${suffix}`;\n  const restText = `${formatter.format(0)}${suffix}`;\n  const isReducedAndLoaded = isLoaded && shouldReduceMotion;\n  const isFinal = hasCounted || isReducedAndLoaded;\n  const shownText = textOf(isFinal, finalText, restText);\n\n  useEffect(() => {\n    const element = liveRef.current;\n    const hasToCount = isLoaded && !hasCounted;\n    const isCounting = hasToCount && !shouldReduceMotion;\n    if (!element || !isCounting) {\n      return;\n    }\n    let frame = 0;\n    let startedAt: number | null = null;\n\n    function step(now: number) {\n      if (!element) {\n        return;\n      }\n      const begun = startedAt ?? now;\n      startedAt = begun;\n      const progress = Math.min((now - begun) / COUNT_MS, 1);\n      const current = value * easeOut(progress);\n      element.textContent = `${formatter.format(current)}${suffix}`;\n      if (progress < 1) {\n        frame = requestAnimationFrame(step);\n        return;\n      }\n      setHasCounted(true);\n    }\n\n    frame = requestAnimationFrame(step);\n    return () => cancelAnimationFrame(frame);\n  }, [isLoaded, hasCounted, shouldReduceMotion, value, formatter, suffix]);\n\n  return (\n    <span className={cn('inline-grid tabular-nums', className)}>\n      <span className='sr-only'>{finalText}</span>\n      <span aria-hidden='true' className='invisible col-start-1 row-start-1'>\n        {finalText}\n      </span>\n      <span\n        ref={liveRef}\n        aria-hidden='true'\n        className='col-start-1 row-start-1'\n      >\n        {shownText}\n      </span>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/count-up.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\nimport {\n  BotIcon,\n  CalendarIcon,\n  FilterIcon,\n  HomeIcon,\n  ListChecksIcon,\n  NetworkIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nexport const BRAND = { name: 'Pebblecrest' };\n\nexport const SALES_LEAD = { name: 'Nadine Mbuyi', role: 'Sales lead' };\n\nconst AGENT_SERIES: SeriesSlot = 2;\n\nexport const AGENT = { name: 'Scout', series: AGENT_SERIES };\n\nexport type SectionId =\n  'overview' | 'pipeline' | 'accounts' | 'tasks' | 'agent' | 'calendar';\n\nexport type NavItem = {\n  id: SectionId;\n  label: string;\n  icon: Icon;\n};\n\nexport const NAV: NavItem[] = [\n  { id: 'overview', label: 'Overview', icon: HomeIcon },\n  { id: 'accounts', label: 'Accounts', icon: NetworkIcon },\n  { id: 'agent', label: 'Agent', icon: BotIcon },\n  { id: 'pipeline', label: 'Pipeline', icon: FilterIcon },\n  { id: 'tasks', label: 'To do', icon: ListChecksIcon },\n  { id: 'calendar', label: 'Next 14 days', icon: CalendarIcon },\n];\n\nexport type FigureId = 'open' | 'won' | 'reply';\n\nexport type Figure = {\n  id: FigureId;\n  label: string;\n  value: number;\n  format: Intl.NumberFormatOptions;\n  suffix?: string;\n  change: string;\n  direction: 'up' | 'down';\n};\n\nexport const FIGURES: Figure[] = [\n  {\n    id: 'open',\n    label: 'Open deals',\n    value: 42,\n    format: { maximumFractionDigits: 0 },\n    change: '6 more than last month',\n    direction: 'up',\n  },\n  {\n    id: 'won',\n    label: 'Won this month',\n    value: 86400,\n    format: {\n      style: 'currency',\n      currency: 'USD',\n      maximumFractionDigits: 0,\n    },\n    change: 'up 12% on last month',\n    direction: 'up',\n  },\n  {\n    id: 'reply',\n    label: 'Reply time',\n    value: 3.4,\n    format: { minimumFractionDigits: 1, maximumFractionDigits: 1 },\n    suffix: ' h',\n    change: '1.2 h faster than last month',\n    direction: 'down',\n  },\n];\n\nexport type StageId = 'new' | 'qualified' | 'proposal' | 'negotiation' | 'won';\n\nexport type Stage = {\n  id: StageId;\n  label: string;\n};\n\nexport const STAGES: Stage[] = [\n  { id: 'new', label: 'New' },\n  { id: 'qualified', label: 'Qualified' },\n  { id: 'proposal', label: 'Proposal' },\n  { id: 'negotiation', label: 'Negotiation' },\n  { id: 'won', label: 'Won' },\n];\n\nexport function stageLabelOf(id: StageId) {\n  const stage = STAGES.find((candidate) => candidate.id === id);\n  return stage?.label ?? '';\n}\n\nexport const STAGE_COUNTS_BEFORE = [128, 76, 41, 22, 11];\n\nexport const STAGE_COUNTS_AFTER = [128, 92, 47, 24, 11];\n\nexport const TREND_WEEKS = [\n  'Aug 24',\n  'Aug 31',\n  'Sep 7',\n  'Sep 14',\n  'Sep 21',\n  'Sep 28',\n  'Oct 5',\n  'Oct 12',\n  'Oct 19',\n  'Oct 26',\n  'Nov 2',\n  'Nov 9',\n];\n\nexport const NEW_LEADS = [38, 42, 40, 47, 52, 49, 55, 61, 58, 66, 71, 78];\n\nexport type Account = {\n  id: string;\n  name: string;\n  city: string;\n  stage: StageId;\n  valueUsd: number;\n};\n\nexport type Contact = {\n  id: string;\n  accountId: string;\n  name: string;\n  role: string;\n};\n\nexport const ACCOUNTS: Account[] = [\n  {\n    id: 'copperline',\n    name: 'Copperline Logistics',\n    city: 'Lubumbashi',\n    stage: 'negotiation',\n    valueUsd: 48000,\n  },\n  {\n    id: 'highland',\n    name: 'Highland Roast Co',\n    city: 'Goma',\n    stage: 'proposal',\n    valueUsd: 22000,\n  },\n  {\n    id: 'riverbend',\n    name: 'Riverbend Fibre',\n    city: 'Kinshasa',\n    stage: 'won',\n    valueUsd: 64000,\n  },\n  {\n    id: 'sunmeadow',\n    name: 'Sunmeadow Solar',\n    city: 'Goma',\n    stage: 'qualified',\n    valueUsd: 35000,\n  },\n  {\n    id: 'northgate',\n    name: 'Northgate Foods',\n    city: 'Lyon',\n    stage: 'negotiation',\n    valueUsd: 41000,\n  },\n  {\n    id: 'stonebridge',\n    name: 'Stonebridge Clinics',\n    city: 'Kinshasa',\n    stage: 'proposal',\n    valueUsd: 18000,\n  },\n];\n\nexport const CONTACTS: Contact[] = [\n  {\n    id: 'esther',\n    accountId: 'copperline',\n    name: 'Esther Kasongo',\n    role: 'Operations director',\n  },\n  {\n    id: 'didier',\n    accountId: 'copperline',\n    name: 'Didier Kalala',\n    role: 'Procurement lead',\n  },\n  {\n    id: 'patrick',\n    accountId: 'highland',\n    name: 'Patrick Ilunga',\n    role: 'Founder',\n  },\n  {\n    id: 'chantal',\n    accountId: 'highland',\n    name: 'Chantal Bahati',\n    role: 'Sales manager',\n  },\n  {\n    id: 'grace',\n    accountId: 'riverbend',\n    name: 'Grace Mukendi',\n    role: 'Finance lead',\n  },\n  {\n    id: 'jeanluc',\n    accountId: 'riverbend',\n    name: 'Jean-Luc Kabeya',\n    role: 'Head of IT',\n  },\n  {\n    id: 'amani',\n    accountId: 'sunmeadow',\n    name: 'Amani Mwamba',\n    role: 'Project manager',\n  },\n  {\n    id: 'lea',\n    accountId: 'sunmeadow',\n    name: 'Léa Safari',\n    role: 'Buyer',\n  },\n  {\n    id: 'hugo',\n    accountId: 'northgate',\n    name: 'Hugo Lambert',\n    role: 'Supply chain lead',\n  },\n  {\n    id: 'ines',\n    accountId: 'northgate',\n    name: 'Inès Moreau',\n    role: 'Quality manager',\n  },\n  {\n    id: 'joel',\n    accountId: 'stonebridge',\n    name: 'Joël Banza',\n    role: 'Medical director',\n  },\n  {\n    id: 'alphonsine',\n    accountId: 'stonebridge',\n    name: 'Alphonsine Tshimanga',\n    role: 'Administrator',\n  },\n];\n\nexport type NodeKind = 'account' | 'contact';\n\nexport type GraphNode = {\n  id: string;\n  kind: NodeKind;\n  accountId: string;\n};\n\nexport type GraphLink = {\n  accountId: string;\n  contactId: string;\n};\n\nexport function contactsOf(accountId: string) {\n  return CONTACTS.filter((contact) => contact.accountId === accountId);\n}\n\nfunction nodesOf(account: Account): GraphNode[] {\n  const accountNode: GraphNode = {\n    id: account.id,\n    kind: 'account',\n    accountId: account.id,\n  };\n  const contactNodes = contactsOf(account.id).map((contact) => {\n    const node: GraphNode = {\n      id: contact.id,\n      kind: 'contact',\n      accountId: account.id,\n    };\n    return node;\n  });\n  return [accountNode, ...contactNodes];\n}\n\n/** Each account comes before its own contacts, which is the order the keyboard walks them in. */\nexport const GRAPH_NODES: GraphNode[] = ACCOUNTS.flatMap(nodesOf);\n\nexport const GRAPH_LINKS: GraphLink[] = CONTACTS.map((contact) => ({\n  accountId: contact.accountId,\n  contactId: contact.id,\n}));\n\nexport function accountOf(id: string) {\n  const account = ACCOUNTS.find((candidate) => candidate.id === id);\n  return account ?? ACCOUNTS[0];\n}\n\nexport function contactOf(id: string) {\n  return CONTACTS.find((candidate) => candidate.id === id);\n}\n\nconst MONEY = new Intl.NumberFormat('en-US', {\n  style: 'currency',\n  currency: 'USD',\n  maximumFractionDigits: 0,\n});\n\nexport function formatMoney(value: number) {\n  return MONEY.format(value);\n}\n\nexport type NodeDetails = {\n  id: string;\n  title: string;\n  meta: string;\n  spoken: string;\n};\n\nexport function detailsOf(id: string): NodeDetails | null {\n  const contact = contactOf(id);\n  if (contact) {\n    const account = accountOf(contact.accountId);\n    const meta = `${contact.role} at ${account.name}`;\n    return {\n      id,\n      title: contact.name,\n      meta,\n      spoken: `${contact.name}, ${meta}`,\n    };\n  }\n  const account = ACCOUNTS.find((candidate) => candidate.id === id);\n  if (!account) {\n    return null;\n  }\n  const stage = stageLabelOf(account.stage);\n  const value = formatMoney(account.valueUsd);\n  const meta = `${account.city} · ${stage} · ${value}`;\n  const spoken = `${account.name}, ${account.city}, ${stage}, ${value}`;\n  return { id, title: account.name, meta, spoken };\n}\n\nexport function spokenNodeOf(id: string) {\n  const details = detailsOf(id);\n  if (!details) {\n    return '';\n  }\n  return details.spoken;\n}\n\nexport type Task = {\n  id: string;\n  title: string;\n  due: string;\n};\n\nexport const TASKS: Task[] = [\n  {\n    id: 'proposal',\n    title: 'Send the proposal to Copperline Logistics',\n    due: 'Today',\n  },\n  {\n    id: 'call',\n    title: 'Call Esther Kasongo about the renewal',\n    due: 'Today',\n  },\n  {\n    id: 'quotes',\n    title: 'Review quotes for Sunmeadow Solar',\n    due: 'Tomorrow',\n  },\n  {\n    id: 'goma',\n    title: 'Update the contacts in Goma',\n    due: 'Friday',\n  },\n];\n\nexport const AGENT_TASK: Task = {\n  id: 'drafts',\n  title: 'Review the 3 follow-ups Scout drafted',\n  due: 'Today',\n};\n\nexport const DEMO_TASK = 'proposal';\n\nexport function taskOf(id: string) {\n  const known = [...TASKS, AGENT_TASK];\n  const task = known.find((candidate) => candidate.id === id);\n  return task ?? TASKS[0];\n}\n\nexport type RunId = 'enrich' | 'qualify' | 'drafts' | 'merge';\n\nexport type RunStatus = 'queued' | 'running' | 'waiting' | 'done' | 'failed';\n\nexport type RunSeed = {\n  id: RunId;\n  title: string;\n  status: RunStatus;\n  note: string;\n  request?: string;\n};\n\nexport const RUNS: RunSeed[] = [\n  {\n    id: 'merge',\n    title: 'Merge duplicate accounts',\n    status: 'waiting',\n    note: '',\n    request: 'Merge 3 duplicate accounts into 3 records',\n  },\n  {\n    id: 'qualify',\n    title: 'Qualify new leads',\n    status: 'running',\n    note: 'Scoring 128 leads against your rules',\n  },\n  {\n    id: 'drafts',\n    title: 'Draft follow-ups for stalled deals',\n    status: 'queued',\n    note: '',\n  },\n  {\n    id: 'enrich',\n    title: 'Enrich 24 new leads',\n    status: 'done',\n    note: 'Added company size and city to 24 leads',\n  },\n];\n\nexport type RunCopy = {\n  running: string;\n  done: string;\n};\n\nexport const RUN_COPY: Record<RunId, RunCopy> = {\n  enrich: {\n    running: 'Adding company size and city',\n    done: 'Added company size and city to 24 leads',\n  },\n  qualify: {\n    running: 'Scoring 128 leads against your rules',\n    done: 'Moved 16 leads to Qualified',\n  },\n  drafts: {\n    running: 'Writing 3 follow-ups',\n    done: '3 drafts are ready for your review',\n  },\n  merge: {\n    running: 'Merging 3 duplicate accounts',\n    done: 'Allowed by you. 3 duplicates merged',\n  },\n};\n\nexport const DENIED_NOTE = 'Denied by you. Nothing was merged';\n\nexport type EventKind = 'call' | 'demo' | 'deadline';\n\nexport type DayEvent = {\n  id: string;\n  dayIndex: number;\n  kind: EventKind;\n  title: string;\n  time: string;\n};\n\n/** The strip starts on a fixed day, so the server and the browser draw the same dates. */\nexport const STRIP_START = '2026-11-13';\n\nexport const STRIP_DAYS = 14;\n\nexport const EVENTS: DayEvent[] = [\n  {\n    id: 'proposal-due',\n    dayIndex: 0,\n    kind: 'deadline',\n    title: 'Proposal due, Copperline Logistics',\n    time: '17:00',\n  },\n  {\n    id: 'call-esther',\n    dayIndex: 0,\n    kind: 'call',\n    title: 'Call with Esther Kasongo',\n    time: '15:00',\n  },\n  {\n    id: 'demo-highland',\n    dayIndex: 3,\n    kind: 'demo',\n    title: 'Demo for Highland Roast Co',\n    time: '10:00',\n  },\n  {\n    id: 'renewal-riverbend',\n    dayIndex: 4,\n    kind: 'call',\n    title: 'Renewal call with Riverbend Fibre',\n    time: '11:30',\n  },\n  {\n    id: 'quotes-sunmeadow',\n    dayIndex: 6,\n    kind: 'deadline',\n    title: 'Quotes due, Sunmeadow Solar',\n    time: '12:00',\n  },\n  {\n    id: 'demo-stonebridge',\n    dayIndex: 6,\n    kind: 'demo',\n    title: 'Demo for Stonebridge Clinics',\n    time: '14:00',\n  },\n  {\n    id: 'sign-copperline',\n    dayIndex: 10,\n    kind: 'deadline',\n    title: 'Contract signing, Copperline Logistics',\n    time: '09:30',\n  },\n  {\n    id: 'checkin-northgate',\n    dayIndex: 12,\n    kind: 'call',\n    title: 'Check-in with Northgate Foods',\n    time: '16:00',\n  },\n];\n\nexport const KIND_WORD: Record<EventKind, string> = {\n  call: 'Call',\n  demo: 'Demo',\n  deadline: 'Deadline',\n};\n\nexport function eventsOfDay(dayIndex: number) {\n  return EVENTS.filter((event) => event.dayIndex === dayIndex);\n}\n\nexport type StripDay = {\n  index: number;\n  weekday: string;\n  dayOfMonth: number;\n  spoken: string;\n};\n\nconst WEEKDAY = new Intl.DateTimeFormat('en-US', {\n  weekday: 'short',\n  timeZone: 'UTC',\n});\n\nconst SPOKEN_DAY = new Intl.DateTimeFormat('en-US', {\n  weekday: 'long',\n  day: 'numeric',\n  month: 'long',\n  timeZone: 'UTC',\n});\n\nconst DAY_MS = 86_400_000;\n\nfunction stripDayOf(index: number): StripDay {\n  const start = Date.parse(`${STRIP_START}T00:00:00Z`);\n  const date = new Date(start + index * DAY_MS);\n  return {\n    index,\n    weekday: WEEKDAY.format(date),\n    dayOfMonth: date.getUTCDate(),\n    spoken: SPOKEN_DAY.format(date),\n  };\n}\n\nexport const STRIP: StripDay[] = Array.from(\n  { length: STRIP_DAYS },\n  (_, index) => stripDayOf(index)\n);\n",
      "type": "registry:component",
      "target": "components/templates/application-15/data.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/day-strip.tsx",
      "content": "'use client';\n\nimport { useId, useState } from 'react';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { countOf } from '@/registry/ndeko/lib/words';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\n\nimport {\n  eventsOfDay,\n  KIND_WORD,\n  STRIP,\n  type DayEvent,\n  type EventKind,\n  type StripDay,\n} from './data';\nimport { rovingTargetOf } from './roving';\n\nconst KIND_DOT: Record<EventKind, string> = {\n  call: 'bg-info',\n  demo: 'bg-primary',\n  deadline: 'bg-warning',\n};\n\nconst KINDS: EventKind[] = ['call', 'demo', 'deadline'];\n\nconst MAX_DOTS = 3;\n\nfunction isWeekendDay(day: StripDay) {\n  const isSaturday = day.weekday === 'Sat';\n  const isSunday = day.weekday === 'Sun';\n  return isSaturday || isSunday;\n}\n\nfunction selectedClassOf(isSelected: boolean) {\n  if (isSelected) {\n    return 'bg-foreground/[0.07]';\n  }\n  return 'hover:bg-foreground/[0.04]';\n}\n\nfunction weekdayToneOf(isWeekend: boolean) {\n  if (isWeekend) {\n    return 'text-muted-foreground/60';\n  }\n  return 'text-muted-foreground';\n}\n\nfunction todayClassOf(isToday: boolean) {\n  if (isToday) {\n    return 'bg-primary text-primary-foreground';\n  }\n  return undefined;\n}\n\nfunction tabIndexOf(index: number, owner: number): 0 | -1 {\n  if (index === owner) {\n    return 0;\n  }\n  return -1;\n}\n\ntype DayCellProps = {\n  day: StripDay;\n  events: DayEvent[];\n  isSelected: boolean;\n  isPressed: boolean;\n  tabIndex: 0 | -1;\n  onSelect: (index: number) => void;\n  onFocusDay: (index: number) => void;\n};\n\nfunction DayCell({\n  day,\n  events,\n  isSelected,\n  isPressed,\n  tabIndex,\n  onSelect,\n  onFocusDay,\n}: DayCellProps) {\n  const isToday = day.index === 0;\n  const isWeekend = isWeekendDay(day);\n  const dots = events.slice(0, MAX_DOTS);\n  const spoken = `${day.spoken}, ${countOf(events.length, 'event')}`;\n\n  function select() {\n    onSelect(day.index);\n  }\n\n  function focusDay() {\n    onFocusDay(day.index);\n  }\n\n  return (\n    <button\n      type='button'\n      data-day={day.index}\n      aria-label={spoken}\n      aria-pressed={isSelected}\n      tabIndex={tabIndex}\n      onClick={select}\n      onFocus={focusDay}\n      className={cn(\n        'focus-visible:ring-ring/25 flex h-16 cursor-pointer flex-col items-center justify-center gap-1 rounded-lg transition-[background-color,scale] duration-150 outline-none focus-visible:ring-[3px] active:scale-[0.97]',\n        selectedClassOf(isSelected),\n        pressedQuietOf(isPressed)\n      )}\n    >\n      <span className={cn('text-xs', weekdayToneOf(isWeekend))}>\n        {day.weekday}\n      </span>\n      <span\n        className={cn(\n          'inline-flex size-6 items-center justify-center rounded-full text-[13px] font-medium tabular-nums',\n          todayClassOf(isToday)\n        )}\n      >\n        {day.dayOfMonth}\n      </span>\n      <span aria-hidden='true' className='flex h-1.5 items-center gap-0.5'>\n        {dots.map((event) => (\n          <span\n            key={event.id}\n            className={cn('size-1.5 rounded-full', KIND_DOT[event.kind])}\n          />\n        ))}\n      </span>\n    </button>\n  );\n}\n\ntype AgendaProps = {\n  dayIndex: number | null;\n};\n\nfunction Agenda({ dayIndex }: AgendaProps) {\n  if (dayIndex === null) {\n    return (\n      <p className='text-muted-foreground px-1 py-2 text-xs'>\n        Select a day to see what is planned\n      </p>\n    );\n  }\n  const day = STRIP[dayIndex];\n  const events = eventsOfDay(dayIndex);\n  const hasEvents = events.length > 0;\n\n  return (\n    <div\n      key={dayIndex}\n      className='flex flex-col gap-1.5 px-1 py-2 transition-opacity duration-300 starting:opacity-0'\n    >\n      <p className='text-xs font-medium'>{day.spoken}</p>\n      {!hasEvents && (\n        <p className='text-muted-foreground text-xs'>Nothing planned</p>\n      )}\n      {events.map((event) => (\n        <p key={event.id} className='flex items-center gap-2 text-[13px]'>\n          <span\n            aria-hidden='true'\n            className={cn(\n              'size-1.5 shrink-0 rounded-full',\n              KIND_DOT[event.kind]\n            )}\n          />\n          <span className='text-muted-foreground w-11 shrink-0 text-xs tabular-nums'>\n            {event.time}\n          </span>\n          <span className='min-w-0 flex-1 truncate'>{event.title}</span>\n          <span className='text-muted-foreground hidden shrink-0 text-xs @md/page:block'>\n            {KIND_WORD[event.kind]}\n          </span>\n        </p>\n      ))}\n    </div>\n  );\n}\n\ntype DayStripProps = {\n  dayIndex: number | null;\n  pressed: string | null;\n  onSelect: (index: number) => void;\n};\n\nexport function DayStrip({ dayIndex, pressed, onSelect }: DayStripProps) {\n  const titleId = useId();\n  const [focusIndex, setFocusIndex] = useState<number | null>(null);\n  const owner = focusIndex ?? dayIndex ?? 0;\n\n  function walk(event: React.KeyboardEvent<HTMLDivElement>) {\n    const target = event.target;\n    if (!(target instanceof HTMLElement)) {\n      return;\n    }\n    const current = Number(target.dataset.day);\n    const next = rovingTargetOf(event.key, current, STRIP.length);\n    if (next === null || next === current) {\n      return;\n    }\n    event.preventDefault();\n    const selector = `[data-day=\"${next}\"]`;\n    const element = event.currentTarget.querySelector<HTMLElement>(selector);\n    element?.focus();\n  }\n\n  return (\n    <section\n      data-section='calendar'\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex scroll-mt-4 flex-col gap-3 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex flex-wrap items-center gap-x-4 gap-y-1'>\n        <h2 id={titleId} className='mr-auto text-sm font-medium'>\n          Next 14 days\n        </h2>\n        <ul className='text-muted-foreground flex items-center gap-3 text-xs'>\n          {KINDS.map((kind) => (\n            <li key={kind} className='flex items-center gap-1.5'>\n              <span\n                aria-hidden='true'\n                className={cn('size-1.5 rounded-full', KIND_DOT[kind])}\n              />\n              {KIND_WORD[kind]}\n            </li>\n          ))}\n        </ul>\n      </header>\n      <div\n        role='group'\n        aria-label='Days. The arrow keys move between them'\n        onKeyDown={walk}\n        className='grid grid-cols-7 gap-1 @2xl/page:grid-cols-[repeat(14,minmax(0,1fr))]'\n      >\n        {STRIP.map((day) => (\n          <DayCell\n            key={day.index}\n            day={day}\n            events={eventsOfDay(day.index)}\n            isSelected={day.index === dayIndex}\n            isPressed={pressed === `day-${day.index}`}\n            tabIndex={tabIndexOf(day.index, owner)}\n            onSelect={onSelect}\n            onFocusDay={setFocusIndex}\n          />\n        ))}\n      </div>\n      <AnimatedSize>\n        <Agenda dayIndex={dayIndex} />\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/day-strip.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/figure-band.tsx",
      "content": "'use client';\n\nimport {\n  TrendingDownIcon,\n  TrendingUpIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nimport { CountUp } from './count-up';\nimport { FIGURES, type Figure } from './data';\n\nconst TREND_ICON: Record<Figure['direction'], Icon> = {\n  up: TrendingUpIcon,\n  down: TrendingDownIcon,\n};\n\ntype FigureCellProps = {\n  figure: Figure;\n  isLoaded: boolean;\n};\n\nfunction FigureCell({ figure, isLoaded }: FigureCellProps) {\n  const TrendIcon = TREND_ICON[figure.direction];\n\n  return (\n    <div className='flex min-w-0 flex-col gap-1'>\n      <p className='text-muted-foreground text-xs'>{figure.label}</p>\n      <CountUp\n        value={figure.value}\n        format={figure.format}\n        suffix={figure.suffix}\n        isLoaded={isLoaded}\n        className='text-2xl leading-8 font-semibold'\n      />\n      <p className='text-muted-foreground flex items-center gap-1 text-xs'>\n        <TrendIcon className='size-3.5 shrink-0' />\n        <span className='min-w-0'>{figure.change}</span>\n      </p>\n    </div>\n  );\n}\n\ntype FigureBandProps = {\n  isLoaded: boolean;\n};\n\nexport function FigureBand({ isLoaded }: FigureBandProps) {\n  return (\n    <section\n      data-section='overview'\n      aria-label='Key figures'\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] grid scroll-mt-4 gap-5 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] @lg/page:grid-cols-3 @lg/page:gap-6'\n    >\n      {FIGURES.map((figure) => (\n        <FigureCell key={figure.id} figure={figure} isLoaded={isLoaded} />\n      ))}\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/figure-band.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/graph-engine.ts",
      "content": "import {\n  GRAPH_LINKS,\n  GRAPH_NODES,\n  type GraphLink,\n  type NodeKind,\n} from './data';\nimport {\n  arrangementOf,\n  LAYOUT_IDS,\n  type Arrangement,\n  type Box,\n  type Guide,\n  type LayoutId,\n} from './graph-layouts';\n\nconst GLIDE_MS = 900;\n\nconst ACCOUNT_STAGGER_MS = 18;\n\n/** Contacts follow their accounts a little later, so a layout change reads as a hand pulling the graph along. */\nconst CONTACT_LAG_MS = 90;\n\nconst CONTACT_STAGGER_MS = 14;\n\nconst GUIDE_FADE_MS = 450;\n\nconst MAX_PIXEL_RATIO = 2;\n\nconst GUIDE_REST = 0.01;\n\nconst LINK_ALPHA = 0.22;\n\nconst GUIDE_ALPHA = 0.1;\n\nconst PREVIEW_ALPHA = 0.5;\n\nconst SELECTED_ALPHA = 0.9;\n\nconst LINK_WIDTH = 1.1;\n\nconst PREVIEW_WIDTH = 1.5;\n\nconst SELECTED_WIDTH = 1.8;\n\ntype MovingNode = {\n  id: string;\n  kind: NodeKind;\n  element: HTMLElement;\n  halfWidth: number;\n  halfHeight: number;\n  x: number;\n  y: number;\n  fromX: number;\n  fromY: number;\n  toX: number;\n  toY: number;\n  delay: number;\n};\n\ntype GuideLevels = Record<LayoutId, number>;\n\ntype EngineState = {\n  canvas: HTMLCanvasElement;\n  pen: CanvasRenderingContext2D;\n  nodes: MovingNode[];\n  byId: Map<string, MovingNode>;\n  stage: Box;\n  layout: LayoutId;\n  arrangements: Map<LayoutId, Arrangement>;\n  guideLevel: GuideLevels;\n  guideGoal: GuideLevels;\n  selectedId: string | null;\n  previewId: string | null;\n  ink: string;\n  accent: string;\n  isLive: boolean;\n  isRevealed: boolean;\n  frame: number;\n  startedAt: number;\n  lastTick: number;\n};\n\nexport type GraphEngine = {\n  setLayout: (layout: LayoutId, shouldGlide: boolean) => void;\n  setHighlight: (selectedId: string | null, previewId: string | null) => void;\n  setLive: (isLive: boolean) => void;\n  dispose: () => void;\n};\n\nfunction clamp01(value: number) {\n  const atLeastZero = Math.max(value, 0);\n  return Math.min(atLeastZero, 1);\n}\n\nfunction easeInOut(progress: number) {\n  if (progress < 0.5) {\n    return 4 * progress * progress * progress;\n  }\n  const mirrored = -2 * progress + 2;\n  return 1 - (mirrored * mirrored * mirrored) / 2;\n}\n\nfunction levelsOf(layout: LayoutId): GuideLevels {\n  const levels = { cluster: 0, rings: 0, grid: 0, orbit: 0, radial: 0 };\n  levels[layout] = 1;\n  return levels;\n}\n\nfunction delayOf(kind: NodeKind, index: number) {\n  if (kind === 'account') {\n    return index * ACCOUNT_STAGGER_MS;\n  }\n  return CONTACT_LAG_MS + index * CONTACT_STAGGER_MS;\n}\n\nfunction nodesOf(plane: HTMLElement) {\n  const nodes: MovingNode[] = [];\n  const counts = { account: 0, contact: 0 };\n  for (const seed of GRAPH_NODES) {\n    const selector = `[data-node=\"${seed.id}\"]`;\n    const element = plane.querySelector<HTMLElement>(selector);\n    if (!element) {\n      continue;\n    }\n    const index = counts[seed.kind];\n    counts[seed.kind] += 1;\n    nodes.push({\n      id: seed.id,\n      kind: seed.kind,\n      element,\n      halfWidth: 0,\n      halfHeight: 0,\n      x: 0,\n      y: 0,\n      fromX: 0,\n      fromY: 0,\n      toX: 0,\n      toY: 0,\n      delay: delayOf(seed.kind, index),\n    });\n  }\n  return nodes;\n}\n\nfunction readColors(state: EngineState) {\n  const style = getComputedStyle(state.canvas);\n  const accent = style.getPropertyValue('--primary').trim();\n  state.ink = style.color;\n  state.accent = accent || style.color;\n}\n\nfunction place(node: MovingNode) {\n  const x = node.x - node.halfWidth;\n  const y = node.y - node.halfHeight;\n  node.element.style.transform = `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px)`;\n}\n\nfunction strokeGuide(pen: CanvasRenderingContext2D, guide: Guide) {\n  pen.beginPath();\n  if (guide.kind === 'ellipse') {\n    pen.ellipse(guide.x, guide.y, guide.rx, guide.ry, 0, 0, Math.PI * 2);\n  } else {\n    pen.moveTo(guide.x1, guide.y1);\n    pen.lineTo(guide.x2, guide.y2);\n  }\n  pen.stroke();\n}\n\nfunction drawGuides(state: EngineState) {\n  const { pen } = state;\n  pen.strokeStyle = state.ink;\n  pen.lineWidth = 1;\n  for (const id of LAYOUT_IDS) {\n    const level = state.guideLevel[id];\n    if (level < GUIDE_REST) {\n      continue;\n    }\n    pen.globalAlpha = level * GUIDE_ALPHA;\n    const arrangement = state.arrangements.get(id);\n    for (const guide of arrangement?.guides ?? []) {\n      strokeGuide(pen, guide);\n    }\n  }\n}\n\nfunction isLinkOf(link: GraphLink, id: string | null) {\n  if (id === null) {\n    return false;\n  }\n  const isAccount = link.accountId === id;\n  const isContact = link.contactId === id;\n  return isAccount || isContact;\n}\n\nfunction strokeLinks(\n  state: EngineState,\n  links: GraphLink[],\n  color: string,\n  alpha: number,\n  width: number\n) {\n  const { pen } = state;\n  pen.strokeStyle = color;\n  pen.globalAlpha = alpha;\n  pen.lineWidth = width;\n  pen.beginPath();\n  for (const link of links) {\n    const account = state.byId.get(link.accountId);\n    const contact = state.byId.get(link.contactId);\n    if (!account || !contact) {\n      continue;\n    }\n    pen.moveTo(account.x, account.y);\n    pen.lineTo(contact.x, contact.y);\n  }\n  pen.stroke();\n}\n\nfunction draw(state: EngineState) {\n  const { pen, stage } = state;\n  pen.globalAlpha = 1;\n  pen.lineCap = 'round';\n  pen.clearRect(0, 0, stage.width, stage.height);\n  drawGuides(state);\n  const selected = GRAPH_LINKS.filter((link) =>\n    isLinkOf(link, state.selectedId)\n  );\n  const previewed = GRAPH_LINKS.filter((link) =>\n    isLinkOf(link, state.previewId)\n  );\n  const quiet = GRAPH_LINKS.filter((link) => !selected.includes(link));\n  strokeLinks(state, quiet, state.ink, LINK_ALPHA, LINK_WIDTH);\n  strokeLinks(state, previewed, state.accent, PREVIEW_ALPHA, PREVIEW_WIDTH);\n  strokeLinks(state, selected, state.accent, SELECTED_ALPHA, SELECTED_WIDTH);\n  pen.globalAlpha = 1;\n}\n\nfunction reveal(state: EngineState) {\n  if (state.isRevealed) {\n    return;\n  }\n  state.isRevealed = true;\n  for (const node of state.nodes) {\n    node.element.style.visibility = 'visible';\n  }\n}\n\nfunction settle(state: EngineState) {\n  const arrangement = state.arrangements.get(state.layout);\n  for (const node of state.nodes) {\n    const spot = arrangement?.places.get(node.id);\n    if (spot) {\n      node.x = spot.x;\n      node.y = spot.y;\n    }\n    node.fromX = node.x;\n    node.fromY = node.y;\n    node.toX = node.x;\n    node.toY = node.y;\n    place(node);\n  }\n  state.guideLevel = { ...state.guideGoal };\n  draw(state);\n  reveal(state);\n}\n\nfunction measure(state: EngineState) {\n  const box = state.canvas.getBoundingClientRect();\n  const hasRoom = box.width > 0 && box.height > 0;\n  if (!hasRoom) {\n    return;\n  }\n  const devicePixelRatio = window.devicePixelRatio || 1;\n  const pixelRatio = Math.min(devicePixelRatio, MAX_PIXEL_RATIO);\n  state.stage = { width: box.width, height: box.height };\n  state.canvas.width = Math.round(box.width * pixelRatio);\n  state.canvas.height = Math.round(box.height * pixelRatio);\n  state.pen.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n  for (const id of LAYOUT_IDS) {\n    state.arrangements.set(id, arrangementOf(id, state.stage));\n  }\n  for (const node of state.nodes) {\n    node.halfWidth = node.element.offsetWidth / 2;\n    node.halfHeight = node.element.offsetHeight / 2;\n  }\n  settle(state);\n}\n\nfunction tick(state: EngineState, now: number) {\n  const elapsed = now - state.startedAt;\n  const sinceLast = Math.max(now - state.lastTick, 0);\n  state.lastTick = now;\n  let isMoving = false;\n  for (const node of state.nodes) {\n    const raw = (elapsed - node.delay) / GLIDE_MS;\n    const progress = clamp01(raw);\n    const eased = easeInOut(progress);\n    node.x = node.fromX + (node.toX - node.fromX) * eased;\n    node.y = node.fromY + (node.toY - node.fromY) * eased;\n    place(node);\n    if (progress < 1) {\n      isMoving = true;\n    }\n  }\n  const fadeStep = sinceLast / GUIDE_FADE_MS;\n  let isFading = false;\n  for (const id of LAYOUT_IDS) {\n    const goal = state.guideGoal[id];\n    const level = state.guideLevel[id];\n    const gap = goal - level;\n    const size = Math.min(Math.abs(gap), fadeStep);\n    const next = level + Math.sign(gap) * size;\n    const remaining = Math.abs(goal - next);\n    const isArrived = remaining <= GUIDE_REST;\n    if (isArrived) {\n      state.guideLevel[id] = goal;\n      continue;\n    }\n    state.guideLevel[id] = next;\n    isFading = true;\n  }\n  draw(state);\n  if (isMoving || isFading) {\n    state.frame = requestAnimationFrame((next) => tick(state, next));\n    return;\n  }\n  state.frame = 0;\n}\n\nfunction wake(state: EngineState) {\n  const isAsleep = state.frame === 0;\n  if (!state.isLive || !isAsleep) {\n    return;\n  }\n  const now = performance.now();\n  state.lastTick = now;\n  state.frame = requestAnimationFrame((next) => tick(state, next));\n}\n\nfunction setLayout(state: EngineState, layout: LayoutId, shouldGlide: boolean) {\n  state.layout = layout;\n  state.guideGoal = levelsOf(layout);\n  const arrangement = state.arrangements.get(layout);\n  const wantsGlide = shouldGlide && state.isLive;\n  const canGlide = wantsGlide && arrangement !== undefined;\n  if (!canGlide) {\n    cancelAnimationFrame(state.frame);\n    state.frame = 0;\n    settle(state);\n    return;\n  }\n  for (const node of state.nodes) {\n    const spot = arrangement.places.get(node.id);\n    node.fromX = node.x;\n    node.fromY = node.y;\n    node.toX = spot?.x ?? node.x;\n    node.toY = spot?.y ?? node.y;\n  }\n  state.startedAt = performance.now();\n  wake(state);\n}\n\nfunction setLive(state: EngineState, isLive: boolean) {\n  state.isLive = isLive;\n  if (isLive) {\n    return;\n  }\n  cancelAnimationFrame(state.frame);\n  state.frame = 0;\n  settle(state);\n}\n\nfunction setHighlight(\n  state: EngineState,\n  selectedId: string | null,\n  previewId: string | null\n) {\n  state.selectedId = selectedId;\n  state.previewId = previewId;\n  const isRunning = state.frame !== 0;\n  if (!isRunning) {\n    draw(state);\n  }\n}\n\n/**\n * The links and the guides of the graph are drawn on one canvas, and every node is a real button\n * the engine moves with a transform. Frames are asked for only while a layout change is gliding:\n * at rest nothing runs, and a change while the graph is off screen or under reduced motion lands at once.\n */\nexport function createGraphEngine(\n  canvas: HTMLCanvasElement,\n  plane: HTMLElement,\n  layout: LayoutId\n): GraphEngine | null {\n  const pen = canvas.getContext('2d');\n  if (!pen) {\n    return null;\n  }\n  const nodes = nodesOf(plane);\n  const byId = new Map(nodes.map((node) => [node.id, node]));\n  const state: EngineState = {\n    canvas,\n    pen,\n    nodes,\n    byId,\n    stage: { width: 0, height: 0 },\n    layout,\n    arrangements: new Map(),\n    guideLevel: levelsOf(layout),\n    guideGoal: levelsOf(layout),\n    selectedId: null,\n    previewId: null,\n    ink: 'currentcolor',\n    accent: 'currentcolor',\n    isLive: false,\n    isRevealed: false,\n    frame: 0,\n    startedAt: 0,\n    lastTick: 0,\n  };\n  readColors(state);\n\n  function onResize() {\n    measure(state);\n  }\n\n  function onTheme() {\n    readColors(state);\n    draw(state);\n  }\n\n  measure(state);\n  const sizeObserver = new ResizeObserver(onResize);\n  const themeObserver = new MutationObserver(onTheme);\n  sizeObserver.observe(canvas);\n  themeObserver.observe(document.documentElement, {\n    attributes: true,\n    attributeFilter: ['class', 'data-theme'],\n  });\n\n  return {\n    setLayout: (next, shouldGlide) => setLayout(state, next, shouldGlide),\n    setHighlight: (selectedId, previewId) =>\n      setHighlight(state, selectedId, previewId),\n    setLive: (isLive) => setLive(state, isLive),\n    dispose() {\n      cancelAnimationFrame(state.frame);\n      state.frame = 0;\n      sizeObserver.disconnect();\n      themeObserver.disconnect();\n    },\n  };\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/graph-engine.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/graph-layouts.ts",
      "content": "import { hashOf } from '@/registry/ndeko/lib/seeded';\n\nimport { ACCOUNTS, contactsOf } from './data';\n\nexport type LayoutId = 'cluster' | 'rings' | 'grid' | 'orbit' | 'radial';\n\nexport type LayoutOption = {\n  value: LayoutId;\n  label: string;\n};\n\nexport const LAYOUT_OPTIONS: LayoutOption[] = [\n  { value: 'cluster', label: 'Cluster' },\n  { value: 'rings', label: 'Rings' },\n  { value: 'grid', label: 'Grid' },\n  { value: 'orbit', label: 'Orbit' },\n  { value: 'radial', label: 'Radial' },\n];\n\nexport const LAYOUT_IDS: LayoutId[] = LAYOUT_OPTIONS.map(\n  (option) => option.value\n);\n\nexport type Box = {\n  width: number;\n  height: number;\n};\n\nexport type Place = {\n  x: number;\n  y: number;\n};\n\nexport type Guide =\n  | { kind: 'ellipse'; x: number; y: number; rx: number; ry: number }\n  | { kind: 'line'; x1: number; y1: number; x2: number; y2: number };\n\nexport type Arrangement = {\n  places: Map<string, Place>;\n  guides: Guide[];\n};\n\n/** The room kept round the nodes, so no node touches the edge of the stage. */\nexport const STAGE_PAD_PX = 22;\n\nconst DEGREE = Math.PI / 180;\n\nconst FULL_TURN = 360;\n\nconst SIDE_TURN = FULL_TURN / ACCOUNTS.length;\n\nfunction clamp(value: number, min: number, max: number) {\n  const atLeastMin = Math.max(value, min);\n  return Math.min(atLeastMin, max);\n}\n\n/** The same node always lands on the same offset, so a layout never shuffles between two renders. */\nfunction jitterOf(seed: string, span: number) {\n  const hash = hashOf(seed);\n  const share = (hash % 1000) / 1000;\n  const centred = share * 2 - 1;\n  return centred * span;\n}\n\nfunction pointOnEllipse(\n  center: Place,\n  rx: number,\n  ry: number,\n  degrees: number\n): Place {\n  const angle = degrees * DEGREE;\n  const offsetX = rx * Math.cos(angle);\n  const offsetY = ry * Math.sin(angle);\n  return { x: center.x + offsetX, y: center.y + offsetY };\n}\n\nfunction ellipseGuide(center: Place, rx: number, ry: number): Guide {\n  return { kind: 'ellipse', x: center.x, y: center.y, rx, ry };\n}\n\ntype Radii = {\n  rx: number;\n  ry: number;\n};\n\n/** A wide stage gets wide rings, up to twice as wide as tall, so the room beside the rings is used. */\nfunction radiiOf(inner: Box): Radii {\n  const ry = inner.height / 2;\n  const widest = ry * 2;\n  const rx = Math.min(inner.width / 2, widest);\n  return { rx, ry };\n}\n\nfunction centerOf(inner: Box): Place {\n  return { x: inner.width / 2, y: inner.height / 2 };\n}\n\nfunction sideOf(slot: number) {\n  if (slot === 0) {\n    return -1;\n  }\n  return 1;\n}\n\nfunction degreesOfAccount(index: number, first: number) {\n  const turn = index * SIDE_TURN;\n  return first + turn;\n}\n\n/** Under this width the clusters stand two across and three down, so each keeps room for its contacts. */\nconst NARROW_CLUSTER_PX = 360;\n\nconst CLUSTER_ANGLES = [145, 35];\n\ntype Grid = {\n  columns: number;\n  rows: number;\n};\n\nfunction clusterGridOf(inner: Box): Grid {\n  if (inner.width < NARROW_CLUSTER_PX) {\n    return { columns: 2, rows: 3 };\n  }\n  return { columns: 3, rows: 2 };\n}\n\nfunction clusterOf(inner: Box): Arrangement {\n  const { columns, rows } = clusterGridOf(inner);\n  const cellWidth = inner.width / columns;\n  const cellHeight = inner.height / rows;\n  const room = Math.min(cellWidth, cellHeight);\n  const spread = clamp(room * 0.34, 38, 46);\n  const territory = spread + 18;\n  const places = new Map<string, Place>();\n  const guides: Guide[] = [];\n  ACCOUNTS.forEach((account, index) => {\n    const column = index % columns;\n    const row = Math.floor(index / columns);\n    const driftX = jitterOf(`${account.id}-x`, cellWidth * 0.05);\n    const driftY = jitterOf(`${account.id}-y`, cellHeight * 0.04);\n    const cellX = (column + 0.5) * cellWidth;\n    const cellY = (row + 0.5) * cellHeight;\n    const home: Place = {\n      x: cellX + driftX,\n      y: cellY + driftY - spread * 0.3,\n    };\n    places.set(account.id, home);\n    contactsOf(account.id).forEach((contact, slot) => {\n      const turn = jitterOf(contact.id, 9);\n      const degrees = CLUSTER_ANGLES[slot] + turn;\n      const place = pointOnEllipse(home, spread, spread, degrees);\n      places.set(contact.id, place);\n    });\n    const middle: Place = { x: home.x, y: home.y + spread * 0.33 };\n    guides.push(ellipseGuide(middle, territory, territory));\n  });\n  return { places, guides };\n}\n\nconst RING_SLOT_TURN = 14;\n\nfunction ringsOf(inner: Box): Arrangement {\n  const center = centerOf(inner);\n  const { rx, ry } = radiiOf(inner);\n  const innerRx = rx * 0.5;\n  const innerRy = ry * 0.5;\n  const places = new Map<string, Place>();\n  ACCOUNTS.forEach((account, index) => {\n    const degrees = degreesOfAccount(index, -90);\n    const home = pointOnEllipse(center, innerRx, innerRy, degrees);\n    places.set(account.id, home);\n    contactsOf(account.id).forEach((contact, slot) => {\n      const turn = sideOf(slot) * RING_SLOT_TURN;\n      const outer = pointOnEllipse(center, rx, ry, degrees + turn);\n      places.set(contact.id, outer);\n    });\n  });\n  const guides = [\n    ellipseGuide(center, innerRx, innerRy),\n    ellipseGuide(center, rx, ry),\n  ];\n  return { places, guides };\n}\n\nconst GRID_COLUMN_SHARES = [0.14, 0.5, 0.86];\n\nfunction gridOf(inner: Box): Arrangement {\n  const rowHeight = inner.height / ACCOUNTS.length;\n  const places = new Map<string, Place>();\n  ACCOUNTS.forEach((account, index) => {\n    const y = (index + 0.5) * rowHeight;\n    const accountX = inner.width * GRID_COLUMN_SHARES[0];\n    places.set(account.id, { x: accountX, y });\n    contactsOf(account.id).forEach((contact, slot) => {\n      const x = inner.width * GRID_COLUMN_SHARES[slot + 1];\n      places.set(contact.id, { x, y });\n    });\n  });\n  return { places, guides: [] };\n}\n\nconst SATELLITE_TURN = 50;\n\nfunction orbitOf(inner: Box): Arrangement {\n  const center = centerOf(inner);\n  const { rx, ry } = radiiOf(inner);\n  const orbitRx = rx * 0.68;\n  const orbitRy = ry * 0.68;\n  const satellite = clamp(ry * 0.34, 40, 48);\n  const places = new Map<string, Place>();\n  const guides: Guide[] = [ellipseGuide(center, orbitRx, orbitRy)];\n  ACCOUNTS.forEach((account, index) => {\n    const degrees = degreesOfAccount(index, -90);\n    const home = pointOnEllipse(center, orbitRx, orbitRy, degrees);\n    places.set(account.id, home);\n    guides.push(ellipseGuide(home, satellite, satellite));\n    contactsOf(account.id).forEach((contact, slot) => {\n      const turn = sideOf(slot) * SATELLITE_TURN;\n      const place = pointOnEllipse(home, satellite, satellite, degrees + turn);\n      places.set(contact.id, place);\n    });\n  });\n  return { places, guides };\n}\n\nconst RADIAL_FIRST_DEGREES = -60;\n\nconst RADIAL_SLOT_TURN = 11;\n\nfunction radialOf(inner: Box): Arrangement {\n  const center = centerOf(inner);\n  const { rx, ry } = radiiOf(inner);\n  const nearRx = rx * 0.4;\n  const nearRy = ry * 0.4;\n  const places = new Map<string, Place>();\n  const guides: Guide[] = [];\n  ACCOUNTS.forEach((account, index) => {\n    const degrees = degreesOfAccount(index, RADIAL_FIRST_DEGREES);\n    const near = pointOnEllipse(center, nearRx, nearRy, degrees);\n    const far = pointOnEllipse(center, rx, ry, degrees);\n    places.set(account.id, near);\n    guides.push({\n      kind: 'line',\n      x1: center.x,\n      y1: center.y,\n      x2: far.x,\n      y2: far.y,\n    });\n    contactsOf(account.id).forEach((contact, slot) => {\n      const turn = sideOf(slot) * RADIAL_SLOT_TURN;\n      const outer = pointOnEllipse(center, rx, ry, degrees + turn);\n      places.set(contact.id, outer);\n    });\n  });\n  return { places, guides };\n}\n\nconst ARRANGERS: Record<LayoutId, (inner: Box) => Arrangement> = {\n  cluster: clusterOf,\n  rings: ringsOf,\n  grid: gridOf,\n  orbit: orbitOf,\n  radial: radialOf,\n};\n\nfunction shiftedGuide(guide: Guide): Guide {\n  if (guide.kind === 'ellipse') {\n    return {\n      ...guide,\n      x: guide.x + STAGE_PAD_PX,\n      y: guide.y + STAGE_PAD_PX,\n    };\n  }\n  return {\n    kind: 'line',\n    x1: guide.x1 + STAGE_PAD_PX,\n    y1: guide.y1 + STAGE_PAD_PX,\n    x2: guide.x2 + STAGE_PAD_PX,\n    y2: guide.y2 + STAGE_PAD_PX,\n  };\n}\n\nexport function arrangementOf(layout: LayoutId, stage: Box): Arrangement {\n  const room = STAGE_PAD_PX * 2;\n  const inner: Box = {\n    width: Math.max(stage.width - room, 1),\n    height: Math.max(stage.height - room, 1),\n  };\n  const raw = ARRANGERS[layout](inner);\n  const places = new Map<string, Place>();\n  for (const [id, place] of raw.places) {\n    const x = place.x + STAGE_PAD_PX;\n    const y = place.y + STAGE_PAD_PX;\n    places.set(id, { x, y });\n  }\n  const guides = raw.guides.map(shiftedGuide);\n  return { places, guides };\n}\n\nexport function layoutNameOf(layout: LayoutId) {\n  const option = LAYOUT_OPTIONS.find((candidate) => candidate.value === layout);\n  return option?.label ?? '';\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/graph-layouts.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/graph-node.tsx",
      "content": "'use client';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\n\nimport {\n  accountOf,\n  contactOf,\n  spokenNodeOf,\n  type GraphNode,\n  type NodeKind,\n} from './data';\n\n/** The engine reveals a node once it knows where the node stands, so none is ever seen at the corner. */\nconst HIDDEN: React.CSSProperties = { visibility: 'hidden' };\n\nconst NODE =\n  'absolute top-0 left-0 grid cursor-pointer place-items-center outline-none transition-[opacity,box-shadow,scale,background-color] duration-150 ease-(--ease-out-strong) hover:bg-foreground/[0.05] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card active:scale-[0.94]';\n\nconst SHAPE: Record<NodeKind, string> = {\n  account: 'size-9 rounded-lg',\n  contact: 'size-8 rounded-full',\n};\n\nconst SELECTED_RING = 'ring-2 ring-primary ring-offset-2 ring-offset-card';\n\nfunction selectedClassOf(isSelected: boolean) {\n  if (isSelected) {\n    return SELECTED_RING;\n  }\n  return undefined;\n}\n\nfunction dimmedClassOf(isDimmed: boolean) {\n  if (isDimmed) {\n    return 'opacity-40';\n  }\n  return undefined;\n}\n\nfunction Face({ node }: { node: GraphNode }) {\n  if (node.kind === 'account') {\n    const account = accountOf(node.id);\n    return <CompanyMark seed={account.name} size='lg' />;\n  }\n  const contact = contactOf(node.id);\n  const name = contact?.name ?? node.id;\n  return <Avatar className='size-6' seed={name} />;\n}\n\ntype GraphNodeButtonProps = {\n  node: GraphNode;\n  isSelected: boolean;\n  isDimmed: boolean;\n  isPressed: boolean;\n  tabIndex: 0 | -1;\n  onSelect: (id: string) => void;\n  onPreview: (id: string | null) => void;\n  onFocusNode: (id: string) => void;\n};\n\nexport function GraphNodeButton({\n  node,\n  isSelected,\n  isDimmed,\n  isPressed,\n  tabIndex,\n  onSelect,\n  onPreview,\n  onFocusNode,\n}: GraphNodeButtonProps) {\n  const { id } = node;\n\n  function select() {\n    onSelect(id);\n  }\n\n  function preview() {\n    onPreview(id);\n  }\n\n  function endPreview() {\n    onPreview(null);\n  }\n\n  function focusNode() {\n    onFocusNode(id);\n    onPreview(id);\n  }\n\n  return (\n    <button\n      type='button'\n      data-node={id}\n      aria-label={spokenNodeOf(id)}\n      aria-pressed={isSelected}\n      tabIndex={tabIndex}\n      style={HIDDEN}\n      onClick={select}\n      onPointerEnter={preview}\n      onPointerLeave={endPreview}\n      onFocus={focusNode}\n      onBlur={endPreview}\n      className={cn(\n        NODE,\n        SHAPE[node.kind],\n        selectedClassOf(isSelected),\n        dimmedClassOf(isDimmed),\n        pressedQuietOf(isPressed)\n      )}\n    >\n      <Face node={node} />\n    </button>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/graph-node.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/lead-trend.tsx",
      "content": "'use client';\n\nimport { useId, useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { countOf } from '@/registry/ndeko/lib/words';\n\nimport { NEW_LEADS, TREND_WEEKS } from './data';\nimport { rovingTargetOf } from './roving';\n\nconst VIEW_WIDTH = 1000;\n\nconst PLOT_HEIGHT = 144;\n\nconst TOP_VALUE = 80;\n\nconst TICKS = [0, 40, 80];\n\nconst LAST_INDEX = NEW_LEADS.length - 1;\n\nconst LABEL_EVERY = 3;\n\nfunction yOf(value: number) {\n  const share = value / TOP_VALUE;\n  return PLOT_HEIGHT - share * PLOT_HEIGHT;\n}\n\nfunction xShareOf(index: number) {\n  return index / LAST_INDEX;\n}\n\nfunction commandLetterOf(index: number) {\n  if (index === 0) {\n    return 'M';\n  }\n  return 'L';\n}\n\nfunction linePathOf() {\n  const commands = NEW_LEADS.map((value, index) => {\n    const x = xShareOf(index) * VIEW_WIDTH;\n    const y = yOf(value);\n    const letter = commandLetterOf(index);\n    return `${letter}${x.toFixed(1)} ${y.toFixed(1)}`;\n  });\n  return commands.join(' ');\n}\n\nconst LINE_PATH = linePathOf();\n\nconst AREA_PATH = `${LINE_PATH} L${VIEW_WIDTH} ${PLOT_HEIGHT} L0 ${PLOT_HEIGHT} Z`;\n\nfunction isLabeled(index: number) {\n  const fromLast = LAST_INDEX - index;\n  return fromLast % LABEL_EVERY === 0;\n}\n\nconst LABELED = TREND_WEEKS.map((week, index) => ({ week, index })).filter(\n  ({ index }) => isLabeled(index)\n);\n\nfunction clampIndex(index: number) {\n  const atLeastFirst = Math.max(index, 0);\n  return Math.min(atLeastFirst, LAST_INDEX);\n}\n\nfunction weekLabelOf(index: number) {\n  if (index === LAST_INDEX) {\n    return 'This week';\n  }\n  return `Week of ${TREND_WEEKS[index]}`;\n}\n\nfunction changeOf(index: number) {\n  if (index === 0) {\n    return 'the first week shown';\n  }\n  const before = NEW_LEADS[index - 1];\n  const difference = NEW_LEADS[index] - before;\n  const ratio = difference / before;\n  const percent = Math.round(ratio * 100);\n  if (percent === 0) {\n    return 'level with the week before';\n  }\n  if (percent > 0) {\n    return `up ${percent}% on the week before`;\n  }\n  return `down ${Math.abs(percent)}% on the week before`;\n}\n\nexport function LeadTrend() {\n  const titleId = useId();\n  const [reading, setReading] = useState<number | null>(null);\n  const shownIndex = reading ?? LAST_INDEX;\n  const value = NEW_LEADS[shownIndex];\n  const label = weekLabelOf(shownIndex);\n  const caption = `${label}, ${changeOf(shownIndex)}`;\n  const guideShare = xShareOf(shownIndex);\n  const spoken = `${TREND_WEEKS[shownIndex]}, ${countOf(value, 'new lead')}`;\n\n  function readFromPointer(event: React.PointerEvent<HTMLDivElement>) {\n    const box = event.currentTarget.getBoundingClientRect();\n    const ratio = (event.clientX - box.left) / box.width;\n    const index = Math.round(ratio * LAST_INDEX);\n    setReading(clampIndex(index));\n  }\n\n  function readFromKeys(event: React.KeyboardEvent<HTMLDivElement>) {\n    if (event.key === 'Escape') {\n      setReading(null);\n      return;\n    }\n    const next = rovingTargetOf(event.key, shownIndex, NEW_LEADS.length);\n    if (next === null) {\n      return;\n    }\n    event.preventDefault();\n    setReading(next);\n  }\n\n  function stopReading() {\n    setReading(null);\n  }\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col gap-4 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex flex-col gap-1'>\n        <h2 id={titleId} className='text-sm font-medium'>\n          New leads\n        </h2>\n        <p className='flex items-baseline gap-1.5'>\n          <MotionNumber\n            value={value}\n            className='text-2xl leading-8 font-semibold'\n          />\n          <span className='text-muted-foreground text-[13px]'>new leads</span>\n        </p>\n        <p className='text-muted-foreground text-xs'>{caption}</p>\n      </header>\n      <div className='grid grid-cols-[auto_minmax(0,1fr)] gap-x-2'>\n        <div\n          aria-hidden='true'\n          className='relative w-6 shrink-0'\n          style={{ height: PLOT_HEIGHT }}\n        >\n          {TICKS.map((tick) => (\n            <span\n              key={tick}\n              className='text-muted-foreground absolute right-0 -translate-y-1/2 text-[11px] tabular-nums'\n              style={{ top: yOf(tick) }}\n            >\n              {tick}\n            </span>\n          ))}\n        </div>\n        <div\n          role='slider'\n          tabIndex={0}\n          aria-label='New leads by week. The arrow keys read each week'\n          aria-orientation='horizontal'\n          aria-valuemin={0}\n          aria-valuemax={LAST_INDEX}\n          aria-valuenow={shownIndex}\n          aria-valuetext={spoken}\n          onPointerMove={readFromPointer}\n          onPointerLeave={stopReading}\n          onKeyDown={readFromKeys}\n          onBlur={stopReading}\n          className='focus-visible:ring-ring/25 @container relative touch-pan-y rounded-md outline-none focus-visible:ring-[3px]'\n          style={{ height: PLOT_HEIGHT }}\n        >\n          {TICKS.map((tick) => (\n            <span\n              key={tick}\n              aria-hidden='true'\n              className='hairline-t border-border pointer-events-none absolute inset-x-0'\n              style={{ top: yOf(tick) }}\n            />\n          ))}\n          <svg\n            aria-hidden='true'\n            viewBox={`0 0 ${VIEW_WIDTH} ${PLOT_HEIGHT}`}\n            preserveAspectRatio='none'\n            className='pointer-events-none absolute inset-0 size-full overflow-visible'\n          >\n            <path d={AREA_PATH} className='fill-primary/10' />\n            <path\n              d={LINE_PATH}\n              vectorEffect='non-scaling-stroke'\n              className='stroke-primary fill-none stroke-2 [stroke-linecap:round] [stroke-linejoin:round]'\n            />\n          </svg>\n          <div\n            aria-hidden='true'\n            className='pointer-events-none absolute inset-y-0 left-0 w-0 transition-transform duration-150 ease-(--ease-out-strong)'\n            style={{ transform: `translateX(${guideShare * 100}cqw)` }}\n          >\n            <span className='bg-foreground/15 absolute inset-y-0 w-px -translate-x-1/2' />\n            <span\n              className='bg-primary ring-card absolute size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 transition-[top] duration-150 ease-(--ease-out-strong)'\n              style={{ top: yOf(value) }}\n            />\n          </div>\n        </div>\n        <div className='col-start-2 row-start-2 mt-2 h-4'>\n          <div aria-hidden='true' className='relative'>\n            {LABELED.map(({ week, index }) => (\n              <span\n                key={week}\n                className='text-muted-foreground absolute top-0 text-[11px] whitespace-nowrap tabular-nums'\n                style={{\n                  left: `${xShareOf(index) * 100}%`,\n                  transform: `translateX(-${xShareOf(index) * 100}%)`,\n                }}\n              >\n                {week}\n              </span>\n            ))}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/lead-trend.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/morph-path.tsx",
      "content": "'use client';\n\nimport { motion, type Transition } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { EASE_OUT_STRONG, INSTANT } from '@/registry/ndeko/lib/motion-presets';\n\nconst MORPH: Transition = { duration: 0.45, ease: EASE_OUT_STRONG };\n\nfunction transitionOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return MORPH;\n}\n\ntype MorphPathProps = {\n  d: string;\n  className?: string;\n  style?: React.CSSProperties;\n};\n\n/** A shape that glides to its new outline when the data changes, as long as both outlines have the same number of points. */\nexport function MorphPath({ d, className, style }: MorphPathProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <motion.path\n      initial={false}\n      animate={{ d }}\n      transition={transitionOf(shouldReduceMotion)}\n      vectorEffect='non-scaling-stroke'\n      className={className}\n      style={style}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/morph-path.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/page-header.tsx",
      "content": "'use client';\n\nimport { MenuIcon } from '@/registry/ndeko/lib/icons';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\ntype PageHeaderProps = {\n  canReplay: boolean;\n  onReplay: () => void;\n  onOpenMenu: () => void;\n};\n\nexport function PageHeader({\n  canReplay,\n  onReplay,\n  onOpenMenu,\n}: PageHeaderProps) {\n  return (\n    <header className='flex h-12 shrink-0 items-center gap-2 px-3'>\n      <Button\n        type='button'\n        variant='ghost'\n        size='icon-sm'\n        data-menu-open\n        aria-label='Open the sections'\n        aria-haspopup='dialog'\n        onClick={onOpenMenu}\n        className='text-muted-foreground @3xl:hidden'\n      >\n        <MenuIcon />\n      </Button>\n      <h1 className='ps-1 text-sm font-medium'>Overview</h1>\n      <Badge variant='secondary'>Illustrative data</Badge>\n      <span className='ms-auto'>\n        <ReplayButton isShown={canReplay} onReplay={onReplay} label='Replay' />\n      </span>\n    </header>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/page-header.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/pipeline-funnel.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { STAGES } from './data';\nimport { MorphPath } from './morph-path';\n\nconst VIEW_WIDTH = 1000;\n\nconst ROW_HEIGHT = 40;\n\nconst ROW_GAP = 4;\n\nconst MIN_SHARE = 0.12;\n\nconst NECK = 0.86;\n\nconst FUNNEL_HEIGHT = ROW_HEIGHT * STAGES.length;\n\n/** The first four stages are the primary colour, fading as the funnel narrows. The last one is a won deal. */\nconst ROW_FILL = [\n  'fill-primary/90',\n  'fill-primary/75',\n  'fill-primary/60',\n  'fill-primary/45',\n  'fill-success/80',\n];\n\nfunction sharesOf(counts: number[]) {\n  const first = counts[0];\n  return counts.map((count) => {\n    if (first === 0) {\n      return MIN_SHARE;\n    }\n    return Math.max(count / first, MIN_SHARE);\n  });\n}\n\nfunction bottomShareOf(index: number, shares: number[]) {\n  const next = shares[index + 1];\n  if (next === undefined) {\n    return shares[index] * NECK;\n  }\n  return next;\n}\n\n/** A row runs from the width of its stage to the width of the next one, so the rows join into one funnel. */\nfunction rowPathOf(index: number, shares: number[]) {\n  const half = VIEW_WIDTH / 2;\n  const topHalf = shares[index] * half;\n  const bottomHalf = bottomShareOf(index, shares) * half;\n  const top = index * ROW_HEIGHT + ROW_GAP / 2;\n  const bottom = (index + 1) * ROW_HEIGHT - ROW_GAP / 2;\n  const topLeft = half - topHalf;\n  const topRight = half + topHalf;\n  const bottomLeft = half - bottomHalf;\n  const bottomRight = half + bottomHalf;\n  return `M${topLeft} ${top} L${topRight} ${top} L${bottomRight} ${bottom} L${bottomLeft} ${bottom} Z`;\n}\n\nfunction moveOnOf(count: number, before: number) {\n  if (before === 0) {\n    return 0;\n  }\n  return Math.round((count / before) * 100);\n}\n\ntype PipelineFunnelProps = {\n  counts: number[];\n};\n\nexport function PipelineFunnel({ counts }: PipelineFunnelProps) {\n  const titleId = useId();\n  const shares = sharesOf(counts);\n\n  return (\n    <section\n      data-section='pipeline'\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex scroll-mt-4 flex-col gap-4 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex flex-col leading-tight'>\n        <h2 id={titleId} className='text-sm font-medium'>\n          Pipeline\n        </h2>\n        <p className='text-muted-foreground text-xs'>\n          Deals that reached each stage\n        </p>\n      </header>\n      <div className='grid grid-cols-[9.5rem_minmax(0,1fr)] gap-x-3'>\n        <ol aria-label='Deals by stage' className='flex flex-col'>\n          {STAGES.map((stage, index) => {\n            const before = counts[index - 1] ?? 0;\n            const share = moveOnOf(counts[index], before);\n            const hasShare = index > 0;\n            return (\n              <li\n                key={stage.id}\n                className='flex h-10 items-center gap-2 text-[13px]'\n              >\n                <span className='text-muted-foreground min-w-0 flex-1 truncate'>\n                  {stage.label}\n                </span>\n                <MotionNumber\n                  value={counts[index]}\n                  className='w-9 justify-end font-medium'\n                />\n                <span\n                  className={cn(\n                    'text-muted-foreground hidden w-9 text-end text-xs tabular-nums @md/page:block',\n                    !hasShare && 'invisible'\n                  )}\n                >\n                  {share}%<span className='sr-only'> of the stage before</span>\n                </span>\n              </li>\n            );\n          })}\n        </ol>\n        <svg\n          aria-hidden='true'\n          viewBox={`0 0 ${VIEW_WIDTH} ${FUNNEL_HEIGHT}`}\n          preserveAspectRatio='none'\n          className='w-full overflow-visible'\n          style={{ height: FUNNEL_HEIGHT }}\n        >\n          {STAGES.map((stage, index) => (\n            <MorphPath\n              key={stage.id}\n              d={rowPathOf(index, shares)}\n              className={ROW_FILL[index]}\n            />\n          ))}\n        </svg>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/pipeline-funnel.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/roving.ts",
      "content": "export function rovingTargetOf(key: string, current: number, count: number) {\n  const last = count - 1;\n  if (key === 'ArrowRight' || key === 'ArrowDown') {\n    return Math.min(current + 1, last);\n  }\n  if (key === 'ArrowLeft' || key === 'ArrowUp') {\n    return Math.max(current - 1, 0);\n  }\n  if (key === 'Home') {\n    return 0;\n  }\n  if (key === 'End') {\n    return last;\n  }\n  return null;\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/roving.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { restingOf } from '@/registry/ndeko/lib/run-session';\nimport { countOf } from '@/registry/ndeko/lib/words';\n\nimport {\n  AGENT_TASK,\n  DEMO_TASK,\n  DENIED_NOTE,\n  eventsOfDay,\n  RUN_COPY,\n  RUNS,\n  spokenNodeOf,\n  STAGE_COUNTS_AFTER,\n  STAGE_COUNTS_BEFORE,\n  STRIP,\n  taskOf,\n  TASKS,\n  type RunId,\n  type RunStatus,\n} from './data';\nimport { layoutNameOf, type LayoutId } from './graph-layouts';\n\nexport type Decision = 'approved' | 'denied';\n\nexport type RunLive = {\n  status: RunStatus;\n  note: string;\n};\n\nexport type CrmState = {\n  isLoaded: boolean;\n  layout: LayoutId;\n  selectedId: string | null;\n  taskIds: string[];\n  doneTaskIds: string[];\n  runs: Record<RunId, RunLive>;\n  stageCounts: number[];\n  dayIndex: number | null;\n  isSidebarOpen: boolean;\n  spoken: string;\n};\n\nexport type CrmAction =\n  | { type: 'loaded' }\n  | { type: 'layoutSet'; layout: LayoutId }\n  | { type: 'nodeSelected'; id: string | null }\n  | { type: 'taskToggled'; id: string }\n  | { type: 'taskAdded'; id: string }\n  | { type: 'runStarted'; id: RunId }\n  | { type: 'runFinished'; id: RunId }\n  | { type: 'decided'; id: RunId; decision: Decision }\n  | { type: 'funnelUpdated' }\n  | { type: 'daySelected'; index: number | null }\n  | { type: 'sidebar'; isOpen: boolean }\n  | { type: 'batch'; actions: CrmAction[] };\n\ntype Step = SessionStep<CrmState, CrmAction>;\n\nconst MERGE: RunId = 'merge';\n\nfunction runsOf(): Record<RunId, RunLive> {\n  const quiet: RunLive = { status: 'done', note: '' };\n  const runs: Record<RunId, RunLive> = {\n    enrich: quiet,\n    qualify: quiet,\n    drafts: quiet,\n    merge: quiet,\n  };\n  for (const seed of RUNS) {\n    runs[seed.id] = { status: seed.status, note: seed.note };\n  }\n  return runs;\n}\n\nexport const INITIAL: CrmState = {\n  isLoaded: false,\n  layout: 'cluster',\n  selectedId: null,\n  taskIds: TASKS.map((task) => task.id),\n  doneTaskIds: [],\n  runs: runsOf(),\n  stageCounts: STAGE_COUNTS_BEFORE,\n  dayIndex: null,\n  isSidebarOpen: false,\n  spoken: '',\n};\n\nfunction spokenSelectionOf(id: string | null) {\n  if (id === null) {\n    return 'Selection cleared';\n  }\n  return spokenNodeOf(id);\n}\n\nfunction taskToggled(state: CrmState, id: string): CrmState {\n  const task = taskOf(id);\n  const isDone = state.doneTaskIds.includes(id);\n  if (isDone) {\n    const doneTaskIds = state.doneTaskIds.filter((doneId) => doneId !== id);\n    return { ...state, doneTaskIds, spoken: `${task.title}, open again` };\n  }\n  const doneTaskIds = [...state.doneTaskIds, id];\n  return { ...state, doneTaskIds, spoken: `${task.title}, done` };\n}\n\nfunction taskAdded(state: CrmState, id: string): CrmState {\n  const isKnown = state.taskIds.includes(id);\n  if (isKnown) {\n    return state;\n  }\n  const taskIds = [id, ...state.taskIds];\n  return { ...state, taskIds };\n}\n\nfunction runPatched(\n  state: CrmState,\n  id: RunId,\n  from: RunStatus,\n  to: RunLive\n): CrmState {\n  const run = state.runs[id];\n  if (run.status !== from) {\n    return state;\n  }\n  return { ...state, runs: { ...state.runs, [id]: to } };\n}\n\nfunction runStarted(state: CrmState, id: RunId): CrmState {\n  const live: RunLive = { status: 'running', note: RUN_COPY[id].running };\n  return runPatched(state, id, 'queued', live);\n}\n\nfunction runFinished(state: CrmState, id: RunId): CrmState {\n  const live: RunLive = { status: 'done', note: RUN_COPY[id].done };\n  return runPatched(state, id, 'running', live);\n}\n\nfunction decided(state: CrmState, id: RunId, decision: Decision): CrmState {\n  if (decision === 'approved') {\n    const live: RunLive = { status: 'running', note: RUN_COPY[id].running };\n    const next = runPatched(state, id, 'waiting', live);\n    return { ...next, spoken: 'Allowed. Scout merges the duplicates' };\n  }\n  const live: RunLive = { status: 'done', note: DENIED_NOTE };\n  const next = runPatched(state, id, 'waiting', live);\n  return { ...next, spoken: 'Denied. Nothing is merged' };\n}\n\nfunction spokenDayOf(index: number | null) {\n  if (index === null) {\n    return 'No day selected';\n  }\n  const day = STRIP[index];\n  const events = eventsOfDay(index);\n  const count = countOf(events.length, 'event');\n  return `${day.spoken}, ${count}`;\n}\n\nexport function reducer(state: CrmState, action: CrmAction): CrmState {\n  switch (action.type) {\n    case 'loaded':\n      return { ...state, isLoaded: true };\n    case 'layoutSet': {\n      const name = layoutNameOf(action.layout);\n      return { ...state, layout: action.layout, spoken: `${name} layout` };\n    }\n    case 'nodeSelected': {\n      const spoken = spokenSelectionOf(action.id);\n      return { ...state, selectedId: action.id, spoken };\n    }\n    case 'taskToggled':\n      return taskToggled(state, action.id);\n    case 'taskAdded':\n      return taskAdded(state, action.id);\n    case 'runStarted':\n      return runStarted(state, action.id);\n    case 'runFinished':\n      return runFinished(state, action.id);\n    case 'decided':\n      return decided(state, action.id, action.decision);\n    case 'funnelUpdated':\n      return { ...state, stageCounts: STAGE_COUNTS_AFTER };\n    case 'daySelected': {\n      const spoken = spokenDayOf(action.index);\n      return { ...state, dayIndex: action.index, spoken };\n    }\n    case 'sidebar':\n      return { ...state, isSidebarOpen: action.isOpen };\n    case 'batch': {\n      let next = state;\n      for (const inner of action.actions) {\n        next = reducer(next, inner);\n      }\n      return next;\n    }\n  }\n}\n\nexport function openTaskCount(state: CrmState) {\n  const open = state.taskIds.filter((id) => !state.doneTaskIds.includes(id));\n  return open.length;\n}\n\nfunction hasDecided(state: CrmState) {\n  return state.runs[MERGE].status !== 'waiting';\n}\n\nconst DEMO_DECIDES_AFTER_MS = 2000;\n\nconst SWITCH_MS = 2600;\n\nfunction layoutStep(after: number, layout: LayoutId): Step {\n  return { after, by: 'demo', action: { type: 'layoutSet', layout } };\n}\n\nfunction frame(after: number, actions: CrmAction[]): Step {\n  return { after, action: { type: 'batch', actions } };\n}\n\nconst OPENING: Step[] = [\n  { after: 700, action: { type: 'loaded' } },\n  layoutStep(1900, 'rings'),\n  layoutStep(SWITCH_MS, 'grid'),\n  layoutStep(SWITCH_MS, 'orbit'),\n  layoutStep(SWITCH_MS, 'radial'),\n  {\n    after: SWITCH_MS,\n    by: 'demo',\n    press: 'node-esther',\n    action: { type: 'nodeSelected', id: 'esther' },\n  },\n  layoutStep(SWITCH_MS, 'cluster'),\n  frame(2400, [\n    { type: 'runFinished', id: 'qualify' },\n    { type: 'funnelUpdated' },\n    { type: 'runStarted', id: 'drafts' },\n  ]),\n  {\n    after: 1800,\n    by: 'demo',\n    press: `task-${DEMO_TASK}`,\n    action: { type: 'taskToggled', id: DEMO_TASK },\n  },\n  frame(1800, [\n    { type: 'runFinished', id: 'drafts' },\n    { type: 'taskAdded', id: AGENT_TASK.id },\n  ]),\n];\n\nconst CLOSING: Step[] = [\n  {\n    after: DEMO_DECIDES_AFTER_MS,\n    by: 'person',\n    press: 'allow',\n    action: { type: 'decided', id: MERGE, decision: 'approved' },\n    isAnswered: hasDecided,\n  },\n  { after: 1100, action: { type: 'runFinished', id: MERGE } },\n  {\n    after: 1800,\n    by: 'demo',\n    press: 'day-3',\n    action: { type: 'daySelected', index: 3 },\n  },\n  {\n    after: SWITCH_MS,\n    by: 'demo',\n    press: 'day-6',\n    action: { type: 'daySelected', index: 6 },\n  },\n];\n\nexport const SCRIPT: Step[] = [...OPENING, ...CLOSING];\n\nconst FINISHED = restingOf(INITIAL, SCRIPT, reducer);\n\n/** Under reduced motion the figures are loaded, the agent's work is done and one person of the graph is open. */\nexport const RESTING: CrmState = {\n  ...FINISHED,\n  layout: 'orbit',\n  dayIndex: 3,\n  spoken: '',\n};\n\nexport const LOOP_AFTER_MS = 3500;\n",
      "type": "registry:component",
      "target": "components/templates/application-15/session.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-15/todo-list.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Checkbox } from '@/registry/ndeko/ui/checkbox';\n\nimport { taskOf } from './data';\n\nfunction doneClassOf(isDone: boolean) {\n  if (isDone) {\n    return 'text-muted-foreground line-through decoration-foreground/30';\n  }\n  return undefined;\n}\n\ntype TaskRowProps = {\n  id: string;\n  isDone: boolean;\n  isPressed: boolean;\n  onToggle: (id: string) => void;\n};\n\nfunction TaskRow({ id, isDone, isPressed, onToggle }: TaskRowProps) {\n  const task = taskOf(id);\n\n  function toggle() {\n    onToggle(id);\n  }\n\n  return (\n    <label\n      className={cn(\n        'hover:bg-foreground/[0.04] flex cursor-pointer items-start gap-2.5 rounded-md px-2 py-2 transition-[background-color,scale] duration-150',\n        pressedQuietOf(isPressed)\n      )}\n    >\n      <Checkbox\n        checked={isDone}\n        onCheckedChange={toggle}\n        aria-label={task.title}\n        className='mt-0.5'\n      />\n      <span className='flex min-w-0 flex-1 flex-col leading-snug'>\n        <span\n          className={cn(\n            'text-[13px] transition-colors duration-200',\n            doneClassOf(isDone)\n          )}\n        >\n          {task.title}\n        </span>\n        <span className='text-muted-foreground text-xs'>{task.due}</span>\n      </span>\n    </label>\n  );\n}\n\ntype TodoListProps = {\n  taskIds: string[];\n  doneTaskIds: string[];\n  openCount: number;\n  pressed: string | null;\n  onToggle: (id: string) => void;\n};\n\nexport function TodoList({\n  taskIds,\n  doneTaskIds,\n  openCount,\n  pressed,\n  onToggle,\n}: TodoListProps) {\n  const titleId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n\n  return (\n    <section\n      data-section='tasks'\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex scroll-mt-4 flex-col gap-2 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex items-baseline gap-2'>\n        <h2 id={titleId} className='text-sm font-medium'>\n          To do\n        </h2>\n        <p className='text-muted-foreground flex items-baseline gap-1 text-xs'>\n          <MotionNumber value={openCount} />\n          <span>left</span>\n        </p>\n      </header>\n      <ul className='-mx-2 flex flex-col'>\n        <AnimatePresence initial={false}>\n          {taskIds.map((id) => (\n            <motion.li key={id} className='overflow-hidden' {...rowPresence}>\n              <TaskRow\n                id={id}\n                isDone={doneTaskIds.includes(id)}\n                isPressed={pressed === `task-${id}`}\n                onToggle={onToggle}\n              />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-15/todo-list.tsx"
    }
  ],
  "categories": [
    "templates",
    "dashboards"
  ],
  "type": "registry:block"
}