@ai-matrx/design-system 0.86.364 → 0.86.365
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/CHANGELOG.md +10 -2
- package/dist/index.cjs +52 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +52 -10
- package/dist/index.js.map +1 -1
- package/dist/swipe-deck.cjs +12 -3
- package/dist/swipe-deck.cjs.map +1 -1
- package/dist/swipe-deck.css +6 -0
- package/dist/swipe-deck.d.cts +11 -0
- package/dist/swipe-deck.d.ts +11 -0
- package/dist/swipe-deck.js +12 -3
- package/dist/swipe-deck.js.map +1 -1
- package/package.json +2 -2
package/dist/swipe-deck.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/swipe-deck/index.ts","../src/swipe-deck/SwipeDeck.tsx","../src/error-box.tsx","../src/desktop/errors.ts","../src/error-sentence.ts","../src/icons.tsx","../src/swipe-deck/chrome.tsx","../src/swipe-deck/visual.ts","../src/swipe-deck/controller.ts","../src/swipe-deck/model.ts","../src/swipe-deck/gesture.ts","../src/swipe-deck/labels.ts","../src/swipe-deck/PartScreen.tsx","../src/input.tsx","../src/cn.ts","../src/field-surface.ts","../src/swipe-deck/ExpandableSwipeDeck.tsx","../src/swipe-deck/kind-value.ts","../src/swipe-deck/logic.ts"],"sourcesContent":["\"use client\";\n\n/**\n * `@ai-matrx/design-system/swipe-deck` — THE swipe deck: a full-screen deck of items a person answers\n * by swiping (right Yes! · up Sort of · left No · down Not sure, every part configurable), with\n * multi-tier parts, categories, pick-one, unlimited undo, and two modes: controlled (`items` in,\n * answers out) or bound (a `SwipeDeckBinding` persists every change). Its own entry so a host that\n * never shows a deck pays nothing. Structural CSS: `swipe-deck.css` (in `styles.css`).\n */\nexport { SwipeDeck } from \"./SwipeDeck\";\nexport type { SwipeDeckProps, SwipeDeckCopyContext, SwipeDeckCardContext } from \"./SwipeDeck\";\nexport { ExpandableSwipeDeck } from \"./ExpandableSwipeDeck\";\nexport type { ExpandableSwipeDeckProps } from \"./ExpandableSwipeDeck\";\nexport { useDeckController, UNDO_KEPT } from \"./controller\";\nexport type { SwipeDeckBinding, DeckController, DeckControllerOptions } from \"./controller\";\nexport { DEFAULT_SWIPE_DECK_LABELS } from \"./labels\";\nexport { swipeDeckFromKindValue, swipeDeckResultRows } from \"./kind-value\";\nexport { applyDeckLogic, canConnect, deckLogicGraph, logicEdgeLabel, logicProblems, newLogicEdge } from \"./logic\";\nexport type { DeckLogicCard, DeckLogicEdge, DeckLogicGraph } from \"./logic\";\nexport type { SwipeDeckKindDeck } from \"./kind-value\";\nexport type { SwipeDeckLabels } from \"./labels\";\nexport { releaseDecision, swipeThreshold, dominantDirection } from \"./gesture\";\nexport {\n DECK_DIRECTIONS,\n DEFAULT_DECK_KEY,\n DEFAULT_KEEP_ANSWER,\n EMPTY_DECK_STATE,\n KEEP_ANSWER_ID,\n answerChange,\n answerDetail,\n askedItems,\n conditionHolds,\n conditionItems,\n conditionProblems,\n dependencyOrder,\n readDeckCondition,\n answerOf,\n answersFor,\n applyOp,\n applyOps,\n chainSuggestions,\n contenders,\n currentStepIndex,\n deckCopyText,\n deckResult,\n deckState,\n deckSteps,\n directionOf,\n findAnswer,\n forgetSpan,\n invertOp,\n itemCopyText,\n keyFor,\n knownCategories,\n makeChange,\n membersOff,\n mergeKey,\n moreFor,\n partAnswer,\n partSuggestion,\n partsOf,\n partText,\n pickedItem,\n placePart,\n shownItems,\n resolveConflict,\n seedParts,\n stepDone,\n tokenize,\n} from \"./model\";\nexport type {\n CategoryConflict,\n DeckAnswer,\n DeckCategory,\n DeckCategoryRow,\n DeckChange,\n DeckCondition,\n DeckCopyLabels,\n DeckDetail,\n DeckDirection,\n DeckField,\n DeckItem,\n DeckKey,\n DeckKeyOverride,\n DeckMedia,\n DeckMember,\n DeckOp,\n DeckPart,\n DeckPartSeed,\n DeckResult,\n DeckResultEntry,\n DeckResultPart,\n DeckRules,\n DeckState,\n DeckStep,\n DeckTone,\n} from \"./model\";\n","\"use client\";\n\n/**\n * SwipeDeck — THE full-screen swipe deck: a deck of items a person answers by swiping.\n *\n * right Yes! · up Sort of · left No · down Not sure (every part configurable)\n *\n * The whole screen is the card; its text fits to the largest size the space allows. Each answer is\n * a large button on the edge it swipes toward; the corners are exit, ?, undo and copy. The moment a\n * drag starts the screen takes the answer's color and name; a flick commits too. The suggested\n * answer's button is filled and pulses and the card leans toward it. Undo is unlimited and the card\n * returns from the side it left. Items can expose parts (spans of their words), each answered on the\n * part screen (hold, or double-click); categories' answers flow down to the parts they tag.\n *\n * TWO MODES. Controlled: pass `items` and read answers back through `onAnswer` / `onChange` /\n * `onComplete`. Bound: pass a `binding` (see `controller.ts`) and the deck persists every change\n * through it, optimistically, showing the connection's own refusal sentence inline.\n *\n * Structural CSS: `swipe-deck.css` (imported by `styles.css`); colors are design-system tokens.\n */\nimport * as React from \"react\";\n\nimport { copyText as copyToClipboard } from \"@ai-matrx/kit/clipboard\";\n\nimport { ErrorBox } from \"../error-box\";\nimport { CheckIcon, CircleHelpIcon, CopyIcon, ListChecksIcon, Loader2Icon, Maximize2Icon, Minimize2Icon, PencilIcon, Undo2Icon, XIcon } from \"../icons\";\nimport { AnswerGlyph, CornerButton, EdgeButtons, setHot, Wash, type EdgeRefs, type WashHandle } from \"./chrome\";\nimport { useDeckController, type DeckController, type SwipeDeckBinding } from \"./controller\";\nimport { attachSwipe } from \"./gesture\";\nimport { DEFAULT_SWIPE_DECK_LABELS, type SwipeDeckLabels } from \"./labels\";\nimport {\n DECK_DIRECTIONS,\n DEFAULT_DECK_KEY,\n DEFAULT_KEEP_ANSWER,\n answerChange,\n answerDetail,\n answerOf,\n applyOps,\n findAnswer,\n membersOff,\n moreFor,\n currentStepIndex,\n deckCopyText,\n deckResult,\n deckSteps,\n directionOf,\n forgetSpan,\n itemCopyText,\n keyFor,\n knownCategories,\n makeChange,\n mergeKey,\n partAnswer,\n partsOf,\n partText,\n placePart,\n tokenize,\n type CategoryConflict,\n type DeckCategoryRow,\n type DeckAnswer,\n type DeckChange,\n type DeckDetail,\n type DeckDirection,\n type DeckOp,\n type DeckItem,\n type DeckMedia,\n type DeckKey,\n type DeckKeyOverride,\n type DeckPart,\n type DeckResult,\n type DeckRules,\n type DeckState,\n type DeckStep,\n type DeckTone,\n} from \"./model\";\nimport { PartScreen } from \"./PartScreen\";\nimport { VECTOR, buzz, enter, finePointer, fitText, flyOut, follow, heroMax, keepFitted, nudge, prefersReducedMotion, snapBack } from \"./visual\";\n\nexport interface SwipeDeckCopyContext {\n readonly item: DeckItem | null;\n readonly state: DeckState;\n readonly result: DeckResult;\n}\n\n/** What a card's own slots (`renderCardBody`, `renderCardActions`) can do. */\nexport interface SwipeDeckCardContext {\n readonly item: DeckItem;\n /** What will ride with this card's answer: the members switched off, a value typed on the card. */\n readonly detail: DeckDetail | null;\n /** Replace what rides with this card's next answer (any route: swipe, edge, key, button). */\n setDetail(detail: DeckDetail | null): void;\n /** Answer the card now, by answer id (on an edge or off it), optionally with what rides along. */\n answer(answerId: string, detail?: DeckDetail | null): void;\n /** While locked (a field being typed in), the card never swipes and the arrows and shortcuts do nothing. */\n lock(locked: boolean): void;\n}\n\nexport interface SwipeDeckProps {\n /** Controlled mode: the items. Ignored when `binding` is given (the binding brings its items). */\n readonly items?: readonly DeckItem[];\n /** Bound mode: the connection the deck persists through. */\n readonly binding?: SwipeDeckBinding;\n /** The deck's key, over the default (Yes! / Sort of / No / Not sure); `null` turns an edge off. */\n readonly answers?: DeckKeyOverride;\n /** Answers off the edges, offered on every card as a row of buttons (an item's own `more` replaces them). */\n readonly more?: readonly DeckAnswer[];\n /** Drawn on the card under its text: the host's own controls (a field to correct a value, a person's name). */\n readonly renderCardBody?: (context: SwipeDeckCardContext) => React.ReactNode;\n /** Drawn in the card's top row, at the end: small actions (open the source, see where it was found). */\n readonly renderCardActions?: (context: SwipeDeckCardContext) => React.ReactNode;\n /** The part screen's key, over the deck's (its down edge defaults to Keep as is). */\n readonly partAnswers?: DeckKeyOverride;\n /** The category rows offered on the part screen. */\n readonly categories?: readonly string[];\n /** Labelled chip rows on the part screen (\"Who\", \"Cares about\"), each with its own \"+\"; a category added there carries the row's id on its op. */\n readonly categoryRows?: readonly DeckCategoryRow[];\n /** When two categories' answers disagree on a part. Default: the worse answer wins. */\n readonly categoryConflict?: CategoryConflict;\n readonly allowNewCategories?: boolean;\n /** Turn the part screen off (parts still show and tap). */\n readonly editParts?: boolean;\n /** Groups that end in a pick-one screen (`true` = every group). */\n readonly pickOne?: boolean | readonly string[];\n /** The answer that makes an item a contender for its group's pick (default: the right edge's). */\n readonly pickAnswer?: string;\n /** What each group is called on its pick screen and at the end. */\n readonly groupLabels?: Readonly<Record<string, string>>;\n /** Controlled mode: answers, picks, parts and categories to start from. */\n readonly initialState?: Partial<DeckState>;\n readonly labels?: Partial<SwipeDeckLabels>;\n readonly onAnswer?: (item: DeckItem, answer: DeckAnswer, state: DeckState) => void;\n /** Every change, undo included (`undo` true), with the state after it. */\n readonly onChange?: (state: DeckState, change: DeckChange, undo: boolean) => void;\n /** The person reached the end; `result` holds every answer, pick, part and category. */\n readonly onComplete?: (result: DeckResult) => void;\n /** The exit corner; omitted, the corner is empty (or holds Full screen when `onExpand` is given). */\n readonly onExit?: () => void;\n /** What the exit corner means: `close` (an X) or `collapse` (leave full screen). */\n readonly exitKind?: \"close\" | \"collapse\";\n /** The full-screen corner (top left), for a deck drawn inline: open this deck full screen. */\n readonly onExpand?: () => void;\n /** Share another deck's controller (state AND undo), e.g. the inline and full-screen views of one deck. */\n readonly controller?: DeckController;\n /** Show each item's choices on the card, by their direction (a quiz). Default: when the item has its own answers. */\n readonly choicesOnCard?: boolean | \"auto\";\n /** The copy corner's text (default: the item, or the whole deck at a pick or the end). */\n readonly copyText?: (context: SwipeDeckCopyContext) => string;\n /** Where \"the walkthrough already played\" is remembered; `null` never plays it on its own. */\n readonly tourKey?: string | null;\n /** Arrows, Z (undo) and ? (default on). */\n readonly keyboard?: boolean;\n /**\n * `fullscreen` covers the viewport; `fill` fills the nearest positioned parent; `inline` is a box in\n * the flow (a chat message): its height is `--sd-inline-height`, and its keys answer only while it\n * holds focus or the pointer.\n */\n readonly layout?: \"fullscreen\" | \"fill\" | \"inline\";\n readonly renderEnd?: (result: DeckResult) => React.ReactNode;\n /** The host's own buttons on the finish screen (back to the page, the next step). */\n readonly endActions?: React.ReactNode;\n /** The screen when there is nothing to answer: its words and the host's way on. */\n readonly empty?: { readonly title?: string; readonly line?: string; readonly action?: React.ReactNode };\n readonly className?: string;\n}\n\nconst KEYS: Readonly<Record<string, DeckDirection>> = { ArrowRight: \"right\", ArrowLeft: \"left\", ArrowUp: \"up\", ArrowDown: \"down\" };\nconst DEFAULT_TOUR_KEY = \"matrx.swipe-deck.tour\";\n\nfunction readFlag(key: string): boolean {\n try {\n return globalThis.localStorage?.getItem(key) === \"1\";\n } catch {\n return false;\n }\n}\nfunction writeFlag(key: string): void {\n try {\n globalThis.localStorage?.setItem(key, \"1\");\n } catch {\n /* storage blocked: the walkthrough may play again next visit */\n }\n}\n\nfunction wait(ms: number): Promise<void> {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nexport function SwipeDeck(props: SwipeDeckProps) {\n const labels = React.useMemo<SwipeDeckLabels>(() => ({ ...DEFAULT_SWIPE_DECK_LABELS, ...props.labels }), [props.labels]);\n const deckKey = React.useMemo(() => mergeKey(DEFAULT_DECK_KEY, props.answers), [props.answers]);\n const partKeyBase = React.useMemo(() => mergeKey({ ...deckKey, down: DEFAULT_KEEP_ANSWER }, props.partAnswers), [deckKey, props.partAnswers]);\n const rules = React.useMemo<DeckRules>(\n () => ({\n key: deckKey,\n ...(props.pickOne !== undefined ? { pickOne: props.pickOne } : {}),\n ...(props.pickAnswer ? { pickAnswer: props.pickAnswer } : {}),\n ...(props.more ? { more: props.more } : {}),\n }),\n [deckKey, props.pickOne, props.pickAnswer, props.more],\n );\n const conflict = props.categoryConflict;\n const own = useDeckController({ items: props.items, binding: props.binding, initialState: props.initialState, onChange: props.onChange });\n const controller = props.controller ?? own;\n const layout = props.layout ?? \"fullscreen\";\n const { items, state } = controller;\n const steps = React.useMemo(() => deckSteps(items, state, rules), [items, state, rules]);\n const stepIndex = currentStepIndex(steps, state);\n const step: DeckStep = steps[stepIndex] ?? { kind: \"end\", id: \"end\" };\n const ready = controller.status === \"ready\";\n const stateRef = React.useRef(state);\n stateRef.current = state;\n // Timers (pick, walkthrough, lean) never act on a deck that has closed.\n const alive = React.useRef(true);\n React.useEffect(() => {\n alive.current = true;\n return () => {\n alive.current = false;\n };\n }, []);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n /** Set when the deck itself moved to the next card (an answer here), so only that card change takes focus back. */\n const answeredHere = React.useRef(false);\n const frameRef = React.useRef<HTMLDivElement>(null);\n const layerRef = React.useRef<HTMLDivElement | null>(null);\n const edgeRefs = React.useRef<EdgeRefs>({});\n const wash = React.useRef<WashHandle>(null);\n const busy = React.useRef(false);\n const enterFrom = React.useRef<DeckDirection | \"stay\" | null>(null);\n const nudgeAnim = React.useRef<Animation | null>(null);\n const [touring, setTouring] = React.useState(false);\n const touringRef = React.useRef(false);\n const tourStop = React.useRef(false);\n const [part, setPart] = React.useState<{ itemId: string; start: number; end: number } | null>(null);\n const [bubble, setBubble] = React.useState<{ text: string; x: number; top: number; bottom: number } | null>(null);\n const [toast, setToast] = React.useState<string | null>(null);\n const [said, setSaid] = React.useState(\"\");\n\n // THE ANSWERED LIST, mid-deck: every answer so far, each one tap from changing it (the finish screen's list,\n // reachable at any point). While it is open the card does not take answers.\n const [reviewing, setReviewing] = React.useState(false);\n const reviewingRef = React.useRef(false);\n reviewingRef.current = reviewing;\n const cardItem = step.kind === \"card\" && !reviewing ? step.item : null;\n const cardKey = cardItem ? keyFor(rules, cardItem) : deckKey;\n const cardMore = React.useMemo(() => (cardItem ? moreFor(rules, cardItem) : []), [cardItem, rules]);\n // The buttons drawn under the card: a hidden answer is reached only through the card's own controls.\n const cardMoreShown = React.useMemo(() => cardMore.filter((a) => !a.hidden), [cardMore]);\n const suggestedDir = cardItem ? directionOf(cardKey, cardItem.suggested) : null;\n // What rides with the card in front's answer, set by its members and its own slots; starts from what was saved.\n const [cardDetail, setCardDetail] = React.useState<{ id: string; detail: DeckDetail | null } | null>(null);\n const detailNow = cardItem ? (cardDetail?.id === cardItem.id ? cardDetail.detail : (state.details?.[cardItem.id] ?? null)) : null;\n const detailRef = React.useRef(detailNow);\n detailRef.current = detailNow;\n const [locked, setLocked] = React.useState<string | null>(null);\n const lockedNow = !!cardItem && locked === cardItem.id;\n const lockedRef = React.useRef(lockedNow);\n lockedRef.current = lockedNow;\n\n const stopNudge = () => {\n try {\n nudgeAnim.current?.cancel();\n } catch {\n /* already finished */\n }\n nudgeAnim.current = null;\n };\n\n const flash = React.useCallback((text: string) => setToast(text), []);\n React.useEffect(() => {\n if (!toast) return;\n const t = setTimeout(() => setToast(null), 1400);\n return () => clearTimeout(t);\n }, [toast]);\n React.useEffect(() => {\n if (!bubble) return;\n const t = setTimeout(() => setBubble(null), 2200);\n return () => clearTimeout(t);\n }, [bubble]);\n\n // ─── answering ───────────────────────────────────────────────────────────\n const act = (dir: DeckDirection, speed = 0) => {\n const answer = cardKey[dir];\n if (answer) void give(answer, dir, speed);\n };\n /** Answer the card in front: by an edge (`dir`) or off the edges (`dir` null: it drops away). */\n const give = async (answer: DeckAnswer, dir: DeckDirection | null, speed = 0, detail?: DeckDetail | null) => {\n if (!cardItem || busy.current || touringRef.current || part) return;\n busy.current = true;\n stopNudge();\n setBubble(null);\n wash.current?.show(answer, dir, 1);\n setHot(edgeRefs.current, dir);\n buzz(globalThis.navigator, 8);\n await flyOut(layerRef.current, dir ?? \"down\", speed);\n const now = stateRef.current;\n const rides = answerDetail(cardItem, detail === undefined ? detailRef.current : detail);\n const made = answerChange(now, cardItem, answer.id, rules, items, dir, rides);\n // \"Skip for now\": the connection sends the card to the back of the line and keeps no answer.\n const change = answer.requeue && props.binding ? { ...made, transient: true } : made;\n enterFrom.current = null;\n setCardDetail(null);\n setLocked(null);\n answeredHere.current = true;\n controller.commit(change);\n busy.current = false;\n setHot(edgeRefs.current, null);\n wash.current?.hide();\n const after = applyOps(now, change.ops);\n props.onAnswer?.(cardItem, answer, after);\n const nextSteps = deckSteps(items, after, rules);\n const next = nextSteps[currentStepIndex(nextSteps, after)];\n setSaid(`${answer.label}.${next && next.kind === \"card\" ? ` ${labels.next}: ${next.item.text}` : \"\"}`);\n };\n const actRef = React.useRef(act);\n actRef.current = act;\n const giveRef = React.useRef(give);\n giveRef.current = give;\n\n const cardContext = React.useMemo<SwipeDeckCardContext | null>(\n () =>\n cardItem\n ? {\n item: cardItem,\n detail: detailNow,\n setDetail: (detail) => setCardDetail({ id: cardItem.id, detail }),\n answer: (answerId, detail) => {\n const a = findAnswer(rules, cardItem, answerId);\n if (a) void giveRef.current(a, directionOf(cardKey, answerId), 0, detail);\n },\n lock: (on) => setLocked(on ? cardItem.id : null),\n }\n : null,\n [cardItem, detailNow, rules, cardKey],\n );\n\n const undo = () => {\n if (busy.current || touringRef.current) return;\n if (part) setPart(null);\n setCardDetail(null);\n setLocked(null);\n const change = controller.undo();\n if (!change) return;\n enterFrom.current = change.from ?? \"stay\";\n // The card comes back as she left it: what rode with the answer (her switches, a typed value) is on it again.\n const answered = change.ops.find((o): o is Extract<DeckOp, { kind: \"answer\" }> => o.kind === \"answer\" && !!o.detail);\n if (answered?.detail) setCardDetail({ id: answered.itemId, detail: answered.detail });\n const touched = change.ops.find((o) => o.kind === \"answer\" || o.kind === \"parts\");\n const item = touched && \"itemId\" in touched ? items.find((i) => i.id === touched.itemId) : undefined;\n setSaid(`${labels.undone}.${item ? ` ${item.text}` : \"\"}`);\n };\n const undoRef = React.useRef(undo);\n undoRef.current = undo;\n\n const pick = (group: string, item: DeckItem) => {\n if (busy.current) return;\n busy.current = true;\n setTimeout(\n () => {\n busy.current = false;\n if (!alive.current) return;\n enterFrom.current = null;\n controller.commit(makeChange(stateRef.current, [{ kind: \"pick\", group, itemId: item.id }], items));\n setSaid(`${props.groupLabels?.[group] ?? group}: ${item.text}`);\n },\n prefersReducedMotion() ? 0 : 260,\n );\n };\n\n // ─── parts ───────────────────────────────────────────────────────────────\n const openPart = (item: DeckItem, index: number) => {\n if (props.editParts === false || busy.current || touringRef.current) return;\n stopNudge();\n setBubble(null);\n if (layerRef.current) snapBack(layerRef.current);\n wash.current?.hide();\n setPart({ itemId: item.id, start: index, end: index });\n };\n const openPartRef = React.useRef(openPart);\n openPartRef.current = openPart;\n\n const partItem = part ? (items.find((i) => i.id === part.itemId) ?? null) : null;\n const partKey = React.useMemo(\n () => (partItem ? mergeKey({ ...keyFor(rules, partItem), down: DEFAULT_KEEP_ANSWER }, props.partAnswers) : partKeyBase),\n [partItem, rules, props.partAnswers, partKeyBase],\n );\n const allCategories = React.useMemo(() => knownCategories(props.categories ?? [], items, state), [props.categories, items, state]);\n\n const placeOnItem = (item: DeckItem, next: DeckPart) => {\n enterFrom.current = \"stay\";\n const now = stateRef.current;\n controller.commit(makeChange(now, [{ kind: \"parts\", itemId: item.id, parts: placePart(partsOf(now, item), next) }], items));\n };\n const forgetOnItem = (item: DeckItem, span: { start: number; end: number }) => {\n enterFrom.current = \"stay\";\n const now = stateRef.current;\n controller.commit(makeChange(now, [{ kind: \"parts\", itemId: item.id, parts: forgetSpan(partsOf(now, item), span) }], items));\n flash(labels.forgotten);\n };\n\n // ─── the swipe on the card ───────────────────────────────────────────────\n // Set from the first move of a press until the next press: a press that dragged is never a choice's tap.\n const dragged = React.useRef(false);\n const live = React.useRef({ cardKey, enabled: false });\n live.current = { cardKey, enabled: !!cardItem && !part && !touring && !lockedNow };\n\n React.useEffect(() => {\n const root = frameRef.current;\n if (!root) return;\n return attachSwipe(root, {\n enabled: () => live.current.enabled && !busy.current && !touringRef.current,\n directions: () => live.current.cardKey,\n start: () => {\n dragged.current = false;\n stopNudge();\n setBubble(null);\n },\n move: (dx, dy, dir, amount) => {\n dragged.current = true;\n const answer = dir ? live.current.cardKey[dir] : undefined;\n follow(layerRef.current, dx, dy, dir && answer ? amount : 0);\n if (dir && answer) {\n wash.current?.show(answer, dir, amount);\n setHot(edgeRefs.current, amount >= 1 ? dir : null);\n } else {\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n }\n },\n release: () => {\n snapBack(layerRef.current);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n },\n commit: (dir, speed) => actRef.current(dir, speed),\n tap: (target) => {\n const span = target.closest<HTMLElement>(\"[data-sd-part]\");\n if (!span) {\n setBubble(null);\n return;\n }\n const r = span.getBoundingClientRect();\n setBubble({ text: span.getAttribute(\"data-sd-part-label\") ?? \"\", x: r.left + r.width / 2, top: r.top, bottom: r.bottom });\n },\n hold: (target) => {\n const i = Number(target.getAttribute(\"data-sd-t\"));\n const item = itemsRef.current.find((x) => x.id === target.closest(\"[data-sd-item]\")?.getAttribute(\"data-sd-item\"));\n if (item && Number.isFinite(i)) openPartRef.current(item, i);\n },\n holdSelector: \"[data-sd-t]\",\n // A swipe may start on a choice (it fills much of a quiz card); other buttons never swipe.\n ignoreSelector: \"button:not([data-sd-choice]), a, input, textarea, [data-sd-noswipe]\",\n });\n }, []);\n const itemsRef = React.useRef(items);\n itemsRef.current = items;\n\n // ─── keyboard ────────────────────────────────────────────────────────────\n const keyboard = props.keyboard !== false;\n // A key pressed during the walkthrough, done once it has stopped.\n const afterTour = React.useRef<string | null>(null);\n /** What a key does on the deck; true when it did something (its default is then prevented). */\n const runKeyRef = React.useRef<(key: string, target: Element | null) => boolean>(() => false);\n runKeyRef.current = (key, target) => {\n if (reviewingRef.current) {\n if (key === \"Escape\") {\n setReviewing(false);\n return true;\n }\n if (key !== \"z\" && key !== \"Z\" && key !== \"Backspace\") return false;\n }\n const dir = KEYS[key];\n const shortcut = !dir && key.length === 1 ? shortcutRef.current(key) : null;\n if ((dir || shortcut) && lockedRef.current) return false;\n if (dir) {\n actRef.current(dir);\n return true;\n }\n if (shortcut) {\n void giveRef.current(shortcut.answer, shortcut.dir);\n return true;\n }\n if (key === \"z\" || key === \"Z\" || key === \"Backspace\") {\n undoRef.current();\n return true;\n }\n if (key === \"?\") {\n void tourRef.current();\n return true;\n }\n if (key === \"Escape\" && exitRef.current.kind === \"collapse\" && exitRef.current.onExit) {\n exitRef.current.onExit();\n return true;\n }\n // Enter on the card (not on one of its buttons) opens the part screen on its first marked words, or its first word.\n if (key === \"Enter\" && !target?.closest(\"button, a, [role='button']\") && cardItemRef.current && props.editParts !== false) {\n const item = cardItemRef.current;\n const first = partsOf(stateRef.current, item)[0];\n openPartRef.current(item, first ? first.start : 0);\n return true;\n }\n return false;\n };\n const cardItemRef = React.useRef(cardItem);\n cardItemRef.current = cardItem;\n // An answer's own key (\"Y\", \"3\"), on an edge or off it; it outranks Z and ? when an answer claims them.\n const shortcutRef = React.useRef<(key: string) => { answer: DeckAnswer; dir: DeckDirection | null } | null>(() => null);\n shortcutRef.current = (key) => {\n if (!cardItem || part) return null;\n const k = key.toLowerCase();\n for (const d of DECK_DIRECTIONS) {\n const a = cardKey[d];\n if (a?.shortcut?.toLowerCase() === k) return { answer: a, dir: d };\n }\n const a = cardMoreShown.find((x) => x.shortcut?.toLowerCase() === k);\n return a ? { answer: a, dir: null } : null;\n };\n const exitRef = React.useRef({ kind: props.exitKind, onExit: props.onExit });\n exitRef.current = { kind: props.exitKind, onExit: props.onExit };\n React.useEffect(() => {\n if (!keyboard) return;\n const view = rootRef.current?.ownerDocument.defaultView ?? window;\n const onKey = (e: KeyboardEvent) => {\n const root = rootRef.current;\n const doc = root?.ownerDocument;\n const active = doc?.activeElement;\n if (active && active !== doc.body && !root?.contains(active)) return;\n // An inline deck (one of many things on a page) answers only while it holds focus or the pointer.\n if (layout === \"inline\" && !(root && (root.contains(active ?? null) || root.matches(\":hover\")))) return;\n const t = e.target instanceof Element ? e.target : null;\n if (t?.closest(\"input, textarea, select, [contenteditable='true']\")) return;\n // Cmd+Z / Ctrl+Z is undo here too (a field's own undo keeps it: fields returned above).\n if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === \"z\" || e.key === \"Z\") && !e.repeat) {\n e.preventDefault();\n undoRef.current();\n return;\n }\n // A held key answers one card, never several; a key with Alt, Ctrl or Cmd belongs to the browser or the host.\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.repeat) {\n if (KEYS[e.key] || e.key === \"z\" || e.key === \"Z\" || e.key === \"Backspace\") e.preventDefault();\n return;\n }\n if (touringRef.current) {\n // A key during the walkthrough ends it AND does what it says: the first answer is never lost.\n tourStop.current = true;\n if (KEYS[e.key] || e.key === \"z\" || e.key === \"Z\" || e.key === \"Backspace\") {\n e.preventDefault();\n afterTour.current = e.key;\n }\n return;\n }\n if (runKeyRef.current(e.key, t)) e.preventDefault();\n };\n view.addEventListener(\"keydown\", onKey);\n return () => view.removeEventListener(\"keydown\", onKey);\n }, [keyboard, layout]);\n\n // The keys stay with the deck after every answer (P5, pool 2026-10-24: after some cards the arrows did nothing until\n // the page was clicked). An answer can leave focus on a control OUTSIDE the deck (a menu's or hover card's portal, a\n // host control that re-rendered, a toast), and the key handler ignores keys whose focus is elsewhere. So when the card\n // changes, a full deck (not inline: one of many things on a page) takes focus back — never from a field being typed\n // in, an open dialog or menu. REVIEW9 M-5: a card change the HOST made (items arriving, re-sorting) never takes focus\n // from a button or link the person is on — only nothing focused (the page itself) is taken then; and a deck that sits\n // inside a dialog takes it back within that dialog.\n const cardId = cardItem?.id ?? null;\n React.useEffect(() => {\n const fromAnswer = answeredHere.current;\n answeredHere.current = false;\n if (!keyboard || layout === \"inline\" || cardId === null) return;\n const root = rootRef.current;\n const doc = root?.ownerDocument;\n const active = doc?.activeElement ?? null;\n if (!root || (active && root.contains(active))) return;\n const idle = !active || active === doc?.body || active === doc?.documentElement;\n if (!idle && !fromAnswer) return;\n if (active?.closest(\"input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='combobox'], [role='textbox'], [role='menu'], [role='listbox']\")) return;\n const dialog = active?.closest(\"[role='dialog'], [role='alertdialog'], dialog\");\n if (dialog && !dialog.contains(root)) return;\n root.focus({ preventScroll: true });\n }, [cardId, keyboard, layout]);\n\n // ─── the walkthrough (?) ─────────────────────────────────────────────────\n const fingerRef = React.useRef<HTMLDivElement>(null);\n const ringRef = React.useRef<HTMLDivElement>(null);\n const capRef = React.useRef<HTMLDivElement>(null);\n const tour = async () => {\n const layer = layerRef.current;\n const stage = layer?.parentElement;\n const F = fingerRef.current;\n if (touringRef.current || !cardItem || busy.current || part || !layer || !stage || !F) return;\n touringRef.current = true;\n tourStop.current = false;\n setTouring(true);\n stopNudge();\n setBubble(null);\n const reduced = prefersReducedMotion();\n const tween = (ms: number, f: (p: number) => void) =>\n new Promise<void>((res) => {\n const t0 = performance.now();\n const frame = (t: number) => {\n if (tourStop.current) return res();\n const p = Math.min(1, (t - t0) / ms);\n f(p);\n if (p < 1) requestAnimationFrame(frame);\n else res();\n };\n requestAnimationFrame(frame);\n });\n const ease = (p: number) => (p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2);\n const place = (el: HTMLElement | null, x: number, y: number) => {\n if (!el) return;\n el.style.left = `${x}px`;\n el.style.top = `${y}px`;\n };\n const r = stage.getBoundingClientRect();\n const cx = r.left + r.width / 2;\n const cy = r.top + r.height / 2;\n const dist = Math.min(r.width, r.height) * 0.34;\n place(F, cx, cy);\n F.style.opacity = \"1\";\n const key = cardKey;\n const order = [...(suggestedDir ? [suggestedDir] : []), ...DECK_DIRECTIONS.filter((d) => d !== suggestedDir)];\n for (const dir of order) {\n if (tourStop.current) break;\n const answer = key[dir];\n if (!answer) continue;\n const [vx, vy] = VECTOR[dir];\n F.setAttribute(\"data-down\", \"\");\n await tween(reduced ? 1 : 620, (p) => {\n const e = ease(p);\n place(F, cx + vx * dist * e, cy + vy * dist * e);\n follow(layer, vx * dist * e, vy * dist * e, e * 1.05);\n wash.current?.show(answer, dir, e * 1.05);\n setHot(edgeRefs.current, p > 0.8 ? dir : null);\n });\n await wait(tourStop.current ? 0 : 420);\n await tween(reduced ? 1 : 240, (p) => {\n const e = 1 - p;\n place(F, cx + vx * dist * e, cy + vy * dist * e);\n follow(layer, vx * dist * e, vy * dist * e, e);\n wash.current?.show(answer, dir, e);\n });\n F.removeAttribute(\"data-down\");\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n follow(layer, 0, 0);\n await wait(tourStop.current ? 0 : 140);\n }\n const word = layer.querySelector<HTMLElement>(\"[data-sd-part] [data-sd-t]\") ?? layer.querySelector<HTMLElement>(\"[data-sd-t]\");\n if (!tourStop.current && word && props.editParts !== false) {\n const wr = word.getBoundingClientRect();\n const tx = wr.left + wr.width / 2;\n const ty = wr.top + wr.height / 2;\n await tween(reduced ? 1 : 420, (p) => {\n const e = ease(p);\n place(F, cx + (tx - cx) * e, cy + (ty - cy) * e);\n });\n const cap = capRef.current;\n if (cap) {\n cap.textContent = finePointer() ? labels.clickHint : labels.holdHint;\n const vw = cap.ownerDocument.defaultView?.innerWidth ?? 0;\n place(cap, Math.max(cap.offsetWidth / 2 + 12, Math.min(tx, vw - cap.offsetWidth / 2 - 12)), ty - 40);\n cap.style.opacity = \"1\";\n }\n F.setAttribute(\"data-down\", \"\");\n word.setAttribute(\"data-sd-press\", \"\");\n place(ringRef.current, tx, ty);\n if (!reduced) ringRef.current?.animate([{ opacity: 1, transform: \"scale(.6)\" }, { opacity: 0, transform: \"scale(1.9)\" }], { duration: 900, iterations: 2 });\n await wait(tourStop.current ? 0 : 1700);\n word.removeAttribute(\"data-sd-press\");\n F.removeAttribute(\"data-down\");\n if (cap) cap.style.opacity = \"0\";\n }\n F.style.opacity = \"0\";\n follow(layer, 0, 0);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n touringRef.current = false;\n setTouring(false);\n const pending = afterTour.current;\n afterTour.current = null;\n if (pending && alive.current) runKeyRef.current(pending, null);\n };\n const tourRef = React.useRef(tour);\n tourRef.current = tour;\n\n // ─── card arrival: enter, lean toward the suggestion, first-use walkthrough ─\n const tourKey = props.tourKey === undefined ? DEFAULT_TOUR_KEY : props.tourKey;\n const onCardMounted = React.useCallback(\n (layer: HTMLDivElement, dir: DeckDirection | null) => {\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer, from);\n if (tourKey && !readFlag(tourKey)) {\n writeFlag(tourKey);\n setTimeout(() => {\n if (alive.current && layerRef.current === layer) void tourRef.current();\n }, 700);\n return;\n }\n if (from === null && dir) {\n setTimeout(() => {\n if (!alive.current || layerRef.current !== layer || busy.current || touringRef.current) return;\n nudgeAnim.current = nudge(layer, dir);\n }, 420);\n }\n },\n [tourKey],\n );\n\n // ─── reaching the end ────────────────────────────────────────────────────\n const result = React.useMemo(() => deckResult(items, state, rules, conflict), [items, state, rules, conflict]);\n const atEnd = ready && items.length > 0 && step.kind === \"end\";\n const wasAtEnd = React.useRef(false);\n const onComplete = props.onComplete;\n React.useEffect(() => {\n if (atEnd && !wasAtEnd.current) {\n onComplete?.(result);\n // Arriving at the finish is said, as every answer is.\n setSaid(\n `${result.score ? `${labels.score}: ${result.score.right} / ${result.score.graded}` : labels.allDone}. ${labels.answeredOf.replace(\"{answered}\", String(result.answered)).replace(\"{total}\", String(result.total))}`,\n );\n }\n wasAtEnd.current = atEnd;\n }, [atEnd, result, onComplete, labels]);\n\n // ─── copy ────────────────────────────────────────────────────────────────\n const copy = async () => {\n const text = props.copyText\n ? props.copyText({ item: cardItem, state, result })\n : cardItem\n ? itemCopyText(cardItem, state, cardKey, labels, conflict, cardMoreShown)\n : deckCopyText(result, rules);\n const ok = await copyToClipboard(text);\n flash(ok ? labels.copied : labels.copyFailed);\n };\n\n // Drop the bubble's measured position into the viewport.\n const bubbleRef = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n const b = bubbleRef.current;\n if (!b || !bubble) return;\n const vw = b.ownerDocument.defaultView?.innerWidth ?? 0;\n const w = b.offsetWidth;\n const h = b.offsetHeight;\n b.style.left = `${Math.max(12, Math.min(bubble.x - w / 2, vw - w - 12))}px`;\n b.style.top = `${bubble.top - h - 10 < 8 ? bubble.bottom + 10 : bubble.top - h - 10}px`;\n }, [bubble]);\n\n const progress = steps.filter((s) => s.kind !== \"end\");\n\n return (\n <div\n ref={rootRef}\n className={[\"matrx-sd\", props.className].filter(Boolean).join(\" \")}\n data-layout={layout}\n data-touring={touring ? \"\" : undefined}\n {...(layout === \"inline\"\n ? {\n tabIndex: 0,\n role: \"group\",\n \"aria-roledescription\": \"swipe deck\",\n onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => {\n // Pressing the deck gives it the keys (it is one of many things in a chat).\n const root = e.currentTarget;\n if (!root.contains(root.ownerDocument.activeElement)) root.focus({ preventScroll: true });\n },\n }\n : { tabIndex: -1 })}\n >\n <div className=\"matrx-sd-progress\" aria-hidden=\"true\">\n {progress.map((s, k) => {\n const tone =\n k === stepIndex\n ? \"current\"\n : s.kind === \"card\"\n ? findAnswer(rules, s.item, state.answers[s.item.id])?.tone\n : s.kind === \"pick\" && state.picks[s.group]\n ? \"primary\"\n : undefined;\n return <i key={s.id} data-tone={tone} />;\n })}\n </div>\n\n <div\n ref={frameRef}\n className=\"matrx-sd-frame\"\n data-axis={!cardKey.up && !cardKey.down ? \"x\" : undefined}\n aria-hidden={part ? true : undefined}\n inert={part ? true : undefined}\n onPointerDownCapture={(e) => {\n // A press on the card away from the host's own controls (their field gone or left) ends a lock.\n if (!lockedRef.current) return;\n const inBody = (n: EventTarget | Element | null) => n instanceof Element && !!n.closest(\".matrx-sd-body\");\n if (inBody(e.target) || inBody(e.currentTarget.ownerDocument.activeElement)) return;\n lockedRef.current = false;\n live.current = { ...live.current, enabled: !!cardItem && !part && !touring };\n setLocked(null);\n }}\n >\n {props.onExpand ? (\n <CornerButton corner=\"tl\" label={labels.expand} onClick={props.onExpand}>\n <Maximize2Icon />\n </CornerButton>\n ) : props.onExit ? (\n <CornerButton corner=\"tl\" label={props.exitKind === \"collapse\" ? labels.collapse : labels.exit} {...(props.exitKind === \"collapse\" ? { shortcut: \"Escape\" } : {})} onClick={props.onExit}>\n {props.exitKind === \"collapse\" ? <Minimize2Icon /> : <XIcon />}\n </CornerButton>\n ) : null}\n <CornerButton corner=\"tr\" label={labels.answered} onClick={() => setReviewing((v) => !v)} disabled={!ready || !items.length || step.kind === \"end\"} pressed={reviewing}>\n <ListChecksIcon />\n {result.answered ? <span className=\"matrx-sd-corner-count\">{result.answered}</span> : null}\n </CornerButton>\n <CornerButton corner=\"bl\" label={labels.undo} shortcut=\"Z\" onClick={undo} disabled={!controller.canUndo}>\n <Undo2Icon />\n </CornerButton>\n <CornerButton corner=\"br\" label={labels.copy} onClick={() => void copy()} disabled={!ready || !items.length}>\n <CopyIcon />\n </CornerButton>\n\n {cardItem ? (\n <EdgeButtons keyMap={cardKey} suggested={suggestedDir} refs={edgeRefs} onAnswer={(d) => act(d)} suggestionLabel={labels.suggestion} />\n ) : null}\n\n <div className=\"matrx-sd-stage\">\n {!ready ? (\n <div className=\"matrx-sd-layer\" data-state={controller.status}>\n {controller.status === \"error\" ? (\n <ErrorBox className=\"matrx-sd-message\" message={controller.readError ?? \"\"} operation=\"Read the deck\" origin=\"design-system/SwipeDeck\" />\n ) : (\n <Loader2Icon className=\"matrx-spin matrx-sd-spinner\" />\n )}\n </div>\n ) : items.length === 0 ? (\n <EmptyView key=\"empty\" title={props.empty?.title ?? labels.emptyTitle} line={props.empty?.line} action={props.empty?.action} layerRef={layerRef} />\n ) : reviewing && step.kind !== \"end\" ? (\n <EndView\n key=\"review\"\n result={result}\n rules={rules}\n labels={labels}\n groupLabels={props.groupLabels}\n layerRef={layerRef}\n enterFrom={enterFrom}\n review={{\n onBack: () => setReviewing(false),\n onHelp: () => {\n setReviewing(false);\n void tour();\n },\n }}\n onChange={(item) => {\n enterFrom.current = null;\n const now = stateRef.current;\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: null }];\n if (item.group && now.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n controller.commit(makeChange(now, ops, items));\n setReviewing(false);\n setSaid(`${labels.change}: ${item.text}`);\n }}\n />\n ) : step.kind === \"card\" ? (\n <CardView\n key={step.id}\n item={step.item}\n keyMap={cardKey}\n state={state}\n conflict={conflict}\n labels={labels}\n suggestedDir={suggestedDir}\n more={cardMoreShown}\n detail={detailNow}\n onDetail={(d) => setCardDetail({ id: step.item.id, detail: d })}\n body={cardContext && props.renderCardBody ? props.renderCardBody(cardContext) : null}\n onBodyLeft={() => setLocked(null)}\n actions={cardContext && props.renderCardActions ? props.renderCardActions(cardContext) : null}\n showChoices={props.choicesOnCard === true || ((props.choicesOnCard ?? \"auto\") === \"auto\" && !!step.item.answers)}\n onChoose={(d) => {\n // A drag that started on a choice and snapped back still ends in a click: not an answer.\n if (dragged.current) dragged.current = false;\n else act(d);\n }}\n onChooseMore={(a) => {\n if (dragged.current) dragged.current = false;\n else void give(a, null);\n }}\n layerRef={layerRef}\n onMounted={onCardMounted}\n onDoubleClickWord={(i) => openPart(step.item, i)}\n />\n ) : step.kind === \"pick\" ? (\n <PickView key={step.id} step={step} label={props.groupLabels?.[step.group] ?? labels.pick} labels={labels} layerRef={layerRef} onPick={pick} enterFrom={enterFrom} />\n ) : (\n <EndView\n key=\"end\"\n result={result}\n rules={rules}\n labels={labels}\n groupLabels={props.groupLabels}\n layerRef={layerRef}\n enterFrom={enterFrom}\n actions={props.endActions}\n onChange={(item) => {\n // Taking an answer back is a change like any other (undo puts it back); the deck returns to that card.\n enterFrom.current = null;\n const now = stateRef.current;\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: null }];\n // A pick that named this item goes with its answer, as when the card is answered otherwise.\n if (item.group && now.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n controller.commit(makeChange(now, ops, items));\n setSaid(`${labels.change}: ${item.text}`);\n }}\n >\n {props.renderEnd?.(result)}\n </EndView>\n )}\n </div>\n <Wash ref={wash} />\n </div>\n\n {controller.writeError ? (\n <ErrorBox className=\"matrx-sd-error\" message={controller.writeError} operation=\"Save an answer\" origin=\"design-system/SwipeDeck\" />\n ) : null}\n\n {part && partItem ? (\n <PartScreen\n key={`${part.itemId}:${part.start}`}\n item={partItem}\n parts={partsOf(state, partItem)}\n initial={{ start: part.start, end: part.end }}\n keyMap={partKey}\n deckKey={keyFor(rules, partItem)}\n state={state}\n categories={allCategories}\n rows={props.categoryRows}\n allowNewCategories={props.allowNewCategories !== false}\n conflict={conflict}\n labels={labels}\n onClose={() => setPart(null)}\n onPlace={(p) => placeOnItem(partItem, p)}\n onForget={(span) => forgetOnItem(partItem, span)}\n onCategoryAnswer={(name, answer, row) => {\n enterFrom.current = \"stay\";\n controller.commit(makeChange(stateRef.current, [{ kind: \"category\", name, answer, ...(row ? { row } : {}) }], items));\n }}\n announce={setSaid}\n />\n ) : null}\n\n <div className=\"matrx-sd-tour\" hidden={!touring} onPointerDown={() => (tourStop.current = true)}>\n <div ref={ringRef} className=\"matrx-sd-ring\" />\n <div ref={fingerRef} className=\"matrx-sd-finger\" />\n <div ref={capRef} className=\"matrx-sd-tour-cap\" />\n </div>\n {bubble ? (\n <div ref={bubbleRef} className=\"matrx-sd-bubble\" role=\"status\">\n {bubble.text}\n </div>\n ) : null}\n <div className=\"matrx-sd-toast\" role=\"status\" aria-live=\"polite\" data-on={toast ? \"\" : undefined}>\n {toast}\n </div>\n <div className=\"matrx-sd-sr\" aria-live=\"polite\" aria-atomic=\"true\">\n {said}\n </div>\n </div>\n );\n}\n\n// ─── the card ──────────────────────────────────────────────────────────────\n\ninterface CardViewProps {\n readonly item: DeckItem;\n readonly keyMap: DeckKey;\n readonly state: DeckState;\n readonly conflict: CategoryConflict | undefined;\n readonly labels: SwipeDeckLabels;\n readonly suggestedDir: DeckDirection | null;\n /** Draw the item's choices on the card by direction (a quiz). */\n readonly showChoices: boolean;\n readonly onChoose: (dir: DeckDirection) => void;\n /** Answers off the edges: on the card as buttons (in the choices when they show). */\n readonly more: readonly DeckAnswer[];\n readonly onChooseMore: (answer: DeckAnswer) => void;\n readonly detail: DeckDetail | null;\n readonly onDetail: (detail: DeckDetail | null) => void;\n readonly body: React.ReactNode;\n /** Focus left the body slot: a lock it held is released. */\n readonly onBodyLeft: () => void;\n readonly actions: React.ReactNode;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly onMounted: (layer: HTMLDivElement, suggested: DeckDirection | null) => void;\n readonly onDoubleClickWord: (index: number) => void;\n}\n\n/** The order choices read on a card: clockwise from the top. */\nconst CHOICE_ORDER: readonly DeckDirection[] = [\"up\", \"right\", \"down\", \"left\"];\n\nfunction MediaView({ media, size }: { media: DeckMedia; size?: \"small\" }) {\n const shape = media.shape ?? \"square\";\n return (\n <span className=\"matrx-sd-media\" data-shape={shape} data-size={size}>\n {\"src\" in media ? <img src={media.src} alt={media.alt ?? \"\"} draggable={false} /> : media.node}\n </span>\n );\n}\n\nfunction CardView({\n item,\n keyMap,\n state,\n conflict,\n labels,\n suggestedDir,\n showChoices,\n onChoose,\n more,\n onChooseMore,\n detail,\n onDetail,\n body,\n onBodyLeft,\n actions,\n layerRef,\n onMounted,\n onDoubleClickWord,\n}: CardViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n const inner = React.useRef<HTMLDivElement>(null);\n const hero = React.useRef<HTMLParagraphElement>(null);\n const tokens = React.useMemo(() => tokenize(item.text), [item.text]);\n const parts = partsOf(state, item);\n const suggested = answerOf(keyMap, item.suggested, more);\n const off = membersOff(item, detail);\n const toggle = (id: string) => {\n const next = off.includes(id) ? off.filter((x) => x !== id) : [...off, id];\n onDetail({ ...(detail ?? {}), off: next });\n };\n\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n if (layer.current) onMounted(layer.current, suggestedDir);\n return () => {\n if (layerRef.current === layer.current) layerRef.current = null;\n };\n // Mount only: a card arrives once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const partsKey = parts.map((p) => `${p.start}-${p.end}`).join(\",\");\n React.useLayoutEffect(() => {\n const box = layer.current;\n if (!box || !inner.current || !hero.current) return;\n return keepFitted(box, () => {\n if (inner.current && hero.current) fitText(box, inner.current, hero.current, 20, heroMax(box));\n });\n }, [item.text, partsKey, item.members?.length, more.length]);\n\n const nodes: React.ReactNode[] = [];\n for (let i = 0; i < tokens.length; ) {\n const p = parts.find((x) => x.start === i);\n if (p) {\n const a = answerOf(keyMap, partAnswer(p, state, keyMap, conflict));\n const words: React.ReactNode[] = [];\n for (let j = p.start; j <= p.end; j++) {\n words.push(\n <span key={j} className=\"matrx-sd-token\" data-sd-t={j}>\n {tokens[j]}\n </span>,\n );\n if (j < p.end) words.push(\" \");\n }\n nodes.push(\n <span key={`p${i}`} className=\"matrx-sd-part\" data-sd-part={i} data-tone={a?.tone} data-sd-part-label={[a?.label, ...p.categories].filter(Boolean).join(\" · \") || partText(item, p)}>\n {words}\n </span>,\n );\n i = p.end + 1;\n } else {\n nodes.push(\n <span key={i} className=\"matrx-sd-token\" data-sd-t={i}>\n {tokens[i]}\n </span>,\n );\n i++;\n }\n if (i < tokens.length) nodes.push(\" \");\n }\n\n return (\n <div\n ref={layer}\n className=\"matrx-sd-layer\"\n data-sd-item={item.id}\n aria-label={[item.kicker, item.text].filter(Boolean).join(\": \")}\n onDoubleClick={(e) => {\n const t = e.target instanceof Element ? e.target.closest(\"[data-sd-t]\") : null;\n if (t) onDoubleClickWord(Number(t.getAttribute(\"data-sd-t\")));\n }}\n >\n <div ref={inner} className=\"matrx-sd-card\">\n {item.media ? <MediaView media={item.media} /> : null}\n {item.kicker || item.tag || actions ? (\n <div className=\"matrx-sd-kicker\">\n {item.kicker ? <span>{item.kicker}</span> : null}\n {item.tag ? (\n <span className=\"matrx-sd-tag\">\n <CheckIcon />\n {item.tag}\n </span>\n ) : null}\n {actions ? <span className=\"matrx-sd-actions\">{actions}</span> : null}\n </div>\n ) : null}\n <p ref={hero} className=\"matrx-sd-hero\" data-quoted={item.quoted ? \"\" : undefined}>\n {nodes}\n </p>\n {item.members?.length ? (\n <div className=\"matrx-sd-members\">\n {item.members.map((m) => {\n const isOff = off.includes(m.id);\n return (\n // ui-exception: a group card's member switch is part of the card (a swipe never starts on it)\n <button key={m.id} type=\"button\" className=\"matrx-sd-member\" aria-pressed={!isOff} data-off={isOff ? \"\" : undefined} onClick={() => toggle(m.id)}>\n {m.media ? <MediaView media={m.media} size=\"small\" /> : null}\n <span>{m.label}</span>\n </button>\n );\n })}\n </div>\n ) : null}\n {body ? (\n <div\n className=\"matrx-sd-body\"\n onBlur={(e) => {\n // Focus leaving the host's own controls (a field closed, a tap on the card) ends a lock: never stuck.\n const next = e.relatedTarget instanceof Node ? e.relatedTarget : null;\n // The window losing focus (another tab, another app) is not leaving the field.\n if (!e.currentTarget.ownerDocument.hasFocus()) return;\n if (!next || !e.currentTarget.contains(next)) onBodyLeft();\n }}\n >\n {body}\n </div>\n ) : null}\n {showChoices ? (\n <div className=\"matrx-sd-choices\">\n {CHOICE_ORDER.map((d) => {\n const a = keyMap[d];\n if (!a) return null;\n return (\n // ui-exception: a choice on the card is the card's own answer target (and a swipe can start on it)\n <button key={d} type=\"button\" className=\"matrx-sd-choice\" data-sd-choice=\"\" data-dir={d} data-tone={a.tone} onClick={() => onChoose(d)}>\n <AnswerGlyph answer={{ ...a, icon: undefined }} dir={d} />\n <span>{a.label}</span>\n </button>\n );\n })}\n {more.map((a) => (\n // ui-exception: an answer off the edges is the card's own answer target\n <button key={a.id} type=\"button\" className=\"matrx-sd-choice\" data-sd-choice=\"\" data-tone={a.tone} title={a.shortcut ? `${a.label} (${a.shortcut})` : a.label} onClick={() => onChooseMore(a)}>\n {a.icon ?? null}\n <span>{a.label}</span>\n </button>\n ))}\n </div>\n ) : more.length ? (\n <div className=\"matrx-sd-more\">\n {more.map((a) => (\n // ui-exception: an answer off the edges is the card's own answer target\n <button\n key={a.id}\n type=\"button\"\n className=\"matrx-sd-more-answer\"\n data-sd-choice=\"\"\n data-tone={a.tone}\n data-suggested={item.suggested === a.id ? \"\" : undefined}\n aria-keyshortcuts={a.shortcut}\n title={a.shortcut ? `${a.label} (${a.shortcut})` : a.label}\n onClick={() => onChooseMore(a)}\n >\n {a.icon ?? null}\n <span>{a.label}</span>\n </button>\n ))}\n </div>\n ) : null}\n {suggested || item.reason || item.fields?.length ? (\n <div className=\"matrx-sd-fields\">\n {suggested ? (\n <div>\n <div className=\"matrx-sd-label\">{labels.suggestion}</div>\n <div className=\"matrx-sd-suggested\" data-tone={suggested.tone}>\n <AnswerGlyph answer={suggested} dir={suggestedDir} />\n {item.suggestedLabel ?? suggested.label}\n </div>\n </div>\n ) : null}\n {item.reason ? (\n <div>\n <div className=\"matrx-sd-label\">{labels.reason}</div>\n <div className=\"matrx-sd-value\">{item.reason}</div>\n </div>\n ) : null}\n {item.fields?.map((f) => (\n <div key={f.label}>\n <div className=\"matrx-sd-label\">{f.label}</div>\n <div className=\"matrx-sd-value\">{f.value}</div>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\n// ─── pick one ──────────────────────────────────────────────────────────────\n\ninterface PickViewProps {\n readonly step: Extract<DeckStep, { kind: \"pick\" }>;\n readonly label: string;\n readonly labels: SwipeDeckLabels;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly enterFrom: React.MutableRefObject<DeckDirection | \"stay\" | null>;\n readonly onPick: (group: string, item: DeckItem) => void;\n}\n\nfunction PickView({ step, label, labels, layerRef, enterFrom, onPick }: PickViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n const [chosen, setChosen] = React.useState<string | null>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer.current, from);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n React.useLayoutEffect(() => {\n const box = layer.current;\n if (!box) return;\n const run = () => {\n const buttons = Array.from(box.querySelectorAll<HTMLElement>(\".matrx-sd-option\"));\n let lo = 16;\n let hi = (box.ownerDocument.defaultView?.innerWidth ?? 0) >= 1024 ? 64 : 40;\n let best = lo;\n for (let k = 0; k < 9; k++) {\n const mid = (lo + hi) / 2;\n buttons.forEach((b) => (b.style.fontSize = `${mid}px`));\n const ok = buttons.every((b) => b.scrollHeight <= b.clientHeight + 1 && b.scrollWidth <= b.clientWidth + 1);\n if (ok) {\n best = mid;\n lo = mid;\n } else hi = mid;\n }\n buttons.forEach((b) => (b.style.fontSize = `${Math.floor(best)}px`));\n // Too many options for even the smallest size: the pick scrolls instead of clipping.\n const list = box.querySelector<HTMLElement>(\".matrx-sd-options\");\n if (list && list.scrollHeight > box.clientHeight + 1) box.setAttribute(\"data-sd-overflow\", \"\");\n else box.removeAttribute(\"data-sd-overflow\");\n };\n return keepFitted(box, run);\n }, [step.items.length]);\n return (\n <div ref={layer} className=\"matrx-sd-layer\">\n <div className=\"matrx-sd-options\" role=\"radiogroup\" aria-label={label}>\n {step.items.map((item) => (\n // ui-exception: a pick-one option fills its share of the full-screen deck\n <button\n key={item.id}\n type=\"button\"\n role=\"radio\"\n aria-checked={chosen === item.id}\n className=\"matrx-sd-option\"\n data-suggested={item.pickSuggested ? \"\" : undefined}\n data-chosen={chosen === item.id ? \"\" : undefined}\n onClick={() => {\n setChosen(item.id);\n onPick(step.group, item);\n }}\n >\n {item.pickSuggested ? <span className=\"matrx-sd-label\">{labels.suggestion}</span> : null}\n <span>{item.text}</span>\n </button>\n ))}\n </div>\n </div>\n );\n}\n\n// ─── the end ───────────────────────────────────────────────────────────────\n\ninterface EndViewProps {\n readonly result: DeckResult;\n readonly rules: DeckRules;\n readonly labels: SwipeDeckLabels;\n readonly groupLabels: Readonly<Record<string, string>> | undefined;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly enterFrom: React.MutableRefObject<DeckDirection | \"stay\" | null>;\n /** The host's own buttons at the end (back to where the person came from, next step). */\n readonly actions?: React.ReactNode;\n /** Take an item's answer back: the deck returns to that card. */\n readonly onChange: (item: DeckItem) => void;\n readonly children?: React.ReactNode;\n /** Mid-deck: the same list titled \"Answered\", with the way back to the cards (and the walkthrough). */\n readonly review?: { readonly onBack: () => void; readonly onHelp?: () => void };\n}\n\ninterface EndGroup {\n readonly key: string;\n readonly label: string;\n readonly tone: DeckTone;\n readonly count: number;\n}\n\n/** How the answers split: right / wrong on a graded deck, else by answer (same words = one group). */\nfunction endGroups(result: DeckResult, labels: SwipeDeckLabels): EndGroup[] {\n const graded = result.entries.filter((e) => e.answer && e.right !== null);\n if (result.score && graded.length) {\n const right = graded.filter((e) => e.right).length;\n return [\n { key: \"right\", label: labels.right, tone: \"success\", count: right },\n { key: \"wrong\", label: labels.wrong, tone: \"destructive\", count: graded.length - right },\n ].filter((g) => g.count > 0) as EndGroup[];\n }\n const out = new Map<string, EndGroup>();\n for (const e of result.entries) {\n if (!e.answer) continue;\n const key = e.answer.label;\n const had = out.get(key);\n out.set(key, { key, label: e.answer.label, tone: had?.tone ?? e.answer.tone, count: (had?.count ?? 0) + 1 });\n }\n return [...out.values()];\n}\n\nfunction groupOf(entry: DeckResult[\"entries\"][number], graded: boolean): string | null {\n if (!entry.answer) return null;\n if (graded && entry.right !== null) return entry.right ? \"right\" : \"wrong\";\n return entry.answer.label;\n}\n\n/** The finish: a mark that draws itself, the headline (a pick, a score, or done), how the answers split, and every answer to look over and change. */\nfunction EndView({ result, rules, labels, groupLabels, layerRef, enterFrom, actions, onChange, children, review }: EndViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer.current, from);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const [filter, setFilter] = React.useState<string | null>(null);\n if (children) {\n return (\n <div ref={layer} className=\"matrx-sd-layer\">\n {children}\n </div>\n );\n }\n const picks = Object.entries(result.picks);\n const [first, ...rest] = picks;\n const score = result.score;\n const groups = endGroups(result, labels);\n const graded = !!score && groups.some((g) => g.key === \"right\" || g.key === \"wrong\");\n const answered = result.entries.filter((e) => e.answer);\n const shown = filter ? answered.filter((e) => groupOf(e, graded) === filter) : answered;\n const pct = score && score.graded ? score.right / score.graded : 1;\n const kicker = review ? null : first ? (groupLabels?.[first[0]] ?? first[0]) : score ? labels.score : null;\n const headline = review ? labels.answered : first ? first[1].text : score ? `${score.right} / ${score.graded}` : labels.allDone;\n const sub = labels.answeredOf.replace(\"{answered}\", String(result.answered)).replace(\"{total}\", String(result.total));\n return (\n <div ref={layer} className=\"matrx-sd-layer matrx-sd-endlayer\">\n <div className=\"matrx-sd-end\" data-graded={graded ? \"\" : undefined} data-review={review ? \"\" : undefined}>\n {review ? null : (\n <svg className=\"matrx-sd-mark\" viewBox=\"0 0 72 72\" aria-hidden=\"true\" data-tone={score ? (pct >= 0.5 ? \"success\" : \"warning\") : \"success\"}>\n <circle className=\"matrx-sd-mark-track\" cx=\"36\" cy=\"36\" r=\"32\" />\n <circle className=\"matrx-sd-mark-ring\" cx=\"36\" cy=\"36\" r=\"32\" pathLength={100} style={{ strokeDasharray: `${Math.round(pct * 100)} 100` }} />\n {!score || pct === 1 ? <path className=\"matrx-sd-mark-check\" d=\"M23 37.5l9 9 17-19\" pathLength={100} /> : null}\n </svg>\n )}\n {kicker ? <div className=\"matrx-sd-kicker\">{kicker}</div> : null}\n <h2 className=\"matrx-sd-end-hero\">{headline}</h2>\n <div className=\"matrx-sd-end-sub\">{sub}</div>\n {score && first && !review ? (\n <div className=\"matrx-sd-endline\">\n <div className=\"matrx-sd-label\">{labels.score}</div>\n <div className=\"matrx-sd-value\">{`${score.right} / ${score.graded}`}</div>\n </div>\n ) : null}\n {(review ? [] : rest).map(([group, item]) => (\n <div key={group} className=\"matrx-sd-endline\">\n <div className=\"matrx-sd-label\">{groupLabels?.[group] ?? group}</div>\n <div className=\"matrx-sd-value\">{item.text}</div>\n </div>\n ))}\n {groups.length ? (\n <>\n <div className=\"matrx-sd-split\" aria-hidden=\"true\">\n {groups.map((g) => (\n <i key={g.key} data-tone={g.tone} style={{ flexGrow: g.count }} />\n ))}\n </div>\n <div className=\"matrx-sd-legend\" role=\"group\" aria-label={labels.filterAnswers}>\n {groups.length > 1 ? (\n // ui-exception: the end's answer filter is part of the deck's own finish screen\n <button type=\"button\" className=\"matrx-sd-legend-chip\" aria-pressed={filter === null} onClick={() => setFilter(null)}>\n <span>{labels.showAll}</span>\n <b>{answered.length}</b>\n </button>\n ) : null}\n {groups.map((g) => (\n // ui-exception: the end's answer filter is part of the deck's own finish screen\n <button\n key={g.key}\n type=\"button\"\n className=\"matrx-sd-legend-chip\"\n data-tone={g.tone}\n aria-pressed={filter === g.key}\n onClick={() => setFilter((f) => (f === g.key ? null : g.key))}\n >\n <i aria-hidden=\"true\" />\n <span>{g.label}</span>\n <b>{g.count}</b>\n </button>\n ))}\n </div>\n </>\n ) : null}\n {shown.length ? (\n <ul className=\"matrx-sd-review\" aria-label={labels.yourAnswers}>\n {shown.map((e) => {\n const rightIds = e.item.correct === undefined ? [] : typeof e.item.correct === \"string\" ? [e.item.correct] : e.item.correct;\n // What rode with the answer reads in its place: the value typed on the card, the relationship picked.\n const said = typeof e.detail?.value === \"string\" && e.detail.value.trim() ? e.detail.value : e.item.text;\n const answerWords = typeof e.detail?.label === \"string\" && e.detail.label ? e.detail.label : e.answer?.label;\n const rightWords = rightIds.map((id) => findAnswer(rules, e.item, id)?.label).filter(Boolean).join(\", \");\n return (\n <li key={e.item.id}>\n {/* ui-exception: a reviewed answer is the end screen's own row (tap to change it) */}\n <button\n type=\"button\"\n className=\"matrx-sd-review-row\"\n onClick={() => onChange(e.item)}\n aria-label={[\n `${labels.change}: ${said}`,\n [answerWords, e.right === true ? labels.right : e.right === false ? labels.wrong : null].filter(Boolean).join(\", \"),\n e.right === false && rightWords ? `${labels.rightAnswer}: ${rightWords}` : null,\n ]\n .filter(Boolean)\n .join(\". \")}\n >\n <span className=\"matrx-sd-review-text\">\n {e.item.kicker ? <span className=\"matrx-sd-label\">{e.item.kicker}</span> : null}\n <span className=\"matrx-sd-review-item\">{said}</span>\n {e.right === false && rightWords ? (\n <span className=\"matrx-sd-review-right\">\n {labels.rightAnswer}: {rightWords}\n </span>\n ) : null}\n </span>\n <span className=\"matrx-sd-review-answer\" data-tone={e.right === null ? e.answer?.tone : e.right ? \"success\" : \"destructive\"}>\n {e.right === true ? <CheckIcon /> : e.right === false ? <XIcon /> : null}\n <span>{answerWords}</span>\n </span>\n <PencilIcon className=\"matrx-sd-review-change\" aria-hidden=\"true\" />\n </button>\n </li>\n );\n })}\n </ul>\n ) : null}\n {review ? (\n <div className=\"matrx-sd-end-actions\">\n {/* ui-exception: the answered list's way back is the deck's own control, in its own geometry */}\n <button type=\"button\" className=\"matrx-sd-review-back\" onClick={review.onBack} autoFocus>\n {labels.backToCards}\n </button>\n {review.onHelp ? (\n // ui-exception: the walkthrough, from the answered list (the corner it had now opens this list)\n <button type=\"button\" className=\"matrx-sd-legend-chip\" onClick={review.onHelp}>\n <CircleHelpIcon aria-hidden=\"true\" />\n <span>{labels.help}</span>\n </button>\n ) : null}\n </div>\n ) : actions ? (\n <div className=\"matrx-sd-end-actions\">{actions}</div>\n ) : null}\n </div>\n </div>\n );\n}\n\n/** Nothing to answer: the deck's own quiet screen, never a blank. */\nfunction EmptyView({ title, line, action, layerRef }: { title: string; line?: string | undefined; action?: React.ReactNode; layerRef: React.MutableRefObject<HTMLDivElement | null> }) {\n const layer = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n enter(layer.current, null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return (\n <div ref={layer} className=\"matrx-sd-layer matrx-sd-endlayer\" data-sd-empty=\"\">\n <div className=\"matrx-sd-end matrx-sd-empty\">\n <div className=\"matrx-sd-empty-stack\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </div>\n <h2 className=\"matrx-sd-end-hero\">{title}</h2>\n {line ? <div className=\"matrx-sd-end-sub\">{line}</div> : null}\n {action ? <div className=\"matrx-sd-end-actions\">{action}</div> : null}\n </div>\n </div>\n );\n}\n\n\n","/**\n * ErrorBox — THE one way a package draws an error on screen, and the seam a\n * host uses to put its own actions on every one of them.\n *\n * Every error sentence this package (and every sibling package that depends\n * on it) shows is an `ErrorBox`. The box is a plain `role=\"alert\"` element —\n * its tag and classes are the caller's, so nothing about the look changes — and\n * after its children it renders whatever the host's `ErrorActionsProvider`\n * returns for that error. With no provider it renders nothing extra.\n *\n * Why a slot and not a menu: the package cannot know the host's AI copy, bug\n * report, or support flow (Matrx fills it with its Alchemy copy-for-AI menu at\n * the app root). The package supplies the error's facts — the sentence, the\n * raw error, the operation, the records — and the host decides the actions.\n *\n * Guard: `error-box.census.test.ts` fails when a package file renders\n * `role=\"alert\"` for an error without going through `ErrorBox` (or, for the\n * `Alert` family, `ErrorActions`).\n */\nimport * as React from \"react\";\nimport { peopleErrorSentence } from \"./error-sentence\";\n\nexport interface ErrorActionsRecord {\n type: string;\n id: string;\n label?: string;\n}\n\n/** The facts a package knows about an error it is showing. All optional. */\nexport interface ErrorActionsInput {\n /** The sentence shown. Omit when the words are only in the rendered box. */\n message?: string | undefined;\n title?: string | undefined;\n /** The raw error (code/status/stack stay available to the host). */\n error?: unknown | undefined;\n /** What was being attempted (\"Load saved views\"). */\n operation?: string | undefined;\n records?: readonly ErrorActionsRecord[] | undefined;\n /** The person's input that did not land. */\n unsavedInput?: unknown | undefined;\n /** The package + component that drew it (\"design-system/SavedViewsControl\"). */\n origin?: string | undefined;\n /** Extra structured facts for the AI payload (never shown). */\n details?: Record<string, unknown> | undefined;\n code?: string | number | undefined;\n status?: number | undefined;\n /** The tables / RPCs the failed call used — pins its captured request as the cause. */\n calls?: readonly string[] | undefined;\n /** Where it was drawn: an `ErrorNotice` card/line (\"inline\") or a package alert box (\"alert\", the default). */\n source?: \"inline\" | \"alert\" | undefined;\n}\n\nexport type ErrorActionsRenderer = (input: ErrorActionsInput) => React.ReactNode;\n\n/**\n * ONE context for every copy of this module. tsup builds each entry point\n * (`.`, `./data-table`, …) without code splitting, so this file is inlined into\n * several bundles; a plain `createContext` would give each bundle its own\n * context and the host's provider (imported from `.`) would never reach an\n * error drawn by the data table. The registry key makes them one.\n */\nconst CONTEXT_KEY = Symbol.for(\"@ai-matrx/design-system/error-actions\");\ntype ContextRegistry = Record<symbol, React.Context<ErrorActionsRenderer | null> | undefined>;\nconst registry = globalThis as unknown as ContextRegistry;\nconst ErrorActionsContext: React.Context<ErrorActionsRenderer | null> =\n registry[CONTEXT_KEY] ??\n (registry[CONTEXT_KEY] = React.createContext<ErrorActionsRenderer | null>(null));\n\n/** Mount once at the host's app root; every ErrorBox below renders `render(...)`. */\nexport function ErrorActionsProvider({\n render,\n children,\n}: {\n render: ErrorActionsRenderer;\n children: React.ReactNode;\n}) {\n return (\n <ErrorActionsContext.Provider value={render}>{children}</ErrorActionsContext.Provider>\n );\n}\n\n/**\n * The host's content menu around an error card (`ErrorNotice`): the corner ⋯\n * button and the right-click boundary that show the host's content actions\n * over the error's sentence. Read-only — nothing here may change a record.\n * Without a provider the card draws neither (the actions slot still renders).\n */\nexport interface ErrorCardMenus {\n /** The corner ⋯ button over `{ title, text }`. */\n Button: React.ComponentType<{ title: string; text: string; className?: string }>;\n /** Wraps the whole card so right-click opens the same menu. */\n Boundary: React.ComponentType<{ title: string; text: string; children: React.ReactNode }>;\n}\n\nconst MENUS_KEY = Symbol.for(\"@ai-matrx/design-system/error-card-menus\");\ntype MenusRegistry = Record<symbol, React.Context<ErrorCardMenus | null> | undefined>;\nconst menusRegistry = globalThis as unknown as MenusRegistry;\nconst ErrorCardMenusContext: React.Context<ErrorCardMenus | null> =\n menusRegistry[MENUS_KEY] ??\n (menusRegistry[MENUS_KEY] = React.createContext<ErrorCardMenus | null>(null));\n\n/** Mount once at the host's app root beside `ErrorActionsProvider`. */\nexport function ErrorCardMenusProvider({\n menus,\n children,\n}: {\n menus: ErrorCardMenus;\n children: React.ReactNode;\n}) {\n return <ErrorCardMenusContext.Provider value={menus}>{children}</ErrorCardMenusContext.Provider>;\n}\n\nexport function useErrorCardMenus(): ErrorCardMenus | null {\n return React.useContext(ErrorCardMenusContext);\n}\n\nexport function useErrorActions(): ErrorActionsRenderer | null {\n return React.useContext(ErrorActionsContext);\n}\n\n/**\n * The host's actions for one error, placed wherever the caller puts this\n * element. Renders nothing without a provider. Use inside a box you do not\n * render yourself (the `Alert` family); everything else uses `ErrorBox`.\n */\nexport function ErrorActions(props: ErrorActionsInput) {\n const render = useErrorActions();\n if (!render) return null;\n return <>{render(props)}</>;\n}\n\ntype ErrorBoxTag = \"p\" | \"div\" | \"span\" | \"section\" | \"li\";\n\nexport interface ErrorBoxProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"role\" | \"title\">,\n ErrorActionsInput {\n /** The element drawn — the caller's existing tag, so layout never shifts. */\n as?: ErrorBoxTag;\n}\n\n/** A plain-string body goes through the one funnel (error-sentence.ts); rich children are the caller's. */\nfunction sayable(body: React.ReactNode, error: unknown): React.ReactNode {\n if (typeof body === \"string\") return peopleErrorSentence(error, body);\n if (Array.isArray(body)) return body.map((b) => (typeof b === \"string\" && b.trim() ? peopleErrorSentence(error, b) : b));\n return body;\n}\n\nexport const ErrorBox = React.forwardRef<HTMLElement, ErrorBoxProps>(function ErrorBox(\n {\n as = \"p\",\n message,\n title,\n error,\n operation,\n records,\n unsavedInput,\n origin,\n children,\n ...rest\n },\n ref,\n) {\n // A component type, never a bare ElementType: an app compiling this source may carry global JSX\n // elements (react-three-fiber) that make a bare ElementType's props `never` (2026-10-22).\n const Tag = as as unknown as React.ComponentType<React.HTMLAttributes<HTMLElement> & { ref?: React.Ref<HTMLElement> }>;\n const facts: ErrorActionsInput = {\n ...(message !== undefined ? { message } : {}),\n ...(title !== undefined ? { title } : {}),\n ...(error !== undefined ? { error } : {}),\n ...(operation !== undefined ? { operation } : {}),\n ...(records !== undefined ? { records } : {}),\n ...(unsavedInput !== undefined ? { unsavedInput } : {}),\n ...(origin !== undefined ? { origin } : {}),\n };\n return (\n <Tag ref={ref} role=\"alert\" data-error-box=\"\" {...rest}>\n {sayable(children ?? message, error)}\n <ErrorActions {...facts} />\n </Tag>\n );\n});\n","/**\n * THE error-wording layer. A failure is shown as a cause the person can act on (\"A program it\n * needs isn't installed\"), never as the raw text a process threw (\"spawn uv ENOENT\"). The raw text\n * is kept, whole, as `detail` — the banner offers it behind Copy details and a tooltip, for a bug\n * report or an agent. One table, so every screen and every service says the same thing.\n */\n\nexport interface DescribedError {\n /** One plain sentence: what went wrong and, where it helps, what to do. */\n cause: string;\n /** The raw text, unedited (empty when it would only repeat `cause`). */\n detail: string;\n /** A short machine code when one was recognized (\"ENOENT\", \"TIMEOUT\"). */\n code?: string;\n}\n\ninterface Rule {\n code: string;\n test: RegExp;\n cause: string;\n}\n\n/** Ordered: the first rule whose pattern matches the raw text wins. */\nconst RULES: ReadonlyArray<Rule> = [\n { code: \"ENOENT\", test: /\\b(spawn\\s+\\S+\\s+)?ENOENT\\b|command not found|no such file or directory/i, cause: \"A program or file it needs isn't on this computer. Install it or update Matrx, then try again.\" },\n { code: \"EACCES\", test: /\\bEACCES\\b|\\bEPERM\\b|permission denied|operation not permitted|not authori[sz]ed by the user/i, cause: \"Matrx isn't allowed to do that. Grant access in System Settings › Privacy & Security, then try again.\" },\n { code: \"EADDRINUSE\", test: /\\bEADDRINUSE\\b|address already in use|port .* (is )?(already )?in use/i, cause: \"Another program is already using that port. Stop it, or choose another port.\" },\n { code: \"ECONNREFUSED\", test: /\\bECONNREFUSED\\b|connection refused/i, cause: \"The service isn't answering. It may have stopped; start it again.\" },\n { code: \"OFFLINE\", test: /\\bENOTFOUND\\b|\\bEAI_AGAIN\\b|\\bENETUNREACH\\b|getaddrinfo|network (is )?unreachable|failed to fetch|offline/i, cause: \"Can't reach the internet. Check the connection and try again.\" },\n { code: \"TIMEOUT\", test: /\\bETIMEDOUT\\b|timed? ?out|\\bTIMEOUT\\b|deadline exceeded/i, cause: \"It took too long to answer. Try again in a moment.\" },\n { code: \"ENOSPC\", test: /\\bENOSPC\\b|no space left/i, cause: \"The disk is full. Free some space, then try again.\" },\n { code: \"ENOMEM\", test: /\\bENOMEM\\b|out of memory|cannot allocate memory/i, cause: \"The computer ran out of memory. Close something and try again.\" },\n { code: \"UNAUTHORIZED\", test: /\\b401\\b|unauthori[sz]ed|invalid (api )?key|not signed in|jwt expired|session expired/i, cause: \"You're signed out, or the key was refused. Sign in again.\" },\n { code: \"FORBIDDEN\", test: /\\b403\\b|forbidden/i, cause: \"This account isn't allowed to do that.\" },\n { code: \"NOT_FOUND\", test: /\\b404\\b|not found/i, cause: \"It isn't there any more. Refresh and try again.\" },\n { code: \"RATE_LIMIT\", test: /\\b429\\b|rate.?limit|too many requests/i, cause: \"Too many requests just now. Wait a moment and try again.\" },\n { code: \"SERVER\", test: /\\b5\\d\\d\\b|internal server error|bad gateway|service unavailable/i, cause: \"The server had a problem. Try again in a moment.\" },\n { code: \"EXITED\", test: /exited with code|process exited|crashed|SIGKILL|SIGSEGV|SIGTERM/i, cause: \"The service stopped unexpectedly. Start it again; Copy details if it keeps happening.\" },\n];\n\nconst RAW = /\\b[A-Z]{2,}[A-Z_]*\\b|[\\\\/][\\w.-]+[\\\\/]|\\bat \\S+ \\(|\\{|\\}|errno|stack|undefined|null|\\bspawn\\b/;\n\nfunction rawText(error: unknown): string {\n if (error instanceof Error) return error.message || error.name;\n if (typeof error === \"string\") return error;\n if (error && typeof error === \"object\" && \"message\" in error && typeof (error as { message: unknown }).message === \"string\") {\n return (error as { message: string }).message;\n }\n return \"\";\n}\n\n/**\n * Turn any thrown or returned error into words a person can act on. Already-humane text (a full\n * sentence the app wrote itself, with no codes, paths or stack) passes through unchanged.\n */\nexport function describeError(error: unknown, fallback = \"Something went wrong. Try again.\"): DescribedError {\n const detail = rawText(error).trim();\n if (!detail) return { cause: fallback, detail: \"\" };\n for (const rule of RULES) {\n if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };\n }\n if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: \"\" };\n return { cause: fallback, detail };\n}\n","/**\n * THE SENTENCE A PERSON READS FOR AN ERROR — the one funnel every error surface draws through\n * (ErrorNotice, ErrorBox, the desktop Banner). Raw error text never reaches the screen: no\n * \"TypeError: Failed to fetch\", no `sidebar_conversations:` RPC prefix, no stack frame or file\n * path (Arman, 2026-10-24: notices are small and plain). The raw error still travels to the\n * Alchemy Menu / AI payload through the `error` prop; only the screen gets the sentence.\n *\n * The wording table is desktop/errors.ts `describeError` (one table for every screen); this file\n * adds what decides WHEN a sentence must go through it, narrow enough that an app's own sentence\n * (\"PDF too large\") passes untouched.\n */\nimport { describeError } from \"./desktop/errors\";\n\n/**\n * The sentence an error carries: its own message (string, Error, or any\n * object with a `message`). Empty when it has none.\n */\nexport function errorSentenceOf(error: unknown): string {\n if (error == null || error === true || error === false) return \"\";\n if (typeof error === \"string\") return error;\n if (typeof error !== \"object\") return String(error);\n const message = (error as { message?: unknown }).message;\n return typeof message === \"string\" ? message : \"\";\n}\n\n/**\n * What a person reads when the store cancelled a call at its statement timeout\n * (SQLSTATE 57014). Postgres' own \"canceling statement due to statement\n * timeout\" is about the database, not the person; the cancelled call rolled\n * back, so nothing was written (lane AT-SLOW, 2026-10-19). The same sentence\n * @ai-matrx/records' `TIMED_OUT_MESSAGE` gives.\n */\nexport const TIMED_OUT_SENTENCE = \"That took too long. Nothing was lost; try again.\";\n\n/** What a person reads when an error says nothing a person can use. */\nexport const FALLBACK_ERROR_SENTENCE = \"Something went wrong. Try again.\";\n\n/**\n * A notice CARD's words (the web toast, Matrx 2's floating card): a card is ~22 rem at most and its\n * action shares the row, so a line is a few words (notice-stack.ts NOTICE_TEXT_BUDGET). The same\n * causes as the sentences above, said short enough to fit at the smallest window, never cut by \"…\".\n */\nexport const CARD_ERROR_LINE = {\n OFFLINE: \"No connection\",\n TIMEOUT: \"Took too long. Nothing was lost.\",\n UNAUTHORIZED: \"Signed out. Sign in again.\",\n FORBIDDEN: \"Not allowed for this account\",\n NOT_FOUND: \"Not found. Refresh and retry.\",\n RATE_LIMIT: \"Too many requests. Wait a moment.\",\n SERVER: \"Server problem. Try again soon.\",\n FALLBACK: \"Something went wrong\",\n} as const;\n\n/** True when an error, its code, or its sentence is the store's statement timeout. */\nexport function isTimedOutError(error: unknown, message?: string | null, code?: string | number): boolean {\n if (code === \"57014\" || code === \"timed_out\") return true;\n if (error && typeof error === \"object\") {\n const o = error as { code?: unknown; sqlstate?: unknown };\n if (o.code === \"57014\" || o.code === \"timed_out\" || o.sqlstate === \"57014\") return true;\n }\n const text = `${message ?? \"\"} ${errorSentenceOf(error)}`;\n return /canceling statement due to statement timeout/i.test(text);\n}\n\n/** True when the call failed because the device is offline or the network never answered. */\nexport function isOfflineError(error: unknown, message?: string | null): boolean {\n if (typeof navigator !== \"undefined\" && navigator.onLine === false) return true;\n return offlineText(`${message ?? \"\"} ${errorSentenceOf(error)}`);\n}\n\nfunction offlineText(text: string): boolean {\n const t = text.trim();\n return t !== \"\" && (describeError(t).code === \"OFFLINE\" || /networkerror|network request failed|load failed/i.test(t));\n}\n\n/** describeError's causes that hold on every host (its process codes — ENOENT, EACCES, ports — are\n * the desktop's words for a local program and would mislead on a database refusal). */\nconst ANY_HOST_CODES = new Set([\"OFFLINE\", \"TIMEOUT\", \"UNAUTHORIZED\", \"FORBIDDEN\", \"NOT_FOUND\", \"RATE_LIMIT\", \"SERVER\"]);\n\n/** A leading machine label: `sidebar_conversations: …`, `chat.rpc_name: …`, `[chat-sidebar] …`. */\nconst MACHINE_PREFIX = /^\\s*(?:\\[[\\w./-]+\\]\\s*|[a-z][\\w]*(?:[._][\\w]+)+:\\s+)/;\n/** Text no person should read: JS error class names, stack frames, source paths. */\nconst RAW_TEXT =\n /\\b(?:Type|Reference|Syntax|Range|Internal|Eval|URI)Error\\b|\\bat\\s+[\\w$.<>]+\\s*\\(|\\.(?:[cm]?[jt]sx?|py):\\d+|(?:^|[\\s(])(?:\\/[\\w.@-]+){2,}|\\bundefined is not\\b|\\bcannot read propert(?:y|ies)\\b|\\bis not a function\\b|\\bunexpected token\\b/i;\n\n/** True when a sentence carries raw error text or a code path (what the guard refuses on screen). */\nexport function isRawErrorText(text: string): boolean {\n return MACHINE_PREFIX.test(text) || RAW_TEXT.test(text);\n}\n\n/**\n * `card: true` = the short CARD_ERROR_LINE words for a notice card. Otherwise:\n * the sentence for the screen: the timeout sentence for a statement timeout; a caller's plain\n * sentence as is; a machine label stripped from the front; anything raw or offline worded by\n * `describeError` (its table, else `fallback`).\n */\nexport function peopleErrorSentence(\n error: unknown,\n message?: string | null,\n options: { code?: string | number | undefined; fallback?: string | undefined; card?: boolean | undefined } = {},\n): string {\n const card = options.card === true;\n if (isTimedOutError(error, message, options.code)) return card ? CARD_ERROR_LINE.TIMEOUT : TIMED_OUT_SENTENCE;\n const fallback = options.fallback ?? (card ? CARD_ERROR_LINE.FALLBACK : FALLBACK_ERROR_SENTENCE);\n const raw = message?.trim() || errorSentenceOf(error).trim();\n if (!raw) return fallback;\n let text = raw;\n for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, \"\").trim();\n if (!text) return fallback;\n if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {\n const said = describeError(text, fallback);\n if (!said.code || !ANY_HOST_CODES.has(said.code)) return fallback;\n return card ? CARD_ERROR_LINE[said.code as keyof typeof CARD_ERROR_LINE] : said.cause;\n }\n return text;\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement>;\n\n/**\n * Every lucide glyph carries `lucide-<name>`, the class lucide-react itself renders: THE OPTICAL\n * GLYPH TRIM (tap-target.css) reads the glyph's real air from it, and a caller's own class follows it.\n */\nfunction lucideProps(name: string, { className, ...props }: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n className: className ? `lucide-${name} ${className}` : `lucide-${name}`,\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/**\n * lucide `loader-2` — the spinner glyph. Callers add `matrx-spin`.\n * Never a resting icon: at rest this incomplete arc reads as a broken\n * half-circle. Refresh controls use arrows, then swap to this only while busy.\n */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"loader-circle\", props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-left\", props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-right\", props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-down` — the disclosure's open glyph. */\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-down\", props)}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `trash-2` (moved from @ai-matrx/agents). */\nexport function Trash2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"trash-2\", props)}>\n <path d=\"M10 11v6\" />\n <path d=\"M14 11v6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" />\n <path d=\"M3 6h18\" />\n <path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `archive` — the archived-rows glyph (ArchivedDisclosure). */\nexport function ArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"archive\", props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"ellipsis\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check\", props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-up-down\", props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"external-link\", props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lock\", props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `pencil` — the edit glyph (the table card's Edit action). */\nexport function PencilIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pencil\", props)}>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\n </svg>\n );\n}\n\n/** lucide `message-square` — a row's comments (records-ui SectionCard). */\nexport function MessageSquareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-square\", props)}>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n </svg>\n );\n}\n\n/** lucide `sticky-note` — a row's usage note (records-ui SectionCard). */\nexport function StickyNoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sticky-note\", props)}>\n <path d=\"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M15 3v4a2 2 0 0 0 2 2h4\" />\n </svg>\n );\n}\n\n/** lucide `minus` — the decrease glyph (NumberStepper). */\nexport function MinusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"minus\", props)}>\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"plus\", props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `search` — the magnifier (the `@ai-matrx/design-system/icons` section). */\nexport function SearchIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"search\", props)}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n );\n}\n\n/** lucide `list-filter` — a table's filter button (Mail's and Finder's filter). */\nexport function ListFilterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list-filter\", props)}>\n <path d=\"M3 6h18\" />\n <path d=\"M7 12h10\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `pin` — pinned state (the `@ai-matrx/design-system/icons` section). */\nexport function PinIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pin\", props)}>\n <path d=\"M12 17v5\" />\n <path d=\"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"x\", props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function RadixCheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DividerHorizontalIcon` — the INDETERMINATE checkbox\n * glyph. Radix renders the indicator for both `true` and `\"indeterminate\"`, so\n * a half-selected \"select all\" that shows a full check states something false;\n * the two states get different glyphs on purpose.\n */\nexport function DividerHorizontalIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `DotFilledIcon` — the menu radio-item indicator. */\nexport function DotFilledIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronRightIcon` — the submenu-trigger glyph. */\nexport function RadixChevronRightIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DragHandleDots2Icon` — the grip on `ResizableHandle`.\n * Inlined per C19: this package depends on no icon library.\n */\nexport function DragHandleDots2Icon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M4.5 2.5C5.05228 2.5 5.5 2.05228 5.5 1.5C5.5 0.947715 5.05228 0.5 4.5 0.5C3.94772 0.5 3.5 0.947715 3.5 1.5C3.5 2.05228 3.94772 2.5 4.5 2.5ZM4.5 6.5C5.05228 6.5 5.5 6.05229 5.5 5.5C5.5 4.94771 5.05228 4.5 4.5 4.5C3.94772 4.5 3.5 4.94771 3.5 5.5C3.5 6.05229 3.94772 6.5 4.5 6.5ZM5.5 9.5C5.5 10.0523 5.05228 10.5 4.5 10.5C3.94772 10.5 3.5 10.0523 3.5 9.5C3.5 8.94771 3.94772 8.5 4.5 8.5C5.05228 8.5 5.5 8.94771 5.5 9.5ZM4.5 14.5C5.05228 14.5 5.5 14.0523 5.5 13.5C5.5 12.9477 5.05228 12.5 4.5 12.5C3.94772 12.5 3.5 12.9477 3.5 13.5C3.5 14.0523 3.94772 14.5 4.5 14.5ZM11.5 1.5C11.5 2.05228 11.0523 2.5 10.5 2.5C9.94771 2.5 9.5 2.05228 9.5 1.5C9.5 0.947715 9.94771 0.5 10.5 0.5C11.0523 0.5 11.5 0.947715 11.5 1.5ZM10.5 6.5C11.0523 6.5 11.5 6.05229 11.5 5.5C11.5 4.94771 11.0523 4.5 10.5 4.5C9.94771 4.5 9.5 4.94771 9.5 5.5C9.5 6.05229 9.94771 6.5 10.5 6.5ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94771 10.5 9.5 10.0523 9.5 9.5C9.5 8.94771 9.94771 8.5 10.5 8.5C11.0523 8.5 11.5 8.94771 11.5 9.5ZM10.5 14.5C11.0523 14.5 11.5 14.0523 11.5 13.5C11.5 12.9477 11.0523 12.5 10.5 12.5C9.94771 12.5 9.5 12.9477 9.5 13.5C9.5 14.0523 9.94771 14.5 10.5 14.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** lucide `star` — the saved-organization badge (OrganizationPicker). */\nexport function StarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"star\", props)}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </svg>\n );\n}\n\n/** lucide `building-2` — the organization glyph (OrganizationPicker trigger). */\nexport function Building2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"building-2\", props)}>\n <path d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\" />\n <path d=\"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2\" />\n <path d=\"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2\" />\n <path d=\"M10 6h4\" />\n <path d=\"M10 10h4\" />\n <path d=\"M10 14h4\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `panel-left` — the sidebar toggle glyph. */\nexport function PanelLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-left\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n </svg>\n );\n}\n\n/** lucide `ellipsis-vertical` — a panel's \"more\" menu. */\nexport function MoreVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"ellipsis-vertical\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `maximize-2` — expand a panel. */\nexport function Maximize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"maximize-2\", props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"m21 3-7 7\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M9 21H3v-6\" />\n </svg>\n );\n}\n\n/** lucide `minimize-2` — restore an expanded panel. */\nexport function Minimize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"minimize-2\", props)}>\n <path d=\"m14 10 7-7\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M4 14h6v6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left`. */\nexport function ArrowLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left\", props)}>\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-right`. */\nexport function ArrowRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-right\", props)}>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up` — the swipe deck's up edge. */\nexport function ArrowUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up\", props)}>\n <path d=\"m5 12 7-7 7 7\" />\n <path d=\"M12 19V5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-down` — the swipe deck's down edge. */\nexport function ArrowDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-down\", props)}>\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n );\n}\n\n/** lucide `undo-2` — take back the last change. */\nexport function Undo2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"undo-2\", props)}>\n <path d=\"M9 14 4 9l5-5\" />\n <path d=\"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\" />\n </svg>\n );\n}\n\n/** lucide `eraser` — forget a marked part. */\nexport function EraserIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eraser\", props)}>\n <path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\" />\n <path d=\"M22 21H7\" />\n <path d=\"m5 11 9 9\" />\n </svg>\n );\n}\n\n/** lucide `rotate-cw` — reload. */\nexport function RotateCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rotate-cw\", props)}>\n <path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n </svg>\n );\n}\n\n/** lucide `globe` — a web page with no favicon. */\nexport function GlobeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"globe\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n );\n}\n\n/** lucide `calendar` — the date field's glyph. */\nexport function CalendarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"calendar\", props)}>\n <path d=\"M8 2v4\" />\n <path d=\"M16 2v4\" />\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\" />\n <path d=\"M3 10h18\" />\n </svg>\n );\n}\n\n/** lucide `clock` — the time field's glyph. */\nexport function ClockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"clock\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <polyline points=\"12 6 12 12 16 14\" />\n </svg>\n );\n}\n\n/** lucide `refresh-cw` — retry / reload. */\nexport function RefreshCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"refresh-cw\", props)}>\n <path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" />\n </svg>\n );\n}\n\n/** lucide `triangle-alert` (alias `AlertTriangle`) — an error or warning. */\nexport function AlertTriangleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"triangle-alert\", props)}>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-check` — a passing state. */\nexport function CircleCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-check\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m16 9-5.5 5.5L8 12\" />\n </svg>\n );\n}\n\n/** lucide `circle-question-mark` (alias `CircleHelp`) — field help. */\nexport function CircleHelpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-question-mark\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-x` — a failing state. */\nexport function CircleXIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-x\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m15 9-6 6\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n );\n}\n\n/** lucide `info` — a row label's help glyph (controls `PropertyRow`). */\nexport function InfoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"info\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-dot` — the \"Get help from Matrx AI\" button glyph (controls `HelpIcon`). */\nexport function CircleDotIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-dot\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `copy` — the Peek's token chip (copy the exact token). */\nexport function CopyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"copy\", props)}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n/** lucide `upload` (moved from @ai-matrx/media). */\nexport function UploadIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"upload\", props)}>\n <path d=\"M12 3v12\" />\n <path d=\"m17 8-5-5-5 5\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n </svg>\n );\n}\n\n/** lucide `circle-alert` — an error or attention state. */\nexport function CircleAlertIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-alert\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n/** lucide `panel-right` — a side pane toggle. */\nexport function PanelRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-right\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `bell` — notifications. */\nexport function BellIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bell\", props)}>\n <path d=\"M10.268 21a2 2 0 0 0 3.464 0\" />\n <path d=\"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\" />\n </svg>\n );\n}\n\n/** lucide `eye-off` — hidden. */\nexport function EyeOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eye-off\", props)}>\n <path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" />\n <path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" />\n <path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `app-window` — open as a window. */\nexport function AppWindowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"app-window\", props)}>\n <rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\" />\n <path d=\"M10 4v4\" />\n <path d=\"M2 8h20\" />\n <path d=\"M6 4v4\" />\n </svg>\n );\n}\n\n/** lucide `video` — a video call or clip. */\nexport function VideoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"video\", props)}>\n <path d=\"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\" />\n <rect x=\"2\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `phone` — a voice call. */\nexport function PhoneIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"phone\", props)}>\n <path d=\"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\" />\n </svg>\n );\n}\n\n/** lucide `sparkles` — AI. */\nexport function SparklesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sparkles\", props)}>\n <path d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\" />\n <path d=\"M20 2v4\" />\n <path d=\"M22 4h-4\" />\n <circle cx=\"4\" cy=\"20\" r=\"2\" />\n </svg>\n );\n}\n\n/** lucide `panels-top-left` — a layout. */\nexport function PanelsTopLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panels-top-left\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"M9 21V9\" />\n </svg>\n );\n}\n\n/** lucide `download`. */\nexport function DownloadIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"download\", props)}>\n <path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `settings`. */\nexport function SettingsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"settings\", props)}>\n <path d=\"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `users`. */\nexport function UsersIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"users\", props)}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <path d=\"M16 3.128a4 4 0 0 1 0 7.744\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n </svg>\n );\n}\n\n/** lucide `grip-vertical` — a drag handle. */\nexport function GripVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip-vertical\", props)}>\n <circle cx=\"9\" cy=\"12\" r=\"1\" />\n <circle cx=\"9\" cy=\"5\" r=\"1\" />\n <circle cx=\"9\" cy=\"19\" r=\"1\" />\n <circle cx=\"15\" cy=\"12\" r=\"1\" />\n <circle cx=\"15\" cy=\"5\" r=\"1\" />\n <circle cx=\"15\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `history`. */\nexport function HistoryIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"history\", props)}>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" />\n </svg>\n );\n}\n\n/** lucide `workflow`. */\nexport function WorkflowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"workflow\", props)}>\n <rect width=\"8\" height=\"8\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M7 11v4a2 2 0 0 0 2 2h4\" />\n <rect width=\"8\" height=\"8\" x=\"13\" y=\"13\" rx=\"2\" />\n </svg>\n );\n}\n\n// ---- Glyphs consolidated from the packages above the design system (one glyph home). ----\n\n/** lucide `activities` (moved from @ai-matrx/meet). */\nexport function ActivitiesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"activities\", props)}>\n <path d=\"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z\" />\n <rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\" />\n <circle cx=\"17.5\" cy=\"17.5\" r=\"3.5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-down-to-line` (moved from @ai-matrx/agents). */\nexport function ArrowDownToLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-down-to-line\", props)}>\n <path d=\"M12 17V3\" />\n <path d=\"m6 11 6 6 6-6\" />\n <path d=\"M19 21H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left-right` (moved from @ai-matrx/diff). */\nexport function ArrowLeftRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left-right\", props)}>\n <path d=\"M8 3 4 7l4 4\" />\n <path d=\"M4 7h16\" />\n <path d=\"m16 21 4-4-4-4\" />\n <path d=\"M20 17H4\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left-to-line` (moved from @ai-matrx/summon). */\nexport function ArrowLeftToLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left-to-line\", props)}>\n <path d=\"M3 19V5\" />\n <path d=\"m13 6-6 6 6 6\" />\n <path d=\"M7 12h14\" />\n </svg>\n );\n}\n\n/** lucide `atom` (moved from @ai-matrx/agents). */\nexport function AtomIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"atom\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <path d=\"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z\" />\n <path d=\"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z\" />\n </svg>\n );\n}\n\n/** lucide `audio-lines` (moved from @ai-matrx/content-ir). */\nexport function AudioLinesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"audio-lines\", props)}>\n <path d=\"M2 10v3\" />\n <path d=\"M6 6v11\" />\n <path d=\"M10 3v18\" />\n <path d=\"M14 8v7\" />\n <path d=\"M18 5v13\" />\n <path d=\"M22 10v3\" />\n </svg>\n );\n}\n\n/** lucide `boxes` (moved from @ai-matrx/associations). */\nexport function BoxesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"boxes\", props)}>\n <path d=\"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z\" />\n <path d=\"m7 16.5-4.74-2.85\" />\n <path d=\"m7 16.5 5-3\" />\n <path d=\"M7 16.5v5.17\" />\n <path d=\"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z\" />\n <path d=\"m17 16.5-5-3\" />\n <path d=\"m17 16.5 4.74-2.85\" />\n <path d=\"M17 16.5v5.17\" />\n <path d=\"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z\" />\n <path d=\"M12 8 7.26 5.15\" />\n <path d=\"m12 8 4.74-2.85\" />\n <path d=\"M12 13.5V8\" />\n </svg>\n );\n}\n\n/** lucide `braces` (moved from @ai-matrx/media). */\nexport function BracesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"braces\", props)}>\n <path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\" />\n <path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\" />\n </svg>\n );\n}\n\n/** lucide `breakout` (moved from @ai-matrx/meet). */\nexport function BreakoutIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"breakout\", props)}>\n <rect width=\"7\" height=\"18\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `camera` (moved from @ai-matrx/meet). */\nexport function CameraIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"camera\", props)}>\n <path d=\"m23 7-7 5 7 5V7Z\" />\n <rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `camera-off` (moved from @ai-matrx/meet). */\nexport function CameraOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"camera-off\", props)}>\n <path d=\"M2 2l20 20\" />\n <path d=\"M10.66 5H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2\" />\n </svg>\n );\n}\n\n/** lucide `captions` (moved from @ai-matrx/meet). */\nexport function CaptionsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"captions\", props)}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M16 10.5a2 2 0 1 0 0 3\" />\n </svg>\n );\n}\n\n/** lucide `chat-bubble` (moved from @ai-matrx/coding-sessions). */\nexport function ChatBubbleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chat-bubble\", props)}>\n <path d=\"M20 12.5a7.5 7.5 0 0 1-10.9 6.7L4 20.5l1.3-4.6A7.5 7.5 0 1 1 20 12.5z\" />\n </svg>\n );\n}\n\n/** lucide `chat` (moved from @ai-matrx/meet). */\nexport function ChatIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chat\", props)}>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z\" />\n </svg>\n );\n}\n\n/** lucide `check-circle-2` (moved from @ai-matrx/media). */\nexport function CheckCircle2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check-circle-2\", props)}>\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n </svg>\n );\n}\n\n/** lucide `chevron-up` (moved from @ai-matrx/meet). */\nexport function ChevronUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-up\", props)}>\n <path d=\"m6 15 6-6 6 6\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-down-up` (moved from @ai-matrx/diff). */\nexport function ChevronsDownUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-down-up\", props)}>\n <path d=\"m7 20 5-5 5 5\" />\n <path d=\"m7 4 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `clock-3` (moved from @ai-matrx/diff). */\nexport function Clock3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"clock-3\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 6v6h4\" />\n </svg>\n );\n}\n\n/** lucide `code-2` (moved from @ai-matrx/office). */\nexport function Code2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"code-2\", props)}>\n <path d=\"m18 16 4-4-4-4\" />\n <path d=\"m6 8-4 4 4 4\" />\n <path d=\"m14.5 4-5 16\" />\n </svg>\n );\n}\n\n/** lucide `code` (moved from @ai-matrx/media). */\nexport function CodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"code\", props)}>\n <path d=\"m16 18 6-6-6-6\" />\n <path d=\"m8 6-6 6 6 6\" />\n </svg>\n );\n}\n\n/** lucide `columns-2` (moved from @ai-matrx/diff). */\nexport function Columns2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"columns-2\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M12 3v18\" />\n </svg>\n );\n}\n\n/** lucide `corner-down-right` (moved from @ai-matrx/associations). */\nexport function CornerDownRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"corner-down-right\", props)}>\n <polyline points=\"15 10 20 15 15 20\" />\n <path d=\"M4 4v7a4 4 0 0 0 4 4h12\" />\n </svg>\n );\n}\n\n/** lucide `database` (moved from @ai-matrx/media). */\nexport function DatabaseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"database\", props)}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n );\n}\n\n/** lucide `dock` (moved from @ai-matrx/canvas). */\nexport function DockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"dock\", props)}>\n <path d=\"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6\" />\n <path d=\"M21 3 12 12\" />\n <path d=\"M12 6v6h6\" />\n </svg>\n );\n}\n\n/** lucide `expand` (moved from @ai-matrx/detail). */\nexport function ExpandIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"expand\", props)}>\n <path d=\"m15 15 6 6\" />\n <path d=\"m15 9 6-6\" />\n <path d=\"M21 16v5h-5\" />\n <path d=\"M21 8V3h-5\" />\n <path d=\"M3 16v5h5\" />\n <path d=\"m3 21 6-6\" />\n <path d=\"M3 8V3h5\" />\n <path d=\"M9 9 3 3\" />\n </svg>\n );\n}\n\n/** lucide `eye` (moved from @ai-matrx/agents). */\nexport function EyeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eye\", props)}>\n <path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `file-archive` (moved from @ai-matrx/content-ir). */\nexport function FileArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-archive\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 6h1\" />\n <path d=\"M10 10h1\" />\n <circle cx=\"10\" cy=\"16\" r=\"2\" />\n <path d=\"M10 2v12\" />\n </svg>\n );\n}\n\n/** lucide `file-audio` (moved from @ai-matrx/media). */\nexport function FileAudioIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-audio\", props)}>\n <path d=\"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0\" />\n </svg>\n );\n}\n\n/** lucide `file-code` (moved from @ai-matrx/media). */\nexport function FileCodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-code\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </svg>\n );\n}\n\n/** lucide `file-json` (moved from @ai-matrx/media). */\nexport function FileJsonIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-json\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1\" />\n <path d=\"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1\" />\n </svg>\n );\n}\n\n/** lucide `file` (moved from @ai-matrx/media). */\nexport function FilePageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n </svg>\n );\n}\n\n/** lucide `file-plus` (moved from @ai-matrx/content-ir). */\nexport function FilePlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-plus\", props)}>\n <path d=\"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n <path d=\"M3 15h6\" />\n <path d=\"M6 12v6\" />\n </svg>\n );\n}\n\n/** lucide `file-spreadsheet` (moved from @ai-matrx/media). */\nexport function FileSpreadsheetIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-spreadsheet\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M8 13h2\" />\n <path d=\"M14 13h2\" />\n <path d=\"M8 17h2\" />\n <path d=\"M14 17h2\" />\n </svg>\n );\n}\n\n/** lucide `file-text` (moved from @ai-matrx/media). */\nexport function FileTextIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-text\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </svg>\n );\n}\n\n/** lucide `file-type` (moved from @ai-matrx/media). */\nexport function FileTypeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-type\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M11 18h2\" />\n <path d=\"M12 12v6\" />\n <path d=\"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5\" />\n </svg>\n );\n}\n\n/** lucide `file-video` (moved from @ai-matrx/media). */\nexport function FileVideoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-video\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z\" />\n </svg>\n );\n}\n\n/** lucide `film` (moved from @ai-matrx/content-ir). */\nexport function FilmIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"film\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M7 3v18\" />\n <path d=\"M3 7.5h4\" />\n <path d=\"M3 12h18\" />\n <path d=\"M3 16.5h4\" />\n <path d=\"M17 3v18\" />\n <path d=\"M17 7.5h4\" />\n <path d=\"M17 16.5h4\" />\n </svg>\n );\n}\n\n/** lucide `flag` (moved from @ai-matrx/meet). */\nexport function FlagIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"flag\", props)}>\n <path d=\"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z\" />\n <line x1=\"4\" x2=\"4\" y1=\"22\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `flip-horizontal-2` (moved from @ai-matrx/capture). */\nexport function FlipHorizontal2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"flip-horizontal-2\", props)}>\n <path d=\"m3 7 5 5-5 5V7\" />\n <path d=\"m21 7-5 5 5 5V7\" />\n <path d=\"M12 20v2\" />\n <path d=\"M12 14v2\" />\n <path d=\"M12 8v2\" />\n <path d=\"M12 2v2\" />\n </svg>\n );\n}\n\n/** lucide `fold-vertical` (moved from @ai-matrx/diff). */\nexport function FoldVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"fold-vertical\", props)}>\n <path d=\"M12 22v-6\" />\n <path d=\"M12 8V2\" />\n <path d=\"M4 12H2\" />\n <path d=\"M10 12H8\" />\n <path d=\"M16 12h-2\" />\n <path d=\"M22 12h-2\" />\n <path d=\"m15 19-3-3-3 3\" />\n <path d=\"m15 5-3 3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `folder` (moved from @ai-matrx/media). */\nexport function FolderIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder\", props)}>\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />\n </svg>\n );\n}\n\n/** lucide `folder-open` (moved from @ai-matrx/media). */\nexport function FolderOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder-open\", props)}>\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `git-merge` (moved from @ai-matrx/diff). */\nexport function GitMergeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"git-merge\", props)}>\n <circle cx=\"18\" cy=\"18\" r=\"3\" />\n <circle cx=\"6\" cy=\"6\" r=\"3\" />\n <path d=\"M6 21V9a9 9 0 0 0 9 9\" />\n </svg>\n );\n}\n\n/** lucide `graduation-cap` (moved from @ai-matrx/office). */\nexport function GraduationCapIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"graduation-cap\", props)}>\n <path d=\"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z\" />\n <path d=\"M22 10v6\" />\n <path d=\"M6 12.5V16a6 3 0 0 0 12 0v-3.5\" />\n </svg>\n );\n}\n\n/** lucide `grid-3x-3` (moved from @ai-matrx/capture). */\nexport function Grid3x3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grid-3x-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"M3 15h18\" />\n <path d=\"M9 3v18\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `grip` (moved from @ai-matrx/capture). */\nexport function GripIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip\", props)}>\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"19\" cy=\"5\" r=\"1\" />\n <circle cx=\"5\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n <circle cx=\"19\" cy=\"19\" r=\"1\" />\n <circle cx=\"5\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `grip-resize` (moved from @ai-matrx/associations). */\nexport function GripResizeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip-resize\", props)}>\n <path d=\"M21 15 15 21\" />\n <path d=\"M21 20 20 21\" />\n </svg>\n );\n}\n\n/** lucide `hammer` (moved from @ai-matrx/agents). */\nexport function HammerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hammer\", props)}>\n <path d=\"m15 12-8.5 8.5c-.83.83-2.17.83-3 0 0 0 0 0 0 0a2.12 2.12 0 0 1 0-3L12 9\" />\n <path d=\"M17.64 15 22 10.64\" />\n <path d=\"m20.91 11.7-1.25-1.25c-.6-.6-.93-1.4-.93-2.25v-.86L16.01 4.6a5.56 5.56 0 0 0-3.94-1.64H9l.92.82A6.18 6.18 0 0 1 12 8.4v1.56l2 2h2.47l2.26 1.91\" />\n </svg>\n );\n}\n\n/** lucide `hand` (moved from @ai-matrx/meet). */\nexport function HandIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hand\", props)}>\n <path d=\"M18 11V6a2 2 0 0 0-4 0v5\" />\n <path d=\"M14 10V4a2 2 0 0 0-4 0v7\" />\n <path d=\"M10 10.5V6a2 2 0 0 0-4 0v8\" />\n <path d=\"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2a8 8 0 0 1-8-8v-1a2 2 0 1 1 4 0\" />\n </svg>\n );\n}\n\n/** lucide `handoff` (moved from @ai-matrx/coding-sessions). */\nexport function HandoffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"handoff\", props)}>\n <path d=\"M5 12h12M13 7l5 5-5 5\" />\n <path d=\"M5 5v14\" />\n </svg>\n );\n}\n\n/** lucide `hash` (moved from @ai-matrx/diff). */\nexport function HashIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hash\", props)}>\n <path d=\"M4 9h16\" />\n <path d=\"M4 15h16\" />\n <path d=\"M10 3 8 21\" />\n <path d=\"M16 3l-2 18\" />\n </svg>\n );\n}\n\n/** lucide `highlighter` (moved from @ai-matrx/diff). */\nexport function HighlighterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"highlighter\", props)}>\n <path d=\"m9 11-6 6v3h9l3-3\" />\n <path d=\"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4\" />\n </svg>\n );\n}\n\n/** lucide `image` (moved from @ai-matrx/media). */\nexport function ImageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"image\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />\n </svg>\n );\n}\n\n/** lucide `image-off` (moved from @ai-matrx/media). */\nexport function ImageOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"image-off\", props)}>\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n <path d=\"M10.41 10.41a2 2 0 1 1-2.83-2.83\" />\n <line x1=\"13.5\" x2=\"6\" y1=\"13.5\" y2=\"21\" />\n <line x1=\"18\" x2=\"21\" y1=\"12\" y2=\"15\" />\n <path d=\"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59\" />\n <path d=\"M21 15V5a2 2 0 0 0-2-2H9\" />\n </svg>\n );\n}\n\n/** lucide `images` (moved from @ai-matrx/capture). */\nexport function ImagesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"images\", props)}>\n <path d=\"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16\" />\n <path d=\"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2\" />\n <circle cx=\"13\" cy=\"7\" r=\"1\" fill=\"currentColor\" />\n <rect x=\"8\" y=\"2\" width=\"14\" height=\"14\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `keyboard` (moved from @ai-matrx/meet). */\nexport function KeyboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"keyboard\", props)}>\n <path d=\"M10 8h.01M12 12h.01M14 8h.01M16 12h.01M18 8h.01M6 8h.01M7 16h10M8 12h.01\" />\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `languages` (moved from @ai-matrx/agents). */\nexport function LanguagesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"languages\", props)}>\n <path d=\"m5 8 6 6\" />\n <path d=\"m4 14 6-6 2-3\" />\n <path d=\"M2 5h12\" />\n <path d=\"M7 2h1\" />\n <path d=\"m22 22-5-10-5 10\" />\n <path d=\"M14 18h6\" />\n </svg>\n );\n}\n\n/** lucide `layers` (moved from @ai-matrx/agents). */\nexport function LayersIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layers\", props)}>\n <path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" />\n <path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" />\n <path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" />\n </svg>\n );\n}\n\n/** lucide `layout-grid` (moved from @ai-matrx/canvas). */\nexport function LayoutGridIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layout-grid\", props)}>\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `link-2` (moved from @ai-matrx/media). */\nexport function Link2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link-2\", props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7h2\" />\n <path d=\"M15 7h2a5 5 0 1 1 0 10h-2\" />\n <line x1=\"8\" x2=\"16\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n/** lucide `list-checks` (moved from @ai-matrx/diff). */\nexport function ListChecksIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list-checks\", props)}>\n <path d=\"m3 17 2 2 4-4\" />\n <path d=\"m3 7 2 2 4-4\" />\n <path d=\"M13 6h8\" />\n <path d=\"M13 12h8\" />\n <path d=\"M13 18h8\" />\n </svg>\n );\n}\n\n/** lucide `list` (moved from @ai-matrx/diff). */\nexport function ListIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list\", props)}>\n <path d=\"M3 12h.01\" />\n <path d=\"M3 18h.01\" />\n <path d=\"M3 6h.01\" />\n <path d=\"M8 12h13\" />\n <path d=\"M8 18h13\" />\n <path d=\"M8 6h13\" />\n </svg>\n );\n}\n\n/** lucide `maximize` (moved from @ai-matrx/content-ir). */\nexport function MaximizeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"maximize\", props)}>\n <polyline points=\"15 3 21 3 21 9\" />\n <polyline points=\"9 21 3 21 3 15\" />\n <line x1=\"21\" x2=\"14\" y1=\"3\" y2=\"10\" />\n <line x1=\"3\" x2=\"10\" y1=\"21\" y2=\"14\" />\n </svg>\n );\n}\n\n/** lucide `megaphone` (moved from @ai-matrx/office). */\nexport function MegaphoneIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"megaphone\", props)}>\n <path d=\"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z\" />\n <path d=\"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14\" />\n <path d=\"M8 6v8\" />\n </svg>\n );\n}\n\n/** lucide `message-square-warning` (moved from @ai-matrx/office). */\nexport function MessageSquareWarningIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-square-warning\", props)}>\n <path d=\"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\" />\n <path d=\"M12 15h.01\" />\n <path d=\"M12 7v4\" />\n </svg>\n );\n}\n\n/** lucide `mic` (moved from @ai-matrx/meet). */\nexport function MicIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mic\", props)}>\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\" />\n <path d=\"M12 19v3\" />\n </svg>\n );\n}\n\n/** lucide `mic-off` (moved from @ai-matrx/meet). */\nexport function MicOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mic-off\", props)}>\n <path d=\"M2 2l20 20\" />\n <path d=\"M9 9v3a3 3 0 0 0 5.12 2.12\" />\n <path d=\"M15 9.34V5a3 3 0 0 0-5.94-.6\" />\n <path d=\"M19 10v2a7 7 0 0 1-.11 1.23M5 10v2a7 7 0 0 0 11 5.66\" />\n <path d=\"M12 19v3\" />\n </svg>\n );\n}\n\n/** lucide `monitor` (moved from @ai-matrx/coding-sessions). */\nexport function MonitorIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"monitor\", props)}>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8.5 20h7M12 16.5V20\" />\n </svg>\n );\n}\n\n/** lucide `moon` (moved from @ai-matrx/coding-sessions). */\nexport function MoonIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"moon\", props)}>\n <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z\" />\n </svg>\n );\n}\n\n/** lucide `music` (moved from @ai-matrx/media). */\nexport function MusicIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"music\", props)}>\n <path d=\"M9 18V5l12-2v13\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" />\n <circle cx=\"18\" cy=\"16\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `notes` (moved from @ai-matrx/meet). */\nexport function NotesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"notes\", props)}>\n <path d=\"M4 20l1-4L16.5 4.5a2.1 2.1 0 0 1 3 3L8 19l-4 1Z\" />\n <path d=\"M14 7l3 3\" />\n </svg>\n );\n}\n\n/** lucide `package-box` (moved from @ai-matrx/media). */\nexport function PackageBoxIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"package-box\", props)}>\n <path d=\"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z\" />\n <path d=\"M12 22V12\" />\n <polyline points=\"3.29 7 12 12 20.71 7\" />\n <path d=\"m7.5 4.27 9 5.15\" />\n </svg>\n );\n}\n\n/** lucide `page` (moved from @ai-matrx/canvas). */\nexport function PageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"page\", props)}>\n <rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\" />\n <path d=\"M8 9h8\" />\n <path d=\"M8 13h8\" />\n <path d=\"M8 17h5\" />\n </svg>\n );\n}\n\n/** lucide `panel-left-close` (moved from @ai-matrx/summon). */\nexport function PanelLeftCloseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-left-close\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m16 15-3-3 3-3\" />\n </svg>\n );\n}\n\n/** lucide `pause` (moved from @ai-matrx/media). */\nexport function PauseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pause\", props)}>\n <rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n <rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `pen-tool` (moved from @ai-matrx/media). */\nexport function PenToolIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pen-tool\", props)}>\n <path d=\"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z\" />\n <path d=\"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18\" />\n <path d=\"m2.3 2.3 7.286 7.286\" />\n <circle cx=\"11\" cy=\"11\" r=\"2\" />\n </svg>\n );\n}\n\n/** lucide `people` (moved from @ai-matrx/meet). */\nexport function PeopleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"people\", props)}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n );\n}\n\n/** lucide `phone-off` (moved from @ai-matrx/meet). */\nexport function PhoneOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"phone-off\", props)}>\n <path d=\"M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.99.99 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9Z\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `play` (moved from @ai-matrx/media). */\nexport function PlayIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"play\", props)}>\n <path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />\n </svg>\n );\n}\n\n/** lucide `poll` (moved from @ai-matrx/meet). */\nexport function PollIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"poll\", props)}>\n <line x1=\"18\" x2=\"18\" y1=\"20\" y2=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"20\" y2=\"4\" />\n <line x1=\"6\" x2=\"6\" y1=\"20\" y2=\"14\" />\n </svg>\n );\n}\n\n/** lucide `proportions` (moved from @ai-matrx/capture). */\nexport function ProportionsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"proportions\", props)}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"M12 9v11\" />\n <path d=\"M2 9h13a2 2 0 0 1 2 2v9\" />\n </svg>\n );\n}\n\n/** lucide `puzzle` (moved from @ai-matrx/office). */\nexport function PuzzleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"puzzle\", props)}>\n <path d=\"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z\" />\n </svg>\n );\n}\n\n/** lucide `question` (moved from @ai-matrx/meet). */\nexport function QuestionIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"question\", props)}>\n <path d=\"M7.9 20A9 9 0 1 0 4 16.1L2 22Z\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `record` (moved from @ai-matrx/meet). */\nexport function RecordIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"record\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"8\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `rectangle-vertical` (moved from @ai-matrx/summon). */\nexport function RectangleVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rectangle-vertical\", props)}>\n <rect width=\"12\" height=\"20\" x=\"6\" y=\"2\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `restore` (moved from @ai-matrx/associations). */\nexport function RestoreIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"restore\", props)}>\n <path d=\"M4 14h6v6\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"M14 10l7-7\" />\n <path d=\"M3 21l7-7\" />\n </svg>\n );\n}\n\n/** lucide `rotate-ccw` (moved from @ai-matrx/capture). */\nexport function RotateCcwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rotate-ccw\", props)}>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n );\n}\n\n/** lucide `rows-3` (moved from @ai-matrx/diff). */\nexport function Rows3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rows-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M21 9H3\" />\n <path d=\"M21 15H3\" />\n </svg>\n );\n}\n\n/** lucide `save` (moved from @ai-matrx/summon). */\nexport function SaveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"save\", props)}>\n <path d=\"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\" />\n <path d=\"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7\" />\n <path d=\"M7 3v4a1 1 0 0 0 1 1h7\" />\n </svg>\n );\n}\n\n/** lucide `scale` (moved from @ai-matrx/agents). */\nexport function ScaleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"scale\", props)}>\n <path d=\"M12 3v18\" />\n <path d=\"m19 8 3 8a5 5 0 0 1-6 0zV7\" />\n <path d=\"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1\" />\n <path d=\"m5 8 3 8a5 5 0 0 1-6 0zV7\" />\n <path d=\"M7 21h10\" />\n </svg>\n );\n}\n\n/** lucide `screen-share` (moved from @ai-matrx/meet). */\nexport function ScreenShareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"screen-share\", props)}>\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" />\n <path d=\"M8 21h8M12 17v4\" />\n <path d=\"M12 13V8m0 0-2.5 2.5M12 8l2.5 2.5\" />\n </svg>\n );\n}\n\n/** lucide `server` (moved from @ai-matrx/agents). */\nexport function ServerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"server\", props)}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n/** lucide `settings-2` (moved from @ai-matrx/media). */\nexport function Settings2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"settings-2\", props)}>\n <path d=\"M20 7h-9\" />\n <path d=\"M14 17H5\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `share-2` (moved from @ai-matrx/media). */\nexport function Share2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"share-2\", props)}>\n <circle cx=\"18\" cy=\"5\" r=\"3\" />\n <circle cx=\"6\" cy=\"12\" r=\"3\" />\n <circle cx=\"18\" cy=\"19\" r=\"3\" />\n <line x1=\"8.59\" x2=\"15.42\" y1=\"13.51\" y2=\"17.49\" />\n <line x1=\"15.41\" x2=\"8.59\" y1=\"6.51\" y2=\"10.49\" />\n </svg>\n );\n}\n\n/** lucide `shield-alert` (moved from @ai-matrx/detail). */\nexport function ShieldAlertIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-alert\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n </svg>\n );\n}\n\n/** lucide `shield-check` (moved from @ai-matrx/detail). */\nexport function ShieldCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-check\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n\n/** lucide `badge-check` — the verified mark. */\nexport function BadgeCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"badge-check\", props)}>\n <path d=\"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n\n/** lucide `shield` (moved from @ai-matrx/agents). */\nexport function ShieldIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n );\n}\n\n/** lucide `sidebar` (moved from @ai-matrx/coding-sessions). */\nexport function SidebarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sidebar\", props)}>\n <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2.5\" />\n <path d=\"M9.5 4.5v15\" />\n </svg>\n );\n}\n\n/** lucide `sliders-horizontal` (moved from @ai-matrx/agents). */\nexport function SlidersHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sliders-horizontal\", props)}>\n <path d=\"M10 5H3\" />\n <path d=\"M12 19H3\" />\n <path d=\"M14 3v4\" />\n <path d=\"M16 17v4\" />\n <path d=\"M21 12h-9\" />\n <path d=\"M21 19h-5\" />\n <path d=\"M21 5h-7\" />\n <path d=\"M8 10v4\" />\n <path d=\"M8 12H3\" />\n </svg>\n );\n}\n\n/** lucide `smile` (moved from @ai-matrx/meet). */\nexport function SmileIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"smile\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 14s1.5 2 4 2 4-2 4-2\" />\n <line x1=\"9\" x2=\"9.01\" y1=\"9\" y2=\"9\" />\n <line x1=\"15\" x2=\"15.01\" y1=\"9\" y2=\"9\" />\n </svg>\n );\n}\n\n/** lucide `speaker` (moved from @ai-matrx/meet). */\nexport function SpeakerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"speaker\", props)}>\n <path d=\"M11 5 6 9H2v6h4l5 4V5Z\" />\n <path d=\"M15.54 8.46a5 5 0 0 1 0 7.07\" />\n <path d=\"M19.07 4.93a10 10 0 0 1 0 14.14\" />\n </svg>\n );\n}\n\n/** lucide `split-down` (moved from @ai-matrx/canvas). */\nexport function SplitDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"split-down\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 12h18\" />\n </svg>\n );\n}\n\n/** lucide `spotlight` (moved from @ai-matrx/meet). */\nexport function SpotlightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"spotlight\", props)}>\n <path d=\"M12 2 15 8.5 22 9.3 17 14 18.2 21 12 17.6 5.8 21 7 14 2 9.3 9 8.5Z\" />\n </svg>\n );\n}\n\n/** lucide `stop` (moved from @ai-matrx/coding-sessions). */\nexport function StopIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"stop\", props)}>\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `subtitles` (moved from @ai-matrx/media). */\nexport function SubtitlesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"subtitles\", props)}>\n <rect width=\"18\" height=\"14\" x=\"3\" y=\"5\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 15h4M15 15h2M7 11h2M13 11h4\" />\n </svg>\n );\n}\n\n/** lucide `sun` (moved from @ai-matrx/coding-sessions). */\nexport function SunIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sun\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2.5v2M12 19.5v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M2.5 12h2M19.5 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4\" />\n </svg>\n );\n}\n\n/** lucide `sun-medium` (moved from @ai-matrx/capture). */\nexport function SunMediumIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sun-medium\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 3v1\" />\n <path d=\"M12 20v1\" />\n <path d=\"M3 12h1\" />\n <path d=\"M20 12h1\" />\n <path d=\"m18.364 5.636-.707.707\" />\n <path d=\"m6.343 17.657-.707.707\" />\n <path d=\"m5.636 5.636.707.707\" />\n <path d=\"m17.657 17.657.707.707\" />\n </svg>\n );\n}\n\n/** lucide `tag` (moved from @ai-matrx/associations). */\nexport function TagIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"tag\", props)}>\n <path d=\"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z\" />\n <circle cx=\"7.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\" />\n </svg>\n );\n}\n\n/** lucide `timer` (moved from @ai-matrx/capture). */\nexport function TimerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"timer\", props)}>\n <line x1=\"10\" x2=\"14\" y1=\"2\" y2=\"2\" />\n <line x1=\"12\" x2=\"15\" y1=\"14\" y2=\"11\" />\n <circle cx=\"12\" cy=\"14\" r=\"8\" />\n </svg>\n );\n}\n\n/** lucide `type` (moved from @ai-matrx/agents). */\nexport function TypeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"type\", props)}>\n <path d=\"M12 4v16\" />\n <path d=\"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2\" />\n <path d=\"M9 20h6\" />\n </svg>\n );\n}\n\n/** lucide `unfold-vertical` (moved from @ai-matrx/diff). */\nexport function UnfoldVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"unfold-vertical\", props)}>\n <path d=\"M12 22v-6\" />\n <path d=\"M12 8V2\" />\n <path d=\"M4 12H2\" />\n <path d=\"M10 12H8\" />\n <path d=\"M16 12h-2\" />\n <path d=\"M22 12h-2\" />\n <path d=\"m15 19-3 3-3-3\" />\n <path d=\"m15 5-3-3-3 3\" />\n </svg>\n );\n}\n\n/** lucide `unlink` (moved from @ai-matrx/agents). */\nexport function UnlinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"unlink\", props)}>\n <path d=\"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" />\n <path d=\"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" />\n <line x1=\"8\" x2=\"8\" y1=\"2\" y2=\"5\" />\n <line x1=\"2\" x2=\"5\" y1=\"8\" y2=\"8\" />\n <line x1=\"16\" x2=\"16\" y1=\"19\" y2=\"22\" />\n <line x1=\"19\" x2=\"22\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n/** lucide `upvote` (moved from @ai-matrx/meet). */\nexport function UpvoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"upvote\", props)}>\n <path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\" />\n </svg>\n );\n}\n\n/** lucide `variable` (moved from @ai-matrx/agents). */\nexport function VariableIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"variable\", props)}>\n <path d=\"M8 21s-4-3-4-9 4-9 4-9\" />\n <path d=\"M16 3s4 3 4 9-4 9-4 9\" />\n <line x1=\"15\" x2=\"9\" y1=\"9\" y2=\"15\" />\n <line x1=\"9\" x2=\"15\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `video-off` (moved from @ai-matrx/media). */\nexport function VideoOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"video-off\", props)}>\n <path d=\"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `volume-x` (moved from @ai-matrx/media). */\nexport function VolumeXIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"volume-x\", props)}>\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <line x1=\"22\" x2=\"16\" y1=\"9\" y2=\"15\" />\n <line x1=\"16\" x2=\"22\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `webhook` (moved from @ai-matrx/agents). */\nexport function WebhookIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"webhook\", props)}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n );\n}\n\n/** lucide `whiteboard` (moved from @ai-matrx/meet). */\nexport function WhiteboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"whiteboard\", props)}>\n <path d=\"M2 3h20\" />\n <path d=\"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3\" />\n <path d=\"m7 21 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `wifi-low` (moved from @ai-matrx/meet). */\nexport function WifiLowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wifi-low\", props)}>\n <path d=\"M12 20h.01\" />\n <path d=\"M8.5 16.5a5 5 0 0 1 7 0\" />\n </svg>\n );\n}\n\n/** lucide `wrap-text` (moved from @ai-matrx/diff). */\nexport function WrapTextIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wrap-text\", props)}>\n <path d=\"M3 6h18\" />\n <path d=\"M3 12h15a3 3 0 1 1 0 6h-4\" />\n <path d=\"m16 16-2 2 2 2\" />\n <path d=\"M3 18h7\" />\n </svg>\n );\n}\n\n/** lucide `wrench` (moved from @ai-matrx/agents). */\nexport function WrenchIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wrench\", props)}>\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z\" />\n </svg>\n );\n}\n\n/** lucide `youtube` (moved from @ai-matrx/agents). */\nexport function YoutubeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"youtube\", props)}>\n <path d=\"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17\" />\n <path d=\"m10 15 5-3-5-3z\" />\n </svg>\n );\n}\n\n/** lucide `zap` (moved from @ai-matrx/capture). */\nexport function ZapIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"zap\", props)}>\n <path d=\"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\" />\n </svg>\n );\n}\n\n/** lucide `zap-off` (moved from @ai-matrx/capture). */\nexport function ZapOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"zap-off\", props)}>\n <path d=\"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317\" />\n <path d=\"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773\" />\n <path d=\"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `log-in` — the sign-in action of the auth gate. */\nexport function LogInIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"log-in\", props)}>\n <path d=\"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4\" />\n <polyline points=\"10 17 15 12 10 7\" />\n <line x1=\"15\" x2=\"3\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n/** lucide `gem` — the create-account action of the auth gate. */\nexport function GemIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"gem\", props)}>\n <path d=\"M6 3h12l4 6-10 13L2 9Z\" />\n <path d=\"M11 3 8 9l4 13 4-13-3-6\" />\n <path d=\"M2 9h20\" />\n </svg>\n );\n}\n\n/** lucide `key`. */\nexport function KeyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"key\", props)}>\n <path d=\"m2 21 9.6-9.6\" />\n <path d=\"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19\" />\n <circle cx=\"15.5\" cy=\"7.5\" r=\"5.5\" />\n </svg>\n );\n}\n\n/** lucide `credit-card`. */\nexport function CreditCardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"credit-card\", props)}>\n <rect width=\"20\" height=\"14\" x=\"2\" y=\"5\" rx=\"2\" />\n <line x1=\"2\" x2=\"22\" y1=\"10\" y2=\"10\" />\n <path d=\"M6 14h2\" />\n </svg>\n );\n}\n\n/** lucide `user-round`. */\nexport function UserRoundIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"user-round\", props)}>\n <circle cx=\"12\" cy=\"8\" r=\"5\" />\n <path d=\"M20 21a8 8 0 0 0-16 0\" />\n </svg>\n );\n}\n\n/** lucide `user`. */\nexport function UserIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"user\", props)}>\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n );\n}\n\n/** lucide `terminal`. */\nexport function TerminalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"terminal\", props)}>\n <path d=\"M12 19h8\" />\n <path d=\"m4 17 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `trash`. */\nexport function TrashIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"trash\", props)}>\n <path d=\"M10 11v6\" />\n <path d=\"M14 11v6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" />\n <path d=\"M3 6h18\" />\n <path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `building`. */\nexport function BuildingIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"building\", props)}>\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3\" />\n <rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `plug`. */\nexport function PlugIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"plug\", props)}>\n <path d=\"M12 22v-5\" />\n <path d=\"M15 8V2\" />\n <path d=\"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z\" />\n <path d=\"M9 8V2\" />\n </svg>\n );\n}\n\n/** lucide `share`. */\nexport function ShareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"share\", props)}>\n <path d=\"M12 2v13\" />\n <path d=\"m16 6-4-4-4 4\" />\n <path d=\"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-down`. */\nexport function ArrowUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-down\", props)}>\n <path d=\"m21 16-4 4-4-4\" />\n <path d=\"M17 20V4\" />\n <path d=\"m3 8 4-4 4 4\" />\n <path d=\"M7 4v16\" />\n </svg>\n );\n}\n\n/** lucide `move`. */\nexport function MoveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"move\", props)}>\n <path d=\"M12 2v20\" />\n <path d=\"m15 19-3 3-3-3\" />\n <path d=\"m19 9 3 3-3 3\" />\n <path d=\"M2 12h20\" />\n <path d=\"m5 9-3 3 3 3\" />\n <path d=\"m9 5 3-3 3 3\" />\n </svg>\n );\n}\n\n/** lucide `qr-code`. */\nexport function QrCodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"qr-code\", props)}>\n <rect width=\"5\" height=\"5\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"5\" height=\"5\" x=\"16\" y=\"3\" rx=\"1\" />\n <rect width=\"5\" height=\"5\" x=\"3\" y=\"16\" rx=\"1\" />\n <path d=\"M21 16h-3a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 21v.01\" />\n <path d=\"M12 7v3a2 2 0 0 1-2 2H7\" />\n <path d=\"M3 12h.01\" />\n <path d=\"M12 3h.01\" />\n <path d=\"M12 16v.01\" />\n <path d=\"M16 12h1\" />\n <path d=\"M21 12v.01\" />\n <path d=\"M12 21v-1\" />\n </svg>\n );\n}\n\n/** lucide `power`. */\nexport function PowerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"power\", props)}>\n <path d=\"M12 2v10\" />\n <path d=\"M18.4 6.6a9 9 0 1 1-12.77.04\" />\n </svg>\n );\n}\n\n/** lucide `sliders-vertical`. */\nexport function SlidersVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sliders-vertical\", props)}>\n <path d=\"M10 8h4\" />\n <path d=\"M12 21v-9\" />\n <path d=\"M12 8V3\" />\n <path d=\"M17 16h4\" />\n <path d=\"M19 12V3\" />\n <path d=\"M19 21v-5\" />\n <path d=\"M3 14h4\" />\n <path d=\"M5 10V3\" />\n <path d=\"M5 21v-7\" />\n </svg>\n );\n}\n\n/** lucide `fingerprint-pattern`. */\nexport function FingerprintPatternIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"fingerprint-pattern\", props)}>\n <path d=\"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4\" />\n <path d=\"M14 13.12c0 2.38 0 6.38-1 8.88\" />\n <path d=\"M17.29 21.02c.12-.6.43-2.3.5-3.02\" />\n <path d=\"M2 12a10 10 0 0 1 18-6\" />\n <path d=\"M2 16h.01\" />\n <path d=\"M21.8 16c.2-2 .131-5.354 0-6\" />\n <path d=\"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2\" />\n <path d=\"M8.65 22c.21-.66.45-1.32.57-2\" />\n <path d=\"M9 6.8a6 6 0 0 1 9 5.2v2\" />\n </svg>\n );\n}\n\n/** lucide `send`. */\nexport function SendIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"send\", props)}>\n <path d=\"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\" />\n <path d=\"m21.854 2.147-10.94 10.939\" />\n </svg>\n );\n}\n\n/** lucide `paperclip`. */\nexport function PaperclipIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"paperclip\", props)}>\n <path d=\"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\" />\n </svg>\n );\n}\n\n/** lucide `check-check`. */\nexport function CheckCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check-check\", props)}>\n <path d=\"M18 6 7 17l-5-5\" />\n <path d=\"m22 10-7.5 7.5L13 16\" />\n </svg>\n );\n}\n\n/** lucide `reply`. */\nexport function ReplyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"reply\", props)}>\n <path d=\"M20 18v-2a4 4 0 0 0-4-4H4\" />\n <path d=\"m9 17-5-5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `link`. */\nexport function LinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link\", props)}>\n <path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n <path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n </svg>\n );\n}\n\n/** lucide `bot`. */\nexport function BotIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bot\", props)}>\n <path d=\"M12 8V4H8\" />\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\" />\n <path d=\"M2 14h2\" />\n <path d=\"M20 14h2\" />\n <path d=\"M15 13v2\" />\n <path d=\"M9 13v2\" />\n </svg>\n );\n}\n\n/** lucide `bell-off`. */\nexport function BellOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bell-off\", props)}>\n <path d=\"M10.268 21a2 2 0 0 0 3.464 0\" />\n <path d=\"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742\" />\n <path d=\"m2 2 20 20\" />\n <path d=\"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05\" />\n </svg>\n );\n}\n\n/** lucide `mail`. */\nexport function MailIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mail\", props)}>\n <path d=\"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7\" />\n <rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `mail-open`. */\nexport function MailOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mail-open\", props)}>\n <path d=\"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z\" />\n <path d=\"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10\" />\n </svg>\n );\n}\n\n/** lucide `folder-input`. */\nexport function FolderInputIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder-input\", props)}>\n <path d=\"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1\" />\n <path d=\"M2 13h10\" />\n <path d=\"m9 16 3-3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `star-off`. */\nexport function StarOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"star-off\", props)}>\n <path d=\"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152\" />\n <path d=\"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `columns-3`. */\nexport function Columns3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"columns-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `blocks`. */\nexport function BlocksIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"blocks\", props)}>\n <path d=\"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2\" />\n <rect x=\"14\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `calendar-clock`. */\nexport function CalendarClockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"calendar-clock\", props)}>\n <path d=\"M16 14v2.2l1.6 1\" />\n <path d=\"M16 2v3\" />\n <path d=\"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338\" />\n <path d=\"M3 9h5.859\" />\n <path d=\"M8 2v3\" />\n <circle cx=\"16\" cy=\"16\" r=\"6\" />\n </svg>\n );\n}\n\n/** lucide `door-open`. */\nexport function DoorOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"door-open\", props)}>\n <path d=\"M10 21H2\" />\n <path d=\"M10 3H7a2 2 0 00-2 2v16\" />\n <path d=\"M14 12h.01\" />\n <path d=\"M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z\" />\n <path d=\"M22 21h-3\" />\n </svg>\n );\n}\n\n/** lucide `inbox`. */\nexport function InboxIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"inbox\", props)}>\n <polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </svg>\n );\n}\n\n/** lucide `layout-dashboard`. */\nexport function LayoutDashboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layout-dashboard\", props)}>\n <rect width=\"7\" height=\"9\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"5\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"9\" x=\"14\" y=\"12\" rx=\"1\" />\n <rect width=\"7\" height=\"5\" x=\"3\" y=\"16\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `archive-restore`. */\nexport function ArchiveRestoreIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"archive-restore\", props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h2\" />\n <path d=\"M20 8v11a2 2 0 0 1-2 2h-2\" />\n <path d=\"m9 15 3-3 3 3\" />\n <path d=\"M12 12v9\" />\n </svg>\n );\n}\n\n/** lucide `split`. */\nexport function SplitIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"split\", props)}>\n <path d=\"M16 3h5v5\" />\n <path d=\"M8 3H3v5\" />\n <path d=\"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3\" />\n <path d=\"m15 9 6-6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-from-line`. */\nexport function ArrowUpFromLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-from-line\", props)}>\n <path d=\"m18 9-6-6-6 6\" />\n <path d=\"M12 3v14\" />\n <path d=\"M5 21h14\" />\n </svg>\n );\n}\n\n/** lucide `lock-open`. */\nexport function LockOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lock-open\", props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 9.9-1\" />\n </svg>\n );\n}\n\n/** lucide `printer`. */\nexport function PrinterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"printer\", props)}>\n <path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\" />\n <path d=\"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6\" />\n <rect x=\"6\" y=\"14\" width=\"12\" height=\"8\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `rocket`. */\nexport function RocketIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rocket\", props)}>\n <path d=\"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5\" />\n <path d=\"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09\" />\n <path d=\"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z\" />\n <path d=\"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05\" />\n </svg>\n );\n}\n\n/** lucide `message-circle`. */\nexport function MessageCircleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-circle\", props)}>\n <path d=\"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\" />\n </svg>\n );\n}\n\n/** lucide `copy-plus`. */\nexport function CopyPlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"copy-plus\", props)}>\n <line x1=\"15\" x2=\"15\" y1=\"12\" y2=\"18\" />\n <line x1=\"12\" x2=\"18\" y1=\"15\" y2=\"15\" />\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n/** lucide `map-pin`. */\nexport function MapPinIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"map-pin\", props)}>\n <path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" />\n <circle cx=\"12\" cy=\"10\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `at-sign`. */\nexport function AtSignIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"at-sign\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8\" />\n </svg>\n );\n}\n\n/** lucide `link-2-off`. */\nexport function Link2OffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link-2-off\", props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7\" />\n <path d=\"M15 7h2a5 5 0 0 1 4 8\" />\n <line x1=\"8\" x2=\"12\" y1=\"12\" y2=\"12\" />\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n </svg>\n );\n}\n\n/** lucide `whole-word`. */\nexport function WholeWordIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"whole-word\", props)}>\n <circle cx=\"7\" cy=\"12\" r=\"3\" />\n <path d=\"M10 9v6\" />\n <circle cx=\"17\" cy=\"12\" r=\"3\" />\n <path d=\"M14 7v8\" />\n <path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\" />\n </svg>\n );\n}\n\n/** lucide `lightbulb`. */\nexport function LightbulbIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lightbulb\", props)}>\n <path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" />\n <path d=\"M9 18h6\" />\n <path d=\"M10 22h4\" />\n </svg>\n );\n}\n\n/** lucide `shield-off`. */\nexport function ShieldOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-off\", props)}>\n <path d=\"m2 2 20 20\" />\n <path d=\"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71\" />\n <path d=\"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-left`. */\nexport function ChevronsLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-left\", props)}>\n <path d=\"m11 17-5-5 5-5\" />\n <path d=\"m18 17-5-5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-right`. */\nexport function ChevronsRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-right\", props)}>\n <path d=\"m6 17 5-5-5-5\" />\n <path d=\"m13 17 5-5-5-5\" />\n </svg>\n );\n}\n\n/** lucide `users-round`. */\nexport function UsersRoundIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"users-round\", props)}>\n <path d=\"M18 21a8 8 0 0 0-16 0\" />\n <circle cx=\"10\" cy=\"8\" r=\"5\" />\n <path d=\"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3\" />\n </svg>\n );\n}\n\n/** lucide `landmark`. */\nexport function LandmarkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"landmark\", props)}>\n <path d=\"M10 18v-7\" />\n <path d=\"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z\" />\n <path d=\"M14 18v-7\" />\n <path d=\"M18 18v-7\" />\n <path d=\"M3 22h18\" />\n <path d=\"M6 18v-7\" />\n </svg>\n );\n}\n\n/** lucide `factory`. */\nexport function FactoryIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"factory\", props)}>\n <path d=\"M12 16h.01\" />\n <path d=\"M16 16h.01\" />\n <path d=\"M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z\" />\n <path d=\"M8 16h.01\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-down` — CollapsibleText's \"expand all\". */\nexport function ChevronsDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-down\", props)}>\n <path d=\"m7 6 5 5 5-5\" />\n <path d=\"m7 13 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up` — CollapsibleText's \"collapse all\". */\nexport function ChevronsUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-up\", props)}>\n <path d=\"m17 11-5-5-5 5\" />\n <path d=\"m17 18-5-5-5 5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-right` — CitationChip's \"open source\". */\nexport function ArrowUpRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-right\", props)}>\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n\n/** lucide `quote` — CitationChip's excerpt blockquote. */\nexport function QuoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"quote\", props)}>\n <path d=\"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\" />\n <path d=\"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\" />\n </svg>\n );\n}\n\n/** lucide `panel-top-open` — the floating dock's phone menu button (opens the list). */\nexport function PanelTopOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-top-open\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"m15 14-3 3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `panel-top-close` — the floating dock's phone menu button (closes the list). */\nexport function PanelTopCloseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-top-close\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"m9 16 3-3 3 3\" />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * The deck's chrome: the four edge buttons, the corner buttons, and the full-screen wash.\n * Hot / wash state is written straight to the DOM (no React render per pointer move).\n */\nimport * as React from \"react\";\n\nimport { ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon } from \"../icons\";\nimport { hideWash, showWash } from \"./visual\";\nimport type { DeckAnswer, DeckDirection, DeckKey } from \"./model\";\n\nconst ARROWS: Record<DeckDirection, React.ComponentType<React.SVGAttributes<SVGSVGElement>>> = {\n right: ArrowRightIcon,\n left: ArrowLeftIcon,\n up: ArrowUpIcon,\n down: ArrowDownIcon,\n};\n\nexport const KEY_GLYPH: Record<DeckDirection, string> = { right: \"→\", up: \"↑\", left: \"←\", down: \"↓\" };\n\n/** The answer's own icon, else the arrow of the edge it sits on (an answer off the edges has none). */\nexport function AnswerGlyph({ answer, dir }: { answer: DeckAnswer; dir: DeckDirection | null }) {\n if (answer.icon) return <>{answer.icon}</>;\n if (!dir) return null;\n const Arrow = ARROWS[dir];\n return <Arrow />;\n}\n\nexport type EdgeRefs = Partial<Record<DeckDirection, HTMLButtonElement | null>>;\n\nexport function setHot(refs: EdgeRefs, dir: DeckDirection | null): void {\n for (const d of Object.keys(refs) as DeckDirection[]) {\n const el = refs[d];\n if (!el) continue;\n if (d === dir) el.setAttribute(\"data-hot\", \"\");\n else el.removeAttribute(\"data-hot\");\n }\n}\n\nexport interface EdgeButtonsProps {\n readonly keyMap: DeckKey;\n readonly suggested: DeckDirection | null;\n readonly refs: React.MutableRefObject<EdgeRefs>;\n readonly onAnswer: (dir: DeckDirection) => void;\n readonly suggestionLabel: string;\n readonly disabled?: boolean;\n}\n\n/** One large button on each enabled edge, where its swipe goes. */\nexport function EdgeButtons({ keyMap, suggested, refs, onAnswer, suggestionLabel, disabled }: EdgeButtonsProps) {\n return (\n <>\n {([\"up\", \"left\", \"right\", \"down\"] as const).map((dir) => {\n const answer = keyMap[dir];\n if (!answer) return null;\n const isSuggested = dir === suggested;\n return (\n // ui-exception: the deck's edge targets are its own geometry (the swipe they mirror), not a form control\n <button\n key={dir}\n ref={(el) => {\n refs.current[dir] = el;\n }}\n type=\"button\"\n className=\"matrx-sd-edge\"\n data-dir={dir}\n data-tone={answer.tone}\n data-suggested={isSuggested ? \"\" : undefined}\n aria-label={isSuggested ? `${answer.label} (${suggestionLabel})` : answer.label}\n aria-keyshortcuts={{ right: \"ArrowRight\", left: \"ArrowLeft\", up: \"ArrowUp\", down: \"ArrowDown\" }[dir]}\n title={`${answer.label} ${KEY_GLYPH[dir]}`}\n disabled={disabled}\n onClick={() => onAnswer(dir)}\n >\n <AnswerGlyph answer={answer} dir={dir} />\n </button>\n );\n })}\n </>\n );\n}\n\nexport interface CornerButtonProps {\n readonly corner: \"tl\" | \"tr\" | \"bl\" | \"br\";\n readonly label: string;\n readonly shortcut?: string;\n readonly onClick: () => void;\n readonly disabled?: boolean;\n readonly pressed?: boolean;\n readonly children: React.ReactNode;\n}\n\nexport function CornerButton({ corner, label, shortcut, onClick, disabled, pressed, children }: CornerButtonProps) {\n return (\n // ui-exception: the deck's four corner targets sit in its own frame geometry\n <button\n type=\"button\"\n className=\"matrx-sd-corner\"\n data-corner={corner}\n aria-label={label}\n title={shortcut ? `${label} (${shortcut})` : label}\n aria-keyshortcuts={shortcut}\n disabled={disabled}\n aria-pressed={pressed}\n onClick={onClick}\n >\n {children}\n </button>\n );\n}\n\nexport interface WashHandle {\n show(answer: DeckAnswer, dir: DeckDirection | null, amount: number): void;\n hide(): void;\n}\n\n/** The whole screen takes the answer's color and shows its name big, the moment a drag starts. */\nexport const Wash = React.forwardRef<WashHandle>(function Wash(_props, ref) {\n const bg = React.useRef<HTMLDivElement>(null);\n const label = React.useRef<HTMLDivElement>(null);\n const [shown, setShown] = React.useState<{ answer: DeckAnswer; dir: DeckDirection | null } | null>(null);\n React.useImperativeHandle(\n ref,\n () => ({\n show(answer, dir, amount) {\n setShown((cur) => (cur && cur.answer.id === answer.id && cur.dir === dir ? cur : { answer, dir }));\n showWash(bg.current, label.current, amount);\n },\n hide() {\n hideWash(bg.current, label.current);\n },\n }),\n [],\n );\n return (\n <div className=\"matrx-sd-wash\" aria-hidden=\"true\" data-tone={shown?.answer.tone}>\n <div ref={bg} className=\"matrx-sd-wash-bg\" />\n <div ref={label} className=\"matrx-sd-wash-label\">\n {shown ? <AnswerGlyph answer={shown.answer} dir={shown.dir} /> : null}\n <b>{shown?.answer.label}</b>\n </div>\n </div>\n );\n});\n","/**\n * The deck's direct-to-DOM motion: card follow, snap back, fly out, enter, the full-screen wash,\n * and the text fit. Each writes `transform`/`opacity` only (compositor properties) and never\n * React state, so dragging stays on the 60fps path.\n */\nimport type { DeckDirection } from \"./model\";\n\nexport const VECTOR: Record<DeckDirection, readonly [number, number]> = {\n right: [1, 0],\n left: [-1, 0],\n up: [0, -1],\n down: [0, 1],\n};\n\n/** A short buzz, only once the page has had a tap (browsers refuse, and say so, before one). */\nexport function buzz(nav: Navigator | undefined, ms: number): void {\n try {\n const activation = (nav as (Navigator & { userActivation?: { hasBeenActive: boolean } }) | undefined)?.userActivation;\n if (activation && !activation.hasBeenActive) return;\n nav?.vibrate?.(ms);\n } catch {\n /* no haptics */\n }\n}\n\nexport function prefersReducedMotion(): boolean {\n try {\n return typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n } catch {\n return false;\n }\n}\n\nexport function finePointer(): boolean {\n try {\n return typeof matchMedia === \"function\" && matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n } catch {\n return false;\n }\n}\n\n/**\n * The card follows the drag; `amount` (distance over the threshold) fades it, so the answer's big name\n * reads over a quiet card (full drag: 0.3), never two texts printed over each other.\n */\nexport function follow(el: HTMLElement | null, dx: number, dy: number, amount = 0): void {\n if (!el) return;\n el.style.transition = \"none\";\n el.style.transform = dx || dy ? `translate3d(${dx}px,${dy}px,0) rotate(${(dx / 28).toFixed(2)}deg)` : \"\";\n el.style.opacity = amount > 0 ? String(1 - 0.7 * Math.min(1, amount)) : \"\";\n}\n\nexport function snapBack(el: HTMLElement | null): void {\n if (!el) return;\n el.style.transition = \"transform 260ms cubic-bezier(.2,.8,.2,1), opacity 260ms ease\";\n el.style.transform = \"\";\n el.style.opacity = \"\";\n}\n\n/** Throw the card off the edge it went toward; faster throws leave faster. */\nexport function flyOut(el: HTMLElement | null, dir: DeckDirection, speed = 0): Promise<void> {\n if (!el || prefersReducedMotion()) return new Promise((r) => setTimeout(r, 90));\n const [vx, vy] = VECTOR[dir];\n const ms = Math.round(Math.max(150, Math.min(260, 260 - speed * 60)));\n el.style.transition = `transform ${ms}ms cubic-bezier(.4,0,1,1), opacity ${ms}ms linear`;\n el.style.transform = `translate3d(${vx * 120}vw,${vy * 110}vh,0) rotate(${vx * 14}deg)`;\n el.style.opacity = \"0\";\n return new Promise((r) => setTimeout(r, ms));\n}\n\n/** A new card arrives: from the edge it left by (undo), or rising in place. */\nexport function enter(el: HTMLElement | null, from: DeckDirection | null): void {\n if (!el || prefersReducedMotion() || typeof el.animate !== \"function\") return;\n if (from) {\n const [vx, vy] = VECTOR[from];\n el.animate(\n [\n { transform: `translate3d(${vx * 100}vw,${vy * 100}vh,0) rotate(${vx * 10}deg)`, opacity: 0.3 },\n { transform: \"none\", opacity: 1 },\n ],\n { duration: 320, easing: \"cubic-bezier(.2,.8,.2,1)\" },\n );\n } else {\n el.animate([{ transform: \"scale(.95)\", opacity: 0 }, { transform: \"none\", opacity: 1 }], { duration: 260, easing: \"cubic-bezier(.2,.8,.2,1)\" });\n }\n}\n\n/** The card leans toward its suggested answer once, then settles. */\nexport function nudge(el: HTMLElement | null, dir: DeckDirection): Animation | null {\n if (!el || prefersReducedMotion() || typeof el.animate !== \"function\") return null;\n const [vx, vy] = VECTOR[dir];\n return el.animate(\n [\n { transform: \"none\" },\n { transform: `translate3d(${vx * 24}px,${vy * 24}px,0) rotate(${vx * 1.2}deg)`, offset: 0.3 },\n { transform: \"none\", offset: 0.6 },\n { transform: `translate3d(${vx * 10}px,${vy * 10}px,0)`, offset: 0.8 },\n { transform: \"none\" },\n ],\n { duration: 1100, easing: \"ease-in-out\" },\n );\n}\n\n/** Fill the screen with the answer's color; `amount` 0..1+ is how far the drag has gone. */\nexport function showWash(bg: HTMLElement | null, label: HTMLElement | null, amount: number): void {\n if (!bg || !label) return;\n const a = Math.max(0, Math.min(1, amount));\n bg.style.opacity = String(Math.min(0.93, 0.2 + 0.73 * a));\n label.style.opacity = String(Math.min(1, 0.35 + a));\n label.style.transform = `scale(${0.82 + 0.22 * a})`;\n}\n\nexport function hideWash(bg: HTMLElement | null, label: HTMLElement | null): void {\n if (bg) bg.style.opacity = \"0\";\n if (label) label.style.opacity = \"0\";\n}\n\n/**\n * The largest font size (px) at which `text` fits: `inner` no taller than `box`, and no word wider\n * than the line. Binary search, ten measurements.\n */\nexport function fitText(box: HTMLElement, inner: HTMLElement, text: HTMLElement, min: number, max: number): number {\n let lo = min;\n let hi = Math.max(min, max);\n let best = lo;\n for (let k = 0; k < 10; k++) {\n const mid = (lo + hi) / 2;\n text.style.fontSize = `${mid}px`;\n const ok = inner.offsetHeight <= box.clientHeight && text.scrollWidth <= text.clientWidth + 1;\n if (ok) {\n best = mid;\n lo = mid;\n } else hi = mid;\n }\n const size = Math.floor(best);\n text.style.fontSize = `${size}px`;\n // Even the smallest size does not fit (a very long text, a narrow phone): this one screen scrolls, never clips.\n if (inner.offsetHeight > box.clientHeight + 1) box.setAttribute(\"data-sd-overflow\", \"\");\n else box.removeAttribute(\"data-sd-overflow\");\n return size;\n}\n\n/** Run a fit now, again once the web font has loaded (it changes every measure), and on every resize. */\nexport function keepFitted(box: HTMLElement, run: () => void): () => void {\n run();\n let alive = true;\n box.ownerDocument.fonts?.ready.then(() => alive && run()).catch(() => undefined);\n if (typeof ResizeObserver === \"undefined\") return () => void (alive = false);\n const ro = new ResizeObserver(run);\n ro.observe(box);\n return () => {\n alive = false;\n ro.disconnect();\n };\n}\n\n/**\n * The largest the card's text may be. A phone (under 480px) goes by its text column (column / 2.6, so a\n * short line like \"junk\" goes huge and the height fills first); wider screens by the screen's width.\n */\nexport function heroMax(box: HTMLElement): number {\n const vw = box.ownerDocument.defaultView?.innerWidth ?? box.clientWidth;\n if (vw < 480) return Math.min(104, Math.max(36, box.clientWidth / 2.6));\n const wide = vw >= 1024;\n return Math.min(wide ? 132 : 104, Math.max(36, Math.min(vw, box.clientWidth * 1.6) / 3.2));\n}\n","/**\n * THE DECK CONTROLLER — the one place a deck's changes go, in either mode.\n *\n * CONTROLLED (no binding): the state lives here; every change is reported through `onChange`.\n * BOUND (a {@link SwipeDeckBinding}): the binding holds the truth (its store, its realtime); this\n * controller draws each change at once on top of it (optimistic), sends the ops, and when the\n * connection refuses, takes the change back and keeps the refusal's own sentence for the screen.\n * Undo in both modes is the change's inverse, sent the same way.\n */\nimport * as React from \"react\";\n\nimport { applyOps, deckState, type DeckChange, type DeckItem, type DeckOp, type DeckState } from \"./model\";\n\n/**\n * A connection a deck persists through: hand one to `SwipeDeck` and it saves every answer, pick,\n * part edit and category the moment it happens. `state` must follow the connection's truth\n * (including other devices' writes); `apply` resolves when the connection kept the ops and rejects\n * with an Error whose message is the connection's own refusal sentence.\n */\nexport interface SwipeDeckBinding {\n readonly status: \"loading\" | \"ready\" | \"error\";\n /** Why the connection cannot be read, in its own words. */\n readonly error: string | null;\n readonly items: readonly DeckItem[];\n readonly state: DeckState;\n apply(ops: readonly DeckOp[]): Promise<void>;\n /**\n * Optional: the undo history the connection kept (newest last). Given, the deck starts from it, so undo\n * still works after a reload or on another device; `saveHistory` is handed every change to it (at most\n * {@link UNDO_KEPT} steps).\n */\n readonly history?: readonly DeckChange[];\n saveHistory?(history: readonly DeckChange[]): void;\n}\n\n/** How many steps of undo a connection is asked to keep. */\nexport const UNDO_KEPT = 100;\n\ninterface Pending {\n readonly id: number;\n readonly ops: readonly DeckOp[];\n settledAt: number | null;\n /** Never kept by the connection (a requeue): dropped the moment it settles, not held until reflected. */\n readonly transient?: boolean;\n}\n\nexport interface DeckController {\n readonly items: readonly DeckItem[];\n readonly state: DeckState;\n readonly status: \"loading\" | \"ready\" | \"error\";\n readonly readError: string | null;\n /** The last refusal of a write, in the connection's words; cleared by the next write that lands. */\n readonly writeError: string | null;\n readonly canUndo: boolean;\n commit(change: DeckChange): void;\n /** Takes back the last change; returns it (its `from` is the edge the card comes back from). */\n undo(): DeckChange | null;\n}\n\nexport interface DeckControllerOptions {\n readonly items?: readonly DeckItem[] | undefined;\n readonly binding?: SwipeDeckBinding | undefined;\n readonly initialState?: Partial<DeckState> | undefined;\n readonly onChange?: ((state: DeckState, change: DeckChange, undo: boolean) => void) | undefined;\n}\n\nconst SETTLE_GRACE_MS = 6000;\n\n/** True when `state` already holds what `op` writes. */\nexport function reflects(state: DeckState, op: DeckOp): boolean {\n switch (op.kind) {\n case \"answer\":\n return (state.answers[op.itemId] ?? null) === op.answer;\n case \"pick\":\n return (state.picks[op.group] ?? null) === op.itemId;\n case \"parts\":\n return JSON.stringify(state.parts[op.itemId] ?? null) === JSON.stringify(op.parts);\n case \"category\":\n return op.remove ? !state.categories[op.name] : (state.categories[op.name]?.answer ?? null) === op.answer;\n }\n}\n\nexport function useDeckController({ items, binding, initialState, onChange }: DeckControllerOptions): DeckController {\n const [local, setLocal] = React.useState<DeckState>(() => deckState(initialState));\n const [history, setHistory] = React.useState<readonly DeckChange[]>([]);\n const [pending, setPending] = React.useState<readonly Pending[]>([]);\n const [writeError, setWriteError] = React.useState<string | null>(null);\n const seq = React.useRef(0);\n const onChangeRef = React.useRef(onChange);\n onChangeRef.current = onChange;\n\n // A connection's state is read through the one sanitizer: an old or broken shape never blanks the deck.\n const bound = binding?.state;\n const base = React.useMemo(() => (bound ? deckState(bound) : local), [bound, local]);\n\n // A connection that keeps the undo history: the deck takes the kept steps while she has done nothing here\n // yet (they may arrive after the deck draws), and hands the history back only after a change of hers, so\n // opening a deck never writes and kept steps are never replaced by none.\n const touched = React.useRef(false);\n const bindingRef = React.useRef(binding);\n bindingRef.current = binding;\n const kept = binding?.history;\n React.useEffect(() => {\n // Follows the kept steps (a later read may bring more, fewer or none) until she acts here.\n if (touched.current || !kept) return;\n setHistory(kept);\n }, [kept]);\n React.useEffect(() => {\n if (touched.current) bindingRef.current?.saveHistory?.(history.slice(-UNDO_KEPT));\n }, [history]);\n // A settled write stays drawn until the connection's state CARRIES it (an unrelated remote write arriving\n // first must not flicker it away), or until a grace passes (another device wrote over it meanwhile).\n React.useEffect(() => {\n setPending((list) => {\n const kept = list.filter((p) => p.settledAt === null || !p.ops.every((op) => reflects(base, op)));\n return kept.length === list.length ? list : kept;\n });\n }, [base]);\n React.useEffect(() => {\n if (!pending.some((p) => p.settledAt !== null)) return;\n const t = setTimeout(() => setPending((list) => list.filter((p) => p.settledAt === null || Date.now() - p.settledAt < SETTLE_GRACE_MS)), SETTLE_GRACE_MS);\n return () => clearTimeout(t);\n }, [pending]);\n\n const state = React.useMemo(() => pending.reduce((s, p) => applyOps(s, p.ops), base), [base, pending]);\n const stateRef = React.useRef(state);\n stateRef.current = state;\n\n const send = React.useCallback(\n (ops: readonly DeckOp[], onRefused: () => void, transient = false) => {\n if (!binding) {\n setLocal((s) => applyOps(s, ops));\n return;\n }\n const id = ++seq.current;\n setPending((list) => [...list, { id, ops, settledAt: null, ...(transient ? { transient } : {}) }]);\n binding.apply(ops).then(\n () => {\n setWriteError(null);\n // A transient change is never in the connection's state: it stops drawing the moment it lands.\n setPending((list) => (transient ? list.filter((p) => p.id !== id) : list.map((p) => (p.id === id ? { ...p, settledAt: Date.now() } : p))));\n },\n (err: unknown) => {\n setPending((list) => list.filter((p) => p.id !== id));\n setWriteError(err instanceof Error && err.message ? err.message : String(err));\n onRefused();\n },\n );\n },\n [binding],\n );\n\n const commit = React.useCallback(\n (change: DeckChange) => {\n touched.current = true;\n setHistory((h) => [...h, change]);\n send(change.ops, () => setHistory((h) => h.filter((c) => c !== change)), change.transient);\n onChangeRef.current?.(applyOps(stateRef.current, change.ops), change, false);\n },\n [send],\n );\n\n const historyRef = React.useRef(history);\n historyRef.current = history;\n const undo = React.useCallback((): DeckChange | null => {\n const last = historyRef.current[historyRef.current.length - 1];\n if (!last) return null;\n touched.current = true;\n setHistory((h) => h.slice(0, -1));\n // A refused undo puts the change back on the stack: the person can try again.\n send(last.inverse, () => setHistory((h) => [...h, last]), last.transient);\n onChangeRef.current?.(applyOps(stateRef.current, last.inverse), last, true);\n return last;\n }, [send]);\n\n return {\n items: binding ? binding.items : (items ?? []),\n state,\n status: binding ? binding.status : \"ready\",\n readError: binding ? binding.error : null,\n writeError,\n canUndo: history.length > 0,\n commit,\n undo,\n };\n}\n","/**\n * THE SWIPE DECK MODEL — everything the deck decides, with no DOM and no React.\n *\n * A deck is a list of items a person answers by swiping one of four ways. The deck never stores\n * anything itself: every change is a list of {@link DeckOp}s applied to a {@link DeckState}, and\n * every change carries its exact inverse, so undo is unlimited and covers every kind of change\n * (answers, picks, part edits, categories). A bound deck sends the same ops to its connection.\n *\n * WHERE THE PERSON IS IS DERIVED, never stored: the current step is the first one not yet done.\n * So a deck open on two devices stays in step by sharing state alone, and a reload resumes where\n * the person left off.\n */\nimport type { ReactNode } from \"react\";\n\nexport type DeckDirection = \"right\" | \"up\" | \"left\" | \"down\";\nexport const DECK_DIRECTIONS: readonly DeckDirection[] = [\"right\", \"up\", \"left\", \"down\"];\n\n/** Semantic color of an answer; each names a design-system token pair (`--success` / `--success-foreground`…). */\nexport type DeckTone = \"success\" | \"info\" | \"destructive\" | \"warning\" | \"primary\" | \"neutral\";\n\nexport interface DeckAnswer {\n /** Stable id: what results, callbacks and connections carry. */\n readonly id: string;\n readonly label: string;\n /**\n * Offered only through the card's own controls (`renderCardActions` / `renderCardBody` call\n * `answer(id)`), never drawn as a button: an answer that needs a choice first (\"Related ▸ Partner\").\n */\n readonly hidden?: boolean;\n /**\n * \"Skip for now\": in a bound deck the connection moves the card to the back of the line and keeps no\n * answer (it comes back once the rest are answered); undo brings it back to the front. In a deck with no\n * connection it is kept like any other answer.\n */\n readonly requeue?: boolean;\n readonly tone: DeckTone;\n /** Higher is better. Decides which answer wins when categories disagree (default by direction). */\n readonly rank?: number;\n /** Replaces the arrow on the edge button and the full-screen wash. */\n readonly icon?: ReactNode;\n /** One key that gives this answer (\"Y\", \"3\"), beside the arrows. Case does not matter. */\n readonly shortcut?: string;\n}\n\n/** The answer on each edge. A missing direction is disabled (two, three or four ways). */\nexport type DeckKey = Partial<Record<DeckDirection, DeckAnswer>>;\n/** An override: an answer replaces that edge, `null` turns the edge off. */\nexport type DeckKeyOverride = Partial<Record<DeckDirection, DeckAnswer | null>>;\n\nexport const DEFAULT_DECK_KEY: DeckKey = {\n right: { id: \"yes\", label: \"Yes!\", tone: \"success\", rank: 3 },\n up: { id: \"sort_of\", label: \"Sort of\", tone: \"info\", rank: 2 },\n left: { id: \"no\", label: \"No\", tone: \"destructive\", rank: 0 },\n down: { id: \"not_sure\", label: \"Not sure\", tone: \"warning\", rank: 1 },\n};\n\n/** The part screen's down edge: close it, changing no answer. */\nexport const KEEP_ANSWER_ID = \"__keep\";\nexport const DEFAULT_KEEP_ANSWER: DeckAnswer = { id: KEEP_ANSWER_ID, label: \"Keep as is\", tone: \"neutral\" };\n\nconst DIRECTION_RANK: Record<DeckDirection, number> = { right: 3, up: 2, down: 1, left: 0 };\n\nexport function mergeKey(base: DeckKey, override?: DeckKeyOverride | null): DeckKey {\n if (!override) return base;\n const out: DeckKey = { ...base };\n for (const dir of DECK_DIRECTIONS) {\n if (!(dir in override)) continue;\n const next = override[dir];\n if (next) out[dir] = next;\n else delete out[dir];\n }\n return out;\n}\n\nexport function directionOf(key: DeckKey, answerId: string | null | undefined): DeckDirection | null {\n if (!answerId) return null;\n for (const dir of DECK_DIRECTIONS) if (key[dir]?.id === answerId) return dir;\n return null;\n}\n\n/** The answer with this id: on an edge of `key`, else among `more` (the answers off the edges). */\nexport function answerOf(key: DeckKey, answerId: string | null | undefined, more?: readonly DeckAnswer[]): DeckAnswer | null {\n const dir = directionOf(key, answerId);\n if (dir) return key[dir] ?? null;\n if (!answerId || !more) return null;\n return more.find((a) => a.id === answerId) ?? null;\n}\n\nfunction rankOf(key: DeckKey, answerId: string): number {\n const dir = directionOf(key, answerId);\n if (!dir) return -1;\n return key[dir]?.rank ?? DIRECTION_RANK[dir];\n}\n\n// ─── items, parts, categories ─────────────────────────────────────────────\n\nexport interface DeckField {\n readonly label: string;\n readonly value: string;\n}\n\n/** A part as an item first offers it: by phrase (first match) or by token span. */\nexport interface DeckPartSeed {\n readonly phrase?: string;\n readonly start?: number;\n readonly end?: number;\n readonly categories?: readonly string[];\n /** The answer this part leans to before anyone answers it. */\n readonly suggested?: string | null;\n readonly answer?: string | null;\n}\n\n/** A span of the item's words [start, end] (token indexes, inclusive) with its own answer. */\nexport interface DeckPart {\n readonly start: number;\n readonly end: number;\n readonly categories: readonly string[];\n readonly suggested: string | null;\n readonly answer: string | null;\n}\n\nexport interface DeckCategory {\n readonly name: string;\n readonly answer: string | null;\n /** The chip row it was added in (see {@link DeckCategoryRow}), when the deck has rows. */\n readonly row?: string;\n}\n\n/** A labelled row of categories on the part screen (\"Who\", \"Cares about\"); a category added with its \"+\" carries the row's id. */\nexport interface DeckCategoryRow {\n readonly id: string;\n readonly label: string;\n readonly categories: readonly string[];\n}\n\n/** A picture on the card: an image by address, or anything the host draws (an avatar with its own fallback). */\nexport type DeckMedia =\n | { readonly src: string; readonly alt?: string; readonly shape?: \"circle\" | \"square\" | \"wide\" }\n | { readonly node: ReactNode; readonly shape?: \"circle\" | \"square\" | \"wide\" };\n\n/** One member of a group card (\"these four logos\"): each can be switched off before the card is answered. */\nexport interface DeckMember {\n readonly id: string;\n readonly label: string;\n readonly media?: DeckMedia;\n /** Starts switched off. */\n readonly off?: boolean;\n}\n\n/**\n * When a card is asked: about one earlier card's answer, or a combination. A leaf names the card (`item`)\n * and, optionally, the answers that count (`is`), the ones that must not (`isNot`), or whether it was\n * answered at all (`answered`, default true). A card only ever depends on cards BEFORE it (no loops);\n * a card that is not asked has no answer as far as later cards are concerned.\n */\nexport type DeckCondition =\n | {\n readonly item: string;\n readonly is?: string | readonly string[];\n readonly isNot?: string | readonly string[];\n readonly answered?: boolean;\n }\n | { readonly all: readonly DeckCondition[] }\n | { readonly any: readonly DeckCondition[] }\n | { readonly not: DeckCondition };\n\n/** What rides with an answer beyond its id: the members switched off, a value typed on the card. */\nexport type DeckDetail = Readonly<Record<string, unknown>>;\n\nexport interface DeckItem {\n readonly id: string;\n /** The main text: fitted to the largest size the screen allows. */\n readonly text: string;\n /** A small label above the text (what kind of item this is). */\n readonly kicker?: string;\n /** A small fact tag beside the kicker. */\n readonly tag?: string;\n /** The suggested answer id: its button is filled and pulses, and the card leans toward it. */\n readonly suggested?: string | null;\n /**\n * The suggestion in finer words than its answer's label, shown as the Suggestion (the card still leans to\n * `suggested`): an answer that merges two (\"Sustain or Accept\") can show the precise one (\"Accept\").\n */\n readonly suggestedLabel?: string;\n /** Shown under the text with the \"Reason\" label. */\n readonly reason?: string;\n /** More label/value lines under the text. */\n readonly fields?: readonly DeckField[];\n /** Draw the text in quotation marks. */\n readonly quoted?: boolean;\n readonly parts?: readonly DeckPartSeed[];\n /** This item's own key: replaces or turns off edges of the deck's key. */\n readonly answers?: DeckKeyOverride;\n /** Pick-one group: when every item of a pick-one group is answered, the person picks one of its Yes items. */\n readonly group?: string;\n /** The suggested pick of its group. */\n readonly pickSuggested?: boolean;\n /**\n * The right answer(s), by answer id, for a deck that is graded (a quiz). Never shown while she answers;\n * the result says which were right and the end shows the score. Absent: the item is not graded.\n */\n readonly correct?: string | readonly string[];\n /** Answers off the edges, as a row of buttons on the card; replaces the deck's own `more` for this item. */\n readonly more?: readonly DeckAnswer[];\n /** A picture above the text. */\n readonly media?: DeckMedia;\n /** A group card: its members, each switched on or off; the off ones ride with the answer as `detail.off`. */\n readonly members?: readonly DeckMember[];\n /**\n * Asked only when this holds (see {@link DeckCondition}). Not asked: skipped, and left out of progress,\n * counts, the score and the results; an answer it already had is KEPT but does not apply, and comes\n * back if the card is asked again.\n */\n readonly showIf?: DeckCondition;\n}\n\nexport interface DeckState {\n readonly answers: Readonly<Record<string, string>>;\n readonly picks: Readonly<Record<string, string>>;\n /** Parts as changed or loaded; an item absent here shows its seeds. */\n readonly parts: Readonly<Record<string, readonly DeckPart[]>>;\n readonly categories: Readonly<Record<string, DeckCategory>>;\n /** What rode with each answer (see {@link DeckDetail}); a binding that keeps none may leave it out. */\n readonly details?: Readonly<Record<string, DeckDetail>>;\n}\n\nexport const EMPTY_DECK_STATE: DeckState = { answers: {}, picks: {}, parts: {}, categories: {}, details: {} };\n\nconst plain = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst keep = <T,>(v: unknown, ok: (x: unknown) => x is T): Record<string, T> =>\n plain(v) ? Object.fromEntries(Object.entries(v).filter((e): e is [string, T] => ok(e[1]))) : {};\nconst isText = (x: unknown): x is string => typeof x === \"string\" && x.length > 0;\nconst isPart = (x: unknown): x is DeckPart => plain(x) && Number.isInteger(x.start) && Number.isInteger(x.end) && Array.isArray(x.categories);\nconst isParts = (x: unknown): x is readonly DeckPart[] => Array.isArray(x) && x.every(isPart);\nconst isCategory = (x: unknown): x is DeckCategory => plain(x) && typeof x.name === \"string\";\n\n/**\n * A full deck state from anything saved or handed in: missing parts start empty, and an entry of the\n * wrong shape (an old save, a hand-edited row) is left out, so a deck never draws blank over bad data.\n */\nexport function deckState(partial?: Partial<DeckState> | null): DeckState {\n const p: Record<string, unknown> = plain(partial) ? partial : {};\n return {\n answers: keep(p.answers, isText),\n picks: keep(p.picks, isText),\n parts: keep(p.parts, isParts),\n categories: keep(p.categories, isCategory),\n details: keep(p.details, plain) as Record<string, DeckDetail>,\n };\n}\n\nexport function tokenize(text: string): string[] {\n return text.split(/\\s+/).filter(Boolean);\n}\n\nfunction norm(token: string): string {\n return token.toLowerCase().replace(/[^\\p{L}\\p{N}+-]/gu, \"\");\n}\n\n/** The parts an item opens with: each seed placed on its tokens; seeds that match nothing are dropped. */\nexport function seedParts(item: DeckItem): DeckPart[] {\n const tokens = tokenize(item.text);\n const normed = tokens.map(norm);\n const out: DeckPart[] = [];\n for (const seed of item.parts ?? []) {\n let start = seed.start;\n let end = seed.end;\n if (seed.phrase !== undefined) {\n const want = tokenize(seed.phrase).map(norm);\n start = undefined;\n for (let i = 0; i + want.length <= normed.length && want.length; i++) {\n if (want.every((w, j) => normed[i + j] === w)) {\n start = i;\n end = i + want.length - 1;\n break;\n }\n }\n }\n if (start === undefined || start < 0 || start >= tokens.length) continue;\n const e = Math.min(tokens.length - 1, Math.max(start, end ?? start));\n out.push({ start, end: e, categories: seed.categories ?? [], suggested: seed.suggested ?? null, answer: seed.answer ?? null });\n }\n return withoutOverlaps(out);\n}\n\nfunction withoutOverlaps(parts: DeckPart[]): DeckPart[] {\n const sorted = [...parts].sort((a, b) => a.start - b.start);\n const out: DeckPart[] = [];\n for (const p of sorted) if (!out.some((q) => !(q.end < p.start || q.start > p.end))) out.push(p);\n return out;\n}\n\nexport function partsOf(state: DeckState, item: DeckItem): readonly DeckPart[] {\n return state.parts[item.id] ?? seedParts(item);\n}\n\nexport function partText(item: DeckItem, part: Pick<DeckPart, \"start\" | \"end\">): string {\n return tokenize(item.text)\n .slice(part.start, part.end + 1)\n .join(\" \")\n .replace(/^[“\"‘'(\\[]+|[”\"’'.,;:!?)\\]]+$/g, \"\");\n}\n\n/** Every category the deck knows: the configured rows, then any a part or the state names. */\nexport function knownCategories(configured: readonly string[], items: readonly DeckItem[], state: DeckState): string[] {\n const out: string[] = [];\n const add = (name: string) => {\n if (name && !out.includes(name)) out.push(name);\n };\n configured.forEach(add);\n for (const item of items) for (const part of partsOf(state, item)) part.categories.forEach(add);\n Object.keys(state.categories).forEach(add);\n return out;\n}\n\nexport type CategoryConflict = \"worse\" | \"better\" | ((answerIds: readonly string[]) => string);\n\n/** One answer from several categories' answers: by default the worse one wins. */\nexport function resolveConflict(answerIds: readonly string[], key: DeckKey, conflict: CategoryConflict = \"worse\"): string | null {\n if (!answerIds.length) return null;\n if (typeof conflict === \"function\") return conflict(answerIds);\n const sign = conflict === \"better\" ? -1 : 1;\n return [...answerIds].sort((a, b) => sign * (rankOf(key, a) - rankOf(key, b)))[0] ?? null;\n}\n\n/** What a part leans to: its categories' answers flow down to it; otherwise its own suggestion. */\nexport function partSuggestion(part: DeckPart, state: DeckState, key: DeckKey, conflict?: CategoryConflict): string | null {\n const flowed = part.categories.map((c) => state.categories[c]?.answer).filter((a): a is string => !!a);\n return resolveConflict(flowed, key, conflict) ?? part.suggested;\n}\n\n/** The answer a part shows: its own, else what flows down to it. */\nexport function partAnswer(part: DeckPart, state: DeckState, key: DeckKey, conflict?: CategoryConflict): string | null {\n return part.answer ?? partSuggestion(part, state, key, conflict);\n}\n\n/** Place a part on its span: every part it overlaps is replaced. */\nexport function placePart(parts: readonly DeckPart[], next: DeckPart): DeckPart[] {\n return [...parts.filter((p) => p.end < next.start || p.start > next.end), next].sort((a, b) => a.start - b.start);\n}\n\nexport function forgetSpan(parts: readonly DeckPart[], span: Pick<DeckPart, \"start\" | \"end\">): DeckPart[] {\n return parts.filter((p) => p.end < span.start || p.start > span.end);\n}\n\n// ─── steps ────────────────────────────────────────────────────────────────\n\nexport type DeckStep =\n | { readonly kind: \"card\"; readonly id: string; readonly item: DeckItem }\n | { readonly kind: \"pick\"; readonly id: string; readonly group: string; readonly items: readonly DeckItem[] }\n | { readonly kind: \"end\"; readonly id: \"end\" };\n\nexport interface DeckRules {\n readonly key: DeckKey;\n /** Groups that end in a pick-one screen: `true` = every group. */\n readonly pickOne?: boolean | readonly string[];\n /** The answer that makes an item a contender in its group's pick (default: the right edge's). */\n readonly pickAnswer?: string;\n /** Answers off the edges, offered on every card (an item's own `more` replaces them). */\n readonly more?: readonly DeckAnswer[];\n}\n\nexport function keyFor(rules: DeckRules, item: DeckItem): DeckKey {\n return mergeKey(rules.key, item.answers);\n}\n\n/** The answers off the edges for this item: its own, or the deck's; never one already on an edge. */\nexport function moreFor(rules: DeckRules, item: DeckItem): readonly DeckAnswer[] {\n const key = keyFor(rules, item);\n const list = item.more ?? rules.more ?? [];\n return list.filter((a) => !directionOf(key, a.id));\n}\n\n/** Every answer this item can take: the edges' (clockwise from the top), then the ones off the edges. */\nexport function answersFor(rules: DeckRules, item: DeckItem): readonly DeckAnswer[] {\n const key = keyFor(rules, item);\n const edges = ([\"up\", \"right\", \"down\", \"left\"] as const).map((d) => key[d]).filter((a): a is DeckAnswer => !!a);\n return [...edges, ...moreFor(rules, item)];\n}\n\n/** The answer with this id for this item, on an edge or off it. */\nexport function findAnswer(rules: DeckRules, item: DeckItem, answerId: string | null | undefined): DeckAnswer | null {\n return answerOf(keyFor(rules, item), answerId, moreFor(rules, item));\n}\n\n/**\n * What rides with an item's answer: the detail given, and on a group card always its members switched off\n * (`off`, the starting ones included), so a consumer never has to know the item's defaults.\n */\nexport function answerDetail(item: DeckItem, detail: DeckDetail | null | undefined): DeckDetail | null {\n if (!item.members?.length) return detail ?? null;\n return { ...(detail ?? {}), off: [...membersOff(item, detail)] };\n}\n\n/** The members switched off on a group card: what the person set, else what the item starts with. */\nexport function membersOff(item: DeckItem, detail: DeckDetail | null | undefined): readonly string[] {\n const off = detail?.off;\n if (Array.isArray(off)) return off.filter((x): x is string => typeof x === \"string\");\n return (item.members ?? []).filter((m) => m.off).map((m) => m.id);\n}\n\nfunction pickAnswerOf(rules: DeckRules): string | null {\n return rules.pickAnswer ?? rules.key.right?.id ?? null;\n}\n\nfunction isPickGroup(rules: DeckRules, group: string | undefined): group is string {\n if (!group || !rules.pickOne) return false;\n return rules.pickOne === true || rules.pickOne.includes(group);\n}\n\nconst asList = (v: string | readonly string[] | undefined): readonly string[] | null => (v === undefined ? null : typeof v === \"string\" ? [v] : v);\n\n/** Whether a condition holds, given the cards asked so far (`asked`: id → asked) and the answers. */\nexport function conditionHolds(cond: DeckCondition, state: DeckState, asked: ReadonlyMap<string, boolean>): boolean {\n if (\"all\" in cond) return cond.all.every((c) => conditionHolds(c, state, asked));\n if (\"any\" in cond) return cond.any.some((c) => conditionHolds(c, state, asked));\n if (\"not\" in cond) return !conditionHolds(cond.not, state, asked);\n // A card not (yet) asked — later, missing, or skipped by its own condition — has no answer.\n const answer = asked.get(cond.item) ? (state.answers[cond.item] ?? null) : null;\n const wantAnswered = cond.answered ?? true;\n if (!wantAnswered) return answer === null;\n if (answer === null) return false;\n const is = asList(cond.is);\n const isNot = asList(cond.isNot);\n if (is && !is.includes(answer)) return false;\n if (isNot && isNot.includes(answer)) return false;\n return true;\n}\n\n/** Which cards are asked, in order: a card with no condition always; one with a condition when it holds over the cards before it. */\nexport function askedItems(items: readonly DeckItem[], state: DeckState): ReadonlyMap<string, boolean> {\n const asked = new Map<string, boolean>();\n for (const item of items) asked.set(item.id, item.showIf ? conditionHolds(item.showIf, state, asked) : true);\n return asked;\n}\n\n/** The cards asked, in order. */\nexport function shownItems(items: readonly DeckItem[], state: DeckState): DeckItem[] {\n if (!items.some((i) => i.showIf)) return [...items];\n const asked = askedItems(items, state);\n return items.filter((i) => asked.get(i.id));\n}\n\n/** Every card id a condition names. */\nexport function conditionItems(cond: DeckCondition): string[] {\n if (\"all\" in cond) return cond.all.flatMap(conditionItems);\n if (\"any\" in cond) return cond.any.flatMap(conditionItems);\n if (\"not\" in cond) return conditionItems(cond.not);\n return [cond.item];\n}\n\n/**\n * THE ORDER A DECK WITH CONDITIONS IS ASKED IN, when its order is not authored (a table sorted any way):\n * the given order, except that a card always comes after every card its condition names. Stable — a\n * deck whose conditions already point backwards is returned unchanged. A loop (two cards naming each\n * other) is left in the given order, where `conditionProblems` says so.\n */\nexport function dependencyOrder<T extends DeckItem>(items: readonly T[]): T[] {\n const ids = new Set(items.map((i) => i.id));\n const needs = new Map(items.map((i) => [i.id, new Set(i.showIf ? conditionItems(i.showIf).filter((d) => ids.has(d) && d !== i.id) : [])]));\n const out: T[] = [];\n const placed = new Set<string>();\n const left = [...items];\n while (left.length) {\n const k = left.findIndex((i) => [...needs.get(i.id)!].every((d) => placed.has(d)));\n const [next] = left.splice(k < 0 ? 0 : k, 1);\n out.push(next!);\n placed.add(next!.id);\n }\n return out;\n}\n\n/**\n * What is wrong with the deck's conditions, in words (never silent): a condition naming a card that does\n * not exist, one that comes later (it could never be answered first), or an answer the card does not have.\n */\n/**\n * A condition as a person or an agent wrote it (`{item, is, is_not | isNot, answered}`, `{all}`, `{any}`,\n * `{not}`, or a list meaning all), with its card and answers resolved by the host: `ref` names the card\n * (an id, a position, its words), `answer(itemId, word)` the answer id. Null when nothing can be read.\n * The one reader for every source of conditions (a chat answer, a table column, a definition).\n */\nexport function readDeckCondition(\n raw: unknown,\n resolve: { ref: (v: unknown) => string; answer: (itemId: string, word: unknown) => string | null },\n): DeckCondition | null {\n const rec = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\n const read = (r: unknown): DeckCondition | null => {\n if (Array.isArray(r)) {\n const all = r.map(read).filter((c): c is DeckCondition => !!c);\n return all.length ? { all } : null;\n }\n if (!rec(r)) return null;\n if (Array.isArray(r.all)) return { all: r.all.map(read).filter((c): c is DeckCondition => !!c) };\n if (Array.isArray(r.any)) return { any: r.any.map(read).filter((c): c is DeckCondition => !!c) };\n if (r.not !== undefined) {\n const inner = read(r.not);\n return inner ? { not: inner } : null;\n }\n if (r.item === undefined || r.item === null) return null;\n const item = resolve.ref(r.item);\n const words = (v: unknown): string[] | undefined =>\n v === undefined || v === null ? undefined : (Array.isArray(v) ? v : [v]).map((w) => resolve.answer(item, w) ?? String(w).trim()).filter(Boolean);\n const is = words(r.is);\n const isNot = words(r.is_not ?? r.isNot);\n return {\n item,\n ...(is ? { is } : {}),\n ...(isNot ? { isNot } : {}),\n ...(typeof r.answered === \"boolean\" ? { answered: r.answered } : {}),\n };\n };\n return read(raw);\n}\n\nexport function conditionProblems(items: readonly DeckItem[], rules: DeckRules): string[] {\n const out: string[] = [];\n const index = new Map(items.map((i, k) => [i.id, k]));\n items.forEach((item, k) => {\n if (!item.showIf) return;\n const visit = (c: DeckCondition): void => {\n if (\"all\" in c) return c.all.forEach(visit);\n if (\"any\" in c) return c.any.forEach(visit);\n if (\"not\" in c) return visit(c.not);\n const at = index.get(c.item);\n if (at === undefined) {\n out.push(`\"${item.text}\" depends on a card that is not in the deck (${c.item}).`);\n return;\n }\n if (at >= k) {\n out.push(`\"${item.text}\" depends on \"${items[at]?.text ?? c.item}\", which comes after it, so it can never be asked.`);\n return;\n }\n const target = items[at];\n if (!target) return;\n for (const id of [...(asList(c.is) ?? []), ...(asList(c.isNot) ?? [])]) {\n if (!findAnswer(rules, target, id)) out.push(`\"${item.text}\" waits for an answer \"${id}\" that \"${target.text}\" does not have.`);\n }\n };\n visit(item.showIf);\n });\n return out;\n}\n\nexport function contenders(items: readonly DeckItem[], state: DeckState, rules: DeckRules, group: string): DeckItem[] {\n const yes = pickAnswerOf(rules);\n return shownItems(items, state).filter((i) => i.group === group && yes !== null && state.answers[i.id] === yes);\n}\n\n/** The picked item of a group: the person's pick while it still stands, or the only contender. */\nexport function pickedItem(items: readonly DeckItem[], state: DeckState, rules: DeckRules, group: string): DeckItem | null {\n const all = contenders(items, state, rules, group);\n const chosen = state.picks[group];\n const hit = chosen ? all.find((i) => i.id === chosen) : undefined;\n if (hit) return hit;\n return all.length === 1 ? (all[0] ?? null) : null;\n}\n\nexport function deckSteps(allItems: readonly DeckItem[], state: DeckState, rules: DeckRules): DeckStep[] {\n const out: DeckStep[] = [];\n // Only the cards that are asked are steps; a card whose condition does not hold is skipped.\n const items = shownItems(allItems, state);\n items.forEach((item, index) => {\n out.push({ kind: \"card\", id: `card:${item.id}`, item });\n const group = item.group;\n if (!isPickGroup(rules, group)) return;\n const isLast = !items.slice(index + 1).some((i) => i.group === group);\n if (!isLast) return;\n const members = items.filter((i) => i.group === group);\n const all = contenders(items, state, rules, group);\n if (all.length > 1 && members.every((i) => state.answers[i.id])) out.push({ kind: \"pick\", id: `pick:${group}`, group, items: all });\n });\n out.push({ kind: \"end\", id: \"end\" });\n return out;\n}\n\nexport function stepDone(step: DeckStep, state: DeckState): boolean {\n if (step.kind === \"card\") return !!state.answers[step.item.id];\n if (step.kind === \"pick\") return step.items.some((i) => i.id === state.picks[step.group]);\n return false;\n}\n\n/** Where the person is: the first step not done (the end when all are). */\nexport function currentStepIndex(steps: readonly DeckStep[], state: DeckState): number {\n const i = steps.findIndex((s) => !stepDone(s, state));\n return i < 0 ? steps.length - 1 : i;\n}\n\n// ─── ops, changes, undo ───────────────────────────────────────────────────\n\nexport type DeckOp =\n | { readonly kind: \"answer\"; readonly itemId: string; readonly answer: string | null; readonly detail?: DeckDetail | null }\n | { readonly kind: \"pick\"; readonly group: string; readonly itemId: string | null }\n | { readonly kind: \"parts\"; readonly itemId: string; readonly parts: readonly DeckPart[] }\n | { readonly kind: \"category\"; readonly name: string; readonly answer: string | null; readonly remove?: boolean; readonly row?: string };\n\n/** One thing the person did: its ops, their exact inverse, and the edge it left by. */\nexport interface DeckChange {\n readonly ops: readonly DeckOp[];\n readonly inverse: readonly DeckOp[];\n readonly from: DeckDirection | null;\n /**\n * The connection acts on it but never keeps it as an answer (a `requeue` answer: the card goes to the\n * back of the line): once the connection resolves, the deck stops drawing it, so the card is unanswered.\n */\n readonly transient?: boolean;\n}\n\nfunction omit<T>(record: Readonly<Record<string, T>>, k: string): Record<string, T> {\n const { [k]: _gone, ...rest } = record;\n return rest;\n}\n\nexport function applyOp(state: DeckState, op: DeckOp): DeckState {\n switch (op.kind) {\n case \"answer\": {\n const details = state.details ?? {};\n return {\n ...state,\n answers: op.answer ? { ...state.answers, [op.itemId]: op.answer } : omit(state.answers, op.itemId),\n details: op.answer && op.detail ? { ...details, [op.itemId]: op.detail } : omit(details, op.itemId),\n };\n }\n case \"pick\":\n return { ...state, picks: op.itemId ? { ...state.picks, [op.group]: op.itemId } : omit(state.picks, op.group) };\n case \"parts\":\n return { ...state, parts: { ...state.parts, [op.itemId]: op.parts } };\n case \"category\":\n return {\n ...state,\n categories: op.remove\n ? omit(state.categories, op.name)\n : { ...state.categories, [op.name]: { name: op.name, answer: op.answer, ...(op.row ? { row: op.row } : {}) } },\n };\n default:\n // An op this deck does not know (saved by a newer one): leave the state as it is.\n return state;\n }\n}\n\nexport function applyOps(state: DeckState, ops: readonly DeckOp[]): DeckState {\n return ops.reduce(applyOp, state);\n}\n\n/** The op that puts back what `op` changes, read from the state before it. */\nexport function invertOp(before: DeckState, op: DeckOp, items: readonly DeckItem[]): DeckOp {\n switch (op.kind) {\n case \"answer\":\n return { kind: \"answer\", itemId: op.itemId, answer: before.answers[op.itemId] ?? null, detail: before.details?.[op.itemId] ?? null };\n case \"pick\":\n return { kind: \"pick\", group: op.group, itemId: before.picks[op.group] ?? null };\n case \"parts\": {\n const item = items.find((i) => i.id === op.itemId);\n return { kind: \"parts\", itemId: op.itemId, parts: before.parts[op.itemId] ?? (item ? seedParts(item) : []) };\n }\n case \"category\": {\n const had = before.categories[op.name];\n return had ? { kind: \"category\", name: op.name, answer: had.answer } : { kind: \"category\", name: op.name, answer: null, remove: true };\n }\n }\n}\n\nexport function makeChange(before: DeckState, ops: readonly DeckOp[], items: readonly DeckItem[], from: DeckDirection | null = null): DeckChange {\n const inverse: DeckOp[] = [];\n let s = before;\n for (const op of ops) {\n inverse.unshift(invertOp(s, op, items));\n s = applyOp(s, op);\n }\n return { ops, inverse, from };\n}\n\n/** Answer an item; an answer that drops it out of its group's contenders also drops a pick that named it. */\nexport function answerChange(\n before: DeckState,\n item: DeckItem,\n answerId: string,\n rules: DeckRules,\n items: readonly DeckItem[],\n from: DeckDirection | null,\n detail?: DeckDetail | null,\n): DeckChange {\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: answerId, ...(detail ? { detail } : {}) }];\n if (item.group && answerId !== pickAnswerOf(rules) && before.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n return makeChange(before, ops, items, from);\n}\n\n// ─── results and copy ─────────────────────────────────────────────────────\n\nexport interface DeckResultPart {\n readonly text: string;\n readonly start: number;\n readonly end: number;\n readonly categories: readonly string[];\n readonly answer: DeckAnswer | null;\n /** True when the person answered the part itself, false when its answer flowed down. */\n readonly own: boolean;\n}\n\nexport interface DeckResultEntry {\n readonly item: DeckItem;\n readonly answer: DeckAnswer | null;\n readonly parts: readonly DeckResultPart[];\n /** Graded items only: whether the answer given is a right one (null: not graded, or not answered). */\n readonly right: boolean | null;\n /** What rode with the answer (members switched off, a value typed on the card); null when nothing did. */\n readonly detail: DeckDetail | null;\n /** False when the card is not asked (its condition does not hold): its answer, if any, does not apply. */\n readonly shown: boolean;\n}\n\nexport interface DeckResult {\n readonly entries: readonly DeckResultEntry[];\n readonly answered: number;\n readonly total: number;\n readonly complete: boolean;\n /** Per answer id: how many items took it. */\n readonly counts: Readonly<Record<string, number>>;\n readonly picks: Readonly<Record<string, DeckItem>>;\n readonly categories: readonly DeckCategory[];\n readonly state: DeckState;\n /** When any item is graded: how many answered items were right, of how many graded items. */\n readonly score: { readonly right: number; readonly graded: number } | null;\n}\n\nexport function deckResult(items: readonly DeckItem[], state: DeckState, rules: DeckRules, conflict?: CategoryConflict): DeckResult {\n const counts: Record<string, number> = {};\n const asked = askedItems(items, state);\n const entries = items.map((item): DeckResultEntry => {\n const key = keyFor(rules, item);\n const more = moreFor(rules, item);\n const shown = asked.get(item.id) !== false;\n // A card not asked keeps its answer in the state, but the answer does not apply anywhere.\n const id = shown ? (state.answers[item.id] ?? null) : null;\n if (id) counts[id] = (counts[id] ?? 0) + 1;\n const parts = partsOf(state, item).map((p): DeckResultPart => {\n const pa = partAnswer(p, state, key, conflict);\n return { text: partText(item, p), start: p.start, end: p.end, categories: p.categories, answer: answerOf(key, pa), own: !!p.answer };\n });\n const correct = item.correct === undefined ? null : typeof item.correct === \"string\" ? [item.correct] : item.correct;\n const right = correct && id ? correct.includes(id) : null;\n return { item, answer: answerOf(key, id, more), parts, right, detail: (id && state.details?.[item.id]) || null, shown };\n });\n const picks: Record<string, DeckItem> = {};\n const groups = new Set(items.map((i) => i.group).filter((g): g is string => isPickGroup(rules, g)));\n for (const g of groups) {\n const p = pickedItem(items, state, rules, g);\n if (p) picks[g] = p;\n }\n const answered = entries.filter((e) => e.answer).length;\n const steps = deckSteps(items, state, rules);\n const complete = steps[currentStepIndex(steps, state)]?.kind === \"end\";\n const graded = entries.filter((e) => e.shown && e.item.correct !== undefined).length;\n const score = graded ? { right: entries.filter((e) => e.right === true).length, graded } : null;\n const total = entries.filter((e) => e.shown).length;\n return { entries, answered, total, complete, counts, picks, categories: Object.values(state.categories), state, score };\n}\n\nexport interface DeckCopyLabels {\n readonly suggestion: string;\n readonly reason: string;\n readonly answer: string;\n readonly unanswered: string;\n}\n\n/** One item as plain text for an AI or a note: what it says, what was suggested, and what the person answered. */\nexport function itemCopyText(\n item: DeckItem,\n state: DeckState,\n key: DeckKey,\n labels: DeckCopyLabels,\n conflict?: CategoryConflict,\n more?: readonly DeckAnswer[],\n): string {\n const lines = [[item.kicker, item.quoted ? `“${item.text}”` : item.text].filter(Boolean).join(\": \")];\n if (item.tag) lines.push(item.tag);\n const off = membersOff(item, state.details?.[item.id]);\n for (const m of item.members ?? []) lines.push(`- ${m.label}${off.includes(m.id) ? \" (off)\" : \"\"}`);\n const sug = answerOf(key, item.suggested, more);\n if (sug) lines.push(`${labels.suggestion}: ${item.suggestedLabel ?? sug.label}`);\n if (item.reason) lines.push(`${labels.reason}: ${item.reason}`);\n for (const f of item.fields ?? []) lines.push(`${f.label}: ${f.value}`);\n const parts = partsOf(state, item);\n for (const p of parts) {\n const a = answerOf(key, partAnswer(p, state, key, conflict));\n lines.push(`- ${partText(item, p)}: ${[a?.label, ...p.categories].filter(Boolean).join(\" · \")}`);\n }\n lines.push(`${labels.answer}: ${answerOf(key, state.answers[item.id], more)?.label ?? labels.unanswered}`);\n return lines.join(\"\\n\");\n}\n\nexport function deckCopyText(result: DeckResult, rules: DeckRules): string {\n const lines: string[] = [];\n for (const [group, item] of Object.entries(result.picks)) lines.push(`${group}: ${item.text}`);\n // Each answer given, in the deck's order (its edges, then the rest as they first appear).\n const order: DeckAnswer[] = DECK_DIRECTIONS.map((d) => rules.key[d]).filter((a): a is DeckAnswer => !!a);\n for (const e of result.entries) if (e.answer && !order.some((a) => a.id === e.answer?.id)) order.push(e.answer);\n for (const a of order) {\n const hits = result.entries.filter((e) => e.answer?.id === a.id);\n if (!hits.length) continue;\n if (lines.length) lines.push(\"\");\n lines.push(`${a.label}:`);\n for (const e of hits) lines.push(`- ${e.item.text}`);\n }\n const placed = result.entries.flatMap((e) => e.parts.filter((p) => p.own && p.answer).map((p) => `- ${p.text}: ${p.answer?.label ?? \"\"}`));\n if (placed.length) lines.push(\"\", ...placed);\n return lines.join(\"\\n\");\n}\n\n// ─── chained decks ────────────────────────────────────────────────────────\n\n/**\n * Feed one deck's answers into the next deck's suggestions: each next item names the earlier item it\n * follows (`link`), and the earlier answer maps to the next suggestion (`map`, identity by default).\n * An item that already carries a suggestion keeps it.\n */\nexport function chainSuggestions(\n next: readonly DeckItem[],\n previous: DeckResult | DeckState,\n link: (item: DeckItem) => string | null | undefined,\n map: (answerId: string, item: DeckItem) => string | null | undefined = (a) => a,\n): DeckItem[] {\n const answers = \"entries\" in previous ? previous.state.answers : previous.answers;\n return next.map((item) => {\n if (item.suggested) return item;\n const from = link(item);\n const prior = from ? answers[from] : undefined;\n const suggested = prior ? map(prior, item) : undefined;\n return suggested ? { ...item, suggested } : item;\n });\n}\n","/**\n * THE SWIPE GESTURE — one pointer, four ways, plus tap and hold.\n *\n * A press that moves more than a few pixels becomes a drag; the drag commits when it passes the\n * distance threshold OR when it is released as a flick (speed over the last ~100ms, so a short fast\n * throw counts the way it does on every phone). A press that never moves is a tap; held still over\n * a `holdSelector` element it becomes a hold. Nothing here renders: the caller moves the card through\n * `move`, which runs per pointer event without touching React state (60fps on a mid-range phone).\n */\nimport type { DeckDirection } from \"./model\";\nimport { buzz } from \"./visual\";\n\nexport interface SwipeHandlers {\n enabled(): boolean;\n directions(): Partial<Record<DeckDirection, unknown>>;\n start?(): void;\n /** `amount` is distance over the threshold: 1 means letting go here commits. */\n move(dx: number, dy: number, dir: DeckDirection | null, amount: number): void;\n release(): void;\n /** `speed` in px/ms, so the card can leave as fast as it was thrown. */\n commit(dir: DeckDirection, speed: number): void;\n tap?(target: Element): void;\n hold?(target: Element): void;\n holdSelector?: string;\n /** Presses starting inside these never swipe (buttons, inputs, chip rows). */\n ignoreSelector?: string;\n}\n\nexport const HOLD_MS = 450;\nconst DRAG_SLOP = 10;\nconst FLICK_MIN_DISTANCE = 40;\nconst FLICK_MIN_SPEED = 0.55;\n\nexport function swipeThreshold(width: number): number {\n return Math.max(70, Math.min(120, width * 0.2));\n}\n\nexport function dominantDirection(dx: number, dy: number): DeckDirection {\n return Math.abs(dx) >= Math.abs(dy) ? (dx > 0 ? \"right\" : \"left\") : dy < 0 ? \"up\" : \"down\";\n}\n\n/** Decide a release: commit a direction, or null to snap back. Pure, so it is tested alone. */\nexport function releaseDecision(\n dx: number,\n dy: number,\n speed: number,\n width: number,\n enabled: Partial<Record<DeckDirection, unknown>>,\n): DeckDirection | null {\n const dir = dominantDirection(dx, dy);\n if (!enabled[dir]) return null;\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n if (dist >= swipeThreshold(width)) return dir;\n if (dist > FLICK_MIN_DISTANCE && speed > FLICK_MIN_SPEED) return dir;\n return null;\n}\n\nexport function attachSwipe(root: HTMLElement, h: SwipeHandlers): () => void {\n let id: number | null = null;\n let sx = 0;\n let sy = 0;\n let dx = 0;\n let dy = 0;\n let mode: \"press\" | \"drag\" | \"held\" | null = null;\n let holdTimer: ReturnType<typeof setTimeout> | null = null;\n let downTarget: Element | null = null;\n let samples: { t: number; x: number; y: number }[] = [];\n const view = root.ownerDocument.defaultView ?? window;\n\n const clearHold = () => {\n if (holdTimer) clearTimeout(holdTimer);\n holdTimer = null;\n root.querySelectorAll(\"[data-sd-press]\").forEach((el) => el.removeAttribute(\"data-sd-press\"));\n };\n\n const width = () => root.getBoundingClientRect().width || view.innerWidth;\n\n const onDown = (e: PointerEvent) => {\n if (id !== null || e.button > 0 || !h.enabled()) return;\n const target = e.target instanceof Element ? e.target : null;\n if (!target || target.closest(h.ignoreSelector ?? \"button, a, input, textarea, [data-sd-noswipe]\")) return;\n id = e.pointerId;\n sx = e.clientX;\n sy = e.clientY;\n dx = dy = 0;\n mode = \"press\";\n downTarget = target;\n samples = [{ t: e.timeStamp, x: e.clientX, y: e.clientY }];\n h.start?.();\n const holdable = h.hold && h.holdSelector ? target.closest(h.holdSelector) : null;\n if (holdable) {\n holdable.setAttribute(\"data-sd-press\", \"\");\n holdTimer = setTimeout(() => {\n if (mode !== \"press\") return;\n mode = \"held\";\n clearHold();\n buzz(view.navigator, 10);\n h.hold?.(holdable);\n }, HOLD_MS);\n }\n view.addEventListener(\"pointermove\", onMove);\n view.addEventListener(\"pointerup\", onUp);\n view.addEventListener(\"pointercancel\", onCancel);\n };\n\n const onMove = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n dx = e.clientX - sx;\n dy = e.clientY - sy;\n samples.push({ t: e.timeStamp, x: e.clientX, y: e.clientY });\n if (samples.length > 8) samples.shift();\n if (mode === \"press\" && Math.hypot(dx, dy) > DRAG_SLOP) {\n clearHold();\n mode = \"drag\";\n }\n if (mode !== \"drag\") return;\n const dir = dominantDirection(dx, dy);\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n h.move(dx, dy, h.directions()[dir] ? dir : null, dist / swipeThreshold(width()));\n };\n\n const detach = () => {\n view.removeEventListener(\"pointermove\", onMove);\n view.removeEventListener(\"pointerup\", onUp);\n view.removeEventListener(\"pointercancel\", onCancel);\n };\n\n const speedNow = (t: number) => {\n const recent = samples.filter((s) => t - s.t <= 100);\n const first = recent[0];\n const last = samples[samples.length - 1];\n if (!first || !last || last.t === first.t) return 0;\n return Math.hypot(last.x - first.x, last.y - first.y) / (last.t - first.t);\n };\n\n const onUp = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n detach();\n clearHold();\n const m = mode;\n id = null;\n mode = null;\n if (m === \"drag\") {\n const speed = speedNow(e.timeStamp);\n const dir = releaseDecision(dx, dy, speed, width(), h.directions());\n if (dir) h.commit(dir, speed);\n else h.release();\n } else if (m === \"press\" && downTarget) h.tap?.(downTarget);\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n detach();\n clearHold();\n const m = mode;\n id = null;\n mode = null;\n if (m === \"drag\") h.release();\n };\n\n const onContext = (e: Event) => {\n if (h.hold) e.preventDefault();\n };\n\n // iOS Safari: a vertical swipe while the page under the deck can scroll is taken by the page (the swipe\n // is cancelled, so \"up\" never answered there) unless the touch's own move is refused. Refused only while\n // this deck holds a press, and a vertical move only when the deck answers up or down (a two-way deck in a\n // chat lets the chat scroll).\n let touchFrom: { x: number; y: number } | null = null;\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n touchFrom = t ? { x: t.clientX, y: t.clientY } : null;\n };\n const onTouchMove = (e: TouchEvent) => {\n if (id === null || !e.cancelable) return;\n const t = e.touches[0];\n const mx = t && touchFrom ? t.clientX - touchFrom.x : dx;\n const my = t && touchFrom ? t.clientY - touchFrom.y : dy;\n const dirs = h.directions();\n if (Math.abs(my) > Math.abs(mx) && !dirs.up && !dirs.down) return;\n e.preventDefault();\n };\n\n root.addEventListener(\"pointerdown\", onDown);\n root.addEventListener(\"contextmenu\", onContext);\n root.addEventListener(\"touchstart\", onTouchStart, { passive: true });\n root.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n return () => {\n detach();\n clearHold();\n root.removeEventListener(\"pointerdown\", onDown);\n root.removeEventListener(\"contextmenu\", onContext);\n root.removeEventListener(\"touchstart\", onTouchStart);\n root.removeEventListener(\"touchmove\", onTouchMove);\n };\n}\n","/** Every word the deck draws: short, because in-app text is layout. A host overrides any of them. */\nexport interface SwipeDeckLabels {\n readonly suggestion: string;\n readonly reason: string;\n readonly exit: string;\n readonly help: string;\n readonly undo: string;\n readonly copy: string;\n readonly copied: string;\n readonly copyFailed: string;\n readonly part: string;\n readonly keep: string;\n readonly forget: string;\n readonly forgotten: string;\n readonly category: string;\n readonly addCategory: string;\n readonly newCategory: string;\n readonly done: string;\n readonly holdHint: string;\n readonly clickHint: string;\n readonly answer: string;\n readonly unanswered: string;\n readonly next: string;\n readonly undone: string;\n readonly pick: string;\n readonly expand: string;\n readonly collapse: string;\n readonly score: string;\n /** The end's headline when nothing else leads it. */\n readonly allDone: string;\n /** \"{answered} of {total} answered\". */\n readonly answeredOf: string;\n /** The end's list of answers. */\n readonly yourAnswers: string;\n /** On an answered item at the end: take this answer back and answer it again. */\n readonly change: string;\n readonly rightAnswer: string;\n readonly right: string;\n readonly wrong: string;\n readonly showAll: string;\n /** The finish's filter chips, by name. */\n readonly filterAnswers: string;\n /** The empty screen (no items). */\n readonly emptyTitle: string;\n /** The corner that opens every answer so far, and that list's title. */\n readonly answered: string;\n /** Leave the answered list for the card in focus. */\n readonly backToCards: string;\n}\n\nexport const DEFAULT_SWIPE_DECK_LABELS: SwipeDeckLabels = {\n suggestion: \"Suggestion\",\n reason: \"Reason\",\n exit: \"Exit\",\n help: \"Show me how\",\n undo: \"Undo\",\n copy: \"Copy\",\n copied: \"Copied\",\n copyFailed: \"Copy failed\",\n part: \"This part\",\n keep: \"Keep as is\",\n forget: \"Forget this\",\n forgotten: \"Forgotten\",\n category: \"Category\",\n addCategory: \"Add a category\",\n newCategory: \"New category\",\n done: \"Done\",\n holdHint: \"Hold any word\",\n clickHint: \"Double-click any word\",\n answer: \"Answer\",\n unanswered: \"Not answered\",\n next: \"Next\",\n undone: \"Undone\",\n pick: \"Pick one\",\n expand: \"Full screen\",\n collapse: \"Exit full screen\",\n score: \"Score\",\n allDone: \"All done\",\n answeredOf: \"{answered} of {total} answered\",\n yourAnswers: \"Your answers\",\n answered: \"Answered\",\n backToCards: \"Back to cards\",\n change: \"Change\",\n rightAnswer: \"Right answer\",\n right: \"Right\",\n wrong: \"Wrong\",\n showAll: \"All\",\n filterAnswers: \"Filter answers\",\n emptyTitle: \"Nothing to answer\",\n};\n","\"use client\";\n\n/**\n * THE PART SCREEN — one part of an item (a span of its words), answered with the same four swipes.\n *\n * Select the span by dragging either handle, sweeping across words, or tapping a word to grow or\n * shrink it; tag it from the category rows (\"+\" adds a missing category and gives that category its\n * own answer with the same swipe); place it; or forget it. Down keeps it as is.\n */\nimport * as React from \"react\";\n\nimport { Input } from \"../input\";\nimport { EraserIcon, PlusIcon, XIcon } from \"../icons\";\nimport { CornerButton, EdgeButtons, setHot, Wash, type EdgeRefs, type WashHandle } from \"./chrome\";\nimport { attachSwipe } from \"./gesture\";\nimport {\n answerOf,\n directionOf,\n KEEP_ANSWER_ID,\n partSuggestion,\n tokenize,\n type CategoryConflict,\n type DeckDirection,\n type DeckItem,\n type DeckKey,\n type DeckCategoryRow,\n type DeckPart,\n type DeckState,\n} from \"./model\";\nimport { fitText, flyOut, follow, keepFitted, snapBack } from \"./visual\";\nimport type { SwipeDeckLabels } from \"./labels\";\n\nexport interface PartScreenProps {\n readonly item: DeckItem;\n readonly parts: readonly DeckPart[];\n readonly initial: { start: number; end: number };\n readonly keyMap: DeckKey;\n /** The deck's key: what a category's answer means (flows down to parts). */\n readonly deckKey: DeckKey;\n readonly state: DeckState;\n readonly categories: readonly string[];\n /** Labelled chip rows (\"Who\", \"Cares about\"); each has its own \"+\". Absent: one row of every category. */\n readonly rows?: readonly DeckCategoryRow[] | undefined;\n readonly allowNewCategories: boolean;\n readonly conflict: CategoryConflict | undefined;\n readonly labels: SwipeDeckLabels;\n readonly onClose: () => void;\n readonly onPlace: (part: DeckPart) => void;\n readonly onForget: (span: { start: number; end: number }) => void;\n readonly onCategoryAnswer: (name: string, answer: string | null, row?: string) => void;\n readonly announce: (text: string) => void;\n}\n\nfunction overlapping(parts: readonly DeckPart[], s: number, e: number): DeckPart[] {\n return parts.filter((p) => !(p.end < s || p.start > e));\n}\n\nexport function PartScreen(props: PartScreenProps) {\n const { item, parts, keyMap, deckKey, state, labels, conflict } = props;\n const tokens = React.useMemo(() => tokenize(item.text), [item.text]);\n const exactAt = (s: number, e: number) => parts.find((p) => p.start === s && p.end === e) ?? null;\n const startPart = parts.find((p) => props.initial.start >= p.start && props.initial.start <= p.end) ?? null;\n const [sel, setSel] = React.useState(() => (startPart ? { s: startPart.start, e: startPart.end } : { s: props.initial.start, e: props.initial.end }));\n const [tagged, setTagged] = React.useState<readonly string[]>(() => startPart?.categories ?? []);\n /** The row whose \"+\" is open (\"\" when the deck has no rows), or null. */\n const [adding, setAdding] = React.useState<string | null>(null);\n const [draft, setDraft] = React.useState(\"\");\n /** Giving a just-added category its own answer: the phrase area shows the category instead. */\n const [categoryMode, setCategoryMode] = React.useState<string | null>(null);\n const [categoryModeRow, setCategoryModeRow] = React.useState<string | undefined>(undefined);\n const [extra, setExtra] = React.useState<readonly { name: string; row: string }[]>([]);\n const guard = React.useRef(true);\n const busy = React.useRef(false);\n\n React.useEffect(() => {\n const t = setTimeout(() => {\n guard.current = false;\n }, 350);\n return () => clearTimeout(t);\n }, []);\n\n const exact = exactAt(sel.s, sel.e);\n const draftPart: DeckPart = { start: sel.s, end: sel.e, categories: tagged, suggested: exact?.suggested ?? null, answer: exact?.answer ?? null };\n const suggestedId = categoryMode ? null : partSuggestion(draftPart, state, deckKey, conflict);\n const suggestedDir = directionOf(keyMap, suggestedId);\n const phrase = categoryMode ?? tokens.slice(sel.s, sel.e + 1).join(\" \").replace(/^[“\"‘'(\\[]+|[”\"’'.,;:!?)\\]]+$/g, \"\");\n const nowAnswer = exact ? answerOf(deckKey, exact.answer ?? partSuggestion(exact, state, deckKey, conflict)) : null;\n const allCategories = React.useMemo(\n () => [...props.categories, ...extra.map((x) => x.name).filter((c) => !props.categories.includes(c))],\n [props.categories, extra],\n );\n // The chip rows: the deck's rows (anything they do not name joins the first), or one row of every category.\n const chipRows = React.useMemo(() => {\n const given = props.rows?.length ? props.rows : null;\n if (!given) return [{ id: \"\", label: null as string | null, categories: allCategories }];\n const named = new Set(given.flatMap((r) => r.categories));\n const loose = allCategories.filter((c) => !named.has(c) && !extra.some((x) => x.name === c));\n return given.map((r, i) => ({\n id: r.id,\n label: r.label as string | null,\n categories: [...r.categories, ...(i === 0 ? loose : []), ...extra.filter((x) => x.row === r.id && !r.categories.includes(x.name)).map((x) => x.name)],\n }));\n }, [props.rows, allCategories, extra]);\n\n // ─── the swipe on the phrase ───────────────────────────────────────────\n const frameRef = React.useRef<HTMLDivElement>(null);\n const phraseRef = React.useRef<HTMLDivElement>(null);\n const edgeRefs = React.useRef<EdgeRefs>({});\n const wash = React.useRef<WashHandle>(null);\n\n const act = async (dir: DeckDirection, speed = 0) => {\n if (busy.current || guard.current) return;\n const answer = keyMap[dir];\n if (!answer) return;\n if (answer.id === KEEP_ANSWER_ID) {\n if (categoryMode) {\n setCategoryMode(null);\n return;\n }\n // Keep as is: the answer stays; a new span or a changed tag is still kept.\n const changed = !exact || exact.categories.join(\"\\u0000\") !== tagged.join(\"\\u0000\");\n if (changed && (exact || tagged.length)) props.onPlace(draftPart);\n props.onClose();\n return;\n }\n busy.current = true;\n wash.current?.show(answer, dir, 1);\n setHot(edgeRefs.current, dir);\n await flyOut(phraseRef.current, dir, speed);\n busy.current = false;\n if (categoryMode) {\n props.onCategoryAnswer(categoryMode, answer.id, categoryModeRow || undefined);\n props.announce(`${categoryMode}: ${answer.label}`);\n setCategoryMode(null);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n if (phraseRef.current) {\n phraseRef.current.style.transition = \"none\";\n phraseRef.current.style.transform = \"\";\n phraseRef.current.style.opacity = \"\";\n }\n return;\n }\n props.onPlace({ ...draftPart, answer: answer.id });\n props.announce(`${phrase}: ${answer.label}`);\n props.onClose();\n };\n const actRef = React.useRef(act);\n actRef.current = act;\n\n React.useEffect(() => {\n const root = frameRef.current;\n if (!root) return;\n return attachSwipe(root, {\n enabled: () => !busy.current && !guard.current,\n directions: () => keyMap,\n move: (dx, dy, dir, amount) => {\n const answer = dir ? keyMap[dir] : undefined;\n follow(phraseRef.current, dx, dy, dir && answer ? amount : 0);\n if (dir && answer) {\n wash.current?.show(answer, dir, amount);\n setHot(edgeRefs.current, amount >= 1 ? dir : null);\n } else {\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n }\n },\n release: () => {\n snapBack(phraseRef.current);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n },\n commit: (dir, speed) => void actRef.current(dir, speed),\n ignoreSelector: \"button, a, input, textarea, [data-sd-noswipe]\",\n });\n }, [keyMap]);\n\n // ─── selecting the span ────────────────────────────────────────────────\n const sentRef = React.useRef<HTMLDivElement>(null);\n const handleS = React.useRef<HTMLSpanElement>(null);\n const handleE = React.useRef<HTMLSpanElement>(null);\n const sweep = React.useRef<{ id: number; mode: \"s\" | \"e\" | \"sweep\"; anchor: number | null; moved: boolean } | null>(null);\n\n React.useLayoutEffect(() => {\n const box = sentRef.current;\n if (!box) return;\n const a = box.querySelector<HTMLElement>(`[data-sd-w=\"${sel.s}\"]`);\n const b = box.querySelector<HTMLElement>(`[data-sd-w=\"${sel.e}\"]`);\n const hs = handleS.current;\n const he = handleE.current;\n if (!a || !b || !hs || !he) return;\n const r = box.getBoundingClientRect();\n const ra = a.getBoundingClientRect();\n const rb = b.getBoundingClientRect();\n const st = box.scrollTop;\n hs.style.left = `${ra.left - r.left}px`;\n hs.style.top = `${ra.top - r.top + st - 12}px`;\n hs.style.height = `${ra.height + 22}px`;\n he.style.left = `${rb.right - r.left}px`;\n he.style.top = `${rb.top - r.top + st - 10}px`;\n he.style.height = `${rb.height + 22}px`;\n });\n\n const wordAt = (x: number, y: number): number | null => {\n const doc = sentRef.current?.ownerDocument;\n const el = doc?.elementFromPoint(x, y);\n const t = el?.closest(\"[data-sd-w], [data-sd-sp]\");\n if (!t || !sentRef.current?.contains(t)) return null;\n const v = t.getAttribute(\"data-sd-w\") ?? t.getAttribute(\"data-sd-sp\");\n return v === null ? null : Number(v);\n };\n\n const tapWord = (i: number) =>\n setSel(({ s, e }) => {\n if (i < s) return { s: i, e };\n if (i > e) return { s, e: i };\n if (s === e) return { s, e };\n if (i === s) return { s: s + 1, e };\n if (i === e) return { s, e: e - 1 };\n return { s: i, e: i };\n });\n\n const onSentDown = (ev: React.PointerEvent) => {\n if (guard.current || categoryMode) return;\n const target = ev.target instanceof Element ? ev.target : null;\n const handle = target?.closest(\"[data-sd-handle]\");\n const word = target?.closest(\"[data-sd-w]\");\n if (!handle && !word) return;\n ev.preventDefault();\n sweep.current = {\n id: ev.pointerId,\n mode: handle ? (handle.getAttribute(\"data-sd-handle\") === \"s\" ? \"s\" : \"e\") : \"sweep\",\n anchor: word ? Number(word.getAttribute(\"data-sd-w\")) : null,\n moved: false,\n };\n const view = sentRef.current?.ownerDocument.defaultView ?? window;\n const move = (e: PointerEvent) => {\n const sw = sweep.current;\n if (!sw || e.pointerId !== sw.id) return;\n const k = wordAt(e.clientX, e.clientY);\n if (k === null) return;\n if (sw.mode === \"s\") setSel(({ e: end }) => ({ s: Math.min(k, end), e: end }));\n else if (sw.mode === \"e\") setSel(({ s }) => ({ s, e: Math.max(k, s) }));\n else if (sw.anchor !== null && (k !== sw.anchor || sw.moved)) {\n sw.moved = true;\n const anchor = sw.anchor;\n setSel({ s: Math.min(k, anchor), e: Math.max(k, anchor) });\n }\n };\n const up = (e: PointerEvent) => {\n const sw = sweep.current;\n if (!sw || e.pointerId !== sw.id) return;\n view.removeEventListener(\"pointermove\", move);\n view.removeEventListener(\"pointerup\", up);\n view.removeEventListener(\"pointercancel\", up);\n if (sw.mode === \"sweep\" && !sw.moved && sw.anchor !== null) tapWord(sw.anchor);\n sweep.current = null;\n };\n view.addEventListener(\"pointermove\", move);\n view.addEventListener(\"pointerup\", up);\n view.addEventListener(\"pointercancel\", up);\n };\n\n // On open, the chosen words are in view (a late word in a long line sits below the capped box) and hold\n // the focus, so the keyboard can grow or shrink them at once.\n React.useEffect(() => {\n const word = sentRef.current?.querySelector<HTMLElement>(`[data-sd-w=\"${sel.s}\"]`);\n word?.scrollIntoView?.({ block: \"nearest\" });\n word?.focus({ preventScroll: true });\n // Open only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // When the span moves onto an existing part, its tags come with it.\n const lastSpan = React.useRef(`${sel.s}:${sel.e}`);\n React.useEffect(() => {\n const k = `${sel.s}:${sel.e}`;\n if (k === lastSpan.current) return;\n lastSpan.current = k;\n const hit = parts.find((p) => p.start === sel.s && p.end === sel.e);\n if (hit) setTagged(hit.categories);\n }, [sel, parts]);\n\n // ─── fit the phrase ────────────────────────────────────────────────────\n const stageRef = React.useRef<HTMLDivElement>(null);\n const pinRef = React.useRef<HTMLDivElement>(null);\n const textRef = React.useRef<HTMLParagraphElement>(null);\n React.useLayoutEffect(() => {\n const box = stageRef.current;\n if (!box || !pinRef.current || !textRef.current) return;\n return keepFitted(box, () => {\n if (pinRef.current && textRef.current) fitText(box, pinRef.current, textRef.current, 22, (box.ownerDocument.defaultView?.innerWidth ?? 0) >= 1024 ? 120 : 84);\n });\n }, [phrase, nowAnswer?.id, categoryMode]);\n\n const addCategory = () => {\n const name = draft.trim();\n const row = adding ?? \"\";\n setAdding(null);\n setDraft(\"\");\n if (!name) return;\n if (!allCategories.includes(name)) setExtra((x) => [...x, { name, row }]);\n setTagged((t) => (t.includes(name) ? t : [...t, name]));\n if (!state.categories[name]?.answer) {\n setCategoryMode(name);\n setCategoryModeRow(row);\n }\n };\n\n // Escape closes (keeping as is); the arrows answer.\n React.useEffect(() => {\n const view = frameRef.current?.ownerDocument.defaultView ?? window;\n const onKey = (e: KeyboardEvent) => {\n const t = e.target instanceof Element ? e.target : null;\n if (t?.closest(\"input, textarea, [contenteditable='true']\")) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const dir = ({ ArrowRight: \"right\", ArrowLeft: \"left\", ArrowUp: \"up\", ArrowDown: \"down\" } as const)[e.key as \"ArrowRight\"];\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopImmediatePropagation();\n if (categoryMode) setCategoryMode(null);\n else props.onClose();\n } else if (dir) {\n e.preventDefault();\n e.stopImmediatePropagation();\n // A held arrow places the part once.\n if (!e.repeat) void actRef.current(dir);\n }\n };\n view.addEventListener(\"keydown\", onKey, true);\n return () => view.removeEventListener(\"keydown\", onKey, true);\n }, [categoryMode, props]);\n\n // The first tagged chip is in view when the screen opens or the tags move.\n const chipsRef = React.useRef<HTMLDivElement>(null);\n const firstTag = tagged[0];\n React.useEffect(() => {\n const on = chipsRef.current?.querySelector<HTMLElement>('[aria-pressed=\"true\"]');\n on?.scrollIntoView?.({ block: \"nearest\", inline: \"center\" });\n }, [firstTag]);\n\n const canForget = !categoryMode && overlapping(parts, sel.s, sel.e).length > 0;\n\n return (\n <div ref={frameRef} className=\"matrx-sd-frame matrx-sd-partscreen\" role=\"dialog\" aria-modal=\"true\" aria-label={labels.part}>\n <CornerButton corner=\"tl\" label={labels.keep} shortcut=\"Escape\" onClick={() => (categoryMode ? setCategoryMode(null) : props.onClose())}>\n <XIcon />\n </CornerButton>\n <div className=\"matrx-sd-partbody\">\n <div ref={sentRef} className=\"matrx-sd-sentence\" data-sd-noswipe=\"\" data-dim={categoryMode ? \"\" : undefined} onPointerDown={onSentDown}>\n {tokens.map((t, i) => (\n <React.Fragment key={i}>\n {i > 0 ? (\n <span className=\"matrx-sd-space\" data-sd-sp={i} data-sel={i > sel.s && i <= sel.e ? \"\" : undefined}>\n {\" \"}\n </span>\n ) : null}\n <span\n className=\"matrx-sd-word\"\n tabIndex={0}\n role=\"button\"\n aria-pressed={i >= sel.s && i <= sel.e}\n onKeyDown={(e) => {\n // The keyboard's way to grow or shrink the words: Enter or Space on a word, as a tap does.\n if ((e.key === \"Enter\" || e.key === \" \") && !e.repeat && !categoryMode) {\n e.preventDefault();\n tapWord(i);\n }\n }}\n data-sd-w={i}\n data-sel={i >= sel.s && i <= sel.e ? \"\" : undefined}\n data-first={i === sel.s ? \"\" : undefined}\n data-last={i === sel.e ? \"\" : undefined}\n >\n {t}\n </span>\n </React.Fragment>\n ))}\n <span ref={handleS} className=\"matrx-sd-handle\" data-sd-handle=\"s\" aria-hidden=\"true\" />\n <span ref={handleE} className=\"matrx-sd-handle\" data-sd-handle=\"e\" aria-hidden=\"true\" />\n </div>\n <div ref={stageRef} className=\"matrx-sd-phrase-stage\">\n <div ref={phraseRef} className=\"matrx-sd-phrase\">\n <div ref={pinRef}>\n {categoryMode ? <div className=\"matrx-sd-kicker\">{labels.category}</div> : null}\n <p ref={textRef} className=\"matrx-sd-phrase-text\" data-quoted={categoryMode ? undefined : \"\"}>\n {phrase}\n </p>\n {nowAnswer && !categoryMode ? (\n <div className=\"matrx-sd-now\" data-tone={nowAnswer.tone}>\n <i />\n <span>{[nowAnswer.label, ...(exact?.categories ?? [])].join(\" · \")}</span>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n <div ref={chipsRef} className=\"matrx-sd-chip-rows\" data-sd-noswipe=\"\">\n {chipRows.map((row) => (\n <div key={row.id || \"all\"} className=\"matrx-sd-chips\" role=\"group\" aria-label={row.label ?? labels.category}>\n {row.label ? <span className=\"matrx-sd-chip-row-label\">{row.label}</span> : null}\n {row.categories.map((c) => {\n const on = tagged.includes(c);\n const ca = answerOf(deckKey, state.categories[c]?.answer);\n return (\n // ui-exception: category chips are the part screen's own toggle row\n <button\n key={c}\n type=\"button\"\n className=\"matrx-sd-chip\"\n aria-pressed={on}\n data-tone={ca?.tone}\n disabled={!!categoryMode}\n onClick={() => setTagged((t) => (on ? t.filter((x) => x !== c) : [...t, c]))}\n >\n {ca ? <i aria-hidden=\"true\" /> : null}\n {c}\n </button>\n );\n })}\n {props.allowNewCategories && !categoryMode ? (\n adding === row.id ? (\n <Input\n className=\"matrx-sd-chip-input\"\n autoFocus\n aria-label={labels.newCategory}\n enterKeyHint=\"done\"\n autoComplete=\"off\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={addCategory}\n onKeyDown={(e) => {\n e.stopPropagation();\n if (e.key === \"Enter\") {\n e.preventDefault();\n addCategory();\n } else if (e.key === \"Escape\") {\n setAdding(null);\n setDraft(\"\");\n }\n }}\n />\n ) : (\n // ui-exception: the chip row's own add target\n <button\n type=\"button\"\n className=\"matrx-sd-chip\"\n data-add=\"\"\n aria-label={row.label ? `${labels.addCategory}: ${row.label}` : labels.addCategory}\n title={labels.addCategory}\n onClick={() => setAdding(row.id)}\n >\n <PlusIcon />\n </button>\n )\n ) : null}\n </div>\n ))}\n </div>\n </div>\n <EdgeButtons keyMap={keyMap} suggested={suggestedDir} refs={edgeRefs} onAnswer={(d) => void act(d)} suggestionLabel={labels.suggestion} />\n {canForget ? (\n <CornerButton\n corner=\"br\"\n label={labels.forget}\n onClick={() => {\n if (guard.current) return;\n props.onForget({ start: sel.s, end: sel.e });\n props.onClose();\n }}\n >\n <EraserIcon />\n </CornerButton>\n ) : null}\n <Wash ref={wash} />\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full ${FIELD_SURFACE_CLASS} text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground\n focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-none\n transition duration-400\n [&:-webkit-autofill]:bg-card [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--card))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n `flex h-9 w-full rounded-md ${FIELD_SURFACE_CLASS} px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-50`,\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n /**\n * Where the prefix glyph sits. `default`: 12px in. `edge`: 8px in, so a field at the column's\n * padding puts its glyph on the same left edge as the icons of the rows under it (a sidebar's\n * Search over its rows; Arman, 2026-10-23: one left edge).\n */\n prefixInset?: \"default\" | \"edge\";\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, prefixInset = \"default\", className, wrapperClassName, ...props }, ref) => {\n const edge = prefixInset === \"edge\";\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground\",\n edge ? \"left-2\" : \"left-3\",\n )}\n data-prefix-inset={prefixInset}\n >\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && (edge ? \"pl-8\" : \"pl-10\"), className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE ONE FIELD SURFACE (page-pass shared fix, 2026-09-27).\n *\n * Every control a person types into or picks from — Input, BasicInput,\n * Textarea, the Select trigger, and the host's ProInput / ProTextarea — sits on\n * this fill and this border. They used to disagree: Input and the elevated\n * Textarea filled with `bg-background` (the gray page color in light mode),\n * BasicInput and the control Textarea were `bg-transparent` (gray on a gray\n * page), while the Select trigger filled with `bg-card` (white). On one form\n * the text fields therefore looked disabled beside white Selects\n * (/hr/settings/employer, the message-template editor) — a screen that lies\n * about what it will let you do.\n *\n * The surface is the Select's: the card fill and the regular border. A caller\n * that genuinely wants no fill (an inline cell editor) still passes\n * `bg-transparent`, which wins through `cn`.\n */\nexport const FIELD_SURFACE_CLASS = \"border border-border bg-card\";\n","\"use client\";\n\n/**\n * ExpandableSwipeDeck — the deck as a box in the flow (a chat message), fully usable where it is\n * (swipe, keys while focused, buttons, undo), with a corner that opens the SAME deck full screen.\n * Both views share one controller, so answers AND the undo history carry across; leaving full\n * screen (the corner, or Escape) returns to the box exactly where the person is.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDeckController } from \"./controller\";\nimport { SwipeDeck, type SwipeDeckProps } from \"./SwipeDeck\";\n\nexport type ExpandableSwipeDeckProps = Omit<SwipeDeckProps, \"layout\" | \"onExpand\" | \"controller\" | \"onExit\" | \"exitKind\"> & {\n /** Full screen from the start (a host that opened the deck from elsewhere). */\n readonly defaultExpanded?: boolean;\n /** Told when the person opens or leaves full screen (a host may prefer its own canvas: return true to take it over). */\n readonly onExpandChange?: (expanded: boolean) => boolean | void;\n};\n\nexport function ExpandableSwipeDeck({ defaultExpanded = false, onExpandChange, ...props }: ExpandableSwipeDeckProps) {\n const controller = useDeckController({ items: props.items, binding: props.binding, initialState: props.initialState, onChange: props.onChange });\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const boxRef = React.useRef<HTMLDivElement>(null);\n const open = () => {\n if (onExpandChange?.(true) === true) return;\n setExpanded(true);\n };\n const close = () => {\n onExpandChange?.(false);\n setExpanded(false);\n // Back in the chat, the box holds the keys again.\n requestAnimationFrame(() => boxRef.current?.querySelector<HTMLElement>(\".matrx-sd\")?.focus({ preventScroll: true }));\n };\n const doc = typeof document === \"undefined\" ? null : document;\n return (\n <div ref={boxRef} className=\"matrx-sd-inline-host\">\n {expanded ? (\n // The box keeps its height while the deck is full screen, so the chat never jumps.\n <div className=\"matrx-sd\" data-layout=\"inline\" aria-hidden=\"true\" />\n ) : (\n <SwipeDeck {...props} layout=\"inline\" controller={controller} onExpand={open} />\n )}\n {expanded && doc\n ? createPortal(<SwipeDeck {...props} layout=\"fullscreen\" controller={controller} onExit={close} exitKind=\"collapse\" tourKey={null} />, doc.body)\n : null}\n </div>\n );\n}\n","/**\n * THE ONE READER of a `swipe_deck` kind value (what an agent writes) into the deck's own terms.\n *\n * Only `items[].text` is required; every other field is optional and nothing is invented for what is\n * absent. Directions are the agent's words: `suggested: \"right\"`, `answers: { up: null }`, a mark's\n * `lean: \"left\"`. An item's `choices` (2 to 8) become that item's own answers: the first four placed\n * clockwise from the top (2: right, left; 3: up, right, left; 4: up, right, down, left), any more as\n * buttons on the card; `correct` names a choice by its words (or a direction). Server declaration: aidream `aidream/kinds/swipe_deck.py`.\n */\nimport { DEFAULT_DECK_KEY, DECK_DIRECTIONS, askedItems, conditionProblems, mergeKey, readDeckCondition, type DeckAnswer, type DeckDirection, type DeckItem, type DeckKey, type DeckKeyOverride, type DeckTone } from \"./model\";\n\nexport interface SwipeDeckKindDeck {\n readonly title: string | null;\n readonly items: DeckItem[];\n /** The deck's key over the default; undefined when the value names none. */\n readonly answers: DeckKeyOverride | undefined;\n readonly pickOne: boolean;\n readonly categories: string[];\n /** Every item carries its own choices: the deck is a quiz-like set of questions. */\n readonly everyItemHasChoices: boolean;\n /** What the agent wrote that could not be honored (a right answer naming no choice, extra choices). Never silent: the host reports them. */\n readonly problems: string[];\n}\n\nconst TONES: readonly DeckTone[] = [\"success\", \"info\", \"destructive\", \"warning\", \"primary\", \"neutral\"];\nconst CHOICE_PLACES: Record<number, readonly DeckDirection[]> = {\n 2: [\"right\", \"left\"],\n 3: [\"up\", \"right\", \"left\"],\n 4: [\"up\", \"right\", \"down\", \"left\"],\n};\n/** Choice tones read as distinct options, never as right/wrong (no green, no red). */\nconst CHOICE_TONES: Record<DeckDirection, DeckTone> = { up: \"primary\", right: \"info\", down: \"warning\", left: \"neutral\" };\n\n/** A card holds four answers on its edges and four more as buttons. */\nconst MAX_CHOICES = 8;\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst text = (v: unknown): string => (typeof v === \"string\" ? v.trim() : typeof v === \"number\" ? String(v) : \"\");\nconst isDirection = (v: unknown): v is DeckDirection => typeof v === \"string\" && (DECK_DIRECTIONS as readonly string[]).includes(v);\n\nfunction answerOverride(raw: unknown): DeckKeyOverride | undefined {\n if (!isRecord(raw)) return undefined;\n const out: { -readonly [D in DeckDirection]?: DeckAnswer | null } = {};\n let any = false;\n for (const dir of DECK_DIRECTIONS) {\n if (!(dir in raw)) continue;\n const v = raw[dir];\n const base = DEFAULT_DECK_KEY[dir];\n if (v === null || v === false) {\n out[dir] = null;\n any = true;\n continue;\n }\n const label = isRecord(v) ? text(v.label) : text(v);\n if (!label || !base) continue;\n const tone = isRecord(v) && TONES.includes(v.tone as DeckTone) ? (v.tone as DeckTone) : base.tone;\n out[dir] = { ...base, label, tone };\n any = true;\n }\n return any ? out : undefined;\n}\n\nfunction norm(s: string): string {\n return s.trim().toLowerCase().replace(/\\s+/g, \" \");\n}\n\n/** Read a swipe_deck value; null when it holds no readable item (the host shows its stand-in). */\nexport function swipeDeckFromKindValue(value: unknown): SwipeDeckKindDeck | null {\n if (!isRecord(value)) return null;\n const answers = answerOverride(value.answers);\n const deckKey: DeckKey = mergeKey(DEFAULT_DECK_KEY, answers);\n const rawItems = Array.isArray(value.items) ? value.items : [];\n const items: DeckItem[] = [];\n const problems: string[] = [];\n const seenIds = new Set<string>();\n // Each item's own answer reader and its raw `show_if`, resolved once every item is known.\n const readers = new Map<string, (w: unknown) => string | undefined>();\n const rawShow = new Map<string, unknown>();\n const positions: string[] = [];\n let withChoices = 0;\n rawItems.forEach((raw, index) => {\n const r = isRecord(raw) ? raw : typeof raw === \"string\" ? { text: raw } : null;\n if (!r) return;\n const body = text(r.text) || text(r.statement) || text(r.question) || text(r.title);\n if (!body) return;\n const allChoices = (Array.isArray(r.choices) ? r.choices : Array.isArray(r.options) ? r.options : [])\n .map((c) => (isRecord(c) ? text(c.label) || text(c.text) : text(c)))\n .filter(Boolean);\n if (allChoices.length > MAX_CHOICES) problems.push(`Item ${index + 1} has ${allChoices.length} choices; a card holds ${MAX_CHOICES}, so the rest were left off.`);\n if (allChoices.length === 1) problems.push(`Item ${index + 1} has a single choice; the deck's own answers were used.`);\n const choiceWords = allChoices.slice(0, MAX_CHOICES);\n const places = choiceWords.length >= 2 ? CHOICE_PLACES[Math.min(4, choiceWords.length)] : undefined;\n let own: DeckKeyOverride | undefined;\n let more: DeckAnswer[] = [];\n let key = deckKey;\n if (places) {\n withChoices++;\n const o: { -readonly [D in DeckDirection]?: DeckAnswer | null } = { up: null, right: null, down: null, left: null };\n places.forEach((dir, i) => {\n o[dir] = { id: `choice_${i + 1}`, label: choiceWords[i] ?? \"\", tone: CHOICE_TONES[dir] };\n });\n own = o;\n key = mergeKey(deckKey, o);\n more = choiceWords.slice(4).map((label, i) => ({ id: `choice_${i + 5}`, label, tone: \"neutral\" as const }));\n }\n // An answer named by its words first (a choice may itself read \"left\"), then — for an item with\n // choices — by letter (\"B\", \"b)\") or number (1-based, or a 0-based number the agent counted from),\n // then by direction.\n const byWords = (w: unknown): string | undefined => {\n const t = text(w);\n if (!t) return undefined;\n for (const a of [...DECK_DIRECTIONS.map((d) => key[d]), ...more]) {\n if (a && (norm(a.label) === norm(t) || a.id === t)) return a.id;\n }\n if (places) {\n const stripped = norm(t.replace(/^\\(?[a-h1-8][).:]\\s+/i, \"\"));\n const byLabel = choiceWords.findIndex((c) => norm(c) === stripped);\n if (byLabel >= 0) return `choice_${byLabel + 1}`;\n const letter = /^\\(?([a-h])[).:]?$/i.exec(t);\n if (letter?.[1]) {\n const i = letter[1].toLowerCase().charCodeAt(0) - 97;\n if (i < choiceWords.length) return `choice_${i + 1}`;\n }\n const numeral = /^\\(?([1-8])[).:]?$/.exec(t);\n if (numeral?.[1] && Number(numeral[1]) <= choiceWords.length) return `choice_${numeral[1]}`;\n if (typeof w === \"number\" && Number.isInteger(w)) {\n if (w >= 1 && w <= choiceWords.length) return `choice_${w}`;\n if (w === 0) return \"choice_1\";\n }\n }\n if (isDirection(t)) return key[t]?.id;\n return undefined;\n };\n const correct = Array.isArray(r.correct) ? r.correct.map(byWords).filter((x): x is string => !!x) : byWords(r.correct);\n const correctGiven = Array.isArray(r.correct) ? r.correct.length > 0 : r.correct !== undefined && r.correct !== null && text(r.correct) !== \"\";\n if (correctGiven && (correct === undefined || (Array.isArray(correct) && !correct.length)))\n problems.push(`Item ${index + 1}'s right answer \"${Array.isArray(r.correct) ? r.correct.map(text).join(\", \") : text(r.correct)}\" names none of its choices, so it is not graded.`);\n const details = (Array.isArray(r.details) ? r.details : Array.isArray(r.fields) ? r.fields : [])\n .filter(isRecord)\n .map((d) => ({ label: text(d.label), value: text(d.value) }))\n .filter((d) => d.label && d.value);\n const marks = (Array.isArray(r.marks) ? r.marks : [])\n .filter(isRecord)\n .map((m) => ({\n phrase: text(m.phrase),\n categories: Array.isArray(m.categories) ? m.categories.map(text).filter(Boolean) : [],\n suggested: isDirection(m.lean) ? (key[m.lean]?.id ?? null) : null,\n }))\n .filter((m) => m.phrase);\n const suggested = byWords(r.suggested);\n let id = text(r.id) || `item_${index + 1}`;\n if (seenIds.has(id)) {\n problems.push(`Two items share the id \"${id}\"; the second was given its own.`);\n id = `${id}_${index + 1}`;\n }\n seenIds.add(id);\n readers.set(id, byWords);\n positions[index] = id;\n const show = r.show_if ?? r.showIf;\n if (show !== undefined && show !== null) rawShow.set(id, show);\n const item: DeckItem = {\n id,\n text: body,\n ...(text(r.kicker) ? { kicker: text(r.kicker) } : {}),\n ...(text(r.tag) ? { tag: text(r.tag) } : {}),\n ...(suggested ? { suggested } : {}),\n ...(text(r.reason) ? { reason: text(r.reason) } : {}),\n ...(details.length ? { fields: details } : {}),\n ...(own ? { answers: own } : {}),\n ...(more.length ? { more } : {}),\n ...(correct !== undefined && (typeof correct === \"string\" || correct.length) ? { correct } : {}),\n ...(text(r.group) ? { group: text(r.group) } : {}),\n ...(marks.length ? { parts: marks } : {}),\n };\n items.push(item);\n });\n if (!items.length) return null;\n // Conditions name a card by its id, its position (1-based) or its exact words, and its answers by\n // their words (or a letter, a number, a direction), as `correct` does.\n const byText = new Map(items.map((i) => [norm(i.text), i.id]));\n const refOf = (v: unknown): string => {\n const t = text(v);\n if (readers.has(t)) return t;\n if (typeof v === \"number\" && Number.isInteger(v) && positions[v - 1]) return positions[v - 1] ?? t;\n return byText.get(norm(t)) ?? t;\n };\n const shaped = items.map((item) => {\n const raw = rawShow.get(item.id);\n const showIf = raw === undefined ? null : readDeckCondition(raw, { ref: refOf, answer: (id, w) => readers.get(id)?.(w) ?? null });\n if (raw !== undefined && !showIf) problems.push(`\"${item.text}\" has a show_if the deck cannot read, so it is always asked.`);\n return showIf ? { ...item, showIf } : item;\n });\n problems.push(...conditionProblems(shaped, { key: deckKey }));\n return {\n title: text(value.title) || null,\n items: shaped,\n answers,\n pickOne: value.pick_one === true,\n categories: Array.isArray(value.categories) ? value.categories.map(text).filter(Boolean) : [],\n everyItemHasChoices: withChoices === items.length,\n problems,\n };\n}\n\n/** The deck's results as rows (one per item), for \"Save to a table\". Column names are words. */\nexport function swipeDeckResultRows(\n deck: SwipeDeckKindDeck,\n answers: Readonly<Record<string, string>>,\n): Record<string, string>[] {\n const deckKey = mergeKey(DEFAULT_DECK_KEY, deck.answers);\n const graded = deck.items.some((i) => i.correct !== undefined);\n // Only the cards that were asked: a card skipped by its condition has no row (its kept answer does not apply).\n const asked = askedItems(deck.items, { answers, picks: {}, parts: {}, categories: {} });\n return deck.items.filter((item) => asked.get(item.id)).map((item) => {\n const key = mergeKey(deckKey, item.answers);\n const all = [...DECK_DIRECTIONS.map((d) => key[d]), ...(item.more ?? [])];\n const id = answers[item.id];\n const answer = id ? all.find((a) => a?.id === id) : undefined;\n const row: Record<string, string> = {};\n if (deck.items.some((i) => i.kicker)) row.Kind = item.kicker ?? \"\";\n row.Item = item.text;\n row.Answer = answer?.label ?? \"\";\n if (graded) {\n const correct = item.correct === undefined ? [] : typeof item.correct === \"string\" ? [item.correct] : item.correct;\n row[\"Right answer\"] = correct.map((c) => all.find((a) => a?.id === c)?.label ?? \"\").filter(Boolean).join(\", \");\n row.Right = !id || !correct.length ? \"\" : correct.includes(id) ? \"Yes\" : \"No\";\n }\n return row;\n });\n}\n","/**\n * THE DECK'S LOGIC AS A GRAPH — and back. Cards are nodes; each condition is an arrow from the earlier\n * card whose answer it reads to the card it opens, labelled by the answers that open it. Editing the\n * graph (draw an arrow, delete one, pick its answers, choose whether a card needs ANY or ALL of its\n * arrows) rebuilds each card's `showIf`; reading it back gives the same graph. Pure data: any graph\n * editor (the diagram canvas, a test) works through these two functions.\n *\n * A condition the graph cannot draw (a `not`, a nested group) is kept exactly as written and the card is\n * marked `custom`: the graph shows it and leaves it alone until a person replaces it there.\n */\nimport { conditionProblems, findAnswer, keyFor, moreFor, type DeckAnswer, type DeckCondition, type DeckItem, type DeckRules } from \"./model\";\n\nexport interface DeckLogicEdge {\n /** Stable while the graph is edited: `from→to`. */\n readonly id: string;\n /** The earlier card whose answer is read. */\n readonly from: string;\n /** The card it opens. */\n readonly to: string;\n /** Answer ids that open it (empty with `isNot` empty: any answer at all). */\n readonly is: readonly string[];\n /** Answer ids that keep it closed. */\n readonly isNot: readonly string[];\n}\n\nexport interface DeckLogicCard {\n readonly id: string;\n readonly text: string;\n readonly kicker?: string;\n /** Every answer the card can take, edges first. */\n readonly answers: readonly DeckAnswer[];\n /** With two or more arrows in: does the card need any of them, or all? */\n readonly match: \"any\" | \"all\";\n /** Its condition is one the graph cannot draw; kept as written. */\n readonly custom: boolean;\n}\n\nexport interface DeckLogicGraph {\n readonly cards: readonly DeckLogicCard[];\n readonly edges: readonly DeckLogicEdge[];\n}\n\nconst list = (v: string | readonly string[] | undefined): string[] => (v === undefined ? [] : typeof v === \"string\" ? [v] : [...v]);\n\ntype Leaf = Extract<DeckCondition, { item: string }>;\nconst isLeaf = (c: DeckCondition): c is Leaf => \"item\" in c;\n\n/** The leaves of a drawable condition and how they combine, or null when it cannot be drawn. */\nfunction drawable(cond: DeckCondition): { match: \"any\" | \"all\"; leaves: Leaf[] } | null {\n const plain = (l: Leaf) => l.answered !== false;\n if (isLeaf(cond)) return plain(cond) ? { match: \"any\", leaves: [cond] } : null;\n // An empty group (never / always) and two leaves on the same earlier card cannot be drawn as\n // arrows without changing what they mean: kept as written (`custom`).\n const group = (list: readonly DeckCondition[], match: \"any\" | \"all\") => {\n if (!list.length || !list.every((c) => isLeaf(c) && plain(c))) return null;\n const leaves = list as Leaf[];\n return new Set(leaves.map((l) => l.item)).size === leaves.length ? { match, leaves } : null;\n };\n if (\"any\" in cond) return group(cond.any, \"any\");\n if (\"all\" in cond) return group(cond.all, \"all\");\n return null;\n}\n\nfunction answersOf(rules: DeckRules, item: DeckItem): DeckAnswer[] {\n const key = keyFor(rules, item);\n const edges = ([\"right\", \"up\", \"left\", \"down\"] as const).map((d) => key[d]).filter((a): a is DeckAnswer => !!a);\n return [...edges, ...moreFor(rules, item)];\n}\n\n/** The graph of a deck's logic. */\nexport function deckLogicGraph(items: readonly DeckItem[], rules: DeckRules): DeckLogicGraph {\n const edges: DeckLogicEdge[] = [];\n const cards = items.map((item): DeckLogicCard => {\n const drawn = item.showIf ? drawable(item.showIf) : { match: \"any\" as const, leaves: [] };\n if (drawn) {\n for (const leaf of drawn.leaves) {\n const id = `${leaf.item}→${item.id}`;\n const at = edges.findIndex((e) => e.id === id);\n const edge = { id, from: leaf.item, to: item.id, is: list(leaf.is), isNot: list(leaf.isNot) };\n // Two leaves on the same card pair (rare, hand-written) merge into one arrow.\n if (at >= 0) {\n const had = edges[at]!;\n edges[at] = { ...had, is: [...new Set([...had.is, ...edge.is])], isNot: [...new Set([...had.isNot, ...edge.isNot])] };\n } else edges.push(edge);\n }\n }\n return {\n id: item.id,\n text: item.text,\n ...(item.kicker ? { kicker: item.kicker } : {}),\n answers: answersOf(rules, item),\n match: drawn?.match ?? \"any\",\n custom: !drawn,\n };\n });\n return { cards, edges };\n}\n\n/**\n * The deck with each card's `showIf` rebuilt from the graph. A card with no arrows in is always asked;\n * one arrow is that leaf; more combine by the card's `match`. A `custom` card keeps its own condition.\n */\nexport function applyDeckLogic(items: readonly DeckItem[], graph: DeckLogicGraph): DeckItem[] {\n const byCard = new Map(graph.cards.map((c) => [c.id, c]));\n return items.map((item) => {\n const card = byCard.get(item.id);\n if (card?.custom) return item;\n const leaves: Leaf[] = graph.edges\n .filter((e) => e.to === item.id)\n .map((e) => ({ item: e.from, ...(e.is.length ? { is: [...e.is] } : {}), ...(e.isNot.length ? { isNot: [...e.isNot] } : {}) }));\n const { showIf: _old, ...rest } = item;\n if (!leaves.length) return rest;\n const showIf: DeckCondition = leaves.length === 1 ? leaves[0]! : card?.match === \"all\" ? { all: leaves } : { any: leaves };\n return { ...rest, showIf };\n });\n}\n\n/** An arrow's words: the answers that open the card (\"Yes · Sort of\", \"not No\", \"answered\"). */\nexport function logicEdgeLabel(edge: DeckLogicEdge, items: readonly DeckItem[], rules: DeckRules): string {\n const from = items.find((i) => i.id === edge.from);\n const words = (ids: readonly string[]) => ids.map((id) => (from ? (findAnswer(rules, from, id)?.label ?? id) : id));\n const parts = [...words(edge.is), ...words(edge.isNot).map((w) => `not ${w}`)];\n return parts.length ? parts.join(\" · \") : \"answered\";\n}\n\n/** Whether an arrow may be drawn: only from an EARLIER card (no loops), never onto itself or twice. */\nexport function canConnect(items: readonly DeckItem[], graph: DeckLogicGraph, from: string, to: string): string | null {\n const a = items.findIndex((i) => i.id === from);\n const b = items.findIndex((i) => i.id === to);\n if (a < 0 || b < 0) return \"That card is not in the deck.\";\n if (a === b) return \"A card cannot depend on itself.\";\n if (a > b) return \"A card can only depend on a card before it.\";\n if (graph.edges.some((e) => e.from === from && e.to === to)) return \"Those two cards are already joined.\";\n if (graph.cards.find((c) => c.id === to)?.custom) return \"This card has a rule the graph cannot draw. Select it and press Clear rule first.\";\n return null;\n}\n\n/** A new arrow, opened by the earlier card's first answer (its right edge's, usually Yes). */\nexport function newLogicEdge(items: readonly DeckItem[], rules: DeckRules, from: string, to: string): DeckLogicEdge {\n const source = items.find((i) => i.id === from);\n const first = source ? answersOf(rules, source)[0] : undefined;\n return { id: `${from}→${to}`, from, to, is: first ? [first.id] : [], isNot: [] };\n}\n\n/** What is wrong with the logic as drawn, in words (the deck's own checks). */\nexport function logicProblems(items: readonly DeckItem[], rules: DeckRules, graph: DeckLogicGraph): string[] {\n return conditionProblems(applyDeckLogic(items, graph), rules);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoBA,IAAAA,SAAuB;AAEvB,uBAA4C;;;ACH5C,YAAuB;;;ACIvB,IAAM,QAA6B;AAAA,EACjC,EAAE,MAAM,UAAU,MAAM,4EAA4E,OAAO,iGAAiG;AAAA,EAC5M,EAAE,MAAM,UAAU,MAAM,iGAAiG,OAAO,6GAAwG;AAAA,EACxO,EAAE,MAAM,cAAc,MAAM,0EAA0E,OAAO,+EAA+E;AAAA,EAC5L,EAAE,MAAM,gBAAgB,MAAM,wCAAwC,OAAO,oEAAoE;AAAA,EACjJ,EAAE,MAAM,WAAW,MAAM,8GAA8G,OAAO,gEAAgE;AAAA,EAC9M,EAAE,MAAM,WAAW,MAAM,4DAA4D,OAAO,qDAAqD;AAAA,EACjJ,E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9C,QAAM,QAAQ,SAAS,UAAU,OAAO,MAAM,EAAE,CAAC,IAAI;AACrD,SAAO,EAAE,IAAI,GAAG,IAAI,SAAI,EAAE,IAAI,MAAM,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,EAAE;AACjF;AAGO,SAAS,cAAc,OAA4B,OAAkB,OAAiC;AAC3G,SAAO,kBAAkB,eAAe,OAAO,KAAK,GAAG,KAAK;AAC9D;","names":["React","text","text","text","ErrorBox","import_jsx_runtime","React","text","import_jsx_runtime","Wash","React","text","list","list","kept","React","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","text","a","copyToClipboard","list","React","import_jsx_runtime","norm","plain","list"]}
|
|
1
|
+
{"version":3,"sources":["../src/swipe-deck/index.ts","../src/swipe-deck/SwipeDeck.tsx","../src/error-box.tsx","../src/desktop/errors.ts","../src/error-sentence.ts","../src/icons.tsx","../src/swipe-deck/chrome.tsx","../src/swipe-deck/visual.ts","../src/swipe-deck/controller.ts","../src/swipe-deck/model.ts","../src/swipe-deck/gesture.ts","../src/swipe-deck/labels.ts","../src/swipe-deck/PartScreen.tsx","../src/input.tsx","../src/cn.ts","../src/field-surface.ts","../src/swipe-deck/ExpandableSwipeDeck.tsx","../src/swipe-deck/kind-value.ts","../src/swipe-deck/logic.ts"],"sourcesContent":["\"use client\";\n\n/**\n * `@ai-matrx/design-system/swipe-deck` — THE swipe deck: a full-screen deck of items a person answers\n * by swiping (right Yes! · up Sort of · left No · down Not sure, every part configurable), with\n * multi-tier parts, categories, pick-one, unlimited undo, and two modes: controlled (`items` in,\n * answers out) or bound (a `SwipeDeckBinding` persists every change). Its own entry so a host that\n * never shows a deck pays nothing. Structural CSS: `swipe-deck.css` (in `styles.css`).\n */\nexport { SwipeDeck } from \"./SwipeDeck\";\nexport type { SwipeDeckProps, SwipeDeckCopyContext, SwipeDeckCardContext } from \"./SwipeDeck\";\nexport { ExpandableSwipeDeck } from \"./ExpandableSwipeDeck\";\nexport type { ExpandableSwipeDeckProps } from \"./ExpandableSwipeDeck\";\nexport { useDeckController, UNDO_KEPT } from \"./controller\";\nexport type { SwipeDeckBinding, DeckController, DeckControllerOptions } from \"./controller\";\nexport { DEFAULT_SWIPE_DECK_LABELS } from \"./labels\";\nexport { swipeDeckFromKindValue, swipeDeckResultRows } from \"./kind-value\";\nexport { applyDeckLogic, canConnect, deckLogicGraph, logicEdgeLabel, logicProblems, newLogicEdge } from \"./logic\";\nexport type { DeckLogicCard, DeckLogicEdge, DeckLogicGraph } from \"./logic\";\nexport type { SwipeDeckKindDeck } from \"./kind-value\";\nexport type { SwipeDeckLabels } from \"./labels\";\nexport { releaseDecision, swipeThreshold, dominantDirection } from \"./gesture\";\nexport {\n DECK_DIRECTIONS,\n DEFAULT_DECK_KEY,\n DEFAULT_KEEP_ANSWER,\n EMPTY_DECK_STATE,\n KEEP_ANSWER_ID,\n answerChange,\n answerDetail,\n askedItems,\n conditionHolds,\n conditionItems,\n conditionProblems,\n dependencyOrder,\n readDeckCondition,\n answerOf,\n answersFor,\n applyOp,\n applyOps,\n chainSuggestions,\n contenders,\n currentStepIndex,\n deckCopyText,\n deckResult,\n deckState,\n deckSteps,\n directionOf,\n findAnswer,\n forgetSpan,\n invertOp,\n itemCopyText,\n keyFor,\n knownCategories,\n makeChange,\n membersOff,\n mergeKey,\n moreFor,\n partAnswer,\n partSuggestion,\n partsOf,\n partText,\n pickedItem,\n placePart,\n shownItems,\n resolveConflict,\n seedParts,\n stepDone,\n tokenize,\n} from \"./model\";\nexport type {\n CategoryConflict,\n DeckAnswer,\n DeckCategory,\n DeckCategoryRow,\n DeckChange,\n DeckCondition,\n DeckCopyLabels,\n DeckDetail,\n DeckDirection,\n DeckField,\n DeckItem,\n DeckKey,\n DeckKeyOverride,\n DeckMedia,\n DeckMember,\n DeckOp,\n DeckPart,\n DeckPartSeed,\n DeckResult,\n DeckResultEntry,\n DeckResultPart,\n DeckRules,\n DeckState,\n DeckStep,\n DeckTone,\n} from \"./model\";\n","\"use client\";\n\n/**\n * SwipeDeck — THE full-screen swipe deck: a deck of items a person answers by swiping.\n *\n * right Yes! · up Sort of · left No · down Not sure (every part configurable)\n *\n * The whole screen is the card; its text fits to the largest size the space allows. Each answer is\n * a large button on the edge it swipes toward; the corners are exit, ?, undo and copy. The moment a\n * drag starts the screen takes the answer's color and name; a flick commits too. The suggested\n * answer's button is filled and pulses and the card leans toward it. Undo is unlimited and the card\n * returns from the side it left. Items can expose parts (spans of their words), each answered on the\n * part screen (hold, or double-click); categories' answers flow down to the parts they tag.\n *\n * TWO MODES. Controlled: pass `items` and read answers back through `onAnswer` / `onChange` /\n * `onComplete`. Bound: pass a `binding` (see `controller.ts`) and the deck persists every change\n * through it, optimistically, showing the connection's own refusal sentence inline.\n *\n * Structural CSS: `swipe-deck.css` (imported by `styles.css`); colors are design-system tokens.\n */\nimport * as React from \"react\";\n\nimport { copyText as copyToClipboard } from \"@ai-matrx/kit/clipboard\";\n\nimport { ErrorBox } from \"../error-box\";\nimport { CheckIcon, CircleHelpIcon, CopyIcon, ListChecksIcon, Loader2Icon, Maximize2Icon, Minimize2Icon, PencilIcon, Undo2Icon, XIcon } from \"../icons\";\nimport { AnswerGlyph, CornerButton, EdgeButtons, setHot, Wash, type EdgeRefs, type WashHandle } from \"./chrome\";\nimport { useDeckController, type DeckController, type SwipeDeckBinding } from \"./controller\";\nimport { attachSwipe } from \"./gesture\";\nimport { DEFAULT_SWIPE_DECK_LABELS, type SwipeDeckLabels } from \"./labels\";\nimport {\n DECK_DIRECTIONS,\n DEFAULT_DECK_KEY,\n DEFAULT_KEEP_ANSWER,\n answerChange,\n answerDetail,\n answerOf,\n applyOps,\n findAnswer,\n membersOff,\n moreFor,\n currentStepIndex,\n deckCopyText,\n deckResult,\n deckSteps,\n directionOf,\n forgetSpan,\n itemCopyText,\n keyFor,\n knownCategories,\n makeChange,\n mergeKey,\n partAnswer,\n partsOf,\n partText,\n placePart,\n tokenize,\n type CategoryConflict,\n type DeckCategoryRow,\n type DeckAnswer,\n type DeckChange,\n type DeckDetail,\n type DeckDirection,\n type DeckOp,\n type DeckItem,\n type DeckMedia,\n type DeckKey,\n type DeckKeyOverride,\n type DeckPart,\n type DeckResult,\n type DeckRules,\n type DeckState,\n type DeckStep,\n type DeckTone,\n} from \"./model\";\nimport { PartScreen } from \"./PartScreen\";\nimport { VECTOR, buzz, enter, finePointer, fitText, flyOut, follow, heroMax, keepFitted, markOverflow, nudge, prefersReducedMotion, snapBack } from \"./visual\";\n\nexport interface SwipeDeckCopyContext {\n readonly item: DeckItem | null;\n readonly state: DeckState;\n readonly result: DeckResult;\n}\n\n/** What a card's own slots (`renderCardBody`, `renderCardActions`) can do. */\nexport interface SwipeDeckCardContext {\n readonly item: DeckItem;\n /** What will ride with this card's answer: the members switched off, a value typed on the card. */\n readonly detail: DeckDetail | null;\n /** Replace what rides with this card's next answer (any route: swipe, edge, key, button). */\n setDetail(detail: DeckDetail | null): void;\n /** Answer the card now, by answer id (on an edge or off it), optionally with what rides along. */\n answer(answerId: string, detail?: DeckDetail | null): void;\n /** While locked (a field being typed in), the card never swipes and the arrows and shortcuts do nothing. */\n lock(locked: boolean): void;\n}\n\nexport interface SwipeDeckProps {\n /** Controlled mode: the items. Ignored when `binding` is given (the binding brings its items). */\n readonly items?: readonly DeckItem[];\n /** Bound mode: the connection the deck persists through. */\n readonly binding?: SwipeDeckBinding;\n /** The deck's key, over the default (Yes! / Sort of / No / Not sure); `null` turns an edge off. */\n readonly answers?: DeckKeyOverride;\n /** Answers off the edges, offered on every card as a row of buttons (an item's own `more` replaces them). */\n readonly more?: readonly DeckAnswer[];\n /** Drawn on the card under its text: the host's own controls (a field to correct a value, a person's name). */\n readonly renderCardBody?: (context: SwipeDeckCardContext) => React.ReactNode;\n /** Drawn in the card's top row, at the end: small actions (open the source, see where it was found). */\n readonly renderCardActions?: (context: SwipeDeckCardContext) => React.ReactNode;\n /** The part screen's key, over the deck's (its down edge defaults to Keep as is). */\n readonly partAnswers?: DeckKeyOverride;\n /** The category rows offered on the part screen. */\n readonly categories?: readonly string[];\n /** Labelled chip rows on the part screen (\"Who\", \"Cares about\"), each with its own \"+\"; a category added there carries the row's id on its op. */\n readonly categoryRows?: readonly DeckCategoryRow[];\n /** When two categories' answers disagree on a part. Default: the worse answer wins. */\n readonly categoryConflict?: CategoryConflict;\n readonly allowNewCategories?: boolean;\n /** Turn the part screen off (parts still show and tap). */\n readonly editParts?: boolean;\n /** Groups that end in a pick-one screen (`true` = every group). */\n readonly pickOne?: boolean | readonly string[];\n /** The answer that makes an item a contender for its group's pick (default: the right edge's). */\n readonly pickAnswer?: string;\n /** What each group is called on its pick screen and at the end. */\n readonly groupLabels?: Readonly<Record<string, string>>;\n /** Controlled mode: answers, picks, parts and categories to start from. */\n readonly initialState?: Partial<DeckState>;\n readonly labels?: Partial<SwipeDeckLabels>;\n readonly onAnswer?: (item: DeckItem, answer: DeckAnswer, state: DeckState) => void;\n /** Every change, undo included (`undo` true), with the state after it. */\n readonly onChange?: (state: DeckState, change: DeckChange, undo: boolean) => void;\n /** The person reached the end; `result` holds every answer, pick, part and category. */\n readonly onComplete?: (result: DeckResult) => void;\n /** The exit corner; omitted, the corner is empty (or holds Full screen when `onExpand` is given). */\n readonly onExit?: () => void;\n /** What the exit corner means: `close` (an X) or `collapse` (leave full screen). */\n readonly exitKind?: \"close\" | \"collapse\";\n /** The full-screen corner (top left), for a deck drawn inline: open this deck full screen. */\n readonly onExpand?: () => void;\n /** Share another deck's controller (state AND undo), e.g. the inline and full-screen views of one deck. */\n readonly controller?: DeckController;\n /** Show each item's choices on the card, by their direction (a quiz). Default: when the item has its own answers. */\n readonly choicesOnCard?: boolean | \"auto\";\n /**\n * How big the card's own text is: `fit` (default) grows it to fill the card (a word, a short line);\n * `page` holds it at a page-title size in a reading-width column, for a card whose body is the point\n * (evidence to read before answering).\n */\n readonly titleSize?: \"fit\" | \"page\";\n /**\n * Draw the answers off the edges (`more`) as the card's row of buttons (default true). `false` when the\n * host draws every answer itself in its body through `context.answer`; their keyboard shortcuts stay.\n */\n readonly moreOnCard?: boolean;\n /** The copy corner's text (default: the item, or the whole deck at a pick or the end). */\n readonly copyText?: (context: SwipeDeckCopyContext) => string;\n /** Where \"the walkthrough already played\" is remembered; `null` never plays it on its own. */\n readonly tourKey?: string | null;\n /** Arrows, Z (undo) and ? (default on). */\n readonly keyboard?: boolean;\n /**\n * `fullscreen` covers the viewport; `fill` fills the nearest positioned parent; `inline` is a box in\n * the flow (a chat message): its height is `--sd-inline-height`, and its keys answer only while it\n * holds focus or the pointer.\n */\n readonly layout?: \"fullscreen\" | \"fill\" | \"inline\";\n readonly renderEnd?: (result: DeckResult) => React.ReactNode;\n /** The host's own buttons on the finish screen (back to the page, the next step). */\n readonly endActions?: React.ReactNode;\n /** The screen when there is nothing to answer: its words and the host's way on. */\n readonly empty?: { readonly title?: string; readonly line?: string; readonly action?: React.ReactNode };\n readonly className?: string;\n}\n\nconst KEYS: Readonly<Record<string, DeckDirection>> = { ArrowRight: \"right\", ArrowLeft: \"left\", ArrowUp: \"up\", ArrowDown: \"down\" };\nconst DEFAULT_TOUR_KEY = \"matrx.swipe-deck.tour\";\n\nfunction readFlag(key: string): boolean {\n try {\n return globalThis.localStorage?.getItem(key) === \"1\";\n } catch {\n return false;\n }\n}\nfunction writeFlag(key: string): void {\n try {\n globalThis.localStorage?.setItem(key, \"1\");\n } catch {\n /* storage blocked: the walkthrough may play again next visit */\n }\n}\n\nfunction wait(ms: number): Promise<void> {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nexport function SwipeDeck(props: SwipeDeckProps) {\n const labels = React.useMemo<SwipeDeckLabels>(() => ({ ...DEFAULT_SWIPE_DECK_LABELS, ...props.labels }), [props.labels]);\n const deckKey = React.useMemo(() => mergeKey(DEFAULT_DECK_KEY, props.answers), [props.answers]);\n const partKeyBase = React.useMemo(() => mergeKey({ ...deckKey, down: DEFAULT_KEEP_ANSWER }, props.partAnswers), [deckKey, props.partAnswers]);\n const rules = React.useMemo<DeckRules>(\n () => ({\n key: deckKey,\n ...(props.pickOne !== undefined ? { pickOne: props.pickOne } : {}),\n ...(props.pickAnswer ? { pickAnswer: props.pickAnswer } : {}),\n ...(props.more ? { more: props.more } : {}),\n }),\n [deckKey, props.pickOne, props.pickAnswer, props.more],\n );\n const conflict = props.categoryConflict;\n const own = useDeckController({ items: props.items, binding: props.binding, initialState: props.initialState, onChange: props.onChange });\n const controller = props.controller ?? own;\n const layout = props.layout ?? \"fullscreen\";\n const { items, state } = controller;\n const steps = React.useMemo(() => deckSteps(items, state, rules), [items, state, rules]);\n const stepIndex = currentStepIndex(steps, state);\n const step: DeckStep = steps[stepIndex] ?? { kind: \"end\", id: \"end\" };\n const ready = controller.status === \"ready\";\n const stateRef = React.useRef(state);\n stateRef.current = state;\n // Timers (pick, walkthrough, lean) never act on a deck that has closed.\n const alive = React.useRef(true);\n React.useEffect(() => {\n alive.current = true;\n return () => {\n alive.current = false;\n };\n }, []);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n /** Set when the deck itself moved to the next card (an answer here), so only that card change takes focus back. */\n const answeredHere = React.useRef(false);\n const frameRef = React.useRef<HTMLDivElement>(null);\n const layerRef = React.useRef<HTMLDivElement | null>(null);\n const edgeRefs = React.useRef<EdgeRefs>({});\n const wash = React.useRef<WashHandle>(null);\n const busy = React.useRef(false);\n const enterFrom = React.useRef<DeckDirection | \"stay\" | null>(null);\n const nudgeAnim = React.useRef<Animation | null>(null);\n const [touring, setTouring] = React.useState(false);\n const touringRef = React.useRef(false);\n const tourStop = React.useRef(false);\n const [part, setPart] = React.useState<{ itemId: string; start: number; end: number } | null>(null);\n const [bubble, setBubble] = React.useState<{ text: string; x: number; top: number; bottom: number } | null>(null);\n const [toast, setToast] = React.useState<string | null>(null);\n const [said, setSaid] = React.useState(\"\");\n\n // THE ANSWERED LIST, mid-deck: every answer so far, each one tap from changing it (the finish screen's list,\n // reachable at any point). While it is open the card does not take answers.\n const [reviewing, setReviewing] = React.useState(false);\n const reviewingRef = React.useRef(false);\n reviewingRef.current = reviewing;\n const cardItem = step.kind === \"card\" && !reviewing ? step.item : null;\n const cardKey = cardItem ? keyFor(rules, cardItem) : deckKey;\n const cardMore = React.useMemo(() => (cardItem ? moreFor(rules, cardItem) : []), [cardItem, rules]);\n // The buttons drawn under the card: a hidden answer is reached only through the card's own controls.\n const cardMoreShown = React.useMemo(() => cardMore.filter((a) => !a.hidden), [cardMore]);\n const suggestedDir = cardItem ? directionOf(cardKey, cardItem.suggested) : null;\n // What rides with the card in front's answer, set by its members and its own slots; starts from what was saved.\n const [cardDetail, setCardDetail] = React.useState<{ id: string; detail: DeckDetail | null } | null>(null);\n const detailNow = cardItem ? (cardDetail?.id === cardItem.id ? cardDetail.detail : (state.details?.[cardItem.id] ?? null)) : null;\n const detailRef = React.useRef(detailNow);\n detailRef.current = detailNow;\n const [locked, setLocked] = React.useState<string | null>(null);\n const lockedNow = !!cardItem && locked === cardItem.id;\n const lockedRef = React.useRef(lockedNow);\n lockedRef.current = lockedNow;\n\n const stopNudge = () => {\n try {\n nudgeAnim.current?.cancel();\n } catch {\n /* already finished */\n }\n nudgeAnim.current = null;\n };\n\n const flash = React.useCallback((text: string) => setToast(text), []);\n React.useEffect(() => {\n if (!toast) return;\n const t = setTimeout(() => setToast(null), 1400);\n return () => clearTimeout(t);\n }, [toast]);\n React.useEffect(() => {\n if (!bubble) return;\n const t = setTimeout(() => setBubble(null), 2200);\n return () => clearTimeout(t);\n }, [bubble]);\n\n // ─── answering ───────────────────────────────────────────────────────────\n const act = (dir: DeckDirection, speed = 0) => {\n const answer = cardKey[dir];\n if (answer) void give(answer, dir, speed);\n };\n /** Answer the card in front: by an edge (`dir`) or off the edges (`dir` null: it drops away). */\n const give = async (answer: DeckAnswer, dir: DeckDirection | null, speed = 0, detail?: DeckDetail | null) => {\n if (!cardItem || busy.current || touringRef.current || part) return;\n busy.current = true;\n stopNudge();\n setBubble(null);\n wash.current?.show(answer, dir, 1);\n setHot(edgeRefs.current, dir);\n buzz(globalThis.navigator, 8);\n await flyOut(layerRef.current, dir ?? \"down\", speed);\n const now = stateRef.current;\n const rides = answerDetail(cardItem, detail === undefined ? detailRef.current : detail);\n const made = answerChange(now, cardItem, answer.id, rules, items, dir, rides);\n // \"Skip for now\": the connection sends the card to the back of the line and keeps no answer.\n const change = answer.requeue && props.binding ? { ...made, transient: true } : made;\n enterFrom.current = null;\n setCardDetail(null);\n setLocked(null);\n answeredHere.current = true;\n controller.commit(change);\n busy.current = false;\n setHot(edgeRefs.current, null);\n wash.current?.hide();\n const after = applyOps(now, change.ops);\n props.onAnswer?.(cardItem, answer, after);\n const nextSteps = deckSteps(items, after, rules);\n const next = nextSteps[currentStepIndex(nextSteps, after)];\n setSaid(`${answer.label}.${next && next.kind === \"card\" ? ` ${labels.next}: ${next.item.text}` : \"\"}`);\n };\n const actRef = React.useRef(act);\n actRef.current = act;\n const giveRef = React.useRef(give);\n giveRef.current = give;\n\n const cardContext = React.useMemo<SwipeDeckCardContext | null>(\n () =>\n cardItem\n ? {\n item: cardItem,\n detail: detailNow,\n setDetail: (detail) => setCardDetail({ id: cardItem.id, detail }),\n answer: (answerId, detail) => {\n const a = findAnswer(rules, cardItem, answerId);\n if (a) void giveRef.current(a, directionOf(cardKey, answerId), 0, detail);\n },\n lock: (on) => setLocked(on ? cardItem.id : null),\n }\n : null,\n [cardItem, detailNow, rules, cardKey],\n );\n\n const undo = () => {\n if (busy.current || touringRef.current) return;\n if (part) setPart(null);\n setCardDetail(null);\n setLocked(null);\n const change = controller.undo();\n if (!change) return;\n enterFrom.current = change.from ?? \"stay\";\n // The card comes back as she left it: what rode with the answer (her switches, a typed value) is on it again.\n const answered = change.ops.find((o): o is Extract<DeckOp, { kind: \"answer\" }> => o.kind === \"answer\" && !!o.detail);\n if (answered?.detail) setCardDetail({ id: answered.itemId, detail: answered.detail });\n const touched = change.ops.find((o) => o.kind === \"answer\" || o.kind === \"parts\");\n const item = touched && \"itemId\" in touched ? items.find((i) => i.id === touched.itemId) : undefined;\n setSaid(`${labels.undone}.${item ? ` ${item.text}` : \"\"}`);\n };\n const undoRef = React.useRef(undo);\n undoRef.current = undo;\n\n const pick = (group: string, item: DeckItem) => {\n if (busy.current) return;\n busy.current = true;\n setTimeout(\n () => {\n busy.current = false;\n if (!alive.current) return;\n enterFrom.current = null;\n controller.commit(makeChange(stateRef.current, [{ kind: \"pick\", group, itemId: item.id }], items));\n setSaid(`${props.groupLabels?.[group] ?? group}: ${item.text}`);\n },\n prefersReducedMotion() ? 0 : 260,\n );\n };\n\n // ─── parts ───────────────────────────────────────────────────────────────\n const openPart = (item: DeckItem, index: number) => {\n if (props.editParts === false || busy.current || touringRef.current) return;\n stopNudge();\n setBubble(null);\n if (layerRef.current) snapBack(layerRef.current);\n wash.current?.hide();\n setPart({ itemId: item.id, start: index, end: index });\n };\n const openPartRef = React.useRef(openPart);\n openPartRef.current = openPart;\n\n const partItem = part ? (items.find((i) => i.id === part.itemId) ?? null) : null;\n const partKey = React.useMemo(\n () => (partItem ? mergeKey({ ...keyFor(rules, partItem), down: DEFAULT_KEEP_ANSWER }, props.partAnswers) : partKeyBase),\n [partItem, rules, props.partAnswers, partKeyBase],\n );\n const allCategories = React.useMemo(() => knownCategories(props.categories ?? [], items, state), [props.categories, items, state]);\n\n const placeOnItem = (item: DeckItem, next: DeckPart) => {\n enterFrom.current = \"stay\";\n const now = stateRef.current;\n controller.commit(makeChange(now, [{ kind: \"parts\", itemId: item.id, parts: placePart(partsOf(now, item), next) }], items));\n };\n const forgetOnItem = (item: DeckItem, span: { start: number; end: number }) => {\n enterFrom.current = \"stay\";\n const now = stateRef.current;\n controller.commit(makeChange(now, [{ kind: \"parts\", itemId: item.id, parts: forgetSpan(partsOf(now, item), span) }], items));\n flash(labels.forgotten);\n };\n\n // ─── the swipe on the card ───────────────────────────────────────────────\n // Set from the first move of a press until the next press: a press that dragged is never a choice's tap.\n const dragged = React.useRef(false);\n const live = React.useRef({ cardKey, enabled: false });\n live.current = { cardKey, enabled: !!cardItem && !part && !touring && !lockedNow };\n\n React.useEffect(() => {\n const root = frameRef.current;\n if (!root) return;\n return attachSwipe(root, {\n enabled: () => live.current.enabled && !busy.current && !touringRef.current,\n directions: () => live.current.cardKey,\n start: () => {\n dragged.current = false;\n stopNudge();\n setBubble(null);\n },\n move: (dx, dy, dir, amount) => {\n dragged.current = true;\n const answer = dir ? live.current.cardKey[dir] : undefined;\n follow(layerRef.current, dx, dy, dir && answer ? amount : 0);\n if (dir && answer) {\n wash.current?.show(answer, dir, amount);\n setHot(edgeRefs.current, amount >= 1 ? dir : null);\n } else {\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n }\n },\n release: () => {\n snapBack(layerRef.current);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n },\n commit: (dir, speed) => actRef.current(dir, speed),\n tap: (target) => {\n const span = target.closest<HTMLElement>(\"[data-sd-part]\");\n if (!span) {\n setBubble(null);\n return;\n }\n const r = span.getBoundingClientRect();\n setBubble({ text: span.getAttribute(\"data-sd-part-label\") ?? \"\", x: r.left + r.width / 2, top: r.top, bottom: r.bottom });\n },\n hold: (target) => {\n const i = Number(target.getAttribute(\"data-sd-t\"));\n const item = itemsRef.current.find((x) => x.id === target.closest(\"[data-sd-item]\")?.getAttribute(\"data-sd-item\"));\n if (item && Number.isFinite(i)) openPartRef.current(item, i);\n },\n holdSelector: \"[data-sd-t]\",\n // A swipe may start on a choice (it fills much of a quiz card); other buttons never swipe.\n ignoreSelector: \"button:not([data-sd-choice]), a, input, textarea, [data-sd-noswipe]\",\n });\n }, []);\n const itemsRef = React.useRef(items);\n itemsRef.current = items;\n\n // ─── keyboard ────────────────────────────────────────────────────────────\n const keyboard = props.keyboard !== false;\n // A key pressed during the walkthrough, done once it has stopped.\n const afterTour = React.useRef<string | null>(null);\n /** What a key does on the deck; true when it did something (its default is then prevented). */\n const runKeyRef = React.useRef<(key: string, target: Element | null) => boolean>(() => false);\n runKeyRef.current = (key, target) => {\n if (reviewingRef.current) {\n if (key === \"Escape\") {\n setReviewing(false);\n return true;\n }\n if (key !== \"z\" && key !== \"Z\" && key !== \"Backspace\") return false;\n }\n const dir = KEYS[key];\n const shortcut = !dir && key.length === 1 ? shortcutRef.current(key) : null;\n if ((dir || shortcut) && lockedRef.current) return false;\n if (dir) {\n actRef.current(dir);\n return true;\n }\n if (shortcut) {\n void giveRef.current(shortcut.answer, shortcut.dir);\n return true;\n }\n if (key === \"z\" || key === \"Z\" || key === \"Backspace\") {\n undoRef.current();\n return true;\n }\n if (key === \"?\") {\n void tourRef.current();\n return true;\n }\n if (key === \"Escape\" && exitRef.current.kind === \"collapse\" && exitRef.current.onExit) {\n exitRef.current.onExit();\n return true;\n }\n // Enter on the card (not on one of its buttons) opens the part screen on its first marked words, or its first word.\n if (key === \"Enter\" && !target?.closest(\"button, a, [role='button']\") && cardItemRef.current && props.editParts !== false) {\n const item = cardItemRef.current;\n const first = partsOf(stateRef.current, item)[0];\n openPartRef.current(item, first ? first.start : 0);\n return true;\n }\n return false;\n };\n const cardItemRef = React.useRef(cardItem);\n cardItemRef.current = cardItem;\n // An answer's own key (\"Y\", \"3\"), on an edge or off it; it outranks Z and ? when an answer claims them.\n const shortcutRef = React.useRef<(key: string) => { answer: DeckAnswer; dir: DeckDirection | null } | null>(() => null);\n shortcutRef.current = (key) => {\n if (!cardItem || part) return null;\n const k = key.toLowerCase();\n for (const d of DECK_DIRECTIONS) {\n const a = cardKey[d];\n if (a?.shortcut?.toLowerCase() === k) return { answer: a, dir: d };\n }\n const a = cardMoreShown.find((x) => x.shortcut?.toLowerCase() === k);\n return a ? { answer: a, dir: null } : null;\n };\n const exitRef = React.useRef({ kind: props.exitKind, onExit: props.onExit });\n exitRef.current = { kind: props.exitKind, onExit: props.onExit };\n React.useEffect(() => {\n if (!keyboard) return;\n const view = rootRef.current?.ownerDocument.defaultView ?? window;\n const onKey = (e: KeyboardEvent) => {\n const root = rootRef.current;\n const doc = root?.ownerDocument;\n const active = doc?.activeElement;\n if (active && active !== doc.body && !root?.contains(active)) return;\n // An inline deck (one of many things on a page) answers only while it holds focus or the pointer.\n if (layout === \"inline\" && !(root && (root.contains(active ?? null) || root.matches(\":hover\")))) return;\n const t = e.target instanceof Element ? e.target : null;\n if (t?.closest(\"input, textarea, select, [contenteditable='true']\")) return;\n // Cmd+Z / Ctrl+Z is undo here too (a field's own undo keeps it: fields returned above).\n if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === \"z\" || e.key === \"Z\") && !e.repeat) {\n e.preventDefault();\n undoRef.current();\n return;\n }\n // A held key answers one card, never several; a key with Alt, Ctrl or Cmd belongs to the browser or the host.\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.repeat) {\n if (KEYS[e.key] || e.key === \"z\" || e.key === \"Z\" || e.key === \"Backspace\") e.preventDefault();\n return;\n }\n if (touringRef.current) {\n // A key during the walkthrough ends it AND does what it says: the first answer is never lost.\n tourStop.current = true;\n if (KEYS[e.key] || e.key === \"z\" || e.key === \"Z\" || e.key === \"Backspace\") {\n e.preventDefault();\n afterTour.current = e.key;\n }\n return;\n }\n if (runKeyRef.current(e.key, t)) e.preventDefault();\n };\n view.addEventListener(\"keydown\", onKey);\n return () => view.removeEventListener(\"keydown\", onKey);\n }, [keyboard, layout]);\n\n // The keys stay with the deck after every answer (P5, pool 2026-10-24: after some cards the arrows did nothing until\n // the page was clicked). An answer can leave focus on a control OUTSIDE the deck (a menu's or hover card's portal, a\n // host control that re-rendered, a toast), and the key handler ignores keys whose focus is elsewhere. So when the card\n // changes, a full deck (not inline: one of many things on a page) takes focus back — never from a field being typed\n // in, an open dialog or menu. REVIEW9 M-5: a card change the HOST made (items arriving, re-sorting) never takes focus\n // from a button or link the person is on — only nothing focused (the page itself) is taken then; and a deck that sits\n // inside a dialog takes it back within that dialog.\n const cardId = cardItem?.id ?? null;\n React.useEffect(() => {\n const fromAnswer = answeredHere.current;\n answeredHere.current = false;\n if (!keyboard || layout === \"inline\" || cardId === null) return;\n const root = rootRef.current;\n const doc = root?.ownerDocument;\n const active = doc?.activeElement ?? null;\n if (!root || (active && root.contains(active))) return;\n const idle = !active || active === doc?.body || active === doc?.documentElement;\n if (!idle && !fromAnswer) return;\n if (active?.closest(\"input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='combobox'], [role='textbox'], [role='menu'], [role='listbox']\")) return;\n const dialog = active?.closest(\"[role='dialog'], [role='alertdialog'], dialog\");\n if (dialog && !dialog.contains(root)) return;\n root.focus({ preventScroll: true });\n }, [cardId, keyboard, layout]);\n\n // ─── the walkthrough (?) ─────────────────────────────────────────────────\n const fingerRef = React.useRef<HTMLDivElement>(null);\n const ringRef = React.useRef<HTMLDivElement>(null);\n const capRef = React.useRef<HTMLDivElement>(null);\n const tour = async () => {\n const layer = layerRef.current;\n const stage = layer?.parentElement;\n const F = fingerRef.current;\n if (touringRef.current || !cardItem || busy.current || part || !layer || !stage || !F) return;\n touringRef.current = true;\n tourStop.current = false;\n setTouring(true);\n stopNudge();\n setBubble(null);\n const reduced = prefersReducedMotion();\n const tween = (ms: number, f: (p: number) => void) =>\n new Promise<void>((res) => {\n const t0 = performance.now();\n const frame = (t: number) => {\n if (tourStop.current) return res();\n const p = Math.min(1, (t - t0) / ms);\n f(p);\n if (p < 1) requestAnimationFrame(frame);\n else res();\n };\n requestAnimationFrame(frame);\n });\n const ease = (p: number) => (p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2);\n const place = (el: HTMLElement | null, x: number, y: number) => {\n if (!el) return;\n el.style.left = `${x}px`;\n el.style.top = `${y}px`;\n };\n const r = stage.getBoundingClientRect();\n const cx = r.left + r.width / 2;\n const cy = r.top + r.height / 2;\n const dist = Math.min(r.width, r.height) * 0.34;\n place(F, cx, cy);\n F.style.opacity = \"1\";\n const key = cardKey;\n const order = [...(suggestedDir ? [suggestedDir] : []), ...DECK_DIRECTIONS.filter((d) => d !== suggestedDir)];\n for (const dir of order) {\n if (tourStop.current) break;\n const answer = key[dir];\n if (!answer) continue;\n const [vx, vy] = VECTOR[dir];\n F.setAttribute(\"data-down\", \"\");\n await tween(reduced ? 1 : 620, (p) => {\n const e = ease(p);\n place(F, cx + vx * dist * e, cy + vy * dist * e);\n follow(layer, vx * dist * e, vy * dist * e, e * 1.05);\n wash.current?.show(answer, dir, e * 1.05);\n setHot(edgeRefs.current, p > 0.8 ? dir : null);\n });\n await wait(tourStop.current ? 0 : 420);\n await tween(reduced ? 1 : 240, (p) => {\n const e = 1 - p;\n place(F, cx + vx * dist * e, cy + vy * dist * e);\n follow(layer, vx * dist * e, vy * dist * e, e);\n wash.current?.show(answer, dir, e);\n });\n F.removeAttribute(\"data-down\");\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n follow(layer, 0, 0);\n await wait(tourStop.current ? 0 : 140);\n }\n const word = layer.querySelector<HTMLElement>(\"[data-sd-part] [data-sd-t]\") ?? layer.querySelector<HTMLElement>(\"[data-sd-t]\");\n if (!tourStop.current && word && props.editParts !== false) {\n const wr = word.getBoundingClientRect();\n const tx = wr.left + wr.width / 2;\n const ty = wr.top + wr.height / 2;\n await tween(reduced ? 1 : 420, (p) => {\n const e = ease(p);\n place(F, cx + (tx - cx) * e, cy + (ty - cy) * e);\n });\n const cap = capRef.current;\n if (cap) {\n cap.textContent = finePointer() ? labels.clickHint : labels.holdHint;\n const vw = cap.ownerDocument.defaultView?.innerWidth ?? 0;\n place(cap, Math.max(cap.offsetWidth / 2 + 12, Math.min(tx, vw - cap.offsetWidth / 2 - 12)), ty - 40);\n cap.style.opacity = \"1\";\n }\n F.setAttribute(\"data-down\", \"\");\n word.setAttribute(\"data-sd-press\", \"\");\n place(ringRef.current, tx, ty);\n if (!reduced) ringRef.current?.animate([{ opacity: 1, transform: \"scale(.6)\" }, { opacity: 0, transform: \"scale(1.9)\" }], { duration: 900, iterations: 2 });\n await wait(tourStop.current ? 0 : 1700);\n word.removeAttribute(\"data-sd-press\");\n F.removeAttribute(\"data-down\");\n if (cap) cap.style.opacity = \"0\";\n }\n F.style.opacity = \"0\";\n follow(layer, 0, 0);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n touringRef.current = false;\n setTouring(false);\n const pending = afterTour.current;\n afterTour.current = null;\n if (pending && alive.current) runKeyRef.current(pending, null);\n };\n const tourRef = React.useRef(tour);\n tourRef.current = tour;\n\n // ─── card arrival: enter, lean toward the suggestion, first-use walkthrough ─\n const tourKey = props.tourKey === undefined ? DEFAULT_TOUR_KEY : props.tourKey;\n const onCardMounted = React.useCallback(\n (layer: HTMLDivElement, dir: DeckDirection | null) => {\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer, from);\n if (tourKey && !readFlag(tourKey)) {\n writeFlag(tourKey);\n setTimeout(() => {\n if (alive.current && layerRef.current === layer) void tourRef.current();\n }, 700);\n return;\n }\n if (from === null && dir) {\n setTimeout(() => {\n if (!alive.current || layerRef.current !== layer || busy.current || touringRef.current) return;\n nudgeAnim.current = nudge(layer, dir);\n }, 420);\n }\n },\n [tourKey],\n );\n\n // ─── reaching the end ────────────────────────────────────────────────────\n const result = React.useMemo(() => deckResult(items, state, rules, conflict), [items, state, rules, conflict]);\n const atEnd = ready && items.length > 0 && step.kind === \"end\";\n const wasAtEnd = React.useRef(false);\n const onComplete = props.onComplete;\n React.useEffect(() => {\n if (atEnd && !wasAtEnd.current) {\n onComplete?.(result);\n // Arriving at the finish is said, as every answer is.\n setSaid(\n `${result.score ? `${labels.score}: ${result.score.right} / ${result.score.graded}` : labels.allDone}. ${labels.answeredOf.replace(\"{answered}\", String(result.answered)).replace(\"{total}\", String(result.total))}`,\n );\n }\n wasAtEnd.current = atEnd;\n }, [atEnd, result, onComplete, labels]);\n\n // ─── copy ────────────────────────────────────────────────────────────────\n const copy = async () => {\n const text = props.copyText\n ? props.copyText({ item: cardItem, state, result })\n : cardItem\n ? itemCopyText(cardItem, state, cardKey, labels, conflict, cardMoreShown)\n : deckCopyText(result, rules);\n const ok = await copyToClipboard(text);\n flash(ok ? labels.copied : labels.copyFailed);\n };\n\n // Drop the bubble's measured position into the viewport.\n const bubbleRef = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n const b = bubbleRef.current;\n if (!b || !bubble) return;\n const vw = b.ownerDocument.defaultView?.innerWidth ?? 0;\n const w = b.offsetWidth;\n const h = b.offsetHeight;\n b.style.left = `${Math.max(12, Math.min(bubble.x - w / 2, vw - w - 12))}px`;\n b.style.top = `${bubble.top - h - 10 < 8 ? bubble.bottom + 10 : bubble.top - h - 10}px`;\n }, [bubble]);\n\n const progress = steps.filter((s) => s.kind !== \"end\");\n\n return (\n <div\n ref={rootRef}\n className={[\"matrx-sd\", props.className].filter(Boolean).join(\" \")}\n data-layout={layout}\n data-touring={touring ? \"\" : undefined}\n {...(layout === \"inline\"\n ? {\n tabIndex: 0,\n role: \"group\",\n \"aria-roledescription\": \"swipe deck\",\n onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => {\n // Pressing the deck gives it the keys (it is one of many things in a chat).\n const root = e.currentTarget;\n if (!root.contains(root.ownerDocument.activeElement)) root.focus({ preventScroll: true });\n },\n }\n : { tabIndex: -1 })}\n >\n <div className=\"matrx-sd-progress\" aria-hidden=\"true\">\n {progress.map((s, k) => {\n const tone =\n k === stepIndex\n ? \"current\"\n : s.kind === \"card\"\n ? findAnswer(rules, s.item, state.answers[s.item.id])?.tone\n : s.kind === \"pick\" && state.picks[s.group]\n ? \"primary\"\n : undefined;\n return <i key={s.id} data-tone={tone} />;\n })}\n </div>\n\n <div\n ref={frameRef}\n className=\"matrx-sd-frame\"\n data-axis={!cardKey.up && !cardKey.down ? \"x\" : undefined}\n aria-hidden={part ? true : undefined}\n inert={part ? true : undefined}\n onPointerDownCapture={(e) => {\n // A press on the card away from the host's own controls (their field gone or left) ends a lock.\n if (!lockedRef.current) return;\n const inBody = (n: EventTarget | Element | null) => n instanceof Element && !!n.closest(\".matrx-sd-body\");\n if (inBody(e.target) || inBody(e.currentTarget.ownerDocument.activeElement)) return;\n lockedRef.current = false;\n live.current = { ...live.current, enabled: !!cardItem && !part && !touring };\n setLocked(null);\n }}\n >\n {props.onExpand ? (\n <CornerButton corner=\"tl\" label={labels.expand} onClick={props.onExpand}>\n <Maximize2Icon />\n </CornerButton>\n ) : props.onExit ? (\n <CornerButton corner=\"tl\" label={props.exitKind === \"collapse\" ? labels.collapse : labels.exit} {...(props.exitKind === \"collapse\" ? { shortcut: \"Escape\" } : {})} onClick={props.onExit}>\n {props.exitKind === \"collapse\" ? <Minimize2Icon /> : <XIcon />}\n </CornerButton>\n ) : null}\n <CornerButton corner=\"tr\" label={labels.answered} onClick={() => setReviewing((v) => !v)} disabled={!ready || !items.length || step.kind === \"end\"} pressed={reviewing}>\n <ListChecksIcon />\n {result.answered ? <span className=\"matrx-sd-corner-count\">{result.answered}</span> : null}\n </CornerButton>\n <CornerButton corner=\"bl\" label={labels.undo} shortcut=\"Z\" onClick={undo} disabled={!controller.canUndo}>\n <Undo2Icon />\n </CornerButton>\n <CornerButton corner=\"br\" label={labels.copy} onClick={() => void copy()} disabled={!ready || !items.length}>\n <CopyIcon />\n </CornerButton>\n\n {cardItem ? (\n <EdgeButtons keyMap={cardKey} suggested={suggestedDir} refs={edgeRefs} onAnswer={(d) => act(d)} suggestionLabel={labels.suggestion} />\n ) : null}\n\n <div className=\"matrx-sd-stage\">\n {!ready ? (\n <div className=\"matrx-sd-layer\" data-state={controller.status}>\n {controller.status === \"error\" ? (\n <ErrorBox className=\"matrx-sd-message\" message={controller.readError ?? \"\"} operation=\"Read the deck\" origin=\"design-system/SwipeDeck\" />\n ) : (\n <Loader2Icon className=\"matrx-spin matrx-sd-spinner\" />\n )}\n </div>\n ) : items.length === 0 ? (\n <EmptyView key=\"empty\" title={props.empty?.title ?? labels.emptyTitle} line={props.empty?.line} action={props.empty?.action} layerRef={layerRef} />\n ) : reviewing && step.kind !== \"end\" ? (\n <EndView\n key=\"review\"\n result={result}\n rules={rules}\n labels={labels}\n groupLabels={props.groupLabels}\n layerRef={layerRef}\n enterFrom={enterFrom}\n review={{\n onBack: () => setReviewing(false),\n onHelp: () => {\n setReviewing(false);\n void tour();\n },\n }}\n onChange={(item) => {\n enterFrom.current = null;\n const now = stateRef.current;\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: null }];\n if (item.group && now.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n controller.commit(makeChange(now, ops, items));\n setReviewing(false);\n setSaid(`${labels.change}: ${item.text}`);\n }}\n />\n ) : step.kind === \"card\" ? (\n <CardView\n key={step.id}\n item={step.item}\n keyMap={cardKey}\n state={state}\n conflict={conflict}\n labels={labels}\n suggestedDir={suggestedDir}\n more={props.moreOnCard === false ? [] : cardMoreShown}\n titleSize={props.titleSize ?? \"fit\"}\n detail={detailNow}\n onDetail={(d) => setCardDetail({ id: step.item.id, detail: d })}\n body={cardContext && props.renderCardBody ? props.renderCardBody(cardContext) : null}\n onBodyLeft={() => setLocked(null)}\n actions={cardContext && props.renderCardActions ? props.renderCardActions(cardContext) : null}\n showChoices={props.choicesOnCard === true || ((props.choicesOnCard ?? \"auto\") === \"auto\" && !!step.item.answers)}\n onChoose={(d) => {\n // A drag that started on a choice and snapped back still ends in a click: not an answer.\n if (dragged.current) dragged.current = false;\n else act(d);\n }}\n onChooseMore={(a) => {\n if (dragged.current) dragged.current = false;\n else void give(a, null);\n }}\n layerRef={layerRef}\n onMounted={onCardMounted}\n onDoubleClickWord={(i) => openPart(step.item, i)}\n />\n ) : step.kind === \"pick\" ? (\n <PickView key={step.id} step={step} label={props.groupLabels?.[step.group] ?? labels.pick} labels={labels} layerRef={layerRef} onPick={pick} enterFrom={enterFrom} />\n ) : (\n <EndView\n key=\"end\"\n result={result}\n rules={rules}\n labels={labels}\n groupLabels={props.groupLabels}\n layerRef={layerRef}\n enterFrom={enterFrom}\n actions={props.endActions}\n onChange={(item) => {\n // Taking an answer back is a change like any other (undo puts it back); the deck returns to that card.\n enterFrom.current = null;\n const now = stateRef.current;\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: null }];\n // A pick that named this item goes with its answer, as when the card is answered otherwise.\n if (item.group && now.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n controller.commit(makeChange(now, ops, items));\n setSaid(`${labels.change}: ${item.text}`);\n }}\n >\n {props.renderEnd?.(result)}\n </EndView>\n )}\n </div>\n <Wash ref={wash} />\n </div>\n\n {controller.writeError ? (\n <ErrorBox className=\"matrx-sd-error\" message={controller.writeError} operation=\"Save an answer\" origin=\"design-system/SwipeDeck\" />\n ) : null}\n\n {part && partItem ? (\n <PartScreen\n key={`${part.itemId}:${part.start}`}\n item={partItem}\n parts={partsOf(state, partItem)}\n initial={{ start: part.start, end: part.end }}\n keyMap={partKey}\n deckKey={keyFor(rules, partItem)}\n state={state}\n categories={allCategories}\n rows={props.categoryRows}\n allowNewCategories={props.allowNewCategories !== false}\n conflict={conflict}\n labels={labels}\n onClose={() => setPart(null)}\n onPlace={(p) => placeOnItem(partItem, p)}\n onForget={(span) => forgetOnItem(partItem, span)}\n onCategoryAnswer={(name, answer, row) => {\n enterFrom.current = \"stay\";\n controller.commit(makeChange(stateRef.current, [{ kind: \"category\", name, answer, ...(row ? { row } : {}) }], items));\n }}\n announce={setSaid}\n />\n ) : null}\n\n <div className=\"matrx-sd-tour\" hidden={!touring} onPointerDown={() => (tourStop.current = true)}>\n <div ref={ringRef} className=\"matrx-sd-ring\" />\n <div ref={fingerRef} className=\"matrx-sd-finger\" />\n <div ref={capRef} className=\"matrx-sd-tour-cap\" />\n </div>\n {bubble ? (\n <div ref={bubbleRef} className=\"matrx-sd-bubble\" role=\"status\">\n {bubble.text}\n </div>\n ) : null}\n <div className=\"matrx-sd-toast\" role=\"status\" aria-live=\"polite\" data-on={toast ? \"\" : undefined}>\n {toast}\n </div>\n <div className=\"matrx-sd-sr\" aria-live=\"polite\" aria-atomic=\"true\">\n {said}\n </div>\n </div>\n );\n}\n\n// ─── the card ──────────────────────────────────────────────────────────────\n\ninterface CardViewProps {\n readonly item: DeckItem;\n readonly keyMap: DeckKey;\n readonly state: DeckState;\n readonly conflict: CategoryConflict | undefined;\n readonly labels: SwipeDeckLabels;\n readonly suggestedDir: DeckDirection | null;\n /** Draw the item's choices on the card by direction (a quiz). */\n readonly showChoices: boolean;\n readonly onChoose: (dir: DeckDirection) => void;\n /** Answers off the edges: on the card as buttons (in the choices when they show). */\n readonly more: readonly DeckAnswer[];\n readonly onChooseMore: (answer: DeckAnswer) => void;\n /** `fit` grows the text to the card; `page` holds it at a page-title size. */\n readonly titleSize: \"fit\" | \"page\";\n readonly detail: DeckDetail | null;\n readonly onDetail: (detail: DeckDetail | null) => void;\n readonly body: React.ReactNode;\n /** Focus left the body slot: a lock it held is released. */\n readonly onBodyLeft: () => void;\n readonly actions: React.ReactNode;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly onMounted: (layer: HTMLDivElement, suggested: DeckDirection | null) => void;\n readonly onDoubleClickWord: (index: number) => void;\n}\n\n/** The order choices read on a card: clockwise from the top. */\nconst CHOICE_ORDER: readonly DeckDirection[] = [\"up\", \"right\", \"down\", \"left\"];\n\nfunction MediaView({ media, size }: { media: DeckMedia; size?: \"small\" }) {\n const shape = media.shape ?? \"square\";\n return (\n <span className=\"matrx-sd-media\" data-shape={shape} data-size={size}>\n {\"src\" in media ? <img src={media.src} alt={media.alt ?? \"\"} draggable={false} /> : media.node}\n </span>\n );\n}\n\nfunction CardView({\n item,\n keyMap,\n state,\n conflict,\n labels,\n suggestedDir,\n showChoices,\n onChoose,\n more,\n onChooseMore,\n titleSize,\n detail,\n onDetail,\n body,\n onBodyLeft,\n actions,\n layerRef,\n onMounted,\n onDoubleClickWord,\n}: CardViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n const inner = React.useRef<HTMLDivElement>(null);\n const hero = React.useRef<HTMLParagraphElement>(null);\n const tokens = React.useMemo(() => tokenize(item.text), [item.text]);\n const parts = partsOf(state, item);\n const suggested = answerOf(keyMap, item.suggested, more);\n const off = membersOff(item, detail);\n const toggle = (id: string) => {\n const next = off.includes(id) ? off.filter((x) => x !== id) : [...off, id];\n onDetail({ ...(detail ?? {}), off: next });\n };\n\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n if (layer.current) onMounted(layer.current, suggestedDir);\n return () => {\n if (layerRef.current === layer.current) layerRef.current = null;\n };\n // Mount only: a card arrives once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const partsKey = parts.map((p) => `${p.start}-${p.end}`).join(\",\");\n React.useLayoutEffect(() => {\n const box = layer.current;\n if (!box || !inner.current || !hero.current) return;\n return keepFitted(box, () => {\n if (!inner.current || !hero.current) return;\n if (titleSize === \"fit\") fitText(box, inner.current, hero.current, 20, heroMax(box));\n else markOverflow(box, inner.current);\n });\n }, [item.text, partsKey, item.members?.length, more.length, titleSize]);\n\n const nodes: React.ReactNode[] = [];\n for (let i = 0; i < tokens.length; ) {\n const p = parts.find((x) => x.start === i);\n if (p) {\n const a = answerOf(keyMap, partAnswer(p, state, keyMap, conflict));\n const words: React.ReactNode[] = [];\n for (let j = p.start; j <= p.end; j++) {\n words.push(\n <span key={j} className=\"matrx-sd-token\" data-sd-t={j}>\n {tokens[j]}\n </span>,\n );\n if (j < p.end) words.push(\" \");\n }\n nodes.push(\n <span key={`p${i}`} className=\"matrx-sd-part\" data-sd-part={i} data-tone={a?.tone} data-sd-part-label={[a?.label, ...p.categories].filter(Boolean).join(\" · \") || partText(item, p)}>\n {words}\n </span>,\n );\n i = p.end + 1;\n } else {\n nodes.push(\n <span key={i} className=\"matrx-sd-token\" data-sd-t={i}>\n {tokens[i]}\n </span>,\n );\n i++;\n }\n if (i < tokens.length) nodes.push(\" \");\n }\n\n return (\n <div\n ref={layer}\n className=\"matrx-sd-layer\"\n data-sd-item={item.id}\n data-sd-title={titleSize === \"page\" ? \"page\" : undefined}\n aria-label={[item.kicker, item.text].filter(Boolean).join(\": \")}\n onDoubleClick={(e) => {\n const t = e.target instanceof Element ? e.target.closest(\"[data-sd-t]\") : null;\n if (t) onDoubleClickWord(Number(t.getAttribute(\"data-sd-t\")));\n }}\n >\n <div ref={inner} className=\"matrx-sd-card\">\n {item.media ? <MediaView media={item.media} /> : null}\n {item.kicker || item.tag || actions ? (\n <div className=\"matrx-sd-kicker\">\n {item.kicker ? <span>{item.kicker}</span> : null}\n {item.tag ? (\n <span className=\"matrx-sd-tag\">\n <CheckIcon />\n {item.tag}\n </span>\n ) : null}\n {actions ? <span className=\"matrx-sd-actions\">{actions}</span> : null}\n </div>\n ) : null}\n <p ref={hero} className=\"matrx-sd-hero\" data-quoted={item.quoted ? \"\" : undefined}>\n {nodes}\n </p>\n {item.members?.length ? (\n <div className=\"matrx-sd-members\">\n {item.members.map((m) => {\n const isOff = off.includes(m.id);\n return (\n // ui-exception: a group card's member switch is part of the card (a swipe never starts on it)\n <button key={m.id} type=\"button\" className=\"matrx-sd-member\" aria-pressed={!isOff} data-off={isOff ? \"\" : undefined} onClick={() => toggle(m.id)}>\n {m.media ? <MediaView media={m.media} size=\"small\" /> : null}\n <span>{m.label}</span>\n </button>\n );\n })}\n </div>\n ) : null}\n {body ? (\n <div\n className=\"matrx-sd-body\"\n onBlur={(e) => {\n // Focus leaving the host's own controls (a field closed, a tap on the card) ends a lock: never stuck.\n const next = e.relatedTarget instanceof Node ? e.relatedTarget : null;\n // The window losing focus (another tab, another app) is not leaving the field.\n if (!e.currentTarget.ownerDocument.hasFocus()) return;\n if (!next || !e.currentTarget.contains(next)) onBodyLeft();\n }}\n >\n {body}\n </div>\n ) : null}\n {showChoices ? (\n <div className=\"matrx-sd-choices\">\n {CHOICE_ORDER.map((d) => {\n const a = keyMap[d];\n if (!a) return null;\n return (\n // ui-exception: a choice on the card is the card's own answer target (and a swipe can start on it)\n <button key={d} type=\"button\" className=\"matrx-sd-choice\" data-sd-choice=\"\" data-dir={d} data-tone={a.tone} onClick={() => onChoose(d)}>\n <AnswerGlyph answer={{ ...a, icon: undefined }} dir={d} />\n <span>{a.label}</span>\n </button>\n );\n })}\n {more.map((a) => (\n // ui-exception: an answer off the edges is the card's own answer target\n <button key={a.id} type=\"button\" className=\"matrx-sd-choice\" data-sd-choice=\"\" data-tone={a.tone} title={a.shortcut ? `${a.label} (${a.shortcut})` : a.label} onClick={() => onChooseMore(a)}>\n {a.icon ?? null}\n <span>{a.label}</span>\n </button>\n ))}\n </div>\n ) : more.length ? (\n <div className=\"matrx-sd-more\">\n {more.map((a) => (\n // ui-exception: an answer off the edges is the card's own answer target\n <button\n key={a.id}\n type=\"button\"\n className=\"matrx-sd-more-answer\"\n data-sd-choice=\"\"\n data-tone={a.tone}\n data-suggested={item.suggested === a.id ? \"\" : undefined}\n aria-keyshortcuts={a.shortcut}\n title={a.shortcut ? `${a.label} (${a.shortcut})` : a.label}\n onClick={() => onChooseMore(a)}\n >\n {a.icon ?? null}\n <span>{a.label}</span>\n </button>\n ))}\n </div>\n ) : null}\n {suggested || item.reason || item.fields?.length ? (\n <div className=\"matrx-sd-fields\">\n {suggested ? (\n <div>\n <div className=\"matrx-sd-label\">{labels.suggestion}</div>\n <div className=\"matrx-sd-suggested\" data-tone={suggested.tone}>\n <AnswerGlyph answer={suggested} dir={suggestedDir} />\n {item.suggestedLabel ?? suggested.label}\n </div>\n </div>\n ) : null}\n {item.reason ? (\n <div>\n <div className=\"matrx-sd-label\">{labels.reason}</div>\n <div className=\"matrx-sd-value\">{item.reason}</div>\n </div>\n ) : null}\n {item.fields?.map((f) => (\n <div key={f.label}>\n <div className=\"matrx-sd-label\">{f.label}</div>\n <div className=\"matrx-sd-value\">{f.value}</div>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\n// ─── pick one ──────────────────────────────────────────────────────────────\n\ninterface PickViewProps {\n readonly step: Extract<DeckStep, { kind: \"pick\" }>;\n readonly label: string;\n readonly labels: SwipeDeckLabels;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly enterFrom: React.MutableRefObject<DeckDirection | \"stay\" | null>;\n readonly onPick: (group: string, item: DeckItem) => void;\n}\n\nfunction PickView({ step, label, labels, layerRef, enterFrom, onPick }: PickViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n const [chosen, setChosen] = React.useState<string | null>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer.current, from);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n React.useLayoutEffect(() => {\n const box = layer.current;\n if (!box) return;\n const run = () => {\n const buttons = Array.from(box.querySelectorAll<HTMLElement>(\".matrx-sd-option\"));\n let lo = 16;\n let hi = (box.ownerDocument.defaultView?.innerWidth ?? 0) >= 1024 ? 64 : 40;\n let best = lo;\n for (let k = 0; k < 9; k++) {\n const mid = (lo + hi) / 2;\n buttons.forEach((b) => (b.style.fontSize = `${mid}px`));\n const ok = buttons.every((b) => b.scrollHeight <= b.clientHeight + 1 && b.scrollWidth <= b.clientWidth + 1);\n if (ok) {\n best = mid;\n lo = mid;\n } else hi = mid;\n }\n buttons.forEach((b) => (b.style.fontSize = `${Math.floor(best)}px`));\n // Too many options for even the smallest size: the pick scrolls instead of clipping.\n const list = box.querySelector<HTMLElement>(\".matrx-sd-options\");\n if (list && list.scrollHeight > box.clientHeight + 1) box.setAttribute(\"data-sd-overflow\", \"\");\n else box.removeAttribute(\"data-sd-overflow\");\n };\n return keepFitted(box, run);\n }, [step.items.length]);\n return (\n <div ref={layer} className=\"matrx-sd-layer\">\n <div className=\"matrx-sd-options\" role=\"radiogroup\" aria-label={label}>\n {step.items.map((item) => (\n // ui-exception: a pick-one option fills its share of the full-screen deck\n <button\n key={item.id}\n type=\"button\"\n role=\"radio\"\n aria-checked={chosen === item.id}\n className=\"matrx-sd-option\"\n data-suggested={item.pickSuggested ? \"\" : undefined}\n data-chosen={chosen === item.id ? \"\" : undefined}\n onClick={() => {\n setChosen(item.id);\n onPick(step.group, item);\n }}\n >\n {item.pickSuggested ? <span className=\"matrx-sd-label\">{labels.suggestion}</span> : null}\n <span>{item.text}</span>\n </button>\n ))}\n </div>\n </div>\n );\n}\n\n// ─── the end ───────────────────────────────────────────────────────────────\n\ninterface EndViewProps {\n readonly result: DeckResult;\n readonly rules: DeckRules;\n readonly labels: SwipeDeckLabels;\n readonly groupLabels: Readonly<Record<string, string>> | undefined;\n readonly layerRef: React.MutableRefObject<HTMLDivElement | null>;\n readonly enterFrom: React.MutableRefObject<DeckDirection | \"stay\" | null>;\n /** The host's own buttons at the end (back to where the person came from, next step). */\n readonly actions?: React.ReactNode;\n /** Take an item's answer back: the deck returns to that card. */\n readonly onChange: (item: DeckItem) => void;\n readonly children?: React.ReactNode;\n /** Mid-deck: the same list titled \"Answered\", with the way back to the cards (and the walkthrough). */\n readonly review?: { readonly onBack: () => void; readonly onHelp?: () => void };\n}\n\ninterface EndGroup {\n readonly key: string;\n readonly label: string;\n readonly tone: DeckTone;\n readonly count: number;\n}\n\n/** How the answers split: right / wrong on a graded deck, else by answer (same words = one group). */\nfunction endGroups(result: DeckResult, labels: SwipeDeckLabels): EndGroup[] {\n const graded = result.entries.filter((e) => e.answer && e.right !== null);\n if (result.score && graded.length) {\n const right = graded.filter((e) => e.right).length;\n return [\n { key: \"right\", label: labels.right, tone: \"success\", count: right },\n { key: \"wrong\", label: labels.wrong, tone: \"destructive\", count: graded.length - right },\n ].filter((g) => g.count > 0) as EndGroup[];\n }\n const out = new Map<string, EndGroup>();\n for (const e of result.entries) {\n if (!e.answer) continue;\n const key = e.answer.label;\n const had = out.get(key);\n out.set(key, { key, label: e.answer.label, tone: had?.tone ?? e.answer.tone, count: (had?.count ?? 0) + 1 });\n }\n return [...out.values()];\n}\n\nfunction groupOf(entry: DeckResult[\"entries\"][number], graded: boolean): string | null {\n if (!entry.answer) return null;\n if (graded && entry.right !== null) return entry.right ? \"right\" : \"wrong\";\n return entry.answer.label;\n}\n\n/** The finish: a mark that draws itself, the headline (a pick, a score, or done), how the answers split, and every answer to look over and change. */\nfunction EndView({ result, rules, labels, groupLabels, layerRef, enterFrom, actions, onChange, children, review }: EndViewProps) {\n const layer = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n const from = enterFrom.current;\n enterFrom.current = null;\n if (from !== \"stay\") enter(layer.current, from);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const [filter, setFilter] = React.useState<string | null>(null);\n if (children) {\n return (\n <div ref={layer} className=\"matrx-sd-layer\">\n {children}\n </div>\n );\n }\n const picks = Object.entries(result.picks);\n const [first, ...rest] = picks;\n const score = result.score;\n const groups = endGroups(result, labels);\n const graded = !!score && groups.some((g) => g.key === \"right\" || g.key === \"wrong\");\n const answered = result.entries.filter((e) => e.answer);\n const shown = filter ? answered.filter((e) => groupOf(e, graded) === filter) : answered;\n const pct = score && score.graded ? score.right / score.graded : 1;\n const kicker = review ? null : first ? (groupLabels?.[first[0]] ?? first[0]) : score ? labels.score : null;\n const headline = review ? labels.answered : first ? first[1].text : score ? `${score.right} / ${score.graded}` : labels.allDone;\n const sub = labels.answeredOf.replace(\"{answered}\", String(result.answered)).replace(\"{total}\", String(result.total));\n return (\n <div ref={layer} className=\"matrx-sd-layer matrx-sd-endlayer\">\n <div className=\"matrx-sd-end\" data-graded={graded ? \"\" : undefined} data-review={review ? \"\" : undefined}>\n {review ? null : (\n <svg className=\"matrx-sd-mark\" viewBox=\"0 0 72 72\" aria-hidden=\"true\" data-tone={score ? (pct >= 0.5 ? \"success\" : \"warning\") : \"success\"}>\n <circle className=\"matrx-sd-mark-track\" cx=\"36\" cy=\"36\" r=\"32\" />\n <circle className=\"matrx-sd-mark-ring\" cx=\"36\" cy=\"36\" r=\"32\" pathLength={100} style={{ strokeDasharray: `${Math.round(pct * 100)} 100` }} />\n {!score || pct === 1 ? <path className=\"matrx-sd-mark-check\" d=\"M23 37.5l9 9 17-19\" pathLength={100} /> : null}\n </svg>\n )}\n {kicker ? <div className=\"matrx-sd-kicker\">{kicker}</div> : null}\n <h2 className=\"matrx-sd-end-hero\">{headline}</h2>\n <div className=\"matrx-sd-end-sub\">{sub}</div>\n {score && first && !review ? (\n <div className=\"matrx-sd-endline\">\n <div className=\"matrx-sd-label\">{labels.score}</div>\n <div className=\"matrx-sd-value\">{`${score.right} / ${score.graded}`}</div>\n </div>\n ) : null}\n {(review ? [] : rest).map(([group, item]) => (\n <div key={group} className=\"matrx-sd-endline\">\n <div className=\"matrx-sd-label\">{groupLabels?.[group] ?? group}</div>\n <div className=\"matrx-sd-value\">{item.text}</div>\n </div>\n ))}\n {groups.length ? (\n <>\n <div className=\"matrx-sd-split\" aria-hidden=\"true\">\n {groups.map((g) => (\n <i key={g.key} data-tone={g.tone} style={{ flexGrow: g.count }} />\n ))}\n </div>\n <div className=\"matrx-sd-legend\" role=\"group\" aria-label={labels.filterAnswers}>\n {groups.length > 1 ? (\n // ui-exception: the end's answer filter is part of the deck's own finish screen\n <button type=\"button\" className=\"matrx-sd-legend-chip\" aria-pressed={filter === null} onClick={() => setFilter(null)}>\n <span>{labels.showAll}</span>\n <b>{answered.length}</b>\n </button>\n ) : null}\n {groups.map((g) => (\n // ui-exception: the end's answer filter is part of the deck's own finish screen\n <button\n key={g.key}\n type=\"button\"\n className=\"matrx-sd-legend-chip\"\n data-tone={g.tone}\n aria-pressed={filter === g.key}\n onClick={() => setFilter((f) => (f === g.key ? null : g.key))}\n >\n <i aria-hidden=\"true\" />\n <span>{g.label}</span>\n <b>{g.count}</b>\n </button>\n ))}\n </div>\n </>\n ) : null}\n {shown.length ? (\n <ul className=\"matrx-sd-review\" aria-label={labels.yourAnswers}>\n {shown.map((e) => {\n const rightIds = e.item.correct === undefined ? [] : typeof e.item.correct === \"string\" ? [e.item.correct] : e.item.correct;\n // What rode with the answer reads in its place: the value typed on the card, the relationship picked.\n const said = typeof e.detail?.value === \"string\" && e.detail.value.trim() ? e.detail.value : e.item.text;\n const answerWords = typeof e.detail?.label === \"string\" && e.detail.label ? e.detail.label : e.answer?.label;\n const rightWords = rightIds.map((id) => findAnswer(rules, e.item, id)?.label).filter(Boolean).join(\", \");\n return (\n <li key={e.item.id}>\n {/* ui-exception: a reviewed answer is the end screen's own row (tap to change it) */}\n <button\n type=\"button\"\n className=\"matrx-sd-review-row\"\n onClick={() => onChange(e.item)}\n aria-label={[\n `${labels.change}: ${said}`,\n [answerWords, e.right === true ? labels.right : e.right === false ? labels.wrong : null].filter(Boolean).join(\", \"),\n e.right === false && rightWords ? `${labels.rightAnswer}: ${rightWords}` : null,\n ]\n .filter(Boolean)\n .join(\". \")}\n >\n <span className=\"matrx-sd-review-text\">\n {e.item.kicker ? <span className=\"matrx-sd-label\">{e.item.kicker}</span> : null}\n <span className=\"matrx-sd-review-item\">{said}</span>\n {e.right === false && rightWords ? (\n <span className=\"matrx-sd-review-right\">\n {labels.rightAnswer}: {rightWords}\n </span>\n ) : null}\n </span>\n <span className=\"matrx-sd-review-answer\" data-tone={e.right === null ? e.answer?.tone : e.right ? \"success\" : \"destructive\"}>\n {e.right === true ? <CheckIcon /> : e.right === false ? <XIcon /> : null}\n <span>{answerWords}</span>\n </span>\n <PencilIcon className=\"matrx-sd-review-change\" aria-hidden=\"true\" />\n </button>\n </li>\n );\n })}\n </ul>\n ) : null}\n {review ? (\n <div className=\"matrx-sd-end-actions\">\n {/* ui-exception: the answered list's way back is the deck's own control, in its own geometry */}\n <button type=\"button\" className=\"matrx-sd-review-back\" onClick={review.onBack} autoFocus>\n {labels.backToCards}\n </button>\n {review.onHelp ? (\n // ui-exception: the walkthrough, from the answered list (the corner it had now opens this list)\n <button type=\"button\" className=\"matrx-sd-legend-chip\" onClick={review.onHelp}>\n <CircleHelpIcon aria-hidden=\"true\" />\n <span>{labels.help}</span>\n </button>\n ) : null}\n </div>\n ) : actions ? (\n <div className=\"matrx-sd-end-actions\">{actions}</div>\n ) : null}\n </div>\n </div>\n );\n}\n\n/** Nothing to answer: the deck's own quiet screen, never a blank. */\nfunction EmptyView({ title, line, action, layerRef }: { title: string; line?: string | undefined; action?: React.ReactNode; layerRef: React.MutableRefObject<HTMLDivElement | null> }) {\n const layer = React.useRef<HTMLDivElement>(null);\n React.useLayoutEffect(() => {\n layerRef.current = layer.current;\n enter(layer.current, null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return (\n <div ref={layer} className=\"matrx-sd-layer matrx-sd-endlayer\" data-sd-empty=\"\">\n <div className=\"matrx-sd-end matrx-sd-empty\">\n <div className=\"matrx-sd-empty-stack\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </div>\n <h2 className=\"matrx-sd-end-hero\">{title}</h2>\n {line ? <div className=\"matrx-sd-end-sub\">{line}</div> : null}\n {action ? <div className=\"matrx-sd-end-actions\">{action}</div> : null}\n </div>\n </div>\n );\n}\n\n\n","/**\n * ErrorBox — THE one way a package draws an error on screen, and the seam a\n * host uses to put its own actions on every one of them.\n *\n * Every error sentence this package (and every sibling package that depends\n * on it) shows is an `ErrorBox`. The box is a plain `role=\"alert\"` element —\n * its tag and classes are the caller's, so nothing about the look changes — and\n * after its children it renders whatever the host's `ErrorActionsProvider`\n * returns for that error. With no provider it renders nothing extra.\n *\n * Why a slot and not a menu: the package cannot know the host's AI copy, bug\n * report, or support flow (Matrx fills it with its Alchemy copy-for-AI menu at\n * the app root). The package supplies the error's facts — the sentence, the\n * raw error, the operation, the records — and the host decides the actions.\n *\n * Guard: `error-box.census.test.ts` fails when a package file renders\n * `role=\"alert\"` for an error without going through `ErrorBox` (or, for the\n * `Alert` family, `ErrorActions`).\n */\nimport * as React from \"react\";\nimport { peopleErrorSentence } from \"./error-sentence\";\n\nexport interface ErrorActionsRecord {\n type: string;\n id: string;\n label?: string;\n}\n\n/** The facts a package knows about an error it is showing. All optional. */\nexport interface ErrorActionsInput {\n /** The sentence shown. Omit when the words are only in the rendered box. */\n message?: string | undefined;\n title?: string | undefined;\n /** The raw error (code/status/stack stay available to the host). */\n error?: unknown | undefined;\n /** What was being attempted (\"Load saved views\"). */\n operation?: string | undefined;\n records?: readonly ErrorActionsRecord[] | undefined;\n /** The person's input that did not land. */\n unsavedInput?: unknown | undefined;\n /** The package + component that drew it (\"design-system/SavedViewsControl\"). */\n origin?: string | undefined;\n /** Extra structured facts for the AI payload (never shown). */\n details?: Record<string, unknown> | undefined;\n code?: string | number | undefined;\n status?: number | undefined;\n /** The tables / RPCs the failed call used — pins its captured request as the cause. */\n calls?: readonly string[] | undefined;\n /** Where it was drawn: an `ErrorNotice` card/line (\"inline\") or a package alert box (\"alert\", the default). */\n source?: \"inline\" | \"alert\" | undefined;\n}\n\nexport type ErrorActionsRenderer = (input: ErrorActionsInput) => React.ReactNode;\n\n/**\n * ONE context for every copy of this module. tsup builds each entry point\n * (`.`, `./data-table`, …) without code splitting, so this file is inlined into\n * several bundles; a plain `createContext` would give each bundle its own\n * context and the host's provider (imported from `.`) would never reach an\n * error drawn by the data table. The registry key makes them one.\n */\nconst CONTEXT_KEY = Symbol.for(\"@ai-matrx/design-system/error-actions\");\ntype ContextRegistry = Record<symbol, React.Context<ErrorActionsRenderer | null> | undefined>;\nconst registry = globalThis as unknown as ContextRegistry;\nconst ErrorActionsContext: React.Context<ErrorActionsRenderer | null> =\n registry[CONTEXT_KEY] ??\n (registry[CONTEXT_KEY] = React.createContext<ErrorActionsRenderer | null>(null));\n\n/** Mount once at the host's app root; every ErrorBox below renders `render(...)`. */\nexport function ErrorActionsProvider({\n render,\n children,\n}: {\n render: ErrorActionsRenderer;\n children: React.ReactNode;\n}) {\n return (\n <ErrorActionsContext.Provider value={render}>{children}</ErrorActionsContext.Provider>\n );\n}\n\n/**\n * The host's content menu around an error card (`ErrorNotice`): the corner ⋯\n * button and the right-click boundary that show the host's content actions\n * over the error's sentence. Read-only — nothing here may change a record.\n * Without a provider the card draws neither (the actions slot still renders).\n */\nexport interface ErrorCardMenus {\n /** The corner ⋯ button over `{ title, text }`. */\n Button: React.ComponentType<{ title: string; text: string; className?: string }>;\n /** Wraps the whole card so right-click opens the same menu. */\n Boundary: React.ComponentType<{ title: string; text: string; children: React.ReactNode }>;\n}\n\nconst MENUS_KEY = Symbol.for(\"@ai-matrx/design-system/error-card-menus\");\ntype MenusRegistry = Record<symbol, React.Context<ErrorCardMenus | null> | undefined>;\nconst menusRegistry = globalThis as unknown as MenusRegistry;\nconst ErrorCardMenusContext: React.Context<ErrorCardMenus | null> =\n menusRegistry[MENUS_KEY] ??\n (menusRegistry[MENUS_KEY] = React.createContext<ErrorCardMenus | null>(null));\n\n/** Mount once at the host's app root beside `ErrorActionsProvider`. */\nexport function ErrorCardMenusProvider({\n menus,\n children,\n}: {\n menus: ErrorCardMenus;\n children: React.ReactNode;\n}) {\n return <ErrorCardMenusContext.Provider value={menus}>{children}</ErrorCardMenusContext.Provider>;\n}\n\nexport function useErrorCardMenus(): ErrorCardMenus | null {\n return React.useContext(ErrorCardMenusContext);\n}\n\nexport function useErrorActions(): ErrorActionsRenderer | null {\n return React.useContext(ErrorActionsContext);\n}\n\n/**\n * The host's actions for one error, placed wherever the caller puts this\n * element. Renders nothing without a provider. Use inside a box you do not\n * render yourself (the `Alert` family); everything else uses `ErrorBox`.\n */\nexport function ErrorActions(props: ErrorActionsInput) {\n const render = useErrorActions();\n if (!render) return null;\n return <>{render(props)}</>;\n}\n\ntype ErrorBoxTag = \"p\" | \"div\" | \"span\" | \"section\" | \"li\";\n\nexport interface ErrorBoxProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"role\" | \"title\">,\n ErrorActionsInput {\n /** The element drawn — the caller's existing tag, so layout never shifts. */\n as?: ErrorBoxTag;\n}\n\n/** A plain-string body goes through the one funnel (error-sentence.ts); rich children are the caller's. */\nfunction sayable(body: React.ReactNode, error: unknown): React.ReactNode {\n if (typeof body === \"string\") return peopleErrorSentence(error, body);\n if (Array.isArray(body)) return body.map((b) => (typeof b === \"string\" && b.trim() ? peopleErrorSentence(error, b) : b));\n return body;\n}\n\nexport const ErrorBox = React.forwardRef<HTMLElement, ErrorBoxProps>(function ErrorBox(\n {\n as = \"p\",\n message,\n title,\n error,\n operation,\n records,\n unsavedInput,\n origin,\n children,\n ...rest\n },\n ref,\n) {\n // A component type, never a bare ElementType: an app compiling this source may carry global JSX\n // elements (react-three-fiber) that make a bare ElementType's props `never` (2026-10-22).\n const Tag = as as unknown as React.ComponentType<React.HTMLAttributes<HTMLElement> & { ref?: React.Ref<HTMLElement> }>;\n const facts: ErrorActionsInput = {\n ...(message !== undefined ? { message } : {}),\n ...(title !== undefined ? { title } : {}),\n ...(error !== undefined ? { error } : {}),\n ...(operation !== undefined ? { operation } : {}),\n ...(records !== undefined ? { records } : {}),\n ...(unsavedInput !== undefined ? { unsavedInput } : {}),\n ...(origin !== undefined ? { origin } : {}),\n };\n return (\n <Tag ref={ref} role=\"alert\" data-error-box=\"\" {...rest}>\n {sayable(children ?? message, error)}\n <ErrorActions {...facts} />\n </Tag>\n );\n});\n","/**\n * THE error-wording layer. A failure is shown as a cause the person can act on (\"A program it\n * needs isn't installed\"), never as the raw text a process threw (\"spawn uv ENOENT\"). The raw text\n * is kept, whole, as `detail` — the banner offers it behind Copy details and a tooltip, for a bug\n * report or an agent. One table, so every screen and every service says the same thing.\n */\n\nexport interface DescribedError {\n /** One plain sentence: what went wrong and, where it helps, what to do. */\n cause: string;\n /** The raw text, unedited (empty when it would only repeat `cause`). */\n detail: string;\n /** A short machine code when one was recognized (\"ENOENT\", \"TIMEOUT\"). */\n code?: string;\n}\n\ninterface Rule {\n code: string;\n test: RegExp;\n cause: string;\n}\n\n/** Ordered: the first rule whose pattern matches the raw text wins. */\nconst RULES: ReadonlyArray<Rule> = [\n { code: \"ENOENT\", test: /\\b(spawn\\s+\\S+\\s+)?ENOENT\\b|command not found|no such file or directory/i, cause: \"A program or file it needs isn't on this computer. Install it or update Matrx, then try again.\" },\n { code: \"EACCES\", test: /\\bEACCES\\b|\\bEPERM\\b|permission denied|operation not permitted|not authori[sz]ed by the user/i, cause: \"Matrx isn't allowed to do that. Grant access in System Settings › Privacy & Security, then try again.\" },\n { code: \"EADDRINUSE\", test: /\\bEADDRINUSE\\b|address already in use|port .* (is )?(already )?in use/i, cause: \"Another program is already using that port. Stop it, or choose another port.\" },\n { code: \"ECONNREFUSED\", test: /\\bECONNREFUSED\\b|connection refused/i, cause: \"The service isn't answering. It may have stopped; start it again.\" },\n { code: \"OFFLINE\", test: /\\bENOTFOUND\\b|\\bEAI_AGAIN\\b|\\bENETUNREACH\\b|getaddrinfo|network (is )?unreachable|failed to fetch|offline/i, cause: \"Can't reach the internet. Check the connection and try again.\" },\n { code: \"TIMEOUT\", test: /\\bETIMEDOUT\\b|timed? ?out|\\bTIMEOUT\\b|deadline exceeded/i, cause: \"It took too long to answer. Try again in a moment.\" },\n { code: \"ENOSPC\", test: /\\bENOSPC\\b|no space left/i, cause: \"The disk is full. Free some space, then try again.\" },\n { code: \"ENOMEM\", test: /\\bENOMEM\\b|out of memory|cannot allocate memory/i, cause: \"The computer ran out of memory. Close something and try again.\" },\n { code: \"UNAUTHORIZED\", test: /\\b401\\b|unauthori[sz]ed|invalid (api )?key|not signed in|jwt expired|session expired/i, cause: \"You're signed out, or the key was refused. Sign in again.\" },\n { code: \"FORBIDDEN\", test: /\\b403\\b|forbidden/i, cause: \"This account isn't allowed to do that.\" },\n { code: \"NOT_FOUND\", test: /\\b404\\b|not found/i, cause: \"It isn't there any more. Refresh and try again.\" },\n { code: \"RATE_LIMIT\", test: /\\b429\\b|rate.?limit|too many requests/i, cause: \"Too many requests just now. Wait a moment and try again.\" },\n { code: \"SERVER\", test: /\\b5\\d\\d\\b|internal server error|bad gateway|service unavailable/i, cause: \"The server had a problem. Try again in a moment.\" },\n { code: \"EXITED\", test: /exited with code|process exited|crashed|SIGKILL|SIGSEGV|SIGTERM/i, cause: \"The service stopped unexpectedly. Start it again; Copy details if it keeps happening.\" },\n];\n\nconst RAW = /\\b[A-Z]{2,}[A-Z_]*\\b|[\\\\/][\\w.-]+[\\\\/]|\\bat \\S+ \\(|\\{|\\}|errno|stack|undefined|null|\\bspawn\\b/;\n\nfunction rawText(error: unknown): string {\n if (error instanceof Error) return error.message || error.name;\n if (typeof error === \"string\") return error;\n if (error && typeof error === \"object\" && \"message\" in error && typeof (error as { message: unknown }).message === \"string\") {\n return (error as { message: string }).message;\n }\n return \"\";\n}\n\n/**\n * Turn any thrown or returned error into words a person can act on. Already-humane text (a full\n * sentence the app wrote itself, with no codes, paths or stack) passes through unchanged.\n */\nexport function describeError(error: unknown, fallback = \"Something went wrong. Try again.\"): DescribedError {\n const detail = rawText(error).trim();\n if (!detail) return { cause: fallback, detail: \"\" };\n for (const rule of RULES) {\n if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };\n }\n if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: \"\" };\n return { cause: fallback, detail };\n}\n","/**\n * THE SENTENCE A PERSON READS FOR AN ERROR — the one funnel every error surface draws through\n * (ErrorNotice, ErrorBox, the desktop Banner). Raw error text never reaches the screen: no\n * \"TypeError: Failed to fetch\", no `sidebar_conversations:` RPC prefix, no stack frame or file\n * path (Arman, 2026-10-24: notices are small and plain). The raw error still travels to the\n * Alchemy Menu / AI payload through the `error` prop; only the screen gets the sentence.\n *\n * The wording table is desktop/errors.ts `describeError` (one table for every screen); this file\n * adds what decides WHEN a sentence must go through it, narrow enough that an app's own sentence\n * (\"PDF too large\") passes untouched.\n */\nimport { describeError } from \"./desktop/errors\";\n\n/**\n * The sentence an error carries: its own message (string, Error, or any\n * object with a `message`). Empty when it has none.\n */\nexport function errorSentenceOf(error: unknown): string {\n if (error == null || error === true || error === false) return \"\";\n if (typeof error === \"string\") return error;\n if (typeof error !== \"object\") return String(error);\n const message = (error as { message?: unknown }).message;\n return typeof message === \"string\" ? message : \"\";\n}\n\n/**\n * What a person reads when the store cancelled a call at its statement timeout\n * (SQLSTATE 57014). Postgres' own \"canceling statement due to statement\n * timeout\" is about the database, not the person; the cancelled call rolled\n * back, so nothing was written (lane AT-SLOW, 2026-10-19). The same sentence\n * @ai-matrx/records' `TIMED_OUT_MESSAGE` gives.\n */\nexport const TIMED_OUT_SENTENCE = \"That took too long. Nothing was lost; try again.\";\n\n/** What a person reads when an error says nothing a person can use. */\nexport const FALLBACK_ERROR_SENTENCE = \"Something went wrong. Try again.\";\n\n/**\n * A notice CARD's words (the web toast, Matrx 2's floating card): a card is ~22 rem at most and its\n * action shares the row, so a line is a few words (notice-stack.ts NOTICE_TEXT_BUDGET). The same\n * causes as the sentences above, said short enough to fit at the smallest window, never cut by \"…\".\n */\nexport const CARD_ERROR_LINE = {\n OFFLINE: \"No connection\",\n TIMEOUT: \"Took too long. Nothing was lost.\",\n UNAUTHORIZED: \"Signed out. Sign in again.\",\n FORBIDDEN: \"Not allowed for this account\",\n NOT_FOUND: \"Not found. Refresh and retry.\",\n RATE_LIMIT: \"Too many requests. Wait a moment.\",\n SERVER: \"Server problem. Try again soon.\",\n FALLBACK: \"Something went wrong\",\n} as const;\n\n/** True when an error, its code, or its sentence is the store's statement timeout. */\nexport function isTimedOutError(error: unknown, message?: string | null, code?: string | number): boolean {\n if (code === \"57014\" || code === \"timed_out\") return true;\n if (error && typeof error === \"object\") {\n const o = error as { code?: unknown; sqlstate?: unknown };\n if (o.code === \"57014\" || o.code === \"timed_out\" || o.sqlstate === \"57014\") return true;\n }\n const text = `${message ?? \"\"} ${errorSentenceOf(error)}`;\n return /canceling statement due to statement timeout/i.test(text);\n}\n\n/** True when the call failed because the device is offline or the network never answered. */\nexport function isOfflineError(error: unknown, message?: string | null): boolean {\n if (typeof navigator !== \"undefined\" && navigator.onLine === false) return true;\n return offlineText(`${message ?? \"\"} ${errorSentenceOf(error)}`);\n}\n\nfunction offlineText(text: string): boolean {\n const t = text.trim();\n return t !== \"\" && (describeError(t).code === \"OFFLINE\" || /networkerror|network request failed|load failed/i.test(t));\n}\n\n/** describeError's causes that hold on every host (its process codes — ENOENT, EACCES, ports — are\n * the desktop's words for a local program and would mislead on a database refusal). */\nconst ANY_HOST_CODES = new Set([\"OFFLINE\", \"TIMEOUT\", \"UNAUTHORIZED\", \"FORBIDDEN\", \"NOT_FOUND\", \"RATE_LIMIT\", \"SERVER\"]);\n\n/** A leading machine label: `sidebar_conversations: …`, `chat.rpc_name: …`, `[chat-sidebar] …`. */\nconst MACHINE_PREFIX = /^\\s*(?:\\[[\\w./-]+\\]\\s*|[a-z][\\w]*(?:[._][\\w]+)+:\\s+)/;\n/** Text no person should read: JS error class names, stack frames, source paths. */\nconst RAW_TEXT =\n /\\b(?:Type|Reference|Syntax|Range|Internal|Eval|URI)Error\\b|\\bat\\s+[\\w$.<>]+\\s*\\(|\\.(?:[cm]?[jt]sx?|py):\\d+|(?:^|[\\s(])(?:\\/[\\w.@-]+){2,}|\\bundefined is not\\b|\\bcannot read propert(?:y|ies)\\b|\\bis not a function\\b|\\bunexpected token\\b/i;\n\n/** True when a sentence carries raw error text or a code path (what the guard refuses on screen). */\nexport function isRawErrorText(text: string): boolean {\n return MACHINE_PREFIX.test(text) || RAW_TEXT.test(text);\n}\n\n/**\n * `card: true` = the short CARD_ERROR_LINE words for a notice card. Otherwise:\n * the sentence for the screen: the timeout sentence for a statement timeout; a caller's plain\n * sentence as is; a machine label stripped from the front; anything raw or offline worded by\n * `describeError` (its table, else `fallback`).\n */\nexport function peopleErrorSentence(\n error: unknown,\n message?: string | null,\n options: { code?: string | number | undefined; fallback?: string | undefined; card?: boolean | undefined } = {},\n): string {\n const card = options.card === true;\n if (isTimedOutError(error, message, options.code)) return card ? CARD_ERROR_LINE.TIMEOUT : TIMED_OUT_SENTENCE;\n const fallback = options.fallback ?? (card ? CARD_ERROR_LINE.FALLBACK : FALLBACK_ERROR_SENTENCE);\n const raw = message?.trim() || errorSentenceOf(error).trim();\n if (!raw) return fallback;\n let text = raw;\n for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, \"\").trim();\n if (!text) return fallback;\n if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {\n const said = describeError(text, fallback);\n if (!said.code || !ANY_HOST_CODES.has(said.code)) return fallback;\n return card ? CARD_ERROR_LINE[said.code as keyof typeof CARD_ERROR_LINE] : said.cause;\n }\n return text;\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement>;\n\n/**\n * Every lucide glyph carries `lucide-<name>`, the class lucide-react itself renders: THE OPTICAL\n * GLYPH TRIM (tap-target.css) reads the glyph's real air from it, and a caller's own class follows it.\n */\nfunction lucideProps(name: string, { className, ...props }: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n className: className ? `lucide-${name} ${className}` : `lucide-${name}`,\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/**\n * lucide `loader-2` — the spinner glyph. Callers add `matrx-spin`.\n * Never a resting icon: at rest this incomplete arc reads as a broken\n * half-circle. Refresh controls use arrows, then swap to this only while busy.\n */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"loader-circle\", props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-left\", props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-right\", props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-down` — the disclosure's open glyph. */\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-down\", props)}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `trash-2` (moved from @ai-matrx/agents). */\nexport function Trash2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"trash-2\", props)}>\n <path d=\"M10 11v6\" />\n <path d=\"M14 11v6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" />\n <path d=\"M3 6h18\" />\n <path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `archive` — the archived-rows glyph (ArchivedDisclosure). */\nexport function ArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"archive\", props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"ellipsis\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check\", props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-up-down\", props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"external-link\", props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lock\", props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `pencil` — the edit glyph (the table card's Edit action). */\nexport function PencilIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pencil\", props)}>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\n </svg>\n );\n}\n\n/** lucide `message-square` — a row's comments (records-ui SectionCard). */\nexport function MessageSquareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-square\", props)}>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n </svg>\n );\n}\n\n/** lucide `sticky-note` — a row's usage note (records-ui SectionCard). */\nexport function StickyNoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sticky-note\", props)}>\n <path d=\"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M15 3v4a2 2 0 0 0 2 2h4\" />\n </svg>\n );\n}\n\n/** lucide `minus` — the decrease glyph (NumberStepper). */\nexport function MinusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"minus\", props)}>\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"plus\", props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `search` — the magnifier (the `@ai-matrx/design-system/icons` section). */\nexport function SearchIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"search\", props)}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n );\n}\n\n/** lucide `list-filter` — a table's filter button (Mail's and Finder's filter). */\nexport function ListFilterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list-filter\", props)}>\n <path d=\"M3 6h18\" />\n <path d=\"M7 12h10\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `pin` — pinned state (the `@ai-matrx/design-system/icons` section). */\nexport function PinIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pin\", props)}>\n <path d=\"M12 17v5\" />\n <path d=\"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"x\", props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function RadixCheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DividerHorizontalIcon` — the INDETERMINATE checkbox\n * glyph. Radix renders the indicator for both `true` and `\"indeterminate\"`, so\n * a half-selected \"select all\" that shows a full check states something false;\n * the two states get different glyphs on purpose.\n */\nexport function DividerHorizontalIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `DotFilledIcon` — the menu radio-item indicator. */\nexport function DotFilledIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronRightIcon` — the submenu-trigger glyph. */\nexport function RadixChevronRightIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DragHandleDots2Icon` — the grip on `ResizableHandle`.\n * Inlined per C19: this package depends on no icon library.\n */\nexport function DragHandleDots2Icon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M4.5 2.5C5.05228 2.5 5.5 2.05228 5.5 1.5C5.5 0.947715 5.05228 0.5 4.5 0.5C3.94772 0.5 3.5 0.947715 3.5 1.5C3.5 2.05228 3.94772 2.5 4.5 2.5ZM4.5 6.5C5.05228 6.5 5.5 6.05229 5.5 5.5C5.5 4.94771 5.05228 4.5 4.5 4.5C3.94772 4.5 3.5 4.94771 3.5 5.5C3.5 6.05229 3.94772 6.5 4.5 6.5ZM5.5 9.5C5.5 10.0523 5.05228 10.5 4.5 10.5C3.94772 10.5 3.5 10.0523 3.5 9.5C3.5 8.94771 3.94772 8.5 4.5 8.5C5.05228 8.5 5.5 8.94771 5.5 9.5ZM4.5 14.5C5.05228 14.5 5.5 14.0523 5.5 13.5C5.5 12.9477 5.05228 12.5 4.5 12.5C3.94772 12.5 3.5 12.9477 3.5 13.5C3.5 14.0523 3.94772 14.5 4.5 14.5ZM11.5 1.5C11.5 2.05228 11.0523 2.5 10.5 2.5C9.94771 2.5 9.5 2.05228 9.5 1.5C9.5 0.947715 9.94771 0.5 10.5 0.5C11.0523 0.5 11.5 0.947715 11.5 1.5ZM10.5 6.5C11.0523 6.5 11.5 6.05229 11.5 5.5C11.5 4.94771 11.0523 4.5 10.5 4.5C9.94771 4.5 9.5 4.94771 9.5 5.5C9.5 6.05229 9.94771 6.5 10.5 6.5ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94771 10.5 9.5 10.0523 9.5 9.5C9.5 8.94771 9.94771 8.5 10.5 8.5C11.0523 8.5 11.5 8.94771 11.5 9.5ZM10.5 14.5C11.0523 14.5 11.5 14.0523 11.5 13.5C11.5 12.9477 11.0523 12.5 10.5 12.5C9.94771 12.5 9.5 12.9477 9.5 13.5C9.5 14.0523 9.94771 14.5 10.5 14.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** lucide `star` — the saved-organization badge (OrganizationPicker). */\nexport function StarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"star\", props)}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </svg>\n );\n}\n\n/** lucide `building-2` — the organization glyph (OrganizationPicker trigger). */\nexport function Building2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"building-2\", props)}>\n <path d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\" />\n <path d=\"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2\" />\n <path d=\"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2\" />\n <path d=\"M10 6h4\" />\n <path d=\"M10 10h4\" />\n <path d=\"M10 14h4\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `panel-left` — the sidebar toggle glyph. */\nexport function PanelLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-left\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n </svg>\n );\n}\n\n/** lucide `ellipsis-vertical` — a panel's \"more\" menu. */\nexport function MoreVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"ellipsis-vertical\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `maximize-2` — expand a panel. */\nexport function Maximize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"maximize-2\", props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"m21 3-7 7\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M9 21H3v-6\" />\n </svg>\n );\n}\n\n/** lucide `minimize-2` — restore an expanded panel. */\nexport function Minimize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"minimize-2\", props)}>\n <path d=\"m14 10 7-7\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M4 14h6v6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left`. */\nexport function ArrowLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left\", props)}>\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-right`. */\nexport function ArrowRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-right\", props)}>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up` — the swipe deck's up edge. */\nexport function ArrowUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up\", props)}>\n <path d=\"m5 12 7-7 7 7\" />\n <path d=\"M12 19V5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-down` — the swipe deck's down edge. */\nexport function ArrowDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-down\", props)}>\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n );\n}\n\n/** lucide `undo-2` — take back the last change. */\nexport function Undo2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"undo-2\", props)}>\n <path d=\"M9 14 4 9l5-5\" />\n <path d=\"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\" />\n </svg>\n );\n}\n\n/** lucide `eraser` — forget a marked part. */\nexport function EraserIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eraser\", props)}>\n <path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\" />\n <path d=\"M22 21H7\" />\n <path d=\"m5 11 9 9\" />\n </svg>\n );\n}\n\n/** lucide `rotate-cw` — reload. */\nexport function RotateCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rotate-cw\", props)}>\n <path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n </svg>\n );\n}\n\n/** lucide `globe` — a web page with no favicon. */\nexport function GlobeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"globe\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n );\n}\n\n/** lucide `calendar` — the date field's glyph. */\nexport function CalendarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"calendar\", props)}>\n <path d=\"M8 2v4\" />\n <path d=\"M16 2v4\" />\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\" />\n <path d=\"M3 10h18\" />\n </svg>\n );\n}\n\n/** lucide `clock` — the time field's glyph. */\nexport function ClockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"clock\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <polyline points=\"12 6 12 12 16 14\" />\n </svg>\n );\n}\n\n/** lucide `refresh-cw` — retry / reload. */\nexport function RefreshCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"refresh-cw\", props)}>\n <path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" />\n </svg>\n );\n}\n\n/** lucide `triangle-alert` (alias `AlertTriangle`) — an error or warning. */\nexport function AlertTriangleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"triangle-alert\", props)}>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-check` — a passing state. */\nexport function CircleCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-check\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m16 9-5.5 5.5L8 12\" />\n </svg>\n );\n}\n\n/** lucide `circle-question-mark` (alias `CircleHelp`) — field help. */\nexport function CircleHelpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-question-mark\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-x` — a failing state. */\nexport function CircleXIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-x\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m15 9-6 6\" />\n <path d=\"m9 9 6 6\" />\n </svg>\n );\n}\n\n/** lucide `info` — a row label's help glyph (controls `PropertyRow`). */\nexport function InfoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"info\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n );\n}\n\n/** lucide `circle-dot` — the \"Get help from Matrx AI\" button glyph (controls `HelpIcon`). */\nexport function CircleDotIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-dot\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `copy` — the Peek's token chip (copy the exact token). */\nexport function CopyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"copy\", props)}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n/** lucide `upload` (moved from @ai-matrx/media). */\nexport function UploadIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"upload\", props)}>\n <path d=\"M12 3v12\" />\n <path d=\"m17 8-5-5-5 5\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n </svg>\n );\n}\n\n/** lucide `circle-alert` — an error or attention state. */\nexport function CircleAlertIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"circle-alert\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n/** lucide `panel-right` — a side pane toggle. */\nexport function PanelRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-right\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `bell` — notifications. */\nexport function BellIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bell\", props)}>\n <path d=\"M10.268 21a2 2 0 0 0 3.464 0\" />\n <path d=\"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\" />\n </svg>\n );\n}\n\n/** lucide `eye-off` — hidden. */\nexport function EyeOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eye-off\", props)}>\n <path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" />\n <path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" />\n <path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `app-window` — open as a window. */\nexport function AppWindowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"app-window\", props)}>\n <rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\" />\n <path d=\"M10 4v4\" />\n <path d=\"M2 8h20\" />\n <path d=\"M6 4v4\" />\n </svg>\n );\n}\n\n/** lucide `video` — a video call or clip. */\nexport function VideoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"video\", props)}>\n <path d=\"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\" />\n <rect x=\"2\" y=\"6\" width=\"14\" height=\"12\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `phone` — a voice call. */\nexport function PhoneIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"phone\", props)}>\n <path d=\"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\" />\n </svg>\n );\n}\n\n/** lucide `sparkles` — AI. */\nexport function SparklesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sparkles\", props)}>\n <path d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\" />\n <path d=\"M20 2v4\" />\n <path d=\"M22 4h-4\" />\n <circle cx=\"4\" cy=\"20\" r=\"2\" />\n </svg>\n );\n}\n\n/** lucide `panels-top-left` — a layout. */\nexport function PanelsTopLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panels-top-left\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"M9 21V9\" />\n </svg>\n );\n}\n\n/** lucide `download`. */\nexport function DownloadIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"download\", props)}>\n <path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `settings`. */\nexport function SettingsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"settings\", props)}>\n <path d=\"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `users`. */\nexport function UsersIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"users\", props)}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <path d=\"M16 3.128a4 4 0 0 1 0 7.744\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n </svg>\n );\n}\n\n/** lucide `grip-vertical` — a drag handle. */\nexport function GripVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip-vertical\", props)}>\n <circle cx=\"9\" cy=\"12\" r=\"1\" />\n <circle cx=\"9\" cy=\"5\" r=\"1\" />\n <circle cx=\"9\" cy=\"19\" r=\"1\" />\n <circle cx=\"15\" cy=\"12\" r=\"1\" />\n <circle cx=\"15\" cy=\"5\" r=\"1\" />\n <circle cx=\"15\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `history`. */\nexport function HistoryIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"history\", props)}>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" />\n </svg>\n );\n}\n\n/** lucide `workflow`. */\nexport function WorkflowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"workflow\", props)}>\n <rect width=\"8\" height=\"8\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M7 11v4a2 2 0 0 0 2 2h4\" />\n <rect width=\"8\" height=\"8\" x=\"13\" y=\"13\" rx=\"2\" />\n </svg>\n );\n}\n\n// ---- Glyphs consolidated from the packages above the design system (one glyph home). ----\n\n/** lucide `activities` (moved from @ai-matrx/meet). */\nexport function ActivitiesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"activities\", props)}>\n <path d=\"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z\" />\n <rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\" />\n <circle cx=\"17.5\" cy=\"17.5\" r=\"3.5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-down-to-line` (moved from @ai-matrx/agents). */\nexport function ArrowDownToLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-down-to-line\", props)}>\n <path d=\"M12 17V3\" />\n <path d=\"m6 11 6 6 6-6\" />\n <path d=\"M19 21H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left-right` (moved from @ai-matrx/diff). */\nexport function ArrowLeftRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left-right\", props)}>\n <path d=\"M8 3 4 7l4 4\" />\n <path d=\"M4 7h16\" />\n <path d=\"m16 21 4-4-4-4\" />\n <path d=\"M20 17H4\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left-to-line` (moved from @ai-matrx/summon). */\nexport function ArrowLeftToLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-left-to-line\", props)}>\n <path d=\"M3 19V5\" />\n <path d=\"m13 6-6 6 6 6\" />\n <path d=\"M7 12h14\" />\n </svg>\n );\n}\n\n/** lucide `atom` (moved from @ai-matrx/agents). */\nexport function AtomIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"atom\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <path d=\"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z\" />\n <path d=\"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z\" />\n </svg>\n );\n}\n\n/** lucide `audio-lines` (moved from @ai-matrx/content-ir). */\nexport function AudioLinesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"audio-lines\", props)}>\n <path d=\"M2 10v3\" />\n <path d=\"M6 6v11\" />\n <path d=\"M10 3v18\" />\n <path d=\"M14 8v7\" />\n <path d=\"M18 5v13\" />\n <path d=\"M22 10v3\" />\n </svg>\n );\n}\n\n/** lucide `boxes` (moved from @ai-matrx/associations). */\nexport function BoxesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"boxes\", props)}>\n <path d=\"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z\" />\n <path d=\"m7 16.5-4.74-2.85\" />\n <path d=\"m7 16.5 5-3\" />\n <path d=\"M7 16.5v5.17\" />\n <path d=\"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z\" />\n <path d=\"m17 16.5-5-3\" />\n <path d=\"m17 16.5 4.74-2.85\" />\n <path d=\"M17 16.5v5.17\" />\n <path d=\"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z\" />\n <path d=\"M12 8 7.26 5.15\" />\n <path d=\"m12 8 4.74-2.85\" />\n <path d=\"M12 13.5V8\" />\n </svg>\n );\n}\n\n/** lucide `braces` (moved from @ai-matrx/media). */\nexport function BracesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"braces\", props)}>\n <path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\" />\n <path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\" />\n </svg>\n );\n}\n\n/** lucide `breakout` (moved from @ai-matrx/meet). */\nexport function BreakoutIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"breakout\", props)}>\n <rect width=\"7\" height=\"18\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `camera` (moved from @ai-matrx/meet). */\nexport function CameraIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"camera\", props)}>\n <path d=\"m23 7-7 5 7 5V7Z\" />\n <rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `camera-off` (moved from @ai-matrx/meet). */\nexport function CameraOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"camera-off\", props)}>\n <path d=\"M2 2l20 20\" />\n <path d=\"M10.66 5H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2\" />\n </svg>\n );\n}\n\n/** lucide `captions` (moved from @ai-matrx/meet). */\nexport function CaptionsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"captions\", props)}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M16 10.5a2 2 0 1 0 0 3\" />\n </svg>\n );\n}\n\n/** lucide `chat-bubble` (moved from @ai-matrx/coding-sessions). */\nexport function ChatBubbleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chat-bubble\", props)}>\n <path d=\"M20 12.5a7.5 7.5 0 0 1-10.9 6.7L4 20.5l1.3-4.6A7.5 7.5 0 1 1 20 12.5z\" />\n </svg>\n );\n}\n\n/** lucide `chat` (moved from @ai-matrx/meet). */\nexport function ChatIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chat\", props)}>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z\" />\n </svg>\n );\n}\n\n/** lucide `check-circle-2` (moved from @ai-matrx/media). */\nexport function CheckCircle2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check-circle-2\", props)}>\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n </svg>\n );\n}\n\n/** lucide `chevron-up` (moved from @ai-matrx/meet). */\nexport function ChevronUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevron-up\", props)}>\n <path d=\"m6 15 6-6 6 6\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-down-up` (moved from @ai-matrx/diff). */\nexport function ChevronsDownUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-down-up\", props)}>\n <path d=\"m7 20 5-5 5 5\" />\n <path d=\"m7 4 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `clock-3` (moved from @ai-matrx/diff). */\nexport function Clock3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"clock-3\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 6v6h4\" />\n </svg>\n );\n}\n\n/** lucide `code-2` (moved from @ai-matrx/office). */\nexport function Code2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"code-2\", props)}>\n <path d=\"m18 16 4-4-4-4\" />\n <path d=\"m6 8-4 4 4 4\" />\n <path d=\"m14.5 4-5 16\" />\n </svg>\n );\n}\n\n/** lucide `code` (moved from @ai-matrx/media). */\nexport function CodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"code\", props)}>\n <path d=\"m16 18 6-6-6-6\" />\n <path d=\"m8 6-6 6 6 6\" />\n </svg>\n );\n}\n\n/** lucide `columns-2` (moved from @ai-matrx/diff). */\nexport function Columns2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"columns-2\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M12 3v18\" />\n </svg>\n );\n}\n\n/** lucide `corner-down-right` (moved from @ai-matrx/associations). */\nexport function CornerDownRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"corner-down-right\", props)}>\n <polyline points=\"15 10 20 15 15 20\" />\n <path d=\"M4 4v7a4 4 0 0 0 4 4h12\" />\n </svg>\n );\n}\n\n/** lucide `database` (moved from @ai-matrx/media). */\nexport function DatabaseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"database\", props)}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n );\n}\n\n/** lucide `dock` (moved from @ai-matrx/canvas). */\nexport function DockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"dock\", props)}>\n <path d=\"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6\" />\n <path d=\"M21 3 12 12\" />\n <path d=\"M12 6v6h6\" />\n </svg>\n );\n}\n\n/** lucide `expand` (moved from @ai-matrx/detail). */\nexport function ExpandIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"expand\", props)}>\n <path d=\"m15 15 6 6\" />\n <path d=\"m15 9 6-6\" />\n <path d=\"M21 16v5h-5\" />\n <path d=\"M21 8V3h-5\" />\n <path d=\"M3 16v5h5\" />\n <path d=\"m3 21 6-6\" />\n <path d=\"M3 8V3h5\" />\n <path d=\"M9 9 3 3\" />\n </svg>\n );\n}\n\n/** lucide `eye` (moved from @ai-matrx/agents). */\nexport function EyeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"eye\", props)}>\n <path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `file-archive` (moved from @ai-matrx/content-ir). */\nexport function FileArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-archive\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 6h1\" />\n <path d=\"M10 10h1\" />\n <circle cx=\"10\" cy=\"16\" r=\"2\" />\n <path d=\"M10 2v12\" />\n </svg>\n );\n}\n\n/** lucide `file-audio` (moved from @ai-matrx/media). */\nexport function FileAudioIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-audio\", props)}>\n <path d=\"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0\" />\n </svg>\n );\n}\n\n/** lucide `file-code` (moved from @ai-matrx/media). */\nexport function FileCodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-code\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12.5 8 15l2 2.5\" />\n <path d=\"m14 12.5 2 2.5-2 2.5\" />\n </svg>\n );\n}\n\n/** lucide `file-json` (moved from @ai-matrx/media). */\nexport function FileJsonIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-json\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1\" />\n <path d=\"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1\" />\n </svg>\n );\n}\n\n/** lucide `file` (moved from @ai-matrx/media). */\nexport function FilePageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n </svg>\n );\n}\n\n/** lucide `file-plus` (moved from @ai-matrx/content-ir). */\nexport function FilePlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-plus\", props)}>\n <path d=\"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n <path d=\"M3 15h6\" />\n <path d=\"M6 12v6\" />\n </svg>\n );\n}\n\n/** lucide `file-spreadsheet` (moved from @ai-matrx/media). */\nexport function FileSpreadsheetIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-spreadsheet\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M8 13h2\" />\n <path d=\"M14 13h2\" />\n <path d=\"M8 17h2\" />\n <path d=\"M14 17h2\" />\n </svg>\n );\n}\n\n/** lucide `file-text` (moved from @ai-matrx/media). */\nexport function FileTextIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-text\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10 9H8\" />\n <path d=\"M16 13H8\" />\n <path d=\"M16 17H8\" />\n </svg>\n );\n}\n\n/** lucide `file-type` (moved from @ai-matrx/media). */\nexport function FileTypeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-type\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M11 18h2\" />\n <path d=\"M12 12v6\" />\n <path d=\"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5\" />\n </svg>\n );\n}\n\n/** lucide `file-video` (moved from @ai-matrx/media). */\nexport function FileVideoIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"file-video\", props)}>\n <path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z\" />\n </svg>\n );\n}\n\n/** lucide `film` (moved from @ai-matrx/content-ir). */\nexport function FilmIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"film\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M7 3v18\" />\n <path d=\"M3 7.5h4\" />\n <path d=\"M3 12h18\" />\n <path d=\"M3 16.5h4\" />\n <path d=\"M17 3v18\" />\n <path d=\"M17 7.5h4\" />\n <path d=\"M17 16.5h4\" />\n </svg>\n );\n}\n\n/** lucide `flag` (moved from @ai-matrx/meet). */\nexport function FlagIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"flag\", props)}>\n <path d=\"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z\" />\n <line x1=\"4\" x2=\"4\" y1=\"22\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `flip-horizontal-2` (moved from @ai-matrx/capture). */\nexport function FlipHorizontal2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"flip-horizontal-2\", props)}>\n <path d=\"m3 7 5 5-5 5V7\" />\n <path d=\"m21 7-5 5 5 5V7\" />\n <path d=\"M12 20v2\" />\n <path d=\"M12 14v2\" />\n <path d=\"M12 8v2\" />\n <path d=\"M12 2v2\" />\n </svg>\n );\n}\n\n/** lucide `fold-vertical` (moved from @ai-matrx/diff). */\nexport function FoldVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"fold-vertical\", props)}>\n <path d=\"M12 22v-6\" />\n <path d=\"M12 8V2\" />\n <path d=\"M4 12H2\" />\n <path d=\"M10 12H8\" />\n <path d=\"M16 12h-2\" />\n <path d=\"M22 12h-2\" />\n <path d=\"m15 19-3-3-3 3\" />\n <path d=\"m15 5-3 3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `folder` (moved from @ai-matrx/media). */\nexport function FolderIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder\", props)}>\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />\n </svg>\n );\n}\n\n/** lucide `folder-open` (moved from @ai-matrx/media). */\nexport function FolderOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder-open\", props)}>\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `git-merge` (moved from @ai-matrx/diff). */\nexport function GitMergeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"git-merge\", props)}>\n <circle cx=\"18\" cy=\"18\" r=\"3\" />\n <circle cx=\"6\" cy=\"6\" r=\"3\" />\n <path d=\"M6 21V9a9 9 0 0 0 9 9\" />\n </svg>\n );\n}\n\n/** lucide `graduation-cap` (moved from @ai-matrx/office). */\nexport function GraduationCapIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"graduation-cap\", props)}>\n <path d=\"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z\" />\n <path d=\"M22 10v6\" />\n <path d=\"M6 12.5V16a6 3 0 0 0 12 0v-3.5\" />\n </svg>\n );\n}\n\n/** lucide `grid-3x-3` (moved from @ai-matrx/capture). */\nexport function Grid3x3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grid-3x-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"M3 15h18\" />\n <path d=\"M9 3v18\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `grip` (moved from @ai-matrx/capture). */\nexport function GripIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip\", props)}>\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"19\" cy=\"5\" r=\"1\" />\n <circle cx=\"5\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n <circle cx=\"19\" cy=\"19\" r=\"1\" />\n <circle cx=\"5\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `grip-resize` (moved from @ai-matrx/associations). */\nexport function GripResizeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"grip-resize\", props)}>\n <path d=\"M21 15 15 21\" />\n <path d=\"M21 20 20 21\" />\n </svg>\n );\n}\n\n/** lucide `hammer` (moved from @ai-matrx/agents). */\nexport function HammerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hammer\", props)}>\n <path d=\"m15 12-8.5 8.5c-.83.83-2.17.83-3 0 0 0 0 0 0 0a2.12 2.12 0 0 1 0-3L12 9\" />\n <path d=\"M17.64 15 22 10.64\" />\n <path d=\"m20.91 11.7-1.25-1.25c-.6-.6-.93-1.4-.93-2.25v-.86L16.01 4.6a5.56 5.56 0 0 0-3.94-1.64H9l.92.82A6.18 6.18 0 0 1 12 8.4v1.56l2 2h2.47l2.26 1.91\" />\n </svg>\n );\n}\n\n/** lucide `hand` (moved from @ai-matrx/meet). */\nexport function HandIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hand\", props)}>\n <path d=\"M18 11V6a2 2 0 0 0-4 0v5\" />\n <path d=\"M14 10V4a2 2 0 0 0-4 0v7\" />\n <path d=\"M10 10.5V6a2 2 0 0 0-4 0v8\" />\n <path d=\"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2a8 8 0 0 1-8-8v-1a2 2 0 1 1 4 0\" />\n </svg>\n );\n}\n\n/** lucide `handoff` (moved from @ai-matrx/coding-sessions). */\nexport function HandoffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"handoff\", props)}>\n <path d=\"M5 12h12M13 7l5 5-5 5\" />\n <path d=\"M5 5v14\" />\n </svg>\n );\n}\n\n/** lucide `hash` (moved from @ai-matrx/diff). */\nexport function HashIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"hash\", props)}>\n <path d=\"M4 9h16\" />\n <path d=\"M4 15h16\" />\n <path d=\"M10 3 8 21\" />\n <path d=\"M16 3l-2 18\" />\n </svg>\n );\n}\n\n/** lucide `highlighter` (moved from @ai-matrx/diff). */\nexport function HighlighterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"highlighter\", props)}>\n <path d=\"m9 11-6 6v3h9l3-3\" />\n <path d=\"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4\" />\n </svg>\n );\n}\n\n/** lucide `image` (moved from @ai-matrx/media). */\nexport function ImageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"image\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />\n </svg>\n );\n}\n\n/** lucide `image-off` (moved from @ai-matrx/media). */\nexport function ImageOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"image-off\", props)}>\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n <path d=\"M10.41 10.41a2 2 0 1 1-2.83-2.83\" />\n <line x1=\"13.5\" x2=\"6\" y1=\"13.5\" y2=\"21\" />\n <line x1=\"18\" x2=\"21\" y1=\"12\" y2=\"15\" />\n <path d=\"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59\" />\n <path d=\"M21 15V5a2 2 0 0 0-2-2H9\" />\n </svg>\n );\n}\n\n/** lucide `images` (moved from @ai-matrx/capture). */\nexport function ImagesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"images\", props)}>\n <path d=\"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16\" />\n <path d=\"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2\" />\n <circle cx=\"13\" cy=\"7\" r=\"1\" fill=\"currentColor\" />\n <rect x=\"8\" y=\"2\" width=\"14\" height=\"14\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `keyboard` (moved from @ai-matrx/meet). */\nexport function KeyboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"keyboard\", props)}>\n <path d=\"M10 8h.01M12 12h.01M14 8h.01M16 12h.01M18 8h.01M6 8h.01M7 16h10M8 12h.01\" />\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `languages` (moved from @ai-matrx/agents). */\nexport function LanguagesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"languages\", props)}>\n <path d=\"m5 8 6 6\" />\n <path d=\"m4 14 6-6 2-3\" />\n <path d=\"M2 5h12\" />\n <path d=\"M7 2h1\" />\n <path d=\"m22 22-5-10-5 10\" />\n <path d=\"M14 18h6\" />\n </svg>\n );\n}\n\n/** lucide `layers` (moved from @ai-matrx/agents). */\nexport function LayersIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layers\", props)}>\n <path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" />\n <path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" />\n <path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" />\n </svg>\n );\n}\n\n/** lucide `layout-grid` (moved from @ai-matrx/canvas). */\nexport function LayoutGridIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layout-grid\", props)}>\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `link-2` (moved from @ai-matrx/media). */\nexport function Link2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link-2\", props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7h2\" />\n <path d=\"M15 7h2a5 5 0 1 1 0 10h-2\" />\n <line x1=\"8\" x2=\"16\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n/** lucide `list-checks` (moved from @ai-matrx/diff). */\nexport function ListChecksIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list-checks\", props)}>\n <path d=\"m3 17 2 2 4-4\" />\n <path d=\"m3 7 2 2 4-4\" />\n <path d=\"M13 6h8\" />\n <path d=\"M13 12h8\" />\n <path d=\"M13 18h8\" />\n </svg>\n );\n}\n\n/** lucide `list` (moved from @ai-matrx/diff). */\nexport function ListIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"list\", props)}>\n <path d=\"M3 12h.01\" />\n <path d=\"M3 18h.01\" />\n <path d=\"M3 6h.01\" />\n <path d=\"M8 12h13\" />\n <path d=\"M8 18h13\" />\n <path d=\"M8 6h13\" />\n </svg>\n );\n}\n\n/** lucide `maximize` (moved from @ai-matrx/content-ir). */\nexport function MaximizeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"maximize\", props)}>\n <polyline points=\"15 3 21 3 21 9\" />\n <polyline points=\"9 21 3 21 3 15\" />\n <line x1=\"21\" x2=\"14\" y1=\"3\" y2=\"10\" />\n <line x1=\"3\" x2=\"10\" y1=\"21\" y2=\"14\" />\n </svg>\n );\n}\n\n/** lucide `megaphone` (moved from @ai-matrx/office). */\nexport function MegaphoneIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"megaphone\", props)}>\n <path d=\"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z\" />\n <path d=\"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14\" />\n <path d=\"M8 6v8\" />\n </svg>\n );\n}\n\n/** lucide `message-square-warning` (moved from @ai-matrx/office). */\nexport function MessageSquareWarningIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-square-warning\", props)}>\n <path d=\"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\" />\n <path d=\"M12 15h.01\" />\n <path d=\"M12 7v4\" />\n </svg>\n );\n}\n\n/** lucide `mic` (moved from @ai-matrx/meet). */\nexport function MicIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mic\", props)}>\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\" />\n <path d=\"M12 19v3\" />\n </svg>\n );\n}\n\n/** lucide `mic-off` (moved from @ai-matrx/meet). */\nexport function MicOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mic-off\", props)}>\n <path d=\"M2 2l20 20\" />\n <path d=\"M9 9v3a3 3 0 0 0 5.12 2.12\" />\n <path d=\"M15 9.34V5a3 3 0 0 0-5.94-.6\" />\n <path d=\"M19 10v2a7 7 0 0 1-.11 1.23M5 10v2a7 7 0 0 0 11 5.66\" />\n <path d=\"M12 19v3\" />\n </svg>\n );\n}\n\n/** lucide `monitor` (moved from @ai-matrx/coding-sessions). */\nexport function MonitorIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"monitor\", props)}>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8.5 20h7M12 16.5V20\" />\n </svg>\n );\n}\n\n/** lucide `moon` (moved from @ai-matrx/coding-sessions). */\nexport function MoonIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"moon\", props)}>\n <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z\" />\n </svg>\n );\n}\n\n/** lucide `music` (moved from @ai-matrx/media). */\nexport function MusicIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"music\", props)}>\n <path d=\"M9 18V5l12-2v13\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" />\n <circle cx=\"18\" cy=\"16\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `notes` (moved from @ai-matrx/meet). */\nexport function NotesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"notes\", props)}>\n <path d=\"M4 20l1-4L16.5 4.5a2.1 2.1 0 0 1 3 3L8 19l-4 1Z\" />\n <path d=\"M14 7l3 3\" />\n </svg>\n );\n}\n\n/** lucide `package-box` (moved from @ai-matrx/media). */\nexport function PackageBoxIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"package-box\", props)}>\n <path d=\"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z\" />\n <path d=\"M12 22V12\" />\n <polyline points=\"3.29 7 12 12 20.71 7\" />\n <path d=\"m7.5 4.27 9 5.15\" />\n </svg>\n );\n}\n\n/** lucide `page` (moved from @ai-matrx/canvas). */\nexport function PageIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"page\", props)}>\n <rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\" />\n <path d=\"M8 9h8\" />\n <path d=\"M8 13h8\" />\n <path d=\"M8 17h5\" />\n </svg>\n );\n}\n\n/** lucide `panel-left-close` (moved from @ai-matrx/summon). */\nexport function PanelLeftCloseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-left-close\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m16 15-3-3 3-3\" />\n </svg>\n );\n}\n\n/** lucide `pause` (moved from @ai-matrx/media). */\nexport function PauseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pause\", props)}>\n <rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n <rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `pen-tool` (moved from @ai-matrx/media). */\nexport function PenToolIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"pen-tool\", props)}>\n <path d=\"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z\" />\n <path d=\"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18\" />\n <path d=\"m2.3 2.3 7.286 7.286\" />\n <circle cx=\"11\" cy=\"11\" r=\"2\" />\n </svg>\n );\n}\n\n/** lucide `people` (moved from @ai-matrx/meet). */\nexport function PeopleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"people\", props)}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n );\n}\n\n/** lucide `phone-off` (moved from @ai-matrx/meet). */\nexport function PhoneOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"phone-off\", props)}>\n <path d=\"M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08a.99.99 0 0 1-.29-.7c0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28a11.27 11.27 0 0 0-2.67-1.85.996.996 0 0 1-.56-.9v-3.1C15.15 9.25 13.6 9 12 9Z\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `play` (moved from @ai-matrx/media). */\nexport function PlayIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"play\", props)}>\n <path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />\n </svg>\n );\n}\n\n/** lucide `poll` (moved from @ai-matrx/meet). */\nexport function PollIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"poll\", props)}>\n <line x1=\"18\" x2=\"18\" y1=\"20\" y2=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"20\" y2=\"4\" />\n <line x1=\"6\" x2=\"6\" y1=\"20\" y2=\"14\" />\n </svg>\n );\n}\n\n/** lucide `proportions` (moved from @ai-matrx/capture). */\nexport function ProportionsIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"proportions\", props)}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"M12 9v11\" />\n <path d=\"M2 9h13a2 2 0 0 1 2 2v9\" />\n </svg>\n );\n}\n\n/** lucide `puzzle` (moved from @ai-matrx/office). */\nexport function PuzzleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"puzzle\", props)}>\n <path d=\"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z\" />\n </svg>\n );\n}\n\n/** lucide `question` (moved from @ai-matrx/meet). */\nexport function QuestionIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"question\", props)}>\n <path d=\"M7.9 20A9 9 0 1 0 4 16.1L2 22Z\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** lucide `record` (moved from @ai-matrx/meet). */\nexport function RecordIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"record\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"8\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `rectangle-vertical` (moved from @ai-matrx/summon). */\nexport function RectangleVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rectangle-vertical\", props)}>\n <rect width=\"12\" height=\"20\" x=\"6\" y=\"2\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `restore` (moved from @ai-matrx/associations). */\nexport function RestoreIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"restore\", props)}>\n <path d=\"M4 14h6v6\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"M14 10l7-7\" />\n <path d=\"M3 21l7-7\" />\n </svg>\n );\n}\n\n/** lucide `rotate-ccw` (moved from @ai-matrx/capture). */\nexport function RotateCcwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rotate-ccw\", props)}>\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n );\n}\n\n/** lucide `rows-3` (moved from @ai-matrx/diff). */\nexport function Rows3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rows-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M21 9H3\" />\n <path d=\"M21 15H3\" />\n </svg>\n );\n}\n\n/** lucide `save` (moved from @ai-matrx/summon). */\nexport function SaveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"save\", props)}>\n <path d=\"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\" />\n <path d=\"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7\" />\n <path d=\"M7 3v4a1 1 0 0 0 1 1h7\" />\n </svg>\n );\n}\n\n/** lucide `scale` (moved from @ai-matrx/agents). */\nexport function ScaleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"scale\", props)}>\n <path d=\"M12 3v18\" />\n <path d=\"m19 8 3 8a5 5 0 0 1-6 0zV7\" />\n <path d=\"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1\" />\n <path d=\"m5 8 3 8a5 5 0 0 1-6 0zV7\" />\n <path d=\"M7 21h10\" />\n </svg>\n );\n}\n\n/** lucide `screen-share` (moved from @ai-matrx/meet). */\nexport function ScreenShareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"screen-share\", props)}>\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" />\n <path d=\"M8 21h8M12 17v4\" />\n <path d=\"M12 13V8m0 0-2.5 2.5M12 8l2.5 2.5\" />\n </svg>\n );\n}\n\n/** lucide `server` (moved from @ai-matrx/agents). */\nexport function ServerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"server\", props)}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n );\n}\n\n/** lucide `settings-2` (moved from @ai-matrx/media). */\nexport function Settings2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"settings-2\", props)}>\n <path d=\"M20 7h-9\" />\n <path d=\"M14 17H5\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `share-2` (moved from @ai-matrx/media). */\nexport function Share2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"share-2\", props)}>\n <circle cx=\"18\" cy=\"5\" r=\"3\" />\n <circle cx=\"6\" cy=\"12\" r=\"3\" />\n <circle cx=\"18\" cy=\"19\" r=\"3\" />\n <line x1=\"8.59\" x2=\"15.42\" y1=\"13.51\" y2=\"17.49\" />\n <line x1=\"15.41\" x2=\"8.59\" y1=\"6.51\" y2=\"10.49\" />\n </svg>\n );\n}\n\n/** lucide `shield-alert` (moved from @ai-matrx/detail). */\nexport function ShieldAlertIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-alert\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n </svg>\n );\n}\n\n/** lucide `shield-check` (moved from @ai-matrx/detail). */\nexport function ShieldCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-check\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n\n/** lucide `badge-check` — the verified mark. */\nexport function BadgeCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"badge-check\", props)}>\n <path d=\"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n\n/** lucide `shield` (moved from @ai-matrx/agents). */\nexport function ShieldIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield\", props)}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n );\n}\n\n/** lucide `sidebar` (moved from @ai-matrx/coding-sessions). */\nexport function SidebarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sidebar\", props)}>\n <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2.5\" />\n <path d=\"M9.5 4.5v15\" />\n </svg>\n );\n}\n\n/** lucide `sliders-horizontal` (moved from @ai-matrx/agents). */\nexport function SlidersHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sliders-horizontal\", props)}>\n <path d=\"M10 5H3\" />\n <path d=\"M12 19H3\" />\n <path d=\"M14 3v4\" />\n <path d=\"M16 17v4\" />\n <path d=\"M21 12h-9\" />\n <path d=\"M21 19h-5\" />\n <path d=\"M21 5h-7\" />\n <path d=\"M8 10v4\" />\n <path d=\"M8 12H3\" />\n </svg>\n );\n}\n\n/** lucide `smile` (moved from @ai-matrx/meet). */\nexport function SmileIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"smile\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M8 14s1.5 2 4 2 4-2 4-2\" />\n <line x1=\"9\" x2=\"9.01\" y1=\"9\" y2=\"9\" />\n <line x1=\"15\" x2=\"15.01\" y1=\"9\" y2=\"9\" />\n </svg>\n );\n}\n\n/** lucide `speaker` (moved from @ai-matrx/meet). */\nexport function SpeakerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"speaker\", props)}>\n <path d=\"M11 5 6 9H2v6h4l5 4V5Z\" />\n <path d=\"M15.54 8.46a5 5 0 0 1 0 7.07\" />\n <path d=\"M19.07 4.93a10 10 0 0 1 0 14.14\" />\n </svg>\n );\n}\n\n/** lucide `split-down` (moved from @ai-matrx/canvas). */\nexport function SplitDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"split-down\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 12h18\" />\n </svg>\n );\n}\n\n/** lucide `spotlight` (moved from @ai-matrx/meet). */\nexport function SpotlightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"spotlight\", props)}>\n <path d=\"M12 2 15 8.5 22 9.3 17 14 18.2 21 12 17.6 5.8 21 7 14 2 9.3 9 8.5Z\" />\n </svg>\n );\n}\n\n/** lucide `stop` (moved from @ai-matrx/coding-sessions). */\nexport function StopIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"stop\", props)}>\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n );\n}\n\n/** lucide `subtitles` (moved from @ai-matrx/media). */\nexport function SubtitlesIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"subtitles\", props)}>\n <rect width=\"18\" height=\"14\" x=\"3\" y=\"5\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 15h4M15 15h2M7 11h2M13 11h4\" />\n </svg>\n );\n}\n\n/** lucide `sun` (moved from @ai-matrx/coding-sessions). */\nexport function SunIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sun\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2.5v2M12 19.5v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M2.5 12h2M19.5 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4\" />\n </svg>\n );\n}\n\n/** lucide `sun-medium` (moved from @ai-matrx/capture). */\nexport function SunMediumIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sun-medium\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 3v1\" />\n <path d=\"M12 20v1\" />\n <path d=\"M3 12h1\" />\n <path d=\"M20 12h1\" />\n <path d=\"m18.364 5.636-.707.707\" />\n <path d=\"m6.343 17.657-.707.707\" />\n <path d=\"m5.636 5.636.707.707\" />\n <path d=\"m17.657 17.657.707.707\" />\n </svg>\n );\n}\n\n/** lucide `tag` (moved from @ai-matrx/associations). */\nexport function TagIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"tag\", props)}>\n <path d=\"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z\" />\n <circle cx=\"7.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\" />\n </svg>\n );\n}\n\n/** lucide `timer` (moved from @ai-matrx/capture). */\nexport function TimerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"timer\", props)}>\n <line x1=\"10\" x2=\"14\" y1=\"2\" y2=\"2\" />\n <line x1=\"12\" x2=\"15\" y1=\"14\" y2=\"11\" />\n <circle cx=\"12\" cy=\"14\" r=\"8\" />\n </svg>\n );\n}\n\n/** lucide `type` (moved from @ai-matrx/agents). */\nexport function TypeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"type\", props)}>\n <path d=\"M12 4v16\" />\n <path d=\"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2\" />\n <path d=\"M9 20h6\" />\n </svg>\n );\n}\n\n/** lucide `unfold-vertical` (moved from @ai-matrx/diff). */\nexport function UnfoldVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"unfold-vertical\", props)}>\n <path d=\"M12 22v-6\" />\n <path d=\"M12 8V2\" />\n <path d=\"M4 12H2\" />\n <path d=\"M10 12H8\" />\n <path d=\"M16 12h-2\" />\n <path d=\"M22 12h-2\" />\n <path d=\"m15 19-3 3-3-3\" />\n <path d=\"m15 5-3-3-3 3\" />\n </svg>\n );\n}\n\n/** lucide `unlink` (moved from @ai-matrx/agents). */\nexport function UnlinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"unlink\", props)}>\n <path d=\"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" />\n <path d=\"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" />\n <line x1=\"8\" x2=\"8\" y1=\"2\" y2=\"5\" />\n <line x1=\"2\" x2=\"5\" y1=\"8\" y2=\"8\" />\n <line x1=\"16\" x2=\"16\" y1=\"19\" y2=\"22\" />\n <line x1=\"19\" x2=\"22\" y1=\"16\" y2=\"16\" />\n </svg>\n );\n}\n\n/** lucide `upvote` (moved from @ai-matrx/meet). */\nexport function UpvoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"upvote\", props)}>\n <path d=\"M9 18v-6H5l7-7 7 7h-4v6H9z\" />\n </svg>\n );\n}\n\n/** lucide `variable` (moved from @ai-matrx/agents). */\nexport function VariableIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"variable\", props)}>\n <path d=\"M8 21s-4-3-4-9 4-9 4-9\" />\n <path d=\"M16 3s4 3 4 9-4 9-4 9\" />\n <line x1=\"15\" x2=\"9\" y1=\"9\" y2=\"15\" />\n <line x1=\"9\" x2=\"15\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `video-off` (moved from @ai-matrx/media). */\nexport function VideoOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"video-off\", props)}>\n <path d=\"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196\" />\n <path d=\"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `volume-x` (moved from @ai-matrx/media). */\nexport function VolumeXIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"volume-x\", props)}>\n <path d=\"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\" />\n <line x1=\"22\" x2=\"16\" y1=\"9\" y2=\"15\" />\n <line x1=\"16\" x2=\"22\" y1=\"9\" y2=\"15\" />\n </svg>\n );\n}\n\n/** lucide `webhook` (moved from @ai-matrx/agents). */\nexport function WebhookIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"webhook\", props)}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n );\n}\n\n/** lucide `whiteboard` (moved from @ai-matrx/meet). */\nexport function WhiteboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"whiteboard\", props)}>\n <path d=\"M2 3h20\" />\n <path d=\"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3\" />\n <path d=\"m7 21 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `wifi-low` (moved from @ai-matrx/meet). */\nexport function WifiLowIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wifi-low\", props)}>\n <path d=\"M12 20h.01\" />\n <path d=\"M8.5 16.5a5 5 0 0 1 7 0\" />\n </svg>\n );\n}\n\n/** lucide `wrap-text` (moved from @ai-matrx/diff). */\nexport function WrapTextIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wrap-text\", props)}>\n <path d=\"M3 6h18\" />\n <path d=\"M3 12h15a3 3 0 1 1 0 6h-4\" />\n <path d=\"m16 16-2 2 2 2\" />\n <path d=\"M3 18h7\" />\n </svg>\n );\n}\n\n/** lucide `wrench` (moved from @ai-matrx/agents). */\nexport function WrenchIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"wrench\", props)}>\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z\" />\n </svg>\n );\n}\n\n/** lucide `youtube` (moved from @ai-matrx/agents). */\nexport function YoutubeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"youtube\", props)}>\n <path d=\"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17\" />\n <path d=\"m10 15 5-3-5-3z\" />\n </svg>\n );\n}\n\n/** lucide `zap` (moved from @ai-matrx/capture). */\nexport function ZapIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"zap\", props)}>\n <path d=\"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\" />\n </svg>\n );\n}\n\n/** lucide `zap-off` (moved from @ai-matrx/capture). */\nexport function ZapOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"zap-off\", props)}>\n <path d=\"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317\" />\n <path d=\"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773\" />\n <path d=\"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `log-in` — the sign-in action of the auth gate. */\nexport function LogInIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"log-in\", props)}>\n <path d=\"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4\" />\n <polyline points=\"10 17 15 12 10 7\" />\n <line x1=\"15\" x2=\"3\" y1=\"12\" y2=\"12\" />\n </svg>\n );\n}\n\n/** lucide `gem` — the create-account action of the auth gate. */\nexport function GemIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"gem\", props)}>\n <path d=\"M6 3h12l4 6-10 13L2 9Z\" />\n <path d=\"M11 3 8 9l4 13 4-13-3-6\" />\n <path d=\"M2 9h20\" />\n </svg>\n );\n}\n\n/** lucide `key`. */\nexport function KeyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"key\", props)}>\n <path d=\"m2 21 9.6-9.6\" />\n <path d=\"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19\" />\n <circle cx=\"15.5\" cy=\"7.5\" r=\"5.5\" />\n </svg>\n );\n}\n\n/** lucide `credit-card`. */\nexport function CreditCardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"credit-card\", props)}>\n <rect width=\"20\" height=\"14\" x=\"2\" y=\"5\" rx=\"2\" />\n <line x1=\"2\" x2=\"22\" y1=\"10\" y2=\"10\" />\n <path d=\"M6 14h2\" />\n </svg>\n );\n}\n\n/** lucide `user-round`. */\nexport function UserRoundIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"user-round\", props)}>\n <circle cx=\"12\" cy=\"8\" r=\"5\" />\n <path d=\"M20 21a8 8 0 0 0-16 0\" />\n </svg>\n );\n}\n\n/** lucide `user`. */\nexport function UserIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"user\", props)}>\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n );\n}\n\n/** lucide `terminal`. */\nexport function TerminalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"terminal\", props)}>\n <path d=\"M12 19h8\" />\n <path d=\"m4 17 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `trash`. */\nexport function TrashIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"trash\", props)}>\n <path d=\"M10 11v6\" />\n <path d=\"M14 11v6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" />\n <path d=\"M3 6h18\" />\n <path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />\n </svg>\n );\n}\n\n/** lucide `building`. */\nexport function BuildingIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"building\", props)}>\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3\" />\n <rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `plug`. */\nexport function PlugIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"plug\", props)}>\n <path d=\"M12 22v-5\" />\n <path d=\"M15 8V2\" />\n <path d=\"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z\" />\n <path d=\"M9 8V2\" />\n </svg>\n );\n}\n\n/** lucide `share`. */\nexport function ShareIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"share\", props)}>\n <path d=\"M12 2v13\" />\n <path d=\"m16 6-4-4-4 4\" />\n <path d=\"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-down`. */\nexport function ArrowUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-down\", props)}>\n <path d=\"m21 16-4 4-4-4\" />\n <path d=\"M17 20V4\" />\n <path d=\"m3 8 4-4 4 4\" />\n <path d=\"M7 4v16\" />\n </svg>\n );\n}\n\n/** lucide `move`. */\nexport function MoveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"move\", props)}>\n <path d=\"M12 2v20\" />\n <path d=\"m15 19-3 3-3-3\" />\n <path d=\"m19 9 3 3-3 3\" />\n <path d=\"M2 12h20\" />\n <path d=\"m5 9-3 3 3 3\" />\n <path d=\"m9 5 3-3 3 3\" />\n </svg>\n );\n}\n\n/** lucide `qr-code`. */\nexport function QrCodeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"qr-code\", props)}>\n <rect width=\"5\" height=\"5\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"5\" height=\"5\" x=\"16\" y=\"3\" rx=\"1\" />\n <rect width=\"5\" height=\"5\" x=\"3\" y=\"16\" rx=\"1\" />\n <path d=\"M21 16h-3a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 21v.01\" />\n <path d=\"M12 7v3a2 2 0 0 1-2 2H7\" />\n <path d=\"M3 12h.01\" />\n <path d=\"M12 3h.01\" />\n <path d=\"M12 16v.01\" />\n <path d=\"M16 12h1\" />\n <path d=\"M21 12v.01\" />\n <path d=\"M12 21v-1\" />\n </svg>\n );\n}\n\n/** lucide `power`. */\nexport function PowerIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"power\", props)}>\n <path d=\"M12 2v10\" />\n <path d=\"M18.4 6.6a9 9 0 1 1-12.77.04\" />\n </svg>\n );\n}\n\n/** lucide `sliders-vertical`. */\nexport function SlidersVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"sliders-vertical\", props)}>\n <path d=\"M10 8h4\" />\n <path d=\"M12 21v-9\" />\n <path d=\"M12 8V3\" />\n <path d=\"M17 16h4\" />\n <path d=\"M19 12V3\" />\n <path d=\"M19 21v-5\" />\n <path d=\"M3 14h4\" />\n <path d=\"M5 10V3\" />\n <path d=\"M5 21v-7\" />\n </svg>\n );\n}\n\n/** lucide `fingerprint-pattern`. */\nexport function FingerprintPatternIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"fingerprint-pattern\", props)}>\n <path d=\"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4\" />\n <path d=\"M14 13.12c0 2.38 0 6.38-1 8.88\" />\n <path d=\"M17.29 21.02c.12-.6.43-2.3.5-3.02\" />\n <path d=\"M2 12a10 10 0 0 1 18-6\" />\n <path d=\"M2 16h.01\" />\n <path d=\"M21.8 16c.2-2 .131-5.354 0-6\" />\n <path d=\"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2\" />\n <path d=\"M8.65 22c.21-.66.45-1.32.57-2\" />\n <path d=\"M9 6.8a6 6 0 0 1 9 5.2v2\" />\n </svg>\n );\n}\n\n/** lucide `send`. */\nexport function SendIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"send\", props)}>\n <path d=\"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\" />\n <path d=\"m21.854 2.147-10.94 10.939\" />\n </svg>\n );\n}\n\n/** lucide `paperclip`. */\nexport function PaperclipIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"paperclip\", props)}>\n <path d=\"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\" />\n </svg>\n );\n}\n\n/** lucide `check-check`. */\nexport function CheckCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"check-check\", props)}>\n <path d=\"M18 6 7 17l-5-5\" />\n <path d=\"m22 10-7.5 7.5L13 16\" />\n </svg>\n );\n}\n\n/** lucide `reply`. */\nexport function ReplyIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"reply\", props)}>\n <path d=\"M20 18v-2a4 4 0 0 0-4-4H4\" />\n <path d=\"m9 17-5-5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `link`. */\nexport function LinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link\", props)}>\n <path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n <path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n </svg>\n );\n}\n\n/** lucide `bot`. */\nexport function BotIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bot\", props)}>\n <path d=\"M12 8V4H8\" />\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\" />\n <path d=\"M2 14h2\" />\n <path d=\"M20 14h2\" />\n <path d=\"M15 13v2\" />\n <path d=\"M9 13v2\" />\n </svg>\n );\n}\n\n/** lucide `bell-off`. */\nexport function BellOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"bell-off\", props)}>\n <path d=\"M10.268 21a2 2 0 0 0 3.464 0\" />\n <path d=\"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742\" />\n <path d=\"m2 2 20 20\" />\n <path d=\"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05\" />\n </svg>\n );\n}\n\n/** lucide `mail`. */\nexport function MailIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mail\", props)}>\n <path d=\"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7\" />\n <rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\" />\n </svg>\n );\n}\n\n/** lucide `mail-open`. */\nexport function MailOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"mail-open\", props)}>\n <path d=\"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z\" />\n <path d=\"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10\" />\n </svg>\n );\n}\n\n/** lucide `folder-input`. */\nexport function FolderInputIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"folder-input\", props)}>\n <path d=\"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1\" />\n <path d=\"M2 13h10\" />\n <path d=\"m9 16 3-3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `star-off`. */\nexport function StarOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"star-off\", props)}>\n <path d=\"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152\" />\n <path d=\"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099\" />\n <path d=\"m2 2 20 20\" />\n </svg>\n );\n}\n\n/** lucide `columns-3`. */\nexport function Columns3Icon(props: IconProps) {\n return (\n <svg {...lucideProps(\"columns-3\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n\n/** lucide `blocks`. */\nexport function BlocksIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"blocks\", props)}>\n <path d=\"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2\" />\n <rect x=\"14\" y=\"2\" width=\"8\" height=\"8\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `calendar-clock`. */\nexport function CalendarClockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"calendar-clock\", props)}>\n <path d=\"M16 14v2.2l1.6 1\" />\n <path d=\"M16 2v3\" />\n <path d=\"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338\" />\n <path d=\"M3 9h5.859\" />\n <path d=\"M8 2v3\" />\n <circle cx=\"16\" cy=\"16\" r=\"6\" />\n </svg>\n );\n}\n\n/** lucide `door-open`. */\nexport function DoorOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"door-open\", props)}>\n <path d=\"M10 21H2\" />\n <path d=\"M10 3H7a2 2 0 00-2 2v16\" />\n <path d=\"M14 12h.01\" />\n <path d=\"M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z\" />\n <path d=\"M22 21h-3\" />\n </svg>\n );\n}\n\n/** lucide `inbox`. */\nexport function InboxIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"inbox\", props)}>\n <polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </svg>\n );\n}\n\n/** lucide `layout-dashboard`. */\nexport function LayoutDashboardIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"layout-dashboard\", props)}>\n <rect width=\"7\" height=\"9\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"5\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"9\" x=\"14\" y=\"12\" rx=\"1\" />\n <rect width=\"7\" height=\"5\" x=\"3\" y=\"16\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `archive-restore`. */\nexport function ArchiveRestoreIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"archive-restore\", props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h2\" />\n <path d=\"M20 8v11a2 2 0 0 1-2 2h-2\" />\n <path d=\"m9 15 3-3 3 3\" />\n <path d=\"M12 12v9\" />\n </svg>\n );\n}\n\n/** lucide `split`. */\nexport function SplitIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"split\", props)}>\n <path d=\"M16 3h5v5\" />\n <path d=\"M8 3H3v5\" />\n <path d=\"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3\" />\n <path d=\"m15 9 6-6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-from-line`. */\nexport function ArrowUpFromLineIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-from-line\", props)}>\n <path d=\"m18 9-6-6-6 6\" />\n <path d=\"M12 3v14\" />\n <path d=\"M5 21h14\" />\n </svg>\n );\n}\n\n/** lucide `lock-open`. */\nexport function LockOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lock-open\", props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 9.9-1\" />\n </svg>\n );\n}\n\n/** lucide `printer`. */\nexport function PrinterIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"printer\", props)}>\n <path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\" />\n <path d=\"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6\" />\n <rect x=\"6\" y=\"14\" width=\"12\" height=\"8\" rx=\"1\" />\n </svg>\n );\n}\n\n/** lucide `rocket`. */\nexport function RocketIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"rocket\", props)}>\n <path d=\"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5\" />\n <path d=\"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09\" />\n <path d=\"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z\" />\n <path d=\"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05\" />\n </svg>\n );\n}\n\n/** lucide `message-circle`. */\nexport function MessageCircleIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"message-circle\", props)}>\n <path d=\"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\" />\n </svg>\n );\n}\n\n/** lucide `copy-plus`. */\nexport function CopyPlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"copy-plus\", props)}>\n <line x1=\"15\" x2=\"15\" y1=\"12\" y2=\"18\" />\n <line x1=\"12\" x2=\"18\" y1=\"15\" y2=\"15\" />\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n );\n}\n\n/** lucide `map-pin`. */\nexport function MapPinIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"map-pin\", props)}>\n <path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" />\n <circle cx=\"12\" cy=\"10\" r=\"3\" />\n </svg>\n );\n}\n\n/** lucide `at-sign`. */\nexport function AtSignIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"at-sign\", props)}>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8\" />\n </svg>\n );\n}\n\n/** lucide `link-2-off`. */\nexport function Link2OffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"link-2-off\", props)}>\n <path d=\"M9 17H7A5 5 0 0 1 7 7\" />\n <path d=\"M15 7h2a5 5 0 0 1 4 8\" />\n <line x1=\"8\" x2=\"12\" y1=\"12\" y2=\"12\" />\n <line x1=\"2\" x2=\"22\" y1=\"2\" y2=\"22\" />\n </svg>\n );\n}\n\n/** lucide `whole-word`. */\nexport function WholeWordIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"whole-word\", props)}>\n <circle cx=\"7\" cy=\"12\" r=\"3\" />\n <path d=\"M10 9v6\" />\n <circle cx=\"17\" cy=\"12\" r=\"3\" />\n <path d=\"M14 7v8\" />\n <path d=\"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1\" />\n </svg>\n );\n}\n\n/** lucide `lightbulb`. */\nexport function LightbulbIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"lightbulb\", props)}>\n <path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" />\n <path d=\"M9 18h6\" />\n <path d=\"M10 22h4\" />\n </svg>\n );\n}\n\n/** lucide `shield-off`. */\nexport function ShieldOffIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"shield-off\", props)}>\n <path d=\"m2 2 20 20\" />\n <path d=\"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71\" />\n <path d=\"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-left`. */\nexport function ChevronsLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-left\", props)}>\n <path d=\"m11 17-5-5 5-5\" />\n <path d=\"m18 17-5-5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-right`. */\nexport function ChevronsRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-right\", props)}>\n <path d=\"m6 17 5-5-5-5\" />\n <path d=\"m13 17 5-5-5-5\" />\n </svg>\n );\n}\n\n/** lucide `users-round`. */\nexport function UsersRoundIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"users-round\", props)}>\n <path d=\"M18 21a8 8 0 0 0-16 0\" />\n <circle cx=\"10\" cy=\"8\" r=\"5\" />\n <path d=\"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3\" />\n </svg>\n );\n}\n\n/** lucide `landmark`. */\nexport function LandmarkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"landmark\", props)}>\n <path d=\"M10 18v-7\" />\n <path d=\"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z\" />\n <path d=\"M14 18v-7\" />\n <path d=\"M18 18v-7\" />\n <path d=\"M3 22h18\" />\n <path d=\"M6 18v-7\" />\n </svg>\n );\n}\n\n/** lucide `factory`. */\nexport function FactoryIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"factory\", props)}>\n <path d=\"M12 16h.01\" />\n <path d=\"M16 16h.01\" />\n <path d=\"M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z\" />\n <path d=\"M8 16h.01\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-down` — CollapsibleText's \"expand all\". */\nexport function ChevronsDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-down\", props)}>\n <path d=\"m7 6 5 5 5-5\" />\n <path d=\"m7 13 5 5 5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up` — CollapsibleText's \"collapse all\". */\nexport function ChevronsUpIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"chevrons-up\", props)}>\n <path d=\"m17 11-5-5-5 5\" />\n <path d=\"m17 18-5-5-5 5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-up-right` — CitationChip's \"open source\". */\nexport function ArrowUpRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"arrow-up-right\", props)}>\n <path d=\"M7 7h10v10\" />\n <path d=\"M7 17 17 7\" />\n </svg>\n );\n}\n\n/** lucide `quote` — CitationChip's excerpt blockquote. */\nexport function QuoteIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"quote\", props)}>\n <path d=\"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\" />\n <path d=\"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\" />\n </svg>\n );\n}\n\n/** lucide `panel-top-open` — the floating dock's phone menu button (opens the list). */\nexport function PanelTopOpenIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-top-open\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"m15 14-3 3-3-3\" />\n </svg>\n );\n}\n\n/** lucide `panel-top-close` — the floating dock's phone menu button (closes the list). */\nexport function PanelTopCloseIcon(props: IconProps) {\n return (\n <svg {...lucideProps(\"panel-top-close\", props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M3 9h18\" />\n <path d=\"m9 16 3-3 3 3\" />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * The deck's chrome: the four edge buttons, the corner buttons, and the full-screen wash.\n * Hot / wash state is written straight to the DOM (no React render per pointer move).\n */\nimport * as React from \"react\";\n\nimport { ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon } from \"../icons\";\nimport { hideWash, showWash } from \"./visual\";\nimport type { DeckAnswer, DeckDirection, DeckKey } from \"./model\";\n\nconst ARROWS: Record<DeckDirection, React.ComponentType<React.SVGAttributes<SVGSVGElement>>> = {\n right: ArrowRightIcon,\n left: ArrowLeftIcon,\n up: ArrowUpIcon,\n down: ArrowDownIcon,\n};\n\nexport const KEY_GLYPH: Record<DeckDirection, string> = { right: \"→\", up: \"↑\", left: \"←\", down: \"↓\" };\n\n/** The answer's own icon, else the arrow of the edge it sits on (an answer off the edges has none). */\nexport function AnswerGlyph({ answer, dir }: { answer: DeckAnswer; dir: DeckDirection | null }) {\n if (answer.icon) return <>{answer.icon}</>;\n if (!dir) return null;\n const Arrow = ARROWS[dir];\n return <Arrow />;\n}\n\nexport type EdgeRefs = Partial<Record<DeckDirection, HTMLButtonElement | null>>;\n\nexport function setHot(refs: EdgeRefs, dir: DeckDirection | null): void {\n for (const d of Object.keys(refs) as DeckDirection[]) {\n const el = refs[d];\n if (!el) continue;\n if (d === dir) el.setAttribute(\"data-hot\", \"\");\n else el.removeAttribute(\"data-hot\");\n }\n}\n\nexport interface EdgeButtonsProps {\n readonly keyMap: DeckKey;\n readonly suggested: DeckDirection | null;\n readonly refs: React.MutableRefObject<EdgeRefs>;\n readonly onAnswer: (dir: DeckDirection) => void;\n readonly suggestionLabel: string;\n readonly disabled?: boolean;\n}\n\n/** One large button on each enabled edge, where its swipe goes. */\nexport function EdgeButtons({ keyMap, suggested, refs, onAnswer, suggestionLabel, disabled }: EdgeButtonsProps) {\n return (\n <>\n {([\"up\", \"left\", \"right\", \"down\"] as const).map((dir) => {\n const answer = keyMap[dir];\n if (!answer) return null;\n const isSuggested = dir === suggested;\n return (\n // ui-exception: the deck's edge targets are its own geometry (the swipe they mirror), not a form control\n <button\n key={dir}\n ref={(el) => {\n refs.current[dir] = el;\n }}\n type=\"button\"\n className=\"matrx-sd-edge\"\n data-dir={dir}\n data-tone={answer.tone}\n data-suggested={isSuggested ? \"\" : undefined}\n aria-label={isSuggested ? `${answer.label} (${suggestionLabel})` : answer.label}\n aria-keyshortcuts={{ right: \"ArrowRight\", left: \"ArrowLeft\", up: \"ArrowUp\", down: \"ArrowDown\" }[dir]}\n title={`${answer.label} ${KEY_GLYPH[dir]}`}\n disabled={disabled}\n onClick={() => onAnswer(dir)}\n >\n <AnswerGlyph answer={answer} dir={dir} />\n </button>\n );\n })}\n </>\n );\n}\n\nexport interface CornerButtonProps {\n readonly corner: \"tl\" | \"tr\" | \"bl\" | \"br\";\n readonly label: string;\n readonly shortcut?: string;\n readonly onClick: () => void;\n readonly disabled?: boolean;\n readonly pressed?: boolean;\n readonly children: React.ReactNode;\n}\n\nexport function CornerButton({ corner, label, shortcut, onClick, disabled, pressed, children }: CornerButtonProps) {\n return (\n // ui-exception: the deck's four corner targets sit in its own frame geometry\n <button\n type=\"button\"\n className=\"matrx-sd-corner\"\n data-corner={corner}\n aria-label={label}\n title={shortcut ? `${label} (${shortcut})` : label}\n aria-keyshortcuts={shortcut}\n disabled={disabled}\n aria-pressed={pressed}\n onClick={onClick}\n >\n {children}\n </button>\n );\n}\n\nexport interface WashHandle {\n show(answer: DeckAnswer, dir: DeckDirection | null, amount: number): void;\n hide(): void;\n}\n\n/** The whole screen takes the answer's color and shows its name big, the moment a drag starts. */\nexport const Wash = React.forwardRef<WashHandle>(function Wash(_props, ref) {\n const bg = React.useRef<HTMLDivElement>(null);\n const label = React.useRef<HTMLDivElement>(null);\n const [shown, setShown] = React.useState<{ answer: DeckAnswer; dir: DeckDirection | null } | null>(null);\n React.useImperativeHandle(\n ref,\n () => ({\n show(answer, dir, amount) {\n setShown((cur) => (cur && cur.answer.id === answer.id && cur.dir === dir ? cur : { answer, dir }));\n showWash(bg.current, label.current, amount);\n },\n hide() {\n hideWash(bg.current, label.current);\n },\n }),\n [],\n );\n return (\n <div className=\"matrx-sd-wash\" aria-hidden=\"true\" data-tone={shown?.answer.tone}>\n <div ref={bg} className=\"matrx-sd-wash-bg\" />\n <div ref={label} className=\"matrx-sd-wash-label\">\n {shown ? <AnswerGlyph answer={shown.answer} dir={shown.dir} /> : null}\n <b>{shown?.answer.label}</b>\n </div>\n </div>\n );\n});\n","/**\n * The deck's direct-to-DOM motion: card follow, snap back, fly out, enter, the full-screen wash,\n * and the text fit. Each writes `transform`/`opacity` only (compositor properties) and never\n * React state, so dragging stays on the 60fps path.\n */\nimport type { DeckDirection } from \"./model\";\n\nexport const VECTOR: Record<DeckDirection, readonly [number, number]> = {\n right: [1, 0],\n left: [-1, 0],\n up: [0, -1],\n down: [0, 1],\n};\n\n/** A short buzz, only once the page has had a tap (browsers refuse, and say so, before one). */\nexport function buzz(nav: Navigator | undefined, ms: number): void {\n try {\n const activation = (nav as (Navigator & { userActivation?: { hasBeenActive: boolean } }) | undefined)?.userActivation;\n if (activation && !activation.hasBeenActive) return;\n nav?.vibrate?.(ms);\n } catch {\n /* no haptics */\n }\n}\n\nexport function prefersReducedMotion(): boolean {\n try {\n return typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n } catch {\n return false;\n }\n}\n\nexport function finePointer(): boolean {\n try {\n return typeof matchMedia === \"function\" && matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n } catch {\n return false;\n }\n}\n\n/**\n * The card follows the drag; `amount` (distance over the threshold) fades it, so the answer's big name\n * reads over a quiet card (full drag: 0.3), never two texts printed over each other.\n */\nexport function follow(el: HTMLElement | null, dx: number, dy: number, amount = 0): void {\n if (!el) return;\n el.style.transition = \"none\";\n el.style.transform = dx || dy ? `translate3d(${dx}px,${dy}px,0) rotate(${(dx / 28).toFixed(2)}deg)` : \"\";\n el.style.opacity = amount > 0 ? String(1 - 0.7 * Math.min(1, amount)) : \"\";\n}\n\nexport function snapBack(el: HTMLElement | null): void {\n if (!el) return;\n el.style.transition = \"transform 260ms cubic-bezier(.2,.8,.2,1), opacity 260ms ease\";\n el.style.transform = \"\";\n el.style.opacity = \"\";\n}\n\n/** Throw the card off the edge it went toward; faster throws leave faster. */\nexport function flyOut(el: HTMLElement | null, dir: DeckDirection, speed = 0): Promise<void> {\n if (!el || prefersReducedMotion()) return new Promise((r) => setTimeout(r, 90));\n const [vx, vy] = VECTOR[dir];\n const ms = Math.round(Math.max(150, Math.min(260, 260 - speed * 60)));\n el.style.transition = `transform ${ms}ms cubic-bezier(.4,0,1,1), opacity ${ms}ms linear`;\n el.style.transform = `translate3d(${vx * 120}vw,${vy * 110}vh,0) rotate(${vx * 14}deg)`;\n el.style.opacity = \"0\";\n return new Promise((r) => setTimeout(r, ms));\n}\n\n/** A new card arrives: from the edge it left by (undo), or rising in place. */\nexport function enter(el: HTMLElement | null, from: DeckDirection | null): void {\n if (!el || prefersReducedMotion() || typeof el.animate !== \"function\") return;\n if (from) {\n const [vx, vy] = VECTOR[from];\n el.animate(\n [\n { transform: `translate3d(${vx * 100}vw,${vy * 100}vh,0) rotate(${vx * 10}deg)`, opacity: 0.3 },\n { transform: \"none\", opacity: 1 },\n ],\n { duration: 320, easing: \"cubic-bezier(.2,.8,.2,1)\" },\n );\n } else {\n el.animate([{ transform: \"scale(.95)\", opacity: 0 }, { transform: \"none\", opacity: 1 }], { duration: 260, easing: \"cubic-bezier(.2,.8,.2,1)\" });\n }\n}\n\n/** The card leans toward its suggested answer once, then settles. */\nexport function nudge(el: HTMLElement | null, dir: DeckDirection): Animation | null {\n if (!el || prefersReducedMotion() || typeof el.animate !== \"function\") return null;\n const [vx, vy] = VECTOR[dir];\n return el.animate(\n [\n { transform: \"none\" },\n { transform: `translate3d(${vx * 24}px,${vy * 24}px,0) rotate(${vx * 1.2}deg)`, offset: 0.3 },\n { transform: \"none\", offset: 0.6 },\n { transform: `translate3d(${vx * 10}px,${vy * 10}px,0)`, offset: 0.8 },\n { transform: \"none\" },\n ],\n { duration: 1100, easing: \"ease-in-out\" },\n );\n}\n\n/** Fill the screen with the answer's color; `amount` 0..1+ is how far the drag has gone. */\nexport function showWash(bg: HTMLElement | null, label: HTMLElement | null, amount: number): void {\n if (!bg || !label) return;\n const a = Math.max(0, Math.min(1, amount));\n bg.style.opacity = String(Math.min(0.93, 0.2 + 0.73 * a));\n label.style.opacity = String(Math.min(1, 0.35 + a));\n label.style.transform = `scale(${0.82 + 0.22 * a})`;\n}\n\nexport function hideWash(bg: HTMLElement | null, label: HTMLElement | null): void {\n if (bg) bg.style.opacity = \"0\";\n if (label) label.style.opacity = \"0\";\n}\n\n/**\n * The largest font size (px) at which `text` fits: `inner` no taller than `box`, and no word wider\n * than the line. Binary search, ten measurements.\n */\nexport function fitText(box: HTMLElement, inner: HTMLElement, text: HTMLElement, min: number, max: number): number {\n let lo = min;\n let hi = Math.max(min, max);\n let best = lo;\n for (let k = 0; k < 10; k++) {\n const mid = (lo + hi) / 2;\n text.style.fontSize = `${mid}px`;\n const ok = inner.offsetHeight <= box.clientHeight && text.scrollWidth <= text.clientWidth + 1;\n if (ok) {\n best = mid;\n lo = mid;\n } else hi = mid;\n }\n const size = Math.floor(best);\n text.style.fontSize = `${size}px`;\n // Even the smallest size does not fit (a very long text, a narrow phone): this one screen scrolls, never clips.\n if (inner.offsetHeight > box.clientHeight + 1) box.setAttribute(\"data-sd-overflow\", \"\");\n else box.removeAttribute(\"data-sd-overflow\");\n return size;\n}\n\n/** The card's text at a fixed size: the one screen scrolls when the card is taller than the stage, never clips. */\nexport function markOverflow(box: HTMLElement, inner: HTMLElement): void {\n if (inner.offsetHeight > box.clientHeight + 1) box.setAttribute(\"data-sd-overflow\", \"\");\n else box.removeAttribute(\"data-sd-overflow\");\n}\n\n/** Run a fit now, again once the web font has loaded (it changes every measure), and on every resize. */\nexport function keepFitted(box: HTMLElement, run: () => void): () => void {\n run();\n let alive = true;\n box.ownerDocument.fonts?.ready.then(() => alive && run()).catch(() => undefined);\n if (typeof ResizeObserver === \"undefined\") return () => void (alive = false);\n const ro = new ResizeObserver(run);\n ro.observe(box);\n return () => {\n alive = false;\n ro.disconnect();\n };\n}\n\n/**\n * The largest the card's text may be. A phone (under 480px) goes by its text column (column / 2.6, so a\n * short line like \"junk\" goes huge and the height fills first); wider screens by the screen's width.\n */\nexport function heroMax(box: HTMLElement): number {\n const vw = box.ownerDocument.defaultView?.innerWidth ?? box.clientWidth;\n if (vw < 480) return Math.min(104, Math.max(36, box.clientWidth / 2.6));\n const wide = vw >= 1024;\n return Math.min(wide ? 132 : 104, Math.max(36, Math.min(vw, box.clientWidth * 1.6) / 3.2));\n}\n","/**\n * THE DECK CONTROLLER — the one place a deck's changes go, in either mode.\n *\n * CONTROLLED (no binding): the state lives here; every change is reported through `onChange`.\n * BOUND (a {@link SwipeDeckBinding}): the binding holds the truth (its store, its realtime); this\n * controller draws each change at once on top of it (optimistic), sends the ops, and when the\n * connection refuses, takes the change back and keeps the refusal's own sentence for the screen.\n * Undo in both modes is the change's inverse, sent the same way.\n */\nimport * as React from \"react\";\n\nimport { applyOps, deckState, type DeckChange, type DeckItem, type DeckOp, type DeckState } from \"./model\";\n\n/**\n * A connection a deck persists through: hand one to `SwipeDeck` and it saves every answer, pick,\n * part edit and category the moment it happens. `state` must follow the connection's truth\n * (including other devices' writes); `apply` resolves when the connection kept the ops and rejects\n * with an Error whose message is the connection's own refusal sentence.\n */\nexport interface SwipeDeckBinding {\n readonly status: \"loading\" | \"ready\" | \"error\";\n /** Why the connection cannot be read, in its own words. */\n readonly error: string | null;\n readonly items: readonly DeckItem[];\n readonly state: DeckState;\n apply(ops: readonly DeckOp[]): Promise<void>;\n /**\n * Optional: the undo history the connection kept (newest last). Given, the deck starts from it, so undo\n * still works after a reload or on another device; `saveHistory` is handed every change to it (at most\n * {@link UNDO_KEPT} steps).\n */\n readonly history?: readonly DeckChange[];\n saveHistory?(history: readonly DeckChange[]): void;\n}\n\n/** How many steps of undo a connection is asked to keep. */\nexport const UNDO_KEPT = 100;\n\ninterface Pending {\n readonly id: number;\n readonly ops: readonly DeckOp[];\n settledAt: number | null;\n /** Never kept by the connection (a requeue): dropped the moment it settles, not held until reflected. */\n readonly transient?: boolean;\n}\n\nexport interface DeckController {\n readonly items: readonly DeckItem[];\n readonly state: DeckState;\n readonly status: \"loading\" | \"ready\" | \"error\";\n readonly readError: string | null;\n /** The last refusal of a write, in the connection's words; cleared by the next write that lands. */\n readonly writeError: string | null;\n readonly canUndo: boolean;\n commit(change: DeckChange): void;\n /** Takes back the last change; returns it (its `from` is the edge the card comes back from). */\n undo(): DeckChange | null;\n}\n\nexport interface DeckControllerOptions {\n readonly items?: readonly DeckItem[] | undefined;\n readonly binding?: SwipeDeckBinding | undefined;\n readonly initialState?: Partial<DeckState> | undefined;\n readonly onChange?: ((state: DeckState, change: DeckChange, undo: boolean) => void) | undefined;\n}\n\nconst SETTLE_GRACE_MS = 6000;\n\n/** True when `state` already holds what `op` writes. */\nexport function reflects(state: DeckState, op: DeckOp): boolean {\n switch (op.kind) {\n case \"answer\":\n return (state.answers[op.itemId] ?? null) === op.answer;\n case \"pick\":\n return (state.picks[op.group] ?? null) === op.itemId;\n case \"parts\":\n return JSON.stringify(state.parts[op.itemId] ?? null) === JSON.stringify(op.parts);\n case \"category\":\n return op.remove ? !state.categories[op.name] : (state.categories[op.name]?.answer ?? null) === op.answer;\n }\n}\n\nexport function useDeckController({ items, binding, initialState, onChange }: DeckControllerOptions): DeckController {\n const [local, setLocal] = React.useState<DeckState>(() => deckState(initialState));\n const [history, setHistory] = React.useState<readonly DeckChange[]>([]);\n const [pending, setPending] = React.useState<readonly Pending[]>([]);\n const [writeError, setWriteError] = React.useState<string | null>(null);\n const seq = React.useRef(0);\n const onChangeRef = React.useRef(onChange);\n onChangeRef.current = onChange;\n\n // A connection's state is read through the one sanitizer: an old or broken shape never blanks the deck.\n const bound = binding?.state;\n const base = React.useMemo(() => (bound ? deckState(bound) : local), [bound, local]);\n\n // A connection that keeps the undo history: the deck takes the kept steps while she has done nothing here\n // yet (they may arrive after the deck draws), and hands the history back only after a change of hers, so\n // opening a deck never writes and kept steps are never replaced by none.\n const touched = React.useRef(false);\n const bindingRef = React.useRef(binding);\n bindingRef.current = binding;\n const kept = binding?.history;\n React.useEffect(() => {\n // Follows the kept steps (a later read may bring more, fewer or none) until she acts here.\n if (touched.current || !kept) return;\n setHistory(kept);\n }, [kept]);\n React.useEffect(() => {\n if (touched.current) bindingRef.current?.saveHistory?.(history.slice(-UNDO_KEPT));\n }, [history]);\n // A settled write stays drawn until the connection's state CARRIES it (an unrelated remote write arriving\n // first must not flicker it away), or until a grace passes (another device wrote over it meanwhile).\n React.useEffect(() => {\n setPending((list) => {\n const kept = list.filter((p) => p.settledAt === null || !p.ops.every((op) => reflects(base, op)));\n return kept.length === list.length ? list : kept;\n });\n }, [base]);\n React.useEffect(() => {\n if (!pending.some((p) => p.settledAt !== null)) return;\n const t = setTimeout(() => setPending((list) => list.filter((p) => p.settledAt === null || Date.now() - p.settledAt < SETTLE_GRACE_MS)), SETTLE_GRACE_MS);\n return () => clearTimeout(t);\n }, [pending]);\n\n const state = React.useMemo(() => pending.reduce((s, p) => applyOps(s, p.ops), base), [base, pending]);\n const stateRef = React.useRef(state);\n stateRef.current = state;\n\n const send = React.useCallback(\n (ops: readonly DeckOp[], onRefused: () => void, transient = false) => {\n if (!binding) {\n setLocal((s) => applyOps(s, ops));\n return;\n }\n const id = ++seq.current;\n setPending((list) => [...list, { id, ops, settledAt: null, ...(transient ? { transient } : {}) }]);\n binding.apply(ops).then(\n () => {\n setWriteError(null);\n // A transient change is never in the connection's state: it stops drawing the moment it lands.\n setPending((list) => (transient ? list.filter((p) => p.id !== id) : list.map((p) => (p.id === id ? { ...p, settledAt: Date.now() } : p))));\n },\n (err: unknown) => {\n setPending((list) => list.filter((p) => p.id !== id));\n setWriteError(err instanceof Error && err.message ? err.message : String(err));\n onRefused();\n },\n );\n },\n [binding],\n );\n\n const commit = React.useCallback(\n (change: DeckChange) => {\n touched.current = true;\n setHistory((h) => [...h, change]);\n send(change.ops, () => setHistory((h) => h.filter((c) => c !== change)), change.transient);\n onChangeRef.current?.(applyOps(stateRef.current, change.ops), change, false);\n },\n [send],\n );\n\n const historyRef = React.useRef(history);\n historyRef.current = history;\n const undo = React.useCallback((): DeckChange | null => {\n const last = historyRef.current[historyRef.current.length - 1];\n if (!last) return null;\n touched.current = true;\n setHistory((h) => h.slice(0, -1));\n // A refused undo puts the change back on the stack: the person can try again.\n send(last.inverse, () => setHistory((h) => [...h, last]), last.transient);\n onChangeRef.current?.(applyOps(stateRef.current, last.inverse), last, true);\n return last;\n }, [send]);\n\n return {\n items: binding ? binding.items : (items ?? []),\n state,\n status: binding ? binding.status : \"ready\",\n readError: binding ? binding.error : null,\n writeError,\n canUndo: history.length > 0,\n commit,\n undo,\n };\n}\n","/**\n * THE SWIPE DECK MODEL — everything the deck decides, with no DOM and no React.\n *\n * A deck is a list of items a person answers by swiping one of four ways. The deck never stores\n * anything itself: every change is a list of {@link DeckOp}s applied to a {@link DeckState}, and\n * every change carries its exact inverse, so undo is unlimited and covers every kind of change\n * (answers, picks, part edits, categories). A bound deck sends the same ops to its connection.\n *\n * WHERE THE PERSON IS IS DERIVED, never stored: the current step is the first one not yet done.\n * So a deck open on two devices stays in step by sharing state alone, and a reload resumes where\n * the person left off.\n */\nimport type { ReactNode } from \"react\";\n\nexport type DeckDirection = \"right\" | \"up\" | \"left\" | \"down\";\nexport const DECK_DIRECTIONS: readonly DeckDirection[] = [\"right\", \"up\", \"left\", \"down\"];\n\n/** Semantic color of an answer; each names a design-system token pair (`--success` / `--success-foreground`…). */\nexport type DeckTone = \"success\" | \"info\" | \"destructive\" | \"warning\" | \"primary\" | \"neutral\";\n\nexport interface DeckAnswer {\n /** Stable id: what results, callbacks and connections carry. */\n readonly id: string;\n readonly label: string;\n /**\n * Offered only through the card's own controls (`renderCardActions` / `renderCardBody` call\n * `answer(id)`), never drawn as a button: an answer that needs a choice first (\"Related ▸ Partner\").\n */\n readonly hidden?: boolean;\n /**\n * \"Skip for now\": in a bound deck the connection moves the card to the back of the line and keeps no\n * answer (it comes back once the rest are answered); undo brings it back to the front. In a deck with no\n * connection it is kept like any other answer.\n */\n readonly requeue?: boolean;\n readonly tone: DeckTone;\n /** Higher is better. Decides which answer wins when categories disagree (default by direction). */\n readonly rank?: number;\n /** Replaces the arrow on the edge button and the full-screen wash. */\n readonly icon?: ReactNode;\n /** One key that gives this answer (\"Y\", \"3\"), beside the arrows. Case does not matter. */\n readonly shortcut?: string;\n}\n\n/** The answer on each edge. A missing direction is disabled (two, three or four ways). */\nexport type DeckKey = Partial<Record<DeckDirection, DeckAnswer>>;\n/** An override: an answer replaces that edge, `null` turns the edge off. */\nexport type DeckKeyOverride = Partial<Record<DeckDirection, DeckAnswer | null>>;\n\nexport const DEFAULT_DECK_KEY: DeckKey = {\n right: { id: \"yes\", label: \"Yes!\", tone: \"success\", rank: 3 },\n up: { id: \"sort_of\", label: \"Sort of\", tone: \"info\", rank: 2 },\n left: { id: \"no\", label: \"No\", tone: \"destructive\", rank: 0 },\n down: { id: \"not_sure\", label: \"Not sure\", tone: \"warning\", rank: 1 },\n};\n\n/** The part screen's down edge: close it, changing no answer. */\nexport const KEEP_ANSWER_ID = \"__keep\";\nexport const DEFAULT_KEEP_ANSWER: DeckAnswer = { id: KEEP_ANSWER_ID, label: \"Keep as is\", tone: \"neutral\" };\n\nconst DIRECTION_RANK: Record<DeckDirection, number> = { right: 3, up: 2, down: 1, left: 0 };\n\nexport function mergeKey(base: DeckKey, override?: DeckKeyOverride | null): DeckKey {\n if (!override) return base;\n const out: DeckKey = { ...base };\n for (const dir of DECK_DIRECTIONS) {\n if (!(dir in override)) continue;\n const next = override[dir];\n if (next) out[dir] = next;\n else delete out[dir];\n }\n return out;\n}\n\nexport function directionOf(key: DeckKey, answerId: string | null | undefined): DeckDirection | null {\n if (!answerId) return null;\n for (const dir of DECK_DIRECTIONS) if (key[dir]?.id === answerId) return dir;\n return null;\n}\n\n/** The answer with this id: on an edge of `key`, else among `more` (the answers off the edges). */\nexport function answerOf(key: DeckKey, answerId: string | null | undefined, more?: readonly DeckAnswer[]): DeckAnswer | null {\n const dir = directionOf(key, answerId);\n if (dir) return key[dir] ?? null;\n if (!answerId || !more) return null;\n return more.find((a) => a.id === answerId) ?? null;\n}\n\nfunction rankOf(key: DeckKey, answerId: string): number {\n const dir = directionOf(key, answerId);\n if (!dir) return -1;\n return key[dir]?.rank ?? DIRECTION_RANK[dir];\n}\n\n// ─── items, parts, categories ─────────────────────────────────────────────\n\nexport interface DeckField {\n readonly label: string;\n readonly value: string;\n}\n\n/** A part as an item first offers it: by phrase (first match) or by token span. */\nexport interface DeckPartSeed {\n readonly phrase?: string;\n readonly start?: number;\n readonly end?: number;\n readonly categories?: readonly string[];\n /** The answer this part leans to before anyone answers it. */\n readonly suggested?: string | null;\n readonly answer?: string | null;\n}\n\n/** A span of the item's words [start, end] (token indexes, inclusive) with its own answer. */\nexport interface DeckPart {\n readonly start: number;\n readonly end: number;\n readonly categories: readonly string[];\n readonly suggested: string | null;\n readonly answer: string | null;\n}\n\nexport interface DeckCategory {\n readonly name: string;\n readonly answer: string | null;\n /** The chip row it was added in (see {@link DeckCategoryRow}), when the deck has rows. */\n readonly row?: string;\n}\n\n/** A labelled row of categories on the part screen (\"Who\", \"Cares about\"); a category added with its \"+\" carries the row's id. */\nexport interface DeckCategoryRow {\n readonly id: string;\n readonly label: string;\n readonly categories: readonly string[];\n}\n\n/** A picture on the card: an image by address, or anything the host draws (an avatar with its own fallback). */\nexport type DeckMedia =\n | { readonly src: string; readonly alt?: string; readonly shape?: \"circle\" | \"square\" | \"wide\" }\n | { readonly node: ReactNode; readonly shape?: \"circle\" | \"square\" | \"wide\" };\n\n/** One member of a group card (\"these four logos\"): each can be switched off before the card is answered. */\nexport interface DeckMember {\n readonly id: string;\n readonly label: string;\n readonly media?: DeckMedia;\n /** Starts switched off. */\n readonly off?: boolean;\n}\n\n/**\n * When a card is asked: about one earlier card's answer, or a combination. A leaf names the card (`item`)\n * and, optionally, the answers that count (`is`), the ones that must not (`isNot`), or whether it was\n * answered at all (`answered`, default true). A card only ever depends on cards BEFORE it (no loops);\n * a card that is not asked has no answer as far as later cards are concerned.\n */\nexport type DeckCondition =\n | {\n readonly item: string;\n readonly is?: string | readonly string[];\n readonly isNot?: string | readonly string[];\n readonly answered?: boolean;\n }\n | { readonly all: readonly DeckCondition[] }\n | { readonly any: readonly DeckCondition[] }\n | { readonly not: DeckCondition };\n\n/** What rides with an answer beyond its id: the members switched off, a value typed on the card. */\nexport type DeckDetail = Readonly<Record<string, unknown>>;\n\nexport interface DeckItem {\n readonly id: string;\n /** The main text: fitted to the largest size the screen allows. */\n readonly text: string;\n /** A small label above the text (what kind of item this is). */\n readonly kicker?: string;\n /** A small fact tag beside the kicker. */\n readonly tag?: string;\n /** The suggested answer id: its button is filled and pulses, and the card leans toward it. */\n readonly suggested?: string | null;\n /**\n * The suggestion in finer words than its answer's label, shown as the Suggestion (the card still leans to\n * `suggested`): an answer that merges two (\"Sustain or Accept\") can show the precise one (\"Accept\").\n */\n readonly suggestedLabel?: string;\n /** Shown under the text with the \"Reason\" label. */\n readonly reason?: string;\n /** More label/value lines under the text. */\n readonly fields?: readonly DeckField[];\n /** Draw the text in quotation marks. */\n readonly quoted?: boolean;\n readonly parts?: readonly DeckPartSeed[];\n /** This item's own key: replaces or turns off edges of the deck's key. */\n readonly answers?: DeckKeyOverride;\n /** Pick-one group: when every item of a pick-one group is answered, the person picks one of its Yes items. */\n readonly group?: string;\n /** The suggested pick of its group. */\n readonly pickSuggested?: boolean;\n /**\n * The right answer(s), by answer id, for a deck that is graded (a quiz). Never shown while she answers;\n * the result says which were right and the end shows the score. Absent: the item is not graded.\n */\n readonly correct?: string | readonly string[];\n /** Answers off the edges, as a row of buttons on the card; replaces the deck's own `more` for this item. */\n readonly more?: readonly DeckAnswer[];\n /** A picture above the text. */\n readonly media?: DeckMedia;\n /** A group card: its members, each switched on or off; the off ones ride with the answer as `detail.off`. */\n readonly members?: readonly DeckMember[];\n /**\n * Asked only when this holds (see {@link DeckCondition}). Not asked: skipped, and left out of progress,\n * counts, the score and the results; an answer it already had is KEPT but does not apply, and comes\n * back if the card is asked again.\n */\n readonly showIf?: DeckCondition;\n}\n\nexport interface DeckState {\n readonly answers: Readonly<Record<string, string>>;\n readonly picks: Readonly<Record<string, string>>;\n /** Parts as changed or loaded; an item absent here shows its seeds. */\n readonly parts: Readonly<Record<string, readonly DeckPart[]>>;\n readonly categories: Readonly<Record<string, DeckCategory>>;\n /** What rode with each answer (see {@link DeckDetail}); a binding that keeps none may leave it out. */\n readonly details?: Readonly<Record<string, DeckDetail>>;\n}\n\nexport const EMPTY_DECK_STATE: DeckState = { answers: {}, picks: {}, parts: {}, categories: {}, details: {} };\n\nconst plain = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst keep = <T,>(v: unknown, ok: (x: unknown) => x is T): Record<string, T> =>\n plain(v) ? Object.fromEntries(Object.entries(v).filter((e): e is [string, T] => ok(e[1]))) : {};\nconst isText = (x: unknown): x is string => typeof x === \"string\" && x.length > 0;\nconst isPart = (x: unknown): x is DeckPart => plain(x) && Number.isInteger(x.start) && Number.isInteger(x.end) && Array.isArray(x.categories);\nconst isParts = (x: unknown): x is readonly DeckPart[] => Array.isArray(x) && x.every(isPart);\nconst isCategory = (x: unknown): x is DeckCategory => plain(x) && typeof x.name === \"string\";\n\n/**\n * A full deck state from anything saved or handed in: missing parts start empty, and an entry of the\n * wrong shape (an old save, a hand-edited row) is left out, so a deck never draws blank over bad data.\n */\nexport function deckState(partial?: Partial<DeckState> | null): DeckState {\n const p: Record<string, unknown> = plain(partial) ? partial : {};\n return {\n answers: keep(p.answers, isText),\n picks: keep(p.picks, isText),\n parts: keep(p.parts, isParts),\n categories: keep(p.categories, isCategory),\n details: keep(p.details, plain) as Record<string, DeckDetail>,\n };\n}\n\nexport function tokenize(text: string): string[] {\n return text.split(/\\s+/).filter(Boolean);\n}\n\nfunction norm(token: string): string {\n return token.toLowerCase().replace(/[^\\p{L}\\p{N}+-]/gu, \"\");\n}\n\n/** The parts an item opens with: each seed placed on its tokens; seeds that match nothing are dropped. */\nexport function seedParts(item: DeckItem): DeckPart[] {\n const tokens = tokenize(item.text);\n const normed = tokens.map(norm);\n const out: DeckPart[] = [];\n for (const seed of item.parts ?? []) {\n let start = seed.start;\n let end = seed.end;\n if (seed.phrase !== undefined) {\n const want = tokenize(seed.phrase).map(norm);\n start = undefined;\n for (let i = 0; i + want.length <= normed.length && want.length; i++) {\n if (want.every((w, j) => normed[i + j] === w)) {\n start = i;\n end = i + want.length - 1;\n break;\n }\n }\n }\n if (start === undefined || start < 0 || start >= tokens.length) continue;\n const e = Math.min(tokens.length - 1, Math.max(start, end ?? start));\n out.push({ start, end: e, categories: seed.categories ?? [], suggested: seed.suggested ?? null, answer: seed.answer ?? null });\n }\n return withoutOverlaps(out);\n}\n\nfunction withoutOverlaps(parts: DeckPart[]): DeckPart[] {\n const sorted = [...parts].sort((a, b) => a.start - b.start);\n const out: DeckPart[] = [];\n for (const p of sorted) if (!out.some((q) => !(q.end < p.start || q.start > p.end))) out.push(p);\n return out;\n}\n\nexport function partsOf(state: DeckState, item: DeckItem): readonly DeckPart[] {\n return state.parts[item.id] ?? seedParts(item);\n}\n\nexport function partText(item: DeckItem, part: Pick<DeckPart, \"start\" | \"end\">): string {\n return tokenize(item.text)\n .slice(part.start, part.end + 1)\n .join(\" \")\n .replace(/^[“\"‘'(\\[]+|[”\"’'.,;:!?)\\]]+$/g, \"\");\n}\n\n/** Every category the deck knows: the configured rows, then any a part or the state names. */\nexport function knownCategories(configured: readonly string[], items: readonly DeckItem[], state: DeckState): string[] {\n const out: string[] = [];\n const add = (name: string) => {\n if (name && !out.includes(name)) out.push(name);\n };\n configured.forEach(add);\n for (const item of items) for (const part of partsOf(state, item)) part.categories.forEach(add);\n Object.keys(state.categories).forEach(add);\n return out;\n}\n\nexport type CategoryConflict = \"worse\" | \"better\" | ((answerIds: readonly string[]) => string);\n\n/** One answer from several categories' answers: by default the worse one wins. */\nexport function resolveConflict(answerIds: readonly string[], key: DeckKey, conflict: CategoryConflict = \"worse\"): string | null {\n if (!answerIds.length) return null;\n if (typeof conflict === \"function\") return conflict(answerIds);\n const sign = conflict === \"better\" ? -1 : 1;\n return [...answerIds].sort((a, b) => sign * (rankOf(key, a) - rankOf(key, b)))[0] ?? null;\n}\n\n/** What a part leans to: its categories' answers flow down to it; otherwise its own suggestion. */\nexport function partSuggestion(part: DeckPart, state: DeckState, key: DeckKey, conflict?: CategoryConflict): string | null {\n const flowed = part.categories.map((c) => state.categories[c]?.answer).filter((a): a is string => !!a);\n return resolveConflict(flowed, key, conflict) ?? part.suggested;\n}\n\n/** The answer a part shows: its own, else what flows down to it. */\nexport function partAnswer(part: DeckPart, state: DeckState, key: DeckKey, conflict?: CategoryConflict): string | null {\n return part.answer ?? partSuggestion(part, state, key, conflict);\n}\n\n/** Place a part on its span: every part it overlaps is replaced. */\nexport function placePart(parts: readonly DeckPart[], next: DeckPart): DeckPart[] {\n return [...parts.filter((p) => p.end < next.start || p.start > next.end), next].sort((a, b) => a.start - b.start);\n}\n\nexport function forgetSpan(parts: readonly DeckPart[], span: Pick<DeckPart, \"start\" | \"end\">): DeckPart[] {\n return parts.filter((p) => p.end < span.start || p.start > span.end);\n}\n\n// ─── steps ────────────────────────────────────────────────────────────────\n\nexport type DeckStep =\n | { readonly kind: \"card\"; readonly id: string; readonly item: DeckItem }\n | { readonly kind: \"pick\"; readonly id: string; readonly group: string; readonly items: readonly DeckItem[] }\n | { readonly kind: \"end\"; readonly id: \"end\" };\n\nexport interface DeckRules {\n readonly key: DeckKey;\n /** Groups that end in a pick-one screen: `true` = every group. */\n readonly pickOne?: boolean | readonly string[];\n /** The answer that makes an item a contender in its group's pick (default: the right edge's). */\n readonly pickAnswer?: string;\n /** Answers off the edges, offered on every card (an item's own `more` replaces them). */\n readonly more?: readonly DeckAnswer[];\n}\n\nexport function keyFor(rules: DeckRules, item: DeckItem): DeckKey {\n return mergeKey(rules.key, item.answers);\n}\n\n/** The answers off the edges for this item: its own, or the deck's; never one already on an edge. */\nexport function moreFor(rules: DeckRules, item: DeckItem): readonly DeckAnswer[] {\n const key = keyFor(rules, item);\n const list = item.more ?? rules.more ?? [];\n return list.filter((a) => !directionOf(key, a.id));\n}\n\n/** Every answer this item can take: the edges' (clockwise from the top), then the ones off the edges. */\nexport function answersFor(rules: DeckRules, item: DeckItem): readonly DeckAnswer[] {\n const key = keyFor(rules, item);\n const edges = ([\"up\", \"right\", \"down\", \"left\"] as const).map((d) => key[d]).filter((a): a is DeckAnswer => !!a);\n return [...edges, ...moreFor(rules, item)];\n}\n\n/** The answer with this id for this item, on an edge or off it. */\nexport function findAnswer(rules: DeckRules, item: DeckItem, answerId: string | null | undefined): DeckAnswer | null {\n return answerOf(keyFor(rules, item), answerId, moreFor(rules, item));\n}\n\n/**\n * What rides with an item's answer: the detail given, and on a group card always its members switched off\n * (`off`, the starting ones included), so a consumer never has to know the item's defaults.\n */\nexport function answerDetail(item: DeckItem, detail: DeckDetail | null | undefined): DeckDetail | null {\n if (!item.members?.length) return detail ?? null;\n return { ...(detail ?? {}), off: [...membersOff(item, detail)] };\n}\n\n/** The members switched off on a group card: what the person set, else what the item starts with. */\nexport function membersOff(item: DeckItem, detail: DeckDetail | null | undefined): readonly string[] {\n const off = detail?.off;\n if (Array.isArray(off)) return off.filter((x): x is string => typeof x === \"string\");\n return (item.members ?? []).filter((m) => m.off).map((m) => m.id);\n}\n\nfunction pickAnswerOf(rules: DeckRules): string | null {\n return rules.pickAnswer ?? rules.key.right?.id ?? null;\n}\n\nfunction isPickGroup(rules: DeckRules, group: string | undefined): group is string {\n if (!group || !rules.pickOne) return false;\n return rules.pickOne === true || rules.pickOne.includes(group);\n}\n\nconst asList = (v: string | readonly string[] | undefined): readonly string[] | null => (v === undefined ? null : typeof v === \"string\" ? [v] : v);\n\n/** Whether a condition holds, given the cards asked so far (`asked`: id → asked) and the answers. */\nexport function conditionHolds(cond: DeckCondition, state: DeckState, asked: ReadonlyMap<string, boolean>): boolean {\n if (\"all\" in cond) return cond.all.every((c) => conditionHolds(c, state, asked));\n if (\"any\" in cond) return cond.any.some((c) => conditionHolds(c, state, asked));\n if (\"not\" in cond) return !conditionHolds(cond.not, state, asked);\n // A card not (yet) asked — later, missing, or skipped by its own condition — has no answer.\n const answer = asked.get(cond.item) ? (state.answers[cond.item] ?? null) : null;\n const wantAnswered = cond.answered ?? true;\n if (!wantAnswered) return answer === null;\n if (answer === null) return false;\n const is = asList(cond.is);\n const isNot = asList(cond.isNot);\n if (is && !is.includes(answer)) return false;\n if (isNot && isNot.includes(answer)) return false;\n return true;\n}\n\n/** Which cards are asked, in order: a card with no condition always; one with a condition when it holds over the cards before it. */\nexport function askedItems(items: readonly DeckItem[], state: DeckState): ReadonlyMap<string, boolean> {\n const asked = new Map<string, boolean>();\n for (const item of items) asked.set(item.id, item.showIf ? conditionHolds(item.showIf, state, asked) : true);\n return asked;\n}\n\n/** The cards asked, in order. */\nexport function shownItems(items: readonly DeckItem[], state: DeckState): DeckItem[] {\n if (!items.some((i) => i.showIf)) return [...items];\n const asked = askedItems(items, state);\n return items.filter((i) => asked.get(i.id));\n}\n\n/** Every card id a condition names. */\nexport function conditionItems(cond: DeckCondition): string[] {\n if (\"all\" in cond) return cond.all.flatMap(conditionItems);\n if (\"any\" in cond) return cond.any.flatMap(conditionItems);\n if (\"not\" in cond) return conditionItems(cond.not);\n return [cond.item];\n}\n\n/**\n * THE ORDER A DECK WITH CONDITIONS IS ASKED IN, when its order is not authored (a table sorted any way):\n * the given order, except that a card always comes after every card its condition names. Stable — a\n * deck whose conditions already point backwards is returned unchanged. A loop (two cards naming each\n * other) is left in the given order, where `conditionProblems` says so.\n */\nexport function dependencyOrder<T extends DeckItem>(items: readonly T[]): T[] {\n const ids = new Set(items.map((i) => i.id));\n const needs = new Map(items.map((i) => [i.id, new Set(i.showIf ? conditionItems(i.showIf).filter((d) => ids.has(d) && d !== i.id) : [])]));\n const out: T[] = [];\n const placed = new Set<string>();\n const left = [...items];\n while (left.length) {\n const k = left.findIndex((i) => [...needs.get(i.id)!].every((d) => placed.has(d)));\n const [next] = left.splice(k < 0 ? 0 : k, 1);\n out.push(next!);\n placed.add(next!.id);\n }\n return out;\n}\n\n/**\n * What is wrong with the deck's conditions, in words (never silent): a condition naming a card that does\n * not exist, one that comes later (it could never be answered first), or an answer the card does not have.\n */\n/**\n * A condition as a person or an agent wrote it (`{item, is, is_not | isNot, answered}`, `{all}`, `{any}`,\n * `{not}`, or a list meaning all), with its card and answers resolved by the host: `ref` names the card\n * (an id, a position, its words), `answer(itemId, word)` the answer id. Null when nothing can be read.\n * The one reader for every source of conditions (a chat answer, a table column, a definition).\n */\nexport function readDeckCondition(\n raw: unknown,\n resolve: { ref: (v: unknown) => string; answer: (itemId: string, word: unknown) => string | null },\n): DeckCondition | null {\n const rec = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\n const read = (r: unknown): DeckCondition | null => {\n if (Array.isArray(r)) {\n const all = r.map(read).filter((c): c is DeckCondition => !!c);\n return all.length ? { all } : null;\n }\n if (!rec(r)) return null;\n if (Array.isArray(r.all)) return { all: r.all.map(read).filter((c): c is DeckCondition => !!c) };\n if (Array.isArray(r.any)) return { any: r.any.map(read).filter((c): c is DeckCondition => !!c) };\n if (r.not !== undefined) {\n const inner = read(r.not);\n return inner ? { not: inner } : null;\n }\n if (r.item === undefined || r.item === null) return null;\n const item = resolve.ref(r.item);\n const words = (v: unknown): string[] | undefined =>\n v === undefined || v === null ? undefined : (Array.isArray(v) ? v : [v]).map((w) => resolve.answer(item, w) ?? String(w).trim()).filter(Boolean);\n const is = words(r.is);\n const isNot = words(r.is_not ?? r.isNot);\n return {\n item,\n ...(is ? { is } : {}),\n ...(isNot ? { isNot } : {}),\n ...(typeof r.answered === \"boolean\" ? { answered: r.answered } : {}),\n };\n };\n return read(raw);\n}\n\nexport function conditionProblems(items: readonly DeckItem[], rules: DeckRules): string[] {\n const out: string[] = [];\n const index = new Map(items.map((i, k) => [i.id, k]));\n items.forEach((item, k) => {\n if (!item.showIf) return;\n const visit = (c: DeckCondition): void => {\n if (\"all\" in c) return c.all.forEach(visit);\n if (\"any\" in c) return c.any.forEach(visit);\n if (\"not\" in c) return visit(c.not);\n const at = index.get(c.item);\n if (at === undefined) {\n out.push(`\"${item.text}\" depends on a card that is not in the deck (${c.item}).`);\n return;\n }\n if (at >= k) {\n out.push(`\"${item.text}\" depends on \"${items[at]?.text ?? c.item}\", which comes after it, so it can never be asked.`);\n return;\n }\n const target = items[at];\n if (!target) return;\n for (const id of [...(asList(c.is) ?? []), ...(asList(c.isNot) ?? [])]) {\n if (!findAnswer(rules, target, id)) out.push(`\"${item.text}\" waits for an answer \"${id}\" that \"${target.text}\" does not have.`);\n }\n };\n visit(item.showIf);\n });\n return out;\n}\n\nexport function contenders(items: readonly DeckItem[], state: DeckState, rules: DeckRules, group: string): DeckItem[] {\n const yes = pickAnswerOf(rules);\n return shownItems(items, state).filter((i) => i.group === group && yes !== null && state.answers[i.id] === yes);\n}\n\n/** The picked item of a group: the person's pick while it still stands, or the only contender. */\nexport function pickedItem(items: readonly DeckItem[], state: DeckState, rules: DeckRules, group: string): DeckItem | null {\n const all = contenders(items, state, rules, group);\n const chosen = state.picks[group];\n const hit = chosen ? all.find((i) => i.id === chosen) : undefined;\n if (hit) return hit;\n return all.length === 1 ? (all[0] ?? null) : null;\n}\n\nexport function deckSteps(allItems: readonly DeckItem[], state: DeckState, rules: DeckRules): DeckStep[] {\n const out: DeckStep[] = [];\n // Only the cards that are asked are steps; a card whose condition does not hold is skipped.\n const items = shownItems(allItems, state);\n items.forEach((item, index) => {\n out.push({ kind: \"card\", id: `card:${item.id}`, item });\n const group = item.group;\n if (!isPickGroup(rules, group)) return;\n const isLast = !items.slice(index + 1).some((i) => i.group === group);\n if (!isLast) return;\n const members = items.filter((i) => i.group === group);\n const all = contenders(items, state, rules, group);\n if (all.length > 1 && members.every((i) => state.answers[i.id])) out.push({ kind: \"pick\", id: `pick:${group}`, group, items: all });\n });\n out.push({ kind: \"end\", id: \"end\" });\n return out;\n}\n\nexport function stepDone(step: DeckStep, state: DeckState): boolean {\n if (step.kind === \"card\") return !!state.answers[step.item.id];\n if (step.kind === \"pick\") return step.items.some((i) => i.id === state.picks[step.group]);\n return false;\n}\n\n/** Where the person is: the first step not done (the end when all are). */\nexport function currentStepIndex(steps: readonly DeckStep[], state: DeckState): number {\n const i = steps.findIndex((s) => !stepDone(s, state));\n return i < 0 ? steps.length - 1 : i;\n}\n\n// ─── ops, changes, undo ───────────────────────────────────────────────────\n\nexport type DeckOp =\n | { readonly kind: \"answer\"; readonly itemId: string; readonly answer: string | null; readonly detail?: DeckDetail | null }\n | { readonly kind: \"pick\"; readonly group: string; readonly itemId: string | null }\n | { readonly kind: \"parts\"; readonly itemId: string; readonly parts: readonly DeckPart[] }\n | { readonly kind: \"category\"; readonly name: string; readonly answer: string | null; readonly remove?: boolean; readonly row?: string };\n\n/** One thing the person did: its ops, their exact inverse, and the edge it left by. */\nexport interface DeckChange {\n readonly ops: readonly DeckOp[];\n readonly inverse: readonly DeckOp[];\n readonly from: DeckDirection | null;\n /**\n * The connection acts on it but never keeps it as an answer (a `requeue` answer: the card goes to the\n * back of the line): once the connection resolves, the deck stops drawing it, so the card is unanswered.\n */\n readonly transient?: boolean;\n}\n\nfunction omit<T>(record: Readonly<Record<string, T>>, k: string): Record<string, T> {\n const { [k]: _gone, ...rest } = record;\n return rest;\n}\n\nexport function applyOp(state: DeckState, op: DeckOp): DeckState {\n switch (op.kind) {\n case \"answer\": {\n const details = state.details ?? {};\n return {\n ...state,\n answers: op.answer ? { ...state.answers, [op.itemId]: op.answer } : omit(state.answers, op.itemId),\n details: op.answer && op.detail ? { ...details, [op.itemId]: op.detail } : omit(details, op.itemId),\n };\n }\n case \"pick\":\n return { ...state, picks: op.itemId ? { ...state.picks, [op.group]: op.itemId } : omit(state.picks, op.group) };\n case \"parts\":\n return { ...state, parts: { ...state.parts, [op.itemId]: op.parts } };\n case \"category\":\n return {\n ...state,\n categories: op.remove\n ? omit(state.categories, op.name)\n : { ...state.categories, [op.name]: { name: op.name, answer: op.answer, ...(op.row ? { row: op.row } : {}) } },\n };\n default:\n // An op this deck does not know (saved by a newer one): leave the state as it is.\n return state;\n }\n}\n\nexport function applyOps(state: DeckState, ops: readonly DeckOp[]): DeckState {\n return ops.reduce(applyOp, state);\n}\n\n/** The op that puts back what `op` changes, read from the state before it. */\nexport function invertOp(before: DeckState, op: DeckOp, items: readonly DeckItem[]): DeckOp {\n switch (op.kind) {\n case \"answer\":\n return { kind: \"answer\", itemId: op.itemId, answer: before.answers[op.itemId] ?? null, detail: before.details?.[op.itemId] ?? null };\n case \"pick\":\n return { kind: \"pick\", group: op.group, itemId: before.picks[op.group] ?? null };\n case \"parts\": {\n const item = items.find((i) => i.id === op.itemId);\n return { kind: \"parts\", itemId: op.itemId, parts: before.parts[op.itemId] ?? (item ? seedParts(item) : []) };\n }\n case \"category\": {\n const had = before.categories[op.name];\n return had ? { kind: \"category\", name: op.name, answer: had.answer } : { kind: \"category\", name: op.name, answer: null, remove: true };\n }\n }\n}\n\nexport function makeChange(before: DeckState, ops: readonly DeckOp[], items: readonly DeckItem[], from: DeckDirection | null = null): DeckChange {\n const inverse: DeckOp[] = [];\n let s = before;\n for (const op of ops) {\n inverse.unshift(invertOp(s, op, items));\n s = applyOp(s, op);\n }\n return { ops, inverse, from };\n}\n\n/** Answer an item; an answer that drops it out of its group's contenders also drops a pick that named it. */\nexport function answerChange(\n before: DeckState,\n item: DeckItem,\n answerId: string,\n rules: DeckRules,\n items: readonly DeckItem[],\n from: DeckDirection | null,\n detail?: DeckDetail | null,\n): DeckChange {\n const ops: DeckOp[] = [{ kind: \"answer\", itemId: item.id, answer: answerId, ...(detail ? { detail } : {}) }];\n if (item.group && answerId !== pickAnswerOf(rules) && before.picks[item.group] === item.id) ops.push({ kind: \"pick\", group: item.group, itemId: null });\n return makeChange(before, ops, items, from);\n}\n\n// ─── results and copy ─────────────────────────────────────────────────────\n\nexport interface DeckResultPart {\n readonly text: string;\n readonly start: number;\n readonly end: number;\n readonly categories: readonly string[];\n readonly answer: DeckAnswer | null;\n /** True when the person answered the part itself, false when its answer flowed down. */\n readonly own: boolean;\n}\n\nexport interface DeckResultEntry {\n readonly item: DeckItem;\n readonly answer: DeckAnswer | null;\n readonly parts: readonly DeckResultPart[];\n /** Graded items only: whether the answer given is a right one (null: not graded, or not answered). */\n readonly right: boolean | null;\n /** What rode with the answer (members switched off, a value typed on the card); null when nothing did. */\n readonly detail: DeckDetail | null;\n /** False when the card is not asked (its condition does not hold): its answer, if any, does not apply. */\n readonly shown: boolean;\n}\n\nexport interface DeckResult {\n readonly entries: readonly DeckResultEntry[];\n readonly answered: number;\n readonly total: number;\n readonly complete: boolean;\n /** Per answer id: how many items took it. */\n readonly counts: Readonly<Record<string, number>>;\n readonly picks: Readonly<Record<string, DeckItem>>;\n readonly categories: readonly DeckCategory[];\n readonly state: DeckState;\n /** When any item is graded: how many answered items were right, of how many graded items. */\n readonly score: { readonly right: number; readonly graded: number } | null;\n}\n\nexport function deckResult(items: readonly DeckItem[], state: DeckState, rules: DeckRules, conflict?: CategoryConflict): DeckResult {\n const counts: Record<string, number> = {};\n const asked = askedItems(items, state);\n const entries = items.map((item): DeckResultEntry => {\n const key = keyFor(rules, item);\n const more = moreFor(rules, item);\n const shown = asked.get(item.id) !== false;\n // A card not asked keeps its answer in the state, but the answer does not apply anywhere.\n const id = shown ? (state.answers[item.id] ?? null) : null;\n if (id) counts[id] = (counts[id] ?? 0) + 1;\n const parts = partsOf(state, item).map((p): DeckResultPart => {\n const pa = partAnswer(p, state, key, conflict);\n return { text: partText(item, p), start: p.start, end: p.end, categories: p.categories, answer: answerOf(key, pa), own: !!p.answer };\n });\n const correct = item.correct === undefined ? null : typeof item.correct === \"string\" ? [item.correct] : item.correct;\n const right = correct && id ? correct.includes(id) : null;\n return { item, answer: answerOf(key, id, more), parts, right, detail: (id && state.details?.[item.id]) || null, shown };\n });\n const picks: Record<string, DeckItem> = {};\n const groups = new Set(items.map((i) => i.group).filter((g): g is string => isPickGroup(rules, g)));\n for (const g of groups) {\n const p = pickedItem(items, state, rules, g);\n if (p) picks[g] = p;\n }\n const answered = entries.filter((e) => e.answer).length;\n const steps = deckSteps(items, state, rules);\n const complete = steps[currentStepIndex(steps, state)]?.kind === \"end\";\n const graded = entries.filter((e) => e.shown && e.item.correct !== undefined).length;\n const score = graded ? { right: entries.filter((e) => e.right === true).length, graded } : null;\n const total = entries.filter((e) => e.shown).length;\n return { entries, answered, total, complete, counts, picks, categories: Object.values(state.categories), state, score };\n}\n\nexport interface DeckCopyLabels {\n readonly suggestion: string;\n readonly reason: string;\n readonly answer: string;\n readonly unanswered: string;\n}\n\n/** One item as plain text for an AI or a note: what it says, what was suggested, and what the person answered. */\nexport function itemCopyText(\n item: DeckItem,\n state: DeckState,\n key: DeckKey,\n labels: DeckCopyLabels,\n conflict?: CategoryConflict,\n more?: readonly DeckAnswer[],\n): string {\n const lines = [[item.kicker, item.quoted ? `“${item.text}”` : item.text].filter(Boolean).join(\": \")];\n if (item.tag) lines.push(item.tag);\n const off = membersOff(item, state.details?.[item.id]);\n for (const m of item.members ?? []) lines.push(`- ${m.label}${off.includes(m.id) ? \" (off)\" : \"\"}`);\n const sug = answerOf(key, item.suggested, more);\n if (sug) lines.push(`${labels.suggestion}: ${item.suggestedLabel ?? sug.label}`);\n if (item.reason) lines.push(`${labels.reason}: ${item.reason}`);\n for (const f of item.fields ?? []) lines.push(`${f.label}: ${f.value}`);\n const parts = partsOf(state, item);\n for (const p of parts) {\n const a = answerOf(key, partAnswer(p, state, key, conflict));\n lines.push(`- ${partText(item, p)}: ${[a?.label, ...p.categories].filter(Boolean).join(\" · \")}`);\n }\n lines.push(`${labels.answer}: ${answerOf(key, state.answers[item.id], more)?.label ?? labels.unanswered}`);\n return lines.join(\"\\n\");\n}\n\nexport function deckCopyText(result: DeckResult, rules: DeckRules): string {\n const lines: string[] = [];\n for (const [group, item] of Object.entries(result.picks)) lines.push(`${group}: ${item.text}`);\n // Each answer given, in the deck's order (its edges, then the rest as they first appear).\n const order: DeckAnswer[] = DECK_DIRECTIONS.map((d) => rules.key[d]).filter((a): a is DeckAnswer => !!a);\n for (const e of result.entries) if (e.answer && !order.some((a) => a.id === e.answer?.id)) order.push(e.answer);\n for (const a of order) {\n const hits = result.entries.filter((e) => e.answer?.id === a.id);\n if (!hits.length) continue;\n if (lines.length) lines.push(\"\");\n lines.push(`${a.label}:`);\n for (const e of hits) lines.push(`- ${e.item.text}`);\n }\n const placed = result.entries.flatMap((e) => e.parts.filter((p) => p.own && p.answer).map((p) => `- ${p.text}: ${p.answer?.label ?? \"\"}`));\n if (placed.length) lines.push(\"\", ...placed);\n return lines.join(\"\\n\");\n}\n\n// ─── chained decks ────────────────────────────────────────────────────────\n\n/**\n * Feed one deck's answers into the next deck's suggestions: each next item names the earlier item it\n * follows (`link`), and the earlier answer maps to the next suggestion (`map`, identity by default).\n * An item that already carries a suggestion keeps it.\n */\nexport function chainSuggestions(\n next: readonly DeckItem[],\n previous: DeckResult | DeckState,\n link: (item: DeckItem) => string | null | undefined,\n map: (answerId: string, item: DeckItem) => string | null | undefined = (a) => a,\n): DeckItem[] {\n const answers = \"entries\" in previous ? previous.state.answers : previous.answers;\n return next.map((item) => {\n if (item.suggested) return item;\n const from = link(item);\n const prior = from ? answers[from] : undefined;\n const suggested = prior ? map(prior, item) : undefined;\n return suggested ? { ...item, suggested } : item;\n });\n}\n","/**\n * THE SWIPE GESTURE — one pointer, four ways, plus tap and hold.\n *\n * A press that moves more than a few pixels becomes a drag; the drag commits when it passes the\n * distance threshold OR when it is released as a flick (speed over the last ~100ms, so a short fast\n * throw counts the way it does on every phone). A press that never moves is a tap; held still over\n * a `holdSelector` element it becomes a hold. Nothing here renders: the caller moves the card through\n * `move`, which runs per pointer event without touching React state (60fps on a mid-range phone).\n */\nimport type { DeckDirection } from \"./model\";\nimport { buzz } from \"./visual\";\n\nexport interface SwipeHandlers {\n enabled(): boolean;\n directions(): Partial<Record<DeckDirection, unknown>>;\n start?(): void;\n /** `amount` is distance over the threshold: 1 means letting go here commits. */\n move(dx: number, dy: number, dir: DeckDirection | null, amount: number): void;\n release(): void;\n /** `speed` in px/ms, so the card can leave as fast as it was thrown. */\n commit(dir: DeckDirection, speed: number): void;\n tap?(target: Element): void;\n hold?(target: Element): void;\n holdSelector?: string;\n /** Presses starting inside these never swipe (buttons, inputs, chip rows). */\n ignoreSelector?: string;\n}\n\nexport const HOLD_MS = 450;\nconst DRAG_SLOP = 10;\nconst FLICK_MIN_DISTANCE = 40;\nconst FLICK_MIN_SPEED = 0.55;\n\nexport function swipeThreshold(width: number): number {\n return Math.max(70, Math.min(120, width * 0.2));\n}\n\nexport function dominantDirection(dx: number, dy: number): DeckDirection {\n return Math.abs(dx) >= Math.abs(dy) ? (dx > 0 ? \"right\" : \"left\") : dy < 0 ? \"up\" : \"down\";\n}\n\n/** Decide a release: commit a direction, or null to snap back. Pure, so it is tested alone. */\nexport function releaseDecision(\n dx: number,\n dy: number,\n speed: number,\n width: number,\n enabled: Partial<Record<DeckDirection, unknown>>,\n): DeckDirection | null {\n const dir = dominantDirection(dx, dy);\n if (!enabled[dir]) return null;\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n if (dist >= swipeThreshold(width)) return dir;\n if (dist > FLICK_MIN_DISTANCE && speed > FLICK_MIN_SPEED) return dir;\n return null;\n}\n\nexport function attachSwipe(root: HTMLElement, h: SwipeHandlers): () => void {\n let id: number | null = null;\n let sx = 0;\n let sy = 0;\n let dx = 0;\n let dy = 0;\n let mode: \"press\" | \"drag\" | \"held\" | null = null;\n let holdTimer: ReturnType<typeof setTimeout> | null = null;\n let downTarget: Element | null = null;\n let samples: { t: number; x: number; y: number }[] = [];\n const view = root.ownerDocument.defaultView ?? window;\n\n const clearHold = () => {\n if (holdTimer) clearTimeout(holdTimer);\n holdTimer = null;\n root.querySelectorAll(\"[data-sd-press]\").forEach((el) => el.removeAttribute(\"data-sd-press\"));\n };\n\n const width = () => root.getBoundingClientRect().width || view.innerWidth;\n\n const onDown = (e: PointerEvent) => {\n if (id !== null || e.button > 0 || !h.enabled()) return;\n const target = e.target instanceof Element ? e.target : null;\n if (!target || target.closest(h.ignoreSelector ?? \"button, a, input, textarea, [data-sd-noswipe]\")) return;\n id = e.pointerId;\n sx = e.clientX;\n sy = e.clientY;\n dx = dy = 0;\n mode = \"press\";\n downTarget = target;\n samples = [{ t: e.timeStamp, x: e.clientX, y: e.clientY }];\n h.start?.();\n const holdable = h.hold && h.holdSelector ? target.closest(h.holdSelector) : null;\n if (holdable) {\n holdable.setAttribute(\"data-sd-press\", \"\");\n holdTimer = setTimeout(() => {\n if (mode !== \"press\") return;\n mode = \"held\";\n clearHold();\n buzz(view.navigator, 10);\n h.hold?.(holdable);\n }, HOLD_MS);\n }\n view.addEventListener(\"pointermove\", onMove);\n view.addEventListener(\"pointerup\", onUp);\n view.addEventListener(\"pointercancel\", onCancel);\n };\n\n const onMove = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n dx = e.clientX - sx;\n dy = e.clientY - sy;\n samples.push({ t: e.timeStamp, x: e.clientX, y: e.clientY });\n if (samples.length > 8) samples.shift();\n if (mode === \"press\" && Math.hypot(dx, dy) > DRAG_SLOP) {\n clearHold();\n mode = \"drag\";\n }\n if (mode !== \"drag\") return;\n const dir = dominantDirection(dx, dy);\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n h.move(dx, dy, h.directions()[dir] ? dir : null, dist / swipeThreshold(width()));\n };\n\n const detach = () => {\n view.removeEventListener(\"pointermove\", onMove);\n view.removeEventListener(\"pointerup\", onUp);\n view.removeEventListener(\"pointercancel\", onCancel);\n };\n\n const speedNow = (t: number) => {\n const recent = samples.filter((s) => t - s.t <= 100);\n const first = recent[0];\n const last = samples[samples.length - 1];\n if (!first || !last || last.t === first.t) return 0;\n return Math.hypot(last.x - first.x, last.y - first.y) / (last.t - first.t);\n };\n\n const onUp = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n detach();\n clearHold();\n const m = mode;\n id = null;\n mode = null;\n if (m === \"drag\") {\n const speed = speedNow(e.timeStamp);\n const dir = releaseDecision(dx, dy, speed, width(), h.directions());\n if (dir) h.commit(dir, speed);\n else h.release();\n } else if (m === \"press\" && downTarget) h.tap?.(downTarget);\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== id) return;\n detach();\n clearHold();\n const m = mode;\n id = null;\n mode = null;\n if (m === \"drag\") h.release();\n };\n\n const onContext = (e: Event) => {\n if (h.hold) e.preventDefault();\n };\n\n // iOS Safari: a vertical swipe while the page under the deck can scroll is taken by the page (the swipe\n // is cancelled, so \"up\" never answered there) unless the touch's own move is refused. Refused only while\n // this deck holds a press, and a vertical move only when the deck answers up or down (a two-way deck in a\n // chat lets the chat scroll).\n let touchFrom: { x: number; y: number } | null = null;\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n touchFrom = t ? { x: t.clientX, y: t.clientY } : null;\n };\n const onTouchMove = (e: TouchEvent) => {\n if (id === null || !e.cancelable) return;\n const t = e.touches[0];\n const mx = t && touchFrom ? t.clientX - touchFrom.x : dx;\n const my = t && touchFrom ? t.clientY - touchFrom.y : dy;\n const dirs = h.directions();\n if (Math.abs(my) > Math.abs(mx) && !dirs.up && !dirs.down) return;\n e.preventDefault();\n };\n\n root.addEventListener(\"pointerdown\", onDown);\n root.addEventListener(\"contextmenu\", onContext);\n root.addEventListener(\"touchstart\", onTouchStart, { passive: true });\n root.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n return () => {\n detach();\n clearHold();\n root.removeEventListener(\"pointerdown\", onDown);\n root.removeEventListener(\"contextmenu\", onContext);\n root.removeEventListener(\"touchstart\", onTouchStart);\n root.removeEventListener(\"touchmove\", onTouchMove);\n };\n}\n","/** Every word the deck draws: short, because in-app text is layout. A host overrides any of them. */\nexport interface SwipeDeckLabels {\n readonly suggestion: string;\n readonly reason: string;\n readonly exit: string;\n readonly help: string;\n readonly undo: string;\n readonly copy: string;\n readonly copied: string;\n readonly copyFailed: string;\n readonly part: string;\n readonly keep: string;\n readonly forget: string;\n readonly forgotten: string;\n readonly category: string;\n readonly addCategory: string;\n readonly newCategory: string;\n readonly done: string;\n readonly holdHint: string;\n readonly clickHint: string;\n readonly answer: string;\n readonly unanswered: string;\n readonly next: string;\n readonly undone: string;\n readonly pick: string;\n readonly expand: string;\n readonly collapse: string;\n readonly score: string;\n /** The end's headline when nothing else leads it. */\n readonly allDone: string;\n /** \"{answered} of {total} answered\". */\n readonly answeredOf: string;\n /** The end's list of answers. */\n readonly yourAnswers: string;\n /** On an answered item at the end: take this answer back and answer it again. */\n readonly change: string;\n readonly rightAnswer: string;\n readonly right: string;\n readonly wrong: string;\n readonly showAll: string;\n /** The finish's filter chips, by name. */\n readonly filterAnswers: string;\n /** The empty screen (no items). */\n readonly emptyTitle: string;\n /** The corner that opens every answer so far, and that list's title. */\n readonly answered: string;\n /** Leave the answered list for the card in focus. */\n readonly backToCards: string;\n}\n\nexport const DEFAULT_SWIPE_DECK_LABELS: SwipeDeckLabels = {\n suggestion: \"Suggestion\",\n reason: \"Reason\",\n exit: \"Exit\",\n help: \"Show me how\",\n undo: \"Undo\",\n copy: \"Copy\",\n copied: \"Copied\",\n copyFailed: \"Copy failed\",\n part: \"This part\",\n keep: \"Keep as is\",\n forget: \"Forget this\",\n forgotten: \"Forgotten\",\n category: \"Category\",\n addCategory: \"Add a category\",\n newCategory: \"New category\",\n done: \"Done\",\n holdHint: \"Hold any word\",\n clickHint: \"Double-click any word\",\n answer: \"Answer\",\n unanswered: \"Not answered\",\n next: \"Next\",\n undone: \"Undone\",\n pick: \"Pick one\",\n expand: \"Full screen\",\n collapse: \"Exit full screen\",\n score: \"Score\",\n allDone: \"All done\",\n answeredOf: \"{answered} of {total} answered\",\n yourAnswers: \"Your answers\",\n answered: \"Answered\",\n backToCards: \"Back to cards\",\n change: \"Change\",\n rightAnswer: \"Right answer\",\n right: \"Right\",\n wrong: \"Wrong\",\n showAll: \"All\",\n filterAnswers: \"Filter answers\",\n emptyTitle: \"Nothing to answer\",\n};\n","\"use client\";\n\n/**\n * THE PART SCREEN — one part of an item (a span of its words), answered with the same four swipes.\n *\n * Select the span by dragging either handle, sweeping across words, or tapping a word to grow or\n * shrink it; tag it from the category rows (\"+\" adds a missing category and gives that category its\n * own answer with the same swipe); place it; or forget it. Down keeps it as is.\n */\nimport * as React from \"react\";\n\nimport { Input } from \"../input\";\nimport { EraserIcon, PlusIcon, XIcon } from \"../icons\";\nimport { CornerButton, EdgeButtons, setHot, Wash, type EdgeRefs, type WashHandle } from \"./chrome\";\nimport { attachSwipe } from \"./gesture\";\nimport {\n answerOf,\n directionOf,\n KEEP_ANSWER_ID,\n partSuggestion,\n tokenize,\n type CategoryConflict,\n type DeckDirection,\n type DeckItem,\n type DeckKey,\n type DeckCategoryRow,\n type DeckPart,\n type DeckState,\n} from \"./model\";\nimport { fitText, flyOut, follow, keepFitted, snapBack } from \"./visual\";\nimport type { SwipeDeckLabels } from \"./labels\";\n\nexport interface PartScreenProps {\n readonly item: DeckItem;\n readonly parts: readonly DeckPart[];\n readonly initial: { start: number; end: number };\n readonly keyMap: DeckKey;\n /** The deck's key: what a category's answer means (flows down to parts). */\n readonly deckKey: DeckKey;\n readonly state: DeckState;\n readonly categories: readonly string[];\n /** Labelled chip rows (\"Who\", \"Cares about\"); each has its own \"+\". Absent: one row of every category. */\n readonly rows?: readonly DeckCategoryRow[] | undefined;\n readonly allowNewCategories: boolean;\n readonly conflict: CategoryConflict | undefined;\n readonly labels: SwipeDeckLabels;\n readonly onClose: () => void;\n readonly onPlace: (part: DeckPart) => void;\n readonly onForget: (span: { start: number; end: number }) => void;\n readonly onCategoryAnswer: (name: string, answer: string | null, row?: string) => void;\n readonly announce: (text: string) => void;\n}\n\nfunction overlapping(parts: readonly DeckPart[], s: number, e: number): DeckPart[] {\n return parts.filter((p) => !(p.end < s || p.start > e));\n}\n\nexport function PartScreen(props: PartScreenProps) {\n const { item, parts, keyMap, deckKey, state, labels, conflict } = props;\n const tokens = React.useMemo(() => tokenize(item.text), [item.text]);\n const exactAt = (s: number, e: number) => parts.find((p) => p.start === s && p.end === e) ?? null;\n const startPart = parts.find((p) => props.initial.start >= p.start && props.initial.start <= p.end) ?? null;\n const [sel, setSel] = React.useState(() => (startPart ? { s: startPart.start, e: startPart.end } : { s: props.initial.start, e: props.initial.end }));\n const [tagged, setTagged] = React.useState<readonly string[]>(() => startPart?.categories ?? []);\n /** The row whose \"+\" is open (\"\" when the deck has no rows), or null. */\n const [adding, setAdding] = React.useState<string | null>(null);\n const [draft, setDraft] = React.useState(\"\");\n /** Giving a just-added category its own answer: the phrase area shows the category instead. */\n const [categoryMode, setCategoryMode] = React.useState<string | null>(null);\n const [categoryModeRow, setCategoryModeRow] = React.useState<string | undefined>(undefined);\n const [extra, setExtra] = React.useState<readonly { name: string; row: string }[]>([]);\n const guard = React.useRef(true);\n const busy = React.useRef(false);\n\n React.useEffect(() => {\n const t = setTimeout(() => {\n guard.current = false;\n }, 350);\n return () => clearTimeout(t);\n }, []);\n\n const exact = exactAt(sel.s, sel.e);\n const draftPart: DeckPart = { start: sel.s, end: sel.e, categories: tagged, suggested: exact?.suggested ?? null, answer: exact?.answer ?? null };\n const suggestedId = categoryMode ? null : partSuggestion(draftPart, state, deckKey, conflict);\n const suggestedDir = directionOf(keyMap, suggestedId);\n const phrase = categoryMode ?? tokens.slice(sel.s, sel.e + 1).join(\" \").replace(/^[“\"‘'(\\[]+|[”\"’'.,;:!?)\\]]+$/g, \"\");\n const nowAnswer = exact ? answerOf(deckKey, exact.answer ?? partSuggestion(exact, state, deckKey, conflict)) : null;\n const allCategories = React.useMemo(\n () => [...props.categories, ...extra.map((x) => x.name).filter((c) => !props.categories.includes(c))],\n [props.categories, extra],\n );\n // The chip rows: the deck's rows (anything they do not name joins the first), or one row of every category.\n const chipRows = React.useMemo(() => {\n const given = props.rows?.length ? props.rows : null;\n if (!given) return [{ id: \"\", label: null as string | null, categories: allCategories }];\n const named = new Set(given.flatMap((r) => r.categories));\n const loose = allCategories.filter((c) => !named.has(c) && !extra.some((x) => x.name === c));\n return given.map((r, i) => ({\n id: r.id,\n label: r.label as string | null,\n categories: [...r.categories, ...(i === 0 ? loose : []), ...extra.filter((x) => x.row === r.id && !r.categories.includes(x.name)).map((x) => x.name)],\n }));\n }, [props.rows, allCategories, extra]);\n\n // ─── the swipe on the phrase ───────────────────────────────────────────\n const frameRef = React.useRef<HTMLDivElement>(null);\n const phraseRef = React.useRef<HTMLDivElement>(null);\n const edgeRefs = React.useRef<EdgeRefs>({});\n const wash = React.useRef<WashHandle>(null);\n\n const act = async (dir: DeckDirection, speed = 0) => {\n if (busy.current || guard.current) return;\n const answer = keyMap[dir];\n if (!answer) return;\n if (answer.id === KEEP_ANSWER_ID) {\n if (categoryMode) {\n setCategoryMode(null);\n return;\n }\n // Keep as is: the answer stays; a new span or a changed tag is still kept.\n const changed = !exact || exact.categories.join(\"\\u0000\") !== tagged.join(\"\\u0000\");\n if (changed && (exact || tagged.length)) props.onPlace(draftPart);\n props.onClose();\n return;\n }\n busy.current = true;\n wash.current?.show(answer, dir, 1);\n setHot(edgeRefs.current, dir);\n await flyOut(phraseRef.current, dir, speed);\n busy.current = false;\n if (categoryMode) {\n props.onCategoryAnswer(categoryMode, answer.id, categoryModeRow || undefined);\n props.announce(`${categoryMode}: ${answer.label}`);\n setCategoryMode(null);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n if (phraseRef.current) {\n phraseRef.current.style.transition = \"none\";\n phraseRef.current.style.transform = \"\";\n phraseRef.current.style.opacity = \"\";\n }\n return;\n }\n props.onPlace({ ...draftPart, answer: answer.id });\n props.announce(`${phrase}: ${answer.label}`);\n props.onClose();\n };\n const actRef = React.useRef(act);\n actRef.current = act;\n\n React.useEffect(() => {\n const root = frameRef.current;\n if (!root) return;\n return attachSwipe(root, {\n enabled: () => !busy.current && !guard.current,\n directions: () => keyMap,\n move: (dx, dy, dir, amount) => {\n const answer = dir ? keyMap[dir] : undefined;\n follow(phraseRef.current, dx, dy, dir && answer ? amount : 0);\n if (dir && answer) {\n wash.current?.show(answer, dir, amount);\n setHot(edgeRefs.current, amount >= 1 ? dir : null);\n } else {\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n }\n },\n release: () => {\n snapBack(phraseRef.current);\n wash.current?.hide();\n setHot(edgeRefs.current, null);\n },\n commit: (dir, speed) => void actRef.current(dir, speed),\n ignoreSelector: \"button, a, input, textarea, [data-sd-noswipe]\",\n });\n }, [keyMap]);\n\n // ─── selecting the span ────────────────────────────────────────────────\n const sentRef = React.useRef<HTMLDivElement>(null);\n const handleS = React.useRef<HTMLSpanElement>(null);\n const handleE = React.useRef<HTMLSpanElement>(null);\n const sweep = React.useRef<{ id: number; mode: \"s\" | \"e\" | \"sweep\"; anchor: number | null; moved: boolean } | null>(null);\n\n React.useLayoutEffect(() => {\n const box = sentRef.current;\n if (!box) return;\n const a = box.querySelector<HTMLElement>(`[data-sd-w=\"${sel.s}\"]`);\n const b = box.querySelector<HTMLElement>(`[data-sd-w=\"${sel.e}\"]`);\n const hs = handleS.current;\n const he = handleE.current;\n if (!a || !b || !hs || !he) return;\n const r = box.getBoundingClientRect();\n const ra = a.getBoundingClientRect();\n const rb = b.getBoundingClientRect();\n const st = box.scrollTop;\n hs.style.left = `${ra.left - r.left}px`;\n hs.style.top = `${ra.top - r.top + st - 12}px`;\n hs.style.height = `${ra.height + 22}px`;\n he.style.left = `${rb.right - r.left}px`;\n he.style.top = `${rb.top - r.top + st - 10}px`;\n he.style.height = `${rb.height + 22}px`;\n });\n\n const wordAt = (x: number, y: number): number | null => {\n const doc = sentRef.current?.ownerDocument;\n const el = doc?.elementFromPoint(x, y);\n const t = el?.closest(\"[data-sd-w], [data-sd-sp]\");\n if (!t || !sentRef.current?.contains(t)) return null;\n const v = t.getAttribute(\"data-sd-w\") ?? t.getAttribute(\"data-sd-sp\");\n return v === null ? null : Number(v);\n };\n\n const tapWord = (i: number) =>\n setSel(({ s, e }) => {\n if (i < s) return { s: i, e };\n if (i > e) return { s, e: i };\n if (s === e) return { s, e };\n if (i === s) return { s: s + 1, e };\n if (i === e) return { s, e: e - 1 };\n return { s: i, e: i };\n });\n\n const onSentDown = (ev: React.PointerEvent) => {\n if (guard.current || categoryMode) return;\n const target = ev.target instanceof Element ? ev.target : null;\n const handle = target?.closest(\"[data-sd-handle]\");\n const word = target?.closest(\"[data-sd-w]\");\n if (!handle && !word) return;\n ev.preventDefault();\n sweep.current = {\n id: ev.pointerId,\n mode: handle ? (handle.getAttribute(\"data-sd-handle\") === \"s\" ? \"s\" : \"e\") : \"sweep\",\n anchor: word ? Number(word.getAttribute(\"data-sd-w\")) : null,\n moved: false,\n };\n const view = sentRef.current?.ownerDocument.defaultView ?? window;\n const move = (e: PointerEvent) => {\n const sw = sweep.current;\n if (!sw || e.pointerId !== sw.id) return;\n const k = wordAt(e.clientX, e.clientY);\n if (k === null) return;\n if (sw.mode === \"s\") setSel(({ e: end }) => ({ s: Math.min(k, end), e: end }));\n else if (sw.mode === \"e\") setSel(({ s }) => ({ s, e: Math.max(k, s) }));\n else if (sw.anchor !== null && (k !== sw.anchor || sw.moved)) {\n sw.moved = true;\n const anchor = sw.anchor;\n setSel({ s: Math.min(k, anchor), e: Math.max(k, anchor) });\n }\n };\n const up = (e: PointerEvent) => {\n const sw = sweep.current;\n if (!sw || e.pointerId !== sw.id) return;\n view.removeEventListener(\"pointermove\", move);\n view.removeEventListener(\"pointerup\", up);\n view.removeEventListener(\"pointercancel\", up);\n if (sw.mode === \"sweep\" && !sw.moved && sw.anchor !== null) tapWord(sw.anchor);\n sweep.current = null;\n };\n view.addEventListener(\"pointermove\", move);\n view.addEventListener(\"pointerup\", up);\n view.addEventListener(\"pointercancel\", up);\n };\n\n // On open, the chosen words are in view (a late word in a long line sits below the capped box) and hold\n // the focus, so the keyboard can grow or shrink them at once.\n React.useEffect(() => {\n const word = sentRef.current?.querySelector<HTMLElement>(`[data-sd-w=\"${sel.s}\"]`);\n word?.scrollIntoView?.({ block: \"nearest\" });\n word?.focus({ preventScroll: true });\n // Open only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // When the span moves onto an existing part, its tags come with it.\n const lastSpan = React.useRef(`${sel.s}:${sel.e}`);\n React.useEffect(() => {\n const k = `${sel.s}:${sel.e}`;\n if (k === lastSpan.current) return;\n lastSpan.current = k;\n const hit = parts.find((p) => p.start === sel.s && p.end === sel.e);\n if (hit) setTagged(hit.categories);\n }, [sel, parts]);\n\n // ─── fit the phrase ────────────────────────────────────────────────────\n const stageRef = React.useRef<HTMLDivElement>(null);\n const pinRef = React.useRef<HTMLDivElement>(null);\n const textRef = React.useRef<HTMLParagraphElement>(null);\n React.useLayoutEffect(() => {\n const box = stageRef.current;\n if (!box || !pinRef.current || !textRef.current) return;\n return keepFitted(box, () => {\n if (pinRef.current && textRef.current) fitText(box, pinRef.current, textRef.current, 22, (box.ownerDocument.defaultView?.innerWidth ?? 0) >= 1024 ? 120 : 84);\n });\n }, [phrase, nowAnswer?.id, categoryMode]);\n\n const addCategory = () => {\n const name = draft.trim();\n const row = adding ?? \"\";\n setAdding(null);\n setDraft(\"\");\n if (!name) return;\n if (!allCategories.includes(name)) setExtra((x) => [...x, { name, row }]);\n setTagged((t) => (t.includes(name) ? t : [...t, name]));\n if (!state.categories[name]?.answer) {\n setCategoryMode(name);\n setCategoryModeRow(row);\n }\n };\n\n // Escape closes (keeping as is); the arrows answer.\n React.useEffect(() => {\n const view = frameRef.current?.ownerDocument.defaultView ?? window;\n const onKey = (e: KeyboardEvent) => {\n const t = e.target instanceof Element ? e.target : null;\n if (t?.closest(\"input, textarea, [contenteditable='true']\")) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const dir = ({ ArrowRight: \"right\", ArrowLeft: \"left\", ArrowUp: \"up\", ArrowDown: \"down\" } as const)[e.key as \"ArrowRight\"];\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopImmediatePropagation();\n if (categoryMode) setCategoryMode(null);\n else props.onClose();\n } else if (dir) {\n e.preventDefault();\n e.stopImmediatePropagation();\n // A held arrow places the part once.\n if (!e.repeat) void actRef.current(dir);\n }\n };\n view.addEventListener(\"keydown\", onKey, true);\n return () => view.removeEventListener(\"keydown\", onKey, true);\n }, [categoryMode, props]);\n\n // The first tagged chip is in view when the screen opens or the tags move.\n const chipsRef = React.useRef<HTMLDivElement>(null);\n const firstTag = tagged[0];\n React.useEffect(() => {\n const on = chipsRef.current?.querySelector<HTMLElement>('[aria-pressed=\"true\"]');\n on?.scrollIntoView?.({ block: \"nearest\", inline: \"center\" });\n }, [firstTag]);\n\n const canForget = !categoryMode && overlapping(parts, sel.s, sel.e).length > 0;\n\n return (\n <div ref={frameRef} className=\"matrx-sd-frame matrx-sd-partscreen\" role=\"dialog\" aria-modal=\"true\" aria-label={labels.part}>\n <CornerButton corner=\"tl\" label={labels.keep} shortcut=\"Escape\" onClick={() => (categoryMode ? setCategoryMode(null) : props.onClose())}>\n <XIcon />\n </CornerButton>\n <div className=\"matrx-sd-partbody\">\n <div ref={sentRef} className=\"matrx-sd-sentence\" data-sd-noswipe=\"\" data-dim={categoryMode ? \"\" : undefined} onPointerDown={onSentDown}>\n {tokens.map((t, i) => (\n <React.Fragment key={i}>\n {i > 0 ? (\n <span className=\"matrx-sd-space\" data-sd-sp={i} data-sel={i > sel.s && i <= sel.e ? \"\" : undefined}>\n {\" \"}\n </span>\n ) : null}\n <span\n className=\"matrx-sd-word\"\n tabIndex={0}\n role=\"button\"\n aria-pressed={i >= sel.s && i <= sel.e}\n onKeyDown={(e) => {\n // The keyboard's way to grow or shrink the words: Enter or Space on a word, as a tap does.\n if ((e.key === \"Enter\" || e.key === \" \") && !e.repeat && !categoryMode) {\n e.preventDefault();\n tapWord(i);\n }\n }}\n data-sd-w={i}\n data-sel={i >= sel.s && i <= sel.e ? \"\" : undefined}\n data-first={i === sel.s ? \"\" : undefined}\n data-last={i === sel.e ? \"\" : undefined}\n >\n {t}\n </span>\n </React.Fragment>\n ))}\n <span ref={handleS} className=\"matrx-sd-handle\" data-sd-handle=\"s\" aria-hidden=\"true\" />\n <span ref={handleE} className=\"matrx-sd-handle\" data-sd-handle=\"e\" aria-hidden=\"true\" />\n </div>\n <div ref={stageRef} className=\"matrx-sd-phrase-stage\">\n <div ref={phraseRef} className=\"matrx-sd-phrase\">\n <div ref={pinRef}>\n {categoryMode ? <div className=\"matrx-sd-kicker\">{labels.category}</div> : null}\n <p ref={textRef} className=\"matrx-sd-phrase-text\" data-quoted={categoryMode ? undefined : \"\"}>\n {phrase}\n </p>\n {nowAnswer && !categoryMode ? (\n <div className=\"matrx-sd-now\" data-tone={nowAnswer.tone}>\n <i />\n <span>{[nowAnswer.label, ...(exact?.categories ?? [])].join(\" · \")}</span>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n <div ref={chipsRef} className=\"matrx-sd-chip-rows\" data-sd-noswipe=\"\">\n {chipRows.map((row) => (\n <div key={row.id || \"all\"} className=\"matrx-sd-chips\" role=\"group\" aria-label={row.label ?? labels.category}>\n {row.label ? <span className=\"matrx-sd-chip-row-label\">{row.label}</span> : null}\n {row.categories.map((c) => {\n const on = tagged.includes(c);\n const ca = answerOf(deckKey, state.categories[c]?.answer);\n return (\n // ui-exception: category chips are the part screen's own toggle row\n <button\n key={c}\n type=\"button\"\n className=\"matrx-sd-chip\"\n aria-pressed={on}\n data-tone={ca?.tone}\n disabled={!!categoryMode}\n onClick={() => setTagged((t) => (on ? t.filter((x) => x !== c) : [...t, c]))}\n >\n {ca ? <i aria-hidden=\"true\" /> : null}\n {c}\n </button>\n );\n })}\n {props.allowNewCategories && !categoryMode ? (\n adding === row.id ? (\n <Input\n className=\"matrx-sd-chip-input\"\n autoFocus\n aria-label={labels.newCategory}\n enterKeyHint=\"done\"\n autoComplete=\"off\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={addCategory}\n onKeyDown={(e) => {\n e.stopPropagation();\n if (e.key === \"Enter\") {\n e.preventDefault();\n addCategory();\n } else if (e.key === \"Escape\") {\n setAdding(null);\n setDraft(\"\");\n }\n }}\n />\n ) : (\n // ui-exception: the chip row's own add target\n <button\n type=\"button\"\n className=\"matrx-sd-chip\"\n data-add=\"\"\n aria-label={row.label ? `${labels.addCategory}: ${row.label}` : labels.addCategory}\n title={labels.addCategory}\n onClick={() => setAdding(row.id)}\n >\n <PlusIcon />\n </button>\n )\n ) : null}\n </div>\n ))}\n </div>\n </div>\n <EdgeButtons keyMap={keyMap} suggested={suggestedDir} refs={edgeRefs} onAnswer={(d) => void act(d)} suggestionLabel={labels.suggestion} />\n {canForget ? (\n <CornerButton\n corner=\"br\"\n label={labels.forget}\n onClick={() => {\n if (guard.current) return;\n props.onForget({ start: sel.s, end: sel.e });\n props.onClose();\n }}\n >\n <EraserIcon />\n </CornerButton>\n ) : null}\n <Wash ref={wash} />\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full ${FIELD_SURFACE_CLASS} text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground\n focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-none\n transition duration-400\n [&:-webkit-autofill]:bg-card [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--card))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n `flex h-9 w-full rounded-md ${FIELD_SURFACE_CLASS} px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-50`,\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n /**\n * Where the prefix glyph sits. `default`: 12px in. `edge`: 8px in, so a field at the column's\n * padding puts its glyph on the same left edge as the icons of the rows under it (a sidebar's\n * Search over its rows; Arman, 2026-10-23: one left edge).\n */\n prefixInset?: \"default\" | \"edge\";\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, prefixInset = \"default\", className, wrapperClassName, ...props }, ref) => {\n const edge = prefixInset === \"edge\";\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 text-muted-foreground\",\n edge ? \"left-2\" : \"left-3\",\n )}\n data-prefix-inset={prefixInset}\n >\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && (edge ? \"pl-8\" : \"pl-10\"), className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE ONE FIELD SURFACE (page-pass shared fix, 2026-09-27).\n *\n * Every control a person types into or picks from — Input, BasicInput,\n * Textarea, the Select trigger, and the host's ProInput / ProTextarea — sits on\n * this fill and this border. They used to disagree: Input and the elevated\n * Textarea filled with `bg-background` (the gray page color in light mode),\n * BasicInput and the control Textarea were `bg-transparent` (gray on a gray\n * page), while the Select trigger filled with `bg-card` (white). On one form\n * the text fields therefore looked disabled beside white Selects\n * (/hr/settings/employer, the message-template editor) — a screen that lies\n * about what it will let you do.\n *\n * The surface is the Select's: the card fill and the regular border. A caller\n * that genuinely wants no fill (an inline cell editor) still passes\n * `bg-transparent`, which wins through `cn`.\n */\nexport const FIELD_SURFACE_CLASS = \"border border-border bg-card\";\n","\"use client\";\n\n/**\n * ExpandableSwipeDeck — the deck as a box in the flow (a chat message), fully usable where it is\n * (swipe, keys while focused, buttons, undo), with a corner that opens the SAME deck full screen.\n * Both views share one controller, so answers AND the undo history carry across; leaving full\n * screen (the corner, or Escape) returns to the box exactly where the person is.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useDeckController } from \"./controller\";\nimport { SwipeDeck, type SwipeDeckProps } from \"./SwipeDeck\";\n\nexport type ExpandableSwipeDeckProps = Omit<SwipeDeckProps, \"layout\" | \"onExpand\" | \"controller\" | \"onExit\" | \"exitKind\"> & {\n /** Full screen from the start (a host that opened the deck from elsewhere). */\n readonly defaultExpanded?: boolean;\n /** Told when the person opens or leaves full screen (a host may prefer its own canvas: return true to take it over). */\n readonly onExpandChange?: (expanded: boolean) => boolean | void;\n};\n\nexport function ExpandableSwipeDeck({ defaultExpanded = false, onExpandChange, ...props }: ExpandableSwipeDeckProps) {\n const controller = useDeckController({ items: props.items, binding: props.binding, initialState: props.initialState, onChange: props.onChange });\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const boxRef = React.useRef<HTMLDivElement>(null);\n const open = () => {\n if (onExpandChange?.(true) === true) return;\n setExpanded(true);\n };\n const close = () => {\n onExpandChange?.(false);\n setExpanded(false);\n // Back in the chat, the box holds the keys again.\n requestAnimationFrame(() => boxRef.current?.querySelector<HTMLElement>(\".matrx-sd\")?.focus({ preventScroll: true }));\n };\n const doc = typeof document === \"undefined\" ? null : document;\n return (\n <div ref={boxRef} className=\"matrx-sd-inline-host\">\n {expanded ? (\n // The box keeps its height while the deck is full screen, so the chat never jumps.\n <div className=\"matrx-sd\" data-layout=\"inline\" aria-hidden=\"true\" />\n ) : (\n <SwipeDeck {...props} layout=\"inline\" controller={controller} onExpand={open} />\n )}\n {expanded && doc\n ? createPortal(<SwipeDeck {...props} layout=\"fullscreen\" controller={controller} onExit={close} exitKind=\"collapse\" tourKey={null} />, doc.body)\n : null}\n </div>\n );\n}\n","/**\n * THE ONE READER of a `swipe_deck` kind value (what an agent writes) into the deck's own terms.\n *\n * Only `items[].text` is required; every other field is optional and nothing is invented for what is\n * absent. Directions are the agent's words: `suggested: \"right\"`, `answers: { up: null }`, a mark's\n * `lean: \"left\"`. An item's `choices` (2 to 8) become that item's own answers: the first four placed\n * clockwise from the top (2: right, left; 3: up, right, left; 4: up, right, down, left), any more as\n * buttons on the card; `correct` names a choice by its words (or a direction). Server declaration: aidream `aidream/kinds/swipe_deck.py`.\n */\nimport { DEFAULT_DECK_KEY, DECK_DIRECTIONS, askedItems, conditionProblems, mergeKey, readDeckCondition, type DeckAnswer, type DeckDirection, type DeckItem, type DeckKey, type DeckKeyOverride, type DeckTone } from \"./model\";\n\nexport interface SwipeDeckKindDeck {\n readonly title: string | null;\n readonly items: DeckItem[];\n /** The deck's key over the default; undefined when the value names none. */\n readonly answers: DeckKeyOverride | undefined;\n readonly pickOne: boolean;\n readonly categories: string[];\n /** Every item carries its own choices: the deck is a quiz-like set of questions. */\n readonly everyItemHasChoices: boolean;\n /** What the agent wrote that could not be honored (a right answer naming no choice, extra choices). Never silent: the host reports them. */\n readonly problems: string[];\n}\n\nconst TONES: readonly DeckTone[] = [\"success\", \"info\", \"destructive\", \"warning\", \"primary\", \"neutral\"];\nconst CHOICE_PLACES: Record<number, readonly DeckDirection[]> = {\n 2: [\"right\", \"left\"],\n 3: [\"up\", \"right\", \"left\"],\n 4: [\"up\", \"right\", \"down\", \"left\"],\n};\n/** Choice tones read as distinct options, never as right/wrong (no green, no red). */\nconst CHOICE_TONES: Record<DeckDirection, DeckTone> = { up: \"primary\", right: \"info\", down: \"warning\", left: \"neutral\" };\n\n/** A card holds four answers on its edges and four more as buttons. */\nconst MAX_CHOICES = 8;\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst text = (v: unknown): string => (typeof v === \"string\" ? v.trim() : typeof v === \"number\" ? String(v) : \"\");\nconst isDirection = (v: unknown): v is DeckDirection => typeof v === \"string\" && (DECK_DIRECTIONS as readonly string[]).includes(v);\n\nfunction answerOverride(raw: unknown): DeckKeyOverride | undefined {\n if (!isRecord(raw)) return undefined;\n const out: { -readonly [D in DeckDirection]?: DeckAnswer | null } = {};\n let any = false;\n for (const dir of DECK_DIRECTIONS) {\n if (!(dir in raw)) continue;\n const v = raw[dir];\n const base = DEFAULT_DECK_KEY[dir];\n if (v === null || v === false) {\n out[dir] = null;\n any = true;\n continue;\n }\n const label = isRecord(v) ? text(v.label) : text(v);\n if (!label || !base) continue;\n const tone = isRecord(v) && TONES.includes(v.tone as DeckTone) ? (v.tone as DeckTone) : base.tone;\n out[dir] = { ...base, label, tone };\n any = true;\n }\n return any ? out : undefined;\n}\n\nfunction norm(s: string): string {\n return s.trim().toLowerCase().replace(/\\s+/g, \" \");\n}\n\n/** Read a swipe_deck value; null when it holds no readable item (the host shows its stand-in). */\nexport function swipeDeckFromKindValue(value: unknown): SwipeDeckKindDeck | null {\n if (!isRecord(value)) return null;\n const answers = answerOverride(value.answers);\n const deckKey: DeckKey = mergeKey(DEFAULT_DECK_KEY, answers);\n const rawItems = Array.isArray(value.items) ? value.items : [];\n const items: DeckItem[] = [];\n const problems: string[] = [];\n const seenIds = new Set<string>();\n // Each item's own answer reader and its raw `show_if`, resolved once every item is known.\n const readers = new Map<string, (w: unknown) => string | undefined>();\n const rawShow = new Map<string, unknown>();\n const positions: string[] = [];\n let withChoices = 0;\n rawItems.forEach((raw, index) => {\n const r = isRecord(raw) ? raw : typeof raw === \"string\" ? { text: raw } : null;\n if (!r) return;\n const body = text(r.text) || text(r.statement) || text(r.question) || text(r.title);\n if (!body) return;\n const allChoices = (Array.isArray(r.choices) ? r.choices : Array.isArray(r.options) ? r.options : [])\n .map((c) => (isRecord(c) ? text(c.label) || text(c.text) : text(c)))\n .filter(Boolean);\n if (allChoices.length > MAX_CHOICES) problems.push(`Item ${index + 1} has ${allChoices.length} choices; a card holds ${MAX_CHOICES}, so the rest were left off.`);\n if (allChoices.length === 1) problems.push(`Item ${index + 1} has a single choice; the deck's own answers were used.`);\n const choiceWords = allChoices.slice(0, MAX_CHOICES);\n const places = choiceWords.length >= 2 ? CHOICE_PLACES[Math.min(4, choiceWords.length)] : undefined;\n let own: DeckKeyOverride | undefined;\n let more: DeckAnswer[] = [];\n let key = deckKey;\n if (places) {\n withChoices++;\n const o: { -readonly [D in DeckDirection]?: DeckAnswer | null } = { up: null, right: null, down: null, left: null };\n places.forEach((dir, i) => {\n o[dir] = { id: `choice_${i + 1}`, label: choiceWords[i] ?? \"\", tone: CHOICE_TONES[dir] };\n });\n own = o;\n key = mergeKey(deckKey, o);\n more = choiceWords.slice(4).map((label, i) => ({ id: `choice_${i + 5}`, label, tone: \"neutral\" as const }));\n }\n // An answer named by its words first (a choice may itself read \"left\"), then — for an item with\n // choices — by letter (\"B\", \"b)\") or number (1-based, or a 0-based number the agent counted from),\n // then by direction.\n const byWords = (w: unknown): string | undefined => {\n const t = text(w);\n if (!t) return undefined;\n for (const a of [...DECK_DIRECTIONS.map((d) => key[d]), ...more]) {\n if (a && (norm(a.label) === norm(t) || a.id === t)) return a.id;\n }\n if (places) {\n const stripped = norm(t.replace(/^\\(?[a-h1-8][).:]\\s+/i, \"\"));\n const byLabel = choiceWords.findIndex((c) => norm(c) === stripped);\n if (byLabel >= 0) return `choice_${byLabel + 1}`;\n const letter = /^\\(?([a-h])[).:]?$/i.exec(t);\n if (letter?.[1]) {\n const i = letter[1].toLowerCase().charCodeAt(0) - 97;\n if (i < choiceWords.length) return `choice_${i + 1}`;\n }\n const numeral = /^\\(?([1-8])[).:]?$/.exec(t);\n if (numeral?.[1] && Number(numeral[1]) <= choiceWords.length) return `choice_${numeral[1]}`;\n if (typeof w === \"number\" && Number.isInteger(w)) {\n if (w >= 1 && w <= choiceWords.length) return `choice_${w}`;\n if (w === 0) return \"choice_1\";\n }\n }\n if (isDirection(t)) return key[t]?.id;\n return undefined;\n };\n const correct = Array.isArray(r.correct) ? r.correct.map(byWords).filter((x): x is string => !!x) : byWords(r.correct);\n const correctGiven = Array.isArray(r.correct) ? r.correct.length > 0 : r.correct !== undefined && r.correct !== null && text(r.correct) !== \"\";\n if (correctGiven && (correct === undefined || (Array.isArray(correct) && !correct.length)))\n problems.push(`Item ${index + 1}'s right answer \"${Array.isArray(r.correct) ? r.correct.map(text).join(\", \") : text(r.correct)}\" names none of its choices, so it is not graded.`);\n const details = (Array.isArray(r.details) ? r.details : Array.isArray(r.fields) ? r.fields : [])\n .filter(isRecord)\n .map((d) => ({ label: text(d.label), value: text(d.value) }))\n .filter((d) => d.label && d.value);\n const marks = (Array.isArray(r.marks) ? r.marks : [])\n .filter(isRecord)\n .map((m) => ({\n phrase: text(m.phrase),\n categories: Array.isArray(m.categories) ? m.categories.map(text).filter(Boolean) : [],\n suggested: isDirection(m.lean) ? (key[m.lean]?.id ?? null) : null,\n }))\n .filter((m) => m.phrase);\n const suggested = byWords(r.suggested);\n let id = text(r.id) || `item_${index + 1}`;\n if (seenIds.has(id)) {\n problems.push(`Two items share the id \"${id}\"; the second was given its own.`);\n id = `${id}_${index + 1}`;\n }\n seenIds.add(id);\n readers.set(id, byWords);\n positions[index] = id;\n const show = r.show_if ?? r.showIf;\n if (show !== undefined && show !== null) rawShow.set(id, show);\n const item: DeckItem = {\n id,\n text: body,\n ...(text(r.kicker) ? { kicker: text(r.kicker) } : {}),\n ...(text(r.tag) ? { tag: text(r.tag) } : {}),\n ...(suggested ? { suggested } : {}),\n ...(text(r.reason) ? { reason: text(r.reason) } : {}),\n ...(details.length ? { fields: details } : {}),\n ...(own ? { answers: own } : {}),\n ...(more.length ? { more } : {}),\n ...(correct !== undefined && (typeof correct === \"string\" || correct.length) ? { correct } : {}),\n ...(text(r.group) ? { group: text(r.group) } : {}),\n ...(marks.length ? { parts: marks } : {}),\n };\n items.push(item);\n });\n if (!items.length) return null;\n // Conditions name a card by its id, its position (1-based) or its exact words, and its answers by\n // their words (or a letter, a number, a direction), as `correct` does.\n const byText = new Map(items.map((i) => [norm(i.text), i.id]));\n const refOf = (v: unknown): string => {\n const t = text(v);\n if (readers.has(t)) return t;\n if (typeof v === \"number\" && Number.isInteger(v) && positions[v - 1]) return positions[v - 1] ?? t;\n return byText.get(norm(t)) ?? t;\n };\n const shaped = items.map((item) => {\n const raw = rawShow.get(item.id);\n const showIf = raw === undefined ? null : readDeckCondition(raw, { ref: refOf, answer: (id, w) => readers.get(id)?.(w) ?? null });\n if (raw !== undefined && !showIf) problems.push(`\"${item.text}\" has a show_if the deck cannot read, so it is always asked.`);\n return showIf ? { ...item, showIf } : item;\n });\n problems.push(...conditionProblems(shaped, { key: deckKey }));\n return {\n title: text(value.title) || null,\n items: shaped,\n answers,\n pickOne: value.pick_one === true,\n categories: Array.isArray(value.categories) ? value.categories.map(text).filter(Boolean) : [],\n everyItemHasChoices: withChoices === items.length,\n problems,\n };\n}\n\n/** The deck's results as rows (one per item), for \"Save to a table\". Column names are words. */\nexport function swipeDeckResultRows(\n deck: SwipeDeckKindDeck,\n answers: Readonly<Record<string, string>>,\n): Record<string, string>[] {\n const deckKey = mergeKey(DEFAULT_DECK_KEY, deck.answers);\n const graded = deck.items.some((i) => i.correct !== undefined);\n // Only the cards that were asked: a card skipped by its condition has no row (its kept answer does not apply).\n const asked = askedItems(deck.items, { answers, picks: {}, parts: {}, categories: {} });\n return deck.items.filter((item) => asked.get(item.id)).map((item) => {\n const key = mergeKey(deckKey, item.answers);\n const all = [...DECK_DIRECTIONS.map((d) => key[d]), ...(item.more ?? [])];\n const id = answers[item.id];\n const answer = id ? all.find((a) => a?.id === id) : undefined;\n const row: Record<string, string> = {};\n if (deck.items.some((i) => i.kicker)) row.Kind = item.kicker ?? \"\";\n row.Item = item.text;\n row.Answer = answer?.label ?? \"\";\n if (graded) {\n const correct = item.correct === undefined ? [] : typeof item.correct === \"string\" ? [item.correct] : item.correct;\n row[\"Right answer\"] = correct.map((c) => all.find((a) => a?.id === c)?.label ?? \"\").filter(Boolean).join(\", \");\n row.Right = !id || !correct.length ? \"\" : correct.includes(id) ? \"Yes\" : \"No\";\n }\n return row;\n });\n}\n","/**\n * THE DECK'S LOGIC AS A GRAPH — and back. Cards are nodes; each condition is an arrow from the earlier\n * card whose answer it reads to the card it opens, labelled by the answers that open it. Editing the\n * graph (draw an arrow, delete one, pick its answers, choose whether a card needs ANY or ALL of its\n * arrows) rebuilds each card's `showIf`; reading it back gives the same graph. Pure data: any graph\n * editor (the diagram canvas, a test) works through these two functions.\n *\n * A condition the graph cannot draw (a `not`, a nested group) is kept exactly as written and the card is\n * marked `custom`: the graph shows it and leaves it alone until a person replaces it there.\n */\nimport { conditionProblems, findAnswer, keyFor, moreFor, type DeckAnswer, type DeckCondition, type DeckItem, type DeckRules } from \"./model\";\n\nexport interface DeckLogicEdge {\n /** Stable while the graph is edited: `from→to`. */\n readonly id: string;\n /** The earlier card whose answer is read. */\n readonly from: string;\n /** The card it opens. */\n readonly to: string;\n /** Answer ids that open it (empty with `isNot` empty: any answer at all). */\n readonly is: readonly string[];\n /** Answer ids that keep it closed. */\n readonly isNot: readonly string[];\n}\n\nexport interface DeckLogicCard {\n readonly id: string;\n readonly text: string;\n readonly kicker?: string;\n /** Every answer the card can take, edges first. */\n readonly answers: readonly DeckAnswer[];\n /** With two or more arrows in: does the card need any of them, or all? */\n readonly match: \"any\" | \"all\";\n /** Its condition is one the graph cannot draw; kept as written. */\n readonly custom: boolean;\n}\n\nexport interface DeckLogicGraph {\n readonly cards: readonly DeckLogicCard[];\n readonly edges: readonly DeckLogicEdge[];\n}\n\nconst list = (v: string | readonly string[] | undefined): string[] => (v === undefined ? [] : typeof v === \"string\" ? [v] : [...v]);\n\ntype Leaf = Extract<DeckCondition, { item: string }>;\nconst isLeaf = (c: DeckCondition): c is Leaf => \"item\" in c;\n\n/** The leaves of a drawable condition and how they combine, or null when it cannot be drawn. */\nfunction drawable(cond: DeckCondition): { match: \"any\" | \"all\"; leaves: Leaf[] } | null {\n const plain = (l: Leaf) => l.answered !== false;\n if (isLeaf(cond)) return plain(cond) ? { match: \"any\", leaves: [cond] } : null;\n // An empty group (never / always) and two leaves on the same earlier card cannot be drawn as\n // arrows without changing what they mean: kept as written (`custom`).\n const group = (list: readonly DeckCondition[], match: \"any\" | \"all\") => {\n if (!list.length || !list.every((c) => isLeaf(c) && plain(c))) return null;\n const leaves = list as Leaf[];\n return new Set(leaves.map((l) => l.item)).size === leaves.length ? { match, leaves } : null;\n };\n if (\"any\" in cond) return group(cond.any, \"any\");\n if (\"all\" in cond) return group(cond.all, \"all\");\n return null;\n}\n\nfunction answersOf(rules: DeckRules, item: DeckItem): DeckAnswer[] {\n const key = keyFor(rules, item);\n const edges = ([\"right\", \"up\", \"left\", \"down\"] as const).map((d) => key[d]).filter((a): a is DeckAnswer => !!a);\n return [...edges, ...moreFor(rules, item)];\n}\n\n/** The graph of a deck's logic. */\nexport function deckLogicGraph(items: readonly DeckItem[], rules: DeckRules): DeckLogicGraph {\n const edges: DeckLogicEdge[] = [];\n const cards = items.map((item): DeckLogicCard => {\n const drawn = item.showIf ? drawable(item.showIf) : { match: \"any\" as const, leaves: [] };\n if (drawn) {\n for (const leaf of drawn.leaves) {\n const id = `${leaf.item}→${item.id}`;\n const at = edges.findIndex((e) => e.id === id);\n const edge = { id, from: leaf.item, to: item.id, is: list(leaf.is), isNot: list(leaf.isNot) };\n // Two leaves on the same card pair (rare, hand-written) merge into one arrow.\n if (at >= 0) {\n const had = edges[at]!;\n edges[at] = { ...had, is: [...new Set([...had.is, ...edge.is])], isNot: [...new Set([...had.isNot, ...edge.isNot])] };\n } else edges.push(edge);\n }\n }\n return {\n id: item.id,\n text: item.text,\n ...(item.kicker ? { kicker: item.kicker } : {}),\n answers: answersOf(rules, item),\n match: drawn?.match ?? \"any\",\n custom: !drawn,\n };\n });\n return { cards, edges };\n}\n\n/**\n * The deck with each card's `showIf` rebuilt from the graph. A card with no arrows in is always asked;\n * one arrow is that leaf; more combine by the card's `match`. A `custom` card keeps its own condition.\n */\nexport function applyDeckLogic(items: readonly DeckItem[], graph: DeckLogicGraph): DeckItem[] {\n const byCard = new Map(graph.cards.map((c) => [c.id, c]));\n return items.map((item) => {\n const card = byCard.get(item.id);\n if (card?.custom) return item;\n const leaves: Leaf[] = graph.edges\n .filter((e) => e.to === item.id)\n .map((e) => ({ item: e.from, ...(e.is.length ? { is: [...e.is] } : {}), ...(e.isNot.length ? { isNot: [...e.isNot] } : {}) }));\n const { showIf: _old, ...rest } = item;\n if (!leaves.length) return rest;\n const showIf: DeckCondition = leaves.length === 1 ? leaves[0]! : card?.match === \"all\" ? { all: leaves } : { any: leaves };\n return { ...rest, showIf };\n });\n}\n\n/** An arrow's words: the answers that open the card (\"Yes · Sort of\", \"not No\", \"answered\"). */\nexport function logicEdgeLabel(edge: DeckLogicEdge, items: readonly DeckItem[], rules: DeckRules): string {\n const from = items.find((i) => i.id === edge.from);\n const words = (ids: readonly string[]) => ids.map((id) => (from ? (findAnswer(rules, from, id)?.label ?? id) : id));\n const parts = [...words(edge.is), ...words(edge.isNot).map((w) => `not ${w}`)];\n return parts.length ? parts.join(\" · \") : \"answered\";\n}\n\n/** Whether an arrow may be drawn: only from an EARLIER card (no loops), never onto itself or twice. */\nexport function canConnect(items: readonly DeckItem[], graph: DeckLogicGraph, from: string, to: string): string | null {\n const a = items.findIndex((i) => i.id === from);\n const b = items.findIndex((i) => i.id === to);\n if (a < 0 || b < 0) return \"That card is not in the deck.\";\n if (a === b) return \"A card cannot depend on itself.\";\n if (a > b) return \"A card can only depend on a card before it.\";\n if (graph.edges.some((e) => e.from === from && e.to === to)) return \"Those two cards are already joined.\";\n if (graph.cards.find((c) => c.id === to)?.custom) return \"This card has a rule the graph cannot draw. Select it and press Clear rule first.\";\n return null;\n}\n\n/** A new arrow, opened by the earlier card's first answer (its right edge's, usually Yes). */\nexport function newLogicEdge(items: readonly DeckItem[], rules: DeckRules, from: string, to: string): DeckLogicEdge {\n const source = items.find((i) => i.id === from);\n const first = source ? answersOf(rules, source)[0] : undefined;\n return { id: `${from}→${to}`, from, to, is: first ? [first.id] : [], isNot: [] };\n}\n\n/** What is wrong with the logic as drawn, in words (the deck's own checks). */\nexport function logicProblems(items: readonly DeckItem[], rules: DeckRules, graph: DeckLogicGraph): string[] {\n return conditionProblems(applyDeckLogic(items, graph), rules);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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orBox","import_jsx_runtime","React","text","import_jsx_runtime","Wash","React","text","list","list","kept","React","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","text","a","copyToClipboard","list","React","import_jsx_runtime","norm","plain","list"]}
|