@burojs/ui-shadcn 0.8.0 → 0.9.0

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.
Files changed (115) hide show
  1. package/dist/{candidates-relation-picker-CGXItMN0.js → candidates-relation-picker-QvoY2bOQ.js} +3 -3
  2. package/dist/{candidates-relation-picker-CGXItMN0.js.map → candidates-relation-picker-QvoY2bOQ.js.map} +1 -1
  3. package/dist/{candidates-relation-picker-C47mF260.cjs → candidates-relation-picker-pEAWKQEY.cjs} +3 -3
  4. package/dist/{candidates-relation-picker-C47mF260.cjs.map → candidates-relation-picker-pEAWKQEY.cjs.map} +1 -1
  5. package/dist/{check-confirm-dialog-CtiRzOAt.js → check-confirm-dialog-B-CbJTln.js} +59 -6
  6. package/dist/{check-confirm-dialog-CtiRzOAt.js.map → check-confirm-dialog-B-CbJTln.js.map} +1 -1
  7. package/dist/{check-confirm-dialog-BT04Mieo.cjs → check-confirm-dialog-W-8WOmGh.cjs} +64 -5
  8. package/dist/{check-confirm-dialog-BT04Mieo.cjs.map → check-confirm-dialog-W-8WOmGh.cjs.map} +1 -1
  9. package/dist/{filter-builder-z3Axzf9Y.js → filter-builder-04nas3eq.js} +14 -6
  10. package/dist/filter-builder-04nas3eq.js.map +1 -0
  11. package/dist/{filter-builder-ByGhxLf_.cjs → filter-builder-DQX-TMFh.cjs} +14 -6
  12. package/dist/filter-builder-DQX-TMFh.cjs.map +1 -0
  13. package/dist/{flow-runtime-DrUWyTS0.js → flow-runtime-BEIyym7d.js} +3 -3
  14. package/dist/{flow-runtime-DrUWyTS0.js.map → flow-runtime-BEIyym7d.js.map} +1 -1
  15. package/dist/{flow-runtime-BVFjMU5-.cjs → flow-runtime-DyNIYfUP.cjs} +3 -3
  16. package/dist/{flow-runtime-BVFjMU5-.cjs.map → flow-runtime-DyNIYfUP.cjs.map} +1 -1
  17. package/dist/{flow-screen-3fk6J33y.js → flow-screen-DY1Z9PbG.js} +53 -14
  18. package/dist/flow-screen-DY1Z9PbG.js.map +1 -0
  19. package/dist/{flow-screen-6y5E_HT6.cjs → flow-screen-FE5Xhb3t.cjs} +52 -13
  20. package/dist/flow-screen-FE5Xhb3t.cjs.map +1 -0
  21. package/dist/index.cjs +54 -71
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +49 -10
  24. package/dist/index.d.ts +49 -10
  25. package/dist/index.js +54 -72
  26. package/dist/index.js.map +1 -1
  27. package/dist/{inline-flow-host-YnnvWjdU.js → inline-flow-host-D6u-RlsV.js} +3 -3
  28. package/dist/{inline-flow-host-YnnvWjdU.js.map → inline-flow-host-D6u-RlsV.js.map} +1 -1
  29. package/dist/{inline-flow-host-C4KmZIYE.cjs → inline-flow-host-yVLo6-sM.cjs} +3 -3
  30. package/dist/{inline-flow-host-C4KmZIYE.cjs.map → inline-flow-host-yVLo6-sM.cjs.map} +1 -1
  31. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js → lazy-relation-picker-dialog-BaORufxQ.js} +2 -2
  32. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js.map → lazy-relation-picker-dialog-BaORufxQ.js.map} +1 -1
  33. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs → lazy-relation-picker-dialog-C_VlGlDz.cjs} +2 -2
  34. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs.map → lazy-relation-picker-dialog-C_VlGlDz.cjs.map} +1 -1
  35. package/dist/{page-flow-route-CtEfqAvU.js → page-flow-route-CyMzUidK.js} +7 -7
  36. package/dist/page-flow-route-CyMzUidK.js.map +1 -0
  37. package/dist/{page-flow-route-DEjAxHe3.cjs → page-flow-route-OFx7h7Ja.cjs} +6 -6
  38. package/dist/page-flow-route-OFx7h7Ja.cjs.map +1 -0
  39. package/dist/{place-node-Bhl8B3fF.cjs → place-node-BZF5Af6x.cjs} +67 -23
  40. package/dist/place-node-BZF5Af6x.cjs.map +1 -0
  41. package/dist/{place-node-BdxT-30h.js → place-node-DRjmJGQ_.js} +69 -25
  42. package/dist/place-node-DRjmJGQ_.js.map +1 -0
  43. package/dist/{related-list-cards-BvkD5OcC.js → related-list-cards-2hLitVkg.js} +3 -3
  44. package/dist/{related-list-cards-BvkD5OcC.js.map → related-list-cards-2hLitVkg.js.map} +1 -1
  45. package/dist/{related-list-cards-Bc_vfCE_.cjs → related-list-cards-xVvgSlu-.cjs} +3 -3
  46. package/dist/{related-list-cards-Bc_vfCE_.cjs.map → related-list-cards-xVvgSlu-.cjs.map} +1 -1
  47. package/dist/{related-list-timeline-DCrwN9oO.js → related-list-timeline-CxJqe6eK.js} +4 -4
  48. package/dist/related-list-timeline-CxJqe6eK.js.map +1 -0
  49. package/dist/{related-list-timeline-k0DtnxTs.cjs → related-list-timeline-Dsf5WewG.cjs} +4 -4
  50. package/dist/related-list-timeline-Dsf5WewG.cjs.map +1 -0
  51. package/dist/{related-rows-BW9Jr07T.cjs → related-rows-DDhp9axl.cjs} +4 -4
  52. package/dist/{related-rows-BW9Jr07T.cjs.map → related-rows-DDhp9axl.cjs.map} +1 -1
  53. package/dist/{related-rows-CPE-9FFr.js → related-rows-DL6CWsrj.js} +4 -4
  54. package/dist/{related-rows-CPE-9FFr.js.map → related-rows-DL6CWsrj.js.map} +1 -1
  55. package/dist/{relation-create-C43cdPQt.js → relation-create-6WicROWA.js} +33 -5
  56. package/dist/relation-create-6WicROWA.js.map +1 -0
  57. package/dist/{relation-create-DDEYcKfw.cjs → relation-create-_SFuPQGM.cjs} +37 -3
  58. package/dist/relation-create-_SFuPQGM.cjs.map +1 -0
  59. package/dist/{relation-many-picker-Br-zBHxT.cjs → relation-many-picker-BBNsmkaX.cjs} +12 -10
  60. package/dist/relation-many-picker-BBNsmkaX.cjs.map +1 -0
  61. package/dist/{relation-many-picker-BlrGRwMV.js → relation-many-picker-mGEQDWo2.js} +12 -10
  62. package/dist/relation-many-picker-mGEQDWo2.js.map +1 -0
  63. package/dist/{relation-picker-x7P5HKie.js → relation-picker-BbO41cFV.js} +13 -10
  64. package/dist/relation-picker-BbO41cFV.js.map +1 -0
  65. package/dist/{relation-picker-dialog-CyKliBkN.js → relation-picker-dialog-BgSG_8bU.js} +5 -5
  66. package/dist/relation-picker-dialog-BgSG_8bU.js.map +1 -0
  67. package/dist/{relation-picker-dialog-DimVQF9Y.cjs → relation-picker-dialog-Duqy2r0n.cjs} +5 -5
  68. package/dist/relation-picker-dialog-Duqy2r0n.cjs.map +1 -0
  69. package/dist/{relation-picker-ADjxI_TI.cjs → relation-picker-jk9D_uwn.cjs} +13 -10
  70. package/dist/relation-picker-jk9D_uwn.cjs.map +1 -0
  71. package/dist/{relation-select-Cr3CfNLy.cjs → relation-select-C3aV18kT.cjs} +2 -2
  72. package/dist/{relation-select-Cr3CfNLy.cjs.map → relation-select-C3aV18kT.cjs.map} +1 -1
  73. package/dist/{relation-select-B8Fq4o-t.js → relation-select-CjQT9LpS.js} +2 -2
  74. package/dist/{relation-select-B8Fq4o-t.js.map → relation-select-CjQT9LpS.js.map} +1 -1
  75. package/dist/{resource-page-router-BRpUnhay.js → resource-page-router-CzaNATSp.js} +71 -19
  76. package/dist/resource-page-router-CzaNATSp.js.map +1 -0
  77. package/dist/{resource-page-router-qEd2xb55.cjs → resource-page-router-dmVIeu5s.cjs} +81 -17
  78. package/dist/resource-page-router-dmVIeu5s.cjs.map +1 -0
  79. package/dist/{success-notices-Dl3M1fZP.cjs → success-notices-Cl4b6MLQ.cjs} +3 -2
  80. package/dist/success-notices-Cl4b6MLQ.cjs.map +1 -0
  81. package/dist/{success-notices-LDEgEkc4.js → success-notices-CrcWOGSo.js} +3 -2
  82. package/dist/success-notices-CrcWOGSo.js.map +1 -0
  83. package/dist/{use-dialog-filter-state-B_MqzHaT.js → use-dialog-filter-state-CJoeY-1j.js} +2 -2
  84. package/dist/{use-dialog-filter-state-B_MqzHaT.js.map → use-dialog-filter-state-CJoeY-1j.js.map} +1 -1
  85. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs → use-dialog-filter-state-lsTJxrB4.cjs} +2 -2
  86. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs.map → use-dialog-filter-state-lsTJxrB4.cjs.map} +1 -1
  87. package/dist/{use-record-subtitle-bfwIoUme.cjs → use-record-subtitle-BJ9rnj6F.cjs} +5 -8
  88. package/dist/use-record-subtitle-BJ9rnj6F.cjs.map +1 -0
  89. package/dist/{use-record-subtitle-gIaCGgbI.js → use-record-subtitle-w3ZhXNlf.js} +5 -8
  90. package/dist/use-record-subtitle-w3ZhXNlf.js.map +1 -0
  91. package/package.json +9 -9
  92. package/dist/filter-builder-ByGhxLf_.cjs.map +0 -1
  93. package/dist/filter-builder-z3Axzf9Y.js.map +0 -1
  94. package/dist/flow-screen-3fk6J33y.js.map +0 -1
  95. package/dist/flow-screen-6y5E_HT6.cjs.map +0 -1
  96. package/dist/page-flow-route-CtEfqAvU.js.map +0 -1
  97. package/dist/page-flow-route-DEjAxHe3.cjs.map +0 -1
  98. package/dist/place-node-BdxT-30h.js.map +0 -1
  99. package/dist/place-node-Bhl8B3fF.cjs.map +0 -1
  100. package/dist/related-list-timeline-DCrwN9oO.js.map +0 -1
  101. package/dist/related-list-timeline-k0DtnxTs.cjs.map +0 -1
  102. package/dist/relation-create-C43cdPQt.js.map +0 -1
  103. package/dist/relation-create-DDEYcKfw.cjs.map +0 -1
  104. package/dist/relation-many-picker-BlrGRwMV.js.map +0 -1
  105. package/dist/relation-many-picker-Br-zBHxT.cjs.map +0 -1
  106. package/dist/relation-picker-ADjxI_TI.cjs.map +0 -1
  107. package/dist/relation-picker-dialog-CyKliBkN.js.map +0 -1
  108. package/dist/relation-picker-dialog-DimVQF9Y.cjs.map +0 -1
  109. package/dist/relation-picker-x7P5HKie.js.map +0 -1
  110. package/dist/resource-page-router-BRpUnhay.js.map +0 -1
  111. package/dist/resource-page-router-qEd2xb55.cjs.map +0 -1
  112. package/dist/success-notices-Dl3M1fZP.cjs.map +0 -1
  113. package/dist/success-notices-LDEgEkc4.js.map +0 -1
  114. package/dist/use-record-subtitle-bfwIoUme.cjs.map +0 -1
  115. package/dist/use-record-subtitle-gIaCGgbI.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["DocMarkdown","lazy","DocFaq","useDocPanel","useDocsConfig","useLocale","useOptionalT","useRef","useMemo","useDocScopes","useState","useCallback","cn","Button","IconArrowLeft","IconBook2","IconMinimize","IconMaximize","IconX","IconLoader2","Suspense","useDocScopes","useDocPanel","useOptionalT","cn","IconHelpHexagon","lazy","useApp","useDocsConfig","useI18nCaps","useOptionalT","useState","useDocumentedScopes","useMemo","resolveConceptLabel","resolveEnumLabel","resolveResourceLabel","resolveDoc","useRef","useDocTopics","cn","IconBook2","IconChevronDown","IconSearch","Input","IconArrowUpRight","readDocHash","scrollToDocAnchor","Suspense","useOptionalT","useDocPanel","useDocumentedScopes","useMemo","useDocScopes","CommandGroup","CommandItem","IconBook2","useState","React","SeparatorPrimitive","cn","React","TooltipProvider","cn","useOptionalT","Sheet","SheetContent","SheetTitle","SheetDescription","Button","IconLayoutSidebar","Input","Slot","cva","Tooltip","TooltipTrigger","TooltipContent","Skeleton","AlertDialogPrimitive","React","cn","buttonVariants","useRegisterNavigationGuardDialog","useNavigationGuardText","useOptionalT","useRef","useOptionalT","useState","TooltipProvider","useShell","useShell","useLinkComponent","React","AvatarPrimitive","cn","useLocale","useContext","I18nContext","useChangeLocale","useLanguageStorageKey","useMemo","useCallback","useOptionalT","useContext","I18nContext","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","useMemo","THEME_CHOICES","useOptionalT","useTheme","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","IconSun","IconMoon","IconDeviceDesktop","Button","useMemo","useOptionalAuthController","useShell","useRouterAdapter","useCallback","useIdentity","useLogout","useMemo","DropdownMenuLabel","Separator","DropdownMenuSeparator","useLinkComponent","DropdownMenuItem","useOptionalT","IconLogout","useShell","useRouterAdapter","IconLogin","Children","isValidElement","Fragment","cloneElement","THEME_CHOICES","Skeleton","DropdownMenuContent","IconUser","Button","DropdownMenu","DropdownMenuTrigger","IconSelector","CollapsiblePrimitive","warned","C","hasIcon","Icon","useContext","ComponentsContext","useCallback","canonicalNavKey","nodeKind","navHrefFor","resolveNavLabel","declaredText","resolveResourceNavLabel","useOptionalRouterAdapter","useApp","useI18nCaps","useResourceVisible","useLayoutResolver","useMatch","useNavVisible","usePageAllowed","nodeKind","hasListPage","hrefFor","canonicalResourceKey","resolveResourceNavLabel","resolveNavLabel","canonicalNavKey","declaredText","isCustomPageDef","navHrefFor","useRef","useState","useCallback","IconChevronRight","useApp","useTestIds","useT","useLinkComponent","useOriginIntent","useApp","useI18nCaps","useNavVisible","useMatch","useLayoutResolver","NavChromeMountedProvider","canonicalNavKey","IconChevronRight","useApp","routeResourceKey","useTestIds","useOptionalT","useLinkComponent","useI18nCaps","useOriginIntent","useDocTrailScopes","cn","canonicalResourceKey","hrefFor","resolveResourceLabel","hasListPage","useTrailContext","useMatch","useApplicationSnapshot","recordTrailRoute","usePublishedRecordTrail","recordTrailKey","useRecordTitle","useNavigationOrigin","originTrail","useDocTrailScopes","effectiveFlow","recordTrail","BUILTIN_LAYOUTS","useTestIds","useOptionalT","useChromeT","humanizeKey","cn","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","useScope","useResourceDimensionOptions","useTestIds","useChromeT","useMemo","humanizeKey","cn","FacetedFilterPicker","useOptionalT","useTestIds","cn","Button","useTrailContext","useMatch","recordTrailRoute","headerTrail","createContext","useContext","useCallback","useOptionalT","useState","useMemo","useRef","CommandDialog","CommandInput","CommandList","CommandEmpty","useOptionalT","useShell","cn","useApp","useI18nCaps","useVisibilityCtx","useOptionalT","useRouteNavigate","useNavVisible","useLayoutResolver","useResourceVisible","usePageAllowed","evaluateVisible","useMemo","hasListPage","canonicalNavKey","isCustomPageDef","resolveResourceLabel","canonicalResourceKey","resolveNavLabel","declaredText","CommandGroup","hrefFor","CommandItem","cn","navHrefFor","nodeKind","Fragment","CommandSeparator","resolveStaticAvailability","recordEntries","recordRouteAvailable","hrefFor","useApp","useOptionalT","useRouteNavigate","useQuick","useCurrentUserId","useResourceVisible","usePlatformStorage","useState","readRecentRecords","useMemo","useCommandState","Fragment","CommandGroup","CommandSeparator","useI18nCaps","useListAccess","resolveResourceLabel","RECENT_LABEL_KEYS","CommandItem","lowerLegacyField","useApp","useOptionalT","useRouteNavigate","useQuick","useResourceVisible","useCommandState","useDebouncedValue","useMemo","isShowAvailable","canonicalResourceKey","CommandGroup","useI18nCaps","useListAccess","useList","useRowSubtitle","resolveResourceLabel","resourceShowHref","CommandItem","resolveNavLabel","resolveContentSlot","useOptionalT","useI18nCaps","useAppActions","usePresentBlock","useRouteNavigate","useMemo","useRef","isExternalHref","CommandGroup","CommandItem","cn","useI18nCaps","useApp","useResourceVisible","useAvailabilityGate","useOptionalT","useRouteNavigate","useQuick","useMemo","hasListPage","canonicalResourceKey","hasRecordPage","resolveResourceLabel","CommandGroup","resourceCreateHref","CommandItem","useT","useRefresh","Button","cn","IconRefresh","useAppActions","useI18nCaps","useLinkComponent","resolveNavLabel","Icon","Button","reasonText","useT","useLinkComponent","IconHelp","Button","cn","React","cn","z","useTestIds","useOptionalT","useI18nCaps","useForm","zodResolver","useState","technicalText","toFriendlyError","friendlyStringsFrom","resolveErrorText","cn","Label","Input","IconAlertCircle","Button","IconLoader2","cn","isEmpty","useOptionalT","React","Icon","cn","EnumSettlingRow","enumBindingKey","useApp","useOptionalT","useI18nCaps","useEnumValues","useAvailableEnumValues","Select","SelectTrigger","SelectValue","SelectContent","LoadError","resolveEnumLabel","enumValueText","resolveDoc","unknownEnumValueLabel","SelectItem","EnumSettlingRow","isEnumControl","ENUM_CONTROLS","useOptionalT","Checkbox","useOptionalLocale","useFieldTimeZone","useTimeZone","Skeleton","formatTimeValue","localeTag","dateDisplayParams","isCalendarDate","zoneShortName","canonicalInstant","epochMsToInstant","toLocalDateTimeText","fromLocalDateTimeText","Input","useOptionCaps","useBoundEnum","resolveOptionLabel","Icon","useOptionalT","enumNamespaceOf","useFieldMetaSources","useAvailableEnumValues","narrowEntriesOf","resolveDoc","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","EnumSettlingRow","useOptionalFileStorage","React","useFileUrls","isImage","useOptionalT","useFileField","React","cn","IconUpload","formatBytes","useFileUrls","isImage","IconLoader2","Button","IconRotate","IconX","React","cn","toDisplayText","useOptionalT","React","lazy","Suspense","Skeleton","lazy","useOptionalT","Suspense","useOptionalLocale","formatNumber","Input","cn","useChromeT","Button","IconArrowUp","IconArrowDown","IconTrash","IconPlus","isRecord","normalizeEntityRef","useApp","useOptionalT","useTestIds","declaredField","linkOf","useLinkKeys","useState","useCallback","useMemo","LoadError","useEntryGate","resourceKey","RelationDisplay","useRelatedRecord","toDisplayText","Input","toDisplayText","optionFieldName","fieldOptionText","formatEntityRef","createElement","enumBindingKey","useOptionalApp","useFieldMetaSources","enumParamsOf","narrowEntriesOf","EnumBadge","RelationDisplay","RelationPickerInput","ScreenStateProvider","useFormController","useMemo","ScreenTree","EnumDisplay","enumBindingKey","useApp","useI18nCaps","useEnumValues","EnumBadge","enumFallbackText","resolveContentSlot","enumFallbackKey","resolveEnumLabel","enumValueText","Icon","useState","useRef","Input","cn","DataTableFacetedFilter","readRange","normalize","cn","Input","cn","Input","useChromeT","useState","useRef","cn","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","Input","useState","useChromeT","Popover","PopoverTrigger","Button","cn","IconDots","PopoverContent","cn","Input","Button","IconX","useApplicationSnapshot","useProjectedRecord","useMemo","compilePageScreen","snapshotBlockLookup","snapshotFrameLookup","snapshotAppFrames","Skeleton","isScreenFailure","RecordState","RouteSourceContext","PlannedBody","isRelationField","dtoFields","peekFieldDefinition","peekLeafAllowed","normalizeDataError","PeekContext","useApp","useMemo","dtoFields","useOne","useList","technicalText","relationAmbiguousError","useTestIds","useOptionalT","useChromeT","Skeleton","Button","useApplicationSnapshot","compiledScreenFor","builtinFrames","useFrameImplementations","resolveFrameView","formatEntityRef","useFrameT","useCapabilityResolver","projectDto","useFieldAccess","useCallback","peekRecord","peekRow","useContext","PeekHostContext","useUIInstance","useQuickOpener","peekAnchorOpener","shadcnFrameViews","Suspense","recordDisplayName","useRecordSubtitle","useFormController","peekLeafAllowed","ScreenTree","QUICK_ANCHOR_ATTRIBUTE","useI18nCaps","useProjectedRecord","columnName","peekFieldDefinition","resolveFieldLabel","declaredText","FieldValueFrame","ResolvedFieldDisplay","toDisplayText","RecordScopeChain","NO_RECORD_SCOPE_FRAMES","RecordState","useRouteRecordId","InvalidRouteId","useApp","useMemo","dtoFields","useOne","retryRecordRead","LoadError","useEntryGate","useQuickEntry","useProjectedTitle","canonicalResourceName","routeResourceKey","useUIInstance","useUIPresentationRuntime","useDispatcherEffects","useRef","DispatcherProvider","RouteSourceContext","QuickScreenClaimContext","RecordScreen","useApp","useI18nCaps","useOptionalT","resolveResourceTitle","resolveResourceLabel","useQuickEntry","useUIInstance","useTestIds","useLinkComponent","useContext","OwnTitleContext","hasRecordPage","resourceShowHref","Button","IconArrowLeft","DialogPrimitive","IconExternalLink","IconX","useSyncExternalStore","useQuickEntryValue","useTestIds","useRef","QuickEntryContext","humanizeKey","useMemo","useUIInstance","DialogPresentationShell","useUIInstance","useState","useRef","useCallback","useMemo","Popover","PopoverAnchor","PopoverContent","PeekHostContext","useUIInstance","SheetPresentationShell","useLoaded","loadFlowScreen","FlowLoadFailed","OwnTitleHeading","IconLoader2","FlowBoundary","FormProvider","React","Controller","useFormContext","cn","Label","Slot","cn","useOptionalT","useTestIds","taskRunOutcome","taskRunFraction","useOptionalT","useLocale","useOptionalDataRuntime","useMemo","useCommandPalette","useMemo","ShellProvider","useOptionalT","useState","IconLoader2","IconSelector","DropdownMenuContent","DropdownMenuLabel","DropdownMenuItem","IconCheck","DropdownMenuSeparator","DropdownMenu","DropdownMenuTrigger"],"sources":["../src/doc/doc-panel.tsx","../src/doc/doc-trail-help.tsx","../src/doc/doc-browser.tsx","../src/layout/command-palette-docs-group.tsx","../src/lib/use-mobile.ts","../src/primitives/separator.tsx","../src/primitives/sidebar.tsx","../src/primitives/alert-dialog.tsx","../src/layout/navigation-guard-dialog.tsx","../src/layout/app-layout.tsx","../src/shell/brand-tile.tsx","../src/shell/brand-mark.tsx","../src/shell/sidebar-brand.tsx","../src/shell/slot.ts","../src/primitives/avatar.tsx","../src/shell/use-language-switch.ts","../src/shell/language-submenu.tsx","../src/shell/theme-controls.tsx","../src/shell/use-current-user.ts","../src/shell/user-menu.tsx","../src/primitives/collapsible.ts","../src/shell/use-nav-icon.tsx","../src/layout/build-nav-items.ts","../src/layout/use-nav-tree.ts","../src/layout/nav-main.tsx","../src/layout/app-sidebar.tsx","../src/layout/nav-chrome.tsx","../src/layout/breadcrumbs.tsx","../src/layout/record-breadcrumbs.tsx","../src/layout/default-nav-layouts.ts","../src/layout/context-picker.tsx","../src/layout/scope-dimension-picker.tsx","../src/layout/language-switch.tsx","../src/layout/header-breadcrumbs.tsx","../src/layout/command-palette.tsx","../src/layout/command-palette-trigger.tsx","../src/layout/command-palette-navigation-groups.tsx","../src/layout/quick-targets.ts","../src/layout/command-palette-recent-group.tsx","../src/layout/command-palette-records-group.tsx","../src/layout/command-palette-actions-group.tsx","../src/layout/command-palette-create-group.tsx","../src/shell/refresh-button.tsx","../src/shell/app-actions.tsx","../src/shell/help-button.tsx","../src/layout/app-header.tsx","../src/primitives/card.tsx","../src/auth/login-form.tsx","../src/auth/auth-page.tsx","../src/enum/enum-choice-group.tsx","../src/enum/enum-picker.tsx","../src/enum/resolve-enum-control.ts","../src/forms/issue-severity.ts","../src/fields/boolean.tsx","../src/fields/date.tsx","../src/fields/enum.tsx","../src/fields/file-display.tsx","../src/fields/file.tsx","../src/primitives/textarea.tsx","../src/fields/json.tsx","../src/fields/lazy-relation-many.tsx","../src/fields/lazy-rich-text.tsx","../src/fields/number.tsx","../src/fields/object-group.tsx","../src/fields/repeater.tsx","../src/fields/link-keys-display.tsx","../src/fields/relation-meta-schema.ts","../src/fields/text.tsx","../src/fields/textarea.tsx","../src/fields/default-renderers.ts","../src/forms/declarative-display.tsx","../src/enum/enum-display.tsx","../src/data-table/data-table-text-filter.tsx","../src/data-table/data-table-enum-filter.tsx","../src/data-table/data-table-num-range-filter.tsx","../src/data-table/data-table-date-range-filter.tsx","../src/data-table/data-table-operator-filter.tsx","../src/data-table/data-table-row-actions.tsx","../src/data-table/data-table-toolbar.tsx","../src/ui-presentations/block-screen.tsx","../src/quick/peek-fields.ts","../src/quick/peek-screen.tsx","../src/quick/quick-body.tsx","../src/quick/quick-header.tsx","../src/quick/quick-screen.tsx","../src/ui-presentations/copy.ts","../src/ui-presentations/dialog-host.tsx","../src/ui-presentations/popover-host.tsx","../src/ui-presentations/sheet-host.tsx","../src/ui-presentations/index.tsx","../src/primitives/form.tsx","../src/primitives/progress.tsx","../src/tasks/task-run-panel.tsx","../src/lib/spacing.ts","../src/shell/default-command-palette.tsx","../src/shell/app-shell.tsx","../src/shell/scope-switcher.tsx","../src/index.ts"],"sourcesContent":["'use client';\n\nimport {\n type DocTopicView,\n useDocPanel,\n useDocScopes,\n useDocsConfig,\n useLocale,\n useOptionalT,\n} from '@burojs/react';\nimport {\n IconArrowLeft,\n IconBook2,\n IconLoader2,\n IconMaximize,\n IconMinimize,\n IconX,\n} from '@tabler/icons-react';\nimport { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\n\n/**\n * The markdown stack (~54 kB gzip) is reached through `React.lazy`, so an app\n * whose users never open an article never downloads it. `React.lazy` and NOT\n * `next/dynamic`: this is a published library and must not import from any\n * framework — the package stays router- and bundler-agnostic.\n */\nconst DocMarkdown = lazy(() =>\n import('../markdown/index.js').then((m) => ({ default: m.DocMarkdown })),\n);\nconst DocFaq = lazy(() => import('../markdown/index.js').then((m) => ({ default: m.DocFaq })));\n\n/** Kept in step with the `duration-200` classes below — see the open/close note. */\nconst PANEL_TRANSITION_MS = 200;\n\nexport interface DocPanelProps {\n className?: string;\n}\n\n/**\n * The documentation panel: one instance, mounted in the layout, driven by a\n * store that `<DocInfo>` buttons anywhere in the tree can push to.\n *\n * **Non-modal, and it displaces rather than covers.** The existing `Sheet`\n * primitive is a modal Radix Dialog with a `bg-overlay/80` overlay and a 384px\n * cap — under it the form is dimmed and inert, which defeats the single reason\n * this panel exists: being readable WHILE the reader works. So it is its own\n * component, a sibling column that the content area gives width to.\n *\n * **Sticky across navigation.** Its content changes only when the reader\n * changes it — a different «i», a link inside the panel, or closing it. The\n * alternative (follow the page) was rejected because it would yank the article\n * away mid-sentence the moment the reader navigated to do what it described.\n */\nexport function DocPanel({ className }: DocPanelProps): React.ReactElement | null {\n const { open, target, returnFocusTo, goTo, close } = useDocPanel();\n const config = useDocsConfig();\n const locale = useLocale();\n const t = useOptionalT();\n /*\n `close()` clears the target, so by the time the exit transition should run\n there is nothing left to render — the panel vanished instantly however\n carefully the animation was set up. The last target is held so the closing\n frames still have content to slide away, and EVERYTHING below reads the\n held value: deriving the scopes from the live one emptied the topic list\n the moment Close was pressed, so the panel slid out blank.\n */\n const lastTarget = useRef(target);\n if (target) lastTarget.current = target;\n const shownTarget = target ?? lastTarget.current;\n\n const scopes = useMemo(() => shownTarget?.scopes ?? [], [shownTarget]);\n const groups = useDocScopes(scopes);\n const containerRef = useRef<HTMLElement | null>(null);\n\n const activeId = shownTarget?.topicId;\n const activeScope = shownTarget?.scope ?? scopes[0];\n const all = useMemo(() => groups.flatMap((g) => g.topics), [groups]);\n const active =\n activeId === undefined\n ? undefined\n : all.find((x) => x.id === activeId && x.scope === activeScope);\n\n /*\n One article across the whole trail → skip the list and open it.\n Deliberately decided HERE and not in the button: if the affordance itself\n branched on the count, it would change behaviour the day a second article\n is written. The control always means \"open help\"; this is only about not\n showing a list of one.\n */\n const soleTopic = all.length === 1 ? all[0] : undefined;\n const shown = active ?? (activeId === undefined ? soleTopic : undefined);\n\n // Focus goes to the container, not to the first control: a static element at\n // the start lets a screen reader announce the panel's structure instead of\n // reading out \"button, Close\".\n useEffect(() => {\n if (open) containerRef.current?.focus();\n }, [open]);\n\n /*\n Reading mode: the panel covers the window instead of taking a slice of it.\n\n The rail's slot in the flex row is KEPT while maximized, and only the inner\n column goes `fixed`. That is the whole point of the feature as asked for:\n the page underneath must not reflow, so nothing it holds — a scroll\n position, an open menu, a half-filled form, a running table selection —\n gets torn down and rebuilt just because someone wanted to read.\n */\n const [maximized, setMaximized] = useState(false);\n\n const handleClose = useCallback(() => {\n // Reset the mode, or the next open would arrive covering the window with\n // no memory of having been asked to.\n setMaximized(false);\n close();\n if (returnFocusTo && typeof document !== 'undefined') {\n // By id, never by a stored node: the trigger's element is remounted by\n // any re-render of the form it sits in, and a stale node would swallow\n // the focus silently.\n const el = document.querySelector<HTMLElement>(`[data-testid=\"${returnFocusTo}\"]`);\n el?.focus();\n }\n }, [close, returnFocusTo]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n e.stopPropagation();\n /*\n Escape unwinds ONE step at a time. Maximized → back to the rail; from\n the rail → closed. Collapsing straight to nothing would make the key\n destroy two states at once, and the reader who only wanted their page\n back would have to re-open the panel and find their article again.\n */\n if (maximized) {\n setMaximized(false);\n return;\n }\n handleClose();\n };\n document.addEventListener('keydown', onKey);\n return () => document.removeEventListener('keydown', onKey);\n }, [open, handleClose, maximized]);\n\n /*\n OPENING AND CLOSING ARE ANIMATED, the same way the navigation sidebar does\n it: the element stays in flow and its WIDTH transitions, so the content\n column is pushed aside smoothly instead of jumping.\n\n Two pieces of bookkeeping are unavoidable for that.\n\n `rendered` keeps the panel in the tree for the length of the close\n transition — unmounting on the click would animate nothing, there would be\n no element left to animate. It is cleared on a timer matched to the\n duration below.\n\n `expanded` flips one frame AFTER mount. A transition needs two values to\n interpolate between, and React commits the open state in the same frame the\n element appears — so without the `requestAnimationFrame` the panel is born\n at its final width and simply pops.\n */\n const [rendered, setRendered] = useState(false);\n const [expanded, setExpanded] = useState(false);\n useEffect(() => {\n if (open) {\n /*\n Opening needs no frame juggling at all: the panel mounts at its final\n width and a CSS KEYFRAME animation plays it out from zero. See\n `@keyframes doc-panel-in` for why a transition cannot do that job.\n */\n setRendered(true);\n setExpanded(true);\n return;\n }\n setExpanded(false);\n const timer = setTimeout(() => setRendered(false), PANEL_TRANSITION_MS);\n return () => clearTimeout(timer);\n }, [open]);\n\n if (!rendered || !shownTarget || !config) return null;\n\n return (\n <aside\n ref={containerRef}\n tabIndex={-1}\n /*\n No explicit role: `<aside>` ALREADY exposes `complementary`, and\n restating it is redundant. The element choice is the decision — the\n panel is persistent and non-modal, so announcing it as a `dialog` would\n promise a focus trap and a modal contract it deliberately does not have.\n */\n aria-label={t('docPanel.title', { defaultValue: 'Help' })}\n data-testid=\"doc-panel\"\n className={cn(\n // Displaces on desktop; on a narrow screen a side column is not\n // survivable, so it becomes a bottom sheet.\n 'flex flex-col border-border bg-background text-foreground focus:outline-hidden',\n 'fixed inset-x-0 bottom-0 z-40 h-[70vh] rounded-t-xl border-t shadow-2xl',\n /*\n A FULL-HEIGHT RAIL, not a column under the header.\n\n The panel is a sibling of `SidebarInset` in the shell, so it is simply\n a flex item of the same row as the whole application — full height,\n and the header shrinks beside it instead of running on above it. No\n sticky positioning is needed for that any more: the shell owns a real\n height (`h-svh` on the wrapper), so this is bounded by construction\n and scrolls internally.\n\n Widths in PIXELS rather than rem, so the documentation reading column\n stays deliberate if an adopter customizes the root font size. It grows\n on a big screen — a fixed 360px next to a 2560px window spends the\n extra room on nothing, and documentation is the one panel where a\n longer measure is a real gain.\n */\n /*\n `md:relative` is load-bearing: the base classes make this `fixed` for\n the phone bottom-sheet, and a fixed element is OUT OF FLOW — it\n floats over the app and displaces nothing. The old `md:sticky`\n happened to override that; removing it left the panel covering the\n content instead of pushing it, with every other style looking right.\n */\n 'md:relative md:inset-x-auto md:bottom-auto md:z-auto md:h-full md:shrink-0',\n /*\n The animating box: it clips, so the fixed-width column inside slides\n into view rather than reflowing as the width changes.\n\n ONE `transition-[…]` covering both properties, NOT two classes.\n `cn()` is tailwind-merge and every `transition-*` utility is a single\n group, so a later `transition-transform` silently deletes an earlier\n `transition-[width]` — the panel then snapped open with both classes\n sitting in the list looking correct. The same merge rule already cost\n this codebase the popover's `max-width`.\n */\n 'overflow-hidden transition-[width,transform] duration-200 ease-out',\n /*\n ONE `clamp`, not a ladder of breakpoints. Three stepped widths\n (`md:` / `2xl:` / `3xl:`) all carry the same specificity, and Tailwind\n emitted the widest one's media block BEFORE the others — so at 1900px\n the 440px rule, being later in the file, won. Both classes were\n present and correct; only the generated ORDER decided it, which is\n not something a class list shows you.\n\n `clamp` also describes the intent better than steps do: never\n narrower than a readable column, never wider than a comfortable\n measure, and proportional in between.\n */\n // Declared once, consumed by both the resting width and the keyframe.\n '[--doc-panel-w:clamp(360px,26vw,520px)]',\n expanded\n ? 'md:w-[var(--doc-panel-w)] md:animate-[doc-panel-in_200ms_ease-out]'\n : 'md:w-0 md:border-l-0',\n // On a phone it is a bottom sheet, so it rises instead of widening.\n expanded ? 'translate-y-0' : 'translate-y-full',\n /*\n `transform-none` on desktop, not `translate-y-0`.\n\n A transformed element becomes the CONTAINING BLOCK for any `fixed`\n descendant, so the maximized overlay — `fixed inset-0` — was laid out\n against this panel instead of the viewport and sat at x=1185 while\n measuring a correct 1600×900. Zeroing the translate is not enough:\n the property still applies. The phone sheet keeps its transform,\n because there is nothing fixed inside it there.\n */\n 'md:transform-none md:translate-none',\n 'md:rounded-none md:border-l md:border-t-0 md:shadow-none',\n className,\n )}\n >\n {/*\n The column is sized independently of the animating box above, so its\n contents keep their final layout while the box opens — otherwise every\n label would reflow and wrap on each frame of the transition, which\n reads as the panel assembling itself rather than sliding in.\n */}\n <div\n data-maximized={maximized ? 'true' : undefined}\n className={cn(\n 'flex min-h-0 flex-col',\n maximized\n ? /*\n Covers the window; the `<aside>` above keeps its width in the\n flex row, so the page underneath does not reflow. `bg-background`\n is not optional here — a transparent overlay would let the page\n show through and read as a rendering fault.\n */\n 'fixed inset-0 z-50 h-svh w-screen border-l-0 bg-background'\n : 'h-full w-full md:w-[var(--doc-panel-w)]',\n )}\n >\n <header className=\"flex shrink-0 items-center gap-1 border-b px-3 py-2 md:h-14 md:px-4\">\n {shown && all.length > 1 && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 min-h-[24px] min-w-[24px] shrink-0\"\n onClick={() => goTo({ scopes })}\n aria-label={t('docPanel.back', { defaultValue: 'Back to the list' })}\n data-testid=\"doc-panel:back\"\n >\n <IconArrowLeft className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n )}\n <IconBook2 className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1 truncate text-sm font-medium\">\n {shown ? shown.title : t('docPanel.title', { defaultValue: 'Help' })}\n </span>\n {/* Desktop only: on a phone the panel is already a full-width sheet,\n so \"expand\" would have nothing left to expand into. */}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"hidden size-7 min-h-[24px] min-w-[24px] shrink-0 md:inline-flex\"\n onClick={() => setMaximized((v) => !v)}\n aria-label={\n maximized\n ? t('docPanel.collapse', { defaultValue: 'Collapse the panel' })\n : t('docPanel.expand', { defaultValue: 'Expand to the full page' })\n }\n aria-pressed={maximized}\n data-testid=\"doc-panel:expand\"\n >\n {maximized ? (\n <IconMinimize className=\"size-4\" aria-hidden=\"true\" />\n ) : (\n <IconMaximize className=\"size-4\" aria-hidden=\"true\" />\n )}\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 min-h-[24px] min-w-[24px] shrink-0\"\n onClick={handleClose}\n aria-label={t('docPanel.close', { defaultValue: 'Close help' })}\n data-testid=\"doc-panel:close\"\n >\n <IconX className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n </header>\n\n <div\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3',\n // Expanded, the column is as wide as the window — and prose at 1900px\n // is roughly 300 characters a line. The measure is the point of the\n // extra room, not the width itself.\n maximized && 'mx-auto w-full max-w-[72ch] px-6 py-6',\n )}\n >\n {shown ? (\n <DocPanelArticle key={`${shown.scope}/${shown.id}/${locale}`} topic={shown} />\n ) : (\n <nav aria-label={t('docPanel.topics', { defaultValue: 'Topics' })}>\n {groups.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n {t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })}\n </p>\n )}\n {groups.map((group) => (\n <section key={group.scope} className=\"mb-4 last:mb-0\">\n {/* The scope heading only earns its space once the trail names\n more than one — on a single scope it just repeats the page. */}\n {groups.length > 1 && (\n <h2 className=\"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-wide text-muted-foreground\">\n {group.label}\n </h2>\n )}\n {group.summary !== undefined && (\n <p className=\"mb-2 text-[0.8125rem] leading-[1.6] text-foreground\">\n {group.summary}\n </p>\n )}\n <ul className=\"flex flex-col gap-0.5\">\n {group.topics.map((topic) => (\n <li key={`${topic.scope}/${topic.id}`}>\n <button\n type=\"button\"\n onClick={() => goTo({ scopes, scope: topic.scope, topicId: topic.id })}\n data-testid={`doc-panel:topic:${topic.id}`}\n className={cn(\n 'w-full rounded-md px-2 py-1.5 text-left text-[0.8125rem]',\n 'text-foreground transition-colors hover:bg-muted',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n {topic.title}\n </button>\n </li>\n ))}\n </ul>\n </section>\n ))}\n </nav>\n )}\n </div>\n </div>\n </aside>\n );\n}\n\n/** Loads and renders one article body, with the fallback-locale disclosure. */\nfunction DocPanelArticle({ topic }: { topic: DocTopicView }): React.ReactElement {\n const t = useOptionalT();\n const [body, setBody] = useState<string | null>(null);\n const [failed, setFailed] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n setBody(null);\n setFailed(false);\n topic\n .load()\n .then((text) => {\n if (!cancelled) setBody(text);\n })\n .catch(() => {\n if (!cancelled) setFailed(true);\n });\n return () => {\n cancelled = true;\n };\n }, [topic]);\n\n if (failed) {\n return (\n <p className=\"text-sm text-muted-foreground\" data-testid=\"doc-panel:error\">\n {t('docPanel.loadFailed', { defaultValue: 'This article could not be loaded.' })}\n </p>\n );\n }\n if (body === null) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </div>\n );\n }\n\n return (\n <>\n {topic.isFallback && (\n /*\n Serving another language silently is worse than serving nothing: the\n reader has no way to know why the text suddenly changed register. The\n notice says so, and `lang` on the article below tells a screen reader\n to switch voices (WCAG SC 3.1.2, AA).\n */\n <p\n className=\"mb-3 rounded-md border border-border/60 bg-muted/50 px-2.5 py-1.5 text-xs text-muted-foreground\"\n data-testid=\"doc-panel:fallback-notice\"\n >\n {t('docPanel.noTranslation', {\n params: { locale: topic.locale },\n defaultValue: `Not translated yet — showing the ${topic.locale} version.`,\n })}\n </p>\n )}\n <article lang={topic.locale} data-testid=\"doc-panel:article\">\n <Suspense\n fallback={\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </div>\n }\n >\n {/*\n The same rule as the handbook: an FAQ is a list of questions, and\n collapsing them matters MORE here than there — this column is 360 px\n wide, so four answers flowed out full-length is a very long scroll\n for someone who wanted one of them.\n */}\n {topic.kind === 'faq' ? <DocFaq>{body}</DocFaq> : <DocMarkdown>{body}</DocMarkdown>}\n </Suspense>\n </article>\n </>\n );\n}\n","'use client';\n\nimport { useDocPanel, useDocScopes, useOptionalT } from '@burojs/react';\nimport { IconHelpHexagon } from '@tabler/icons-react';\nimport type { JSX } from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport interface DocTrailHelpProps {\n /** Scopes named by the breadcrumb trail, outermost first. */\n scopes: readonly string[];\n testId?: string;\n className?: string;\n}\n\n/**\n * Help for where you are: a «?» that sits at the end of the breadcrumb trail.\n *\n * The breadcrumb is the one element with a fixed position on every page in this\n * app — it lives in the shell header — and it is also the page's only VISIBLE\n * identity, since `visibleTitle` is false everywhere and the `<h1>` is\n * `sr-only`. Anchoring help to it puts the control in the same spot every time.\n *\n * Two things it does that per-entity icons structurally cannot:\n *\n * - **The trail is a CHAIN.** «Documents › wo:2921 › Codes» names two\n * documented resources, and one control can offer both.\n * - **It survives sub-pages.** On «Documents › Creation» there is no record and\n * no fields yet, but the reader can still reach the resource's help — which\n * is exactly when they are most likely to want it.\n *\n * `?` rather than the `i` used beside fields, and the distinction is the one\n * NN/g draws: `i` reads as \"a definition of this specific thing\", `?` as \"help\n * for this area\". A trail control is the second.\n *\n * Renders NOTHING when nothing in the trail is documented. \"Always in the same\n * place\" has to mean \"when there is something\" — a button that opens an empty\n * list on 37 of 39 resources teaches people not to press it.\n *\n * One behaviour, always: open the panel. Whether the panel then shows a list or\n * goes straight to a single article is the PANEL's decision, not this button's\n * — otherwise the control would change what it does on the day a second article\n * is written.\n */\nexport function DocTrailHelp({ scopes, testId, className }: DocTrailHelpProps): JSX.Element | null {\n const documented = useDocScopes(scopes);\n const { openPanel } = useDocPanel();\n const t = useOptionalT();\n\n if (documented.length === 0) return null;\n\n const id = testId ?? 'doc-trail-help';\n return (\n <button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-label={t('docPanel.openForArea', { defaultValue: 'Help for this section' })}\n data-testid={id}\n onClick={() => openPanel({ scopes: documented.map((s) => s.scope) }, id)}\n className={cn(\n // 24 CSS px, stated in pixels because SC 2.5.8 states its floor in\n // pixels. At the standard 16px root, `size-6` is 24px too.\n 'inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-full',\n 'text-muted-foreground transition-colors duration-150',\n 'hover:bg-muted hover:text-foreground',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n className,\n )}\n >\n <IconHelpHexagon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n );\n}\n","'use client';\n\nimport {\n type DocTopicView,\n useDocTopics,\n useDocsConfig,\n useApp,\n useDocumentedScopes,\n useI18nCaps,\n useOptionalT,\n} from '@burojs/react';\nimport {\n resolveConceptLabel,\n resolveDoc,\n resolveEnumLabel,\n resolveResourceLabel,\n} from '@burojs/core';\nimport { IconArrowUpRight, IconBook2, IconChevronDown, IconSearch } from '@tabler/icons-react';\nimport { Suspense, lazy, useEffect, useMemo, useRef, useState } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Input } from '../primitives/input.js';\n\nconst DocMarkdown = lazy(() =>\n import('../markdown/index.js').then((m) => ({ default: m.DocMarkdown })),\n);\nconst DocFaq = lazy(() => import('../markdown/index.js').then((m) => ({ default: m.DocFaq })));\n\n// Static, not lazy: a few lines of string handling, and the anchor logic has\n// to run whether or not the markdown chunk has finished loading.\nimport { readDocHash, scrollToDocAnchor } from '../markdown/anchors.js';\n\n/**\n * Query parameters that make the handbook linkable.\n *\n * Two, not one packed string: `?area=concept/gtin&topic=index` survives a\n * scope that contains slashes without needing a separator convention, and it\n * is readable in a chat message — which is where these links are pasted.\n */\nconst AREA_PARAM = 'area';\nconst TOPIC_PARAM = 'topic';\n\nexport interface DocBrowserProps {\n className?: string;\n}\n\n/**\n * The browsable handbook: every documented scope in one place.\n *\n * The framework does NOT register a route for this. `CustomPageDef.path` is\n * documented as \"the framework does not own routing\", and that is doubly true\n * now that any router must work — so the adopter mounts this component wherever\n * their routes live and registers the nav item with `defineCustomPage`. An\n * auto-registered menu entry would have pointed at a 404 until they did.\n *\n * WCAG SC 3.2.6 Consistent Help (Level A) still applies to that menu entry: it\n * has to appear in the same relative order on every page. The app's sidebar is\n * global, so a normally-registered custom page satisfies it — no mechanism\n * needed beyond putting it there once.\n *\n * Only scopes the registry actually knows are listed. A handbook that\n * enumerated everything would leak the shape of the application to a reader\n * whose role cannot see it.\n */\nexport function DocBrowser({ className }: DocBrowserProps): React.ReactElement {\n const app = useApp();\n const config = useDocsConfig();\n const caps = useI18nCaps();\n const t = useOptionalT();\n const [query, setQuery] = useState('');\n const glossaryLabel = t('docPanel.glossary', { defaultValue: 'Glossary' });\n const areasLabel = t('docPanel.areas', { defaultValue: 'Areas' });\n const [selected, setSelected] = useState<{ scope: string; topicId: string } | null>(null);\n // Narrow screens only — above `md` the list is shown unconditionally.\n const [railOpen, setRailOpen] = useState(false);\n\n /*\n The areas, from the enumeration SHARED with the command palette. It used to\n be computed here and again there, and the two drifted: the palette's copy\n kept only registered resources, so the glossary and every per-type article\n were missing from ⌘K entirely. One function now, two callers.\n\n Labels and grouping stay here, because they are presentation: a term names\n itself, a variant reads its enum value's label and is indented under its\n owner, and the glossary comes first because a term is what the rest of the\n handbook is written in.\n */\n const documented = useDocumentedScopes();\n const scopes = useMemo(\n () =>\n documented.map((entry) => {\n const parts = entry.scope.split('/');\n const label =\n entry.kind === 'concept'\n ? resolveConceptLabel(caps, parts[1] as string)\n : entry.kind === 'variant' && parts[1] && parts[2]\n ? resolveEnumLabel(caps, parts[1], parts[2])\n : resolveResourceLabel(caps, entry.scope, 'plural', app.registry.get(entry.scope));\n return {\n scope: entry.scope,\n label,\n summary: resolveDoc(caps, entry.scope)?.summary,\n nested: entry.kind === 'variant',\n group:\n entry.kind === 'concept'\n ? glossaryLabel\n : entry.kind === 'resource'\n ? areasLabel\n : undefined,\n };\n }),\n [app, documented, caps, glossaryLabel, areasLabel],\n );\n\n /*\n THE HANDBOOK IS ADDRESSABLE.\n\n `/help?area=concept/gtin&topic=index#kak-ustroen-gtin` — an area, an article\n inside it, and a heading or FAQ question inside that. The point is being\n able to answer a colleague with a link instead of \"open Help, then\n Documents, then the third tab, then scroll\".\n\n Query parameters and `history.replaceState`, NOT a router: this package has\n to work under any of them, and this is the same mechanism the side panel's\n `?help=` already uses. Replacing rather than pushing keeps Back meaning \"the\n previous page\" rather than walking a reader out through every tab they\n happened to click.\n\n Read ONCE. Making the URL the source of truth would fight the component on\n every click, and the hash in particular must survive being scrolled away\n from.\n */\n const urlApplied = useRef(false);\n\n /*\n ONE effect decides the initial selection — the URL if it names a real area,\n the first area otherwise. Splitting \"apply the URL\" and \"fall back to the\n first area\" into two effects looks tidier and is a race: both run in the\n same commit, `selected` is still null in each, and the fallback silently\n wins over the link the reader followed.\n */\n useEffect(() => {\n if (urlApplied.current || scopes.length === 0) return;\n urlApplied.current = true;\n\n const first = scopes[0];\n if (typeof window !== 'undefined') {\n const params = new URLSearchParams(window.location.search);\n const area = params.get(AREA_PARAM);\n // An area that no longer exists is a stale link, not an error: fall\n // through to the first one rather than showing an empty handbook.\n if (area !== null && scopes.some((s) => s.scope === area)) {\n setSelected({ scope: area, topicId: params.get(TOPIC_PARAM) ?? '' });\n return;\n }\n }\n if (first) setSelected({ scope: first.scope, topicId: '' });\n }, [scopes]);\n\n // Mirror the reader's position back out, so the address bar is always a\n // shareable link to what they are looking at.\n useEffect(() => {\n if (!urlApplied.current || typeof window === 'undefined' || selected === null) return;\n const url = new URL(window.location.href);\n url.searchParams.set(AREA_PARAM, selected.scope);\n if (selected.topicId !== '') url.searchParams.set(TOPIC_PARAM, selected.topicId);\n else url.searchParams.delete(TOPIC_PARAM);\n window.history.replaceState(window.history.state, '', url.toString());\n }, [selected]);\n\n const activeScope = selected?.scope ?? scopes[0]?.scope;\n const topics = useDocTopics(activeScope);\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return topics;\n return topics.filter((x) => x.title.toLowerCase().includes(q));\n }, [topics, query]);\n\n /*\n Search has to reach the SCOPE list too. It was topic-only when the handbook\n held eight scopes and every one of them fitted on screen; at three dozen the\n thing a reader types is far more often the name of an area than the title of\n an article inside it. A nested variant keeps its parent visible when it\n matches, otherwise it would appear indented under nothing.\n */\n const visibleScopes = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return scopes;\n const keep = new Set<number>();\n scopes.forEach((s, i) => {\n if (!s.label.toLowerCase().includes(q)) return;\n keep.add(i);\n if (!s.nested) return;\n for (let j = i - 1; j >= 0; j--) {\n if (!scopes[j]?.nested) {\n keep.add(j);\n break;\n }\n }\n });\n return scopes.filter((_, i) => keep.has(i));\n }, [scopes, query]);\n\n const activeTopic =\n selected?.topicId !== undefined && selected.topicId !== ''\n ? topics.find((x) => x.id === selected.topicId)\n : undefined;\n\n if (!config) {\n return (\n <p className=\"text-sm text-muted-foreground\" data-testid=\"doc-browser:disabled\">\n {t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })}\n </p>\n );\n }\n\n const active = scopes.find((s) => s.scope === activeScope);\n\n return (\n <div\n className={cn(\n 'flex flex-col gap-5 md:flex-row md:gap-8',\n /*\n TWO PANES, EACH WITH ITS OWN SCROLL — and deliberately NOT a sticky\n rail, which was tried and is dead on arrival in this shell.\n\n `position: sticky` resolves against the nearest scrolling ancestor,\n and the app's content pane carries `overflow-auto`, so that is the\n ancestor it binds to. But `SidebarInset` is `min-h-svh` — a MINIMUM —\n so the pane grows with its content and never actually scrolls; the\n document does. A sticky child of a container that never scrolls simply\n rides the page away: measured at −430px after a 500px scroll, i.e. the\n rail scrolled clean off the top and under the header.\n\n Bounding the handbook's own height instead makes it self-contained:\n nothing here depends on how the shell decides to scroll. The offset is\n the app header (3.5rem) plus the pane's padding (1.5rem × 2), and the\n side panel already sizes itself the same way — one number, measured,\n used consistently.\n\n Below `md` this is all off and the page flows normally, which is what\n a phone wants.\n */\n 'md:h-[calc(100svh-6.5rem)] md:overflow-hidden',\n className,\n )}\n data-testid=\"doc-browser\"\n >\n {/*\n THE RAIL HOLDS AREAS AND NOTHING ELSE.\n\n It used to also hold the open scope's articles, indented one step — and\n a nested variant scope was ALSO indented one step, so «Frequent questions»\n (an article inside Documents) and «Aggregation» (a sibling scope) rendered\n identically. Two different kinds of thing, one appearance; the reader\n had no way to tell which click changed the area and which changed the\n page. Articles now live in the reading pane, where the thing they belong\n to is on screen with them, and the rail is one uniform list.\n */}\n <nav\n className={cn(\n 'w-full shrink-0 md:w-[248px]',\n // Fills the bounded row and scrolls itself; see the note above.\n 'md:h-full md:min-h-0',\n /*\n `relative` so this scroller is a CONTAINING BLOCK.\n\n `sr-only` is `position: absolute`, and an absolutely positioned\n element resolves against its nearest positioned ancestor — which,\n with nothing in between, is the app shell's `<main>`. So a\n screen-reader-only span buried in a scrolled list was laid out\n against `main` at its un-scrolled coordinate, escaping the scroller\n entirely and stretching the page to 1256px in an 800px window. The\n visible layout gave no hint: the offending elements are 1px tall and\n clipped.\n */\n 'relative',\n // `overflow-x` explicitly: leaving it `visible` beside a non-visible\n // `overflow-y` makes the browser compute it to `auto` per spec, and a\n // long term name would then add a horizontal scrollbar to the rail.\n 'md:overflow-y-auto md:overflow-x-hidden',\n // A hairline separating rail from article, on the side the rail ends.\n 'md:border-r md:border-border/60 md:pr-4',\n )}\n aria-label={t('docPanel.topics', { defaultValue: 'Topics' })}\n >\n <div className=\"mb-3 flex items-center gap-2\">\n <IconBook2 className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <h1 className=\"text-[0.9375rem] font-semibold\">\n {t('docPanel.title', { defaultValue: 'Help' })}\n </h1>\n </div>\n\n {/*\n NARROW SCREENS COLLAPSE THE RAIL.\n\n Stacked, three dozen areas sit between the top of the page and the\n article — the reader scrolls past every area in the product to reach\n the one they picked. The disclosure names the current area, so the\n rail costs one line until it is wanted, and picking an area closes it\n again. Above `md` the list is simply always shown and the toggle is\n not rendered at all.\n */}\n <button\n type=\"button\"\n onClick={() => setRailOpen((v) => !v)}\n aria-expanded={railOpen}\n aria-controls=\"doc-browser-scopes\"\n data-testid=\"doc-browser:rail-toggle\"\n className={cn(\n 'mb-3 flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 md:hidden',\n 'text-[0.8125rem] font-medium transition-colors hover:bg-muted/60',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n <span className=\"min-w-0 truncate\">{active?.label ?? ''}</span>\n <IconChevronDown\n className={cn('size-4 shrink-0 transition-transform', railOpen && 'rotate-180')}\n aria-hidden=\"true\"\n />\n </button>\n\n <div id=\"doc-browser-scopes\" className={cn(railOpen ? 'block' : 'hidden', 'md:block')}>\n <div className=\"relative mb-3\">\n <IconSearch\n className=\"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <Input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={t('docPanel.search', { defaultValue: 'Search help' })}\n aria-label={t('docPanel.search', { defaultValue: 'Search help' })}\n className=\"h-8 w-full pl-8 text-[0.8125rem]\"\n data-testid=\"doc-browser:search\"\n />\n </div>\n\n <ul className=\"flex flex-col gap-px\">\n {visibleScopes.map((s, i) => (\n <li key={s.scope}>\n {/*\n The eyebrow is emitted on CHANGE rather than by grouping the\n list into sections, so a search that filters the glossary away\n entirely also takes its heading with it — a lone «GLOSSARY»\n above nothing is the classic filtered-nav artefact.\n */}\n {s.group !== undefined && s.group !== visibleScopes[i - 1]?.group && (\n <h2 className=\"px-2 pb-1 pt-3 text-[0.6875rem] font-semibold uppercase tracking-wide text-muted-foreground first:pt-0\">\n {s.group}\n </h2>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setSelected({ scope: s.scope, topicId: '' });\n setRailOpen(false);\n }}\n aria-current={s.scope === activeScope ? 'page' : undefined}\n data-testid={`doc-browser:scope:${s.scope}`}\n className={cn(\n 'w-full rounded-md py-1.5 pr-2 text-left text-[0.8125rem] leading-snug',\n 'transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n // A variant is a KIND of its parent. The indent plus the rule\n // running down its left edge says \"inside\", where an extra\n // font treatment would just add noise to a list this long.\n s.nested ? 'ml-2.5 border-l border-border/70 pl-3.5' : 'pl-2 font-medium',\n s.scope === activeScope\n ? 'bg-muted text-foreground'\n : 'text-muted-foreground hover:bg-muted/60 hover:text-foreground',\n )}\n >\n {s.label}\n </button>\n </li>\n ))}\n </ul>\n {/*\n Inside the disclosure, not beside it: a search that matches nothing\n has to say so where the results would have been, and hanging it\n outside would also have hidden it on desktop, where `railOpen` is\n false and the list is shown by the `md:block` above.\n */}\n {visibleScopes.length === 0 && (\n <p className=\"px-2 text-[0.8125rem] text-muted-foreground\">\n {scopes.length === 0\n ? t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })\n : t('docPanel.noMatches', { defaultValue: 'Nothing matches that.' })}\n </p>\n )}\n </div>\n </nav>\n\n {/*\n The reading pane is a PAGE about one area: its name, what it is, where\n to read more, and then whichever article is open. A reader who lands\n here from the rail should not have to look back at the rail to know\n what they are reading about.\n */}\n <div\n className={cn('flex min-w-0 flex-1 flex-col', 'md:h-full md:min-h-0')}\n data-testid=\"doc-browser:content\"\n key={activeScope /* reset topic scroll/state when the area changes */}\n >\n {/*\n WHAT AREA YOU ARE IN, AND WHICH ARTICLE — pinned.\n\n These scrolled away with the body in the first cut, which is how you\n lose your place in a long article: the tab strip is the control for\n switching articles, and having to scroll back up to reach it makes it\n feel like part of the text rather than part of the page.\n */}\n <div className=\"shrink-0\">\n <header className=\"mb-4\">\n <h2 className=\"text-xl font-semibold tracking-tight\">{active?.label ?? ''}</h2>\n <ScopeSummary scope={activeScope} summary={active?.summary} />\n </header>\n\n {/*\n One article needs no chooser — a tab strip of one is a control that\n cannot do anything. Its title still belongs on the page, so it is\n rendered as a heading inside the article instead.\n */}\n {topics.length > 1 && (\n <TopicTabs\n topics={filtered.length > 0 ? filtered : topics}\n activeId={activeTopic?.id}\n onSelect={(id) =>\n activeScope !== undefined && setSelected({ scope: activeScope, topicId: id })\n }\n />\n )}\n </div>\n\n {topics.length > 0 && (\n // The body is the only thing that scrolls. `min-h-0` again: a flex\n // child will not shrink below its content without it, and the\n // overflow would silently never engage.\n <div\n // `relative`: see the rail — an `sr-only` span inside a scroller\n // otherwise resolves against `<main>` and stretches the page.\n className=\"relative min-h-0 flex-1 pb-10 md:overflow-y-auto md:pr-1\"\n data-testid=\"doc-browser:body\"\n >\n <BrowserArticle\n topic={(activeTopic ?? filtered[0] ?? topics[0]) as DocTopicView}\n showTitle={topics.length === 1}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * The article chooser for a scope with more than one.\n *\n * A plain button row rather than Radix `Tabs`: the panel below is loaded\n * asynchronously and swapped in place, so there is no persistent tabpanel per\n * tab for `aria-controls` to point at. Claiming `role=\"tablist\"` without that\n * relationship is worse for a screen reader than not claiming it — this is a\n * group of links to one live region, and `aria-current` says which is open.\n */\nfunction TopicTabs({\n topics,\n activeId,\n onSelect,\n}: {\n topics: DocTopicView[];\n activeId: string | undefined;\n onSelect: (id: string) => void;\n}): React.ReactElement {\n const current = activeId ?? topics[0]?.id;\n return (\n /*\n `overflow-y-hidden` is not redundant. CSS computes a `visible` overflow on\n one axis to `auto` when the other axis is not visible, so `overflow-x-auto`\n alone silently makes this box scrollable VERTICALLY too — and the tabs used\n to sit 1px proud of it via `-mb-px`, which was enough to produce a real,\n draggable vertical scroll on a strip of tab buttons.\n\n The underline is now drawn by the buttons' own bottom border sitting ON the\n container's, so nothing overflows and there is nothing to scroll.\n */\n <div className=\"mb-5 flex gap-1 overflow-x-auto overflow-y-hidden border-b border-border/60\">\n {topics.map((topic) => (\n <button\n key={topic.id}\n type=\"button\"\n onClick={() => onSelect(topic.id)}\n aria-current={topic.id === current ? 'true' : undefined}\n data-testid={`doc-browser:topic:${topic.id}`}\n className={cn(\n 'relative whitespace-nowrap px-3 pb-1.5 pt-2 text-[0.8125rem] transition-colors',\n 'border-b-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n topic.id === current\n ? 'border-primary font-medium text-foreground'\n : 'border-transparent text-muted-foreground hover:text-foreground',\n )}\n >\n {topic.title}\n </button>\n ))}\n </div>\n );\n}\n\n/**\n * What a scope IS, above whatever article is open: its summary and any external\n * links. Rendered in the page header rather than as a body, because it is the\n * one piece of text that stays true whichever article the reader picks.\n */\nfunction ScopeSummary({\n scope,\n summary,\n}: {\n scope: string | undefined;\n summary: string | undefined;\n}): React.ReactElement | null {\n const caps = useI18nCaps();\n const t = useOptionalT();\n const doc = scope !== undefined ? resolveDoc(caps, scope) : undefined;\n const links = doc?.links ?? [];\n const newTabNote = t('docPanel.opensInNewTab', { defaultValue: '(opens in a new tab)' });\n\n if (summary === undefined && links.length === 0) return null;\n\n return (\n <div className=\"mt-2 flex flex-col items-start gap-3\" data-testid=\"doc-browser:summary\">\n {summary !== undefined && (\n <p className=\"max-w-[68ch] text-[0.9375rem] leading-relaxed text-muted-foreground\">\n {summary}\n </p>\n )}\n {links.length > 0 && (\n <div\n className={cn(\n 'flex flex-col items-start gap-1.5',\n summary !== undefined && 'border-t border-border/60 pt-3',\n )}\n >\n {links.map((link) => (\n <a\n key={link.href}\n href={link.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'group inline-flex max-w-full items-center gap-1 rounded-sm',\n 'text-[0.8125rem] font-medium text-primary',\n 'hover:underline underline-offset-2',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n <span className=\"min-w-0 truncate\">{link.label}</span>\n <IconArrowUpRight\n className=\"size-3.5 shrink-0 transition-transform duration-150 group-hover:-translate-y-px group-hover:translate-x-px\"\n aria-hidden=\"true\"\n />\n <span className=\"sr-only\">{newTabNote}</span>\n </a>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction BrowserArticle({\n topic,\n showTitle,\n}: {\n topic: DocTopicView;\n showTitle: boolean;\n}): React.ReactElement {\n const t = useOptionalT();\n const [body, setBody] = useState<string | null>(null);\n\n const articleRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n setBody(null);\n topic.load().then((text) => {\n if (!cancelled) setBody(text);\n });\n return () => {\n cancelled = true;\n };\n }, [topic]);\n\n /*\n THE ARTICLE HAS TO PLACE ITS OWN ANCHORS — the browser cannot, twice over.\n\n On ARRIVAL: the body comes from a dynamic import and a fetch, long after the\n URL was read, so at navigation time the target element does not exist yet.\n\n On a HASH CHANGE: `#why-fields-lock` matches nothing in the\n document, because the sanitizer renamed the element to\n `user-content-why-fields-lock` to stop articles clobbering globals.\n The bare slug is what a person pastes and what the visible « # » beside each\n heading links to — so clicking that link changed the address bar and moved\n nothing at all. A fragment-only navigation also does not re-run any of this\n on its own: no reload, no re-render, no effect.\n\n `hashchange` covers both the pasted link and the clicked one.\n */\n useEffect(() => {\n if (body === null) return;\n let stop: (() => void) | undefined;\n const place = () => {\n stop?.();\n const hash = readDocHash();\n const article = articleRef.current;\n if (hash === '' || !article) return;\n stop = scrollToDocAnchor(hash, article);\n };\n place();\n window.addEventListener('hashchange', place);\n return () => {\n window.removeEventListener('hashchange', place);\n stop?.();\n };\n }, [body]);\n\n if (body === null) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </p>\n );\n }\n return (\n <>\n {showTitle && <h3 className=\"mb-3 text-base font-semibold\">{topic.title}</h3>}\n {topic.isFallback && (\n <p\n className=\"mb-3 rounded-md border border-border/60 bg-muted/50 px-2.5 py-1.5 text-xs text-muted-foreground\"\n data-testid=\"doc-browser:fallback-notice\"\n >\n {t('docPanel.noTranslation', {\n params: { locale: topic.locale },\n defaultValue: `Not translated yet — showing the ${topic.locale} version.`,\n })}\n </p>\n )}\n {/*\n `max-w-[68ch]` is not decoration. The reading pane is ~900 px on a\n desktop and prose was set to `max-w-none` for the 360 px side panel,\n so a handbook article ran the full width — roughly 140 characters a\n line, about double what anyone can track back to the next line.\n */}\n <article\n ref={articleRef}\n lang={topic.locale}\n data-testid=\"doc-browser:article\"\n className=\"max-w-[68ch]\"\n >\n <Suspense fallback={<p className=\"text-sm text-muted-foreground\">…</p>}>\n {/*\n An FAQ is a list of questions and gets rendered as one — see DocFaq.\n Every other kind is prose.\n */}\n {topic.kind === 'faq' ? <DocFaq>{body}</DocFaq> : <DocMarkdown>{body}</DocMarkdown>}\n </Suspense>\n </article>\n </>\n );\n}\n","'use client';\n\nimport { useDocPanel, useDocScopes, useDocumentedScopes, useOptionalT } from '@burojs/react';\nimport type { DocTopicKind } from '@burojs/core';\nimport { IconBook2 } from '@tabler/icons-react';\nimport { useMemo } from 'react';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\n\nexport interface CommandPaletteDocsGroupProps {\n /** Active locale. Pass the app's current one so results follow a live switch. */\n locale: string;\n /** Called after a topic is picked — wire to `setOpen(false)`. */\n onSelect?: () => void;\n /** Heading override; defaults to the `docPanel.title` chrome string. */\n heading?: string;\n}\n\ninterface Hit {\n scope: string;\n scopeLabel: string;\n /** Absent when the hit IS the area — a term documented with a summary only. */\n topicId?: string;\n title: string;\n kind: DocTopicKind;\n}\n\n/**\n * Documentation topics in the command palette.\n *\n * Indexes TITLES, not article bodies. Indexing `##` headings inside bodies —\n * the richer option, and the one the first draft of the spec wanted — would\n * require eagerly loading every article on the first keystroke, which is\n * exactly what the lazy loader exists to avoid. Titles live in the i18n bundle\n * and are available synchronously, so this costs nothing.\n *\n * The set of areas comes from `useDocumentedScopes`, shared with the handbook —\n * see its note for the bug that shape exists to prevent.\n *\n * Composed by the ADOPTER into their palette, like every other group here: the\n * palette is a JSX composition rather than a registry, so there is no way for a\n * framework-side config flag to inject a group. Worth being explicit about,\n * because \"the whole feature turns on with one prop\" is true of the panel and\n * not of this.\n */\nexport function CommandPaletteDocsGroup({\n locale,\n onSelect,\n heading,\n}: CommandPaletteDocsGroupProps): React.ReactElement | null {\n const t = useOptionalT();\n const { openPanel } = useDocPanel();\n const glossaryLabel = t('docPanel.glossary', { defaultValue: 'Glossary' });\n\n /*\n The SAME enumeration the handbook uses, and that is the fix.\n\n This walked `config.sources` and kept only keys matching a registered\n resource. `concept/gtin` and `enum/document_type/order_code` are neither, so\n the entire glossary and every per-type article were invisible here:\n ⌘K → «GTIN» returned a packing-config record, and «aggregat» returned an\n equipment row, while the articles for both sat in the handbook. The handbook\n had already been fixed; the duplicate here had not, which is precisely what\n duplicating an enumeration buys you.\n\n `useDocScopes` then resolves each label the one way — a term names itself, a\n variant reads its enum VALUE's label — so «Order codes» reads as itself\n rather than as a raw address.\n */\n const scopes = useDocumentedScopes();\n const scopeNames = useMemo(() => scopes.map((s) => s.scope), [scopes]);\n const groups = useDocScopes(scopeNames);\n\n /*\n What to show BESIDE a result, and it has to disambiguate rather than repeat.\n\n «Aggregation» exists twice over: as a glossary term and as a kind of document.\n Both are legitimately documented, and with the area's own name as context\n both rendered as a bare «Aggregation» — two identical rows, no way to tell\n which is which. A term is labelled by the glossary; a kind is labelled by\n the resource it is a kind OF; a resource speaks for itself.\n */\n const labelOf = useMemo(() => new Map(groups.map((g) => [g.scope, g.label])), [groups]);\n const contextOf = useMemo(() => {\n const byScope = new Map(scopes.map((s) => [s.scope, s]));\n return (scope: string, fallback: string): string => {\n const entry = byScope.get(scope);\n if (entry?.kind === 'concept') return glossaryLabel;\n if (entry?.kind === 'variant' && entry.owner) return labelOf.get(entry.owner) ?? fallback;\n return fallback;\n };\n }, [scopes, labelOf, glossaryLabel]);\n\n const hits = useMemo<Hit[]>(\n () =>\n groups.flatMap((group) => {\n if (group.topics.length > 0) {\n return group.topics.map((topic) => ({\n scope: group.scope,\n scopeLabel: contextOf(group.scope, group.label),\n topicId: topic.id,\n title: topic.title,\n kind: topic.kind,\n }));\n }\n /*\n An area with a summary and no article is still an answer — «Aggregation»\n is documented in one sentence and has no `.md`, and typing «aggregat»\n found nothing because this listed ARTICLES only. The reader cannot see\n that distinction and should not have to: the area itself becomes the\n result, and picking it opens the panel on its summary.\n */\n if (group.summary === undefined) return [];\n return [\n {\n scope: group.scope,\n scopeLabel: contextOf(group.scope, group.label),\n title: group.label,\n kind: 'explanation' as DocTopicKind,\n },\n ];\n }),\n [groups, contextOf],\n );\n\n if (hits.length === 0) return null;\n\n return (\n <CommandGroup heading={heading ?? t('docPanel.title', { defaultValue: 'Help' })}>\n {hits.map((hit) => (\n <CommandItem\n key={hit.topicId === undefined ? hit.scope : `${hit.scope}/${hit.topicId}`}\n // cmdk fuzzy-matches on `value`; folding the scope label in means\n // typing the resource name finds its articles too.\n value={`doc ${hit.scopeLabel} ${hit.title}`}\n data-testid={`command-doc:${hit.scope}${hit.topicId === undefined ? '' : `:${hit.topicId}`}`}\n onSelect={() => {\n openPanel(\n hit.topicId === undefined\n ? { scopes: [hit.scope], scope: hit.scope }\n : { scopes: [hit.scope], scope: hit.scope, topicId: hit.topicId },\n );\n onSelect?.();\n }}\n >\n <IconBook2\n className=\"mr-2 size-4 shrink-0 text-muted-foreground group-data-[selected=true]:text-accent-foreground\"\n aria-hidden=\"true\"\n />\n <span className=\"min-w-0 truncate\">{hit.title}</span>\n {/* A term whose title IS its area name would read «GTIN GTIN». */}\n {hit.scopeLabel !== hit.title && (\n <span className=\"ml-2 shrink-0 text-xs text-muted-foreground group-data-[selected=true]:text-accent-foreground\">\n {hit.scopeLabel}\n </span>\n )}\n </CommandItem>\n ))}\n </CommandGroup>\n );\n}\n","'use client';\nimport { useEffect, useState } from 'react';\n\nconst MOBILE_BREAKPOINT = 768;\n\n/** True when viewport width < 768px. SSR-safe (defaults to false). */\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState(false);\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => setIsMobile(mql.matches);\n mql.addEventListener('change', onChange);\n onChange();\n return () => mql.removeEventListener('change', onChange);\n }, []);\n return isMobile;\n}\n","'use client';\n\nimport * as React from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport { cn } from '../lib/cn.js';\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n 'shrink-0 bg-border',\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n","'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { IconLayoutSidebar } from '@tabler/icons-react';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { useIsMobile } from '../lib/use-mobile.js';\nimport { Button } from './button.js';\nimport { Input } from './input.js';\nimport { Separator } from './separator.js';\nimport { Sheet, SheetContent, SheetTitle, SheetDescription } from './sheet.js';\nimport { Skeleton } from './skeleton.js';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';\n\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n\ntype SidebarContextValue = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextValue | null>(null);\n\nexport function useSidebar(): SidebarContextValue {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n return context;\n}\n\n/** The sidebar context, or `null` outside a `SidebarProvider`. Never throws. */\nexport function useOptionalSidebar(): SidebarContextValue | null {\n return React.useContext(SidebarContext);\n}\n\nexport interface SidebarProviderProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nexport const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // Uncontrolled internal state\n const [_open, _setOpen] = React.useState(defaultOpen);\n\n // Whether the component is controlled from outside\n const isControlled = openProp !== undefined;\n const open = isControlled ? (openProp as boolean) : _open;\n\n const setOpen = React.useCallback(\n (openState: boolean) => {\n if (isControlled) {\n setOpenProp?.(openState);\n } else {\n _setOpen(openState);\n }\n // No cookie write — persistence is owned by the AppLayout wrapper.\n },\n [isControlled, setOpenProp],\n );\n\n const toggleSidebar = React.useCallback(() => {\n if (isMobile) {\n setOpenMobile((prev) => !prev);\n } else {\n setOpen(!open);\n }\n }, [isMobile, open, setOpen]);\n\n // Cmd/Ctrl-B keyboard shortcut\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = React.useMemo<SidebarContextValue>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n /*\n `h-svh`, not `min-h-svh`. A MINIMUM lets the whole shell grow\n with its content, which means the inner `overflow-auto` content\n pane is never constrained and therefore never scrolls — the\n document does instead. Two consequences, both observed:\n `position: sticky` inside the pane binds to a container that\n never scrolls and silently becomes `static` (measured at −430px\n after a 500px scroll), and a panel sized against the pane grew\n past the viewport (1115px in a 960px window) taking its own\n controls out of reach. Both were worked around locally before\n the cause was traced here.\n */\n 'group/sidebar-wrapper flex h-svh w-full has-[[data-variant=inset]]:bg-sidebar',\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n },\n);\nSidebarProvider.displayName = 'SidebarProvider';\n\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'div'> {\n side?: 'left' | 'right';\n variant?: 'sidebar' | 'floating' | 'inset';\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}\n\nexport const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(\n (\n {\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const t = useOptionalT();\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={cn(\n 'flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground',\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as React.CSSProperties}\n side={side === 'left' ? 'left' : 'right'}\n {...props}\n >\n {/* Visually-hidden title for a11y — SheetContent is a Radix Dialog.\n Screen-reader-only is not a reason to ship it untranslated. */}\n <SheetTitle className=\"sr-only\">\n {t('nav.label', { defaultValue: 'Navigation' })}\n </SheetTitle>\n <SheetDescription className=\"sr-only\">\n {t('nav.main', { defaultValue: 'Main navigation' })}\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"group peer hidden md:block text-sidebar-foreground\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* Gap element that is only visible when the sidebar is expanded */}\n <div\n className={cn(\n 'duration-200 relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating' || variant === 'inset'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]',\n )}\n />\n <div\n className={cn(\n 'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n variant === 'floating' || variant === 'inset'\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className,\n )}\n {...props}\n >\n {/*\n ⚠️ `<nav>`, not `<div>`. This is the app's primary navigation and it\n was an anonymous div — the only `<nav>` on the page was the\n breadcrumb, so a screen-reader user had NO navigation landmark to\n jump to and had to tab through ~24 stops to get past the menu.\n */}\n <nav\n aria-label={t('nav.main', { defaultValue: 'Main navigation' })}\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow\"\n >\n {children}\n </nav>\n </div>\n </div>\n );\n },\n);\nSidebar.displayName = 'Sidebar';\n\nexport const SidebarTrigger = React.forwardRef<\n React.ElementRef<typeof Button>,\n React.ComponentPropsWithoutRef<typeof Button>\n>(({ className, onClick, ...props }, ref) => {\n const t = useOptionalT();\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n ref={ref}\n data-sidebar=\"trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn('h-7 w-7', className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <IconLayoutSidebar />\n {/* Third occurrence of this string — the earlier pass fixed SidebarRail's\n aria-label/title and missed this sr-only span, so screen-reader users\n still heard English on every page. */}\n <span className=\"sr-only\">{t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}</span>\n </Button>\n );\n});\nSidebarTrigger.displayName = 'SidebarTrigger';\n\nexport const SidebarRail = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'>\n>(({ className, ...props }, ref) => {\n const t = useOptionalT();\n const { toggleSidebar } = useSidebar();\n return (\n <button\n ref={ref}\n data-sidebar=\"rail\"\n aria-label={t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}\n tabIndex={-1}\n onClick={toggleSidebar}\n title={t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}\n className={cn(\n 'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',\n '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',\n 'group-data-[side=left][data-collapsible=offcanvas]:-right-2',\n 'group-data-[side=right][data-collapsible=offcanvas]:-left-2',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarRail.displayName = 'SidebarRail';\n\nexport const SidebarInset = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<'main'>>(\n ({ className, ...props }, ref) => {\n return (\n <main\n ref={ref}\n className={cn(\n // `min-w-0` is load-bearing, not cosmetic. A flex item defaults to\n // `min-width: auto`, i.e. it REFUSES to shrink below its content's\n // intrinsic minimum — so a wide data table stretched this <main> to the\n // table's width (960px+ on a 390px phone) and the whole page scrolled\n // sideways. Worse, the sidebar is `position: fixed`, so it stayed put\n // while the page slid under it, which read as \"the user avatar floats\n // over the content\". Allowing the main column to shrink lets the inner\n // `overflow-auto` container do its job and scroll the table by itself.\n // `min-h-0` and NOT `min-h-svh`: a flex child refuses to shrink below\n // its content unless told it may, and that refusal is what stops the\n // `overflow-auto` pane inside from ever engaging. Height now comes from\n // the wrapper's `h-svh` via `flex-1`.\n 'relative flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground',\n 'peer-data-[variant=inset]:h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarInset.displayName = 'SidebarInset';\n\nexport const SidebarInput = React.forwardRef<\n React.ElementRef<typeof Input>,\n React.ComponentPropsWithoutRef<typeof Input>\n>(({ className, ...props }, ref) => {\n return (\n <Input\n ref={ref}\n data-sidebar=\"input\"\n className={cn(\n 'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarInput.displayName = 'SidebarInput';\n\nexport const SidebarHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n});\nSidebarHeader.displayName = 'SidebarHeader';\n\nexport const SidebarFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"footer\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n});\nSidebarFooter.displayName = 'SidebarFooter';\n\nexport const SidebarSeparator = React.forwardRef<\n React.ElementRef<typeof Separator>,\n React.ComponentPropsWithoutRef<typeof Separator>\n>(({ className, ...props }, ref) => {\n return (\n <Separator\n ref={ref}\n data-sidebar=\"separator\"\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\n {...props}\n />\n );\n});\nSidebarSeparator.displayName = 'SidebarSeparator';\n\nexport const SidebarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarContent.displayName = 'SidebarContent';\n\nexport const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"group\"\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\n {...props}\n />\n );\n },\n);\nSidebarGroup.displayName = 'SidebarGroup';\n\nexport const SidebarGroupLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(\n 'duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupLabel.displayName = 'SidebarGroupLabel';\n\nexport const SidebarGroupAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-action\"\n className={cn(\n 'absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n // Increases the hit area of the button on mobile.\n 'after:absolute after:-inset-2 after:md:hidden',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupAction.displayName = 'SidebarGroupAction';\n\nexport const SidebarGroupContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"group-content\"\n className={cn('w-full text-sm', className)}\n {...props}\n />\n));\nSidebarGroupContent.displayName = 'SidebarGroupContent';\n\nexport const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentPropsWithoutRef<'ul'>>(\n ({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu\"\n className={cn('flex w-full min-w-0 flex-col gap-1', className)}\n {...props}\n />\n ),\n);\nSidebarMenu.displayName = 'SidebarMenu';\n\nexport const SidebarMenuItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<'li'>\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n data-sidebar=\"menu-item\"\n className={cn('group/menu-item relative', className)}\n {...props}\n />\n));\nSidebarMenuItem.displayName = 'SidebarMenuItem';\n\nconst sidebarMenuButtonVariants = cva(\n 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n outline:\n 'bg-background text-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',\n },\n size: {\n default: 'h-8 text-sm',\n sm: 'h-7 text-xs',\n lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n);\n\nexport interface SidebarMenuButtonProps\n extends React.ComponentPropsWithoutRef<'button'>,\n VariantProps<typeof sidebarMenuButtonVariants> {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | React.ComponentProps<typeof TooltipContent>;\n}\n\nexport const SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(\n (\n {\n asChild = false,\n isActive = false,\n variant = 'default',\n size = 'default',\n tooltip,\n className,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : 'button';\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n ref={ref}\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) {\n return button;\n }\n\n const tooltipProps: React.ComponentProps<typeof TooltipContent> =\n typeof tooltip === 'string' ? { children: tooltip } : tooltip;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== 'collapsed' || isMobile}\n {...tooltipProps}\n />\n </Tooltip>\n );\n },\n);\nSidebarMenuButton.displayName = 'SidebarMenuButton';\n\nexport const SidebarMenuAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'> & { asChild?: boolean; showOnHover?: boolean }\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-action\"\n className={cn(\n 'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',\n // Increases the hit area of the button on mobile.\n 'after:absolute after:-inset-2 after:md:hidden',\n 'peer-data-[size=sm]/menu-button:top-1',\n 'peer-data-[size=default]/menu-button:top-1.5',\n 'peer-data-[size=lg]/menu-button:top-2.5',\n 'group-data-[collapsible=icon]:hidden',\n showOnHover &&\n 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuAction.displayName = 'SidebarMenuAction';\n\nexport const SidebarMenuBadge = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"menu-badge\"\n className={cn(\n 'absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none',\n 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',\n 'peer-data-[size=sm]/menu-button:top-1',\n 'peer-data-[size=default]/menu-button:top-1.5',\n 'peer-data-[size=lg]/menu-button:top-2.5',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n));\nSidebarMenuBadge.displayName = 'SidebarMenuBadge';\n\nexport const SidebarMenuSkeleton = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'> & { showIcon?: boolean }\n>(({ className, showIcon = false, ...props }, ref) => {\n // Random width between 50 and 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n ref={ref}\n data-sidebar=\"menu-skeleton\"\n className={cn('rounded-md h-8 flex gap-2 px-2 items-center', className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 flex-1 max-w-[var(--skeleton-width)]\"\n data-sidebar=\"menu-skeleton-text\"\n style={{ '--skeleton-width': width } as React.CSSProperties}\n />\n </div>\n );\n});\nSidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';\n\nexport const SidebarMenuSub = React.forwardRef<\n HTMLUListElement,\n React.ComponentPropsWithoutRef<'ul'>\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu-sub\"\n className={cn(\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n));\nSidebarMenuSub.displayName = 'SidebarMenuSub';\n\nexport const SidebarMenuSubItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<'li'>\n>(({ ...props }, ref) => <li ref={ref} {...props} />);\nSidebarMenuSubItem.displayName = 'SidebarMenuSubItem';\n\nexport interface SidebarMenuSubButtonProps extends React.ComponentPropsWithoutRef<'a'> {\n asChild?: boolean;\n size?: 'sm' | 'md';\n isActive?: boolean;\n}\n\nexport const SidebarMenuSubButton = React.forwardRef<HTMLAnchorElement, SidebarMenuSubButtonProps>(\n ({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\n 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',\n size === 'sm' && 'text-xs',\n size === 'md' && 'text-sm',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarMenuSubButton.displayName = 'SidebarMenuSubButton';\n","'use client';\n\nimport * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { cn } from '../lib/cn.js';\nimport { buttonVariants } from './button.js';\n\n/**\n * Shadcn-canonical AlertDialog primitive on top of `@radix-ui/react-alert-dialog`.\n *\n * Use this for \"are you sure?\" destructive confirmations. The key difference\n * from the regular `<Dialog>` is that AlertDialog enforces a modal interaction\n * pattern designed for *consequential* decisions:\n * - it cannot be dismissed by Escape OR clicking outside (Radix gates these\n * to encourage explicit Cancel / Action choice).\n * - the trigger surface is paired with `<AlertDialogAction>` and\n * `<AlertDialogCancel>` (not generic Buttons) — the action button gets the\n * destructive variant by default; the cancel button gets the outline\n * variant.\n *\n * Use the regular `<Dialog>` for non-destructive content (forms, info,\n * pickers); reserve AlertDialog for destructive confirms (delete, archive,\n * irreversible actions).\n */\nconst AlertDialog = AlertDialogPrimitive.Root;\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\nexport type AlertDialogOverlayProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Overlay\n>;\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n AlertDialogOverlayProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-overlay/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-[var(--duration-overlay)] ease-[var(--ease-overlay)]',\n className,\n )}\n {...props}\n />\n));\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;\n\nexport type AlertDialogContentProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Content\n>;\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n {/* No slide-* class here on purpose — same reason as\n primitives/dialog.tsx's DialogContent: this surface centres itself\n with `translate-x-[-50%] translate-y-[-50%]` (Tailwind v4 emits the\n `translate` CSS property), and tw-animate-css's slide keyframes\n write `transform`. The two COMPOSE rather than replace each other,\n so a slide-* class here would offset the centring and the dialog\n would animate in diagonally — see\n tests/overlay-animation.test.tsx. Fade + zoom stay safe: zoom only\n feeds `--tw-enter-scale`, inside the keyframe's own `transform`. */}\n <AlertDialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background text-foreground p-6 shadow-lg duration-[var(--duration-overlay)] ease-[var(--ease-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg',\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n));\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;\n\nexport type AlertDialogHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst AlertDialogHeader = ({ className, ...props }: AlertDialogHeaderProps) => (\n <div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />\n);\nAlertDialogHeader.displayName = 'AlertDialogHeader';\n\nexport type AlertDialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst AlertDialogFooter = ({ className, ...props }: AlertDialogFooterProps) => (\n <div\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nAlertDialogFooter.displayName = 'AlertDialogFooter';\n\nexport type AlertDialogTitleProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Title\n>;\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n AlertDialogTitleProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold', className)}\n {...props}\n />\n));\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;\n\nexport type AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Description\n>;\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n AlertDialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n));\nAlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;\n\nexport type AlertDialogActionProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Action\n>;\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n AlertDialogActionProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />\n));\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;\n\nexport type AlertDialogCancelProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Cancel\n>;\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n AlertDialogCancelProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}\n {...props}\n />\n));\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n};\n","'use client';\nimport {\n useNavigationGuardText,\n useOptionalT,\n useRegisterNavigationGuardDialog,\n} from '@burojs/react';\nimport { type ReactElement, useRef } from 'react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '../primitives/alert-dialog.js';\n\n/**\n * The unsaved-changes guard's \"leave?\" dialog. The guard itself — which clicks\n * it holds, `beforeunload`, the back-button sentinel — is `@burojs/react`'s and\n * mounted by `<BuroProvider>`; this component registers itself as the guard's\n * dialog while mounted and answers the navigation the guard is holding.\n * `<AppLayout>` renders one, so an app on the layout mounts nothing; an app\n * without it renders this once inside `<BuroProvider>`. With no dialog\n * registered the guard asks through `window.confirm`.\n *\n * A second mounted dialog stays closed: the guard hands a held navigation to\n * the most recently registered dialog only, and back to the previous one when\n * that one unmounts.\n */\nexport function NavigationGuardDialog(): ReactElement {\n const prompt = useRegisterNavigationGuardDialog();\n const text = useNavigationGuardText();\n const t = useOptionalT();\n const unsavedAction = t('navigation.unsavedAction', {\n defaultValue: 'An action on this screen has unsaved input',\n });\n // Stay keeps everything as it was, focus included (P3-30): the element that had focus when\n // the prompt opened — a dirty field, a dialog's ✕ — gets it back once this dialog has closed.\n // Read during the render that opens the prompt, before this dialog's content takes focus.\n const returnFocus = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n const open = prompt !== null;\n if (open && !wasOpen.current && typeof document !== 'undefined') {\n const active = document.activeElement;\n returnFocus.current = active instanceof HTMLElement && active !== document.body ? active : null;\n }\n wasOpen.current = open;\n return (\n <AlertDialog\n open={prompt !== null}\n onOpenChange={(open) => {\n if (!open) prompt?.stay();\n }}\n >\n <AlertDialogContent\n data-testid=\"nav-guard-dialog\"\n onCloseAutoFocus={(event) => {\n const element = returnFocus.current;\n returnFocus.current = null;\n // Gone after Leave closed its overlay: let Radix decide.\n if (element === null || !element.isConnected) return;\n event.preventDefault();\n element.focus();\n }}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{text.title}</AlertDialogTitle>\n <AlertDialogDescription>\n {text.body}\n {prompt !== null && prompt.labels.length > 0\n ? ` ${unsavedAction}: ${prompt.labels.join(', ')}.`\n : null}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel data-testid=\"nav-guard-stay\">{text.stay}</AlertDialogCancel>\n <AlertDialogAction data-testid=\"nav-guard-leave\" onClick={() => prompt?.leave()}>\n {prompt?.reason === 'dismiss' ? text.discard : text.leave}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n","'use client';\nimport { type ReactNode, useEffect, useState } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { SidebarInset, SidebarProvider } from '../primitives/sidebar.js';\nimport { TooltipProvider } from '../primitives/tooltip.js';\nimport { NavigationGuardDialog } from './navigation-guard-dialog.js';\n\nconst SIDEBAR_STORAGE_KEY = 'buro-sidebar';\n\nexport interface AppLayoutProps {\n children: ReactNode;\n /**\n * The sidebar tree — typically <AppSidebar .../>. `null` (or `undefined`/`false`) means no\n * sidebar at all: the layout then mounts no `SidebarProvider`, so `useOptionalSidebar()` is\n * null below it and `AppHeader` drops its trigger.\n */\n sidebar: ReactNode;\n /** The header tree — typically <AppHeader .../>. */\n header?: ReactNode;\n /**\n * The documentation panel — typically <DocPanel />.\n *\n * A SIBLING of the content column, not an overlay: the panel's whole reason\n * for existing is being readable while the reader works, so it takes width\n * from the content rather than covering it. Renders nothing until opened.\n */\n docPanel?: ReactNode;\n}\n\n/**\n * Shell layout on shadcn's SidebarProvider. Open/collapsed state is\n * CONTROLLED here and persisted to localStorage[\"buro-sidebar\"]\n * (the vendored provider's cookie persistence was removed). Defaults to\n * open for a deterministic SSR render; the stored value is applied on\n * mount. A one-frame flash is possible if the stored state is collapsed —\n * acceptable for an admin app; adopters wanting zero flash can inline a\n * blocking <script> that sets the initial state before hydration.\n */\nexport function AppLayout({\n children,\n sidebar,\n header,\n docPanel,\n}: AppLayoutProps): React.ReactElement {\n const t = useOptionalT();\n const [open, setOpen] = useState(true);\n\n useEffect(() => {\n try {\n const saved = window.localStorage.getItem(SIDEBAR_STORAGE_KEY);\n if (saved === 'true' || saved === 'false') setOpen(saved === 'true');\n } catch {\n // localStorage unavailable — keep default open\n }\n }, []);\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next);\n try {\n window.localStorage.setItem(SIDEBAR_STORAGE_KEY, String(next));\n } catch {\n // ignore persistence failure\n }\n };\n\n const frame = (\n <>\n {/*\n Skip link. A keyboard user landing on a fresh page had to tab through\n the company switcher, both scope selectors and every nav item — 13 stops\n — before reaching page content, and paid that cost again every time\n focus returned to the top. This is the standard remedy: hidden until\n focused, first in the tab order, jumps straight to <main>. It changes\n nothing about the existing focus order; it only adds a way out of it.\n */}\n <a\n href=\"#main-content\"\n className=\"sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:shadow-lg focus:outline-hidden focus:ring-2 focus:ring-ring\"\n data-testid=\"skip-to-content\"\n >\n {t('nav.skipToContent', { defaultValue: 'Skip to content' })}\n </a>\n {sidebar}\n {/*\n ⚠️ `tabIndex={-1}` is what makes the skip link above actually work.\n A fragment link to a non-focusable element scrolls but does not move\n focus, so focus stayed on <body> and the next Tab went straight back\n to the sidebar trigger — i.e. the skip link skipped nothing, and a\n keyboard user still traversed ~26 sidebar stops on every page.\n Acceptance testing measured exactly that. `-1` keeps it out of the\n sequential tab order while making it a valid programmatic target.\n */}\n <SidebarInset id=\"main-content\" tabIndex={-1} className=\"focus:outline-hidden\">\n {header}\n {/* `min-w-0` for the same reason as SidebarInset: without it this\n column inherits its content's intrinsic width and `overflow-auto`\n never engages. `p-4` on phones — 6 units of padding on a 390px\n screen spends 12% of the width on empty margins. */}\n <div className=\"flex min-h-0 flex-1 md:flex-row\">\n {/* `relative`: this is the page's ONLY scroll container\n (`overflow-auto`), and it must also be the nearest positioned\n ancestor for anything below it. Several Radix controls (Select,\n Checkbox, …) bubble their value to a hidden native form element\n rendered `position: absolute` with no `top`/`left` — its\n containing block is simply the nearest ancestor that isn't\n `position: static`. With none between a deep field and here,\n that search continued past this div to `<main>`\n (`SidebarInset`), which is `position: relative` but\n deliberately `overflow: visible` (it is not a scroll\n container) — so the hidden element's natural, unscrolled\n position (which can sit well below the fold on a tall form)\n inflated `main`'s scrollable-overflow region and bubbled to\n `document.scrollingElement`, a second real scrollbar next to\n this element's own. Stopping the search HERE instead costs at\n most a pixel of `scrollHeight` on an element that already\n clips via `overflow-auto`, and it covers every Radix bubble\n anywhere in page content — any form, framework or\n adopter-authored, present or future — not just the one\n instance that got reported. */}\n <div className=\"relative min-w-0 flex-1 overflow-auto p-4 md:p-6\">{children}</div>\n </div>\n </SidebarInset>\n {/*\n The documentation panel is a SIBLING of the inset, not a column inside\n it — so it is the full height of the shell and the app header shrinks\n beside it rather than running on above it.\n\n Inside the inset it began below the header, which read as a panel\n belonging to the page. As a sibling it reads as what it is: a second\n rail, the mirror of the navigation one, that the whole application\n makes room for. `SidebarInset` is `flex-1`, so opening the panel\n displaces the content instead of covering it — the property this panel\n has always been built around.\n */}\n {docPanel}\n {/*\n The unsaved-changes guard's dialog. The guard is `<BuroProvider>`'s;\n registering the dialog here is what turns its leave prompt from a\n `window.confirm` into this one, with nothing for the app to mount.\n */}\n <NavigationGuardDialog />\n </>\n );\n\n if (sidebar === null || sidebar === undefined || sidebar === false) {\n // The same wrapper the provider draws, minus the sidebar context.\n return (\n <TooltipProvider delayDuration={0}>\n <div className=\"group/sidebar-wrapper flex h-svh w-full\">{frame}</div>\n </TooltipProvider>\n );\n }\n return (\n <SidebarProvider open={open} onOpenChange={handleOpenChange}>\n {frame}\n </SidebarProvider>\n );\n}\n","import type { ReactElement, ReactNode } from 'react';\n\n/** The rounded primary-coloured square shared by `SidebarBrand` and `ScopeSwitcher`. */\nexport function BrandTile({\n children,\n 'data-testid': testId,\n}: {\n children: ReactNode;\n 'data-testid'?: string;\n}): ReactElement {\n return (\n <div\n data-testid={testId}\n className=\"bg-primary text-primary-foreground flex size-8 shrink-0 items-center justify-center rounded-lg\"\n >\n {children}\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { BrandTile } from './brand-tile.js';\nimport { type ShellBrand, useShell } from './shell-context.js';\n\n/** Tile, name and subtitle. Shared by `SidebarBrand` (inside its menu button) and `BrandMark`. */\nexport function BrandMarkContent({\n brand,\n tileTestId,\n}: {\n brand: ShellBrand;\n tileTestId: string;\n}): ReactElement {\n return (\n <>\n <BrandTile data-testid={tileTestId}>\n {brand.logo ?? Array.from(brand.name)[0]?.toUpperCase()}\n </BrandTile>\n <div className=\"grid flex-1 text-left group-data-[collapsible=icon]:hidden text-sm leading-tight\">\n <span className=\"truncate font-medium\">{brand.name}</span>\n {brand.subtitle !== undefined ? (\n <span className=\"truncate text-xs\">{brand.subtitle}</span>\n ) : null}\n </div>\n </>\n );\n}\n\n/**\n * The `ShellProvider` brand as a standalone mark — `SidebarBrand` without the sidebar button.\n * `AuthPage` shows it when given no `brand`. Renders nothing without a brand.\n */\nexport function BrandMark(): ReactElement | null {\n const { brand } = useShell();\n if (brand === undefined) return null;\n return (\n <div data-testid=\"brand-mark\" className=\"flex items-center gap-2\">\n <BrandMarkContent brand={brand} tileTestId=\"brand-mark:tile\" />\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { useEffect } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '../primitives/sidebar.js';\nimport { BrandMarkContent } from './brand-mark.js';\nimport { useShell } from './shell-context.js';\n\n/** The brand tile, name and subtitle at the top of the sidebar; reads `AppShell brand` / `ShellProvider brand`. */\nexport function SidebarBrand(): ReactElement | null {\n const { brand } = useShell();\n const RouterLink = useLinkComponent();\n const missing = brand === undefined;\n useEffect(() => {\n if (missing && process.env.NODE_ENV !== 'production') {\n console.warn(\n '[buro] SidebarBrand rendered without a brand: pass AppShell brand={…} or wrap in <ShellProvider brand>',\n );\n }\n }, [missing]);\n if (brand === undefined) return null;\n return (\n <SidebarMenu data-testid=\"sidebar-brand\">\n <SidebarMenuItem>\n <SidebarMenuButton size=\"lg\" asChild tooltip={brand.name}>\n <RouterLink href={brand.homePath ?? '/'}>\n <BrandMarkContent brand={brand} tileTestId=\"sidebar-brand:tile\" />\n </RouterLink>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * A shell component's slot. Omit it (or pass `undefined`, which is the same\n * thing) to get the component's default; pass `false` to leave the slot\n * empty; pass anything else to replace the default with it. `null` is an\n * element like any other: it replaces the default and renders nothing.\n */\nexport type Slot = ReactNode | false;\n\n/** Resolves a slot: `false` → `null`, `undefined` → `fallback()`, anything else as is. */\nexport function fill(slot: Slot | undefined, fallback: () => ReactNode): ReactNode {\n if (slot === false) return null;\n if (slot === undefined) return fallback();\n return slot;\n}\n","'use client';\n\nimport * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { cn } from '../lib/cn.js';\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn('aspect-square h-full w-full', className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n 'flex h-full w-full items-center justify-center rounded-full bg-muted',\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","'use client';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { I18nContext, useChangeLocale, useLanguageStorageKey, useLocale } from '@burojs/react';\nimport { saveLocale } from '../layout/language-storage.js';\n\nexport interface LanguageSwitchApi {\n /** The active locale code. */\n readonly locale: string;\n /** Every locale the app can switch to; just the active one when the i18n facade does not list them. */\n readonly locales: readonly string[];\n /** Switch the live locale (no reload) and persist the choice under the provider's `languageStorageKey`. */\n readonly change: (code: string) => void;\n}\n\n/**\n * The headless model behind every language control: the active locale, the\n * locales on offer, and a `change` that switches live and remembers the pick.\n * `<LanguageSwitch>`, `<LanguageSubmenu>` and the palette actions are views\n * over it; an app's own control can be one too.\n */\nexport function useLanguageSwitch(): LanguageSwitchApi {\n const locale = useLocale();\n const i18n = useContext(I18nContext);\n const changeLocale = useChangeLocale();\n const storageKey = useLanguageStorageKey();\n const locales = useMemo(() => i18n?.locales?.() ?? [locale], [i18n, locale]);\n const change = useCallback(\n (code: string) => {\n saveLocale(code, storageKey);\n changeLocale(code);\n },\n [changeLocale, storageKey],\n );\n return { locale, locales, change };\n}\n","'use client';\nimport { I18nContext, useOptionalT } from '@burojs/react';\nimport { type ReactElement, useContext, useMemo } from 'react';\nimport type { ActionItem } from '../layout/command-palette-actions-group.js';\nimport {\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../primitives/dropdown-menu.js';\nimport { useLanguageSwitch } from './use-language-switch.js';\n\n/**\n * A locale's name in its own language (\"English\", \"Deutsch\", \"Français\"),\n * capitalised. Falls back to the bare code when `Intl.DisplayNames` does not\n * know it (or the code is not a valid BCP-47 tag).\n */\nexport function localeLabel(code: string): string {\n try {\n const name = new Intl.DisplayNames([code], { type: 'language' }).of(code);\n if (name !== undefined && name !== code) {\n return name.charAt(0).toLocaleUpperCase(code) + name.slice(1);\n }\n } catch {\n // An invalid tag throws a RangeError: fall through to the code.\n }\n return code;\n}\n\n/**\n * Radio submenu over the app's locales. Renders nothing only when there is no\n * i18n facade; with one locale it still renders that one choice (hiding a\n * single-locale row is the default menu's decision, not this part's).\n */\nexport function LanguageSubmenu(): ReactElement | null {\n const t = useOptionalT();\n const hasI18n = useContext(I18nContext) !== null;\n const { locale, locales, change } = useLanguageSwitch();\n if (!hasI18n) return null;\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid=\"language-submenu\">\n {t('language.label', { defaultValue: 'Language' })}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup value={locale} onValueChange={change}>\n {locales.map((code) => (\n <DropdownMenuRadioItem key={code} value={code} data-testid={`language-submenu:${code}`}>\n {localeLabel(code)}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\n/** One command-palette action per locale; empty unless the app has more than one. */\nexport function useLanguagePaletteActions(): ActionItem[] {\n const t = useOptionalT();\n const { locales, change } = useLanguageSwitch();\n const label = t('language.label', { defaultValue: 'Language' });\n // `t` is a fresh closure each render; the label and locale are what it varies by.\n // biome-ignore lint/correctness/useExhaustiveDependencies: see above\n return useMemo(\n () =>\n locales.length < 2\n ? []\n : locales.map((code) => ({\n id: `language-${code}`,\n label: `${label}: ${localeLabel(code)}`,\n keywords: `language locale ${code}`,\n onRun: () => change(code),\n })),\n [locales, label, change],\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { IconDeviceDesktop, IconMoon, IconSun } from '@tabler/icons-react';\nimport { type ReactElement, useMemo } from 'react';\nimport type { ActionItem } from '../layout/command-palette-actions-group.js';\nimport { THEME_CHOICES, type ThemeChoice, useTheme } from '../layout/use-theme.js';\nimport { Button } from '../primitives/button.js';\nimport {\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../primitives/dropdown-menu.js';\n\nconst THEME_DEFAULTS: Record<ThemeChoice, string> = {\n light: 'Light',\n dark: 'Dark',\n system: 'System',\n};\n\nfunction isThemeChoice(value: string): value is ThemeChoice {\n return (THEME_CHOICES as readonly string[]).includes(value);\n}\n\n/** Radio submenu over {@link THEME_CHOICES}, bound to the stored choice (not the resolved theme). */\nexport function ThemeSubmenu(): ReactElement {\n const t = useOptionalT();\n const { choice, setTheme } = useTheme();\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid=\"theme-submenu\">\n {t('theme.label', { defaultValue: 'Theme' })}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={choice}\n onValueChange={(value) => {\n if (isThemeChoice(value)) setTheme(value);\n }}\n >\n {THEME_CHOICES.map((c) => (\n <DropdownMenuRadioItem key={c} value={c} data-testid={`theme-submenu:${c}`}>\n {t(`theme.${c}`, { defaultValue: THEME_DEFAULTS[c] })}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\nconst NEXT_CHOICE: Record<ThemeChoice, ThemeChoice> = {\n light: 'dark',\n dark: 'system',\n system: 'light',\n};\n\n/** Icon button cycling light, dark, system. The icon shows the current choice. */\nexport function ThemeToggle(): ReactElement {\n const t = useOptionalT();\n const { choice, setTheme } = useTheme();\n const Icon = choice === 'light' ? IconSun : choice === 'dark' ? IconMoon : IconDeviceDesktop;\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t('theme.label', { defaultValue: 'Theme' })}\n data-testid=\"theme-toggle\"\n data-theme-choice={choice}\n onClick={() => setTheme(NEXT_CHOICE[choice])}\n >\n <Icon aria-hidden=\"true\" />\n </Button>\n );\n}\n\n/** One command-palette action per theme choice. */\nexport function useThemePaletteActions(): ActionItem[] {\n const t = useOptionalT();\n const { setTheme } = useTheme();\n const label = t('theme.label', { defaultValue: 'Theme' });\n const names = THEME_CHOICES.map((c) => t(`theme.${c}`, { defaultValue: THEME_DEFAULTS[c] }));\n const key = names.join('\\u0000');\n // `t` is a fresh closure each render; the translated strings are what it varies by.\n // biome-ignore lint/correctness/useExhaustiveDependencies: see above\n return useMemo(\n () =>\n THEME_CHOICES.map((c, i) => ({\n id: `theme-${c}`,\n label: `${label}: ${names[i]}`,\n keywords: `theme appearance ${c}`,\n onRun: () => setTheme(c),\n })),\n [label, key, setTheme],\n );\n}\n","import type { AuthResult } from '@burojs/core';\nimport { useIdentity, useLogout, useOptionalAuthController, useRouterAdapter } from '@burojs/react';\nimport { useCallback, useMemo } from 'react';\n\nimport { type ShellUser, useShell } from './shell-context.js';\n\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0];\n if (first === undefined) return '?';\n const letters =\n words.length > 1\n ? Array.from(first)[0]! + Array.from(words[1]!)[0]!\n : Array.from(first).slice(0, 2).join('');\n return letters.toUpperCase();\n}\n\nexport interface CurrentUser {\n readonly user: ShellUser | null;\n /** The identity is being fetched. `false` for a query that is idle (session not ready) or absent. */\n readonly isLoading: boolean;\n /** `false` when the app has no `authProvider`: there is no identity to show and no logout to run. */\n readonly available: boolean;\n /**\n * Logs out, then goes to the shell's `loginPath`; stays put on `{ success: false }`. Returns the\n * result. Rejects when the auth provider's `logout` throws instead of returning a result.\n */\n readonly signOut: () => Promise<AuthResult>;\n}\n\n/**\n * The signed-in user as the shell shows it. Never throws: without an `authProvider` it reports\n * `available: false` and no user.\n */\nexport function useCurrentUser(): CurrentUser {\n // Stable for the life of the provider tree, so the hooks below are called consistently.\n const hasAuth = useOptionalAuthController() !== null;\n return hasAuth ? useAuthenticatedUser() : useUnauthenticatedUser();\n}\n\nfunction useUnauthenticatedUser(): CurrentUser {\n const { loginPath } = useShell();\n const { push } = useRouterAdapter();\n const signOut = useCallback(async (): Promise<AuthResult> => {\n push(loginPath);\n return { success: true };\n }, [push, loginPath]);\n return { user: null, isLoading: false, available: false, signOut };\n}\n\nfunction useAuthenticatedUser(): CurrentUser {\n const { mapUser, loginPath } = useShell();\n const identity = useIdentity();\n const { mutateAsync } = useLogout();\n const { push } = useRouterAdapter();\n const data = identity.data;\n const user = useMemo<ShellUser | null>(() => {\n if (data === undefined || data === null) return null;\n const mapped = mapUser(data);\n return { ...mapped, initials: initialsOf(mapped.name) };\n }, [data, mapUser]);\n const signOut = useCallback(async (): Promise<AuthResult> => {\n const result = await mutateAsync(undefined);\n if (result.success) push(loginPath);\n return result;\n }, [mutateAsync, push, loginPath]);\n return {\n user,\n isLoading: identity.isPending && identity.fetchStatus !== 'idle',\n available: true,\n signOut,\n };\n}\n","'use client';\nimport { useOptionalT, useRouterAdapter } from '@burojs/react';\nimport { IconLogin, IconLogout, IconSelector, IconUser } from '@tabler/icons-react';\nimport {\n Children,\n cloneElement,\n Fragment,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { THEME_CHOICES } from '../layout/use-theme.js';\nimport { Avatar, AvatarFallback, AvatarImage } from '../primitives/avatar.js';\nimport { Button } from '../primitives/button.js';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../primitives/dropdown-menu.js';\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useOptionalSidebar,\n} from '../primitives/sidebar.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { LanguageSubmenu } from './language-submenu.js';\nimport { useShell } from './shell-context.js';\nimport { ThemeSubmenu } from './theme-controls.js';\nimport { useCurrentUser } from './use-current-user.js';\nimport { useLanguageSwitch } from './use-language-switch.js';\n\nexport interface UserMenuProps {\n /** `'sidebar'`: the sidebar-footer row (avatar, name, email). `'avatar'`: a round avatar button for a header. Default `'sidebar'`. */\n variant?: 'sidebar' | 'avatar';\n /**\n * The menu's parts, in the order given. Omit to get the default set: Profile, Theme, Language\n * (only with more than one locale) and Sign out. Passed parts always render. Signed out, the\n * menu shows the passed parts except `Profile` and `SignOut`, then \"Sign in\"; the default set\n * signed out is Theme, Language and \"Sign in\".\n */\n children?: ReactNode;\n}\n\nfunction Profile(): ReactElement {\n const { user } = useCurrentUser();\n return (\n <DropdownMenuLabel className=\"font-normal\" data-testid=\"user-menu:profile\">\n <div className=\"grid text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user?.name ?? ''}</span>\n {user?.email !== undefined && (\n <span className=\"truncate text-xs text-muted-foreground\">{user.email}</span>\n )}\n </div>\n </DropdownMenuLabel>\n );\n}\n\nfunction Theme(): ReactElement {\n return <ThemeSubmenu />;\n}\n\nfunction Language(): ReactElement | null {\n return <LanguageSubmenu />;\n}\n\nfunction Separator(): ReactElement {\n return <DropdownMenuSeparator />;\n}\n\ntype ItemProps = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n} & ({ href: string; onSelect?: never } | { onSelect: () => void; href?: never });\n\nfunction Item(props: ItemProps): ReactElement {\n const { id, label, icon } = props;\n const RouterLink = useLinkComponent();\n const content = (\n <>\n {icon}\n {label}\n </>\n );\n if (props.href !== undefined) {\n return (\n <DropdownMenuItem asChild data-testid={`user-menu:item:${id}`}>\n <RouterLink href={props.href}>{content}</RouterLink>\n </DropdownMenuItem>\n );\n }\n return (\n <DropdownMenuItem data-testid={`user-menu:item:${id}`} onSelect={props.onSelect}>\n {content}\n </DropdownMenuItem>\n );\n}\n\nfunction SignOut(): ReactElement {\n const t = useOptionalT();\n const { signOut } = useCurrentUser();\n return (\n <DropdownMenuItem data-testid=\"user-menu:sign-out\" onSelect={() => void signOut()}>\n <IconLogout aria-hidden=\"true\" />\n {t('auth.signOut', { defaultValue: 'Sign out' })}\n </DropdownMenuItem>\n );\n}\n\n/** The signed-out menu's last row: navigates to the shell's login path. */\nfunction SignIn(): ReactElement {\n const t = useOptionalT();\n const { loginPath } = useShell();\n const { push } = useRouterAdapter();\n return (\n <DropdownMenuItem data-testid=\"user-menu:sign-in\" onSelect={() => push(loginPath)}>\n <IconLogin aria-hidden=\"true\" />\n {t('auth.signIn', { defaultValue: 'Sign in' })}\n </DropdownMenuItem>\n );\n}\n\n/**\n * Adopter parts for a signed-out reader: everything except the two that need an identity,\n * `Profile` and `SignOut`, looking through fragments.\n */\nfunction withoutAccountParts(children: ReactNode): ReactNode {\n return Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return child;\n if (child.type === Profile || child.type === SignOut) return null;\n if (child.type === Fragment) {\n return cloneElement(child, undefined, withoutAccountParts(child.props.children));\n }\n return child;\n });\n}\n\nfunction SignedOutDefaultParts(): ReactElement {\n const { locales } = useLanguageSwitch();\n const theme = THEME_CHOICES.length > 1;\n const language = locales.length > 1;\n return (\n <>\n {theme && <Theme />}\n {language && <Language />}\n {(theme || language) && <Separator />}\n <SignIn />\n </>\n );\n}\n\nfunction DefaultParts(): ReactElement {\n const { locales } = useLanguageSwitch();\n return (\n <>\n <Profile />\n <Separator />\n {THEME_CHOICES.length > 1 && <Theme />}\n {locales.length > 1 && <Language />}\n <Separator />\n <SignOut />\n </>\n );\n}\n\nfunction UserMenuRoot({ variant = 'sidebar', children }: UserMenuProps): ReactElement | null {\n const t = useOptionalT();\n const { user, isLoading, available } = useCurrentUser();\n const sidebar = useOptionalSidebar();\n const isSidebar = variant === 'sidebar';\n\n // No auth provider: there is no identity to show and nothing to sign in to.\n if (!available) return null;\n\n if (isLoading) {\n return (\n <Skeleton\n data-testid=\"user-menu:loading\"\n className={isSidebar ? 'h-12 w-full rounded-lg' : 'size-8 rounded-full'}\n />\n );\n }\n\n if (user === null) {\n // Signed out: still a menu, so theme and language stay reachable, ending in \"Sign in\".\n const label = t('auth.signIn', { defaultValue: 'Sign in' });\n const signedOutContent = (\n <DropdownMenuContent\n data-testid=\"user-menu\"\n className=\"min-w-56 rounded-lg\"\n side={isSidebar && sidebar?.isMobile === false ? 'right' : 'bottom'}\n align=\"end\"\n sideOffset={4}\n >\n {children === undefined || children === null ? (\n <SignedOutDefaultParts />\n ) : (\n <>\n {withoutAccountParts(children)}\n <SignIn />\n </>\n )}\n </DropdownMenuContent>\n );\n let trigger: ReactElement;\n if (!isSidebar) {\n trigger = (\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n aria-label={label}\n className=\"rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Avatar className=\"size-8\">\n <AvatarFallback>\n <IconUser className=\"size-4\" aria-hidden=\"true\" />\n </AvatarFallback>\n </Avatar>\n </button>\n );\n } else if (sidebar === null) {\n trigger = (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" data-testid=\"user-menu:trigger\">\n <IconLogin aria-hidden=\"true\" />\n {label}\n </Button>\n );\n } else {\n trigger = (\n <SidebarMenuButton tooltip={label} data-testid=\"user-menu:trigger\">\n <IconLogin aria-hidden=\"true\" />\n <span>{label}</span>\n </SidebarMenuButton>\n );\n }\n const menu = (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>\n {signedOutContent}\n </DropdownMenu>\n );\n if (!isSidebar || sidebar === null) return menu;\n return (\n <SidebarMenu>\n <SidebarMenuItem>{menu}</SidebarMenuItem>\n </SidebarMenu>\n );\n }\n\n const avatar = (\n <Avatar className={isSidebar ? 'h-8 w-8 rounded-lg' : 'size-8'}>\n {user.avatarUrl !== undefined && <AvatarImage src={user.avatarUrl} alt=\"\" />}\n <AvatarFallback className={isSidebar ? 'rounded-lg' : undefined}>\n {user.initials}\n </AvatarFallback>\n </Avatar>\n );\n\n const content = (\n <DropdownMenuContent\n data-testid=\"user-menu\"\n className={\n isSidebar ? 'w-[var(--radix-dropdown-menu-trigger-width)] min-w-56 rounded-lg' : 'min-w-56'\n }\n side={isSidebar ? (sidebar?.isMobile === false ? 'right' : 'bottom') : 'bottom'}\n align=\"end\"\n sideOffset={4}\n >\n {children === undefined || children === null ? <DefaultParts /> : children}\n </DropdownMenuContent>\n );\n\n if (!isSidebar) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n aria-label={\n user.name.trim() !== '' ? user.name : t('shell.account', { defaultValue: 'Account' })\n }\n className=\"rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {avatar}\n </button>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n }\n\n const rowContent = (\n <>\n {avatar}\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user.name}</span>\n {user.email !== undefined && <span className=\"truncate text-xs\">{user.email}</span>}\n </div>\n <IconSelector className=\"ml-auto size-4\" aria-hidden=\"true\" />\n </>\n );\n\n // Outside a SidebarProvider the sidebar primitives cannot mount: same row, plain button.\n if (sidebar === null) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n className=\"flex w-full items-center gap-2 rounded-lg p-2 outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent\"\n >\n {rowContent}\n </button>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n }\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n data-testid=\"user-menu:trigger\"\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {rowContent}\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n\n/**\n * The user's menu. Fills each part you do not pass with its default; passed children replace\n * the default set. `UserMenu.Profile`, `.Theme`, `.Language`, `.Separator`, `.Item` and\n * `.SignOut` are the parts. Signed out it is still a menu — the parts that need no identity,\n * then \"Sign in\" (`user-menu:sign-in`) — so theme and language stay reachable. Renders nothing\n * without an auth provider.\n */\nexport const UserMenu = Object.assign(UserMenuRoot, {\n Profile,\n Theme,\n Language,\n Separator,\n Item,\n SignOut,\n});\n","'use client';\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n","'use client';\n\nimport { ComponentsContext } from '@burojs/react';\nimport { type ComponentType, type ReactNode, useCallback, useContext } from 'react';\nimport { Icon, hasIcon } from '../primitives/icon.js';\n\nconst warned = new Set<string>();\n\n/**\n * Resolve a nav icon NAME to a node: a Components-registry slot of that key\n * first, then the `registerIcons` registry. An unknown name yields `undefined`\n * (no placeholder circle) and, outside production, warns once per name.\n */\nexport function resolveNavIcon(\n name: string | undefined,\n components: (key: string) => unknown,\n): ReactNode | undefined {\n if (name === undefined || name === '') return undefined;\n const slot = components(name);\n if (typeof slot === 'function' || (typeof slot === 'object' && slot !== null)) {\n const C = slot as ComponentType<{ className?: string }>;\n return <C className=\"h-4 w-4\" />;\n }\n if (hasIcon(name)) return <Icon name={name} />;\n if (process.env.NODE_ENV !== 'production' && !warned.has(name)) {\n warned.add(name);\n console.warn(`[buro] unknown nav icon \"${name}\"`);\n }\n return undefined;\n}\n\n/** `resolveNavIcon` bound to the Components registry in context. */\nexport function useNavIcon(): (name: string | undefined) => ReactNode | undefined {\n const components = useContext(ComponentsContext);\n return useCallback(\n (name: string | undefined) => resolveNavIcon(name, (key) => components[key]),\n [components],\n );\n}\n","import {\n type AppRuntime,\n type I18nCaps,\n type NavNode,\n type ResourceLabels,\n type RouteMatch,\n navHrefFor,\n nodeKind,\n resolveNavLabel,\n resolveResourceNavLabel,\n declaredText,\n} from '@burojs/core';\nimport type { ReactNode } from 'react';\nimport type { NavItem } from './nav-slots.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nexport interface BuildNavItemsArgs {\n registry: AppRuntime['registry'];\n caps: I18nCaps;\n groupName: string;\n match: RouteMatch | null;\n isVisible: (node: NavNode) => boolean;\n entryFilter?: (node: NavNode) => boolean;\n icons?: {\n resource?: (name: string) => ReactNode;\n page?: (name: string) => ReactNode;\n group?: (name: string) => ReactNode;\n };\n}\n\n/**\n * Resolve a group's direct children into NavItems: href via `navHrefFor`\n * (nesting-independent; resolves a sub-group directly to its visible target,\n * skipping the group-root redirect hop so React reconciles the nested chrome\n * instead of remounting it), label via the i18n resolvers (reactive on locale),\n * and `active` via the spec §8.2 rule — a leaf is active when it IS the\n * current match; a sub-group is active when it is an ANCESTOR of the match\n * (on `match.groupChain`). Children failing `isVisible`/`entryFilter` drop.\n */\nexport function buildNavItems(args: BuildNavItemsArgs): NavItem[] {\n const { registry, caps, groupName, match, isVisible, entryFilter, icons } = args;\n const chain = match?.groupChain ?? [];\n // On a group-index match, match.name is the GROUP; the shown page is match.target\n // (the index page, or the first-visible-descendant leaf). Highlight THAT.\n const qualifiedMatch = match as\n | (RouteMatch & {\n readonly ref?: Readonly<{ namespace: string; id: string }>;\n readonly targetRef?: Readonly<{ namespace: string; id: string }>;\n })\n | null;\n const activeLeaf =\n qualifiedMatch == null\n ? undefined\n : qualifiedMatch.kind === 'group-index'\n ? canonicalNavKey({\n name: qualifiedMatch.target ?? qualifiedMatch.name,\n ref: qualifiedMatch.targetRef,\n })\n : canonicalNavKey(qualifiedMatch);\n const isEligible = (node: NavNode): boolean =>\n isVisible(node) && (entryFilter ? entryFilter(node) : true);\n const out: NavItem[] = [];\n for (const child of registry.groups.childrenOf(groupName)) {\n if (!isEligible(child as NavNode)) continue;\n const kind = nodeKind(child);\n const childKey = canonicalNavKey(child);\n const href = navHrefFor(registry, childKey, { isVisible: isEligible });\n if (kind === 'group') {\n const label = resolveNavLabel(\n caps,\n `groups.${childKey}`,\n declaredText('chrome', child, 'label'),\n );\n const active = chain.some((g) => canonicalNavKey(g) === childKey);\n out.push({\n kind: 'group',\n name: childKey,\n label,\n href,\n icon: icons?.group?.(childKey),\n active,\n });\n } else if (kind === 'custom-page') {\n out.push({\n kind: 'custom-page',\n name: childKey,\n label: resolveNavLabel(caps, `pages.${childKey}`, declaredText('chrome', child, 'label')),\n href,\n icon: icons?.page?.(childKey),\n active: activeLeaf === childKey,\n });\n } else {\n out.push({\n kind: 'resource',\n name: childKey,\n /*\n `navLabel` first, the plural label otherwise.\n\n A sidebar entry and a page title are not always the same phrase. Under\n a «Documents» section the entry wants to read «All documents» — it\n sits beside the individual kinds and has to say which one it is —\n while the breadcrumb still wants «Documents › wo:2921», because «All\n documents › wo:2921» is not a sentence anyone would write.\n\n A LEAF string, deliberately: a `nav` object with a `.label` inside\n would put an object node in the lookup path, and i18next answers\n `exists()` true for those while `t()` returns the literal\n \"key '…' returned an object instead of string.\" — the exact trap this\n codebase has already been bitten by.\n */\n label: resolveResourceNavLabel(caps, childKey, child as ResourceLabels),\n href,\n icon: icons?.resource?.(childKey),\n active: activeLeaf === childKey,\n });\n }\n }\n return out;\n}\n","'use client';\nimport {\n type CustomPageDef,\n type NavGroupDef,\n type NavNode,\n type ResourceDef,\n type SectionDef,\n hasListPage,\n hrefFor,\n isCustomPageDef,\n navHrefFor,\n nodeKind,\n resolveNavLabel,\n resolveResourceNavLabel,\n declaredText,\n} from '@burojs/core';\nimport { useApp, useI18nCaps, useOptionalRouterAdapter } from '@burojs/react';\nimport { canonicalNavKey, canonicalResourceKey } from '../resource-key.js';\nimport { buildNavItems } from './build-nav-items.js';\nimport type { NavItem } from './nav-slots.js';\nimport { useLayoutResolver, useReportUnresolvedLayouts } from './nav-slots.js';\nimport { useMatch, useNavVisible, usePageAllowed, useResourceVisible } from './use-nav-routing.js';\n\n/**\n * How a group presents its children. `flat` and `collapsible` expand inline in\n * the sidebar; any other value is the key of a registered content layout\n * (`tabs`, `secondary-sidebar`, or an app's own), and the sidebar shows the\n * group as ONE link into its area.\n */\nexport type NavTreeLayout = 'flat' | 'collapsible' | 'tabs' | 'secondary-sidebar' | (string & {});\n\n/** One navigable entry. `icon` is the declared icon NAME; the renderer resolves it. */\nexport type NavTreeEntry =\n | {\n kind: 'resource' | 'page';\n key: string;\n label: string;\n href: string;\n icon?: string;\n active: boolean;\n }\n | {\n kind: 'group';\n key: string;\n label: string;\n href?: string;\n icon?: string;\n /** For a content group: its link is the current location. Otherwise: an ancestor of it. */\n active: boolean;\n layout: NavTreeLayout;\n /** Declared `defaultOpen`, or the active page lives inside. */\n defaultOpen: boolean;\n children: NavTreeEntry[];\n };\n\n/**\n * One block of the sidebar. The first block is the ungrouped top level, with\n * `key: null` and `label: null`: the renderer decides its heading. A block with\n * a key and `label: null` is a content group's own link and has no heading.\n */\nexport interface NavTreeSection {\n key: string | null;\n label: string | null;\n icon?: string;\n collapsible: boolean;\n /** Open on first render: declared `defaultOpen`, or `active`. */\n defaultOpen: boolean;\n /** One of the entries is the page currently shown. Drives re-opening a collapsed block. */\n active: boolean;\n entries: NavTreeEntry[];\n}\n\nexport interface UseNavTreeOptions {\n /**\n * Extra allow-filter applied to every nav entry (resources, custom pages and\n * groups) on top of the built-in visibility rules. Return false to hide an\n * entry. Defaults to always-true.\n */\n entryFilter?: (entry: NavNode) => boolean;\n}\n\nexport function isActiveHref(href: string, currentPath: string | undefined): boolean {\n if (!currentPath) return false;\n if (currentPath === href) return true;\n if (href === '/') return false;\n return currentPath.startsWith(`${href}/`);\n}\n\n/**\n * The sidebar's navigation as plain data: what `<NavMain>` draws, with every\n * visibility rule, permission gate, sort, label and active flag already\n * applied. Build a custom nav on it and it shows the same entries.\n */\nexport function useNavTree(opts: UseNavTreeOptions = {}): NavTreeSection[] {\n const { entryFilter } = opts;\n // The location is the router adapter's, the one seam every host mounts.\n // Without one (a story, a test) nothing is active and nothing is said.\n const currentPath = useOptionalRouterAdapter()?.pathname;\n const passesEntryFilter = (entry: NavNode): boolean => (entryFilter ? entryFilter(entry) : true);\n const app = useApp();\n const caps = useI18nCaps();\n const isResourceVisible = useResourceVisible();\n\n const resolveLayout = useLayoutResolver();\n const match = useMatch();\n const isVisible = useNavVisible();\n // A page's `requires` decides its entry (P7 3.13): undecided or denied draws nothing.\n const pageAllowed = usePageAllowed();\n const isNavEligible = (node: NavNode): boolean => isVisible(node) && passesEntryFilter(node);\n\n const allResources = app.registry.list();\n const allCustomPages = app.registry.customPages.list();\n const sections = app.registry.sections.list();\n const groups = app.registry.groups\n .rootNodes()\n .filter((n) => nodeKind(n) === 'group') as NavGroupDef[];\n\n useReportUnresolvedLayouts(app.registry.groups.list(), resolveLayout);\n\n // Embedded-only subresources are hidden from navigation entirely.\n // Invisible resources are also filtered out.\n const visibleResources = allResources\n .filter((r) => hasListPage(r))\n .filter(isResourceVisible)\n .filter(passesEntryFilter);\n\n // A resource/page with `group` set lives behind a nav group (either its\n // own content-chrome link, or inline under a flat/collapsible group below)\n // and must not also appear as a top-level sidebar item.\n /*\n Sorted by `order`, like every other level of the nav.\n\n `registry.list()` returns REGISTRATION order, while a section's or group's\n children are sorted by `order ?? Infinity`. So `order` on a top-level\n resource silently did nothing — a declaration that looks like it works,\n reads like it works in review, and is ignored. Sorting here makes the one\n rule hold everywhere; a stable index tie-break keeps the previous behaviour\n for everyone who never set it.\n */\n const topLevelResources = visibleResources\n .filter((r) => !r.section && !r.group)\n .map((r, idx) => ({ r, idx }))\n .sort((a, b) => {\n const ao = a.r.order ?? Number.POSITIVE_INFINITY;\n const bo = b.r.order ?? Number.POSITIVE_INFINITY;\n return ao !== bo ? ao - bo : a.idx - b.idx;\n })\n .map((x) => x.r);\n const topLevelCustomPages = allCustomPages\n .filter((p) => !p.section && !p.group)\n .filter(pageAllowed)\n .filter(passesEntryFilter);\n\n const resourceHref = (def: ResourceDef) => hrefFor(app.registry, canonicalResourceKey(def));\n // Shared with `buildNavItems` — see `resolveResourceNavLabel`. The sidebar\n // resolves labels in two places and they must not drift.\n const resourceLabel = (def: ResourceDef) =>\n resolveResourceNavLabel(caps, canonicalResourceKey(def), def);\n const pageLabel = (page: CustomPageDef) =>\n resolveNavLabel(caps, `pages.${canonicalNavKey(page)}`, declaredText('chrome', page, 'label'));\n const sectionLabel = (section: SectionDef) =>\n resolveNavLabel(\n caps,\n `sections.${canonicalNavKey(section)}`,\n declaredText('chrome', section, 'label'),\n );\n const groupLabel = (group: NavGroupDef) =>\n resolveNavLabel(\n caps,\n `groups.${canonicalNavKey(group)}`,\n declaredText('chrome', group, 'label'),\n );\n\n const pageEntry = (page: CustomPageDef): NavTreeEntry => {\n // A custom page owns its declared path even if an internal,\n // non-navigable resource happens to use the same identity.\n const href = page.path;\n return {\n kind: 'page',\n key: canonicalNavKey(page),\n label: pageLabel(page),\n href,\n icon: page.icon,\n active: isActiveHref(href, currentPath),\n };\n };\n const resourceEntry = (def: ResourceDef): NavTreeEntry => {\n const href = resourceHref(def);\n return {\n kind: 'resource',\n key: canonicalResourceKey(def),\n label: resourceLabel(def),\n href,\n icon: def.icon,\n active: isActiveHref(href, currentPath),\n };\n };\n\n const layoutOf = (group: NavGroupDef): NavTreeLayout =>\n resolveLayout(group.layout) ? group.layout : group.collapsible ? 'collapsible' : 'flat';\n\n // A group's children: `buildNavItems` is the one resolver of group members\n // (href via `navHrefFor`, labels, the match-based `active` rule), shared with\n // the content-chrome layouts. Sub-groups recurse.\n const groupChildren = (groupKey: string): NavTreeEntry[] =>\n buildNavItems({\n registry: app.registry,\n caps,\n groupName: groupKey,\n match,\n isVisible,\n entryFilter,\n }).map(itemEntry);\n const groupEntry = (\n group: NavGroupDef,\n label: string,\n href: string,\n active: boolean,\n ): NavTreeEntry => {\n const key = canonicalNavKey(group);\n return {\n kind: 'group',\n key,\n label,\n href,\n icon: group.icon,\n active,\n layout: layoutOf(group),\n defaultOpen: group.defaultOpen === true || active,\n children: groupChildren(key),\n };\n };\n function itemEntry(it: NavItem): NavTreeEntry {\n if (it.kind === 'group') {\n const group = app.registry.groups.get(it.name) as NavGroupDef;\n return groupEntry(group, it.label, it.href, it.active);\n }\n const icon =\n it.kind === 'custom-page'\n ? app.registry.customPages.get(it.name)?.icon\n : app.registry.get(it.name)?.icon;\n return {\n kind: it.kind === 'custom-page' ? 'page' : 'resource',\n key: it.name,\n label: it.label,\n href: it.href,\n icon,\n active: it.active,\n };\n }\n\n const topEntries = [\n ...topLevelCustomPages.map(pageEntry),\n ...topLevelResources.map(resourceEntry),\n ];\n const out: NavTreeSection[] = [\n {\n key: null,\n label: null,\n collapsible: false,\n defaultOpen: true,\n active: topEntries.some((e) => e.active),\n entries: topEntries,\n },\n ];\n\n for (const section of sections) {\n const sectionKey = canonicalNavKey(section);\n // Filter section children: drop resources with no list page, drop invisible\n // resources, and custom pages whose `requires` is not decided in favour.\n const entries = app.registry.sections\n .childrenOf(sectionKey)\n .filter((c) => !('parent' in c) || hasListPage(c))\n .filter((c) => (isCustomPageDef(c) ? pageAllowed(c) : isResourceVisible(c)))\n .filter(passesEntryFilter)\n .map((c) => (isCustomPageDef(c) ? pageEntry(c) : resourceEntry(c)));\n if (entries.length === 0) continue;\n const active = entries.some((e) => e.active);\n out.push({\n key: sectionKey,\n label: sectionLabel(section),\n icon: section.icon,\n collapsible: section.collapsible === true,\n defaultOpen: section.defaultOpen === true || active,\n active,\n entries,\n });\n }\n\n for (const group of groups) {\n const groupKey = canonicalNavKey(group);\n if (!isNavEligible(group)) continue;\n const gLabel = groupLabel(group);\n\n if (resolveLayout(group.layout)) {\n // A content group (tabs / secondary-sidebar / a registered layout) owns\n // its chrome, so the sidebar shows it as ONE link into its area.\n const href = navHrefFor(app.registry, groupKey, { isVisible: isNavEligible });\n const entry = groupEntry(group, gLabel, href, isActiveHref(href, currentPath));\n out.push({\n key: groupKey,\n label: null,\n collapsible: false,\n defaultOpen: false,\n active: entry.active,\n entries: [entry],\n });\n continue;\n }\n\n // Flat / collapsible group: no dedicated content chrome, so its\n // children render inline in the main sidebar (same shape as a\n // section) rather than behind a single group link.\n const entries = groupChildren(groupKey);\n if (entries.length === 0) continue;\n const active = entries.some((e) => e.active);\n out.push({\n key: groupKey,\n label: gLabel,\n icon: group.icon,\n collapsible: group.collapsible === true,\n defaultOpen: group.defaultOpen === true || active,\n active,\n entries,\n });\n }\n\n return out;\n}\n","'use client';\nimport type { CustomPageDef, NavNode, ResourceDef, SectionDef } from '@burojs/core';\nimport { useApp, useOriginIntent, useT, useTestIds } from '@burojs/react';\nimport { IconChevronRight } from '@tabler/icons-react';\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../primitives/collapsible.js';\nimport {\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n} from '../primitives/sidebar.js';\nimport { useLinkComponent } from './link-component.js';\nimport { useNavIcon } from '../shell/use-nav-icon.js';\nimport { type NavTreeEntry, useNavTree } from './use-nav-tree.js';\n\nexport interface NavMainProps {\n iconForResource?: (def: ResourceDef) => ReactNode;\n iconForCustomPage?: (def: CustomPageDef) => ReactNode;\n /** Icon for a collapsible section's trigger row (#16). */\n iconForSection?: (def: SectionDef) => ReactNode;\n /**\n * Extra allow-filter applied to every nav entry (resources, custom pages,\n * and groups) on top of the built-in visibility rules. The\n * app owns the policy — e.g. reduce the sidebar to a companies/users/logs\n * allow-list in admin (\"stand\") mode (#12) — while the framework stays\n * generic. Return false to hide an entry. Defaults to always-true.\n */\n entryFilter?: (entry: NavNode) => boolean;\n /**\n * Heading for the ungrouped block at the top of the sidebar.\n *\n * `null` renders NO heading — the entries sit bare above the first named\n * section. That is the right shape when the block holds the two or three\n * places a user starts from («Home», the codes, the products): an eyebrow\n * over them has to invent a category, and every word that fits («Resources»,\n * «Misc») is less informative than the item names already are.\n *\n * Omitted → the framework's own `nav.resources` string, as before.\n */\n topLabel?: string | null;\n}\n\ninterface CollapsibleNavSectionProps {\n /** Section or group name — drives the test ids. */\n name: string;\n label: string;\n icon?: ReactNode;\n /** True when one of the children is the page currently being shown. */\n hasActiveChild: boolean;\n /** Declared `defaultOpen` on the section/group definition. */\n declaredOpen: boolean;\n children: ReactNode;\n}\n\n/**\n * One collapsible nav row plus its submenu. Shared by `section.collapsible`\n * and `group.collapsible`, which rendered byte-identical trees.\n *\n * ⚠️ Owns two behaviours a bare `<Collapsible defaultOpen>` does not have:\n *\n * 1. **Scroll the revealed children into view.** The sidebar's nav list\n * scrolls independently of its sticky footer, so a collapsible sitting near\n * the bottom expanded into space nobody could see: acceptance testing\n * clicked «Monitoring», watched the chevron rotate, and saw none of its five\n * children — the click read as broken. Opening now scrolls down just far\n * enough to show the submenu, and never so far that the group's own row\n * leaves the viewport, so the user keeps their place.\n *\n * 2. **Re-open when the active page moves inside it.** `defaultOpen` is only\n * read at mount, and the sidebar stays mounted across soft navigations — so\n * arriving at a page inside a collapsed group (via the command palette, a\n * breadcrumb, or a link) left the current location hidden behind a closed\n * submenu, which is exactly what the `defaultOpen` expression was written to\n * prevent.\n */\nfunction CollapsibleNavSection({\n name,\n label,\n icon,\n hasActiveChild,\n declaredOpen,\n children,\n}: CollapsibleNavSectionProps): React.ReactElement {\n const itemRef = useRef<HTMLLIElement>(null);\n const [open, setOpen] = useState(declaredOpen || hasActiveChild);\n\n /**\n * Reveal the submenu inside the sidebar's own scroll container.\n *\n * Deliberately NOT `Element.scrollIntoView`: that also scrolls every\n * scrollable ancestor, including the document, so expanding a nav group\n * could jump the page content behind it.\n */\n const revealSubmenu = useCallback(() => {\n const el = itemRef.current;\n const scroller = el?.closest<HTMLElement>('[data-sidebar=\"content\"]');\n if (!el || !scroller) return;\n const er = el.getBoundingClientRect();\n const sr = scroller.getBoundingClientRect();\n const hiddenBelow = er.bottom - sr.bottom;\n if (hiddenBelow <= 0) return;\n // Never scroll past the group's own row — losing the header you just\n // clicked is more disorienting than not seeing the last child.\n const maxScroll = Math.max(0, er.top - sr.top);\n scroller.scrollTop += Math.min(hiddenBelow + 8, maxScroll);\n }, []);\n\n const handleOpenChange = useCallback(\n (next: boolean) => {\n setOpen(next);\n // One frame, so the submenu has been laid out and its height counts.\n if (next) requestAnimationFrame(revealSubmenu);\n },\n [revealSubmenu],\n );\n\n // Behaviour 2. Only ever opens — never yanks a group shut that the user\n // deliberately opened.\n useEffect(() => {\n if (hasActiveChild) setOpen(true);\n }, [hasActiveChild]);\n\n return (\n <SidebarGroup data-testid={`sidebar-section-group:${name}`}>\n <SidebarGroupContent>\n <SidebarMenu>\n <Collapsible\n asChild\n open={open}\n onOpenChange={handleOpenChange}\n className=\"group/collapsible\"\n >\n <SidebarMenuItem ref={itemRef}>\n <CollapsibleTrigger asChild>\n <SidebarMenuButton tooltip={label} data-testid={`sidebar-section-toggle:${name}`}>\n {icon != null && (\n <span\n className=\"inline-flex h-4 w-4 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n )}\n <span data-testid={`sidebar-section:${name}`}>{label}</span>\n <IconChevronRight className=\"ml-auto h-4 w-4 shrink-0 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90\" />\n </SidebarMenuButton>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <SidebarMenuSub>{children}</SidebarMenuSub>\n </CollapsibleContent>\n </SidebarMenuItem>\n </Collapsible>\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n}\n\nexport function NavMain({\n topLabel,\n iconForResource,\n iconForCustomPage,\n iconForSection,\n entryFilter,\n}: NavMainProps): React.ReactElement {\n // Everything the sidebar shows — visibility, permission gates, sort, labels,\n // active flags — is decided by `useNavTree`. This component only draws it.\n const tree = useNavTree({ entryFilter });\n const app = useApp();\n const tid = useTestIds();\n const t = useT();\n const RouterLink = useLinkComponent();\n const navIcon = useNavIcon();\n // A sidebar entry is a jump: the page it opens starts a fresh trail (navigation origin).\n const intent = useOriginIntent();\n const jump = (entry: NavTreeEntry) => () => {\n if (entry.href !== undefined) intent(entry.href, 'jump');\n };\n\n // The `iconFor*` prop decides first; when it is absent or answers\n // `undefined`, the entry's declared icon name is resolved.\n const ownOr = (own: ReactNode | undefined, name: string | undefined): ReactNode =>\n own !== undefined ? own : navIcon(name);\n // A group goes through `iconForSection` too, as it always has.\n const groupAsSection = (key: string): SectionDef | undefined =>\n app.registry.sections.get(key) ??\n (app.registry.groups.get(key) as unknown as SectionDef | undefined);\n const sectionIcon = (key: string, name: string | undefined): ReactNode => {\n const def = iconForSection ? groupAsSection(key) : undefined;\n return ownOr(def ? iconForSection?.(def) : undefined, name);\n };\n /*\n ⚠️ Custom pages inside a GROUP once got no icon resolver — it was hardcoded\n `undefined`, so a page rendered with an icon in a SECTION and without one\n in a group. Moving a page between the two silently lost its icon, which\n is exactly what happened when «Monitoring» became a group: «Processes»\n and «Application logs» went blank while their resource siblings kept\n theirs. One resolver per entry kind, wherever the entry sits, keeps that\n from coming back.\n */\n const entryIcon = (entry: NavTreeEntry): ReactNode => {\n if (entry.kind === 'group') return sectionIcon(entry.key, entry.icon);\n if (entry.kind === 'page') {\n const page = iconForCustomPage ? app.registry.customPages.get(entry.key) : undefined;\n return ownOr(page ? iconForCustomPage?.(page) : undefined, entry.icon);\n }\n const def = iconForResource ? app.registry.get(entry.key) : undefined;\n return ownOr(def ? iconForResource?.(def) : undefined, entry.icon);\n };\n const entryTestId = (entry: NavTreeEntry): string =>\n entry.kind === 'page'\n ? tid.sidebarCustomPage(entry.key)\n : entry.kind === 'group'\n ? tid.navGroup(entry.key)\n : tid.navMenuItem(entry.key);\n\n const menuItem = (entry: NavTreeEntry): ReactNode => {\n const icon = entryIcon(entry);\n return (\n <SidebarMenuItem key={entry.key}>\n <SidebarMenuButton asChild isActive={entry.active} tooltip={entry.label}>\n <RouterLink\n href={entry.href ?? ''}\n aria-current={entry.active ? 'page' : undefined}\n data-testid={entryTestId(entry)}\n onClick={jump(entry)}\n >\n {icon != null && (\n <span className=\"inline-flex h-4 w-4 items-center justify-center\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span>{entry.label}</span>\n </RouterLink>\n </SidebarMenuButton>\n </SidebarMenuItem>\n );\n };\n // Submenu rows carry no icon: the collapsible row above them already has one.\n const subItem = (entry: NavTreeEntry): ReactNode => (\n <SidebarMenuSubItem key={entry.key}>\n <SidebarMenuSubButton asChild isActive={entry.active}>\n <RouterLink\n href={entry.href ?? ''}\n aria-current={entry.active ? 'page' : undefined}\n data-testid={entryTestId(entry)}\n onClick={jump(entry)}\n >\n <span>{entry.label}</span>\n </RouterLink>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n );\n\n const [top, ...blocks] = tree;\n\n return (\n <>\n {/* Every top-level entry filtered out or grouped away: no group, so no lone heading. */}\n {top !== undefined && top.entries.length > 0 && (\n <SidebarGroup>\n {/* `null` means \"no heading\" — see `topLabel`. `undefined` keeps the\n framework default, so existing consumers are untouched. */}\n {topLabel !== null && (\n <SidebarGroupLabel>{topLabel ?? t('nav.resources')}</SidebarGroupLabel>\n )}\n <SidebarGroupContent>\n <SidebarMenu>{top.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n )}\n\n {blocks.map((block) => {\n const key = block.key ?? '';\n // A content group: one link into its area, no heading.\n if (block.label === null) {\n return (\n <SidebarGroup key={key}>\n <SidebarGroupContent>\n <SidebarMenu>{block.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n }\n\n // Collapsible second-level menu (#16): one row that expands to its\n // children, instead of an always-open labelled group. Auto-expands when\n // the active page lives inside it, so the user's current location is\n // never hidden behind a collapsed submenu.\n if (block.collapsible) {\n return (\n <CollapsibleNavSection\n key={key}\n name={key}\n label={block.label}\n icon={sectionIcon(key, block.icon)}\n hasActiveChild={block.active}\n declaredOpen={block.defaultOpen}\n >\n {block.entries.map(subItem)}\n </CollapsibleNavSection>\n );\n }\n\n return (\n <SidebarGroup key={key} data-testid={`sidebar-section-group:${key}`}>\n <SidebarGroupLabel data-testid={`sidebar-section:${key}`}>\n {block.label}\n </SidebarGroupLabel>\n <SidebarGroupContent>\n <SidebarMenu>{block.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n })}\n </>\n );\n}\n","'use client';\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarHeader,\n SidebarRail,\n} from '../primitives/sidebar.js';\nimport { SidebarBrand } from '../shell/sidebar-brand.js';\nimport { fill, type Slot } from '../shell/slot.js';\nimport { UserMenu } from '../shell/user-menu.js';\nimport { NavMain } from './nav-main.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppSidebarProps {\n /** Top of the sidebar. Default `<SidebarBrand />` (the `ShellProvider` brand). */\n header?: Slot;\n /** Scope filters rendered under the header. No default. */\n filters?: Slot;\n /** Main navigation. Default `<NavMain />`. */\n nav?: Slot;\n /** Footer. Default `<UserMenu />`, which renders nothing without an auth provider. */\n footer?: Slot;\n}\n\nexport function AppSidebar({ header, filters, nav, footer }: AppSidebarProps): React.ReactElement {\n const headerNode = fill(header, () => <SidebarBrand />);\n const filtersNode = fill(filters, () => null);\n const navNode = fill(nav, () => <NavMain />);\n const footerNode = fill(footer, () => <UserMenu />);\n return (\n <Sidebar collapsible=\"icon\">\n {(headerNode != null || filtersNode != null) && (\n <SidebarHeader className=\"empty:hidden\">\n {headerNode}\n {filtersNode}\n </SidebarHeader>\n )}\n <SidebarContent>{navNode}</SidebarContent>\n {footerNode != null && <SidebarFooter className=\"empty:hidden\">{footerNode}</SidebarFooter>}\n <SidebarRail />\n </Sidebar>\n );\n}\n","'use client';\nimport { useApp, useI18nCaps } from '@burojs/react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { buildNavItems, type BuildNavItemsArgs } from './build-nav-items.js';\nimport { NavChromeMountedProvider } from './nav-chrome-mounted.js';\nimport { useLayoutResolver, useReportUnresolvedLayouts } from './nav-slots.js';\nimport { useMatch, useNavVisible } from './use-nav-routing.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nconst DETAIL_ACTIONS = new Set(['show', 'edit', 'create']);\n\nexport interface NavChromeProps {\n children: ReactNode;\n entryFilter?: (node: { name: string }) => boolean;\n icons?: BuildNavItemsArgs['icons'];\n}\n\n/**\n * Wrap the active page in its group-chain chrome. Walks `match.groupChain`\n * innermost→outermost, wrapping the accumulating content in each group's\n * content layout (secondary-sidebar / tabs). Groups whose layout has no\n * content renderer (flat / collapsible — main-sidebar only) contribute no\n * wrapping. No match → children bare (`/login`, a host's own routes).\n *\n * Mount it ONCE in the persistent layout, around whatever the router renders —\n * `AppShell` does this by default. Moving within an area keeps the outer layout\n * element at the same type and position, so React reconciles it in place: the\n * secondary sidebar stays the same DOM node and only its active item changes.\n * Output depends only on the registry, the adapter's pathname and i18n — no\n * effect decides it, so it renders on the server as on the client.\n */\nexport function NavChrome({ children, entryFilter, icons }: NavChromeProps): ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const isVisible = useNavVisible();\n const match = useMatch();\n const resolveLayout = useLayoutResolver();\n useReportUnresolvedLayouts(match?.groupChain ?? [], resolveLayout);\n\n if (!match) return <NavChromeMountedProvider value>{children}</NavChromeMountedProvider>;\n\n let content = children;\n // innermost group is last in groupChain → fold from the end outward.\n for (let i = match.groupChain.length - 1; i >= 0; i--) {\n const group = match.groupChain[i];\n if (!group) continue;\n const groupKey = canonicalNavKey(group);\n // chromeOn: 'list' groups collapse (contribute zero wrapping) on a\n // resource detail action — drilling into a record hides that group's\n // chrome (tabs / secondary-sidebar) entirely.\n if (group.chromeOn === 'list' && match.kind === 'resource' && DETAIL_ACTIONS.has(match.action))\n continue;\n const Layout = resolveLayout(group.layout);\n if (!Layout) continue; // flat/collapsible: no content wrapping\n const items = buildNavItems({\n registry: app.registry,\n caps,\n groupName: groupKey,\n match,\n isVisible,\n entryFilter,\n icons,\n });\n content = (\n <Layout group={group} groupKey={groupKey} items={items}>\n {content}\n </Layout>\n );\n }\n return <NavChromeMountedProvider value>{content}</NavChromeMountedProvider>;\n}\n","'use client';\nimport { routeResourceKey } from '@burojs/core';\nimport type { ResourceNameOrRef } from '@burojs/core';\nimport { hasListPage, hrefFor, resolveResourceLabel } from '@burojs/core';\nimport {\n useApp,\n useDocTrailScopes,\n useI18nCaps,\n useOptionalT,\n useOriginIntent,\n useTestIds,\n} from '@burojs/react';\nimport { IconChevronRight } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\nimport { DocTrailHelp } from '../doc/doc-trail-help.js';\nimport { cn } from '../lib/cn.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useLinkComponent } from './link-component.js';\n\n/** A crumb; `jump` makes its click start a fresh trail (`useOriginIntent`), as a group link does. */\ntype Segment = { label: string; href?: string; jump?: boolean };\n\ninterface BreadcrumbsBaseProps {\n className?: string;\n /**\n * Scopes the trail offers help for, outermost first. Defaults to the resource\n * this breadcrumb is rooted at (none for a trail without a resource).\n */\n docScopes?: string[];\n /**\n * Segments rendered before the resource segment (or before the page label in\n * a trail without one), each followed by a chevron — the group chain. A\n * segment with an `href` renders as a link; without one, as muted text.\n */\n leadingSegments?: Segment[];\n /** Optional testid forwarded to the root nav. */\n 'data-testid'?: string;\n}\n\n/** A trail that ends at, or passes through, a resource: its list link, then the record. */\nexport interface ResourceBreadcrumbsProps<N extends string = string> extends BreadcrumbsBaseProps {\n /** Resource name (the registry key), checked against the registered resources; or its entity ref. */\n resource: ResourceNameOrRef<N>;\n name?: never;\n /** Identifier for the current page (testid only); a record id on show/edit pages. */\n recordId?: string;\n /**\n * Display label for the trailing segment (the current page). When omitted\n * the resource segment itself is the current crumb (a list page).\n */\n pageLabel?: string;\n /**\n * Segments rendered between the resource link and the trailing page label —\n * the record on an edit page («Documents › live-one › Edit»). A segment\n * without `href` renders as plain text.\n */\n middleSegments?: Segment[];\n /**\n * Where the resource crumb links instead of the list's canonical address: the list as the user\n * had it, filters and page included (a record page reached from it, navigation origin).\n */\n resourceHref?: string;\n /**\n * Segments that replace the leading segments and the resource crumb: the trail of the page the\n * user came from when it is not this resource's list (a parent record's card). `middleSegments`\n * are not drawn with them.\n */\n rootSegments?: Segment[];\n}\n\n/** A trail with no resource segment: a custom page or a group index. */\nexport interface PageBreadcrumbsProps extends BreadcrumbsBaseProps {\n resource?: never;\n /** The test-id name of the current crumb: the custom page's or the group's key. */\n name: string;\n /** The current page's label, the trail's last crumb. */\n pageLabel: string;\n recordId?: never;\n middleSegments?: never;\n resourceHref?: never;\n rootSegments?: never;\n}\n\nexport type BreadcrumbsProps<N extends string = string> =\n | ResourceBreadcrumbsProps<N>\n | PageBreadcrumbsProps;\n\nconst LINK_CLASS =\n 'rounded hover:text-foreground transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2';\n\nfunction Chevron(): ReactElement {\n return (\n <IconChevronRight className=\"size-3.5 shrink-0 text-muted-foreground/60\" aria-hidden=\"true\" />\n );\n}\n\n/**\n * The navigation breadcrumb, in two shapes. With `resource`: the leading\n * segments, the resource (a link to its canonical, nesting-aware list href,\n * or the current crumb on a bare list), the middle segments and the page\n * label. Without: the leading segments and the page label only, test ids\n * named by `name`. The last crumb is always the \"you are here\" marker — an\n * emphasised, non-linked span with `aria-current=\"page\"`. Every crumb carries\n * its label as a `title` tooltip, so a truncated one can still be read.\n */\nexport function Breadcrumbs<const N extends string = string>(\n input: BreadcrumbsProps<N>,\n): ReactElement | null {\n // Checked at the call; from here on the name is a plain string or an entity ref.\n const props: BreadcrumbsProps = input;\n const { leadingSegments, className, docScopes, 'data-testid': testId } = props;\n const app = useApp();\n const resource = props.resource === undefined ? undefined : routeResourceKey(props.resource);\n const def = resource === undefined ? undefined : app.registry.get(resource);\n const tid = useTestIds();\n const t = useOptionalT();\n const RouterLink = useLinkComponent();\n const caps = useI18nCaps(def?.name);\n const intent = useOriginIntent();\n /** A jump crumb's click: the page it opens starts a fresh trail. */\n const onJump = (seg: Segment): (() => void) | undefined => {\n const href = seg.href;\n return seg.jump === true && href !== undefined ? () => intent(href, 'jump') : undefined;\n };\n // Resource plus its documentation variant, when the resource declares one.\n const trailScopes = useDocTrailScopes(def?.name);\n\n const leading = (name: string) =>\n leadingSegments?.map((seg, i) => (\n <span key={`lead:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(name)}:lead:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span className=\"truncate\" title={seg.label}>\n {seg.label}\n </span>\n )}\n <Chevron />\n </span>\n ));\n const current = (crumbTestId: string, label: string) => (\n <span\n data-testid={crumbTestId}\n className=\"text-foreground font-medium truncate\"\n aria-current=\"page\"\n title={label}\n >\n {label}\n </span>\n );\n // Every crumb may shrink and truncate (its `title` keeps it readable); the chevrons and the help\n // button may not, so a trail squeezed by a crowded header keeps its «?» on screen.\n const navClass = cn('flex min-w-0 items-center gap-1 text-sm text-muted-foreground', className);\n const ariaLabel = t('nav.breadcrumb', { defaultValue: 'Breadcrumb' });\n // Help for where you are, at the end of the trail. Renders nothing when\n // nothing in the trail is documented.\n const help = <DocTrailHelp scopes={docScopes ?? trailScopes} className=\"ml-0.5\" />;\n\n if (props.resource === undefined) {\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {leading(props.name)}\n {current(tid.navBreadcrumb(props.name), props.pageLabel)}\n {help}\n </nav>\n );\n }\n if (!def) return null;\n const { recordId, pageLabel, middleSegments, rootSegments } = props;\n const resourceKey = canonicalResourceKey(def);\n if (rootSegments !== undefined && rootSegments.length > 0) {\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {rootSegments.map((seg, i) => (\n <span key={`root:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n {i > 0 && <Chevron />}\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(resourceKey)}:root:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span\n data-testid={`${tid.navBreadcrumb(resourceKey)}:root:${i}`}\n className=\"truncate\"\n title={seg.label}\n >\n {seg.label}\n </span>\n )}\n </span>\n ))}\n {pageLabel && (\n <>\n <Chevron />\n {current(tid.navBreadcrumb(resourceKey, recordId), pageLabel)}\n </>\n )}\n {help}\n </nav>\n );\n }\n // Canonical, nesting-aware href: for a resource behind a nav group it is the\n // group-prefixed path, so the crumb keeps the nested chrome.\n const listHref = props.resourceHref ?? hrefFor(app.registry, resourceKey);\n const resourceLabel = resolveResourceLabel(caps, resourceKey, 'plural', def);\n // The resource is the current crumb only on a bare list page, when nothing\n // trails it; otherwise it stays a parent link.\n const resourceIsCurrent = !pageLabel && !(middleSegments && middleSegments.length > 0);\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {leading(resourceKey)}\n {resourceIsCurrent ? (\n current(tid.navBreadcrumb(resourceKey), resourceLabel)\n ) : !hasListPage(def) ? (\n // `views.list.page: false`: there is no list to go back to, so the crumb only names it.\n <span\n data-testid={tid.navBreadcrumb(resourceKey)}\n className=\"truncate\"\n title={resourceLabel}\n >\n {resourceLabel}\n </span>\n ) : (\n <RouterLink\n href={listHref}\n data-testid={tid.navBreadcrumb(resourceKey)}\n className={cn(LINK_CLASS, 'truncate')}\n title={resourceLabel}\n >\n {resourceLabel}\n </RouterLink>\n )}\n {middleSegments?.map((seg, i) => (\n <span key={`mid:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n <Chevron />\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(resourceKey)}:mid:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span className=\"truncate\" title={seg.label}>\n {seg.label}\n </span>\n )}\n </span>\n ))}\n {pageLabel && (\n <>\n <Chevron />\n {current(tid.navBreadcrumb(resourceKey, recordId), pageLabel)}\n </>\n )}\n {help}\n </nav>\n );\n}\n","'use client';\nimport { effectiveFlow } from '@burojs/core';\nimport {\n useApplicationSnapshot,\n useDocTrailScopes,\n useNavigationOrigin,\n usePublishOriginTitle,\n useRecordTitle,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { Breadcrumbs } from './breadcrumbs.js';\nimport { recordTrailKey, usePublishedRecordTrail } from './record-trail-store.js';\nimport {\n type OriginTrail,\n originTrail,\n recordTrail,\n recordTrailRoute,\n type TrailContext,\n useTrailContext,\n} from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\n\n/**\n * The record trail of the current route, the one `<HeaderBreadcrumbs>` draws\n * there; record and flow pages draw none of their own.\n *\n * On a record route whose operation is available: the group chain, the\n * resource, then the record (show), the record linking to show when show is\n * available plus \"Edit\" (edit), or \"Create\" (create). The record crumb is the\n * record's title once `<RecordPage>` has loaded it, and the id while it loads,\n * has failed, or is not mounted at all.\n *\n * On a page-hosted flow's route: the record's edit-shaped trail ending with the\n * flow's label, once the flow page shows its form or its \"not available\"\n * notice; until then, and on every not-found it answers with, the record's\n * show trail with the id, so a flow the user may not run is never named. A\n * name no flow answers to is the framework 404, with no trail.\n *\n * With an origin (`useNavigationOrigin`) the trail roots where the user came\n * from instead of at the record's resource (navigation origin): a filtered\n * list keeps its address on the resource crumb, a parent record's card\n * replaces the resource crumb with its own trail. A record page reached from a\n * list whose resource routes its show here (`routesTo.show`, a view onto this\n * resource) asks that resource for help first, then this one.\n *\n * Nothing on any other route.\n */\n\n/**\n * @internal The resource of a list origin whose `routesTo.show` is `resource`: the list the\n * shared record page was reached from, whose documentation the reader is asking for first.\n */\nexport function viewOrigin(ctx: TrailContext, trail: OriginTrail | undefined, resource: string) {\n if (trail === undefined || trail.resource === undefined || trail.segments.length > 0)\n return undefined;\n const def = ctx.registry.get(trail.resource);\n const target = def?.routesTo?.show;\n if (target === undefined || ctx.registry.get(target) !== ctx.registry.get(resource))\n return undefined;\n return trail.resource;\n}\nexport function RecordBreadcrumbs(): ReactElement | null {\n const ctx = useTrailContext();\n const match = useMatch();\n const snapshot = useApplicationSnapshot();\n const route = recordTrailRoute(ctx.registry, match);\n const published = usePublishedRecordTrail(\n route === null\n ? ''\n : recordTrailKey(\n route.resource,\n route.id,\n route.flow === undefined ? route.action : `flow:${route.flow}`,\n ),\n );\n // `#<id>` (or `''` without an id): what the trail shows until the page publishes the title.\n const idTitle = useRecordTitle(route?.resource, route?.id);\n // The title this trail shows is what an origin captured on leaving the page carries.\n usePublishOriginTitle(published?.title || undefined);\n const origin = useNavigationOrigin();\n const rooted = origin === null ? undefined : originTrail(ctx, origin);\n const view = route === null ? undefined : viewOrigin(ctx, rooted, route.resource);\n const viewScopes = useDocTrailScopes(view);\n const ownScopes = useDocTrailScopes(view === undefined ? undefined : route?.resource);\n const docScopes =\n view === undefined ? {} : { docScopes: [...new Set([...viewScopes, ...ownScopes])] };\n if (route === null || match === null) return null;\n const { resource, id, groupChain } = route;\n const title = published?.title ?? idTitle;\n const withOrigin = rooted === undefined ? {} : { origin: rooted };\n if (route.flow !== undefined) {\n if (effectiveFlow(snapshot, match.ref, route.flow) === undefined) return null;\n const flowLabel = published?.flowLabel;\n if (flowLabel === undefined) {\n return (\n <Breadcrumbs\n {...recordTrail(ctx, {\n resource,\n action: 'show',\n id,\n title: idTitle,\n groupChain,\n ...withOrigin,\n })}\n {...docScopes}\n data-testid=\"record-breadcrumbs\"\n />\n );\n }\n return (\n <Breadcrumbs\n {...recordTrail(ctx, { resource, action: 'edit', id, title, groupChain, ...withOrigin })}\n {...docScopes}\n pageLabel={flowLabel}\n data-testid=\"record-breadcrumbs\"\n />\n );\n }\n return (\n <Breadcrumbs\n {...recordTrail(ctx, {\n resource,\n action: route.action,\n id,\n title,\n groupChain,\n ...withOrigin,\n })}\n {...docScopes}\n data-testid=\"record-breadcrumbs\"\n />\n );\n}\n","import { BUILTIN_LAYOUTS, type NavLayout } from './nav-slots.js';\n\n/**\n * The built-in content-wrapping layouts as a Components-registry table.\n *\n * Optional: `secondary-sidebar` and `tabs` resolve without it. Spread it into\n * `BuroProvider`'s `components` only to wrap or re-register the built-ins.\n */\nexport const defaultNavLayouts: Record<string, NavLayout> = { ...BUILTIN_LAYOUTS };\n","'use client';\nimport { humanizeKey } from '@burojs/core';\nimport { useChromeT, useOptionalT, useTestIds } from '@burojs/react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport { cn } from '../lib/cn.js';\n\ninterface ContextPickerBase {\n /**\n * Slice name (also used in testid). Free-form — playground uses 'company',\n * 'productGroup', 'location' etc.\n */\n sliceName: string;\n /** Human label shown above the dropdown. Falls back to humanizeKey(sliceName). */\n label?: string;\n options: Array<{ value: string; label: string }>;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n /**\n * When true, render the label as `sr-only` instead of the visual\n * uppercase eyebrow. Useful when the picker is one of a row of\n * dense pickers in a sidebar (the iar-ui pattern: company on its\n * own row, then `[PG] [Location]` side-by-side with placeholder\n * text doing the labelling). Accessibility is preserved — screen\n * readers still announce the label, only the visual chrome is\n * suppressed.\n */\n hideLabel?: boolean;\n}\n\nexport type ContextPickerProps =\n | (ContextPickerBase & {\n allOption?: undefined;\n value: string | null;\n onChange: (value: string) => void;\n })\n | (ContextPickerBase & {\n /**\n * Adds an \"All\" item first: `true` labels it with the `scope.all` chrome string, a string\n * is the label. `value: null` selects it and `onChange` receives `null` for it.\n */\n allOption: true | string;\n value: string | null;\n onChange: (value: string | null) => void;\n });\n\n/** The Radix `Select` rejects an empty item value, so \"All\" travels under this private one. */\nconst ALL = '\\u0000all';\n\n/**\n * Generic context picker — a labeled dropdown that drives a slice value.\n * Used in the sidebar / header to switch company, product group, location, etc.\n *\n * The component is presentational. Consumers wire it to whatever store they\n * use (auth context, buro context engine, or local state).\n */\nexport function ContextPicker({\n sliceName,\n label,\n options,\n value,\n onChange,\n placeholder,\n disabled,\n className,\n hideLabel,\n allOption,\n}: ContextPickerProps): React.ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const chromeT = useChromeT();\n const allLabel =\n typeof allOption === 'string' ? allOption : chromeT('scope.all', { defaultValue: 'All' });\n const displayLabel = label ?? humanizeKey(sliceName);\n return (\n <div className={cn('space-y-1', className)}>\n <label\n htmlFor={`context-picker:${sliceName}`}\n className={\n hideLabel\n ? 'sr-only'\n : 'text-xs font-medium text-muted-foreground uppercase tracking-wide'\n }\n >\n {displayLabel}\n </label>\n <Select\n value={value ?? (allOption === undefined ? '' : ALL)}\n onValueChange={(next) => {\n if (allOption === undefined) onChange(next);\n else onChange(next === ALL ? null : next);\n }}\n disabled={disabled}\n >\n <SelectTrigger\n id={`context-picker:${sliceName}`}\n data-testid={tid.contextPicker(sliceName)}\n className={cn('w-full', hideLabel ? 'h-8 text-xs' : undefined)}\n >\n <SelectValue\n placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })}\n />\n </SelectTrigger>\n <SelectContent>\n {allOption === undefined ? null : (\n <SelectItem value={ALL} data-testid={tid.contextPickerOption(sliceName, 'all')}>\n {allLabel}\n </SelectItem>\n )}\n {options.map((o) => (\n <SelectItem\n key={o.value}\n value={o.value}\n data-testid={tid.contextPickerOption(sliceName, o.value)}\n >\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n );\n}\n","'use client';\nimport { humanizeKey, type ReadScopeValue, type ScopeSelectionValue } from '@burojs/core';\nimport { useChromeT, useScope, useTestIds } from '@burojs/react';\nimport { useMemo } from 'react';\nimport { FacetedFilterPicker } from '../data-table/data-table-faceted-filter.js';\nimport { cn } from '../lib/cn.js';\nimport { ContextPicker } from './context-picker.js';\nimport { type DimensionOption, useResourceDimensionOptions } from './use-dimension-options.js';\n\nexport interface ScopeDimensionPickerProps {\n /** A key of `defineScope(...)`. */\n dimension: string;\n /** Falls back to `humanizeKey(dimension)`. */\n label?: string;\n hideLabel?: boolean;\n className?: string;\n}\n\n/**\n * The control for one scope dimension (read-scope spec 7c.3): the dimension's values as options,\n * \"All\" first (nothing selected means everything allowed), writing `useScope().select`. A\n * selection change, never a transition: no cache is cleared and nothing in flight is cancelled.\n * Renders nothing for `select: 'none'`.\n */\nexport function ScopeDimensionPicker(props: ScopeDimensionPickerProps): React.ReactElement | null {\n const scope = useScope();\n const definition = scope.definition?.dimensions[props.dimension];\n if (definition === undefined) {\n throw new Error(\n `ScopeDimensionPicker: '${props.dimension}' is not a dimension of the app's defineScope(...)`,\n );\n }\n if (definition.select === 'none') return null;\n const source = definition.values;\n if (source === undefined) {\n throw new Error(\n `ScopeDimensionPicker: dimension '${props.dimension}' declares no values; add values: { resource } or a { value, label } list`,\n );\n }\n const allowed = scope.access[props.dimension]?.allowed;\n const permitted = Array.isArray(allowed) ? (allowed as readonly ReadScopeValue[]) : undefined;\n const common = {\n ...props,\n multiple: definition.select === 'multiple',\n all: definition.all,\n selected: scope.selection[props.dimension] ?? null,\n select: (value: ScopeSelectionValue) => scope.select(props.dimension, value),\n };\n if (Array.isArray(source)) {\n const options = (source as readonly DimensionOption[]).filter(\n (option) => permitted === undefined || permitted.includes(option.value),\n );\n return <DimensionControl {...common} options={options} />;\n }\n const { resource, label } = source as { resource: string; label?: string };\n return (\n <ResourceDimension {...common} resource={resource} {...(label ? { labelField: label } : {})} />\n );\n}\n\ninterface ControlProps extends ScopeDimensionPickerProps {\n readonly multiple: boolean;\n readonly all: boolean;\n readonly selected: ScopeSelectionValue;\n readonly select: (value: ScopeSelectionValue) => void;\n readonly options: readonly DimensionOption[];\n}\n\n/** A resource-backed dimension: its values come from {@link useResourceDimensionOptions}. */\nfunction ResourceDimension({\n resource,\n labelField,\n ...rest\n}: Omit<ControlProps, 'options'> & {\n readonly resource: string;\n readonly labelField?: string;\n}): React.ReactElement {\n const options = useResourceDimensionOptions(rest.dimension, resource, labelField);\n return <DimensionControl {...rest} options={options} />;\n}\n\nfunction DimensionControl({\n dimension,\n label,\n hideLabel,\n className,\n multiple,\n all,\n selected,\n select,\n options,\n}: ControlProps): React.ReactElement {\n const tid = useTestIds();\n const chromeT = useChromeT();\n const byText = useMemo(\n () => new Map(options.map((option) => [String(option.value), option.value] as const)),\n [options],\n );\n const textOptions = useMemo(\n () => options.map((option) => ({ value: String(option.value), label: option.label })),\n [options],\n );\n const picked = (Array.isArray(selected) ? selected : selected === null ? [] : [selected]).map(\n String,\n );\n const text = label ?? humanizeKey(dimension);\n if (multiple) {\n return (\n <div className={cn('space-y-1', className)}>\n <span\n className={\n hideLabel\n ? 'sr-only'\n : 'text-xs font-medium text-muted-foreground uppercase tracking-wide'\n }\n >\n {text}\n </span>\n <FacetedFilterPicker\n title={text}\n options={textOptions}\n selected={picked}\n {...(all\n ? { emptyLabel: chromeT('scope.all', { defaultValue: 'All' }) }\n : { clearable: false })}\n onChange={(next) => {\n // `all: false`: an empty selection would mean \"everything\", which the dimension opted\n // out of, so the last value cannot be deselected.\n if (next.length === 0 && !all) return;\n select(next.length === 0 ? null : next.map((value) => byText.get(value) ?? value));\n }}\n getTestId={(role, value) =>\n role === 'trigger'\n ? tid.contextPicker(dimension)\n : role === 'option'\n ? tid.contextPickerOption(dimension, value ?? '')\n : role === 'clear'\n ? tid.contextPickerOption(dimension, 'all')\n : undefined\n }\n />\n </div>\n );\n }\n const common = {\n sliceName: dimension,\n ...(label === undefined ? {} : { label }),\n options: textOptions,\n value: picked[0] ?? null,\n ...(hideLabel === undefined ? {} : { hideLabel }),\n ...(className === undefined ? {} : { className }),\n };\n const choose = (value: string | null) =>\n select(value === null ? null : (byText.get(value) ?? value));\n return all ? (\n <ContextPicker {...common} allOption onChange={choose} />\n ) : (\n <ContextPicker {...common} onChange={choose} />\n );\n}\n","'use client';\nimport { useOptionalT, useTestIds } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport { localeLabel } from '../shell/language-submenu.js';\nimport { useLanguageSwitch } from '../shell/use-language-switch.js';\n\nexport interface LanguageSwitchProps {\n /**\n * Called with the picked locale code AFTER the live locale has switched and\n * the choice has been persisted.\n */\n onChange?: (code: string) => void;\n className?: string;\n}\n\n/**\n * Segmented locale switcher: one button per locale the i18n facade lists\n * (`I18nFacade.locales`, which `createI18nFromRegistry` fills from the\n * registry), each labelled with the locale's own name (`Intl.DisplayNames`).\n * A view over {@link useLanguageSwitch}: picking a locale switches the LIVE\n * locale (no reload) and persists it under `<BuroProvider languageStorageKey>`.\n *\n * Reactivity: the active locale is read live, so the switcher always reflects\n * the CURRENT locale, including a change made elsewhere. `tests/language-switch.test.tsx`\n * guards that nothing here reloads the page.\n */\nexport function LanguageSwitch({ onChange, className }: LanguageSwitchProps): React.ReactElement {\n const t = useOptionalT();\n const tid = useTestIds();\n const { locale, locales, change } = useLanguageSwitch();\n\n function pick(code: string) {\n if (code === locale) return;\n change(code);\n onChange?.(code);\n }\n\n return (\n <div\n data-testid={tid.languageSwitch()}\n data-language-state={locale}\n className={cn(\n 'inline-flex items-center rounded-md border border-input bg-background',\n className,\n )}\n role=\"group\"\n aria-label={t('language.label', { defaultValue: 'Language' })}\n >\n {locales.map((code) => {\n const isActive = locale === code;\n return (\n <Button\n key={code}\n type=\"button\"\n size=\"sm\"\n variant={isActive ? 'secondary' : 'ghost'}\n data-testid={tid.languageSwitchOption(code)}\n data-active={isActive ? 'true' : 'false'}\n aria-pressed={isActive}\n onClick={() => pick(code)}\n className={cn(\n 'h-7 rounded-sm px-2 text-xs font-medium',\n !isActive && 'text-muted-foreground',\n )}\n >\n {localeLabel(code)}\n </Button>\n );\n })}\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { Breadcrumbs } from './breadcrumbs.js';\nimport { RecordBreadcrumbs } from './record-breadcrumbs.js';\nimport { headerTrail, recordTrailRoute, useTrailContext } from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\n\n/**\n * The page's one breadcrumb trail, and `<AppHeader>`'s default `breadcrumbs`:\n * the group chain and the resource, custom page or group — and on a record\n * route or a page-hosted flow's route the record trail (`<RecordBreadcrumbs>`,\n * `data-testid=\"record-breadcrumbs\"`), which ends with the record's title once\n * the page has loaded it. Record and flow pages draw no trail of their own, so\n * a page never shows two. Nothing — silently — without a match: a sidebar or\n * header rendered in a story with no router is not a misconfiguration, and\n * `<NavAreaPage>`'s own message is the one that names the fix.\n */\nexport function HeaderBreadcrumbs(): ReactElement | null {\n const ctx = useTrailContext();\n const match = useMatch();\n if (recordTrailRoute(ctx.registry, match) !== null) return <RecordBreadcrumbs />;\n const trail = headerTrail(ctx, match);\n if (trail === null) return null;\n return <Breadcrumbs {...trail} data-testid=\"header-breadcrumbs\" />;\n}\n","'use client';\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { CommandDialog, CommandInput, CommandList, CommandEmpty } from '../primitives/command.js';\n\n/** Provider-optional translator returned by {@link useOptionalT}. */\ntype Translator = ReturnType<typeof useOptionalT>;\n\n/**\n * Test-id role passed to the optional `getTestId` builder so adopters\n * can address the dialog body, input, empty-state, and footer nodes\n * from e2e tests without leaking implementation details into the\n * component API.\n */\nexport type CommandPaletteTestIdRole = 'dialog' | 'input' | 'empty' | 'footer';\n\n/**\n * Default empty-state node — shown when no group renders any items.\n * Mentions both retrying the search and falling back to the navigation\n * (since the palette doubles as the primary navigator). Adopters can\n * override via the `emptyState` prop. Localized via `commandPalette.empty`\n * + `commandPalette.emptyHint` (English fallbacks preserved for the\n * no-provider path).\n */\nfunction defaultEmptyState(t: Translator): ReactNode {\n return (\n <div className=\"py-6 text-center text-sm\">\n <p className=\"text-muted-foreground\">\n {t('commandPalette.empty', { defaultValue: 'No matches found.' })}\n </p>\n <p className=\"mt-2 text-xs text-muted-foreground/70\">\n {t('commandPalette.emptyHint', {\n defaultValue: 'Try a different search or open a resource from the navigation.',\n })}\n </p>\n </div>\n );\n}\n\n/**\n * Default footer hint — keyboard affordance crib so first-time users\n * discover ↑↓ / Enter / Esc without RTFM. Adopters can override via\n * the `footer` prop, or pass `footer={null}` to hide the slot entirely.\n * The three action labels are localized via `commandPalette.navigate` /\n * `.select` / `.close` (English fallbacks preserved for the no-provider\n * path).\n */\nfunction defaultFooter(t: Translator): ReactNode {\n return (\n <div className=\"flex items-center justify-between gap-2 border-t px-3 py-2 text-xs text-muted-foreground\">\n <div className=\"flex items-center gap-1.5\">\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">↑↓</kbd>\n <span>{t('commandPalette.navigate', { defaultValue: 'Navigate' })}</span>\n <span className=\"mx-1 opacity-50\">·</span>\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">Enter</kbd>\n <span>{t('commandPalette.select', { defaultValue: 'Select' })}</span>\n <span className=\"mx-1 opacity-50\">·</span>\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">Esc</kbd>\n <span>{t('commandPalette.close', { defaultValue: 'Close' })}</span>\n </div>\n </div>\n );\n}\n\n/**\n * Props for `<CommandPalette>`. The component owns the modal frame +\n * search input + empty-state slot; adopters compose their own groups\n * (Resources, Pages, Recent, Records, Actions) inside `children`.\n */\nexport interface CommandPaletteProps {\n /** Whether the palette is open. Required (controlled). */\n open: boolean;\n /** Called when the palette wants to open / close (Esc, overlay click, item select). */\n onOpenChange: (open: boolean) => void;\n /**\n * Children render the groups + items inside `<CommandList>`. Adopters\n * compose their own sections; the palette body is otherwise empty.\n */\n children?: ReactNode;\n /**\n * Placeholder text in the search input. When omitted, resolves via\n * i18n (`commandPalette.search`, English fallback `\"Search…\"`).\n */\n placeholder?: string;\n /**\n * Empty state when no items match. Default: the framework's standard\n * \"No matches found.\" copy with a hint to fall back to the navigation.\n * Pass any node to override; pass `null` to render no empty-state row.\n */\n emptyState?: ReactNode;\n /**\n * Footer slot rendered below the list. Default: a keyboard-hint row\n * showing \"↑↓ Navigate · Enter Select · Esc Close\". Pass any node to\n * override; pass `null` to hide the footer entirely.\n */\n footer?: ReactNode;\n /**\n * Optional test-id builder. Receives a `role` (`dialog` | `input` |\n * `empty` | `footer`) and returns the test id, or `undefined` to skip.\n * Mirrors the `useTestIds` pattern used elsewhere in\n * `@burojs/ui-shadcn`.\n */\n getTestId?: (role: CommandPaletteTestIdRole) => string | undefined;\n /** Optional className forwarded to the dialog content wrapper. */\n className?: string;\n}\n\n/**\n * Modal command palette frame.\n *\n * Wraps `<CommandDialog>` with the standard input + list + empty-state\n * scaffolding so adopters only need to render their own\n * `<CommandGroup>` + `<CommandItem>` children.\n *\n * Open/close is controlled via `open` + `onOpenChange`. Pair with\n * `useCommandPalette()` from `@burojs/react` for `open`, `setOpen` and `toggle`, and\n * `useGlobalShortcut` from `@burojs/react/web` for the ⌘K/Ctrl+K shortcut.\n *\n * Defaults:\n *\n * - `emptyState` — framework \"No matches found.\" copy. Override via the\n * `emptyState` prop, or pass `null` to hide.\n * - `footer` — keyboard-hint row (↑↓ Navigate · Enter Select · Esc\n * Close). Override via the `footer` prop, or pass `null` to hide.\n *\n * Example:\n * ```tsx\n * const { open, setOpen, toggle } = useCommandPalette();\n * useGlobalShortcut({ key: 'k', mod: true }, toggle);\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandGroup heading=\"Resources\">\n * <CommandItem onSelect={() => router.push('/documents')}>\n * Documents\n * </CommandItem>\n * </CommandGroup>\n * </CommandPalette>\n * );\n * ```\n */\n/**\n * Lets a group whose items are `forceMount`-ed tell the palette that it is\n * showing results.\n *\n * ⚠️ Why this has to exist: cmdk's `<CommandEmpty>` renders when its internal\n * `filtered.count` is 0, and **force-mounted items are excluded from that\n * count**. Any group backed by a SERVER search must force-mount (cmdk's\n * client-side filter would otherwise hide rows the server already matched),\n * so the empty state is structurally blind to exactly the results that took\n * the longest to arrive. Acceptance testing caught the outcome: typing «plant»\n * rendered \"No results\" directly above two matching records.\n *\n * Groups call {@link useCommandPaletteResults} and report their count; the\n * palette suppresses the default empty state while any of them is non-zero.\n */\nconst CommandPaletteResultsContext = createContext<((key: string, count: number) => void) | null>(\n null,\n);\n\n/**\n * Report how many results a force-mounted group is currently showing.\n * No-op outside a `<CommandPalette>`, so groups stay usable standalone.\n */\nexport function useCommandPaletteResults(key: string): (count: number) => void {\n const report = useContext(CommandPaletteResultsContext);\n return useCallback(\n (count: number) => {\n report?.(key, count);\n },\n [report, key],\n );\n}\n\nexport function CommandPalette({\n open,\n onOpenChange,\n children,\n placeholder,\n emptyState,\n footer,\n getTestId,\n className,\n}: CommandPaletteProps) {\n const t = useOptionalT();\n const dialogTestId = getTestId?.('dialog');\n const inputTestId = getTestId?.('input');\n const emptyTestId = getTestId?.('empty');\n const footerTestId = getTestId?.('footer');\n\n const resolvedPlaceholder =\n placeholder ?? t('commandPalette.search', { defaultValue: 'Search…' });\n\n // `undefined` → use default; `null` → render nothing; any other node\n // → render that node. This lets adopters opt out of the slot without\n // a separate boolean prop.\n // Counts reported by force-mounted groups (see CommandPaletteResultsContext).\n const [asyncCounts, setAsyncCounts] = useState<Record<string, number>>({});\n const reportResults = useCallback((key: string, count: number) => {\n setAsyncCounts((prev) => (prev[key] === count ? prev : { ...prev, [key]: count }));\n }, []);\n const hasAsyncResults = useMemo(\n () => Object.values(asyncCounts).some((n) => n > 0),\n [asyncCounts],\n );\n\n const resolvedEmpty = emptyState === undefined ? defaultEmptyState(t) : emptyState;\n const resolvedFooter = footer === undefined ? defaultFooter(t) : footer;\n\n /**\n * ⚠️ Where focus goes when the palette closes.\n *\n * The palette usually opens from a KEYBOARD SHORTCUT, so there is no trigger\n * for Radix to restore focus to — pressing Escape dropped focus on <body>\n * and a keyboard user restarted from the top of the document. A keyboard-only\n * acceptance pass measured the same fall-through whether it was opened with\n * Ctrl+K or by activating the search chip.\n *\n * Remembering what was focused at open time covers both cases, and is\n * strictly better than a trigger ref: it returns the user to where they\n * actually were.\n */\n const restoreFocusRef = useRef<HTMLElement | null>(null);\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (next) {\n const active = typeof document !== 'undefined' ? document.activeElement : null;\n restoreFocusRef.current = active instanceof HTMLElement ? active : null;\n } else {\n const target = restoreFocusRef.current;\n restoreFocusRef.current = null;\n // After the dialog unmounts, or Radix's own restore overwrites it.\n if (target?.isConnected) requestAnimationFrame(() => target.focus());\n }\n onOpenChange(next);\n },\n [onOpenChange],\n );\n\n return (\n <CommandDialog\n open={open}\n onOpenChange={handleOpenChange}\n className={className}\n title={t('commandPalette.title', { defaultValue: 'Command Palette' })}\n description={t('commandPalette.description', { defaultValue: 'Search and run actions.' })}\n >\n <CommandInput placeholder={resolvedPlaceholder} data-testid={inputTestId} />\n <CommandList data-testid={dialogTestId}>\n {resolvedEmpty !== null && !hasAsyncResults && (\n <CommandEmpty data-testid={emptyTestId}>{resolvedEmpty}</CommandEmpty>\n )}\n <CommandPaletteResultsContext.Provider value={reportResults}>\n {children}\n </CommandPaletteResultsContext.Provider>\n </CommandList>\n {resolvedFooter !== null && (\n <div data-testid={footerTestId} data-slot=\"command-palette-footer\">\n {resolvedFooter}\n </div>\n )}\n </CommandDialog>\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { useShell } from '../shell/shell-context.js';\n\nexport interface CommandPaletteTriggerProps {\n /**\n * Opens the palette. Defaults to the `ShellProvider`'s `openPalette`; with\n * neither, the trigger renders nothing.\n */\n onOpen?: () => void;\n /** Shortcut hint rendered in the `<kbd>` chip. Defaults to `⌘K`. */\n shortcut?: string;\n /** `data-testid` for the trigger button. Default `'open-palette'`. */\n testid?: string;\n className?: string;\n}\n\n/**\n * Header affordance that opens the command palette — the visible, clickable\n * counterpart to the global ⌘K / Ctrl+K shortcut.\n *\n * Lives in the library (rather than being re-hand-rolled per app) so its label\n * and accessible name come from the framework i18n bundle\n * (`commandPalette.trigger` / `.triggerHint`) instead of hardcoded English.\n * Falls back to English when rendered outside a `BuroProvider`.\n */\nexport function CommandPaletteTrigger({\n onOpen,\n shortcut = '⌘K',\n testid = 'open-palette',\n className,\n}: CommandPaletteTriggerProps): React.ReactElement | null {\n const t = useOptionalT();\n const { openPalette } = useShell();\n const open = onOpen ?? openPalette;\n const hint = t('commandPalette.triggerHint', {\n defaultValue: 'Open command palette (⌘K / Ctrl+K)',\n });\n if (open === undefined) return null;\n return (\n <button\n type=\"button\"\n data-testid={testid}\n onClick={() => open()}\n title={hint}\n aria-label={hint}\n className={cn(\n // The header's one control shape: h-8, outlined, like the app actions and refresh beside it.\n 'hidden md:inline-flex h-8 items-center gap-1.5 rounded-md border border-input bg-background px-2.5',\n 'text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground',\n className,\n )}\n >\n <span>{t('commandPalette.trigger', { defaultValue: 'Search' })}</span>\n <kbd className=\"rounded border bg-background px-1 font-mono text-[10px]\">{shortcut}</kbd>\n </button>\n );\n}\n","'use client';\nimport { Fragment, type ReactNode, useMemo } from 'react';\nimport {\n hasListPage,\n evaluateVisible,\n hrefFor,\n isCustomPageDef,\n navHrefFor,\n nodeKind,\n resolveNavLabel,\n resolveResourceLabel,\n type CustomPageDef,\n type NavGroupDef,\n type NavNode,\n type ResourceDef,\n type SectionDef,\n declaredText,\n} from '@burojs/core';\nimport {\n useApp,\n useI18nCaps,\n useOptionalT,\n useRouteNavigate,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem, CommandSeparator } from '../primitives/command.js';\nimport { cn } from '../lib/cn.js';\nimport { useLayoutResolver } from './nav-slots.js';\nimport { useNavVisible, usePageAllowed, useResourceVisible } from './use-nav-routing.js';\nimport { canonicalNavKey, canonicalResourceKey } from '../resource-key.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used elsewhere in `@burojs/ui-shadcn` so adopters\n * can address each navigation entry from e2e tests without touching\n * implementation details.\n *\n * - `resource` — a resource entry (top-level OR inside a section/group).\n * - `page` — a custom-page entry (top-level OR inside a section/group).\n * - `section` — the (disabled) header row of a sidebar section.\n * - `group` — a nav-group's own \"jump to area\" entry (content groups —\n * secondary-sidebar/tabs — only; flat/collapsible groups contribute no\n * entry of their own, only their members').\n */\nexport type CommandPaletteNavigationTestIdRole = 'resource' | 'page' | 'section' | 'group';\n\n/**\n * Props for `<CommandPaletteNavigationGroups>`.\n *\n * The component reads the current `App` from `useApp()` (so it must be\n * rendered inside a `BuroProvider`) and the visibility context from\n * `useVisibilityCtx()` (mirrors the sidebar's filter logic so an entry\n * hidden in the sidebar stays hidden in the palette).\n *\n * Navigation goes through `useRouteNavigate` — the `RouterAdapter` the host\n * mounts above `<BuroProvider>` — so picks stay client-side with nothing to\n * wire.\n */\nexport interface CommandPaletteNavigationGroupsProps {\n /**\n * Called after the user picks a navigation entry, BEFORE the\n * navigation. Adopters typically wire this to `setOpen(false)` to close\n * the palette before the route change. Optional.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives a `role` plus an entry-specific\n * `id` (resource name, page name, or `<section>:<name>` for entries\n * rendered under a section) and returns the test id, or `undefined`\n * to skip. Returning `undefined` keeps the entry rendered but\n * unaddressable from tests.\n */\n getTestId?: (role: CommandPaletteNavigationTestIdRole, id: string) => string | undefined;\n}\n\n/**\n * Render the framework's standard navigation entries inside a command\n * palette: top-level Resources, top-level Pages, and Sections (with their\n * resource + page children rendered inline beneath each section header).\n *\n * Visibility filtering mirrors `<Sidebar>` (visible predicates evaluated\n * against `useVisibilityCtx()`, fail-closed for throwing predicates,\n * resources with no list page hidden from navigation entirely). An entry hidden\n * in the sidebar is also hidden in the palette — that parity is the\n * primary contract of this component.\n *\n * Rendering rules:\n *\n * - The component is `<CommandList>`-aware: it renders only\n * `<CommandGroup>` / `<CommandItem>` / `<CommandSeparator>` children, so\n * it can be dropped directly inside `<CommandPalette>` (which already\n * provides the dialog frame + input + empty state).\n * - Empty groups are suppressed entirely (no heading rendered) so the\n * palette never shows a stray \"Resources\" header above zero items.\n * - `<CommandSeparator>` is inserted only between consecutive non-empty\n * groups, not unconditionally.\n * - Each `<CommandItem>`'s `value` prop combines the role prefix + the\n * stable id + the rendered label so cmdk's built-in fuzzy filter can\n * match by either label or id (typing \"doc\" matches \"Documents\" via\n * the label fragment).\n * - Section groups render the section's label as the cmdk\n * `<CommandGroup heading={...}>` AND as a leading disabled item — the\n * disabled item gives e2e tests a stable testid plus contributes the\n * section name to cmdk's fuzzy match, so typing the section name\n * surfaces the whole group.\n *\n * Example (Next App Router):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import {\n * CommandPalette,\n * CommandPaletteNavigationGroups,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen } = useCommandPalette();\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteNavigationGroups({\n onSelect,\n getTestId,\n}: CommandPaletteNavigationGroupsProps): React.ReactElement | null {\n const app = useApp();\n const caps = useI18nCaps();\n const visibilityCtx = useVisibilityCtx();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n // Canonical, nesting-aware visibility predicate — same one `hrefFor`\n // consults to resolve a content-less group's first visible descendant.\n // Structurally identical to `isResourceVisible` below (both delegate to\n // `evaluateVisible`), but typed over `NavNode` so it also covers groups.\n const isVisible = useNavVisible();\n const resolveLayout = useLayoutResolver();\n\n // Visibility filter — the same predicate the sidebar uses (`useResourceVisible`).\n const isResourceVisible = useResourceVisible();\n // A page also needs its `requires` decided in the user's favour: undecided draws no entry.\n const pageAllowed = usePageAllowed();\n const isPageVisible = (p: CustomPageDef): boolean =>\n evaluateVisible(p.visible, visibilityCtx) && pageAllowed(p);\n\n // Resources and custom pages split by whether they belong to a\n // section, exactly mirroring `<Sidebar>`'s split. Embedded subresources\n // are dropped from BOTH the top-level list AND any section grouping\n // below — they are reached only through a placement in their parent.\n const { topLevelResources, topLevelPages, sectionGroups } = useMemo(() => {\n const allResources = app.registry.list();\n const allPages = app.registry.customPages.list();\n const allSections = app.registry.sections.list();\n\n const visibleResources = allResources.filter((r) => hasListPage(r)).filter(isResourceVisible);\n\n const tlResources = visibleResources.filter((r) => !r.section && !r.group);\n const tlPages = allPages.filter((p) => !p.section && !p.group).filter(isPageVisible);\n\n const groups: Array<{\n section: SectionDef;\n children: Array<ResourceDef | CustomPageDef>;\n }> = [];\n for (const section of allSections) {\n const children = app.registry.sections\n .childrenOf(canonicalNavKey(section))\n // A group is the structural navigation owner when a declaration\n // carries both `section` (categorisation) and `group` (placement).\n // Rendering it here as well would emit the same leaf twice.\n .filter((c) => !c.group)\n // Embedded-only resources hidden from sections too (see Sidebar\n // notes for parity).\n .filter((c) => !('parent' in c) || hasListPage(c))\n // Per-node visibility: a gated resource or page is dropped (the page\n // route renders not-found for a hidden page anyway).\n .filter((c) => (isCustomPageDef(c) ? isPageVisible(c) : isResourceVisible(c)));\n if (children.length === 0) continue;\n groups.push({ section, children });\n }\n\n return {\n topLevelResources: tlResources,\n topLevelPages: tlPages,\n sectionGroups: groups,\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app, visibilityCtx]);\n\n const goTo = (href: string): void => {\n onSelect?.();\n navigate(href, { origin: 'jump' });\n };\n\n const resourceLabel = (def: ResourceDef): string =>\n resolveResourceLabel(caps, canonicalResourceKey(def), 'plural', def);\n\n const pageLabel = (def: CustomPageDef): string =>\n resolveNavLabel(caps, `pages.${canonicalNavKey(def)}`, declaredText('chrome', def, 'label'));\n\n // Build the list of group nodes first so we can interleave separators\n // between consecutive non-empty groups without nested ternaries. cmdk\n // discovers groups + items via DOM data-attributes, so wrapping or\n // not wrapping the groups in a parent element makes no difference to\n // its filter / keyboard nav semantics.\n const groups: ReactNode[] = [];\n\n if (topLevelResources.length > 0) {\n groups.push(\n <CommandGroup\n heading={t('commandPalette.resources', { defaultValue: 'Resources' })}\n key=\"resources\"\n >\n {topLevelResources.map((def) => {\n const resource = canonicalResourceKey(def);\n const label = resourceLabel(def);\n const href = hrefFor(app.registry, resource, { isVisible });\n return (\n <CommandItem\n key={`resource:${resource}`}\n value={`resource:${resource}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', resource)}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n if (topLevelPages.length > 0) {\n groups.push(\n <CommandGroup heading={t('commandPalette.pages', { defaultValue: 'Pages' })} key=\"pages\">\n {topLevelPages.map((page) => {\n const pageKey = canonicalNavKey(page);\n const label = pageLabel(page);\n const href = page.path;\n return (\n <CommandItem\n key={`page:${pageKey}`}\n value={`page:${pageKey}:${page.path}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', pageKey)}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n for (const { section, children } of sectionGroups) {\n const sectionKey = canonicalNavKey(section);\n const sectionLabel = resolveNavLabel(\n caps,\n `sections.${sectionKey}`,\n declaredText('chrome', section, 'label'),\n );\n groups.push(\n <CommandGroup heading={sectionLabel} key={`section:${sectionKey}`}>\n {/* Disabled label-only header inside the group — supplements\n cmdk's heading by contributing the section label to the\n fuzzy match AND by providing a stable testid per-section\n for e2e specs that want to assert section presence. */}\n <CommandItem\n key={`__section_header_${sectionKey}`}\n value={`section:${sectionKey}:${sectionLabel}`}\n disabled\n className=\"font-medium opacity-70\"\n data-testid={getTestId?.('section', sectionKey)}\n >\n {sectionLabel}\n </CommandItem>\n {children.map((child) => {\n if (isCustomPageDef(child)) {\n const pageKey = canonicalNavKey(child);\n const href = child.path;\n // Custom page child.\n const label = pageLabel(child);\n return (\n <CommandItem\n key={`section:${sectionKey}:page:${pageKey}`}\n value={`section:${sectionKey}:page:${pageKey}:${child.path}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', `${sectionKey}:${pageKey}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>\n );\n }\n // Resource child.\n const resource = canonicalResourceKey(child);\n const label = resourceLabel(child);\n const href = hrefFor(app.registry, resource, { isVisible });\n return (\n <CommandItem\n key={`section:${sectionKey}:resource:${resource}`}\n value={`section:${sectionKey}:resource:${resource}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', `${sectionKey}:${resource}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n // Nav-group entries — recursive per-group walk so every member, including\n // deeply nested-group members, gets a reachable palette entry (unlike the\n // sidebar's `<NavMain>`, which only single-links to a content group's own\n // area). A content group (secondary-sidebar/tabs — i.e. any group with a\n // registered layout renderer) contributes ONE \"jump to area\" entry via\n // `hrefFor(group)`; a flat/collapsible group contributes no entry of its\n // own. Either way, recursion continues into `childrenOf(group)` so every\n // leaf (and every content sub-group) surfaces as its own entry too — the\n // palette's whole-app search contract wouldn't hold if a resource three\n // groups deep were only reachable by drilling through the sidebar first.\n const collectGroupItems = (group: NavGroupDef, idPath: string, depth: number): ReactNode[] => {\n const items: ReactNode[] = [];\n const isContentGroup = !!resolveLayout(group.layout);\n if (isContentGroup) {\n const groupKey = canonicalNavKey(group);\n const label = resolveNavLabel(\n caps,\n `groups.${groupKey}`,\n declaredText('chrome', group, 'label'),\n );\n const href = navHrefFor(app.registry, groupKey, { isVisible });\n items.push(\n <CommandItem\n key={`group:${idPath}`}\n value={`group:${idPath}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('group', idPath)}\n className={depth > 0 ? cn('pl-6') : undefined}\n >\n {label}\n </CommandItem>,\n );\n }\n for (const child of app.registry.groups.childrenOf(canonicalNavKey(group))) {\n const kind = nodeKind(child);\n if (kind === 'group') {\n const sub = child as NavGroupDef;\n if (!isVisible(sub as NavNode)) continue;\n items.push(...collectGroupItems(sub, `${idPath}:${canonicalNavKey(sub)}`, depth + 1));\n continue;\n }\n if (kind === 'custom-page') {\n const page = child as CustomPageDef;\n const pageKey = canonicalNavKey(page);\n const label = pageLabel(page);\n const href = page.path;\n items.push(\n <CommandItem\n key={`page:${idPath}:${pageKey}`}\n value={`page:${idPath}:${pageKey}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', `${idPath}:${pageKey}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>,\n );\n continue;\n }\n // Resource child — a resource with no list page is hidden from\n // navigation entirely (parity with the top-level/section handling\n // above), and per-resource `visible(ctx)` still gates entry.\n const resource = child as ResourceDef;\n if (!hasListPage(resource)) continue;\n if (!isResourceVisible(resource)) continue;\n const resourceId = canonicalResourceKey(resource);\n const label = resourceLabel(resource);\n const href = hrefFor(app.registry, resourceId, { isVisible });\n items.push(\n <CommandItem\n key={`resource:${idPath}:${resourceId}`}\n value={`resource:${idPath}:${resourceId}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', `${idPath}:${resourceId}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>,\n );\n }\n return items;\n };\n\n const rootGroups = app.registry.groups\n .rootNodes()\n .filter((n) => nodeKind(n) === 'group') as NavGroupDef[];\n\n for (const group of rootGroups) {\n if (!isVisible(group as NavNode)) continue;\n const groupKey = canonicalNavKey(group);\n const items = collectGroupItems(group, groupKey, 0);\n if (items.length === 0) continue;\n const heading = resolveNavLabel(\n caps,\n `groups.${groupKey}`,\n declaredText('chrome', group, 'label'),\n );\n groups.push(\n <CommandGroup heading={heading} key={`group:${groupKey}`}>\n {items}\n </CommandGroup>,\n );\n }\n\n if (groups.length === 0) return null;\n\n // Interleave a `<CommandSeparator>` between consecutive groups so the\n // visual divider only renders between non-empty siblings.\n return (\n <>\n {groups.map((group, idx) => (\n <Fragment key={`navgrp-${idx}`}>\n {idx > 0 && <CommandSeparator />}\n {group}\n </Fragment>\n ))}\n </>\n );\n}\n","import { type RegistryReader, recordEntries, resolveStaticAvailability } from '@burojs/core';\n\n/**\n * Whether a record of `resource` without a `mode` page is reached through its quick entry\n * instead (spec 4.7): the operation is statically available, there is no page for it, and the\n * quick entry exists. The dynamic answer is the entry gate's, asked when it opens.\n */\nexport function opensInQuick(\n registry: RegistryReader,\n resource: string,\n mode: 'show' | 'edit' | 'create',\n): boolean {\n const def = registry.get(resource);\n if (def === undefined) return false;\n if (resolveStaticAvailability(registry, resource, mode).state !== 'available') return false;\n const entries = recordEntries(def);\n return !entries.page[mode] && entries.quick[mode] !== null;\n}\n","'use client';\nimport { Fragment, useMemo, useState, useEffect } from 'react';\nimport { useCommandState } from 'cmdk';\nimport { hrefFor, resolveResourceLabel } from '@burojs/core';\nimport {\n recordRouteAvailable,\n useApp,\n useCurrentUserId,\n useI18nCaps,\n useListAccess,\n useOptionalT,\n usePlatformStorage,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem, CommandSeparator } from '../primitives/command.js';\nimport { RECENT_LABEL_KEYS, type RecentRecord, readRecentRecords } from './recent-records.js';\nimport { opensInQuick } from './quick-targets.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by `<CommandPaletteNavigationGroups>`.\n *\n * - `recent` — a recently-visited record entry. `id` passed to the\n * builder is `<canonical resource>:<record-id>`.\n */\nexport type CommandPaletteRecentTestIdRole = 'recent';\n\n/**\n * Props for `<CommandPaletteRecentGroup>`.\n *\n * The component reads the signed-in user's recent list (the records\n * `<RecordPage>` recorded as it read them) and renders one `<CommandItem>`\n * per entry. It re-reads on every mount, when the user changes and when\n * `refreshKey` changes — single-tab consistency is preserved because the\n * palette dialog tears down + remounts each time it opens.\n */\nexport interface CommandPaletteRecentGroupProps {\n /**\n * Called BEFORE the navigation. Adopters typically wire this to\n * `setOpen(false)` to close the palette during the route change.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('recent', '<resource>:<id>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteRecentTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.recent`, English fallback `\"Recent\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Re-read trigger. When this prop changes the component re-reads\n * the platform's local store (e.g. flip from `false` → `true` on palette open).\n * Optional — when omitted the component reads only on mount and when\n * the user changes, which is sufficient for the typical \"palette\n * dialog re-mounts on each open\" use case.\n */\n refreshKey?: unknown;\n /**\n * Render a `<CommandSeparator>` after the group when the list is\n * non-empty. Default `true` — adopters composing alongside\n * `<CommandPaletteNavigationGroups>` get the divider for free, and\n * the separator stays hidden when Recent is empty (so no orphan\n * line at the top of the palette).\n */\n withSeparator?: boolean;\n}\n\n/**\n * The route an entry opens: the record's show route, else its edit route,\n * through the registry (so a resource nested in a group opens under the\n * group's path); `null` when the resource has no record page and the record\n * opens in its `quick.show` (spec 4.7: recent records include overlay visits);\n * `undefined` when the registry lacks the resource or it has neither.\n */\nfunction entryHref(\n registry: ReturnType<typeof useApp>['registry'],\n entry: RecentRecord,\n isResourceVisible: (def: { readonly visible?: unknown }) => boolean,\n) {\n const def = registry.get(entry.canonicalRef);\n if (def === undefined) return undefined;\n // A resource the user can no longer see (its `visible`) is not offered, whatever was stored.\n if (!isResourceVisible(def)) return undefined;\n for (const action of ['show', 'edit'] as const)\n if (recordRouteAvailable(registry, entry.canonicalRef, action))\n return hrefFor(registry, entry.canonicalRef, { action, id: entry.id });\n if (opensInQuick(registry, entry.canonicalRef, 'show')) return null;\n return undefined;\n}\n\n/**\n * Render the \"Recent\" group inside a command palette: the last records the\n * signed-in user opened. `<RecordPage>` records each show or edit visit\n * from the record it read — there is nothing to wire, and nothing is\n * recorded or shown without a signed-in user.\n *\n * Visibility:\n *\n * - Renders nothing when the recent list is empty (no orphan\n * \"Recent\" heading on a fresh user). Adopters that want a permanent\n * slot (with an empty-state row) can fork this component — the\n * surface is small.\n * - An entry opens the record's show route, else its edit route, built\n * from the registry. An entry whose resource the registry no longer\n * has, whose resource's `visible` now hides it from the user, or which\n * has neither route, is not rendered.\n *\n * Example (router-independent — picks navigate through `useRouteNavigate`,\n * the `RouterAdapter` seam `useResourceUrlState` also uses; wrap the app in\n * `RouterAdapterProvider` once):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import {\n * CommandPalette,\n * CommandPaletteRecentGroup,\n * CommandPaletteNavigationGroups,\n * CommandSeparator,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen } = useCommandPalette();\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteRecentGroup\n * onSelect={() => setOpen(false)}\n * refreshKey={open}\n * />\n * <CommandSeparator />\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteRecentGroup({\n onSelect,\n getTestId,\n heading,\n refreshKey,\n withSeparator = true,\n}: CommandPaletteRecentGroupProps): React.ReactElement | null {\n const caps = useI18nCaps();\n const app = useApp();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n const userId = useCurrentUserId();\n const isResourceVisible = useResourceVisible();\n const resolvedHeading = heading ?? t('commandPalette.recent', { defaultValue: 'Recent' });\n\n // Read in an effect, so the server and the first client paint both render `[]` (no hydration\n // mismatch) and an asynchronous store may answer later: the list shows once the read settles.\n const store = usePlatformStorage().local;\n const [stored, setStored] = useState<readonly RecentRecord[]>([]);\n useEffect(() => {\n if (userId === null) {\n setStored([]);\n return;\n }\n let current = true;\n const read = readRecentRecords(store, userId);\n if (Array.isArray(read)) setStored(read);\n else\n read.then(\n (entries) => {\n if (current) setStored(entries);\n },\n () => undefined,\n );\n return () => {\n current = false;\n };\n // refreshKey is intentionally a dep so callers can force a re-read.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, userId, refreshKey]);\n\n const recents = useMemo(\n () =>\n stored.flatMap((entry) => {\n const href = entryHref(app.registry, entry, isResourceVisible);\n return href === undefined ? [] : [{ entry, href }];\n }),\n [stored, app.registry, isResourceVisible],\n );\n\n // Hide the Recent group entirely while the user is typing — cmdk's\n // filtered groups (Resources / Pages / Records / Actions) take over\n // and the static \"last visited\" list would otherwise compete with\n // search-relevance ordering. Empty input → Recent visible. Any\n // typing (>=1 char) → Recent hidden + separator hidden too.\n const liveQuery = useCommandState((state) => state.search) ?? '';\n if (liveQuery.length > 0) return null;\n\n if (recents.length === 0) return null;\n\n const goTo = (href: string | null, entry: RecentRecord): void => {\n onSelect?.();\n if (href === null) quick.show(entry.canonicalRef, entry.id);\n else navigate(href, { origin: 'jump' });\n };\n\n return (\n <Fragment>\n <CommandGroup heading={resolvedHeading} key=\"recent\">\n {recents.map(({ entry, href }) => (\n <RecentItem\n key={`recent:${entry.canonicalRef}:${entry.id}`}\n entry={entry}\n href={href}\n onGo={goTo}\n {...(getTestId === undefined ? {} : { getTestId })}\n />\n ))}\n </CommandGroup>\n {withSeparator && <CommandSeparator />}\n </Fragment>\n );\n}\n\n/**\n * One recent entry. Its stored label is shown only while the field it was read from is still\n * visible to the signed-in user (P5 spec 3.8); otherwise the record's id. The label is part of\n * the item's search value only when shown, so a hidden one is not reachable by typing either.\n */\nfunction RecentItem({\n entry,\n href,\n onGo,\n getTestId,\n}: {\n readonly entry: RecentRecord;\n readonly href: string | null;\n readonly onGo: (href: string | null, entry: RecentRecord) => void;\n readonly getTestId?: CommandPaletteRecentGroupProps['getTestId'];\n}): React.ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const access = useListAccess(entry.canonicalRef);\n const def = app.registry.get(entry.canonicalRef);\n const resourceLabel = resolveResourceLabel(caps, entry.canonicalRef, 'single', def);\n const key = `${entry.canonicalRef}:${entry.id}`;\n // An entry stored before labels named their field is trusted only when none of the fields its\n // label could have been read from is guarded: the label keys the resource declares and its\n // display field, or every field when a `recordTitle` hook (which may read any) titles it.\n const declared = Object.keys((def?.fields ?? {}) as Record<string, unknown>);\n const candidates =\n def?.recordTitle === undefined\n ? [\n ...declared.filter((name) => RECENT_LABEL_KEYS.includes(name)),\n ...(def?.displayField === undefined ? [] : [def.displayField]),\n ]\n : declared;\n const legacyTrusted =\n entry.label === entry.id ||\n (access.status === 'ready' && candidates.every((name) => access.fieldVisible(name)));\n const shown =\n entry.labelField === undefined\n ? legacyTrusted\n ? entry.label\n : entry.id\n : access.status === 'ready' && access.fieldVisible(entry.labelField)\n ? entry.label\n : entry.id;\n return (\n <CommandItem\n value={`recent:${key}:${resourceLabel}:${shown}`}\n onSelect={() => onGo(href, entry)}\n data-testid={getTestId?.('recent', key)}\n >\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resourceLabel}:\n </span>\n {shown}\n </CommandItem>\n );\n}\n","'use client';\nimport { useEffect, useMemo } from 'react';\nimport { useCommandState } from 'cmdk';\nimport {\n resolveResourceLabel,\n resourceShowHref,\n type AppRuntime,\n type ResourceDef,\n} from '@burojs/core';\nimport {\n useApp,\n useDebouncedValue,\n useI18nCaps,\n useListAccess,\n useList,\n useOptionalT,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\nimport { lowerLegacyField, type LegacyFieldLike } from '../fields/legacy-field.js';\nimport { useCommandPaletteResults } from './command-palette.js';\nimport { isShowAvailable } from './record-targets.js';\nimport { opensInQuick } from './quick-targets.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useRowSubtitle } from '../resource/use-record-subtitle.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by `<CommandPaletteNavigationGroups>` and\n * `<CommandPaletteRecentGroup>`.\n *\n * - `records-record` — a single record hit. `id` passed to the builder\n * is `<resource>:<record-id>`.\n */\nexport type CommandPaletteRecordsTestIdRole = 'records-record';\n\n/**\n * Props for `<CommandPaletteRecordsGroup>`.\n *\n * The component reads the current cmdk search state via `useCommandState`\n * and the `App` from `useApp()` (so it must be rendered inside a\n * `BuroProvider` AND inside a `<Command>` / `<CommandPalette>` shell).\n *\n * For every registered resource that has a resolvable `displayField`, the\n * component fires a `useList({ resource, filters: [{ field, operator:\n * 'contains', value: q }], pagination: { pageSize, mode: 'server' } })`\n * keyed on the debounced query. react-query's built-in fetch supersession\n * is what gives us \"cancel in-flight on next keystroke\" — we don't need\n * an explicit AbortController.\n */\nexport interface CommandPaletteRecordsGroupProps {\n /**\n * Disable the group entirely (e.g. when the palette is closed). When\n * false, no `useList` calls are fired (each per-resource sub-component\n * passes `queryOptions.enabled: false`). Defaults to `true`.\n */\n enabled?: boolean;\n /**\n * Number of rows fetched per resource. Defaults to 5 — small enough\n * that a multi-resource match still fits the palette without scrolling.\n */\n pageSize?: number;\n /**\n * Minimum query length before search fires. Below this, the group\n * renders nothing and no requests are made. Default 2.\n */\n minQueryLength?: number;\n /**\n * Debounce window (ms) applied to the cmdk search input before it\n * propagates to `useList`. Default 200ms.\n */\n debounceMs?: number;\n /**\n * Called BEFORE the navigation. Adopters typically wire this to\n * `setOpen(false)` to close the palette during the route change.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('records-record', '<resource>:<id>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteRecordsTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.records`, English fallback `\"Records\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Override the path generator. By default the component resolves the\n * resource's canonical show route (including namespaces, explicit routes,\n * nesting and `routesTo`).\n */\n recordHref?: (resource: string, id: string | number) => string;\n}\n\ninterface SearchableResource {\n def: ResourceDef;\n displayField: string;\n}\n\nconst STRING_DISPLAY_FALLBACKS = ['name', 'title', 'label', 'alias'] as const;\n\n/**\n * Resolve the display field for cross-resource search.\n *\n * Resolution order:\n * 1. Adopter's `def.displayField` (if it points at a real field on\n * the resolved schema — `defineResource` already validates this\n * via `resolveDisplayField`, but we re-check defensively to avoid\n * firing a `useList` against a non-existent column).\n * 2. Convention names: `name` → `title` → `label` → `alias`. The\n * `displayField` resolver in `define-resource.ts` only walks the\n * first matching string-kind field, which can produce a bad\n * candidate (e.g. a status enum) for cross-resource search; this\n * explicit allow-list keeps record search opt-in via these\n * well-known field names.\n * 3. Otherwise → `null` → resource is excluded from cross-resource\n * search entirely.\n *\n * Why we don't always trust `def.displayField`: `displayField` gets\n * inferred to \"first non-system string-kind field\" when the adopter\n * doesn't declare one explicitly. For breadcrumbs / picker labels that\n * inferred default works, but for free-text record search the inferred\n * field may be a categorical column (status / type) where a `contains`\n * filter degrades into noise. Adopters opt INTO record search either by\n * setting `displayField` explicitly OR by naming a field one of the\n * convention names above.\n */\nfunction resolveDisplayField(def: ResourceDef): string | null {\n const fields = def.fields ?? {};\n // Only string-shaped canonical fields make sense for a `contains` search\n // filter (numeric / boolean / enum fields are excluded so the API doesn't\n // get a malformed filter against a non-text column).\n const isSearchable = (fieldName: string): boolean => {\n const fieldDef = fields[fieldName];\n if (!fieldDef) return false;\n const canonical = lowerLegacyField(fieldDef as LegacyFieldLike);\n return canonical.type === 'string' && canonical.format !== 'enum';\n };\n // Adopter's `def.displayField` (auto-inferred or explicit) takes\n // precedence WHEN the targeted field is a string-kind. The\n // `defineResource` resolver picks the first non-system string-kind\n // field by default, so for resources with a sensible string display\n // column this branch fires. Adopters who want a non-string column to\n // be the displayField (display only, not search) opt the resource out\n // of cross-resource search by virtue of this branch returning null.\n if (def.displayField && isSearchable(def.displayField)) {\n return def.displayField;\n }\n // Fall back to convention names — adopter who set displayField to a\n // non-string column may still get search via a conventional name\n // (e.g. `name` / `title` / `label` / `alias`).\n for (const candidate of STRING_DISPLAY_FALLBACKS) {\n if (isSearchable(candidate)) return candidate;\n }\n return null;\n}\n\n/**\n * Render the \"Records\" group inside a command palette: cross-resource\n * record search wired through `useList`. As the user types,\n * each searchable resource fires a debounced `contains` filter against\n * its `displayField` and the resulting rows are rendered as flat\n * entries under a single \"Records\" heading.\n *\n * Behavior:\n *\n * - Renders nothing when the palette has no query (or the query is\n * shorter than `minQueryLength`). No `useList` calls are issued.\n * - Renders nothing when no registered resource has a resolvable\n * `displayField` (record search is opt-in via `def.displayField`).\n * - Each resource hit is prefixed with the resource's label so an\n * ambiguous query (matching multiple resources) stays disambiguated.\n * - On pick: calls `onSelect` (typical: close the palette) THEN\n * navigates to the record.\n *\n * Cancellation:\n *\n * react-query's built-in fetch supersession discards stale results when\n * a newer query is in flight — typing fast naturally cancels the prior\n * request via the standard query-key mechanism. No AbortController is\n * needed at this layer.\n *\n * Rules-of-Hooks safety:\n *\n * The set of searchable resources is computed once via `useMemo` keyed\n * on `app.registry` (and re-snapshotted only if the registry instance\n * changes). Each resource gets a sub-component (`<PerResourceSearchHits>`)\n * that calls `useList` exactly once per render. The sub-component count\n * is stable, so no conditional/loop hook is created.\n *\n * Example (router-independent — picks navigate through `useRouteNavigate`,\n * the `RouterAdapter` seam `useResourceUrlState` also uses; wrap the app in\n * `RouterAdapterProvider` once):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import { useGlobalShortcut } from '@burojs/react/web';\n * import {\n * CommandPalette,\n * CommandPaletteRecordsGroup,\n * CommandPaletteNavigationGroups,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen, toggle } = useCommandPalette();\n * useGlobalShortcut({ key: 'k', mod: true }, toggle);\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteRecordsGroup\n * enabled={open}\n * onSelect={() => setOpen(false)}\n * />\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteRecordsGroup({\n enabled = true,\n pageSize = 5,\n minQueryLength = 2,\n debounceMs = 200,\n onSelect,\n getTestId,\n heading,\n recordHref,\n}: CommandPaletteRecordsGroupProps): React.ReactElement | null {\n const app = useApp();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n // A resource the sidebar hides (its `visible`) is not searched either.\n const isResourceVisible = useResourceVisible();\n const resolvedHeading = heading ?? t('commandPalette.records', { defaultValue: 'Records' });\n // cmdk exposes the live search state via `useCommandState` — selectors\n // re-run when the `state.search` slice changes. Outside a `<Command>`\n // root this returns `undefined`, so we coalesce defensively.\n const liveQuery = useCommandState((state) => state.search) ?? '';\n const debouncedQuery = useDebouncedValue(liveQuery, debounceMs);\n\n // Snapshot searchable resources once — the result MUST be stable across\n // renders so the per-resource hook count below stays Rules-of-Hooks-\n // compliant. The registry is build-time fixed in practice; if adopters\n // mutate it dynamically the memo key (`app.registry`) re-runs here.\n const searchableResources = useMemo<SearchableResource[]>(() => {\n return app.registry\n .list()\n .filter(\n (r) =>\n isShowAvailable(app.registry, canonicalResourceKey(r)) ||\n opensInQuick(app.registry, canonicalResourceKey(r), 'show'),\n )\n .filter(isResourceVisible)\n .map((def): SearchableResource | null => {\n const displayField = resolveDisplayField(def);\n return displayField ? { def, displayField } : null;\n })\n .filter((entry): entry is SearchableResource => entry !== null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app.registry, isResourceVisible]);\n\n // Don't render empty headings or fire any requests when below threshold.\n const isReady =\n enabled && debouncedQuery.length >= minQueryLength && searchableResources.length > 0;\n\n // Below the search threshold OR no resource has a displayField →\n // render nothing at all (no orphan \"Records\" heading). When the\n // group goes from null → mounted, the per-resource sub-components\n // mount AS A SET (each is a fresh component instance), so React's\n // Rules of Hooks remain satisfied: the parent component's hook\n // sequence (useApp / useOptionalT / useRouteNavigate / useCommandState /\n // useDebouncedValue / useMemo) is identical on every render, and the\n // children mount via the\n // standard array-key path which doesn't violate the rules either.\n if (!isReady) return null;\n\n // A record with no page opens its `quick.show` (spec 4.7).\n const goTo = (href: string | null, resource: string, id: string): void => {\n onSelect?.();\n if (href === null) quick.show(resource, id);\n else navigate(href, { origin: 'jump' });\n };\n\n // The group is `forceMount`-ed so cmdk doesn't auto-hide the heading\n // when its items' values don't match the live cmdk search string.\n // Our items are server-side-filtered (the `useList` `contains` filter\n // already did the matching), so the cmdk client-side filter would\n // wrongly hide them. Item-level `forceMount` keeps each row visible;\n // group-level `forceMount` keeps the heading visible even when the\n // sub-component count momentarily drops (e.g. while a fetch is\n // in-flight). The \"no rows\" case is handled below: when every\n // PerResourceSearchHits returns null, the group's children are an\n // empty array and the heading paints alone — that's a 1-frame state\n // before either rows arrive or the user shifts the query. To\n // suppress an orphan heading on truly zero-results, we render\n // `null` for the entire component instead (see the `if (!isReady)`\n // guard above plus the resource-count guard).\n return (\n <CommandGroup heading={resolvedHeading} key=\"records\" forceMount>\n {searchableResources.map(({ def, displayField }) => (\n <PerResourceSearchHits\n key={canonicalResourceKey(def)}\n def={def}\n displayField={displayField}\n query={debouncedQuery}\n pageSize={pageSize}\n goTo={goTo}\n recordHref={recordHref}\n registry={app.registry}\n getTestId={getTestId}\n />\n ))}\n </CommandGroup>\n );\n}\n\ninterface PerResourceSearchHitsProps {\n def: ResourceDef;\n displayField: string;\n query: string;\n pageSize: number;\n goTo: (href: string | null, resource: string, id: string) => void;\n recordHref?: (resource: string, id: string | number) => string;\n registry: AppRuntime['registry'];\n getTestId?: (role: CommandPaletteRecordsTestIdRole, id: string) => string | undefined;\n}\n\n/**\n * Per-resource leaf inside `<CommandPaletteRecordsGroup>`. Calls\n * `useList` exactly once with the current debounced query — react-query\n * keys on the resource + filter shape so a query change supersedes the\n * prior request automatically.\n *\n * Renders nothing while loading or on error to keep the palette quiet.\n * The cmdk empty-state slot at the palette root surfaces \"No matches\"\n * when every group is empty.\n */\nfunction PerResourceSearchHits({\n def,\n displayField,\n query,\n pageSize,\n goTo,\n recordHref,\n registry,\n getTestId,\n}: PerResourceSearchHitsProps): React.ReactElement | null {\n const caps = useI18nCaps();\n // The parent gates on `query.length >= minQueryLength` and only\n // mounts this child once that's true; we still defensively check\n // for a non-empty query so a future caller using this component\n // standalone doesn't fire useList with an empty filter.\n const resource = canonicalResourceKey(def);\n // The record search names the display field (P5 spec 3.7): a resource whose display field its\n // user may not view leaves the search — no predicate on it, no request.\n const access = useListAccess(resource);\n const titleVisible = access.status === 'ready' && access.fieldVisible(displayField);\n const shouldFetch = query.length > 0 && titleVisible;\n const q = useList(resource, {\n ...(shouldFetch ? { filter: { field: displayField, op: 'contains', value: query } } : {}),\n pagination: { kind: 'offset', page: 1, pageSize },\n // The global search follows the session's scope selection.\n scope: 'session',\n enabled: shouldFetch,\n });\n const report = useCommandPaletteResults(`records:${resource}`);\n const rowSubtitle = useRowSubtitle(resource);\n\n const rows =\n !shouldFetch || q.isLoading || q.isError\n ? []\n : ((q.data?.data ?? []) as Array<Record<string, unknown>>);\n\n // Tell the palette we are showing results. Our items are `forceMount`-ed\n // (server-side filtered), and cmdk excludes force-mounted items from the\n // `filtered.count` that drives `<CommandEmpty>` — so without this the\n // palette renders \"no matches\" directly above real rows.\n useEffect(() => {\n report(rows.length);\n }, [report, rows.length]);\n\n if (rows.length === 0) return null;\n\n const resourceLabel = resolveResourceLabel(caps, canonicalResourceKey(def), 'single', def);\n // A hit is keyed and linked by the resource's id field, which is not always `id`.\n const declaredIdField = (def.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField =\n typeof declaredIdField === 'string' && declaredIdField.length > 0 ? declaredIdField : 'id';\n\n return (\n <>\n {rows.map((row) => {\n const idVal = row[idField] ?? row.id ?? row.event_id ?? row.job_id;\n const id = idVal == null ? '' : String(idVal);\n if (!id) return null;\n const display = titleVisible ? row[displayField] : undefined;\n const labelText = typeof display === 'string' && display.length > 0 ? display : id;\n // Only a declared `recordSubtitle` draws a second line here: the palette has no default.\n const subtitle = rowSubtitle(row) ?? null;\n const href = recordHref\n ? recordHref(resource, id)\n : isShowAvailable(registry, resource)\n ? resourceShowHref(registry, def, resource, id)\n : null;\n return (\n <CommandItem\n key={`record:${resource}:${id}`}\n // Server-side filtered: include the live query in the\n // value so cmdk's built-in fuzzy filter accepts the row.\n // (Without this, cmdk would drop rows whose label/id\n // doesn't contain the typed query — but for cross-resource\n // search the server already did the filtering, so we must\n // bypass cmdk's filter.) `forceMount` is the canonical\n // cmdk knob for \"render this regardless of search filter.\"\n value={`record:${resource}:${id}:${labelText}`}\n forceMount\n onSelect={() => goTo(href, resource, id)}\n data-testid={getTestId?.('records-record', `${resource}:${id}`)}\n >\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resourceLabel}:\n </span>\n {labelText}\n {subtitle === null ? null : (\n <span\n data-buro-region=\"record-subtitle\"\n className=\"ml-auto truncate pl-2 text-xs text-muted-foreground group-data-[selected=true]:text-accent-foreground\"\n >\n {subtitle}\n </span>\n )}\n </CommandItem>\n );\n })}\n </>\n );\n}\n","'use client';\nimport { useEffect, useMemo, useRef } from 'react';\nimport {\n useAppActions,\n useI18nCaps,\n useOptionalT,\n useRouteNavigate,\n usePresentBlock,\n type AppActionEntry,\n} from '@burojs/react';\nimport { resolveContentSlot, resolveNavLabel, type I18nCaps } from '@burojs/core';\nimport { cn } from '../lib/cn.js';\nimport { isExternalHref, openExternal } from '../lib/external-href.js';\nimport { toast } from '../notification/toaster.js';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used elsewhere in `@burojs/ui-shadcn` (e.g.\n * `<CommandPaletteNavigationGroups>`, `<CommandPaletteRecentGroup>`,\n * `<CommandPaletteRecordsGroup>`) so adopters can address each action\n * entry from e2e tests without leaking implementation details.\n *\n * - `action` — a single action item.\n */\nexport type CommandPaletteActionsTestIdRole = 'action';\n\n/** Stable empty array — a fresh `[]` default would recompute `useMemo` below on every render for a caller that never passes `actions` at all. */\nconst EMPTY_ACTIONS: readonly ActionItem[] = Object.freeze([]);\n\n/**\n * Single action descriptor consumed by `<CommandPaletteActionsGroup>`.\n *\n * Adopters may still supply their own list via the `actions` prop — it\n * remains fully functional, because it is the only way to reach concerns\n * that cannot live in the app-action registry (a theme provider, an auth\n * context, a locale store: state and handlers that are bound to the\n * adopter's own tree). The component itself no longer stays opinion-free\n * about WHICH actions appear: it also reads `useAppActions()` and renders\n * those alongside the prop list — see the component's own docblock for the\n * merge order. Each action has a single activation path: either `href`\n * (navigates through `useRouteNavigate`) OR `onRun` (custom handler). When\n * both are provided `href` wins.\n */\nexport interface ActionItem {\n /** Stable id used for the cmdk `value` and the optional `getTestId` callback. */\n id: string;\n /** Display label (rendered after the optional `prefix`). */\n label: string;\n /**\n * Optional muted prefix shown before the label, e.g. `\"Create new\"`\n * for resource quick-actions. Rendered with the framework's\n * `text-muted-foreground` token so it visually de-emphasizes the\n * type-of-action prefix while keeping the resource label primary.\n */\n prefix?: string;\n /**\n * Synchronous or async handler. The component awaits the returned\n * promise (if any) before calling `onSelect`, so async work like\n * `auth.signOut()` finishes before the palette closes. Errors are\n * caught + logged; the palette closes regardless so the user is\n * never stuck with an unresponsive overlay after a misbehaving\n * handler.\n */\n onRun?: () => void | Promise<void>;\n /**\n * Optional href shortcut: when set, the component navigates to it\n * through `useRouteNavigate` (the same navigate → `onSelect` → close\n * flow used elsewhere in the palette) and `onRun` is not called. An\n * external href (`https:`, `mailto:`) opens in a new window instead.\n * Use this for actions that are really just navigation shortcuts\n * (e.g. `\"Create new <resource>\"`).\n */\n href?: string;\n /**\n * Optional keyword string contributing to cmdk's fuzzy match. Use for\n * synonyms / alternate phrasings — typing `\"logout\"` should still\n * surface a `\"Sign out\"` action when `keywords: 'logout sign out'`.\n * Keywords are appended to the cmdk `value` so the built-in filter\n * picks them up without any extra plumbing.\n */\n keywords?: string;\n /**\n * Marks the item as denied WITHOUT hiding it or handing it to cmdk's own\n * `disabled` prop — see the long comment on `<CommandPaletteActionsGroup>`\n * for why: cmdk's `disabled` removes the item from keyboard navigation\n * entirely, not just from activation, which would make the reason\n * unreachable by keyboard/screen-reader users (exactly the failure mode\n * `DisabledAction` in `action-button.tsx` was written to avoid). The item\n * stays focusable and keyboard-reachable; selecting it shows\n * `disabledReason` (via `toast`) instead of running `href`/`onRun`, and it\n * renders dimmed (`opacity-60`, matching `DisabledAction`'s own convention)\n * to still visually read as denied. Set automatically for a registry entry\n * whose rule allowed-but-disabled it (see `AppActionEntry.disabledReason`);\n * a caller-supplied action may also set it directly.\n */\n disabled?: boolean;\n /**\n * Human-readable reason. Rendered muted after the label AND announced via\n * `toast` when a `disabled` item is selected — the visible text alone\n * reaches a screen reader that lands on the (still-focusable) item, and the\n * toast additionally confirms the no-op to whoever just pressed\n * Enter/clicked. Set automatically from `AppActionEntry.disabledReason` for\n * registry-sourced entries.\n */\n disabledReason?: string;\n}\n\n/**\n * Props for `<CommandPaletteActionsGroup>`.\n */\nexport interface CommandPaletteActionsGroupProps {\n /**\n * Additional actions to render after the registry-sourced ones. Optional —\n * the group renders registry actions on its own with no `actions` prop at\n * all. When both sources are empty, the entire group is suppressed (no\n * orphan heading on a fresh palette).\n */\n actions?: ActionItem[];\n /**\n * Called AFTER the action's handler resolves (or the navigation\n * fires). Adopters typically wire this to `setOpen(false)` so the\n * palette closes once the user has picked an action.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('action', '<action-id>')` and\n * returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteActionsTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.actions`, English fallback `\"Actions\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n}\n\n/**\n * Turn one registry `AppActionEntry` into the component's internal\n * `ActionItem` view. `kind: 'link'` maps onto `href` (the existing\n * navigate-on-select path); `kind: 'modal'` maps onto `onRun`, which\n * presents the entry's block through `present()` — `host`\n * (defaulting to `'dialog'`) becomes the presentation `host`, and `props`\n * is forwarded verbatim, exactly like `ModalActionButton` does for\n * resource actions.\n *\n * `label` and `disabledReason` both go through i18n rather than rendering\n * `entry.label` / `entry.disabledReason` raw, mirroring the two\n * siblings that already do this: `resolveNavLabel` is what\n * `<CommandPaletteNavigationGroups>` uses for a section/page/group label\n * (`sections.<key>` etc.), and the `reason ? resolveContentSlot([reason], {\n * default: reason }) : ...` shape is `DisabledAction`'s (`action-button.tsx`)\n * own resolution of a rule's `reason` — a rule author may write a bundle key\n * (`locks.systemManaged`) or a plain-English literal, and `has()` is how you\n * tell those apart without both warning AND rendering the raw key. Without\n * this, a plugin-shipped label can never be translated, and a\n * bundle-key-shaped `reason` renders as that literal key instead of its\n * resolved text.\n */\nfunction appActionToItem(\n entry: AppActionEntry,\n present: ReturnType<typeof usePresentBlock>,\n caps: I18nCaps,\n): ActionItem {\n const label = resolveNavLabel(caps, `appActions.${entry.name}`, entry.label);\n const disabledReason =\n entry.disabledReason === undefined\n ? undefined\n : resolveContentSlot(caps, [entry.disabledReason], { default: entry.disabledReason });\n const base = {\n id: entry.name,\n label,\n disabled: entry.disabledReason !== undefined,\n disabledReason,\n };\n if (entry.kind === 'link') {\n return { ...base, href: entry.to };\n }\n // A flow hosted on a custom page is a guarded link to it (P7 3.15).\n if (entry.hostHref !== undefined) return { ...base, href: entry.hostHref };\n return {\n ...base,\n onRun: () => {\n // Name the dialog after the (already-localized) action label —\n // mirroring `ModalActionButton` (`action-button.tsx`), which does the\n // same for resource item actions. Without this, a host with no\n // `optionsSchema.title` override falls back to a humanized COMPONENT\n // name (`usePresentationCopy`/`componentLabel`, `ui-presentations/copy.ts`)\n // instead of anything the action author actually wrote — placeholder-\n // grade copy in what is otherwise a fully localized dialog. `dialog`'s\n // `optionsSchema` accepts exactly `title` / `description` / `wrapper`\n // (`dialog-host.tsx`), so only `title` is set here; the conditional\n // spread keeps `options` itself absent for a host that declares no\n // schema at all, rather than sending a key nothing asked for.\n const result = present({\n block: entry.block as { namespace: string; id: string },\n props: entry.props ?? {},\n host: entry.host ?? 'dialog',\n ...(label.length > 0 ? { label } : {}),\n });\n if (!result.ok) {\n // eslint-disable-next-line no-console\n console.error(\n `[CommandPaletteActionsGroup] app action \"${entry.name}\" failed to open block \"${entry.block?.namespace}:${entry.block?.id}\": ${result.code}`,\n );\n }\n },\n };\n}\n\ninterface MergedActions {\n readonly items: readonly ActionItem[];\n /** ids present in BOTH sources — the registry entry won each; surfaced separately so the caller can warn without re-deriving it. */\n readonly collidingIds: readonly string[];\n}\n\n/**\n * Merge registry-sourced items with the caller's `actions` prop:\n * registry first, then prop entries. On an `id` collision the registry\n * entry wins outright — the prop entry with that id is dropped, not\n * rendered twice, not silently overwritten either (the caller finds out\n * via `collidingIds`). This is the one rule this component exists to\n * enforce: a slot that quietly loses to another contributor is exactly\n * the failure mode the app-action registry was built to remove.\n */\nfunction mergeActions(\n registryItems: readonly ActionItem[],\n propItems: readonly ActionItem[],\n): MergedActions {\n const registryIds = new Set(registryItems.map((item) => item.id));\n const collidingIds: string[] = [];\n const items: ActionItem[] = [...registryItems];\n for (const item of propItems) {\n if (registryIds.has(item.id)) {\n collidingIds.push(item.id);\n continue;\n }\n items.push(item);\n }\n return { items, collidingIds };\n}\n\n/**\n * Render the \"Actions\" group inside a command palette: every app-level\n * action the registry knows about (`defineAppAction` / `registerAppAction`,\n * read via `useAppActions()` — already filtered by the deny-wins rule\n * engine, so this component does not re-gate them), followed by whatever\n * the caller passes through the `actions` prop.\n *\n * Why the prop still exists alongside the registry: the registry can only\n * hold portable data (`link`/`modal` — a destination or a component to\n * present), never a function. Actions bound to the adopter's own tree —\n * toggling a theme, switching a locale, signing out — have nowhere to live\n * in it and keep going through `actions`.\n *\n * Merge order and collisions: registry entries render FIRST, prop entries\n * after. If a prop entry's `id` matches a registry entry's `name`, the\n * registry entry wins and is kept; the prop entry is dropped and the\n * component logs exactly one `console.warn` naming the id (see\n * `mergeActions`) — never a silent overwrite.\n *\n * Behavior:\n *\n * - Both sources empty → renders nothing (no orphan \"Actions\" heading).\n * - Each item's `onRun` is awaited (sync handlers resolve immediately)\n * before `onSelect` fires, so async work finishes before the\n * palette closes.\n * - Errors thrown / rejected from `onRun` are caught + logged via\n * `console.error` and the palette still closes — the user is never\n * stuck on an overlay after a misbehaving handler.\n * - Actions with `href` set bypass `onRun` and navigate through\n * `useRouteNavigate`; an external href opens in a new window.\n * - A registry entry the rule engine allowed-but-disabled (`disabled: true`)\n * stays keyboard-reachable and dimmed (`opacity-60`), and selecting it\n * shows its `disabledReason` via `toast` instead of running the action —\n * see the long comment on `ActionItem.disabled` for why this does NOT use\n * cmdk's own `disabled` prop (it would remove the item from keyboard\n * navigation entirely, not just from activation — verified against cmdk\n * 1.1.1's source, not merely against its types).\n *\n * Example:\n *\n * ```tsx\n * <CommandPaletteActionsGroup\n * actions={[\n * {\n * id: 'toggle-theme',\n * label: 'Toggle theme',\n * onRun: () => setTheme(theme === 'dark' ? 'light' : 'dark'),\n * keywords: 'dark light mode',\n * },\n * {\n * id: 'sign-out',\n * label: 'Sign out',\n * onRun: () => auth.signOut(),\n * keywords: 'logout sign out',\n * },\n * ]}\n * onSelect={() => setOpen(false)}\n * />\n * ```\n */\nexport function CommandPaletteActionsGroup({\n actions,\n onSelect,\n getTestId,\n heading,\n}: CommandPaletteActionsGroupProps): React.ReactElement | null {\n const t = useOptionalT();\n const caps = useI18nCaps();\n const registryEntries = useAppActions();\n const present = usePresentBlock();\n const navigate = useRouteNavigate();\n const propActions = actions ?? EMPTY_ACTIONS;\n const resolvedHeading = heading ?? t('commandPalette.actions', { defaultValue: 'Actions' });\n\n // `registryEntries` can gain a fresh array identity across renders — a new\n // commit, or a change to any of `useAvailabilityGate`'s own inputs\n // (permissions/scope/user), re-runs `useAppActions`'s `useMemo` and\n // produces a new array. (`registry.appActions.list()` itself,\n // `createSnapshotRegistry`, memoizes per snapshot identity and returns a\n // STABLE reference between commits — it is not the source of any\n // per-render churn.) Regardless of how often `registryEntries` actually\n // changes, recomputing the merge here is cheap and always correct, so this\n // `useMemo` does not try to detect whether its inputs really changed. The\n // collision WARNING is kept out of this recomputation on purpose, because\n // IT does need that finer-grained guard: see the `useEffect` below.\n const { items, collidingIds } = useMemo(() => {\n const registryItems = registryEntries.map((entry) => appActionToItem(entry, present, caps));\n return mergeActions(registryItems, propActions);\n }, [registryEntries, propActions, present, caps]);\n\n // Warn on a real collision exactly once — not once per render. `items`/\n // `collidingIds` can get a new array identity on any render that\n // recomputes the `useMemo` above (see its own note), so a `useEffect`\n // keyed on `collidingIds` itself would re-warn on such a render regardless\n // of whether the collision actually changed. A\n // \"latest ref\" plus a CONTENT-derived key (not identity) is what makes the\n // effect a no-op on a render that reproduces the same collision, instead\n // of re-warning every time this component re-renders for an unrelated\n // reason (typing into the palette's search input, another item's `onRun`\n // resolving, …). The `\u0000` separator is only a change signal for the\n // dependency array, never decoded back — an id containing it would still\n // warn correctly, just wouldn't have to survive a round trip.\n const collidingIdsRef = useRef<readonly string[]>(collidingIds);\n collidingIdsRef.current = collidingIds;\n const collidingIdsKey = collidingIds.join('\u0000');\n useEffect(() => {\n const ids = collidingIdsRef.current;\n if (ids.length === 0) return;\n for (const id of ids) {\n // eslint-disable-next-line no-console\n console.warn(\n `[CommandPaletteActionsGroup] action id \"${id}\" was passed via the \\`actions\\` prop but collides with a registry app action of the same id — the registry entry wins; rename one of the two ids to keep both.`,\n );\n }\n }, [collidingIdsKey]);\n\n if (items.length === 0) return null;\n\n // Activation handler. We always close the palette via `onSelect`\n // AFTER the handler resolves (or the navigation fires), and we\n // catch errors so a misbehaving handler doesn't leave the user\n // stuck on the overlay. Catching here also keeps the cmdk select\n // event from bubbling an unhandled rejection.\n const run = async (item: ActionItem): Promise<void> => {\n // A `disabled` item is never handed to `href`/`onRun` — it is still\n // selectable (see `ActionItem.disabled`'s doc for why it must stay\n // reachable), so this is the one branch that answers \"why didn't\n // anything happen\" instead of running the action. The palette is\n // deliberately left open (no `onSelect()`): nothing ran, so there is\n // nothing to close for — the user can pick a different item.\n if (item.disabled) {\n if (item.disabledReason) toast(item.disabledReason);\n return;\n }\n try {\n if (item.href) {\n // An app action's `to` arrives as a bare href. An external one\n // (https:, mailto:) leaves the app in a new window; handed to the\n // router it would be pushed as an app path.\n if (isExternalHref(item.href)) openExternal(item.href);\n else navigate(item.href);\n } else if (item.onRun) {\n await item.onRun();\n }\n } catch (err) {\n // Surface the failure but keep the palette flow intact — the\n // user always sees the overlay close on pick, regardless of the\n // handler's outcome.\n // eslint-disable-next-line no-console\n console.error(`[CommandPaletteActionsGroup] action \"${item.id}\" failed:`, err);\n } finally {\n onSelect?.();\n }\n };\n\n return (\n <CommandGroup heading={resolvedHeading} key=\"actions\">\n {items.map((item) => {\n // Compose the cmdk value: stable id + label + optional\n // keywords. cmdk's built-in fuzzy filter walks this string,\n // so synonyms (\"logout\") surface the canonical label\n // (\"Sign out\") without any extra plumbing.\n const value = ['action', item.id, item.prefix ?? '', item.label, item.keywords ?? '']\n .filter((s) => s.length > 0)\n .join(':');\n return (\n <CommandItem\n key={`action:${item.id}`}\n value={value}\n // Deliberately NOT cmdk's own `disabled` prop — see\n // `ActionItem.disabled`'s doc. The item stays a fully\n // interactive cmdk option (keyboard-navigable, clickable);\n // `opacity-60` (matching `DisabledAction`'s own convention) is\n // the only visual concession, and `run()` above is what\n // actually turns \"select\" into \"explain, don't execute\".\n className={cn(item.disabled && 'opacity-60')}\n onSelect={() => {\n void run(item);\n }}\n data-testid={getTestId?.('action', item.id)}\n >\n {item.prefix ? (\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {item.prefix}\n </span>\n ) : null}\n {item.label}\n {item.disabled && item.disabledReason ? (\n <span className=\"text-muted-foreground ml-2 text-xs\">{item.disabledReason}</span>\n ) : null}\n </CommandItem>\n );\n })}\n </CommandGroup>\n );\n}\n","'use client';\nimport { useMemo } from 'react';\nimport {\n hasListPage,\n hasRecordPage,\n resolveResourceLabel,\n resourceCreateHref,\n type ResourceDef,\n} from '@burojs/core';\nimport {\n useApp,\n useAvailabilityGate,\n useI18nCaps,\n useOptionalT,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { opensInQuick } from './quick-targets.js';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by the other command-palette groups.\n *\n * - `create` — a single `\"Create new <resource>\"` item. `id` passed\n * to the builder is the resource's `name`.\n */\nexport type CommandPaletteCreateTestIdRole = 'create';\n\n/**\n * Props for `<CommandPaletteCreateGroup>`.\n */\nexport interface CommandPaletteCreateGroupProps {\n /**\n * Override which resources expose a Create entry. Default: every\n * resource with a list page that passes its `visible(ctx)` predicate.\n * Adopters who want to hide a specific resource's Create action\n * (e.g. read-only views, demo-only resources) supply a predicate\n * that returns `false` for that resource.\n */\n resourceFilter?: (def: ResourceDef) => boolean;\n /**\n * Called AFTER the navigation fires. Adopters typically wire this\n * to `setOpen(false)` so the palette closes once the user has\n * picked an entry.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('create', '<resource-name>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteCreateTestIdRole, resourceName: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.create`, English fallback `\"Create\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Override the path generator. By default each item navigates to\n * `/<resource>/create`. Adopters with custom create routes\n * (e.g. a dedicated flow, a modal) override per-resource.\n */\n createHref?: (def: ResourceDef) => string;\n /**\n * Prefix shown muted before each resource label. When omitted,\n * resolves via i18n (`commandPalette.createNew`, English fallback\n * `\"Create new\"`). Set to an empty string to suppress.\n */\n prefix?: string;\n}\n\n/**\n * Render the per-resource quick-action group inside a command\n * palette: one `\"Create new <resource>\"` item per registered\n * visible resource with a list page.\n *\n * Filters applied (in order):\n *\n * 1. Resources with no list page (`views.list.page: false`) are\n * excluded — they are reached through a parent's placement.\n * 2. `useResourceVisible()` (the sidebar's predicate: its `visible(ctx)`) must return true.\n * Same predicate the sidebar + navigation group use, fail-closed\n * on throwing predicates. Hidden in sidebar → hidden here.\n * 3. Caller-supplied `resourceFilter` (if any). Returning `false`\n * drops the resource. Use to hide demo-only / read-only resources.\n *\n * When zero resources pass the filter chain the entire group is\n * suppressed (no orphan heading on a fresh palette).\n *\n * Example (Next App Router):\n *\n * ```tsx\n * <CommandPaletteCreateGroup\n * onSelect={() => setOpen(false)}\n * getTestId={(role, name) => `command-palette-${role}:${name}`}\n * />\n * ```\n */\nexport function CommandPaletteCreateGroup({\n resourceFilter,\n onSelect,\n getTestId,\n heading,\n createHref,\n prefix,\n}: CommandPaletteCreateGroupProps): React.ReactElement | null {\n const caps = useI18nCaps();\n const app = useApp();\n const isResourceVisible = useResourceVisible();\n const gate = useAvailabilityGate();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n const resolvedHeading = heading ?? t('commandPalette.create', { defaultValue: 'Create' });\n const resolvedPrefix = prefix ?? t('commandPalette.createNew', { defaultValue: 'Create new' });\n\n const visibleResources = useMemo<ResourceDef[]>(() => {\n return (\n app.registry\n .list()\n .filter((r) => hasListPage(r))\n // The availability gate, same as `<CreateButton>` asks. Without it this\n // group offered \"Create new X\" for a resource declaring\n // `operations: { create: false }` — whose create ROUTE no longer\n // exists, so the item navigated to a 404. An entry that leads nowhere\n // is worse than a missing entry.\n //\n // `disabled` is treated as hidden here on purpose: a command-palette\n // item is a search RESULT, and a result that cannot be chosen is noise\n // in a list whose whole job is to be filtered down to one thing. This\n // is the same call the empty-state CTA makes for the same reason.\n .filter((r) => gate(canonicalResourceKey(r), 'create').state === 'available')\n // A resource without a create page creates in its `quick.create` (spec 4.7); with\n // neither there is nothing to offer.\n .filter(\n (r) =>\n hasRecordPage(r, 'create') ||\n opensInQuick(app.registry, canonicalResourceKey(r), 'create'),\n )\n .filter(isResourceVisible)\n .filter((r) => (resourceFilter ? resourceFilter(r) : true))\n );\n // isResourceVisible is intentionally a dep so flipping permissions /\n // scope refilters the list. resourceFilter is referenced by\n // identity — adopters who pass an inline closure trigger a\n // re-filter on each render, which is fine: the filter chain is\n // pure + cheap.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app, gate, isResourceVisible, resourceFilter]);\n\n if (visibleResources.length === 0) return null;\n\n const goTo = (href: string): void => {\n navigate(href, { origin: 'jump' });\n onSelect?.();\n };\n const createIn = (def: ResourceDef, href: string): void => {\n if (hasRecordPage(def, 'create')) {\n goTo(href);\n return;\n }\n onSelect?.();\n void quick.create(canonicalResourceKey(def));\n };\n\n const resourceLabel = (def: ResourceDef): string =>\n resolveResourceLabel(caps, canonicalResourceKey(def), 'single', def);\n\n return (\n <CommandGroup heading={resolvedHeading} key=\"create\">\n {visibleResources.map((def) => {\n const resource = canonicalResourceKey(def);\n const label = resourceLabel(def);\n const href = createHref?.(def) ?? resourceCreateHref(app.registry, def, resource);\n // Compose the cmdk value: role + resource name + label + the\n // muted prefix. Including the prefix means typing `\"create\"`\n // surfaces every entry (the prefix matches the keyword).\n const value = `create:${resource}:${resolvedPrefix}:${label}`;\n return (\n <CommandItem\n key={`create:${resource}`}\n value={value}\n onSelect={() => createIn(def, href)}\n data-testid={getTestId?.('create', resource)}\n >\n {resolvedPrefix ? (\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resolvedPrefix}\n </span>\n ) : null}\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>\n );\n}\n","import { useRefresh, useT } from '@burojs/react';\nimport { IconRefresh } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\n\nimport { Button } from '../primitives/button.js';\nimport { cn } from '../lib/cn.js';\n\nexport interface RefreshButtonProps {\n readonly className?: string;\n}\n\n/** Ghost icon button that refetches the app's data; spins and disables while it runs. */\nexport function RefreshButton({ className }: RefreshButtonProps): ReactElement | null {\n const t = useT();\n const { refresh, isRefreshing, available } = useRefresh();\n if (!available) return null;\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('size-8', className)}\n aria-label={t('shell.refresh')}\n data-testid=\"refresh-button\"\n disabled={isRefreshing}\n onClick={() => void refresh()}\n >\n <IconRefresh className={cn(isRefreshing && 'animate-spin')} aria-hidden=\"true\" />\n </Button>\n );\n}\n","import { resolveNavLabel } from '@burojs/core';\nimport { useAppActions, useI18nCaps } from '@burojs/react';\nimport type { ReactElement } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { Button } from '../primitives/button.js';\nimport { Icon } from '../primitives/icon.js';\n\n/**\n * The app-level action strip: every `defineAppAction` entry that belongs to no resource, already\n * filtered by the rule engine (`useAppActions`). Only entries that resolve to a route render: a\n * `link`, or a flow hosted on a page (`hostHref`). A `modal` entry needs a presentation host and is\n * skipped. `disabledReason` keeps the action visible but inert, with the reason as its tooltip.\n */\nexport function AppActions(): ReactElement | null {\n const actions = useAppActions();\n const caps = useI18nCaps();\n const RouterLink = useLinkComponent();\n // A link, or a flow hosted on a page (P7 3.15): both are links to a route the user may open.\n const links = actions\n .map((action) => ({ action, href: action.kind === 'link' ? action.to : action.hostHref }))\n .filter(\n (entry): entry is { action: typeof entry.action; href: string } => entry.href !== undefined,\n );\n if (links.length === 0) return null;\n\n return (\n <div className=\"flex items-center gap-1\" data-testid=\"app-actions\">\n {links.map(({ action, href }) => {\n const label = resolveNavLabel(caps, `appActions.${action.name}`, action.label);\n // With an icon, a phone shows only the icon; the label stays as its accessible name.\n const content =\n action.icon === undefined ? (\n label\n ) : (\n <>\n <Icon name={action.icon} />\n <span className=\"max-md:sr-only\">{label}</span>\n </>\n );\n return (\n <Button\n key={action.name}\n asChild={action.disabledReason === undefined}\n variant=\"outline\"\n size=\"sm\"\n disabled={action.disabledReason !== undefined}\n title={\n action.disabledReason === undefined\n ? undefined\n : reasonText(caps, action.disabledReason)\n }\n data-testid={`app-action:${action.name}`}\n >\n {action.disabledReason === undefined ? (\n <RouterLink href={href}>{content}</RouterLink>\n ) : (\n <span>{content}</span>\n )}\n </Button>\n );\n })}\n </div>\n );\n}\n","import { useT } from '@burojs/react';\nimport { IconHelp } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\n\nexport type HelpButtonProps = { readonly className?: string } & (\n | { readonly href: string; readonly onClick?: never }\n | { readonly onClick: () => void; readonly href?: never }\n);\n\n/** Ghost icon button that opens help: a link when given `href`, a button when given `onClick`. */\nexport function HelpButton({ href, onClick, className }: HelpButtonProps): ReactElement {\n const t = useT();\n const RouterLink = useLinkComponent();\n const icon = <IconHelp aria-hidden=\"true\" />;\n if (href !== undefined) {\n return (\n <Button\n asChild\n variant=\"ghost\"\n size=\"icon\"\n className={className}\n aria-label={t('shell.help')}\n data-testid=\"help-button\"\n >\n <RouterLink href={href}>{icon}</RouterLink>\n </Button>\n );\n }\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={className}\n aria-label={t('shell.help')}\n data-testid=\"help-button\"\n onClick={onClick}\n >\n {icon}\n </Button>\n );\n}\n","'use client';\nimport { cn } from '../lib/cn.js';\nimport { Separator } from '../primitives/separator.js';\nimport { SidebarTrigger, useOptionalSidebar } from '../primitives/sidebar.js';\nimport { AppActions } from '../shell/app-actions.js';\nimport { RefreshButton } from '../shell/refresh-button.js';\nimport { fill, type Slot } from '../shell/slot.js';\nimport { CommandPaletteTrigger } from './command-palette-trigger.js';\nimport { HeaderBreadcrumbs } from './header-breadcrumbs.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppHeaderProps {\n /** The breadcrumb trail. Default `<HeaderBreadcrumbs />`, the current route's trail. */\n breadcrumbs?: Slot;\n /**\n * The search chip. Default `<CommandPaletteTrigger />`, which renders only\n * when the `ShellProvider` has an `openPalette`.\n */\n search?: Slot;\n /**\n * The right-hand controls. Default `<AppActions />` and `<RefreshButton />`;\n * each renders nothing when it has nothing to show.\n */\n actions?: Slot;\n className?: string;\n}\n\nexport function AppHeader({\n breadcrumbs,\n search,\n actions,\n className,\n}: AppHeaderProps): React.ReactElement {\n // Outside a `SidebarProvider` (an app with no sidebar) there is nothing to toggle.\n const sidebar = useOptionalSidebar();\n return (\n <header\n data-testid=\"app-header\"\n className={cn(\n 'sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/95 text-foreground px-4',\n 'supports-[backdrop-filter]:bg-background/60 supports-[backdrop-filter]:backdrop-blur',\n className,\n )}\n >\n {sidebar !== null && (\n <>\n <SidebarTrigger data-testid=\"sidebar-trigger\" className=\"-ml-1 shrink-0\" />\n <Separator orientation=\"vertical\" className=\"mr-2 h-4 shrink-0\" />\n </>\n )}\n {/*\n `min-w-0` + `overflow-hidden` on the breadcrumb slot and `shrink-0` on\n everything else. Without it a long crumb («Order for production №53»)\n refused to shrink and pushed the right-hand cluster to x=415 on a 390px\n phone: the whole page scrolled sideways and the refresh button was\n clipped off-screen. A breadcrumb is the one element here that can afford\n to truncate — the controls beside it cannot.\n */}\n {/* On a phone the trail keeps only where you are (and its help): the parents truncated to\n «S… › Nord…» said nothing anyway. */}\n <div className=\"min-w-0 flex-1 overflow-hidden max-md:[&_nav>:not([aria-current]):not(button)]:hidden\">\n {fill(breadcrumbs, () => (\n <HeaderBreadcrumbs />\n ))}\n </div>\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {fill(search, () => (\n <CommandPaletteTrigger />\n ))}\n {fill(actions, () => (\n <>\n <AppActions />\n <RefreshButton />\n </>\n ))}\n </div>\n </header>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('rounded-lg border bg-card text-card-foreground shadow-xs', className)}\n {...props}\n />\n));\nCard.displayName = 'Card';\n\nexport type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nexport type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\n\nconst CardTitle = React.forwardRef<HTMLParagraphElement, CardTitleProps>(\n ({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn('text-2xl font-semibold leading-none tracking-tight', className)}\n {...props}\n />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nexport type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst CardDescription = React.forwardRef<HTMLParagraphElement, CardDescriptionProps>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />\n ),\n);\nCardContent.displayName = 'CardContent';\n\nexport type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };\n","'use client';\nimport { useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { z } from 'zod';\nimport { IconAlertCircle, IconLoader2 } from '@tabler/icons-react';\nimport { resolveErrorText, useI18nCaps, useOptionalT, useTestIds } from '@burojs/react';\nimport { friendlyStringsFrom, technicalText, toFriendlyError } from '../lib/friendly-error.js';\nimport { Button } from '../primitives/button.js';\nimport { Input } from '../primitives/input.js';\nimport { Label } from '../primitives/label.js';\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '../primitives/card.js';\nimport { cn } from '../lib/cn.js';\n\nconst schema = z.object({\n email: z.string().email('Invalid email'),\n password: z.string().min(1, 'Password required'),\n});\nexport type LoginCredentials = z.infer<typeof schema>;\n\n/**\n * The login form is the one screen every user sees, and it was the last\n * place still speaking English into a Russian UI: zod's literals above and\n * the raw `err.message` from a failed sign-in (which surfaced a JSON 401\n * body verbatim). Both are localized here.\n */\n/**\n * Recognise a wrong-credentials failure and say so plainly. Anything else\n * the adopter's `onSubmit` threw is theirs and passes through untouched.\n */\nfunction credentialsMessage(raw: string, t: ReturnType<typeof useOptionalT>): string {\n if (/invalid-email-password|401|Incorrect email or password|Unauthorized/i.test(raw)) {\n return t('auth.invalidCredentials', {\n defaultValue: 'Incorrect email or password.',\n });\n }\n return raw;\n}\n\nfunction localizedSchema(t: ReturnType<typeof useOptionalT>) {\n return z.object({\n email: z.string().email(t('auth.invalidEmail', { defaultValue: 'Invalid email' })),\n password: z.string().min(1, t('auth.passwordRequired', { defaultValue: 'Password required' })),\n });\n}\n\nexport interface LoginFormProps {\n onSubmit: (creds: LoginCredentials) => Promise<void>;\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport function LoginForm({\n onSubmit,\n title,\n description,\n className,\n}: LoginFormProps): React.ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps();\n const resolvedTitle = title ?? t('auth.signIn', { defaultValue: 'Sign in' });\n const {\n register,\n handleSubmit,\n formState: { errors, isSubmitting },\n } = useForm<LoginCredentials>({\n resolver: zodResolver(localizedSchema(t)),\n defaultValues: { email: '', password: '' },\n });\n const [submitError, setSubmitError] = useState<string | null>(null);\n\n const submit = handleSubmit(async (values) => {\n setSubmitError(null);\n try {\n await onSubmit(values);\n } catch (e) {\n // ⚠️ FOURTH `toFriendlyError` call site. Without it a failed sign-in\n // printed the transport's own words at the user — acceptance testing\n // saw `Sign-in failed (401): {\"error\":\"invalid-email-password\",…}`,\n // raw JSON, on the first screen of the app.\n // A thrown `DataError` carries no sentence in `message` (a reference): its technical text\n // is what the patterns below read, and its resolved text is what the user is shown.\n const dataCode =\n e !== null && typeof e === 'object' && !(e instanceof Error)\n ? (e as { readonly code?: unknown }).code\n : undefined;\n const raw =\n e instanceof Error\n ? e.message\n : (technicalText(e) ?? (dataCode === undefined ? String(e) : ''));\n const friendly = toFriendlyError(raw, '', friendlyStringsFrom(t));\n const credentials = credentialsMessage(raw, t);\n setSubmitError(\n friendly.replaced\n ? `${friendly.title}. ${friendly.detail}`\n : typeof dataCode === 'string' && credentials === raw\n ? resolveErrorText(e as { code: string }, caps)\n : credentials,\n );\n }\n });\n\n return (\n <Card className={cn('mx-auto w-full max-w-sm', className)}>\n <CardHeader className=\"space-y-1.5 text-center\">\n <CardTitle className=\"text-2xl\">{resolvedTitle}</CardTitle>\n {description && <CardDescription className=\"text-balance\">{description}</CardDescription>}\n </CardHeader>\n <form onSubmit={submit} noValidate>\n <CardContent className=\"space-y-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-email\" required>\n {t('auth.email', { defaultValue: 'Email' })}\n </Label>\n <Input\n id=\"login-email\"\n type=\"email\"\n autoComplete=\"email\"\n required\n aria-required=\"true\"\n data-testid={tid.loginEmail()}\n aria-invalid={!!errors.email}\n aria-describedby={errors.email ? 'login-email-error' : undefined}\n {...register('email')}\n />\n {errors.email && (\n <p\n id=\"login-email-error\"\n role=\"alert\"\n className=\"text-sm font-medium text-destructive\"\n data-testid=\"login-email-error\"\n >\n {errors.email.message}\n </p>\n )}\n </div>\n <div className=\"space-y-1\">\n <Label htmlFor=\"login-password\" required>\n {t('auth.password', { defaultValue: 'Password' })}\n </Label>\n <Input\n id=\"login-password\"\n type=\"password\"\n autoComplete=\"current-password\"\n required\n aria-required=\"true\"\n data-testid={tid.loginPassword()}\n aria-invalid={!!errors.password}\n aria-describedby={errors.password ? 'login-password-error' : undefined}\n {...register('password')}\n />\n {errors.password && (\n <p\n id=\"login-password-error\"\n role=\"alert\"\n className=\"text-sm font-medium text-destructive\"\n data-testid=\"login-password-error\"\n >\n {errors.password.message}\n </p>\n )}\n </div>\n {submitError && (\n <div\n role=\"alert\"\n data-testid=\"login-error\"\n className=\"flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive\"\n >\n <IconAlertCircle className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n <p className=\"font-medium leading-snug\">{submitError}</p>\n </div>\n )}\n </CardContent>\n <CardFooter>\n <Button\n type=\"submit\"\n disabled={isSubmitting}\n aria-busy={isSubmitting}\n data-testid={tid.loginSubmit()}\n className=\"w-full\"\n >\n {isSubmitting && (\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" aria-hidden=\"true\" />\n )}\n {isSubmitting\n ? t('auth.signingIn', { defaultValue: 'Signing in…' })\n : t('auth.signIn', { defaultValue: 'Sign in' })}\n </Button>\n </CardFooter>\n </form>\n </Card>\n );\n}\n","'use client';\nimport type { ReactNode } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { BrandMark } from '../shell/brand-mark.js';\nimport { fill } from '../shell/slot.js';\n\nexport interface AuthPageProps {\n children: ReactNode;\n /**\n * The brand above the auth card. Omit it for `<BrandMark />` (the `ShellProvider` brand, if\n * any); pass `false` for none; pass an element to replace it.\n */\n brand?: ReactNode;\n /** Optional footer text under the auth card (e.g. legal). */\n footer?: ReactNode;\n className?: string;\n}\n\n/**\n * Full-viewport auth page wrapper. Centers the auth card vertically\n * and horizontally over a `bg-muted/40` backdrop, and exposes brand/\n * footer slots for consumer customization.\n *\n * The muted background gives the card a subtle anchor without\n * dominating it — the card's own border + foreground content carries\n * the visual weight, matching shadcn Authentication 01's centered-\n * card variant rather than the two-column hero variant.\n *\n * Designed to wrap a single `<LoginForm>` (or `<SignupForm>`, etc.) so\n * unauthenticated entry points feel deliberate instead of \"floating card\n * on bare white\".\n */\nexport function AuthPage({\n children,\n brand,\n footer,\n className,\n}: AuthPageProps): React.ReactElement {\n return (\n <div\n className={cn(\n 'flex min-h-screen flex-col items-center justify-center gap-6 bg-muted/40 p-6',\n className,\n )}\n >\n <div className=\"mb-2 empty:hidden\">\n {fill(brand, () => (\n <BrandMark />\n ))}\n </div>\n <div className=\"w-full\">{children}</div>\n {footer && <div className=\"text-xs text-muted-foreground\">{footer}</div>}\n </div>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { EnumControl } from '@burojs/core';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { Icon } from '../primitives/icon.js';\nimport { EnumSettlingRow, type EnumSettling } from './enum-settling.js';\n\n/** One resolved choice: what the caller has already looked up for a value. */\nexport interface EnumChoiceOption {\n value: string;\n /** Display label, already localized. */\n label: string;\n /** Semantic icon key, rendered before the label (as on badges). */\n icon?: string;\n /** One-line value documentation, plain text, shown under the label by `cards` and `radio`. */\n summary?: string;\n}\n\nexport interface EnumChoiceGroupProps {\n control: Exclude<EnumControl, 'select'>;\n options: readonly EnumChoiceOption[];\n /**\n * The current value when it is not one of `options` (REF-132 §8): drawn first, checked and\n * inert, so a stored value the set does not offer still shows. Pass it only while `value` is\n * that value; once the user picks an option it is gone and cannot be picked again.\n */\n current?: EnumChoiceOption;\n /**\n * The available set is not settled (REF-132 §7.4): a status row stands in for the options and\n * no \"None\" option is offered; `current` still shows the stored value.\n */\n settling?: EnumSettling;\n value: string | null | undefined;\n /** The picked value, or `undefined` when the \"None\" option is picked. */\n onChange: (value: string | undefined) => void;\n testid: string;\n /** Radio group name. Defaults to a per-instance id, so two groups never share one. */\n name?: string;\n id?: string;\n /** A required group offers no \"None\" option. */\n required?: boolean;\n disabled?: boolean;\n ariaInvalid?: boolean;\n ariaDescribedBy?: string;\n ariaErrorMessage?: string;\n /**\n * Id of the element that names the group, set as its `aria-labelledby`. A\n * form's `<label for>` cannot name a `radiogroup` (a `div` is not labelable),\n * so the field's label id has to arrive this way.\n */\n ariaLabelledBy?: string;\n className?: string;\n}\n\n/** Test-id and input-value suffix of the \"None\" option. */\nconst NONE = '__none__';\n\nfunction isEmpty(value: string | null | undefined): boolean {\n return value === null || value === undefined || value === '';\n}\n\n/**\n * The non-select enum controls, shared by every enum input that resolves its\n * own options:\n *\n * - `cards`: a vertical stack of bordered cards, each a `<label>` around a\n * native radio, the label in medium weight and the summary under it.\n * - `radio`: the same structure without the card borders (the dense variant).\n * - `segmented`: a row of toggle buttons; no summaries, which do not fit in a\n * button. Meant for two to four short values.\n *\n * A radio group cannot be unselected, so a non-required group offers a \"None\"\n * option first. It is checked while the value is empty and maps back to\n * `undefined` through `onChange`.\n *\n * `cards` and `radio` use native `<input type=\"radio\">` sharing one `name`:\n * arrow-key navigation and a single tab stop come from the browser.\n */\nexport function EnumChoiceGroup({\n control,\n options,\n current,\n settling,\n value,\n onChange,\n testid,\n name,\n id,\n required,\n disabled,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n className,\n}: EnumChoiceGroupProps): React.ReactElement {\n const t = useOptionalT();\n const generatedName = React.useId();\n const groupName = name ?? generatedName;\n const empty = isEmpty(value);\n const noneLabel = t('field.none', { defaultValue: 'None' });\n // Native `disabled` already blocks a user's click; the guard also holds\n // against a programmatic `click()` (and jsdom), which still flips a disabled\n // radio and fires React's `onChange`.\n const pick = (next: string | undefined): void => {\n if (!disabled) onChange(next);\n };\n const ariaProps = {\n 'aria-invalid': ariaInvalid || undefined,\n 'aria-describedby': ariaDescribedBy,\n ...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {}),\n };\n\n if (control === 'segmented') {\n const segmentLabel = (option: EnumChoiceOption) => (\n <>\n {option.icon ? (\n <span data-testid={`${testid}:option:${option.value}:icon`} className=\"contents\">\n <Icon name={option.icon} className=\"size-3.5 shrink-0\" />\n </span>\n ) : null}\n {option.label}\n </>\n );\n const segment = (\n key: string,\n label: React.ReactNode,\n active: boolean,\n select: () => void,\n currentItem = false,\n ) => (\n <button\n key={currentItem ? `current:${key}` : key}\n type=\"button\"\n aria-pressed={active}\n data-state={active ? 'active' : 'inactive'}\n data-testid={currentItem ? `${testid}:current` : `${testid}:option:${key}`}\n {...(currentItem ? { 'data-current': '' } : {})}\n disabled={disabled || currentItem}\n onClick={select}\n className={cn(\n 'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all',\n 'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n {label}\n </button>\n );\n return (\n <div\n role=\"group\"\n id={id}\n aria-labelledby={ariaLabelledBy}\n data-testid={testid}\n className={cn(\n 'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',\n className,\n )}\n {...ariaProps}\n >\n {current === undefined\n ? null\n : segment(current.value, segmentLabel(current), true, () => undefined, true)}\n {required || settling !== undefined\n ? null\n : segment(NONE, noneLabel, empty, () => pick(undefined))}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={testid} />}\n {options.map((option) =>\n segment(option.value, segmentLabel(option), value === option.value, () =>\n pick(option.value),\n ),\n )}\n </div>\n );\n }\n\n const cards = control === 'cards';\n const choice = (\n key: string,\n option: EnumChoiceOption | undefined,\n label: string,\n checked: boolean,\n select: () => void,\n currentItem = false,\n ) => {\n const inputId = `${id ?? groupName}:${currentItem ? 'current:' : ''}${key}`;\n const inert = disabled || currentItem;\n return (\n <label\n key={currentItem ? `current:${key}` : key}\n htmlFor={inputId}\n className={cn(\n 'flex items-start gap-2.5',\n cards &&\n 'cursor-pointer rounded-lg border px-3 py-2.5 transition-colors hover:bg-accent/50 has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring',\n cards && (checked ? 'border-primary' : 'border-input'),\n inert && 'cursor-not-allowed opacity-60',\n )}\n >\n <input\n type=\"radio\"\n id={inputId}\n name={groupName}\n value={key}\n checked={checked}\n onChange={select}\n disabled={inert}\n {...ariaProps}\n data-testid={currentItem ? `${testid}:current` : `${testid}:option:${key}`}\n {...(currentItem ? { 'data-current': '' } : {})}\n className={cn('h-4 w-4 shrink-0 accent-primary', cards ? 'mt-0.5' : 'mt-1')}\n />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className={cn('flex items-center gap-1.5', cards && 'font-medium')}>\n {option?.icon ? (\n <span data-testid={`${testid}:option:${key}:icon`} className=\"contents\">\n <Icon name={option.icon} className=\"size-4 shrink-0\" />\n </span>\n ) : null}\n <span>{label}</span>\n </span>\n {option?.summary === undefined || option.summary === '' ? null : (\n <span\n data-testid={`${testid}:option:${key}:doc`}\n className=\"text-sm text-muted-foreground\"\n >\n {option.summary}\n </span>\n )}\n </span>\n </label>\n );\n };\n\n return (\n <div\n role=\"radiogroup\"\n id={id}\n aria-labelledby={ariaLabelledBy}\n data-testid={testid}\n aria-required={required}\n className={cn('flex flex-col', cards ? 'gap-2' : 'gap-1.5', className)}\n >\n {current === undefined\n ? null\n : choice(current.value, current, current.label, true, () => undefined, true)}\n {required || settling !== undefined\n ? null\n : choice(NONE, undefined, noneLabel, empty, () => pick(undefined))}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={testid} />}\n {options.map((option) =>\n choice(option.value, option, option.label, value === option.value, () =>\n pick(option.value),\n ),\n )}\n </div>\n );\n}\n","'use client';\n\nimport type * as React from 'react';\nimport {\n type EnumUseSite,\n useApp,\n useAvailableEnumValues,\n useEnumValues,\n useI18nCaps,\n useOptionalT,\n} from '@burojs/react';\nimport {\n type EnumControl,\n type EnumValue,\n enumValueText,\n resolveDoc,\n resolveEnumLabel,\n} from '@burojs/core';\nimport type { EnumNameOrRef } from '@burojs/core';\nimport { enumBindingKey } from '@burojs/core/internal';\nimport { EnumChoiceGroup, type EnumChoiceOption } from './enum-choice-group.js';\nimport { EnumSettlingRow, unknownEnumValueLabel } from './enum-settling.js';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\n\n/**\n * Internal sentinel used as the `value` for the \"All\" / clear item when\n * `clearable` is set. Radix `<SelectItem value=\"\">` is forbidden, so we use\n * a non-empty string that no real enum will ever collide with and translate\n * it back to `undefined` before calling the consumer's `onChange`.\n */\nexport const ENUM_PICKER_CLEAR_SENTINEL = '__buro_clear__';\n\nexport interface EnumPickerProps<N extends string = string> {\n /** The enum's name, checked against the registered enums, or its entity ref `{ namespace, id }`. */\n enumName: EnumNameOrRef<N>;\n value: string | null | undefined;\n /**\n * Called whenever the user picks an option. `value` is `undefined` when\n * the user picks the select's \"All\" item (`clearable`) or the \"None\"\n * option of a non-required `cards` / `radio` / `segmented` control —\n * consumers use that to clear their state. Otherwise it is one of the\n * enum's declared values.\n */\n onChange: (value: string | undefined) => void;\n /**\n * The control that renders the values. Defaults to `'select'`. `cards`,\n * `radio` and `segmented` offer a \"None\" option first unless `required`.\n */\n control?: EnumControl;\n /** HTML name attribute (form integration). */\n name?: string;\n /** HTML id attribute. */\n id?: string;\n /** Test-id override. Defaults to `enum-picker:<enumName>`. */\n testid?: string;\n /** Placeholder for the empty state in `select` mode. */\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n /** Validation state supplied by a form renderer. */\n ariaInvalid?: boolean;\n /** Help-text ids that describe the underlying control. */\n ariaDescribedBy?: string;\n /** Current field-error element id, valid only while ariaInvalid is true. */\n ariaErrorMessage?: string;\n /**\n * Id of the field's label. Names the `cards` / `radio` / `segmented` group\n * (`aria-labelledby`), which a `<label for>` cannot. The select trigger is a\n * labelable button and keeps its name from the label's `for`.\n */\n ariaLabelledBy?: string;\n className?: string;\n /**\n * When `true`, prepend an \"All\" item (label customizable via\n * `clearLabel`) to the dropdown that maps back to `undefined` on\n * selection. Use this for filter-style pickers where \"no filter\" is a\n * valid state. Defaults to `false` so existing form-input call sites\n * (where the value is required) keep their old behavior.\n *\n * Only honored by the `select` control. The other controls clear through\n * their \"None\" option, shown whenever `required` is not set.\n */\n clearable?: boolean;\n /** Label for the clear item. Defaults to \"All\". */\n clearLabel?: string;\n /**\n * The field's use site (REF-132 §7.2): its `params`, its `narrow` and the sources they read.\n * Given, the picker offers only the available set (§7.6); absent, every value, as a filter\n * offers them. Either way a current value that is not offered still shows (§8), as a\n * \"current\" item that cannot be picked again once the user moves away.\n */\n use?: EnumUseSite;\n}\n\n/** `{ summary }` when there is one, so an absent summary stays an absent key. */\nfunction withSummary(summary: string | undefined): { summary?: string } {\n return summary === undefined ? {} : { summary };\n}\n\n/**\n * Single picker primitive that renders enum values with one of the\n * `EnumControl`s: a Select (default), bordered cards (`control='cards'`), a\n * compact radio list (`control='radio'`), or a segmented control\n * (`control='segmented'`). The three non-select controls are the shared\n * `EnumChoiceGroup`; this component only resolves the options (label, icon,\n * value summary) from the registered enum.\n *\n * Falls back to a disabled placeholder when the enum is not registered —\n * matches the EnumBadge fallback policy: a half-shipped enum should not\n * crash the form.\n */\nexport function EnumPicker<const N extends string = string>({\n enumName: enumInput,\n value,\n onChange,\n control = 'select',\n name,\n id,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n className,\n clearable = false,\n clearLabel = 'All',\n use,\n}: EnumPickerProps<N>): React.ReactElement {\n const enumName = enumBindingKey(enumInput) ?? '';\n const app = useApp();\n const t = useOptionalT();\n const def = app.registry.enums.get(enumName);\n const caps = useI18nCaps();\n const ns = (def as { i18nNamespace?: string } | undefined)?.i18nNamespace ?? enumName;\n const { values, isLoading, error } = useEnumValues(enumName);\n const available = useAvailableEnumValues({\n values: isLoading || values === undefined ? 'pending' : values,\n ...(def === undefined ? {} : { enum: def }),\n ...(use === undefined ? {} : { use }),\n });\n const tid = testid ?? `enum-picker:${enumName}`;\n\n if (!def) {\n return (\n <span data-testid={`${tid}:unregistered`} className=\"text-muted-foreground\">\n (enum &lsquo;{enumName}&rsquo; not registered)\n </span>\n );\n }\n\n // Loader-backed enum still resolving — render a disabled select placeholder\n // so the form layout is stable. (An available set that is not settled yet\n // is drawn below: its values are known, so the stored value keeps its label.)\n if (isLoading) {\n return (\n <Select disabled>\n <SelectTrigger\n data-testid={`${tid}:loading`}\n name={name}\n id={id}\n aria-busy=\"true\"\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n className={className}\n >\n <SelectValue placeholder={t('field.loading', { defaultValue: 'Loading…' })} />\n </SelectTrigger>\n <SelectContent />\n </Select>\n );\n }\n\n // Loader rejected — degrade to the same unregistered fallback so the\n // adopter notices in dev but the form does not crash. The error message\n // is included via `title` for inspection.\n if (error || !values) {\n return (\n <LoadError\n surface=\"picker\"\n error={error}\n testId={`${tid}:error`}\n className=\"text-muted-foreground\"\n fallback={{ key: 'relation.failed', default: 'Failed to load options.' }}\n >\n (failed to load enum &lsquo;{enumName}&rsquo;)\n </LoadError>\n );\n }\n\n const labelOf = (entry: EnumValue): string =>\n resolveEnumLabel(caps, ns, entry.value, enumValueText(def, entry.value) ?? entry.label);\n const summaryOf = (entry: EnumValue): string | undefined =>\n resolveDoc(caps, `enum/${ns}/${entry.value}`)?.summary || undefined;\n\n // The current value when it is not offered (REF-132 §8): a known value the set removed shows\n // its label, an unknown one the enum's fallback or the raw value. Once the user picks an\n // offered value it is gone, so it cannot be picked again. While the set is not settled\n // (pending, or a source failed: §7.4) nothing is offered, the stored value shows as the\n // current item and a status row stands in for the options.\n const settling = available.status === 'ready' ? undefined : available.status;\n const offered = settling === undefined ? available.values : [];\n const known = value == null ? undefined : values.find((entry) => entry.value === value);\n const current: EnumChoiceOption | undefined =\n value == null || value === '' || offered.some((entry) => entry.value === value)\n ? undefined\n : known === undefined\n ? { value, label: unknownEnumValueLabel(caps, def, ns, value).label }\n : {\n value,\n label: labelOf(known),\n ...(known.icon === undefined ? {} : { icon: known.icon }),\n };\n\n if (control !== 'select') {\n return (\n <EnumChoiceGroup\n control={control}\n {...(current === undefined ? {} : { current })}\n {...(settling === undefined ? {} : { settling })}\n options={offered.map((entry) => ({\n value: entry.value,\n label: labelOf(entry),\n ...(entry.icon === undefined ? {} : { icon: entry.icon }),\n ...withSummary(summaryOf(entry)),\n }))}\n value={value}\n onChange={onChange}\n testid={tid}\n name={name}\n id={id}\n required={required}\n disabled={disabled}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n ariaLabelledBy={ariaLabelledBy}\n className={className}\n />\n );\n }\n\n // 'select' (default)\n // When `clearable`, we prepend an \"All\" item using a sentinel value\n // because Radix forbids `<SelectItem value=\"\">`. We translate the\n // sentinel back to `undefined` before notifying the consumer; the\n // controlled-input `value` falls back to the sentinel when the consumer\n // passes null/undefined so the trigger reads \"All\" rather than the\n // placeholder.\n const selectValue = value == null ? (clearable ? ENUM_PICKER_CLEAR_SENTINEL : '') : value;\n const handleValueChange = (next: string): void => {\n if (clearable && next === ENUM_PICKER_CLEAR_SENTINEL) {\n onChange(undefined);\n return;\n }\n onChange(next);\n };\n return (\n <Select\n value={selectValue}\n onValueChange={handleValueChange}\n disabled={disabled}\n required={required}\n >\n <SelectTrigger\n data-testid={tid}\n name={name}\n id={id}\n aria-required={required}\n aria-busy={settling === 'pending' || undefined}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n className={className}\n >\n <SelectValue placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })} />\n </SelectTrigger>\n <SelectContent>\n {clearable && (\n <SelectItem value={ENUM_PICKER_CLEAR_SENTINEL} data-testid={`${tid}:option:__clear__`}>\n {clearLabel}\n </SelectItem>\n )}\n {current === undefined ? null : (\n <SelectItem value={current.value} disabled data-current=\"\" data-testid={`${tid}:current`}>\n {current.label}\n </SelectItem>\n )}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={tid} />}\n {offered.map((entry) => {\n const optionLabel = labelOf(entry);\n // Documentation for a value renders as PLAIN TEXT, never as a\n // button, and is passed as the item's `description` so it sits\n // OUTSIDE `ItemText`. Radix clones `ItemText` into the closed trigger\n // on selection, so a summary inside it would be glued onto the\n // selected label; an interactive child would also be unreachable by\n // keyboard, since the item owns roving focus. The «i» affordance is\n // reserved for the cmdk-based pickers, where an item can host one.\n const optionDoc = summaryOf(entry);\n return (\n <SelectItem\n key={entry.value}\n value={entry.value}\n data-testid={`${tid}:option:${entry.value}`}\n description={\n optionDoc === undefined ? undefined : (\n <span data-testid={`${tid}:option:${entry.value}:doc`}>{optionDoc}</span>\n )\n }\n >\n {optionLabel}\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n );\n}\n","import { ENUM_CONTROLS, type EnumControl, type EnumDef, isEnumControl } from '@burojs/core';\n\n/** `where` + value pairs already warned about, so a re-render does not repeat the warning. */\nconst warned = new Set<string>();\n\n/**\n * The control an enum field renders with: the field's own `ui.control`, else\n * the bound enum's `control`, else `'select'`.\n *\n * A field control that is not one of the four (possible from JavaScript or a\n * lowered declaration) is ignored with one `console.warn` naming `where` and\n * the value, and resolution falls through to the enum's control. An enum's own\n * `control` needs no check here: `defineEnum` refuses an unknown one.\n */\nexport function resolveEnumControl(\n fieldControl: unknown,\n enumDef: EnumDef | undefined,\n where: string,\n): EnumControl {\n if (isEnumControl(fieldControl)) return fieldControl;\n if (fieldControl !== undefined) {\n // `String()`, not a bare template: a symbol in a template literal throws.\n const shown = typeof fieldControl === 'string' ? `'${fieldControl}'` : String(fieldControl);\n const key = `${where}\\u0000${shown}`;\n if (!warned.has(key)) {\n warned.add(key);\n // eslint-disable-next-line no-console\n console.warn(\n `[buro/ui-shadcn] ${where}: unknown enum control ${shown}; expected one of ${ENUM_CONTROLS.map((control) => `'${control}'`).join(', ')}. Using the enum's control, else 'select'.`,\n );\n }\n }\n return enumDef?.control ?? 'select';\n}\n","import type { ValidationIssue, ValidationIssues } from '@burojs/core';\n\n/**\n * `ValidationIssue.severity` is a REQUIRED field (`'error' | 'warning' |\n * 'info'`) — every producer in the codebase already tags one, but nothing\n * downstream of core read it: a `severity: 'warning'` issue rendered red,\n * set `aria-invalid`, and blocked submit exactly like an error. This module\n * is the single place that decides what counts as blocking.\n *\n * Mirrors `@burojs/react`'s `useFormController` controller\n * (`packages/react/src/forms/use-declarative-form.ts:264-279`), which\n * already partitions the same way on the headless side — keep both in sync\n * if the severity contract ever grows a fourth bucket.\n */\nexport function isErrorIssue(issue: ValidationIssue): boolean {\n return issue.severity === 'error';\n}\n\nexport interface PartitionedIssues {\n /** Blocking: sets `aria-invalid`, gates submit, steals focus on submit. */\n readonly errors: ValidationIssues;\n /** Non-blocking (`'warning'` and `'info'`): rendered in a distinct, non-destructive channel. */\n readonly warnings: ValidationIssues;\n}\n\n/** Split a canonical issue list into blocking errors and non-blocking warnings/info, discarding neither. */\nexport function partitionIssuesBySeverity(issues: ValidationIssues): PartitionedIssues {\n const errors: ValidationIssue[] = [];\n const warnings: ValidationIssue[] = [];\n for (const issue of issues) {\n (isErrorIssue(issue) ? errors : warnings).push(issue);\n }\n return Object.freeze({ errors: Object.freeze(errors), warnings: Object.freeze(warnings) });\n}\n","'use client';\nimport type * as React from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { Checkbox } from '../primitives/checkbox.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nexport function BooleanDisplay({ value, text }: FieldRendererProps): React.ReactElement {\n const t = useOptionalT();\n if (value == null) return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces Yes / No.\n if (text !== undefined) return <span>{text}</span>;\n return (\n <span>\n {value ? t('boolean.yes', { defaultValue: 'Yes' }) : t('boolean.no', { defaultValue: 'No' })}\n </span>\n );\n}\n\nexport function BooleanInput({\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n}: FieldInputProps): React.ReactElement {\n return (\n <Checkbox\n name={name}\n id={id}\n checked={Boolean(value)}\n onCheckedChange={(v) => onChange(v === true)}\n data-testid={testid}\n disabled={disabled}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport {\n type TimeKind,\n canonicalInstant,\n epochMsToInstant,\n formatTimeValue,\n isCalendarDate,\n zoneShortName,\n} from '@burojs/core';\nimport { useOptionalLocale, useTimeZone } from '@burojs/react';\nimport { Input } from '../primitives/input.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { dateDisplayParams, useFieldTimeZone } from './field-time-zone.js';\nimport { localeTag } from './format.js';\nimport { fromLocalDateTimeText, toLocalDateTimeText } from './local-date-time.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nexport function DateDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"date\" {...props} />;\n}\n\n/**\n * Date AND time for a date-time field (`f.dateTime()`), in the live app locale and the field's\n * resolved zone (REF-118 §4.2): the field's own, else the user's, the app's and the host's.\n */\nexport function DateTimeDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"dateTime\" {...props} />;\n}\n\n/** A wall time (`f.time()`), shown in the live locale; it has no zone. */\nexport function TimeDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"time\" {...props} />;\n}\n\n/** The text a value is stored as: a `Date` reads as its ISO instant. */\nfunction storedText(value: unknown): string {\n return value instanceof Date && !Number.isNaN(value.getTime())\n ? value.toISOString()\n : String(value);\n}\n\nfunction TemporalDisplay({\n kind,\n value,\n text,\n field,\n record,\n}: FieldRendererProps & { readonly kind: TimeKind }): React.ReactElement {\n // Subscribe to the live locale so a language switch re-renders this cell in\n // place — matching `EnumDisplay`/`BooleanDisplay`. Without this, a table\n // row memoized on `row.original` (see data-table.tsx's `MemoRow`/`MemoCell`)\n // never re-renders on a locale-only change, so this cell would stay frozen\n // in the OLD language's date format while everything else flips.\n //\n // `useOptionalLocale` and not `useLocale`, and the difference is the whole\n // fix (F20): `useLocale` answers `'en'` both for \"the app is in English\" and\n // for \"there is no provider\", so a renderer that has its OWN fallback for the\n // second case cannot reach it. The optional form answers `undefined` there,\n // and the formatter then falls back to the persisted locale\n // — which is what `fields-display.test.tsx` drives, and what an\n // isolated (Storybook / no-provider) mount needs.\n //\n // In the app the value passed here is the REGISTERED locale code, so a\n // registry of `en`/`es`/`fr` formats as those.\n const locale = useOptionalLocale();\n // The zone the value is read in, and the viewer's own: the zone's name shows only when they\n // differ. A calendar date and a wall time have no zone, and ignore both.\n const zone = useFieldTimeZone(field?.zone, record);\n const viewer = useTimeZone();\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n if (zone.status === 'pending' || viewer.status === 'pending')\n return <Skeleton className=\"h-4 w-24\" aria-busy=\"true\" />;\n const raw = storedText(value);\n const formatted = formatTimeValue(kind, raw, {\n zone: zone.zone,\n viewerZone: viewer.zone,\n locale: localeTag(locale),\n params: {\n // A time field that is edited to the second is shown to the second, unless it says otherwise.\n ...(kind === 'time' && field?.ui?.seconds === true ? { timeStyle: 'medium' as const } : {}),\n ...dateDisplayParams(field?.ui),\n },\n });\n // A formatter's text is not a single date token, so it may wrap like any text. The full date\n // goes in the hover title: «2 days ago» alone cannot say which day.\n if (text !== undefined) return <span title={formatted}>{text}</span>;\n // Unparseable (a hand-edited value): the raw text is more honest than \"Invalid Date\".\n if (formatted === undefined) return <span>{raw}</span>;\n // `whitespace-nowrap`: a short date in some locales renders as «19 Jul 2026 AD» and\n // wrapped in a narrow table column, leaving «AD» stranded on a second line and\n // making that row taller than its neighbours — the table's row rhythm broke on\n // whichever rows happened to wrap. A date is a single token; never break it.\n return <span className=\"whitespace-nowrap\">{formatted}</span>;\n}\n\n/** A stored calendar date as the `date` box wants it; anything but `YYYY-MM-DD` reads as empty. */\nfunction toIsoDate(v: unknown): string {\n if (v == null || v === '') return '';\n const s = String(v);\n return isCalendarDate(s) ? s : '';\n}\n\nexport function DateInput(props: FieldInputProps): React.ReactElement {\n return (\n <TemporalInput {...props} type=\"date\" toText={toIsoDate} fromText={(text) => text || null} />\n );\n}\n\n/**\n * A date-time field (`f.dateTime()`): edited as the wall time of the field's resolved zone\n * (REF-118 §4.8), written as a canonical instant (see `local-date-time.ts`). The zone's short name\n * shows beside the box when it is not the viewer's own. While the zone is pending, the box is\n * disabled: a pending zone is never guessed.\n */\nexport function DateTimeInput(props: FieldInputProps): React.ReactElement {\n const locale = useOptionalLocale();\n const zone = useFieldTimeZone(\n props.field?.zone,\n props.values === undefined ? props.record : { ...props.record, ...props.values },\n );\n const viewer = useTimeZone();\n const pending = zone.status === 'pending';\n const fieldZone = zone.status === 'ready' ? zone.zone : undefined;\n const named =\n fieldZone !== undefined && viewer.status === 'ready' && fieldZone !== viewer.zone\n ? zoneShortName(\n canonicalInstant(String(props.value ?? '')) ?? epochMsToInstant(Date.now()),\n fieldZone,\n localeTag(locale),\n )\n : undefined;\n return (\n <TemporalInput\n {...props}\n type=\"datetime-local\"\n disabled={props.disabled || pending}\n toText={(value) => (fieldZone === undefined ? '' : toLocalDateTimeText(value, fieldZone))}\n fromText={(text) =>\n fieldZone === undefined ? null : (fromLocalDateTimeText(text, fieldZone) ?? null)\n }\n {...(named === undefined ? {} : { zoneName: named })}\n />\n );\n}\n\n/**\n * A wall time field (`f.time()`): a `time` box that writes `HH:mm`, or `HH:mm:ss` when the field\n * declares `seconds: true` (a box with a whole minute may report `HH:mm`; it is padded).\n */\nexport function TimeInput(props: FieldInputProps): React.ReactElement {\n const seconds = props.field?.ui?.seconds === true;\n return (\n <TemporalInput\n {...props}\n type=\"time\"\n step={seconds ? 1 : 60}\n toText={(value) => (value == null ? '' : String(value))}\n fromText={(text) => {\n if (text === '') return null;\n if (seconds) return text.length === 5 ? `${text}:00` : text;\n return text.slice(0, 5);\n }}\n />\n );\n}\n\nfunction TemporalInput({\n type,\n step,\n toText,\n fromText,\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n zoneName,\n}: FieldInputProps & {\n readonly type: 'date' | 'datetime-local' | 'time';\n readonly step?: number;\n /** The zone's short name, shown beside the box. */\n readonly zoneName?: string;\n readonly toText: (value: unknown) => string;\n readonly fromText: (text: string) => string | null;\n}): React.ReactElement {\n const input = (\n <Input\n name={name}\n id={id}\n type={type}\n {...(step === undefined ? {} : { step })}\n value={toText(value)}\n onChange={(e) => onChange(fromText(e.target.value))}\n data-testid={testid}\n disabled={disabled}\n required={required}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n if (zoneName === undefined) return input;\n return (\n <div className=\"flex items-center gap-2\">\n {input}\n <span\n className=\"whitespace-nowrap text-xs text-muted-foreground\"\n data-testid={testid === undefined ? undefined : `${testid}:zone`}\n >\n {zoneName}\n </span>\n </div>\n );\n}\n","'use client';\nimport { enumNamespaceOf, resolveDoc } from '@burojs/core';\nimport { narrowEntriesOf } from '@burojs/core/internal';\nimport {\n resolveOptionLabel,\n useAvailableEnumValues,\n useBoundEnum,\n useFieldMetaSources,\n useOptionCaps,\n useOptionalT,\n} from '@burojs/react';\nimport type * as React from 'react';\nimport { EnumChoiceGroup, type EnumChoiceOption } from '../enum/enum-choice-group.js';\nimport { EnumSettlingRow } from '../enum/enum-settling.js';\nimport { resolveEnumControl } from '../enum/resolve-enum-control.js';\nimport { Icon } from '../primitives/icon.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\n/*\n * An option's label is `resolveOptionLabel` (`@burojs/react`), the one reader a custom field\n * implementation's `FieldRenderContext.options` is resolved by too, so both show the same text.\n */\n\nexport function EnumDisplay({\n value,\n options,\n field,\n resource,\n}: FieldRendererProps): React.ReactElement {\n const caps = useOptionCaps(resource);\n const enumDef = useBoundEnum(field);\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const opt = options?.find((o) => o.value === String(value));\n const label = resolveOptionLabel(caps, field, String(value), opt, enumDef);\n return (\n <span className=\"inline-flex items-center gap-1\">\n {opt?.icon ? (\n <Icon name={opt.icon} className=\"size-3.5 shrink-0 text-muted-foreground\" />\n ) : null}\n {label}\n </span>\n );\n}\n\n/**\n * The options-driven enum input: a field with inline options, or one bound to\n * an enum only through `meta.enumNamespace`. Renders the control the field\n * asks for (`ui.control`), else the bound enum's `control`, else a select; the\n * non-select controls are the shared `EnumChoiceGroup`. When the field is bound\n * to an enum namespace, each value's summary is read the way `EnumPicker` reads\n * it (`enum/<ns>/<value>`), so one enum looks the same however its field is\n * bound; a truly inline enum has no value docs and shows labels only.\n *\n * The field's `meta.narrow` (REF-132 §7.2) removes options here as it does on a\n * registered enum's picker; a current value that is not offered still shows,\n * first and inert (§8).\n */\nexport function EnumInput({\n name,\n id,\n value,\n onChange,\n testid,\n options,\n field,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n resource,\n record,\n values,\n metaSources,\n baseline,\n}: FieldInputProps): React.ReactElement {\n const t = useOptionalT();\n const caps = useOptionCaps(resource);\n const enumDef = useBoundEnum(field);\n const ns = enumNamespaceOf(field);\n const control = resolveEnumControl(field?.ui?.control, enumDef, `field ${field?.name ?? name}`);\n const sources = useFieldMetaSources({ record, values, extra: metaSources });\n const available = useAvailableEnumValues({\n values: options ?? [],\n use: {\n narrow: narrowEntriesOf(field?.meta?.narrow),\n sources,\n mode: record === undefined ? 'create' : 'edit',\n // The form's starting values (seeded on a create), as the plan and the save compare.\n baseline: baseline ?? record,\n },\n });\n // Not settled (§7.4): nothing is offered, the stored value shows as the current item beside a\n // status row, exactly as `EnumPicker` draws it.\n const settling = available.status === 'ready' ? undefined : available.status;\n const offered = settling === undefined ? available.values : [];\n const tid = testid ?? name;\n const resolved: EnumChoiceOption[] = offered.map((o) => {\n const summary =\n ns === undefined ? undefined : resolveDoc(caps, `enum/${ns}/${o.value}`)?.summary;\n return {\n value: o.value,\n label: resolveOptionLabel(caps, field, o.value, o, enumDef),\n ...(o.icon === undefined ? {} : { icon: o.icon }),\n ...(summary === undefined ? {} : { summary }),\n };\n });\n // The current value when it is not offered: its label as a display shows it, inert.\n const raw = value == null || value === '' ? undefined : String(value);\n const known = raw === undefined ? undefined : options?.find((o) => o.value === raw);\n const current: EnumChoiceOption | undefined =\n raw === undefined || resolved.some((o) => o.value === raw)\n ? undefined\n : {\n value: raw,\n label: resolveOptionLabel(caps, field, raw, known, enumDef),\n ...(known?.icon === undefined ? {} : { icon: known.icon }),\n };\n\n if (control !== 'select') {\n return (\n <EnumChoiceGroup\n control={control}\n options={resolved}\n {...(current === undefined ? {} : { current })}\n {...(settling === undefined ? {} : { settling })}\n value={value as string | null | undefined}\n onChange={onChange}\n testid={tid}\n name={name}\n id={id}\n required={required}\n disabled={disabled}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n ariaLabelledBy={ariaLabelledBy}\n />\n );\n }\n\n return (\n <Select\n value={(value as string | undefined) ?? ''}\n onValueChange={onChange}\n disabled={disabled}\n required={required}\n >\n <SelectTrigger\n data-testid={testid}\n name={name}\n id={id}\n aria-required={required}\n aria-busy={settling === 'pending' || undefined}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n >\n <SelectValue placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })} />\n </SelectTrigger>\n <SelectContent>\n {current === undefined ? null : (\n <SelectItem value={current.value} disabled data-current=\"\" data-testid={`${tid}:current`}>\n {current.label}\n </SelectItem>\n )}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={tid} />}\n {resolved.map((o) => (\n <SelectItem\n key={o.value}\n value={o.value}\n data-testid={testid === undefined ? undefined : `${testid}:option:${o.value}`}\n // Outside `ItemText`, which Radix clones into the closed trigger.\n description={\n o.summary === undefined ? undefined : (\n <span\n data-testid={testid === undefined ? undefined : `${testid}:option:${o.value}:doc`}\n >\n {o.summary}\n </span>\n )\n }\n >\n <span className=\"inline-flex items-center gap-1.5\">\n {o.icon ? (\n <Icon name={o.icon} className=\"size-3.5 shrink-0 text-muted-foreground\" />\n ) : null}\n {o.label}\n </span>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n}\n","'use client';\nimport { type FileMapper, type FileRef, isImage } from '@burojs/file-storage';\nimport { useFileUrls, useOptionalFileStorage } from '@burojs/react';\nimport * as React from 'react';\nimport type { FieldRendererProps } from './registry.js';\n\nexport interface FileFieldProps extends FieldRendererProps {\n resource?: string;\n record?: Record<string, unknown>;\n variant?: { width?: number; height?: number };\n /** Cap for a narrow list cell. Extra files collapse into a `+N` badge. */\n max?: number;\n}\n\n// `isImage` itself lives in `@burojs/file-storage`, next to the `FileRef`\n// type it is a pure predicate over — not here, so an input renderer doesn't\n// have to depend on the display renderer (or vice versa) for it. Re-exported\n// below so `@burojs/ui-shadcn`'s public surface is unchanged.\nexport { isImage };\n\nexport function FileField(props: FileFieldProps): React.ReactElement {\n const ui = (props.field?.ui ?? {}) as {\n mapper?: unknown;\n fileStorage?: string;\n multiple?: boolean;\n };\n const name = props.field?.name ?? 'file';\n const testid = `file-field:${name}`;\n\n // Resolved WITHOUT throwing. A list renders one of these per row, all inside\n // the DataGrid's single render pass and with no error boundary between them,\n // so a throw here does not blank one cell — it takes down the whole table.\n // A misspelled `ui.fileStorage` is a config mistake in one field; it must\n // cost that field, not the page. The name is shown so the mistake is\n // findable without opening the console.\n const { adapter, error: storageError } = useOptionalFileStorage(ui.fileStorage);\n const multiple = props.multiple === true || ui.multiple === true;\n const { refs, error: mapperError } = React.useMemo(\n () =>\n toDomainRefs(props.value, (ui.mapper as FileMapper | undefined) ?? adapter?.defaultMapper, {\n resource: props.resource ?? '',\n field: name,\n multiple,\n record: props.record,\n }),\n [props.value, ui.mapper, adapter, props.resource, name, multiple, props.record],\n );\n\n const shown = props.max != null ? refs.slice(0, props.max) : refs;\n const hidden = refs.length - shown.length;\n\n const { urls, refresh } = useFileUrls(shown, {\n storage: ui.fileStorage,\n resource: props.resource,\n record: props.record,\n variant: props.variant ?? { width: 40, height: 40 },\n });\n\n // One retry PER REF, actually bounded. `refresh()` deliberately bypasses\n // useFileUrls' resolve cooldown (an explicit user/render-triggered retry\n // must never be blocked by it) — which is exactly why an unconditional\n // `onError -> refresh()` never stopped: a deleted object resolves a NEW\n // signed url just fine (the sign endpoint doesn't know the object is gone),\n // the <img> loads that new src, 404s again, and refresh() fires again,\n // forever, hammering the signing endpoint. `retried` remembers which refs\n // already spent their one retry so a second failure renders the fallback\n // badge instead of looping.\n const retried = React.useRef(new Set<string>());\n const [exhausted, setExhausted] = React.useState<Set<string>>(() => new Set());\n const handleError = React.useCallback(\n (localId: string) => {\n if (retried.current.has(localId)) {\n setExhausted((prev) => (prev.has(localId) ? prev : new Set(prev).add(localId)));\n return;\n }\n retried.current.add(localId);\n refresh(localId);\n },\n [refresh],\n );\n\n if (storageError) {\n return (\n <span\n className=\"inline-flex items-center rounded border border-destructive/40 px-2 py-0.5 text-xs text-destructive\"\n title={storageError}\n data-testid={`${testid}:storage-error`}\n >\n {storageError}\n </span>\n );\n }\n\n if (mapperError) {\n return (\n <span\n className=\"inline-flex items-center rounded border border-destructive/40 px-2 py-0.5 text-xs text-destructive\"\n title={mapperError}\n data-testid={`${testid}:mapper-error`}\n >\n {mapperError}\n </span>\n );\n }\n\n // A missing file is the ORDINARY case in real data — a nullable column, a\n // record saved before the field existed, a row whose upload failed — not an\n // error state, so it renders the same neutral dash every other empty cell\n // does. The test id is what lets \"nothing is shown here\" be asserted\n // positively; matching on the dash character alone would silently start\n // passing for any other empty rendering.\n if (refs.length === 0) {\n return (\n <span className=\"text-muted-foreground\" data-testid={`${testid}:empty`}>\n —\n </span>\n );\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {shown.map((ref, i) => {\n const url = urls[ref.localId];\n const label = ref.name ?? ref.handle ?? '';\n return (\n <span key={ref.localId} data-testid={`${testid}:item:${i}`} title={label}>\n {url && isImage(ref) && !exhausted.has(ref.localId) ? (\n <img\n src={url}\n alt={label}\n className=\"h-10 w-10 rounded border object-cover\"\n // One retry — an expired signature is the usual cause. After\n // that a placeholder, never an exception through a list, and\n // never another request: see `handleError` above.\n onError={() => handleError(ref.localId)}\n />\n ) : (\n <span className=\"inline-flex h-10 items-center rounded border px-2 font-mono text-xs\">\n {label.split('/').pop() || 'file'}\n </span>\n )}\n </span>\n );\n })}\n {hidden > 0 && (\n <span className=\"text-xs text-muted-foreground\" data-testid={`${testid}:overflow`}>\n +{hidden}\n </span>\n )}\n </div>\n );\n}\n\n/** The registry's `Display` for kind `file`. */\nexport const FileDisplay = FileField;\n\n/**\n * Column value → the framework's in-memory `FileRef[]`.\n *\n * TWO shapes reach this, and the order matters.\n *\n * 1. Already-normalised `FileRef[]`. That is what a form hands back while\n * it is being edited, and it must be taken VERBATIM — re-running a\n * mapper over a ref that already carries upload state would reinterpret\n * the framework's own domain value as if it were a backend column.\n * 2. The RAW COLUMN, straight off the record: a filename, a key, a URL, an\n * array of them, or `null`. That is what a list cell and a show page get,\n * because a data provider returns rows, not refs.\n *\n * Case 2 used to return `[]` — which meant a file field rendered from a\n * record showed the empty dash forever, however many files the column\n * actually named, on every backend. `FileMapper.read` is the port's own\n * answer to that translation and nothing in the repository ever called it;\n * this is that call, not a new abstraction beside it. The mapper is the\n * field's declared one (`f.file({ mapper })`) or the storage's\n * `defaultMapper`, exactly the pair `assertFileStorageWiring` already treats\n * as authoritative for the write direction.\n *\n * `read` is documented as PURE, and every mapper shipped by the port is\n * total over a well-formed column — but \"well-formed\" is the adopter's\n * claim, not a checked one (`scalarHandle` over a numeric column throws), so\n * a throw is reported in the cell rather than allowed out. A list renders one\n * of these per row inside the DataGrid's single render pass with no error\n * boundary between them: an uncaught throw here does not blank one cell, it\n * takes down the whole table. Reported and not swallowed, for the same reason\n * an unknown storage name is.\n */\nfunction toDomainRefs(\n value: unknown,\n mapper: FileMapper | undefined,\n ctx: { resource: string; field: string; multiple: boolean; record?: Record<string, unknown> },\n): { refs: FileRef[]; error?: string } {\n if (isFileRefs(value)) return { refs: value };\n if (value == null || mapper === undefined) return { refs: [] };\n try {\n return { refs: mapper.read(value, ctx) };\n } catch (e) {\n return {\n refs: [],\n error: `Cannot read file column '${ctx.field}': ${(e as Error).message}`,\n };\n }\n}\n\nfunction isFileRefs(value: unknown): value is FileRef[] {\n return (\n Array.isArray(value) &&\n value.every(\n (entry) =>\n entry !== null &&\n typeof entry === 'object' &&\n typeof (entry as { localId?: unknown }).localId === 'string',\n )\n );\n}\n","'use client';\nimport { isImage } from '@burojs/file-storage';\nimport { type FileItem, formatBytes, useFileField, useFileUrls, useOptionalT } from '@burojs/react';\nimport { IconLoader2, IconRotate, IconUpload, IconX } from '@tabler/icons-react';\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport type { FieldInputProps } from './registry.js';\n\nexport { FileDisplay, FileField, isImage, type FileFieldProps } from './file-display.js';\n\n/**\n * `<FileInput>` — presentational. Every decision that used to live here (which\n * backend, which token, what a value looks like) now lives in the storage port,\n * and this component only renders the state machine `useFileField` produces.\n */\nexport interface FileInputProps extends FieldInputProps {\n resource?: string;\n record?: Record<string, unknown>;\n}\n\nexport function FileInput(props: FileInputProps): React.ReactElement {\n const t = useOptionalT();\n const ui = (props.field?.ui ?? {}) as {\n accept?: string[];\n multiple?: boolean;\n maxSize?: number;\n fileStorage?: string;\n mapper?: unknown;\n defer?: boolean;\n orphans?: 'best-effort' | 'keep';\n };\n\n // The logical field name remains distinct from the DOM input name.\n // `<RecordScreen>` prefixes DOM names so create and edit controls cannot\n // collide, while storage context must still identify the declared field.\n const fieldName = props.field?.name ?? props.name;\n\n const field = useFileField({\n resource: props.resource ?? 'unknown',\n field: fieldName,\n multiple: props.multiple === true || ui.multiple === true,\n value: props.value,\n onChange: props.onChange,\n record: props.record,\n storage: ui.fileStorage,\n defer: ui.defer,\n orphans: ui.orphans,\n accept: ui.accept,\n maxSize: ui.maxSize,\n });\n\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const [isDragging, setIsDragging] = React.useState(false);\n const testid = props.testid ?? `file-input:${props.name}`;\n const disabled = props.disabled === true;\n const rejected = field.items.find((i) => i.status === 'rejected' && i.error);\n\n function pick(list: FileList | null) {\n if (!list || list.length === 0) return;\n // ⚠️ Clear any previous rejection FIRST. A rejected item is hidden from the\n // list below (there is no row, so no remove button), but it stays in\n // `items` — so without this the message from a file the user has already\n // dealt with hangs around forever with no way to dismiss it, describing a\n // file that is no longer on screen.\n dismissRejected();\n field.add([...list]);\n }\n\n /** Drop every rejected item, so a stale validation message cannot outlive it. */\n function dismissRejected() {\n for (const item of field.items) {\n if (item.status === 'rejected') field.remove(item.ref.localId);\n }\n }\n\n return (\n <div className=\"space-y-2\" data-testid={`${testid}:root`}>\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (!disabled) inputRef.current?.click();\n }\n }}\n onDragEnter={(e) => {\n e.preventDefault();\n if (!disabled) setIsDragging(true);\n }}\n onDragOver={(e) => e.preventDefault()}\n onDragLeave={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setIsDragging(false);\n }}\n onDrop={(e) => {\n e.preventDefault();\n setIsDragging(false);\n if (!disabled) pick(e.dataTransfer.files);\n }}\n data-testid={`${testid}:dropzone`}\n data-dragging={isDragging || undefined}\n data-uploading={field.busy || undefined}\n aria-disabled={disabled || undefined}\n aria-label={t('field.pickFile', { defaultValue: 'Pick or drop a file' })}\n aria-invalid={props.ariaInvalid || undefined}\n aria-describedby={props.ariaDescribedBy || undefined}\n {...(props.ariaErrorMessage ? { 'aria-errormessage': props.ariaErrorMessage } : {})}\n className={cn(\n 'flex min-h-[6rem] cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-muted-foreground/30 bg-muted/20 px-4 py-3 text-center text-sm transition-colors',\n isDragging && 'border-primary bg-primary/5',\n disabled && 'cursor-not-allowed opacity-60',\n )}\n >\n <IconUpload className=\"h-5 w-5 text-muted-foreground\" aria-hidden />\n <p className=\"text-sm\">\n {t('field.dropHint', { defaultValue: 'Click to pick a file or drag-and-drop' })}\n </p>\n {(ui.accept?.length || ui.maxSize != null) && (\n <p className=\"text-xs text-muted-foreground\">\n {ui.accept?.length ? `Accepts ${ui.accept.join(', ')}` : ''}\n {ui.accept?.length && ui.maxSize != null ? ' · ' : ''}\n {ui.maxSize != null ? `Max ${formatBytes(ui.maxSize)}` : ''}\n </p>\n )}\n </div>\n\n <input\n ref={inputRef}\n type=\"file\"\n name={props.name}\n id={props.id}\n accept={ui.accept?.length ? ui.accept.join(',') : undefined}\n multiple={props.multiple === true || ui.multiple === true}\n disabled={disabled || field.busy}\n required={props.required}\n onChange={(e) => {\n pick(e.target.files);\n // Reset so re-picking the same file still fires a change.\n e.target.value = '';\n }}\n data-testid={`${testid}:native`}\n aria-invalid={props.ariaInvalid || undefined}\n aria-describedby={props.ariaDescribedBy || undefined}\n {...(props.ariaErrorMessage ? { 'aria-errormessage': props.ariaErrorMessage } : {})}\n className=\"sr-only\"\n />\n\n <ul className=\"space-y-1\">\n {field.items\n .filter((i) => i.status !== 'rejected')\n .map((item) => (\n <FileRow\n key={item.ref.localId}\n item={item}\n testid={testid}\n storage={ui.fileStorage}\n resource={props.resource}\n record={props.record}\n onRemove={() => field.remove(item.ref.localId)}\n onRetry={() => field.retry(item.ref.localId)}\n />\n ))}\n </ul>\n\n {/* Always mounted: some screen readers skip a live region inserted late.\n Mounted is what matters — the reserved height did not, and cost a\n blank line under every file field that never errors. No\n `empty:hidden`/`hidden` here either: `display: none` pulls the\n element OUT of the accessibility tree, so an empty-to-populated\n transition would look exactly like a late-inserted live region to\n a screen reader — the one thing unconditional mounting exists to\n avoid. An empty `<p>` with `flex items-center` already collapses\n to zero height on its own; nothing is gained by hiding it. */}\n <p\n className=\"flex items-center gap-2 text-sm text-destructive\"\n aria-live=\"polite\"\n data-testid={`${testid}:local-error`}\n >\n {rejected?.error ?? ''}\n {rejected ? (\n // A rejected file has no row of its own, so this is the ONLY way to\n // dismiss its message. Without it the error is unclearable.\n <button\n type=\"button\"\n onClick={dismissRejected}\n className=\"underline underline-offset-2\"\n data-testid={`${testid}:dismiss-error`}\n >\n {t('field.dismiss', { defaultValue: 'Dismiss' })}\n </button>\n ) : null}\n </p>\n </div>\n );\n}\n\nfunction FileRow({\n item,\n testid,\n storage,\n resource,\n record,\n onRemove,\n onRetry,\n}: {\n item: FileItem;\n testid: string;\n storage?: string;\n resource?: string;\n record?: Record<string, unknown>;\n onRemove: () => void;\n onRetry: () => void;\n}): React.ReactElement {\n const single = React.useMemo(() => [item.ref], [item.ref]);\n const t = useOptionalT();\n const { urls, refresh } = useFileUrls(single, {\n storage,\n resource,\n record,\n variant: { width: 48, height: 48 },\n enabled: item.status === 'uploaded',\n });\n\n // A pending file has no server URL yet; preview it locally and revoke on\n // unmount, or the object URL leaks for the life of the page.\n const [localUrl, setLocalUrl] = React.useState<string | undefined>();\n React.useEffect(() => {\n const file = item.ref.pending;\n if (!file || !file.type.startsWith('image/')) return;\n const url = URL.createObjectURL(file);\n setLocalUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [item.ref.pending]);\n\n const src = urls[item.ref.localId] ?? localUrl;\n const id = `${testid}:item:${item.ref.localId}`;\n\n // One retry, ACTUALLY bounded, then a placeholder. `refresh()` deliberately\n // bypasses useFileUrls' resolve cooldown — an explicit retry must never be\n // blocked by it — which is exactly why an unconditional `onError ->\n // refresh()` never stopped: a deleted object still signs a fresh (also\n // dead) url every time, the <img> loads it, 404s again, and refresh() fires\n // again — forever, hammering the signing endpoint. `retriedRef` remembers\n // this ref already spent its one retry so a second failure shows the\n // filetype icon instead of looping.\n const retriedRef = React.useRef(false);\n const [exhausted, setExhausted] = React.useState(false);\n const handleThumbError = React.useCallback(() => {\n if (retriedRef.current) {\n setExhausted(true);\n return;\n }\n retriedRef.current = true;\n refresh(item.ref.localId);\n }, [refresh, item.ref.localId]);\n\n return (\n <li className=\"flex items-center gap-3 rounded border px-2 py-1.5\" data-testid={id}>\n {src && isImage(item.ref) && !exhausted ? (\n <img\n src={src}\n alt={item.ref.name ?? ''}\n className=\"h-10 w-10 shrink-0 rounded border object-cover\"\n data-testid={`${id}:thumb`}\n // One retry: the overwhelmingly common cause is an expired\n // signature. After that a placeholder, never another request: see\n // `handleThumbError` above.\n onError={handleThumbError}\n />\n ) : (\n <div\n className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded border bg-background text-[10px] font-semibold uppercase text-muted-foreground\"\n data-testid={`${id}:filetype-icon`}\n >\n {extOf(item.ref.name ?? '') || 'FILE'}\n </div>\n )}\n\n <div className=\"min-w-0 flex-1 text-left\">\n <p className=\"truncate text-sm\">{item.ref.name ?? item.ref.handle}</p>\n <p className=\"truncate text-xs text-muted-foreground\">\n {item.ref.size != null ? formatBytes(item.ref.size) : ''}\n {item.status === 'deferred'\n ? ` · ${t('field.waitingForSave', { defaultValue: 'waiting for save' })}`\n : ''}\n {item.status === 'failed' ? ` · ${item.error ?? 'failed'}` : ''}\n </p>\n {item.status === 'uploading' && (\n <progress\n className=\"h-1 w-full\"\n max={1}\n value={item.progress ?? 0}\n data-testid={`${id}:progress`}\n />\n )}\n </div>\n\n <div className=\"flex items-center gap-1\">\n {item.status === 'uploading' && (\n <IconLoader2 className=\"h-4 w-4 animate-spin text-muted-foreground\" aria-hidden />\n )}\n {item.status === 'failed' && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onRetry}\n data-testid={`${id}:retry`}\n >\n <IconRotate className=\"h-4 w-4\" aria-hidden />\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onRemove}\n data-testid={`${id}:remove`}\n >\n <IconX className=\"h-4 w-4\" aria-hidden />\n </Button>\n </div>\n </li>\n );\n}\n\nfunction extOf(name: string): string {\n const dot = name.lastIndexOf('.');\n return dot < 0 ? '' : name.slice(dot + 1).toLowerCase();\n}\n","'use client';\n\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n 'flex min-h-[80px] w-full rounded-md border border-input bg-background text-foreground px-3 py-2 text-base md:text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-input-disabled',\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n","'use client';\nimport * as React from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { Textarea } from '../primitives/textarea.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\n/**\n * Read view for a jsonb field: pretty-printed, monospace, indentation kept.\n * Routes through `toDisplayText` so an object never reaches the screen as\n * «[object Object]».\n */\nexport function JsonDisplay({\n value,\n presentation,\n testid,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const { text } = toDisplayText(value);\n // The <pre> stays in both modes: monospace and preserved line breaks are\n // information, not decoration. What `plain` drops is the chrome around it —\n // the fill, border and padding, all of which fight whatever container is\n // hosting the value.\n const className =\n presentation === 'plain'\n ? 'overflow-x-auto whitespace-pre font-mono text-xs leading-relaxed'\n : 'overflow-x-auto whitespace-pre rounded-md border bg-muted/40 p-3 font-mono text-xs leading-relaxed';\n return (\n <pre data-testid={testid} className={className}>\n {text}\n </pre>\n );\n}\n\n/**\n * Edit view for a jsonb field.\n *\n * The old path routed json through the plain textarea input, which set\n * `value={object}` — React stringifies that to «[object Object]», so a work\n * order's processing options (and every other jsonb field) were uneditable and\n * showed the literal placeholder. This keeps a local TEXT buffer seeded from the\n * value as pretty JSON, and:\n * - emits the PARSED object upward while the text is valid JSON, so the payload\n * stays a real object;\n * - keeps the last valid value and shows an inline \"invalid JSON\" hint while the\n * user is mid-edit, rather than blocking typing or emitting a broken string.\n */\nexport function JsonInput({\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n}: FieldInputProps): React.ReactElement {\n const t = useOptionalT();\n const seed = React.useMemo(() => {\n if (value == null || value === '') return '';\n return toDisplayText(value).text;\n }, [value]);\n\n const [text, setText] = React.useState(seed);\n const [invalid, setInvalid] = React.useState(false);\n // Re-seed when the upstream value changes identity (e.g. draft restore) but\n // not on every keystroke — the local buffer owns the text while editing.\n const lastSeed = React.useRef(seed);\n if (seed !== lastSeed.current) {\n lastSeed.current = seed;\n // Only adopt the new seed when the user isn't mid-edit on a divergent value.\n if (!invalid) setText(seed);\n }\n\n return (\n <div className=\"space-y-1\">\n <Textarea\n name={name}\n id={id}\n value={text}\n onChange={(e) => {\n const next = e.target.value;\n setText(next);\n const trimmed = next.trim();\n if (trimmed === '') {\n setInvalid(false);\n onChange(null);\n return;\n }\n try {\n onChange(JSON.parse(trimmed));\n setInvalid(false);\n } catch {\n // Keep the buffer, don't emit a broken value.\n setInvalid(true);\n }\n }}\n data-testid={testid}\n disabled={disabled}\n aria-required={required}\n aria-invalid={ariaInvalid || invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className=\"min-h-40 font-mono text-xs\"\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n {invalid && (\n <p\n className=\"text-[13px] leading-snug text-destructive\"\n data-testid={`${testid}-json-error`}\n >\n {t('field.jsonInvalid', {\n defaultValue: 'Invalid JSON. Changes will not be saved until it is valid.',\n })}\n </p>\n )}\n </div>\n );\n}\n","import { type ReactElement, Suspense, lazy } from 'react';\nimport type { FieldInputProps } from './registry.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nconst RelationManyPickerInput = lazy(() =>\n import('./relation-many-picker.js').then((module) => ({\n default: module.RelationManyPickerInput,\n })),\n);\n\n/**\n * The to-many select, kept off the first paint: a screen draws a skeleton until its chunk\n * arrives (the chunk holds no data, so no access is decided here).\n */\nexport function LazyRelationManyInput(props: FieldInputProps): ReactElement {\n return (\n <Suspense\n fallback={\n <Skeleton\n data-buro-skeleton=\"\"\n data-testid=\"relation-many-loading\"\n className=\"h-9 w-full\"\n />\n }\n >\n <RelationManyPickerInput {...props} />\n </Suspense>\n );\n}\n","import { lazy, Suspense, type ReactElement } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nconst RichTextDisplay = lazy(() =>\n import('./rich-text.js').then((module) => ({ default: module.RichTextDisplay })),\n);\nconst RichTextInput = lazy(() =>\n import('./rich-text.js').then((module) => ({ default: module.RichTextInput })),\n);\n\nfunction RichTextDisplayLoading(): ReactElement {\n const t = useOptionalT();\n return (\n <div\n data-testid=\"rich-text-display-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n aria-label={t('richText.loadingDisplay', { defaultValue: 'Loading rich text display' })}\n className=\"min-h-5 w-full animate-pulse rounded-sm bg-muted\"\n />\n );\n}\n\nfunction RichTextInputLoading({ field }: Pick<FieldInputProps, 'field'>): ReactElement {\n const t = useOptionalT();\n const showToolbar = field?.ui?.formatting !== false;\n\n return (\n <div\n data-testid=\"rich-text-input-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n aria-label={t('richText.loadingEditor', { defaultValue: 'Loading rich text editor' })}\n className=\"w-full overflow-hidden rounded-md border bg-background\"\n >\n {showToolbar ? (\n <div\n data-testid=\"rich-text-input-loading-toolbar\"\n aria-hidden=\"true\"\n className=\"h-9 border-b bg-muted/30\"\n />\n ) : null}\n <div\n data-testid=\"rich-text-input-loading-editor\"\n aria-hidden=\"true\"\n className=\"min-h-[6rem] animate-pulse bg-muted\"\n />\n </div>\n );\n}\n\nexport function LazyRichTextDisplay(props: FieldRendererProps): ReactElement {\n return (\n <Suspense fallback={<RichTextDisplayLoading />}>\n <RichTextDisplay {...props} />\n </Suspense>\n );\n}\n\nexport function LazyRichTextInput(props: FieldInputProps): ReactElement {\n return (\n <Suspense fallback={<RichTextInputLoading field={props.field} />}>\n <RichTextInput {...props} />\n </Suspense>\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { useOptionalLocale } from '@burojs/react';\nimport { Input } from '../primitives/input.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { formatNumber } from './format.js';\n\n/**\n * Strip wrapping double quotes from a value.\n * Defends against APIs that serialize bigint as a quoted string (e.g. Hasura\n * returning `count` as `\"\\\"299978\\\"\"`).\n */\nfunction unquote(s: string): string {\n if (s.length >= 2 && s.startsWith('\"') && s.endsWith('\"')) {\n return s.slice(1, -1);\n }\n return s;\n}\n\n/**\n * Is this field an IDENTIFIER rather than a quantity?\n *\n * An id is a name that happens to be spelled with digits — grouping it turns\n * record 2910 into «2 910» (or \"2,910\" in English), which reads as a count, does\n * not match what the user sees elsewhere (the dashboard prints `#2910`), and\n * cannot be copy-pasted or searched for as typed.\n *\n * Convention over configuration: `id` and any `*_id` foreign key. Making every\n * adopter tag ~20 resources by hand to avoid a wrong default would be the wrong\n * trade; a field explicitly marked `meta.identifier` wins either way.\n */\nfunction isIdentifier(field?: { name?: string; meta?: Record<string, unknown> }): boolean {\n if (field?.meta?.identifier === true) return true;\n if (field?.meta?.identifier === false) return false;\n const n = field?.name;\n return n === 'id' || (typeof n === 'string' && n.endsWith('_id'));\n}\n\nexport function NumberDisplay({ value, field, text }: FieldRendererProps): React.ReactElement {\n // Subscribe to the live locale so a language switch re-renders this cell in\n // place, even inside a memoized table row/cell (see `DateDisplay`'s comment\n // in `./date.tsx` for the full rationale — same fix, same reasoning), and\n // hand the live code to `formatNumber` so the number groups per ITS rules.\n const locale = useOptionalLocale();\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces the locale grouping.\n if (text !== undefined) return <span>{text}</span>;\n let raw = value;\n if (typeof raw === 'string') raw = unquote(raw);\n const n = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(n)) return <span>{String(value)}</span>;\n return <span>{isIdentifier(field) ? String(n) : formatNumber(n, locale)}</span>;\n}\n\nexport function NumberInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n min,\n max,\n}: FieldInputProps): React.ReactElement {\n return (\n <Input\n name={name}\n id={id}\n type=\"number\"\n value={value == null ? '' : String(value)}\n onChange={(e) => {\n const v = e.target.value;\n if (v === '') {\n onChange(null);\n return;\n }\n const n = Number(v);\n onChange(Number.isNaN(n) ? v : n);\n }}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n min={min}\n max={max}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type { ScalarDisplayProps, ScalarInputProps } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { cn } from '../lib/cn.js';\n\nconst GROUP = 'rounded-md border border-input p-3';\n\n/**\n * The input chrome of an object field (T2 5.5): a bordered group around its properties. The\n * shell lays the properties out in the declared layout and hands them over as `children`; the\n * field's own label is the leaf's, so the group is named by it.\n */\nexport function ObjectGroupInput(props: ScalarInputProps<unknown>): ReactElement {\n const { testIds, accessibility, children } = props;\n return (\n <div\n role=\"group\"\n data-buro-object-group=\"input\"\n className={cn(GROUP, 'space-y-3')}\n data-testid={testIds.input}\n id={accessibility.input}\n aria-labelledby={accessibility.label}\n aria-describedby={accessibility.description}\n aria-invalid={\n props.issues.some((issue) => issue.severity === 'error' && issue.path.length === 0) ||\n undefined\n }\n aria-errormessage={accessibility.error}\n >\n {children}\n </div>\n );\n}\n\n/** The display chrome of an object field: the same group around its properties' displays. */\nexport function ObjectGroupDisplay(props: ScalarDisplayProps<unknown>): ReactElement {\n const { testIds, children } = props;\n return (\n <div\n role=\"group\"\n data-buro-object-group=\"display\"\n className={cn(GROUP, 'space-y-2')}\n data-testid={testIds.display}\n >\n {children}\n </div>\n );\n}\n","'use client';\nimport type { CollectionDisplayProps, CollectionInputProps } from '@burojs/react';\nimport { useChromeT } from '@burojs/react';\nimport { IconArrowDown, IconArrowUp, IconPlus, IconTrash } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\nimport { Button } from '../primitives/button.js';\n\n/** The repeater's texts: one translatable text each, the English default beside the key. */\nfunction useRepeaterTexts() {\n const t = useChromeT();\n return {\n add: t('field.repeater.add', { defaultValue: 'Add' }),\n empty: t('field.repeater.empty', { defaultValue: 'No items yet' }),\n remove: (position: number) =>\n t('field.repeater.remove', {\n params: { position },\n defaultValue: 'Remove item {{position}}',\n }),\n moveUp: (position: number) =>\n t('field.repeater.moveUp', {\n params: { position },\n defaultValue: 'Move item {{position}} up',\n }),\n moveDown: (position: number) =>\n t('field.repeater.moveDown', {\n params: { position },\n defaultValue: 'Move item {{position}} down',\n }),\n };\n}\n\n/**\n * The input chrome of an array field (T2 5.5): its elements, each with move-up, move-down and\n * remove, and an add button. The shell supplies the elements (`renderElement`), their stable keys\n * and the one set of actions; the repeater only draws them. Test ids are\n * `<input id>:item:<n>`, `:add`, `:empty` and, per element, `:remove:<n>`, `:up:<n>`, `:down:<n>`.\n */\nexport function RepeaterInput(props: CollectionInputProps<unknown>): ReactElement {\n const texts = useRepeaterTexts();\n const { value, renderElement, elementKeys, onAdd, onRemove, onMove, testIds, accessibility } =\n props;\n const root = testIds.input;\n const at = (suffix: string) => (root === undefined ? undefined : `${root}:${suffix}`);\n const editable = props.disabled !== true && props.readOnly !== true;\n const canAdd = editable && onAdd !== undefined && props.canAdd !== false;\n const canRemove = editable && onRemove !== undefined && props.canRemove !== false;\n const last = value.length - 1;\n return (\n <div\n role=\"group\"\n className=\"space-y-2\"\n data-testid={root}\n id={accessibility.input}\n aria-labelledby={accessibility.label}\n aria-describedby={accessibility.description}\n aria-errormessage={accessibility.error}\n >\n {value.length === 0 ? (\n <p className=\"text-sm text-muted-foreground\" data-testid={at('empty')}>\n {texts.empty}\n </p>\n ) : (\n <ol className=\"space-y-2\">\n {value.map((_, index) => (\n <li\n key={elementKeys?.[index] ?? index}\n className=\"flex items-start gap-2 rounded-md border border-input p-3\"\n data-testid={at(`item:${index}`)}\n >\n <div className=\"min-w-0 flex-1\">{renderElement?.(index)}</div>\n {onMove === undefined && onRemove === undefined ? null : (\n <div className=\"flex shrink-0 gap-1\">\n {onMove === undefined ? null : (\n <>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.moveUp(index + 1)}\n disabled={!editable || index === 0}\n data-testid={at(`up:${index}`)}\n onClick={() => onMove(index, index - 1)}\n >\n <IconArrowUp aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.moveDown(index + 1)}\n disabled={!editable || index === last}\n data-testid={at(`down:${index}`)}\n onClick={() => onMove(index, index + 1)}\n >\n <IconArrowDown aria-hidden=\"true\" />\n </Button>\n </>\n )}\n {onRemove === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.remove(index + 1)}\n disabled={!canRemove}\n data-testid={at(`remove:${index}`)}\n onClick={() => onRemove(index)}\n >\n <IconTrash aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n )}\n </li>\n ))}\n </ol>\n )}\n {onAdd === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={!canAdd}\n data-testid={at('add')}\n onClick={onAdd}\n >\n <IconPlus aria-hidden=\"true\" />\n {texts.add}\n </Button>\n )}\n </div>\n );\n}\n\n/** The display chrome of an array field: a read-only list of its elements' displays. */\nexport function RepeaterDisplay(props: CollectionDisplayProps<unknown>): ReactElement {\n const texts = useRepeaterTexts();\n const { value, renderElement, testIds } = props;\n if (value.length === 0)\n return (\n <span className=\"text-muted-foreground\" data-testid={testIds.display}>\n {texts.empty}\n </span>\n );\n return (\n <ol className=\"space-y-2\" data-testid={testIds.display}>\n {value.map((_, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a read-only list has no identity to keep\n <li key={index} className=\"rounded-md border border-input p-3\">\n {renderElement?.(index)}\n </li>\n ))}\n </ol>\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport {\n type DtoSource,\n type ResourceRefInput,\n declaredField,\n linkOf,\n normalizeEntityRef,\n resourceKey,\n} from '@burojs/core';\nimport {\n useApp,\n useEntryGate,\n useLinkKeys,\n useOptionalT,\n useRelatedRecord,\n useTestIds,\n} from '@burojs/react';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport type { FieldRendererProps } from './registry.js';\nimport { RelationDisplay } from './relation-display.js';\n\ntype Rec = Readonly<Record<string, unknown>>;\n\nconst isRecord = (value: unknown): value is Rec =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\n/** A display name (`through.resource`) as the registry keys it: a bare one means `default` (REF-95 §4.3). */\nfunction qualify(name: unknown): string | undefined {\n try {\n const ref = normalizeEntityRef(name as string);\n return ref.namespace === 'default' ? ref.id : `${ref.namespace}:${ref.id}`;\n } catch {\n return undefined;\n }\n}\n\nfunction idFieldOf(def: { readonly data?: unknown } | undefined): string {\n const declared = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n return typeof declared === 'string' && declared.length > 0 ? declared : 'id';\n}\n\nfunction byOf(field: unknown): string | undefined {\n const by = isRecord(field) && isRecord(field.meta) ? field.meta.by : undefined;\n return typeof by === 'string' && by.length > 0 ? by : undefined;\n}\n\nconst chipClassName =\n 'inline-flex items-center rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-xs';\n\n/**\n * A link field (`f.relationMany({ through })`): the target keys its junction rows hold, each a\n * chip titled as {@link RelationDisplay} titles one key. The owner key is the record's value of\n * the field the junction's `sourceKey` relation names (`by`), else of the owner's id field. Keys\n * whose title read finds no row (the target is filtered or out of the user's reach) are counted in\n * one \"not visible\" chip, never dropped silently; an owner whose rows reach the read cap shows\n * how many keys were read instead of chips, since the set is not known to be whole. A failed read\n * says so, distinct from an empty link.\n */\nexport function LinkKeysDisplay(props: FieldRendererProps): React.ReactElement {\n const { field, record } = props;\n // The registry key, namespace included; `resource` is the bare id on the adapter path.\n const owner = props.owner ?? props.resource ?? '';\n const name = field?.name ?? '';\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n\n const ownerDef = owner === '' ? undefined : app.registry.get(owner);\n // A base field or a type's own: a link a type declares draws like any other.\n const declaration =\n ownerDef === undefined ? undefined : declaredField(ownerDef as unknown as DtoSource, name);\n const link = isRecord(declaration) ? linkOf(declaration) : undefined;\n const junctionName = link === undefined ? undefined : qualify(link.junction);\n const junctionDef = junctionName === undefined ? undefined : app.registry.get(junctionName);\n const junctionField = (key: string) =>\n junctionDef === undefined ? undefined : declaredField(junctionDef as unknown as DtoSource, key);\n const ownerField =\n link === undefined\n ? idFieldOf(ownerDef)\n : (byOf(junctionField(link.sourceKey)) ?? idFieldOf(ownerDef));\n const targetBy = link === undefined ? undefined : byOf(junctionField(link.targetKey));\n const ownerKey = record?.[ownerField];\n\n const { keys, complete, isLoading, error } = useLinkKeys(owner, name, ownerKey);\n\n // Keys whose title read is a confirmed miss, reported by each chip.\n const [missed, setMissed] = useState<ReadonlySet<string>>(() => new Set());\n const onMiss = useCallback((key: string, isMiss: boolean) => {\n setMissed((current) => {\n if (current.has(key) === isMiss) return current;\n const next = new Set(current);\n if (isMiss) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n // The target as the declaration names it, else as the props carry it.\n const target =\n (isRecord(declaration) && isRecord(declaration.meta) ? declaration.meta.to : undefined) ??\n field?.meta?.to;\n const chipField = useMemo(\n () => ({\n name,\n meta: {\n ...(target === undefined ? {} : { to: target }),\n ...(targetBy === undefined ? {} : { by: targetBy }),\n },\n ...(field?.ui === undefined ? {} : { ui: field.ui }),\n }),\n [name, target, field?.ui, targetBy],\n );\n\n const chipsId = tid.linkChips(owner, name);\n if (error)\n return (\n <LoadError\n surface=\"relation\"\n error={error}\n {...(typeof target === 'string' ? { resource: target } : {})}\n testId={tid.linkError(owner, name)}\n className=\"text-destructive text-xs\"\n attributes={{ role: 'status' }}\n fallback={{ key: 'field.link.failed', default: 'Links could not be loaded' }}\n />\n );\n if (keys === undefined) {\n if (!isLoading)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n return (\n <span\n data-testid={`${chipsId}:loading`}\n className=\"inline-block h-5 w-20 animate-pulse rounded bg-muted\"\n aria-busy=\"true\"\n />\n );\n }\n if (!complete)\n return (\n <span data-testid={chipsId} className=\"inline-flex flex-wrap gap-1\">\n <span data-testid={tid.linkIncomplete(owner, name)} className=\"text-muted-foreground\">\n {t('field.link.incomplete', {\n count: keys.length,\n defaultValue: 'More than {{count}} links',\n })}\n </span>\n </span>\n );\n if (keys.length === 0)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n const hidden = keys.filter((key) => missed.has(String(key))).length;\n return (\n <span data-testid={chipsId} className=\"inline-flex flex-wrap gap-1\">\n {keys.map((key) => (\n <LinkChip key={String(key)} value={key} field={chipField} onMiss={onMiss} />\n ))}\n {hidden > 0 ? (\n <span\n data-testid={tid.linkHidden(owner, name)}\n className={`${chipClassName} text-muted-foreground`}\n >\n {t('field.link.hidden', { count: hidden, defaultValue: '{{count}} not visible' })}\n </span>\n ) : null}\n </span>\n );\n}\n\ninterface ChipProps {\n readonly value: string | number;\n readonly field: NonNullable<FieldRendererProps['field']>;\n readonly onMiss: (key: string, miss: boolean) => void;\n}\n\n/**\n * One key: what the entry gate allows is read (as {@link RelationDisplay} reads it, sharing that\n * read) so that a confirmed miss is reported and drawn by the parent's count, not here. A key the\n * gate keeps unread is drawn as {@link RelationDisplay} draws it.\n */\nfunction LinkChip({ value, field, onMiss }: ChipProps): React.ReactElement | null {\n const gate = useEntryGate();\n const meta = field.meta as { readonly to?: ResourceRefInput } | undefined;\n let to: string | undefined;\n try {\n to = meta?.to === undefined ? undefined : resourceKey(meta.to);\n } catch {\n to = undefined;\n }\n const answer = to === undefined ? undefined : gate(to, 'show');\n const reads =\n to !== undefined &&\n answer !== undefined &&\n answer.state !== 'undecided' &&\n answer.state !== 'hidden' &&\n answer.state !== 'disabled';\n if (!reads)\n return (\n <span className={chipClassName}>\n <RelationDisplay value={value} field={field} />\n </span>\n );\n return <ReadChip to={to as string} value={value} field={field} onMiss={onMiss} />;\n}\n\nfunction ReadChip({\n to,\n value,\n field,\n onMiss,\n}: ChipProps & { readonly to: string }): React.ReactElement | null {\n const app = useApp();\n const by = (field.meta as { readonly by?: unknown } | undefined)?.by;\n const { record, isLoading, error, ambiguous } = useRelatedRecord(\n to,\n value,\n typeof by === 'string' ? { by } : undefined,\n );\n const registered = app.registry.get(to) !== undefined;\n const miss = registered && !isLoading && !error && !ambiguous && !record;\n const key = String(value);\n useEffect(() => {\n onMiss(key, miss);\n }, [onMiss, key, miss]);\n useEffect(() => () => onMiss(key, false), [onMiss, key]);\n if (miss) return null;\n return (\n <span className={chipClassName}>\n <RelationDisplay value={value} field={field} />\n </span>\n );\n}\n\n/**\n * A to-many relation (`f.relationMany`): each key rendered as {@link RelationDisplay} renders\n * one — eager keys share the aggregator's batched read, lazy keys read nothing. A link (a field\n * `linkOf` reads a link from) is drawn by {@link LinkKeysDisplay}.\n */\nexport function RelationManyDisplay(props: FieldRendererProps): React.ReactElement {\n const app = useApp();\n // The field's declaration as the registry holds it (a base field or a type's own): the props\n // carry only its name and meta, too little to tell a link from a `meta.through` that is none.\n const owner = props.owner ?? props.resource ?? '';\n const ownerDef = owner === '' ? undefined : app.registry.get(owner);\n const declared =\n ownerDef === undefined || props.field?.name === undefined\n ? undefined\n : declaredField(ownerDef as unknown as DtoSource, props.field.name);\n // A link holds no keys of its own: its junction rows are read apart.\n if (isRecord(declared) && linkOf(declared) !== undefined) return <LinkKeysDisplay {...props} />;\n const { value, field } = props;\n const keys = Array.isArray(value) ? value : [];\n if (keys.length === 0)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n return (\n <span className=\"inline-flex flex-wrap gap-x-2\" data-testid=\"relation-many-display\">\n {keys.map((key, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a key may repeat; its position is its identity\n <RelationDisplay key={`${String(key)}:${index}`} value={key} field={field} />\n ))}\n </span>\n );\n}\n","import type { StandardSchemaV1 } from '@burojs/core';\n\ntype Meta = Readonly<Record<string, unknown>>;\ntype Issue = { readonly message: string; readonly path: readonly string[] };\n\nconst isRecord = (value: unknown): value is Meta =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\n/**\n * The `meta` a relation field's implementation reads (P7 3.3): the framework-owned keys, checked\n * at render so a misconfigured relation shows as such instead of failing deep inside the picker.\n * Other keys pass through untouched; `to` may be absent (the picker degrades with a warning, as\n * it always has) but, present, is a resource name or reference.\n */\nexport const relationMetaSchema: StandardSchemaV1<unknown, Meta> = Object.freeze({\n '~standard': Object.freeze({\n version: 1 as const,\n vendor: 'buro',\n validate(value: unknown) {\n if (!isRecord(value)) return { issues: [{ message: 'meta must be an object', path: [] }] };\n const issues: Issue[] = [];\n const { to, by, resolve, searchField, candidates, scope } = value;\n if (\n to !== undefined &&\n !(typeof to === 'string' && to.length > 0) &&\n !(isRecord(to) && (typeof to.id === 'string' || isRecord(to.ref)))\n )\n issues.push({ message: 'must be a resource name or reference', path: ['to'] });\n if (by !== undefined && (typeof by !== 'string' || by.length === 0))\n issues.push({ message: 'must be the name of a field of the target', path: ['by'] });\n if (resolve !== undefined && resolve !== 'eager' && resolve !== 'lazy')\n issues.push({ message: \"must be 'eager' or 'lazy'\", path: ['resolve'] });\n if (searchField !== undefined && typeof searchField !== 'string')\n issues.push({ message: 'must be a field name', path: ['searchField'] });\n if (candidates !== undefined && !Array.isArray(candidates))\n issues.push({ message: 'must be an array of conditions', path: ['candidates'] });\n if (scope !== undefined && scope !== 'context' && scope !== 'session' && scope !== 'none')\n issues.push({ message: \"must be 'context', 'session' or 'none'\", path: ['scope'] });\n return issues.length > 0 ? { issues } : { value };\n },\n }),\n}) as StandardSchemaV1<unknown, Meta>;\n","'use client';\nimport type * as React from 'react';\nimport { Input } from '../primitives/input.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\nexport function TextDisplay({ value, text: formatted }: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces `String(value)`.\n if (formatted !== undefined) return <span>{formatted}</span>;\n const { text, isStructured } = toDisplayText(value);\n return isStructured ? (\n <span className=\"font-mono text-xs break-all\">{text}</span>\n ) : (\n <span>{text}</span>\n );\n}\n\nexport function TextInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n minLength,\n maxLength,\n pattern,\n}: FieldInputProps): React.ReactElement {\n return (\n <Input\n name={name}\n id={id}\n type=\"text\"\n value={(value as string | undefined) ?? ''}\n onChange={(e) => onChange(e.target.value)}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n minLength={minLength}\n maxLength={maxLength}\n pattern={pattern}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n // WAI-ARIA 1.2 attribute spread — see record/record-screen.tsx for rationale.\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { Textarea } from '../primitives/textarea.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\nexport function TextareaDisplay({\n value,\n text: formatted,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // `f.json` now routes to `JsonDisplay` (see json.tsx), not here — but this\n // renderer still needs the same object-safe formatting for a plain textarea\n // field fed a structured value, which is why guarding only `TextDisplay`\n // once left «[object Object]» on every jsonb field. See toDisplayText. The surface's formatted\n // text (REF-117 §4.4) replaces it when the field declares a transform.\n const { text, isStructured } =\n formatted === undefined ? toDisplayText(value) : { text: formatted, isStructured: false };\n return (\n <pre\n className={\n isStructured\n ? 'whitespace-pre-wrap break-all font-mono text-xs'\n : 'whitespace-pre-wrap font-sans text-sm'\n }\n >\n {text}\n </pre>\n );\n}\n\n/**\n * Code / configuration display: monospace, indentation preserved, no wrapping\n * mid-token. YAML is indentation-significant, so the sans-serif proportional\n * rendering used for prose actively misleads here.\n */\nexport function CodeDisplay({\n value,\n text: formatted,\n presentation,\n testid,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const text = formatted ?? toDisplayText(value).text;\n // The <pre> stays in both modes: monospace and preserved line breaks are\n // information, not decoration. What `plain` drops is the chrome around it —\n // the fill, border and padding, all of which fight whatever container is\n // hosting the value.\n const className =\n presentation === 'plain'\n ? 'overflow-x-auto whitespace-pre font-mono text-xs leading-relaxed'\n : 'overflow-x-auto whitespace-pre rounded-md border bg-muted/40 p-3 font-mono text-xs leading-relaxed';\n return (\n <pre data-testid={testid} className={className}>\n {text}\n </pre>\n );\n}\n\n/**\n * Code / configuration input. A plain textarea for now, but monospace and\n * Tab-aware: in a normal textarea Tab moves focus, which makes indented YAML\n * impossible to type. Swapping in a real editor later is a change here only.\n */\nexport function CodeInput(props: FieldInputProps): React.ReactElement {\n return (\n <TextareaInput\n {...props}\n className=\"min-h-64 font-mono text-xs\"\n onKeyDown={(e) => {\n if (e.key !== 'Tab' || e.shiftKey) return;\n e.preventDefault();\n const el = e.currentTarget;\n const { selectionStart: start, selectionEnd: end, value: v } = el;\n props.onChange(`${v.slice(0, start)} ${v.slice(end)}`);\n // Restore the caret after React re-renders with the new value;\n // otherwise it jumps to the end on every Tab.\n requestAnimationFrame(() => el.setSelectionRange(start + 2, start + 2));\n }}\n />\n );\n}\n\nexport function TextareaInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n className,\n onKeyDown,\n minLength,\n maxLength,\n}: FieldInputProps & {\n className?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n}): React.ReactElement {\n return (\n <Textarea\n className={className}\n onKeyDown={onKeyDown}\n name={name}\n id={id}\n value={(value as string | undefined) ?? ''}\n onChange={(e) => onChange(e.target.value)}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n minLength={minLength}\n maxLength={maxLength}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","import { fieldOptionText } from '@burojs/core';\nimport {\n type CollectionDisplayProps,\n type CollectionInputProps,\n type FieldImplementation,\n type FieldImplementationLayout,\n optionFieldName,\n type ScalarDisplayProps,\n type ScalarInputProps,\n} from '@burojs/react';\nimport { type EntityRef, formatEntityRef } from '@burojs/core';\nimport { enumBindingKey, enumParamsOf, narrowEntriesOf } from '@burojs/core/internal';\nimport { useFieldMetaSources, useOptionalApp } from '@burojs/react';\nimport { type ReactElement, createElement } from 'react';\nimport { EnumBadge } from '../enum/enum-badge.js';\nimport { EnumPicker } from '../enum/enum-picker.js';\nimport { resolveEnumControl } from '../enum/resolve-enum-control.js';\nimport { isErrorIssue } from '../forms/issue-severity.js';\nimport { BooleanDisplay, BooleanInput } from './boolean.js';\nimport {\n DateDisplay,\n DateInput,\n DateTimeDisplay,\n DateTimeInput,\n TimeDisplay,\n TimeInput,\n} from './date.js';\nimport { EnumDisplay, EnumInput } from './enum.js';\nimport { FileDisplay } from './file-display.js';\nimport { FileInput } from './file.js';\nimport { JsonDisplay, JsonInput } from './json.js';\nimport { LazyRelationManyInput } from './lazy-relation-many.js';\nimport { LazyRichTextDisplay, LazyRichTextInput } from './lazy-rich-text.js';\nimport { NumberDisplay, NumberInput } from './number.js';\nimport { ObjectGroupDisplay, ObjectGroupInput } from './object-group.js';\nimport { RepeaterDisplay, RepeaterInput } from './repeater.js';\nimport type { FieldInputProps, FieldRenderer, FieldRendererProps } from './registry.js';\nimport { RelationManyDisplay } from './link-keys-display.js';\nimport { RelationDisplay } from './relation-display.js';\nimport { relationMetaSchema } from './relation-meta-schema.js';\nimport { RelationPickerInput } from './relation-picker.js';\nimport { TextDisplay, TextInput } from './text.js';\nimport { CodeDisplay, CodeInput, TextareaDisplay, TextareaInput } from './textarea.js';\n\n/**\n * Transitional adapter for the existing shadcn controls. It is deliberately\n * one-way: field consumers use the canonical React contract, while individual\n * controls can keep their small, stable prop surface during this migration.\n */\nfunction legacyField(\n props:\n | ScalarInputProps<unknown>\n | ScalarDisplayProps<unknown>\n | CollectionInputProps<unknown>\n | CollectionDisplayProps<unknown>,\n) {\n const name = optionFieldName(props.path);\n const { texts, zone } = props.field as { readonly texts?: unknown; readonly zone?: unknown };\n return Object.freeze({\n name,\n meta: props.meta as Record<string, unknown>,\n ui: props.ui as Record<string, unknown>,\n ...(texts === undefined ? {} : { texts }),\n ...(zone === undefined ? {} : { zone }),\n });\n}\n\nfunction legacyOptions(\n options: ScalarInputProps<unknown>['options'],\n field: unknown,\n): FieldRendererProps['options'] {\n if (options.length === 0) return undefined;\n return options.map((option) => {\n const value = String(option.value ?? '');\n return Object.freeze({\n value,\n // The field's `texts.options`, else the raw value.\n label: fieldOptionText(field, value) ?? value,\n ...(typeof option.meta?.icon === 'string' ? { icon: option.meta.icon } : {}),\n });\n }) as FieldRendererProps['options'];\n}\n\n/** A resource's registry key: `<namespace>:<id>`, or the bare id in the default namespace. */\nfunction registryKey(ref: EntityRef): string {\n return ref.namespace === 'default' ? ref.id : formatEntityRef(ref);\n}\n\nfunction display(renderer: FieldRenderer['Display']) {\n return function ShadcnDisplay(\n props: ScalarDisplayProps<unknown> | CollectionDisplayProps<unknown>,\n ): ReactElement {\n return createElement(renderer, {\n value: props.value,\n ...(props.text === undefined ? {} : { text: props.text }),\n multiple: props.multiple,\n field: legacyField(props),\n options: legacyOptions(props.options, props.field),\n resource: props.resource.id,\n owner: registryKey(props.resource),\n record: props.record as Record<string, unknown> | undefined,\n presentation: props.presentation,\n testid: props.testIds.display,\n });\n };\n}\n\nfunction input(renderer: FieldRenderer['Input']) {\n return function ShadcnInput(\n props: ScalarInputProps<unknown> | CollectionInputProps<unknown>,\n ): ReactElement {\n const constraints = props.field.constraints;\n const nativeConstraints =\n props.field.type === 'number'\n ? {\n ...(typeof constraints?.minimum === 'number' ? { min: constraints.minimum } : {}),\n ...(typeof constraints?.maximum === 'number' ? { max: constraints.maximum } : {}),\n }\n : props.field.type === 'string'\n ? {\n ...(typeof constraints?.minLength === 'number'\n ? { minLength: constraints.minLength }\n : {}),\n ...(typeof constraints?.maxLength === 'number'\n ? { maxLength: constraints.maxLength }\n : {}),\n ...(typeof constraints?.pattern === 'string' ? { pattern: constraints.pattern } : {}),\n }\n : {};\n return createElement(renderer, {\n name:\n props.accessibility.input ??\n (typeof props.path.at(-1) === 'string' ? String(props.path.at(-1)) : 'field'),\n id: props.accessibility.input,\n value: props.value,\n multiple: props.multiple,\n onChange: (props.onChange ?? (() => undefined)) as FieldInputProps['onChange'],\n testid: props.testIds.input,\n options: legacyOptions(props.options, props.field) as FieldInputProps['options'],\n placeholder: typeof props.ui.placeholder === 'string' ? props.ui.placeholder : undefined,\n disabled: props.disabled,\n required: props.field.required === true,\n ...nativeConstraints,\n // A `severity: 'warning' | 'info'` issue renders in its own\n // non-destructive channel (record/record-screen.tsx) — it must never mark the\n // control invalid. Only an ERROR-severity issue does.\n ariaInvalid: props.issues.some(isErrorIssue),\n ariaDescribedBy: props.accessibility.description,\n ariaErrorMessage: props.accessibility.error,\n ariaLabelledBy: props.accessibility.label,\n field: legacyField(props),\n resource: props.resource.id,\n record: props.record as Record<string, unknown> | undefined,\n values: props.form,\n relationSeeds: (props as { readonly relationSeeds?: FieldInputProps['relationSeeds'] })\n .relationSeeds,\n fixedFilters: (props as { readonly fixedFilters?: FieldInputProps['fixedFilters'] })\n .fixedFilters,\n optionSubtitle: (props as { readonly optionSubtitle?: FieldInputProps['optionSubtitle'] })\n .optionSubtitle,\n metaSources: props.metaSources,\n ...(props.baseline === undefined ? {} : { baseline: props.baseline }),\n link: (props as { readonly link?: FieldInputProps['link'] }).link,\n });\n };\n}\n\nfunction scalar(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n return Object.freeze({\n Input: input(renderer.Input) as FieldImplementation<unknown>['Input'],\n Display: display(renderer.Display) as FieldImplementation<unknown>['Display'],\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\nfunction collection(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n const ScalarInput = input(renderer.Input);\n const ScalarDisplay = display(renderer.Display);\n return Object.freeze({\n CollectionInput: (props: CollectionInputProps<unknown>) =>\n createElement(ScalarInput, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarInputProps<unknown>),\n CollectionDisplay: (props: CollectionDisplayProps<unknown>) =>\n createElement(ScalarDisplay, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarDisplayProps<unknown>),\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\n/**\n * File fields can be either a legacy scalar (one selected file) or a canonical\n * collection. Both share the same legacy control, while the resolver supplies\n * the cardinality bit that `FileInput` passes to `useFileField`.\n */\nfunction scalarOrCollection(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n const ScalarInput = input(renderer.Input);\n const ScalarDisplay = display(renderer.Display);\n return Object.freeze({\n Input: ScalarInput as FieldImplementation<unknown>['Input'],\n Display: ScalarDisplay as FieldImplementation<unknown>['Display'],\n CollectionInput: (props: CollectionInputProps<unknown>) =>\n createElement(ScalarInput, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarInputProps<unknown>),\n CollectionDisplay: (props: CollectionDisplayProps<unknown>) =>\n createElement(ScalarDisplay, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarDisplayProps<unknown>),\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\n/** The registered enum a field names: a lowered entity ref keeps its namespace (`audit:severity`). */\nfunction enumName(ui: Readonly<Record<string, unknown>>): string | undefined {\n return enumBindingKey(ui.enum);\n}\n\n/**\n * The registry branch of `enumAware()`: `EnumPicker` over the registered enum\n * `enumName`, in the control the field asks for (`ui.control`), else the one\n * the enum declares, else a select. A component of its own so the registry is\n * read through a hook at render, never at module level.\n *\n * The field is the enum's use site (REF-132 §7.2): its `meta.enumParams` and\n * `meta.narrow`, read over the owner's sources, make the picker offer only the\n * available set.\n */\nfunction RegistryEnumInput(\n props: ScalarInputProps<unknown> & { readonly enumName: string },\n): ReactElement {\n const app = useOptionalApp();\n const meta = props.field.meta;\n const sources = useFieldMetaSources({\n record: props.record,\n values: props.form,\n // The owner's projected states, handed to every input beside the canonical context.\n extra: props.metaSources,\n });\n const control = resolveEnumControl(\n props.ui.control,\n app?.registry.enums.get(props.enumName),\n `field ${typeof props.path.at(-1) === 'string' ? String(props.path.at(-1)) : props.enumName}`,\n );\n return createElement(EnumPicker, {\n enumName: props.enumName,\n control,\n value: props.value == null ? undefined : String(props.value),\n onChange: props.onChange ?? (() => undefined),\n name: props.accessibility.input,\n id: props.accessibility.input,\n testid: props.testIds.input,\n placeholder: typeof props.ui.placeholder === 'string' ? props.ui.placeholder : undefined,\n disabled: props.disabled,\n required: props.field.required === true,\n ariaInvalid: props.issues.some(isErrorIssue),\n ariaDescribedBy: props.accessibility.description,\n ariaErrorMessage: props.accessibility.error,\n ariaLabelledBy: props.accessibility.label,\n use: {\n params: enumParamsOf(meta?.enumParams),\n narrow: narrowEntriesOf(meta?.narrow),\n sources,\n mode: props.record === undefined ? 'create' : 'edit',\n // The form's starting values (seeded on a create), as the plan and the save compare.\n baseline: props.baseline ?? props.record,\n },\n });\n}\n\n/**\n * A string declaration may carry an enum resource independently of its\n * semantic format. Keep that decision inside the catalog implementation so\n * all field surfaces retain the same resolver path and adopters can override\n * it through a higher-priority explicit UI implementation.\n *\n * Three-way routing, checked in this order:\n * 1. `ui.enum` present → the REGISTRY picker/badge (`EnumPicker`/\n * `EnumBadge`), in the control `resolveEnumControl` picks.\n * 2. No registry enum, but the field declares a non-empty inline\n * `options` array (e.g. `csvFormat()`'s delimiter presets: `type:\n * 'string'` + `options`, no `ui.enum`) → the options-driven\n * `EnumInput`/`EnumDisplay` (`./enum.js`), which reads `props.options`\n * directly and needs no registry at all. This is the routing this\n * function existed to add: an inline-options field used to fall all\n * the way through to `renderer` (a plain text box) because `enumName`\n * only ever looked at `ui.enum`.\n * 3. Neither → `renderer` (the plain fallback control, e.g. `TextInput`),\n * unchanged. A plain string field with no options must keep rendering\n * a text box.\n *\n * `EnumInput`/`EnumDisplay` degrade correctly when reached via (2): with no\n * `ui.enum` and no `meta.enumNamespace`, `enumNamespaceOf` (`@burojs/core`)\n * returns `undefined`, and `resolveOptionLabel` (`@burojs/react`) reads the field's own slot\n * `fields.<name>.options.<value>` with the inline label as its default\n * rather than querying a registry namespace — no throw, no blank.\n */\nfunction enumAware(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n // `input()`/`display()` (the same adapters `scalar()` itself calls, and the\n // same pattern `collection()`/`scalarOrCollection()` above already use)\n // return the concrete component directly — no optional-field unwrapping,\n // so no non-null assertion is needed here. `layout` is deliberately not\n // threaded through: it only affects the `FieldImplementation` object\n // `scalar()` returns, never the Input/Display components themselves, and\n // `enumAware()`'s OWN return value applies `layout` once, below.\n const FallbackInput = input(renderer.Input);\n const FallbackDisplay = display(renderer.Display);\n // `en` (`EnumInput`/`EnumDisplay`) is itself the fallback the `enum` UI-type\n // registration passes as `renderer` — for that entry this is the exact same\n // component as `FallbackInput`/`FallbackDisplay` above, so routing (2)/(3)\n // below collapses to the unchanged \"always EnumInput/EnumDisplay when\n // `ui.enum` is absent\" behavior it already had. Only the `string` entry\n // (`renderer` = `text`) sees a genuinely different component here.\n const OptionedInput = input(en.Input);\n const OptionedDisplay = display(en.Display);\n return Object.freeze({\n Input: (props: ScalarInputProps<unknown>) => {\n const name = enumName(props.ui);\n if (name !== undefined) return createElement(RegistryEnumInput, { ...props, enumName: name });\n if (props.options.length > 0) return createElement(OptionedInput, props);\n return createElement(FallbackInput, props);\n },\n Display: (props: ScalarDisplayProps<unknown>) => {\n const name = enumName(props.ui);\n if (name !== undefined) {\n return createElement(EnumBadge, {\n enumName: name,\n value: props.value == null ? undefined : String(props.value),\n testid: props.testIds.display,\n presentation: props.presentation,\n });\n }\n if (props.options.length > 0) return createElement(OptionedDisplay, props);\n return createElement(FallbackDisplay, props);\n },\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\nconst text = { Display: TextDisplay, Input: TextInput };\nconst num = { Display: NumberDisplay, Input: NumberInput };\nconst bool = { Display: BooleanDisplay, Input: BooleanInput };\nconst date = { Display: DateDisplay, Input: DateInput };\nconst dateTime = { Display: DateTimeDisplay, Input: DateTimeInput };\nconst time = { Display: TimeDisplay, Input: TimeInput };\nconst en = { Display: EnumDisplay, Input: EnumInput };\nconst ta = { Display: TextareaDisplay, Input: TextareaInput };\nconst rel = { Display: RelationDisplay, Input: RelationPickerInput };\nconst file = { Display: FileDisplay, Input: FileInput };\n// Keep rich text behind the Vite-era lazy boundary. The canonical adapters\n// still supply its legacy control contract, while the TipTap implementation\n// remains out of the initial bundle.\nconst rich = { Display: LazyRichTextDisplay, Input: LazyRichTextInput };\n\nconst relationMany = collection({ Display: RelationManyDisplay, Input: LazyRelationManyInput });\n\n/** Immutable, trusted shadcn implementations keyed by the compiler's UI IDs. */\nexport const shadcnFieldImplementations = Object.freeze({\n string: enumAware(text),\n text: scalar(text),\n textarea: scalar(ta, { size: 'full' }),\n code: scalar({ Display: CodeDisplay, Input: CodeInput }, { size: 'full' }),\n number: scalar(num),\n boolean: scalar(bool),\n date: scalar(date),\n dateTime: scalar(dateTime),\n 'date-time': scalar(dateTime),\n 'default:date-time': scalar(dateTime),\n time: scalar(time),\n 'default:time': scalar(time),\n enum: enumAware(en),\n json: scalar({ Display: JsonDisplay, Input: JsonInput }, { size: 'full' }),\n // A to-many relation (`type: 'array'`, `format: 'relation'`) displays each key as a relation;\n // its input is the generic array input over its items.\n // A to-many relation (`type: 'array'`, `format: 'relation'`): chips with a select over the same\n // option query as the single one. Its input loads lazily (P7 3.5).\n relation: Object.freeze({\n ...scalar(rel),\n meta: relationMetaSchema,\n ...relationMany,\n }),\n richText: scalar(rich, { size: 'full' }),\n 'rich-text': scalar(rich, { size: 'full' }),\n 'default:rich-text': scalar(rich, { size: 'full' }),\n file: scalarOrCollection(file, { size: 'full' }),\n // The chrome of a structured field (T2 5.5). The shell lays the properties and elements out and\n // hands them over as `children` and `renderElement`, so these draw only the container.\n object: Object.freeze({\n Input: ObjectGroupInput,\n Display: ObjectGroupDisplay,\n chrome: true,\n } satisfies FieldImplementation<unknown>),\n array: Object.freeze({\n CollectionInput: RepeaterInput,\n CollectionDisplay: RepeaterDisplay,\n chrome: true,\n } satisfies FieldImplementation<unknown>),\n});\n","'use client';\nimport type { FormBody, ResourceFieldMap } from '@burojs/core';\nimport { type FormValues, ScreenStateProvider, useFormController } from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport { ScreenTree } from '../screen/screen-tree.js';\n\nexport interface DeclarativeDisplayProps<F extends ResourceFieldMap = ResourceFieldMap> {\n /** The same field-def map shape `defineResource`'s `f` builder produces. */\n readonly fields: F;\n /** The values to display — this renderer owns no state of its own. */\n readonly values: FormValues;\n /**\n * Drives label i18n, the doc address and the leaf ids\n * (`<i18nPrefix>:field:<name>:hint` / `:info`). Default `'form'`.\n */\n readonly i18nPrefix?: string;\n /**\n * The display's tree, as `<DeclarativeForm body>`; absent, every field in\n * one column, in declaration order. A field under a `when` that does not\n * hold over `values` is not shown.\n */\n readonly body?: FormBody<F>;\n}\n\n/**\n * Read-only VIEW of a resource-less field map (P1b+P1c S3e): the\n * read/edit/locked distinction's \"view\" corner — **edit** is\n * `<DeclarativeForm>`, **locked** `<DeclarativeForm disabled>` (inputs,\n * disabled), **view** this (displays, never inputs). Driven by the form\n * controller in `show` mode over `values`, rendered through the same screen\n * renderer, so a field hidden by a `when` in `<DeclarativeForm>` is hidden here\n * too for the same values.\n */\nexport function DeclarativeDisplay<F extends ResourceFieldMap = ResourceFieldMap>(\n props: DeclarativeDisplayProps<F>,\n): ReactElement {\n return (\n <ScreenStateProvider>\n <DisplayBody {...(props as DeclarativeDisplayProps)} />\n </ScreenStateProvider>\n );\n}\n\nfunction DisplayBody(props: DeclarativeDisplayProps): ReactElement {\n const prefix = props.i18nPrefix ?? 'form';\n const controller = useFormController({\n fields: props.fields,\n mode: 'show',\n value: props.values,\n ...(props.body === undefined ? {} : { body: props.body }),\n ...(props.i18nPrefix === undefined ? {} : { i18nPrefix: props.i18nPrefix }),\n });\n const leafIds = useMemo(() => ({ prefix }), [prefix]);\n return (\n <ScreenTree\n region=\"form-body\"\n resource={prefix}\n mode=\"show\"\n compiled={controller.screen}\n controller={controller}\n leafIds={leafIds}\n />\n );\n}\n","'use client';\n\nimport type * as React from 'react';\nimport {\n type EnumNameOrRef,\n type EnumValue,\n enumFallbackKey,\n enumFallbackText,\n enumValueText,\n resolveContentSlot,\n resolveEnumLabel,\n} from '@burojs/core';\nimport { useApp, useEnumValues, useI18nCaps } from '@burojs/react';\nimport { enumBindingKey } from '@burojs/core/internal';\nimport { EnumBadge } from './enum-badge.js';\nimport { Icon } from '../primitives/icon.js';\n\nexport type EnumDisplayVariant = 'badge' | 'plain' | 'icon-label';\n\nexport interface EnumDisplayProps<N extends string = string> {\n /** The enum's name, checked against the registered enums, or its entity ref `{ namespace, id }`. */\n enumName: EnumNameOrRef<N>;\n value: string | null | undefined;\n /** Display variant. Defaults to 'badge'. */\n variant?: EnumDisplayVariant;\n testid?: string;\n className?: string;\n}\n\n/**\n * Render an enum value in one of three variants:\n * - `badge` (default): delegates to `<EnumBadge>`. Best for table cells.\n * - `plain`: renders just the resolved label as a `<span>`. No styling.\n * Best for show-page key/value layouts where the label sits next to a\n * field name.\n * - `icon-label`: renders the icon slot (a `data-icon` attribute consumed\n * by the adopter's icon registry) followed by the label. v1 ships the\n * attribute + label only — adopters wire their own icon component.\n *\n * Backward compat: undefined / null / empty values render an em-dash in\n * every variant. Unregistered enums fall back to raw value text (logged\n * once via console.warn, dev-only).\n */\nexport function EnumDisplay<const N extends string = string>({\n enumName: enumInput,\n value,\n variant = 'badge',\n testid,\n className,\n}: EnumDisplayProps<N>): React.ReactElement {\n const enumName = enumBindingKey(enumInput) ?? '';\n const app = useApp();\n const caps = useI18nCaps();\n const def = app.registry.enums.get(enumName);\n const { values, isLoading, error } = useEnumValues(enumName);\n const ns = (def as { i18nNamespace?: string } | undefined)?.i18nNamespace ?? enumName;\n const id = testid ?? `enum-display:${enumName}:${String(value ?? 'null')}`;\n\n if (variant === 'badge') {\n return <EnumBadge enumName={enumName} value={value} testid={testid} className={className} />;\n }\n\n if (value == null || value === '') {\n return (\n <span data-testid={`${id}:empty`} className=\"text-muted-foreground\">\n —\n </span>\n );\n }\n\n // Loader still resolving — small skeleton placeholder.\n if (isLoading) {\n return (\n <span\n data-testid={`${id}:loading`}\n className={`inline-block h-4 w-12 animate-pulse rounded bg-muted ${className ?? ''}`}\n aria-busy=\"true\"\n />\n );\n }\n\n // Loader rejected — render the raw value as plain text (graceful\n // degradation). The error message is included via `title` for inspection.\n if (error) {\n return (\n <span data-testid={`${id}:error`} className={className} title={error.message}>\n {value}\n </span>\n );\n }\n\n const entry: EnumValue | undefined = values?.find((v) => v.value === value);\n // A value the enum does not declare takes the fallback slot, as in `<EnumBadge>`.\n const label =\n entry === undefined && (def?.fallback !== undefined || enumFallbackText(def) !== undefined)\n ? (resolveContentSlot(caps, [enumFallbackKey(ns)], { default: enumFallbackText(def) }) ??\n value)\n : resolveEnumLabel(caps, ns, value, enumValueText(def, value) ?? entry?.label);\n const icon = entry?.icon;\n\n if (variant === 'icon-label') {\n return (\n <span\n data-testid={id}\n data-icon={icon}\n className={`inline-flex items-center gap-1 ${className ?? ''}`}\n >\n {icon ? <Icon name={icon} className=\"size-3.5 shrink-0 text-muted-foreground\" /> : null}\n {label}\n </span>\n );\n }\n\n // 'plain'\n return (\n <span data-testid={id} className={className}>\n {label}\n </span>\n );\n}\n","'use client';\nimport { useEffect, useRef, useState } from 'react';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Thin text-input filter bound to a TanStack column. Used for\n * `contains` / `equal` / `startswith` operators where the column\n * itself declares the operator on its `meta.filters`. The value is\n * written straight to the column's own TanStack filter state — this\n * component does not convert it to a server-side filter expression.\n *\n * Storage shape: a plain string. An empty string clears the filter\n * entirely (`column.setFilterValue(undefined)`) so the filter state\n * does not carry a noisy `field = ''` entry.\n *\n * No internal state — read/write goes through `column.getFilterValue()`\n * and `column.setFilterValue()` exclusively, matching the contract\n * shared with the other column-driven filter components.\n *\n * Testid: caller-provided via the `testid` prop. Resource-aware\n * generation is the caller's responsibility (e.g.\n * `list-filter:posts:title:input`).\n */\nexport interface DataTableTextFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n placeholder?: string;\n /** testid for the input */\n testid?: string;\n className?: string;\n}\n\nexport function DataTableTextFilter<TData, TValue>({\n column,\n placeholder,\n testid,\n className,\n}: DataTableTextFilterProps<TData, TValue>): React.ReactElement {\n const external = (column.getFilterValue() as string | undefined) ?? '';\n\n // Local text state keeps typing instant (only this input re-renders per\n // key); the commit to `column.setFilterValue` — which round-trips to the\n // URL and triggers a server refetch — is debounced so it fires once per\n // typing burst, not per keystroke. Re-syncs from the external value on\n // clear-all / saved view / deep link.\n const [text, setText] = useState(external);\n const lastPushedRef = useRef(external);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Adopt the external value ONLY when it changed from outside (clear-all /\n // saved view / deep link) — never when it's the echo of our own debounced\n // commit, which would clobber characters typed during the debounce window.\n useEffect(() => {\n if (external !== lastPushedRef.current) {\n setText(external);\n lastPushedRef.current = external;\n }\n }, [external]);\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n },\n [],\n );\n\n return (\n <Input\n type=\"text\"\n placeholder={placeholder}\n value={text}\n data-testid={testid}\n onChange={(event) => {\n const next = event.target.value;\n setText(next);\n if (timerRef.current) clearTimeout(timerRef.current);\n // Empty string clears entirely. There's no bridge to drop `''`\n // values downstream anymore (removed in 4f86a514) — this\n // component canonicalises to `undefined` itself, so\n // `column.getIsFiltered()` and `table.getState().columnFilters`\n // reflect \"no filter\" rather than \"filter present with empty\n // string\".\n timerRef.current = setTimeout(() => {\n lastPushedRef.current = next;\n column.setFilterValue(next === '' ? undefined : next);\n }, 300);\n }}\n className={cn('h-8 w-[150px] lg:w-[200px]', className)}\n />\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { DataTableFacetedFilter, type FacetedFilterOption } from './data-table-faceted-filter.js';\n\n/**\n * Thin convenience wrapper around `<DataTableFacetedFilter>` that\n * exists so callers can spell the iar-ui-style \"enum filter\"\n * vocabulary without having to know the multi-select implementation\n * detail. Future enum-specific affordances (e.g. icon-from-registry,\n * cross-resource enum source) can be added here without changing the\n * caller-visible API.\n *\n * Storage shape and testid contract are inherited from\n * `<DataTableFacetedFilter>`: an array of selected option `value`s\n * is written via `column.setFilterValue(...)`, and an empty\n * selection clears with `column.setFilterValue(undefined)` so the\n * filter bridge does not emit `{operator: 'in', value: []}` (which\n * most providers interpret as \"match nothing\").\n */\nexport type { FacetedFilterOption } from './data-table-faceted-filter.js';\n\nexport interface DataTableEnumFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n title: string;\n options: FacetedFilterOption[];\n /**\n * Resource-agnostic testid generator. Roles:\n * 'trigger' → the popover trigger button\n * 'search' → the cmdk search input\n * 'option' → option item (value passed as second arg)\n * 'clear' → the Clear-filters footer item\n */\n getTestId?: (\n role: 'trigger' | 'option' | 'clear' | 'search',\n value?: string,\n ) => string | undefined;\n className?: string;\n}\n\nexport function DataTableEnumFilter<TData, TValue>({\n column,\n title,\n options,\n getTestId,\n className,\n}: DataTableEnumFilterProps<TData, TValue>): React.ReactElement {\n return (\n <DataTableFacetedFilter\n column={column}\n title={title}\n options={options}\n getTestId={getTestId}\n className={className}\n />\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Pair of number inputs for a numeric range filter. Writes the column\n * filter value as a `[min?, max?]` tuple — either entry can be\n * `undefined`. When BOTH ends are empty the filter is cleared entirely\n * (`column.setFilterValue(undefined)`) so no caller reading\n * `column.getFilterValue()` sees a `between` filter with no bounds.\n *\n * The storage shape is intentionally a tuple (not `{min, max}`) to match\n * `FilterOperator`'s `between` value convention (`@burojs/core`) and so\n * the column can declare `meta.filters: [{operators: ['between']}]`\n * without an extra unwrap step for callers reading the tuple straight off\n * `column.getFilterValue()`.\n *\n * Number parsing: empty string → `undefined`. `Number(value)` is\n * used otherwise; `NaN` is treated as `undefined` so a partially\n * typed `'-'` does not clobber the other end of the range with a\n * spurious value.\n *\n * Testids: caller-provided via `getTestId(role)` where role is\n * `'min' | 'max'`. Resource-aware generation is the caller's\n * responsibility.\n */\nexport interface DataTableNumRangeFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n minPlaceholder?: string;\n maxPlaceholder?: string;\n /** Resource-aware testid generator. Roles: 'min' | 'max'. */\n getTestId?: (role: 'min' | 'max') => string | undefined;\n className?: string;\n}\n\ntype NumRange = [number | undefined, number | undefined];\n\nfunction readRange(value: unknown): NumRange {\n if (Array.isArray(value)) {\n const [a, b] = value;\n return [normalize(a), normalize(b)];\n }\n return [undefined, undefined];\n}\n\nfunction normalize(v: unknown): number | undefined {\n if (v === undefined || v === null || v === '') return undefined;\n const n = typeof v === 'number' ? v : Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\nfunction parseInput(raw: string): number | undefined {\n if (raw === '') return undefined;\n const n = Number(raw);\n return Number.isFinite(n) ? n : undefined;\n}\n\nexport function DataTableNumRangeFilter<TData, TValue>({\n column,\n minPlaceholder,\n maxPlaceholder,\n getTestId,\n className,\n}: DataTableNumRangeFilterProps<TData, TValue>): React.ReactElement {\n const [minVal, maxVal] = readRange(column.getFilterValue());\n\n const commit = (next: NumRange) => {\n if (next[0] === undefined && next[1] === undefined) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue(next);\n };\n\n return (\n <div className={cn('flex gap-2', className)}>\n <Input\n type=\"number\"\n placeholder={minPlaceholder}\n value={minVal ?? ''}\n data-testid={getTestId?.('min')}\n onChange={(event) => commit([parseInput(event.target.value), maxVal])}\n className=\"h-8 w-[100px]\"\n />\n <Input\n type=\"number\"\n placeholder={maxPlaceholder}\n value={maxVal ?? ''}\n data-testid={getTestId?.('max')}\n onChange={(event) => commit([minVal, parseInput(event.target.value)])}\n className=\"h-8 w-[100px]\"\n />\n </div>\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Pair of `<input type=\"date\">` controls for a date-range filter.\n * Writes the column filter value as a `[isoStart?, isoEnd?]` tuple\n * of ISO 8601 `yyyy-mm-dd` strings — either entry can be\n * `undefined`. When BOTH ends are empty the filter is cleared\n * entirely (`column.setFilterValue(undefined)`).\n *\n * We deliberately ship the native browser date control rather than a\n * Calendar-Popover so this component depends only on existing\n * primitives. Stage-2 polish can swap to a richer picker without\n * changing the storage shape — adopters keep `[isoStart?, isoEnd?]`\n * either way.\n *\n * Testids: caller-provided via `getTestId(role)` where role is\n * `'from' | 'to'`.\n */\nexport interface DataTableDateRangeFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n fromPlaceholder?: string;\n toPlaceholder?: string;\n /** Resource-aware testid generator. Roles: 'from' | 'to'. */\n getTestId?: (role: 'from' | 'to') => string | undefined;\n className?: string;\n}\n\ntype DateRange = [string | undefined, string | undefined];\n\nfunction readRange(value: unknown): DateRange {\n if (Array.isArray(value)) {\n const [a, b] = value;\n return [normalize(a), normalize(b)];\n }\n return [undefined, undefined];\n}\n\nfunction normalize(v: unknown): string | undefined {\n if (v === undefined || v === null || v === '') return undefined;\n return String(v);\n}\n\nexport function DataTableDateRangeFilter<TData, TValue>({\n column,\n fromPlaceholder,\n toPlaceholder,\n getTestId,\n className,\n}: DataTableDateRangeFilterProps<TData, TValue>): React.ReactElement {\n const [fromVal, toVal] = readRange(column.getFilterValue());\n\n const commit = (next: DateRange) => {\n if (next[0] === undefined && next[1] === undefined) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue(next);\n };\n\n return (\n <div className={cn('flex gap-2', className)}>\n <Input\n type=\"date\"\n placeholder={fromPlaceholder}\n value={fromVal ?? ''}\n data-testid={getTestId?.('from')}\n onChange={(event) =>\n commit([event.target.value === '' ? undefined : event.target.value, toVal])\n }\n className=\"h-8 w-[150px]\"\n />\n <Input\n type=\"date\"\n placeholder={toPlaceholder}\n value={toVal ?? ''}\n data-testid={getTestId?.('to')}\n onChange={(event) =>\n commit([fromVal, event.target.value === '' ? undefined : event.target.value])\n }\n className=\"h-8 w-[150px]\"\n />\n </div>\n );\n}\n","'use client';\nimport { useEffect, useRef, useState } from 'react';\nimport { useChromeT } from '@burojs/react';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport { cn } from '../lib/cn.js';\nimport type { FilterOperator } from './use-buro-data-table.js';\n\n/**\n * Universal filter chip that pairs an explicit operator picker with a\n * single value input. Used for columns whose filter UI must let the\n * user choose the operator at runtime (e.g. \"id equals\" vs \"id ≥\") —\n * the more common case where the operator is fixed by the column is\n * served by `<DataTableTextFilter>` / `<DataTableNumRangeFilter>` /\n * `<DataTableDateRangeFilter>`.\n *\n * Storage shape: a `{operator, value}` object written via\n * `column.setFilterValue(...)`. When the value end is empty\n * (`undefined` / `null` / `''`) the entire filter is cleared\n * (`column.setFilterValue(undefined)`) — we never store an\n * `{operator, value: undefined}` shell that would fool\n * `column.getIsFiltered()`. Operator-only changes preserve the\n * current value when one exists.\n *\n * Bridge integration: `tanStackFiltersToBuro` natively understands\n * the `{operator, value}` shape and uses the stored per-row operator\n * (overriding `meta.filters[0].operators[0]`). Empty inner values\n * (`undefined` / `null` / `''`) are dropped by the bridge same as raw\n * empty values, so the `setFilterValue(undefined)` canonicalisation\n * above is what users see end-to-end.\n *\n * Testids: caller-provided via `getTestId(role, value?)`. Roles:\n * 'op' → the Select trigger\n * 'op-option' → an option inside the Select (operator passed as 2nd arg)\n * 'value' → the value input\n */\nexport interface DataTableOperatorFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n operators: FilterOperator[];\n defaultOperator?: FilterOperator;\n /** Determines the value input type. */\n valueKind?: 'text' | 'number' | 'date';\n /** Resource-aware testid generator. */\n getTestId?: (role: 'op' | 'op-option' | 'value', value?: string) => string | undefined;\n className?: string;\n}\n\ninterface OperatorFilterState {\n operator?: FilterOperator;\n value?: unknown;\n}\n\n/**\n * English fallbacks, used only when no i18n bundle is mounted. The LIVE labels\n * come from `filters.operators.<op>` — these were previously rendered directly,\n * so a list whose primary locale is not English showed «Alias · contains» on its default screen\n * while a translated `filters.contains` sat unused in the bundle. The locale slot\n * existed; nothing was wired to it.\n */\n/** @internal The operators `filters.operators.<op>` is keyed by, with their English defaults. */\nexport const OPERATOR_LABELS: Record<FilterOperator, string> = {\n eq: 'equals',\n ne: 'not equals',\n gt: '>',\n gte: '≥',\n lt: '<',\n lte: '≤',\n in: 'in',\n nin: 'not in',\n contains: 'contains',\n ncontains: 'not contains',\n between: 'between',\n nbetween: 'not between',\n null: 'is null',\n nnull: 'is not null',\n startswith: 'starts with',\n endswith: 'ends with',\n has: 'has',\n hasAny: 'has any of',\n hasAll: 'has all of',\n hasNone: 'has none of',\n some: 'has an item where',\n};\n\n/**\n * Translate a `FilterOperator` to its caller-facing label. Exported so\n * an adopter can override per-locale via composition rather than\n * patching this file.\n */\nexport function formatOperatorLabel(\n op: FilterOperator,\n chromeT?: (key: string, opts?: { defaultValue?: string }) => string,\n): string {\n return chromeT\n ? chromeT(`filters.operators.${op}`, { defaultValue: OPERATOR_LABELS[op] })\n : OPERATOR_LABELS[op];\n}\n\n/** Hook form, for the common case of rendering inside a component. */\nexport function useOperatorLabel(): (op: FilterOperator) => string {\n const chromeT = useChromeT();\n return (op) => formatOperatorLabel(op, chromeT);\n}\n\nfunction isEmpty(v: unknown): boolean {\n return v === undefined || v === null || v === '';\n}\n\nfunction inputTypeFor(kind: 'text' | 'number' | 'date'): string {\n switch (kind) {\n case 'number':\n return 'number';\n case 'date':\n return 'date';\n default:\n return 'text';\n }\n}\n\nexport function DataTableOperatorFilter<TData, TValue>({\n column,\n operators,\n defaultOperator,\n valueKind = 'text',\n getTestId,\n className,\n}: DataTableOperatorFilterProps<TData, TValue>): React.ReactElement {\n const opLabel = useOperatorLabel();\n const stored = column.getFilterValue() as OperatorFilterState | undefined;\n const storedOperator = stored?.operator;\n const storedValue = stored?.value;\n\n // Operator + value live in LOCAL state so:\n // (a) the operator dropdown reflects the user's pick IMMEDIATELY even\n // before a value is typed — previously the pick was discarded when\n // the value was empty, so the Select snapped back to its default;\n // (b) typing in the value input is instant (only this component\n // re-renders per key); the commit to `column.setFilterValue` —\n // which round-trips to the URL and triggers a server refetch — is\n // debounced so it fires once per typing burst, not per keystroke.\n const storedValueStr =\n storedValue === undefined || storedValue === null ? '' : String(storedValue);\n\n const [op, setOp] = useState<FilterOperator | undefined>(\n storedOperator ?? defaultOperator ?? operators[0],\n );\n const [text, setText] = useState<string>(storedValueStr);\n const lastPushedRef = useRef<string>(storedValueStr);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Operator comes from a Select (no caret) — sync it freely from external\n // state (URL nav / clear-all / saved view).\n useEffect(() => {\n setOp(storedOperator ?? defaultOperator ?? operators[0]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storedOperator]);\n\n // Adopt the external VALUE only on a genuine outside change — never the\n // echo of our own debounced commit, which would otherwise clobber\n // characters typed during the debounce window (caret jumps, chars vanish\n // then reappear).\n useEffect(() => {\n if (storedValueStr !== lastPushedRef.current) {\n setText(storedValueStr);\n lastPushedRef.current = storedValueStr;\n }\n }, [storedValueStr]);\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n },\n [],\n );\n\n const commit = (nextOp: FilterOperator | undefined, rawValue: string) => {\n if (rawValue === '' || !nextOp) {\n column.setFilterValue(undefined);\n return;\n }\n const parsed: unknown =\n valueKind === 'number'\n ? (() => {\n const n = Number(rawValue);\n return Number.isFinite(n) ? n : undefined;\n })()\n : rawValue;\n if (isEmpty(parsed)) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue({ operator: nextOp, value: parsed });\n };\n\n const onOperatorChange = (next: FilterOperator) => {\n setOp(next);\n // Re-commit immediately with the new operator when a value is present.\n if (text !== '') {\n lastPushedRef.current = text;\n commit(next, text);\n }\n };\n\n const onValueChange = (raw: string) => {\n setText(raw);\n if (timerRef.current) clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => {\n lastPushedRef.current = raw;\n commit(op, raw);\n }, 300);\n };\n\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <Select value={op} onValueChange={(next) => onOperatorChange(next as FilterOperator)}>\n <SelectTrigger data-testid={getTestId?.('op')} className=\"h-8 w-[120px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {operators.map((o) => (\n <SelectItem key={o} value={o} data-testid={getTestId?.('op-option', o)}>\n {opLabel(o)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Input\n type={inputTypeFor(valueKind)}\n value={text}\n data-testid={getTestId?.('value')}\n onChange={(event) => onValueChange(event.target.value)}\n className=\"h-8 w-[150px] lg:w-[200px]\"\n />\n </div>\n );\n}\n","'use client';\nimport type { Row } from '@tanstack/react-table';\nimport { IconDots } from '@tabler/icons-react';\nimport { useState } from 'react';\nimport { useChromeT } from '@burojs/react';\nimport { Button } from '../primitives/button.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Per-row \"...\" actions menu. Functional adaptation of the canonical\n * shadcn Tasks `data-table-row-actions.tsx` using existing Popover\n * primitive (DropdownMenu primitive isn't shipped). The shadcn\n * version is hard-coded to a `task` schema; this version takes a\n * generic `actions` array so it can be plugged into any resource.\n *\n * Adopters who need richer affordances (sub-menus, radio groups,\n * keyboard shortcuts) can wrap and extend; this baseline ships the\n * menu-of-actions shape used by 99% of admin tables.\n *\n * Testids: resource-agnostic. Caller supplies `getTestId(role,\n * actionName?)` — roles 'trigger' (the \"...\" button) and 'action'\n * (per-action button, with the action's name passed as second arg).\n */\nexport interface RowActionDescriptor<TData> {\n /** Stable identifier — used for testid + React keys. */\n name: string;\n\n /** Visible label shown in the menu. */\n label: string;\n\n /** Click handler. The row's `original` record is passed in. */\n onClick: (row: TData) => void | Promise<void>;\n\n /** Marks the item as visually destructive. */\n variant?: 'default' | 'destructive';\n\n /**\n * Optional confirmation message. When provided, the action is\n * gated behind `window.confirm(message)` — accept proceeds, dismiss\n * aborts. Mirrors the existing ActionButton + BulkActionToolbar\n * confirm semantic.\n */\n confirm?: string;\n\n /** Disable the action (e.g., when prerequisites aren't met). */\n disabled?: boolean;\n}\n\nexport interface DataTableRowActionsProps<TData> {\n row: Row<TData>;\n actions: RowActionDescriptor<TData>[];\n\n /**\n * Resource-agnostic testid generator. Roles:\n * 'trigger' → the \"...\" button\n * 'action' → per-action button (action.name passed as second arg)\n */\n getTestId?: (role: 'trigger' | 'action', actionName?: string) => string | undefined;\n\n className?: string;\n}\n\nexport function DataTableRowActions<TData>({\n row,\n actions,\n getTestId,\n className,\n}: DataTableRowActionsProps<TData>): React.ReactElement | null {\n const [open, setOpen] = useState(false);\n const chromeT = useChromeT();\n if (actions.length === 0) return null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n data-testid={getTestId?.('trigger')}\n className={cn('h-8 w-8', className)}\n >\n <IconDots className=\"h-4 w-4\" aria-hidden=\"true\" />\n <span className=\"sr-only\">\n {chromeT('actions.openMenu', { defaultValue: 'Open row actions menu' })}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[180px] p-1\">\n {actions.map((action) => (\n <button\n key={action.name}\n type=\"button\"\n disabled={action.disabled}\n data-testid={getTestId?.('action', action.name)}\n onClick={async () => {\n if (action.confirm && !window.confirm(action.confirm)) return;\n setOpen(false);\n await action.onClick(row.original);\n }}\n className={cn(\n 'flex w-full items-center rounded-sm px-2 py-1.5 text-sm outline-hidden',\n 'hover:bg-accent hover:text-accent-foreground',\n 'focus-visible:bg-accent focus-visible:text-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50',\n action.variant === 'destructive' &&\n 'text-destructive hover:bg-destructive hover:text-destructive-foreground focus-visible:bg-destructive focus-visible:text-destructive-foreground',\n )}\n >\n {action.label}\n </button>\n ))}\n </PopoverContent>\n </Popover>\n );\n}\n","'use client';\nimport type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\nimport { IconX } from '@tabler/icons-react';\nimport { Button } from '../primitives/button.js';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Generic toolbar shell for `<DataTable>`. Functional adaptation of\n * the canonical shadcn Tasks `data-table-toolbar.tsx`, but with the\n * resource-specific bits (title/status/priority filters, \"Add Task\"\n * button) replaced by slots so the same component serves any\n * resource.\n *\n * Layout:\n * [Search input] [filters slot] [extra slot] [DataTableViewOptions slot]\n *\n * The Reset button auto-appears when any column filter is active —\n * `table.resetColumnFilters()` clears them all and bubbles up through\n * `useBuroDataTable`'s `columnFilters`/`onColumnFiltersChange` passthrough\n * to the caller's own state.\n *\n * Testids: caller-provided via `getTestId(role)` — roles 'search',\n * 'reset'. Resource-aware testids for filter chips and view options\n * are emitted by their own components, threaded into the slots.\n */\nexport interface DataTableToolbarProps<TData> {\n table: Table<TData>;\n\n /**\n * Column id to wire the search input to. When undefined, the\n * search input is omitted entirely. The matching column must\n * register a `filterFn` (default 'includesString' is sufficient\n * for client-side; server-side filtering is handled via the\n * `useBuroDataTable` bridge).\n */\n searchColumnId?: string;\n searchPlaceholder?: string;\n\n /** Faceted filter chips to render inside the left cluster. */\n filters?: ReactNode;\n\n /** Slot for any extra controls on the right (e.g., \"Add\" button). */\n extraActions?: ReactNode;\n\n /** Slot for the DataTableViewOptions menu (or a custom column visibility control). */\n viewOptions?: ReactNode;\n\n /** Resource-agnostic testid generator. Roles: 'search', 'reset'. */\n getTestId?: (role: 'search' | 'reset') => string | undefined;\n\n className?: string;\n}\n\nexport function DataTableToolbar<TData>({\n table,\n searchColumnId,\n searchPlaceholder = 'Search…',\n filters,\n extraActions,\n viewOptions,\n getTestId,\n className,\n}: DataTableToolbarProps<TData>): React.ReactElement {\n const isFiltered = table.getState().columnFilters.length > 0;\n const searchColumn = searchColumnId ? table.getColumn(searchColumnId) : undefined;\n\n return (\n <div className={cn('flex items-center justify-between gap-2', className)}>\n <div className=\"flex flex-1 items-center gap-2\">\n {searchColumn && (\n <Input\n type=\"search\"\n placeholder={searchPlaceholder}\n value={(searchColumn.getFilterValue() as string) ?? ''}\n onChange={(event) => searchColumn.setFilterValue(event.target.value)}\n data-testid={getTestId?.('search')}\n className=\"h-8 w-[150px] lg:w-[250px]\"\n />\n )}\n {filters}\n {isFiltered && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => table.resetColumnFilters()}\n data-testid={getTestId?.('reset')}\n className=\"h-8 px-2 lg:px-3\"\n >\n Reset\n <IconX className=\"ml-2 h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {extraActions}\n {viewOptions}\n </div>\n </div>\n );\n}\n","'use client';\nimport {\n type CustomPageDef,\n compilePageScreen,\n isScreenFailure,\n type ScreenNode,\n snapshotAppFrames,\n snapshotBlockLookup,\n snapshotFrameLookup,\n} from '@burojs/core';\nimport {\n type BlockScreenProps,\n RouteSourceContext,\n useApplicationSnapshot,\n useProjectedRecord,\n} from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport { PlannedBody } from '../layout/page-host.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { RecordState } from '../record/record-state.js';\n\n/** The value at `path` of a record, or `undefined`. */\nfunction readPath(record: Readonly<Record<string, unknown>>, path: readonly string[]): unknown {\n let current: unknown = record;\n for (const segment of path) {\n if (current === null || typeof current !== 'object') return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** `value` with every ref to `record` replaced by what the (projected) row holds there. */\nfunction bindRecord(value: unknown, record: Readonly<Record<string, unknown>>): unknown {\n if (value === null || typeof value !== 'object') return value;\n if (Array.isArray(value)) return value.map((entry) => bindRecord(entry, record));\n const object = value as Record<string, unknown>;\n if (object.kind === 'ref' && object.source === 'record' && Array.isArray(object.path))\n return readPath(record, object.path as string[]);\n return Object.fromEntries(\n Object.entries(object).map(([key, entry]) => [key, bindRecord(entry, record)]),\n );\n}\n\n/**\n * `screens.block`: a modal action's block (P7 3.16), drawn as the one placement of a page with the\n * block's own data, `requires` and mount-time validation. An item action's `ref('record', …)` is\n * bound from the clicked row **projected** by field view: a field its user may not view is never read, and\n * nothing is drawn (so nothing is read) until that is decided. The same row is the page's `record`\n * source, so a prop the action leaves unset reads its declared `default(ref('record', …))` (and\n * `ref('values', …)`, which reads the record in show) from it (#49). A resource-level or app modal has\n * no row. The overlay host owns dismissal and the navigation guard, as for every overlay (P3).\n */\nexport function BlockScreen({\n block,\n props,\n resource,\n record,\n label,\n}: BlockScreenProps): ReactElement {\n const snapshot = useApplicationSnapshot();\n const projected = useProjectedRecord(resource ?? '', record);\n const needsRow = resource !== undefined && record !== undefined;\n const ready = !needsRow || projected.status === 'ready';\n const row = projected.value;\n const compiled = useMemo(() => {\n if (!ready) return undefined;\n const bound =\n needsRow && row !== null ? (bindRecord(props, row) as Record<string, unknown>) : props;\n const node = Object.freeze({\n kind: 'place',\n key: 'content',\n block,\n ...(Object.keys(bound).length === 0 ? {} : { props: bound }),\n }) as unknown as ScreenNode;\n const page = Object.freeze({\n name: 'modal',\n path: '/',\n label: label ?? 'modal',\n body: Object.freeze([node]),\n }) as unknown as CustomPageDef;\n return compilePageScreen(page, {\n blocks: snapshotBlockLookup(snapshot),\n frames: snapshotFrameLookup(snapshot),\n appFrames: snapshotAppFrames(snapshot),\n });\n }, [ready, needsRow, row, props, block, label, snapshot]);\n if (compiled === undefined) return <Skeleton className=\"h-24 w-full\" />;\n if (isScreenFailure(compiled)) return <RecordState state=\"error\" />;\n return (\n <RouteSourceContext.Provider value={null}>\n <div data-testid=\"modal-block\" className=\"min-w-0\">\n <PlannedBody\n screen={compiled}\n name=\"modal\"\n label={label ?? ''}\n {...(needsRow && row !== null ? { record: row } : {})}\n />\n </div>\n </RouteSourceContext.Provider>\n );\n}\n","import { dtoFields, isRelationField } from '@burojs/core';\nimport type { CapabilityResolver } from '@burojs/react';\nimport { type PeekFieldSource, peekFieldDefinition, peekLeafAllowed } from './peek-filter.js';\n\nexport { type PeekFieldSource, peekFieldDefinition } from './peek-filter.js';\n\n/** How many fields a peek shows under its title (the design page's number, Q10). */\nexport const PEEK_FIELD_COUNT = 5;\n\n/** Whether a field definition (a runtime field def or a portable entry) is a relation. */\nfunction relation(field: unknown): boolean {\n if (field === null || typeof field !== 'object') return false;\n return isRelationField(field as Readonly<{ type?: unknown; format?: unknown; kind?: unknown }>);\n}\n\nconst resolveOf = (bag: unknown): unknown =>\n bag !== null && typeof bag === 'object'\n ? (bag as { readonly resolve?: unknown }).resolve\n : undefined;\n\n/**\n * Whether a relation is a lazy to-one (`meta.resolve: 'lazy'`, or `opts.resolve` on a builder\n * def): it reads nothing, its key renders as a link or the target's opener (spec 4.3), so the\n * peek's one read still holds. The same rule `checkPeekBody` applies to a declared peek body.\n */\nfunction lazyToOne(field: unknown): boolean {\n const entry = field as Readonly<Record<string, unknown>>;\n if (entry.kind === 'relationMany' || entry.type === 'array') return false;\n return (resolveOf(entry.meta) ?? resolveOf(entry.opts)) === 'lazy';\n}\n\n/**\n * The fields a peek shows (spec 4.6): `columns` (the target's `views.list.columns`) in order,\n * minus the display field, minus every field not in the record DTO (`in: ['list']` only, or not\n * declared at all), minus every `sensitive` field, minus every column the target's `column` rule\n * hides from this viewer, minus every field its viewer may not view (`fieldVisible`, decided in\n * record reach over the read row, P5 spec 3.6), minus every relation field that would need its own\n * read (an eager to-one or any to-many; a lazy to-one shows its key); the first\n * {@link PEEK_FIELD_COUNT}.\n */\nexport function peekFields(\n def: PeekFieldSource,\n columns: readonly string[],\n capabilityFor: CapabilityResolver,\n fieldVisible: (name: string) => boolean = () => true,\n): readonly string[] {\n const record = new Set(dtoFields(def, 'record'));\n const out: string[] = [];\n for (const name of columns) {\n if (out.length === PEEK_FIELD_COUNT) break;\n if (name === def.displayField || out.includes(name) || !record.has(name)) continue;\n const field = peekFieldDefinition(def, name);\n if (\n !peekLeafAllowed(def, name, capabilityFor, fieldVisible) ||\n (relation(field) && !lazyToOne(field))\n )\n continue;\n out.push(name);\n }\n return Object.freeze(out);\n}\n","'use client';\nimport {\n builtinFrames,\n type CompiledScreen,\n compiledScreenFor,\n type EntityRef,\n dtoFields,\n formatEntityRef,\n normalizeDataError,\n projectDto,\n relationAmbiguousError,\n resolveFieldLabel,\n declaredText,\n type ColumnEntry,\n columnName,\n} from '@burojs/core';\nimport {\n QUICK_ANCHOR_ATTRIBUTE,\n type CapabilityResolver,\n type FrameTranslate,\n type PeekScreenProps,\n useApp,\n useApplicationSnapshot,\n useFormController,\n useFrameImplementations,\n useFrameT,\n useCapabilityResolver,\n useFieldAccess,\n useI18nCaps,\n useList,\n useOne,\n useChromeT,\n useOptionalT,\n useProjectedRecord,\n useQuickOpener,\n useTestIds,\n useUIInstance,\n} from '@burojs/react';\nimport {\n type ComponentType,\n type ReactElement,\n Suspense,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\nimport { shadcnFrameViews } from '../frames/builtin.js';\nimport { resolveFrameView } from '../frames/resolve.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { peekLeafAllowed, peekRecord, peekRow } from './peek-filter.js';\nimport { toDisplayText } from '../fields/display-value.js';\nimport { FieldValueFrame } from '../fields/field-value-frame.js';\nimport { ResolvedFieldDisplay } from '../fields/resolved-field.js';\nimport { Button } from '../primitives/button.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { recordDisplayName } from '../resource/record-display-name.js';\nimport { useRecordSubtitle } from '../resource/use-record-subtitle.js';\nimport { technicalText } from '../lib/friendly-error.js';\nimport { PeekContext, PeekHostContext } from './peek-context.js';\nimport { type PeekFieldSource, peekFieldDefinition, peekFields } from './peek-fields.js';\nimport { focusWithoutPeek, peekAnchorOpener } from './use-peek-intent.js';\n\ntype Row = Readonly<Record<string, unknown>>;\n\n/** What a peek's read came to. */\ntype PeekRead =\n | { readonly state: 'pending' }\n | { readonly state: 'failed'; readonly retry: () => void }\n | { readonly state: 'unavailable' }\n | { readonly state: 'ambiguous' }\n | { readonly state: 'row'; readonly row: Row };\n\n/** `not-found` and `forbidden` read the same (spec 4.6); anything else can be retried. */\nfunction failure(error: unknown, retry: () => void): PeekRead {\n const { kind } = normalizeDataError(error);\n if (kind === 'not-found' || kind === 'forbidden') return { state: 'unavailable' };\n return { state: 'failed', retry };\n}\n\n/**\n * The UI kit's peek (`presentationHosts.screens.peek`, presented under `buro:peek` in a popover;\n * spec 4.6): the target's title, which opens `quick.show`, and up to five of its list columns.\n * It reads once it renders — by id, the record with the record DTO (the descriptor `quick.show`\n * reads, so a cached row renders at once and the click into `quick.show` reuses it); by a `by`\n * key, the `where <by> eq <key>` read with limit 2.\n */\nexport function PeekScreen(props: PeekScreenProps): ReactElement {\n return (\n <PeekContext.Provider value={true}>\n {props.by !== undefined ? (\n <PeekByKey target={props.target} by={props.by} />\n ) : (\n <PeekById target={props.target} id={props.id ?? ''} />\n )}\n </PeekContext.Provider>\n );\n}\n\nfunction useRecordProjection(target: string): readonly string[] | undefined {\n const app = useApp();\n const def = app.registry.get(target);\n return useMemo(() => (def === undefined ? undefined : dtoFields(def, 'record')), [def]);\n}\n\nfunction PeekById({ target, id }: { readonly target: string; readonly id: string }) {\n const projection = useRecordProjection(target);\n // A key that names no record reads nothing (Known finding 1).\n const usable = id !== '' && projection !== undefined;\n const query = useOne(target, {\n id,\n enabled: usable,\n retry: false,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n let read: PeekRead;\n // Data already there (cached, or kept while it refetches) renders at once; a background\n // refetch never blanks it (P3-42).\n if (!usable) read = { state: 'unavailable' };\n else if (result !== undefined)\n read =\n result.data !== null && typeof result.data === 'object'\n ? { state: 'row', row: result.data as Row }\n : { state: 'unavailable' };\n else if (query.error != null) read = failure(query.error, () => void query.refetch());\n else read = { state: 'pending' };\n return <PeekBody target={target} peekKey={id} read={read} />;\n}\n\nfunction PeekByKey({\n target,\n by,\n}: {\n readonly target: string;\n readonly by: { readonly field: string; readonly key: string };\n}) {\n // The lazy display's click reads the same descriptor (spec 4.5): one of them is the first read.\n const query = useList(target, {\n filter: { field: by.field, op: 'eq', value: by.key } as never,\n pagination: { kind: 'offset', page: 1, pageSize: 2 } as never,\n // The lazy display's descriptor (`relation-display.tsx`): a key read, never narrowed.\n scope: 'none',\n enabled: by.key !== '',\n retry: false,\n });\n const rows = (query.data as { readonly data?: readonly Row[] } | undefined)?.data;\n let read: PeekRead;\n if (rows !== undefined) {\n if (rows.length === 0) read = { state: 'unavailable' };\n else if (rows.length > 1) read = { state: 'ambiguous' };\n else read = { state: 'row', row: rows[0] as Row };\n } else if (query.error != null) read = failure(query.error, () => void query.refetch());\n else read = { state: 'pending' };\n useEffect(() => {\n if (read.state === 'ambiguous' && process.env.NODE_ENV !== 'production')\n console.error(`[burojs] ${technicalText(relationAmbiguousError(target, by.field, by.key))}`);\n }, [read.state, target, by.field, by.key]);\n return <PeekBody target={target} peekKey={by.key} read={read} />;\n}\n\nfunction PeekBody({\n target,\n peekKey,\n read,\n}: {\n readonly target: string;\n readonly peekKey: string;\n readonly read: PeekRead;\n}): ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const chromeT = useChromeT();\n const testid = tid.peek(target, peekKey);\n if (read.state === 'pending')\n return (\n <div data-testid={testid} aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <div data-testid={`${testid}:peek-skeleton`} className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-5 w-40\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n </div>\n </div>\n );\n if (read.state === 'failed')\n return (\n <div data-testid={testid} className=\"flex flex-col items-start gap-2 text-sm\">\n <p data-testid={`${testid}:failed`}>\n {t('peek.failed', { defaultValue: \"Couldn't load\" })}\n </p>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n data-testid={`${testid}:retry`}\n onClick={read.retry}\n >\n {chromeT('actions.retry', { defaultValue: 'Retry' })}\n </Button>\n </div>\n );\n if (read.state === 'unavailable')\n return (\n <p data-testid={testid} className=\"text-sm text-muted-foreground\">\n <span data-testid={`${testid}:unavailable`}>\n {t('peek.unavailable', { defaultValue: 'Not available' })}\n </span>\n </p>\n );\n if (read.state === 'ambiguous')\n return (\n <p data-testid={testid} className=\"text-sm text-muted-foreground\">\n <span data-testid={`${testid}:ambiguous`}>{peekKey}</span>\n </p>\n );\n return <PeekRecord target={target} testid={testid} row={read.row} />;\n}\n\n/** The id of a peeked row, by the target's id field (the DTO leaves it out). */\nfunction rowIdOf(def: { readonly data?: unknown } | undefined, row: Row): unknown {\n const idField = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n return row[typeof idField === 'string' && idField.length > 0 ? idField : 'id'];\n}\n\n/**\n * The read row in its peek: the effective peek frame (`views.quick.peek.frame` ← the app's\n * `frames.peek` ← `buro:peek`) around the declared body (planned over the one row already read,\n * filtered by {@link peekLeafAllowed}; no new read) or P3's default body (P6 3.9).\n */\nfunction PeekRecord({\n target,\n testid,\n row,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly row: Row;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(target) as\n | (PeekFieldSource & { readonly data?: unknown; readonly ref?: EntityRef })\n | undefined;\n const ref = def?.ref ?? { namespace: 'default', id: target };\n const snapshot = useApplicationSnapshot();\n const compiled = useMemo(\n () => (def === undefined ? undefined : compiledScreenFor(snapshot, ref, 'show', 'peek')),\n [snapshot, ref, def],\n );\n const screen =\n compiled === undefined || 'kind' in compiled ? undefined : (compiled as CompiledScreen);\n const declared =\n screen !== undefined && Object.values(screen.slots).some((nodes) => nodes.length > 0);\n const frameRef = screen?.frame ?? builtinFrames.peek.ref;\n const catalog = useFrameImplementations();\n const resolved = useMemo(() => resolveFrameView(frameRef, catalog, 'peek'), [frameRef, catalog]);\n const frameId = formatEntityRef(frameRef);\n const t = useFrameT(frameId);\n const capabilityFor = useCapabilityResolver(target, row, 'show');\n const idFieldValue = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField = typeof idFieldValue === 'string' && idFieldValue.length > 0 ? idFieldValue : 'id';\n const projection = useRecordProjection(target);\n const dto = useMemo(\n () =>\n projection === undefined ? row : { ...projectDto(row, projection), [idField]: row[idField] },\n [row, projection, idField],\n );\n // P5 field view in record reach over the row as read; undecided is not visible (spec 3.6.5).\n const access = useFieldAccess(target, 'record', dto);\n const fieldVisible = useCallback((name: string) => access[name]?.view === 'visible', [access]);\n const record = useMemo(\n () => peekRecord(def, dto, idField, capabilityFor, fieldVisible),\n [dto, def, idField, capabilityFor, fieldVisible],\n );\n // A peek frame's `record` prop holds only the fields the body draws (P5 spec 3.6.5).\n const frameRow = useMemo(() => {\n if (def === undefined || screen === undefined) return record;\n const drawn = new Set<string>();\n for (const node of screen.nodes)\n if (node.kind === 'field' && node.field !== undefined) drawn.add(node.field);\n return peekRow(def, dto, idField, capabilityFor, fieldVisible, drawn);\n }, [def, screen, dto, record, idField, capabilityFor, fieldVisible]);\n const host = useContext(PeekHostContext);\n const instance = useUIInstance();\n const quickOpen = useQuickOpener();\n const rowId = rowIdOf(def, row);\n const openable = rowId !== null && rowId !== undefined && rowId !== '';\n // The title click: closes the peek, then opens `quick.show` through the entry gate (undecided\n // access opens nothing).\n const open = useCallback(() => {\n if (!openable) return;\n const anchor = host?.anchor ?? null;\n const anchorOpen = peekAnchorOpener(anchor);\n instance.dismiss();\n // Focus returns to the anchor when `quick.show` closes (spec 4.12): the overlay\n // records the focused element as it opens, and this focus opens no peek.\n if (anchor?.isConnected) focusWithoutPeek(anchor);\n if (anchorOpen !== undefined) anchorOpen(target, String(rowId));\n else void quickOpen(target, String(rowId));\n }, [openable, host, instance, target, rowId, quickOpen]);\n const builtin = resolved.view === shadcnFrameViews['buro:peek'].component;\n if (!declared) {\n const body = (\n <DefaultPeekBody\n target={target}\n testid={testid}\n row={row}\n open={openable ? open : undefined}\n />\n );\n if (builtin) return body;\n const View = resolved.view;\n const slots: Record<string, ReactElement | null> = { body };\n for (const name of Object.keys(screen?.slots ?? {})) slots[name] ??= null;\n return (\n <Suspense fallback={null}>\n <View slots={slots} record={frameRow} open={open} t={t} />\n </Suspense>\n );\n }\n return (\n <DeclaredPeekBody\n target={target}\n testid={testid}\n record={record}\n frameRecord={frameRow}\n def={def}\n capabilityFor={capabilityFor}\n fieldVisible={fieldVisible}\n view={resolved.view}\n builtin={builtin}\n open={open}\n openable={openable}\n t={t}\n />\n );\n}\n\n/** A declared peek body, planned over the filtered row (`entry: 'peek'`; nothing is read). */\nfunction DeclaredPeekBody({\n target,\n testid,\n record,\n frameRecord,\n def,\n capabilityFor,\n fieldVisible,\n view: View,\n builtin,\n open,\n openable,\n t,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly record: Row;\n readonly frameRecord: Row;\n readonly def: PeekFieldSource | undefined;\n readonly capabilityFor: CapabilityResolver;\n readonly fieldVisible: (name: string) => boolean;\n // biome-ignore lint/suspicious/noExplicitAny: a peek frame view\n readonly view: ComponentType<any>;\n /** The built-in peek frame draws only `body`: the framework draws the title above it. */\n readonly builtin: boolean;\n readonly open: () => void;\n readonly openable: boolean;\n readonly t: FrameTranslate;\n}): ReactElement {\n // The popover is named by the record's title, whatever body or frame draws it (P3 4.12).\n const host = useContext(PeekHostContext);\n const title = recordDisplayName(record as Record<string, unknown>, def?.displayField);\n const subtitle = useRecordSubtitle(target)(record as Record<string, unknown>) ?? undefined;\n const setLabel = host?.setLabel;\n useEffect(() => setLabel?.(title), [setLabel, title]);\n const controller = useFormController({\n resource: target,\n mode: 'show',\n record: record as Record<string, unknown>,\n entry: 'peek',\n });\n const compiled = controller.screen;\n // A leaf of a field the peek may not show renders absent (P3-38 in custom bodies, P6-66).\n const hidden = useMemo<ReadonlySet<string>>(() => {\n const out = new Set<string>();\n for (const entry of compiled?.fields ?? [])\n if (def === undefined || !peekLeafAllowed(def, entry.name, capabilityFor, fieldVisible))\n out.add(entry.name);\n return out;\n }, [compiled, def, capabilityFor, fieldVisible]);\n const slots: Record<string, ReactElement | null> = {};\n for (const name of Object.keys(compiled?.slots ?? {})) {\n const roots = controller.plan?.slots[name] ?? [];\n slots[name] = roots.every((node) => node.state === 'absent') ? null : (\n <ScreenTree\n key={name}\n region=\"record\"\n slot={name}\n resource={target}\n mode=\"show\"\n compiled={compiled}\n controller={controller}\n hiddenFields={hidden}\n />\n );\n }\n return (\n <div data-testid={testid} className=\"flex flex-col gap-3\">\n {builtin ? (\n <PeekTitle\n testid={testid}\n title={title}\n subtitle={subtitle}\n open={openable ? open : undefined}\n />\n ) : null}\n <Suspense fallback={null}>\n <View slots={slots} record={frameRecord} open={open} t={t} />\n </Suspense>\n </div>\n );\n}\n\n/** The peek's title: a button into `quick.show` when the row can be opened, else text. */\nfunction PeekTitle({\n testid,\n title,\n subtitle,\n open,\n}: {\n readonly testid: string;\n readonly title: string;\n /** The record's declared `recordSubtitle`, drawn under the title; the peek has no default. */\n readonly subtitle: string | undefined;\n readonly open: (() => void) | undefined;\n}): ReactElement {\n const heading =\n open === undefined ? (\n <p className=\"text-sm font-semibold\">{title}</p>\n ) : (\n <PeekTitleButton testid={testid} title={title} open={open} />\n );\n if (subtitle === undefined) return heading;\n return (\n <div className=\"flex flex-col gap-0.5\">\n {heading}\n <p data-testid={`${testid}:subtitle`} className=\"text-xs text-muted-foreground\">\n {subtitle}\n </p>\n </div>\n );\n}\n\n/** The title as a button into `quick.show`. */\nfunction PeekTitleButton({\n testid,\n title,\n open,\n}: {\n readonly testid: string;\n readonly title: string;\n readonly open: () => void;\n}): ReactElement {\n return (\n <button\n type=\"button\"\n data-testid={`${testid}:title`}\n {...{ [QUICK_ANCHOR_ATTRIBUTE]: '' }}\n className=\"self-start text-left text-sm font-semibold underline-offset-4 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n event.preventDefault();\n open();\n }}\n >\n {title}\n </button>\n );\n}\n\n/**\n * P3's default peek body (spec 4.6): the title, which opens `quick.show`, and up to five of the\n * target's list columns that {@link peekFields} admits. Under a custom peek frame it is that\n * frame's `body` slot (P6 plan ruling 14).\n */\nfunction DefaultPeekBody({\n target,\n testid,\n row,\n open,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly row: Row;\n readonly open: (() => void) | undefined;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(target) as\n | (PeekFieldSource & {\n readonly data?: unknown;\n readonly views?: unknown;\n readonly ref?: EntityRef;\n })\n | undefined;\n const ref = def?.ref ?? { namespace: 'default', id: target };\n const host = useContext(PeekHostContext);\n const caps = useI18nCaps(target);\n const capabilityFor = useCapabilityResolver(target, row, 'show');\n const projection = useRecordProjection(target);\n const dtoRow = useMemo(\n () => (projection === undefined ? row : projectDto(row, projection)),\n [row, projection],\n );\n // Decided in record reach over the row as read, then projected (P5 spec 3.6): the title, the\n // fields and their values come from the projected row, never from `row`.\n const access = useFieldAccess(target, 'record', dtoRow);\n const projected = useProjectedRecord(target, dtoRow);\n const record = (projected.value ?? {}) as Row;\n const title = recordDisplayName(record as Record<string, unknown>, def?.displayField);\n const subtitleOf = useRecordSubtitle(target);\n // Called once the projected record is there, as a title hook is: never on the pending `{}`.\n const subtitle = projected.status === 'ready' ? (subtitleOf(record) ?? undefined) : undefined;\n const setLabel = host?.setLabel;\n useEffect(() => setLabel?.(title), [setLabel, title]);\n const columns = useMemo(() => {\n if (def === undefined) return [];\n const listed = (def.views as { readonly list?: { readonly columns?: readonly ColumnEntry[] } })\n ?.list?.columns;\n return peekFields(\n def,\n listed?.map(columnName) ?? Object.keys(def.fields),\n capabilityFor,\n (name) => access[name]?.view === 'visible',\n );\n }, [def, capabilityFor, access]);\n if (projected.status === 'pending')\n return (\n <div data-testid={testid} aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <div data-testid={`${testid}:peek-skeleton`} className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-5 w-40\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n </div>\n </div>\n );\n return (\n <div data-testid={testid} className=\"flex flex-col gap-3\">\n <PeekTitle testid={testid} title={title} subtitle={subtitle} open={open} />\n {columns.length === 0 ? null : (\n <dl className=\"grid gap-1.5\">\n {columns.map((name) => {\n const field = peekFieldDefinition(def!, name) as { readonly label?: string };\n const value = record[name];\n return (\n <div\n key={name}\n data-testid={`${testid}:field:${name}`}\n className=\"flex min-w-0 items-baseline gap-2 text-sm\"\n >\n <dt className=\"w-24 shrink-0 truncate text-xs text-muted-foreground\">\n {resolveFieldLabel(caps, name, declaredText('field', field, 'label'))}\n </dt>\n <dd className=\"min-w-0 break-words\">\n {/* The show page's surface, frame included (copy, overflow; REF-117 §4.13). */}\n <FieldValueFrame\n field={{ ...(field as object), name } as never}\n value={value}\n surface=\"display\"\n >\n <ResolvedFieldDisplay\n resource={ref}\n name={name}\n field={field as never}\n value={value}\n record={record}\n fallback={toDisplayText(value).text}\n />\n </FieldValueFrame>\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n </div>\n );\n}\n","'use client';\nimport {\n type DispatcherEffects,\n type EntityRef,\n type RecordId,\n type RouteDescriptor,\n dtoFields,\n routeResourceKey,\n} from '@burojs/core';\nimport {\n DispatcherProvider,\n type QuickEntry,\n NO_RECORD_SCOPE_FRAMES,\n type QuickEntryValue,\n RecordScopeChain,\n RouteSourceContext,\n retryRecordRead,\n useApp,\n useDispatcherEffects,\n useEntryGate,\n useOne,\n useQuickEntry,\n useProjectedTitle,\n useUIInstance,\n useUIPresentationRuntime,\n useRouteRecordId,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { InvalidRouteId, LoadError } from '../load-error/load-error-view.js';\nimport { canonicalResourceName } from '../list-kit/list-slots.js';\nimport { useRecordVisit } from '../layout/use-record-visit.js';\nimport { RecordScreen } from '../record/record-screen.js';\nimport { RecordState } from '../record/record-state.js';\nimport { QuickScreenClaimContext } from '../record/route-screen-context.js';\n\ntype Row = Readonly<Record<string, unknown>>;\n\nconst EMPTY_ROUTE: Row = Object.freeze({});\n\n/**\n * The top entry of a quick overlay (spec 4.4, 4.10): the record route's own screen, rendered\n * in the overlay. Show and edit read the record by id with the record DTO — the descriptor the\n * record route reads, so the two share one query — and never take an opener's row.\n */\nexport function QuickBody({ entry }: { readonly entry: QuickEntry }): ReactElement {\n // The overlay renders beside the app, not inside its opener: the record scope frames the entry\n // was opened under reach its reads only through the entry.\n return (\n <RecordScopeChain frames={entry.scopeFrames ?? NO_RECORD_SCOPE_FRAMES}>\n <QuickBodyOf entry={entry} />\n </RecordScopeChain>\n );\n}\n\nfunction QuickBodyOf({ entry }: { readonly entry: QuickEntry }): ReactElement {\n if (entry.mode === 'create') return <QuickScreenOf entry={entry} route={EMPTY_ROUTE} />;\n if (entry.recordId === undefined || entry.recordId === '')\n return <RecordState state=\"not-found\" />;\n return <QuickReadRoute entry={entry} recordId={entry.recordId} />;\n}\n\n/** The entry's text id read as the resource's id field declares it; an invalid one is not-found. */\nfunction QuickReadRoute({\n entry,\n recordId,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n}): ReactElement {\n const typed = useRouteRecordId(entry.resource, recordId);\n if (typed === undefined) return <InvalidRouteId resource={entry.resource} />;\n return <QuickRead entry={entry} recordId={recordId} typedId={typed} />;\n}\n\nfunction QuickRead({\n entry,\n recordId,\n typedId,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n readonly typedId: RecordId;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(entry.resource);\n const projection = useMemo(\n () => (def === undefined ? undefined : dtoFields(def, 'record')),\n [def],\n );\n const query = useOne(entry.resource, {\n id: typedId,\n retry: retryRecordRead,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n if (result !== undefined) {\n const row = result.data;\n if (row === null || typeof row !== 'object') return <RecordState state=\"not-found\" />;\n return (\n <QuickLoaded\n entry={entry}\n recordId={recordId}\n typedId={typedId}\n row={row as Row}\n isCurrentData={!query.isPlaceholderData}\n />\n );\n }\n if (query.error != null) {\n return (\n <LoadError\n surface=\"record\"\n resource={entry.resource}\n error={query.error}\n retry={() => void query.refetch()}\n />\n );\n }\n return <RecordState state=\"loading\" />;\n}\n\n/**\n * A read record. The gate opened the entry without the row; with it, the entry's own operation\n * is re-checked (P3-44: a row-level `show` rule — an archived order, say). Anything but `open`\n * renders the not-found state and mounts no frame, so nothing the screen would read is read.\n */\nfunction QuickLoaded({\n entry,\n recordId,\n typedId,\n row,\n isCurrentData,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n readonly typedId: RecordId;\n readonly row: Row;\n readonly isCurrentData: boolean;\n}): ReactElement {\n const gate = useEntryGate();\n const quick = useQuickEntry();\n const answer = gate(entry.resource, entry.mode === 'edit' ? 'edit' : 'show', row);\n const open = answer.state === 'open';\n const title = useProjectedTitle(entry.resource, recordId, row, { placeholder: !isCurrentData });\n // The visit is recorded as the record route records it (spec 4.4 (5)), show only.\n useRecordVisit(entry.resource, open && entry.mode === 'show' ? row : null, { isCurrentData });\n const stack = quick?.stack;\n useEffect(() => {\n if (open && stack !== undefined) stack.nameTop(title);\n }, [open, stack, title]);\n const route = useMemo<Row>(() => Object.freeze({ id: recordId }), [recordId]);\n if (answer.state === 'undecided') return <RecordState state=\"loading\" />;\n if (!open) return <RecordState state=\"not-found\" />;\n return <QuickScreenOf entry={entry} route={route} recordId={typedId} />;\n}\n\n/** `name` canonical, or `null` when it names no entity. */\nfunction canonicalOrNull(name: unknown): string | null {\n try {\n if (typeof name === 'string') return canonicalResourceName(name);\n // A route's entity-ref resource (`{ namespace, id }`), as its key.\n if (name !== null && typeof name === 'object') return routeResourceKey(name as EntityRef);\n } catch {}\n return null;\n}\n\n/** What a redirect from inside the entry means for it, if anything. */\nfunction absorbedRedirect(to: RouteDescriptor, entry: QuickEntry): 'close' | 'show' | null {\n if (typeof to !== 'object' || to === null) return null;\n if (canonicalOrNull(to.resource) !== canonicalOrNull(entry.resource)) return null;\n if (to.action === 'list') return 'close';\n if (to.action !== 'show' && to.action !== 'edit') return null;\n const id = (to.params as { readonly id?: unknown } | undefined)?.id;\n return id !== undefined && id !== null && String(id) === entry.recordId ? 'show' : null;\n}\n\n/** Closes the entry: the overlay at depth 1, the top entry (Back, unguarded) deeper. */\nfunction closeEntry(quick: QuickEntryValue, dismiss: (id: string) => void): void {\n if (quick.stack.entries.length > 1) quick.stack.pop();\n else dismiss(quick.presentationId);\n}\n\n/**\n * The entry's `<RecordScreen>`, claimed as the quick entry's own and given its `route`, inside a\n * nested dispatcher scope (spec 4.4 (3)): a redirect to the entry resource's list closes the entry\n * (a Delete), one to its own record returns to show, and any other passes to the page's\n * dispatcher (a guarded navigation, after which the pathname close applies). Edit's Save and\n * Cancel return to show — Cancel asking first when the form is dirty; create's Save settles the\n * row for `useQuick().create` and closes.\n */\nfunction QuickScreenOf({\n entry,\n route,\n recordId,\n}: {\n readonly entry: QuickEntry;\n readonly route: Row;\n /** The entry's id as the id field types it (show, edit): what the screen reads and writes with. */\n readonly recordId?: RecordId;\n}): ReactElement {\n const quick = useQuickEntry();\n const instance = useUIInstance();\n const runtime = useUIPresentationRuntime();\n const parentEffects = useDispatcherEffects();\n const latest = useRef({ entry, quick });\n latest.current = { entry, quick };\n const effects = useMemo<Partial<DispatcherEffects>>(\n () => ({\n redirect: (to) => {\n const { entry: current, quick: overlay } = latest.current;\n const absorbed = overlay === null ? null : absorbedRedirect(to, current);\n // Both ask first when a form in the overlay is dirty, as the route's guarded navigation\n // would (a confirmed Delete leaves a clean show, so it closes at once).\n if (overlay !== null && absorbed === 'close') {\n overlay.scope.request(() => closeEntry(overlay, (id) => runtime.dismiss(id)));\n return;\n }\n if (overlay !== null && absorbed === 'show') {\n overlay.scope.request(() => overlay.stack.replaceTop({ ...current, mode: 'show' }));\n return;\n }\n return parentEffects().redirect?.(to);\n },\n }),\n [runtime, parentEffects],\n );\n const toShow = () => quick?.stack.replaceTop({ ...entry, mode: 'show' });\n const callbacks =\n entry.mode === 'edit'\n ? {\n onSuccess: toShow,\n onCancel: () => quick?.scope.request(toShow),\n }\n : entry.mode === 'create'\n ? {\n onSuccess: (result: unknown) => {\n quick?.stack.settle(createdRow(result));\n runtime.dismiss(instance.id);\n },\n onCancel: () => instance.dismiss(),\n }\n : {};\n return (\n <DispatcherProvider effects={effects}>\n <RouteSourceContext.Provider value={route}>\n <QuickScreenClaimContext.Provider value={true}>\n <RecordScreen\n resource={entry.resource}\n mode={entry.mode}\n {...(recordId === undefined ? {} : { recordId })}\n {...(entry.defaults === undefined ? {} : { defaults: entry.defaults })}\n {...(entry.input === undefined ? {} : { input: entry.input })}\n {...callbacks}\n />\n </QuickScreenClaimContext.Provider>\n </RouteSourceContext.Provider>\n </DispatcherProvider>\n );\n}\n\n/** The row a create's write returned, as `useQuick().create` resolves it. */\nfunction createdRow(result: unknown): Readonly<Record<string, unknown>> | null {\n if (result === null || typeof result !== 'object') return null;\n const record = (result as { readonly record?: unknown }).record;\n if (record !== null && typeof record === 'object') return record as Row;\n return result as Row;\n}\n","'use client';\nimport { hasRecordPage, resolveResourceLabel, resourceShowHref } from '@burojs/core';\nimport {\n type QuickEntry,\n useApp,\n useI18nCaps,\n useOptionalT,\n useQuickEntry,\n useTestIds,\n useUIInstance,\n} from '@burojs/react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { IconArrowLeft, IconExternalLink, IconX } from '@tabler/icons-react';\nimport { type ReactElement, useContext } from 'react';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\nimport { resolveResourceTitle } from '../resource/resource-title.js';\nimport { OwnTitleContext } from '../ui-presentations/shell.js';\n\n/** The heading of an entry: its record title once read, \"Create <label>\" for a create. */\nexport function useEntryTitle(entry: QuickEntry): string {\n const app = useApp();\n const caps = useI18nCaps(entry.resource);\n const t = useOptionalT();\n if (entry.mode !== 'create') return entry.title ?? '';\n return resolveResourceTitle(caps, t, entry.resource, 'createTitle', {\n label: resolveResourceLabel(caps, entry.resource, 'single', app.registry.get(entry.resource)),\n });\n}\n\nconst HEADING_CLASS =\n 'min-w-0 flex-1 break-words text-lg font-semibold tracking-tight focus-visible:outline-hidden';\n\n/**\n * A quick overlay's header (spec 4.1, 4.12): Back to the previous entry when the sheet's history\n * is deeper than one, the record's title as the overlay's heading (`h2`, focusable by code), \"Open\n * as page\" when the record has a show page, and ✕ — which closes through the overlay's guarded\n * `dismiss()`.\n */\nexport function QuickHeader({\n entries,\n}: {\n readonly entries: readonly QuickEntry[];\n}): ReactElement {\n const entry = useQuickEntry();\n const instance = useUIInstance();\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n const RouterLink = useLinkComponent();\n const ownTitle = useContext(OwnTitleContext);\n const top = entries[entries.length - 1] as QuickEntry;\n const previous = entries.length > 1 ? entries[entries.length - 2] : undefined;\n const title = useEntryTitle(top);\n const def = app.registry.get(top.resource);\n const pageHref =\n top.mode !== 'create' &&\n top.recordId !== undefined &&\n def !== undefined &&\n hasRecordPage(def, 'show')\n ? resourceShowHref(app.registry, def, top.resource, top.recordId)\n : null;\n const heading = (\n <h2 tabIndex={-1} data-buro-overlay-heading=\"\" className={HEADING_CLASS}>\n {title}\n </h2>\n );\n return (\n <div data-buro-region=\"quick-header\" className=\"flex items-center gap-2 pr-1\">\n {previous === undefined || entry === null ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n data-testid={tid.quickBack()}\n aria-label={t('quick.back', {\n params: { title: previous.title ?? '' },\n defaultValue: 'Back to {{title}}',\n })}\n onClick={() => entry.scope.request(() => entry.stack.pop())}\n >\n <IconArrowLeft className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n )}\n {/* Inside the kit's own shells the heading is the Radix title the overlay is labelled by;\n an app's host (not necessarily a Radix dialog) gets a plain heading. */}\n {ownTitle ? <DialogPrimitive.Title asChild>{heading}</DialogPrimitive.Title> : heading}\n {pageHref === null ? null : (\n <RouterLink\n href={pageHref}\n data-testid={tid.quickOpenPage()}\n className=\"inline-flex shrink-0 items-center gap-1 rounded px-2 py-1 text-sm text-muted-foreground hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <IconExternalLink className=\"h-4 w-4\" aria-hidden=\"true\" />\n <span>{t('quick.openAsPage', { defaultValue: 'Open as page' })}</span>\n </RouterLink>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n data-testid={tid.quickClose()}\n aria-label={t('quick.close', { defaultValue: 'Close' })}\n onClick={() => instance.dismiss()}\n >\n <IconX className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n </div>\n );\n}\n","'use client';\nimport {\n type QuickEntry,\n QuickEntryContext,\n type QuickScreenProps,\n useQuickEntryValue,\n useTestIds,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useRef, useSyncExternalStore } from 'react';\nimport { QuickBody } from './quick-body.js';\nimport { QuickHeader, useEntryTitle } from './quick-header.js';\n\n/** One identity per entry position, kept when the entry is only named (`nameTop`). */\nfunction entryKey(entry: QuickEntry, depth: number): string {\n return JSON.stringify([depth, entry.resource, entry.mode, entry.recordId ?? null]);\n}\n\n/**\n * The UI kit's quick screen (`presentationHosts.screens.quick`, presented under `buro:quick`):\n * a record's route screen in a sheet or a dialog (spec 4.1, 4.4, 4.9). It renders the header and\n * the stack's top entry — only the top is mounted; Back remounts the previous one — and provides\n * the overlay to everything inside it (`useQuickEntry`), so an opener there pushes into this sheet\n * or closes this dialog, and a form there asks through this overlay's dismiss scope.\n */\nexport function QuickScreen({ stack }: QuickScreenProps): ReactElement {\n const entries = useSyncExternalStore(stack.subscribe, stack.getSnapshot, stack.getSnapshot);\n const value = useQuickEntryValue(stack);\n const tid = useTestIds();\n const top = entries[entries.length - 1] as QuickEntry;\n const key = entryKey(top, entries.length);\n const title = useEntryTitle(top);\n // A push or Back (spec 4.12): focus moves to the new heading, and a polite live region says the\n // new title once it is known. Not on open, where the host focuses the heading itself.\n const root = useRef<HTMLDivElement>(null);\n const firstKey = useRef(key);\n // Once the history moved, every later entry (Back to the first one included) is announced.\n const moved = useRef(false);\n if (key !== firstKey.current) moved.current = true;\n const navigated = moved.current;\n // biome-ignore lint/correctness/useExhaustiveDependencies: runs on every entry change\n useEffect(() => {\n if (!moved.current) return;\n root.current?.querySelector<HTMLElement>('[data-buro-overlay-heading]')?.focus();\n }, [key]);\n return (\n <QuickEntryContext.Provider value={value}>\n <div\n ref={root}\n data-testid={tid.quickSheet(top.resource, top.recordId)}\n data-buro-quick-host={value.host}\n data-buro-quick-depth={entries.length}\n className=\"flex min-h-0 flex-1 flex-col gap-4\"\n >\n <QuickHeader entries={entries} />\n <div role=\"status\" aria-live=\"polite\" className=\"sr-only\" data-buro-quick-announce=\"\">\n {navigated ? title : ''}\n </div>\n <div className=\"-mx-1 min-h-0 flex-1 overflow-y-auto px-1\">\n <QuickBody key={key} entry={top} />\n </div>\n </div>\n </QuickEntryContext.Provider>\n );\n}\n","import { humanizeKey } from '@burojs/core';\nimport { useMemo, type ComponentType } from 'react';\nimport type { PresentationCopy } from './shell.js';\n\n/**\n * Best-effort label for a presented component when the caller didn't supply\n * `options.title`: the component's `displayName`/`name` (as assigned at its\n * declaration or, for an object-literal entry like `{ Body: () => ... }`,\n * inferred by the engine from the property key), humanized the same way a\n * missing field/resource label falls back elsewhere in the framework.\n */\nfunction componentLabel(component: ComponentType<Record<string, unknown>>): string {\n const named = component as { readonly displayName?: string; readonly name?: string };\n const humanized = humanizeKey(named.displayName ?? named.name ?? '');\n return humanized.length > 0 ? humanized : 'Presentation';\n}\n\n/**\n * Resolves presentation chrome copy directly from the descriptor's portable\n * `options` — no content-key/i18n indirection. `options.title` /\n * `options.description` win when present (and are non-empty strings);\n * otherwise the title falls back to a humanized component label and the\n * description is simply omitted.\n */\nexport function usePresentationCopy(\n options: Readonly<Record<string, unknown>>,\n component: ComponentType<Record<string, unknown>>,\n): PresentationCopy {\n return useMemo(() => {\n const title =\n typeof options.title === 'string' && options.title.length > 0\n ? options.title\n : componentLabel(component);\n const description = typeof options.description === 'string' ? options.description : undefined;\n return description === undefined\n ? Object.freeze({ title })\n : Object.freeze({ title, description });\n }, [options, component]);\n}\n\n/** Whether the shell renders its own title/description/close chrome. Defaults to true. */\nexport function wrapperEnabled(options: Readonly<Record<string, unknown>>): boolean {\n return options.wrapper !== false;\n}\n","import {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { usePresentationCopy, wrapperEnabled } from './copy.js';\nimport { DialogPresentationShell } from './shell.js';\n\n/**\n * Concrete `dialog` host for `BuroProvider`'s `presentationHosts` prop:\n * renders the already-resolved `component` (from `<UIPresentations/>`'s\n * registry lookup) inside a centered Radix dialog. Dismissal comes from the\n * `UIInstance` the framework wraps this host's subtree with, not from a\n * prop — `component`/`props`/`options` is the entire host contract.\n */\nexport function DialogPresentationHost({\n component: Component,\n props,\n options,\n}: UIPresentationHostProps): ReactElement {\n const instance = useUIInstance();\n return (\n <DialogPresentationShell\n dismiss={instance.dismiss}\n wrapper={wrapperEnabled(options)}\n ownTitle={options.ownTitle === true}\n copy={usePresentationCopy(options, Component)}\n >\n <Component {...props} />\n </DialogPresentationShell>\n );\n}\n\n/**\n * Must list exactly the keys this host actually reads, via `copy.ts`'s\n * `usePresentationCopy` (`title`, `description`), `wrapperEnabled`\n * (`wrapper`) and the shell's `ownTitle` — no more. Do not add a key here without first adding the\n * reader in `copy.ts` (or this host) that consumes it.\n */\nDialogPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n description: 'string',\n wrapper: 'boolean',\n ownTitle: 'boolean',\n}) satisfies UIPresentationOptionsSchema;\n","'use client';\nimport {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Popover, PopoverAnchor, PopoverContent } from '../primitives/popover.js';\nimport { PeekHostContext, type PeekHostValue } from '../quick/peek-context.js';\n\n/** How long the pointer may be off both the anchor and the popover before it closes. */\nexport const POPOVER_LEAVE_GRACE_MS = 150;\n\n/** The anchor's element when it is one in a document; anything else presents nothing. */\nfunction anchorElement(anchor: UIPresentationHostProps['anchor']): HTMLElement | null {\n const element = anchor?.element;\n return typeof HTMLElement !== 'undefined' && element instanceof HTMLElement ? element : null;\n}\n\n/**\n * Concrete `popover` host for `BuroProvider`'s `presentationHosts` prop (spec 4.1, 4.12): a\n * non-modal Radix popover positioned against the request's `anchor.element`. Focus stays on the\n * anchor (nothing is focused on open, nothing is restored on close); the content is a\n * `role=\"dialog\"` named by the presented screen. It closes through the guarded `dismiss()` on\n * Escape, on a pointer down outside it, when focus moves elsewhere, when the pointer has been off\n * both the anchor and the popover for {@link POPOVER_LEAVE_GRACE_MS}, and when the anchor leaves\n * the document.\n */\nexport function PopoverPresentationHost({\n component: Component,\n props,\n options,\n anchor,\n}: UIPresentationHostProps): ReactElement | null {\n const instance = useUIInstance();\n const element = anchorElement(anchor);\n const [label, setLabel] = useState(() =>\n typeof options.title === 'string' ? options.title : (element?.textContent ?? ''),\n );\n const grace = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hold = useCallback(() => {\n if (grace.current === null) return;\n clearTimeout(grace.current);\n grace.current = null;\n }, []);\n const release = useCallback(() => {\n if (grace.current !== null) return;\n grace.current = setTimeout(() => {\n grace.current = null;\n instance.dismiss();\n }, POPOVER_LEAVE_GRACE_MS);\n }, [instance]);\n useEffect(() => hold, [hold]);\n\n useEffect(() => {\n if (element === null || !element.isConnected) {\n instance.dismiss();\n return;\n }\n element.addEventListener('pointerenter', hold);\n element.addEventListener('pointerleave', release);\n // The anchor unmounted (its row re-rendered away, the page changed): the peek goes with it.\n const observer = new MutationObserver(() => {\n if (!element.isConnected) instance.dismiss();\n });\n observer.observe(element.ownerDocument, { childList: true, subtree: true });\n return () => {\n element.removeEventListener('pointerenter', hold);\n element.removeEventListener('pointerleave', release);\n observer.disconnect();\n };\n }, [element, instance, hold, release]);\n\n const virtualRef = useMemo(() => ({ current: element }), [element]);\n const host = useMemo<PeekHostValue>(() => ({ anchor: element, setLabel }), [element]);\n if (element === null) return null;\n return (\n <Popover\n open\n onOpenChange={(open) => {\n if (!open) instance.dismiss();\n }}\n >\n <PopoverAnchor virtualRef={virtualRef as { current: HTMLElement }} />\n <PopoverContent\n role=\"dialog\"\n aria-label={label}\n data-buro-popover=\"\"\n className=\"motion-reduce:animate-none motion-reduce:transition-none\"\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onPointerEnter={hold}\n onPointerLeave={release}\n >\n <PeekHostContext.Provider value={host}>\n <Component {...props} />\n </PeekHostContext.Provider>\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The one option this host reads: the popover's initial accessible name. */\nPopoverPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n}) satisfies UIPresentationOptionsSchema;\n","import {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { usePresentationCopy, wrapperEnabled } from './copy.js';\nimport { SheetPresentationShell } from './shell.js';\n\n/** Concrete `sheet` host for `BuroProvider`'s `presentationHosts` prop; see `DialogPresentationHost`. */\nexport function SheetPresentationHost({\n component: Component,\n props,\n options,\n}: UIPresentationHostProps): ReactElement {\n const instance = useUIInstance();\n return (\n <SheetPresentationShell\n dismiss={instance.dismiss}\n wrapper={wrapperEnabled(options)}\n ownTitle={options.ownTitle === true}\n copy={usePresentationCopy(options, Component)}\n >\n <Component {...props} />\n </SheetPresentationShell>\n );\n}\n\n/**\n * Must list exactly the keys this host actually reads, via `copy.ts`'s\n * `usePresentationCopy` (`title`, `description`), `wrapperEnabled`\n * (`wrapper`) and the shell's `ownTitle` — no more. Identical to `DialogPresentationHost.optionsSchema`\n * because both hosts read the same helpers; if `sheet` ever grows its own\n * option (e.g. `side`), the schema diverges then, not pre-emptively.\n */\nSheetPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n description: 'string',\n wrapper: 'boolean',\n ownTitle: 'boolean',\n}) satisfies UIPresentationOptionsSchema;\n","import type { FlowScreenProps, UIPresentationHosts } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { IconLoader2 } from '@tabler/icons-react';\nimport { OwnTitleHeading } from '../flows/overlay-heading.js';\nimport { FlowBoundary, FlowLoadFailed, loadFlowScreen, useLoaded } from '../flows/load-runtime.js';\nimport { BlockScreen } from './block-screen.js';\nimport { PeekScreen } from '../quick/peek-screen.js';\nimport { QuickScreen } from '../quick/quick-screen.js';\nimport { DialogPresentationHost } from './dialog-host.js';\nimport { PopoverPresentationHost } from './popover-host.js';\nimport { SheetPresentationHost } from './sheet-host.js';\n\n/**\n * `screens.flow`: the flow host screen, loaded when a flow first opens (plan ruling 8: only the\n * flow's button is in the initial chunk). A screen that failed to load or to render says so in\n * its host, with Retry and Close; nothing outside the host is affected (P4-C review C1).\n */\nfunction FlowScreen(props: FlowScreenProps): ReactElement | null {\n const loaded = useLoaded(loadFlowScreen);\n if (loaded.error !== undefined)\n return <FlowLoadFailed label={props.label} onRetry={loaded.retry} />;\n if (loaded.module === undefined) {\n return (\n <div data-buro-flow-step=\"loading\" aria-busy=\"true\" className=\"flex flex-col gap-4\">\n <OwnTitleHeading label={props.label} />\n <IconLoader2 className=\"h-5 w-5 animate-spin self-center\" aria-hidden=\"true\" />\n </div>\n );\n }\n const Screen = loaded.module.FlowScreen;\n return (\n <FlowBoundary\n fallback={(_error, reset) => <FlowLoadFailed label={props.label} onRetry={reset} />}\n >\n <Screen {...props} />\n </FlowBoundary>\n );\n}\n\nexport { DialogPresentationHost } from './dialog-host.js';\nexport { PopoverPresentationHost } from './popover-host.js';\nexport { SheetPresentationHost } from './sheet-host.js';\nexport { DialogPresentationShell, SheetPresentationShell, type PresentationCopy } from './shell.js';\nexport { usePresentationCopy, wrapperEnabled } from './copy.js';\n\n/**\n * Concrete dialog/sheet/popover hosts for `BuroProvider`'s `presentationHosts`\n * prop, keyed by `UIPresentationDescriptor['host']`, and the kit's overlay\n * screens (`screens.quick`: a record's quick entry; `screens.peek`: the hover\n * preview of a relation display's record; `screens.flow`: a flow's host,\n * loaded on first use). Pass this straight through:\n * `<BuroProvider presentationHosts={shadcnPresentationHosts} .../>`; an app\n * with hosts of its own keeps quick entries and flows by spreading\n * `shadcnPresentationHosts.screens` into them.\n */\nexport const shadcnPresentationHosts: UIPresentationHosts = Object.freeze({\n dialog: DialogPresentationHost,\n sheet: SheetPresentationHost,\n popover: PopoverPresentationHost,\n screens: Object.freeze({\n quick: QuickScreen,\n peek: PeekScreen,\n flow: FlowScreen,\n block: BlockScreen,\n }),\n});\n","'use client';\n\nimport * as React from 'react';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\nimport { cn } from '../lib/cn.js';\nimport { Label } from './label.js';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: ControllerProps<TFieldValues, TName>) {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\nfunction useFormField() {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n}\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nexport type FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = 'FormItem';\n\nexport type FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, FormLabelProps>(\n ({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n ref={ref}\n className={cn(error && 'text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n },\n);\nFormLabel.displayName = 'FormLabel';\n\nexport type FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<React.ElementRef<typeof Slot>, FormControlProps>(\n ({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n },\n);\nFormControl.displayName = 'FormControl';\n\nexport type FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\nFormDescription.displayName = 'FormDescription';\n\nexport type FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, FormMessageProps>(\n ({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn('text-sm font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n );\n },\n);\nFormMessage.displayName = 'FormMessage';\n\nexport {\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n useFormField,\n};\n","'use client';\n\nimport type * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\n/**\n * A determinate or INDETERMINATE progress bar.\n *\n * Hand-written rather than pulled from the shadcn registry, for one reason\n * that decides the whole component: the registry's `Progress` is a thin wrapper\n * over `@radix-ui/react-progress`, which this package does not depend on, and\n * adding a Radix dependency to render one filled `<div>` buys nothing here —\n * the primitive has no focus management, no portal, no keyboard behaviour and\n * no controlled/uncontrolled state. What it does have is the ARIA contract,\n * which is written out below rather than inherited.\n *\n * **`value === undefined` is a state, not a zero.** A run whose total is not\n * known yet (a paginated job before its first count, a stream with no length)\n * is *indeterminate*: the bar animates and reports NO `aria-valuenow` at all,\n * which is exactly what the ARIA spec asks for and what a screen reader needs\n * in order to say \"busy\" instead of \"0 percent\". Rendering it as 0% would be a\n * measurement nobody took.\n */\nexport interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** Units done. `undefined` renders an indeterminate bar. */\n readonly value?: number;\n /** Units in total. Defaults to 1, i.e. `value` is read as a fraction in `[0, 1]`. */\n readonly max?: number;\n /** Accessible name. A bar with no name is announced as an anonymous busy region. */\n readonly label?: string;\n}\n\nexport function Progress({\n value,\n max = 1,\n label,\n className,\n ...props\n}: ProgressProps): React.ReactElement {\n const determinate = value !== undefined && max > 0;\n const fraction = determinate ? Math.min(1, Math.max(0, (value as number) / max)) : undefined;\n\n return (\n <div\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={determinate ? 0 : undefined}\n aria-valuemax={determinate ? max : undefined}\n aria-valuenow={determinate ? value : undefined}\n data-state={determinate ? 'determinate' : 'indeterminate'}\n className={cn('h-2 w-full overflow-hidden rounded-full bg-secondary', className)}\n {...props}\n >\n <div\n // `transition-[width]` and not `transition-all`: the bar's own width is\n // the only thing that should ease. Under `transition-all` the colour\n // change on a terminal state eased too, which read as the bar fading\n // rather than finishing.\n className={cn(\n 'h-full rounded-full bg-primary transition-[width] duration-300 ease-out',\n !determinate && 'w-1/3 animate-pulse',\n )}\n style={determinate ? { width: `${(fraction as number) * 100}%` } : undefined}\n />\n </div>\n );\n}\n","'use client';\nimport { type TaskRunReport, taskRunFraction, taskRunOutcome } from '@burojs/core';\nimport { useOptionalT, useTestIds } from '@burojs/react';\nimport type * as React from 'react';\nimport { Progress } from '../primitives/progress.js';\n\nexport interface TaskRunPanelProps {\n /**\n * The run's own name — `'stock'`, `'import'`, `'ship-selected'`. Not a\n * resource: a long server-side operation has no record and a bulk run spans a\n * selection, so a resource-keyed id could not address either.\n */\n readonly name: string;\n readonly report: TaskRunReport;\n /** Shown above the bar. The app names the work; this component never guesses it. */\n readonly title?: string;\n readonly className?: string;\n}\n\n/**\n * WHAT AN OPERATOR SEES WHILE SOMETHING LONG IS HAPPENING, AND AFTERWARDS.\n *\n * Four things, and each of them is a fact the framework had no way to show\n * before:\n *\n * - **how far it has got** — a determinate bar when the total is known, an\n * indeterminate one when it is not (see `<Progress>` for why those are\n * different renderings rather than one with a zero in it);\n * - **which unit is in flight** — \"aggregate-items\", not a spinner;\n * - **what did not make it** — every {@link TaskRunFailure}, by subject and\n * code, whether the run carried on past it or stopped there;\n * - **that a run which stopped part-way still did part of the work** — the\n * counts stay on screen after a failure, because \"it failed\" and \"it failed\n * after doing 2 of 3\" lead to different next actions.\n *\n * `data-state` on the root is the machine-readable outcome, so a test never has\n * to match translated prose — the device `<LanguageSwitch>` already uses for\n * the active locale.\n *\n * **Nothing here knows what the work is.** No poll, no selection, no resource,\n * no operation name: the panel renders a {@link TaskRunReport} and a report is\n * produced identically by `useTaskRun` driving an RPC poll and by a loop over\n * selected rows.\n */\nexport function TaskRunPanel({\n name,\n report,\n title,\n className,\n}: TaskRunPanelProps): React.ReactElement {\n const t = useOptionalT();\n const tid = useTestIds();\n const outcome = taskRunOutcome(report);\n const fraction = taskRunFraction(report);\n\n const statusText =\n outcome === 'running'\n ? t('taskRun.running', { defaultValue: 'Running' })\n : outcome === 'complete'\n ? t('taskRun.complete', { defaultValue: 'Finished' })\n : outcome === 'partial'\n ? t('taskRun.partial', { defaultValue: 'Finished, with refusals' })\n : outcome === 'stopped'\n ? t('taskRun.stopped', { defaultValue: 'Stopped' })\n : outcome === 'cancelled'\n ? t('taskRun.cancelled', { defaultValue: 'Cancelled' })\n : t('taskRun.idle', { defaultValue: 'Not started' });\n\n return (\n <div\n data-testid={tid.taskRun(name)}\n data-state={report.state}\n data-outcome={outcome}\n // `role=\"status\"` and not `alert`: this is an ongoing report, and an\n // assertive live region would interrupt a screen-reader user on every\n // single step of a run they asked for.\n role=\"status\"\n aria-live=\"polite\"\n className={className ?? 'space-y-3 rounded-md border p-4'}\n >\n <div className=\"flex items-baseline justify-between gap-4\">\n <span className=\"text-sm font-medium\">{title ?? statusText}</span>\n <span className=\"text-sm text-muted-foreground\">\n {report.total === undefined\n ? t('taskRun.countUnknownTotal', {\n params: { completed: report.completed },\n defaultValue: '{{completed}} done',\n })\n : t('taskRun.count', {\n params: { completed: report.completed, total: report.total },\n defaultValue: '{{completed}} of {{total}}',\n })}\n </span>\n </div>\n\n <Progress\n data-testid={tid.taskRunProgress(name)}\n value={fraction === undefined ? undefined : report.completed}\n max={report.total ?? 1}\n label={title ?? statusText}\n />\n\n <div className=\"flex items-baseline justify-between gap-4 text-sm\">\n <span data-testid={`${tid.taskRun(name)}:status`}>{statusText}</span>\n {report.unit !== undefined && (\n <span className=\"text-muted-foreground\" data-testid={`${tid.taskRun(name)}:unit`}>\n {report.unit}\n </span>\n )}\n </div>\n\n {/*\n One list, both kinds. A unit refused mid-run and the failure that ended\n the run are the same thing to a reader — \"this did not happen, and here\n is which one\" — and the report keeps them apart (`failures` vs `error`)\n so a caller can act on the difference. The run-ending one is rendered\n first and marked, because it is the one that explains why the later\n units are missing entirely.\n */}\n {(report.error !== undefined || report.failures.length > 0) && (\n <ul className=\"space-y-1 text-sm\">\n {[\n ...(report.error === undefined ? [] : [{ failure: report.error, stopped: true }]),\n ...report.failures.map((failure) => ({ failure, stopped: false })),\n ].map(({ failure, stopped }) => (\n <li\n key={`${failure.subject}:${failure.code}`}\n data-testid={tid.taskRunFailure(name, failure.subject)}\n data-stopped={stopped ? 'true' : 'false'}\n className=\"text-destructive\"\n >\n <span className=\"font-medium\">{failure.subject}</span>\n {' — '}\n <span>{failure.message ?? failure.code}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n","/**\n * Canonical spacing scale used throughout the Buro playground /\n * framework UI. All spacing tokens (`p-*`, `gap-*`, `space-y-*`,\n * `mx-*`, etc.) should resolve to one of these values.\n *\n * Tailwind utility-class numbers map to pixel values via the default\n * `0.25rem`-step base:\n *\n * class | px | role\n * ------|------|--------------------------------------------------\n * 1 | 4px | xs — divider margins, micro-gaps, half-step compounds\n * 2 | 8px | sm — default button padding-y, sibling gap\n * 3 | 12px | md — list-item padding-y, dl row gap-y\n * 4 | 16px | lg — Card content gap, form field gap, page section gap\n * 6 | 24px | xl — Card padding (CardContent p-6), page section gap-y\n *\n * The framework uses {1, 2, 3, 4, 6} as the primary scale. Anything\n * else (a `gap-5`, `p-7`, `mx-9`) means a contributor diverged from\n * the system; reach for the nearest scale value or call it out\n * explicitly in a code comment.\n *\n * **Half-step tokens** — `1.5` (6px), `0.5` (2px) are acceptable\n * shadcn idioms for tight inline elements: `<Button py-1.5>`,\n * `<CommandItem py-1.5>`, divider `mx-0.5`. They preserve the\n * 4/8/12/16/24 rhythm at a finer grain inside controls.\n *\n * **Prominent vertical** — empty-state padding (`py-16` = 64px) is a\n * deliberate exception in `<ResourceList>`'s empty/error panels to\n * give the call-to-action room to breathe. Do NOT generalize this\n * scale beyond those two sites.\n *\n * Adopters can re-export their own scale on top of this module — the\n * exports are pure numbers (Tailwind class numbers), no runtime cost.\n */\nexport const spacing = {\n /** 4px — divider margins, micro-gaps. */\n xs: 1,\n /** 8px — default button padding-y, gap between buttons. */\n sm: 2,\n /** 12px — list-item padding-y, dl row gap-y. */\n md: 3,\n /** 16px — Card content gap, form field gap. */\n lg: 4,\n /** 24px — Card padding (CardContent p-6), section gap-y. */\n xl: 6,\n} as const;\n\nexport type SpacingKey = keyof typeof spacing;\n","'use client';\nimport { useLocale, useOptionalDataRuntime, useOptionalT } from '@burojs/react';\nimport { type ReactElement, type ReactNode, useMemo } from 'react';\nimport { CommandPalette } from '../layout/command-palette.js';\nimport {\n type ActionItem,\n CommandPaletteActionsGroup,\n} from '../layout/command-palette-actions-group.js';\nimport { CommandPaletteCreateGroup } from '../layout/command-palette-create-group.js';\nimport { CommandPaletteDocsGroup } from '../layout/command-palette-docs-group.js';\nimport { CommandPaletteNavigationGroups } from '../layout/command-palette-navigation-groups.js';\nimport { CommandPaletteRecentGroup } from '../layout/command-palette-recent-group.js';\nimport { CommandPaletteRecordsGroup } from '../layout/command-palette-records-group.js';\nimport { useLanguagePaletteActions } from './language-submenu.js';\nimport { useThemePaletteActions } from './theme-controls.js';\nimport { useCurrentUser } from './use-current-user.js';\n\nexport interface DefaultCommandPaletteProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Appended to the Actions group after theme, language and sign out. */\n actions?: ActionItem[];\n /** Replaces every group. The dialog, input, empty state and footer stay. */\n children?: ReactNode;\n}\n\nconst groupTestId = (role: string, id: string): string => `command-palette:${role}:${id}`;\n\n/**\n * The palette `AppShell` mounts by default: Docs, Recent, Records, Navigation, Create and\n * Actions, in that order. Records needs a data runtime and is left out without one. Actions are the theme choices, the languages (only with more than\n * one locale), \"Sign out\" (only when someone is signed in) and then `actions`.\n */\nexport function DefaultCommandPalette({\n open,\n onOpenChange,\n actions,\n children,\n}: DefaultCommandPaletteProps): ReactElement {\n const t = useOptionalT();\n const locale = useLocale();\n // Record search queries through the data runtime; without one the group is left out.\n const canSearchRecords = useOptionalDataRuntime() !== null;\n const close = (): void => onOpenChange(false);\n const themeActions = useThemePaletteActions();\n const languageActions = useLanguagePaletteActions();\n const { user, signOut } = useCurrentUser();\n const signedIn = user !== null;\n const signOutLabel = t('auth.signOut', { defaultValue: 'Sign out' });\n const allActions = useMemo<ActionItem[]>(\n () => [\n ...themeActions,\n ...languageActions,\n ...(signedIn\n ? [\n {\n id: 'sign-out',\n label: signOutLabel,\n keywords: 'sign out logout log out',\n onRun: async () => {\n await signOut();\n },\n },\n ]\n : []),\n ...(actions ?? []),\n ],\n [themeActions, languageActions, signedIn, signOutLabel, signOut, actions],\n );\n\n return (\n <CommandPalette\n open={open}\n onOpenChange={onOpenChange}\n placeholder={t('commandPalette.searchEverything', {\n defaultValue: 'Search resources, pages, records, actions…',\n })}\n getTestId={(role) => `command-palette:${role}`}\n >\n {children !== undefined ? (\n children\n ) : (\n <>\n <CommandPaletteDocsGroup locale={locale} onSelect={close} />\n {/* `refreshKey={open}`: the recent list is read at render; reopening must re-read it. */}\n <CommandPaletteRecentGroup onSelect={close} refreshKey={open} getTestId={groupTestId} />\n {/* `enabled={open}`: no per-resource search queries while the dialog is closed. */}\n {canSearchRecords ? (\n <CommandPaletteRecordsGroup enabled={open} onSelect={close} getTestId={groupTestId} />\n ) : null}\n <CommandPaletteNavigationGroups\n onSelect={close}\n getTestId={(role, id) => `command-palette:nav:${role}:${id}`}\n />\n <CommandPaletteCreateGroup onSelect={close} getTestId={groupTestId} />\n <CommandPaletteActionsGroup\n onSelect={close}\n getTestId={groupTestId}\n actions={allActions}\n />\n </>\n )}\n </CommandPalette>\n );\n}\n","'use client';\nimport { useCommandPalette } from '@burojs/react';\nimport { useGlobalShortcut } from '@burojs/react/web';\nimport { type ReactElement, type ReactNode, useMemo } from 'react';\nimport { AppHeader } from '../layout/app-header.js';\nimport { AppLayout } from '../layout/app-layout.js';\nimport { AppSidebar } from '../layout/app-sidebar.js';\nimport { NavChrome } from '../layout/nav-chrome.js';\nimport { DefaultCommandPalette } from './default-command-palette.js';\nimport {\n type PaletteState,\n type ShellBrand,\n ShellProvider,\n type ShellUserMapper,\n} from './shell-context.js';\nimport { fill, type Slot } from './slot.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppShellProps {\n /** Read by `SidebarBrand`, `AuthPage` and the document title. */\n brand: ShellBrand;\n /** Maps the auth provider's identity to what the user menu shows. Default: `defaultUserMapper`. */\n user?: ShellUserMapper;\n /** Where sign-out and \"Sign in\" go. Default `'/login'`. */\n loginPath?: string;\n /** Default `<AppSidebar />`. `false` gives a header-only layout with no sidebar trigger. */\n sidebar?: Slot;\n /** Default `<AppHeader />`. */\n header?: Slot;\n /**\n * Default `<DefaultCommandPalette />`. `false` removes the palette, the ⌘K / Ctrl+K shortcut\n * and the header's search chip. A custom element receives no props: it reads `open` and\n * `setOpen` from `usePaletteState()`.\n */\n palette?: Slot;\n /** Passed to `AppLayout`, typically `<DocPanel />`. */\n docPanel?: ReactNode;\n /**\n * Default `true`: `children` render inside `<NavChrome>`, the secondary sidebar and tabs of\n * the active navigation group chain, mounted once here so it keeps its DOM node while the\n * user moves within an area. `false` renders `children` bare, for an app that places\n * `<NavChrome>` itself (also the way to pass it `entryFilter` or `icons`).\n */\n navChrome?: boolean;\n children: ReactNode;\n}\n\n/**\n * `AppLayout` with the default sidebar, header and command palette, the area chrome\n * (`<NavChrome>`) around its children, and the brand and user context they read. Renders inside\n * `BuroProvider`, a `RouterAdapter` and a `LinkComponentProvider`; it does not boot the runtime,\n * own routes or guard auth.\n */\nexport function AppShell({\n brand,\n user,\n loginPath,\n sidebar,\n header,\n palette,\n docPanel,\n navChrome,\n children,\n}: AppShellProps): ReactElement {\n const enabled = palette !== false;\n const { open, setOpen, toggle } = useCommandPalette();\n useGlobalShortcut({ key: 'k', mod: true }, toggle, { enabled });\n const paletteState = useMemo<PaletteState>(() => ({ open, setOpen }), [open, setOpen]);\n const paletteNode = fill(palette, () => (\n <DefaultCommandPalette open={open} onOpenChange={setOpen} />\n ));\n return (\n <ShellProvider\n brand={brand}\n {...(user !== undefined ? { mapUser: user } : {})}\n {...(loginPath !== undefined ? { loginPath } : {})}\n {...(enabled ? { palette: paletteState } : {})}\n >\n <AppLayout\n sidebar={fill(sidebar, () => <AppSidebar />)}\n header={fill(header, () => <AppHeader />)}\n {...(docPanel !== undefined ? { docPanel } : {})}\n >\n {navChrome === false ? children : <NavChrome>{children}</NavChrome>}\n </AppLayout>\n {paletteNode}\n </ShellProvider>\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { IconCheck, IconLoader2, IconSelector } from '@tabler/icons-react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useState } from 'react';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../primitives/dropdown-menu.js';\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useOptionalSidebar,\n} from '../primitives/sidebar.js';\nimport { BrandTile } from './brand-tile.js';\n\nexport interface ScopeOption {\n value: string;\n label: string;\n description?: string;\n icon?: ReactNode;\n}\n\nexport interface ScopeSwitcherProps {\n options: readonly ScopeOption[];\n value: string | null;\n /** A rejection is swallowed here and leaves the value unchanged; the caller reports the error. */\n onChange: (value: string) => void | Promise<void>;\n /** Dropdown heading, e.g. \"Tenant\". */\n label?: string;\n /** Rows rendered after a separator, e.g. an \"Administration\" item. */\n extra?: ReactNode;\n /** Shown when `value` is null. */\n placeholder?: string;\n}\n\n/** A sidebar-header picker for the current tenant, workspace or other scope. */\nexport function ScopeSwitcher({\n options,\n value,\n onChange,\n label,\n extra,\n placeholder,\n}: ScopeSwitcherProps): ReactElement {\n const t = useOptionalT();\n const sidebar = useOptionalSidebar();\n const [pending, setPending] = useState(false);\n const current = options.find((o) => o.value === value);\n const text =\n current?.label ?? placeholder ?? t('shell.scopePlaceholder', { defaultValue: 'Select…' });\n // The accessible name carries the visible text too (WCAG 2.5.3, label in name), so a speech\n // user can say what they see and a screen reader announces the current scope.\n const ariaLabel = `${label ?? t('shell.scopeSwitcher', { defaultValue: 'Switch' })}: ${text}`;\n\n const select = (next: string) => {\n if (pending || next === value) return;\n setPending(true);\n void (async () => {\n try {\n await onChange(next);\n } catch {\n // The caller owns error reporting; the value stays as it was.\n } finally {\n setPending(false);\n }\n })();\n };\n\n const rowContent = (\n <>\n <BrandTile>\n {pending ? (\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n ) : (\n (current?.icon ?? Array.from(current?.label ?? '')[0]?.toUpperCase())\n )}\n </BrandTile>\n <div className=\"grid flex-1 text-left group-data-[collapsible=icon]:hidden text-sm leading-tight\">\n <span className=\"truncate font-medium\">{text}</span>\n {current?.description !== undefined && (\n <span className=\"truncate text-xs\">{current.description}</span>\n )}\n </div>\n <IconSelector className=\"ml-auto size-4\" aria-hidden=\"true\" />\n </>\n );\n\n const content = (\n <DropdownMenuContent\n data-testid=\"scope-switcher:menu\"\n className=\"w-[var(--radix-dropdown-menu-trigger-width)] min-w-56 rounded-lg\"\n side={sidebar?.isMobile === false ? 'right' : 'bottom'}\n align=\"start\"\n sideOffset={4}\n >\n {label !== undefined && <DropdownMenuLabel>{label}</DropdownMenuLabel>}\n {options.map((o) => (\n <DropdownMenuItem\n key={o.value}\n data-testid={`scope-switcher:option:${o.value}`}\n onSelect={() => select(o.value)}\n >\n {o.icon}\n <div className=\"grid flex-1 leading-tight\">\n <span className=\"truncate\">{o.label}</span>\n {o.description !== undefined && (\n <span className=\"truncate text-xs text-muted-foreground\">{o.description}</span>\n )}\n </div>\n {o.value === value && <IconCheck className=\"ml-auto size-4\" aria-hidden=\"true\" />}\n </DropdownMenuItem>\n ))}\n {extra !== undefined && extra !== null && extra !== false && (\n <>\n <DropdownMenuSeparator />\n {extra}\n </>\n )}\n </DropdownMenuContent>\n );\n\n // Outside a SidebarProvider the sidebar primitives cannot mount: same row, plain button.\n const trigger =\n sidebar === null ? (\n <button\n type=\"button\"\n data-testid=\"scope-switcher:trigger\"\n aria-label={ariaLabel}\n disabled={pending}\n className=\"flex w-full items-center gap-2 rounded-lg p-2 outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-70 data-[state=open]:bg-accent\"\n >\n {rowContent}\n </button>\n ) : (\n <SidebarMenuButton\n size=\"lg\"\n data-testid=\"scope-switcher:trigger\"\n aria-label={ariaLabel}\n disabled={pending}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {rowContent}\n </SidebarMenuButton>\n );\n\n const menu = (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n\n if (sidebar === null) return <div data-testid=\"scope-switcher\">{menu}</div>;\n return (\n <SidebarMenu data-testid=\"scope-switcher\">\n <SidebarMenuItem>{menu}</SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","// Constants\nexport const PACKAGE_NAME = '@burojs/ui-shadcn' as const;\nexport const PACKAGE_VERSION = '0.0.0' as const;\n\n// The browser's platform: `<BuroProvider platform={webPlatform()}>` without a second import.\nexport { webPlatform } from '@burojs/react/web';\n\n// Layout\nexport { DocInfo, type DocInfoProps } from './doc/doc-info.js';\nexport { DocPanel, type DocPanelProps } from './doc/doc-panel.js';\nexport { DocTrailHelp, type DocTrailHelpProps } from './doc/doc-trail-help.js';\nexport { DocBrowser, type DocBrowserProps } from './doc/doc-browser.js';\nexport {\n CommandPaletteDocsGroup,\n type CommandPaletteDocsGroupProps,\n} from './layout/command-palette-docs-group.js';\nexport { AppLayout, type AppLayoutProps } from './layout/app-layout.js';\nexport { AppSidebar, type AppSidebarProps } from './layout/app-sidebar.js';\nexport { NavMain, type NavMainProps } from './layout/nav-main.js';\nexport {\n useNavTree,\n type NavTreeEntry,\n type NavTreeLayout,\n type NavTreeSection,\n type UseNavTreeOptions,\n} from './layout/use-nav-tree.js';\nexport {\n type NavItem,\n type NavLayout,\n type NavLayoutProps,\n layoutSlot,\n useLayout,\n useLayoutResolver,\n} from './layout/nav-slots.js';\nexport { buildNavItems, type BuildNavItemsArgs } from './layout/build-nav-items.js';\nexport { SecondarySidebarLayout } from './layout/layouts/secondary-sidebar-layout.js';\nexport { TabsLayout } from './layout/layouts/tabs-layout.js';\nexport { NavChrome, type NavChromeProps } from './layout/nav-chrome.js';\nexport {\n NavAreaPage,\n ResourcePageRouter,\n type ResourcePageRouterProps,\n} from './layout/resource-page-router.js';\nexport { RecordPage, type RecordPageProps } from './layout/record-page.js';\nexport { RecordBreadcrumbs } from './layout/record-breadcrumbs.js';\nexport {\n RecordScreen,\n type RecordScreenProps,\n} from './record/record-screen.js';\nexport { CopyId, FormActions, RecordActions, RecordTitle } from './record/frame-pieces.js';\nexport { defaultNavLayouts } from './layout/default-nav-layouts.js';\nexport { ContextPicker, type ContextPickerProps } from './layout/context-picker.js';\nexport {\n ScopeDimensionPicker,\n type ScopeDimensionPickerProps,\n} from './layout/scope-dimension-picker.js';\nexport {\n THEME_CHOICES,\n THEME_STORAGE_KEY,\n useTheme,\n type ResolvedTheme,\n type ThemeChoice,\n type UseThemeResult,\n} from './layout/use-theme.js';\nexport { LanguageSwitch, type LanguageSwitchProps } from './layout/language-switch.js';\nexport {\n loadLocale,\n saveLocale,\n DEFAULT_LANGUAGE_STORAGE_KEY,\n} from './layout/language-storage.js';\nexport {\n Breadcrumbs,\n type BreadcrumbsProps,\n type PageBreadcrumbsProps,\n type ResourceBreadcrumbsProps,\n} from './layout/breadcrumbs.js';\nexport { HeaderBreadcrumbs } from './layout/header-breadcrumbs.js';\nexport {\n CommandPalette,\n type CommandPaletteProps,\n type CommandPaletteTestIdRole,\n} from './layout/command-palette.js';\nexport {\n CommandPaletteTrigger,\n type CommandPaletteTriggerProps,\n} from './layout/command-palette-trigger.js';\nexport {\n CommandPaletteNavigationGroups,\n type CommandPaletteNavigationGroupsProps,\n type CommandPaletteNavigationTestIdRole,\n} from './layout/command-palette-navigation-groups.js';\nexport {\n CommandPaletteRecentGroup,\n type CommandPaletteRecentGroupProps,\n type CommandPaletteRecentTestIdRole,\n} from './layout/command-palette-recent-group.js';\nexport {\n CommandPaletteRecordsGroup,\n type CommandPaletteRecordsGroupProps,\n type CommandPaletteRecordsTestIdRole,\n} from './layout/command-palette-records-group.js';\nexport {\n CommandPaletteActionsGroup,\n type ActionItem,\n type CommandPaletteActionsGroupProps,\n type CommandPaletteActionsTestIdRole,\n} from './layout/command-palette-actions-group.js';\nexport {\n CommandPaletteCreateGroup,\n type CommandPaletteCreateGroupProps,\n type CommandPaletteCreateTestIdRole,\n} from './layout/command-palette-create-group.js';\nexport {\n LinkComponentProvider,\n useLinkComponent,\n type LinkComponent,\n type LinkComponentProps,\n type LinkComponentProviderProps,\n} from './layout/link-component.js';\nexport { useHref, useMatch, useNavVisible } from './layout/use-nav-routing.js';\nexport { NavigationGuardDialog } from './layout/navigation-guard-dialog.js';\nexport { RefreshButton, type RefreshButtonProps } from './shell/refresh-button.js';\nexport { AppActions } from './shell/app-actions.js';\nexport { HelpButton, type HelpButtonProps } from './shell/help-button.js';\nexport { AppHeader, type AppHeaderProps } from './layout/app-header.js';\nexport {\n DocumentTitleProvider,\n useDocumentTitle,\n} from './layout/document-title.js';\n\n// Notifications\nexport { Toaster, type ToasterProps, toast } from './notification/toaster.js';\n\n// Auth\nexport { LoginForm, type LoginFormProps, type LoginCredentials } from './auth/login-form.js';\nexport { AuthPage, type AuthPageProps } from './auth/auth-page.js';\n\n// Fields\nexport { shadcnFieldImplementations } from './fields/default-renderers.js';\nexport { shadcnBlockImplementations } from './blocks/builtins.js';\nexport { TextDisplay, TextInput } from './fields/text.js';\nexport { NumberDisplay, NumberInput } from './fields/number.js';\nexport { BooleanDisplay, BooleanInput } from './fields/boolean.js';\nexport { DateDisplay, DateInput } from './fields/date.js';\nexport { EnumDisplay, EnumInput } from './fields/enum.js';\nexport { TextareaDisplay, TextareaInput } from './fields/textarea.js';\nexport {\n RelationDisplay,\n RelationField,\n relationLinkClassName,\n} from './fields/relation-display.js';\nexport { LinkKeysDisplay, RelationManyDisplay } from './fields/link-keys-display.js';\nexport {\n RelationPicker,\n RelationPickerInput,\n type RelationPickerProps,\n} from './fields/relation-picker.js';\n// The dialog is a chunk of its own: this export draws nothing until that chunk has loaded, so an\n// app that never opens one does not carry it.\nexport { LazyRelationPickerDialog as RelationPickerDialog } from './fields/lazy-relation-picker-dialog.js';\nexport type { RelationPickerDialogProps } from './fields/relation-picker-dialog.js';\n// A picker as a promise: `open()` settles with the chosen keys and rows, or why none was chosen.\nexport {\n useRelationPicker,\n type RelationPickerCancelReason,\n type RelationPickerHandle,\n type RelationPickerOpenOptions,\n type RelationPickerResult,\n type RelationPickerRow,\n type UseRelationPickerOptions,\n} from './fields/use-relation-picker.js';\n// URL-free filter state (group/search/page + the shared `composeListFilter`\n// composition) for mounting `FilterBuilder` outside a list page — e.g. a\n// custom modal. `RelationPickerDialog` is the reference consumer; nothing\n// about it is picker-specific.\nexport {\n useDialogFilterState,\n type DialogFilterState,\n type UseDialogFilterStateOptions,\n} from './fields/use-dialog-filter-state.js';\nexport { FileInput, type FileInputProps } from './fields/file.js';\nexport { FileDisplay, FileField, isImage, type FileFieldProps } from './fields/file-display.js';\n\n// Forms — public, resource-independent single-field bricks\nexport {\n Field,\n FieldDisplay,\n i18nPrefixToRef,\n type FieldProps,\n type FieldDisplayProps,\n} from './forms/field.js';\nexport {\n DeclarativeForm,\n type DeclarativeFormProps,\n type DeclarativeFormSlots,\n} from './forms/declarative-form.js';\nexport { DeclarativeDisplay, type DeclarativeDisplayProps } from './forms/declarative-display.js';\n\n// Export — self-hosted dialog (see its own docblock for why it is not\n// presented through `useUIPresent`) + the one DOM-touching download helper.\nexport { ExportDialog, type ExportDialogProps } from './export/export-dialog.js';\nexport { downloadArtifact } from './export/download.js';\nexport { ExportButton, type ExportButtonProps } from './export/export-button.js';\n// `useTrackDisplayedRun` is deliberately NOT exported: after Task 8's fix\n// round its only caller is `<ExportDialog>`, in this same package, and\n// removing a published export later would be a breaking change.\nexport { useExportRunWatcher } from './export/run-watcher.js';\n\n// Enum primitives — declarative status / type / kind columns\n// (separate namespace from the lower-level field-renderer EnumDisplay /\n// EnumInput which take a flat options array; the EnumValueDisplay variant\n// here resolves the enum from the app registry by name).\nexport { EnumBadge, type EnumBadgeProps } from './enum/enum-badge.js';\nexport {\n EnumDisplay as EnumValueDisplay,\n type EnumDisplayProps as EnumValueDisplayProps,\n type EnumDisplayVariant as EnumValueDisplayVariant,\n} from './enum/enum-display.js';\nexport {\n EnumPicker,\n ENUM_PICKER_CLEAR_SENTINEL,\n type EnumPickerProps,\n} from './enum/enum-picker.js';\n\n// Actions\nexport {\n ActionButton,\n type ActionButtonProps,\n DisabledAction,\n type DisabledActionProps,\n} from './actions/action-button.js';\nexport { ActionOverflow, type ActionOverflowProps } from './actions/action-overflow.js';\nexport { type ActionSurface, modeForSurface } from './actions/action-surface.js';\nexport { BulkActionToolbar, type BulkActionToolbarProps } from './actions/bulk-action-toolbar.js';\nexport {\n AppFlowButton,\n type AppFlowButtonProps,\n FlowActionButton,\n type FlowActionButtonProps,\n} from './flows/index.js';\n\n// Checks — the conditional-checks rule engine's one rendering surface\n// (`useCheckGate`'s dialog, `@burojs/react`). Mounted by the record frame's\n// submit gate, the DeclarativeForm submit gate, and action buttons alike.\nexport {\n CheckConfirmDialog,\n type CheckConfirmDialogProps,\n} from './checks/check-confirm-dialog.js';\n\n// Data Table (TanStack Table v8 foundation — Stage 1 of the polish loop)\nexport {\n useBuroDataTable,\n buroSortingToTanStack,\n tanStackSortingToBuro,\n resolveUpdater,\n type UseBuroDataTableOptions,\n type FilterOperator,\n} from './data-table/use-buro-data-table.js';\nexport { DataTable, type DataTableProps } from './data-table/data-table.js';\nexport {\n DataTableFacetedFilter,\n type DataTableFacetedFilterProps,\n FacetedFilterPicker,\n type FacetedFilterPickerProps,\n type FacetedFilterOption,\n} from './data-table/data-table-faceted-filter.js';\nexport {\n DataTableTextFilter,\n type DataTableTextFilterProps,\n} from './data-table/data-table-text-filter.js';\nexport {\n DataTableEnumFilter,\n type DataTableEnumFilterProps,\n} from './data-table/data-table-enum-filter.js';\nexport {\n DataTableNumRangeFilter,\n type DataTableNumRangeFilterProps,\n} from './data-table/data-table-num-range-filter.js';\nexport {\n DataTableDateRangeFilter,\n type DataTableDateRangeFilterProps,\n} from './data-table/data-table-date-range-filter.js';\nexport {\n DataTableOperatorFilter,\n formatOperatorLabel,\n type DataTableOperatorFilterProps,\n} from './data-table/data-table-operator-filter.js';\nexport {\n DataTableViewOptions,\n type DataTableViewOptionsProps,\n} from './data-table/data-table-view-options.js';\nexport {\n DataTableRowActions,\n type DataTableRowActionsProps,\n type RowActionDescriptor,\n} from './data-table/data-table-row-actions.js';\nexport {\n DataTableToolbar,\n type DataTableToolbarProps,\n} from './data-table/data-table-toolbar.js';\n\n// List kit — search input and column toggle for the list toolbar.\nexport { ListSearchInput } from './list-kit/list-search-input.js';\nexport { ColumnsToggle } from './list-kit/columns-toggle.js';\n// The route list's toolbar and rows as named pieces (P7-33): a list frame arranges them.\nexport {\n ListBody,\n ListBulkBar,\n ListColumns,\n ListControls,\n ListCreate,\n ListExport,\n ListFilters,\n ListFlows,\n ListLive,\n ListSavedViews,\n} from './list-kit/pieces/index.js';\n// The load-more footer a CURSOR-paginated list renders instead of the\n// numbered pager (Task B5.3). Provider-agnostic — see its docblock.\nexport {\n CursorLoadMore,\n type CursorLoadMoreProps,\n} from './list-kit/cursor-load-more.js';\nexport {\n ResourceListPage,\n type ResourceListPageProps,\n} from './list-kit/resource-list-page.js';\n// The filter-builder region (Task 7) — `FilterRegion` is the default\n// `list.filters.<resource>` content `<ResourceListPage>` mounts; the other\n// four are its building blocks, exported so an adopter can compose a\n// DIFFERENT layout instead of forking this file.\nexport { FilterRegion } from './list-kit/filter-builder/filter-region.js';\nexport {\n FilterBuilder,\n type FilterBuilderProps,\n} from './list-kit/filter-builder/filter-builder.js';\nexport {\n FilterPanel,\n type FilterPanelProps,\n type DraftRemovalSignal,\n} from './list-kit/filter-builder/filter-panel.js';\nexport {\n FilterBadges,\n type FilterBadgesProps,\n} from './list-kit/filter-builder/filter-badges.js';\nexport {\n PinnedFilterControls,\n type PinnedFilterControlsProps,\n} from './list-kit/filter-builder/pinned-filter-controls.js';\nexport {\n PresetFilterControls,\n type PresetFilterControlsProps,\n} from './list-kit/filter-builder/preset-filter-controls.js';\nexport {\n FilterValueControl,\n type FilterValueControlProps,\n} from './list-kit/filter-builder/values/filter-value-control.js';\n// The list override ladder (Task B3.2; level 1 added by SP0 Task 5) —\n// key-builder + resolver for the `list.cell.<resource>` /\n// `list.filters.<resource>` / `list.body.<resource>` Components-registry\n// slots `<ResourceListPage>` renders. Mirrors `layoutSlot`\n// above; `useListSlot` is exported so an app dispatcher can ask whether a\n// resource overrides a region without duplicating the key format.\n// `ListCellRenderer` is exported alongside so an adopter registering\n// `list.cell.<resource>` can type the function it hands the registry\n// (`Record<string, unknown>` slot values are otherwise unchecked).\nexport {\n listSlot,\n useListSlot,\n type ListCellRenderer,\n type ListSlot,\n type ListSlotRegion,\n} from './list-kit/list-slots.js';\n\n// Saved views\nexport {\n SavedViewsDropdown,\n type SavedViewsDropdownProps,\n} from './saved-views/saved-views-dropdown.js';\n\n// Resource views\nexport { ResourceList, type ResourceListProps } from './resource/resource-list.js';\nexport { ListErrorState, type ListErrorStateProps } from './resource/list-error-state.js';\nexport { recordDisplayName } from './resource/record-display-name.js';\nexport {\n EditPageHeader,\n PageHeader,\n type PageHeaderProps,\n ShowPageHeader,\n} from './resource/page-header.js';\nexport { CreateButton, type CreateButtonProps } from './resource/create-button.js';\nexport { useFormControl, type FormControl } from './resource/form-context.js';\n\n// UI Presentations — concrete dialog/sheet/popover hosts for the framework-mounted\n// `<UIPresentations/>` overlay stack (`BuroProvider`'s `presentationHosts`).\nexport {\n DialogPresentationHost,\n SheetPresentationHost,\n PopoverPresentationHost,\n DialogPresentationShell,\n SheetPresentationShell,\n type PresentationCopy,\n usePresentationCopy,\n wrapperEnabled,\n shadcnPresentationHosts,\n} from './ui-presentations/index.js';\n\n// Primitives (re-export common ones for convenience)\nexport * from './primitives/button.js';\nexport * from './primitives/icon.js';\nexport * from './primitives/input.js';\nexport * from './primitives/alert-dialog.js';\nexport * from './primitives/command.js';\nexport * from './primitives/dialog.js';\nexport * from './primitives/card.js';\nexport * from './primitives/table.js';\nexport * from './primitives/form.js';\nexport * from './primitives/select.js';\nexport * from './primitives/popover.js';\nexport * from './primitives/checkbox.js';\nexport * from './primitives/textarea.js';\nexport * from './primitives/badge.js';\nexport * from './primitives/sheet.js';\nexport * from './primitives/label.js';\nexport * from './primitives/tabs.js';\nexport * from './primitives/dropdown-menu.js';\nexport * from './primitives/avatar.js';\nexport * from './primitives/tooltip.js';\nexport * from './primitives/separator.js';\nexport * from './primitives/collapsible.js';\nexport * from './primitives/skeleton.js';\nexport * from './primitives/sidebar.js';\nexport * from './primitives/progress.js';\n\n// Progress + partial failure for work long enough to watch. Renders\n// `@burojs/core`'s `TaskRunReport`, which knows nothing about how the work is\n// driven — a polled server-side run and a loop over a selection produce the\n// same report.\nexport * from './tasks/task-run-panel.js';\n\n// Utils\nexport { cn } from './lib/cn.js';\nexport { useIsMobile } from './lib/use-mobile.js';\nexport { spacing, type SpacingKey } from './lib/spacing.js';\nexport { typography, type TypographyKey } from './lib/typography.js';\nexport {\n ShellProvider,\n useShell,\n usePaletteState,\n defaultUserMapper,\n type PaletteState,\n type ShellBrand,\n type ShellUser,\n type ShellUserMapper,\n type ShellContextValue,\n type ShellProviderProps,\n} from './shell/shell-context.js';\nexport { useCurrentUser } from './shell/use-current-user.js';\nexport { SidebarBrand } from './shell/sidebar-brand.js';\nexport { BrandMark } from './shell/brand-mark.js';\nexport { resolveNavIcon, useNavIcon } from './shell/use-nav-icon.js';\nexport { AppShell, type AppShellProps } from './shell/app-shell.js';\nexport {\n DefaultCommandPalette,\n type DefaultCommandPaletteProps,\n} from './shell/default-command-palette.js';\nexport type { Slot } from './shell/slot.js';\nexport {\n ScopeSwitcher,\n type ScopeOption,\n type ScopeSwitcherProps,\n} from './shell/scope-switcher.js';\nexport { UserMenu, type UserMenuProps } from './shell/user-menu.js';\nexport { useLanguageSwitch, type LanguageSwitchApi } from './shell/use-language-switch.js';\nexport {\n ThemeSubmenu,\n ThemeToggle,\n useThemePaletteActions,\n} from './shell/theme-controls.js';\nexport {\n LanguageSubmenu,\n localeLabel,\n useLanguagePaletteActions,\n} from './shell/language-submenu.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,iBAAAA,GAAcC,MAAAA,KAAAA,OAAAA,QAAAA,QAAAA,CAAAA,CAAAA,WAAAA,QAClB,sBAAA,CAAA,CAAA,CAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CACzE;AACA,MAAMC,YAAAA,GAASD,MAAAA,KAAAA,OAAAA,QAAAA,QAAAA,CAAAA,CAAAA,WAAAA,QAAW,sBAAA,CAAA,CAAA,CAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAG7F,MAAM,sBAAsB;AAqB5B,SAAgB,SAAS,EAAE,aAAuD;CAChF,MAAM,EAAE,MAAM,QAAQ,eAA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AAA,UAAA,EACE,GAAA,kBAAA,IAAA,CAACC,6BAAAA,uBAAD,CAAwB,CAAA,GACvB,KACD,EAAA,CAAA;EAEe;;CA2BvB,MAAM,QACJ,GAAA,kBAAA,KAAA,CAACC,6BAAAA,cAAD,EAAA,UAAA,EACE,GAAA,kBAAA,IAAA,CAACC,6BAAAA,qBAAD;EAAqB,SAAA;EAxBvB,UAAA,YAAY,QACV,GAAA,kBAAA,IAAA,CAAC,UAAD;GACE,MAAK;GACL,eAAY;GACZ,cAAY;GACZ,UAAU;GACV,WAAU;GAET,UAAA;EACK,CAAA,KAER,GAAA,kBAAA,IAAA,CAAC,mBAAD;GACE,MAAK;GACL,eAAY;GACZ,cAAY;GACZ,UAAU;GACV,WAAU;GAET,UAAA;EACgB,CAAA;CAKwC,CAAA,GAC1D,OACW,EAAA,CAAA;CAGhB,IAAI,YAAY,MAAM,QAAO,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,eAAY;EAAkB,UAAA;CAAU,CAAA;CAC1E,QACE,GAAA,kBAAA,IAAA,CAAC,aAAD;EAAa,eAAY;EACvB,WAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAA,UAAkB,KAAsB,CAAA;CAC7B,CAAA;AAEjB;;;ACnKA,MAAa,eAAe;AAC5B,MAAa,kBAAkB"}
1
+ {"version":3,"file":"index.cjs","names":["DocMarkdown","lazy","DocFaq","useDocPanel","useDocsConfig","useLocale","useOptionalT","useRef","useMemo","useDocScopes","useState","useCallback","cn","Button","IconArrowLeft","IconBook2","IconMinimize","IconMaximize","IconX","IconLoader2","Suspense","useDocScopes","useDocPanel","useOptionalT","cn","IconHelpHexagon","lazy","useApp","useDocsConfig","useI18nCaps","useOptionalT","useState","useDocumentedScopes","useMemo","resolveConceptLabel","resolveEnumLabel","resolveResourceLabel","resolveDoc","useRef","useDocTopics","cn","IconBook2","IconChevronDown","IconSearch","Input","IconArrowUpRight","readDocHash","scrollToDocAnchor","Suspense","useOptionalT","useDocPanel","useDocumentedScopes","useMemo","useDocScopes","CommandGroup","CommandItem","IconBook2","useState","React","SeparatorPrimitive","cn","React","TooltipProvider","cn","useOptionalT","Sheet","SheetContent","SheetTitle","SheetDescription","Button","IconLayoutSidebar","Input","Slot","cva","Tooltip","TooltipTrigger","TooltipContent","Skeleton","AlertDialogPrimitive","React","cn","buttonVariants","useRegisterNavigationGuardDialog","useNavigationGuardText","useOptionalT","useRef","useOptionalT","useState","TooltipProvider","useShell","useShell","useLinkComponent","React","AvatarPrimitive","cn","useLocale","useContext","I18nContext","useChangeLocale","useLanguageStorageKey","useMemo","useCallback","useOptionalT","useContext","I18nContext","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","useMemo","THEME_CHOICES","useOptionalT","useTheme","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","IconSun","IconMoon","IconDeviceDesktop","Button","useMemo","useOptionalAuthController","useShell","useRouterAdapter","useCallback","useIdentity","useLogout","useMemo","DropdownMenuLabel","Separator","DropdownMenuSeparator","useLinkComponent","DropdownMenuItem","useOptionalT","IconLogout","useShell","useRouterAdapter","IconLogin","Children","isValidElement","Fragment","cloneElement","THEME_CHOICES","Skeleton","DropdownMenuContent","IconUser","Button","DropdownMenu","DropdownMenuTrigger","IconSelector","CollapsiblePrimitive","warned","C","hasIcon","Icon","useContext","ComponentsContext","useCallback","usePermissionsUndecided","useOptionalRouterAdapter","useApp","useI18nCaps","useResourceVisible","useLayoutResolver","useMatch","useNavVisible","usePageAllowed","nodeKind","hasListPage","hrefFor","canonicalResourceKey","resolveResourceNavLabel","resolveNavLabel","canonicalNavKey","declaredText","buildNavItems","isCustomPageDef","groupNavHref","useRef","useState","useCallback","IconChevronRight","useApp","useTestIds","useT","useLinkComponent","useOriginIntent","useApp","useI18nCaps","useNavVisible","useMatch","useLayoutResolver","NavChromeMountedProvider","canonicalNavKey","buildNavItems","IconChevronRight","useApp","routeResourceKey","useTestIds","useOptionalT","useLinkComponent","useI18nCaps","useOriginIntent","useDocTrailScopes","cn","canonicalResourceKey","hrefFor","resolveResourceLabel","hasListPage","useTrailContext","useMatch","useApplicationSnapshot","recordTrailRoute","usePublishedRecordTrail","recordTrailKey","useRecordTitle","useNavigationOrigin","originTrail","useDocTrailScopes","effectiveFlow","recordTrail","BUILTIN_LAYOUTS","useTestIds","useOptionalT","useChromeT","humanizeKey","cn","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","useScope","useResourceDimensionOptions","useTestIds","useChromeT","useMemo","humanizeKey","cn","FacetedFilterPicker","useOptionalT","useTestIds","cn","Button","useTrailContext","useMatch","recordTrailRoute","headerTrail","createContext","useContext","useCallback","useOptionalT","useState","useMemo","useRef","CommandDialog","CommandInput","CommandList","CommandEmpty","useOptionalT","useShell","cn","useApp","useI18nCaps","useVisibilityCtx","useOptionalT","useRouteNavigate","useNavVisible","useLayoutResolver","useResourceVisible","usePageAllowed","evaluateVisible","useMemo","hasListPage","canonicalNavKey","isCustomPageDef","resolveResourceLabel","canonicalResourceKey","resolveNavLabel","declaredText","CommandGroup","hrefFor","CommandItem","cn","groupNavHref","nodeKind","Fragment","CommandSeparator","resolveStaticAvailability","recordEntries","recordRouteAvailable","hrefFor","useApp","useOptionalT","useRouteNavigate","useQuick","useCurrentUserId","useResourceVisible","usePlatformStorage","useState","readRecentRecords","useMemo","useCommandState","Fragment","CommandGroup","CommandSeparator","useI18nCaps","useListAccess","resolveResourceLabel","RECENT_LABEL_KEYS","CommandItem","lowerLegacyField","useApp","useOptionalT","useRouteNavigate","useQuick","useResourceVisible","useCommandState","useDebouncedValue","useMemo","isShowAvailable","canonicalResourceKey","CommandGroup","useI18nCaps","useListAccess","useList","useRowSubtitle","resolveResourceLabel","resourceShowHref","CommandItem","resolveNavLabel","resolveContentSlot","useOptionalT","useI18nCaps","useAppActions","usePresentBlock","useRouteNavigate","useMemo","useRef","isExternalHref","CommandGroup","CommandItem","cn","useI18nCaps","useApp","useResourceVisible","useAvailabilityGate","useOptionalT","useRouteNavigate","useQuick","useMemo","hasListPage","canonicalResourceKey","hasRecordPage","resolveResourceLabel","CommandGroup","resourceCreateHref","CommandItem","useT","useRefresh","Button","cn","IconRefresh","useAppActions","useI18nCaps","useLinkComponent","resolveNavLabel","Icon","Button","reasonText","useT","useLinkComponent","IconHelp","Button","cn","React","cn","z","useTestIds","useOptionalT","useI18nCaps","useForm","zodResolver","useState","technicalText","toFriendlyError","friendlyStringsFrom","resolveErrorText","cn","Label","Input","IconAlertCircle","Button","IconLoader2","cn","isEmpty","useOptionalT","React","Icon","cn","EnumSettlingRow","enumBindingKey","useApp","useOptionalT","useI18nCaps","resolveEnumParams","useEnumValues","useAvailableEnumValues","Select","SelectTrigger","SelectValue","SelectContent","LoadError","resolveEnumLabel","enumValueText","resolveDoc","unknownEnumValueLabel","SelectItem","EnumSettlingRow","isEnumControl","ENUM_CONTROLS","useOptionalT","Checkbox","useOptionalLocale","useFieldTimeZone","useTimeZone","Skeleton","formatTimeValue","localeTag","dateDisplayParams","isCalendarDate","zoneShortName","canonicalInstant","epochMsToInstant","toLocalDateTimeText","fromLocalDateTimeText","Input","useOptionCaps","useBoundEnum","resolveOptionLabel","Icon","useOptionalT","enumNamespaceOf","useFieldMetaSources","useAvailableEnumValues","narrowEntriesOf","resolveDoc","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","EnumSettlingRow","useOptionalFileStorage","React","useFileUrls","isImage","useOptionalT","useFileField","React","cn","IconUpload","formatBytes","useFileUrls","isImage","IconLoader2","Button","IconRotate","IconX","React","cn","toDisplayText","useOptionalT","React","lazy","Suspense","Skeleton","lazy","useOptionalT","Suspense","useOptionalLocale","formatNumber","Input","cn","useChromeT","Button","IconArrowUp","IconArrowDown","IconTrash","IconPlus","isRecord","normalizeEntityRef","useApp","useOptionalT","useTestIds","declaredField","linkOf","useLinkKeys","useState","useCallback","useMemo","LoadError","useEntryGate","resourceKey","RelationDisplay","useRelatedRecord","toDisplayText","Input","toDisplayText","optionFieldName","fieldOptionText","formatEntityRef","createElement","enumBindingKey","useOptionalApp","useFieldMetaSources","enumParamsOf","narrowEntriesOf","EnumBadge","RelationDisplay","RelationPickerInput","ScreenStateProvider","useFormController","useMemo","ScreenTree","EnumDisplay","enumBindingKey","useApp","useI18nCaps","useEnumValues","EnumBadge","enumFallbackText","resolveContentSlot","enumFallbackKey","resolveEnumLabel","enumValueText","Icon","useState","useRef","Input","cn","DataTableFacetedFilter","readRange","normalize","cn","Input","cn","Input","useChromeT","useState","useRef","cn","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","Input","useState","useChromeT","Popover","PopoverTrigger","Button","cn","IconDots","PopoverContent","cn","Input","Button","IconX","useApplicationSnapshot","useProjectedRecord","useMemo","compilePageScreen","snapshotBlockLookup","snapshotFrameLookup","snapshotAppFrames","Skeleton","isScreenFailure","RecordState","RouteSourceContext","PlannedBody","isRelationField","dtoFields","peekFieldDefinition","peekLeafAllowed","normalizeDataError","PeekContext","useApp","useMemo","dtoFields","useOne","useList","technicalText","relationAmbiguousError","useTestIds","useOptionalT","useChromeT","Skeleton","Button","useApplicationSnapshot","compiledScreenFor","builtinFrames","useFrameImplementations","resolveFrameView","formatEntityRef","useFrameT","useCapabilityResolver","projectDto","useFieldAccess","useCallback","peekRecord","peekRow","useContext","PeekHostContext","useUIInstance","useQuickOpener","peekAnchorOpener","shadcnFrameViews","Suspense","recordDisplayName","useRecordSubtitle","useFormController","peekLeafAllowed","ScreenTree","QUICK_ANCHOR_ATTRIBUTE","useI18nCaps","useProjectedRecord","columnName","peekFieldDefinition","resolveFieldLabel","declaredText","FieldValueFrame","ResolvedFieldDisplay","toDisplayText","RecordScopeChain","NO_RECORD_SCOPE_FRAMES","RecordState","useRouteRecordId","InvalidRouteId","useApp","useMemo","dtoFields","useOne","retryRecordRead","LoadError","useEntryGate","useQuickEntry","useProjectedTitle","canonicalResourceName","routeResourceKey","useUIInstance","useUIPresentationRuntime","useDispatcherEffects","useRef","DispatcherProvider","RouteSourceContext","QuickScreenClaimContext","RecordScreen","useApp","useI18nCaps","useOptionalT","resolveResourceTitle","resolveResourceLabel","useQuickEntry","useUIInstance","useTestIds","useLinkComponent","useContext","OwnTitleContext","hasRecordPage","resourceShowHref","Button","IconArrowLeft","DialogPrimitive","IconExternalLink","IconX","useSyncExternalStore","useQuickEntryValue","useTestIds","useRef","QuickEntryContext","humanizeKey","useMemo","useUIInstance","DialogPresentationShell","useUIInstance","useState","useRef","useCallback","useMemo","Popover","PopoverAnchor","PopoverContent","PeekHostContext","useUIInstance","SheetPresentationShell","useLoaded","loadFlowScreen","FlowLoadFailed","OwnTitleHeading","IconLoader2","FlowBoundary","FormProvider","React","Controller","useFormContext","cn","Label","Slot","cn","useOptionalT","useTestIds","taskRunOutcome","taskRunFraction","useOptionalT","useLocale","useOptionalDataRuntime","useMemo","useRef","useCommandPalette","useMemo","ShellProvider","RecordState","useOptionalT","useState","IconLoader2","IconSelector","DropdownMenuContent","DropdownMenuLabel","DropdownMenuItem","IconCheck","DropdownMenuSeparator","DropdownMenu","DropdownMenuTrigger"],"sources":["../src/doc/doc-panel.tsx","../src/doc/doc-trail-help.tsx","../src/doc/doc-browser.tsx","../src/layout/command-palette-docs-group.tsx","../src/lib/use-mobile.ts","../src/primitives/separator.tsx","../src/primitives/sidebar.tsx","../src/primitives/alert-dialog.tsx","../src/layout/navigation-guard-dialog.tsx","../src/layout/app-layout.tsx","../src/shell/brand-tile.tsx","../src/shell/brand-mark.tsx","../src/shell/sidebar-brand.tsx","../src/shell/slot.ts","../src/primitives/avatar.tsx","../src/shell/use-language-switch.ts","../src/shell/language-submenu.tsx","../src/shell/theme-controls.tsx","../src/shell/use-current-user.ts","../src/shell/user-menu.tsx","../src/primitives/collapsible.ts","../src/shell/use-nav-icon.tsx","../src/shell/use-shell-waiting.ts","../src/layout/use-nav-tree.ts","../src/layout/nav-main.tsx","../src/layout/app-sidebar.tsx","../src/layout/nav-chrome.tsx","../src/layout/breadcrumbs.tsx","../src/layout/record-breadcrumbs.tsx","../src/layout/default-nav-layouts.ts","../src/layout/context-picker.tsx","../src/layout/scope-dimension-picker.tsx","../src/layout/language-switch.tsx","../src/layout/header-breadcrumbs.tsx","../src/layout/command-palette.tsx","../src/layout/command-palette-trigger.tsx","../src/layout/command-palette-navigation-groups.tsx","../src/layout/quick-targets.ts","../src/layout/command-palette-recent-group.tsx","../src/layout/command-palette-records-group.tsx","../src/layout/command-palette-actions-group.tsx","../src/layout/command-palette-create-group.tsx","../src/shell/refresh-button.tsx","../src/shell/app-actions.tsx","../src/shell/help-button.tsx","../src/layout/app-header.tsx","../src/primitives/card.tsx","../src/auth/login-form.tsx","../src/auth/auth-page.tsx","../src/enum/enum-choice-group.tsx","../src/enum/enum-picker.tsx","../src/enum/resolve-enum-control.ts","../src/forms/issue-severity.ts","../src/fields/boolean.tsx","../src/fields/date.tsx","../src/fields/enum.tsx","../src/fields/file-display.tsx","../src/fields/file.tsx","../src/primitives/textarea.tsx","../src/fields/json.tsx","../src/fields/lazy-relation-many.tsx","../src/fields/lazy-rich-text.tsx","../src/fields/number.tsx","../src/fields/object-group.tsx","../src/fields/repeater.tsx","../src/fields/link-keys-display.tsx","../src/fields/relation-meta-schema.ts","../src/fields/text.tsx","../src/fields/textarea.tsx","../src/fields/default-renderers.ts","../src/forms/declarative-display.tsx","../src/enum/enum-display.tsx","../src/data-table/data-table-text-filter.tsx","../src/data-table/data-table-enum-filter.tsx","../src/data-table/data-table-num-range-filter.tsx","../src/data-table/data-table-date-range-filter.tsx","../src/data-table/data-table-operator-filter.tsx","../src/data-table/data-table-row-actions.tsx","../src/data-table/data-table-toolbar.tsx","../src/ui-presentations/block-screen.tsx","../src/quick/peek-fields.ts","../src/quick/peek-screen.tsx","../src/quick/quick-body.tsx","../src/quick/quick-header.tsx","../src/quick/quick-screen.tsx","../src/ui-presentations/copy.ts","../src/ui-presentations/dialog-host.tsx","../src/ui-presentations/popover-host.tsx","../src/ui-presentations/sheet-host.tsx","../src/ui-presentations/index.tsx","../src/primitives/form.tsx","../src/primitives/progress.tsx","../src/tasks/task-run-panel.tsx","../src/lib/spacing.ts","../src/shell/default-command-palette.tsx","../src/shell/app-shell.tsx","../src/shell/scope-switcher.tsx","../src/index.ts"],"sourcesContent":["'use client';\n\nimport {\n type DocTopicView,\n useDocPanel,\n useDocScopes,\n useDocsConfig,\n useLocale,\n useOptionalT,\n} from '@burojs/react';\nimport {\n IconArrowLeft,\n IconBook2,\n IconLoader2,\n IconMaximize,\n IconMinimize,\n IconX,\n} from '@tabler/icons-react';\nimport { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\n\n/**\n * The markdown stack (~54 kB gzip) is reached through `React.lazy`, so an app\n * whose users never open an article never downloads it. `React.lazy` and NOT\n * `next/dynamic`: this is a published library and must not import from any\n * framework — the package stays router- and bundler-agnostic.\n */\nconst DocMarkdown = lazy(() =>\n import('../markdown/index.js').then((m) => ({ default: m.DocMarkdown })),\n);\nconst DocFaq = lazy(() => import('../markdown/index.js').then((m) => ({ default: m.DocFaq })));\n\n/** Kept in step with the `duration-200` classes below — see the open/close note. */\nconst PANEL_TRANSITION_MS = 200;\n\nexport interface DocPanelProps {\n className?: string;\n}\n\n/**\n * The documentation panel: one instance, mounted in the layout, driven by a\n * store that `<DocInfo>` buttons anywhere in the tree can push to.\n *\n * **Non-modal, and it displaces rather than covers.** The existing `Sheet`\n * primitive is a modal Radix Dialog with a `bg-overlay/80` overlay and a 384px\n * cap — under it the form is dimmed and inert, which defeats the single reason\n * this panel exists: being readable WHILE the reader works. So it is its own\n * component, a sibling column that the content area gives width to.\n *\n * **Sticky across navigation.** Its content changes only when the reader\n * changes it — a different «i», a link inside the panel, or closing it. The\n * alternative (follow the page) was rejected because it would yank the article\n * away mid-sentence the moment the reader navigated to do what it described.\n */\nexport function DocPanel({ className }: DocPanelProps): React.ReactElement | null {\n const { open, target, returnFocusTo, goTo, close } = useDocPanel();\n const config = useDocsConfig();\n const locale = useLocale();\n const t = useOptionalT();\n /*\n `close()` clears the target, so by the time the exit transition should run\n there is nothing left to render — the panel vanished instantly however\n carefully the animation was set up. The last target is held so the closing\n frames still have content to slide away, and EVERYTHING below reads the\n held value: deriving the scopes from the live one emptied the topic list\n the moment Close was pressed, so the panel slid out blank.\n */\n const lastTarget = useRef(target);\n if (target) lastTarget.current = target;\n const shownTarget = target ?? lastTarget.current;\n\n const scopes = useMemo(() => shownTarget?.scopes ?? [], [shownTarget]);\n const groups = useDocScopes(scopes);\n const containerRef = useRef<HTMLElement | null>(null);\n\n const activeId = shownTarget?.topicId;\n const activeScope = shownTarget?.scope ?? scopes[0];\n const all = useMemo(() => groups.flatMap((g) => g.topics), [groups]);\n const active =\n activeId === undefined\n ? undefined\n : all.find((x) => x.id === activeId && x.scope === activeScope);\n\n /*\n One article across the whole trail → skip the list and open it.\n Deliberately decided HERE and not in the button: if the affordance itself\n branched on the count, it would change behaviour the day a second article\n is written. The control always means \"open help\"; this is only about not\n showing a list of one.\n */\n const soleTopic = all.length === 1 ? all[0] : undefined;\n const shown = active ?? (activeId === undefined ? soleTopic : undefined);\n\n // Focus goes to the container, not to the first control: a static element at\n // the start lets a screen reader announce the panel's structure instead of\n // reading out \"button, Close\".\n useEffect(() => {\n if (open) containerRef.current?.focus();\n }, [open]);\n\n /*\n Reading mode: the panel covers the window instead of taking a slice of it.\n\n The rail's slot in the flex row is KEPT while maximized, and only the inner\n column goes `fixed`. That is the whole point of the feature as asked for:\n the page underneath must not reflow, so nothing it holds — a scroll\n position, an open menu, a half-filled form, a running table selection —\n gets torn down and rebuilt just because someone wanted to read.\n */\n const [maximized, setMaximized] = useState(false);\n\n const handleClose = useCallback(() => {\n // Reset the mode, or the next open would arrive covering the window with\n // no memory of having been asked to.\n setMaximized(false);\n close();\n if (returnFocusTo && typeof document !== 'undefined') {\n // By id, never by a stored node: the trigger's element is remounted by\n // any re-render of the form it sits in, and a stale node would swallow\n // the focus silently.\n const el = document.querySelector<HTMLElement>(`[data-testid=\"${returnFocusTo}\"]`);\n el?.focus();\n }\n }, [close, returnFocusTo]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n e.stopPropagation();\n /*\n Escape unwinds ONE step at a time. Maximized → back to the rail; from\n the rail → closed. Collapsing straight to nothing would make the key\n destroy two states at once, and the reader who only wanted their page\n back would have to re-open the panel and find their article again.\n */\n if (maximized) {\n setMaximized(false);\n return;\n }\n handleClose();\n };\n document.addEventListener('keydown', onKey);\n return () => document.removeEventListener('keydown', onKey);\n }, [open, handleClose, maximized]);\n\n /*\n OPENING AND CLOSING ARE ANIMATED, the same way the navigation sidebar does\n it: the element stays in flow and its WIDTH transitions, so the content\n column is pushed aside smoothly instead of jumping.\n\n Two pieces of bookkeeping are unavoidable for that.\n\n `rendered` keeps the panel in the tree for the length of the close\n transition — unmounting on the click would animate nothing, there would be\n no element left to animate. It is cleared on a timer matched to the\n duration below.\n\n `expanded` flips one frame AFTER mount. A transition needs two values to\n interpolate between, and React commits the open state in the same frame the\n element appears — so without the `requestAnimationFrame` the panel is born\n at its final width and simply pops.\n */\n const [rendered, setRendered] = useState(false);\n const [expanded, setExpanded] = useState(false);\n useEffect(() => {\n if (open) {\n /*\n Opening needs no frame juggling at all: the panel mounts at its final\n width and a CSS KEYFRAME animation plays it out from zero. See\n `@keyframes doc-panel-in` for why a transition cannot do that job.\n */\n setRendered(true);\n setExpanded(true);\n return;\n }\n setExpanded(false);\n const timer = setTimeout(() => setRendered(false), PANEL_TRANSITION_MS);\n return () => clearTimeout(timer);\n }, [open]);\n\n if (!rendered || !shownTarget || !config) return null;\n\n return (\n <aside\n ref={containerRef}\n tabIndex={-1}\n /*\n No explicit role: `<aside>` ALREADY exposes `complementary`, and\n restating it is redundant. The element choice is the decision — the\n panel is persistent and non-modal, so announcing it as a `dialog` would\n promise a focus trap and a modal contract it deliberately does not have.\n */\n aria-label={t('docPanel.title', { defaultValue: 'Help' })}\n data-testid=\"doc-panel\"\n className={cn(\n // Displaces on desktop; on a narrow screen a side column is not\n // survivable, so it becomes a bottom sheet.\n 'flex flex-col border-border bg-background text-foreground focus:outline-hidden',\n 'fixed inset-x-0 bottom-0 z-40 h-[70vh] rounded-t-xl border-t shadow-2xl',\n /*\n A FULL-HEIGHT RAIL, not a column under the header.\n\n The panel is a sibling of `SidebarInset` in the shell, so it is simply\n a flex item of the same row as the whole application — full height,\n and the header shrinks beside it instead of running on above it. No\n sticky positioning is needed for that any more: the shell owns a real\n height (`h-svh` on the wrapper), so this is bounded by construction\n and scrolls internally.\n\n Widths in PIXELS rather than rem, so the documentation reading column\n stays deliberate if an adopter customizes the root font size. It grows\n on a big screen — a fixed 360px next to a 2560px window spends the\n extra room on nothing, and documentation is the one panel where a\n longer measure is a real gain.\n */\n /*\n `md:relative` is load-bearing: the base classes make this `fixed` for\n the phone bottom-sheet, and a fixed element is OUT OF FLOW — it\n floats over the app and displaces nothing. The old `md:sticky`\n happened to override that; removing it left the panel covering the\n content instead of pushing it, with every other style looking right.\n */\n 'md:relative md:inset-x-auto md:bottom-auto md:z-auto md:h-full md:shrink-0',\n /*\n The animating box: it clips, so the fixed-width column inside slides\n into view rather than reflowing as the width changes.\n\n ONE `transition-[…]` covering both properties, NOT two classes.\n `cn()` is tailwind-merge and every `transition-*` utility is a single\n group, so a later `transition-transform` silently deletes an earlier\n `transition-[width]` — the panel then snapped open with both classes\n sitting in the list looking correct. The same merge rule already cost\n this codebase the popover's `max-width`.\n */\n 'overflow-hidden transition-[width,transform] duration-200 ease-out',\n /*\n ONE `clamp`, not a ladder of breakpoints. Three stepped widths\n (`md:` / `2xl:` / `3xl:`) all carry the same specificity, and Tailwind\n emitted the widest one's media block BEFORE the others — so at 1900px\n the 440px rule, being later in the file, won. Both classes were\n present and correct; only the generated ORDER decided it, which is\n not something a class list shows you.\n\n `clamp` also describes the intent better than steps do: never\n narrower than a readable column, never wider than a comfortable\n measure, and proportional in between.\n */\n // Declared once, consumed by both the resting width and the keyframe.\n '[--doc-panel-w:clamp(360px,26vw,520px)]',\n expanded\n ? 'md:w-[var(--doc-panel-w)] md:animate-[doc-panel-in_200ms_ease-out]'\n : 'md:w-0 md:border-l-0',\n // On a phone it is a bottom sheet, so it rises instead of widening.\n expanded ? 'translate-y-0' : 'translate-y-full',\n /*\n `transform-none` on desktop, not `translate-y-0`.\n\n A transformed element becomes the CONTAINING BLOCK for any `fixed`\n descendant, so the maximized overlay — `fixed inset-0` — was laid out\n against this panel instead of the viewport and sat at x=1185 while\n measuring a correct 1600×900. Zeroing the translate is not enough:\n the property still applies. The phone sheet keeps its transform,\n because there is nothing fixed inside it there.\n */\n 'md:transform-none md:translate-none',\n 'md:rounded-none md:border-l md:border-t-0 md:shadow-none',\n className,\n )}\n >\n {/*\n The column is sized independently of the animating box above, so its\n contents keep their final layout while the box opens — otherwise every\n label would reflow and wrap on each frame of the transition, which\n reads as the panel assembling itself rather than sliding in.\n */}\n <div\n data-maximized={maximized ? 'true' : undefined}\n className={cn(\n 'flex min-h-0 flex-col',\n maximized\n ? /*\n Covers the window; the `<aside>` above keeps its width in the\n flex row, so the page underneath does not reflow. `bg-background`\n is not optional here — a transparent overlay would let the page\n show through and read as a rendering fault.\n */\n 'fixed inset-0 z-50 h-svh w-screen border-l-0 bg-background'\n : 'h-full w-full md:w-[var(--doc-panel-w)]',\n )}\n >\n <header className=\"flex shrink-0 items-center gap-1 border-b px-3 py-2 md:h-14 md:px-4\">\n {shown && all.length > 1 && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 min-h-[24px] min-w-[24px] shrink-0\"\n onClick={() => goTo({ scopes })}\n aria-label={t('docPanel.back', { defaultValue: 'Back to the list' })}\n data-testid=\"doc-panel:back\"\n >\n <IconArrowLeft className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n )}\n <IconBook2 className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1 truncate text-sm font-medium\">\n {shown ? shown.title : t('docPanel.title', { defaultValue: 'Help' })}\n </span>\n {/* Desktop only: on a phone the panel is already a full-width sheet,\n so \"expand\" would have nothing left to expand into. */}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"hidden size-7 min-h-[24px] min-w-[24px] shrink-0 md:inline-flex\"\n onClick={() => setMaximized((v) => !v)}\n aria-label={\n maximized\n ? t('docPanel.collapse', { defaultValue: 'Collapse the panel' })\n : t('docPanel.expand', { defaultValue: 'Expand to the full page' })\n }\n aria-pressed={maximized}\n data-testid=\"doc-panel:expand\"\n >\n {maximized ? (\n <IconMinimize className=\"size-4\" aria-hidden=\"true\" />\n ) : (\n <IconMaximize className=\"size-4\" aria-hidden=\"true\" />\n )}\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-7 min-h-[24px] min-w-[24px] shrink-0\"\n onClick={handleClose}\n aria-label={t('docPanel.close', { defaultValue: 'Close help' })}\n data-testid=\"doc-panel:close\"\n >\n <IconX className=\"size-4\" aria-hidden=\"true\" />\n </Button>\n </header>\n\n <div\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3',\n // Expanded, the column is as wide as the window — and prose at 1900px\n // is roughly 300 characters a line. The measure is the point of the\n // extra room, not the width itself.\n maximized && 'mx-auto w-full max-w-[72ch] px-6 py-6',\n )}\n >\n {shown ? (\n <DocPanelArticle key={`${shown.scope}/${shown.id}/${locale}`} topic={shown} />\n ) : (\n <nav aria-label={t('docPanel.topics', { defaultValue: 'Topics' })}>\n {groups.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n {t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })}\n </p>\n )}\n {groups.map((group) => (\n <section key={group.scope} className=\"mb-4 last:mb-0\">\n {/* The scope heading only earns its space once the trail names\n more than one — on a single scope it just repeats the page. */}\n {groups.length > 1 && (\n <h2 className=\"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-wide text-muted-foreground\">\n {group.label}\n </h2>\n )}\n {group.summary !== undefined && (\n <p className=\"mb-2 text-[0.8125rem] leading-[1.6] text-foreground\">\n {group.summary}\n </p>\n )}\n <ul className=\"flex flex-col gap-0.5\">\n {group.topics.map((topic) => (\n <li key={`${topic.scope}/${topic.id}`}>\n <button\n type=\"button\"\n onClick={() => goTo({ scopes, scope: topic.scope, topicId: topic.id })}\n data-testid={`doc-panel:topic:${topic.id}`}\n className={cn(\n 'w-full rounded-md px-2 py-1.5 text-left text-[0.8125rem]',\n 'text-foreground transition-colors hover:bg-muted',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n {topic.title}\n </button>\n </li>\n ))}\n </ul>\n </section>\n ))}\n </nav>\n )}\n </div>\n </div>\n </aside>\n );\n}\n\n/** Loads and renders one article body, with the fallback-locale disclosure. */\nfunction DocPanelArticle({ topic }: { topic: DocTopicView }): React.ReactElement {\n const t = useOptionalT();\n const [body, setBody] = useState<string | null>(null);\n const [failed, setFailed] = useState(false);\n\n useEffect(() => {\n let cancelled = false;\n setBody(null);\n setFailed(false);\n topic\n .load()\n .then((text) => {\n if (!cancelled) setBody(text);\n })\n .catch(() => {\n if (!cancelled) setFailed(true);\n });\n return () => {\n cancelled = true;\n };\n }, [topic]);\n\n if (failed) {\n return (\n <p className=\"text-sm text-muted-foreground\" data-testid=\"doc-panel:error\">\n {t('docPanel.loadFailed', { defaultValue: 'This article could not be loaded.' })}\n </p>\n );\n }\n if (body === null) {\n return (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </div>\n );\n }\n\n return (\n <>\n {topic.isFallback && (\n /*\n Serving another language silently is worse than serving nothing: the\n reader has no way to know why the text suddenly changed register. The\n notice says so, and `lang` on the article below tells a screen reader\n to switch voices (WCAG SC 3.1.2, AA).\n */\n <p\n className=\"mb-3 rounded-md border border-border/60 bg-muted/50 px-2.5 py-1.5 text-xs text-muted-foreground\"\n data-testid=\"doc-panel:fallback-notice\"\n >\n {t('docPanel.noTranslation', {\n params: { locale: topic.locale },\n defaultValue: `Not translated yet — showing the ${topic.locale} version.`,\n })}\n </p>\n )}\n <article lang={topic.locale} data-testid=\"doc-panel:article\">\n <Suspense\n fallback={\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </div>\n }\n >\n {/*\n The same rule as the handbook: an FAQ is a list of questions, and\n collapsing them matters MORE here than there — this column is 360 px\n wide, so four answers flowed out full-length is a very long scroll\n for someone who wanted one of them.\n */}\n {topic.kind === 'faq' ? <DocFaq>{body}</DocFaq> : <DocMarkdown>{body}</DocMarkdown>}\n </Suspense>\n </article>\n </>\n );\n}\n","'use client';\n\nimport { useDocPanel, useDocScopes, useOptionalT } from '@burojs/react';\nimport { IconHelpHexagon } from '@tabler/icons-react';\nimport type { JSX } from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport interface DocTrailHelpProps {\n /** Scopes named by the breadcrumb trail, outermost first. */\n scopes: readonly string[];\n testId?: string;\n className?: string;\n}\n\n/**\n * Help for where you are: a «?» that sits at the end of the breadcrumb trail.\n *\n * The breadcrumb is the one element with a fixed position on every page in this\n * app — it lives in the shell header — and it is also the page's only VISIBLE\n * identity, since `visibleTitle` is false everywhere and the `<h1>` is\n * `sr-only`. Anchoring help to it puts the control in the same spot every time.\n *\n * Two things it does that per-entity icons structurally cannot:\n *\n * - **The trail is a CHAIN.** «Documents › wo:2921 › Codes» names two\n * documented resources, and one control can offer both.\n * - **It survives sub-pages.** On «Documents › Creation» there is no record and\n * no fields yet, but the reader can still reach the resource's help — which\n * is exactly when they are most likely to want it.\n *\n * `?` rather than the `i` used beside fields, and the distinction is the one\n * NN/g draws: `i` reads as \"a definition of this specific thing\", `?` as \"help\n * for this area\". A trail control is the second.\n *\n * Renders NOTHING when nothing in the trail is documented. \"Always in the same\n * place\" has to mean \"when there is something\" — a button that opens an empty\n * list on 37 of 39 resources teaches people not to press it.\n *\n * One behaviour, always: open the panel. Whether the panel then shows a list or\n * goes straight to a single article is the PANEL's decision, not this button's\n * — otherwise the control would change what it does on the day a second article\n * is written.\n */\nexport function DocTrailHelp({ scopes, testId, className }: DocTrailHelpProps): JSX.Element | null {\n const documented = useDocScopes(scopes);\n const { openPanel } = useDocPanel();\n const t = useOptionalT();\n\n if (documented.length === 0) return null;\n\n const id = testId ?? 'doc-trail-help';\n return (\n <button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-label={t('docPanel.openForArea', { defaultValue: 'Help for this section' })}\n data-testid={id}\n onClick={() => openPanel({ scopes: documented.map((s) => s.scope) }, id)}\n className={cn(\n // 24 CSS px, stated in pixels because SC 2.5.8 states its floor in\n // pixels. At the standard 16px root, `size-6` is 24px too.\n 'inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-full',\n 'text-muted-foreground transition-colors duration-150',\n 'hover:bg-muted hover:text-foreground',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n className,\n )}\n >\n <IconHelpHexagon className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n );\n}\n","'use client';\n\nimport {\n type DocTopicView,\n useDocTopics,\n useDocsConfig,\n useApp,\n useDocumentedScopes,\n useI18nCaps,\n useOptionalT,\n} from '@burojs/react';\nimport {\n resolveConceptLabel,\n resolveDoc,\n resolveEnumLabel,\n resolveResourceLabel,\n} from '@burojs/core';\nimport { IconArrowUpRight, IconBook2, IconChevronDown, IconSearch } from '@tabler/icons-react';\nimport { Suspense, lazy, useEffect, useMemo, useRef, useState } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Input } from '../primitives/input.js';\n\nconst DocMarkdown = lazy(() =>\n import('../markdown/index.js').then((m) => ({ default: m.DocMarkdown })),\n);\nconst DocFaq = lazy(() => import('../markdown/index.js').then((m) => ({ default: m.DocFaq })));\n\n// Static, not lazy: a few lines of string handling, and the anchor logic has\n// to run whether or not the markdown chunk has finished loading.\nimport { readDocHash, scrollToDocAnchor } from '../markdown/anchors.js';\n\n/**\n * Query parameters that make the handbook linkable.\n *\n * Two, not one packed string: `?area=concept/gtin&topic=index` survives a\n * scope that contains slashes without needing a separator convention, and it\n * is readable in a chat message — which is where these links are pasted.\n */\nconst AREA_PARAM = 'area';\nconst TOPIC_PARAM = 'topic';\n\nexport interface DocBrowserProps {\n className?: string;\n}\n\n/**\n * The browsable handbook: every documented scope in one place.\n *\n * The framework does NOT register a route for this. `CustomPageDef.path` is\n * documented as \"the framework does not own routing\", and that is doubly true\n * now that any router must work — so the adopter mounts this component wherever\n * their routes live and registers the nav item with `defineCustomPage`. An\n * auto-registered menu entry would have pointed at a 404 until they did.\n *\n * WCAG SC 3.2.6 Consistent Help (Level A) still applies to that menu entry: it\n * has to appear in the same relative order on every page. The app's sidebar is\n * global, so a normally-registered custom page satisfies it — no mechanism\n * needed beyond putting it there once.\n *\n * Only scopes the registry actually knows are listed. A handbook that\n * enumerated everything would leak the shape of the application to a reader\n * whose role cannot see it.\n */\nexport function DocBrowser({ className }: DocBrowserProps): React.ReactElement {\n const app = useApp();\n const config = useDocsConfig();\n const caps = useI18nCaps();\n const t = useOptionalT();\n const [query, setQuery] = useState('');\n const glossaryLabel = t('docPanel.glossary', { defaultValue: 'Glossary' });\n const areasLabel = t('docPanel.areas', { defaultValue: 'Areas' });\n const [selected, setSelected] = useState<{ scope: string; topicId: string } | null>(null);\n // Narrow screens only — above `md` the list is shown unconditionally.\n const [railOpen, setRailOpen] = useState(false);\n\n /*\n The areas, from the enumeration SHARED with the command palette. It used to\n be computed here and again there, and the two drifted: the palette's copy\n kept only registered resources, so the glossary and every per-type article\n were missing from ⌘K entirely. One function now, two callers.\n\n Labels and grouping stay here, because they are presentation: a term names\n itself, a variant reads its enum value's label and is indented under its\n owner, and the glossary comes first because a term is what the rest of the\n handbook is written in.\n */\n const documented = useDocumentedScopes();\n const scopes = useMemo(\n () =>\n documented.map((entry) => {\n const parts = entry.scope.split('/');\n const label =\n entry.kind === 'concept'\n ? resolveConceptLabel(caps, parts[1] as string)\n : entry.kind === 'variant' && parts[1] && parts[2]\n ? resolveEnumLabel(caps, parts[1], parts[2])\n : resolveResourceLabel(caps, entry.scope, 'plural', app.registry.get(entry.scope));\n return {\n scope: entry.scope,\n label,\n summary: resolveDoc(caps, entry.scope)?.summary,\n nested: entry.kind === 'variant',\n group:\n entry.kind === 'concept'\n ? glossaryLabel\n : entry.kind === 'resource'\n ? areasLabel\n : undefined,\n };\n }),\n [app, documented, caps, glossaryLabel, areasLabel],\n );\n\n /*\n THE HANDBOOK IS ADDRESSABLE.\n\n `/help?area=concept/gtin&topic=index#kak-ustroen-gtin` — an area, an article\n inside it, and a heading or FAQ question inside that. The point is being\n able to answer a colleague with a link instead of \"open Help, then\n Documents, then the third tab, then scroll\".\n\n Query parameters and `history.replaceState`, NOT a router: this package has\n to work under any of them, and this is the same mechanism the side panel's\n `?help=` already uses. Replacing rather than pushing keeps Back meaning \"the\n previous page\" rather than walking a reader out through every tab they\n happened to click.\n\n Read ONCE. Making the URL the source of truth would fight the component on\n every click, and the hash in particular must survive being scrolled away\n from.\n */\n const urlApplied = useRef(false);\n\n /*\n ONE effect decides the initial selection — the URL if it names a real area,\n the first area otherwise. Splitting \"apply the URL\" and \"fall back to the\n first area\" into two effects looks tidier and is a race: both run in the\n same commit, `selected` is still null in each, and the fallback silently\n wins over the link the reader followed.\n */\n useEffect(() => {\n if (urlApplied.current || scopes.length === 0) return;\n urlApplied.current = true;\n\n const first = scopes[0];\n if (typeof window !== 'undefined') {\n const params = new URLSearchParams(window.location.search);\n const area = params.get(AREA_PARAM);\n // An area that no longer exists is a stale link, not an error: fall\n // through to the first one rather than showing an empty handbook.\n if (area !== null && scopes.some((s) => s.scope === area)) {\n setSelected({ scope: area, topicId: params.get(TOPIC_PARAM) ?? '' });\n return;\n }\n }\n if (first) setSelected({ scope: first.scope, topicId: '' });\n }, [scopes]);\n\n // Mirror the reader's position back out, so the address bar is always a\n // shareable link to what they are looking at.\n useEffect(() => {\n if (!urlApplied.current || typeof window === 'undefined' || selected === null) return;\n const url = new URL(window.location.href);\n url.searchParams.set(AREA_PARAM, selected.scope);\n if (selected.topicId !== '') url.searchParams.set(TOPIC_PARAM, selected.topicId);\n else url.searchParams.delete(TOPIC_PARAM);\n window.history.replaceState(window.history.state, '', url.toString());\n }, [selected]);\n\n const activeScope = selected?.scope ?? scopes[0]?.scope;\n const topics = useDocTopics(activeScope);\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return topics;\n return topics.filter((x) => x.title.toLowerCase().includes(q));\n }, [topics, query]);\n\n /*\n Search has to reach the SCOPE list too. It was topic-only when the handbook\n held eight scopes and every one of them fitted on screen; at three dozen the\n thing a reader types is far more often the name of an area than the title of\n an article inside it. A nested variant keeps its parent visible when it\n matches, otherwise it would appear indented under nothing.\n */\n const visibleScopes = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return scopes;\n const keep = new Set<number>();\n scopes.forEach((s, i) => {\n if (!s.label.toLowerCase().includes(q)) return;\n keep.add(i);\n if (!s.nested) return;\n for (let j = i - 1; j >= 0; j--) {\n if (!scopes[j]?.nested) {\n keep.add(j);\n break;\n }\n }\n });\n return scopes.filter((_, i) => keep.has(i));\n }, [scopes, query]);\n\n const activeTopic =\n selected?.topicId !== undefined && selected.topicId !== ''\n ? topics.find((x) => x.id === selected.topicId)\n : undefined;\n\n if (!config) {\n return (\n <p className=\"text-sm text-muted-foreground\" data-testid=\"doc-browser:disabled\">\n {t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })}\n </p>\n );\n }\n\n const active = scopes.find((s) => s.scope === activeScope);\n\n return (\n <div\n className={cn(\n 'flex flex-col gap-5 md:flex-row md:gap-8',\n /*\n TWO PANES, EACH WITH ITS OWN SCROLL — and deliberately NOT a sticky\n rail, which was tried and is dead on arrival in this shell.\n\n `position: sticky` resolves against the nearest scrolling ancestor,\n and the app's content pane carries `overflow-auto`, so that is the\n ancestor it binds to. But `SidebarInset` is `min-h-svh` — a MINIMUM —\n so the pane grows with its content and never actually scrolls; the\n document does. A sticky child of a container that never scrolls simply\n rides the page away: measured at −430px after a 500px scroll, i.e. the\n rail scrolled clean off the top and under the header.\n\n Bounding the handbook's own height instead makes it self-contained:\n nothing here depends on how the shell decides to scroll. The offset is\n the app header (3.5rem) plus the pane's padding (1.5rem × 2), and the\n side panel already sizes itself the same way — one number, measured,\n used consistently.\n\n Below `md` this is all off and the page flows normally, which is what\n a phone wants.\n */\n 'md:h-[calc(100svh-6.5rem)] md:overflow-hidden',\n className,\n )}\n data-testid=\"doc-browser\"\n >\n {/*\n THE RAIL HOLDS AREAS AND NOTHING ELSE.\n\n It used to also hold the open scope's articles, indented one step — and\n a nested variant scope was ALSO indented one step, so «Frequent questions»\n (an article inside Documents) and «Aggregation» (a sibling scope) rendered\n identically. Two different kinds of thing, one appearance; the reader\n had no way to tell which click changed the area and which changed the\n page. Articles now live in the reading pane, where the thing they belong\n to is on screen with them, and the rail is one uniform list.\n */}\n <nav\n className={cn(\n 'w-full shrink-0 md:w-[248px]',\n // Fills the bounded row and scrolls itself; see the note above.\n 'md:h-full md:min-h-0',\n /*\n `relative` so this scroller is a CONTAINING BLOCK.\n\n `sr-only` is `position: absolute`, and an absolutely positioned\n element resolves against its nearest positioned ancestor — which,\n with nothing in between, is the app shell's `<main>`. So a\n screen-reader-only span buried in a scrolled list was laid out\n against `main` at its un-scrolled coordinate, escaping the scroller\n entirely and stretching the page to 1256px in an 800px window. The\n visible layout gave no hint: the offending elements are 1px tall and\n clipped.\n */\n 'relative',\n // `overflow-x` explicitly: leaving it `visible` beside a non-visible\n // `overflow-y` makes the browser compute it to `auto` per spec, and a\n // long term name would then add a horizontal scrollbar to the rail.\n 'md:overflow-y-auto md:overflow-x-hidden',\n // A hairline separating rail from article, on the side the rail ends.\n 'md:border-r md:border-border/60 md:pr-4',\n )}\n aria-label={t('docPanel.topics', { defaultValue: 'Topics' })}\n >\n <div className=\"mb-3 flex items-center gap-2\">\n <IconBook2 className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <h1 className=\"text-[0.9375rem] font-semibold\">\n {t('docPanel.title', { defaultValue: 'Help' })}\n </h1>\n </div>\n\n {/*\n NARROW SCREENS COLLAPSE THE RAIL.\n\n Stacked, three dozen areas sit between the top of the page and the\n article — the reader scrolls past every area in the product to reach\n the one they picked. The disclosure names the current area, so the\n rail costs one line until it is wanted, and picking an area closes it\n again. Above `md` the list is simply always shown and the toggle is\n not rendered at all.\n */}\n <button\n type=\"button\"\n onClick={() => setRailOpen((v) => !v)}\n aria-expanded={railOpen}\n aria-controls=\"doc-browser-scopes\"\n data-testid=\"doc-browser:rail-toggle\"\n className={cn(\n 'mb-3 flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 md:hidden',\n 'text-[0.8125rem] font-medium transition-colors hover:bg-muted/60',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n <span className=\"min-w-0 truncate\">{active?.label ?? ''}</span>\n <IconChevronDown\n className={cn('size-4 shrink-0 transition-transform', railOpen && 'rotate-180')}\n aria-hidden=\"true\"\n />\n </button>\n\n <div id=\"doc-browser-scopes\" className={cn(railOpen ? 'block' : 'hidden', 'md:block')}>\n <div className=\"relative mb-3\">\n <IconSearch\n className=\"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <Input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={t('docPanel.search', { defaultValue: 'Search help' })}\n aria-label={t('docPanel.search', { defaultValue: 'Search help' })}\n className=\"h-8 w-full pl-8 text-[0.8125rem]\"\n data-testid=\"doc-browser:search\"\n />\n </div>\n\n <ul className=\"flex flex-col gap-px\">\n {visibleScopes.map((s, i) => (\n <li key={s.scope}>\n {/*\n The eyebrow is emitted on CHANGE rather than by grouping the\n list into sections, so a search that filters the glossary away\n entirely also takes its heading with it — a lone «GLOSSARY»\n above nothing is the classic filtered-nav artefact.\n */}\n {s.group !== undefined && s.group !== visibleScopes[i - 1]?.group && (\n <h2 className=\"px-2 pb-1 pt-3 text-[0.6875rem] font-semibold uppercase tracking-wide text-muted-foreground first:pt-0\">\n {s.group}\n </h2>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setSelected({ scope: s.scope, topicId: '' });\n setRailOpen(false);\n }}\n aria-current={s.scope === activeScope ? 'page' : undefined}\n data-testid={`doc-browser:scope:${s.scope}`}\n className={cn(\n 'w-full rounded-md py-1.5 pr-2 text-left text-[0.8125rem] leading-snug',\n 'transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n // A variant is a KIND of its parent. The indent plus the rule\n // running down its left edge says \"inside\", where an extra\n // font treatment would just add noise to a list this long.\n s.nested ? 'ml-2.5 border-l border-border/70 pl-3.5' : 'pl-2 font-medium',\n s.scope === activeScope\n ? 'bg-muted text-foreground'\n : 'text-muted-foreground hover:bg-muted/60 hover:text-foreground',\n )}\n >\n {s.label}\n </button>\n </li>\n ))}\n </ul>\n {/*\n Inside the disclosure, not beside it: a search that matches nothing\n has to say so where the results would have been, and hanging it\n outside would also have hidden it on desktop, where `railOpen` is\n false and the list is shown by the `md:block` above.\n */}\n {visibleScopes.length === 0 && (\n <p className=\"px-2 text-[0.8125rem] text-muted-foreground\">\n {scopes.length === 0\n ? t('docPanel.empty', { defaultValue: 'Nothing is documented here yet.' })\n : t('docPanel.noMatches', { defaultValue: 'Nothing matches that.' })}\n </p>\n )}\n </div>\n </nav>\n\n {/*\n The reading pane is a PAGE about one area: its name, what it is, where\n to read more, and then whichever article is open. A reader who lands\n here from the rail should not have to look back at the rail to know\n what they are reading about.\n */}\n <div\n className={cn('flex min-w-0 flex-1 flex-col', 'md:h-full md:min-h-0')}\n data-testid=\"doc-browser:content\"\n key={activeScope /* reset topic scroll/state when the area changes */}\n >\n {/*\n WHAT AREA YOU ARE IN, AND WHICH ARTICLE — pinned.\n\n These scrolled away with the body in the first cut, which is how you\n lose your place in a long article: the tab strip is the control for\n switching articles, and having to scroll back up to reach it makes it\n feel like part of the text rather than part of the page.\n */}\n <div className=\"shrink-0\">\n <header className=\"mb-4\">\n <h2 className=\"text-xl font-semibold tracking-tight\">{active?.label ?? ''}</h2>\n <ScopeSummary scope={activeScope} summary={active?.summary} />\n </header>\n\n {/*\n One article needs no chooser — a tab strip of one is a control that\n cannot do anything. Its title still belongs on the page, so it is\n rendered as a heading inside the article instead.\n */}\n {topics.length > 1 && (\n <TopicTabs\n topics={filtered.length > 0 ? filtered : topics}\n activeId={activeTopic?.id}\n onSelect={(id) =>\n activeScope !== undefined && setSelected({ scope: activeScope, topicId: id })\n }\n />\n )}\n </div>\n\n {topics.length > 0 && (\n // The body is the only thing that scrolls. `min-h-0` again: a flex\n // child will not shrink below its content without it, and the\n // overflow would silently never engage.\n <div\n // `relative`: see the rail — an `sr-only` span inside a scroller\n // otherwise resolves against `<main>` and stretches the page.\n className=\"relative min-h-0 flex-1 pb-10 md:overflow-y-auto md:pr-1\"\n data-testid=\"doc-browser:body\"\n >\n <BrowserArticle\n topic={(activeTopic ?? filtered[0] ?? topics[0]) as DocTopicView}\n showTitle={topics.length === 1}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/**\n * The article chooser for a scope with more than one.\n *\n * A plain button row rather than Radix `Tabs`: the panel below is loaded\n * asynchronously and swapped in place, so there is no persistent tabpanel per\n * tab for `aria-controls` to point at. Claiming `role=\"tablist\"` without that\n * relationship is worse for a screen reader than not claiming it — this is a\n * group of links to one live region, and `aria-current` says which is open.\n */\nfunction TopicTabs({\n topics,\n activeId,\n onSelect,\n}: {\n topics: DocTopicView[];\n activeId: string | undefined;\n onSelect: (id: string) => void;\n}): React.ReactElement {\n const current = activeId ?? topics[0]?.id;\n return (\n /*\n `overflow-y-hidden` is not redundant. CSS computes a `visible` overflow on\n one axis to `auto` when the other axis is not visible, so `overflow-x-auto`\n alone silently makes this box scrollable VERTICALLY too — and the tabs used\n to sit 1px proud of it via `-mb-px`, which was enough to produce a real,\n draggable vertical scroll on a strip of tab buttons.\n\n The underline is now drawn by the buttons' own bottom border sitting ON the\n container's, so nothing overflows and there is nothing to scroll.\n */\n <div className=\"mb-5 flex gap-1 overflow-x-auto overflow-y-hidden border-b border-border/60\">\n {topics.map((topic) => (\n <button\n key={topic.id}\n type=\"button\"\n onClick={() => onSelect(topic.id)}\n aria-current={topic.id === current ? 'true' : undefined}\n data-testid={`doc-browser:topic:${topic.id}`}\n className={cn(\n 'relative whitespace-nowrap px-3 pb-1.5 pt-2 text-[0.8125rem] transition-colors',\n 'border-b-2 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n topic.id === current\n ? 'border-primary font-medium text-foreground'\n : 'border-transparent text-muted-foreground hover:text-foreground',\n )}\n >\n {topic.title}\n </button>\n ))}\n </div>\n );\n}\n\n/**\n * What a scope IS, above whatever article is open: its summary and any external\n * links. Rendered in the page header rather than as a body, because it is the\n * one piece of text that stays true whichever article the reader picks.\n */\nfunction ScopeSummary({\n scope,\n summary,\n}: {\n scope: string | undefined;\n summary: string | undefined;\n}): React.ReactElement | null {\n const caps = useI18nCaps();\n const t = useOptionalT();\n const doc = scope !== undefined ? resolveDoc(caps, scope) : undefined;\n const links = doc?.links ?? [];\n const newTabNote = t('docPanel.opensInNewTab', { defaultValue: '(opens in a new tab)' });\n\n if (summary === undefined && links.length === 0) return null;\n\n return (\n <div className=\"mt-2 flex flex-col items-start gap-3\" data-testid=\"doc-browser:summary\">\n {summary !== undefined && (\n <p className=\"max-w-[68ch] text-[0.9375rem] leading-relaxed text-muted-foreground\">\n {summary}\n </p>\n )}\n {links.length > 0 && (\n <div\n className={cn(\n 'flex flex-col items-start gap-1.5',\n summary !== undefined && 'border-t border-border/60 pt-3',\n )}\n >\n {links.map((link) => (\n <a\n key={link.href}\n href={link.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'group inline-flex max-w-full items-center gap-1 rounded-sm',\n 'text-[0.8125rem] font-medium text-primary',\n 'hover:underline underline-offset-2',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n <span className=\"min-w-0 truncate\">{link.label}</span>\n <IconArrowUpRight\n className=\"size-3.5 shrink-0 transition-transform duration-150 group-hover:-translate-y-px group-hover:translate-x-px\"\n aria-hidden=\"true\"\n />\n <span className=\"sr-only\">{newTabNote}</span>\n </a>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction BrowserArticle({\n topic,\n showTitle,\n}: {\n topic: DocTopicView;\n showTitle: boolean;\n}): React.ReactElement {\n const t = useOptionalT();\n const [body, setBody] = useState<string | null>(null);\n\n const articleRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n setBody(null);\n topic.load().then((text) => {\n if (!cancelled) setBody(text);\n });\n return () => {\n cancelled = true;\n };\n }, [topic]);\n\n /*\n THE ARTICLE HAS TO PLACE ITS OWN ANCHORS — the browser cannot, twice over.\n\n On ARRIVAL: the body comes from a dynamic import and a fetch, long after the\n URL was read, so at navigation time the target element does not exist yet.\n\n On a HASH CHANGE: `#why-fields-lock` matches nothing in the\n document, because the sanitizer renamed the element to\n `user-content-why-fields-lock` to stop articles clobbering globals.\n The bare slug is what a person pastes and what the visible « # » beside each\n heading links to — so clicking that link changed the address bar and moved\n nothing at all. A fragment-only navigation also does not re-run any of this\n on its own: no reload, no re-render, no effect.\n\n `hashchange` covers both the pasted link and the clicked one.\n */\n useEffect(() => {\n if (body === null) return;\n let stop: (() => void) | undefined;\n const place = () => {\n stop?.();\n const hash = readDocHash();\n const article = articleRef.current;\n if (hash === '' || !article) return;\n stop = scrollToDocAnchor(hash, article);\n };\n place();\n window.addEventListener('hashchange', place);\n return () => {\n window.removeEventListener('hashchange', place);\n stop?.();\n };\n }, [body]);\n\n if (body === null) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n {t('docPanel.loading', { defaultValue: 'Loading…' })}\n </p>\n );\n }\n return (\n <>\n {showTitle && <h3 className=\"mb-3 text-base font-semibold\">{topic.title}</h3>}\n {topic.isFallback && (\n <p\n className=\"mb-3 rounded-md border border-border/60 bg-muted/50 px-2.5 py-1.5 text-xs text-muted-foreground\"\n data-testid=\"doc-browser:fallback-notice\"\n >\n {t('docPanel.noTranslation', {\n params: { locale: topic.locale },\n defaultValue: `Not translated yet — showing the ${topic.locale} version.`,\n })}\n </p>\n )}\n {/*\n `max-w-[68ch]` is not decoration. The reading pane is ~900 px on a\n desktop and prose was set to `max-w-none` for the 360 px side panel,\n so a handbook article ran the full width — roughly 140 characters a\n line, about double what anyone can track back to the next line.\n */}\n <article\n ref={articleRef}\n lang={topic.locale}\n data-testid=\"doc-browser:article\"\n className=\"max-w-[68ch]\"\n >\n <Suspense fallback={<p className=\"text-sm text-muted-foreground\">…</p>}>\n {/*\n An FAQ is a list of questions and gets rendered as one — see DocFaq.\n Every other kind is prose.\n */}\n {topic.kind === 'faq' ? <DocFaq>{body}</DocFaq> : <DocMarkdown>{body}</DocMarkdown>}\n </Suspense>\n </article>\n </>\n );\n}\n","'use client';\n\nimport { useDocPanel, useDocScopes, useDocumentedScopes, useOptionalT } from '@burojs/react';\nimport type { DocTopicKind } from '@burojs/core';\nimport { IconBook2 } from '@tabler/icons-react';\nimport { useMemo } from 'react';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\n\nexport interface CommandPaletteDocsGroupProps {\n /** Active locale. Pass the app's current one so results follow a live switch. */\n locale: string;\n /** Called after a topic is picked — wire to `setOpen(false)`. */\n onSelect?: () => void;\n /** Heading override; defaults to the `docPanel.title` chrome string. */\n heading?: string;\n}\n\ninterface Hit {\n scope: string;\n scopeLabel: string;\n /** Absent when the hit IS the area — a term documented with a summary only. */\n topicId?: string;\n title: string;\n kind: DocTopicKind;\n}\n\n/**\n * Documentation topics in the command palette.\n *\n * Indexes TITLES, not article bodies. Indexing `##` headings inside bodies —\n * the richer option, and the one the first draft of the spec wanted — would\n * require eagerly loading every article on the first keystroke, which is\n * exactly what the lazy loader exists to avoid. Titles live in the i18n bundle\n * and are available synchronously, so this costs nothing.\n *\n * The set of areas comes from `useDocumentedScopes`, shared with the handbook —\n * see its note for the bug that shape exists to prevent.\n *\n * Composed by the ADOPTER into their palette, like every other group here: the\n * palette is a JSX composition rather than a registry, so there is no way for a\n * framework-side config flag to inject a group. Worth being explicit about,\n * because \"the whole feature turns on with one prop\" is true of the panel and\n * not of this.\n */\nexport function CommandPaletteDocsGroup({\n locale,\n onSelect,\n heading,\n}: CommandPaletteDocsGroupProps): React.ReactElement | null {\n const t = useOptionalT();\n const { openPanel } = useDocPanel();\n const glossaryLabel = t('docPanel.glossary', { defaultValue: 'Glossary' });\n\n /*\n The SAME enumeration the handbook uses, and that is the fix.\n\n This walked `config.sources` and kept only keys matching a registered\n resource. `concept/gtin` and `enum/document_type/order_code` are neither, so\n the entire glossary and every per-type article were invisible here:\n ⌘K → «GTIN» returned a packing-config record, and «aggregat» returned an\n equipment row, while the articles for both sat in the handbook. The handbook\n had already been fixed; the duplicate here had not, which is precisely what\n duplicating an enumeration buys you.\n\n `useDocScopes` then resolves each label the one way — a term names itself, a\n variant reads its enum VALUE's label — so «Order codes» reads as itself\n rather than as a raw address.\n */\n const scopes = useDocumentedScopes();\n const scopeNames = useMemo(() => scopes.map((s) => s.scope), [scopes]);\n const groups = useDocScopes(scopeNames);\n\n /*\n What to show BESIDE a result, and it has to disambiguate rather than repeat.\n\n «Aggregation» exists twice over: as a glossary term and as a kind of document.\n Both are legitimately documented, and with the area's own name as context\n both rendered as a bare «Aggregation» — two identical rows, no way to tell\n which is which. A term is labelled by the glossary; a kind is labelled by\n the resource it is a kind OF; a resource speaks for itself.\n */\n const labelOf = useMemo(() => new Map(groups.map((g) => [g.scope, g.label])), [groups]);\n const contextOf = useMemo(() => {\n const byScope = new Map(scopes.map((s) => [s.scope, s]));\n return (scope: string, fallback: string): string => {\n const entry = byScope.get(scope);\n if (entry?.kind === 'concept') return glossaryLabel;\n if (entry?.kind === 'variant' && entry.owner) return labelOf.get(entry.owner) ?? fallback;\n return fallback;\n };\n }, [scopes, labelOf, glossaryLabel]);\n\n const hits = useMemo<Hit[]>(\n () =>\n groups.flatMap((group) => {\n if (group.topics.length > 0) {\n return group.topics.map((topic) => ({\n scope: group.scope,\n scopeLabel: contextOf(group.scope, group.label),\n topicId: topic.id,\n title: topic.title,\n kind: topic.kind,\n }));\n }\n /*\n An area with a summary and no article is still an answer — «Aggregation»\n is documented in one sentence and has no `.md`, and typing «aggregat»\n found nothing because this listed ARTICLES only. The reader cannot see\n that distinction and should not have to: the area itself becomes the\n result, and picking it opens the panel on its summary.\n */\n if (group.summary === undefined) return [];\n return [\n {\n scope: group.scope,\n scopeLabel: contextOf(group.scope, group.label),\n title: group.label,\n kind: 'explanation' as DocTopicKind,\n },\n ];\n }),\n [groups, contextOf],\n );\n\n if (hits.length === 0) return null;\n\n return (\n <CommandGroup heading={heading ?? t('docPanel.title', { defaultValue: 'Help' })}>\n {hits.map((hit) => (\n <CommandItem\n key={hit.topicId === undefined ? hit.scope : `${hit.scope}/${hit.topicId}`}\n // cmdk fuzzy-matches on `value`; folding the scope label in means\n // typing the resource name finds its articles too.\n value={`doc ${hit.scopeLabel} ${hit.title}`}\n data-testid={`command-doc:${hit.scope}${hit.topicId === undefined ? '' : `:${hit.topicId}`}`}\n onSelect={() => {\n openPanel(\n hit.topicId === undefined\n ? { scopes: [hit.scope], scope: hit.scope }\n : { scopes: [hit.scope], scope: hit.scope, topicId: hit.topicId },\n );\n onSelect?.();\n }}\n >\n <IconBook2\n className=\"mr-2 size-4 shrink-0 text-muted-foreground group-data-[selected=true]:text-accent-foreground\"\n aria-hidden=\"true\"\n />\n <span className=\"min-w-0 truncate\">{hit.title}</span>\n {/* A term whose title IS its area name would read «GTIN GTIN». */}\n {hit.scopeLabel !== hit.title && (\n <span className=\"ml-2 shrink-0 text-xs text-muted-foreground group-data-[selected=true]:text-accent-foreground\">\n {hit.scopeLabel}\n </span>\n )}\n </CommandItem>\n ))}\n </CommandGroup>\n );\n}\n","'use client';\nimport { useEffect, useState } from 'react';\n\nconst MOBILE_BREAKPOINT = 768;\n\n/** True when viewport width < 768px. SSR-safe (defaults to false). */\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState(false);\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => setIsMobile(mql.matches);\n mql.addEventListener('change', onChange);\n onChange();\n return () => mql.removeEventListener('change', onChange);\n }, []);\n return isMobile;\n}\n","'use client';\n\nimport * as React from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport { cn } from '../lib/cn.js';\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n 'shrink-0 bg-border',\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n","'use client';\n\nimport * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { IconLayoutSidebar } from '@tabler/icons-react';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { useIsMobile } from '../lib/use-mobile.js';\nimport { Button } from './button.js';\nimport { Input } from './input.js';\nimport { Separator } from './separator.js';\nimport { Sheet, SheetContent, SheetTitle, SheetDescription } from './sheet.js';\nimport { Skeleton } from './skeleton.js';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';\n\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n\ntype SidebarContextValue = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextValue | null>(null);\n\nexport function useSidebar(): SidebarContextValue {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n return context;\n}\n\n/** The sidebar context, or `null` outside a `SidebarProvider`. Never throws. */\nexport function useOptionalSidebar(): SidebarContextValue | null {\n return React.useContext(SidebarContext);\n}\n\nexport interface SidebarProviderProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nexport const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n className,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // Uncontrolled internal state\n const [_open, _setOpen] = React.useState(defaultOpen);\n\n // Whether the component is controlled from outside\n const isControlled = openProp !== undefined;\n const open = isControlled ? (openProp as boolean) : _open;\n\n const setOpen = React.useCallback(\n (openState: boolean) => {\n if (isControlled) {\n setOpenProp?.(openState);\n } else {\n _setOpen(openState);\n }\n // No cookie write — persistence is owned by the AppLayout wrapper.\n },\n [isControlled, setOpenProp],\n );\n\n const toggleSidebar = React.useCallback(() => {\n if (isMobile) {\n setOpenMobile((prev) => !prev);\n } else {\n setOpen(!open);\n }\n }, [isMobile, open, setOpen]);\n\n // Cmd/Ctrl-B keyboard shortcut\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state = open ? 'expanded' : 'collapsed';\n\n const contextValue = React.useMemo<SidebarContextValue>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n /*\n `h-svh`, not `min-h-svh`. A MINIMUM lets the whole shell grow\n with its content, which means the inner `overflow-auto` content\n pane is never constrained and therefore never scrolls — the\n document does instead. Two consequences, both observed:\n `position: sticky` inside the pane binds to a container that\n never scrolls and silently becomes `static` (measured at −430px\n after a 500px scroll), and a panel sized against the pane grew\n past the viewport (1115px in a 960px window) taking its own\n controls out of reach. Both were worked around locally before\n the cause was traced here.\n */\n 'group/sidebar-wrapper flex h-svh w-full has-[[data-variant=inset]]:bg-sidebar',\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n },\n);\nSidebarProvider.displayName = 'SidebarProvider';\n\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'div'> {\n side?: 'left' | 'right';\n variant?: 'sidebar' | 'floating' | 'inset';\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}\n\nexport const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(\n (\n {\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const t = useOptionalT();\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div\n className={cn(\n 'flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground',\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden\"\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as React.CSSProperties}\n side={side === 'left' ? 'left' : 'right'}\n {...props}\n >\n {/* Visually-hidden title for a11y — SheetContent is a Radix Dialog.\n Screen-reader-only is not a reason to ship it untranslated. */}\n <SheetTitle className=\"sr-only\">\n {t('nav.label', { defaultValue: 'Navigation' })}\n </SheetTitle>\n <SheetDescription className=\"sr-only\">\n {t('nav.main', { defaultValue: 'Main navigation' })}\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"group peer hidden md:block text-sidebar-foreground\"\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n {/* Gap element that is only visible when the sidebar is expanded */}\n <div\n className={cn(\n 'duration-200 relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] ease-linear',\n 'group-data-[collapsible=offcanvas]:w-0',\n 'group-data-[side=right]:rotate-180',\n variant === 'floating' || variant === 'inset'\n ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'\n : 'group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]',\n )}\n />\n <div\n className={cn(\n 'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] ease-linear md:flex',\n side === 'left'\n ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'\n : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',\n variant === 'floating' || variant === 'inset'\n ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'\n : 'group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l',\n className,\n )}\n {...props}\n >\n {/*\n ⚠️ `<nav>`, not `<div>`. This is the app's primary navigation and it\n was an anonymous div — the only `<nav>` on the page was the\n breadcrumb, so a screen-reader user had NO navigation landmark to\n jump to and had to tab through ~24 stops to get past the menu.\n */}\n <nav\n aria-label={t('nav.main', { defaultValue: 'Main navigation' })}\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow\"\n >\n {children}\n </nav>\n </div>\n </div>\n );\n },\n);\nSidebar.displayName = 'Sidebar';\n\nexport const SidebarTrigger = React.forwardRef<\n React.ElementRef<typeof Button>,\n React.ComponentPropsWithoutRef<typeof Button>\n>(({ className, onClick, ...props }, ref) => {\n const t = useOptionalT();\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n ref={ref}\n data-sidebar=\"trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn('h-7 w-7', className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <IconLayoutSidebar />\n {/* Third occurrence of this string — the earlier pass fixed SidebarRail's\n aria-label/title and missed this sr-only span, so screen-reader users\n still heard English on every page. */}\n <span className=\"sr-only\">{t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}</span>\n </Button>\n );\n});\nSidebarTrigger.displayName = 'SidebarTrigger';\n\nexport const SidebarRail = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'>\n>(({ className, ...props }, ref) => {\n const t = useOptionalT();\n const { toggleSidebar } = useSidebar();\n return (\n <button\n ref={ref}\n data-sidebar=\"rail\"\n aria-label={t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}\n tabIndex={-1}\n onClick={toggleSidebar}\n title={t('nav.toggleSidebar', { defaultValue: 'Toggle sidebar' })}\n className={cn(\n 'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',\n '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',\n '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',\n 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',\n 'group-data-[side=left][data-collapsible=offcanvas]:-right-2',\n 'group-data-[side=right][data-collapsible=offcanvas]:-left-2',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarRail.displayName = 'SidebarRail';\n\nexport const SidebarInset = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<'main'>>(\n ({ className, ...props }, ref) => {\n return (\n <main\n ref={ref}\n className={cn(\n // `min-w-0` is load-bearing, not cosmetic. A flex item defaults to\n // `min-width: auto`, i.e. it REFUSES to shrink below its content's\n // intrinsic minimum — so a wide data table stretched this <main> to the\n // table's width (960px+ on a 390px phone) and the whole page scrolled\n // sideways. Worse, the sidebar is `position: fixed`, so it stayed put\n // while the page slid under it, which read as \"the user avatar floats\n // over the content\". Allowing the main column to shrink lets the inner\n // `overflow-auto` container do its job and scroll the table by itself.\n // `min-h-0` and NOT `min-h-svh`: a flex child refuses to shrink below\n // its content unless told it may, and that refusal is what stops the\n // `overflow-auto` pane inside from ever engaging. Height now comes from\n // the wrapper's `h-svh` via `flex-1`.\n 'relative flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground',\n 'peer-data-[variant=inset]:h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarInset.displayName = 'SidebarInset';\n\nexport const SidebarInput = React.forwardRef<\n React.ElementRef<typeof Input>,\n React.ComponentPropsWithoutRef<typeof Input>\n>(({ className, ...props }, ref) => {\n return (\n <Input\n ref={ref}\n data-sidebar=\"input\"\n className={cn(\n 'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarInput.displayName = 'SidebarInput';\n\nexport const SidebarHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n});\nSidebarHeader.displayName = 'SidebarHeader';\n\nexport const SidebarFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"footer\"\n className={cn('flex flex-col gap-2 p-2', className)}\n {...props}\n />\n );\n});\nSidebarFooter.displayName = 'SidebarFooter';\n\nexport const SidebarSeparator = React.forwardRef<\n React.ElementRef<typeof Separator>,\n React.ComponentPropsWithoutRef<typeof Separator>\n>(({ className, ...props }, ref) => {\n return (\n <Separator\n ref={ref}\n data-sidebar=\"separator\"\n className={cn('mx-2 w-auto bg-sidebar-border', className)}\n {...props}\n />\n );\n});\nSidebarSeparator.displayName = 'SidebarSeparator';\n\nexport const SidebarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarContent.displayName = 'SidebarContent';\n\nexport const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"group\"\n className={cn('relative flex w-full min-w-0 flex-col p-2', className)}\n {...props}\n />\n );\n },\n);\nSidebarGroup.displayName = 'SidebarGroup';\n\nexport const SidebarGroupLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(\n 'duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupLabel.displayName = 'SidebarGroupLabel';\n\nexport const SidebarGroupAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-action\"\n className={cn(\n 'absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',\n // Increases the hit area of the button on mobile.\n 'after:absolute after:-inset-2 after:md:hidden',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupAction.displayName = 'SidebarGroupAction';\n\nexport const SidebarGroupContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"group-content\"\n className={cn('w-full text-sm', className)}\n {...props}\n />\n));\nSidebarGroupContent.displayName = 'SidebarGroupContent';\n\nexport const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentPropsWithoutRef<'ul'>>(\n ({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu\"\n className={cn('flex w-full min-w-0 flex-col gap-1', className)}\n {...props}\n />\n ),\n);\nSidebarMenu.displayName = 'SidebarMenu';\n\nexport const SidebarMenuItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<'li'>\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n data-sidebar=\"menu-item\"\n className={cn('group/menu-item relative', className)}\n {...props}\n />\n));\nSidebarMenuItem.displayName = 'SidebarMenuItem';\n\nconst sidebarMenuButtonVariants = cva(\n 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n outline:\n 'bg-background text-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',\n },\n size: {\n default: 'h-8 text-sm',\n sm: 'h-7 text-xs',\n lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n);\n\nexport interface SidebarMenuButtonProps\n extends React.ComponentPropsWithoutRef<'button'>,\n VariantProps<typeof sidebarMenuButtonVariants> {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | React.ComponentProps<typeof TooltipContent>;\n}\n\nexport const SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(\n (\n {\n asChild = false,\n isActive = false,\n variant = 'default',\n size = 'default',\n tooltip,\n className,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : 'button';\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n ref={ref}\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) {\n return button;\n }\n\n const tooltipProps: React.ComponentProps<typeof TooltipContent> =\n typeof tooltip === 'string' ? { children: tooltip } : tooltip;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== 'collapsed' || isMobile}\n {...tooltipProps}\n />\n </Tooltip>\n );\n },\n);\nSidebarMenuButton.displayName = 'SidebarMenuButton';\n\nexport const SidebarMenuAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentPropsWithoutRef<'button'> & { asChild?: boolean; showOnHover?: boolean }\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-action\"\n className={cn(\n 'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',\n // Increases the hit area of the button on mobile.\n 'after:absolute after:-inset-2 after:md:hidden',\n 'peer-data-[size=sm]/menu-button:top-1',\n 'peer-data-[size=default]/menu-button:top-1.5',\n 'peer-data-[size=lg]/menu-button:top-2.5',\n 'group-data-[collapsible=icon]:hidden',\n showOnHover &&\n 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuAction.displayName = 'SidebarMenuAction';\n\nexport const SidebarMenuBadge = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"menu-badge\"\n className={cn(\n 'absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none',\n 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',\n 'peer-data-[size=sm]/menu-button:top-1',\n 'peer-data-[size=default]/menu-button:top-1.5',\n 'peer-data-[size=lg]/menu-button:top-2.5',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n));\nSidebarMenuBadge.displayName = 'SidebarMenuBadge';\n\nexport const SidebarMenuSkeleton = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<'div'> & { showIcon?: boolean }\n>(({ className, showIcon = false, ...props }, ref) => {\n // Random width between 50 and 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n ref={ref}\n data-sidebar=\"menu-skeleton\"\n className={cn('rounded-md h-8 flex gap-2 px-2 items-center', className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 flex-1 max-w-[var(--skeleton-width)]\"\n data-sidebar=\"menu-skeleton-text\"\n style={{ '--skeleton-width': width } as React.CSSProperties}\n />\n </div>\n );\n});\nSidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';\n\nexport const SidebarMenuSub = React.forwardRef<\n HTMLUListElement,\n React.ComponentPropsWithoutRef<'ul'>\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu-sub\"\n className={cn(\n 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n));\nSidebarMenuSub.displayName = 'SidebarMenuSub';\n\nexport const SidebarMenuSubItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<'li'>\n>(({ ...props }, ref) => <li ref={ref} {...props} />);\nSidebarMenuSubItem.displayName = 'SidebarMenuSubItem';\n\nexport interface SidebarMenuSubButtonProps extends React.ComponentPropsWithoutRef<'a'> {\n asChild?: boolean;\n size?: 'sm' | 'md';\n isActive?: boolean;\n}\n\nexport const SidebarMenuSubButton = React.forwardRef<HTMLAnchorElement, SidebarMenuSubButtonProps>(\n ({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a';\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',\n 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',\n size === 'sm' && 'text-xs',\n size === 'md' && 'text-sm',\n 'group-data-[collapsible=icon]:hidden',\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarMenuSubButton.displayName = 'SidebarMenuSubButton';\n","'use client';\n\nimport * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\nimport { cn } from '../lib/cn.js';\nimport { buttonVariants } from './button.js';\n\n/**\n * Shadcn-canonical AlertDialog primitive on top of `@radix-ui/react-alert-dialog`.\n *\n * Use this for \"are you sure?\" destructive confirmations. The key difference\n * from the regular `<Dialog>` is that AlertDialog enforces a modal interaction\n * pattern designed for *consequential* decisions:\n * - it cannot be dismissed by Escape OR clicking outside (Radix gates these\n * to encourage explicit Cancel / Action choice).\n * - the trigger surface is paired with `<AlertDialogAction>` and\n * `<AlertDialogCancel>` (not generic Buttons) — the action button gets the\n * destructive variant by default; the cancel button gets the outline\n * variant.\n *\n * Use the regular `<Dialog>` for non-destructive content (forms, info,\n * pickers); reserve AlertDialog for destructive confirms (delete, archive,\n * irreversible actions).\n */\nconst AlertDialog = AlertDialogPrimitive.Root;\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\nexport type AlertDialogOverlayProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Overlay\n>;\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n AlertDialogOverlayProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-overlay/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-[var(--duration-overlay)] ease-[var(--ease-overlay)]',\n className,\n )}\n {...props}\n />\n));\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;\n\nexport type AlertDialogContentProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Content\n>;\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n {/* No slide-* class here on purpose — same reason as\n primitives/dialog.tsx's DialogContent: this surface centres itself\n with `translate-x-[-50%] translate-y-[-50%]` (Tailwind v4 emits the\n `translate` CSS property), and tw-animate-css's slide keyframes\n write `transform`. The two COMPOSE rather than replace each other,\n so a slide-* class here would offset the centring and the dialog\n would animate in diagonally — see\n tests/overlay-animation.test.tsx. Fade + zoom stay safe: zoom only\n feeds `--tw-enter-scale`, inside the keyframe's own `transform`. */}\n <AlertDialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background text-foreground p-6 shadow-lg duration-[var(--duration-overlay)] ease-[var(--ease-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg',\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n));\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;\n\nexport type AlertDialogHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst AlertDialogHeader = ({ className, ...props }: AlertDialogHeaderProps) => (\n <div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />\n);\nAlertDialogHeader.displayName = 'AlertDialogHeader';\n\nexport type AlertDialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst AlertDialogFooter = ({ className, ...props }: AlertDialogFooterProps) => (\n <div\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nAlertDialogFooter.displayName = 'AlertDialogFooter';\n\nexport type AlertDialogTitleProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Title\n>;\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n AlertDialogTitleProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold', className)}\n {...props}\n />\n));\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;\n\nexport type AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Description\n>;\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n AlertDialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n));\nAlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;\n\nexport type AlertDialogActionProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Action\n>;\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n AlertDialogActionProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />\n));\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;\n\nexport type AlertDialogCancelProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Cancel\n>;\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n AlertDialogCancelProps\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}\n {...props}\n />\n));\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n};\n","'use client';\nimport {\n useNavigationGuardText,\n useOptionalT,\n useRegisterNavigationGuardDialog,\n} from '@burojs/react';\nimport { type ReactElement, useRef } from 'react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '../primitives/alert-dialog.js';\n\n/**\n * The unsaved-changes guard's \"leave?\" dialog. The guard itself — which clicks\n * it holds, `beforeunload`, the back-button sentinel — is `@burojs/react`'s and\n * mounted by `<BuroProvider>`; this component registers itself as the guard's\n * dialog while mounted and answers the navigation the guard is holding.\n * `<AppLayout>` renders one, so an app on the layout mounts nothing; an app\n * without it renders this once inside `<BuroProvider>`. With no dialog\n * registered the guard asks through `window.confirm`.\n *\n * A second mounted dialog stays closed: the guard hands a held navigation to\n * the most recently registered dialog only, and back to the previous one when\n * that one unmounts.\n */\nexport function NavigationGuardDialog(): ReactElement {\n const prompt = useRegisterNavigationGuardDialog();\n const text = useNavigationGuardText();\n const t = useOptionalT();\n const unsavedAction = t('navigation.unsavedAction', {\n defaultValue: 'An action on this screen has unsaved input',\n });\n // Stay keeps everything as it was, focus included (P3-30): the element that had focus when\n // the prompt opened — a dirty field, a dialog's ✕ — gets it back once this dialog has closed.\n // Read during the render that opens the prompt, before this dialog's content takes focus.\n const returnFocus = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n const open = prompt !== null;\n if (open && !wasOpen.current && typeof document !== 'undefined') {\n const active = document.activeElement;\n returnFocus.current = active instanceof HTMLElement && active !== document.body ? active : null;\n }\n wasOpen.current = open;\n return (\n <AlertDialog\n open={prompt !== null}\n onOpenChange={(open) => {\n if (!open) prompt?.stay();\n }}\n >\n <AlertDialogContent\n data-testid=\"nav-guard-dialog\"\n onCloseAutoFocus={(event) => {\n const element = returnFocus.current;\n returnFocus.current = null;\n // Gone after Leave closed its overlay: let Radix decide.\n if (element === null || !element.isConnected) return;\n event.preventDefault();\n element.focus();\n }}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{text.title}</AlertDialogTitle>\n <AlertDialogDescription>\n {text.body}\n {prompt !== null && prompt.labels.length > 0\n ? ` ${unsavedAction}: ${prompt.labels.join(', ')}.`\n : null}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel data-testid=\"nav-guard-stay\">{text.stay}</AlertDialogCancel>\n <AlertDialogAction data-testid=\"nav-guard-leave\" onClick={() => prompt?.leave()}>\n {prompt?.reason === 'dismiss' ? text.discard : text.leave}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n","'use client';\nimport { type ReactNode, useEffect, useState } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { SidebarInset, SidebarProvider } from '../primitives/sidebar.js';\nimport { TooltipProvider } from '../primitives/tooltip.js';\nimport { NavigationGuardDialog } from './navigation-guard-dialog.js';\n\nconst SIDEBAR_STORAGE_KEY = 'buro-sidebar';\n\nexport interface AppLayoutProps {\n children: ReactNode;\n /**\n * The sidebar tree — typically <AppSidebar .../>. `null` (or `undefined`/`false`) means no\n * sidebar at all: the layout then mounts no `SidebarProvider`, so `useOptionalSidebar()` is\n * null below it and `AppHeader` drops its trigger.\n */\n sidebar: ReactNode;\n /** The header tree — typically <AppHeader .../>. */\n header?: ReactNode;\n /**\n * The documentation panel — typically <DocPanel />.\n *\n * A SIBLING of the content column, not an overlay: the panel's whole reason\n * for existing is being readable while the reader works, so it takes width\n * from the content rather than covering it. Renders nothing until opened.\n */\n docPanel?: ReactNode;\n}\n\n/**\n * Shell layout on shadcn's SidebarProvider. Open/collapsed state is\n * CONTROLLED here and persisted to localStorage[\"buro-sidebar\"]\n * (the vendored provider's cookie persistence was removed). Defaults to\n * open for a deterministic SSR render; the stored value is applied on\n * mount. A one-frame flash is possible if the stored state is collapsed —\n * acceptable for an admin app; adopters wanting zero flash can inline a\n * blocking <script> that sets the initial state before hydration.\n */\nexport function AppLayout({\n children,\n sidebar,\n header,\n docPanel,\n}: AppLayoutProps): React.ReactElement {\n const t = useOptionalT();\n const [open, setOpen] = useState(true);\n\n useEffect(() => {\n try {\n const saved = window.localStorage.getItem(SIDEBAR_STORAGE_KEY);\n if (saved === 'true' || saved === 'false') setOpen(saved === 'true');\n } catch {\n // localStorage unavailable — keep default open\n }\n }, []);\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next);\n try {\n window.localStorage.setItem(SIDEBAR_STORAGE_KEY, String(next));\n } catch {\n // ignore persistence failure\n }\n };\n\n const frame = (\n <>\n {/*\n Skip link. A keyboard user landing on a fresh page had to tab through\n the company switcher, both scope selectors and every nav item — 13 stops\n — before reaching page content, and paid that cost again every time\n focus returned to the top. This is the standard remedy: hidden until\n focused, first in the tab order, jumps straight to <main>. It changes\n nothing about the existing focus order; it only adds a way out of it.\n */}\n <a\n href=\"#main-content\"\n className=\"sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:shadow-lg focus:outline-hidden focus:ring-2 focus:ring-ring\"\n data-testid=\"skip-to-content\"\n >\n {t('nav.skipToContent', { defaultValue: 'Skip to content' })}\n </a>\n {sidebar}\n {/*\n ⚠️ `tabIndex={-1}` is what makes the skip link above actually work.\n A fragment link to a non-focusable element scrolls but does not move\n focus, so focus stayed on <body> and the next Tab went straight back\n to the sidebar trigger — i.e. the skip link skipped nothing, and a\n keyboard user still traversed ~26 sidebar stops on every page.\n Acceptance testing measured exactly that. `-1` keeps it out of the\n sequential tab order while making it a valid programmatic target.\n */}\n <SidebarInset id=\"main-content\" tabIndex={-1} className=\"focus:outline-hidden\">\n {header}\n {/* `min-w-0` for the same reason as SidebarInset: without it this\n column inherits its content's intrinsic width and `overflow-auto`\n never engages. `p-4` on phones — 6 units of padding on a 390px\n screen spends 12% of the width on empty margins. */}\n <div className=\"flex min-h-0 flex-1 md:flex-row\">\n {/* `relative`: this is the page's ONLY scroll container\n (`overflow-auto`), and it must also be the nearest positioned\n ancestor for anything below it. Several Radix controls (Select,\n Checkbox, …) bubble their value to a hidden native form element\n rendered `position: absolute` with no `top`/`left` — its\n containing block is simply the nearest ancestor that isn't\n `position: static`. With none between a deep field and here,\n that search continued past this div to `<main>`\n (`SidebarInset`), which is `position: relative` but\n deliberately `overflow: visible` (it is not a scroll\n container) — so the hidden element's natural, unscrolled\n position (which can sit well below the fold on a tall form)\n inflated `main`'s scrollable-overflow region and bubbled to\n `document.scrollingElement`, a second real scrollbar next to\n this element's own. Stopping the search HERE instead costs at\n most a pixel of `scrollHeight` on an element that already\n clips via `overflow-auto`, and it covers every Radix bubble\n anywhere in page content — any form, framework or\n adopter-authored, present or future — not just the one\n instance that got reported. */}\n <div className=\"relative min-w-0 flex-1 overflow-auto p-4 md:p-6\">{children}</div>\n </div>\n </SidebarInset>\n {/*\n The documentation panel is a SIBLING of the inset, not a column inside\n it — so it is the full height of the shell and the app header shrinks\n beside it rather than running on above it.\n\n Inside the inset it began below the header, which read as a panel\n belonging to the page. As a sibling it reads as what it is: a second\n rail, the mirror of the navigation one, that the whole application\n makes room for. `SidebarInset` is `flex-1`, so opening the panel\n displaces the content instead of covering it — the property this panel\n has always been built around.\n */}\n {docPanel}\n {/*\n The unsaved-changes guard's dialog. The guard is `<BuroProvider>`'s;\n registering the dialog here is what turns its leave prompt from a\n `window.confirm` into this one, with nothing for the app to mount.\n */}\n <NavigationGuardDialog />\n </>\n );\n\n if (sidebar === null || sidebar === undefined || sidebar === false) {\n // The same wrapper the provider draws, minus the sidebar context.\n return (\n <TooltipProvider delayDuration={0}>\n <div className=\"group/sidebar-wrapper flex h-svh w-full\">{frame}</div>\n </TooltipProvider>\n );\n }\n return (\n <SidebarProvider open={open} onOpenChange={handleOpenChange}>\n {frame}\n </SidebarProvider>\n );\n}\n","import type { ReactElement, ReactNode } from 'react';\n\n/** The rounded primary-coloured square shared by `SidebarBrand` and `ScopeSwitcher`. */\nexport function BrandTile({\n children,\n 'data-testid': testId,\n}: {\n children: ReactNode;\n 'data-testid'?: string;\n}): ReactElement {\n return (\n <div\n data-testid={testId}\n className=\"bg-primary text-primary-foreground flex size-8 shrink-0 items-center justify-center rounded-lg\"\n >\n {children}\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { BrandTile } from './brand-tile.js';\nimport { type ShellBrand, useShell } from './shell-context.js';\n\n/** Tile, name and subtitle. Shared by `SidebarBrand` (inside its menu button) and `BrandMark`. */\nexport function BrandMarkContent({\n brand,\n tileTestId,\n}: {\n brand: ShellBrand;\n tileTestId: string;\n}): ReactElement {\n return (\n <>\n <BrandTile data-testid={tileTestId}>\n {brand.logo ?? Array.from(brand.name)[0]?.toUpperCase()}\n </BrandTile>\n <div className=\"grid flex-1 text-left group-data-[collapsible=icon]:hidden text-sm leading-tight\">\n <span className=\"truncate font-medium\">{brand.name}</span>\n {brand.subtitle !== undefined ? (\n <span className=\"truncate text-xs\">{brand.subtitle}</span>\n ) : null}\n </div>\n </>\n );\n}\n\n/**\n * The `ShellProvider` brand as a standalone mark — `SidebarBrand` without the sidebar button.\n * `AuthPage` shows it when given no `brand`. Renders nothing without a brand.\n */\nexport function BrandMark(): ReactElement | null {\n const { brand } = useShell();\n if (brand === undefined) return null;\n return (\n <div data-testid=\"brand-mark\" className=\"flex items-center gap-2\">\n <BrandMarkContent brand={brand} tileTestId=\"brand-mark:tile\" />\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { useEffect } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '../primitives/sidebar.js';\nimport { BrandMarkContent } from './brand-mark.js';\nimport { useShell } from './shell-context.js';\n\n/** The brand tile, name and subtitle at the top of the sidebar; reads `AppShell brand` / `ShellProvider brand`. */\nexport function SidebarBrand(): ReactElement | null {\n const { brand } = useShell();\n const RouterLink = useLinkComponent();\n const missing = brand === undefined;\n useEffect(() => {\n if (missing && process.env.NODE_ENV !== 'production') {\n console.warn(\n '[buro] SidebarBrand rendered without a brand: pass AppShell brand={…} or wrap in <ShellProvider brand>',\n );\n }\n }, [missing]);\n if (brand === undefined) return null;\n return (\n <SidebarMenu data-testid=\"sidebar-brand\">\n <SidebarMenuItem>\n <SidebarMenuButton size=\"lg\" asChild tooltip={brand.name}>\n <RouterLink href={brand.homePath ?? '/'}>\n <BrandMarkContent brand={brand} tileTestId=\"sidebar-brand:tile\" />\n </RouterLink>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * A shell component's slot. Omit it (or pass `undefined`, which is the same\n * thing) to get the component's default; pass `false` to leave the slot\n * empty; pass anything else to replace the default with it. `null` is an\n * element like any other: it replaces the default and renders nothing.\n */\nexport type Slot = ReactNode | false;\n\n/** Resolves a slot: `false` → `null`, `undefined` → `fallback()`, anything else as is. */\nexport function fill(slot: Slot | undefined, fallback: () => ReactNode): ReactNode {\n if (slot === false) return null;\n if (slot === undefined) return fallback();\n return slot;\n}\n","'use client';\n\nimport * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { cn } from '../lib/cn.js';\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn('aspect-square h-full w-full', className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n 'flex h-full w-full items-center justify-center rounded-full bg-muted',\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","'use client';\nimport { useCallback, useContext, useMemo } from 'react';\nimport { I18nContext, useChangeLocale, useLanguageStorageKey, useLocale } from '@burojs/react';\nimport { saveLocale } from '../layout/language-storage.js';\n\nexport interface LanguageSwitchApi {\n /** The active locale code. */\n readonly locale: string;\n /** Every locale the app can switch to; just the active one when the i18n facade does not list them. */\n readonly locales: readonly string[];\n /** Switch the live locale (no reload) and persist the choice under the provider's `languageStorageKey`. */\n readonly change: (code: string) => void;\n}\n\n/**\n * The headless model behind every language control: the active locale, the\n * locales on offer, and a `change` that switches live and remembers the pick.\n * `<LanguageSwitch>`, `<LanguageSubmenu>` and the palette actions are views\n * over it; an app's own control can be one too.\n */\nexport function useLanguageSwitch(): LanguageSwitchApi {\n const locale = useLocale();\n const i18n = useContext(I18nContext);\n const changeLocale = useChangeLocale();\n const storageKey = useLanguageStorageKey();\n const locales = useMemo(() => i18n?.locales?.() ?? [locale], [i18n, locale]);\n const change = useCallback(\n (code: string) => {\n saveLocale(code, storageKey);\n changeLocale(code);\n },\n [changeLocale, storageKey],\n );\n return { locale, locales, change };\n}\n","'use client';\nimport { I18nContext, useOptionalT } from '@burojs/react';\nimport { type ReactElement, useContext, useMemo } from 'react';\nimport type { ActionItem } from '../layout/command-palette-actions-group.js';\nimport {\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../primitives/dropdown-menu.js';\nimport { useLanguageSwitch } from './use-language-switch.js';\n\n/**\n * A locale's name in its own language (\"English\", \"Deutsch\", \"Français\"),\n * capitalised. Falls back to the bare code when `Intl.DisplayNames` does not\n * know it (or the code is not a valid BCP-47 tag).\n */\nexport function localeLabel(code: string): string {\n try {\n const name = new Intl.DisplayNames([code], { type: 'language' }).of(code);\n if (name !== undefined && name !== code) {\n return name.charAt(0).toLocaleUpperCase(code) + name.slice(1);\n }\n } catch {\n // An invalid tag throws a RangeError: fall through to the code.\n }\n return code;\n}\n\n/**\n * Radio submenu over the app's locales. Renders nothing only when there is no\n * i18n facade; with one locale it still renders that one choice (hiding a\n * single-locale row is the default menu's decision, not this part's).\n */\nexport function LanguageSubmenu(): ReactElement | null {\n const t = useOptionalT();\n const hasI18n = useContext(I18nContext) !== null;\n const { locale, locales, change } = useLanguageSwitch();\n if (!hasI18n) return null;\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid=\"language-submenu\">\n {t('language.label', { defaultValue: 'Language' })}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup value={locale} onValueChange={change}>\n {locales.map((code) => (\n <DropdownMenuRadioItem key={code} value={code} data-testid={`language-submenu:${code}`}>\n {localeLabel(code)}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\n/** One command-palette action per locale; empty unless the app has more than one. */\nexport function useLanguagePaletteActions(): ActionItem[] {\n const t = useOptionalT();\n const { locales, change } = useLanguageSwitch();\n const label = t('language.label', { defaultValue: 'Language' });\n // `t` is a fresh closure each render; the label and locale are what it varies by.\n // biome-ignore lint/correctness/useExhaustiveDependencies: see above\n return useMemo(\n () =>\n locales.length < 2\n ? []\n : locales.map((code) => ({\n id: `language-${code}`,\n label: `${label}: ${localeLabel(code)}`,\n keywords: `language locale ${code}`,\n onRun: () => change(code),\n })),\n [locales, label, change],\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { IconDeviceDesktop, IconMoon, IconSun } from '@tabler/icons-react';\nimport { type ReactElement, useMemo } from 'react';\nimport type { ActionItem } from '../layout/command-palette-actions-group.js';\nimport { THEME_CHOICES, type ThemeChoice, useTheme } from '../layout/use-theme.js';\nimport { Button } from '../primitives/button.js';\nimport {\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n} from '../primitives/dropdown-menu.js';\n\nconst THEME_DEFAULTS: Record<ThemeChoice, string> = {\n light: 'Light',\n dark: 'Dark',\n system: 'System',\n};\n\nfunction isThemeChoice(value: string): value is ThemeChoice {\n return (THEME_CHOICES as readonly string[]).includes(value);\n}\n\n/** Radio submenu over {@link THEME_CHOICES}, bound to the stored choice (not the resolved theme). */\nexport function ThemeSubmenu(): ReactElement {\n const t = useOptionalT();\n const { choice, setTheme } = useTheme();\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger data-testid=\"theme-submenu\">\n {t('theme.label', { defaultValue: 'Theme' })}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={choice}\n onValueChange={(value) => {\n if (isThemeChoice(value)) setTheme(value);\n }}\n >\n {THEME_CHOICES.map((c) => (\n <DropdownMenuRadioItem key={c} value={c} data-testid={`theme-submenu:${c}`}>\n {t(`theme.${c}`, { defaultValue: THEME_DEFAULTS[c] })}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\nconst NEXT_CHOICE: Record<ThemeChoice, ThemeChoice> = {\n light: 'dark',\n dark: 'system',\n system: 'light',\n};\n\n/** Icon button cycling light, dark, system. The icon shows the current choice. */\nexport function ThemeToggle(): ReactElement {\n const t = useOptionalT();\n const { choice, setTheme } = useTheme();\n const Icon = choice === 'light' ? IconSun : choice === 'dark' ? IconMoon : IconDeviceDesktop;\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t('theme.label', { defaultValue: 'Theme' })}\n data-testid=\"theme-toggle\"\n data-theme-choice={choice}\n onClick={() => setTheme(NEXT_CHOICE[choice])}\n >\n <Icon aria-hidden=\"true\" />\n </Button>\n );\n}\n\n/** One command-palette action per theme choice. */\nexport function useThemePaletteActions(): ActionItem[] {\n const t = useOptionalT();\n const { setTheme } = useTheme();\n const label = t('theme.label', { defaultValue: 'Theme' });\n const names = THEME_CHOICES.map((c) => t(`theme.${c}`, { defaultValue: THEME_DEFAULTS[c] }));\n const key = names.join('\\u0000');\n // `t` is a fresh closure each render; the translated strings are what it varies by.\n // biome-ignore lint/correctness/useExhaustiveDependencies: see above\n return useMemo(\n () =>\n THEME_CHOICES.map((c, i) => ({\n id: `theme-${c}`,\n label: `${label}: ${names[i]}`,\n keywords: `theme appearance ${c}`,\n onRun: () => setTheme(c),\n })),\n [label, key, setTheme],\n );\n}\n","import type { AuthResult } from '@burojs/core';\nimport { useIdentity, useLogout, useOptionalAuthController, useRouterAdapter } from '@burojs/react';\nimport { useCallback, useMemo } from 'react';\n\nimport { type ShellUser, useShell } from './shell-context.js';\n\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const first = words[0];\n if (first === undefined) return '?';\n const letters =\n words.length > 1\n ? Array.from(first)[0]! + Array.from(words[1]!)[0]!\n : Array.from(first).slice(0, 2).join('');\n return letters.toUpperCase();\n}\n\nexport interface CurrentUser {\n readonly user: ShellUser | null;\n /** The identity is being fetched. `false` for a query that is idle (session not ready) or absent. */\n readonly isLoading: boolean;\n /** `false` when the app has no `authProvider`: there is no identity to show and no logout to run. */\n readonly available: boolean;\n /**\n * Logs out, then goes to the shell's `loginPath`; stays put on `{ success: false }`. Returns the\n * result. Rejects when the auth provider's `logout` throws instead of returning a result.\n */\n readonly signOut: () => Promise<AuthResult>;\n}\n\n/**\n * The signed-in user as the shell shows it. Never throws: without an `authProvider` it reports\n * `available: false` and no user.\n */\nexport function useCurrentUser(): CurrentUser {\n // Stable for the life of the provider tree, so the hooks below are called consistently.\n const hasAuth = useOptionalAuthController() !== null;\n return hasAuth ? useAuthenticatedUser() : useUnauthenticatedUser();\n}\n\nfunction useUnauthenticatedUser(): CurrentUser {\n const { loginPath } = useShell();\n const { push } = useRouterAdapter();\n const signOut = useCallback(async (): Promise<AuthResult> => {\n push(loginPath);\n return { success: true };\n }, [push, loginPath]);\n return { user: null, isLoading: false, available: false, signOut };\n}\n\nfunction useAuthenticatedUser(): CurrentUser {\n const { mapUser, loginPath } = useShell();\n const identity = useIdentity();\n const { mutateAsync } = useLogout();\n const { push } = useRouterAdapter();\n const data = identity.data;\n const user = useMemo<ShellUser | null>(() => {\n if (data === undefined || data === null) return null;\n const mapped = mapUser(data);\n return { ...mapped, initials: initialsOf(mapped.name) };\n }, [data, mapUser]);\n const signOut = useCallback(async (): Promise<AuthResult> => {\n const result = await mutateAsync(undefined);\n if (result.success) push(loginPath);\n return result;\n }, [mutateAsync, push, loginPath]);\n return {\n user,\n isLoading: identity.isPending && identity.fetchStatus !== 'idle',\n available: true,\n signOut,\n };\n}\n","'use client';\nimport { useOptionalT, useRouterAdapter } from '@burojs/react';\nimport { IconLogin, IconLogout, IconSelector, IconUser } from '@tabler/icons-react';\nimport {\n Children,\n cloneElement,\n Fragment,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { THEME_CHOICES } from '../layout/use-theme.js';\nimport { Avatar, AvatarFallback, AvatarImage } from '../primitives/avatar.js';\nimport { Button } from '../primitives/button.js';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../primitives/dropdown-menu.js';\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useOptionalSidebar,\n} from '../primitives/sidebar.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { LanguageSubmenu } from './language-submenu.js';\nimport { useShell } from './shell-context.js';\nimport { ThemeSubmenu } from './theme-controls.js';\nimport { useCurrentUser } from './use-current-user.js';\nimport { useLanguageSwitch } from './use-language-switch.js';\n\nexport interface UserMenuProps {\n /** `'sidebar'`: the sidebar-footer row (avatar, name, email). `'avatar'`: a round avatar button for a header. Default `'sidebar'`. */\n variant?: 'sidebar' | 'avatar';\n /**\n * The menu's parts, in the order given. Omit to get the default set: Profile, Theme, Language\n * (only with more than one locale) and Sign out. Passed parts always render. Signed out, the\n * menu shows the passed parts except `Profile` and `SignOut`, then \"Sign in\"; the default set\n * signed out is Theme, Language and \"Sign in\".\n */\n children?: ReactNode;\n}\n\nfunction Profile(): ReactElement {\n const { user } = useCurrentUser();\n return (\n <DropdownMenuLabel className=\"font-normal\" data-testid=\"user-menu:profile\">\n <div className=\"grid text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user?.name ?? ''}</span>\n {user?.email !== undefined && (\n <span className=\"truncate text-xs text-muted-foreground\">{user.email}</span>\n )}\n </div>\n </DropdownMenuLabel>\n );\n}\n\nfunction Theme(): ReactElement {\n return <ThemeSubmenu />;\n}\n\nfunction Language(): ReactElement | null {\n return <LanguageSubmenu />;\n}\n\nfunction Separator(): ReactElement {\n return <DropdownMenuSeparator />;\n}\n\ntype ItemProps = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n} & ({ href: string; onSelect?: never } | { onSelect: () => void; href?: never });\n\nfunction Item(props: ItemProps): ReactElement {\n const { id, label, icon } = props;\n const RouterLink = useLinkComponent();\n const content = (\n <>\n {icon}\n {label}\n </>\n );\n if (props.href !== undefined) {\n return (\n <DropdownMenuItem asChild data-testid={`user-menu:item:${id}`}>\n <RouterLink href={props.href}>{content}</RouterLink>\n </DropdownMenuItem>\n );\n }\n return (\n <DropdownMenuItem data-testid={`user-menu:item:${id}`} onSelect={props.onSelect}>\n {content}\n </DropdownMenuItem>\n );\n}\n\nfunction SignOut(): ReactElement {\n const t = useOptionalT();\n const { signOut } = useCurrentUser();\n return (\n <DropdownMenuItem data-testid=\"user-menu:sign-out\" onSelect={() => void signOut()}>\n <IconLogout aria-hidden=\"true\" />\n {t('auth.signOut', { defaultValue: 'Sign out' })}\n </DropdownMenuItem>\n );\n}\n\n/** The signed-out menu's last row: navigates to the shell's login path. */\nfunction SignIn(): ReactElement {\n const t = useOptionalT();\n const { loginPath } = useShell();\n const { push } = useRouterAdapter();\n return (\n <DropdownMenuItem data-testid=\"user-menu:sign-in\" onSelect={() => push(loginPath)}>\n <IconLogin aria-hidden=\"true\" />\n {t('auth.signIn', { defaultValue: 'Sign in' })}\n </DropdownMenuItem>\n );\n}\n\n/**\n * Adopter parts for a signed-out reader: everything except the two that need an identity,\n * `Profile` and `SignOut`, looking through fragments.\n */\nfunction withoutAccountParts(children: ReactNode): ReactNode {\n return Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return child;\n if (child.type === Profile || child.type === SignOut) return null;\n if (child.type === Fragment) {\n return cloneElement(child, undefined, withoutAccountParts(child.props.children));\n }\n return child;\n });\n}\n\nfunction SignedOutDefaultParts(): ReactElement {\n const { locales } = useLanguageSwitch();\n const theme = THEME_CHOICES.length > 1;\n const language = locales.length > 1;\n return (\n <>\n {theme && <Theme />}\n {language && <Language />}\n {(theme || language) && <Separator />}\n <SignIn />\n </>\n );\n}\n\nfunction DefaultParts(): ReactElement {\n const { locales } = useLanguageSwitch();\n return (\n <>\n <Profile />\n <Separator />\n {THEME_CHOICES.length > 1 && <Theme />}\n {locales.length > 1 && <Language />}\n <Separator />\n <SignOut />\n </>\n );\n}\n\nfunction UserMenuRoot({ variant = 'sidebar', children }: UserMenuProps): ReactElement | null {\n const t = useOptionalT();\n const { user, isLoading, available } = useCurrentUser();\n const sidebar = useOptionalSidebar();\n const isSidebar = variant === 'sidebar';\n\n // No auth provider: there is no identity to show and nothing to sign in to.\n if (!available) return null;\n\n if (isLoading) {\n return (\n <Skeleton\n data-testid=\"user-menu:loading\"\n className={isSidebar ? 'h-12 w-full rounded-lg' : 'size-8 rounded-full'}\n />\n );\n }\n\n if (user === null) {\n // Signed out: still a menu, so theme and language stay reachable, ending in \"Sign in\".\n const label = t('auth.signIn', { defaultValue: 'Sign in' });\n const signedOutContent = (\n <DropdownMenuContent\n data-testid=\"user-menu\"\n className=\"min-w-56 rounded-lg\"\n side={isSidebar && sidebar?.isMobile === false ? 'right' : 'bottom'}\n align=\"end\"\n sideOffset={4}\n >\n {children === undefined || children === null ? (\n <SignedOutDefaultParts />\n ) : (\n <>\n {withoutAccountParts(children)}\n <SignIn />\n </>\n )}\n </DropdownMenuContent>\n );\n let trigger: ReactElement;\n if (!isSidebar) {\n trigger = (\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n aria-label={label}\n className=\"rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Avatar className=\"size-8\">\n <AvatarFallback>\n <IconUser className=\"size-4\" aria-hidden=\"true\" />\n </AvatarFallback>\n </Avatar>\n </button>\n );\n } else if (sidebar === null) {\n trigger = (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" data-testid=\"user-menu:trigger\">\n <IconLogin aria-hidden=\"true\" />\n {label}\n </Button>\n );\n } else {\n trigger = (\n <SidebarMenuButton tooltip={label} data-testid=\"user-menu:trigger\">\n <IconLogin aria-hidden=\"true\" />\n <span>{label}</span>\n </SidebarMenuButton>\n );\n }\n const menu = (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>\n {signedOutContent}\n </DropdownMenu>\n );\n if (!isSidebar || sidebar === null) return menu;\n return (\n <SidebarMenu>\n <SidebarMenuItem>{menu}</SidebarMenuItem>\n </SidebarMenu>\n );\n }\n\n const avatar = (\n <Avatar className={isSidebar ? 'h-8 w-8 rounded-lg' : 'size-8'}>\n {user.avatarUrl !== undefined && <AvatarImage src={user.avatarUrl} alt=\"\" />}\n <AvatarFallback className={isSidebar ? 'rounded-lg' : undefined}>\n {user.initials}\n </AvatarFallback>\n </Avatar>\n );\n\n const content = (\n <DropdownMenuContent\n data-testid=\"user-menu\"\n className={\n isSidebar ? 'w-[var(--radix-dropdown-menu-trigger-width)] min-w-56 rounded-lg' : 'min-w-56'\n }\n side={isSidebar ? (sidebar?.isMobile === false ? 'right' : 'bottom') : 'bottom'}\n align=\"end\"\n sideOffset={4}\n >\n {children === undefined || children === null ? <DefaultParts /> : children}\n </DropdownMenuContent>\n );\n\n if (!isSidebar) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n aria-label={\n user.name.trim() !== '' ? user.name : t('shell.account', { defaultValue: 'Account' })\n }\n className=\"rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {avatar}\n </button>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n }\n\n const rowContent = (\n <>\n {avatar}\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user.name}</span>\n {user.email !== undefined && <span className=\"truncate text-xs\">{user.email}</span>}\n </div>\n <IconSelector className=\"ml-auto size-4\" aria-hidden=\"true\" />\n </>\n );\n\n // Outside a SidebarProvider the sidebar primitives cannot mount: same row, plain button.\n if (sidebar === null) {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-testid=\"user-menu:trigger\"\n className=\"flex w-full items-center gap-2 rounded-lg p-2 outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent\"\n >\n {rowContent}\n </button>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n }\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n data-testid=\"user-menu:trigger\"\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {rowContent}\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n );\n}\n\n/**\n * The user's menu. Fills each part you do not pass with its default; passed children replace\n * the default set. `UserMenu.Profile`, `.Theme`, `.Language`, `.Separator`, `.Item` and\n * `.SignOut` are the parts. Signed out it is still a menu — the parts that need no identity,\n * then \"Sign in\" (`user-menu:sign-in`) — so theme and language stay reachable. Renders nothing\n * without an auth provider.\n */\nexport const UserMenu = Object.assign(UserMenuRoot, {\n Profile,\n Theme,\n Language,\n Separator,\n Item,\n SignOut,\n});\n","'use client';\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n","'use client';\n\nimport { ComponentsContext } from '@burojs/react';\nimport { type ComponentType, type ReactNode, useCallback, useContext } from 'react';\nimport { Icon, hasIcon } from '../primitives/icon.js';\n\nconst warned = new Set<string>();\n\n/**\n * Resolve a nav icon NAME to a node: a Components-registry slot of that key\n * first, then the `registerIcons` registry. An unknown name yields `undefined`\n * (no placeholder circle) and, outside production, warns once per name.\n */\nexport function resolveNavIcon(\n name: string | undefined,\n components: (key: string) => unknown,\n): ReactNode | undefined {\n if (name === undefined || name === '') return undefined;\n const slot = components(name);\n if (typeof slot === 'function' || (typeof slot === 'object' && slot !== null)) {\n const C = slot as ComponentType<{ className?: string }>;\n return <C className=\"h-4 w-4\" />;\n }\n if (hasIcon(name)) return <Icon name={name} />;\n if (process.env.NODE_ENV !== 'production' && !warned.has(name)) {\n warned.add(name);\n console.warn(`[buro] unknown nav icon \"${name}\"`);\n }\n return undefined;\n}\n\n/** `resolveNavIcon` bound to the Components registry in context. */\nexport function useNavIcon(): (name: string | undefined) => ReactNode | undefined {\n const components = useContext(ComponentsContext);\n return useCallback(\n (name: string | undefined) => resolveNavIcon(name, (key) => components[key]),\n [components],\n );\n}\n","'use client';\nimport { usePermissionsUndecided } from '@burojs/react';\n\n/**\n * Whether the shell is waiting for the permission map (D6): true while it loads. The one place\n * that decides it — the shell's children, the sidebar's nav items and the palette's discovery\n * groups all read this, so they wait together and never disagree. No map and a ready map are\n * both decided; the wait ends the moment the map is ready.\n */\nexport function useShellWaiting(): boolean {\n return usePermissionsUndecided();\n}\n","'use client';\nimport {\n type CustomPageDef,\n type NavGroupDef,\n type NavNode,\n type ResourceDef,\n type SectionDef,\n hasListPage,\n hrefFor,\n isCustomPageDef,\n nodeKind,\n resolveNavLabel,\n resolveResourceNavLabel,\n declaredText,\n} from '@burojs/core';\nimport { useApp, useI18nCaps, useOptionalRouterAdapter } from '@burojs/react';\nimport { canonicalNavKey, canonicalResourceKey } from '../resource-key.js';\nimport { buildNavItems, groupNavHref } from './build-nav-items.js';\nimport type { NavItem } from './nav-slots.js';\nimport { useLayoutResolver, useReportUnresolvedLayouts } from './nav-slots.js';\nimport { useMatch, useNavVisible, usePageAllowed, useResourceVisible } from './use-nav-routing.js';\n\n/**\n * How a group presents its children. `flat` and `collapsible` expand inline in\n * the sidebar; any other value is the key of a registered content layout\n * (`tabs`, `secondary-sidebar`, or an app's own), and the sidebar shows the\n * group as ONE link into its area.\n */\nexport type NavTreeLayout = 'flat' | 'collapsible' | 'tabs' | 'secondary-sidebar' | (string & {});\n\n/** One navigable entry. `icon` is the declared icon NAME; the renderer resolves it. */\nexport type NavTreeEntry =\n | {\n kind: 'resource' | 'page';\n key: string;\n label: string;\n href: string;\n icon?: string;\n active: boolean;\n }\n | {\n kind: 'group';\n key: string;\n label: string;\n href?: string;\n icon?: string;\n /** For a content group: its link is the current location. Otherwise: an ancestor of it. */\n active: boolean;\n layout: NavTreeLayout;\n /** Declared `defaultOpen`, or the active page lives inside. */\n defaultOpen: boolean;\n children: NavTreeEntry[];\n };\n\n/**\n * One block of the sidebar. The first block is the ungrouped top level, with\n * `key: null` and `label: null`: the renderer decides its heading. A block with\n * a key and `label: null` is a content group's own link and has no heading.\n */\nexport interface NavTreeSection {\n key: string | null;\n label: string | null;\n icon?: string;\n collapsible: boolean;\n /** Open on first render: declared `defaultOpen`, or `active`. */\n defaultOpen: boolean;\n /** One of the entries is the page currently shown. Drives re-opening a collapsed block. */\n active: boolean;\n entries: NavTreeEntry[];\n}\n\nexport interface UseNavTreeOptions {\n /**\n * Extra allow-filter applied to every nav entry (resources, custom pages and\n * groups) on top of the built-in visibility rules. Return false to hide an\n * entry. Defaults to always-true.\n */\n entryFilter?: (entry: NavNode) => boolean;\n}\n\nexport function isActiveHref(href: string, currentPath: string | undefined): boolean {\n if (!currentPath) return false;\n if (currentPath === href) return true;\n if (href === '/') return false;\n return currentPath.startsWith(`${href}/`);\n}\n\n/**\n * The sidebar's navigation as plain data: what `<NavMain>` draws, with every\n * visibility rule, permission gate, sort, label and active flag already\n * applied. Build a custom nav on it and it shows the same entries.\n */\nexport function useNavTree(opts: UseNavTreeOptions = {}): NavTreeSection[] {\n const { entryFilter } = opts;\n // The location is the router adapter's, the one seam every host mounts.\n // Without one (a story, a test) nothing is active and nothing is said.\n const currentPath = useOptionalRouterAdapter()?.pathname;\n const passesEntryFilter = (entry: NavNode): boolean => (entryFilter ? entryFilter(entry) : true);\n const app = useApp();\n const caps = useI18nCaps();\n const isResourceVisible = useResourceVisible();\n\n const resolveLayout = useLayoutResolver();\n const match = useMatch();\n const isVisible = useNavVisible();\n // A page's `requires` decides its entry (P7 3.13): undecided or denied draws nothing.\n const pageAllowed = usePageAllowed();\n const isNavEligible = (node: NavNode): boolean => isVisible(node) && passesEntryFilter(node);\n\n const allResources = app.registry.list();\n const allCustomPages = app.registry.customPages.list();\n const sections = app.registry.sections.list();\n const groups = app.registry.groups\n .rootNodes()\n .filter((n) => nodeKind(n) === 'group') as NavGroupDef[];\n\n useReportUnresolvedLayouts(app.registry.groups.list(), resolveLayout);\n\n // Embedded-only subresources are hidden from navigation entirely.\n // Invisible resources are also filtered out.\n const visibleResources = allResources\n .filter((r) => hasListPage(r))\n .filter(isResourceVisible)\n .filter(passesEntryFilter);\n\n // A resource/page with `group` set lives behind a nav group (either its\n // own content-chrome link, or inline under a flat/collapsible group below)\n // and must not also appear as a top-level sidebar item.\n /*\n Sorted by `order`, like every other level of the nav.\n\n `registry.list()` returns REGISTRATION order, while a section's or group's\n children are sorted by `order ?? Infinity`. So `order` on a top-level\n resource silently did nothing — a declaration that looks like it works,\n reads like it works in review, and is ignored. Sorting here makes the one\n rule hold everywhere; a stable index tie-break keeps the previous behaviour\n for everyone who never set it.\n */\n const topLevelResources = visibleResources\n .filter((r) => !r.section && !r.group)\n .map((r, idx) => ({ r, idx }))\n .sort((a, b) => {\n const ao = a.r.order ?? Number.POSITIVE_INFINITY;\n const bo = b.r.order ?? Number.POSITIVE_INFINITY;\n return ao !== bo ? ao - bo : a.idx - b.idx;\n })\n .map((x) => x.r);\n const topLevelCustomPages = allCustomPages\n .filter((p) => !p.section && !p.group)\n .filter(pageAllowed)\n .filter(passesEntryFilter);\n\n const resourceHref = (def: ResourceDef) => hrefFor(app.registry, canonicalResourceKey(def));\n // Shared with `buildNavItems` — see `resolveResourceNavLabel`. The sidebar\n // resolves labels in two places and they must not drift.\n const resourceLabel = (def: ResourceDef) =>\n resolveResourceNavLabel(caps, canonicalResourceKey(def), def);\n const pageLabel = (page: CustomPageDef) =>\n resolveNavLabel(caps, `pages.${canonicalNavKey(page)}`, declaredText('chrome', page, 'label'));\n const sectionLabel = (section: SectionDef) =>\n resolveNavLabel(\n caps,\n `sections.${canonicalNavKey(section)}`,\n declaredText('chrome', section, 'label'),\n );\n const groupLabel = (group: NavGroupDef) =>\n resolveNavLabel(\n caps,\n `groups.${canonicalNavKey(group)}`,\n declaredText('chrome', group, 'label'),\n );\n\n const pageEntry = (page: CustomPageDef): NavTreeEntry => {\n // A custom page owns its declared path even if an internal,\n // non-navigable resource happens to use the same identity.\n const href = page.path;\n return {\n kind: 'page',\n key: canonicalNavKey(page),\n label: pageLabel(page),\n href,\n icon: page.icon,\n active: isActiveHref(href, currentPath),\n };\n };\n const resourceEntry = (def: ResourceDef): NavTreeEntry => {\n const href = resourceHref(def);\n return {\n kind: 'resource',\n key: canonicalResourceKey(def),\n label: resourceLabel(def),\n href,\n icon: def.icon,\n active: isActiveHref(href, currentPath),\n };\n };\n\n const layoutOf = (group: NavGroupDef): NavTreeLayout =>\n resolveLayout(group.layout) ? group.layout : group.collapsible ? 'collapsible' : 'flat';\n\n // A group's children: `buildNavItems` is the one resolver of group members\n // (href via `navHrefFor`, labels, the match-based `active` rule), shared with\n // the content-chrome layouts. Sub-groups recurse.\n const groupChildren = (groupKey: string): NavTreeEntry[] =>\n buildNavItems({\n registry: app.registry,\n caps,\n groupName: groupKey,\n match,\n isVisible,\n entryFilter,\n }).map(itemEntry);\n const groupEntry = (\n group: NavGroupDef,\n label: string,\n href: string,\n active: boolean,\n ): NavTreeEntry => {\n const key = canonicalNavKey(group);\n return {\n kind: 'group',\n key,\n label,\n href,\n icon: group.icon,\n active,\n layout: layoutOf(group),\n defaultOpen: group.defaultOpen === true || active,\n children: groupChildren(key),\n };\n };\n function itemEntry(it: NavItem): NavTreeEntry {\n if (it.kind === 'group') {\n const group = app.registry.groups.get(it.name) as NavGroupDef;\n return groupEntry(group, it.label, it.href, it.active);\n }\n const icon =\n it.kind === 'custom-page'\n ? app.registry.customPages.get(it.name)?.icon\n : app.registry.get(it.name)?.icon;\n return {\n kind: it.kind === 'custom-page' ? 'page' : 'resource',\n key: it.name,\n label: it.label,\n href: it.href,\n icon,\n active: it.active,\n };\n }\n\n const topEntries = [\n ...topLevelCustomPages.map(pageEntry),\n ...topLevelResources.map(resourceEntry),\n ];\n const out: NavTreeSection[] = [\n {\n key: null,\n label: null,\n collapsible: false,\n defaultOpen: true,\n active: topEntries.some((e) => e.active),\n entries: topEntries,\n },\n ];\n\n for (const section of sections) {\n const sectionKey = canonicalNavKey(section);\n // Filter section children: drop resources with no list page, drop invisible\n // resources, and custom pages whose `requires` is not decided in favour.\n const entries = app.registry.sections\n .childrenOf(sectionKey)\n .filter((c) => !('parent' in c) || hasListPage(c))\n .filter((c) => (isCustomPageDef(c) ? pageAllowed(c) : isResourceVisible(c)))\n .filter(passesEntryFilter)\n .map((c) => (isCustomPageDef(c) ? pageEntry(c) : resourceEntry(c)));\n if (entries.length === 0) continue;\n const active = entries.some((e) => e.active);\n out.push({\n key: sectionKey,\n label: sectionLabel(section),\n icon: section.icon,\n collapsible: section.collapsible === true,\n defaultOpen: section.defaultOpen === true || active,\n active,\n entries,\n });\n }\n\n for (const group of groups) {\n const groupKey = canonicalNavKey(group);\n if (!isNavEligible(group)) continue;\n const gLabel = groupLabel(group);\n\n if (resolveLayout(group.layout)) {\n // A content group (tabs / secondary-sidebar / a registered layout) owns\n // its chrome, so the sidebar shows it as ONE link into its area — none\n // when no member is reachable: such a group has no area to open.\n const href = groupNavHref(app.registry, groupKey, isNavEligible);\n if (href === undefined) continue;\n const entry = groupEntry(group, gLabel, href, isActiveHref(href, currentPath));\n out.push({\n key: groupKey,\n label: null,\n collapsible: false,\n defaultOpen: false,\n active: entry.active,\n entries: [entry],\n });\n continue;\n }\n\n // Flat / collapsible group: no dedicated content chrome, so its\n // children render inline in the main sidebar (same shape as a\n // section) rather than behind a single group link.\n const entries = groupChildren(groupKey);\n if (entries.length === 0) continue;\n const active = entries.some((e) => e.active);\n out.push({\n key: groupKey,\n label: gLabel,\n icon: group.icon,\n collapsible: group.collapsible === true,\n defaultOpen: group.defaultOpen === true || active,\n active,\n entries,\n });\n }\n\n return out;\n}\n","'use client';\nimport type { CustomPageDef, NavNode, ResourceDef, SectionDef } from '@burojs/core';\nimport { useApp, useOriginIntent, useT, useTestIds } from '@burojs/react';\nimport { IconChevronRight } from '@tabler/icons-react';\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../primitives/collapsible.js';\nimport {\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSkeleton,\n SidebarMenuSubItem,\n} from '../primitives/sidebar.js';\nimport { useLinkComponent } from './link-component.js';\nimport { useNavIcon } from '../shell/use-nav-icon.js';\nimport { useShellWaiting } from '../shell/use-shell-waiting.js';\nimport { type NavTreeEntry, useNavTree } from './use-nav-tree.js';\n\nexport interface NavMainProps {\n iconForResource?: (def: ResourceDef) => ReactNode;\n iconForCustomPage?: (def: CustomPageDef) => ReactNode;\n /** Icon for a collapsible section's trigger row (#16). */\n iconForSection?: (def: SectionDef) => ReactNode;\n /**\n * Extra allow-filter applied to every nav entry (resources, custom pages,\n * and groups) on top of the built-in visibility rules. The\n * app owns the policy — e.g. reduce the sidebar to a companies/users/logs\n * allow-list in admin (\"stand\") mode (#12) — while the framework stays\n * generic. Return false to hide an entry. Defaults to always-true.\n */\n entryFilter?: (entry: NavNode) => boolean;\n /**\n * Heading for the ungrouped block at the top of the sidebar.\n *\n * `null` renders NO heading — the entries sit bare above the first named\n * section. That is the right shape when the block holds the two or three\n * places a user starts from («Home», the codes, the products): an eyebrow\n * over them has to invent a category, and every word that fits («Resources»,\n * «Misc») is less informative than the item names already are.\n *\n * Omitted → the framework's own `nav.resources` string, as before.\n */\n topLabel?: string | null;\n}\n\ninterface CollapsibleNavSectionProps {\n /** Section or group name — drives the test ids. */\n name: string;\n label: string;\n icon?: ReactNode;\n /** True when one of the children is the page currently being shown. */\n hasActiveChild: boolean;\n /** Declared `defaultOpen` on the section/group definition. */\n declaredOpen: boolean;\n children: ReactNode;\n}\n\n/**\n * One collapsible nav row plus its submenu. Shared by `section.collapsible`\n * and `group.collapsible`, which rendered byte-identical trees.\n *\n * ⚠️ Owns two behaviours a bare `<Collapsible defaultOpen>` does not have:\n *\n * 1. **Scroll the revealed children into view.** The sidebar's nav list\n * scrolls independently of its sticky footer, so a collapsible sitting near\n * the bottom expanded into space nobody could see: acceptance testing\n * clicked «Monitoring», watched the chevron rotate, and saw none of its five\n * children — the click read as broken. Opening now scrolls down just far\n * enough to show the submenu, and never so far that the group's own row\n * leaves the viewport, so the user keeps their place.\n *\n * 2. **Re-open when the active page moves inside it.** `defaultOpen` is only\n * read at mount, and the sidebar stays mounted across soft navigations — so\n * arriving at a page inside a collapsed group (via the command palette, a\n * breadcrumb, or a link) left the current location hidden behind a closed\n * submenu, which is exactly what the `defaultOpen` expression was written to\n * prevent.\n */\nfunction CollapsibleNavSection({\n name,\n label,\n icon,\n hasActiveChild,\n declaredOpen,\n children,\n}: CollapsibleNavSectionProps): React.ReactElement {\n const itemRef = useRef<HTMLLIElement>(null);\n const [open, setOpen] = useState(declaredOpen || hasActiveChild);\n\n /**\n * Reveal the submenu inside the sidebar's own scroll container.\n *\n * Deliberately NOT `Element.scrollIntoView`: that also scrolls every\n * scrollable ancestor, including the document, so expanding a nav group\n * could jump the page content behind it.\n */\n const revealSubmenu = useCallback(() => {\n const el = itemRef.current;\n const scroller = el?.closest<HTMLElement>('[data-sidebar=\"content\"]');\n if (!el || !scroller) return;\n const er = el.getBoundingClientRect();\n const sr = scroller.getBoundingClientRect();\n const hiddenBelow = er.bottom - sr.bottom;\n if (hiddenBelow <= 0) return;\n // Never scroll past the group's own row — losing the header you just\n // clicked is more disorienting than not seeing the last child.\n const maxScroll = Math.max(0, er.top - sr.top);\n scroller.scrollTop += Math.min(hiddenBelow + 8, maxScroll);\n }, []);\n\n const handleOpenChange = useCallback(\n (next: boolean) => {\n setOpen(next);\n // One frame, so the submenu has been laid out and its height counts.\n if (next) requestAnimationFrame(revealSubmenu);\n },\n [revealSubmenu],\n );\n\n // Behaviour 2. Only ever opens — never yanks a group shut that the user\n // deliberately opened.\n useEffect(() => {\n if (hasActiveChild) setOpen(true);\n }, [hasActiveChild]);\n\n return (\n <SidebarGroup data-testid={`sidebar-section-group:${name}`}>\n <SidebarGroupContent>\n <SidebarMenu>\n <Collapsible\n asChild\n open={open}\n onOpenChange={handleOpenChange}\n className=\"group/collapsible\"\n >\n <SidebarMenuItem ref={itemRef}>\n <CollapsibleTrigger asChild>\n <SidebarMenuButton tooltip={label} data-testid={`sidebar-section-toggle:${name}`}>\n {icon != null && (\n <span\n className=\"inline-flex h-4 w-4 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n )}\n <span data-testid={`sidebar-section:${name}`}>{label}</span>\n <IconChevronRight className=\"ml-auto h-4 w-4 shrink-0 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90\" />\n </SidebarMenuButton>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <SidebarMenuSub>{children}</SidebarMenuSub>\n </CollapsibleContent>\n </SidebarMenuItem>\n </Collapsible>\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n}\n\nexport function NavMain({\n topLabel,\n iconForResource,\n iconForCustomPage,\n iconForSection,\n entryFilter,\n}: NavMainProps): React.ReactElement {\n // Everything the sidebar shows — visibility, permission gates, sort, labels,\n // active flags — is decided by `useNavTree`. This component only draws it.\n const tree = useNavTree({ entryFilter });\n const app = useApp();\n const tid = useTestIds();\n const t = useT();\n const RouterLink = useLinkComponent();\n const navIcon = useNavIcon();\n const waiting = useShellWaiting();\n // A sidebar entry is a jump: the page it opens starts a fresh trail (navigation origin).\n const intent = useOriginIntent();\n const jump = (entry: NavTreeEntry) => () => {\n if (entry.href !== undefined) intent(entry.href, 'jump');\n };\n\n // The `iconFor*` prop decides first; when it is absent or answers\n // `undefined`, the entry's declared icon name is resolved.\n const ownOr = (own: ReactNode | undefined, name: string | undefined): ReactNode =>\n own !== undefined ? own : navIcon(name);\n // A group goes through `iconForSection` too, as it always has.\n const groupAsSection = (key: string): SectionDef | undefined =>\n app.registry.sections.get(key) ??\n (app.registry.groups.get(key) as unknown as SectionDef | undefined);\n const sectionIcon = (key: string, name: string | undefined): ReactNode => {\n const def = iconForSection ? groupAsSection(key) : undefined;\n return ownOr(def ? iconForSection?.(def) : undefined, name);\n };\n /*\n ⚠️ Custom pages inside a GROUP once got no icon resolver — it was hardcoded\n `undefined`, so a page rendered with an icon in a SECTION and without one\n in a group. Moving a page between the two silently lost its icon, which\n is exactly what happened when «Monitoring» became a group: «Processes»\n and «Application logs» went blank while their resource siblings kept\n theirs. One resolver per entry kind, wherever the entry sits, keeps that\n from coming back.\n */\n const entryIcon = (entry: NavTreeEntry): ReactNode => {\n if (entry.kind === 'group') return sectionIcon(entry.key, entry.icon);\n if (entry.kind === 'page') {\n const page = iconForCustomPage ? app.registry.customPages.get(entry.key) : undefined;\n return ownOr(page ? iconForCustomPage?.(page) : undefined, entry.icon);\n }\n const def = iconForResource ? app.registry.get(entry.key) : undefined;\n return ownOr(def ? iconForResource?.(def) : undefined, entry.icon);\n };\n const entryTestId = (entry: NavTreeEntry): string =>\n entry.kind === 'page'\n ? tid.sidebarCustomPage(entry.key)\n : entry.kind === 'group'\n ? tid.navGroup(entry.key)\n : tid.navMenuItem(entry.key);\n\n const menuItem = (entry: NavTreeEntry): ReactNode => {\n const icon = entryIcon(entry);\n return (\n <SidebarMenuItem key={entry.key}>\n <SidebarMenuButton asChild isActive={entry.active} tooltip={entry.label}>\n <RouterLink\n href={entry.href ?? ''}\n aria-current={entry.active ? 'page' : undefined}\n data-testid={entryTestId(entry)}\n onClick={jump(entry)}\n >\n {icon != null && (\n <span className=\"inline-flex h-4 w-4 items-center justify-center\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span>{entry.label}</span>\n </RouterLink>\n </SidebarMenuButton>\n </SidebarMenuItem>\n );\n };\n // Submenu rows carry no icon: the collapsible row above them already has one.\n const subItem = (entry: NavTreeEntry): ReactNode => (\n <SidebarMenuSubItem key={entry.key}>\n <SidebarMenuSubButton asChild isActive={entry.active}>\n <RouterLink\n href={entry.href ?? ''}\n aria-current={entry.active ? 'page' : undefined}\n data-testid={entryTestId(entry)}\n onClick={jump(entry)}\n >\n <span>{entry.label}</span>\n </RouterLink>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n );\n\n // The map decides which entries exist: until it is ready, a skeleton stands where they will be.\n if (waiting) {\n return (\n <SidebarGroup data-testid=\"sidebar-nav-loading\" aria-busy=\"true\">\n <SidebarGroupContent>\n <SidebarMenu>\n {[0, 1, 2, 3].map((i) => (\n <SidebarMenuItem key={i}>\n <SidebarMenuSkeleton showIcon />\n </SidebarMenuItem>\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n }\n\n const [top, ...blocks] = tree;\n\n return (\n <>\n {/* Every top-level entry filtered out or grouped away: no group, so no lone heading. */}\n {top !== undefined && top.entries.length > 0 && (\n <SidebarGroup>\n {/* `null` means \"no heading\" — see `topLabel`. `undefined` keeps the\n framework default, so existing consumers are untouched. */}\n {topLabel !== null && (\n <SidebarGroupLabel>{topLabel ?? t('nav.resources')}</SidebarGroupLabel>\n )}\n <SidebarGroupContent>\n <SidebarMenu>{top.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n )}\n\n {blocks.map((block) => {\n const key = block.key ?? '';\n // A content group: one link into its area, no heading.\n if (block.label === null) {\n return (\n <SidebarGroup key={key}>\n <SidebarGroupContent>\n <SidebarMenu>{block.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n }\n\n // Collapsible second-level menu (#16): one row that expands to its\n // children, instead of an always-open labelled group. Auto-expands when\n // the active page lives inside it, so the user's current location is\n // never hidden behind a collapsed submenu.\n if (block.collapsible) {\n return (\n <CollapsibleNavSection\n key={key}\n name={key}\n label={block.label}\n icon={sectionIcon(key, block.icon)}\n hasActiveChild={block.active}\n declaredOpen={block.defaultOpen}\n >\n {block.entries.map(subItem)}\n </CollapsibleNavSection>\n );\n }\n\n return (\n <SidebarGroup key={key} data-testid={`sidebar-section-group:${key}`}>\n <SidebarGroupLabel data-testid={`sidebar-section:${key}`}>\n {block.label}\n </SidebarGroupLabel>\n <SidebarGroupContent>\n <SidebarMenu>{block.entries.map(menuItem)}</SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n );\n })}\n </>\n );\n}\n","'use client';\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarHeader,\n SidebarRail,\n} from '../primitives/sidebar.js';\nimport { SidebarBrand } from '../shell/sidebar-brand.js';\nimport { fill, type Slot } from '../shell/slot.js';\nimport { UserMenu } from '../shell/user-menu.js';\nimport { NavMain } from './nav-main.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppSidebarProps {\n /** Top of the sidebar. Default `<SidebarBrand />` (the `ShellProvider` brand). */\n header?: Slot;\n /** Scope filters rendered under the header. No default. */\n filters?: Slot;\n /** Main navigation. Default `<NavMain />`. */\n nav?: Slot;\n /** Footer. Default `<UserMenu />`, which renders nothing without an auth provider. */\n footer?: Slot;\n}\n\nexport function AppSidebar({ header, filters, nav, footer }: AppSidebarProps): React.ReactElement {\n const headerNode = fill(header, () => <SidebarBrand />);\n const filtersNode = fill(filters, () => null);\n const navNode = fill(nav, () => <NavMain />);\n const footerNode = fill(footer, () => <UserMenu />);\n return (\n <Sidebar collapsible=\"icon\">\n {(headerNode != null || filtersNode != null) && (\n <SidebarHeader className=\"empty:hidden\">\n {headerNode}\n {filtersNode}\n </SidebarHeader>\n )}\n <SidebarContent>{navNode}</SidebarContent>\n {footerNode != null && <SidebarFooter className=\"empty:hidden\">{footerNode}</SidebarFooter>}\n <SidebarRail />\n </Sidebar>\n );\n}\n","'use client';\nimport { useApp, useI18nCaps } from '@burojs/react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { buildNavItems, type BuildNavItemsArgs } from './build-nav-items.js';\nimport { NavChromeMountedProvider } from './nav-chrome-mounted.js';\nimport { useLayoutResolver, useReportUnresolvedLayouts } from './nav-slots.js';\nimport { useMatch, useNavVisible } from './use-nav-routing.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nconst DETAIL_ACTIONS = new Set(['show', 'edit', 'create']);\n\nexport interface NavChromeProps {\n children: ReactNode;\n entryFilter?: (node: { name: string }) => boolean;\n icons?: BuildNavItemsArgs['icons'];\n}\n\n/**\n * Wrap the active page in its group-chain chrome. Walks `match.groupChain`\n * innermost→outermost, wrapping the accumulating content in each group's\n * content layout (secondary-sidebar / tabs). Groups whose layout has no\n * content renderer (flat / collapsible — main-sidebar only) contribute no\n * wrapping. No match → children bare (`/login`, a host's own routes).\n *\n * Mount it ONCE in the persistent layout, around whatever the router renders —\n * `AppShell` does this by default. Moving within an area keeps the outer layout\n * element at the same type and position, so React reconciles it in place: the\n * secondary sidebar stays the same DOM node and only its active item changes.\n * Output depends only on the registry, the adapter's pathname and i18n — no\n * effect decides it, so it renders on the server as on the client.\n */\nexport function NavChrome({ children, entryFilter, icons }: NavChromeProps): ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const isVisible = useNavVisible();\n const match = useMatch();\n const resolveLayout = useLayoutResolver();\n useReportUnresolvedLayouts(match?.groupChain ?? [], resolveLayout);\n\n if (!match) return <NavChromeMountedProvider value>{children}</NavChromeMountedProvider>;\n\n let content = children;\n // innermost group is last in groupChain → fold from the end outward.\n for (let i = match.groupChain.length - 1; i >= 0; i--) {\n const group = match.groupChain[i];\n if (!group) continue;\n const groupKey = canonicalNavKey(group);\n // chromeOn: 'list' groups collapse (contribute zero wrapping) on a\n // resource detail action — drilling into a record hides that group's\n // chrome (tabs / secondary-sidebar) entirely.\n if (group.chromeOn === 'list' && match.kind === 'resource' && DETAIL_ACTIONS.has(match.action))\n continue;\n const Layout = resolveLayout(group.layout);\n if (!Layout) continue; // flat/collapsible: no content wrapping\n const items = buildNavItems({\n registry: app.registry,\n caps,\n groupName: groupKey,\n match,\n isVisible,\n entryFilter,\n icons,\n });\n content = (\n <Layout group={group} groupKey={groupKey} items={items}>\n {content}\n </Layout>\n );\n }\n return <NavChromeMountedProvider value>{content}</NavChromeMountedProvider>;\n}\n","'use client';\nimport { routeResourceKey } from '@burojs/core';\nimport type { ResourceNameOrRef } from '@burojs/core';\nimport { hasListPage, hrefFor, resolveResourceLabel } from '@burojs/core';\nimport {\n useApp,\n useDocTrailScopes,\n useI18nCaps,\n useOptionalT,\n useOriginIntent,\n useTestIds,\n} from '@burojs/react';\nimport { IconChevronRight } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\nimport { DocTrailHelp } from '../doc/doc-trail-help.js';\nimport { cn } from '../lib/cn.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useLinkComponent } from './link-component.js';\n\n/** A crumb; `jump` makes its click start a fresh trail (`useOriginIntent`), as a group link does. */\ntype Segment = { label: string; href?: string; jump?: boolean };\n\ninterface BreadcrumbsBaseProps {\n className?: string;\n /**\n * Scopes the trail offers help for, outermost first. Defaults to the resource\n * this breadcrumb is rooted at (none for a trail without a resource).\n */\n docScopes?: string[];\n /**\n * Segments rendered before the resource segment (or before the page label in\n * a trail without one), each followed by a chevron — the group chain. A\n * segment with an `href` renders as a link; without one, as muted text.\n */\n leadingSegments?: Segment[];\n /** Optional testid forwarded to the root nav. */\n 'data-testid'?: string;\n}\n\n/** A trail that ends at, or passes through, a resource: its list link, then the record. */\nexport interface ResourceBreadcrumbsProps<N extends string = string> extends BreadcrumbsBaseProps {\n /** Resource name (the registry key), checked against the registered resources; or its entity ref. */\n resource: ResourceNameOrRef<N>;\n name?: never;\n /** Identifier for the current page (testid only); a record id on show/edit pages. */\n recordId?: string;\n /**\n * Display label for the trailing segment (the current page). When omitted\n * the resource segment itself is the current crumb (a list page).\n */\n pageLabel?: string;\n /**\n * Segments rendered between the resource link and the trailing page label —\n * the record on an edit page («Documents › live-one › Edit»). A segment\n * without `href` renders as plain text.\n */\n middleSegments?: Segment[];\n /**\n * Where the resource crumb links instead of the list's canonical address: the list as the user\n * had it, filters and page included (a record page reached from it, navigation origin).\n */\n resourceHref?: string;\n /**\n * Segments that replace the leading segments and the resource crumb: the trail of the page the\n * user came from when it is not this resource's list (a parent record's card). `middleSegments`\n * are not drawn with them.\n */\n rootSegments?: Segment[];\n}\n\n/** A trail with no resource segment: a custom page or a group index. */\nexport interface PageBreadcrumbsProps extends BreadcrumbsBaseProps {\n resource?: never;\n /** The test-id name of the current crumb: the custom page's or the group's key. */\n name: string;\n /** The current page's label, the trail's last crumb. */\n pageLabel: string;\n recordId?: never;\n middleSegments?: never;\n resourceHref?: never;\n rootSegments?: never;\n}\n\nexport type BreadcrumbsProps<N extends string = string> =\n | ResourceBreadcrumbsProps<N>\n | PageBreadcrumbsProps;\n\nconst LINK_CLASS =\n 'rounded hover:text-foreground transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2';\n\nfunction Chevron(): ReactElement {\n return (\n <IconChevronRight className=\"size-3.5 shrink-0 text-muted-foreground/60\" aria-hidden=\"true\" />\n );\n}\n\n/**\n * The navigation breadcrumb, in two shapes. With `resource`: the leading\n * segments, the resource (a link to its canonical, nesting-aware list href,\n * or the current crumb on a bare list), the middle segments and the page\n * label. Without: the leading segments and the page label only, test ids\n * named by `name`. The last crumb is always the \"you are here\" marker — an\n * emphasised, non-linked span with `aria-current=\"page\"`. Every crumb carries\n * its label as a `title` tooltip, so a truncated one can still be read.\n */\nexport function Breadcrumbs<const N extends string = string>(\n input: BreadcrumbsProps<N>,\n): ReactElement | null {\n // Checked at the call; from here on the name is a plain string or an entity ref.\n const props: BreadcrumbsProps = input;\n const { leadingSegments, className, docScopes, 'data-testid': testId } = props;\n const app = useApp();\n const resource = props.resource === undefined ? undefined : routeResourceKey(props.resource);\n const def = resource === undefined ? undefined : app.registry.get(resource);\n const tid = useTestIds();\n const t = useOptionalT();\n const RouterLink = useLinkComponent();\n const caps = useI18nCaps(def?.name);\n const intent = useOriginIntent();\n /** A jump crumb's click: the page it opens starts a fresh trail. */\n const onJump = (seg: Segment): (() => void) | undefined => {\n const href = seg.href;\n return seg.jump === true && href !== undefined ? () => intent(href, 'jump') : undefined;\n };\n // Resource plus its documentation variant, when the resource declares one.\n const trailScopes = useDocTrailScopes(def?.name);\n\n const leading = (name: string) =>\n leadingSegments?.map((seg, i) => (\n <span key={`lead:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(name)}:lead:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span className=\"truncate\" title={seg.label}>\n {seg.label}\n </span>\n )}\n <Chevron />\n </span>\n ));\n const current = (crumbTestId: string, label: string) => (\n <span\n data-testid={crumbTestId}\n className=\"text-foreground font-medium truncate\"\n aria-current=\"page\"\n title={label}\n >\n {label}\n </span>\n );\n // Every crumb may shrink and truncate (its `title` keeps it readable); the chevrons and the help\n // button may not, so a trail squeezed by a crowded header keeps its «?» on screen.\n const navClass = cn('flex min-w-0 items-center gap-1 text-sm text-muted-foreground', className);\n const ariaLabel = t('nav.breadcrumb', { defaultValue: 'Breadcrumb' });\n // Help for where you are, at the end of the trail. Renders nothing when\n // nothing in the trail is documented.\n const help = <DocTrailHelp scopes={docScopes ?? trailScopes} className=\"ml-0.5\" />;\n\n if (props.resource === undefined) {\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {leading(props.name)}\n {current(tid.navBreadcrumb(props.name), props.pageLabel)}\n {help}\n </nav>\n );\n }\n if (!def) return null;\n const { recordId, pageLabel, middleSegments, rootSegments } = props;\n const resourceKey = canonicalResourceKey(def);\n if (rootSegments !== undefined && rootSegments.length > 0) {\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {rootSegments.map((seg, i) => (\n <span key={`root:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n {i > 0 && <Chevron />}\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(resourceKey)}:root:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span\n data-testid={`${tid.navBreadcrumb(resourceKey)}:root:${i}`}\n className=\"truncate\"\n title={seg.label}\n >\n {seg.label}\n </span>\n )}\n </span>\n ))}\n {pageLabel && (\n <>\n <Chevron />\n {current(tid.navBreadcrumb(resourceKey, recordId), pageLabel)}\n </>\n )}\n {help}\n </nav>\n );\n }\n // Canonical, nesting-aware href: for a resource behind a nav group it is the\n // group-prefixed path, so the crumb keeps the nested chrome.\n const listHref = props.resourceHref ?? hrefFor(app.registry, resourceKey);\n const resourceLabel = resolveResourceLabel(caps, resourceKey, 'plural', def);\n // The resource is the current crumb only on a bare list page, when nothing\n // trails it; otherwise it stays a parent link.\n const resourceIsCurrent = !pageLabel && !(middleSegments && middleSegments.length > 0);\n return (\n <nav className={navClass} aria-label={ariaLabel} data-testid={testId}>\n {leading(resourceKey)}\n {resourceIsCurrent ? (\n current(tid.navBreadcrumb(resourceKey), resourceLabel)\n ) : !hasListPage(def) ? (\n // `views.list.page: false`: there is no list to go back to, so the crumb only names it.\n <span\n data-testid={tid.navBreadcrumb(resourceKey)}\n className=\"truncate\"\n title={resourceLabel}\n >\n {resourceLabel}\n </span>\n ) : (\n <RouterLink\n href={listHref}\n data-testid={tid.navBreadcrumb(resourceKey)}\n className={cn(LINK_CLASS, 'truncate')}\n title={resourceLabel}\n >\n {resourceLabel}\n </RouterLink>\n )}\n {middleSegments?.map((seg, i) => (\n <span key={`mid:${i}:${seg.label}`} className=\"flex min-w-0 items-center gap-1\">\n <Chevron />\n {seg.href ? (\n <RouterLink\n href={seg.href}\n onClick={onJump(seg)}\n data-testid={`${tid.navBreadcrumb(resourceKey)}:mid:${i}`}\n className={cn(LINK_CLASS, 'truncate')}\n title={seg.label}\n >\n {seg.label}\n </RouterLink>\n ) : (\n <span className=\"truncate\" title={seg.label}>\n {seg.label}\n </span>\n )}\n </span>\n ))}\n {pageLabel && (\n <>\n <Chevron />\n {current(tid.navBreadcrumb(resourceKey, recordId), pageLabel)}\n </>\n )}\n {help}\n </nav>\n );\n}\n","'use client';\nimport { effectiveFlow } from '@burojs/core';\nimport {\n useApplicationSnapshot,\n useDocTrailScopes,\n useNavigationOrigin,\n usePublishOriginTitle,\n useRecordTitle,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { Breadcrumbs } from './breadcrumbs.js';\nimport { recordTrailKey, usePublishedRecordTrail } from './record-trail-store.js';\nimport {\n type OriginTrail,\n originTrail,\n recordTrail,\n recordTrailRoute,\n type TrailContext,\n useTrailContext,\n} from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\n\n/**\n * The record trail of the current route, the one `<HeaderBreadcrumbs>` draws\n * there; record and flow pages draw none of their own.\n *\n * On a record route whose operation is available: the group chain, the\n * resource, then the record (show), the record linking to show when show is\n * available plus \"Edit\" (edit), or \"Create\" (create). The record crumb is the\n * record's title once `<RecordPage>` has loaded it, and the id while it loads,\n * has failed, or is not mounted at all.\n *\n * On a page-hosted flow's route: the record's edit-shaped trail ending with the\n * flow's label, once the flow page shows its form or its \"not available\"\n * notice; until then, and on every not-found it answers with, the record's\n * show trail with the id, so a flow the user may not run is never named. A\n * name no flow answers to is the framework 404, with no trail.\n *\n * With an origin (`useNavigationOrigin`) the trail roots where the user came\n * from instead of at the record's resource (navigation origin): a filtered\n * list keeps its address on the resource crumb, a parent record's card\n * replaces the resource crumb with its own trail. A record page reached from a\n * list whose resource routes its show here (`routesTo.show`, a view onto this\n * resource) asks that resource for help first, then this one.\n *\n * Nothing on any other route.\n */\n\n/**\n * @internal The resource of a list origin whose `routesTo.show` is `resource`: the list the\n * shared record page was reached from, whose documentation the reader is asking for first.\n */\nexport function viewOrigin(ctx: TrailContext, trail: OriginTrail | undefined, resource: string) {\n if (trail === undefined || trail.resource === undefined || trail.segments.length > 0)\n return undefined;\n const def = ctx.registry.get(trail.resource);\n const target = def?.routesTo?.show;\n if (target === undefined || ctx.registry.get(target) !== ctx.registry.get(resource))\n return undefined;\n return trail.resource;\n}\nexport function RecordBreadcrumbs(): ReactElement | null {\n const ctx = useTrailContext();\n const match = useMatch();\n const snapshot = useApplicationSnapshot();\n const route = recordTrailRoute(ctx.registry, match);\n const published = usePublishedRecordTrail(\n route === null\n ? ''\n : recordTrailKey(\n route.resource,\n route.id,\n route.flow === undefined ? route.action : `flow:${route.flow}`,\n ),\n );\n // `#<id>` (or `''` without an id): what the trail shows until the page publishes the title.\n const idTitle = useRecordTitle(route?.resource, route?.id);\n // The title this trail shows is what an origin captured on leaving the page carries.\n usePublishOriginTitle(published?.title || undefined);\n const origin = useNavigationOrigin();\n const rooted = origin === null ? undefined : originTrail(ctx, origin);\n const view = route === null ? undefined : viewOrigin(ctx, rooted, route.resource);\n const viewScopes = useDocTrailScopes(view);\n const ownScopes = useDocTrailScopes(view === undefined ? undefined : route?.resource);\n const docScopes =\n view === undefined ? {} : { docScopes: [...new Set([...viewScopes, ...ownScopes])] };\n if (route === null || match === null) return null;\n const { resource, id, groupChain } = route;\n const title = published?.title ?? idTitle;\n const withOrigin = rooted === undefined ? {} : { origin: rooted };\n if (route.flow !== undefined) {\n if (effectiveFlow(snapshot, match.ref, route.flow) === undefined) return null;\n const flowLabel = published?.flowLabel;\n if (flowLabel === undefined) {\n return (\n <Breadcrumbs\n {...recordTrail(ctx, {\n resource,\n action: 'show',\n id,\n title: idTitle,\n groupChain,\n ...withOrigin,\n })}\n {...docScopes}\n data-testid=\"record-breadcrumbs\"\n />\n );\n }\n return (\n <Breadcrumbs\n {...recordTrail(ctx, { resource, action: 'edit', id, title, groupChain, ...withOrigin })}\n {...docScopes}\n pageLabel={flowLabel}\n data-testid=\"record-breadcrumbs\"\n />\n );\n }\n return (\n <Breadcrumbs\n {...recordTrail(ctx, {\n resource,\n action: route.action,\n id,\n title,\n groupChain,\n ...withOrigin,\n })}\n {...docScopes}\n data-testid=\"record-breadcrumbs\"\n />\n );\n}\n","import { BUILTIN_LAYOUTS, type NavLayout } from './nav-slots.js';\n\n/**\n * The built-in content-wrapping layouts as a Components-registry table.\n *\n * Optional: `secondary-sidebar` and `tabs` resolve without it. Spread it into\n * `BuroProvider`'s `components` only to wrap or re-register the built-ins.\n */\nexport const defaultNavLayouts: Record<string, NavLayout> = { ...BUILTIN_LAYOUTS };\n","'use client';\nimport { humanizeKey } from '@burojs/core';\nimport { useChromeT, useOptionalT, useTestIds } from '@burojs/react';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport { cn } from '../lib/cn.js';\n\ninterface ContextPickerBase {\n /**\n * Slice name (also used in testid). Free-form — playground uses 'company',\n * 'productGroup', 'location' etc.\n */\n sliceName: string;\n /** Human label shown above the dropdown. Falls back to humanizeKey(sliceName). */\n label?: string;\n options: Array<{ value: string; label: string }>;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n /**\n * When true, render the label as `sr-only` instead of the visual\n * uppercase eyebrow. Useful when the picker is one of a row of\n * dense pickers in a sidebar (the iar-ui pattern: company on its\n * own row, then `[PG] [Location]` side-by-side with placeholder\n * text doing the labelling). Accessibility is preserved — screen\n * readers still announce the label, only the visual chrome is\n * suppressed.\n */\n hideLabel?: boolean;\n}\n\nexport type ContextPickerProps =\n | (ContextPickerBase & {\n allOption?: undefined;\n value: string | null;\n onChange: (value: string) => void;\n })\n | (ContextPickerBase & {\n /**\n * Adds an \"All\" item first: `true` labels it with the `scope.all` chrome string, a string\n * is the label. `value: null` selects it and `onChange` receives `null` for it.\n */\n allOption: true | string;\n value: string | null;\n onChange: (value: string | null) => void;\n });\n\n/** The Radix `Select` rejects an empty item value, so \"All\" travels under this private one. */\nconst ALL = '\\u0000all';\n\n/**\n * Generic context picker — a labeled dropdown that drives a slice value.\n * Used in the sidebar / header to switch company, product group, location, etc.\n *\n * The component is presentational. Consumers wire it to whatever store they\n * use (auth context, buro context engine, or local state).\n */\nexport function ContextPicker({\n sliceName,\n label,\n options,\n value,\n onChange,\n placeholder,\n disabled,\n className,\n hideLabel,\n allOption,\n}: ContextPickerProps): React.ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const chromeT = useChromeT();\n const allLabel =\n typeof allOption === 'string' ? allOption : chromeT('scope.all', { defaultValue: 'All' });\n const displayLabel = label ?? humanizeKey(sliceName);\n return (\n <div className={cn('space-y-1', className)}>\n <label\n htmlFor={`context-picker:${sliceName}`}\n className={\n hideLabel\n ? 'sr-only'\n : 'text-xs font-medium text-muted-foreground uppercase tracking-wide'\n }\n >\n {displayLabel}\n </label>\n <Select\n value={value ?? (allOption === undefined ? '' : ALL)}\n onValueChange={(next) => {\n if (allOption === undefined) onChange(next);\n else onChange(next === ALL ? null : next);\n }}\n disabled={disabled}\n >\n <SelectTrigger\n id={`context-picker:${sliceName}`}\n data-testid={tid.contextPicker(sliceName)}\n className={cn('w-full', hideLabel ? 'h-8 text-xs' : undefined)}\n >\n <SelectValue\n placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })}\n />\n </SelectTrigger>\n <SelectContent>\n {allOption === undefined ? null : (\n <SelectItem value={ALL} data-testid={tid.contextPickerOption(sliceName, 'all')}>\n {allLabel}\n </SelectItem>\n )}\n {options.map((o) => (\n <SelectItem\n key={o.value}\n value={o.value}\n data-testid={tid.contextPickerOption(sliceName, o.value)}\n >\n {o.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n );\n}\n","'use client';\nimport { humanizeKey, type ReadScopeValue, type ScopeSelectionValue } from '@burojs/core';\nimport { useChromeT, useScope, useTestIds } from '@burojs/react';\nimport { useMemo } from 'react';\nimport { FacetedFilterPicker } from '../data-table/data-table-faceted-filter.js';\nimport { cn } from '../lib/cn.js';\nimport { ContextPicker } from './context-picker.js';\nimport { type DimensionOption, useResourceDimensionOptions } from './use-dimension-options.js';\n\nexport interface ScopeDimensionPickerProps {\n /** A key of `defineScope(...)`. */\n dimension: string;\n /** Falls back to `humanizeKey(dimension)`. */\n label?: string;\n hideLabel?: boolean;\n className?: string;\n}\n\n/**\n * The control for one scope dimension (read-scope spec 7c.3): the dimension's values as options,\n * \"All\" first (nothing selected means everything allowed), writing `useScope().select`. A\n * selection change, never a transition: no cache is cleared and nothing in flight is cancelled.\n * Renders nothing for `select: 'none'`.\n */\nexport function ScopeDimensionPicker(props: ScopeDimensionPickerProps): React.ReactElement | null {\n const scope = useScope();\n const definition = scope.definition?.dimensions[props.dimension];\n if (definition === undefined) {\n throw new Error(\n `ScopeDimensionPicker: '${props.dimension}' is not a dimension of the app's defineScope(...)`,\n );\n }\n if (definition.select === 'none') return null;\n const source = definition.values;\n if (source === undefined) {\n throw new Error(\n `ScopeDimensionPicker: dimension '${props.dimension}' declares no values; add values: { resource } or a { value, label } list`,\n );\n }\n const allowed = scope.access[props.dimension]?.allowed;\n const permitted = Array.isArray(allowed) ? (allowed as readonly ReadScopeValue[]) : undefined;\n const common = {\n ...props,\n multiple: definition.select === 'multiple',\n all: definition.all,\n selected: scope.selection[props.dimension] ?? null,\n select: (value: ScopeSelectionValue) => scope.select(props.dimension, value),\n };\n if (Array.isArray(source)) {\n const options = (source as readonly DimensionOption[]).filter(\n (option) => permitted === undefined || permitted.includes(option.value),\n );\n return <DimensionControl {...common} options={options} />;\n }\n const { resource, label } = source as { resource: string; label?: string };\n return (\n <ResourceDimension {...common} resource={resource} {...(label ? { labelField: label } : {})} />\n );\n}\n\ninterface ControlProps extends ScopeDimensionPickerProps {\n readonly multiple: boolean;\n readonly all: boolean;\n readonly selected: ScopeSelectionValue;\n readonly select: (value: ScopeSelectionValue) => void;\n readonly options: readonly DimensionOption[];\n}\n\n/** A resource-backed dimension: its values come from {@link useResourceDimensionOptions}. */\nfunction ResourceDimension({\n resource,\n labelField,\n ...rest\n}: Omit<ControlProps, 'options'> & {\n readonly resource: string;\n readonly labelField?: string;\n}): React.ReactElement {\n const options = useResourceDimensionOptions(rest.dimension, resource, labelField);\n return <DimensionControl {...rest} options={options} />;\n}\n\nfunction DimensionControl({\n dimension,\n label,\n hideLabel,\n className,\n multiple,\n all,\n selected,\n select,\n options,\n}: ControlProps): React.ReactElement {\n const tid = useTestIds();\n const chromeT = useChromeT();\n const byText = useMemo(\n () => new Map(options.map((option) => [String(option.value), option.value] as const)),\n [options],\n );\n const textOptions = useMemo(\n () => options.map((option) => ({ value: String(option.value), label: option.label })),\n [options],\n );\n const picked = (Array.isArray(selected) ? selected : selected === null ? [] : [selected]).map(\n String,\n );\n const text = label ?? humanizeKey(dimension);\n if (multiple) {\n return (\n <div className={cn('space-y-1', className)}>\n <span\n className={\n hideLabel\n ? 'sr-only'\n : 'text-xs font-medium text-muted-foreground uppercase tracking-wide'\n }\n >\n {text}\n </span>\n <FacetedFilterPicker\n title={text}\n options={textOptions}\n selected={picked}\n {...(all\n ? { emptyLabel: chromeT('scope.all', { defaultValue: 'All' }) }\n : { clearable: false })}\n onChange={(next) => {\n // `all: false`: an empty selection would mean \"everything\", which the dimension opted\n // out of, so the last value cannot be deselected.\n if (next.length === 0 && !all) return;\n select(next.length === 0 ? null : next.map((value) => byText.get(value) ?? value));\n }}\n getTestId={(role, value) =>\n role === 'trigger'\n ? tid.contextPicker(dimension)\n : role === 'option'\n ? tid.contextPickerOption(dimension, value ?? '')\n : role === 'clear'\n ? tid.contextPickerOption(dimension, 'all')\n : undefined\n }\n />\n </div>\n );\n }\n const common = {\n sliceName: dimension,\n ...(label === undefined ? {} : { label }),\n options: textOptions,\n value: picked[0] ?? null,\n ...(hideLabel === undefined ? {} : { hideLabel }),\n ...(className === undefined ? {} : { className }),\n };\n const choose = (value: string | null) =>\n select(value === null ? null : (byText.get(value) ?? value));\n return all ? (\n <ContextPicker {...common} allOption onChange={choose} />\n ) : (\n <ContextPicker {...common} onChange={choose} />\n );\n}\n","'use client';\nimport { useOptionalT, useTestIds } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport { localeLabel } from '../shell/language-submenu.js';\nimport { useLanguageSwitch } from '../shell/use-language-switch.js';\n\nexport interface LanguageSwitchProps {\n /**\n * Called with the picked locale code AFTER the live locale has switched and\n * the choice has been persisted.\n */\n onChange?: (code: string) => void;\n className?: string;\n}\n\n/**\n * Segmented locale switcher: one button per locale the i18n facade lists\n * (`I18nFacade.locales`, which `createI18nFromRegistry` fills from the\n * registry), each labelled with the locale's own name (`Intl.DisplayNames`).\n * A view over {@link useLanguageSwitch}: picking a locale switches the LIVE\n * locale (no reload) and persists it under `<BuroProvider languageStorageKey>`.\n *\n * Reactivity: the active locale is read live, so the switcher always reflects\n * the CURRENT locale, including a change made elsewhere. `tests/language-switch.test.tsx`\n * guards that nothing here reloads the page.\n */\nexport function LanguageSwitch({ onChange, className }: LanguageSwitchProps): React.ReactElement {\n const t = useOptionalT();\n const tid = useTestIds();\n const { locale, locales, change } = useLanguageSwitch();\n\n function pick(code: string) {\n if (code === locale) return;\n change(code);\n onChange?.(code);\n }\n\n return (\n <div\n data-testid={tid.languageSwitch()}\n data-language-state={locale}\n className={cn(\n 'inline-flex items-center rounded-md border border-input bg-background',\n className,\n )}\n role=\"group\"\n aria-label={t('language.label', { defaultValue: 'Language' })}\n >\n {locales.map((code) => {\n const isActive = locale === code;\n return (\n <Button\n key={code}\n type=\"button\"\n size=\"sm\"\n variant={isActive ? 'secondary' : 'ghost'}\n data-testid={tid.languageSwitchOption(code)}\n data-active={isActive ? 'true' : 'false'}\n aria-pressed={isActive}\n onClick={() => pick(code)}\n className={cn(\n 'h-7 rounded-sm px-2 text-xs font-medium',\n !isActive && 'text-muted-foreground',\n )}\n >\n {localeLabel(code)}\n </Button>\n );\n })}\n </div>\n );\n}\n","'use client';\nimport type { ReactElement } from 'react';\nimport { Breadcrumbs } from './breadcrumbs.js';\nimport { RecordBreadcrumbs } from './record-breadcrumbs.js';\nimport { headerTrail, recordTrailRoute, useTrailContext } from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\n\n/**\n * The page's one breadcrumb trail, and `<AppHeader>`'s default `breadcrumbs`:\n * the group chain and the resource, custom page or group — and on a record\n * route or a page-hosted flow's route the record trail (`<RecordBreadcrumbs>`,\n * `data-testid=\"record-breadcrumbs\"`), which ends with the record's title once\n * the page has loaded it. Record and flow pages draw no trail of their own, so\n * a page never shows two. Nothing — silently — without a match: a sidebar or\n * header rendered in a story with no router is not a misconfiguration, and\n * `<NavAreaPage>`'s own message is the one that names the fix.\n */\nexport function HeaderBreadcrumbs(): ReactElement | null {\n const ctx = useTrailContext();\n const match = useMatch();\n if (recordTrailRoute(ctx.registry, match) !== null) return <RecordBreadcrumbs />;\n const trail = headerTrail(ctx, match);\n if (trail === null) return null;\n return <Breadcrumbs {...trail} data-testid=\"header-breadcrumbs\" />;\n}\n","'use client';\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { CommandDialog, CommandInput, CommandList, CommandEmpty } from '../primitives/command.js';\n\n/** Provider-optional translator returned by {@link useOptionalT}. */\ntype Translator = ReturnType<typeof useOptionalT>;\n\n/**\n * Test-id role passed to the optional `getTestId` builder so adopters\n * can address the dialog body, input, empty-state, and footer nodes\n * from e2e tests without leaking implementation details into the\n * component API.\n */\nexport type CommandPaletteTestIdRole = 'dialog' | 'input' | 'empty' | 'footer';\n\n/**\n * Default empty-state node — shown when no group renders any items.\n * Mentions both retrying the search and falling back to the navigation\n * (since the palette doubles as the primary navigator). Adopters can\n * override via the `emptyState` prop. Localized via `commandPalette.empty`\n * + `commandPalette.emptyHint` (English fallbacks preserved for the\n * no-provider path).\n */\nfunction defaultEmptyState(t: Translator): ReactNode {\n return (\n <div className=\"py-6 text-center text-sm\">\n <p className=\"text-muted-foreground\">\n {t('commandPalette.empty', { defaultValue: 'No matches found.' })}\n </p>\n <p className=\"mt-2 text-xs text-muted-foreground/70\">\n {t('commandPalette.emptyHint', {\n defaultValue: 'Try a different search or open a resource from the navigation.',\n })}\n </p>\n </div>\n );\n}\n\n/**\n * Default footer hint — keyboard affordance crib so first-time users\n * discover ↑↓ / Enter / Esc without RTFM. Adopters can override via\n * the `footer` prop, or pass `footer={null}` to hide the slot entirely.\n * The three action labels are localized via `commandPalette.navigate` /\n * `.select` / `.close` (English fallbacks preserved for the no-provider\n * path).\n */\nfunction defaultFooter(t: Translator): ReactNode {\n return (\n <div className=\"flex items-center justify-between gap-2 border-t px-3 py-2 text-xs text-muted-foreground\">\n <div className=\"flex items-center gap-1.5\">\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">↑↓</kbd>\n <span>{t('commandPalette.navigate', { defaultValue: 'Navigate' })}</span>\n <span className=\"mx-1 opacity-50\">·</span>\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">Enter</kbd>\n <span>{t('commandPalette.select', { defaultValue: 'Select' })}</span>\n <span className=\"mx-1 opacity-50\">·</span>\n <kbd className=\"rounded border bg-muted px-1 font-mono text-[10px]\">Esc</kbd>\n <span>{t('commandPalette.close', { defaultValue: 'Close' })}</span>\n </div>\n </div>\n );\n}\n\n/**\n * Props for `<CommandPalette>`. The component owns the modal frame +\n * search input + empty-state slot; adopters compose their own groups\n * (Resources, Pages, Recent, Records, Actions) inside `children`.\n */\nexport interface CommandPaletteProps {\n /** Whether the palette is open. Required (controlled). */\n open: boolean;\n /** Called when the palette wants to open / close (Esc, overlay click, item select). */\n onOpenChange: (open: boolean) => void;\n /**\n * Children render the groups + items inside `<CommandList>`. Adopters\n * compose their own sections; the palette body is otherwise empty.\n */\n children?: ReactNode;\n /**\n * Placeholder text in the search input. When omitted, resolves via\n * i18n (`commandPalette.search`, English fallback `\"Search…\"`).\n */\n placeholder?: string;\n /**\n * Empty state when no items match. Default: the framework's standard\n * \"No matches found.\" copy with a hint to fall back to the navigation.\n * Pass any node to override; pass `null` to render no empty-state row.\n */\n emptyState?: ReactNode;\n /**\n * Footer slot rendered below the list. Default: a keyboard-hint row\n * showing \"↑↓ Navigate · Enter Select · Esc Close\". Pass any node to\n * override; pass `null` to hide the footer entirely.\n */\n footer?: ReactNode;\n /**\n * Optional test-id builder. Receives a `role` (`dialog` | `input` |\n * `empty` | `footer`) and returns the test id, or `undefined` to skip.\n * Mirrors the `useTestIds` pattern used elsewhere in\n * `@burojs/ui-shadcn`.\n */\n getTestId?: (role: CommandPaletteTestIdRole) => string | undefined;\n /** Optional className forwarded to the dialog content wrapper. */\n className?: string;\n}\n\n/**\n * Modal command palette frame.\n *\n * Wraps `<CommandDialog>` with the standard input + list + empty-state\n * scaffolding so adopters only need to render their own\n * `<CommandGroup>` + `<CommandItem>` children.\n *\n * Open/close is controlled via `open` + `onOpenChange`. Pair with\n * `useCommandPalette()` from `@burojs/react` for `open`, `setOpen` and `toggle`, and\n * `useGlobalShortcut` from `@burojs/react/web` for the ⌘K/Ctrl+K shortcut.\n *\n * Defaults:\n *\n * - `emptyState` — framework \"No matches found.\" copy. Override via the\n * `emptyState` prop, or pass `null` to hide.\n * - `footer` — keyboard-hint row (↑↓ Navigate · Enter Select · Esc\n * Close). Override via the `footer` prop, or pass `null` to hide.\n *\n * Example:\n * ```tsx\n * const { open, setOpen, toggle } = useCommandPalette();\n * useGlobalShortcut({ key: 'k', mod: true }, toggle);\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandGroup heading=\"Resources\">\n * <CommandItem onSelect={() => router.push('/documents')}>\n * Documents\n * </CommandItem>\n * </CommandGroup>\n * </CommandPalette>\n * );\n * ```\n */\n/**\n * Lets a group whose items are `forceMount`-ed tell the palette that it is\n * showing results.\n *\n * ⚠️ Why this has to exist: cmdk's `<CommandEmpty>` renders when its internal\n * `filtered.count` is 0, and **force-mounted items are excluded from that\n * count**. Any group backed by a SERVER search must force-mount (cmdk's\n * client-side filter would otherwise hide rows the server already matched),\n * so the empty state is structurally blind to exactly the results that took\n * the longest to arrive. Acceptance testing caught the outcome: typing «plant»\n * rendered \"No results\" directly above two matching records.\n *\n * Groups call {@link useCommandPaletteResults} and report their count; the\n * palette suppresses the default empty state while any of them is non-zero.\n */\nconst CommandPaletteResultsContext = createContext<((key: string, count: number) => void) | null>(\n null,\n);\n\n/**\n * Report how many results a force-mounted group is currently showing.\n * No-op outside a `<CommandPalette>`, so groups stay usable standalone.\n */\nexport function useCommandPaletteResults(key: string): (count: number) => void {\n const report = useContext(CommandPaletteResultsContext);\n return useCallback(\n (count: number) => {\n report?.(key, count);\n },\n [report, key],\n );\n}\n\nexport function CommandPalette({\n open,\n onOpenChange,\n children,\n placeholder,\n emptyState,\n footer,\n getTestId,\n className,\n}: CommandPaletteProps) {\n const t = useOptionalT();\n const dialogTestId = getTestId?.('dialog');\n const inputTestId = getTestId?.('input');\n const emptyTestId = getTestId?.('empty');\n const footerTestId = getTestId?.('footer');\n\n const resolvedPlaceholder =\n placeholder ?? t('commandPalette.search', { defaultValue: 'Search…' });\n\n // `undefined` → use default; `null` → render nothing; any other node\n // → render that node. This lets adopters opt out of the slot without\n // a separate boolean prop.\n // Counts reported by force-mounted groups (see CommandPaletteResultsContext).\n const [asyncCounts, setAsyncCounts] = useState<Record<string, number>>({});\n const reportResults = useCallback((key: string, count: number) => {\n setAsyncCounts((prev) => (prev[key] === count ? prev : { ...prev, [key]: count }));\n }, []);\n const hasAsyncResults = useMemo(\n () => Object.values(asyncCounts).some((n) => n > 0),\n [asyncCounts],\n );\n\n const resolvedEmpty = emptyState === undefined ? defaultEmptyState(t) : emptyState;\n const resolvedFooter = footer === undefined ? defaultFooter(t) : footer;\n\n /**\n * ⚠️ Where focus goes when the palette closes.\n *\n * The palette usually opens from a KEYBOARD SHORTCUT, so there is no trigger\n * for Radix to restore focus to — pressing Escape dropped focus on <body>\n * and a keyboard user restarted from the top of the document. A keyboard-only\n * acceptance pass measured the same fall-through whether it was opened with\n * Ctrl+K or by activating the search chip.\n *\n * Remembering what was focused at open time covers both cases, and is\n * strictly better than a trigger ref: it returns the user to where they\n * actually were.\n */\n const restoreFocusRef = useRef<HTMLElement | null>(null);\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (next) {\n const active = typeof document !== 'undefined' ? document.activeElement : null;\n restoreFocusRef.current = active instanceof HTMLElement ? active : null;\n } else {\n const target = restoreFocusRef.current;\n restoreFocusRef.current = null;\n // After the dialog unmounts, or Radix's own restore overwrites it.\n if (target?.isConnected) requestAnimationFrame(() => target.focus());\n }\n onOpenChange(next);\n },\n [onOpenChange],\n );\n\n return (\n <CommandDialog\n open={open}\n onOpenChange={handleOpenChange}\n className={className}\n title={t('commandPalette.title', { defaultValue: 'Command Palette' })}\n description={t('commandPalette.description', { defaultValue: 'Search and run actions.' })}\n >\n <CommandInput placeholder={resolvedPlaceholder} data-testid={inputTestId} />\n <CommandList data-testid={dialogTestId}>\n {resolvedEmpty !== null && !hasAsyncResults && (\n <CommandEmpty data-testid={emptyTestId}>{resolvedEmpty}</CommandEmpty>\n )}\n <CommandPaletteResultsContext.Provider value={reportResults}>\n {children}\n </CommandPaletteResultsContext.Provider>\n </CommandList>\n {resolvedFooter !== null && (\n <div data-testid={footerTestId} data-slot=\"command-palette-footer\">\n {resolvedFooter}\n </div>\n )}\n </CommandDialog>\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { useShell } from '../shell/shell-context.js';\n\nexport interface CommandPaletteTriggerProps {\n /**\n * Opens the palette. Defaults to the `ShellProvider`'s `openPalette`; with\n * neither, the trigger renders nothing.\n */\n onOpen?: () => void;\n /** Shortcut hint rendered in the `<kbd>` chip. Defaults to `⌘K`. */\n shortcut?: string;\n /** `data-testid` for the trigger button. Default `'open-palette'`. */\n testid?: string;\n className?: string;\n}\n\n/**\n * Header affordance that opens the command palette — the visible, clickable\n * counterpart to the global ⌘K / Ctrl+K shortcut.\n *\n * Lives in the library (rather than being re-hand-rolled per app) so its label\n * and accessible name come from the framework i18n bundle\n * (`commandPalette.trigger` / `.triggerHint`) instead of hardcoded English.\n * Falls back to English when rendered outside a `BuroProvider`.\n */\nexport function CommandPaletteTrigger({\n onOpen,\n shortcut = '⌘K',\n testid = 'open-palette',\n className,\n}: CommandPaletteTriggerProps): React.ReactElement | null {\n const t = useOptionalT();\n const { openPalette } = useShell();\n const open = onOpen ?? openPalette;\n const hint = t('commandPalette.triggerHint', {\n defaultValue: 'Open command palette (⌘K / Ctrl+K)',\n });\n if (open === undefined) return null;\n return (\n <button\n type=\"button\"\n data-testid={testid}\n onClick={() => open()}\n title={hint}\n aria-label={hint}\n className={cn(\n // The header's one control shape: h-8, outlined, like the app actions and refresh beside it.\n 'hidden md:inline-flex h-8 items-center gap-1.5 rounded-md border border-input bg-background px-2.5',\n 'text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground',\n className,\n )}\n >\n <span>{t('commandPalette.trigger', { defaultValue: 'Search' })}</span>\n <kbd className=\"rounded border bg-background px-1 font-mono text-[10px]\">{shortcut}</kbd>\n </button>\n );\n}\n","'use client';\nimport { Fragment, type ReactNode, useMemo } from 'react';\nimport {\n hasListPage,\n evaluateVisible,\n hrefFor,\n isCustomPageDef,\n nodeKind,\n resolveNavLabel,\n resolveResourceLabel,\n type CustomPageDef,\n type NavGroupDef,\n type NavNode,\n type ResourceDef,\n type SectionDef,\n declaredText,\n} from '@burojs/core';\nimport {\n useApp,\n useI18nCaps,\n useOptionalT,\n useRouteNavigate,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem, CommandSeparator } from '../primitives/command.js';\nimport { cn } from '../lib/cn.js';\nimport { groupNavHref } from './build-nav-items.js';\nimport { useLayoutResolver } from './nav-slots.js';\nimport { useNavVisible, usePageAllowed, useResourceVisible } from './use-nav-routing.js';\nimport { canonicalNavKey, canonicalResourceKey } from '../resource-key.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used elsewhere in `@burojs/ui-shadcn` so adopters\n * can address each navigation entry from e2e tests without touching\n * implementation details.\n *\n * - `resource` — a resource entry (top-level OR inside a section/group).\n * - `page` — a custom-page entry (top-level OR inside a section/group).\n * - `section` — the (disabled) header row of a sidebar section.\n * - `group` — a nav-group's own \"jump to area\" entry (content groups —\n * secondary-sidebar/tabs — only; flat/collapsible groups contribute no\n * entry of their own, only their members').\n */\nexport type CommandPaletteNavigationTestIdRole = 'resource' | 'page' | 'section' | 'group';\n\n/**\n * Props for `<CommandPaletteNavigationGroups>`.\n *\n * The component reads the current `App` from `useApp()` (so it must be\n * rendered inside a `BuroProvider`) and the visibility context from\n * `useVisibilityCtx()` (mirrors the sidebar's filter logic so an entry\n * hidden in the sidebar stays hidden in the palette).\n *\n * Navigation goes through `useRouteNavigate` — the `RouterAdapter` the host\n * mounts above `<BuroProvider>` — so picks stay client-side with nothing to\n * wire.\n */\nexport interface CommandPaletteNavigationGroupsProps {\n /**\n * Called after the user picks a navigation entry, BEFORE the\n * navigation. Adopters typically wire this to `setOpen(false)` to close\n * the palette before the route change. Optional.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives a `role` plus an entry-specific\n * `id` (resource name, page name, or `<section>:<name>` for entries\n * rendered under a section) and returns the test id, or `undefined`\n * to skip. Returning `undefined` keeps the entry rendered but\n * unaddressable from tests.\n */\n getTestId?: (role: CommandPaletteNavigationTestIdRole, id: string) => string | undefined;\n}\n\n/**\n * Render the framework's standard navigation entries inside a command\n * palette: top-level Resources, top-level Pages, and Sections (with their\n * resource + page children rendered inline beneath each section header).\n *\n * Visibility filtering mirrors `<Sidebar>` (visible predicates evaluated\n * against `useVisibilityCtx()`, fail-closed for throwing predicates,\n * resources with no list page hidden from navigation entirely). An entry hidden\n * in the sidebar is also hidden in the palette — that parity is the\n * primary contract of this component.\n *\n * Rendering rules:\n *\n * - The component is `<CommandList>`-aware: it renders only\n * `<CommandGroup>` / `<CommandItem>` / `<CommandSeparator>` children, so\n * it can be dropped directly inside `<CommandPalette>` (which already\n * provides the dialog frame + input + empty state).\n * - Empty groups are suppressed entirely (no heading rendered) so the\n * palette never shows a stray \"Resources\" header above zero items.\n * - `<CommandSeparator>` is inserted only between consecutive non-empty\n * groups, not unconditionally.\n * - Each `<CommandItem>`'s `value` prop combines the role prefix + the\n * stable id + the rendered label so cmdk's built-in fuzzy filter can\n * match by either label or id (typing \"doc\" matches \"Documents\" via\n * the label fragment).\n * - Section groups render the section's label as the cmdk\n * `<CommandGroup heading={...}>` AND as a leading disabled item — the\n * disabled item gives e2e tests a stable testid plus contributes the\n * section name to cmdk's fuzzy match, so typing the section name\n * surfaces the whole group.\n *\n * Example (Next App Router):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import {\n * CommandPalette,\n * CommandPaletteNavigationGroups,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen } = useCommandPalette();\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteNavigationGroups({\n onSelect,\n getTestId,\n}: CommandPaletteNavigationGroupsProps): React.ReactElement | null {\n const app = useApp();\n const caps = useI18nCaps();\n const visibilityCtx = useVisibilityCtx();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n // Canonical, nesting-aware visibility predicate — same one `hrefFor`\n // consults to resolve a content-less group's first visible descendant.\n // Structurally identical to `isResourceVisible` below (both delegate to\n // `evaluateVisible`), but typed over `NavNode` so it also covers groups.\n const isVisible = useNavVisible();\n const resolveLayout = useLayoutResolver();\n\n // Visibility filter — the same predicate the sidebar uses (`useResourceVisible`).\n const isResourceVisible = useResourceVisible();\n // A page also needs its `requires` decided in the user's favour: undecided draws no entry.\n const pageAllowed = usePageAllowed();\n const isPageVisible = (p: CustomPageDef): boolean =>\n evaluateVisible(p.visible, visibilityCtx) && pageAllowed(p);\n\n // Resources and custom pages split by whether they belong to a\n // section, exactly mirroring `<Sidebar>`'s split. Embedded subresources\n // are dropped from BOTH the top-level list AND any section grouping\n // below — they are reached only through a placement in their parent.\n const { topLevelResources, topLevelPages, sectionGroups } = useMemo(() => {\n const allResources = app.registry.list();\n const allPages = app.registry.customPages.list();\n const allSections = app.registry.sections.list();\n\n const visibleResources = allResources.filter((r) => hasListPage(r)).filter(isResourceVisible);\n\n const tlResources = visibleResources.filter((r) => !r.section && !r.group);\n const tlPages = allPages.filter((p) => !p.section && !p.group).filter(isPageVisible);\n\n const groups: Array<{\n section: SectionDef;\n children: Array<ResourceDef | CustomPageDef>;\n }> = [];\n for (const section of allSections) {\n const children = app.registry.sections\n .childrenOf(canonicalNavKey(section))\n // A group is the structural navigation owner when a declaration\n // carries both `section` (categorisation) and `group` (placement).\n // Rendering it here as well would emit the same leaf twice.\n .filter((c) => !c.group)\n // Embedded-only resources hidden from sections too (see Sidebar\n // notes for parity).\n .filter((c) => !('parent' in c) || hasListPage(c))\n // Per-node visibility: a gated resource or page is dropped (the page\n // route renders not-found for a hidden page anyway).\n .filter((c) => (isCustomPageDef(c) ? isPageVisible(c) : isResourceVisible(c)));\n if (children.length === 0) continue;\n groups.push({ section, children });\n }\n\n return {\n topLevelResources: tlResources,\n topLevelPages: tlPages,\n sectionGroups: groups,\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app, visibilityCtx]);\n\n const goTo = (href: string): void => {\n onSelect?.();\n navigate(href, { origin: 'jump' });\n };\n\n const resourceLabel = (def: ResourceDef): string =>\n resolveResourceLabel(caps, canonicalResourceKey(def), 'plural', def);\n\n const pageLabel = (def: CustomPageDef): string =>\n resolveNavLabel(caps, `pages.${canonicalNavKey(def)}`, declaredText('chrome', def, 'label'));\n\n // Build the list of group nodes first so we can interleave separators\n // between consecutive non-empty groups without nested ternaries. cmdk\n // discovers groups + items via DOM data-attributes, so wrapping or\n // not wrapping the groups in a parent element makes no difference to\n // its filter / keyboard nav semantics.\n const groups: ReactNode[] = [];\n\n if (topLevelResources.length > 0) {\n groups.push(\n <CommandGroup\n heading={t('commandPalette.resources', { defaultValue: 'Resources' })}\n key=\"resources\"\n >\n {topLevelResources.map((def) => {\n const resource = canonicalResourceKey(def);\n const label = resourceLabel(def);\n const href = hrefFor(app.registry, resource, { isVisible });\n return (\n <CommandItem\n key={`resource:${resource}`}\n value={`resource:${resource}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', resource)}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n if (topLevelPages.length > 0) {\n groups.push(\n <CommandGroup heading={t('commandPalette.pages', { defaultValue: 'Pages' })} key=\"pages\">\n {topLevelPages.map((page) => {\n const pageKey = canonicalNavKey(page);\n const label = pageLabel(page);\n const href = page.path;\n return (\n <CommandItem\n key={`page:${pageKey}`}\n value={`page:${pageKey}:${page.path}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', pageKey)}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n for (const { section, children } of sectionGroups) {\n const sectionKey = canonicalNavKey(section);\n const sectionLabel = resolveNavLabel(\n caps,\n `sections.${sectionKey}`,\n declaredText('chrome', section, 'label'),\n );\n groups.push(\n <CommandGroup heading={sectionLabel} key={`section:${sectionKey}`}>\n {/* Disabled label-only header inside the group — supplements\n cmdk's heading by contributing the section label to the\n fuzzy match AND by providing a stable testid per-section\n for e2e specs that want to assert section presence. */}\n <CommandItem\n key={`__section_header_${sectionKey}`}\n value={`section:${sectionKey}:${sectionLabel}`}\n disabled\n className=\"font-medium opacity-70\"\n data-testid={getTestId?.('section', sectionKey)}\n >\n {sectionLabel}\n </CommandItem>\n {children.map((child) => {\n if (isCustomPageDef(child)) {\n const pageKey = canonicalNavKey(child);\n const href = child.path;\n // Custom page child.\n const label = pageLabel(child);\n return (\n <CommandItem\n key={`section:${sectionKey}:page:${pageKey}`}\n value={`section:${sectionKey}:page:${pageKey}:${child.path}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', `${sectionKey}:${pageKey}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>\n );\n }\n // Resource child.\n const resource = canonicalResourceKey(child);\n const label = resourceLabel(child);\n const href = hrefFor(app.registry, resource, { isVisible });\n return (\n <CommandItem\n key={`section:${sectionKey}:resource:${resource}`}\n value={`section:${sectionKey}:resource:${resource}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', `${sectionKey}:${resource}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>,\n );\n }\n\n // Nav-group entries — recursive per-group walk so every member, including\n // deeply nested-group members, gets a reachable palette entry (unlike the\n // sidebar's `<NavMain>`, which only single-links to a content group's own\n // area). A content group (secondary-sidebar/tabs — i.e. any group with a\n // registered layout renderer) contributes ONE \"jump to area\" entry via\n // `groupNavHref` — none when the user can reach no member of it (L3 9.1);\n // a flat/collapsible group contributes no entry of its\n // own. Either way, recursion continues into `childrenOf(group)` so every\n // leaf (and every content sub-group) surfaces as its own entry too — the\n // palette's whole-app search contract wouldn't hold if a resource three\n // groups deep were only reachable by drilling through the sidebar first.\n const collectGroupItems = (group: NavGroupDef, idPath: string, depth: number): ReactNode[] => {\n const items: ReactNode[] = [];\n const isContentGroup = !!resolveLayout(group.layout);\n // A content group with no reachable member has no area to jump to.\n const href = isContentGroup\n ? groupNavHref(app.registry, canonicalNavKey(group), isVisible)\n : undefined;\n if (href !== undefined) {\n const groupKey = canonicalNavKey(group);\n const label = resolveNavLabel(\n caps,\n `groups.${groupKey}`,\n declaredText('chrome', group, 'label'),\n );\n items.push(\n <CommandItem\n key={`group:${idPath}`}\n value={`group:${idPath}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('group', idPath)}\n className={depth > 0 ? cn('pl-6') : undefined}\n >\n {label}\n </CommandItem>,\n );\n }\n for (const child of app.registry.groups.childrenOf(canonicalNavKey(group))) {\n const kind = nodeKind(child);\n if (kind === 'group') {\n const sub = child as NavGroupDef;\n if (!isVisible(sub as NavNode)) continue;\n items.push(...collectGroupItems(sub, `${idPath}:${canonicalNavKey(sub)}`, depth + 1));\n continue;\n }\n if (kind === 'custom-page') {\n const page = child as CustomPageDef;\n // Same gate as a top-level or section page: hidden or not decided in favour, no entry.\n if (!isPageVisible(page)) continue;\n const pageKey = canonicalNavKey(page);\n const label = pageLabel(page);\n const href = page.path;\n items.push(\n <CommandItem\n key={`page:${idPath}:${pageKey}`}\n value={`page:${idPath}:${pageKey}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('page', `${idPath}:${pageKey}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>,\n );\n continue;\n }\n // Resource child — a resource with no list page is hidden from\n // navigation entirely (parity with the top-level/section handling\n // above), and per-resource `visible(ctx)` still gates entry.\n const resource = child as ResourceDef;\n if (!hasListPage(resource)) continue;\n if (!isResourceVisible(resource)) continue;\n const resourceId = canonicalResourceKey(resource);\n const label = resourceLabel(resource);\n const href = hrefFor(app.registry, resourceId, { isVisible });\n items.push(\n <CommandItem\n key={`resource:${idPath}:${resourceId}`}\n value={`resource:${idPath}:${resourceId}:${label}`}\n onSelect={() => goTo(href)}\n data-testid={getTestId?.('resource', `${idPath}:${resourceId}`)}\n className={cn('pl-6')}\n >\n {label}\n </CommandItem>,\n );\n }\n return items;\n };\n\n const rootGroups = app.registry.groups\n .rootNodes()\n .filter((n) => nodeKind(n) === 'group') as NavGroupDef[];\n\n for (const group of rootGroups) {\n if (!isVisible(group as NavNode)) continue;\n const groupKey = canonicalNavKey(group);\n const items = collectGroupItems(group, groupKey, 0);\n if (items.length === 0) continue;\n const heading = resolveNavLabel(\n caps,\n `groups.${groupKey}`,\n declaredText('chrome', group, 'label'),\n );\n groups.push(\n <CommandGroup heading={heading} key={`group:${groupKey}`}>\n {items}\n </CommandGroup>,\n );\n }\n\n if (groups.length === 0) return null;\n\n // Interleave a `<CommandSeparator>` between consecutive groups so the\n // visual divider only renders between non-empty siblings.\n return (\n <>\n {groups.map((group, idx) => (\n <Fragment key={`navgrp-${idx}`}>\n {idx > 0 && <CommandSeparator />}\n {group}\n </Fragment>\n ))}\n </>\n );\n}\n","import { type RegistryReader, recordEntries, resolveStaticAvailability } from '@burojs/core';\n\n/**\n * Whether a record of `resource` without a `mode` page is reached through its quick entry\n * instead (spec 4.7): the operation is statically available, there is no page for it, and the\n * quick entry exists. The dynamic answer is the entry gate's, asked when it opens.\n */\nexport function opensInQuick(\n registry: RegistryReader,\n resource: string,\n mode: 'show' | 'edit' | 'create',\n): boolean {\n const def = registry.get(resource);\n if (def === undefined) return false;\n if (resolveStaticAvailability(registry, resource, mode).state !== 'available') return false;\n const entries = recordEntries(def);\n return !entries.page[mode] && entries.quick[mode] !== null;\n}\n","'use client';\nimport { Fragment, useMemo, useState, useEffect } from 'react';\nimport { useCommandState } from 'cmdk';\nimport { hrefFor, resolveResourceLabel } from '@burojs/core';\nimport {\n recordRouteAvailable,\n useApp,\n useCurrentUserId,\n useI18nCaps,\n useListAccess,\n useOptionalT,\n usePlatformStorage,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem, CommandSeparator } from '../primitives/command.js';\nimport { RECENT_LABEL_KEYS, type RecentRecord, readRecentRecords } from './recent-records.js';\nimport { opensInQuick } from './quick-targets.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by `<CommandPaletteNavigationGroups>`.\n *\n * - `recent` — a recently-visited record entry. `id` passed to the\n * builder is `<canonical resource>:<record-id>`.\n */\nexport type CommandPaletteRecentTestIdRole = 'recent';\n\n/**\n * Props for `<CommandPaletteRecentGroup>`.\n *\n * The component reads the signed-in user's recent list (the records\n * `<RecordPage>` recorded as it read them) and renders one `<CommandItem>`\n * per entry. It re-reads on every mount, when the user changes and when\n * `refreshKey` changes — single-tab consistency is preserved because the\n * palette dialog tears down + remounts each time it opens.\n */\nexport interface CommandPaletteRecentGroupProps {\n /**\n * Called BEFORE the navigation. Adopters typically wire this to\n * `setOpen(false)` to close the palette during the route change.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('recent', '<resource>:<id>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteRecentTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.recent`, English fallback `\"Recent\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Re-read trigger. When this prop changes the component re-reads\n * the platform's local store (e.g. flip from `false` → `true` on palette open).\n * Optional — when omitted the component reads only on mount and when\n * the user changes, which is sufficient for the typical \"palette\n * dialog re-mounts on each open\" use case.\n */\n refreshKey?: unknown;\n /**\n * Render a `<CommandSeparator>` after the group when the list is\n * non-empty. Default `true` — adopters composing alongside\n * `<CommandPaletteNavigationGroups>` get the divider for free, and\n * the separator stays hidden when Recent is empty (so no orphan\n * line at the top of the palette).\n */\n withSeparator?: boolean;\n}\n\n/**\n * The route an entry opens: the record's show route, else its edit route,\n * through the registry (so a resource nested in a group opens under the\n * group's path); `null` when the resource has no record page and the record\n * opens in its `quick.show` (spec 4.7: recent records include overlay visits);\n * `undefined` when the registry lacks the resource or it has neither.\n */\nfunction entryHref(\n registry: ReturnType<typeof useApp>['registry'],\n entry: RecentRecord,\n isResourceVisible: (def: { readonly visible?: unknown }) => boolean,\n) {\n const def = registry.get(entry.canonicalRef);\n if (def === undefined) return undefined;\n // A resource the user can no longer see (its `visible`) is not offered, whatever was stored.\n if (!isResourceVisible(def)) return undefined;\n for (const action of ['show', 'edit'] as const)\n if (recordRouteAvailable(registry, entry.canonicalRef, action))\n return hrefFor(registry, entry.canonicalRef, { action, id: entry.id });\n if (opensInQuick(registry, entry.canonicalRef, 'show')) return null;\n return undefined;\n}\n\n/**\n * Render the \"Recent\" group inside a command palette: the last records the\n * signed-in user opened. `<RecordPage>` records each show or edit visit\n * from the record it read — there is nothing to wire, and nothing is\n * recorded or shown without a signed-in user.\n *\n * Visibility:\n *\n * - Renders nothing when the recent list is empty (no orphan\n * \"Recent\" heading on a fresh user). Adopters that want a permanent\n * slot (with an empty-state row) can fork this component — the\n * surface is small.\n * - An entry opens the record's show route, else its edit route, built\n * from the registry. An entry whose resource the registry no longer\n * has, whose resource's `visible` now hides it from the user, or which\n * has neither route, is not rendered.\n *\n * Example (router-independent — picks navigate through `useRouteNavigate`,\n * the `RouterAdapter` seam `useResourceUrlState` also uses; wrap the app in\n * `RouterAdapterProvider` once):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import {\n * CommandPalette,\n * CommandPaletteRecentGroup,\n * CommandPaletteNavigationGroups,\n * CommandSeparator,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen } = useCommandPalette();\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteRecentGroup\n * onSelect={() => setOpen(false)}\n * refreshKey={open}\n * />\n * <CommandSeparator />\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteRecentGroup({\n onSelect,\n getTestId,\n heading,\n refreshKey,\n withSeparator = true,\n}: CommandPaletteRecentGroupProps): React.ReactElement | null {\n const caps = useI18nCaps();\n const app = useApp();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n const userId = useCurrentUserId();\n const isResourceVisible = useResourceVisible();\n const resolvedHeading = heading ?? t('commandPalette.recent', { defaultValue: 'Recent' });\n\n // Read in an effect, so the server and the first client paint both render `[]` (no hydration\n // mismatch) and an asynchronous store may answer later: the list shows once the read settles.\n const store = usePlatformStorage().local;\n const [stored, setStored] = useState<readonly RecentRecord[]>([]);\n useEffect(() => {\n if (userId === null) {\n setStored([]);\n return;\n }\n let current = true;\n const read = readRecentRecords(store, userId);\n if (Array.isArray(read)) setStored(read);\n else\n read.then(\n (entries) => {\n if (current) setStored(entries);\n },\n () => undefined,\n );\n return () => {\n current = false;\n };\n // refreshKey is intentionally a dep so callers can force a re-read.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, userId, refreshKey]);\n\n const recents = useMemo(\n () =>\n stored.flatMap((entry) => {\n const href = entryHref(app.registry, entry, isResourceVisible);\n return href === undefined ? [] : [{ entry, href }];\n }),\n [stored, app.registry, isResourceVisible],\n );\n\n // Hide the Recent group entirely while the user is typing — cmdk's\n // filtered groups (Resources / Pages / Records / Actions) take over\n // and the static \"last visited\" list would otherwise compete with\n // search-relevance ordering. Empty input → Recent visible. Any\n // typing (>=1 char) → Recent hidden + separator hidden too.\n const liveQuery = useCommandState((state) => state.search) ?? '';\n if (liveQuery.length > 0) return null;\n\n if (recents.length === 0) return null;\n\n const goTo = (href: string | null, entry: RecentRecord): void => {\n onSelect?.();\n if (href === null) quick.show(entry.canonicalRef, entry.id);\n else navigate(href, { origin: 'jump' });\n };\n\n return (\n <Fragment>\n <CommandGroup heading={resolvedHeading} key=\"recent\">\n {recents.map(({ entry, href }) => (\n <RecentItem\n key={`recent:${entry.canonicalRef}:${entry.id}`}\n entry={entry}\n href={href}\n onGo={goTo}\n {...(getTestId === undefined ? {} : { getTestId })}\n />\n ))}\n </CommandGroup>\n {withSeparator && <CommandSeparator />}\n </Fragment>\n );\n}\n\n/**\n * One recent entry. Its stored label is shown only while the field it was read from is still\n * visible to the signed-in user (P5 spec 3.8); otherwise the record's id. The label is part of\n * the item's search value only when shown, so a hidden one is not reachable by typing either.\n */\nfunction RecentItem({\n entry,\n href,\n onGo,\n getTestId,\n}: {\n readonly entry: RecentRecord;\n readonly href: string | null;\n readonly onGo: (href: string | null, entry: RecentRecord) => void;\n readonly getTestId?: CommandPaletteRecentGroupProps['getTestId'];\n}): React.ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const access = useListAccess(entry.canonicalRef);\n const def = app.registry.get(entry.canonicalRef);\n const resourceLabel = resolveResourceLabel(caps, entry.canonicalRef, 'single', def);\n const key = `${entry.canonicalRef}:${entry.id}`;\n // An entry stored before labels named their field is trusted only when none of the fields its\n // label could have been read from is guarded: the label keys the resource declares and its\n // display field, or every field when a `recordTitle` hook (which may read any) titles it.\n const declared = Object.keys((def?.fields ?? {}) as Record<string, unknown>);\n const candidates =\n def?.recordTitle === undefined\n ? [\n ...declared.filter((name) => RECENT_LABEL_KEYS.includes(name)),\n ...(def?.displayField === undefined ? [] : [def.displayField]),\n ]\n : declared;\n const legacyTrusted =\n entry.label === entry.id ||\n (access.status === 'ready' && candidates.every((name) => access.fieldVisible(name)));\n const shown =\n entry.labelField === undefined\n ? legacyTrusted\n ? entry.label\n : entry.id\n : access.status === 'ready' && access.fieldVisible(entry.labelField)\n ? entry.label\n : entry.id;\n return (\n <CommandItem\n value={`recent:${key}:${resourceLabel}:${shown}`}\n onSelect={() => onGo(href, entry)}\n data-testid={getTestId?.('recent', key)}\n >\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resourceLabel}:\n </span>\n {shown}\n </CommandItem>\n );\n}\n","'use client';\nimport { useEffect, useMemo } from 'react';\nimport { useCommandState } from 'cmdk';\nimport {\n resolveResourceLabel,\n resourceShowHref,\n type AppRuntime,\n type ResourceDef,\n} from '@burojs/core';\nimport {\n useApp,\n useDebouncedValue,\n useI18nCaps,\n useListAccess,\n useList,\n useOptionalT,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\nimport { lowerLegacyField, type LegacyFieldLike } from '../fields/legacy-field.js';\nimport { useCommandPaletteResults } from './command-palette.js';\nimport { isShowAvailable } from './record-targets.js';\nimport { opensInQuick } from './quick-targets.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useRowSubtitle } from '../resource/use-record-subtitle.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by `<CommandPaletteNavigationGroups>` and\n * `<CommandPaletteRecentGroup>`.\n *\n * - `records-record` — a single record hit. `id` passed to the builder\n * is `<resource>:<record-id>`.\n */\nexport type CommandPaletteRecordsTestIdRole = 'records-record';\n\n/**\n * Props for `<CommandPaletteRecordsGroup>`.\n *\n * The component reads the current cmdk search state via `useCommandState`\n * and the `App` from `useApp()` (so it must be rendered inside a\n * `BuroProvider` AND inside a `<Command>` / `<CommandPalette>` shell).\n *\n * For every registered resource that has a resolvable `displayField`, the\n * component fires a `useList({ resource, filters: [{ field, operator:\n * 'contains', value: q }], pagination: { pageSize, mode: 'server' } })`\n * keyed on the debounced query. react-query's built-in fetch supersession\n * is what gives us \"cancel in-flight on next keystroke\" — we don't need\n * an explicit AbortController.\n */\nexport interface CommandPaletteRecordsGroupProps {\n /**\n * Disable the group entirely (e.g. when the palette is closed). When\n * false, no `useList` calls are fired (each per-resource sub-component\n * passes `queryOptions.enabled: false`). Defaults to `true`.\n */\n enabled?: boolean;\n /**\n * Number of rows fetched per resource. Defaults to 5 — small enough\n * that a multi-resource match still fits the palette without scrolling.\n */\n pageSize?: number;\n /**\n * Minimum query length before search fires. Below this, the group\n * renders nothing and no requests are made. Default 2.\n */\n minQueryLength?: number;\n /**\n * Debounce window (ms) applied to the cmdk search input before it\n * propagates to `useList`. Default 200ms.\n */\n debounceMs?: number;\n /**\n * Called BEFORE the navigation. Adopters typically wire this to\n * `setOpen(false)` to close the palette during the route change.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('records-record', '<resource>:<id>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteRecordsTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.records`, English fallback `\"Records\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Override the path generator. By default the component resolves the\n * resource's canonical show route (including namespaces, explicit routes,\n * nesting and `routesTo`).\n */\n recordHref?: (resource: string, id: string | number) => string;\n}\n\ninterface SearchableResource {\n def: ResourceDef;\n displayField: string;\n}\n\nconst STRING_DISPLAY_FALLBACKS = ['name', 'title', 'label', 'alias'] as const;\n\n/**\n * Resolve the display field for cross-resource search.\n *\n * Resolution order:\n * 1. Adopter's `def.displayField` (if it points at a real field on\n * the resolved schema — `defineResource` already validates this\n * via `resolveDisplayField`, but we re-check defensively to avoid\n * firing a `useList` against a non-existent column).\n * 2. Convention names: `name` → `title` → `label` → `alias`. The\n * `displayField` resolver in `define-resource.ts` only walks the\n * first matching string-kind field, which can produce a bad\n * candidate (e.g. a status enum) for cross-resource search; this\n * explicit allow-list keeps record search opt-in via these\n * well-known field names.\n * 3. Otherwise → `null` → resource is excluded from cross-resource\n * search entirely.\n *\n * Why we don't always trust `def.displayField`: `displayField` gets\n * inferred to \"first non-system string-kind field\" when the adopter\n * doesn't declare one explicitly. For breadcrumbs / picker labels that\n * inferred default works, but for free-text record search the inferred\n * field may be a categorical column (status / type) where a `contains`\n * filter degrades into noise. Adopters opt INTO record search either by\n * setting `displayField` explicitly OR by naming a field one of the\n * convention names above.\n */\nfunction resolveDisplayField(def: ResourceDef): string | null {\n const fields = def.fields ?? {};\n // Only string-shaped canonical fields make sense for a `contains` search\n // filter (numeric / boolean / enum fields are excluded so the API doesn't\n // get a malformed filter against a non-text column).\n const isSearchable = (fieldName: string): boolean => {\n const fieldDef = fields[fieldName];\n if (!fieldDef) return false;\n const canonical = lowerLegacyField(fieldDef as LegacyFieldLike);\n return canonical.type === 'string' && canonical.format !== 'enum';\n };\n // Adopter's `def.displayField` (auto-inferred or explicit) takes\n // precedence WHEN the targeted field is a string-kind. The\n // `defineResource` resolver picks the first non-system string-kind\n // field by default, so for resources with a sensible string display\n // column this branch fires. Adopters who want a non-string column to\n // be the displayField (display only, not search) opt the resource out\n // of cross-resource search by virtue of this branch returning null.\n if (def.displayField && isSearchable(def.displayField)) {\n return def.displayField;\n }\n // Fall back to convention names — adopter who set displayField to a\n // non-string column may still get search via a conventional name\n // (e.g. `name` / `title` / `label` / `alias`).\n for (const candidate of STRING_DISPLAY_FALLBACKS) {\n if (isSearchable(candidate)) return candidate;\n }\n return null;\n}\n\n/**\n * Render the \"Records\" group inside a command palette: cross-resource\n * record search wired through `useList`. As the user types,\n * each searchable resource fires a debounced `contains` filter against\n * its `displayField` and the resulting rows are rendered as flat\n * entries under a single \"Records\" heading.\n *\n * Behavior:\n *\n * - Renders nothing when the palette has no query (or the query is\n * shorter than `minQueryLength`). No `useList` calls are issued.\n * - Renders nothing when no registered resource has a resolvable\n * `displayField` (record search is opt-in via `def.displayField`).\n * - Each resource hit is prefixed with the resource's label so an\n * ambiguous query (matching multiple resources) stays disambiguated.\n * - On pick: calls `onSelect` (typical: close the palette) THEN\n * navigates to the record.\n *\n * Cancellation:\n *\n * react-query's built-in fetch supersession discards stale results when\n * a newer query is in flight — typing fast naturally cancels the prior\n * request via the standard query-key mechanism. No AbortController is\n * needed at this layer.\n *\n * Rules-of-Hooks safety:\n *\n * The set of searchable resources is computed once via `useMemo` keyed\n * on `app.registry` (and re-snapshotted only if the registry instance\n * changes). Each resource gets a sub-component (`<PerResourceSearchHits>`)\n * that calls `useList` exactly once per render. The sub-component count\n * is stable, so no conditional/loop hook is created.\n *\n * Example (router-independent — picks navigate through `useRouteNavigate`,\n * the `RouterAdapter` seam `useResourceUrlState` also uses; wrap the app in\n * `RouterAdapterProvider` once):\n *\n * ```tsx\n * 'use client';\n * import { useCommandPalette } from '@burojs/react';\n * import { useGlobalShortcut } from '@burojs/react/web';\n * import {\n * CommandPalette,\n * CommandPaletteRecordsGroup,\n * CommandPaletteNavigationGroups,\n * } from '@burojs/ui-shadcn';\n *\n * function Shell() {\n * const { open, setOpen, toggle } = useCommandPalette();\n * useGlobalShortcut({ key: 'k', mod: true }, toggle);\n * return (\n * <CommandPalette open={open} onOpenChange={setOpen}>\n * <CommandPaletteRecordsGroup\n * enabled={open}\n * onSelect={() => setOpen(false)}\n * />\n * <CommandPaletteNavigationGroups\n * onSelect={() => setOpen(false)}\n * />\n * </CommandPalette>\n * );\n * }\n * ```\n */\nexport function CommandPaletteRecordsGroup({\n enabled = true,\n pageSize = 5,\n minQueryLength = 2,\n debounceMs = 200,\n onSelect,\n getTestId,\n heading,\n recordHref,\n}: CommandPaletteRecordsGroupProps): React.ReactElement | null {\n const app = useApp();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n // A resource the sidebar hides (its `visible`) is not searched either.\n const isResourceVisible = useResourceVisible();\n const resolvedHeading = heading ?? t('commandPalette.records', { defaultValue: 'Records' });\n // cmdk exposes the live search state via `useCommandState` — selectors\n // re-run when the `state.search` slice changes. Outside a `<Command>`\n // root this returns `undefined`, so we coalesce defensively.\n const liveQuery = useCommandState((state) => state.search) ?? '';\n const debouncedQuery = useDebouncedValue(liveQuery, debounceMs);\n\n // Snapshot searchable resources once — the result MUST be stable across\n // renders so the per-resource hook count below stays Rules-of-Hooks-\n // compliant. The registry is build-time fixed in practice; if adopters\n // mutate it dynamically the memo key (`app.registry`) re-runs here.\n const searchableResources = useMemo<SearchableResource[]>(() => {\n return app.registry\n .list()\n .filter(\n (r) =>\n isShowAvailable(app.registry, canonicalResourceKey(r)) ||\n opensInQuick(app.registry, canonicalResourceKey(r), 'show'),\n )\n .filter(isResourceVisible)\n .map((def): SearchableResource | null => {\n const displayField = resolveDisplayField(def);\n return displayField ? { def, displayField } : null;\n })\n .filter((entry): entry is SearchableResource => entry !== null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app.registry, isResourceVisible]);\n\n // Don't render empty headings or fire any requests when below threshold.\n const isReady =\n enabled && debouncedQuery.length >= minQueryLength && searchableResources.length > 0;\n\n // Below the search threshold OR no resource has a displayField →\n // render nothing at all (no orphan \"Records\" heading). When the\n // group goes from null → mounted, the per-resource sub-components\n // mount AS A SET (each is a fresh component instance), so React's\n // Rules of Hooks remain satisfied: the parent component's hook\n // sequence (useApp / useOptionalT / useRouteNavigate / useCommandState /\n // useDebouncedValue / useMemo) is identical on every render, and the\n // children mount via the\n // standard array-key path which doesn't violate the rules either.\n if (!isReady) return null;\n\n // A record with no page opens its `quick.show` (spec 4.7).\n const goTo = (href: string | null, resource: string, id: string): void => {\n onSelect?.();\n if (href === null) quick.show(resource, id);\n else navigate(href, { origin: 'jump' });\n };\n\n // The group is `forceMount`-ed so cmdk doesn't auto-hide the heading\n // when its items' values don't match the live cmdk search string.\n // Our items are server-side-filtered (the `useList` `contains` filter\n // already did the matching), so the cmdk client-side filter would\n // wrongly hide them. Item-level `forceMount` keeps each row visible;\n // group-level `forceMount` keeps the heading visible even when the\n // sub-component count momentarily drops (e.g. while a fetch is\n // in-flight). The \"no rows\" case is handled below: when every\n // PerResourceSearchHits returns null, the group's children are an\n // empty array and the heading paints alone — that's a 1-frame state\n // before either rows arrive or the user shifts the query. To\n // suppress an orphan heading on truly zero-results, we render\n // `null` for the entire component instead (see the `if (!isReady)`\n // guard above plus the resource-count guard).\n return (\n <CommandGroup heading={resolvedHeading} key=\"records\" forceMount>\n {searchableResources.map(({ def, displayField }) => (\n <PerResourceSearchHits\n key={canonicalResourceKey(def)}\n def={def}\n displayField={displayField}\n query={debouncedQuery}\n pageSize={pageSize}\n goTo={goTo}\n recordHref={recordHref}\n registry={app.registry}\n getTestId={getTestId}\n />\n ))}\n </CommandGroup>\n );\n}\n\ninterface PerResourceSearchHitsProps {\n def: ResourceDef;\n displayField: string;\n query: string;\n pageSize: number;\n goTo: (href: string | null, resource: string, id: string) => void;\n recordHref?: (resource: string, id: string | number) => string;\n registry: AppRuntime['registry'];\n getTestId?: (role: CommandPaletteRecordsTestIdRole, id: string) => string | undefined;\n}\n\n/**\n * Per-resource leaf inside `<CommandPaletteRecordsGroup>`. Calls\n * `useList` exactly once with the current debounced query — react-query\n * keys on the resource + filter shape so a query change supersedes the\n * prior request automatically.\n *\n * Renders nothing while loading or on error to keep the palette quiet.\n * The cmdk empty-state slot at the palette root surfaces \"No matches\"\n * when every group is empty.\n */\nfunction PerResourceSearchHits({\n def,\n displayField,\n query,\n pageSize,\n goTo,\n recordHref,\n registry,\n getTestId,\n}: PerResourceSearchHitsProps): React.ReactElement | null {\n const caps = useI18nCaps();\n // The parent gates on `query.length >= minQueryLength` and only\n // mounts this child once that's true; we still defensively check\n // for a non-empty query so a future caller using this component\n // standalone doesn't fire useList with an empty filter.\n const resource = canonicalResourceKey(def);\n // The record search names the display field (P5 spec 3.7): a resource whose display field its\n // user may not view leaves the search — no predicate on it, no request.\n const access = useListAccess(resource);\n const titleVisible = access.status === 'ready' && access.fieldVisible(displayField);\n const shouldFetch = query.length > 0 && titleVisible;\n const q = useList(resource, {\n ...(shouldFetch ? { filter: { field: displayField, op: 'contains', value: query } } : {}),\n pagination: { kind: 'offset', page: 1, pageSize },\n // The global search follows the session's scope selection.\n scope: 'session',\n enabled: shouldFetch,\n });\n const report = useCommandPaletteResults(`records:${resource}`);\n const rowSubtitle = useRowSubtitle(resource);\n\n const rows =\n !shouldFetch || q.isLoading || q.isError\n ? []\n : ((q.data?.data ?? []) as Array<Record<string, unknown>>);\n\n // Tell the palette we are showing results. Our items are `forceMount`-ed\n // (server-side filtered), and cmdk excludes force-mounted items from the\n // `filtered.count` that drives `<CommandEmpty>` — so without this the\n // palette renders \"no matches\" directly above real rows.\n useEffect(() => {\n report(rows.length);\n }, [report, rows.length]);\n\n if (rows.length === 0) return null;\n\n const resourceLabel = resolveResourceLabel(caps, canonicalResourceKey(def), 'single', def);\n // A hit is keyed and linked by the resource's id field, which is not always `id`.\n const declaredIdField = (def.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField =\n typeof declaredIdField === 'string' && declaredIdField.length > 0 ? declaredIdField : 'id';\n\n return (\n <>\n {rows.map((row) => {\n const idVal = row[idField] ?? row.id ?? row.event_id ?? row.job_id;\n const id = idVal == null ? '' : String(idVal);\n if (!id) return null;\n const display = titleVisible ? row[displayField] : undefined;\n const labelText = typeof display === 'string' && display.length > 0 ? display : id;\n // Only a declared `recordSubtitle` draws a second line here: the palette has no default.\n const subtitle = rowSubtitle(row) ?? null;\n const href = recordHref\n ? recordHref(resource, id)\n : isShowAvailable(registry, resource)\n ? resourceShowHref(registry, def, resource, id)\n : null;\n return (\n <CommandItem\n key={`record:${resource}:${id}`}\n // Server-side filtered: include the live query in the\n // value so cmdk's built-in fuzzy filter accepts the row.\n // (Without this, cmdk would drop rows whose label/id\n // doesn't contain the typed query — but for cross-resource\n // search the server already did the filtering, so we must\n // bypass cmdk's filter.) `forceMount` is the canonical\n // cmdk knob for \"render this regardless of search filter.\"\n value={`record:${resource}:${id}:${labelText}`}\n forceMount\n onSelect={() => goTo(href, resource, id)}\n data-testid={getTestId?.('records-record', `${resource}:${id}`)}\n >\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resourceLabel}:\n </span>\n {labelText}\n {subtitle === null ? null : (\n <span\n data-buro-region=\"record-subtitle\"\n className=\"ml-auto truncate pl-2 text-xs text-muted-foreground group-data-[selected=true]:text-accent-foreground\"\n >\n {subtitle}\n </span>\n )}\n </CommandItem>\n );\n })}\n </>\n );\n}\n","'use client';\nimport { useEffect, useMemo, useRef } from 'react';\nimport {\n useAppActions,\n useI18nCaps,\n useOptionalT,\n useRouteNavigate,\n usePresentBlock,\n type AppActionEntry,\n} from '@burojs/react';\nimport { resolveContentSlot, resolveNavLabel, type I18nCaps } from '@burojs/core';\nimport { cn } from '../lib/cn.js';\nimport { isExternalHref, openExternal } from '../lib/external-href.js';\nimport { toast } from '../notification/toaster.js';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used elsewhere in `@burojs/ui-shadcn` (e.g.\n * `<CommandPaletteNavigationGroups>`, `<CommandPaletteRecentGroup>`,\n * `<CommandPaletteRecordsGroup>`) so adopters can address each action\n * entry from e2e tests without leaking implementation details.\n *\n * - `action` — a single action item.\n */\nexport type CommandPaletteActionsTestIdRole = 'action';\n\n/** Stable empty array — a fresh `[]` default would recompute `useMemo` below on every render for a caller that never passes `actions` at all. */\nconst EMPTY_ACTIONS: readonly ActionItem[] = Object.freeze([]);\n\n/**\n * Single action descriptor consumed by `<CommandPaletteActionsGroup>`.\n *\n * Adopters may still supply their own list via the `actions` prop — it\n * remains fully functional, because it is the only way to reach concerns\n * that cannot live in the app-action registry (a theme provider, an auth\n * context, a locale store: state and handlers that are bound to the\n * adopter's own tree). The component itself no longer stays opinion-free\n * about WHICH actions appear: it also reads `useAppActions()` and renders\n * those alongside the prop list — see the component's own docblock for the\n * merge order. Each action has a single activation path: either `href`\n * (navigates through `useRouteNavigate`) OR `onRun` (custom handler). When\n * both are provided `href` wins.\n */\nexport interface ActionItem {\n /** Stable id used for the cmdk `value` and the optional `getTestId` callback. */\n id: string;\n /** Display label (rendered after the optional `prefix`). */\n label: string;\n /**\n * Optional muted prefix shown before the label, e.g. `\"Create new\"`\n * for resource quick-actions. Rendered with the framework's\n * `text-muted-foreground` token so it visually de-emphasizes the\n * type-of-action prefix while keeping the resource label primary.\n */\n prefix?: string;\n /**\n * Synchronous or async handler. The component awaits the returned\n * promise (if any) before calling `onSelect`, so async work like\n * `auth.signOut()` finishes before the palette closes. Errors are\n * caught + logged; the palette closes regardless so the user is\n * never stuck with an unresponsive overlay after a misbehaving\n * handler.\n */\n onRun?: () => void | Promise<void>;\n /**\n * Optional href shortcut: when set, the component navigates to it\n * through `useRouteNavigate` (the same navigate → `onSelect` → close\n * flow used elsewhere in the palette) and `onRun` is not called. An\n * external href (`https:`, `mailto:`) opens in a new window instead.\n * Use this for actions that are really just navigation shortcuts\n * (e.g. `\"Create new <resource>\"`).\n */\n href?: string;\n /**\n * Optional keyword string contributing to cmdk's fuzzy match. Use for\n * synonyms / alternate phrasings — typing `\"logout\"` should still\n * surface a `\"Sign out\"` action when `keywords: 'logout sign out'`.\n * Keywords are appended to the cmdk `value` so the built-in filter\n * picks them up without any extra plumbing.\n */\n keywords?: string;\n /**\n * Marks the item as denied WITHOUT hiding it or handing it to cmdk's own\n * `disabled` prop — see the long comment on `<CommandPaletteActionsGroup>`\n * for why: cmdk's `disabled` removes the item from keyboard navigation\n * entirely, not just from activation, which would make the reason\n * unreachable by keyboard/screen-reader users (exactly the failure mode\n * `DisabledAction` in `action-button.tsx` was written to avoid). The item\n * stays focusable and keyboard-reachable; selecting it shows\n * `disabledReason` (via `toast`) instead of running `href`/`onRun`, and it\n * renders dimmed (`opacity-60`, matching `DisabledAction`'s own convention)\n * to still visually read as denied. Set automatically for a registry entry\n * whose rule allowed-but-disabled it (see `AppActionEntry.disabledReason`);\n * a caller-supplied action may also set it directly.\n */\n disabled?: boolean;\n /**\n * Human-readable reason. Rendered muted after the label AND announced via\n * `toast` when a `disabled` item is selected — the visible text alone\n * reaches a screen reader that lands on the (still-focusable) item, and the\n * toast additionally confirms the no-op to whoever just pressed\n * Enter/clicked. Set automatically from `AppActionEntry.disabledReason` for\n * registry-sourced entries.\n */\n disabledReason?: string;\n}\n\n/**\n * Props for `<CommandPaletteActionsGroup>`.\n */\nexport interface CommandPaletteActionsGroupProps {\n /**\n * Additional actions to render after the registry-sourced ones. Optional —\n * the group renders registry actions on its own with no `actions` prop at\n * all. When both sources are empty, the entire group is suppressed (no\n * orphan heading on a fresh palette).\n */\n actions?: ActionItem[];\n /**\n * Called AFTER the action's handler resolves (or the navigation\n * fires). Adopters typically wire this to `setOpen(false)` so the\n * palette closes once the user has picked an action.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('action', '<action-id>')` and\n * returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteActionsTestIdRole, id: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.actions`, English fallback `\"Actions\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n}\n\n/**\n * Turn one registry `AppActionEntry` into the component's internal\n * `ActionItem` view. `kind: 'link'` maps onto `href` (the existing\n * navigate-on-select path); `kind: 'modal'` maps onto `onRun`, which\n * presents the entry's block through `present()` — `host`\n * (defaulting to `'dialog'`) becomes the presentation `host`, and `props`\n * is forwarded verbatim, exactly like `ModalActionButton` does for\n * resource actions.\n *\n * `label` and `disabledReason` both go through i18n rather than rendering\n * `entry.label` / `entry.disabledReason` raw, mirroring the two\n * siblings that already do this: `resolveNavLabel` is what\n * `<CommandPaletteNavigationGroups>` uses for a section/page/group label\n * (`sections.<key>` etc.), and the `reason ? resolveContentSlot([reason], {\n * default: reason }) : ...` shape is `DisabledAction`'s (`action-button.tsx`)\n * own resolution of a rule's `reason` — a rule author may write a bundle key\n * (`locks.systemManaged`) or a plain-English literal, and `has()` is how you\n * tell those apart without both warning AND rendering the raw key. Without\n * this, a plugin-shipped label can never be translated, and a\n * bundle-key-shaped `reason` renders as that literal key instead of its\n * resolved text.\n */\nfunction appActionToItem(\n entry: AppActionEntry,\n present: ReturnType<typeof usePresentBlock>,\n caps: I18nCaps,\n): ActionItem {\n const label = resolveNavLabel(caps, `appActions.${entry.name}`, entry.label);\n const disabledReason =\n entry.disabledReason === undefined\n ? undefined\n : resolveContentSlot(caps, [entry.disabledReason], { default: entry.disabledReason });\n const base = {\n id: entry.name,\n label,\n disabled: entry.disabledReason !== undefined,\n disabledReason,\n };\n if (entry.kind === 'link') {\n return { ...base, href: entry.to };\n }\n // A flow hosted on a custom page is a guarded link to it (P7 3.15).\n if (entry.hostHref !== undefined) return { ...base, href: entry.hostHref };\n return {\n ...base,\n onRun: () => {\n // Name the dialog after the (already-localized) action label —\n // mirroring `ModalActionButton` (`action-button.tsx`), which does the\n // same for resource item actions. Without this, a host with no\n // `optionsSchema.title` override falls back to a humanized COMPONENT\n // name (`usePresentationCopy`/`componentLabel`, `ui-presentations/copy.ts`)\n // instead of anything the action author actually wrote — placeholder-\n // grade copy in what is otherwise a fully localized dialog. `dialog`'s\n // `optionsSchema` accepts exactly `title` / `description` / `wrapper`\n // (`dialog-host.tsx`), so only `title` is set here; the conditional\n // spread keeps `options` itself absent for a host that declares no\n // schema at all, rather than sending a key nothing asked for.\n const result = present({\n block: entry.block as { namespace: string; id: string },\n props: entry.props ?? {},\n host: entry.host ?? 'dialog',\n ...(label.length > 0 ? { label } : {}),\n });\n if (!result.ok) {\n // eslint-disable-next-line no-console\n console.error(\n `[CommandPaletteActionsGroup] app action \"${entry.name}\" failed to open block \"${entry.block?.namespace}:${entry.block?.id}\": ${result.code}`,\n );\n }\n },\n };\n}\n\ninterface MergedActions {\n readonly items: readonly ActionItem[];\n /** ids present in BOTH sources — the registry entry won each; surfaced separately so the caller can warn without re-deriving it. */\n readonly collidingIds: readonly string[];\n}\n\n/**\n * Merge registry-sourced items with the caller's `actions` prop:\n * registry first, then prop entries. On an `id` collision the registry\n * entry wins outright — the prop entry with that id is dropped, not\n * rendered twice, not silently overwritten either (the caller finds out\n * via `collidingIds`). This is the one rule this component exists to\n * enforce: a slot that quietly loses to another contributor is exactly\n * the failure mode the app-action registry was built to remove.\n */\nfunction mergeActions(\n registryItems: readonly ActionItem[],\n propItems: readonly ActionItem[],\n): MergedActions {\n const registryIds = new Set(registryItems.map((item) => item.id));\n const collidingIds: string[] = [];\n const items: ActionItem[] = [...registryItems];\n for (const item of propItems) {\n if (registryIds.has(item.id)) {\n collidingIds.push(item.id);\n continue;\n }\n items.push(item);\n }\n return { items, collidingIds };\n}\n\n/**\n * Render the \"Actions\" group inside a command palette: every app-level\n * action the registry knows about (`defineAppAction` / `registerAppAction`,\n * read via `useAppActions()` — already filtered by the deny-wins rule\n * engine, so this component does not re-gate them), followed by whatever\n * the caller passes through the `actions` prop.\n *\n * Why the prop still exists alongside the registry: the registry can only\n * hold portable data (`link`/`modal` — a destination or a component to\n * present), never a function. Actions bound to the adopter's own tree —\n * toggling a theme, switching a locale, signing out — have nowhere to live\n * in it and keep going through `actions`.\n *\n * Merge order and collisions: registry entries render FIRST, prop entries\n * after. If a prop entry's `id` matches a registry entry's `name`, the\n * registry entry wins and is kept; the prop entry is dropped and the\n * component logs exactly one `console.warn` naming the id (see\n * `mergeActions`) — never a silent overwrite.\n *\n * Behavior:\n *\n * - Both sources empty → renders nothing (no orphan \"Actions\" heading).\n * - Each item's `onRun` is awaited (sync handlers resolve immediately)\n * before `onSelect` fires, so async work finishes before the\n * palette closes.\n * - Errors thrown / rejected from `onRun` are caught + logged via\n * `console.error` and the palette still closes — the user is never\n * stuck on an overlay after a misbehaving handler.\n * - Actions with `href` set bypass `onRun` and navigate through\n * `useRouteNavigate`; an external href opens in a new window.\n * - A registry entry the rule engine allowed-but-disabled (`disabled: true`)\n * stays keyboard-reachable and dimmed (`opacity-60`), and selecting it\n * shows its `disabledReason` via `toast` instead of running the action —\n * see the long comment on `ActionItem.disabled` for why this does NOT use\n * cmdk's own `disabled` prop (it would remove the item from keyboard\n * navigation entirely, not just from activation — verified against cmdk\n * 1.1.1's source, not merely against its types).\n *\n * Example:\n *\n * ```tsx\n * <CommandPaletteActionsGroup\n * actions={[\n * {\n * id: 'toggle-theme',\n * label: 'Toggle theme',\n * onRun: () => setTheme(theme === 'dark' ? 'light' : 'dark'),\n * keywords: 'dark light mode',\n * },\n * {\n * id: 'sign-out',\n * label: 'Sign out',\n * onRun: () => auth.signOut(),\n * keywords: 'logout sign out',\n * },\n * ]}\n * onSelect={() => setOpen(false)}\n * />\n * ```\n */\nexport function CommandPaletteActionsGroup({\n actions,\n onSelect,\n getTestId,\n heading,\n}: CommandPaletteActionsGroupProps): React.ReactElement | null {\n const t = useOptionalT();\n const caps = useI18nCaps();\n const registryEntries = useAppActions();\n const present = usePresentBlock();\n const navigate = useRouteNavigate();\n const propActions = actions ?? EMPTY_ACTIONS;\n const resolvedHeading = heading ?? t('commandPalette.actions', { defaultValue: 'Actions' });\n\n // `registryEntries` can gain a fresh array identity across renders — a new\n // commit, or a change to any of `useAvailabilityGate`'s own inputs\n // (permissions/scope/user), re-runs `useAppActions`'s `useMemo` and\n // produces a new array. (`registry.appActions.list()` itself,\n // `createSnapshotRegistry`, memoizes per snapshot identity and returns a\n // STABLE reference between commits — it is not the source of any\n // per-render churn.) Regardless of how often `registryEntries` actually\n // changes, recomputing the merge here is cheap and always correct, so this\n // `useMemo` does not try to detect whether its inputs really changed. The\n // collision WARNING is kept out of this recomputation on purpose, because\n // IT does need that finer-grained guard: see the `useEffect` below.\n const { items, collidingIds } = useMemo(() => {\n // A discovery list: an action still undecided (the permission map loading) is offered once\n // decided, not as an inert entry.\n const registryItems = registryEntries\n .filter((entry) => entry.undecided !== true)\n .map((entry) => appActionToItem(entry, present, caps));\n return mergeActions(registryItems, propActions);\n }, [registryEntries, propActions, present, caps]);\n\n // Warn on a real collision exactly once — not once per render. `items`/\n // `collidingIds` can get a new array identity on any render that\n // recomputes the `useMemo` above (see its own note), so a `useEffect`\n // keyed on `collidingIds` itself would re-warn on such a render regardless\n // of whether the collision actually changed. A\n // \"latest ref\" plus a CONTENT-derived key (not identity) is what makes the\n // effect a no-op on a render that reproduces the same collision, instead\n // of re-warning every time this component re-renders for an unrelated\n // reason (typing into the palette's search input, another item's `onRun`\n // resolving, …). The `\u0000` separator is only a change signal for the\n // dependency array, never decoded back — an id containing it would still\n // warn correctly, just wouldn't have to survive a round trip.\n const collidingIdsRef = useRef<readonly string[]>(collidingIds);\n collidingIdsRef.current = collidingIds;\n const collidingIdsKey = collidingIds.join('\u0000');\n useEffect(() => {\n const ids = collidingIdsRef.current;\n if (ids.length === 0) return;\n for (const id of ids) {\n // eslint-disable-next-line no-console\n console.warn(\n `[CommandPaletteActionsGroup] action id \"${id}\" was passed via the \\`actions\\` prop but collides with a registry app action of the same id — the registry entry wins; rename one of the two ids to keep both.`,\n );\n }\n }, [collidingIdsKey]);\n\n if (items.length === 0) return null;\n\n // Activation handler. We always close the palette via `onSelect`\n // AFTER the handler resolves (or the navigation fires), and we\n // catch errors so a misbehaving handler doesn't leave the user\n // stuck on the overlay. Catching here also keeps the cmdk select\n // event from bubbling an unhandled rejection.\n const run = async (item: ActionItem): Promise<void> => {\n // A `disabled` item is never handed to `href`/`onRun` — it is still\n // selectable (see `ActionItem.disabled`'s doc for why it must stay\n // reachable), so this is the one branch that answers \"why didn't\n // anything happen\" instead of running the action. The palette is\n // deliberately left open (no `onSelect()`): nothing ran, so there is\n // nothing to close for — the user can pick a different item.\n if (item.disabled) {\n if (item.disabledReason) toast(item.disabledReason);\n return;\n }\n try {\n if (item.href) {\n // An app action's `to` arrives as a bare href. An external one\n // (https:, mailto:) leaves the app in a new window; handed to the\n // router it would be pushed as an app path.\n if (isExternalHref(item.href)) openExternal(item.href);\n else navigate(item.href);\n } else if (item.onRun) {\n await item.onRun();\n }\n } catch (err) {\n // Surface the failure but keep the palette flow intact — the\n // user always sees the overlay close on pick, regardless of the\n // handler's outcome.\n // eslint-disable-next-line no-console\n console.error(`[CommandPaletteActionsGroup] action \"${item.id}\" failed:`, err);\n } finally {\n onSelect?.();\n }\n };\n\n return (\n <CommandGroup heading={resolvedHeading} key=\"actions\">\n {items.map((item) => {\n // Compose the cmdk value: stable id + label + optional\n // keywords. cmdk's built-in fuzzy filter walks this string,\n // so synonyms (\"logout\") surface the canonical label\n // (\"Sign out\") without any extra plumbing.\n const value = ['action', item.id, item.prefix ?? '', item.label, item.keywords ?? '']\n .filter((s) => s.length > 0)\n .join(':');\n return (\n <CommandItem\n key={`action:${item.id}`}\n value={value}\n // Deliberately NOT cmdk's own `disabled` prop — see\n // `ActionItem.disabled`'s doc. The item stays a fully\n // interactive cmdk option (keyboard-navigable, clickable);\n // `opacity-60` (matching `DisabledAction`'s own convention) is\n // the only visual concession, and `run()` above is what\n // actually turns \"select\" into \"explain, don't execute\".\n className={cn(item.disabled && 'opacity-60')}\n onSelect={() => {\n void run(item);\n }}\n data-testid={getTestId?.('action', item.id)}\n >\n {item.prefix ? (\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {item.prefix}\n </span>\n ) : null}\n {item.label}\n {item.disabled && item.disabledReason ? (\n <span className=\"text-muted-foreground ml-2 text-xs\">{item.disabledReason}</span>\n ) : null}\n </CommandItem>\n );\n })}\n </CommandGroup>\n );\n}\n","'use client';\nimport { useMemo } from 'react';\nimport {\n hasListPage,\n hasRecordPage,\n resolveResourceLabel,\n resourceCreateHref,\n type ResourceDef,\n} from '@burojs/core';\nimport {\n useApp,\n useAvailabilityGate,\n useI18nCaps,\n useOptionalT,\n useQuick,\n useRouteNavigate,\n} from '@burojs/react';\nimport { opensInQuick } from './quick-targets.js';\nimport { CommandGroup, CommandItem } from '../primitives/command.js';\nimport { canonicalResourceKey } from '../resource-key.js';\nimport { useResourceVisible } from './use-nav-routing.js';\n\n/**\n * Roles emitted by the optional `getTestId` builder. Mirrors the\n * `useTestIds` pattern used by the other command-palette groups.\n *\n * - `create` — a single `\"Create new <resource>\"` item. `id` passed\n * to the builder is the resource's `name`.\n */\nexport type CommandPaletteCreateTestIdRole = 'create';\n\n/**\n * Props for `<CommandPaletteCreateGroup>`.\n */\nexport interface CommandPaletteCreateGroupProps {\n /**\n * Override which resources expose a Create entry. Default: every\n * resource with a list page that passes its `visible(ctx)` predicate.\n * Adopters who want to hide a specific resource's Create action\n * (e.g. read-only views, demo-only resources) supply a predicate\n * that returns `false` for that resource.\n */\n resourceFilter?: (def: ResourceDef) => boolean;\n /**\n * Called AFTER the navigation fires. Adopters typically wire this\n * to `setOpen(false)` so the palette closes once the user has\n * picked an entry.\n */\n onSelect?: () => void;\n /**\n * Optional test-id builder. Receives `('create', '<resource-name>')`\n * and returns the test id, or `undefined` to skip.\n */\n getTestId?: (role: CommandPaletteCreateTestIdRole, resourceName: string) => string | undefined;\n /**\n * Heading for the group. When omitted, resolves via i18n\n * (`commandPalette.create`, English fallback `\"Create\"`). Pass an\n * explicit string to override.\n */\n heading?: string;\n /**\n * Override the path generator. By default each item navigates to\n * `/<resource>/create`. Adopters with custom create routes\n * (e.g. a dedicated flow, a modal) override per-resource.\n */\n createHref?: (def: ResourceDef) => string;\n /**\n * Prefix shown muted before each resource label. When omitted,\n * resolves via i18n (`commandPalette.createNew`, English fallback\n * `\"Create new\"`). Set to an empty string to suppress.\n */\n prefix?: string;\n}\n\n/**\n * Render the per-resource quick-action group inside a command\n * palette: one `\"Create new <resource>\"` item per registered\n * visible resource with a list page.\n *\n * Filters applied (in order):\n *\n * 1. Resources with no list page (`views.list.page: false`) are\n * excluded — they are reached through a parent's placement.\n * 2. `useResourceVisible()` (the sidebar's predicate: its `visible(ctx)`) must return true.\n * Same predicate the sidebar + navigation group use, fail-closed\n * on throwing predicates. Hidden in sidebar → hidden here.\n * 3. Caller-supplied `resourceFilter` (if any). Returning `false`\n * drops the resource. Use to hide demo-only / read-only resources.\n *\n * When zero resources pass the filter chain the entire group is\n * suppressed (no orphan heading on a fresh palette).\n *\n * Example (Next App Router):\n *\n * ```tsx\n * <CommandPaletteCreateGroup\n * onSelect={() => setOpen(false)}\n * getTestId={(role, name) => `command-palette-${role}:${name}`}\n * />\n * ```\n */\nexport function CommandPaletteCreateGroup({\n resourceFilter,\n onSelect,\n getTestId,\n heading,\n createHref,\n prefix,\n}: CommandPaletteCreateGroupProps): React.ReactElement | null {\n const caps = useI18nCaps();\n const app = useApp();\n const isResourceVisible = useResourceVisible();\n const gate = useAvailabilityGate();\n const t = useOptionalT();\n const navigate = useRouteNavigate();\n const quick = useQuick();\n const resolvedHeading = heading ?? t('commandPalette.create', { defaultValue: 'Create' });\n const resolvedPrefix = prefix ?? t('commandPalette.createNew', { defaultValue: 'Create new' });\n\n const visibleResources = useMemo<ResourceDef[]>(() => {\n return (\n app.registry\n .list()\n .filter((r) => hasListPage(r))\n // The availability gate, same as `<CreateButton>` asks. Without it this\n // group offered \"Create new X\" for a resource declaring\n // `operations: { create: false }` — whose create ROUTE no longer\n // exists, so the item navigated to a 404. An entry that leads nowhere\n // is worse than a missing entry.\n //\n // `disabled` is treated as hidden here on purpose: a command-palette\n // item is a search RESULT, and a result that cannot be chosen is noise\n // in a list whose whole job is to be filtered down to one thing. This\n // is the same call the empty-state CTA makes for the same reason.\n .filter((r) => gate(canonicalResourceKey(r), 'create').state === 'available')\n // A resource without a create page creates in its `quick.create` (spec 4.7); with\n // neither there is nothing to offer.\n .filter(\n (r) =>\n hasRecordPage(r, 'create') ||\n opensInQuick(app.registry, canonicalResourceKey(r), 'create'),\n )\n .filter(isResourceVisible)\n .filter((r) => (resourceFilter ? resourceFilter(r) : true))\n );\n // isResourceVisible is intentionally a dep so flipping permissions /\n // scope refilters the list. resourceFilter is referenced by\n // identity — adopters who pass an inline closure trigger a\n // re-filter on each render, which is fine: the filter chain is\n // pure + cheap.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [app, gate, isResourceVisible, resourceFilter]);\n\n if (visibleResources.length === 0) return null;\n\n const goTo = (href: string): void => {\n navigate(href, { origin: 'jump' });\n onSelect?.();\n };\n const createIn = (def: ResourceDef, href: string): void => {\n if (hasRecordPage(def, 'create')) {\n goTo(href);\n return;\n }\n onSelect?.();\n void quick.create(canonicalResourceKey(def));\n };\n\n const resourceLabel = (def: ResourceDef): string =>\n resolveResourceLabel(caps, canonicalResourceKey(def), 'single', def);\n\n return (\n <CommandGroup heading={resolvedHeading} key=\"create\">\n {visibleResources.map((def) => {\n const resource = canonicalResourceKey(def);\n const label = resourceLabel(def);\n const href = createHref?.(def) ?? resourceCreateHref(app.registry, def, resource);\n // Compose the cmdk value: role + resource name + label + the\n // muted prefix. Including the prefix means typing `\"create\"`\n // surfaces every entry (the prefix matches the keyword).\n const value = `create:${resource}:${resolvedPrefix}:${label}`;\n return (\n <CommandItem\n key={`create:${resource}`}\n value={value}\n onSelect={() => createIn(def, href)}\n data-testid={getTestId?.('create', resource)}\n >\n {resolvedPrefix ? (\n <span className=\"text-muted-foreground group-data-[selected=true]:text-accent-foreground mr-2\">\n {resolvedPrefix}\n </span>\n ) : null}\n {label}\n </CommandItem>\n );\n })}\n </CommandGroup>\n );\n}\n","import { useRefresh, useT } from '@burojs/react';\nimport { IconRefresh } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\n\nimport { Button } from '../primitives/button.js';\nimport { cn } from '../lib/cn.js';\n\nexport interface RefreshButtonProps {\n readonly className?: string;\n}\n\n/** Ghost icon button that refetches the app's data; spins and disables while it runs. */\nexport function RefreshButton({ className }: RefreshButtonProps): ReactElement | null {\n const t = useT();\n const { refresh, isRefreshing, available } = useRefresh();\n if (!available) return null;\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('size-8', className)}\n aria-label={t('shell.refresh')}\n data-testid=\"refresh-button\"\n disabled={isRefreshing}\n onClick={() => void refresh()}\n >\n <IconRefresh className={cn(isRefreshing && 'animate-spin')} aria-hidden=\"true\" />\n </Button>\n );\n}\n","import { resolveNavLabel } from '@burojs/core';\nimport { useAppActions, useI18nCaps } from '@burojs/react';\nimport type { ReactElement } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { reasonText } from '../lib/reason-text.js';\nimport { Button } from '../primitives/button.js';\nimport { Icon } from '../primitives/icon.js';\n\n/**\n * The app-level action strip: every `defineAppAction` entry that belongs to no resource, already\n * filtered by the rule engine (`useAppActions`). Only entries that resolve to a route render: a\n * `link`, or a flow hosted on a page (`hostHref`). A `modal` entry needs a presentation host and is\n * skipped. `disabledReason` keeps the action visible but inert, with the reason as its tooltip; an\n * `undecided` one (the permission map loading) keeps its place, disabled and busy.\n */\nexport function AppActions(): ReactElement | null {\n const actions = useAppActions();\n const caps = useI18nCaps();\n const RouterLink = useLinkComponent();\n // A link, or a flow hosted on a page (P7 3.15): both are links to a route the user may open.\n const links = actions\n .map((action) => ({ action, href: action.kind === 'link' ? action.to : action.hostHref }))\n .filter(\n (entry): entry is { action: typeof entry.action; href: string } => entry.href !== undefined,\n );\n if (links.length === 0) return null;\n\n return (\n <div className=\"flex items-center gap-1\" data-testid=\"app-actions\">\n {links.map(({ action, href }) => {\n const inert = action.disabledReason !== undefined || action.undecided === true;\n const label = resolveNavLabel(caps, `appActions.${action.name}`, action.label);\n // With an icon, a phone shows only the icon; the label stays as its accessible name.\n const content =\n action.icon === undefined ? (\n label\n ) : (\n <>\n <Icon name={action.icon} />\n <span className=\"max-md:sr-only\">{label}</span>\n </>\n );\n return (\n <Button\n key={action.name}\n asChild={!inert}\n variant=\"outline\"\n size=\"sm\"\n disabled={inert}\n aria-busy={action.undecided === true ? 'true' : undefined}\n title={\n action.disabledReason === undefined\n ? undefined\n : reasonText(caps, action.disabledReason)\n }\n data-testid={`app-action:${action.name}`}\n >\n {!inert ? <RouterLink href={href}>{content}</RouterLink> : <span>{content}</span>}\n </Button>\n );\n })}\n </div>\n );\n}\n","import { useT } from '@burojs/react';\nimport { IconHelp } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\n\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\n\nexport type HelpButtonProps = { readonly className?: string } & (\n | { readonly href: string; readonly onClick?: never }\n | { readonly onClick: () => void; readonly href?: never }\n);\n\n/** Ghost icon button that opens help: a link when given `href`, a button when given `onClick`. */\nexport function HelpButton({ href, onClick, className }: HelpButtonProps): ReactElement {\n const t = useT();\n const RouterLink = useLinkComponent();\n const icon = <IconHelp aria-hidden=\"true\" />;\n if (href !== undefined) {\n return (\n <Button\n asChild\n variant=\"ghost\"\n size=\"icon\"\n className={className}\n aria-label={t('shell.help')}\n data-testid=\"help-button\"\n >\n <RouterLink href={href}>{icon}</RouterLink>\n </Button>\n );\n }\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={className}\n aria-label={t('shell.help')}\n data-testid=\"help-button\"\n onClick={onClick}\n >\n {icon}\n </Button>\n );\n}\n","'use client';\nimport { cn } from '../lib/cn.js';\nimport { Separator } from '../primitives/separator.js';\nimport { SidebarTrigger, useOptionalSidebar } from '../primitives/sidebar.js';\nimport { AppActions } from '../shell/app-actions.js';\nimport { RefreshButton } from '../shell/refresh-button.js';\nimport { fill, type Slot } from '../shell/slot.js';\nimport { CommandPaletteTrigger } from './command-palette-trigger.js';\nimport { HeaderBreadcrumbs } from './header-breadcrumbs.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppHeaderProps {\n /** The breadcrumb trail. Default `<HeaderBreadcrumbs />`, the current route's trail. */\n breadcrumbs?: Slot;\n /**\n * The search chip. Default `<CommandPaletteTrigger />`, which renders only\n * when the `ShellProvider` has an `openPalette`.\n */\n search?: Slot;\n /**\n * The right-hand controls. Default `<AppActions />` and `<RefreshButton />`;\n * each renders nothing when it has nothing to show.\n */\n actions?: Slot;\n className?: string;\n}\n\nexport function AppHeader({\n breadcrumbs,\n search,\n actions,\n className,\n}: AppHeaderProps): React.ReactElement {\n // Outside a `SidebarProvider` (an app with no sidebar) there is nothing to toggle.\n const sidebar = useOptionalSidebar();\n return (\n <header\n data-testid=\"app-header\"\n className={cn(\n 'sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/95 text-foreground px-4',\n 'supports-[backdrop-filter]:bg-background/60 supports-[backdrop-filter]:backdrop-blur',\n className,\n )}\n >\n {sidebar !== null && (\n <>\n <SidebarTrigger data-testid=\"sidebar-trigger\" className=\"-ml-1 shrink-0\" />\n <Separator orientation=\"vertical\" className=\"mr-2 h-4 shrink-0\" />\n </>\n )}\n {/*\n `min-w-0` + `overflow-hidden` on the breadcrumb slot and `shrink-0` on\n everything else. Without it a long crumb («Order for production №53»)\n refused to shrink and pushed the right-hand cluster to x=415 on a 390px\n phone: the whole page scrolled sideways and the refresh button was\n clipped off-screen. A breadcrumb is the one element here that can afford\n to truncate — the controls beside it cannot.\n */}\n {/* On a phone the trail keeps only where you are (and its help): the parents truncated to\n «S… › Nord…» said nothing anyway. */}\n <div className=\"min-w-0 flex-1 overflow-hidden max-md:[&_nav>:not([aria-current]):not(button)]:hidden\">\n {fill(breadcrumbs, () => (\n <HeaderBreadcrumbs />\n ))}\n </div>\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {fill(search, () => (\n <CommandPaletteTrigger />\n ))}\n {fill(actions, () => (\n <>\n <AppActions />\n <RefreshButton />\n </>\n ))}\n </div>\n </header>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('rounded-lg border bg-card text-card-foreground shadow-xs', className)}\n {...props}\n />\n));\nCard.displayName = 'Card';\n\nexport type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nexport type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\n\nconst CardTitle = React.forwardRef<HTMLParagraphElement, CardTitleProps>(\n ({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn('text-2xl font-semibold leading-none tracking-tight', className)}\n {...props}\n />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nexport type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst CardDescription = React.forwardRef<HTMLParagraphElement, CardDescriptionProps>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />\n ),\n);\nCardContent.displayName = 'CardContent';\n\nexport type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };\n","'use client';\nimport { useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { z } from 'zod';\nimport { IconAlertCircle, IconLoader2 } from '@tabler/icons-react';\nimport { resolveErrorText, useI18nCaps, useOptionalT, useTestIds } from '@burojs/react';\nimport { friendlyStringsFrom, technicalText, toFriendlyError } from '../lib/friendly-error.js';\nimport { Button } from '../primitives/button.js';\nimport { Input } from '../primitives/input.js';\nimport { Label } from '../primitives/label.js';\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '../primitives/card.js';\nimport { cn } from '../lib/cn.js';\n\nconst schema = z.object({\n email: z.string().email('Invalid email'),\n password: z.string().min(1, 'Password required'),\n});\nexport type LoginCredentials = z.infer<typeof schema>;\n\n/**\n * The login form is the one screen every user sees, and it was the last\n * place still speaking English into a Russian UI: zod's literals above and\n * the raw `err.message` from a failed sign-in (which surfaced a JSON 401\n * body verbatim). Both are localized here.\n */\n/**\n * Recognise a wrong-credentials failure and say so plainly. Anything else\n * the adopter's `onSubmit` threw is theirs and passes through untouched.\n */\nfunction credentialsMessage(raw: string, t: ReturnType<typeof useOptionalT>): string {\n if (/invalid-email-password|401|Incorrect email or password|Unauthorized/i.test(raw)) {\n return t('auth.invalidCredentials', {\n defaultValue: 'Incorrect email or password.',\n });\n }\n return raw;\n}\n\nfunction localizedSchema(t: ReturnType<typeof useOptionalT>) {\n return z.object({\n email: z.string().email(t('auth.invalidEmail', { defaultValue: 'Invalid email' })),\n password: z.string().min(1, t('auth.passwordRequired', { defaultValue: 'Password required' })),\n });\n}\n\nexport interface LoginFormProps {\n onSubmit: (creds: LoginCredentials) => Promise<void>;\n title?: string;\n description?: string;\n className?: string;\n}\n\nexport function LoginForm({\n onSubmit,\n title,\n description,\n className,\n}: LoginFormProps): React.ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const caps = useI18nCaps();\n const resolvedTitle = title ?? t('auth.signIn', { defaultValue: 'Sign in' });\n const {\n register,\n handleSubmit,\n formState: { errors, isSubmitting },\n } = useForm<LoginCredentials>({\n resolver: zodResolver(localizedSchema(t)),\n defaultValues: { email: '', password: '' },\n });\n const [submitError, setSubmitError] = useState<string | null>(null);\n\n const submit = handleSubmit(async (values) => {\n setSubmitError(null);\n try {\n await onSubmit(values);\n } catch (e) {\n // ⚠️ FOURTH `toFriendlyError` call site. Without it a failed sign-in\n // printed the transport's own words at the user — acceptance testing\n // saw `Sign-in failed (401): {\"error\":\"invalid-email-password\",…}`,\n // raw JSON, on the first screen of the app.\n // A thrown `DataError` carries no sentence in `message` (a reference): its technical text\n // is what the patterns below read, and its resolved text is what the user is shown.\n const dataCode =\n e !== null && typeof e === 'object' && !(e instanceof Error)\n ? (e as { readonly code?: unknown }).code\n : undefined;\n const raw =\n e instanceof Error\n ? e.message\n : (technicalText(e) ?? (dataCode === undefined ? String(e) : ''));\n const friendly = toFriendlyError(raw, '', friendlyStringsFrom(t));\n const credentials = credentialsMessage(raw, t);\n setSubmitError(\n friendly.replaced\n ? `${friendly.title}. ${friendly.detail}`\n : typeof dataCode === 'string' && credentials === raw\n ? resolveErrorText(e as { code: string }, caps)\n : credentials,\n );\n }\n });\n\n return (\n <Card className={cn('mx-auto w-full max-w-sm', className)}>\n <CardHeader className=\"space-y-1.5 text-center\">\n <CardTitle className=\"text-2xl\">{resolvedTitle}</CardTitle>\n {description && <CardDescription className=\"text-balance\">{description}</CardDescription>}\n </CardHeader>\n <form onSubmit={submit} noValidate>\n <CardContent className=\"space-y-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-email\" required>\n {t('auth.email', { defaultValue: 'Email' })}\n </Label>\n <Input\n id=\"login-email\"\n type=\"email\"\n autoComplete=\"email\"\n required\n aria-required=\"true\"\n data-testid={tid.loginEmail()}\n aria-invalid={!!errors.email}\n aria-describedby={errors.email ? 'login-email-error' : undefined}\n {...register('email')}\n />\n {errors.email && (\n <p\n id=\"login-email-error\"\n role=\"alert\"\n className=\"text-sm font-medium text-destructive\"\n data-testid=\"login-email-error\"\n >\n {errors.email.message}\n </p>\n )}\n </div>\n <div className=\"space-y-1\">\n <Label htmlFor=\"login-password\" required>\n {t('auth.password', { defaultValue: 'Password' })}\n </Label>\n <Input\n id=\"login-password\"\n type=\"password\"\n autoComplete=\"current-password\"\n required\n aria-required=\"true\"\n data-testid={tid.loginPassword()}\n aria-invalid={!!errors.password}\n aria-describedby={errors.password ? 'login-password-error' : undefined}\n {...register('password')}\n />\n {errors.password && (\n <p\n id=\"login-password-error\"\n role=\"alert\"\n className=\"text-sm font-medium text-destructive\"\n data-testid=\"login-password-error\"\n >\n {errors.password.message}\n </p>\n )}\n </div>\n {submitError && (\n <div\n role=\"alert\"\n data-testid=\"login-error\"\n className=\"flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive\"\n >\n <IconAlertCircle className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n <p className=\"font-medium leading-snug\">{submitError}</p>\n </div>\n )}\n </CardContent>\n <CardFooter>\n <Button\n type=\"submit\"\n disabled={isSubmitting}\n aria-busy={isSubmitting}\n data-testid={tid.loginSubmit()}\n className=\"w-full\"\n >\n {isSubmitting && (\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" aria-hidden=\"true\" />\n )}\n {isSubmitting\n ? t('auth.signingIn', { defaultValue: 'Signing in…' })\n : t('auth.signIn', { defaultValue: 'Sign in' })}\n </Button>\n </CardFooter>\n </form>\n </Card>\n );\n}\n","'use client';\nimport type { ReactNode } from 'react';\nimport { cn } from '../lib/cn.js';\nimport { BrandMark } from '../shell/brand-mark.js';\nimport { fill } from '../shell/slot.js';\n\nexport interface AuthPageProps {\n children: ReactNode;\n /**\n * The brand above the auth card. Omit it for `<BrandMark />` (the `ShellProvider` brand, if\n * any); pass `false` for none; pass an element to replace it.\n */\n brand?: ReactNode;\n /** Optional footer text under the auth card (e.g. legal). */\n footer?: ReactNode;\n className?: string;\n}\n\n/**\n * Full-viewport auth page wrapper. Centers the auth card vertically\n * and horizontally over a `bg-muted/40` backdrop, and exposes brand/\n * footer slots for consumer customization.\n *\n * The muted background gives the card a subtle anchor without\n * dominating it — the card's own border + foreground content carries\n * the visual weight, matching shadcn Authentication 01's centered-\n * card variant rather than the two-column hero variant.\n *\n * Designed to wrap a single `<LoginForm>` (or `<SignupForm>`, etc.) so\n * unauthenticated entry points feel deliberate instead of \"floating card\n * on bare white\".\n */\nexport function AuthPage({\n children,\n brand,\n footer,\n className,\n}: AuthPageProps): React.ReactElement {\n return (\n <div\n className={cn(\n 'flex min-h-screen flex-col items-center justify-center gap-6 bg-muted/40 p-6',\n className,\n )}\n >\n <div className=\"mb-2 empty:hidden\">\n {fill(brand, () => (\n <BrandMark />\n ))}\n </div>\n <div className=\"w-full\">{children}</div>\n {footer && <div className=\"text-xs text-muted-foreground\">{footer}</div>}\n </div>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { EnumControl } from '@burojs/core';\nimport { useOptionalT } from '@burojs/react';\nimport { cn } from '../lib/cn.js';\nimport { Icon } from '../primitives/icon.js';\nimport { EnumSettlingRow, type EnumSettling } from './enum-settling.js';\n\n/** One resolved choice: what the caller has already looked up for a value. */\nexport interface EnumChoiceOption {\n value: string;\n /** Display label, already localized. */\n label: string;\n /** Semantic icon key, rendered before the label (as on badges). */\n icon?: string;\n /** One-line value documentation, plain text, shown under the label by `cards` and `radio`. */\n summary?: string;\n}\n\nexport interface EnumChoiceGroupProps {\n control: Exclude<EnumControl, 'select'>;\n options: readonly EnumChoiceOption[];\n /**\n * The current value when it is not one of `options` (REF-132 §8): drawn first, checked and\n * inert, so a stored value the set does not offer still shows. Pass it only while `value` is\n * that value; once the user picks an option it is gone and cannot be picked again.\n */\n current?: EnumChoiceOption;\n /**\n * The available set is not settled (REF-132 §7.4): a status row stands in for the options and\n * no \"None\" option is offered; `current` still shows the stored value.\n */\n settling?: EnumSettling;\n value: string | null | undefined;\n /** The picked value, or `undefined` when the \"None\" option is picked. */\n onChange: (value: string | undefined) => void;\n testid: string;\n /** Radio group name. Defaults to a per-instance id, so two groups never share one. */\n name?: string;\n id?: string;\n /** A required group offers no \"None\" option. */\n required?: boolean;\n disabled?: boolean;\n ariaInvalid?: boolean;\n ariaDescribedBy?: string;\n ariaErrorMessage?: string;\n /**\n * Id of the element that names the group, set as its `aria-labelledby`. A\n * form's `<label for>` cannot name a `radiogroup` (a `div` is not labelable),\n * so the field's label id has to arrive this way.\n */\n ariaLabelledBy?: string;\n className?: string;\n}\n\n/** Test-id and input-value suffix of the \"None\" option. */\nconst NONE = '__none__';\n\nfunction isEmpty(value: string | null | undefined): boolean {\n return value === null || value === undefined || value === '';\n}\n\n/**\n * The non-select enum controls, shared by every enum input that resolves its\n * own options:\n *\n * - `cards`: a vertical stack of bordered cards, each a `<label>` around a\n * native radio, the label in medium weight and the summary under it.\n * - `radio`: the same structure without the card borders (the dense variant).\n * - `segmented`: a row of toggle buttons; no summaries, which do not fit in a\n * button. Meant for two to four short values.\n *\n * A radio group cannot be unselected, so a non-required group offers a \"None\"\n * option first. It is checked while the value is empty and maps back to\n * `undefined` through `onChange`.\n *\n * `cards` and `radio` use native `<input type=\"radio\">` sharing one `name`:\n * arrow-key navigation and a single tab stop come from the browser.\n */\nexport function EnumChoiceGroup({\n control,\n options,\n current,\n settling,\n value,\n onChange,\n testid,\n name,\n id,\n required,\n disabled,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n className,\n}: EnumChoiceGroupProps): React.ReactElement {\n const t = useOptionalT();\n const generatedName = React.useId();\n const groupName = name ?? generatedName;\n const empty = isEmpty(value);\n const noneLabel = t('field.none', { defaultValue: 'None' });\n // Native `disabled` already blocks a user's click; the guard also holds\n // against a programmatic `click()` (and jsdom), which still flips a disabled\n // radio and fires React's `onChange`.\n const pick = (next: string | undefined): void => {\n if (!disabled) onChange(next);\n };\n const ariaProps = {\n 'aria-invalid': ariaInvalid || undefined,\n 'aria-describedby': ariaDescribedBy,\n ...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {}),\n };\n\n if (control === 'segmented') {\n const segmentLabel = (option: EnumChoiceOption) => (\n <>\n {option.icon ? (\n <span data-testid={`${testid}:option:${option.value}:icon`} className=\"contents\">\n <Icon name={option.icon} className=\"size-3.5 shrink-0\" />\n </span>\n ) : null}\n {option.label}\n </>\n );\n const segment = (\n key: string,\n label: React.ReactNode,\n active: boolean,\n select: () => void,\n currentItem = false,\n ) => (\n <button\n key={currentItem ? `current:${key}` : key}\n type=\"button\"\n aria-pressed={active}\n data-state={active ? 'active' : 'inactive'}\n data-testid={currentItem ? `${testid}:current` : `${testid}:option:${key}`}\n {...(currentItem ? { 'data-current': '' } : {})}\n disabled={disabled || currentItem}\n onClick={select}\n className={cn(\n 'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all',\n 'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n )}\n >\n {label}\n </button>\n );\n return (\n <div\n role=\"group\"\n id={id}\n aria-labelledby={ariaLabelledBy}\n data-testid={testid}\n className={cn(\n 'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',\n className,\n )}\n {...ariaProps}\n >\n {current === undefined\n ? null\n : segment(current.value, segmentLabel(current), true, () => undefined, true)}\n {required || settling !== undefined\n ? null\n : segment(NONE, noneLabel, empty, () => pick(undefined))}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={testid} />}\n {options.map((option) =>\n segment(option.value, segmentLabel(option), value === option.value, () =>\n pick(option.value),\n ),\n )}\n </div>\n );\n }\n\n const cards = control === 'cards';\n const choice = (\n key: string,\n option: EnumChoiceOption | undefined,\n label: string,\n checked: boolean,\n select: () => void,\n currentItem = false,\n ) => {\n const inputId = `${id ?? groupName}:${currentItem ? 'current:' : ''}${key}`;\n const inert = disabled || currentItem;\n return (\n <label\n key={currentItem ? `current:${key}` : key}\n htmlFor={inputId}\n className={cn(\n 'flex items-start gap-2.5',\n cards &&\n 'cursor-pointer rounded-lg border px-3 py-2.5 transition-colors hover:bg-accent/50 has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring',\n cards && (checked ? 'border-primary' : 'border-input'),\n inert && 'cursor-not-allowed opacity-60',\n )}\n >\n <input\n type=\"radio\"\n id={inputId}\n name={groupName}\n value={key}\n checked={checked}\n onChange={select}\n disabled={inert}\n {...ariaProps}\n data-testid={currentItem ? `${testid}:current` : `${testid}:option:${key}`}\n {...(currentItem ? { 'data-current': '' } : {})}\n className={cn('h-4 w-4 shrink-0 accent-primary', cards ? 'mt-0.5' : 'mt-1')}\n />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className={cn('flex items-center gap-1.5', cards && 'font-medium')}>\n {option?.icon ? (\n <span data-testid={`${testid}:option:${key}:icon`} className=\"contents\">\n <Icon name={option.icon} className=\"size-4 shrink-0\" />\n </span>\n ) : null}\n <span>{label}</span>\n </span>\n {option?.summary === undefined || option.summary === '' ? null : (\n <span\n data-testid={`${testid}:option:${key}:doc`}\n className=\"text-sm text-muted-foreground\"\n >\n {option.summary}\n </span>\n )}\n </span>\n </label>\n );\n };\n\n return (\n <div\n role=\"radiogroup\"\n id={id}\n aria-labelledby={ariaLabelledBy}\n data-testid={testid}\n aria-required={required}\n className={cn('flex flex-col', cards ? 'gap-2' : 'gap-1.5', className)}\n >\n {current === undefined\n ? null\n : choice(current.value, current, current.label, true, () => undefined, true)}\n {required || settling !== undefined\n ? null\n : choice(NONE, undefined, noneLabel, empty, () => pick(undefined))}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={testid} />}\n {options.map((option) =>\n choice(option.value, option, option.label, value === option.value, () =>\n pick(option.value),\n ),\n )}\n </div>\n );\n}\n","'use client';\n\nimport type * as React from 'react';\nimport {\n type EnumUseSite,\n useApp,\n useAvailableEnumValues,\n useEnumValues,\n useI18nCaps,\n useOptionalT,\n} from '@burojs/react';\nimport {\n type EnumControl,\n type EnumValue,\n enumValueText,\n resolveDoc,\n resolveEnumLabel,\n} from '@burojs/core';\nimport type { EnumNameOrRef } from '@burojs/core';\nimport { enumBindingKey, resolveEnumParams } from '@burojs/core/internal';\nimport { EnumChoiceGroup, type EnumChoiceOption } from './enum-choice-group.js';\nimport { EnumSettlingRow, unknownEnumValueLabel } from './enum-settling.js';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\n\n/**\n * Internal sentinel used as the `value` for the \"All\" / clear item when\n * `clearable` is set. Radix `<SelectItem value=\"\">` is forbidden, so we use\n * a non-empty string that no real enum will ever collide with and translate\n * it back to `undefined` before calling the consumer's `onChange`.\n */\nexport const ENUM_PICKER_CLEAR_SENTINEL = '__buro_clear__';\n\nexport interface EnumPickerProps<N extends string = string> {\n /** The enum's name, checked against the registered enums, or its entity ref `{ namespace, id }`. */\n enumName: EnumNameOrRef<N>;\n value: string | null | undefined;\n /**\n * Called whenever the user picks an option. `value` is `undefined` when\n * the user picks the select's \"All\" item (`clearable`) or the \"None\"\n * option of a non-required `cards` / `radio` / `segmented` control —\n * consumers use that to clear their state. Otherwise it is one of the\n * enum's declared values.\n */\n onChange: (value: string | undefined) => void;\n /**\n * The control that renders the values. Defaults to `'select'`. `cards`,\n * `radio` and `segmented` offer a \"None\" option first unless `required`.\n */\n control?: EnumControl;\n /** HTML name attribute (form integration). */\n name?: string;\n /** HTML id attribute. */\n id?: string;\n /** Test-id override. Defaults to `enum-picker:<enumName>`. */\n testid?: string;\n /** Placeholder for the empty state in `select` mode. */\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n /** Validation state supplied by a form renderer. */\n ariaInvalid?: boolean;\n /** Help-text ids that describe the underlying control. */\n ariaDescribedBy?: string;\n /** Current field-error element id, valid only while ariaInvalid is true. */\n ariaErrorMessage?: string;\n /**\n * Id of the field's label. Names the `cards` / `radio` / `segmented` group\n * (`aria-labelledby`), which a `<label for>` cannot. The select trigger is a\n * labelable button and keeps its name from the label's `for`.\n */\n ariaLabelledBy?: string;\n className?: string;\n /**\n * When `true`, prepend an \"All\" item (label customizable via\n * `clearLabel`) to the dropdown that maps back to `undefined` on\n * selection. Use this for filter-style pickers where \"no filter\" is a\n * valid state. Defaults to `false` so existing form-input call sites\n * (where the value is required) keep their old behavior.\n *\n * Only honored by the `select` control. The other controls clear through\n * their \"None\" option, shown whenever `required` is not set.\n */\n clearable?: boolean;\n /** Label for the clear item. Defaults to \"All\". */\n clearLabel?: string;\n /**\n * The field's use site (REF-132 §7.2): its `params`, its `narrow` and the sources they read.\n * Given, the picker offers only the available set (§7.6); absent, every value, as a filter\n * offers them. Either way a current value that is not offered still shows (§8), as a\n * \"current\" item that cannot be picked again once the user moves away.\n */\n use?: EnumUseSite;\n}\n\nconst NO_VALUES: readonly EnumValue[] = Object.freeze([]);\n\n/** `{ summary }` when there is one, so an absent summary stays an absent key. */\nfunction withSummary(summary: string | undefined): { summary?: string } {\n return summary === undefined ? {} : { summary };\n}\n\n/**\n * Single picker primitive that renders enum values with one of the\n * `EnumControl`s: a Select (default), bordered cards (`control='cards'`), a\n * compact radio list (`control='radio'`), or a segmented control\n * (`control='segmented'`). The three non-select controls are the shared\n * `EnumChoiceGroup`; this component only resolves the options (label, icon,\n * value summary) from the registered enum.\n *\n * Falls back to a disabled placeholder when the enum is not registered —\n * matches the EnumBadge fallback policy: a half-shipped enum should not\n * crash the form.\n */\nexport function EnumPicker<const N extends string = string>({\n enumName: enumInput,\n value,\n onChange,\n control = 'select',\n name,\n id,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n className,\n clearable = false,\n clearLabel = 'All',\n use,\n}: EnumPickerProps<N>): React.ReactElement {\n const enumName = enumBindingKey(enumInput) ?? '';\n const app = useApp();\n const t = useOptionalT();\n const def = app.registry.enums.get(enumName);\n const caps = useI18nCaps();\n const ns = (def as { i18nNamespace?: string } | undefined)?.i18nNamespace ?? enumName;\n // A loader enum's use site resolves its parameters before the fetch (REF-132 D10): the picker\n // loads the key they resolve to. While one is pending, or once one failed, nothing loads and the\n // set settles as a static enum's does over the same source: the stored value as the current\n // item beside a loading or failure row (§8). A static enum is unchanged.\n const loaderParams =\n def !== undefined && def.values === undefined && use !== undefined\n ? resolveEnumParams(def.params, use.params, use.sources)\n : undefined;\n const unsettledParams = loaderParams !== undefined && loaderParams.status !== 'ready';\n const {\n values: loadedValues,\n isLoading,\n error,\n } = useEnumValues(enumName, loaderParams?.status === 'ready' ? loaderParams.params : undefined, {\n enabled: !unsettledParams,\n });\n // No values are read for unsettled parameters: none is known, and the set resolves the same\n // parameters to pending or failed by itself.\n const values = unsettledParams ? NO_VALUES : loadedValues;\n const available = useAvailableEnumValues({\n values: isLoading || values === undefined ? 'pending' : values,\n ...(def === undefined ? {} : { enum: def }),\n ...(use === undefined ? {} : { use }),\n });\n const tid = testid ?? `enum-picker:${enumName}`;\n\n if (!def) {\n return (\n <span data-testid={`${tid}:unregistered`} className=\"text-muted-foreground\">\n (enum &lsquo;{enumName}&rsquo; not registered)\n </span>\n );\n }\n\n // Loader-backed enum still resolving — render a disabled select placeholder\n // so the form layout is stable. (An available set that is not settled yet\n // is drawn below: its values are known, so the stored value keeps its label.)\n if (isLoading) {\n return (\n <Select disabled>\n <SelectTrigger\n data-testid={`${tid}:loading`}\n name={name}\n id={id}\n aria-busy=\"true\"\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n className={className}\n >\n <SelectValue placeholder={t('field.loading', { defaultValue: 'Loading…' })} />\n </SelectTrigger>\n <SelectContent />\n </Select>\n );\n }\n\n // Loader rejected — degrade to the same unregistered fallback so the\n // adopter notices in dev but the form does not crash. The error message\n // is included via `title` for inspection.\n if (error || !values) {\n return (\n <LoadError\n surface=\"picker\"\n error={error}\n testId={`${tid}:error`}\n className=\"text-muted-foreground\"\n fallback={{ key: 'relation.failed', default: 'Failed to load options.' }}\n >\n (failed to load enum &lsquo;{enumName}&rsquo;)\n </LoadError>\n );\n }\n\n const labelOf = (entry: EnumValue): string =>\n resolveEnumLabel(caps, ns, entry.value, enumValueText(def, entry.value) ?? entry.label);\n const summaryOf = (entry: EnumValue): string | undefined =>\n resolveDoc(caps, `enum/${ns}/${entry.value}`)?.summary || undefined;\n\n // The current value when it is not offered (REF-132 §8): a known value the set removed shows\n // its label, an unknown one the enum's fallback or the raw value. Once the user picks an\n // offered value it is gone, so it cannot be picked again. While the set is not settled\n // (pending, or a source failed: §7.4) nothing is offered, the stored value shows as the\n // current item and a status row stands in for the options.\n const settling = available.status === 'ready' ? undefined : available.status;\n const offered = settling === undefined ? available.values : [];\n const known = value == null ? undefined : values.find((entry) => entry.value === value);\n const current: EnumChoiceOption | undefined =\n value == null || value === '' || offered.some((entry) => entry.value === value)\n ? undefined\n : known === undefined\n ? { value, label: unknownEnumValueLabel(caps, def, ns, value).label }\n : {\n value,\n label: labelOf(known),\n ...(known.icon === undefined ? {} : { icon: known.icon }),\n };\n\n if (control !== 'select') {\n return (\n <EnumChoiceGroup\n control={control}\n {...(current === undefined ? {} : { current })}\n {...(settling === undefined ? {} : { settling })}\n options={offered.map((entry) => ({\n value: entry.value,\n label: labelOf(entry),\n ...(entry.icon === undefined ? {} : { icon: entry.icon }),\n ...withSummary(summaryOf(entry)),\n }))}\n value={value}\n onChange={onChange}\n testid={tid}\n name={name}\n id={id}\n required={required}\n disabled={disabled}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n ariaLabelledBy={ariaLabelledBy}\n className={className}\n />\n );\n }\n\n // 'select' (default)\n // When `clearable`, we prepend an \"All\" item using a sentinel value\n // because Radix forbids `<SelectItem value=\"\">`. We translate the\n // sentinel back to `undefined` before notifying the consumer; the\n // controlled-input `value` falls back to the sentinel when the consumer\n // passes null/undefined so the trigger reads \"All\" rather than the\n // placeholder.\n const selectValue = value == null ? (clearable ? ENUM_PICKER_CLEAR_SENTINEL : '') : value;\n const handleValueChange = (next: string): void => {\n if (clearable && next === ENUM_PICKER_CLEAR_SENTINEL) {\n onChange(undefined);\n return;\n }\n onChange(next);\n };\n return (\n <Select\n value={selectValue}\n onValueChange={handleValueChange}\n disabled={disabled}\n required={required}\n >\n <SelectTrigger\n data-testid={tid}\n name={name}\n id={id}\n aria-required={required}\n aria-busy={settling === 'pending' || undefined}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n className={className}\n >\n <SelectValue placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })} />\n </SelectTrigger>\n <SelectContent>\n {clearable && (\n <SelectItem value={ENUM_PICKER_CLEAR_SENTINEL} data-testid={`${tid}:option:__clear__`}>\n {clearLabel}\n </SelectItem>\n )}\n {current === undefined ? null : (\n <SelectItem value={current.value} disabled data-current=\"\" data-testid={`${tid}:current`}>\n {current.label}\n </SelectItem>\n )}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={tid} />}\n {offered.map((entry) => {\n const optionLabel = labelOf(entry);\n // Documentation for a value renders as PLAIN TEXT, never as a\n // button, and is passed as the item's `description` so it sits\n // OUTSIDE `ItemText`. Radix clones `ItemText` into the closed trigger\n // on selection, so a summary inside it would be glued onto the\n // selected label; an interactive child would also be unreachable by\n // keyboard, since the item owns roving focus. The «i» affordance is\n // reserved for the cmdk-based pickers, where an item can host one.\n const optionDoc = summaryOf(entry);\n return (\n <SelectItem\n key={entry.value}\n value={entry.value}\n data-testid={`${tid}:option:${entry.value}`}\n description={\n optionDoc === undefined ? undefined : (\n <span data-testid={`${tid}:option:${entry.value}:doc`}>{optionDoc}</span>\n )\n }\n >\n {optionLabel}\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n );\n}\n","import { ENUM_CONTROLS, type EnumControl, type EnumDef, isEnumControl } from '@burojs/core';\n\n/** `where` + value pairs already warned about, so a re-render does not repeat the warning. */\nconst warned = new Set<string>();\n\n/**\n * The control an enum field renders with: the field's own `ui.control`, else\n * the bound enum's `control`, else `'select'`.\n *\n * A field control that is not one of the four (possible from JavaScript or a\n * lowered declaration) is ignored with one `console.warn` naming `where` and\n * the value, and resolution falls through to the enum's control. An enum's own\n * `control` needs no check here: `defineEnum` refuses an unknown one.\n */\nexport function resolveEnumControl(\n fieldControl: unknown,\n enumDef: EnumDef | undefined,\n where: string,\n): EnumControl {\n if (isEnumControl(fieldControl)) return fieldControl;\n if (fieldControl !== undefined) {\n // `String()`, not a bare template: a symbol in a template literal throws.\n const shown = typeof fieldControl === 'string' ? `'${fieldControl}'` : String(fieldControl);\n const key = `${where}\\u0000${shown}`;\n if (!warned.has(key)) {\n warned.add(key);\n // eslint-disable-next-line no-console\n console.warn(\n `[buro/ui-shadcn] ${where}: unknown enum control ${shown}; expected one of ${ENUM_CONTROLS.map((control) => `'${control}'`).join(', ')}. Using the enum's control, else 'select'.`,\n );\n }\n }\n return enumDef?.control ?? 'select';\n}\n","import type { ValidationIssue, ValidationIssues } from '@burojs/core';\n\n/**\n * `ValidationIssue.severity` is a REQUIRED field (`'error' | 'warning' |\n * 'info'`) — every producer in the codebase already tags one, but nothing\n * downstream of core read it: a `severity: 'warning'` issue rendered red,\n * set `aria-invalid`, and blocked submit exactly like an error. This module\n * is the single place that decides what counts as blocking.\n *\n * Mirrors `@burojs/react`'s `useFormController` controller\n * (`packages/react/src/forms/use-declarative-form.ts:264-279`), which\n * already partitions the same way on the headless side — keep both in sync\n * if the severity contract ever grows a fourth bucket.\n */\nexport function isErrorIssue(issue: ValidationIssue): boolean {\n return issue.severity === 'error';\n}\n\nexport interface PartitionedIssues {\n /** Blocking: sets `aria-invalid`, gates submit, steals focus on submit. */\n readonly errors: ValidationIssues;\n /** Non-blocking (`'warning'` and `'info'`): rendered in a distinct, non-destructive channel. */\n readonly warnings: ValidationIssues;\n}\n\n/** Split a canonical issue list into blocking errors and non-blocking warnings/info, discarding neither. */\nexport function partitionIssuesBySeverity(issues: ValidationIssues): PartitionedIssues {\n const errors: ValidationIssue[] = [];\n const warnings: ValidationIssue[] = [];\n for (const issue of issues) {\n (isErrorIssue(issue) ? errors : warnings).push(issue);\n }\n return Object.freeze({ errors: Object.freeze(errors), warnings: Object.freeze(warnings) });\n}\n","'use client';\nimport type * as React from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { Checkbox } from '../primitives/checkbox.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nexport function BooleanDisplay({ value, text }: FieldRendererProps): React.ReactElement {\n const t = useOptionalT();\n if (value == null) return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces Yes / No.\n if (text !== undefined) return <span>{text}</span>;\n return (\n <span>\n {value ? t('boolean.yes', { defaultValue: 'Yes' }) : t('boolean.no', { defaultValue: 'No' })}\n </span>\n );\n}\n\nexport function BooleanInput({\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n}: FieldInputProps): React.ReactElement {\n return (\n <Checkbox\n name={name}\n id={id}\n checked={Boolean(value)}\n onCheckedChange={(v) => onChange(v === true)}\n data-testid={testid}\n disabled={disabled}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport {\n type TimeKind,\n canonicalInstant,\n epochMsToInstant,\n formatTimeValue,\n isCalendarDate,\n zoneShortName,\n} from '@burojs/core';\nimport { useOptionalLocale, useTimeZone } from '@burojs/react';\nimport { Input } from '../primitives/input.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { dateDisplayParams, useFieldTimeZone } from './field-time-zone.js';\nimport { localeTag } from './format.js';\nimport { fromLocalDateTimeText, toLocalDateTimeText } from './local-date-time.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nexport function DateDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"date\" {...props} />;\n}\n\n/**\n * Date AND time for a date-time field (`f.dateTime()`), in the live app locale and the field's\n * resolved zone (REF-118 §4.2): the field's own, else the user's, the app's and the host's.\n */\nexport function DateTimeDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"dateTime\" {...props} />;\n}\n\n/** A wall time (`f.time()`), shown in the live locale; it has no zone. */\nexport function TimeDisplay(props: FieldRendererProps): React.ReactElement {\n return <TemporalDisplay kind=\"time\" {...props} />;\n}\n\n/** The text a value is stored as: a `Date` reads as its ISO instant. */\nfunction storedText(value: unknown): string {\n return value instanceof Date && !Number.isNaN(value.getTime())\n ? value.toISOString()\n : String(value);\n}\n\nfunction TemporalDisplay({\n kind,\n value,\n text,\n field,\n record,\n}: FieldRendererProps & { readonly kind: TimeKind }): React.ReactElement {\n // Subscribe to the live locale so a language switch re-renders this cell in\n // place — matching `EnumDisplay`/`BooleanDisplay`. Without this, a table\n // row memoized on `row.original` (see data-table.tsx's `MemoRow`/`MemoCell`)\n // never re-renders on a locale-only change, so this cell would stay frozen\n // in the OLD language's date format while everything else flips.\n //\n // `useOptionalLocale` and not `useLocale`, and the difference is the whole\n // fix (F20): `useLocale` answers `'en'` both for \"the app is in English\" and\n // for \"there is no provider\", so a renderer that has its OWN fallback for the\n // second case cannot reach it. The optional form answers `undefined` there,\n // and the formatter then falls back to the persisted locale\n // — which is what `fields-display.test.tsx` drives, and what an\n // isolated (Storybook / no-provider) mount needs.\n //\n // In the app the value passed here is the REGISTERED locale code, so a\n // registry of `en`/`es`/`fr` formats as those.\n const locale = useOptionalLocale();\n // The zone the value is read in, and the viewer's own: the zone's name shows only when they\n // differ. A calendar date and a wall time have no zone, and ignore both.\n const zone = useFieldTimeZone(field?.zone, record);\n const viewer = useTimeZone();\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n if (zone.status === 'pending' || viewer.status === 'pending')\n return <Skeleton className=\"h-4 w-24\" aria-busy=\"true\" />;\n const raw = storedText(value);\n const formatted = formatTimeValue(kind, raw, {\n zone: zone.zone,\n viewerZone: viewer.zone,\n locale: localeTag(locale),\n params: {\n // A time field that is edited to the second is shown to the second, unless it says otherwise.\n ...(kind === 'time' && field?.ui?.seconds === true ? { timeStyle: 'medium' as const } : {}),\n ...dateDisplayParams(field?.ui),\n },\n });\n // A formatter's text is not a single date token, so it may wrap like any text. The full date\n // goes in the hover title: «2 days ago» alone cannot say which day.\n if (text !== undefined) return <span title={formatted}>{text}</span>;\n // Unparseable (a hand-edited value): the raw text is more honest than \"Invalid Date\".\n if (formatted === undefined) return <span>{raw}</span>;\n // `whitespace-nowrap`: a short date in some locales renders as «19 Jul 2026 AD» and\n // wrapped in a narrow table column, leaving «AD» stranded on a second line and\n // making that row taller than its neighbours — the table's row rhythm broke on\n // whichever rows happened to wrap. A date is a single token; never break it.\n return <span className=\"whitespace-nowrap\">{formatted}</span>;\n}\n\n/** A stored calendar date as the `date` box wants it; anything but `YYYY-MM-DD` reads as empty. */\nfunction toIsoDate(v: unknown): string {\n if (v == null || v === '') return '';\n const s = String(v);\n return isCalendarDate(s) ? s : '';\n}\n\nexport function DateInput(props: FieldInputProps): React.ReactElement {\n return (\n <TemporalInput {...props} type=\"date\" toText={toIsoDate} fromText={(text) => text || null} />\n );\n}\n\n/**\n * A date-time field (`f.dateTime()`): edited as the wall time of the field's resolved zone\n * (REF-118 §4.8), written as a canonical instant (see `local-date-time.ts`). The zone's short name\n * shows beside the box when it is not the viewer's own. While the zone is pending, the box is\n * disabled: a pending zone is never guessed.\n */\nexport function DateTimeInput(props: FieldInputProps): React.ReactElement {\n const locale = useOptionalLocale();\n const zone = useFieldTimeZone(\n props.field?.zone,\n props.values === undefined ? props.record : { ...props.record, ...props.values },\n );\n const viewer = useTimeZone();\n const pending = zone.status === 'pending';\n const fieldZone = zone.status === 'ready' ? zone.zone : undefined;\n const named =\n fieldZone !== undefined && viewer.status === 'ready' && fieldZone !== viewer.zone\n ? zoneShortName(\n canonicalInstant(String(props.value ?? '')) ?? epochMsToInstant(Date.now()),\n fieldZone,\n localeTag(locale),\n )\n : undefined;\n return (\n <TemporalInput\n {...props}\n type=\"datetime-local\"\n disabled={props.disabled || pending}\n toText={(value) => (fieldZone === undefined ? '' : toLocalDateTimeText(value, fieldZone))}\n fromText={(text) =>\n fieldZone === undefined ? null : (fromLocalDateTimeText(text, fieldZone) ?? null)\n }\n {...(named === undefined ? {} : { zoneName: named })}\n />\n );\n}\n\n/**\n * A wall time field (`f.time()`): a `time` box that writes `HH:mm`, or `HH:mm:ss` when the field\n * declares `seconds: true` (a box with a whole minute may report `HH:mm`; it is padded).\n */\nexport function TimeInput(props: FieldInputProps): React.ReactElement {\n const seconds = props.field?.ui?.seconds === true;\n return (\n <TemporalInput\n {...props}\n type=\"time\"\n step={seconds ? 1 : 60}\n toText={(value) => (value == null ? '' : String(value))}\n fromText={(text) => {\n if (text === '') return null;\n if (seconds) return text.length === 5 ? `${text}:00` : text;\n return text.slice(0, 5);\n }}\n />\n );\n}\n\nfunction TemporalInput({\n type,\n step,\n toText,\n fromText,\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n zoneName,\n}: FieldInputProps & {\n readonly type: 'date' | 'datetime-local' | 'time';\n readonly step?: number;\n /** The zone's short name, shown beside the box. */\n readonly zoneName?: string;\n readonly toText: (value: unknown) => string;\n readonly fromText: (text: string) => string | null;\n}): React.ReactElement {\n const input = (\n <Input\n name={name}\n id={id}\n type={type}\n {...(step === undefined ? {} : { step })}\n value={toText(value)}\n onChange={(e) => onChange(fromText(e.target.value))}\n data-testid={testid}\n disabled={disabled}\n required={required}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n if (zoneName === undefined) return input;\n return (\n <div className=\"flex items-center gap-2\">\n {input}\n <span\n className=\"whitespace-nowrap text-xs text-muted-foreground\"\n data-testid={testid === undefined ? undefined : `${testid}:zone`}\n >\n {zoneName}\n </span>\n </div>\n );\n}\n","'use client';\nimport { enumNamespaceOf, resolveDoc } from '@burojs/core';\nimport { narrowEntriesOf } from '@burojs/core/internal';\nimport {\n resolveOptionLabel,\n useAvailableEnumValues,\n useBoundEnum,\n useFieldMetaSources,\n useOptionCaps,\n useOptionalT,\n} from '@burojs/react';\nimport type * as React from 'react';\nimport { EnumChoiceGroup, type EnumChoiceOption } from '../enum/enum-choice-group.js';\nimport { EnumSettlingRow } from '../enum/enum-settling.js';\nimport { resolveEnumControl } from '../enum/resolve-enum-control.js';\nimport { Icon } from '../primitives/icon.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\n/*\n * An option's label is `resolveOptionLabel` (`@burojs/react`), the one reader a custom field\n * implementation's `FieldRenderContext.options` is resolved by too, so both show the same text.\n */\n\nexport function EnumDisplay({\n value,\n options,\n field,\n resource,\n}: FieldRendererProps): React.ReactElement {\n const caps = useOptionCaps(resource);\n const enumDef = useBoundEnum(field);\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const opt = options?.find((o) => o.value === String(value));\n const label = resolveOptionLabel(caps, field, String(value), opt, enumDef);\n return (\n <span className=\"inline-flex items-center gap-1\">\n {opt?.icon ? (\n <Icon name={opt.icon} className=\"size-3.5 shrink-0 text-muted-foreground\" />\n ) : null}\n {label}\n </span>\n );\n}\n\n/**\n * The options-driven enum input: a field with inline options, or one bound to\n * an enum only through `meta.enumNamespace`. Renders the control the field\n * asks for (`ui.control`), else the bound enum's `control`, else a select; the\n * non-select controls are the shared `EnumChoiceGroup`. When the field is bound\n * to an enum namespace, each value's summary is read the way `EnumPicker` reads\n * it (`enum/<ns>/<value>`), so one enum looks the same however its field is\n * bound; a truly inline enum has no value docs and shows labels only.\n *\n * The field's `meta.narrow` (REF-132 §7.2) removes options here as it does on a\n * registered enum's picker; a current value that is not offered still shows,\n * first and inert (§8).\n */\nexport function EnumInput({\n name,\n id,\n value,\n onChange,\n testid,\n options,\n field,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n resource,\n record,\n values,\n metaSources,\n baseline,\n}: FieldInputProps): React.ReactElement {\n const t = useOptionalT();\n const caps = useOptionCaps(resource);\n const enumDef = useBoundEnum(field);\n const ns = enumNamespaceOf(field);\n const control = resolveEnumControl(field?.ui?.control, enumDef, `field ${field?.name ?? name}`);\n const sources = useFieldMetaSources({ record, values, extra: metaSources });\n const available = useAvailableEnumValues({\n values: options ?? [],\n use: {\n narrow: narrowEntriesOf(field?.meta?.narrow),\n sources,\n mode: record === undefined ? 'create' : 'edit',\n // The form's starting values (seeded on a create), as the plan and the save compare.\n baseline: baseline ?? record,\n },\n });\n // Not settled (§7.4): nothing is offered, the stored value shows as the current item beside a\n // status row, exactly as `EnumPicker` draws it.\n const settling = available.status === 'ready' ? undefined : available.status;\n const offered = settling === undefined ? available.values : [];\n const tid = testid ?? name;\n const resolved: EnumChoiceOption[] = offered.map((o) => {\n const summary =\n ns === undefined ? undefined : resolveDoc(caps, `enum/${ns}/${o.value}`)?.summary;\n return {\n value: o.value,\n label: resolveOptionLabel(caps, field, o.value, o, enumDef),\n ...(o.icon === undefined ? {} : { icon: o.icon }),\n ...(summary === undefined ? {} : { summary }),\n };\n });\n // The current value when it is not offered: its label as a display shows it, inert.\n const raw = value == null || value === '' ? undefined : String(value);\n const known = raw === undefined ? undefined : options?.find((o) => o.value === raw);\n const current: EnumChoiceOption | undefined =\n raw === undefined || resolved.some((o) => o.value === raw)\n ? undefined\n : {\n value: raw,\n label: resolveOptionLabel(caps, field, raw, known, enumDef),\n ...(known?.icon === undefined ? {} : { icon: known.icon }),\n };\n\n if (control !== 'select') {\n return (\n <EnumChoiceGroup\n control={control}\n options={resolved}\n {...(current === undefined ? {} : { current })}\n {...(settling === undefined ? {} : { settling })}\n value={value as string | null | undefined}\n onChange={onChange}\n testid={tid}\n name={name}\n id={id}\n required={required}\n disabled={disabled}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n ariaLabelledBy={ariaLabelledBy}\n />\n );\n }\n\n return (\n <Select\n value={(value as string | undefined) ?? ''}\n onValueChange={onChange}\n disabled={disabled}\n required={required}\n >\n <SelectTrigger\n data-testid={testid}\n name={name}\n id={id}\n aria-required={required}\n aria-busy={settling === 'pending' || undefined}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n >\n <SelectValue placeholder={placeholder ?? t('field.select', { defaultValue: 'Select…' })} />\n </SelectTrigger>\n <SelectContent>\n {current === undefined ? null : (\n <SelectItem value={current.value} disabled data-current=\"\" data-testid={`${tid}:current`}>\n {current.label}\n </SelectItem>\n )}\n {settling === undefined ? null : <EnumSettlingRow status={settling} testid={tid} />}\n {resolved.map((o) => (\n <SelectItem\n key={o.value}\n value={o.value}\n data-testid={testid === undefined ? undefined : `${testid}:option:${o.value}`}\n // Outside `ItemText`, which Radix clones into the closed trigger.\n description={\n o.summary === undefined ? undefined : (\n <span\n data-testid={testid === undefined ? undefined : `${testid}:option:${o.value}:doc`}\n >\n {o.summary}\n </span>\n )\n }\n >\n <span className=\"inline-flex items-center gap-1.5\">\n {o.icon ? (\n <Icon name={o.icon} className=\"size-3.5 shrink-0 text-muted-foreground\" />\n ) : null}\n {o.label}\n </span>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n}\n","'use client';\nimport { type FileMapper, type FileRef, isImage } from '@burojs/file-storage';\nimport { useFileUrls, useOptionalFileStorage } from '@burojs/react';\nimport * as React from 'react';\nimport type { FieldRendererProps } from './registry.js';\n\nexport interface FileFieldProps extends FieldRendererProps {\n resource?: string;\n record?: Record<string, unknown>;\n variant?: { width?: number; height?: number };\n /** Cap for a narrow list cell. Extra files collapse into a `+N` badge. */\n max?: number;\n}\n\n// `isImage` itself lives in `@burojs/file-storage`, next to the `FileRef`\n// type it is a pure predicate over — not here, so an input renderer doesn't\n// have to depend on the display renderer (or vice versa) for it. Re-exported\n// below so `@burojs/ui-shadcn`'s public surface is unchanged.\nexport { isImage };\n\nexport function FileField(props: FileFieldProps): React.ReactElement {\n const ui = (props.field?.ui ?? {}) as {\n mapper?: unknown;\n fileStorage?: string;\n multiple?: boolean;\n };\n const name = props.field?.name ?? 'file';\n const testid = `file-field:${name}`;\n\n // Resolved WITHOUT throwing. A list renders one of these per row, all inside\n // the DataGrid's single render pass and with no error boundary between them,\n // so a throw here does not blank one cell — it takes down the whole table.\n // A misspelled `ui.fileStorage` is a config mistake in one field; it must\n // cost that field, not the page. The name is shown so the mistake is\n // findable without opening the console.\n const { adapter, error: storageError } = useOptionalFileStorage(ui.fileStorage);\n const multiple = props.multiple === true || ui.multiple === true;\n const { refs, error: mapperError } = React.useMemo(\n () =>\n toDomainRefs(props.value, (ui.mapper as FileMapper | undefined) ?? adapter?.defaultMapper, {\n resource: props.resource ?? '',\n field: name,\n multiple,\n record: props.record,\n }),\n [props.value, ui.mapper, adapter, props.resource, name, multiple, props.record],\n );\n\n const shown = props.max != null ? refs.slice(0, props.max) : refs;\n const hidden = refs.length - shown.length;\n\n const { urls, refresh } = useFileUrls(shown, {\n storage: ui.fileStorage,\n resource: props.resource,\n record: props.record,\n variant: props.variant ?? { width: 40, height: 40 },\n });\n\n // One retry PER REF, actually bounded. `refresh()` deliberately bypasses\n // useFileUrls' resolve cooldown (an explicit user/render-triggered retry\n // must never be blocked by it) — which is exactly why an unconditional\n // `onError -> refresh()` never stopped: a deleted object resolves a NEW\n // signed url just fine (the sign endpoint doesn't know the object is gone),\n // the <img> loads that new src, 404s again, and refresh() fires again,\n // forever, hammering the signing endpoint. `retried` remembers which refs\n // already spent their one retry so a second failure renders the fallback\n // badge instead of looping.\n const retried = React.useRef(new Set<string>());\n const [exhausted, setExhausted] = React.useState<Set<string>>(() => new Set());\n const handleError = React.useCallback(\n (localId: string) => {\n if (retried.current.has(localId)) {\n setExhausted((prev) => (prev.has(localId) ? prev : new Set(prev).add(localId)));\n return;\n }\n retried.current.add(localId);\n refresh(localId);\n },\n [refresh],\n );\n\n if (storageError) {\n return (\n <span\n className=\"inline-flex items-center rounded border border-destructive/40 px-2 py-0.5 text-xs text-destructive\"\n title={storageError}\n data-testid={`${testid}:storage-error`}\n >\n {storageError}\n </span>\n );\n }\n\n if (mapperError) {\n return (\n <span\n className=\"inline-flex items-center rounded border border-destructive/40 px-2 py-0.5 text-xs text-destructive\"\n title={mapperError}\n data-testid={`${testid}:mapper-error`}\n >\n {mapperError}\n </span>\n );\n }\n\n // A missing file is the ORDINARY case in real data — a nullable column, a\n // record saved before the field existed, a row whose upload failed — not an\n // error state, so it renders the same neutral dash every other empty cell\n // does. The test id is what lets \"nothing is shown here\" be asserted\n // positively; matching on the dash character alone would silently start\n // passing for any other empty rendering.\n if (refs.length === 0) {\n return (\n <span className=\"text-muted-foreground\" data-testid={`${testid}:empty`}>\n —\n </span>\n );\n }\n\n return (\n <div className=\"flex items-center gap-1\">\n {shown.map((ref, i) => {\n const url = urls[ref.localId];\n const label = ref.name ?? ref.handle ?? '';\n return (\n <span key={ref.localId} data-testid={`${testid}:item:${i}`} title={label}>\n {url && isImage(ref) && !exhausted.has(ref.localId) ? (\n <img\n src={url}\n alt={label}\n className=\"h-10 w-10 rounded border object-cover\"\n // One retry — an expired signature is the usual cause. After\n // that a placeholder, never an exception through a list, and\n // never another request: see `handleError` above.\n onError={() => handleError(ref.localId)}\n />\n ) : (\n <span className=\"inline-flex h-10 items-center rounded border px-2 font-mono text-xs\">\n {label.split('/').pop() || 'file'}\n </span>\n )}\n </span>\n );\n })}\n {hidden > 0 && (\n <span className=\"text-xs text-muted-foreground\" data-testid={`${testid}:overflow`}>\n +{hidden}\n </span>\n )}\n </div>\n );\n}\n\n/** The registry's `Display` for kind `file`. */\nexport const FileDisplay = FileField;\n\n/**\n * Column value → the framework's in-memory `FileRef[]`.\n *\n * TWO shapes reach this, and the order matters.\n *\n * 1. Already-normalised `FileRef[]`. That is what a form hands back while\n * it is being edited, and it must be taken VERBATIM — re-running a\n * mapper over a ref that already carries upload state would reinterpret\n * the framework's own domain value as if it were a backend column.\n * 2. The RAW COLUMN, straight off the record: a filename, a key, a URL, an\n * array of them, or `null`. That is what a list cell and a show page get,\n * because a data provider returns rows, not refs.\n *\n * Case 2 used to return `[]` — which meant a file field rendered from a\n * record showed the empty dash forever, however many files the column\n * actually named, on every backend. `FileMapper.read` is the port's own\n * answer to that translation and nothing in the repository ever called it;\n * this is that call, not a new abstraction beside it. The mapper is the\n * field's declared one (`f.file({ mapper })`) or the storage's\n * `defaultMapper`, exactly the pair `assertFileStorageWiring` already treats\n * as authoritative for the write direction.\n *\n * `read` is documented as PURE, and every mapper shipped by the port is\n * total over a well-formed column — but \"well-formed\" is the adopter's\n * claim, not a checked one (`scalarHandle` over a numeric column throws), so\n * a throw is reported in the cell rather than allowed out. A list renders one\n * of these per row inside the DataGrid's single render pass with no error\n * boundary between them: an uncaught throw here does not blank one cell, it\n * takes down the whole table. Reported and not swallowed, for the same reason\n * an unknown storage name is.\n */\nfunction toDomainRefs(\n value: unknown,\n mapper: FileMapper | undefined,\n ctx: { resource: string; field: string; multiple: boolean; record?: Record<string, unknown> },\n): { refs: FileRef[]; error?: string } {\n if (isFileRefs(value)) return { refs: value };\n if (value == null || mapper === undefined) return { refs: [] };\n try {\n return { refs: mapper.read(value, ctx) };\n } catch (e) {\n return {\n refs: [],\n error: `Cannot read file column '${ctx.field}': ${(e as Error).message}`,\n };\n }\n}\n\nfunction isFileRefs(value: unknown): value is FileRef[] {\n return (\n Array.isArray(value) &&\n value.every(\n (entry) =>\n entry !== null &&\n typeof entry === 'object' &&\n typeof (entry as { localId?: unknown }).localId === 'string',\n )\n );\n}\n","'use client';\nimport { isImage } from '@burojs/file-storage';\nimport { type FileItem, formatBytes, useFileField, useFileUrls, useOptionalT } from '@burojs/react';\nimport { IconLoader2, IconRotate, IconUpload, IconX } from '@tabler/icons-react';\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport type { FieldInputProps } from './registry.js';\n\nexport { FileDisplay, FileField, isImage, type FileFieldProps } from './file-display.js';\n\n/**\n * `<FileInput>` — presentational. Every decision that used to live here (which\n * backend, which token, what a value looks like) now lives in the storage port,\n * and this component only renders the state machine `useFileField` produces.\n */\nexport interface FileInputProps extends FieldInputProps {\n resource?: string;\n record?: Record<string, unknown>;\n}\n\nexport function FileInput(props: FileInputProps): React.ReactElement {\n const t = useOptionalT();\n const ui = (props.field?.ui ?? {}) as {\n accept?: string[];\n multiple?: boolean;\n maxSize?: number;\n fileStorage?: string;\n mapper?: unknown;\n defer?: boolean;\n orphans?: 'best-effort' | 'keep';\n };\n\n // The logical field name remains distinct from the DOM input name.\n // `<RecordScreen>` prefixes DOM names so create and edit controls cannot\n // collide, while storage context must still identify the declared field.\n const fieldName = props.field?.name ?? props.name;\n\n const field = useFileField({\n resource: props.resource ?? 'unknown',\n field: fieldName,\n multiple: props.multiple === true || ui.multiple === true,\n value: props.value,\n onChange: props.onChange,\n record: props.record,\n storage: ui.fileStorage,\n defer: ui.defer,\n orphans: ui.orphans,\n accept: ui.accept,\n maxSize: ui.maxSize,\n });\n\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const [isDragging, setIsDragging] = React.useState(false);\n const testid = props.testid ?? `file-input:${props.name}`;\n const disabled = props.disabled === true;\n const rejected = field.items.find((i) => i.status === 'rejected' && i.error);\n\n function pick(list: FileList | null) {\n if (!list || list.length === 0) return;\n // ⚠️ Clear any previous rejection FIRST. A rejected item is hidden from the\n // list below (there is no row, so no remove button), but it stays in\n // `items` — so without this the message from a file the user has already\n // dealt with hangs around forever with no way to dismiss it, describing a\n // file that is no longer on screen.\n dismissRejected();\n field.add([...list]);\n }\n\n /** Drop every rejected item, so a stale validation message cannot outlive it. */\n function dismissRejected() {\n for (const item of field.items) {\n if (item.status === 'rejected') field.remove(item.ref.localId);\n }\n }\n\n return (\n <div className=\"space-y-2\" data-testid={`${testid}:root`}>\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n onClick={() => !disabled && inputRef.current?.click()}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (!disabled) inputRef.current?.click();\n }\n }}\n onDragEnter={(e) => {\n e.preventDefault();\n if (!disabled) setIsDragging(true);\n }}\n onDragOver={(e) => e.preventDefault()}\n onDragLeave={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setIsDragging(false);\n }}\n onDrop={(e) => {\n e.preventDefault();\n setIsDragging(false);\n if (!disabled) pick(e.dataTransfer.files);\n }}\n data-testid={`${testid}:dropzone`}\n data-dragging={isDragging || undefined}\n data-uploading={field.busy || undefined}\n aria-disabled={disabled || undefined}\n aria-label={t('field.pickFile', { defaultValue: 'Pick or drop a file' })}\n aria-invalid={props.ariaInvalid || undefined}\n aria-describedby={props.ariaDescribedBy || undefined}\n {...(props.ariaErrorMessage ? { 'aria-errormessage': props.ariaErrorMessage } : {})}\n className={cn(\n 'flex min-h-[6rem] cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-muted-foreground/30 bg-muted/20 px-4 py-3 text-center text-sm transition-colors',\n isDragging && 'border-primary bg-primary/5',\n disabled && 'cursor-not-allowed opacity-60',\n )}\n >\n <IconUpload className=\"h-5 w-5 text-muted-foreground\" aria-hidden />\n <p className=\"text-sm\">\n {t('field.dropHint', { defaultValue: 'Click to pick a file or drag-and-drop' })}\n </p>\n {(ui.accept?.length || ui.maxSize != null) && (\n <p className=\"text-xs text-muted-foreground\">\n {ui.accept?.length ? `Accepts ${ui.accept.join(', ')}` : ''}\n {ui.accept?.length && ui.maxSize != null ? ' · ' : ''}\n {ui.maxSize != null ? `Max ${formatBytes(ui.maxSize)}` : ''}\n </p>\n )}\n </div>\n\n <input\n ref={inputRef}\n type=\"file\"\n name={props.name}\n id={props.id}\n accept={ui.accept?.length ? ui.accept.join(',') : undefined}\n multiple={props.multiple === true || ui.multiple === true}\n disabled={disabled || field.busy}\n required={props.required}\n onChange={(e) => {\n pick(e.target.files);\n // Reset so re-picking the same file still fires a change.\n e.target.value = '';\n }}\n data-testid={`${testid}:native`}\n aria-invalid={props.ariaInvalid || undefined}\n aria-describedby={props.ariaDescribedBy || undefined}\n {...(props.ariaErrorMessage ? { 'aria-errormessage': props.ariaErrorMessage } : {})}\n className=\"sr-only\"\n />\n\n <ul className=\"space-y-1\">\n {field.items\n .filter((i) => i.status !== 'rejected')\n .map((item) => (\n <FileRow\n key={item.ref.localId}\n item={item}\n testid={testid}\n storage={ui.fileStorage}\n resource={props.resource}\n record={props.record}\n onRemove={() => field.remove(item.ref.localId)}\n onRetry={() => field.retry(item.ref.localId)}\n />\n ))}\n </ul>\n\n {/* Always mounted: some screen readers skip a live region inserted late.\n Mounted is what matters — the reserved height did not, and cost a\n blank line under every file field that never errors. No\n `empty:hidden`/`hidden` here either: `display: none` pulls the\n element OUT of the accessibility tree, so an empty-to-populated\n transition would look exactly like a late-inserted live region to\n a screen reader — the one thing unconditional mounting exists to\n avoid. An empty `<p>` with `flex items-center` already collapses\n to zero height on its own; nothing is gained by hiding it. */}\n <p\n className=\"flex items-center gap-2 text-sm text-destructive\"\n aria-live=\"polite\"\n data-testid={`${testid}:local-error`}\n >\n {rejected?.error ?? ''}\n {rejected ? (\n // A rejected file has no row of its own, so this is the ONLY way to\n // dismiss its message. Without it the error is unclearable.\n <button\n type=\"button\"\n onClick={dismissRejected}\n className=\"underline underline-offset-2\"\n data-testid={`${testid}:dismiss-error`}\n >\n {t('field.dismiss', { defaultValue: 'Dismiss' })}\n </button>\n ) : null}\n </p>\n </div>\n );\n}\n\nfunction FileRow({\n item,\n testid,\n storage,\n resource,\n record,\n onRemove,\n onRetry,\n}: {\n item: FileItem;\n testid: string;\n storage?: string;\n resource?: string;\n record?: Record<string, unknown>;\n onRemove: () => void;\n onRetry: () => void;\n}): React.ReactElement {\n const single = React.useMemo(() => [item.ref], [item.ref]);\n const t = useOptionalT();\n const { urls, refresh } = useFileUrls(single, {\n storage,\n resource,\n record,\n variant: { width: 48, height: 48 },\n enabled: item.status === 'uploaded',\n });\n\n // A pending file has no server URL yet; preview it locally and revoke on\n // unmount, or the object URL leaks for the life of the page.\n const [localUrl, setLocalUrl] = React.useState<string | undefined>();\n React.useEffect(() => {\n const file = item.ref.pending;\n if (!file || !file.type.startsWith('image/')) return;\n const url = URL.createObjectURL(file);\n setLocalUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [item.ref.pending]);\n\n const src = urls[item.ref.localId] ?? localUrl;\n const id = `${testid}:item:${item.ref.localId}`;\n\n // One retry, ACTUALLY bounded, then a placeholder. `refresh()` deliberately\n // bypasses useFileUrls' resolve cooldown — an explicit retry must never be\n // blocked by it — which is exactly why an unconditional `onError ->\n // refresh()` never stopped: a deleted object still signs a fresh (also\n // dead) url every time, the <img> loads it, 404s again, and refresh() fires\n // again — forever, hammering the signing endpoint. `retriedRef` remembers\n // this ref already spent its one retry so a second failure shows the\n // filetype icon instead of looping.\n const retriedRef = React.useRef(false);\n const [exhausted, setExhausted] = React.useState(false);\n const handleThumbError = React.useCallback(() => {\n if (retriedRef.current) {\n setExhausted(true);\n return;\n }\n retriedRef.current = true;\n refresh(item.ref.localId);\n }, [refresh, item.ref.localId]);\n\n return (\n <li className=\"flex items-center gap-3 rounded border px-2 py-1.5\" data-testid={id}>\n {src && isImage(item.ref) && !exhausted ? (\n <img\n src={src}\n alt={item.ref.name ?? ''}\n className=\"h-10 w-10 shrink-0 rounded border object-cover\"\n data-testid={`${id}:thumb`}\n // One retry: the overwhelmingly common cause is an expired\n // signature. After that a placeholder, never another request: see\n // `handleThumbError` above.\n onError={handleThumbError}\n />\n ) : (\n <div\n className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded border bg-background text-[10px] font-semibold uppercase text-muted-foreground\"\n data-testid={`${id}:filetype-icon`}\n >\n {extOf(item.ref.name ?? '') || 'FILE'}\n </div>\n )}\n\n <div className=\"min-w-0 flex-1 text-left\">\n <p className=\"truncate text-sm\">{item.ref.name ?? item.ref.handle}</p>\n <p className=\"truncate text-xs text-muted-foreground\">\n {item.ref.size != null ? formatBytes(item.ref.size) : ''}\n {item.status === 'deferred'\n ? ` · ${t('field.waitingForSave', { defaultValue: 'waiting for save' })}`\n : ''}\n {item.status === 'failed' ? ` · ${item.error ?? 'failed'}` : ''}\n </p>\n {item.status === 'uploading' && (\n <progress\n className=\"h-1 w-full\"\n max={1}\n value={item.progress ?? 0}\n data-testid={`${id}:progress`}\n />\n )}\n </div>\n\n <div className=\"flex items-center gap-1\">\n {item.status === 'uploading' && (\n <IconLoader2 className=\"h-4 w-4 animate-spin text-muted-foreground\" aria-hidden />\n )}\n {item.status === 'failed' && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onRetry}\n data-testid={`${id}:retry`}\n >\n <IconRotate className=\"h-4 w-4\" aria-hidden />\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onRemove}\n data-testid={`${id}:remove`}\n >\n <IconX className=\"h-4 w-4\" aria-hidden />\n </Button>\n </div>\n </li>\n );\n}\n\nfunction extOf(name: string): string {\n const dot = name.lastIndexOf('.');\n return dot < 0 ? '' : name.slice(dot + 1).toLowerCase();\n}\n","'use client';\n\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n 'flex min-h-[80px] w-full rounded-md border border-input bg-background text-foreground px-3 py-2 text-base md:text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-input-disabled',\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n","'use client';\nimport * as React from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport { Textarea } from '../primitives/textarea.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\n/**\n * Read view for a jsonb field: pretty-printed, monospace, indentation kept.\n * Routes through `toDisplayText` so an object never reaches the screen as\n * «[object Object]».\n */\nexport function JsonDisplay({\n value,\n presentation,\n testid,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const { text } = toDisplayText(value);\n // The <pre> stays in both modes: monospace and preserved line breaks are\n // information, not decoration. What `plain` drops is the chrome around it —\n // the fill, border and padding, all of which fight whatever container is\n // hosting the value.\n const className =\n presentation === 'plain'\n ? 'overflow-x-auto whitespace-pre font-mono text-xs leading-relaxed'\n : 'overflow-x-auto whitespace-pre rounded-md border bg-muted/40 p-3 font-mono text-xs leading-relaxed';\n return (\n <pre data-testid={testid} className={className}>\n {text}\n </pre>\n );\n}\n\n/**\n * Edit view for a jsonb field.\n *\n * The old path routed json through the plain textarea input, which set\n * `value={object}` — React stringifies that to «[object Object]», so a work\n * order's processing options (and every other jsonb field) were uneditable and\n * showed the literal placeholder. This keeps a local TEXT buffer seeded from the\n * value as pretty JSON, and:\n * - emits the PARSED object upward while the text is valid JSON, so the payload\n * stays a real object;\n * - keeps the last valid value and shows an inline \"invalid JSON\" hint while the\n * user is mid-edit, rather than blocking typing or emitting a broken string.\n */\nexport function JsonInput({\n name,\n id,\n value,\n onChange,\n testid,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n}: FieldInputProps): React.ReactElement {\n const t = useOptionalT();\n const seed = React.useMemo(() => {\n if (value == null || value === '') return '';\n return toDisplayText(value).text;\n }, [value]);\n\n const [text, setText] = React.useState(seed);\n const [invalid, setInvalid] = React.useState(false);\n // Re-seed when the upstream value changes identity (e.g. draft restore) but\n // not on every keystroke — the local buffer owns the text while editing.\n const lastSeed = React.useRef(seed);\n if (seed !== lastSeed.current) {\n lastSeed.current = seed;\n // Only adopt the new seed when the user isn't mid-edit on a divergent value.\n if (!invalid) setText(seed);\n }\n\n return (\n <div className=\"space-y-1\">\n <Textarea\n name={name}\n id={id}\n value={text}\n onChange={(e) => {\n const next = e.target.value;\n setText(next);\n const trimmed = next.trim();\n if (trimmed === '') {\n setInvalid(false);\n onChange(null);\n return;\n }\n try {\n onChange(JSON.parse(trimmed));\n setInvalid(false);\n } catch {\n // Keep the buffer, don't emit a broken value.\n setInvalid(true);\n }\n }}\n data-testid={testid}\n disabled={disabled}\n aria-required={required}\n aria-invalid={ariaInvalid || invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className=\"min-h-40 font-mono text-xs\"\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n {invalid && (\n <p\n className=\"text-[13px] leading-snug text-destructive\"\n data-testid={`${testid}-json-error`}\n >\n {t('field.jsonInvalid', {\n defaultValue: 'Invalid JSON. Changes will not be saved until it is valid.',\n })}\n </p>\n )}\n </div>\n );\n}\n","import { type ReactElement, Suspense, lazy } from 'react';\nimport type { FieldInputProps } from './registry.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nconst RelationManyPickerInput = lazy(() =>\n import('./relation-many-picker.js').then((module) => ({\n default: module.RelationManyPickerInput,\n })),\n);\n\n/**\n * The to-many select, kept off the first paint: a screen draws a skeleton until its chunk\n * arrives (the chunk holds no data, so no access is decided here).\n */\nexport function LazyRelationManyInput(props: FieldInputProps): ReactElement {\n return (\n <Suspense\n fallback={\n <Skeleton\n data-buro-skeleton=\"\"\n data-testid=\"relation-many-loading\"\n className=\"h-9 w-full\"\n />\n }\n >\n <RelationManyPickerInput {...props} />\n </Suspense>\n );\n}\n","import { lazy, Suspense, type ReactElement } from 'react';\nimport { useOptionalT } from '@burojs/react';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\n\nconst RichTextDisplay = lazy(() =>\n import('./rich-text.js').then((module) => ({ default: module.RichTextDisplay })),\n);\nconst RichTextInput = lazy(() =>\n import('./rich-text.js').then((module) => ({ default: module.RichTextInput })),\n);\n\nfunction RichTextDisplayLoading(): ReactElement {\n const t = useOptionalT();\n return (\n <div\n data-testid=\"rich-text-display-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n aria-label={t('richText.loadingDisplay', { defaultValue: 'Loading rich text display' })}\n className=\"min-h-5 w-full animate-pulse rounded-sm bg-muted\"\n />\n );\n}\n\nfunction RichTextInputLoading({ field }: Pick<FieldInputProps, 'field'>): ReactElement {\n const t = useOptionalT();\n const showToolbar = field?.ui?.formatting !== false;\n\n return (\n <div\n data-testid=\"rich-text-input-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n aria-label={t('richText.loadingEditor', { defaultValue: 'Loading rich text editor' })}\n className=\"w-full overflow-hidden rounded-md border bg-background\"\n >\n {showToolbar ? (\n <div\n data-testid=\"rich-text-input-loading-toolbar\"\n aria-hidden=\"true\"\n className=\"h-9 border-b bg-muted/30\"\n />\n ) : null}\n <div\n data-testid=\"rich-text-input-loading-editor\"\n aria-hidden=\"true\"\n className=\"min-h-[6rem] animate-pulse bg-muted\"\n />\n </div>\n );\n}\n\nexport function LazyRichTextDisplay(props: FieldRendererProps): ReactElement {\n return (\n <Suspense fallback={<RichTextDisplayLoading />}>\n <RichTextDisplay {...props} />\n </Suspense>\n );\n}\n\nexport function LazyRichTextInput(props: FieldInputProps): ReactElement {\n return (\n <Suspense fallback={<RichTextInputLoading field={props.field} />}>\n <RichTextInput {...props} />\n </Suspense>\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { useOptionalLocale } from '@burojs/react';\nimport { Input } from '../primitives/input.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { formatNumber } from './format.js';\n\n/**\n * Strip wrapping double quotes from a value.\n * Defends against APIs that serialize bigint as a quoted string (e.g. Hasura\n * returning `count` as `\"\\\"299978\\\"\"`).\n */\nfunction unquote(s: string): string {\n if (s.length >= 2 && s.startsWith('\"') && s.endsWith('\"')) {\n return s.slice(1, -1);\n }\n return s;\n}\n\n/**\n * Is this field an IDENTIFIER rather than a quantity?\n *\n * An id is a name that happens to be spelled with digits — grouping it turns\n * record 2910 into «2 910» (or \"2,910\" in English), which reads as a count, does\n * not match what the user sees elsewhere (the dashboard prints `#2910`), and\n * cannot be copy-pasted or searched for as typed.\n *\n * Convention over configuration: `id` and any `*_id` foreign key. Making every\n * adopter tag ~20 resources by hand to avoid a wrong default would be the wrong\n * trade; a field explicitly marked `meta.identifier` wins either way.\n */\nfunction isIdentifier(field?: { name?: string; meta?: Record<string, unknown> }): boolean {\n if (field?.meta?.identifier === true) return true;\n if (field?.meta?.identifier === false) return false;\n const n = field?.name;\n return n === 'id' || (typeof n === 'string' && n.endsWith('_id'));\n}\n\nexport function NumberDisplay({ value, field, text }: FieldRendererProps): React.ReactElement {\n // Subscribe to the live locale so a language switch re-renders this cell in\n // place, even inside a memoized table row/cell (see `DateDisplay`'s comment\n // in `./date.tsx` for the full rationale — same fix, same reasoning), and\n // hand the live code to `formatNumber` so the number groups per ITS rules.\n const locale = useOptionalLocale();\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces the locale grouping.\n if (text !== undefined) return <span>{text}</span>;\n let raw = value;\n if (typeof raw === 'string') raw = unquote(raw);\n const n = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(n)) return <span>{String(value)}</span>;\n return <span>{isIdentifier(field) ? String(n) : formatNumber(n, locale)}</span>;\n}\n\nexport function NumberInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n min,\n max,\n}: FieldInputProps): React.ReactElement {\n return (\n <Input\n name={name}\n id={id}\n type=\"number\"\n value={value == null ? '' : String(value)}\n onChange={(e) => {\n const v = e.target.value;\n if (v === '') {\n onChange(null);\n return;\n }\n const n = Number(v);\n onChange(Number.isNaN(n) ? v : n);\n }}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n min={min}\n max={max}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type { ScalarDisplayProps, ScalarInputProps } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { cn } from '../lib/cn.js';\n\nconst GROUP = 'rounded-md border border-input p-3';\n\n/**\n * The input chrome of an object field (T2 5.5): a bordered group around its properties. The\n * shell lays the properties out in the declared layout and hands them over as `children`; the\n * field's own label is the leaf's, so the group is named by it.\n */\nexport function ObjectGroupInput(props: ScalarInputProps<unknown>): ReactElement {\n const { testIds, accessibility, children } = props;\n return (\n <div\n role=\"group\"\n data-buro-object-group=\"input\"\n className={cn(GROUP, 'space-y-3')}\n data-testid={testIds.input}\n id={accessibility.input}\n aria-labelledby={accessibility.label}\n aria-describedby={accessibility.description}\n aria-invalid={\n props.issues.some((issue) => issue.severity === 'error' && issue.path.length === 0) ||\n undefined\n }\n aria-errormessage={accessibility.error}\n >\n {children}\n </div>\n );\n}\n\n/** The display chrome of an object field: the same group around its properties' displays. */\nexport function ObjectGroupDisplay(props: ScalarDisplayProps<unknown>): ReactElement {\n const { testIds, children } = props;\n return (\n <div\n role=\"group\"\n data-buro-object-group=\"display\"\n className={cn(GROUP, 'space-y-2')}\n data-testid={testIds.display}\n >\n {children}\n </div>\n );\n}\n","'use client';\nimport type { CollectionDisplayProps, CollectionInputProps } from '@burojs/react';\nimport { useChromeT } from '@burojs/react';\nimport { IconArrowDown, IconArrowUp, IconPlus, IconTrash } from '@tabler/icons-react';\nimport type { ReactElement } from 'react';\nimport { Button } from '../primitives/button.js';\n\n/** The repeater's texts: one translatable text each, the English default beside the key. */\nfunction useRepeaterTexts() {\n const t = useChromeT();\n return {\n add: t('field.repeater.add', { defaultValue: 'Add' }),\n empty: t('field.repeater.empty', { defaultValue: 'No items yet' }),\n remove: (position: number) =>\n t('field.repeater.remove', {\n params: { position },\n defaultValue: 'Remove item {{position}}',\n }),\n moveUp: (position: number) =>\n t('field.repeater.moveUp', {\n params: { position },\n defaultValue: 'Move item {{position}} up',\n }),\n moveDown: (position: number) =>\n t('field.repeater.moveDown', {\n params: { position },\n defaultValue: 'Move item {{position}} down',\n }),\n };\n}\n\n/**\n * The input chrome of an array field (T2 5.5): its elements, each with move-up, move-down and\n * remove, and an add button. The shell supplies the elements (`renderElement`), their stable keys\n * and the one set of actions; the repeater only draws them. Test ids are\n * `<input id>:item:<n>`, `:add`, `:empty` and, per element, `:remove:<n>`, `:up:<n>`, `:down:<n>`.\n */\nexport function RepeaterInput(props: CollectionInputProps<unknown>): ReactElement {\n const texts = useRepeaterTexts();\n const { value, renderElement, elementKeys, onAdd, onRemove, onMove, testIds, accessibility } =\n props;\n const root = testIds.input;\n const at = (suffix: string) => (root === undefined ? undefined : `${root}:${suffix}`);\n const editable = props.disabled !== true && props.readOnly !== true;\n const canAdd = editable && onAdd !== undefined && props.canAdd !== false;\n const canRemove = editable && onRemove !== undefined && props.canRemove !== false;\n const last = value.length - 1;\n return (\n <div\n role=\"group\"\n className=\"space-y-2\"\n data-testid={root}\n id={accessibility.input}\n aria-labelledby={accessibility.label}\n aria-describedby={accessibility.description}\n aria-errormessage={accessibility.error}\n >\n {value.length === 0 ? (\n <p className=\"text-sm text-muted-foreground\" data-testid={at('empty')}>\n {texts.empty}\n </p>\n ) : (\n <ol className=\"space-y-2\">\n {value.map((_, index) => (\n <li\n key={elementKeys?.[index] ?? index}\n className=\"flex items-start gap-2 rounded-md border border-input p-3\"\n data-testid={at(`item:${index}`)}\n >\n <div className=\"min-w-0 flex-1\">{renderElement?.(index)}</div>\n {onMove === undefined && onRemove === undefined ? null : (\n <div className=\"flex shrink-0 gap-1\">\n {onMove === undefined ? null : (\n <>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.moveUp(index + 1)}\n disabled={!editable || index === 0}\n data-testid={at(`up:${index}`)}\n onClick={() => onMove(index, index - 1)}\n >\n <IconArrowUp aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.moveDown(index + 1)}\n disabled={!editable || index === last}\n data-testid={at(`down:${index}`)}\n onClick={() => onMove(index, index + 1)}\n >\n <IconArrowDown aria-hidden=\"true\" />\n </Button>\n </>\n )}\n {onRemove === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={texts.remove(index + 1)}\n disabled={!canRemove}\n data-testid={at(`remove:${index}`)}\n onClick={() => onRemove(index)}\n >\n <IconTrash aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n )}\n </li>\n ))}\n </ol>\n )}\n {onAdd === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={!canAdd}\n data-testid={at('add')}\n onClick={onAdd}\n >\n <IconPlus aria-hidden=\"true\" />\n {texts.add}\n </Button>\n )}\n </div>\n );\n}\n\n/** The display chrome of an array field: a read-only list of its elements' displays. */\nexport function RepeaterDisplay(props: CollectionDisplayProps<unknown>): ReactElement {\n const texts = useRepeaterTexts();\n const { value, renderElement, testIds } = props;\n if (value.length === 0)\n return (\n <span className=\"text-muted-foreground\" data-testid={testIds.display}>\n {texts.empty}\n </span>\n );\n return (\n <ol className=\"space-y-2\" data-testid={testIds.display}>\n {value.map((_, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a read-only list has no identity to keep\n <li key={index} className=\"rounded-md border border-input p-3\">\n {renderElement?.(index)}\n </li>\n ))}\n </ol>\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport {\n type ResourceRefInput,\n declaredField,\n linkOf,\n normalizeEntityRef,\n resourceKey,\n} from '@burojs/core';\nimport {\n useApp,\n useEntryGate,\n useLinkKeys,\n useOptionalT,\n useRelatedRecord,\n useTestIds,\n} from '@burojs/react';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport type { FieldRendererProps } from './registry.js';\nimport { RelationDisplay } from './relation-display.js';\n\ntype Rec = Readonly<Record<string, unknown>>;\n\nconst isRecord = (value: unknown): value is Rec =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\n/** A display name (`through.resource`) as the registry keys it: a bare one means `default` (REF-95 §4.3). */\nfunction qualify(name: unknown): string | undefined {\n try {\n const ref = normalizeEntityRef(name as string);\n return ref.namespace === 'default' ? ref.id : `${ref.namespace}:${ref.id}`;\n } catch {\n return undefined;\n }\n}\n\nfunction idFieldOf(def: { readonly data?: unknown } | undefined): string {\n const declared = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n return typeof declared === 'string' && declared.length > 0 ? declared : 'id';\n}\n\nfunction byOf(field: unknown): string | undefined {\n const by = isRecord(field) && isRecord(field.meta) ? field.meta.by : undefined;\n return typeof by === 'string' && by.length > 0 ? by : undefined;\n}\n\nconst chipClassName =\n 'inline-flex items-center rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-xs';\n\n/**\n * A link field (`f.relationMany({ through })`): the target keys its junction rows hold, each a\n * chip titled as {@link RelationDisplay} titles one key. The owner key is the record's value of\n * the field the junction's `sourceKey` relation names (`by`), else of the owner's id field. Keys\n * whose title read finds no row (the target is filtered or out of the user's reach) are counted in\n * one \"not visible\" chip, never dropped silently; an owner whose rows reach the read cap shows\n * how many keys were read instead of chips, since the set is not known to be whole. A failed read\n * says so, distinct from an empty link.\n */\nexport function LinkKeysDisplay(props: FieldRendererProps): React.ReactElement {\n const { field, record } = props;\n // The registry key, namespace included; `resource` is the bare id on the adapter path.\n const owner = props.owner ?? props.resource ?? '';\n const name = field?.name ?? '';\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n\n const ownerDef = owner === '' ? undefined : app.registry.get(owner);\n // A base field or a type's own: a link a type declares draws like any other.\n const declaration = ownerDef === undefined ? undefined : declaredField(ownerDef, name);\n const link = isRecord(declaration) ? linkOf(declaration) : undefined;\n const junctionName = link === undefined ? undefined : qualify(link.junction);\n const junctionDef = junctionName === undefined ? undefined : app.registry.get(junctionName);\n const junctionField = (key: string) =>\n junctionDef === undefined ? undefined : declaredField(junctionDef, key);\n const ownerField =\n link === undefined\n ? idFieldOf(ownerDef)\n : (byOf(junctionField(link.sourceKey)) ?? idFieldOf(ownerDef));\n const targetBy = link === undefined ? undefined : byOf(junctionField(link.targetKey));\n const ownerKey = record?.[ownerField];\n\n const { keys, complete, isLoading, error } = useLinkKeys(owner, name, ownerKey);\n\n // Keys whose title read is a confirmed miss, reported by each chip.\n const [missed, setMissed] = useState<ReadonlySet<string>>(() => new Set());\n const onMiss = useCallback((key: string, isMiss: boolean) => {\n setMissed((current) => {\n if (current.has(key) === isMiss) return current;\n const next = new Set(current);\n if (isMiss) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n // The target as the declaration names it, else as the props carry it.\n const target =\n (isRecord(declaration) && isRecord(declaration.meta) ? declaration.meta.to : undefined) ??\n field?.meta?.to;\n const chipField = useMemo(\n () => ({\n name,\n meta: {\n ...(target === undefined ? {} : { to: target }),\n ...(targetBy === undefined ? {} : { by: targetBy }),\n },\n ...(field?.ui === undefined ? {} : { ui: field.ui }),\n }),\n [name, target, field?.ui, targetBy],\n );\n\n const chipsId = tid.linkChips(owner, name);\n if (error)\n return (\n <LoadError\n surface=\"relation\"\n error={error}\n {...(typeof target === 'string' ? { resource: target } : {})}\n testId={tid.linkError(owner, name)}\n className=\"text-destructive text-xs\"\n attributes={{ role: 'status' }}\n fallback={{ key: 'field.link.failed', default: 'Links could not be loaded' }}\n />\n );\n if (keys === undefined) {\n if (!isLoading)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n return (\n <span\n data-testid={`${chipsId}:loading`}\n className=\"inline-block h-5 w-20 animate-pulse rounded bg-muted\"\n aria-busy=\"true\"\n />\n );\n }\n if (!complete)\n return (\n <span data-testid={chipsId} className=\"inline-flex flex-wrap gap-1\">\n <span data-testid={tid.linkIncomplete(owner, name)} className=\"text-muted-foreground\">\n {t('field.link.incomplete', {\n count: keys.length,\n defaultValue: 'More than {{count}} links',\n })}\n </span>\n </span>\n );\n if (keys.length === 0)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n const hidden = keys.filter((key) => missed.has(String(key))).length;\n return (\n <span data-testid={chipsId} className=\"inline-flex flex-wrap gap-1\">\n {keys.map((key) => (\n <LinkChip key={String(key)} value={key} field={chipField} onMiss={onMiss} />\n ))}\n {hidden > 0 ? (\n <span\n data-testid={tid.linkHidden(owner, name)}\n className={`${chipClassName} text-muted-foreground`}\n >\n {t('field.link.hidden', { count: hidden, defaultValue: '{{count}} not visible' })}\n </span>\n ) : null}\n </span>\n );\n}\n\ninterface ChipProps {\n readonly value: string | number;\n readonly field: NonNullable<FieldRendererProps['field']>;\n readonly onMiss: (key: string, miss: boolean) => void;\n}\n\n/**\n * One key: what the entry gate allows is read (as {@link RelationDisplay} reads it, sharing that\n * read) so that a confirmed miss is reported and drawn by the parent's count, not here. A key the\n * gate keeps unread is drawn as {@link RelationDisplay} draws it.\n */\nfunction LinkChip({ value, field, onMiss }: ChipProps): React.ReactElement | null {\n const gate = useEntryGate();\n const meta = field.meta as { readonly to?: ResourceRefInput } | undefined;\n let to: string | undefined;\n try {\n to = meta?.to === undefined ? undefined : resourceKey(meta.to);\n } catch {\n to = undefined;\n }\n const answer = to === undefined ? undefined : gate(to, 'show');\n const reads =\n to !== undefined &&\n answer !== undefined &&\n answer.state !== 'undecided' &&\n answer.state !== 'hidden' &&\n answer.state !== 'disabled';\n if (!reads)\n return (\n <span className={chipClassName}>\n <RelationDisplay value={value} field={field} />\n </span>\n );\n return <ReadChip to={to as string} value={value} field={field} onMiss={onMiss} />;\n}\n\nfunction ReadChip({\n to,\n value,\n field,\n onMiss,\n}: ChipProps & { readonly to: string }): React.ReactElement | null {\n const app = useApp();\n const by = (field.meta as { readonly by?: unknown } | undefined)?.by;\n const { record, isLoading, error, ambiguous } = useRelatedRecord(\n to,\n value,\n typeof by === 'string' ? { by } : undefined,\n );\n const registered = app.registry.get(to) !== undefined;\n const miss = registered && !isLoading && !error && !ambiguous && !record;\n const key = String(value);\n useEffect(() => {\n onMiss(key, miss);\n }, [onMiss, key, miss]);\n useEffect(() => () => onMiss(key, false), [onMiss, key]);\n if (miss) return null;\n return (\n <span className={chipClassName}>\n <RelationDisplay value={value} field={field} />\n </span>\n );\n}\n\n/**\n * A to-many relation (`f.relationMany`): each key rendered as {@link RelationDisplay} renders\n * one — eager keys share the aggregator's batched read, lazy keys read nothing. A link (a field\n * `linkOf` reads a link from) is drawn by {@link LinkKeysDisplay}.\n */\nexport function RelationManyDisplay(props: FieldRendererProps): React.ReactElement {\n const app = useApp();\n // The field's declaration as the registry holds it (a base field or a type's own): the props\n // carry only its name and meta, too little to tell a link from a `meta.through` that is none.\n // A key array inside an object arrives under its dotted path name (`head.gtins`, REF-131 S4),\n // which names no declared field, so it is never taken for a link (core refuses `through`\n // inside an object): its keys are its own, drawn from its own `meta`.\n const owner = props.owner ?? props.resource ?? '';\n const ownerDef = owner === '' ? undefined : app.registry.get(owner);\n const declared =\n ownerDef === undefined || props.field?.name === undefined\n ? undefined\n : declaredField(ownerDef, props.field.name);\n // A link holds no keys of its own: its junction rows are read apart.\n if (isRecord(declared) && linkOf(declared) !== undefined) return <LinkKeysDisplay {...props} />;\n const { value, field } = props;\n const keys = Array.isArray(value) ? value : [];\n if (keys.length === 0)\n return (\n <span data-testid=\"relation-many-display:empty\" className=\"text-muted-foreground\">\n —\n </span>\n );\n return (\n <span className=\"inline-flex flex-wrap gap-x-2\" data-testid=\"relation-many-display\">\n {keys.map((key, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: a key may repeat; its position is its identity\n <RelationDisplay key={`${String(key)}:${index}`} value={key} field={field} />\n ))}\n </span>\n );\n}\n","import type { StandardSchemaV1 } from '@burojs/core';\n\ntype Meta = Readonly<Record<string, unknown>>;\ntype Issue = { readonly message: string; readonly path: readonly string[] };\n\nconst isRecord = (value: unknown): value is Meta =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\n/**\n * The `meta` a relation field's implementation reads (P7 3.3): the framework-owned keys, checked\n * at render so a misconfigured relation shows as such instead of failing deep inside the picker.\n * Other keys pass through untouched; `to` may be absent (the picker degrades with a warning, as\n * it always has) but, present, is a resource name or reference.\n */\nexport const relationMetaSchema: StandardSchemaV1<unknown, Meta> = Object.freeze({\n '~standard': Object.freeze({\n version: 1 as const,\n vendor: 'buro',\n validate(value: unknown) {\n if (!isRecord(value)) return { issues: [{ message: 'meta must be an object', path: [] }] };\n const issues: Issue[] = [];\n const { to, by, resolve, searchField, candidates, scope } = value;\n if (\n to !== undefined &&\n !(typeof to === 'string' && to.length > 0) &&\n !(isRecord(to) && (typeof to.id === 'string' || isRecord(to.ref)))\n )\n issues.push({ message: 'must be a resource name or reference', path: ['to'] });\n if (by !== undefined && (typeof by !== 'string' || by.length === 0))\n issues.push({ message: 'must be the name of a field of the target', path: ['by'] });\n if (resolve !== undefined && resolve !== 'eager' && resolve !== 'lazy')\n issues.push({ message: \"must be 'eager' or 'lazy'\", path: ['resolve'] });\n if (searchField !== undefined && typeof searchField !== 'string')\n issues.push({ message: 'must be a field name', path: ['searchField'] });\n if (candidates !== undefined && !Array.isArray(candidates))\n issues.push({ message: 'must be an array of conditions', path: ['candidates'] });\n if (scope !== undefined && scope !== 'context' && scope !== 'session' && scope !== 'none')\n issues.push({ message: \"must be 'context', 'session' or 'none'\", path: ['scope'] });\n return issues.length > 0 ? { issues } : { value };\n },\n }),\n}) as StandardSchemaV1<unknown, Meta>;\n","'use client';\nimport type * as React from 'react';\nimport { Input } from '../primitives/input.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\nexport function TextDisplay({ value, text: formatted }: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // The surface's formatted text (REF-117 §4.4) replaces `String(value)`.\n if (formatted !== undefined) return <span>{formatted}</span>;\n const { text, isStructured } = toDisplayText(value);\n return isStructured ? (\n <span className=\"font-mono text-xs break-all\">{text}</span>\n ) : (\n <span>{text}</span>\n );\n}\n\nexport function TextInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n minLength,\n maxLength,\n pattern,\n}: FieldInputProps): React.ReactElement {\n return (\n <Input\n name={name}\n id={id}\n type=\"text\"\n value={(value as string | undefined) ?? ''}\n onChange={(e) => onChange(e.target.value)}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n minLength={minLength}\n maxLength={maxLength}\n pattern={pattern}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n // WAI-ARIA 1.2 attribute spread — see record/record-screen.tsx for rationale.\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","'use client';\nimport type * as React from 'react';\nimport { Textarea } from '../primitives/textarea.js';\nimport type { FieldInputProps, FieldRendererProps } from './registry.js';\nimport { toDisplayText } from './display-value.js';\n\nexport function TextareaDisplay({\n value,\n text: formatted,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n // `f.json` now routes to `JsonDisplay` (see json.tsx), not here — but this\n // renderer still needs the same object-safe formatting for a plain textarea\n // field fed a structured value, which is why guarding only `TextDisplay`\n // once left «[object Object]» on every jsonb field. See toDisplayText. The surface's formatted\n // text (REF-117 §4.4) replaces it when the field declares a transform.\n const { text, isStructured } =\n formatted === undefined ? toDisplayText(value) : { text: formatted, isStructured: false };\n return (\n <pre\n className={\n isStructured\n ? 'whitespace-pre-wrap break-all font-mono text-xs'\n : 'whitespace-pre-wrap font-sans text-sm'\n }\n >\n {text}\n </pre>\n );\n}\n\n/**\n * Code / configuration display: monospace, indentation preserved, no wrapping\n * mid-token. YAML is indentation-significant, so the sans-serif proportional\n * rendering used for prose actively misleads here.\n */\nexport function CodeDisplay({\n value,\n text: formatted,\n presentation,\n testid,\n}: FieldRendererProps): React.ReactElement {\n if (value == null || value === '') return <span className=\"text-muted-foreground\">—</span>;\n const text = formatted ?? toDisplayText(value).text;\n // The <pre> stays in both modes: monospace and preserved line breaks are\n // information, not decoration. What `plain` drops is the chrome around it —\n // the fill, border and padding, all of which fight whatever container is\n // hosting the value.\n const className =\n presentation === 'plain'\n ? 'overflow-x-auto whitespace-pre font-mono text-xs leading-relaxed'\n : 'overflow-x-auto whitespace-pre rounded-md border bg-muted/40 p-3 font-mono text-xs leading-relaxed';\n return (\n <pre data-testid={testid} className={className}>\n {text}\n </pre>\n );\n}\n\n/**\n * Code / configuration input. A plain textarea for now, but monospace and\n * Tab-aware: in a normal textarea Tab moves focus, which makes indented YAML\n * impossible to type. Swapping in a real editor later is a change here only.\n */\nexport function CodeInput(props: FieldInputProps): React.ReactElement {\n return (\n <TextareaInput\n {...props}\n className=\"min-h-64 font-mono text-xs\"\n onKeyDown={(e) => {\n if (e.key !== 'Tab' || e.shiftKey) return;\n e.preventDefault();\n const el = e.currentTarget;\n const { selectionStart: start, selectionEnd: end, value: v } = el;\n props.onChange(`${v.slice(0, start)} ${v.slice(end)}`);\n // Restore the caret after React re-renders with the new value;\n // otherwise it jumps to the end on every Tab.\n requestAnimationFrame(() => el.setSelectionRange(start + 2, start + 2));\n }}\n />\n );\n}\n\nexport function TextareaInput({\n name,\n id,\n value,\n onChange,\n testid,\n placeholder,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n className,\n onKeyDown,\n minLength,\n maxLength,\n}: FieldInputProps & {\n className?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n}): React.ReactElement {\n return (\n <Textarea\n className={className}\n onKeyDown={onKeyDown}\n name={name}\n id={id}\n value={(value as string | undefined) ?? ''}\n onChange={(e) => onChange(e.target.value)}\n data-testid={testid}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n minLength={minLength}\n maxLength={maxLength}\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n />\n );\n}\n","import { fieldOptionText } from '@burojs/core';\nimport {\n type CollectionDisplayProps,\n type CollectionInputProps,\n type FieldImplementation,\n type FieldImplementationLayout,\n optionFieldName,\n type ScalarDisplayProps,\n type ScalarInputProps,\n} from '@burojs/react';\nimport { type EntityRef, formatEntityRef } from '@burojs/core';\nimport { enumBindingKey, enumParamsOf, narrowEntriesOf } from '@burojs/core/internal';\nimport { useFieldMetaSources, useOptionalApp } from '@burojs/react';\nimport { type ReactElement, createElement } from 'react';\nimport { EnumBadge } from '../enum/enum-badge.js';\nimport { EnumPicker } from '../enum/enum-picker.js';\nimport { resolveEnumControl } from '../enum/resolve-enum-control.js';\nimport { isErrorIssue } from '../forms/issue-severity.js';\nimport { BooleanDisplay, BooleanInput } from './boolean.js';\nimport {\n DateDisplay,\n DateInput,\n DateTimeDisplay,\n DateTimeInput,\n TimeDisplay,\n TimeInput,\n} from './date.js';\nimport { EnumDisplay, EnumInput } from './enum.js';\nimport { FileDisplay } from './file-display.js';\nimport { FileInput } from './file.js';\nimport { JsonDisplay, JsonInput } from './json.js';\nimport { LazyRelationManyInput } from './lazy-relation-many.js';\nimport { LazyRichTextDisplay, LazyRichTextInput } from './lazy-rich-text.js';\nimport { NumberDisplay, NumberInput } from './number.js';\nimport { ObjectGroupDisplay, ObjectGroupInput } from './object-group.js';\nimport { RepeaterDisplay, RepeaterInput } from './repeater.js';\nimport type { FieldInputProps, FieldRenderer, FieldRendererProps } from './registry.js';\nimport { RelationManyDisplay } from './link-keys-display.js';\nimport { RelationDisplay } from './relation-display.js';\nimport { relationMetaSchema } from './relation-meta-schema.js';\nimport { RelationPickerInput } from './relation-picker.js';\nimport { TextDisplay, TextInput } from './text.js';\nimport { CodeDisplay, CodeInput, TextareaDisplay, TextareaInput } from './textarea.js';\n\n/**\n * Transitional adapter for the existing shadcn controls. It is deliberately\n * one-way: field consumers use the canonical React contract, while individual\n * controls can keep their small, stable prop surface during this migration.\n */\nfunction legacyField(\n props:\n | ScalarInputProps<unknown>\n | ScalarDisplayProps<unknown>\n | CollectionInputProps<unknown>\n | CollectionDisplayProps<unknown>,\n) {\n const name = optionFieldName(props.path);\n const { texts, zone } = props.field as { readonly texts?: unknown; readonly zone?: unknown };\n return Object.freeze({\n name,\n meta: props.meta as Record<string, unknown>,\n ui: props.ui as Record<string, unknown>,\n ...(texts === undefined ? {} : { texts }),\n ...(zone === undefined ? {} : { zone }),\n });\n}\n\nfunction legacyOptions(\n options: ScalarInputProps<unknown>['options'],\n field: unknown,\n): FieldRendererProps['options'] {\n if (options.length === 0) return undefined;\n return options.map((option) => {\n const value = String(option.value ?? '');\n return Object.freeze({\n value,\n // The field's `texts.options`, else the raw value.\n label: fieldOptionText(field, value) ?? value,\n ...(typeof option.meta?.icon === 'string' ? { icon: option.meta.icon } : {}),\n });\n }) as FieldRendererProps['options'];\n}\n\n/** A resource's registry key: `<namespace>:<id>`, or the bare id in the default namespace. */\nfunction registryKey(ref: EntityRef): string {\n return ref.namespace === 'default' ? ref.id : formatEntityRef(ref);\n}\n\nfunction display(renderer: FieldRenderer['Display']) {\n return function ShadcnDisplay(\n props: ScalarDisplayProps<unknown> | CollectionDisplayProps<unknown>,\n ): ReactElement {\n return createElement(renderer, {\n value: props.value,\n ...(props.text === undefined ? {} : { text: props.text }),\n multiple: props.multiple,\n field: legacyField(props),\n options: legacyOptions(props.options, props.field),\n resource: props.resource.id,\n owner: registryKey(props.resource),\n record: props.record as Record<string, unknown> | undefined,\n presentation: props.presentation,\n testid: props.testIds.display,\n });\n };\n}\n\nfunction input(renderer: FieldRenderer['Input']) {\n return function ShadcnInput(\n props: ScalarInputProps<unknown> | CollectionInputProps<unknown>,\n ): ReactElement {\n const constraints = props.field.constraints;\n const nativeConstraints =\n props.field.type === 'number'\n ? {\n ...(typeof constraints?.minimum === 'number' ? { min: constraints.minimum } : {}),\n ...(typeof constraints?.maximum === 'number' ? { max: constraints.maximum } : {}),\n }\n : props.field.type === 'string'\n ? {\n ...(typeof constraints?.minLength === 'number'\n ? { minLength: constraints.minLength }\n : {}),\n ...(typeof constraints?.maxLength === 'number'\n ? { maxLength: constraints.maxLength }\n : {}),\n ...(typeof constraints?.pattern === 'string' ? { pattern: constraints.pattern } : {}),\n }\n : {};\n return createElement(renderer, {\n name:\n props.accessibility.input ??\n (typeof props.path.at(-1) === 'string' ? String(props.path.at(-1)) : 'field'),\n id: props.accessibility.input,\n value: props.value,\n multiple: props.multiple,\n onChange: (props.onChange ?? (() => undefined)) as FieldInputProps['onChange'],\n testid: props.testIds.input,\n options: legacyOptions(props.options, props.field) as FieldInputProps['options'],\n placeholder: typeof props.ui.placeholder === 'string' ? props.ui.placeholder : undefined,\n disabled: props.disabled,\n required: props.field.required === true,\n ...nativeConstraints,\n // A `severity: 'warning' | 'info'` issue renders in its own\n // non-destructive channel (record/record-screen.tsx) — it must never mark the\n // control invalid. Only an ERROR-severity issue does.\n ariaInvalid: props.issues.some(isErrorIssue),\n ariaDescribedBy: props.accessibility.description,\n ariaErrorMessage: props.accessibility.error,\n ariaLabelledBy: props.accessibility.label,\n field: legacyField(props),\n resource: props.resource.id,\n record: props.record as Record<string, unknown> | undefined,\n values: props.form,\n relationSeeds: (props as { readonly relationSeeds?: FieldInputProps['relationSeeds'] })\n .relationSeeds,\n fixedFilters: (props as { readonly fixedFilters?: FieldInputProps['fixedFilters'] })\n .fixedFilters,\n optionSubtitle: (props as { readonly optionSubtitle?: FieldInputProps['optionSubtitle'] })\n .optionSubtitle,\n metaSources: props.metaSources,\n ...(props.baseline === undefined ? {} : { baseline: props.baseline }),\n link: (props as { readonly link?: FieldInputProps['link'] }).link,\n });\n };\n}\n\nfunction scalar(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n return Object.freeze({\n Input: input(renderer.Input) as FieldImplementation<unknown>['Input'],\n Display: display(renderer.Display) as FieldImplementation<unknown>['Display'],\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\nfunction collection(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n const ScalarInput = input(renderer.Input);\n const ScalarDisplay = display(renderer.Display);\n return Object.freeze({\n CollectionInput: (props: CollectionInputProps<unknown>) =>\n createElement(ScalarInput, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarInputProps<unknown>),\n CollectionDisplay: (props: CollectionDisplayProps<unknown>) =>\n createElement(ScalarDisplay, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarDisplayProps<unknown>),\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\n/**\n * File fields can be either a legacy scalar (one selected file) or a canonical\n * collection. Both share the same legacy control, while the resolver supplies\n * the cardinality bit that `FileInput` passes to `useFileField`.\n */\nfunction scalarOrCollection(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n const ScalarInput = input(renderer.Input);\n const ScalarDisplay = display(renderer.Display);\n return Object.freeze({\n Input: ScalarInput as FieldImplementation<unknown>['Input'],\n Display: ScalarDisplay as FieldImplementation<unknown>['Display'],\n CollectionInput: (props: CollectionInputProps<unknown>) =>\n createElement(ScalarInput, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarInputProps<unknown>),\n CollectionDisplay: (props: CollectionDisplayProps<unknown>) =>\n createElement(ScalarDisplay, {\n ...props,\n multiple: true,\n value: props.value,\n } as unknown as ScalarDisplayProps<unknown>),\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\n/** The registered enum a field names: a lowered entity ref keeps its namespace (`audit:severity`). */\nfunction enumName(ui: Readonly<Record<string, unknown>>): string | undefined {\n return enumBindingKey(ui.enum);\n}\n\n/**\n * The registry branch of `enumAware()`: `EnumPicker` over the registered enum\n * `enumName`, in the control the field asks for (`ui.control`), else the one\n * the enum declares, else a select. A component of its own so the registry is\n * read through a hook at render, never at module level.\n *\n * The field is the enum's use site (REF-132 §7.2): its `meta.enumParams` and\n * `meta.narrow`, read over the owner's sources, make the picker offer only the\n * available set.\n */\nfunction RegistryEnumInput(\n props: ScalarInputProps<unknown> & { readonly enumName: string },\n): ReactElement {\n const app = useOptionalApp();\n const meta = props.field.meta;\n const sources = useFieldMetaSources({\n record: props.record,\n values: props.form,\n // The owner's projected states, handed to every input beside the canonical context.\n extra: props.metaSources,\n });\n const control = resolveEnumControl(\n props.ui.control,\n app?.registry.enums.get(props.enumName),\n `field ${typeof props.path.at(-1) === 'string' ? String(props.path.at(-1)) : props.enumName}`,\n );\n return createElement(EnumPicker, {\n enumName: props.enumName,\n control,\n value: props.value == null ? undefined : String(props.value),\n onChange: props.onChange ?? (() => undefined),\n name: props.accessibility.input,\n id: props.accessibility.input,\n testid: props.testIds.input,\n placeholder: typeof props.ui.placeholder === 'string' ? props.ui.placeholder : undefined,\n disabled: props.disabled,\n required: props.field.required === true,\n ariaInvalid: props.issues.some(isErrorIssue),\n ariaDescribedBy: props.accessibility.description,\n ariaErrorMessage: props.accessibility.error,\n ariaLabelledBy: props.accessibility.label,\n use: {\n params: enumParamsOf(meta?.enumParams),\n narrow: narrowEntriesOf(meta?.narrow),\n sources,\n mode: props.record === undefined ? 'create' : 'edit',\n // The form's starting values (seeded on a create), as the plan and the save compare.\n baseline: props.baseline ?? props.record,\n },\n });\n}\n\n/**\n * A string declaration may carry an enum resource independently of its\n * semantic format. Keep that decision inside the catalog implementation so\n * all field surfaces retain the same resolver path and adopters can override\n * it through a higher-priority explicit UI implementation.\n *\n * Three-way routing, checked in this order:\n * 1. `ui.enum` present → the REGISTRY picker/badge (`EnumPicker`/\n * `EnumBadge`), in the control `resolveEnumControl` picks.\n * 2. No registry enum, but the field declares a non-empty inline\n * `options` array (e.g. `csvFormat()`'s delimiter presets: `type:\n * 'string'` + `options`, no `ui.enum`) → the options-driven\n * `EnumInput`/`EnumDisplay` (`./enum.js`), which reads `props.options`\n * directly and needs no registry at all. This is the routing this\n * function existed to add: an inline-options field used to fall all\n * the way through to `renderer` (a plain text box) because `enumName`\n * only ever looked at `ui.enum`.\n * 3. Neither → `renderer` (the plain fallback control, e.g. `TextInput`),\n * unchanged. A plain string field with no options must keep rendering\n * a text box.\n *\n * `EnumInput`/`EnumDisplay` degrade correctly when reached via (2): with no\n * `ui.enum` and no `meta.enumNamespace`, `enumNamespaceOf` (`@burojs/core`)\n * returns `undefined`, and `resolveOptionLabel` (`@burojs/react`) reads the field's own slot\n * `fields.<name>.options.<value>` with the inline label as its default\n * rather than querying a registry namespace — no throw, no blank.\n */\nfunction enumAware(\n renderer: FieldRenderer,\n layout?: FieldImplementationLayout,\n): FieldImplementation<unknown> {\n // `input()`/`display()` (the same adapters `scalar()` itself calls, and the\n // same pattern `collection()`/`scalarOrCollection()` above already use)\n // return the concrete component directly — no optional-field unwrapping,\n // so no non-null assertion is needed here. `layout` is deliberately not\n // threaded through: it only affects the `FieldImplementation` object\n // `scalar()` returns, never the Input/Display components themselves, and\n // `enumAware()`'s OWN return value applies `layout` once, below.\n const FallbackInput = input(renderer.Input);\n const FallbackDisplay = display(renderer.Display);\n // `en` (`EnumInput`/`EnumDisplay`) is itself the fallback the `enum` UI-type\n // registration passes as `renderer` — for that entry this is the exact same\n // component as `FallbackInput`/`FallbackDisplay` above, so routing (2)/(3)\n // below collapses to the unchanged \"always EnumInput/EnumDisplay when\n // `ui.enum` is absent\" behavior it already had. Only the `string` entry\n // (`renderer` = `text`) sees a genuinely different component here.\n const OptionedInput = input(en.Input);\n const OptionedDisplay = display(en.Display);\n return Object.freeze({\n Input: (props: ScalarInputProps<unknown>) => {\n const name = enumName(props.ui);\n if (name !== undefined) return createElement(RegistryEnumInput, { ...props, enumName: name });\n if (props.options.length > 0) return createElement(OptionedInput, props);\n return createElement(FallbackInput, props);\n },\n Display: (props: ScalarDisplayProps<unknown>) => {\n const name = enumName(props.ui);\n if (name !== undefined) {\n return createElement(EnumBadge, {\n enumName: name,\n value: props.value == null ? undefined : String(props.value),\n testid: props.testIds.display,\n presentation: props.presentation,\n });\n }\n if (props.options.length > 0) return createElement(OptionedDisplay, props);\n return createElement(FallbackDisplay, props);\n },\n ...(layout === undefined ? {} : { layout }),\n });\n}\n\nconst text = { Display: TextDisplay, Input: TextInput };\nconst num = { Display: NumberDisplay, Input: NumberInput };\nconst bool = { Display: BooleanDisplay, Input: BooleanInput };\nconst date = { Display: DateDisplay, Input: DateInput };\nconst dateTime = { Display: DateTimeDisplay, Input: DateTimeInput };\nconst time = { Display: TimeDisplay, Input: TimeInput };\nconst en = { Display: EnumDisplay, Input: EnumInput };\nconst ta = { Display: TextareaDisplay, Input: TextareaInput };\nconst rel = { Display: RelationDisplay, Input: RelationPickerInput };\nconst file = { Display: FileDisplay, Input: FileInput };\n// Keep rich text behind the Vite-era lazy boundary. The canonical adapters\n// still supply its legacy control contract, while the TipTap implementation\n// remains out of the initial bundle.\nconst rich = { Display: LazyRichTextDisplay, Input: LazyRichTextInput };\n\nconst relationMany = collection({ Display: RelationManyDisplay, Input: LazyRelationManyInput });\n\n/** Immutable, trusted shadcn implementations keyed by the compiler's UI IDs. */\nexport const shadcnFieldImplementations = Object.freeze({\n string: enumAware(text),\n text: scalar(text),\n textarea: scalar(ta, { size: 'full' }),\n code: scalar({ Display: CodeDisplay, Input: CodeInput }, { size: 'full' }),\n number: scalar(num),\n boolean: scalar(bool),\n date: scalar(date),\n dateTime: scalar(dateTime),\n 'date-time': scalar(dateTime),\n 'default:date-time': scalar(dateTime),\n time: scalar(time),\n 'default:time': scalar(time),\n enum: enumAware(en),\n json: scalar({ Display: JsonDisplay, Input: JsonInput }, { size: 'full' }),\n // A to-many relation (`type: 'array'`, `format: 'relation'`) displays each key as a relation;\n // its input is the generic array input over its items.\n // A to-many relation (`type: 'array'`, `format: 'relation'`): chips with a select over the same\n // option query as the single one. Its input loads lazily (P7 3.5).\n relation: Object.freeze({\n ...scalar(rel),\n meta: relationMetaSchema,\n ...relationMany,\n }),\n richText: scalar(rich, { size: 'full' }),\n 'rich-text': scalar(rich, { size: 'full' }),\n 'default:rich-text': scalar(rich, { size: 'full' }),\n file: scalarOrCollection(file, { size: 'full' }),\n // The chrome of a structured field (T2 5.5). The shell lays the properties and elements out and\n // hands them over as `children` and `renderElement`, so these draw only the container.\n object: Object.freeze({\n Input: ObjectGroupInput,\n Display: ObjectGroupDisplay,\n chrome: true,\n } satisfies FieldImplementation<unknown>),\n array: Object.freeze({\n CollectionInput: RepeaterInput,\n CollectionDisplay: RepeaterDisplay,\n chrome: true,\n } satisfies FieldImplementation<unknown>),\n});\n","'use client';\nimport type { FormBody, ResourceFieldMap } from '@burojs/core';\nimport { type FormValues, ScreenStateProvider, useFormController } from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport { ScreenTree } from '../screen/screen-tree.js';\n\nexport interface DeclarativeDisplayProps<F extends ResourceFieldMap = ResourceFieldMap> {\n /** The same field-def map shape `defineResource`'s `f` builder produces. */\n readonly fields: F;\n /** The values to display — this renderer owns no state of its own. */\n readonly values: FormValues;\n /**\n * Drives label i18n, the doc address and the leaf ids\n * (`<i18nPrefix>:field:<name>:hint` / `:info`). Default `'form'`.\n */\n readonly i18nPrefix?: string;\n /**\n * The display's tree, as `<DeclarativeForm body>`; absent, every field in\n * one column, in declaration order. A field under a `when` that does not\n * hold over `values` is not shown.\n */\n readonly body?: FormBody<F>;\n}\n\n/**\n * Read-only VIEW of a resource-less field map (P1b+P1c S3e): the\n * read/edit/locked distinction's \"view\" corner — **edit** is\n * `<DeclarativeForm>`, **locked** `<DeclarativeForm disabled>` (inputs,\n * disabled), **view** this (displays, never inputs). Driven by the form\n * controller in `show` mode over `values`, rendered through the same screen\n * renderer, so a field hidden by a `when` in `<DeclarativeForm>` is hidden here\n * too for the same values.\n */\nexport function DeclarativeDisplay<F extends ResourceFieldMap = ResourceFieldMap>(\n props: DeclarativeDisplayProps<F>,\n): ReactElement {\n return (\n <ScreenStateProvider>\n <DisplayBody {...(props as DeclarativeDisplayProps)} />\n </ScreenStateProvider>\n );\n}\n\nfunction DisplayBody(props: DeclarativeDisplayProps): ReactElement {\n const prefix = props.i18nPrefix ?? 'form';\n const controller = useFormController({\n fields: props.fields,\n mode: 'show',\n value: props.values,\n ...(props.body === undefined ? {} : { body: props.body }),\n ...(props.i18nPrefix === undefined ? {} : { i18nPrefix: props.i18nPrefix }),\n });\n const leafIds = useMemo(() => ({ prefix }), [prefix]);\n return (\n <ScreenTree\n region=\"form-body\"\n resource={prefix}\n mode=\"show\"\n compiled={controller.screen}\n controller={controller}\n leafIds={leafIds}\n />\n );\n}\n","'use client';\n\nimport type * as React from 'react';\nimport {\n type EnumNameOrRef,\n type EnumValue,\n enumFallbackKey,\n enumFallbackText,\n enumValueText,\n resolveContentSlot,\n resolveEnumLabel,\n} from '@burojs/core';\nimport { useApp, useEnumValues, useI18nCaps } from '@burojs/react';\nimport { enumBindingKey } from '@burojs/core/internal';\nimport { EnumBadge } from './enum-badge.js';\nimport { Icon } from '../primitives/icon.js';\n\nexport type EnumDisplayVariant = 'badge' | 'plain' | 'icon-label';\n\nexport interface EnumDisplayProps<N extends string = string> {\n /** The enum's name, checked against the registered enums, or its entity ref `{ namespace, id }`. */\n enumName: EnumNameOrRef<N>;\n value: string | null | undefined;\n /** Display variant. Defaults to 'badge'. */\n variant?: EnumDisplayVariant;\n testid?: string;\n className?: string;\n}\n\n/**\n * Render an enum value in one of three variants:\n * - `badge` (default): delegates to `<EnumBadge>`. Best for table cells.\n * - `plain`: renders just the resolved label as a `<span>`. No styling.\n * Best for show-page key/value layouts where the label sits next to a\n * field name.\n * - `icon-label`: renders the icon slot (a `data-icon` attribute consumed\n * by the adopter's icon registry) followed by the label. v1 ships the\n * attribute + label only — adopters wire their own icon component.\n *\n * Backward compat: undefined / null / empty values render an em-dash in\n * every variant. Unregistered enums fall back to raw value text (logged\n * once via console.warn, dev-only).\n */\nexport function EnumDisplay<const N extends string = string>({\n enumName: enumInput,\n value,\n variant = 'badge',\n testid,\n className,\n}: EnumDisplayProps<N>): React.ReactElement {\n const enumName = enumBindingKey(enumInput) ?? '';\n const app = useApp();\n const caps = useI18nCaps();\n const def = app.registry.enums.get(enumName);\n const { values, isLoading, error } = useEnumValues(enumName);\n const ns = (def as { i18nNamespace?: string } | undefined)?.i18nNamespace ?? enumName;\n const id = testid ?? `enum-display:${enumName}:${String(value ?? 'null')}`;\n\n if (variant === 'badge') {\n return <EnumBadge enumName={enumName} value={value} testid={testid} className={className} />;\n }\n\n if (value == null || value === '') {\n return (\n <span data-testid={`${id}:empty`} className=\"text-muted-foreground\">\n —\n </span>\n );\n }\n\n // Loader still resolving — small skeleton placeholder.\n if (isLoading) {\n return (\n <span\n data-testid={`${id}:loading`}\n className={`inline-block h-4 w-12 animate-pulse rounded bg-muted ${className ?? ''}`}\n aria-busy=\"true\"\n />\n );\n }\n\n // Loader rejected — render the raw value as plain text (graceful\n // degradation). The error message is included via `title` for inspection.\n if (error) {\n return (\n <span data-testid={`${id}:error`} className={className} title={error.message}>\n {value}\n </span>\n );\n }\n\n const entry: EnumValue | undefined = values?.find((v) => v.value === value);\n // A value the enum does not declare takes the fallback slot, as in `<EnumBadge>`.\n const label =\n entry === undefined && (def?.fallback !== undefined || enumFallbackText(def) !== undefined)\n ? (resolveContentSlot(caps, [enumFallbackKey(ns)], { default: enumFallbackText(def) }) ??\n value)\n : resolveEnumLabel(caps, ns, value, enumValueText(def, value) ?? entry?.label);\n const icon = entry?.icon;\n\n if (variant === 'icon-label') {\n return (\n <span\n data-testid={id}\n data-icon={icon}\n className={`inline-flex items-center gap-1 ${className ?? ''}`}\n >\n {icon ? <Icon name={icon} className=\"size-3.5 shrink-0 text-muted-foreground\" /> : null}\n {label}\n </span>\n );\n }\n\n // 'plain'\n return (\n <span data-testid={id} className={className}>\n {label}\n </span>\n );\n}\n","'use client';\nimport { useEffect, useRef, useState } from 'react';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Thin text-input filter bound to a TanStack column. Used for\n * `contains` / `equal` / `startswith` operators where the column\n * itself declares the operator on its `meta.filters`. The value is\n * written straight to the column's own TanStack filter state — this\n * component does not convert it to a server-side filter expression.\n *\n * Storage shape: a plain string. An empty string clears the filter\n * entirely (`column.setFilterValue(undefined)`) so the filter state\n * does not carry a noisy `field = ''` entry.\n *\n * No internal state — read/write goes through `column.getFilterValue()`\n * and `column.setFilterValue()` exclusively, matching the contract\n * shared with the other column-driven filter components.\n *\n * Testid: caller-provided via the `testid` prop. Resource-aware\n * generation is the caller's responsibility (e.g.\n * `list-filter:posts:title:input`).\n */\nexport interface DataTableTextFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n placeholder?: string;\n /** testid for the input */\n testid?: string;\n className?: string;\n}\n\nexport function DataTableTextFilter<TData, TValue>({\n column,\n placeholder,\n testid,\n className,\n}: DataTableTextFilterProps<TData, TValue>): React.ReactElement {\n const external = (column.getFilterValue() as string | undefined) ?? '';\n\n // Local text state keeps typing instant (only this input re-renders per\n // key); the commit to `column.setFilterValue` — which round-trips to the\n // URL and triggers a server refetch — is debounced so it fires once per\n // typing burst, not per keystroke. Re-syncs from the external value on\n // clear-all / saved view / deep link.\n const [text, setText] = useState(external);\n const lastPushedRef = useRef(external);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Adopt the external value ONLY when it changed from outside (clear-all /\n // saved view / deep link) — never when it's the echo of our own debounced\n // commit, which would clobber characters typed during the debounce window.\n useEffect(() => {\n if (external !== lastPushedRef.current) {\n setText(external);\n lastPushedRef.current = external;\n }\n }, [external]);\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n },\n [],\n );\n\n return (\n <Input\n type=\"text\"\n placeholder={placeholder}\n value={text}\n data-testid={testid}\n onChange={(event) => {\n const next = event.target.value;\n setText(next);\n if (timerRef.current) clearTimeout(timerRef.current);\n // Empty string clears entirely. There's no bridge to drop `''`\n // values downstream anymore (removed in 4f86a514) — this\n // component canonicalises to `undefined` itself, so\n // `column.getIsFiltered()` and `table.getState().columnFilters`\n // reflect \"no filter\" rather than \"filter present with empty\n // string\".\n timerRef.current = setTimeout(() => {\n lastPushedRef.current = next;\n column.setFilterValue(next === '' ? undefined : next);\n }, 300);\n }}\n className={cn('h-8 w-[150px] lg:w-[200px]', className)}\n />\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { DataTableFacetedFilter, type FacetedFilterOption } from './data-table-faceted-filter.js';\n\n/**\n * Thin convenience wrapper around `<DataTableFacetedFilter>` that\n * exists so callers can spell the iar-ui-style \"enum filter\"\n * vocabulary without having to know the multi-select implementation\n * detail. Future enum-specific affordances (e.g. icon-from-registry,\n * cross-resource enum source) can be added here without changing the\n * caller-visible API.\n *\n * Storage shape and testid contract are inherited from\n * `<DataTableFacetedFilter>`: an array of selected option `value`s\n * is written via `column.setFilterValue(...)`, and an empty\n * selection clears with `column.setFilterValue(undefined)` so the\n * filter bridge does not emit `{operator: 'in', value: []}` (which\n * most providers interpret as \"match nothing\").\n */\nexport type { FacetedFilterOption } from './data-table-faceted-filter.js';\n\nexport interface DataTableEnumFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n title: string;\n options: FacetedFilterOption[];\n /**\n * Resource-agnostic testid generator. Roles:\n * 'trigger' → the popover trigger button\n * 'search' → the cmdk search input\n * 'option' → option item (value passed as second arg)\n * 'clear' → the Clear-filters footer item\n */\n getTestId?: (\n role: 'trigger' | 'option' | 'clear' | 'search',\n value?: string,\n ) => string | undefined;\n className?: string;\n}\n\nexport function DataTableEnumFilter<TData, TValue>({\n column,\n title,\n options,\n getTestId,\n className,\n}: DataTableEnumFilterProps<TData, TValue>): React.ReactElement {\n return (\n <DataTableFacetedFilter\n column={column}\n title={title}\n options={options}\n getTestId={getTestId}\n className={className}\n />\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Pair of number inputs for a numeric range filter. Writes the column\n * filter value as a `[min?, max?]` tuple — either entry can be\n * `undefined`. When BOTH ends are empty the filter is cleared entirely\n * (`column.setFilterValue(undefined)`) so no caller reading\n * `column.getFilterValue()` sees a `between` filter with no bounds.\n *\n * The storage shape is intentionally a tuple (not `{min, max}`) to match\n * `FilterOperator`'s `between` value convention (`@burojs/core`) and so\n * the column can declare `meta.filters: [{operators: ['between']}]`\n * without an extra unwrap step for callers reading the tuple straight off\n * `column.getFilterValue()`.\n *\n * Number parsing: empty string → `undefined`. `Number(value)` is\n * used otherwise; `NaN` is treated as `undefined` so a partially\n * typed `'-'` does not clobber the other end of the range with a\n * spurious value.\n *\n * Testids: caller-provided via `getTestId(role)` where role is\n * `'min' | 'max'`. Resource-aware generation is the caller's\n * responsibility.\n */\nexport interface DataTableNumRangeFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n minPlaceholder?: string;\n maxPlaceholder?: string;\n /** Resource-aware testid generator. Roles: 'min' | 'max'. */\n getTestId?: (role: 'min' | 'max') => string | undefined;\n className?: string;\n}\n\ntype NumRange = [number | undefined, number | undefined];\n\nfunction readRange(value: unknown): NumRange {\n if (Array.isArray(value)) {\n const [a, b] = value;\n return [normalize(a), normalize(b)];\n }\n return [undefined, undefined];\n}\n\nfunction normalize(v: unknown): number | undefined {\n if (v === undefined || v === null || v === '') return undefined;\n const n = typeof v === 'number' ? v : Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\nfunction parseInput(raw: string): number | undefined {\n if (raw === '') return undefined;\n const n = Number(raw);\n return Number.isFinite(n) ? n : undefined;\n}\n\nexport function DataTableNumRangeFilter<TData, TValue>({\n column,\n minPlaceholder,\n maxPlaceholder,\n getTestId,\n className,\n}: DataTableNumRangeFilterProps<TData, TValue>): React.ReactElement {\n const [minVal, maxVal] = readRange(column.getFilterValue());\n\n const commit = (next: NumRange) => {\n if (next[0] === undefined && next[1] === undefined) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue(next);\n };\n\n return (\n <div className={cn('flex gap-2', className)}>\n <Input\n type=\"number\"\n placeholder={minPlaceholder}\n value={minVal ?? ''}\n data-testid={getTestId?.('min')}\n onChange={(event) => commit([parseInput(event.target.value), maxVal])}\n className=\"h-8 w-[100px]\"\n />\n <Input\n type=\"number\"\n placeholder={maxPlaceholder}\n value={maxVal ?? ''}\n data-testid={getTestId?.('max')}\n onChange={(event) => commit([minVal, parseInput(event.target.value)])}\n className=\"h-8 w-[100px]\"\n />\n </div>\n );\n}\n","'use client';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Pair of `<input type=\"date\">` controls for a date-range filter.\n * Writes the column filter value as a `[isoStart?, isoEnd?]` tuple\n * of ISO 8601 `yyyy-mm-dd` strings — either entry can be\n * `undefined`. When BOTH ends are empty the filter is cleared\n * entirely (`column.setFilterValue(undefined)`).\n *\n * We deliberately ship the native browser date control rather than a\n * Calendar-Popover so this component depends only on existing\n * primitives. Stage-2 polish can swap to a richer picker without\n * changing the storage shape — adopters keep `[isoStart?, isoEnd?]`\n * either way.\n *\n * Testids: caller-provided via `getTestId(role)` where role is\n * `'from' | 'to'`.\n */\nexport interface DataTableDateRangeFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n fromPlaceholder?: string;\n toPlaceholder?: string;\n /** Resource-aware testid generator. Roles: 'from' | 'to'. */\n getTestId?: (role: 'from' | 'to') => string | undefined;\n className?: string;\n}\n\ntype DateRange = [string | undefined, string | undefined];\n\nfunction readRange(value: unknown): DateRange {\n if (Array.isArray(value)) {\n const [a, b] = value;\n return [normalize(a), normalize(b)];\n }\n return [undefined, undefined];\n}\n\nfunction normalize(v: unknown): string | undefined {\n if (v === undefined || v === null || v === '') return undefined;\n return String(v);\n}\n\nexport function DataTableDateRangeFilter<TData, TValue>({\n column,\n fromPlaceholder,\n toPlaceholder,\n getTestId,\n className,\n}: DataTableDateRangeFilterProps<TData, TValue>): React.ReactElement {\n const [fromVal, toVal] = readRange(column.getFilterValue());\n\n const commit = (next: DateRange) => {\n if (next[0] === undefined && next[1] === undefined) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue(next);\n };\n\n return (\n <div className={cn('flex gap-2', className)}>\n <Input\n type=\"date\"\n placeholder={fromPlaceholder}\n value={fromVal ?? ''}\n data-testid={getTestId?.('from')}\n onChange={(event) =>\n commit([event.target.value === '' ? undefined : event.target.value, toVal])\n }\n className=\"h-8 w-[150px]\"\n />\n <Input\n type=\"date\"\n placeholder={toPlaceholder}\n value={toVal ?? ''}\n data-testid={getTestId?.('to')}\n onChange={(event) =>\n commit([fromVal, event.target.value === '' ? undefined : event.target.value])\n }\n className=\"h-8 w-[150px]\"\n />\n </div>\n );\n}\n","'use client';\nimport { useEffect, useRef, useState } from 'react';\nimport { useChromeT } from '@burojs/react';\nimport type { Column } from '@tanstack/react-table';\nimport { Input } from '../primitives/input.js';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../primitives/select.js';\nimport { cn } from '../lib/cn.js';\nimport type { FilterOperator } from './use-buro-data-table.js';\n\n/**\n * Universal filter chip that pairs an explicit operator picker with a\n * single value input. Used for columns whose filter UI must let the\n * user choose the operator at runtime (e.g. \"id equals\" vs \"id ≥\") —\n * the more common case where the operator is fixed by the column is\n * served by `<DataTableTextFilter>` / `<DataTableNumRangeFilter>` /\n * `<DataTableDateRangeFilter>`.\n *\n * Storage shape: a `{operator, value}` object written via\n * `column.setFilterValue(...)`. When the value end is empty\n * (`undefined` / `null` / `''`) the entire filter is cleared\n * (`column.setFilterValue(undefined)`) — we never store an\n * `{operator, value: undefined}` shell that would fool\n * `column.getIsFiltered()`. Operator-only changes preserve the\n * current value when one exists.\n *\n * Bridge integration: `tanStackFiltersToBuro` natively understands\n * the `{operator, value}` shape and uses the stored per-row operator\n * (overriding `meta.filters[0].operators[0]`). Empty inner values\n * (`undefined` / `null` / `''`) are dropped by the bridge same as raw\n * empty values, so the `setFilterValue(undefined)` canonicalisation\n * above is what users see end-to-end.\n *\n * Testids: caller-provided via `getTestId(role, value?)`. Roles:\n * 'op' → the Select trigger\n * 'op-option' → an option inside the Select (operator passed as 2nd arg)\n * 'value' → the value input\n */\nexport interface DataTableOperatorFilterProps<TData, TValue> {\n column: Column<TData, TValue>;\n operators: FilterOperator[];\n defaultOperator?: FilterOperator;\n /** Determines the value input type. */\n valueKind?: 'text' | 'number' | 'date';\n /** Resource-aware testid generator. */\n getTestId?: (role: 'op' | 'op-option' | 'value', value?: string) => string | undefined;\n className?: string;\n}\n\ninterface OperatorFilterState {\n operator?: FilterOperator;\n value?: unknown;\n}\n\n/**\n * English fallbacks, used only when no i18n bundle is mounted. The LIVE labels\n * come from `filters.operators.<op>` — these were previously rendered directly,\n * so a list whose primary locale is not English showed «Alias · contains» on its default screen\n * while a translated `filters.contains` sat unused in the bundle. The locale slot\n * existed; nothing was wired to it.\n */\n/** @internal The operators `filters.operators.<op>` is keyed by, with their English defaults. */\nexport const OPERATOR_LABELS: Record<FilterOperator, string> = {\n eq: 'equals',\n ne: 'not equals',\n gt: '>',\n gte: '≥',\n lt: '<',\n lte: '≤',\n in: 'in',\n nin: 'not in',\n contains: 'contains',\n ncontains: 'not contains',\n between: 'between',\n nbetween: 'not between',\n null: 'is null',\n nnull: 'is not null',\n startswith: 'starts with',\n endswith: 'ends with',\n has: 'has',\n hasAny: 'has any of',\n hasAll: 'has all of',\n hasNone: 'has none of',\n some: 'has an item where',\n};\n\n/**\n * Translate a `FilterOperator` to its caller-facing label. Exported so\n * an adopter can override per-locale via composition rather than\n * patching this file.\n */\nexport function formatOperatorLabel(\n op: FilterOperator,\n chromeT?: (key: string, opts?: { defaultValue?: string }) => string,\n): string {\n return chromeT\n ? chromeT(`filters.operators.${op}`, { defaultValue: OPERATOR_LABELS[op] })\n : OPERATOR_LABELS[op];\n}\n\n/** Hook form, for the common case of rendering inside a component. */\nexport function useOperatorLabel(): (op: FilterOperator) => string {\n const chromeT = useChromeT();\n return (op) => formatOperatorLabel(op, chromeT);\n}\n\nfunction isEmpty(v: unknown): boolean {\n return v === undefined || v === null || v === '';\n}\n\nfunction inputTypeFor(kind: 'text' | 'number' | 'date'): string {\n switch (kind) {\n case 'number':\n return 'number';\n case 'date':\n return 'date';\n default:\n return 'text';\n }\n}\n\nexport function DataTableOperatorFilter<TData, TValue>({\n column,\n operators,\n defaultOperator,\n valueKind = 'text',\n getTestId,\n className,\n}: DataTableOperatorFilterProps<TData, TValue>): React.ReactElement {\n const opLabel = useOperatorLabel();\n const stored = column.getFilterValue() as OperatorFilterState | undefined;\n const storedOperator = stored?.operator;\n const storedValue = stored?.value;\n\n // Operator + value live in LOCAL state so:\n // (a) the operator dropdown reflects the user's pick IMMEDIATELY even\n // before a value is typed — previously the pick was discarded when\n // the value was empty, so the Select snapped back to its default;\n // (b) typing in the value input is instant (only this component\n // re-renders per key); the commit to `column.setFilterValue` —\n // which round-trips to the URL and triggers a server refetch — is\n // debounced so it fires once per typing burst, not per keystroke.\n const storedValueStr =\n storedValue === undefined || storedValue === null ? '' : String(storedValue);\n\n const [op, setOp] = useState<FilterOperator | undefined>(\n storedOperator ?? defaultOperator ?? operators[0],\n );\n const [text, setText] = useState<string>(storedValueStr);\n const lastPushedRef = useRef<string>(storedValueStr);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Operator comes from a Select (no caret) — sync it freely from external\n // state (URL nav / clear-all / saved view).\n useEffect(() => {\n setOp(storedOperator ?? defaultOperator ?? operators[0]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storedOperator]);\n\n // Adopt the external VALUE only on a genuine outside change — never the\n // echo of our own debounced commit, which would otherwise clobber\n // characters typed during the debounce window (caret jumps, chars vanish\n // then reappear).\n useEffect(() => {\n if (storedValueStr !== lastPushedRef.current) {\n setText(storedValueStr);\n lastPushedRef.current = storedValueStr;\n }\n }, [storedValueStr]);\n\n useEffect(\n () => () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n },\n [],\n );\n\n const commit = (nextOp: FilterOperator | undefined, rawValue: string) => {\n if (rawValue === '' || !nextOp) {\n column.setFilterValue(undefined);\n return;\n }\n const parsed: unknown =\n valueKind === 'number'\n ? (() => {\n const n = Number(rawValue);\n return Number.isFinite(n) ? n : undefined;\n })()\n : rawValue;\n if (isEmpty(parsed)) {\n column.setFilterValue(undefined);\n return;\n }\n column.setFilterValue({ operator: nextOp, value: parsed });\n };\n\n const onOperatorChange = (next: FilterOperator) => {\n setOp(next);\n // Re-commit immediately with the new operator when a value is present.\n if (text !== '') {\n lastPushedRef.current = text;\n commit(next, text);\n }\n };\n\n const onValueChange = (raw: string) => {\n setText(raw);\n if (timerRef.current) clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => {\n lastPushedRef.current = raw;\n commit(op, raw);\n }, 300);\n };\n\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <Select value={op} onValueChange={(next) => onOperatorChange(next as FilterOperator)}>\n <SelectTrigger data-testid={getTestId?.('op')} className=\"h-8 w-[120px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {operators.map((o) => (\n <SelectItem key={o} value={o} data-testid={getTestId?.('op-option', o)}>\n {opLabel(o)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Input\n type={inputTypeFor(valueKind)}\n value={text}\n data-testid={getTestId?.('value')}\n onChange={(event) => onValueChange(event.target.value)}\n className=\"h-8 w-[150px] lg:w-[200px]\"\n />\n </div>\n );\n}\n","'use client';\nimport type { Row } from '@tanstack/react-table';\nimport { IconDots } from '@tabler/icons-react';\nimport { useState } from 'react';\nimport { useChromeT } from '@burojs/react';\nimport { Button } from '../primitives/button.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Per-row \"...\" actions menu. Functional adaptation of the canonical\n * shadcn Tasks `data-table-row-actions.tsx` using existing Popover\n * primitive (DropdownMenu primitive isn't shipped). The shadcn\n * version is hard-coded to a `task` schema; this version takes a\n * generic `actions` array so it can be plugged into any resource.\n *\n * Adopters who need richer affordances (sub-menus, radio groups,\n * keyboard shortcuts) can wrap and extend; this baseline ships the\n * menu-of-actions shape used by 99% of admin tables.\n *\n * Testids: resource-agnostic. Caller supplies `getTestId(role,\n * actionName?)` — roles 'trigger' (the \"...\" button) and 'action'\n * (per-action button, with the action's name passed as second arg).\n */\nexport interface RowActionDescriptor<TData> {\n /** Stable identifier — used for testid + React keys. */\n name: string;\n\n /** Visible label shown in the menu. */\n label: string;\n\n /** Click handler. The row's `original` record is passed in. */\n onClick: (row: TData) => void | Promise<void>;\n\n /** Marks the item as visually destructive. */\n variant?: 'default' | 'destructive';\n\n /**\n * Optional confirmation message. When provided, the action is\n * gated behind `window.confirm(message)` — accept proceeds, dismiss\n * aborts. Mirrors the existing ActionButton + BulkActionToolbar\n * confirm semantic.\n */\n confirm?: string;\n\n /** Disable the action (e.g., when prerequisites aren't met). */\n disabled?: boolean;\n}\n\nexport interface DataTableRowActionsProps<TData> {\n row: Row<TData>;\n actions: RowActionDescriptor<TData>[];\n\n /**\n * Resource-agnostic testid generator. Roles:\n * 'trigger' → the \"...\" button\n * 'action' → per-action button (action.name passed as second arg)\n */\n getTestId?: (role: 'trigger' | 'action', actionName?: string) => string | undefined;\n\n className?: string;\n}\n\nexport function DataTableRowActions<TData>({\n row,\n actions,\n getTestId,\n className,\n}: DataTableRowActionsProps<TData>): React.ReactElement | null {\n const [open, setOpen] = useState(false);\n const chromeT = useChromeT();\n if (actions.length === 0) return null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n data-testid={getTestId?.('trigger')}\n className={cn('h-8 w-8', className)}\n >\n <IconDots className=\"h-4 w-4\" aria-hidden=\"true\" />\n <span className=\"sr-only\">\n {chromeT('actions.openMenu', { defaultValue: 'Open row actions menu' })}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[180px] p-1\">\n {actions.map((action) => (\n <button\n key={action.name}\n type=\"button\"\n disabled={action.disabled}\n data-testid={getTestId?.('action', action.name)}\n onClick={async () => {\n if (action.confirm && !window.confirm(action.confirm)) return;\n setOpen(false);\n await action.onClick(row.original);\n }}\n className={cn(\n 'flex w-full items-center rounded-sm px-2 py-1.5 text-sm outline-hidden',\n 'hover:bg-accent hover:text-accent-foreground',\n 'focus-visible:bg-accent focus-visible:text-accent-foreground',\n 'disabled:pointer-events-none disabled:opacity-50',\n action.variant === 'destructive' &&\n 'text-destructive hover:bg-destructive hover:text-destructive-foreground focus-visible:bg-destructive focus-visible:text-destructive-foreground',\n )}\n >\n {action.label}\n </button>\n ))}\n </PopoverContent>\n </Popover>\n );\n}\n","'use client';\nimport type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\nimport { IconX } from '@tabler/icons-react';\nimport { Button } from '../primitives/button.js';\nimport { Input } from '../primitives/input.js';\nimport { cn } from '../lib/cn.js';\n\n/**\n * Generic toolbar shell for `<DataTable>`. Functional adaptation of\n * the canonical shadcn Tasks `data-table-toolbar.tsx`, but with the\n * resource-specific bits (title/status/priority filters, \"Add Task\"\n * button) replaced by slots so the same component serves any\n * resource.\n *\n * Layout:\n * [Search input] [filters slot] [extra slot] [DataTableViewOptions slot]\n *\n * The Reset button auto-appears when any column filter is active —\n * `table.resetColumnFilters()` clears them all and bubbles up through\n * `useBuroDataTable`'s `columnFilters`/`onColumnFiltersChange` passthrough\n * to the caller's own state.\n *\n * Testids: caller-provided via `getTestId(role)` — roles 'search',\n * 'reset'. Resource-aware testids for filter chips and view options\n * are emitted by their own components, threaded into the slots.\n */\nexport interface DataTableToolbarProps<TData> {\n table: Table<TData>;\n\n /**\n * Column id to wire the search input to. When undefined, the\n * search input is omitted entirely. The matching column must\n * register a `filterFn` (default 'includesString' is sufficient\n * for client-side; server-side filtering is handled via the\n * `useBuroDataTable` bridge).\n */\n searchColumnId?: string;\n searchPlaceholder?: string;\n\n /** Faceted filter chips to render inside the left cluster. */\n filters?: ReactNode;\n\n /** Slot for any extra controls on the right (e.g., \"Add\" button). */\n extraActions?: ReactNode;\n\n /** Slot for the DataTableViewOptions menu (or a custom column visibility control). */\n viewOptions?: ReactNode;\n\n /** Resource-agnostic testid generator. Roles: 'search', 'reset'. */\n getTestId?: (role: 'search' | 'reset') => string | undefined;\n\n className?: string;\n}\n\nexport function DataTableToolbar<TData>({\n table,\n searchColumnId,\n searchPlaceholder = 'Search…',\n filters,\n extraActions,\n viewOptions,\n getTestId,\n className,\n}: DataTableToolbarProps<TData>): React.ReactElement {\n const isFiltered = table.getState().columnFilters.length > 0;\n const searchColumn = searchColumnId ? table.getColumn(searchColumnId) : undefined;\n\n return (\n <div className={cn('flex items-center justify-between gap-2', className)}>\n <div className=\"flex flex-1 items-center gap-2\">\n {searchColumn && (\n <Input\n type=\"search\"\n placeholder={searchPlaceholder}\n value={(searchColumn.getFilterValue() as string) ?? ''}\n onChange={(event) => searchColumn.setFilterValue(event.target.value)}\n data-testid={getTestId?.('search')}\n className=\"h-8 w-[150px] lg:w-[250px]\"\n />\n )}\n {filters}\n {isFiltered && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => table.resetColumnFilters()}\n data-testid={getTestId?.('reset')}\n className=\"h-8 px-2 lg:px-3\"\n >\n Reset\n <IconX className=\"ml-2 h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {extraActions}\n {viewOptions}\n </div>\n </div>\n );\n}\n","'use client';\nimport {\n type CustomPageDef,\n compilePageScreen,\n isScreenFailure,\n type ScreenNode,\n snapshotAppFrames,\n snapshotBlockLookup,\n snapshotFrameLookup,\n} from '@burojs/core';\nimport {\n type BlockScreenProps,\n RouteSourceContext,\n useApplicationSnapshot,\n useProjectedRecord,\n} from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport { PlannedBody } from '../layout/page-host.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { RecordState } from '../record/record-state.js';\n\n/** The value at `path` of a record, or `undefined`. */\nfunction readPath(record: Readonly<Record<string, unknown>>, path: readonly string[]): unknown {\n let current: unknown = record;\n for (const segment of path) {\n if (current === null || typeof current !== 'object') return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** `value` with every ref to `record` replaced by what the (projected) row holds there. */\nfunction bindRecord(value: unknown, record: Readonly<Record<string, unknown>>): unknown {\n if (value === null || typeof value !== 'object') return value;\n if (Array.isArray(value)) return value.map((entry) => bindRecord(entry, record));\n const object = value as Record<string, unknown>;\n if (object.kind === 'ref' && object.source === 'record' && Array.isArray(object.path))\n return readPath(record, object.path as string[]);\n return Object.fromEntries(\n Object.entries(object).map(([key, entry]) => [key, bindRecord(entry, record)]),\n );\n}\n\n/**\n * `screens.block`: a modal action's block (P7 3.16), drawn as the one placement of a page with the\n * block's own data, `requires` and mount-time validation. An item action's `ref('record', …)` is\n * bound from the clicked row **projected** by field view: a field its user may not view is never read, and\n * nothing is drawn (so nothing is read) until that is decided. The same row is the page's `record`\n * source, so a prop the action leaves unset reads its declared `default(ref('record', …))` (and\n * `ref('values', …)`, which reads the record in show) from it (#49). A resource-level or app modal has\n * no row. The overlay host owns dismissal and the navigation guard, as for every overlay (P3).\n */\nexport function BlockScreen({\n block,\n props,\n resource,\n record,\n label,\n}: BlockScreenProps): ReactElement {\n const snapshot = useApplicationSnapshot();\n const projected = useProjectedRecord(resource ?? '', record);\n const needsRow = resource !== undefined && record !== undefined;\n const ready = !needsRow || projected.status === 'ready';\n const row = projected.value;\n const compiled = useMemo(() => {\n if (!ready) return undefined;\n const bound =\n needsRow && row !== null ? (bindRecord(props, row) as Record<string, unknown>) : props;\n const node = Object.freeze({\n kind: 'place',\n key: 'content',\n block,\n ...(Object.keys(bound).length === 0 ? {} : { props: bound }),\n }) as unknown as ScreenNode;\n const page = Object.freeze({\n name: 'modal',\n path: '/',\n label: label ?? 'modal',\n body: Object.freeze([node]),\n }) as unknown as CustomPageDef;\n return compilePageScreen(page, {\n blocks: snapshotBlockLookup(snapshot),\n frames: snapshotFrameLookup(snapshot),\n appFrames: snapshotAppFrames(snapshot),\n });\n }, [ready, needsRow, row, props, block, label, snapshot]);\n if (compiled === undefined) return <Skeleton className=\"h-24 w-full\" />;\n if (isScreenFailure(compiled)) return <RecordState state=\"error\" />;\n return (\n <RouteSourceContext.Provider value={null}>\n <div data-testid=\"modal-block\" className=\"min-w-0\">\n <PlannedBody\n screen={compiled}\n name=\"modal\"\n label={label ?? ''}\n {...(needsRow && row !== null ? { record: row } : {})}\n />\n </div>\n </RouteSourceContext.Provider>\n );\n}\n","import { dtoFields, isRelationField } from '@burojs/core';\nimport type { CapabilityResolver } from '@burojs/react';\nimport { type PeekFieldSource, peekFieldDefinition, peekLeafAllowed } from './peek-filter.js';\n\nexport { type PeekFieldSource, peekFieldDefinition } from './peek-filter.js';\n\n/** How many fields a peek shows under its title (the design page's number, Q10). */\nexport const PEEK_FIELD_COUNT = 5;\n\n/** Whether a field definition (a runtime field def or a portable entry) is a relation. */\nfunction relation(field: unknown): boolean {\n if (field === null || typeof field !== 'object') return false;\n return isRelationField(field as Readonly<{ type?: unknown; format?: unknown; kind?: unknown }>);\n}\n\nconst resolveOf = (bag: unknown): unknown =>\n bag !== null && typeof bag === 'object'\n ? (bag as { readonly resolve?: unknown }).resolve\n : undefined;\n\n/**\n * Whether a relation is a lazy to-one (`meta.resolve: 'lazy'`, or `opts.resolve` on a builder\n * def): it reads nothing, its key renders as a link or the target's opener (spec 4.3), so the\n * peek's one read still holds. The same rule `checkPeekBody` applies to a declared peek body.\n */\nfunction lazyToOne(field: unknown): boolean {\n const entry = field as Readonly<Record<string, unknown>>;\n if (entry.kind === 'relationMany' || entry.type === 'array') return false;\n return (resolveOf(entry.meta) ?? resolveOf(entry.opts)) === 'lazy';\n}\n\n/**\n * The fields a peek shows (spec 4.6): `columns` (the target's `views.list.columns`) in order,\n * minus the display field, minus every field not in the record DTO (`in: ['list']` only, or not\n * declared at all), minus every `sensitive` field, minus every column the target's `column` rule\n * hides from this viewer, minus every field its viewer may not view (`fieldVisible`, decided in\n * record reach over the read row, P5 spec 3.6), minus every relation field that would need its own\n * read (an eager to-one or any to-many; a lazy to-one shows its key); the first\n * {@link PEEK_FIELD_COUNT}.\n */\nexport function peekFields(\n def: PeekFieldSource,\n columns: readonly string[],\n capabilityFor: CapabilityResolver,\n fieldVisible: (name: string) => boolean = () => true,\n): readonly string[] {\n const record = new Set(dtoFields(def, 'record'));\n const out: string[] = [];\n for (const name of columns) {\n if (out.length === PEEK_FIELD_COUNT) break;\n if (name === def.displayField || out.includes(name) || !record.has(name)) continue;\n const field = peekFieldDefinition(def, name);\n if (\n !peekLeafAllowed(def, name, capabilityFor, fieldVisible) ||\n (relation(field) && !lazyToOne(field))\n )\n continue;\n out.push(name);\n }\n return Object.freeze(out);\n}\n","'use client';\nimport {\n builtinFrames,\n type CompiledScreen,\n compiledScreenFor,\n type EntityRef,\n dtoFields,\n formatEntityRef,\n normalizeDataError,\n projectDto,\n relationAmbiguousError,\n resolveFieldLabel,\n declaredText,\n type ColumnEntry,\n columnName,\n} from '@burojs/core';\nimport {\n QUICK_ANCHOR_ATTRIBUTE,\n type CapabilityResolver,\n type FrameTranslate,\n type PeekScreenProps,\n useApp,\n useApplicationSnapshot,\n useFormController,\n useFrameImplementations,\n useFrameT,\n useCapabilityResolver,\n useFieldAccess,\n useI18nCaps,\n useList,\n useOne,\n useChromeT,\n useOptionalT,\n useProjectedRecord,\n useQuickOpener,\n useTestIds,\n useUIInstance,\n} from '@burojs/react';\nimport {\n type ComponentType,\n type ReactElement,\n Suspense,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\nimport { shadcnFrameViews } from '../frames/builtin.js';\nimport { resolveFrameView } from '../frames/resolve.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { peekLeafAllowed, peekRecord, peekRow } from './peek-filter.js';\nimport { toDisplayText } from '../fields/display-value.js';\nimport { FieldValueFrame } from '../fields/field-value-frame.js';\nimport { ResolvedFieldDisplay } from '../fields/resolved-field.js';\nimport { Button } from '../primitives/button.js';\nimport { Skeleton } from '../primitives/skeleton.js';\nimport { recordDisplayName } from '../resource/record-display-name.js';\nimport { useRecordSubtitle } from '../resource/use-record-subtitle.js';\nimport { technicalText } from '../lib/friendly-error.js';\nimport { PeekContext, PeekHostContext } from './peek-context.js';\nimport { type PeekFieldSource, peekFieldDefinition, peekFields } from './peek-fields.js';\nimport { focusWithoutPeek, peekAnchorOpener } from './use-peek-intent.js';\n\ntype Row = Readonly<Record<string, unknown>>;\n\n/** What a peek's read came to. */\ntype PeekRead =\n | { readonly state: 'pending' }\n | { readonly state: 'failed'; readonly retry: () => void }\n | { readonly state: 'unavailable' }\n | { readonly state: 'ambiguous' }\n | { readonly state: 'row'; readonly row: Row };\n\n/** `not-found` and `forbidden` read the same (spec 4.6); anything else can be retried. */\nfunction failure(error: unknown, retry: () => void): PeekRead {\n const { kind } = normalizeDataError(error);\n if (kind === 'not-found' || kind === 'forbidden') return { state: 'unavailable' };\n return { state: 'failed', retry };\n}\n\n/**\n * The UI kit's peek (`presentationHosts.screens.peek`, presented under `buro:peek` in a popover;\n * spec 4.6): the target's title, which opens `quick.show`, and up to five of its list columns.\n * It reads once it renders — by id, the record with the record DTO (the descriptor `quick.show`\n * reads, so a cached row renders at once and the click into `quick.show` reuses it); by a `by`\n * key, the `where <by> eq <key>` read with limit 2.\n */\nexport function PeekScreen(props: PeekScreenProps): ReactElement {\n return (\n <PeekContext.Provider value={true}>\n {props.by !== undefined ? (\n <PeekByKey target={props.target} by={props.by} />\n ) : (\n <PeekById target={props.target} id={props.id ?? ''} />\n )}\n </PeekContext.Provider>\n );\n}\n\nfunction useRecordProjection(target: string): readonly string[] | undefined {\n const app = useApp();\n const def = app.registry.get(target);\n return useMemo(() => (def === undefined ? undefined : dtoFields(def, 'record')), [def]);\n}\n\nfunction PeekById({ target, id }: { readonly target: string; readonly id: string }) {\n const projection = useRecordProjection(target);\n // A key that names no record reads nothing (Known finding 1).\n const usable = id !== '' && projection !== undefined;\n const query = useOne(target, {\n id,\n enabled: usable,\n retry: false,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n let read: PeekRead;\n // Data already there (cached, or kept while it refetches) renders at once; a background\n // refetch never blanks it (P3-42).\n if (!usable) read = { state: 'unavailable' };\n else if (result !== undefined)\n read =\n result.data !== null && typeof result.data === 'object'\n ? { state: 'row', row: result.data as Row }\n : { state: 'unavailable' };\n else if (query.error != null) read = failure(query.error, () => void query.refetch());\n else read = { state: 'pending' };\n return <PeekBody target={target} peekKey={id} read={read} />;\n}\n\nfunction PeekByKey({\n target,\n by,\n}: {\n readonly target: string;\n readonly by: { readonly field: string; readonly key: string };\n}) {\n // The lazy display's click reads the same descriptor (spec 4.5): one of them is the first read.\n const query = useList(target, {\n filter: { field: by.field, op: 'eq', value: by.key } as never,\n pagination: { kind: 'offset', page: 1, pageSize: 2 } as never,\n // The lazy display's descriptor (`relation-display.tsx`): a key read, never narrowed.\n scope: 'none',\n enabled: by.key !== '',\n retry: false,\n });\n const rows = (query.data as { readonly data?: readonly Row[] } | undefined)?.data;\n let read: PeekRead;\n if (rows !== undefined) {\n if (rows.length === 0) read = { state: 'unavailable' };\n else if (rows.length > 1) read = { state: 'ambiguous' };\n else read = { state: 'row', row: rows[0] as Row };\n } else if (query.error != null) read = failure(query.error, () => void query.refetch());\n else read = { state: 'pending' };\n useEffect(() => {\n if (read.state === 'ambiguous' && process.env.NODE_ENV !== 'production')\n console.error(`[burojs] ${technicalText(relationAmbiguousError(target, by.field, by.key))}`);\n }, [read.state, target, by.field, by.key]);\n return <PeekBody target={target} peekKey={by.key} read={read} />;\n}\n\nfunction PeekBody({\n target,\n peekKey,\n read,\n}: {\n readonly target: string;\n readonly peekKey: string;\n readonly read: PeekRead;\n}): ReactElement {\n const tid = useTestIds();\n const t = useOptionalT();\n const chromeT = useChromeT();\n const testid = tid.peek(target, peekKey);\n if (read.state === 'pending')\n return (\n <div data-testid={testid} aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <div data-testid={`${testid}:peek-skeleton`} className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-5 w-40\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n </div>\n </div>\n );\n if (read.state === 'failed')\n return (\n <div data-testid={testid} className=\"flex flex-col items-start gap-2 text-sm\">\n <p data-testid={`${testid}:failed`}>\n {t('peek.failed', { defaultValue: \"Couldn't load\" })}\n </p>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n data-testid={`${testid}:retry`}\n onClick={read.retry}\n >\n {chromeT('actions.retry', { defaultValue: 'Retry' })}\n </Button>\n </div>\n );\n if (read.state === 'unavailable')\n return (\n <p data-testid={testid} className=\"text-sm text-muted-foreground\">\n <span data-testid={`${testid}:unavailable`}>\n {t('peek.unavailable', { defaultValue: 'Not available' })}\n </span>\n </p>\n );\n if (read.state === 'ambiguous')\n return (\n <p data-testid={testid} className=\"text-sm text-muted-foreground\">\n <span data-testid={`${testid}:ambiguous`}>{peekKey}</span>\n </p>\n );\n return <PeekRecord target={target} testid={testid} row={read.row} />;\n}\n\n/** The id of a peeked row, by the target's id field (the DTO leaves it out). */\nfunction rowIdOf(def: { readonly data?: unknown } | undefined, row: Row): unknown {\n const idField = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n return row[typeof idField === 'string' && idField.length > 0 ? idField : 'id'];\n}\n\n/**\n * The read row in its peek: the effective peek frame (`views.quick.peek.frame` ← the app's\n * `frames.peek` ← `buro:peek`) around the declared body (planned over the one row already read,\n * filtered by {@link peekLeafAllowed}; no new read) or P3's default body (P6 3.9).\n */\nfunction PeekRecord({\n target,\n testid,\n row,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly row: Row;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(target) as\n | (PeekFieldSource & { readonly data?: unknown; readonly ref?: EntityRef })\n | undefined;\n const ref = def?.ref ?? { namespace: 'default', id: target };\n const snapshot = useApplicationSnapshot();\n const compiled = useMemo(\n () => (def === undefined ? undefined : compiledScreenFor(snapshot, ref, 'show', 'peek')),\n [snapshot, ref, def],\n );\n const screen =\n compiled === undefined || 'kind' in compiled ? undefined : (compiled as CompiledScreen);\n const declared =\n screen !== undefined && Object.values(screen.slots).some((nodes) => nodes.length > 0);\n const frameRef = screen?.frame ?? builtinFrames.peek.ref;\n const catalog = useFrameImplementations();\n const resolved = useMemo(() => resolveFrameView(frameRef, catalog, 'peek'), [frameRef, catalog]);\n const frameId = formatEntityRef(frameRef);\n const t = useFrameT(frameId);\n const capabilityFor = useCapabilityResolver(target, row, 'show');\n const idFieldValue = (def?.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField = typeof idFieldValue === 'string' && idFieldValue.length > 0 ? idFieldValue : 'id';\n const projection = useRecordProjection(target);\n const dto = useMemo(\n () =>\n projection === undefined ? row : { ...projectDto(row, projection), [idField]: row[idField] },\n [row, projection, idField],\n );\n // P5 field view in record reach over the row as read; undecided is not visible (spec 3.6.5).\n const access = useFieldAccess(target, 'record', dto);\n const fieldVisible = useCallback((name: string) => access[name]?.view === 'visible', [access]);\n const record = useMemo(\n () => peekRecord(def, dto, idField, capabilityFor, fieldVisible),\n [dto, def, idField, capabilityFor, fieldVisible],\n );\n // A peek frame's `record` prop holds only the fields the body draws (P5 spec 3.6.5).\n const frameRow = useMemo(() => {\n if (def === undefined || screen === undefined) return record;\n const drawn = new Set<string>();\n for (const node of screen.nodes)\n if (node.kind === 'field' && node.field !== undefined) drawn.add(node.field);\n return peekRow(def, dto, idField, capabilityFor, fieldVisible, drawn);\n }, [def, screen, dto, record, idField, capabilityFor, fieldVisible]);\n const host = useContext(PeekHostContext);\n const instance = useUIInstance();\n const quickOpen = useQuickOpener();\n const rowId = rowIdOf(def, row);\n const openable = rowId !== null && rowId !== undefined && rowId !== '';\n // The title click: closes the peek, then opens `quick.show` through the entry gate (undecided\n // access opens nothing).\n const open = useCallback(() => {\n if (!openable) return;\n const anchor = host?.anchor ?? null;\n const anchorOpen = peekAnchorOpener(anchor);\n instance.dismiss();\n // Focus returns to the anchor when `quick.show` closes (spec 4.12): the overlay\n // records the focused element as it opens, and this focus opens no peek.\n if (anchor?.isConnected) focusWithoutPeek(anchor);\n if (anchorOpen !== undefined) anchorOpen(target, String(rowId));\n else void quickOpen(target, String(rowId));\n }, [openable, host, instance, target, rowId, quickOpen]);\n const builtin = resolved.view === shadcnFrameViews['buro:peek'].component;\n if (!declared) {\n const body = (\n <DefaultPeekBody\n target={target}\n testid={testid}\n row={row}\n open={openable ? open : undefined}\n />\n );\n if (builtin) return body;\n const View = resolved.view;\n const slots: Record<string, ReactElement | null> = { body };\n for (const name of Object.keys(screen?.slots ?? {})) slots[name] ??= null;\n return (\n <Suspense fallback={null}>\n <View slots={slots} record={frameRow} open={open} t={t} />\n </Suspense>\n );\n }\n return (\n <DeclaredPeekBody\n target={target}\n testid={testid}\n record={record}\n frameRecord={frameRow}\n def={def}\n capabilityFor={capabilityFor}\n fieldVisible={fieldVisible}\n view={resolved.view}\n builtin={builtin}\n open={open}\n openable={openable}\n t={t}\n />\n );\n}\n\n/** A declared peek body, planned over the filtered row (`entry: 'peek'`; nothing is read). */\nfunction DeclaredPeekBody({\n target,\n testid,\n record,\n frameRecord,\n def,\n capabilityFor,\n fieldVisible,\n view: View,\n builtin,\n open,\n openable,\n t,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly record: Row;\n readonly frameRecord: Row;\n readonly def: PeekFieldSource | undefined;\n readonly capabilityFor: CapabilityResolver;\n readonly fieldVisible: (name: string) => boolean;\n // biome-ignore lint/suspicious/noExplicitAny: a peek frame view\n readonly view: ComponentType<any>;\n /** The built-in peek frame draws only `body`: the framework draws the title above it. */\n readonly builtin: boolean;\n readonly open: () => void;\n readonly openable: boolean;\n readonly t: FrameTranslate;\n}): ReactElement {\n // The popover is named by the record's title, whatever body or frame draws it (P3 4.12).\n const host = useContext(PeekHostContext);\n const title = recordDisplayName(record as Record<string, unknown>, def?.displayField);\n const subtitle = useRecordSubtitle(target)(record as Record<string, unknown>) ?? undefined;\n const setLabel = host?.setLabel;\n useEffect(() => setLabel?.(title), [setLabel, title]);\n const controller = useFormController({\n resource: target,\n mode: 'show',\n record: record as Record<string, unknown>,\n entry: 'peek',\n });\n const compiled = controller.screen;\n // A leaf of a field the peek may not show renders absent (P3-38 in custom bodies, P6-66).\n const hidden = useMemo<ReadonlySet<string>>(() => {\n const out = new Set<string>();\n for (const entry of compiled?.fields ?? [])\n if (def === undefined || !peekLeafAllowed(def, entry.name, capabilityFor, fieldVisible))\n out.add(entry.name);\n return out;\n }, [compiled, def, capabilityFor, fieldVisible]);\n const slots: Record<string, ReactElement | null> = {};\n for (const name of Object.keys(compiled?.slots ?? {})) {\n const roots = controller.plan?.slots[name] ?? [];\n slots[name] = roots.every((node) => node.state === 'absent') ? null : (\n <ScreenTree\n key={name}\n region=\"record\"\n slot={name}\n resource={target}\n mode=\"show\"\n compiled={compiled}\n controller={controller}\n hiddenFields={hidden}\n />\n );\n }\n return (\n <div data-testid={testid} className=\"flex flex-col gap-3\">\n {builtin ? (\n <PeekTitle\n testid={testid}\n title={title}\n subtitle={subtitle}\n open={openable ? open : undefined}\n />\n ) : null}\n <Suspense fallback={null}>\n <View slots={slots} record={frameRecord} open={open} t={t} />\n </Suspense>\n </div>\n );\n}\n\n/** The peek's title: a button into `quick.show` when the row can be opened, else text. */\nfunction PeekTitle({\n testid,\n title,\n subtitle,\n open,\n}: {\n readonly testid: string;\n readonly title: string;\n /** The record's declared `recordSubtitle`, drawn under the title; the peek has no default. */\n readonly subtitle: string | undefined;\n readonly open: (() => void) | undefined;\n}): ReactElement {\n const heading =\n open === undefined ? (\n <p className=\"text-sm font-semibold\">{title}</p>\n ) : (\n <PeekTitleButton testid={testid} title={title} open={open} />\n );\n if (subtitle === undefined) return heading;\n return (\n <div className=\"flex flex-col gap-0.5\">\n {heading}\n <p data-testid={`${testid}:subtitle`} className=\"text-xs text-muted-foreground\">\n {subtitle}\n </p>\n </div>\n );\n}\n\n/** The title as a button into `quick.show`. */\nfunction PeekTitleButton({\n testid,\n title,\n open,\n}: {\n readonly testid: string;\n readonly title: string;\n readonly open: () => void;\n}): ReactElement {\n return (\n <button\n type=\"button\"\n data-testid={`${testid}:title`}\n {...{ [QUICK_ANCHOR_ATTRIBUTE]: '' }}\n className=\"self-start text-left text-sm font-semibold underline-offset-4 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n event.preventDefault();\n open();\n }}\n >\n {title}\n </button>\n );\n}\n\n/**\n * P3's default peek body (spec 4.6): the title, which opens `quick.show`, and up to five of the\n * target's list columns that {@link peekFields} admits. Under a custom peek frame it is that\n * frame's `body` slot (P6 plan ruling 14).\n */\nfunction DefaultPeekBody({\n target,\n testid,\n row,\n open,\n}: {\n readonly target: string;\n readonly testid: string;\n readonly row: Row;\n readonly open: (() => void) | undefined;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(target) as\n | (PeekFieldSource & {\n readonly data?: unknown;\n readonly views?: unknown;\n readonly ref?: EntityRef;\n })\n | undefined;\n const ref = def?.ref ?? { namespace: 'default', id: target };\n const host = useContext(PeekHostContext);\n const caps = useI18nCaps(target);\n const capabilityFor = useCapabilityResolver(target, row, 'show');\n const projection = useRecordProjection(target);\n const dtoRow = useMemo(\n () => (projection === undefined ? row : projectDto(row, projection)),\n [row, projection],\n );\n // Decided in record reach over the row as read, then projected (P5 spec 3.6): the title, the\n // fields and their values come from the projected row, never from `row`.\n const access = useFieldAccess(target, 'record', dtoRow);\n const projected = useProjectedRecord(target, dtoRow);\n const record = (projected.value ?? {}) as Row;\n const title = recordDisplayName(record as Record<string, unknown>, def?.displayField);\n const subtitleOf = useRecordSubtitle(target);\n // Called once the projected record is there, as a title hook is: never on the pending `{}`.\n const subtitle = projected.status === 'ready' ? (subtitleOf(record) ?? undefined) : undefined;\n const setLabel = host?.setLabel;\n useEffect(() => setLabel?.(title), [setLabel, title]);\n const columns = useMemo(() => {\n if (def === undefined) return [];\n const listed = (def.views as { readonly list?: { readonly columns?: readonly ColumnEntry[] } })\n ?.list?.columns;\n return peekFields(\n def,\n listed?.map(columnName) ?? Object.keys(def.fields),\n capabilityFor,\n (name) => access[name]?.view === 'visible',\n );\n }, [def, capabilityFor, access]);\n if (projected.status === 'pending')\n return (\n <div data-testid={testid} aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <div data-testid={`${testid}:peek-skeleton`} className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-5 w-40\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n </div>\n </div>\n );\n return (\n <div data-testid={testid} className=\"flex flex-col gap-3\">\n <PeekTitle testid={testid} title={title} subtitle={subtitle} open={open} />\n {columns.length === 0 ? null : (\n <dl className=\"grid gap-1.5\">\n {columns.map((name) => {\n const field = peekFieldDefinition(def!, name) as { readonly label?: string };\n const value = record[name];\n return (\n <div\n key={name}\n data-testid={`${testid}:field:${name}`}\n className=\"flex min-w-0 items-baseline gap-2 text-sm\"\n >\n <dt className=\"w-24 shrink-0 truncate text-xs text-muted-foreground\">\n {resolveFieldLabel(caps, name, declaredText('field', field, 'label'))}\n </dt>\n <dd className=\"min-w-0 break-words\">\n {/* The show page's surface, frame included (copy, overflow; REF-117 §4.13). */}\n <FieldValueFrame\n field={{ ...(field as object), name } as never}\n value={value}\n surface=\"display\"\n >\n <ResolvedFieldDisplay\n resource={ref}\n name={name}\n field={field as never}\n value={value}\n record={record}\n fallback={toDisplayText(value).text}\n />\n </FieldValueFrame>\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n </div>\n );\n}\n","'use client';\nimport {\n type DispatcherEffects,\n type EntityRef,\n type RecordId,\n type RouteDescriptor,\n dtoFields,\n routeResourceKey,\n} from '@burojs/core';\nimport {\n DispatcherProvider,\n type QuickEntry,\n NO_RECORD_SCOPE_FRAMES,\n type QuickEntryValue,\n RecordScopeChain,\n RouteSourceContext,\n retryRecordRead,\n useApp,\n useDispatcherEffects,\n useEntryGate,\n useOne,\n useQuickEntry,\n useProjectedTitle,\n useUIInstance,\n useUIPresentationRuntime,\n useRouteRecordId,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { InvalidRouteId, LoadError } from '../load-error/load-error-view.js';\nimport { canonicalResourceName } from '../list-kit/list-slots.js';\nimport { useRecordVisit } from '../layout/use-record-visit.js';\nimport { RecordScreen } from '../record/record-screen.js';\nimport { RecordState } from '../record/record-state.js';\nimport { QuickScreenClaimContext } from '../record/route-screen-context.js';\n\ntype Row = Readonly<Record<string, unknown>>;\n\nconst EMPTY_ROUTE: Row = Object.freeze({});\n\n/**\n * The top entry of a quick overlay (spec 4.4, 4.10): the record route's own screen, rendered\n * in the overlay. Show and edit read the record by id with the record DTO — the descriptor the\n * record route reads, so the two share one query — and never take an opener's row.\n */\nexport function QuickBody({ entry }: { readonly entry: QuickEntry }): ReactElement {\n // The overlay renders beside the app, not inside its opener: the record scope frames the entry\n // was opened under reach its reads only through the entry.\n return (\n <RecordScopeChain frames={entry.scopeFrames ?? NO_RECORD_SCOPE_FRAMES}>\n <QuickBodyOf entry={entry} />\n </RecordScopeChain>\n );\n}\n\nfunction QuickBodyOf({ entry }: { readonly entry: QuickEntry }): ReactElement {\n if (entry.mode === 'create') return <QuickScreenOf entry={entry} route={EMPTY_ROUTE} />;\n if (entry.recordId === undefined || entry.recordId === '')\n return <RecordState state=\"not-found\" />;\n return <QuickReadRoute entry={entry} recordId={entry.recordId} />;\n}\n\n/** The entry's text id read as the resource's id field declares it; an invalid one is not-found. */\nfunction QuickReadRoute({\n entry,\n recordId,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n}): ReactElement {\n const typed = useRouteRecordId(entry.resource, recordId);\n if (typed === undefined) return <InvalidRouteId resource={entry.resource} />;\n return <QuickRead entry={entry} recordId={recordId} typedId={typed} />;\n}\n\nfunction QuickRead({\n entry,\n recordId,\n typedId,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n readonly typedId: RecordId;\n}): ReactElement {\n const app = useApp();\n const def = app.registry.get(entry.resource);\n const projection = useMemo(\n () => (def === undefined ? undefined : dtoFields(def, 'record')),\n [def],\n );\n const query = useOne(entry.resource, {\n id: typedId,\n retry: retryRecordRead,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n if (result !== undefined) {\n const row = result.data;\n if (row === null || typeof row !== 'object') return <RecordState state=\"not-found\" />;\n return (\n <QuickLoaded\n entry={entry}\n recordId={recordId}\n typedId={typedId}\n row={row as Row}\n isCurrentData={!query.isPlaceholderData}\n />\n );\n }\n if (query.error != null) {\n return (\n <LoadError\n surface=\"record\"\n resource={entry.resource}\n error={query.error}\n retry={() => void query.refetch()}\n />\n );\n }\n return <RecordState state=\"loading\" />;\n}\n\n/**\n * A read record. The gate opened the entry without the row; with it, the entry's own operation\n * is re-checked (P3-44: a row-level `show` rule — an archived order, say). Anything but `open`\n * renders the not-found state and mounts no frame, so nothing the screen would read is read.\n */\nfunction QuickLoaded({\n entry,\n recordId,\n typedId,\n row,\n isCurrentData,\n}: {\n readonly entry: QuickEntry;\n readonly recordId: string;\n readonly typedId: RecordId;\n readonly row: Row;\n readonly isCurrentData: boolean;\n}): ReactElement {\n const gate = useEntryGate();\n const quick = useQuickEntry();\n const answer = gate(entry.resource, entry.mode === 'edit' ? 'edit' : 'show', row);\n const open = answer.state === 'open';\n const title = useProjectedTitle(entry.resource, recordId, row, { placeholder: !isCurrentData });\n // The visit is recorded as the record route records it (spec 4.4 (5)), show only.\n useRecordVisit(entry.resource, open && entry.mode === 'show' ? row : null, { isCurrentData });\n const stack = quick?.stack;\n useEffect(() => {\n if (open && stack !== undefined) stack.nameTop(title);\n }, [open, stack, title]);\n const route = useMemo<Row>(() => Object.freeze({ id: recordId }), [recordId]);\n if (answer.state === 'undecided') return <RecordState state=\"loading\" />;\n if (!open) return <RecordState state=\"not-found\" />;\n return <QuickScreenOf entry={entry} route={route} recordId={typedId} />;\n}\n\n/** `name` canonical, or `null` when it names no entity. */\nfunction canonicalOrNull(name: unknown): string | null {\n try {\n if (typeof name === 'string') return canonicalResourceName(name);\n // A route's entity-ref resource (`{ namespace, id }`), as its key.\n if (name !== null && typeof name === 'object') return routeResourceKey(name as EntityRef);\n } catch {}\n return null;\n}\n\n/** What a redirect from inside the entry means for it, if anything. */\nfunction absorbedRedirect(to: RouteDescriptor, entry: QuickEntry): 'close' | 'show' | null {\n if (typeof to !== 'object' || to === null) return null;\n if (canonicalOrNull(to.resource) !== canonicalOrNull(entry.resource)) return null;\n if (to.action === 'list') return 'close';\n if (to.action !== 'show' && to.action !== 'edit') return null;\n const id = (to.params as { readonly id?: unknown } | undefined)?.id;\n return id !== undefined && id !== null && String(id) === entry.recordId ? 'show' : null;\n}\n\n/** Closes the entry: the overlay at depth 1, the top entry (Back, unguarded) deeper. */\nfunction closeEntry(quick: QuickEntryValue, dismiss: (id: string) => void): void {\n if (quick.stack.entries.length > 1) quick.stack.pop();\n else dismiss(quick.presentationId);\n}\n\n/**\n * The entry's `<RecordScreen>`, claimed as the quick entry's own and given its `route`, inside a\n * nested dispatcher scope (spec 4.4 (3)): a redirect to the entry resource's list closes the entry\n * (a Delete), one to its own record returns to show, and any other passes to the page's\n * dispatcher (a guarded navigation, after which the pathname close applies). Edit's Save and\n * Cancel return to show — Cancel asking first when the form is dirty; create's Save settles the\n * row for `useQuick().create` and closes.\n */\nfunction QuickScreenOf({\n entry,\n route,\n recordId,\n}: {\n readonly entry: QuickEntry;\n readonly route: Row;\n /** The entry's id as the id field types it (show, edit): what the screen reads and writes with. */\n readonly recordId?: RecordId;\n}): ReactElement {\n const quick = useQuickEntry();\n const instance = useUIInstance();\n const runtime = useUIPresentationRuntime();\n const parentEffects = useDispatcherEffects();\n const latest = useRef({ entry, quick });\n latest.current = { entry, quick };\n const effects = useMemo<Partial<DispatcherEffects>>(\n () => ({\n redirect: (to) => {\n const { entry: current, quick: overlay } = latest.current;\n const absorbed = overlay === null ? null : absorbedRedirect(to, current);\n // Both ask first when a form in the overlay is dirty, as the route's guarded navigation\n // would (a confirmed Delete leaves a clean show, so it closes at once).\n if (overlay !== null && absorbed === 'close') {\n overlay.scope.request(() => closeEntry(overlay, (id) => runtime.dismiss(id)));\n return;\n }\n if (overlay !== null && absorbed === 'show') {\n overlay.scope.request(() => overlay.stack.replaceTop({ ...current, mode: 'show' }));\n return;\n }\n return parentEffects().redirect?.(to);\n },\n }),\n [runtime, parentEffects],\n );\n const toShow = () => quick?.stack.replaceTop({ ...entry, mode: 'show' });\n const callbacks =\n entry.mode === 'edit'\n ? {\n onSuccess: toShow,\n onCancel: () => quick?.scope.request(toShow),\n }\n : entry.mode === 'create'\n ? {\n onSuccess: (result: unknown) => {\n quick?.stack.settle(createdRow(result));\n runtime.dismiss(instance.id);\n },\n onCancel: () => instance.dismiss(),\n }\n : {};\n return (\n <DispatcherProvider effects={effects}>\n <RouteSourceContext.Provider value={route}>\n <QuickScreenClaimContext.Provider value={true}>\n <RecordScreen\n resource={entry.resource}\n mode={entry.mode}\n {...(recordId === undefined ? {} : { recordId })}\n {...(entry.defaults === undefined ? {} : { defaults: entry.defaults })}\n {...(entry.input === undefined ? {} : { input: entry.input })}\n {...callbacks}\n />\n </QuickScreenClaimContext.Provider>\n </RouteSourceContext.Provider>\n </DispatcherProvider>\n );\n}\n\n/** The row a create's write returned, as `useQuick().create` resolves it. */\nfunction createdRow(result: unknown): Readonly<Record<string, unknown>> | null {\n if (result === null || typeof result !== 'object') return null;\n const record = (result as { readonly record?: unknown }).record;\n if (record !== null && typeof record === 'object') return record as Row;\n return result as Row;\n}\n","'use client';\nimport { hasRecordPage, resolveResourceLabel, resourceShowHref } from '@burojs/core';\nimport {\n type QuickEntry,\n useApp,\n useI18nCaps,\n useOptionalT,\n useQuickEntry,\n useTestIds,\n useUIInstance,\n} from '@burojs/react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { IconArrowLeft, IconExternalLink, IconX } from '@tabler/icons-react';\nimport { type ReactElement, useContext } from 'react';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\nimport { resolveResourceTitle } from '../resource/resource-title.js';\nimport { OwnTitleContext } from '../ui-presentations/shell.js';\n\n/** The heading of an entry: its record title once read, \"Create <label>\" for a create. */\nexport function useEntryTitle(entry: QuickEntry): string {\n const app = useApp();\n const caps = useI18nCaps(entry.resource);\n const t = useOptionalT();\n if (entry.mode !== 'create') return entry.title ?? '';\n return resolveResourceTitle(caps, t, entry.resource, 'createTitle', {\n label: resolveResourceLabel(caps, entry.resource, 'single', app.registry.get(entry.resource)),\n });\n}\n\nconst HEADING_CLASS =\n 'min-w-0 flex-1 break-words text-lg font-semibold tracking-tight focus-visible:outline-hidden';\n\n/**\n * A quick overlay's header (spec 4.1, 4.12): Back to the previous entry when the sheet's history\n * is deeper than one, the record's title as the overlay's heading (`h2`, focusable by code), \"Open\n * as page\" when the record has a show page, and ✕ — which closes through the overlay's guarded\n * `dismiss()`.\n */\nexport function QuickHeader({\n entries,\n}: {\n readonly entries: readonly QuickEntry[];\n}): ReactElement {\n const entry = useQuickEntry();\n const instance = useUIInstance();\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n const RouterLink = useLinkComponent();\n const ownTitle = useContext(OwnTitleContext);\n const top = entries[entries.length - 1] as QuickEntry;\n const previous = entries.length > 1 ? entries[entries.length - 2] : undefined;\n const title = useEntryTitle(top);\n const def = app.registry.get(top.resource);\n const pageHref =\n top.mode !== 'create' &&\n top.recordId !== undefined &&\n def !== undefined &&\n hasRecordPage(def, 'show')\n ? resourceShowHref(app.registry, def, top.resource, top.recordId)\n : null;\n const heading = (\n <h2 tabIndex={-1} data-buro-overlay-heading=\"\" className={HEADING_CLASS}>\n {title}\n </h2>\n );\n return (\n <div data-buro-region=\"quick-header\" className=\"flex items-center gap-2 pr-1\">\n {previous === undefined || entry === null ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n data-testid={tid.quickBack()}\n aria-label={t('quick.back', {\n params: { title: previous.title ?? '' },\n defaultValue: 'Back to {{title}}',\n })}\n onClick={() => entry.scope.request(() => entry.stack.pop())}\n >\n <IconArrowLeft className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n )}\n {/* Inside the kit's own shells the heading is the Radix title the overlay is labelled by;\n an app's host (not necessarily a Radix dialog) gets a plain heading. */}\n {ownTitle ? <DialogPrimitive.Title asChild>{heading}</DialogPrimitive.Title> : heading}\n {pageHref === null ? null : (\n <RouterLink\n href={pageHref}\n data-testid={tid.quickOpenPage()}\n className=\"inline-flex shrink-0 items-center gap-1 rounded px-2 py-1 text-sm text-muted-foreground hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <IconExternalLink className=\"h-4 w-4\" aria-hidden=\"true\" />\n <span>{t('quick.openAsPage', { defaultValue: 'Open as page' })}</span>\n </RouterLink>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n data-testid={tid.quickClose()}\n aria-label={t('quick.close', { defaultValue: 'Close' })}\n onClick={() => instance.dismiss()}\n >\n <IconX className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n </div>\n );\n}\n","'use client';\nimport {\n type QuickEntry,\n QuickEntryContext,\n type QuickScreenProps,\n useQuickEntryValue,\n useTestIds,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useRef, useSyncExternalStore } from 'react';\nimport { QuickBody } from './quick-body.js';\nimport { QuickHeader, useEntryTitle } from './quick-header.js';\n\n/** One identity per entry position, kept when the entry is only named (`nameTop`). */\nfunction entryKey(entry: QuickEntry, depth: number): string {\n return JSON.stringify([depth, entry.resource, entry.mode, entry.recordId ?? null]);\n}\n\n/**\n * The UI kit's quick screen (`presentationHosts.screens.quick`, presented under `buro:quick`):\n * a record's route screen in a sheet or a dialog (spec 4.1, 4.4, 4.9). It renders the header and\n * the stack's top entry — only the top is mounted; Back remounts the previous one — and provides\n * the overlay to everything inside it (`useQuickEntry`), so an opener there pushes into this sheet\n * or closes this dialog, and a form there asks through this overlay's dismiss scope.\n */\nexport function QuickScreen({ stack }: QuickScreenProps): ReactElement {\n const entries = useSyncExternalStore(stack.subscribe, stack.getSnapshot, stack.getSnapshot);\n const value = useQuickEntryValue(stack);\n const tid = useTestIds();\n const top = entries[entries.length - 1] as QuickEntry;\n const key = entryKey(top, entries.length);\n const title = useEntryTitle(top);\n // A push or Back (spec 4.12): focus moves to the new heading, and a polite live region says the\n // new title once it is known. Not on open, where the host focuses the heading itself.\n const root = useRef<HTMLDivElement>(null);\n const firstKey = useRef(key);\n // Once the history moved, every later entry (Back to the first one included) is announced.\n const moved = useRef(false);\n if (key !== firstKey.current) moved.current = true;\n const navigated = moved.current;\n // biome-ignore lint/correctness/useExhaustiveDependencies: runs on every entry change\n useEffect(() => {\n if (!moved.current) return;\n root.current?.querySelector<HTMLElement>('[data-buro-overlay-heading]')?.focus();\n }, [key]);\n return (\n <QuickEntryContext.Provider value={value}>\n <div\n ref={root}\n data-testid={tid.quickSheet(top.resource, top.recordId)}\n data-buro-quick-host={value.host}\n data-buro-quick-depth={entries.length}\n className=\"flex min-h-0 flex-1 flex-col gap-4\"\n >\n <QuickHeader entries={entries} />\n <div role=\"status\" aria-live=\"polite\" className=\"sr-only\" data-buro-quick-announce=\"\">\n {navigated ? title : ''}\n </div>\n <div className=\"-mx-1 min-h-0 flex-1 overflow-y-auto px-1\">\n <QuickBody key={key} entry={top} />\n </div>\n </div>\n </QuickEntryContext.Provider>\n );\n}\n","import { humanizeKey } from '@burojs/core';\nimport { useMemo, type ComponentType } from 'react';\nimport type { PresentationCopy } from './shell.js';\n\n/**\n * Best-effort label for a presented component when the caller didn't supply\n * `options.title`: the component's `displayName`/`name` (as assigned at its\n * declaration or, for an object-literal entry like `{ Body: () => ... }`,\n * inferred by the engine from the property key), humanized the same way a\n * missing field/resource label falls back elsewhere in the framework.\n */\nfunction componentLabel(component: ComponentType<Record<string, unknown>>): string {\n const named = component as { readonly displayName?: string; readonly name?: string };\n const humanized = humanizeKey(named.displayName ?? named.name ?? '');\n return humanized.length > 0 ? humanized : 'Presentation';\n}\n\n/**\n * Resolves presentation chrome copy directly from the descriptor's portable\n * `options` — no content-key/i18n indirection. `options.title` /\n * `options.description` win when present (and are non-empty strings);\n * otherwise the title falls back to a humanized component label and the\n * description is simply omitted.\n */\nexport function usePresentationCopy(\n options: Readonly<Record<string, unknown>>,\n component: ComponentType<Record<string, unknown>>,\n): PresentationCopy {\n return useMemo(() => {\n const title =\n typeof options.title === 'string' && options.title.length > 0\n ? options.title\n : componentLabel(component);\n const description = typeof options.description === 'string' ? options.description : undefined;\n return description === undefined\n ? Object.freeze({ title })\n : Object.freeze({ title, description });\n }, [options, component]);\n}\n\n/** Whether the shell renders its own title/description/close chrome. Defaults to true. */\nexport function wrapperEnabled(options: Readonly<Record<string, unknown>>): boolean {\n return options.wrapper !== false;\n}\n","import {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { usePresentationCopy, wrapperEnabled } from './copy.js';\nimport { DialogPresentationShell } from './shell.js';\n\n/**\n * Concrete `dialog` host for `BuroProvider`'s `presentationHosts` prop:\n * renders the already-resolved `component` (from `<UIPresentations/>`'s\n * registry lookup) inside a centered Radix dialog. Dismissal comes from the\n * `UIInstance` the framework wraps this host's subtree with, not from a\n * prop — `component`/`props`/`options` is the entire host contract.\n */\nexport function DialogPresentationHost({\n component: Component,\n props,\n options,\n}: UIPresentationHostProps): ReactElement {\n const instance = useUIInstance();\n return (\n <DialogPresentationShell\n dismiss={instance.dismiss}\n wrapper={wrapperEnabled(options)}\n ownTitle={options.ownTitle === true}\n copy={usePresentationCopy(options, Component)}\n >\n <Component {...props} />\n </DialogPresentationShell>\n );\n}\n\n/**\n * Must list exactly the keys this host actually reads, via `copy.ts`'s\n * `usePresentationCopy` (`title`, `description`), `wrapperEnabled`\n * (`wrapper`) and the shell's `ownTitle` — no more. Do not add a key here without first adding the\n * reader in `copy.ts` (or this host) that consumes it.\n */\nDialogPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n description: 'string',\n wrapper: 'boolean',\n ownTitle: 'boolean',\n}) satisfies UIPresentationOptionsSchema;\n","'use client';\nimport {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Popover, PopoverAnchor, PopoverContent } from '../primitives/popover.js';\nimport { PeekHostContext, type PeekHostValue } from '../quick/peek-context.js';\n\n/** How long the pointer may be off both the anchor and the popover before it closes. */\nexport const POPOVER_LEAVE_GRACE_MS = 150;\n\n/** The anchor's element when it is one in a document; anything else presents nothing. */\nfunction anchorElement(anchor: UIPresentationHostProps['anchor']): HTMLElement | null {\n const element = anchor?.element;\n return typeof HTMLElement !== 'undefined' && element instanceof HTMLElement ? element : null;\n}\n\n/**\n * Concrete `popover` host for `BuroProvider`'s `presentationHosts` prop (spec 4.1, 4.12): a\n * non-modal Radix popover positioned against the request's `anchor.element`. Focus stays on the\n * anchor (nothing is focused on open, nothing is restored on close); the content is a\n * `role=\"dialog\"` named by the presented screen. It closes through the guarded `dismiss()` on\n * Escape, on a pointer down outside it, when focus moves elsewhere, when the pointer has been off\n * both the anchor and the popover for {@link POPOVER_LEAVE_GRACE_MS}, and when the anchor leaves\n * the document.\n */\nexport function PopoverPresentationHost({\n component: Component,\n props,\n options,\n anchor,\n}: UIPresentationHostProps): ReactElement | null {\n const instance = useUIInstance();\n const element = anchorElement(anchor);\n const [label, setLabel] = useState(() =>\n typeof options.title === 'string' ? options.title : (element?.textContent ?? ''),\n );\n const grace = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hold = useCallback(() => {\n if (grace.current === null) return;\n clearTimeout(grace.current);\n grace.current = null;\n }, []);\n const release = useCallback(() => {\n if (grace.current !== null) return;\n grace.current = setTimeout(() => {\n grace.current = null;\n instance.dismiss();\n }, POPOVER_LEAVE_GRACE_MS);\n }, [instance]);\n useEffect(() => hold, [hold]);\n\n useEffect(() => {\n if (element === null || !element.isConnected) {\n instance.dismiss();\n return;\n }\n element.addEventListener('pointerenter', hold);\n element.addEventListener('pointerleave', release);\n // The anchor unmounted (its row re-rendered away, the page changed): the peek goes with it.\n const observer = new MutationObserver(() => {\n if (!element.isConnected) instance.dismiss();\n });\n observer.observe(element.ownerDocument, { childList: true, subtree: true });\n return () => {\n element.removeEventListener('pointerenter', hold);\n element.removeEventListener('pointerleave', release);\n observer.disconnect();\n };\n }, [element, instance, hold, release]);\n\n const virtualRef = useMemo(() => ({ current: element }), [element]);\n const host = useMemo<PeekHostValue>(() => ({ anchor: element, setLabel }), [element]);\n if (element === null) return null;\n return (\n <Popover\n open\n onOpenChange={(open) => {\n if (!open) instance.dismiss();\n }}\n >\n <PopoverAnchor virtualRef={virtualRef as { current: HTMLElement }} />\n <PopoverContent\n role=\"dialog\"\n aria-label={label}\n data-buro-popover=\"\"\n className=\"motion-reduce:animate-none motion-reduce:transition-none\"\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onPointerEnter={hold}\n onPointerLeave={release}\n >\n <PeekHostContext.Provider value={host}>\n <Component {...props} />\n </PeekHostContext.Provider>\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The one option this host reads: the popover's initial accessible name. */\nPopoverPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n}) satisfies UIPresentationOptionsSchema;\n","import {\n useUIInstance,\n type UIPresentationHostProps,\n type UIPresentationOptionsSchema,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { usePresentationCopy, wrapperEnabled } from './copy.js';\nimport { SheetPresentationShell } from './shell.js';\n\n/** Concrete `sheet` host for `BuroProvider`'s `presentationHosts` prop; see `DialogPresentationHost`. */\nexport function SheetPresentationHost({\n component: Component,\n props,\n options,\n}: UIPresentationHostProps): ReactElement {\n const instance = useUIInstance();\n return (\n <SheetPresentationShell\n dismiss={instance.dismiss}\n wrapper={wrapperEnabled(options)}\n ownTitle={options.ownTitle === true}\n copy={usePresentationCopy(options, Component)}\n >\n <Component {...props} />\n </SheetPresentationShell>\n );\n}\n\n/**\n * Must list exactly the keys this host actually reads, via `copy.ts`'s\n * `usePresentationCopy` (`title`, `description`), `wrapperEnabled`\n * (`wrapper`) and the shell's `ownTitle` — no more. Identical to `DialogPresentationHost.optionsSchema`\n * because both hosts read the same helpers; if `sheet` ever grows its own\n * option (e.g. `side`), the schema diverges then, not pre-emptively.\n */\nSheetPresentationHost.optionsSchema = Object.freeze({\n title: 'string',\n description: 'string',\n wrapper: 'boolean',\n ownTitle: 'boolean',\n}) satisfies UIPresentationOptionsSchema;\n","import type { FlowScreenProps, UIPresentationHosts } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { IconLoader2 } from '@tabler/icons-react';\nimport { OwnTitleHeading } from '../flows/overlay-heading.js';\nimport { FlowBoundary, FlowLoadFailed, loadFlowScreen, useLoaded } from '../flows/load-runtime.js';\nimport { BlockScreen } from './block-screen.js';\nimport { PeekScreen } from '../quick/peek-screen.js';\nimport { QuickScreen } from '../quick/quick-screen.js';\nimport { DialogPresentationHost } from './dialog-host.js';\nimport { PopoverPresentationHost } from './popover-host.js';\nimport { SheetPresentationHost } from './sheet-host.js';\n\n/**\n * `screens.flow`: the flow host screen, loaded when a flow first opens (plan ruling 8: only the\n * flow's button is in the initial chunk). A screen that failed to load or to render says so in\n * its host, with Retry and Close; nothing outside the host is affected (P4-C review C1).\n */\nfunction FlowScreen(props: FlowScreenProps): ReactElement | null {\n const loaded = useLoaded(loadFlowScreen);\n if (loaded.error !== undefined)\n return <FlowLoadFailed label={props.label} onRetry={loaded.retry} />;\n if (loaded.module === undefined) {\n return (\n <div data-buro-flow-step=\"loading\" aria-busy=\"true\" className=\"flex flex-col gap-4\">\n <OwnTitleHeading label={props.label} />\n <IconLoader2 className=\"h-5 w-5 animate-spin self-center\" aria-hidden=\"true\" />\n </div>\n );\n }\n const Screen = loaded.module.FlowScreen;\n return (\n <FlowBoundary\n fallback={(_error, reset) => <FlowLoadFailed label={props.label} onRetry={reset} />}\n >\n <Screen {...props} />\n </FlowBoundary>\n );\n}\n\nexport { DialogPresentationHost } from './dialog-host.js';\nexport { PopoverPresentationHost } from './popover-host.js';\nexport { SheetPresentationHost } from './sheet-host.js';\nexport { DialogPresentationShell, SheetPresentationShell, type PresentationCopy } from './shell.js';\nexport { usePresentationCopy, wrapperEnabled } from './copy.js';\n\n/**\n * Concrete dialog/sheet/popover hosts for `BuroProvider`'s `presentationHosts`\n * prop, keyed by `UIPresentationDescriptor['host']`, and the kit's overlay\n * screens (`screens.quick`: a record's quick entry; `screens.peek`: the hover\n * preview of a relation display's record; `screens.flow`: a flow's host,\n * loaded on first use). Pass this straight through:\n * `<BuroProvider presentationHosts={shadcnPresentationHosts} .../>`; an app\n * with hosts of its own keeps quick entries and flows by spreading\n * `shadcnPresentationHosts.screens` into them.\n */\nexport const shadcnPresentationHosts: UIPresentationHosts = Object.freeze({\n dialog: DialogPresentationHost,\n sheet: SheetPresentationHost,\n popover: PopoverPresentationHost,\n screens: Object.freeze({\n quick: QuickScreen,\n peek: PeekScreen,\n flow: FlowScreen,\n block: BlockScreen,\n }),\n});\n","'use client';\n\nimport * as React from 'react';\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport { Slot } from '@radix-ui/react-slot';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\nimport { cn } from '../lib/cn.js';\nimport { Label } from './label.js';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({ ...props }: ControllerProps<TFieldValues, TName>) {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n}\n\nfunction useFormField() {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n}\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nexport type FormItemProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn('space-y-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = 'FormItem';\n\nexport type FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;\n\nconst FormLabel = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, FormLabelProps>(\n ({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n ref={ref}\n className={cn(error && 'text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n },\n);\nFormLabel.displayName = 'FormLabel';\n\nexport type FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;\n\nconst FormControl = React.forwardRef<React.ElementRef<typeof Slot>, FormControlProps>(\n ({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n },\n);\nFormControl.displayName = 'FormControl';\n\nexport type FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\nFormDescription.displayName = 'FormDescription';\n\nexport type FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, FormMessageProps>(\n ({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn('text-sm font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n );\n },\n);\nFormMessage.displayName = 'FormMessage';\n\nexport {\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n useFormField,\n};\n","'use client';\n\nimport type * as React from 'react';\nimport { cn } from '../lib/cn.js';\n\n/**\n * A determinate or INDETERMINATE progress bar.\n *\n * Hand-written rather than pulled from the shadcn registry, for one reason\n * that decides the whole component: the registry's `Progress` is a thin wrapper\n * over `@radix-ui/react-progress`, which this package does not depend on, and\n * adding a Radix dependency to render one filled `<div>` buys nothing here —\n * the primitive has no focus management, no portal, no keyboard behaviour and\n * no controlled/uncontrolled state. What it does have is the ARIA contract,\n * which is written out below rather than inherited.\n *\n * **`value === undefined` is a state, not a zero.** A run whose total is not\n * known yet (a paginated job before its first count, a stream with no length)\n * is *indeterminate*: the bar animates and reports NO `aria-valuenow` at all,\n * which is exactly what the ARIA spec asks for and what a screen reader needs\n * in order to say \"busy\" instead of \"0 percent\". Rendering it as 0% would be a\n * measurement nobody took.\n */\nexport interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** Units done. `undefined` renders an indeterminate bar. */\n readonly value?: number;\n /** Units in total. Defaults to 1, i.e. `value` is read as a fraction in `[0, 1]`. */\n readonly max?: number;\n /** Accessible name. A bar with no name is announced as an anonymous busy region. */\n readonly label?: string;\n}\n\nexport function Progress({\n value,\n max = 1,\n label,\n className,\n ...props\n}: ProgressProps): React.ReactElement {\n const determinate = value !== undefined && max > 0;\n const fraction = determinate ? Math.min(1, Math.max(0, (value as number) / max)) : undefined;\n\n return (\n <div\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={determinate ? 0 : undefined}\n aria-valuemax={determinate ? max : undefined}\n aria-valuenow={determinate ? value : undefined}\n data-state={determinate ? 'determinate' : 'indeterminate'}\n className={cn('h-2 w-full overflow-hidden rounded-full bg-secondary', className)}\n {...props}\n >\n <div\n // `transition-[width]` and not `transition-all`: the bar's own width is\n // the only thing that should ease. Under `transition-all` the colour\n // change on a terminal state eased too, which read as the bar fading\n // rather than finishing.\n className={cn(\n 'h-full rounded-full bg-primary transition-[width] duration-300 ease-out',\n !determinate && 'w-1/3 animate-pulse',\n )}\n style={determinate ? { width: `${(fraction as number) * 100}%` } : undefined}\n />\n </div>\n );\n}\n","'use client';\nimport { type TaskRunReport, taskRunFraction, taskRunOutcome } from '@burojs/core';\nimport { useOptionalT, useTestIds } from '@burojs/react';\nimport type * as React from 'react';\nimport { Progress } from '../primitives/progress.js';\n\nexport interface TaskRunPanelProps {\n /**\n * The run's own name — `'stock'`, `'import'`, `'ship-selected'`. Not a\n * resource: a long server-side operation has no record and a bulk run spans a\n * selection, so a resource-keyed id could not address either.\n */\n readonly name: string;\n readonly report: TaskRunReport;\n /** Shown above the bar. The app names the work; this component never guesses it. */\n readonly title?: string;\n readonly className?: string;\n}\n\n/**\n * WHAT AN OPERATOR SEES WHILE SOMETHING LONG IS HAPPENING, AND AFTERWARDS.\n *\n * Four things, and each of them is a fact the framework had no way to show\n * before:\n *\n * - **how far it has got** — a determinate bar when the total is known, an\n * indeterminate one when it is not (see `<Progress>` for why those are\n * different renderings rather than one with a zero in it);\n * - **which unit is in flight** — \"aggregate-items\", not a spinner;\n * - **what did not make it** — every {@link TaskRunFailure}, by subject and\n * code, whether the run carried on past it or stopped there;\n * - **that a run which stopped part-way still did part of the work** — the\n * counts stay on screen after a failure, because \"it failed\" and \"it failed\n * after doing 2 of 3\" lead to different next actions.\n *\n * `data-state` on the root is the machine-readable outcome, so a test never has\n * to match translated prose — the device `<LanguageSwitch>` already uses for\n * the active locale.\n *\n * **Nothing here knows what the work is.** No poll, no selection, no resource,\n * no operation name: the panel renders a {@link TaskRunReport} and a report is\n * produced identically by `useTaskRun` driving an RPC poll and by a loop over\n * selected rows.\n */\nexport function TaskRunPanel({\n name,\n report,\n title,\n className,\n}: TaskRunPanelProps): React.ReactElement {\n const t = useOptionalT();\n const tid = useTestIds();\n const outcome = taskRunOutcome(report);\n const fraction = taskRunFraction(report);\n\n const statusText =\n outcome === 'running'\n ? t('taskRun.running', { defaultValue: 'Running' })\n : outcome === 'complete'\n ? t('taskRun.complete', { defaultValue: 'Finished' })\n : outcome === 'partial'\n ? t('taskRun.partial', { defaultValue: 'Finished, with refusals' })\n : outcome === 'stopped'\n ? t('taskRun.stopped', { defaultValue: 'Stopped' })\n : outcome === 'cancelled'\n ? t('taskRun.cancelled', { defaultValue: 'Cancelled' })\n : t('taskRun.idle', { defaultValue: 'Not started' });\n\n return (\n <div\n data-testid={tid.taskRun(name)}\n data-state={report.state}\n data-outcome={outcome}\n // `role=\"status\"` and not `alert`: this is an ongoing report, and an\n // assertive live region would interrupt a screen-reader user on every\n // single step of a run they asked for.\n role=\"status\"\n aria-live=\"polite\"\n className={className ?? 'space-y-3 rounded-md border p-4'}\n >\n <div className=\"flex items-baseline justify-between gap-4\">\n <span className=\"text-sm font-medium\">{title ?? statusText}</span>\n <span className=\"text-sm text-muted-foreground\">\n {report.total === undefined\n ? t('taskRun.countUnknownTotal', {\n params: { completed: report.completed },\n defaultValue: '{{completed}} done',\n })\n : t('taskRun.count', {\n params: { completed: report.completed, total: report.total },\n defaultValue: '{{completed}} of {{total}}',\n })}\n </span>\n </div>\n\n <Progress\n data-testid={tid.taskRunProgress(name)}\n value={fraction === undefined ? undefined : report.completed}\n max={report.total ?? 1}\n label={title ?? statusText}\n />\n\n <div className=\"flex items-baseline justify-between gap-4 text-sm\">\n <span data-testid={`${tid.taskRun(name)}:status`}>{statusText}</span>\n {report.unit !== undefined && (\n <span className=\"text-muted-foreground\" data-testid={`${tid.taskRun(name)}:unit`}>\n {report.unit}\n </span>\n )}\n </div>\n\n {/*\n One list, both kinds. A unit refused mid-run and the failure that ended\n the run are the same thing to a reader — \"this did not happen, and here\n is which one\" — and the report keeps them apart (`failures` vs `error`)\n so a caller can act on the difference. The run-ending one is rendered\n first and marked, because it is the one that explains why the later\n units are missing entirely.\n */}\n {(report.error !== undefined || report.failures.length > 0) && (\n <ul className=\"space-y-1 text-sm\">\n {[\n ...(report.error === undefined ? [] : [{ failure: report.error, stopped: true }]),\n ...report.failures.map((failure) => ({ failure, stopped: false })),\n ].map(({ failure, stopped }) => (\n <li\n key={`${failure.subject}:${failure.code}`}\n data-testid={tid.taskRunFailure(name, failure.subject)}\n data-stopped={stopped ? 'true' : 'false'}\n className=\"text-destructive\"\n >\n <span className=\"font-medium\">{failure.subject}</span>\n {' — '}\n <span>{failure.message ?? failure.code}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n","/**\n * Canonical spacing scale used throughout the Buro playground /\n * framework UI. All spacing tokens (`p-*`, `gap-*`, `space-y-*`,\n * `mx-*`, etc.) should resolve to one of these values.\n *\n * Tailwind utility-class numbers map to pixel values via the default\n * `0.25rem`-step base:\n *\n * class | px | role\n * ------|------|--------------------------------------------------\n * 1 | 4px | xs — divider margins, micro-gaps, half-step compounds\n * 2 | 8px | sm — default button padding-y, sibling gap\n * 3 | 12px | md — list-item padding-y, dl row gap-y\n * 4 | 16px | lg — Card content gap, form field gap, page section gap\n * 6 | 24px | xl — Card padding (CardContent p-6), page section gap-y\n *\n * The framework uses {1, 2, 3, 4, 6} as the primary scale. Anything\n * else (a `gap-5`, `p-7`, `mx-9`) means a contributor diverged from\n * the system; reach for the nearest scale value or call it out\n * explicitly in a code comment.\n *\n * **Half-step tokens** — `1.5` (6px), `0.5` (2px) are acceptable\n * shadcn idioms for tight inline elements: `<Button py-1.5>`,\n * `<CommandItem py-1.5>`, divider `mx-0.5`. They preserve the\n * 4/8/12/16/24 rhythm at a finer grain inside controls.\n *\n * **Prominent vertical** — empty-state padding (`py-16` = 64px) is a\n * deliberate exception in `<ResourceList>`'s empty/error panels to\n * give the call-to-action room to breathe. Do NOT generalize this\n * scale beyond those two sites.\n *\n * Adopters can re-export their own scale on top of this module — the\n * exports are pure numbers (Tailwind class numbers), no runtime cost.\n */\nexport const spacing = {\n /** 4px — divider margins, micro-gaps. */\n xs: 1,\n /** 8px — default button padding-y, gap between buttons. */\n sm: 2,\n /** 12px — list-item padding-y, dl row gap-y. */\n md: 3,\n /** 16px — Card content gap, form field gap. */\n lg: 4,\n /** 24px — Card padding (CardContent p-6), section gap-y. */\n xl: 6,\n} as const;\n\nexport type SpacingKey = keyof typeof spacing;\n","'use client';\nimport { useLocale, useOptionalDataRuntime, useOptionalT } from '@burojs/react';\nimport { type ReactElement, type ReactNode, useMemo } from 'react';\nimport { CommandPalette } from '../layout/command-palette.js';\nimport {\n type ActionItem,\n CommandPaletteActionsGroup,\n} from '../layout/command-palette-actions-group.js';\nimport { CommandPaletteCreateGroup } from '../layout/command-palette-create-group.js';\nimport { CommandPaletteDocsGroup } from '../layout/command-palette-docs-group.js';\nimport { CommandPaletteNavigationGroups } from '../layout/command-palette-navigation-groups.js';\nimport { CommandPaletteRecentGroup } from '../layout/command-palette-recent-group.js';\nimport { CommandPaletteRecordsGroup } from '../layout/command-palette-records-group.js';\nimport { useLanguagePaletteActions } from './language-submenu.js';\nimport { useThemePaletteActions } from './theme-controls.js';\nimport { useCurrentUser } from './use-current-user.js';\nimport { useShellWaiting } from './use-shell-waiting.js';\n\nexport interface DefaultCommandPaletteProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Appended to the Actions group after theme, language and sign out. */\n actions?: ActionItem[];\n /** Replaces every group. The dialog, input, empty state and footer stay. */\n children?: ReactNode;\n}\n\nconst groupTestId = (role: string, id: string): string => `command-palette:${role}:${id}`;\n\n/**\n * The palette `AppShell` mounts by default: Docs, Recent, Records, Navigation, Create and\n * Actions, in that order. Records needs a data runtime and is left out without one. Actions are the theme choices, the languages (only with more than\n * one locale), \"Sign out\" (only when someone is signed in) and then `actions`.\n */\nexport function DefaultCommandPalette({\n open,\n onOpenChange,\n actions,\n children,\n}: DefaultCommandPaletteProps): ReactElement {\n const t = useOptionalT();\n const waiting = useShellWaiting();\n const locale = useLocale();\n // Record search queries through the data runtime; without one the group is left out.\n const canSearchRecords = useOptionalDataRuntime() !== null;\n const close = (): void => onOpenChange(false);\n const themeActions = useThemePaletteActions();\n const languageActions = useLanguagePaletteActions();\n const { user, signOut } = useCurrentUser();\n const signedIn = user !== null;\n const signOutLabel = t('auth.signOut', { defaultValue: 'Sign out' });\n const allActions = useMemo<ActionItem[]>(\n () => [\n ...themeActions,\n ...languageActions,\n ...(signedIn\n ? [\n {\n id: 'sign-out',\n label: signOutLabel,\n keywords: 'sign out logout log out',\n onRun: async () => {\n await signOut();\n },\n },\n ]\n : []),\n ...(actions ?? []),\n ],\n [themeActions, languageActions, signedIn, signOutLabel, signOut, actions],\n );\n\n return (\n <CommandPalette\n open={open}\n onOpenChange={onOpenChange}\n placeholder={t('commandPalette.searchEverything', {\n defaultValue: 'Search resources, pages, records, actions…',\n })}\n getTestId={(role) => `command-palette:${role}`}\n >\n {children !== undefined ? (\n children\n ) : (\n <>\n <CommandPaletteDocsGroup locale={locale} onSelect={close} />\n {/* `refreshKey={open}`: the recent list is read at render; reopening must re-read it. */}\n {/* The groups the permission map decides stay out while it loads (D6). */}\n {waiting ? null : (\n <CommandPaletteRecentGroup onSelect={close} refreshKey={open} getTestId={groupTestId} />\n )}\n {/* `enabled={open}`: no per-resource search queries while the dialog is closed. */}\n {canSearchRecords && !waiting ? (\n <CommandPaletteRecordsGroup enabled={open} onSelect={close} getTestId={groupTestId} />\n ) : null}\n {waiting ? null : (\n <CommandPaletteNavigationGroups\n onSelect={close}\n getTestId={(role, id) => `command-palette:nav:${role}:${id}`}\n />\n )}\n {waiting ? null : <CommandPaletteCreateGroup onSelect={close} getTestId={groupTestId} />}\n <CommandPaletteActionsGroup\n onSelect={close}\n getTestId={groupTestId}\n actions={allActions}\n />\n </>\n )}\n </CommandPalette>\n );\n}\n","'use client';\nimport { useCommandPalette } from '@burojs/react';\nimport { useGlobalShortcut } from '@burojs/react/web';\nimport { type ReactElement, type ReactNode, useMemo, useRef } from 'react';\nimport { AppHeader } from '../layout/app-header.js';\nimport { AppLayout } from '../layout/app-layout.js';\nimport { AppSidebar } from '../layout/app-sidebar.js';\nimport { NavChrome } from '../layout/nav-chrome.js';\nimport { RecordState } from '../record/record-state.js';\nimport { DefaultCommandPalette } from './default-command-palette.js';\nimport {\n type PaletteState,\n type ShellBrand,\n ShellProvider,\n type ShellUserMapper,\n} from './shell-context.js';\nimport { fill, type Slot } from './slot.js';\nimport { useShellWaiting } from './use-shell-waiting.js';\n\n/** Every slot follows {@link Slot}: omit for the default, `false` for nothing, an element to replace. */\nexport interface AppShellProps {\n /** Read by `SidebarBrand`, `AuthPage` and the document title. */\n brand: ShellBrand;\n /** Maps the auth provider's identity to what the user menu shows. Default: `defaultUserMapper`. */\n user?: ShellUserMapper;\n /** Where sign-out and \"Sign in\" go. Default `'/login'`. */\n loginPath?: string;\n /** Default `<AppSidebar />`. `false` gives a header-only layout with no sidebar trigger. */\n sidebar?: Slot;\n /** Default `<AppHeader />`. */\n header?: Slot;\n /**\n * Default `<DefaultCommandPalette />`. `false` removes the palette, the ⌘K / Ctrl+K shortcut\n * and the header's search chip. A custom element receives no props: it reads `open` and\n * `setOpen` from `usePaletteState()`.\n */\n palette?: Slot;\n /** Passed to `AppLayout`, typically `<DocPanel />`. */\n docPanel?: ReactNode;\n /**\n * Default `true`: `children` render inside `<NavChrome>`, the secondary sidebar and tabs of\n * the active navigation group chain, mounted once here so it keeps its DOM node while the\n * user moves within an area. `false` renders `children` bare, for an app that places\n * `<NavChrome>` itself (also the way to pass it `entryFilter` or `icons`).\n */\n navChrome?: boolean;\n children: ReactNode;\n}\n\n/**\n * `AppLayout` with the default sidebar, header and command palette, the area chrome\n * (`<NavChrome>`) around its children (while the permission map loads they are replaced by one\n * loading status, and the sidebar's nav items by a skeleton), and the brand and user context they read. Renders inside\n * `BuroProvider`, a `RouterAdapter` and a `LinkComponentProvider`; it does not boot the runtime,\n * own routes or guard auth.\n */\nexport function AppShell({\n brand,\n user,\n loginPath,\n sidebar,\n header,\n palette,\n docPanel,\n navChrome,\n children,\n}: AppShellProps): ReactElement {\n const enabled = palette !== false;\n const waiting = useShellWaiting();\n // The children wait only for the map's FIRST decision. A map that goes back to `loading` later\n // (a sign-in attempt, a company switch) leaves the mounted page in place, its state with it: its\n // gates are undecided and draw their reserved busy states until the map is decided again.\n const decidedOnce = useRef(false);\n if (!waiting) decidedOnce.current = true;\n const holding = waiting && !decidedOnce.current;\n const { open, setOpen, toggle } = useCommandPalette();\n useGlobalShortcut({ key: 'k', mod: true }, toggle, { enabled });\n const paletteState = useMemo<PaletteState>(() => ({ open, setOpen }), [open, setOpen]);\n const paletteNode = fill(palette, () => (\n <DefaultCommandPalette open={open} onOpenChange={setOpen} />\n ));\n return (\n <ShellProvider\n brand={brand}\n {...(user !== undefined ? { mapUser: user } : {})}\n {...(loginPath !== undefined ? { loginPath } : {})}\n {...(enabled ? { palette: paletteState } : {})}\n >\n <AppLayout\n sidebar={fill(sidebar, () => <AppSidebar />)}\n header={fill(header, () => <AppHeader />)}\n {...(docPanel !== undefined ? { docPanel } : {})}\n >\n {/* Until the permission map is first decided nothing mounts: no route judges access it cannot know. */}\n {holding ? (\n <RecordState state=\"loading\" />\n ) : navChrome === false ? (\n children\n ) : (\n <NavChrome>{children}</NavChrome>\n )}\n </AppLayout>\n {paletteNode}\n </ShellProvider>\n );\n}\n","'use client';\nimport { useOptionalT } from '@burojs/react';\nimport { IconCheck, IconLoader2, IconSelector } from '@tabler/icons-react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useState } from 'react';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../primitives/dropdown-menu.js';\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useOptionalSidebar,\n} from '../primitives/sidebar.js';\nimport { BrandTile } from './brand-tile.js';\n\nexport interface ScopeOption {\n value: string;\n label: string;\n description?: string;\n icon?: ReactNode;\n}\n\nexport interface ScopeSwitcherProps {\n options: readonly ScopeOption[];\n value: string | null;\n /** A rejection is swallowed here and leaves the value unchanged; the caller reports the error. */\n onChange: (value: string) => void | Promise<void>;\n /** Dropdown heading, e.g. \"Tenant\". */\n label?: string;\n /** Rows rendered after a separator, e.g. an \"Administration\" item. */\n extra?: ReactNode;\n /** Shown when `value` is null. */\n placeholder?: string;\n}\n\n/** A sidebar-header picker for the current tenant, workspace or other scope. */\nexport function ScopeSwitcher({\n options,\n value,\n onChange,\n label,\n extra,\n placeholder,\n}: ScopeSwitcherProps): ReactElement {\n const t = useOptionalT();\n const sidebar = useOptionalSidebar();\n const [pending, setPending] = useState(false);\n const current = options.find((o) => o.value === value);\n const text =\n current?.label ?? placeholder ?? t('shell.scopePlaceholder', { defaultValue: 'Select…' });\n // The accessible name carries the visible text too (WCAG 2.5.3, label in name), so a speech\n // user can say what they see and a screen reader announces the current scope.\n const ariaLabel = `${label ?? t('shell.scopeSwitcher', { defaultValue: 'Switch' })}: ${text}`;\n\n const select = (next: string) => {\n if (pending || next === value) return;\n setPending(true);\n void (async () => {\n try {\n await onChange(next);\n } catch {\n // The caller owns error reporting; the value stays as it was.\n } finally {\n setPending(false);\n }\n })();\n };\n\n const rowContent = (\n <>\n <BrandTile>\n {pending ? (\n <IconLoader2 className=\"size-4 animate-spin\" aria-hidden=\"true\" />\n ) : (\n (current?.icon ?? Array.from(current?.label ?? '')[0]?.toUpperCase())\n )}\n </BrandTile>\n <div className=\"grid flex-1 text-left group-data-[collapsible=icon]:hidden text-sm leading-tight\">\n <span className=\"truncate font-medium\">{text}</span>\n {current?.description !== undefined && (\n <span className=\"truncate text-xs\">{current.description}</span>\n )}\n </div>\n <IconSelector className=\"ml-auto size-4\" aria-hidden=\"true\" />\n </>\n );\n\n const content = (\n <DropdownMenuContent\n data-testid=\"scope-switcher:menu\"\n className=\"w-[var(--radix-dropdown-menu-trigger-width)] min-w-56 rounded-lg\"\n side={sidebar?.isMobile === false ? 'right' : 'bottom'}\n align=\"start\"\n sideOffset={4}\n >\n {label !== undefined && <DropdownMenuLabel>{label}</DropdownMenuLabel>}\n {options.map((o) => (\n <DropdownMenuItem\n key={o.value}\n data-testid={`scope-switcher:option:${o.value}`}\n onSelect={() => select(o.value)}\n >\n {o.icon}\n <div className=\"grid flex-1 leading-tight\">\n <span className=\"truncate\">{o.label}</span>\n {o.description !== undefined && (\n <span className=\"truncate text-xs text-muted-foreground\">{o.description}</span>\n )}\n </div>\n {o.value === value && <IconCheck className=\"ml-auto size-4\" aria-hidden=\"true\" />}\n </DropdownMenuItem>\n ))}\n {extra !== undefined && extra !== null && extra !== false && (\n <>\n <DropdownMenuSeparator />\n {extra}\n </>\n )}\n </DropdownMenuContent>\n );\n\n // Outside a SidebarProvider the sidebar primitives cannot mount: same row, plain button.\n const trigger =\n sidebar === null ? (\n <button\n type=\"button\"\n data-testid=\"scope-switcher:trigger\"\n aria-label={ariaLabel}\n disabled={pending}\n className=\"flex w-full items-center gap-2 rounded-lg p-2 outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-70 data-[state=open]:bg-accent\"\n >\n {rowContent}\n </button>\n ) : (\n <SidebarMenuButton\n size=\"lg\"\n data-testid=\"scope-switcher:trigger\"\n aria-label={ariaLabel}\n disabled={pending}\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n >\n {rowContent}\n </SidebarMenuButton>\n );\n\n const menu = (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>\n {content}\n </DropdownMenu>\n );\n\n if (sidebar === null) return <div data-testid=\"scope-switcher\">{menu}</div>;\n return (\n <SidebarMenu data-testid=\"scope-switcher\">\n <SidebarMenuItem>{menu}</SidebarMenuItem>\n </SidebarMenu>\n );\n}\n","// Constants\nexport const PACKAGE_NAME = '@burojs/ui-shadcn' as const;\nexport const PACKAGE_VERSION = '0.0.0' as const;\n\n// The browser's platform: `<BuroProvider platform={webPlatform()}>` without a second import.\nexport { webPlatform } from '@burojs/react/web';\n\n// Layout\nexport { DocInfo, type DocInfoProps } from './doc/doc-info.js';\nexport { DocPanel, type DocPanelProps } from './doc/doc-panel.js';\nexport { DocTrailHelp, type DocTrailHelpProps } from './doc/doc-trail-help.js';\nexport { DocBrowser, type DocBrowserProps } from './doc/doc-browser.js';\nexport {\n CommandPaletteDocsGroup,\n type CommandPaletteDocsGroupProps,\n} from './layout/command-palette-docs-group.js';\nexport { AppLayout, type AppLayoutProps } from './layout/app-layout.js';\nexport { AppSidebar, type AppSidebarProps } from './layout/app-sidebar.js';\nexport { NavMain, type NavMainProps } from './layout/nav-main.js';\nexport {\n useNavTree,\n type NavTreeEntry,\n type NavTreeLayout,\n type NavTreeSection,\n type UseNavTreeOptions,\n} from './layout/use-nav-tree.js';\nexport {\n type NavItem,\n type NavLayout,\n type NavLayoutProps,\n layoutSlot,\n useLayout,\n useLayoutResolver,\n} from './layout/nav-slots.js';\nexport { buildNavItems, type BuildNavItemsArgs } from './layout/build-nav-items.js';\nexport { SecondarySidebarLayout } from './layout/layouts/secondary-sidebar-layout.js';\nexport { TabsLayout } from './layout/layouts/tabs-layout.js';\nexport { NavChrome, type NavChromeProps } from './layout/nav-chrome.js';\nexport {\n NavAreaNotFound,\n NavAreaPage,\n ResourcePageRouter,\n type ResourcePageRouterProps,\n} from './layout/resource-page-router.js';\nexport { RecordPage, type RecordPageProps } from './layout/record-page.js';\nexport { RecordBreadcrumbs } from './layout/record-breadcrumbs.js';\nexport {\n RecordScreen,\n type RecordScreenProps,\n} from './record/record-screen.js';\nexport { CopyId, FormActions, RecordActions, RecordTitle } from './record/frame-pieces.js';\nexport { defaultNavLayouts } from './layout/default-nav-layouts.js';\nexport { ContextPicker, type ContextPickerProps } from './layout/context-picker.js';\nexport {\n ScopeDimensionPicker,\n type ScopeDimensionPickerProps,\n} from './layout/scope-dimension-picker.js';\nexport {\n THEME_CHOICES,\n THEME_STORAGE_KEY,\n useTheme,\n type ResolvedTheme,\n type ThemeChoice,\n type UseThemeResult,\n} from './layout/use-theme.js';\nexport { LanguageSwitch, type LanguageSwitchProps } from './layout/language-switch.js';\nexport {\n loadLocale,\n saveLocale,\n DEFAULT_LANGUAGE_STORAGE_KEY,\n} from './layout/language-storage.js';\nexport {\n Breadcrumbs,\n type BreadcrumbsProps,\n type PageBreadcrumbsProps,\n type ResourceBreadcrumbsProps,\n} from './layout/breadcrumbs.js';\nexport { HeaderBreadcrumbs } from './layout/header-breadcrumbs.js';\nexport {\n CommandPalette,\n type CommandPaletteProps,\n type CommandPaletteTestIdRole,\n} from './layout/command-palette.js';\nexport {\n CommandPaletteTrigger,\n type CommandPaletteTriggerProps,\n} from './layout/command-palette-trigger.js';\nexport {\n CommandPaletteNavigationGroups,\n type CommandPaletteNavigationGroupsProps,\n type CommandPaletteNavigationTestIdRole,\n} from './layout/command-palette-navigation-groups.js';\nexport {\n CommandPaletteRecentGroup,\n type CommandPaletteRecentGroupProps,\n type CommandPaletteRecentTestIdRole,\n} from './layout/command-palette-recent-group.js';\nexport {\n CommandPaletteRecordsGroup,\n type CommandPaletteRecordsGroupProps,\n type CommandPaletteRecordsTestIdRole,\n} from './layout/command-palette-records-group.js';\nexport {\n CommandPaletteActionsGroup,\n type ActionItem,\n type CommandPaletteActionsGroupProps,\n type CommandPaletteActionsTestIdRole,\n} from './layout/command-palette-actions-group.js';\nexport {\n CommandPaletteCreateGroup,\n type CommandPaletteCreateGroupProps,\n type CommandPaletteCreateTestIdRole,\n} from './layout/command-palette-create-group.js';\nexport {\n LinkComponentProvider,\n useLinkComponent,\n type LinkComponent,\n type LinkComponentProps,\n type LinkComponentProviderProps,\n} from './layout/link-component.js';\nexport { useHref, useMatch, useNavVisible } from './layout/use-nav-routing.js';\nexport { NavigationGuardDialog } from './layout/navigation-guard-dialog.js';\nexport { RefreshButton, type RefreshButtonProps } from './shell/refresh-button.js';\nexport { AppActions } from './shell/app-actions.js';\nexport { HelpButton, type HelpButtonProps } from './shell/help-button.js';\nexport { AppHeader, type AppHeaderProps } from './layout/app-header.js';\nexport {\n DocumentTitleProvider,\n useDocumentTitle,\n} from './layout/document-title.js';\n\n// Notifications\nexport { Toaster, type ToasterProps, toast } from './notification/toaster.js';\n\n// Auth\nexport { LoginForm, type LoginFormProps, type LoginCredentials } from './auth/login-form.js';\nexport { AuthPage, type AuthPageProps } from './auth/auth-page.js';\n\n// Fields\nexport { shadcnFieldImplementations } from './fields/default-renderers.js';\nexport { shadcnBlockImplementations } from './blocks/builtins.js';\nexport { TextDisplay, TextInput } from './fields/text.js';\nexport { NumberDisplay, NumberInput } from './fields/number.js';\nexport { BooleanDisplay, BooleanInput } from './fields/boolean.js';\nexport { DateDisplay, DateInput } from './fields/date.js';\nexport { EnumDisplay, EnumInput } from './fields/enum.js';\nexport { TextareaDisplay, TextareaInput } from './fields/textarea.js';\nexport {\n RelationDisplay,\n RelationField,\n relationLinkClassName,\n} from './fields/relation-display.js';\nexport { LinkKeysDisplay, RelationManyDisplay } from './fields/link-keys-display.js';\nexport {\n RelationPicker,\n RelationPickerInput,\n type RelationPickerProps,\n} from './fields/relation-picker.js';\n// The dialog is a chunk of its own: this export draws nothing until that chunk has loaded, so an\n// app that never opens one does not carry it.\nexport { LazyRelationPickerDialog as RelationPickerDialog } from './fields/lazy-relation-picker-dialog.js';\nexport type { RelationPickerDialogProps } from './fields/relation-picker-dialog.js';\n// A picker as a promise: `open()` settles with the chosen keys and rows, or why none was chosen.\nexport {\n useRelationPicker,\n type RelationPickerCancelReason,\n type RelationPickerHandle,\n type RelationPickerOpenOptions,\n type RelationPickerResult,\n type RelationPickerRow,\n type UseRelationPickerOptions,\n} from './fields/use-relation-picker.js';\n// URL-free filter state (group/search/page + the shared `composeListFilter`\n// composition) for mounting `FilterBuilder` outside a list page — e.g. a\n// custom modal. `RelationPickerDialog` is the reference consumer; nothing\n// about it is picker-specific.\nexport {\n useDialogFilterState,\n type DialogFilterState,\n type UseDialogFilterStateOptions,\n} from './fields/use-dialog-filter-state.js';\nexport { FileInput, type FileInputProps } from './fields/file.js';\nexport { FileDisplay, FileField, isImage, type FileFieldProps } from './fields/file-display.js';\n\n// Forms — public, resource-independent single-field bricks\nexport {\n Field,\n FieldDisplay,\n i18nPrefixToRef,\n type FieldProps,\n type FieldDisplayProps,\n} from './forms/field.js';\nexport {\n DeclarativeForm,\n type DeclarativeFormProps,\n type DeclarativeFormSlots,\n} from './forms/declarative-form.js';\nexport { DeclarativeDisplay, type DeclarativeDisplayProps } from './forms/declarative-display.js';\n\n// Export — self-hosted dialog (see its own docblock for why it is not\n// presented through `useUIPresent`) + the one DOM-touching download helper.\nexport { ExportDialog, type ExportDialogProps } from './export/export-dialog.js';\nexport { downloadArtifact } from './export/download.js';\nexport { ExportButton, type ExportButtonProps } from './export/export-button.js';\n// `useTrackDisplayedRun` is deliberately NOT exported: after Task 8's fix\n// round its only caller is `<ExportDialog>`, in this same package, and\n// removing a published export later would be a breaking change.\nexport { useExportRunWatcher } from './export/run-watcher.js';\n\n// Enum primitives — declarative status / type / kind columns\n// (separate namespace from the lower-level field-renderer EnumDisplay /\n// EnumInput which take a flat options array; the EnumValueDisplay variant\n// here resolves the enum from the app registry by name).\nexport { EnumBadge, type EnumBadgeProps } from './enum/enum-badge.js';\nexport {\n EnumDisplay as EnumValueDisplay,\n type EnumDisplayProps as EnumValueDisplayProps,\n type EnumDisplayVariant as EnumValueDisplayVariant,\n} from './enum/enum-display.js';\nexport {\n EnumPicker,\n ENUM_PICKER_CLEAR_SENTINEL,\n type EnumPickerProps,\n} from './enum/enum-picker.js';\n\n// Actions\nexport {\n ActionButton,\n type ActionButtonProps,\n DisabledAction,\n type DisabledActionProps,\n} from './actions/action-button.js';\nexport { ActionOverflow, type ActionOverflowProps } from './actions/action-overflow.js';\nexport { type ActionSurface, modeForSurface } from './actions/action-surface.js';\nexport { BulkActionToolbar, type BulkActionToolbarProps } from './actions/bulk-action-toolbar.js';\nexport {\n AppFlowButton,\n type AppFlowButtonProps,\n FlowActionButton,\n type FlowActionButtonProps,\n} from './flows/index.js';\n\n// Checks — the conditional-checks rule engine's one rendering surface\n// (`useCheckGate`'s dialog, `@burojs/react`). Mounted by the record frame's\n// submit gate, the DeclarativeForm submit gate, and action buttons alike.\nexport {\n CheckConfirmDialog,\n type CheckConfirmDialogProps,\n} from './checks/check-confirm-dialog.js';\n\n// Data Table (TanStack Table v8 foundation — Stage 1 of the polish loop)\nexport {\n useBuroDataTable,\n buroSortingToTanStack,\n tanStackSortingToBuro,\n resolveUpdater,\n type UseBuroDataTableOptions,\n type FilterOperator,\n} from './data-table/use-buro-data-table.js';\nexport { DataTable, type DataTableProps } from './data-table/data-table.js';\nexport {\n DataTableFacetedFilter,\n type DataTableFacetedFilterProps,\n FacetedFilterPicker,\n type FacetedFilterPickerProps,\n type FacetedFilterOption,\n} from './data-table/data-table-faceted-filter.js';\nexport {\n DataTableTextFilter,\n type DataTableTextFilterProps,\n} from './data-table/data-table-text-filter.js';\nexport {\n DataTableEnumFilter,\n type DataTableEnumFilterProps,\n} from './data-table/data-table-enum-filter.js';\nexport {\n DataTableNumRangeFilter,\n type DataTableNumRangeFilterProps,\n} from './data-table/data-table-num-range-filter.js';\nexport {\n DataTableDateRangeFilter,\n type DataTableDateRangeFilterProps,\n} from './data-table/data-table-date-range-filter.js';\nexport {\n DataTableOperatorFilter,\n formatOperatorLabel,\n type DataTableOperatorFilterProps,\n} from './data-table/data-table-operator-filter.js';\nexport {\n DataTableViewOptions,\n type DataTableViewOptionsProps,\n} from './data-table/data-table-view-options.js';\nexport {\n DataTableRowActions,\n type DataTableRowActionsProps,\n type RowActionDescriptor,\n} from './data-table/data-table-row-actions.js';\nexport {\n DataTableToolbar,\n type DataTableToolbarProps,\n} from './data-table/data-table-toolbar.js';\n\n// List kit — search input and column toggle for the list toolbar.\nexport { ListSearchInput } from './list-kit/list-search-input.js';\nexport { ColumnsToggle } from './list-kit/columns-toggle.js';\n// The route list's toolbar and rows as named pieces (P7-33): a list frame arranges them.\nexport {\n ListBody,\n ListBulkBar,\n ListColumns,\n ListControls,\n ListCreate,\n ListExport,\n ListFilters,\n ListFlows,\n ListLive,\n ListSavedViews,\n} from './list-kit/pieces/index.js';\n// The load-more footer a CURSOR-paginated list renders instead of the\n// numbered pager (Task B5.3). Provider-agnostic — see its docblock.\nexport {\n CursorLoadMore,\n type CursorLoadMoreProps,\n} from './list-kit/cursor-load-more.js';\nexport {\n ResourceListPage,\n type ResourceListPageProps,\n} from './list-kit/resource-list-page.js';\n// The filter-builder region (Task 7) — `FilterRegion` is the default\n// `list.filters.<resource>` content `<ResourceListPage>` mounts; the other\n// four are its building blocks, exported so an adopter can compose a\n// DIFFERENT layout instead of forking this file.\nexport { FilterRegion } from './list-kit/filter-builder/filter-region.js';\nexport {\n FilterBuilder,\n type FilterBuilderProps,\n} from './list-kit/filter-builder/filter-builder.js';\nexport {\n FilterPanel,\n type FilterPanelProps,\n type DraftRemovalSignal,\n} from './list-kit/filter-builder/filter-panel.js';\nexport {\n FilterBadges,\n type FilterBadgesProps,\n} from './list-kit/filter-builder/filter-badges.js';\nexport {\n PinnedFilterControls,\n type PinnedFilterControlsProps,\n} from './list-kit/filter-builder/pinned-filter-controls.js';\nexport {\n PresetFilterControls,\n type PresetFilterControlsProps,\n} from './list-kit/filter-builder/preset-filter-controls.js';\nexport {\n FilterValueControl,\n type FilterValueControlProps,\n} from './list-kit/filter-builder/values/filter-value-control.js';\n// The list override ladder (Task B3.2; level 1 added by SP0 Task 5) —\n// key-builder + resolver for the `list.cell.<resource>` /\n// `list.filters.<resource>` / `list.body.<resource>` Components-registry\n// slots `<ResourceListPage>` renders. Mirrors `layoutSlot`\n// above; `useListSlot` is exported so an app dispatcher can ask whether a\n// resource overrides a region without duplicating the key format.\n// `ListCellRenderer` is exported alongside so an adopter registering\n// `list.cell.<resource>` can type the function it hands the registry\n// (`Record<string, unknown>` slot values are otherwise unchecked).\nexport {\n listSlot,\n useListSlot,\n type ListCellRenderer,\n type ListSlot,\n type ListSlotRegion,\n} from './list-kit/list-slots.js';\n\n// Saved views\nexport {\n SavedViewsDropdown,\n type SavedViewsDropdownProps,\n} from './saved-views/saved-views-dropdown.js';\n\n// Resource views\nexport { ResourceList, type ResourceListProps } from './resource/resource-list.js';\nexport { ListErrorState, type ListErrorStateProps } from './resource/list-error-state.js';\nexport { recordDisplayName } from './resource/record-display-name.js';\nexport {\n EditPageHeader,\n PageHeader,\n type PageHeaderProps,\n ShowPageHeader,\n} from './resource/page-header.js';\nexport { CreateButton, type CreateButtonProps } from './resource/create-button.js';\nexport { useFormControl, type FormControl } from './resource/form-context.js';\n\n// UI Presentations — concrete dialog/sheet/popover hosts for the framework-mounted\n// `<UIPresentations/>` overlay stack (`BuroProvider`'s `presentationHosts`).\nexport {\n DialogPresentationHost,\n SheetPresentationHost,\n PopoverPresentationHost,\n DialogPresentationShell,\n SheetPresentationShell,\n type PresentationCopy,\n usePresentationCopy,\n wrapperEnabled,\n shadcnPresentationHosts,\n} from './ui-presentations/index.js';\n\n// Primitives (re-export common ones for convenience)\nexport * from './primitives/button.js';\nexport * from './primitives/icon.js';\nexport * from './primitives/input.js';\nexport * from './primitives/alert-dialog.js';\nexport * from './primitives/command.js';\nexport * from './primitives/dialog.js';\nexport * from './primitives/card.js';\nexport * from './primitives/table.js';\nexport * from './primitives/form.js';\nexport * from './primitives/select.js';\nexport * from './primitives/popover.js';\nexport * from './primitives/checkbox.js';\nexport * from './primitives/textarea.js';\nexport * from './primitives/badge.js';\nexport * from './primitives/sheet.js';\nexport * from './primitives/label.js';\nexport * from './primitives/tabs.js';\nexport * from './primitives/dropdown-menu.js';\nexport * from './primitives/avatar.js';\nexport * from './primitives/tooltip.js';\nexport * from './primitives/separator.js';\nexport * from './primitives/collapsible.js';\nexport * from './primitives/skeleton.js';\nexport * from './primitives/sidebar.js';\nexport * from './primitives/progress.js';\n\n// Progress + partial failure for work long enough to watch. Renders\n// `@burojs/core`'s `TaskRunReport`, which knows nothing about how the work is\n// driven — a polled server-side run and a loop over a selection produce the\n// same report.\nexport * from './tasks/task-run-panel.js';\n\n// Utils\nexport { cn } from './lib/cn.js';\nexport { useIsMobile } from './lib/use-mobile.js';\nexport { spacing, type SpacingKey } from './lib/spacing.js';\nexport { typography, type TypographyKey } from './lib/typography.js';\nexport {\n ShellProvider,\n useShell,\n usePaletteState,\n defaultUserMapper,\n type PaletteState,\n type ShellBrand,\n type ShellUser,\n type ShellUserMapper,\n type ShellContextValue,\n type ShellProviderProps,\n} from './shell/shell-context.js';\nexport { useCurrentUser } from './shell/use-current-user.js';\nexport { SidebarBrand } from './shell/sidebar-brand.js';\nexport { BrandMark } from './shell/brand-mark.js';\nexport { resolveNavIcon, useNavIcon } from './shell/use-nav-icon.js';\nexport { AppShell, type AppShellProps } from './shell/app-shell.js';\nexport {\n DefaultCommandPalette,\n type DefaultCommandPaletteProps,\n} from './shell/default-command-palette.js';\nexport type { Slot } from './shell/slot.js';\nexport {\n ScopeSwitcher,\n type ScopeOption,\n type ScopeSwitcherProps,\n} from './shell/scope-switcher.js';\nexport { UserMenu, type UserMenuProps } from './shell/user-menu.js';\nexport { useLanguageSwitch, type LanguageSwitchApi } from './shell/use-language-switch.js';\nexport {\n ThemeSubmenu,\n ThemeToggle,\n useThemePaletteActions,\n} from './shell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