@arbidocs/blocks 0.5.58 → 0.5.59

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 (134) hide show
  1. package/dist/{ConnectedCallDock-SWDSHWTE.cjs → ConnectedCallDock-IGIDX5LT.cjs} +7 -7
  2. package/dist/{ConnectedCallDock-SWDSHWTE.cjs.map → ConnectedCallDock-IGIDX5LT.cjs.map} +1 -1
  3. package/dist/{ConnectedCallDock-HFQNXBH2.js → ConnectedCallDock-KCINYWGF.js} +7 -7
  4. package/dist/{ConnectedCallDock-HFQNXBH2.js.map → ConnectedCallDock-KCINYWGF.js.map} +1 -1
  5. package/dist/{ConnectedCallRoom-JOUQ5SM5.cjs → ConnectedCallRoom-V3UUSCMA.cjs} +7 -7
  6. package/dist/{ConnectedCallRoom-JOUQ5SM5.cjs.map → ConnectedCallRoom-V3UUSCMA.cjs.map} +1 -1
  7. package/dist/{ConnectedCallRoom-EGPYH7XF.js → ConnectedCallRoom-W3IDBOFA.js} +7 -7
  8. package/dist/{ConnectedCallRoom-EGPYH7XF.js.map → ConnectedCallRoom-W3IDBOFA.js.map} +1 -1
  9. package/dist/{ConnectedDocumentViewer-PGFWDHBI.cjs → ConnectedDocumentViewer-DXBTO2K6.cjs} +13 -13
  10. package/dist/{ConnectedDocumentViewer-PGFWDHBI.cjs.map → ConnectedDocumentViewer-DXBTO2K6.cjs.map} +1 -1
  11. package/dist/{ConnectedDocumentViewer-KIZCVZXV.js → ConnectedDocumentViewer-S4TWI5ML.js} +12 -12
  12. package/dist/{ConnectedDocumentViewer-KIZCVZXV.js.map → ConnectedDocumentViewer-S4TWI5ML.js.map} +1 -1
  13. package/dist/{ConnectedNativeDocxComparison-NGS4IMUZ.js → ConnectedNativeDocxComparison-4Q57CKP4.js} +12 -12
  14. package/dist/ConnectedNativeDocxComparison-4Q57CKP4.js.map +1 -0
  15. package/dist/{ConnectedNativeDocxComparison-XJ66AM6C.cjs → ConnectedNativeDocxComparison-XOUU4XE4.cjs} +13 -13
  16. package/dist/ConnectedNativeDocxComparison-XOUU4XE4.cjs.map +1 -0
  17. package/dist/{ConnectedNativeDocxEditor-MJUFY74T.js → ConnectedNativeDocxEditor-4KXAQEBW.js} +11 -11
  18. package/dist/ConnectedNativeDocxEditor-4KXAQEBW.js.map +1 -0
  19. package/dist/{ConnectedNativeDocxEditor-23O5EH7F.cjs → ConnectedNativeDocxEditor-EFEAU6CF.cjs} +13 -13
  20. package/dist/ConnectedNativeDocxEditor-EFEAU6CF.cjs.map +1 -0
  21. package/dist/{ConnectedStreamedWordArtifact-VWG2BXSW.js → ConnectedStreamedWordArtifact-MKEN2R7Y.js} +12 -12
  22. package/dist/ConnectedStreamedWordArtifact-MKEN2R7Y.js.map +1 -0
  23. package/dist/{ConnectedStreamedWordArtifact-567Q2AOX.cjs → ConnectedStreamedWordArtifact-MWVDNPYF.cjs} +13 -13
  24. package/dist/ConnectedStreamedWordArtifact-MWVDNPYF.cjs.map +1 -0
  25. package/dist/{DocumentReviewCard-AKIBUBPA.js → DocumentReviewCard-FHRCV7IB.js} +8 -8
  26. package/dist/{DocumentReviewCard-AKIBUBPA.js.map → DocumentReviewCard-FHRCV7IB.js.map} +1 -1
  27. package/dist/{DocumentReviewCard-4KB66DX4.cjs → DocumentReviewCard-RURBAILX.cjs} +8 -8
  28. package/dist/{DocumentReviewCard-4KB66DX4.cjs.map → DocumentReviewCard-RURBAILX.cjs.map} +1 -1
  29. package/dist/{WorkspaceTableView-ZXIW3MQ5.cjs → WorkspaceTableView-2AZRQUTW.cjs} +10 -10
  30. package/dist/{WorkspaceTableView-ZXIW3MQ5.cjs.map → WorkspaceTableView-2AZRQUTW.cjs.map} +1 -1
  31. package/dist/{WorkspaceTableView-3VP56J6F.js → WorkspaceTableView-7D6CO2NO.js} +8 -8
  32. package/dist/{WorkspaceTableView-3VP56J6F.js.map → WorkspaceTableView-7D6CO2NO.js.map} +1 -1
  33. package/dist/agents/index.cjs +342 -342
  34. package/dist/agents/index.js +6 -6
  35. package/dist/calendar/index.cjs +116 -116
  36. package/dist/calendar/index.js +1 -1
  37. package/dist/calls/index.cjs +2 -2
  38. package/dist/calls/index.js +2 -2
  39. package/dist/chat/index.cjs +85 -85
  40. package/dist/chat/index.js +5 -5
  41. package/dist/{chunk-QDHVZ56E.cjs → chunk-4QDJQC5I.cjs} +4 -4
  42. package/dist/{chunk-QDHVZ56E.cjs.map → chunk-4QDJQC5I.cjs.map} +1 -1
  43. package/dist/{chunk-Q5BWRMET.cjs → chunk-62DTFNIS.cjs} +5 -5
  44. package/dist/{chunk-Q5BWRMET.cjs.map → chunk-62DTFNIS.cjs.map} +1 -1
  45. package/dist/{chunk-2LK27F43.cjs → chunk-6YJLVAR6.cjs} +14 -14
  46. package/dist/{chunk-2LK27F43.cjs.map → chunk-6YJLVAR6.cjs.map} +1 -1
  47. package/dist/{chunk-HXAWPMRJ.cjs → chunk-72VTGWZ5.cjs} +5 -5
  48. package/dist/{chunk-HXAWPMRJ.cjs.map → chunk-72VTGWZ5.cjs.map} +1 -1
  49. package/dist/{chunk-E5RN3LWS.js → chunk-AWVGKHJT.js} +2 -2
  50. package/dist/{chunk-E5RN3LWS.js.map → chunk-AWVGKHJT.js.map} +1 -1
  51. package/dist/{chunk-SUW7USWW.js → chunk-BFWAIOZK.js} +3 -3
  52. package/dist/{chunk-SUW7USWW.js.map → chunk-BFWAIOZK.js.map} +1 -1
  53. package/dist/{chunk-T2DUORCT.cjs → chunk-BL6KFCZK.cjs} +18 -18
  54. package/dist/{chunk-T2DUORCT.cjs.map → chunk-BL6KFCZK.cjs.map} +1 -1
  55. package/dist/{chunk-K2UPRNQB.cjs → chunk-DDHEN3TC.cjs} +3 -3
  56. package/dist/{chunk-K2UPRNQB.cjs.map → chunk-DDHEN3TC.cjs.map} +1 -1
  57. package/dist/{chunk-HG5J7G5H.js → chunk-EANS63YE.js} +3 -3
  58. package/dist/{chunk-HG5J7G5H.js.map → chunk-EANS63YE.js.map} +1 -1
  59. package/dist/{chunk-I5BYLF6V.cjs → chunk-EQRSQZS5.cjs} +4 -4
  60. package/dist/{chunk-I5BYLF6V.cjs.map → chunk-EQRSQZS5.cjs.map} +1 -1
  61. package/dist/{chunk-X2AIPVIT.cjs → chunk-F72ZD5Q2.cjs} +3 -3
  62. package/dist/{chunk-X2AIPVIT.cjs.map → chunk-F72ZD5Q2.cjs.map} +1 -1
  63. package/dist/{chunk-ICQWNUDD.js → chunk-FAYWEPDL.js} +4 -4
  64. package/dist/{chunk-ICQWNUDD.js.map → chunk-FAYWEPDL.js.map} +1 -1
  65. package/dist/{chunk-QJHU6BEE.cjs → chunk-HA27GUIF.cjs} +12 -12
  66. package/dist/{chunk-QJHU6BEE.cjs.map → chunk-HA27GUIF.cjs.map} +1 -1
  67. package/dist/{chunk-UM543YBU.js → chunk-HPA4XNIC.js} +3 -3
  68. package/dist/{chunk-UM543YBU.js.map → chunk-HPA4XNIC.js.map} +1 -1
  69. package/dist/{chunk-JFNF6HTE.cjs → chunk-IHEXSVAI.cjs} +68 -68
  70. package/dist/{chunk-JFNF6HTE.cjs.map → chunk-IHEXSVAI.cjs.map} +1 -1
  71. package/dist/{chunk-WIW3XGHO.js → chunk-JS7KJRKG.js} +3 -3
  72. package/dist/{chunk-WIW3XGHO.js.map → chunk-JS7KJRKG.js.map} +1 -1
  73. package/dist/{chunk-OFYTC2QC.js → chunk-MQBEX5KB.js} +9 -9
  74. package/dist/{chunk-OFYTC2QC.js.map → chunk-MQBEX5KB.js.map} +1 -1
  75. package/dist/{chunk-2N5G5WZ7.js → chunk-MSY4JQPU.js} +3 -3
  76. package/dist/{chunk-2N5G5WZ7.js.map → chunk-MSY4JQPU.js.map} +1 -1
  77. package/dist/{chunk-C3FVQIBJ.js → chunk-NTXOETH6.js} +3 -3
  78. package/dist/{chunk-C3FVQIBJ.js.map → chunk-NTXOETH6.js.map} +1 -1
  79. package/dist/{chunk-53AGHUFO.cjs → chunk-OXDKLA47.cjs} +3 -3
  80. package/dist/{chunk-53AGHUFO.cjs.map → chunk-OXDKLA47.cjs.map} +1 -1
  81. package/dist/{chunk-DQ6PNJ6J.cjs → chunk-PFCTYQJH.cjs} +3 -3
  82. package/dist/{chunk-DQ6PNJ6J.cjs.map → chunk-PFCTYQJH.cjs.map} +1 -1
  83. package/dist/{chunk-HIDCHFFI.js → chunk-PFEXFTJ6.js} +3 -3
  84. package/dist/{chunk-HIDCHFFI.js.map → chunk-PFEXFTJ6.js.map} +1 -1
  85. package/dist/{chunk-ELY7WGBN.js → chunk-PPOL2RVQ.js} +3 -3
  86. package/dist/{chunk-ELY7WGBN.js.map → chunk-PPOL2RVQ.js.map} +1 -1
  87. package/dist/{chunk-4MSQJ6GX.js → chunk-QV3YRFQS.js} +10 -10
  88. package/dist/{chunk-4MSQJ6GX.js.map → chunk-QV3YRFQS.js.map} +1 -1
  89. package/dist/{chunk-CWV4SLRT.js → chunk-S65CHL3M.js} +5 -5
  90. package/dist/{chunk-CWV4SLRT.js.map → chunk-S65CHL3M.js.map} +1 -1
  91. package/dist/{chunk-PPXY4F3C.js → chunk-TUXGAGPX.js} +5 -5
  92. package/dist/{chunk-PPXY4F3C.js.map → chunk-TUXGAGPX.js.map} +1 -1
  93. package/dist/{chunk-K3B3V6EA.js → chunk-UJN3MBVO.js} +3 -3
  94. package/dist/{chunk-K3B3V6EA.js.map → chunk-UJN3MBVO.js.map} +1 -1
  95. package/dist/{chunk-FDETJCMV.cjs → chunk-UPWVMG2X.cjs} +4 -4
  96. package/dist/{chunk-FDETJCMV.cjs.map → chunk-UPWVMG2X.cjs.map} +1 -1
  97. package/dist/{chunk-LM7DVT7C.cjs → chunk-W3PSIIMN.cjs} +2 -2
  98. package/dist/{chunk-LM7DVT7C.cjs.map → chunk-W3PSIIMN.cjs.map} +1 -1
  99. package/dist/{chunk-4TQGWQHK.js → chunk-W7B6VO7E.js} +3 -3
  100. package/dist/{chunk-4TQGWQHK.js.map → chunk-W7B6VO7E.js.map} +1 -1
  101. package/dist/{chunk-K7OBYDUO.cjs → chunk-XNOQVBU3.cjs} +16 -16
  102. package/dist/{chunk-K7OBYDUO.cjs.map → chunk-XNOQVBU3.cjs.map} +1 -1
  103. package/dist/{chunk-SNUWLNVU.cjs → chunk-YWBIOI6M.cjs} +9 -9
  104. package/dist/{chunk-SNUWLNVU.cjs.map → chunk-YWBIOI6M.cjs.map} +1 -1
  105. package/dist/collaboration/index.cjs +9 -9
  106. package/dist/collaboration/index.js +1 -1
  107. package/dist/connect/docx.cjs +15 -15
  108. package/dist/connect/docx.js +11 -11
  109. package/dist/connect/index.cjs +832 -832
  110. package/dist/connect/index.js +38 -38
  111. package/dist/connect/viewer.cjs +11 -11
  112. package/dist/connect/viewer.js +10 -10
  113. package/dist/facts/index.cjs +57 -57
  114. package/dist/facts/index.js +5 -5
  115. package/dist/files/index.cjs +1 -1
  116. package/dist/files/index.js +1 -1
  117. package/dist/index.cjs +600 -600
  118. package/dist/index.js +18 -18
  119. package/dist/settings/index.cjs +155 -155
  120. package/dist/settings/index.js +3 -3
  121. package/dist/shell/index.cjs +65 -65
  122. package/dist/shell/index.js +5 -5
  123. package/dist/studio/index.cjs +2 -2
  124. package/dist/studio/index.js +2 -2
  125. package/dist/workflow-canvas/index.cjs +43 -43
  126. package/dist/workflow-canvas/index.js +18 -18
  127. package/node_modules/@arbidocs/coedit/package.json +1 -1
  128. package/package.json +5 -5
  129. package/dist/ConnectedNativeDocxComparison-NGS4IMUZ.js.map +0 -1
  130. package/dist/ConnectedNativeDocxComparison-XJ66AM6C.cjs.map +0 -1
  131. package/dist/ConnectedNativeDocxEditor-23O5EH7F.cjs.map +0 -1
  132. package/dist/ConnectedNativeDocxEditor-MJUFY74T.js.map +0 -1
  133. package/dist/ConnectedStreamedWordArtifact-567Q2AOX.cjs.map +0 -1
  134. package/dist/ConnectedStreamedWordArtifact-VWG2BXSW.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shell/sidebar-context.ts","../src/shell/SidebarBadgeRow.tsx","../src/lib/use-close-on-escape.ts","../src/lib/sidebar-mode.ts","../src/shell/use-sidebar-controller.ts","../src/shell/Workspace.tsx","../src/shell/reload-policy.ts","../src/shell/ActionCluster.tsx","../src/shell/DockZone.tsx","../src/shell/PanelModeSwitcher.tsx","../src/shell/panel-windows.ts","../src/shell/panel-host.ts","../src/shell/PanelPortal.tsx"],"names":["SidebarBadgeRow","useRef","useEffect","jsxs","jsx","cn","useState","useCallback","containerWidth","Tooltip","TooltipTrigger","TooltipContent"],"mappings":";;;;;;;;;;;;AAYO,IAAM,sBAAA,GAAwC;AAAA,EACnD,cAAA,EAAgB,iBAAA;AAAA,EAChB,WAAA,EAAa,cAAA;AAAA,EACb,WAAA,EAAa,cAAA;AAAA,EACb,mBAAA,EAAqB;AACvB;AAOO,IAAM,iBAAiB,aAAA,CAAmC;AAAA,EAC/D,QAAA,EAAU,IAAA;AAAA,EACV,MAAA,EAAQ;AACV,CAAC;AACM,IAAM,iBAAA,GAAoB,MAA2B,UAAA,CAAW,cAAc;AAG9E,IAAM,sBAAA,GAAyB,cAAc,KAAK;ACIlD,IAAM,eAAA,GAAkB,UAAA;AAAA,EAC7B,SAASA,gBAAAA,CACP,EAAE,IAAA,EAAM,OAAO,KAAA,EAAO,SAAA,EAAW,OAAA,EAAS,WAAA,EAAa,WAAW,IAAA,GAAO,QAAA,EAAU,GAAG,IAAA,IACtF,GAAA,EACA;AACA,IAAA,MAAM,EAAE,QAAA,EAAS,GAAI,iBAAA,EAAkB;AACvC,IAAA,MAAM,QAAA,GAAW,OAAA,KAAY,QAAA,GAAW,KAAA,GAAQ,MAAA,CAAA;AAChD,IAAA,MAAM,QAAA,GAAW,KAAA,KAAU,MAAA,IAAa,KAAA,GAAQ,CAAA;AAChD,IAAA,MAAM,YAAY,QAAA,GAAY,KAAA,GAAQ,IAAI,IAAA,GAAO,MAAA,CAAO,KAAK,CAAA,GAAK,IAAA;AAClE,IAAA,MAAM,OAAO,SAAA,KAAc,QAAA,GAA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AA,EACF;AAGA,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,cAAA,CAAe,WAAW,CAAA;AACpD,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,OAAO,YAAA,CAAa,UAAU,QAAQ,CAAA;AAAA,EACxC;AAGA,EAAA,OAAO,IAAA;AACT","file":"chunk-UM543YBU.js","sourcesContent":["import { createContext, useContext } from 'react'\n\n/** Fixed strings of the sidebar family. Set once on `Sidebar.Root`; parts read them from context. */\nexport interface SidebarLabels {\n /** The sidebar's accessible name (the Root `aria-label` prop wins). */\n mainNavigation: string\n hideSidebar: string\n showSidebar: string\n /** The drawer's close button (the `closeLabel` prop wins). */\n closeNavigationMenu: string\n}\n\nexport const DEFAULT_SIDEBAR_LABELS: SidebarLabels = {\n mainNavigation: 'Main navigation',\n hideSidebar: 'Hide sidebar',\n showSidebar: 'Show sidebar',\n closeNavigationMenu: 'Close navigation menu',\n}\n\nexport interface SidebarContextValue {\n /** Labels are visible (full width), as opposed to the icon-only rail. */\n expanded: boolean\n labels: SidebarLabels\n}\nexport const SidebarContext = createContext<SidebarContextValue>({\n expanded: true,\n labels: DEFAULT_SIDEBAR_LABELS,\n})\nexport const useSidebarContext = (): SidebarContextValue => useContext(SidebarContext)\n\n/** True while the surrounding row is hovered/focused; trailing controls may brighten on it. */\nexport const SidebarRowHoverContext = createContext(false)\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react'\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { useSidebarContext } from './sidebar-context'\n\nexport interface SidebarBadgeRowProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'children'\n> {\n /** Glyph (20px). */\n icon: ReactNode\n /** Visible label of the expanded row; the tooltip of the icon-only rail. */\n label: string\n /** Unread/pending number. Hidden at 0 or `undefined`; values above 9 read \"9+\". */\n count?: number\n /**\n * Accessible name including the count, for example \"Notifications, 2 unread\". Defaults to\n * `label` plus the count.\n */\n ariaLabel?: string\n /**\n * `row`: a labelled row styled like the module rows, badge at the right. `icon`: icon-only with\n * the badge on the corner. Default follows the sidebar (`row` expanded, `icon` on the rail).\n */\n variant?: 'row' | 'icon'\n /** Test id of the count badge. */\n badgeTestId?: string\n}\n\n/**\n * A sidebar row that carries a badge and may open something (a panel, a popover): the\n * notifications and contacts rows above the account bar. A real button that forwards its ref and\n * rest props, so it can be a popover trigger (`<DropdownMenuTrigger asChild>`). The badge is\n * visible in both the expanded row and the icon-only rail, and the accessible name carries the\n * count in both.\n */\nexport const SidebarBadgeRow = forwardRef<HTMLButtonElement, SidebarBadgeRowProps>(\n function SidebarBadgeRow(\n { icon, label, count, ariaLabel, variant, badgeTestId, className, type = 'button', ...rest },\n ref\n ) {\n const { expanded } = useSidebarContext()\n const resolved = variant ?? (expanded ? 'row' : 'icon')\n const hasCount = count !== undefined && count > 0\n const badgeText = hasCount ? (count > 9 ? '9+' : String(count)) : null\n const name = ariaLabel ?? (hasCount ? `${label}, ${count}` : label)\n\n if (resolved === 'row') {\n return (\n <button\n ref={ref}\n type={type}\n aria-label={name}\n data-slot=\"sidebar-badge-row\"\n data-variant=\"row\"\n className={cn(\n 'group flex h-9 w-full cursor-pointer items-center rounded-md px-3 text-left text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:h-11',\n className\n )}\n {...rest}\n >\n <span className=\"flex size-5 flex-shrink-0 items-center justify-center\" aria-hidden>\n {icon}\n </span>\n <span className=\"ml-3 min-w-0 truncate\" aria-hidden>\n {label}\n </span>\n {badgeText && (\n <span\n aria-hidden\n data-testid={badgeTestId}\n className=\"ml-auto inline-flex min-w-5 flex-shrink-0 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold leading-5 tabular-nums text-primary-foreground\"\n >\n {badgeText}\n </span>\n )}\n </button>\n )\n }\n\n const iconButton = (\n <button\n ref={ref}\n type={type}\n aria-label={name}\n data-slot=\"sidebar-badge-row\"\n data-variant=\"icon\"\n title={variant === 'icon' ? label : undefined}\n className={cn(\n 'relative m-0 flex h-9 w-12 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:h-11',\n className\n )}\n {...rest}\n >\n <span className=\"flex size-5 items-center justify-center\" aria-hidden>\n {icon}\n </span>\n {badgeText && (\n <span\n aria-hidden\n data-testid={badgeTestId}\n className=\"absolute right-1 top-0.5 flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-semibold leading-4 tabular-nums text-primary-foreground\"\n >\n {badgeText}\n </span>\n )}\n </button>\n )\n // A standalone icon button (the page header) keeps its native title; the rail uses a tooltip.\n if (variant === 'icon') return iconButton\n return (\n <Tooltip delayDuration={50}>\n <TooltipTrigger asChild>{iconButton}</TooltipTrigger>\n <TooltipContent side=\"right\" sideOffset={8}>\n {label}\n </TooltipContent>\n </Tooltip>\n )\n }\n)\n","import { useEffect, useRef } from 'react'\n\n/**\n * While `isActive`, Escape calls `onClose`. For surfaces that float over the page without being a\n * modal (no backdrop, no focus trap), so nothing else closes them from the keyboard. An Escape a\n * dialog already handled (`defaultPrevented`) is left alone so one press closes one layer.\n */\nexport function useCloseOnEscape(isActive: boolean, onClose: () => void): void {\n const onCloseRef = useRef(onClose)\n useEffect(() => {\n onCloseRef.current = onClose\n })\n\n useEffect(() => {\n if (!isActive) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onCloseRef.current()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isActive])\n}\n","import { useEffect, useRef, useState } from 'react'\n\n/**\n * Headless sidebar behaviour (no DOM, no store): how the sidebar lays out for a given set of\n * inputs, and the settle timing that keeps labels/tips from squeezing during the width transition.\n *\n * - `drawer` small-screen off-canvas panel (opened by the app bar's menu button)\n * - `collapsed` hidden (width 0): a phone with the drawer closed, or `isCollapsed`\n * - `pinned` full width, inline, pushes the content\n * - `rail` icon strip that floats open to full width while hovered\n */\nexport type SidebarMode = 'drawer' | 'collapsed' | 'pinned' | 'rail'\n\nexport interface SidebarModeInput {\n isSmallScreen: boolean\n /** The phone drawer was requested open. */\n isDrawerRequested: boolean\n isCollapsed: boolean\n isPinned: boolean\n isHovering: boolean\n /**\n * Tablet-width viewport (above the phone drawer breakpoint but too narrow to give the content a\n * usable column next to a 255px panel): pinning is ignored and the sidebar stays an icon rail.\n */\n isNarrow?: boolean\n}\n\nexport interface SidebarLayout {\n mode: SidebarMode\n /** Labels should be shown (the panel is, or is becoming, full width). */\n expanded: boolean\n /** Phones: nothing is rendered until the drawer opens. */\n hidden: boolean\n /** Hover state that actually applies (never on touch-sized screens). */\n hovering: boolean\n}\n\nexport function resolveSidebarLayout(input: SidebarModeInput): SidebarLayout {\n const { isSmallScreen, isDrawerRequested, isCollapsed, isPinned, isHovering } = input\n const canPin = isPinned && !isSmallScreen && !input.isNarrow\n const drawerOpen = isSmallScreen && isDrawerRequested\n // Small screens are drawer-only: when it is closed the panel is fully off-canvas\n // regardless of pinning (pinning is a desktop concept), and hover never expands.\n const effectiveCollapsed = isCollapsed || (isSmallScreen && !drawerOpen)\n const hovering = isHovering && !isSmallScreen\n\n let mode: SidebarMode\n if (drawerOpen) mode = 'drawer'\n else if (effectiveCollapsed) mode = 'collapsed'\n else if (canPin) mode = 'pinned'\n else mode = 'rail'\n\n // `hovering`, not `isHovering`: a stale hover flag must not report a hidden phone sidebar as expanded.\n const expanded = drawerOpen || (!effectiveCollapsed && (canPin || hovering))\n\n return { mode, expanded, hidden: isSmallScreen && !drawerOpen, hovering }\n}\n\n/**\n * Settle timing around the width transition (default 300ms):\n * - `labelsExpanded` switches on immediately but off only after the transition, so labels do not\n * snap to icon-only while the panel is still wide;\n * - `tipsVisible` is the opposite: width-bound content (a tip card) appears only once the panel\n * has fully opened and disappears the instant collapse starts.\n */\nexport function useSidebarSettle(expanded: boolean, settleMs = 300) {\n const [labelsExpanded, setLabelsExpanded] = useState(expanded)\n const [tipsVisible, setTipsVisible] = useState(expanded)\n const labelsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const tipsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useEffect(() => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n if (expanded) setLabelsExpanded(true)\n else labelsTimer.current = setTimeout(() => setLabelsExpanded(false), settleMs)\n return () => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n }\n }, [expanded, settleMs])\n\n useEffect(() => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n if (expanded) tipsTimer.current = setTimeout(() => setTipsVisible(true), settleMs)\n else setTipsVisible(false)\n return () => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n }\n }, [expanded, settleMs])\n\n return { labelsExpanded, tipsVisible }\n}\n","import { useCallback, useEffect, useRef } from 'react'\nimport { useControllableState } from '../lib/useControllableState'\nimport { useCloseOnEscape } from '../lib/use-close-on-escape'\nimport { useIsNarrow, useIsPhone, useIsTouchScreen } from '../lib/use-media-query'\nimport { resolveSidebarLayout, useSidebarSettle, type SidebarLayout } from '../lib/sidebar-mode'\nimport type { SidebarRootProps } from './Sidebar'\n\nexport interface UseSidebarControllerOptions {\n /** Pinned open (desktop). Controlled when set; otherwise kept here, seeded by `defaultPinned`. */\n isPinned?: boolean\n /** Default `true`. */\n defaultPinned?: boolean\n onPinnedChange?: (isPinned: boolean) => void\n /** The rail is floated open (hover, or its toggle at a narrow width). Controlled when set. */\n isHovering?: boolean\n onHoveringChange?: (isHovering: boolean) => void\n /** The phone drawer is open. Controlled when set (the app bar's menu button opens it). */\n isDrawerOpen?: boolean\n onDrawerOpenChange?: (isDrawerOpen: boolean) => void\n /**\n * Keep the sidebar a rail even when pinned, on top of the tablet width (for example while a\n * docked panel squeezes the content). The stored pin is left untouched.\n */\n forceRail?: boolean\n /**\n * Which rails expand on mouseenter. The default ignores narrow and emulated touch hover;\n * `all` retains hover expansion for a host whose narrow rail has no separate expand button.\n */\n hoverExpansion?: 'desktop-pointer' | 'all'\n}\n\n/** The `Sidebar.Root` props the controller resolves. */\nexport type SidebarControllerRootProps = Pick<\n SidebarRootProps,\n | 'mode'\n | 'expanded'\n | 'isHovering'\n | 'onBackdropClick'\n | 'hasRailBackdrop'\n | 'onMouseEnter'\n | 'onMouseLeave'\n>\n\nexport interface SidebarController {\n layout: SidebarLayout\n /** Labels shown (settled: they stay on until the closing transition ends). */\n expanded: boolean\n /** Width-bound content (tips, notices) may show: on once fully open, off as closing starts. */\n tipsVisible: boolean\n /** The phone drawer is showing. */\n isDrawer: boolean\n isSmallScreen: boolean\n /** Tablet width (or `forceRail`): pinning is ignored and the sidebar stays a rail. */\n isNarrow: boolean\n /** The pin as it applies (always off while narrow). */\n isPinned: boolean\n /** Spread onto `Sidebar.Root` (or pass the controller to `ShellSidebar`). */\n rootProps: SidebarControllerRootProps\n openDrawer: () => void\n closeDrawer: () => void\n /** The pin toggle: pins/unpins, or floats the rail open/closed while narrow. */\n togglePin: () => void\n /** Open from the rail (its ask button): pins, or floats the rail open while narrow. */\n expand: () => void\n /** After a nav row is chosen: closes the drawer, and a floated rail the pointer has left. */\n afterNavigate: () => void\n}\n\n// A menu opened from the rail (the account menu) is positioned against the sidebar's current\n// layout. Hovering that menu from the content would expand the rail, re-anchor the menu under\n// the pointer and move the item being clicked, so hover does not expand the rail while one is open.\nconst isMenuOpen = () =>\n typeof document !== 'undefined' &&\n document.querySelector('[role=\"menu\"][data-state=\"open\"]') !== null\n\n/**\n * Sidebar behaviour as one hook, shared by every shell: resolves the layout (drawer / pinned /\n * rail) for the viewport, settles labels and tips around the width transition, and owns the hover,\n * pin and drawer rules:\n * - touch: the rail opens only through its toggle, never by the emulated mouseenter of a tap;\n * - narrow: a pointer drifting over the rail does not float the labels over the content;\n * - Escape closes a floated rail; the drawer closes itself when the viewport grows past a phone;\n * - choosing a row closes the drawer, and a floated rail unless the pointer is still over it.\n *\n * State is controlled per field (`isPinned`, `isHovering`, `isDrawerOpen`) so an app can keep it\n * in its own store, or uncontrolled for a shell that does not care.\n */\nexport function useSidebarController(options: UseSidebarControllerOptions = {}): SidebarController {\n const [storedPinned, setPinned] = useControllableState(\n options.isPinned,\n options.defaultPinned ?? true,\n options.onPinnedChange\n )\n const [isHovering, setHovering] = useControllableState(\n options.isHovering,\n false,\n options.onHoveringChange\n )\n const [isDrawerOpen, setDrawerOpen] = useControllableState(\n options.isDrawerOpen,\n false,\n options.onDrawerOpenChange\n )\n\n const isSmallScreen = useIsPhone()\n const isNarrow = useIsNarrow() || !!options.forceRail\n const isTouch = useIsTouchScreen()\n\n const layout = resolveSidebarLayout({\n isSmallScreen,\n isDrawerRequested: isDrawerOpen,\n isCollapsed: false,\n isPinned: storedPinned,\n isHovering,\n isNarrow,\n })\n const isDrawer = layout.mode === 'drawer'\n const { labelsExpanded, tipsVisible } = useSidebarSettle(layout.expanded)\n\n // Whether the pointer is physically over the sidebar (decides if navigating closes the rail).\n const isPointerOver = useRef(false)\n\n const closeDrawer = useCallback(() => setDrawerOpen(false), [setDrawerOpen])\n const openDrawer = useCallback(() => setDrawerOpen(true), [setDrawerOpen])\n\n // The floated rail has no modal behaviour (the drawer gets Escape from `Sidebar.Root`).\n useCloseOnEscape(layout.mode === 'rail' && layout.hovering, () => setHovering(false))\n\n // A drawer left open when the viewport grows past a phone (rotate/resize) would be a stuck overlay.\n useEffect(() => {\n if (isDrawerOpen && !isSmallScreen) setDrawerOpen(false)\n }, [isDrawerOpen, isSmallScreen, setDrawerOpen])\n\n const onMouseEnter = () => {\n if (isTouch && options.hoverExpansion !== 'all') return\n isPointerOver.current = true\n if (\n !isSmallScreen &&\n (!isNarrow || options.hoverExpansion === 'all') &&\n (!isMenuOpen() || options.hoverExpansion === 'all')\n )\n setHovering(true)\n }\n const onMouseLeave = () => {\n if (isTouch && options.hoverExpansion !== 'all') return\n isPointerOver.current = false\n if (!isSmallScreen) setHovering(false)\n }\n\n return {\n layout,\n expanded: labelsExpanded,\n tipsVisible,\n isDrawer,\n isSmallScreen,\n isNarrow,\n isPinned: storedPinned && !isNarrow,\n rootProps: {\n mode: layout.mode,\n expanded: labelsExpanded,\n isHovering: layout.hovering,\n onBackdropClick: isDrawer ? closeDrawer : () => setHovering(false),\n hasRailBackdrop: isTouch,\n onMouseEnter,\n onMouseLeave,\n },\n openDrawer,\n closeDrawer,\n togglePin: () => (isNarrow ? setHovering(!isHovering) : setPinned(!storedPinned)),\n expand: () => (isNarrow ? setHovering(true) : setPinned(true)),\n afterNavigate: () => {\n if (!isPointerOver.current && !storedPinned) setHovering(false)\n if (isDrawer) closeDrawer()\n },\n }\n}\n","import type { ComponentType } from 'react'\nimport { ChevronDown, Globe, LayoutGrid, Lock, Plus, Users } from 'lucide-react'\nimport {\n cn,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '@arbidocs/react/ui'\nimport { prefixedTestId, testIdOr } from '../chat/test-id'\nimport type { ShellRecentWorkspace, ShellWorkspace, ShellWorkspaceKind } from './types'\n\n/** The three workspace-kind names (badge title, type glyph name, subtitle). */\nexport interface WorkspaceKindLabels {\n common: string\n shared: string\n private: string\n}\n\nexport const DEFAULT_WORKSPACE_KIND_LABELS: WorkspaceKindLabels = {\n common: 'Common',\n shared: 'Shared',\n private: 'Private',\n}\n\n/**\n * Workspace type drives the initial-badge fill and a quiet secondary glyph:\n * private (just you) -> navy, lock shared (several) -> selection tint, people\n * common (public) -> neutral, globe\n * Navy is identity and cyan is reserved for ARBI/AI, so \"shared\" is the selection tint.\n */\nexport function workspaceKindMeta(\n kind: ShellWorkspaceKind,\n labels?: Partial<WorkspaceKindLabels>\n): {\n Icon: ComponentType<{ className?: string; 'aria-label'?: string; 'data-testid'?: string }>\n label: string\n fill: string\n} {\n const l = { ...DEFAULT_WORKSPACE_KIND_LABELS, ...labels }\n if (kind === 'common')\n return { Icon: Globe, label: l.common, fill: 'bg-muted text-muted-foreground' }\n if (kind === 'shared')\n return { Icon: Users, label: l.shared, fill: 'bg-secondary text-secondary-foreground' }\n return { Icon: Lock, label: l.private, fill: 'bg-primary text-primary-foreground' }\n}\n\n/** The kind's hue as a CSS colour, for glyphs painted by SVG fill (the workspace shield). */\nexport function workspaceKindColor(kind: ShellWorkspaceKind): string {\n if (kind === 'common') return 'var(--color-muted-foreground)'\n if (kind === 'shared') return 'var(--color-secondary)'\n return 'var(--color-primary)'\n}\n\n/** Overridable ids of the workspace identity; defaults are the current ids. */\ntype WorkspaceIdentityTestIds = Partial<Record<'initial' | 'type' | 'projectName', string>>\n\nexport interface WorkspaceIdentityProps {\n workspace: ShellWorkspace\n /** Show name + type/project line beside the badge; otherwise the badge alone. */\n expanded: boolean\n /** Selected (nav-row) styling of the name. */\n isActive?: boolean\n /** Reword the kind names. */\n labels?: Partial<WorkspaceKindLabels>\n /** Part ids; defaults are the current ids. */\n testIds?: WorkspaceIdentityTestIds\n}\n\n/**\n * Non-interactive guts of the workspace head: the initial badge (with a tiny type glyph) and,\n * when expanded, the name and the project/type line. Hosted by the switcher trigger and by the\n * workspace settings header, so it never nests a button.\n */\nexport function WorkspaceIdentity({\n workspace,\n expanded,\n isActive = false,\n labels,\n testIds,\n}: WorkspaceIdentityProps) {\n const kind = workspaceKindMeta(workspace.kind, labels)\n const badge = (\n <span className=\"relative flex flex-shrink-0\" title={kind.label}>\n <span\n aria-hidden=\"true\"\n data-testid={testIdOr(testIds?.initial, { testId: 'sidebar-workspace-card-initial' })}\n className={cn(\n 'flex size-7 flex-shrink-0 items-center justify-center rounded-md text-sm font-semibold leading-none',\n kind.fill\n )}\n >\n {workspace.name.charAt(0).toUpperCase()}\n </span>\n {/* Type as a tiny overlay on the badge: status reads at the icon, not after the name. */}\n <span className=\"absolute -bottom-1 -right-1 flex size-3.5 items-center justify-center rounded-full bg-background ring-1 ring-border\">\n <kind.Icon\n aria-label={kind.label}\n data-testid={testIdOr(testIds?.type, { testId: 'sidebar-workspace-card-type' })}\n className=\"size-2.5 text-muted-foreground\"\n />\n </span>\n </span>\n )\n\n if (!expanded)\n return <div className=\"flex flex-shrink-0 items-center justify-center\">{badge}</div>\n\n return (\n <>\n <div className=\"flex flex-shrink-0 items-center justify-center\">{badge}</div>\n <div className=\"ml-2.5 flex min-w-0 flex-1 flex-col text-left\">\n <span\n // 600: the name of the thing you are inside, above a lighter project line.\n className={cn(\n 'min-w-0 truncate text-left text-sm font-semibold capitalize leading-tight transition-colors duration-100',\n isActive ? 'text-accent-foreground' : 'text-foreground'\n )}\n >\n {workspace.name}\n </span>\n {!workspace.projectName && (\n <span className=\"mt-0.5 truncate text-xs text-muted-foreground\">{kind.label}</span>\n )}\n {workspace.projectName && (\n <span\n className=\"mt-0.5 flex min-w-0\"\n data-testid={testIdOr(testIds?.projectName, {\n testId: 'sidebar-workspace-card-project-name',\n })}\n >\n {workspace.projectLine ?? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {workspace.projectName}\n </span>\n )}\n </span>\n )}\n </div>\n </>\n )\n}\n\n/**\n * Entity nouns plus the switcher's strings. `plural` arrives lowercased and `singular`\n * capitalized in the functions below.\n */\nexport interface WorkspaceSwitcherLabels extends WorkspaceKindLabels {\n /** Entity nouns, e.g. { plural: 'workspaces', singular: 'workspace' }. */\n plural: string\n singular: string\n /** The trigger's accessible name. */\n switchWorkspace: (name: string, plural: string) => string\n allWorkspaces: (plural: string) => string\n newWorkspace: (singular: string) => string\n recentWorkspaces: (plural: string) => string\n}\n\nexport const DEFAULT_WORKSPACE_SWITCHER_LABELS: WorkspaceSwitcherLabels = {\n ...DEFAULT_WORKSPACE_KIND_LABELS,\n plural: 'workspaces',\n singular: 'workspace',\n switchWorkspace: (name, plural) => `${name} — switch ${plural}`,\n allWorkspaces: (plural) => `All ${plural}`,\n newWorkspace: (singular) => `New ${singular}`,\n recentWorkspaces: (plural) => `Recent ${plural}`,\n}\n\nexport interface WorkspaceSwitcherProps {\n workspace: ShellWorkspace\n /** Other workspaces to jump to (the app orders and caps them). */\n recent?: ShellRecentWorkspace[]\n /** Icon-only trigger (the sidebar rail). */\n compact?: boolean\n /** `appbar`: the phone app bar's title, name + chevron on one line. */\n variant?: 'sidebar' | 'appbar'\n onSwitch: (workspace: ShellWorkspace) => void\n /** Return to the workspaces list; leaves the workspace open. */\n onGoToList: () => void\n onNewWorkspace: () => void\n /**\n * When set, \"New workspace\" is shown disabled with this explanation under it (e.g. the user may\n * not create workspaces on this deployment).\n */\n newWorkspaceDisabledReason?: string\n /** Entity nouns and menu strings; any subset (the nouns default to workspace(s)). */\n labels?: Partial<WorkspaceSwitcherLabels>\n className?: string\n /** Trigger id (default `workspace-switcher-trigger`). */\n testId?: string\n /**\n * Part ids; defaults are the current ids. `switchItem`, `type` and `lastSeen` are prefixes\n * (`<prefix>-<workspace id>`).\n */\n testIds?: Partial<Record<'menu' | 'all' | 'new' | 'switchItem' | 'type' | 'lastSeen', string>>\n /** Ids forwarded to the trigger's workspace identity. */\n identityTestIds?: WorkspaceIdentityTestIds\n}\n\n/**\n * The current-workspace control as a dropdown: \"All workspaces\", \"New workspace\", then the\n * recent workspaces to jump straight into.\n */\nexport function WorkspaceSwitcher({\n workspace,\n recent = [],\n compact = false,\n variant = 'sidebar',\n onSwitch,\n onGoToList,\n onNewWorkspace,\n newWorkspaceDisabledReason,\n labels,\n className,\n testId,\n testIds,\n identityTestIds,\n}: WorkspaceSwitcherProps) {\n const l = { ...DEFAULT_WORKSPACE_SWITCHER_LABELS, ...labels }\n const plural = l.plural.toLowerCase()\n const singular = l.singular.charAt(0).toUpperCase() + l.singular.slice(1)\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-slot=\"workspace-switcher\"\n data-testid={testIdOr(testId, { testId: 'workspace-switcher-trigger' })}\n aria-label={l.switchWorkspace(workspace.name, plural)}\n className={cn(\n 'group flex min-w-0 items-center rounded-md transition-colors duration-100 hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n variant === 'appbar'\n ? 'h-11 max-w-full gap-1 px-2'\n : compact\n ? 'h-12 w-12 justify-center'\n : 'h-12 w-full px-2',\n className\n )}\n >\n {variant === 'appbar' ? (\n <span className=\"min-w-0 truncate text-base font-semibold text-foreground\">\n {workspace.name}\n </span>\n ) : (\n <WorkspaceIdentity\n workspace={workspace}\n expanded={!compact}\n labels={l}\n testIds={identityTestIds}\n />\n )}\n {!(compact && variant === 'sidebar') && (\n <ChevronDown\n aria-hidden=\"true\"\n className=\"ml-auto size-4 flex-shrink-0 text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-180\"\n />\n )}\n </button>\n </DropdownMenuTrigger>\n {/* Expanded menus follow the trigger width so they stay inside the sidebar. */}\n <DropdownMenuContent\n align=\"start\"\n className={cn(\n 'border-0 max-w-[calc(100vw-1.5rem)]',\n variant === 'sidebar' && !compact\n ? 'w-[var(--radix-dropdown-menu-trigger-width)]'\n : 'w-60'\n )}\n data-testid={testIdOr(testIds?.menu, { testId: 'workspace-switcher-menu' })}\n >\n <DropdownMenuItem\n onClick={onGoToList}\n data-testid={testIdOr(testIds?.all, { testId: 'workspace-switcher-all' })}\n className=\"gap-2\"\n >\n <LayoutGrid className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n {l.allWorkspaces(plural)}\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={newWorkspaceDisabledReason ? undefined : onNewWorkspace}\n disabled={!!newWorkspaceDisabledReason}\n title={newWorkspaceDisabledReason}\n data-testid={testIdOr(testIds?.new, { testId: 'workspace-switcher-new' })}\n className=\"gap-2\"\n >\n <Plus className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n <span className=\"flex min-w-0 flex-col\">\n {l.newWorkspace(singular)}\n {newWorkspaceDisabledReason && (\n <span className=\"text-xs text-muted-foreground\">{newWorkspaceDisabledReason}</span>\n )}\n </span>\n </DropdownMenuItem>\n {recent.length > 0 && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuLabel className=\"text-xs font-normal text-muted-foreground\">\n {l.recentWorkspaces(plural)}\n </DropdownMenuLabel>\n {recent.map((w) => {\n const kind = workspaceKindMeta(w.kind, l)\n return (\n <DropdownMenuItem\n key={w.id}\n onClick={() => onSwitch(w)}\n data-testid={prefixedTestId(testIds?.switchItem, w.id, {\n testId: `workspace-switch-${w.id}`,\n })}\n className=\"gap-2\"\n >\n <span className=\"relative flex flex-shrink-0\" title={kind.label}>\n <span\n aria-hidden=\"true\"\n className={cn(\n 'flex size-6 flex-shrink-0 items-center justify-center rounded text-xs font-semibold leading-none',\n kind.fill\n )}\n >\n {w.name.charAt(0).toUpperCase()}\n </span>\n <span className=\"absolute -bottom-1 -right-1 flex size-3 items-center justify-center rounded-full bg-background ring-1 ring-border\">\n <kind.Icon\n aria-label={kind.label}\n data-testid={prefixedTestId(testIds?.type, w.id, {\n testId: `workspace-type-${w.id}`,\n })}\n className=\"size-2 text-muted-foreground\"\n />\n </span>\n </span>\n <span className=\"min-w-0 flex-1 truncate capitalize\">{w.name}</span>\n {w.lastSeen && (\n <span\n className=\"ml-2 flex-shrink-0 text-xs tabular-nums text-muted-foreground\"\n data-testid={prefixedTestId(testIds?.lastSeen, w.id, {\n testId: `workspace-last-seen-${w.id}`,\n })}\n >\n {w.lastSeen}\n </span>\n )}\n </DropdownMenuItem>\n )\n })}\n </>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","/**\n * One policy for every automatic reload: when the running build is out of date, pick a moment\n * that costs the user nothing.\n *\n * After a deploy (or mid-rollout, while old and new pods both serve) the previous build's hashed\n * chunks can 404. Vite reports that as `vite:preloadError`. Reloading fetches the current\n * index.html (served no-cache) and its chunks, but reloading at once throws away whatever the\n * user is typing, so:\n *\n * - A failed prefetch (`prefetchChunk`) never reloads. Nothing on screen depends on it.\n * - A failed chunk the user is waiting for reloads at once, unless the user is on a sign-in form\n * or has unsaved input (a focused or edited field, or a `[data-reload-guard]` region).\n * - Otherwise the reload waits: the next route navigation becomes a full page load of its target,\n * or the page reloads once the user is idle with nothing unsaved.\n * - Per tab, at most one policy reload a minute. A second failure right after one is not a stale\n * build (a genuinely missing chunk, say), so it surfaces to the error boundary instead of looping.\n */\n\nimport { notify } from '@arbidocs/react/shell'\n\nexport const CHUNK_RELOAD_KEY = 'arbi_chunk_reload_at'\n\n/** A second failure within this window after a reload is not a stale build: let it surface. */\nconst RELOAD_GUARD_MS = 60_000\n/** A deferred reload waits until the user has done nothing for this long. */\nconst IDLE_MS = 10_000\nconst IDLE_CHECK_MS = 2_000\n\n/** Sign-in pages, and regions a host marks as holding unsaved work. */\nconst GUARD_SELECTOR =\n '[data-slot=\"auth-layout\"], input[type=\"password\"], input[autocomplete=\"one-time-code\"], [data-reload-guard]'\nconst NON_TEXT_INPUTS = new Set([\n 'button',\n 'submit',\n 'reset',\n 'checkbox',\n 'radio',\n 'hidden',\n 'range',\n 'color',\n 'file',\n 'image',\n])\n\nexport interface ReloadPolicyDeps {\n /** Reload the current page. */\n reload: () => void\n /** Full page load of `url` (instead of a client-side navigation). */\n load: (url: string, replace: boolean) => void\n now: () => number\n}\n\nconst browserDeps: ReloadPolicyDeps = {\n reload: () => window.location.reload(),\n load: (url, replace) => (replace ? window.location.replace(url) : window.location.assign(url)),\n now: () => Date.now(),\n}\n\nlet deps = browserDeps\nlet installed = false\n/** The build is out of date: the next route navigation loads the page fresh. */\nlet stale = false\n/** A chunk the user needed failed: reload as soon as nothing would be lost. */\nlet reloadWanted = false\nlet lastActivity = 0\nlet idleTimer: ReturnType<typeof setInterval> | undefined\nlet restoreNavigation: (() => void) | null = null\n/** Fields the user typed into. */\nconst edited = new Set<Element>()\n/** Errors from `prefetchChunk` loads, so the preload-error handler can tell them apart. */\nconst prefetchFailures = new WeakSet<object>()\n\nfunction isTextField(el: Element): boolean {\n if (el instanceof HTMLInputElement) return !NON_TEXT_INPUTS.has(el.type)\n return el instanceof HTMLTextAreaElement || (el as HTMLElement).isContentEditable === true\n}\n\nfunction hasText(el: Element): boolean {\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n return el.value.trim() !== ''\n }\n return (el.textContent ?? '').trim() !== ''\n}\n\n/**\n * Whether reloading now could cost the user something: a sign-in form, a `[data-reload-guard]`\n * region, a focused text field, or a field they typed into that still holds text.\n */\nexport function hasUnsavedInput(doc: Document = document): boolean {\n if (doc.querySelector(GUARD_SELECTOR)) return true\n const active = doc.activeElement\n if (active && active !== doc.body && isTextField(active)) return true\n for (const el of edited) {\n if (!el.isConnected) edited.delete(el)\n else if (hasText(el)) return true\n }\n return false\n}\n\n/** Take this tab's reload slot. False within the guard window, or when storage can't record it. */\nfunction claimReload(): boolean {\n const now = deps.now()\n let last = 0\n try {\n last = Number(sessionStorage.getItem(CHUNK_RELOAD_KEY)) || 0\n } catch {\n // Unreadable: treat as never reloaded. Writing below decides.\n }\n if (last && now - last < RELOAD_GUARD_MS) return false\n try {\n sessionStorage.setItem(CHUNK_RELOAD_KEY, String(now))\n } catch {\n // Without the guard we can't tell a loop from a stale build: don't risk one.\n return false\n }\n return true\n}\n\nfunction guardHot(): boolean {\n try {\n const last = Number(sessionStorage.getItem(CHUNK_RELOAD_KEY)) || 0\n return !!last && deps.now() - last < RELOAD_GUARD_MS\n } catch {\n return false\n }\n}\n\nfunction settle(): void {\n stale = false\n reloadWanted = false\n if (idleTimer !== undefined) clearInterval(idleTimer)\n idleTimer = undefined\n restoreNavigation?.()\n restoreNavigation = null\n}\n\nfunction reloadNow(): boolean {\n if (!claimReload()) {\n settle()\n return false\n }\n settle()\n deps.reload()\n return true\n}\n\n/** A client-side navigation to `url` becomes a full page load of it while the build is stale. */\nfunction loadsFresh(url: string | URL | null | undefined): string | null {\n if (!stale || url == null) return null\n const target = new URL(String(url), window.location.href)\n if (target.pathname === window.location.pathname) return null\n // Leaving a sign-in page establishes the session: a full load there races its persistence.\n if (document.querySelector(GUARD_SELECTOR)) return null\n return target.href\n}\n\nfunction interceptNavigation(): void {\n if (restoreNavigation) return\n const history = window.history\n const push = history.pushState\n const replace = history.replaceState\n let shownPath = window.location.pathname\n const wrap = (original: History['pushState'], replaceEntry: boolean): History['pushState'] =>\n function (this: History, data, unused, url) {\n const target = loadsFresh(url)\n if (target && claimReload()) {\n settle()\n deps.load(target, replaceEntry)\n return\n }\n original.call(this, data, unused, url)\n shownPath = window.location.pathname\n }\n history.pushState = wrap(push, false)\n history.replaceState = wrap(replace, true)\n // Back/forward already changed the address: reloading loads that target.\n const onPopState = () => {\n if (window.location.pathname === shownPath) return\n shownPath = window.location.pathname\n if (!document.querySelector(GUARD_SELECTOR)) reloadNow()\n }\n window.addEventListener('popstate', onPopState)\n restoreNavigation = () => {\n history.pushState = push\n history.replaceState = replace\n window.removeEventListener('popstate', onPopState)\n }\n}\n\nfunction watchForIdle(): void {\n if (idleTimer !== undefined) return\n idleTimer = setInterval(() => {\n if (!reloadWanted) return\n const idle = document.visibilityState === 'hidden' || deps.now() - lastActivity >= IDLE_MS\n if (idle && !hasUnsavedInput()) reloadNow()\n }, IDLE_CHECK_MS)\n}\n\n/**\n * The running build is out of date (a chunk 404'd, or a new service worker took over): the next\n * route navigation loads its target fresh instead of rendering it client-side.\n */\nexport function markBuildStale(): void {\n stale = true\n interceptNavigation()\n}\n\nexport type ReloadOutcome = 'reloaded' | 'deferred' | 'guarded'\n\n/**\n * Reload onto the current build when nothing would be lost; otherwise defer to the next route\n * navigation or to the moment the user is idle with nothing unsaved. `guarded` means a policy\n * reload just happened in this tab, so the failure should surface instead.\n */\nexport function requestReload(): ReloadOutcome {\n if (guardHot()) return 'guarded'\n if (!hasUnsavedInput()) return reloadNow() ? 'reloaded' : 'guarded'\n reloadWanted = true\n markBuildStale()\n watchForIdle()\n return 'deferred'\n}\n\n/**\n * Load a chunk ahead of need (warming a route the user may open next). Never rejects, and a\n * failure never reloads the page: it only marks the build stale so the next navigation loads\n * fresh.\n */\nexport function prefetchChunk(load: () => Promise<unknown>): Promise<void> {\n let loading: Promise<unknown>\n try {\n loading = load()\n } catch (error) {\n loading = Promise.reject(error)\n }\n return loading.then(\n () => undefined,\n (error: unknown) => {\n if (typeof error === 'object' && error !== null) prefetchFailures.add(error)\n }\n )\n}\n\nfunction decide(payload: unknown): void {\n const prefetch = typeof payload === 'object' && payload !== null && prefetchFailures.has(payload)\n // Offline the chunk simply couldn't be downloaded (it isn't cached yet). Reloading can't fix\n // that and would throw away what's on screen; say what happened instead, and let the failed\n // import reach the nearest error boundary as usual.\n if (typeof navigator !== 'undefined' && navigator.onLine === false) {\n if (!prefetch) {\n notify.warning(\"This part of ARBI isn't available offline yet\", {\n description: 'Reconnect to open it. Once you have, it will work offline too.',\n })\n }\n return\n }\n markBuildStale()\n if (prefetch) return\n const outcome = requestReload()\n console.warn(`[chunk] A code chunk failed to load (stale build?): ${outcome}`, payload)\n}\n\n/**\n * The `vite:preloadError` handler. Decides once the failed import's own handlers have run, so a\n * `prefetchChunk` failure is known as one. Never cancels the event: the import rejects as usual\n * and, if a reload follows, the page is replaced anyway.\n */\nexport function handleChunkLoadError(event: Event): void {\n const payload = (event as Event & { payload?: unknown }).payload\n setTimeout(() => decide(payload), 0)\n}\n\nfunction onActivity(event: Event): void {\n lastActivity = deps.now()\n if (event.type === 'input' && event.target instanceof Element && isTextField(event.target)) {\n edited.add(event.target)\n }\n}\n\nconst ACTIVITY_EVENTS = ['input', 'keydown', 'pointerdown', 'wheel', 'touchstart'] as const\n\n/** Install the reload policy. Call once at startup; later calls are no-ops. */\nexport function installReloadPolicy(overrides: Partial<ReloadPolicyDeps> = {}): void {\n deps = { ...browserDeps, ...overrides }\n if (installed || typeof window === 'undefined') return\n installed = true\n lastActivity = deps.now()\n window.addEventListener('vite:preloadError', handleChunkLoadError)\n for (const type of ACTIVITY_EVENTS) {\n document.addEventListener(type, onActivity, { capture: true, passive: true })\n }\n}\n\n/** Undo `installReloadPolicy` and forget all state (tests). */\nexport function resetReloadPolicy(): void {\n settle()\n edited.clear()\n if (installed) {\n window.removeEventListener('vite:preloadError', handleChunkLoadError)\n for (const type of ACTIVITY_EVENTS) document.removeEventListener(type, onActivity, true)\n }\n installed = false\n deps = browserDeps\n}\n","import { useId, type MouseEvent, type ReactNode } from 'react'\nimport type { ShellActionLayout } from './types'\n\nexport interface ActionClusterProps {\n /**\n * `bar`: one row for a page header or phone app bar (status, bell, contacts, account).\n * `sidebar`: the bottom of the expanded sidebar: the bell and contacts rows stacked above the\n * account row.\n * `rail`: the same stack on the icon-only rail (same order, icon-only rows).\n * `drawer`: the phone drawer's rows (bell and contacts only; the app bar carries the account).\n */\n layout?: ShellActionLayout\n /** Status pill (remote control); `bar` only. Other layouts show status in their own rows. */\n status?: ReactNode\n /** Report a problem (bug icon), first in the cluster. */\n report?: ReactNode\n /** Notification bell (the kit's NotificationBell, or a `Sidebar.BadgeRow`). */\n mail?: ReactNode\n /** Calendar entry (a `Sidebar.BadgeRow`), right after mail. */\n calendar?: ReactNode\n /** Databases entry (a `Sidebar.BadgeRow`), right after calendar. */\n databases?: ReactNode\n bell?: ReactNode\n /** Contacts / messages entry with its own badge (a `Sidebar.BadgeRow`). */\n contacts?: ReactNode\n /** Account menu (the kit's UserMenu). */\n account?: ReactNode\n /**\n * Names the cluster: the group's accessible name in every layout, and a visible heading above\n * the rows in the `drawer` layout (where phones otherwise get unlabelled rows).\n */\n label?: string\n 'data-testid'?: string\n}\n\n/**\n * The account area: notifications, contacts and the account menu, in one of four placements. In\n * the sidebar and on the rail the two badge rows are stacked above the account row in the same\n * order, so nothing moves when the rail expands; the account menu holds everything else (help,\n * settings, tips, processing).\n */\nexport function ActionCluster({\n layout = 'bar',\n status,\n report,\n mail,\n calendar,\n databases,\n bell,\n contacts,\n account,\n label,\n 'data-testid': testId = 'sidebar-actions',\n}: ActionClusterProps) {\n const labelId = useId()\n // Dashboard's content area resets focus on click, and Radix PORTALS bubble through the React\n // tree: stop clicks here or a dropdown item (e.g. \"View all\") would un-focus the panel it opened.\n const stop = (e: MouseEvent) => e.stopPropagation()\n\n if (layout === 'sidebar' || layout === 'rail' || layout === 'drawer') {\n const rail = layout === 'rail'\n return (\n <div\n className={rail ? 'flex flex-col items-center gap-0.5' : 'flex flex-col gap-0.5'}\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-labelledby={label && layout === 'drawer' ? labelId : undefined}\n aria-label={label && layout !== 'drawer' ? label : undefined}\n data-slot=\"action-cluster\"\n data-layout={layout}\n data-testid={testId}\n >\n {label && layout === 'drawer' && (\n <p\n id={labelId}\n className=\"px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground\"\n data-slot=\"action-cluster-label\"\n >\n {label}\n </p>\n )}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account && layout !== 'drawer' && (\n <div className={rail ? 'mt-1' : 'mt-1 min-w-0'}>{account}</div>\n )}\n </div>\n )\n }\n\n return (\n <div\n className=\"flex items-center gap-1\"\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-label={label}\n data-slot=\"action-cluster\"\n >\n {status}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account}\n </div>\n )\n}\n","/**\n * DockZone Component\n *\n * Layout wrapper that provides a resizable right-hand panel area (#dock-zone)\n * where panels in 'docked' mode render via PanelPortal.\n *\n * Uses MutationObserver on the #dock-zone element to detect when content is\n * portaled in/out, so the split layout appears only when a panel is actually\n * mounted — not just when the store says a panel prefers 'docked' mode.\n *\n * The dock zone reads its initial width from the child's data-dock-width\n * attribute (pixels). If absent, defaults to 50% of the container.\n *\n * Below MOBILE_BREAKPOINT_PX, MIN_MAIN_PX + MIN_DOCK_PX (500px combined)\n * can't both fit — the clamp math still ran unconditionally and squeezed the\n * dock pane down to whatever sliver was left (as little as ~90px on a 390px\n * phone), rendering both panes as unusable slivers instead of showing either\n * one properly. Below that width this becomes a single full-width view that\n * swaps between main and docked content instead of splitting — same\n * principle as the Document Viewer's own view-swap (Edit ⇄ Track Changes).\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nconst MIN_DOCK_PX = 200\nconst MIN_MAIN_PX = 300\n// Standard right-panel width — matches the overlay sheet (sm:w-[34rem]) so a\n// panel is the same size whether it's pinned or floating. Pinned stays\n// draggable from here; floating is fixed.\nconst DEFAULT_DOCK_PX = 544\nconst MOBILE_BREAKPOINT_PX = 640\n\ninterface DockZoneProps {\n children: React.ReactNode\n 'data-testid'?: string\n}\n\nexport function DockZone({ children, ...props }: DockZoneProps) {\n const [hasDockedContent, setHasDockedContent] = useState(false)\n const [dockWidth, setDockWidth] = useState<number | null>(null)\n const [isResizing, setIsResizing] = useState(false)\n const [dragPosition, setDragPosition] = useState<number | null>(null)\n const [containerWidth, setContainerWidth] = useState(0)\n const containerRef = useRef<HTMLDivElement>(null)\n const dockZoneRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const el = containerRef.current\n if (!el) return\n const observer = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width\n if (width !== undefined) setContainerWidth(width)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n const isMobile = containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT_PX\n\n // Observe dock-zone children to know when content is actually portaled in\n // Also read initial width from the child's data-dock-width attribute\n useEffect(() => {\n const el = dockZoneRef.current\n if (!el) return\n\n const update = () => {\n const hasChildren = el.children.length > 0\n setHasDockedContent(hasChildren)\n if (hasChildren) {\n const requestedWidth = el.firstElementChild?.getAttribute('data-dock-width')\n if (requestedWidth) {\n setDockWidth(parseInt(requestedWidth, 10))\n }\n }\n }\n\n const observer = new MutationObserver(update)\n update()\n observer.observe(el, { childList: true })\n return () => observer.disconnect()\n }, [])\n\n const handleMouseDown = useCallback(() => {\n setIsResizing(true)\n setDragPosition(null)\n }, [])\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || !containerRef.current) return\n const rect = containerRef.current.getBoundingClientRect()\n const x = e.clientX - rect.left\n // Clamp so neither pane gets too small\n const clamped = Math.min(Math.max(x, MIN_MAIN_PX), rect.width - MIN_DOCK_PX)\n setDragPosition(clamped)\n },\n [isResizing]\n )\n\n const handleMouseUp = useCallback(() => {\n if (dragPosition !== null && containerRef.current) {\n const containerWidth = containerRef.current.getBoundingClientRect().width\n setDockWidth(containerWidth - dragPosition)\n }\n setIsResizing(false)\n setDragPosition(null)\n }, [dragPosition])\n\n useEffect(() => {\n if (!isResizing) return\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, handleMouseMove, handleMouseUp])\n\n // Below the mobile breakpoint there's no room to split at all — MIN_MAIN_PX\n // + MIN_DOCK_PX alone is 500px, wider than most phones. Show whichever\n // side is active at full width instead of squeezing both into slivers.\n const effectiveDockWidth =\n hasDockedContent && containerWidth > 0\n ? isMobile\n ? containerWidth\n : Math.min(\n Math.max(dockWidth ?? DEFAULT_DOCK_PX, MIN_DOCK_PX),\n containerWidth - MIN_MAIN_PX\n )\n : 0\n const mainHidden = isMobile && hasDockedContent\n\n return (\n <div ref={containerRef} className=\"h-full relative flex\" data-testid={props['data-testid']}>\n <div\n style={{\n width: mainHidden ? 0 : `calc(100% - ${effectiveDockWidth}px)`,\n // Reserve gutter space so the vertical scrollbar doesn't appear and\n // disappear as streaming content crosses the viewport boundary —\n // that toggle reflows the layout and reads as a screen-wide flicker.\n scrollbarGutter: 'stable',\n }}\n className={cn(\n // The CSS container for the page's @-variants (PageContainer must not be one; see there).\n '@container h-full overflow-auto',\n hasDockedContent && !isMobile && 'border-r',\n mainHidden && 'overflow-hidden',\n // Animate opening only. On close the portaled content has already\n // unmounted, so animating leaves an empty strip shrinking while the\n // page behind reflows — reads as flicker over heavy content like the\n // documents grid. Snap closed instead. Resizing is also instant so\n // the divider doesn't lag the cursor.\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n aria-hidden={mainHidden}\n inert={mainHidden}\n data-scroll-container\n >\n {children}\n </div>\n\n {/* Wide grab zone with a visible grip, so the divider is findable and forgiving to hit */}\n {hasDockedContent && !isMobile && (\n <div\n className=\"group flex w-2 flex-shrink-0 cursor-col-resize items-center justify-center\"\n onMouseDown={handleMouseDown}\n data-testid=\"dock-resize-handle\"\n >\n <div className=\"h-12 w-1 rounded-full bg-muted-foreground/40 transition-colors group-hover:bg-primary\" />\n </div>\n )}\n\n <div\n ref={dockZoneRef}\n id=\"dock-zone\"\n style={{ width: effectiveDockWidth }}\n className={cn(\n 'h-full overflow-hidden flex-shrink-0',\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n />\n\n {isResizing && dragPosition !== null && (\n <div\n className=\"absolute top-0 bottom-0 w-0.5 bg-primary z-50 pointer-events-none\"\n style={{ left: dragPosition }}\n />\n )}\n {isResizing && <div className=\"absolute inset-0 z-40 cursor-col-resize\" />}\n </div>\n )\n}\n","/**\n * PanelModeSwitcher Component\n *\n * User-selectable placements are: popped out, docked, or overlay. `main` is\n * NOT user-selectable — the system decides which surfaces render full-width\n * (e.g. the DM modal); the user just moves floating panels between popout /\n * docked / overlay. The switcher shows a button for each placement you're not\n * currently in (plus close):\n * - Popout/pop-in toggle (unless disablePopout).\n * - Split-screen button (when not docked).\n * - Float-as-overlay button (when not overlay).\n * - Popout mode shows just the pop-in toggle (the window has its own close).\n */\n\nimport { Button, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { ExternalLink, PanelRight, PictureInPicture2, X } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport type { ArbiPanelMode as PanelMode } from '@arbidocs/react'\nimport { useIsPhone, useMediaQuery } from '../lib/use-media-query'\n\nconst btnClass = 'h-7 w-7 p-0 text-muted-foreground hover:text-foreground'\n\ninterface SwitcherButtonProps {\n label: string\n /** True when rendered inside a popout window (see note below). */\n inPopout?: boolean\n onClick: () => void\n testId: string\n children: ReactNode\n}\n\n// Icon-only buttons get a visible tooltip with their label, so the icon's meaning\n// is readable on hover and on keyboard focus. Radix tooltips portal into the main\n// window, which would misplace them inside a popout window, so there we fall back\n// to a native title.\nfunction SwitcherButton({\n label,\n inPopout = false,\n onClick,\n testId,\n children,\n}: SwitcherButtonProps) {\n const button = (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={btnClass}\n aria-label={label}\n title={inPopout ? label : undefined}\n onClick={onClick}\n data-testid={testId}\n >\n {children}\n </Button>\n )\n if (inPopout) return button\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n )\n}\n\n// \"Open in new window\" (popout) and \"Float as overlay\" are desktop-only\n// window-management concepts — a tablet has no multi-window/overlay chrome to\n// pop into. 1024px mirrors the common tablet/small-laptop cutoff (Tailwind's\n// `lg`) and matches WorkspaceTopbar's own matchMedia convention for\n// viewport-driven chrome (as opposed to DocumentViewer's container-width\n// ResizeObserver, which fits ITS OWN toolbar buttons reflowing inside a panel\n// that can be split narrow on a wide desktop — PanelModeSwitcher instead needs\n// to know the actual device class, since popping into \"a new window\" or\n// \"floating overlay\" is meaningless on a touch tablet regardless of how the\n// panel happens to be sized in that moment). Deliberately separate from\n// `useIsPhone` (640px, phones only): this only needs to hide these two\n// buttons, not collapse the whole switcher, at tablet widths.\nconst TABLET_AND_BELOW_QUERY = '(max-width: 1024px)'\n\ninterface PanelModeSwitcherProps {\n mode: PanelMode\n onModeChange: (mode: PanelMode) => void\n onClose?: () => void\n /** When true, hides the popout button (e.g. for panels whose content breaks in a popup window) */\n disablePopout?: boolean\n /**\n * Override the close-button data-testid. Defaults to `dialog-close-button`\n * for backwards compatibility. Use a panel-specific value (e.g.\n * `close-viewer-button`) when there are multiple PanelModeSwitchers in the\n * DOM at once and tests need to disambiguate.\n */\n closeTestId?: string\n}\n\nexport function PanelModeSwitcher({\n mode,\n onModeChange,\n onClose,\n disablePopout,\n closeTestId = 'dialog-close-button',\n}: PanelModeSwitcherProps) {\n const isPopout = mode === 'popout'\n const isSmallScreen = useIsPhone()\n const isTabletAndBelow = useMediaQuery(TABLET_AND_BELOW_QUERY)\n\n const closeButton = onClose && (\n <SwitcherButton label=\"Close (Esc)\" onClick={onClose} testId={closeTestId}>\n <X className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )\n\n // Phones: every panel is an overlay and mode-switching is disabled, so only\n // the close ✕ is meaningful.\n if (isSmallScreen) {\n return <div className=\"flex items-center gap-0.5 flex-shrink-0\">{closeButton}</div>\n }\n\n return (\n <div className=\"flex items-center gap-0.5 flex-shrink-0\">\n {/* Popout / pop-in toggle — hidden when disablePopout is set, or on\n tablet-and-below where \"a new window\" isn't a real concept. */}\n {!disablePopout && !isTabletAndBelow && (\n <SwitcherButton\n label={isPopout ? 'Pop back in' : 'Open in new window'}\n inPopout={isPopout}\n onClick={() => onModeChange(isPopout ? 'docked' : 'popout')}\n testId={isPopout ? 'pop-into-main-window-button' : 'open-in-new-window-button'}\n >\n <ExternalLink className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* Split-screen (docked to the side) — shown when not already in it */}\n {!isPopout && mode !== 'docked' && (\n <SwitcherButton\n label=\"Split screen\"\n onClick={() => onModeChange('docked')}\n testId=\"dock-panel-button\"\n >\n <PanelRight className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* Float as an overlay sheet — shown when not already an overlay, and\n not on tablet-and-below (no floating-window chrome to speak of). */}\n {!isPopout && mode !== 'overlay' && !isTabletAndBelow && (\n <SwitcherButton\n label=\"Float as overlay\"\n onClick={() => onModeChange('overlay')}\n testId=\"overlay-panel-button\"\n >\n <PictureInPicture2 className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* All non-popout modes: ✕ to close */}\n {!isPopout && closeButton}\n </div>\n )\n}\n","/**\n * Window Manager for Pop-out Panels\n *\n * Handles creating, managing, and communicating with popup windows\n */\n\ninterface PopupWindow {\n id: string\n window: Window\n panelId: string\n rootElement: HTMLElement | null\n onClose?: () => void\n}\n\n/** Window lifecycle port; hosts may share or replace the browser implementation. */\nexport interface PanelWindows {\n createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null\n getWindow(windowId: string): Window | null\n getRootElement(windowId: string): HTMLElement | null\n focusPanelWindow(panelId: string): boolean\n clearOnClose(windowId: string): void\n closeWindow(windowId: string): void\n closeAllWindows(): void\n}\n\nexport class PanelWindowManager implements PanelWindows {\n constructor(private readonly defaultTitle = 'Panel') {}\n private windows = new Map<string, PopupWindow>()\n\n createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null {\n const windowId = `panel-window-${panelId}`\n\n // Check if window already exists\n if (this.windows.has(windowId)) {\n const existing = this.windows.get(windowId)\n if (existing && !existing.window.closed) {\n existing.window.focus()\n return windowId\n } else {\n // Clean up closed window\n this.windows.delete(windowId)\n }\n }\n\n // Position popup in the right half of the screen\n const currentWidth = window.outerWidth\n const currentHeight = window.outerHeight\n const currentLeft = window.screenX ?? window.screenLeft ?? 0\n const currentTop = window.screenY ?? window.screenTop ?? 0\n\n // Calculate popup position (right half)\n const halfWidth = Math.floor(currentWidth / 2)\n const popupWidth = halfWidth\n const popupHeight = currentHeight\n const left = currentLeft + halfWidth\n const top = currentTop\n\n const popup = window.open(\n '',\n windowId,\n `width=${popupWidth},height=${popupHeight},left=${left},top=${top},scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=no`\n )\n\n if (!popup) {\n console.error('Failed to create popup window - popup blocked?')\n return null\n }\n\n // Set up the popup window HTML with proper CSS links\n const mainDocument = document\n const stylesheets = Array.from(\n mainDocument.head.querySelectorAll('link[rel=\"stylesheet\"], style')\n )\n .map((el) => el.outerHTML)\n .join('\\n')\n\n popup.document.write(`\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title></title>\n <!-- about:blank has no base, so copied @font-face / asset URLs (e.g.\n /assets/font.woff2) would resolve against nothing and render as\n tofu squares. Anchor relative URLs to the app origin. -->\n <base href=\"${window.location.origin}/\">\n ${stylesheets}\n <style>\n body {\n margin: 0;\n padding: 0;\n font-family: system-ui, -apple-system, sans-serif;\n }\n #panel-root {\n width: 100%;\n height: 100vh;\n overflow: hidden;\n }\n * {\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n <div id=\"panel-root\"></div>\n </body>\n </html>\n `)\n popup.document.close()\n // A host title is text, even when it contains HTML delimiters.\n popup.document.title = title || this.defaultTitle\n\n // Belt-and-suspenders: re-register the parent's already-loaded web fonts in\n // the popup's FontFaceSet, so glyphs render even if a copied @font-face\n // doesn't re-fetch. Best-effort — engines that reject a cross-document add\n // just fall back to the <base>-anchored @font-face rules above.\n try {\n mainDocument.fonts.forEach((font) => {\n try {\n popup.document.fonts.add(font)\n } catch {\n /* ignore per-font failures */\n }\n })\n } catch {\n /* FontFaceSet unavailable — ignore */\n }\n\n // Get root element after DOM is ready\n const rootElement = popup.document.getElementById('panel-root')\n\n // Store window reference\n const popupWindow: PopupWindow = {\n id: windowId,\n window: popup,\n panelId,\n rootElement,\n onClose,\n }\n this.windows.set(windowId, popupWindow)\n\n // Handle window close — read onClose from the map entry so clearOnClose() works\n const closeCheckInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(closeCheckInterval)\n const entry = this.windows.get(windowId)\n this.windows.delete(windowId)\n entry?.onClose?.()\n }\n }, 200)\n\n return windowId\n }\n\n getWindow(windowId: string): Window | null {\n const popup = this.windows.get(windowId)\n return popup && !popup.window.closed ? popup.window : null\n }\n\n getRootElement(windowId: string): HTMLElement | null {\n const popup = this.windows.get(windowId)\n return popup && !popup.window.closed ? popup.rootElement : null\n }\n\n /** Focus the popup window for a given panel ID. Returns true if focused. */\n focusPanelWindow(panelId: string): boolean {\n const windowId = `panel-window-panel-${panelId}`\n const popup = this.windows.get(windowId)\n if (popup && !popup.window.closed) {\n popup.window.focus()\n return true\n }\n return false\n }\n\n /** Remove the onClose callback so it won't fire when the window is closed programmatically. */\n clearOnClose(windowId: string): void {\n const popup = this.windows.get(windowId)\n if (popup) {\n popup.onClose = undefined\n }\n }\n\n closeWindow(windowId: string): void {\n const popup = this.windows.get(windowId)\n if (popup && !popup.window.closed) {\n popup.window.close()\n }\n this.windows.delete(windowId)\n }\n\n closeAllWindows(): void {\n for (const [, popup] of this.windows) {\n if (!popup.window.closed) {\n popup.window.close()\n }\n }\n this.windows.clear()\n }\n}\n\n/** A window registry shared by the host's panel controls and portal layer. */\nexport function createPanelWindowManager(options: { defaultTitle?: string } = {}) {\n return new PanelWindowManager(options.defaultTitle)\n}\n","import { useHost } from '../provider/host'\nimport { createPanelWindowManager, type PanelWindows } from './panel-windows'\n\n/** Browser windows and site-specific titles shared by a host's panel controls. */\nexport interface PanelHostSupport {\n windows?: PanelWindows\n popoutTitle?: (title: string) => string\n}\n\nconst defaultWindows = createPanelWindowManager()\nconst titleOnly = (title: string) => title\n\n/** Panel support from the existing ArbiHost; standalone panels share the browser defaults. */\nexport function usePanelHostSupport(): Required<PanelHostSupport> {\n const { panels } = useHost()\n return {\n windows: panels?.windows ?? defaultWindows,\n popoutTitle: panels?.popoutTitle ?? titleOnly,\n }\n}\n","/**\n * PanelPortal Component\n *\n * Thin portal layer that renders children into the right target based on panel mode:\n * - docked: portal to #dock-zone element\n * - overlay: portal to <body> as a slide-out sheet over a backdrop\n * - popout: portal to a separate browser window\n * - main: portal to #main-zone element\n *\n * Manages popup window lifecycle for popout mode.\n * Content-agnostic — just handles where things render.\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { DEFAULT_OVERLAY_ZONE_ID } from './Shell'\nimport { usePanelHostSupport } from './panel-host'\nimport { PortalContainerProvider } from '@arbidocs/react/ui'\nimport type { FloatingPanelMode as PanelMode } from '../settings/FloatingPanel'\n\n// Overlay sheet sizing — defaults match the docked width (DEFAULT_DOCK_PX) so a\n// panel is the same size whether pinned or floating, and stays draggable here.\nconst OVERLAY_DEFAULT_PX = 544\nconst OVERLAY_MIN_PX = 360\n\nexport interface PanelPortalProps {\n panelId: string\n mode: PanelMode\n isOpen: boolean\n /** True while the overlay is animating out before unmounting. */\n isExiting?: boolean\n /** Called when popup window is closed externally (user closes the window) */\n onPopupClosed?: () => void\n /** Dismisses the panel — used by the overlay backdrop. */\n onClose?: () => void\n /** Window title for popout mode */\n popoutTitle?: string\n /** Initial overlay width in px (defaults to OVERLAY_DEFAULT_PX). */\n defaultWidth?: number\n children: React.ReactNode\n}\n\n/**\n * Overlay sheet — a slide-out panel over the still-visible page, resizable by\n * dragging its left edge. Slides in on mount and out (via isExiting) before\n * unmounting, mirroring the left sidebar's animation.\n */\nfunction OverlaySheet({\n panelId,\n isExiting,\n onClose,\n defaultWidth,\n scoped,\n children,\n}: {\n panelId: string\n isExiting?: boolean\n onClose?: () => void\n defaultWidth?: number\n /** Rendered inside the layout's overlay zone (below the topbar) rather than\n * over the whole viewport. */\n scoped?: boolean\n children: React.ReactNode\n}) {\n const [width, setWidth] = useState(defaultWidth ?? OVERLAY_DEFAULT_PX)\n const [isResizing, setIsResizing] = useState(false)\n // Live cursor position while dragging. The panel keeps its committed `width`\n // during the drag — only this thin preview line moves — so the heavy panel\n // content never reflows mid-drag (matching DockZone's split-screen handle).\n // The width is committed once on mouse-up.\n const [dragWidth, setDragWidth] = useState<number | null>(null)\n const dragWidthRef = useRef<number | null>(null)\n // Once the slide-in has played we drop the entry class, so later re-renders\n // don't restart the animation.\n const [hasEntered, setHasEntered] = useState(false)\n\n const handleResizeStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setHasEntered(true)\n setIsResizing(true)\n setDragWidth(null)\n dragWidthRef.current = null\n }, [])\n\n useEffect(() => {\n if (!isResizing) return\n const handleMouseMove = (e: MouseEvent) => {\n // Anchored to the right edge — width grows as the cursor moves left.\n const max = window.innerWidth * 0.92\n const next = Math.min(Math.max(window.innerWidth - e.clientX, OVERLAY_MIN_PX), max)\n dragWidthRef.current = next\n setDragWidth(next)\n }\n const handleMouseUp = () => {\n if (dragWidthRef.current !== null) setWidth(dragWidthRef.current)\n setIsResizing(false)\n setDragWidth(null)\n dragWidthRef.current = null\n }\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing])\n\n return (\n // Scoped: absolute within the layout's overlay zone (below the topbar).\n // Unscoped fallback: fixed over the whole viewport, as before.\n <div\n className={scoped ? 'absolute inset-0 z-40' : 'fixed inset-0 z-50'}\n data-testid={`${panelId}-overlay`}\n >\n {/* In dark mode a 40% black veil crushes the light page text behind the sheet to\n mid-grey, so the veil is lighter there and the page stays readable underneath. */}\n <div\n className={`absolute inset-0 bg-black/40 dark:bg-black/20 duration-200 ${\n // fill-mode-forwards holds the exit end-state — without it the\n // element snaps back fully visible for the frames between the\n // animation finishing and React unmounting it (a flicker).\n isExiting ? 'animate-out fade-out fill-mode-forwards' : 'animate-in fade-in'\n }`}\n onClick={onClose}\n aria-hidden=\"true\"\n data-testid={`${panelId}-overlay-backdrop`}\n />\n <div\n style={{ width }}\n onAnimationEnd={() => !isExiting && setHasEntered(true)}\n className={`absolute right-0 top-0 bottom-0 flex max-w-[92vw] flex-col border-l max-sm:!w-full max-sm:!max-w-full max-sm:border-l-0 border-border bg-muted shadow-2xl duration-200 ${\n isExiting\n ? 'animate-out slide-out-to-right fill-mode-forwards'\n : // Suppress the slide transform once entered so it doesn't replay.\n hasEntered\n ? ''\n : 'animate-in slide-in-from-right'\n }`}\n >\n {/* Drag handle on the left edge to resize the sheet. */}\n <div\n className=\"absolute left-0 top-0 bottom-0 z-10 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/40\"\n onMouseDown={handleResizeStart}\n data-testid={`${panelId}-overlay-resize-handle`}\n />\n {children}\n </div>\n\n {/* Preview line — tracks the cursor during the drag; the panel resizes\n to this position only on release. */}\n {isResizing && dragWidth !== null && (\n <div\n className=\"absolute top-0 bottom-0 z-[60] w-0.5 bg-primary pointer-events-none\"\n style={{ right: dragWidth }}\n />\n )}\n {/* Transparent capture layer so the drag isn't interrupted by elements\n (iframes, the grid) swallowing pointer events. */}\n {isResizing && <div className=\"absolute inset-0 z-[55] cursor-col-resize\" />}\n </div>\n )\n}\n\nexport function PanelPortal({\n panelId,\n mode,\n isOpen,\n isExiting,\n onPopupClosed,\n onClose,\n popoutTitle,\n defaultWidth,\n children,\n}: PanelPortalProps) {\n const { windows: windowManager } = usePanelHostSupport()\n const [popupRoot, setPopupRoot] = useState<HTMLElement | null>(null)\n const popupWindowIdRef = useRef<string | null>(null)\n\n // Open popup window when switching to popout mode\n useEffect(() => {\n if (!isOpen || mode !== 'popout') {\n // Close popup if we're leaving popout mode (intentional mode switch, not user closing)\n if (popupWindowIdRef.current) {\n // Clear the onClose callback before closing so it doesn't trigger onPopupClosed\n windowManager.clearOnClose(popupWindowIdRef.current)\n windowManager.closeWindow(popupWindowIdRef.current)\n popupWindowIdRef.current = null\n setPopupRoot(null)\n }\n return\n }\n\n // Already have a popup open\n if (popupWindowIdRef.current) return\n\n const windowId = windowManager.createPopupWindow(\n `panel-${panelId}`,\n () => {\n popupWindowIdRef.current = null\n setPopupRoot(null)\n onPopupClosed?.()\n },\n popoutTitle || panelId\n )\n\n if (windowId) {\n const rootElement = windowManager.getRootElement(windowId)\n if (rootElement) {\n popupWindowIdRef.current = windowId\n setPopupRoot(rootElement)\n windowManager.getWindow(windowId)?.focus()\n }\n }\n }, [isOpen, mode, panelId, popoutTitle, onPopupClosed, windowManager])\n\n // Clean up on unmount\n useEffect(() => {\n return () => {\n if (popupWindowIdRef.current) {\n windowManager.closeWindow(popupWindowIdRef.current)\n }\n }\n }, [windowManager])\n\n if (!isOpen && !isExiting) return null\n\n // Popout: render into popup window. Its dialogs and menus open there too, not in the window\n // behind it (where the Sign dialog used to open, out of sight).\n if (mode === 'popout' && popupRoot) {\n return createPortal(\n <PortalContainerProvider container={popupRoot}>{children}</PortalContainerProvider>,\n popupRoot\n )\n }\n\n // Overlay: a slide-out sheet over the still-visible page. Rendered into the\n // layout's #app-overlay-zone — the content region BELOW the app topbar — so\n // the bar stays visible and interactive above every overlay. Falls back to\n // <body> (viewport-covering) when no zone is mounted (e.g. embedded shells).\n if (mode === 'overlay') {\n const overlayZone = document.getElementById(DEFAULT_OVERLAY_ZONE_ID)\n return createPortal(\n <OverlaySheet\n panelId={panelId}\n isExiting={isExiting}\n onClose={onClose}\n defaultWidth={defaultWidth}\n scoped={overlayZone !== null}\n >\n {children}\n </OverlaySheet>,\n overlayZone ?? document.body\n )\n }\n\n // Main: render into main content zone\n if (mode === 'main') {\n const mainZone = document.getElementById('main-zone')\n if (mainZone) {\n return createPortal(children, mainZone)\n }\n }\n\n // Docked: render into dock zone\n const dockZone = document.getElementById('dock-zone')\n if (dockZone) {\n return createPortal(children, dockZone)\n }\n\n // No target zone mounted yet — render nothing\n return null\n}\n"]}
1
+ {"version":3,"sources":["../src/shell/sidebar-context.ts","../src/shell/SidebarBadgeRow.tsx","../src/lib/use-close-on-escape.ts","../src/lib/sidebar-mode.ts","../src/shell/use-sidebar-controller.ts","../src/shell/Workspace.tsx","../src/shell/reload-policy.ts","../src/shell/ActionCluster.tsx","../src/shell/DockZone.tsx","../src/shell/PanelModeSwitcher.tsx","../src/shell/panel-windows.ts","../src/shell/panel-host.ts","../src/shell/PanelPortal.tsx"],"names":["SidebarBadgeRow","useRef","useEffect","jsxs","jsx","cn","useState","useCallback","containerWidth","Tooltip","TooltipTrigger","TooltipContent"],"mappings":";;;;;;;;;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AAAA,MACpD;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,aAAa,CAAC,CAAA;AAElB,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,SAAA,EAAW,OAAO,IAAA;AAIlC,EAAA,IAAI,IAAA,KAAS,YAAY,SAAA,EAAW;AAClC,IAAA,OAAO,YAAA;AAAA,sBACLE,GAAAA,CAAC,uBAAA,EAAA,EAAwB,SAAA,EAAW,WAAY,QAAA,EAAS,CAAA;AAAA,MACzD;AAAA,KACF;AAAA,EACF;AAMA,EAAA,IAAI,SAAS,SAAA,EAAW;AACtB,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,cAAA,CAAe,uBAAuB,CAAA;AACnE,IAAA,OAAO,YAAA;AAAA,sBACLA,GAAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,SAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,QAAQ,WAAA,KAAgB,IAAA;AAAA,UAEvB;AAAA;AAAA,OACH;AAAA,MACA,eAAe,QAAA,CAAS;AAAA,KAC1B;AAAA,EACF;AAGA,EAAA,IAAI,SAAS,MAAA,EAAQ;AACnB,IAAA,MAAM,QAAA,GAAW,QAAA,CAAS,cAAA,CAAe,WAAW,CAAA;AACpD,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAO,YAAA,CAAa,UAAU,QAAQ,CAAA;AAAA,IACxC;AAAA,EACF;AAGA,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,cAAA,CAAe,WAAW,CAAA;AACpD,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,OAAO,YAAA,CAAa,UAAU,QAAQ,CAAA;AAAA,EACxC;AAGA,EAAA,OAAO,IAAA;AACT","file":"chunk-HPA4XNIC.js","sourcesContent":["import { createContext, useContext } from 'react'\n\n/** Fixed strings of the sidebar family. Set once on `Sidebar.Root`; parts read them from context. */\nexport interface SidebarLabels {\n /** The sidebar's accessible name (the Root `aria-label` prop wins). */\n mainNavigation: string\n hideSidebar: string\n showSidebar: string\n /** The drawer's close button (the `closeLabel` prop wins). */\n closeNavigationMenu: string\n}\n\nexport const DEFAULT_SIDEBAR_LABELS: SidebarLabels = {\n mainNavigation: 'Main navigation',\n hideSidebar: 'Hide sidebar',\n showSidebar: 'Show sidebar',\n closeNavigationMenu: 'Close navigation menu',\n}\n\nexport interface SidebarContextValue {\n /** Labels are visible (full width), as opposed to the icon-only rail. */\n expanded: boolean\n labels: SidebarLabels\n}\nexport const SidebarContext = createContext<SidebarContextValue>({\n expanded: true,\n labels: DEFAULT_SIDEBAR_LABELS,\n})\nexport const useSidebarContext = (): SidebarContextValue => useContext(SidebarContext)\n\n/** True while the surrounding row is hovered/focused; trailing controls may brighten on it. */\nexport const SidebarRowHoverContext = createContext(false)\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react'\nimport { cn, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { useSidebarContext } from './sidebar-context'\n\nexport interface SidebarBadgeRowProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'children'\n> {\n /** Glyph (20px). */\n icon: ReactNode\n /** Visible label of the expanded row; the tooltip of the icon-only rail. */\n label: string\n /** Unread/pending number. Hidden at 0 or `undefined`; values above 9 read \"9+\". */\n count?: number\n /**\n * Accessible name including the count, for example \"Notifications, 2 unread\". Defaults to\n * `label` plus the count.\n */\n ariaLabel?: string\n /**\n * `row`: a labelled row styled like the module rows, badge at the right. `icon`: icon-only with\n * the badge on the corner. Default follows the sidebar (`row` expanded, `icon` on the rail).\n */\n variant?: 'row' | 'icon'\n /** Test id of the count badge. */\n badgeTestId?: string\n}\n\n/**\n * A sidebar row that carries a badge and may open something (a panel, a popover): the\n * notifications and contacts rows above the account bar. A real button that forwards its ref and\n * rest props, so it can be a popover trigger (`<DropdownMenuTrigger asChild>`). The badge is\n * visible in both the expanded row and the icon-only rail, and the accessible name carries the\n * count in both.\n */\nexport const SidebarBadgeRow = forwardRef<HTMLButtonElement, SidebarBadgeRowProps>(\n function SidebarBadgeRow(\n { icon, label, count, ariaLabel, variant, badgeTestId, className, type = 'button', ...rest },\n ref\n ) {\n const { expanded } = useSidebarContext()\n const resolved = variant ?? (expanded ? 'row' : 'icon')\n const hasCount = count !== undefined && count > 0\n const badgeText = hasCount ? (count > 9 ? '9+' : String(count)) : null\n const name = ariaLabel ?? (hasCount ? `${label}, ${count}` : label)\n\n if (resolved === 'row') {\n return (\n <button\n ref={ref}\n type={type}\n aria-label={name}\n data-slot=\"sidebar-badge-row\"\n data-variant=\"row\"\n className={cn(\n 'group flex h-9 w-full cursor-pointer items-center rounded-md px-3 text-left text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:h-11',\n className\n )}\n {...rest}\n >\n <span className=\"flex size-5 flex-shrink-0 items-center justify-center\" aria-hidden>\n {icon}\n </span>\n <span className=\"ml-3 min-w-0 truncate\" aria-hidden>\n {label}\n </span>\n {badgeText && (\n <span\n aria-hidden\n data-testid={badgeTestId}\n className=\"ml-auto inline-flex min-w-5 flex-shrink-0 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold leading-5 tabular-nums text-primary-foreground\"\n >\n {badgeText}\n </span>\n )}\n </button>\n )\n }\n\n const iconButton = (\n <button\n ref={ref}\n type={type}\n aria-label={name}\n data-slot=\"sidebar-badge-row\"\n data-variant=\"icon\"\n title={variant === 'icon' ? label : undefined}\n className={cn(\n 'relative m-0 flex h-9 w-12 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:h-11',\n className\n )}\n {...rest}\n >\n <span className=\"flex size-5 items-center justify-center\" aria-hidden>\n {icon}\n </span>\n {badgeText && (\n <span\n aria-hidden\n data-testid={badgeTestId}\n className=\"absolute right-1 top-0.5 flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-semibold leading-4 tabular-nums text-primary-foreground\"\n >\n {badgeText}\n </span>\n )}\n </button>\n )\n // A standalone icon button (the page header) keeps its native title; the rail uses a tooltip.\n if (variant === 'icon') return iconButton\n return (\n <Tooltip delayDuration={50}>\n <TooltipTrigger asChild>{iconButton}</TooltipTrigger>\n <TooltipContent side=\"right\" sideOffset={8}>\n {label}\n </TooltipContent>\n </Tooltip>\n )\n }\n)\n","import { useEffect, useRef } from 'react'\n\n/**\n * While `isActive`, Escape calls `onClose`. For surfaces that float over the page without being a\n * modal (no backdrop, no focus trap), so nothing else closes them from the keyboard. An Escape a\n * dialog already handled (`defaultPrevented`) is left alone so one press closes one layer.\n */\nexport function useCloseOnEscape(isActive: boolean, onClose: () => void): void {\n const onCloseRef = useRef(onClose)\n useEffect(() => {\n onCloseRef.current = onClose\n })\n\n useEffect(() => {\n if (!isActive) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented) onCloseRef.current()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [isActive])\n}\n","import { useEffect, useRef, useState } from 'react'\n\n/**\n * Headless sidebar behaviour (no DOM, no store): how the sidebar lays out for a given set of\n * inputs, and the settle timing that keeps labels/tips from squeezing during the width transition.\n *\n * - `drawer` small-screen off-canvas panel (opened by the app bar's menu button)\n * - `collapsed` hidden (width 0): a phone with the drawer closed, or `isCollapsed`\n * - `pinned` full width, inline, pushes the content\n * - `rail` icon strip that floats open to full width while hovered\n */\nexport type SidebarMode = 'drawer' | 'collapsed' | 'pinned' | 'rail'\n\nexport interface SidebarModeInput {\n isSmallScreen: boolean\n /** The phone drawer was requested open. */\n isDrawerRequested: boolean\n isCollapsed: boolean\n isPinned: boolean\n isHovering: boolean\n /**\n * Tablet-width viewport (above the phone drawer breakpoint but too narrow to give the content a\n * usable column next to a 255px panel): pinning is ignored and the sidebar stays an icon rail.\n */\n isNarrow?: boolean\n}\n\nexport interface SidebarLayout {\n mode: SidebarMode\n /** Labels should be shown (the panel is, or is becoming, full width). */\n expanded: boolean\n /** Phones: nothing is rendered until the drawer opens. */\n hidden: boolean\n /** Hover state that actually applies (never on touch-sized screens). */\n hovering: boolean\n}\n\nexport function resolveSidebarLayout(input: SidebarModeInput): SidebarLayout {\n const { isSmallScreen, isDrawerRequested, isCollapsed, isPinned, isHovering } = input\n const canPin = isPinned && !isSmallScreen && !input.isNarrow\n const drawerOpen = isSmallScreen && isDrawerRequested\n // Small screens are drawer-only: when it is closed the panel is fully off-canvas\n // regardless of pinning (pinning is a desktop concept), and hover never expands.\n const effectiveCollapsed = isCollapsed || (isSmallScreen && !drawerOpen)\n const hovering = isHovering && !isSmallScreen\n\n let mode: SidebarMode\n if (drawerOpen) mode = 'drawer'\n else if (effectiveCollapsed) mode = 'collapsed'\n else if (canPin) mode = 'pinned'\n else mode = 'rail'\n\n // `hovering`, not `isHovering`: a stale hover flag must not report a hidden phone sidebar as expanded.\n const expanded = drawerOpen || (!effectiveCollapsed && (canPin || hovering))\n\n return { mode, expanded, hidden: isSmallScreen && !drawerOpen, hovering }\n}\n\n/**\n * Settle timing around the width transition (default 300ms):\n * - `labelsExpanded` switches on immediately but off only after the transition, so labels do not\n * snap to icon-only while the panel is still wide;\n * - `tipsVisible` is the opposite: width-bound content (a tip card) appears only once the panel\n * has fully opened and disappears the instant collapse starts.\n */\nexport function useSidebarSettle(expanded: boolean, settleMs = 300) {\n const [labelsExpanded, setLabelsExpanded] = useState(expanded)\n const [tipsVisible, setTipsVisible] = useState(expanded)\n const labelsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const tipsTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useEffect(() => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n if (expanded) setLabelsExpanded(true)\n else labelsTimer.current = setTimeout(() => setLabelsExpanded(false), settleMs)\n return () => {\n if (labelsTimer.current) clearTimeout(labelsTimer.current)\n }\n }, [expanded, settleMs])\n\n useEffect(() => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n if (expanded) tipsTimer.current = setTimeout(() => setTipsVisible(true), settleMs)\n else setTipsVisible(false)\n return () => {\n if (tipsTimer.current) clearTimeout(tipsTimer.current)\n }\n }, [expanded, settleMs])\n\n return { labelsExpanded, tipsVisible }\n}\n","import { useCallback, useEffect, useRef } from 'react'\nimport { useControllableState } from '../lib/useControllableState'\nimport { useCloseOnEscape } from '../lib/use-close-on-escape'\nimport { useIsNarrow, useIsPhone, useIsTouchScreen } from '../lib/use-media-query'\nimport { resolveSidebarLayout, useSidebarSettle, type SidebarLayout } from '../lib/sidebar-mode'\nimport type { SidebarRootProps } from './Sidebar'\n\nexport interface UseSidebarControllerOptions {\n /** Pinned open (desktop). Controlled when set; otherwise kept here, seeded by `defaultPinned`. */\n isPinned?: boolean\n /** Default `true`. */\n defaultPinned?: boolean\n onPinnedChange?: (isPinned: boolean) => void\n /** The rail is floated open (hover, or its toggle at a narrow width). Controlled when set. */\n isHovering?: boolean\n onHoveringChange?: (isHovering: boolean) => void\n /** The phone drawer is open. Controlled when set (the app bar's menu button opens it). */\n isDrawerOpen?: boolean\n onDrawerOpenChange?: (isDrawerOpen: boolean) => void\n /**\n * Keep the sidebar a rail even when pinned, on top of the tablet width (for example while a\n * docked panel squeezes the content). The stored pin is left untouched.\n */\n forceRail?: boolean\n /**\n * Which rails expand on mouseenter. The default ignores narrow and emulated touch hover;\n * `all` retains hover expansion for a host whose narrow rail has no separate expand button.\n */\n hoverExpansion?: 'desktop-pointer' | 'all'\n}\n\n/** The `Sidebar.Root` props the controller resolves. */\nexport type SidebarControllerRootProps = Pick<\n SidebarRootProps,\n | 'mode'\n | 'expanded'\n | 'isHovering'\n | 'onBackdropClick'\n | 'hasRailBackdrop'\n | 'onMouseEnter'\n | 'onMouseLeave'\n>\n\nexport interface SidebarController {\n layout: SidebarLayout\n /** Labels shown (settled: they stay on until the closing transition ends). */\n expanded: boolean\n /** Width-bound content (tips, notices) may show: on once fully open, off as closing starts. */\n tipsVisible: boolean\n /** The phone drawer is showing. */\n isDrawer: boolean\n isSmallScreen: boolean\n /** Tablet width (or `forceRail`): pinning is ignored and the sidebar stays a rail. */\n isNarrow: boolean\n /** The pin as it applies (always off while narrow). */\n isPinned: boolean\n /** Spread onto `Sidebar.Root` (or pass the controller to `ShellSidebar`). */\n rootProps: SidebarControllerRootProps\n openDrawer: () => void\n closeDrawer: () => void\n /** The pin toggle: pins/unpins, or floats the rail open/closed while narrow. */\n togglePin: () => void\n /** Open from the rail (its ask button): pins, or floats the rail open while narrow. */\n expand: () => void\n /** After a nav row is chosen: closes the drawer, and a floated rail the pointer has left. */\n afterNavigate: () => void\n}\n\n// A menu opened from the rail (the account menu) is positioned against the sidebar's current\n// layout. Hovering that menu from the content would expand the rail, re-anchor the menu under\n// the pointer and move the item being clicked, so hover does not expand the rail while one is open.\nconst isMenuOpen = () =>\n typeof document !== 'undefined' &&\n document.querySelector('[role=\"menu\"][data-state=\"open\"]') !== null\n\n/**\n * Sidebar behaviour as one hook, shared by every shell: resolves the layout (drawer / pinned /\n * rail) for the viewport, settles labels and tips around the width transition, and owns the hover,\n * pin and drawer rules:\n * - touch: the rail opens only through its toggle, never by the emulated mouseenter of a tap;\n * - narrow: a pointer drifting over the rail does not float the labels over the content;\n * - Escape closes a floated rail; the drawer closes itself when the viewport grows past a phone;\n * - choosing a row closes the drawer, and a floated rail unless the pointer is still over it.\n *\n * State is controlled per field (`isPinned`, `isHovering`, `isDrawerOpen`) so an app can keep it\n * in its own store, or uncontrolled for a shell that does not care.\n */\nexport function useSidebarController(options: UseSidebarControllerOptions = {}): SidebarController {\n const [storedPinned, setPinned] = useControllableState(\n options.isPinned,\n options.defaultPinned ?? true,\n options.onPinnedChange\n )\n const [isHovering, setHovering] = useControllableState(\n options.isHovering,\n false,\n options.onHoveringChange\n )\n const [isDrawerOpen, setDrawerOpen] = useControllableState(\n options.isDrawerOpen,\n false,\n options.onDrawerOpenChange\n )\n\n const isSmallScreen = useIsPhone()\n const isNarrow = useIsNarrow() || !!options.forceRail\n const isTouch = useIsTouchScreen()\n\n const layout = resolveSidebarLayout({\n isSmallScreen,\n isDrawerRequested: isDrawerOpen,\n isCollapsed: false,\n isPinned: storedPinned,\n isHovering,\n isNarrow,\n })\n const isDrawer = layout.mode === 'drawer'\n const { labelsExpanded, tipsVisible } = useSidebarSettle(layout.expanded)\n\n // Whether the pointer is physically over the sidebar (decides if navigating closes the rail).\n const isPointerOver = useRef(false)\n\n const closeDrawer = useCallback(() => setDrawerOpen(false), [setDrawerOpen])\n const openDrawer = useCallback(() => setDrawerOpen(true), [setDrawerOpen])\n\n // The floated rail has no modal behaviour (the drawer gets Escape from `Sidebar.Root`).\n useCloseOnEscape(layout.mode === 'rail' && layout.hovering, () => setHovering(false))\n\n // A drawer left open when the viewport grows past a phone (rotate/resize) would be a stuck overlay.\n useEffect(() => {\n if (isDrawerOpen && !isSmallScreen) setDrawerOpen(false)\n }, [isDrawerOpen, isSmallScreen, setDrawerOpen])\n\n const onMouseEnter = () => {\n if (isTouch && options.hoverExpansion !== 'all') return\n isPointerOver.current = true\n if (\n !isSmallScreen &&\n (!isNarrow || options.hoverExpansion === 'all') &&\n (!isMenuOpen() || options.hoverExpansion === 'all')\n )\n setHovering(true)\n }\n const onMouseLeave = () => {\n if (isTouch && options.hoverExpansion !== 'all') return\n isPointerOver.current = false\n if (!isSmallScreen) setHovering(false)\n }\n\n return {\n layout,\n expanded: labelsExpanded,\n tipsVisible,\n isDrawer,\n isSmallScreen,\n isNarrow,\n isPinned: storedPinned && !isNarrow,\n rootProps: {\n mode: layout.mode,\n expanded: labelsExpanded,\n isHovering: layout.hovering,\n onBackdropClick: isDrawer ? closeDrawer : () => setHovering(false),\n hasRailBackdrop: isTouch,\n onMouseEnter,\n onMouseLeave,\n },\n openDrawer,\n closeDrawer,\n togglePin: () => (isNarrow ? setHovering(!isHovering) : setPinned(!storedPinned)),\n expand: () => (isNarrow ? setHovering(true) : setPinned(true)),\n afterNavigate: () => {\n if (!isPointerOver.current && !storedPinned) setHovering(false)\n if (isDrawer) closeDrawer()\n },\n }\n}\n","import type { ComponentType } from 'react'\nimport { ChevronDown, Globe, LayoutGrid, Lock, Plus, Users } from 'lucide-react'\nimport {\n cn,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '@arbidocs/react/ui'\nimport { prefixedTestId, testIdOr } from '../chat/test-id'\nimport type { ShellRecentWorkspace, ShellWorkspace, ShellWorkspaceKind } from './types'\n\n/** The three workspace-kind names (badge title, type glyph name, subtitle). */\nexport interface WorkspaceKindLabels {\n common: string\n shared: string\n private: string\n}\n\nexport const DEFAULT_WORKSPACE_KIND_LABELS: WorkspaceKindLabels = {\n common: 'Common',\n shared: 'Shared',\n private: 'Private',\n}\n\n/**\n * Workspace type drives the initial-badge fill and a quiet secondary glyph:\n * private (just you) -> navy, lock shared (several) -> selection tint, people\n * common (public) -> neutral, globe\n * Navy is identity and cyan is reserved for ARBI/AI, so \"shared\" is the selection tint.\n */\nexport function workspaceKindMeta(\n kind: ShellWorkspaceKind,\n labels?: Partial<WorkspaceKindLabels>\n): {\n Icon: ComponentType<{ className?: string; 'aria-label'?: string; 'data-testid'?: string }>\n label: string\n fill: string\n} {\n const l = { ...DEFAULT_WORKSPACE_KIND_LABELS, ...labels }\n if (kind === 'common')\n return { Icon: Globe, label: l.common, fill: 'bg-muted text-muted-foreground' }\n if (kind === 'shared')\n return { Icon: Users, label: l.shared, fill: 'bg-secondary text-secondary-foreground' }\n return { Icon: Lock, label: l.private, fill: 'bg-primary text-primary-foreground' }\n}\n\n/** The kind's hue as a CSS colour, for glyphs painted by SVG fill (the workspace shield). */\nexport function workspaceKindColor(kind: ShellWorkspaceKind): string {\n if (kind === 'common') return 'var(--color-muted-foreground)'\n if (kind === 'shared') return 'var(--color-secondary)'\n return 'var(--color-primary)'\n}\n\n/** Overridable ids of the workspace identity; defaults are the current ids. */\ntype WorkspaceIdentityTestIds = Partial<Record<'initial' | 'type' | 'projectName', string>>\n\nexport interface WorkspaceIdentityProps {\n workspace: ShellWorkspace\n /** Show name + type/project line beside the badge; otherwise the badge alone. */\n expanded: boolean\n /** Selected (nav-row) styling of the name. */\n isActive?: boolean\n /** Reword the kind names. */\n labels?: Partial<WorkspaceKindLabels>\n /** Part ids; defaults are the current ids. */\n testIds?: WorkspaceIdentityTestIds\n}\n\n/**\n * Non-interactive guts of the workspace head: the initial badge (with a tiny type glyph) and,\n * when expanded, the name and the project/type line. Hosted by the switcher trigger and by the\n * workspace settings header, so it never nests a button.\n */\nexport function WorkspaceIdentity({\n workspace,\n expanded,\n isActive = false,\n labels,\n testIds,\n}: WorkspaceIdentityProps) {\n const kind = workspaceKindMeta(workspace.kind, labels)\n const badge = (\n <span className=\"relative flex flex-shrink-0\" title={kind.label}>\n <span\n aria-hidden=\"true\"\n data-testid={testIdOr(testIds?.initial, { testId: 'sidebar-workspace-card-initial' })}\n className={cn(\n 'flex size-7 flex-shrink-0 items-center justify-center rounded-md text-sm font-semibold leading-none',\n kind.fill\n )}\n >\n {workspace.name.charAt(0).toUpperCase()}\n </span>\n {/* Type as a tiny overlay on the badge: status reads at the icon, not after the name. */}\n <span className=\"absolute -bottom-1 -right-1 flex size-3.5 items-center justify-center rounded-full bg-background ring-1 ring-border\">\n <kind.Icon\n aria-label={kind.label}\n data-testid={testIdOr(testIds?.type, { testId: 'sidebar-workspace-card-type' })}\n className=\"size-2.5 text-muted-foreground\"\n />\n </span>\n </span>\n )\n\n if (!expanded)\n return <div className=\"flex flex-shrink-0 items-center justify-center\">{badge}</div>\n\n return (\n <>\n <div className=\"flex flex-shrink-0 items-center justify-center\">{badge}</div>\n <div className=\"ml-2.5 flex min-w-0 flex-1 flex-col text-left\">\n <span\n // 600: the name of the thing you are inside, above a lighter project line.\n className={cn(\n 'min-w-0 truncate text-left text-sm font-semibold capitalize leading-tight transition-colors duration-100',\n isActive ? 'text-accent-foreground' : 'text-foreground'\n )}\n >\n {workspace.name}\n </span>\n {!workspace.projectName && (\n <span className=\"mt-0.5 truncate text-xs text-muted-foreground\">{kind.label}</span>\n )}\n {workspace.projectName && (\n <span\n className=\"mt-0.5 flex min-w-0\"\n data-testid={testIdOr(testIds?.projectName, {\n testId: 'sidebar-workspace-card-project-name',\n })}\n >\n {workspace.projectLine ?? (\n <span className=\"truncate text-xs text-muted-foreground\">\n {workspace.projectName}\n </span>\n )}\n </span>\n )}\n </div>\n </>\n )\n}\n\n/**\n * Entity nouns plus the switcher's strings. `plural` arrives lowercased and `singular`\n * capitalized in the functions below.\n */\nexport interface WorkspaceSwitcherLabels extends WorkspaceKindLabels {\n /** Entity nouns, e.g. { plural: 'workspaces', singular: 'workspace' }. */\n plural: string\n singular: string\n /** The trigger's accessible name. */\n switchWorkspace: (name: string, plural: string) => string\n allWorkspaces: (plural: string) => string\n newWorkspace: (singular: string) => string\n recentWorkspaces: (plural: string) => string\n}\n\nexport const DEFAULT_WORKSPACE_SWITCHER_LABELS: WorkspaceSwitcherLabels = {\n ...DEFAULT_WORKSPACE_KIND_LABELS,\n plural: 'workspaces',\n singular: 'workspace',\n switchWorkspace: (name, plural) => `${name} — switch ${plural}`,\n allWorkspaces: (plural) => `All ${plural}`,\n newWorkspace: (singular) => `New ${singular}`,\n recentWorkspaces: (plural) => `Recent ${plural}`,\n}\n\nexport interface WorkspaceSwitcherProps {\n workspace: ShellWorkspace\n /** Other workspaces to jump to (the app orders and caps them). */\n recent?: ShellRecentWorkspace[]\n /** Icon-only trigger (the sidebar rail). */\n compact?: boolean\n /** `appbar`: the phone app bar's title, name + chevron on one line. */\n variant?: 'sidebar' | 'appbar'\n onSwitch: (workspace: ShellWorkspace) => void\n /** Return to the workspaces list; leaves the workspace open. */\n onGoToList: () => void\n onNewWorkspace: () => void\n /**\n * When set, \"New workspace\" is shown disabled with this explanation under it (e.g. the user may\n * not create workspaces on this deployment).\n */\n newWorkspaceDisabledReason?: string\n /** Entity nouns and menu strings; any subset (the nouns default to workspace(s)). */\n labels?: Partial<WorkspaceSwitcherLabels>\n className?: string\n /** Trigger id (default `workspace-switcher-trigger`). */\n testId?: string\n /**\n * Part ids; defaults are the current ids. `switchItem`, `type` and `lastSeen` are prefixes\n * (`<prefix>-<workspace id>`).\n */\n testIds?: Partial<Record<'menu' | 'all' | 'new' | 'switchItem' | 'type' | 'lastSeen', string>>\n /** Ids forwarded to the trigger's workspace identity. */\n identityTestIds?: WorkspaceIdentityTestIds\n}\n\n/**\n * The current-workspace control as a dropdown: \"All workspaces\", \"New workspace\", then the\n * recent workspaces to jump straight into.\n */\nexport function WorkspaceSwitcher({\n workspace,\n recent = [],\n compact = false,\n variant = 'sidebar',\n onSwitch,\n onGoToList,\n onNewWorkspace,\n newWorkspaceDisabledReason,\n labels,\n className,\n testId,\n testIds,\n identityTestIds,\n}: WorkspaceSwitcherProps) {\n const l = { ...DEFAULT_WORKSPACE_SWITCHER_LABELS, ...labels }\n const plural = l.plural.toLowerCase()\n const singular = l.singular.charAt(0).toUpperCase() + l.singular.slice(1)\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n data-slot=\"workspace-switcher\"\n data-testid={testIdOr(testId, { testId: 'workspace-switcher-trigger' })}\n aria-label={l.switchWorkspace(workspace.name, plural)}\n className={cn(\n 'group flex min-w-0 items-center rounded-md transition-colors duration-100 hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n variant === 'appbar'\n ? 'h-11 max-w-full gap-1 px-2'\n : compact\n ? 'h-12 w-12 justify-center'\n : 'h-12 w-full px-2',\n className\n )}\n >\n {variant === 'appbar' ? (\n <span className=\"min-w-0 truncate text-base font-semibold text-foreground\">\n {workspace.name}\n </span>\n ) : (\n <WorkspaceIdentity\n workspace={workspace}\n expanded={!compact}\n labels={l}\n testIds={identityTestIds}\n />\n )}\n {!(compact && variant === 'sidebar') && (\n <ChevronDown\n aria-hidden=\"true\"\n className=\"ml-auto size-4 flex-shrink-0 text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-180\"\n />\n )}\n </button>\n </DropdownMenuTrigger>\n {/* Expanded menus follow the trigger width so they stay inside the sidebar. */}\n <DropdownMenuContent\n align=\"start\"\n className={cn(\n 'border-0 max-w-[calc(100vw-1.5rem)]',\n variant === 'sidebar' && !compact\n ? 'w-[var(--radix-dropdown-menu-trigger-width)]'\n : 'w-60'\n )}\n data-testid={testIdOr(testIds?.menu, { testId: 'workspace-switcher-menu' })}\n >\n <DropdownMenuItem\n onClick={onGoToList}\n data-testid={testIdOr(testIds?.all, { testId: 'workspace-switcher-all' })}\n className=\"gap-2\"\n >\n <LayoutGrid className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n {l.allWorkspaces(plural)}\n </DropdownMenuItem>\n <DropdownMenuItem\n onClick={newWorkspaceDisabledReason ? undefined : onNewWorkspace}\n disabled={!!newWorkspaceDisabledReason}\n title={newWorkspaceDisabledReason}\n data-testid={testIdOr(testIds?.new, { testId: 'workspace-switcher-new' })}\n className=\"gap-2\"\n >\n <Plus className=\"size-4 flex-shrink-0 text-muted-foreground\" />\n <span className=\"flex min-w-0 flex-col\">\n {l.newWorkspace(singular)}\n {newWorkspaceDisabledReason && (\n <span className=\"text-xs text-muted-foreground\">{newWorkspaceDisabledReason}</span>\n )}\n </span>\n </DropdownMenuItem>\n {recent.length > 0 && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuLabel className=\"text-xs font-normal text-muted-foreground\">\n {l.recentWorkspaces(plural)}\n </DropdownMenuLabel>\n {recent.map((w) => {\n const kind = workspaceKindMeta(w.kind, l)\n return (\n <DropdownMenuItem\n key={w.id}\n onClick={() => onSwitch(w)}\n data-testid={prefixedTestId(testIds?.switchItem, w.id, {\n testId: `workspace-switch-${w.id}`,\n })}\n className=\"gap-2\"\n >\n <span className=\"relative flex flex-shrink-0\" title={kind.label}>\n <span\n aria-hidden=\"true\"\n className={cn(\n 'flex size-6 flex-shrink-0 items-center justify-center rounded text-xs font-semibold leading-none',\n kind.fill\n )}\n >\n {w.name.charAt(0).toUpperCase()}\n </span>\n <span className=\"absolute -bottom-1 -right-1 flex size-3 items-center justify-center rounded-full bg-background ring-1 ring-border\">\n <kind.Icon\n aria-label={kind.label}\n data-testid={prefixedTestId(testIds?.type, w.id, {\n testId: `workspace-type-${w.id}`,\n })}\n className=\"size-2 text-muted-foreground\"\n />\n </span>\n </span>\n <span className=\"min-w-0 flex-1 truncate capitalize\">{w.name}</span>\n {w.lastSeen && (\n <span\n className=\"ml-2 flex-shrink-0 text-xs tabular-nums text-muted-foreground\"\n data-testid={prefixedTestId(testIds?.lastSeen, w.id, {\n testId: `workspace-last-seen-${w.id}`,\n })}\n >\n {w.lastSeen}\n </span>\n )}\n </DropdownMenuItem>\n )\n })}\n </>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","/**\n * One policy for every automatic reload: when the running build is out of date, pick a moment\n * that costs the user nothing.\n *\n * After a deploy (or mid-rollout, while old and new pods both serve) the previous build's hashed\n * chunks can 404. Vite reports that as `vite:preloadError`. Reloading fetches the current\n * index.html (served no-cache) and its chunks, but reloading at once throws away whatever the\n * user is typing, so:\n *\n * - A failed prefetch (`prefetchChunk`) never reloads. Nothing on screen depends on it.\n * - A failed chunk the user is waiting for reloads at once, unless the user is on a sign-in form\n * or has unsaved input (a focused or edited field, or a `[data-reload-guard]` region).\n * - Otherwise the reload waits: the next route navigation becomes a full page load of its target,\n * or the page reloads once the user is idle with nothing unsaved.\n * - Per tab, at most one policy reload a minute. A second failure right after one is not a stale\n * build (a genuinely missing chunk, say), so it surfaces to the error boundary instead of looping.\n */\n\nimport { notify } from '@arbidocs/react/shell'\n\nexport const CHUNK_RELOAD_KEY = 'arbi_chunk_reload_at'\n\n/** A second failure within this window after a reload is not a stale build: let it surface. */\nconst RELOAD_GUARD_MS = 60_000\n/** A deferred reload waits until the user has done nothing for this long. */\nconst IDLE_MS = 10_000\nconst IDLE_CHECK_MS = 2_000\n\n/** Sign-in pages, and regions a host marks as holding unsaved work. */\nconst GUARD_SELECTOR =\n '[data-slot=\"auth-layout\"], input[type=\"password\"], input[autocomplete=\"one-time-code\"], [data-reload-guard]'\nconst NON_TEXT_INPUTS = new Set([\n 'button',\n 'submit',\n 'reset',\n 'checkbox',\n 'radio',\n 'hidden',\n 'range',\n 'color',\n 'file',\n 'image',\n])\n\nexport interface ReloadPolicyDeps {\n /** Reload the current page. */\n reload: () => void\n /** Full page load of `url` (instead of a client-side navigation). */\n load: (url: string, replace: boolean) => void\n now: () => number\n}\n\nconst browserDeps: ReloadPolicyDeps = {\n reload: () => window.location.reload(),\n load: (url, replace) => (replace ? window.location.replace(url) : window.location.assign(url)),\n now: () => Date.now(),\n}\n\nlet deps = browserDeps\nlet installed = false\n/** The build is out of date: the next route navigation loads the page fresh. */\nlet stale = false\n/** A chunk the user needed failed: reload as soon as nothing would be lost. */\nlet reloadWanted = false\nlet lastActivity = 0\nlet idleTimer: ReturnType<typeof setInterval> | undefined\nlet restoreNavigation: (() => void) | null = null\n/** Fields the user typed into. */\nconst edited = new Set<Element>()\n/** Errors from `prefetchChunk` loads, so the preload-error handler can tell them apart. */\nconst prefetchFailures = new WeakSet<object>()\n\nfunction isTextField(el: Element): boolean {\n if (el instanceof HTMLInputElement) return !NON_TEXT_INPUTS.has(el.type)\n return el instanceof HTMLTextAreaElement || (el as HTMLElement).isContentEditable === true\n}\n\nfunction hasText(el: Element): boolean {\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n return el.value.trim() !== ''\n }\n return (el.textContent ?? '').trim() !== ''\n}\n\n/**\n * Whether reloading now could cost the user something: a sign-in form, a `[data-reload-guard]`\n * region, a focused text field, or a field they typed into that still holds text.\n */\nexport function hasUnsavedInput(doc: Document = document): boolean {\n if (doc.querySelector(GUARD_SELECTOR)) return true\n const active = doc.activeElement\n if (active && active !== doc.body && isTextField(active)) return true\n for (const el of edited) {\n if (!el.isConnected) edited.delete(el)\n else if (hasText(el)) return true\n }\n return false\n}\n\n/** Take this tab's reload slot. False within the guard window, or when storage can't record it. */\nfunction claimReload(): boolean {\n const now = deps.now()\n let last = 0\n try {\n last = Number(sessionStorage.getItem(CHUNK_RELOAD_KEY)) || 0\n } catch {\n // Unreadable: treat as never reloaded. Writing below decides.\n }\n if (last && now - last < RELOAD_GUARD_MS) return false\n try {\n sessionStorage.setItem(CHUNK_RELOAD_KEY, String(now))\n } catch {\n // Without the guard we can't tell a loop from a stale build: don't risk one.\n return false\n }\n return true\n}\n\nfunction guardHot(): boolean {\n try {\n const last = Number(sessionStorage.getItem(CHUNK_RELOAD_KEY)) || 0\n return !!last && deps.now() - last < RELOAD_GUARD_MS\n } catch {\n return false\n }\n}\n\nfunction settle(): void {\n stale = false\n reloadWanted = false\n if (idleTimer !== undefined) clearInterval(idleTimer)\n idleTimer = undefined\n restoreNavigation?.()\n restoreNavigation = null\n}\n\nfunction reloadNow(): boolean {\n if (!claimReload()) {\n settle()\n return false\n }\n settle()\n deps.reload()\n return true\n}\n\n/** A client-side navigation to `url` becomes a full page load of it while the build is stale. */\nfunction loadsFresh(url: string | URL | null | undefined): string | null {\n if (!stale || url == null) return null\n const target = new URL(String(url), window.location.href)\n if (target.pathname === window.location.pathname) return null\n // Leaving a sign-in page establishes the session: a full load there races its persistence.\n if (document.querySelector(GUARD_SELECTOR)) return null\n return target.href\n}\n\nfunction interceptNavigation(): void {\n if (restoreNavigation) return\n const history = window.history\n const push = history.pushState\n const replace = history.replaceState\n let shownPath = window.location.pathname\n const wrap = (original: History['pushState'], replaceEntry: boolean): History['pushState'] =>\n function (this: History, data, unused, url) {\n const target = loadsFresh(url)\n if (target && claimReload()) {\n settle()\n deps.load(target, replaceEntry)\n return\n }\n original.call(this, data, unused, url)\n shownPath = window.location.pathname\n }\n history.pushState = wrap(push, false)\n history.replaceState = wrap(replace, true)\n // Back/forward already changed the address: reloading loads that target.\n const onPopState = () => {\n if (window.location.pathname === shownPath) return\n shownPath = window.location.pathname\n if (!document.querySelector(GUARD_SELECTOR)) reloadNow()\n }\n window.addEventListener('popstate', onPopState)\n restoreNavigation = () => {\n history.pushState = push\n history.replaceState = replace\n window.removeEventListener('popstate', onPopState)\n }\n}\n\nfunction watchForIdle(): void {\n if (idleTimer !== undefined) return\n idleTimer = setInterval(() => {\n if (!reloadWanted) return\n const idle = document.visibilityState === 'hidden' || deps.now() - lastActivity >= IDLE_MS\n if (idle && !hasUnsavedInput()) reloadNow()\n }, IDLE_CHECK_MS)\n}\n\n/**\n * The running build is out of date (a chunk 404'd, or a new service worker took over): the next\n * route navigation loads its target fresh instead of rendering it client-side.\n */\nexport function markBuildStale(): void {\n stale = true\n interceptNavigation()\n}\n\nexport type ReloadOutcome = 'reloaded' | 'deferred' | 'guarded'\n\n/**\n * Reload onto the current build when nothing would be lost; otherwise defer to the next route\n * navigation or to the moment the user is idle with nothing unsaved. `guarded` means a policy\n * reload just happened in this tab, so the failure should surface instead.\n */\nexport function requestReload(): ReloadOutcome {\n if (guardHot()) return 'guarded'\n if (!hasUnsavedInput()) return reloadNow() ? 'reloaded' : 'guarded'\n reloadWanted = true\n markBuildStale()\n watchForIdle()\n return 'deferred'\n}\n\n/**\n * Load a chunk ahead of need (warming a route the user may open next). Never rejects, and a\n * failure never reloads the page: it only marks the build stale so the next navigation loads\n * fresh.\n */\nexport function prefetchChunk(load: () => Promise<unknown>): Promise<void> {\n let loading: Promise<unknown>\n try {\n loading = load()\n } catch (error) {\n loading = Promise.reject(error)\n }\n return loading.then(\n () => undefined,\n (error: unknown) => {\n if (typeof error === 'object' && error !== null) prefetchFailures.add(error)\n }\n )\n}\n\nfunction decide(payload: unknown): void {\n const prefetch = typeof payload === 'object' && payload !== null && prefetchFailures.has(payload)\n // Offline the chunk simply couldn't be downloaded (it isn't cached yet). Reloading can't fix\n // that and would throw away what's on screen; say what happened instead, and let the failed\n // import reach the nearest error boundary as usual.\n if (typeof navigator !== 'undefined' && navigator.onLine === false) {\n if (!prefetch) {\n notify.warning(\"This part of ARBI isn't available offline yet\", {\n description: 'Reconnect to open it. Once you have, it will work offline too.',\n })\n }\n return\n }\n markBuildStale()\n if (prefetch) return\n const outcome = requestReload()\n console.warn(`[chunk] A code chunk failed to load (stale build?): ${outcome}`, payload)\n}\n\n/**\n * The `vite:preloadError` handler. Decides once the failed import's own handlers have run, so a\n * `prefetchChunk` failure is known as one. Never cancels the event: the import rejects as usual\n * and, if a reload follows, the page is replaced anyway.\n */\nexport function handleChunkLoadError(event: Event): void {\n const payload = (event as Event & { payload?: unknown }).payload\n setTimeout(() => decide(payload), 0)\n}\n\nfunction onActivity(event: Event): void {\n lastActivity = deps.now()\n if (event.type === 'input' && event.target instanceof Element && isTextField(event.target)) {\n edited.add(event.target)\n }\n}\n\nconst ACTIVITY_EVENTS = ['input', 'keydown', 'pointerdown', 'wheel', 'touchstart'] as const\n\n/** Install the reload policy. Call once at startup; later calls are no-ops. */\nexport function installReloadPolicy(overrides: Partial<ReloadPolicyDeps> = {}): void {\n deps = { ...browserDeps, ...overrides }\n if (installed || typeof window === 'undefined') return\n installed = true\n lastActivity = deps.now()\n window.addEventListener('vite:preloadError', handleChunkLoadError)\n for (const type of ACTIVITY_EVENTS) {\n document.addEventListener(type, onActivity, { capture: true, passive: true })\n }\n}\n\n/** Undo `installReloadPolicy` and forget all state (tests). */\nexport function resetReloadPolicy(): void {\n settle()\n edited.clear()\n if (installed) {\n window.removeEventListener('vite:preloadError', handleChunkLoadError)\n for (const type of ACTIVITY_EVENTS) document.removeEventListener(type, onActivity, true)\n }\n installed = false\n deps = browserDeps\n}\n","import { useId, type MouseEvent, type ReactNode } from 'react'\nimport type { ShellActionLayout } from './types'\n\nexport interface ActionClusterProps {\n /**\n * `bar`: one row for a page header or phone app bar (status, bell, contacts, account).\n * `sidebar`: the bottom of the expanded sidebar: the bell and contacts rows stacked above the\n * account row.\n * `rail`: the same stack on the icon-only rail (same order, icon-only rows).\n * `drawer`: the phone drawer's rows (bell and contacts only; the app bar carries the account).\n */\n layout?: ShellActionLayout\n /** Status pill (remote control); `bar` only. Other layouts show status in their own rows. */\n status?: ReactNode\n /** Report a problem (bug icon), first in the cluster. */\n report?: ReactNode\n /** Notification bell (the kit's NotificationBell, or a `Sidebar.BadgeRow`). */\n mail?: ReactNode\n /** Calendar entry (a `Sidebar.BadgeRow`), right after mail. */\n calendar?: ReactNode\n /** Databases entry (a `Sidebar.BadgeRow`), right after calendar. */\n databases?: ReactNode\n bell?: ReactNode\n /** Contacts / messages entry with its own badge (a `Sidebar.BadgeRow`). */\n contacts?: ReactNode\n /** Account menu (the kit's UserMenu). */\n account?: ReactNode\n /**\n * Names the cluster: the group's accessible name in every layout, and a visible heading above\n * the rows in the `drawer` layout (where phones otherwise get unlabelled rows).\n */\n label?: string\n 'data-testid'?: string\n}\n\n/**\n * The account area: notifications, contacts and the account menu, in one of four placements. In\n * the sidebar and on the rail the two badge rows are stacked above the account row in the same\n * order, so nothing moves when the rail expands; the account menu holds everything else (help,\n * settings, tips, processing).\n */\nexport function ActionCluster({\n layout = 'bar',\n status,\n report,\n mail,\n calendar,\n databases,\n bell,\n contacts,\n account,\n label,\n 'data-testid': testId = 'sidebar-actions',\n}: ActionClusterProps) {\n const labelId = useId()\n // Dashboard's content area resets focus on click, and Radix PORTALS bubble through the React\n // tree: stop clicks here or a dropdown item (e.g. \"View all\") would un-focus the panel it opened.\n const stop = (e: MouseEvent) => e.stopPropagation()\n\n if (layout === 'sidebar' || layout === 'rail' || layout === 'drawer') {\n const rail = layout === 'rail'\n return (\n <div\n className={rail ? 'flex flex-col items-center gap-0.5' : 'flex flex-col gap-0.5'}\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-labelledby={label && layout === 'drawer' ? labelId : undefined}\n aria-label={label && layout !== 'drawer' ? label : undefined}\n data-slot=\"action-cluster\"\n data-layout={layout}\n data-testid={testId}\n >\n {label && layout === 'drawer' && (\n <p\n id={labelId}\n className=\"px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground\"\n data-slot=\"action-cluster-label\"\n >\n {label}\n </p>\n )}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account && layout !== 'drawer' && (\n <div className={rail ? 'mt-1' : 'mt-1 min-w-0'}>{account}</div>\n )}\n </div>\n )\n }\n\n return (\n <div\n className=\"flex items-center gap-1\"\n onClick={stop}\n role={label ? 'group' : undefined}\n aria-label={label}\n data-slot=\"action-cluster\"\n >\n {status}\n {report}\n {mail}\n {calendar}\n {databases}\n {bell}\n {contacts}\n {account}\n </div>\n )\n}\n","/**\n * DockZone Component\n *\n * Layout wrapper that provides a resizable right-hand panel area (#dock-zone)\n * where panels in 'docked' mode render via PanelPortal.\n *\n * Uses MutationObserver on the #dock-zone element to detect when content is\n * portaled in/out, so the split layout appears only when a panel is actually\n * mounted — not just when the store says a panel prefers 'docked' mode.\n *\n * The dock zone reads its initial width from the child's data-dock-width\n * attribute (pixels). If absent, defaults to 50% of the container.\n *\n * Below MOBILE_BREAKPOINT_PX, MIN_MAIN_PX + MIN_DOCK_PX (500px combined)\n * can't both fit — the clamp math still ran unconditionally and squeezed the\n * dock pane down to whatever sliver was left (as little as ~90px on a 390px\n * phone), rendering both panes as unusable slivers instead of showing either\n * one properly. Below that width this becomes a single full-width view that\n * swaps between main and docked content instead of splitting — same\n * principle as the Document Viewer's own view-swap (Edit ⇄ Track Changes).\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nconst MIN_DOCK_PX = 200\nconst MIN_MAIN_PX = 300\n// Standard right-panel width — matches the overlay sheet (sm:w-[34rem]) so a\n// panel is the same size whether it's pinned or floating. Pinned stays\n// draggable from here; floating is fixed.\nconst DEFAULT_DOCK_PX = 544\nconst MOBILE_BREAKPOINT_PX = 640\n\ninterface DockZoneProps {\n children: React.ReactNode\n 'data-testid'?: string\n}\n\nexport function DockZone({ children, ...props }: DockZoneProps) {\n const [hasDockedContent, setHasDockedContent] = useState(false)\n const [dockWidth, setDockWidth] = useState<number | null>(null)\n const [isResizing, setIsResizing] = useState(false)\n const [dragPosition, setDragPosition] = useState<number | null>(null)\n const [containerWidth, setContainerWidth] = useState(0)\n const containerRef = useRef<HTMLDivElement>(null)\n const dockZoneRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const el = containerRef.current\n if (!el) return\n const observer = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width\n if (width !== undefined) setContainerWidth(width)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n const isMobile = containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT_PX\n\n // Observe dock-zone children to know when content is actually portaled in\n // Also read initial width from the child's data-dock-width attribute\n useEffect(() => {\n const el = dockZoneRef.current\n if (!el) return\n\n const update = () => {\n const hasChildren = el.children.length > 0\n setHasDockedContent(hasChildren)\n if (hasChildren) {\n const requestedWidth = el.firstElementChild?.getAttribute('data-dock-width')\n if (requestedWidth) {\n setDockWidth(parseInt(requestedWidth, 10))\n }\n }\n }\n\n const observer = new MutationObserver(update)\n update()\n observer.observe(el, { childList: true })\n return () => observer.disconnect()\n }, [])\n\n const handleMouseDown = useCallback(() => {\n setIsResizing(true)\n setDragPosition(null)\n }, [])\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || !containerRef.current) return\n const rect = containerRef.current.getBoundingClientRect()\n const x = e.clientX - rect.left\n // Clamp so neither pane gets too small\n const clamped = Math.min(Math.max(x, MIN_MAIN_PX), rect.width - MIN_DOCK_PX)\n setDragPosition(clamped)\n },\n [isResizing]\n )\n\n const handleMouseUp = useCallback(() => {\n if (dragPosition !== null && containerRef.current) {\n const containerWidth = containerRef.current.getBoundingClientRect().width\n setDockWidth(containerWidth - dragPosition)\n }\n setIsResizing(false)\n setDragPosition(null)\n }, [dragPosition])\n\n useEffect(() => {\n if (!isResizing) return\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, handleMouseMove, handleMouseUp])\n\n // Below the mobile breakpoint there's no room to split at all — MIN_MAIN_PX\n // + MIN_DOCK_PX alone is 500px, wider than most phones. Show whichever\n // side is active at full width instead of squeezing both into slivers.\n const effectiveDockWidth =\n hasDockedContent && containerWidth > 0\n ? isMobile\n ? containerWidth\n : Math.min(\n Math.max(dockWidth ?? DEFAULT_DOCK_PX, MIN_DOCK_PX),\n containerWidth - MIN_MAIN_PX\n )\n : 0\n const mainHidden = isMobile && hasDockedContent\n\n return (\n <div ref={containerRef} className=\"h-full relative flex\" data-testid={props['data-testid']}>\n <div\n style={{\n width: mainHidden ? 0 : `calc(100% - ${effectiveDockWidth}px)`,\n // Reserve gutter space so the vertical scrollbar doesn't appear and\n // disappear as streaming content crosses the viewport boundary —\n // that toggle reflows the layout and reads as a screen-wide flicker.\n scrollbarGutter: 'stable',\n }}\n className={cn(\n // The CSS container for the page's @-variants (PageContainer must not be one; see there).\n '@container h-full overflow-auto',\n hasDockedContent && !isMobile && 'border-r',\n mainHidden && 'overflow-hidden',\n // Animate opening only. On close the portaled content has already\n // unmounted, so animating leaves an empty strip shrinking while the\n // page behind reflows — reads as flicker over heavy content like the\n // documents grid. Snap closed instead. Resizing is also instant so\n // the divider doesn't lag the cursor.\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n aria-hidden={mainHidden}\n inert={mainHidden}\n data-scroll-container\n >\n {children}\n </div>\n\n {/* Wide grab zone with a visible grip, so the divider is findable and forgiving to hit */}\n {hasDockedContent && !isMobile && (\n <div\n className=\"group flex w-2 flex-shrink-0 cursor-col-resize items-center justify-center\"\n onMouseDown={handleMouseDown}\n data-testid=\"dock-resize-handle\"\n >\n <div className=\"h-12 w-1 rounded-full bg-muted-foreground/40 transition-colors group-hover:bg-primary\" />\n </div>\n )}\n\n <div\n ref={dockZoneRef}\n id=\"dock-zone\"\n style={{ width: effectiveDockWidth }}\n className={cn(\n 'h-full overflow-hidden flex-shrink-0',\n hasDockedContent && !isResizing && 'transition-[width] duration-300 ease-in-out'\n )}\n />\n\n {isResizing && dragPosition !== null && (\n <div\n className=\"absolute top-0 bottom-0 w-0.5 bg-primary z-50 pointer-events-none\"\n style={{ left: dragPosition }}\n />\n )}\n {isResizing && <div className=\"absolute inset-0 z-40 cursor-col-resize\" />}\n </div>\n )\n}\n","/**\n * PanelModeSwitcher Component\n *\n * User-selectable placements are: popped out, docked, or overlay. `main` is\n * NOT user-selectable — the system decides which surfaces render full-width\n * (e.g. the DM modal); the user just moves floating panels between popout /\n * docked / overlay. The switcher shows a button for each placement you're not\n * currently in (plus close):\n * - Popout/pop-in toggle (unless disablePopout).\n * - Split-screen button (when not docked).\n * - Float-as-overlay button (when not overlay).\n * - Popout mode shows just the pop-in toggle (the window has its own close).\n */\n\nimport { Button, Tooltip, TooltipContent, TooltipTrigger } from '@arbidocs/react/ui'\nimport { ExternalLink, PanelRight, PictureInPicture2, X } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport type { ArbiPanelMode as PanelMode } from '@arbidocs/react'\nimport { useIsPhone, useMediaQuery } from '../lib/use-media-query'\n\nconst btnClass = 'h-7 w-7 p-0 text-muted-foreground hover:text-foreground'\n\ninterface SwitcherButtonProps {\n label: string\n /** True when rendered inside a popout window (see note below). */\n inPopout?: boolean\n onClick: () => void\n testId: string\n children: ReactNode\n}\n\n// Icon-only buttons get a visible tooltip with their label, so the icon's meaning\n// is readable on hover and on keyboard focus. Radix tooltips portal into the main\n// window, which would misplace them inside a popout window, so there we fall back\n// to a native title.\nfunction SwitcherButton({\n label,\n inPopout = false,\n onClick,\n testId,\n children,\n}: SwitcherButtonProps) {\n const button = (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={btnClass}\n aria-label={label}\n title={inPopout ? label : undefined}\n onClick={onClick}\n data-testid={testId}\n >\n {children}\n </Button>\n )\n if (inPopout) return button\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n )\n}\n\n// \"Open in new window\" (popout) and \"Float as overlay\" are desktop-only\n// window-management concepts — a tablet has no multi-window/overlay chrome to\n// pop into. 1024px mirrors the common tablet/small-laptop cutoff (Tailwind's\n// `lg`) and matches WorkspaceTopbar's own matchMedia convention for\n// viewport-driven chrome (as opposed to DocumentViewer's container-width\n// ResizeObserver, which fits ITS OWN toolbar buttons reflowing inside a panel\n// that can be split narrow on a wide desktop — PanelModeSwitcher instead needs\n// to know the actual device class, since popping into \"a new window\" or\n// \"floating overlay\" is meaningless on a touch tablet regardless of how the\n// panel happens to be sized in that moment). Deliberately separate from\n// `useIsPhone` (640px, phones only): this only needs to hide these two\n// buttons, not collapse the whole switcher, at tablet widths.\nconst TABLET_AND_BELOW_QUERY = '(max-width: 1024px)'\n\ninterface PanelModeSwitcherProps {\n mode: PanelMode\n onModeChange: (mode: PanelMode) => void\n onClose?: () => void\n /** When true, hides the popout button (e.g. for panels whose content breaks in a popup window) */\n disablePopout?: boolean\n /**\n * Override the close-button data-testid. Defaults to `dialog-close-button`\n * for backwards compatibility. Use a panel-specific value (e.g.\n * `close-viewer-button`) when there are multiple PanelModeSwitchers in the\n * DOM at once and tests need to disambiguate.\n */\n closeTestId?: string\n}\n\nexport function PanelModeSwitcher({\n mode,\n onModeChange,\n onClose,\n disablePopout,\n closeTestId = 'dialog-close-button',\n}: PanelModeSwitcherProps) {\n const isPopout = mode === 'popout'\n const isSmallScreen = useIsPhone()\n const isTabletAndBelow = useMediaQuery(TABLET_AND_BELOW_QUERY)\n\n const closeButton = onClose && (\n <SwitcherButton label=\"Close (Esc)\" onClick={onClose} testId={closeTestId}>\n <X className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )\n\n // Phones: every panel is an overlay and mode-switching is disabled, so only\n // the close ✕ is meaningful.\n if (isSmallScreen) {\n return <div className=\"flex items-center gap-0.5 flex-shrink-0\">{closeButton}</div>\n }\n\n return (\n <div className=\"flex items-center gap-0.5 flex-shrink-0\">\n {/* Popout / pop-in toggle — hidden when disablePopout is set, or on\n tablet-and-below where \"a new window\" isn't a real concept. */}\n {!disablePopout && !isTabletAndBelow && (\n <SwitcherButton\n label={isPopout ? 'Pop back in' : 'Open in new window'}\n inPopout={isPopout}\n onClick={() => onModeChange(isPopout ? 'docked' : 'popout')}\n testId={isPopout ? 'pop-into-main-window-button' : 'open-in-new-window-button'}\n >\n <ExternalLink className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* Split-screen (docked to the side) — shown when not already in it */}\n {!isPopout && mode !== 'docked' && (\n <SwitcherButton\n label=\"Split screen\"\n onClick={() => onModeChange('docked')}\n testId=\"dock-panel-button\"\n >\n <PanelRight className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* Float as an overlay sheet — shown when not already an overlay, and\n not on tablet-and-below (no floating-window chrome to speak of). */}\n {!isPopout && mode !== 'overlay' && !isTabletAndBelow && (\n <SwitcherButton\n label=\"Float as overlay\"\n onClick={() => onModeChange('overlay')}\n testId=\"overlay-panel-button\"\n >\n <PictureInPicture2 className=\"w-3.5 h-3.5\" />\n </SwitcherButton>\n )}\n\n {/* All non-popout modes: ✕ to close */}\n {!isPopout && closeButton}\n </div>\n )\n}\n","/**\n * Window Manager for Pop-out Panels\n *\n * Handles creating, managing, and communicating with popup windows\n */\n\ninterface PopupWindow {\n id: string\n window: Window\n panelId: string\n rootElement: HTMLElement | null\n onClose?: () => void\n}\n\n/** Window lifecycle port; hosts may share or replace the browser implementation. */\nexport interface PanelWindows {\n createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null\n getWindow(windowId: string): Window | null\n getRootElement(windowId: string): HTMLElement | null\n focusPanelWindow(panelId: string): boolean\n clearOnClose(windowId: string): void\n closeWindow(windowId: string): void\n closeAllWindows(): void\n}\n\nexport class PanelWindowManager implements PanelWindows {\n constructor(private readonly defaultTitle = 'Panel') {}\n private windows = new Map<string, PopupWindow>()\n\n createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null {\n const windowId = `panel-window-${panelId}`\n\n // Check if window already exists\n if (this.windows.has(windowId)) {\n const existing = this.windows.get(windowId)\n if (existing && !existing.window.closed) {\n existing.window.focus()\n return windowId\n } else {\n // Clean up closed window\n this.windows.delete(windowId)\n }\n }\n\n // Position popup in the right half of the screen\n const currentWidth = window.outerWidth\n const currentHeight = window.outerHeight\n const currentLeft = window.screenX ?? window.screenLeft ?? 0\n const currentTop = window.screenY ?? window.screenTop ?? 0\n\n // Calculate popup position (right half)\n const halfWidth = Math.floor(currentWidth / 2)\n const popupWidth = halfWidth\n const popupHeight = currentHeight\n const left = currentLeft + halfWidth\n const top = currentTop\n\n const popup = window.open(\n '',\n windowId,\n `width=${popupWidth},height=${popupHeight},left=${left},top=${top},scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=no`\n )\n\n if (!popup) {\n console.error('Failed to create popup window - popup blocked?')\n return null\n }\n\n // Set up the popup window HTML with proper CSS links\n const mainDocument = document\n const stylesheets = Array.from(\n mainDocument.head.querySelectorAll('link[rel=\"stylesheet\"], style')\n )\n .map((el) => el.outerHTML)\n .join('\\n')\n\n popup.document.write(`\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title></title>\n <!-- about:blank has no base, so copied @font-face / asset URLs (e.g.\n /assets/font.woff2) would resolve against nothing and render as\n tofu squares. Anchor relative URLs to the app origin. -->\n <base href=\"${window.location.origin}/\">\n ${stylesheets}\n <style>\n body {\n margin: 0;\n padding: 0;\n font-family: system-ui, -apple-system, sans-serif;\n }\n #panel-root {\n width: 100%;\n height: 100vh;\n overflow: hidden;\n }\n * {\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n <div id=\"panel-root\"></div>\n </body>\n </html>\n `)\n popup.document.close()\n // A host title is text, even when it contains HTML delimiters.\n popup.document.title = title || this.defaultTitle\n\n // Belt-and-suspenders: re-register the parent's already-loaded web fonts in\n // the popup's FontFaceSet, so glyphs render even if a copied @font-face\n // doesn't re-fetch. Best-effort — engines that reject a cross-document add\n // just fall back to the <base>-anchored @font-face rules above.\n try {\n mainDocument.fonts.forEach((font) => {\n try {\n popup.document.fonts.add(font)\n } catch {\n /* ignore per-font failures */\n }\n })\n } catch {\n /* FontFaceSet unavailable — ignore */\n }\n\n // Get root element after DOM is ready\n const rootElement = popup.document.getElementById('panel-root')\n\n // Store window reference\n const popupWindow: PopupWindow = {\n id: windowId,\n window: popup,\n panelId,\n rootElement,\n onClose,\n }\n this.windows.set(windowId, popupWindow)\n\n // Handle window close — read onClose from the map entry so clearOnClose() works\n const closeCheckInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(closeCheckInterval)\n const entry = this.windows.get(windowId)\n this.windows.delete(windowId)\n entry?.onClose?.()\n }\n }, 200)\n\n return windowId\n }\n\n getWindow(windowId: string): Window | null {\n const popup = this.windows.get(windowId)\n return popup && !popup.window.closed ? popup.window : null\n }\n\n getRootElement(windowId: string): HTMLElement | null {\n const popup = this.windows.get(windowId)\n return popup && !popup.window.closed ? popup.rootElement : null\n }\n\n /** Focus the popup window for a given panel ID. Returns true if focused. */\n focusPanelWindow(panelId: string): boolean {\n const windowId = `panel-window-panel-${panelId}`\n const popup = this.windows.get(windowId)\n if (popup && !popup.window.closed) {\n popup.window.focus()\n return true\n }\n return false\n }\n\n /** Remove the onClose callback so it won't fire when the window is closed programmatically. */\n clearOnClose(windowId: string): void {\n const popup = this.windows.get(windowId)\n if (popup) {\n popup.onClose = undefined\n }\n }\n\n closeWindow(windowId: string): void {\n const popup = this.windows.get(windowId)\n if (popup && !popup.window.closed) {\n popup.window.close()\n }\n this.windows.delete(windowId)\n }\n\n closeAllWindows(): void {\n for (const [, popup] of this.windows) {\n if (!popup.window.closed) {\n popup.window.close()\n }\n }\n this.windows.clear()\n }\n}\n\n/** A window registry shared by the host's panel controls and portal layer. */\nexport function createPanelWindowManager(options: { defaultTitle?: string } = {}) {\n return new PanelWindowManager(options.defaultTitle)\n}\n","import { useHost } from '../provider/host'\nimport { createPanelWindowManager, type PanelWindows } from './panel-windows'\n\n/** Browser windows and site-specific titles shared by a host's panel controls. */\nexport interface PanelHostSupport {\n windows?: PanelWindows\n popoutTitle?: (title: string) => string\n}\n\nconst defaultWindows = createPanelWindowManager()\nconst titleOnly = (title: string) => title\n\n/** Panel support from the existing ArbiHost; standalone panels share the browser defaults. */\nexport function usePanelHostSupport(): Required<PanelHostSupport> {\n const { panels } = useHost()\n return {\n windows: panels?.windows ?? defaultWindows,\n popoutTitle: panels?.popoutTitle ?? titleOnly,\n }\n}\n","/**\n * PanelPortal Component\n *\n * Thin portal layer that renders children into the right target based on panel mode:\n * - docked: portal to #dock-zone element\n * - overlay: portal to <body> as a slide-out sheet over a backdrop\n * - popout: portal to a separate browser window\n * - main: portal to #main-zone element\n *\n * Manages popup window lifecycle for popout mode.\n * Content-agnostic — just handles where things render.\n */\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { DEFAULT_OVERLAY_ZONE_ID } from './Shell'\nimport { usePanelHostSupport } from './panel-host'\nimport { PortalContainerProvider } from '@arbidocs/react/ui'\nimport type { FloatingPanelMode as PanelMode } from '../settings/FloatingPanel'\n\n// Overlay sheet sizing — defaults match the docked width (DEFAULT_DOCK_PX) so a\n// panel is the same size whether pinned or floating, and stays draggable here.\nconst OVERLAY_DEFAULT_PX = 544\nconst OVERLAY_MIN_PX = 360\n\nexport interface PanelPortalProps {\n panelId: string\n mode: PanelMode\n isOpen: boolean\n /** True while the overlay is animating out before unmounting. */\n isExiting?: boolean\n /** Called when popup window is closed externally (user closes the window) */\n onPopupClosed?: () => void\n /** Dismisses the panel — used by the overlay backdrop. */\n onClose?: () => void\n /** Window title for popout mode */\n popoutTitle?: string\n /** Initial overlay width in px (defaults to OVERLAY_DEFAULT_PX). */\n defaultWidth?: number\n children: React.ReactNode\n}\n\n/**\n * Overlay sheet — a slide-out panel over the still-visible page, resizable by\n * dragging its left edge. Slides in on mount and out (via isExiting) before\n * unmounting, mirroring the left sidebar's animation.\n */\nfunction OverlaySheet({\n panelId,\n isExiting,\n onClose,\n defaultWidth,\n scoped,\n children,\n}: {\n panelId: string\n isExiting?: boolean\n onClose?: () => void\n defaultWidth?: number\n /** Rendered inside the layout's overlay zone (below the topbar) rather than\n * over the whole viewport. */\n scoped?: boolean\n children: React.ReactNode\n}) {\n const [width, setWidth] = useState(defaultWidth ?? OVERLAY_DEFAULT_PX)\n const [isResizing, setIsResizing] = useState(false)\n // Live cursor position while dragging. The panel keeps its committed `width`\n // during the drag — only this thin preview line moves — so the heavy panel\n // content never reflows mid-drag (matching DockZone's split-screen handle).\n // The width is committed once on mouse-up.\n const [dragWidth, setDragWidth] = useState<number | null>(null)\n const dragWidthRef = useRef<number | null>(null)\n // Once the slide-in has played we drop the entry class, so later re-renders\n // don't restart the animation.\n const [hasEntered, setHasEntered] = useState(false)\n\n const handleResizeStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setHasEntered(true)\n setIsResizing(true)\n setDragWidth(null)\n dragWidthRef.current = null\n }, [])\n\n useEffect(() => {\n if (!isResizing) return\n const handleMouseMove = (e: MouseEvent) => {\n // Anchored to the right edge — width grows as the cursor moves left.\n const max = window.innerWidth * 0.92\n const next = Math.min(Math.max(window.innerWidth - e.clientX, OVERLAY_MIN_PX), max)\n dragWidthRef.current = next\n setDragWidth(next)\n }\n const handleMouseUp = () => {\n if (dragWidthRef.current !== null) setWidth(dragWidthRef.current)\n setIsResizing(false)\n setDragWidth(null)\n dragWidthRef.current = null\n }\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n return () => {\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing])\n\n return (\n // Scoped: absolute within the layout's overlay zone (below the topbar).\n // Unscoped fallback: fixed over the whole viewport, as before.\n <div\n className={scoped ? 'absolute inset-0 z-40' : 'fixed inset-0 z-50'}\n data-testid={`${panelId}-overlay`}\n >\n {/* In dark mode a 40% black veil crushes the light page text behind the sheet to\n mid-grey, so the veil is lighter there and the page stays readable underneath. */}\n <div\n className={`absolute inset-0 bg-black/40 dark:bg-black/20 duration-200 ${\n // fill-mode-forwards holds the exit end-state — without it the\n // element snaps back fully visible for the frames between the\n // animation finishing and React unmounting it (a flicker).\n isExiting ? 'animate-out fade-out fill-mode-forwards' : 'animate-in fade-in'\n }`}\n onClick={onClose}\n aria-hidden=\"true\"\n data-testid={`${panelId}-overlay-backdrop`}\n />\n <div\n style={{ width }}\n onAnimationEnd={() => !isExiting && setHasEntered(true)}\n className={`absolute right-0 top-0 bottom-0 flex max-w-[92vw] flex-col border-l max-sm:!w-full max-sm:!max-w-full max-sm:border-l-0 border-border bg-muted shadow-2xl duration-200 ${\n isExiting\n ? 'animate-out slide-out-to-right fill-mode-forwards'\n : // Suppress the slide transform once entered so it doesn't replay.\n hasEntered\n ? ''\n : 'animate-in slide-in-from-right'\n }`}\n >\n {/* Drag handle on the left edge to resize the sheet. */}\n <div\n className=\"absolute left-0 top-0 bottom-0 z-10 w-1.5 -translate-x-1/2 cursor-col-resize hover:bg-primary/40\"\n onMouseDown={handleResizeStart}\n data-testid={`${panelId}-overlay-resize-handle`}\n />\n {children}\n </div>\n\n {/* Preview line — tracks the cursor during the drag; the panel resizes\n to this position only on release. */}\n {isResizing && dragWidth !== null && (\n <div\n className=\"absolute top-0 bottom-0 z-[60] w-0.5 bg-primary pointer-events-none\"\n style={{ right: dragWidth }}\n />\n )}\n {/* Transparent capture layer so the drag isn't interrupted by elements\n (iframes, the grid) swallowing pointer events. */}\n {isResizing && <div className=\"absolute inset-0 z-[55] cursor-col-resize\" />}\n </div>\n )\n}\n\nexport function PanelPortal({\n panelId,\n mode,\n isOpen,\n isExiting,\n onPopupClosed,\n onClose,\n popoutTitle,\n defaultWidth,\n children,\n}: PanelPortalProps) {\n const { windows: windowManager } = usePanelHostSupport()\n const [popupRoot, setPopupRoot] = useState<HTMLElement | null>(null)\n const popupWindowIdRef = useRef<string | null>(null)\n\n // Open popup window when switching to popout mode\n useEffect(() => {\n if (!isOpen || mode !== 'popout') {\n // Close popup if we're leaving popout mode (intentional mode switch, not user closing)\n if (popupWindowIdRef.current) {\n // Clear the onClose callback before closing so it doesn't trigger onPopupClosed\n windowManager.clearOnClose(popupWindowIdRef.current)\n windowManager.closeWindow(popupWindowIdRef.current)\n popupWindowIdRef.current = null\n setPopupRoot(null)\n }\n return\n }\n\n // Already have a popup open\n if (popupWindowIdRef.current) return\n\n const windowId = windowManager.createPopupWindow(\n `panel-${panelId}`,\n () => {\n popupWindowIdRef.current = null\n setPopupRoot(null)\n onPopupClosed?.()\n },\n popoutTitle || panelId\n )\n\n if (windowId) {\n const rootElement = windowManager.getRootElement(windowId)\n if (rootElement) {\n popupWindowIdRef.current = windowId\n setPopupRoot(rootElement)\n windowManager.getWindow(windowId)?.focus()\n }\n }\n }, [isOpen, mode, panelId, popoutTitle, onPopupClosed, windowManager])\n\n // Clean up on unmount\n useEffect(() => {\n return () => {\n if (popupWindowIdRef.current) {\n windowManager.closeWindow(popupWindowIdRef.current)\n }\n }\n }, [windowManager])\n\n if (!isOpen && !isExiting) return null\n\n // Popout: render into popup window. Its dialogs and menus open there too, not in the window\n // behind it (where the Sign dialog used to open, out of sight).\n if (mode === 'popout' && popupRoot) {\n return createPortal(\n <PortalContainerProvider container={popupRoot}>{children}</PortalContainerProvider>,\n popupRoot\n )\n }\n\n // Overlay: a slide-out sheet over the still-visible page. Rendered into the\n // layout's #app-overlay-zone — the content region BELOW the app topbar — so\n // the bar stays visible and interactive above every overlay. Falls back to\n // <body> (viewport-covering) when no zone is mounted (e.g. embedded shells).\n if (mode === 'overlay') {\n const overlayZone = document.getElementById(DEFAULT_OVERLAY_ZONE_ID)\n return createPortal(\n <OverlaySheet\n panelId={panelId}\n isExiting={isExiting}\n onClose={onClose}\n defaultWidth={defaultWidth}\n scoped={overlayZone !== null}\n >\n {children}\n </OverlaySheet>,\n overlayZone ?? document.body\n )\n }\n\n // Main: render into main content zone\n if (mode === 'main') {\n const mainZone = document.getElementById('main-zone')\n if (mainZone) {\n return createPortal(children, mainZone)\n }\n }\n\n // Docked: render into dock zone\n const dockZone = document.getElementById('dock-zone')\n if (dockZone) {\n return createPortal(children, dockZone)\n }\n\n // No target zone mounted yet — render nothing\n return null\n}\n"]}