@rebasepro/ui 0.21.0 → 0.21.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","names":[],"sources":["../src/styles.ts","../src/util/cls.ts","../src/util/debounce.ts","../src/util/hash.ts","../src/util/chip_colors.ts","../src/hooks/PortalContainerContext.tsx","../src/hooks/useInjectStyles.tsx","../src/hooks/useOutsideAlerter.tsx","../src/hooks/useDebouncedCallback.ts","../src/hooks/useDebounceCallback.tsx","../src/hooks/useDebounceValue.tsx","../src/hooks/useIsDarkMode.ts","../src/components/Collapse.tsx","../src/components/Autocomplete.tsx","../src/icons/icon_keys.ts","../src/icons/cool_icon_keys.ts","../src/icons/Icon.tsx","../src/icons/GitHubIcon.tsx","../src/icons/HandleIcon.tsx","../src/icons/LucideIconByName.tsx","../src/components/Alert.tsx","../src/components/Avatar.tsx","../src/components/BooleanSwitch.tsx","../src/components/BooleanSwitchWithLabel.tsx","../src/components/Button.tsx","../src/components/Card.tsx","../src/components/Container.tsx","../src/components/CenteredView.tsx","../src/components/CircularProgress.tsx","../src/components/Typography.tsx","../src/components/CircularProgressCenter.tsx","../src/util/lazy_chunk.ts","../src/components/ErrorBoundary.tsx","../src/components/Checkbox.tsx","../src/components/Chip.tsx","../src/components/Tooltip.tsx","../src/components/ColorPicker.tsx","../src/components/IconButton.tsx","../src/components/InputLabel.tsx","../src/components/DateTimeField.tsx","../src/components/Dialog.tsx","../src/components/DialogActions.tsx","../src/components/DialogContent.tsx","../src/components/DialogTitle.tsx","../src/components/ExpandablePanel.tsx","../src/components/FileUpload.tsx","../src/components/FilterChip.tsx","../src/components/InfoLabel.tsx","../src/components/Label.tsx","../src/components/LoadingButton.tsx","../src/components/Markdown.tsx","../src/components/Menu.tsx","../src/components/Menubar.tsx","../src/components/Separator.tsx","../src/components/common/SelectInputLabel.tsx","../src/components/MultiSelect.tsx","../src/components/Paper.tsx","../src/components/RadioGroup.tsx","../src/components/ResizablePanels.tsx","../src/components/SearchBar.tsx","../src/components/Select.tsx","../src/components/Slider.tsx","../src/components/Sheet.tsx","../src/components/TextareaAutosize.tsx","../src/components/TextField.tsx","../src/components/Tabs.tsx","../src/components/Table.tsx","../src/components/Popover.tsx","../src/components/Badge.tsx","../src/components/DebouncedTextField.tsx","../src/components/Skeleton.tsx","../src/components/ToggleButtonGroup.tsx","../src/components/VirtualTable/VirtualTableHeader.tsx","../src/components/VirtualTable/VirtualTableHeaderRow.tsx","../src/components/VirtualTable/VirtualTableRow.tsx","../src/components/VirtualTable/VirtualTableCell.tsx","../src/components/VirtualTable/VirtualTable.tsx","../src/components/VirtualTable/selection/SelectionStore.ts","../src/components/VirtualTable/selection/SelectionContext.tsx","../src/components/VirtualTable/fields/VirtualTableInput.tsx","../src/components/VirtualTable/fields/VirtualTableNumberInput.tsx","../src/components/VirtualTable/fields/VirtualTableSwitch.tsx","../src/components/VirtualTable/fields/VirtualTableDateField.tsx","../src/components/VirtualTable/fields/VirtualTableSelect.tsx","../src/views/ListView.tsx","../src/views/CardView.tsx","../src/views/Kanban/BoardSortableList.tsx","../src/views/Kanban/BoardColumnTitle.tsx","../src/views/Kanban/BoardColumn.tsx","../src/views/Kanban/placement.ts","../src/views/Kanban/Board.tsx","../src/views/KanbanView.tsx","../src/views/CollectionView/CollectionViewToolbar.tsx","../src/views/CollectionView/DefaultCellRenderer.tsx","../src/views/CollectionView/utils.ts","../src/views/CollectionView/CollectionTableView.tsx","../src/views/CollectionView/resolveTitleProperty.ts","../src/views/CollectionView/CollectionCardView.tsx","../src/views/CollectionView/CollectionListView.tsx","../src/views/CollectionView/CollectionKanbanView.tsx","../src/views/CollectionView/CollectionView.tsx"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Control size scale — the single source of truth for how tall an inline\n// control is.\n//\n// Every control that sits on a line with another control (buttons, text\n// fields, selects, search bars, date fields, icon buttons, checkboxes) resolves\n// its height from this map, so a Button and a TextField at the same `size` are\n// pixel-identical and share a baseline. Before this existed each component\n// carried its own map and `size=\"large\"` meant 42px on a Button and 64px on a\n// TextField.\n//\n// The scale is 28/32/40/48 — the rhythm IconButton and Checkbox already used.\n// `xl`/`2xl` continue above it and are button-only.\n// ---------------------------------------------------------------------------\n\nexport type ControlSize = \"smallest\" | \"small\" | \"medium\" | \"large\";\nexport type ButtonSize = ControlSize | \"xl\" | \"2xl\";\n\nexport const CONTROL_HEIGHT = {\n smallest: 28,\n small: 32,\n medium: 40,\n large: 48,\n xl: 56,\n \"2xl\": 64\n} as const satisfies Record<ButtonSize, number>;\n\n/** Tailwind min-height class per control size. Keep in sync with CONTROL_HEIGHT. */\nexport const controlHeightMixin = {\n smallest: \"min-h-[28px]\",\n small: \"min-h-[32px]\",\n medium: \"min-h-[40px]\",\n large: \"min-h-[48px]\",\n xl: \"min-h-[56px]\",\n \"2xl\": \"min-h-[64px]\"\n} as const satisfies Record<ButtonSize, string>;\n\n/** Horizontal padding paired with each size, so gutters scale with height. */\nexport const controlPaddingMixin = {\n smallest: \"px-2\",\n small: \"px-2\",\n medium: \"px-3\",\n large: \"px-4\",\n xl: \"px-6\",\n \"2xl\": \"px-10\"\n} as const satisfies Record<ButtonSize, string>;\n\n/**\n * Suppress the focus ring on a surface that is focusable but is not a control —\n * a popover panel, a menu container, a bare cell input inside a table that\n * indicates focus by other means.\n *\n * Still expressed as `ring-0`, and that is why the default ring in\n * `index.css` overrides `--tw-ring-shadow` rather than switching to\n * `inset-ring-*`: `inset-ring` is a different variable, which this would not\n * have silenced, and every surface that had opted out would have got a ring\n * back.\n */\nexport const focusedDisabled = \"focus-visible:ring-0 focus-visible:ring-offset-0\";\nexport const focusedInvisibleMixin = \"focus:bg-surface-field-hover\";\n\n/**\n * The focus ring, drawn OUTSIDE the element, for a control that opts into it.\n *\n * The product's default ring is the `:focus-visible` rule in `index.css`, and\n * that one is drawn *inside* the border box: an outset ring is paint beyond the\n * box, and any ancestor that clips — a scroller, a truncating cell, a\n * max-height collapse — cuts it. This one is still outset because its only\n * caller is a whole field row sitting inside `p-4`/`p-6` of card padding, where\n * there is room around it and nothing clipping within 16px. Reach for it only\n * where that is true; anywhere else, let the default apply.\n *\n * Three dead declarations were removed rather than reshuffled:\n * `outline-hidden` + `outline-none` — the same instruction twice.\n * `ring-primary` + `ring-primary/50` — the first could never win.\n * `ring-opacity-50` — Tailwind v3 syntax. v4 expresses\n * opacity with the `/50` slash form, so\n * this generated nothing at all.\n *\n * What is left is the ring that was actually rendering, at 60% rather than 50%:\n * on `surface-900` the old value sat close enough to the field's own border to\n * be missed at a glance, which is the one thing a focus ring may not be.\n * `ring-offset-0` + a transparent offset stay — without them the ring draws a\n * white halo on dark surfaces.\n */\nexport const focusedClasses = \"z-30 outline-none ring-2 ring-primary/60 ring-offset-0 ring-offset-transparent\";\n\n/**\n * Field surfaces.\n *\n * A field is the one surface that goes the other way: it is INSET into\n * whatever holds it, so `surface-field` is an alpha fill rather than a solid,\n * and it composes over a card, the sheet or a dialog alike. It also carries\n * the hairline: a field is an object (DESIGN.md rule 2), and without the line\n * a 4% fill on a card reads as a soft slab rather than a control — measured on\n * the product form, eight of them in a row looked like a wall. The reference\n * draws every input with its 1px edge, on both themes.\n *\n * The 1px inset top highlight that used to sit here was the recessed-edge\n * device from before the field had a border; with a real hairline above it\n * the two stacked into a doubled top edge. The border does its work now.\n *\n * Exactly one element carries this mixin per field — the box, never the\n * input inside it — so the alpha fill and its hover composite once.\n */\nexport const fieldBackgroundMixin = \"bg-surface-field border border-hairline\";\nexport const fieldBackgroundInvisibleMixin = \"bg-transparent\";\nexport const fieldBackgroundDisabledMixin = \"bg-surface-field/60\";\n\n/**\n * `transition-colors` here, because every other interactive surface in the kit\n * has it and fields did not — `cardClickableMixin` eases, a TextField snapped.\n * On a form of eight fields that difference is the whole feel of the screen.\n */\nexport const fieldBackgroundHoverMixin = \"transition-colors duration-150 hover:bg-surface-field-hover\";\n\n/**\n * The hairline. One value per theme (`--hairline` in theme.css), and where it\n * goes matters more than what it is: a line marks an OBJECT — a card on the\n * sheet, a field, a floating surface. It does not mark a region: a tile inside\n * a card, a row, a segmented track, a button, a chip are fills, and the\n * lightness step between them is the whole separation. One exception, and it\n * is the sheet's own edge against the frame: that step is about 3 L* on both\n * themes and did not read on a real screen, so the Scaffold draws this line\n * there. Measured before this existed, the panel drew the same line on every\n * card and every tile as well, and with only two surface values available the\n * line was doing the work a step should have done.\n */\nexport const defaultBorderMixin = \"border-hairline\";\n\n// ---------------------------------------------------------------------------\n// Surfaces are named by ROLE (see theme.css) and the theme decides the value.\n// Every nested surface is one step lifted from the surface it sits on, on both\n// themes. The reasoning and the measurements behind the ladder are in\n// docs/plans/surface-system-2026-09.md.\n//\n// Two kinds of card, and the difference is what the border is for.\n//\n// A **floating** surface — a menu, a dialog, a popover — sits OVER the page. It\n// has to be legible against whatever happens to be underneath it, so its edge\n// is definite: `hairline-strong`. That is `paperMixin`.\n//\n// A **page** surface — a card in the document flow — sits ON the sheet, and it\n// is already one step lighter than the sheet. It keeps a plain hairline, which\n// is all a card on the sheet needs; once the step is there the line is close\n// to optional, and a stronger one reads as a box drawn around content.\n// ---------------------------------------------------------------------------\nexport const paperMixin = \"bg-surface-card rounded-lg border border-hairline-strong\";\nexport const cardMixin = \"bg-surface-card rounded-xl border border-hairline\";\n\n/**\n * An inset well: code, a query, a log tail, a connection string.\n *\n * It must read as *recessed into* the surface holding it, which means darker\n * than that surface in dark mode. Cards now sit at `surface-card` (#181818),\n * so #0a0a0a is already fourteen units below and reads as a well; #000 was\n * tuned for the old #0a card and is now harsher than it needs to be. That value\n * is the `surface-well` role (theme.css), the one surface that goes DOWN the\n * ladder on purpose. Pair with `font-mono`; this mixin carries the surface\n * only.\n */\nexport const codeSurfaceMixin = \"bg-surface-well rounded-md\";\n\n/**\n * The accent, used as TEXT.\n *\n * `--color-primary` (#0070F4) is tuned to be a fill — white text on it, it on\n * white. Read as text on our dark surfaces it lands at **4.36:1 on a\n * `surface-900` card** (measured), which is below AA for body-sized text, and\n * every accent link in the product sits on exactly that surface. On the page's\n * `surface-950` it only reaches 4.62:1, so the margin was never real.\n *\n * `--color-primary-light` is the same hue lifted 0.15 in OKLCH lightness and\n * measures **7.34:1** on the same card. It is indistinguishable as \"the blue\"\n * and comfortably legible, so dark mode swaps to it for text.\n *\n * Use this for links, accent labels and any accent-coloured type. It is NOT for\n * fills — a filled button keeps `bg-primary`, where the contrast question runs\n * the other way and #0070F4 is already correct.\n */\nexport const accentTextMixin = \"text-primary dark:text-primary-light\";\n\n/**\n * Hover on a SOLID surface goes one step lighter, and it stays neutral. The\n * previous `hover:bg-primary/5` tinted every clickable card blue, which spent\n * the brand colour on a state that carries no meaning; on the dark ladder it\n * also read as a hue shift rather than a lift.\n */\nexport const cardClickableMixin = \"hover:bg-surface-card-hover cursor-pointer transition-colors duration-150\";\nexport const cardSelectedMixin = \"bg-primary-bg/30 dark:bg-primary-bg/10 ring-1 ring-primary/75\";\n\n/**\n * Hover on a TRANSPARENT ground — a nav item, a menu item, a list row, a tree\n * row. `surface-hover` is an alpha fill, so it lifts whatever it lands on by\n * the same amount, and `surface-active` is the same idea one step further for\n * the selected row when no hue is wanted. Do not use these on a solid card:\n * an alpha fill REPLACES a solid background rather than tinting it.\n */\nexport const surfaceHoverMixin = \"hover:bg-surface-hover transition-colors duration-150\";\nexport const surfaceActiveMixin = \"bg-surface-active\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cls(...classes: ClassValue[]) {\n return twMerge(clsx(classes));\n}\n\n\n","/**\n * @ignore\n */\n\nexport function debounce<T extends (...args: any[]) => unknown>(func: T, wait = 166) {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(this: unknown, ...args: Parameters<T>) {\n const later = () => {\n func.apply(this, args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n }\n\n debounced.clear = () => {\n clearTimeout(timeout);\n };\n\n return debounced as T & Cancelable;\n}\n\n/**\n * @ignore\n */\nexport interface Cancelable {\n clear(): void;\n}\n","export function hashString(str: string): number {\n let hash = 0;\n let i;\n let chr;\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return Math.abs(hash);\n}\n","import { hashString } from \"./hash\";\n\nexport type ChipColorScheme = {\n color: string;\n text: string;\n /** Background color override for dark mode */\n darkColor?: string;\n /** Text color override for dark mode */\n darkText?: string;\n /**\n * Ink for the `outlined` variant, which has no fill of its own.\n *\n * `text`/`darkText` are the ink ON the chip's own background. An outlined\n * chip drops that background and sits on the PAGE, so the same value is\n * being asked to be legible against two different surfaces at once — and\n * for most hues it cannot be. Splitting the roles is what lets the filled\n * ink follow its fill (often dark ink on a bright chip) without dragging\n * the outlined variant down with it.\n */\n outlineText?: string;\n /** Outlined-variant ink in dark mode. */\n darkOutlineText?: string;\n /**\n * The `tinted` variant: the hue's solid stop at low alpha, as an `rgba()`\n * string so it composes over a card, the sheet or a dialog alike, and an\n * ink MEASURED on what that tint reads as over the page. A tint is the\n * reference's rule for hue in the chrome — a 12–16% wash behind hue-coloured\n * text — and it is what a status or enum chip paints by default now; the\n * saturated `color` stop is the `filled` variant, kept for swatches.\n */\n tintColor?: string;\n tintText?: string;\n darkTintColor?: string;\n darkTintText?: string;\n}\n\n/* ────────────────────────────────────────────────────────────────────────────\n Contrast\n ────────────────────────────────────────────────────────────────────────────\n\n Chip ink is DERIVED, not hand-picked. It used to be written down per tone —\n `\"#fff\"` on every `solid` background, the hue's `pale` on every `deep` one —\n and an audit of all 120 hue/tone/mode pairs found **63 of them below WCAG AA**.\n The worst was white on `teal.solid` at **1.76:1**, which is not a near miss;\n it is unreadable. The palette is an Airtable-style one whose mid stops are\n bright enough to need dark ink, and hardcoding light ink ignored that.\n\n So the ink is measured against the background it will actually sit on, and\n pushed toward black or white only as far as it must go to clear the floor.\n Starting from the hue's own dark/light tints rather than from flat `#000`\n and `#fff` keeps the family looking like a family: `blue.solid` gets a very\n dark navy, not black.\n\n Deriving it also means a new hue cannot be added below AA — there is no\n per-tone ink to forget to check. */\n\n/** WCAG floor, plus a little margin so rounding cannot drop a pair below 4.5. */\nconst CONTRAST_TARGET = 4.6;\n\n/** Page backgrounds the outlined variant sits on: `bg-white` and `surface-950`. */\nconst PAGE_LIGHT = \"#ffffff\";\nconst PAGE_DARK = \"#181818\";\n\nfunction toRgb(hex: string): [number, number, number] {\n let h = hex.replace(\"#\", \"\");\n if (h.length === 3) h = h.split(\"\").map(c => c + c).join(\"\");\n return [0, 2, 4].map(i => parseInt(h.slice(i, i + 2), 16)) as [number, number, number];\n}\n\nfunction toHex(rgb: number[]): string {\n return \"#\" + rgb.map(v => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction toRgba(hex: string, alpha: number): string {\n const [r, g, b] = toRgb(hex);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n\n/**\n * What a translucent colour reads as over an opaque one: a per-channel sRGB\n * mix, which is how the browser composites it. The tint ink is pushed against\n * this, never against the page alone — a 16% wash of the hue moves the\n * background a long way toward the ink, and an ink that only cleared AA on\n * the bare page lands near 3.5:1 on its own tint.\n */\nexport function compositeOver(fgHex: string, alpha: number, bgHex: string): string {\n const fg = toRgb(fgHex);\n const bg = toRgb(bgHex);\n return toHex(fg.map((c, i) => alpha * c + (1 - alpha) * bg[i]));\n}\n\n/** Read an `rgba(r, g, b, a)` string back as what it composites to over `bgHex`. */\nexport function tintOnPage(rgba: string, bgHex: string): string {\n const m = rgba.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);\n if (!m) return rgba;\n const fg = toHex([Number(m[1]), Number(m[2]), Number(m[3])]);\n return compositeOver(fg, m[4] === undefined ? 1 : Number(m[4]), bgHex);\n}\n\n/**\n * Tint alpha by tone, light then dark. The tones keep meaning something in the\n * tinted variant — a `Darker` chip is a heavier wash, not a different hue —\n * and dark mode runs four points higher because the same alpha of a bright\n * hue reads fainter over near-black than over white.\n */\nconst TINT_ALPHA: Record<ChipTone, [light: number, dark: number]> = {\n Lighter: [0.10, 0.14],\n Light: [0.14, 0.18],\n Dark: [0.18, 0.22],\n Darker: [0.22, 0.26]\n};\n\nfunction relativeLuminance(hex: string): number {\n const [r, g, b] = toRgb(hex).map(v => {\n const c = v / 255;\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\nexport function contrastRatio(a: string, b: string): number {\n const x = relativeLuminance(a);\n const y = relativeLuminance(b);\n const [hi, lo] = x > y ? [x, y] : [y, x];\n return (hi + 0.05) / (lo + 0.05);\n}\n\nfunction mixHex(from: string, to: string, t: number): string {\n const A = toRgb(from);\n const B = toRgb(to);\n return toHex([0, 1, 2].map(i => A[i] + (B[i] - A[i]) * t));\n}\n\n/**\n * Walk a tinted ink toward black or white until it clears the floor on `bg`.\n *\n * Stops at the first passing step rather than going all the way, so the ink\n * keeps as much of its hue as legibility allows.\n */\nfunction push(base: string, toward: string, bg: string): string {\n for (let t = 0; t <= 1.0001; t += 0.02) {\n const candidate = mixHex(base, toward, t);\n if (contrastRatio(candidate, bg) >= CONTRAST_TARGET) return candidate;\n }\n return toward;\n}\n\n/** The ink for a chip filled with `bg`: whichever direction has more headroom. */\nfunction inkOn(stops: HueStops, bg: string): string {\n const dark = push(stops.text, \"#000000\", bg);\n const light = push(stops.onDeep ?? stops.pale, \"#ffffff\", bg);\n return contrastRatio(dark, bg) >= contrastRatio(light, bg) ? dark : light;\n}\n\n/**\n * The hues a chip can take, and the four stops each one is built from.\n *\n * `pale` and `mid` are backgrounds for dark text; `solid` and `deep` are\n * backgrounds for light text. `text` is the dark ink used on the two pale\n * stops, and `onDeep` the light ink on `deep` — it defaults to `pale`, and is\n * only set where a hue needs a tint of its own to stay legible.\n */\ntype HueStops = {\n pale: string;\n mid: string;\n solid: string;\n deep: string;\n text: string;\n onDeep?: string;\n}\n\nexport const CHIP_HUES = [\n \"blue\", \"cyan\", \"teal\", \"green\", \"yellow\", \"orange\", \"red\", \"pink\", \"purple\", \"gray\",\n \"indigo\", \"violet\", \"fuchsia\", \"rose\", \"emerald\"\n] as const;\n\nexport type ChipHue = typeof CHIP_HUES[number];\n\n/**\n * How light or saturated a chip of a given hue is.\n *\n * A hue on its own (`\"blue\"`) means `Lighter` — the tone the picker offers and\n * the one seeded chips used to be limited to.\n */\nexport type ChipTone = \"Lighter\" | \"Light\" | \"Dark\" | \"Darker\";\n\nexport type ChipColorKey = ChipHue | `${ChipHue}${ChipTone}`;\n\nconst HUE_STOPS: Record<ChipHue, HueStops> = {\n blue: { pale: \"#cfdfff\", mid: \"#9cc7ff\", solid: \"#2d7ff9\", deep: \"#2750ae\", text: \"#102046\" },\n cyan: { pale: \"#d0f0fd\", mid: \"#77d1f3\", solid: \"#18bfff\", deep: \"#0b76b7\", text: \"#04283f\" },\n teal: { pale: \"#c2f5e9\", mid: \"#72ddc3\", solid: \"#20d9d2\", deep: \"#06a09b\", text: \"#012524\", onDeep: \"#daf3e9\" },\n green: { pale: \"#d1f7c4\", mid: \"#93e088\", solid: \"#20c933\", deep: \"#338a17\", text: \"#0b1d05\" },\n yellow: { pale: \"#ffeab6\", mid: \"#ffd66e\", solid: \"#fcb400\", deep: \"#b87503\", text: \"#3b2501\" },\n orange: { pale: \"#fee2d5\", mid: \"#ffa981\", solid: \"#ff6f2c\", deep: \"#d74d26\", text: \"#6b2613\" },\n red: { pale: \"#ffdce5\", mid: \"#ff9eb7\", solid: \"#f82b60\", deep: \"#ba1e45\", text: \"#4c0c1c\" },\n pink: { pale: \"#ffdaf6\", mid: \"#f99de2\", solid: \"#ff08c2\", deep: \"#b2158b\", text: \"#400832\" },\n purple: { pale: \"#ede2fe\", mid: \"#cdb0ff\", solid: \"#8b46ff\", deep: \"#6b1cb0\", text: \"#280b42\" },\n gray: { pale: \"#eeeeee\", mid: \"#cccccc\", solid: \"#666666\", deep: \"#444444\", text: \"#040404\" },\n indigo: { pale: \"#e0e7ff\", mid: \"#a5b4fc\", solid: \"#6366f1\", deep: \"#4f46e5\", text: \"#312e81\" },\n violet: { pale: \"#ede9fe\", mid: \"#c4b5fd\", solid: \"#8b5cf6\", deep: \"#7c3aed\", text: \"#4c1d95\" },\n fuchsia: { pale: \"#fae8ff\", mid: \"#f0abfc\", solid: \"#d946ef\", deep: \"#c026d3\", text: \"#701a75\" },\n rose: { pale: \"#ffe4e6\", mid: \"#fda4af\", solid: \"#f43f5e\", deep: \"#e11d48\", text: \"#881337\" },\n emerald: { pale: \"#d1fae5\", mid: \"#6ee7b7\", solid: \"#10b981\", deep: \"#059669\", text: \"#064e3b\" }\n};\n\n/**\n * One tone of one hue.\n *\n * Backgrounds are the palette's, unchanged — the stops were not the problem and\n * moving them would have restyled every chip in the product. Only the ink moved,\n * and it moved to wherever the measurement says it has to be.\n */\nfunction tone(stops: HueStops, chipTone: ChipTone): ChipColorScheme {\n // The outlined variant is a property of the HUE, not of the tone: it has no\n // fill, so every tone of a hue sits on the same page background and wants\n // the same ink.\n const outline = {\n outlineText: push(stops.text, \"#000000\", PAGE_LIGHT),\n darkOutlineText: push(stops.onDeep ?? stops.pale, \"#ffffff\", PAGE_DARK)\n };\n\n // The tint is the SOLID stop washed out, on both themes, so a hue keeps\n // its identity across the two — a pale-stop tint of blue reads as grey.\n // Light ink starts from `deep` and dark ink from `mid`: the saturated end\n // that already sits on the right side of the composite, pushed only as\n // far as the measurement says.\n const [alphaLight, alphaDark] = TINT_ALPHA[chipTone];\n const tint = {\n tintColor: toRgba(stops.solid, alphaLight),\n tintText: push(stops.deep, \"#000000\", compositeOver(stops.solid, alphaLight, PAGE_LIGHT)),\n darkTintColor: toRgba(stops.solid, alphaDark),\n darkTintText: push(stops.mid, \"#ffffff\", compositeOver(stops.solid, alphaDark, PAGE_DARK))\n };\n\n const filled = (light: string, dark: string): ChipColorScheme => ({\n color: light,\n text: inkOn(stops, light),\n darkColor: dark,\n darkText: inkOn(stops, dark),\n ...outline,\n ...tint\n });\n\n switch (chipTone) {\n case \"Light\":\n return filled(stops.mid, stops.solid);\n case \"Dark\":\n return filled(stops.solid, stops.solid);\n case \"Darker\":\n return filled(stops.deep, stops.deep);\n case \"Lighter\":\n default:\n return filled(stops.pale, stops.deep);\n }\n}\n\nconst CHIP_TONES: ChipTone[] = [\"Lighter\", \"Light\", \"Dark\", \"Darker\"];\n\nfunction buildChipColors(): Record<ChipColorKey, ChipColorScheme> {\n const colors = {} as Record<ChipColorKey, ChipColorScheme>;\n for (const hue of CHIP_HUES) {\n const stops = HUE_STOPS[hue];\n for (const chipTone of CHIP_TONES) {\n colors[`${hue}${chipTone}` as ChipColorKey] = tone(stops, chipTone);\n }\n // The bare hue is the lightest tone, which is what every existing\n // `color: \"blue\"` in a collection config already means.\n colors[hue] = tone(stops, \"Lighter\");\n }\n return colors;\n}\n\n/**\n * Every chip scheme, keyed by hue and tone.\n *\n * This table used to hold four tones per hue and was flattened to one, which\n * left `blueDark`, `redDarker` and friends resolving to `undefined` — a chip\n * with a colour in its config rendering with no colour at all — and left seeded\n * chips picking from ten schemes, so a five-value enum routinely drew the same\n * background three times. The tones are generated from {@link HUE_STOPS} now,\n * so a new hue brings its whole family with it.\n */\nexport const CHIP_COLORS: Record<ChipColorKey, ChipColorScheme> = buildChipColors();\n\n/**\n * The keys a seeded chip may be assigned, in a stable order.\n *\n * The bare-hue aliases are excluded: they are the same scheme as `<hue>Lighter`\n * and would make the palest tone twice as likely as any other.\n */\nexport const CHIP_SEED_KEYS: ChipColorKey[] = CHIP_HUES.flatMap(\n hue => CHIP_TONES.map(chipTone => `${hue}${chipTone}` as ChipColorKey));\n\n// `string & {}` keeps the known keys in autocomplete while still accepting the\n// arbitrary column colours a board hands over.\nexport function getColorSchemeForKey(key: ChipColorKey | (string & {})): ChipColorScheme {\n // An unknown key is a config that names a colour this build does not have —\n // a renamed hue, or a value typed by hand. Seeding from the key keeps it\n // coloured and keeps it stable, rather than dropping it to no colour.\n return CHIP_COLORS[key as ChipColorKey] ?? getColorSchemeForSeed(String(key));\n}\n\nexport function getColorSchemeForSeed(seed: string): ChipColorScheme {\n const hash: number = hashString(seed);\n return CHIP_COLORS[CHIP_SEED_KEYS[hash % CHIP_SEED_KEYS.length]];\n}\n","\"use client\";\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nexport interface PortalContainerContextType {\n container: HTMLElement | null;\n}\n\nconst PortalContainerContext = createContext<PortalContainerContextType | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n container: HTMLElement | null;\n children: React.ReactNode;\n}\n\n/**\n * Provider component that sets the portal container for all descendants.\n * This can be used at any level of the tree to specify where portals should be attached.\n *\n * @example\n * ```tsx\n * const containerRef = useRef<HTMLDivElement>(null);\n *\n * <div ref={containerRef}>\n * <PortalContainerProvider container={containerRef.current}>\n * <YourComponents />\n * </PortalContainerProvider>\n * </div>\n * ```\n */\nexport function PortalContainerProvider({ container, children }: PortalContainerProviderProps) {\n const contextValue = useMemo(() => ({ container }), [container]);\n\n return (\n <PortalContainerContext.Provider value={contextValue}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Hook to access the portal container from context.\n * Returns null if no provider is found in the tree.\n *\n * @returns The portal container element or null\n */\nexport function usePortalContainer(): HTMLElement | null {\n const context = useContext(PortalContainerContext);\n return context?.container ?? null;\n}\n\n","\"use client\";\nimport { useEffect } from \"react\";\nimport { usePortalContainer } from \"./PortalContainerContext\";\n\n/**\n * Use this hook to create a `<style>` element and inject it into the DOM.\n * It checks if the style already exists, and if it does, it does not inject it again.\n * @param key\n * @param styles\n */\nexport function useInjectStyles(key: string, styles: string) {\n\n const portalContainer = usePortalContainer();\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n\n const targetContainer: HTMLElement | null = portalContainer ?? document.head;\n\n // Try to find an existing style element within the target container first\n const existingStyle = (targetContainer as HTMLElement).querySelector?.(`#${key}`) as HTMLStyleElement | null;\n\n if (!existingStyle) {\n const style = document.createElement(\"style\");\n style.id = key;\n style.innerHTML = styles;\n (targetContainer || document.head).appendChild(style);\n }\n }, []);\n\n}\n","\"use client\";\n\nimport { RefObject, useEffect } from \"react\";\n\n/**\n * Hook that alerts clicks outside the passed ref\n */\nexport function useOutsideAlerter(ref: RefObject<HTMLElement | null>, onOutsideClick: () => void, active = true): void {\n useEffect(() => {\n if (!active)\n return;\n\n /**\n * Alert if clicked on outside of element\n */\n function handleClickOutside(event: Event) {\n if (isInPresentationLayer(event.target as Node)) {\n return;\n }\n\n if (ref.current && !ref.current.contains(event.target as Node)) {\n onOutsideClick();\n }\n }\n\n // Bind the event listener\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n // Unbind the event listener on clean up\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [ref, active, onOutsideClick]);\n}\n\n/**\n * Check if any parent of the node is a presentation node\n * @param node\n */\nfunction isInPresentationLayer(node: Node | null): boolean {\n if (node instanceof HTMLElement) {\n if (node.getAttribute(\"role\") === \"presentation\")\n return true;\n return isInPresentationLayer(node.parentNode);\n }\n return false;\n}\n","import React from \"react\";\n\nexport function useDebouncedCallback<T>(value: T, callback: () => void, immediate: boolean, timeoutMs = 300) {\n\n const pendingUpdate = React.useRef(false);\n\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n const performUpdate = React.useCallback(() => {\n callbackRef.current();\n pendingUpdate.current = false;\n }, []);\n\n const handlerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n React.useEffect(\n () => {\n if (immediate) {\n clearTimeout(handlerRef.current);\n if (pendingUpdate.current) {\n performUpdate();\n }\n return;\n }\n\n pendingUpdate.current = true;\n clearTimeout(handlerRef.current);\n handlerRef.current = setTimeout(performUpdate, timeoutMs);\n return () => {\n if (immediate)\n performUpdate();\n };\n },\n [immediate, value, performUpdate, timeoutMs]\n );\n}\n","import { useCallback, useRef } from \"react\";\n\n\nexport function useDebounceCallback<T extends (...args: any[]) => unknown>(\n callback?: T,\n delay?: number\n): T {\n const timeoutRef = useRef<number | null>(null);\n\n const debouncedCallback = useCallback((...args: Parameters<T>) => {\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = window.setTimeout(() => {\n callback?.(...args);\n }, delay ?? 200);\n }, [callback, delay]);\n\n return debouncedCallback as T;\n}\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useDebounceValue<T>(value: T, delay = 300): T {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = useState(value);\n useEffect(\n () => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n },\n [value, delay] // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n}\n","import { useSyncExternalStore } from \"react\";\n\n/**\n * Whether the document is in dark mode right now, and re-rendered when that\n * changes.\n *\n * The theme is a class on `<html>` (`dark`, set by the panel's mode\n * controller) or a `data-theme` attribute (the marketing site). Components\n * that pick colours in JS rather than through CSS variables — `Chip` derives\n * its ink per theme — used to read the class once at render and never again,\n * so a theme switch left every chip on screen wearing the other theme's ink\n * until something else happened to re-render it. Subscribing through a\n * `MutationObserver` on the root's attributes makes the read live.\n */\nexport function useIsDarkMode(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nfunction getSnapshot(): boolean {\n if (typeof document === \"undefined\") return false;\n const root = document.documentElement;\n return root.classList.contains(\"dark\") || root.getAttribute(\"data-theme\") === \"dark\";\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nfunction subscribe(onChange: () => void): () => void {\n if (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-theme\"]\n });\n return () => observer.disconnect();\n}\n","\"use client\";\nimport React from \"react\";\nimport * as Collapsible from \"@radix-ui/react-collapsible\";\n\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\ninterface CollapseProps {\n children?: React.ReactNode;\n className?: string;\n in?: boolean;\n duration?: number;\n}\n\nexport const Collapse = React.memo(({\n children,\n className,\n in: isOpen = false,\n duration = 220\n }: CollapseProps) => {\n\n useInjectStyles(`Collapse-${duration}`, `\n.CollapseContent-${duration} {\n overflow: hidden;\n}\n.CollapseContent-${duration}[data-state='open'] {\n animation: slideDown ${duration}ms ease-out;\n}\n.CollapseContent-${duration}[data-state='closed'] {\n animation: slideUp ${duration}ms ease-in;\n}\n\n@keyframes slideDown {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n\n@keyframes slideUp {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n`);\n\n return (\n <Collapsible.Root\n open={isOpen}\n className={className}>\n\n <Collapsible.Content\n className={cls(`CollapseContent-${duration}`)}\n >\n {children}\n </Collapsible.Content>\n </Collapsible.Root>\n )\n});\n\nCollapse.displayName = \"Collapse\";\n","\"use client\";\nimport React from \"react\";\n\nimport { paperMixin } from \"../styles\";\nimport { Collapse } from \"./Collapse\";\nimport { cls } from \"../util\";\nimport { useOutsideAlerter } from \"../hooks\";\n\nexport type AutocompleteProps = {\n children: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n className?: string;\n}\n\nexport const useAutoComplete = ({ ref }: {\n ref: React.MutableRefObject<HTMLDivElement | null>;\n}) => {\n\n const [autoCompleteOpen, setAutoCompleteOpen] = React.useState(false);\n const [inputFocused, setInputFocused] = React.useState(false);\n\n // if ref is not focused, close autocomplete\n React.useEffect(() => {\n if (ref.current) {\n ref.current.onfocus = () => {\n setAutoCompleteOpen(true);\n setInputFocused(true);\n }\n ref.current.onblur = () => {\n setInputFocused(false);\n }\n }\n }, [ref]);\n\n return {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n };\n}\n\nexport function Autocomplete({\n children,\n open,\n setOpen,\n className\n }: AutocompleteProps) {\n\n const autocompleteRef = React.useRef<HTMLDivElement>(null);\n useOutsideAlerter(autocompleteRef, () => setOpen(false));\n\n return <Collapse\n in={open}\n duration={30}\n className={cls(\n \"absolute top-full left-0 right-0 overflow-visible\",\n open ? \"shadow-2xs\" : \"\",\n \"my-2\",\n \"z-20\",\n \"w-full\")}>\n <div ref={autocompleteRef}\n className={cls(\n open ? paperMixin : \"\",\n \"bg-surface-card\",\n className\n )}>\n {children}\n </div>\n </Collapse>;\n\n}\n\nexport type AutocompleteItemProps = {\n children: React.ReactNode,\n onClick?: () => void,\n className?: string\n};\n\nexport const AutocompleteItem = React.memo(function AutocompleteItem({\n children,\n onClick,\n className\n }: AutocompleteItemProps) {\n\n return (\n <div\n className={cls(\"flex w-full items-center h-[48px] cursor-pointer transition-colors duration-150 hover:bg-surface-hover\", className)}\n onClick={onClick}>\n {children}\n </div>\n )\n});\n","export const iconKeys = [\n \"AArrowDown\",\n \"AArrowUp\",\n \"ALargeSmall\",\n \"Accessibility\",\n \"Activity\",\n \"ActivitySquare\",\n \"AirVent\",\n \"Airplay\",\n \"AlarmCheck\",\n \"AlarmClock\",\n \"AlarmClockCheck\",\n \"AlarmClockMinus\",\n \"AlarmClockOff\",\n \"AlarmClockPlus\",\n \"AlarmMinus\",\n \"AlarmPlus\",\n \"AlarmSmoke\",\n \"Album\",\n \"AlertCircle\",\n \"AlertOctagon\",\n \"AlertTriangle\",\n \"AlignCenter\",\n \"AlignCenterHorizontal\",\n \"AlignCenterVertical\",\n \"AlignEndHorizontal\",\n \"AlignEndVertical\",\n \"AlignHorizontalDistributeCenter\",\n \"AlignHorizontalDistributeEnd\",\n \"AlignHorizontalDistributeStart\",\n \"AlignHorizontalJustifyCenter\",\n \"AlignHorizontalJustifyEnd\",\n \"AlignHorizontalJustifyStart\",\n \"AlignHorizontalSpaceAround\",\n \"AlignHorizontalSpaceBetween\",\n \"AlignJustify\",\n \"AlignLeft\",\n \"AlignRight\",\n \"AlignStartHorizontal\",\n \"AlignStartVertical\",\n \"AlignVerticalDistributeCenter\",\n \"AlignVerticalDistributeEnd\",\n \"AlignVerticalDistributeStart\",\n \"AlignVerticalJustifyCenter\",\n \"AlignVerticalJustifyEnd\",\n \"AlignVerticalJustifyStart\",\n \"AlignVerticalSpaceAround\",\n \"AlignVerticalSpaceBetween\",\n \"Ambulance\",\n \"Ampersand\",\n \"Ampersands\",\n \"Amphora\",\n \"Anchor\",\n \"Angry\",\n \"Annoyed\",\n \"Antenna\",\n \"Anvil\",\n \"Aperture\",\n \"AppWindow\",\n \"AppWindowMac\",\n \"Apple\",\n \"Archive\",\n \"ArchiveRestore\",\n \"ArchiveX\",\n \"AreaChart\",\n \"Armchair\",\n \"ArrowBigDown\",\n \"ArrowBigDownDash\",\n \"ArrowBigLeft\",\n \"ArrowBigLeftDash\",\n \"ArrowBigRight\",\n \"ArrowBigRightDash\",\n \"ArrowBigUp\",\n \"ArrowBigUpDash\",\n \"ArrowDown\",\n \"ArrowDown01\",\n \"ArrowDown10\",\n \"ArrowDownAZ\",\n \"ArrowDownCircle\",\n \"ArrowDownFromLine\",\n \"ArrowDownLeft\",\n \"ArrowDownLeftFromCircle\",\n \"ArrowDownLeftFromSquare\",\n \"ArrowDownLeftSquare\",\n \"ArrowDownNarrowWide\",\n \"ArrowDownRight\",\n \"ArrowDownRightFromCircle\",\n \"ArrowDownRightFromSquare\",\n \"ArrowDownRightSquare\",\n \"ArrowDownSquare\",\n \"ArrowDownToDot\",\n \"ArrowDownToLine\",\n \"ArrowDownUp\",\n \"ArrowDownWideNarrow\",\n \"ArrowDownZA\",\n \"ArrowLeft\",\n \"ArrowLeftCircle\",\n \"ArrowLeftFromLine\",\n \"ArrowLeftRight\",\n \"ArrowLeftSquare\",\n \"ArrowLeftToLine\",\n \"ArrowRight\",\n \"ArrowRightCircle\",\n \"ArrowRightFromLine\",\n \"ArrowRightLeft\",\n \"ArrowRightSquare\",\n \"ArrowRightToLine\",\n \"ArrowUp\",\n \"ArrowUp01\",\n \"ArrowUp10\",\n \"ArrowUpAZ\",\n \"ArrowUpCircle\",\n \"ArrowUpDown\",\n \"ArrowUpFromDot\",\n \"ArrowUpFromLine\",\n \"ArrowUpLeft\",\n \"ArrowUpLeftFromCircle\",\n \"ArrowUpLeftFromSquare\",\n \"ArrowUpLeftSquare\",\n \"ArrowUpNarrowWide\",\n \"ArrowUpRight\",\n \"ArrowUpRightFromCircle\",\n \"ArrowUpRightFromSquare\",\n \"ArrowUpRightSquare\",\n \"ArrowUpSquare\",\n \"ArrowUpToLine\",\n \"ArrowUpWideNarrow\",\n \"ArrowUpZA\",\n \"ArrowsUpFromLine\",\n \"Asterisk\",\n \"AsteriskSquare\",\n \"Astroid\",\n \"AtSign\",\n \"Atom\",\n \"AudioLines\",\n \"AudioWaveform\",\n \"Award\",\n \"Axe\",\n \"Axis3D\",\n \"Baby\",\n \"Backpack\",\n \"Badge\",\n \"BadgeAlert\",\n \"BadgeCent\",\n \"BadgeCheck\",\n \"BadgeDollarSign\",\n \"BadgeEuro\",\n \"BadgeHelp\",\n \"BadgeIndianRupee\",\n \"BadgeInfo\",\n \"BadgeJapaneseYen\",\n \"BadgeMinus\",\n \"BadgePercent\",\n \"BadgePlus\",\n \"BadgePoundSterling\",\n \"BadgeQuestionMark\",\n \"BadgeRussianRuble\",\n \"BadgeSwissFranc\",\n \"BadgeTurkishLira\",\n \"BadgeX\",\n \"BaggageClaim\",\n \"Balloon\",\n \"Ban\",\n \"Banana\",\n \"Bandage\",\n \"Banknote\",\n \"BanknoteArrowDown\",\n \"BanknoteArrowUp\",\n \"BanknoteX\",\n \"BarChart\",\n \"BarChart2\",\n \"BarChart3\",\n \"BarChart4\",\n \"BarChartBig\",\n \"BarChartHorizontal\",\n \"BarChartHorizontalBig\",\n \"Barcode\",\n \"Barrel\",\n \"Baseline\",\n \"Bath\",\n \"Battery\",\n \"BatteryCharging\",\n \"BatteryFull\",\n \"BatteryLow\",\n \"BatteryMedium\",\n \"BatteryPlus\",\n \"BatteryWarning\",\n \"Beaker\",\n \"Bean\",\n \"BeanOff\",\n \"Bed\",\n \"BedDouble\",\n \"BedSingle\",\n \"Beef\",\n \"BeefOff\",\n \"Beer\",\n \"BeerOff\",\n \"Bell\",\n \"BellCheck\",\n \"BellDot\",\n \"BellElectric\",\n \"BellMinus\",\n \"BellOff\",\n \"BellPlus\",\n \"BellRing\",\n \"BetweenHorizonalEnd\",\n \"BetweenHorizonalStart\",\n \"BetweenHorizontalEnd\",\n \"BetweenHorizontalStart\",\n \"BetweenVerticalEnd\",\n \"BetweenVerticalStart\",\n \"BicepsFlexed\",\n \"Bike\",\n \"Binary\",\n \"Binoculars\",\n \"Biohazard\",\n \"Bird\",\n \"Birdhouse\",\n \"Bitcoin\",\n \"Blend\",\n \"Blinds\",\n \"Blocks\",\n \"Bluetooth\",\n \"BluetoothConnected\",\n \"BluetoothOff\",\n \"BluetoothSearching\",\n \"Bold\",\n \"Bolt\",\n \"Bomb\",\n \"Bone\",\n \"Book\",\n \"BookA\",\n \"BookAlert\",\n \"BookAudio\",\n \"BookCheck\",\n \"BookCopy\",\n \"BookDashed\",\n \"BookDown\",\n \"BookHeadphones\",\n \"BookHeart\",\n \"BookImage\",\n \"BookKey\",\n \"BookLock\",\n \"BookMarked\",\n \"BookMinus\",\n \"BookOpen\",\n \"BookOpenCheck\",\n \"BookOpenText\",\n \"BookPlus\",\n \"BookSearch\",\n \"BookTemplate\",\n \"BookText\",\n \"BookType\",\n \"BookUp\",\n \"BookUp2\",\n \"BookUser\",\n \"BookX\",\n \"Bookmark\",\n \"BookmarkCheck\",\n \"BookmarkMinus\",\n \"BookmarkOff\",\n \"BookmarkPlus\",\n \"BookmarkX\",\n \"BoomBox\",\n \"Bot\",\n \"BotMessageSquare\",\n \"BotOff\",\n \"BottleWine\",\n \"BowArrow\",\n \"Box\",\n \"BoxSelect\",\n \"Boxes\",\n \"Braces\",\n \"Brackets\",\n \"Brain\",\n \"BrainCircuit\",\n \"BrainCog\",\n \"BrickWall\",\n \"BrickWallFire\",\n \"BrickWallShield\",\n \"Briefcase\",\n \"BriefcaseBusiness\",\n \"BriefcaseConveyorBelt\",\n \"BriefcaseMedical\",\n \"BringToFront\",\n \"Brush\",\n \"BrushCleaning\",\n \"Bubbles\",\n \"Bug\",\n \"BugOff\",\n \"BugPlay\",\n \"Building\",\n \"Building2\",\n \"Bus\",\n \"BusFront\",\n \"Cable\",\n \"CableCar\",\n \"Cake\",\n \"CakeSlice\",\n \"Calculator\",\n \"Calendar\",\n \"Calendar1\",\n \"CalendarArrowDown\",\n \"CalendarArrowUp\",\n \"CalendarCheck\",\n \"CalendarCheck2\",\n \"CalendarClock\",\n \"CalendarCog\",\n \"CalendarDays\",\n \"CalendarFold\",\n \"CalendarHeart\",\n \"CalendarMinus\",\n \"CalendarMinus2\",\n \"CalendarOff\",\n \"CalendarPlus\",\n \"CalendarPlus2\",\n \"CalendarRange\",\n \"CalendarSearch\",\n \"CalendarSync\",\n \"CalendarX\",\n \"CalendarX2\",\n \"Calendars\",\n \"Camera\",\n \"CameraOff\",\n \"CandlestickChart\",\n \"Candy\",\n \"CandyCane\",\n \"CandyOff\",\n \"Cannabis\",\n \"CannabisOff\",\n \"Captions\",\n \"CaptionsOff\",\n \"Car\",\n \"CarFront\",\n \"CarTaxiFront\",\n \"Caravan\",\n \"CardSim\",\n \"Carrot\",\n \"CaseLower\",\n \"CaseSensitive\",\n \"CaseUpper\",\n \"CassetteTape\",\n \"Cast\",\n \"Castle\",\n \"Cat\",\n \"Cctv\",\n \"CctvOff\",\n \"ChartArea\",\n \"ChartBar\",\n \"ChartBarBig\",\n \"ChartBarDecreasing\",\n \"ChartBarIncreasing\",\n \"ChartBarStacked\",\n \"ChartCandlestick\",\n \"ChartColumn\",\n \"ChartColumnBig\",\n \"ChartColumnDecreasing\",\n \"ChartColumnIncreasing\",\n \"ChartColumnStacked\",\n \"ChartGantt\",\n \"ChartLine\",\n \"ChartNetwork\",\n \"ChartNoAxesColumn\",\n \"ChartNoAxesColumnDecreasing\",\n \"ChartNoAxesColumnIncreasing\",\n \"ChartNoAxesCombined\",\n \"ChartNoAxesGantt\",\n \"ChartPie\",\n \"ChartScatter\",\n \"ChartSpline\",\n \"Check\",\n \"CheckCheck\",\n \"CheckCircle\",\n \"CheckCircle2\",\n \"CheckLine\",\n \"CheckSquare\",\n \"CheckSquare2\",\n \"ChefHat\",\n \"Cherry\",\n \"ChessBishop\",\n \"ChessKing\",\n \"ChessKnight\",\n \"ChessPawn\",\n \"ChessQueen\",\n \"ChessRook\",\n \"ChevronDown\",\n \"ChevronDownCircle\",\n \"ChevronDownSquare\",\n \"ChevronFirst\",\n \"ChevronLast\",\n \"ChevronLeft\",\n \"ChevronLeftCircle\",\n \"ChevronLeftSquare\",\n \"ChevronRight\",\n \"ChevronRightCircle\",\n \"ChevronRightSquare\",\n \"ChevronUp\",\n \"ChevronUpCircle\",\n \"ChevronUpSquare\",\n \"ChevronsDown\",\n \"ChevronsDownUp\",\n \"ChevronsLeft\",\n \"ChevronsLeftRight\",\n \"ChevronsLeftRightEllipsis\",\n \"ChevronsRight\",\n \"ChevronsRightLeft\",\n \"ChevronsUp\",\n \"ChevronsUpDown\",\n \"Church\",\n \"Cigarette\",\n \"CigaretteOff\",\n \"Circle\",\n \"CircleAlert\",\n \"CircleArrowDown\",\n \"CircleArrowLeft\",\n \"CircleArrowOutDownLeft\",\n \"CircleArrowOutDownRight\",\n \"CircleArrowOutUpLeft\",\n \"CircleArrowOutUpRight\",\n \"CircleArrowRight\",\n \"CircleArrowUp\",\n \"CircleCheck\",\n \"CircleCheckBig\",\n \"CircleChevronDown\",\n \"CircleChevronLeft\",\n \"CircleChevronRight\",\n \"CircleChevronUp\",\n \"CircleDashed\",\n \"CircleDivide\",\n \"CircleDollarSign\",\n \"CircleDot\",\n \"CircleDotDashed\",\n \"CircleEllipsis\",\n \"CircleEqual\",\n \"CircleFadingArrowUp\",\n \"CircleFadingPlus\",\n \"CircleGauge\",\n \"CircleHelp\",\n \"CircleMinus\",\n \"CircleOff\",\n \"CircleParking\",\n \"CircleParkingOff\",\n \"CirclePause\",\n \"CirclePercent\",\n \"CirclePile\",\n \"CirclePlay\",\n \"CirclePlus\",\n \"CirclePoundSterling\",\n \"CirclePower\",\n \"CircleQuestionMark\",\n \"CircleSlash\",\n \"CircleSlash2\",\n \"CircleSlashed\",\n \"CircleSmall\",\n \"CircleStar\",\n \"CircleStop\",\n \"CircleUser\",\n \"CircleUserRound\",\n \"CircleX\",\n \"CircuitBoard\",\n \"Citrus\",\n \"Clapperboard\",\n \"Clipboard\",\n \"ClipboardCheck\",\n \"ClipboardClock\",\n \"ClipboardCopy\",\n \"ClipboardEdit\",\n \"ClipboardList\",\n \"ClipboardMinus\",\n \"ClipboardPaste\",\n \"ClipboardPen\",\n \"ClipboardPenLine\",\n \"ClipboardPlus\",\n \"ClipboardSignature\",\n \"ClipboardType\",\n \"ClipboardX\",\n \"Clock\",\n \"Clock1\",\n \"Clock10\",\n \"Clock11\",\n \"Clock12\",\n \"Clock2\",\n \"Clock3\",\n \"Clock4\",\n \"Clock5\",\n \"Clock6\",\n \"Clock7\",\n \"Clock8\",\n \"Clock9\",\n \"ClockAlert\",\n \"ClockArrowDown\",\n \"ClockArrowUp\",\n \"ClockCheck\",\n \"ClockFading\",\n \"ClockPlus\",\n \"ClosedCaption\",\n \"Cloud\",\n \"CloudAlert\",\n \"CloudBackup\",\n \"CloudCheck\",\n \"CloudCog\",\n \"CloudDownload\",\n \"CloudDrizzle\",\n \"CloudFog\",\n \"CloudHail\",\n \"CloudLightning\",\n \"CloudMoon\",\n \"CloudMoonRain\",\n \"CloudOff\",\n \"CloudRain\",\n \"CloudRainWind\",\n \"CloudSnow\",\n \"CloudSun\",\n \"CloudSunRain\",\n \"CloudSync\",\n \"CloudUpload\",\n \"Cloudy\",\n \"Clover\",\n \"Club\",\n \"Code\",\n \"Code2\",\n \"CodeSquare\",\n \"CodeXml\",\n \"Coffee\",\n \"Cog\",\n \"Coins\",\n \"Columns\",\n \"Columns2\",\n \"Columns3\",\n \"Columns3Cog\",\n \"Columns4\",\n \"ColumnsSettings\",\n \"Combine\",\n \"Command\",\n \"Compass\",\n \"Component\",\n \"Computer\",\n \"ConciergeBell\",\n \"Cone\",\n \"Construction\",\n \"Contact\",\n \"Contact2\",\n \"ContactRound\",\n \"Container\",\n \"Contrast\",\n \"Cookie\",\n \"CookingPot\",\n \"Copy\",\n \"CopyCheck\",\n \"CopyMinus\",\n \"CopyPlus\",\n \"CopySlash\",\n \"CopyX\",\n \"Copyleft\",\n \"Copyright\",\n \"CornerDownLeft\",\n \"CornerDownRight\",\n \"CornerLeftDown\",\n \"CornerLeftUp\",\n \"CornerRightDown\",\n \"CornerRightUp\",\n \"CornerUpLeft\",\n \"CornerUpRight\",\n \"Cpu\",\n \"CreativeCommons\",\n \"CreditCard\",\n \"Croissant\",\n \"Crop\",\n \"Cross\",\n \"Crosshair\",\n \"Crown\",\n \"Cuboid\",\n \"CupSoda\",\n \"CurlyBraces\",\n \"Currency\",\n \"Cylinder\",\n \"Dam\",\n \"Database\",\n \"DatabaseBackup\",\n \"DatabaseSearch\",\n \"DatabaseZap\",\n \"DecimalsArrowLeft\",\n \"DecimalsArrowRight\",\n \"Delete\",\n \"Dessert\",\n \"Diameter\",\n \"Diamond\",\n \"DiamondMinus\",\n \"DiamondPercent\",\n \"DiamondPlus\",\n \"Dice1\",\n \"Dice2\",\n \"Dice3\",\n \"Dice4\",\n \"Dice5\",\n \"Dice6\",\n \"Dices\",\n \"Diff\",\n \"Disc\",\n \"Disc2\",\n \"Disc3\",\n \"DiscAlbum\",\n \"Divide\",\n \"DivideCircle\",\n \"DivideSquare\",\n \"Dna\",\n \"DnaOff\",\n \"Dock\",\n \"Dog\",\n \"DollarSign\",\n \"Donut\",\n \"DoorClosed\",\n \"DoorClosedLocked\",\n \"DoorOpen\",\n \"Dot\",\n \"DotSquare\",\n \"Download\",\n \"DownloadCloud\",\n \"DraftingCompass\",\n \"Drama\",\n \"Drill\",\n \"Drone\",\n \"Droplet\",\n \"DropletOff\",\n \"Droplets\",\n \"Drum\",\n \"Drumstick\",\n \"Dumbbell\",\n \"Ear\",\n \"EarOff\",\n \"Earth\",\n \"EarthLock\",\n \"Eclipse\",\n \"Edit\",\n \"Edit2\",\n \"Edit3\",\n \"Egg\",\n \"EggFried\",\n \"EggOff\",\n \"Ellipse\",\n \"Ellipsis\",\n \"EllipsisVertical\",\n \"Equal\",\n \"EqualApproximately\",\n \"EqualNot\",\n \"EqualSquare\",\n \"Eraser\",\n \"EthernetPort\",\n \"Euro\",\n \"EvCharger\",\n \"Expand\",\n \"ExternalLink\",\n \"Eye\",\n \"EyeClosed\",\n \"EyeOff\",\n \"Factory\",\n \"Fan\",\n \"FastForward\",\n \"Feather\",\n \"Fence\",\n \"FerrisWheel\",\n \"File\",\n \"FileArchive\",\n \"FileAudio\",\n \"FileAudio2\",\n \"FileAxis3D\",\n \"FileBadge\",\n \"FileBadge2\",\n \"FileBarChart\",\n \"FileBarChart2\",\n \"FileBox\",\n \"FileBraces\",\n \"FileBracesCorner\",\n \"FileChartColumn\",\n \"FileChartColumnIncreasing\",\n \"FileChartLine\",\n \"FileChartPie\",\n \"FileCheck\",\n \"FileCheck2\",\n \"FileCheckCorner\",\n \"FileClock\",\n \"FileCode\",\n \"FileCode2\",\n \"FileCodeCorner\",\n \"FileCog\",\n \"FileCog2\",\n \"FileDiff\",\n \"FileDigit\",\n \"FileDown\",\n \"FileEdit\",\n \"FileExclamationPoint\",\n \"FileHeadphone\",\n \"FileHeart\",\n \"FileImage\",\n \"FileInput\",\n \"FileJson\",\n \"FileJson2\",\n \"FileKey\",\n \"FileKey2\",\n \"FileLineChart\",\n \"FileLock\",\n \"FileLock2\",\n \"FileMinus\",\n \"FileMinus2\",\n \"FileMinusCorner\",\n \"FileMusic\",\n \"FileOutput\",\n \"FilePen\",\n \"FilePenLine\",\n \"FilePieChart\",\n \"FilePlay\",\n \"FilePlus\",\n \"FilePlus2\",\n \"FilePlusCorner\",\n \"FileQuestion\",\n \"FileQuestionMark\",\n \"FileScan\",\n \"FileSearch\",\n \"FileSearch2\",\n \"FileSearchCorner\",\n \"FileSignal\",\n \"FileSignature\",\n \"FileSliders\",\n \"FileSpreadsheet\",\n \"FileStack\",\n \"FileSymlink\",\n \"FileTerminal\",\n \"FileText\",\n \"FileType\",\n \"FileType2\",\n \"FileTypeCorner\",\n \"FileUp\",\n \"FileUser\",\n \"FileVideo\",\n \"FileVideo2\",\n \"FileVideoCamera\",\n \"FileVolume\",\n \"FileVolume2\",\n \"FileWarning\",\n \"FileX\",\n \"FileX2\",\n \"FileXCorner\",\n \"Files\",\n \"Film\",\n \"Filter\",\n \"FilterX\",\n \"Fingerprint\",\n \"FingerprintPattern\",\n \"FireExtinguisher\",\n \"Fish\",\n \"FishOff\",\n \"FishSymbol\",\n \"FishingHook\",\n \"FishingRod\",\n \"Flag\",\n \"FlagOff\",\n \"FlagTriangleLeft\",\n \"FlagTriangleRight\",\n \"Flame\",\n \"FlameKindling\",\n \"Flashlight\",\n \"FlashlightOff\",\n \"FlaskConical\",\n \"FlaskConicalOff\",\n \"FlaskRound\",\n \"FlipHorizontal\",\n \"FlipHorizontal2\",\n \"FlipVertical\",\n \"FlipVertical2\",\n \"Flower\",\n \"Flower2\",\n \"Focus\",\n \"FoldHorizontal\",\n \"FoldVertical\",\n \"Folder\",\n \"FolderArchive\",\n \"FolderBookmark\",\n \"FolderCheck\",\n \"FolderClock\",\n \"FolderClosed\",\n \"FolderCode\",\n \"FolderCog\",\n \"FolderCog2\",\n \"FolderDot\",\n \"FolderDown\",\n \"FolderEdit\",\n \"FolderGit\",\n \"FolderGit2\",\n \"FolderHeart\",\n \"FolderInput\",\n \"FolderKanban\",\n \"FolderKey\",\n \"FolderLock\",\n \"FolderMinus\",\n \"FolderOpen\",\n \"FolderOpenDot\",\n \"FolderOutput\",\n \"FolderPen\",\n \"FolderPlus\",\n \"FolderRoot\",\n \"FolderSearch\",\n \"FolderSearch2\",\n \"FolderSymlink\",\n \"FolderSync\",\n \"FolderTree\",\n \"FolderUp\",\n \"FolderX\",\n \"Folders\",\n \"Footprints\",\n \"ForkKnife\",\n \"ForkKnifeCrossed\",\n \"Forklift\",\n \"Form\",\n \"FormInput\",\n \"Forward\",\n \"Frame\",\n \"Frown\",\n \"Fuel\",\n \"Fullscreen\",\n \"FunctionSquare\",\n \"Funnel\",\n \"FunnelPlus\",\n \"FunnelX\",\n \"GalleryHorizontal\",\n \"GalleryHorizontalEnd\",\n \"GalleryThumbnails\",\n \"GalleryVertical\",\n \"GalleryVerticalEnd\",\n \"Gamepad\",\n \"Gamepad2\",\n \"GamepadDirectional\",\n \"GanttChart\",\n \"GanttChartSquare\",\n \"Gauge\",\n \"GaugeCircle\",\n \"Gavel\",\n \"Gem\",\n \"GeorgianLari\",\n \"Ghost\",\n \"Gift\",\n \"GitBranch\",\n \"GitBranchMinus\",\n \"GitBranchPlus\",\n \"GitCommit\",\n \"GitCommitHorizontal\",\n \"GitCommitVertical\",\n \"GitCompare\",\n \"GitCompareArrows\",\n \"GitFork\",\n \"GitGraph\",\n \"GitMerge\",\n \"GitMergeConflict\",\n \"GitPullRequest\",\n \"GitPullRequestArrow\",\n \"GitPullRequestClosed\",\n \"GitPullRequestCreate\",\n \"GitPullRequestCreateArrow\",\n \"GitPullRequestDraft\",\n \"GlassWater\",\n \"Glasses\",\n \"Globe\",\n \"Globe2\",\n \"GlobeLock\",\n \"GlobeOff\",\n \"GlobeX\",\n \"Goal\",\n \"Gpu\",\n \"Grab\",\n \"GraduationCap\",\n \"Grape\",\n \"Grid\",\n \"Grid2X2\",\n \"Grid2X2Check\",\n \"Grid2X2Plus\",\n \"Grid2X2X\",\n \"Grid3X3\",\n \"Grid3x2\",\n \"Grip\",\n \"GripHorizontal\",\n \"GripVertical\",\n \"Group\",\n \"Guitar\",\n \"Ham\",\n \"Hamburger\",\n \"Hammer\",\n \"Hand\",\n \"HandCoins\",\n \"HandFist\",\n \"HandGrab\",\n \"HandHeart\",\n \"HandHelping\",\n \"HandMetal\",\n \"HandPlatter\",\n \"Handbag\",\n \"Handshake\",\n \"HardDrive\",\n \"HardDriveDownload\",\n \"HardDriveUpload\",\n \"HardHat\",\n \"Hash\",\n \"HatGlasses\",\n \"Haze\",\n \"Hd\",\n \"HdmiPort\",\n \"Heading\",\n \"Heading1\",\n \"Heading2\",\n \"Heading3\",\n \"Heading4\",\n \"Heading5\",\n \"Heading6\",\n \"HeadphoneOff\",\n \"Headphones\",\n \"Headset\",\n \"Heart\",\n \"HeartCrack\",\n \"HeartHandshake\",\n \"HeartMinus\",\n \"HeartOff\",\n \"HeartPlus\",\n \"HeartPulse\",\n \"HeartX\",\n \"Heater\",\n \"Helicopter\",\n \"HelpCircle\",\n \"HelpingHand\",\n \"Hexagon\",\n \"Highlighter\",\n \"History\",\n \"Home\",\n \"Hop\",\n \"HopOff\",\n \"Hospital\",\n \"Hotel\",\n \"Hourglass\",\n \"House\",\n \"HouseHeart\",\n \"HousePlug\",\n \"HousePlus\",\n \"HouseWifi\",\n \"IceCream\",\n \"IceCream2\",\n \"IceCreamBowl\",\n \"IceCreamCone\",\n \"IdCard\",\n \"IdCardLanyard\",\n \"Image\",\n \"ImageDown\",\n \"ImageMinus\",\n \"ImageOff\",\n \"ImagePlay\",\n \"ImagePlus\",\n \"ImageUp\",\n \"ImageUpscale\",\n \"Images\",\n \"Import\",\n \"Inbox\",\n \"Indent\",\n \"IndentDecrease\",\n \"IndentIncrease\",\n \"IndianRupee\",\n \"Infinity\",\n \"Info\",\n \"Inspect\",\n \"InspectionPanel\",\n \"Italic\",\n \"IterationCcw\",\n \"IterationCw\",\n \"JapaneseYen\",\n \"Joystick\",\n \"Kanban\",\n \"KanbanSquare\",\n \"KanbanSquareDashed\",\n \"Kayak\",\n \"Key\",\n \"KeyRound\",\n \"KeySquare\",\n \"Keyboard\",\n \"KeyboardMusic\",\n \"KeyboardOff\",\n \"Lamp\",\n \"LampCeiling\",\n \"LampDesk\",\n \"LampFloor\",\n \"LampWallDown\",\n \"LampWallUp\",\n \"LandPlot\",\n \"Landmark\",\n \"Languages\",\n \"Laptop\",\n \"Laptop2\",\n \"LaptopMinimal\",\n \"LaptopMinimalCheck\",\n \"Lasso\",\n \"LassoSelect\",\n \"Laugh\",\n \"Layers\",\n \"Layers2\",\n \"Layers3\",\n \"LayersMinus\",\n \"LayersPlus\",\n \"Layout\",\n \"LayoutDashboard\",\n \"LayoutGrid\",\n \"LayoutList\",\n \"LayoutPanelLeft\",\n \"LayoutPanelTop\",\n \"LayoutTemplate\",\n \"Leaf\",\n \"LeafyGreen\",\n \"Lectern\",\n \"LensConcave\",\n \"LensConvex\",\n \"LetterText\",\n \"Library\",\n \"LibraryBig\",\n \"LibrarySquare\",\n \"LifeBuoy\",\n \"Ligature\",\n \"Lightbulb\",\n \"LightbulbOff\",\n \"LineChart\",\n \"LineDotRightHorizontal\",\n \"LineSquiggle\",\n \"LineStyle\",\n \"Link\",\n \"Link2\",\n \"Link2Off\",\n \"List\",\n \"ListCheck\",\n \"ListChecks\",\n \"ListChevronsDownUp\",\n \"ListChevronsUpDown\",\n \"ListCollapse\",\n \"ListEnd\",\n \"ListFilter\",\n \"ListFilterPlus\",\n \"ListIndentDecrease\",\n \"ListIndentIncrease\",\n \"ListMinus\",\n \"ListMusic\",\n \"ListOrdered\",\n \"ListPlus\",\n \"ListRestart\",\n \"ListStart\",\n \"ListTodo\",\n \"ListTree\",\n \"ListVideo\",\n \"ListX\",\n \"Loader\",\n \"Loader2\",\n \"LoaderCircle\",\n \"LoaderPinwheel\",\n \"Locate\",\n \"LocateFixed\",\n \"LocateOff\",\n \"LocationEdit\",\n \"Lock\",\n \"LockKeyhole\",\n \"LockKeyholeOpen\",\n \"LockOpen\",\n \"LogIn\",\n \"LogOut\",\n \"Logs\",\n \"Lollipop\",\n \"Luggage\",\n \"MSquare\",\n \"Magnet\",\n \"Mail\",\n \"MailCheck\",\n \"MailMinus\",\n \"MailOpen\",\n \"MailPlus\",\n \"MailQuestion\",\n \"MailQuestionMark\",\n \"MailSearch\",\n \"MailWarning\",\n \"MailX\",\n \"Mailbox\",\n \"Mails\",\n \"Map\",\n \"MapMinus\",\n \"MapPin\",\n \"MapPinCheck\",\n \"MapPinCheckInside\",\n \"MapPinHouse\",\n \"MapPinMinus\",\n \"MapPinMinusInside\",\n \"MapPinOff\",\n \"MapPinPen\",\n \"MapPinPlus\",\n \"MapPinPlusInside\",\n \"MapPinSearch\",\n \"MapPinX\",\n \"MapPinXInside\",\n \"MapPinned\",\n \"MapPlus\",\n \"Mars\",\n \"MarsStroke\",\n \"Martini\",\n \"Maximize\",\n \"Maximize2\",\n \"Medal\",\n \"Megaphone\",\n \"MegaphoneOff\",\n \"Meh\",\n \"MemoryStick\",\n \"Menu\",\n \"MenuSquare\",\n \"Merge\",\n \"MessageCircle\",\n \"MessageCircleCheck\",\n \"MessageCircleCode\",\n \"MessageCircleDashed\",\n \"MessageCircleHeart\",\n \"MessageCircleMore\",\n \"MessageCircleOff\",\n \"MessageCirclePlus\",\n \"MessageCircleQuestion\",\n \"MessageCircleQuestionMark\",\n \"MessageCircleReply\",\n \"MessageCircleWarning\",\n \"MessageCircleX\",\n \"MessageSquare\",\n \"MessageSquareCheck\",\n \"MessageSquareCode\",\n \"MessageSquareDashed\",\n \"MessageSquareDiff\",\n \"MessageSquareDot\",\n \"MessageSquareHeart\",\n \"MessageSquareLock\",\n \"MessageSquareMore\",\n \"MessageSquareOff\",\n \"MessageSquarePlus\",\n \"MessageSquareQuote\",\n \"MessageSquareReply\",\n \"MessageSquareShare\",\n \"MessageSquareText\",\n \"MessageSquareWarning\",\n \"MessageSquareX\",\n \"MessagesSquare\",\n \"Metronome\",\n \"Mic\",\n \"Mic2\",\n \"MicOff\",\n \"MicVocal\",\n \"Microchip\",\n \"Microscope\",\n \"Microwave\",\n \"Milestone\",\n \"Milk\",\n \"MilkOff\",\n \"Minimize\",\n \"Minimize2\",\n \"Minus\",\n \"MinusCircle\",\n \"MinusSquare\",\n \"MirrorRectangular\",\n \"MirrorRound\",\n \"Monitor\",\n \"MonitorCheck\",\n \"MonitorCloud\",\n \"MonitorCog\",\n \"MonitorDot\",\n \"MonitorDown\",\n \"MonitorOff\",\n \"MonitorPause\",\n \"MonitorPlay\",\n \"MonitorSmartphone\",\n \"MonitorSpeaker\",\n \"MonitorStop\",\n \"MonitorUp\",\n \"MonitorX\",\n \"Moon\",\n \"MoonStar\",\n \"MoreHorizontal\",\n \"MoreVertical\",\n \"Motorbike\",\n \"Mountain\",\n \"MountainSnow\",\n \"Mouse\",\n \"MouseLeft\",\n \"MouseOff\",\n \"MousePointer\",\n \"MousePointer2\",\n \"MousePointer2Off\",\n \"MousePointerBan\",\n \"MousePointerClick\",\n \"MousePointerSquareDashed\",\n \"MouseRight\",\n \"Move\",\n \"Move3D\",\n \"MoveDiagonal\",\n \"MoveDiagonal2\",\n \"MoveDown\",\n \"MoveDownLeft\",\n \"MoveDownRight\",\n \"MoveHorizontal\",\n \"MoveLeft\",\n \"MoveRight\",\n \"MoveUp\",\n \"MoveUpLeft\",\n \"MoveUpRight\",\n \"MoveVertical\",\n \"Music\",\n \"Music2\",\n \"Music3\",\n \"Music4\",\n \"Navigation\",\n \"Navigation2\",\n \"Navigation2Off\",\n \"NavigationOff\",\n \"Network\",\n \"Newspaper\",\n \"Nfc\",\n \"NonBinary\",\n \"Notebook\",\n \"NotebookPen\",\n \"NotebookTabs\",\n \"NotebookText\",\n \"NotepadText\",\n \"NotepadTextDashed\",\n \"Nut\",\n \"NutOff\",\n \"Octagon\",\n \"OctagonAlert\",\n \"OctagonMinus\",\n \"OctagonPause\",\n \"OctagonX\",\n \"Omega\",\n \"Option\",\n \"Orbit\",\n \"Origami\",\n \"Outdent\",\n \"Package\",\n \"Package2\",\n \"PackageCheck\",\n \"PackageMinus\",\n \"PackageOpen\",\n \"PackagePlus\",\n \"PackageSearch\",\n \"PackageX\",\n \"PaintBucket\",\n \"PaintRoller\",\n \"Paintbrush\",\n \"Paintbrush2\",\n \"PaintbrushVertical\",\n \"Palette\",\n \"Palmtree\",\n \"Panda\",\n \"PanelBottom\",\n \"PanelBottomClose\",\n \"PanelBottomDashed\",\n \"PanelBottomInactive\",\n \"PanelBottomOpen\",\n \"PanelLeft\",\n \"PanelLeftClose\",\n \"PanelLeftDashed\",\n \"PanelLeftInactive\",\n \"PanelLeftOpen\",\n \"PanelLeftRightDashed\",\n \"PanelRight\",\n \"PanelRightClose\",\n \"PanelRightDashed\",\n \"PanelRightInactive\",\n \"PanelRightOpen\",\n \"PanelTop\",\n \"PanelTopBottomDashed\",\n \"PanelTopClose\",\n \"PanelTopDashed\",\n \"PanelTopInactive\",\n \"PanelTopOpen\",\n \"PanelsLeftBottom\",\n \"PanelsLeftRight\",\n \"PanelsRightBottom\",\n \"PanelsTopBottom\",\n \"PanelsTopLeft\",\n \"Paperclip\",\n \"Parentheses\",\n \"ParkingCircle\",\n \"ParkingCircleOff\",\n \"ParkingMeter\",\n \"ParkingSquare\",\n \"ParkingSquareOff\",\n \"PartyPopper\",\n \"Pause\",\n \"PauseCircle\",\n \"PauseOctagon\",\n \"PawPrint\",\n \"PcCase\",\n \"Pen\",\n \"PenBox\",\n \"PenLine\",\n \"PenOff\",\n \"PenSquare\",\n \"PenTool\",\n \"Pencil\",\n \"PencilLine\",\n \"PencilOff\",\n \"PencilRuler\",\n \"Pentagon\",\n \"Percent\",\n \"PercentCircle\",\n \"PercentDiamond\",\n \"PercentSquare\",\n \"PersonStanding\",\n \"PhilippinePeso\",\n \"Phone\",\n \"PhoneCall\",\n \"PhoneForwarded\",\n \"PhoneIncoming\",\n \"PhoneMissed\",\n \"PhoneOff\",\n \"PhoneOutgoing\",\n \"Pi\",\n \"PiSquare\",\n \"Piano\",\n \"Pickaxe\",\n \"PictureInPicture\",\n \"PictureInPicture2\",\n \"PieChart\",\n \"PiggyBank\",\n \"Pilcrow\",\n \"PilcrowLeft\",\n \"PilcrowRight\",\n \"PilcrowSquare\",\n \"Pill\",\n \"PillBottle\",\n \"Pin\",\n \"PinOff\",\n \"Pipette\",\n \"Pizza\",\n \"Plane\",\n \"PlaneLanding\",\n \"PlaneTakeoff\",\n \"Play\",\n \"PlayCircle\",\n \"PlaySquare\",\n \"Plug\",\n \"Plug2\",\n \"PlugZap\",\n \"PlugZap2\",\n \"Plus\",\n \"PlusCircle\",\n \"PlusSquare\",\n \"PocketKnife\",\n \"Podcast\",\n \"Pointer\",\n \"PointerOff\",\n \"Popcorn\",\n \"Popsicle\",\n \"PoundSterling\",\n \"Power\",\n \"PowerCircle\",\n \"PowerOff\",\n \"PowerSquare\",\n \"Presentation\",\n \"Printer\",\n \"PrinterCheck\",\n \"PrinterX\",\n \"Projector\",\n \"Proportions\",\n \"Puzzle\",\n \"Pyramid\",\n \"QrCode\",\n \"Quote\",\n \"Rabbit\",\n \"Radar\",\n \"Radiation\",\n \"Radical\",\n \"Radio\",\n \"RadioOff\",\n \"RadioReceiver\",\n \"RadioTower\",\n \"Radius\",\n \"Rainbow\",\n \"Rat\",\n \"Ratio\",\n \"Receipt\",\n \"ReceiptCent\",\n \"ReceiptEuro\",\n \"ReceiptIndianRupee\",\n \"ReceiptJapaneseYen\",\n \"ReceiptPoundSterling\",\n \"ReceiptRussianRuble\",\n \"ReceiptSwissFranc\",\n \"ReceiptText\",\n \"ReceiptTurkishLira\",\n \"RectangleCircle\",\n \"RectangleEllipsis\",\n \"RectangleGoggles\",\n \"RectangleHorizontal\",\n \"RectangleVertical\",\n \"Recycle\",\n \"Redo\",\n \"Redo2\",\n \"RedoDot\",\n \"RefreshCcw\",\n \"RefreshCcwDot\",\n \"RefreshCw\",\n \"RefreshCwOff\",\n \"Refrigerator\",\n \"Regex\",\n \"RemoveFormatting\",\n \"Repeat\",\n \"Repeat1\",\n \"Repeat2\",\n \"RepeatOff\",\n \"Replace\",\n \"ReplaceAll\",\n \"Reply\",\n \"ReplyAll\",\n \"Rewind\",\n \"Ribbon\",\n \"Road\",\n \"Rocket\",\n \"RockingChair\",\n \"RollerCoaster\",\n \"Rose\",\n \"Rotate3D\",\n \"RotateCcw\",\n \"RotateCcwKey\",\n \"RotateCcwSquare\",\n \"RotateCw\",\n \"RotateCwSquare\",\n \"Route\",\n \"RouteOff\",\n \"Router\",\n \"Rows\",\n \"Rows2\",\n \"Rows3\",\n \"Rows4\",\n \"Rss\",\n \"Ruler\",\n \"RulerDimensionLine\",\n \"RussianRuble\",\n \"Sailboat\",\n \"Salad\",\n \"Sandwich\",\n \"Satellite\",\n \"SatelliteDish\",\n \"SaudiRiyal\",\n \"Save\",\n \"SaveAll\",\n \"SaveOff\",\n \"Scale\",\n \"Scale3D\",\n \"Scaling\",\n \"Scan\",\n \"ScanBarcode\",\n \"ScanEye\",\n \"ScanFace\",\n \"ScanHeart\",\n \"ScanLine\",\n \"ScanQrCode\",\n \"ScanSearch\",\n \"ScanText\",\n \"ScatterChart\",\n \"School\",\n \"School2\",\n \"Scissors\",\n \"ScissorsLineDashed\",\n \"ScissorsSquare\",\n \"ScissorsSquareDashedBottom\",\n \"Scooter\",\n \"ScreenShare\",\n \"ScreenShareOff\",\n \"Scroll\",\n \"ScrollText\",\n \"Search\",\n \"SearchAlert\",\n \"SearchCheck\",\n \"SearchCode\",\n \"SearchSlash\",\n \"SearchX\",\n \"Section\",\n \"Send\",\n \"SendHorizonal\",\n \"SendHorizontal\",\n \"SendToBack\",\n \"SeparatorHorizontal\",\n \"SeparatorVertical\",\n \"Server\",\n \"ServerCog\",\n \"ServerCrash\",\n \"ServerOff\",\n \"Settings\",\n \"Settings2\",\n \"Shapes\",\n \"Share\",\n \"Share2\",\n \"Sheet\",\n \"Shell\",\n \"ShelvingUnit\",\n \"Shield\",\n \"ShieldAlert\",\n \"ShieldBan\",\n \"ShieldCheck\",\n \"ShieldClose\",\n \"ShieldCog\",\n \"ShieldCogCorner\",\n \"ShieldEllipsis\",\n \"ShieldHalf\",\n \"ShieldMinus\",\n \"ShieldOff\",\n \"ShieldPlus\",\n \"ShieldQuestion\",\n \"ShieldQuestionMark\",\n \"ShieldUser\",\n \"ShieldX\",\n \"Ship\",\n \"ShipWheel\",\n \"Shirt\",\n \"ShoppingBag\",\n \"ShoppingBasket\",\n \"ShoppingCart\",\n \"Shovel\",\n \"ShowerHead\",\n \"Shredder\",\n \"Shrimp\",\n \"Shrink\",\n \"Shrub\",\n \"Shuffle\",\n \"Sidebar\",\n \"SidebarClose\",\n \"SidebarOpen\",\n \"Sigma\",\n \"SigmaSquare\",\n \"Signal\",\n \"SignalHigh\",\n \"SignalLow\",\n \"SignalMedium\",\n \"SignalZero\",\n \"Signature\",\n \"Signpost\",\n \"SignpostBig\",\n \"Siren\",\n \"SkipBack\",\n \"SkipForward\",\n \"Skull\",\n \"Slash\",\n \"SlashSquare\",\n \"Slice\",\n \"Sliders\",\n \"SlidersHorizontal\",\n \"SlidersVertical\",\n \"Smartphone\",\n \"SmartphoneCharging\",\n \"SmartphoneNfc\",\n \"Smile\",\n \"SmilePlus\",\n \"Snail\",\n \"Snowflake\",\n \"SoapDispenserDroplet\",\n \"Sofa\",\n \"SolarPanel\",\n \"SortAsc\",\n \"SortDesc\",\n \"Soup\",\n \"Space\",\n \"Spade\",\n \"Sparkle\",\n \"Sparkles\",\n \"Speaker\",\n \"Speech\",\n \"SpellCheck\",\n \"SpellCheck2\",\n \"Spline\",\n \"SplinePointer\",\n \"Split\",\n \"SplitSquareHorizontal\",\n \"SplitSquareVertical\",\n \"Spool\",\n \"SportShoe\",\n \"Spotlight\",\n \"SprayCan\",\n \"Sprout\",\n \"Square\",\n \"SquareActivity\",\n \"SquareArrowDown\",\n \"SquareArrowDownLeft\",\n \"SquareArrowDownRight\",\n \"SquareArrowLeft\",\n \"SquareArrowOutDownLeft\",\n \"SquareArrowOutDownRight\",\n \"SquareArrowOutUpLeft\",\n \"SquareArrowOutUpRight\",\n \"SquareArrowRight\",\n \"SquareArrowRightEnter\",\n \"SquareArrowRightExit\",\n \"SquareArrowUp\",\n \"SquareArrowUpLeft\",\n \"SquareArrowUpRight\",\n \"SquareAsterisk\",\n \"SquareBottomDashedScissors\",\n \"SquareCenterlineDashedHorizontal\",\n \"SquareCenterlineDashedVertical\",\n \"SquareChartGantt\",\n \"SquareCheck\",\n \"SquareCheckBig\",\n \"SquareChevronDown\",\n \"SquareChevronLeft\",\n \"SquareChevronRight\",\n \"SquareChevronUp\",\n \"SquareCode\",\n \"SquareDashed\",\n \"SquareDashedBottom\",\n \"SquareDashedBottomCode\",\n \"SquareDashedKanban\",\n \"SquareDashedMousePointer\",\n \"SquareDashedText\",\n \"SquareDashedTopSolid\",\n \"SquareDivide\",\n \"SquareDot\",\n \"SquareEqual\",\n \"SquareFunction\",\n \"SquareGanttChart\",\n \"SquareKanban\",\n \"SquareLibrary\",\n \"SquareM\",\n \"SquareMenu\",\n \"SquareMinus\",\n \"SquareMousePointer\",\n \"SquareParking\",\n \"SquareParkingOff\",\n \"SquarePause\",\n \"SquarePen\",\n \"SquarePercent\",\n \"SquarePi\",\n \"SquarePilcrow\",\n \"SquarePlay\",\n \"SquarePlus\",\n \"SquarePower\",\n \"SquareRadical\",\n \"SquareRoundCorner\",\n \"SquareScissors\",\n \"SquareSigma\",\n \"SquareSlash\",\n \"SquareSplitHorizontal\",\n \"SquareSplitVertical\",\n \"SquareSquare\",\n \"SquareStack\",\n \"SquareStar\",\n \"SquareStop\",\n \"SquareTerminal\",\n \"SquareUser\",\n \"SquareUserRound\",\n \"SquareX\",\n \"SquaresExclude\",\n \"SquaresIntersect\",\n \"SquaresSubtract\",\n \"SquaresUnite\",\n \"Squircle\",\n \"SquircleDashed\",\n \"Squirrel\",\n \"Stamp\",\n \"Star\",\n \"StarHalf\",\n \"StarOff\",\n \"Stars\",\n \"StepBack\",\n \"StepForward\",\n \"Stethoscope\",\n \"Sticker\",\n \"StickyNote\",\n \"Stone\",\n \"StopCircle\",\n \"Store\",\n \"StretchHorizontal\",\n \"StretchVertical\",\n \"Strikethrough\",\n \"Subscript\",\n \"Subtitles\",\n \"Sun\",\n \"SunDim\",\n \"SunMedium\",\n \"SunMoon\",\n \"SunSnow\",\n \"Sunrise\",\n \"Sunset\",\n \"Superscript\",\n \"SwatchBook\",\n \"SwissFranc\",\n \"SwitchCamera\",\n \"Sword\",\n \"Swords\",\n \"Syringe\",\n \"Table\",\n \"Table2\",\n \"TableCellsMerge\",\n \"TableCellsSplit\",\n \"TableColumnsSplit\",\n \"TableConfig\",\n \"TableOfContents\",\n \"TableProperties\",\n \"TableRowsSplit\",\n \"Tablet\",\n \"TabletSmartphone\",\n \"Tablets\",\n \"Tag\",\n \"Tags\",\n \"Tally1\",\n \"Tally2\",\n \"Tally3\",\n \"Tally4\",\n \"Tally5\",\n \"Tangent\",\n \"Target\",\n \"Telescope\",\n \"Tent\",\n \"TentTree\",\n \"Terminal\",\n \"TerminalSquare\",\n \"TestTube\",\n \"TestTube2\",\n \"TestTubeDiagonal\",\n \"TestTubes\",\n \"Text\",\n \"TextAlignCenter\",\n \"TextAlignEnd\",\n \"TextAlignJustify\",\n \"TextAlignStart\",\n \"TextCursor\",\n \"TextCursorInput\",\n \"TextInitial\",\n \"TextQuote\",\n \"TextSearch\",\n \"TextSelect\",\n \"TextSelection\",\n \"TextWrap\",\n \"Theater\",\n \"Thermometer\",\n \"ThermometerSnowflake\",\n \"ThermometerSun\",\n \"ThumbsDown\",\n \"ThumbsUp\",\n \"Ticket\",\n \"TicketCheck\",\n \"TicketMinus\",\n \"TicketPercent\",\n \"TicketPlus\",\n \"TicketSlash\",\n \"TicketX\",\n \"Tickets\",\n \"TicketsPlane\",\n \"Timeline\",\n \"Timer\",\n \"TimerOff\",\n \"TimerReset\",\n \"ToggleLeft\",\n \"ToggleRight\",\n \"Toilet\",\n \"ToolCase\",\n \"Toolbox\",\n \"Tornado\",\n \"Torus\",\n \"Touchpad\",\n \"TouchpadOff\",\n \"TowelRack\",\n \"TowerControl\",\n \"ToyBrick\",\n \"Tractor\",\n \"TrafficCone\",\n \"Train\",\n \"TrainFront\",\n \"TrainFrontTunnel\",\n \"TrainTrack\",\n \"TramFront\",\n \"Transgender\",\n \"Trash\",\n \"Trash2\",\n \"TreeDeciduous\",\n \"TreePalm\",\n \"TreePine\",\n \"Trees\",\n \"TrendingDown\",\n \"TrendingUp\",\n \"TrendingUpDown\",\n \"Triangle\",\n \"TriangleAlert\",\n \"TriangleDashed\",\n \"TriangleRight\",\n \"Trophy\",\n \"Truck\",\n \"TruckElectric\",\n \"TurkishLira\",\n \"Turntable\",\n \"Turtle\",\n \"Tv\",\n \"Tv2\",\n \"TvMinimal\",\n \"TvMinimalPlay\",\n \"Type\",\n \"TypeOutline\",\n \"Umbrella\",\n \"UmbrellaOff\",\n \"Underline\",\n \"Undo\",\n \"Undo2\",\n \"UndoDot\",\n \"UnfoldHorizontal\",\n \"UnfoldVertical\",\n \"Ungroup\",\n \"University\",\n \"Unlink\",\n \"Unlink2\",\n \"Unlock\",\n \"UnlockKeyhole\",\n \"Unplug\",\n \"Upload\",\n \"UploadCloud\",\n \"Usb\",\n \"User\",\n \"User2\",\n \"UserCheck\",\n \"UserCheck2\",\n \"UserCircle\",\n \"UserCircle2\",\n \"UserCog\",\n \"UserCog2\",\n \"UserKey\",\n \"UserLock\",\n \"UserMinus\",\n \"UserMinus2\",\n \"UserPen\",\n \"UserPlus\",\n \"UserPlus2\",\n \"UserRound\",\n \"UserRoundCheck\",\n \"UserRoundCog\",\n \"UserRoundKey\",\n \"UserRoundMinus\",\n \"UserRoundPen\",\n \"UserRoundPlus\",\n \"UserRoundSearch\",\n \"UserRoundX\",\n \"UserSearch\",\n \"UserSquare\",\n \"UserSquare2\",\n \"UserStar\",\n \"UserX\",\n \"UserX2\",\n \"Users\",\n \"Users2\",\n \"UsersRound\",\n \"Utensils\",\n \"UtensilsCrossed\",\n \"UtilityPole\",\n \"Van\",\n \"Variable\",\n \"Vault\",\n \"VectorSquare\",\n \"Vegan\",\n \"VenetianMask\",\n \"Venus\",\n \"VenusAndMars\",\n \"Verified\",\n \"Vibrate\",\n \"VibrateOff\",\n \"Video\",\n \"VideoOff\",\n \"Videotape\",\n \"View\",\n \"Voicemail\",\n \"Volleyball\",\n \"Volume\",\n \"Volume1\",\n \"Volume2\",\n \"VolumeOff\",\n \"VolumeX\",\n \"Vote\",\n \"Wallet\",\n \"Wallet2\",\n \"WalletCards\",\n \"WalletMinimal\",\n \"Wallpaper\",\n \"Wand\",\n \"Wand2\",\n \"WandSparkles\",\n \"Warehouse\",\n \"WashingMachine\",\n \"Watch\",\n \"Waves\",\n \"WavesArrowDown\",\n \"WavesArrowUp\",\n \"WavesHorizontal\",\n \"WavesLadder\",\n \"WavesVertical\",\n \"Waypoints\",\n \"Webcam\",\n \"Webhook\",\n \"WebhookOff\",\n \"Weight\",\n \"WeightTilde\",\n \"Wheat\",\n \"WheatOff\",\n \"WholeWord\",\n \"Wifi\",\n \"WifiCog\",\n \"WifiHigh\",\n \"WifiLow\",\n \"WifiOff\",\n \"WifiPen\",\n \"WifiSync\",\n \"WifiZero\",\n \"Wind\",\n \"WindArrowDown\",\n \"Wine\",\n \"WineOff\",\n \"Workflow\",\n \"Worm\",\n \"WrapText\",\n \"Wrench\",\n \"X\",\n \"XCircle\",\n \"XLineTop\",\n \"XOctagon\",\n \"XSquare\",\n \"Zap\",\n \"ZapOff\",\n \"ZodiacAquarius\",\n \"ZodiacAries\",\n \"ZodiacCancer\",\n \"ZodiacCapricorn\",\n \"ZodiacGemini\",\n \"ZodiacLeo\",\n \"ZodiacLibra\",\n \"ZodiacOphiuchus\",\n \"ZodiacPisces\",\n \"ZodiacSagittarius\",\n \"ZodiacScorpio\",\n \"ZodiacTaurus\",\n \"ZodiacVirgo\",\n \"ZoomIn\",\n \"ZoomOut\"\n];\n","export const coolIconKeys: string[] = [\n \"Rows4\", \"Video\",\n \"Plane\", \"LayoutDashboard\", \"LayoutGrid\", \"Square\", \"Snowflake\",\n \"CircleDashed\", \"AlignCenterHorizontal\", \"Disc\", \"Infinity\",\n \"Maximize\", \"Play\", \"Sparkles\", \"Music\",\n \"Wallet\", \"Layout\", \"Zap\", \"Circle\", \"Coffee\",\n \"ImageOff\", \"Sun\", \"Cable\", \"CalendarDays\",\n \"Dices\", \"Shapes\", \"Cloud\", \"Palette\",\n \"CreditCard\", \"Headphones\", \"Egg\", \"Disc3\", \"Flag\",\n \"Bandage\", \"Thermometer\", \"Hexagon\", \"Network\", \"Library\", \"Pizza\",\n \"Cpu\", \"Plug\", \"Files\", \"Globe\", \"SignalZero\",\n \"Gamepad2\", \"CloudLightning\", \"ListTree\", \"Command\"];\n","\"use client\";\n\nexport type IconColor = \"inherit\" | \"primary\" | \"secondary\" | \"disabled\" | \"error\" | \"success\" | \"warning\";\nexport type IconSize = \"smallest\" | \"small\" | \"medium\" | \"large\";\n\n/**\n * Standardized icon size map in px.\n * Use with direct Lucide imports: `<Database size={iconSize.small} />`\n */\nexport const iconSize = {\n smallest: 16,\n small: 20,\n medium: 24,\n large: 28\n} as const satisfies Record<IconSize, number>;\n\nexport type IconProps = {\n size?: IconSize | number,\n color?: IconColor,\n className?: string,\n onClick?: (e: React.SyntheticEvent) => void,\n style?: React.CSSProperties,\n}\n\nexport const colorClassesMapping: Record<IconColor, string> = {\n inherit: \"\",\n primary: \"text-primary\",\n success: \"text-green-500\",\n warning: \"text-yellow-500\",\n secondary: \"text-secondary\",\n disabled: \"text-text-disabled dark:text-text-disabled-dark\",\n error: \"text-red-500\"\n}\n","import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function GitHubIcon({ size = 24, color, className, onClick, style }: IconProps) {\n // `size` is `IconSize | number` — resolve the keyword, or an SVG attribute\n // of width=\"small\" is emitted and the icon renders at its intrinsic size.\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n fill={\"currentColor\"}\n width={px}\n height={px}\n viewBox=\"0 0 24 24\">\n <path\n d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\"/>\n </svg>;\n}\n","import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function HandleIcon({ size = 24, color, className, onClick, style }: IconProps) {\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n width={px}\n height={px}\n viewBox=\"0 0 100 100\"\n fill=\"none\">\n <circle cx=\"28\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n </svg>;\n}\n","\"use client\";\n\nimport React from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\n\n/**\n * Rendering a Lucide icon chosen at runtime, without shipping all 1,600 of them\n * on the login screen.\n *\n * `@rebasepro/ui` used to re-export lucide's whole `icons` map:\n *\n * export { icons as lucideIcons } from \"lucide-react\";\n *\n * That map is an object literal holding a reference to every icon component in\n * the library, so a tree-shaker cannot drop a single one — reaching the map\n * reaches all of them. Two callers reached it, both by name lookup: `getIcon`\n * in `@rebasepro/app` (a collection's `icon: \"ShoppingCart\"`) and the admin's\n * icon picker. That put 822 kB of SVG components into the entry chunk's static\n * graph, `modulepreload`ed before authentication.\n *\n * The ~130 icons the product's own chrome uses are still plain named imports\n * from `lucide-react`, which tree-shake to just those. Only the by-name lookup\n * goes through here, and it pays for the map once, asynchronously, the first\n * time a runtime-chosen icon is rendered.\n */\n\ntype IconsMap = Record<string, LucideIcon | undefined>;\n\nlet loaded: IconsMap | undefined;\nlet pending: Promise<IconsMap> | undefined;\n\n/**\n * The full lucide icon map, fetched on first use and cached for the session.\n *\n * Prefer {@link LucideIconByName}. This is here for callers that need to know\n * whether a name resolves, such as the icon picker's grid.\n */\nexport function loadLucideIcons(): Promise<IconsMap> {\n if (loaded) return Promise.resolve(loaded);\n pending ??= import(\"lucide-react\").then(({ icons }) => {\n loaded = icons as IconsMap;\n return loaded;\n });\n return pending;\n}\n\n/** The map if it has already been fetched, otherwise `undefined`. Never fetches. */\nexport function getLoadedLucideIcons(): IconsMap | undefined {\n return loaded;\n}\n\n/**\n * Subscribe to the icon map.\n *\n * Returns it synchronously once loaded — including on the very first render of\n * every icon after the first one anywhere, which is what stops a page full of\n * icons from each flashing its placeholder.\n */\nexport function useLucideIcons(): IconsMap | undefined {\n const [map, setMap] = React.useState<IconsMap | undefined>(loaded);\n React.useEffect(() => {\n if (map) return;\n let cancelled = false;\n loadLucideIcons()\n .then(resolved => { if (!cancelled) setMap(resolved); })\n .catch(error => console.error(\"[rebase] could not load the icon set\", error));\n return () => { cancelled = true; };\n }, [map]);\n return map;\n}\n\nfunction toPascalCase(str: string): string {\n return str.split(/[-_]/).map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(\"\");\n}\n\n/**\n * The same resolution order the two call sites used against the eager map:\n * exact name, then PascalCase, then `CircleAlert` as the visible \"unknown icon\".\n */\nexport function resolveLucideIcon(icons: IconsMap, name: string): LucideIcon | undefined {\n return icons[name] ?? icons[toPascalCase(name)] ?? icons.CircleAlert;\n}\n\nexport type LucideIconByNameProps = {\n /**\n * A PascalCase lucide icon name, e.g. `\"ShoppingCart\"`. Whether a name\n * exists can be answered ahead of the fetch with `iconKeys`, which is a\n * plain string array and costs nothing.\n */\n name: string;\n size?: number;\n className?: string;\n /** Rendered while the icon set is in flight. Defaults to a blank box of `size`. */\n fallback?: React.ReactNode;\n};\n\n/**\n * An icon named at runtime. Renders `fallback` until the icon set arrives.\n */\nexport const LucideIconByName = React.memo(\n function LucideIconByName({ name, size, className, fallback }: LucideIconByNameProps) {\n const icons = useLucideIcons();\n const Icon = icons ? resolveLucideIcon(icons, name) : undefined;\n\n if (!Icon) {\n if (fallback !== undefined) return <>{fallback}</>;\n // A box of the right size, so the layout does not jump when the\n // icon lands.\n return <span aria-hidden={true}\n className={\"inline-block shrink-0\"}\n style={{ width: size, height: size }}/>;\n }\n\n return <Icon size={size}\n className={className}/>;\n }\n);\n","import * as React from \"react\";\nimport { cls } from \"../util\";\nimport { AlertCircleIcon, AlertTriangleIcon, CheckCircleIcon, InfoIcon, XIcon } from \"../icons\";\n\nexport interface AlertProps {\n children: React.ReactNode;\n onDismiss?: () => void;\n color?: \"error\" | \"warning\" | \"info\" | \"success\" | \"base\";\n size?: \"small\" | \"medium\" | \"large\";\n action?: React.ReactNode;\n className?: string;\n outerClassName?: string;\n style?: React.CSSProperties;\n}\n\nconst getSizeClasses = (size: \"small\" | \"medium\" | \"large\") => {\n switch (size) {\n case \"small\":\n return \"px-3 py-1.5 text-xs gap-2 rounded-md\";\n case \"large\":\n return \"px-4 py-3.5 text-sm gap-3 rounded-lg\";\n case \"medium\":\n default:\n return \"px-3.5 py-2.5 text-sm gap-2.5 rounded-lg\";\n }\n}\n\nconst getIconSize = (size: \"small\" | \"medium\" | \"large\") => size === \"small\" ? 16 : 18;\n\nconst getColorClasses = (severity: string) => {\n switch (severity) {\n case \"error\":\n return \"bg-red-500/8 dark:bg-red-500/12 text-red-800 dark:text-red-200 border border-red-500/20 dark:border-red-500/25\";\n case \"warning\":\n return \"bg-amber-500/8 dark:bg-amber-500/12 text-amber-800 dark:text-amber-200 border border-amber-500/20 dark:border-amber-500/25\";\n case \"info\":\n return \"bg-blue-500/8 dark:bg-blue-500/12 text-blue-800 dark:text-blue-200 border border-blue-500/20 dark:border-blue-500/25\";\n case \"success\":\n return \"bg-emerald-500/8 dark:bg-emerald-500/12 text-emerald-800 dark:text-emerald-200 border border-emerald-500/20 dark:border-emerald-500/25\";\n case \"base\":\n default:\n return \"bg-surface-field text-text-primary dark:text-text-primary-dark border border-hairline\";\n }\n};\n\nconst getIconColor = (severity: string) => {\n switch (severity) {\n case \"error\":\n return \"text-red-500 dark:text-red-400\";\n case \"warning\":\n return \"text-amber-500 dark:text-amber-400\";\n case \"info\":\n return \"text-blue-500 dark:text-blue-400\";\n case \"success\":\n return \"text-emerald-500 dark:text-emerald-400\";\n case \"base\":\n default:\n return \"text-surface-accent-500 dark:text-surface-accent-400\";\n }\n};\n\nconst getIcon = (severity: string, size: number, className: string) => {\n switch (severity) {\n case \"error\":\n return <AlertCircleIcon size={size} className={className}/>;\n case \"warning\":\n return <AlertTriangleIcon size={size} className={className}/>;\n case \"success\":\n return <CheckCircleIcon size={size} className={className}/>;\n case \"info\":\n case \"base\":\n default:\n return <InfoIcon size={size} className={className}/>;\n }\n};\n\nexport const Alert: React.FC<AlertProps> = ({\n children,\n onDismiss,\n color = \"info\",\n size = \"medium\",\n action,\n outerClassName,\n className,\n style\n }) => {\n const classes = getColorClasses(color);\n const iconSize = getIconSize(size);\n\n return (\n <div\n style={style}\n className={cls(\n getSizeClasses(size),\n \"w-full\",\n \"font-medium leading-snug\",\n \"flex items-start\",\n classes,\n outerClassName)}>\n <span className={cls(\"shrink-0 mt-px\", getIconColor(color))}>\n {getIcon(color, iconSize, \"\")}\n </span>\n <div className={cls(\"grow min-w-0 self-center\", className)}>{children}</div>\n {action}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n className={cls(\n \"shrink-0 rounded p-0.5 opacity-60 transition-opacity hover:opacity-100\",\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-current/40\")}\n onClick={onDismiss}>\n <XIcon size={iconSize - 2}/>\n </button>\n )}\n </div>\n );\n};\n","\"use client\";\nimport React, { useState } from \"react\";\nimport { cls } from \"../util\";\n\nexport interface AvatarProps {\n src?: string;\n alt?: string;\n children?: React.ReactNode;\n className?: string;\n outerClassName?: string;\n hover?: boolean;\n style?: React.CSSProperties;\n}\n\nconst AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps> = (\n {\n src,\n alt,\n children,\n className,\n style,\n outerClassName,\n hover = true,\n ...props\n },\n ref\n) => {\n const [isImageError, setIsImageError] = useState(false);\n\n const handleImageError = () => {\n setIsImageError(true);\n };\n\n return (\n <button\n ref={ref}\n style={style}\n {...props}\n className={cls(\n \"rounded-full flex items-center justify-center overflow-hidden\",\n \"p-1 w-12 h-12 min-w-12 min-h-12\",\n hover && \"transition-colors duration-150 hover:bg-surface-raised-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\",\n outerClassName\n )}\n >\n {src && !isImageError ? (\n <img\n className={cls(\n \"bg-surface-raised\",\n \"w-full h-full object-cover rounded-full\",\n className\n )}\n src={src}\n alt={alt}\n onError={handleImageError}\n />\n ) : (\n <span\n className={cls(\n \"bg-surface-raised\",\n \"flex items-center justify-center\",\n \"w-full h-full py-1.5 text-lg font-medium text-surface-accent-900 dark:text-text-primary-dark rounded-full\",\n className\n )}\n >\n {children}\n </span>\n )}\n </button>\n );\n};\n\nexport const Avatar = React.forwardRef(AvatarInner);\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\n\n/**\n * Switch geometry, one row per size: track w x h, knob k, and the knob's\n * off/on x-offsets. `on` is always `w - k - inset` so the knob is inset by the\n * same amount at both ends and vertically centred.\n *\n * This is a table rather than inline `cls({...})` conditions on purpose. The\n * offsets used to be computed object keys — `[value ? \"translate-x-[24px]\" :\n * \"translate-x-[3px]\"]: size === \"large\"` — and `large` and `medium` both\n * produced the key `translate-x-[3px]` when off. The later literal overwrote\n * the earlier, so the off-state class was silently dropped for `large` and the\n * knob sat flush against the edge.\n */\nconst SWITCH_GEOMETRY = {\n smallest: {\n track: \"w-[34px] h-[18px] min-w-[34px] min-h-[18px]\",\n knob: \"w-[16px] h-[16px]\", off: \"translate-x-[1px]\", on: \"translate-x-[17px]\",\n bar: \"w-[16px] h-[6px]\", barX: \"translate-x-[9px]\"\n },\n small: {\n track: \"w-[38px] h-[22px] min-w-[38px] min-h-[22px]\",\n knob: \"w-[18px] h-[18px]\", off: \"translate-x-[2px]\", on: \"translate-x-[18px]\",\n bar: \"w-[18px] h-[8px]\", barX: \"translate-x-[10px]\"\n },\n medium: {\n track: \"w-[44px] h-[26px] min-w-[44px] min-h-[26px]\",\n knob: \"w-[20px] h-[20px]\", off: \"translate-x-[3px]\", on: \"translate-x-[21px]\",\n bar: \"w-[20px] h-[10px]\", barX: \"translate-x-[12px]\"\n },\n large: {\n track: \"w-[48px] h-[28px] min-w-[48px] min-h-[28px]\",\n knob: \"w-[22px] h-[22px]\", off: \"translate-x-[3px]\", on: \"translate-x-[23px]\",\n bar: \"w-[22px] h-[11px]\", barX: \"translate-x-[13px]\"\n }\n} as const;\n\nexport type BooleanSwitchProps = {\n value: boolean | null;\n className?: string;\n disabled?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n} & ({\n allowIndeterminate: true;\n onValueChange?: (newValue: boolean | null) => void;\n} | {\n allowIndeterminate?: false;\n onValueChange?: (newValue: boolean) => void;\n});\n\nexport const BooleanSwitch = React.forwardRef(function BooleanSwitch({\n value,\n allowIndeterminate,\n className,\n onValueChange,\n disabled = false,\n size = \"medium\",\n ...props\n }: BooleanSwitchProps, ref: React.Ref<HTMLButtonElement>) {\n return <button\n type=\"button\"\n role=\"switch\"\n aria-checked={allowIndeterminate && (value === null || value === undefined) ? \"mixed\" : !!value}\n aria-disabled={disabled || undefined}\n ref={ref}\n tabIndex={disabled ? -1 : undefined}\n onClick={disabled\n ? (e) => e.preventDefault()\n : (e) => {\n e.preventDefault();\n if (allowIndeterminate) {\n if (value === null || value === undefined) onValueChange?.(true)\n else if (value) onValueChange?.(false)\n else onValueChange?.(null);\n } else {\n onValueChange?.(!value);\n }\n }}\n className={cls(\n // `large` used to share the `medium` branch, so the two sizes\n // rendered identically and the prop looked inert. Geometry is\n // now derived from one table (see SWITCH_GEOMETRY) so the knob\n // inset is symmetric at every size.\n SWITCH_GEOMETRY[size].track,\n \"outline-none outline-hidden rounded-full relative shadow-sm\",\n // On is the primary, not the secondary rose: a boolean is the one\n // place the product turns a hue into a value, and the hue it uses\n // should be the one that means \"yes\" everywhere else (the primary\n // button, the checked checkbox). The rose stays a marketing token.\n // Off is the neutral `active` fill with a strong hairline, so the\n // track is visible on every surface without a fill of its own;\n // disabled keeps its state legible at reduced strength.\n disabled\n ? (value ? \"bg-primary/40 ring-1 ring-transparent\" : \"bg-surface-field ring-1 ring-hairline\")\n : (value ? \"bg-primary ring-1 ring-primary\" : \"bg-surface-active ring-1 ring-hairline-strong\"),\n className\n )}\n {...props}\n >\n {allowIndeterminate && (value === null || value === undefined) && <div\n key={\"knob\"}\n className={cls(\n \"block rounded-full transition-transform duration-100 ease-out transform will-change-auto shadow-sm\",\n // A glyph on the track, not a surface: the numbered grey is the\n // knob's own colour on both themes.\n \"bg-surface-400\",\n SWITCH_GEOMETRY[size].bar,\n SWITCH_GEOMETRY[size].barX\n )}\n />}\n\n {!(allowIndeterminate && (value === null || value === undefined)) && <div\n key={\"knob\"}\n className={cls(\n \"block rounded-full transition-transform duration-100 ease-out transform will-change-auto shadow-sm\",\n disabled ? \"bg-surface-300 dark:bg-surface-600\" : (value ? \"bg-white shadow\" : \"bg-surface-500 dark:bg-surface-400\"),\n SWITCH_GEOMETRY[size].knob,\n value ? SWITCH_GEOMETRY[size].on : SWITCH_GEOMETRY[size].off\n )}\n />}\n </button>;\n }\n) as React.ForwardRefExoticComponent<BooleanSwitchProps & React.RefAttributes<HTMLButtonElement>>;\n","\"use client\";\nimport React from \"react\";\nimport {\n controlHeightMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundMixin,\n focusedClasses\n} from \"../styles\";\nimport { BooleanSwitch, BooleanSwitchProps } from \"./BooleanSwitch\";\nimport { cls } from \"../util\";\n\nexport type BooleanSwitchWithLabelProps = BooleanSwitchProps & {\n position?: \"start\" | \"end\",\n invisible?: boolean,\n label?: React.ReactNode,\n error?: boolean,\n autoFocus?: boolean,\n fullWidth?: boolean,\n className?: string,\n inputClassName?: string,\n};\n\n/**\n * Simple boolean switch.\n *\n */\nexport const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({\n value,\n position = \"end\",\n size = \"medium\",\n invisible,\n onValueChange,\n error,\n label,\n autoFocus,\n disabled,\n className,\n fullWidth = true,\n inputClassName,\n ...props\n }: BooleanSwitchWithLabelProps) {\n\n const ref = React.useRef<HTMLDivElement | null>(null);\n const refInput = React.useRef<HTMLButtonElement | null>(null);\n const switchLabelId = React.useId();\n const [_, setFocused] = React.useState(autoFocus)\n const onFocus = () => setFocused(true);\n const onBlur = () => setFocused(false);\n\n React.useEffect(() => {\n if (autoFocus) {\n // refInput.current?.focus();\n }\n }, []);\n\n const focus = document.activeElement === refInput?.current || document.activeElement === ref?.current\n\n return (\n <div\n ref={ref}\n onFocus={onFocus}\n onBlur={onBlur}\n role=\"switch\"\n aria-checked={props.allowIndeterminate && (value === null || value === undefined) ? \"mixed\" : !!value}\n aria-disabled={disabled || undefined}\n aria-labelledby={label ? switchLabelId : undefined}\n tabIndex={-1}\n className={cls(\n !invisible && fieldBackgroundMixin,\n !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),\n disabled ? \"cursor-default\" : \"cursor-pointer\",\n \"rounded-lg max-w-full justify-between box-border relative inline-flex items-center\",\n !invisible && focus && !disabled ? focusedClasses : \"\",\n error ? \"text-red-500 dark:text-red-600\" : (focus && !disabled ? \"text-primary\" : (!disabled ? \"text-text-primary dark:text-text-primary-dark\" : \"text-text-secondary dark:text-text-secondary-dark\")),\n // The one control size scale — 28/32/40/48. This component still\n // carried its own map (…/44/64), so a switch at `large` stood\n // 16px taller than the text field beside it, which read as a\n // giant empty box once the label moved out of the control.\n controlHeightMixin[size],\n size === \"small\" || size === \"smallest\" ? \"pl-2\" : \"pl-4\",\n size === \"small\" || size === \"smallest\" ? \"pr-4\" : \"pr-6\",\n position === \"end\" ? \"flex-row-reverse\" : \"flex-row\",\n fullWidth ? \"w-full\" : \"\",\n className\n )}\n onClick={disabled ? undefined : (e) => {\n if (props.allowIndeterminate) {\n const onChange = onValueChange as ((newValue: boolean | null) => void) | undefined;\n if (value === null || value === undefined) onChange?.(true)\n else if (value) onChange?.(false)\n else onChange?.(null);\n } else {\n onValueChange?.(!value);\n }\n // refInput.current?.focus();\n }}\n >\n\n <BooleanSwitch\n value={value}\n ref={refInput}\n size={size}\n className={cls(invisible && focus ? focusedClasses : \"\", inputClassName)}\n disabled={disabled}\n {...props}\n />\n\n <div id={switchLabelId} className={cls(\n \"grow\",\n position === \"end\" ? \"mr-4\" : \"ml-4\",\n size === \"small\" || size === \"smallest\" ? \"text-sm\" : \"text-base\"\n )}>\n {label}\n </div>\n\n </div>\n\n );\n};\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\nimport { type ButtonSize, controlHeightMixin, controlPaddingMixin } from \"../styles\";\n\nexport type ButtonProps<C extends React.ElementType = \"button\"> = {\n children?: React.ReactNode;\n variant?: \"filled\" | \"outlined\" | \"text\";\n disabled?: boolean;\n color?: \"primary\" | \"secondary\" | \"text\" | \"error\" | \"neutral\";\n size?: ButtonSize;\n startIcon?: React.ReactNode;\n fullWidth?: boolean;\n className?: string;\n component?: C;\n onClick?: React.MouseEventHandler<HTMLElement>;\n} & React.ComponentPropsWithoutRef<C>;\n\nconst ButtonInner = React.memo(React.forwardRef<\n HTMLButtonElement,\n ButtonProps<React.ElementType>\n>(({\n children,\n className,\n variant = \"filled\",\n disabled = false,\n size = \"medium\",\n startIcon = null,\n fullWidth = false,\n component: Component,\n color = \"neutral\",\n ...props\n }: ButtonProps<React.ElementType>, ref) => {\n\n const baseClasses =\n \"typography-button h-fit rounded-lg whitespace-nowrap inline-flex items-center justify-center p-2 px-4 focus:outline-none transition-colors ease-in-out duration-150 gap-2\";\n\n const buttonClasses = cls({\n \"w-full\": fullWidth,\n \"w-fit\": !fullWidth,\n\n // Filled Variants\n \"border border-primary bg-primary focus:ring-primary text-white hover:text-white hover:brightness-105\": variant === \"filled\" && color === \"primary\" && !disabled,\n \"border border-secondary bg-secondary focus:ring-secondary text-white hover:text-white hover:brightness-105\": variant === \"filled\" && color === \"secondary\" && !disabled,\n \"border border-red-600 bg-red-600 hover:bg-red-700 focus:ring-red-600 text-white hover:text-white\": variant === \"filled\" && color === \"error\" && !disabled,\n \"border border-hairline-strong bg-surface-raised hover:bg-surface-raised-hover text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark\": variant === \"filled\" && color === \"text\" && !disabled,\n \"border border-transparent bg-surface-raised hover:bg-surface-raised-hover text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark\": variant === \"filled\" && color === \"neutral\" && !disabled,\n\n // Text Variants\n \"border border-transparent text-primary hover:text-primary hover:bg-surface-hover\": variant === \"text\" && color === \"primary\" && !disabled,\n \"border border-transparent text-secondary hover:text-secondary hover:bg-surface-hover\": variant === \"text\" && color === \"secondary\" && !disabled,\n \"border border-transparent text-red-600 hover:text-red-600 hover:bg-red-600 hover:bg-opacity-10 hover:bg-red-600/10\": variant === \"text\" && color === \"error\" && !disabled,\n \"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"text\" && color === \"text\" && !disabled,\n \"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark dark:hover:text-text-primary-dark hover:bg-surface-hover\": variant === \"text\" && color === \"neutral\" && !disabled,\n\n // Outlined Variants\n \"border border-primary text-primary hover:text-primary hover:bg-primary-bg hover:bg-primary/10\": variant === \"outlined\" && color === \"primary\" && !disabled,\n \"border border-secondary text-secondary hover:text-secondary hover:bg-secondary-bg\": variant === \"outlined\" && color === \"secondary\" && !disabled,\n \"border border-red-500 text-red-600 hover:text-white hover:bg-red-600\": variant === \"outlined\" && color === \"error\" && !disabled,\n \"border border-hairline-strong text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"outlined\" && color === \"text\" && !disabled,\n \"border border-hairline-strong text-text-primary dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"outlined\" && color === \"neutral\" && !disabled,\n\n // Disabled states for all variants\n \"text-text-disabled dark:text-text-disabled-dark\": disabled,\n \"border border-transparent opacity-50\": variant === \"text\" && disabled,\n \"border border-hairline-strong opacity-50\": variant === \"outlined\" && disabled,\n \"border border-transparent bg-surface-raised\": variant === \"filled\" && disabled\n });\n\n // Height comes from the shared control scale (see styles.ts) so a Button\n // and a TextField at the same `size` line up. Vertical padding is dropped:\n // the button is an inline-flex box centring its content inside min-height.\n const sizeClasses = cls(\"py-0\", controlHeightMixin[size], controlPaddingMixin[size]);\n\n const iconColorClass = (color === \"neutral\" || color === \"text\") && !disabled\n ? \"[&>svg]:text-surface-accent-500 dark:[&>svg]:text-surface-accent-300\"\n : \"\";\n\n if (Component) {\n return (\n <Component\n ref={ref}\n onClick={props.onClick}\n className={cls(startIcon ? \"pl-3\" : \"\", baseClasses, buttonClasses, sizeClasses, iconColorClass, className)}\n {...props}>\n {startIcon}\n {children}\n </Component>\n );\n }\n\n return (\n <button ref={ref as React.Ref<HTMLButtonElement>}\n type={props.type ?? \"button\"}\n onClick={props.onClick}\n className={cls(startIcon ? \"pl-3\" : \"\", baseClasses, buttonClasses, sizeClasses, iconColorClass, className)}\n disabled={disabled}\n data-variant={variant}\n data-size={size}\n {...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>\n {startIcon}\n {children}\n </button>\n );\n\n}));\n\nButtonInner.displayName = \"Button\"\n\nexport const Button = ButtonInner as React.FC<ButtonProps<React.ElementType>>;\n","\"use client\";\nimport React, { useCallback } from \"react\";\nimport { cardClickableMixin, cardMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\ntype CardProps = {\n children: React.ReactNode;\n style?: React.CSSProperties;\n onClick?: (e?: React.MouseEvent) => void;\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({\n children,\n className,\n onClick,\n style,\n ...props\n}, ref) => {\n const onKeyPress = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n onClick?.();\n }\n }, [onClick]);\n\n return (\n <div\n ref={ref}\n onKeyPress={onKeyPress}\n role={onClick ? \"button\" : undefined}\n tabIndex={onClick ? 0 : undefined}\n onClick={onClick}\n className={cls(cardMixin, onClick && cardClickableMixin, className)}\n style={style}\n {...props}>\n {children}\n </div>\n );\n});\n\nCard.displayName = \"Card\";\n\nexport { Card };\n","\"use client\";\nimport React, { ForwardRefRenderFunction } from \"react\";\nimport { cls } from \"../util\";\n\nexport type ContainerProps = {\n children: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n maxWidth?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n}\n\nconst containerMaxWidths = {\n xs: \"max-w-xs\",\n sm: \"max-w-sm\",\n md: \"max-w-md\",\n lg: \"max-w-lg\",\n xl: \"max-w-xl\",\n \"2xl\": \"max-w-2xl\",\n \"3xl\": \"max-w-3xl\",\n \"4xl\": \"max-w-4xl\",\n \"5xl\": \"max-w-5xl\",\n \"6xl\": \"max-w-6xl\",\n \"7xl\": \"max-w-7xl\"\n}\n\nconst ContainerInner: ForwardRefRenderFunction<HTMLDivElement, ContainerProps> = (\n {\n children,\n className,\n style,\n maxWidth = \"7xl\"\n },\n ref\n) => {\n\n const classForMaxWidth = maxWidth ? containerMaxWidths[maxWidth] : \"\";\n\n return (\n <div\n ref={ref}\n className={cls(\"mx-auto px-3 md:px-4 lg:px-6\",\n classForMaxWidth,\n className)}\n style={style}>\n {children}\n </div>\n );\n}\n\nexport const Container = React.forwardRef(ContainerInner);\n\n","\"use client\";\nimport React from \"react\";\nimport { Container } from \"./Container\";\nimport { cls } from \"../util\";\n\nexport type CenteredViewProps = {\n children: React.ReactNode;\n maxWidth?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n outerClassName?: string;\n className?: string;\n fullScreen?: boolean;\n};\n\nexport const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(({\n children,\n maxWidth,\n outerClassName,\n className,\n fullScreen,\n ...rest\n }, ref) => { // Notice how the ref is now received as the second argument\n\n return (\n <div ref={ref}\n className={cls(\"flex flex-col grow\", fullScreen ? \"h-screen\" : \"h-full\", outerClassName)}\n {...rest}>\n <Container className={cls(\"m-auto\", className)} maxWidth={maxWidth}>\n {children}\n </Container>\n </div>\n );\n\n});\n\nCenteredView.displayName = \"CenteredView\";\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport type CircularProgressProps = {\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n className?: string\n}\n\nexport function CircularProgress({\n size = \"medium\",\n className\n }: CircularProgressProps) {\n\n let sizeClasses = \"\";\n if (size === \"smallest\") {\n sizeClasses = \"w-4 h-4\";\n } else if (size === \"small\") {\n sizeClasses = \"w-6 h-6\";\n } else if (size === \"medium\") {\n sizeClasses = \"w-8 h-8 m-1\";\n } else {\n sizeClasses = \"w-10 h-10 m-1\";\n }\n\n let borderClasses = \"\";\n if (size === \"smallest\") {\n borderClasses = \"border-2\";\n } else if (size === \"small\") {\n borderClasses = \"border-2\";\n } else if (size === \"medium\") {\n borderClasses = \"border-[3px]\";\n } else {\n borderClasses = \"border-4\";\n }\n\n return (\n <div\n className={cls(\n sizeClasses,\n borderClasses,\n \"inline-block shrink-0 rounded-full border-solid align-[-0.125em]\",\n \"animate-[spin_0.7s_linear_infinite] motion-reduce:animate-[spin_1.5s_linear_infinite]\",\n \"border-hairline-strong border-t-primary dark:border-t-primary\",\n className)}\n role=\"status\">\n <span\n className=\"absolute! -m-px! h-px! w-px! overflow-hidden! whitespace-nowrap! border-0! p-0! [clip:rect(0,0,0,0)]!\"\n >\n Loading...\n </span>\n </div>\n );\n}\n","import React, { ReactEventHandler } from \"react\";\nimport { cls } from \"../util\";\n\nexport type TypographyVariant = keyof typeof typographyVariants;\nexport type TypographyProps<C extends React.ElementType = \"span\"> = {\n align?: \"center\" | \"inherit\" | \"justify\" | \"left\" | \"right\";\n children?: React.ReactNode;\n className?: string;\n component?: C;\n gutterBottom?: boolean;\n noWrap?: boolean;\n paragraph?: boolean;\n variant?: TypographyVariant;\n variantMapping?: { [key: string]: string };\n color?: \"inherit\" | \"initial\" | \"primary\" | \"secondary\" | \"disabled\" | \"error\";\n onClick?: ReactEventHandler<HTMLElement>;\n style?: React.CSSProperties;\n} & React.ComponentPropsWithoutRef<C>;\n\nconst typographyVariants = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n subtitle1: \"h6\",\n subtitle2: \"h6\",\n label: \"label\",\n body1: \"p\",\n body2: \"p\",\n inherit: \"p\",\n caption: \"p\",\n button: \"span\",\n lead: \"p\",\n micro: \"span\",\n mono: \"span\",\n stat: \"span\"\n};\n\nconst colorToClasses = {\n inherit: \"text-inherit\",\n initial: \"text-current\",\n primary: \"text-text-primary dark:text-text-primary-dark\",\n secondary: \"text-text-secondary dark:text-text-secondary-dark\",\n disabled: \"text-text-disabled dark:text-text-disabled-dark\",\n error: \"text-red-600 dark:text-red-500\"\n};\n\nconst gutterBottomClasses = {\n h1: \"mb-5\",\n h2: \"mb-4\",\n h3: \"mb-4\",\n h4: \"mb-4\",\n h5: \"mb-3\",\n h6: \"mb-3\",\n subtitle1: \"mb-3\",\n subtitle2: \"mb-3\",\n body1: \"mb-3\",\n body2: \"mb-3\",\n inherit: \"mb-3\",\n caption: \"mb-2\",\n button: \"mb-2\",\n label: \"mb-2\",\n lead: \"mb-4\",\n micro: \"mb-1\",\n mono: \"mb-2\",\n stat: \"mb-1\"\n};\n\nconst variantToClasses = {\n h1: \"typography-h1\",\n h2: \"typography-h2\",\n h3: \"typography-h3\",\n h4: \"typography-h4\",\n h5: \"typography-h5\",\n h6: \"typography-h6\",\n subtitle1: \"typography-subtitle1\",\n subtitle2: \"typography-subtitle2\",\n body1: \"typography-body1\",\n body2: \"typography-body2\",\n label: \"typography-label\",\n inherit: \"typography-inherit\",\n caption: \"typography-caption\",\n button: \"typography-button\",\n lead: \"typography-lead\",\n micro: \"typography-micro\",\n mono: \"typography-mono\",\n stat: \"typography-stat\"\n};\n\nexport function Typography<C extends React.ElementType = \"span\">(\n {\n align = \"inherit\",\n color = \"primary\",\n children,\n className,\n component,\n gutterBottom = false,\n noWrap = false,\n paragraph = false,\n variant = \"body1\",\n variantMapping = typographyVariants,\n style,\n onClick,\n ...other\n }: TypographyProps<C>\n) {\n const Component =\n component ||\n (paragraph ? \"p\" : variantMapping[variant] || typographyVariants[variant]) ||\n \"span\";\n\n const classes = cls(\n variantToClasses[variant],\n color ? colorToClasses[color] : \"\",\n align !== \"inherit\" && `text-${align}`,\n gutterBottom && gutterBottomClasses[variant],\n noWrap && \"truncate\",\n paragraph && \"mb-3\",\n className\n );\n\n return (\n <Component className={classes}\n onClick={onClick}\n style={style}\n {...other}>\n {children}\n </Component>\n );\n}\n","import React from \"react\";\nimport { CircularProgress, CircularProgressProps } from \"./CircularProgress\";\nimport { Typography } from \"./Typography\";\n\n/**\n *\n * @param text\n * @param props\n\n * @ignore\n */\nexport function CircularProgressCenter({ text, ...props }: CircularProgressProps & {\n text?: string\n}) {\n return (\n <div\n className=\"flex w-full h-screen max-h-full max-w-full gap-4\">\n <div className=\"m-auto flex flex-col gap-2 items-center\">\n <CircularProgress {...props}/>\n {text && <Typography\n color={\"secondary\"}\n variant={\"caption\"}\n className=\"text-center\">{text}</Typography>}\n </div>\n </div>\n );\n}\n","import React from \"react\";\n\n/**\n * Dynamic imports that survive a redeploy.\n *\n * A built SPA names its chunks by content hash and a deploy replaces the whole\n * `assets/` directory, so a tab opened before the deploy still holds the *old*\n * entry chunk. The first lazy route that tab opens asks for a hash that no\n * longer exists on the server, the import rejects, and the view is dead until\n * the user thinks to reload — which nothing on screen tells them to do. The\n * browser's own wording (\"Failed to fetch dynamically imported module: …\") reads\n * like a build bug, so this is usually reported as one.\n *\n * `loadChunk` retries once — that covers a transient network failure — and then\n * gives up with an error tagged as a chunk load failure, so `ErrorBoundary` can\n * offer a reload instead of printing the browser's message.\n */\n\n/**\n * Marker property set on the error thrown after a failed retry. Read by\n * `isChunkLoadError`, which is what the UI matches on.\n */\nconst CHUNK_LOAD_ERROR_FLAG = \"rebaseChunkLoadError\";\n\n/**\n * Each engine words this differently, and the message is the only signal — none\n * of them use a distinguishable error type. The MIME variants matter as much as\n * the fetch ones: a server whose SPA fallback answers a missing `/assets/x.js`\n * with `index.html` returns 200 HTML, and the browser rejects it as a module.\n */\nconst CHUNK_ERROR_PATTERNS = [\n \"failed to fetch dynamically imported module\",\n \"error loading dynamically imported module\",\n \"importing a module script failed\",\n \"failed to load module script\",\n \"expected a javascript\",\n \"unable to preload css\"\n];\n\n/**\n * Does this error mean a chunk could not be loaded — rather than the chunk's\n * own code throwing once it did load?\n *\n * Errors raised anywhere are matched, not just ones `loadChunk` produced: React\n * `lazy()` calls that still import directly, and Vite's own CSS preloads, fail\n * the same way and deserve the same recovery.\n */\nexport function isChunkLoadError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n if ((error as Record<string, unknown>)[CHUNK_LOAD_ERROR_FLAG] === true) return true;\n const message = (error as { message?: unknown }).message;\n if (typeof message !== \"string\") return false;\n const lower = message.toLowerCase();\n return CHUNK_ERROR_PATTERNS.some(pattern => lower.includes(pattern));\n}\n\nfunction chunkLoadError(cause: unknown): Error {\n const error = new Error(\n \"This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.\"\n );\n Object.assign(error, { [CHUNK_LOAD_ERROR_FLAG]: true,\ncause });\n return error;\n}\n\n/**\n * Run a dynamic import, retrying once before declaring the chunk unreachable.\n *\n * Errors that are not chunk load failures — the imported module throwing while\n * it evaluates, say — are re-thrown untouched and never retried: running a\n * module's side effects twice is worse than the original failure.\n */\nexport async function loadChunk<T>(loader: () => Promise<T>): Promise<T> {\n try {\n return await loader();\n } catch (error) {\n if (!isChunkLoadError(error)) throw error;\n // A blip resolves inside a few hundred ms; a stale hash never will.\n await new Promise(resolve => setTimeout(resolve, 250));\n try {\n return await loader();\n } catch (retryError) {\n throw chunkLoadError(retryError);\n }\n }\n}\n\n/**\n * `React.lazy` with the retry above. A drop-in replacement — use it for every\n * lazy route or dialog, since any one of them can be the first chunk a stale\n * tab reaches for.\n *\n * Note that React caches the rejection: once a lazy component has failed, later\n * renders re-throw without calling the loader again. Resetting an error boundary\n * therefore cannot recover it, which is why the boundary offers a reload.\n */\nexport function lazyChunk<T extends React.ComponentType<any>>(\n loader: () => Promise<{ default: T }>\n): React.LazyExoticComponent<T> {\n return React.lazy(() => loadChunk(loader));\n}\n","\nimport React, { ErrorInfo, PropsWithChildren } from \"react\";\n\nimport { AlertCircleIcon, ShieldAlertIcon, RefreshCwIcon, ArrowLeftIcon, ChevronDownIcon, ChevronUpIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { Typography } from \"./Typography\";\nimport { Button } from \"./Button\";\nimport { cls } from \"../util\";\nimport { isChunkLoadError } from \"../util/lazy_chunk\";\n\n/**\n * The one error a user can fix themselves. A deploy replaces the hashed chunk\n * files, so a tab opened before it cannot load any lazy view it has not already\n * fetched — with the browser's raw message (\"Failed to fetch dynamically\n * imported module: …\") this reads as a broken build rather than a stale tab.\n */\nconst CHUNK_ERROR_DESCRIPTION =\n \"This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.\";\n\n/**\n * Checks whether the error message relates to missing permissions or\n * authorization failures. Used to show a friendlier message in fullPage mode.\n */\nfunction isPermissionError(error: Error | null): boolean {\n if (!error) return false;\n const msg = error.message?.toLowerCase() ?? \"\";\n const code = (error as { code?: string }).code?.toLowerCase() ?? \"\";\n return msg.includes(\"permission\")\n || msg.includes(\"insufficient\")\n || msg.includes(\"unauthorized\")\n || msg.includes(\"forbidden\")\n || msg.includes(\"access denied\")\n || code === \"permission_denied\"\n || code === \"insufficient_permissions\"\n || (error as { status?: number }).status === 403;\n}\n\nexport interface ErrorBoundaryProps {\n /**\n * When true, renders a full-page centered error screen instead of the\n * compact inline error. Intended for wrapping top-level app roots or\n * major route sections.\n */\n fullPage?: boolean;\n /**\n * Optional callback invoked when the user clicks \"Try again\". If provided,\n * the boundary resets its error state and calls this handler. If omitted,\n * the \"Try again\" button resets the boundary state, re-mounting children.\n */\n onReset?: () => void;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n showDetails: boolean;\n}\n\nexport class ErrorBoundary extends React.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {\n constructor(props: PropsWithChildren<ErrorBoundaryProps>) {\n super(props);\n this.state = { error: null,\nshowDetails: false };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n console.error(error);\n }\n\n private handleReset = () => {\n this.setState({ error: null,\nshowDetails: false });\n this.props.onReset?.();\n };\n\n private handleReload = () => {\n window.location.reload();\n };\n\n private toggleDetails = () => {\n this.setState(prev => ({ showDetails: !prev.showDetails }));\n };\n\n render() {\n if (this.state.error) {\n if (this.props.fullPage) {\n return this.renderFullPage();\n }\n return this.renderInline();\n }\n\n return this.props.children;\n }\n\n private renderInline() {\n const isStaleChunk = isChunkLoadError(this.state.error);\n return (\n <div className=\"flex flex-col m-2 items-start\">\n <div className=\"flex items-center m-2\">\n {isStaleChunk\n ? <RefreshCwIcon className={\"text-text-secondary dark:text-text-secondary-dark\"}\n size={iconSize.small}/>\n : <AlertCircleIcon className={\"text-red-500 dark:text-red-400\"} size={iconSize.small}/>}\n <div className=\"ml-4\">{isStaleChunk ? \"New version available\" : \"Error\"}</div>\n </div>\n <Typography variant={\"caption\"}>\n {isStaleChunk\n ? CHUNK_ERROR_DESCRIPTION\n : this.state.error?.message ?? \"See the error in the console\"}\n </Typography>\n {isStaleChunk && <Button variant=\"outlined\"\n color=\"neutral\"\n size=\"small\"\n className=\"mt-3 ml-2\"\n onClick={this.handleReload}>\n <RefreshCwIcon size={16}/>\n Reload\n </Button>}\n </div>\n );\n }\n\n private renderFullPage() {\n const { error, showDetails } = this.state;\n const isPermission = isPermissionError(error);\n // Neither a fault nor a denial: the app is fine, this tab is behind it.\n const isStaleChunk = !isPermission && isChunkLoadError(error);\n\n const Icon = isPermission ? ShieldAlertIcon : isStaleChunk ? RefreshCwIcon : AlertCircleIcon;\n const title = isPermission\n ? \"Access denied\"\n : isStaleChunk\n ? \"New version available\"\n : \"Something went wrong\";\n const description = isPermission\n ? \"You don't have permission to access this resource. Please check your account permissions or contact your administrator.\"\n : isStaleChunk\n ? CHUNK_ERROR_DESCRIPTION\n : \"An unexpected error occurred. You can try reloading the page or going back.\";\n\n return (\n <div className={cls(\n \"flex items-center justify-center min-h-[400px] h-full w-full\",\n \"bg-surface-sheet\"\n )}>\n <div className=\"flex flex-col items-center max-w-md px-6 py-10 text-center\">\n <div className={cls(\n \"flex items-center justify-center w-14 h-14 rounded-xl mb-6\",\n isPermission\n ? \"bg-amber-100 dark:bg-amber-900/30\"\n : isStaleChunk\n ? \"bg-surface-raised\"\n : \"bg-red-100 dark:bg-red-900/30\"\n )}>\n <Icon\n size={28}\n className={isPermission\n ? \"text-amber-600 dark:text-amber-400\"\n : isStaleChunk\n ? \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-500 dark:text-red-400\"}\n />\n </div>\n\n <Typography variant={\"h6\"}\n className=\"text-text-primary dark:text-text-primary-dark mb-2\">\n {title}\n </Typography>\n\n <Typography variant={\"body2\"}\n className=\"text-text-secondary dark:text-text-secondary-dark mb-8\">\n {description}\n </Typography>\n\n <div className=\"flex gap-3\">\n {/* React caches a `lazy()` rejection: re-mounting the\n children re-throws without re-running the import, so\n \"Try again\" cannot recover a missing chunk. */}\n {!isStaleChunk && <Button\n variant=\"outlined\"\n color=\"neutral\"\n size=\"medium\"\n onClick={this.handleReset}\n >\n <ArrowLeftIcon size={16}/>\n Try again\n </Button>}\n <Button\n variant=\"filled\"\n color=\"primary\"\n size=\"medium\"\n onClick={this.handleReload}\n >\n <RefreshCwIcon size={16}/>\n Reload page\n </Button>\n </div>\n\n {/* For a stale chunk the message *is* the description\n above; repeating it under a disclosure adds nothing. */}\n {!isStaleChunk && error?.message && (\n <div className=\"mt-8 w-full\">\n <button\n onClick={this.toggleDetails}\n className={cls(\n \"flex items-center gap-1 mx-auto text-xs\",\n \"text-text-disabled dark:text-text-disabled-dark\",\n \"hover:text-text-secondary dark:hover:text-text-secondary-dark\",\n \"transition-colors cursor-pointer bg-transparent border-none p-0\"\n )}\n >\n Technical details\n {showDetails\n ? <ChevronUpIcon size={14}/>\n : <ChevronDownIcon size={14}/>}\n </button>\n {showDetails && (\n <div className={cls(\n \"mt-3 p-3 rounded-lg text-left text-xs\",\n \"bg-surface-field\",\n \"text-text-secondary dark:text-text-secondary-dark\",\n \"font-mono break-all\"\n )}>\n {error.message}\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n","\nimport React from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\n\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { cls } from \"../util\";\n\nexport interface CheckboxProps {\n checked: boolean;\n id?: string;\n disabled?: boolean;\n indeterminate?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n padding?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n color?: \"primary\" | \"secondary\";\n \"aria-label\"?: string;\n}\n\n// Radius steps down with the box. `rounded-md` is 6px — on a 16-20px box that\n// is most of the edge, so the control reads as a squircle rather than a\n// checkbox. Box sizes match the icon glyph scale (16/16/20/24) so a Checkbox\n// sitting beside IconButtons in a table row is the same visual size.\nconst sizeClasses = {\n large: \"w-6 h-6 rounded flex items-center justify-center\",\n medium: \"w-5 h-5 rounded flex items-center justify-center\",\n small: \"w-4 h-4 rounded-sm flex items-center justify-center\",\n smallest: \"w-4 h-4 rounded-sm flex items-center justify-center\"\n};\n\n// Outer box is the hit area and sets the control's rendered height, so it\n// tracks the shared 28/32/40/48 scale. `smallest` used to reuse `small`'s\n// 32px box, which made the two sizes identical.\n//\n// A checkbox with no `onCheckedChange` is not a hit area — it is a tick mark\n// standing in for a value, as in `BooleanPreview`. There the box was 10px of\n// dead space on each side of a `medium` tick: on top of a read-only field's\n// own padding, it started the tick 10px further in than the text of the field\n// beside it. `padding={false}` reads as the request to drop it, and until now\n// did nothing at all, because it only removed `p-2` from a box whose size was\n// fixed regardless. Kept for anything clickable — the same box is the click\n// target for table row selection and for editor task items.\nconst outerSizeClasses = {\n medium: \"w-10 h-10\",\n small: \"w-8 h-8\",\n large: \"w-12 h-12 \",\n smallest: \"w-7 h-7\"\n}\n// Flat p-2, as it always was. `shrink-0` on the box below is what stops it\n// being squashed; changing the padding here only shifts the control's optical\n// weight relative to the icons beside it.\nconst paddingClasses = {\n medium: \"p-2\",\n small: \"p-2\",\n large: \"p-2\",\n smallest: \"p-2\"\n}\n\nconst colorClasses = {\n primary: \"bg-primary\",\n secondary: \"bg-secondary\"\n}\n\nexport const Checkbox = React.memo(({\n id,\n checked,\n indeterminate = false,\n padding = true,\n disabled,\n size = \"medium\",\n onCheckedChange,\n color = \"primary\",\n \"aria-label\": ariaLabel\n }: CheckboxProps) => {\n\n const isChecked = indeterminate ? false : checked;\n\n const iconSize = size === \"medium\"\n ? 20\n : size === \"small\"\n ? 16\n : size === \"smallest\"\n ? 14\n : 24;\n return (\n <CheckboxPrimitive.Root\n id={id}\n checked={indeterminate || isChecked}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-checked={indeterminate ? \"mixed\" : isChecked}\n className=\"rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\"\n onCheckedChange={disabled ? undefined : onCheckedChange}>\n\n <div className={cls(\n padding ? paddingClasses[size] : \"\",\n padding || onCheckedChange ? outerSizeClasses[size] : \"\",\n \"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150\",\n onCheckedChange ? \"rounded-full hover:bg-surface-hover\" : \"\",\n onCheckedChange ? \"cursor-pointer\" : \"cursor-default\"\n )}>\n <div\n className={cls(\n \"border-2 shrink-0 relative transition-colors ease-in-out duration-150\",\n sizeClasses[size],\n disabled\n ? \"bg-surface-300 dark:bg-surface-600\"\n : (indeterminate || isChecked ? colorClasses[color] : \"bg-surface-card\"),\n (indeterminate || isChecked) ? \"text-surface-accent-100 dark:text-surface-accent-900\" : \"\",\n disabled\n ? \"border-transparent\"\n : (indeterminate || isChecked ? \"border-transparent\" : \"border-surface-accent-800 dark:border-surface-accent-500\")\n )}>\n <CheckboxPrimitive.Indicator asChild>\n {indeterminate\n ? (\n <MinusIcon size={iconSize} className={\"absolute\"}/>\n )\n : (\n <CheckIcon size={iconSize} className={\"absolute\"}/>\n )}\n </CheckboxPrimitive.Indicator>\n </div>\n </div>\n </CheckboxPrimitive.Root>\n );\n});\n\nCheckbox.displayName = \"Checkbox\";\n","import React from \"react\";\nimport { CHIP_COLORS, cls, getColorSchemeForKey } from \"../util\";\nimport type { ChipColorKey, ChipColorScheme } from \"../util/chip_colors\";\nimport { useIsDarkMode } from \"../hooks/useIsDarkMode\";\n\nexport type { ChipColorKey, ChipColorScheme };\n\nexport interface ChipProps {\n className?: string;\n children: React.ReactNode;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n colorScheme?: ChipColorScheme | ChipColorKey;\n /**\n * How a coloured chip paints its hue. `tinted` (the default) is the hue at\n * low alpha behind hue-coloured ink: a label, not a block, and the rule the\n * chrome follows for colour everywhere else (a dot, an icon, an outline, a\n * tint — never a fill). `filled` is the palette's solid stop, for the few\n * places that want a swatch: a colour picker, a legend. A custom scheme\n * without tint values falls back to `filled`.\n */\n variant?: \"tinted\" | \"filled\";\n error?: boolean;\n outlined?: boolean;\n onClick?: () => void;\n icon?: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n// `small` and `medium` used to differ only in horizontal padding, so both\n// rendered at the same height and the step was invisible. Vertical rhythm now\n// increases across the whole scale.\nconst sizeClassNames = {\n smallest: \"px-1.5 py-px text-[10px]\",\n small: \"px-2 py-0.5 text-xs\",\n medium: \"px-2.5 py-1 text-xs\",\n large: \"px-3 py-1.5 text-sm\"\n}\n\n/**\n * Helper to generate rgba from hex or standard colors.\n */\nfunction getRgba(hex: string, alpha: number): string {\n if (!hex || !hex.startsWith(\"#\")) return hex;\n let color = hex.slice(1);\n if (color.length === 3) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n const r = parseInt(color.slice(0, 2), 16);\n const g = parseInt(color.slice(2, 4), 16);\n const b = parseInt(color.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n\n/**\n * @group Preview components\n */\nexport function Chip({\n children,\n colorScheme,\n error,\n outlined,\n variant = \"tinted\",\n onClick,\n icon,\n size = \"medium\",\n className,\n style\n }: ChipProps) {\n\n const usedColorScheme = typeof colorScheme === \"string\" ? getColorSchemeForKey(colorScheme) : colorScheme;\n // Live, not read once: the ink is chosen in JS per theme, so a theme switch\n // has to reach every mounted chip (see useIsDarkMode).\n const dark = useIsDarkMode();\n\n const hasScheme = error || usedColorScheme;\n\n let textColor = \"\";\n let bgColor = \"\";\n let border = \"\";\n\n if (error) {\n textColor = dark ? \"#f87171\" : \"#dc2626\";\n } else if (usedColorScheme) {\n textColor = dark && usedColorScheme.darkText ? usedColorScheme.darkText : usedColorScheme.text;\n }\n\n if (hasScheme) {\n if (outlined) {\n // An outlined chip has no fill, so it needs the ink meant for the\n // PAGE, not the ink meant for the fill it just dropped. Those are\n // different colours for most hues — a bright `solid` chip carries\n // dark ink, which on a near-black page would be invisible.\n if (!error && usedColorScheme) {\n const outlineInk = dark\n ? usedColorScheme.darkOutlineText ?? usedColorScheme.darkText\n : usedColorScheme.outlineText;\n if (outlineInk) textColor = outlineInk;\n }\n bgColor = getRgba(textColor, dark ? 0.1 : 0.06);\n border = `1px solid ${getRgba(textColor, dark ? 0.2 : 0.14)}`;\n } else if (error) {\n bgColor = dark ? \"rgba(220, 38, 38, 0.15)\" : \"rgba(239, 68, 68, 0.1)\";\n border = `1px solid ${dark ? \"rgba(220, 38, 38, 0.3)\" : \"rgba(239, 68, 68, 0.2)\"}`;\n } else if (usedColorScheme) {\n const tintColor = dark ? usedColorScheme.darkTintColor : usedColorScheme.tintColor;\n const tintText = dark ? usedColorScheme.darkTintText : usedColorScheme.tintText;\n if (variant === \"tinted\" && tintColor && tintText) {\n bgColor = tintColor;\n textColor = tintText;\n } else {\n bgColor = dark && usedColorScheme.darkColor ? usedColorScheme.darkColor : usedColorScheme.color;\n }\n }\n }\n\n return (\n <div\n // `rounded-md`, not `lg`: a radius is proportional to the thing it\n // rounds. At a chip's 20-24px height the control radius makes a pill,\n // and a pill is a different object (a segment, a search field).\n className={cls(\"rounded-md max-w-full w-max h-fit font-medium inline-flex gap-1\",\n \"text-ellipsis\",\n \"items-center\",\n \"transition-colors duration-150\",\n !hasScheme && \"bg-surface-raised text-text-secondary dark:text-text-secondary-dark\",\n !hasScheme && outlined && \"bg-transparent border border-hairline-strong\",\n onClick ? \"cursor-pointer hover:bg-surface-raised-hover\" : \"\",\n sizeClassNames[size],\n className)}\n onClick={onClick}\n style={{\n ...(hasScheme ? {\n backgroundColor: bgColor,\n color: textColor,\n border: border || undefined,\n } : {}),\n overflow: \"hidden\",\n ...style\n }}\n >\n {icon}\n {children}\n </div>\n );\n}\n","\"use client\";\nimport React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type TooltipProps = {\n open?: boolean,\n defaultOpen?: boolean,\n onOpenChange?: (open: boolean) => void,\n side?: \"top\" | \"bottom\" | \"left\" | \"right\",\n align?: \"start\" | \"center\" | \"end\",\n sideOffset?: number,\n title?: string | React.ReactNode,\n delayDuration?: number;\n asChild?: boolean;\n tooltipClassName?: string,\n tooltipStyle?: React.CSSProperties;\n children: React.ReactNode,\n className?: string,\n container?: HTMLElement,\n style?: React.CSSProperties;\n};\n\nexport const Tooltip = ({\n open,\n defaultOpen,\n side = \"bottom\",\n delayDuration = 200,\n sideOffset,\n align,\n onOpenChange,\n title,\n tooltipClassName,\n tooltipStyle,\n children,\n asChild = false,\n container,\n className,\n style\n }: TooltipProps) => {\n\n useInjectStyles(\"Tooltip\", styles);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (container ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n if (!title)\n return <>{children}</>;\n\n const trigger = asChild\n ? <TooltipPrimitive.Trigger asChild={true}>\n {children}\n </TooltipPrimitive.Trigger>\n : <TooltipPrimitive.Trigger asChild={true}>\n <div style={style} className={className}>\n {children}\n </div>\n </TooltipPrimitive.Trigger>;\n\n return (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <TooltipPrimitive.Root {...(open !== undefined ? { open,\nonOpenChange } : {})} defaultOpen={defaultOpen}>\n {trigger}\n <TooltipPrimitive.Portal container={finalContainer}>\n <TooltipPrimitive.Content\n className={cls(\"TooltipContent\",\n \"max-w-lg leading-relaxed\",\n \"z-50 rounded-md px-3 py-2 text-xs leading-none bg-surface-800/95 dark:bg-surface-raised-hover font-medium text-white shadow-2xl select-none duration-400 ease-in transform opacity-100\",\n tooltipClassName)}\n style={tooltipStyle}\n sideOffset={sideOffset === undefined ? 4 : sideOffset}\n align={align}\n side={side}>\n {title}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n};\n\nconst styles = `\n\n.TooltipContent {\n animation-duration: 220ms;\n animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n}\n\n.TooltipContent[data-state='delayed-open'][data-side='top'] {\n animation-name: slideDownAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='right'] {\n animation-name: slideLeftAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='bottom'] {\n animation-name: slideUpAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='left'] {\n animation-name: slideRightAndFade;\n}\n\n\n@keyframes slideUpAndFade {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideRightAndFade {\n from {\n opacity: 0;\n transform: translateX(-4px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideDownAndFade {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideLeftAndFade {\n from {\n opacity: 0;\n transform: translateX(4px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}`;\n","\nimport React from \"react\";\nimport { CHIP_COLORS, cls } from \"../util\";\nimport { ChipColorKey, ChipColorScheme } from \"./Chip\";\nimport type { ChipTone } from \"../util/chip_colors\";\nimport { CheckIcon } from \"lucide-react\";\nimport { Tooltip } from \"./Tooltip\";\n\nexport interface ColorPickerProps {\n /**\n * Currently selected color key\n */\n value?: ChipColorKey;\n /**\n * Callback when color selection changes. Passes undefined when \"Auto\" is selected.\n */\n onChange: (colorKey: ChipColorKey | undefined) => void;\n /**\n * Size of the color swatches\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether to show the \"Auto\" option that clears the selection\n */\n allowClear?: boolean;\n /**\n * Whether the picker is disabled\n */\n disabled?: boolean;\n}\n\n// Hues across, tones down — the arrangement the palette is built in.\nconst BASE_COLORS = [\"blue\", \"indigo\", \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\", \"red\", \"orange\", \"yellow\", \"green\", \"emerald\", \"teal\", \"cyan\", \"gray\"] as const;\n\n// Lightest first, matching how the bare hue name reads.\nconst TONES: ChipTone[] = [\"Lighter\", \"Light\", \"Dark\", \"Darker\"];\n\n// Helper to get readable name from color key\nfunction getColorDisplayName(hue: string, tone: ChipTone): string {\n const hueName = `${hue.charAt(0).toUpperCase()}${hue.slice(1)}`;\n return tone === \"Lighter\" ? hueName : `${hueName} ${tone.toLowerCase()}`;\n}\n\n/**\n * A color picker component that displays a grid of predefined CHIP_COLORS.\n * Used for selecting colors for enum values, tags, and other chip-based UI elements.\n *\n * @group Form components\n */\nexport function ColorPicker({\n value,\n onChange,\n size = \"medium\",\n allowClear = true,\n disabled = false\n}: ColorPickerProps) {\n\n const swatchSize = size === \"small\" ? \"w-5 h-5\" : \"w-6 h-6\";\n const checkSize = size === \"small\" ? 12 : 14;\n\n return (\n <div className=\"flex flex-col gap-2\">\n {allowClear && (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(undefined)}\n className={cls(\n \"flex items-center gap-2 px-2 py-1 rounded-lg text-sm transition-colors duration-150\",\n \"hover:bg-surface-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-primary\",\n disabled && \"opacity-50 cursor-not-allowed\",\n !value && \"bg-surface-raised font-medium\"\n )}\n >\n <div className={cls(\n swatchSize,\n \"rounded-full border-2 border-dashed border-surface-accent-400 dark:border-surface-accent-600\",\n \"flex items-center justify-center\"\n )}>\n {!value && <CheckIcon size={checkSize}/>}\n </div>\n <span className=\"text-surface-accent-700 dark:text-surface-accent-300\">\n Auto (based on ID)\n </span>\n </button>\n )}\n\n {/* One row per tone. Wrapping rather than a fixed 15-column grid:\n the picker also opens inside narrow property panels, where\n fifteen tracks would shrink each swatch to a few pixels. */}\n {TONES.map((tone) => (\n <div key={tone} className=\"flex flex-wrap gap-1.5\">\n {BASE_COLORS.map((base) => {\n // The bare hue and its `Lighter` tone are the same\n // scheme; the picker offers the short name so configs\n // stay readable.\n const colorKey = (tone === \"Lighter\" ? base : `${base}${tone}`) as ChipColorKey;\n const colorScheme = CHIP_COLORS[colorKey] as ChipColorScheme;\n const isSelected = value === colorKey;\n const displayName = getColorDisplayName(base, tone);\n\n return (\n <Tooltip\n key={colorKey}\n title={displayName}\n delayDuration={300}\n >\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(colorKey)}\n className={cls(\n swatchSize,\n \"rounded-full transition-all flex items-center justify-center\",\n \"hover:scale-110 hover:shadow-md\",\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n disabled && \"opacity-50 cursor-not-allowed hover:scale-100\",\n isSelected && \"ring-2 ring-primary ring-offset-1\"\n )}\n style={{\n backgroundColor: colorScheme.color\n }}\n aria-label={displayName}\n aria-pressed={isSelected}\n >\n {isSelected && (\n <CheckIcon\n size={checkSize}\n style={{ color: colorScheme.text }}\n />\n )}\n </button>\n </Tooltip>\n );\n })}\n </div>\n ))}\n </div>\n );\n}\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\n\nexport type IconButtonProps<C extends React.ElementType> =\n Omit<(C extends \"button\" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<C>), \"onClick\">\n & {\n size?: \"medium\" | \"small\" | \"smallest\" | \"large\";\n variant?: \"ghost\" | \"filled\",\n shape?: \"circular\" | \"square\",\n disabled?: boolean;\n toggled?: boolean;\n component?: C;\n onClick?: React.MouseEventHandler<any>;\n \"aria-label\"?: string;\n}\n\nconst buttonClasses = \"hover:scale-[1.04] active:scale-95 transition-transform\";\n// `[&>svg]:shrink-0` is load-bearing: without it flex compresses the icon to\n// whatever width is left after padding, so an 18px icon in a 28px button\n// rendered 12x18 — visibly squashed rather than merely small.\nconst baseClasses = \"inline-flex items-center justify-center text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 transition-colors ease-in-out duration-150 [&>svg]:shrink-0\";\nconst colorClasses = \"text-surface-accent-500 visited:text-surface-accent-500 dark:text-surface-accent-300 dark:visited:text-surface-accent-300\";\n// Padding stays a flat p-2 (as it always was). Callers pass their own icon\n// sizes, so tightening it here shrinks the content box under an icon that was\n// sized for the old one and makes the icon overflow. `shrink-0` above is what\n// actually fixes the squashing — the icon keeps its own dimensions and simply\n// eats into the padding.\nconst sizeClasses = {\n medium: \"w-10 !h-10 min-w-10 min-h-10 p-2\",\n small: \"w-8 !h-8 min-w-8 min-h-8 p-2\",\n smallest: \"w-7 !h-7 min-w-7 min-h-7 p-2\",\n large: \"w-12 !h-12 min-w-12 min-h-12 p-2\"\n}\nconst shapeClasses = {\n circular: \"rounded-full\",\n square: \"rounded-md\"\n}\n\n/** Icon size used when the caller doesn't set one on the child. */\nconst defaultIconSize = {\n smallest: 16,\n small: 18,\n medium: 20,\n large: 24\n} as const;\n\nconst IconButtonInner = <C extends React.ElementType = \"button\">({\n children,\n className,\n size = \"medium\",\n variant = \"ghost\",\n shape = \"circular\",\n disabled,\n toggled,\n component,\n ...props\n }: IconButtonProps<C>, ref: React.ForwardedRef<HTMLButtonElement>) => {\n\n const bgClasses = variant === \"ghost\" ? \"bg-transparent hover:bg-surface-hover\" : \"bg-surface-raised hover:bg-surface-raised-hover\";\n const Component: React.ElementType<any> = component || \"button\";\n const isNativeButton = Component === \"button\";\n\n // Give the icon a size that matches the button when the caller didn't pick\n // one. Without this a bare <IconButton size=\"smallest\"><PencilIcon/></…>\n // renders lucide's 24px default inside a 28px button, so icon size ended up\n // depending on whether each call site happened to pass one — which is what\n // made a row of icon buttons look randomly sized. An explicit `size` on the\n // child always wins.\n const sizedChildren = React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) return child;\n if ((child.props as { size?: unknown }).size !== undefined) return child;\n return React.cloneElement(child as React.ReactElement<{ size?: number }>,\n { size: defaultIconSize[size] });\n });\n return (\n <Component\n type={isNativeButton ? \"button\" : undefined}\n role={isNativeButton ? undefined : \"button\"}\n ref={ref}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n {...props}\n className={cls(\n disabled ? \"opacity-50 pointer-events-none\" : \"cursor-pointer\",\n toggled ? \"outline outline-2 outline-primary\" : \"\",\n \"text-inherit dark:text-inherit\",\n colorClasses,\n bgClasses,\n baseClasses,\n buttonClasses,\n shapeClasses[shape],\n sizeClasses[size],\n className\n )}>\n {sizedChildren}\n </Component>\n );\n};\n\nexport const IconButton = React.forwardRef(IconButtonInner as React.ForwardRefRenderFunction<HTMLButtonElement, IconButtonProps<any>>) as React.ComponentType<IconButtonProps<any>>;\n","\"use client\";\nimport * as React from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type InputLabelProps = {\n children?: React.ReactNode;\n className?: string;\n shrink?: boolean;\n} & React.LabelHTMLAttributes<HTMLLabelElement>;\n\nconst defaultClasses = {\n root: \"origin-left transition-transform block whitespace-nowrap overflow-hidden text-ellipsis max-w-full\",\n shrink: \"transform translate-y-[2px] scale-75 translate-x-[12px]\",\n expanded: \"translate-x-[16px] top-0 transform translate-y-[16px] scale-100\"\n};\n\nexport const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(function InputLabel(inProps, ref) {\n const {\n shrink,\n className,\n ...other\n } = inProps;\n\n const computedClassName = cls(defaultClasses.root,\n {\n [defaultClasses.shrink]: shrink,\n [defaultClasses.expanded]: !shrink\n }, className);\n\n return (\n <label\n className={cls(\"text-sm font-medium peer-disabled:cursor-not-allowed\",\n defaultBorderMixin, computedClassName)}\n data-shrink={shrink}\n ref={ref}\n {...other}\n />\n );\n});\n","\n\"use client\";\n\nimport React, { useId, useRef, useState } from \"react\";\nimport { CalendarIcon, XIcon, AlertCircleIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { IconButton } from \"./IconButton\";\nimport { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin } from \"../styles\";\nimport { InputLabel } from \"./InputLabel\";\nimport { Typography } from \"./Typography\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport type DateTimeFieldProps = {\n value?: Date | null;\n onChange?: (date: Date | null) => void;\n mode?: \"date\" | \"date_time\";\n disabled?: boolean;\n clearable?: boolean;\n error?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n label?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n inputClassName?: string;\n invisible?: boolean;\n locale?: string;\n /**\n * IANA timezone string (e.g., \"America/New_York\", \"Europe/London\").\n * Used to display and input dates in the specified timezone.\n * The value passed to onChange will always be in UTC.\n * If not provided, uses the user's local timezone.\n */\n timezone?: string;\n /**\n * Names the control when there is no `label` — e.g. when the surrounding\n * form draws the label itself and passes `label={undefined}`.\n */\n \"aria-label\"?: string;\n};\n\nexport const DateTimeField: React.FC<DateTimeFieldProps> = ({\n value,\n label,\n onChange,\n disabled,\n clearable,\n mode = \"date\",\n error,\n size = \"large\",\n className,\n style,\n inputClassName,\n invisible,\n timezone,\n \"aria-label\": ariaLabel\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [focused, setFocused] = useState(false);\n // The label was decorative: an InputLabel with no `htmlFor` beside an input\n // with no `id`, so a date field announced itself by its value even when it\n // visibly had a label. Wired the way TextField already does it.\n const inputId = useId();\n const labelId = `${inputId}-label`;\n const [internalValue, setInternalValue] = useState<string>(\"\");\n const [isTyping, setIsTyping] = useState(false);\n const invalidValue = value !== undefined && value !== null && (!(value instanceof Date) || isNaN(value.getTime()));\n\n // The calendar/clear adornments are IconButtons. Left at their default\n // (`medium`, 40px) they floored the whole field at 40px, so smallest/small\n // rendered identically to medium. Keep them a step below the field.\n const adornmentSize = size === \"large\" ? \"medium\" : size === \"medium\" ? \"small\" : \"smallest\";\n\n useInjectStyles(\"DateTimeField\", inputStyles);\n\n const handleClear = (e: React.MouseEvent) => {\n e.preventDefault();\n setInternalValue(\"\");\n setIsTyping(false);\n onChange?.(null);\n };\n\n // Convert UTC Date to display string in the specified timezone\n const valueAsInputValue = (\n dateValue: Date | null,\n mode: \"date\" | \"date_time\"\n ) => {\n if (!dateValue || !(dateValue instanceof Date) || isNaN(dateValue.getTime())) {\n return \"\";\n }\n const pad = (n: number) => n.toString().padStart(2, \"0\");\n\n // Use Intl.DateTimeFormat to get date parts in the target timezone\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n timeZone: timezone // undefined = local timezone\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-CA\", options);\n const parts = formatter.formatToParts(dateValue);\n\n const getPart = (type: string) => parts.find(p => p.type === type)?.value ?? \"\";\n\n const year = getPart(\"year\");\n const month = getPart(\"month\");\n const day = getPart(\"day\");\n\n if (mode === \"date\") {\n return `${year}-${month}-${day}`;\n } else {\n const hours = getPart(\"hour\");\n const minutes = getPart(\"minute\");\n return `${year}-${month}-${day}T${hours}:${minutes}`;\n }\n };\n\n // Get the UTC offset for a specific date in the target timezone (in minutes)\n const getTimezoneOffsetMinutes = (date: Date, tz?: string): number => {\n if (!tz) {\n // Local timezone: use built-in getTimezoneOffset (returns offset in minutes, inverted sign)\n return -date.getTimezoneOffset();\n }\n // For named timezones, calculate the offset by comparing formatted times\n const utcFormatter = new Intl.DateTimeFormat(\"en-CA\", {\n year: \"numeric\",\nmonth: \"2-digit\",\nday: \"2-digit\",\n hour: \"2-digit\",\nminute: \"2-digit\",\nhour12: false,\n timeZone: \"UTC\"\n });\n const tzFormatter = new Intl.DateTimeFormat(\"en-CA\", {\n year: \"numeric\",\nmonth: \"2-digit\",\nday: \"2-digit\",\n hour: \"2-digit\",\nminute: \"2-digit\",\nhour12: false,\n timeZone: tz\n });\n\n const utcParts = utcFormatter.formatToParts(date);\n const tzParts = tzFormatter.formatToParts(date);\n\n const getPart = (parts: Intl.DateTimeFormatPart[], type: string) =>\n parseInt(parts.find(p => p.type === type)?.value ?? \"0\", 10);\n\n const utcDate = new Date(Date.UTC(\n getPart(utcParts, \"year\"),\n getPart(utcParts, \"month\") - 1,\n getPart(utcParts, \"day\"),\n getPart(utcParts, \"hour\"),\n getPart(utcParts, \"minute\")\n ));\n\n const tzDate = new Date(Date.UTC(\n getPart(tzParts, \"year\"),\n getPart(tzParts, \"month\") - 1,\n getPart(tzParts, \"day\"),\n getPart(tzParts, \"hour\"),\n getPart(tzParts, \"minute\")\n ));\n\n return (tzDate.getTime() - utcDate.getTime()) / 60000;\n };\n\n // Handle input value change - convert from display timezone to UTC\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setInternalValue(inputValue);\n setIsTyping(true);\n\n if (!inputValue) {\n onChange?.(null);\n return;\n }\n\n try {\n let year: number, month: number, day: number, hours = 0, minutes = 0;\n\n if (mode === \"date\") {\n // Parse date-only input: \"YYYY-MM-DD\"\n [year, month, day] = inputValue.split(\"-\").map(Number);\n } else {\n // Parse datetime-local input: \"YYYY-MM-DDTHH:MM\"\n const [datePart, timePart] = inputValue.split(\"T\");\n [year, month, day] = datePart.split(\"-\").map(Number);\n [hours, minutes] = timePart.split(\":\").map(Number);\n }\n\n let resultDate: Date;\n\n if (!timezone) {\n // No timezone specified: interpret input as local time (backward compatible)\n resultDate = new Date(year, month - 1, day, hours, minutes);\n } else {\n // Timezone specified: interpret input as that timezone and convert to UTC\n // We need to find the UTC equivalent of the entered time in the target timezone\n\n // Create a reference UTC date to calculate the offset for this moment\n const refUtcDate = new Date(Date.UTC(year, month - 1, day, hours, minutes));\n const offsetMinutes = getTimezoneOffsetMinutes(refUtcDate, timezone);\n\n // Convert from target timezone to UTC:\n // If user entered 00:00 in Mexico (UTC-6, offset=-360), we subtract the offset\n // Date.UTC gives us 00:00 UTC, subtracting -360 minutes (= adding 360 min) gives 06:00 UTC\n resultDate = new Date(Date.UTC(year, month - 1, day, hours, minutes) - offsetMinutes * 60000);\n }\n\n if (isNaN(resultDate.getTime())) {\n throw new Error(\"Invalid date\");\n }\n\n onChange?.(resultDate);\n } catch (e) {\n // Don't call onChange with null while typing\n return;\n }\n };\n\n const handleFocus = () => {\n setFocused(true);\n setIsTyping(true);\n setInternalValue(valueAsInputValue(value ?? null, mode));\n };\n\n const handleBlur = () => {\n setFocused(false);\n setIsTyping(false);\n };\n\n return (\n <>\n {/* Inject the styles to hide the calendar icon */}\n <style>{inputStyles}</style>\n <div\n className={cls(\n \"rounded-lg relative max-w-full\",\n !invisible && fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n className\n )}\n style={style}\n onClick={() => {\n if (!disabled) {\n inputRef.current?.focus();\n }\n }}\n >\n {label && (\n <InputLabel\n id={labelId}\n htmlFor={inputId}\n className={cls(\n \"absolute top-1 pointer-events-none\",\n !error\n ? focused\n ? \"text-primary\"\n : \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-600 dark:text-red-500\",\n disabled ? \"opacity-50\" : \"\"\n )}\n shrink={true}\n // shrink={hasValue || focused}\n >\n {label}\n </InputLabel>\n )}\n\n <input\n ref={inputRef}\n id={inputId}\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : ariaLabel}\n type={mode === \"date_time\" ? \"datetime-local\" : \"date\"}\n value={isTyping ? internalValue : valueAsInputValue(value ?? null, mode)}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n className={cls(\n \"w-full outline-hidden bg-transparent leading-normal text-sm px-3\",\n clearable ? \"pr-14\" : \"pr-12\",\n \"rounded-lg\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n // A flat py-2 (16px) plus the line box floored\n // the field at 40px, so smallest/small/medium all\n // rendered the same height. Scale it with `size`.\n label\n ? \"pt-8 pb-2\"\n : { smallest: \"py-0.5\", small: \"py-1\", medium: \"py-2\", large: \"py-3\" }[size],\n inputClassName,\n disabled &&\n \"border border-transparent outline-hidden opacity-50 dark:opacity-50 text-surface-accent-600 dark:text-surface-accent-500\"\n )}\n />\n <IconButton\n size={adornmentSize}\n onClick={(e) => {\n e.stopPropagation();\n inputRef.current?.showPicker();\n }}\n className=\"absolute right-3 top-1/2 transform -translate-y-1/2 text-surface-accent-500!\"\n >\n <CalendarIcon/>\n </IconButton>\n {clearable && value && (\n <IconButton\n size={adornmentSize}\n onClick={handleClear}\n className=\"absolute right-14 top-1/2 transform -translate-y-1/2 text-surface-accent-400 \"\n >\n <XIcon/>\n </IconButton>\n )}\n </div>\n {invalidValue && (\n <div className=\"flex items-center m-2\">\n <AlertCircleIcon size={iconSize.small} color={\"error\"}/>\n <div className=\"pl-2\">\n <Typography variant={\"body2\"}>\n Invalid date value for this field\n </Typography>\n <Typography variant={\"body2\"}>\n {`The provided value is: ${JSON.stringify(value)}`}\n </Typography>\n </div>\n </div>\n )}\n </>\n );\n};\n\nconst inputStyles = `\n /* Hide the default calendar icon in Chrome, Safari, Edge, Opera */\n input[type=\"date\"]::-webkit-calendar-picker-indicator,\n input[type=\"datetime-local\"]::-webkit-calendar-picker-indicator {\n display: none;\n -webkit-appearance: none;\n }\n /* Hide default calendar icon in Firefox */\n input[type=\"date\"],\n input[type=\"datetime-local\"] {\n -moz-appearance:textfield;\n }\n `;\n","\"use client\";\nimport React, { useEffect, useState } from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { PortalContainerProvider, usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type DialogProps = {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: React.ReactNode;\n className?: string;\n containerClassName?: string;\n fullWidth?: boolean;\n fullHeight?: boolean;\n fullScreen?: boolean;\n scrollable?: boolean;\n maxWidth?: keyof typeof widthClasses;\n modal?: boolean;\n onOpenAutoFocus?: (e: Event) => void;\n onEscapeKeyDown?: (e: KeyboardEvent) => void;\n onPointerDownOutside?: (e: Event) => void;\n onInteractOutside?: (e: Event) => void;\n /**\n * If `true`, the dialog will not focus the first focusable element when opened.\n */\n disableInitialFocus?: boolean;\n portalContainer?: HTMLElement | null;\n \"aria-describedby\"?: string;\n};\n\nconst widthClasses = {\n xs: \"max-w-xs w-xs\",\n sm: \"max-w-sm w-sm\",\n md: \"max-w-md w-md\",\n lg: \"max-w-lg w-lg\",\n xl: \"max-w-xl w-xl\",\n \"2xl\": \"max-w-2xl w-2xl\",\n \"3xl\": \"max-w-3xl w-3xl\",\n \"4xl\": \"max-w-4xl w-4xl\",\n \"5xl\": \"max-w-5xl w-5xl\",\n \"6xl\": \"max-w-6xl w-6xl\",\n \"7xl\": \"max-w-7xl w-7xl\",\n full: \"max-w-full w-full\"\n};\n\nexport const Dialog = ({\n open,\n onOpenChange,\n children,\n className,\n containerClassName,\n fullWidth = true,\n fullHeight,\n fullScreen,\n scrollable = true,\n maxWidth = \"lg\",\n modal = true,\n onOpenAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n disableInitialFocus = true,\n portalContainer,\n \"aria-describedby\": ariaDescribedby\n }: DialogProps) => {\n const [displayed, setDisplayed] = useState(false);\n // Where popups rendered *inside* this dialog get portaled to. A modal\n // dialog locks scrolling everywhere but its own content, so a popup\n // portaled to `document.body` renders fine and then refuses to scroll:\n // `react-remove-scroll` cancels every wheel event outside the lock.\n // Handing descendants this host keeps them inside it.\n const [popupHost, setPopupHost] = useState<HTMLDivElement | null>(null);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n if (!open) {\n const timeout = setTimeout(() => {\n setDisplayed(false);\n }, 100);\n return () => clearTimeout(timeout);\n } else {\n setDisplayed(true);\n return () => {\n };\n }\n }, [open]);\n\n return (\n <DialogPrimitive.Root open={displayed || open}\n modal={modal}\n onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal container={finalContainer}>\n\n <div className={cls(\"fixed inset-0 z-50\", containerClassName)}>\n\n <DialogPrimitive.Overlay\n className={cls(\"fixed inset-0 transition-opacity ease-in-out duration-200 bg-black/50 dark:bg-black/60 backdrop-blur-sm\",\n displayed && open ? \"opacity-100\" : \"opacity-0\",\n \"z-50 fixed top-0 left-0 w-full h-full flex justify-center items-center\"\n )}\n style={{\n pointerEvents: displayed ? \"auto\" : \"none\"\n }}\n />\n\n <DialogPrimitive.Content\n onEscapeKeyDown={onEscapeKeyDown}\n onOpenAutoFocus={(e) => {\n if (disableInitialFocus) {\n e.preventDefault();\n }\n onOpenAutoFocus?.(e);\n }}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n aria-describedby={ariaDescribedby}\n className={cls(\"relative h-full outline-none flex justify-center items-center z-60 opacity-100 transition-all duration-200 ease-in-out\")}\n >\n <div\n className={cls(paperMixin,\n \"rounded-2xl\",\n \"z-60\",\n \"relative\",\n \"overflow-hidden\",\n \"outline-none focus:outline-none\",\n fullWidth && !fullScreen ? \"w-11/12\" : undefined,\n fullHeight && !fullScreen ? \"h-full\" : undefined,\n \"text-text-primary dark:text-text-primary-dark\",\n \"justify-center items-center\",\n fullScreen ? \"h-screen w-screen\" : \"max-h-[90vh] shadow-lg\",\n \"ease-in-out duration-200\",\n scrollable && \"overflow-y-auto\",\n displayed && open ? \"opacity-100 scale-100\" : \"opacity-0 scale-[0.97]\",\n maxWidth && !fullScreen ? widthClasses[maxWidth] : undefined,\n className\n )}>\n <PortalContainerProvider container={popupHost}>\n {children}\n </PortalContainerProvider>\n </div>\n\n {/* Sized to nothing so it changes no layout, but positioned and\n stacked above the paper so popups portaled here are not\n painted behind it. */}\n <div ref={setPopupHost} className={\"relative z-70 w-0 h-0\"}/>\n\n </DialogPrimitive.Content>\n </div>\n\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n","import React from \"react\";\nimport { defaultBorderMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport function DialogActions({\n children,\n position = \"sticky\",\n translucent = true,\n className\n }: {\n children: React.ReactNode,\n position?: \"sticky\" | \"absolute\",\n translucent?: boolean,\n className?: string\n}) {\n\n return <div\n className={cls(\n defaultBorderMixin,\n // `shrink-0`: as a flex child at the foot of a column this bar must\n // keep its height instead of being squeezed by the content above it.\n \"pt-2 pb-4 px-4 border-t flex flex-row items-center justify-end shrink-0 bottom-0 right-0 left-0 text-right z-2 gap-2\",\n position,\n \"bg-surface-card/60\",\n translucent ? \"backdrop-blur-sm\" : \"\",\n className)}>\n {children}\n </div>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport function DialogContent({\n children,\n className,\n fullHeight,\n includeMargin = true\n }: {\n children: React.ReactNode,\n includeMargin?: boolean,\n fullHeight?: boolean,\n className?: string\n}) {\n\n if (fullHeight)\n return <div className={\"flex-grow flex flex-col h-full relative\"}>\n {children}\n </div>;\n\n return <div\n className={cls(\"flex-grow\",\n { \"my-8 mx-8\": includeMargin },\n className)}>\n {children}\n </div>;\n}\n","\"use client\";\n\nimport React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Typography, TypographyProps, TypographyVariant } from \"./Typography\";\nimport { cls } from \"../util\";\n\nexport type DialogContentProps = TypographyProps & {\n children: React.ReactNode,\n hidden?: boolean,\n className?: string,\n includeMargin?: boolean,\n variant?: TypographyVariant\n};\n\nexport function DialogTitle({\n children,\n hidden,\n className,\n variant = \"subtitle2\",\n gutterBottom = true,\n includeMargin = true,\n ...props\n }: DialogContentProps) {\n\n const title = <DialogPrimitive.Title asChild>\n <Typography variant={variant}\n className={cls({ \"mt-8 mx-8\": includeMargin }, className)}\n gutterBottom={gutterBottom}\n {...props}>\n {children}\n </Typography>\n </DialogPrimitive.Title>;\n\n if (hidden) {\n return <VisuallyHidden.Root>{title}</VisuallyHidden.Root>\n }\n\n return title;\n}\n","\n\"use client\";\nimport React, { PropsWithChildren, useEffect, useState } from \"react\";\n\nimport * as Collapsible from \"@radix-ui/react-collapsible\";\nimport { defaultBorderMixin, fieldBackgroundMixin } from \"../styles\";\nimport { ChevronDownIcon } from \"lucide-react\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport function ExpandablePanel({\n title,\n children,\n invisible = false,\n expanded,\n onExpandedChange,\n initiallyExpanded = true,\n titleClassName,\n asField,\n className,\n innerClassName\n }: PropsWithChildren<{\n title: React.ReactNode,\n invisible?: boolean,\n initiallyExpanded?: boolean;\n expanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void,\n titleClassName?: string,\n asField?: boolean,\n className?: string,\n innerClassName?: string\n}>) {\n\n useInjectStyles(\"ExpandablePanel\", `\n.CollapsibleContent {\n overflow: hidden;\n}\n.CollapsibleContent[data-state='open'] {\n animation: slideDown 220ms ease-out\n}\n.CollapsibleContent[data-state='closed'] {\n animation: slideUp 220ms ease-out;\n}\n\n@keyframes slideDown {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n\n@keyframes slideUp {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}`);\n\n const [open, setOpen] = useState(expanded !== undefined ? expanded : initiallyExpanded);\n const [allowOverflow, setAllowOverflow] = useState(open);\n\n useEffect(() => {\n if (open) {\n setTimeout(() => {\n setAllowOverflow(true);\n }, 220);\n } else {\n setAllowOverflow(false);\n }\n }, [open]);\n\n useEffect(() => {\n if (expanded !== undefined)\n setOpen(expanded);\n }, [expanded]);\n\n return (<>\n <Collapsible.Root\n className={cls(\n !invisible && defaultBorderMixin + \" border\",\n \"rounded-lg\",\n \"w-full\",\n className\n )}\n open={open}\n onOpenChange={(updatedOpen: boolean) => {\n onExpandedChange?.(updatedOpen);\n setOpen(updatedOpen);\n }}>\n\n <Collapsible.Trigger asChild>\n <div\n className={cls(\n \"rounded-t-lg flex items-center justify-between w-full min-h-[52px]\",\n \"hover:bg-surface-hover active:bg-surface-active\",\n invisible ? \"border-b px-2\" : \"p-4\",\n open ? \"py-6\" : \"py-4\",\n \"transition-all duration-200\",\n invisible && defaultBorderMixin,\n asField && fieldBackgroundMixin,\n titleClassName,\n \"cursor-pointer\"\n )}\n role=\"button\"\n tabIndex={0}\n aria-expanded={open}\n >\n {title}\n <ChevronDownIcon className={cls(\"transition\", open ? \"rotate-180\" : \"\")}/>\n </div>\n </Collapsible.Trigger>\n\n <Collapsible.Content\n className={cls(\"CollapsibleContent\")}\n style={{\n overflow: allowOverflow ? \"visible\" : \"hidden\"\n }}\n >\n <div className={innerClassName}>\n {children}\n </div>\n </Collapsible.Content>\n </Collapsible.Root>\n </>\n )\n}\n","\"use client\";\nimport React from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { fieldBackgroundHoverMixin, fieldBackgroundMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { Typography } from \"./Typography\";\n\nexport interface FileUploadError {\n message: string;\n code: string;\n}\n\nexport type OnFileUploadRejected = (fileRejections: {\n file: File;\n errors: readonly FileUploadError[];\n}[], event: object) => void;\n\nexport type OnFilesUploadAdded = (files: File[]) => void;\n\nexport type FileUploadProps = {\n // e.g. accept={{ \"*/image\": [] }}\n accept?: Record<string, string[]>,\n onFilesAdded: OnFilesUploadAdded,\n onFilesRejected?: OnFileUploadRejected,\n maxSize?: number,\n disabled?: boolean;\n maxFiles?: number;\n title?: React.ReactNode;\n uploadDescription?: React.ReactNode;\n preventDropOnDocument?: boolean;\n size?: \"small\" | \"medium\" | \"large\";\n};\n\nexport function FileUpload({\n accept,\n onFilesAdded,\n onFilesRejected,\n maxSize,\n disabled,\n maxFiles,\n title,\n uploadDescription,\n children,\n preventDropOnDocument = true,\n size\n}: React.PropsWithChildren<FileUploadProps>) {\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject\n } = useDropzone({\n accept,\n noDragEventsBubbling: true,\n maxSize,\n onDrop: onFilesAdded,\n onDropRejected: onFilesRejected,\n disabled,\n maxFiles,\n preventDropOnDocument\n }\n );\n return <div\n {...getRootProps()}\n role=\"button\"\n aria-label={typeof title === \"string\" ? title : (typeof uploadDescription === \"string\" ? uploadDescription : \"Upload file\")}\n aria-disabled={disabled || undefined}\n className={cls(\n fieldBackgroundMixin,\n \"flex gap-2\",\n \"p-4 box-border relative items-center border-2 border-solid border-transparent outline-hidden rounded-lg duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary\",\n {\n \"h-44\": size === \"large\",\n \"h-28\": size === \"medium\",\n \"h-16\": size === \"small\",\n \"cursor-pointer\": !disabled,\n [fieldBackgroundHoverMixin]: !isDragActive,\n \"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-red-500\": isDragReject,\n \"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-green-500\": isDragAccept\n })}>\n\n <Typography variant={\"caption\"} color={\"secondary\"} className={\"absolute top-2 left-3.5 cursor-inherit\"}>\n {title}\n </Typography>\n\n <input\n {...getInputProps()}/>\n\n {children}\n\n <div\n className=\"grow h-28 box-border flex flex-col items-center justify-center text-center\">\n <Typography align={\"center\"}\n variant={\"label\"}\n className={\"flex flex-row gap-2 justify-center\"}>\n {uploadDescription}\n </Typography>\n </div>\n\n </div>\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport interface FilterChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /**\n * The text label displayed on the chip.\n */\n children: React.ReactNode;\n /**\n * Whether the chip is currently in an active/selected state.\n */\n active?: boolean;\n /**\n * Optional icon rendered before the label.\n */\n icon?: React.ReactNode;\n /**\n * Size variant.\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether the chip is disabled.\n */\n disabled?: boolean;\n}\n\nconst sizeClasses = {\n small: \"px-2 py-0.5 text-xs\",\n medium: \"px-2.5 py-1 text-xs\"\n};\n\n/**\n * A toggle chip used for filter presets and similar multi-select controls.\n *\n * Reads as a text tab: no fill at rest, the alpha highlight when active. It\n * shares no grammar with the tinted enum {@link Chip}, which carries a hue.\n *\n * @group Interactive components\n */\nexport const FilterChip = React.forwardRef<HTMLButtonElement, FilterChipProps>(function FilterChip({\n children,\n active = false,\n onClick,\n icon,\n size = \"medium\",\n className,\n disabled = false,\n ...rest\n}: FilterChipProps, ref) {\n return (\n <button\n ref={ref}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={cls(\n \"inline-flex items-center gap-1 rounded-md\",\n \"font-medium whitespace-nowrap select-none shrink-0\",\n \"transition-colors duration-150\",\n // Colour only, no width: the 2px comes from the global inset ring, which a\n // chip needs because the preset row it sits in is a horizontal\n // scroller — an outset ring on the first or last chip was cut off\n // by the scrollport edge.\n \"focus-visible:outline-none focus-visible:ring-primary/50\",\n sizeClasses[size],\n !disabled && \"cursor-pointer\",\n // Hover is one step along the same ramp the chip already sits\n // on, the way every other hoverable surface here moves. It used\n // to be `hover:bg-primary/5` for the inactive chip, which\n // *replaces* the resting fill with a tint fainter than it — so\n // pointing at a chip made its background vanish. The active chip\n // had no hover state at all.\n // These are view presets, not enum values, so they take the row\n // grammar (an alpha highlight for the active one, text otherwise)\n // and not the chip grammar (a hue tint). A primary ring here made\n // every preset look like a selected enum cell.\n active\n ? \"bg-surface-active text-text-primary dark:text-text-primary-dark\"\n : cls(\n \"bg-transparent text-text-secondary dark:text-text-secondary-dark\",\n !disabled && \"hover:bg-surface-hover\"\n ),\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...rest}\n >\n {icon}\n {children}\n </button>\n );\n});\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nconst colorClasses = {\n info: \"bg-blue-500/8 dark:bg-blue-500/12 text-blue-800 dark:text-blue-200 border border-blue-500/20 dark:border-blue-500/25\",\n warn: \"bg-amber-500/8 dark:bg-amber-500/12 text-amber-800 dark:text-amber-200 border border-amber-500/20 dark:border-amber-500/25\"\n}\n\nexport function InfoLabel({\n children,\n mode = \"info\"\n }: {\n children: React.ReactNode,\n mode?: \"info\" | \"warn\"\n}) {\n\n return (\n <div\n className={cls(\"my-3 py-2 px-4 rounded-lg text-sm font-medium leading-snug\", colorClasses[mode])}>\n {children}\n </div>\n )\n}\n","\"use client\";\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\ntype LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {\n border?: boolean,\n onClick?: React.MouseEventHandler<HTMLLabelElement>\n};\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n LabelProps\n>(({\n className,\n border,\n onClick,\n ...props\n }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n onClick={onClick}\n className={cls(\"text-sm font-medium peer-disabled:cursor-not-allowed\",\n border && \"border border-hairline-strong rounded-md px-3 py-1.5\",\n onClick && \"hover:cursor-pointer hover:bg-surface-hover\",\n defaultBorderMixin, className)}\n {...props}\n />\n))\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import React from \"react\";\nimport { Button, ButtonProps } from \"./Button\";\nimport { CircularProgress } from \"./CircularProgress\";\n\nexport type LoadingButtonProps<P extends React.ElementType> = ButtonProps<P> & {\n startIcon?: React.ReactNode;\n loading?: boolean;\n}\n\nexport function LoadingButton<P extends React.ElementType = \"button\">({\n children,\n loading,\n disabled,\n onClick,\n startIcon,\n ...props\n }: LoadingButtonProps<P>) {\n return (\n <Button\n disabled={loading || disabled}\n onClick={onClick}\n component={props.component as React.ElementType}\n {...props}\n >\n {loading && (\n <CircularProgress size={\"smallest\"}/>\n )}\n {!loading && startIcon}\n {children}\n </Button>\n );\n};\n","\"use client\";\nimport React, { useMemo } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport MarkdownIt from \"markdown-it\";\nimport { cls } from \"../util\";\n\nexport interface MarkdownProps {\n source: string,\n size?: \"small\" | \"medium\" | \"large\" | \"xl\" | \"2xl\";\n className?: string\n}\n\nconst proseClasses = {\n small: \"prose prose-sm typography-body2\",\n medium: \"prose typography-body1\",\n large: \"prose prose-lg\",\n xl: \"prose prose-xl\",\n \"2xl\": \"prose prose-2xl\"\n};\n\n/**\n * Tailwind typography-plugin weight overrides.\n * The plugin defaults to very heavy weights (h1: 800, h2: 700, h3/h4: 600,\n * strong: 600, code: 600) which clash with the Rebase design-system that uses\n * font-light (300) / font-normal (400) for headings.\n * We reset them here so rendered markdown matches the rest of the UI.\n */\nconst proseWeightOverrides = [\n \"prose-headings:font-normal\",\n \"prose-strong:font-semibold\",\n \"prose-code:font-normal\",\n \"prose-blockquote:font-normal\",\n \"prose-a:font-normal\"\n].join(\" \");\n\nconst md = new MarkdownIt({ html: false });\n/**\n * @group Preview components\n */\nexport const Markdown = React.memo<MarkdownProps>(function Markdown({\n source,\n className,\n size = \"medium\"\n }: MarkdownProps) {\n const html = useMemo(() => {\n return md.render(typeof source === \"string\" ? source : \"\");\n }, [source]);\n\n return <div\n className={cls(proseClasses[size], \"dark:prose-invert prose-headings:font-title\", proseWeightOverrides, className)}\n dangerouslySetInnerHTML={{ __html: html }}\n />;\n }\n , equal) as React.FunctionComponent<MarkdownProps>;\n","\"use client\";\nimport React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { focusedDisabled, paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type MenuProps = {\n children: React.ReactNode;\n trigger: React.ReactNode;\n\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n\n portalContainer?: HTMLElement | null;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n\n sideOffset?: number;\n className?: string;\n}\n\nconst Menu = React.forwardRef<\n React.ElementRef<typeof DropdownMenu.Trigger>,\n MenuProps\n>(({\n children,\n trigger,\n open,\n defaultOpen,\n side,\n align,\n onOpenChange,\n portalContainer,\n sideOffset = 4,\n className\n }, ref) => {\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n return (\n <DropdownMenu.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}>\n <DropdownMenu.Trigger\n ref={ref}\n asChild>\n {trigger}\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal container={finalContainer}>\n <DropdownMenu.Content\n side={side}\n sideOffset={sideOffset}\n align={align}\n // `z-50` is the floating layer — the tier `Dialog`, `Sheet`,\n // `Select` and `Tooltip` all sit on. Radix copies this value\n // onto the popper wrapper it portals next to them, so at any\n // lower value the menu opens *behind* the dialog or sheet it\n // was opened from: visible in the DOM, painted under the\n // overlay, and unclickable. Peers on this tier stack by mount\n // order, which is what puts a menu above the dialog holding\n // its trigger, and a dialog that menu opens above them both.\n className={cls(paperMixin, focusedDisabled, \"py-2 z-50\", className)}>\n {children}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n})\nMenu.displayName = \"Menu\"\n\nexport { Menu }\n\nexport type MenuItemProps = {\n children: React.ReactNode;\n dense?: boolean;\n disabled?: boolean;\n onClick?: (event: React.MouseEvent) => void;\n className?: string;\n};\n\nexport const MenuItem = React.memo(({\n children,\n dense = false, // Default value is false if not provided\n disabled = false,\n onClick,\n className\n }: MenuItemProps) => {\n // Dynamically adjusting the class based on the \"dense\" prop\n const classNames = cls(\n onClick && !disabled && \"cursor-pointer\",\n disabled && \"opacity-50 cursor-not-allowed\",\n \"rounded-md text-sm font-medium text-surface-accent-700 dark:text-surface-accent-300 flex items-center gap-4 transition-colors duration-150\",\n !disabled && \"hover:bg-surface-hover\",\n dense ? \"px-4 py-1.5\" : \"px-4 py-2\",\n className\n );\n\n return (\n <DropdownMenu.Item\n className={classNames}\n disabled={disabled}\n onClick={disabled ? undefined : onClick}>\n {children}\n </DropdownMenu.Item>\n );\n});\n\nMenuItem.displayName = \"MenuItem\";\n","\nimport * as React from \"react\";\n\nimport * as MenubarPrimitive from \"@radix-ui/react-menubar\";\nimport { cls } from \"../util\";\nimport { CheckIcon, ChevronRightIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport function Menubar({\n children,\n onSelect,\n value,\n defaultValue,\n onValueChange,\n className\n }: {\n children: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n /** Value of the open menu, controlled. Pair with `onValueChange`. */\n value?: string,\n /** Value of the menu open on mount, uncontrolled. */\n defaultValue?: string,\n onValueChange?: (value: string) => void,\n className?: string\n}) {\n return (\n <MenubarPrimitive.Root\n onSelect={onSelect}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n className={cls(\"z-10 flex bg-surface-card p-[3px] rounded-lg shadow-sm\", className)}>\n {children}\n </MenubarPrimitive.Root>\n )\n}\n\nexport function MenubarMenu({\n children,\n value\n }: {\n children: React.ReactNode,\n /** Identifies this menu to the parent Menubar's `value`/`defaultValue`. */\n value?: string\n}) {\n return (\n <MenubarPrimitive.Menu value={value}>\n {children}\n </MenubarPrimitive.Menu>\n )\n}\n\nexport function MenubarTrigger({\n children,\n onSelect,\n className\n }: {\n children: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n className?: string\n}) {\n return (\n <MenubarPrimitive.Trigger\n onSelect={onSelect}\n className={cls(\"py-2 px-3 outline-none select-none font-medium leading-none rounded-md text-text-primary dark:text-text-primary-dark text-sm transition-colors duration-150 flex items-center justify-between gap-[2px] data-[highlighted]:bg-surface-hover data-[state=open]:bg-surface-active hover:bg-surface-hover\",\n className)}>\n {children}\n </MenubarPrimitive.Trigger>\n )\n}\n\nexport function MenubarPortal({\n children,\n portalContainer\n }: {\n children: React.ReactNode;\n portalContainer?: HTMLElement | null;\n}) {\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n return (\n <MenubarPrimitive.Portal container={finalContainer}>\n {children}\n </MenubarPrimitive.Portal>\n )\n}\n\nexport function MenubarContent({\n children,\n className,\n align,\n sideOffset,\n alignOffset,\n onSelect,\n ...rest\n }: {\n children: React.ReactNode,\n className?: string,\n onSelect?: (event: React.SyntheticEvent) => void,\n align?: \"start\" | \"center\" | \"end\",\n sideOffset?: number,\n alignOffset?: number\n}) {\n return (\n <MenubarPrimitive.Content\n onSelect={onSelect}\n // `z-50`, the floating layer — see the note in `Menu`. This carried\n // no z-index at all, so the wrapper Radix portals out to the body\n // got `auto` and the menu opened underneath any dialog or panel it\n // was hosted in.\n className={cls(\"z-50 min-w-[220px] bg-surface-card rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]\", className)}\n align={align ?? \"start\"}\n sideOffset={sideOffset ?? 5}\n alignOffset={alignOffset ?? -3}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Content>\n )\n}\n\nexport function MenubarItem({\n children,\n leftPadding,\n className,\n disabled,\n onSelect,\n ...rest\n }: {\n children: React.ReactNode,\n onSelect?: (event: Event) => void;\n leftPadding?: boolean,\n className?: string,\n disabled?: boolean\n}) {\n return (\n <MenubarPrimitive.Item\n onSelect={onSelect}\n className={cls(\"group text-sm leading-none rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 outline-none data-[state=open]:bg-surface-active data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n leftPadding ? \"pl-5\" : \"\",\n disabled ? \"pointer-events-none text-text-secondary dark:text-text-secondary-dark\" : \"text-text-primary dark:text-text-primary-dark\",\n className)}\n disabled={disabled}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Item>\n )\n}\n\nexport function MenubarSeparator({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.Separator\n className={cls(\"h-[1px] bg-hairline m-[5px]\", className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Separator>\n )\n}\n\nexport function MenubarSub({\n children,\n ...rest\n }: {\n children?: React.ReactNode,\n}) {\n return (\n <MenubarPrimitive.Sub\n {...rest}\n >\n {children}\n </MenubarPrimitive.Sub>\n )\n}\n\nexport function MenubarSubTrigger({\n children,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.SubTrigger\n onSelect={onSelect}\n className={cls(\"group text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 outline-none data-[state=open]:bg-surface-active data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.SubTrigger>\n )\n}\n\nexport function MenubarSubContent({\n children,\n alignOffset,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n alignOffset?: number,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.SubContent\n onSelect={onSelect}\n alignOffset={alignOffset ?? -5}\n className={cls(\"min-w-[220px] bg-surface-card rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]\",\n className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.SubContent>\n )\n}\n\nexport function MenubarCheckboxItem({\n children,\n checked,\n onCheckedChange,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: Event) => void;\n checked?: boolean,\n onCheckedChange?: () => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.CheckboxItem\n onSelect={onSelect}\n className={cls(\"text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 pl-5 outline-none data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n checked={checked}\n onCheckedChange={onCheckedChange}\n {...rest}\n >\n {children}\n </MenubarPrimitive.CheckboxItem>\n )\n}\n\nexport function MenubarItemIndicator({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.ItemIndicator\n className={cls(\"absolute left-0 w-4 inline-flex items-center justify-center\", className)}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.smallest}/>}\n </MenubarPrimitive.ItemIndicator>\n )\n}\n\nexport function MenubarRadioGroup({\n children,\n className,\n value,\n onValueChange,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n value?: string,\n onValueChange?: (value: string) => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.RadioGroup\n className={cls(className)}\n value={value}\n onValueChange={onValueChange}\n onSelect={onSelect}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.small}/>}\n </MenubarPrimitive.RadioGroup>\n )\n}\n\nexport function MenubarRadioItem({\n children,\n className,\n value,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: Event) => void;\n value: string,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.RadioItem\n onSelect={onSelect}\n className={cls(\"text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 pl-5 outline-none data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n value={value}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.small}/>}\n </MenubarPrimitive.RadioItem>\n )\n}\n\nexport function MenubarShortcut({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <div\n className={cls(\"ml-auto pl-5 group-data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark\",\n className)}\n {...rest}>\n {children}\n </div>\n )\n}\n\nexport function MenubarSubTriggerIndicator() {\n return (\n <div className=\"ml-auto pl-5 \">\n <ChevronRightIcon size={iconSize.small}/>\n </div>\n )\n}\n","import * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport { cls } from \"../util\";\n\nexport function Separator({\n orientation,\n decorative,\n className\n }: {\n orientation: \"horizontal\" | \"vertical\",\n decorative?: boolean,\n className?: string\n}) {\n if (orientation === \"horizontal\")\n return (\n <SeparatorPrimitive.Root\n decorative={decorative}\n orientation=\"horizontal\"\n className={cls(\"bg-hairline data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px my-4\", className)}/>\n );\n else\n return (\n <SeparatorPrimitive.Root\n className={cls(\"bg-hairline data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px mx-4\", className)}\n decorative={decorative}\n orientation=\"vertical\"\n />\n );\n}\n","import React from \"react\";\nimport { cls } from \"../../util\";\n\n/**\n * The label above a Select or MultiSelect.\n *\n * It used `text-surface-accent-500` — a SURFACE scale, borrowed for type. The\n * label above a TextField has always used `text-text-secondary`, and the two are\n * the same role, so a form mixing the components showed two different label\n * colours: `#64748b` blue-grey over a Select, `#757575` neutral over a TextField.\n * Measured side by side on /debug/ui, which is where it is most obvious, because\n * the reference puts them in adjacent columns.\n *\n * The text tokens are also the tuned ones: `--color-surface-500` was moved to\n * #797979 precisely so muted type clears AA on both grounds. The slate scale\n * carries no such guarantee — it is for surfaces.\n */\nexport function SelectInputLabel({ children, error }: { children: React.ReactNode, error?: boolean }) {\n return <div className={cls(\"text-sm font-medium ml-3.5 mb-1\",\n error ? \"text-red-600 dark:text-red-500\" : \"text-text-secondary dark:text-text-secondary-dark\")}>\n {children}\n </div>;\n}\n","\n\"use client\";\nimport { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { ChangeEvent, Children, useEffect, useState } from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cls } from \"../util\";\n\nimport { Separator } from \"./Separator\";\nimport { Chip } from \"./Chip\";\nimport { SelectInputLabel } from \"./common/SelectInputLabel\";\nimport {\n defaultBorderMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedDisabled\n} from \"../styles\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type MultiSelectValue = string | number | boolean;\n\n// Make the context properly generic\ninterface MultiSelectContextProps<T extends MultiSelectValue = string> {\n fieldValue?: T[];\n onItemClick: (v: T) => void;\n}\n\n// Create a proper generic context\nexport const MultiSelectContext = React.createContext<MultiSelectContextProps<MultiSelectValue>>(null! as MultiSelectContextProps<MultiSelectValue>);\n\n/**\n * Props for MultiSelect component\n */\ninterface MultiSelectProps<T extends MultiSelectValue = string> {\n modalPopover?: boolean;\n className?: string;\n open?: boolean,\n name?: string,\n id?: string,\n onOpenChange?: (open: boolean) => void,\n value?: T[],\n inputClassName?: string,\n onChange?: React.EventHandler<ChangeEvent<HTMLSelectElement>>,\n onValueChange?: (updatedValue: T[]) => void,\n placeholder?: React.ReactNode,\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n useChips?: boolean,\n label?: React.ReactNode | string,\n disabled?: boolean,\n error?: boolean,\n position?: \"item-aligned\" | \"popper\",\n endAdornment?: React.ReactNode,\n multiple?: boolean,\n includeSelectAll?: boolean,\n includeClear?: boolean,\n inputRef?: React.Ref<HTMLButtonElement>,\n padding?: boolean,\n invisible?: boolean,\n children: React.ReactNode;\n renderValues?: (values: T[]) => React.ReactNode;\n portalContainer?: HTMLElement | null;\n /**\n * Accessible name for the trigger.\n *\n * Without it the name is whatever the button happens to contain — the\n * selected chips, or nothing at all when the field is empty — so an empty\n * multi-select announced itself as an unnamed button. `label` cannot serve:\n * an entity form passes an element there, because the label carries the\n * property's type icon.\n */\n \"aria-label\"?: string;\n}\n\n// Use generic type for the forwarded ref\nexport const MultiSelect = React.forwardRef<\n HTMLButtonElement,\n MultiSelectProps\n>(\n (\n {\n value,\n size = \"large\",\n label,\n error,\n onValueChange,\n invisible,\n disabled,\n placeholder,\n modalPopover = true,\n includeClear = true,\n includeSelectAll = true,\n useChips = true,\n className,\n inputClassName,\n inputRef,\n children,\n renderValues,\n open,\n onOpenChange,\n portalContainer,\n \"aria-label\": ariaLabel\n },\n ref\n ) => {\n const [isMounted, setIsMounted] = useState(false);\n const [isPopoverOpen, setIsPopoverOpen] = useState(open ?? false);\n const [selectedValues, setSelectedValues] = useState<string[]>(value ?? []);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n const onPopoverOpenChange = (open: boolean) => {\n setIsPopoverOpen(open);\n onOpenChange?.(open);\n }\n\n useEffect(() => {\n setIsPopoverOpen(open ?? false);\n }, [open]);\n\n const allValues = React.useMemo(() => children\n ?\n Children.map(children, (child) => {\n if (React.isValidElement<MultiSelectItemProps>(child)) {\n return child.props.value;\n }\n return null;\n })?.filter(Boolean) ?? []\n : [], [children]);\n\n const optionsMap = React.useMemo(() => {\n const map = new Map<string, React.ReactNode>();\n Children.forEach(children, (child) => {\n if (React.isValidElement<MultiSelectItemProps>(child)) {\n map.set(String(child.props.value), child.props.children);\n }\n });\n return map;\n }, [children]);\n\n React.useEffect(() => {\n setSelectedValues(value ?? []);\n }, [value]);\n\n const updateValues = React.useCallback((values: string[]) => {\n setSelectedValues(values);\n onValueChange?.(values);\n }, [onValueChange]);\n\n const onItemClick = React.useCallback((newValue: MultiSelectValue) => {\n let newSelectedValues: string[];\n if (selectedValues.some(v => String(v) === String(newValue))) {\n newSelectedValues = selectedValues.filter(v => String(v) !== String(newValue));\n } else {\n newSelectedValues = [...selectedValues, String(newValue)];\n }\n updateValues(newSelectedValues);\n }, [selectedValues, updateValues]);\n\n const handleInputKeyDown = (\n event: React.KeyboardEvent<HTMLInputElement>\n ) => {\n if (event.key === \"Enter\") {\n onPopoverOpenChange(true);\n } else if (event.key === \"Backspace\" && !event.currentTarget.value) {\n const newSelectedValues = [...selectedValues];\n newSelectedValues.pop();\n updateValues(newSelectedValues);\n }\n };\n\n const toggleOption = (value: string) => {\n const newSelectedValues = selectedValues.some(v => String(v) === String(value))\n ? selectedValues.filter(v => String(v) !== String(value))\n : [...selectedValues, value];\n updateValues(newSelectedValues);\n };\n\n const handleClear = () => {\n updateValues([]);\n };\n\n const handleTogglePopover = () => {\n onPopoverOpenChange(!isPopoverOpen);\n };\n\n const toggleAll = () => {\n if (selectedValues.length === allValues.length) {\n handleClear();\n } else {\n updateValues(allValues);\n }\n onPopoverOpenChange(false);\n };\n\n // Scoped to this popover. Unscoped, it reached every other cmdk list on\n // the page — the relation and user selectors set their own height on\n // the list and got a second, competing scroll container inside it.\n useInjectStyles(\"MultiSelect\", `\n[data-multi-select-content] [cmdk-group] {\n max-height: 45vh;\n overflow-y: auto;\n} `)\n\n const contextValue = React.useMemo(() => ({\n fieldValue: selectedValues,\n onItemClick\n }), [selectedValues, onItemClick]);\n\n return (\n <MultiSelectContext.Provider value={contextValue}>\n\n {typeof label === \"string\" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}\n\n <PopoverPrimitive.Root\n open={isMounted && isPopoverOpen}\n onOpenChange={onPopoverOpenChange}\n modal={modalPopover}\n >\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={inputRef ?? ref}\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n onClick={handleTogglePopover}\n className={cls(\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n {\n // Kept tight so the min-height above governs:\n // py-2 plus a medium Chip overflowed it and made\n // smallest/small render at the same height.\n \"py-0\": size === \"smallest\",\n \"py-0.5\": size === \"small\",\n \"py-1\": size === \"medium\" || size === \"large\"\n },\n {\n \"px-2\": size === \"small\" || size === \"smallest\",\n \"px-4\": size === \"medium\" || size === \"large\"\n },\n \"select-none rounded-lg text-sm\",\n \"focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n \"relative flex items-center\",\n className,\n inputClassName\n )}\n >\n {selectedValues.length > 0 ? (\n <div className=\"flex justify-between items-center w-full\">\n <div className=\"flex flex-wrap items-center gap-1.5 text-start\">\n {renderValues && renderValues(selectedValues)}\n {!renderValues && selectedValues.map((value) => {\n\n const optionChildren = optionsMap.get(String(value));\n if (!useChips) {\n return optionChildren;\n }\n return (\n <Chip\n size={size === \"smallest\" || size === \"small\" ? \"smallest\" : \"small\"}\n key={String(value)}\n className={cls(\"flex flex-row items-center p-1\")}\n >\n {optionChildren}\n <XIcon\n size={iconSize.smallest}\n onClick={(event) => {\n event.stopPropagation();\n toggleOption(value);\n }}\n />\n </Chip>\n );\n })}\n </div>\n <div className=\"flex items-center justify-between\">\n {includeClear && <XIcon\n className={\"ml-4\"}\n size={iconSize.small}\n onClick={(event) => {\n event.stopPropagation();\n handleClear();\n }}\n />}\n <div className={cls(\"px-2 h-full flex items-center\")}>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", isPopoverOpen ? \"rotate-180\" : \"\")}/>\n </div>\n </div>\n </div>\n ) : (\n <div className=\"flex items-center justify-between w-full mx-auto\">\n <span className=\"text-sm\">\n {placeholder}\n </span>\n <div className={cls(\"px-2 h-full flex items-center\")}>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", isPopoverOpen ? \"rotate-180\" : \"\")}/>\n </div>\n </div>\n )}\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal container={finalContainer}>\n <PopoverPrimitive.Content\n data-multi-select-content\n className={cls(\"z-50 overflow-hidden border bg-surface-card rounded-lg w-[400px]\", defaultBorderMixin)}\n align=\"start\"\n sideOffset={8}\n onEscapeKeyDown={() => onPopoverOpenChange(false)}\n >\n <CommandPrimitive>\n <div className={\"flex flex-row items-center\"}>\n <CommandPrimitive.Input\n className={cls(focusedDisabled, \"bg-transparent outline-none flex-1 h-full w-full m-4 flex-grow text-surface-accent-900 dark:text-white\")}\n placeholder=\"Search...\"\n onKeyDown={handleInputKeyDown}\n />\n {selectedValues.length > 0 && (\n <div\n onClick={handleClear}\n className=\"text-sm justify-center cursor-pointer py-3 px-4 text-text-secondary dark:text-text-secondary-dark\">\n Clear\n </div>\n )}\n </div>\n <Separator orientation={\"horizontal\"} className={\"my-0\"}/>\n <CommandPrimitive.List>\n <CommandPrimitive.Empty className={\"px-4 py-2 text-sm text-text-secondary dark:text-text-secondary-dark\"}>\n No results found.\n </CommandPrimitive.Empty>\n <CommandPrimitive.Group>\n {includeSelectAll && <CommandPrimitive.Item\n key=\"all\"\n onSelect={toggleAll}\n className={\n cls(\n \"flex flex-row items-center gap-1.5\",\n \"cursor-pointer\",\n \"m-1\",\n \"ring-offset-transparent\",\n \"p-1 rounded-md aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-primary/75 aria-[selected=true]:ring-offset-2\",\n \"aria-[selected=true]:bg-surface-active\",\n \"cursor-pointer p-2 rounded-md aria-[selected=true]:bg-surface-active\"\n )\n }\n >\n <InnerCheckBox checked={selectedValues.length === allValues.length}/>\n <span className={\"text-sm text-text-secondary dark:text-text-secondary-dark\"}>(Select All)</span>\n </CommandPrimitive.Item>}\n {children}\n </CommandPrimitive.Group>\n </CommandPrimitive.List>\n </CommandPrimitive>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </MultiSelectContext.Provider>\n );\n }\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n\nexport interface MultiSelectItemProps<T extends MultiSelectValue = string> {\n value: T;\n children?: React.ReactNode,\n className?: string;\n}\n\nexport const MultiSelectItem = React.memo(function MultiSelectItem<T extends MultiSelectValue = string>({\n children,\n value,\n className\n}: MultiSelectItemProps<T>) {\n const context = React.useContext(MultiSelectContext);\n if (!context) throw new Error(\"MultiSelectItem must be used inside a MultiSelect\");\n const {\n fieldValue,\n onItemClick\n } = context;\n\n const isSelected = (fieldValue ?? []).some(v => String(v) === String(value));\n\n return <CommandPrimitive.Item\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n onSelect={(_) => {\n onItemClick(value);\n }}\n className={cls(\n \"flex flex-row items-center gap-1.5\",\n isSelected ? \"bg-surface-active\" : \"\",\n \"cursor-pointer\",\n \"m-1\",\n \"ring-offset-transparent\",\n \"p-1 rounded-md aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-primary/75 aria-[selected=true]:ring-offset-2\",\n \"aria-[selected=true]:bg-surface-active\",\n \"cursor-pointer p-2 rounded-md aria-[selected=true]:bg-surface-active\",\n \"text-surface-accent-700 dark:text-surface-accent-300\",\n className\n )}\n >\n <InnerCheckBox checked={isSelected}/>\n {children}\n </CommandPrimitive.Item>;\n});\n\nconst InnerCheckBox = React.memo(function InnerCheckBox({ checked }: { checked: boolean }) {\n return <div className={cls(\n \"p-2\",\n \"w-8 h-8\",\n \"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150\"\n )}>\n <div\n className={cls(\n \"border-2 relative transition-colors ease-in-out duration-150\",\n \"w-4 h-4 rounded-sm flex items-center justify-center\",\n (checked ? \"bg-primary\" : \"bg-surface-card\"),\n (checked) ? \"text-surface-accent-100 dark:text-surface-accent-900\" : \"\",\n (checked ? \"border-transparent\" : \"border-surface-accent-800 dark:border-surface-accent-200\")\n )}>\n {checked && <CheckIcon size={iconSize.smallest} className={\"absolute\"}/>}\n </div>\n </div>\n});\n","import React from \"react\";\n\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport function Paper({\n children,\n style,\n className\n }: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n\n}) {\n return (\n <div\n className={cls(paperMixin, className)}\n style={style}>\n {children}\n </div>\n )\n}\n","\"use client\";\nimport * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { cls } from \"../util\";\n\nexport interface RadioGroupProps {\n id?: string;\n children: React.ReactNode;\n name?: string\n required?: boolean;\n disabled?: boolean;\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: boolean;\n defaultValue?: string;\n value?: string;\n\n onValueChange?(value: string): void;\n\n className?: string;\n}\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({\n className,\n ...props\n }, ref) => {\n return (\n <RadioGroupPrimitive.Root\n className={cls(\"grid gap-2\", className)}\n {...props}\n ref={ref}\n />\n )\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport interface RadioGroupItemProps {\n id?: string;\n value: string;\n checked?: boolean;\n required?: boolean;\n className?: string;\n disabled?: boolean;\n}\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({\n className,\n ...props\n }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cls(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <div className=\"h-2.5 w-2.5 fill-current text-current bg-primary rounded-full\"/>\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type ResizablePanelsProps = {\n firstPanel: React.ReactNode;\n secondPanel: React.ReactNode;\n /** Whether the first panel is visible (e.g. Sidebar) */\n showFirstPanel?: boolean;\n /** Whether the second panel is visible (e.g. Results) */\n showSecondPanel?: boolean;\n /** 0-100 representing the width/height of the first panel */\n panelSizePercent: number;\n onPanelSizeChange: (sizePercent: number) => void;\n minPanelSizePx?: number;\n orientation?: \"horizontal\" | \"vertical\";\n animateLayout?: boolean;\n className?: string;\n stacked?: boolean;\n};\n\nexport function ResizablePanels({\n firstPanel,\n secondPanel,\n showFirstPanel = true,\n showSecondPanel = true,\n panelSizePercent,\n onPanelSizeChange,\n minPanelSizePx = 200,\n orientation = \"horizontal\",\n animateLayout = true,\n className,\n stacked = false\n}: ResizablePanelsProps) {\n\n const containerRef = useRef<HTMLDivElement>(null);\n const isResizingRef = useRef(false);\n\n // For local layout tracking without triggering React rerenders during drag\n const firstPanelRef = useRef<HTMLDivElement>(null);\n const startPosRef = useRef(0);\n const startSizeRef = useRef(0);\n\n const [isResizing, setIsResizing] = useState(false);\n const isHorizontal = orientation === \"horizontal\";\n\n const handleResizeStart = useCallback((e: React.MouseEvent) => {\n if (!showFirstPanel || !showSecondPanel) return;\n\n e.preventDefault();\n isResizingRef.current = true;\n setIsResizing(true);\n\n startPosRef.current = isHorizontal ? e.clientX : e.clientY;\n\n if (firstPanelRef.current) {\n const rect = firstPanelRef.current.getBoundingClientRect();\n startSizeRef.current = isHorizontal ? rect.width : rect.height;\n }\n\n document.body.style.cursor = isHorizontal ? \"col-resize\" : \"row-resize\";\n document.body.style.userSelect = \"none\";\n }, [isHorizontal, showFirstPanel, showSecondPanel]);\n\n useEffect(() => {\n const handleMouseMove = (e: MouseEvent) => {\n if (!isResizingRef.current || !containerRef.current) return;\n\n const currentPos = isHorizontal ? e.clientX : e.clientY;\n const delta = currentPos - startPosRef.current; // Dragging right/down increases first panel size\n\n let newSize = startSizeRef.current + delta;\n\n const containerRect = containerRef.current.getBoundingClientRect();\n const containerTotal = isHorizontal ? containerRect.width : containerRect.height;\n\n // Limit the maximum size to prevent pushing the second panel offscreen\n const maxSize = containerTotal - minPanelSizePx;\n\n newSize = Math.max(minPanelSizePx, Math.min(newSize, maxSize));\n\n // Directly update the DOM for performance while dragging\n if (firstPanelRef.current) {\n firstPanelRef.current.style.flexBasis = `${newSize}px`;\n }\n };\n\n const handleMouseUp = () => {\n if (isResizingRef.current && containerRef.current && firstPanelRef.current) {\n // Calculate the final percentage\n const containerRect = containerRef.current.getBoundingClientRect();\n const firstPanelRect = firstPanelRef.current.getBoundingClientRect();\n\n const containerSize = isHorizontal ? containerRect.width : containerRect.height;\n const finalSize = isHorizontal ? firstPanelRect.width : firstPanelRect.height;\n\n // Pre-set the DOM to the exact % value BEFORE re-enabling transitions.\n // This prevents the visual \"snap\" that occurs when switching from px → %\n // with the CSS transition active.\n if (containerSize > 0) {\n const newPercent = (finalSize / containerSize) * 100;\n firstPanelRef.current.style.flexBasis = `${newPercent}%`;\n onPanelSizeChange(Math.max(0, Math.min(100, newPercent)));\n }\n\n isResizingRef.current = false;\n setIsResizing(false);\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n }\n };\n\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [onPanelSizeChange, isHorizontal, minPanelSizePx]);\n\n // Calculate applied size\n const appliedBasis = !showFirstPanel ? \"0%\" : (showSecondPanel ? `${panelSizePercent}%` : \"100%\");\n\n return (\n <div\n ref={containerRef}\n className={cls(\n \"relative w-full h-full flex overflow-hidden\",\n !stacked && (isHorizontal ? \"flex-row\" : \"flex-col\"),\n className\n )}\n >\n {/* First Panel */}\n <div\n ref={firstPanelRef}\n className={cls(\n stacked ? \"absolute inset-0\" : \"relative flex-shrink-0\",\n \"flex flex-col overflow-hidden\",\n !stacked && !isResizing && animateLayout && \"transition-[flex-basis] duration-150 ease-out\",\n !showFirstPanel && \"hidden\"\n )}\n style={stacked ? undefined : {\n flexBasis: appliedBasis,\n minWidth: isHorizontal && showFirstPanel && showSecondPanel ? `${minPanelSizePx}px` : undefined,\n minHeight: !isHorizontal && showFirstPanel && showSecondPanel ? `${minPanelSizePx}px` : undefined,\n maxWidth: showSecondPanel ? undefined : \"100%\",\n maxHeight: showSecondPanel ? undefined : \"100%\"\n }}\n >\n {firstPanel}\n </div>\n\n {/* Divider */}\n {!stacked && showFirstPanel && showSecondPanel && (\n <div\n // The divider is a handle, not a rule: invisible until the\n // pointer is on it. The two panels it separates already\n // differ by a surface step, and a permanent 1px line between\n // them was one of six on the split record view where the\n // reference draws one.\n className={cls(\n \"relative z-10 flex flex-shrink-0 items-center justify-center border-transparent\",\n isHorizontal ? \"border-l w-px h-full cursor-col-resize\" : \"border-t h-px w-full cursor-row-resize\"\n )}\n onMouseDown={handleResizeStart}\n >\n {/* Transparent Hit Area with Pill inside */}\n <div className={cls(\n \"absolute flex items-center justify-center group\",\n isHorizontal ? \"w-4 h-full cursor-col-resize top-0\" : \"h-4 w-full cursor-row-resize left-0\"\n )}>\n <div className={cls(\n \"bg-primary/60 dark:bg-primary rounded-full opacity-0 group-hover:opacity-100 transition-all duration-200\",\n isHorizontal ? \"w-1 h-8\" : \"h-1 w-8\"\n )}/>\n </div>\n </div>\n )}\n\n {/* Second Panel */}\n <div\n className={cls(\n stacked ? \"absolute inset-0\" : \"flex-grow relative min-w-0 min-h-0\",\n \"flex flex-col overflow-hidden\",\n !showSecondPanel && \"hidden\"\n )}\n >\n {secondPanel}\n </div>\n </div>\n );\n}\n","\n\"use client\";\nimport { SearchIcon, XIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport React, { useCallback, useState } from \"react\";\n\nimport { defaultBorderMixin } from \"../styles\";\nimport { CircularProgress } from \"./CircularProgress\";\nimport { IconButton } from \"./IconButton\";\n\nimport { cls } from \"../util\";\nimport { useDebounceValue } from \"../hooks\";\n\ninterface SearchBarProps {\n onClick?: () => void;\n onTextSearch?: (searchString?: string) => void;\n placeholder?: string;\n expandable?: boolean;\n /**\n * Size of the search bar.\n * - \"small\": 32px height (matches TextField small)\n * - \"medium\": 44px height (matches TextField medium)\n * @default \"medium\"\n */\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n innerClassName?: string;\n className?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n loading?: boolean;\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Optional initial value for the search input, e.g. from URL params.\n */\n initialValue?: string;\n}\n\nexport function SearchBar({\n onClick,\n onTextSearch,\n placeholder = \"Search\",\n expandable = false,\n size = \"medium\",\n innerClassName,\n className,\n autoFocus,\n disabled,\n loading,\n inputRef,\n initialValue\n}: SearchBarProps) {\n\n const [searchText, setSearchText] = useState<string>(initialValue ?? \"\");\n const [active, setActive] = useState<boolean>(false);\n\n const deferredValues = useDebounceValue(searchText, 200);\n\n /**\n * Debounce on SearchIcon text update\n */\n React.useEffect(() => {\n if (!onTextSearch) return;\n if (deferredValues) {\n onTextSearch(deferredValues);\n } else {\n onTextSearch(undefined);\n }\n }, [deferredValues]);\n\n const clearText = useCallback(() => {\n if (!onTextSearch) return;\n setSearchText(\"\");\n onTextSearch(undefined);\n }, [onTextSearch]);\n\n // Height classes matching TextField sizes\n // Heights come from the shared control scale (styles.ts) so a SearchBar\n // lines up with the Button and Select beside it in a toolbar.\n const heightClass = { smallest: \"h-[28px]\", small: \"h-[32px]\", medium: \"h-[40px]\", large: \"h-[48px]\" }[size];\n const iconPaddingClass = size === \"smallest\" || size === \"small\" ? \"px-2\" : size === \"medium\" ? \"px-3\" : \"px-4\";\n const inputPaddingClass = size === \"smallest\" || size === \"small\" ? \"pl-8\" : size === \"medium\" ? \"pl-10\" : \"pl-12\";\n\n return (\n <div\n role=\"search\"\n aria-label=\"Search\"\n onClick={onClick}\n className={cls(\"relative transition-all\",\n heightClass,\n \"bg-surface-field border\",\n defaultBorderMixin,\n \"focus-within:ring-1 focus-within:ring-primary/60 focus-within:border-primary focus-within:shadow-[0_0_0_3px_rgba(0,112,244,0.1)]\",\n \"rounded-full overflow-hidden\",\n className)}>\n <div\n className={cls(\"absolute p-0 h-full pointer-events-none flex items-center justify-center top-0\", iconPaddingClass)}>\n {loading ? <CircularProgress size={\"smallest\"}/> : <SearchIcon className={\"text-text-disabled dark:text-text-disabled-dark\"} size={size === \"smallest\" ? 14 : size === \"small\" ? 18 : 20}/>}\n </div>\n <input\n value={searchText ?? \"\"}\n ref={inputRef}\n onClick={onClick}\n placeholder={placeholder}\n aria-label={placeholder}\n readOnly={!onTextSearch}\n onChange={onTextSearch\n ? (event) => {\n setSearchText(event.target.value);\n }\n : undefined}\n autoFocus={autoFocus}\n onFocus={() => setActive(true)}\n onBlur={() => setActive(false)}\n className={cls(\n (disabled || loading) && \"pointer-events-none\",\n \"placeholder-text-disabled dark:placeholder-text-disabled-dark\",\n \"relative flex items-center transition-all bg-transparent outline-none focus:outline-none focus:ring-0 appearance-none border-none focus:border-transparent\",\n inputPaddingClass, \"h-full w-full text-current\",\n size === \"small\" ? \"text-sm\" : \"\",\n expandable ? (active ? \"w-[220px]\" : \"w-[180px]\") : \"\",\n innerClassName\n )}\n />\n {searchText\n ? <IconButton\n className={`${size === \"small\" ? \"mr-0 top-0\" : \"mr-1 top-0\"} absolute right-0 z-10`}\n size={\"small\"}\n aria-label=\"Clear search\"\n onClick={clearText}>\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n : <div style={{ width: 26 }}/>\n }\n </div>\n );\n}\n","\n\"use client\";\nimport { CheckIcon, ChevronDownIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport React, { ChangeEvent, Children, forwardRef, useCallback, useEffect, useMemo, useState } from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport {\n defaultBorderMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedDisabled\n} from \"../styles\";\n\nimport { cls } from \"../util\";\nimport { SelectInputLabel } from \"./common/SelectInputLabel\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type SelectValue = string | number | boolean;\n\nexport type SelectProps<T extends SelectValue = string> = {\n open?: boolean,\n name?: string,\n fullWidth?: boolean,\n id?: string,\n onOpenChange?: (open: boolean) => void,\n value?: T,\n className?: string,\n inputClassName?: string,\n viewportClassName?: string,\n onChange?: React.EventHandler<ChangeEvent<HTMLSelectElement>>,\n onValueChange?: (updatedValue: T) => void,\n placeholder?: React.ReactNode,\n renderValue?: (value: T) => React.ReactNode,\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n label?: React.ReactNode | string,\n disabled?: boolean,\n error?: boolean,\n position?: \"item-aligned\" | \"popper\",\n endAdornment?: React.ReactNode,\n inputRef?: React.Ref<HTMLButtonElement>,\n padding?: boolean,\n invisible?: boolean,\n children?: React.ReactNode;\n dataType?: \"string\" | \"number\" | \"boolean\";\n portalContainer?: HTMLElement | null; // Explicitly added to props type if missing\n /**\n * Accessible name for the trigger, for a select whose `label` is a node\n * rather than a string — or which shows no label at all.\n *\n * Without it such a select announces the literal fallback \"Select an\n * option\", which is indistinguishable from every other unlabelled select\n * on the screen.\n */\n \"aria-label\"?: string;\n};\n\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(({\n inputRef,\n open,\n name,\n fullWidth = false,\n id,\n onOpenChange,\n value,\n onChange,\n onValueChange,\n className,\n inputClassName,\n viewportClassName,\n placeholder,\n renderValue,\n label,\n size = \"large\",\n error,\n disabled,\n padding = true,\n position = \"item-aligned\",\n endAdornment,\n invisible,\n children,\n dataType = \"string\",\n portalContainer: manualContainer, // Rename to avoid confusion\n \"aria-label\": ariaLabel,\n ...props\n}, ref) => {\n\n const [openInternal, setOpenInternal] = useState(open ?? false);\n\n useEffect(() => {\n setOpenInternal(open ?? false);\n }, [open]);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Resolve final container (Manual Prop > Context Container > Undefined/Body)\n const finalContainer = (manualContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n const onValueChangeInternal = useCallback((newValue: string) => {\n let typedValue: SelectValue = newValue;\n if (dataType === \"boolean\") {\n if (newValue === \"true\") typedValue = true;\n else if (newValue === \"false\") typedValue = false;\n } else if (dataType === \"number\") {\n if (!isNaN(Number(newValue)) && newValue.trim() !== \"\") typedValue = Number(newValue);\n }\n\n onValueChange?.(typedValue as SelectValue & typeof value);\n if (onChange) {\n const event = {\n target: {\n name,\n value: typedValue\n }\n } as ChangeEvent<HTMLSelectElement>;\n onChange(event);\n }\n }, [onChange, onValueChange, name, dataType]);\n\n const hasValue = Array.isArray(value) ? value.length > 0 : (value != null && value !== \"\" && value !== undefined);\n const stringValue = value !== undefined ? String(value) : undefined;\n\n const displayChildren = useMemo(() => {\n if (!hasValue || renderValue) return null;\n\n // Find the child that matches the current value to display its content\n let found: React.ReactNode = null;\n Children.forEach(children, (child) => {\n if (React.isValidElement<SelectItemProps>(child) && String(child.props.value) === String(value)) {\n found = child.props.children;\n }\n });\n return found;\n }, [children, hasValue, renderValue, value]);\n\n return (\n <SelectPrimitive.Root\n name={name}\n value={stringValue}\n open={openInternal}\n disabled={disabled}\n onValueChange={onValueChangeInternal}\n onOpenChange={(open) => {\n onOpenChange?.(open);\n setOpenInternal(open);\n }}\n {...props}>\n {typeof label === \"string\" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}\n <div className={cls(\n \"select-none rounded-lg text-sm\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n \"relative flex items-center\",\n className,\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\",\n \"w-fit\": !fullWidth,\n \"w-full\": fullWidth\n }\n )}>\n <SelectPrimitive.Trigger\n ref={inputRef}\n id={id}\n asChild={false}\n type=\"button\"\n // A `label` that is an element — which every entity form\n // passes, because the label carries the property's type\n // icon — fell through to a hard-coded English literal, so\n // every enum field in every form announced itself as\n // \"Select an option\". Callers pass `aria-label` now; the\n // literal stays as the last resort, and is unreachable for\n // anything that names itself.\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : (typeof renderValue === \"string\" ? renderValue : \"Select an option\"))}\n aria-invalid={error || undefined}\n className={cls(\n \"h-full\",\n padding ? {\n \"px-4\": size === \"large\",\n \"px-3\": size === \"medium\",\n \"px-2\": size === \"small\" || size === \"smallest\"\n } : \"\",\n \"outline-hidden focus:outline-hidden\",\n \"outline-none focus:outline-none\",\n \"select-none rounded-lg text-sm\",\n error ? \"text-red-500 dark:text-red-600\" : \"focus:text-text-primary dark:focus:text-text-primary-dark\",\n error ? \"border border-red-500 dark:border-red-600\" : \"\",\n disabled ? \"text-surface-accent-600 dark:text-surface-accent-400\" : \"text-surface-accent-800 dark:text-white\",\n \"relative flex flex-row items-center\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\",\n \"w-full\": fullWidth,\n \"w-fit\": !fullWidth\n },\n inputClassName\n )}\n >\n <div\n ref={ref}\n className={cls(\n \"flex-grow max-w-full flex flex-row gap-2 items-center\",\n \"overflow-visible\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n }\n )}>\n <SelectPrimitive.Value\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n placeholder={placeholder}\n className={\"w-full\"}>\n\n {hasValue && value !== undefined && renderValue\n ? renderValue(value)\n : (displayChildren || placeholder)\n }\n\n </SelectPrimitive.Value>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", open ? \"rotate-180\" : \"\", {\n \"px-2\": size === \"large\",\n \"px-1\": size === \"medium\" || size === \"small\"\n })}/>\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {endAdornment && (\n <div\n className={cls(\"h-full flex items-center absolute right-0 pr-12\")}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}>\n {endAdornment}\n </div>\n )}\n </div>\n\n {/* Pass the calculated finalContainer */}\n <SelectPrimitive.Portal container={finalContainer}>\n <SelectPrimitive.Content position={position}\n className={cls(focusedDisabled, \"z-50 relative overflow-hidden border bg-surface-card p-2 rounded-lg shadow-lg animate-in fade-in-0 zoom-in-95 duration-150\", defaultBorderMixin)}>\n <SelectPrimitive.Viewport className={cls(\"p-1\", viewportClassName)}\n style={{ maxHeight: \"var(--radix-select-content-available-height)\" }}>\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n );\n});\n\nSelect.displayName = \"Select\";\n\n// ... (SelectItem and SelectGroup remain unchanged)\nexport type SelectItemProps<T extends SelectValue = string> = {\n value: T,\n children?: React.ReactNode,\n disabled?: boolean,\n className?: string,\n};\n\nexport const SelectItem = React.memo(function SelectItem<T extends SelectValue = string>({\n value,\n children,\n disabled,\n className\n}: SelectItemProps<T>) {\n // Convert value to string for Radix UI\n const stringValue = String(value);\n\n return <SelectPrimitive.Item\n key={stringValue}\n value={stringValue}\n disabled={disabled}\n className={cls(\n \"w-full\",\n \"relative flex items-center p-2 rounded-md text-sm text-surface-accent-700 dark:text-surface-accent-300\",\n \"focus:z-10\",\n \"data-[state=checked]:bg-surface-active focus:bg-surface-hover\",\n \"data-[state=checked]:focus:bg-surface-active\",\n disabled ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\",\n \"[&>*]:w-full\",\n \"overflow-visible\",\n className\n )}>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <div\n className=\"absolute left-1 data-[state=checked]:block hidden\">\n <CheckIcon size={iconSize.smallest}/>\n </div>\n </SelectPrimitive.Item>;\n});\n\nexport type SelectGroupProps = {\n label: React.ReactNode,\n children: React.ReactNode,\n className?: string\n};\n\nexport const SelectGroup = React.memo(function SelectGroup({\n label,\n children,\n className\n}: SelectGroupProps) {\n return <>\n <SelectPrimitive.Group\n className={cls(\n \"text-xs text-surface-accent-900 dark:text-white uppercase tracking-wider font-semibold mt-6 first:mt-2\",\n \"px-2 py-2\",\n className\n )}>\n {label}\n </SelectPrimitive.Group>\n\n {children}\n </>;\n});\n","\"use client\";\nimport * as React from \"react\";\nimport { cls } from \"../util\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nexport interface SliderProps {\n className?: string;\n name?: string;\n disabled?: boolean;\n orientation?: React.AriaAttributes[\"aria-orientation\"];\n dir?: \"ltr\" | \"rtl\";\n min?: number;\n max?: number;\n step?: number;\n minStepsBetweenThumbs?: number;\n value?: number[];\n defaultValue?: number[];\n onValueChange?: (value: number[]) => void;\n onValueCommit?: (value: number[]) => void;\n inverted?: boolean;\n form?: string;\n size?: \"small\" | \"regular\";\n}\n\nfunction SliderThumb(props: {\n props: Omit<React.PropsWithoutRef<SliderProps>, \"size\" | \"className\">,\n index: number,\n hovered: boolean,\n classes: string\n}) {\n return <TooltipPrimitive.Root open={props.hovered}>\n <TooltipPrimitive.Trigger asChild>\n <SliderPrimitive.Thumb\n className={cls({\n \"border-primary bg-primary outline-none\": !props.props.disabled,\n \"border-surface-raised-hover bg-surface-raised-hover\": props.props.disabled\n },\n props.classes,\n \"focus-visible:ring-4 focus-visible:ring-primary focus-visible:ring-opacity-50 focus-visible:ring-primary/50\",\n \"hover:ring-4 hover:ring-primary hover:ring-opacity-25 hover:ring-primary/25\",\n \"block rounded-full transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50\")}\n\n />\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content side=\"top\"\n sideOffset={5}\n className={cls(\n \"TooltipContent\",\n \"max-w-lg leading-relaxed\",\n \"z-50 rounded-md px-3 py-2 text-xs leading-none bg-surface-800/95 dark:bg-surface-raised-hover font-medium text-white shadow-2xl select-none duration-400 ease-in transform opacity-100\"\n )}>\n {props.props.value?.[props.index]}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>;\n}\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({\n className,\n size = \"regular\",\n ...props\n }, ref) => {\n const [hovered, setHovered] = React.useState(false);\n\n const thumbSizeClasses =\n size === \"small\"\n ? \"h-4 w-4\" // Smaller size for the thumb\n : \"h-6 w-6\"; // Default size\n\n return (\n <TooltipPrimitive.Provider delayDuration={200}>\n <SliderPrimitive.Root\n ref={ref}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n className={cls(\n \"relative flex w-full touch-none select-none items-center\",\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track\n style={{ height: size === \"small\" ? 4 : 8 }}\n className={\"relative w-full grow overflow-hidden rounded-full bg-surface-active\"}>\n\n <SliderPrimitive.Range\n className={cls(\"absolute h-full\", {\n \"bg-primary\": !props.disabled,\n \"bg-surface-raised-hover\": props.disabled\n })}\n />\n </SliderPrimitive.Track>\n\n {(props.value ?? [0]).map((_, index) => <SliderThumb\n key={index}\n index={index}\n props={props}\n hovered={hovered}\n classes={thumbSizeClasses}/>)}\n </SliderPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n});\n\nSlider.displayName = \"Slider\";\n\nexport { Slider };\n","\"use client\";\nimport React, { useEffect, useState } from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { usePortalContainer, PortalContainerProvider } from \"../hooks/PortalContainerContext\";\n\ninterface SheetProps {\n children: React.ReactNode;\n open: boolean;\n title?: string;\n modal?: boolean;\n includeBackgroundOverlay?: boolean;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n darkBackground?: boolean;\n transparent?: boolean;\n onOpenChange?: (open: boolean) => void;\n onPointerDownOutside?: (e: Event) => void;\n onInteractOutside?: (e: Event) => void;\n className?: string;\n style?: React.CSSProperties;\n overlayClassName?: string;\n overlayZIndex?: string;\n overlayStyle?: React.CSSProperties;\n portalContainer?: HTMLElement | null;\n}\n\nexport const Sheet: React.FC<SheetProps> = ({\n children,\n side = \"right\",\n title,\n modal = true,\n includeBackgroundOverlay = true,\n open,\n onOpenChange,\n onPointerDownOutside,\n onInteractOutside,\n transparent,\n className,\n style,\n overlayClassName,\n overlayZIndex = \"z-50\",\n overlayStyle,\n portalContainer,\n ...props\n}) => {\n const [displayed, setDisplayed] = useState(false);\n const [contentEl, setContentEl] = useState<HTMLDivElement | null>(null);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n setDisplayed(open);\n });\n return () => cancelAnimationFrame(raf);\n }, [open]);\n\n const transformValue: Record<string, string> = {\n top: \"-translate-y-full\",\n bottom: \"translate-y-full\",\n left: \"-translate-x-full\",\n right: \"translate-x-full\"\n };\n\n const borderClass: Record<string, string> = {\n top: \"border-b\",\n bottom: \"border-t\",\n left: \"border-r\",\n right: \"border-l\"\n };\n\n return (\n <DialogPrimitive.Root open={displayed || open}\n modal={modal}\n onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal container={finalContainer}>\n {includeBackgroundOverlay && <DialogPrimitive.Overlay\n className={cls(\n \"outline-none\",\n \"fixed inset-0 bg-surface-scrim\",\n \"backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in\",\n overlayZIndex,\n overlayClassName\n )}\n style={overlayStyle}\n />}\n <DialogPrimitive.Content\n {...props}\n ref={setContentEl}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n className={cls(\n \"outline-none\",\n borderClass[side],\n defaultBorderMixin,\n // No `will-change: transform` / `transform-gpu` here, however\n // tempting the layer hint is on a panel this size. Either one\n // makes this element a *containing block* for its\n // `position: fixed` descendants, and everything portaled into\n // the panel below — a Select dropdown, above all — is fixed and\n // positioned in viewport coordinates. Inside a containing block\n // those coordinates are resolved against the panel instead, so\n // every popup was displaced by the panel's own offset and a\n // right-hand Select opened its list off the edge of the screen:\n // the dropdown was open, just nowhere anyone could see it.\n \"text-surface-accent-900 dark:text-white\",\n \"fixed transform z-50 transition-[transform,opacity] ease-in-out\",\n !displayed ? \"duration-150\" : \"duration-100\",\n \"outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus:ring-0\",\n transparent ? \"\" : \"shadow-md bg-surface-card\",\n side === \"top\" || side === \"bottom\" ? \"w-full\" : \"h-full\",\n side === \"left\" || side === \"top\" ? \"left-0 top-0\" : \"right-0 bottom-0\",\n displayed && open ? \"opacity-100\" : \"opacity-50\",\n !displayed || !open ? transformValue[side] : \"\",\n className\n )}\n style={style}\n >\n <DialogPrimitive.Title className=\"sr-only outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus:ring-0\">\n {title ?? \"Sheet\"}\n </DialogPrimitive.Title>\n <PortalContainerProvider container={contentEl}>\n {children}\n </PortalContainerProvider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n","\"use client\";\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { cls, debounce } from \"../util\";\n\ntype State = {\n outerHeightStyle: number;\n overflow?: boolean | undefined;\n};\n\nfunction getStyleValue(value: string) {\n return parseInt(value, 10) || 0;\n}\n\nconst styles: {\n shadow: React.CSSProperties;\n} = {\n shadow: {\n // Visibility needed to hide the extra text area on iPads\n visibility: \"hidden\",\n // Remove from the content flow\n position: \"absolute\",\n // Ignore the scrollbar width\n overflow: \"hidden\",\n height: 0,\n top: 0,\n left: 0,\n // Create a new layer, increase the isolation of the computed values\n transform: \"translateZ(0)\"\n }\n};\n\nfunction isEmpty(obj: State) {\n return (\n obj === undefined ||\n obj === null ||\n Object.keys(obj).length === 0 ||\n (obj.outerHeightStyle === 0 && !obj.overflow)\n );\n}\n\nexport const TextareaAutosize = React.forwardRef(function TextareaAutosize(\n props: TextareaAutosizeProps,\n ref: React.ForwardedRef<Element>\n) {\n const {\n onChange,\n onScroll,\n onResize,\n maxRows,\n minRows = 1,\n style,\n value,\n onFocus,\n onBlur,\n sizeRef,\n ignoreBoxSizing,\n ...other\n } = props;\n\n const { current: isControlled } = React.useRef(value != null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, inputRef);\n const shadowRef = React.useRef<HTMLTextAreaElement>(null);\n const renders = React.useRef(0);\n const [state, setState] = React.useState<State>({\n outerHeightStyle: 0\n });\n\n const getUpdatedState = React.useCallback(() => {\n\n const input = inputRef.current!;\n if (typeof window === \"undefined\") {\n return {\n outerHeightStyle: 0\n };\n }\n\n const containerWindow = window;\n const computedStyle = containerWindow.getComputedStyle(input);\n\n // If input's width is shrunk and it's not visible, don't sync height.\n if (computedStyle.width === \"0px\") {\n return {\n outerHeightStyle: 0\n };\n }\n\n const sizeReferenceElement = sizeRef?.current ?? shadowRef.current!;\n const inputShallow = shadowRef.current!;\n\n sizeReferenceElement.style.width = computedStyle.width;\n inputShallow.value = input.value || props.placeholder || \"x\";\n if (inputShallow.value.slice(-1) === \"\\n\") {\n // Certain fonts which overflow the line height will cause the textarea\n // to report a different scrollHeight depending on whether the last line\n // is empty. Make it non-empty to avoid this issue.\n inputShallow.value += \" \";\n }\n\n const boxSizing = computedStyle.boxSizing;\n const padding =\n getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);\n const border =\n getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);\n const minHeight = getStyleValue(computedStyle.minHeight);\n\n // The height of the inner content\n const innerHeight = sizeReferenceElement.scrollHeight;\n\n // Measure height of a textarea with a single row\n inputShallow.value = \"x\";\n const singleRowHeight = sizeReferenceElement.scrollHeight;\n\n // The height of the outer content\n let outerHeight = innerHeight;\n\n if (minRows) {\n outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);\n }\n if (maxRows) {\n outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);\n }\n outerHeight = Math.max(outerHeight, singleRowHeight, minHeight);\n\n // Take the box sizing into account for applying this value as a style.\n const outerHeightStyle = outerHeight + (!ignoreBoxSizing && boxSizing === \"border-box\" ? padding + border : 0);\n\n const overflow = Math.abs(outerHeight - innerHeight) <= 1;\n\n return {\n outerHeightStyle,\n overflow\n };\n }, [maxRows, minRows, props.placeholder]);\n\n const updateState = React.useCallback((prevState: State, newState: State) => {\n const {\n outerHeightStyle,\n overflow\n } = newState;\n // Need a large enough difference to update the height.\n // This prevents infinite rendering loop.\n if (\n renders.current < 20 &&\n ((outerHeightStyle > 0 &&\n Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1) ||\n prevState.overflow !== overflow)\n ) {\n renders.current += 1;\n return {\n overflow,\n outerHeightStyle\n };\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (renders.current === 20) {\n console.error(\n [\n \"MUI: Too many re-renders. The layout is unstable.\",\n \"TextareaAutosize limits the number of renders to prevent an infinite loop.\"\n ].join(\"\\n\")\n );\n }\n }\n return prevState;\n }, []);\n\n const syncHeight = React.useCallback(() => {\n const newState = getUpdatedState();\n\n if (isEmpty(newState)) {\n return;\n }\n if (onResize) {\n onResize(newState);\n }\n\n setState((prevState) => {\n return updateState(prevState, newState);\n });\n }, [getUpdatedState, onResize, updateState]);\n\n const syncHeightWithFlushSync = React.useCallback(() => {\n const newState = getUpdatedState();\n\n if (isEmpty(newState)) {\n return;\n }\n\n // In React 18, state updates in a ResizeObserver's callback are happening after the paint which causes flickering\n // when doing some visual updates in it. Using flushSync ensures that the dom will be painted after the states updates happen\n // Related issue - https://github.com/facebook/react/issues/24331\n ReactDOM.flushSync(() => {\n setState((prevState) => {\n return updateState(prevState, newState);\n });\n });\n }, [getUpdatedState, updateState]);\n\n React.useEffect(() => {\n const handleResize = debounce(() => {\n renders.current = 0;\n\n // If the TextareaAutosize component is replaced by Suspense with a fallback, the last\n // ResizeObserver's handler that runs because of the change in the layout is trying to\n // access a dom node that is no longer there (as the fallback component is being shown instead).\n if (inputRef.current) {\n syncHeightWithFlushSync();\n }\n });\n let resizeObserver: ResizeObserver;\n\n const input = inputRef.current!;\n const containerWindow = window;\n if (typeof window === \"undefined\") {\n return;\n }\n\n containerWindow.addEventListener(\"resize\", handleResize);\n\n if (typeof ResizeObserver !== \"undefined\") {\n resizeObserver = new ResizeObserver(handleResize);\n resizeObserver.observe(input);\n }\n\n return () => {\n handleResize.clear();\n containerWindow.removeEventListener(\"resize\", handleResize);\n if (resizeObserver) {\n resizeObserver.disconnect();\n }\n };\n }, [syncHeightWithFlushSync]);\n\n useLayoutEffect(() => {\n syncHeight();\n });\n\n React.useEffect(() => {\n renders.current = 0;\n }, [value]);\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n renders.current = 0;\n\n if (!isControlled) {\n syncHeight();\n }\n\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <React.Fragment>\n <textarea\n value={value}\n onChange={handleChange}\n className={props.className}\n ref={handleRef as React.Ref<HTMLTextAreaElement>}\n onFocus={onFocus}\n onBlur={onBlur}\n // Apply the rows prop to get a \"correct\" first SSR paint\n rows={minRows as number}\n style={{\n height: state.outerHeightStyle,\n // Need a large enough difference to allow scrolling.\n // This prevents infinite rendering loop.\n overflow: state.overflow ? \"hidden\" : undefined,\n ...style\n }}\n onScroll={onScroll}\n {...other}\n />\n <textarea\n aria-hidden\n className={cls(props.className, props.shadowClassName)}\n readOnly\n ref={shadowRef}\n tabIndex={-1}\n style={{\n padding: 0,\n ...styles.shadow,\n ...style\n }}\n />\n </React.Fragment>\n );\n}) as React.FC<TextareaAutosizeProps & { ref?: React.ForwardedRef<Element> }>;\n\nexport type TextareaAutosizeProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, \"onResize\"> & {\n\n className?: string;\n\n shadowClassName?: string;\n\n /**\n * Maximum number of rows to display.\n */\n maxRows?: number | string;\n /**\n * Minimum number of rows to display.\n * @default 1\n */\n minRows?: number | string;\n /**\n * @ignore\n */\n onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * @ignore\n */\n placeholder?: string;\n /**\n * @ignore\n */\n style?: object;\n /**\n * @ignore\n */\n value?: string[] | number | string;\n\n sizeRef?: React.RefObject<HTMLDivElement>;\n\n onScroll?: (event: React.UIEvent<HTMLTextAreaElement>) => void;\n\n onResize?: (state: State) => void;\n\n autoFocus?: boolean;\n\n ignoreBoxSizing?: boolean;\n}\n\nfunction useForkRef<Instance>(\n ...refs: Array<React.Ref<Instance> | undefined>\n): React.RefCallback<Instance> | null {\n /**\n * This will create a new function if the refs passed to this hook change and are all defined.\n * This means react will call the old forkRef with `null` and the new forkRef\n * with the ref. Cleanup naturally emerges from this behavior.\n */\n return React.useMemo(() => {\n if (refs.every((ref) => ref == null)) {\n return null;\n }\n\n return (instance) => {\n refs.forEach((ref) => {\n setRef(ref, instance);\n });\n };\n\n }, refs);\n}\n\nfunction setRef<T>(\n ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined,\n value: T | null\n): void {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\n","\"use client\";\nimport React, { ForwardedRef, forwardRef, useEffect, useId, useRef } from \"react\";\n\nimport {\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedInvisibleMixin\n} from \"../styles\";\nimport { InputLabel } from \"./InputLabel\";\nimport { cls } from \"../util\";\n\nexport type InputType =\n | \"text\"\n | \"number\"\n | \"phone\"\n | \"email\"\n | \"password\"\n | \"search\"\n | \"url\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"month\"\n | \"week\"\n | \"color\";\n\nexport type TextFieldProps<T extends string | number> = {\n type?: InputType;\n value?: T;\n onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n label?: React.ReactNode;\n multiline?: boolean;\n disabled?: boolean;\n invisible?: boolean;\n error?: boolean;\n endAdornment?: React.ReactNode;\n autoFocus?: boolean;\n placeholder?: string;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n className?: string;\n style?: React.CSSProperties;\n inputClassName?: string;\n inputStyle?: React.CSSProperties;\n inputRef?: React.ForwardedRef<any>;\n /**\n * Maximum number of rows to display.\n */\n maxRows?: number | string;\n /**\n * Minimum number of rows to display.\n * @default 1\n */\n minRows?: number | string;\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"value\">;\n\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps<string | number>>(\n <T extends string | number>(\n {\n value,\n onChange,\n label,\n type = \"text\",\n multiline = false,\n invisible,\n maxRows,\n minRows,\n disabled,\n error,\n endAdornment,\n autoFocus,\n placeholder,\n size = \"large\",\n className,\n style,\n inputClassName,\n inputStyle,\n inputRef: inputRefProp,\n ...inputProps\n }: TextFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n\n const fallbackRef = useRef(null);\n const inputRef = inputRefProp ?? fallbackRef;\n const autoId = useId();\n const inputId = inputProps.id ?? autoId;\n const labelId = `${inputId}-label`;\n\n const [focused, setFocused] = React.useState(false);\n const hasValue = value !== undefined && value !== null && value !== \"\";\n\n useEffect(() => {\n const element = inputRef && \"current\" in inputRef ? inputRef.current : null;\n if (element && document.activeElement === element) {\n setFocused(true);\n }\n }, []);\n\n useEffect(() => {\n if (type !== \"number\") return;\n const handleWheel = (event: any) => {\n if (event.target instanceof HTMLElement) event.target.blur();\n };\n\n const element = \"current\" in inputRef ? inputRef.current : inputRef;\n\n element?.addEventListener(\"wheel\", handleWheel);\n\n return () => {\n element?.removeEventListener(\"wheel\", handleWheel);\n };\n }, [inputRef, type]);\n\n const input = multiline ? (\n <textarea\n {...(inputProps as React.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n ref={inputRef}\n id={inputId}\n // Falls back to the caller's own value rather than to `undefined`:\n // this sits after the spread, so hardcoding `undefined` silently\n // erased an `aria-labelledby` a consumer had passed, and the\n // unlabelled field it was meant to name stayed unnamed.\n aria-labelledby={label ? labelId : inputProps[\"aria-labelledby\"]}\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n placeholder={focused || hasValue || !label ? placeholder : undefined}\n autoFocus={autoFocus}\n rows={typeof minRows === \"string\" ? parseInt(minRows) : (minRows ?? 3)}\n value={value ?? \"\"}\n onChange={onChange}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n style={inputStyle}\n className={cls(\n invisible ? focusedInvisibleMixin : \"\",\n \"rounded-lg resize-none w-full outline-none text-sm bg-transparent min-h-[64px] px-3\",\n label ? \"pt-8 pb-2\" : \"py-2\",\n disabled && \"outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500\",\n inputClassName\n )}\n />\n ) : (\n <input\n {...inputProps}\n ref={inputRef}\n id={inputId}\n // See the textarea branch: preserve a caller-supplied\n // `aria-labelledby` instead of overwriting it with `undefined`.\n aria-labelledby={label ? labelId : inputProps[\"aria-labelledby\"]}\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n style={inputStyle}\n className={cls(\n \"w-full outline-none bg-transparent leading-normal px-3 text-sm\",\n \"rounded-lg\",\n \"focused:text-text-primary focused:dark:text-text-primary-dark\",\n invisible ? focusedInvisibleMixin : \"\",\n // No fill, hover or disabled tint on the input itself: the\n // wrapper carries all three. Both used to carry the hover\n // fill, so a hovered field painted the alpha twice — once on\n // the box and once on the input a pixel inside its border,\n // at the same radius — and read as a box inside a box.\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n /* A shrunk label occupies roughly the first 16px of the\n box (`top-[-1px]`, translated down 2px, ~15px tall at\n scale-75). `pt-4` put the value's first line at exactly\n 16px, so label and content shared a row: a labelled\n `small` field with a placeholder rendered \"Name\" on top\n of \"e.g. Analytics Pipeline\". `large` was never affected\n — it reserves `pt-8`. */\n label\n // Labelled fields sit exactly 16px above the unlabelled\n // scale (44/48/56/64 against 28/32/40/48). smallest,\n // small and medium all used to share `pt-5 pb-1.5`, so\n // they rendered at an identical 50px and `size` looked\n // inert whenever a label was present.\n ? { smallest: \"pt-4 pb-1\", small: \"pt-5 pb-1\", medium: \"pt-6 pb-2\", large: \"pt-8 pb-2\" }[size]\n : size === \"smallest\"\n ? \"py-0.5\"\n : size === \"small\"\n ? \"py-1\"\n : \"py-2\",\n endAdornment ? \"pr-12\" : \"pr-3\",\n disabled &&\n \"outline-none opacity-65 dark:opacity-60 text-surface-accent-800 dark:text-white\",\n inputClassName\n )}\n placeholder={focused || hasValue || !label ? placeholder : undefined}\n autoFocus={autoFocus}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n type={type}\n value={type === \"number\" && Number.isNaN(value) ? \"\" : value ?? \"\"}\n onChange={onChange}\n />\n );\n\n return (\n <div\n ref={ref}\n className={cls(\n \"rounded-lg relative max-w-full\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n error ? \"border border-red-500 dark:border-red-600\" : \"\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n className\n )}\n style={style}\n >\n {label && (\n <InputLabel\n id={labelId}\n htmlFor={inputId}\n className={cls(\n \"pointer-events-none absolute\",\n size === \"large\" ? \"top-1\" : \"top-[-1px]\",\n !error\n ? focused\n ? \"text-primary dark:text-primary\"\n : \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-500 dark:text-red-600\",\n // A disabled field's LABEL is the one part that must\n // stay readable — it is what tells you which field\n // you cannot edit. `opacity-50` halved the alpha of\n // an already-muted #737373, landing near 2.2:1 over\n // the field fill; the label was effectively gone.\n //\n // The value below it keeps its own `opacity-50`,\n // which is the correct signal: the CONTENT is\n // inactive. Naming the field is not content.\n disabled ? \"text-text-disabled dark:text-text-disabled-dark\" : \"\"\n )}\n shrink={hasValue || focused}\n >\n {label}\n </InputLabel>\n )}\n\n {input}\n\n {endAdornment && (\n <div\n className={cls(\n \"flex flex-row justify-center items-center absolute h-full right-0 top-0\",\n {\n \"mr-4\": size === \"large\",\n \"mr-3\": size === \"medium\",\n \"mr-2\": size === \"small\" || size === \"smallest\"\n }\n )}\n >\n {endAdornment}\n </div>\n )}\n </div>\n );\n }\n);\n\nTextField.displayName = \"TextField\";\n","\nimport React, { createContext, useContext, useRef, useState, useEffect, useMemo } from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type TabVariant = \"standard\" | \"boxy\" | \"pill\";\n\nconst TabsContext = createContext<{ variant: TabVariant }>({ variant: \"standard\" });\nimport { IconButton } from \"./IconButton\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\n\nexport type TabsProps = {\n value: string,\n children: React.ReactNode,\n innerClassName?: string,\n className?: string,\n variant?: TabVariant,\n onValueChange: (value: string) => void\n};\n\nexport function Tabs({\n value,\n onValueChange,\n className,\n innerClassName,\n variant = \"standard\",\n children\n}: TabsProps) {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const [showLeftScroll, setShowLeftScroll] = useState(false);\n const [showRightScroll, setShowRightScroll] = useState(false);\n const [isScrollable, setIsScrollable] = useState(false);\n\n const checkScroll = () => {\n if (scrollContainerRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current;\n setShowLeftScroll(scrollLeft > 0);\n setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);\n setIsScrollable(scrollWidth > clientWidth);\n }\n };\n\n useEffect(() => {\n checkScroll();\n window.addEventListener(\"resize\", checkScroll);\n\n let observer: ResizeObserver;\n if (scrollContainerRef.current) {\n observer = new ResizeObserver(checkScroll);\n observer.observe(scrollContainerRef.current);\n if (scrollContainerRef.current.firstElementChild) {\n observer.observe(scrollContainerRef.current.firstElementChild);\n }\n }\n\n return () => {\n window.removeEventListener(\"resize\", checkScroll);\n observer?.disconnect();\n };\n }, [children]);\n\n const scroll = (direction: \"left\" | \"right\") => {\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current;\n const scrollAmount = Math.max(container.clientWidth / 2, 200);\n const targetScroll = container.scrollLeft + (direction === \"left\" ? -scrollAmount : scrollAmount);\n\n container.scrollTo({\n left: targetScroll,\n behavior: \"smooth\"\n });\n // checkScroll will be called by onScroll event\n }\n };\n\n const contextValue = useMemo(() => ({ variant }), [variant]);\n\n return <TabsContext.Provider value={contextValue}>\n <TabsPrimitive.Root\n value={value}\n onValueChange={onValueChange}\n className={cls(\"relative flex flex-row items-center min-w-0 w-full\", className)}\n >\n {isScrollable && (\n <button\n type=\"button\"\n disabled={!showLeftScroll}\n aria-label=\"Scroll tabs left\"\n onClick={() => scroll(\"left\")}\n className={cls(\n \"absolute left-0 top-1/2 -translate-y-1/2 z-10 flex items-center justify-center rounded-md transition-all h-8 w-6\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400\",\n !showLeftScroll ? \"pointer-events-none opacity-0\" : \"text-surface-600 dark:text-surface-400 hover:bg-surface-hover\",\n \"bg-surface-card border shadow-sm\", defaultBorderMixin\n )}\n >\n <ChevronLeftIcon size={iconSize.smallest}/>\n </button>\n )}\n <div\n ref={scrollContainerRef}\n className=\"flex-1 overflow-x-auto no-scrollbar min-w-0\"\n onScroll={checkScroll}\n style={{ scrollbarWidth: \"none\",\nmsOverflowStyle: \"none\" }}\n >\n <TabsPrimitive.List className={cls(\n // A segmented track is a region, not an object: an inset fill and no border.\n variant === \"standard\" && \"inline-flex h-9 items-center justify-start rounded-md bg-surface-field p-1 text-surface-600 dark:text-surface-400 gap-2\",\n // Folder tabs sit on the strip's bottom edge, so the list aligns\n // them to the end; the active tab overlaps that edge by 1px.\n variant === \"boxy\" && \"flex items-end h-full\",\n variant === \"pill\" && \"flex items-center gap-0.5\",\n innerClassName)\n }>\n {children}\n </TabsPrimitive.List>\n </div>\n {isScrollable && (\n <button\n type=\"button\"\n disabled={!showRightScroll}\n aria-label=\"Scroll tabs right\"\n onClick={() => scroll(\"right\")}\n className={cls(\n \"absolute right-0 top-1/2 -translate-y-1/2 z-10 flex items-center justify-center rounded-md transition-all h-8 w-6\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400\",\n !showRightScroll ? \"pointer-events-none opacity-0\" : \"text-surface-600 dark:text-surface-400 hover:bg-surface-hover\",\n \"bg-surface-card border shadow-sm\", defaultBorderMixin\n )}\n >\n <ChevronRightIcon size={iconSize.smallest}/>\n </button>\n )}\n </TabsPrimitive.Root>\n </TabsContext.Provider>;\n}\n\nexport type TabProps = {\n value: string,\n className?: string,\n innerClassName?: string,\n children: React.ReactNode,\n disabled?: boolean\n};\n\nexport function Tab({\n value,\n className,\n innerClassName,\n children,\n disabled\n}: TabProps) {\n const { variant } = useContext(TabsContext);\n\n return (\n <TabsPrimitive.Trigger\n value={value}\n disabled={disabled}\n className={cls(\n \"inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all\",\n // Colour only. The width and the inset come from the global rule:\n // the tab list scrolls horizontally, so a ring 2px out — with a\n // further 2px of offset — was clipped by the scrollport on the\n // first and last tab. `ring-offset-white` went with it; with an\n // inset ring there is no offset for it to colour.\n \"focus-visible:outline-none focus-visible:ring-surface-400\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n variant === \"standard\" && \"rounded-md px-3 py-1 data-[state=active]:bg-surface-lifted data-[state=active]:text-surface-900 data-[state=active]:shadow-sm dark:data-[state=active]:text-surface-50\",\n // A folder tab. The active one is cut from the same surface as the\n // panel it opens and sits over the strip's hairline (`-mb-px`), so\n // it reads as CONNECTED to what it shows rather than underlined,\n // and the primary is not spent on it. The vertical dividers and\n // the blue underline this variant used to draw were the boxiest\n // thing on the record view; the reference separates tabs with\n // nothing but their own rounded tops.\n variant === \"boxy\" && cls(\n \"flex-shrink-0 flex items-center gap-1.5 px-3.5 h-9 cursor-pointer text-xs font-medium transition-colors group relative box-border\",\n \"rounded-t-lg -mb-px border border-transparent border-b-0\",\n \"data-[state=active]:bg-surface-card data-[state=active]:border-hairline\",\n \"data-[state=active]:text-text-primary dark:data-[state=active]:text-text-primary-dark\",\n \"text-text-secondary dark:text-text-secondary-dark hover:bg-surface-hover\"\n ),\n variant === \"pill\" && cls(\n \"px-2 py-0.5 rounded-md text-[10px] font-medium transition-colors\",\n \"data-[state=active]:bg-primary/10 data-[state=active]:text-primary dark:data-[state=active]:bg-primary/20 dark:data-[state=active]:text-primary\",\n \"text-text-disabled dark:text-text-disabled-dark hover:text-text-secondary dark:hover:text-text-secondary-dark\"\n ),\n className,\n variant === \"standard\" && innerClassName\n )}\n >\n {children}\n </TabsPrimitive.Trigger>\n );\n}\n","\n\"use client\";\n\nimport { TagIcon } from \"lucide-react\";\nimport React, { useRef } from \"react\";\nimport { defaultBorderMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport type TableProps = {\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & React.TableHTMLAttributes<HTMLTableElement>;\n\nexport const Table = React.memo(({\n children,\n className,\n style,\n ...rest\n }: TableProps) => (\n <table\n className={cls(\"text-left text-text-primary dark:text-text-primary-dark rounded-lg overflow-x-auto\", className)}\n style={style}\n {...rest}\n >\n {children}\n </table>\n));\n\nexport type TableBodyProps = {\n children?: React.ReactNode;\n className?: string;\n} & React.HTMLAttributes<HTMLTableSectionElement>;\n\nexport const TableBody = React.memo(({\n children,\n className,\n ...rest\n }: TableBodyProps) => (\n <tbody\n className={cls(\"bg-surface-card text-sm divide-y divide-hairline\", className)}\n {...rest}\n >\n {children}\n </tbody>\n));\n\nexport type TableHeaderProps = {\n children?: React.ReactNode;\n className?: string;\n} & React.HTMLAttributes<HTMLTableSectionElement>;\n\nexport const TableHeader = React.memo(({\n children,\n className,\n ...rest\n }: TableHeaderProps) => (\n <thead {...rest}>\n <tr\n className={cls(\n defaultBorderMixin,\n \"text-sm font-medium text-surface-700 dark:text-surface-accent-300\",\n \"bg-surface-sheet border-b\",\n className\n )}\n >\n {children}\n </tr>\n </thead>\n));\n\nexport type TableRowProps = {\n children?: React.ReactNode;\n className?: string;\n onClick?: React.MouseEventHandler<any>;\n style?: React.CSSProperties;\n} & React.HTMLAttributes<HTMLTableRowElement>;\n\nexport const TableRow = React.memo(({\n children,\n className,\n onClick,\n style,\n ...rest\n }: TableRowProps) => (\n <tr\n onClick={onClick}\n style={style}\n className={cls(\n \"bg-surface-card\",\n onClick ? \"transition-colors duration-150 hover:bg-surface-card-hover cursor-pointer\" : \"\",\n className\n )}\n {...rest}\n >\n {children}\n </tr>\n));\n\nexport type TableCellProps = {\n children?: React.ReactNode;\n header?: boolean;\n scope?: string;\n className?: string;\n style?: React.CSSProperties;\n align?: \"left\" | \"center\" | \"right\";\n colspan?: number;\n} & React.HTMLAttributes<HTMLTableCellElement>;\n\nexport const TableCell = React.memo(({\n children,\n header = false,\n scope = \"\",\n align,\n className,\n style,\n colspan,\n ...rest\n }: TableCellProps) => {\n const ref = useRef<HTMLTableCellElement>(null);\n const TagIcon = header || getParentName(ref.current) === \"TableHeader\" ? \"th\" : \"td\";\n return (\n <TagIcon\n scope={scope}\n colSpan={colspan}\n ref={ref}\n style={style}\n className={cls(\n \"px-4 py-3 text-clip \",\n align === \"center\" ? \"text-center\" : (align === \"right\" ? \"text-right\" : \"text-left\"),\n className\n )}\n {...rest}\n >\n {children}\n </TagIcon>\n );\n});\n\ninterface ReactFiber {\n return: ReactFiber;\n type: string | Function;\n elementType?: {\n name?: string;\n };\n}\n\n// This is highly experimental and might break in the future\nfunction getParentName(element: HTMLElement | null): string | undefined {\n if (element) {\n const key = Object.keys(element).find((key) => {\n return (\n key.startsWith(\"__reactFiber$\") ||\n key.startsWith(\"__reactInternalInstance$\")\n );\n });\n if (key) {\n // React's internal fibre, reached by the `__reactFiber$<hash>` key\n // found on the element above. It is not part of any public API and\n // no type describes it, so this cannot be checked by anything —\n // which is the standing cost of reading it, and the reason the read\n // is confined to this one function.\n const domFiber = (element as unknown as Record<string, ReactFiber>)[key];\n const getComponentFiber = (fiber: ReactFiber): ReactFiber => {\n let parentFiber = fiber.return;\n while (parentFiber && typeof parentFiber.type === \"string\") {\n parentFiber = parentFiber.return;\n }\n return parentFiber;\n };\n let fiber = getComponentFiber(domFiber);\n fiber = getComponentFiber(fiber);\n return fiber?.elementType?.name;\n }\n }\n return undefined;\n}\n\nTable.displayName = \"Table\";\nTableBody.displayName = \"TableBody\";\nTableHeader.displayName = \"TableHeader\";\nTableRow.displayName = \"TableRow\";\nTableCell.displayName = \"TableCell\";\n","\"use client\";\nimport React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\n\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n trigger: React.ReactNode;\n children: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n side?: PopoverSide;\n sideOffset?: number;\n align?: PopoverAlign;\n alignOffset?: number;\n arrowPadding?: number;\n sticky?: \"partial\" | \"always\";\n hideWhenDetached?: boolean;\n avoidCollisions?: boolean;\n enabled?: boolean;\n modal?: boolean;\n className?: string;\n portalContainer?: HTMLElement | null;\n onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n}\n\nexport function Popover({\n trigger,\n children,\n open,\n onOpenChange,\n side,\n sideOffset = 5,\n align,\n alignOffset,\n arrowPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n enabled = true,\n modal = false,\n portalContainer,\n className,\n onMouseEnter,\n onMouseLeave\n }: PopoverProps) {\n\n useInjectStyles(\"Popover\", popoverStyles);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n if (!enabled)\n return <>{trigger}</>;\n\n return <PopoverPrimitive.Root open={open}\n onOpenChange={onOpenChange}\n modal={modal}>\n\n <PopoverPrimitive.Trigger asChild>\n {trigger}\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal container={finalContainer}>\n <PopoverPrimitive.Content\n // `z-50`, the floating layer — see the note in `Menu`. Below it\n // a popover opened from inside a dialog or a side panel is\n // painted under the thing that owns its trigger.\n className={cls(paperMixin,\n \"PopoverContent z-50\", className)}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n arrowPadding={arrowPadding}\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n avoidCollisions={avoidCollisions}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}>\n\n {children}\n <PopoverPrimitive.Arrow className=\"fill-white dark:fill-surface-900\"/>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>;\n}\n\nconst popoverStyles = `\n/* ... (styles remain unchanged) ... */\n.PopoverContent {\n animation-duration: 400ms;\n animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n}\n.PopoverContent[data-state='open'][data-side='top'] {\n animation-name: slideDownAndFade;\n}\n.PopoverContent[data-state='open'][data-side='right'] {\n animation-name: slideLeftAndFade;\n}\n.PopoverContent[data-state='open'][data-side='bottom'] {\n animation-name: slideUpAndFade;\n}\n.PopoverContent[data-state='open'][data-side='left'] {\n animation-name: slideRightAndFade;\n}\n\n@keyframes slideUpAndFade {\n from {\n opacity: 0;\n transform: translateY(2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideRightAndFade {\n from {\n opacity: 0;\n transform: translateX(-2px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideDownAndFade {\n from {\n opacity: 0;\n transform: translateY(-2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideLeftAndFade {\n from {\n opacity: 0;\n transform: translateX(2px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n`;\n","import React from \"react\";\n\nexport type BadgeColor = \"primary\" | \"secondary\" | \"warning\" | \"error\";\n\nexport interface BadgeProps {\n color?: BadgeColor;\n children: React.ReactNode;\n invisible?: boolean;\n}\n\nconst getColor = (color: BadgeColor) => {\n switch (color) {\n case \"primary\":\n return \"bg-primary\";\n case \"secondary\":\n return \"bg-secondary\";\n case \"warning\":\n return \"bg-orange-500\";\n case \"error\":\n return \"bg-red-500\";\n default:\n return \"bg-surface-raised-hover\";\n }\n}\n\nexport const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(({\n color = \"primary\",\n invisible = false,\n children\n }, ref) => {\n return (\n <div ref={ref} className=\"relative inline-block w-fit\">\n {children}\n <span\n className={`absolute top-0.5 right-0.5 transform translate-x-1/2 -translate-y-1/2 rounded-full\n ${getColor(color)}\n transition-all duration-200 ease-out\n ${invisible ? \"w-0 h-0\" : \"w-2 h-2\"}`}\n />\n </div>\n );\n});\n\nBadge.displayName = \"Badge\";\n","\"use client\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { TextField, TextFieldProps } from \"./TextField\";\n\ntype TextFieldChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>;\n\nexport function DebouncedTextField<T extends string | number>(props: TextFieldProps<T>) {\n\n const [internalValue, setInternalValue] = useState<T | string>(props.value ?? \"\");\n const lastSentValueRef = useRef<T | string>(props.value ?? \"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Sync state with props.value when it changes externally\n useEffect(() => {\n const externalValue = props.value ?? \"\";\n if (externalValue !== lastSentValueRef.current) {\n setInternalValue(externalValue);\n lastSentValueRef.current = externalValue;\n }\n }, [props.value]);\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n };\n }, []);\n\n const flushChange = useCallback((value: T | string, event?: TextFieldChangeEvent) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n if (value !== props.value && props.onChange) {\n lastSentValueRef.current = value;\n const e = {\n ...event,\n target: {\n ...event?.target,\n value: value,\n name: props.name\n }\n } as TextFieldChangeEvent;\n props.onChange(e);\n }\n }, [props.value, props.onChange, props.name]);\n\n const internalOnChange = useCallback((event: TextFieldChangeEvent) => {\n const newValue = event.target.value;\n setInternalValue(newValue);\n\n if (timerRef.current) clearTimeout(timerRef.current);\n\n const eventCopy = {\n ...event,\n target: {\n ...event?.target,\n name: event?.target?.name\n }\n };\n\n timerRef.current = setTimeout(() => {\n flushChange(newValue, eventCopy as TextFieldChangeEvent);\n }, 150);\n }, [flushChange]);\n\n const internalOnBlur = useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n flushChange(internalValue, event as TextFieldChangeEvent);\n props.onBlur?.(event);\n }, [internalValue, flushChange, props.onBlur]);\n\n return <TextField {...props}\n onChange={internalOnChange}\n onBlur={internalOnBlur}\n value={internalValue as T}/>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport type SkeletonProps = {\n width?: number;\n height?: number;\n className?: string;\n}\n\nconst styles = `\n@keyframes shimmer {\n 0% {\n transform: translateX(-150%);\n }\n 100% {\n transform: translateX(150%);\n }\n}\n`;\n\nexport function Skeleton({\n width,\n height,\n className\n }: SkeletonProps) {\n\n useInjectStyles(\"Skeleton\", styles);\n\n return <span\n style={{\n width: width === undefined ? undefined : `${width}px`,\n height: height === undefined ? undefined : `${height}px`\n }}\n className={\n cls(\n \"block relative overflow-hidden\",\n \"bg-surface-raised rounded-md\",\n \"max-w-full max-h-full\",\n // The defaults are classes, not inline styles, so that a caller can\n // override them: an inline style beats every utility, which is why\n // `<Skeleton className=\"w-full h-full\"/>` inside a 40px thumbnail\n // box used to render a 12px bar. The `width`/`height` props still\n // win over any class, since those do land inline.\n width === undefined ? \"w-full\" : undefined,\n height === undefined ? \"h-3\" : undefined,\n className)\n }>\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white/50 dark:via-white/8 to-transparent\"\n style={{ animation: \"shimmer 1.8s ease-in-out infinite\" }}\n />\n </span>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport type ToggleButtonOption<T extends string = string> = {\n value: T;\n label: string;\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport type ToggleButtonGroupProps<T extends string = string> = {\n /**\n * Currently selected value\n */\n value: T;\n /**\n * Callback when value changes\n */\n onValueChange: (value: T) => void;\n /**\n * Options to display\n */\n options: ToggleButtonOption<T>[];\n /**\n * Additional class names for the container\n */\n className?: string;\n}\n\n/**\n * A toggle button group component for selecting one option from a set.\n * Displays options as buttons in a horizontal row with active state styling.\n */\nexport function ToggleButtonGroup<T extends string = string>({\n value,\n onValueChange,\n options,\n className\n}: ToggleButtonGroupProps<T>) {\n return (\n // A 32px rounded track (`lg`) with `md` segments. It was 48px with a\n // blue label on the active segment; the lifted fill already says which\n // segment is on, so the label stays in the primary ink and the hue is\n // not spent twice.\n <div role=\"group\" aria-label=\"Toggle options\" className={cls(\"inline-flex flex-row bg-surface-field rounded-lg p-1 gap-1\", className)}>\n {options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n if (!option.disabled) {\n onValueChange(option.value);\n }\n }}\n disabled={option.disabled}\n aria-pressed={value === option.value}\n aria-disabled={option.disabled || undefined}\n className={cls(\n \"flex flex-row items-center justify-center gap-2 h-6 px-3.5 rounded-md transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\",\n value === option.value\n ? \"bg-surface-lifted text-text-primary dark:text-text-primary-dark shadow-sm\"\n : \"text-text-secondary dark:text-text-secondary-dark hover:bg-surface-hover\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.icon}\n <span className=\"text-xs font-medium\">{option.label}</span>\n </button>\n ))}\n </div>\n );\n}\n","import { ArrowUpIcon, FilterIcon } from \"lucide-react\";\nimport { iconSize } from \"../../icons/Icon\";\n\nimport React, { RefObject, useCallback, useEffect, useState } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { VirtualTableColumn, VirtualTableSort, VirtualTableWhereFilterOp } from \"./VirtualTableProps\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { Badge } from \"../Badge\";\nimport { Button } from \"../Button\";\nimport { IconButton } from \"../IconButton\";\nimport { Popover } from \"../Popover\";\nimport { defaultBorderMixin } from \"../../styles\";\nimport { cls } from \"../../util/cls\";\ninterface FilterFormProps<T> {\n column: VirtualTableColumn<T>;\n onFilterUpdate: (filter?: [VirtualTableWhereFilterOp, unknown], newOpenFilterState?: boolean) => void;\n filter?: [VirtualTableWhereFilterOp, unknown];\n onHover: boolean,\n createFilterField: (props: FilterFormFieldProps<T>) => React.ReactNode;\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n}\n\nexport type FilterFormFieldProps<CustomProps> = {\n id: React.Key,\n filterValue: [VirtualTableWhereFilterOp, unknown] | undefined,\n setFilterValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;\n column: VirtualTableColumn<CustomProps>;\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n};\n\ntype VirtualTableHeaderProps<M extends object> = {\n resizeHandleRef: React.Ref<HTMLDivElement>;\n columnIndex: number;\n isResizingIndex: number;\n column: VirtualTableColumn<unknown>;\n onColumnSort: (key: Extract<keyof M, string>, additive?: boolean) => void;\n filter?: [VirtualTableWhereFilterOp, unknown];\n sort: VirtualTableSort;\n /**\n * This column's zero-based rank in a multi-key sort, or `undefined` when\n * only one column is sorted and a rank would say nothing.\n */\n sortPosition?: number;\n onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;\n onClickResizeColumn?: (columnIndex: number, column: VirtualTableColumn) => void;\n createFilterField?: (props: FilterFormFieldProps<unknown>) => React.ReactNode;\n AdditionalHeaderWidget?: (props: { onHover: boolean }) => React.ReactNode;\n isDragging?: boolean;\n isDraggable?: boolean;\n};\n\n/**\n * What the next click on this column's sort control will do, spelled out for\n * the tooltip and for screen readers. An unlabelled arrow that means three\n * different things depending on the state it is in is a control you have to\n * click to learn.\n */\nfunction sortActionTitle(sort: VirtualTableSort, sortPosition?: number): string {\n const rank = sortPosition !== undefined ? ` (sort key ${sortPosition + 1})` : \"\";\n const addKey = \" — shift-click to add it under the current sort instead\";\n if (sort === \"asc\") return `Sorted ascending${rank}. Click to sort descending.${addKey}`;\n if (sort === \"desc\") return `Sorted descending${rank}. Click to remove this sort.${addKey}`;\n return `Click to sort ascending.${addKey}`;\n}\n\nexport const VirtualTableHeader = React.memo<VirtualTableHeaderProps<Record<string, unknown>>>(\n function VirtualTableHeader<M extends object>({\n resizeHandleRef,\n columnIndex,\n isResizingIndex,\n sort,\n sortPosition,\n onColumnSort,\n onFilterUpdate,\n filter,\n column,\n onClickResizeColumn,\n createFilterField,\n AdditionalHeaderWidget,\n isDragging,\n isDraggable\n }: VirtualTableHeaderProps<M>) {\n\n const [onHover, setOnHover] = useState(false);\n\n const [openFilter, setOpenFilter] = React.useState(false);\n const [hidden, setHidden] = React.useState(false);\n\n const handleSettingsClick = useCallback((_event: React.MouseEvent) => {\n setOpenFilter(true);\n }, []);\n\n const update = useCallback((filterForProperty?: [VirtualTableWhereFilterOp, unknown], newOpenFilterState?: boolean) => {\n onFilterUpdate(column, filterForProperty);\n if (newOpenFilterState !== undefined)\n setOpenFilter(newOpenFilterState);\n }, [column, onFilterUpdate]);\n\n const thisColumnIsResizing = isResizingIndex === columnIndex;\n const anotherColumnIsResizing = isResizingIndex !== columnIndex && isResizingIndex > 0;\n\n const hovered = !anotherColumnIsResizing && (onHover || thisColumnIsResizing);\n\n return (\n <ErrorBoundary>\n <div\n className={cls(\"flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center\",\n isDragging\n ? \"bg-primary-bg\"\n : \"bg-surface-sheet\",\n \"text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark\",\n !isDragging && \"hover:bg-surface-hover\",\n column.frozen ? \"sticky left-0 z-10\" : \"relative z-0\",\n isDraggable && \"cursor-grab\"\n )}\n style={{\n left: column.frozen ? 0 : undefined,\n minWidth: column.width,\n maxWidth: column.width\n }}\n onMouseEnter={() => setOnHover(true)}\n onMouseMove={() => setOnHover(true)}\n onMouseLeave={() => setOnHover(false)}\n >\n\n <div className=\"overflow-hidden grow\">\n <div\n className={`flex items-center justify-${column.headerAlign} flex-row`}>\n\n {column.icon && (\n <div className=\"flex-shrink-0 flex items-center justify-center mr-1\">\n {React.isValidElement(column.icon) ? (\n React.cloneElement(column.icon as React.ReactElement<any>, {\n size: 14,\n className: cls((column.icon as React.ReactElement<any>).props?.className, \"flex-shrink-0\")\n })\n ) : (\n column.icon\n )}\n </div>\n )}\n\n <div\n className=\"truncate -webkit-box w-full mr-1 overflow-hidden\"\n style={{\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 2,\n justifyContent: column.align\n }}>\n {column.title}\n </div>\n\n </div>\n </div>\n <>\n\n {AdditionalHeaderWidget &&\n <AdditionalHeaderWidget onHover={onHover || openFilter}/>}\n\n {column.sortable && (sort || hovered || openFilter) &&\n <div className=\"flex-shrink-0 flex items-center\">\n <Badge color=\"secondary\"\n invisible={!sort}>\n <IconButton\n size={\"small\"}\n className={onHover || openFilter ? \"bg-surface-card\" : undefined}\n // Shift keeps the sort already in place\n // and adds this column beneath it, which\n // is how a two-key order is built from\n // header clicks. Plain click still\n // replaces the whole sort, so the common\n // case takes no modifier and nothing a\n // user knew before stops working.\n title={sortActionTitle(sort, sortPosition)}\n aria-label={sortActionTitle(sort, sortPosition)}\n onClick={(event: React.MouseEvent) => {\n onColumnSort(column.key as Extract<keyof M, string>, event.shiftKey);\n }}\n >\n {!sort &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0\" />}\n {sort === \"asc\" &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0\" />}\n {sort === \"desc\" &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0 rotate-180\" />}\n </IconButton>\n </Badge>\n {/* The rank, shown only once there is more than\n one key: two arrows with no numbers beside\n them say a table is sorted by both columns\n and nothing about which one decides. */}\n {sort && sortPosition !== undefined && (\n <span\n className=\"flex-shrink-0 -ml-0.5 mr-0.5 text-[10px] font-semibold leading-none tabular-nums text-text-secondary dark:text-text-secondary-dark\"\n aria-hidden={true}\n >\n {sortPosition + 1}\n </span>\n )}\n </div>\n }\n </>\n\n {column.filter && createFilterField && <div className=\"flex-shrink-0\">\n <Badge color=\"secondary\"\n invisible={!filter}>\n\n <Popover\n open={openFilter}\n onOpenChange={setOpenFilter}\n className={hidden ? \"hidden\" : undefined}\n modal={true}\n trigger={\n <IconButton\n className={onHover || openFilter ? \"bg-surface-card\" : undefined}\n size={\"small\"}\n onClick={handleSettingsClick}>\n <FilterIcon size={14} className=\"flex-shrink-0\"/>\n </IconButton>}\n >\n <FilterForm column={column}\n filter={filter}\n onHover={onHover}\n onFilterUpdate={update}\n createFilterField={createFilterField}\n hidden={hidden}\n setHidden={setHidden}/>\n\n </Popover>\n\n </Badge>\n\n </div>}\n\n {column.resizable && <div\n ref={resizeHandleRef as React.Ref<HTMLDivElement>}\n data-no-dnd=\"true\"\n className={cls(\n \"absolute h-full w-[6px] top-0 right-0 cursor-col-resize\",\n hovered && \"bg-hairline-strong\"\n )}\n onPointerDown={(e) => {\n e.stopPropagation();\n if (onClickResizeColumn) {\n onClickResizeColumn(columnIndex, column);\n }\n }}\n />}\n </div>\n\n </ErrorBoundary>\n );\n }, equal) as React.FunctionComponent<VirtualTableHeaderProps<Record<string, unknown>>>;\n\nfunction FilterForm<M>({\n column,\n onFilterUpdate,\n filter,\n onHover,\n createFilterField,\n hidden,\n setHidden\n}: FilterFormProps<M>) {\n\n const id = column.key;\n\n const [filterInternal, setFilterInternal] = useState<[VirtualTableWhereFilterOp, unknown] | undefined>(filter);\n\n useEffect(() => {\n setFilterInternal(filter);\n }, [filter]);\n\n if (!column.filter) return null;\n\n const submit = () => {\n onFilterUpdate(filterInternal, false);\n };\n\n const reset = (_e: React.MouseEvent) => {\n onFilterUpdate(undefined, false);\n };\n\n const filterIsSet = !!filter;\n\n const filterField = createFilterField({\n id,\n filterValue: filterInternal,\n setFilterValue: setFilterInternal,\n column,\n hidden,\n setHidden\n });\n\n if (!filterField) return null;\n return (\n <form noValidate={true}\n onSubmit={(e) => {\n e.stopPropagation();\n e.preventDefault();\n submit();\n }}\n className={\"text-surface-900 dark:text-white\"}>\n <div\n className={cls(defaultBorderMixin, \"py-4 px-6 typography-label border-b\")}>\n {column.title ?? id}\n </div>\n {filterField && <div className=\"m-4 w-[400px]\">\n {filterField}\n </div>}\n <div className=\"flex justify-end m-4\">\n <Button\n className=\"mr-4\"\n disabled={!filterIsSet}\n variant={\"text\"}\n type=\"reset\"\n aria-label=\"filter clear\"\n onClick={reset}>Clear</Button>\n <Button\n type=\"submit\">Filter</Button>\n </div>\n </form>\n );\n\n}\n","import React, { createRef, useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { VirtualTableColumn, VirtualTableWhereFilterOp } from \"./VirtualTableProps\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { VirtualTableHeader } from \"./VirtualTableHeader\";\nimport { VirtualTableContextProps } from \"./types\";\nimport { defaultBorderMixin } from \"../../styles\";\nimport { cls } from \"../../util/cls\";import { useSortable } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\n\n// Sortable column header wrapper\nconst SortableColumnHeader = ({\n column,\n columnIndex,\n columnRefs,\n isResizing,\n onFilterUpdate,\n filter,\n sortIndex,\n sortCount,\n onColumnSort,\n onClickResizeColumn,\n createFilterField,\n isDragging,\n isDraggable\n}: {\n column: VirtualTableColumn;\n columnIndex: number;\n columnRefs: React.Ref<HTMLDivElement>[];\n isResizing: number;\n onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;\n filter: [VirtualTableWhereFilterOp, unknown] | undefined;\n sortIndex: Map<string, { direction: \"asc\" | \"desc\"; position: number }>;\n sortCount: number;\n onColumnSort: (key: string, additive?: boolean) => void;\n onClickResizeColumn: (index: number) => void;\n createFilterField: ((props: import(\"./VirtualTableHeader\").FilterFormFieldProps<unknown>) => React.ReactNode) | undefined;\n isDragging: boolean;\n isDraggable: boolean;\n}) => {\n const [isPressing, setIsPressing] = useState(false);\n\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition\n } = useSortable({\n id: column.key,\n disabled: !isDraggable || column.frozen\n });\n\n const style = {\n // Only use translate, ignore any scale transforms\n transform: transform ? `translateX(${transform.x}px)` : undefined,\n // Don't transition the dragged item - only other items should animate\n transition: isDragging ? undefined : transition,\n minWidth: column.width,\n maxWidth: column.width,\n width: column.width\n };\n\n // Combine our press handlers with dnd-kit listeners\n const combinedListeners = isDraggable ? {\n ...listeners,\n onPointerDown: (e: React.PointerEvent) => {\n setIsPressing(true);\n listeners?.onPointerDown?.(e);\n },\n onPointerUp: () => setIsPressing(false),\n onPointerCancel: () => setIsPressing(false)\n } : {};\n\n // Reset pressing state when drag ends\n React.useEffect(() => {\n if (!isDragging) {\n setIsPressing(false);\n }\n }, [isDragging]);\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cls(\n \"flex-shrink-0 h-full\",\n column.frozen && \"sticky left-0 z-10\"\n )}\n {...attributes}\n {...combinedListeners}\n >\n <VirtualTableHeader\n resizeHandleRef={columnRefs[columnIndex]}\n columnIndex={columnIndex}\n isResizingIndex={isResizing}\n onFilterUpdate={onFilterUpdate}\n filter={filter}\n sort={sortIndex.get(column.key)?.direction}\n sortPosition={sortCount > 1 ? sortIndex.get(column.key)?.position : undefined}\n onColumnSort={onColumnSort}\n onClickResizeColumn={onClickResizeColumn}\n column={column}\n createFilterField={createFilterField}\n AdditionalHeaderWidget={column.AdditionalHeaderWidget}\n isDragging={isDragging || isPressing}\n isDraggable={isDraggable}/>\n </div>\n );\n};\n\nexport const VirtualTableHeaderRow = ({\n columns,\n sortIndex,\n onColumnSort,\n onFilterUpdate,\n filter,\n onColumnResize,\n onColumnResizeEnd,\n createFilterField,\n AddColumnComponent,\n onColumnsOrderChange,\n data,\n cellRenderer: CellRenderer,\n rowHeight = 54,\n draggingColumnId,\n headerHeight = 40\n}: VirtualTableContextProps<Record<string, unknown>>) => {\n\n const columnRefs = useMemo(() => columns.map(() => createRef<HTMLDivElement>()), [columns.length]);\n const [isResizing, setIsResizing] = useState(-1);\n\n const adjustWidthColumn = useCallback((index: number, width: number, end: boolean) => {\n const column = columns[index];\n const minWidth = 100;\n const maxWidth = 800;\n const newWidth = width > maxWidth ? maxWidth : (width < minWidth ? minWidth : width);\n const params = {\n width: newWidth,\n key: column.key as string,\n column: {\n ...column,\n width: newWidth\n } as VirtualTableColumn\n };\n if (!end)\n onColumnResize(params);\n else\n onColumnResizeEnd(params);\n }, [columns, onColumnResize, onColumnResizeEnd]);\n\n const getEventNewWidth = useCallback((e: MouseEvent) => {\n if (isResizing >= 0) {\n const left = columnRefs[isResizing].current?.parentElement?.getBoundingClientRect().left;\n if (!left) return;\n return e.clientX - left;\n }\n return undefined;\n }, [columnRefs, isResizing]);\n\n const setCursorDocument = useCallback((isResizing: boolean) => {\n document.body.style.cursor = isResizing ? \"col-resize\" : \"auto\";\n }, []);\n\n const handleOnMouseMove = useCallback((e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const newWidth = getEventNewWidth(e);\n if (newWidth)\n adjustWidthColumn(isResizing, newWidth, false);\n }, [adjustWidthColumn, getEventNewWidth, isResizing]);\n\n const handleOnMouseUp = useCallback((e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const newWidth = getEventNewWidth(e);\n if (newWidth)\n adjustWidthColumn(isResizing, newWidth, true);\n setIsResizing(-1);\n setCursorDocument(false);\n }, [adjustWidthColumn, getEventNewWidth, isResizing, setCursorDocument]);\n\n const removeResizingListeners = useCallback(() => {\n document.removeEventListener(\"mousemove\", handleOnMouseMove);\n document.removeEventListener(\"mouseup\", handleOnMouseUp);\n }, [handleOnMouseMove, handleOnMouseUp]);\n\n const attachResizeListeners = useCallback(() => {\n document.addEventListener(\"mousemove\", handleOnMouseMove);\n document.addEventListener(\"mouseup\", handleOnMouseUp);\n }, [handleOnMouseMove, handleOnMouseUp]);\n\n useEffect(() => {\n if (isResizing >= 0) {\n attachResizeListeners();\n } else {\n removeResizingListeners();\n }\n return () => {\n removeResizingListeners();\n };\n }, [attachResizeListeners, isResizing, removeResizingListeners]);\n\n const onClickResizeColumn = useCallback((index: number) => {\n setIsResizing(index);\n setCursorDocument(true);\n }, [setCursorDocument]);\n\n return (\n <>\n <div\n className={cls(defaultBorderMixin, \"z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 border-b bg-surface-sheet\")}\n style={{ height: headerHeight }}>\n {columns.map((column, columnIndex) => {\n const columnFilter = column && filter && filter[column.key] ? filter[column.key] : undefined;\n const filterForThisProperty: [VirtualTableWhereFilterOp, unknown] | undefined =\n columnFilter\n ? (Array.isArray(columnFilter[0]) ? (columnFilter as [VirtualTableWhereFilterOp, unknown][])[0] : (columnFilter as [VirtualTableWhereFilterOp, unknown]))\n : undefined;\n\n const isDraggable = !column.frozen && !!onColumnsOrderChange;\n const isDragging = draggingColumnId === column.key;\n\n return (\n <ErrorBoundary key={\"header_\" + column.key}>\n <SortableColumnHeader\n column={column}\n columnIndex={columnIndex}\n columnRefs={columnRefs}\n isResizing={isResizing}\n onFilterUpdate={onFilterUpdate}\n filter={filterForThisProperty}\n sortIndex={sortIndex}\n sortCount={sortIndex.size}\n onColumnSort={onColumnSort}\n onClickResizeColumn={onClickResizeColumn}\n createFilterField={createFilterField}\n isDragging={isDragging}\n isDraggable={isDraggable}\n />\n </ErrorBoundary>\n );\n })}\n\n {AddColumnComponent && <AddColumnComponent/>}\n\n </div>\n </>\n );\n};\n","import React, { useCallback } from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { VirtualTableRowProps } from \"./types\";\nimport { cls } from \"../../util/cls\";\nconst VirtualTableRowInner = React.memo<VirtualTableRowProps<object>>(\n function VirtualTableRow<T extends object>({\n rowData,\n rowIndex,\n children,\n onRowClick,\n rowHeight,\n style,\n hoverRow,\n rowClassName\n }: VirtualTableRowProps<T>) {\n\n const onClick = useCallback((event: React.SyntheticEvent) => {\n // A row with no data yet is not a row anyone clicked *on*.\n if (onRowClick && rowData)\n onRowClick({\n rowData,\n rowIndex,\n event\n })\n }, [onRowClick, rowData, rowIndex]);\n\n return (\n <div\n className={cls(\n \"group flex min-w-full text-sm border-b border-hairline bg-surface-card\",\n rowClassName && rowData ? rowClassName(rowData) : \"\",\n {\n \"hover:!bg-surface-card-hover\": hoverRow,\n \"cursor-pointer \": onRowClick\n }\n )}\n onClick={onClick}\n style={{\n ...(style),\n height: rowHeight,\n width: \"fit-content\"\n }}\n >\n {children}\n </div>\n );\n\n },\n equal\n);\n\n/**\n * The same fix `VirtualTable` carries, one level down: `React.memo` takes the\n * props type as its own type argument, so the annotation on the call pins the\n * row type at the boundary and discards the `<T>` the inner function declares.\n * Pinned, the row a caller passes in and the row its `onRowClick` and\n * `rowClassName` receive were unrelated types, which is what every consumer was\n * paying for with a cast.\n */\nexport const VirtualTableRow = VirtualTableRowInner as <T extends object>(\n props: VirtualTableRowProps<T>\n) => React.ReactElement | null;\n","import React from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { CellRendererParams, VirtualTableColumn } from \"./VirtualTableProps\";\n\ntype VirtualTableCellProps<T> = {\n dataKey: string;\n column: VirtualTableColumn;\n columns: VirtualTableColumn[];\n rowData: T;\n cellData: unknown;\n rowIndex: number;\n columnIndex: number;\n cellRenderer: (props: CellRendererParams<T>) => React.ReactNode;\n // Sortable props\n sortableNodeRef?: (node: HTMLElement | null) => void;\n sortableStyle?: React.CSSProperties;\n sortableAttributes?: Record<string, unknown>;\n isDragging?: boolean;\n isDraggable?: boolean;\n frozen?: boolean;\n extraData?: unknown;\n};\n\nexport const VirtualTableCell = React.memo<VirtualTableCellProps<unknown>>(\n function VirtualTableCell<T>(props: VirtualTableCellProps<T>) {\n return props.rowData ? props.cellRenderer(\n {\n cellData: props.cellData,\n rowData: props.rowData,\n rowIndex: props.rowIndex,\n isScrolling: false,\n column: props.column,\n columns: props.columns,\n columnIndex: props.columnIndex,\n width: props.column.width,\n sortableNodeRef: props.sortableNodeRef,\n sortableStyle: props.sortableStyle,\n sortableAttributes: props.sortableAttributes,\n isDragging: props.isDragging,\n isDraggable: props.isDraggable,\n frozen: props.frozen,\n extraData: props.extraData\n } as CellRendererParams<T>\n ) : null;\n },\n (a, b) => {\n return equal(a.rowData, b.rowData) &&\n equal(a.column, b.column) &&\n equal(a.cellData, b.cellData) &&\n a.rowIndex === b.rowIndex &&\n a.columnIndex === b.columnIndex &&\n a.isDragging === b.isDragging &&\n a.isDraggable === b.isDraggable &&\n a.frozen === b.frozen &&\n equal(a.extraData, b.extraData)\n }\n);\n","\n\nimport React, { createContext, forwardRef, RefObject, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { FixedSizeList as List } from \"react-window\";\nimport useMeasure from \"react-use-measure\";\n\nimport { CircularProgress } from \"../CircularProgress\";\nimport {\n OnVirtualTableColumnResizeParams,\n VirtualTableColumn,\n VirtualTableFilterValues,\n VirtualTableProps,\n VirtualTableSortKey,\n VirtualTableWhereFilterOp\n} from \"./VirtualTableProps\";\n\nimport { VirtualTableContextProps } from \"./types\";\nimport { VirtualTableHeaderRow } from \"./VirtualTableHeaderRow\";\nimport { VirtualTableRow } from \"./VirtualTableRow\";\nimport { VirtualTableCell } from \"./VirtualTableCell\";\nimport { CenteredView } from \"../CenteredView\";\nimport { Typography } from \"../Typography\";\nimport { cls } from \"../../util/cls\";\nimport { useDebounceCallback } from \"../../hooks/useDebounceCallback\";\nimport {\n closestCenter,\n DndContext,\n DragEndEvent,\n DragStartEvent,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from \"@dnd-kit/sortable\";\n\n\nconst VirtualListContext = createContext<VirtualTableContextProps<Record<string, unknown>>>(null! as VirtualTableContextProps<Record<string, unknown>>);\nVirtualListContext.displayName = \"VirtualListContext\";\n\ntype InnerElementProps = {\n children: React.ReactNode,\n style: React.CSSProperties\n};\n\n// eslint-disable-next-line react/display-name\nconst innerElementType = forwardRef<HTMLDivElement, InnerElementProps>(({\n children,\n ...rest\n}: InnerElementProps, ref) => {\n\n return (\n <VirtualListContext.Consumer>\n {(virtualTableProps) => {\n const customView = virtualTableProps.customView;\n const headerHeight = virtualTableProps.headerHeight ?? 48;\n return (\n <>\n <div\n id={\"virtual-table\"}\n style={{\n position: \"relative\",\n height: \"100%\",\n zIndex: 0\n }}>\n <div\n ref={ref}\n {...rest}\n style={{\n ...rest?.style,\n height: (typeof rest?.style?.height === \"number\" ? rest.style.height : parseFloat((rest?.style?.height as string) || \"0\")) + headerHeight,\n minHeight: \"100%\",\n position: \"relative\"\n }}>\n <div style={{ position: \"sticky\",\ntop: 0,\nzIndex: 20 }}>\n <VirtualTableHeaderRow {...virtualTableProps}/>\n </div>\n {!customView && children}\n </div>\n\n </div>\n\n {customView && <div style={{\n position: \"sticky\",\n top: virtualTableProps.headerHeight ?? 48,\n flexGrow: 1,\n height: `calc(100% - ${virtualTableProps.headerHeight ?? 48}px)`,\n marginTop: `calc(${(virtualTableProps.headerHeight ?? 48)}px - 100vh)`,\n left: 0\n }}>{customView}</div>}\n\n </>\n );\n }}\n </VirtualListContext.Consumer>\n );\n})\n ;\n\n/**\n * This is a Table component that allows displaying arbitrary data, not\n * necessarily related to entities or properties. It is the component\n * that powers the entity collections but has a generic API, so it\n * can be reused.\n *\n * @group Components\n */\nconst VirtualTableInner = React.memo<VirtualTableProps<Record<string, unknown>>>(\n function VirtualTable<T extends object>({\n data,\n onResetPagination,\n onEndReached,\n endOffset = 600,\n rowHeight = 54,\n headerHeight = 40,\n columns: columnsProp,\n onRowClick,\n onColumnResize,\n onColumnResizeEnd,\n filter: filterInput,\n checkFilterCombination,\n onFilterUpdate,\n sortBy,\n error,\n emptyComponent,\n onSortByUpdate,\n onScroll: onScrollProp,\n loading,\n cellRenderer,\n hoverRow,\n createFilterField,\n rowClassName,\n style,\n className,\n endAdornment,\n AddColumnComponent,\n initialScroll = 0,\n onColumnsOrderChange,\n extraData\n }: VirtualTableProps<T>) {\n\n // Where each sorted column sits in the order, so a header can show both\n // which way it runs and how much it counts: `roles ↑1, created_at ↓2`\n // reads as \"by role, newest first within each role\". Without the rank a\n // multi-key sort shows two arrows and no way to tell which one wins.\n const sortIndex = useMemo(() => {\n const index = new Map<string, { direction: \"asc\" | \"desc\"; position: number }>();\n (sortBy ?? []).forEach(([key, direction], position) => {\n if (!index.has(key)) index.set(key, { direction,\nposition });\n });\n return index;\n }, [sortBy]);\n\n const [columns, setColumns] = useState(columnsProp);\n\n const tableRef = useRef<HTMLDivElement>(null);\n const endReachCallbackThreshold = useRef<number>(0);\n\n const debouncedScroll = useDebounceCallback(onScrollProp, 200);\n\n // Drag and drop state\n const [draggingColumnId, setDraggingColumnId] = useState<string | null>(null);\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n })\n );\n\n const handleDragStart = useCallback((event: DragStartEvent) => {\n setDraggingColumnId(event.active.id as string);\n }, []);\n\n const handleDragEnd = useCallback((event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n setDraggingColumnId(null);\n\n if (over && active.id !== over.id && onColumnsOrderChange) {\n const oldIndex = columns.findIndex((col) => col.key === active.id);\n const newIndex = columns.findIndex((col) => col.key === over.id);\n\n if (oldIndex !== -1 && newIndex !== -1) {\n const newColumns = arrayMove(columns, oldIndex, newIndex);\n setColumns(newColumns);\n onColumnsOrderChange(newColumns);\n }\n }\n }, [columns, onColumnsOrderChange]);\n\n const handleDragCancel = useCallback(() => {\n setDraggingColumnId(null);\n }, []);\n\n // Set initial scroll position\n useEffect(() => {\n if (tableRef.current && initialScroll) {\n const { scrollLeft } = tableRef.current;\n tableRef.current.scrollTo(scrollLeft, initialScroll);\n }\n }, [tableRef, initialScroll]);\n\n useEffect(() => {\n setColumns(columnsProp);\n }, [columnsProp]);\n\n // Removed redundant ResizeObserver to prevent performance issues and UI flickering.\n\n const [measureRef, bounds] = useMeasure({\n polyfill: ResizeObserver,\n scroll: true,\n // This is important for handling zooming in react-flow\n offsetSize: true\n });\n\n const onColumnResizeInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {\n setColumns(prevColumns =>\n prevColumns.map((column) =>\n column.key === params.column.key ? params.column : column\n )\n );\n }, []);\n\n const onColumnResizeEndInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {\n setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));\n if (onColumnResize) {\n onColumnResize(params);\n }\n if (onColumnResizeEnd) {\n onColumnResizeEnd(params);\n }\n }, [columns, onColumnResize, onColumnResizeEnd]);\n\n // saving the current filter as a ref as a workaround for header closure\n const filterRef = useRef<VirtualTableFilterValues<string> | undefined>(undefined);\n\n useEffect(() => {\n filterRef.current = filterInput;\n }, [filterInput]);\n\n const scrollToTop = useCallback(() => {\n endReachCallbackThreshold.current = 0;\n if (tableRef.current) {\n tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);\n }\n }, []);\n\n /**\n * Click a header to sort by that column: ascending, descending, then\n * off. Shift-click to keep the sort you already have and add this\n * column under it — the same idiom spreadsheets use, and the only way\n * to build \"by role, newest first\" out of two clicks.\n *\n * Shift cycles the column it lands on through the same three states, so\n * a key added by mistake is removed by shift-clicking it twice more,\n * without disturbing the keys around it.\n */\n const onColumnSort = useCallback((key: string, additive = false) => {\n\n const current = sortIndex.get(key);\n const next: \"asc\" | \"desc\" | undefined = current === undefined\n ? \"asc\"\n : current.direction === \"asc\" ? \"desc\" : undefined;\n\n const existing = sortBy ?? [];\n let newSortBy: VirtualTableSortKey[] | undefined;\n if (!additive) {\n newSortBy = next ? [[key, next]] : undefined;\n } else if (next === undefined) {\n newSortBy = existing.filter(([existingKey]) => existingKey !== key);\n } else if (current === undefined) {\n newSortBy = [...existing, [key, next]];\n } else {\n newSortBy = existing.map((entry) => entry[0] === key ? [key, next] as VirtualTableSortKey : entry);\n }\n if (newSortBy?.length === 0) newSortBy = undefined;\n\n const filter = filterRef.current;\n if (filter) {\n if (checkFilterCombination && !checkFilterCombination(filter, newSortBy)) {\n if (onFilterUpdate)\n onFilterUpdate(undefined);\n }\n }\n\n if (onResetPagination) {\n onResetPagination();\n }\n\n if (onSortByUpdate) {\n onSortByUpdate(newSortBy);\n }\n\n scrollToTop();\n }, [checkFilterCombination, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortBy, sortIndex]);\n\n const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);\n\n const onEndReachedInternal = useCallback((scrollOffset: number) => {\n if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {\n endReachCallbackThreshold.current = scrollOffset;\n onEndReached();\n }\n }, [data?.length, onEndReached]);\n\n const onScroll = useCallback(({\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n }: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean;\n }) => {\n if (onScrollProp) {\n debouncedScroll({\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n })\n }\n if (!scrollUpdateWasRequested && (scrollOffset >= maxScroll - endOffset))\n onEndReachedInternal(scrollOffset);\n }, [maxScroll, onEndReachedInternal]);\n\n const onFilterUpdateInternal = useCallback((column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => {\n\n endReachCallbackThreshold.current = 0;\n const filter = filterRef.current;\n let newFilterValue: VirtualTableFilterValues<string> = filter ? { ...filter } : {};\n\n if (!filterForProperty) {\n delete newFilterValue[column.key];\n } else {\n newFilterValue[column.key] = filterForProperty;\n }\n const isNewFilterCombinationValid = !checkFilterCombination || checkFilterCombination(newFilterValue, sortBy);\n if (!isNewFilterCombinationValid) {\n newFilterValue = filterForProperty ? { [column.key]: filterForProperty } as VirtualTableFilterValues<Extract<keyof T, string>> : {};\n }\n\n if (onFilterUpdate) onFilterUpdate(newFilterValue);\n }, [checkFilterCombination, onFilterUpdate, sortBy]);\n\n const empty = !loading && (data?.length ?? 0) === 0;\n const customView = (error && (data?.length ?? 0) === 0)\n ? <CenteredView maxWidth={\"2xl\"}\n className=\"flex flex-col gap-2\">\n\n <Typography variant={\"h6\"}>\n {\"Error\"}\n </Typography>\n\n {error?.message && <SafeLinkRenderer text={error.message}/>}\n\n </CenteredView>\n : (empty\n ? (loading\n ? <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\"/>\n </div>\n : <div\n className=\"flex flex-col overflow-auto items-center justify-center py-12 px-8\">\n {emptyComponent}\n </div>)\n : undefined);\n\n const virtualListController = useMemo(() => ({\n data,\n rowHeight: rowHeight,\n headerHeight: headerHeight,\n cellRenderer,\n columns,\n onRowClick,\n customView,\n onColumnResize: onColumnResizeInternal,\n onColumnResizeEnd: onColumnResizeEndInternal,\n filter: filterRef.current,\n onColumnSort,\n onFilterUpdate: onFilterUpdateInternal,\n sortIndex,\n hoverRow: hoverRow ?? false,\n createFilterField,\n rowClassName,\n endAdornment,\n AddColumnComponent,\n onColumnsOrderChange: onColumnsOrderChange ? (newColumns: VirtualTableColumn[]) => {\n setColumns(newColumns);\n onColumnsOrderChange(newColumns);\n } : undefined,\n draggingColumnId,\n extraData\n }), [data, rowHeight, cellRenderer, columns, onRowClick, customView, onColumnResizeInternal, onColumnResizeEndInternal, filterInput, onColumnSort, onFilterUpdateInternal, sortIndex, hoverRow, createFilterField, rowClassName, endAdornment, AddColumnComponent, onColumnsOrderChange, draggingColumnId, extraData]);\n\n // Get sortable column keys (excluding frozen columns)\n const sortableColumnKeys = columns\n .filter(col => !col.frozen)\n .map(col => col.key);\n\n const tableContent = (\n <div\n ref={measureRef}\n style={style}\n className={cls(\n \"h-full w-full\",\n className,\n draggingColumnId && \"overflow-hidden\"\n )}>\n {/* SAFETY: T extends Record<string, any> is structurally assignable to Record<string, unknown> */}\n <VirtualListContext.Provider\n value={virtualListController as VirtualTableContextProps<Record<string, unknown>>}>\n\n <MemoizedList\n outerRef={tableRef}\n key={rowHeight}\n width={bounds.width}\n height={bounds.height}\n itemCount={(data?.length ?? 0) + (endAdornment ? 1 : 0)}\n onScroll={draggingColumnId ? undefined : onScroll}\n includeAddColumn={Boolean(AddColumnComponent)}\n itemSize={rowHeight}/>\n\n </VirtualListContext.Provider>\n </div>\n );\n\n // Wrap with DndContext if column reorder is enabled\n if (onColumnsOrderChange) {\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <SortableContext\n items={sortableColumnKeys}\n strategy={horizontalListSortingStrategy}\n >\n {tableContent}\n </SortableContext>\n </DndContext>\n );\n }\n\n return tableContent;\n },\n equal\n);\n\n/**\n * `React.memo` is not generic-preserving: it takes the props type as its own\n * type argument, so annotating the call with\n * `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and\n * discarded the `<T>` the inner function declares. The exported component was\n * therefore not generic at all — every consumer got `Record<string, unknown>`,\n * `columns` and `cellRenderer` were unrelated to `data`, and a caller writing\n * `<VirtualTable<Post> …>` was told the component expects no type arguments.\n *\n * Re-asserting the call signature is the standard way to carry a type parameter\n * across `memo`; it is the only cast here, and it restores the generic the\n * implementation always had. Runtime behaviour is unchanged — this is the same\n * memoized component under a type that describes it.\n */\nexport const VirtualTable = VirtualTableInner as <T extends object>(\n props: VirtualTableProps<T>\n) => React.ReactElement | null;\n// Wrapper that applies sortable transforms to cells\nconst SortableCellWrapper = ({\n columnKey,\n width,\n isDragging,\n isDraggable,\n frozen,\n children\n}: {\n columnKey: string;\n width: number;\n isDragging: boolean;\n isDraggable: boolean;\n frozen?: boolean;\n children: React.ReactNode;\n}) => {\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition\n } = useSortable({\n id: columnKey,\n disabled: !isDraggable || frozen\n });\n\n // Remove tabIndex from attributes to avoid capturing focus before cell content\n const { tabIndex: _tabIndex, ...attrsWithoutTabIndex } = attributes;\n\n const style = {\n // Only use translate, ignore any scale transforms\n transform: transform ? `translateX(${transform.x}px)` : undefined,\n // Don't transition the dragged item - only other items should animate\n transition: isDragging ? undefined : transition,\n minWidth: width,\n maxWidth: width,\n width: width\n };\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cls(\n \"flex-shrink-0\",\n frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n {...attrsWithoutTabIndex}\n >\n {children}\n </div>\n );\n};\n\nfunction MemoizedList({\n outerRef,\n width,\n height,\n itemCount,\n onScroll,\n itemSize,\n includeAddColumn\n}: {\n outerRef: RefObject<HTMLDivElement | null>;\n width: number;\n height: number;\n itemCount: number;\n onScroll?: (params: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean;\n }) => void;\n itemSize: number;\n includeAddColumn?: boolean;\n}) {\n\n const Row = useCallback(({\n index,\n style\n }: { index: number; style: React.CSSProperties }) => {\n return <VirtualListContext.Consumer>\n {({\n onRowClick,\n data,\n columns,\n rowHeight = 54,\n headerHeight = 40,\n cellRenderer,\n hoverRow,\n rowClassName,\n endAdornment,\n draggingColumnId,\n onColumnsOrderChange,\n extraData\n }) => {\n\n if (endAdornment && index === (data ?? []).length) {\n return <div style={{\n ...style,\n height: \"auto\",\n position: \"sticky\",\n bottom: 0,\n zIndex: 1\n }}>\n {endAdornment}\n </div>;\n }\n\n const rowData = data ? data[index] : undefined;\n return (\n <VirtualTableRow\n key={`row_${index}`}\n rowData={rowData}\n rowIndex={index}\n onRowClick={onRowClick}\n columns={columns}\n hoverRow={hoverRow}\n rowClassName={rowClassName}\n style={{\n ...style,\n top: `calc(${style.top}px + ${headerHeight ?? 48}px)`\n }}\n rowHeight={rowHeight}>\n\n {columns.map((column: VirtualTableColumn, columnIndex: number) => {\n // The one place the row is read by key, and the one\n // cast for it. `T` is constrained to `object`\n // rather than `Record<string, unknown>` because an\n // `interface` — `Entity`, every consumer's row type\n // — has no implicit index signature and so does not\n // satisfy the latter. Constraining it there did not\n // make this read safe; it pushed an\n // `as unknown as Record<string, unknown>` onto every\n // caller, on the data going in AND on each callback\n // coming back out, which is four of them in\n // `SelectableTable` alone.\n const cellData = rowData && (rowData as Record<string, unknown>)[column.key];\n const isDragging = draggingColumnId === column.key;\n const isDraggable = !column.frozen && !!onColumnsOrderChange;\n\n return onColumnsOrderChange ? (\n <SortableCellWrapper\n key={`cell_wrapper_${column.key}`}\n columnKey={column.key}\n width={column.width}\n isDragging={isDragging}\n isDraggable={isDraggable}\n frozen={column.frozen}\n >\n <VirtualTableCell\n dataKey={column.key}\n // @ts-expect-error -- React.memo<VirtualTableProps<any>> erases the generic T, so cellRenderer's parameter type widens to `any` losing structural compatibility with VirtualTableCell<T>. The types are structurally correct at runtime.\n cellRenderer={cellRenderer}\n column={column}\n columns={columns}\n rowData={rowData}\n cellData={cellData}\n rowIndex={index}\n columnIndex={columnIndex}\n extraData={extraData}/>\n </SortableCellWrapper>\n ) : (\n <div\n key={`cell_wrapper_${column.key}`}\n className={cls(\n \"flex-shrink-0 relative\",\n column.frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n style={{\n minWidth: column.width,\n maxWidth: column.width,\n width: column.width\n }}\n >\n <VirtualTableCell\n dataKey={column.key}\n // @ts-expect-error -- React.memo<VirtualTableProps<any>> erases the generic T, so cellRenderer's parameter type widens to `any` losing structural compatibility with VirtualTableCell<T>. The types are structurally correct at runtime.\n cellRenderer={cellRenderer}\n column={column}\n columns={columns}\n rowData={rowData}\n cellData={cellData}\n rowIndex={index}\n columnIndex={columnIndex}\n extraData={extraData}/>\n </div>\n );\n })}\n\n {includeAddColumn && <div className={\"w-20\"}/>}\n\n </VirtualTableRow>\n );\n }}\n </VirtualListContext.Consumer>;\n }, []);\n\n return <List\n outerRef={outerRef}\n innerElementType={innerElementType}\n width={width}\n height={height}\n overscanCount={4}\n itemCount={itemCount}\n onScroll={onScroll}\n itemSize={itemSize}>\n {Row}\n </List>;\n}\n\nconst SafeLinkRenderer: React.FC<{\n text: string;\n}> = ({ text }) => {\n const urlRegex = /https?:\\/\\/[^\\s]+/g;\n const urls = text.match(urlRegex) || [];\n const parts = text.split(urlRegex);\n\n return (\n <div className={\"break-all\"}>\n {parts.map((part, i) => (\n <React.Fragment key={i}>\n {part}\n {urls[i] && (\n <>\n <a href={urls[i]} className=\"underline\" target=\"_blank\" rel=\"noopener noreferrer\">Link</a>\n <br/>\n </>\n )}\n </React.Fragment>\n ))}\n </div>\n );\n};\n","import { useSyncExternalStore, useCallback, useRef } from \"react\";\n\nexport interface SelectedCell {\n columnKey: string;\n id: string | number;\n cellRect?: DOMRect;\n width?: number;\n height?: number;\n}\n\nexport function createVirtualTableSelectionStore<T extends SelectedCell = SelectedCell>() {\n let selectedCell: T | undefined = undefined;\n const listeners = new Set<() => void>();\n\n function getEntity(): T | undefined {\n return selectedCell;\n }\n\n function subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n function select(cell: T | undefined) {\n selectedCell = cell;\n listeners.forEach(l => l());\n }\n\n return {\n getEntity,\n subscribe,\n select\n };\n}\n\nexport type VirtualTableSelectionStore<T extends SelectedCell = SelectedCell> = ReturnType<typeof createVirtualTableSelectionStore<T>>;\n\nexport function useVirtualTableCellSelected<T extends SelectedCell = SelectedCell>(\n store: VirtualTableSelectionStore<T>,\n columnKey: string,\n id: string | number\n): boolean {\n const selectorRef = useRef({ columnKey, id });\n selectorRef.current = { columnKey, id };\n\n const getEntity = useCallback(() => {\n const cell = store.getEntity();\n if (!cell) return false;\n const s = selectorRef.current;\n return cell.columnKey === s.columnKey && cell.id === s.id;\n }, [store]);\n\n return useSyncExternalStore(store.subscribe, getEntity, getEntity);\n}\n","import React, { createContext, useContext } from \"react\";\nimport { VirtualTableSelectionStore, SelectedCell } from \"./SelectionStore\";\n\nexport interface VirtualTableSelectionContextProps<T extends SelectedCell = SelectedCell> {\n selectionStore: VirtualTableSelectionStore<T>;\n select: (cell: T | undefined) => void;\n}\n\nconst SelectionContext = createContext<VirtualTableSelectionContextProps<any> | null>(null);\n\nexport const VirtualTableSelectionProvider = <T extends SelectedCell = SelectedCell>({\n store,\n children\n}: {\n store: VirtualTableSelectionStore<T>;\n children: React.ReactNode;\n}) => {\n const value = React.useMemo(() => ({\n selectionStore: store,\n select: store.select\n }), [store]);\n\n return (\n <SelectionContext.Provider value={value}>\n {children}\n </SelectionContext.Provider>\n );\n};\n\nexport const useVirtualTableSelection = <T extends SelectedCell = SelectedCell>() => {\n const context = useContext(SelectionContext);\n if (!context) {\n throw new Error(\"useVirtualTableSelection must be used within a VirtualTableSelectionProvider\");\n }\n return context as VirtualTableSelectionContextProps<T>;\n};\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { TextareaAutosize } from \"../../TextareaAutosize\";\n\nexport function VirtualTableInput(props: {\n error?: Error;\n value: string;\n multiline?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (string | null)) => void;\n onBlur?: () => void;\n}) {\n const ref = React.useRef<HTMLTextAreaElement>(null);\n const { disabled, value, multiline = false, updateValue, focused } = props;\n const prevValue = useRef<string | null>(value);\n const [internalValue, setInternalValue] = useState<typeof value>(value);\n const focusedState = useRef<boolean>(false);\n\n useEffect(() => {\n if (prevValue.current !== value && value !== internalValue)\n setInternalValue(value);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n const emptyInitialValue = !value;\n if (emptyInitialValue && !internalValue) return;\n if (internalValue !== value && internalValue !== prevValue.current) {\n prevValue.current = internalValue;\n updateValue(internalValue);\n }\n }, [internalValue, updateValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (ref.current && focused && !focusedState.current) {\n focusedState.current = true;\n ref.current.focus({ preventScroll: true });\n ref.current.selectionStart = ref.current.value.length;\n ref.current.selectionEnd = ref.current.value.length;\n } else {\n focusedState.current = focused;\n }\n }, [focused, ref]);\n\n return (\n <TextareaAutosize\n className={focusedDisabled}\n ref={ref}\n // Destructured above and passed to nothing, so a property carrying\n // `admin: { disabled: true }` stayed typeable in the table and the\n // debounced write fired on blur. `readOnly` as well as `disabled`:\n // a disabled textarea is skipped by keyboard navigation, and a cell\n // you cannot tab through is worse than one you cannot edit.\n disabled={disabled}\n readOnly={disabled}\n style={{\n padding: 0,\n margin: 0,\n width: \"100%\",\n color: \"unset\",\n fontWeight: \"unset\",\n fontSize: \"unset\",\n fontFamily: \"unset\",\n background: \"unset\",\n border: \"unset\",\n resize: \"none\",\n outline: \"none\"\n }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value as string;\n if (multiline || !newValue.endsWith(\"\\n\"))\n setInternalValue(newValue);\n }}\n onFocus={() => {\n focusedState.current = true;\n }}\n onBlur={() => {\n focusedState.current = false;\n doUpdate();\n if (props.onBlur) props.onBlur();\n }}\n />\n );\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { TextField } from \"../../TextField\";\n\nexport function VirtualTableNumberInput(props: {\n error?: Error;\n value: number;\n align?: \"right\" | \"left\" | \"center\";\n updateValue: (newValue: (number | null)) => void;\n focused: boolean;\n disabled: boolean;\n}) {\n const { align = \"left\", value, updateValue, focused } = props;\n const propStringValue = (value && typeof value === \"number\") ? value.toString() : \"\";\n const [internalValue, setInternalValue] = useState<string | null>(propStringValue);\n const prevValue = useRef<number | null>(value);\n\n useEffect(() => {\n if (prevValue.current !== value && String(value) !== internalValue)\n setInternalValue(value ? value.toString() : null);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n if (internalValue !== propStringValue) {\n if (internalValue !== undefined && internalValue !== null) {\n const numberValue = parseFloat(internalValue);\n if (isNaN(numberValue)) return;\n updateValue(numberValue);\n } else {\n updateValue(null);\n }\n }\n }, [internalValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (!focused && propStringValue !== internalValue)\n setInternalValue(value !== undefined && value !== null ? value.toString() : null);\n }, [value, focused]);\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (inputRef.current && focused) {\n inputRef.current.focus({ preventScroll: true });\n }\n }, [focused, inputRef]);\n\n const regexp = /^-?[0-9]+[,.]?[0-9]*$/;\n\n return (\n <TextField\n inputRef={inputRef}\n invisible={true}\n size=\"small\"\n className=\"w-full\"\n inputClassName={cls(\"p-0 m-0 bg-transparent border-none outline-hidden font-normal leading-normal text-unset\", focusedDisabled)}\n inputStyle={{ textAlign: align }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value.replace(\",\", \".\");\n if (newValue.length === 0) setInternalValue(null);\n if (regexp.test(newValue) || newValue.startsWith(\"-\")) setInternalValue(newValue);\n }}\n />\n );\n}\n","import React, { useEffect } from \"react\";\nimport { BooleanSwitch } from \"../../BooleanSwitch\";\n\nexport function VirtualTableSwitch(props: {\n error?: Error;\n internalValue?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (boolean | null)) => void;\n}) {\n const { internalValue, updateValue, focused } = props;\n const ref = React.useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n return (\n <BooleanSwitch\n ref={ref}\n size={\"small\"}\n value={Boolean(internalValue)}\n onValueChange={updateValue}\n />\n );\n}\n","import React from \"react\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { DateTimeField } from \"../../DateTimeField\";\n\nexport function VirtualTableDateField(props: {\n name?: string;\n error?: Error;\n mode?: \"date\" | \"date_time\";\n timezone?: string;\n internalValue: Date | undefined | null;\n updateValue: (newValue: (Date | null)) => void;\n focused: boolean;\n disabled: boolean;\n small?: boolean;\n locale?: string;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { name, disabled, error, mode, timezone, internalValue, updateValue, small = false, locale } = props;\n\n return (\n <DateTimeField\n value={internalValue ?? undefined}\n onChange={(dateValue) => updateValue(dateValue ?? null)}\n // Same omission as `VirtualTableInput`: destructured and forwarded\n // nowhere, so a disabled date cell was still editable. `error` went\n // the same way — it drives `DateTimeField`'s invalid styling, and a\n // prop a caller passes should reach something rather than sit in a\n // destructure.\n disabled={disabled}\n error={Boolean(error)}\n // Third prop this component declared and dropped. A table cell\n // draws no visible label — the column header is the only thing\n // naming it, and a header is not an accessible name for the input\n // underneath — so without this every date cell reads as an unnamed\n // \"date entry\" to a screen reader, one per row per date column.\n aria-label={name}\n invisible={true}\n // Without this the field falls back to DateTimeField's own default of\n // `size=\"large\"` (min-h-64px), which overflows a table cell and makes\n // the value collide with the cell border.\n size={small ? \"small\" : \"medium\"}\n inputClassName={cls(\"w-full h-full\", focusedDisabled)}\n className={cls(\"w-full h-full\", focusedDisabled)}\n mode={mode}\n timezone={timezone}\n locale={locale}\n />\n );\n}\n","import React, { useCallback, useEffect, useRef } from \"react\";\nimport { Select, SelectItem } from \"../../Select\";\nimport { MultiSelect, MultiSelectItem } from \"../../MultiSelect\";\nimport { Chip } from \"../../Chip\";\n\nexport interface VirtualTableSelectOption {\n value: string | number;\n label: string;\n color?: string;\n}\n\nexport function VirtualTableSelect(props: {\n options: VirtualTableSelectOption[];\n error?: Error;\n multiple?: boolean;\n disabled: boolean;\n small?: boolean;\n value: string | number | string[] | number[] | undefined;\n updateValue: (newValue: (string | number | string[] | number[] | null)) => void;\n focused: boolean;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { options, value, disabled, small = false, focused, updateValue, multiple = false } = props;\n const validValue = (Array.isArray(value) && multiple) || (!Array.isArray(value) && !multiple);\n const ref = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current?.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n const onChange = useCallback((updatedValue: string | string[]) => {\n if (multiple) {\n const isNumber = options.some(o => typeof o.value === \"number\");\n const newValue = (updatedValue as string[]).map((v) => {\n const opt = options.find(o => String(o.value) === v);\n return typeof opt?.value === \"number\" ? parseFloat(v) : v;\n });\n if (isNumber) {\n updateValue(newValue as number[]);\n } else {\n updateValue(newValue as string[]);\n }\n } else {\n const opt = options.find(o => String(o.value) === updatedValue);\n updateValue(typeof opt?.value === \"number\" ? parseFloat(updatedValue as string) : (updatedValue as string || null));\n }\n }, [multiple, updateValue, options]);\n\n const renderValue = (val?: string | number) => {\n const option = options.find(o => o.value === val);\n return (\n <Chip size={small ? \"small\" : \"medium\"}>\n {option ? option.label : String(val)}\n </Chip>\n );\n };\n\n const handleOpenChange = useCallback((open: boolean) => {\n if (!open && ref.current) {\n setTimeout(() => {\n ref.current?.focus({ preventScroll: true });\n }, 0);\n }\n }, []);\n\n return multiple ? (\n <MultiSelect\n inputRef={ref}\n className=\"w-full h-full p-0 bg-transparent outline-none\"\n position={\"item-aligned\"}\n disabled={disabled}\n includeClear={false}\n useChips={false}\n value={validValue ? (value as (string | number)[]).map(v => String(v)) : []}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n >\n {options.map((opt) => (\n <MultiSelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </MultiSelectItem>\n ))}\n </MultiSelect>\n ) : (\n <Select\n inputRef={ref}\n fullWidth\n className=\"w-full h-full p-0 bg-transparent outline-none [&_button]:ring-0 [&_button]:ring-offset-0\"\n inputClassName=\"ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-offset-0\"\n position={\"item-aligned\"}\n disabled={disabled}\n padding={false}\n value={validValue ? String(value) : \"\"}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n renderValue={renderValue}\n >\n {options.map((opt) => (\n <SelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </SelectItem>\n ))}\n </Select>\n );\n}\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n CircularProgress,\n Typography\n} from \"../components\";\nimport { cls } from \"../util\";\n\nexport type CollectionSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nexport type ListViewColumnDef<T> = {\n key: string;\n label: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string;\n renderCell: (item: T) => React.ReactNode;\n isTitle?: boolean;\n};\n\nexport type ListViewProps<T> = {\n data: T[];\n dataLoading?: boolean;\n noMoreToLoad?: boolean;\n dataLoadingError?: Error;\n itemCount?: number;\n setItemCount?: (itemCount: number) => void;\n pageSize?: number;\n paginationEnabled?: boolean;\n\n onItemClick?: (item: T) => void;\n selectedIds?: Set<string | number>;\n highlightedIds?: Set<string | number>;\n selectionEnabled?: boolean;\n onSelectionChange?: (item: T, selected: boolean) => void;\n emptyComponent?: React.ReactNode;\n\n size?: CollectionSize;\n selectedEntityId?: string | number;\n\n /**\n * Rendered above the rows, inside the list's own frame, and only when there\n * are rows to head. A column header over an empty state or a spinner labels\n * nothing.\n */\n header?: React.ReactNode;\n\n renderRow: (params: {\n item: T;\n index: number;\n style: React.CSSProperties;\n className: string;\n selected: boolean;\n highlighted: boolean;\n isLast: boolean;\n onClick: (e: React.MouseEvent) => void;\n onSelectionChange: (selected: boolean) => void;\n }) => React.ReactNode;\n};\n\nfunction getEstimatedRowHeight(size: CollectionSize): number {\n switch (size) {\n case \"xs\": return 44;\n case \"s\": return 52;\n case \"m\": return 64;\n case \"l\": return 76;\n case \"xl\": return 88;\n default: return 64;\n }\n}\n\nconst OVERSCAN_COUNT = 8;\nconst LOAD_MORE_THRESHOLD = 400;\n\nfunction getScrollParent(element: HTMLElement | null): HTMLElement | null {\n let parent = element?.parentElement ?? null;\n while (parent) {\n const style = getComputedStyle(parent);\n if (\n style.overflowY === \"auto\" || style.overflowY === \"scroll\" ||\n style.overflow === \"auto\" || style.overflow === \"scroll\"\n ) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return document.documentElement;\n}\n\nexport function ListView<T>({\n data,\n dataLoading = false,\n noMoreToLoad = false,\n dataLoadingError,\n itemCount,\n setItemCount,\n pageSize = 50,\n paginationEnabled = true,\n\n onItemClick,\n selectedIds,\n highlightedIds,\n selectionEnabled = true,\n onSelectionChange,\n emptyComponent,\n\n size = \"m\",\n selectedEntityId,\n header,\n renderRow\n}: ListViewProps<T>) {\n const containerRef = useRef<HTMLDivElement>(null);\n // The rows' own box, which a header shifts down from the container's top.\n // Virtualization measures against it rather than against the container, so\n // the window of rendered rows stays the one the viewport is actually over.\n const rowsRef = useRef<HTMLDivElement>(null);\n const isLoadingMore = useRef(false);\n\n // Reset loading gate when loading stops\n useEffect(() => {\n if (!dataLoading) isLoadingMore.current = false;\n }, [dataLoading]);\n\n // Virtualization scroll states\n const estimatedRowHeight = getEstimatedRowHeight(size);\n const [effectiveScrollTop, setEffectiveScrollTop] = useState(0);\n const [viewportHeight, setViewportHeight] = useState(800);\n\n const paginationStateRef = useRef({ paginationEnabled, noMoreToLoad, itemCount, pageSize });\n useEffect(() => {\n paginationStateRef.current = { paginationEnabled, noMoreToLoad, itemCount, pageSize };\n }, [paginationEnabled, noMoreToLoad, itemCount, pageSize]);\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n let rafId: number | null = null;\n\n const update = () => {\n rafId = null;\n const scrollRect = scrollEl.getBoundingClientRect();\n const listRect = (rowsRef.current ?? el).getBoundingClientRect();\n\n const listTopRelative = listRect.top - scrollRect.top;\n setEffectiveScrollTop(Math.max(0, -listTopRelative));\n setViewportHeight(scrollRect.height);\n\n const { paginationEnabled: pe, noMoreToLoad: nm, itemCount: ic, pageSize: ps } = paginationStateRef.current;\n if (\n pe &&\n !nm &&\n !isLoadingMore.current &&\n scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight < LOAD_MORE_THRESHOLD\n ) {\n isLoadingMore.current = true;\n setItemCount?.((ic ?? ps) + ps);\n }\n };\n\n const onScroll = () => {\n if (rafId === null) rafId = requestAnimationFrame(update);\n };\n\n scrollEl.addEventListener(\"scroll\", onScroll, { passive: true });\n const ro = new ResizeObserver(() => update());\n ro.observe(scrollEl);\n update();\n\n return () => {\n scrollEl.removeEventListener(\"scroll\", onScroll);\n ro.disconnect();\n if (rafId !== null) cancelAnimationFrame(rafId);\n };\n }, [setItemCount]);\n\n const totalHeight = data.length * estimatedRowHeight;\n const startIndex = Math.max(0, Math.floor(effectiveScrollTop / estimatedRowHeight) - OVERSCAN_COUNT);\n const endIndex = Math.min(\n data.length,\n Math.ceil((effectiveScrollTop + viewportHeight) / estimatedRowHeight) + OVERSCAN_COUNT\n );\n const visibleData = data.slice(startIndex, endIndex);\n const offsetY = startIndex * estimatedRowHeight;\n\n const footerHeight = dataLoading ? 48 : (!dataLoading && noMoreToLoad && data.length > 0) ? 32 : 0;\n\n const isInitialLoading = dataLoading && data.length === 0;\n const isEmpty = !dataLoading && data.length === 0 && !dataLoadingError;\n\n const getItemId = useCallback((item: T): string | number => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const id = (item as Record<\"id\", unknown>).id;\n return typeof id === \"number\" ? id : String(id);\n }\n return String(item);\n }, []);\n\n const borderMixinClass = \"border-hairline\";\n\n return (\n <div\n ref={containerRef}\n className={cls(\n \"w-full\",\n selectedEntityId === undefined && `rounded-lg overflow-hidden border ${borderMixinClass}`\n )}\n >\n {dataLoadingError && data.length === 0 ? (\n <div className=\"flex items-center justify-center p-8\">\n <Typography className=\"text-red-500\">\n Error loading data: {dataLoadingError.message}\n </Typography>\n </div>\n ) : isInitialLoading ? (\n <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\" />\n </div>\n ) : isEmpty ? (\n <div className=\"w-full flex items-center justify-center py-12 px-8\">\n {emptyComponent ?? (\n <Typography variant=\"label\" color=\"secondary\">\n No entries found\n </Typography>\n )}\n </div>\n ) : (\n <>\n {header}\n {/* `my-1.5`, not padding: the rows are absolutely positioned\n inside this box, and `top: 0` lands on the padding edge,\n so padding would not move them. A margin does, and it is\n what keeps the first row's rounded highlight from sitting\n on the header's rule (and the last from touching the\n bottom edge). */}\n <div ref={rowsRef} className=\"my-1.5\" style={{ height: totalHeight + footerHeight, position: \"relative\" }}>\n <div style={{ position: \"absolute\", top: offsetY, left: 0, right: 0 }}>\n {visibleData.map((item, i) => {\n const actualIndex = startIndex + i;\n const isLast = actualIndex === data.length - 1;\n const id = getItemId(item);\n const selected = selectedIds?.has(id) ?? false;\n const highlighted = highlightedIds?.has(id) ?? false;\n\n const handleClick = (e: React.MouseEvent) => {\n if ((e.metaKey || e.ctrlKey) && selectionEnabled) {\n e.preventDefault();\n onSelectionChange?.(item, !selected);\n return;\n }\n onItemClick?.(item);\n };\n\n const handleSelectionChange = (val: boolean) => {\n onSelectionChange?.(item, val);\n };\n\n return (\n <React.Fragment key={id || actualIndex}>\n {renderRow({\n item,\n index: actualIndex,\n style: { height: estimatedRowHeight, overflow: \"hidden\" },\n // No divider between rows. Rows are inset, rounded\n // highlights now (see the CMS list binding), and a\n // hairline under each one turned every highlight into\n // a pill floating on a ruled page. `py-0.5` inside the\n // fixed-height slot gives two adjacent highlights 4px\n // of air instead of a shared edge.\n className: \"py-0.5\",\n selected,\n highlighted,\n isLast,\n onClick: handleClick,\n onSelectionChange: handleSelectionChange\n })}\n </React.Fragment>\n );\n })}\n </div>\n\n {dataLoading && (\n <div\n className=\"flex items-center justify-center py-3\"\n style={{ position: \"absolute\", top: totalHeight, left: 0, right: 0 }}\n >\n <CircularProgress size=\"small\" />\n </div>\n )}\n {!dataLoading && noMoreToLoad && data.length > 0 && (\n <div\n className=\"flex items-center justify-center py-2\"\n style={{ position: \"absolute\", top: totalHeight, left: 0, right: 0 }}\n >\n <Typography variant=\"caption\" color=\"secondary\">\n All {data.length} entries loaded\n </Typography>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n );\n}\n","import React, { useCallback, useEffect, useRef } from \"react\";\nimport {\n CircularProgress,\n Typography\n} from \"../components\";\nimport { cls } from \"../util\";\n\nimport { CollectionSize } from \"./ListView\";\n\nexport type CardViewProps<T> = {\n data: T[];\n dataLoading?: boolean;\n noMoreToLoad?: boolean;\n dataLoadingError?: Error;\n itemCount?: number;\n setItemCount?: (itemCount: number) => void;\n pageSize?: number;\n paginationEnabled?: boolean;\n\n onItemClick?: (item: T) => void;\n selectedIds?: Set<string | number>;\n highlightedIds?: Set<string | number>;\n selectionEnabled?: boolean;\n onSelectionChange?: (item: T, selected: boolean) => void;\n\n onScroll?: (props: {\n scrollDirection: \"forward\" | \"backward\";\n scrollOffset: number;\n scrollUpdateWasRequested: boolean;\n }) => void;\n initialScroll?: number;\n\n size?: CollectionSize;\n renderCard: (\n item: T,\n extra: {\n selected: boolean;\n highlighted: boolean;\n onSelectionChange: (selected: boolean) => void;\n /**\n * Absent on a keyboard activation — a card is a `role=\"button\"` and\n * Enter/Space reach this with no event. Only the modifier branch\n * needs one; the click itself does not.\n */\n onClick: (e?: React.MouseEvent) => void;\n }\n ) => React.ReactNode;\n emptyComponent?: React.ReactNode;\n};\n\nfunction getGridColumnsClass(size: CollectionSize): string {\n switch (size) {\n case \"xs\":\n return \"grid-cols-4 sm:grid-cols-5 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10\";\n case \"s\":\n return \"grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8\";\n case \"m\":\n return \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6\";\n case \"l\":\n return \"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-4\";\n case \"xl\":\n return \"grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3\";\n default:\n return \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6\";\n }\n}\n\nfunction getScrollParent(element: HTMLElement | null): HTMLElement | null {\n if (!element) return null;\n let parent = element.parentElement;\n while (parent) {\n const overflowY = window.getComputedStyle(parent).overflowY;\n if (overflowY === \"auto\" || overflowY === \"scroll\") {\n return parent;\n }\n parent = parent.parentElement;\n }\n return document.documentElement;\n}\n\nexport function CardView<T>({\n data,\n dataLoading = false,\n noMoreToLoad = false,\n dataLoadingError,\n itemCount,\n setItemCount,\n pageSize = 50,\n paginationEnabled = true,\n\n onItemClick,\n selectedIds,\n highlightedIds,\n selectionEnabled = true,\n onSelectionChange,\n\n onScroll,\n initialScroll,\n size = \"m\",\n renderCard,\n emptyComponent\n}: CardViewProps<T>) {\n const containerRef = useRef<HTMLDivElement>(null);\n const hasRestoredScroll = useRef(false);\n const isLoadingMore = useRef(false);\n\n // Sync mutable ref with pagination settings to avoid resetting listeners\n const paginationStateRef = useRef({ paginationEnabled, noMoreToLoad, itemCount, pageSize });\n useEffect(() => {\n paginationStateRef.current = { paginationEnabled, noMoreToLoad, itemCount, pageSize };\n }, [paginationEnabled, noMoreToLoad, itemCount, pageSize]);\n\n useEffect(() => {\n if (!dataLoading) isLoadingMore.current = false;\n }, [dataLoading]);\n\n // Infinite scroll and resize observer\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n let rafId: number | null = null;\n\n const update = () => {\n rafId = null;\n const { paginationEnabled: pe, noMoreToLoad: nm, itemCount: ic, pageSize: ps } = paginationStateRef.current;\n if (\n pe &&\n !nm &&\n !isLoadingMore.current &&\n scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight < 400\n ) {\n isLoadingMore.current = true;\n setItemCount?.((ic ?? ps) + ps);\n }\n };\n\n const onScrollEvent = () => {\n if (rafId === null) rafId = requestAnimationFrame(update);\n };\n\n scrollEl.addEventListener(\"scroll\", onScrollEvent, { passive: true });\n const ro = new ResizeObserver(() => update());\n ro.observe(scrollEl);\n update();\n\n return () => {\n scrollEl.removeEventListener(\"scroll\", onScrollEvent);\n ro.disconnect();\n if (rafId !== null) cancelAnimationFrame(rafId);\n };\n }, [setItemCount]);\n\n // Scroll restoration\n useEffect(() => {\n if (!containerRef.current || !initialScroll || hasRestoredScroll.current || data.length === 0) return;\n\n const scrollEl = getScrollParent(containerRef.current);\n if (!scrollEl) return;\n\n let attempts = 0;\n const maxAttempts = 5;\n\n const tryRestore = () => {\n if (scrollEl.scrollHeight >= initialScroll || attempts >= maxAttempts) {\n scrollEl.scrollTop = initialScroll;\n hasRestoredScroll.current = true;\n } else {\n attempts++;\n requestAnimationFrame(tryRestore);\n }\n };\n\n requestAnimationFrame(tryRestore);\n }, [initialScroll, data.length]);\n\n // Scroll tracking: call onScroll callback\n const lastScrollOffset = useRef(0);\n useEffect(() => {\n const el = containerRef.current;\n if (!el || !onScroll) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n const handleScroll = () => {\n const currentOffset = scrollEl.scrollTop;\n const direction = currentOffset > lastScrollOffset.current ? \"forward\" : \"backward\";\n lastScrollOffset.current = currentOffset;\n onScroll({\n scrollDirection: direction,\n scrollOffset: currentOffset,\n scrollUpdateWasRequested: false\n });\n };\n\n scrollEl.addEventListener(\"scroll\", handleScroll, { passive: true });\n return () => scrollEl.removeEventListener(\"scroll\", handleScroll);\n }, [onScroll]);\n\n const getItemId = useCallback((item: T): string | number => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const id = (item as Record<\"id\", unknown>).id;\n return typeof id === \"number\" ? id : String(id);\n }\n return String(item);\n }, []);\n\n const gridColumnsClass = getGridColumnsClass(size);\n\n const isInitialLoading = dataLoading && data.length === 0 && !dataLoadingError;\n const isEmpty = !dataLoading && data.length === 0 && !dataLoadingError;\n\n return (\n <div\n ref={containerRef}\n className=\"w-full p-4\"\n >\n {dataLoadingError && data.length === 0 ? (\n <div className=\"h-full flex items-center justify-center p-8\">\n <Typography className=\"text-red-500\">\n Error loading data: {dataLoadingError.message}\n </Typography>\n </div>\n ) : isInitialLoading ? (\n <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\"/>\n </div>\n ) : isEmpty ? (\n <div className=\"w-full flex items-center justify-center py-12 px-8\">\n {emptyComponent ?? (\n <Typography variant=\"label\" color=\"secondary\">\n No entries found\n </Typography>\n )}\n </div>\n ) : (\n <div className=\"max-w-7xl mx-auto\">\n <div className={cls(\"grid gap-4\", gridColumnsClass)}>\n {data.map((item, index) => {\n const id = getItemId(item);\n const selected = selectedIds?.has(id) ?? false;\n const highlighted = highlightedIds?.has(id) ?? false;\n\n const handleClick = (e?: React.MouseEvent) => {\n if (e && (e.metaKey || e.ctrlKey) && selectionEnabled) {\n e.preventDefault();\n onSelectionChange?.(item, !selected);\n return;\n }\n onItemClick?.(item);\n };\n\n const handleSelectionChange = (val: boolean) => {\n onSelectionChange?.(item, val);\n };\n\n return (\n <React.Fragment key={id || index}>\n {renderCard(item, {\n selected,\n highlighted,\n onSelectionChange: handleSelectionChange,\n onClick: handleClick\n })}\n </React.Fragment>\n );\n })}\n </div>\n\n <div className=\"flex items-center justify-center py-8\">\n {dataLoading && (\n <CircularProgress size=\"small\"/>\n )}\n {!dataLoading && noMoreToLoad && data.length > 0 && (\n <Typography variant=\"caption\" color=\"secondary\">\n All {data.length} entries loaded\n </Typography>\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import React, { memo, useEffect, useMemo, useRef } from \"react\";\nimport { useDroppable } from \"@dnd-kit/core\";\nimport { useSortable, SortableContext, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { CircularProgress } from \"../../components\";\nimport { cls } from \"../../util\";\nimport { BoardItem, BoardItemViewProps } from \"./board_types\";\n\ninterface BoardSortableListProps<T> {\n columnId: string;\n items: BoardItem<T>[];\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n isDragging: boolean;\n isDragOverColumn: boolean;\n loading?: boolean;\n hasMore?: boolean;\n error?: Error;\n onLoadMore?: () => void;\n}\n\nexport function BoardSortableList<T>({\n columnId,\n items,\n ItemComponent,\n isDragging,\n isDragOverColumn,\n loading = false,\n hasMore = false,\n error,\n onLoadMore\n}: BoardSortableListProps<T>) {\n const {\n setNodeRef\n } = useDroppable({\n id: columnId,\n data: { type: \"ITEM-LIST\" }\n });\n\n const sentinelRef = useRef<HTMLDivElement>(null);\n const isLoadingRef = useRef(loading);\n isLoadingRef.current = loading;\n const lastLoadTimeRef = useRef(0);\n\n useEffect(() => {\n if (!sentinelRef.current || !hasMore || !onLoadMore) return;\n\n const sentinel = sentinelRef.current;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const now = Date.now();\n if (\n entries[0].isIntersecting &&\n hasMore &&\n !isLoadingRef.current &&\n now - lastLoadTimeRef.current > 500\n ) {\n lastLoadTimeRef.current = now;\n onLoadMore();\n }\n },\n { threshold: 0.1 }\n );\n\n observer.observe(sentinel);\n\n const rect = sentinel.getBoundingClientRect();\n const containerRect = sentinel.parentElement?.getBoundingClientRect();\n if (containerRect && rect.top < containerRect.bottom && rect.bottom > containerRect.top) {\n const now = Date.now();\n if (hasMore && !isLoadingRef.current && now - lastLoadTimeRef.current > 500) {\n lastLoadTimeRef.current = now;\n onLoadMore();\n }\n }\n\n return () => observer.disconnect();\n }, [hasMore, onLoadMore]);\n\n const containerClassName = useMemo(() => cls(\n // The scrollbar stays: this is the only thing on the page that scrolls\n // vertically, and hiding it left a column of cards with no sign that\n // there were more below the fold.\n \"flex flex-col p-2 transition-opacity duration-100 transition-bg ease-linear w-full overflow-y-auto flex-1 min-h-0 rounded-md\",\n isDragging && isDragOverColumn\n ? \"bg-surface-active\"\n : isDragging\n ? \"bg-surface-field hover:bg-surface-hover\"\n : \"bg-surface-field\"\n ), [isDragging, isDragOverColumn]);\n\n return (\n <div\n ref={setNodeRef}\n className={containerClassName}\n style={{ minHeight: 80 }}\n >\n <SortableContext\n items={items.map(i => i.id)}\n strategy={verticalListSortingStrategy}\n >\n {items.length === 0 && !loading ? (\n <div className=\"flex-1 flex items-center justify-center px-3 text-center\">\n {/* \"No items\" over a header counting eleven of them is\n the wrong thing to say when the read failed. */}\n <span className={cls(\n \"text-xs\",\n error\n ? \"text-red-600 dark:text-red-400\"\n : \"text-surface-400 dark:text-surface-500\"\n )}>\n {error ? \"Could not load this column\" : \"No items\"}\n </span>\n </div>\n ) : (\n <>\n {items.map((item, index) => (\n <SortableItem\n key={item.id}\n item={item}\n index={index}\n columnId={columnId}\n ItemComponent={ItemComponent}\n />\n ))}\n {(loading || hasMore) && (\n <div ref={sentinelRef} className=\"flex items-center justify-center py-2 min-h-6\">\n {loading && <CircularProgress size=\"smallest\"/>}\n </div>\n )}\n </>\n )}\n </SortableContext>\n </div>\n );\n}\n\ninterface SortableItemProps<T> {\n item: BoardItem<T>;\n index: number;\n columnId: string;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n}\n\nconst SortableItem = memo(function SortableItem<T>({\n item,\n index,\n columnId,\n ItemComponent\n}: SortableItemProps<T>) {\n const {\n setNodeRef,\n attributes,\n listeners,\n isDragging: isItemBeingDragged,\n transform,\n transition\n } = useSortable({\n id: item.id,\n data: {\n type: \"ITEM\",\n columnId\n }\n });\n\n const sortableStyle = useMemo(() => ({\n transform: CSS.Transform.toString(transform),\n transition,\n zIndex: isItemBeingDragged ? 2 : 1,\n opacity: isItemBeingDragged ? 0 : 1\n }), [transform, transition, isItemBeingDragged]);\n\n return (\n <div ref={setNodeRef} style={sortableStyle} {...attributes} {...listeners}>\n <ItemComponent\n item={item}\n isDragging={isItemBeingDragged}\n index={index}\n />\n </div>\n );\n}) as <T>(props: SortableItemProps<T>) => React.ReactElement;\n","import React, { useMemo } from \"react\";\nimport { Typography } from \"../../components\";\nimport { cls, getColorSchemeForKey } from \"../../util\";\n\nexport interface BoardColumnTitleProps {\n children: React.ReactNode;\n className?: string;\n \"aria-label\"?: string;\n color?: any;\n}\n\nexport function BoardColumnTitle({\n children,\n className,\n color,\n ...props\n}: BoardColumnTitleProps) {\n const colorScheme = useMemo(() => {\n if (!color) return undefined;\n if (typeof color === \"string\") {\n return getColorSchemeForKey(color);\n }\n return color;\n }, [color]);\n\n return (\n <Typography\n variant=\"subtitle2\"\n component=\"h4\"\n className={\n cls(\"py-3 px-3 transition-colors duration-200 flex-grow select-none relative outline-none focus:outline focus:outline-2 focus:outline-offset-2 flex items-center gap-3\",\n className)\n }\n {...props}\n >\n {colorScheme && (\n <div\n className=\"w-3 h-3 rounded-full flex-shrink-0\"\n style={{\n backgroundColor: colorScheme.darkColor ?? colorScheme.color\n }}\n />\n )}\n {children}\n </Typography>\n );\n}\n","import React, { memo, useMemo } from \"react\";\nimport { SortableContext, useSortable, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { BoardSortableList } from \"./BoardSortableList\";\nimport { BoardColumnTitle } from \"./BoardColumnTitle\";\nimport { BoardItem, BoardItemViewProps } from \"./board_types\";\nimport {\n IconButton\n} from \"../../components\";\nimport { cls } from \"../../util\";\nimport { iconSize, PlusIcon } from \"../../icons\";\n\nexport interface BoardColumnProps<T> {\n id: string;\n title: string;\n items: BoardItem<T>[];\n index: number;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n isDragging: boolean;\n isDragOverColumn: boolean;\n allowReorder?: boolean;\n loading?: boolean;\n hasMore?: boolean;\n error?: Error;\n onLoadMore?: () => void;\n onAddItem?: () => void;\n totalCount?: number;\n color?: any;\n style?: React.CSSProperties;\n}\n\nexport const BoardColumn = memo(function BoardColumn<T>({\n id,\n title,\n items,\n ItemComponent,\n isDragging,\n isDragOverColumn,\n allowReorder = false,\n loading = false,\n hasMore = false,\n error,\n onLoadMore,\n onAddItem,\n totalCount,\n color,\n style\n}: BoardColumnProps<T>) {\n const {\n setNodeRef,\n attributes,\n listeners,\n isDragging: isColumnBeingDragged,\n transform,\n transition\n } = useSortable({\n id,\n data: { type: \"COLUMN\" },\n disabled: !allowReorder\n });\n\n const combinedStyle = useMemo(() => ({\n ...style,\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isColumnBeingDragged ? 2 : 1\n }), [style, transform, transition, isColumnBeingDragged]);\n\n const dragListeners = allowReorder ? listeners : {};\n\n const columnClassName = useMemo(() => cls(\n \"border h-full w-80 min-w-80 mx-2 flex flex-col rounded-md border-hairline\",\n isColumnBeingDragged ? \"ring-2 ring-primary\" : \"\"\n ), [isColumnBeingDragged]);\n\n const headerClassName = useMemo(() => cls(\n \"flex items-center justify-between px-2 rounded-t-md transition-colors duration-200 ease-in-out\",\n isColumnBeingDragged\n ? \"bg-surface-active\"\n : \"bg-surface-field hover:bg-surface-field-hover\",\n allowReorder ? \"cursor-grab\" : \"\"\n ), [isColumnBeingDragged, allowReorder]);\n\n const itemIds = useMemo(() => items.map(i => i.id), [items]);\n\n return (\n <div\n ref={setNodeRef}\n style={combinedStyle}\n {...attributes}\n className={columnClassName}\n >\n <div\n {...dragListeners}\n className={headerClassName}\n >\n <div className=\"flex items-center gap-2\">\n <BoardColumnTitle aria-label={`${title} item list`} color={color}>\n {title}\n </BoardColumnTitle>\n {totalCount !== undefined && (\n <span className=\"text-xs text-surface-500 dark:text-surface-400\">\n {totalCount}\n </span>\n )}\n </div>\n {onAddItem && (\n <IconButton\n size=\"small\"\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n onAddItem();\n }}\n className=\"opacity-60 hover:opacity-100\"\n >\n <PlusIcon size={iconSize.small}/>\n </IconButton>\n )}\n </div>\n <SortableContext\n items={itemIds}\n strategy={verticalListSortingStrategy}\n >\n <BoardSortableList\n columnId={id}\n items={items}\n ItemComponent={ItemComponent}\n isDragging={isDragging}\n isDragOverColumn={isDragOverColumn}\n loading={loading}\n hasMore={hasMore}\n error={error}\n onLoadMore={onLoadMore}\n />\n </SortableContext>\n </div>\n );\n}) as <T>(props: BoardColumnProps<T>) => React.ReactElement;\n","import { arrayMove } from \"@dnd-kit/sortable\";\nimport { BoardItem } from \"./board_types\";\n\nexport interface PlaceDroppedCardParams<T> {\n /**\n * The destination column as it stands at the moment of the drop. When the\n * card came from another column it is normally already in here:\n * `handleDragOver` moves it while the pointer is still down, which is what\n * opens the gap under the cursor.\n */\n targetItems: BoardItem<T>[];\n /** The card being dropped. */\n movedItem: BoardItem<T>;\n /** What the pointer was over — a card id, or the column's own droppable id. */\n overId: string;\n /** Whether the card was picked up in a different column than it landed in. */\n changedColumn: boolean;\n}\n\n/**\n * Where a dropped card ends up in its destination column.\n *\n * Pulled out of the drop handler because it is the part that was wrong twice:\n * once appending a card that had been dropped into the middle of a column, and\n * once refusing to place a card at all when it was released over an empty\n * column rather than over another card. It is pure, so it can be checked\n * without driving a pointer.\n */\nexport function placeDroppedCard<T>({\n targetItems,\n movedItem,\n overId,\n changedColumn\n}: PlaceDroppedCardParams<T>): BoardItem<T>[] {\n\n const indexInTarget = targetItems.findIndex(i => i.id === movedItem.id);\n const overIndex = targetItems.findIndex(i => i.id === overId);\n\n // Not placed during the drag — drop straight into the slot. `-1` means the\n // pointer was over the column itself (an empty one, or the space below the\n // last card), which appends.\n if (indexInTarget === -1) {\n const placed = [...targetItems];\n placed.splice(overIndex === -1 ? targetItems.length : overIndex, 0, movedItem);\n return placed;\n }\n\n // Released over another card: that card's slot is the one the user chose.\n if (overIndex !== -1) {\n return arrayMove(targetItems, indexInTarget, overIndex);\n }\n\n // Released over the column rather than a card. The card is already sitting\n // in the gap the drag opened, so its position is the one on screen —\n // appending here is what used to send it to the bottom.\n if (changedColumn) {\n return targetItems;\n }\n\n // Same column, released below the last card.\n return arrayMove(targetItems, indexInTarget, targetItems.length - 1);\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n closestCorners,\n DndContext,\n DragEndEvent,\n DragOverEvent,\n DragOverlay,\n DragStartEvent,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport { arrayMove, SortableContext } from \"@dnd-kit/sortable\";\nimport { BoardColumn } from \"./BoardColumn\";\nimport { placeDroppedCard } from \"./placement\";\nimport { BoardItem, BoardItemMap, BoardProps } from \"./board_types\";\nimport { cls } from \"../../util\";\n\nexport function Board<T, COLUMN extends string>({\n data,\n columns: columnsProp,\n columnLabels,\n columnColors,\n className,\n assignColumn,\n allowColumnReorder = false,\n onColumnReorder,\n onItemsReorder,\n ItemComponent,\n columnLoadingState,\n onLoadMoreColumn,\n onAddItemToColumn,\n AddColumnComponent\n}: BoardProps<T, COLUMN>) {\n\n const [activeItem, setActiveItem] = useState<BoardItem<T> | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [dragOverColumnId, setDragOverColumnId] = useState<string | null>(null);\n\n /**\n * Which column the card was picked up from.\n *\n * `handleDragOver` moves the card between columns in `itemMapState` while\n * the pointer is still down — that is what makes the gap open up under the\n * cursor. So by the time the drop is handled, looking the card up by id\n * finds it in its *destination*, and the board was reporting the move as\n * source === target: a cross-column drop looked like a plain reorder and\n * the column property was never written. The card snapped back on the next\n * fetch.\n */\n const dragSourceColumnRef = useRef<COLUMN | null>(null);\n\n const [itemMapState, setItemMapState] = useState<BoardItemMap<T>>(() => {\n const dataColumnMap: Record<string, COLUMN> = data.reduce((prev, item: BoardItem<T>) => ({\n ...prev,\n [item.id]: assignColumn(item)\n }), {});\n return columnsProp.reduce(\n (previous: BoardItemMap<T>, column: COLUMN) => ({\n ...previous,\n [column]: data.filter((item: BoardItem<T>) => dataColumnMap[item.id] === column)\n }),\n {} as BoardItemMap<T>\n );\n });\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n })\n );\n\n useEffect(() => {\n if (isDragging) return;\n\n const dataColumnMap: Record<string, COLUMN> = data.reduce((prev, item) => ({\n ...prev,\n [item.id]: assignColumn(item)\n }), {});\n\n const newItemMap = columnsProp.reduce(\n (previous: BoardItemMap<T>, column: COLUMN) => ({\n ...previous,\n [column]: data.filter((item: BoardItem<T>) => dataColumnMap[item.id] === column)\n }),\n {} as BoardItemMap<T>\n );\n\n setItemMapState(prevMap => {\n let changed = false;\n\n for (const col of columnsProp) {\n const prevItems = prevMap[col] ?? [];\n const newItems = newItemMap[col] ?? [];\n\n if (prevItems.length !== newItems.length) {\n changed = true;\n continue;\n }\n for (let i = 0; i < prevItems.length; i++) {\n if (prevItems[i].id !== newItems[i].id || prevItems[i].data !== newItems[i].data) {\n changed = true;\n break;\n }\n }\n }\n\n if (!changed) {\n return prevMap;\n }\n\n const updated: BoardItemMap<T> = {};\n for (const col of columnsProp) {\n const prevItems = prevMap[col] ?? [];\n const newItems = newItemMap[col] ?? [];\n\n const prevById = new Map<string, BoardItem<T>>();\n for (const item of prevItems) {\n prevById.set(item.id, item);\n }\n\n updated[col] = newItems.map(newItem => {\n const prev = prevById.get(newItem.id);\n if (prev && prev.data === newItem.data) {\n return prev;\n }\n return newItem;\n });\n }\n return updated;\n });\n }, [data, columnsProp, assignColumn]);\n\n const findColumnByItemId = (id: string): string | undefined => {\n return Object.keys(itemMapState).find(col => itemMapState[col]?.some(i => i.id === id));\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n setIsDragging(true);\n setDragOverColumnId(null);\n const { active } = event;\n\n if (active.data.current?.type === \"ITEM\") {\n const columnId = findColumnByItemId(active.id as string);\n dragSourceColumnRef.current = (columnId as COLUMN | undefined) ?? null;\n if (columnId) {\n const item = itemMapState[columnId]?.find(i => i.id === active.id);\n setActiveItem(item || null);\n }\n }\n };\n\n const handleDragOver = (event: DragOverEvent) => {\n const {\n active,\n over\n } = event;\n\n if (!over) {\n setDragOverColumnId(null);\n return;\n }\n\n let currentHoveredColumnId: string | null = null;\n const overId = over.id as string;\n const overDataType = over.data.current?.type as string | undefined;\n\n if (overDataType === \"ITEM-LIST\" || overDataType === \"COLUMN\") {\n currentHoveredColumnId = overId;\n } else if (overDataType === \"ITEM\") {\n currentHoveredColumnId = findColumnByItemId(overId) || null;\n } else if (columnsProp.includes(overId as COLUMN)) {\n currentHoveredColumnId = overId;\n }\n\n setDragOverColumnId(currentHoveredColumnId);\n\n if (active.data.current?.type !== \"ITEM\") {\n return;\n }\n\n const activeId = active.id as string;\n const activeItemColumn = findColumnByItemId(activeId);\n let overColumnForMove = findColumnByItemId(overId);\n\n if (!overColumnForMove && overDataType === \"ITEM-LIST\") {\n overColumnForMove = overId;\n }\n if (!overColumnForMove && columnsProp.includes(overId as COLUMN)) {\n overColumnForMove = overId;\n }\n\n if (!activeItemColumn || !overColumnForMove) return;\n if (activeItemColumn === overColumnForMove) return;\n\n if (itemMapState[overColumnForMove]?.some(i => i.id === activeId)) {\n return;\n }\n\n setItemMapState(currentMap => {\n const activeItems = [...(currentMap[activeItemColumn] || [])];\n const overItems = [...(currentMap[overColumnForMove!] || [])];\n const activeIndex = activeItems.findIndex(i => i.id === activeId);\n\n if (activeIndex === -1) return currentMap;\n\n let overIndex;\n if (overDataType === \"ITEM-LIST\" || (columnsProp.includes(overId as COLUMN) && !findColumnByItemId(overId))) {\n overIndex = overItems.length;\n } else {\n overIndex = overItems.findIndex(i => i.id === overId);\n if (overIndex !== -1) {\n const activeTop = active.rect.current.translated?.top ?? 0;\n const activeHeight = active.rect.current.translated?.height ?? 0;\n const activeCenter = activeTop + activeHeight / 2;\n\n const overTop = over?.rect.top ?? 0;\n const overHeight = over?.rect.height ?? 0;\n const overCenter = overTop + overHeight / 2;\n\n const isBelowOverItem = activeCenter > overCenter;\n\n const modifier = isBelowOverItem ? 1 : 0;\n overIndex = overIndex >= 0 ? overIndex + modifier : overItems.length;\n } else {\n overIndex = overItems.length;\n }\n }\n\n const newItemMap = { ...currentMap };\n const [moved] = activeItems.splice(activeIndex, 1);\n overItems.splice(overIndex, 0, moved);\n newItemMap[activeItemColumn] = activeItems;\n newItemMap[overColumnForMove!] = overItems;\n return newItemMap;\n });\n };\n\n // Escape, or a drop outside the board. `handleDragOver` may already have\n // moved the card between columns, so the next `data` effect has to be\n // allowed to put it back.\n const handleDragCancel = () => {\n setIsDragging(false);\n setActiveItem(null);\n setDragOverColumnId(null);\n dragSourceColumnRef.current = null;\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n\n const sourceColumn = dragSourceColumnRef.current;\n\n setIsDragging(false);\n setActiveItem(null);\n setDragOverColumnId(null);\n dragSourceColumnRef.current = null;\n\n if (!over) return;\n\n const activeId = active.id as string;\n const overId = over.id as string;\n\n if (active.data.current?.type === \"COLUMN\") {\n if (activeId !== overId) {\n const oldIndex = columnsProp.indexOf(activeId as COLUMN);\n const newIndex = columnsProp.indexOf(overId as COLUMN);\n if (oldIndex !== -1 && newIndex !== -1) {\n const reordered = arrayMove(columnsProp, oldIndex, newIndex);\n onColumnReorder?.(reordered);\n }\n }\n return;\n }\n\n // Where the card sits right now — `handleDragOver` has already put it in\n // the column being hovered, so this is the destination, not the origin.\n const currentCol = findColumnByItemId(activeId) as COLUMN | undefined;\n let targetCol = findColumnByItemId(overId) as COLUMN | undefined;\n\n if (!targetCol) {\n const overDataType = over.data.current?.type;\n if (overDataType === \"ITEM-LIST\" || columnsProp.includes(overId as COLUMN)) {\n targetCol = overId as COLUMN;\n }\n }\n targetCol = targetCol ?? currentCol;\n\n if (!currentCol || !targetCol) return;\n\n const targetItems = itemMapState[targetCol] || [];\n const movedItem = (itemMapState[currentCol] || []).find(i => i.id === activeId);\n if (!movedItem) return;\n\n const finalTargetItems = placeDroppedCard({\n targetItems,\n movedItem,\n overId,\n changedColumn: (sourceColumn ?? currentCol) !== targetCol\n });\n\n onItemsReorder?.(finalTargetItems, {\n itemId: activeId,\n // The column the pointer went down in. `currentCol` would report a\n // cross-column move as a same-column reorder.\n sourceColumn: (sourceColumn ?? currentCol),\n targetColumn: targetCol\n });\n };\n\n return (\n <DndContext\n sensors={sensors}\n // `rectIntersection`, the default, only reports a target while the\n // dragged rect physically overlaps it, and prefers whichever\n // overlap is largest — on a board of tall columns that means a card\n // held over a gap reports nothing, and one held near a column edge\n // reports the neighbour. `closestCorners` is the sortable-list\n // recommendation and is what makes the drop land where it looks\n // like it will.\n collisionDetection={closestCorners}\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <div className={cls(\"flex flex-row h-full w-full overflow-x-auto p-4 select-none items-start\", className)}>\n <SortableContext items={columnsProp}>\n {columnsProp.map((col, index) => {\n const colItems = itemMapState[col] || [];\n const loadingState = columnLoadingState?.[col];\n return (\n <BoardColumn\n key={String(col)}\n id={String(col)}\n title={columnLabels?.[col] ?? String(col)}\n items={colItems}\n index={index}\n ItemComponent={ItemComponent}\n isDragging={isDragging}\n isDragOverColumn={dragOverColumnId === String(col)}\n allowReorder={allowColumnReorder}\n loading={loadingState?.loading}\n hasMore={loadingState?.hasMore}\n error={loadingState?.error}\n totalCount={loadingState?.totalCount}\n color={columnColors?.[col]}\n onLoadMore={onLoadMoreColumn ? () => onLoadMoreColumn(col) : undefined}\n onAddItem={onAddItemToColumn ? () => onAddItemToColumn(col) : undefined}\n />\n );\n })}\n </SortableContext>\n {AddColumnComponent}\n </div>\n\n {/* The overlay used to be positioned by hand, from `mousemove`\n listeners on `window` and a grab offset measured off whatever\n `[role='button']` the pointer went down on. dnd-kit already\n tracks the pointer and already knows the grab offset — the\n hand-rolled copy drifted from the position collision detection\n was actually using, so the card you saw and the slot you got\n were two different things. */}\n {typeof document !== \"undefined\" && createPortal(\n <DragOverlay dropAnimation={null} zIndex={9999}>\n {activeItem && (\n <ItemComponent\n item={activeItem}\n isDragging={true}\n isClone={true}\n />\n )}\n </DragOverlay>,\n document.body\n )}\n </DndContext>\n );\n}\n","import React from \"react\";\nimport { Board } from \"./Kanban/Board\";\nimport { BoardItem, BoardItemViewProps, ColumnLoadingState } from \"./Kanban/board_types\";\n\nexport type KanbanViewProps<T, COLUMN extends string> = {\n columns: COLUMN[];\n columnLabels?: Record<COLUMN, string>;\n columnColors?: Record<COLUMN, any>;\n className?: string;\n assignColumn: (item: BoardItem<T>) => COLUMN;\n allowColumnReorder?: boolean;\n onColumnReorder?: (columns: COLUMN[]) => void;\n onItemsReorder?: (\n items: BoardItem<T>[],\n moveInfo?: {\n itemId: string;\n sourceColumn: COLUMN;\n targetColumn: COLUMN;\n }\n ) => void;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n columnLoadingState?: ColumnLoadingState;\n onLoadMoreColumn?: (column: COLUMN) => void;\n onAddItemToColumn?: (column: COLUMN) => void;\n AddColumnComponent?: React.ReactNode;\n data: BoardItem<T>[];\n};\n\nexport function KanbanView<T, COLUMN extends string>(props: KanbanViewProps<T, COLUMN>) {\n return <Board {...props} />;\n}\nexport type { BoardItem, BoardItemViewProps, ColumnLoadingState };\n","\"use client\";\nimport React, { useCallback, useState } from \"react\";\nimport { LayoutList, Table2, LayoutGrid, Kanban, Settings2 } from \"lucide-react\";\nimport { iconSize } from \"../../icons/Icon\";\nimport { SearchBar } from \"../../components/SearchBar\";\nimport { Popover } from \"../../components/Popover\";\nimport { ToggleButtonGroup } from \"../../components/ToggleButtonGroup\";\nimport type { ToggleButtonOption } from \"../../components/ToggleButtonGroup\";\nimport { Typography } from \"../../components/Typography\";\nimport { Select, SelectItem } from \"../../components/Select\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { cls } from \"../../util\";\nimport type { CollectionViewMode, CollectionViewSize, KanbanPropertyOption } from \"./CollectionViewTypes\";\n\n/**\n * Props for the {@link CollectionViewToolbar} component.\n * @group Collection View\n */\nexport type CollectionViewToolbarProps = {\n viewMode: CollectionViewMode;\n onViewModeChange?: (mode: CollectionViewMode) => void;\n enabledViews?: CollectionViewMode[];\n /**\n * Custom view modes, supplying the label and icon for their switcher\n * entries. Without these an `enabledViews` key outside the four built-ins\n * has no label and no icon to draw.\n */\n customViews?: { key: string, name: string, icon?: React.ReactNode }[];\n size?: CollectionViewSize;\n onSizeChange?: (size: CollectionViewSize) => void;\n searchString?: string;\n onSearchChange?: (search?: string) => void;\n loading?: boolean;\n actionsStart?: React.ReactNode;\n actionsEnd?: React.ReactNode;\n compact?: boolean;\n kanbanPropertyOptions?: KanbanPropertyOption[];\n selectedKanbanProperty?: string;\n onKanbanPropertyChange?: (property: string) => void;\n};\n\nconst VIEW_MODE_ICONS: Record<string, React.ReactNode> = {\n list: <LayoutList size={iconSize.small} />,\n table: <Table2 size={iconSize.small} />,\n cards: <LayoutGrid size={iconSize.small} />,\n kanban: <Kanban size={iconSize.small} />,\n};\n\nconst VIEW_MODE_LABELS: Record<string, string> = {\n list: \"List\",\n table: \"Table\",\n cards: \"Cards\",\n kanban: \"Board\",\n};\n\nconst SIZE_LABELS: Record<CollectionViewSize, string> = {\n xs: \"Extra Small\",\n s: \"Small\",\n m: \"Medium\",\n l: \"Large\",\n xl: \"Extra Large\",\n};\n\n/**\n * Toolbar for the headless CollectionView.\n *\n * Renders a search bar, view mode toggle (popover with toggle button group),\n * optional size selector, optional kanban property selector, and action slots.\n *\n * @group Collection View\n */\nexport function CollectionViewToolbar({\n viewMode,\n onViewModeChange,\n enabledViews = [\"list\", \"table\", \"cards\", \"kanban\"],\n customViews,\n size = \"m\",\n onSizeChange,\n searchString,\n onSearchChange,\n loading,\n actionsStart,\n actionsEnd,\n compact,\n kanbanPropertyOptions,\n selectedKanbanProperty,\n onKanbanPropertyChange,\n}: CollectionViewToolbarProps) {\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n // A key outside the four built-ins takes its label and icon from the\n // custom view that declared it; without one it falls back to the key\n // itself and the list glyph, so an entry is never blank.\n const viewOptions: ToggleButtonOption<CollectionViewMode>[] = enabledViews.map((mode) => {\n const custom = customViews?.find((entry) => entry.key === mode);\n return {\n value: mode,\n label: VIEW_MODE_LABELS[mode] ?? custom?.name ?? mode,\n icon: VIEW_MODE_ICONS[mode] ?? custom?.icon ?? <LayoutList size={iconSize.small} />,\n };\n });\n\n const handleViewModeChange = useCallback(\n (mode: CollectionViewMode) => {\n onViewModeChange?.(mode);\n },\n [onViewModeChange]\n );\n\n const handleSizeChange = useCallback(\n (value: string) => {\n onSizeChange?.(value as CollectionViewSize);\n },\n [onSizeChange]\n );\n\n const handleKanbanPropertyChange = useCallback(\n (value: string) => {\n onKanbanPropertyChange?.(value);\n },\n [onKanbanPropertyChange]\n );\n\n const showViewToggle = onViewModeChange && enabledViews.length > 1;\n const showSizeSelector = onSizeChange && viewMode !== \"kanban\";\n const showKanbanSelector =\n kanbanPropertyOptions &&\n kanbanPropertyOptions.length > 0 &&\n viewMode === \"kanban\" &&\n onKanbanPropertyChange;\n const showPopover = showViewToggle || showSizeSelector || showKanbanSelector;\n\n return (\n <div\n className={cls(\n \"flex items-center gap-2 px-2 flex-shrink-0\",\n \"border-b border-hairline\",\n compact ? \"py-0.5 gap-1\" : \"py-1\"\n )}\n >\n {actionsStart}\n\n {onSearchChange && (\n <SearchBar\n onTextSearch={onSearchChange}\n size=\"small\"\n initialValue={searchString}\n loading={loading}\n expandable\n />\n )}\n\n <div className=\"flex-1\" />\n\n {actionsEnd}\n\n {showPopover && (\n <Popover\n open={popoverOpen}\n onOpenChange={setPopoverOpen}\n side=\"bottom\"\n align=\"end\"\n trigger={\n <IconButton\n size=\"small\"\n onClick={() => setPopoverOpen((prev) => !prev)}\n >\n <Settings2 size={iconSize.small} />\n </IconButton>\n }\n >\n <div className=\"p-3 min-w-[200px] flex flex-col gap-3\">\n {showViewToggle && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n View\n </Typography>\n <ToggleButtonGroup<CollectionViewMode>\n value={viewMode}\n onValueChange={handleViewModeChange}\n options={viewOptions}\n />\n </div>\n )}\n\n {showSizeSelector && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n Size\n </Typography>\n <Select\n value={size}\n onValueChange={handleSizeChange}\n size=\"small\"\n >\n {(Object.keys(SIZE_LABELS) as CollectionViewSize[]).map(\n (sizeKey) => (\n <SelectItem key={sizeKey} value={sizeKey}>\n {SIZE_LABELS[sizeKey]}\n </SelectItem>\n )\n )}\n </Select>\n </div>\n )}\n\n {showKanbanSelector && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n Group by\n </Typography>\n <Select\n value={selectedKanbanProperty}\n onValueChange={handleKanbanPropertyChange}\n size=\"small\"\n >\n {kanbanPropertyOptions.map((option) => (\n <SelectItem key={option.key} value={option.key}>\n {option.label}\n </SelectItem>\n ))}\n </Select>\n </div>\n )}\n </div>\n </Popover>\n )}\n </div>\n );\n}\n","import React from \"react\";\nimport { ImageIcon } from \"lucide-react\";\nimport { cls } from \"../../util\";\nimport { Typography } from \"../../components/Typography\";\nimport { Chip } from \"../../components/Chip\";\nimport { BooleanSwitch } from \"../../components/BooleanSwitch\";\nimport { Markdown } from \"../../components/Markdown\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { iconSize } from \"../../icons\";\nimport type { CellRendererProps, CollectionPropertyConfig, CollectionEnumValueConfig } from \"./CollectionViewTypes\";\n\n// ——— Helpers ———\n\n/**\n * Resolve an enum key to its display label and optional color.\n */\nfunction resolveEnumLabel(\n enumValues: CollectionPropertyConfig[\"enum\"],\n value: unknown\n): { label: string; color?: string } | undefined {\n if (!enumValues) return undefined;\n const key = String(value);\n if (enumValues instanceof Map) {\n const config: CollectionEnumValueConfig | undefined = enumValues.get(value as string | number);\n if (!config) return undefined;\n if (typeof config === \"string\") return { label: config };\n return { label: config.label, color: config.color };\n }\n const config: CollectionEnumValueConfig | undefined = enumValues[key];\n if (!config) return undefined;\n if (typeof config === \"string\") return { label: config };\n return { label: config.label, color: config.color };\n}\n\n/**\n * Format a date value using Intl.DateTimeFormat.\n */\nfunction formatDate(value: unknown, includeTime: boolean): string {\n if (value == null) return \"—\";\n const date = value instanceof Date ? value : new Date(String(value));\n if (isNaN(date.getTime())) return String(value);\n\n const options: Intl.DateTimeFormatOptions = includeTime\n ? { year: \"numeric\", month: \"short\", day: \"numeric\", hour: \"2-digit\", minute: \"2-digit\" }\n : { year: \"numeric\", month: \"short\", day: \"numeric\" };\n\n return new Intl.DateTimeFormat(undefined, options).format(date);\n}\n\n/**\n * Type guard for geopoint-like objects.\n */\nfunction isGeoPoint(value: unknown): value is { lat: number; lng: number } {\n if (typeof value !== \"object\" || value === null) return false;\n const obj = value as Record<string, unknown>;\n return typeof obj.lat === \"number\" && typeof obj.lng === \"number\";\n}\n\n// ——— Component ———\n\n/**\n * Default cell renderer for the headless CollectionView.\n * Handles all built-in property types without depending on any Rebase core types.\n *\n * @group Preview components\n */\nexport function DefaultCellRenderer({\n row,\n propertyKey,\n property,\n value,\n size,\n width,\n height\n}: CellRendererProps) {\n\n // 1. Null / undefined → em-dash\n if (value === null || value === undefined) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n // 2. Custom Preview component override\n if (property.Preview) {\n const PreviewComponent = property.Preview;\n return (\n <PreviewComponent\n row={row}\n propertyKey={propertyKey}\n property={property}\n value={value}\n size={size}\n width={width}\n height={height}\n />\n );\n }\n\n // ——— Type-specific renderers ———\n\n switch (property.type) {\n case \"string\":\n return renderString(property, value);\n\n case \"number\":\n return renderNumber(property, value);\n\n case \"boolean\":\n return renderBoolean(value);\n\n case \"date\":\n return renderDate(property, value);\n\n case \"array\":\n return renderArray(property, value);\n\n case \"map\":\n return renderMap(value);\n\n case \"reference\":\n case \"relation\":\n return renderReference(value);\n\n case \"geopoint\":\n return renderGeopoint(value);\n\n default:\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n noWrap\n className=\"px-1\">\n {JSON.stringify(value)}\n </Typography>\n );\n }\n}\n\n// ——— Per-type render functions ———\n\nfunction renderString(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const strValue = String(value);\n\n // Enum → Chip\n if (property.enum) {\n const resolved = resolveEnumLabel(property.enum, value);\n return (\n <Chip size=\"small\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? strValue}\n </Chip>\n );\n }\n\n // Preview as tag → Chip\n if (property.previewAsTag) {\n return (\n <Chip size=\"small\">\n {strValue}\n </Chip>\n );\n }\n\n // URL → clickable link\n if (property.url) {\n const href = typeof property.url === \"string\" ? property.url : strValue;\n return (\n <Typography variant=\"body2\"\n noWrap\n component=\"a\"\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cls(\n \"px-1 text-primary hover:underline cursor-pointer\"\n )}>\n {strValue}\n </Typography>\n );\n }\n\n // Email → mailto link\n if (property.email) {\n return (\n <Typography variant=\"body2\"\n noWrap\n component=\"a\"\n href={`mailto:${strValue}`}\n className={cls(\n \"px-1 text-primary hover:underline cursor-pointer\"\n )}>\n {strValue}\n </Typography>\n );\n }\n\n // Markdown → rendered markdown\n if (property.markdown) {\n return (\n <div className=\"px-1 max-h-[100px] overflow-hidden\">\n <Markdown source={strValue} size=\"small\" />\n </div>\n );\n }\n\n // Storage → image preview with fallback\n if (property.storage) {\n return (\n <div className={cls(\n \"px-1 flex items-center justify-center\",\n \"w-[40px] h-[40px] rounded overflow-hidden\"\n )}>\n {strValue ? (\n <img\n src={strValue}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n onError={(e) => {\n const target = e.currentTarget;\n target.style.display = \"none\";\n const fallback = target.nextElementSibling;\n if (fallback instanceof HTMLElement) {\n fallback.style.display = \"flex\";\n }\n }}\n />\n ) : null}\n <div className={cls(\n \"w-full h-full items-center justify-center rounded\",\n \"bg-surface-raised text-text-secondary dark:text-text-secondary-dark\",\n strValue ? \"hidden\" : \"flex\"\n )}>\n <ImageIcon size={iconSize.small} />\n </div>\n </div>\n );\n }\n\n // Default string → truncated text\n return (\n <Tooltip title={strValue.length > 50 ? strValue : undefined}\n side=\"bottom\">\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {strValue}\n </Typography>\n </Tooltip>\n );\n}\n\nfunction renderNumber(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const numStr = String(value);\n\n // Enum → Chip\n if (property.enum) {\n const resolved = resolveEnumLabel(property.enum, value);\n return (\n <Chip size=\"small\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? numStr}\n </Chip>\n );\n }\n\n // Default → right-aligned\n return (\n <Typography variant=\"body2\"\n noWrap\n align=\"right\"\n className=\"px-1 tabular-nums\">\n {numStr}\n </Typography>\n );\n}\n\nfunction renderBoolean(value: unknown): React.ReactElement {\n return (\n <div className=\"px-1 flex items-center\">\n <BooleanSwitch value={!!value}\n size=\"small\"\n disabled />\n </div>\n );\n}\n\nfunction renderDate(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const includeTime = property.mode === \"date_time\";\n const formatted = formatDate(value, includeTime);\n\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1 tabular-nums\">\n {formatted}\n </Typography>\n );\n}\n\nfunction renderArray(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n if (!Array.isArray(value)) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n // Array of enum values → row of chips\n if (property.of?.enum && value.length > 0) {\n return (\n <div className=\"px-1 flex flex-wrap gap-1 overflow-hidden\">\n {value.map((item, i) => {\n const resolved = resolveEnumLabel(property.of!.enum, item);\n return (\n <Chip key={i}\n size=\"smallest\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? String(item)}\n </Chip>\n );\n })}\n </div>\n );\n }\n\n // Array of strings → comma-separated\n if (value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {(value as string[]).join(\", \")}\n </Typography>\n );\n }\n\n // Generic array → item count\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {value.length} {value.length === 1 ? \"item\" : \"items\"}\n </Typography>\n );\n}\n\nfunction renderMap(value: unknown): React.ReactElement {\n if (typeof value !== \"object\" || value === null) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n const fieldCount = Object.keys(value as Record<string, unknown>).length;\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {fieldCount} {fieldCount === 1 ? \"field\" : \"fields\"}\n </Typography>\n );\n}\n\nfunction renderReference(value: unknown): React.ReactElement {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {String(value)}\n </Typography>\n );\n}\n\nfunction renderGeopoint(value: unknown): React.ReactElement {\n if (isGeoPoint(value)) {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1 tabular-nums\">\n {value.lat.toFixed(6)}, {value.lng.toFixed(6)}\n </Typography>\n );\n }\n\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {String(value)}\n </Typography>\n );\n}\n","/**\n * Traverse an object by dot-separated path.\n * Returns `undefined` if any segment is missing.\n */\nexport function getValueInPath(obj: Record<string, unknown> | undefined, path: string): unknown {\n if (!obj) return undefined;\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { VirtualTable } from \"../../components/VirtualTable/VirtualTable\";\nimport type { VirtualTableColumn, CellRendererParams, OnVirtualTableColumnResizeParams } from \"../../components/VirtualTable/VirtualTableProps\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n CellRendererProps,\n} from \"./CollectionViewTypes\";\n\nimport { getValueInPath } from \"./utils\";\n\nconst DEFAULT_COLUMN_WIDTHS: Record<string, number> = {\n string: 200,\n number: 140,\n date: 160,\n boolean: 120,\n array: 200,\n map: 200,\n reference: 200,\n relation: 200,\n geopoint: 180,\n};\nconst FALLBACK_COLUMN_WIDTH = 200;\n\nconst SIZE_TO_ROW_HEIGHT: Record<CollectionViewSize, number> = {\n xs: 36,\n s: 44,\n m: 52,\n l: 64,\n xl: 80,\n};\n\nconst SORTABLE_TYPES = new Set([\"string\", \"number\", \"date\"]);\n\ntype RendererSize = \"tiny\" | \"small\" | \"medium\" | \"large\";\n\nconst VIEW_SIZE_TO_RENDERER_SIZE: Record<CollectionViewSize, RendererSize> = {\n xs: \"tiny\",\n s: \"small\",\n m: \"medium\",\n l: \"large\",\n xl: \"large\",\n};\n\n/**\n * Props for the {@link CollectionTableView} component.\n * @group Collection View\n */\nexport type CollectionTableViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n displayedColumnIds?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n hoverRow?: boolean;\n className?: string;\n onColumnResize?: (params: { key: string; width: number }) => void;\n onColumnsOrderChange?: (keys: string[]) => void;\n};\n\n/**\n * Headless table view that wraps {@link VirtualTable}.\n *\n * Converts property configurations into virtual table columns and wires up\n * sorting, pagination, and cell rendering without coupling to any data layer.\n *\n * @group Collection View\n */\nexport function CollectionTableView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n displayedColumnIds,\n onRowClick,\n cellRenderer,\n size = \"m\",\n emptyComponent,\n hoverRow = true,\n className,\n onColumnResize,\n onColumnsOrderChange,\n}: CollectionTableViewProps<T>) {\n // ── Build columns ────────────────────────────────────────────────\n const columns = useMemo<VirtualTableColumn[]>(() => {\n const order = propertiesOrder ?? Object.keys(properties);\n const filteredKeys = displayedColumnIds\n ? order.filter((key) => displayedColumnIds.includes(key))\n : order.filter((key) => {\n const prop = properties[key];\n return prop && !prop.hideFromCollection;\n });\n\n return filteredKeys\n .map((key): VirtualTableColumn | null => {\n const prop = properties[key];\n if (!prop) return null;\n return {\n key,\n width: prop.columnWidth || DEFAULT_COLUMN_WIDTHS[prop.type] || FALLBACK_COLUMN_WIDTH,\n title: prop.name,\n sortable: SORTABLE_TYPES.has(prop.type),\n resizable: true,\n };\n })\n .filter((col): col is VirtualTableColumn => col !== null);\n }, [properties, propertiesOrder, displayedColumnIds]);\n\n // ── Row height ───────────────────────────────────────────────────\n const rowHeight = SIZE_TO_ROW_HEIGHT[size];\n const rendererSize = VIEW_SIZE_TO_RENDERER_SIZE[size];\n\n // ── Cell renderer ────────────────────────────────────────────────\n const tableCellRenderer = useCallback(\n (params: CellRendererParams<Record<string, unknown>>): React.ReactNode => {\n if (!params.rowData) return null;\n\n const propertyConfig = properties[params.column.key];\n if (!propertyConfig) return null;\n\n const value = getValueInPath(\n params.rowData,\n params.column.key\n );\n\n const cellProps: CellRendererProps<T> = {\n row: params.rowData as T,\n propertyKey: params.column.key,\n property: propertyConfig,\n value,\n size: rendererSize,\n width: params.width,\n };\n\n // Try custom renderer first\n if (cellRenderer) {\n const custom = cellRenderer(cellProps);\n if (custom !== undefined) {\n return (\n <div className=\"flex items-center h-full px-1 overflow-hidden\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div className=\"flex items-center h-full px-1 overflow-hidden\">\n <DefaultCellRenderer {...cellProps} />\n </div>\n );\n },\n [properties, cellRenderer, rendererSize]\n );\n\n // ── Row click ────────────────────────────────────────────────────\n const handleRowClick = useCallback(\n ({ rowData }: { rowData: Record<string, unknown> }) => {\n onRowClick?.(rowData as T);\n },\n [onRowClick]\n );\n\n // ── Pagination ──────────────────────────────────────────────────\n const handleEndReached = useCallback(() => {\n if (dataController.paginationEnabled && !dataController.noMoreToLoad) {\n const currentCount = dataController.itemCount ?? dataController.pageSize ?? 50;\n const pageSize = dataController.pageSize ?? 50;\n dataController.setItemCount?.(currentCount + pageSize);\n }\n }, [\n dataController.paginationEnabled,\n dataController.noMoreToLoad,\n dataController.itemCount,\n dataController.pageSize,\n dataController.setItemCount,\n ]);\n\n // ── Column resize ───────────────────────────────────────────────\n const handleColumnResize = useCallback(\n (params: OnVirtualTableColumnResizeParams) => {\n onColumnResize?.({ key: params.key, width: params.width });\n },\n [onColumnResize]\n );\n\n // ── Column reorder ──────────────────────────────────────────────\n const handleColumnsOrderChange = useCallback(\n (newColumns: VirtualTableColumn[]) => {\n onColumnsOrderChange?.(newColumns.map((col) => col.key));\n },\n [onColumnsOrderChange]\n );\n\n return (\n <VirtualTable\n data={dataController.data}\n columns={columns}\n cellRenderer={tableCellRenderer}\n rowHeight={rowHeight}\n sortBy={dataController.sortBy}\n onSortByUpdate={dataController.setSortBy}\n onRowClick={handleRowClick}\n onEndReached={handleEndReached}\n onColumnResize={handleColumnResize}\n onColumnsOrderChange={handleColumnsOrderChange}\n loading={dataController.loading}\n emptyComponent={emptyComponent}\n error={dataController.error}\n hoverRow={hoverRow}\n className={cls(\"h-full\", className)}\n onScroll={dataController.onScroll}\n initialScroll={dataController.initialScroll}\n />\n );\n}\n","import type { CollectionPropertyConfig } from \"./CollectionViewTypes\";\n\n/**\n * Pick the property that acts as a row's title.\n *\n * Headless mirror of the ranking in `@rebasepro/common`: identifiers are kept\n * out of the title slot structurally (the id property, images, hidden fields),\n * and among what is left a plain text field beats a description, an enum or a\n * relation. Falls back to the id property only when a collection has nothing\n * else to show.\n */\nexport function resolveTitlePropertyKey(\n order: string[],\n properties: Record<string, CollectionPropertyConfig>,\n idProperty: string,\n titleProperty?: string\n): string {\n if (titleProperty) return titleProperty;\n\n const SCORE = {\n RELATION: 10,\n LONG_TEXT: 20,\n ENUM: 30,\n EMAIL: 45,\n PLAIN_TEXT: 60,\n NAMED: 100\n };\n const titleLikeKeys = new Set([\"name\", \"fullname\", \"displayname\", \"title\", \"label\", \"heading\", \"subject\", \"username\", \"nickname\"]);\n\n let best: { key: string; score: number } | undefined;\n\n order.forEach(key => {\n const property = properties[key];\n if (!property || property.hideFromCollection) return;\n if (key === idProperty) return;\n if (property.storage || property.url === \"image\") return;\n\n let score: number;\n if (property.type === \"relation\" || property.type === \"reference\") score = SCORE.RELATION;\n else if (property.type !== \"string\") return;\n else if (property.enum) score = SCORE.ENUM;\n else if (property.multiline || property.markdown) score = SCORE.LONG_TEXT;\n else if (property.email) score = SCORE.EMAIL;\n else if (titleLikeKeys.has(key.toLowerCase().replace(/[^a-z0-9]/g, \"\"))) score = SCORE.NAMED;\n else score = SCORE.PLAIN_TEXT;\n\n if (!best || score > best.score) best = { key,\nscore };\n });\n\n return best?.key ?? idProperty;\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { CardView } from \"../CardView\";\nimport { Card } from \"../../components/Card\";\nimport { Typography } from \"../../components/Typography\";\nimport { Checkbox } from \"../../components/Checkbox\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport { cardSelectedMixin, fieldBackgroundMixin } from \"../../styles\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\n/**\n * Props for the {@link CollectionCardView} component.\n * @group Collection View\n */\nexport type CollectionCardViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n className?: string;\n};\n\n/**\n * Headless card grid view that wraps {@link CardView}.\n *\n * Renders each item as a card with an optional image, title,\n * preview properties, and selection support.\n *\n * @group Collection View\n */\nexport function CollectionCardView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n onRowClick,\n cellRenderer,\n size = \"m\",\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n className,\n}: CollectionCardViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Resolve image property ───────────────────────────────────────\n const imageProperty = useMemo(() => {\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.storage) {\n return key;\n }\n }\n return undefined;\n }, [order, properties]);\n\n // ── Preview properties (up to 3) ─────────────────────────────────\n const previewProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey || key === imageProperty) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 3) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey, imageProperty]);\n\n // ── Selection IDs ────────────────────────────────────────────────\n const selectedIds = useMemo(() => {\n if (!selectionController?.selectedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of selectionController.selectedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [selectionController?.selectedItems, idProperty]);\n\n // ── Highlighted IDs ──────────────────────────────────────────────\n const highlightedIds = useMemo(() => {\n if (!highlightedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of highlightedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [highlightedItems, idProperty]);\n\n // ── Selection handler ────────────────────────────────────────────\n const handleSelectionChange = useCallback(\n (item: T, selected: boolean) => {\n if (!selectionController) return;\n selectionController.setSelectedItems((prev) => {\n if (selected) {\n return [...prev, item];\n }\n const itemId = getValueInPath(item as Record<string, unknown>, idProperty);\n return prev.filter((existing) => {\n const existingId = getValueInPath(existing as Record<string, unknown>, idProperty);\n return existingId !== itemId;\n });\n });\n },\n [selectionController, idProperty]\n );\n\n // ── Render card ──────────────────────────────────────────────────\n const renderCard = useCallback(\n (\n item: T,\n extra: {\n selected: boolean;\n highlighted: boolean;\n onSelectionChange: (selected: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n }\n ): React.ReactNode => {\n const titleValue = getValueInPath(item as Record<string, unknown>, titlePropertyKey);\n const imageValue = imageProperty\n ? getValueInPath(item as Record<string, unknown>, imageProperty)\n : undefined;\n const hasImage = typeof imageValue === \"string\" && imageValue.length > 0;\n\n return (\n <Card\n onClick={(e) => { if (e) extra.onClick(e); }}\n className={cls(\n \"overflow-hidden relative\",\n extra.selected && cardSelectedMixin,\n extra.highlighted && !extra.selected && \"ring-1 ring-primary/50\"\n )}\n >\n {/* Image */}\n {imageProperty && (\n hasImage ? (\n <img\n src={imageValue as string}\n alt=\"\"\n className=\"w-full h-32 object-cover rounded-t-lg\"\n />\n ) : (\n <div className={cls(\"h-24 rounded-t-lg\", fieldBackgroundMixin)} />\n )\n )}\n\n {/* Selection checkbox */}\n {selectionEnabled && (\n <div\n className=\"absolute top-2 right-2\"\n onClick={(e) => e.stopPropagation()}\n >\n <Checkbox\n checked={extra.selected}\n onCheckedChange={extra.onSelectionChange}\n size=\"small\"\n />\n </div>\n )}\n\n {/* Title */}\n <Typography variant=\"subtitle2\" noWrap className=\"px-3 pt-2 pb-1\">\n {String(titleValue ?? \"\")}\n </Typography>\n\n {/* Preview properties */}\n {previewProperties.map(({ key, property }) => {\n const value = getValueInPath(item as Record<string, unknown>, key);\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item,\n propertyKey: key,\n property,\n value,\n size: \"small\",\n });\n if (custom !== undefined) {\n return (\n <div key={key} className=\"px-3 py-0.5\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div key={key} className=\"px-3 py-0.5\">\n <DefaultCellRenderer\n row={item}\n propertyKey={key}\n property={property}\n value={value}\n size=\"small\"\n />\n </div>\n );\n })}\n\n <div className=\"pb-2\" />\n </Card>\n );\n },\n [titlePropertyKey, imageProperty, previewProperties, cellRenderer, selectionEnabled]\n );\n\n return (\n <div className={cls(\"w-full h-full overflow-auto\", className)}>\n <CardView<T>\n data={dataController.data}\n dataLoading={dataController.loading}\n noMoreToLoad={dataController.noMoreToLoad}\n dataLoadingError={dataController.error}\n itemCount={dataController.itemCount}\n setItemCount={dataController.setItemCount}\n pageSize={dataController.pageSize}\n paginationEnabled={dataController.paginationEnabled}\n onItemClick={onRowClick}\n selectedIds={selectedIds}\n highlightedIds={highlightedIds}\n selectionEnabled={!!selectionEnabled}\n onSelectionChange={handleSelectionChange}\n size={size}\n renderCard={renderCard}\n emptyComponent={emptyComponent}\n />\n </div>\n );\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { ListView } from \"../ListView\";\nimport { Typography } from \"../../components/Typography\";\nimport { Checkbox } from \"../../components/Checkbox\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\n/**\n * Props for the {@link CollectionListView} component.\n * @group Collection View\n */\nexport type CollectionListViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n className?: string;\n};\n\n/**\n * Headless list view that wraps {@link ListView}.\n *\n * Each row displays a title (bold), subtitle with 1–2 secondary property values,\n * and optional selection support.\n *\n * @group Collection View\n */\nexport function CollectionListView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n onRowClick,\n cellRenderer,\n size = \"m\",\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n className,\n}: CollectionListViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Subtitle properties (up to 2) ────────────────────────────────\n const subtitleProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 2) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey]);\n\n // ── Selection IDs ────────────────────────────────────────────────\n const selectedIds = useMemo(() => {\n if (!selectionController?.selectedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of selectionController.selectedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [selectionController?.selectedItems, idProperty]);\n\n // ── Highlighted IDs ──────────────────────────────────────────────\n const highlightedIds = useMemo(() => {\n if (!highlightedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of highlightedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [highlightedItems, idProperty]);\n\n // ── Selection handler ────────────────────────────────────────────\n const handleSelectionChange = useCallback(\n (item: T, selected: boolean) => {\n if (!selectionController) return;\n selectionController.setSelectedItems((prev) => {\n if (selected) {\n return [...prev, item];\n }\n const itemId = getValueInPath(item as Record<string, unknown>, idProperty);\n return prev.filter((existing) => {\n const existingId = getValueInPath(existing as Record<string, unknown>, idProperty);\n return existingId !== itemId;\n });\n });\n },\n [selectionController, idProperty]\n );\n\n // ── Render row ───────────────────────────────────────────────────\n const renderRow = useCallback(\n (params: {\n item: T;\n index: number;\n style: React.CSSProperties;\n className: string;\n selected: boolean;\n highlighted: boolean;\n isLast: boolean;\n onClick: (e: React.MouseEvent) => void;\n onSelectionChange: (selected: boolean) => void;\n }): React.ReactNode => {\n const { item, style, className: rowClassName, selected, highlighted, onClick, onSelectionChange } = params;\n const titleValue = getValueInPath(item as Record<string, unknown>, titlePropertyKey);\n\n return (\n <div\n style={style}\n className={cls(\n \"flex items-center gap-3 px-4 cursor-pointer\",\n \"hover:bg-surface-hover\",\n \"transition-colors duration-100\",\n selected && \"bg-primary-bg\",\n highlighted && \"bg-surface-raised\",\n rowClassName\n )}\n onClick={onClick}\n >\n {/* Selection checkbox */}\n {selectionEnabled && (\n <div className=\"flex-shrink-0\" onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={selected}\n onCheckedChange={onSelectionChange}\n size=\"small\"\n />\n </div>\n )}\n\n {/* Content */}\n <div className=\"flex-1 min-w-0 py-1\">\n {/* Title */}\n <Typography variant=\"subtitle2\" noWrap>\n {String(titleValue ?? \"\")}\n </Typography>\n\n {/* Subtitle properties */}\n {subtitleProperties.length > 0 && (\n <div className=\"flex items-center gap-2\">\n {subtitleProperties.map(({ key, property }) => {\n const value = getValueInPath(item as Record<string, unknown>, key);\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item,\n propertyKey: key,\n property,\n value,\n size: \"tiny\",\n });\n if (custom !== undefined) {\n return <React.Fragment key={key}>{custom}</React.Fragment>;\n }\n }\n\n return (\n <React.Fragment key={key}>\n <DefaultCellRenderer\n row={item}\n propertyKey={key}\n property={property}\n value={value}\n size=\"tiny\"\n />\n </React.Fragment>\n );\n })}\n </div>\n )}\n </div>\n </div>\n );\n },\n [titlePropertyKey, subtitleProperties, cellRenderer, selectionEnabled]\n );\n\n return (\n <div className={cls(\"w-full h-full overflow-auto\", className)}>\n <ListView<T>\n data={dataController.data}\n dataLoading={dataController.loading}\n noMoreToLoad={dataController.noMoreToLoad}\n dataLoadingError={dataController.error}\n itemCount={dataController.itemCount}\n setItemCount={dataController.setItemCount}\n pageSize={dataController.pageSize}\n paginationEnabled={dataController.paginationEnabled}\n onItemClick={onRowClick}\n selectedIds={selectedIds}\n highlightedIds={highlightedIds}\n selectionEnabled={!!selectionEnabled}\n onSelectionChange={handleSelectionChange}\n size={size}\n renderRow={renderRow}\n emptyComponent={emptyComponent}\n />\n </div>\n );\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { KanbanView } from \"../KanbanView\";\nimport type { BoardItem, BoardItemViewProps } from \"../KanbanView\";\nimport { Card } from \"../../components/Card\";\nimport { Typography } from \"../../components/Typography\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport { cardClickableMixin, cardSelectedMixin } from \"../../styles\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionSelectionController,\n CollectionEnumValueConfig,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\nfunction getEnumLabel(enumConfig: CollectionPropertyConfig[\"enum\"], key: string): string {\n if (!enumConfig) return key;\n if (enumConfig instanceof Map) {\n const cfg: CollectionEnumValueConfig | undefined = enumConfig.get(key);\n if (!cfg) return key;\n return typeof cfg === \"string\" ? cfg : cfg.label;\n }\n const cfg: CollectionEnumValueConfig | undefined = enumConfig[key];\n if (!cfg) return key;\n return typeof cfg === \"string\" ? cfg : cfg.label;\n}\n\n/**\n * Props for the {@link CollectionKanbanView} component.\n * @group Collection View\n */\nexport type CollectionKanbanViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n kanbanProperty: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n onRowCreate?: (defaults?: Record<string, unknown>) => void;\n className?: string;\n};\n\n/**\n * Headless kanban view that wraps {@link KanbanView}.\n *\n * Groups data by a kanban property's enum values into columns.\n * Each card displays a title and 1–2 preview properties.\n *\n * @group Collection View\n */\nexport function CollectionKanbanView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n kanbanProperty,\n onRowClick,\n cellRenderer,\n emptyComponent,\n onRowCreate,\n className,\n}: CollectionKanbanViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve kanban columns ───────────────────────────────────────\n const columns = useMemo<string[]>(() => {\n const kanbanConfig = properties[kanbanProperty];\n if (kanbanConfig?.enum) {\n if (kanbanConfig.enum instanceof Map) {\n return Array.from(kanbanConfig.enum.keys()).map(String);\n }\n return Object.keys(kanbanConfig.enum);\n }\n // Deduce from data\n const seen = new Set<string>();\n for (const row of dataController.data) {\n const val = getValueInPath(row as Record<string, unknown>, kanbanProperty);\n if (val !== null && val !== undefined) {\n seen.add(String(val));\n }\n }\n return Array.from(seen);\n }, [properties, kanbanProperty, dataController.data]);\n\n // ── Column labels ────────────────────────────────────────────────\n const columnLabels = useMemo(() => {\n const kanbanConfig = properties[kanbanProperty];\n const labels: Record<string, string> = {};\n for (const col of columns) {\n labels[col] = getEnumLabel(kanbanConfig?.enum, col);\n }\n return labels;\n }, [properties, kanbanProperty, columns]);\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Preview properties (up to 2) ─────────────────────────────────\n const previewProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey || key === kanbanProperty) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 2) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey, kanbanProperty]);\n\n // ── Convert data to BoardItem<T>[] ───────────────────────────────\n const boardItems = useMemo<BoardItem<T>[]>(() => {\n return dataController.data.map((row, index) => {\n const id = getValueInPath(row as Record<string, unknown>, idProperty);\n return {\n id: id !== null && id !== undefined ? String(id) : String(index),\n data: row,\n };\n });\n }, [dataController.data, idProperty]);\n\n // ── Assign column ────────────────────────────────────────────────\n const assignColumn = useCallback(\n (item: BoardItem<T>): string => {\n const val = getValueInPath(item.data as Record<string, unknown>, kanbanProperty);\n const strVal = val !== null && val !== undefined ? String(val) : \"\";\n if (columns.includes(strVal)) return strVal;\n return columns[0] ?? \"\";\n },\n [kanbanProperty, columns]\n );\n\n // ── Item component ───────────────────────────────────────────────\n const ItemComponent = useMemo(() => {\n function KanbanCard(props: BoardItemViewProps<T>) {\n const { item } = props;\n const titleValue = getValueInPath(\n item.data as Record<string, unknown>,\n titlePropertyKey\n );\n\n return (\n <Card\n onClick={() => onRowClick?.(item.data)}\n className={cls(\n \"p-3\",\n cardClickableMixin,\n props.isDragging && cardSelectedMixin,\n props.isDragging && \"shadow-lg opacity-75\"\n )}\n >\n <Typography variant=\"subtitle2\" noWrap>\n {String(titleValue ?? \"\")}\n </Typography>\n {previewProperties.map(({ key, property }) => {\n const value = getValueInPath(\n item.data as Record<string, unknown>,\n key\n );\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item.data,\n propertyKey: key,\n property,\n value,\n size: \"tiny\",\n });\n if (custom !== undefined) {\n return (\n <div key={key} className=\"mt-1\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div key={key} className=\"mt-1\">\n <DefaultCellRenderer\n row={item.data}\n propertyKey={key}\n property={property}\n value={value}\n size=\"tiny\"\n />\n </div>\n );\n })}\n </Card>\n );\n }\n return KanbanCard;\n }, [titlePropertyKey, previewProperties, cellRenderer, onRowClick]);\n\n // ── Add item to column ───────────────────────────────────────────\n const handleAddItemToColumn = useCallback(\n (column: string) => {\n onRowCreate?.({ [kanbanProperty]: column });\n },\n [onRowCreate, kanbanProperty]\n );\n\n if (columns.length === 0 && !dataController.loading) {\n return (\n <div className=\"flex items-center justify-center p-8\">\n {emptyComponent ?? (\n <Typography variant=\"body2\" color=\"secondary\">\n No columns available for kanban view.\n </Typography>\n )}\n </div>\n );\n }\n\n return (\n <KanbanView<T, string>\n columns={columns}\n columnLabels={columnLabels as Record<string, string>}\n data={boardItems}\n assignColumn={assignColumn}\n ItemComponent={ItemComponent}\n onAddItemToColumn={onRowCreate ? handleAddItemToColumn : undefined}\n className={className}\n />\n );\n}\n","import React, { useCallback, useMemo, useState } from \"react\";\nimport { cls } from \"../../util\";\nimport { Typography } from \"../../components/Typography\";\nimport { CollectionViewToolbar } from \"./CollectionViewToolbar\";\nimport { CollectionTableView } from \"./CollectionTableView\";\nimport { CollectionCardView } from \"./CollectionCardView\";\nimport { CollectionListView } from \"./CollectionListView\";\nimport { CollectionKanbanView } from \"./CollectionKanbanView\";\nimport type {\n CollectionViewMode,\n CollectionViewSize,\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionCustomViewEntry,\n CollectionSelectionController,\n KanbanPropertyOption\n} from \"./CollectionViewTypes\";\n\n/**\n * Props for the headless {@link CollectionView} component.\n *\n * This component is data-agnostic — it renders collection data based on\n * property configurations and callbacks, with ZERO coupling to any entity\n * or data layer.\n *\n * @group Collection View\n */\nexport interface CollectionViewProps<T = Record<string, unknown>> {\n // ── Data ──────────────────────────────────────────────────────────\n\n /**\n * Data controller providing rows, loading state, pagination,\n * filter/sort/search state and setters.\n */\n dataController: CollectionDataController<T>;\n\n /**\n * Property definitions keyed by property key.\n * Drives column rendering, cell formatting, and filter UI.\n */\n properties: Record<string, CollectionPropertyConfig>;\n\n /**\n * Display order of properties. If omitted, uses Object.keys(properties).\n */\n propertiesOrder?: string[];\n\n /**\n * Subset of property keys to actually display as columns.\n * If omitted, all non-hidden properties are shown.\n */\n displayedColumnIds?: string[];\n\n // ── Identity ──────────────────────────────────────────────────────\n\n /** Property key used as row identifier. Default: \"id\" */\n idProperty?: string;\n\n /** Property key used as the display title in card/list views */\n titleProperty?: string;\n\n // ── View configuration ────────────────────────────────────────────\n\n /** Title displayed above the collection. `false` to hide. */\n title?: string | false;\n\n /** Controlled view mode. If omitted, internal state is used. */\n viewMode?: CollectionViewMode;\n\n /** Default view mode when uncontrolled. Default: \"list\" */\n defaultViewMode?: CollectionViewMode;\n\n /** Which view modes are available in the toggle */\n enabledViews?: CollectionViewMode[];\n\n /** Callback when view mode changes */\n onViewModeChange?: (mode: CollectionViewMode) => void;\n\n // ── Size ──────────────────────────────────────────────────────────\n\n /** Controlled size. If omitted, internal state is used. */\n size?: CollectionViewSize;\n\n /** Default size. Default: \"m\" */\n defaultSize?: CollectionViewSize;\n\n /** Callback when size changes */\n onSizeChange?: (size: CollectionViewSize) => void;\n\n // ── Kanban ─────────────────────────────────────────────────────────\n\n /** Property key for kanban column grouping */\n kanbanProperty?: string;\n\n /** Available kanban property options (shown in view toggle) */\n kanbanPropertyOptions?: KanbanPropertyOption[];\n\n /** Callback when kanban column property changes */\n onKanbanPropertyChange?: (property: string) => void;\n\n // ── Interactions ──────────────────────────────────────────────────\n\n /** Called when a row is clicked */\n onRowClick?: (row: T) => void;\n\n /** Called when the \"create\" button is clicked */\n onRowCreate?: (defaults?: Record<string, unknown>) => void;\n\n /** Whether creation is allowed (shows the + button) */\n canCreate?: boolean;\n\n // ── Selection ─────────────────────────────────────────────────────\n\n /** Enable row selection checkboxes */\n selectionEnabled?: boolean;\n\n /** Selection controller */\n selectionController?: CollectionSelectionController<T>;\n\n /** Highlighted items (e.g. recently clicked) */\n highlightedItems?: T[];\n\n /** Callback for bulk delete */\n onMultipleDelete?: (rows: T[]) => void;\n\n // ── Custom rendering ──────────────────────────────────────────────\n\n /**\n * Custom cell renderer override. Return undefined to use default.\n * This is how the connected wrapper injects PropertyPreview.\n */\n cellRenderer?: CellRendererOverride<T>;\n\n /** Custom empty state component */\n emptyComponent?: React.ReactNode;\n\n /**\n * Additional ways to render these rows, keyed by view mode. A key here can\n * be named by `viewMode`, `defaultViewMode` and `enabledViews`, and gets\n * its own entry in the view switcher.\n *\n * A custom view is another rendering of the *same* `dataController`, so it\n * inherits the toolbar's search, the loading state and selection. A\n * component that fetches its own data does not want to be a view mode —\n * the toolbar above it would be describing a query it does not render.\n *\n * @example\n * ```tsx\n * <CollectionView\n * customViews={{ map: { name: \"Map\", Component: MapView } }}\n * enabledViews={[\"table\", \"map\"]}\n * defaultViewMode=\"map\"\n * />\n * ```\n */\n customViews?: Record<string, CollectionCustomViewEntry<T>>;\n\n // ── Toolbar ───────────────────────────────────────────────────────\n\n /** Actions rendered at the start (left) of the toolbar */\n toolbarActionsStart?: React.ReactNode;\n\n /** Actions rendered at the end (right) of the toolbar */\n toolbarActionsEnd?: React.ReactNode;\n\n /** Hide the built-in toolbar entirely */\n hideToolbar?: boolean;\n\n // ── Table-specific ────────────────────────────────────────────────\n\n /** Enable row hover highlight in table view */\n hoverRow?: boolean;\n\n /** Callback when table columns are resized */\n onColumnResize?: (params: { key: string; width: number }) => void;\n\n /** Callback when table columns are reordered */\n onColumnsOrderChange?: (keys: string[]) => void;\n\n // ── Style ─────────────────────────────────────────────────────────\n\n /** CSS class for the outer container */\n className?: string;\n}\n\nconst DEFAULT_ENABLED_VIEWS: CollectionViewMode[] = [\"list\", \"table\", \"cards\", \"kanban\"];\n\n/**\n * A data-agnostic collection view component that orchestrates table, card,\n * list, and kanban views — driven entirely by props.\n *\n * Zero imports from any entity or data layer. This component lives in\n * `@rebasepro/ui` and can be used with any data source.\n *\n * @example\n * ```tsx\n * import { CollectionView } from \"@rebasepro/ui\";\n *\n * <CollectionView\n * dataController={{ data: myRows, loading: false, noMoreToLoad: true }}\n * properties={{\n * name: { type: \"string\", name: \"Name\" },\n * email: { type: \"string\", name: \"Email\" },\n * }}\n * title=\"Contacts\"\n * onRowClick={(row) => openDetail(row.id)}\n * />\n * ```\n *\n * @group Collection View\n */\nexport function CollectionView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n displayedColumnIds,\n idProperty = \"id\",\n titleProperty,\n title,\n viewMode: viewModeProp,\n defaultViewMode = \"list\",\n enabledViews = DEFAULT_ENABLED_VIEWS,\n onViewModeChange: onViewModeChangeProp,\n size: sizeProp,\n defaultSize = \"m\",\n onSizeChange: onSizeChangeProp,\n kanbanProperty: kanbanPropertyProp,\n kanbanPropertyOptions,\n onKanbanPropertyChange: onKanbanPropertyChangeProp,\n onRowClick,\n onRowCreate,\n canCreate = true,\n selectionEnabled,\n selectionController,\n highlightedItems,\n onMultipleDelete,\n cellRenderer,\n emptyComponent,\n customViews,\n toolbarActionsStart,\n toolbarActionsEnd,\n hideToolbar,\n hoverRow = true,\n onColumnResize,\n onColumnsOrderChange,\n className\n}: CollectionViewProps<T>) {\n\n // ── View mode state (uncontrolled with controlled override) ───────\n\n const [internalViewMode, setInternalViewMode] = useState<CollectionViewMode>(defaultViewMode);\n const viewMode = viewModeProp ?? internalViewMode;\n\n const onViewModeChange = useCallback((mode: CollectionViewMode) => {\n setInternalViewMode(mode);\n onViewModeChangeProp?.(mode);\n }, [onViewModeChangeProp]);\n\n // ── Size state (uncontrolled with controlled override) ────────────\n\n const [internalSize, setInternalSize] = useState<CollectionViewSize>(defaultSize);\n const size = sizeProp ?? internalSize;\n\n const onSizeChange = useCallback((s: CollectionViewSize) => {\n setInternalSize(s);\n onSizeChangeProp?.(s);\n }, [onSizeChangeProp]);\n\n // ── Kanban property state ─────────────────────────────────────────\n\n const [internalKanbanProperty, setInternalKanbanProperty] = useState<string | undefined>(kanbanPropertyProp);\n const kanbanProperty = kanbanPropertyProp ?? internalKanbanProperty;\n\n const onKanbanPropertyChange = useCallback((property: string) => {\n setInternalKanbanProperty(property);\n onKanbanPropertyChangeProp?.(property);\n }, [onKanbanPropertyChangeProp]);\n\n // Auto-detect kanban property if not provided\n const resolvedKanbanProperty = useMemo(() => {\n if (kanbanProperty) return kanbanProperty;\n // Find first enum property\n const order = propertiesOrder ?? Object.keys(properties);\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.enum) {\n return key;\n }\n }\n return undefined;\n }, [kanbanProperty, properties, propertiesOrder]);\n\n // Build kanban property options from properties if not provided\n const resolvedKanbanPropertyOptions = useMemo((): KanbanPropertyOption[] => {\n if (kanbanPropertyOptions) return kanbanPropertyOptions;\n const options: KanbanPropertyOption[] = [];\n const order = propertiesOrder ?? Object.keys(properties);\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.enum) {\n options.push({ key, label: prop.name });\n }\n }\n return options;\n }, [kanbanPropertyOptions, properties, propertiesOrder]);\n\n // ── Render ────────────────────────────────────────────────────────\n\n const sharedProps = {\n dataController,\n properties,\n propertiesOrder,\n idProperty,\n titleProperty,\n onRowClick,\n cellRenderer,\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n };\n\n // Resolved once so both the switcher and the render path agree. A custom\n // view keyed as a built-in is ignored rather than allowed to shadow it —\n // the switch below checks the built-ins first, so honouring such a key\n // here would put the switcher and the canvas out of step.\n const customViewEntries = useMemo(() => {\n if (!customViews) return [];\n return Object.entries(customViews)\n .filter(([key]) => !DEFAULT_ENABLED_VIEWS.includes(key))\n .map(([key, entry]) => {\n const isBare = typeof entry === \"function\";\n return {\n key,\n name: isBare ? key : (entry.name ?? key),\n icon: isBare ? undefined : entry.icon,\n Component: isBare ? entry : entry.Component\n };\n });\n }, [customViews]);\n\n function renderView() {\n const custom = customViewEntries.find((entry) => entry.key === viewMode);\n if (custom) {\n const { Component } = custom;\n return (\n <Component\n {...sharedProps}\n onRowCreate={canCreate ? onRowCreate : undefined}\n canCreate={canCreate}\n size={size}\n />\n );\n }\n\n switch (viewMode) {\n case \"table\":\n return (\n <CollectionTableView<T>\n {...sharedProps}\n displayedColumnIds={displayedColumnIds}\n size={size}\n hoverRow={hoverRow}\n onColumnResize={onColumnResize}\n onColumnsOrderChange={onColumnsOrderChange}\n />\n );\n case \"cards\":\n return (\n <CollectionCardView<T>\n {...sharedProps}\n size={size}\n />\n );\n case \"kanban\":\n return resolvedKanbanProperty ? (\n <CollectionKanbanView<T>\n {...sharedProps}\n kanbanProperty={resolvedKanbanProperty}\n // `canCreate` is documented as \"whether creation is\n // allowed (shows the + button)\" and was destructured\n // and read nowhere, so the button showed regardless.\n // The kanban view draws its add affordance exactly when\n // it has a callback, so withholding the callback is\n // what the prop means.\n onRowCreate={canCreate ? onRowCreate : undefined}\n />\n ) : (\n <div className=\"flex items-center justify-center p-8\">\n <Typography variant=\"body2\" color=\"secondary\">\n No enum property available for kanban grouping.\n </Typography>\n </div>\n );\n case \"list\":\n default:\n return (\n <CollectionListView<T>\n {...sharedProps}\n size={size}\n />\n );\n }\n }\n\n return (\n <div\n className={cls(\n \"overflow-hidden h-full w-full rounded-md flex flex-col\",\n \"bg-surface-sheet\",\n className\n )}\n >\n {/* Error banner */}\n {dataController.error && dataController.data.length > 0 && (\n <div className=\"flex items-center gap-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 border-b border-red-200 dark:border-red-800 flex-shrink-0\">\n <Typography variant=\"body2\" className=\"text-red-700 dark:text-red-300 flex-1\">\n <strong>Warning:</strong> {dataController.error.message || \"Failed to update data.\"}\n </Typography>\n </div>\n )}\n\n {/* Toolbar */}\n {!hideToolbar && (\n <CollectionViewToolbar\n viewMode={viewMode}\n onViewModeChange={enabledViews.length > 1 ? onViewModeChange : undefined}\n enabledViews={enabledViews}\n customViews={customViewEntries}\n size={size}\n onSizeChange={onSizeChange}\n searchString={dataController.searchString}\n onSearchChange={dataController.setSearchString}\n loading={dataController.loading}\n actionsStart={toolbarActionsStart}\n actionsEnd={toolbarActionsEnd}\n kanbanPropertyOptions={viewMode === \"kanban\" ? resolvedKanbanPropertyOptions : undefined}\n selectedKanbanProperty={resolvedKanbanProperty}\n onKanbanPropertyChange={onKanbanPropertyChange}\n />\n )}\n\n {/* View */}\n <div className=\"flex-1 overflow-hidden\">\n {renderView()}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAa,iBAAiB;CAC1B,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,IAAI;CACJ,OAAO;AACX;;AAGA,IAAa,qBAAqB;CAC9B,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,IAAI;CACJ,OAAO;AACX;;AAGA,IAAa,sBAAsB;CAC/B,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAA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,KAAK,CAAC;CAEvD,OAAO,oBAAC,UAAD;EACH,IAAI;EACJ,UAAU;EACV,WAAW,IACP,qDACA,OAAO,eAAe,IACtB,QACA,QACA,QAAQ;YACZ,oBAAC,OAAD;GAAK,KAAK;GACL,WAAW,IACP,OAAO,aAAa,IACpB,mBACA,SACJ;GACA;EACA,CAAA;CACC,CAAA;AAEd;AAQA,IAAa,mBAAmB,MAAM,KAAK,SAAS,iBAAiB,EAChC,UACA,SACA,aACsB;CAEvD,OACI,oBAAC,OAAD;EACI,WAAW,IAAI,0GAA0G,SAAS;EACzH;EACR;CACA,CAAA;AAEb,CAAC;;;AC5FD,IAAa,WAAW;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;AC/4DA,IAAa,eAAyB;CAClC;CAAS;CACT;CAAS;CAAmB;CAAc;CAAU;CACpD;CAAgB;CAAyB;CAAQ;CACjD;CAAY;CAAQ;CAAY;CAChC;CAAU;C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Y,cAAc,KAAA;IAC5B;IACL;GACT,CAAA;EAET;EAEA,QAAQ,UAAR;GACI,KAAK,SACD,OACI,oBAAC,qBAAD;IACI,GAAI;IACgB;IACd;IACI;IACM;IACM;GACzB,CAAA;GAET,KAAK,SACD,OACI,oBAAC,oBAAD;IACI,GAAI;IACE;GACT,CAAA;GAET,KAAK,UACD,OAAO,yBACH,oBAAC,sBAAD;IACI,GAAI;IACJ,gBAAgB;IAOhB,aAAa,YAAY,cAAc,KAAA;GAC1C,CAAA,IAED,oBAAC,OAAD;IAAK,WAAU;cACX,oBAAC,YAAD;KAAY,SAAQ;KAAQ,OAAM;eAAY;IAElC,CAAA;GACX,CAAA;GAGb,SACI,OACI,oBAAC,oBAAD;IACI,GAAI;IACE;GACT,CAAA;EAEb;CACJ;CAEA,OACI,qBAAC,OAAD;EACI,WAAW,IACP,0DACA,oBACA,SACJ;YALJ;GAQK,eAAe,SAAS,eAAe,KAAK,SAAS,KAClD,oBAAC,OAAD;IAAK,WAAU;cACX,qBAAC,YAAD;KAAY,SAAQ;KAAQ,WAAU;eAAtC;MACI,oBAAC,UAAD,EAAA,UAAQ,WAAgB,CAAA;MAAC;MAAE,eAAe,MAAM,WAAW;KACnD;;GACX,CAAA;GAIR,CAAC,eACE,oBAAC,uBAAD;IACc;IACV,kBAAkB,aAAa,SAAS,IAAI,mBAAmB,KAAA;IACjD;IACd,aAAa;IACP;IACQ;IACd,cAAc,eAAe;IAC7B,gBAAgB,eAAe;IAC/B,SAAS,eAAe;IACxB,cAAc;IACd,YAAY;IACZ,uBAAuB,aAAa,WAAW,gCAAgC,KAAA;IAC/E,wBAAwB;IACA;GAC3B,CAAA;GAIL,oBAAC,OAAD;IAAK,WAAU;cACV,WAAW;GACX,CAAA;EACJ;;AAEb"}
1
+ {"version":3,"file":"index.es.js","names":[],"sources":["../src/styles.ts","../src/util/cls.ts","../src/util/debounce.ts","../src/util/hash.ts","../src/util/chip_colors.ts","../src/hooks/PortalContainerContext.tsx","../src/hooks/useInjectStyles.tsx","../src/hooks/useOutsideAlerter.tsx","../src/hooks/useDebouncedCallback.ts","../src/hooks/useDebounceCallback.tsx","../src/hooks/useDebounceValue.tsx","../src/hooks/useIsDarkMode.ts","../src/components/Collapse.tsx","../src/components/Autocomplete.tsx","../src/icons/icon_keys.ts","../src/icons/cool_icon_keys.ts","../src/icons/Icon.tsx","../src/icons/GitHubIcon.tsx","../src/icons/HandleIcon.tsx","../src/icons/LucideIconByName.tsx","../src/components/Alert.tsx","../src/components/Avatar.tsx","../src/components/BooleanSwitch.tsx","../src/components/BooleanSwitchWithLabel.tsx","../src/components/Button.tsx","../src/components/Card.tsx","../src/components/Container.tsx","../src/components/CenteredView.tsx","../src/components/CircularProgress.tsx","../src/components/Typography.tsx","../src/components/CircularProgressCenter.tsx","../src/util/lazy_chunk.ts","../src/components/ErrorBoundary.tsx","../src/components/Checkbox.tsx","../src/components/Chip.tsx","../src/components/Tooltip.tsx","../src/components/ColorPicker.tsx","../src/components/IconButton.tsx","../src/components/InputLabel.tsx","../src/components/DateTimeField.tsx","../src/components/Dialog.tsx","../src/components/DialogActions.tsx","../src/components/DialogContent.tsx","../src/components/DialogTitle.tsx","../src/components/ExpandablePanel.tsx","../src/components/FileUpload.tsx","../src/components/FilterChip.tsx","../src/components/InfoLabel.tsx","../src/components/Label.tsx","../src/components/LoadingButton.tsx","../src/components/Markdown.tsx","../src/components/Menu.tsx","../src/components/Menubar.tsx","../src/components/Separator.tsx","../src/components/common/SelectInputLabel.tsx","../src/components/MultiSelect.tsx","../src/components/Paper.tsx","../src/components/RadioGroup.tsx","../src/components/ResizablePanels.tsx","../src/components/SearchBar.tsx","../src/components/Select.tsx","../src/components/Slider.tsx","../src/components/Sheet.tsx","../src/components/TextareaAutosize.tsx","../src/components/TextField.tsx","../src/components/Tabs.tsx","../src/components/Table.tsx","../src/components/Popover.tsx","../src/components/Badge.tsx","../src/components/DebouncedTextField.tsx","../src/components/Skeleton.tsx","../src/components/ToggleButtonGroup.tsx","../src/components/VirtualTable/VirtualTableHeader.tsx","../src/components/VirtualTable/VirtualTableHeaderRow.tsx","../src/components/VirtualTable/VirtualTableRow.tsx","../src/components/VirtualTable/VirtualTableCell.tsx","../src/components/VirtualTable/VirtualTable.tsx","../src/components/VirtualTable/selection/SelectionStore.ts","../src/components/VirtualTable/selection/SelectionContext.tsx","../src/components/VirtualTable/fields/VirtualTableInput.tsx","../src/components/VirtualTable/fields/VirtualTableNumberInput.tsx","../src/components/VirtualTable/fields/VirtualTableSwitch.tsx","../src/components/VirtualTable/fields/VirtualTableDateField.tsx","../src/components/VirtualTable/fields/VirtualTableSelect.tsx","../src/views/ListView.tsx","../src/views/CardView.tsx","../src/views/Kanban/BoardSortableList.tsx","../src/views/Kanban/BoardColumnTitle.tsx","../src/views/Kanban/BoardColumn.tsx","../src/views/Kanban/placement.ts","../src/views/Kanban/Board.tsx","../src/views/KanbanView.tsx","../src/views/CollectionView/CollectionViewToolbar.tsx","../src/views/CollectionView/DefaultCellRenderer.tsx","../src/views/CollectionView/utils.ts","../src/views/CollectionView/CollectionTableView.tsx","../src/views/CollectionView/resolveTitleProperty.ts","../src/views/CollectionView/CollectionCardView.tsx","../src/views/CollectionView/CollectionListView.tsx","../src/views/CollectionView/CollectionKanbanView.tsx","../src/views/CollectionView/CollectionView.tsx"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Control size scale — the single source of truth for how tall an inline\n// control is.\n//\n// Every control that sits on a line with another control (buttons, text\n// fields, selects, search bars, date fields, icon buttons, checkboxes) resolves\n// its height from this map, so a Button and a TextField at the same `size` are\n// pixel-identical and share a baseline. Before this existed each component\n// carried its own map and `size=\"large\"` meant 42px on a Button and 64px on a\n// TextField.\n//\n// The scale is 28/32/40/48 — the rhythm IconButton and Checkbox already used.\n// `xl`/`2xl` continue above it and are button-only.\n// ---------------------------------------------------------------------------\n\nexport type ControlSize = \"smallest\" | \"small\" | \"medium\" | \"large\";\nexport type ButtonSize = ControlSize | \"xl\" | \"2xl\";\n\nexport const CONTROL_HEIGHT = {\n smallest: 28,\n small: 32,\n medium: 40,\n large: 48,\n xl: 56,\n \"2xl\": 64\n} as const satisfies Record<ButtonSize, number>;\n\n/** Tailwind min-height class per control size. Keep in sync with CONTROL_HEIGHT. */\nexport const controlHeightMixin = {\n smallest: \"min-h-[28px]\",\n small: \"min-h-[32px]\",\n medium: \"min-h-[40px]\",\n large: \"min-h-[48px]\",\n xl: \"min-h-[56px]\",\n \"2xl\": \"min-h-[64px]\"\n} as const satisfies Record<ButtonSize, string>;\n\n/** Horizontal padding paired with each size, so gutters scale with height. */\nexport const controlPaddingMixin = {\n smallest: \"px-2\",\n small: \"px-2\",\n medium: \"px-3\",\n large: \"px-4\",\n xl: \"px-6\",\n \"2xl\": \"px-10\"\n} as const satisfies Record<ButtonSize, string>;\n\n/**\n * Suppress the focus ring on a surface that is focusable but is not a control —\n * a popover panel, a menu container, a bare cell input inside a table that\n * indicates focus by other means.\n *\n * Still expressed as `ring-0`, and that is why the default ring in\n * `index.css` overrides `--tw-ring-shadow` rather than switching to\n * `inset-ring-*`: `inset-ring` is a different variable, which this would not\n * have silenced, and every surface that had opted out would have got a ring\n * back.\n */\nexport const focusedDisabled = \"focus-visible:ring-0 focus-visible:ring-offset-0\";\nexport const focusedInvisibleMixin = \"focus:bg-surface-field-hover\";\n\n/**\n * The focus ring, drawn OUTSIDE the element, for a control that opts into it.\n *\n * The product's default ring is the `:focus-visible` rule in `index.css`, and\n * that one is drawn *inside* the border box: an outset ring is paint beyond the\n * box, and any ancestor that clips — a scroller, a truncating cell, a\n * max-height collapse — cuts it. This one is still outset because its only\n * caller is a whole field row sitting inside `p-4`/`p-6` of card padding, where\n * there is room around it and nothing clipping within 16px. Reach for it only\n * where that is true; anywhere else, let the default apply.\n *\n * Three dead declarations were removed rather than reshuffled:\n * `outline-hidden` + `outline-none` — the same instruction twice.\n * `ring-primary` + `ring-primary/50` — the first could never win.\n * `ring-opacity-50` — Tailwind v3 syntax. v4 expresses\n * opacity with the `/50` slash form, so\n * this generated nothing at all.\n *\n * What is left is the ring that was actually rendering, at 60% rather than 50%:\n * on `surface-900` the old value sat close enough to the field's own border to\n * be missed at a glance, which is the one thing a focus ring may not be.\n * `ring-offset-0` + a transparent offset stay — without them the ring draws a\n * white halo on dark surfaces.\n */\nexport const focusedClasses = \"z-30 outline-none ring-2 ring-primary/60 ring-offset-0 ring-offset-transparent\";\n\n/**\n * Field surfaces.\n *\n * A field is the one surface that goes the other way: it is INSET into\n * whatever holds it, so `surface-field` is an alpha fill rather than a solid,\n * and it composes over a card, the sheet or a dialog alike. It also carries\n * the hairline: a field is an object (DESIGN.md rule 2), and without the line\n * a 4% fill on a card reads as a soft slab rather than a control — measured on\n * the product form, eight of them in a row looked like a wall. The reference\n * draws every input with its 1px edge, on both themes.\n *\n * The 1px inset top highlight that used to sit here was the recessed-edge\n * device from before the field had a border; with a real hairline above it\n * the two stacked into a doubled top edge. The border does its work now.\n *\n * Exactly one element carries this mixin per field — the box, never the\n * input inside it — so the alpha fill and its hover composite once.\n */\nexport const fieldBackgroundMixin = \"bg-surface-field border border-hairline\";\nexport const fieldBackgroundInvisibleMixin = \"bg-transparent\";\nexport const fieldBackgroundDisabledMixin = \"bg-surface-field/60\";\n\n/**\n * `transition-colors` here, because every other interactive surface in the kit\n * has it and fields did not — `cardClickableMixin` eases, a TextField snapped.\n * On a form of eight fields that difference is the whole feel of the screen.\n */\nexport const fieldBackgroundHoverMixin = \"transition-colors duration-150 hover:bg-surface-field-hover\";\n\n/**\n * The hairline. One value per theme (`--hairline` in theme.css), and where it\n * goes matters more than what it is: a line marks an OBJECT — a card on the\n * sheet, a field, a floating surface. It does not mark a region: a tile inside\n * a card, a row, a segmented track, a button, a chip are fills, and the\n * lightness step between them is the whole separation. One exception, and it\n * is the sheet's own edge against the frame: that step is about 3 L* on both\n * themes and did not read on a real screen, so the Scaffold draws this line\n * there. Measured before this existed, the panel drew the same line on every\n * card and every tile as well, and with only two surface values available the\n * line was doing the work a step should have done.\n */\nexport const defaultBorderMixin = \"border-hairline\";\n\n// ---------------------------------------------------------------------------\n// Surfaces are named by ROLE (see theme.css) and the theme decides the value.\n// Every nested surface is one step lifted from the surface it sits on, on both\n// themes. The rules are in packages/ui/DESIGN.md (Surfaces); the measurements\n// behind the ladder are in docs/design/instatic-distilled.html.\n//\n// Two kinds of card, and the difference is what the border is for.\n//\n// A **floating** surface — a menu, a dialog, a popover — sits OVER the page. It\n// has to be legible against whatever happens to be underneath it, so its edge\n// is definite: `hairline-strong`. That is `paperMixin`.\n//\n// A **page** surface — a card in the document flow — sits ON the sheet, and it\n// is already one step lighter than the sheet. It keeps a plain hairline, which\n// is all a card on the sheet needs; once the step is there the line is close\n// to optional, and a stronger one reads as a box drawn around content.\n// ---------------------------------------------------------------------------\nexport const paperMixin = \"bg-surface-card rounded-lg border border-hairline-strong\";\nexport const cardMixin = \"bg-surface-card rounded-xl border border-hairline\";\n\n/**\n * An inset well: code, a query, a log tail, a connection string.\n *\n * It must read as *recessed into* the surface holding it, which means darker\n * than that surface in dark mode. Cards now sit at `surface-card` (#181818),\n * so #0a0a0a is already fourteen units below and reads as a well; #000 was\n * tuned for the old #0a card and is now harsher than it needs to be. That value\n * is the `surface-well` role (theme.css), the one surface that goes DOWN the\n * ladder on purpose. Pair with `font-mono`; this mixin carries the surface\n * only.\n */\nexport const codeSurfaceMixin = \"bg-surface-well rounded-md\";\n\n/**\n * The accent, used as TEXT.\n *\n * `--color-primary` (#0070F4) is tuned to be a fill — white text on it, it on\n * white. Read as text on our dark surfaces it lands at **4.36:1 on a\n * `surface-900` card** (measured), which is below AA for body-sized text, and\n * every accent link in the product sits on exactly that surface. On the page's\n * `surface-950` it only reaches 4.62:1, so the margin was never real.\n *\n * `--color-primary-light` is the same hue lifted 0.15 in OKLCH lightness and\n * measures **7.34:1** on the same card. It is indistinguishable as \"the blue\"\n * and comfortably legible, so dark mode swaps to it for text.\n *\n * Use this for links, accent labels and any accent-coloured type. It is NOT for\n * fills — a filled button keeps `bg-primary`, where the contrast question runs\n * the other way and #0070F4 is already correct.\n */\nexport const accentTextMixin = \"text-primary dark:text-primary-light\";\n\n/**\n * Hover on a SOLID surface goes one step lighter, and it stays neutral. The\n * previous `hover:bg-primary/5` tinted every clickable card blue, which spent\n * the brand colour on a state that carries no meaning; on the dark ladder it\n * also read as a hue shift rather than a lift.\n */\nexport const cardClickableMixin = \"hover:bg-surface-card-hover cursor-pointer transition-colors duration-150\";\nexport const cardSelectedMixin = \"bg-primary-bg/30 dark:bg-primary-bg/10 ring-1 ring-primary/75\";\n\n/**\n * Hover on a TRANSPARENT ground — a nav item, a menu item, a list row, a tree\n * row. `surface-hover` is an alpha fill, so it lifts whatever it lands on by\n * the same amount, and `surface-active` is the same idea one step further for\n * the selected row when no hue is wanted. Do not use these on a solid card:\n * an alpha fill REPLACES a solid background rather than tinting it.\n */\nexport const surfaceHoverMixin = \"hover:bg-surface-hover transition-colors duration-150\";\nexport const surfaceActiveMixin = \"bg-surface-active\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cls(...classes: ClassValue[]) {\n return twMerge(clsx(classes));\n}\n\n\n","/**\n * @ignore\n */\n\nexport function debounce<T extends (...args: any[]) => unknown>(func: T, wait = 166) {\n let timeout: ReturnType<typeof setTimeout>;\n\n function debounced(this: unknown, ...args: Parameters<T>) {\n const later = () => {\n func.apply(this, args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n }\n\n debounced.clear = () => {\n clearTimeout(timeout);\n };\n\n return debounced as T & Cancelable;\n}\n\n/**\n * @ignore\n */\nexport interface Cancelable {\n clear(): void;\n}\n","export function hashString(str: string): number {\n let hash = 0;\n let i;\n let chr;\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return Math.abs(hash);\n}\n","import { hashString } from \"./hash\";\n\nexport type ChipColorScheme = {\n color: string;\n text: string;\n /** Background color override for dark mode */\n darkColor?: string;\n /** Text color override for dark mode */\n darkText?: string;\n /**\n * Ink for the `outlined` variant, which has no fill of its own.\n *\n * `text`/`darkText` are the ink ON the chip's own background. An outlined\n * chip drops that background and sits on the PAGE, so the same value is\n * being asked to be legible against two different surfaces at once — and\n * for most hues it cannot be. Splitting the roles is what lets the filled\n * ink follow its fill (often dark ink on a bright chip) without dragging\n * the outlined variant down with it.\n */\n outlineText?: string;\n /** Outlined-variant ink in dark mode. */\n darkOutlineText?: string;\n /**\n * The `tinted` variant: the hue's solid stop at low alpha, as an `rgba()`\n * string so it composes over a card, the sheet or a dialog alike, and an\n * ink MEASURED on what that tint reads as over the page. A tint is the\n * reference's rule for hue in the chrome — a 12–16% wash behind hue-coloured\n * text — and it is what a status or enum chip paints by default now; the\n * saturated `color` stop is the `filled` variant, kept for swatches.\n */\n tintColor?: string;\n tintText?: string;\n darkTintColor?: string;\n darkTintText?: string;\n}\n\n/* ────────────────────────────────────────────────────────────────────────────\n Contrast\n ────────────────────────────────────────────────────────────────────────────\n\n Chip ink is DERIVED, not hand-picked. It used to be written down per tone —\n `\"#fff\"` on every `solid` background, the hue's `pale` on every `deep` one —\n and an audit of all 120 hue/tone/mode pairs found **63 of them below WCAG AA**.\n The worst was white on `teal.solid` at **1.76:1**, which is not a near miss;\n it is unreadable. The palette is an Airtable-style one whose mid stops are\n bright enough to need dark ink, and hardcoding light ink ignored that.\n\n So the ink is measured against the background it will actually sit on, and\n pushed toward black or white only as far as it must go to clear the floor.\n Starting from the hue's own dark/light tints rather than from flat `#000`\n and `#fff` keeps the family looking like a family: `blue.solid` gets a very\n dark navy, not black.\n\n Deriving it also means a new hue cannot be added below AA — there is no\n per-tone ink to forget to check. */\n\n/** WCAG floor, plus a little margin so rounding cannot drop a pair below 4.5. */\nconst CONTRAST_TARGET = 4.6;\n\n/** Page backgrounds the outlined variant sits on: `bg-white` and `surface-950`. */\nconst PAGE_LIGHT = \"#ffffff\";\nconst PAGE_DARK = \"#181818\";\n\nfunction toRgb(hex: string): [number, number, number] {\n let h = hex.replace(\"#\", \"\");\n if (h.length === 3) h = h.split(\"\").map(c => c + c).join(\"\");\n return [0, 2, 4].map(i => parseInt(h.slice(i, i + 2), 16)) as [number, number, number];\n}\n\nfunction toHex(rgb: number[]): string {\n return \"#\" + rgb.map(v => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction toRgba(hex: string, alpha: number): string {\n const [r, g, b] = toRgb(hex);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n\n/**\n * What a translucent colour reads as over an opaque one: a per-channel sRGB\n * mix, which is how the browser composites it. The tint ink is pushed against\n * this, never against the page alone — a 16% wash of the hue moves the\n * background a long way toward the ink, and an ink that only cleared AA on\n * the bare page lands near 3.5:1 on its own tint.\n */\nexport function compositeOver(fgHex: string, alpha: number, bgHex: string): string {\n const fg = toRgb(fgHex);\n const bg = toRgb(bgHex);\n return toHex(fg.map((c, i) => alpha * c + (1 - alpha) * bg[i]));\n}\n\n/** Read an `rgba(r, g, b, a)` string back as what it composites to over `bgHex`. */\nexport function tintOnPage(rgba: string, bgHex: string): string {\n const m = rgba.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);\n if (!m) return rgba;\n const fg = toHex([Number(m[1]), Number(m[2]), Number(m[3])]);\n return compositeOver(fg, m[4] === undefined ? 1 : Number(m[4]), bgHex);\n}\n\n/**\n * Tint alpha by tone, light then dark. The tones keep meaning something in the\n * tinted variant — a `Darker` chip is a heavier wash, not a different hue —\n * and dark mode runs four points higher because the same alpha of a bright\n * hue reads fainter over near-black than over white.\n */\nconst TINT_ALPHA: Record<ChipTone, [light: number, dark: number]> = {\n Lighter: [0.10, 0.14],\n Light: [0.14, 0.18],\n Dark: [0.18, 0.22],\n Darker: [0.22, 0.26]\n};\n\nfunction relativeLuminance(hex: string): number {\n const [r, g, b] = toRgb(hex).map(v => {\n const c = v / 255;\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\nexport function contrastRatio(a: string, b: string): number {\n const x = relativeLuminance(a);\n const y = relativeLuminance(b);\n const [hi, lo] = x > y ? [x, y] : [y, x];\n return (hi + 0.05) / (lo + 0.05);\n}\n\nfunction mixHex(from: string, to: string, t: number): string {\n const A = toRgb(from);\n const B = toRgb(to);\n return toHex([0, 1, 2].map(i => A[i] + (B[i] - A[i]) * t));\n}\n\n/**\n * Walk a tinted ink toward black or white until it clears the floor on `bg`.\n *\n * Stops at the first passing step rather than going all the way, so the ink\n * keeps as much of its hue as legibility allows.\n */\nfunction push(base: string, toward: string, bg: string): string {\n for (let t = 0; t <= 1.0001; t += 0.02) {\n const candidate = mixHex(base, toward, t);\n if (contrastRatio(candidate, bg) >= CONTRAST_TARGET) return candidate;\n }\n return toward;\n}\n\n/** The ink for a chip filled with `bg`: whichever direction has more headroom. */\nfunction inkOn(stops: HueStops, bg: string): string {\n const dark = push(stops.text, \"#000000\", bg);\n const light = push(stops.onDeep ?? stops.pale, \"#ffffff\", bg);\n return contrastRatio(dark, bg) >= contrastRatio(light, bg) ? dark : light;\n}\n\n/**\n * The hues a chip can take, and the four stops each one is built from.\n *\n * `pale` and `mid` are backgrounds for dark text; `solid` and `deep` are\n * backgrounds for light text. `text` is the dark ink used on the two pale\n * stops, and `onDeep` the light ink on `deep` — it defaults to `pale`, and is\n * only set where a hue needs a tint of its own to stay legible.\n */\ntype HueStops = {\n pale: string;\n mid: string;\n solid: string;\n deep: string;\n text: string;\n onDeep?: string;\n}\n\nexport const CHIP_HUES = [\n \"blue\", \"cyan\", \"teal\", \"green\", \"yellow\", \"orange\", \"red\", \"pink\", \"purple\", \"gray\",\n \"indigo\", \"violet\", \"fuchsia\", \"rose\", \"emerald\"\n] as const;\n\nexport type ChipHue = typeof CHIP_HUES[number];\n\n/**\n * How light or saturated a chip of a given hue is.\n *\n * A hue on its own (`\"blue\"`) means `Lighter` — the tone the picker offers and\n * the one seeded chips used to be limited to.\n */\nexport type ChipTone = \"Lighter\" | \"Light\" | \"Dark\" | \"Darker\";\n\nexport type ChipColorKey = ChipHue | `${ChipHue}${ChipTone}`;\n\nconst HUE_STOPS: Record<ChipHue, HueStops> = {\n blue: { pale: \"#cfdfff\", mid: \"#9cc7ff\", solid: \"#2d7ff9\", deep: \"#2750ae\", text: \"#102046\" },\n cyan: { pale: \"#d0f0fd\", mid: \"#77d1f3\", solid: \"#18bfff\", deep: \"#0b76b7\", text: \"#04283f\" },\n teal: { pale: \"#c2f5e9\", mid: \"#72ddc3\", solid: \"#20d9d2\", deep: \"#06a09b\", text: \"#012524\", onDeep: \"#daf3e9\" },\n green: { pale: \"#d1f7c4\", mid: \"#93e088\", solid: \"#20c933\", deep: \"#338a17\", text: \"#0b1d05\" },\n yellow: { pale: \"#ffeab6\", mid: \"#ffd66e\", solid: \"#fcb400\", deep: \"#b87503\", text: \"#3b2501\" },\n orange: { pale: \"#fee2d5\", mid: \"#ffa981\", solid: \"#ff6f2c\", deep: \"#d74d26\", text: \"#6b2613\" },\n red: { pale: \"#ffdce5\", mid: \"#ff9eb7\", solid: \"#f82b60\", deep: \"#ba1e45\", text: \"#4c0c1c\" },\n pink: { pale: \"#ffdaf6\", mid: \"#f99de2\", solid: \"#ff08c2\", deep: \"#b2158b\", text: \"#400832\" },\n purple: { pale: \"#ede2fe\", mid: \"#cdb0ff\", solid: \"#8b46ff\", deep: \"#6b1cb0\", text: \"#280b42\" },\n gray: { pale: \"#eeeeee\", mid: \"#cccccc\", solid: \"#666666\", deep: \"#444444\", text: \"#040404\" },\n indigo: { pale: \"#e0e7ff\", mid: \"#a5b4fc\", solid: \"#6366f1\", deep: \"#4f46e5\", text: \"#312e81\" },\n violet: { pale: \"#ede9fe\", mid: \"#c4b5fd\", solid: \"#8b5cf6\", deep: \"#7c3aed\", text: \"#4c1d95\" },\n fuchsia: { pale: \"#fae8ff\", mid: \"#f0abfc\", solid: \"#d946ef\", deep: \"#c026d3\", text: \"#701a75\" },\n rose: { pale: \"#ffe4e6\", mid: \"#fda4af\", solid: \"#f43f5e\", deep: \"#e11d48\", text: \"#881337\" },\n emerald: { pale: \"#d1fae5\", mid: \"#6ee7b7\", solid: \"#10b981\", deep: \"#059669\", text: \"#064e3b\" }\n};\n\n/**\n * One tone of one hue.\n *\n * Backgrounds are the palette's, unchanged — the stops were not the problem and\n * moving them would have restyled every chip in the product. Only the ink moved,\n * and it moved to wherever the measurement says it has to be.\n */\nfunction tone(stops: HueStops, chipTone: ChipTone): ChipColorScheme {\n // The outlined variant is a property of the HUE, not of the tone: it has no\n // fill, so every tone of a hue sits on the same page background and wants\n // the same ink.\n const outline = {\n outlineText: push(stops.text, \"#000000\", PAGE_LIGHT),\n darkOutlineText: push(stops.onDeep ?? stops.pale, \"#ffffff\", PAGE_DARK)\n };\n\n // The tint is the SOLID stop washed out, on both themes, so a hue keeps\n // its identity across the two — a pale-stop tint of blue reads as grey.\n // Light ink starts from `deep` and dark ink from `mid`: the saturated end\n // that already sits on the right side of the composite, pushed only as\n // far as the measurement says.\n const [alphaLight, alphaDark] = TINT_ALPHA[chipTone];\n const tint = {\n tintColor: toRgba(stops.solid, alphaLight),\n tintText: push(stops.deep, \"#000000\", compositeOver(stops.solid, alphaLight, PAGE_LIGHT)),\n darkTintColor: toRgba(stops.solid, alphaDark),\n darkTintText: push(stops.mid, \"#ffffff\", compositeOver(stops.solid, alphaDark, PAGE_DARK))\n };\n\n const filled = (light: string, dark: string): ChipColorScheme => ({\n color: light,\n text: inkOn(stops, light),\n darkColor: dark,\n darkText: inkOn(stops, dark),\n ...outline,\n ...tint\n });\n\n switch (chipTone) {\n case \"Light\":\n return filled(stops.mid, stops.solid);\n case \"Dark\":\n return filled(stops.solid, stops.solid);\n case \"Darker\":\n return filled(stops.deep, stops.deep);\n case \"Lighter\":\n default:\n return filled(stops.pale, stops.deep);\n }\n}\n\nconst CHIP_TONES: ChipTone[] = [\"Lighter\", \"Light\", \"Dark\", \"Darker\"];\n\nfunction buildChipColors(): Record<ChipColorKey, ChipColorScheme> {\n const colors = {} as Record<ChipColorKey, ChipColorScheme>;\n for (const hue of CHIP_HUES) {\n const stops = HUE_STOPS[hue];\n for (const chipTone of CHIP_TONES) {\n colors[`${hue}${chipTone}` as ChipColorKey] = tone(stops, chipTone);\n }\n // The bare hue is the lightest tone, which is what every existing\n // `color: \"blue\"` in a collection config already means.\n colors[hue] = tone(stops, \"Lighter\");\n }\n return colors;\n}\n\n/**\n * Every chip scheme, keyed by hue and tone.\n *\n * This table used to hold four tones per hue and was flattened to one, which\n * left `blueDark`, `redDarker` and friends resolving to `undefined` — a chip\n * with a colour in its config rendering with no colour at all — and left seeded\n * chips picking from ten schemes, so a five-value enum routinely drew the same\n * background three times. The tones are generated from {@link HUE_STOPS} now,\n * so a new hue brings its whole family with it.\n */\nexport const CHIP_COLORS: Record<ChipColorKey, ChipColorScheme> = buildChipColors();\n\n/**\n * The keys a seeded chip may be assigned, in a stable order.\n *\n * The bare-hue aliases are excluded: they are the same scheme as `<hue>Lighter`\n * and would make the palest tone twice as likely as any other.\n */\nexport const CHIP_SEED_KEYS: ChipColorKey[] = CHIP_HUES.flatMap(\n hue => CHIP_TONES.map(chipTone => `${hue}${chipTone}` as ChipColorKey));\n\n// `string & {}` keeps the known keys in autocomplete while still accepting the\n// arbitrary column colours a board hands over.\nexport function getColorSchemeForKey(key: ChipColorKey | (string & {})): ChipColorScheme {\n // An unknown key is a config that names a colour this build does not have —\n // a renamed hue, or a value typed by hand. Seeding from the key keeps it\n // coloured and keeps it stable, rather than dropping it to no colour.\n return CHIP_COLORS[key as ChipColorKey] ?? getColorSchemeForSeed(String(key));\n}\n\nexport function getColorSchemeForSeed(seed: string): ChipColorScheme {\n const hash: number = hashString(seed);\n return CHIP_COLORS[CHIP_SEED_KEYS[hash % CHIP_SEED_KEYS.length]];\n}\n","\"use client\";\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nexport interface PortalContainerContextType {\n container: HTMLElement | null;\n}\n\nconst PortalContainerContext = createContext<PortalContainerContextType | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n container: HTMLElement | null;\n children: React.ReactNode;\n}\n\n/**\n * Provider component that sets the portal container for all descendants.\n * This can be used at any level of the tree to specify where portals should be attached.\n *\n * @example\n * ```tsx\n * const containerRef = useRef<HTMLDivElement>(null);\n *\n * <div ref={containerRef}>\n * <PortalContainerProvider container={containerRef.current}>\n * <YourComponents />\n * </PortalContainerProvider>\n * </div>\n * ```\n */\nexport function PortalContainerProvider({ container, children }: PortalContainerProviderProps) {\n const contextValue = useMemo(() => ({ container }), [container]);\n\n return (\n <PortalContainerContext.Provider value={contextValue}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Hook to access the portal container from context.\n * Returns null if no provider is found in the tree.\n *\n * @returns The portal container element or null\n */\nexport function usePortalContainer(): HTMLElement | null {\n const context = useContext(PortalContainerContext);\n return context?.container ?? null;\n}\n\n","\"use client\";\nimport { useEffect } from \"react\";\nimport { usePortalContainer } from \"./PortalContainerContext\";\n\n/**\n * Use this hook to create a `<style>` element and inject it into the DOM.\n * It checks if the style already exists, and if it does, it does not inject it again.\n * @param key\n * @param styles\n */\nexport function useInjectStyles(key: string, styles: string) {\n\n const portalContainer = usePortalContainer();\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n\n const targetContainer: HTMLElement | null = portalContainer ?? document.head;\n\n // Try to find an existing style element within the target container first\n const existingStyle = (targetContainer as HTMLElement).querySelector?.(`#${key}`) as HTMLStyleElement | null;\n\n if (!existingStyle) {\n const style = document.createElement(\"style\");\n style.id = key;\n style.innerHTML = styles;\n (targetContainer || document.head).appendChild(style);\n }\n }, []);\n\n}\n","\"use client\";\n\nimport { RefObject, useEffect } from \"react\";\n\n/**\n * Hook that alerts clicks outside the passed ref\n */\nexport function useOutsideAlerter(ref: RefObject<HTMLElement | null>, onOutsideClick: () => void, active = true): void {\n useEffect(() => {\n if (!active)\n return;\n\n /**\n * Alert if clicked on outside of element\n */\n function handleClickOutside(event: Event) {\n if (isInPresentationLayer(event.target as Node)) {\n return;\n }\n\n if (ref.current && !ref.current.contains(event.target as Node)) {\n onOutsideClick();\n }\n }\n\n // Bind the event listener\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n // Unbind the event listener on clean up\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [ref, active, onOutsideClick]);\n}\n\n/**\n * Check if any parent of the node is a presentation node\n * @param node\n */\nfunction isInPresentationLayer(node: Node | null): boolean {\n if (node instanceof HTMLElement) {\n if (node.getAttribute(\"role\") === \"presentation\")\n return true;\n return isInPresentationLayer(node.parentNode);\n }\n return false;\n}\n","import React from \"react\";\n\nexport function useDebouncedCallback<T>(value: T, callback: () => void, immediate: boolean, timeoutMs = 300) {\n\n const pendingUpdate = React.useRef(false);\n\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n const performUpdate = React.useCallback(() => {\n callbackRef.current();\n pendingUpdate.current = false;\n }, []);\n\n const handlerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n React.useEffect(\n () => {\n if (immediate) {\n clearTimeout(handlerRef.current);\n if (pendingUpdate.current) {\n performUpdate();\n }\n return;\n }\n\n pendingUpdate.current = true;\n clearTimeout(handlerRef.current);\n handlerRef.current = setTimeout(performUpdate, timeoutMs);\n return () => {\n if (immediate)\n performUpdate();\n };\n },\n [immediate, value, performUpdate, timeoutMs]\n );\n}\n","import { useCallback, useRef } from \"react\";\n\n\nexport function useDebounceCallback<T extends (...args: any[]) => unknown>(\n callback?: T,\n delay?: number\n): T {\n const timeoutRef = useRef<number | null>(null);\n\n const debouncedCallback = useCallback((...args: Parameters<T>) => {\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = window.setTimeout(() => {\n callback?.(...args);\n }, delay ?? 200);\n }, [callback, delay]);\n\n return debouncedCallback as T;\n}\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useDebounceValue<T>(value: T, delay = 300): T {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = useState(value);\n useEffect(\n () => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n },\n [value, delay] // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n}\n","import { useSyncExternalStore } from \"react\";\n\n/**\n * Whether the document is in dark mode right now, and re-rendered when that\n * changes.\n *\n * The theme is a class on `<html>` (`dark`, set by the panel's mode\n * controller) or a `data-theme` attribute (the marketing site). Components\n * that pick colours in JS rather than through CSS variables — `Chip` derives\n * its ink per theme — used to read the class once at render and never again,\n * so a theme switch left every chip on screen wearing the other theme's ink\n * until something else happened to re-render it. Subscribing through a\n * `MutationObserver` on the root's attributes makes the read live.\n */\nexport function useIsDarkMode(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nfunction getSnapshot(): boolean {\n if (typeof document === \"undefined\") return false;\n const root = document.documentElement;\n return root.classList.contains(\"dark\") || root.getAttribute(\"data-theme\") === \"dark\";\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nfunction subscribe(onChange: () => void): () => void {\n if (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-theme\"]\n });\n return () => observer.disconnect();\n}\n","\"use client\";\nimport React from \"react\";\nimport * as Collapsible from \"@radix-ui/react-collapsible\";\n\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\ninterface CollapseProps {\n children?: React.ReactNode;\n className?: string;\n in?: boolean;\n duration?: number;\n}\n\nexport const Collapse = React.memo(({\n children,\n className,\n in: isOpen = false,\n duration = 220\n }: CollapseProps) => {\n\n useInjectStyles(`Collapse-${duration}`, `\n.CollapseContent-${duration} {\n overflow: hidden;\n}\n.CollapseContent-${duration}[data-state='open'] {\n animation: slideDown ${duration}ms ease-out;\n}\n.CollapseContent-${duration}[data-state='closed'] {\n animation: slideUp ${duration}ms ease-in;\n}\n\n@keyframes slideDown {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n\n@keyframes slideUp {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}\n`);\n\n return (\n <Collapsible.Root\n open={isOpen}\n className={className}>\n\n <Collapsible.Content\n className={cls(`CollapseContent-${duration}`)}\n >\n {children}\n </Collapsible.Content>\n </Collapsible.Root>\n )\n});\n\nCollapse.displayName = \"Collapse\";\n","\"use client\";\nimport React from \"react\";\n\nimport { paperMixin } from \"../styles\";\nimport { Collapse } from \"./Collapse\";\nimport { cls } from \"../util\";\nimport { useOutsideAlerter } from \"../hooks\";\n\nexport type AutocompleteProps = {\n children: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n className?: string;\n}\n\nexport const useAutoComplete = ({ ref }: {\n ref: React.MutableRefObject<HTMLDivElement | null>;\n}) => {\n\n const [autoCompleteOpen, setAutoCompleteOpen] = React.useState(false);\n const [inputFocused, setInputFocused] = React.useState(false);\n\n // if ref is not focused, close autocomplete\n React.useEffect(() => {\n if (ref.current) {\n ref.current.onfocus = () => {\n setAutoCompleteOpen(true);\n setInputFocused(true);\n }\n ref.current.onblur = () => {\n setInputFocused(false);\n }\n }\n }, [ref]);\n\n return {\n inputFocused,\n autoCompleteOpen,\n setAutoCompleteOpen\n };\n}\n\nexport function Autocomplete({\n children,\n open,\n setOpen,\n className\n }: AutocompleteProps) {\n\n const autocompleteRef = React.useRef<HTMLDivElement>(null);\n useOutsideAlerter(autocompleteRef, () => setOpen(false));\n\n return <Collapse\n in={open}\n duration={30}\n className={cls(\n \"absolute top-full left-0 right-0 overflow-visible\",\n open ? \"shadow-2xs\" : \"\",\n \"my-2\",\n \"z-20\",\n \"w-full\")}>\n <div ref={autocompleteRef}\n className={cls(\n open ? paperMixin : \"\",\n \"bg-surface-card\",\n className\n )}>\n {children}\n </div>\n </Collapse>;\n\n}\n\nexport type AutocompleteItemProps = {\n children: React.ReactNode,\n onClick?: () => void,\n className?: string\n};\n\nexport const AutocompleteItem = React.memo(function AutocompleteItem({\n children,\n onClick,\n className\n }: AutocompleteItemProps) {\n\n return (\n <div\n className={cls(\"flex w-full items-center h-[48px] cursor-pointer transition-colors duration-150 hover:bg-surface-hover\", className)}\n onClick={onClick}>\n {children}\n </div>\n )\n});\n","export const iconKeys = [\n \"AArrowDown\",\n \"AArrowUp\",\n \"ALargeSmall\",\n \"Accessibility\",\n \"Activity\",\n \"ActivitySquare\",\n \"AirVent\",\n \"Airplay\",\n \"AlarmCheck\",\n \"AlarmClock\",\n \"AlarmClockCheck\",\n \"AlarmClockMinus\",\n \"AlarmClockOff\",\n \"AlarmClockPlus\",\n \"AlarmMinus\",\n \"AlarmPlus\",\n \"AlarmSmoke\",\n \"Album\",\n \"AlertCircle\",\n \"AlertOctagon\",\n \"AlertTriangle\",\n \"AlignCenter\",\n \"AlignCenterHorizontal\",\n \"AlignCenterVertical\",\n \"AlignEndHorizontal\",\n \"AlignEndVertical\",\n \"AlignHorizontalDistributeCenter\",\n \"AlignHorizontalDistributeEnd\",\n \"AlignHorizontalDistributeStart\",\n \"AlignHorizontalJustifyCenter\",\n \"AlignHorizontalJustifyEnd\",\n \"AlignHorizontalJustifyStart\",\n \"AlignHorizontalSpaceAround\",\n \"AlignHorizontalSpaceBetween\",\n \"AlignJustify\",\n \"AlignLeft\",\n \"AlignRight\",\n \"AlignStartHorizontal\",\n \"AlignStartVertical\",\n \"AlignVerticalDistributeCenter\",\n \"AlignVerticalDistributeEnd\",\n \"AlignVerticalDistributeStart\",\n \"AlignVerticalJustifyCenter\",\n \"AlignVerticalJustifyEnd\",\n \"AlignVerticalJustifyStart\",\n \"AlignVerticalSpaceAround\",\n \"AlignVerticalSpaceBetween\",\n \"Ambulance\",\n \"Ampersand\",\n \"Ampersands\",\n \"Amphora\",\n \"Anchor\",\n \"Angry\",\n \"Annoyed\",\n \"Antenna\",\n \"Anvil\",\n \"Aperture\",\n \"AppWindow\",\n \"AppWindowMac\",\n \"Apple\",\n \"Archive\",\n \"ArchiveRestore\",\n \"ArchiveX\",\n \"AreaChart\",\n \"Armchair\",\n \"ArrowBigDown\",\n \"ArrowBigDownDash\",\n \"ArrowBigLeft\",\n \"ArrowBigLeftDash\",\n \"ArrowBigRight\",\n \"ArrowBigRightDash\",\n \"ArrowBigUp\",\n \"ArrowBigUpDash\",\n \"ArrowDown\",\n \"ArrowDown01\",\n \"ArrowDown10\",\n \"ArrowDownAZ\",\n \"ArrowDownCircle\",\n \"ArrowDownFromLine\",\n \"ArrowDownLeft\",\n \"ArrowDownLeftFromCircle\",\n \"ArrowDownLeftFromSquare\",\n \"ArrowDownLeftSquare\",\n \"ArrowDownNarrowWide\",\n \"ArrowDownRight\",\n \"ArrowDownRightFromCircle\",\n \"ArrowDownRightFromSquare\",\n \"ArrowDownRightSquare\",\n \"ArrowDownSquare\",\n \"ArrowDownToDot\",\n \"ArrowDownToLine\",\n \"ArrowDownUp\",\n \"ArrowDownWideNarrow\",\n \"ArrowDownZA\",\n \"ArrowLeft\",\n \"ArrowLeftCircle\",\n \"ArrowLeftFromLine\",\n \"ArrowLeftRight\",\n \"ArrowLeftSquare\",\n \"ArrowLeftToLine\",\n \"ArrowRight\",\n \"ArrowRightCircle\",\n \"ArrowRightFromLine\",\n \"ArrowRightLeft\",\n \"ArrowRightSquare\",\n \"ArrowRightToLine\",\n \"ArrowUp\",\n \"ArrowUp01\",\n \"ArrowUp10\",\n \"ArrowUpAZ\",\n \"ArrowUpCircle\",\n \"ArrowUpDown\",\n \"ArrowUpFromDot\",\n \"ArrowUpFromLine\",\n \"ArrowUpLeft\",\n \"ArrowUpLeftFromCircle\",\n \"ArrowUpLeftFromSquare\",\n \"ArrowUpLeftSquare\",\n \"ArrowUpNarrowWide\",\n \"ArrowUpRight\",\n \"ArrowUpRightFromCircle\",\n \"ArrowUpRightFromSquare\",\n \"ArrowUpRightSquare\",\n \"ArrowUpSquare\",\n \"ArrowUpToLine\",\n \"ArrowUpWideNarrow\",\n \"ArrowUpZA\",\n \"ArrowsUpFromLine\",\n \"Asterisk\",\n \"AsteriskSquare\",\n \"Astroid\",\n \"AtSign\",\n \"Atom\",\n \"AudioLines\",\n \"AudioWaveform\",\n \"Award\",\n \"Axe\",\n \"Axis3D\",\n \"Baby\",\n \"Backpack\",\n \"Badge\",\n \"BadgeAlert\",\n \"BadgeCent\",\n \"BadgeCheck\",\n \"BadgeDollarSign\",\n \"BadgeEuro\",\n \"BadgeHelp\",\n \"BadgeIndianRupee\",\n \"BadgeInfo\",\n \"BadgeJapaneseYen\",\n \"BadgeMinus\",\n \"BadgePercent\",\n \"BadgePlus\",\n \"BadgePoundSterling\",\n \"BadgeQuestionMark\",\n \"BadgeRussianRuble\",\n \"BadgeSwissFranc\",\n \"BadgeTurkishLira\",\n \"BadgeX\",\n \"BaggageClaim\",\n \"Balloon\",\n \"Ban\",\n \"Banana\",\n \"Bandage\",\n \"Banknote\",\n \"BanknoteArrowDown\",\n \"BanknoteArrowUp\",\n \"BanknoteX\",\n \"BarChart\",\n \"BarChart2\",\n \"BarChart3\",\n \"BarChart4\",\n \"BarChartBig\",\n \"BarChartHorizontal\",\n \"BarChartHorizontalBig\",\n \"Barcode\",\n \"Barrel\",\n \"Baseline\",\n \"Bath\",\n \"Battery\",\n \"BatteryCharging\",\n \"BatteryFull\",\n \"BatteryLow\",\n \"BatteryMedium\",\n \"BatteryPlus\",\n \"BatteryWarning\",\n \"Beaker\",\n \"Bean\",\n \"BeanOff\",\n \"Bed\",\n \"BedDouble\",\n \"BedSingle\",\n \"Beef\",\n \"BeefOff\",\n \"Beer\",\n \"BeerOff\",\n \"Bell\",\n \"BellCheck\",\n \"BellDot\",\n \"BellElectric\",\n \"BellMinus\",\n \"BellOff\",\n \"BellPlus\",\n \"BellRing\",\n \"BetweenHorizonalEnd\",\n \"BetweenHorizonalStart\",\n \"BetweenHorizontalEnd\",\n \"BetweenHorizontalStart\",\n \"BetweenVerticalEnd\",\n \"BetweenVerticalStart\",\n \"BicepsFlexed\",\n \"Bike\",\n \"Binary\",\n \"Binoculars\",\n \"Biohazard\",\n \"Bird\",\n \"Birdhouse\",\n \"Bitcoin\",\n \"Blend\",\n \"Blinds\",\n \"Blocks\",\n \"Bluetooth\",\n \"BluetoothConnected\",\n \"BluetoothOff\",\n \"BluetoothSearching\",\n \"Bold\",\n \"Bolt\",\n \"Bomb\",\n \"Bone\",\n \"Book\",\n \"BookA\",\n \"BookAlert\",\n \"BookAudio\",\n \"BookCheck\",\n \"BookCopy\",\n \"BookDashed\",\n \"BookDown\",\n \"BookHeadphones\",\n \"BookHeart\",\n \"BookImage\",\n \"BookKey\",\n \"BookLock\",\n \"BookMarked\",\n \"BookMinus\",\n \"BookOpen\",\n \"BookOpenCheck\",\n \"BookOpenText\",\n \"BookPlus\",\n \"BookSearch\",\n \"BookTemplate\",\n \"BookText\",\n \"BookType\",\n \"BookUp\",\n \"BookUp2\",\n \"BookUser\",\n \"BookX\",\n \"Bookmark\",\n \"BookmarkCheck\",\n \"BookmarkMinus\",\n \"BookmarkOff\",\n \"BookmarkPlus\",\n \"BookmarkX\",\n \"BoomBox\",\n \"Bot\",\n \"BotMessageSquare\",\n \"BotOff\",\n \"BottleWine\",\n \"BowArrow\",\n \"Box\",\n \"BoxSelect\",\n \"Boxes\",\n \"Braces\",\n \"Brackets\",\n \"Brain\",\n \"BrainCircuit\",\n \"BrainCog\",\n \"BrickWall\",\n \"BrickWallFire\",\n \"BrickWallShield\",\n \"Briefcase\",\n \"BriefcaseBusiness\",\n \"BriefcaseConveyorBelt\",\n \"BriefcaseMedical\",\n \"BringToFront\",\n \"Brush\",\n \"BrushCleaning\",\n \"Bubbles\",\n \"Bug\",\n \"BugOff\",\n \"BugPlay\",\n \"Building\",\n \"Building2\",\n \"Bus\",\n \"BusFront\",\n \"Cable\",\n \"CableCar\",\n \"Cake\",\n \"CakeSlice\",\n \"Calculator\",\n \"Calendar\",\n \"Calendar1\",\n \"CalendarArrowDown\",\n \"CalendarArrowUp\",\n \"CalendarCheck\",\n \"CalendarCheck2\",\n \"CalendarClock\",\n \"CalendarCog\",\n \"CalendarDays\",\n \"CalendarFold\",\n \"CalendarHeart\",\n \"CalendarMinus\",\n \"CalendarMinus2\",\n \"CalendarOff\",\n \"CalendarPlus\",\n \"CalendarPlus2\",\n \"CalendarRange\",\n \"CalendarSearch\",\n \"CalendarSync\",\n \"CalendarX\",\n \"CalendarX2\",\n \"Calendars\",\n \"Camera\",\n \"CameraOff\",\n \"CandlestickChart\",\n \"Candy\",\n \"CandyCane\",\n \"CandyOff\",\n \"Cannabis\",\n \"CannabisOff\",\n \"Captions\",\n \"CaptionsOff\",\n \"Car\",\n \"CarFront\",\n \"CarTaxiFront\",\n \"Caravan\",\n \"CardSim\",\n \"Carrot\",\n \"CaseLower\",\n \"CaseSensitive\",\n \"CaseUpper\",\n \"CassetteTape\",\n \"Cast\",\n \"Castle\",\n \"Cat\",\n \"Cctv\",\n \"CctvOff\",\n \"ChartArea\",\n \"ChartBar\",\n \"ChartBarBig\",\n \"ChartBarDecreasing\",\n \"ChartBarIncreasing\",\n \"ChartBarStacked\",\n \"ChartCandlestick\",\n \"ChartColumn\",\n \"ChartColumnBig\",\n \"ChartColumnDecreasing\",\n \"ChartColumnIncreasing\",\n \"ChartColumnStacked\",\n \"ChartGantt\",\n \"ChartLine\",\n \"ChartNetwork\",\n \"ChartNoAxesColumn\",\n \"ChartNoAxesColumnDecreasing\",\n \"ChartNoAxesColumnIncreasing\",\n \"ChartNoAxesCombined\",\n \"ChartNoAxesGantt\",\n \"ChartPie\",\n \"ChartScatter\",\n \"ChartSpline\",\n \"Check\",\n \"CheckCheck\",\n \"CheckCircle\",\n \"CheckCircle2\",\n \"CheckLine\",\n \"CheckSquare\",\n \"CheckSquare2\",\n \"ChefHat\",\n \"Cherry\",\n \"ChessBishop\",\n \"ChessKing\",\n \"ChessKnight\",\n \"ChessPawn\",\n \"ChessQueen\",\n \"ChessRook\",\n \"ChevronDown\",\n \"ChevronDownCircle\",\n \"ChevronDownSquare\",\n \"ChevronFirst\",\n \"ChevronLast\",\n \"ChevronLeft\",\n \"ChevronLeftCircle\",\n \"ChevronLeftSquare\",\n \"ChevronRight\",\n \"ChevronRightCircle\",\n \"ChevronRightSquare\",\n \"ChevronUp\",\n \"ChevronUpCircle\",\n \"ChevronUpSquare\",\n \"ChevronsDown\",\n \"ChevronsDownUp\",\n \"ChevronsLeft\",\n \"ChevronsLeftRight\",\n \"ChevronsLeftRightEllipsis\",\n \"ChevronsRight\",\n \"ChevronsRightLeft\",\n \"ChevronsUp\",\n \"ChevronsUpDown\",\n \"Church\",\n \"Cigarette\",\n \"CigaretteOff\",\n \"Circle\",\n \"CircleAlert\",\n \"CircleArrowDown\",\n \"CircleArrowLeft\",\n \"CircleArrowOutDownLeft\",\n \"CircleArrowOutDownRight\",\n \"CircleArrowOutUpLeft\",\n \"CircleArrowOutUpRight\",\n \"CircleArrowRight\",\n \"CircleArrowUp\",\n \"CircleCheck\",\n \"CircleCheckBig\",\n \"CircleChevronDown\",\n \"CircleChevronLeft\",\n \"CircleChevronRight\",\n \"CircleChevronUp\",\n \"CircleDashed\",\n \"CircleDivide\",\n \"CircleDollarSign\",\n \"CircleDot\",\n \"CircleDotDashed\",\n \"CircleEllipsis\",\n \"CircleEqual\",\n \"CircleFadingArrowUp\",\n \"CircleFadingPlus\",\n \"CircleGauge\",\n \"CircleHelp\",\n \"CircleMinus\",\n \"CircleOff\",\n \"CircleParking\",\n \"CircleParkingOff\",\n \"CirclePause\",\n \"CirclePercent\",\n \"CirclePile\",\n \"CirclePlay\",\n \"CirclePlus\",\n \"CirclePoundSterling\",\n \"CirclePower\",\n \"CircleQuestionMark\",\n \"CircleSlash\",\n \"CircleSlash2\",\n \"CircleSlashed\",\n \"CircleSmall\",\n \"CircleStar\",\n \"CircleStop\",\n \"CircleUser\",\n \"CircleUserRound\",\n \"CircleX\",\n \"CircuitBoard\",\n \"Citrus\",\n \"Clapperboard\",\n \"Clipboard\",\n \"ClipboardCheck\",\n \"ClipboardClock\",\n \"ClipboardCopy\",\n \"ClipboardEdit\",\n \"ClipboardList\",\n \"ClipboardMinus\",\n \"ClipboardPaste\",\n \"ClipboardPen\",\n \"ClipboardPenLine\",\n \"ClipboardPlus\",\n \"ClipboardSignature\",\n \"ClipboardType\",\n \"ClipboardX\",\n \"Clock\",\n \"Clock1\",\n \"Clock10\",\n \"Clock11\",\n \"Clock12\",\n \"Clock2\",\n \"Clock3\",\n \"Clock4\",\n \"Clock5\",\n \"Clock6\",\n \"Clock7\",\n \"Clock8\",\n \"Clock9\",\n \"ClockAlert\",\n \"ClockArrowDown\",\n \"ClockArrowUp\",\n \"ClockCheck\",\n \"ClockFading\",\n \"ClockPlus\",\n \"ClosedCaption\",\n \"Cloud\",\n \"CloudAlert\",\n \"CloudBackup\",\n \"CloudCheck\",\n \"CloudCog\",\n \"CloudDownload\",\n \"CloudDrizzle\",\n \"CloudFog\",\n \"CloudHail\",\n \"CloudLightning\",\n \"CloudMoon\",\n \"CloudMoonRain\",\n \"CloudOff\",\n \"CloudRain\",\n \"CloudRainWind\",\n \"CloudSnow\",\n \"CloudSun\",\n \"CloudSunRain\",\n \"CloudSync\",\n \"CloudUpload\",\n \"Cloudy\",\n \"Clover\",\n \"Club\",\n \"Code\",\n \"Code2\",\n \"CodeSquare\",\n \"CodeXml\",\n \"Coffee\",\n \"Cog\",\n \"Coins\",\n \"Columns\",\n \"Columns2\",\n \"Columns3\",\n \"Columns3Cog\",\n \"Columns4\",\n \"ColumnsSettings\",\n \"Combine\",\n \"Command\",\n \"Compass\",\n \"Component\",\n \"Computer\",\n \"ConciergeBell\",\n \"Cone\",\n \"Construction\",\n \"Contact\",\n \"Contact2\",\n \"ContactRound\",\n \"Container\",\n \"Contrast\",\n \"Cookie\",\n \"CookingPot\",\n \"Copy\",\n \"CopyCheck\",\n \"CopyMinus\",\n \"CopyPlus\",\n \"CopySlash\",\n \"CopyX\",\n \"Copyleft\",\n \"Copyright\",\n \"CornerDownLeft\",\n \"CornerDownRight\",\n \"CornerLeftDown\",\n \"CornerLeftUp\",\n \"CornerRightDown\",\n \"CornerRightUp\",\n \"CornerUpLeft\",\n \"CornerUpRight\",\n \"Cpu\",\n \"CreativeCommons\",\n \"CreditCard\",\n \"Croissant\",\n \"Crop\",\n \"Cross\",\n \"Crosshair\",\n \"Crown\",\n \"Cuboid\",\n \"CupSoda\",\n \"CurlyBraces\",\n \"Currency\",\n \"Cylinder\",\n \"Dam\",\n \"Database\",\n \"DatabaseBackup\",\n \"DatabaseSearch\",\n \"DatabaseZap\",\n \"DecimalsArrowLeft\",\n \"DecimalsArrowRight\",\n \"Delete\",\n \"Dessert\",\n \"Diameter\",\n \"Diamond\",\n \"DiamondMinus\",\n \"DiamondPercent\",\n \"DiamondPlus\",\n \"Dice1\",\n \"Dice2\",\n \"Dice3\",\n \"Dice4\",\n \"Dice5\",\n \"Dice6\",\n \"Dices\",\n \"Diff\",\n \"Disc\",\n \"Disc2\",\n \"Disc3\",\n \"DiscAlbum\",\n \"Divide\",\n \"DivideCircle\",\n \"DivideSquare\",\n \"Dna\",\n \"DnaOff\",\n \"Dock\",\n \"Dog\",\n \"DollarSign\",\n \"Donut\",\n \"DoorClosed\",\n \"DoorClosedLocked\",\n \"DoorOpen\",\n \"Dot\",\n \"DotSquare\",\n \"Download\",\n \"DownloadCloud\",\n \"DraftingCompass\",\n \"Drama\",\n \"Drill\",\n \"Drone\",\n \"Droplet\",\n \"DropletOff\",\n \"Droplets\",\n \"Drum\",\n \"Drumstick\",\n \"Dumbbell\",\n \"Ear\",\n \"EarOff\",\n \"Earth\",\n \"EarthLock\",\n \"Eclipse\",\n \"Edit\",\n \"Edit2\",\n \"Edit3\",\n \"Egg\",\n \"EggFried\",\n \"EggOff\",\n \"Ellipse\",\n \"Ellipsis\",\n \"EllipsisVertical\",\n \"Equal\",\n \"EqualApproximately\",\n \"EqualNot\",\n \"EqualSquare\",\n \"Eraser\",\n \"EthernetPort\",\n \"Euro\",\n \"EvCharger\",\n \"Expand\",\n \"ExternalLink\",\n \"Eye\",\n \"EyeClosed\",\n \"EyeOff\",\n \"Factory\",\n \"Fan\",\n \"FastForward\",\n \"Feather\",\n \"Fence\",\n \"FerrisWheel\",\n \"File\",\n \"FileArchive\",\n \"FileAudio\",\n \"FileAudio2\",\n \"FileAxis3D\",\n \"FileBadge\",\n \"FileBadge2\",\n \"FileBarChart\",\n \"FileBarChart2\",\n \"FileBox\",\n \"FileBraces\",\n \"FileBracesCorner\",\n \"FileChartColumn\",\n \"FileChartColumnIncreasing\",\n \"FileChartLine\",\n \"FileChartPie\",\n \"FileCheck\",\n \"FileCheck2\",\n \"FileCheckCorner\",\n \"FileClock\",\n \"FileCode\",\n \"FileCode2\",\n \"FileCodeCorner\",\n \"FileCog\",\n \"FileCog2\",\n \"FileDiff\",\n \"FileDigit\",\n \"FileDown\",\n \"FileEdit\",\n \"FileExclamationPoint\",\n \"FileHeadphone\",\n \"FileHeart\",\n \"FileImage\",\n \"FileInput\",\n \"FileJson\",\n \"FileJson2\",\n \"FileKey\",\n \"FileKey2\",\n \"FileLineChart\",\n \"FileLock\",\n \"FileLock2\",\n \"FileMinus\",\n \"FileMinus2\",\n \"FileMinusCorner\",\n \"FileMusic\",\n \"FileOutput\",\n \"FilePen\",\n \"FilePenLine\",\n \"FilePieChart\",\n \"FilePlay\",\n \"FilePlus\",\n \"FilePlus2\",\n \"FilePlusCorner\",\n \"FileQuestion\",\n \"FileQuestionMark\",\n \"FileScan\",\n \"FileSearch\",\n \"FileSearch2\",\n \"FileSearchCorner\",\n \"FileSignal\",\n \"FileSignature\",\n \"FileSliders\",\n \"FileSpreadsheet\",\n \"FileStack\",\n \"FileSymlink\",\n \"FileTerminal\",\n \"FileText\",\n \"FileType\",\n \"FileType2\",\n \"FileTypeCorner\",\n \"FileUp\",\n \"FileUser\",\n \"FileVideo\",\n \"FileVideo2\",\n \"FileVideoCamera\",\n \"FileVolume\",\n \"FileVolume2\",\n \"FileWarning\",\n \"FileX\",\n \"FileX2\",\n \"FileXCorner\",\n \"Files\",\n \"Film\",\n \"Filter\",\n \"FilterX\",\n \"Fingerprint\",\n \"FingerprintPattern\",\n \"FireExtinguisher\",\n \"Fish\",\n \"FishOff\",\n \"FishSymbol\",\n \"FishingHook\",\n \"FishingRod\",\n \"Flag\",\n \"FlagOff\",\n \"FlagTriangleLeft\",\n \"FlagTriangleRight\",\n \"Flame\",\n \"FlameKindling\",\n \"Flashlight\",\n \"FlashlightOff\",\n \"FlaskConical\",\n \"FlaskConicalOff\",\n \"FlaskRound\",\n \"FlipHorizontal\",\n \"FlipHorizontal2\",\n \"FlipVertical\",\n \"FlipVertical2\",\n \"Flower\",\n \"Flower2\",\n \"Focus\",\n \"FoldHorizontal\",\n \"FoldVertical\",\n \"Folder\",\n \"FolderArchive\",\n \"FolderBookmark\",\n \"FolderCheck\",\n \"FolderClock\",\n \"FolderClosed\",\n \"FolderCode\",\n \"FolderCog\",\n \"FolderCog2\",\n \"FolderDot\",\n \"FolderDown\",\n \"FolderEdit\",\n \"FolderGit\",\n \"FolderGit2\",\n \"FolderHeart\",\n \"FolderInput\",\n \"FolderKanban\",\n \"FolderKey\",\n \"FolderLock\",\n \"FolderMinus\",\n \"FolderOpen\",\n \"FolderOpenDot\",\n \"FolderOutput\",\n \"FolderPen\",\n \"FolderPlus\",\n \"FolderRoot\",\n \"FolderSearch\",\n \"FolderSearch2\",\n \"FolderSymlink\",\n \"FolderSync\",\n \"FolderTree\",\n \"FolderUp\",\n \"FolderX\",\n \"Folders\",\n \"Footprints\",\n \"ForkKnife\",\n \"ForkKnifeCrossed\",\n \"Forklift\",\n \"Form\",\n \"FormInput\",\n \"Forward\",\n \"Frame\",\n \"Frown\",\n \"Fuel\",\n \"Fullscreen\",\n \"FunctionSquare\",\n \"Funnel\",\n \"FunnelPlus\",\n \"FunnelX\",\n \"GalleryHorizontal\",\n \"GalleryHorizontalEnd\",\n \"GalleryThumbnails\",\n \"GalleryVertical\",\n \"GalleryVerticalEnd\",\n \"Gamepad\",\n \"Gamepad2\",\n \"GamepadDirectional\",\n \"GanttChart\",\n \"GanttChartSquare\",\n \"Gauge\",\n \"GaugeCircle\",\n \"Gavel\",\n \"Gem\",\n \"GeorgianLari\",\n \"Ghost\",\n \"Gift\",\n \"GitBranch\",\n \"GitBranchMinus\",\n \"GitBranchPlus\",\n \"GitCommit\",\n \"GitCommitHorizontal\",\n \"GitCommitVertical\",\n \"GitCompare\",\n \"GitCompareArrows\",\n \"GitFork\",\n \"GitGraph\",\n \"GitMerge\",\n \"GitMergeConflict\",\n \"GitPullRequest\",\n \"GitPullRequestArrow\",\n \"GitPullRequestClosed\",\n \"GitPullRequestCreate\",\n \"GitPullRequestCreateArrow\",\n \"GitPullRequestDraft\",\n \"GlassWater\",\n \"Glasses\",\n \"Globe\",\n \"Globe2\",\n \"GlobeLock\",\n \"GlobeOff\",\n \"GlobeX\",\n \"Goal\",\n \"Gpu\",\n \"Grab\",\n \"GraduationCap\",\n \"Grape\",\n \"Grid\",\n \"Grid2X2\",\n \"Grid2X2Check\",\n \"Grid2X2Plus\",\n \"Grid2X2X\",\n \"Grid3X3\",\n \"Grid3x2\",\n \"Grip\",\n \"GripHorizontal\",\n \"GripVertical\",\n \"Group\",\n \"Guitar\",\n \"Ham\",\n \"Hamburger\",\n \"Hammer\",\n \"Hand\",\n \"HandCoins\",\n \"HandFist\",\n \"HandGrab\",\n \"HandHeart\",\n \"HandHelping\",\n \"HandMetal\",\n \"HandPlatter\",\n \"Handbag\",\n \"Handshake\",\n \"HardDrive\",\n \"HardDriveDownload\",\n \"HardDriveUpload\",\n \"HardHat\",\n \"Hash\",\n \"HatGlasses\",\n \"Haze\",\n \"Hd\",\n \"HdmiPort\",\n \"Heading\",\n \"Heading1\",\n \"Heading2\",\n \"Heading3\",\n \"Heading4\",\n \"Heading5\",\n \"Heading6\",\n \"HeadphoneOff\",\n \"Headphones\",\n \"Headset\",\n \"Heart\",\n \"HeartCrack\",\n \"HeartHandshake\",\n \"HeartMinus\",\n \"HeartOff\",\n \"HeartPlus\",\n \"HeartPulse\",\n \"HeartX\",\n \"Heater\",\n \"Helicopter\",\n \"HelpCircle\",\n \"HelpingHand\",\n \"Hexagon\",\n \"Highlighter\",\n \"History\",\n \"Home\",\n \"Hop\",\n \"HopOff\",\n \"Hospital\",\n \"Hotel\",\n \"Hourglass\",\n \"House\",\n \"HouseHeart\",\n \"HousePlug\",\n \"HousePlus\",\n \"HouseWifi\",\n \"IceCream\",\n \"IceCream2\",\n \"IceCreamBowl\",\n \"IceCreamCone\",\n \"IdCard\",\n \"IdCardLanyard\",\n \"Image\",\n \"ImageDown\",\n \"ImageMinus\",\n \"ImageOff\",\n \"ImagePlay\",\n \"ImagePlus\",\n \"ImageUp\",\n \"ImageUpscale\",\n \"Images\",\n \"Import\",\n \"Inbox\",\n \"Indent\",\n \"IndentDecrease\",\n \"IndentIncrease\",\n \"IndianRupee\",\n \"Infinity\",\n \"Info\",\n \"Inspect\",\n \"InspectionPanel\",\n \"Italic\",\n \"IterationCcw\",\n \"IterationCw\",\n \"JapaneseYen\",\n \"Joystick\",\n \"Kanban\",\n \"KanbanSquare\",\n \"KanbanSquareDashed\",\n \"Kayak\",\n \"Key\",\n \"KeyRound\",\n \"KeySquare\",\n \"Keyboard\",\n \"KeyboardMusic\",\n \"KeyboardOff\",\n \"Lamp\",\n \"LampCeiling\",\n \"LampDesk\",\n \"LampFloor\",\n \"LampWallDown\",\n \"LampWallUp\",\n \"LandPlot\",\n \"Landmark\",\n \"Languages\",\n \"Laptop\",\n \"Laptop2\",\n \"LaptopMinimal\",\n \"LaptopMinimalCheck\",\n \"Lasso\",\n \"LassoSelect\",\n \"Laugh\",\n \"Layers\",\n \"Layers2\",\n \"Layers3\",\n \"LayersMinus\",\n \"LayersPlus\",\n \"Layout\",\n \"LayoutDashboard\",\n \"LayoutGrid\",\n \"LayoutList\",\n \"LayoutPanelLeft\",\n \"LayoutPanelTop\",\n \"LayoutTemplate\",\n \"Leaf\",\n \"LeafyGreen\",\n \"Lectern\",\n \"LensConcave\",\n \"LensConvex\",\n \"LetterText\",\n \"Library\",\n \"LibraryBig\",\n \"LibrarySquare\",\n \"LifeBuoy\",\n \"Ligature\",\n \"Lightbulb\",\n \"LightbulbOff\",\n \"LineChart\",\n \"LineDotRightHorizontal\",\n \"LineSquiggle\",\n \"LineStyle\",\n \"Link\",\n \"Link2\",\n \"Link2Off\",\n \"List\",\n \"ListCheck\",\n \"ListChecks\",\n \"ListChevronsDownUp\",\n \"ListChevronsUpDown\",\n \"ListCollapse\",\n \"ListEnd\",\n \"ListFilter\",\n \"ListFilterPlus\",\n \"ListIndentDecrease\",\n \"ListIndentIncrease\",\n \"ListMinus\",\n \"ListMusic\",\n \"ListOrdered\",\n \"ListPlus\",\n \"ListRestart\",\n \"ListStart\",\n \"ListTodo\",\n \"ListTree\",\n \"ListVideo\",\n \"ListX\",\n \"Loader\",\n \"Loader2\",\n \"LoaderCircle\",\n \"LoaderPinwheel\",\n \"Locate\",\n \"LocateFixed\",\n \"LocateOff\",\n \"LocationEdit\",\n \"Lock\",\n \"LockKeyhole\",\n \"LockKeyholeOpen\",\n \"LockOpen\",\n \"LogIn\",\n \"LogOut\",\n \"Logs\",\n \"Lollipop\",\n \"Luggage\",\n \"MSquare\",\n \"Magnet\",\n \"Mail\",\n \"MailCheck\",\n \"MailMinus\",\n \"MailOpen\",\n \"MailPlus\",\n \"MailQuestion\",\n \"MailQuestionMark\",\n \"MailSearch\",\n \"MailWarning\",\n \"MailX\",\n \"Mailbox\",\n \"Mails\",\n \"Map\",\n \"MapMinus\",\n \"MapPin\",\n \"MapPinCheck\",\n \"MapPinCheckInside\",\n \"MapPinHouse\",\n \"MapPinMinus\",\n \"MapPinMinusInside\",\n \"MapPinOff\",\n \"MapPinPen\",\n \"MapPinPlus\",\n \"MapPinPlusInside\",\n \"MapPinSearch\",\n \"MapPinX\",\n \"MapPinXInside\",\n \"MapPinned\",\n \"MapPlus\",\n \"Mars\",\n \"MarsStroke\",\n \"Martini\",\n \"Maximize\",\n \"Maximize2\",\n \"Medal\",\n \"Megaphone\",\n \"MegaphoneOff\",\n \"Meh\",\n \"MemoryStick\",\n \"Menu\",\n \"MenuSquare\",\n \"Merge\",\n \"MessageCircle\",\n \"MessageCircleCheck\",\n \"MessageCircleCode\",\n \"MessageCircleDashed\",\n \"MessageCircleHeart\",\n \"MessageCircleMore\",\n \"MessageCircleOff\",\n \"MessageCirclePlus\",\n \"MessageCircleQuestion\",\n \"MessageCircleQuestionMark\",\n \"MessageCircleReply\",\n \"MessageCircleWarning\",\n \"MessageCircleX\",\n \"MessageSquare\",\n \"MessageSquareCheck\",\n \"MessageSquareCode\",\n \"MessageSquareDashed\",\n \"MessageSquareDiff\",\n \"MessageSquareDot\",\n \"MessageSquareHeart\",\n \"MessageSquareLock\",\n \"MessageSquareMore\",\n \"MessageSquareOff\",\n \"MessageSquarePlus\",\n \"MessageSquareQuote\",\n \"MessageSquareReply\",\n \"MessageSquareShare\",\n \"MessageSquareText\",\n \"MessageSquareWarning\",\n \"MessageSquareX\",\n \"MessagesSquare\",\n \"Metronome\",\n \"Mic\",\n \"Mic2\",\n \"MicOff\",\n \"MicVocal\",\n \"Microchip\",\n \"Microscope\",\n \"Microwave\",\n \"Milestone\",\n \"Milk\",\n \"MilkOff\",\n \"Minimize\",\n \"Minimize2\",\n \"Minus\",\n \"MinusCircle\",\n \"MinusSquare\",\n \"MirrorRectangular\",\n \"MirrorRound\",\n \"Monitor\",\n \"MonitorCheck\",\n \"MonitorCloud\",\n \"MonitorCog\",\n \"MonitorDot\",\n \"MonitorDown\",\n \"MonitorOff\",\n \"MonitorPause\",\n \"MonitorPlay\",\n \"MonitorSmartphone\",\n \"MonitorSpeaker\",\n \"MonitorStop\",\n \"MonitorUp\",\n \"MonitorX\",\n \"Moon\",\n \"MoonStar\",\n \"MoreHorizontal\",\n \"MoreVertical\",\n \"Motorbike\",\n \"Mountain\",\n \"MountainSnow\",\n \"Mouse\",\n \"MouseLeft\",\n \"MouseOff\",\n \"MousePointer\",\n \"MousePointer2\",\n \"MousePointer2Off\",\n \"MousePointerBan\",\n \"MousePointerClick\",\n \"MousePointerSquareDashed\",\n \"MouseRight\",\n \"Move\",\n \"Move3D\",\n \"MoveDiagonal\",\n \"MoveDiagonal2\",\n \"MoveDown\",\n \"MoveDownLeft\",\n \"MoveDownRight\",\n \"MoveHorizontal\",\n \"MoveLeft\",\n \"MoveRight\",\n \"MoveUp\",\n \"MoveUpLeft\",\n \"MoveUpRight\",\n \"MoveVertical\",\n \"Music\",\n \"Music2\",\n \"Music3\",\n \"Music4\",\n \"Navigation\",\n \"Navigation2\",\n \"Navigation2Off\",\n \"NavigationOff\",\n \"Network\",\n \"Newspaper\",\n \"Nfc\",\n \"NonBinary\",\n \"Notebook\",\n \"NotebookPen\",\n \"NotebookTabs\",\n \"NotebookText\",\n \"NotepadText\",\n \"NotepadTextDashed\",\n \"Nut\",\n \"NutOff\",\n \"Octagon\",\n \"OctagonAlert\",\n \"OctagonMinus\",\n \"OctagonPause\",\n \"OctagonX\",\n \"Omega\",\n \"Option\",\n \"Orbit\",\n \"Origami\",\n \"Outdent\",\n \"Package\",\n \"Package2\",\n \"PackageCheck\",\n \"PackageMinus\",\n \"PackageOpen\",\n \"PackagePlus\",\n \"PackageSearch\",\n \"PackageX\",\n \"PaintBucket\",\n \"PaintRoller\",\n \"Paintbrush\",\n \"Paintbrush2\",\n \"PaintbrushVertical\",\n \"Palette\",\n \"Palmtree\",\n \"Panda\",\n \"PanelBottom\",\n \"PanelBottomClose\",\n \"PanelBottomDashed\",\n \"PanelBottomInactive\",\n \"PanelBottomOpen\",\n \"PanelLeft\",\n \"PanelLeftClose\",\n \"PanelLeftDashed\",\n \"PanelLeftInactive\",\n \"PanelLeftOpen\",\n \"PanelLeftRightDashed\",\n \"PanelRight\",\n \"PanelRightClose\",\n \"PanelRightDashed\",\n \"PanelRightInactive\",\n \"PanelRightOpen\",\n \"PanelTop\",\n \"PanelTopBottomDashed\",\n \"PanelTopClose\",\n \"PanelTopDashed\",\n \"PanelTopInactive\",\n \"PanelTopOpen\",\n \"PanelsLeftBottom\",\n \"PanelsLeftRight\",\n \"PanelsRightBottom\",\n \"PanelsTopBottom\",\n \"PanelsTopLeft\",\n \"Paperclip\",\n \"Parentheses\",\n \"ParkingCircle\",\n \"ParkingCircleOff\",\n \"ParkingMeter\",\n \"ParkingSquare\",\n \"ParkingSquareOff\",\n \"PartyPopper\",\n \"Pause\",\n \"PauseCircle\",\n \"PauseOctagon\",\n \"PawPrint\",\n \"PcCase\",\n \"Pen\",\n \"PenBox\",\n \"PenLine\",\n \"PenOff\",\n \"PenSquare\",\n \"PenTool\",\n \"Pencil\",\n \"PencilLine\",\n \"PencilOff\",\n \"PencilRuler\",\n \"Pentagon\",\n \"Percent\",\n \"PercentCircle\",\n \"PercentDiamond\",\n \"PercentSquare\",\n \"PersonStanding\",\n \"PhilippinePeso\",\n \"Phone\",\n \"PhoneCall\",\n \"PhoneForwarded\",\n \"PhoneIncoming\",\n \"PhoneMissed\",\n \"PhoneOff\",\n \"PhoneOutgoing\",\n \"Pi\",\n \"PiSquare\",\n \"Piano\",\n \"Pickaxe\",\n \"PictureInPicture\",\n \"PictureInPicture2\",\n \"PieChart\",\n \"PiggyBank\",\n \"Pilcrow\",\n \"PilcrowLeft\",\n \"PilcrowRight\",\n \"PilcrowSquare\",\n \"Pill\",\n \"PillBottle\",\n \"Pin\",\n \"PinOff\",\n \"Pipette\",\n \"Pizza\",\n \"Plane\",\n \"PlaneLanding\",\n \"PlaneTakeoff\",\n \"Play\",\n \"PlayCircle\",\n \"PlaySquare\",\n \"Plug\",\n \"Plug2\",\n \"PlugZap\",\n \"PlugZap2\",\n \"Plus\",\n \"PlusCircle\",\n \"PlusSquare\",\n \"PocketKnife\",\n \"Podcast\",\n \"Pointer\",\n \"PointerOff\",\n \"Popcorn\",\n \"Popsicle\",\n \"PoundSterling\",\n \"Power\",\n \"PowerCircle\",\n \"PowerOff\",\n \"PowerSquare\",\n \"Presentation\",\n \"Printer\",\n \"PrinterCheck\",\n \"PrinterX\",\n \"Projector\",\n \"Proportions\",\n \"Puzzle\",\n \"Pyramid\",\n \"QrCode\",\n \"Quote\",\n \"Rabbit\",\n \"Radar\",\n \"Radiation\",\n \"Radical\",\n \"Radio\",\n \"RadioOff\",\n \"RadioReceiver\",\n \"RadioTower\",\n \"Radius\",\n \"Rainbow\",\n \"Rat\",\n \"Ratio\",\n \"Receipt\",\n \"ReceiptCent\",\n \"ReceiptEuro\",\n \"ReceiptIndianRupee\",\n \"ReceiptJapaneseYen\",\n \"ReceiptPoundSterling\",\n \"ReceiptRussianRuble\",\n \"ReceiptSwissFranc\",\n \"ReceiptText\",\n \"ReceiptTurkishLira\",\n \"RectangleCircle\",\n \"RectangleEllipsis\",\n \"RectangleGoggles\",\n \"RectangleHorizontal\",\n \"RectangleVertical\",\n \"Recycle\",\n \"Redo\",\n \"Redo2\",\n \"RedoDot\",\n \"RefreshCcw\",\n \"RefreshCcwDot\",\n \"RefreshCw\",\n \"RefreshCwOff\",\n \"Refrigerator\",\n \"Regex\",\n \"RemoveFormatting\",\n \"Repeat\",\n \"Repeat1\",\n \"Repeat2\",\n \"RepeatOff\",\n \"Replace\",\n \"ReplaceAll\",\n \"Reply\",\n \"ReplyAll\",\n \"Rewind\",\n \"Ribbon\",\n \"Road\",\n \"Rocket\",\n \"RockingChair\",\n \"RollerCoaster\",\n \"Rose\",\n \"Rotate3D\",\n \"RotateCcw\",\n \"RotateCcwKey\",\n \"RotateCcwSquare\",\n \"RotateCw\",\n \"RotateCwSquare\",\n \"Route\",\n \"RouteOff\",\n \"Router\",\n \"Rows\",\n \"Rows2\",\n \"Rows3\",\n \"Rows4\",\n \"Rss\",\n \"Ruler\",\n \"RulerDimensionLine\",\n \"RussianRuble\",\n \"Sailboat\",\n \"Salad\",\n \"Sandwich\",\n \"Satellite\",\n \"SatelliteDish\",\n \"SaudiRiyal\",\n \"Save\",\n \"SaveAll\",\n \"SaveOff\",\n \"Scale\",\n \"Scale3D\",\n \"Scaling\",\n \"Scan\",\n \"ScanBarcode\",\n \"ScanEye\",\n \"ScanFace\",\n \"ScanHeart\",\n \"ScanLine\",\n \"ScanQrCode\",\n \"ScanSearch\",\n \"ScanText\",\n \"ScatterChart\",\n \"School\",\n \"School2\",\n \"Scissors\",\n \"ScissorsLineDashed\",\n \"ScissorsSquare\",\n \"ScissorsSquareDashedBottom\",\n \"Scooter\",\n \"ScreenShare\",\n \"ScreenShareOff\",\n \"Scroll\",\n \"ScrollText\",\n \"Search\",\n \"SearchAlert\",\n \"SearchCheck\",\n \"SearchCode\",\n \"SearchSlash\",\n \"SearchX\",\n \"Section\",\n \"Send\",\n \"SendHorizonal\",\n \"SendHorizontal\",\n \"SendToBack\",\n \"SeparatorHorizontal\",\n \"SeparatorVertical\",\n \"Server\",\n \"ServerCog\",\n \"ServerCrash\",\n \"ServerOff\",\n \"Settings\",\n \"Settings2\",\n \"Shapes\",\n \"Share\",\n \"Share2\",\n \"Sheet\",\n \"Shell\",\n \"ShelvingUnit\",\n \"Shield\",\n \"ShieldAlert\",\n \"ShieldBan\",\n \"ShieldCheck\",\n \"ShieldClose\",\n \"ShieldCog\",\n \"ShieldCogCorner\",\n \"ShieldEllipsis\",\n \"ShieldHalf\",\n \"ShieldMinus\",\n \"ShieldOff\",\n \"ShieldPlus\",\n \"ShieldQuestion\",\n \"ShieldQuestionMark\",\n \"ShieldUser\",\n \"ShieldX\",\n \"Ship\",\n \"ShipWheel\",\n \"Shirt\",\n \"ShoppingBag\",\n \"ShoppingBasket\",\n \"ShoppingCart\",\n \"Shovel\",\n \"ShowerHead\",\n \"Shredder\",\n \"Shrimp\",\n \"Shrink\",\n \"Shrub\",\n \"Shuffle\",\n \"Sidebar\",\n \"SidebarClose\",\n \"SidebarOpen\",\n \"Sigma\",\n \"SigmaSquare\",\n \"Signal\",\n \"SignalHigh\",\n \"SignalLow\",\n \"SignalMedium\",\n \"SignalZero\",\n \"Signature\",\n \"Signpost\",\n \"SignpostBig\",\n \"Siren\",\n \"SkipBack\",\n \"SkipForward\",\n \"Skull\",\n \"Slash\",\n \"SlashSquare\",\n \"Slice\",\n \"Sliders\",\n \"SlidersHorizontal\",\n \"SlidersVertical\",\n \"Smartphone\",\n \"SmartphoneCharging\",\n \"SmartphoneNfc\",\n \"Smile\",\n \"SmilePlus\",\n \"Snail\",\n \"Snowflake\",\n \"SoapDispenserDroplet\",\n \"Sofa\",\n \"SolarPanel\",\n \"SortAsc\",\n \"SortDesc\",\n \"Soup\",\n \"Space\",\n \"Spade\",\n \"Sparkle\",\n \"Sparkles\",\n \"Speaker\",\n \"Speech\",\n \"SpellCheck\",\n \"SpellCheck2\",\n \"Spline\",\n \"SplinePointer\",\n \"Split\",\n \"SplitSquareHorizontal\",\n \"SplitSquareVertical\",\n \"Spool\",\n \"SportShoe\",\n \"Spotlight\",\n \"SprayCan\",\n \"Sprout\",\n \"Square\",\n \"SquareActivity\",\n \"SquareArrowDown\",\n \"SquareArrowDownLeft\",\n \"SquareArrowDownRight\",\n \"SquareArrowLeft\",\n \"SquareArrowOutDownLeft\",\n \"SquareArrowOutDownRight\",\n \"SquareArrowOutUpLeft\",\n \"SquareArrowOutUpRight\",\n \"SquareArrowRight\",\n \"SquareArrowRightEnter\",\n \"SquareArrowRightExit\",\n \"SquareArrowUp\",\n \"SquareArrowUpLeft\",\n \"SquareArrowUpRight\",\n \"SquareAsterisk\",\n \"SquareBottomDashedScissors\",\n \"SquareCenterlineDashedHorizontal\",\n \"SquareCenterlineDashedVertical\",\n \"SquareChartGantt\",\n \"SquareCheck\",\n \"SquareCheckBig\",\n \"SquareChevronDown\",\n \"SquareChevronLeft\",\n \"SquareChevronRight\",\n \"SquareChevronUp\",\n \"SquareCode\",\n \"SquareDashed\",\n \"SquareDashedBottom\",\n \"SquareDashedBottomCode\",\n \"SquareDashedKanban\",\n \"SquareDashedMousePointer\",\n \"SquareDashedText\",\n \"SquareDashedTopSolid\",\n \"SquareDivide\",\n \"SquareDot\",\n \"SquareEqual\",\n \"SquareFunction\",\n \"SquareGanttChart\",\n \"SquareKanban\",\n \"SquareLibrary\",\n \"SquareM\",\n \"SquareMenu\",\n \"SquareMinus\",\n \"SquareMousePointer\",\n \"SquareParking\",\n \"SquareParkingOff\",\n \"SquarePause\",\n \"SquarePen\",\n \"SquarePercent\",\n \"SquarePi\",\n \"SquarePilcrow\",\n \"SquarePlay\",\n \"SquarePlus\",\n \"SquarePower\",\n \"SquareRadical\",\n \"SquareRoundCorner\",\n \"SquareScissors\",\n \"SquareSigma\",\n \"SquareSlash\",\n \"SquareSplitHorizontal\",\n \"SquareSplitVertical\",\n \"SquareSquare\",\n \"SquareStack\",\n \"SquareStar\",\n \"SquareStop\",\n \"SquareTerminal\",\n \"SquareUser\",\n \"SquareUserRound\",\n \"SquareX\",\n \"SquaresExclude\",\n \"SquaresIntersect\",\n \"SquaresSubtract\",\n \"SquaresUnite\",\n \"Squircle\",\n \"SquircleDashed\",\n \"Squirrel\",\n \"Stamp\",\n \"Star\",\n \"StarHalf\",\n \"StarOff\",\n \"Stars\",\n \"StepBack\",\n \"StepForward\",\n \"Stethoscope\",\n \"Sticker\",\n \"StickyNote\",\n \"Stone\",\n \"StopCircle\",\n \"Store\",\n \"StretchHorizontal\",\n \"StretchVertical\",\n \"Strikethrough\",\n \"Subscript\",\n \"Subtitles\",\n \"Sun\",\n \"SunDim\",\n \"SunMedium\",\n \"SunMoon\",\n \"SunSnow\",\n \"Sunrise\",\n \"Sunset\",\n \"Superscript\",\n \"SwatchBook\",\n \"SwissFranc\",\n \"SwitchCamera\",\n \"Sword\",\n \"Swords\",\n \"Syringe\",\n \"Table\",\n \"Table2\",\n \"TableCellsMerge\",\n \"TableCellsSplit\",\n \"TableColumnsSplit\",\n \"TableConfig\",\n \"TableOfContents\",\n \"TableProperties\",\n \"TableRowsSplit\",\n \"Tablet\",\n \"TabletSmartphone\",\n \"Tablets\",\n \"Tag\",\n \"Tags\",\n \"Tally1\",\n \"Tally2\",\n \"Tally3\",\n \"Tally4\",\n \"Tally5\",\n \"Tangent\",\n \"Target\",\n \"Telescope\",\n \"Tent\",\n \"TentTree\",\n \"Terminal\",\n \"TerminalSquare\",\n \"TestTube\",\n \"TestTube2\",\n \"TestTubeDiagonal\",\n \"TestTubes\",\n \"Text\",\n \"TextAlignCenter\",\n \"TextAlignEnd\",\n \"TextAlignJustify\",\n \"TextAlignStart\",\n \"TextCursor\",\n \"TextCursorInput\",\n \"TextInitial\",\n \"TextQuote\",\n \"TextSearch\",\n \"TextSelect\",\n \"TextSelection\",\n \"TextWrap\",\n \"Theater\",\n \"Thermometer\",\n \"ThermometerSnowflake\",\n \"ThermometerSun\",\n \"ThumbsDown\",\n \"ThumbsUp\",\n \"Ticket\",\n \"TicketCheck\",\n \"TicketMinus\",\n \"TicketPercent\",\n \"TicketPlus\",\n \"TicketSlash\",\n \"TicketX\",\n \"Tickets\",\n \"TicketsPlane\",\n \"Timeline\",\n \"Timer\",\n \"TimerOff\",\n \"TimerReset\",\n \"ToggleLeft\",\n \"ToggleRight\",\n \"Toilet\",\n \"ToolCase\",\n \"Toolbox\",\n \"Tornado\",\n \"Torus\",\n \"Touchpad\",\n \"TouchpadOff\",\n \"TowelRack\",\n \"TowerControl\",\n \"ToyBrick\",\n \"Tractor\",\n \"TrafficCone\",\n \"Train\",\n \"TrainFront\",\n \"TrainFrontTunnel\",\n \"TrainTrack\",\n \"TramFront\",\n \"Transgender\",\n \"Trash\",\n \"Trash2\",\n \"TreeDeciduous\",\n \"TreePalm\",\n \"TreePine\",\n \"Trees\",\n \"TrendingDown\",\n \"TrendingUp\",\n \"TrendingUpDown\",\n \"Triangle\",\n \"TriangleAlert\",\n \"TriangleDashed\",\n \"TriangleRight\",\n \"Trophy\",\n \"Truck\",\n \"TruckElectric\",\n \"TurkishLira\",\n \"Turntable\",\n \"Turtle\",\n \"Tv\",\n \"Tv2\",\n \"TvMinimal\",\n \"TvMinimalPlay\",\n \"Type\",\n \"TypeOutline\",\n \"Umbrella\",\n \"UmbrellaOff\",\n \"Underline\",\n \"Undo\",\n \"Undo2\",\n \"UndoDot\",\n \"UnfoldHorizontal\",\n \"UnfoldVertical\",\n \"Ungroup\",\n \"University\",\n \"Unlink\",\n \"Unlink2\",\n \"Unlock\",\n \"UnlockKeyhole\",\n \"Unplug\",\n \"Upload\",\n \"UploadCloud\",\n \"Usb\",\n \"User\",\n \"User2\",\n \"UserCheck\",\n \"UserCheck2\",\n \"UserCircle\",\n \"UserCircle2\",\n \"UserCog\",\n \"UserCog2\",\n \"UserKey\",\n \"UserLock\",\n \"UserMinus\",\n \"UserMinus2\",\n \"UserPen\",\n \"UserPlus\",\n \"UserPlus2\",\n \"UserRound\",\n \"UserRoundCheck\",\n \"UserRoundCog\",\n \"UserRoundKey\",\n \"UserRoundMinus\",\n \"UserRoundPen\",\n \"UserRoundPlus\",\n \"UserRoundSearch\",\n \"UserRoundX\",\n \"UserSearch\",\n \"UserSquare\",\n \"UserSquare2\",\n \"UserStar\",\n \"UserX\",\n \"UserX2\",\n \"Users\",\n \"Users2\",\n \"UsersRound\",\n \"Utensils\",\n \"UtensilsCrossed\",\n \"UtilityPole\",\n \"Van\",\n \"Variable\",\n \"Vault\",\n \"VectorSquare\",\n \"Vegan\",\n \"VenetianMask\",\n \"Venus\",\n \"VenusAndMars\",\n \"Verified\",\n \"Vibrate\",\n \"VibrateOff\",\n \"Video\",\n \"VideoOff\",\n \"Videotape\",\n \"View\",\n \"Voicemail\",\n \"Volleyball\",\n \"Volume\",\n \"Volume1\",\n \"Volume2\",\n \"VolumeOff\",\n \"VolumeX\",\n \"Vote\",\n \"Wallet\",\n \"Wallet2\",\n \"WalletCards\",\n \"WalletMinimal\",\n \"Wallpaper\",\n \"Wand\",\n \"Wand2\",\n \"WandSparkles\",\n \"Warehouse\",\n \"WashingMachine\",\n \"Watch\",\n \"Waves\",\n \"WavesArrowDown\",\n \"WavesArrowUp\",\n \"WavesHorizontal\",\n \"WavesLadder\",\n \"WavesVertical\",\n \"Waypoints\",\n \"Webcam\",\n \"Webhook\",\n \"WebhookOff\",\n \"Weight\",\n \"WeightTilde\",\n \"Wheat\",\n \"WheatOff\",\n \"WholeWord\",\n \"Wifi\",\n \"WifiCog\",\n \"WifiHigh\",\n \"WifiLow\",\n \"WifiOff\",\n \"WifiPen\",\n \"WifiSync\",\n \"WifiZero\",\n \"Wind\",\n \"WindArrowDown\",\n \"Wine\",\n \"WineOff\",\n \"Workflow\",\n \"Worm\",\n \"WrapText\",\n \"Wrench\",\n \"X\",\n \"XCircle\",\n \"XLineTop\",\n \"XOctagon\",\n \"XSquare\",\n \"Zap\",\n \"ZapOff\",\n \"ZodiacAquarius\",\n \"ZodiacAries\",\n \"ZodiacCancer\",\n \"ZodiacCapricorn\",\n \"ZodiacGemini\",\n \"ZodiacLeo\",\n \"ZodiacLibra\",\n \"ZodiacOphiuchus\",\n \"ZodiacPisces\",\n \"ZodiacSagittarius\",\n \"ZodiacScorpio\",\n \"ZodiacTaurus\",\n \"ZodiacVirgo\",\n \"ZoomIn\",\n \"ZoomOut\"\n];\n","export const coolIconKeys: string[] = [\n \"Rows4\", \"Video\",\n \"Plane\", \"LayoutDashboard\", \"LayoutGrid\", \"Square\", \"Snowflake\",\n \"CircleDashed\", \"AlignCenterHorizontal\", \"Disc\", \"Infinity\",\n \"Maximize\", \"Play\", \"Sparkles\", \"Music\",\n \"Wallet\", \"Layout\", \"Zap\", \"Circle\", \"Coffee\",\n \"ImageOff\", \"Sun\", \"Cable\", \"CalendarDays\",\n \"Dices\", \"Shapes\", \"Cloud\", \"Palette\",\n \"CreditCard\", \"Headphones\", \"Egg\", \"Disc3\", \"Flag\",\n \"Bandage\", \"Thermometer\", \"Hexagon\", \"Network\", \"Library\", \"Pizza\",\n \"Cpu\", \"Plug\", \"Files\", \"Globe\", \"SignalZero\",\n \"Gamepad2\", \"CloudLightning\", \"ListTree\", \"Command\"];\n","\"use client\";\n\nexport type IconColor = \"inherit\" | \"primary\" | \"secondary\" | \"disabled\" | \"error\" | \"success\" | \"warning\";\nexport type IconSize = \"smallest\" | \"small\" | \"medium\" | \"large\";\n\n/**\n * Standardized icon size map in px.\n * Use with direct Lucide imports: `<Database size={iconSize.small} />`\n */\nexport const iconSize = {\n smallest: 16,\n small: 20,\n medium: 24,\n large: 28\n} as const satisfies Record<IconSize, number>;\n\nexport type IconProps = {\n size?: IconSize | number,\n color?: IconColor,\n className?: string,\n onClick?: (e: React.SyntheticEvent) => void,\n style?: React.CSSProperties,\n}\n\nexport const colorClassesMapping: Record<IconColor, string> = {\n inherit: \"\",\n primary: \"text-primary\",\n success: \"text-green-500\",\n warning: \"text-yellow-500\",\n secondary: \"text-secondary\",\n disabled: \"text-text-disabled dark:text-text-disabled-dark\",\n error: \"text-red-500\"\n}\n","import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function GitHubIcon({ size = 24, color, className, onClick, style }: IconProps) {\n // `size` is `IconSize | number` — resolve the keyword, or an SVG attribute\n // of width=\"small\" is emitted and the icon renders at its intrinsic size.\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n fill={\"currentColor\"}\n width={px}\n height={px}\n viewBox=\"0 0 24 24\">\n <path\n d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\"/>\n </svg>;\n}\n","import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function HandleIcon({ size = 24, color, className, onClick, style }: IconProps) {\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n width={px}\n height={px}\n viewBox=\"0 0 100 100\"\n fill=\"none\">\n <circle cx=\"28\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n </svg>;\n}\n","\"use client\";\n\nimport React from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\n\n/**\n * Rendering a Lucide icon chosen at runtime, without shipping all 1,600 of them\n * on the login screen.\n *\n * `@rebasepro/ui` used to re-export lucide's whole `icons` map:\n *\n * export { icons as lucideIcons } from \"lucide-react\";\n *\n * That map is an object literal holding a reference to every icon component in\n * the library, so a tree-shaker cannot drop a single one — reaching the map\n * reaches all of them. Two callers reached it, both by name lookup: `getIcon`\n * in `@rebasepro/app` (a collection's `icon: \"ShoppingCart\"`) and the admin's\n * icon picker. That put 822 kB of SVG components into the entry chunk's static\n * graph, `modulepreload`ed before authentication.\n *\n * The ~130 icons the product's own chrome uses are still plain named imports\n * from `lucide-react`, which tree-shake to just those. Only the by-name lookup\n * goes through here, and it pays for the map once, asynchronously, the first\n * time a runtime-chosen icon is rendered.\n */\n\ntype IconsMap = Record<string, LucideIcon | undefined>;\n\nlet loaded: IconsMap | undefined;\nlet pending: Promise<IconsMap> | undefined;\n\n/**\n * The full lucide icon map, fetched on first use and cached for the session.\n *\n * Prefer {@link LucideIconByName}. This is here for callers that need to know\n * whether a name resolves, such as the icon picker's grid.\n */\nexport function loadLucideIcons(): Promise<IconsMap> {\n if (loaded) return Promise.resolve(loaded);\n pending ??= import(\"lucide-react\").then(({ icons }) => {\n loaded = icons as IconsMap;\n return loaded;\n });\n return pending;\n}\n\n/** The map if it has already been fetched, otherwise `undefined`. Never fetches. */\nexport function getLoadedLucideIcons(): IconsMap | undefined {\n return loaded;\n}\n\n/**\n * Subscribe to the icon map.\n *\n * Returns it synchronously once loaded — including on the very first render of\n * every icon after the first one anywhere, which is what stops a page full of\n * icons from each flashing its placeholder.\n */\nexport function useLucideIcons(): IconsMap | undefined {\n const [map, setMap] = React.useState<IconsMap | undefined>(loaded);\n React.useEffect(() => {\n if (map) return;\n let cancelled = false;\n loadLucideIcons()\n .then(resolved => { if (!cancelled) setMap(resolved); })\n .catch(error => console.error(\"[rebase] could not load the icon set\", error));\n return () => { cancelled = true; };\n }, [map]);\n return map;\n}\n\nfunction toPascalCase(str: string): string {\n return str.split(/[-_]/).map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(\"\");\n}\n\n/**\n * The same resolution order the two call sites used against the eager map:\n * exact name, then PascalCase, then `CircleAlert` as the visible \"unknown icon\".\n */\nexport function resolveLucideIcon(icons: IconsMap, name: string): LucideIcon | undefined {\n return icons[name] ?? icons[toPascalCase(name)] ?? icons.CircleAlert;\n}\n\nexport type LucideIconByNameProps = {\n /**\n * A PascalCase lucide icon name, e.g. `\"ShoppingCart\"`. Whether a name\n * exists can be answered ahead of the fetch with `iconKeys`, which is a\n * plain string array and costs nothing.\n */\n name: string;\n size?: number;\n className?: string;\n /** Rendered while the icon set is in flight. Defaults to a blank box of `size`. */\n fallback?: React.ReactNode;\n};\n\n/**\n * An icon named at runtime. Renders `fallback` until the icon set arrives.\n */\nexport const LucideIconByName = React.memo(\n function LucideIconByName({ name, size, className, fallback }: LucideIconByNameProps) {\n const icons = useLucideIcons();\n const Icon = icons ? resolveLucideIcon(icons, name) : undefined;\n\n if (!Icon) {\n if (fallback !== undefined) return <>{fallback}</>;\n // A box of the right size, so the layout does not jump when the\n // icon lands.\n return <span aria-hidden={true}\n className={\"inline-block shrink-0\"}\n style={{ width: size, height: size }}/>;\n }\n\n return <Icon size={size}\n className={className}/>;\n }\n);\n","import * as React from \"react\";\nimport { cls } from \"../util\";\nimport { AlertCircleIcon, AlertTriangleIcon, CheckCircleIcon, InfoIcon, XIcon } from \"../icons\";\n\nexport interface AlertProps {\n children: React.ReactNode;\n onDismiss?: () => void;\n color?: \"error\" | \"warning\" | \"info\" | \"success\" | \"base\";\n size?: \"small\" | \"medium\" | \"large\";\n action?: React.ReactNode;\n className?: string;\n outerClassName?: string;\n style?: React.CSSProperties;\n}\n\nconst getSizeClasses = (size: \"small\" | \"medium\" | \"large\") => {\n switch (size) {\n case \"small\":\n return \"px-3 py-1.5 text-xs gap-2 rounded-md\";\n case \"large\":\n return \"px-4 py-3.5 text-sm gap-3 rounded-lg\";\n case \"medium\":\n default:\n return \"px-3.5 py-2.5 text-sm gap-2.5 rounded-lg\";\n }\n}\n\nconst getIconSize = (size: \"small\" | \"medium\" | \"large\") => size === \"small\" ? 16 : 18;\n\nconst getColorClasses = (severity: string) => {\n switch (severity) {\n case \"error\":\n return \"bg-red-500/8 dark:bg-red-500/12 text-red-800 dark:text-red-200 border border-red-500/20 dark:border-red-500/25\";\n case \"warning\":\n return \"bg-amber-500/8 dark:bg-amber-500/12 text-amber-800 dark:text-amber-200 border border-amber-500/20 dark:border-amber-500/25\";\n case \"info\":\n return \"bg-blue-500/8 dark:bg-blue-500/12 text-blue-800 dark:text-blue-200 border border-blue-500/20 dark:border-blue-500/25\";\n case \"success\":\n return \"bg-emerald-500/8 dark:bg-emerald-500/12 text-emerald-800 dark:text-emerald-200 border border-emerald-500/20 dark:border-emerald-500/25\";\n case \"base\":\n default:\n return \"bg-surface-field text-text-primary dark:text-text-primary-dark border border-hairline\";\n }\n};\n\nconst getIconColor = (severity: string) => {\n switch (severity) {\n case \"error\":\n return \"text-red-500 dark:text-red-400\";\n case \"warning\":\n return \"text-amber-500 dark:text-amber-400\";\n case \"info\":\n return \"text-blue-500 dark:text-blue-400\";\n case \"success\":\n return \"text-emerald-500 dark:text-emerald-400\";\n case \"base\":\n default:\n return \"text-surface-accent-500 dark:text-surface-accent-400\";\n }\n};\n\nconst getIcon = (severity: string, size: number, className: string) => {\n switch (severity) {\n case \"error\":\n return <AlertCircleIcon size={size} className={className}/>;\n case \"warning\":\n return <AlertTriangleIcon size={size} className={className}/>;\n case \"success\":\n return <CheckCircleIcon size={size} className={className}/>;\n case \"info\":\n case \"base\":\n default:\n return <InfoIcon size={size} className={className}/>;\n }\n};\n\nexport const Alert: React.FC<AlertProps> = ({\n children,\n onDismiss,\n color = \"info\",\n size = \"medium\",\n action,\n outerClassName,\n className,\n style\n }) => {\n const classes = getColorClasses(color);\n const iconSize = getIconSize(size);\n\n return (\n <div\n style={style}\n className={cls(\n getSizeClasses(size),\n \"w-full\",\n \"font-medium leading-snug\",\n \"flex items-start\",\n classes,\n outerClassName)}>\n <span className={cls(\"shrink-0 mt-px\", getIconColor(color))}>\n {getIcon(color, iconSize, \"\")}\n </span>\n <div className={cls(\"grow min-w-0 self-center\", className)}>{children}</div>\n {action}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n className={cls(\n \"shrink-0 rounded p-0.5 opacity-60 transition-opacity hover:opacity-100\",\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-current/40\")}\n onClick={onDismiss}>\n <XIcon size={iconSize - 2}/>\n </button>\n )}\n </div>\n );\n};\n","\"use client\";\nimport React, { useState } from \"react\";\nimport { cls } from \"../util\";\n\nexport interface AvatarProps {\n src?: string;\n alt?: string;\n children?: React.ReactNode;\n className?: string;\n outerClassName?: string;\n hover?: boolean;\n style?: React.CSSProperties;\n}\n\nconst AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps> = (\n {\n src,\n alt,\n children,\n className,\n style,\n outerClassName,\n hover = true,\n ...props\n },\n ref\n) => {\n const [isImageError, setIsImageError] = useState(false);\n\n const handleImageError = () => {\n setIsImageError(true);\n };\n\n return (\n <button\n ref={ref}\n style={style}\n {...props}\n className={cls(\n \"rounded-full flex items-center justify-center overflow-hidden\",\n \"p-1 w-12 h-12 min-w-12 min-h-12\",\n hover && \"transition-colors duration-150 hover:bg-surface-raised-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\",\n outerClassName\n )}\n >\n {src && !isImageError ? (\n <img\n className={cls(\n \"bg-surface-raised\",\n \"w-full h-full object-cover rounded-full\",\n className\n )}\n src={src}\n alt={alt}\n onError={handleImageError}\n />\n ) : (\n <span\n className={cls(\n \"bg-surface-raised\",\n \"flex items-center justify-center\",\n \"w-full h-full py-1.5 text-lg font-medium text-surface-accent-900 dark:text-text-primary-dark rounded-full\",\n className\n )}\n >\n {children}\n </span>\n )}\n </button>\n );\n};\n\nexport const Avatar = React.forwardRef(AvatarInner);\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\n\n/**\n * Switch geometry, one row per size: track w x h, knob k, and the knob's\n * off/on x-offsets. `on` is always `w - k - inset` so the knob is inset by the\n * same amount at both ends and vertically centred.\n *\n * This is a table rather than inline `cls({...})` conditions on purpose. The\n * offsets used to be computed object keys — `[value ? \"translate-x-[24px]\" :\n * \"translate-x-[3px]\"]: size === \"large\"` — and `large` and `medium` both\n * produced the key `translate-x-[3px]` when off. The later literal overwrote\n * the earlier, so the off-state class was silently dropped for `large` and the\n * knob sat flush against the edge.\n */\nconst SWITCH_GEOMETRY = {\n smallest: {\n track: \"w-[34px] h-[18px] min-w-[34px] min-h-[18px]\",\n knob: \"w-[16px] h-[16px]\", off: \"translate-x-[1px]\", on: \"translate-x-[17px]\",\n bar: \"w-[16px] h-[6px]\", barX: \"translate-x-[9px]\"\n },\n small: {\n track: \"w-[38px] h-[22px] min-w-[38px] min-h-[22px]\",\n knob: \"w-[18px] h-[18px]\", off: \"translate-x-[2px]\", on: \"translate-x-[18px]\",\n bar: \"w-[18px] h-[8px]\", barX: \"translate-x-[10px]\"\n },\n medium: {\n track: \"w-[44px] h-[26px] min-w-[44px] min-h-[26px]\",\n knob: \"w-[20px] h-[20px]\", off: \"translate-x-[3px]\", on: \"translate-x-[21px]\",\n bar: \"w-[20px] h-[10px]\", barX: \"translate-x-[12px]\"\n },\n large: {\n track: \"w-[48px] h-[28px] min-w-[48px] min-h-[28px]\",\n knob: \"w-[22px] h-[22px]\", off: \"translate-x-[3px]\", on: \"translate-x-[23px]\",\n bar: \"w-[22px] h-[11px]\", barX: \"translate-x-[13px]\"\n }\n} as const;\n\nexport type BooleanSwitchProps = {\n value: boolean | null;\n className?: string;\n disabled?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n} & ({\n allowIndeterminate: true;\n onValueChange?: (newValue: boolean | null) => void;\n} | {\n allowIndeterminate?: false;\n onValueChange?: (newValue: boolean) => void;\n});\n\nexport const BooleanSwitch = React.forwardRef(function BooleanSwitch({\n value,\n allowIndeterminate,\n className,\n onValueChange,\n disabled = false,\n size = \"medium\",\n ...props\n }: BooleanSwitchProps, ref: React.Ref<HTMLButtonElement>) {\n return <button\n type=\"button\"\n role=\"switch\"\n aria-checked={allowIndeterminate && (value === null || value === undefined) ? \"mixed\" : !!value}\n aria-disabled={disabled || undefined}\n ref={ref}\n tabIndex={disabled ? -1 : undefined}\n onClick={disabled\n ? (e) => e.preventDefault()\n : (e) => {\n e.preventDefault();\n if (allowIndeterminate) {\n if (value === null || value === undefined) onValueChange?.(true)\n else if (value) onValueChange?.(false)\n else onValueChange?.(null);\n } else {\n onValueChange?.(!value);\n }\n }}\n className={cls(\n // `large` used to share the `medium` branch, so the two sizes\n // rendered identically and the prop looked inert. Geometry is\n // now derived from one table (see SWITCH_GEOMETRY) so the knob\n // inset is symmetric at every size.\n SWITCH_GEOMETRY[size].track,\n \"outline-none outline-hidden rounded-full relative shadow-sm\",\n // On is the primary, not the secondary rose: a boolean is the one\n // place the product turns a hue into a value, and the hue it uses\n // should be the one that means \"yes\" everywhere else (the primary\n // button, the checked checkbox). The rose stays a marketing token.\n // Off is the neutral `active` fill with a strong hairline, so the\n // track is visible on every surface without a fill of its own;\n // disabled keeps its state legible at reduced strength.\n disabled\n ? (value ? \"bg-primary/40 ring-1 ring-transparent\" : \"bg-surface-field ring-1 ring-hairline\")\n : (value ? \"bg-primary ring-1 ring-primary\" : \"bg-surface-active ring-1 ring-hairline-strong\"),\n className\n )}\n {...props}\n >\n {allowIndeterminate && (value === null || value === undefined) && <div\n key={\"knob\"}\n className={cls(\n \"block rounded-full transition-transform duration-100 ease-out transform will-change-auto shadow-sm\",\n // A glyph on the track, not a surface: the numbered grey is the\n // knob's own colour on both themes.\n \"bg-surface-400\",\n SWITCH_GEOMETRY[size].bar,\n SWITCH_GEOMETRY[size].barX\n )}\n />}\n\n {!(allowIndeterminate && (value === null || value === undefined)) && <div\n key={\"knob\"}\n className={cls(\n \"block rounded-full transition-transform duration-100 ease-out transform will-change-auto shadow-sm\",\n disabled ? \"bg-surface-300 dark:bg-surface-600\" : (value ? \"bg-white shadow\" : \"bg-surface-500 dark:bg-surface-400\"),\n SWITCH_GEOMETRY[size].knob,\n value ? SWITCH_GEOMETRY[size].on : SWITCH_GEOMETRY[size].off\n )}\n />}\n </button>;\n }\n) as React.ForwardRefExoticComponent<BooleanSwitchProps & React.RefAttributes<HTMLButtonElement>>;\n","\"use client\";\nimport React from \"react\";\nimport {\n controlHeightMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundMixin,\n focusedClasses\n} from \"../styles\";\nimport { BooleanSwitch, BooleanSwitchProps } from \"./BooleanSwitch\";\nimport { cls } from \"../util\";\n\nexport type BooleanSwitchWithLabelProps = BooleanSwitchProps & {\n position?: \"start\" | \"end\",\n invisible?: boolean,\n label?: React.ReactNode,\n error?: boolean,\n autoFocus?: boolean,\n fullWidth?: boolean,\n className?: string,\n inputClassName?: string,\n};\n\n/**\n * Simple boolean switch.\n *\n */\nexport const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({\n value,\n position = \"end\",\n size = \"medium\",\n invisible,\n onValueChange,\n error,\n label,\n autoFocus,\n disabled,\n className,\n fullWidth = true,\n inputClassName,\n ...props\n }: BooleanSwitchWithLabelProps) {\n\n const ref = React.useRef<HTMLDivElement | null>(null);\n const refInput = React.useRef<HTMLButtonElement | null>(null);\n const switchLabelId = React.useId();\n const [_, setFocused] = React.useState(autoFocus)\n const onFocus = () => setFocused(true);\n const onBlur = () => setFocused(false);\n\n React.useEffect(() => {\n if (autoFocus) {\n // refInput.current?.focus();\n }\n }, []);\n\n const focus = document.activeElement === refInput?.current || document.activeElement === ref?.current\n\n return (\n <div\n ref={ref}\n onFocus={onFocus}\n onBlur={onBlur}\n role=\"switch\"\n aria-checked={props.allowIndeterminate && (value === null || value === undefined) ? \"mixed\" : !!value}\n aria-disabled={disabled || undefined}\n aria-labelledby={label ? switchLabelId : undefined}\n tabIndex={-1}\n className={cls(\n !invisible && fieldBackgroundMixin,\n !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),\n disabled ? \"cursor-default\" : \"cursor-pointer\",\n \"rounded-lg max-w-full justify-between box-border relative inline-flex items-center\",\n !invisible && focus && !disabled ? focusedClasses : \"\",\n error ? \"text-red-500 dark:text-red-600\" : (focus && !disabled ? \"text-primary\" : (!disabled ? \"text-text-primary dark:text-text-primary-dark\" : \"text-text-secondary dark:text-text-secondary-dark\")),\n // The one control size scale — 28/32/40/48. This component still\n // carried its own map (…/44/64), so a switch at `large` stood\n // 16px taller than the text field beside it, which read as a\n // giant empty box once the label moved out of the control.\n controlHeightMixin[size],\n size === \"small\" || size === \"smallest\" ? \"pl-2\" : \"pl-4\",\n size === \"small\" || size === \"smallest\" ? \"pr-4\" : \"pr-6\",\n position === \"end\" ? \"flex-row-reverse\" : \"flex-row\",\n fullWidth ? \"w-full\" : \"\",\n className\n )}\n onClick={disabled ? undefined : (e) => {\n if (props.allowIndeterminate) {\n const onChange = onValueChange as ((newValue: boolean | null) => void) | undefined;\n if (value === null || value === undefined) onChange?.(true)\n else if (value) onChange?.(false)\n else onChange?.(null);\n } else {\n onValueChange?.(!value);\n }\n // refInput.current?.focus();\n }}\n >\n\n <BooleanSwitch\n value={value}\n ref={refInput}\n size={size}\n className={cls(invisible && focus ? focusedClasses : \"\", inputClassName)}\n disabled={disabled}\n {...props}\n />\n\n <div id={switchLabelId} className={cls(\n \"grow\",\n position === \"end\" ? \"mr-4\" : \"ml-4\",\n size === \"small\" || size === \"smallest\" ? \"text-sm\" : \"text-base\"\n )}>\n {label}\n </div>\n\n </div>\n\n );\n};\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\nimport { type ButtonSize, controlHeightMixin, controlPaddingMixin } from \"../styles\";\n\nexport type ButtonProps<C extends React.ElementType = \"button\"> = {\n children?: React.ReactNode;\n variant?: \"filled\" | \"outlined\" | \"text\";\n disabled?: boolean;\n color?: \"primary\" | \"secondary\" | \"text\" | \"error\" | \"neutral\";\n size?: ButtonSize;\n startIcon?: React.ReactNode;\n fullWidth?: boolean;\n className?: string;\n component?: C;\n onClick?: React.MouseEventHandler<HTMLElement>;\n} & React.ComponentPropsWithoutRef<C>;\n\nconst ButtonInner = React.memo(React.forwardRef<\n HTMLButtonElement,\n ButtonProps<React.ElementType>\n>(({\n children,\n className,\n variant = \"filled\",\n disabled = false,\n size = \"medium\",\n startIcon = null,\n fullWidth = false,\n component: Component,\n color = \"neutral\",\n ...props\n }: ButtonProps<React.ElementType>, ref) => {\n\n const baseClasses =\n \"typography-button h-fit rounded-lg whitespace-nowrap inline-flex items-center justify-center p-2 px-4 focus:outline-none transition-colors ease-in-out duration-150 gap-2\";\n\n const buttonClasses = cls({\n \"w-full\": fullWidth,\n \"w-fit\": !fullWidth,\n\n // Filled Variants\n \"border border-primary bg-primary focus:ring-primary text-white hover:text-white hover:brightness-105\": variant === \"filled\" && color === \"primary\" && !disabled,\n \"border border-secondary bg-secondary focus:ring-secondary text-white hover:text-white hover:brightness-105\": variant === \"filled\" && color === \"secondary\" && !disabled,\n \"border border-red-600 bg-red-600 hover:bg-red-700 focus:ring-red-600 text-white hover:text-white\": variant === \"filled\" && color === \"error\" && !disabled,\n \"border border-hairline-strong bg-surface-raised hover:bg-surface-raised-hover text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark\": variant === \"filled\" && color === \"text\" && !disabled,\n \"border border-transparent bg-surface-raised hover:bg-surface-raised-hover text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark\": variant === \"filled\" && color === \"neutral\" && !disabled,\n\n // Text Variants\n \"border border-transparent text-primary hover:text-primary hover:bg-surface-hover\": variant === \"text\" && color === \"primary\" && !disabled,\n \"border border-transparent text-secondary hover:text-secondary hover:bg-surface-hover\": variant === \"text\" && color === \"secondary\" && !disabled,\n \"border border-transparent text-red-600 hover:text-red-600 hover:bg-red-600 hover:bg-opacity-10 hover:bg-red-600/10\": variant === \"text\" && color === \"error\" && !disabled,\n \"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"text\" && color === \"text\" && !disabled,\n \"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark dark:hover:text-text-primary-dark hover:bg-surface-hover\": variant === \"text\" && color === \"neutral\" && !disabled,\n\n // Outlined Variants\n \"border border-primary text-primary hover:text-primary hover:bg-primary-bg hover:bg-primary/10\": variant === \"outlined\" && color === \"primary\" && !disabled,\n \"border border-secondary text-secondary hover:text-secondary hover:bg-secondary-bg\": variant === \"outlined\" && color === \"secondary\" && !disabled,\n \"border border-red-500 text-red-600 hover:text-white hover:bg-red-600\": variant === \"outlined\" && color === \"error\" && !disabled,\n \"border border-hairline-strong text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"outlined\" && color === \"text\" && !disabled,\n \"border border-hairline-strong text-text-primary dark:text-text-primary-dark hover:bg-surface-hover\": variant === \"outlined\" && color === \"neutral\" && !disabled,\n\n // Disabled states for all variants\n \"text-text-disabled dark:text-text-disabled-dark\": disabled,\n \"border border-transparent opacity-50\": variant === \"text\" && disabled,\n \"border border-hairline-strong opacity-50\": variant === \"outlined\" && disabled,\n \"border border-transparent bg-surface-raised\": variant === \"filled\" && disabled\n });\n\n // Height comes from the shared control scale (see styles.ts) so a Button\n // and a TextField at the same `size` line up. Vertical padding is dropped:\n // the button is an inline-flex box centring its content inside min-height.\n const sizeClasses = cls(\"py-0\", controlHeightMixin[size], controlPaddingMixin[size]);\n\n const iconColorClass = (color === \"neutral\" || color === \"text\") && !disabled\n ? \"[&>svg]:text-surface-accent-500 dark:[&>svg]:text-surface-accent-300\"\n : \"\";\n\n if (Component) {\n return (\n <Component\n ref={ref}\n onClick={props.onClick}\n className={cls(startIcon ? \"pl-3\" : \"\", baseClasses, buttonClasses, sizeClasses, iconColorClass, className)}\n {...props}>\n {startIcon}\n {children}\n </Component>\n );\n }\n\n return (\n <button ref={ref as React.Ref<HTMLButtonElement>}\n type={props.type ?? \"button\"}\n onClick={props.onClick}\n className={cls(startIcon ? \"pl-3\" : \"\", baseClasses, buttonClasses, sizeClasses, iconColorClass, className)}\n disabled={disabled}\n data-variant={variant}\n data-size={size}\n {...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>\n {startIcon}\n {children}\n </button>\n );\n\n}));\n\nButtonInner.displayName = \"Button\"\n\nexport const Button = ButtonInner as React.FC<ButtonProps<React.ElementType>>;\n","\"use client\";\nimport React, { useCallback } from \"react\";\nimport { cardClickableMixin, cardMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\ntype CardProps = {\n children: React.ReactNode;\n style?: React.CSSProperties;\n onClick?: (e?: React.MouseEvent) => void;\n className?: string;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({\n children,\n className,\n onClick,\n style,\n ...props\n}, ref) => {\n const onKeyPress = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n onClick?.();\n }\n }, [onClick]);\n\n return (\n <div\n ref={ref}\n onKeyPress={onKeyPress}\n role={onClick ? \"button\" : undefined}\n tabIndex={onClick ? 0 : undefined}\n onClick={onClick}\n className={cls(cardMixin, onClick && cardClickableMixin, className)}\n style={style}\n {...props}>\n {children}\n </div>\n );\n});\n\nCard.displayName = \"Card\";\n\nexport { Card };\n","\"use client\";\nimport React, { ForwardRefRenderFunction } from \"react\";\nimport { cls } from \"../util\";\n\nexport type ContainerProps = {\n children: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n maxWidth?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n}\n\nconst containerMaxWidths = {\n xs: \"max-w-xs\",\n sm: \"max-w-sm\",\n md: \"max-w-md\",\n lg: \"max-w-lg\",\n xl: \"max-w-xl\",\n \"2xl\": \"max-w-2xl\",\n \"3xl\": \"max-w-3xl\",\n \"4xl\": \"max-w-4xl\",\n \"5xl\": \"max-w-5xl\",\n \"6xl\": \"max-w-6xl\",\n \"7xl\": \"max-w-7xl\"\n}\n\nconst ContainerInner: ForwardRefRenderFunction<HTMLDivElement, ContainerProps> = (\n {\n children,\n className,\n style,\n maxWidth = \"7xl\"\n },\n ref\n) => {\n\n const classForMaxWidth = maxWidth ? containerMaxWidths[maxWidth] : \"\";\n\n return (\n <div\n ref={ref}\n className={cls(\"mx-auto px-3 md:px-4 lg:px-6\",\n classForMaxWidth,\n className)}\n style={style}>\n {children}\n </div>\n );\n}\n\nexport const Container = React.forwardRef(ContainerInner);\n\n","\"use client\";\nimport React from \"react\";\nimport { Container } from \"./Container\";\nimport { cls } from \"../util\";\n\nexport type CenteredViewProps = {\n children: React.ReactNode;\n maxWidth?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"4xl\" | \"5xl\" | \"6xl\" | \"7xl\";\n outerClassName?: string;\n className?: string;\n fullScreen?: boolean;\n};\n\nexport const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(({\n children,\n maxWidth,\n outerClassName,\n className,\n fullScreen,\n ...rest\n }, ref) => { // Notice how the ref is now received as the second argument\n\n return (\n <div ref={ref}\n className={cls(\"flex flex-col grow\", fullScreen ? \"h-screen\" : \"h-full\", outerClassName)}\n {...rest}>\n <Container className={cls(\"m-auto\", className)} maxWidth={maxWidth}>\n {children}\n </Container>\n </div>\n );\n\n});\n\nCenteredView.displayName = \"CenteredView\";\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport type CircularProgressProps = {\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n className?: string\n}\n\nexport function CircularProgress({\n size = \"medium\",\n className\n }: CircularProgressProps) {\n\n let sizeClasses = \"\";\n if (size === \"smallest\") {\n sizeClasses = \"w-4 h-4\";\n } else if (size === \"small\") {\n sizeClasses = \"w-6 h-6\";\n } else if (size === \"medium\") {\n sizeClasses = \"w-8 h-8 m-1\";\n } else {\n sizeClasses = \"w-10 h-10 m-1\";\n }\n\n let borderClasses = \"\";\n if (size === \"smallest\") {\n borderClasses = \"border-2\";\n } else if (size === \"small\") {\n borderClasses = \"border-2\";\n } else if (size === \"medium\") {\n borderClasses = \"border-[3px]\";\n } else {\n borderClasses = \"border-4\";\n }\n\n return (\n <div\n className={cls(\n sizeClasses,\n borderClasses,\n \"inline-block shrink-0 rounded-full border-solid align-[-0.125em]\",\n \"animate-[spin_0.7s_linear_infinite] motion-reduce:animate-[spin_1.5s_linear_infinite]\",\n \"border-hairline-strong border-t-primary dark:border-t-primary\",\n className)}\n role=\"status\">\n <span\n className=\"absolute! -m-px! h-px! w-px! overflow-hidden! whitespace-nowrap! border-0! p-0! [clip:rect(0,0,0,0)]!\"\n >\n Loading...\n </span>\n </div>\n );\n}\n","import React, { ReactEventHandler } from \"react\";\nimport { cls } from \"../util\";\n\nexport type TypographyVariant = keyof typeof typographyVariants;\nexport type TypographyProps<C extends React.ElementType = \"span\"> = {\n align?: \"center\" | \"inherit\" | \"justify\" | \"left\" | \"right\";\n children?: React.ReactNode;\n className?: string;\n component?: C;\n gutterBottom?: boolean;\n noWrap?: boolean;\n paragraph?: boolean;\n variant?: TypographyVariant;\n variantMapping?: { [key: string]: string };\n color?: \"inherit\" | \"initial\" | \"primary\" | \"secondary\" | \"disabled\" | \"error\";\n onClick?: ReactEventHandler<HTMLElement>;\n style?: React.CSSProperties;\n} & React.ComponentPropsWithoutRef<C>;\n\nconst typographyVariants = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n subtitle1: \"h6\",\n subtitle2: \"h6\",\n label: \"label\",\n body1: \"p\",\n body2: \"p\",\n inherit: \"p\",\n caption: \"p\",\n button: \"span\",\n lead: \"p\",\n micro: \"span\",\n mono: \"span\",\n stat: \"span\"\n};\n\nconst colorToClasses = {\n inherit: \"text-inherit\",\n initial: \"text-current\",\n primary: \"text-text-primary dark:text-text-primary-dark\",\n secondary: \"text-text-secondary dark:text-text-secondary-dark\",\n disabled: \"text-text-disabled dark:text-text-disabled-dark\",\n error: \"text-red-600 dark:text-red-500\"\n};\n\nconst gutterBottomClasses = {\n h1: \"mb-5\",\n h2: \"mb-4\",\n h3: \"mb-4\",\n h4: \"mb-4\",\n h5: \"mb-3\",\n h6: \"mb-3\",\n subtitle1: \"mb-3\",\n subtitle2: \"mb-3\",\n body1: \"mb-3\",\n body2: \"mb-3\",\n inherit: \"mb-3\",\n caption: \"mb-2\",\n button: \"mb-2\",\n label: \"mb-2\",\n lead: \"mb-4\",\n micro: \"mb-1\",\n mono: \"mb-2\",\n stat: \"mb-1\"\n};\n\nconst variantToClasses = {\n h1: \"typography-h1\",\n h2: \"typography-h2\",\n h3: \"typography-h3\",\n h4: \"typography-h4\",\n h5: \"typography-h5\",\n h6: \"typography-h6\",\n subtitle1: \"typography-subtitle1\",\n subtitle2: \"typography-subtitle2\",\n body1: \"typography-body1\",\n body2: \"typography-body2\",\n label: \"typography-label\",\n inherit: \"typography-inherit\",\n caption: \"typography-caption\",\n button: \"typography-button\",\n lead: \"typography-lead\",\n micro: \"typography-micro\",\n mono: \"typography-mono\",\n stat: \"typography-stat\"\n};\n\nexport function Typography<C extends React.ElementType = \"span\">(\n {\n align = \"inherit\",\n color = \"primary\",\n children,\n className,\n component,\n gutterBottom = false,\n noWrap = false,\n paragraph = false,\n variant = \"body1\",\n variantMapping = typographyVariants,\n style,\n onClick,\n ...other\n }: TypographyProps<C>\n) {\n const Component =\n component ||\n (paragraph ? \"p\" : variantMapping[variant] || typographyVariants[variant]) ||\n \"span\";\n\n const classes = cls(\n variantToClasses[variant],\n color ? colorToClasses[color] : \"\",\n align !== \"inherit\" && `text-${align}`,\n gutterBottom && gutterBottomClasses[variant],\n noWrap && \"truncate\",\n paragraph && \"mb-3\",\n className\n );\n\n return (\n <Component className={classes}\n onClick={onClick}\n style={style}\n {...other}>\n {children}\n </Component>\n );\n}\n","import React from \"react\";\nimport { CircularProgress, CircularProgressProps } from \"./CircularProgress\";\nimport { Typography } from \"./Typography\";\n\n/**\n *\n * @param text\n * @param props\n\n * @ignore\n */\nexport function CircularProgressCenter({ text, ...props }: CircularProgressProps & {\n text?: string\n}) {\n return (\n <div\n className=\"flex w-full h-screen max-h-full max-w-full gap-4\">\n <div className=\"m-auto flex flex-col gap-2 items-center\">\n <CircularProgress {...props}/>\n {text && <Typography\n color={\"secondary\"}\n variant={\"caption\"}\n className=\"text-center\">{text}</Typography>}\n </div>\n </div>\n );\n}\n","import React from \"react\";\n\n/**\n * Dynamic imports that survive a redeploy.\n *\n * A built SPA names its chunks by content hash and a deploy replaces the whole\n * `assets/` directory, so a tab opened before the deploy still holds the *old*\n * entry chunk. The first lazy route that tab opens asks for a hash that no\n * longer exists on the server, the import rejects, and the view is dead until\n * the user thinks to reload — which nothing on screen tells them to do. The\n * browser's own wording (\"Failed to fetch dynamically imported module: …\") reads\n * like a build bug, so this is usually reported as one.\n *\n * `loadChunk` retries once — that covers a transient network failure — and then\n * gives up with an error tagged as a chunk load failure, so `ErrorBoundary` can\n * offer a reload instead of printing the browser's message.\n */\n\n/**\n * Marker property set on the error thrown after a failed retry. Read by\n * `isChunkLoadError`, which is what the UI matches on.\n */\nconst CHUNK_LOAD_ERROR_FLAG = \"rebaseChunkLoadError\";\n\n/**\n * Each engine words this differently, and the message is the only signal — none\n * of them use a distinguishable error type. The MIME variants matter as much as\n * the fetch ones: a server whose SPA fallback answers a missing `/assets/x.js`\n * with `index.html` returns 200 HTML, and the browser rejects it as a module.\n */\nconst CHUNK_ERROR_PATTERNS = [\n \"failed to fetch dynamically imported module\",\n \"error loading dynamically imported module\",\n \"importing a module script failed\",\n \"failed to load module script\",\n \"expected a javascript\",\n \"unable to preload css\"\n];\n\n/**\n * Does this error mean a chunk could not be loaded — rather than the chunk's\n * own code throwing once it did load?\n *\n * Errors raised anywhere are matched, not just ones `loadChunk` produced: React\n * `lazy()` calls that still import directly, and Vite's own CSS preloads, fail\n * the same way and deserve the same recovery.\n */\nexport function isChunkLoadError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n if ((error as Record<string, unknown>)[CHUNK_LOAD_ERROR_FLAG] === true) return true;\n const message = (error as { message?: unknown }).message;\n if (typeof message !== \"string\") return false;\n const lower = message.toLowerCase();\n return CHUNK_ERROR_PATTERNS.some(pattern => lower.includes(pattern));\n}\n\nfunction chunkLoadError(cause: unknown): Error {\n const error = new Error(\n \"This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.\"\n );\n Object.assign(error, { [CHUNK_LOAD_ERROR_FLAG]: true,\ncause });\n return error;\n}\n\n/**\n * Run a dynamic import, retrying once before declaring the chunk unreachable.\n *\n * Errors that are not chunk load failures — the imported module throwing while\n * it evaluates, say — are re-thrown untouched and never retried: running a\n * module's side effects twice is worse than the original failure.\n */\nexport async function loadChunk<T>(loader: () => Promise<T>): Promise<T> {\n try {\n return await loader();\n } catch (error) {\n if (!isChunkLoadError(error)) throw error;\n // A blip resolves inside a few hundred ms; a stale hash never will.\n await new Promise(resolve => setTimeout(resolve, 250));\n try {\n return await loader();\n } catch (retryError) {\n throw chunkLoadError(retryError);\n }\n }\n}\n\n/**\n * `React.lazy` with the retry above. A drop-in replacement — use it for every\n * lazy route or dialog, since any one of them can be the first chunk a stale\n * tab reaches for.\n *\n * Note that React caches the rejection: once a lazy component has failed, later\n * renders re-throw without calling the loader again. Resetting an error boundary\n * therefore cannot recover it, which is why the boundary offers a reload.\n */\nexport function lazyChunk<T extends React.ComponentType<any>>(\n loader: () => Promise<{ default: T }>\n): React.LazyExoticComponent<T> {\n return React.lazy(() => loadChunk(loader));\n}\n","\nimport React, { ErrorInfo, PropsWithChildren } from \"react\";\n\nimport { AlertCircleIcon, ShieldAlertIcon, RefreshCwIcon, ArrowLeftIcon, ChevronDownIcon, ChevronUpIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { Typography } from \"./Typography\";\nimport { Button } from \"./Button\";\nimport { cls } from \"../util\";\nimport { isChunkLoadError } from \"../util/lazy_chunk\";\n\n/**\n * The one error a user can fix themselves. A deploy replaces the hashed chunk\n * files, so a tab opened before it cannot load any lazy view it has not already\n * fetched — with the browser's raw message (\"Failed to fetch dynamically\n * imported module: …\") this reads as a broken build rather than a stale tab.\n */\nconst CHUNK_ERROR_DESCRIPTION =\n \"This app was updated while the tab was open, so part of it could not be loaded. Reload to continue.\";\n\n/**\n * Checks whether the error message relates to missing permissions or\n * authorization failures. Used to show a friendlier message in fullPage mode.\n */\nfunction isPermissionError(error: Error | null): boolean {\n if (!error) return false;\n const msg = error.message?.toLowerCase() ?? \"\";\n const code = (error as { code?: string }).code?.toLowerCase() ?? \"\";\n return msg.includes(\"permission\")\n || msg.includes(\"insufficient\")\n || msg.includes(\"unauthorized\")\n || msg.includes(\"forbidden\")\n || msg.includes(\"access denied\")\n || code === \"permission_denied\"\n || code === \"insufficient_permissions\"\n || (error as { status?: number }).status === 403;\n}\n\nexport interface ErrorBoundaryProps {\n /**\n * When true, renders a full-page centered error screen instead of the\n * compact inline error. Intended for wrapping top-level app roots or\n * major route sections.\n */\n fullPage?: boolean;\n /**\n * Optional callback invoked when the user clicks \"Try again\". If provided,\n * the boundary resets its error state and calls this handler. If omitted,\n * the \"Try again\" button resets the boundary state, re-mounting children.\n */\n onReset?: () => void;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n showDetails: boolean;\n}\n\nexport class ErrorBoundary extends React.Component<PropsWithChildren<ErrorBoundaryProps>, ErrorBoundaryState> {\n constructor(props: PropsWithChildren<ErrorBoundaryProps>) {\n super(props);\n this.state = { error: null,\nshowDetails: false };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n console.error(error);\n }\n\n private handleReset = () => {\n this.setState({ error: null,\nshowDetails: false });\n this.props.onReset?.();\n };\n\n private handleReload = () => {\n window.location.reload();\n };\n\n private toggleDetails = () => {\n this.setState(prev => ({ showDetails: !prev.showDetails }));\n };\n\n render() {\n if (this.state.error) {\n if (this.props.fullPage) {\n return this.renderFullPage();\n }\n return this.renderInline();\n }\n\n return this.props.children;\n }\n\n private renderInline() {\n const isStaleChunk = isChunkLoadError(this.state.error);\n return (\n <div className=\"flex flex-col m-2 items-start\">\n <div className=\"flex items-center m-2\">\n {isStaleChunk\n ? <RefreshCwIcon className={\"text-text-secondary dark:text-text-secondary-dark\"}\n size={iconSize.small}/>\n : <AlertCircleIcon className={\"text-red-500 dark:text-red-400\"} size={iconSize.small}/>}\n <div className=\"ml-4\">{isStaleChunk ? \"New version available\" : \"Error\"}</div>\n </div>\n <Typography variant={\"caption\"}>\n {isStaleChunk\n ? CHUNK_ERROR_DESCRIPTION\n : this.state.error?.message ?? \"See the error in the console\"}\n </Typography>\n {isStaleChunk && <Button variant=\"outlined\"\n color=\"neutral\"\n size=\"small\"\n className=\"mt-3 ml-2\"\n onClick={this.handleReload}>\n <RefreshCwIcon size={16}/>\n Reload\n </Button>}\n </div>\n );\n }\n\n private renderFullPage() {\n const { error, showDetails } = this.state;\n const isPermission = isPermissionError(error);\n // Neither a fault nor a denial: the app is fine, this tab is behind it.\n const isStaleChunk = !isPermission && isChunkLoadError(error);\n\n const Icon = isPermission ? ShieldAlertIcon : isStaleChunk ? RefreshCwIcon : AlertCircleIcon;\n const title = isPermission\n ? \"Access denied\"\n : isStaleChunk\n ? \"New version available\"\n : \"Something went wrong\";\n const description = isPermission\n ? \"You don't have permission to access this resource. Please check your account permissions or contact your administrator.\"\n : isStaleChunk\n ? CHUNK_ERROR_DESCRIPTION\n : \"An unexpected error occurred. You can try reloading the page or going back.\";\n\n return (\n <div className={cls(\n \"flex items-center justify-center min-h-[400px] h-full w-full\",\n \"bg-surface-sheet\"\n )}>\n <div className=\"flex flex-col items-center max-w-md px-6 py-10 text-center\">\n <div className={cls(\n \"flex items-center justify-center w-14 h-14 rounded-xl mb-6\",\n isPermission\n ? \"bg-amber-100 dark:bg-amber-900/30\"\n : isStaleChunk\n ? \"bg-surface-raised\"\n : \"bg-red-100 dark:bg-red-900/30\"\n )}>\n <Icon\n size={28}\n className={isPermission\n ? \"text-amber-600 dark:text-amber-400\"\n : isStaleChunk\n ? \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-500 dark:text-red-400\"}\n />\n </div>\n\n <Typography variant={\"h6\"}\n className=\"text-text-primary dark:text-text-primary-dark mb-2\">\n {title}\n </Typography>\n\n <Typography variant={\"body2\"}\n className=\"text-text-secondary dark:text-text-secondary-dark mb-8\">\n {description}\n </Typography>\n\n <div className=\"flex gap-3\">\n {/* React caches a `lazy()` rejection: re-mounting the\n children re-throws without re-running the import, so\n \"Try again\" cannot recover a missing chunk. */}\n {!isStaleChunk && <Button\n variant=\"outlined\"\n color=\"neutral\"\n size=\"medium\"\n onClick={this.handleReset}\n >\n <ArrowLeftIcon size={16}/>\n Try again\n </Button>}\n <Button\n variant=\"filled\"\n color=\"primary\"\n size=\"medium\"\n onClick={this.handleReload}\n >\n <RefreshCwIcon size={16}/>\n Reload page\n </Button>\n </div>\n\n {/* For a stale chunk the message *is* the description\n above; repeating it under a disclosure adds nothing. */}\n {!isStaleChunk && error?.message && (\n <div className=\"mt-8 w-full\">\n <button\n onClick={this.toggleDetails}\n className={cls(\n \"flex items-center gap-1 mx-auto text-xs\",\n \"text-text-disabled dark:text-text-disabled-dark\",\n \"hover:text-text-secondary dark:hover:text-text-secondary-dark\",\n \"transition-colors cursor-pointer bg-transparent border-none p-0\"\n )}\n >\n Technical details\n {showDetails\n ? <ChevronUpIcon size={14}/>\n : <ChevronDownIcon size={14}/>}\n </button>\n {showDetails && (\n <div className={cls(\n \"mt-3 p-3 rounded-lg text-left text-xs\",\n \"bg-surface-field\",\n \"text-text-secondary dark:text-text-secondary-dark\",\n \"font-mono break-all\"\n )}>\n {error.message}\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n","\nimport React from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\n\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { cls } from \"../util\";\n\nexport interface CheckboxProps {\n checked: boolean;\n id?: string;\n disabled?: boolean;\n indeterminate?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n padding?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n color?: \"primary\" | \"secondary\";\n \"aria-label\"?: string;\n}\n\n// Radius steps down with the box. `rounded-md` is 6px — on a 16-20px box that\n// is most of the edge, so the control reads as a squircle rather than a\n// checkbox. Box sizes match the icon glyph scale (16/16/20/24) so a Checkbox\n// sitting beside IconButtons in a table row is the same visual size.\nconst sizeClasses = {\n large: \"w-6 h-6 rounded flex items-center justify-center\",\n medium: \"w-5 h-5 rounded flex items-center justify-center\",\n small: \"w-4 h-4 rounded-sm flex items-center justify-center\",\n smallest: \"w-4 h-4 rounded-sm flex items-center justify-center\"\n};\n\n// Outer box is the hit area and sets the control's rendered height, so it\n// tracks the shared 28/32/40/48 scale. `smallest` used to reuse `small`'s\n// 32px box, which made the two sizes identical.\n//\n// A checkbox with no `onCheckedChange` is not a hit area — it is a tick mark\n// standing in for a value, as in `BooleanPreview`. There the box was 10px of\n// dead space on each side of a `medium` tick: on top of a read-only field's\n// own padding, it started the tick 10px further in than the text of the field\n// beside it. `padding={false}` reads as the request to drop it, and until now\n// did nothing at all, because it only removed `p-2` from a box whose size was\n// fixed regardless. Kept for anything clickable — the same box is the click\n// target for table row selection and for editor task items.\nconst outerSizeClasses = {\n medium: \"w-10 h-10\",\n small: \"w-8 h-8\",\n large: \"w-12 h-12 \",\n smallest: \"w-7 h-7\"\n}\n// Flat p-2, as it always was. `shrink-0` on the box below is what stops it\n// being squashed; changing the padding here only shifts the control's optical\n// weight relative to the icons beside it.\nconst paddingClasses = {\n medium: \"p-2\",\n small: \"p-2\",\n large: \"p-2\",\n smallest: \"p-2\"\n}\n\nconst colorClasses = {\n primary: \"bg-primary\",\n secondary: \"bg-secondary\"\n}\n\nexport const Checkbox = React.memo(({\n id,\n checked,\n indeterminate = false,\n padding = true,\n disabled,\n size = \"medium\",\n onCheckedChange,\n color = \"primary\",\n \"aria-label\": ariaLabel\n }: CheckboxProps) => {\n\n const isChecked = indeterminate ? false : checked;\n\n const iconSize = size === \"medium\"\n ? 20\n : size === \"small\"\n ? 16\n : size === \"smallest\"\n ? 14\n : 24;\n return (\n <CheckboxPrimitive.Root\n id={id}\n checked={indeterminate || isChecked}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-checked={indeterminate ? \"mixed\" : isChecked}\n className=\"rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\"\n onCheckedChange={disabled ? undefined : onCheckedChange}>\n\n <div className={cls(\n padding ? paddingClasses[size] : \"\",\n padding || onCheckedChange ? outerSizeClasses[size] : \"\",\n \"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150\",\n onCheckedChange ? \"rounded-full hover:bg-surface-hover\" : \"\",\n onCheckedChange ? \"cursor-pointer\" : \"cursor-default\"\n )}>\n <div\n className={cls(\n \"border-2 shrink-0 relative transition-colors ease-in-out duration-150\",\n sizeClasses[size],\n disabled\n ? \"bg-surface-300 dark:bg-surface-600\"\n : (indeterminate || isChecked ? colorClasses[color] : \"bg-surface-card\"),\n (indeterminate || isChecked) ? \"text-surface-accent-100 dark:text-surface-accent-900\" : \"\",\n disabled\n ? \"border-transparent\"\n : (indeterminate || isChecked ? \"border-transparent\" : \"border-surface-accent-800 dark:border-surface-accent-500\")\n )}>\n <CheckboxPrimitive.Indicator asChild>\n {indeterminate\n ? (\n <MinusIcon size={iconSize} className={\"absolute\"}/>\n )\n : (\n <CheckIcon size={iconSize} className={\"absolute\"}/>\n )}\n </CheckboxPrimitive.Indicator>\n </div>\n </div>\n </CheckboxPrimitive.Root>\n );\n});\n\nCheckbox.displayName = \"Checkbox\";\n","import React from \"react\";\nimport { CHIP_COLORS, cls, getColorSchemeForKey } from \"../util\";\nimport type { ChipColorKey, ChipColorScheme } from \"../util/chip_colors\";\nimport { useIsDarkMode } from \"../hooks/useIsDarkMode\";\n\nexport type { ChipColorKey, ChipColorScheme };\n\nexport interface ChipProps {\n className?: string;\n children: React.ReactNode;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n colorScheme?: ChipColorScheme | ChipColorKey;\n /**\n * How a coloured chip paints its hue. `tinted` (the default) is the hue at\n * low alpha behind hue-coloured ink: a label, not a block, and the rule the\n * chrome follows for colour everywhere else (a dot, an icon, an outline, a\n * tint — never a fill). `filled` is the palette's solid stop, for the few\n * places that want a swatch: a colour picker, a legend. A custom scheme\n * without tint values falls back to `filled`.\n */\n variant?: \"tinted\" | \"filled\";\n error?: boolean;\n outlined?: boolean;\n onClick?: () => void;\n icon?: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n// `small` and `medium` used to differ only in horizontal padding, so both\n// rendered at the same height and the step was invisible. Vertical rhythm now\n// increases across the whole scale.\nconst sizeClassNames = {\n smallest: \"px-1.5 py-px text-[10px]\",\n small: \"px-2 py-0.5 text-xs\",\n medium: \"px-2.5 py-1 text-xs\",\n large: \"px-3 py-1.5 text-sm\"\n}\n\n/**\n * Helper to generate rgba from hex or standard colors.\n */\nfunction getRgba(hex: string, alpha: number): string {\n if (!hex || !hex.startsWith(\"#\")) return hex;\n let color = hex.slice(1);\n if (color.length === 3) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n const r = parseInt(color.slice(0, 2), 16);\n const g = parseInt(color.slice(2, 4), 16);\n const b = parseInt(color.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n\n/**\n * @group Preview components\n */\nexport function Chip({\n children,\n colorScheme,\n error,\n outlined,\n variant = \"tinted\",\n onClick,\n icon,\n size = \"medium\",\n className,\n style\n }: ChipProps) {\n\n const usedColorScheme = typeof colorScheme === \"string\" ? getColorSchemeForKey(colorScheme) : colorScheme;\n // Live, not read once: the ink is chosen in JS per theme, so a theme switch\n // has to reach every mounted chip (see useIsDarkMode).\n const dark = useIsDarkMode();\n\n const hasScheme = error || usedColorScheme;\n\n let textColor = \"\";\n let bgColor = \"\";\n let border = \"\";\n\n if (error) {\n textColor = dark ? \"#f87171\" : \"#dc2626\";\n } else if (usedColorScheme) {\n textColor = dark && usedColorScheme.darkText ? usedColorScheme.darkText : usedColorScheme.text;\n }\n\n if (hasScheme) {\n if (outlined) {\n // An outlined chip has no fill, so it needs the ink meant for the\n // PAGE, not the ink meant for the fill it just dropped. Those are\n // different colours for most hues — a bright `solid` chip carries\n // dark ink, which on a near-black page would be invisible.\n if (!error && usedColorScheme) {\n const outlineInk = dark\n ? usedColorScheme.darkOutlineText ?? usedColorScheme.darkText\n : usedColorScheme.outlineText;\n if (outlineInk) textColor = outlineInk;\n }\n bgColor = getRgba(textColor, dark ? 0.1 : 0.06);\n border = `1px solid ${getRgba(textColor, dark ? 0.2 : 0.14)}`;\n } else if (error) {\n bgColor = dark ? \"rgba(220, 38, 38, 0.15)\" : \"rgba(239, 68, 68, 0.1)\";\n border = `1px solid ${dark ? \"rgba(220, 38, 38, 0.3)\" : \"rgba(239, 68, 68, 0.2)\"}`;\n } else if (usedColorScheme) {\n const tintColor = dark ? usedColorScheme.darkTintColor : usedColorScheme.tintColor;\n const tintText = dark ? usedColorScheme.darkTintText : usedColorScheme.tintText;\n if (variant === \"tinted\" && tintColor && tintText) {\n bgColor = tintColor;\n textColor = tintText;\n } else {\n bgColor = dark && usedColorScheme.darkColor ? usedColorScheme.darkColor : usedColorScheme.color;\n }\n }\n }\n\n return (\n <div\n // `rounded-md`, not `lg`: a radius is proportional to the thing it\n // rounds. At a chip's 20-24px height the control radius makes a pill,\n // and a pill is a different object (a segment, a search field).\n className={cls(\"rounded-md max-w-full w-max h-fit font-medium inline-flex gap-1\",\n \"text-ellipsis\",\n \"items-center\",\n \"transition-colors duration-150\",\n !hasScheme && \"bg-surface-raised text-text-secondary dark:text-text-secondary-dark\",\n !hasScheme && outlined && \"bg-transparent border border-hairline-strong\",\n onClick ? \"cursor-pointer hover:bg-surface-raised-hover\" : \"\",\n sizeClassNames[size],\n className)}\n onClick={onClick}\n style={{\n ...(hasScheme ? {\n backgroundColor: bgColor,\n color: textColor,\n border: border || undefined,\n } : {}),\n overflow: \"hidden\",\n ...style\n }}\n >\n {icon}\n {children}\n </div>\n );\n}\n","\"use client\";\nimport React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type TooltipProps = {\n open?: boolean,\n defaultOpen?: boolean,\n onOpenChange?: (open: boolean) => void,\n side?: \"top\" | \"bottom\" | \"left\" | \"right\",\n align?: \"start\" | \"center\" | \"end\",\n sideOffset?: number,\n title?: string | React.ReactNode,\n delayDuration?: number;\n asChild?: boolean;\n tooltipClassName?: string,\n tooltipStyle?: React.CSSProperties;\n children: React.ReactNode,\n className?: string,\n container?: HTMLElement,\n style?: React.CSSProperties;\n};\n\nexport const Tooltip = ({\n open,\n defaultOpen,\n side = \"bottom\",\n delayDuration = 200,\n sideOffset,\n align,\n onOpenChange,\n title,\n tooltipClassName,\n tooltipStyle,\n children,\n asChild = false,\n container,\n className,\n style\n }: TooltipProps) => {\n\n useInjectStyles(\"Tooltip\", styles);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (container ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n if (!title)\n return <>{children}</>;\n\n const trigger = asChild\n ? <TooltipPrimitive.Trigger asChild={true}>\n {children}\n </TooltipPrimitive.Trigger>\n : <TooltipPrimitive.Trigger asChild={true}>\n <div style={style} className={className}>\n {children}\n </div>\n </TooltipPrimitive.Trigger>;\n\n return (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <TooltipPrimitive.Root {...(open !== undefined ? { open,\nonOpenChange } : {})} defaultOpen={defaultOpen}>\n {trigger}\n <TooltipPrimitive.Portal container={finalContainer}>\n <TooltipPrimitive.Content\n className={cls(\"TooltipContent\",\n \"max-w-lg leading-relaxed\",\n \"z-50 rounded-md px-3 py-2 text-xs leading-none bg-surface-800/95 dark:bg-surface-raised-hover font-medium text-white shadow-2xl select-none duration-400 ease-in transform opacity-100\",\n tooltipClassName)}\n style={tooltipStyle}\n sideOffset={sideOffset === undefined ? 4 : sideOffset}\n align={align}\n side={side}>\n {title}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n};\n\nconst styles = `\n\n.TooltipContent {\n animation-duration: 220ms;\n animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n}\n\n.TooltipContent[data-state='delayed-open'][data-side='top'] {\n animation-name: slideDownAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='right'] {\n animation-name: slideLeftAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='bottom'] {\n animation-name: slideUpAndFade;\n}\n.TooltipContent[data-state='delayed-open'][data-side='left'] {\n animation-name: slideRightAndFade;\n}\n\n\n@keyframes slideUpAndFade {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideRightAndFade {\n from {\n opacity: 0;\n transform: translateX(-4px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideDownAndFade {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideLeftAndFade {\n from {\n opacity: 0;\n transform: translateX(4px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}`;\n","\nimport React from \"react\";\nimport { CHIP_COLORS, cls } from \"../util\";\nimport { ChipColorKey, ChipColorScheme } from \"./Chip\";\nimport type { ChipTone } from \"../util/chip_colors\";\nimport { CheckIcon } from \"lucide-react\";\nimport { Tooltip } from \"./Tooltip\";\n\nexport interface ColorPickerProps {\n /**\n * Currently selected color key\n */\n value?: ChipColorKey;\n /**\n * Callback when color selection changes. Passes undefined when \"Auto\" is selected.\n */\n onChange: (colorKey: ChipColorKey | undefined) => void;\n /**\n * Size of the color swatches\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether to show the \"Auto\" option that clears the selection\n */\n allowClear?: boolean;\n /**\n * Whether the picker is disabled\n */\n disabled?: boolean;\n}\n\n// Hues across, tones down — the arrangement the palette is built in.\nconst BASE_COLORS = [\"blue\", \"indigo\", \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\", \"red\", \"orange\", \"yellow\", \"green\", \"emerald\", \"teal\", \"cyan\", \"gray\"] as const;\n\n// Lightest first, matching how the bare hue name reads.\nconst TONES: ChipTone[] = [\"Lighter\", \"Light\", \"Dark\", \"Darker\"];\n\n// Helper to get readable name from color key\nfunction getColorDisplayName(hue: string, tone: ChipTone): string {\n const hueName = `${hue.charAt(0).toUpperCase()}${hue.slice(1)}`;\n return tone === \"Lighter\" ? hueName : `${hueName} ${tone.toLowerCase()}`;\n}\n\n/**\n * A color picker component that displays a grid of predefined CHIP_COLORS.\n * Used for selecting colors for enum values, tags, and other chip-based UI elements.\n *\n * @group Form components\n */\nexport function ColorPicker({\n value,\n onChange,\n size = \"medium\",\n allowClear = true,\n disabled = false\n}: ColorPickerProps) {\n\n const swatchSize = size === \"small\" ? \"w-5 h-5\" : \"w-6 h-6\";\n const checkSize = size === \"small\" ? 12 : 14;\n\n return (\n <div className=\"flex flex-col gap-2\">\n {allowClear && (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(undefined)}\n className={cls(\n \"flex items-center gap-2 px-2 py-1 rounded-lg text-sm transition-colors duration-150\",\n \"hover:bg-surface-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-primary\",\n disabled && \"opacity-50 cursor-not-allowed\",\n !value && \"bg-surface-raised font-medium\"\n )}\n >\n <div className={cls(\n swatchSize,\n \"rounded-full border-2 border-dashed border-surface-accent-400 dark:border-surface-accent-600\",\n \"flex items-center justify-center\"\n )}>\n {!value && <CheckIcon size={checkSize}/>}\n </div>\n <span className=\"text-surface-accent-700 dark:text-surface-accent-300\">\n Auto (based on ID)\n </span>\n </button>\n )}\n\n {/* One row per tone. Wrapping rather than a fixed 15-column grid:\n the picker also opens inside narrow property panels, where\n fifteen tracks would shrink each swatch to a few pixels. */}\n {TONES.map((tone) => (\n <div key={tone} className=\"flex flex-wrap gap-1.5\">\n {BASE_COLORS.map((base) => {\n // The bare hue and its `Lighter` tone are the same\n // scheme; the picker offers the short name so configs\n // stay readable.\n const colorKey = (tone === \"Lighter\" ? base : `${base}${tone}`) as ChipColorKey;\n const colorScheme = CHIP_COLORS[colorKey] as ChipColorScheme;\n const isSelected = value === colorKey;\n const displayName = getColorDisplayName(base, tone);\n\n return (\n <Tooltip\n key={colorKey}\n title={displayName}\n delayDuration={300}\n >\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => onChange(colorKey)}\n className={cls(\n swatchSize,\n \"rounded-full transition-all flex items-center justify-center\",\n \"hover:scale-110 hover:shadow-md\",\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\",\n disabled && \"opacity-50 cursor-not-allowed hover:scale-100\",\n isSelected && \"ring-2 ring-primary ring-offset-1\"\n )}\n style={{\n backgroundColor: colorScheme.color\n }}\n aria-label={displayName}\n aria-pressed={isSelected}\n >\n {isSelected && (\n <CheckIcon\n size={checkSize}\n style={{ color: colorScheme.text }}\n />\n )}\n </button>\n </Tooltip>\n );\n })}\n </div>\n ))}\n </div>\n );\n}\n","\"use client\";\nimport React from \"react\";\nimport { cls } from \"../util\";\n\nexport type IconButtonProps<C extends React.ElementType> =\n Omit<(C extends \"button\" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<C>), \"onClick\">\n & {\n size?: \"medium\" | \"small\" | \"smallest\" | \"large\";\n variant?: \"ghost\" | \"filled\",\n shape?: \"circular\" | \"square\",\n disabled?: boolean;\n toggled?: boolean;\n component?: C;\n onClick?: React.MouseEventHandler<any>;\n \"aria-label\"?: string;\n}\n\nconst buttonClasses = \"hover:scale-[1.04] active:scale-95 transition-transform\";\n// `[&>svg]:shrink-0` is load-bearing: without it flex compresses the icon to\n// whatever width is left after padding, so an 18px icon in a 28px button\n// rendered 12x18 — visibly squashed rather than merely small.\nconst baseClasses = \"inline-flex items-center justify-center text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 transition-colors ease-in-out duration-150 [&>svg]:shrink-0\";\nconst colorClasses = \"text-surface-accent-500 visited:text-surface-accent-500 dark:text-surface-accent-300 dark:visited:text-surface-accent-300\";\n// Padding stays a flat p-2 (as it always was). Callers pass their own icon\n// sizes, so tightening it here shrinks the content box under an icon that was\n// sized for the old one and makes the icon overflow. `shrink-0` above is what\n// actually fixes the squashing — the icon keeps its own dimensions and simply\n// eats into the padding.\nconst sizeClasses = {\n medium: \"w-10 !h-10 min-w-10 min-h-10 p-2\",\n small: \"w-8 !h-8 min-w-8 min-h-8 p-2\",\n smallest: \"w-7 !h-7 min-w-7 min-h-7 p-2\",\n large: \"w-12 !h-12 min-w-12 min-h-12 p-2\"\n}\nconst shapeClasses = {\n circular: \"rounded-full\",\n square: \"rounded-md\"\n}\n\n/** Icon size used when the caller doesn't set one on the child. */\nconst defaultIconSize = {\n smallest: 16,\n small: 18,\n medium: 20,\n large: 24\n} as const;\n\nconst IconButtonInner = <C extends React.ElementType = \"button\">({\n children,\n className,\n size = \"medium\",\n variant = \"ghost\",\n shape = \"circular\",\n disabled,\n toggled,\n component,\n ...props\n }: IconButtonProps<C>, ref: React.ForwardedRef<HTMLButtonElement>) => {\n\n const bgClasses = variant === \"ghost\" ? \"bg-transparent hover:bg-surface-hover\" : \"bg-surface-raised hover:bg-surface-raised-hover\";\n const Component: React.ElementType<any> = component || \"button\";\n const isNativeButton = Component === \"button\";\n\n // Give the icon a size that matches the button when the caller didn't pick\n // one. Without this a bare <IconButton size=\"smallest\"><PencilIcon/></…>\n // renders lucide's 24px default inside a 28px button, so icon size ended up\n // depending on whether each call site happened to pass one — which is what\n // made a row of icon buttons look randomly sized. An explicit `size` on the\n // child always wins.\n const sizedChildren = React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) return child;\n if ((child.props as { size?: unknown }).size !== undefined) return child;\n return React.cloneElement(child as React.ReactElement<{ size?: number }>,\n { size: defaultIconSize[size] });\n });\n return (\n <Component\n type={isNativeButton ? \"button\" : undefined}\n role={isNativeButton ? undefined : \"button\"}\n ref={ref}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n {...props}\n className={cls(\n disabled ? \"opacity-50 pointer-events-none\" : \"cursor-pointer\",\n toggled ? \"outline outline-2 outline-primary\" : \"\",\n \"text-inherit dark:text-inherit\",\n colorClasses,\n bgClasses,\n baseClasses,\n buttonClasses,\n shapeClasses[shape],\n sizeClasses[size],\n className\n )}>\n {sizedChildren}\n </Component>\n );\n};\n\nexport const IconButton = React.forwardRef(IconButtonInner as React.ForwardRefRenderFunction<HTMLButtonElement, IconButtonProps<any>>) as React.ComponentType<IconButtonProps<any>>;\n","\"use client\";\nimport * as React from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type InputLabelProps = {\n children?: React.ReactNode;\n className?: string;\n shrink?: boolean;\n} & React.LabelHTMLAttributes<HTMLLabelElement>;\n\nconst defaultClasses = {\n root: \"origin-left transition-transform block whitespace-nowrap overflow-hidden text-ellipsis max-w-full\",\n shrink: \"transform translate-y-[2px] scale-75 translate-x-[12px]\",\n expanded: \"translate-x-[16px] top-0 transform translate-y-[16px] scale-100\"\n};\n\nexport const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(function InputLabel(inProps, ref) {\n const {\n shrink,\n className,\n ...other\n } = inProps;\n\n const computedClassName = cls(defaultClasses.root,\n {\n [defaultClasses.shrink]: shrink,\n [defaultClasses.expanded]: !shrink\n }, className);\n\n return (\n <label\n className={cls(\"text-sm font-medium peer-disabled:cursor-not-allowed\",\n defaultBorderMixin, computedClassName)}\n data-shrink={shrink}\n ref={ref}\n {...other}\n />\n );\n});\n","\n\"use client\";\n\nimport React, { useId, useRef, useState } from \"react\";\nimport { CalendarIcon, XIcon, AlertCircleIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { IconButton } from \"./IconButton\";\nimport { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin } from \"../styles\";\nimport { InputLabel } from \"./InputLabel\";\nimport { Typography } from \"./Typography\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport type DateTimeFieldProps = {\n value?: Date | null;\n onChange?: (date: Date | null) => void;\n mode?: \"date\" | \"date_time\";\n disabled?: boolean;\n clearable?: boolean;\n error?: boolean;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n label?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n inputClassName?: string;\n invisible?: boolean;\n locale?: string;\n /**\n * IANA timezone string (e.g., \"America/New_York\", \"Europe/London\").\n * Used to display and input dates in the specified timezone.\n * The value passed to onChange will always be in UTC.\n * If not provided, uses the user's local timezone.\n */\n timezone?: string;\n /**\n * Names the control when there is no `label` — e.g. when the surrounding\n * form draws the label itself and passes `label={undefined}`.\n */\n \"aria-label\"?: string;\n};\n\nexport const DateTimeField: React.FC<DateTimeFieldProps> = ({\n value,\n label,\n onChange,\n disabled,\n clearable,\n mode = \"date\",\n error,\n size = \"large\",\n className,\n style,\n inputClassName,\n invisible,\n timezone,\n \"aria-label\": ariaLabel\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [focused, setFocused] = useState(false);\n // The label was decorative: an InputLabel with no `htmlFor` beside an input\n // with no `id`, so a date field announced itself by its value even when it\n // visibly had a label. Wired the way TextField already does it.\n const inputId = useId();\n const labelId = `${inputId}-label`;\n const [internalValue, setInternalValue] = useState<string>(\"\");\n const [isTyping, setIsTyping] = useState(false);\n const invalidValue = value !== undefined && value !== null && (!(value instanceof Date) || isNaN(value.getTime()));\n\n // The calendar/clear adornments are IconButtons. Left at their default\n // (`medium`, 40px) they floored the whole field at 40px, so smallest/small\n // rendered identically to medium. Keep them a step below the field.\n const adornmentSize = size === \"large\" ? \"medium\" : size === \"medium\" ? \"small\" : \"smallest\";\n\n useInjectStyles(\"DateTimeField\", inputStyles);\n\n const handleClear = (e: React.MouseEvent) => {\n e.preventDefault();\n setInternalValue(\"\");\n setIsTyping(false);\n onChange?.(null);\n };\n\n // Convert UTC Date to display string in the specified timezone\n const valueAsInputValue = (\n dateValue: Date | null,\n mode: \"date\" | \"date_time\"\n ) => {\n if (!dateValue || !(dateValue instanceof Date) || isNaN(dateValue.getTime())) {\n return \"\";\n }\n const pad = (n: number) => n.toString().padStart(2, \"0\");\n\n // Use Intl.DateTimeFormat to get date parts in the target timezone\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n timeZone: timezone // undefined = local timezone\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-CA\", options);\n const parts = formatter.formatToParts(dateValue);\n\n const getPart = (type: string) => parts.find(p => p.type === type)?.value ?? \"\";\n\n const year = getPart(\"year\");\n const month = getPart(\"month\");\n const day = getPart(\"day\");\n\n if (mode === \"date\") {\n return `${year}-${month}-${day}`;\n } else {\n const hours = getPart(\"hour\");\n const minutes = getPart(\"minute\");\n return `${year}-${month}-${day}T${hours}:${minutes}`;\n }\n };\n\n // Get the UTC offset for a specific date in the target timezone (in minutes)\n const getTimezoneOffsetMinutes = (date: Date, tz?: string): number => {\n if (!tz) {\n // Local timezone: use built-in getTimezoneOffset (returns offset in minutes, inverted sign)\n return -date.getTimezoneOffset();\n }\n // For named timezones, calculate the offset by comparing formatted times\n const utcFormatter = new Intl.DateTimeFormat(\"en-CA\", {\n year: \"numeric\",\nmonth: \"2-digit\",\nday: \"2-digit\",\n hour: \"2-digit\",\nminute: \"2-digit\",\nhour12: false,\n timeZone: \"UTC\"\n });\n const tzFormatter = new Intl.DateTimeFormat(\"en-CA\", {\n year: \"numeric\",\nmonth: \"2-digit\",\nday: \"2-digit\",\n hour: \"2-digit\",\nminute: \"2-digit\",\nhour12: false,\n timeZone: tz\n });\n\n const utcParts = utcFormatter.formatToParts(date);\n const tzParts = tzFormatter.formatToParts(date);\n\n const getPart = (parts: Intl.DateTimeFormatPart[], type: string) =>\n parseInt(parts.find(p => p.type === type)?.value ?? \"0\", 10);\n\n const utcDate = new Date(Date.UTC(\n getPart(utcParts, \"year\"),\n getPart(utcParts, \"month\") - 1,\n getPart(utcParts, \"day\"),\n getPart(utcParts, \"hour\"),\n getPart(utcParts, \"minute\")\n ));\n\n const tzDate = new Date(Date.UTC(\n getPart(tzParts, \"year\"),\n getPart(tzParts, \"month\") - 1,\n getPart(tzParts, \"day\"),\n getPart(tzParts, \"hour\"),\n getPart(tzParts, \"minute\")\n ));\n\n return (tzDate.getTime() - utcDate.getTime()) / 60000;\n };\n\n // Handle input value change - convert from display timezone to UTC\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setInternalValue(inputValue);\n setIsTyping(true);\n\n if (!inputValue) {\n onChange?.(null);\n return;\n }\n\n try {\n let year: number, month: number, day: number, hours = 0, minutes = 0;\n\n if (mode === \"date\") {\n // Parse date-only input: \"YYYY-MM-DD\"\n [year, month, day] = inputValue.split(\"-\").map(Number);\n } else {\n // Parse datetime-local input: \"YYYY-MM-DDTHH:MM\"\n const [datePart, timePart] = inputValue.split(\"T\");\n [year, month, day] = datePart.split(\"-\").map(Number);\n [hours, minutes] = timePart.split(\":\").map(Number);\n }\n\n let resultDate: Date;\n\n if (!timezone) {\n // No timezone specified: interpret input as local time (backward compatible)\n resultDate = new Date(year, month - 1, day, hours, minutes);\n } else {\n // Timezone specified: interpret input as that timezone and convert to UTC\n // We need to find the UTC equivalent of the entered time in the target timezone\n\n // Create a reference UTC date to calculate the offset for this moment\n const refUtcDate = new Date(Date.UTC(year, month - 1, day, hours, minutes));\n const offsetMinutes = getTimezoneOffsetMinutes(refUtcDate, timezone);\n\n // Convert from target timezone to UTC:\n // If user entered 00:00 in Mexico (UTC-6, offset=-360), we subtract the offset\n // Date.UTC gives us 00:00 UTC, subtracting -360 minutes (= adding 360 min) gives 06:00 UTC\n resultDate = new Date(Date.UTC(year, month - 1, day, hours, minutes) - offsetMinutes * 60000);\n }\n\n if (isNaN(resultDate.getTime())) {\n throw new Error(\"Invalid date\");\n }\n\n onChange?.(resultDate);\n } catch (e) {\n // Don't call onChange with null while typing\n return;\n }\n };\n\n const handleFocus = () => {\n setFocused(true);\n setIsTyping(true);\n setInternalValue(valueAsInputValue(value ?? null, mode));\n };\n\n const handleBlur = () => {\n setFocused(false);\n setIsTyping(false);\n };\n\n return (\n <>\n {/* Inject the styles to hide the calendar icon */}\n <style>{inputStyles}</style>\n <div\n className={cls(\n \"rounded-lg relative max-w-full\",\n !invisible && fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n className\n )}\n style={style}\n onClick={() => {\n if (!disabled) {\n inputRef.current?.focus();\n }\n }}\n >\n {label && (\n <InputLabel\n id={labelId}\n htmlFor={inputId}\n className={cls(\n \"absolute top-1 pointer-events-none\",\n !error\n ? focused\n ? \"text-primary\"\n : \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-600 dark:text-red-500\",\n disabled ? \"opacity-50\" : \"\"\n )}\n shrink={true}\n // shrink={hasValue || focused}\n >\n {label}\n </InputLabel>\n )}\n\n <input\n ref={inputRef}\n id={inputId}\n aria-labelledby={label ? labelId : undefined}\n aria-label={label ? undefined : ariaLabel}\n type={mode === \"date_time\" ? \"datetime-local\" : \"date\"}\n value={isTyping ? internalValue : valueAsInputValue(value ?? null, mode)}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n className={cls(\n \"w-full outline-hidden bg-transparent leading-normal text-sm px-3\",\n clearable ? \"pr-14\" : \"pr-12\",\n \"rounded-lg\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n // A flat py-2 (16px) plus the line box floored\n // the field at 40px, so smallest/small/medium all\n // rendered the same height. Scale it with `size`.\n label\n ? \"pt-8 pb-2\"\n : { smallest: \"py-0.5\", small: \"py-1\", medium: \"py-2\", large: \"py-3\" }[size],\n inputClassName,\n disabled &&\n \"border border-transparent outline-hidden opacity-50 dark:opacity-50 text-surface-accent-600 dark:text-surface-accent-500\"\n )}\n />\n <IconButton\n size={adornmentSize}\n onClick={(e) => {\n e.stopPropagation();\n inputRef.current?.showPicker();\n }}\n className=\"absolute right-3 top-1/2 transform -translate-y-1/2 text-surface-accent-500!\"\n >\n <CalendarIcon/>\n </IconButton>\n {clearable && value && (\n <IconButton\n size={adornmentSize}\n onClick={handleClear}\n className=\"absolute right-14 top-1/2 transform -translate-y-1/2 text-surface-accent-400 \"\n >\n <XIcon/>\n </IconButton>\n )}\n </div>\n {invalidValue && (\n <div className=\"flex items-center m-2\">\n <AlertCircleIcon size={iconSize.small} color={\"error\"}/>\n <div className=\"pl-2\">\n <Typography variant={\"body2\"}>\n Invalid date value for this field\n </Typography>\n <Typography variant={\"body2\"}>\n {`The provided value is: ${JSON.stringify(value)}`}\n </Typography>\n </div>\n </div>\n )}\n </>\n );\n};\n\nconst inputStyles = `\n /* Hide the default calendar icon in Chrome, Safari, Edge, Opera */\n input[type=\"date\"]::-webkit-calendar-picker-indicator,\n input[type=\"datetime-local\"]::-webkit-calendar-picker-indicator {\n display: none;\n -webkit-appearance: none;\n }\n /* Hide default calendar icon in Firefox */\n input[type=\"date\"],\n input[type=\"datetime-local\"] {\n -moz-appearance:textfield;\n }\n `;\n","\"use client\";\nimport React, { useEffect, useState } from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { PortalContainerProvider, usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type DialogProps = {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: React.ReactNode;\n className?: string;\n containerClassName?: string;\n fullWidth?: boolean;\n fullHeight?: boolean;\n fullScreen?: boolean;\n scrollable?: boolean;\n maxWidth?: keyof typeof widthClasses;\n modal?: boolean;\n onOpenAutoFocus?: (e: Event) => void;\n onEscapeKeyDown?: (e: KeyboardEvent) => void;\n onPointerDownOutside?: (e: Event) => void;\n onInteractOutside?: (e: Event) => void;\n /**\n * If `true`, the dialog will not focus the first focusable element when opened.\n */\n disableInitialFocus?: boolean;\n portalContainer?: HTMLElement | null;\n \"aria-describedby\"?: string;\n};\n\nconst widthClasses = {\n xs: \"max-w-xs w-xs\",\n sm: \"max-w-sm w-sm\",\n md: \"max-w-md w-md\",\n lg: \"max-w-lg w-lg\",\n xl: \"max-w-xl w-xl\",\n \"2xl\": \"max-w-2xl w-2xl\",\n \"3xl\": \"max-w-3xl w-3xl\",\n \"4xl\": \"max-w-4xl w-4xl\",\n \"5xl\": \"max-w-5xl w-5xl\",\n \"6xl\": \"max-w-6xl w-6xl\",\n \"7xl\": \"max-w-7xl w-7xl\",\n full: \"max-w-full w-full\"\n};\n\nexport const Dialog = ({\n open,\n onOpenChange,\n children,\n className,\n containerClassName,\n fullWidth = true,\n fullHeight,\n fullScreen,\n scrollable = true,\n maxWidth = \"lg\",\n modal = true,\n onOpenAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n disableInitialFocus = true,\n portalContainer,\n \"aria-describedby\": ariaDescribedby\n }: DialogProps) => {\n const [displayed, setDisplayed] = useState(false);\n // Where popups rendered *inside* this dialog get portaled to. A modal\n // dialog locks scrolling everywhere but its own content, so a popup\n // portaled to `document.body` renders fine and then refuses to scroll:\n // `react-remove-scroll` cancels every wheel event outside the lock.\n // Handing descendants this host keeps them inside it.\n const [popupHost, setPopupHost] = useState<HTMLDivElement | null>(null);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n if (!open) {\n const timeout = setTimeout(() => {\n setDisplayed(false);\n }, 100);\n return () => clearTimeout(timeout);\n } else {\n setDisplayed(true);\n return () => {\n };\n }\n }, [open]);\n\n return (\n <DialogPrimitive.Root open={displayed || open}\n modal={modal}\n onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal container={finalContainer}>\n\n <div className={cls(\"fixed inset-0 z-50\", containerClassName)}>\n\n <DialogPrimitive.Overlay\n className={cls(\"fixed inset-0 transition-opacity ease-in-out duration-200 bg-black/50 dark:bg-black/60 backdrop-blur-sm\",\n displayed && open ? \"opacity-100\" : \"opacity-0\",\n \"z-50 fixed top-0 left-0 w-full h-full flex justify-center items-center\"\n )}\n style={{\n pointerEvents: displayed ? \"auto\" : \"none\"\n }}\n />\n\n <DialogPrimitive.Content\n onEscapeKeyDown={onEscapeKeyDown}\n onOpenAutoFocus={(e) => {\n if (disableInitialFocus) {\n e.preventDefault();\n }\n onOpenAutoFocus?.(e);\n }}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n aria-describedby={ariaDescribedby}\n className={cls(\"relative h-full outline-none flex justify-center items-center z-60 opacity-100 transition-all duration-200 ease-in-out\")}\n >\n <div\n className={cls(paperMixin,\n \"rounded-2xl\",\n \"z-60\",\n \"relative\",\n \"overflow-hidden\",\n \"outline-none focus:outline-none\",\n fullWidth && !fullScreen ? \"w-11/12\" : undefined,\n fullHeight && !fullScreen ? \"h-full\" : undefined,\n \"text-text-primary dark:text-text-primary-dark\",\n \"justify-center items-center\",\n fullScreen ? \"h-screen w-screen\" : \"max-h-[90vh] shadow-lg\",\n \"ease-in-out duration-200\",\n scrollable && \"overflow-y-auto\",\n displayed && open ? \"opacity-100 scale-100\" : \"opacity-0 scale-[0.97]\",\n maxWidth && !fullScreen ? widthClasses[maxWidth] : undefined,\n className\n )}>\n <PortalContainerProvider container={popupHost}>\n {children}\n </PortalContainerProvider>\n </div>\n\n {/* Sized to nothing so it changes no layout, but positioned and\n stacked above the paper so popups portaled here are not\n painted behind it. */}\n <div ref={setPopupHost} className={\"relative z-70 w-0 h-0\"}/>\n\n </DialogPrimitive.Content>\n </div>\n\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n","import React from \"react\";\nimport { defaultBorderMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport function DialogActions({\n children,\n position = \"sticky\",\n translucent = true,\n className\n }: {\n children: React.ReactNode,\n position?: \"sticky\" | \"absolute\",\n translucent?: boolean,\n className?: string\n}) {\n\n return <div\n className={cls(\n defaultBorderMixin,\n // `shrink-0`: as a flex child at the foot of a column this bar must\n // keep its height instead of being squeezed by the content above it.\n \"pt-2 pb-4 px-4 border-t flex flex-row items-center justify-end shrink-0 bottom-0 right-0 left-0 text-right z-2 gap-2\",\n position,\n \"bg-surface-card/60\",\n translucent ? \"backdrop-blur-sm\" : \"\",\n className)}>\n {children}\n </div>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport function DialogContent({\n children,\n className,\n fullHeight,\n includeMargin = true\n }: {\n children: React.ReactNode,\n includeMargin?: boolean,\n fullHeight?: boolean,\n className?: string\n}) {\n\n if (fullHeight)\n return <div className={\"flex-grow flex flex-col h-full relative\"}>\n {children}\n </div>;\n\n return <div\n className={cls(\"flex-grow\",\n { \"my-8 mx-8\": includeMargin },\n className)}>\n {children}\n </div>;\n}\n","\"use client\";\n\nimport React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Typography, TypographyProps, TypographyVariant } from \"./Typography\";\nimport { cls } from \"../util\";\n\nexport type DialogContentProps = TypographyProps & {\n children: React.ReactNode,\n hidden?: boolean,\n className?: string,\n includeMargin?: boolean,\n variant?: TypographyVariant\n};\n\nexport function DialogTitle({\n children,\n hidden,\n className,\n variant = \"subtitle2\",\n gutterBottom = true,\n includeMargin = true,\n ...props\n }: DialogContentProps) {\n\n const title = <DialogPrimitive.Title asChild>\n <Typography variant={variant}\n className={cls({ \"mt-8 mx-8\": includeMargin }, className)}\n gutterBottom={gutterBottom}\n {...props}>\n {children}\n </Typography>\n </DialogPrimitive.Title>;\n\n if (hidden) {\n return <VisuallyHidden.Root>{title}</VisuallyHidden.Root>\n }\n\n return title;\n}\n","\n\"use client\";\nimport React, { PropsWithChildren, useEffect, useState } from \"react\";\n\nimport * as Collapsible from \"@radix-ui/react-collapsible\";\nimport { defaultBorderMixin, fieldBackgroundMixin } from \"../styles\";\nimport { ChevronDownIcon } from \"lucide-react\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport function ExpandablePanel({\n title,\n children,\n invisible = false,\n expanded,\n onExpandedChange,\n initiallyExpanded = true,\n titleClassName,\n asField,\n className,\n innerClassName\n }: PropsWithChildren<{\n title: React.ReactNode,\n invisible?: boolean,\n initiallyExpanded?: boolean;\n expanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void,\n titleClassName?: string,\n asField?: boolean,\n className?: string,\n innerClassName?: string\n}>) {\n\n useInjectStyles(\"ExpandablePanel\", `\n.CollapsibleContent {\n overflow: hidden;\n}\n.CollapsibleContent[data-state='open'] {\n animation: slideDown 220ms ease-out\n}\n.CollapsibleContent[data-state='closed'] {\n animation: slideUp 220ms ease-out;\n}\n\n@keyframes slideDown {\n from {\n height: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n }\n}\n\n@keyframes slideUp {\n from {\n height: var(--radix-collapsible-content-height);\n }\n to {\n height: 0;\n }\n}`);\n\n const [open, setOpen] = useState(expanded !== undefined ? expanded : initiallyExpanded);\n const [allowOverflow, setAllowOverflow] = useState(open);\n\n useEffect(() => {\n if (open) {\n setTimeout(() => {\n setAllowOverflow(true);\n }, 220);\n } else {\n setAllowOverflow(false);\n }\n }, [open]);\n\n useEffect(() => {\n if (expanded !== undefined)\n setOpen(expanded);\n }, [expanded]);\n\n return (<>\n <Collapsible.Root\n className={cls(\n !invisible && defaultBorderMixin + \" border\",\n \"rounded-lg\",\n \"w-full\",\n className\n )}\n open={open}\n onOpenChange={(updatedOpen: boolean) => {\n onExpandedChange?.(updatedOpen);\n setOpen(updatedOpen);\n }}>\n\n <Collapsible.Trigger asChild>\n <div\n className={cls(\n \"rounded-t-lg flex items-center justify-between w-full min-h-[52px]\",\n \"hover:bg-surface-hover active:bg-surface-active\",\n invisible ? \"border-b px-2\" : \"p-4\",\n open ? \"py-6\" : \"py-4\",\n \"transition-all duration-200\",\n invisible && defaultBorderMixin,\n asField && fieldBackgroundMixin,\n titleClassName,\n \"cursor-pointer\"\n )}\n role=\"button\"\n tabIndex={0}\n aria-expanded={open}\n >\n {title}\n <ChevronDownIcon className={cls(\"transition\", open ? \"rotate-180\" : \"\")}/>\n </div>\n </Collapsible.Trigger>\n\n <Collapsible.Content\n className={cls(\"CollapsibleContent\")}\n style={{\n overflow: allowOverflow ? \"visible\" : \"hidden\"\n }}\n >\n <div className={innerClassName}>\n {children}\n </div>\n </Collapsible.Content>\n </Collapsible.Root>\n </>\n )\n}\n","\"use client\";\nimport React from \"react\";\nimport { useDropzone } from \"react-dropzone\";\nimport { fieldBackgroundHoverMixin, fieldBackgroundMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { Typography } from \"./Typography\";\n\nexport interface FileUploadError {\n message: string;\n code: string;\n}\n\nexport type OnFileUploadRejected = (fileRejections: {\n file: File;\n errors: readonly FileUploadError[];\n}[], event: object) => void;\n\nexport type OnFilesUploadAdded = (files: File[]) => void;\n\nexport type FileUploadProps = {\n // e.g. accept={{ \"*/image\": [] }}\n accept?: Record<string, string[]>,\n onFilesAdded: OnFilesUploadAdded,\n onFilesRejected?: OnFileUploadRejected,\n maxSize?: number,\n disabled?: boolean;\n maxFiles?: number;\n title?: React.ReactNode;\n uploadDescription?: React.ReactNode;\n preventDropOnDocument?: boolean;\n size?: \"small\" | \"medium\" | \"large\";\n};\n\nexport function FileUpload({\n accept,\n onFilesAdded,\n onFilesRejected,\n maxSize,\n disabled,\n maxFiles,\n title,\n uploadDescription,\n children,\n preventDropOnDocument = true,\n size\n}: React.PropsWithChildren<FileUploadProps>) {\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject\n } = useDropzone({\n accept,\n noDragEventsBubbling: true,\n maxSize,\n onDrop: onFilesAdded,\n onDropRejected: onFilesRejected,\n disabled,\n maxFiles,\n preventDropOnDocument\n }\n );\n return <div\n {...getRootProps()}\n role=\"button\"\n aria-label={typeof title === \"string\" ? title : (typeof uploadDescription === \"string\" ? uploadDescription : \"Upload file\")}\n aria-disabled={disabled || undefined}\n className={cls(\n fieldBackgroundMixin,\n \"flex gap-2\",\n \"p-4 box-border relative items-center border-2 border-solid border-transparent outline-hidden rounded-lg duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary\",\n {\n \"h-44\": size === \"large\",\n \"h-28\": size === \"medium\",\n \"h-16\": size === \"small\",\n \"cursor-pointer\": !disabled,\n [fieldBackgroundHoverMixin]: !isDragActive,\n \"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-red-500\": isDragReject,\n \"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-green-500\": isDragAccept\n })}>\n\n <Typography variant={\"caption\"} color={\"secondary\"} className={\"absolute top-2 left-3.5 cursor-inherit\"}>\n {title}\n </Typography>\n\n <input\n {...getInputProps()}/>\n\n {children}\n\n <div\n className=\"grow h-28 box-border flex flex-col items-center justify-center text-center\">\n <Typography align={\"center\"}\n variant={\"label\"}\n className={\"flex flex-row gap-2 justify-center\"}>\n {uploadDescription}\n </Typography>\n </div>\n\n </div>\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport interface FilterChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /**\n * The text label displayed on the chip.\n */\n children: React.ReactNode;\n /**\n * Whether the chip is currently in an active/selected state.\n */\n active?: boolean;\n /**\n * Optional icon rendered before the label.\n */\n icon?: React.ReactNode;\n /**\n * Size variant.\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether the chip is disabled.\n */\n disabled?: boolean;\n}\n\nconst sizeClasses = {\n small: \"px-2 py-0.5 text-xs\",\n medium: \"px-2.5 py-1 text-xs\"\n};\n\n/**\n * A toggle chip used for filter presets and similar multi-select controls.\n *\n * Reads as a text tab: no fill at rest, the alpha highlight when active. It\n * shares no grammar with the tinted enum {@link Chip}, which carries a hue.\n *\n * @group Interactive components\n */\nexport const FilterChip = React.forwardRef<HTMLButtonElement, FilterChipProps>(function FilterChip({\n children,\n active = false,\n onClick,\n icon,\n size = \"medium\",\n className,\n disabled = false,\n ...rest\n}: FilterChipProps, ref) {\n return (\n <button\n ref={ref}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={cls(\n \"inline-flex items-center gap-1 rounded-md\",\n \"font-medium whitespace-nowrap select-none shrink-0\",\n \"transition-colors duration-150\",\n // Colour only, no width: the 2px comes from the global inset ring, which a\n // chip needs because the preset row it sits in is a horizontal\n // scroller — an outset ring on the first or last chip was cut off\n // by the scrollport edge.\n \"focus-visible:outline-none focus-visible:ring-primary/50\",\n sizeClasses[size],\n !disabled && \"cursor-pointer\",\n // Hover is one step along the same ramp the chip already sits\n // on, the way every other hoverable surface here moves. It used\n // to be `hover:bg-primary/5` for the inactive chip, which\n // *replaces* the resting fill with a tint fainter than it — so\n // pointing at a chip made its background vanish. The active chip\n // had no hover state at all.\n // These are view presets, not enum values, so they take the row\n // grammar (an alpha highlight for the active one, text otherwise)\n // and not the chip grammar (a hue tint). A primary ring here made\n // every preset look like a selected enum cell.\n active\n ? \"bg-surface-active text-text-primary dark:text-text-primary-dark\"\n : cls(\n \"bg-transparent text-text-secondary dark:text-text-secondary-dark\",\n !disabled && \"hover:bg-surface-hover\"\n ),\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...rest}\n >\n {icon}\n {children}\n </button>\n );\n});\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nconst colorClasses = {\n info: \"bg-blue-500/8 dark:bg-blue-500/12 text-blue-800 dark:text-blue-200 border border-blue-500/20 dark:border-blue-500/25\",\n warn: \"bg-amber-500/8 dark:bg-amber-500/12 text-amber-800 dark:text-amber-200 border border-amber-500/20 dark:border-amber-500/25\"\n}\n\nexport function InfoLabel({\n children,\n mode = \"info\"\n }: {\n children: React.ReactNode,\n mode?: \"info\" | \"warn\"\n}) {\n\n return (\n <div\n className={cls(\"my-3 py-2 px-4 rounded-lg text-sm font-medium leading-snug\", colorClasses[mode])}>\n {children}\n </div>\n )\n}\n","\"use client\";\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\ntype LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {\n border?: boolean,\n onClick?: React.MouseEventHandler<HTMLLabelElement>\n};\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n LabelProps\n>(({\n className,\n border,\n onClick,\n ...props\n }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n onClick={onClick}\n className={cls(\"text-sm font-medium peer-disabled:cursor-not-allowed\",\n border && \"border border-hairline-strong rounded-md px-3 py-1.5\",\n onClick && \"hover:cursor-pointer hover:bg-surface-hover\",\n defaultBorderMixin, className)}\n {...props}\n />\n))\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n","import React from \"react\";\nimport { Button, ButtonProps } from \"./Button\";\nimport { CircularProgress } from \"./CircularProgress\";\n\nexport type LoadingButtonProps<P extends React.ElementType> = ButtonProps<P> & {\n startIcon?: React.ReactNode;\n loading?: boolean;\n}\n\nexport function LoadingButton<P extends React.ElementType = \"button\">({\n children,\n loading,\n disabled,\n onClick,\n startIcon,\n ...props\n }: LoadingButtonProps<P>) {\n return (\n <Button\n disabled={loading || disabled}\n onClick={onClick}\n component={props.component as React.ElementType}\n {...props}\n >\n {loading && (\n <CircularProgress size={\"smallest\"}/>\n )}\n {!loading && startIcon}\n {children}\n </Button>\n );\n};\n","\"use client\";\nimport React, { useMemo } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport MarkdownIt from \"markdown-it\";\nimport { cls } from \"../util\";\n\nexport interface MarkdownProps {\n source: string,\n size?: \"small\" | \"medium\" | \"large\" | \"xl\" | \"2xl\";\n className?: string\n}\n\nconst proseClasses = {\n small: \"prose prose-sm typography-body2\",\n medium: \"prose typography-body1\",\n large: \"prose prose-lg\",\n xl: \"prose prose-xl\",\n \"2xl\": \"prose prose-2xl\"\n};\n\n/**\n * Tailwind typography-plugin weight overrides.\n * The plugin defaults to very heavy weights (h1: 800, h2: 700, h3/h4: 600,\n * strong: 600, code: 600) which clash with the Rebase design-system that uses\n * font-light (300) / font-normal (400) for headings.\n * We reset them here so rendered markdown matches the rest of the UI.\n */\nconst proseWeightOverrides = [\n \"prose-headings:font-normal\",\n \"prose-strong:font-semibold\",\n \"prose-code:font-normal\",\n \"prose-blockquote:font-normal\",\n \"prose-a:font-normal\"\n].join(\" \");\n\nconst md = new MarkdownIt({ html: false });\n/**\n * @group Preview components\n */\nexport const Markdown = React.memo<MarkdownProps>(function Markdown({\n source,\n className,\n size = \"medium\"\n }: MarkdownProps) {\n const html = useMemo(() => {\n return md.render(typeof source === \"string\" ? source : \"\");\n }, [source]);\n\n return <div\n className={cls(proseClasses[size], \"dark:prose-invert prose-headings:font-title\", proseWeightOverrides, className)}\n dangerouslySetInnerHTML={{ __html: html }}\n />;\n }\n , equal) as React.FunctionComponent<MarkdownProps>;\n","\"use client\";\nimport React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { focusedDisabled, paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type MenuProps = {\n children: React.ReactNode;\n trigger: React.ReactNode;\n\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n\n portalContainer?: HTMLElement | null;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n\n sideOffset?: number;\n className?: string;\n}\n\nconst Menu = React.forwardRef<\n React.ElementRef<typeof DropdownMenu.Trigger>,\n MenuProps\n>(({\n children,\n trigger,\n open,\n defaultOpen,\n side,\n align,\n onOpenChange,\n portalContainer,\n sideOffset = 4,\n className\n }, ref) => {\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n return (\n <DropdownMenu.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}>\n <DropdownMenu.Trigger\n ref={ref}\n asChild>\n {trigger}\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal container={finalContainer}>\n <DropdownMenu.Content\n side={side}\n sideOffset={sideOffset}\n align={align}\n // `z-50` is the floating layer — the tier `Dialog`, `Sheet`,\n // `Select` and `Tooltip` all sit on. Radix copies this value\n // onto the popper wrapper it portals next to them, so at any\n // lower value the menu opens *behind* the dialog or sheet it\n // was opened from: visible in the DOM, painted under the\n // overlay, and unclickable. Peers on this tier stack by mount\n // order, which is what puts a menu above the dialog holding\n // its trigger, and a dialog that menu opens above them both.\n className={cls(paperMixin, focusedDisabled, \"py-2 z-50\", className)}>\n {children}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n})\nMenu.displayName = \"Menu\"\n\nexport { Menu }\n\nexport type MenuItemProps = {\n children: React.ReactNode;\n dense?: boolean;\n disabled?: boolean;\n onClick?: (event: React.MouseEvent) => void;\n className?: string;\n};\n\nexport const MenuItem = React.memo(({\n children,\n dense = false, // Default value is false if not provided\n disabled = false,\n onClick,\n className\n }: MenuItemProps) => {\n // Dynamically adjusting the class based on the \"dense\" prop\n const classNames = cls(\n onClick && !disabled && \"cursor-pointer\",\n disabled && \"opacity-50 cursor-not-allowed\",\n \"rounded-md text-sm font-medium text-surface-accent-700 dark:text-surface-accent-300 flex items-center gap-4 transition-colors duration-150\",\n !disabled && \"hover:bg-surface-hover\",\n dense ? \"px-4 py-1.5\" : \"px-4 py-2\",\n className\n );\n\n return (\n <DropdownMenu.Item\n className={classNames}\n disabled={disabled}\n onClick={disabled ? undefined : onClick}>\n {children}\n </DropdownMenu.Item>\n );\n});\n\nMenuItem.displayName = \"MenuItem\";\n","\nimport * as React from \"react\";\n\nimport * as MenubarPrimitive from \"@radix-ui/react-menubar\";\nimport { cls } from \"../util\";\nimport { CheckIcon, ChevronRightIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport function Menubar({\n children,\n onSelect,\n value,\n defaultValue,\n onValueChange,\n className\n }: {\n children: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n /** Value of the open menu, controlled. Pair with `onValueChange`. */\n value?: string,\n /** Value of the menu open on mount, uncontrolled. */\n defaultValue?: string,\n onValueChange?: (value: string) => void,\n className?: string\n}) {\n return (\n <MenubarPrimitive.Root\n onSelect={onSelect}\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n className={cls(\"z-10 flex bg-surface-card p-[3px] rounded-lg shadow-sm\", className)}>\n {children}\n </MenubarPrimitive.Root>\n )\n}\n\nexport function MenubarMenu({\n children,\n value\n }: {\n children: React.ReactNode,\n /** Identifies this menu to the parent Menubar's `value`/`defaultValue`. */\n value?: string\n}) {\n return (\n <MenubarPrimitive.Menu value={value}>\n {children}\n </MenubarPrimitive.Menu>\n )\n}\n\nexport function MenubarTrigger({\n children,\n onSelect,\n className\n }: {\n children: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n className?: string\n}) {\n return (\n <MenubarPrimitive.Trigger\n onSelect={onSelect}\n className={cls(\"py-2 px-3 outline-none select-none font-medium leading-none rounded-md text-text-primary dark:text-text-primary-dark text-sm transition-colors duration-150 flex items-center justify-between gap-[2px] data-[highlighted]:bg-surface-hover data-[state=open]:bg-surface-active hover:bg-surface-hover\",\n className)}>\n {children}\n </MenubarPrimitive.Trigger>\n )\n}\n\nexport function MenubarPortal({\n children,\n portalContainer\n }: {\n children: React.ReactNode;\n portalContainer?: HTMLElement | null;\n}) {\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n return (\n <MenubarPrimitive.Portal container={finalContainer}>\n {children}\n </MenubarPrimitive.Portal>\n )\n}\n\nexport function MenubarContent({\n children,\n className,\n align,\n sideOffset,\n alignOffset,\n onSelect,\n ...rest\n }: {\n children: React.ReactNode,\n className?: string,\n onSelect?: (event: React.SyntheticEvent) => void,\n align?: \"start\" | \"center\" | \"end\",\n sideOffset?: number,\n alignOffset?: number\n}) {\n return (\n <MenubarPrimitive.Content\n onSelect={onSelect}\n // `z-50`, the floating layer — see the note in `Menu`. This carried\n // no z-index at all, so the wrapper Radix portals out to the body\n // got `auto` and the menu opened underneath any dialog or panel it\n // was hosted in.\n className={cls(\"z-50 min-w-[220px] bg-surface-card rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]\", className)}\n align={align ?? \"start\"}\n sideOffset={sideOffset ?? 5}\n alignOffset={alignOffset ?? -3}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Content>\n )\n}\n\nexport function MenubarItem({\n children,\n leftPadding,\n className,\n disabled,\n onSelect,\n ...rest\n }: {\n children: React.ReactNode,\n onSelect?: (event: Event) => void;\n leftPadding?: boolean,\n className?: string,\n disabled?: boolean\n}) {\n return (\n <MenubarPrimitive.Item\n onSelect={onSelect}\n className={cls(\"group text-sm leading-none rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 outline-none data-[state=open]:bg-surface-active data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n leftPadding ? \"pl-5\" : \"\",\n disabled ? \"pointer-events-none text-text-secondary dark:text-text-secondary-dark\" : \"text-text-primary dark:text-text-primary-dark\",\n className)}\n disabled={disabled}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Item>\n )\n}\n\nexport function MenubarSeparator({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.Separator\n className={cls(\"h-[1px] bg-hairline m-[5px]\", className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.Separator>\n )\n}\n\nexport function MenubarSub({\n children,\n ...rest\n }: {\n children?: React.ReactNode,\n}) {\n return (\n <MenubarPrimitive.Sub\n {...rest}\n >\n {children}\n </MenubarPrimitive.Sub>\n )\n}\n\nexport function MenubarSubTrigger({\n children,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.SubTrigger\n onSelect={onSelect}\n className={cls(\"group text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 outline-none data-[state=open]:bg-surface-active data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.SubTrigger>\n )\n}\n\nexport function MenubarSubContent({\n children,\n alignOffset,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n alignOffset?: number,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.SubContent\n onSelect={onSelect}\n alignOffset={alignOffset ?? -5}\n className={cls(\"min-w-[220px] bg-surface-card rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]\",\n className)}\n {...rest}\n >\n {children}\n </MenubarPrimitive.SubContent>\n )\n}\n\nexport function MenubarCheckboxItem({\n children,\n checked,\n onCheckedChange,\n className,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: Event) => void;\n checked?: boolean,\n onCheckedChange?: () => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.CheckboxItem\n onSelect={onSelect}\n className={cls(\"text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 pl-5 outline-none data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n checked={checked}\n onCheckedChange={onCheckedChange}\n {...rest}\n >\n {children}\n </MenubarPrimitive.CheckboxItem>\n )\n}\n\nexport function MenubarItemIndicator({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.ItemIndicator\n className={cls(\"absolute left-0 w-4 inline-flex items-center justify-center\", className)}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.smallest}/>}\n </MenubarPrimitive.ItemIndicator>\n )\n}\n\nexport function MenubarRadioGroup({\n children,\n className,\n value,\n onValueChange,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: React.SyntheticEvent) => void,\n value?: string,\n onValueChange?: (value: string) => void,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.RadioGroup\n className={cls(className)}\n value={value}\n onValueChange={onValueChange}\n onSelect={onSelect}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.small}/>}\n </MenubarPrimitive.RadioGroup>\n )\n}\n\nexport function MenubarRadioItem({\n children,\n className,\n value,\n onSelect,\n ...rest\n }: {\n children?: React.ReactNode,\n onSelect?: (event: Event) => void;\n value: string,\n className?: string,\n}) {\n return (\n <MenubarPrimitive.RadioItem\n onSelect={onSelect}\n className={cls(\"text-sm leading-none text-text-primary dark:text-text-primary-dark rounded-md flex items-center h-[32px] px-[10px] py-[2px] relative select-none transition-colors duration-150 pl-5 outline-none data-[highlighted]:bg-surface-hover data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none\",\n className)}\n value={value}\n {...rest}>\n {children ?? <CheckIcon size={iconSize.small}/>}\n </MenubarPrimitive.RadioItem>\n )\n}\n\nexport function MenubarShortcut({\n children,\n className,\n ...rest\n }: {\n children?: React.ReactNode,\n className?: string,\n}) {\n return (\n <div\n className={cls(\"ml-auto pl-5 group-data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark\",\n className)}\n {...rest}>\n {children}\n </div>\n )\n}\n\nexport function MenubarSubTriggerIndicator() {\n return (\n <div className=\"ml-auto pl-5 \">\n <ChevronRightIcon size={iconSize.small}/>\n </div>\n )\n}\n","import * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport { cls } from \"../util\";\n\nexport function Separator({\n orientation,\n decorative,\n className\n }: {\n orientation: \"horizontal\" | \"vertical\",\n decorative?: boolean,\n className?: string\n}) {\n if (orientation === \"horizontal\")\n return (\n <SeparatorPrimitive.Root\n decorative={decorative}\n orientation=\"horizontal\"\n className={cls(\"bg-hairline data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px my-4\", className)}/>\n );\n else\n return (\n <SeparatorPrimitive.Root\n className={cls(\"bg-hairline data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px mx-4\", className)}\n decorative={decorative}\n orientation=\"vertical\"\n />\n );\n}\n","import React from \"react\";\nimport { cls } from \"../../util\";\n\n/**\n * The label above a Select or MultiSelect.\n *\n * It used `text-surface-accent-500` — a SURFACE scale, borrowed for type. The\n * label above a TextField has always used `text-text-secondary`, and the two are\n * the same role, so a form mixing the components showed two different label\n * colours: `#64748b` blue-grey over a Select, `#757575` neutral over a TextField.\n * Measured side by side on /debug/ui, which is where it is most obvious, because\n * the reference puts them in adjacent columns.\n *\n * The text tokens are also the tuned ones: `--color-surface-500` was moved to\n * #797979 precisely so muted type clears AA on both grounds. The slate scale\n * carries no such guarantee — it is for surfaces.\n */\nexport function SelectInputLabel({ children, error }: { children: React.ReactNode, error?: boolean }) {\n return <div className={cls(\"text-sm font-medium ml-3.5 mb-1\",\n error ? \"text-red-600 dark:text-red-500\" : \"text-text-secondary dark:text-text-secondary-dark\")}>\n {children}\n </div>;\n}\n","\n\"use client\";\nimport { CheckIcon, ChevronDownIcon, XIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { ChangeEvent, Children, useEffect, useState } from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cls } from \"../util\";\n\nimport { Separator } from \"./Separator\";\nimport { Chip } from \"./Chip\";\nimport { SelectInputLabel } from \"./common/SelectInputLabel\";\nimport {\n defaultBorderMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedDisabled\n} from \"../styles\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type MultiSelectValue = string | number | boolean;\n\n// Make the context properly generic\ninterface MultiSelectContextProps<T extends MultiSelectValue = string> {\n fieldValue?: T[];\n onItemClick: (v: T) => void;\n}\n\n// Create a proper generic context\nexport const MultiSelectContext = React.createContext<MultiSelectContextProps<MultiSelectValue>>(null! as MultiSelectContextProps<MultiSelectValue>);\n\n/**\n * Props for MultiSelect component\n */\ninterface MultiSelectProps<T extends MultiSelectValue = string> {\n modalPopover?: boolean;\n className?: string;\n open?: boolean,\n name?: string,\n id?: string,\n onOpenChange?: (open: boolean) => void,\n value?: T[],\n inputClassName?: string,\n onChange?: React.EventHandler<ChangeEvent<HTMLSelectElement>>,\n onValueChange?: (updatedValue: T[]) => void,\n placeholder?: React.ReactNode,\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n useChips?: boolean,\n label?: React.ReactNode | string,\n disabled?: boolean,\n error?: boolean,\n position?: \"item-aligned\" | \"popper\",\n endAdornment?: React.ReactNode,\n multiple?: boolean,\n includeSelectAll?: boolean,\n includeClear?: boolean,\n inputRef?: React.Ref<HTMLButtonElement>,\n padding?: boolean,\n invisible?: boolean,\n children: React.ReactNode;\n renderValues?: (values: T[]) => React.ReactNode;\n portalContainer?: HTMLElement | null;\n /**\n * Accessible name for the trigger.\n *\n * Without it the name is whatever the button happens to contain — the\n * selected chips, or nothing at all when the field is empty — so an empty\n * multi-select announced itself as an unnamed button. `label` cannot serve:\n * an entity form passes an element there, because the label carries the\n * property's type icon.\n */\n \"aria-label\"?: string;\n}\n\n// Use generic type for the forwarded ref\nexport const MultiSelect = React.forwardRef<\n HTMLButtonElement,\n MultiSelectProps\n>(\n (\n {\n value,\n size = \"large\",\n label,\n error,\n onValueChange,\n invisible,\n disabled,\n placeholder,\n modalPopover = true,\n includeClear = true,\n includeSelectAll = true,\n useChips = true,\n className,\n inputClassName,\n inputRef,\n children,\n renderValues,\n open,\n onOpenChange,\n portalContainer,\n \"aria-label\": ariaLabel\n },\n ref\n ) => {\n const [isMounted, setIsMounted] = useState(false);\n const [isPopoverOpen, setIsPopoverOpen] = useState(open ?? false);\n const [selectedValues, setSelectedValues] = useState<string[]>(value ?? []);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n const onPopoverOpenChange = (open: boolean) => {\n setIsPopoverOpen(open);\n onOpenChange?.(open);\n }\n\n useEffect(() => {\n setIsPopoverOpen(open ?? false);\n }, [open]);\n\n const allValues = React.useMemo(() => children\n ?\n Children.map(children, (child) => {\n if (React.isValidElement<MultiSelectItemProps>(child)) {\n return child.props.value;\n }\n return null;\n })?.filter(Boolean) ?? []\n : [], [children]);\n\n const optionsMap = React.useMemo(() => {\n const map = new Map<string, React.ReactNode>();\n Children.forEach(children, (child) => {\n if (React.isValidElement<MultiSelectItemProps>(child)) {\n map.set(String(child.props.value), child.props.children);\n }\n });\n return map;\n }, [children]);\n\n React.useEffect(() => {\n setSelectedValues(value ?? []);\n }, [value]);\n\n const updateValues = React.useCallback((values: string[]) => {\n setSelectedValues(values);\n onValueChange?.(values);\n }, [onValueChange]);\n\n const onItemClick = React.useCallback((newValue: MultiSelectValue) => {\n let newSelectedValues: string[];\n if (selectedValues.some(v => String(v) === String(newValue))) {\n newSelectedValues = selectedValues.filter(v => String(v) !== String(newValue));\n } else {\n newSelectedValues = [...selectedValues, String(newValue)];\n }\n updateValues(newSelectedValues);\n }, [selectedValues, updateValues]);\n\n const handleInputKeyDown = (\n event: React.KeyboardEvent<HTMLInputElement>\n ) => {\n if (event.key === \"Enter\") {\n onPopoverOpenChange(true);\n } else if (event.key === \"Backspace\" && !event.currentTarget.value) {\n const newSelectedValues = [...selectedValues];\n newSelectedValues.pop();\n updateValues(newSelectedValues);\n }\n };\n\n const toggleOption = (value: string) => {\n const newSelectedValues = selectedValues.some(v => String(v) === String(value))\n ? selectedValues.filter(v => String(v) !== String(value))\n : [...selectedValues, value];\n updateValues(newSelectedValues);\n };\n\n const handleClear = () => {\n updateValues([]);\n };\n\n const handleTogglePopover = () => {\n onPopoverOpenChange(!isPopoverOpen);\n };\n\n const toggleAll = () => {\n if (selectedValues.length === allValues.length) {\n handleClear();\n } else {\n updateValues(allValues);\n }\n onPopoverOpenChange(false);\n };\n\n // Scoped to this popover. Unscoped, it reached every other cmdk list on\n // the page — the relation and user selectors set their own height on\n // the list and got a second, competing scroll container inside it.\n useInjectStyles(\"MultiSelect\", `\n[data-multi-select-content] [cmdk-group] {\n max-height: 45vh;\n overflow-y: auto;\n} `)\n\n const contextValue = React.useMemo(() => ({\n fieldValue: selectedValues,\n onItemClick\n }), [selectedValues, onItemClick]);\n\n return (\n <MultiSelectContext.Provider value={contextValue}>\n\n {typeof label === \"string\" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}\n\n <PopoverPrimitive.Root\n open={isMounted && isPopoverOpen}\n onOpenChange={onPopoverOpenChange}\n modal={modalPopover}\n >\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={inputRef ?? ref}\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n onClick={handleTogglePopover}\n className={cls(\n // The control height, plus the 1px hairline on\n // each side when the field has one. `TextField`,\n // `Select` and `DateTimeField` set the height on\n // an inner element and draw the border around\n // it, so a bordered field is N + 2. This button\n // is both the box and the border, and under\n // border-box sizing the border ate into N: a\n // multi-select stood 2px short of every field\n // beside it. An invisible one has no border and\n // stays N, like theirs.\n invisible\n ? { smallest: \"min-h-[28px]\", small: \"min-h-[32px]\", medium: \"min-h-[40px]\", large: \"min-h-[48px]\" }[size]\n : { smallest: \"min-h-[30px]\", small: \"min-h-[34px]\", medium: \"min-h-[42px]\", large: \"min-h-[50px]\" }[size],\n {\n // Kept tight so the min-height above governs:\n // py-2 plus a medium Chip overflowed it and made\n // smallest/small render at the same height.\n \"py-0\": size === \"smallest\",\n \"py-0.5\": size === \"small\",\n \"py-1\": size === \"medium\" || size === \"large\"\n },\n {\n \"px-2\": size === \"small\" || size === \"smallest\",\n \"px-4\": size === \"medium\" || size === \"large\"\n },\n \"select-none rounded-lg text-sm\",\n \"focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n \"relative flex items-center\",\n className,\n inputClassName\n )}\n >\n {selectedValues.length > 0 ? (\n <div className=\"flex justify-between items-center w-full\">\n <div className=\"flex flex-wrap items-center gap-1.5 text-start\">\n {renderValues && renderValues(selectedValues)}\n {!renderValues && selectedValues.map((value) => {\n\n const optionChildren = optionsMap.get(String(value));\n if (!useChips) {\n return optionChildren;\n }\n return (\n <Chip\n size={size === \"smallest\" || size === \"small\" ? \"smallest\" : \"small\"}\n key={String(value)}\n className={cls(\"flex flex-row items-center p-1\")}\n >\n {optionChildren}\n <XIcon\n size={iconSize.smallest}\n onClick={(event) => {\n event.stopPropagation();\n toggleOption(value);\n }}\n />\n </Chip>\n );\n })}\n </div>\n <div className=\"flex items-center justify-between\">\n {includeClear && <XIcon\n className={\"ml-4\"}\n size={iconSize.small}\n onClick={(event) => {\n event.stopPropagation();\n handleClear();\n }}\n />}\n <div className={cls(\"px-2 h-full flex items-center\")}>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", isPopoverOpen ? \"rotate-180\" : \"\")}/>\n </div>\n </div>\n </div>\n ) : (\n <div className=\"flex items-center justify-between w-full mx-auto\">\n <span className=\"text-sm\">\n {placeholder}\n </span>\n <div className={cls(\"px-2 h-full flex items-center\")}>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", isPopoverOpen ? \"rotate-180\" : \"\")}/>\n </div>\n </div>\n )}\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal container={finalContainer}>\n <PopoverPrimitive.Content\n data-multi-select-content\n className={cls(\"z-50 overflow-hidden border bg-surface-card rounded-lg w-[400px]\", defaultBorderMixin)}\n align=\"start\"\n sideOffset={8}\n onEscapeKeyDown={() => onPopoverOpenChange(false)}\n >\n <CommandPrimitive>\n <div className={\"flex flex-row items-center\"}>\n <CommandPrimitive.Input\n className={cls(focusedDisabled, \"bg-transparent outline-none flex-1 h-full w-full m-4 flex-grow text-surface-accent-900 dark:text-white\")}\n placeholder=\"Search...\"\n onKeyDown={handleInputKeyDown}\n />\n {selectedValues.length > 0 && (\n <div\n onClick={handleClear}\n className=\"text-sm justify-center cursor-pointer py-3 px-4 text-text-secondary dark:text-text-secondary-dark\">\n Clear\n </div>\n )}\n </div>\n <Separator orientation={\"horizontal\"} className={\"my-0\"}/>\n <CommandPrimitive.List>\n <CommandPrimitive.Empty className={\"px-4 py-2 text-sm text-text-secondary dark:text-text-secondary-dark\"}>\n No results found.\n </CommandPrimitive.Empty>\n <CommandPrimitive.Group>\n {includeSelectAll && <CommandPrimitive.Item\n key=\"all\"\n onSelect={toggleAll}\n className={\n cls(\n \"flex flex-row items-center gap-1.5\",\n \"cursor-pointer\",\n \"m-1\",\n \"ring-offset-transparent\",\n \"p-1 rounded-md aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-primary/75 aria-[selected=true]:ring-offset-2\",\n \"aria-[selected=true]:bg-surface-active\",\n \"cursor-pointer p-2 rounded-md aria-[selected=true]:bg-surface-active\"\n )\n }\n >\n <InnerCheckBox checked={selectedValues.length === allValues.length}/>\n <span className={\"text-sm text-text-secondary dark:text-text-secondary-dark\"}>(Select All)</span>\n </CommandPrimitive.Item>}\n {children}\n </CommandPrimitive.Group>\n </CommandPrimitive.List>\n </CommandPrimitive>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </MultiSelectContext.Provider>\n );\n }\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n\nexport interface MultiSelectItemProps<T extends MultiSelectValue = string> {\n value: T;\n children?: React.ReactNode,\n className?: string;\n}\n\nexport const MultiSelectItem = React.memo(function MultiSelectItem<T extends MultiSelectValue = string>({\n children,\n value,\n className\n}: MultiSelectItemProps<T>) {\n const context = React.useContext(MultiSelectContext);\n if (!context) throw new Error(\"MultiSelectItem must be used inside a MultiSelect\");\n const {\n fieldValue,\n onItemClick\n } = context;\n\n const isSelected = (fieldValue ?? []).some(v => String(v) === String(value));\n\n return <CommandPrimitive.Item\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n onSelect={(_) => {\n onItemClick(value);\n }}\n className={cls(\n \"flex flex-row items-center gap-1.5\",\n isSelected ? \"bg-surface-active\" : \"\",\n \"cursor-pointer\",\n \"m-1\",\n \"ring-offset-transparent\",\n \"p-1 rounded-md aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-primary/75 aria-[selected=true]:ring-offset-2\",\n \"aria-[selected=true]:bg-surface-active\",\n \"cursor-pointer p-2 rounded-md aria-[selected=true]:bg-surface-active\",\n \"text-surface-accent-700 dark:text-surface-accent-300\",\n className\n )}\n >\n <InnerCheckBox checked={isSelected}/>\n {children}\n </CommandPrimitive.Item>;\n});\n\nconst InnerCheckBox = React.memo(function InnerCheckBox({ checked }: { checked: boolean }) {\n return <div className={cls(\n \"p-2\",\n \"w-8 h-8\",\n \"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150\"\n )}>\n <div\n className={cls(\n \"border-2 relative transition-colors ease-in-out duration-150\",\n \"w-4 h-4 rounded-sm flex items-center justify-center\",\n (checked ? \"bg-primary\" : \"bg-surface-card\"),\n (checked) ? \"text-surface-accent-100 dark:text-surface-accent-900\" : \"\",\n (checked ? \"border-transparent\" : \"border-surface-accent-800 dark:border-surface-accent-200\")\n )}>\n {checked && <CheckIcon size={iconSize.smallest} className={\"absolute\"}/>}\n </div>\n </div>\n});\n","import React from \"react\";\n\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport function Paper({\n children,\n style,\n className\n }: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n\n}) {\n return (\n <div\n className={cls(paperMixin, className)}\n style={style}>\n {children}\n </div>\n )\n}\n","\"use client\";\nimport * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { cls } from \"../util\";\n\nexport interface RadioGroupProps {\n id?: string;\n children: React.ReactNode;\n name?: string\n required?: boolean;\n disabled?: boolean;\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: boolean;\n defaultValue?: string;\n value?: string;\n\n onValueChange?(value: string): void;\n\n className?: string;\n}\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({\n className,\n ...props\n }, ref) => {\n return (\n <RadioGroupPrimitive.Root\n className={cls(\"grid gap-2\", className)}\n {...props}\n ref={ref}\n />\n )\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport interface RadioGroupItemProps {\n id?: string;\n value: string;\n checked?: boolean;\n required?: boolean;\n className?: string;\n disabled?: boolean;\n}\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({\n className,\n ...props\n }, ref) => {\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cls(\n \"aspect-square h-4 w-4 rounded-full border border-primary text-primary focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <div className=\"h-2.5 w-2.5 fill-current text-current bg-primary rounded-full\"/>\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type ResizablePanelsProps = {\n firstPanel: React.ReactNode;\n secondPanel: React.ReactNode;\n /** Whether the first panel is visible (e.g. Sidebar) */\n showFirstPanel?: boolean;\n /** Whether the second panel is visible (e.g. Results) */\n showSecondPanel?: boolean;\n /** 0-100 representing the width/height of the first panel */\n panelSizePercent: number;\n onPanelSizeChange: (sizePercent: number) => void;\n minPanelSizePx?: number;\n orientation?: \"horizontal\" | \"vertical\";\n animateLayout?: boolean;\n className?: string;\n stacked?: boolean;\n};\n\nexport function ResizablePanels({\n firstPanel,\n secondPanel,\n showFirstPanel = true,\n showSecondPanel = true,\n panelSizePercent,\n onPanelSizeChange,\n minPanelSizePx = 200,\n orientation = \"horizontal\",\n animateLayout = true,\n className,\n stacked = false\n}: ResizablePanelsProps) {\n\n const containerRef = useRef<HTMLDivElement>(null);\n const isResizingRef = useRef(false);\n\n // For local layout tracking without triggering React rerenders during drag\n const firstPanelRef = useRef<HTMLDivElement>(null);\n const startPosRef = useRef(0);\n const startSizeRef = useRef(0);\n\n const [isResizing, setIsResizing] = useState(false);\n const isHorizontal = orientation === \"horizontal\";\n\n const handleResizeStart = useCallback((e: React.MouseEvent) => {\n if (!showFirstPanel || !showSecondPanel) return;\n\n e.preventDefault();\n isResizingRef.current = true;\n setIsResizing(true);\n\n startPosRef.current = isHorizontal ? e.clientX : e.clientY;\n\n if (firstPanelRef.current) {\n const rect = firstPanelRef.current.getBoundingClientRect();\n startSizeRef.current = isHorizontal ? rect.width : rect.height;\n }\n\n document.body.style.cursor = isHorizontal ? \"col-resize\" : \"row-resize\";\n document.body.style.userSelect = \"none\";\n }, [isHorizontal, showFirstPanel, showSecondPanel]);\n\n useEffect(() => {\n const handleMouseMove = (e: MouseEvent) => {\n if (!isResizingRef.current || !containerRef.current) return;\n\n const currentPos = isHorizontal ? e.clientX : e.clientY;\n const delta = currentPos - startPosRef.current; // Dragging right/down increases first panel size\n\n let newSize = startSizeRef.current + delta;\n\n const containerRect = containerRef.current.getBoundingClientRect();\n const containerTotal = isHorizontal ? containerRect.width : containerRect.height;\n\n // Limit the maximum size to prevent pushing the second panel offscreen\n const maxSize = containerTotal - minPanelSizePx;\n\n newSize = Math.max(minPanelSizePx, Math.min(newSize, maxSize));\n\n // Directly update the DOM for performance while dragging\n if (firstPanelRef.current) {\n firstPanelRef.current.style.flexBasis = `${newSize}px`;\n }\n };\n\n const handleMouseUp = () => {\n if (isResizingRef.current && containerRef.current && firstPanelRef.current) {\n // Calculate the final percentage\n const containerRect = containerRef.current.getBoundingClientRect();\n const firstPanelRect = firstPanelRef.current.getBoundingClientRect();\n\n const containerSize = isHorizontal ? containerRect.width : containerRect.height;\n const finalSize = isHorizontal ? firstPanelRect.width : firstPanelRect.height;\n\n // Pre-set the DOM to the exact % value BEFORE re-enabling transitions.\n // This prevents the visual \"snap\" that occurs when switching from px → %\n // with the CSS transition active.\n if (containerSize > 0) {\n const newPercent = (finalSize / containerSize) * 100;\n firstPanelRef.current.style.flexBasis = `${newPercent}%`;\n onPanelSizeChange(Math.max(0, Math.min(100, newPercent)));\n }\n\n isResizingRef.current = false;\n setIsResizing(false);\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n }\n };\n\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [onPanelSizeChange, isHorizontal, minPanelSizePx]);\n\n // Calculate applied size\n const appliedBasis = !showFirstPanel ? \"0%\" : (showSecondPanel ? `${panelSizePercent}%` : \"100%\");\n\n return (\n <div\n ref={containerRef}\n className={cls(\n \"relative w-full h-full flex overflow-hidden\",\n !stacked && (isHorizontal ? \"flex-row\" : \"flex-col\"),\n className\n )}\n >\n {/* First Panel */}\n <div\n ref={firstPanelRef}\n className={cls(\n stacked ? \"absolute inset-0\" : \"relative flex-shrink-0\",\n \"flex flex-col overflow-hidden\",\n !stacked && !isResizing && animateLayout && \"transition-[flex-basis] duration-150 ease-out\",\n !showFirstPanel && \"hidden\"\n )}\n style={stacked ? undefined : {\n flexBasis: appliedBasis,\n minWidth: isHorizontal && showFirstPanel && showSecondPanel ? `${minPanelSizePx}px` : undefined,\n minHeight: !isHorizontal && showFirstPanel && showSecondPanel ? `${minPanelSizePx}px` : undefined,\n maxWidth: showSecondPanel ? undefined : \"100%\",\n maxHeight: showSecondPanel ? undefined : \"100%\"\n }}\n >\n {firstPanel}\n </div>\n\n {/* Divider */}\n {!stacked && showFirstPanel && showSecondPanel && (\n <div\n // The divider is a handle, not a rule: invisible until the\n // pointer is on it. The two panels it separates already\n // differ by a surface step, and a permanent 1px line between\n // them was one of six on the split record view where the\n // reference draws one.\n className={cls(\n \"relative z-10 flex flex-shrink-0 items-center justify-center border-transparent\",\n isHorizontal ? \"border-l w-px h-full cursor-col-resize\" : \"border-t h-px w-full cursor-row-resize\"\n )}\n onMouseDown={handleResizeStart}\n >\n {/* Transparent Hit Area with Pill inside */}\n <div className={cls(\n \"absolute flex items-center justify-center group\",\n isHorizontal ? \"w-4 h-full cursor-col-resize top-0\" : \"h-4 w-full cursor-row-resize left-0\"\n )}>\n <div className={cls(\n \"bg-primary/60 dark:bg-primary rounded-full opacity-0 group-hover:opacity-100 transition-all duration-200\",\n isHorizontal ? \"w-1 h-8\" : \"h-1 w-8\"\n )}/>\n </div>\n </div>\n )}\n\n {/* Second Panel */}\n <div\n className={cls(\n stacked ? \"absolute inset-0\" : \"flex-grow relative min-w-0 min-h-0\",\n \"flex flex-col overflow-hidden\",\n !showSecondPanel && \"hidden\"\n )}\n >\n {secondPanel}\n </div>\n </div>\n );\n}\n","\n\"use client\";\nimport { SearchIcon, XIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport React, { useCallback, useState } from \"react\";\n\nimport { defaultBorderMixin } from \"../styles\";\nimport { CircularProgress } from \"./CircularProgress\";\nimport { IconButton } from \"./IconButton\";\n\nimport { cls } from \"../util\";\nimport { useDebounceValue } from \"../hooks\";\n\ninterface SearchBarProps {\n onClick?: () => void;\n onTextSearch?: (searchString?: string) => void;\n placeholder?: string;\n expandable?: boolean;\n /**\n * Size of the search bar.\n * - \"small\": 32px height (matches TextField small)\n * - \"medium\": 44px height (matches TextField medium)\n * @default \"medium\"\n */\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n innerClassName?: string;\n className?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n loading?: boolean;\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Optional initial value for the search input, e.g. from URL params.\n */\n initialValue?: string;\n}\n\nexport function SearchBar({\n onClick,\n onTextSearch,\n placeholder = \"Search\",\n expandable = false,\n size = \"medium\",\n innerClassName,\n className,\n autoFocus,\n disabled,\n loading,\n inputRef,\n initialValue\n}: SearchBarProps) {\n\n const [searchText, setSearchText] = useState<string>(initialValue ?? \"\");\n const [active, setActive] = useState<boolean>(false);\n\n const deferredValues = useDebounceValue(searchText, 200);\n\n /**\n * Debounce on SearchIcon text update\n */\n React.useEffect(() => {\n if (!onTextSearch) return;\n if (deferredValues) {\n onTextSearch(deferredValues);\n } else {\n onTextSearch(undefined);\n }\n }, [deferredValues]);\n\n const clearText = useCallback(() => {\n if (!onTextSearch) return;\n setSearchText(\"\");\n onTextSearch(undefined);\n }, [onTextSearch]);\n\n // Height classes matching TextField sizes\n // Heights come from the shared control scale (styles.ts) so a SearchBar\n // lines up with the Button and Select beside it in a toolbar.\n const heightClass = { smallest: \"h-[28px]\", small: \"h-[32px]\", medium: \"h-[40px]\", large: \"h-[48px]\" }[size];\n const iconPaddingClass = size === \"smallest\" || size === \"small\" ? \"px-2\" : size === \"medium\" ? \"px-3\" : \"px-4\";\n const inputPaddingClass = size === \"smallest\" || size === \"small\" ? \"pl-8\" : size === \"medium\" ? \"pl-10\" : \"pl-12\";\n\n return (\n <div\n role=\"search\"\n aria-label=\"Search\"\n onClick={onClick}\n className={cls(\"relative transition-all\",\n heightClass,\n \"bg-surface-field border\",\n defaultBorderMixin,\n \"focus-within:ring-1 focus-within:ring-primary/60 focus-within:border-primary focus-within:shadow-[0_0_0_3px_rgba(0,112,244,0.1)]\",\n \"rounded-full overflow-hidden\",\n className)}>\n <div\n className={cls(\"absolute p-0 h-full pointer-events-none flex items-center justify-center top-0\", iconPaddingClass)}>\n {loading ? <CircularProgress size={\"smallest\"}/> : <SearchIcon className={\"text-text-disabled dark:text-text-disabled-dark\"} size={size === \"smallest\" ? 14 : size === \"small\" ? 18 : 20}/>}\n </div>\n <input\n value={searchText ?? \"\"}\n ref={inputRef}\n onClick={onClick}\n placeholder={placeholder}\n aria-label={placeholder}\n readOnly={!onTextSearch}\n onChange={onTextSearch\n ? (event) => {\n setSearchText(event.target.value);\n }\n : undefined}\n autoFocus={autoFocus}\n onFocus={() => setActive(true)}\n onBlur={() => setActive(false)}\n className={cls(\n (disabled || loading) && \"pointer-events-none\",\n \"placeholder-text-disabled dark:placeholder-text-disabled-dark\",\n \"relative flex items-center transition-all bg-transparent outline-none focus:outline-none focus:ring-0 appearance-none border-none focus:border-transparent\",\n inputPaddingClass, \"h-full w-full text-current\",\n size === \"small\" ? \"text-sm\" : \"\",\n expandable ? (active ? \"w-[220px]\" : \"w-[180px]\") : \"\",\n innerClassName\n )}\n />\n {searchText\n ? <IconButton\n className={`${size === \"small\" ? \"mr-0 top-0\" : \"mr-1 top-0\"} absolute right-0 z-10`}\n size={\"small\"}\n aria-label=\"Clear search\"\n onClick={clearText}>\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n : <div style={{ width: 26 }}/>\n }\n </div>\n );\n}\n","\n\"use client\";\nimport { CheckIcon, ChevronDownIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\nimport React, { ChangeEvent, Children, forwardRef, useCallback, useEffect, useMemo, useState } from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport {\n defaultBorderMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedDisabled\n} from \"../styles\";\n\nimport { cls } from \"../util\";\nimport { SelectInputLabel } from \"./common/SelectInputLabel\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type SelectValue = string | number | boolean;\n\nexport type SelectProps<T extends SelectValue = string> = {\n open?: boolean,\n name?: string,\n fullWidth?: boolean,\n id?: string,\n onOpenChange?: (open: boolean) => void,\n value?: T,\n className?: string,\n inputClassName?: string,\n viewportClassName?: string,\n onChange?: React.EventHandler<ChangeEvent<HTMLSelectElement>>,\n onValueChange?: (updatedValue: T) => void,\n placeholder?: React.ReactNode,\n renderValue?: (value: T) => React.ReactNode,\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n label?: React.ReactNode | string,\n disabled?: boolean,\n error?: boolean,\n position?: \"item-aligned\" | \"popper\",\n endAdornment?: React.ReactNode,\n inputRef?: React.Ref<HTMLButtonElement>,\n padding?: boolean,\n invisible?: boolean,\n children?: React.ReactNode;\n dataType?: \"string\" | \"number\" | \"boolean\";\n portalContainer?: HTMLElement | null; // Explicitly added to props type if missing\n /**\n * Accessible name for the trigger, for a select whose `label` is a node\n * rather than a string — or which shows no label at all.\n *\n * Without it such a select announces the literal fallback \"Select an\n * option\", which is indistinguishable from every other unlabelled select\n * on the screen.\n */\n \"aria-label\"?: string;\n};\n\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(({\n inputRef,\n open,\n name,\n fullWidth = false,\n id,\n onOpenChange,\n value,\n onChange,\n onValueChange,\n className,\n inputClassName,\n viewportClassName,\n placeholder,\n renderValue,\n label,\n size = \"large\",\n error,\n disabled,\n padding = true,\n position = \"item-aligned\",\n endAdornment,\n invisible,\n children,\n dataType = \"string\",\n portalContainer: manualContainer, // Rename to avoid confusion\n \"aria-label\": ariaLabel,\n ...props\n}, ref) => {\n\n const [openInternal, setOpenInternal] = useState(open ?? false);\n\n useEffect(() => {\n setOpenInternal(open ?? false);\n }, [open]);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Resolve final container (Manual Prop > Context Container > Undefined/Body)\n const finalContainer = (manualContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n const onValueChangeInternal = useCallback((newValue: string) => {\n let typedValue: SelectValue = newValue;\n if (dataType === \"boolean\") {\n if (newValue === \"true\") typedValue = true;\n else if (newValue === \"false\") typedValue = false;\n } else if (dataType === \"number\") {\n if (!isNaN(Number(newValue)) && newValue.trim() !== \"\") typedValue = Number(newValue);\n }\n\n onValueChange?.(typedValue as SelectValue & typeof value);\n if (onChange) {\n const event = {\n target: {\n name,\n value: typedValue\n }\n } as ChangeEvent<HTMLSelectElement>;\n onChange(event);\n }\n }, [onChange, onValueChange, name, dataType]);\n\n const hasValue = Array.isArray(value) ? value.length > 0 : (value != null && value !== \"\" && value !== undefined);\n const stringValue = value !== undefined ? String(value) : undefined;\n\n const displayChildren = useMemo(() => {\n if (!hasValue || renderValue) return null;\n\n // Find the child that matches the current value to display its content\n let found: React.ReactNode = null;\n Children.forEach(children, (child) => {\n if (React.isValidElement<SelectItemProps>(child) && String(child.props.value) === String(value)) {\n found = child.props.children;\n }\n });\n return found;\n }, [children, hasValue, renderValue, value]);\n\n return (\n <SelectPrimitive.Root\n name={name}\n value={stringValue}\n open={openInternal}\n disabled={disabled}\n onValueChange={onValueChangeInternal}\n onOpenChange={(open) => {\n onOpenChange?.(open);\n setOpenInternal(open);\n }}\n {...props}>\n {typeof label === \"string\" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}\n <div className={cls(\n \"select-none rounded-lg text-sm\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n \"relative flex items-center\",\n className,\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\",\n \"w-fit\": !fullWidth,\n \"w-full\": fullWidth\n }\n )}>\n <SelectPrimitive.Trigger\n ref={inputRef}\n id={id}\n asChild={false}\n type=\"button\"\n // A `label` that is an element — which every entity form\n // passes, because the label carries the property's type\n // icon — fell through to a hard-coded English literal, so\n // every enum field in every form announced itself as\n // \"Select an option\". Callers pass `aria-label` now; the\n // literal stays as the last resort, and is unreachable for\n // anything that names itself.\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : (typeof renderValue === \"string\" ? renderValue : \"Select an option\"))}\n aria-invalid={error || undefined}\n className={cls(\n \"h-full\",\n padding ? {\n \"px-4\": size === \"large\",\n \"px-3\": size === \"medium\",\n \"px-2\": size === \"small\" || size === \"smallest\"\n } : \"\",\n \"outline-hidden focus:outline-hidden\",\n \"outline-none focus:outline-none\",\n \"select-none rounded-lg text-sm\",\n error ? \"text-red-500 dark:text-red-600\" : \"focus:text-text-primary dark:focus:text-text-primary-dark\",\n error ? \"border border-red-500 dark:border-red-600\" : \"\",\n disabled ? \"text-surface-accent-600 dark:text-surface-accent-400\" : \"text-surface-accent-800 dark:text-white\",\n \"relative flex flex-row items-center\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\",\n \"w-full\": fullWidth,\n \"w-fit\": !fullWidth\n },\n inputClassName\n )}\n >\n <div\n ref={ref}\n className={cls(\n \"flex-grow max-w-full flex flex-row gap-2 items-center\",\n \"overflow-visible\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n }\n )}>\n <SelectPrimitive.Value\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n placeholder={placeholder}\n className={\"w-full\"}>\n\n {hasValue && value !== undefined && renderValue\n ? renderValue(value)\n : (displayChildren || placeholder)\n }\n\n </SelectPrimitive.Value>\n </div>\n\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon size={size === \"large\" ? iconSize.medium : iconSize.small}\n className={cls(\"transition\", open ? \"rotate-180\" : \"\", {\n \"px-2\": size === \"large\",\n \"px-1\": size === \"medium\" || size === \"small\"\n })}/>\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n {endAdornment && (\n <div\n className={cls(\"h-full flex items-center absolute right-0 pr-12\")}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}>\n {endAdornment}\n </div>\n )}\n </div>\n\n {/* Pass the calculated finalContainer */}\n <SelectPrimitive.Portal container={finalContainer}>\n <SelectPrimitive.Content position={position}\n className={cls(focusedDisabled, \"z-50 relative overflow-hidden border bg-surface-card p-2 rounded-lg shadow-lg animate-in fade-in-0 zoom-in-95 duration-150\", defaultBorderMixin)}>\n <SelectPrimitive.Viewport className={cls(\"p-1\", viewportClassName)}\n style={{ maxHeight: \"var(--radix-select-content-available-height)\" }}>\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n );\n});\n\nSelect.displayName = \"Select\";\n\n// ... (SelectItem and SelectGroup remain unchanged)\nexport type SelectItemProps<T extends SelectValue = string> = {\n value: T,\n children?: React.ReactNode,\n disabled?: boolean,\n className?: string,\n};\n\nexport const SelectItem = React.memo(function SelectItem<T extends SelectValue = string>({\n value,\n children,\n disabled,\n className\n}: SelectItemProps<T>) {\n // Convert value to string for Radix UI\n const stringValue = String(value);\n\n return <SelectPrimitive.Item\n key={stringValue}\n value={stringValue}\n disabled={disabled}\n className={cls(\n \"w-full\",\n \"relative flex items-center p-2 rounded-md text-sm text-surface-accent-700 dark:text-surface-accent-300\",\n \"focus:z-10\",\n \"data-[state=checked]:bg-surface-active focus:bg-surface-hover\",\n \"data-[state=checked]:focus:bg-surface-active\",\n disabled ? \"opacity-50 cursor-not-allowed\" : \"cursor-pointer\",\n \"[&>*]:w-full\",\n \"overflow-visible\",\n className\n )}>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <div\n className=\"absolute left-1 data-[state=checked]:block hidden\">\n <CheckIcon size={iconSize.smallest}/>\n </div>\n </SelectPrimitive.Item>;\n});\n\nexport type SelectGroupProps = {\n label: React.ReactNode,\n children: React.ReactNode,\n className?: string\n};\n\nexport const SelectGroup = React.memo(function SelectGroup({\n label,\n children,\n className\n}: SelectGroupProps) {\n return <>\n <SelectPrimitive.Group\n className={cls(\n \"text-xs text-surface-accent-900 dark:text-white uppercase tracking-wider font-semibold mt-6 first:mt-2\",\n \"px-2 py-2\",\n className\n )}>\n {label}\n </SelectPrimitive.Group>\n\n {children}\n </>;\n});\n","\"use client\";\nimport * as React from \"react\";\nimport { cls } from \"../util\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nexport interface SliderProps {\n className?: string;\n name?: string;\n disabled?: boolean;\n orientation?: React.AriaAttributes[\"aria-orientation\"];\n dir?: \"ltr\" | \"rtl\";\n min?: number;\n max?: number;\n step?: number;\n minStepsBetweenThumbs?: number;\n value?: number[];\n defaultValue?: number[];\n onValueChange?: (value: number[]) => void;\n onValueCommit?: (value: number[]) => void;\n inverted?: boolean;\n form?: string;\n size?: \"small\" | \"regular\";\n}\n\nfunction SliderThumb(props: {\n props: Omit<React.PropsWithoutRef<SliderProps>, \"size\" | \"className\">,\n index: number,\n hovered: boolean,\n classes: string\n}) {\n return <TooltipPrimitive.Root open={props.hovered}>\n <TooltipPrimitive.Trigger asChild>\n <SliderPrimitive.Thumb\n className={cls({\n \"border-primary bg-primary outline-none\": !props.props.disabled,\n \"border-surface-raised-hover bg-surface-raised-hover\": props.props.disabled\n },\n props.classes,\n \"focus-visible:ring-4 focus-visible:ring-primary focus-visible:ring-opacity-50 focus-visible:ring-primary/50\",\n \"hover:ring-4 hover:ring-primary hover:ring-opacity-25 hover:ring-primary/25\",\n \"block rounded-full transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50\")}\n\n />\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Content side=\"top\"\n sideOffset={5}\n className={cls(\n \"TooltipContent\",\n \"max-w-lg leading-relaxed\",\n \"z-50 rounded-md px-3 py-2 text-xs leading-none bg-surface-800/95 dark:bg-surface-raised-hover font-medium text-white shadow-2xl select-none duration-400 ease-in transform opacity-100\"\n )}>\n {props.props.value?.[props.index]}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Root>;\n}\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({\n className,\n size = \"regular\",\n ...props\n }, ref) => {\n const [hovered, setHovered] = React.useState(false);\n\n const thumbSizeClasses =\n size === \"small\"\n ? \"h-4 w-4\" // Smaller size for the thumb\n : \"h-6 w-6\"; // Default size\n\n return (\n <TooltipPrimitive.Provider delayDuration={200}>\n <SliderPrimitive.Root\n ref={ref}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n className={cls(\n \"relative flex w-full touch-none select-none items-center\",\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track\n style={{ height: size === \"small\" ? 4 : 8 }}\n className={\"relative w-full grow overflow-hidden rounded-full bg-surface-active\"}>\n\n <SliderPrimitive.Range\n className={cls(\"absolute h-full\", {\n \"bg-primary\": !props.disabled,\n \"bg-surface-raised-hover\": props.disabled\n })}\n />\n </SliderPrimitive.Track>\n\n {(props.value ?? [0]).map((_, index) => <SliderThumb\n key={index}\n index={index}\n props={props}\n hovered={hovered}\n classes={thumbSizeClasses}/>)}\n </SliderPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n});\n\nSlider.displayName = \"Slider\";\n\nexport { Slider };\n","\"use client\";\nimport React, { useEffect, useState } from \"react\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { usePortalContainer, PortalContainerProvider } from \"../hooks/PortalContainerContext\";\n\ninterface SheetProps {\n children: React.ReactNode;\n open: boolean;\n title?: string;\n modal?: boolean;\n includeBackgroundOverlay?: boolean;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n darkBackground?: boolean;\n transparent?: boolean;\n onOpenChange?: (open: boolean) => void;\n onPointerDownOutside?: (e: Event) => void;\n onInteractOutside?: (e: Event) => void;\n className?: string;\n style?: React.CSSProperties;\n overlayClassName?: string;\n overlayZIndex?: string;\n overlayStyle?: React.CSSProperties;\n portalContainer?: HTMLElement | null;\n}\n\nexport const Sheet: React.FC<SheetProps> = ({\n children,\n side = \"right\",\n title,\n modal = true,\n includeBackgroundOverlay = true,\n open,\n onOpenChange,\n onPointerDownOutside,\n onInteractOutside,\n transparent,\n className,\n style,\n overlayClassName,\n overlayZIndex = \"z-50\",\n overlayStyle,\n portalContainer,\n ...props\n}) => {\n const [displayed, setDisplayed] = useState(false);\n const [contentEl, setContentEl] = useState<HTMLDivElement | null>(null);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n setDisplayed(open);\n });\n return () => cancelAnimationFrame(raf);\n }, [open]);\n\n const transformValue: Record<string, string> = {\n top: \"-translate-y-full\",\n bottom: \"translate-y-full\",\n left: \"-translate-x-full\",\n right: \"translate-x-full\"\n };\n\n const borderClass: Record<string, string> = {\n top: \"border-b\",\n bottom: \"border-t\",\n left: \"border-r\",\n right: \"border-l\"\n };\n\n return (\n <DialogPrimitive.Root open={displayed || open}\n modal={modal}\n onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal container={finalContainer}>\n {includeBackgroundOverlay && <DialogPrimitive.Overlay\n className={cls(\n \"outline-none\",\n \"fixed inset-0 bg-surface-scrim\",\n \"backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in\",\n overlayZIndex,\n overlayClassName\n )}\n style={overlayStyle}\n />}\n <DialogPrimitive.Content\n {...props}\n ref={setContentEl}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onPointerDownOutside={onPointerDownOutside}\n onInteractOutside={onInteractOutside}\n className={cls(\n \"outline-none\",\n borderClass[side],\n defaultBorderMixin,\n // No `will-change: transform` / `transform-gpu` here, however\n // tempting the layer hint is on a panel this size. Either one\n // makes this element a *containing block* for its\n // `position: fixed` descendants, and everything portaled into\n // the panel below — a Select dropdown, above all — is fixed and\n // positioned in viewport coordinates. Inside a containing block\n // those coordinates are resolved against the panel instead, so\n // every popup was displaced by the panel's own offset and a\n // right-hand Select opened its list off the edge of the screen:\n // the dropdown was open, just nowhere anyone could see it.\n \"text-surface-accent-900 dark:text-white\",\n \"fixed transform z-50 transition-[transform,opacity] ease-in-out\",\n !displayed ? \"duration-150\" : \"duration-100\",\n \"outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus:ring-0\",\n transparent ? \"\" : \"shadow-md bg-surface-card\",\n side === \"top\" || side === \"bottom\" ? \"w-full\" : \"h-full\",\n side === \"left\" || side === \"top\" ? \"left-0 top-0\" : \"right-0 bottom-0\",\n displayed && open ? \"opacity-100\" : \"opacity-50\",\n !displayed || !open ? transformValue[side] : \"\",\n className\n )}\n style={style}\n >\n <DialogPrimitive.Title className=\"sr-only outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus:ring-0\">\n {title ?? \"Sheet\"}\n </DialogPrimitive.Title>\n <PortalContainerProvider container={contentEl}>\n {children}\n </PortalContainerProvider>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n};\n","\"use client\";\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { cls, debounce } from \"../util\";\n\ntype State = {\n outerHeightStyle: number;\n overflow?: boolean | undefined;\n};\n\nfunction getStyleValue(value: string) {\n return parseInt(value, 10) || 0;\n}\n\nconst styles: {\n shadow: React.CSSProperties;\n} = {\n shadow: {\n // Visibility needed to hide the extra text area on iPads\n visibility: \"hidden\",\n // Remove from the content flow\n position: \"absolute\",\n // Ignore the scrollbar width\n overflow: \"hidden\",\n height: 0,\n top: 0,\n left: 0,\n // Create a new layer, increase the isolation of the computed values\n transform: \"translateZ(0)\"\n }\n};\n\nfunction isEmpty(obj: State) {\n return (\n obj === undefined ||\n obj === null ||\n Object.keys(obj).length === 0 ||\n (obj.outerHeightStyle === 0 && !obj.overflow)\n );\n}\n\nexport const TextareaAutosize = React.forwardRef(function TextareaAutosize(\n props: TextareaAutosizeProps,\n ref: React.ForwardedRef<Element>\n) {\n const {\n onChange,\n onScroll,\n onResize,\n maxRows,\n minRows = 1,\n style,\n value,\n onFocus,\n onBlur,\n sizeRef,\n ignoreBoxSizing,\n ...other\n } = props;\n\n const { current: isControlled } = React.useRef(value != null);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, inputRef);\n const shadowRef = React.useRef<HTMLTextAreaElement>(null);\n const renders = React.useRef(0);\n const [state, setState] = React.useState<State>({\n outerHeightStyle: 0\n });\n\n const getUpdatedState = React.useCallback(() => {\n\n const input = inputRef.current!;\n if (typeof window === \"undefined\") {\n return {\n outerHeightStyle: 0\n };\n }\n\n const containerWindow = window;\n const computedStyle = containerWindow.getComputedStyle(input);\n\n // If input's width is shrunk and it's not visible, don't sync height.\n if (computedStyle.width === \"0px\") {\n return {\n outerHeightStyle: 0\n };\n }\n\n const sizeReferenceElement = sizeRef?.current ?? shadowRef.current!;\n const inputShallow = shadowRef.current!;\n\n sizeReferenceElement.style.width = computedStyle.width;\n inputShallow.value = input.value || props.placeholder || \"x\";\n if (inputShallow.value.slice(-1) === \"\\n\") {\n // Certain fonts which overflow the line height will cause the textarea\n // to report a different scrollHeight depending on whether the last line\n // is empty. Make it non-empty to avoid this issue.\n inputShallow.value += \" \";\n }\n\n const boxSizing = computedStyle.boxSizing;\n const padding =\n getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);\n const border =\n getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);\n const minHeight = getStyleValue(computedStyle.minHeight);\n\n // The height of the inner content\n const innerHeight = sizeReferenceElement.scrollHeight;\n\n // Measure height of a textarea with a single row\n inputShallow.value = \"x\";\n const singleRowHeight = sizeReferenceElement.scrollHeight;\n\n // The height of the outer content\n let outerHeight = innerHeight;\n\n if (minRows) {\n outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);\n }\n if (maxRows) {\n outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);\n }\n outerHeight = Math.max(outerHeight, singleRowHeight, minHeight);\n\n // Take the box sizing into account for applying this value as a style.\n const outerHeightStyle = outerHeight + (!ignoreBoxSizing && boxSizing === \"border-box\" ? padding + border : 0);\n\n const overflow = Math.abs(outerHeight - innerHeight) <= 1;\n\n return {\n outerHeightStyle,\n overflow\n };\n }, [maxRows, minRows, props.placeholder]);\n\n const updateState = React.useCallback((prevState: State, newState: State) => {\n const {\n outerHeightStyle,\n overflow\n } = newState;\n // Need a large enough difference to update the height.\n // This prevents infinite rendering loop.\n if (\n renders.current < 20 &&\n ((outerHeightStyle > 0 &&\n Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1) ||\n prevState.overflow !== overflow)\n ) {\n renders.current += 1;\n return {\n overflow,\n outerHeightStyle\n };\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (renders.current === 20) {\n console.error(\n [\n \"MUI: Too many re-renders. The layout is unstable.\",\n \"TextareaAutosize limits the number of renders to prevent an infinite loop.\"\n ].join(\"\\n\")\n );\n }\n }\n return prevState;\n }, []);\n\n const syncHeight = React.useCallback(() => {\n const newState = getUpdatedState();\n\n if (isEmpty(newState)) {\n return;\n }\n if (onResize) {\n onResize(newState);\n }\n\n setState((prevState) => {\n return updateState(prevState, newState);\n });\n }, [getUpdatedState, onResize, updateState]);\n\n const syncHeightWithFlushSync = React.useCallback(() => {\n const newState = getUpdatedState();\n\n if (isEmpty(newState)) {\n return;\n }\n\n // In React 18, state updates in a ResizeObserver's callback are happening after the paint which causes flickering\n // when doing some visual updates in it. Using flushSync ensures that the dom will be painted after the states updates happen\n // Related issue - https://github.com/facebook/react/issues/24331\n ReactDOM.flushSync(() => {\n setState((prevState) => {\n return updateState(prevState, newState);\n });\n });\n }, [getUpdatedState, updateState]);\n\n React.useEffect(() => {\n const handleResize = debounce(() => {\n renders.current = 0;\n\n // If the TextareaAutosize component is replaced by Suspense with a fallback, the last\n // ResizeObserver's handler that runs because of the change in the layout is trying to\n // access a dom node that is no longer there (as the fallback component is being shown instead).\n if (inputRef.current) {\n syncHeightWithFlushSync();\n }\n });\n let resizeObserver: ResizeObserver;\n\n const input = inputRef.current!;\n const containerWindow = window;\n if (typeof window === \"undefined\") {\n return;\n }\n\n containerWindow.addEventListener(\"resize\", handleResize);\n\n if (typeof ResizeObserver !== \"undefined\") {\n resizeObserver = new ResizeObserver(handleResize);\n resizeObserver.observe(input);\n }\n\n return () => {\n handleResize.clear();\n containerWindow.removeEventListener(\"resize\", handleResize);\n if (resizeObserver) {\n resizeObserver.disconnect();\n }\n };\n }, [syncHeightWithFlushSync]);\n\n useLayoutEffect(() => {\n syncHeight();\n });\n\n React.useEffect(() => {\n renders.current = 0;\n }, [value]);\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n renders.current = 0;\n\n if (!isControlled) {\n syncHeight();\n }\n\n if (onChange) {\n onChange(event);\n }\n };\n\n return (\n <React.Fragment>\n <textarea\n value={value}\n onChange={handleChange}\n className={props.className}\n ref={handleRef as React.Ref<HTMLTextAreaElement>}\n onFocus={onFocus}\n onBlur={onBlur}\n // Apply the rows prop to get a \"correct\" first SSR paint\n rows={minRows as number}\n style={{\n height: state.outerHeightStyle,\n // Need a large enough difference to allow scrolling.\n // This prevents infinite rendering loop.\n overflow: state.overflow ? \"hidden\" : undefined,\n ...style\n }}\n onScroll={onScroll}\n {...other}\n />\n <textarea\n aria-hidden\n className={cls(props.className, props.shadowClassName)}\n readOnly\n ref={shadowRef}\n tabIndex={-1}\n style={{\n padding: 0,\n ...styles.shadow,\n ...style\n }}\n />\n </React.Fragment>\n );\n}) as React.FC<TextareaAutosizeProps & { ref?: React.ForwardedRef<Element> }>;\n\nexport type TextareaAutosizeProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, \"onResize\"> & {\n\n className?: string;\n\n shadowClassName?: string;\n\n /**\n * Maximum number of rows to display.\n */\n maxRows?: number | string;\n /**\n * Minimum number of rows to display.\n * @default 1\n */\n minRows?: number | string;\n /**\n * @ignore\n */\n onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * @ignore\n */\n placeholder?: string;\n /**\n * @ignore\n */\n style?: object;\n /**\n * @ignore\n */\n value?: string[] | number | string;\n\n sizeRef?: React.RefObject<HTMLDivElement>;\n\n onScroll?: (event: React.UIEvent<HTMLTextAreaElement>) => void;\n\n onResize?: (state: State) => void;\n\n autoFocus?: boolean;\n\n ignoreBoxSizing?: boolean;\n}\n\nfunction useForkRef<Instance>(\n ...refs: Array<React.Ref<Instance> | undefined>\n): React.RefCallback<Instance> | null {\n /**\n * This will create a new function if the refs passed to this hook change and are all defined.\n * This means react will call the old forkRef with `null` and the new forkRef\n * with the ref. Cleanup naturally emerges from this behavior.\n */\n return React.useMemo(() => {\n if (refs.every((ref) => ref == null)) {\n return null;\n }\n\n return (instance) => {\n refs.forEach((ref) => {\n setRef(ref, instance);\n });\n };\n\n }, refs);\n}\n\nfunction setRef<T>(\n ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined,\n value: T | null\n): void {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\n","\"use client\";\nimport React, { ForwardedRef, forwardRef, useEffect, useId, useRef } from \"react\";\n\nimport {\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedInvisibleMixin\n} from \"../styles\";\nimport { InputLabel } from \"./InputLabel\";\nimport { cls } from \"../util\";\n\nexport type InputType =\n | \"text\"\n | \"number\"\n | \"phone\"\n | \"email\"\n | \"password\"\n | \"search\"\n | \"url\"\n | \"date\"\n | \"time\"\n | \"datetime-local\"\n | \"month\"\n | \"week\"\n | \"color\";\n\nexport type TextFieldProps<T extends string | number> = {\n type?: InputType;\n value?: T;\n onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;\n label?: React.ReactNode;\n multiline?: boolean;\n disabled?: boolean;\n invisible?: boolean;\n error?: boolean;\n endAdornment?: React.ReactNode;\n autoFocus?: boolean;\n placeholder?: string;\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\";\n className?: string;\n style?: React.CSSProperties;\n inputClassName?: string;\n inputStyle?: React.CSSProperties;\n inputRef?: React.ForwardedRef<any>;\n /**\n * Maximum number of rows to display.\n */\n maxRows?: number | string;\n /**\n * Minimum number of rows to display.\n * @default 1\n */\n minRows?: number | string;\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"value\">;\n\nexport const TextField = forwardRef<HTMLDivElement, TextFieldProps<string | number>>(\n <T extends string | number>(\n {\n value,\n onChange,\n label,\n type = \"text\",\n multiline = false,\n invisible,\n maxRows,\n minRows,\n disabled,\n error,\n endAdornment,\n autoFocus,\n placeholder,\n size = \"large\",\n className,\n style,\n inputClassName,\n inputStyle,\n inputRef: inputRefProp,\n ...inputProps\n }: TextFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n\n const fallbackRef = useRef(null);\n const inputRef = inputRefProp ?? fallbackRef;\n const autoId = useId();\n const inputId = inputProps.id ?? autoId;\n const labelId = `${inputId}-label`;\n\n const [focused, setFocused] = React.useState(false);\n const hasValue = value !== undefined && value !== null && value !== \"\";\n\n useEffect(() => {\n const element = inputRef && \"current\" in inputRef ? inputRef.current : null;\n if (element && document.activeElement === element) {\n setFocused(true);\n }\n }, []);\n\n useEffect(() => {\n if (type !== \"number\") return;\n const handleWheel = (event: any) => {\n if (event.target instanceof HTMLElement) event.target.blur();\n };\n\n const element = \"current\" in inputRef ? inputRef.current : inputRef;\n\n element?.addEventListener(\"wheel\", handleWheel);\n\n return () => {\n element?.removeEventListener(\"wheel\", handleWheel);\n };\n }, [inputRef, type]);\n\n const input = multiline ? (\n <textarea\n {...(inputProps as React.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n ref={inputRef}\n id={inputId}\n // Falls back to the caller's own value rather than to `undefined`:\n // this sits after the spread, so hardcoding `undefined` silently\n // erased an `aria-labelledby` a consumer had passed, and the\n // unlabelled field it was meant to name stayed unnamed.\n aria-labelledby={label ? labelId : inputProps[\"aria-labelledby\"]}\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n placeholder={focused || hasValue || !label ? placeholder : undefined}\n autoFocus={autoFocus}\n rows={typeof minRows === \"string\" ? parseInt(minRows) : (minRows ?? 3)}\n value={value ?? \"\"}\n onChange={onChange}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n style={inputStyle}\n className={cls(\n invisible ? focusedInvisibleMixin : \"\",\n \"rounded-lg resize-none w-full outline-none text-sm bg-transparent min-h-[64px] px-3\",\n label ? \"pt-8 pb-2\" : \"py-2\",\n disabled && \"outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500\",\n inputClassName\n )}\n />\n ) : (\n <input\n {...inputProps}\n ref={inputRef}\n id={inputId}\n // See the textarea branch: preserve a caller-supplied\n // `aria-labelledby` instead of overwriting it with `undefined`.\n aria-labelledby={label ? labelId : inputProps[\"aria-labelledby\"]}\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n style={inputStyle}\n className={cls(\n \"w-full outline-none bg-transparent leading-normal px-3 text-sm\",\n \"rounded-lg\",\n \"focused:text-text-primary focused:dark:text-text-primary-dark\",\n invisible ? focusedInvisibleMixin : \"\",\n // No fill, hover or disabled tint on the input itself: the\n // wrapper carries all three. Both used to carry the hover\n // fill, so a hovered field painted the alpha twice — once on\n // the box and once on the input a pixel inside its border,\n // at the same radius — and read as a box inside a box.\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n /* A shrunk label occupies roughly the first 16px of the\n box (`top-[-1px]`, translated down 2px, ~15px tall at\n scale-75). `pt-4` put the value's first line at exactly\n 16px, so label and content shared a row: a labelled\n `small` field with a placeholder rendered \"Name\" on top\n of \"e.g. Analytics Pipeline\". `large` was never affected\n — it reserves `pt-8`. */\n label\n // Labelled fields sit exactly 16px above the unlabelled\n // scale (44/48/56/64 against 28/32/40/48). smallest,\n // small and medium all used to share `pt-5 pb-1.5`, so\n // they rendered at an identical 50px and `size` looked\n // inert whenever a label was present.\n ? { smallest: \"pt-4 pb-1\", small: \"pt-5 pb-1\", medium: \"pt-6 pb-2\", large: \"pt-8 pb-2\" }[size]\n : size === \"smallest\"\n ? \"py-0.5\"\n : size === \"small\"\n ? \"py-1\"\n : \"py-2\",\n endAdornment ? \"pr-12\" : \"pr-3\",\n disabled &&\n \"outline-none opacity-65 dark:opacity-60 text-surface-accent-800 dark:text-white\",\n inputClassName\n )}\n placeholder={focused || hasValue || !label ? placeholder : undefined}\n autoFocus={autoFocus}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n type={type}\n value={type === \"number\" && Number.isNaN(value) ? \"\" : value ?? \"\"}\n onChange={onChange}\n />\n );\n\n return (\n <div\n ref={ref}\n className={cls(\n \"rounded-lg relative max-w-full\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n // An invisible field has no hover fill of its own: whatever frames it (a table cell) carries the hover.\n disabled ? fieldBackgroundDisabledMixin : (invisible ? \"\" : fieldBackgroundHoverMixin),\n error ? \"border border-red-500 dark:border-red-600\" : \"\",\n {\n \"min-h-[28px]\": size === \"smallest\",\n \"min-h-[32px]\": size === \"small\",\n \"min-h-[40px]\": size === \"medium\",\n \"min-h-[48px]\": size === \"large\"\n },\n className\n )}\n style={style}\n >\n {label && (\n <InputLabel\n id={labelId}\n htmlFor={inputId}\n className={cls(\n \"pointer-events-none absolute\",\n size === \"large\" ? \"top-1\" : \"top-[-1px]\",\n !error\n ? focused\n ? \"text-primary dark:text-primary\"\n : \"text-text-secondary dark:text-text-secondary-dark\"\n : \"text-red-500 dark:text-red-600\",\n // A disabled field's LABEL is the one part that must\n // stay readable — it is what tells you which field\n // you cannot edit. `opacity-50` halved the alpha of\n // an already-muted #737373, landing near 2.2:1 over\n // the field fill; the label was effectively gone.\n //\n // The value below it keeps its own `opacity-50`,\n // which is the correct signal: the CONTENT is\n // inactive. Naming the field is not content.\n disabled ? \"text-text-disabled dark:text-text-disabled-dark\" : \"\"\n )}\n shrink={hasValue || focused}\n >\n {label}\n </InputLabel>\n )}\n\n {input}\n\n {endAdornment && (\n <div\n className={cls(\n \"flex flex-row justify-center items-center absolute h-full right-0 top-0\",\n {\n \"mr-4\": size === \"large\",\n \"mr-3\": size === \"medium\",\n \"mr-2\": size === \"small\" || size === \"smallest\"\n }\n )}\n >\n {endAdornment}\n </div>\n )}\n </div>\n );\n }\n);\n\nTextField.displayName = \"TextField\";\n","\nimport React, { createContext, useContext, useRef, useState, useEffect, useMemo } from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport { cls } from \"../util\";\nimport { defaultBorderMixin } from \"../styles\";\n\nexport type TabVariant = \"standard\" | \"boxy\" | \"pill\";\n\nconst TabsContext = createContext<{ variant: TabVariant }>({ variant: \"standard\" });\nimport { IconButton } from \"./IconButton\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport { iconSize } from \"../icons/Icon\";\n\nexport type TabsProps = {\n value: string,\n children: React.ReactNode,\n innerClassName?: string,\n className?: string,\n variant?: TabVariant,\n onValueChange: (value: string) => void\n};\n\nexport function Tabs({\n value,\n onValueChange,\n className,\n innerClassName,\n variant = \"standard\",\n children\n}: TabsProps) {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const [showLeftScroll, setShowLeftScroll] = useState(false);\n const [showRightScroll, setShowRightScroll] = useState(false);\n const [isScrollable, setIsScrollable] = useState(false);\n\n const checkScroll = () => {\n if (scrollContainerRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current;\n setShowLeftScroll(scrollLeft > 0);\n setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);\n setIsScrollable(scrollWidth > clientWidth);\n }\n };\n\n useEffect(() => {\n checkScroll();\n window.addEventListener(\"resize\", checkScroll);\n\n let observer: ResizeObserver;\n if (scrollContainerRef.current) {\n observer = new ResizeObserver(checkScroll);\n observer.observe(scrollContainerRef.current);\n if (scrollContainerRef.current.firstElementChild) {\n observer.observe(scrollContainerRef.current.firstElementChild);\n }\n }\n\n return () => {\n window.removeEventListener(\"resize\", checkScroll);\n observer?.disconnect();\n };\n }, [children]);\n\n const scroll = (direction: \"left\" | \"right\") => {\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current;\n const scrollAmount = Math.max(container.clientWidth / 2, 200);\n const targetScroll = container.scrollLeft + (direction === \"left\" ? -scrollAmount : scrollAmount);\n\n container.scrollTo({\n left: targetScroll,\n behavior: \"smooth\"\n });\n // checkScroll will be called by onScroll event\n }\n };\n\n const contextValue = useMemo(() => ({ variant }), [variant]);\n\n return <TabsContext.Provider value={contextValue}>\n <TabsPrimitive.Root\n value={value}\n onValueChange={onValueChange}\n className={cls(\"relative flex flex-row items-center min-w-0 w-full\", className)}\n >\n {isScrollable && (\n <button\n type=\"button\"\n disabled={!showLeftScroll}\n aria-label=\"Scroll tabs left\"\n onClick={() => scroll(\"left\")}\n className={cls(\n \"absolute left-0 top-1/2 -translate-y-1/2 z-10 flex items-center justify-center rounded-md transition-all h-8 w-6\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400\",\n !showLeftScroll ? \"pointer-events-none opacity-0\" : \"text-surface-600 dark:text-surface-400 hover:bg-surface-hover\",\n \"bg-surface-card border shadow-sm\", defaultBorderMixin\n )}\n >\n <ChevronLeftIcon size={iconSize.smallest}/>\n </button>\n )}\n <div\n ref={scrollContainerRef}\n className=\"flex-1 overflow-x-auto no-scrollbar min-w-0\"\n onScroll={checkScroll}\n style={{ scrollbarWidth: \"none\",\nmsOverflowStyle: \"none\" }}\n >\n <TabsPrimitive.List className={cls(\n // A segmented track is a region, not an object: an inset fill and no border.\n variant === \"standard\" && \"inline-flex h-9 items-center justify-start rounded-md bg-surface-field p-1 text-surface-600 dark:text-surface-400 gap-2\",\n // Folder tabs sit on the strip's bottom edge, so the list aligns\n // them to the end; the active tab overlaps that edge by 1px.\n variant === \"boxy\" && \"flex items-end h-full\",\n variant === \"pill\" && \"flex items-center gap-0.5\",\n innerClassName)\n }>\n {children}\n </TabsPrimitive.List>\n </div>\n {isScrollable && (\n <button\n type=\"button\"\n disabled={!showRightScroll}\n aria-label=\"Scroll tabs right\"\n onClick={() => scroll(\"right\")}\n className={cls(\n \"absolute right-0 top-1/2 -translate-y-1/2 z-10 flex items-center justify-center rounded-md transition-all h-8 w-6\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400\",\n !showRightScroll ? \"pointer-events-none opacity-0\" : \"text-surface-600 dark:text-surface-400 hover:bg-surface-hover\",\n \"bg-surface-card border shadow-sm\", defaultBorderMixin\n )}\n >\n <ChevronRightIcon size={iconSize.smallest}/>\n </button>\n )}\n </TabsPrimitive.Root>\n </TabsContext.Provider>;\n}\n\nexport type TabProps = {\n value: string,\n className?: string,\n innerClassName?: string,\n children: React.ReactNode,\n disabled?: boolean\n};\n\nexport function Tab({\n value,\n className,\n innerClassName,\n children,\n disabled\n}: TabProps) {\n const { variant } = useContext(TabsContext);\n\n return (\n <TabsPrimitive.Trigger\n value={value}\n disabled={disabled}\n className={cls(\n \"inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all\",\n // Colour only. The width and the inset come from the global rule:\n // the tab list scrolls horizontally, so a ring 2px out — with a\n // further 2px of offset — was clipped by the scrollport on the\n // first and last tab. `ring-offset-white` went with it; with an\n // inset ring there is no offset for it to colour.\n \"focus-visible:outline-none focus-visible:ring-surface-400\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n variant === \"standard\" && \"rounded-md px-3 py-1 data-[state=active]:bg-surface-lifted data-[state=active]:text-surface-900 data-[state=active]:shadow-sm dark:data-[state=active]:text-surface-50\",\n // A folder tab. The active one is cut from the same surface as the\n // panel it opens and sits over the strip's hairline (`-mb-px`), so\n // it reads as CONNECTED to what it shows rather than underlined,\n // and the primary is not spent on it. The vertical dividers and\n // the blue underline this variant used to draw were the boxiest\n // thing on the record view; the reference separates tabs with\n // nothing but their own rounded tops.\n variant === \"boxy\" && cls(\n \"flex-shrink-0 flex items-center gap-1.5 px-3.5 h-9 cursor-pointer text-xs font-medium transition-colors group relative box-border\",\n \"rounded-t-lg -mb-px border border-transparent border-b-0\",\n \"data-[state=active]:bg-surface-card data-[state=active]:border-hairline\",\n \"data-[state=active]:text-text-primary dark:data-[state=active]:text-text-primary-dark\",\n \"text-text-secondary dark:text-text-secondary-dark hover:bg-surface-hover\"\n ),\n variant === \"pill\" && cls(\n \"px-2 py-0.5 rounded-md text-[10px] font-medium transition-colors\",\n \"data-[state=active]:bg-primary/10 data-[state=active]:text-primary dark:data-[state=active]:bg-primary/20 dark:data-[state=active]:text-primary\",\n \"text-text-disabled dark:text-text-disabled-dark hover:text-text-secondary dark:hover:text-text-secondary-dark\"\n ),\n className,\n variant === \"standard\" && innerClassName\n )}\n >\n {children}\n </TabsPrimitive.Trigger>\n );\n}\n","\n\"use client\";\n\nimport { TagIcon } from \"lucide-react\";\nimport React, { useRef } from \"react\";\nimport { defaultBorderMixin } from \"../styles\";\nimport { cls } from \"../util\";\n\nexport type TableProps = {\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & React.TableHTMLAttributes<HTMLTableElement>;\n\nexport const Table = React.memo(({\n children,\n className,\n style,\n ...rest\n }: TableProps) => (\n <table\n className={cls(\"text-left text-text-primary dark:text-text-primary-dark rounded-lg overflow-x-auto\", className)}\n style={style}\n {...rest}\n >\n {children}\n </table>\n));\n\nexport type TableBodyProps = {\n children?: React.ReactNode;\n className?: string;\n} & React.HTMLAttributes<HTMLTableSectionElement>;\n\nexport const TableBody = React.memo(({\n children,\n className,\n ...rest\n }: TableBodyProps) => (\n <tbody\n className={cls(\"bg-surface-card text-sm divide-y divide-hairline\", className)}\n {...rest}\n >\n {children}\n </tbody>\n));\n\nexport type TableHeaderProps = {\n children?: React.ReactNode;\n className?: string;\n} & React.HTMLAttributes<HTMLTableSectionElement>;\n\nexport const TableHeader = React.memo(({\n children,\n className,\n ...rest\n }: TableHeaderProps) => (\n <thead {...rest}>\n <tr\n className={cls(\n defaultBorderMixin,\n \"text-sm font-medium text-surface-700 dark:text-surface-accent-300\",\n \"bg-surface-sheet border-b\",\n className\n )}\n >\n {children}\n </tr>\n </thead>\n));\n\nexport type TableRowProps = {\n children?: React.ReactNode;\n className?: string;\n onClick?: React.MouseEventHandler<any>;\n style?: React.CSSProperties;\n} & React.HTMLAttributes<HTMLTableRowElement>;\n\nexport const TableRow = React.memo(({\n children,\n className,\n onClick,\n style,\n ...rest\n }: TableRowProps) => (\n <tr\n onClick={onClick}\n style={style}\n className={cls(\n \"bg-surface-card\",\n onClick ? \"transition-colors duration-150 hover:bg-surface-card-hover cursor-pointer\" : \"\",\n className\n )}\n {...rest}\n >\n {children}\n </tr>\n));\n\nexport type TableCellProps = {\n children?: React.ReactNode;\n header?: boolean;\n scope?: string;\n className?: string;\n style?: React.CSSProperties;\n align?: \"left\" | \"center\" | \"right\";\n colspan?: number;\n} & React.HTMLAttributes<HTMLTableCellElement>;\n\nexport const TableCell = React.memo(({\n children,\n header = false,\n scope = \"\",\n align,\n className,\n style,\n colspan,\n ...rest\n }: TableCellProps) => {\n const ref = useRef<HTMLTableCellElement>(null);\n const TagIcon = header || getParentName(ref.current) === \"TableHeader\" ? \"th\" : \"td\";\n return (\n <TagIcon\n scope={scope}\n colSpan={colspan}\n ref={ref}\n style={style}\n className={cls(\n \"px-4 py-3 text-clip \",\n align === \"center\" ? \"text-center\" : (align === \"right\" ? \"text-right\" : \"text-left\"),\n className\n )}\n {...rest}\n >\n {children}\n </TagIcon>\n );\n});\n\ninterface ReactFiber {\n return: ReactFiber;\n type: string | Function;\n elementType?: {\n name?: string;\n };\n}\n\n// This is highly experimental and might break in the future\nfunction getParentName(element: HTMLElement | null): string | undefined {\n if (element) {\n const key = Object.keys(element).find((key) => {\n return (\n key.startsWith(\"__reactFiber$\") ||\n key.startsWith(\"__reactInternalInstance$\")\n );\n });\n if (key) {\n // React's internal fibre, reached by the `__reactFiber$<hash>` key\n // found on the element above. It is not part of any public API and\n // no type describes it, so this cannot be checked by anything —\n // which is the standing cost of reading it, and the reason the read\n // is confined to this one function.\n const domFiber = (element as unknown as Record<string, ReactFiber>)[key];\n const getComponentFiber = (fiber: ReactFiber): ReactFiber => {\n let parentFiber = fiber.return;\n while (parentFiber && typeof parentFiber.type === \"string\") {\n parentFiber = parentFiber.return;\n }\n return parentFiber;\n };\n let fiber = getComponentFiber(domFiber);\n fiber = getComponentFiber(fiber);\n return fiber?.elementType?.name;\n }\n }\n return undefined;\n}\n\nTable.displayName = \"Table\";\nTableBody.displayName = \"TableBody\";\nTableHeader.displayName = \"TableHeader\";\nTableRow.displayName = \"TableRow\";\nTableCell.displayName = \"TableCell\";\n","\"use client\";\nimport React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\n\nimport { paperMixin } from \"../styles\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\nimport { usePortalContainer } from \"../hooks/PortalContainerContext\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n trigger: React.ReactNode;\n children: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n side?: PopoverSide;\n sideOffset?: number;\n align?: PopoverAlign;\n alignOffset?: number;\n arrowPadding?: number;\n sticky?: \"partial\" | \"always\";\n hideWhenDetached?: boolean;\n avoidCollisions?: boolean;\n enabled?: boolean;\n modal?: boolean;\n className?: string;\n portalContainer?: HTMLElement | null;\n onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;\n onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;\n}\n\nexport function Popover({\n trigger,\n children,\n open,\n onOpenChange,\n side,\n sideOffset = 5,\n align,\n alignOffset,\n arrowPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n enabled = true,\n modal = false,\n portalContainer,\n className,\n onMouseEnter,\n onMouseLeave\n }: PopoverProps) {\n\n useInjectStyles(\"Popover\", popoverStyles);\n\n // Get the portal container from context\n const contextContainer = usePortalContainer();\n\n // Prioritize manual prop, fallback to context container\n const finalContainer = (portalContainer ?? contextContainer ?? undefined) as HTMLElement | undefined;\n\n if (!enabled)\n return <>{trigger}</>;\n\n return <PopoverPrimitive.Root open={open}\n onOpenChange={onOpenChange}\n modal={modal}>\n\n <PopoverPrimitive.Trigger asChild>\n {trigger}\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal container={finalContainer}>\n <PopoverPrimitive.Content\n // `z-50`, the floating layer — see the note in `Menu`. Below it\n // a popover opened from inside a dialog or a side panel is\n // painted under the thing that owns its trigger.\n className={cls(paperMixin,\n \"PopoverContent z-50\", className)}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n arrowPadding={arrowPadding}\n sticky={sticky}\n hideWhenDetached={hideWhenDetached}\n avoidCollisions={avoidCollisions}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}>\n\n {children}\n <PopoverPrimitive.Arrow className=\"fill-white dark:fill-surface-900\"/>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>;\n}\n\nconst popoverStyles = `\n/* ... (styles remain unchanged) ... */\n.PopoverContent {\n animation-duration: 400ms;\n animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n}\n.PopoverContent[data-state='open'][data-side='top'] {\n animation-name: slideDownAndFade;\n}\n.PopoverContent[data-state='open'][data-side='right'] {\n animation-name: slideLeftAndFade;\n}\n.PopoverContent[data-state='open'][data-side='bottom'] {\n animation-name: slideUpAndFade;\n}\n.PopoverContent[data-state='open'][data-side='left'] {\n animation-name: slideRightAndFade;\n}\n\n@keyframes slideUpAndFade {\n from {\n opacity: 0;\n transform: translateY(2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideRightAndFade {\n from {\n opacity: 0;\n transform: translateX(-2px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideDownAndFade {\n from {\n opacity: 0;\n transform: translateY(-2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes slideLeftAndFade {\n from {\n opacity: 0;\n transform: translateX(2px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n`;\n","import React from \"react\";\n\nexport type BadgeColor = \"primary\" | \"secondary\" | \"warning\" | \"error\";\n\nexport interface BadgeProps {\n color?: BadgeColor;\n children: React.ReactNode;\n invisible?: boolean;\n}\n\nconst getColor = (color: BadgeColor) => {\n switch (color) {\n case \"primary\":\n return \"bg-primary\";\n case \"secondary\":\n return \"bg-secondary\";\n case \"warning\":\n return \"bg-orange-500\";\n case \"error\":\n return \"bg-red-500\";\n default:\n return \"bg-surface-raised-hover\";\n }\n}\n\nexport const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(({\n color = \"primary\",\n invisible = false,\n children\n }, ref) => {\n return (\n <div ref={ref} className=\"relative inline-block w-fit\">\n {children}\n <span\n className={`absolute top-0.5 right-0.5 transform translate-x-1/2 -translate-y-1/2 rounded-full\n ${getColor(color)}\n transition-all duration-200 ease-out\n ${invisible ? \"w-0 h-0\" : \"w-2 h-2\"}`}\n />\n </div>\n );\n});\n\nBadge.displayName = \"Badge\";\n","\"use client\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { TextField, TextFieldProps } from \"./TextField\";\n\ntype TextFieldChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>;\n\nexport function DebouncedTextField<T extends string | number>(props: TextFieldProps<T>) {\n\n const [internalValue, setInternalValue] = useState<T | string>(props.value ?? \"\");\n const lastSentValueRef = useRef<T | string>(props.value ?? \"\");\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Sync state with props.value when it changes externally\n useEffect(() => {\n const externalValue = props.value ?? \"\";\n if (externalValue !== lastSentValueRef.current) {\n setInternalValue(externalValue);\n lastSentValueRef.current = externalValue;\n }\n }, [props.value]);\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n };\n }, []);\n\n const flushChange = useCallback((value: T | string, event?: TextFieldChangeEvent) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n }\n if (value !== props.value && props.onChange) {\n lastSentValueRef.current = value;\n const e = {\n ...event,\n target: {\n ...event?.target,\n value: value,\n name: props.name\n }\n } as TextFieldChangeEvent;\n props.onChange(e);\n }\n }, [props.value, props.onChange, props.name]);\n\n const internalOnChange = useCallback((event: TextFieldChangeEvent) => {\n const newValue = event.target.value;\n setInternalValue(newValue);\n\n if (timerRef.current) clearTimeout(timerRef.current);\n\n const eventCopy = {\n ...event,\n target: {\n ...event?.target,\n name: event?.target?.name\n }\n };\n\n timerRef.current = setTimeout(() => {\n flushChange(newValue, eventCopy as TextFieldChangeEvent);\n }, 150);\n }, [flushChange]);\n\n const internalOnBlur = useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n flushChange(internalValue, event as TextFieldChangeEvent);\n props.onBlur?.(event);\n }, [internalValue, flushChange, props.onBlur]);\n\n return <TextField {...props}\n onChange={internalOnChange}\n onBlur={internalOnBlur}\n value={internalValue as T}/>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\nimport { useInjectStyles } from \"../hooks\";\n\nexport type SkeletonProps = {\n width?: number;\n height?: number;\n className?: string;\n}\n\nconst styles = `\n@keyframes shimmer {\n 0% {\n transform: translateX(-150%);\n }\n 100% {\n transform: translateX(150%);\n }\n}\n`;\n\nexport function Skeleton({\n width,\n height,\n className\n }: SkeletonProps) {\n\n useInjectStyles(\"Skeleton\", styles);\n\n return <span\n style={{\n width: width === undefined ? undefined : `${width}px`,\n height: height === undefined ? undefined : `${height}px`\n }}\n className={\n cls(\n \"block relative overflow-hidden\",\n \"bg-surface-raised rounded-md\",\n \"max-w-full max-h-full\",\n // The defaults are classes, not inline styles, so that a caller can\n // override them: an inline style beats every utility, which is why\n // `<Skeleton className=\"w-full h-full\"/>` inside a 40px thumbnail\n // box used to render a 12px bar. The `width`/`height` props still\n // win over any class, since those do land inline.\n width === undefined ? \"w-full\" : undefined,\n height === undefined ? \"h-3\" : undefined,\n className)\n }>\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white/50 dark:via-white/8 to-transparent\"\n style={{ animation: \"shimmer 1.8s ease-in-out infinite\" }}\n />\n </span>;\n}\n","import React from \"react\";\nimport { cls } from \"../util\";\n\nexport type ToggleButtonOption<T extends string = string> = {\n value: T;\n label: string;\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport type ToggleButtonGroupProps<T extends string = string> = {\n /**\n * Currently selected value\n */\n value: T;\n /**\n * Callback when value changes\n */\n onValueChange: (value: T) => void;\n /**\n * Options to display\n */\n options: ToggleButtonOption<T>[];\n /**\n * Additional class names for the container\n */\n className?: string;\n}\n\n/**\n * A toggle button group component for selecting one option from a set.\n * Displays options as buttons in a horizontal row with active state styling.\n */\nexport function ToggleButtonGroup<T extends string = string>({\n value,\n onValueChange,\n options,\n className\n}: ToggleButtonGroupProps<T>) {\n return (\n // A 32px rounded track (`lg`) with `md` segments. It was 48px with a\n // blue label on the active segment; the lifted fill already says which\n // segment is on, so the label stays in the primary ink and the hue is\n // not spent twice.\n <div role=\"group\" aria-label=\"Toggle options\" className={cls(\"inline-flex flex-row bg-surface-field rounded-lg p-1 gap-1\", className)}>\n {options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n if (!option.disabled) {\n onValueChange(option.value);\n }\n }}\n disabled={option.disabled}\n aria-pressed={value === option.value}\n aria-disabled={option.disabled || undefined}\n className={cls(\n \"flex flex-row items-center justify-center gap-2 h-6 px-3.5 rounded-md transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50\",\n value === option.value\n ? \"bg-surface-lifted text-text-primary dark:text-text-primary-dark shadow-sm\"\n : \"text-text-secondary dark:text-text-secondary-dark hover:bg-surface-hover\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.icon}\n <span className=\"text-xs font-medium\">{option.label}</span>\n </button>\n ))}\n </div>\n );\n}\n","import { ArrowUpIcon, FilterIcon } from \"lucide-react\";\nimport { iconSize } from \"../../icons/Icon\";\n\nimport React, { RefObject, useCallback, useEffect, useState } from \"react\";\nimport { deepEqual as equal } from \"fast-equals\";\n\nimport { VirtualTableColumn, VirtualTableSort, VirtualTableWhereFilterOp } from \"./VirtualTableProps\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { Badge } from \"../Badge\";\nimport { Button } from \"../Button\";\nimport { IconButton } from \"../IconButton\";\nimport { Popover } from \"../Popover\";\nimport { defaultBorderMixin } from \"../../styles\";\nimport { cls } from \"../../util/cls\";\ninterface FilterFormProps<T> {\n column: VirtualTableColumn<T>;\n onFilterUpdate: (filter?: [VirtualTableWhereFilterOp, unknown], newOpenFilterState?: boolean) => void;\n filter?: [VirtualTableWhereFilterOp, unknown];\n onHover: boolean,\n createFilterField: (props: FilterFormFieldProps<T>) => React.ReactNode;\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n}\n\nexport type FilterFormFieldProps<CustomProps> = {\n id: React.Key,\n filterValue: [VirtualTableWhereFilterOp, unknown] | undefined,\n setFilterValue: (filterValue?: [VirtualTableWhereFilterOp, unknown]) => void;\n column: VirtualTableColumn<CustomProps>;\n hidden: boolean;\n setHidden: (hidden: boolean) => void;\n};\n\ntype VirtualTableHeaderProps<M extends object> = {\n resizeHandleRef: React.Ref<HTMLDivElement>;\n columnIndex: number;\n isResizingIndex: number;\n column: VirtualTableColumn<unknown>;\n onColumnSort: (key: Extract<keyof M, string>, additive?: boolean) => void;\n filter?: [VirtualTableWhereFilterOp, unknown];\n sort: VirtualTableSort;\n /**\n * This column's zero-based rank in a multi-key sort, or `undefined` when\n * only one column is sorted and a rank would say nothing.\n */\n sortPosition?: number;\n onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;\n onClickResizeColumn?: (columnIndex: number, column: VirtualTableColumn) => void;\n createFilterField?: (props: FilterFormFieldProps<unknown>) => React.ReactNode;\n AdditionalHeaderWidget?: (props: { onHover: boolean }) => React.ReactNode;\n isDragging?: boolean;\n isDraggable?: boolean;\n};\n\n/**\n * What the next click on this column's sort control will do, spelled out for\n * the tooltip and for screen readers. An unlabelled arrow that means three\n * different things depending on the state it is in is a control you have to\n * click to learn.\n */\nfunction sortActionTitle(sort: VirtualTableSort, sortPosition?: number): string {\n const rank = sortPosition !== undefined ? ` (sort key ${sortPosition + 1})` : \"\";\n const addKey = \" — shift-click to add it under the current sort instead\";\n if (sort === \"asc\") return `Sorted ascending${rank}. Click to sort descending.${addKey}`;\n if (sort === \"desc\") return `Sorted descending${rank}. Click to remove this sort.${addKey}`;\n return `Click to sort ascending.${addKey}`;\n}\n\nexport const VirtualTableHeader = React.memo<VirtualTableHeaderProps<Record<string, unknown>>>(\n function VirtualTableHeader<M extends object>({\n resizeHandleRef,\n columnIndex,\n isResizingIndex,\n sort,\n sortPosition,\n onColumnSort,\n onFilterUpdate,\n filter,\n column,\n onClickResizeColumn,\n createFilterField,\n AdditionalHeaderWidget,\n isDragging,\n isDraggable\n }: VirtualTableHeaderProps<M>) {\n\n const [onHover, setOnHover] = useState(false);\n\n const [openFilter, setOpenFilter] = React.useState(false);\n const [hidden, setHidden] = React.useState(false);\n\n const handleSettingsClick = useCallback((_event: React.MouseEvent) => {\n setOpenFilter(true);\n }, []);\n\n const update = useCallback((filterForProperty?: [VirtualTableWhereFilterOp, unknown], newOpenFilterState?: boolean) => {\n onFilterUpdate(column, filterForProperty);\n if (newOpenFilterState !== undefined)\n setOpenFilter(newOpenFilterState);\n }, [column, onFilterUpdate]);\n\n const thisColumnIsResizing = isResizingIndex === columnIndex;\n const anotherColumnIsResizing = isResizingIndex !== columnIndex && isResizingIndex > 0;\n\n const hovered = !anotherColumnIsResizing && (onHover || thisColumnIsResizing);\n\n return (\n <ErrorBoundary>\n <div\n className={cls(\"flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center\",\n isDragging\n ? \"bg-primary-bg\"\n : \"bg-surface-sheet\",\n \"text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark\",\n !isDragging && \"hover:bg-surface-hover\",\n column.frozen ? \"sticky left-0 z-10\" : \"relative z-0\",\n isDraggable && \"cursor-grab\"\n )}\n style={{\n left: column.frozen ? 0 : undefined,\n minWidth: column.width,\n maxWidth: column.width\n }}\n onMouseEnter={() => setOnHover(true)}\n onMouseMove={() => setOnHover(true)}\n onMouseLeave={() => setOnHover(false)}\n >\n\n <div className=\"overflow-hidden grow\">\n <div\n className={`flex items-center justify-${column.headerAlign} flex-row`}>\n\n {column.icon && (\n <div className=\"flex-shrink-0 flex items-center justify-center mr-1\">\n {React.isValidElement(column.icon) ? (\n React.cloneElement(column.icon as React.ReactElement<any>, {\n size: 14,\n className: cls((column.icon as React.ReactElement<any>).props?.className, \"flex-shrink-0\")\n })\n ) : (\n column.icon\n )}\n </div>\n )}\n\n <div\n className=\"truncate -webkit-box w-full mr-1 overflow-hidden\"\n style={{\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 2,\n justifyContent: column.align\n }}>\n {column.title}\n </div>\n\n </div>\n </div>\n <>\n\n {AdditionalHeaderWidget &&\n <AdditionalHeaderWidget onHover={onHover || openFilter}/>}\n\n {column.sortable && (sort || hovered || openFilter) &&\n <div className=\"flex-shrink-0 flex items-center\">\n <Badge color=\"secondary\"\n invisible={!sort}>\n <IconButton\n size={\"small\"}\n className={onHover || openFilter ? \"bg-surface-card\" : undefined}\n // Shift keeps the sort already in place\n // and adds this column beneath it, which\n // is how a two-key order is built from\n // header clicks. Plain click still\n // replaces the whole sort, so the common\n // case takes no modifier and nothing a\n // user knew before stops working.\n title={sortActionTitle(sort, sortPosition)}\n aria-label={sortActionTitle(sort, sortPosition)}\n onClick={(event: React.MouseEvent) => {\n onColumnSort(column.key as Extract<keyof M, string>, event.shiftKey);\n }}\n >\n {!sort &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0\" />}\n {sort === \"asc\" &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0\" />}\n {sort === \"desc\" &&\n <ArrowUpIcon size={14} className=\"flex-shrink-0 rotate-180\" />}\n </IconButton>\n </Badge>\n {/* The rank, shown only once there is more than\n one key: two arrows with no numbers beside\n them say a table is sorted by both columns\n and nothing about which one decides. */}\n {sort && sortPosition !== undefined && (\n <span\n className=\"flex-shrink-0 -ml-0.5 mr-0.5 text-[10px] font-semibold leading-none tabular-nums text-text-secondary dark:text-text-secondary-dark\"\n aria-hidden={true}\n >\n {sortPosition + 1}\n </span>\n )}\n </div>\n }\n </>\n\n {column.filter && createFilterField && <div className=\"flex-shrink-0\">\n <Badge color=\"secondary\"\n invisible={!filter}>\n\n <Popover\n open={openFilter}\n onOpenChange={setOpenFilter}\n className={hidden ? \"hidden\" : undefined}\n modal={true}\n trigger={\n <IconButton\n className={onHover || openFilter ? \"bg-surface-card\" : undefined}\n size={\"small\"}\n onClick={handleSettingsClick}>\n <FilterIcon size={14} className=\"flex-shrink-0\"/>\n </IconButton>}\n >\n <FilterForm column={column}\n filter={filter}\n onHover={onHover}\n onFilterUpdate={update}\n createFilterField={createFilterField}\n hidden={hidden}\n setHidden={setHidden}/>\n\n </Popover>\n\n </Badge>\n\n </div>}\n\n {column.resizable && <div\n ref={resizeHandleRef as React.Ref<HTMLDivElement>}\n data-no-dnd=\"true\"\n className={cls(\n \"absolute h-full w-[6px] top-0 right-0 cursor-col-resize\",\n hovered && \"bg-hairline-strong\"\n )}\n onPointerDown={(e) => {\n e.stopPropagation();\n if (onClickResizeColumn) {\n onClickResizeColumn(columnIndex, column);\n }\n }}\n />}\n </div>\n\n </ErrorBoundary>\n );\n }, equal) as React.FunctionComponent<VirtualTableHeaderProps<Record<string, unknown>>>;\n\nfunction FilterForm<M>({\n column,\n onFilterUpdate,\n filter,\n onHover,\n createFilterField,\n hidden,\n setHidden\n}: FilterFormProps<M>) {\n\n const id = column.key;\n\n const [filterInternal, setFilterInternal] = useState<[VirtualTableWhereFilterOp, unknown] | undefined>(filter);\n\n useEffect(() => {\n setFilterInternal(filter);\n }, [filter]);\n\n if (!column.filter) return null;\n\n const submit = () => {\n onFilterUpdate(filterInternal, false);\n };\n\n const reset = (_e: React.MouseEvent) => {\n onFilterUpdate(undefined, false);\n };\n\n const filterIsSet = !!filter;\n\n const filterField = createFilterField({\n id,\n filterValue: filterInternal,\n setFilterValue: setFilterInternal,\n column,\n hidden,\n setHidden\n });\n\n if (!filterField) return null;\n return (\n <form noValidate={true}\n onSubmit={(e) => {\n e.stopPropagation();\n e.preventDefault();\n submit();\n }}\n className={\"text-surface-900 dark:text-white\"}>\n <div\n className={cls(defaultBorderMixin, \"py-4 px-6 typography-label border-b\")}>\n {column.title ?? id}\n </div>\n {filterField && <div className=\"m-4 w-[400px]\">\n {filterField}\n </div>}\n <div className=\"flex justify-end m-4\">\n <Button\n className=\"mr-4\"\n disabled={!filterIsSet}\n variant={\"text\"}\n type=\"reset\"\n aria-label=\"filter clear\"\n onClick={reset}>Clear</Button>\n <Button\n type=\"submit\">Filter</Button>\n </div>\n </form>\n );\n\n}\n","import React, { createRef, useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { VirtualTableColumn, VirtualTableWhereFilterOp } from \"./VirtualTableProps\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { VirtualTableHeader } from \"./VirtualTableHeader\";\nimport { VirtualTableContextProps } from \"./types\";\nimport { defaultBorderMixin } from \"../../styles\";\nimport { cls } from \"../../util/cls\";import { useSortable } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\n\n// Sortable column header wrapper\nconst SortableColumnHeader = ({\n column,\n columnIndex,\n columnRefs,\n isResizing,\n onFilterUpdate,\n filter,\n sortIndex,\n sortCount,\n onColumnSort,\n onClickResizeColumn,\n createFilterField,\n isDragging,\n isDraggable\n}: {\n column: VirtualTableColumn;\n columnIndex: number;\n columnRefs: React.Ref<HTMLDivElement>[];\n isResizing: number;\n onFilterUpdate: (column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => void;\n filter: [VirtualTableWhereFilterOp, unknown] | undefined;\n sortIndex: Map<string, { direction: \"asc\" | \"desc\"; position: number }>;\n sortCount: number;\n onColumnSort: (key: string, additive?: boolean) => void;\n onClickResizeColumn: (index: number) => void;\n createFilterField: ((props: import(\"./VirtualTableHeader\").FilterFormFieldProps<unknown>) => React.ReactNode) | undefined;\n isDragging: boolean;\n isDraggable: boolean;\n}) => {\n const [isPressing, setIsPressing] = useState(false);\n\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition\n } = useSortable({\n id: column.key,\n disabled: !isDraggable || column.frozen\n });\n\n const style = {\n // Only use translate, ignore any scale transforms\n transform: transform ? `translateX(${transform.x}px)` : undefined,\n // Don't transition the dragged item - only other items should animate\n transition: isDragging ? undefined : transition,\n minWidth: column.width,\n maxWidth: column.width,\n width: column.width\n };\n\n // Combine our press handlers with dnd-kit listeners\n const combinedListeners = isDraggable ? {\n ...listeners,\n onPointerDown: (e: React.PointerEvent) => {\n setIsPressing(true);\n listeners?.onPointerDown?.(e);\n },\n onPointerUp: () => setIsPressing(false),\n onPointerCancel: () => setIsPressing(false)\n } : {};\n\n // Reset pressing state when drag ends\n React.useEffect(() => {\n if (!isDragging) {\n setIsPressing(false);\n }\n }, [isDragging]);\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cls(\n \"flex-shrink-0 h-full\",\n column.frozen && \"sticky left-0 z-10\"\n )}\n {...attributes}\n {...combinedListeners}\n >\n <VirtualTableHeader\n resizeHandleRef={columnRefs[columnIndex]}\n columnIndex={columnIndex}\n isResizingIndex={isResizing}\n onFilterUpdate={onFilterUpdate}\n filter={filter}\n sort={sortIndex.get(column.key)?.direction}\n sortPosition={sortCount > 1 ? sortIndex.get(column.key)?.position : undefined}\n onColumnSort={onColumnSort}\n onClickResizeColumn={onClickResizeColumn}\n column={column}\n createFilterField={createFilterField}\n AdditionalHeaderWidget={column.AdditionalHeaderWidget}\n isDragging={isDragging || isPressing}\n isDraggable={isDraggable}/>\n </div>\n );\n};\n\nexport const VirtualTableHeaderRow = ({\n columns,\n sortIndex,\n onColumnSort,\n onFilterUpdate,\n filter,\n onColumnResize,\n onColumnResizeEnd,\n createFilterField,\n AddColumnComponent,\n onColumnsOrderChange,\n data,\n cellRenderer: CellRenderer,\n rowHeight = 54,\n draggingColumnId,\n headerHeight = 40\n}: VirtualTableContextProps<Record<string, unknown>>) => {\n\n const columnRefs = useMemo(() => columns.map(() => createRef<HTMLDivElement>()), [columns.length]);\n const [isResizing, setIsResizing] = useState(-1);\n\n const adjustWidthColumn = useCallback((index: number, width: number, end: boolean) => {\n const column = columns[index];\n const minWidth = 100;\n const maxWidth = 800;\n const newWidth = width > maxWidth ? maxWidth : (width < minWidth ? minWidth : width);\n const params = {\n width: newWidth,\n key: column.key as string,\n column: {\n ...column,\n width: newWidth\n } as VirtualTableColumn\n };\n if (!end)\n onColumnResize(params);\n else\n onColumnResizeEnd(params);\n }, [columns, onColumnResize, onColumnResizeEnd]);\n\n const getEventNewWidth = useCallback((e: MouseEvent) => {\n if (isResizing >= 0) {\n const left = columnRefs[isResizing].current?.parentElement?.getBoundingClientRect().left;\n if (!left) return;\n return e.clientX - left;\n }\n return undefined;\n }, [columnRefs, isResizing]);\n\n const setCursorDocument = useCallback((isResizing: boolean) => {\n document.body.style.cursor = isResizing ? \"col-resize\" : \"auto\";\n }, []);\n\n const handleOnMouseMove = useCallback((e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const newWidth = getEventNewWidth(e);\n if (newWidth)\n adjustWidthColumn(isResizing, newWidth, false);\n }, [adjustWidthColumn, getEventNewWidth, isResizing]);\n\n const handleOnMouseUp = useCallback((e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const newWidth = getEventNewWidth(e);\n if (newWidth)\n adjustWidthColumn(isResizing, newWidth, true);\n setIsResizing(-1);\n setCursorDocument(false);\n }, [adjustWidthColumn, getEventNewWidth, isResizing, setCursorDocument]);\n\n const removeResizingListeners = useCallback(() => {\n document.removeEventListener(\"mousemove\", handleOnMouseMove);\n document.removeEventListener(\"mouseup\", handleOnMouseUp);\n }, [handleOnMouseMove, handleOnMouseUp]);\n\n const attachResizeListeners = useCallback(() => {\n document.addEventListener(\"mousemove\", handleOnMouseMove);\n document.addEventListener(\"mouseup\", handleOnMouseUp);\n }, [handleOnMouseMove, handleOnMouseUp]);\n\n useEffect(() => {\n if (isResizing >= 0) {\n attachResizeListeners();\n } else {\n removeResizingListeners();\n }\n return () => {\n removeResizingListeners();\n };\n }, [attachResizeListeners, isResizing, removeResizingListeners]);\n\n const onClickResizeColumn = useCallback((index: number) => {\n setIsResizing(index);\n setCursorDocument(true);\n }, [setCursorDocument]);\n\n return (\n <>\n <div\n className={cls(defaultBorderMixin, \"z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 border-b bg-surface-sheet\")}\n style={{ height: headerHeight }}>\n {columns.map((column, columnIndex) => {\n const columnFilter = column && filter && filter[column.key] ? filter[column.key] : undefined;\n const filterForThisProperty: [VirtualTableWhereFilterOp, unknown] | undefined =\n columnFilter\n ? (Array.isArray(columnFilter[0]) ? (columnFilter as [VirtualTableWhereFilterOp, unknown][])[0] : (columnFilter as [VirtualTableWhereFilterOp, unknown]))\n : undefined;\n\n const isDraggable = !column.frozen && !!onColumnsOrderChange;\n const isDragging = draggingColumnId === column.key;\n\n return (\n <ErrorBoundary key={\"header_\" + column.key}>\n <SortableColumnHeader\n column={column}\n columnIndex={columnIndex}\n columnRefs={columnRefs}\n isResizing={isResizing}\n onFilterUpdate={onFilterUpdate}\n filter={filterForThisProperty}\n sortIndex={sortIndex}\n sortCount={sortIndex.size}\n onColumnSort={onColumnSort}\n onClickResizeColumn={onClickResizeColumn}\n createFilterField={createFilterField}\n isDragging={isDragging}\n isDraggable={isDraggable}\n />\n </ErrorBoundary>\n );\n })}\n\n {AddColumnComponent && <AddColumnComponent/>}\n\n </div>\n </>\n );\n};\n","import React, { useCallback } from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { VirtualTableRowProps } from \"./types\";\nimport { cls } from \"../../util/cls\";\nconst VirtualTableRowInner = React.memo<VirtualTableRowProps<object>>(\n function VirtualTableRow<T extends object>({\n rowData,\n rowIndex,\n children,\n onRowClick,\n rowHeight,\n style,\n hoverRow,\n rowClassName\n }: VirtualTableRowProps<T>) {\n\n const onClick = useCallback((event: React.SyntheticEvent) => {\n // A row with no data yet is not a row anyone clicked *on*.\n if (onRowClick && rowData)\n onRowClick({\n rowData,\n rowIndex,\n event\n })\n }, [onRowClick, rowData, rowIndex]);\n\n return (\n <div\n className={cls(\n \"group flex min-w-full text-sm border-b border-hairline bg-surface-card\",\n rowClassName && rowData ? rowClassName(rowData) : \"\",\n {\n \"hover:!bg-surface-card-hover\": hoverRow,\n \"cursor-pointer \": onRowClick\n }\n )}\n onClick={onClick}\n style={{\n ...(style),\n height: rowHeight,\n width: \"fit-content\"\n }}\n >\n {children}\n </div>\n );\n\n },\n equal\n);\n\n/**\n * The same fix `VirtualTable` carries, one level down: `React.memo` takes the\n * props type as its own type argument, so the annotation on the call pins the\n * row type at the boundary and discards the `<T>` the inner function declares.\n * Pinned, the row a caller passes in and the row its `onRowClick` and\n * `rowClassName` receive were unrelated types, which is what every consumer was\n * paying for with a cast.\n */\nexport const VirtualTableRow = VirtualTableRowInner as <T extends object>(\n props: VirtualTableRowProps<T>\n) => React.ReactElement | null;\n","import React from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { CellRendererParams, VirtualTableColumn } from \"./VirtualTableProps\";\n\ntype VirtualTableCellProps<T> = {\n dataKey: string;\n column: VirtualTableColumn;\n columns: VirtualTableColumn[];\n rowData: T;\n cellData: unknown;\n rowIndex: number;\n columnIndex: number;\n cellRenderer: (props: CellRendererParams<T>) => React.ReactNode;\n // Sortable props\n sortableNodeRef?: (node: HTMLElement | null) => void;\n sortableStyle?: React.CSSProperties;\n sortableAttributes?: Record<string, unknown>;\n isDragging?: boolean;\n isDraggable?: boolean;\n frozen?: boolean;\n extraData?: unknown;\n};\n\nexport const VirtualTableCell = React.memo<VirtualTableCellProps<unknown>>(\n function VirtualTableCell<T>(props: VirtualTableCellProps<T>) {\n return props.rowData ? props.cellRenderer(\n {\n cellData: props.cellData,\n rowData: props.rowData,\n rowIndex: props.rowIndex,\n isScrolling: false,\n column: props.column,\n columns: props.columns,\n columnIndex: props.columnIndex,\n width: props.column.width,\n sortableNodeRef: props.sortableNodeRef,\n sortableStyle: props.sortableStyle,\n sortableAttributes: props.sortableAttributes,\n isDragging: props.isDragging,\n isDraggable: props.isDraggable,\n frozen: props.frozen,\n extraData: props.extraData\n } as CellRendererParams<T>\n ) : null;\n },\n (a, b) => {\n return equal(a.rowData, b.rowData) &&\n equal(a.column, b.column) &&\n equal(a.cellData, b.cellData) &&\n a.rowIndex === b.rowIndex &&\n a.columnIndex === b.columnIndex &&\n a.isDragging === b.isDragging &&\n a.isDraggable === b.isDraggable &&\n a.frozen === b.frozen &&\n equal(a.extraData, b.extraData)\n }\n);\n","\n\nimport React, { createContext, forwardRef, RefObject, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { FixedSizeList as List } from \"react-window\";\nimport useMeasure from \"react-use-measure\";\n\nimport { CircularProgress } from \"../CircularProgress\";\nimport {\n OnVirtualTableColumnResizeParams,\n VirtualTableColumn,\n VirtualTableFilterValues,\n VirtualTableProps,\n VirtualTableSortKey,\n VirtualTableWhereFilterOp\n} from \"./VirtualTableProps\";\n\nimport { VirtualTableContextProps } from \"./types\";\nimport { VirtualTableHeaderRow } from \"./VirtualTableHeaderRow\";\nimport { VirtualTableRow } from \"./VirtualTableRow\";\nimport { VirtualTableCell } from \"./VirtualTableCell\";\nimport { CenteredView } from \"../CenteredView\";\nimport { Typography } from \"../Typography\";\nimport { cls } from \"../../util/cls\";\nimport { useDebounceCallback } from \"../../hooks/useDebounceCallback\";\nimport {\n closestCenter,\n DndContext,\n DragEndEvent,\n DragStartEvent,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable } from \"@dnd-kit/sortable\";\n\n\nconst VirtualListContext = createContext<VirtualTableContextProps<Record<string, unknown>>>(null! as VirtualTableContextProps<Record<string, unknown>>);\nVirtualListContext.displayName = \"VirtualListContext\";\n\ntype InnerElementProps = {\n children: React.ReactNode,\n style: React.CSSProperties\n};\n\n// eslint-disable-next-line react/display-name\nconst innerElementType = forwardRef<HTMLDivElement, InnerElementProps>(({\n children,\n ...rest\n}: InnerElementProps, ref) => {\n\n return (\n <VirtualListContext.Consumer>\n {(virtualTableProps) => {\n const customView = virtualTableProps.customView;\n const headerHeight = virtualTableProps.headerHeight ?? 48;\n return (\n <>\n <div\n id={\"virtual-table\"}\n style={{\n position: \"relative\",\n height: \"100%\",\n zIndex: 0\n }}>\n <div\n ref={ref}\n {...rest}\n style={{\n ...rest?.style,\n height: (typeof rest?.style?.height === \"number\" ? rest.style.height : parseFloat((rest?.style?.height as string) || \"0\")) + headerHeight,\n minHeight: \"100%\",\n position: \"relative\"\n }}>\n <div style={{ position: \"sticky\",\ntop: 0,\nzIndex: 20 }}>\n <VirtualTableHeaderRow {...virtualTableProps}/>\n </div>\n {!customView && children}\n </div>\n\n </div>\n\n {customView && <div style={{\n position: \"sticky\",\n top: virtualTableProps.headerHeight ?? 48,\n flexGrow: 1,\n height: `calc(100% - ${virtualTableProps.headerHeight ?? 48}px)`,\n marginTop: `calc(${(virtualTableProps.headerHeight ?? 48)}px - 100vh)`,\n left: 0\n }}>{customView}</div>}\n\n </>\n );\n }}\n </VirtualListContext.Consumer>\n );\n})\n ;\n\n/**\n * This is a Table component that allows displaying arbitrary data, not\n * necessarily related to entities or properties. It is the component\n * that powers the entity collections but has a generic API, so it\n * can be reused.\n *\n * @group Components\n */\nconst VirtualTableInner = React.memo<VirtualTableProps<Record<string, unknown>>>(\n function VirtualTable<T extends object>({\n data,\n onResetPagination,\n onEndReached,\n endOffset = 600,\n rowHeight = 54,\n headerHeight = 40,\n columns: columnsProp,\n onRowClick,\n onColumnResize,\n onColumnResizeEnd,\n filter: filterInput,\n checkFilterCombination,\n onFilterUpdate,\n sortBy,\n error,\n emptyComponent,\n onSortByUpdate,\n onScroll: onScrollProp,\n loading,\n cellRenderer,\n hoverRow,\n createFilterField,\n rowClassName,\n style,\n className,\n endAdornment,\n AddColumnComponent,\n initialScroll = 0,\n onColumnsOrderChange,\n extraData\n }: VirtualTableProps<T>) {\n\n // Where each sorted column sits in the order, so a header can show both\n // which way it runs and how much it counts: `roles ↑1, created_at ↓2`\n // reads as \"by role, newest first within each role\". Without the rank a\n // multi-key sort shows two arrows and no way to tell which one wins.\n const sortIndex = useMemo(() => {\n const index = new Map<string, { direction: \"asc\" | \"desc\"; position: number }>();\n (sortBy ?? []).forEach(([key, direction], position) => {\n if (!index.has(key)) index.set(key, { direction,\nposition });\n });\n return index;\n }, [sortBy]);\n\n const [columns, setColumns] = useState(columnsProp);\n\n const tableRef = useRef<HTMLDivElement>(null);\n const endReachCallbackThreshold = useRef<number>(0);\n\n const debouncedScroll = useDebounceCallback(onScrollProp, 200);\n\n // Drag and drop state\n const [draggingColumnId, setDraggingColumnId] = useState<string | null>(null);\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n })\n );\n\n const handleDragStart = useCallback((event: DragStartEvent) => {\n setDraggingColumnId(event.active.id as string);\n }, []);\n\n const handleDragEnd = useCallback((event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n setDraggingColumnId(null);\n\n if (over && active.id !== over.id && onColumnsOrderChange) {\n const oldIndex = columns.findIndex((col) => col.key === active.id);\n const newIndex = columns.findIndex((col) => col.key === over.id);\n\n if (oldIndex !== -1 && newIndex !== -1) {\n const newColumns = arrayMove(columns, oldIndex, newIndex);\n setColumns(newColumns);\n onColumnsOrderChange(newColumns);\n }\n }\n }, [columns, onColumnsOrderChange]);\n\n const handleDragCancel = useCallback(() => {\n setDraggingColumnId(null);\n }, []);\n\n // Set initial scroll position\n useEffect(() => {\n if (tableRef.current && initialScroll) {\n const { scrollLeft } = tableRef.current;\n tableRef.current.scrollTo(scrollLeft, initialScroll);\n }\n }, [tableRef, initialScroll]);\n\n useEffect(() => {\n setColumns(columnsProp);\n }, [columnsProp]);\n\n // Removed redundant ResizeObserver to prevent performance issues and UI flickering.\n\n const [measureRef, bounds] = useMeasure({\n polyfill: ResizeObserver,\n scroll: true,\n // This is important for handling zooming in react-flow\n offsetSize: true\n });\n\n const onColumnResizeInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {\n setColumns(prevColumns =>\n prevColumns.map((column) =>\n column.key === params.column.key ? params.column : column\n )\n );\n }, []);\n\n const onColumnResizeEndInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {\n setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));\n if (onColumnResize) {\n onColumnResize(params);\n }\n if (onColumnResizeEnd) {\n onColumnResizeEnd(params);\n }\n }, [columns, onColumnResize, onColumnResizeEnd]);\n\n // saving the current filter as a ref as a workaround for header closure\n const filterRef = useRef<VirtualTableFilterValues<string> | undefined>(undefined);\n\n useEffect(() => {\n filterRef.current = filterInput;\n }, [filterInput]);\n\n const scrollToTop = useCallback(() => {\n endReachCallbackThreshold.current = 0;\n if (tableRef.current) {\n tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);\n }\n }, []);\n\n /**\n * Click a header to sort by that column: ascending, descending, then\n * off. Shift-click to keep the sort you already have and add this\n * column under it — the same idiom spreadsheets use, and the only way\n * to build \"by role, newest first\" out of two clicks.\n *\n * Shift cycles the column it lands on through the same three states, so\n * a key added by mistake is removed by shift-clicking it twice more,\n * without disturbing the keys around it.\n */\n const onColumnSort = useCallback((key: string, additive = false) => {\n\n const current = sortIndex.get(key);\n const next: \"asc\" | \"desc\" | undefined = current === undefined\n ? \"asc\"\n : current.direction === \"asc\" ? \"desc\" : undefined;\n\n const existing = sortBy ?? [];\n let newSortBy: VirtualTableSortKey[] | undefined;\n if (!additive) {\n newSortBy = next ? [[key, next]] : undefined;\n } else if (next === undefined) {\n newSortBy = existing.filter(([existingKey]) => existingKey !== key);\n } else if (current === undefined) {\n newSortBy = [...existing, [key, next]];\n } else {\n newSortBy = existing.map((entry) => entry[0] === key ? [key, next] as VirtualTableSortKey : entry);\n }\n if (newSortBy?.length === 0) newSortBy = undefined;\n\n const filter = filterRef.current;\n if (filter) {\n if (checkFilterCombination && !checkFilterCombination(filter, newSortBy)) {\n if (onFilterUpdate)\n onFilterUpdate(undefined);\n }\n }\n\n if (onResetPagination) {\n onResetPagination();\n }\n\n if (onSortByUpdate) {\n onSortByUpdate(newSortBy);\n }\n\n scrollToTop();\n }, [checkFilterCombination, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortBy, sortIndex]);\n\n const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);\n\n const onEndReachedInternal = useCallback((scrollOffset: number) => {\n if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {\n endReachCallbackThreshold.current = scrollOffset;\n onEndReached();\n }\n }, [data?.length, onEndReached]);\n\n const onScroll = useCallback(({\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n }: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean;\n }) => {\n if (onScrollProp) {\n debouncedScroll({\n scrollDirection,\n scrollOffset,\n scrollUpdateWasRequested\n })\n }\n if (!scrollUpdateWasRequested && (scrollOffset >= maxScroll - endOffset))\n onEndReachedInternal(scrollOffset);\n }, [maxScroll, onEndReachedInternal]);\n\n const onFilterUpdateInternal = useCallback((column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, unknown]) => {\n\n endReachCallbackThreshold.current = 0;\n const filter = filterRef.current;\n let newFilterValue: VirtualTableFilterValues<string> = filter ? { ...filter } : {};\n\n if (!filterForProperty) {\n delete newFilterValue[column.key];\n } else {\n newFilterValue[column.key] = filterForProperty;\n }\n const isNewFilterCombinationValid = !checkFilterCombination || checkFilterCombination(newFilterValue, sortBy);\n if (!isNewFilterCombinationValid) {\n newFilterValue = filterForProperty ? { [column.key]: filterForProperty } as VirtualTableFilterValues<Extract<keyof T, string>> : {};\n }\n\n if (onFilterUpdate) onFilterUpdate(newFilterValue);\n }, [checkFilterCombination, onFilterUpdate, sortBy]);\n\n const empty = !loading && (data?.length ?? 0) === 0;\n const customView = (error && (data?.length ?? 0) === 0)\n ? <CenteredView maxWidth={\"2xl\"}\n className=\"flex flex-col gap-2\">\n\n <Typography variant={\"h6\"}>\n {\"Error\"}\n </Typography>\n\n {error?.message && <SafeLinkRenderer text={error.message}/>}\n\n </CenteredView>\n : (empty\n ? (loading\n ? <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\"/>\n </div>\n : <div\n className=\"flex flex-col overflow-auto items-center justify-center py-12 px-8\">\n {emptyComponent}\n </div>)\n : undefined);\n\n const virtualListController = useMemo(() => ({\n data,\n rowHeight: rowHeight,\n headerHeight: headerHeight,\n cellRenderer,\n columns,\n onRowClick,\n customView,\n onColumnResize: onColumnResizeInternal,\n onColumnResizeEnd: onColumnResizeEndInternal,\n filter: filterRef.current,\n onColumnSort,\n onFilterUpdate: onFilterUpdateInternal,\n sortIndex,\n hoverRow: hoverRow ?? false,\n createFilterField,\n rowClassName,\n endAdornment,\n AddColumnComponent,\n onColumnsOrderChange: onColumnsOrderChange ? (newColumns: VirtualTableColumn[]) => {\n setColumns(newColumns);\n onColumnsOrderChange(newColumns);\n } : undefined,\n draggingColumnId,\n extraData\n }), [data, rowHeight, cellRenderer, columns, onRowClick, customView, onColumnResizeInternal, onColumnResizeEndInternal, filterInput, onColumnSort, onFilterUpdateInternal, sortIndex, hoverRow, createFilterField, rowClassName, endAdornment, AddColumnComponent, onColumnsOrderChange, draggingColumnId, extraData]);\n\n // Get sortable column keys (excluding frozen columns)\n const sortableColumnKeys = columns\n .filter(col => !col.frozen)\n .map(col => col.key);\n\n const tableContent = (\n <div\n ref={measureRef}\n style={style}\n className={cls(\n \"h-full w-full\",\n className,\n draggingColumnId && \"overflow-hidden\"\n )}>\n {/* SAFETY: T extends Record<string, any> is structurally assignable to Record<string, unknown> */}\n <VirtualListContext.Provider\n value={virtualListController as VirtualTableContextProps<Record<string, unknown>>}>\n\n <MemoizedList\n outerRef={tableRef}\n key={rowHeight}\n width={bounds.width}\n height={bounds.height}\n itemCount={(data?.length ?? 0) + (endAdornment ? 1 : 0)}\n onScroll={draggingColumnId ? undefined : onScroll}\n includeAddColumn={Boolean(AddColumnComponent)}\n itemSize={rowHeight}/>\n\n </VirtualListContext.Provider>\n </div>\n );\n\n // Wrap with DndContext if column reorder is enabled\n if (onColumnsOrderChange) {\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <SortableContext\n items={sortableColumnKeys}\n strategy={horizontalListSortingStrategy}\n >\n {tableContent}\n </SortableContext>\n </DndContext>\n );\n }\n\n return tableContent;\n },\n equal\n);\n\n/**\n * `React.memo` is not generic-preserving: it takes the props type as its own\n * type argument, so annotating the call with\n * `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and\n * discarded the `<T>` the inner function declares. The exported component was\n * therefore not generic at all — every consumer got `Record<string, unknown>`,\n * `columns` and `cellRenderer` were unrelated to `data`, and a caller writing\n * `<VirtualTable<Post> …>` was told the component expects no type arguments.\n *\n * Re-asserting the call signature is the standard way to carry a type parameter\n * across `memo`; it is the only cast here, and it restores the generic the\n * implementation always had. Runtime behaviour is unchanged — this is the same\n * memoized component under a type that describes it.\n */\nexport const VirtualTable = VirtualTableInner as <T extends object>(\n props: VirtualTableProps<T>\n) => React.ReactElement | null;\n// Wrapper that applies sortable transforms to cells\nconst SortableCellWrapper = ({\n columnKey,\n width,\n isDragging,\n isDraggable,\n frozen,\n children\n}: {\n columnKey: string;\n width: number;\n isDragging: boolean;\n isDraggable: boolean;\n frozen?: boolean;\n children: React.ReactNode;\n}) => {\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition\n } = useSortable({\n id: columnKey,\n disabled: !isDraggable || frozen\n });\n\n // Remove tabIndex from attributes to avoid capturing focus before cell content\n const { tabIndex: _tabIndex, ...attrsWithoutTabIndex } = attributes;\n\n const style = {\n // Only use translate, ignore any scale transforms\n transform: transform ? `translateX(${transform.x}px)` : undefined,\n // Don't transition the dragged item - only other items should animate\n transition: isDragging ? undefined : transition,\n minWidth: width,\n maxWidth: width,\n width: width\n };\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cls(\n \"flex-shrink-0\",\n frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n {...attrsWithoutTabIndex}\n >\n {children}\n </div>\n );\n};\n\nfunction MemoizedList({\n outerRef,\n width,\n height,\n itemCount,\n onScroll,\n itemSize,\n includeAddColumn\n}: {\n outerRef: RefObject<HTMLDivElement | null>;\n width: number;\n height: number;\n itemCount: number;\n onScroll?: (params: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean;\n }) => void;\n itemSize: number;\n includeAddColumn?: boolean;\n}) {\n\n const Row = useCallback(({\n index,\n style\n }: { index: number; style: React.CSSProperties }) => {\n return <VirtualListContext.Consumer>\n {({\n onRowClick,\n data,\n columns,\n rowHeight = 54,\n headerHeight = 40,\n cellRenderer,\n hoverRow,\n rowClassName,\n endAdornment,\n draggingColumnId,\n onColumnsOrderChange,\n extraData\n }) => {\n\n if (endAdornment && index === (data ?? []).length) {\n return <div style={{\n ...style,\n height: \"auto\",\n position: \"sticky\",\n bottom: 0,\n zIndex: 1\n }}>\n {endAdornment}\n </div>;\n }\n\n const rowData = data ? data[index] : undefined;\n return (\n <VirtualTableRow\n key={`row_${index}`}\n rowData={rowData}\n rowIndex={index}\n onRowClick={onRowClick}\n columns={columns}\n hoverRow={hoverRow}\n rowClassName={rowClassName}\n style={{\n ...style,\n top: `calc(${style.top}px + ${headerHeight ?? 48}px)`\n }}\n rowHeight={rowHeight}>\n\n {columns.map((column: VirtualTableColumn, columnIndex: number) => {\n // The one place the row is read by key, and the one\n // cast for it. `T` is constrained to `object`\n // rather than `Record<string, unknown>` because an\n // `interface` — `Entity`, every consumer's row type\n // — has no implicit index signature and so does not\n // satisfy the latter. Constraining it there did not\n // make this read safe; it pushed an\n // `as unknown as Record<string, unknown>` onto every\n // caller, on the data going in AND on each callback\n // coming back out, which is four of them in\n // `SelectableTable` alone.\n const cellData = rowData && (rowData as Record<string, unknown>)[column.key];\n const isDragging = draggingColumnId === column.key;\n const isDraggable = !column.frozen && !!onColumnsOrderChange;\n\n return onColumnsOrderChange ? (\n <SortableCellWrapper\n key={`cell_wrapper_${column.key}`}\n columnKey={column.key}\n width={column.width}\n isDragging={isDragging}\n isDraggable={isDraggable}\n frozen={column.frozen}\n >\n <VirtualTableCell\n dataKey={column.key}\n // @ts-expect-error -- React.memo<VirtualTableProps<any>> erases the generic T, so cellRenderer's parameter type widens to `any` losing structural compatibility with VirtualTableCell<T>. The types are structurally correct at runtime.\n cellRenderer={cellRenderer}\n column={column}\n columns={columns}\n rowData={rowData}\n cellData={cellData}\n rowIndex={index}\n columnIndex={columnIndex}\n extraData={extraData}/>\n </SortableCellWrapper>\n ) : (\n <div\n key={`cell_wrapper_${column.key}`}\n className={cls(\n \"flex-shrink-0 relative\",\n column.frozen && \"sticky left-0 z-10 bg-surface-card\"\n )}\n style={{\n minWidth: column.width,\n maxWidth: column.width,\n width: column.width\n }}\n >\n <VirtualTableCell\n dataKey={column.key}\n // @ts-expect-error -- React.memo<VirtualTableProps<any>> erases the generic T, so cellRenderer's parameter type widens to `any` losing structural compatibility with VirtualTableCell<T>. The types are structurally correct at runtime.\n cellRenderer={cellRenderer}\n column={column}\n columns={columns}\n rowData={rowData}\n cellData={cellData}\n rowIndex={index}\n columnIndex={columnIndex}\n extraData={extraData}/>\n </div>\n );\n })}\n\n {includeAddColumn && <div className={\"w-20\"}/>}\n\n </VirtualTableRow>\n );\n }}\n </VirtualListContext.Consumer>;\n }, []);\n\n return <List\n outerRef={outerRef}\n innerElementType={innerElementType}\n width={width}\n height={height}\n overscanCount={4}\n itemCount={itemCount}\n onScroll={onScroll}\n itemSize={itemSize}>\n {Row}\n </List>;\n}\n\nconst SafeLinkRenderer: React.FC<{\n text: string;\n}> = ({ text }) => {\n const urlRegex = /https?:\\/\\/[^\\s]+/g;\n const urls = text.match(urlRegex) || [];\n const parts = text.split(urlRegex);\n\n return (\n <div className={\"break-all\"}>\n {parts.map((part, i) => (\n <React.Fragment key={i}>\n {part}\n {urls[i] && (\n <>\n <a href={urls[i]} className=\"underline\" target=\"_blank\" rel=\"noopener noreferrer\">Link</a>\n <br/>\n </>\n )}\n </React.Fragment>\n ))}\n </div>\n );\n};\n","import { useSyncExternalStore, useCallback, useRef } from \"react\";\n\nexport interface SelectedCell {\n columnKey: string;\n id: string | number;\n cellRect?: DOMRect;\n width?: number;\n height?: number;\n}\n\nexport function createVirtualTableSelectionStore<T extends SelectedCell = SelectedCell>() {\n let selectedCell: T | undefined = undefined;\n const listeners = new Set<() => void>();\n\n function getEntity(): T | undefined {\n return selectedCell;\n }\n\n function subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }\n\n function select(cell: T | undefined) {\n selectedCell = cell;\n listeners.forEach(l => l());\n }\n\n return {\n getEntity,\n subscribe,\n select\n };\n}\n\nexport type VirtualTableSelectionStore<T extends SelectedCell = SelectedCell> = ReturnType<typeof createVirtualTableSelectionStore<T>>;\n\nexport function useVirtualTableCellSelected<T extends SelectedCell = SelectedCell>(\n store: VirtualTableSelectionStore<T>,\n columnKey: string,\n id: string | number\n): boolean {\n const selectorRef = useRef({ columnKey, id });\n selectorRef.current = { columnKey, id };\n\n const getEntity = useCallback(() => {\n const cell = store.getEntity();\n if (!cell) return false;\n const s = selectorRef.current;\n return cell.columnKey === s.columnKey && cell.id === s.id;\n }, [store]);\n\n return useSyncExternalStore(store.subscribe, getEntity, getEntity);\n}\n","import React, { createContext, useContext } from \"react\";\nimport { VirtualTableSelectionStore, SelectedCell } from \"./SelectionStore\";\n\nexport interface VirtualTableSelectionContextProps<T extends SelectedCell = SelectedCell> {\n selectionStore: VirtualTableSelectionStore<T>;\n select: (cell: T | undefined) => void;\n}\n\nconst SelectionContext = createContext<VirtualTableSelectionContextProps<any> | null>(null);\n\nexport const VirtualTableSelectionProvider = <T extends SelectedCell = SelectedCell>({\n store,\n children\n}: {\n store: VirtualTableSelectionStore<T>;\n children: React.ReactNode;\n}) => {\n const value = React.useMemo(() => ({\n selectionStore: store,\n select: store.select\n }), [store]);\n\n return (\n <SelectionContext.Provider value={value}>\n {children}\n </SelectionContext.Provider>\n );\n};\n\nexport const useVirtualTableSelection = <T extends SelectedCell = SelectedCell>() => {\n const context = useContext(SelectionContext);\n if (!context) {\n throw new Error(\"useVirtualTableSelection must be used within a VirtualTableSelectionProvider\");\n }\n return context as VirtualTableSelectionContextProps<T>;\n};\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { TextareaAutosize } from \"../../TextareaAutosize\";\n\nexport function VirtualTableInput(props: {\n error?: Error;\n value: string;\n multiline?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (string | null)) => void;\n onBlur?: () => void;\n}) {\n const ref = React.useRef<HTMLTextAreaElement>(null);\n const { disabled, value, multiline = false, updateValue, focused } = props;\n const prevValue = useRef<string | null>(value);\n const [internalValue, setInternalValue] = useState<typeof value>(value);\n const focusedState = useRef<boolean>(false);\n\n useEffect(() => {\n if (prevValue.current !== value && value !== internalValue)\n setInternalValue(value);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n const emptyInitialValue = !value;\n if (emptyInitialValue && !internalValue) return;\n if (internalValue !== value && internalValue !== prevValue.current) {\n prevValue.current = internalValue;\n updateValue(internalValue);\n }\n }, [internalValue, updateValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (ref.current && focused && !focusedState.current) {\n focusedState.current = true;\n ref.current.focus({ preventScroll: true });\n ref.current.selectionStart = ref.current.value.length;\n ref.current.selectionEnd = ref.current.value.length;\n } else {\n focusedState.current = focused;\n }\n }, [focused, ref]);\n\n return (\n <TextareaAutosize\n className={focusedDisabled}\n ref={ref}\n // Destructured above and passed to nothing, so a property carrying\n // `admin: { disabled: true }` stayed typeable in the table and the\n // debounced write fired on blur. `readOnly` as well as `disabled`:\n // a disabled textarea is skipped by keyboard navigation, and a cell\n // you cannot tab through is worse than one you cannot edit.\n disabled={disabled}\n readOnly={disabled}\n style={{\n padding: 0,\n margin: 0,\n width: \"100%\",\n color: \"unset\",\n fontWeight: \"unset\",\n fontSize: \"unset\",\n fontFamily: \"unset\",\n background: \"unset\",\n border: \"unset\",\n resize: \"none\",\n outline: \"none\"\n }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value as string;\n if (multiline || !newValue.endsWith(\"\\n\"))\n setInternalValue(newValue);\n }}\n onFocus={() => {\n focusedState.current = true;\n }}\n onBlur={() => {\n focusedState.current = false;\n doUpdate();\n if (props.onBlur) props.onBlur();\n }}\n />\n );\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { useDebouncedCallback } from \"../../../hooks/useDebouncedCallback\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { TextField } from \"../../TextField\";\n\nexport function VirtualTableNumberInput(props: {\n error?: Error;\n value: number;\n align?: \"right\" | \"left\" | \"center\";\n updateValue: (newValue: (number | null)) => void;\n focused: boolean;\n disabled: boolean;\n}) {\n const { align = \"left\", value, updateValue, focused } = props;\n const propStringValue = (value && typeof value === \"number\") ? value.toString() : \"\";\n const [internalValue, setInternalValue] = useState<string | null>(propStringValue);\n const prevValue = useRef<number | null>(value);\n\n useEffect(() => {\n if (prevValue.current !== value && String(value) !== internalValue)\n setInternalValue(value ? value.toString() : null);\n prevValue.current = value;\n }, [value]);\n\n const doUpdate = React.useCallback(() => {\n if (internalValue !== propStringValue) {\n if (internalValue !== undefined && internalValue !== null) {\n const numberValue = parseFloat(internalValue);\n if (isNaN(numberValue)) return;\n updateValue(numberValue);\n } else {\n updateValue(null);\n }\n }\n }, [internalValue, value]);\n\n useDebouncedCallback(internalValue, doUpdate, !focused, 400);\n\n useEffect(() => {\n if (!focused && propStringValue !== internalValue)\n setInternalValue(value !== undefined && value !== null ? value.toString() : null);\n }, [value, focused]);\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (inputRef.current && focused) {\n inputRef.current.focus({ preventScroll: true });\n }\n }, [focused, inputRef]);\n\n const regexp = /^-?[0-9]+[,.]?[0-9]*$/;\n\n return (\n <TextField\n inputRef={inputRef}\n invisible={true}\n size=\"small\"\n className=\"w-full\"\n inputClassName={cls(\"p-0 m-0 bg-transparent border-none outline-hidden font-normal leading-normal text-unset\", focusedDisabled)}\n inputStyle={{ textAlign: align }}\n value={internalValue ?? \"\"}\n onChange={(evt) => {\n const newValue = evt.target.value.replace(\",\", \".\");\n if (newValue.length === 0) setInternalValue(null);\n if (regexp.test(newValue) || newValue.startsWith(\"-\")) setInternalValue(newValue);\n }}\n />\n );\n}\n","import React, { useEffect } from \"react\";\nimport { BooleanSwitch } from \"../../BooleanSwitch\";\n\nexport function VirtualTableSwitch(props: {\n error?: Error;\n internalValue?: boolean;\n focused: boolean;\n disabled: boolean;\n updateValue: (newValue: (boolean | null)) => void;\n}) {\n const { internalValue, updateValue, focused } = props;\n const ref = React.useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n return (\n <BooleanSwitch\n ref={ref}\n size={\"small\"}\n value={Boolean(internalValue)}\n onValueChange={updateValue}\n />\n );\n}\n","import React from \"react\";\nimport { cls } from \"../../../util\";\nimport { focusedDisabled } from \"../../../styles\";\nimport { DateTimeField } from \"../../DateTimeField\";\n\nexport function VirtualTableDateField(props: {\n name?: string;\n error?: Error;\n mode?: \"date\" | \"date_time\";\n timezone?: string;\n internalValue: Date | undefined | null;\n updateValue: (newValue: (Date | null)) => void;\n focused: boolean;\n disabled: boolean;\n small?: boolean;\n locale?: string;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { name, disabled, error, mode, timezone, internalValue, updateValue, small = false, locale } = props;\n\n return (\n <DateTimeField\n value={internalValue ?? undefined}\n onChange={(dateValue) => updateValue(dateValue ?? null)}\n // Same omission as `VirtualTableInput`: destructured and forwarded\n // nowhere, so a disabled date cell was still editable. `error` went\n // the same way — it drives `DateTimeField`'s invalid styling, and a\n // prop a caller passes should reach something rather than sit in a\n // destructure.\n disabled={disabled}\n error={Boolean(error)}\n // Third prop this component declared and dropped. A table cell\n // draws no visible label — the column header is the only thing\n // naming it, and a header is not an accessible name for the input\n // underneath — so without this every date cell reads as an unnamed\n // \"date entry\" to a screen reader, one per row per date column.\n aria-label={name}\n invisible={true}\n // Without this the field falls back to DateTimeField's own default of\n // `size=\"large\"` (min-h-64px), which overflows a table cell and makes\n // the value collide with the cell border.\n size={small ? \"small\" : \"medium\"}\n inputClassName={cls(\"w-full h-full\", focusedDisabled)}\n className={cls(\"w-full h-full\", focusedDisabled)}\n mode={mode}\n timezone={timezone}\n locale={locale}\n />\n );\n}\n","import React, { useCallback, useEffect, useRef } from \"react\";\nimport { Select, SelectItem } from \"../../Select\";\nimport { MultiSelect, MultiSelectItem } from \"../../MultiSelect\";\nimport { Chip } from \"../../Chip\";\n\nexport interface VirtualTableSelectOption {\n value: string | number;\n label: string;\n color?: string;\n}\n\nexport function VirtualTableSelect(props: {\n options: VirtualTableSelectOption[];\n error?: Error;\n multiple?: boolean;\n disabled: boolean;\n small?: boolean;\n value: string | number | string[] | number[] | undefined;\n updateValue: (newValue: (string | number | string[] | number[] | null)) => void;\n focused: boolean;\n onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n}) {\n const { options, value, disabled, small = false, focused, updateValue, multiple = false } = props;\n const validValue = (Array.isArray(value) && multiple) || (!Array.isArray(value) && !multiple);\n const ref = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (ref.current && focused) {\n ref.current?.focus({ preventScroll: true });\n }\n }, [focused, ref]);\n\n const onChange = useCallback((updatedValue: string | string[]) => {\n if (multiple) {\n const isNumber = options.some(o => typeof o.value === \"number\");\n const newValue = (updatedValue as string[]).map((v) => {\n const opt = options.find(o => String(o.value) === v);\n return typeof opt?.value === \"number\" ? parseFloat(v) : v;\n });\n if (isNumber) {\n updateValue(newValue as number[]);\n } else {\n updateValue(newValue as string[]);\n }\n } else {\n const opt = options.find(o => String(o.value) === updatedValue);\n updateValue(typeof opt?.value === \"number\" ? parseFloat(updatedValue as string) : (updatedValue as string || null));\n }\n }, [multiple, updateValue, options]);\n\n const renderValue = (val?: string | number) => {\n const option = options.find(o => o.value === val);\n return (\n <Chip size={small ? \"small\" : \"medium\"}>\n {option ? option.label : String(val)}\n </Chip>\n );\n };\n\n const handleOpenChange = useCallback((open: boolean) => {\n if (!open && ref.current) {\n setTimeout(() => {\n ref.current?.focus({ preventScroll: true });\n }, 0);\n }\n }, []);\n\n return multiple ? (\n <MultiSelect\n inputRef={ref}\n className=\"w-full h-full p-0 bg-transparent outline-none\"\n position={\"item-aligned\"}\n disabled={disabled}\n includeClear={false}\n useChips={false}\n value={validValue ? (value as (string | number)[]).map(v => String(v)) : []}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n >\n {options.map((opt) => (\n <MultiSelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </MultiSelectItem>\n ))}\n </MultiSelect>\n ) : (\n <Select\n inputRef={ref}\n fullWidth\n className=\"w-full h-full p-0 bg-transparent outline-none [&_button]:ring-0 [&_button]:ring-offset-0\"\n inputClassName=\"ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-offset-0\"\n position={\"item-aligned\"}\n disabled={disabled}\n padding={false}\n value={validValue ? String(value) : \"\"}\n onValueChange={onChange}\n onOpenChange={handleOpenChange}\n renderValue={renderValue}\n >\n {options.map((opt) => (\n <SelectItem key={String(opt.value)} value={String(opt.value)}>\n <Chip size={small ? \"small\" : \"medium\"}>{opt.label}</Chip>\n </SelectItem>\n ))}\n </Select>\n );\n}\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n CircularProgress,\n Typography\n} from \"../components\";\nimport { cls } from \"../util\";\n\nexport type CollectionSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nexport type ListViewColumnDef<T> = {\n key: string;\n label: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string;\n renderCell: (item: T) => React.ReactNode;\n isTitle?: boolean;\n};\n\nexport type ListViewProps<T> = {\n data: T[];\n dataLoading?: boolean;\n noMoreToLoad?: boolean;\n dataLoadingError?: Error;\n itemCount?: number;\n setItemCount?: (itemCount: number) => void;\n pageSize?: number;\n paginationEnabled?: boolean;\n\n onItemClick?: (item: T) => void;\n selectedIds?: Set<string | number>;\n highlightedIds?: Set<string | number>;\n selectionEnabled?: boolean;\n onSelectionChange?: (item: T, selected: boolean) => void;\n emptyComponent?: React.ReactNode;\n\n size?: CollectionSize;\n selectedEntityId?: string | number;\n\n /**\n * Rendered above the rows, inside the list's own frame, and only when there\n * are rows to head. A column header over an empty state or a spinner labels\n * nothing.\n */\n header?: React.ReactNode;\n\n renderRow: (params: {\n item: T;\n index: number;\n style: React.CSSProperties;\n className: string;\n selected: boolean;\n highlighted: boolean;\n isLast: boolean;\n onClick: (e: React.MouseEvent) => void;\n onSelectionChange: (selected: boolean) => void;\n }) => React.ReactNode;\n};\n\nfunction getEstimatedRowHeight(size: CollectionSize): number {\n switch (size) {\n case \"xs\": return 44;\n case \"s\": return 52;\n case \"m\": return 64;\n case \"l\": return 76;\n case \"xl\": return 88;\n default: return 64;\n }\n}\n\nconst OVERSCAN_COUNT = 8;\nconst LOAD_MORE_THRESHOLD = 400;\n\nfunction getScrollParent(element: HTMLElement | null): HTMLElement | null {\n let parent = element?.parentElement ?? null;\n while (parent) {\n const style = getComputedStyle(parent);\n if (\n style.overflowY === \"auto\" || style.overflowY === \"scroll\" ||\n style.overflow === \"auto\" || style.overflow === \"scroll\"\n ) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return document.documentElement;\n}\n\nexport function ListView<T>({\n data,\n dataLoading = false,\n noMoreToLoad = false,\n dataLoadingError,\n itemCount,\n setItemCount,\n pageSize = 50,\n paginationEnabled = true,\n\n onItemClick,\n selectedIds,\n highlightedIds,\n selectionEnabled = true,\n onSelectionChange,\n emptyComponent,\n\n size = \"m\",\n selectedEntityId,\n header,\n renderRow\n}: ListViewProps<T>) {\n const containerRef = useRef<HTMLDivElement>(null);\n // The rows' own box, which a header shifts down from the container's top.\n // Virtualization measures against it rather than against the container, so\n // the window of rendered rows stays the one the viewport is actually over.\n const rowsRef = useRef<HTMLDivElement>(null);\n const isLoadingMore = useRef(false);\n\n // Reset loading gate when loading stops\n useEffect(() => {\n if (!dataLoading) isLoadingMore.current = false;\n }, [dataLoading]);\n\n // Virtualization scroll states\n const estimatedRowHeight = getEstimatedRowHeight(size);\n const [effectiveScrollTop, setEffectiveScrollTop] = useState(0);\n const [viewportHeight, setViewportHeight] = useState(800);\n\n const paginationStateRef = useRef({ paginationEnabled, noMoreToLoad, itemCount, pageSize });\n useEffect(() => {\n paginationStateRef.current = { paginationEnabled, noMoreToLoad, itemCount, pageSize };\n }, [paginationEnabled, noMoreToLoad, itemCount, pageSize]);\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n let rafId: number | null = null;\n\n const update = () => {\n rafId = null;\n const scrollRect = scrollEl.getBoundingClientRect();\n const listRect = (rowsRef.current ?? el).getBoundingClientRect();\n\n const listTopRelative = listRect.top - scrollRect.top;\n setEffectiveScrollTop(Math.max(0, -listTopRelative));\n setViewportHeight(scrollRect.height);\n\n const { paginationEnabled: pe, noMoreToLoad: nm, itemCount: ic, pageSize: ps } = paginationStateRef.current;\n if (\n pe &&\n !nm &&\n !isLoadingMore.current &&\n scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight < LOAD_MORE_THRESHOLD\n ) {\n isLoadingMore.current = true;\n setItemCount?.((ic ?? ps) + ps);\n }\n };\n\n const onScroll = () => {\n if (rafId === null) rafId = requestAnimationFrame(update);\n };\n\n scrollEl.addEventListener(\"scroll\", onScroll, { passive: true });\n const ro = new ResizeObserver(() => update());\n ro.observe(scrollEl);\n update();\n\n return () => {\n scrollEl.removeEventListener(\"scroll\", onScroll);\n ro.disconnect();\n if (rafId !== null) cancelAnimationFrame(rafId);\n };\n }, [setItemCount]);\n\n const totalHeight = data.length * estimatedRowHeight;\n const startIndex = Math.max(0, Math.floor(effectiveScrollTop / estimatedRowHeight) - OVERSCAN_COUNT);\n const endIndex = Math.min(\n data.length,\n Math.ceil((effectiveScrollTop + viewportHeight) / estimatedRowHeight) + OVERSCAN_COUNT\n );\n const visibleData = data.slice(startIndex, endIndex);\n const offsetY = startIndex * estimatedRowHeight;\n\n const footerHeight = dataLoading ? 48 : (!dataLoading && noMoreToLoad && data.length > 0) ? 32 : 0;\n\n const isInitialLoading = dataLoading && data.length === 0;\n const isEmpty = !dataLoading && data.length === 0 && !dataLoadingError;\n\n const getItemId = useCallback((item: T): string | number => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const id = (item as Record<\"id\", unknown>).id;\n return typeof id === \"number\" ? id : String(id);\n }\n return String(item);\n }, []);\n\n const borderMixinClass = \"border-hairline\";\n\n return (\n <div\n ref={containerRef}\n className={cls(\n \"w-full\",\n selectedEntityId === undefined && `rounded-lg overflow-hidden border ${borderMixinClass}`\n )}\n >\n {dataLoadingError && data.length === 0 ? (\n <div className=\"flex items-center justify-center p-8\">\n <Typography className=\"text-red-500\">\n Error loading data: {dataLoadingError.message}\n </Typography>\n </div>\n ) : isInitialLoading ? (\n <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\" />\n </div>\n ) : isEmpty ? (\n <div className=\"w-full flex items-center justify-center py-12 px-8\">\n {emptyComponent ?? (\n <Typography variant=\"label\" color=\"secondary\">\n No entries found\n </Typography>\n )}\n </div>\n ) : (\n <>\n {header}\n {/* `my-1.5`, not padding: the rows are absolutely positioned\n inside this box, and `top: 0` lands on the padding edge,\n so padding would not move them. A margin does, and it is\n what keeps the first row's rounded highlight from sitting\n on the header's rule (and the last from touching the\n bottom edge). */}\n <div ref={rowsRef} className=\"my-1.5\" style={{ height: totalHeight + footerHeight, position: \"relative\" }}>\n <div style={{ position: \"absolute\", top: offsetY, left: 0, right: 0 }}>\n {visibleData.map((item, i) => {\n const actualIndex = startIndex + i;\n const isLast = actualIndex === data.length - 1;\n const id = getItemId(item);\n const selected = selectedIds?.has(id) ?? false;\n const highlighted = highlightedIds?.has(id) ?? false;\n\n const handleClick = (e: React.MouseEvent) => {\n if ((e.metaKey || e.ctrlKey) && selectionEnabled) {\n e.preventDefault();\n onSelectionChange?.(item, !selected);\n return;\n }\n onItemClick?.(item);\n };\n\n const handleSelectionChange = (val: boolean) => {\n onSelectionChange?.(item, val);\n };\n\n return (\n <React.Fragment key={id || actualIndex}>\n {renderRow({\n item,\n index: actualIndex,\n style: { height: estimatedRowHeight, overflow: \"hidden\" },\n // No divider between rows. Rows are inset, rounded\n // highlights now (see the CMS list binding), and a\n // hairline under each one turned every highlight into\n // a pill floating on a ruled page. `py-0.5` inside the\n // fixed-height slot gives two adjacent highlights 4px\n // of air instead of a shared edge.\n className: \"py-0.5\",\n selected,\n highlighted,\n isLast,\n onClick: handleClick,\n onSelectionChange: handleSelectionChange\n })}\n </React.Fragment>\n );\n })}\n </div>\n\n {dataLoading && (\n <div\n className=\"flex items-center justify-center py-3\"\n style={{ position: \"absolute\", top: totalHeight, left: 0, right: 0 }}\n >\n <CircularProgress size=\"small\" />\n </div>\n )}\n {!dataLoading && noMoreToLoad && data.length > 0 && (\n <div\n className=\"flex items-center justify-center py-2\"\n style={{ position: \"absolute\", top: totalHeight, left: 0, right: 0 }}\n >\n <Typography variant=\"caption\" color=\"secondary\">\n All {data.length} entries loaded\n </Typography>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n );\n}\n","import React, { useCallback, useEffect, useRef } from \"react\";\nimport {\n CircularProgress,\n Typography\n} from \"../components\";\nimport { cls } from \"../util\";\n\nimport { CollectionSize } from \"./ListView\";\n\nexport type CardViewProps<T> = {\n data: T[];\n dataLoading?: boolean;\n noMoreToLoad?: boolean;\n dataLoadingError?: Error;\n itemCount?: number;\n setItemCount?: (itemCount: number) => void;\n pageSize?: number;\n paginationEnabled?: boolean;\n\n onItemClick?: (item: T) => void;\n selectedIds?: Set<string | number>;\n highlightedIds?: Set<string | number>;\n selectionEnabled?: boolean;\n onSelectionChange?: (item: T, selected: boolean) => void;\n\n onScroll?: (props: {\n scrollDirection: \"forward\" | \"backward\";\n scrollOffset: number;\n scrollUpdateWasRequested: boolean;\n }) => void;\n initialScroll?: number;\n\n size?: CollectionSize;\n renderCard: (\n item: T,\n extra: {\n selected: boolean;\n highlighted: boolean;\n onSelectionChange: (selected: boolean) => void;\n /**\n * Absent on a keyboard activation — a card is a `role=\"button\"` and\n * Enter/Space reach this with no event. Only the modifier branch\n * needs one; the click itself does not.\n */\n onClick: (e?: React.MouseEvent) => void;\n }\n ) => React.ReactNode;\n emptyComponent?: React.ReactNode;\n};\n\nfunction getGridColumnsClass(size: CollectionSize): string {\n switch (size) {\n case \"xs\":\n return \"grid-cols-4 sm:grid-cols-5 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10\";\n case \"s\":\n return \"grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8\";\n case \"m\":\n return \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6\";\n case \"l\":\n return \"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-4\";\n case \"xl\":\n return \"grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3\";\n default:\n return \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6\";\n }\n}\n\nfunction getScrollParent(element: HTMLElement | null): HTMLElement | null {\n if (!element) return null;\n let parent = element.parentElement;\n while (parent) {\n const overflowY = window.getComputedStyle(parent).overflowY;\n if (overflowY === \"auto\" || overflowY === \"scroll\") {\n return parent;\n }\n parent = parent.parentElement;\n }\n return document.documentElement;\n}\n\nexport function CardView<T>({\n data,\n dataLoading = false,\n noMoreToLoad = false,\n dataLoadingError,\n itemCount,\n setItemCount,\n pageSize = 50,\n paginationEnabled = true,\n\n onItemClick,\n selectedIds,\n highlightedIds,\n selectionEnabled = true,\n onSelectionChange,\n\n onScroll,\n initialScroll,\n size = \"m\",\n renderCard,\n emptyComponent\n}: CardViewProps<T>) {\n const containerRef = useRef<HTMLDivElement>(null);\n const hasRestoredScroll = useRef(false);\n const isLoadingMore = useRef(false);\n\n // Sync mutable ref with pagination settings to avoid resetting listeners\n const paginationStateRef = useRef({ paginationEnabled, noMoreToLoad, itemCount, pageSize });\n useEffect(() => {\n paginationStateRef.current = { paginationEnabled, noMoreToLoad, itemCount, pageSize };\n }, [paginationEnabled, noMoreToLoad, itemCount, pageSize]);\n\n useEffect(() => {\n if (!dataLoading) isLoadingMore.current = false;\n }, [dataLoading]);\n\n // Infinite scroll and resize observer\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n let rafId: number | null = null;\n\n const update = () => {\n rafId = null;\n const { paginationEnabled: pe, noMoreToLoad: nm, itemCount: ic, pageSize: ps } = paginationStateRef.current;\n if (\n pe &&\n !nm &&\n !isLoadingMore.current &&\n scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight < 400\n ) {\n isLoadingMore.current = true;\n setItemCount?.((ic ?? ps) + ps);\n }\n };\n\n const onScrollEvent = () => {\n if (rafId === null) rafId = requestAnimationFrame(update);\n };\n\n scrollEl.addEventListener(\"scroll\", onScrollEvent, { passive: true });\n const ro = new ResizeObserver(() => update());\n ro.observe(scrollEl);\n update();\n\n return () => {\n scrollEl.removeEventListener(\"scroll\", onScrollEvent);\n ro.disconnect();\n if (rafId !== null) cancelAnimationFrame(rafId);\n };\n }, [setItemCount]);\n\n // Scroll restoration\n useEffect(() => {\n if (!containerRef.current || !initialScroll || hasRestoredScroll.current || data.length === 0) return;\n\n const scrollEl = getScrollParent(containerRef.current);\n if (!scrollEl) return;\n\n let attempts = 0;\n const maxAttempts = 5;\n\n const tryRestore = () => {\n if (scrollEl.scrollHeight >= initialScroll || attempts >= maxAttempts) {\n scrollEl.scrollTop = initialScroll;\n hasRestoredScroll.current = true;\n } else {\n attempts++;\n requestAnimationFrame(tryRestore);\n }\n };\n\n requestAnimationFrame(tryRestore);\n }, [initialScroll, data.length]);\n\n // Scroll tracking: call onScroll callback\n const lastScrollOffset = useRef(0);\n useEffect(() => {\n const el = containerRef.current;\n if (!el || !onScroll) return;\n const scrollEl = getScrollParent(el);\n if (!scrollEl) return;\n\n const handleScroll = () => {\n const currentOffset = scrollEl.scrollTop;\n const direction = currentOffset > lastScrollOffset.current ? \"forward\" : \"backward\";\n lastScrollOffset.current = currentOffset;\n onScroll({\n scrollDirection: direction,\n scrollOffset: currentOffset,\n scrollUpdateWasRequested: false\n });\n };\n\n scrollEl.addEventListener(\"scroll\", handleScroll, { passive: true });\n return () => scrollEl.removeEventListener(\"scroll\", handleScroll);\n }, [onScroll]);\n\n const getItemId = useCallback((item: T): string | number => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const id = (item as Record<\"id\", unknown>).id;\n return typeof id === \"number\" ? id : String(id);\n }\n return String(item);\n }, []);\n\n const gridColumnsClass = getGridColumnsClass(size);\n\n const isInitialLoading = dataLoading && data.length === 0 && !dataLoadingError;\n const isEmpty = !dataLoading && data.length === 0 && !dataLoadingError;\n\n return (\n <div\n ref={containerRef}\n className=\"w-full p-4\"\n >\n {dataLoadingError && data.length === 0 ? (\n <div className=\"h-full flex items-center justify-center p-8\">\n <Typography className=\"text-red-500\">\n Error loading data: {dataLoadingError.message}\n </Typography>\n </div>\n ) : isInitialLoading ? (\n <div className=\"flex items-center justify-center py-12 px-8\">\n <CircularProgress size=\"small\"/>\n </div>\n ) : isEmpty ? (\n <div className=\"w-full flex items-center justify-center py-12 px-8\">\n {emptyComponent ?? (\n <Typography variant=\"label\" color=\"secondary\">\n No entries found\n </Typography>\n )}\n </div>\n ) : (\n <div className=\"max-w-7xl mx-auto\">\n <div className={cls(\"grid gap-4\", gridColumnsClass)}>\n {data.map((item, index) => {\n const id = getItemId(item);\n const selected = selectedIds?.has(id) ?? false;\n const highlighted = highlightedIds?.has(id) ?? false;\n\n const handleClick = (e?: React.MouseEvent) => {\n if (e && (e.metaKey || e.ctrlKey) && selectionEnabled) {\n e.preventDefault();\n onSelectionChange?.(item, !selected);\n return;\n }\n onItemClick?.(item);\n };\n\n const handleSelectionChange = (val: boolean) => {\n onSelectionChange?.(item, val);\n };\n\n return (\n <React.Fragment key={id || index}>\n {renderCard(item, {\n selected,\n highlighted,\n onSelectionChange: handleSelectionChange,\n onClick: handleClick\n })}\n </React.Fragment>\n );\n })}\n </div>\n\n <div className=\"flex items-center justify-center py-8\">\n {dataLoading && (\n <CircularProgress size=\"small\"/>\n )}\n {!dataLoading && noMoreToLoad && data.length > 0 && (\n <Typography variant=\"caption\" color=\"secondary\">\n All {data.length} entries loaded\n </Typography>\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import React, { memo, useEffect, useMemo, useRef } from \"react\";\nimport { useDroppable } from \"@dnd-kit/core\";\nimport { useSortable, SortableContext, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { CircularProgress } from \"../../components\";\nimport { cls } from \"../../util\";\nimport { BoardItem, BoardItemViewProps } from \"./board_types\";\n\ninterface BoardSortableListProps<T> {\n columnId: string;\n items: BoardItem<T>[];\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n isDragging: boolean;\n isDragOverColumn: boolean;\n loading?: boolean;\n hasMore?: boolean;\n error?: Error;\n onLoadMore?: () => void;\n}\n\nexport function BoardSortableList<T>({\n columnId,\n items,\n ItemComponent,\n isDragging,\n isDragOverColumn,\n loading = false,\n hasMore = false,\n error,\n onLoadMore\n}: BoardSortableListProps<T>) {\n const {\n setNodeRef\n } = useDroppable({\n id: columnId,\n data: { type: \"ITEM-LIST\" }\n });\n\n const sentinelRef = useRef<HTMLDivElement>(null);\n const isLoadingRef = useRef(loading);\n isLoadingRef.current = loading;\n const lastLoadTimeRef = useRef(0);\n\n useEffect(() => {\n if (!sentinelRef.current || !hasMore || !onLoadMore) return;\n\n const sentinel = sentinelRef.current;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const now = Date.now();\n if (\n entries[0].isIntersecting &&\n hasMore &&\n !isLoadingRef.current &&\n now - lastLoadTimeRef.current > 500\n ) {\n lastLoadTimeRef.current = now;\n onLoadMore();\n }\n },\n { threshold: 0.1 }\n );\n\n observer.observe(sentinel);\n\n const rect = sentinel.getBoundingClientRect();\n const containerRect = sentinel.parentElement?.getBoundingClientRect();\n if (containerRect && rect.top < containerRect.bottom && rect.bottom > containerRect.top) {\n const now = Date.now();\n if (hasMore && !isLoadingRef.current && now - lastLoadTimeRef.current > 500) {\n lastLoadTimeRef.current = now;\n onLoadMore();\n }\n }\n\n return () => observer.disconnect();\n }, [hasMore, onLoadMore]);\n\n const containerClassName = useMemo(() => cls(\n // The scrollbar stays: this is the only thing on the page that scrolls\n // vertically, and hiding it left a column of cards with no sign that\n // there were more below the fold.\n \"flex flex-col p-2 transition-opacity duration-100 transition-bg ease-linear w-full overflow-y-auto flex-1 min-h-0 rounded-md\",\n isDragging && isDragOverColumn\n ? \"bg-surface-active\"\n : isDragging\n ? \"bg-surface-field hover:bg-surface-hover\"\n : \"bg-surface-field\"\n ), [isDragging, isDragOverColumn]);\n\n return (\n <div\n ref={setNodeRef}\n className={containerClassName}\n style={{ minHeight: 80 }}\n >\n <SortableContext\n items={items.map(i => i.id)}\n strategy={verticalListSortingStrategy}\n >\n {items.length === 0 && !loading ? (\n <div className=\"flex-1 flex items-center justify-center px-3 text-center\">\n {/* \"No items\" over a header counting eleven of them is\n the wrong thing to say when the read failed. */}\n <span className={cls(\n \"text-xs\",\n error\n ? \"text-red-600 dark:text-red-400\"\n : \"text-surface-400 dark:text-surface-500\"\n )}>\n {error ? \"Could not load this column\" : \"No items\"}\n </span>\n </div>\n ) : (\n <>\n {items.map((item, index) => (\n <SortableItem\n key={item.id}\n item={item}\n index={index}\n columnId={columnId}\n ItemComponent={ItemComponent}\n />\n ))}\n {(loading || hasMore) && (\n <div ref={sentinelRef} className=\"flex items-center justify-center py-2 min-h-6\">\n {loading && <CircularProgress size=\"smallest\"/>}\n </div>\n )}\n </>\n )}\n </SortableContext>\n </div>\n );\n}\n\ninterface SortableItemProps<T> {\n item: BoardItem<T>;\n index: number;\n columnId: string;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n}\n\nconst SortableItem = memo(function SortableItem<T>({\n item,\n index,\n columnId,\n ItemComponent\n}: SortableItemProps<T>) {\n const {\n setNodeRef,\n attributes,\n listeners,\n isDragging: isItemBeingDragged,\n transform,\n transition\n } = useSortable({\n id: item.id,\n data: {\n type: \"ITEM\",\n columnId\n }\n });\n\n const sortableStyle = useMemo(() => ({\n transform: CSS.Transform.toString(transform),\n transition,\n zIndex: isItemBeingDragged ? 2 : 1,\n opacity: isItemBeingDragged ? 0 : 1\n }), [transform, transition, isItemBeingDragged]);\n\n return (\n <div ref={setNodeRef} style={sortableStyle} {...attributes} {...listeners}>\n <ItemComponent\n item={item}\n isDragging={isItemBeingDragged}\n index={index}\n />\n </div>\n );\n}) as <T>(props: SortableItemProps<T>) => React.ReactElement;\n","import React, { useMemo } from \"react\";\nimport { Typography } from \"../../components\";\nimport { cls, getColorSchemeForKey } from \"../../util\";\n\nexport interface BoardColumnTitleProps {\n children: React.ReactNode;\n className?: string;\n \"aria-label\"?: string;\n color?: any;\n}\n\nexport function BoardColumnTitle({\n children,\n className,\n color,\n ...props\n}: BoardColumnTitleProps) {\n const colorScheme = useMemo(() => {\n if (!color) return undefined;\n if (typeof color === \"string\") {\n return getColorSchemeForKey(color);\n }\n return color;\n }, [color]);\n\n return (\n <Typography\n variant=\"subtitle2\"\n component=\"h4\"\n className={\n cls(\"py-3 px-3 transition-colors duration-200 flex-grow select-none relative outline-none focus:outline focus:outline-2 focus:outline-offset-2 flex items-center gap-3\",\n className)\n }\n {...props}\n >\n {colorScheme && (\n <div\n className=\"w-3 h-3 rounded-full flex-shrink-0\"\n style={{\n backgroundColor: colorScheme.darkColor ?? colorScheme.color\n }}\n />\n )}\n {children}\n </Typography>\n );\n}\n","import React, { memo, useMemo } from \"react\";\nimport { SortableContext, useSortable, verticalListSortingStrategy } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { BoardSortableList } from \"./BoardSortableList\";\nimport { BoardColumnTitle } from \"./BoardColumnTitle\";\nimport { BoardItem, BoardItemViewProps } from \"./board_types\";\nimport {\n IconButton\n} from \"../../components\";\nimport { cls } from \"../../util\";\nimport { iconSize, PlusIcon } from \"../../icons\";\n\nexport interface BoardColumnProps<T> {\n id: string;\n title: string;\n items: BoardItem<T>[];\n index: number;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n isDragging: boolean;\n isDragOverColumn: boolean;\n allowReorder?: boolean;\n loading?: boolean;\n hasMore?: boolean;\n error?: Error;\n onLoadMore?: () => void;\n onAddItem?: () => void;\n totalCount?: number;\n color?: any;\n style?: React.CSSProperties;\n}\n\nexport const BoardColumn = memo(function BoardColumn<T>({\n id,\n title,\n items,\n ItemComponent,\n isDragging,\n isDragOverColumn,\n allowReorder = false,\n loading = false,\n hasMore = false,\n error,\n onLoadMore,\n onAddItem,\n totalCount,\n color,\n style\n}: BoardColumnProps<T>) {\n const {\n setNodeRef,\n attributes,\n listeners,\n isDragging: isColumnBeingDragged,\n transform,\n transition\n } = useSortable({\n id,\n data: { type: \"COLUMN\" },\n disabled: !allowReorder\n });\n\n const combinedStyle = useMemo(() => ({\n ...style,\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isColumnBeingDragged ? 2 : 1\n }), [style, transform, transition, isColumnBeingDragged]);\n\n const dragListeners = allowReorder ? listeners : {};\n\n const columnClassName = useMemo(() => cls(\n \"border h-full w-80 min-w-80 mx-2 flex flex-col rounded-md border-hairline\",\n isColumnBeingDragged ? \"ring-2 ring-primary\" : \"\"\n ), [isColumnBeingDragged]);\n\n const headerClassName = useMemo(() => cls(\n \"flex items-center justify-between px-2 rounded-t-md transition-colors duration-200 ease-in-out\",\n isColumnBeingDragged\n ? \"bg-surface-active\"\n : \"bg-surface-field hover:bg-surface-field-hover\",\n allowReorder ? \"cursor-grab\" : \"\"\n ), [isColumnBeingDragged, allowReorder]);\n\n const itemIds = useMemo(() => items.map(i => i.id), [items]);\n\n return (\n <div\n ref={setNodeRef}\n style={combinedStyle}\n {...attributes}\n className={columnClassName}\n >\n <div\n {...dragListeners}\n className={headerClassName}\n >\n <div className=\"flex items-center gap-2\">\n <BoardColumnTitle aria-label={`${title} item list`} color={color}>\n {title}\n </BoardColumnTitle>\n {totalCount !== undefined && (\n <span className=\"text-xs text-surface-500 dark:text-surface-400\">\n {totalCount}\n </span>\n )}\n </div>\n {onAddItem && (\n <IconButton\n size=\"small\"\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n onAddItem();\n }}\n className=\"opacity-60 hover:opacity-100\"\n >\n <PlusIcon size={iconSize.small}/>\n </IconButton>\n )}\n </div>\n <SortableContext\n items={itemIds}\n strategy={verticalListSortingStrategy}\n >\n <BoardSortableList\n columnId={id}\n items={items}\n ItemComponent={ItemComponent}\n isDragging={isDragging}\n isDragOverColumn={isDragOverColumn}\n loading={loading}\n hasMore={hasMore}\n error={error}\n onLoadMore={onLoadMore}\n />\n </SortableContext>\n </div>\n );\n}) as <T>(props: BoardColumnProps<T>) => React.ReactElement;\n","import { arrayMove } from \"@dnd-kit/sortable\";\nimport { BoardItem } from \"./board_types\";\n\nexport interface PlaceDroppedCardParams<T> {\n /**\n * The destination column as it stands at the moment of the drop. When the\n * card came from another column it is normally already in here:\n * `handleDragOver` moves it while the pointer is still down, which is what\n * opens the gap under the cursor.\n */\n targetItems: BoardItem<T>[];\n /** The card being dropped. */\n movedItem: BoardItem<T>;\n /** What the pointer was over — a card id, or the column's own droppable id. */\n overId: string;\n /** Whether the card was picked up in a different column than it landed in. */\n changedColumn: boolean;\n}\n\n/**\n * Where a dropped card ends up in its destination column.\n *\n * Pulled out of the drop handler because it is the part that was wrong twice:\n * once appending a card that had been dropped into the middle of a column, and\n * once refusing to place a card at all when it was released over an empty\n * column rather than over another card. It is pure, so it can be checked\n * without driving a pointer.\n */\nexport function placeDroppedCard<T>({\n targetItems,\n movedItem,\n overId,\n changedColumn\n}: PlaceDroppedCardParams<T>): BoardItem<T>[] {\n\n const indexInTarget = targetItems.findIndex(i => i.id === movedItem.id);\n const overIndex = targetItems.findIndex(i => i.id === overId);\n\n // Not placed during the drag — drop straight into the slot. `-1` means the\n // pointer was over the column itself (an empty one, or the space below the\n // last card), which appends.\n if (indexInTarget === -1) {\n const placed = [...targetItems];\n placed.splice(overIndex === -1 ? targetItems.length : overIndex, 0, movedItem);\n return placed;\n }\n\n // Released over another card: that card's slot is the one the user chose.\n if (overIndex !== -1) {\n return arrayMove(targetItems, indexInTarget, overIndex);\n }\n\n // Released over the column rather than a card. The card is already sitting\n // in the gap the drag opened, so its position is the one on screen —\n // appending here is what used to send it to the bottom.\n if (changedColumn) {\n return targetItems;\n }\n\n // Same column, released below the last card.\n return arrayMove(targetItems, indexInTarget, targetItems.length - 1);\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n closestCorners,\n DndContext,\n DragEndEvent,\n DragOverEvent,\n DragOverlay,\n DragStartEvent,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport { arrayMove, SortableContext } from \"@dnd-kit/sortable\";\nimport { BoardColumn } from \"./BoardColumn\";\nimport { placeDroppedCard } from \"./placement\";\nimport { BoardItem, BoardItemMap, BoardProps } from \"./board_types\";\nimport { cls } from \"../../util\";\n\nexport function Board<T, COLUMN extends string>({\n data,\n columns: columnsProp,\n columnLabels,\n columnColors,\n className,\n assignColumn,\n allowColumnReorder = false,\n onColumnReorder,\n onItemsReorder,\n ItemComponent,\n columnLoadingState,\n onLoadMoreColumn,\n onAddItemToColumn,\n AddColumnComponent\n}: BoardProps<T, COLUMN>) {\n\n const [activeItem, setActiveItem] = useState<BoardItem<T> | null>(null);\n const [isDragging, setIsDragging] = useState(false);\n const [dragOverColumnId, setDragOverColumnId] = useState<string | null>(null);\n\n /**\n * Which column the card was picked up from.\n *\n * `handleDragOver` moves the card between columns in `itemMapState` while\n * the pointer is still down — that is what makes the gap open up under the\n * cursor. So by the time the drop is handled, looking the card up by id\n * finds it in its *destination*, and the board was reporting the move as\n * source === target: a cross-column drop looked like a plain reorder and\n * the column property was never written. The card snapped back on the next\n * fetch.\n */\n const dragSourceColumnRef = useRef<COLUMN | null>(null);\n\n const [itemMapState, setItemMapState] = useState<BoardItemMap<T>>(() => {\n const dataColumnMap: Record<string, COLUMN> = data.reduce((prev, item: BoardItem<T>) => ({\n ...prev,\n [item.id]: assignColumn(item)\n }), {});\n return columnsProp.reduce(\n (previous: BoardItemMap<T>, column: COLUMN) => ({\n ...previous,\n [column]: data.filter((item: BoardItem<T>) => dataColumnMap[item.id] === column)\n }),\n {} as BoardItemMap<T>\n );\n });\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n })\n );\n\n useEffect(() => {\n if (isDragging) return;\n\n const dataColumnMap: Record<string, COLUMN> = data.reduce((prev, item) => ({\n ...prev,\n [item.id]: assignColumn(item)\n }), {});\n\n const newItemMap = columnsProp.reduce(\n (previous: BoardItemMap<T>, column: COLUMN) => ({\n ...previous,\n [column]: data.filter((item: BoardItem<T>) => dataColumnMap[item.id] === column)\n }),\n {} as BoardItemMap<T>\n );\n\n setItemMapState(prevMap => {\n let changed = false;\n\n for (const col of columnsProp) {\n const prevItems = prevMap[col] ?? [];\n const newItems = newItemMap[col] ?? [];\n\n if (prevItems.length !== newItems.length) {\n changed = true;\n continue;\n }\n for (let i = 0; i < prevItems.length; i++) {\n if (prevItems[i].id !== newItems[i].id || prevItems[i].data !== newItems[i].data) {\n changed = true;\n break;\n }\n }\n }\n\n if (!changed) {\n return prevMap;\n }\n\n const updated: BoardItemMap<T> = {};\n for (const col of columnsProp) {\n const prevItems = prevMap[col] ?? [];\n const newItems = newItemMap[col] ?? [];\n\n const prevById = new Map<string, BoardItem<T>>();\n for (const item of prevItems) {\n prevById.set(item.id, item);\n }\n\n updated[col] = newItems.map(newItem => {\n const prev = prevById.get(newItem.id);\n if (prev && prev.data === newItem.data) {\n return prev;\n }\n return newItem;\n });\n }\n return updated;\n });\n }, [data, columnsProp, assignColumn]);\n\n const findColumnByItemId = (id: string): string | undefined => {\n return Object.keys(itemMapState).find(col => itemMapState[col]?.some(i => i.id === id));\n };\n\n const handleDragStart = (event: DragStartEvent) => {\n setIsDragging(true);\n setDragOverColumnId(null);\n const { active } = event;\n\n if (active.data.current?.type === \"ITEM\") {\n const columnId = findColumnByItemId(active.id as string);\n dragSourceColumnRef.current = (columnId as COLUMN | undefined) ?? null;\n if (columnId) {\n const item = itemMapState[columnId]?.find(i => i.id === active.id);\n setActiveItem(item || null);\n }\n }\n };\n\n const handleDragOver = (event: DragOverEvent) => {\n const {\n active,\n over\n } = event;\n\n if (!over) {\n setDragOverColumnId(null);\n return;\n }\n\n let currentHoveredColumnId: string | null = null;\n const overId = over.id as string;\n const overDataType = over.data.current?.type as string | undefined;\n\n if (overDataType === \"ITEM-LIST\" || overDataType === \"COLUMN\") {\n currentHoveredColumnId = overId;\n } else if (overDataType === \"ITEM\") {\n currentHoveredColumnId = findColumnByItemId(overId) || null;\n } else if (columnsProp.includes(overId as COLUMN)) {\n currentHoveredColumnId = overId;\n }\n\n setDragOverColumnId(currentHoveredColumnId);\n\n if (active.data.current?.type !== \"ITEM\") {\n return;\n }\n\n const activeId = active.id as string;\n const activeItemColumn = findColumnByItemId(activeId);\n let overColumnForMove = findColumnByItemId(overId);\n\n if (!overColumnForMove && overDataType === \"ITEM-LIST\") {\n overColumnForMove = overId;\n }\n if (!overColumnForMove && columnsProp.includes(overId as COLUMN)) {\n overColumnForMove = overId;\n }\n\n if (!activeItemColumn || !overColumnForMove) return;\n if (activeItemColumn === overColumnForMove) return;\n\n if (itemMapState[overColumnForMove]?.some(i => i.id === activeId)) {\n return;\n }\n\n setItemMapState(currentMap => {\n const activeItems = [...(currentMap[activeItemColumn] || [])];\n const overItems = [...(currentMap[overColumnForMove!] || [])];\n const activeIndex = activeItems.findIndex(i => i.id === activeId);\n\n if (activeIndex === -1) return currentMap;\n\n let overIndex;\n if (overDataType === \"ITEM-LIST\" || (columnsProp.includes(overId as COLUMN) && !findColumnByItemId(overId))) {\n overIndex = overItems.length;\n } else {\n overIndex = overItems.findIndex(i => i.id === overId);\n if (overIndex !== -1) {\n const activeTop = active.rect.current.translated?.top ?? 0;\n const activeHeight = active.rect.current.translated?.height ?? 0;\n const activeCenter = activeTop + activeHeight / 2;\n\n const overTop = over?.rect.top ?? 0;\n const overHeight = over?.rect.height ?? 0;\n const overCenter = overTop + overHeight / 2;\n\n const isBelowOverItem = activeCenter > overCenter;\n\n const modifier = isBelowOverItem ? 1 : 0;\n overIndex = overIndex >= 0 ? overIndex + modifier : overItems.length;\n } else {\n overIndex = overItems.length;\n }\n }\n\n const newItemMap = { ...currentMap };\n const [moved] = activeItems.splice(activeIndex, 1);\n overItems.splice(overIndex, 0, moved);\n newItemMap[activeItemColumn] = activeItems;\n newItemMap[overColumnForMove!] = overItems;\n return newItemMap;\n });\n };\n\n // Escape, or a drop outside the board. `handleDragOver` may already have\n // moved the card between columns, so the next `data` effect has to be\n // allowed to put it back.\n const handleDragCancel = () => {\n setIsDragging(false);\n setActiveItem(null);\n setDragOverColumnId(null);\n dragSourceColumnRef.current = null;\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n\n const sourceColumn = dragSourceColumnRef.current;\n\n setIsDragging(false);\n setActiveItem(null);\n setDragOverColumnId(null);\n dragSourceColumnRef.current = null;\n\n if (!over) return;\n\n const activeId = active.id as string;\n const overId = over.id as string;\n\n if (active.data.current?.type === \"COLUMN\") {\n if (activeId !== overId) {\n const oldIndex = columnsProp.indexOf(activeId as COLUMN);\n const newIndex = columnsProp.indexOf(overId as COLUMN);\n if (oldIndex !== -1 && newIndex !== -1) {\n const reordered = arrayMove(columnsProp, oldIndex, newIndex);\n onColumnReorder?.(reordered);\n }\n }\n return;\n }\n\n // Where the card sits right now — `handleDragOver` has already put it in\n // the column being hovered, so this is the destination, not the origin.\n const currentCol = findColumnByItemId(activeId) as COLUMN | undefined;\n let targetCol = findColumnByItemId(overId) as COLUMN | undefined;\n\n if (!targetCol) {\n const overDataType = over.data.current?.type;\n if (overDataType === \"ITEM-LIST\" || columnsProp.includes(overId as COLUMN)) {\n targetCol = overId as COLUMN;\n }\n }\n targetCol = targetCol ?? currentCol;\n\n if (!currentCol || !targetCol) return;\n\n const targetItems = itemMapState[targetCol] || [];\n const movedItem = (itemMapState[currentCol] || []).find(i => i.id === activeId);\n if (!movedItem) return;\n\n const finalTargetItems = placeDroppedCard({\n targetItems,\n movedItem,\n overId,\n changedColumn: (sourceColumn ?? currentCol) !== targetCol\n });\n\n onItemsReorder?.(finalTargetItems, {\n itemId: activeId,\n // The column the pointer went down in. `currentCol` would report a\n // cross-column move as a same-column reorder.\n sourceColumn: (sourceColumn ?? currentCol),\n targetColumn: targetCol\n });\n };\n\n return (\n <DndContext\n sensors={sensors}\n // `rectIntersection`, the default, only reports a target while the\n // dragged rect physically overlaps it, and prefers whichever\n // overlap is largest — on a board of tall columns that means a card\n // held over a gap reports nothing, and one held near a column edge\n // reports the neighbour. `closestCorners` is the sortable-list\n // recommendation and is what makes the drop land where it looks\n // like it will.\n collisionDetection={closestCorners}\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <div className={cls(\"flex flex-row h-full w-full overflow-x-auto p-4 select-none items-start\", className)}>\n <SortableContext items={columnsProp}>\n {columnsProp.map((col, index) => {\n const colItems = itemMapState[col] || [];\n const loadingState = columnLoadingState?.[col];\n return (\n <BoardColumn\n key={String(col)}\n id={String(col)}\n title={columnLabels?.[col] ?? String(col)}\n items={colItems}\n index={index}\n ItemComponent={ItemComponent}\n isDragging={isDragging}\n isDragOverColumn={dragOverColumnId === String(col)}\n allowReorder={allowColumnReorder}\n loading={loadingState?.loading}\n hasMore={loadingState?.hasMore}\n error={loadingState?.error}\n totalCount={loadingState?.totalCount}\n color={columnColors?.[col]}\n onLoadMore={onLoadMoreColumn ? () => onLoadMoreColumn(col) : undefined}\n onAddItem={onAddItemToColumn ? () => onAddItemToColumn(col) : undefined}\n />\n );\n })}\n </SortableContext>\n {AddColumnComponent}\n </div>\n\n {/* The overlay used to be positioned by hand, from `mousemove`\n listeners on `window` and a grab offset measured off whatever\n `[role='button']` the pointer went down on. dnd-kit already\n tracks the pointer and already knows the grab offset — the\n hand-rolled copy drifted from the position collision detection\n was actually using, so the card you saw and the slot you got\n were two different things. */}\n {typeof document !== \"undefined\" && createPortal(\n <DragOverlay dropAnimation={null} zIndex={9999}>\n {activeItem && (\n <ItemComponent\n item={activeItem}\n isDragging={true}\n isClone={true}\n />\n )}\n </DragOverlay>,\n document.body\n )}\n </DndContext>\n );\n}\n","import React from \"react\";\nimport { Board } from \"./Kanban/Board\";\nimport { BoardItem, BoardItemViewProps, ColumnLoadingState } from \"./Kanban/board_types\";\n\nexport type KanbanViewProps<T, COLUMN extends string> = {\n columns: COLUMN[];\n columnLabels?: Record<COLUMN, string>;\n columnColors?: Record<COLUMN, any>;\n className?: string;\n assignColumn: (item: BoardItem<T>) => COLUMN;\n allowColumnReorder?: boolean;\n onColumnReorder?: (columns: COLUMN[]) => void;\n onItemsReorder?: (\n items: BoardItem<T>[],\n moveInfo?: {\n itemId: string;\n sourceColumn: COLUMN;\n targetColumn: COLUMN;\n }\n ) => void;\n ItemComponent: React.ComponentType<BoardItemViewProps<T>>;\n columnLoadingState?: ColumnLoadingState;\n onLoadMoreColumn?: (column: COLUMN) => void;\n onAddItemToColumn?: (column: COLUMN) => void;\n AddColumnComponent?: React.ReactNode;\n data: BoardItem<T>[];\n};\n\nexport function KanbanView<T, COLUMN extends string>(props: KanbanViewProps<T, COLUMN>) {\n return <Board {...props} />;\n}\nexport type { BoardItem, BoardItemViewProps, ColumnLoadingState };\n","\"use client\";\nimport React, { useCallback, useState } from \"react\";\nimport { LayoutList, Table2, LayoutGrid, Kanban, Settings2 } from \"lucide-react\";\nimport { iconSize } from \"../../icons/Icon\";\nimport { SearchBar } from \"../../components/SearchBar\";\nimport { Popover } from \"../../components/Popover\";\nimport { ToggleButtonGroup } from \"../../components/ToggleButtonGroup\";\nimport type { ToggleButtonOption } from \"../../components/ToggleButtonGroup\";\nimport { Typography } from \"../../components/Typography\";\nimport { Select, SelectItem } from \"../../components/Select\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { cls } from \"../../util\";\nimport type { CollectionViewMode, CollectionViewSize, KanbanPropertyOption } from \"./CollectionViewTypes\";\n\n/**\n * Props for the {@link CollectionViewToolbar} component.\n * @group Collection View\n */\nexport type CollectionViewToolbarProps = {\n viewMode: CollectionViewMode;\n onViewModeChange?: (mode: CollectionViewMode) => void;\n enabledViews?: CollectionViewMode[];\n /**\n * Custom view modes, supplying the label and icon for their switcher\n * entries. Without these an `enabledViews` key outside the four built-ins\n * has no label and no icon to draw.\n */\n customViews?: { key: string, name: string, icon?: React.ReactNode }[];\n size?: CollectionViewSize;\n onSizeChange?: (size: CollectionViewSize) => void;\n searchString?: string;\n onSearchChange?: (search?: string) => void;\n loading?: boolean;\n actionsStart?: React.ReactNode;\n actionsEnd?: React.ReactNode;\n compact?: boolean;\n kanbanPropertyOptions?: KanbanPropertyOption[];\n selectedKanbanProperty?: string;\n onKanbanPropertyChange?: (property: string) => void;\n};\n\nconst VIEW_MODE_ICONS: Record<string, React.ReactNode> = {\n list: <LayoutList size={iconSize.small} />,\n table: <Table2 size={iconSize.small} />,\n cards: <LayoutGrid size={iconSize.small} />,\n kanban: <Kanban size={iconSize.small} />,\n};\n\nconst VIEW_MODE_LABELS: Record<string, string> = {\n list: \"List\",\n table: \"Table\",\n cards: \"Cards\",\n kanban: \"Board\",\n};\n\nconst SIZE_LABELS: Record<CollectionViewSize, string> = {\n xs: \"Extra Small\",\n s: \"Small\",\n m: \"Medium\",\n l: \"Large\",\n xl: \"Extra Large\",\n};\n\n/**\n * Toolbar for the headless CollectionView.\n *\n * Renders a search bar, view mode toggle (popover with toggle button group),\n * optional size selector, optional kanban property selector, and action slots.\n *\n * @group Collection View\n */\nexport function CollectionViewToolbar({\n viewMode,\n onViewModeChange,\n enabledViews = [\"list\", \"table\", \"cards\", \"kanban\"],\n customViews,\n size = \"m\",\n onSizeChange,\n searchString,\n onSearchChange,\n loading,\n actionsStart,\n actionsEnd,\n compact,\n kanbanPropertyOptions,\n selectedKanbanProperty,\n onKanbanPropertyChange,\n}: CollectionViewToolbarProps) {\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n // A key outside the four built-ins takes its label and icon from the\n // custom view that declared it; without one it falls back to the key\n // itself and the list glyph, so an entry is never blank.\n const viewOptions: ToggleButtonOption<CollectionViewMode>[] = enabledViews.map((mode) => {\n const custom = customViews?.find((entry) => entry.key === mode);\n return {\n value: mode,\n label: VIEW_MODE_LABELS[mode] ?? custom?.name ?? mode,\n icon: VIEW_MODE_ICONS[mode] ?? custom?.icon ?? <LayoutList size={iconSize.small} />,\n };\n });\n\n const handleViewModeChange = useCallback(\n (mode: CollectionViewMode) => {\n onViewModeChange?.(mode);\n },\n [onViewModeChange]\n );\n\n const handleSizeChange = useCallback(\n (value: string) => {\n onSizeChange?.(value as CollectionViewSize);\n },\n [onSizeChange]\n );\n\n const handleKanbanPropertyChange = useCallback(\n (value: string) => {\n onKanbanPropertyChange?.(value);\n },\n [onKanbanPropertyChange]\n );\n\n const showViewToggle = onViewModeChange && enabledViews.length > 1;\n const showSizeSelector = onSizeChange && viewMode !== \"kanban\";\n const showKanbanSelector =\n kanbanPropertyOptions &&\n kanbanPropertyOptions.length > 0 &&\n viewMode === \"kanban\" &&\n onKanbanPropertyChange;\n const showPopover = showViewToggle || showSizeSelector || showKanbanSelector;\n\n return (\n <div\n className={cls(\n \"flex items-center gap-2 px-2 flex-shrink-0\",\n \"border-b border-hairline\",\n compact ? \"py-0.5 gap-1\" : \"py-1\"\n )}\n >\n {actionsStart}\n\n {onSearchChange && (\n <SearchBar\n onTextSearch={onSearchChange}\n size=\"small\"\n initialValue={searchString}\n loading={loading}\n expandable\n />\n )}\n\n <div className=\"flex-1\" />\n\n {actionsEnd}\n\n {showPopover && (\n <Popover\n open={popoverOpen}\n onOpenChange={setPopoverOpen}\n side=\"bottom\"\n align=\"end\"\n trigger={\n <IconButton\n size=\"small\"\n onClick={() => setPopoverOpen((prev) => !prev)}\n >\n <Settings2 size={iconSize.small} />\n </IconButton>\n }\n >\n <div className=\"p-3 min-w-[200px] flex flex-col gap-3\">\n {showViewToggle && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n View\n </Typography>\n <ToggleButtonGroup<CollectionViewMode>\n value={viewMode}\n onValueChange={handleViewModeChange}\n options={viewOptions}\n />\n </div>\n )}\n\n {showSizeSelector && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n Size\n </Typography>\n <Select\n value={size}\n onValueChange={handleSizeChange}\n size=\"small\"\n >\n {(Object.keys(SIZE_LABELS) as CollectionViewSize[]).map(\n (sizeKey) => (\n <SelectItem key={sizeKey} value={sizeKey}>\n {SIZE_LABELS[sizeKey]}\n </SelectItem>\n )\n )}\n </Select>\n </div>\n )}\n\n {showKanbanSelector && (\n <div className=\"flex flex-col gap-1\">\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"font-medium uppercase tracking-wider\"\n >\n Group by\n </Typography>\n <Select\n value={selectedKanbanProperty}\n onValueChange={handleKanbanPropertyChange}\n size=\"small\"\n >\n {kanbanPropertyOptions.map((option) => (\n <SelectItem key={option.key} value={option.key}>\n {option.label}\n </SelectItem>\n ))}\n </Select>\n </div>\n )}\n </div>\n </Popover>\n )}\n </div>\n );\n}\n","import React from \"react\";\nimport { ImageIcon } from \"lucide-react\";\nimport { cls } from \"../../util\";\nimport { Typography } from \"../../components/Typography\";\nimport { Chip } from \"../../components/Chip\";\nimport { BooleanSwitch } from \"../../components/BooleanSwitch\";\nimport { Markdown } from \"../../components/Markdown\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { iconSize } from \"../../icons\";\nimport type { CellRendererProps, CollectionPropertyConfig, CollectionEnumValueConfig } from \"./CollectionViewTypes\";\n\n// ——— Helpers ———\n\n/**\n * Resolve an enum key to its display label and optional color.\n */\nfunction resolveEnumLabel(\n enumValues: CollectionPropertyConfig[\"enum\"],\n value: unknown\n): { label: string; color?: string } | undefined {\n if (!enumValues) return undefined;\n const key = String(value);\n if (enumValues instanceof Map) {\n const config: CollectionEnumValueConfig | undefined = enumValues.get(value as string | number);\n if (!config) return undefined;\n if (typeof config === \"string\") return { label: config };\n return { label: config.label, color: config.color };\n }\n const config: CollectionEnumValueConfig | undefined = enumValues[key];\n if (!config) return undefined;\n if (typeof config === \"string\") return { label: config };\n return { label: config.label, color: config.color };\n}\n\n/**\n * Format a date value using Intl.DateTimeFormat.\n */\nfunction formatDate(value: unknown, includeTime: boolean): string {\n if (value == null) return \"—\";\n const date = value instanceof Date ? value : new Date(String(value));\n if (isNaN(date.getTime())) return String(value);\n\n const options: Intl.DateTimeFormatOptions = includeTime\n ? { year: \"numeric\", month: \"short\", day: \"numeric\", hour: \"2-digit\", minute: \"2-digit\" }\n : { year: \"numeric\", month: \"short\", day: \"numeric\" };\n\n return new Intl.DateTimeFormat(undefined, options).format(date);\n}\n\n/**\n * Type guard for geopoint-like objects.\n */\nfunction isGeoPoint(value: unknown): value is { lat: number; lng: number } {\n if (typeof value !== \"object\" || value === null) return false;\n const obj = value as Record<string, unknown>;\n return typeof obj.lat === \"number\" && typeof obj.lng === \"number\";\n}\n\n// ——— Component ———\n\n/**\n * Default cell renderer for the headless CollectionView.\n * Handles all built-in property types without depending on any Rebase core types.\n *\n * @group Preview components\n */\nexport function DefaultCellRenderer({\n row,\n propertyKey,\n property,\n value,\n size,\n width,\n height\n}: CellRendererProps) {\n\n // 1. Null / undefined → em-dash\n if (value === null || value === undefined) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n // 2. Custom Preview component override\n if (property.Preview) {\n const PreviewComponent = property.Preview;\n return (\n <PreviewComponent\n row={row}\n propertyKey={propertyKey}\n property={property}\n value={value}\n size={size}\n width={width}\n height={height}\n />\n );\n }\n\n // ——— Type-specific renderers ———\n\n switch (property.type) {\n case \"string\":\n return renderString(property, value);\n\n case \"number\":\n return renderNumber(property, value);\n\n case \"boolean\":\n return renderBoolean(value);\n\n case \"date\":\n return renderDate(property, value);\n\n case \"array\":\n return renderArray(property, value);\n\n case \"map\":\n return renderMap(value);\n\n case \"reference\":\n case \"relation\":\n return renderReference(value);\n\n case \"geopoint\":\n return renderGeopoint(value);\n\n default:\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n noWrap\n className=\"px-1\">\n {JSON.stringify(value)}\n </Typography>\n );\n }\n}\n\n// ——— Per-type render functions ———\n\nfunction renderString(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const strValue = String(value);\n\n // Enum → Chip\n if (property.enum) {\n const resolved = resolveEnumLabel(property.enum, value);\n return (\n <Chip size=\"small\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? strValue}\n </Chip>\n );\n }\n\n // Preview as tag → Chip\n if (property.previewAsTag) {\n return (\n <Chip size=\"small\">\n {strValue}\n </Chip>\n );\n }\n\n // URL → clickable link\n if (property.url) {\n const href = typeof property.url === \"string\" ? property.url : strValue;\n return (\n <Typography variant=\"body2\"\n noWrap\n component=\"a\"\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cls(\n \"px-1 text-primary hover:underline cursor-pointer\"\n )}>\n {strValue}\n </Typography>\n );\n }\n\n // Email → mailto link\n if (property.email) {\n return (\n <Typography variant=\"body2\"\n noWrap\n component=\"a\"\n href={`mailto:${strValue}`}\n className={cls(\n \"px-1 text-primary hover:underline cursor-pointer\"\n )}>\n {strValue}\n </Typography>\n );\n }\n\n // Markdown → rendered markdown\n if (property.markdown) {\n return (\n <div className=\"px-1 max-h-[100px] overflow-hidden\">\n <Markdown source={strValue} size=\"small\" />\n </div>\n );\n }\n\n // Storage → image preview with fallback\n if (property.storage) {\n return (\n <div className={cls(\n \"px-1 flex items-center justify-center\",\n \"w-[40px] h-[40px] rounded overflow-hidden\"\n )}>\n {strValue ? (\n <img\n src={strValue}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n onError={(e) => {\n const target = e.currentTarget;\n target.style.display = \"none\";\n const fallback = target.nextElementSibling;\n if (fallback instanceof HTMLElement) {\n fallback.style.display = \"flex\";\n }\n }}\n />\n ) : null}\n <div className={cls(\n \"w-full h-full items-center justify-center rounded\",\n \"bg-surface-raised text-text-secondary dark:text-text-secondary-dark\",\n strValue ? \"hidden\" : \"flex\"\n )}>\n <ImageIcon size={iconSize.small} />\n </div>\n </div>\n );\n }\n\n // Default string → truncated text\n return (\n <Tooltip title={strValue.length > 50 ? strValue : undefined}\n side=\"bottom\">\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {strValue}\n </Typography>\n </Tooltip>\n );\n}\n\nfunction renderNumber(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const numStr = String(value);\n\n // Enum → Chip\n if (property.enum) {\n const resolved = resolveEnumLabel(property.enum, value);\n return (\n <Chip size=\"small\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? numStr}\n </Chip>\n );\n }\n\n // Default → right-aligned\n return (\n <Typography variant=\"body2\"\n noWrap\n align=\"right\"\n className=\"px-1 tabular-nums\">\n {numStr}\n </Typography>\n );\n}\n\nfunction renderBoolean(value: unknown): React.ReactElement {\n return (\n <div className=\"px-1 flex items-center\">\n <BooleanSwitch value={!!value}\n size=\"small\"\n disabled />\n </div>\n );\n}\n\nfunction renderDate(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n const includeTime = property.mode === \"date_time\";\n const formatted = formatDate(value, includeTime);\n\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1 tabular-nums\">\n {formatted}\n </Typography>\n );\n}\n\nfunction renderArray(property: CollectionPropertyConfig, value: unknown): React.ReactElement {\n if (!Array.isArray(value)) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n // Array of enum values → row of chips\n if (property.of?.enum && value.length > 0) {\n return (\n <div className=\"px-1 flex flex-wrap gap-1 overflow-hidden\">\n {value.map((item, i) => {\n const resolved = resolveEnumLabel(property.of!.enum, item);\n return (\n <Chip key={i}\n size=\"smallest\"\n colorScheme={resolved?.color ? { color: resolved.color, text: \"#fff\" } : undefined}>\n {resolved?.label ?? String(item)}\n </Chip>\n );\n })}\n </div>\n );\n }\n\n // Array of strings → comma-separated\n if (value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {(value as string[]).join(\", \")}\n </Typography>\n );\n }\n\n // Generic array → item count\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {value.length} {value.length === 1 ? \"item\" : \"items\"}\n </Typography>\n );\n}\n\nfunction renderMap(value: unknown): React.ReactElement {\n if (typeof value !== \"object\" || value === null) {\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n —\n </Typography>\n );\n }\n\n const fieldCount = Object.keys(value as Record<string, unknown>).length;\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {fieldCount} {fieldCount === 1 ? \"field\" : \"fields\"}\n </Typography>\n );\n}\n\nfunction renderReference(value: unknown): React.ReactElement {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1\">\n {String(value)}\n </Typography>\n );\n}\n\nfunction renderGeopoint(value: unknown): React.ReactElement {\n if (isGeoPoint(value)) {\n return (\n <Typography variant=\"body2\"\n noWrap\n className=\"px-1 tabular-nums\">\n {value.lat.toFixed(6)}, {value.lng.toFixed(6)}\n </Typography>\n );\n }\n\n return (\n <Typography variant=\"body2\"\n color=\"secondary\"\n className=\"px-1\">\n {String(value)}\n </Typography>\n );\n}\n","/**\n * Traverse an object by dot-separated path.\n * Returns `undefined` if any segment is missing.\n */\nexport function getValueInPath(obj: Record<string, unknown> | undefined, path: string): unknown {\n if (!obj) return undefined;\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") return undefined;\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { VirtualTable } from \"../../components/VirtualTable/VirtualTable\";\nimport type { VirtualTableColumn, CellRendererParams, OnVirtualTableColumnResizeParams } from \"../../components/VirtualTable/VirtualTableProps\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n CellRendererProps,\n} from \"./CollectionViewTypes\";\n\nimport { getValueInPath } from \"./utils\";\n\nconst DEFAULT_COLUMN_WIDTHS: Record<string, number> = {\n string: 200,\n number: 140,\n date: 160,\n boolean: 120,\n array: 200,\n map: 200,\n reference: 200,\n relation: 200,\n geopoint: 180,\n};\nconst FALLBACK_COLUMN_WIDTH = 200;\n\nconst SIZE_TO_ROW_HEIGHT: Record<CollectionViewSize, number> = {\n xs: 36,\n s: 44,\n m: 52,\n l: 64,\n xl: 80,\n};\n\nconst SORTABLE_TYPES = new Set([\"string\", \"number\", \"date\"]);\n\ntype RendererSize = \"tiny\" | \"small\" | \"medium\" | \"large\";\n\nconst VIEW_SIZE_TO_RENDERER_SIZE: Record<CollectionViewSize, RendererSize> = {\n xs: \"tiny\",\n s: \"small\",\n m: \"medium\",\n l: \"large\",\n xl: \"large\",\n};\n\n/**\n * Props for the {@link CollectionTableView} component.\n * @group Collection View\n */\nexport type CollectionTableViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n displayedColumnIds?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n hoverRow?: boolean;\n className?: string;\n onColumnResize?: (params: { key: string; width: number }) => void;\n onColumnsOrderChange?: (keys: string[]) => void;\n};\n\n/**\n * Headless table view that wraps {@link VirtualTable}.\n *\n * Converts property configurations into virtual table columns and wires up\n * sorting, pagination, and cell rendering without coupling to any data layer.\n *\n * @group Collection View\n */\nexport function CollectionTableView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n displayedColumnIds,\n onRowClick,\n cellRenderer,\n size = \"m\",\n emptyComponent,\n hoverRow = true,\n className,\n onColumnResize,\n onColumnsOrderChange,\n}: CollectionTableViewProps<T>) {\n // ── Build columns ────────────────────────────────────────────────\n const columns = useMemo<VirtualTableColumn[]>(() => {\n const order = propertiesOrder ?? Object.keys(properties);\n const filteredKeys = displayedColumnIds\n ? order.filter((key) => displayedColumnIds.includes(key))\n : order.filter((key) => {\n const prop = properties[key];\n return prop && !prop.hideFromCollection;\n });\n\n return filteredKeys\n .map((key): VirtualTableColumn | null => {\n const prop = properties[key];\n if (!prop) return null;\n return {\n key,\n width: prop.columnWidth || DEFAULT_COLUMN_WIDTHS[prop.type] || FALLBACK_COLUMN_WIDTH,\n title: prop.name,\n sortable: SORTABLE_TYPES.has(prop.type),\n resizable: true,\n };\n })\n .filter((col): col is VirtualTableColumn => col !== null);\n }, [properties, propertiesOrder, displayedColumnIds]);\n\n // ── Row height ───────────────────────────────────────────────────\n const rowHeight = SIZE_TO_ROW_HEIGHT[size];\n const rendererSize = VIEW_SIZE_TO_RENDERER_SIZE[size];\n\n // ── Cell renderer ────────────────────────────────────────────────\n const tableCellRenderer = useCallback(\n (params: CellRendererParams<Record<string, unknown>>): React.ReactNode => {\n if (!params.rowData) return null;\n\n const propertyConfig = properties[params.column.key];\n if (!propertyConfig) return null;\n\n const value = getValueInPath(\n params.rowData,\n params.column.key\n );\n\n const cellProps: CellRendererProps<T> = {\n row: params.rowData as T,\n propertyKey: params.column.key,\n property: propertyConfig,\n value,\n size: rendererSize,\n width: params.width,\n };\n\n // Try custom renderer first\n if (cellRenderer) {\n const custom = cellRenderer(cellProps);\n if (custom !== undefined) {\n return (\n <div className=\"flex items-center h-full px-1 overflow-hidden\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div className=\"flex items-center h-full px-1 overflow-hidden\">\n <DefaultCellRenderer {...cellProps} />\n </div>\n );\n },\n [properties, cellRenderer, rendererSize]\n );\n\n // ── Row click ────────────────────────────────────────────────────\n const handleRowClick = useCallback(\n ({ rowData }: { rowData: Record<string, unknown> }) => {\n onRowClick?.(rowData as T);\n },\n [onRowClick]\n );\n\n // ── Pagination ──────────────────────────────────────────────────\n const handleEndReached = useCallback(() => {\n if (dataController.paginationEnabled && !dataController.noMoreToLoad) {\n const currentCount = dataController.itemCount ?? dataController.pageSize ?? 50;\n const pageSize = dataController.pageSize ?? 50;\n dataController.setItemCount?.(currentCount + pageSize);\n }\n }, [\n dataController.paginationEnabled,\n dataController.noMoreToLoad,\n dataController.itemCount,\n dataController.pageSize,\n dataController.setItemCount,\n ]);\n\n // ── Column resize ───────────────────────────────────────────────\n const handleColumnResize = useCallback(\n (params: OnVirtualTableColumnResizeParams) => {\n onColumnResize?.({ key: params.key, width: params.width });\n },\n [onColumnResize]\n );\n\n // ── Column reorder ──────────────────────────────────────────────\n const handleColumnsOrderChange = useCallback(\n (newColumns: VirtualTableColumn[]) => {\n onColumnsOrderChange?.(newColumns.map((col) => col.key));\n },\n [onColumnsOrderChange]\n );\n\n return (\n <VirtualTable\n data={dataController.data}\n columns={columns}\n cellRenderer={tableCellRenderer}\n rowHeight={rowHeight}\n sortBy={dataController.sortBy}\n onSortByUpdate={dataController.setSortBy}\n onRowClick={handleRowClick}\n onEndReached={handleEndReached}\n onColumnResize={handleColumnResize}\n onColumnsOrderChange={handleColumnsOrderChange}\n loading={dataController.loading}\n emptyComponent={emptyComponent}\n error={dataController.error}\n hoverRow={hoverRow}\n className={cls(\"h-full\", className)}\n onScroll={dataController.onScroll}\n initialScroll={dataController.initialScroll}\n />\n );\n}\n","import type { CollectionPropertyConfig } from \"./CollectionViewTypes\";\n\n/**\n * Pick the property that acts as a row's title.\n *\n * Headless mirror of the ranking in `@rebasepro/common`: identifiers are kept\n * out of the title slot structurally (the id property, images, hidden fields),\n * and among what is left a plain text field beats a description, an enum or a\n * relation. Falls back to the id property only when a collection has nothing\n * else to show.\n */\nexport function resolveTitlePropertyKey(\n order: string[],\n properties: Record<string, CollectionPropertyConfig>,\n idProperty: string,\n titleProperty?: string\n): string {\n if (titleProperty) return titleProperty;\n\n const SCORE = {\n RELATION: 10,\n LONG_TEXT: 20,\n ENUM: 30,\n EMAIL: 45,\n PLAIN_TEXT: 60,\n NAMED: 100\n };\n const titleLikeKeys = new Set([\"name\", \"fullname\", \"displayname\", \"title\", \"label\", \"heading\", \"subject\", \"username\", \"nickname\"]);\n\n let best: { key: string; score: number } | undefined;\n\n order.forEach(key => {\n const property = properties[key];\n if (!property || property.hideFromCollection) return;\n if (key === idProperty) return;\n if (property.storage || property.url === \"image\") return;\n\n let score: number;\n if (property.type === \"relation\" || property.type === \"reference\") score = SCORE.RELATION;\n else if (property.type !== \"string\") return;\n else if (property.enum) score = SCORE.ENUM;\n else if (property.multiline || property.markdown) score = SCORE.LONG_TEXT;\n else if (property.email) score = SCORE.EMAIL;\n else if (titleLikeKeys.has(key.toLowerCase().replace(/[^a-z0-9]/g, \"\"))) score = SCORE.NAMED;\n else score = SCORE.PLAIN_TEXT;\n\n if (!best || score > best.score) best = { key,\nscore };\n });\n\n return best?.key ?? idProperty;\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { CardView } from \"../CardView\";\nimport { Card } from \"../../components/Card\";\nimport { Typography } from \"../../components/Typography\";\nimport { Checkbox } from \"../../components/Checkbox\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport { cardSelectedMixin, fieldBackgroundMixin } from \"../../styles\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\n/**\n * Props for the {@link CollectionCardView} component.\n * @group Collection View\n */\nexport type CollectionCardViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n className?: string;\n};\n\n/**\n * Headless card grid view that wraps {@link CardView}.\n *\n * Renders each item as a card with an optional image, title,\n * preview properties, and selection support.\n *\n * @group Collection View\n */\nexport function CollectionCardView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n onRowClick,\n cellRenderer,\n size = \"m\",\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n className,\n}: CollectionCardViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Resolve image property ───────────────────────────────────────\n const imageProperty = useMemo(() => {\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.storage) {\n return key;\n }\n }\n return undefined;\n }, [order, properties]);\n\n // ── Preview properties (up to 3) ─────────────────────────────────\n const previewProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey || key === imageProperty) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 3) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey, imageProperty]);\n\n // ── Selection IDs ────────────────────────────────────────────────\n const selectedIds = useMemo(() => {\n if (!selectionController?.selectedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of selectionController.selectedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [selectionController?.selectedItems, idProperty]);\n\n // ── Highlighted IDs ──────────────────────────────────────────────\n const highlightedIds = useMemo(() => {\n if (!highlightedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of highlightedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [highlightedItems, idProperty]);\n\n // ── Selection handler ────────────────────────────────────────────\n const handleSelectionChange = useCallback(\n (item: T, selected: boolean) => {\n if (!selectionController) return;\n selectionController.setSelectedItems((prev) => {\n if (selected) {\n return [...prev, item];\n }\n const itemId = getValueInPath(item as Record<string, unknown>, idProperty);\n return prev.filter((existing) => {\n const existingId = getValueInPath(existing as Record<string, unknown>, idProperty);\n return existingId !== itemId;\n });\n });\n },\n [selectionController, idProperty]\n );\n\n // ── Render card ──────────────────────────────────────────────────\n const renderCard = useCallback(\n (\n item: T,\n extra: {\n selected: boolean;\n highlighted: boolean;\n onSelectionChange: (selected: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n }\n ): React.ReactNode => {\n const titleValue = getValueInPath(item as Record<string, unknown>, titlePropertyKey);\n const imageValue = imageProperty\n ? getValueInPath(item as Record<string, unknown>, imageProperty)\n : undefined;\n const hasImage = typeof imageValue === \"string\" && imageValue.length > 0;\n\n return (\n <Card\n onClick={(e) => { if (e) extra.onClick(e); }}\n className={cls(\n \"overflow-hidden relative\",\n extra.selected && cardSelectedMixin,\n extra.highlighted && !extra.selected && \"ring-1 ring-primary/50\"\n )}\n >\n {/* Image */}\n {imageProperty && (\n hasImage ? (\n <img\n src={imageValue as string}\n alt=\"\"\n className=\"w-full h-32 object-cover rounded-t-lg\"\n />\n ) : (\n <div className={cls(\"h-24 rounded-t-lg\", fieldBackgroundMixin)} />\n )\n )}\n\n {/* Selection checkbox */}\n {selectionEnabled && (\n <div\n className=\"absolute top-2 right-2\"\n onClick={(e) => e.stopPropagation()}\n >\n <Checkbox\n checked={extra.selected}\n onCheckedChange={extra.onSelectionChange}\n size=\"small\"\n />\n </div>\n )}\n\n {/* Title */}\n <Typography variant=\"subtitle2\" noWrap className=\"px-3 pt-2 pb-1\">\n {String(titleValue ?? \"\")}\n </Typography>\n\n {/* Preview properties */}\n {previewProperties.map(({ key, property }) => {\n const value = getValueInPath(item as Record<string, unknown>, key);\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item,\n propertyKey: key,\n property,\n value,\n size: \"small\",\n });\n if (custom !== undefined) {\n return (\n <div key={key} className=\"px-3 py-0.5\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div key={key} className=\"px-3 py-0.5\">\n <DefaultCellRenderer\n row={item}\n propertyKey={key}\n property={property}\n value={value}\n size=\"small\"\n />\n </div>\n );\n })}\n\n <div className=\"pb-2\" />\n </Card>\n );\n },\n [titlePropertyKey, imageProperty, previewProperties, cellRenderer, selectionEnabled]\n );\n\n return (\n <div className={cls(\"w-full h-full overflow-auto\", className)}>\n <CardView<T>\n data={dataController.data}\n dataLoading={dataController.loading}\n noMoreToLoad={dataController.noMoreToLoad}\n dataLoadingError={dataController.error}\n itemCount={dataController.itemCount}\n setItemCount={dataController.setItemCount}\n pageSize={dataController.pageSize}\n paginationEnabled={dataController.paginationEnabled}\n onItemClick={onRowClick}\n selectedIds={selectedIds}\n highlightedIds={highlightedIds}\n selectionEnabled={!!selectionEnabled}\n onSelectionChange={handleSelectionChange}\n size={size}\n renderCard={renderCard}\n emptyComponent={emptyComponent}\n />\n </div>\n );\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { ListView } from \"../ListView\";\nimport { Typography } from \"../../components/Typography\";\nimport { Checkbox } from \"../../components/Checkbox\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionViewSize,\n CollectionSelectionController,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\n/**\n * Props for the {@link CollectionListView} component.\n * @group Collection View\n */\nexport type CollectionListViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n size?: CollectionViewSize;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n className?: string;\n};\n\n/**\n * Headless list view that wraps {@link ListView}.\n *\n * Each row displays a title (bold), subtitle with 1–2 secondary property values,\n * and optional selection support.\n *\n * @group Collection View\n */\nexport function CollectionListView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n onRowClick,\n cellRenderer,\n size = \"m\",\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n className,\n}: CollectionListViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Subtitle properties (up to 2) ────────────────────────────────\n const subtitleProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 2) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey]);\n\n // ── Selection IDs ────────────────────────────────────────────────\n const selectedIds = useMemo(() => {\n if (!selectionController?.selectedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of selectionController.selectedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [selectionController?.selectedItems, idProperty]);\n\n // ── Highlighted IDs ──────────────────────────────────────────────\n const highlightedIds = useMemo(() => {\n if (!highlightedItems) return undefined;\n const ids = new Set<string | number>();\n for (const item of highlightedItems) {\n const id = getValueInPath(item as Record<string, unknown>, idProperty);\n if (id !== undefined && id !== null) {\n ids.add(id as string | number);\n }\n }\n return ids;\n }, [highlightedItems, idProperty]);\n\n // ── Selection handler ────────────────────────────────────────────\n const handleSelectionChange = useCallback(\n (item: T, selected: boolean) => {\n if (!selectionController) return;\n selectionController.setSelectedItems((prev) => {\n if (selected) {\n return [...prev, item];\n }\n const itemId = getValueInPath(item as Record<string, unknown>, idProperty);\n return prev.filter((existing) => {\n const existingId = getValueInPath(existing as Record<string, unknown>, idProperty);\n return existingId !== itemId;\n });\n });\n },\n [selectionController, idProperty]\n );\n\n // ── Render row ───────────────────────────────────────────────────\n const renderRow = useCallback(\n (params: {\n item: T;\n index: number;\n style: React.CSSProperties;\n className: string;\n selected: boolean;\n highlighted: boolean;\n isLast: boolean;\n onClick: (e: React.MouseEvent) => void;\n onSelectionChange: (selected: boolean) => void;\n }): React.ReactNode => {\n const { item, style, className: rowClassName, selected, highlighted, onClick, onSelectionChange } = params;\n const titleValue = getValueInPath(item as Record<string, unknown>, titlePropertyKey);\n\n return (\n <div\n style={style}\n className={cls(\n \"flex items-center gap-3 px-4 cursor-pointer\",\n \"hover:bg-surface-hover\",\n \"transition-colors duration-100\",\n selected && \"bg-primary-bg\",\n highlighted && \"bg-surface-raised\",\n rowClassName\n )}\n onClick={onClick}\n >\n {/* Selection checkbox */}\n {selectionEnabled && (\n <div className=\"flex-shrink-0\" onClick={(e) => e.stopPropagation()}>\n <Checkbox\n checked={selected}\n onCheckedChange={onSelectionChange}\n size=\"small\"\n />\n </div>\n )}\n\n {/* Content */}\n <div className=\"flex-1 min-w-0 py-1\">\n {/* Title */}\n <Typography variant=\"subtitle2\" noWrap>\n {String(titleValue ?? \"\")}\n </Typography>\n\n {/* Subtitle properties */}\n {subtitleProperties.length > 0 && (\n <div className=\"flex items-center gap-2\">\n {subtitleProperties.map(({ key, property }) => {\n const value = getValueInPath(item as Record<string, unknown>, key);\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item,\n propertyKey: key,\n property,\n value,\n size: \"tiny\",\n });\n if (custom !== undefined) {\n return <React.Fragment key={key}>{custom}</React.Fragment>;\n }\n }\n\n return (\n <React.Fragment key={key}>\n <DefaultCellRenderer\n row={item}\n propertyKey={key}\n property={property}\n value={value}\n size=\"tiny\"\n />\n </React.Fragment>\n );\n })}\n </div>\n )}\n </div>\n </div>\n );\n },\n [titlePropertyKey, subtitleProperties, cellRenderer, selectionEnabled]\n );\n\n return (\n <div className={cls(\"w-full h-full overflow-auto\", className)}>\n <ListView<T>\n data={dataController.data}\n dataLoading={dataController.loading}\n noMoreToLoad={dataController.noMoreToLoad}\n dataLoadingError={dataController.error}\n itemCount={dataController.itemCount}\n setItemCount={dataController.setItemCount}\n pageSize={dataController.pageSize}\n paginationEnabled={dataController.paginationEnabled}\n onItemClick={onRowClick}\n selectedIds={selectedIds}\n highlightedIds={highlightedIds}\n selectionEnabled={!!selectionEnabled}\n onSelectionChange={handleSelectionChange}\n size={size}\n renderRow={renderRow}\n emptyComponent={emptyComponent}\n />\n </div>\n );\n}\n","\"use client\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { KanbanView } from \"../KanbanView\";\nimport type { BoardItem, BoardItemViewProps } from \"../KanbanView\";\nimport { Card } from \"../../components/Card\";\nimport { Typography } from \"../../components/Typography\";\nimport { DefaultCellRenderer } from \"./DefaultCellRenderer\";\nimport { cls } from \"../../util\";\nimport { cardClickableMixin, cardSelectedMixin } from \"../../styles\";\nimport type {\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionSelectionController,\n CollectionEnumValueConfig,\n} from \"./CollectionViewTypes\";\nimport { resolveTitlePropertyKey } from \"./resolveTitleProperty\";\n\nimport { getValueInPath } from \"./utils\";\n\nfunction getEnumLabel(enumConfig: CollectionPropertyConfig[\"enum\"], key: string): string {\n if (!enumConfig) return key;\n if (enumConfig instanceof Map) {\n const cfg: CollectionEnumValueConfig | undefined = enumConfig.get(key);\n if (!cfg) return key;\n return typeof cfg === \"string\" ? cfg : cfg.label;\n }\n const cfg: CollectionEnumValueConfig | undefined = enumConfig[key];\n if (!cfg) return key;\n return typeof cfg === \"string\" ? cfg : cfg.label;\n}\n\n/**\n * Props for the {@link CollectionKanbanView} component.\n * @group Collection View\n */\nexport type CollectionKanbanViewProps<T = Record<string, unknown>> = {\n dataController: CollectionDataController<T>;\n properties: Record<string, CollectionPropertyConfig>;\n propertiesOrder?: string[];\n idProperty?: string;\n titleProperty?: string;\n kanbanProperty: string;\n onRowClick?: (row: T) => void;\n cellRenderer?: CellRendererOverride<T>;\n selectionEnabled?: boolean;\n selectionController?: CollectionSelectionController<T>;\n highlightedItems?: T[];\n emptyComponent?: React.ReactNode;\n onRowCreate?: (defaults?: Record<string, unknown>) => void;\n className?: string;\n};\n\n/**\n * Headless kanban view that wraps {@link KanbanView}.\n *\n * Groups data by a kanban property's enum values into columns.\n * Each card displays a title and 1–2 preview properties.\n *\n * @group Collection View\n */\nexport function CollectionKanbanView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n idProperty = \"id\",\n titleProperty,\n kanbanProperty,\n onRowClick,\n cellRenderer,\n emptyComponent,\n onRowCreate,\n className,\n}: CollectionKanbanViewProps<T>) {\n const order = useMemo(\n () => propertiesOrder ?? Object.keys(properties),\n [propertiesOrder, properties]\n );\n\n // ── Resolve kanban columns ───────────────────────────────────────\n const columns = useMemo<string[]>(() => {\n const kanbanConfig = properties[kanbanProperty];\n if (kanbanConfig?.enum) {\n if (kanbanConfig.enum instanceof Map) {\n return Array.from(kanbanConfig.enum.keys()).map(String);\n }\n return Object.keys(kanbanConfig.enum);\n }\n // Deduce from data\n const seen = new Set<string>();\n for (const row of dataController.data) {\n const val = getValueInPath(row as Record<string, unknown>, kanbanProperty);\n if (val !== null && val !== undefined) {\n seen.add(String(val));\n }\n }\n return Array.from(seen);\n }, [properties, kanbanProperty, dataController.data]);\n\n // ── Column labels ────────────────────────────────────────────────\n const columnLabels = useMemo(() => {\n const kanbanConfig = properties[kanbanProperty];\n const labels: Record<string, string> = {};\n for (const col of columns) {\n labels[col] = getEnumLabel(kanbanConfig?.enum, col);\n }\n return labels;\n }, [properties, kanbanProperty, columns]);\n\n // ── Resolve title property ───────────────────────────────────────\n const titlePropertyKey = useMemo(\n () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),\n [titleProperty, order, properties, idProperty]\n );\n\n // ── Preview properties (up to 2) ─────────────────────────────────\n const previewProperties = useMemo(() => {\n const result: { key: string; property: CollectionPropertyConfig }[] = [];\n for (const key of order) {\n if (key === titlePropertyKey || key === kanbanProperty) continue;\n const prop = properties[key];\n if (prop && !prop.hideFromCollection) {\n result.push({ key, property: prop });\n if (result.length >= 2) break;\n }\n }\n return result;\n }, [order, properties, titlePropertyKey, kanbanProperty]);\n\n // ── Convert data to BoardItem<T>[] ───────────────────────────────\n const boardItems = useMemo<BoardItem<T>[]>(() => {\n return dataController.data.map((row, index) => {\n const id = getValueInPath(row as Record<string, unknown>, idProperty);\n return {\n id: id !== null && id !== undefined ? String(id) : String(index),\n data: row,\n };\n });\n }, [dataController.data, idProperty]);\n\n // ── Assign column ────────────────────────────────────────────────\n const assignColumn = useCallback(\n (item: BoardItem<T>): string => {\n const val = getValueInPath(item.data as Record<string, unknown>, kanbanProperty);\n const strVal = val !== null && val !== undefined ? String(val) : \"\";\n if (columns.includes(strVal)) return strVal;\n return columns[0] ?? \"\";\n },\n [kanbanProperty, columns]\n );\n\n // ── Item component ───────────────────────────────────────────────\n const ItemComponent = useMemo(() => {\n function KanbanCard(props: BoardItemViewProps<T>) {\n const { item } = props;\n const titleValue = getValueInPath(\n item.data as Record<string, unknown>,\n titlePropertyKey\n );\n\n return (\n <Card\n onClick={() => onRowClick?.(item.data)}\n className={cls(\n \"p-3\",\n cardClickableMixin,\n props.isDragging && cardSelectedMixin,\n props.isDragging && \"shadow-lg opacity-75\"\n )}\n >\n <Typography variant=\"subtitle2\" noWrap>\n {String(titleValue ?? \"\")}\n </Typography>\n {previewProperties.map(({ key, property }) => {\n const value = getValueInPath(\n item.data as Record<string, unknown>,\n key\n );\n\n if (cellRenderer) {\n const custom = cellRenderer({\n row: item.data,\n propertyKey: key,\n property,\n value,\n size: \"tiny\",\n });\n if (custom !== undefined) {\n return (\n <div key={key} className=\"mt-1\">\n {custom}\n </div>\n );\n }\n }\n\n return (\n <div key={key} className=\"mt-1\">\n <DefaultCellRenderer\n row={item.data}\n propertyKey={key}\n property={property}\n value={value}\n size=\"tiny\"\n />\n </div>\n );\n })}\n </Card>\n );\n }\n return KanbanCard;\n }, [titlePropertyKey, previewProperties, cellRenderer, onRowClick]);\n\n // ── Add item to column ───────────────────────────────────────────\n const handleAddItemToColumn = useCallback(\n (column: string) => {\n onRowCreate?.({ [kanbanProperty]: column });\n },\n [onRowCreate, kanbanProperty]\n );\n\n if (columns.length === 0 && !dataController.loading) {\n return (\n <div className=\"flex items-center justify-center p-8\">\n {emptyComponent ?? (\n <Typography variant=\"body2\" color=\"secondary\">\n No columns available for kanban view.\n </Typography>\n )}\n </div>\n );\n }\n\n return (\n <KanbanView<T, string>\n columns={columns}\n columnLabels={columnLabels as Record<string, string>}\n data={boardItems}\n assignColumn={assignColumn}\n ItemComponent={ItemComponent}\n onAddItemToColumn={onRowCreate ? handleAddItemToColumn : undefined}\n className={className}\n />\n );\n}\n","import React, { useCallback, useMemo, useState } from \"react\";\nimport { cls } from \"../../util\";\nimport { Typography } from \"../../components/Typography\";\nimport { CollectionViewToolbar } from \"./CollectionViewToolbar\";\nimport { CollectionTableView } from \"./CollectionTableView\";\nimport { CollectionCardView } from \"./CollectionCardView\";\nimport { CollectionListView } from \"./CollectionListView\";\nimport { CollectionKanbanView } from \"./CollectionKanbanView\";\nimport type {\n CollectionViewMode,\n CollectionViewSize,\n CollectionPropertyConfig,\n CollectionDataController,\n CellRendererOverride,\n CollectionCustomViewEntry,\n CollectionSelectionController,\n KanbanPropertyOption\n} from \"./CollectionViewTypes\";\n\n/**\n * Props for the headless {@link CollectionView} component.\n *\n * This component is data-agnostic — it renders collection data based on\n * property configurations and callbacks, with ZERO coupling to any entity\n * or data layer.\n *\n * @group Collection View\n */\nexport interface CollectionViewProps<T = Record<string, unknown>> {\n // ── Data ──────────────────────────────────────────────────────────\n\n /**\n * Data controller providing rows, loading state, pagination,\n * filter/sort/search state and setters.\n */\n dataController: CollectionDataController<T>;\n\n /**\n * Property definitions keyed by property key.\n * Drives column rendering, cell formatting, and filter UI.\n */\n properties: Record<string, CollectionPropertyConfig>;\n\n /**\n * Display order of properties. If omitted, uses Object.keys(properties).\n */\n propertiesOrder?: string[];\n\n /**\n * Subset of property keys to actually display as columns.\n * If omitted, all non-hidden properties are shown.\n */\n displayedColumnIds?: string[];\n\n // ── Identity ──────────────────────────────────────────────────────\n\n /** Property key used as row identifier. Default: \"id\" */\n idProperty?: string;\n\n /** Property key used as the display title in card/list views */\n titleProperty?: string;\n\n // ── View configuration ────────────────────────────────────────────\n\n /** Title displayed above the collection. `false` to hide. */\n title?: string | false;\n\n /** Controlled view mode. If omitted, internal state is used. */\n viewMode?: CollectionViewMode;\n\n /** Default view mode when uncontrolled. Default: \"list\" */\n defaultViewMode?: CollectionViewMode;\n\n /** Which view modes are available in the toggle */\n enabledViews?: CollectionViewMode[];\n\n /** Callback when view mode changes */\n onViewModeChange?: (mode: CollectionViewMode) => void;\n\n // ── Size ──────────────────────────────────────────────────────────\n\n /** Controlled size. If omitted, internal state is used. */\n size?: CollectionViewSize;\n\n /** Default size. Default: \"m\" */\n defaultSize?: CollectionViewSize;\n\n /** Callback when size changes */\n onSizeChange?: (size: CollectionViewSize) => void;\n\n // ── Kanban ─────────────────────────────────────────────────────────\n\n /** Property key for kanban column grouping */\n kanbanProperty?: string;\n\n /** Available kanban property options (shown in view toggle) */\n kanbanPropertyOptions?: KanbanPropertyOption[];\n\n /** Callback when kanban column property changes */\n onKanbanPropertyChange?: (property: string) => void;\n\n // ── Interactions ──────────────────────────────────────────────────\n\n /** Called when a row is clicked */\n onRowClick?: (row: T) => void;\n\n /** Called when the \"create\" button is clicked */\n onRowCreate?: (defaults?: Record<string, unknown>) => void;\n\n /** Whether creation is allowed (shows the + button) */\n canCreate?: boolean;\n\n // ── Selection ─────────────────────────────────────────────────────\n\n /** Enable row selection checkboxes */\n selectionEnabled?: boolean;\n\n /** Selection controller */\n selectionController?: CollectionSelectionController<T>;\n\n /** Highlighted items (e.g. recently clicked) */\n highlightedItems?: T[];\n\n /** Callback for bulk delete */\n onMultipleDelete?: (rows: T[]) => void;\n\n // ── Custom rendering ──────────────────────────────────────────────\n\n /**\n * Custom cell renderer override. Return undefined to use default.\n * This is how the connected wrapper injects PropertyPreview.\n */\n cellRenderer?: CellRendererOverride<T>;\n\n /** Custom empty state component */\n emptyComponent?: React.ReactNode;\n\n /**\n * Additional ways to render these rows, keyed by view mode. A key here can\n * be named by `viewMode`, `defaultViewMode` and `enabledViews`, and gets\n * its own entry in the view switcher.\n *\n * A custom view is another rendering of the *same* `dataController`, so it\n * inherits the toolbar's search, the loading state and selection. A\n * component that fetches its own data does not want to be a view mode —\n * the toolbar above it would be describing a query it does not render.\n *\n * @example\n * ```tsx\n * <CollectionView\n * customViews={{ map: { name: \"Map\", Component: MapView } }}\n * enabledViews={[\"table\", \"map\"]}\n * defaultViewMode=\"map\"\n * />\n * ```\n */\n customViews?: Record<string, CollectionCustomViewEntry<T>>;\n\n // ── Toolbar ───────────────────────────────────────────────────────\n\n /** Actions rendered at the start (left) of the toolbar */\n toolbarActionsStart?: React.ReactNode;\n\n /** Actions rendered at the end (right) of the toolbar */\n toolbarActionsEnd?: React.ReactNode;\n\n /** Hide the built-in toolbar entirely */\n hideToolbar?: boolean;\n\n // ── Table-specific ────────────────────────────────────────────────\n\n /** Enable row hover highlight in table view */\n hoverRow?: boolean;\n\n /** Callback when table columns are resized */\n onColumnResize?: (params: { key: string; width: number }) => void;\n\n /** Callback when table columns are reordered */\n onColumnsOrderChange?: (keys: string[]) => void;\n\n // ── Style ─────────────────────────────────────────────────────────\n\n /** CSS class for the outer container */\n className?: string;\n}\n\nconst DEFAULT_ENABLED_VIEWS: CollectionViewMode[] = [\"list\", \"table\", \"cards\", \"kanban\"];\n\n/**\n * A data-agnostic collection view component that orchestrates table, card,\n * list, and kanban views — driven entirely by props.\n *\n * Zero imports from any entity or data layer. This component lives in\n * `@rebasepro/ui` and can be used with any data source.\n *\n * @example\n * ```tsx\n * import { CollectionView } from \"@rebasepro/ui\";\n *\n * <CollectionView\n * dataController={{ data: myRows, loading: false, noMoreToLoad: true }}\n * properties={{\n * name: { type: \"string\", name: \"Name\" },\n * email: { type: \"string\", name: \"Email\" },\n * }}\n * title=\"Contacts\"\n * onRowClick={(row) => openDetail(row.id)}\n * />\n * ```\n *\n * @group Collection View\n */\nexport function CollectionView<T extends Record<string, unknown> = Record<string, unknown>>({\n dataController,\n properties,\n propertiesOrder,\n displayedColumnIds,\n idProperty = \"id\",\n titleProperty,\n title,\n viewMode: viewModeProp,\n defaultViewMode = \"list\",\n enabledViews = DEFAULT_ENABLED_VIEWS,\n onViewModeChange: onViewModeChangeProp,\n size: sizeProp,\n defaultSize = \"m\",\n onSizeChange: onSizeChangeProp,\n kanbanProperty: kanbanPropertyProp,\n kanbanPropertyOptions,\n onKanbanPropertyChange: onKanbanPropertyChangeProp,\n onRowClick,\n onRowCreate,\n canCreate = true,\n selectionEnabled,\n selectionController,\n highlightedItems,\n onMultipleDelete,\n cellRenderer,\n emptyComponent,\n customViews,\n toolbarActionsStart,\n toolbarActionsEnd,\n hideToolbar,\n hoverRow = true,\n onColumnResize,\n onColumnsOrderChange,\n className\n}: CollectionViewProps<T>) {\n\n // ── View mode state (uncontrolled with controlled override) ───────\n\n const [internalViewMode, setInternalViewMode] = useState<CollectionViewMode>(defaultViewMode);\n const viewMode = viewModeProp ?? internalViewMode;\n\n const onViewModeChange = useCallback((mode: CollectionViewMode) => {\n setInternalViewMode(mode);\n onViewModeChangeProp?.(mode);\n }, [onViewModeChangeProp]);\n\n // ── Size state (uncontrolled with controlled override) ────────────\n\n const [internalSize, setInternalSize] = useState<CollectionViewSize>(defaultSize);\n const size = sizeProp ?? internalSize;\n\n const onSizeChange = useCallback((s: CollectionViewSize) => {\n setInternalSize(s);\n onSizeChangeProp?.(s);\n }, [onSizeChangeProp]);\n\n // ── Kanban property state ─────────────────────────────────────────\n\n const [internalKanbanProperty, setInternalKanbanProperty] = useState<string | undefined>(kanbanPropertyProp);\n const kanbanProperty = kanbanPropertyProp ?? internalKanbanProperty;\n\n const onKanbanPropertyChange = useCallback((property: string) => {\n setInternalKanbanProperty(property);\n onKanbanPropertyChangeProp?.(property);\n }, [onKanbanPropertyChangeProp]);\n\n // Auto-detect kanban property if not provided\n const resolvedKanbanProperty = useMemo(() => {\n if (kanbanProperty) return kanbanProperty;\n // Find first enum property\n const order = propertiesOrder ?? Object.keys(properties);\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.enum) {\n return key;\n }\n }\n return undefined;\n }, [kanbanProperty, properties, propertiesOrder]);\n\n // Build kanban property options from properties if not provided\n const resolvedKanbanPropertyOptions = useMemo((): KanbanPropertyOption[] => {\n if (kanbanPropertyOptions) return kanbanPropertyOptions;\n const options: KanbanPropertyOption[] = [];\n const order = propertiesOrder ?? Object.keys(properties);\n for (const key of order) {\n const prop = properties[key];\n if (prop && prop.type === \"string\" && prop.enum) {\n options.push({ key, label: prop.name });\n }\n }\n return options;\n }, [kanbanPropertyOptions, properties, propertiesOrder]);\n\n // ── Render ────────────────────────────────────────────────────────\n\n const sharedProps = {\n dataController,\n properties,\n propertiesOrder,\n idProperty,\n titleProperty,\n onRowClick,\n cellRenderer,\n selectionEnabled,\n selectionController,\n highlightedItems,\n emptyComponent,\n };\n\n // Resolved once so both the switcher and the render path agree. A custom\n // view keyed as a built-in is ignored rather than allowed to shadow it —\n // the switch below checks the built-ins first, so honouring such a key\n // here would put the switcher and the canvas out of step.\n const customViewEntries = useMemo(() => {\n if (!customViews) return [];\n return Object.entries(customViews)\n .filter(([key]) => !DEFAULT_ENABLED_VIEWS.includes(key))\n .map(([key, entry]) => {\n const isBare = typeof entry === \"function\";\n return {\n key,\n name: isBare ? key : (entry.name ?? key),\n icon: isBare ? undefined : entry.icon,\n Component: isBare ? entry : entry.Component\n };\n });\n }, [customViews]);\n\n function renderView() {\n const custom = customViewEntries.find((entry) => entry.key === viewMode);\n if (custom) {\n const { Component } = custom;\n return (\n <Component\n {...sharedProps}\n onRowCreate={canCreate ? onRowCreate : undefined}\n canCreate={canCreate}\n size={size}\n />\n );\n }\n\n switch (viewMode) {\n case \"table\":\n return (\n <CollectionTableView<T>\n {...sharedProps}\n displayedColumnIds={displayedColumnIds}\n size={size}\n hoverRow={hoverRow}\n onColumnResize={onColumnResize}\n onColumnsOrderChange={onColumnsOrderChange}\n />\n );\n case \"cards\":\n return (\n <CollectionCardView<T>\n {...sharedProps}\n size={size}\n />\n );\n case \"kanban\":\n return resolvedKanbanProperty ? (\n <CollectionKanbanView<T>\n {...sharedProps}\n kanbanProperty={resolvedKanbanProperty}\n // `canCreate` is documented as \"whether creation is\n // allowed (shows the + button)\" and was destructured\n // and read nowhere, so the button showed regardless.\n // The kanban view draws its add affordance exactly when\n // it has a callback, so withholding the callback is\n // what the prop means.\n onRowCreate={canCreate ? onRowCreate : undefined}\n />\n ) : (\n <div className=\"flex items-center justify-center p-8\">\n <Typography variant=\"body2\" color=\"secondary\">\n No enum property available for kanban grouping.\n </Typography>\n </div>\n );\n case \"list\":\n default:\n return (\n <CollectionListView<T>\n {...sharedProps}\n size={size}\n />\n );\n }\n }\n\n return (\n <div\n className={cls(\n \"overflow-hidden h-full w-full rounded-md flex flex-col\",\n \"bg-surface-sheet\",\n className\n )}\n >\n {/* Error banner */}\n {dataController.error && dataController.data.length > 0 && (\n <div className=\"flex items-center gap-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 border-b border-red-200 dark:border-red-800 flex-shrink-0\">\n <Typography variant=\"body2\" className=\"text-red-700 dark:text-red-300 flex-1\">\n <strong>Warning:</strong> {dataController.error.message || \"Failed to update data.\"}\n </Typography>\n </div>\n )}\n\n {/* Toolbar */}\n {!hideToolbar && (\n <CollectionViewToolbar\n viewMode={viewMode}\n onViewModeChange={enabledViews.length > 1 ? onViewModeChange : undefined}\n enabledViews={enabledViews}\n customViews={customViewEntries}\n size={size}\n onSizeChange={onSizeChange}\n searchString={dataController.searchString}\n onSearchChange={dataController.setSearchString}\n loading={dataController.loading}\n actionsStart={toolbarActionsStart}\n actionsEnd={toolbarActionsEnd}\n kanbanPropertyOptions={viewMode === \"kanban\" ? resolvedKanbanPropertyOptions : undefined}\n selectedKanbanProperty={resolvedKanbanProperty}\n onKanbanPropertyChange={onKanbanPropertyChange}\n />\n )}\n\n {/* View */}\n <div className=\"flex-1 overflow-hidden\">\n {renderView()}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAa,iBAAiB;CAC1B,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,IAAI;CACJ,OAAO;AACX;;AAGA,IAAa,qBAAqB;CAC9B,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;CACP,IAAI;CACJ,OAAO;AACX;;AAGA,IAAa,sBAAsB;CAC/B,UAAU;CACV,OAAO;CACP,QAAQ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uB,QAAQ,KAAK,CAAC;CAEvD,OAAO,oBAAC,UAAD;EACH,IAAI;EACJ,UAAU;EACV,WAAW,IACP,qDACA,OAAO,eAAe,IACtB,QACA,QACA,QAAQ;YACZ,oBAAC,OAAD;GAAK,KAAK;GACL,WAAW,IACP,OAAO,aAAa,IACpB,mBACA,SACJ;GACA;EACA,CAAA;CACC,CAAA;AAEd;AAQA,IAAa,mBAAmB,MAAM,KAAK,SAAS,iBAAiB,EAChC,UACA,SACA,aACsB;CAEvD,OACI,oBAAC,OAAD;EACI,WAAW,IAAI,0GAA0G,SAAS;EACzH;EACR;CACA,CAAA;AAEb,CAAC;;;AC5FD,IAAa,WAAW;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;AC/4DA,IAAa,eAAyB;CAClC;CAAS;CACT;CAAS;CAAmB;CAAc;CAAU;CACpD;CAAgB;CAAyB;CAAQ;CACjD;CAAY;CAAQ;CAAY;CACh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