@shware/workflow-ui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["SIZE_STYLE","PALETTE","iphoneFrameUrl","pixelBackUrl","pixelMaskUrl","SIZE_STYLE","WorkflowIcon","Fragment"],"sources":["../src/utils/cn.ts","../src/components/corner-shape.ts","../src/components/button/index.tsx","../src/components/layout.ts","../src/components/workflow-canvas.tsx","../src/utils/template-content.ts","../src/components/chat-markup.tsx","../src/components/discord-preview.tsx","../src/components/email-thumbnail.tsx","../src/app/assets/devices/iphone-17-pro.png","../src/app/assets/devices/pixel-10-pro-back.webp","../src/app/assets/devices/pixel-10-pro-mask.webp","../src/components/push-preview.tsx","../src/components/slack-preview.tsx","../src/components/textarea/index.tsx","../src/components/templates-page.tsx","../src/utils/label.ts","../src/components/sparkline.tsx","../src/components/workflow-list.tsx","../src/components/metric-card.tsx","../src/components/input/index.tsx","../src/components/date-range.tsx","../src/components/channel-icon.ts","../src/components/avatar.tsx","../src/components/template-refs.ts"],"sourcesContent":["import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { CSSProperties } from 'react';\n\n/**\n * Every rounded surface that is not a full pill carries this.\n *\n * A plain border-radius leaves a visible curvature break where the arc meets\n * the straight edge; a superellipse blends the two, which is what the canvas\n * cards already do. Pills (`rounded-full`) are continuous by construction, so\n * they skip it.\n *\n * Cast because `corner-shape` is not in React's CSSProperties yet.\n */\nexport const superellipse = { cornerShape: 'superellipse(1.2)' } as CSSProperties;\n","import { clsx } from 'clsx';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { superellipse } from '../corner-shape';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-primary`, `--color-accent`, `--color-gray-*`), so a project that\n * re-themes the ramp re-themes the buttons with it.\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'button'>, 'type'> {\n size?: Size;\n children?: ReactNode;\n type?: 'submit' | 'reset' | 'button';\n variant?: 'text' | 'accent' | 'default' | 'secondary' | 'destructive' | 'outline';\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'h-7 px-3 text-xs rounded-md focus-visible:ring-2',\n sm: 'h-9 px-3 text-sm rounded-lg focus-visible:ring-3',\n md: 'h-10 px-4 text-sm rounded-xl focus-visible:ring-3',\n lg: 'h-12 px-6 text-base rounded-xl focus-visible:ring-4',\n xl: 'h-14 px-8 text-lg rounded-2xl focus-visible:ring-4',\n};\n\nconst VARIANT_STYLE = {\n text: clsx(\n 'text-primary border-none bg-transparent',\n 'hover:bg-gray-100 focus-visible:ring-black/10 active:bg-gray-200/80',\n 'dark:hover:bg-gray-800 dark:focus-visible:ring-white/20 dark:active:bg-gray-700/80'\n ),\n accent: clsx(\n 'bg-accent active:bg-accent/80 text-white',\n 'focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50'\n ),\n default: clsx(\n 'border-none bg-black text-white focus-visible:ring-black/20 dark:bg-white dark:text-black',\n 'active:bg-black/80 dark:focus-visible:ring-white/30 dark:active:bg-white/80'\n ),\n secondary: clsx(\n 'text-primary bg-gray-100 focus-visible:ring-black/10 active:bg-gray-200/80',\n 'dark:bg-gray-800 dark:focus-visible:ring-white/20 dark:active:bg-gray-700/80'\n ),\n destructive: clsx(\n 'text-white focus-visible:ring-red-400/40',\n 'bg-red-400 active:bg-red-500/90',\n 'dark:bg-red-400/70 dark:active:bg-red-400/90'\n ),\n outline: clsx(\n 'text-primary border',\n 'bg-white focus-visible:ring-black/10 active:bg-gray-100/70',\n 'dark:bg-gray-900/70 dark:focus-visible:ring-white/30 dark:active:bg-gray-900'\n ),\n};\n\nexport function Button({\n children,\n className,\n size = 'md',\n style,\n type = 'button',\n variant = 'default',\n ...props\n}: Props) {\n return (\n <button\n // oxlint-disable-next-line react/button-has-type\n type={type}\n style={{ ...superellipse, ...style }}\n className={cn(\n SIZE_STYLE[size],\n VARIANT_STYLE[variant],\n 'inline-flex items-center justify-center',\n 'text-center font-medium transition-all duration-100 focus:outline-none',\n 'disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n >\n {children}\n </button>\n );\n}\n","import type { ConditionIR, NodeIR, WorkflowIR } from '@shware/workflow';\nimport type { NodeStats } from '../config';\n\n/**\n * Tree layout: IR → react-flow nodes and edges.\n *\n * IR is a structured tree rather than an arbitrary graph, so dagre/elkjs are\n * unnecessary: a vertical spine, branch columns fanning out left and right,\n * and rejoin edges — customer.io's look, computed in a single recursion.\n * Layout is a pure function: the same IR (plus optional stats) always yields\n * the same picture.\n */\n\nexport type NodeCategory = 'trigger' | 'message' | 'delay' | 'control' | 'data' | 'exit';\n\nexport type NodeIcon =\n | 'trigger'\n | 'email'\n | 'sms'\n | 'push'\n | 'in_app'\n | 'slack'\n | 'discord'\n | 'survey'\n | 'delay'\n | 'time_window'\n | 'wait_until'\n | 'branch'\n | 'filter'\n | 'cohort'\n | 'exit'\n | 'send_event'\n | 'action';\n\nexport interface CanvasNodeData extends Record<string, unknown> {\n title: string;\n subtitle?: string;\n category: NodeCategory;\n /** card: the regular card (icon + title + subtitle + count badge); icon: icon-only pill (exit). */\n variant: 'card' | 'icon';\n icon: NodeIcon;\n /** How many users currently sit on this node (runtime stats, injected via `stats`). */\n count?: number;\n}\n\n/** Card sizes: the single source shared by layout and renderer, all on the 16/8 grid. */\nexport const CARD_SIZE = { w: 288, h: 64 } as const;\n/**\n * The icon variant renders as an auto-width pill, so only its height is known\n * here. It is laid out in a card-width box and centred inside it: guessing the\n * pill's width instead put its visual centre a couple of pixels off the column\n * the connectors are drawn down, which reads as a crooked line.\n */\nexport const ICON_SIZE = { w: CARD_SIZE.w, h: 32 } as const;\n\nexport interface CanvasNode {\n id: string;\n type: 'wf';\n position: { x: number; y: number };\n data: CanvasNodeData;\n}\n\nexport interface CanvasEdge {\n id: string;\n source: string;\n target: string;\n label?: string;\n /** Label anchor: `target` = the arm's entry corner (real arm); `source` = just below the deciding node (empty pass-through arm). */\n data?: { anchor: 'source' | 'target' };\n}\n\n/**\n * Tiered spacing: straight sequences stay tight, forks open up (room for the\n * rounded split, the hanging labels, and a future insert-action button), and\n * rejoins get slightly more than a sequence gap so merge lines have space.\n */\nconst W = CARD_SIZE.w;\nconst VGAP = 48; // node → node inside a sequence\nconst FORK_GAP = 112; // branching node's bottom → arm top (stem splits at 28, labels hang at 56)\nconst REJOIN_EXTRA = 24; // added on top of VGAP at a rejoin\nconst HGAP = 88;\n\nfunction nodeSize(n: NodeIR): { w: number; h: number } {\n return n.type === 'exit' ? ICON_SIZE : CARD_SIZE;\n}\n\n/** Common abstraction for nodes with child groups: branch cases/otherwise, cohort arms, waitUntil's timeout lane. */\ninterface Group {\n label: string;\n nodes: NodeIR[];\n}\n\n/** Property operator → label symbol (math signs for eq/ne/gt/lt; set and text operators keep short words). */\nconst OP_LABEL: Record<string, string> = {\n eq: '=',\n ne: '≠',\n gt: '>',\n lt: '<',\n between: 'between',\n in_array: 'in',\n not_in_array: 'not in',\n exists: 'exists',\n not_exists: 'not exists',\n contains: 'contains',\n not_contains: 'not contains',\n};\n\nfunction conditionLabel(c: ConditionIR, fallback: string): string {\n if (c.type === 'segment') return c.segment;\n if (c.type === 'not') return `not ${conditionLabel(c.condition, fallback)}`;\n if (c.type === 'property') {\n const op = OP_LABEL[c.op] ?? c.op;\n const value =\n c.op === 'between'\n ? `${c.values?.[0]} – ${c.values?.[1]}`\n : c.op === 'in_array' || c.op === 'not_in_array'\n ? `[${c.values?.join(', ')}]`\n : c.value !== undefined\n ? String(c.value)\n : '';\n return value === '' ? `${c.path} ${op}` : `${c.path} ${op} ${value}`;\n }\n if (c.type === 'performed') return `did ${c.event}`;\n if (c.type === 'reachable') return `reachable by ${c.channel}`;\n if (c.type === 'and' || c.type === 'or') {\n return c.conditions.map((child) => conditionLabel(child, fallback)).join(` ${c.type} `);\n }\n return fallback;\n}\n\nfunction groupsOf(n: NodeIR): Group[] | null {\n switch (n.type) {\n case 'branch': {\n const groups = n.cases.map((c, i) => ({\n label: c.label ?? conditionLabel(c.condition, `case ${i + 1}`),\n nodes: c.flow,\n }));\n groups.push({ label: 'else', nodes: n.otherwise ?? [] });\n return groups;\n }\n case 'cohort':\n return n.arms.map((a) => ({ label: `${a.name} · ${a.weight}%`, nodes: a.flow }));\n case 'wait_until':\n if (Array.isArray(n.onTimeout)) {\n return [\n { label: 'met', nodes: [] },\n { label: 'timeout', nodes: n.onTimeout },\n ];\n }\n return null;\n default:\n return null;\n }\n}\n\nfunction seqWidth(nodes: NodeIR[]): number {\n return nodes.length === 0 ? W : Math.max(...nodes.map(nodeWidth));\n}\n\nfunction nodeWidth(n: NodeIR): number {\n const groups = groupsOf(n);\n if (!groups) return nodeSize(n).w;\n return (\n groups.reduce((sum, g) => sum + Math.max(W, seqWidth(g.nodes)), 0) + HGAP * (groups.length - 1)\n );\n}\n\nconst CHANNEL_TITLE: Record<string, string> = {\n email: 'Email',\n sms: 'SMS',\n push: 'Push Notification',\n in_app: 'In-App Message',\n slack: 'Slack Message',\n discord: 'Discord Message',\n survey: 'Survey',\n};\n\nfunction nodeData(n: NodeIR): CanvasNodeData {\n switch (n.type) {\n case 'message':\n return {\n title: CHANNEL_TITLE[n.channel] ?? n.channel,\n subtitle: n.devices === 'latest' ? `${n.template} · latest device` : n.template,\n category: 'message',\n variant: 'card',\n icon: n.channel,\n };\n case 'delay':\n return {\n title: 'Time Delay',\n subtitle: `Wait ${n.duration.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'delay',\n };\n case 'random_delay':\n return {\n title: 'Randomized Delay',\n subtitle: `Wait ${n.min.value} – ${n.max.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'delay',\n };\n case 'time_window':\n return {\n title: 'Time Window',\n subtitle: `${n.days.join(' ')} ${n.between[0]}–${n.between[1]}`,\n category: 'delay',\n variant: 'card',\n icon: 'time_window',\n };\n case 'wait_until':\n return {\n title: `Wait until ${conditionLabel(n.condition, '…')}`,\n subtitle: `timeout ${n.timeout.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'wait_until',\n };\n case 'branch': {\n const arms = n.cases.length + 1;\n return {\n title: n.label ?? (n.cases.length > 1 ? 'Multi-Split Branch' : 'True/False Branch'),\n subtitle: `${arms} arms, first match`,\n category: 'control',\n variant: 'card',\n icon: 'branch',\n };\n }\n case 'filter':\n return {\n title: 'Filter',\n subtitle: n.reason ?? 'only continue if…',\n category: 'control',\n variant: 'card',\n icon: 'filter',\n };\n case 'cohort':\n return {\n title: 'Random Cohort',\n subtitle: n.arms.map((a) => `${a.name} ${a.weight}%`).join(' / '),\n category: 'control',\n variant: 'card',\n icon: 'cohort',\n };\n case 'exit':\n return {\n title: 'Exit',\n // reason stays off the canvas and lives in the hover tooltip\n ...(n.reason !== undefined ? { subtitle: n.reason } : {}),\n category: 'exit',\n variant: 'icon',\n icon: 'exit',\n };\n case 'send_event':\n return {\n title: 'Send Event',\n subtitle: n.event,\n category: 'data',\n variant: 'card',\n icon: 'send_event',\n };\n case 'action':\n return {\n title: 'Custom Action',\n subtitle: n.action,\n category: 'data',\n variant: 'card',\n icon: 'action',\n };\n }\n}\n\ninterface Tail {\n id: string;\n label?: string;\n anchor?: 'source' | 'target';\n}\n\nexport function layout(\n ir: WorkflowIR,\n stats?: NodeStats\n): { nodes: CanvasNode[]; edges: CanvasEdge[] } {\n const nodes: CanvasNode[] = [];\n const edges: CanvasEdge[] = [];\n let edgeSeq = 0;\n\n const addNode = (id: string, x: number, y: number, data: CanvasNodeData): void => {\n const count = stats?.[id];\n nodes.push({\n id,\n type: 'wf',\n position: { x, y },\n data: count === undefined ? data : { ...data, count },\n });\n };\n\n const addEdges = (tails: Tail[], target: string): void => {\n for (const t of tails) {\n edges.push({\n id: `e${edgeSeq++}`,\n source: t.id,\n target,\n ...(t.label !== undefined ? { label: t.label } : {}),\n ...(t.anchor !== undefined ? { data: { anchor: t.anchor } } : {}),\n });\n }\n };\n\n /** Lay out one sequence recursively: `cx` is the centre line; returns the bottom y and the tails that continue downward. */\n function layoutSeq(\n seq: NodeIR[],\n cx: number,\n y: number,\n incoming: Tail[]\n ): {\n bottom: number;\n tails: Tail[];\n } {\n let curY = y;\n let tails = incoming;\n\n for (const n of seq) {\n const size = nodeSize(n);\n addNode(n.id, cx - size.w / 2, curY, nodeData(n));\n addEdges(tails, n.id);\n const bottom = curY + size.h;\n\n if (n.type === 'exit') {\n tails = []; // terminal: nothing connects downward\n curY = bottom + VGAP;\n continue;\n }\n\n const groups = groupsOf(n);\n if (!groups) {\n tails = [{ id: n.id }];\n curY = bottom + VGAP;\n continue;\n }\n\n const widths = groups.map((g) => Math.max(W, seqWidth(g.nodes)));\n const total = widths.reduce((a, b) => a + b, 0) + HGAP * (groups.length - 1);\n let gx = cx - total / 2;\n const groupTop = bottom + FORK_GAP;\n let maxBottom = groupTop;\n const groupTails: Tail[] = [];\n\n groups.forEach((g, gi) => {\n const center = gx + (widths[gi] ?? W) / 2;\n if (g.nodes.length === 0) {\n // Empty group: the parent rejoins straight down, so anchor the label right below it\n groupTails.push({ id: n.id, label: g.label, anchor: 'source' });\n } else {\n const r = layoutSeq(g.nodes, center, groupTop, [\n { id: n.id, label: g.label, anchor: 'target' },\n ]);\n groupTails.push(...r.tails);\n maxBottom = Math.max(maxBottom, r.bottom);\n }\n gx += (widths[gi] ?? W) + HGAP;\n });\n\n tails = groupTails;\n curY = maxBottom + REJOIN_EXTRA;\n }\n\n return { bottom: curY, tails };\n }\n\n // Trigger node\n const t = ir.trigger;\n const triggerSubtitle =\n t.type === 'event'\n ? `${t.event}${t.filter ? ' · +filter' : ''}`\n : t.type === 'segment'\n ? `enters ${t.segment}`\n : t.type === 'date'\n ? t.at\n : 'webhook';\n addNode('__trigger', -CARD_SIZE.w / 2, 0, {\n title: 'Trigger',\n subtitle: triggerSubtitle,\n category: 'trigger',\n variant: 'card',\n icon: 'trigger',\n });\n\n const { bottom, tails } = layoutSeq(ir.flow, 0, CARD_SIZE.h + VGAP, [{ id: '__trigger' }]);\n\n // Closing Exit node (customer.io's explicit terminus); unnecessary when every path exits early\n if (tails.length > 0) {\n addNode('__end', -ICON_SIZE.w / 2, bottom, {\n title: 'Exit',\n category: 'exit',\n variant: 'icon',\n icon: 'exit',\n });\n addEdges(tails, '__end');\n }\n\n return { nodes, edges };\n}\n","import type { WorkflowIR } from '@shware/workflow';\nimport {\n Background,\n BaseEdge,\n Controls,\n type Edge,\n EdgeLabelRenderer,\n type EdgeProps,\n Handle,\n type Node,\n type NodeProps,\n Position,\n ReactFlow,\n} from '@xyflow/react';\nimport {\n AlarmClock,\n AppWindow,\n BellRing,\n CalendarClock,\n ClipboardList,\n Filter,\n GitBranch,\n Hourglass,\n LogOut,\n type LucideIcon,\n Mail,\n MessageCircle,\n MessageSquareText,\n MessagesSquare,\n Send,\n Shuffle,\n SquareFunction,\n User,\n Zap,\n} from 'lucide-react';\nimport { type CSSProperties, createContext, useContext, useMemo } from 'react';\nimport type { NodeStats } from '../config';\nimport { superellipse } from './corner-shape';\nimport {\n CARD_SIZE,\n type CanvasEdge,\n type CanvasNode,\n type CanvasNodeData,\n ICON_SIZE,\n type NodeCategory,\n type NodeIcon,\n layout,\n} from './layout';\n\n/**\n * Read-only workflow canvas: renders IR. Structure is code-owned, so the UI\n * offers no editing.\n *\n * Rendering principle — HTML-first and pixel-exact: node cards and edge labels\n * are always HTML (fonts and line heights on tailwind's scale, and new CSS such\n * as corner-shape is available). SVG is kept only for what react-flow's\n * architecture requires — the connector paths and their endpoint markers — with\n * every parameter passed explicitly. SVG EdgeText is not used: its size follows\n * the font's bounding box and cannot be pinned to exact pixels.\n */\nexport interface WorkflowCanvasProps {\n ir: WorkflowIR;\n /** Node id → users currently waiting there (from the engine's stats API); no badge without it. */\n stats?: NodeStats;\n /**\n * Drives react-flow's own chrome (background dots, zoom controls). The card\n * and connector colours come from CSS variables and follow the host's theme\n * on their own; this is only for the parts react-flow paints itself. Passed\n * in rather than sniffed from the DOM, so an embedding app stays in control.\n */\n colorMode?: 'light' | 'dark';\n /** Node id to show as selected; pairs with onSelectNode for an inspector panel. */\n selectedId?: string | undefined;\n /** Node clicked, or undefined when the click landed on empty canvas. */\n onSelectNode?: (id: string | undefined) => void;\n}\n\n/** The callback travels by context: react-flow node data should carry serializable data only. */\n/** Same reason: selection is view state, not node data, so it must not enter the layout. */\nconst SelectedContext = createContext<string | undefined>(undefined);\n\n/**\n * One hue per category, not per icon: six colours make a message, a wait and a\n * branch tell themselves apart at a glance; fifteen would just be noise. Values\n * live in CSS so they shift with the theme.\n */\nconst CATEGORY_COLOR: Record<NodeCategory, string> = {\n trigger: 'var(--color-icon-trigger)',\n message: 'var(--color-icon-message)',\n delay: 'var(--color-icon-delay)',\n control: 'var(--color-icon-control)',\n data: 'var(--color-icon-data)',\n exit: 'var(--color-icon-exit)',\n};\n\nconst ICONS: Record<NodeIcon, LucideIcon> = {\n trigger: Zap,\n email: Mail,\n sms: MessageSquareText,\n push: BellRing,\n /*\n * in_app moved off the speech bubble when discord arrived: the channel\n * pickers already spend it on discord (see channel-icon.ts), and two\n * identical glyphs on one canvas stop working as an index. A window is the\n * truer mark for an in-product surface anyway.\n */\n in_app: AppWindow,\n slack: MessagesSquare,\n discord: MessageCircle,\n survey: ClipboardList,\n delay: AlarmClock,\n time_window: CalendarClock,\n wait_until: Hourglass,\n branch: GitBranch,\n filter: Filter,\n cohort: Shuffle,\n exit: LogOut,\n send_event: Send,\n action: SquareFunction,\n};\n\n/**\n * A 1px border and nothing else — no drop shadow. It takes --color-edge rather\n * than --color-border, so a card's outline and the connectors between cards are\n * the same weight: on a canvas the wiring is as much a first-class line as the\n * boxes, and one darker step is what replaces the lift the shadow used to give.\n * boxSizing is border-box, so the border sits inside CARD_SIZE and the layout\n * stays on its 8px steps.\n */\nconst baseCard: CSSProperties = {\n boxSizing: 'border-box',\n background: 'var(--color-card)',\n // Longhand, not the `border` shorthand: selection overrides borderColor alone,\n // and React warns when a rerender mixes a shorthand with its longhand.\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: 'var(--color-edge)',\n fontFamily: \"'Inter Variable', Inter, ui-sans-serif, system-ui, sans-serif\",\n overflow: 'hidden',\n ...superellipse,\n};\n\n/** Flex column, centred: top and bottom whitespace stay equal without hand-balancing padding against line height. */\nconst cardStyle: CSSProperties = {\n ...baseCard,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n width: CARD_SIZE.w,\n height: CARD_SIZE.h,\n padding: '0 16px',\n borderRadius: 12,\n};\n\n/**\n * The pill sits in a card-width box and centres itself in it. react-flow anchors\n * handles at the measured box's midpoint, so letting the auto-width pill *be*\n * the box put its centre wherever the label happened to end — a couple of\n * pixels off the column the connectors run down.\n */\nconst iconWrapStyle: CSSProperties = {\n display: 'flex',\n justifyContent: 'center',\n width: ICON_SIZE.w,\n height: ICON_SIZE.h,\n};\n\nconst iconStyle: CSSProperties = {\n ...baseCard,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 6,\n // Width follows content; 12 on the icon side, 16 on the text side — optical balance for icon+label\n width: 'fit-content',\n height: ICON_SIZE.h,\n padding: '0 16px 0 12px',\n // Stadium pill: radius = half the height, with round corners restored (superellipse would flatten the ends)\n borderRadius: 16,\n ...({ cornerShape: 'round' } as CSSProperties),\n fontSize: 12,\n lineHeight: '16px',\n fontWeight: 600,\n color: 'var(--color-secondary)',\n};\n\nconst headerStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n};\n\nconst titleStyle: CSSProperties = {\n flex: 1,\n minWidth: 0,\n fontSize: 14,\n lineHeight: '20px',\n fontWeight: 600,\n color: 'var(--color-primary)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nconst countStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n fontSize: 14,\n lineHeight: '20px',\n fontWeight: 600,\n color: 'var(--color-primary)',\n};\n\nconst subtitleStyle: CSSProperties = {\n marginTop: 4,\n fontSize: 12,\n lineHeight: '16px',\n color: 'var(--color-muted)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nconst handleStyle: CSSProperties = { opacity: 0, width: 1, height: 1, minWidth: 0, minHeight: 0 };\n\n/** Open-template button: a borderless icon button in the card's top-right corner. */\ntype WfNode = Node<CanvasNodeData, 'wf'>;\n\nfunction WorkflowNode({ id, data }: NodeProps<WfNode>) {\n const Icon = ICONS[data.icon];\n /*\n * Selection reads as a focused form control: the card's own border takes the\n * accent and a translucent halo sits outside it. A solid ring on top of the\n * existing border instead looked like two borders stacked.\n */\n const selected =\n useContext(SelectedContext) === id\n ? {\n borderColor: 'var(--color-accent)',\n boxShadow: '0 0 0 3px var(--color-accent-ring)',\n }\n : undefined;\n\n const body =\n data.variant === 'icon' ? (\n // Small pill (exit): icon plus a short label, with reason in the tooltip\n <div style={iconWrapStyle}>\n <div\n style={{ ...iconStyle, ...selected }}\n title={data.subtitle ? `${data.title} · ${data.subtitle}` : data.title}\n >\n <Icon size={16} color={CATEGORY_COLOR[data.category]} strokeWidth={2} aria-hidden />\n {data.title}\n </div>\n </div>\n ) : (\n <div style={{ ...cardStyle, ...selected }}>\n <div style={headerStyle}>\n <Icon size={16} color={CATEGORY_COLOR[data.category]} strokeWidth={2} aria-hidden />\n <span style={titleStyle}>{data.title}</span>\n {data.count !== undefined && (\n <span style={countStyle}>\n <User size={16} color=\"var(--color-muted)\" strokeWidth={2} aria-hidden />\n {data.count}\n </span>\n )}\n </div>\n {data.subtitle !== undefined && <div style={subtitleStyle}>{data.subtitle}</div>}\n </div>\n );\n\n return (\n <>\n <Handle type=\"target\" position={Position.Top} style={handleStyle} isConnectable={false} />\n {body}\n <Handle type=\"source\" position={Position.Bottom} style={handleStyle} isConnectable={false} />\n </>\n );\n}\n\nconst nodeTypes = { wf: WorkflowNode };\n\n/**\n * Edge label pill: 32px tall (8-grid), fully rounded, typography on tailwind's\n * text-xs (12px / 16px). Border on --color-edge like every other outline on the\n * canvas — cards, the exit pill and the connectors all draw at one weight.\n */\nconst edgeLabelStyle: CSSProperties = {\n position: 'absolute',\n display: 'flex',\n alignItems: 'center',\n height: 32,\n padding: '0 12px',\n borderRadius: 16,\n background: 'var(--color-card)',\n border: '1px solid var(--color-edge)',\n fontFamily: \"'Inter Variable', Inter, ui-sans-serif, system-ui, sans-serif\",\n fontSize: 12,\n lineHeight: '16px',\n fontWeight: 500,\n color: 'var(--color-secondary)',\n pointerEvents: 'none',\n};\n\ntype WfEdge = Edge<{ anchor?: 'source' | 'target' }, 'wf'>;\n\n/* ----------------------------- Connector routing ---------------------------- */\n\n/** One bend radius for every corner. */\nconst BEND = 16;\n/** How far a labelled fork runs straight down before it turns. */\nconst FORK_STEM = 28;\n/** Where a label pill hangs below the deciding node. */\nconst LABEL_DROP = 56;\nconst DOT_R = 3.5;\n/**\n * react-flow anchors its 1px handles just outside the node box, so both ends of\n * a connector stop one pixel short of the card: the line leaves the bottom edge\n * with a visible hairline under it, and the endpoint dot floats above the top\n * edge. Growing the path by this much at each end — and placing the dot's\n * bottom at the same point — closes both seams.\n */\nconst HANDLE_INSET = 1;\n\n/** Endpoint dot, sized off DOT_R so the SVG geometry and the HTML marker agree. */\nconst dotStyle: CSSProperties = {\n position: 'absolute',\n boxSizing: 'border-box',\n width: DOT_R * 2,\n height: DOT_R * 2,\n borderRadius: '50%',\n background: 'var(--color-card)',\n border: '1px solid var(--color-edge)',\n pointerEvents: 'none',\n};\n/**\n * Corner control-point factor. A circular arc's classic value is 0.552; pulling\n * it out to 0.9 squares the shoulder off, approximating the look of\n * corner-shape: superellipse. (CSS corner-shape does not apply to SVG paths, so\n * the shape is built by hand from cubic béziers.)\n */\nconst SQUIRCLE = 0.9;\n\n/** A superellipse shoulder bending from (x1,y1) through the corner (cx,cy) to (x2,y2). */\nfunction corner(x1: number, y1: number, cx: number, cy: number, x2: number, y2: number): string {\n const c1x = x1 + (cx - x1) * SQUIRCLE;\n const c1y = y1 + (cy - y1) * SQUIRCLE;\n const c2x = x2 + (cx - x2) * SQUIRCLE;\n const c2y = y2 + (cy - y2) * SQUIRCLE;\n return `C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`;\n}\n\n/** Three-segment orthogonal route (down, across, down); `splitY` is where the horizontal run sits. */\nfunction orthogonalPath(sx: number, sy: number, tx: number, ty: number, splitY: number): string {\n const dx = tx - sx;\n if (Math.abs(dx) < 1) return `M ${sx} ${sy} L ${tx} ${ty}`;\n const dir = Math.sign(dx);\n const r = Math.max(0, Math.min(BEND, Math.abs(dx) / 2, splitY - sy, ty - splitY));\n return [\n `M ${sx} ${sy}`,\n `L ${sx} ${splitY - r}`,\n corner(sx, splitY - r, sx, splitY, sx + dir * r, splitY),\n `L ${tx - dir * r} ${splitY}`,\n corner(tx - dir * r, splitY, tx, splitY, tx, splitY + r),\n `L ${tx} ${ty}`,\n ].join(' ');\n}\n\n/**\n * Custom edge with an HTML label: SVG EdgeText's height floats with the font's\n * bounding box, and only HTML can be pinned to exact pixels.\n *\n * Labels anchor one of two ways — never at the path midpoint, since a short\n * horizontal run would disappear entirely behind the pill:\n * - target: above the arm's entry corner (a real arm; customer.io's position)\n * - source: right below the deciding node (empty pass-through arm, which also\n * keeps several merge-edge labels from colliding at the far end)\n */\nfunction WorkflowEdge({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n label,\n style,\n data,\n}: EdgeProps<WfEdge>) {\n /*\n * Both label anchors have to end up sitting ON their own line. A target\n * anchor already does — the pill hangs in the target's column, which the path\n * descends through. A source anchor hangs directly under the deciding node,\n * where the path has already turned away at FORK_STEM, leaving the pill\n * stranded in open space; so for those the stem runs all the way down to the\n * pill and turns behind it.\n */\n const anchoredAtSource = data?.anchor === 'source';\n const splitY = label\n ? sourceY + (anchoredAtSource ? LABEL_DROP : FORK_STEM)\n : (sourceY + targetY) / 2;\n const path = orthogonalPath(\n sourceX,\n sourceY - HANDLE_INSET,\n targetX,\n targetY + HANDLE_INSET,\n splitY\n );\n // The label hangs below the split line, pinned to its own arm's column\n const labelPos = { x: anchoredAtSource ? sourceX : targetX, y: sourceY + LABEL_DROP };\n return (\n <>\n <BaseEdge id={id} path={path} style={style} />\n <EdgeLabelRenderer>\n {/*\n Connection point: a hollow dot instead of an arrowhead. Drawn as HTML\n rather than SVG because SVG paints in document order — a long\n pass-through connector running down the same column is a later sibling\n and would draw straight through a dot belonging to an earlier edge.\n The HTML layer sits above every path, so no line can cross it.\n */}\n <div\n style={{\n ...dotStyle,\n transform: `translate(-50%, -50%) translate(${targetX}px, ${targetY + HANDLE_INSET - DOT_R}px)`,\n }}\n />\n {!!label && (\n <div\n style={{\n ...edgeLabelStyle,\n transform: `translate(-50%, -50%) translate(${labelPos.x}px, ${labelPos.y}px)`,\n }}\n >\n {label}\n </div>\n )}\n </EdgeLabelRenderer>\n </>\n );\n}\n\nconst edgeTypes = { wf: WorkflowEdge };\n\nexport function WorkflowCanvas({\n ir,\n stats,\n colorMode = 'light',\n selectedId,\n onSelectNode,\n}: WorkflowCanvasProps) {\n const { nodes, edges } = useMemo(() => layout(ir, stats), [ir, stats]);\n return (\n <SelectedContext value={selectedId}>\n <CanvasSurface\n nodes={nodes}\n edges={edges}\n colorMode={colorMode}\n {...(onSelectNode !== undefined ? { onSelectNode } : {})}\n />\n </SelectedContext>\n );\n}\n\nfunction CanvasSurface({\n nodes,\n edges,\n colorMode,\n onSelectNode,\n}: {\n nodes: CanvasNode[];\n edges: CanvasEdge[];\n colorMode: 'light' | 'dark';\n onSelectNode?: (id: string | undefined) => void;\n}) {\n return (\n <div style={{ width: '100%', height: '100%' }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n colorMode={colorMode}\n onNodeClick={(_event, node) => onSelectNode?.(node.id)}\n onPaneClick={() => onSelectNode?.(undefined)}\n // Overrides react-flow's own dark surface, which sits between our page and card\n style={{ background: 'var(--color-canvas)' }}\n fitView\n minZoom={0.2}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n defaultEdgeOptions={{\n type: 'wf',\n style: { stroke: 'var(--color-edge)' },\n }}\n >\n <Background gap={16} color=\"var(--color-grid)\" />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n );\n}\n","import {\n type DiscordContent,\n type DiscordTemplate,\n type EmailTemplate,\n type PushContent,\n type PushTemplate,\n type SlackContent,\n type SlackTemplate,\n type TemplateIssue,\n TemplateValidationError,\n parseTemplateProps,\n renderDiscordContent,\n renderPushContent,\n renderSlackContent,\n} from '@shware/workflow';\nimport type { ComponentType } from 'react';\nimport type { ResolvedStudioConfig } from '../config';\nimport { lookup } from './lookup';\n\n/**\n * What the studio reads out of a template definition.\n *\n * Every registry entry is an `emailTemplate({...})` / `pushTemplate({...})`\n * (the dev server refuses anything else). Previews are validated with the\n * SDK's own functions (parseTemplateProps, renderPushContent), the same ones\n * the senders run, so the studio cannot accept props a send would refuse;\n * everything downstream reads the parsed value.\n */\n\nexport type Props = Record<string, unknown>;\n\n/**\n * A failed render: which phase refused, and every field path with its message.\n * `json` is the studio's own: the props editor holds text that is not a JSON\n * object, so nothing was validated at all.\n */\nexport interface TemplateFailure {\n phase: 'json' | 'props' | 'content' | 'render';\n issues: TemplateIssue[];\n}\n\n/** The channels with a template registry; every other channel's messages have no preview. */\nexport type TemplateChannel = 'email' | 'push' | 'discord' | 'slack';\n\nexport function isTemplateChannel(channel: string): channel is TemplateChannel {\n return channel === 'email' || channel === 'push' || channel === 'discord' || channel === 'slack';\n}\n\n/** One registry entry, read from the registry its channel owns — a push key never resolves to an email. */\nexport type TemplateEntry =\n | { channel: 'email'; entry: EmailTemplate }\n | { channel: 'push'; entry: PushTemplate }\n | { channel: 'discord'; entry: DiscordTemplate }\n | { channel: 'slack'; entry: SlackTemplate };\n\nexport function lookupTemplate(\n config: Partial<Pick<ResolvedStudioConfig, 'emails' | 'pushes' | 'discords' | 'slacks'>>,\n channel: string,\n key: string\n): TemplateEntry | undefined {\n const found = <T>(registry: Record<string, T> | undefined) =>\n registry === undefined ? undefined : lookup(registry, key);\n switch (channel) {\n case 'email': {\n const entry = found(config.emails);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'push': {\n const entry = found(config.pushes);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'discord': {\n const entry = found(config.discords);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'slack': {\n const entry = found(config.slacks);\n return entry === undefined ? undefined : { channel, entry };\n }\n default:\n return undefined;\n }\n}\n\n/** The sample props the studio renders with: the template's `preview`. */\nexport function previewPropsOf(entry: TemplateEntry['entry']): Props {\n return { ...entry.preview };\n}\n\n/** One line per issue, `path message`, for surfaces too small for a list. */\nexport function formatIssues(failure: TemplateFailure): string {\n return failure.issues\n .map((issue) => (issue.path === '' ? issue.message : `${issue.path}: ${issue.message}`))\n .join('\\n');\n}\n\nfunction failureOf(error: unknown, phase: TemplateFailure['phase']): TemplateFailure {\n if (error instanceof TemplateValidationError) return { phase: error.phase, issues: error.issues };\n return {\n phase,\n issues: [{ path: '', message: error instanceof Error ? error.message : String(error) }],\n };\n}\n\n/* ---------------------------------- Email ---------------------------------- */\n\n/** What the renderer needs: a component and the parsed props to give it, plus the subject. */\nexport interface PreparedEmail {\n component: ComponentType<Props>;\n props: Props;\n subject: string;\n}\n\nexport type EmailPreparation =\n | { ok: true; email: PreparedEmail }\n | { ok: false; failure: TemplateFailure };\n\n/**\n * Parse the props a preview renders with against the template's schema, and\n * hand the component the parsed value — or refuse, with the field paths, and\n * render nothing.\n */\nexport function prepareEmail(entry: EmailTemplate, key: string, props?: Props): EmailPreparation {\n try {\n const parsed = parseTemplateProps(entry, key, props ?? previewPropsOf(entry));\n return {\n ok: true,\n email: {\n component: entry.component as ComponentType<Props>,\n props: parsed,\n subject: entry.subject,\n },\n };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'props') };\n }\n}\n\n/** A render that threw (the component itself failed), as a failure the page can show. */\nexport function renderFailure(error: unknown): TemplateFailure {\n return failureOf(error, 'render');\n}\n\n/* ----------------------------------- Push ---------------------------------- */\n\nexport type PushResolution =\n | { ok: true; push: PushContent }\n | { ok: false; failure: TemplateFailure };\n\n/**\n * The notification a push template produces for some props: its `content`\n * over the parsed props, through the SDK (output checked, nothing\n * placeholder-filled afterwards).\n */\nexport function resolvePush(entry: PushTemplate, key: string, props?: Props): PushResolution {\n try {\n return { ok: true, push: renderPushContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/* -------------------------------- Webhooks --------------------------------- */\n\nexport type DiscordResolution =\n | { ok: true; message: DiscordContent }\n | { ok: false; failure: TemplateFailure };\n\nexport type SlackResolution =\n | { ok: true; message: SlackContent }\n | { ok: false; failure: TemplateFailure };\n\n/** The Discord message a template posts for some props, checked like a send checks it. */\nexport function resolveDiscord(\n entry: DiscordTemplate,\n key: string,\n props?: Props\n): DiscordResolution {\n try {\n return { ok: true, message: renderDiscordContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/** The Slack message a template posts for some props, checked like a send checks it. */\nexport function resolveSlack(entry: SlackTemplate, key: string, props?: Props): SlackResolution {\n try {\n return { ok: true, message: renderSlackContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/* -------------------------------- Identity --------------------------------- */\n\nconst identities = new WeakMap<object, number>();\nlet nextIdentity = 0;\n\n/**\n * A number per entry object, for query keys. HMR re-imports a template module\n * as a new object, so a changed component, content or schema gets a new key —\n * and a fresh render, never the cached one from before the edit.\n */\nexport function entryIdentity(entry: object | undefined): number | undefined {\n if (entry === undefined) return undefined;\n let id = identities.get(entry);\n if (id === undefined) {\n id = nextIdentity++;\n identities.set(entry, id);\n }\n return id;\n}\n","import type { ReactNode } from 'react';\n\n/**\n * The inline formatting chat clients render, drawn as React nodes (never HTML strings): Discord's\n * markdown (`**bold**`, `*italic*`, `__underline__`, `~~strike~~`, `` `code` ``, `[text](url)`)\n * and Slack's mrkdwn (`*bold*`, `_italic_`, `~strike~`, `` `code` ``, `<url|text>`). Enough to\n * preview a message faithfully, not a full parser: nesting is one level deep. Underscore (and\n * Slack's `*` / `~`) markers only open and close at word boundaries, so `snake_case_name` stays text.\n */\nexport type Dialect = 'discord' | 'slack';\n\ninterface Rule {\n pattern: RegExp;\n render: (match: RegExpExecArray, key: string, linkClass: string) => ReactNode;\n}\n\nconst code = (text: string, key: string) => (\n <code\n key={key}\n className=\"rounded bg-black/10 px-1 py-px font-mono text-[0.85em] dark:bg-white/10\"\n >\n {text}\n </code>\n);\n\nconst link = (href: string, text: string, key: string, className: string) => (\n <a key={key} href={href} target=\"_blank\" rel=\"noreferrer\" className={className}>\n {text}\n </a>\n);\n\nconst RULES: Record<Dialect, Rule[]> = {\n discord: [\n { pattern: /`([^`]+)`/, render: (m, key) => code(m[1] ?? '', key) },\n {\n pattern: /\\[([^\\]]+)\\]\\((https?:\\/\\/[^)\\s]+)\\)/,\n render: (m, key, linkClass) => link(m[2] ?? '', m[1] ?? '', key, linkClass),\n },\n { pattern: /\\*\\*([^*]+)\\*\\*/, render: (m, key) => <strong key={key}>{m[1]}</strong> },\n { pattern: /(?<!\\w)__([^_]+)__(?!\\w)/, render: (m, key) => <u key={key}>{m[1]}</u> },\n { pattern: /~~([^~]+)~~/, render: (m, key) => <s key={key}>{m[1]}</s> },\n {\n pattern: /\\*([^*]+)\\*|(?<!\\w)_([^_]+)_(?!\\w)/,\n render: (m, key) => <em key={key}>{m[1] ?? m[2]}</em>,\n },\n {\n pattern: /(https?:\\/\\/[^\\s<]+)/,\n render: (m, key, linkClass) => link(m[1] ?? '', m[1] ?? '', key, linkClass),\n },\n ],\n slack: [\n { pattern: /`([^`]+)`/, render: (m, key) => code(m[1] ?? '', key) },\n {\n pattern: /<((?:https?:\\/\\/|mailto:|tel:)[^|>]+)(?:\\|([^>]+))?>/,\n render: (m, key, linkClass) => link(m[1] ?? '', m[2] ?? m[1] ?? '', key, linkClass),\n },\n { pattern: /(?<!\\w)\\*([^*]+)\\*(?!\\w)/, render: (m, key) => <strong key={key}>{m[1]}</strong> },\n { pattern: /(?<!\\w)_([^_]+)_(?!\\w)/, render: (m, key) => <em key={key}>{m[1]}</em> },\n { pattern: /(?<!\\w)~([^~]+)~(?!\\w)/, render: (m, key) => <s key={key}>{m[1]}</s> },\n ],\n};\n\nfunction inline(text: string, dialect: Dialect, linkClass: string, prefix: string): ReactNode[] {\n const out: ReactNode[] = [];\n let rest = text;\n let index = 0;\n while (rest !== '') {\n // The earliest match of any rule wins; ties go to the rule listed first\n let best: { match: RegExpExecArray; rule: Rule } | undefined;\n for (const rule of RULES[dialect]) {\n const match = rule.pattern.exec(rest);\n if (match !== null && (best === undefined || match.index < best.match.index)) {\n best = { match, rule };\n }\n }\n if (best === undefined) {\n out.push(rest);\n break;\n }\n if (best.match.index > 0) out.push(rest.slice(0, best.match.index));\n out.push(best.rule.render(best.match, `${prefix}${index++}`, linkClass));\n rest = rest.slice(best.match.index + best.match[0].length);\n }\n return out;\n}\n\n/** Lines kept as lines; each formatted inline. */\nexport function ChatMarkup({\n text,\n dialect,\n linkClass,\n}: {\n text: string;\n dialect: Dialect;\n linkClass: string;\n}) {\n const lines = text.split('\\n');\n return (\n <>\n {lines.map((line, i) => (\n // oxlint-disable-next-line react/no-array-index-key -- lines have no identity but their place\n <span key={i}>\n {inline(line, dialect, linkClass, `${i}-`)}\n {i < lines.length - 1 && <br />}\n </span>\n ))}\n </>\n );\n}\n","import type { DiscordContent } from '@shware/workflow';\nimport { useTranslation } from 'react-i18next';\nimport { ChatMarkup } from './chat-markup';\nimport { superellipse } from './corner-shape';\n\n/**\n * A webhook message as Discord draws it in a channel: the webhook's name and avatar with the APP\n * tag, the content, and every embed (accent bar, author, title, description, fields, image,\n * thumbnail, footer). Discord's own palette for each theme; close enough to judge the message,\n * not a pixel copy.\n */\nexport interface DiscordPreviewProps {\n message: DiscordContent;\n /** The name a webhook posts under when the message names none: the project title upstream. */\n appName: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\nconst PALETTE = {\n dark: { bg: '#313338', text: '#dbdee1', muted: '#949ba4', name: '#f2f3f5', embed: '#2b2d31' },\n light: { bg: '#ffffff', text: '#313338', muted: '#5c5e66', name: '#060607', embed: '#f2f3f5' },\n};\n\nconst hex = (color: number | null | undefined) =>\n color === undefined || color === null ? '#1e1f22' : `#${color.toString(16).padStart(6, '0')}`;\n\nexport function DiscordPreview({ message, appName, scheme, zoom }: DiscordPreviewProps) {\n const { t } = useTranslation();\n const colors = PALETTE[scheme];\n const name = message.username ?? appName;\n const linkClass = 'text-[#00a8fc] hover:underline';\n return (\n <div\n className=\"mx-auto w-full max-w-2xl overflow-hidden rounded-2xl shadow-sm\"\n style={{\n ...superellipse,\n background: colors.bg,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n >\n <div className=\"flex gap-4 px-4 py-4\" style={{ color: colors.text }}>\n {message.avatar_url ? (\n <img\n src={message.avatar_url}\n alt=\"\"\n className=\"size-10 shrink-0 rounded-full object-cover\"\n />\n ) : (\n <div className=\"flex size-10 shrink-0 items-center justify-center rounded-full bg-[#5865f2] text-sm font-semibold text-white\">\n {name.slice(0, 1).toUpperCase()}\n </div>\n )}\n <div className=\"min-w-0 flex-1 text-[15px] leading-[1.375]\">\n <div className=\"flex items-center gap-1.5\">\n <span className=\"font-medium\" style={{ color: colors.name }}>\n {name}\n </span>\n <span className=\"rounded-[3px] bg-[#5865f2] px-1 text-[10px] leading-4 font-semibold text-white\">\n APP\n </span>\n <span className=\"text-xs\" style={{ color: colors.muted }}>\n {t('emails.chatNow')}\n </span>\n </div>\n {message.content !== undefined && message.content !== '' && (\n <div className=\"break-words whitespace-pre-wrap\">\n <ChatMarkup text={message.content} dialect=\"discord\" linkClass={linkClass} />\n </div>\n )}\n {(message.embeds ?? []).map((embed, index) => (\n <div\n // oxlint-disable-next-line react/no-array-index-key -- embeds are positional\n key={index}\n className=\"mt-1.5 grid max-w-[516px] grid-cols-[1fr_auto] gap-x-4 rounded-[4px] border-l-4 py-2 pr-4 pl-3\"\n style={{ borderLeftColor: hex(embed.color), background: colors.embed }}\n >\n <div className=\"min-w-0\">\n {embed.author !== undefined && (\n <div\n className=\"mt-1 flex items-center gap-2 text-sm font-semibold\"\n style={{ color: colors.name }}\n >\n {embed.author.icon_url !== undefined && (\n <img src={embed.author.icon_url} alt=\"\" className=\"size-6 rounded-full\" />\n )}\n {embed.author.name}\n </div>\n )}\n {embed.title !== undefined && (\n <div\n className=\"mt-1 font-semibold\"\n style={{ color: embed.url ? undefined : colors.name }}\n >\n {embed.url ? (\n <a href={embed.url} target=\"_blank\" rel=\"noreferrer\" className={linkClass}>\n {embed.title}\n </a>\n ) : (\n embed.title\n )}\n </div>\n )}\n {embed.description !== undefined && (\n <div className=\"mt-1 text-sm break-words whitespace-pre-wrap\">\n <ChatMarkup text={embed.description} dialect=\"discord\" linkClass={linkClass} />\n </div>\n )}\n {(embed.fields ?? []).length > 0 && (\n <div className=\"mt-2 grid grid-cols-3 gap-2\">\n {(embed.fields ?? []).map((field, i) => (\n <div\n // oxlint-disable-next-line react/no-array-index-key -- fields are positional\n key={i}\n className={field.inline ? 'col-span-1' : 'col-span-3'}\n >\n <div className=\"text-sm font-semibold\" style={{ color: colors.name }}>\n {field.name}\n </div>\n <div className=\"text-sm whitespace-pre-wrap\">\n <ChatMarkup text={field.value} dialect=\"discord\" linkClass={linkClass} />\n </div>\n </div>\n ))}\n </div>\n )}\n {embed.image?.url !== undefined && (\n <img\n src={embed.image.url}\n alt=\"\"\n className=\"mt-4 max-h-[300px] rounded-[4px] object-contain\"\n />\n )}\n {(embed.footer !== undefined || embed.timestamp !== undefined) && (\n <div\n className=\"mt-2 flex items-center gap-2 text-xs\"\n style={{ color: colors.muted }}\n >\n {embed.footer?.icon_url !== undefined && (\n <img src={embed.footer.icon_url} alt=\"\" className=\"size-5 rounded-full\" />\n )}\n {[\n embed.footer?.text,\n embed.timestamp && new Date(embed.timestamp).toLocaleString(),\n ]\n .filter(Boolean)\n .join(' • ')}\n </div>\n )}\n </div>\n {embed.thumbnail?.url !== undefined && (\n <img\n src={embed.thumbnail.url}\n alt=\"\"\n className=\"mt-2 size-20 rounded-[4px] object-cover\"\n />\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n );\n}\n","import { useLayoutEffect, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { ThumbnailStatus, ThumbnailWindow } from './thumbnail-window';\n\n/**\n * Dark-mode simulation for a rendered email: emails are authored light, so a\n * dark stage inverts the document and re-inverts imagery. Shared with the\n * templates page so the thumbnail and the full preview agree.\n */\nexport const DARK_SIMULATION =\n '<style>html{background:#fff;filter:invert(0.92) hue-rotate(180deg)}img,video{filter:invert(1) hue-rotate(180deg)}</style>';\n\n/** The window scrolls the document; the frame itself must never scroll inside it. */\nconst NO_SCROLL = '<style>html,body{overflow:hidden}</style>';\n\n/** Emails are laid out for this width; the thumbnail scales that down, never reflows it. */\nconst EMAIL_WIDTH = 600;\n\nexport interface EmailThumbnailProps {\n /** Rendered HTML; absent while loading, on error, or when nothing is registered. */\n html?: string | undefined;\n loading: boolean;\n error?: string | undefined;\n /** False when the IR references a template the email registry does not register. */\n registered: boolean;\n scheme: 'light' | 'dark';\n /** Open the full preview — the button under the window. */\n onOpen: () => void;\n}\n\n/**\n * The email at postage-stamp size: the document renders at its native width\n * in a sandboxed frame and is scaled to the card, so what shows is exactly\n * what the templates page shows, only smaller. The window scrolls through the\n * whole email; a button beneath it opens the full preview.\n */\nexport function EmailThumbnail({\n html,\n loading,\n error,\n registered,\n scheme,\n onOpen,\n}: EmailThumbnailProps) {\n const { t } = useTranslation();\n const boxRef = useRef<HTMLDivElement>(null);\n const [box, setBox] = useState<{ width: number; height: number }>();\n /* Native document height, read once the frame has laid out. */\n const [docHeight, setDocHeight] = useState<number>();\n\n /* The scale follows the window's inner width; measure rather than assume it. */\n useLayoutEffect(() => {\n const element = boxRef.current;\n if (element === null) return;\n const measure = () => setBox({ width: element.clientWidth, height: element.clientHeight });\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n const scale = box === undefined ? undefined : box.width / EMAIL_WIDTH;\n let status: string | undefined;\n if (!registered) status = t('emails.notRegistered');\n else if (error !== undefined) status = error;\n else if (loading || html === undefined) status = t('emails.rendering');\n\n /* Until the document reports its height, fill the window so the first paint is not blank. */\n const frameHeight =\n box === undefined || scale === undefined\n ? 0\n : Math.max(docHeight ?? 0, Math.ceil(box.height / scale));\n /*\n * The wrapper only grows for a document taller than the window. Otherwise it\n * fills exactly and clips the frame's rounding: the ceil above leaves a\n * fraction of a pixel that would otherwise read as overflow and show a bar.\n */\n const contentHeight = docHeight !== undefined && scale !== undefined ? docHeight * scale : 0;\n const wrapperHeight =\n box !== undefined && contentHeight > box.height + 1 ? contentHeight : '100%';\n\n return (\n <ThumbnailWindow\n ref={boxRef}\n className=\"overflow-x-hidden overflow-y-auto\"\n style={{ backgroundColor: scheme === 'dark' ? '#161616' : '#fff' }}\n onOpen={registered ? onOpen : undefined}\n >\n {status !== undefined ? (\n <ThumbnailStatus tone={error !== undefined ? 'error' : 'muted'}>\n <span className=\"whitespace-pre-line\">{status}</span>\n </ThumbnailStatus>\n ) : (\n scale !== undefined && (\n /* Sized to the scaled document, so the window scrolls the whole email. */\n <div className=\"overflow-hidden\" style={{ height: wrapperHeight }}>\n <iframe\n title={t('inspector.openTemplate')}\n srcDoc={`${html}${scheme === 'dark' ? DARK_SIMULATION : ''}${NO_SCROLL}`}\n /*\n * Same-origin so the document's height is readable; no\n * allow-scripts, so nothing in it runs. A picture of a document.\n */\n sandbox=\"allow-same-origin\"\n tabIndex={-1}\n aria-hidden\n onLoad={(event) => {\n const height = event.currentTarget.contentDocument?.documentElement.scrollHeight;\n if (height !== undefined && height > 0) setDocHeight(height);\n }}\n className=\"pointer-events-none block origin-top-left border-0\"\n style={{\n width: EMAIL_WIDTH,\n height: frameHeight,\n transform: `scale(${scale})`,\n }}\n />\n </div>\n )\n )}\n </ThumbnailWindow>\n );\n}\n","module.exports = \"__ROLLDOWN_ASSET__#FKNdLzKnlftW3t_gzo81yw\"","module.exports = \"__ROLLDOWN_ASSET__#WPGYjwIlzWVNM1bYhOc83w\"","module.exports = \"__ROLLDOWN_ASSET__#VRAku6fjghkApIISiBWPzg\"","import { Camera, ChevronDown, Flashlight, Lock } from 'lucide-react';\nimport type { CSSProperties, ReactNode } from 'react';\nimport iphoneFrameUrl from '../app/assets/devices/iphone-17-pro.png';\nimport pixelBackUrl from '../app/assets/devices/pixel-10-pro-back.webp';\nimport pixelMaskUrl from '../app/assets/devices/pixel-10-pro-mask.webp';\n\n/**\n * Push-notification preview: the two platforms' lock screens, side by side.\n *\n * Emails render themselves — the preview is an iframe around real output. A\n * push has no document of its own: what the user sees is the OS's chrome\n * around two strings, so the preview must *draw* that chrome. Both platforms\n * are shown at once because their layouts genuinely differ (iOS stacks\n * notifications at the bottom of the lock screen, Android under the clock)\n * and the copy has to survive both.\n *\n * The hardware is the vendors' own artwork, not ours: Apple's iPhone 17 Pro\n * product bezel (developer.apple.com/design/resources, PNG with a transparent\n * screen cutout the content shows through — the Dynamic Island is part of the\n * bezel) and Google's Pixel 10 Pro device frame (AOSP's device-art-resources,\n * the artwork behind Android Studio's screenshot framing: a `back` body layer\n * under the content and a screen-sized `mask` overlay painting the corner\n * bezels and the punch-hole camera over it).\n *\n * The software is drawn to the platforms' own design kits, at true scale:\n * screen content renders at the device's logical resolution (402pt / 412dp)\n * and is scaled into the frame's window, so every measurement below is the\n * spec's own number. iOS notification metrics come from the iOS 26 Figma kit\n * and a real device's lock screen (card 386w r28, padding 14/12, centred icon\n * 38 r12, title SF 15/17 semibold −0.23,\n * body 15/18 regular, time 15/17 top-right); Android lock-screen metrics\n * follow Google's official Android UI Kit on Figma (leading 40dp app icon,\n * bold 14sp title with an inline \"• now\", 14sp content line, a circled\n * expander). Collapsed banners carry no rich image on either platform.\n */\nexport interface PushPreviewProps {\n /** App identity on the banner; falls back to the project title upstream. */\n appName: string;\n /** The notification title, as `content` returned it. */\n title: string;\n body: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\n/** The keynote clock: every device mockup shows 9:41. */\nconst CLOCK = '9:41';\n/** Rendered device width; the frames' aspect ratios set everything else. */\nconst DEVICE_W = 300;\n\n/** One frame asset's geometry: canvas size and the screen window inside it. */\ninterface FrameGeometry {\n w: number;\n h: number;\n screen: { x: number; y: number; w: number; h: number };\n /**\n * Corner radius of the screen window, in the artwork's pixels. The content\n * must round itself off: the window's corner arcs pass inside its bounding\n * box, and past them the artwork is transparent (the outside of the device),\n * so square content corners would poke out of the hardware.\n */\n screenRadius: number;\n /** Logical width (pt / dp): screen content renders at this and scales down. */\n logicalW: number;\n}\n\n/** Measured from the bezel PNG (alpha scan of the transparent cutout). */\nconst IPHONE: FrameGeometry = {\n w: 1350,\n h: 2760,\n screen: { x: 72, y: 69, w: 1206, h: 2622 },\n screenRadius: 185,\n logicalW: 402,\n};\n/** From the frame's layout descriptor (display size/offset, corner_radius). */\nconst PIXEL: FrameGeometry = {\n w: 1410,\n h: 2968,\n screen: { x: 59, y: 60, w: 1280, h: 2856 },\n screenRadius: 99,\n logicalW: 412,\n};\n\n/**\n * Apple's continuous corner — a true squircle, not the studio's subtler 1.2.\n * Falls back to plain border-radius where `corner-shape` is unsupported.\n */\nconst squircle = { cornerShape: 'superellipse(2)' } as CSSProperties;\n\n/** App icon stand-in: initial on a gradient, sized by the caller. */\nfunction AppIcon({\n name,\n size,\n radius,\n shape,\n className,\n}: {\n name: string;\n size: number;\n radius: number;\n shape?: CSSProperties;\n className?: string;\n}) {\n return (\n <div\n aria-hidden\n className={`flex shrink-0 items-center justify-center font-semibold text-white ${className ?? ''}`}\n style={{\n width: size,\n height: size,\n borderRadius: radius,\n fontSize: size * 0.48,\n background: 'linear-gradient(135deg,#6366f1 0%,#8b5cf6 55%,#d946ef 100%)',\n ...shape,\n }}\n >\n {(name.trim().charAt(0) || 'A').toUpperCase()}\n </div>\n );\n}\n\n/**\n * One device: platform label above, then the frame artwork with the software\n * screen composited into its window. Children render at the device's logical\n * resolution and are scaled to fit, so their styles use real pt / dp values.\n */\nfunction Device({\n label,\n dark,\n geometry,\n underlay,\n overlay,\n overlayPlacement = 'frame',\n screenShape,\n wallpaper,\n children,\n}: {\n label: string;\n dark: boolean;\n geometry: FrameGeometry;\n underlay?: string;\n overlay: string;\n /** Whether the overlay artwork spans the whole frame or just the screen window. */\n overlayPlacement?: 'frame' | 'screen';\n /** Extra corner treatment for the screen content (the iPhone's squircle). */\n screenShape?: CSSProperties;\n wallpaper: string;\n children: ReactNode;\n}) {\n const scale = DEVICE_W / geometry.w;\n const screenRect: CSSProperties = {\n position: 'absolute',\n left: geometry.screen.x * scale,\n top: geometry.screen.y * scale,\n width: geometry.screen.w * scale,\n height: geometry.screen.h * scale,\n };\n const frameRect: CSSProperties = {\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n };\n /* Logical canvas: spec-true units inside, one scale() to the frame window. */\n const logicalScale = (geometry.screen.w * scale) / geometry.logicalW;\n const logicalH = (geometry.screen.h / geometry.screen.w) * geometry.logicalW;\n return (\n <div className=\"shrink-0\" style={{ width: DEVICE_W }}>\n <div\n className=\"mb-3 text-center text-[14px] font-semibold\"\n style={{ color: dark ? 'var(--color-gray-400)' : 'var(--color-gray-500)' }}\n >\n {label}\n </div>\n <div\n className=\"relative\"\n style={{\n width: DEVICE_W,\n height: Math.round(geometry.h * scale),\n filter: dark\n ? 'drop-shadow(0 20px 40px rgba(0,0,0,0.55))'\n : 'drop-shadow(0 20px 40px rgba(15,23,42,0.3))',\n }}\n >\n {underlay !== undefined && <img src={underlay} alt=\"\" style={frameRect} />}\n <div\n className=\"overflow-hidden\"\n style={{\n ...screenRect,\n borderRadius: geometry.screenRadius * scale,\n background: wallpaper,\n ...screenShape,\n }}\n >\n <div\n className=\"flex flex-col\"\n style={{\n width: geometry.logicalW,\n height: logicalH,\n transform: `scale(${logicalScale})`,\n transformOrigin: 'top left',\n }}\n >\n {children}\n </div>\n </div>\n <img\n src={overlay}\n alt=\"\"\n className=\"pointer-events-none\"\n style={overlayPlacement === 'screen' ? screenRect : frameRect}\n />\n </div>\n </div>\n );\n}\n\n/** iOS lock-screen wallpaper; the inspector's push thumbnail uses the same one. */\nexport const IOS_WALLPAPER = {\n light: 'linear-gradient(170deg,#a9c4ff 0%,#d5b3f7 52%,#ffc0d3 100%)',\n dark: 'linear-gradient(170deg,#26355f 0%,#45296b 52%,#131625 100%)',\n};\n\nconst IOS_FACE: CSSProperties = {\n fontFamily: \"-apple-system, 'SF Pro Text', system-ui, sans-serif\",\n};\n\n/**\n * The banner alone, to the iOS 26 kit: 8pt side margins (386 wide on a 402pt\n * screen), padding 14/12, a 10pt gap after the 38pt icon, and the time\n * top-right. The lock screen composes it; the inspector thumbnail shows it bare.\n */\nexport function IosBanner({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n const primary = dark ? 'rgba(255,255,255,0.96)' : 'rgba(0,0,0,0.9)';\n const secondary = dark ? 'rgba(235,235,245,0.6)' : '#4D4D4D';\n return (\n <div\n className=\"relative mx-[8px] shrink-0 rounded-[40px] px-[14px] py-[12px]\"\n style={{\n ...IOS_FACE,\n /* Liquid glass: brighter than the wallpaper, heavy blur, a specular rim. */\n background: dark ? 'rgba(110,115,135,0.34)' : 'rgba(250,250,252,0.5)',\n backdropFilter: 'blur(28px) saturate(180%)',\n WebkitBackdropFilter: 'blur(28px) saturate(180%)',\n boxShadow: dark\n ? '0 8px 32px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.16)'\n : '0 8px 32px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.55)',\n ...squircle,\n }}\n >\n <div className=\"flex gap-[10px]\">\n <AppIcon name={appName} size={38} radius={12} shape={squircle} className=\"self-center\" />\n <div className=\"min-w-0 flex-1 self-center\">\n <div\n className=\"truncate text-[15px] leading-[17px] font-semibold tracking-[-0.23px]\"\n style={{ color: primary }}\n >\n {title}\n </div>\n <div\n className=\"line-clamp-4 text-[15px] leading-[18px] tracking-[-0.23px]\"\n style={{ color: primary }}\n >\n {body}\n </div>\n </div>\n <span\n className=\"shrink-0 self-start text-[15px] leading-[17px]\"\n style={{ color: secondary }}\n >\n now\n </span>\n </div>\n </div>\n );\n}\n\nfunction IosDevice({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n return (\n <Device\n label=\"iOS\"\n dark={dark}\n geometry={IPHONE}\n overlay={iphoneFrameUrl}\n screenShape={squircle}\n wallpaper={dark ? IOS_WALLPAPER.dark : IOS_WALLPAPER.light}\n >\n <div className=\"relative flex min-h-0 flex-1 flex-col\" style={IOS_FACE}>\n {/*\n Wallpaper glow, sitting behind the banner: frosted glass is invisible\n over a flat gradient — the blur needs detail to smear. Two soft light\n blobs give the backdrop-filter something to show.\n */}\n <div aria-hidden className=\"pointer-events-none absolute inset-0\">\n <div\n className=\"absolute rounded-full\"\n style={{\n left: 20,\n top: 540,\n width: 240,\n height: 240,\n background: `radial-gradient(circle, ${\n dark ? 'rgba(125,110,255,0.4)' : 'rgba(255,255,255,0.75)'\n }, transparent 65%)`,\n }}\n />\n <div\n className=\"absolute rounded-full\"\n style={{\n right: -40,\n top: 640,\n width: 280,\n height: 280,\n background: `radial-gradient(circle, ${\n dark ? 'rgba(70,150,255,0.32)' : 'rgba(255,170,205,0.7)'\n }, transparent 65%)`,\n }}\n />\n </div>\n {/*\n Lock-screen clock, at the kit's measured offsets (Examples/\n Notifications): the 22pt medium date sits at y76 (26 tall), the\n clock's glyphs at y119 with a 73pt cap height (a ~100pt face) — a\n 17pt visual gap between them.\n */}\n <div\n className=\"mt-[76px] shrink-0 text-center\"\n style={{ color: 'rgba(255,255,255,0.95)', textShadow: '0 1px 18px rgba(0,0,0,0.18)' }}\n >\n <div className=\"text-[22px] leading-[26px] font-medium\">Monday, June 9</div>\n <div className=\"mt-[3px] text-[100px] leading-[100px] font-semibold tracking-[-2px]\">\n {CLOCK}\n </div>\n </div>\n {/* Wallpaper breathes; notifications rise from the bottom on iOS. */}\n <div className=\"min-h-0 flex-1\" />\n <IosBanner appName={appName} title={title} body={body} dark={dark} />\n {/* Flashlight / camera (50pt), and the home indicator. */}\n <div className=\"mt-[24px] mb-[12px] flex shrink-0 items-center justify-between px-[52px]\">\n {[Flashlight, Camera].map((Icon, index) => (\n <span\n key={index}\n className=\"flex size-[50px] items-center justify-center rounded-full backdrop-blur-md\"\n style={{ background: 'rgba(20,20,24,0.34)', color: 'rgba(255,255,255,0.92)' }}\n >\n <Icon size={22} strokeWidth={2} aria-hidden />\n </span>\n ))}\n </div>\n <div\n className=\"mx-auto mb-[9px] h-[5px] w-[148px] shrink-0 rounded-full\"\n style={{ background: 'rgba(255,255,255,0.9)' }}\n />\n </div>\n </Device>\n );\n}\n\nfunction AndroidDevice({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n const face: CSSProperties = { fontFamily: \"Roboto, 'Google Sans', system-ui, sans-serif\" };\n const primary = dark ? 'rgba(255,255,255,0.95)' : 'rgba(27,27,31,0.95)';\n const secondary = dark ? 'rgba(255,255,255,0.65)' : 'rgba(68,71,78,0.8)';\n /* Material You: the clock picks up the wallpaper's tone, dark on light. */\n const clockColor = dark ? 'rgba(255,255,255,0.95)' : 'rgba(28,44,40,0.9)';\n return (\n <Device\n label=\"Android\"\n dark={dark}\n geometry={PIXEL}\n underlay={pixelBackUrl}\n overlay={pixelMaskUrl}\n overlayPlacement=\"screen\"\n wallpaper={\n dark\n ? 'linear-gradient(170deg,#1d2b33 0%,#262040 58%,#0f1317 100%)'\n : 'linear-gradient(170deg,#b6d2c8 0%,#a3c2b4 55%,#ddd3c0 100%)'\n }\n >\n <div className=\"flex min-h-0 flex-1 flex-col\" style={face}>\n {/* Lock-screen clock: date over the clock, per the kit's templates. */}\n <div className=\"mt-[88px] shrink-0 text-center\" style={{ color: clockColor }}>\n <div className=\"text-[16px] leading-[22px] font-medium\">Mon, Jun 9</div>\n <div className=\"text-[64px] leading-[1.1] font-normal\">{CLOCK}</div>\n </div>\n {/*\n Lock-screen notification, to Google's Android UI Kit: a full-width\n card with 12dp margins, a leading 40dp app icon, a bold 14sp title\n with the \"• now\" inline, a 14sp content line, then the circled\n expander. App name never appears — the icon is the identity,\n exactly as on the real lock screen.\n */}\n <div\n className=\"mx-[12px] mt-[28px] shrink-0 rounded-[16px] p-[12px] backdrop-blur-md\"\n style={{\n /* A step lighter than the wallpaper's darkest stop, so the card reads at night. */\n background: dark ? 'rgba(64,68,76,0.78)' : 'rgba(255,255,255,0.92)',\n boxShadow: dark\n ? '0 4px 16px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.08)'\n : '0 4px 16px rgba(0,0,0,0.12)',\n }}\n >\n <div className=\"flex items-center gap-[12px]\">\n <AppIcon name={appName} size={40} radius={12} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline gap-[6px]\">\n <span\n className=\"min-w-0 truncate text-[14px] leading-[20px] font-bold\"\n style={{ color: primary }}\n >\n {title}\n </span>\n <span className=\"shrink-0 text-[14px] leading-[20px]\" style={{ color: secondary }}>\n • now\n </span>\n </div>\n <div className=\"line-clamp-2 text-[14px] leading-[20px]\" style={{ color: primary }}>\n {body}\n </div>\n </div>\n <span\n className=\"flex size-[28px] shrink-0 items-center justify-center rounded-full\"\n style={{\n background: dark ? 'rgba(255,255,255,0.12)' : 'rgba(27,27,31,0.08)',\n color: secondary,\n }}\n >\n <ChevronDown size={16} strokeWidth={2.5} aria-hidden />\n </span>\n </div>\n </div>\n <div className=\"min-h-0 flex-1\" />\n {/* The lock glyph above the gesture area. */}\n <div\n className=\"mb-[18px] flex shrink-0 justify-center\"\n style={{ color: dark ? 'rgba(255,255,255,0.85)' : 'rgba(28,44,40,0.8)' }}\n >\n <Lock size={18} strokeWidth={2.5} aria-hidden />\n </div>\n </div>\n </Device>\n );\n}\n\nexport function PushPreview({ appName, title, body, scheme, zoom }: PushPreviewProps) {\n const dark = scheme === 'dark';\n return (\n <div\n className=\"flex flex-wrap items-start justify-center gap-12 pt-2\"\n style={{ transform: `scale(${zoom})`, transformOrigin: 'top center' }}\n >\n <IosDevice appName={appName} title={title} body={body} dark={dark} />\n <AndroidDevice appName={appName} title={title} body={body} dark={dark} />\n </div>\n );\n}\n","import type { SlackContent } from '@shware/workflow';\nimport { useTranslation } from 'react-i18next';\nimport { ChatMarkup } from './chat-markup';\nimport { superellipse } from './corner-shape';\n\n/**\n * An incoming-webhook message as Slack draws it in a channel: the app's name and icon with the\n * APP tag, then its Block Kit blocks (header, section with fields and accessory, divider,\n * context, actions, image) — or the plain `text` when there are none, which is also what\n * notifications show. Slack's palette for each theme; close enough to judge the message.\n */\nexport interface SlackPreviewProps {\n message: SlackContent;\n /** The name the app posts under when the message names none: the project title upstream. */\n appName: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\nconst PALETTE = {\n dark: { bg: '#1a1d21', text: '#d1d2d3', muted: '#ababad', name: '#ffffff', border: '#35373b' },\n light: { bg: '#ffffff', text: '#1d1c1d', muted: '#616061', name: '#1d1c1d', border: '#dddddd' },\n};\n\n/** A Block Kit text object: plain text, or mrkdwn formatted. */\ninterface TextObject {\n type: 'plain_text' | 'mrkdwn';\n text: string;\n}\n\ntype Element = Record<string, unknown> & { type: string };\n\nconst textOf = (value: unknown): TextObject | undefined => {\n if (typeof value !== 'object' || value === null) return undefined;\n const object = value as Partial<TextObject>;\n return typeof object.text === 'string' ? (object as TextObject) : undefined;\n};\n\nexport function SlackPreview({ message, appName, scheme, zoom }: SlackPreviewProps) {\n const { t } = useTranslation();\n const colors = PALETTE[scheme];\n const name = message.username ?? appName;\n const linkClass = 'text-[#1d9bd1] hover:underline';\n const Text = ({ value, className }: { value: TextObject | undefined; className?: string }) =>\n value === undefined ? null : (\n <div className={`break-words whitespace-pre-wrap ${className ?? ''}`}>\n {value.type === 'mrkdwn' ? (\n <ChatMarkup text={value.text} dialect=\"slack\" linkClass={linkClass} />\n ) : (\n value.text\n )}\n </div>\n );\n const Button = ({ element }: { element: Element }) => {\n const style = element.style as string | undefined;\n return (\n <span\n className=\"inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold\"\n style={\n style === 'primary'\n ? { background: '#007a5a', borderColor: '#007a5a', color: '#fff' }\n : style === 'danger'\n ? { background: '#e01e5a', borderColor: '#e01e5a', color: '#fff' }\n : { borderColor: colors.border, color: colors.name }\n }\n >\n {textOf(element.text)?.text}\n </span>\n );\n };\n\n const blocks = (message.blocks ?? []) as Element[];\n return (\n <div\n className=\"mx-auto w-full max-w-2xl overflow-hidden rounded-2xl border shadow-sm\"\n style={{\n ...superellipse,\n background: colors.bg,\n borderColor: colors.border,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n >\n <div\n className=\"flex gap-2 px-5 py-4 text-[15px] leading-[1.46668]\"\n style={{ color: colors.text }}\n >\n {message.icon_url ? (\n <img src={message.icon_url} alt=\"\" className=\"size-9 shrink-0 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[#4a154b] text-sm font-bold text-white\">\n {message.icon_emoji === undefined ? name.slice(0, 1).toUpperCase() : '🙂'}\n </div>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div className=\"flex items-baseline gap-1.5\">\n <span className=\"font-black\" style={{ color: colors.name }}>\n {name}\n </span>\n <span\n className=\"rounded-[3px] px-1 text-[10px] font-bold\"\n style={{ background: scheme === 'dark' ? '#35373b' : '#e8e8e8', color: colors.muted }}\n >\n APP\n </span>\n <span className=\"text-xs\" style={{ color: colors.muted }}>\n {t('emails.chatNow')}\n </span>\n </div>\n {blocks.length === 0 ? (\n <Text\n value={{\n type: message.mrkdwn === false ? 'plain_text' : 'mrkdwn',\n text: message.text,\n }}\n />\n ) : (\n blocks.map((block, index) => {\n // oxlint-disable-next-line react/no-array-index-key -- blocks are positional\n const key = index;\n switch (block.type) {\n case 'header':\n return (\n <div\n key={key}\n className=\"mt-1 text-lg font-black\"\n style={{ color: colors.name }}\n >\n {textOf(block.text)?.text}\n </div>\n );\n case 'divider':\n return <hr key={key} className=\"my-2\" style={{ borderColor: colors.border }} />;\n case 'section': {\n const fields = (block.fields as unknown[] | undefined) ?? [];\n const accessory = block.accessory as Element | undefined;\n return (\n <div key={key} className=\"flex gap-3\">\n <div className=\"min-w-0 flex-1\">\n <Text value={textOf(block.text)} />\n {fields.length > 0 && (\n <div className=\"mt-2 grid grid-cols-2 gap-x-4 gap-y-2\">\n {fields.map((field, i) => (\n // oxlint-disable-next-line react/no-array-index-key -- fields are positional\n <Text key={i} value={textOf(field)} />\n ))}\n </div>\n )}\n </div>\n {accessory?.type === 'image' && (\n <img\n src={accessory.image_url as string}\n alt={(accessory.alt_text as string | undefined) ?? ''}\n className=\"size-[88px] shrink-0 rounded-lg object-cover\"\n />\n )}\n {accessory?.type === 'button' && <Button element={accessory} />}\n </div>\n );\n }\n case 'context':\n return (\n <div\n key={key}\n className=\"flex flex-wrap items-center gap-1.5 text-xs\"\n style={{ color: colors.muted }}\n >\n {((block.elements as Element[] | undefined) ?? []).map((element, i) =>\n element.type === 'image' ? (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <img\n key={i}\n src={element.image_url as string}\n alt=\"\"\n className=\"size-4 rounded\"\n />\n ) : (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <Text key={i} value={textOf(element)} />\n )\n )}\n </div>\n );\n case 'actions':\n return (\n <div key={key} className=\"mt-1 flex flex-wrap gap-2\">\n {((block.elements as Element[] | undefined) ?? []).map((element, i) =>\n element.type === 'button' ? (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <Button key={i} element={element} />\n ) : null\n )}\n </div>\n );\n case 'image':\n return (\n <figure key={key} className=\"mt-1\">\n {textOf(block.title) !== undefined && (\n <figcaption className=\"mb-1 text-sm\" style={{ color: colors.muted }}>\n {textOf(block.title)?.text}\n </figcaption>\n )}\n <img\n src={block.image_url as string}\n alt={(block.alt_text as string | undefined) ?? ''}\n className=\"max-h-[300px] rounded-lg object-contain\"\n />\n </figure>\n );\n default:\n return (\n <div key={key} className=\"text-xs italic\" style={{ color: colors.muted }}>\n {t('emails.slackBlockUnsupported', { type: block.type })}\n </div>\n );\n }\n })\n )}\n </div>\n </div>\n </div>\n );\n}\n","import type { ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-textfield`, `--color-placeholder`, `--color-accent`).\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'textarea'>, 'size'> {\n size?: Size;\n className?: string;\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'px-2 py-[5px] text-xs rounded-md focus-visible:ring-2',\n sm: 'px-2 py-[7px] text-sm rounded-lg focus-visible:ring-3',\n md: 'px-3 py-[9px] text-sm rounded-xl focus-visible:ring-3',\n lg: 'px-4 py-[11px] text-md rounded-xl focus-visible:ring-4',\n xl: 'px-4 py-[13px] text-lg rounded-2xl focus-visible:ring-4',\n};\n\nexport function Textarea({ size = 'md', className, ...props }: Props) {\n return (\n <textarea\n {...props}\n className={cn(\n 'transition-colors duration-100 focus:outline-none',\n 'placeholder-placeholder bg-textfield focus-visible:border-accent border',\n 'dark:focus-visible:ring-accent/50 focus-visible:ring-accent/40',\n SIZE_STYLE[size],\n className\n )}\n />\n );\n}\n","import type { DiscordTemplate, EmailTemplate, PushTemplate, SlackTemplate } from '@shware/workflow';\nimport { Minus, Monitor, Moon, Plus, Smartphone, Sun } from 'lucide-react';\nimport { type ReactNode, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cn } from '../utils/cn';\nimport {\n type Props,\n type TemplateFailure,\n previewPropsOf,\n resolveDiscord,\n resolvePush,\n resolveSlack,\n} from '../utils/template-content';\nimport { superellipse } from './corner-shape';\nimport { DiscordPreview } from './discord-preview';\nimport { DARK_SIMULATION } from './email-thumbnail';\nimport { PushPreview } from './push-preview';\nimport { SlackPreview } from './slack-preview';\nimport type { TemplateRefInfo } from './template-refs';\nimport { Textarea } from './textarea';\n\n/**\n * Template preview page: the list on the left comes from IR, the react-email\n * component renders on the right. The email render is the caller's (it owns\n * the query); exactly one of `html` and `failure` describes this render.\n */\nexport interface TemplatePreview {\n html?: string;\n subject?: string;\n /** The template refused its props, or failed to render — field paths included. */\n failure?: TemplateFailure;\n /** Anything else that stopped the render. */\n error?: string;\n loading: boolean;\n}\n\nexport type { TemplateFailure } from '../utils/template-content';\n\nexport interface TemplatesPageProps {\n refs: TemplateRefInfo[];\n /** The project's email registry; keys match the DSL's template keys. */\n emails: Record<string, EmailTemplate | undefined>;\n /** The project's push registry, same contract as `emails` for the push channel. */\n pushes?: Record<string, PushTemplate | undefined>;\n /** The project's Discord and Slack webhook registries. */\n discords?: Record<string, DiscordTemplate | undefined>;\n slacks?: Record<string, SlackTemplate | undefined>;\n /** App identity on the push mockups; defaults to the project title upstream. */\n appName?: string;\n selected: string | undefined;\n /**\n * Channel of the selected template. One key can be registered in more than\n * one registry (an email and a push both called `checkout_reminder`), so the\n * key alone does not say which one is meant; absent picks the first match.\n */\n selectedChannel?: string | undefined;\n /** Rendered output for the selected template, produced by the caller. */\n preview: TemplatePreview;\n /** The project's envelope (`emails.from` / `replyTo`): every email is sent with it. */\n emailDefaults?: { from?: string; replyTo?: string };\n /**\n * In-memory props override for the selected template's preview; absent\n * renders the template's own `preview`. Never written anywhere.\n */\n previewProps?: Props | undefined;\n /**\n * Called as the props editor changes (undefined: back to the template's\n * `preview`). The editor only appears when this is provided.\n */\n onPreviewPropsChange?: (props: Props | undefined) => void;\n /**\n * The preview stage's starting light/dark, normally the studio's own theme.\n * The toolbar toggle overrides it for this visit only — leaving the page\n * drops the override, so the stage always reopens matching the studio.\n */\n defaultScheme?: 'light' | 'dark';\n}\n\n/**\n * One label/value row. A fragment rather than a wrapper so the rows land\n * directly in the parent grid: the label column then sizes to the longest label\n * — a custom header name can be any length and must not wrap — and every row\n * stays aligned with the others. One face, one size throughout.\n */\nfunction Field({ label, children }: { label: string; children: ReactNode }) {\n return (\n <>\n <dt className=\"text-muted whitespace-nowrap\">{label}</dt>\n <dd className=\"text-secondary min-w-0 break-words\">{children}</dd>\n </>\n );\n}\n\n/*\n * The frame is sized to its document and never scrolls itself — the page is\n * the one scroller. Without this a document whose real height has a\n * fractional part overflows the integer height we set by a fraction of a\n * pixel, which is nothing at all with overlay scrollbars and a permanent bar\n * for anyone whose OS always shows them. The thumbnail carries the same line\n * for the same reason.\n */\nconst NO_SCROLL = '<style>html,body{overflow:hidden}</style>';\n\n/*\n * Rough dark-mode simulation, the invert-and-rotate trick: emails carry their\n * own fixed colours, so this approximates what Gmail-style forced dark does to\n * them. Images are re-inverted to keep their real colours.\n */\n/*\n * The explicit white background matters: email bodies are often transparent,\n * and the white behind them is the iframe element's own — outside the\n * document, where the filter cannot reach. Painting it inside makes it flip.\n */\n/** A refused render: which phase, then every failing field path with its message. */\nexport function TemplateFailurePanel({ failure }: { failure: TemplateFailure }) {\n const { t } = useTranslation();\n return (\n <div\n role=\"alert\"\n className=\"mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300\"\n style={superellipse}\n >\n <p className=\"font-medium\">{t(`emails.failure.${failure.phase}`)}</p>\n <ul className=\"mt-2 flex flex-col gap-1\">\n {failure.issues.map((issue, index) => (\n <li key={`${issue.path}:${index}`}>\n {issue.path !== '' && <code className=\"mr-2 font-mono\">{issue.path}</code>}\n {issue.message}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/**\n * The preview props as JSON, editable in memory. Text that is not a JSON\n * object is reported here and handed up as a failure, so the preview never\n * goes on showing the last good render as if it were this one.\n */\nfunction PreviewPropsEditor({\n initial,\n onChange,\n onInvalid,\n onReset,\n}: {\n initial: Props;\n onChange: (props: Props) => void;\n onInvalid: (message: string) => void;\n onReset: () => void;\n}) {\n const { t } = useTranslation();\n /*\n * The text is the user's once they type, and derived from `initial` until\n * then — so an HMR change to the template's `preview` still shows here, and\n * the component never remounts mid-edit (a remount loses the caret).\n */\n const [draft, setDraft] = useState<string | undefined>(undefined);\n const text = draft ?? JSON.stringify(initial, null, 2);\n return (\n <div className=\"border-border bg-card border-b px-6 py-4\">\n <div className=\"flex items-center justify-between\">\n <label htmlFor=\"preview-props\" className=\"text-muted text-sm\">\n {t('emails.previewProps')}\n </label>\n <button\n type=\"button\"\n onClick={() => {\n setDraft(undefined);\n onReset();\n }}\n className=\"text-muted hover:text-primary text-xs transition-colors\"\n >\n {t('emails.previewPropsReset')}\n </button>\n </div>\n <Textarea\n id=\"preview-props\"\n size=\"sm\"\n rows={Math.min(8, Math.max(2, text.split('\\n').length))}\n spellCheck={false}\n className=\"mt-2 w-full font-mono text-xs\"\n value={text}\n onChange={(event) => {\n const next = event.target.value;\n setDraft(next);\n let parsed: unknown;\n try {\n parsed = JSON.parse(next);\n } catch (error) {\n onInvalid(error instanceof Error ? error.message : String(error));\n return;\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n onInvalid(t('emails.previewPropsNotObject'));\n return;\n }\n onChange(parsed as Props);\n }}\n />\n <p className=\"text-muted mt-1.5 text-xs\">{t('emails.previewPropsHint')}</p>\n </div>\n );\n}\n\n/** One control on the floating preview toolbar: a round 32px icon button. */\nfunction ToolButton({\n active = false,\n label,\n onClick,\n children,\n}: {\n active?: boolean;\n label: string;\n onClick: () => void;\n children: ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n title={label}\n aria-label={label}\n aria-pressed={active}\n onClick={onClick}\n className={cn(\n 'flex size-8 items-center justify-center rounded-full transition-colors',\n active ? 'bg-selected text-primary' : 'text-muted hover:bg-hover hover:text-primary'\n )}\n >\n {children}\n </button>\n );\n}\n\nexport function TemplatesPage({\n refs,\n emails,\n pushes = {},\n discords = {},\n slacks = {},\n appName,\n selected,\n selectedChannel,\n preview,\n emailDefaults,\n previewProps,\n onPreviewPropsChange,\n defaultScheme,\n}: TemplatesPageProps) {\n const { t } = useTranslation();\n /* Preview chrome: how the rendered email is framed, not what is in it. */\n /*\n * The stage follows the studio theme until the toggle is clicked; the click\n * is an override held in state only, so a fresh visit follows the theme\n * again — and an untouched stage keeps following live theme switches.\n */\n const [schemeOverride, setSchemeOverride] = useState<'light' | 'dark' | undefined>(undefined);\n const scheme = schemeOverride ?? defaultScheme ?? 'light';\n const setScheme = setSchemeOverride;\n const [device, setDevice] = useState<'desktop' | 'mobile'>('desktop');\n const [zoom, setZoom] = useState(1);\n /* Exactly the template asked for: an unknown key says so rather than showing another's content. */\n const active = refs.find(\n (ref) =>\n ref.key === selected && (selectedChannel === undefined || ref.channel === selectedChannel)\n );\n /* Editor text that is not a JSON object: shown in place of any render. */\n const [jsonError, setJsonError] = useState<{ for: string; message: string } | undefined>();\n /* Each channel reads its own registry, so a push key never shadows an email one. */\n const isPush = active?.channel === 'push';\n const isEmail = active?.channel === 'email';\n const activeEmail = active !== undefined && isEmail ? emails[active.key] : undefined;\n const activePush = active !== undefined && isPush ? pushes[active.key] : undefined;\n const isDiscord = active?.channel === 'discord';\n const isSlack = active?.channel === 'slack';\n const isChat = isDiscord || isSlack;\n const activeDiscord = active !== undefined && isDiscord ? discords[active.key] : undefined;\n const activeSlack = active !== undefined && isSlack ? slacks[active.key] : undefined;\n const { html, subject, error, loading } = preview;\n const activeId = active === undefined ? '' : `${active.channel}:${active.key}`;\n /* Leaving a template drops its JSON error: coming back remounts the editor with fresh text. */\n if (jsonError !== undefined && jsonError.for !== activeId) setJsonError(undefined);\n const propsFailure: TemplateFailure | undefined =\n jsonError?.for === activeId\n ? { phase: 'json', issues: [{ path: '', message: jsonError.message }] }\n : undefined;\n /* Exactly one of these describes this render; a failure is never shown beside a success. */\n const failure = propsFailure ?? preview.failure;\n\n /*\n * The notification, from the same validated content a send uses — the props\n * override when there is one, the template's `preview` otherwise.\n */\n const pushResolution =\n active !== undefined && activePush !== undefined\n ? resolvePush(activePush, active.key, previewProps)\n : undefined;\n const push =\n propsFailure === undefined && pushResolution?.ok === true ? pushResolution.push : undefined;\n const pushFailure =\n propsFailure ?? (pushResolution?.ok === false ? pushResolution.failure : undefined);\n\n /* A chat message, from the same checked content a send posts. */\n const discordResolution =\n active !== undefined && activeDiscord !== undefined\n ? resolveDiscord(activeDiscord, active.key, previewProps)\n : undefined;\n const slackResolution =\n active !== undefined && activeSlack !== undefined\n ? resolveSlack(activeSlack, active.key, previewProps)\n : undefined;\n const chatResolution = discordResolution ?? slackResolution;\n const chatFailure =\n propsFailure ?? (chatResolution?.ok === false ? chatResolution.failure : undefined);\n const chatReady = propsFailure === undefined && chatResolution?.ok === true;\n\n const editedEntry = isPush\n ? activePush\n : isDiscord\n ? activeDiscord\n : isSlack\n ? activeSlack\n : activeEmail;\n\n return (\n <div className=\"flex flex-1\">\n {/* Preview; the template list lives on the /emails index and the header dropdown. */}\n <section className=\"bg-page flex min-w-0 flex-1 flex-col\">\n {active === undefined ? (\n <div className=\"text-muted flex flex-1 items-center justify-center text-sm\">\n {selected === undefined ? t('emails.empty') : t('emails.notFound', { key: selected })}\n </div>\n ) : (\n <>\n {/*\n The envelope: one face, one size, roomy rows — a read-only\n summary reads better as a calm table. Every email goes out with\n the project's envelope; a push's \"envelope\" is its content.\n */}\n {((isEmail && activeEmail !== undefined) || push !== undefined) && (\n <div className=\"border-border bg-card border-b px-6 py-4\">\n <dl className=\"grid grid-cols-[max-content_1fr] gap-x-8 gap-y-2.5 text-sm\">\n {isEmail && activeEmail !== undefined && (\n <>\n <Field label={t('emails.from')}>\n {emailDefaults?.from ?? t('common.none')}\n </Field>\n {emailDefaults?.replyTo !== undefined && (\n <Field label={t('emails.replyTo')}>{emailDefaults.replyTo}</Field>\n )}\n <Field label={t('emails.subject')}>{subject ?? activeEmail.subject}</Field>\n </>\n )}\n {push !== undefined && (\n <>\n <Field label={t('emails.contentTitle')}>{push.title}</Field>\n <Field label={t('emails.contentBody')}>{push.body}</Field>\n {push.image !== undefined && (\n <Field label={t('emails.contentImage')}>{push.image}</Field>\n )}\n </>\n )}\n </dl>\n </div>\n )}\n\n {onPreviewPropsChange !== undefined && editedEntry !== undefined && (\n <PreviewPropsEditor\n /* A fresh editor per template only: the key must not change while someone types. */\n key={activeId}\n /* What the preview renders: the props handed in, else the template's own `preview`. */\n initial={previewProps ?? previewPropsOf(editedEntry)}\n onChange={(next) => {\n setJsonError(undefined);\n onPreviewPropsChange(next);\n }}\n onInvalid={(message) => setJsonError({ for: activeId, message })}\n onReset={() => {\n setJsonError(undefined);\n onPreviewPropsChange(undefined);\n }}\n />\n )}\n\n {/*\n Dot grid with the workflow canvas's look (its two themes' exact\n canvas/grid colours, 16px gap), marking everything around the\n rendered email as the studio's surface. It follows the toolbar's\n light/dark toggle rather than the studio theme, so flipping the\n simulated client mode visibly flips the whole stage.\n */}\n <div\n className=\"relative flex flex-1 flex-col\"\n style={{\n backgroundColor: scheme === 'dark' ? '#000' : 'var(--color-gray-50)',\n /* 0.5px radius: react-flow draws its dots at r=0.5 for zoom 1. */\n backgroundImage: `radial-gradient(${\n scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-400)'\n } 0.5px, transparent 0.5px)`,\n backgroundSize: '16px 16px',\n }}\n >\n {/* The stage grows with the email and the page scrolls it (see\n __root); the toolbar below rides along as `sticky`. */}\n <div className=\"flex-1 p-6 pb-4\">\n {isChat ? (\n (isDiscord ? activeDiscord : activeSlack) === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">\n {t('emails.notRegistered')}\n </p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.chatNotRegisteredHint', {\n key: active.key,\n channel: isDiscord ? 'discord' : 'slack',\n })}\n </p>\n </div>\n ) : chatFailure !== undefined ? (\n <TemplateFailurePanel failure={chatFailure} />\n ) : discordResolution?.ok === true ? (\n <DiscordPreview\n message={discordResolution.message}\n appName={appName ?? 'App'}\n scheme={scheme}\n zoom={zoom}\n />\n ) : slackResolution?.ok === true ? (\n <SlackPreview\n message={slackResolution.message}\n appName={appName ?? 'App'}\n scheme={scheme}\n zoom={zoom}\n />\n ) : null\n ) : isPush ? (\n activePush === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">\n {t('emails.notRegistered')}\n </p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.pushNotRegisteredHint', { key: active.key })}\n </p>\n </div>\n ) : pushFailure !== undefined ? (\n <TemplateFailurePanel failure={pushFailure} />\n ) : (\n <PushPreview\n appName={appName ?? 'App'}\n title={push?.title ?? ''}\n body={push?.body ?? ''}\n scheme={scheme}\n zoom={zoom}\n />\n )\n ) : activeEmail === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">{t('emails.notRegistered')}</p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.notRegisteredHint', { key: active.key })}\n </p>\n </div>\n ) : failure !== undefined ? (\n <TemplateFailurePanel failure={failure} />\n ) : loading ? (\n <div className=\"text-muted text-center text-sm\">{t('emails.rendering')}</div>\n ) : error !== undefined ? (\n <div\n className=\"mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300\"\n style={superellipse}\n >\n {error}\n </div>\n ) : (\n <iframe\n title={`${active.key} preview`}\n srcDoc={`${html ?? ''}${NO_SCROLL}${scheme === 'dark' ? DARK_SIMULATION : ''}`}\n /*\n * Sized to its document rather than the pane, so long emails\n * scroll in the outer container — which can pad past the\n * floating toolbar; an iframe scrolling internally cannot.\n */\n onLoad={(event) => {\n const frame = event.currentTarget;\n const root = frame.contentDocument?.documentElement ?? undefined;\n if (root === undefined) return;\n /* getBoundingClientRect keeps the fraction scrollHeight rounds off; ceil it. */\n const height = Math.ceil(root.getBoundingClientRect().height);\n if (height > 0) frame.style.height = `${height}px`;\n }}\n /*\n * Square corners — this box IS the email's viewport, not a\n * studio card. Border and fill follow the toolbar's\n * light/dark toggle with the stage, not the studio theme.\n */\n className=\"mx-auto min-h-40 border\"\n style={{\n borderColor:\n scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-300)',\n backgroundColor: '#fff',\n width: device === 'mobile' ? 375 : '100%',\n maxWidth: device === 'mobile' ? 375 : 672,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n />\n )}\n </div>\n\n {/*\n Floating preview toolbar: client scheme, device width, zoom.\n Sticky rather than absolute — the stage is no longer a fixed\n frame, so anchoring to its bottom would park the toolbar at the\n end of a long email instead of keeping it to hand. The wrapper\n spans the stage and must not swallow clicks meant for it.\n */}\n {(isChat\n ? chatReady\n : isPush\n ? push !== undefined\n : activeEmail !== undefined &&\n !loading &&\n error === undefined &&\n failure === undefined) && (\n <div className=\"pointer-events-none sticky bottom-0 z-10 flex justify-center pt-2 pb-4\">\n <div className=\"border-border bg-card pointer-events-auto flex items-center gap-0.5 rounded-full border p-1 shadow-lg\">\n <ToolButton\n active={scheme === 'light'}\n label={t('emails.previewLight')}\n onClick={() => setScheme('light')}\n >\n <Sun size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <ToolButton\n active={scheme === 'dark'}\n label={t('emails.previewDark')}\n onClick={() => setScheme('dark')}\n >\n <Moon size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n {/* Device widths are an email concern; a push shows both platforms, a chat message its client. */}\n {isEmail && (\n <>\n <div className=\"bg-border mx-1 h-4 w-px\" />\n <ToolButton\n active={device === 'desktop'}\n label={t('emails.previewDesktop')}\n onClick={() => setDevice('desktop')}\n >\n <Monitor size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <ToolButton\n active={device === 'mobile'}\n label={t('emails.previewMobile')}\n onClick={() => setDevice('mobile')}\n >\n <Smartphone size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n </>\n )}\n <div className=\"bg-border mx-1 h-4 w-px\" />\n <ToolButton\n label={t('emails.zoomOut')}\n onClick={() => setZoom((level) => Math.max(0.5, level - 0.25))}\n >\n <Minus size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <button\n type=\"button\"\n title={t('emails.zoomReset')}\n onClick={() => setZoom(1)}\n className=\"text-secondary hover:text-primary w-11 text-center text-xs font-medium tabular-nums transition-colors\"\n >\n {Math.round(zoom * 100)}%\n </button>\n <ToolButton\n label={t('emails.zoomIn')}\n onClick={() => setZoom((level) => Math.min(1.5, level + 0.25))}\n >\n <Plus size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </section>\n </div>\n );\n}\n","/**\n * What to call a code-owned asset in the UI.\n *\n * Keys are wire identity — referenced by name in IR, keyed on by the engine —\n * and nothing anyone should have to read. The label is `meta.name` when set;\n * when it is not, an explicit placeholder, because a blank is easy to miss and\n * \"Untitled\" is an invitation to name the thing.\n */\nexport function displayName(name: string | undefined, untitled: string): string {\n const trimmed = name?.trim();\n return trimmed !== undefined && trimmed !== '' ? trimmed : untitled;\n}\n","/**\n * Sparkline for the workflows list.\n *\n * A polyline over N points: no axes, no scales, no interaction. Same reasoning\n * as the Metrics tab chart — at this size a charting dependency would only add\n * weight.\n */\nexport interface SparklineProps {\n values: readonly number[];\n width?: number;\n height?: number;\n className?: string;\n}\n\nexport function Sparkline({ values, width = 76, height = 26, className }: SparklineProps) {\n if (values.length < 2) {\n return (\n <svg width={width} height={height} className={className} aria-hidden>\n <line\n x1={0}\n y1={height - 1}\n x2={width}\n y2={height - 1}\n stroke=\"var(--color-border)\"\n strokeWidth={1.5}\n />\n </svg>\n );\n }\n\n const max = Math.max(...values);\n const min = Math.min(...values);\n const span = max - min || 1;\n const stepX = width / (values.length - 1);\n // 1px inset top and bottom so the stroke is never clipped\n const points = values\n .map((value, index) => {\n const x = index * stepX;\n const y = height - 1 - ((value - min) / span) * (height - 2);\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(' ');\n\n const flat = max === min;\n\n return (\n <svg width={width} height={height} className={className} aria-hidden>\n <polyline\n points={points}\n fill=\"none\"\n stroke={flat ? 'var(--color-border)' : 'var(--color-primary)'}\n strokeWidth={1.5}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import type { NodeIR, WorkflowIR } from '@shware/workflow';\nimport { clsx } from 'clsx';\nimport { AlarmClock, Mail, Workflow as WorkflowIcon } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport type { WorkflowReport } from '../config';\nimport { displayName } from '../utils/label';\nimport { superellipse } from './corner-shape';\nimport { Sparkline } from './sparkline';\n\n/**\n * The workflows list: one row per definition with its shape (how many\n * messages, how many waits) and the funnel from the stats source, all inside\n * a single card.\n *\n * One card of rows rather than a card per workflow: the four funnel numbers\n * are only worth showing because they can be read down a column, and a grid\n * of tiles breaks exactly that. Below `md` there are no columns left to align,\n * so a row folds into title-then-stats instead.\n */\nexport interface WorkflowListProps {\n /** Local definitions, keyed by the id used in the URL. */\n items: { key: string; ir: WorkflowIR }[];\n reports?: WorkflowReport[];\n onOpen: (key: string) => void;\n}\n\n/** Count message and delay nodes across the whole tree, arms included. */\nfunction countNodes(nodes: readonly NodeIR[], acc = { messages: 0, delays: 0 }) {\n for (const node of nodes) {\n if (node.type === 'message') acc.messages++;\n if (node.type === 'delay' || node.type === 'random_delay' || node.type === 'wait_until') {\n acc.delays++;\n }\n if (node.type === 'branch') {\n for (const branchCase of node.cases) countNodes(branchCase.flow, acc);\n if (node.otherwise) countNodes(node.otherwise, acc);\n }\n if (node.type === 'cohort') for (const arm of node.arms) countNodes(arm.flow, acc);\n if (node.type === 'wait_until' && Array.isArray(node.onTimeout)) {\n countNodes(node.onTimeout, acc);\n }\n }\n return acc;\n}\n\nconst compact = (value: number) =>\n value >= 1000\n ? `${(value / 1000).toFixed(2).replace(/0+$/, '').replace(/\\.$/, '')}k`\n : `${value}`;\n\nconst rate = (part: number | undefined, whole: number | undefined) =>\n part === undefined || whole === undefined || whole === 0\n ? '—'\n : `${((part / whole) * 100).toFixed(1)}%`;\n\nconst COLUMNS = ['delivered', 'opened', 'clicked', 'converted'] as const;\n\n/*\n * Not pinned: the app header is the only sticky chrome, so the head scrolls\n * away with the rows and needs no opaque fill of its own. The radii stay —\n * the card has no `overflow` to clip with, so its top corners are cut here.\n */\nconst HEAD_CELL = 'border-border border-b py-3 first:rounded-tl-2xl last:rounded-tr-2xl';\n\n/*\n * Stacked, every cell is inset by the row's own padding instead of its own,\n * so the four metrics line up with the title above them and the row's hover\n * fill still reaches the card's edges.\n */\nconst CELL = 'border-border border-b py-4 max-md:border-b-0 max-md:px-3';\n\n/*\n * The studio's palette is monochrome; colour is reserved for state. Running /\n * draft is state, so it keeps green and grey.\n */\n\nexport function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {\n const { t } = useTranslation();\n const byId = new Map((reports ?? []).map((report) => [report.id, report]));\n\n return (\n /*\n * No `overflow` on the card, deliberately: any value at all turns it into\n * a scrollport of its own and draws a second bar inset inside the border —\n * the page is the one scroller (see __root). Nothing clips, so the corners\n * are re-cut on the first and last cells below.\n */\n <div className=\"border-border bg-card rounded-2xl border\" style={superellipse}>\n {/* Below `md` the table leaves table layout entirely and each row lays\n itself out as a four-column grid — see the row classes. */}\n <table className=\"w-full table-fixed border-separate border-spacing-0 text-sm max-md:block\">\n <thead className=\"max-md:hidden\">\n <tr className=\"text-muted text-left text-xs font-medium\">\n <th className={clsx(HEAD_CELL, 'min-w-0 px-6')} style={superellipse}>\n {t('common.name')}\n </th>\n <th className={clsx(HEAD_CELL, 'w-28 px-3')} style={superellipse} />\n {COLUMNS.map((column) => (\n <th key={column} className={clsx(HEAD_CELL, 'w-28 px-3')} style={superellipse}>\n {t(`workflows.columns.${column}`)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"max-md:block\">\n {items.map(({ key, ir }) => {\n const shape = countNodes(ir.flow);\n const report = byId.get(ir.id);\n const values: Record<(typeof COLUMNS)[number], string> = {\n delivered: report?.delivered === undefined ? '—' : compact(report.delivered),\n opened: rate(report?.opened, report?.delivered),\n clicked: rate(report?.clicked, report?.delivered),\n converted: rate(report?.converted, report?.entered),\n };\n\n return (\n <tr\n key={key}\n onClick={() => onOpen(key)}\n className={clsx(\n 'cursor-pointer align-top [&>td]:transition-colors',\n /*\n * Laid out as a table the hover fill has to live on the\n * cells: a row box paints its background underneath them,\n * where no cell radius reaches it, so the last row would\n * poke square grey corners out of the card. Stacked, the row\n * is an ordinary grid box and takes fill and radius itself.\n */\n 'md:hover:[&>td]:bg-hover md:last:[&>td]:border-b-0',\n 'md:last:[&>td:first-child]:rounded-bl-2xl md:last:[&>td:last-child]:rounded-br-2xl',\n /* Stacked: title / status / the metrics two by two\n — four across a phone leaves no room for a label, let\n alone the sparkline under it. */\n 'border-border max-md:hover:bg-hover max-md:grid max-md:grid-cols-6',\n 'max-md:border-b max-md:px-3 max-md:first:rounded-t-2xl',\n 'max-md:last:rounded-b-2xl max-md:last:border-b-0'\n )}\n style={superellipse}\n >\n <td\n className={clsx(CELL, 'px-6 max-md:order-1 max-md:col-span-6 max-md:pb-2')}\n style={superellipse}\n >\n <div className=\"flex items-start gap-3\">\n <WorkflowIcon className=\"text-muted mt-0.5 size-4 shrink-0\" strokeWidth={2} />\n <div className=\"min-w-0\">\n <div\n className={clsx(\n 'truncate font-medium',\n ir.meta?.name === undefined ? 'text-muted italic' : 'text-primary'\n )}\n >\n {displayName(ir.meta?.name, t('common.untitled'))}\n </div>\n {/*\n Below md these two step back out of the title's indent\n (the 16px icon plus its 12px gap). The stacked rows under\n them — status, then the funnel — start at the card's edge,\n so keeping the indent here left a notch down the side.\n */}\n {ir.meta?.description !== undefined && (\n <p className=\"text-muted mt-1 truncate text-sm max-md:-ml-7\">\n {ir.meta.description}\n </p>\n )}\n <div className=\"text-muted mt-2 flex items-center gap-3 text-xs max-md:-ml-7\">\n <span className=\"flex items-center gap-1\">\n <Mail className=\"size-3.5\" strokeWidth={2} />\n {shape.messages}\n </span>\n <span className=\"flex items-center gap-1\">\n <AlarmClock className=\"size-3.5\" strokeWidth={2} />\n {shape.delays}\n </span>\n </div>\n </div>\n </div>\n </td>\n\n {/* Second in the DOM so the desktop column order holds; `order`\n moves it under the title once the row is a grid. */}\n <td\n className={clsx(\n CELL,\n 'px-3 max-md:order-3 max-md:col-span-6 max-md:pt-0 max-md:pb-3'\n )}\n style={superellipse}\n >\n <span\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n report\n ? 'bg-green-50 text-green-700 dark:bg-green-400/10 dark:text-green-300'\n : 'bg-selected text-muted'\n )}\n >\n <span\n className={clsx(\n 'size-1.5 rounded-full',\n report ? 'bg-green-500' : 'bg-muted'\n )}\n />\n {report ? t('status.running') : t('status.draft')}\n </span>\n </td>\n\n {COLUMNS.map((column) => (\n <td\n key={column}\n className={clsx(\n CELL,\n 'px-3 max-md:order-4 max-md:col-span-3 max-md:pt-0 max-md:pb-4'\n )}\n style={superellipse}\n >\n {/* The head is gone when stacked, so each figure names itself. */}\n <div className=\"text-muted mb-1 truncate text-xs md:hidden\">\n {t(`workflows.columns.${column}`)}\n </div>\n <div className=\"tabular-nums\">{values[column]}</div>\n <Sparkline values={report?.series?.[column] ?? []} className=\"mt-1\" />\n </td>\n ))}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n","import { ArrowDown, ArrowUp, type LucideIcon, Minus } from 'lucide-react';\nimport { Fragment, type PointerEvent, useId, useState } from 'react';\nimport { cn } from '../utils/cn';\nimport { superellipse } from './corner-shape';\n\n/**\n * One metric of the delivery funnel: what it is worth right now, which way it\n * moved, and its shape over the queried range.\n *\n * Four of these replace the single four-series line chart. That chart made the\n * drop-off between the stages legible and nothing else — every series but the\n * first was pinned to the floor by a shared y axis, so a 2% swing in clicks was\n * invisible. Each card gets its own scale instead, which is what you want once\n * the funnel's shape is a known quantity and the question becomes \"is today\n * normal for this stage\".\n *\n * Hand-drawn SVG, like every other chart here — see the note in sparkline.tsx.\n */\n\n/** Which way a delta points; `flat` is an exact zero, not a rounding of one. */\nexport type Trend = 'up' | 'down' | 'flat';\n\n/**\n * One plotted line.\n *\n * A card plots either one series or a total and the parts it decomposes into\n * (email opens split into human and machine). The parts are not independent\n * measurements, which is why they arrive as a list on one card rather than as\n * cards of their own: they only mean anything read against the total.\n */\nexport interface MetricSeries {\n /** Named in the hover readout, beside its colour swatch. */\n label: string;\n /** One value per bucket, oldest first; as long as `dates`. */\n values: readonly number[];\n}\n\nexport interface MetricCardProps {\n label: string;\n /** The current bucket, already formatted ('9,280', '26.2%'). */\n value: string;\n /** Period-over-period change, already formatted and signed. */\n delta?: { text: string; trend: Trend };\n /**\n * Bucket dates, oldest first, already formatted: the card has no business\n * knowing the locale, and the hover readout is the only place they are read.\n */\n dates: readonly string[];\n /**\n * Head series first. It gets the strongest shade and the gradient fill; any\n * that follow are its components and share its y scale — plotted against\n * scales of their own, two halves would not visibly add up to the whole.\n */\n series: readonly MetricSeries[];\n /** Formats the extremes in the plot's corners, and the values under the cursor. */\n format: (value: number) => string;\n}\n\n/**\n * viewBox units; `preserveAspectRatio=\"none\"` stretches them to the card.\n *\n * The height doubles as the plot's pixel height, which is what lets the hover\n * indicator place its dots with a y taken straight from the viewBox. The two\n * are the same number on purpose — move one and the other has to follow, or\n * the curve stretches vertically and the dots leave it.\n */\nconst VIEW_WIDTH = 320;\nconst VIEW_HEIGHT = 120;\n/** Headroom above the peak so the max label never sits on the curve. */\nconst TOP_PAD = 22;\n\n/**\n * Successive series, each mixed further toward the card it sits on.\n *\n * Mixing with the surface — rather than stepping down a fixed ramp — is what\n * makes one set of shades work in both themes: it pales toward the white card\n * in light mode and darkens toward the near-black one in dark mode, so the\n * head series is the highest-contrast line either way and the components read\n * as subordinate to it. A second hue was the other option and is not on the\n * table: accent is the only colour in the studio.\n */\nconst seriesColor = (index: number): string =>\n `color-mix(in oklab, var(--color-accent) ${Math.round(100 * 0.7 ** index)}%, var(--color-card))`;\n\ninterface Point {\n x: number;\n y: number;\n}\n\n/**\n * A cardinal spline through every point. The samples are daily counts, not a\n * continuous signal, so the curve is a reading aid rather than interpolation —\n * which is why it is allowed to overshoot slightly between points.\n */\nfunction splinePath(points: readonly Point[]): string {\n if (points.length === 0) return '';\n const first = points[0];\n let d = `M ${first.x.toFixed(1)} ${first.y.toFixed(1)}`;\n for (let i = 0; i < points.length - 1; i++) {\n /* Clamped neighbours, so the end segments bend the same way as the middle. */\n const p0 = points[Math.max(0, i - 1)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(points.length - 1, i + 2)];\n const c1x = p1.x + (p2.x - p0.x) / 6;\n const c1y = p1.y + (p2.y - p0.y) / 6;\n const c2x = p2.x - (p3.x - p1.x) / 6;\n const c2y = p2.y - (p3.y - p1.y) / 6;\n d += ` C ${c1x.toFixed(1)} ${c1y.toFixed(1)}, ${c2x.toFixed(1)} ${c2y.toFixed(1)}, ${p2.x.toFixed(1)} ${p2.y.toFixed(1)}`;\n }\n return d;\n}\n\nconst TREND_STYLE: Record<Trend, string> = {\n up: 'text-emerald-600 dark:text-emerald-400',\n down: 'text-red-600 dark:text-red-400',\n flat: 'text-secondary',\n};\n\nconst TREND_ICON: Record<Trend, LucideIcon> = { up: ArrowUp, down: ArrowDown, flat: Minus };\n\nexport function MetricCard({ label, value, delta, dates, series, format }: MetricCardProps) {\n const gradientId = useId();\n /** Which bucket the cursor is over; null once it leaves the plot. */\n const [active, setActive] = useState<number | null>(null);\n\n /* One scale for every line on the card: the components sum to the head\n series, and a shared axis is the only way that addition is visible. */\n const all = series.flatMap((one) => [...one.values]);\n const max = Math.max(...all, 0);\n const min = Math.min(...all, max);\n /* A flat series has no range to scale against; park it on the baseline. */\n const span = max - min || 1;\n const stepX = dates.length > 1 ? VIEW_WIDTH / (dates.length - 1) : 0;\n const yOf = (point: number) => TOP_PAD + (1 - (point - min) / span) * (VIEW_HEIGHT - TOP_PAD);\n const plotted = series.map((one) =>\n one.values.map((point, index) => ({ x: index * stepX, y: yOf(point) }))\n );\n\n const head = plotted.length > 0 ? plotted[0] : [];\n const line = splinePath(head);\n /* The fill closes the curve to the bottom edge and back to where it started.\n Only the head series gets one: three stacked washes would muddy the plot\n and the components are read as lines against the total, not as volumes. */\n const area = line === '' ? '' : `${line} L ${VIEW_WIDTH} ${VIEW_HEIGHT} L 0 ${VIEW_HEIGHT} Z`;\n\n const DeltaIcon = delta ? TREND_ICON[delta.trend] : undefined;\n\n /* The series can be replaced under a held cursor — a new granularity, a new\n channel — so a stale index is a live possibility, not a defensive fiction. */\n const hovered = active !== null && active < dates.length ? active : undefined;\n\n /**\n * Cursor → bucket. The plot is `preserveAspectRatio=\"none\"`, so its viewBox\n * is stretched to whatever width the card ended up with; only the rendered\n * box knows the real scale, and reading x in viewBox units would leave the\n * indicator a growing distance behind the pointer.\n */\n const trackPointer = (event: PointerEvent<HTMLDivElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n if (width === 0 || dates.length === 0) return;\n const index = Math.round(((event.clientX - left) / width) * (dates.length - 1));\n setActive(Math.min(Math.max(index, 0), dates.length - 1));\n };\n\n return (\n <section\n className=\"border-border bg-card flex flex-col overflow-hidden rounded-2xl border\"\n style={superellipse}\n >\n <div className=\"px-4 pt-4\">\n <h3 className=\"text-sm font-medium\">{label}</h3>\n </div>\n\n <div className=\"flex flex-wrap items-baseline gap-x-2 gap-y-1 px-4 pt-3\">\n <span className=\"text-2xl font-semibold tracking-tight tabular-nums\">{value}</span>\n {delta !== undefined && DeltaIcon !== undefined && (\n <span className={cn('inline-flex items-center gap-1 text-xs', TREND_STYLE[delta.trend])}>\n <DeltaIcon size={12} strokeWidth={2.5} aria-hidden />\n {delta.text}\n </span>\n )}\n </div>\n\n <div\n className=\"relative mt-3\"\n onPointerMove={trackPointer}\n onPointerLeave={() => setActive(null)}\n >\n <svg\n viewBox={`0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height: VIEW_HEIGHT }}\n role=\"img\"\n aria-label={label}\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"var(--color-accent)\" stopOpacity={0.22} />\n <stop offset=\"100%\" stopColor=\"var(--color-accent)\" stopOpacity={0} />\n </linearGradient>\n </defs>\n {area !== '' && <path d={area} fill={`url(#${gradientId})`} />}\n {/* Components first, head last: where they cross, the total is the\n line you want on top. */}\n {plotted\n .map((points, index) => ({ d: splinePath(points), index }))\n .filter((entry) => entry.d !== '')\n .reverse()\n .map((entry) => (\n <path\n key={entry.index}\n d={entry.d}\n fill=\"none\"\n style={{ stroke: seriesColor(entry.index) }}\n strokeWidth={1.75}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n /* The viewBox is stretched, so the stroke must opt out of scaling. */\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </svg>\n {all.length > 0 && (\n <>\n <span className=\"text-muted pointer-events-none absolute top-0 left-4 text-xs tabular-nums\">\n {format(max)}\n </span>\n <span className=\"text-muted pointer-events-none absolute right-4 bottom-1 text-xs tabular-nums\">\n {format(min)}\n </span>\n </>\n )}\n {hovered !== undefined && (\n <HoverReadout\n x={dates.length > 1 ? hovered / (dates.length - 1) : 0}\n date={dates[hovered]}\n rows={series.map((one, index) => ({\n color: seriesColor(index),\n label: one.label,\n value: format(one.values[hovered]),\n y: plotted[index][hovered].y,\n }))}\n />\n )}\n </div>\n </section>\n );\n}\n\n/** One line of the readout: which series, what it read, and where its dot goes. */\ninterface ReadoutRow {\n color: string;\n label: string;\n value: string;\n /** Plot pixels from the top — the viewBox height is the rendered height. */\n y: number;\n}\n\n/**\n * Rule, dots and panel for the bucket under the cursor.\n *\n * HTML rather than SVG: a circle drawn in the stretched viewBox renders as an\n * ellipse and the panel would shear with it. A percentage rides the same\n * stretch the curve does, so `x` is a 0–1 fraction of the plot's width, while\n * each `y` is plain pixels.\n *\n * Every card uses the same layout, one line per series, whether it plots one\n * or three. A single line's swatch and name are redundant on their own card,\n * but four cards sit side by side: reading across them, a row that suddenly\n * loses its columns costs more than the redundancy does.\n */\nfunction HoverReadout({ x, date, rows }: { x: number; date: string; rows: readonly ReadoutRow[] }) {\n const left = `${x * 100}%`;\n return (\n <div aria-hidden className=\"pointer-events-none\">\n <div className=\"bg-border absolute inset-y-0 w-px\" style={{ left }} />\n {rows.map((row) => (\n <div\n key={row.label}\n className=\"border-card absolute size-2.5 rounded-full border-2\"\n style={{ left, top: row.y, background: row.color, transform: 'translate(-50%, -50%)' }}\n />\n ))}\n {/*\n Anchored by the same fraction it sits at: the panel hugs the left edge\n at the start of the series and the right edge at the end, so the card\n never clips it.\n\n `w-max` is load-bearing. The date spans all three columns, but the\n middle one is `1fr`, and a flexible track takes no min-content\n contribution from a spanning item — so a shrink-to-fit panel sizes\n itself to the data row alone and the date spills out the side. Sizing\n to max-content measures the date too; the `1fr` then hands the slack to\n the label, which keeps the value flush right.\n */}\n <div\n className=\"border-border bg-card shadow-card-shadow absolute top-0 grid w-max items-center gap-x-3 gap-y-1 rounded-lg border px-2.5 py-2 text-xs shadow-md\"\n style={{\n ...superellipse,\n left,\n transform: `translateX(-${x * 100}%)`,\n gridTemplateColumns: 'auto 1fr auto',\n }}\n >\n <div className=\"col-span-full font-medium whitespace-nowrap\">{date}</div>\n {rows.map((row) => (\n <Fragment key={row.label}>\n <span\n className=\"size-3 rounded-sm\"\n style={{ ...superellipse, background: row.color }}\n />\n <span className=\"text-secondary whitespace-nowrap\">{row.label}</span>\n <span className=\"text-right font-medium tabular-nums\">{row.value}</span>\n </Fragment>\n ))}\n </div>\n </div>\n );\n}\n","import type { ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-textfield`, `--color-placeholder`, `--color-accent`).\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'input'>, 'size'> {\n size?: Size;\n htmlSize?: number;\n className?: string;\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'h-7 px-2 text-xs rounded-md focus-visible:ring-2',\n sm: 'h-9 px-2 text-sm rounded-lg focus-visible:ring-3',\n md: 'h-10 px-3 text-sm rounded-xl focus-visible:ring-3',\n lg: 'h-12 px-4 text-md rounded-xl focus-visible:ring-4',\n xl: 'h-14 px-4 text-lg rounded-2xl focus-visible:ring-4',\n};\n\nexport function Input({ size = 'md', type = 'text', htmlSize, className, ...props }: Props) {\n return (\n <input\n {...props}\n type={type}\n size={htmlSize}\n className={cn(\n 'transition-colors duration-100 focus:outline-none',\n 'placeholder-placeholder bg-textfield focus-visible:border-accent border',\n 'dark:focus-visible:ring-accent/50 focus-visible:ring-accent/40',\n SIZE_STYLE[size],\n className\n )}\n />\n );\n}\n","import {\n FloatingFocusManager,\n autoUpdate,\n flip,\n offset,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Calendar } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cn } from '../utils/cn';\nimport { Button } from './button';\nimport { superellipse } from './corner-shape';\nimport { Input } from './input';\n\n/**\n * The range every panel on the Overview reads from. Both ends are inclusive\n * ISO `YYYY-MM-DD` days — the same shape the stats contract takes, so the\n * picker's value can be handed straight to a query.\n */\nexport interface DateRange {\n from: string;\n to: string;\n}\n\n/**\n * A local calendar day, not a UTC instant. `toISOString().slice(0, 10)` is the\n * usual shortcut and it is wrong west of Greenwich for most of the day: it\n * reports yesterday, so \"last 30 days\" silently ends a day early.\n */\nexport function isoDay(date: Date): string {\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, '0');\n const day = `${date.getDate()}`.padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\n/** Parse an ISO day back to local midnight — `new Date(iso)` would read it as UTC. */\nexport function parseIsoDay(iso: string): Date {\n const [year = 1970, month = 1, day = 1] = iso.split('-').map(Number);\n return new Date(year, month - 1, day);\n}\n\n/** The inclusive range of the `count` days ending today. */\nexport function lastDays(count: number): DateRange {\n const to = new Date();\n const from = new Date();\n from.setDate(from.getDate() - (count - 1));\n return { from: isoDay(from), to: isoDay(to) };\n}\n\n/** 'Aug 21, 2026' — the compact form, for the toolbar trigger. */\nexport function formatDay(iso: string, locale: string): string {\n return parseIsoDay(iso).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nconst PRESETS = [7, 14, 30, 90] as const;\n\ninterface Props {\n value: DateRange;\n onChange: (range: DateRange) => void;\n className?: string;\n}\n\n/**\n * Presets plus two date fields, rather than a drawn calendar.\n *\n * Reporting ranges are chosen by duration (\"the last month\"), not by hunting\n * for a Tuesday, so the presets answer nearly every case; the two fields cover\n * the rest at a fraction of a calendar widget's weight — and the native picker\n * they carry is already localized and keyboard-accessible.\n */\nexport function DateRangePicker({ value, onChange, className }: Props) {\n const { t, i18n } = useTranslation();\n const [open, setOpen] = useState(false);\n\n const { refs, floatingStyles, context } = useFloating({\n open,\n onOpenChange: setOpen,\n placement: 'bottom-start',\n whileElementsMounted: autoUpdate,\n middleware: [offset(4), flip({ padding: 8 }), shift({ padding: 8 })],\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context),\n useRole(context, { role: 'dialog' }),\n ]);\n\n /*\n * A native date field reports '' when it is cleared, and an out-of-calendar\n * year is just as reachable by typing. Neither is a range: '' parses to 1900\n * and would ask the stats source for a century of daily buckets. Ignore\n * anything that is not a plain ISO day and the field snaps back to the value\n * it had, which is the only other honest answer — the range is required.\n */\n const isDay = (value: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(value);\n /* An inverted range is never what was meant; pin the other end to the edit. */\n const setFrom = (from: string) => {\n if (isDay(from)) onChange({ from, to: from > value.to ? from : value.to });\n };\n const setTo = (to: string) => {\n if (isDay(to)) onChange({ from: to < value.from ? to : value.from, to });\n };\n\n return (\n <>\n <Button\n ref={refs.setReference}\n size=\"sm\"\n variant=\"outline\"\n className={cn('gap-2 font-normal', className)}\n {...getReferenceProps()}\n >\n <Calendar size={16} strokeWidth={2} aria-hidden className=\"text-secondary shrink-0\" />\n <span className=\"tabular-nums\">\n {formatDay(value.from, i18n.language)} – {formatDay(value.to, i18n.language)}\n </span>\n </Button>\n {open && (\n <FloatingFocusManager context={context} modal={false}>\n <div\n ref={refs.setFloating}\n style={{ ...floatingStyles, ...superellipse }}\n className=\"border-border bg-card shadow-card-shadow z-50 w-64 rounded-xl border p-2 shadow-lg\"\n {...getFloatingProps()}\n >\n {PRESETS.map((days) => (\n <button\n key={days}\n type=\"button\"\n className=\"hover:bg-hover block w-full rounded-lg px-2.5 py-1.5 text-left text-sm\"\n style={superellipse}\n onClick={() => {\n onChange(lastDays(days));\n setOpen(false);\n }}\n >\n {t('metrics.range.lastDays', { count: days })}\n </button>\n ))}\n <div className=\"border-border mt-2 space-y-2 border-t pt-2\">\n <label className=\"block\">\n <span className=\"text-muted text-xs\">{t('metrics.range.from')}</span>\n <Input\n size=\"sm\"\n type=\"date\"\n max={value.to}\n value={value.from}\n className=\"mt-1 w-full\"\n onChange={(event) => setFrom(event.target.value)}\n />\n </label>\n <label className=\"block\">\n <span className=\"text-muted text-xs\">{t('metrics.range.to')}</span>\n <Input\n size=\"sm\"\n type=\"date\"\n min={value.from}\n value={value.to}\n className=\"mt-1 w-full\"\n onChange={(event) => setTo(event.target.value)}\n />\n </label>\n </div>\n </div>\n </FloatingFocusManager>\n )}\n </>\n );\n}\n","import {\n Bot,\n Globe,\n type LucideIcon,\n Mail,\n MessageCircle,\n MessageSquareText,\n MessagesSquare,\n Send,\n Smartphone,\n Webhook,\n} from 'lucide-react';\nimport type { MetricChannel } from '../config';\n\n/**\n * One glyph per delivery channel, shared by the chart cards, the channel\n * pickers and the message table — a channel has to read the same everywhere or\n * the eye stops using the icon as an index.\n *\n * lucide dropped brand marks, so iOS and Android borrow the nearest generic\n * pair (a handset, a robot) and a browser push a globe: what matters here is that the two platforms are\n * told apart at a glance, not that the logo is right.\n */\nexport const CHANNEL_ICON: Record<MetricChannel, LucideIcon> = {\n email: Mail,\n push_ios: Smartphone,\n push_android: Bot,\n push_web: Globe,\n slack: MessagesSquare,\n discord: MessageCircle,\n sms: MessageSquareText,\n webhook: Webhook,\n};\n\n/** Stand-in for \"every channel\": still a send, just not one transport. */\nexport const ALL_CHANNELS_ICON: LucideIcon = Send;\n\nexport const channelIcon = (channel: MetricChannel | undefined): LucideIcon =>\n channel === undefined ? ALL_CHANNELS_ICON : CHANNEL_ICON[channel];\n","import { useState } from 'react';\nimport { cn } from '../utils/cn';\n\n/**\n * A person's round portrait, with an initial on a tinted circle behind it.\n *\n * The picture comes from a profile's `properties`, a dictionary the project\n * fills — so it is typed `unknown` here and narrowed rather than asserted: an\n * absent key, a null, or a number all mean the same thing to this component,\n * which is \"draw the initial\". A URL that resolves to nothing means it too,\n * once the browser says so, so a dead image degrades to the same fallback\n * instead of leaving a broken-image glyph in the row.\n */\nexport interface AvatarProps {\n /** Straight out of `Profile.properties`; anything but a non-empty string falls back. */\n picture: unknown;\n /** Whatever names the person — a name, an email, an id. Its first letter is the fallback. */\n label: string;\n /** `md` heads the profile drawer; `sm` sits inside a table row. */\n size?: 'sm' | 'md';\n}\n\n/* Font scales with the circle: an `sm` initial at `text-sm` crowds the edges. */\nconst SIZES = {\n sm: 'size-6 text-xs',\n md: 'size-9 text-sm',\n} as const;\n\nexport function Avatar({ picture, label, size = 'md' }: AvatarProps) {\n const [failed, setFailed] = useState(false);\n const src = typeof picture === 'string' && picture !== '' ? picture : undefined;\n\n if (src !== undefined && !failed) {\n return (\n <img\n src={src}\n /* Decorative: the name or address it sits beside already says who this\n is, and a screen reader repeating it is noise. */\n alt=\"\"\n onError={() => setFailed(true)}\n className={cn('shrink-0 rounded-full object-cover', SIZES[size])}\n />\n );\n }\n\n return (\n <div\n aria-hidden\n className={cn(\n 'bg-selected text-secondary flex shrink-0 items-center justify-center rounded-full font-medium',\n SIZES[size]\n )}\n >\n {label.trim().charAt(0).toUpperCase()}\n </div>\n );\n}\n","import type { NodeIR, WorkflowIR } from '@shware/workflow';\n\n/**\n * Derive template references from IR — \"which flows use which template\" is not\n * a hand-maintained list but something computed from the middle layer. It also\n * surfaces templates that are referenced but have no content registered yet.\n */\nexport interface TemplateUsage {\n /** Name of the workflow referencing this template. */\n workflow: string;\n /** Node id (structural path), pinpointing the exact node on the canvas. */\n nodeId: string;\n /** Props passed at this site: each value is a literal or a user-property reference. */\n props: Record<string, unknown>;\n}\n\nexport interface TemplateRefInfo {\n key: string;\n channel: string;\n /** Every use site — one template can be used by several flows, each passing its own props. */\n usages: TemplateUsage[];\n}\n\nconst TEMPLATE_CHANNELS = new Set(['email', 'push', 'discord', 'slack']);\n\n/** Walk the IR node tree depth-first (branch arms, cohort arms and waitUntil timeout flows all included). */\nfunction walk(nodes: readonly NodeIR[], visit: (node: NodeIR) => void): void {\n for (const node of nodes) {\n visit(node);\n switch (node.type) {\n case 'branch':\n for (const branchCase of node.cases) walk(branchCase.flow, visit);\n if (node.otherwise) walk(node.otherwise, visit);\n break;\n case 'cohort':\n for (const arm of node.arms) walk(arm.flow, visit);\n break;\n case 'wait_until':\n if (Array.isArray(node.onTimeout)) walk(node.onTimeout, visit);\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * One entry per template — per channel and key, since one key can name an\n * email and a push, and their usages must not run together.\n */\nexport function collectTemplateRefs(irs: readonly WorkflowIR[]): TemplateRefInfo[] {\n const byKey = new Map<string, TemplateRefInfo>();\n for (const ir of irs) {\n walk(ir.flow, (node) => {\n // Only the template channels have registries; other channels' messages have nothing to preview\n if (node.type !== 'message' || !TEMPLATE_CHANNELS.has(node.channel)) return;\n const usage: TemplateUsage = { workflow: ir.id, nodeId: node.id, props: node.props };\n const id = `${node.channel}:${node.template}`;\n const found = byKey.get(id);\n if (found) {\n found.usages.push(usage);\n return;\n }\n byKey.set(id, {\n key: node.template,\n channel: node.channel,\n usages: [usage],\n });\n });\n }\n return Array.from(byKey.values()).sort(\n (a, b) => a.key.localeCompare(b.key) || a.channel.localeCompare(b.channel)\n );\n}\n\n/**\n * Every template the studio can show: each registered one — referenced or\n * not yet, so a template can be previewed before a flow uses it — plus each\n * one the IR references without registering it (shown as missing). The IR\n * only adds the use sites.\n */\nexport function collectTemplates(\n irs: readonly WorkflowIR[],\n registries: { emails?: object; pushes?: object; discords?: object; slacks?: object }\n): TemplateRefInfo[] {\n const byKey = new Map(collectTemplateRefs(irs).map((ref) => [`${ref.channel}:${ref.key}`, ref]));\n for (const [channel, registry] of [\n ['email', registries.emails],\n ['push', registries.pushes],\n ['discord', registries.discords],\n ['slack', registries.slacks],\n ] as const) {\n for (const key of Object.keys(registry ?? {})) {\n if (!byKey.has(`${channel}:${key}`))\n byKey.set(`${channel}:${key}`, { key, channel, usages: [] });\n }\n }\n return Array.from(byKey.values()).sort(\n (a, b) => a.key.localeCompare(b.key) || a.channel.localeCompare(b.channel)\n );\n}\n\n/** Find one node by its structural id, arms and timeout lanes included. */\nexport function findNode(ir: WorkflowIR, id: string): NodeIR | undefined {\n let found: NodeIR | undefined;\n walk(ir.flow, (node) => {\n if (node.id === id) found = node;\n });\n return found;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;;;;;;;ACOA,MAAa,eAAe,EAAE,aAAa,oBAAoB;;;ACQ/D,MAAMA,eAAmC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,gBAAgB;CACpB,MAAM,KACJ,2CACA,uEACA,oFACF;CACA,QAAQ,KACN,4CACA,gEACF;CACA,SAAS,KACP,6FACA,6EACF;CACA,WAAW,KACT,8EACA,8EACF;CACA,aAAa,KACX,4CACA,mCACA,8CACF;CACA,SAAS,KACP,uBACA,8DACA,8EACF;AACF;AAEA,SAAgB,OAAO,EACrB,UACA,WACA,OAAO,MACP,OACA,OAAO,UACP,UAAU,WACV,GAAG,SACK;CACR,OACE,oBAAC,UAAD;EAEQ;EACN,OAAO;GAAE,GAAG;GAAc,GAAG;EAAM;EACnC,WAAW,GACTA,aAAW,OACX,cAAc,UACd,2CACA,0EACA,oDACA,SACF;EACA,GAAI;EAEH;CACK,CAAA;AAEZ;;;;ACvCA,MAAa,YAAY;CAAE,GAAG;CAAK,GAAG;AAAG;;;;;;;AAOzC,MAAa,YAAY;CAAE,GAAG,UAAU;CAAG,GAAG;AAAG;;;;;;AAuBjD,MAAM,IAAI,UAAU;AACpB,MAAM,OAAO;AACb,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,OAAO;AAEb,SAA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,CAAC,CAAC,CAAC,MAC/B,GAAG,MAAM,EAAE,IAAI,cAAc,EAAE,GAAG,KAAK,EAAE,QAAQ,cAAc,EAAE,OAAO,CAC3E;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["SIZE_STYLE","PALETTE","iphoneFrameUrl","pixelBackUrl","pixelMaskUrl","SIZE_STYLE","WorkflowIcon","Fragment"],"sources":["../src/utils/cn.ts","../src/components/corner-shape.ts","../src/components/button/index.tsx","../src/components/layout.ts","../src/components/workflow-canvas.tsx","../src/utils/template-content.ts","../src/components/chat-markup.tsx","../src/components/discord-preview.tsx","../src/components/email-thumbnail.tsx","../src/app/assets/devices/iphone-17-pro.png","../src/app/assets/devices/pixel-10-pro-back.webp","../src/app/assets/devices/pixel-10-pro-mask.webp","../src/components/push-preview.tsx","../src/components/slack-preview.tsx","../src/components/textarea/index.tsx","../src/components/templates-page.tsx","../src/utils/label.ts","../src/components/sparkline.tsx","../src/components/workflow-list.tsx","../src/components/metric-card.tsx","../src/components/input/index.tsx","../src/components/date-range.tsx","../src/components/channel-icon.ts","../src/components/avatar.tsx","../src/components/template-refs.ts"],"sourcesContent":["import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { CSSProperties } from 'react';\n\n/**\n * Every rounded surface that is not a full pill carries this.\n *\n * A plain border-radius leaves a visible curvature break where the arc meets\n * the straight edge; a superellipse blends the two, which is what the canvas\n * cards already do. Pills (`rounded-full`) are continuous by construction, so\n * they skip it.\n *\n * Cast because `corner-shape` is not in React's CSSProperties yet.\n */\nexport const superellipse = { cornerShape: 'superellipse(1.2)' } as CSSProperties;\n","import { clsx } from 'clsx';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { superellipse } from '../corner-shape';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-primary`, `--color-accent`, `--color-gray-*`), so a project that\n * re-themes the ramp re-themes the buttons with it.\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'button'>, 'type'> {\n size?: Size;\n children?: ReactNode;\n type?: 'submit' | 'reset' | 'button';\n variant?: 'text' | 'accent' | 'default' | 'secondary' | 'destructive' | 'outline';\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'h-7 px-3 text-xs rounded-md focus-visible:ring-2',\n sm: 'h-9 px-3 text-sm rounded-lg focus-visible:ring-3',\n md: 'h-10 px-4 text-sm rounded-xl focus-visible:ring-3',\n lg: 'h-12 px-6 text-base rounded-xl focus-visible:ring-4',\n xl: 'h-14 px-8 text-lg rounded-2xl focus-visible:ring-4',\n};\n\nconst VARIANT_STYLE = {\n text: clsx(\n 'text-primary border-none bg-transparent',\n 'hover:bg-gray-100 focus-visible:ring-black/10 active:bg-gray-200/80',\n 'dark:hover:bg-gray-800 dark:focus-visible:ring-white/20 dark:active:bg-gray-700/80'\n ),\n accent: clsx(\n 'bg-accent active:bg-accent/80 text-white',\n 'focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50'\n ),\n default: clsx(\n 'border-none bg-black text-white focus-visible:ring-black/20 dark:bg-white dark:text-black',\n 'active:bg-black/80 dark:focus-visible:ring-white/30 dark:active:bg-white/80'\n ),\n secondary: clsx(\n 'text-primary bg-gray-100 focus-visible:ring-black/10 active:bg-gray-200/80',\n 'dark:bg-gray-800 dark:focus-visible:ring-white/20 dark:active:bg-gray-700/80'\n ),\n destructive: clsx(\n 'text-white focus-visible:ring-red-400/40',\n 'bg-red-400 active:bg-red-500/90',\n 'dark:bg-red-400/70 dark:active:bg-red-400/90'\n ),\n outline: clsx(\n 'text-primary border',\n 'bg-white focus-visible:ring-black/10 active:bg-gray-100/70',\n 'dark:bg-gray-900/70 dark:focus-visible:ring-white/30 dark:active:bg-gray-900'\n ),\n};\n\nexport function Button({\n children,\n className,\n size = 'md',\n style,\n type = 'button',\n variant = 'default',\n ...props\n}: Props) {\n return (\n <button\n // oxlint-disable-next-line react/button-has-type\n type={type}\n style={{ ...superellipse, ...style }}\n className={cn(\n SIZE_STYLE[size],\n VARIANT_STYLE[variant],\n 'inline-flex items-center justify-center',\n 'text-center font-medium transition-all duration-100 focus:outline-none',\n 'disabled:pointer-events-none disabled:opacity-50',\n className\n )}\n {...props}\n >\n {children}\n </button>\n );\n}\n","import type { ConditionIR, NodeIR, WorkflowIR } from '@shware/workflow';\nimport type { NodeStats } from '../config';\n\n/**\n * Tree layout: IR → react-flow nodes and edges.\n *\n * IR is a structured tree rather than an arbitrary graph, so dagre/elkjs are\n * unnecessary: a vertical spine, branch columns fanning out left and right,\n * and rejoin edges — customer.io's look, computed in a single recursion.\n * Layout is a pure function: the same IR (plus optional stats) always yields\n * the same picture.\n */\n\nexport type NodeCategory = 'trigger' | 'message' | 'delay' | 'control' | 'data' | 'exit';\n\nexport type NodeIcon =\n | 'trigger'\n | 'email'\n | 'sms'\n | 'push'\n | 'in_app'\n | 'slack'\n | 'discord'\n | 'survey'\n | 'delay'\n | 'time_window'\n | 'wait_until'\n | 'branch'\n | 'filter'\n | 'cohort'\n | 'exit'\n | 'send_event'\n | 'action';\n\nexport interface CanvasNodeData extends Record<string, unknown> {\n title: string;\n subtitle?: string;\n category: NodeCategory;\n /** card: the regular card (icon + title + subtitle + count badge); icon: icon-only pill (exit). */\n variant: 'card' | 'icon';\n icon: NodeIcon;\n /** How many users currently sit on this node (runtime stats, injected via `stats`). */\n count?: number;\n}\n\n/** Card sizes: the single source shared by layout and renderer, all on the 16/8 grid. */\nexport const CARD_SIZE = { w: 288, h: 64 } as const;\n/**\n * The icon variant renders as an auto-width pill, so only its height is known\n * here. It is laid out in a card-width box and centred inside it: guessing the\n * pill's width instead put its visual centre a couple of pixels off the column\n * the connectors are drawn down, which reads as a crooked line.\n */\nexport const ICON_SIZE = { w: CARD_SIZE.w, h: 32 } as const;\n\nexport interface CanvasNode {\n id: string;\n type: 'wf';\n position: { x: number; y: number };\n data: CanvasNodeData;\n}\n\nexport interface CanvasEdge {\n id: string;\n source: string;\n target: string;\n label?: string;\n /** Label anchor: `target` = the arm's entry corner (real arm); `source` = just below the deciding node (empty pass-through arm). */\n data?: { anchor: 'source' | 'target' };\n}\n\n/**\n * Tiered spacing: straight sequences stay tight, forks open up (room for the\n * rounded split, the hanging labels, and a future insert-action button), and\n * rejoins get slightly more than a sequence gap so merge lines have space.\n */\nconst W = CARD_SIZE.w;\nconst VGAP = 48; // node → node inside a sequence\nconst FORK_GAP = 112; // branching node's bottom → arm top (stem splits at 28, labels hang at 56)\nconst REJOIN_EXTRA = 24; // added on top of VGAP at a rejoin\nconst HGAP = 88;\n\nfunction nodeSize(n: NodeIR): { w: number; h: number } {\n return n.type === 'exit' ? ICON_SIZE : CARD_SIZE;\n}\n\n/** Common abstraction for nodes with child groups: branch cases/otherwise, cohort arms, waitUntil's timeout lane. */\ninterface Group {\n label: string;\n nodes: NodeIR[];\n}\n\n/** Property operator → label symbol (math signs for eq/ne/gt/lt; set and text operators keep short words). */\nconst OP_LABEL: Record<string, string> = {\n eq: '=',\n ne: '≠',\n gt: '>',\n lt: '<',\n between: 'between',\n in_array: 'in',\n not_in_array: 'not in',\n exists: 'exists',\n not_exists: 'not exists',\n contains: 'contains',\n not_contains: 'not contains',\n};\n\nfunction conditionLabel(c: ConditionIR, fallback: string): string {\n if (c.type === 'segment') return c.segment;\n if (c.type === 'not') return `not ${conditionLabel(c.condition, fallback)}`;\n if (c.type === 'property') {\n const op = OP_LABEL[c.op] ?? c.op;\n const value =\n c.op === 'between'\n ? `${c.values?.[0]} – ${c.values?.[1]}`\n : c.op === 'in_array' || c.op === 'not_in_array'\n ? `[${c.values?.join(', ')}]`\n : c.value !== undefined\n ? String(c.value)\n : '';\n return value === '' ? `${c.path} ${op}` : `${c.path} ${op} ${value}`;\n }\n if (c.type === 'performed') return `did ${c.event}`;\n if (c.type === 'reachable') return `reachable by ${c.channel}`;\n if (c.type === 'and' || c.type === 'or') {\n return c.conditions.map((child) => conditionLabel(child, fallback)).join(` ${c.type} `);\n }\n return fallback;\n}\n\nfunction groupsOf(n: NodeIR): Group[] | null {\n switch (n.type) {\n case 'branch': {\n const groups = n.cases.map((c, i) => ({\n label: c.label ?? conditionLabel(c.condition, `case ${i + 1}`),\n nodes: c.flow,\n }));\n groups.push({ label: 'else', nodes: n.otherwise ?? [] });\n return groups;\n }\n case 'cohort':\n return n.arms.map((a) => ({ label: `${a.name} · ${a.weight}%`, nodes: a.flow }));\n case 'wait_until':\n if (Array.isArray(n.onTimeout)) {\n return [\n { label: 'met', nodes: [] },\n { label: 'timeout', nodes: n.onTimeout },\n ];\n }\n return null;\n default:\n return null;\n }\n}\n\nfunction seqWidth(nodes: NodeIR[]): number {\n return nodes.length === 0 ? W : Math.max(...nodes.map(nodeWidth));\n}\n\nfunction nodeWidth(n: NodeIR): number {\n const groups = groupsOf(n);\n if (!groups) return nodeSize(n).w;\n return (\n groups.reduce((sum, g) => sum + Math.max(W, seqWidth(g.nodes)), 0) + HGAP * (groups.length - 1)\n );\n}\n\nconst CHANNEL_TITLE: Record<string, string> = {\n email: 'Email',\n sms: 'SMS',\n push: 'Push Notification',\n in_app: 'In-App Message',\n slack: 'Slack Message',\n discord: 'Discord Message',\n survey: 'Survey',\n};\n\nfunction nodeData(n: NodeIR): CanvasNodeData {\n switch (n.type) {\n case 'message':\n return {\n title: CHANNEL_TITLE[n.channel] ?? n.channel,\n subtitle: n.devices === 'latest' ? `${n.template} · latest device` : n.template,\n category: 'message',\n variant: 'card',\n icon: n.channel,\n };\n case 'delay':\n return {\n title: 'Time Delay',\n subtitle: `Wait ${n.duration.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'delay',\n };\n case 'random_delay':\n return {\n title: 'Randomized Delay',\n subtitle: `Wait ${n.min.value} – ${n.max.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'delay',\n };\n case 'time_window':\n return {\n title: 'Time Window',\n subtitle: `${n.days.join(' ')} ${n.between[0]}–${n.between[1]}`,\n category: 'delay',\n variant: 'card',\n icon: 'time_window',\n };\n case 'wait_until':\n return {\n title: `Wait until ${conditionLabel(n.condition, '…')}`,\n subtitle: `timeout ${n.timeout.value}`,\n category: 'delay',\n variant: 'card',\n icon: 'wait_until',\n };\n case 'branch': {\n const arms = n.cases.length + 1;\n return {\n title: n.label ?? (n.cases.length > 1 ? 'Multi-Split Branch' : 'True/False Branch'),\n subtitle: `${arms} arms, first match`,\n category: 'control',\n variant: 'card',\n icon: 'branch',\n };\n }\n case 'filter':\n return {\n title: 'Filter',\n subtitle: n.reason ?? 'only continue if…',\n category: 'control',\n variant: 'card',\n icon: 'filter',\n };\n case 'cohort':\n return {\n title: 'Random Cohort',\n subtitle: n.arms.map((a) => `${a.name} ${a.weight}%`).join(' / '),\n category: 'control',\n variant: 'card',\n icon: 'cohort',\n };\n case 'exit':\n return {\n title: 'Exit',\n // reason stays off the canvas and lives in the hover tooltip\n ...(n.reason !== undefined ? { subtitle: n.reason } : {}),\n category: 'exit',\n variant: 'icon',\n icon: 'exit',\n };\n case 'send_event':\n return {\n title: 'Send Event',\n subtitle: n.event,\n category: 'data',\n variant: 'card',\n icon: 'send_event',\n };\n case 'action':\n return {\n title: 'Custom Action',\n subtitle: n.action,\n category: 'data',\n variant: 'card',\n icon: 'action',\n };\n }\n}\n\ninterface Tail {\n id: string;\n label?: string;\n anchor?: 'source' | 'target';\n}\n\nexport function layout(\n ir: WorkflowIR,\n stats?: NodeStats\n): { nodes: CanvasNode[]; edges: CanvasEdge[] } {\n const nodes: CanvasNode[] = [];\n const edges: CanvasEdge[] = [];\n let edgeSeq = 0;\n\n const addNode = (id: string, x: number, y: number, data: CanvasNodeData): void => {\n const count = stats?.[id];\n nodes.push({\n id,\n type: 'wf',\n position: { x, y },\n data: count === undefined ? data : { ...data, count },\n });\n };\n\n const addEdges = (tails: Tail[], target: string): void => {\n for (const t of tails) {\n edges.push({\n id: `e${edgeSeq++}`,\n source: t.id,\n target,\n ...(t.label !== undefined ? { label: t.label } : {}),\n ...(t.anchor !== undefined ? { data: { anchor: t.anchor } } : {}),\n });\n }\n };\n\n /** Lay out one sequence recursively: `cx` is the centre line; returns the bottom y and the tails that continue downward. */\n function layoutSeq(\n seq: NodeIR[],\n cx: number,\n y: number,\n incoming: Tail[]\n ): {\n bottom: number;\n tails: Tail[];\n } {\n let curY = y;\n let tails = incoming;\n\n for (const n of seq) {\n const size = nodeSize(n);\n addNode(n.id, cx - size.w / 2, curY, nodeData(n));\n addEdges(tails, n.id);\n const bottom = curY + size.h;\n\n if (n.type === 'exit') {\n tails = []; // terminal: nothing connects downward\n curY = bottom + VGAP;\n continue;\n }\n\n const groups = groupsOf(n);\n if (!groups) {\n tails = [{ id: n.id }];\n curY = bottom + VGAP;\n continue;\n }\n\n const widths = groups.map((g) => Math.max(W, seqWidth(g.nodes)));\n const total = widths.reduce((a, b) => a + b, 0) + HGAP * (groups.length - 1);\n let gx = cx - total / 2;\n const groupTop = bottom + FORK_GAP;\n let maxBottom = groupTop;\n const groupTails: Tail[] = [];\n\n groups.forEach((g, gi) => {\n const center = gx + (widths[gi] ?? W) / 2;\n if (g.nodes.length === 0) {\n // Empty group: the parent rejoins straight down, so anchor the label right below it\n groupTails.push({ id: n.id, label: g.label, anchor: 'source' });\n } else {\n const r = layoutSeq(g.nodes, center, groupTop, [\n { id: n.id, label: g.label, anchor: 'target' },\n ]);\n groupTails.push(...r.tails);\n maxBottom = Math.max(maxBottom, r.bottom);\n }\n gx += (widths[gi] ?? W) + HGAP;\n });\n\n tails = groupTails;\n curY = maxBottom + REJOIN_EXTRA;\n }\n\n return { bottom: curY, tails };\n }\n\n // Trigger node\n const t = ir.trigger;\n const triggerSubtitle =\n t.type === 'event'\n ? `${t.event}${t.filter ? ' · +filter' : ''}`\n : t.type === 'segment'\n ? `enters ${t.segment}`\n : t.type === 'date'\n ? t.at\n : 'webhook';\n addNode('__trigger', -CARD_SIZE.w / 2, 0, {\n title: 'Trigger',\n subtitle: triggerSubtitle,\n category: 'trigger',\n variant: 'card',\n icon: 'trigger',\n });\n\n const { bottom, tails } = layoutSeq(ir.flow, 0, CARD_SIZE.h + VGAP, [{ id: '__trigger' }]);\n\n // Closing Exit node (customer.io's explicit terminus); unnecessary when every path exits early\n if (tails.length > 0) {\n addNode('__end', -ICON_SIZE.w / 2, bottom, {\n title: 'Exit',\n category: 'exit',\n variant: 'icon',\n icon: 'exit',\n });\n addEdges(tails, '__end');\n }\n\n return { nodes, edges };\n}\n","import type { WorkflowIR } from '@shware/workflow';\nimport {\n Background,\n BaseEdge,\n Controls,\n type Edge,\n EdgeLabelRenderer,\n type EdgeProps,\n Handle,\n type Node,\n type NodeProps,\n Position,\n ReactFlow,\n} from '@xyflow/react';\nimport {\n AlarmClock,\n AppWindow,\n BellRing,\n CalendarClock,\n ClipboardList,\n Filter,\n GitBranch,\n Hourglass,\n LogOut,\n type LucideIcon,\n Mail,\n MessageCircle,\n MessageSquareText,\n MessagesSquare,\n Send,\n Shuffle,\n SquareFunction,\n User,\n Zap,\n} from 'lucide-react';\nimport { type CSSProperties, createContext, useContext, useMemo } from 'react';\nimport type { NodeStats } from '../config';\nimport { superellipse } from './corner-shape';\nimport {\n CARD_SIZE,\n type CanvasEdge,\n type CanvasNode,\n type CanvasNodeData,\n ICON_SIZE,\n type NodeCategory,\n type NodeIcon,\n layout,\n} from './layout';\n\n/**\n * Read-only workflow canvas: renders IR. Structure is code-owned, so the UI\n * offers no editing.\n *\n * Rendering principle — HTML-first and pixel-exact: node cards and edge labels\n * are always HTML (fonts and line heights on tailwind's scale, and new CSS such\n * as corner-shape is available). SVG is kept only for what react-flow's\n * architecture requires — the connector paths and their endpoint markers — with\n * every parameter passed explicitly. SVG EdgeText is not used: its size follows\n * the font's bounding box and cannot be pinned to exact pixels.\n */\nexport interface WorkflowCanvasProps {\n ir: WorkflowIR;\n /** Node id → users currently waiting there (from the engine's stats API); no badge without it. */\n stats?: NodeStats;\n /**\n * Drives react-flow's own chrome (background dots, zoom controls). The card\n * and connector colours come from CSS variables and follow the host's theme\n * on their own; this is only for the parts react-flow paints itself. Passed\n * in rather than sniffed from the DOM, so an embedding app stays in control.\n */\n colorMode?: 'light' | 'dark';\n /** Node id to show as selected; pairs with onSelectNode for an inspector panel. */\n selectedId?: string | undefined;\n /** Node clicked, or undefined when the click landed on empty canvas. */\n onSelectNode?: (id: string | undefined) => void;\n}\n\n/** The callback travels by context: react-flow node data should carry serializable data only. */\n/** Same reason: selection is view state, not node data, so it must not enter the layout. */\nconst SelectedContext = createContext<string | undefined>(undefined);\n\n/**\n * One hue per category, not per icon: six colours make a message, a wait and a\n * branch tell themselves apart at a glance; fifteen would just be noise. Values\n * live in CSS so they shift with the theme.\n */\nconst CATEGORY_COLOR: Record<NodeCategory, string> = {\n trigger: 'var(--color-icon-trigger)',\n message: 'var(--color-icon-message)',\n delay: 'var(--color-icon-delay)',\n control: 'var(--color-icon-control)',\n data: 'var(--color-icon-data)',\n exit: 'var(--color-icon-exit)',\n};\n\nconst ICONS: Record<NodeIcon, LucideIcon> = {\n trigger: Zap,\n email: Mail,\n sms: MessageSquareText,\n push: BellRing,\n /*\n * in_app moved off the speech bubble when discord arrived: the channel\n * pickers already spend it on discord (see channel-icon.ts), and two\n * identical glyphs on one canvas stop working as an index. A window is the\n * truer mark for an in-product surface anyway.\n */\n in_app: AppWindow,\n slack: MessagesSquare,\n discord: MessageCircle,\n survey: ClipboardList,\n delay: AlarmClock,\n time_window: CalendarClock,\n wait_until: Hourglass,\n branch: GitBranch,\n filter: Filter,\n cohort: Shuffle,\n exit: LogOut,\n send_event: Send,\n action: SquareFunction,\n};\n\n/**\n * A 1px border and nothing else — no drop shadow. It takes --color-edge rather\n * than --color-border, so a card's outline and the connectors between cards are\n * the same weight: on a canvas the wiring is as much a first-class line as the\n * boxes, and one darker step is what replaces the lift the shadow used to give.\n * boxSizing is border-box, so the border sits inside CARD_SIZE and the layout\n * stays on its 8px steps.\n */\nconst baseCard: CSSProperties = {\n boxSizing: 'border-box',\n background: 'var(--color-card)',\n // Longhand, not the `border` shorthand: selection overrides borderColor alone,\n // and React warns when a rerender mixes a shorthand with its longhand.\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: 'var(--color-edge)',\n fontFamily: \"'Inter Variable', Inter, ui-sans-serif, system-ui, sans-serif\",\n overflow: 'hidden',\n ...superellipse,\n};\n\n/** Flex column, centred: top and bottom whitespace stay equal without hand-balancing padding against line height. */\nconst cardStyle: CSSProperties = {\n ...baseCard,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n width: CARD_SIZE.w,\n height: CARD_SIZE.h,\n padding: '0 16px',\n borderRadius: 12,\n};\n\n/**\n * The pill sits in a card-width box and centres itself in it. react-flow anchors\n * handles at the measured box's midpoint, so letting the auto-width pill *be*\n * the box put its centre wherever the label happened to end — a couple of\n * pixels off the column the connectors run down.\n */\nconst iconWrapStyle: CSSProperties = {\n display: 'flex',\n justifyContent: 'center',\n width: ICON_SIZE.w,\n height: ICON_SIZE.h,\n};\n\nconst iconStyle: CSSProperties = {\n ...baseCard,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 6,\n // Width follows content; 12 on the icon side, 16 on the text side — optical balance for icon+label\n width: 'fit-content',\n height: ICON_SIZE.h,\n padding: '0 16px 0 12px',\n // Stadium pill: radius = half the height, with round corners restored (superellipse would flatten the ends)\n borderRadius: 16,\n ...({ cornerShape: 'round' } as CSSProperties),\n fontSize: 12,\n lineHeight: '16px',\n fontWeight: 600,\n color: 'var(--color-secondary)',\n};\n\nconst headerStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n};\n\nconst titleStyle: CSSProperties = {\n flex: 1,\n minWidth: 0,\n fontSize: 14,\n lineHeight: '20px',\n fontWeight: 600,\n color: 'var(--color-primary)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nconst countStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 4,\n fontSize: 14,\n lineHeight: '20px',\n fontWeight: 600,\n color: 'var(--color-primary)',\n};\n\nconst subtitleStyle: CSSProperties = {\n marginTop: 4,\n fontSize: 12,\n lineHeight: '16px',\n color: 'var(--color-muted)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nconst handleStyle: CSSProperties = { opacity: 0, width: 1, height: 1, minWidth: 0, minHeight: 0 };\n\n/** Open-template button: a borderless icon button in the card's top-right corner. */\ntype WfNode = Node<CanvasNodeData, 'wf'>;\n\nfunction WorkflowNode({ id, data }: NodeProps<WfNode>) {\n const Icon = ICONS[data.icon];\n /*\n * Selection reads as a focused form control: the card's own border takes the\n * accent and a translucent halo sits outside it. A solid ring on top of the\n * existing border instead looked like two borders stacked.\n */\n const selected =\n useContext(SelectedContext) === id\n ? {\n borderColor: 'var(--color-accent)',\n boxShadow: '0 0 0 3px var(--color-accent-ring)',\n }\n : undefined;\n\n const body =\n data.variant === 'icon' ? (\n // Small pill (exit): icon plus a short label, with reason in the tooltip\n <div style={iconWrapStyle}>\n <div\n style={{ ...iconStyle, ...selected }}\n title={data.subtitle ? `${data.title} · ${data.subtitle}` : data.title}\n >\n <Icon size={16} color={CATEGORY_COLOR[data.category]} strokeWidth={2} aria-hidden />\n {data.title}\n </div>\n </div>\n ) : (\n <div style={{ ...cardStyle, ...selected }}>\n <div style={headerStyle}>\n <Icon size={16} color={CATEGORY_COLOR[data.category]} strokeWidth={2} aria-hidden />\n <span style={titleStyle}>{data.title}</span>\n {data.count !== undefined && (\n <span style={countStyle}>\n <User size={16} color=\"var(--color-muted)\" strokeWidth={2} aria-hidden />\n {data.count}\n </span>\n )}\n </div>\n {data.subtitle !== undefined && <div style={subtitleStyle}>{data.subtitle}</div>}\n </div>\n );\n\n return (\n <>\n <Handle type=\"target\" position={Position.Top} style={handleStyle} isConnectable={false} />\n {body}\n <Handle type=\"source\" position={Position.Bottom} style={handleStyle} isConnectable={false} />\n </>\n );\n}\n\nconst nodeTypes = { wf: WorkflowNode };\n\n/**\n * Edge label pill: 32px tall (8-grid), fully rounded, typography on tailwind's\n * text-xs (12px / 16px). Border on --color-edge like every other outline on the\n * canvas — cards, the exit pill and the connectors all draw at one weight.\n */\nconst edgeLabelStyle: CSSProperties = {\n position: 'absolute',\n display: 'flex',\n alignItems: 'center',\n height: 32,\n padding: '0 12px',\n borderRadius: 16,\n background: 'var(--color-card)',\n border: '1px solid var(--color-edge)',\n fontFamily: \"'Inter Variable', Inter, ui-sans-serif, system-ui, sans-serif\",\n fontSize: 12,\n lineHeight: '16px',\n fontWeight: 500,\n color: 'var(--color-secondary)',\n pointerEvents: 'none',\n};\n\ntype WfEdge = Edge<{ anchor?: 'source' | 'target' }, 'wf'>;\n\n/* ----------------------------- Connector routing ---------------------------- */\n\n/** One bend radius for every corner. */\nconst BEND = 16;\n/** How far a labelled fork runs straight down before it turns. */\nconst FORK_STEM = 28;\n/** Where a label pill hangs below the deciding node. */\nconst LABEL_DROP = 56;\nconst DOT_R = 3.5;\n/**\n * react-flow anchors its 1px handles just outside the node box, so both ends of\n * a connector stop one pixel short of the card: the line leaves the bottom edge\n * with a visible hairline under it, and the endpoint dot floats above the top\n * edge. Growing the path by this much at each end — and placing the dot's\n * bottom at the same point — closes both seams.\n */\nconst HANDLE_INSET = 1;\n\n/** Endpoint dot, sized off DOT_R so the SVG geometry and the HTML marker agree. */\nconst dotStyle: CSSProperties = {\n position: 'absolute',\n boxSizing: 'border-box',\n width: DOT_R * 2,\n height: DOT_R * 2,\n borderRadius: '50%',\n background: 'var(--color-card)',\n border: '1px solid var(--color-edge)',\n pointerEvents: 'none',\n};\n/**\n * Corner control-point factor. A circular arc's classic value is 0.552; pulling\n * it out to 0.9 squares the shoulder off, approximating the look of\n * corner-shape: superellipse. (CSS corner-shape does not apply to SVG paths, so\n * the shape is built by hand from cubic béziers.)\n */\nconst SQUIRCLE = 0.9;\n\n/** A superellipse shoulder bending from (x1,y1) through the corner (cx,cy) to (x2,y2). */\nfunction corner(x1: number, y1: number, cx: number, cy: number, x2: number, y2: number): string {\n const c1x = x1 + (cx - x1) * SQUIRCLE;\n const c1y = y1 + (cy - y1) * SQUIRCLE;\n const c2x = x2 + (cx - x2) * SQUIRCLE;\n const c2y = y2 + (cy - y2) * SQUIRCLE;\n return `C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`;\n}\n\n/** Three-segment orthogonal route (down, across, down); `splitY` is where the horizontal run sits. */\nfunction orthogonalPath(sx: number, sy: number, tx: number, ty: number, splitY: number): string {\n const dx = tx - sx;\n if (Math.abs(dx) < 1) return `M ${sx} ${sy} L ${tx} ${ty}`;\n const dir = Math.sign(dx);\n const r = Math.max(0, Math.min(BEND, Math.abs(dx) / 2, splitY - sy, ty - splitY));\n return [\n `M ${sx} ${sy}`,\n `L ${sx} ${splitY - r}`,\n corner(sx, splitY - r, sx, splitY, sx + dir * r, splitY),\n `L ${tx - dir * r} ${splitY}`,\n corner(tx - dir * r, splitY, tx, splitY, tx, splitY + r),\n `L ${tx} ${ty}`,\n ].join(' ');\n}\n\n/**\n * Custom edge with an HTML label: SVG EdgeText's height floats with the font's\n * bounding box, and only HTML can be pinned to exact pixels.\n *\n * Labels anchor one of two ways — never at the path midpoint, since a short\n * horizontal run would disappear entirely behind the pill:\n * - target: above the arm's entry corner (a real arm; customer.io's position)\n * - source: right below the deciding node (empty pass-through arm, which also\n * keeps several merge-edge labels from colliding at the far end)\n */\nfunction WorkflowEdge({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n label,\n style,\n data,\n}: EdgeProps<WfEdge>) {\n /*\n * Both label anchors have to end up sitting ON their own line. A target\n * anchor already does — the pill hangs in the target's column, which the path\n * descends through. A source anchor hangs directly under the deciding node,\n * where the path has already turned away at FORK_STEM, leaving the pill\n * stranded in open space; so for those the stem runs all the way down to the\n * pill and turns behind it.\n */\n const anchoredAtSource = data?.anchor === 'source';\n const splitY = label\n ? sourceY + (anchoredAtSource ? LABEL_DROP : FORK_STEM)\n : (sourceY + targetY) / 2;\n const path = orthogonalPath(\n sourceX,\n sourceY - HANDLE_INSET,\n targetX,\n targetY + HANDLE_INSET,\n splitY\n );\n // The label hangs below the split line, pinned to its own arm's column\n const labelPos = { x: anchoredAtSource ? sourceX : targetX, y: sourceY + LABEL_DROP };\n return (\n <>\n <BaseEdge id={id} path={path} style={style} />\n <EdgeLabelRenderer>\n {/*\n Connection point: a hollow dot instead of an arrowhead. Drawn as HTML\n rather than SVG because SVG paints in document order — a long\n pass-through connector running down the same column is a later sibling\n and would draw straight through a dot belonging to an earlier edge.\n The HTML layer sits above every path, so no line can cross it.\n */}\n <div\n style={{\n ...dotStyle,\n transform: `translate(-50%, -50%) translate(${targetX}px, ${targetY + HANDLE_INSET - DOT_R}px)`,\n }}\n />\n {!!label && (\n <div\n style={{\n ...edgeLabelStyle,\n transform: `translate(-50%, -50%) translate(${labelPos.x}px, ${labelPos.y}px)`,\n }}\n >\n {label}\n </div>\n )}\n </EdgeLabelRenderer>\n </>\n );\n}\n\nconst edgeTypes = { wf: WorkflowEdge };\n\nexport function WorkflowCanvas({\n ir,\n stats,\n colorMode = 'light',\n selectedId,\n onSelectNode,\n}: WorkflowCanvasProps) {\n const { nodes, edges } = useMemo(() => layout(ir, stats), [ir, stats]);\n return (\n <SelectedContext value={selectedId}>\n <CanvasSurface\n nodes={nodes}\n edges={edges}\n colorMode={colorMode}\n {...(onSelectNode !== undefined ? { onSelectNode } : {})}\n />\n </SelectedContext>\n );\n}\n\nfunction CanvasSurface({\n nodes,\n edges,\n colorMode,\n onSelectNode,\n}: {\n nodes: CanvasNode[];\n edges: CanvasEdge[];\n colorMode: 'light' | 'dark';\n onSelectNode?: (id: string | undefined) => void;\n}) {\n return (\n <div style={{ width: '100%', height: '100%' }}>\n <ReactFlow\n nodes={nodes}\n edges={edges}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n colorMode={colorMode}\n onNodeClick={(_event, node) => onSelectNode?.(node.id)}\n onPaneClick={() => onSelectNode?.(undefined)}\n // Overrides react-flow's own dark surface, which sits between our page and card\n style={{ background: 'var(--color-canvas)' }}\n fitView\n minZoom={0.2}\n nodesDraggable={false}\n nodesConnectable={false}\n elementsSelectable={false}\n defaultEdgeOptions={{\n type: 'wf',\n style: { stroke: 'var(--color-edge)' },\n }}\n >\n <Background gap={16} color=\"var(--color-grid)\" />\n <Controls showInteractive={false} />\n </ReactFlow>\n </div>\n );\n}\n","import {\n type DiscordContent,\n type DiscordTemplate,\n type EmailTemplate,\n type PushContent,\n type PushTemplate,\n type SlackContent,\n type SlackTemplate,\n type TemplateIssue,\n TemplateValidationError,\n parseTemplateProps,\n renderDiscordContent,\n renderPushContent,\n renderSlackContent,\n} from '@shware/workflow';\nimport type { ComponentType } from 'react';\nimport type { ResolvedStudioConfig } from '../config';\nimport { lookup } from './lookup';\n\n/**\n * What the studio reads out of a template definition.\n *\n * Every registry entry is an `emailTemplate({...})` / `pushTemplate({...})`\n * (the dev server refuses anything else). Previews are validated with the\n * SDK's own functions (parseTemplateProps, renderPushContent), the same ones\n * the senders run, so the studio cannot accept props a send would refuse;\n * everything downstream reads the parsed value.\n */\n\nexport type Props = Record<string, unknown>;\n\n/**\n * A failed render: which phase refused, and every field path with its message.\n * `json` is the studio's own: the props editor holds text that is not a JSON\n * object, so nothing was validated at all.\n */\nexport interface TemplateFailure {\n phase: 'json' | 'props' | 'content' | 'render';\n issues: TemplateIssue[];\n}\n\n/** The channels with a template registry; every other channel's messages have no preview. */\nexport type TemplateChannel = 'email' | 'push' | 'discord' | 'slack';\n\nexport function isTemplateChannel(channel: string): channel is TemplateChannel {\n return channel === 'email' || channel === 'push' || channel === 'discord' || channel === 'slack';\n}\n\n/** One registry entry, read from the registry its channel owns — a push key never resolves to an email. */\nexport type TemplateEntry =\n | { channel: 'email'; entry: EmailTemplate }\n | { channel: 'push'; entry: PushTemplate }\n | { channel: 'discord'; entry: DiscordTemplate }\n | { channel: 'slack'; entry: SlackTemplate };\n\nexport function lookupTemplate(\n config: Partial<Pick<ResolvedStudioConfig, 'emails' | 'pushes' | 'discords' | 'slacks'>>,\n channel: string,\n key: string\n): TemplateEntry | undefined {\n const found = <T>(registry: Record<string, T> | undefined) =>\n registry === undefined ? undefined : lookup(registry, key);\n switch (channel) {\n case 'email': {\n const entry = found(config.emails);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'push': {\n const entry = found(config.pushes);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'discord': {\n const entry = found(config.discords);\n return entry === undefined ? undefined : { channel, entry };\n }\n case 'slack': {\n const entry = found(config.slacks);\n return entry === undefined ? undefined : { channel, entry };\n }\n default:\n return undefined;\n }\n}\n\n/** The sample props the studio renders with: the template's `preview`. */\nexport function previewPropsOf(entry: TemplateEntry['entry']): Props {\n return { ...entry.preview };\n}\n\n/** One line per issue, `path message`, for surfaces too small for a list. */\nexport function formatIssues(failure: TemplateFailure): string {\n return failure.issues\n .map((issue) => (issue.path === '' ? issue.message : `${issue.path}: ${issue.message}`))\n .join('\\n');\n}\n\nfunction failureOf(error: unknown, phase: TemplateFailure['phase']): TemplateFailure {\n if (error instanceof TemplateValidationError) return { phase: error.phase, issues: error.issues };\n return {\n phase,\n issues: [{ path: '', message: error instanceof Error ? error.message : String(error) }],\n };\n}\n\n/* ---------------------------------- Email ---------------------------------- */\n\n/** What the renderer needs: a component and the parsed props to give it, plus the subject. */\nexport interface PreparedEmail {\n component: ComponentType<Props>;\n props: Props;\n subject: string;\n}\n\nexport type EmailPreparation =\n | { ok: true; email: PreparedEmail }\n | { ok: false; failure: TemplateFailure };\n\n/**\n * Parse the props a preview renders with against the template's schema, and\n * hand the component the parsed value — or refuse, with the field paths, and\n * render nothing.\n */\nexport function prepareEmail(entry: EmailTemplate, key: string, props?: Props): EmailPreparation {\n try {\n const parsed = parseTemplateProps(entry, key, props ?? previewPropsOf(entry));\n return {\n ok: true,\n email: {\n component: entry.component as ComponentType<Props>,\n props: parsed,\n subject: entry.subject,\n },\n };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'props') };\n }\n}\n\n/** A render that threw (the component itself failed), as a failure the page can show. */\nexport function renderFailure(error: unknown): TemplateFailure {\n return failureOf(error, 'render');\n}\n\n/* ----------------------------------- Push ---------------------------------- */\n\nexport type PushResolution =\n | { ok: true; push: PushContent }\n | { ok: false; failure: TemplateFailure };\n\n/**\n * The notification a push template produces for some props: its `content`\n * over the parsed props, through the SDK (output checked, nothing\n * placeholder-filled afterwards).\n */\nexport function resolvePush(entry: PushTemplate, key: string, props?: Props): PushResolution {\n try {\n return { ok: true, push: renderPushContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/* -------------------------------- Webhooks --------------------------------- */\n\nexport type DiscordResolution =\n | { ok: true; message: DiscordContent }\n | { ok: false; failure: TemplateFailure };\n\nexport type SlackResolution =\n | { ok: true; message: SlackContent }\n | { ok: false; failure: TemplateFailure };\n\n/** The Discord message a template posts for some props, checked like a send checks it. */\nexport function resolveDiscord(\n entry: DiscordTemplate,\n key: string,\n props?: Props\n): DiscordResolution {\n try {\n return { ok: true, message: renderDiscordContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/** The Slack message a template posts for some props, checked like a send checks it. */\nexport function resolveSlack(entry: SlackTemplate, key: string, props?: Props): SlackResolution {\n try {\n return { ok: true, message: renderSlackContent(entry, key, props ?? previewPropsOf(entry)) };\n } catch (error) {\n return { ok: false, failure: failureOf(error, 'content') };\n }\n}\n\n/* -------------------------------- Identity --------------------------------- */\n\nconst identities = new WeakMap<object, number>();\nlet nextIdentity = 0;\n\n/**\n * A number per entry object, for query keys. HMR re-imports a template module\n * as a new object, so a changed component, content or schema gets a new key —\n * and a fresh render, never the cached one from before the edit.\n */\nexport function entryIdentity(entry: object | undefined): number | undefined {\n if (entry === undefined) return undefined;\n let id = identities.get(entry);\n if (id === undefined) {\n id = nextIdentity++;\n identities.set(entry, id);\n }\n return id;\n}\n","import type { ReactNode } from 'react';\n\n/**\n * The inline formatting chat clients render, drawn as React nodes (never HTML strings): Discord's\n * markdown (`**bold**`, `*italic*`, `__underline__`, `~~strike~~`, `` `code` ``, `[text](url)`)\n * and Slack's mrkdwn (`*bold*`, `_italic_`, `~strike~`, `` `code` ``, `<url|text>`). Enough to\n * preview a message faithfully, not a full parser: nesting is one level deep. Underscore (and\n * Slack's `*` / `~`) markers only open and close at word boundaries, so `snake_case_name` stays text.\n */\nexport type Dialect = 'discord' | 'slack';\n\ninterface Rule {\n pattern: RegExp;\n render: (match: RegExpExecArray, key: string, linkClass: string) => ReactNode;\n}\n\nconst code = (text: string, key: string) => (\n <code\n key={key}\n className=\"rounded bg-black/10 px-1 py-px font-mono text-[0.85em] dark:bg-white/10\"\n >\n {text}\n </code>\n);\n\nconst link = (href: string, text: string, key: string, className: string) => (\n <a key={key} href={href} target=\"_blank\" rel=\"noreferrer\" className={className}>\n {text}\n </a>\n);\n\nconst RULES: Record<Dialect, Rule[]> = {\n discord: [\n { pattern: /`([^`]+)`/, render: (m, key) => code(m[1] ?? '', key) },\n {\n pattern: /\\[([^\\]]+)\\]\\((https?:\\/\\/[^)\\s]+)\\)/,\n render: (m, key, linkClass) => link(m[2] ?? '', m[1] ?? '', key, linkClass),\n },\n { pattern: /\\*\\*([^*]+)\\*\\*/, render: (m, key) => <strong key={key}>{m[1]}</strong> },\n { pattern: /(?<!\\w)__([^_]+)__(?!\\w)/, render: (m, key) => <u key={key}>{m[1]}</u> },\n { pattern: /~~([^~]+)~~/, render: (m, key) => <s key={key}>{m[1]}</s> },\n {\n pattern: /\\*([^*]+)\\*|(?<!\\w)_([^_]+)_(?!\\w)/,\n render: (m, key) => <em key={key}>{m[1] ?? m[2]}</em>,\n },\n {\n pattern: /(https?:\\/\\/[^\\s<]+)/,\n render: (m, key, linkClass) => link(m[1] ?? '', m[1] ?? '', key, linkClass),\n },\n ],\n slack: [\n { pattern: /`([^`]+)`/, render: (m, key) => code(m[1] ?? '', key) },\n {\n pattern: /<((?:https?:\\/\\/|mailto:|tel:)[^|>]+)(?:\\|([^>]+))?>/,\n render: (m, key, linkClass) => link(m[1] ?? '', m[2] ?? m[1] ?? '', key, linkClass),\n },\n { pattern: /(?<!\\w)\\*([^*]+)\\*(?!\\w)/, render: (m, key) => <strong key={key}>{m[1]}</strong> },\n { pattern: /(?<!\\w)_([^_]+)_(?!\\w)/, render: (m, key) => <em key={key}>{m[1]}</em> },\n { pattern: /(?<!\\w)~([^~]+)~(?!\\w)/, render: (m, key) => <s key={key}>{m[1]}</s> },\n ],\n};\n\nfunction inline(text: string, dialect: Dialect, linkClass: string, prefix: string): ReactNode[] {\n const out: ReactNode[] = [];\n let rest = text;\n let index = 0;\n while (rest !== '') {\n // The earliest match of any rule wins; ties go to the rule listed first\n let best: { match: RegExpExecArray; rule: Rule } | undefined;\n for (const rule of RULES[dialect]) {\n const match = rule.pattern.exec(rest);\n if (match !== null && (best === undefined || match.index < best.match.index)) {\n best = { match, rule };\n }\n }\n if (best === undefined) {\n out.push(rest);\n break;\n }\n if (best.match.index > 0) out.push(rest.slice(0, best.match.index));\n out.push(best.rule.render(best.match, `${prefix}${index++}`, linkClass));\n rest = rest.slice(best.match.index + best.match[0].length);\n }\n return out;\n}\n\n/** Lines kept as lines; each formatted inline. */\nexport function ChatMarkup({\n text,\n dialect,\n linkClass,\n}: {\n text: string;\n dialect: Dialect;\n linkClass: string;\n}) {\n const lines = text.split('\\n');\n return (\n <>\n {lines.map((line, i) => (\n // oxlint-disable-next-line react/no-array-index-key -- lines have no identity but their place\n <span key={i}>\n {inline(line, dialect, linkClass, `${i}-`)}\n {i < lines.length - 1 && <br />}\n </span>\n ))}\n </>\n );\n}\n","import type { DiscordContent } from '@shware/workflow';\nimport { useTranslation } from 'react-i18next';\nimport { ChatMarkup } from './chat-markup';\nimport { superellipse } from './corner-shape';\n\n/**\n * A webhook message as Discord draws it in a channel: the webhook's name and avatar with the APP\n * tag, the content, and every embed (accent bar, author, title, description, fields, image,\n * thumbnail, footer). Discord's own palette for each theme; close enough to judge the message,\n * not a pixel copy.\n */\nexport interface DiscordPreviewProps {\n message: DiscordContent;\n /** The name a webhook posts under when the message names none: the project title upstream. */\n appName: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\nconst PALETTE = {\n dark: { bg: '#313338', text: '#dbdee1', muted: '#949ba4', name: '#f2f3f5', embed: '#2b2d31' },\n light: { bg: '#ffffff', text: '#313338', muted: '#5c5e66', name: '#060607', embed: '#f2f3f5' },\n};\n\nconst hex = (color: number | null | undefined) =>\n color === undefined || color === null ? '#1e1f22' : `#${color.toString(16).padStart(6, '0')}`;\n\nexport function DiscordPreview({ message, appName, scheme, zoom }: DiscordPreviewProps) {\n const { t } = useTranslation();\n const colors = PALETTE[scheme];\n const name = message.username ?? appName;\n const linkClass = 'text-[#00a8fc] hover:underline';\n return (\n <div\n className=\"mx-auto w-full max-w-2xl overflow-hidden rounded-2xl shadow-sm\"\n style={{\n ...superellipse,\n background: colors.bg,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n >\n <div className=\"flex gap-4 px-4 py-4\" style={{ color: colors.text }}>\n {message.avatar_url ? (\n <img\n src={message.avatar_url}\n alt=\"\"\n className=\"size-10 shrink-0 rounded-full object-cover\"\n />\n ) : (\n <div className=\"flex size-10 shrink-0 items-center justify-center rounded-full bg-[#5865f2] text-sm font-semibold text-white\">\n {name.slice(0, 1).toUpperCase()}\n </div>\n )}\n <div className=\"min-w-0 flex-1 text-[15px] leading-[1.375]\">\n <div className=\"flex items-center gap-1.5\">\n <span className=\"font-medium\" style={{ color: colors.name }}>\n {name}\n </span>\n <span className=\"rounded-[3px] bg-[#5865f2] px-1 text-[10px] leading-4 font-semibold text-white\">\n APP\n </span>\n <span className=\"text-xs\" style={{ color: colors.muted }}>\n {t('emails.chatNow')}\n </span>\n </div>\n {message.content !== undefined && message.content !== '' && (\n <div className=\"break-words whitespace-pre-wrap\">\n <ChatMarkup text={message.content} dialect=\"discord\" linkClass={linkClass} />\n </div>\n )}\n {(message.embeds ?? []).map((embed, index) => (\n <div\n // oxlint-disable-next-line react/no-array-index-key -- embeds are positional\n key={index}\n className=\"mt-1.5 grid max-w-[516px] grid-cols-[1fr_auto] gap-x-4 rounded-[4px] border-l-4 py-2 pr-4 pl-3\"\n style={{ borderLeftColor: hex(embed.color), background: colors.embed }}\n >\n <div className=\"min-w-0\">\n {embed.author !== undefined && (\n <div\n className=\"mt-1 flex items-center gap-2 text-sm font-semibold\"\n style={{ color: colors.name }}\n >\n {embed.author.icon_url !== undefined && (\n <img src={embed.author.icon_url} alt=\"\" className=\"size-6 rounded-full\" />\n )}\n {embed.author.name}\n </div>\n )}\n {embed.title !== undefined && (\n <div\n className=\"mt-1 font-semibold\"\n style={{ color: embed.url ? undefined : colors.name }}\n >\n {embed.url ? (\n <a href={embed.url} target=\"_blank\" rel=\"noreferrer\" className={linkClass}>\n {embed.title}\n </a>\n ) : (\n embed.title\n )}\n </div>\n )}\n {embed.description !== undefined && (\n <div className=\"mt-1 text-sm break-words whitespace-pre-wrap\">\n <ChatMarkup text={embed.description} dialect=\"discord\" linkClass={linkClass} />\n </div>\n )}\n {(embed.fields ?? []).length > 0 && (\n <div className=\"mt-2 grid grid-cols-3 gap-2\">\n {(embed.fields ?? []).map((field, i) => (\n <div\n // oxlint-disable-next-line react/no-array-index-key -- fields are positional\n key={i}\n className={field.inline ? 'col-span-1' : 'col-span-3'}\n >\n <div className=\"text-sm font-semibold\" style={{ color: colors.name }}>\n {field.name}\n </div>\n <div className=\"text-sm whitespace-pre-wrap\">\n <ChatMarkup text={field.value} dialect=\"discord\" linkClass={linkClass} />\n </div>\n </div>\n ))}\n </div>\n )}\n {embed.image?.url !== undefined && (\n <img\n src={embed.image.url}\n alt=\"\"\n className=\"mt-4 max-h-[300px] rounded-[4px] object-contain\"\n />\n )}\n {(embed.footer !== undefined || embed.timestamp !== undefined) && (\n <div\n className=\"mt-2 flex items-center gap-2 text-xs\"\n style={{ color: colors.muted }}\n >\n {embed.footer?.icon_url !== undefined && (\n <img src={embed.footer.icon_url} alt=\"\" className=\"size-5 rounded-full\" />\n )}\n {[\n embed.footer?.text,\n embed.timestamp && new Date(embed.timestamp).toLocaleString(),\n ]\n .filter(Boolean)\n .join(' • ')}\n </div>\n )}\n </div>\n {embed.thumbnail?.url !== undefined && (\n <img\n src={embed.thumbnail.url}\n alt=\"\"\n className=\"mt-2 size-20 rounded-[4px] object-cover\"\n />\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n );\n}\n","import { useLayoutEffect, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { ThumbnailStatus, ThumbnailWindow } from './thumbnail-window';\n\n/**\n * Dark-mode simulation for a rendered email: emails are authored light, so a\n * dark stage inverts the document and re-inverts imagery. Shared with the\n * templates page so the thumbnail and the full preview agree.\n */\nexport const DARK_SIMULATION =\n '<style>html{background:#fff;filter:invert(0.92) hue-rotate(180deg)}img,video{filter:invert(1) hue-rotate(180deg)}</style>';\n\n/** The window scrolls the document; the frame itself must never scroll inside it. */\nconst NO_SCROLL = '<style>html,body{overflow:hidden}</style>';\n\n/** Emails are laid out for this width; the thumbnail scales that down, never reflows it. */\nconst EMAIL_WIDTH = 600;\n\nexport interface EmailThumbnailProps {\n /** Rendered HTML; absent while loading, on error, or when nothing is registered. */\n html?: string | undefined;\n loading: boolean;\n error?: string | undefined;\n /** False when the IR references a template the email registry does not register. */\n registered: boolean;\n scheme: 'light' | 'dark';\n /** Open the full preview — the button under the window. */\n onOpen: () => void;\n}\n\n/**\n * The email at postage-stamp size: the document renders at its native width\n * in a sandboxed frame and is scaled to the card, so what shows is exactly\n * what the templates page shows, only smaller. The window scrolls through the\n * whole email; a button beneath it opens the full preview.\n */\nexport function EmailThumbnail({\n html,\n loading,\n error,\n registered,\n scheme,\n onOpen,\n}: EmailThumbnailProps) {\n const { t } = useTranslation();\n const boxRef = useRef<HTMLDivElement>(null);\n const [box, setBox] = useState<{ width: number; height: number }>();\n /* Native document height, read once the frame has laid out. */\n const [docHeight, setDocHeight] = useState<number>();\n\n /* The scale follows the window's inner width; measure rather than assume it. */\n useLayoutEffect(() => {\n const element = boxRef.current;\n if (element === null) return;\n const measure = () => setBox({ width: element.clientWidth, height: element.clientHeight });\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n const scale = box === undefined ? undefined : box.width / EMAIL_WIDTH;\n let status: string | undefined;\n if (!registered) status = t('emails.notRegistered');\n else if (error !== undefined) status = error;\n else if (loading || html === undefined) status = t('emails.rendering');\n\n /* Until the document reports its height, fill the window so the first paint is not blank. */\n const frameHeight =\n box === undefined || scale === undefined\n ? 0\n : Math.max(docHeight ?? 0, Math.ceil(box.height / scale));\n /*\n * The wrapper only grows for a document taller than the window. Otherwise it\n * fills exactly and clips the frame's rounding: the ceil above leaves a\n * fraction of a pixel that would otherwise read as overflow and show a bar.\n */\n const contentHeight = docHeight !== undefined && scale !== undefined ? docHeight * scale : 0;\n const wrapperHeight =\n box !== undefined && contentHeight > box.height + 1 ? contentHeight : '100%';\n\n return (\n <ThumbnailWindow\n ref={boxRef}\n className=\"overflow-x-hidden overflow-y-auto\"\n style={{ backgroundColor: scheme === 'dark' ? '#161616' : '#fff' }}\n onOpen={registered ? onOpen : undefined}\n >\n {status !== undefined ? (\n <ThumbnailStatus tone={error !== undefined ? 'error' : 'muted'}>\n <span className=\"whitespace-pre-line\">{status}</span>\n </ThumbnailStatus>\n ) : (\n scale !== undefined && (\n /* Sized to the scaled document, so the window scrolls the whole email. */\n <div className=\"overflow-hidden\" style={{ height: wrapperHeight }}>\n <iframe\n title={t('inspector.openTemplate')}\n srcDoc={`${html}${scheme === 'dark' ? DARK_SIMULATION : ''}${NO_SCROLL}`}\n /*\n * Same-origin so the document's height is readable; no\n * allow-scripts, so nothing in it runs. A picture of a document.\n */\n sandbox=\"allow-same-origin\"\n tabIndex={-1}\n aria-hidden\n onLoad={(event) => {\n const height = event.currentTarget.contentDocument?.documentElement.scrollHeight;\n if (height !== undefined && height > 0) setDocHeight(height);\n }}\n className=\"pointer-events-none block origin-top-left border-0\"\n style={{\n width: EMAIL_WIDTH,\n height: frameHeight,\n transform: `scale(${scale})`,\n }}\n />\n </div>\n )\n )}\n </ThumbnailWindow>\n );\n}\n","module.exports = \"__ROLLDOWN_ASSET__#WPGYjwIlzWVNM1bYhOc83w\"","module.exports = \"__ROLLDOWN_ASSET__#FKNdLzKnlftW3t_gzo81yw\"","module.exports = \"__ROLLDOWN_ASSET__#VRAku6fjghkApIISiBWPzg\"","import { Camera, ChevronDown, Flashlight, Lock } from 'lucide-react';\nimport type { CSSProperties, ReactNode } from 'react';\nimport iphoneFrameUrl from '../app/assets/devices/iphone-17-pro.png';\nimport pixelBackUrl from '../app/assets/devices/pixel-10-pro-back.webp';\nimport pixelMaskUrl from '../app/assets/devices/pixel-10-pro-mask.webp';\n\n/**\n * Push-notification preview: the two platforms' lock screens, side by side.\n *\n * Emails render themselves — the preview is an iframe around real output. A\n * push has no document of its own: what the user sees is the OS's chrome\n * around two strings, so the preview must *draw* that chrome. Both platforms\n * are shown at once because their layouts genuinely differ (iOS stacks\n * notifications at the bottom of the lock screen, Android under the clock)\n * and the copy has to survive both.\n *\n * The hardware is the vendors' own artwork, not ours: Apple's iPhone 17 Pro\n * product bezel (developer.apple.com/design/resources, PNG with a transparent\n * screen cutout the content shows through — the Dynamic Island is part of the\n * bezel) and Google's Pixel 10 Pro device frame (AOSP's device-art-resources,\n * the artwork behind Android Studio's screenshot framing: a `back` body layer\n * under the content and a screen-sized `mask` overlay painting the corner\n * bezels and the punch-hole camera over it).\n *\n * The software is drawn to the platforms' own design kits, at true scale:\n * screen content renders at the device's logical resolution (402pt / 412dp)\n * and is scaled into the frame's window, so every measurement below is the\n * spec's own number. iOS notification metrics come from the iOS 26 Figma kit\n * and a real device's lock screen (card 386w r28, padding 14/12, centred icon\n * 38 r12, title SF 15/17 semibold −0.23,\n * body 15/18 regular, time 15/17 top-right); Android lock-screen metrics\n * follow Google's official Android UI Kit on Figma (leading 40dp app icon,\n * bold 14sp title with an inline \"• now\", 14sp content line, a circled\n * expander). Collapsed banners carry no rich image on either platform.\n */\nexport interface PushPreviewProps {\n /** App identity on the banner; falls back to the project title upstream. */\n appName: string;\n /** The notification title, as `content` returned it. */\n title: string;\n body: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\n/** The keynote clock: every device mockup shows 9:41. */\nconst CLOCK = '9:41';\n/** Rendered device width; the frames' aspect ratios set everything else. */\nconst DEVICE_W = 300;\n\n/** One frame asset's geometry: canvas size and the screen window inside it. */\ninterface FrameGeometry {\n w: number;\n h: number;\n screen: { x: number; y: number; w: number; h: number };\n /**\n * Corner radius of the screen window, in the artwork's pixels. The content\n * must round itself off: the window's corner arcs pass inside its bounding\n * box, and past them the artwork is transparent (the outside of the device),\n * so square content corners would poke out of the hardware.\n */\n screenRadius: number;\n /** Logical width (pt / dp): screen content renders at this and scales down. */\n logicalW: number;\n}\n\n/** Measured from the bezel PNG (alpha scan of the transparent cutout). */\nconst IPHONE: FrameGeometry = {\n w: 1350,\n h: 2760,\n screen: { x: 72, y: 69, w: 1206, h: 2622 },\n screenRadius: 185,\n logicalW: 402,\n};\n/** From the frame's layout descriptor (display size/offset, corner_radius). */\nconst PIXEL: FrameGeometry = {\n w: 1410,\n h: 2968,\n screen: { x: 59, y: 60, w: 1280, h: 2856 },\n screenRadius: 99,\n logicalW: 412,\n};\n\n/**\n * Apple's continuous corner — a true squircle, not the studio's subtler 1.2.\n * Falls back to plain border-radius where `corner-shape` is unsupported.\n */\nconst squircle = { cornerShape: 'superellipse(2)' } as CSSProperties;\n\n/** App icon stand-in: initial on a gradient, sized by the caller. */\nfunction AppIcon({\n name,\n size,\n radius,\n shape,\n className,\n}: {\n name: string;\n size: number;\n radius: number;\n shape?: CSSProperties;\n className?: string;\n}) {\n return (\n <div\n aria-hidden\n className={`flex shrink-0 items-center justify-center font-semibold text-white ${className ?? ''}`}\n style={{\n width: size,\n height: size,\n borderRadius: radius,\n fontSize: size * 0.48,\n background: 'linear-gradient(135deg,#6366f1 0%,#8b5cf6 55%,#d946ef 100%)',\n ...shape,\n }}\n >\n {(name.trim().charAt(0) || 'A').toUpperCase()}\n </div>\n );\n}\n\n/**\n * One device: platform label above, then the frame artwork with the software\n * screen composited into its window. Children render at the device's logical\n * resolution and are scaled to fit, so their styles use real pt / dp values.\n */\nfunction Device({\n label,\n dark,\n geometry,\n underlay,\n overlay,\n overlayPlacement = 'frame',\n screenShape,\n wallpaper,\n children,\n}: {\n label: string;\n dark: boolean;\n geometry: FrameGeometry;\n underlay?: string;\n overlay: string;\n /** Whether the overlay artwork spans the whole frame or just the screen window. */\n overlayPlacement?: 'frame' | 'screen';\n /** Extra corner treatment for the screen content (the iPhone's squircle). */\n screenShape?: CSSProperties;\n wallpaper: string;\n children: ReactNode;\n}) {\n const scale = DEVICE_W / geometry.w;\n const screenRect: CSSProperties = {\n position: 'absolute',\n left: geometry.screen.x * scale,\n top: geometry.screen.y * scale,\n width: geometry.screen.w * scale,\n height: geometry.screen.h * scale,\n };\n const frameRect: CSSProperties = {\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n };\n /* Logical canvas: spec-true units inside, one scale() to the frame window. */\n const logicalScale = (geometry.screen.w * scale) / geometry.logicalW;\n const logicalH = (geometry.screen.h / geometry.screen.w) * geometry.logicalW;\n return (\n <div className=\"shrink-0\" style={{ width: DEVICE_W }}>\n <div\n className=\"mb-3 text-center text-[14px] font-semibold\"\n style={{ color: dark ? 'var(--color-gray-400)' : 'var(--color-gray-500)' }}\n >\n {label}\n </div>\n <div\n className=\"relative\"\n style={{\n width: DEVICE_W,\n height: Math.round(geometry.h * scale),\n filter: dark\n ? 'drop-shadow(0 20px 40px rgba(0,0,0,0.55))'\n : 'drop-shadow(0 20px 40px rgba(15,23,42,0.3))',\n }}\n >\n {underlay !== undefined && <img src={underlay} alt=\"\" style={frameRect} />}\n <div\n className=\"overflow-hidden\"\n style={{\n ...screenRect,\n borderRadius: geometry.screenRadius * scale,\n background: wallpaper,\n ...screenShape,\n }}\n >\n <div\n className=\"flex flex-col\"\n style={{\n width: geometry.logicalW,\n height: logicalH,\n transform: `scale(${logicalScale})`,\n transformOrigin: 'top left',\n }}\n >\n {children}\n </div>\n </div>\n <img\n src={overlay}\n alt=\"\"\n className=\"pointer-events-none\"\n style={overlayPlacement === 'screen' ? screenRect : frameRect}\n />\n </div>\n </div>\n );\n}\n\n/** iOS lock-screen wallpaper; the inspector's push thumbnail uses the same one. */\nexport const IOS_WALLPAPER = {\n light: 'linear-gradient(170deg,#a9c4ff 0%,#d5b3f7 52%,#ffc0d3 100%)',\n dark: 'linear-gradient(170deg,#26355f 0%,#45296b 52%,#131625 100%)',\n};\n\nconst IOS_FACE: CSSProperties = {\n fontFamily: \"-apple-system, 'SF Pro Text', system-ui, sans-serif\",\n};\n\n/**\n * The banner alone, to the iOS 26 kit: 8pt side margins (386 wide on a 402pt\n * screen), padding 14/12, a 10pt gap after the 38pt icon, and the time\n * top-right. The lock screen composes it; the inspector thumbnail shows it bare.\n */\nexport function IosBanner({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n const primary = dark ? 'rgba(255,255,255,0.96)' : 'rgba(0,0,0,0.9)';\n const secondary = dark ? 'rgba(235,235,245,0.6)' : '#4D4D4D';\n return (\n <div\n className=\"relative mx-[8px] shrink-0 rounded-[40px] px-[14px] py-[12px]\"\n style={{\n ...IOS_FACE,\n /* Liquid glass: brighter than the wallpaper, heavy blur, a specular rim. */\n background: dark ? 'rgba(110,115,135,0.34)' : 'rgba(250,250,252,0.5)',\n backdropFilter: 'blur(28px) saturate(180%)',\n WebkitBackdropFilter: 'blur(28px) saturate(180%)',\n boxShadow: dark\n ? '0 8px 32px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.16)'\n : '0 8px 32px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.55)',\n ...squircle,\n }}\n >\n <div className=\"flex gap-[10px]\">\n <AppIcon name={appName} size={38} radius={12} shape={squircle} className=\"self-center\" />\n <div className=\"min-w-0 flex-1 self-center\">\n <div\n className=\"truncate text-[15px] leading-[17px] font-semibold tracking-[-0.23px]\"\n style={{ color: primary }}\n >\n {title}\n </div>\n <div\n className=\"line-clamp-4 text-[15px] leading-[18px] tracking-[-0.23px]\"\n style={{ color: primary }}\n >\n {body}\n </div>\n </div>\n <span\n className=\"shrink-0 self-start text-[15px] leading-[17px]\"\n style={{ color: secondary }}\n >\n now\n </span>\n </div>\n </div>\n );\n}\n\nfunction IosDevice({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n return (\n <Device\n label=\"iOS\"\n dark={dark}\n geometry={IPHONE}\n overlay={iphoneFrameUrl}\n screenShape={squircle}\n wallpaper={dark ? IOS_WALLPAPER.dark : IOS_WALLPAPER.light}\n >\n <div className=\"relative flex min-h-0 flex-1 flex-col\" style={IOS_FACE}>\n {/*\n Wallpaper glow, sitting behind the banner: frosted glass is invisible\n over a flat gradient — the blur needs detail to smear. Two soft light\n blobs give the backdrop-filter something to show.\n */}\n <div aria-hidden className=\"pointer-events-none absolute inset-0\">\n <div\n className=\"absolute rounded-full\"\n style={{\n left: 20,\n top: 540,\n width: 240,\n height: 240,\n background: `radial-gradient(circle, ${\n dark ? 'rgba(125,110,255,0.4)' : 'rgba(255,255,255,0.75)'\n }, transparent 65%)`,\n }}\n />\n <div\n className=\"absolute rounded-full\"\n style={{\n right: -40,\n top: 640,\n width: 280,\n height: 280,\n background: `radial-gradient(circle, ${\n dark ? 'rgba(70,150,255,0.32)' : 'rgba(255,170,205,0.7)'\n }, transparent 65%)`,\n }}\n />\n </div>\n {/*\n Lock-screen clock, at the kit's measured offsets (Examples/\n Notifications): the 22pt medium date sits at y76 (26 tall), the\n clock's glyphs at y119 with a 73pt cap height (a ~100pt face) — a\n 17pt visual gap between them.\n */}\n <div\n className=\"mt-[76px] shrink-0 text-center\"\n style={{ color: 'rgba(255,255,255,0.95)', textShadow: '0 1px 18px rgba(0,0,0,0.18)' }}\n >\n <div className=\"text-[22px] leading-[26px] font-medium\">Monday, June 9</div>\n <div className=\"mt-[3px] text-[100px] leading-[100px] font-semibold tracking-[-2px]\">\n {CLOCK}\n </div>\n </div>\n {/* Wallpaper breathes; notifications rise from the bottom on iOS. */}\n <div className=\"min-h-0 flex-1\" />\n <IosBanner appName={appName} title={title} body={body} dark={dark} />\n {/* Flashlight / camera (50pt), and the home indicator. */}\n <div className=\"mt-[24px] mb-[12px] flex shrink-0 items-center justify-between px-[52px]\">\n {[Flashlight, Camera].map((Icon, index) => (\n <span\n key={index}\n className=\"flex size-[50px] items-center justify-center rounded-full backdrop-blur-md\"\n style={{ background: 'rgba(20,20,24,0.34)', color: 'rgba(255,255,255,0.92)' }}\n >\n <Icon size={22} strokeWidth={2} aria-hidden />\n </span>\n ))}\n </div>\n <div\n className=\"mx-auto mb-[9px] h-[5px] w-[148px] shrink-0 rounded-full\"\n style={{ background: 'rgba(255,255,255,0.9)' }}\n />\n </div>\n </Device>\n );\n}\n\nfunction AndroidDevice({\n appName,\n title,\n body,\n dark,\n}: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {\n const face: CSSProperties = { fontFamily: \"Roboto, 'Google Sans', system-ui, sans-serif\" };\n const primary = dark ? 'rgba(255,255,255,0.95)' : 'rgba(27,27,31,0.95)';\n const secondary = dark ? 'rgba(255,255,255,0.65)' : 'rgba(68,71,78,0.8)';\n /* Material You: the clock picks up the wallpaper's tone, dark on light. */\n const clockColor = dark ? 'rgba(255,255,255,0.95)' : 'rgba(28,44,40,0.9)';\n return (\n <Device\n label=\"Android\"\n dark={dark}\n geometry={PIXEL}\n underlay={pixelBackUrl}\n overlay={pixelMaskUrl}\n overlayPlacement=\"screen\"\n wallpaper={\n dark\n ? 'linear-gradient(170deg,#1d2b33 0%,#262040 58%,#0f1317 100%)'\n : 'linear-gradient(170deg,#b6d2c8 0%,#a3c2b4 55%,#ddd3c0 100%)'\n }\n >\n <div className=\"flex min-h-0 flex-1 flex-col\" style={face}>\n {/* Lock-screen clock: date over the clock, per the kit's templates. */}\n <div className=\"mt-[88px] shrink-0 text-center\" style={{ color: clockColor }}>\n <div className=\"text-[16px] leading-[22px] font-medium\">Mon, Jun 9</div>\n <div className=\"text-[64px] leading-[1.1] font-normal\">{CLOCK}</div>\n </div>\n {/*\n Lock-screen notification, to Google's Android UI Kit: a full-width\n card with 12dp margins, a leading 40dp app icon, a bold 14sp title\n with the \"• now\" inline, a 14sp content line, then the circled\n expander. App name never appears — the icon is the identity,\n exactly as on the real lock screen.\n */}\n <div\n className=\"mx-[12px] mt-[28px] shrink-0 rounded-[16px] p-[12px] backdrop-blur-md\"\n style={{\n /* A step lighter than the wallpaper's darkest stop, so the card reads at night. */\n background: dark ? 'rgba(64,68,76,0.78)' : 'rgba(255,255,255,0.92)',\n boxShadow: dark\n ? '0 4px 16px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.08)'\n : '0 4px 16px rgba(0,0,0,0.12)',\n }}\n >\n <div className=\"flex items-center gap-[12px]\">\n <AppIcon name={appName} size={40} radius={12} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline gap-[6px]\">\n <span\n className=\"min-w-0 truncate text-[14px] leading-[20px] font-bold\"\n style={{ color: primary }}\n >\n {title}\n </span>\n <span className=\"shrink-0 text-[14px] leading-[20px]\" style={{ color: secondary }}>\n • now\n </span>\n </div>\n <div className=\"line-clamp-2 text-[14px] leading-[20px]\" style={{ color: primary }}>\n {body}\n </div>\n </div>\n <span\n className=\"flex size-[28px] shrink-0 items-center justify-center rounded-full\"\n style={{\n background: dark ? 'rgba(255,255,255,0.12)' : 'rgba(27,27,31,0.08)',\n color: secondary,\n }}\n >\n <ChevronDown size={16} strokeWidth={2.5} aria-hidden />\n </span>\n </div>\n </div>\n <div className=\"min-h-0 flex-1\" />\n {/* The lock glyph above the gesture area. */}\n <div\n className=\"mb-[18px] flex shrink-0 justify-center\"\n style={{ color: dark ? 'rgba(255,255,255,0.85)' : 'rgba(28,44,40,0.8)' }}\n >\n <Lock size={18} strokeWidth={2.5} aria-hidden />\n </div>\n </div>\n </Device>\n );\n}\n\nexport function PushPreview({ appName, title, body, scheme, zoom }: PushPreviewProps) {\n const dark = scheme === 'dark';\n return (\n <div\n className=\"flex flex-wrap items-start justify-center gap-12 pt-2\"\n style={{ transform: `scale(${zoom})`, transformOrigin: 'top center' }}\n >\n <IosDevice appName={appName} title={title} body={body} dark={dark} />\n <AndroidDevice appName={appName} title={title} body={body} dark={dark} />\n </div>\n );\n}\n","import type { SlackContent } from '@shware/workflow';\nimport { useTranslation } from 'react-i18next';\nimport { ChatMarkup } from './chat-markup';\nimport { superellipse } from './corner-shape';\n\n/**\n * An incoming-webhook message as Slack draws it in a channel: the app's name and icon with the\n * APP tag, then its Block Kit blocks (header, section with fields and accessory, divider,\n * context, actions, image) — or the plain `text` when there are none, which is also what\n * notifications show. Slack's palette for each theme; close enough to judge the message.\n */\nexport interface SlackPreviewProps {\n message: SlackContent;\n /** The name the app posts under when the message names none: the project title upstream. */\n appName: string;\n scheme: 'light' | 'dark';\n zoom: number;\n}\n\nconst PALETTE = {\n dark: { bg: '#1a1d21', text: '#d1d2d3', muted: '#ababad', name: '#ffffff', border: '#35373b' },\n light: { bg: '#ffffff', text: '#1d1c1d', muted: '#616061', name: '#1d1c1d', border: '#dddddd' },\n};\n\n/** A Block Kit text object: plain text, or mrkdwn formatted. */\ninterface TextObject {\n type: 'plain_text' | 'mrkdwn';\n text: string;\n}\n\ntype Element = Record<string, unknown> & { type: string };\n\nconst textOf = (value: unknown): TextObject | undefined => {\n if (typeof value !== 'object' || value === null) return undefined;\n const object = value as Partial<TextObject>;\n return typeof object.text === 'string' ? (object as TextObject) : undefined;\n};\n\nexport function SlackPreview({ message, appName, scheme, zoom }: SlackPreviewProps) {\n const { t } = useTranslation();\n const colors = PALETTE[scheme];\n const name = message.username ?? appName;\n const linkClass = 'text-[#1d9bd1] hover:underline';\n const Text = ({ value, className }: { value: TextObject | undefined; className?: string }) =>\n value === undefined ? null : (\n <div className={`break-words whitespace-pre-wrap ${className ?? ''}`}>\n {value.type === 'mrkdwn' ? (\n <ChatMarkup text={value.text} dialect=\"slack\" linkClass={linkClass} />\n ) : (\n value.text\n )}\n </div>\n );\n const Button = ({ element }: { element: Element }) => {\n const style = element.style as string | undefined;\n return (\n <span\n className=\"inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold\"\n style={\n style === 'primary'\n ? { background: '#007a5a', borderColor: '#007a5a', color: '#fff' }\n : style === 'danger'\n ? { background: '#e01e5a', borderColor: '#e01e5a', color: '#fff' }\n : { borderColor: colors.border, color: colors.name }\n }\n >\n {textOf(element.text)?.text}\n </span>\n );\n };\n\n const blocks = (message.blocks ?? []) as Element[];\n return (\n <div\n className=\"mx-auto w-full max-w-2xl overflow-hidden rounded-2xl border shadow-sm\"\n style={{\n ...superellipse,\n background: colors.bg,\n borderColor: colors.border,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n >\n <div\n className=\"flex gap-2 px-5 py-4 text-[15px] leading-[1.46668]\"\n style={{ color: colors.text }}\n >\n {message.icon_url ? (\n <img src={message.icon_url} alt=\"\" className=\"size-9 shrink-0 rounded-lg object-cover\" />\n ) : (\n <div className=\"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[#4a154b] text-sm font-bold text-white\">\n {message.icon_emoji === undefined ? name.slice(0, 1).toUpperCase() : '🙂'}\n </div>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <div className=\"flex items-baseline gap-1.5\">\n <span className=\"font-black\" style={{ color: colors.name }}>\n {name}\n </span>\n <span\n className=\"rounded-[3px] px-1 text-[10px] font-bold\"\n style={{ background: scheme === 'dark' ? '#35373b' : '#e8e8e8', color: colors.muted }}\n >\n APP\n </span>\n <span className=\"text-xs\" style={{ color: colors.muted }}>\n {t('emails.chatNow')}\n </span>\n </div>\n {blocks.length === 0 ? (\n <Text\n value={{\n type: message.mrkdwn === false ? 'plain_text' : 'mrkdwn',\n text: message.text,\n }}\n />\n ) : (\n blocks.map((block, index) => {\n // oxlint-disable-next-line react/no-array-index-key -- blocks are positional\n const key = index;\n switch (block.type) {\n case 'header':\n return (\n <div\n key={key}\n className=\"mt-1 text-lg font-black\"\n style={{ color: colors.name }}\n >\n {textOf(block.text)?.text}\n </div>\n );\n case 'divider':\n return <hr key={key} className=\"my-2\" style={{ borderColor: colors.border }} />;\n case 'section': {\n const fields = (block.fields as unknown[] | undefined) ?? [];\n const accessory = block.accessory as Element | undefined;\n return (\n <div key={key} className=\"flex gap-3\">\n <div className=\"min-w-0 flex-1\">\n <Text value={textOf(block.text)} />\n {fields.length > 0 && (\n <div className=\"mt-2 grid grid-cols-2 gap-x-4 gap-y-2\">\n {fields.map((field, i) => (\n // oxlint-disable-next-line react/no-array-index-key -- fields are positional\n <Text key={i} value={textOf(field)} />\n ))}\n </div>\n )}\n </div>\n {accessory?.type === 'image' && (\n <img\n src={accessory.image_url as string}\n alt={(accessory.alt_text as string | undefined) ?? ''}\n className=\"size-[88px] shrink-0 rounded-lg object-cover\"\n />\n )}\n {accessory?.type === 'button' && <Button element={accessory} />}\n </div>\n );\n }\n case 'context':\n return (\n <div\n key={key}\n className=\"flex flex-wrap items-center gap-1.5 text-xs\"\n style={{ color: colors.muted }}\n >\n {((block.elements as Element[] | undefined) ?? []).map((element, i) =>\n element.type === 'image' ? (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <img\n key={i}\n src={element.image_url as string}\n alt=\"\"\n className=\"size-4 rounded\"\n />\n ) : (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <Text key={i} value={textOf(element)} />\n )\n )}\n </div>\n );\n case 'actions':\n return (\n <div key={key} className=\"mt-1 flex flex-wrap gap-2\">\n {((block.elements as Element[] | undefined) ?? []).map((element, i) =>\n element.type === 'button' ? (\n // oxlint-disable-next-line react/no-array-index-key -- elements are positional\n <Button key={i} element={element} />\n ) : null\n )}\n </div>\n );\n case 'image':\n return (\n <figure key={key} className=\"mt-1\">\n {textOf(block.title) !== undefined && (\n <figcaption className=\"mb-1 text-sm\" style={{ color: colors.muted }}>\n {textOf(block.title)?.text}\n </figcaption>\n )}\n <img\n src={block.image_url as string}\n alt={(block.alt_text as string | undefined) ?? ''}\n className=\"max-h-[300px] rounded-lg object-contain\"\n />\n </figure>\n );\n default:\n return (\n <div key={key} className=\"text-xs italic\" style={{ color: colors.muted }}>\n {t('emails.slackBlockUnsupported', { type: block.type })}\n </div>\n );\n }\n })\n )}\n </div>\n </div>\n </div>\n );\n}\n","import type { ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-textfield`, `--color-placeholder`, `--color-accent`).\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'textarea'>, 'size'> {\n size?: Size;\n className?: string;\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'px-2 py-[5px] text-xs rounded-md focus-visible:ring-2',\n sm: 'px-2 py-[7px] text-sm rounded-lg focus-visible:ring-3',\n md: 'px-3 py-[9px] text-sm rounded-xl focus-visible:ring-3',\n lg: 'px-4 py-[11px] text-md rounded-xl focus-visible:ring-4',\n xl: 'px-4 py-[13px] text-lg rounded-2xl focus-visible:ring-4',\n};\n\nexport function Textarea({ size = 'md', className, ...props }: Props) {\n return (\n <textarea\n {...props}\n className={cn(\n 'transition-colors duration-100 focus:outline-none',\n 'placeholder-placeholder bg-textfield focus-visible:border-accent border',\n 'dark:focus-visible:ring-accent/50 focus-visible:ring-accent/40',\n SIZE_STYLE[size],\n className\n )}\n />\n );\n}\n","import type { DiscordTemplate, EmailTemplate, PushTemplate, SlackTemplate } from '@shware/workflow';\nimport { Minus, Monitor, Moon, Plus, Smartphone, Sun } from 'lucide-react';\nimport { type ReactNode, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cn } from '../utils/cn';\nimport {\n type Props,\n type TemplateFailure,\n previewPropsOf,\n resolveDiscord,\n resolvePush,\n resolveSlack,\n} from '../utils/template-content';\nimport { superellipse } from './corner-shape';\nimport { DiscordPreview } from './discord-preview';\nimport { DARK_SIMULATION } from './email-thumbnail';\nimport { PushPreview } from './push-preview';\nimport { SlackPreview } from './slack-preview';\nimport type { TemplateRefInfo } from './template-refs';\nimport { Textarea } from './textarea';\n\n/**\n * Template preview page: the list on the left comes from IR, the react-email\n * component renders on the right. The email render is the caller's (it owns\n * the query); exactly one of `html` and `failure` describes this render.\n */\nexport interface TemplatePreview {\n html?: string;\n subject?: string;\n /** The template refused its props, or failed to render — field paths included. */\n failure?: TemplateFailure;\n /** Anything else that stopped the render. */\n error?: string;\n loading: boolean;\n}\n\nexport type { TemplateFailure } from '../utils/template-content';\n\nexport interface TemplatesPageProps {\n refs: TemplateRefInfo[];\n /** The project's email registry; keys match the DSL's template keys. */\n emails: Record<string, EmailTemplate | undefined>;\n /** The project's push registry, same contract as `emails` for the push channel. */\n pushes?: Record<string, PushTemplate | undefined>;\n /** The project's Discord and Slack webhook registries. */\n discords?: Record<string, DiscordTemplate | undefined>;\n slacks?: Record<string, SlackTemplate | undefined>;\n /** App identity on the push mockups; defaults to the project title upstream. */\n appName?: string;\n selected: string | undefined;\n /**\n * Channel of the selected template. One key can be registered in more than\n * one registry (an email and a push both called `checkout_reminder`), so the\n * key alone does not say which one is meant; absent picks the first match.\n */\n selectedChannel?: string | undefined;\n /** Rendered output for the selected template, produced by the caller. */\n preview: TemplatePreview;\n /** The project's envelope (`emails.from` / `replyTo`): every email is sent with it. */\n emailDefaults?: { from?: string; replyTo?: string };\n /**\n * In-memory props override for the selected template's preview; absent\n * renders the template's own `preview`. Never written anywhere.\n */\n previewProps?: Props | undefined;\n /**\n * Called as the props editor changes (undefined: back to the template's\n * `preview`). The editor only appears when this is provided.\n */\n onPreviewPropsChange?: (props: Props | undefined) => void;\n /**\n * The preview stage's starting light/dark, normally the studio's own theme.\n * The toolbar toggle overrides it for this visit only — leaving the page\n * drops the override, so the stage always reopens matching the studio.\n */\n defaultScheme?: 'light' | 'dark';\n}\n\n/**\n * One label/value row. A fragment rather than a wrapper so the rows land\n * directly in the parent grid: the label column then sizes to the longest label\n * — a custom header name can be any length and must not wrap — and every row\n * stays aligned with the others. One face, one size throughout.\n */\nfunction Field({ label, children }: { label: string; children: ReactNode }) {\n return (\n <>\n <dt className=\"text-muted whitespace-nowrap\">{label}</dt>\n <dd className=\"text-secondary min-w-0 break-words\">{children}</dd>\n </>\n );\n}\n\n/*\n * The frame is sized to its document and never scrolls itself — the page is\n * the one scroller. Without this a document whose real height has a\n * fractional part overflows the integer height we set by a fraction of a\n * pixel, which is nothing at all with overlay scrollbars and a permanent bar\n * for anyone whose OS always shows them. The thumbnail carries the same line\n * for the same reason.\n */\nconst NO_SCROLL = '<style>html,body{overflow:hidden}</style>';\n\n/*\n * Rough dark-mode simulation, the invert-and-rotate trick: emails carry their\n * own fixed colours, so this approximates what Gmail-style forced dark does to\n * them. Images are re-inverted to keep their real colours.\n */\n/*\n * The explicit white background matters: email bodies are often transparent,\n * and the white behind them is the iframe element's own — outside the\n * document, where the filter cannot reach. Painting it inside makes it flip.\n */\n/** A refused render: which phase, then every failing field path with its message. */\nexport function TemplateFailurePanel({ failure }: { failure: TemplateFailure }) {\n const { t } = useTranslation();\n return (\n <div\n role=\"alert\"\n className=\"mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300\"\n style={superellipse}\n >\n <p className=\"font-medium\">{t(`emails.failure.${failure.phase}`)}</p>\n <ul className=\"mt-2 flex flex-col gap-1\">\n {failure.issues.map((issue, index) => (\n <li key={`${issue.path}:${index}`}>\n {issue.path !== '' && <code className=\"mr-2 font-mono\">{issue.path}</code>}\n {issue.message}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/**\n * The preview props as JSON, editable in memory. Text that is not a JSON\n * object is reported here and handed up as a failure, so the preview never\n * goes on showing the last good render as if it were this one.\n */\nfunction PreviewPropsEditor({\n initial,\n onChange,\n onInvalid,\n onReset,\n}: {\n initial: Props;\n onChange: (props: Props) => void;\n onInvalid: (message: string) => void;\n onReset: () => void;\n}) {\n const { t } = useTranslation();\n /*\n * The text is the user's once they type, and derived from `initial` until\n * then — so an HMR change to the template's `preview` still shows here, and\n * the component never remounts mid-edit (a remount loses the caret).\n */\n const [draft, setDraft] = useState<string | undefined>(undefined);\n const text = draft ?? JSON.stringify(initial, null, 2);\n return (\n <div className=\"border-border bg-card border-b px-6 py-4\">\n <div className=\"flex items-center justify-between\">\n <label htmlFor=\"preview-props\" className=\"text-muted text-sm\">\n {t('emails.previewProps')}\n </label>\n <button\n type=\"button\"\n onClick={() => {\n setDraft(undefined);\n onReset();\n }}\n className=\"text-muted hover:text-primary text-xs transition-colors\"\n >\n {t('emails.previewPropsReset')}\n </button>\n </div>\n <Textarea\n id=\"preview-props\"\n size=\"sm\"\n rows={Math.min(8, Math.max(2, text.split('\\n').length))}\n spellCheck={false}\n className=\"mt-2 w-full font-mono text-xs\"\n value={text}\n onChange={(event) => {\n const next = event.target.value;\n setDraft(next);\n let parsed: unknown;\n try {\n parsed = JSON.parse(next);\n } catch (error) {\n onInvalid(error instanceof Error ? error.message : String(error));\n return;\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n onInvalid(t('emails.previewPropsNotObject'));\n return;\n }\n onChange(parsed as Props);\n }}\n />\n <p className=\"text-muted mt-1.5 text-xs\">{t('emails.previewPropsHint')}</p>\n </div>\n );\n}\n\n/** One control on the floating preview toolbar: a round 32px icon button. */\nfunction ToolButton({\n active = false,\n label,\n onClick,\n children,\n}: {\n active?: boolean;\n label: string;\n onClick: () => void;\n children: ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n title={label}\n aria-label={label}\n aria-pressed={active}\n onClick={onClick}\n className={cn(\n 'flex size-8 items-center justify-center rounded-full transition-colors',\n active ? 'bg-selected text-primary' : 'text-muted hover:bg-hover hover:text-primary'\n )}\n >\n {children}\n </button>\n );\n}\n\nexport function TemplatesPage({\n refs,\n emails,\n pushes = {},\n discords = {},\n slacks = {},\n appName,\n selected,\n selectedChannel,\n preview,\n emailDefaults,\n previewProps,\n onPreviewPropsChange,\n defaultScheme,\n}: TemplatesPageProps) {\n const { t } = useTranslation();\n /* Preview chrome: how the rendered email is framed, not what is in it. */\n /*\n * The stage follows the studio theme until the toggle is clicked; the click\n * is an override held in state only, so a fresh visit follows the theme\n * again — and an untouched stage keeps following live theme switches.\n */\n const [schemeOverride, setSchemeOverride] = useState<'light' | 'dark' | undefined>(undefined);\n const scheme = schemeOverride ?? defaultScheme ?? 'light';\n const setScheme = setSchemeOverride;\n const [device, setDevice] = useState<'desktop' | 'mobile'>('desktop');\n const [zoom, setZoom] = useState(1);\n /* Exactly the template asked for: an unknown key says so rather than showing another's content. */\n const active = refs.find(\n (ref) =>\n ref.key === selected && (selectedChannel === undefined || ref.channel === selectedChannel)\n );\n /* Editor text that is not a JSON object: shown in place of any render. */\n const [jsonError, setJsonError] = useState<{ for: string; message: string } | undefined>();\n /* Each channel reads its own registry, so a push key never shadows an email one. */\n const isPush = active?.channel === 'push';\n const isEmail = active?.channel === 'email';\n const activeEmail = active !== undefined && isEmail ? emails[active.key] : undefined;\n const activePush = active !== undefined && isPush ? pushes[active.key] : undefined;\n const isDiscord = active?.channel === 'discord';\n const isSlack = active?.channel === 'slack';\n const isChat = isDiscord || isSlack;\n const activeDiscord = active !== undefined && isDiscord ? discords[active.key] : undefined;\n const activeSlack = active !== undefined && isSlack ? slacks[active.key] : undefined;\n const { html, subject, error, loading } = preview;\n const activeId = active === undefined ? '' : `${active.channel}:${active.key}`;\n /* Leaving a template drops its JSON error: coming back remounts the editor with fresh text. */\n if (jsonError !== undefined && jsonError.for !== activeId) setJsonError(undefined);\n const propsFailure: TemplateFailure | undefined =\n jsonError?.for === activeId\n ? { phase: 'json', issues: [{ path: '', message: jsonError.message }] }\n : undefined;\n /* Exactly one of these describes this render; a failure is never shown beside a success. */\n const failure = propsFailure ?? preview.failure;\n\n /*\n * The notification, from the same validated content a send uses — the props\n * override when there is one, the template's `preview` otherwise.\n */\n const pushResolution =\n active !== undefined && activePush !== undefined\n ? resolvePush(activePush, active.key, previewProps)\n : undefined;\n const push =\n propsFailure === undefined && pushResolution?.ok === true ? pushResolution.push : undefined;\n const pushFailure =\n propsFailure ?? (pushResolution?.ok === false ? pushResolution.failure : undefined);\n\n /* A chat message, from the same checked content a send posts. */\n const discordResolution =\n active !== undefined && activeDiscord !== undefined\n ? resolveDiscord(activeDiscord, active.key, previewProps)\n : undefined;\n const slackResolution =\n active !== undefined && activeSlack !== undefined\n ? resolveSlack(activeSlack, active.key, previewProps)\n : undefined;\n const chatResolution = discordResolution ?? slackResolution;\n const chatFailure =\n propsFailure ?? (chatResolution?.ok === false ? chatResolution.failure : undefined);\n const chatReady = propsFailure === undefined && chatResolution?.ok === true;\n\n const editedEntry = isPush\n ? activePush\n : isDiscord\n ? activeDiscord\n : isSlack\n ? activeSlack\n : activeEmail;\n\n return (\n <div className=\"flex flex-1\">\n {/* Preview; the template list lives on the /emails index and the header dropdown. */}\n <section className=\"bg-page flex min-w-0 flex-1 flex-col\">\n {active === undefined ? (\n <div className=\"text-muted flex flex-1 items-center justify-center text-sm\">\n {selected === undefined ? t('emails.empty') : t('emails.notFound', { key: selected })}\n </div>\n ) : (\n <>\n {/*\n The envelope: one face, one size, roomy rows — a read-only\n summary reads better as a calm table. Every email goes out with\n the project's envelope; a push's \"envelope\" is its content.\n */}\n {((isEmail && activeEmail !== undefined) || push !== undefined) && (\n <div className=\"border-border bg-card border-b px-6 py-4\">\n <dl className=\"grid grid-cols-[max-content_1fr] gap-x-8 gap-y-2.5 text-sm\">\n {isEmail && activeEmail !== undefined && (\n <>\n <Field label={t('emails.from')}>\n {emailDefaults?.from ?? t('common.none')}\n </Field>\n {emailDefaults?.replyTo !== undefined && (\n <Field label={t('emails.replyTo')}>{emailDefaults.replyTo}</Field>\n )}\n <Field label={t('emails.subject')}>{subject ?? activeEmail.subject}</Field>\n </>\n )}\n {push !== undefined && (\n <>\n <Field label={t('emails.contentTitle')}>{push.title}</Field>\n <Field label={t('emails.contentBody')}>{push.body}</Field>\n {push.image !== undefined && (\n <Field label={t('emails.contentImage')}>{push.image}</Field>\n )}\n </>\n )}\n </dl>\n </div>\n )}\n\n {onPreviewPropsChange !== undefined && editedEntry !== undefined && (\n <PreviewPropsEditor\n /* A fresh editor per template only: the key must not change while someone types. */\n key={activeId}\n /* What the preview renders: the props handed in, else the template's own `preview`. */\n initial={previewProps ?? previewPropsOf(editedEntry)}\n onChange={(next) => {\n setJsonError(undefined);\n onPreviewPropsChange(next);\n }}\n onInvalid={(message) => setJsonError({ for: activeId, message })}\n onReset={() => {\n setJsonError(undefined);\n onPreviewPropsChange(undefined);\n }}\n />\n )}\n\n {/*\n Dot grid with the workflow canvas's look (its two themes' exact\n canvas/grid colours, 16px gap), marking everything around the\n rendered email as the studio's surface. It follows the toolbar's\n light/dark toggle rather than the studio theme, so flipping the\n simulated client mode visibly flips the whole stage.\n */}\n <div\n className=\"relative flex flex-1 flex-col\"\n style={{\n backgroundColor: scheme === 'dark' ? '#000' : 'var(--color-gray-50)',\n /* 0.5px radius: react-flow draws its dots at r=0.5 for zoom 1. */\n backgroundImage: `radial-gradient(${\n scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-400)'\n } 0.5px, transparent 0.5px)`,\n backgroundSize: '16px 16px',\n }}\n >\n {/* The stage grows with the email and the page scrolls it (see\n __root); the toolbar below rides along as `sticky`. */}\n <div className=\"flex-1 p-6 pb-4\">\n {isChat ? (\n (isDiscord ? activeDiscord : activeSlack) === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">\n {t('emails.notRegistered')}\n </p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.chatNotRegisteredHint', {\n key: active.key,\n channel: isDiscord ? 'discord' : 'slack',\n })}\n </p>\n </div>\n ) : chatFailure !== undefined ? (\n <TemplateFailurePanel failure={chatFailure} />\n ) : discordResolution?.ok === true ? (\n <DiscordPreview\n message={discordResolution.message}\n appName={appName ?? 'App'}\n scheme={scheme}\n zoom={zoom}\n />\n ) : slackResolution?.ok === true ? (\n <SlackPreview\n message={slackResolution.message}\n appName={appName ?? 'App'}\n scheme={scheme}\n zoom={zoom}\n />\n ) : null\n ) : isPush ? (\n activePush === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">\n {t('emails.notRegistered')}\n </p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.pushNotRegisteredHint', { key: active.key })}\n </p>\n </div>\n ) : pushFailure !== undefined ? (\n <TemplateFailurePanel failure={pushFailure} />\n ) : (\n <PushPreview\n appName={appName ?? 'App'}\n title={push?.title ?? ''}\n body={push?.body ?? ''}\n scheme={scheme}\n zoom={zoom}\n />\n )\n ) : activeEmail === undefined ? (\n <div\n className=\"border-border bg-card mx-auto max-w-xl rounded-2xl border border-dashed p-8 text-center\"\n style={superellipse}\n >\n <p className=\"text-primary text-sm font-medium\">{t('emails.notRegistered')}</p>\n <p className=\"text-muted mt-2 text-sm\">\n {t('emails.notRegisteredHint', { key: active.key })}\n </p>\n </div>\n ) : failure !== undefined ? (\n <TemplateFailurePanel failure={failure} />\n ) : loading ? (\n <div className=\"text-muted text-center text-sm\">{t('emails.rendering')}</div>\n ) : error !== undefined ? (\n <div\n className=\"mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300\"\n style={superellipse}\n >\n {error}\n </div>\n ) : (\n <iframe\n title={`${active.key} preview`}\n srcDoc={`${html ?? ''}${NO_SCROLL}${scheme === 'dark' ? DARK_SIMULATION : ''}`}\n /*\n * Sized to its document rather than the pane, so long emails\n * scroll in the outer container — which can pad past the\n * floating toolbar; an iframe scrolling internally cannot.\n */\n onLoad={(event) => {\n const frame = event.currentTarget;\n const root = frame.contentDocument?.documentElement ?? undefined;\n if (root === undefined) return;\n /* getBoundingClientRect keeps the fraction scrollHeight rounds off; ceil it. */\n const height = Math.ceil(root.getBoundingClientRect().height);\n if (height > 0) frame.style.height = `${height}px`;\n }}\n /*\n * Square corners — this box IS the email's viewport, not a\n * studio card. Border and fill follow the toolbar's\n * light/dark toggle with the stage, not the studio theme.\n */\n className=\"mx-auto min-h-40 border\"\n style={{\n borderColor:\n scheme === 'dark' ? 'var(--color-gray-700)' : 'var(--color-gray-300)',\n backgroundColor: '#fff',\n width: device === 'mobile' ? 375 : '100%',\n maxWidth: device === 'mobile' ? 375 : 672,\n transform: `scale(${zoom})`,\n transformOrigin: 'top center',\n }}\n />\n )}\n </div>\n\n {/*\n Floating preview toolbar: client scheme, device width, zoom.\n Sticky rather than absolute — the stage is no longer a fixed\n frame, so anchoring to its bottom would park the toolbar at the\n end of a long email instead of keeping it to hand. The wrapper\n spans the stage and must not swallow clicks meant for it.\n */}\n {(isChat\n ? chatReady\n : isPush\n ? push !== undefined\n : activeEmail !== undefined &&\n !loading &&\n error === undefined &&\n failure === undefined) && (\n <div className=\"pointer-events-none sticky bottom-0 z-10 flex justify-center pt-2 pb-4\">\n <div className=\"border-border bg-card pointer-events-auto flex items-center gap-0.5 rounded-full border p-1 shadow-lg\">\n <ToolButton\n active={scheme === 'light'}\n label={t('emails.previewLight')}\n onClick={() => setScheme('light')}\n >\n <Sun size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <ToolButton\n active={scheme === 'dark'}\n label={t('emails.previewDark')}\n onClick={() => setScheme('dark')}\n >\n <Moon size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n {/* Device widths are an email concern; a push shows both platforms, a chat message its client. */}\n {isEmail && (\n <>\n <div className=\"bg-border mx-1 h-4 w-px\" />\n <ToolButton\n active={device === 'desktop'}\n label={t('emails.previewDesktop')}\n onClick={() => setDevice('desktop')}\n >\n <Monitor size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <ToolButton\n active={device === 'mobile'}\n label={t('emails.previewMobile')}\n onClick={() => setDevice('mobile')}\n >\n <Smartphone size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n </>\n )}\n <div className=\"bg-border mx-1 h-4 w-px\" />\n <ToolButton\n label={t('emails.zoomOut')}\n onClick={() => setZoom((level) => Math.max(0.5, level - 0.25))}\n >\n <Minus size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n <button\n type=\"button\"\n title={t('emails.zoomReset')}\n onClick={() => setZoom(1)}\n className=\"text-secondary hover:text-primary w-11 text-center text-xs font-medium tabular-nums transition-colors\"\n >\n {Math.round(zoom * 100)}%\n </button>\n <ToolButton\n label={t('emails.zoomIn')}\n onClick={() => setZoom((level) => Math.min(1.5, level + 0.25))}\n >\n <Plus size={16} strokeWidth={2} aria-hidden />\n </ToolButton>\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </section>\n </div>\n );\n}\n","/**\n * What to call a code-owned asset in the UI.\n *\n * Keys are wire identity — referenced by name in IR, keyed on by the engine —\n * and nothing anyone should have to read. The label is `meta.name` when set;\n * when it is not, an explicit placeholder, because a blank is easy to miss and\n * \"Untitled\" is an invitation to name the thing.\n */\nexport function displayName(name: string | undefined, untitled: string): string {\n const trimmed = name?.trim();\n return trimmed !== undefined && trimmed !== '' ? trimmed : untitled;\n}\n","/**\n * Sparkline for the workflows list.\n *\n * A polyline over N points: no axes, no scales, no interaction. Same reasoning\n * as the Metrics tab chart — at this size a charting dependency would only add\n * weight.\n */\nexport interface SparklineProps {\n values: readonly number[];\n width?: number;\n height?: number;\n className?: string;\n}\n\nexport function Sparkline({ values, width = 76, height = 26, className }: SparklineProps) {\n if (values.length < 2) {\n return (\n <svg width={width} height={height} className={className} aria-hidden>\n <line\n x1={0}\n y1={height - 1}\n x2={width}\n y2={height - 1}\n stroke=\"var(--color-border)\"\n strokeWidth={1.5}\n />\n </svg>\n );\n }\n\n const max = Math.max(...values);\n const min = Math.min(...values);\n const span = max - min || 1;\n const stepX = width / (values.length - 1);\n // 1px inset top and bottom so the stroke is never clipped\n const points = values\n .map((value, index) => {\n const x = index * stepX;\n const y = height - 1 - ((value - min) / span) * (height - 2);\n return `${x.toFixed(1)},${y.toFixed(1)}`;\n })\n .join(' ');\n\n const flat = max === min;\n\n return (\n <svg width={width} height={height} className={className} aria-hidden>\n <polyline\n points={points}\n fill=\"none\"\n stroke={flat ? 'var(--color-border)' : 'var(--color-primary)'}\n strokeWidth={1.5}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import type { NodeIR, WorkflowIR } from '@shware/workflow';\nimport { clsx } from 'clsx';\nimport { AlarmClock, Mail, Workflow as WorkflowIcon } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport type { WorkflowReport } from '../config';\nimport { displayName } from '../utils/label';\nimport { superellipse } from './corner-shape';\nimport { Sparkline } from './sparkline';\n\n/**\n * The workflows list: one row per definition with its shape (how many\n * messages, how many waits) and the funnel from the stats source, all inside\n * a single card.\n *\n * One card of rows rather than a card per workflow: the four funnel numbers\n * are only worth showing because they can be read down a column, and a grid\n * of tiles breaks exactly that. Below `md` there are no columns left to align,\n * so a row folds into title-then-stats instead.\n */\nexport interface WorkflowListProps {\n /** Local definitions, keyed by the id used in the URL. */\n items: { key: string; ir: WorkflowIR }[];\n reports?: WorkflowReport[];\n onOpen: (key: string) => void;\n}\n\n/** Count message and delay nodes across the whole tree, arms included. */\nfunction countNodes(nodes: readonly NodeIR[], acc = { messages: 0, delays: 0 }) {\n for (const node of nodes) {\n if (node.type === 'message') acc.messages++;\n if (node.type === 'delay' || node.type === 'random_delay' || node.type === 'wait_until') {\n acc.delays++;\n }\n if (node.type === 'branch') {\n for (const branchCase of node.cases) countNodes(branchCase.flow, acc);\n if (node.otherwise) countNodes(node.otherwise, acc);\n }\n if (node.type === 'cohort') for (const arm of node.arms) countNodes(arm.flow, acc);\n if (node.type === 'wait_until' && Array.isArray(node.onTimeout)) {\n countNodes(node.onTimeout, acc);\n }\n }\n return acc;\n}\n\nconst compact = (value: number) =>\n value >= 1000\n ? `${(value / 1000).toFixed(2).replace(/0+$/, '').replace(/\\.$/, '')}k`\n : `${value}`;\n\nconst rate = (part: number | undefined, whole: number | undefined) =>\n part === undefined || whole === undefined || whole === 0\n ? '—'\n : `${((part / whole) * 100).toFixed(1)}%`;\n\nconst COLUMNS = ['delivered', 'opened', 'clicked', 'converted'] as const;\n\n/*\n * Not pinned: the app header is the only sticky chrome, so the head scrolls\n * away with the rows and needs no opaque fill of its own. The radii stay —\n * the card has no `overflow` to clip with, so its top corners are cut here.\n */\nconst HEAD_CELL = 'border-border border-b py-3 first:rounded-tl-2xl last:rounded-tr-2xl';\n\n/*\n * Stacked, every cell is inset by the row's own padding instead of its own,\n * so the four metrics line up with the title above them and the row's hover\n * fill still reaches the card's edges.\n */\nconst CELL = 'border-border border-b py-4 max-md:border-b-0 max-md:px-3';\n\n/*\n * The studio's palette is monochrome; colour is reserved for state. Running /\n * draft is state, so it keeps green and grey.\n */\n\nexport function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {\n const { t } = useTranslation();\n const byId = new Map((reports ?? []).map((report) => [report.id, report]));\n\n return (\n /*\n * No `overflow` on the card, deliberately: any value at all turns it into\n * a scrollport of its own and draws a second bar inset inside the border —\n * the page is the one scroller (see __root). Nothing clips, so the corners\n * are re-cut on the first and last cells below.\n */\n <div className=\"border-border bg-card rounded-2xl border\" style={superellipse}>\n {/* Below `md` the table leaves table layout entirely and each row lays\n itself out as a four-column grid — see the row classes. */}\n <table className=\"w-full table-fixed border-separate border-spacing-0 text-sm max-md:block\">\n <thead className=\"max-md:hidden\">\n <tr className=\"text-muted text-left text-xs font-medium\">\n <th className={clsx(HEAD_CELL, 'min-w-0 px-6')} style={superellipse}>\n {t('common.name')}\n </th>\n <th className={clsx(HEAD_CELL, 'w-28 px-3')} style={superellipse} />\n {COLUMNS.map((column) => (\n <th key={column} className={clsx(HEAD_CELL, 'w-28 px-3')} style={superellipse}>\n {t(`workflows.columns.${column}`)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"max-md:block\">\n {items.map(({ key, ir }) => {\n const shape = countNodes(ir.flow);\n const report = byId.get(ir.id);\n const values: Record<(typeof COLUMNS)[number], string> = {\n delivered: report?.delivered === undefined ? '—' : compact(report.delivered),\n opened: rate(report?.opened, report?.delivered),\n clicked: rate(report?.clicked, report?.delivered),\n converted: rate(report?.converted, report?.entered),\n };\n\n return (\n <tr\n key={key}\n onClick={() => onOpen(key)}\n className={clsx(\n 'cursor-pointer align-top [&>td]:transition-colors',\n /*\n * Laid out as a table the hover fill has to live on the\n * cells: a row box paints its background underneath them,\n * where no cell radius reaches it, so the last row would\n * poke square grey corners out of the card. Stacked, the row\n * is an ordinary grid box and takes fill and radius itself.\n */\n 'md:hover:[&>td]:bg-hover md:last:[&>td]:border-b-0',\n 'md:last:[&>td:first-child]:rounded-bl-2xl md:last:[&>td:last-child]:rounded-br-2xl',\n /* Stacked: title / status / the metrics two by two\n — four across a phone leaves no room for a label, let\n alone the sparkline under it. */\n 'border-border max-md:hover:bg-hover max-md:grid max-md:grid-cols-6',\n 'max-md:border-b max-md:px-3 max-md:first:rounded-t-2xl',\n 'max-md:last:rounded-b-2xl max-md:last:border-b-0'\n )}\n style={superellipse}\n >\n <td\n className={clsx(CELL, 'px-6 max-md:order-1 max-md:col-span-6 max-md:pb-2')}\n style={superellipse}\n >\n <div className=\"flex items-start gap-3\">\n <WorkflowIcon className=\"text-muted mt-0.5 size-4 shrink-0\" strokeWidth={2} />\n <div className=\"min-w-0\">\n <div\n className={clsx(\n 'truncate font-medium',\n ir.meta?.name === undefined ? 'text-muted italic' : 'text-primary'\n )}\n >\n {displayName(ir.meta?.name, t('common.untitled'))}\n </div>\n {/*\n Below md these two step back out of the title's indent\n (the 16px icon plus its 12px gap). The stacked rows under\n them — status, then the funnel — start at the card's edge,\n so keeping the indent here left a notch down the side.\n */}\n {ir.meta?.description !== undefined && (\n <p className=\"text-muted mt-1 truncate text-sm max-md:-ml-7\">\n {ir.meta.description}\n </p>\n )}\n <div className=\"text-muted mt-2 flex items-center gap-3 text-xs max-md:-ml-7\">\n <span className=\"flex items-center gap-1\">\n <Mail className=\"size-3.5\" strokeWidth={2} />\n {shape.messages}\n </span>\n <span className=\"flex items-center gap-1\">\n <AlarmClock className=\"size-3.5\" strokeWidth={2} />\n {shape.delays}\n </span>\n </div>\n </div>\n </div>\n </td>\n\n {/* Second in the DOM so the desktop column order holds; `order`\n moves it under the title once the row is a grid. */}\n <td\n className={clsx(\n CELL,\n 'px-3 max-md:order-3 max-md:col-span-6 max-md:pt-0 max-md:pb-3'\n )}\n style={superellipse}\n >\n <span\n className={clsx(\n 'inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n report\n ? 'bg-green-50 text-green-700 dark:bg-green-400/10 dark:text-green-300'\n : 'bg-selected text-muted'\n )}\n >\n <span\n className={clsx(\n 'size-1.5 rounded-full',\n report ? 'bg-green-500' : 'bg-muted'\n )}\n />\n {report ? t('status.running') : t('status.draft')}\n </span>\n </td>\n\n {COLUMNS.map((column) => (\n <td\n key={column}\n className={clsx(\n CELL,\n 'px-3 max-md:order-4 max-md:col-span-3 max-md:pt-0 max-md:pb-4'\n )}\n style={superellipse}\n >\n {/* The head is gone when stacked, so each figure names itself. */}\n <div className=\"text-muted mb-1 truncate text-xs md:hidden\">\n {t(`workflows.columns.${column}`)}\n </div>\n <div className=\"tabular-nums\">{values[column]}</div>\n <Sparkline values={report?.series?.[column] ?? []} className=\"mt-1\" />\n </td>\n ))}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n","import { ArrowDown, ArrowUp, type LucideIcon, Minus } from 'lucide-react';\nimport { Fragment, type PointerEvent, useId, useState } from 'react';\nimport { cn } from '../utils/cn';\nimport { superellipse } from './corner-shape';\n\n/**\n * One metric of the delivery funnel: what it is worth right now, which way it\n * moved, and its shape over the queried range.\n *\n * Four of these replace the single four-series line chart. That chart made the\n * drop-off between the stages legible and nothing else — every series but the\n * first was pinned to the floor by a shared y axis, so a 2% swing in clicks was\n * invisible. Each card gets its own scale instead, which is what you want once\n * the funnel's shape is a known quantity and the question becomes \"is today\n * normal for this stage\".\n *\n * Hand-drawn SVG, like every other chart here — see the note in sparkline.tsx.\n */\n\n/** Which way a delta points; `flat` is an exact zero, not a rounding of one. */\nexport type Trend = 'up' | 'down' | 'flat';\n\n/**\n * One plotted line.\n *\n * A card plots either one series or a total and the parts it decomposes into\n * (email opens split into human and machine). The parts are not independent\n * measurements, which is why they arrive as a list on one card rather than as\n * cards of their own: they only mean anything read against the total.\n */\nexport interface MetricSeries {\n /** Named in the hover readout, beside its colour swatch. */\n label: string;\n /** One value per bucket, oldest first; as long as `dates`. */\n values: readonly number[];\n}\n\nexport interface MetricCardProps {\n label: string;\n /** The current bucket, already formatted ('9,280', '26.2%'). */\n value: string;\n /** Period-over-period change, already formatted and signed. */\n delta?: { text: string; trend: Trend };\n /**\n * Bucket dates, oldest first, already formatted: the card has no business\n * knowing the locale, and the hover readout is the only place they are read.\n */\n dates: readonly string[];\n /**\n * Head series first. It gets the strongest shade and the gradient fill; any\n * that follow are its components and share its y scale — plotted against\n * scales of their own, two halves would not visibly add up to the whole.\n */\n series: readonly MetricSeries[];\n /** Formats the extremes in the plot's corners, and the values under the cursor. */\n format: (value: number) => string;\n}\n\n/**\n * viewBox units; `preserveAspectRatio=\"none\"` stretches them to the card.\n *\n * The height doubles as the plot's pixel height, which is what lets the hover\n * indicator place its dots with a y taken straight from the viewBox. The two\n * are the same number on purpose — move one and the other has to follow, or\n * the curve stretches vertically and the dots leave it.\n */\nconst VIEW_WIDTH = 320;\nconst VIEW_HEIGHT = 120;\n/** Headroom above the peak so the max label never sits on the curve. */\nconst TOP_PAD = 22;\n\n/**\n * Successive series, each mixed further toward the card it sits on.\n *\n * Mixing with the surface — rather than stepping down a fixed ramp — is what\n * makes one set of shades work in both themes: it pales toward the white card\n * in light mode and darkens toward the near-black one in dark mode, so the\n * head series is the highest-contrast line either way and the components read\n * as subordinate to it. A second hue was the other option and is not on the\n * table: accent is the only colour in the studio.\n */\nconst seriesColor = (index: number): string =>\n `color-mix(in oklab, var(--color-accent) ${Math.round(100 * 0.7 ** index)}%, var(--color-card))`;\n\ninterface Point {\n x: number;\n y: number;\n}\n\n/**\n * A cardinal spline through every point. The samples are daily counts, not a\n * continuous signal, so the curve is a reading aid rather than interpolation —\n * which is why it is allowed to overshoot slightly between points.\n */\nfunction splinePath(points: readonly Point[]): string {\n if (points.length === 0) return '';\n const first = points[0];\n let d = `M ${first.x.toFixed(1)} ${first.y.toFixed(1)}`;\n for (let i = 0; i < points.length - 1; i++) {\n /* Clamped neighbours, so the end segments bend the same way as the middle. */\n const p0 = points[Math.max(0, i - 1)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(points.length - 1, i + 2)];\n const c1x = p1.x + (p2.x - p0.x) / 6;\n const c1y = p1.y + (p2.y - p0.y) / 6;\n const c2x = p2.x - (p3.x - p1.x) / 6;\n const c2y = p2.y - (p3.y - p1.y) / 6;\n d += ` C ${c1x.toFixed(1)} ${c1y.toFixed(1)}, ${c2x.toFixed(1)} ${c2y.toFixed(1)}, ${p2.x.toFixed(1)} ${p2.y.toFixed(1)}`;\n }\n return d;\n}\n\nconst TREND_STYLE: Record<Trend, string> = {\n up: 'text-emerald-600 dark:text-emerald-400',\n down: 'text-red-600 dark:text-red-400',\n flat: 'text-secondary',\n};\n\nconst TREND_ICON: Record<Trend, LucideIcon> = { up: ArrowUp, down: ArrowDown, flat: Minus };\n\nexport function MetricCard({ label, value, delta, dates, series, format }: MetricCardProps) {\n const gradientId = useId();\n /** Which bucket the cursor is over; null once it leaves the plot. */\n const [active, setActive] = useState<number | null>(null);\n\n /* One scale for every line on the card: the components sum to the head\n series, and a shared axis is the only way that addition is visible. */\n const all = series.flatMap((one) => [...one.values]);\n const max = Math.max(...all, 0);\n const min = Math.min(...all, max);\n /* A flat series has no range to scale against; park it on the baseline. */\n const span = max - min || 1;\n const stepX = dates.length > 1 ? VIEW_WIDTH / (dates.length - 1) : 0;\n const yOf = (point: number) => TOP_PAD + (1 - (point - min) / span) * (VIEW_HEIGHT - TOP_PAD);\n const plotted = series.map((one) =>\n one.values.map((point, index) => ({ x: index * stepX, y: yOf(point) }))\n );\n\n const head = plotted.length > 0 ? plotted[0] : [];\n const line = splinePath(head);\n /* The fill closes the curve to the bottom edge and back to where it started.\n Only the head series gets one: three stacked washes would muddy the plot\n and the components are read as lines against the total, not as volumes. */\n const area = line === '' ? '' : `${line} L ${VIEW_WIDTH} ${VIEW_HEIGHT} L 0 ${VIEW_HEIGHT} Z`;\n\n const DeltaIcon = delta ? TREND_ICON[delta.trend] : undefined;\n\n /* The series can be replaced under a held cursor — a new granularity, a new\n channel — so a stale index is a live possibility, not a defensive fiction. */\n const hovered = active !== null && active < dates.length ? active : undefined;\n\n /**\n * Cursor → bucket. The plot is `preserveAspectRatio=\"none\"`, so its viewBox\n * is stretched to whatever width the card ended up with; only the rendered\n * box knows the real scale, and reading x in viewBox units would leave the\n * indicator a growing distance behind the pointer.\n */\n const trackPointer = (event: PointerEvent<HTMLDivElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n if (width === 0 || dates.length === 0) return;\n const index = Math.round(((event.clientX - left) / width) * (dates.length - 1));\n setActive(Math.min(Math.max(index, 0), dates.length - 1));\n };\n\n return (\n <section\n className=\"border-border bg-card flex flex-col overflow-hidden rounded-2xl border\"\n style={superellipse}\n >\n <div className=\"px-4 pt-4\">\n <h3 className=\"text-sm font-medium\">{label}</h3>\n </div>\n\n <div className=\"flex flex-wrap items-baseline gap-x-2 gap-y-1 px-4 pt-3\">\n <span className=\"text-2xl font-semibold tracking-tight tabular-nums\">{value}</span>\n {delta !== undefined && DeltaIcon !== undefined && (\n <span className={cn('inline-flex items-center gap-1 text-xs', TREND_STYLE[delta.trend])}>\n <DeltaIcon size={12} strokeWidth={2.5} aria-hidden />\n {delta.text}\n </span>\n )}\n </div>\n\n <div\n className=\"relative mt-3\"\n onPointerMove={trackPointer}\n onPointerLeave={() => setActive(null)}\n >\n <svg\n viewBox={`0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height: VIEW_HEIGHT }}\n role=\"img\"\n aria-label={label}\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"var(--color-accent)\" stopOpacity={0.22} />\n <stop offset=\"100%\" stopColor=\"var(--color-accent)\" stopOpacity={0} />\n </linearGradient>\n </defs>\n {area !== '' && <path d={area} fill={`url(#${gradientId})`} />}\n {/* Components first, head last: where they cross, the total is the\n line you want on top. */}\n {plotted\n .map((points, index) => ({ d: splinePath(points), index }))\n .filter((entry) => entry.d !== '')\n .reverse()\n .map((entry) => (\n <path\n key={entry.index}\n d={entry.d}\n fill=\"none\"\n style={{ stroke: seriesColor(entry.index) }}\n strokeWidth={1.75}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n /* The viewBox is stretched, so the stroke must opt out of scaling. */\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </svg>\n {all.length > 0 && (\n <>\n <span className=\"text-muted pointer-events-none absolute top-0 left-4 text-xs tabular-nums\">\n {format(max)}\n </span>\n <span className=\"text-muted pointer-events-none absolute right-4 bottom-1 text-xs tabular-nums\">\n {format(min)}\n </span>\n </>\n )}\n {hovered !== undefined && (\n <HoverReadout\n x={dates.length > 1 ? hovered / (dates.length - 1) : 0}\n date={dates[hovered]}\n rows={series.map((one, index) => ({\n color: seriesColor(index),\n label: one.label,\n value: format(one.values[hovered]),\n y: plotted[index][hovered].y,\n }))}\n />\n )}\n </div>\n </section>\n );\n}\n\n/** One line of the readout: which series, what it read, and where its dot goes. */\ninterface ReadoutRow {\n color: string;\n label: string;\n value: string;\n /** Plot pixels from the top — the viewBox height is the rendered height. */\n y: number;\n}\n\n/**\n * Rule, dots and panel for the bucket under the cursor.\n *\n * HTML rather than SVG: a circle drawn in the stretched viewBox renders as an\n * ellipse and the panel would shear with it. A percentage rides the same\n * stretch the curve does, so `x` is a 0–1 fraction of the plot's width, while\n * each `y` is plain pixels.\n *\n * Every card uses the same layout, one line per series, whether it plots one\n * or three. A single line's swatch and name are redundant on their own card,\n * but four cards sit side by side: reading across them, a row that suddenly\n * loses its columns costs more than the redundancy does.\n */\nfunction HoverReadout({ x, date, rows }: { x: number; date: string; rows: readonly ReadoutRow[] }) {\n const left = `${x * 100}%`;\n return (\n <div aria-hidden className=\"pointer-events-none\">\n <div className=\"bg-border absolute inset-y-0 w-px\" style={{ left }} />\n {rows.map((row) => (\n <div\n key={row.label}\n className=\"border-card absolute size-2.5 rounded-full border-2\"\n style={{ left, top: row.y, background: row.color, transform: 'translate(-50%, -50%)' }}\n />\n ))}\n {/*\n Anchored by the same fraction it sits at: the panel hugs the left edge\n at the start of the series and the right edge at the end, so the card\n never clips it.\n\n `w-max` is load-bearing. The date spans all three columns, but the\n middle one is `1fr`, and a flexible track takes no min-content\n contribution from a spanning item — so a shrink-to-fit panel sizes\n itself to the data row alone and the date spills out the side. Sizing\n to max-content measures the date too; the `1fr` then hands the slack to\n the label, which keeps the value flush right.\n */}\n <div\n className=\"border-border bg-card shadow-card-shadow absolute top-0 grid w-max items-center gap-x-3 gap-y-1 rounded-lg border px-2.5 py-2 text-xs shadow-md\"\n style={{\n ...superellipse,\n left,\n transform: `translateX(-${x * 100}%)`,\n gridTemplateColumns: 'auto 1fr auto',\n }}\n >\n <div className=\"col-span-full font-medium whitespace-nowrap\">{date}</div>\n {rows.map((row) => (\n <Fragment key={row.label}>\n <span\n className=\"size-3 rounded-sm\"\n style={{ ...superellipse, background: row.color }}\n />\n <span className=\"text-secondary whitespace-nowrap\">{row.label}</span>\n <span className=\"text-right font-medium tabular-nums\">{row.value}</span>\n </Fragment>\n ))}\n </div>\n </div>\n );\n}\n","import type { ComponentProps } from 'react';\nimport { cn } from '../../utils/cn';\n\n/**\n * Ported from the design system in the template project — same API, so the two\n * stay diffable. Colours resolve through the studio's CSS variables\n * (`--color-textfield`, `--color-placeholder`, `--color-accent`).\n */\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\ninterface Props extends Omit<ComponentProps<'input'>, 'size'> {\n size?: Size;\n htmlSize?: number;\n className?: string;\n}\n\nconst SIZE_STYLE: Record<Size, string> = {\n xs: 'h-7 px-2 text-xs rounded-md focus-visible:ring-2',\n sm: 'h-9 px-2 text-sm rounded-lg focus-visible:ring-3',\n md: 'h-10 px-3 text-sm rounded-xl focus-visible:ring-3',\n lg: 'h-12 px-4 text-md rounded-xl focus-visible:ring-4',\n xl: 'h-14 px-4 text-lg rounded-2xl focus-visible:ring-4',\n};\n\nexport function Input({ size = 'md', type = 'text', htmlSize, className, ...props }: Props) {\n return (\n <input\n {...props}\n type={type}\n size={htmlSize}\n className={cn(\n 'transition-colors duration-100 focus:outline-none',\n 'placeholder-placeholder bg-textfield focus-visible:border-accent border',\n 'dark:focus-visible:ring-accent/50 focus-visible:ring-accent/40',\n SIZE_STYLE[size],\n className\n )}\n />\n );\n}\n","import {\n FloatingFocusManager,\n autoUpdate,\n flip,\n offset,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Calendar } from 'lucide-react';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cn } from '../utils/cn';\nimport { Button } from './button';\nimport { superellipse } from './corner-shape';\nimport { Input } from './input';\n\n/**\n * The range every panel on the Overview reads from. Both ends are inclusive\n * ISO `YYYY-MM-DD` days — the same shape the stats contract takes, so the\n * picker's value can be handed straight to a query.\n */\nexport interface DateRange {\n from: string;\n to: string;\n}\n\n/**\n * A local calendar day, not a UTC instant. `toISOString().slice(0, 10)` is the\n * usual shortcut and it is wrong west of Greenwich for most of the day: it\n * reports yesterday, so \"last 30 days\" silently ends a day early.\n */\nexport function isoDay(date: Date): string {\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, '0');\n const day = `${date.getDate()}`.padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\n/** Parse an ISO day back to local midnight — `new Date(iso)` would read it as UTC. */\nexport function parseIsoDay(iso: string): Date {\n const [year = 1970, month = 1, day = 1] = iso.split('-').map(Number);\n return new Date(year, month - 1, day);\n}\n\n/** The inclusive range of the `count` days ending today. */\nexport function lastDays(count: number): DateRange {\n const to = new Date();\n const from = new Date();\n from.setDate(from.getDate() - (count - 1));\n return { from: isoDay(from), to: isoDay(to) };\n}\n\n/** 'Aug 21, 2026' — the compact form, for the toolbar trigger. */\nexport function formatDay(iso: string, locale: string): string {\n return parseIsoDay(iso).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nconst PRESETS = [7, 14, 30, 90] as const;\n\ninterface Props {\n value: DateRange;\n onChange: (range: DateRange) => void;\n className?: string;\n}\n\n/**\n * Presets plus two date fields, rather than a drawn calendar.\n *\n * Reporting ranges are chosen by duration (\"the last month\"), not by hunting\n * for a Tuesday, so the presets answer nearly every case; the two fields cover\n * the rest at a fraction of a calendar widget's weight — and the native picker\n * they carry is already localized and keyboard-accessible.\n */\nexport function DateRangePicker({ value, onChange, className }: Props) {\n const { t, i18n } = useTranslation();\n const [open, setOpen] = useState(false);\n\n const { refs, floatingStyles, context } = useFloating({\n open,\n onOpenChange: setOpen,\n placement: 'bottom-start',\n whileElementsMounted: autoUpdate,\n middleware: [offset(4), flip({ padding: 8 }), shift({ padding: 8 })],\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context),\n useRole(context, { role: 'dialog' }),\n ]);\n\n /*\n * A native date field reports '' when it is cleared, and an out-of-calendar\n * year is just as reachable by typing. Neither is a range: '' parses to 1900\n * and would ask the stats source for a century of daily buckets. Ignore\n * anything that is not a plain ISO day and the field snaps back to the value\n * it had, which is the only other honest answer — the range is required.\n */\n const isDay = (value: string) => /^\\d{4}-\\d{2}-\\d{2}$/.test(value);\n /* An inverted range is never what was meant; pin the other end to the edit. */\n const setFrom = (from: string) => {\n if (isDay(from)) onChange({ from, to: from > value.to ? from : value.to });\n };\n const setTo = (to: string) => {\n if (isDay(to)) onChange({ from: to < value.from ? to : value.from, to });\n };\n\n return (\n <>\n <Button\n ref={refs.setReference}\n size=\"sm\"\n variant=\"outline\"\n className={cn('gap-2 font-normal', className)}\n {...getReferenceProps()}\n >\n <Calendar size={16} strokeWidth={2} aria-hidden className=\"text-secondary shrink-0\" />\n <span className=\"tabular-nums\">\n {formatDay(value.from, i18n.language)} – {formatDay(value.to, i18n.language)}\n </span>\n </Button>\n {open && (\n <FloatingFocusManager context={context} modal={false}>\n <div\n ref={refs.setFloating}\n style={{ ...floatingStyles, ...superellipse }}\n className=\"border-border bg-card shadow-card-shadow z-50 w-64 rounded-xl border p-2 shadow-lg\"\n {...getFloatingProps()}\n >\n {PRESETS.map((days) => (\n <button\n key={days}\n type=\"button\"\n className=\"hover:bg-hover block w-full rounded-lg px-2.5 py-1.5 text-left text-sm\"\n style={superellipse}\n onClick={() => {\n onChange(lastDays(days));\n setOpen(false);\n }}\n >\n {t('metrics.range.lastDays', { count: days })}\n </button>\n ))}\n <div className=\"border-border mt-2 space-y-2 border-t pt-2\">\n <label className=\"block\">\n <span className=\"text-muted text-xs\">{t('metrics.range.from')}</span>\n <Input\n size=\"sm\"\n type=\"date\"\n max={value.to}\n value={value.from}\n className=\"mt-1 w-full\"\n onChange={(event) => setFrom(event.target.value)}\n />\n </label>\n <label className=\"block\">\n <span className=\"text-muted text-xs\">{t('metrics.range.to')}</span>\n <Input\n size=\"sm\"\n type=\"date\"\n min={value.from}\n value={value.to}\n className=\"mt-1 w-full\"\n onChange={(event) => setTo(event.target.value)}\n />\n </label>\n </div>\n </div>\n </FloatingFocusManager>\n )}\n </>\n );\n}\n","import {\n Bot,\n Globe,\n type LucideIcon,\n Mail,\n MessageCircle,\n MessageSquareText,\n MessagesSquare,\n Send,\n Smartphone,\n Webhook,\n} from 'lucide-react';\nimport type { MetricChannel } from '../config';\n\n/**\n * One glyph per delivery channel, shared by the chart cards, the channel\n * pickers and the message table — a channel has to read the same everywhere or\n * the eye stops using the icon as an index.\n *\n * lucide dropped brand marks, so iOS and Android borrow the nearest generic\n * pair (a handset, a robot) and a browser push a globe: what matters here is that the two platforms are\n * told apart at a glance, not that the logo is right.\n */\nexport const CHANNEL_ICON: Record<MetricChannel, LucideIcon> = {\n email: Mail,\n push_ios: Smartphone,\n push_android: Bot,\n push_web: Globe,\n slack: MessagesSquare,\n discord: MessageCircle,\n sms: MessageSquareText,\n webhook: Webhook,\n};\n\n/** Stand-in for \"every channel\": still a send, just not one transport. */\nexport const ALL_CHANNELS_ICON: LucideIcon = Send;\n\nexport const channelIcon = (channel: MetricChannel | undefined): LucideIcon =>\n channel === undefined ? ALL_CHANNELS_ICON : CHANNEL_ICON[channel];\n","import { useState } from 'react';\nimport { cn } from '../utils/cn';\n\n/**\n * A person's round portrait, with an initial on a tinted circle behind it.\n *\n * The picture comes from a profile's `properties`, a dictionary the project\n * fills — so it is typed `unknown` here and narrowed rather than asserted: an\n * absent key, a null, or a number all mean the same thing to this component,\n * which is \"draw the initial\". A URL that resolves to nothing means it too,\n * once the browser says so, so a dead image degrades to the same fallback\n * instead of leaving a broken-image glyph in the row.\n */\nexport interface AvatarProps {\n /** Straight out of `Profile.properties`; anything but a non-empty string falls back. */\n picture: unknown;\n /** Whatever names the person — a name, an email, an id. Its first letter is the fallback. */\n label: string;\n /** `md` heads the profile drawer; `sm` sits inside a table row. */\n size?: 'sm' | 'md';\n}\n\n/* Font scales with the circle: an `sm` initial at `text-sm` crowds the edges. */\nconst SIZES = {\n sm: 'size-6 text-xs',\n md: 'size-9 text-sm',\n} as const;\n\nexport function Avatar({ picture, label, size = 'md' }: AvatarProps) {\n const [failed, setFailed] = useState(false);\n const src = typeof picture === 'string' && picture !== '' ? picture : undefined;\n\n if (src !== undefined && !failed) {\n return (\n <img\n src={src}\n /* Decorative: the name or address it sits beside already says who this\n is, and a screen reader repeating it is noise. */\n alt=\"\"\n onError={() => setFailed(true)}\n className={cn('shrink-0 rounded-full object-cover', SIZES[size])}\n />\n );\n }\n\n return (\n <div\n aria-hidden\n className={cn(\n 'bg-selected text-secondary flex shrink-0 items-center justify-center rounded-full font-medium',\n SIZES[size]\n )}\n >\n {label.trim().charAt(0).toUpperCase()}\n </div>\n );\n}\n","import type { NodeIR, WorkflowIR } from '@shware/workflow';\n\n/**\n * Derive template references from IR — \"which flows use which template\" is not\n * a hand-maintained list but something computed from the middle layer. It also\n * surfaces templates that are referenced but have no content registered yet.\n */\nexport interface TemplateUsage {\n /** Name of the workflow referencing this template. */\n workflow: string;\n /** Node id (structural path), pinpointing the exact node on the canvas. */\n nodeId: string;\n /** Props passed at this site: each value is a literal or a user-property reference. */\n props: Record<string, unknown>;\n}\n\nexport interface TemplateRefInfo {\n key: string;\n channel: string;\n /** Every use site — one template can be used by several flows, each passing its own props. */\n usages: TemplateUsage[];\n}\n\nconst TEMPLATE_CHANNELS = new Set(['email', 'push', 'discord', 'slack']);\n\n/** Walk the IR node tree depth-first (branch arms, cohort arms and waitUntil timeout flows all included). */\nfunction walk(nodes: readonly NodeIR[], visit: (node: NodeIR) => void): void {\n for (const node of nodes) {\n visit(node);\n switch (node.type) {\n case 'branch':\n for (const branchCase of node.cases) walk(branchCase.flow, visit);\n if (node.otherwise) walk(node.otherwise, visit);\n break;\n case 'cohort':\n for (const arm of node.arms) walk(arm.flow, visit);\n break;\n case 'wait_until':\n if (Array.isArray(node.onTimeout)) walk(node.onTimeout, visit);\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * One entry per template — per channel and key, since one key can name an\n * email and a push, and their usages must not run together.\n */\nexport function collectTemplateRefs(irs: readonly WorkflowIR[]): TemplateRefInfo[] {\n const byKey = new Map<string, TemplateRefInfo>();\n for (const ir of irs) {\n walk(ir.flow, (node) => {\n // Only the template channels have registries; other channels' messages have nothing to preview\n if (node.type !== 'message' || !TEMPLATE_CHANNELS.has(node.channel)) return;\n const usage: TemplateUsage = { workflow: ir.id, nodeId: node.id, props: node.props };\n const id = `${node.channel}:${node.template}`;\n const found = byKey.get(id);\n if (found) {\n found.usages.push(usage);\n return;\n }\n byKey.set(id, {\n key: node.template,\n channel: node.channel,\n usages: [usage],\n });\n });\n }\n return Array.from(byKey.values()).sort(\n (a, b) => a.key.localeCompare(b.key) || a.channel.localeCompare(b.channel)\n );\n}\n\n/**\n * Every template the studio can show: each registered one — referenced or\n * not yet, so a template can be previewed before a flow uses it — plus each\n * one the IR references without registering it (shown as missing). The IR\n * only adds the use sites.\n */\nexport function collectTemplates(\n irs: readonly WorkflowIR[],\n registries: { emails?: object; pushes?: object; discords?: object; slacks?: object }\n): TemplateRefInfo[] {\n const byKey = new Map(collectTemplateRefs(irs).map((ref) => [`${ref.channel}:${ref.key}`, ref]));\n for (const [channel, registry] of [\n ['email', registries.emails],\n ['push', registries.pushes],\n ['discord', registries.discords],\n ['slack', registries.slacks],\n ] as const) {\n for (const key of Object.keys(registry ?? {})) {\n if (!byKey.has(`${channel}:${key}`))\n byKey.set(`${channel}:${key}`, { key, channel, usages: [] });\n }\n }\n return Array.from(byKey.values()).sort(\n (a, b) => a.key.localeCompare(b.key) || a.channel.localeCompare(b.channel)\n );\n}\n\n/** Find one node by its structural id, arms and timeout lanes included. */\nexport function findNode(ir: WorkflowIR, id: string): NodeIR | undefined {\n let found: NodeIR | undefined;\n walk(ir.flow, (node) => {\n if (node.id === id) found = node;\n });\n return found;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;;;;;;;ACOA,MAAa,eAAe,EAAE,aAAa,oBAAoB;;;ACQ/D,MAAMA,eAAmC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,gBAAgB;CACpB,MAAM,KACJ,2CACA,uEACA,oFACF;CACA,QAAQ,KACN,4CACA,gEACF;CACA,SAAS,KACP,6FACA,6EACF;CACA,WAAW,KACT,8EACA,8EACF;CACA,aAAa,KACX,4CACA,mCACA,8CACF;CACA,SAAS,KACP,uBACA,8DACA,8EACF;AACF;AAEA,SAAgB,OAAO,EACrB,UACA,WACA,OAAO,MACP,OACA,OAAO,UACP,UAAU,WACV,GAAG,SACK;CACR,OACE,oBAAC,UAAD;EAEQ;EACN,OAAO;GAAE,GAAG;GAAc,GAAG;EAAM;EACnC,WAAW,GACTA,aAAW,OACX,cAAc,UACd,2CACA,0EACA,oDACA,SACF;EACA,GAAI;EAEH;CACK,CAAA;AAEZ;;;;ACvCA,MAAa,YAAY;CAAE,GAAG;CAAK,GAAG;AAAG;;;;;;;AAOzC,MAAa,YAAY;CAAE,GAAG,UAAU;CAAG,GAAG;AAAG;;;;;;AAuBjD,MAAM,IAAI,UAAU;AACpB,MAAM,OAAO;AACb,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,OAAO;AAEb,SAAS,SAAS,GAAqC;CACrD,OAAO,EAAE,SAAS,SAAS,YAAY;AACzC;;AASA,MAAM,WA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K,EAAE,QAAQ,cAAc,EAAE,OAAO,CAC3E;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shware/workflow-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ShwareHQ/shware-sdk.git"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "^0.27.20",
|
|
41
41
|
"@react-email/render": "^2.1.0",
|
|
42
|
-
"@shware/workflow": "0.
|
|
42
|
+
"@shware/workflow": "0.3.0",
|
|
43
43
|
"@tailwindcss/vite": "^4.3.3",
|
|
44
44
|
"@tanstack/react-query": "^5.104.0",
|
|
45
45
|
"@tanstack/react-router": "^1.170.39",
|