@womp/kookie-ui 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/components.css +86 -35
  2. package/dist/cjs/components/_internal/pane-chrome.js +1 -1
  3. package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
  4. package/dist/cjs/components/_internal/shell-bottom.d.ts +7 -2
  5. package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
  6. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  7. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  8. package/dist/cjs/components/_internal/shell-inspector.d.ts +7 -2
  9. package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
  10. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  11. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  12. package/dist/cjs/components/_internal/shell-pane.js +1 -1
  13. package/dist/cjs/components/_internal/shell-pane.js.map +2 -2
  14. package/dist/cjs/components/_internal/shell-sidebar.d.ts +7 -2
  15. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  16. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  17. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  18. package/dist/cjs/components/_internal/shell-store.d.ts +6 -6
  19. package/dist/cjs/components/_internal/shell-store.d.ts.map +1 -1
  20. package/dist/cjs/components/_internal/shell-store.js +1 -1
  21. package/dist/cjs/components/_internal/shell-store.js.map +3 -3
  22. package/dist/cjs/components/index.js +1 -1
  23. package/dist/cjs/components/index.js.map +3 -3
  24. package/dist/cjs/components/navigator.js +1 -1
  25. package/dist/cjs/components/navigator.js.map +2 -2
  26. package/dist/cjs/components/shell.context.js +1 -1
  27. package/dist/cjs/components/shell.context.js.map +2 -2
  28. package/dist/cjs/components/shell.d.ts +25 -7
  29. package/dist/cjs/components/shell.d.ts.map +1 -1
  30. package/dist/cjs/components/shell.hooks.js +1 -1
  31. package/dist/cjs/components/shell.hooks.js.map +2 -2
  32. package/dist/cjs/components/shell.js +1 -1
  33. package/dist/cjs/components/shell.js.map +3 -3
  34. package/dist/cjs/components/toolbar.js +1 -1
  35. package/dist/cjs/components/toolbar.js.map +2 -2
  36. package/dist/cjs/index.js +1 -1
  37. package/dist/cjs/index.js.map +3 -3
  38. package/dist/esm/chunk-5BXCPANF.js +3 -0
  39. package/dist/esm/{chunk-GHWEXMF6.js.map → chunk-5BXCPANF.js.map} +3 -3
  40. package/dist/esm/{chunk-ZG2XQUOH.js → chunk-B447PNRD.js} +2 -2
  41. package/dist/esm/{chunk-QDAM2I6O.js → chunk-BR6Z2CAE.js} +2 -2
  42. package/dist/esm/{chunk-4G3FJUER.js → chunk-INGT6DB6.js} +2 -2
  43. package/dist/esm/{chunk-4ZHBNYXM.js → chunk-J6B7UCZN.js} +2 -2
  44. package/dist/esm/chunk-KDJM4NQQ.js +3 -0
  45. package/dist/esm/chunk-KDJM4NQQ.js.map +7 -0
  46. package/dist/esm/{chunk-LTUW36HM.js → chunk-KGCGT4MJ.js} +2 -2
  47. package/dist/esm/chunk-NO2JCJWI.js +3 -0
  48. package/dist/esm/chunk-NO2JCJWI.js.map +7 -0
  49. package/dist/esm/{chunk-NFSW36RG.js → chunk-ODHCDJ3Y.js} +2 -2
  50. package/dist/esm/chunk-UMQOTGJC.js +3 -0
  51. package/dist/esm/chunk-UMQOTGJC.js.map +7 -0
  52. package/dist/esm/chunk-XD676L6S.js +3 -0
  53. package/dist/esm/chunk-XD676L6S.js.map +7 -0
  54. package/dist/esm/{chunk-6SGJWML7.js → chunk-XKYPJTRN.js} +2 -2
  55. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  56. package/dist/esm/components/_internal/shell-bottom.d.ts +7 -2
  57. package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
  58. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  59. package/dist/esm/components/_internal/shell-inspector.d.ts +7 -2
  60. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  61. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  62. package/dist/esm/components/_internal/shell-pane.js +1 -1
  63. package/dist/esm/components/_internal/shell-sidebar.d.ts +7 -2
  64. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  65. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  66. package/dist/esm/components/_internal/shell-store.d.ts +6 -6
  67. package/dist/esm/components/_internal/shell-store.d.ts.map +1 -1
  68. package/dist/esm/components/_internal/shell-store.js +1 -1
  69. package/dist/esm/components/index.js +1 -1
  70. package/dist/esm/components/navigator.js +1 -1
  71. package/dist/esm/components/shell.context.js +1 -1
  72. package/dist/esm/components/shell.d.ts +25 -7
  73. package/dist/esm/components/shell.d.ts.map +1 -1
  74. package/dist/esm/components/shell.hooks.js +1 -1
  75. package/dist/esm/components/shell.js +1 -1
  76. package/dist/esm/components/sidebar.js +1 -1
  77. package/dist/esm/components/toolbar.js +1 -1
  78. package/dist/esm/index.js +1 -1
  79. package/package.json +1 -1
  80. package/src/components/_internal/shell-bottom.tsx +11 -6
  81. package/src/components/_internal/shell-inspector.tsx +11 -6
  82. package/src/components/_internal/shell-sidebar.tsx +11 -6
  83. package/src/components/_internal/shell-store.tsx +13 -13
  84. package/src/components/shell.css +133 -47
  85. package/src/components/shell.tsx +50 -32
  86. package/src/styles/tokens/color.css +2 -0
  87. package/styles.css +87 -35
  88. package/tokens/base.css +1 -0
  89. package/tokens.css +1 -0
  90. package/dist/esm/chunk-4B3S2DM7.js +0 -3
  91. package/dist/esm/chunk-4B3S2DM7.js.map +0 -7
  92. package/dist/esm/chunk-AKMRPGNP.js +0 -3
  93. package/dist/esm/chunk-AKMRPGNP.js.map +0 -7
  94. package/dist/esm/chunk-GHWEXMF6.js +0 -3
  95. package/dist/esm/chunk-ZBSGH74F.js +0 -3
  96. package/dist/esm/chunk-ZBSGH74F.js.map +0 -7
  97. package/dist/esm/chunk-ZHXEEOGI.js +0 -3
  98. package/dist/esm/chunk-ZHXEEOGI.js.map +0 -7
  99. /package/dist/esm/{chunk-ZG2XQUOH.js.map → chunk-B447PNRD.js.map} +0 -0
  100. /package/dist/esm/{chunk-QDAM2I6O.js.map → chunk-BR6Z2CAE.js.map} +0 -0
  101. /package/dist/esm/{chunk-4G3FJUER.js.map → chunk-INGT6DB6.js.map} +0 -0
  102. /package/dist/esm/{chunk-4ZHBNYXM.js.map → chunk-J6B7UCZN.js.map} +0 -0
  103. /package/dist/esm/{chunk-LTUW36HM.js.map → chunk-KGCGT4MJ.js.map} +0 -0
  104. /package/dist/esm/{chunk-NFSW36RG.js.map → chunk-ODHCDJ3Y.js.map} +0 -0
  105. /package/dist/esm/{chunk-6SGJWML7.js.map → chunk-XKYPJTRN.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/_internal/pane-chrome.tsx", "../../../../src/components/scroll-area.tsx", "../../../../src/props/as-child.prop.ts", "../../../../src/props/radius.prop.ts", "../../../../src/components/scroll-area.props.tsx", "../../../../src/hooks/use-scroll-edges.ts", "../../../../src/hooks/use-thumb-sync.ts", "../../../../src/helpers/get-subtree.ts", "../../../../src/helpers/extract-props.ts", "../../../../src/helpers/compile-prop-defs.ts", "../../../../src/props/prop-def.ts", "../../../../src/helpers/has-own-property.ts", "../../../../src/helpers/is-responsive-object.ts", "../../../../src/helpers/get-responsive-styles.ts", "../../../../src/helpers/merge-styles.ts", "../../../../src/props/width.props.ts", "../../../../src/props/height.props.ts", "../../../../src/components/_internal/shell-store.tsx", "../../../../src/components/shell.types.ts", "../../../../src/components/_internal/pane-band-context.ts", "../../../../src/components/_internal/shell-page-scroll.ts"],
4
- "sourcesContent": ["'use client';\n\n/**\n * A pane's own chrome: a header row, a scrolling region and a footer row.\n *\n * Shell.Sidebar and Shell.Panel render these as `Shell.PaneHeader`, `Shell.Scroll` and\n * `Shell.PaneFooter`. The pane renders anything; with these parts it is the presentation, so\n * Sidebar's menu parts work inside it with no `Sidebar.Root`. The index comes from the nearest\n * Shell (`Shell.Root size`), or from a deprecated `Sidebar.Root` that still wraps them.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { ScrollArea } from '../scroll-area.js';\nimport { ShellStoreContext } from './shell-store.js';\nimport { PaneBandSizeContext, type BandSize } from './pane-band-context.js';\nimport { usePageScrollMedia } from './shell-page-scroll.js';\n\ntype PaneSize = '1' | '2' | '3';\n\ntype SidebarVisualContextValue = {\n size: PaneSize;\n menuVariant: 'solid' | 'soft';\n presentation?: 'thin' | 'expanded';\n color?: string;\n};\n\n/** Size, menu highlight and presentation for the Sidebar parts. Internal: not exported. */\nconst SidebarVisualContext = React.createContext<SidebarVisualContextValue | null>(null);\n\nfunction useSidebarVisual() {\n return React.useContext(SidebarVisualContext);\n}\n\n/** The Shell's index. `Shell.Root size` sets it; panes hand it to their chrome. */\nconst ShellSizeContext = React.createContext<PaneSize>('2');\n\n/**\n * True inside `Shell.Content`. `Shell.Root` sets it back to false, so a Shell nested in the\n * content gets pane chrome in its own panes. Read by `Shell.Scroll`: in the content it holds a\n * page, not a menu, so it takes none of the menu's padding, gap or layering.\n */\nconst ShellContentContext = React.createContext(false);\n\n/**\n * True inside a window Shell: one with no `contained` and no `height`, which lets the page scroll\n * on a narrow touch screen. Each `Shell.Root` sets its own, so a Shell nested in another answers\n * for itself.\n */\nconst ShellWindowContext = React.createContext(false);\n\n/**\n * Gives a Shell pane's children the Shell's index, so Sidebar parts size themselves. In a Rail\n * the rows are `thin`: icon tiles with a small label, sub-menus as dropdowns.\n */\nfunction PaneChromeScope({ children, presentation }: { children: React.ReactNode; presentation?: 'thin' }) {\n const size = React.useContext(ShellSizeContext);\n const value = React.useMemo<SidebarVisualContextValue>(() => ({ size, menuVariant: 'soft', presentation }), [size, presentation]);\n return <SidebarVisualContext.Provider value={value}>{children}</SidebarVisualContext.Provider>;\n}\n\nfunction useChromeClasses() {\n const visual = useSidebarVisual();\n // A pane with no scope (Inspector, Bottom) still takes the Shell's index.\n const shellSize = React.useContext(ShellSizeContext);\n const size = visual?.size ?? shellSize;\n const menuVariant = visual?.menuVariant ?? 'soft';\n return ['kui-ShellPaneChrome', `kui-r-size-${size}`, `kui-menu-variant-${menuVariant}`];\n}\n\n/**\n * The index a Toolbar in a pane's header or footer rests at when it states none: one step above\n * the Shell's, so the band reads as chrome over the rows (v2 BAND_STEP). 4 has no step above.\n */\nconst BAND_STEP = { '1': '2', '2': '3', '3': '4', '4': '4' } as const satisfies Record<BandSize, BandSize>;\n\nfunction useBandSize(): BandSize {\n const visual = useSidebarVisual();\n const shellSize = React.useContext(ShellSizeContext);\n return BAND_STEP[visual?.size ?? shellSize];\n}\n\n/**\n * The size a Toolbar with no `size` of its own rests at, or null for none.\n *\n * In a pane's header or footer it is that band's size. Anywhere else inside a Shell, such as\n * `Shell.Content` or a pane's body, it is the same step: one above the Shell's index, so a\n * toolbar in the content area matches the ones in the pane headers beside it (v2 sizes every\n * toolbar this way). A pane's scrolling list, and anything outside a Shell, has none.\n */\nfunction usePaneBandSize(): BandSize | null {\n const band = React.useContext(PaneBandSizeContext);\n const inShell = React.useContext(ShellStoreContext) !== null;\n const step = useBandSize();\n if (band !== undefined) return band;\n return inShell ? step : null;\n}\n\ninterface PaneHeaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Floats the row over the top of `Shell.Scroll`, so the list scrolls behind it. The list\n * starts below the row, and `Shell.Scroll fade` fades it out under the row. The row paints\n * nothing and lets clicks through between its controls; a `Toolbar backdrop` in it keeps\n * the controls readable.\n */\n float?: boolean;\n}\n\n/** A pane's header row, pinned above its scrolling region. */\nconst PaneHeader = React.forwardRef<HTMLDivElement, PaneHeaderProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneHeader', 'kui-SidebarHeader', 'kui-SidebarHeader--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneHeader.displayName = 'Shell.PaneHeader';\n\ninterface PaneFooterProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Floats the row over the bottom of `Shell.Scroll`, the way `Shell.PaneHeader float` does at the top. */\n float?: boolean;\n}\n\n/** A pane's footer row, pinned below its scrolling region. */\nconst PaneFooter = React.forwardRef<HTMLDivElement, PaneFooterProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneFooter', 'kui-SidebarFooter', 'kui-SidebarFooter--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneFooter.displayName = 'Shell.PaneFooter';\n\ninterface ScrollProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Fades the list out toward an edge with more past it, and under a floating header or footer. */\n fade?: boolean;\n /**\n * Keeps the pane's list (its menu rows) when React puts this under `Shell.Content`, as when an\n * app renders a pane's content in its page and portals it into `Shell.Panel`. In a Rail, Panel\n * or Sidebar it is already the pane's list.\n */\n pane?: boolean;\n}\n\n/**\n * The one region of a pane that scrolls; it takes the room the header and footer leave.\n * In `Shell.Content` it is the page's scroller, and a `Shell.PaneHeader float` beside it pins\n * the page's toolbar over it. The ref, events and ARIA props land on the element that scrolls;\n * `className`, `style` and `dir` apply to the content inside it. In a Rail, Panel or Sidebar the pane is\n * already a navigation landmark, so it needs no role of its own.\n */\nconst Scroll = React.forwardRef<HTMLDivElement, ScrollProps>(({ className, style, dir, children, fade = false, pane = false, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n // A Sidebar.Root inside the content still gets a menu.\n const contentPane = React.useContext(ShellContentContext);\n const visual = useSidebarVisual();\n const inContent = contentPane && visual === null && !pane;\n // While the page scrolls, the content's viewport scrolls nothing: as a tab stop it would take a\n // Tab, ring the whole page and move nothing. Resolved after mount; a `tabIndex` of the caller's wins.\n const windowShell = React.useContext(ShellWindowContext);\n const pageScrolls = usePageScrollMedia();\n if (inContent) {\n const tabIndex = props.tabIndex ?? (windowShell && pageScrolls ? -1 : undefined);\n return (\n <ScrollArea {...props} tabIndex={tabIndex} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-ShellScrollContent', className)}>\n {children}\n </div>\n </ScrollArea>\n );\n }\n return (\n <ScrollArea {...props} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-BaseMenuContent', 'kui-SidebarContent', ...chrome, className)}>\n {/* A header's band does not reach a Toolbar in the scrolling list. */}\n <PaneBandSizeContext.Provider value={null}>\n <div className=\"kui-BaseMenuViewport\">{children}</div>\n </PaneBandSizeContext.Provider>\n </div>\n </ScrollArea>\n );\n});\nScroll.displayName = 'Shell.Scroll';\n\nexport { SidebarVisualContext, useSidebarVisual, ShellSizeContext, ShellContentContext, ShellWindowContext, PaneChromeScope, PaneHeader, PaneFooter, Scroll, BAND_STEP, usePaneBandSize };\nexport type { SidebarVisualContextValue, PaneSize, BandSize, PaneHeaderProps, PaneFooterProps, ScrollProps };\n", "import * as React from 'react';\nimport classNames from 'classnames';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { useComposedRefs } from 'radix-ui/internal';\n\nimport { scrollAreaPropDefs } from './scroll-area.props.js';\nimport { scrollableOverflow, useScrollEdges } from '../hooks/use-scroll-edges.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\nimport { getSubtree } from '../helpers/get-subtree.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\n\ntype ScrollAreaElement = React.ElementRef<typeof ScrollAreaPrimitive.Viewport>;\ntype ScrollAreaOwnProps = GetPropDefTypes<typeof scrollAreaPropDefs>;\ninterface ScrollAreaProps\n extends ComponentPropsWithout<typeof ScrollAreaPrimitive.Root, RemovedProps>,\n ComponentPropsWithout<typeof ScrollAreaPrimitive.Viewport, RemovedProps | 'dir'>,\n ScrollAreaOwnProps,\n WidthProps,\n HeightProps {}\n\n/** Menus and listboxes move focus between their items, so a scroller inside one stays out of the tab order. */\nconst OWNS_FOCUS = '[role=\"menu\"], [role=\"listbox\"]';\n\n/**\n * Puts the viewport in the tab order while it has something to scroll, so a keyboard can reach it\n * and scroll it with the arrow keys. A `tabIndex` the caller set wins.\n */\nfunction useFocusableWhileScrollable(element: HTMLDivElement | null, enabled: boolean) {\n React.useEffect(() => {\n if (!enabled || !element || element.closest(OWNS_FOCUS)) return;\n let frame = 0;\n const update = () => {\n frame = 0;\n const overflow = scrollableOverflow(element);\n const scrollable = overflow.x > 0 || overflow.y > 0;\n if (scrollable) element.setAttribute('tabindex', '0');\n else element.removeAttribute('tabindex');\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n update();\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);\n observer?.observe(element);\n for (const child of Array.from(element.children)) observer?.observe(child);\n return () => {\n if (frame) cancelAnimationFrame(frame);\n // The attribute stays: a caller who now sets `tabIndex` has already written it.\n observer?.disconnect();\n };\n }, [element, enabled]);\n}\n\nconst ScrollArea = React.forwardRef<ScrollAreaElement, ScrollAreaProps>((props, forwardedRef) => {\n const {\n asChild,\n children,\n className,\n style,\n type,\n scrollHideDelay = type !== 'scroll' ? 0 : undefined,\n dir,\n radius = scrollAreaPropDefs.radius.default,\n scrollbars = scrollAreaPropDefs.scrollbars.default,\n fade = scrollAreaPropDefs.fade.default,\n ...viewportProps\n } = extractProps(props, widthPropDefs, heightPropDefs);\n const [viewport, setViewport] = React.useState<HTMLDivElement | null>(null);\n const setEdgesElement = useScrollEdges<HTMLDivElement>(fade);\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n const viewportRef = useComposedRefs(forwardedRef, setEdgesElement, setThumbViewport, setViewport);\n useFocusableWhileScrollable(viewport, viewportProps.tabIndex === undefined);\n // A named scroller is a region, so a screen reader can find it and say what it holds.\n const named = viewportProps['aria-label'] !== undefined || viewportProps['aria-labelledby'] !== undefined;\n\n return (\n <ScrollAreaPrimitive.Root\n type={type}\n scrollHideDelay={scrollHideDelay}\n dir={dir}\n className={classNames('kui-ScrollAreaRoot', className)}\n data-fade={fade ? '' : undefined}\n style={style}\n asChild={asChild}\n >\n {getSubtree({ asChild, children }, (children) => (\n <>\n <ScrollAreaPrimitive.Viewport\n role={named ? 'region' : undefined}\n {...viewportProps}\n ref={viewportRef}\n className=\"kui-ScrollAreaViewport\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n\n <div className=\"kui-ScrollAreaViewportFocusRing\" />\n\n {scrollbars !== 'vertical' ? (\n <ScrollAreaPrimitive.Scrollbar\n data-radius={radius}\n orientation=\"horizontal\"\n className=\"kui-ScrollAreaScrollbar\"\n >\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n ) : null}\n\n {scrollbars !== 'horizontal' ? (\n <ScrollAreaPrimitive.Scrollbar\n data-radius={radius}\n orientation=\"vertical\"\n className=\"kui-ScrollAreaScrollbar\"\n >\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n ) : null}\n\n {scrollbars === 'both' ? (\n <ScrollAreaPrimitive.Corner className=\"kui-ScrollAreaCorner\" />\n ) : null}\n </>\n ))}\n </ScrollAreaPrimitive.Root>\n );\n});\nScrollArea.displayName = 'ScrollArea';\n\nexport { ScrollArea };\nexport type { ScrollAreaProps };\n", "import type { PropDef } from './prop-def.js';\n\nconst asChildPropDef = {\n /**\n * Composes the component into its immediate child instead of rendering its own HTML element.\n * You\u2019ll have to provide a single React Element child.\n */\n asChild: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport { asChildPropDef };\n", "import type { PropDef } from './prop-def.js';\n\nconst radii = ['none', 'small', 'medium', 'large', 'full'] as const;\n\nconst radiusPropDef = {\n radius: {\n type: 'enum',\n values: radii,\n default: undefined,\n },\n} satisfies {\n radius: PropDef<(typeof radii)[number]>;\n};\n\nexport { radiusPropDef, radii };\n", "import { asChildPropDef } from '../props/as-child.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst scrollbarsValues = ['vertical', 'horizontal', 'both'] as const;\n\nconst scrollAreaPropDefs = {\n ...asChildPropDef,\n ...radiusPropDef,\n scrollbars: { type: 'enum', values: scrollbarsValues, default: 'both' },\n /**\n * Fades the content toward the top and bottom edges while there is more content past them.\n * An edge with nothing hidden past it does not fade. A floating band over an edge can set\n * `--scroll-fade-start` or `--scroll-fade-end` to its height, so content fades as it passes\n * under the band.\n */\n fade: { type: 'boolean', default: false },\n} satisfies {\n scrollbars: PropDef<(typeof scrollbarsValues)[number]>;\n fade: PropDef<boolean>;\n};\n\nexport { scrollAreaPropDefs };\n", "import * as React from 'react';\n\n/**\n * How far content runs past the element on each axis, in px. An axis whose overflow is hidden\n * cannot be scrolled (a ScrollArea with `scrollbars=\"vertical\"` hides the inline axis), so it\n * counts as 0, however wide the content.\n */\nexport function scrollableOverflow(element: HTMLElement) {\n const style = getComputedStyle(element);\n return {\n x: style.overflowX === 'hidden' ? 0 : Math.max(0, element.scrollWidth - element.clientWidth),\n y: style.overflowY === 'hidden' ? 0 : Math.max(0, element.scrollHeight - element.clientHeight),\n };\n}\n\n/**\n * Publishes how much content is hidden past each edge of a scroller, as\n * `--scroll-overflow-start` and `--scroll-overflow-end` (block axis) and\n * `--scroll-overflow-x-start` and `--scroll-overflow-x-end` (inline axis, from\n * the inline start, so right-to-left reads the same) in px on the element.\n * The scroll fade reads them, so an edge fades only while content is hidden\n * there, and the fade ramps in over the first pixels of scrolling.\n *\n * Writes happen at most once per frame, on scroll and when the element or its\n * content resizes. Nothing re-renders.\n */\nexport function useScrollEdges<T extends HTMLElement>(enabled: boolean) {\n const [element, setElement] = React.useState<T | null>(null);\n\n React.useEffect(() => {\n if (!enabled || !element) return;\n let frame = 0;\n const write = () => {\n frame = 0;\n const overflow = scrollableOverflow(element);\n const start = Math.max(0, element.scrollTop);\n const end = Math.max(0, overflow.y - element.scrollTop);\n element.style.setProperty('--scroll-overflow-start', `${start}px`);\n element.style.setProperty('--scroll-overflow-end', `${end}px`);\n // scrollLeft runs negative in right-to-left, so its size is the distance from the inline start.\n const xStart = Math.abs(element.scrollLeft);\n const xEnd = Math.max(0, overflow.x - xStart);\n element.style.setProperty('--scroll-overflow-x-start', `${xStart}px`);\n element.style.setProperty('--scroll-overflow-x-end', `${xEnd}px`);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(write);\n };\n write();\n element.addEventListener('scroll', schedule, { passive: true });\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);\n observer?.observe(element);\n for (const child of Array.from(element.children)) observer?.observe(child);\n const mutations = typeof MutationObserver === 'undefined' ? null : new MutationObserver(schedule);\n mutations?.observe(element, { childList: true });\n return () => {\n if (frame) cancelAnimationFrame(frame);\n element.removeEventListener('scroll', schedule);\n observer?.disconnect();\n mutations?.disconnect();\n element.style.removeProperty('--scroll-overflow-start');\n element.style.removeProperty('--scroll-overflow-end');\n element.style.removeProperty('--scroll-overflow-x-start');\n element.style.removeProperty('--scroll-overflow-x-end');\n };\n }, [enabled, element]);\n\n return setElement;\n}\n", "import * as React from 'react';\n\n/**\n * Keeps a Radix ScrollArea's thumbs on the scroll position on every scroll.\n *\n * Radix moves a thumb from a requestAnimationFrame loop it starts on the first scroll event of a\n * burst. Next's production minifier compiles that self-calling loop away, so in a production\n * build the thumb moves once, sits while the content scrolls, and jumps when the next burst\n * starts. This writes the transform Radix would, at most once per frame. Nothing re-renders.\n *\n * Pass the hook's setter as a ref on `ScrollArea.Viewport`; the scrollbars are its siblings.\n */\nexport function useThumbSync<T extends HTMLElement>() {\n const [viewport, setViewport] = React.useState<T | null>(null);\n\n React.useEffect(() => {\n const root = viewport?.parentElement;\n if (!viewport || !root) return;\n let frame = 0;\n const write = () => {\n frame = 0;\n for (const thumb of root.querySelectorAll<HTMLElement>(':scope > .kui-ScrollAreaScrollbar > .kui-ScrollAreaThumb')) {\n const scrollbar = thumb.parentElement as HTMLElement;\n const style = getComputedStyle(scrollbar);\n if (scrollbar.dataset.orientation === 'horizontal') {\n const track = scrollbar.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);\n const offset = thumbOffset(viewport.scrollLeft, viewport.scrollWidth - viewport.offsetWidth, track - thumb.offsetWidth);\n thumb.style.transform = `translate3d(${offset}px, 0, 0)`;\n } else {\n const track = scrollbar.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n const offset = thumbOffset(viewport.scrollTop, viewport.scrollHeight - viewport.offsetHeight, track - thumb.offsetHeight);\n thumb.style.transform = `translate3d(0, ${offset}px, 0)`;\n }\n }\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(write);\n };\n viewport.addEventListener('scroll', schedule, { passive: true });\n return () => {\n if (frame) cancelAnimationFrame(frame);\n viewport.removeEventListener('scroll', schedule);\n };\n }, [viewport]);\n\n return setViewport;\n}\n\n/** Radix's mapping: scroll position over its range, onto the room the thumb has to travel. */\nfunction thumbOffset(position: number, range: number, travel: number) {\n if (range <= 0 || travel <= 0) return 0;\n // Right-to-left scrolls run from -range to 0; the thumb then travels from -travel to 0.\n const clamped = Math.min(Math.max(position, -range), range);\n return (clamped / range) * travel;\n}\n", "import * as React from 'react';\n\n/**\n * This is a helper function that is used when a component supports `asChild`\n * using the `Slot` component but its implementation contains nested DOM elements.\n *\n * Using it ensures if a consumer uses the `asChild` prop, the elements are in\n * correct order in the DOM, adopting the intended consumer `children`.\n */\nexport function getSubtree(\n options: { asChild: boolean | undefined; children: React.ReactNode },\n content: React.ReactNode | ((children: React.ReactNode) => React.ReactNode)\n) {\n const { asChild, children } = options;\n if (!asChild) return typeof content === 'function' ? content(children) : content;\n\n const firstChild = React.Children.only(children) as React.ReactElement;\n return React.cloneElement(firstChild, {\n // @ts-expect-error\n children: typeof content === 'function' ? content(firstChild.props.children) : content,\n });\n}\n", "import classNames from 'classnames';\n\nimport { getCompiledPropDefs } from './compile-prop-defs.js';\nimport { getResponsiveClassNames, getResponsiveStyles } from './get-responsive-styles.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\nimport { mergeStyles } from './merge-styles.js';\n\nimport type { CompiledPropDef } from './compile-prop-defs.js';\nimport type * as React from 'react';\nimport type { PropDef } from '../props/prop-def.js';\n\ntype PropDefsWithClassName<T> = T extends Record<string, PropDef> ? { [K in keyof T]: T[K] extends { className: string } ? K : never }[keyof T] : never;\n\ntype ResponsiveValue = Record<string, string | undefined>;\n\n/**\n * Fills in the `initial` breakpoint of a responsive value from the prop def's\n * default, and coerces an invalid `initial` enum value back to that default.\n *\n * Returns the value untouched when nothing needs changing, and a copy otherwise\n * \u2014 callers routinely hoist responsive objects to module scope, so mutating the\n * caller's object would corrupt it for every later render.\n */\nfunction normalizeResponsiveValue(value: ResponsiveValue, propDef: CompiledPropDef) {\n let initial = value.initial;\n let changed = false;\n\n if (propDef.hasDefault && initial === undefined) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(initial)) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n return changed ? { ...value, initial } : value;\n}\n\n/**\n * Takes props, checks them against prop defs that have a `className` on them,\n * adds necessary CSS classes and inline styles, and returns the props without\n * the corresponding prop defs that were used to formulate the new `className`\n * and `style` values. Also applies prop def defaults to every prop.\n */\nfunction extractProps<P extends { className?: string; style?: React.CSSProperties; [key: string]: any }, T extends Record<string, PropDef>[]>(\n props: P,\n ...propDefs: T\n): Omit<P & { className?: string; style?: React.CSSProperties }, PropDefsWithClassName<T[number]>> {\n const { styling, passthrough, stylingKeys } = getCompiledPropDefs(propDefs);\n\n // Copy the props that survive to the element rather than spreading and then\n // deleting the styling keys. Deleting off a spread demotes the object to\n // dictionary mode in V8, and this object is on the render path of every\n // component in the library.\n const extractedProps: Record<string, any> = {};\n for (const key in props) {\n if (stylingKeys.has(key)) continue;\n extractedProps[key] = props[key];\n }\n\n for (let i = 0; i < passthrough.length; i++) {\n const propDef = passthrough[i];\n const value = extractedProps[propDef.key];\n\n if (value === undefined) {\n if (propDef.hasDefault) extractedProps[propDef.key] = propDef.default;\n continue;\n }\n\n // Fall back to the default when the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n extractedProps[propDef.key] = propDef.default;\n }\n }\n\n let style: ReturnType<typeof mergeStyles>;\n const classes: string[] = [];\n\n for (let i = 0; i < styling.length; i++) {\n const propDef = styling[i];\n let value = props[propDef.key];\n\n // Apply prop def defaults\n if (value === undefined && propDef.hasDefault) {\n value = propDef.default;\n }\n\n // Apply the default value if the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n value = propDef.default;\n }\n\n if (!value) continue;\n\n if (isResponsiveObject(value)) {\n // Make sure we are not threading through responsive values for non-responsive prop defs\n if (!propDef.responsive) continue;\n value = normalizeResponsiveValue(value, propDef);\n }\n\n if (propDef.type === 'enum') {\n const propClassName = getResponsiveClassNames({\n allowArbitraryValues: false,\n value,\n className: propDef.className!,\n propValues: propDef.values,\n propValueSet: propDef.valueSet,\n parseValue: propDef.parseValue,\n });\n\n if (propClassName) classes.push(propClassName);\n continue;\n }\n\n if (propDef.type === 'string' || propDef.type === 'enum | string') {\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className: propDef.className!,\n customProperties: propDef.customProperties!,\n // `string` prop defs have no enum values, so every value is arbitrary\n propValues: propDef.type === 'string' ? [] : propDef.values,\n propValueSet: propDef.type === 'string' ? undefined : propDef.valueSet,\n parseValue: propDef.parseValue,\n value,\n });\n\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n if (propClassNames) classes.push(propClassNames);\n continue;\n }\n\n if (propDef.type === 'boolean') {\n // TODO handle responsive boolean props\n classes.push(propDef.className!);\n continue;\n }\n }\n\n extractedProps.className = classNames(classes.length > 0 ? classes.join(' ') : undefined, props.className);\n extractedProps.style = mergeStyles(style, props.style);\n return extractedProps as ReturnType<typeof extractProps<P, T>>;\n}\n\nexport { extractProps };\n", "import type { PropDef } from '../props/prop-def.js';\n\n/**\n * A prop def pre-processed into the exact shape `extractProps` needs at render\n * time. Everything that can be derived from the static prop def \u2014 enum\n * membership sets, whether the def is responsive, whether it carries a default\n * \u2014 is computed once here instead of on every render.\n */\ninterface CompiledPropDef {\n key: string;\n type: PropDef['type'];\n default: unknown;\n hasDefault: boolean;\n responsive: boolean;\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n /** The prop def's own enum values, kept for the responsive class name helpers. */\n values: readonly string[];\n /** O(1) membership for `values`. */\n valueSet: ReadonlySet<string>;\n /**\n * `values` plus the default, used to coerce invalid enum values back to the\n * default. Only present for `type: 'enum'` \u2014 `'enum | string'` props accept\n * arbitrary strings and must not be coerced.\n */\n enumValueSet?: ReadonlySet<unknown>;\n}\n\ninterface CompiledPropDefs {\n /** Defs that contribute a class name and/or custom properties. */\n styling: CompiledPropDef[];\n /**\n * Defs that pass through to the element but still need a default applied or\n * an invalid enum value coerced. Defs that can do neither are omitted\n * entirely \u2014 they are already correct as passed.\n */\n passthrough: CompiledPropDef[];\n /** Keys consumed by `styling`, so they can be skipped when copying props. */\n stylingKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_VALUES: readonly string[] = [];\nconst EMPTY_SET: ReadonlySet<string> = new Set();\n\nfunction compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);\n const styling: CompiledPropDef[] = [];\n const passthrough: CompiledPropDef[] = [];\n const stylingKeys = new Set<string>();\n\n for (const key in merged) {\n // The PropDef union is narrowed per-field below; reading the optional\n // members off the union directly is what the runtime actually needs.\n const def = merged[key] as PropDef & {\n default?: unknown;\n values?: readonly string[];\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n responsive?: true;\n };\n\n const values = def.values ?? EMPTY_VALUES;\n const compiled: CompiledPropDef = {\n key,\n type: def.type,\n default: def.default,\n hasDefault: def.default !== undefined,\n responsive: 'responsive' in def,\n className: def.className,\n customProperties: def.customProperties,\n parseValue: def.parseValue,\n values,\n valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,\n enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,\n };\n\n if (def.className) {\n styling.push(compiled);\n stylingKeys.add(key);\n } else if (compiled.hasDefault || def.type === 'enum') {\n // Anything else is copied through untouched, so there is nothing to do.\n passthrough.push(compiled);\n }\n }\n\n return { styling, passthrough, stylingKeys };\n}\n\ninterface CacheNode {\n children: WeakMap<object, CacheNode>;\n compiled?: CompiledPropDefs;\n}\n\nconst cacheRoot: CacheNode = { children: new WeakMap() };\n\n/**\n * Compiles a set of prop defs, memoized on the identity of the prop def objects\n * themselves. Components always pass the same module-level constants, so after\n * the first render of a given component this is a couple of WeakMap lookups\n * instead of merging 50-odd prop defs into a fresh object.\n */\nfunction getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n let node = cacheRoot;\n\n for (let i = 0; i < propDefs.length; i++) {\n const propDef = propDefs[i];\n let child = node.children.get(propDef);\n if (child === undefined) {\n child = { children: new WeakMap() };\n node.children.set(propDef, child);\n }\n node = child;\n }\n\n return (node.compiled ??= compile(propDefs));\n}\n\nexport { getCompiledPropDefs };\nexport type { CompiledPropDef, CompiledPropDefs };\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n", "import type { GetPropDefTypes, PropDef } from './prop-def.js';\n\nconst widthPropDefs = {\n /**\n * Sets the CSS **width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * width=\"100px\"\n * width={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/width\n */\n width: {\n type: 'string',\n className: 'kui-r-w',\n customProperties: ['--width'],\n responsive: true,\n },\n /**\n * Sets the CSS **min-width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * minWidth=\"100px\"\n * minWidth={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/min-width\n */\n minWidth: {\n type: 'string',\n className: 'kui-r-min-w',\n customProperties: ['--min-width'],\n responsive: true,\n },\n /**\n * Sets the CSS **max-width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * maxWidth=\"100px\"\n * maxWidth={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n */\n maxWidth: {\n type: 'string',\n className: 'kui-r-max-w',\n customProperties: ['--max-width'],\n responsive: true,\n },\n} satisfies {\n width: PropDef<string>;\n minWidth: PropDef<string>;\n maxWidth: PropDef<string>;\n};\n\ntype WidthProps = GetPropDefTypes<typeof widthPropDefs>;\n\nexport { widthPropDefs };\nexport type { WidthProps };\n", "import type { PropDef, GetPropDefTypes } from './prop-def.js';\n\nconst heightPropDefs = {\n /**\n * Sets the CSS **height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * height=\"100px\"\n * height={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/height\n */\n height: {\n type: 'string',\n className: 'kui-r-h',\n customProperties: ['--height'],\n responsive: true,\n },\n /**\n * Sets the CSS **min-height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * minHeight=\"100px\"\n * minHeight={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/min-height\n */\n minHeight: {\n type: 'string',\n className: 'kui-r-min-h',\n customProperties: ['--min-height'],\n responsive: true,\n },\n /**\n * Sets the CSS **max-height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * maxHeight=\"100px\"\n * maxHeight={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/max-height\n */\n maxHeight: {\n type: 'string',\n className: 'kui-r-max-h',\n customProperties: ['--max-height'],\n responsive: true,\n },\n} satisfies {\n height: PropDef<string>;\n minHeight: PropDef<string>;\n maxHeight: PropDef<string>;\n};\n\ntype HeightProps = GetPropDefTypes<typeof heightPropDefs>;\n\nexport { heightPropDefs };\nexport type { HeightProps };\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Inset \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type InsetPaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellInsetContext = React.createContext<{\n registerInset: (id: InsetPaneId) => void;\n unregisterInset: (id: InsetPaneId) => void;\n} | null>(null);\n\n/** Registers a pane's `inset` with the Root, which paints the backdrop while any pane is inset. */\nexport function useInsetRegistration(id: InsetPaneId, inset: boolean | undefined) {\n const ctx = React.useContext(ShellInsetContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerInset, unregisterInset } = ctx;\n useLayoutEffect(() => {\n if (!inset) return;\n registerInset(id);\n return () => unregisterInset(id);\n }, [id, inset, registerInset, unregisterInset]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "import * as React from 'react';\n\ntype BandSize = '1' | '2' | '3' | '4';\n\n/**\n * Set by `Shell.PaneHeader` and `Shell.PaneFooter` to their band size, and by `Shell.Scroll` to\n * null (a scrolling list has no band). `PortalTheme`, the root of every portalled surface\n * (Popover, Dialog, Sheet, menus), sets null too, so a Toolbar in one does not take the Shell's\n * step; a `Theme asChild` an app nests in a pane leaves it alone. `Shell.Root` clears it again.\n * Unset (`undefined`) everywhere else.\n *\n * Its own module so PortalTheme can reset it without bringing the Shell.\n */\nconst PaneBandSizeContext = React.createContext<BandSize | null | undefined>(undefined);\n\nexport { PaneBandSizeContext };\nexport type { BandSize };\n", "'use client';\n\nimport * as React from 'react';\n\n/**\n * When a window Shell lets the page scroll: a narrow window (below the `sm` breakpoint) under a\n * coarse pointer. The stylesheet decides it (shell.css, the page-scroll block), so first paint is\n * right with no script. This is the script's copy, for the few things only script can do when the\n * answer changes: carry the reading position between the two scrollers, and take the content's\n * unused viewport out of the tab order. A test holds it equal to the stylesheet's.\n */\nexport const PAGE_SCROLL_QUERY = '(max-width: 767.98px) and (pointer: coarse)';\n\nlet list: MediaQueryList | undefined;\nconst media = () => (list ??= window.matchMedia(PAGE_SCROLL_QUERY));\n\nfunction listen(m: MediaQueryList, handler: () => void): () => void {\n // Safari below 14 has only the deprecated listener API.\n if (typeof m.addEventListener === 'function') {\n m.addEventListener('change', handler);\n return () => m.removeEventListener('change', handler);\n }\n m.addListener?.(handler);\n return () => m.removeListener?.(handler);\n}\n\nfunction subscribe(onChange: () => void): () => void {\n return listen(media(), onChange);\n}\n\n/** True where a window Shell lets the page scroll. False on the server and through hydration. */\nexport function usePageScrollMedia(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => media().matches,\n () => false,\n );\n}\n\n/** Whether the page scrolls right now. */\nexport function pageScrollMatches(): boolean {\n return media().matches;\n}\n\n/** Subscribes to the answer changing, outside React. */\nexport function onPageScrollMediaChange(onChange: (matches: boolean) => void): () => void {\n const m = media();\n return listen(m, () => onChange(m.matches));\n}\n"],
4
+ "sourcesContent": ["'use client';\n\n/**\n * A pane's own chrome: a header row, a scrolling region and a footer row.\n *\n * Shell.Sidebar and Shell.Panel render these as `Shell.PaneHeader`, `Shell.Scroll` and\n * `Shell.PaneFooter`. The pane renders anything; with these parts it is the presentation, so\n * Sidebar's menu parts work inside it with no `Sidebar.Root`. The index comes from the nearest\n * Shell (`Shell.Root size`), or from a deprecated `Sidebar.Root` that still wraps them.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { ScrollArea } from '../scroll-area.js';\nimport { ShellStoreContext } from './shell-store.js';\nimport { PaneBandSizeContext, type BandSize } from './pane-band-context.js';\nimport { usePageScrollMedia } from './shell-page-scroll.js';\n\ntype PaneSize = '1' | '2' | '3';\n\ntype SidebarVisualContextValue = {\n size: PaneSize;\n menuVariant: 'solid' | 'soft';\n presentation?: 'thin' | 'expanded';\n color?: string;\n};\n\n/** Size, menu highlight and presentation for the Sidebar parts. Internal: not exported. */\nconst SidebarVisualContext = React.createContext<SidebarVisualContextValue | null>(null);\n\nfunction useSidebarVisual() {\n return React.useContext(SidebarVisualContext);\n}\n\n/** The Shell's index. `Shell.Root size` sets it; panes hand it to their chrome. */\nconst ShellSizeContext = React.createContext<PaneSize>('2');\n\n/**\n * True inside `Shell.Content`. `Shell.Root` sets it back to false, so a Shell nested in the\n * content gets pane chrome in its own panes. Read by `Shell.Scroll`: in the content it holds a\n * page, not a menu, so it takes none of the menu's padding, gap or layering.\n */\nconst ShellContentContext = React.createContext(false);\n\n/**\n * True inside a window Shell: one with no `contained` and no `height`, which lets the page scroll\n * on a narrow touch screen. Each `Shell.Root` sets its own, so a Shell nested in another answers\n * for itself.\n */\nconst ShellWindowContext = React.createContext(false);\n\n/**\n * Gives a Shell pane's children the Shell's index, so Sidebar parts size themselves. In a Rail\n * the rows are `thin`: icon tiles with a small label, sub-menus as dropdowns.\n */\nfunction PaneChromeScope({ children, presentation }: { children: React.ReactNode; presentation?: 'thin' }) {\n const size = React.useContext(ShellSizeContext);\n const value = React.useMemo<SidebarVisualContextValue>(() => ({ size, menuVariant: 'soft', presentation }), [size, presentation]);\n return <SidebarVisualContext.Provider value={value}>{children}</SidebarVisualContext.Provider>;\n}\n\nfunction useChromeClasses() {\n const visual = useSidebarVisual();\n // A pane with no scope (Inspector, Bottom) still takes the Shell's index.\n const shellSize = React.useContext(ShellSizeContext);\n const size = visual?.size ?? shellSize;\n const menuVariant = visual?.menuVariant ?? 'soft';\n return ['kui-ShellPaneChrome', `kui-r-size-${size}`, `kui-menu-variant-${menuVariant}`];\n}\n\n/**\n * The index a Toolbar in a pane's header or footer rests at when it states none: one step above\n * the Shell's, so the band reads as chrome over the rows (v2 BAND_STEP). 4 has no step above.\n */\nconst BAND_STEP = { '1': '2', '2': '3', '3': '4', '4': '4' } as const satisfies Record<BandSize, BandSize>;\n\nfunction useBandSize(): BandSize {\n const visual = useSidebarVisual();\n const shellSize = React.useContext(ShellSizeContext);\n return BAND_STEP[visual?.size ?? shellSize];\n}\n\n/**\n * The size a Toolbar with no `size` of its own rests at, or null for none.\n *\n * In a pane's header or footer it is that band's size. Anywhere else inside a Shell, such as\n * `Shell.Content` or a pane's body, it is the same step: one above the Shell's index, so a\n * toolbar in the content area matches the ones in the pane headers beside it (v2 sizes every\n * toolbar this way). A pane's scrolling list, and anything outside a Shell, has none.\n */\nfunction usePaneBandSize(): BandSize | null {\n const band = React.useContext(PaneBandSizeContext);\n const inShell = React.useContext(ShellStoreContext) !== null;\n const step = useBandSize();\n if (band !== undefined) return band;\n return inShell ? step : null;\n}\n\ninterface PaneHeaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Floats the row over the top of `Shell.Scroll`, so the list scrolls behind it. The list\n * starts below the row, and `Shell.Scroll fade` fades it out under the row. The row paints\n * nothing and lets clicks through between its controls; a `Toolbar backdrop` in it keeps\n * the controls readable.\n */\n float?: boolean;\n}\n\n/** A pane's header row, pinned above its scrolling region. */\nconst PaneHeader = React.forwardRef<HTMLDivElement, PaneHeaderProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneHeader', 'kui-SidebarHeader', 'kui-SidebarHeader--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneHeader.displayName = 'Shell.PaneHeader';\n\ninterface PaneFooterProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Floats the row over the bottom of `Shell.Scroll`, the way `Shell.PaneHeader float` does at the top. */\n float?: boolean;\n}\n\n/** A pane's footer row, pinned below its scrolling region. */\nconst PaneFooter = React.forwardRef<HTMLDivElement, PaneFooterProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneFooter', 'kui-SidebarFooter', 'kui-SidebarFooter--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneFooter.displayName = 'Shell.PaneFooter';\n\ninterface ScrollProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Fades the list out toward an edge with more past it, and under a floating header or footer. */\n fade?: boolean;\n /**\n * Keeps the pane's list (its menu rows) when React puts this under `Shell.Content`, as when an\n * app renders a pane's content in its page and portals it into `Shell.Panel`. In a Rail, Panel\n * or Sidebar it is already the pane's list.\n */\n pane?: boolean;\n}\n\n/**\n * The one region of a pane that scrolls; it takes the room the header and footer leave.\n * In `Shell.Content` it is the page's scroller, and a `Shell.PaneHeader float` beside it pins\n * the page's toolbar over it. The ref, events and ARIA props land on the element that scrolls;\n * `className`, `style` and `dir` apply to the content inside it. In a Rail, Panel or Sidebar the pane is\n * already a navigation landmark, so it needs no role of its own.\n */\nconst Scroll = React.forwardRef<HTMLDivElement, ScrollProps>(({ className, style, dir, children, fade = false, pane = false, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n // A Sidebar.Root inside the content still gets a menu.\n const contentPane = React.useContext(ShellContentContext);\n const visual = useSidebarVisual();\n const inContent = contentPane && visual === null && !pane;\n // While the page scrolls, the content's viewport scrolls nothing: as a tab stop it would take a\n // Tab, ring the whole page and move nothing. Resolved after mount; a `tabIndex` of the caller's wins.\n const windowShell = React.useContext(ShellWindowContext);\n const pageScrolls = usePageScrollMedia();\n if (inContent) {\n const tabIndex = props.tabIndex ?? (windowShell && pageScrolls ? -1 : undefined);\n return (\n <ScrollArea {...props} tabIndex={tabIndex} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-ShellScrollContent', className)}>\n {children}\n </div>\n </ScrollArea>\n );\n }\n return (\n <ScrollArea {...props} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-BaseMenuContent', 'kui-SidebarContent', ...chrome, className)}>\n {/* A header's band does not reach a Toolbar in the scrolling list. */}\n <PaneBandSizeContext.Provider value={null}>\n <div className=\"kui-BaseMenuViewport\">{children}</div>\n </PaneBandSizeContext.Provider>\n </div>\n </ScrollArea>\n );\n});\nScroll.displayName = 'Shell.Scroll';\n\nexport { SidebarVisualContext, useSidebarVisual, ShellSizeContext, ShellContentContext, ShellWindowContext, PaneChromeScope, PaneHeader, PaneFooter, Scroll, BAND_STEP, usePaneBandSize };\nexport type { SidebarVisualContextValue, PaneSize, BandSize, PaneHeaderProps, PaneFooterProps, ScrollProps };\n", "import * as React from 'react';\nimport classNames from 'classnames';\nimport { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { useComposedRefs } from 'radix-ui/internal';\n\nimport { scrollAreaPropDefs } from './scroll-area.props.js';\nimport { scrollableOverflow, useScrollEdges } from '../hooks/use-scroll-edges.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\nimport { getSubtree } from '../helpers/get-subtree.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\n\ntype ScrollAreaElement = React.ElementRef<typeof ScrollAreaPrimitive.Viewport>;\ntype ScrollAreaOwnProps = GetPropDefTypes<typeof scrollAreaPropDefs>;\ninterface ScrollAreaProps\n extends ComponentPropsWithout<typeof ScrollAreaPrimitive.Root, RemovedProps>,\n ComponentPropsWithout<typeof ScrollAreaPrimitive.Viewport, RemovedProps | 'dir'>,\n ScrollAreaOwnProps,\n WidthProps,\n HeightProps {}\n\n/** Menus and listboxes move focus between their items, so a scroller inside one stays out of the tab order. */\nconst OWNS_FOCUS = '[role=\"menu\"], [role=\"listbox\"]';\n\n/**\n * Puts the viewport in the tab order while it has something to scroll, so a keyboard can reach it\n * and scroll it with the arrow keys. A `tabIndex` the caller set wins.\n */\nfunction useFocusableWhileScrollable(element: HTMLDivElement | null, enabled: boolean) {\n React.useEffect(() => {\n if (!enabled || !element || element.closest(OWNS_FOCUS)) return;\n let frame = 0;\n const update = () => {\n frame = 0;\n const overflow = scrollableOverflow(element);\n const scrollable = overflow.x > 0 || overflow.y > 0;\n if (scrollable) element.setAttribute('tabindex', '0');\n else element.removeAttribute('tabindex');\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n update();\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);\n observer?.observe(element);\n for (const child of Array.from(element.children)) observer?.observe(child);\n return () => {\n if (frame) cancelAnimationFrame(frame);\n // The attribute stays: a caller who now sets `tabIndex` has already written it.\n observer?.disconnect();\n };\n }, [element, enabled]);\n}\n\nconst ScrollArea = React.forwardRef<ScrollAreaElement, ScrollAreaProps>((props, forwardedRef) => {\n const {\n asChild,\n children,\n className,\n style,\n type,\n scrollHideDelay = type !== 'scroll' ? 0 : undefined,\n dir,\n radius = scrollAreaPropDefs.radius.default,\n scrollbars = scrollAreaPropDefs.scrollbars.default,\n fade = scrollAreaPropDefs.fade.default,\n ...viewportProps\n } = extractProps(props, widthPropDefs, heightPropDefs);\n const [viewport, setViewport] = React.useState<HTMLDivElement | null>(null);\n const setEdgesElement = useScrollEdges<HTMLDivElement>(fade);\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n const viewportRef = useComposedRefs(forwardedRef, setEdgesElement, setThumbViewport, setViewport);\n useFocusableWhileScrollable(viewport, viewportProps.tabIndex === undefined);\n // A named scroller is a region, so a screen reader can find it and say what it holds.\n const named = viewportProps['aria-label'] !== undefined || viewportProps['aria-labelledby'] !== undefined;\n\n return (\n <ScrollAreaPrimitive.Root\n type={type}\n scrollHideDelay={scrollHideDelay}\n dir={dir}\n className={classNames('kui-ScrollAreaRoot', className)}\n data-fade={fade ? '' : undefined}\n style={style}\n asChild={asChild}\n >\n {getSubtree({ asChild, children }, (children) => (\n <>\n <ScrollAreaPrimitive.Viewport\n role={named ? 'region' : undefined}\n {...viewportProps}\n ref={viewportRef}\n className=\"kui-ScrollAreaViewport\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n\n <div className=\"kui-ScrollAreaViewportFocusRing\" />\n\n {scrollbars !== 'vertical' ? (\n <ScrollAreaPrimitive.Scrollbar\n data-radius={radius}\n orientation=\"horizontal\"\n className=\"kui-ScrollAreaScrollbar\"\n >\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n ) : null}\n\n {scrollbars !== 'horizontal' ? (\n <ScrollAreaPrimitive.Scrollbar\n data-radius={radius}\n orientation=\"vertical\"\n className=\"kui-ScrollAreaScrollbar\"\n >\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n ) : null}\n\n {scrollbars === 'both' ? (\n <ScrollAreaPrimitive.Corner className=\"kui-ScrollAreaCorner\" />\n ) : null}\n </>\n ))}\n </ScrollAreaPrimitive.Root>\n );\n});\nScrollArea.displayName = 'ScrollArea';\n\nexport { ScrollArea };\nexport type { ScrollAreaProps };\n", "import type { PropDef } from './prop-def.js';\n\nconst asChildPropDef = {\n /**\n * Composes the component into its immediate child instead of rendering its own HTML element.\n * You\u2019ll have to provide a single React Element child.\n */\n asChild: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport { asChildPropDef };\n", "import type { PropDef } from './prop-def.js';\n\nconst radii = ['none', 'small', 'medium', 'large', 'full'] as const;\n\nconst radiusPropDef = {\n radius: {\n type: 'enum',\n values: radii,\n default: undefined,\n },\n} satisfies {\n radius: PropDef<(typeof radii)[number]>;\n};\n\nexport { radiusPropDef, radii };\n", "import { asChildPropDef } from '../props/as-child.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst scrollbarsValues = ['vertical', 'horizontal', 'both'] as const;\n\nconst scrollAreaPropDefs = {\n ...asChildPropDef,\n ...radiusPropDef,\n scrollbars: { type: 'enum', values: scrollbarsValues, default: 'both' },\n /**\n * Fades the content toward the top and bottom edges while there is more content past them.\n * An edge with nothing hidden past it does not fade. A floating band over an edge can set\n * `--scroll-fade-start` or `--scroll-fade-end` to its height, so content fades as it passes\n * under the band.\n */\n fade: { type: 'boolean', default: false },\n} satisfies {\n scrollbars: PropDef<(typeof scrollbarsValues)[number]>;\n fade: PropDef<boolean>;\n};\n\nexport { scrollAreaPropDefs };\n", "import * as React from 'react';\n\n/**\n * How far content runs past the element on each axis, in px. An axis whose overflow is hidden\n * cannot be scrolled (a ScrollArea with `scrollbars=\"vertical\"` hides the inline axis), so it\n * counts as 0, however wide the content.\n */\nexport function scrollableOverflow(element: HTMLElement) {\n const style = getComputedStyle(element);\n return {\n x: style.overflowX === 'hidden' ? 0 : Math.max(0, element.scrollWidth - element.clientWidth),\n y: style.overflowY === 'hidden' ? 0 : Math.max(0, element.scrollHeight - element.clientHeight),\n };\n}\n\n/**\n * Publishes how much content is hidden past each edge of a scroller, as\n * `--scroll-overflow-start` and `--scroll-overflow-end` (block axis) and\n * `--scroll-overflow-x-start` and `--scroll-overflow-x-end` (inline axis, from\n * the inline start, so right-to-left reads the same) in px on the element.\n * The scroll fade reads them, so an edge fades only while content is hidden\n * there, and the fade ramps in over the first pixels of scrolling.\n *\n * Writes happen at most once per frame, on scroll and when the element or its\n * content resizes. Nothing re-renders.\n */\nexport function useScrollEdges<T extends HTMLElement>(enabled: boolean) {\n const [element, setElement] = React.useState<T | null>(null);\n\n React.useEffect(() => {\n if (!enabled || !element) return;\n let frame = 0;\n const write = () => {\n frame = 0;\n const overflow = scrollableOverflow(element);\n const start = Math.max(0, element.scrollTop);\n const end = Math.max(0, overflow.y - element.scrollTop);\n element.style.setProperty('--scroll-overflow-start', `${start}px`);\n element.style.setProperty('--scroll-overflow-end', `${end}px`);\n // scrollLeft runs negative in right-to-left, so its size is the distance from the inline start.\n const xStart = Math.abs(element.scrollLeft);\n const xEnd = Math.max(0, overflow.x - xStart);\n element.style.setProperty('--scroll-overflow-x-start', `${xStart}px`);\n element.style.setProperty('--scroll-overflow-x-end', `${xEnd}px`);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(write);\n };\n write();\n element.addEventListener('scroll', schedule, { passive: true });\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);\n observer?.observe(element);\n for (const child of Array.from(element.children)) observer?.observe(child);\n const mutations = typeof MutationObserver === 'undefined' ? null : new MutationObserver(schedule);\n mutations?.observe(element, { childList: true });\n return () => {\n if (frame) cancelAnimationFrame(frame);\n element.removeEventListener('scroll', schedule);\n observer?.disconnect();\n mutations?.disconnect();\n element.style.removeProperty('--scroll-overflow-start');\n element.style.removeProperty('--scroll-overflow-end');\n element.style.removeProperty('--scroll-overflow-x-start');\n element.style.removeProperty('--scroll-overflow-x-end');\n };\n }, [enabled, element]);\n\n return setElement;\n}\n", "import * as React from 'react';\n\n/**\n * Keeps a Radix ScrollArea's thumbs on the scroll position on every scroll.\n *\n * Radix moves a thumb from a requestAnimationFrame loop it starts on the first scroll event of a\n * burst. Next's production minifier compiles that self-calling loop away, so in a production\n * build the thumb moves once, sits while the content scrolls, and jumps when the next burst\n * starts. This writes the transform Radix would, at most once per frame. Nothing re-renders.\n *\n * Pass the hook's setter as a ref on `ScrollArea.Viewport`; the scrollbars are its siblings.\n */\nexport function useThumbSync<T extends HTMLElement>() {\n const [viewport, setViewport] = React.useState<T | null>(null);\n\n React.useEffect(() => {\n const root = viewport?.parentElement;\n if (!viewport || !root) return;\n let frame = 0;\n const write = () => {\n frame = 0;\n for (const thumb of root.querySelectorAll<HTMLElement>(':scope > .kui-ScrollAreaScrollbar > .kui-ScrollAreaThumb')) {\n const scrollbar = thumb.parentElement as HTMLElement;\n const style = getComputedStyle(scrollbar);\n if (scrollbar.dataset.orientation === 'horizontal') {\n const track = scrollbar.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);\n const offset = thumbOffset(viewport.scrollLeft, viewport.scrollWidth - viewport.offsetWidth, track - thumb.offsetWidth);\n thumb.style.transform = `translate3d(${offset}px, 0, 0)`;\n } else {\n const track = scrollbar.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n const offset = thumbOffset(viewport.scrollTop, viewport.scrollHeight - viewport.offsetHeight, track - thumb.offsetHeight);\n thumb.style.transform = `translate3d(0, ${offset}px, 0)`;\n }\n }\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(write);\n };\n viewport.addEventListener('scroll', schedule, { passive: true });\n return () => {\n if (frame) cancelAnimationFrame(frame);\n viewport.removeEventListener('scroll', schedule);\n };\n }, [viewport]);\n\n return setViewport;\n}\n\n/** Radix's mapping: scroll position over its range, onto the room the thumb has to travel. */\nfunction thumbOffset(position: number, range: number, travel: number) {\n if (range <= 0 || travel <= 0) return 0;\n // Right-to-left scrolls run from -range to 0; the thumb then travels from -travel to 0.\n const clamped = Math.min(Math.max(position, -range), range);\n return (clamped / range) * travel;\n}\n", "import * as React from 'react';\n\n/**\n * This is a helper function that is used when a component supports `asChild`\n * using the `Slot` component but its implementation contains nested DOM elements.\n *\n * Using it ensures if a consumer uses the `asChild` prop, the elements are in\n * correct order in the DOM, adopting the intended consumer `children`.\n */\nexport function getSubtree(\n options: { asChild: boolean | undefined; children: React.ReactNode },\n content: React.ReactNode | ((children: React.ReactNode) => React.ReactNode)\n) {\n const { asChild, children } = options;\n if (!asChild) return typeof content === 'function' ? content(children) : content;\n\n const firstChild = React.Children.only(children) as React.ReactElement;\n return React.cloneElement(firstChild, {\n // @ts-expect-error\n children: typeof content === 'function' ? content(firstChild.props.children) : content,\n });\n}\n", "import classNames from 'classnames';\n\nimport { getCompiledPropDefs } from './compile-prop-defs.js';\nimport { getResponsiveClassNames, getResponsiveStyles } from './get-responsive-styles.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\nimport { mergeStyles } from './merge-styles.js';\n\nimport type { CompiledPropDef } from './compile-prop-defs.js';\nimport type * as React from 'react';\nimport type { PropDef } from '../props/prop-def.js';\n\ntype PropDefsWithClassName<T> = T extends Record<string, PropDef> ? { [K in keyof T]: T[K] extends { className: string } ? K : never }[keyof T] : never;\n\ntype ResponsiveValue = Record<string, string | undefined>;\n\n/**\n * Fills in the `initial` breakpoint of a responsive value from the prop def's\n * default, and coerces an invalid `initial` enum value back to that default.\n *\n * Returns the value untouched when nothing needs changing, and a copy otherwise\n * \u2014 callers routinely hoist responsive objects to module scope, so mutating the\n * caller's object would corrupt it for every later render.\n */\nfunction normalizeResponsiveValue(value: ResponsiveValue, propDef: CompiledPropDef) {\n let initial = value.initial;\n let changed = false;\n\n if (propDef.hasDefault && initial === undefined) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(initial)) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n return changed ? { ...value, initial } : value;\n}\n\n/**\n * Takes props, checks them against prop defs that have a `className` on them,\n * adds necessary CSS classes and inline styles, and returns the props without\n * the corresponding prop defs that were used to formulate the new `className`\n * and `style` values. Also applies prop def defaults to every prop.\n */\nfunction extractProps<P extends { className?: string; style?: React.CSSProperties; [key: string]: any }, T extends Record<string, PropDef>[]>(\n props: P,\n ...propDefs: T\n): Omit<P & { className?: string; style?: React.CSSProperties }, PropDefsWithClassName<T[number]>> {\n const { styling, passthrough, stylingKeys } = getCompiledPropDefs(propDefs);\n\n // Copy the props that survive to the element rather than spreading and then\n // deleting the styling keys. Deleting off a spread demotes the object to\n // dictionary mode in V8, and this object is on the render path of every\n // component in the library.\n const extractedProps: Record<string, any> = {};\n for (const key in props) {\n if (stylingKeys.has(key)) continue;\n extractedProps[key] = props[key];\n }\n\n for (let i = 0; i < passthrough.length; i++) {\n const propDef = passthrough[i];\n const value = extractedProps[propDef.key];\n\n if (value === undefined) {\n if (propDef.hasDefault) extractedProps[propDef.key] = propDef.default;\n continue;\n }\n\n // Fall back to the default when the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n extractedProps[propDef.key] = propDef.default;\n }\n }\n\n let style: ReturnType<typeof mergeStyles>;\n const classes: string[] = [];\n\n for (let i = 0; i < styling.length; i++) {\n const propDef = styling[i];\n let value = props[propDef.key];\n\n // Apply prop def defaults\n if (value === undefined && propDef.hasDefault) {\n value = propDef.default;\n }\n\n // Apply the default value if the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n value = propDef.default;\n }\n\n if (!value) continue;\n\n if (isResponsiveObject(value)) {\n // Make sure we are not threading through responsive values for non-responsive prop defs\n if (!propDef.responsive) continue;\n value = normalizeResponsiveValue(value, propDef);\n }\n\n if (propDef.type === 'enum') {\n const propClassName = getResponsiveClassNames({\n allowArbitraryValues: false,\n value,\n className: propDef.className!,\n propValues: propDef.values,\n propValueSet: propDef.valueSet,\n parseValue: propDef.parseValue,\n });\n\n if (propClassName) classes.push(propClassName);\n continue;\n }\n\n if (propDef.type === 'string' || propDef.type === 'enum | string') {\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className: propDef.className!,\n customProperties: propDef.customProperties!,\n // `string` prop defs have no enum values, so every value is arbitrary\n propValues: propDef.type === 'string' ? [] : propDef.values,\n propValueSet: propDef.type === 'string' ? undefined : propDef.valueSet,\n parseValue: propDef.parseValue,\n value,\n });\n\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n if (propClassNames) classes.push(propClassNames);\n continue;\n }\n\n if (propDef.type === 'boolean') {\n // TODO handle responsive boolean props\n classes.push(propDef.className!);\n continue;\n }\n }\n\n extractedProps.className = classNames(classes.length > 0 ? classes.join(' ') : undefined, props.className);\n extractedProps.style = mergeStyles(style, props.style);\n return extractedProps as ReturnType<typeof extractProps<P, T>>;\n}\n\nexport { extractProps };\n", "import type { PropDef } from '../props/prop-def.js';\n\n/**\n * A prop def pre-processed into the exact shape `extractProps` needs at render\n * time. Everything that can be derived from the static prop def \u2014 enum\n * membership sets, whether the def is responsive, whether it carries a default\n * \u2014 is computed once here instead of on every render.\n */\ninterface CompiledPropDef {\n key: string;\n type: PropDef['type'];\n default: unknown;\n hasDefault: boolean;\n responsive: boolean;\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n /** The prop def's own enum values, kept for the responsive class name helpers. */\n values: readonly string[];\n /** O(1) membership for `values`. */\n valueSet: ReadonlySet<string>;\n /**\n * `values` plus the default, used to coerce invalid enum values back to the\n * default. Only present for `type: 'enum'` \u2014 `'enum | string'` props accept\n * arbitrary strings and must not be coerced.\n */\n enumValueSet?: ReadonlySet<unknown>;\n}\n\ninterface CompiledPropDefs {\n /** Defs that contribute a class name and/or custom properties. */\n styling: CompiledPropDef[];\n /**\n * Defs that pass through to the element but still need a default applied or\n * an invalid enum value coerced. Defs that can do neither are omitted\n * entirely \u2014 they are already correct as passed.\n */\n passthrough: CompiledPropDef[];\n /** Keys consumed by `styling`, so they can be skipped when copying props. */\n stylingKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_VALUES: readonly string[] = [];\nconst EMPTY_SET: ReadonlySet<string> = new Set();\n\nfunction compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);\n const styling: CompiledPropDef[] = [];\n const passthrough: CompiledPropDef[] = [];\n const stylingKeys = new Set<string>();\n\n for (const key in merged) {\n // The PropDef union is narrowed per-field below; reading the optional\n // members off the union directly is what the runtime actually needs.\n const def = merged[key] as PropDef & {\n default?: unknown;\n values?: readonly string[];\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n responsive?: true;\n };\n\n const values = def.values ?? EMPTY_VALUES;\n const compiled: CompiledPropDef = {\n key,\n type: def.type,\n default: def.default,\n hasDefault: def.default !== undefined,\n responsive: 'responsive' in def,\n className: def.className,\n customProperties: def.customProperties,\n parseValue: def.parseValue,\n values,\n valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,\n enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,\n };\n\n if (def.className) {\n styling.push(compiled);\n stylingKeys.add(key);\n } else if (compiled.hasDefault || def.type === 'enum') {\n // Anything else is copied through untouched, so there is nothing to do.\n passthrough.push(compiled);\n }\n }\n\n return { styling, passthrough, stylingKeys };\n}\n\ninterface CacheNode {\n children: WeakMap<object, CacheNode>;\n compiled?: CompiledPropDefs;\n}\n\nconst cacheRoot: CacheNode = { children: new WeakMap() };\n\n/**\n * Compiles a set of prop defs, memoized on the identity of the prop def objects\n * themselves. Components always pass the same module-level constants, so after\n * the first render of a given component this is a couple of WeakMap lookups\n * instead of merging 50-odd prop defs into a fresh object.\n */\nfunction getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n let node = cacheRoot;\n\n for (let i = 0; i < propDefs.length; i++) {\n const propDef = propDefs[i];\n let child = node.children.get(propDef);\n if (child === undefined) {\n child = { children: new WeakMap() };\n node.children.set(propDef, child);\n }\n node = child;\n }\n\n return (node.compiled ??= compile(propDefs));\n}\n\nexport { getCompiledPropDefs };\nexport type { CompiledPropDef, CompiledPropDefs };\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n", "import type { GetPropDefTypes, PropDef } from './prop-def.js';\n\nconst widthPropDefs = {\n /**\n * Sets the CSS **width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * width=\"100px\"\n * width={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/width\n */\n width: {\n type: 'string',\n className: 'kui-r-w',\n customProperties: ['--width'],\n responsive: true,\n },\n /**\n * Sets the CSS **min-width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * minWidth=\"100px\"\n * minWidth={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/min-width\n */\n minWidth: {\n type: 'string',\n className: 'kui-r-min-w',\n customProperties: ['--min-width'],\n responsive: true,\n },\n /**\n * Sets the CSS **max-width** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * maxWidth=\"100px\"\n * maxWidth={{ md: '100vw', xl: '1400px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/max-width\n */\n maxWidth: {\n type: 'string',\n className: 'kui-r-max-w',\n customProperties: ['--max-width'],\n responsive: true,\n },\n} satisfies {\n width: PropDef<string>;\n minWidth: PropDef<string>;\n maxWidth: PropDef<string>;\n};\n\ntype WidthProps = GetPropDefTypes<typeof widthPropDefs>;\n\nexport { widthPropDefs };\nexport type { WidthProps };\n", "import type { PropDef, GetPropDefTypes } from './prop-def.js';\n\nconst heightPropDefs = {\n /**\n * Sets the CSS **height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * height=\"100px\"\n * height={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/height\n */\n height: {\n type: 'string',\n className: 'kui-r-h',\n customProperties: ['--height'],\n responsive: true,\n },\n /**\n * Sets the CSS **min-height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * minHeight=\"100px\"\n * minHeight={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/min-height\n */\n minHeight: {\n type: 'string',\n className: 'kui-r-min-h',\n customProperties: ['--min-height'],\n responsive: true,\n },\n /**\n * Sets the CSS **max-height** property.\n * Supports CSS strings and responsive objects.\n *\n * @example\n * maxHeight=\"100px\"\n * maxHeight={{ md: '100vh', xl: '600px' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/max-height\n */\n maxHeight: {\n type: 'string',\n className: 'kui-r-max-h',\n customProperties: ['--max-height'],\n responsive: true,\n },\n} satisfies {\n height: PropDef<string>;\n minHeight: PropDef<string>;\n maxHeight: PropDef<string>;\n};\n\ntype HeightProps = GetPropDefTypes<typeof heightPropDefs>;\n\nexport { heightPropDefs };\nexport type { HeightProps };\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Off the frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type FramePaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellFrameContext = React.createContext<{\n registerOffFrame: (id: FramePaneId) => void;\n unregisterOffFrame: (id: FramePaneId) => void;\n} | null>(null);\n\n/** Tells the Root a pane is off the frame (`flush={false}`); the Rail's card moves a floating Panel over. */\nexport function useFrameRegistration(id: FramePaneId, flush: boolean) {\n const ctx = React.useContext(ShellFrameContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerOffFrame, unregisterOffFrame } = ctx;\n useLayoutEffect(() => {\n if (flush) return;\n registerOffFrame(id);\n return () => unregisterOffFrame(id);\n }, [id, flush, registerOffFrame, unregisterOffFrame]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "import * as React from 'react';\n\ntype BandSize = '1' | '2' | '3' | '4';\n\n/**\n * Set by `Shell.PaneHeader` and `Shell.PaneFooter` to their band size, and by `Shell.Scroll` to\n * null (a scrolling list has no band). `PortalTheme`, the root of every portalled surface\n * (Popover, Dialog, Sheet, menus), sets null too, so a Toolbar in one does not take the Shell's\n * step; a `Theme asChild` an app nests in a pane leaves it alone. `Shell.Root` clears it again.\n * Unset (`undefined`) everywhere else.\n *\n * Its own module so PortalTheme can reset it without bringing the Shell.\n */\nconst PaneBandSizeContext = React.createContext<BandSize | null | undefined>(undefined);\n\nexport { PaneBandSizeContext };\nexport type { BandSize };\n", "'use client';\n\nimport * as React from 'react';\n\n/**\n * When a window Shell lets the page scroll: a narrow window (below the `sm` breakpoint) under a\n * coarse pointer. The stylesheet decides it (shell.css, the page-scroll block), so first paint is\n * right with no script. This is the script's copy, for the few things only script can do when the\n * answer changes: carry the reading position between the two scrollers, and take the content's\n * unused viewport out of the tab order. A test holds it equal to the stylesheet's.\n */\nexport const PAGE_SCROLL_QUERY = '(max-width: 767.98px) and (pointer: coarse)';\n\nlet list: MediaQueryList | undefined;\nconst media = () => (list ??= window.matchMedia(PAGE_SCROLL_QUERY));\n\nfunction listen(m: MediaQueryList, handler: () => void): () => void {\n // Safari below 14 has only the deprecated listener API.\n if (typeof m.addEventListener === 'function') {\n m.addEventListener('change', handler);\n return () => m.removeEventListener('change', handler);\n }\n m.addListener?.(handler);\n return () => m.removeListener?.(handler);\n}\n\nfunction subscribe(onChange: () => void): () => void {\n return listen(media(), onChange);\n}\n\n/** True where a window Shell lets the page scroll. False on the server and through hydration. */\nexport function usePageScrollMedia(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => media().matches,\n () => false,\n );\n}\n\n/** Whether the page scrolls right now. */\nexport function pageScrollMatches(): boolean {\n return media().matches;\n}\n\n/** Subscribes to the answer changing, outside React. */\nexport function onPageScrollMediaChange(onChange: (matches: boolean) => void): () => void {\n const m = media();\n return listen(m, () => onChange(m.matches));\n}\n"],
5
5
  "mappings": ";mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,GAAA,oBAAAC,GAAA,eAAAC,GAAA,eAAAC,GAAA,WAAAC,GAAA,wBAAAC,GAAA,qBAAAC,EAAA,uBAAAC,GAAA,yBAAAC,EAAA,oBAAAC,GAAA,qBAAAC,IAAA,eAAAC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,GAAexB,IAAW,MAAQ,CAACuB,EAG/CG,EAAoB,aAAWjC,EAAkB,EACjDkC,EAAcC,GAAmB,EACvC,GAAIH,EAAW,CACb,IAAMI,EAAWf,EAAM,WAAaY,GAAeC,EAAc,GAAK,QACtE,OACE,gBAACG,EAAA,CAAY,GAAGhB,EAAO,SAAUe,EAAU,IAAKd,EAAc,KAAK,QAAQ,KAAMO,EAAM,UAAU,mBAC/F,gBAAC,OAAI,MAAOF,EAAO,IAAKC,EAAK,aAAW,EAAAJ,SAAW,yBAA0BL,CAAS,GACnFjB,CACH,CACF,CAEJ,CACA,OACE,gBAACmC,EAAA,CAAY,GAAGhB,EAAO,IAAKC,EAAc,KAAK,QAAQ,KAAMO,EAAM,UAAU,mBAC3E,gBAAC,OAAI,MAAOF,EAAO,IAAKC,EAAK,aAAW,EAAAJ,SAAW,sBAAuB,qBAAsB,GAAGD,EAAQJ,CAAS,GAElH,gBAACL,EAAoB,SAApB,CAA6B,MAAO,MACnC,gBAAC,OAAI,UAAU,wBAAwBZ,CAAS,CAClD,CACF,CACF,CAEJ,CAAC,EACDwB,GAAO,YAAc",
6
- "names": ["pane_chrome_exports", "__export", "BAND_STEP", "PaneChromeScope", "PaneFooter", "PaneHeader", "Scroll", "ShellContentContext", "ShellSizeContext", "ShellWindowContext", "SidebarVisualContext", "usePaneBandSize", "useSidebarVisual", "__toCommonJS", "React", "import_classnames", "React", "import_classnames", "import_radix_ui", "import_internal", "asChildPropDef", "radii", "radiusPropDef", "scrollbarsValues", "scrollAreaPropDefs", "asChildPropDef", "radiusPropDef", "React", "scrollableOverflow", "element", "style", "useScrollEdges", "enabled", "setElement", "frame", "write", "overflow", "start", "end", "xStart", "xEnd", "schedule", "observer", "child", "mutations", "React", "useThumbSync", "viewport", "setViewport", "root", "frame", "write", "thumb", "scrollbar", "style", "track", "offset", "thumbOffset", "schedule", "position", "range", "travel", "React", "getSubtree", "options", "content", "asChild", "children", "firstChild", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "i", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames", "widthPropDefs", "heightPropDefs", "OWNS_FOCUS", "useFocusableWhileScrollable", "element", "enabled", "frame", "update", "overflow", "scrollableOverflow", "schedule", "observer", "child", "ScrollArea", "props", "forwardedRef", "asChild", "children", "className", "style", "type", "scrollHideDelay", "dir", "radius", "scrollAreaPropDefs", "scrollbars", "fade", "viewportProps", "extractProps", "widthPropDefs", "heightPropDefs", "viewport", "setViewport", "setEdgesElement", "useScrollEdges", "setThumbViewport", "useThumbSync", "viewportRef", "named", "ScrollAreaPrimitive", "classNames", "getSubtree", "React", "import_internal", "SHELL_BREAKPOINTS", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "ShellStoreContext", "ShellInsetContext", "React", "PaneBandSizeContext", "React", "PAGE_SCROLL_QUERY", "list", "media", "listen", "m", "handler", "subscribe", "onChange", "usePageScrollMedia", "SidebarVisualContext", "useSidebarVisual", "ShellSizeContext", "ShellContentContext", "ShellWindowContext", "PaneChromeScope", "children", "presentation", "size", "value", "useChromeClasses", "visual", "shellSize", "menuVariant", "BAND_STEP", "useBandSize", "usePaneBandSize", "band", "PaneBandSizeContext", "inShell", "ShellStoreContext", "step", "PaneHeader", "className", "float", "props", "forwardedRef", "chrome", "classNames", "PaneFooter", "Scroll", "style", "dir", "fade", "pane", "contentPane", "inContent", "windowShell", "pageScrolls", "usePageScrollMedia", "tabIndex", "ScrollArea"]
6
+ "names": ["pane_chrome_exports", "__export", "BAND_STEP", "PaneChromeScope", "PaneFooter", "PaneHeader", "Scroll", "ShellContentContext", "ShellSizeContext", "ShellWindowContext", "SidebarVisualContext", "usePaneBandSize", "useSidebarVisual", "__toCommonJS", "React", "import_classnames", "React", "import_classnames", "import_radix_ui", "import_internal", "asChildPropDef", "radii", "radiusPropDef", "scrollbarsValues", "scrollAreaPropDefs", "asChildPropDef", "radiusPropDef", "React", "scrollableOverflow", "element", "style", "useScrollEdges", "enabled", "setElement", "frame", "write", "overflow", "start", "end", "xStart", "xEnd", "schedule", "observer", "child", "mutations", "React", "useThumbSync", "viewport", "setViewport", "root", "frame", "write", "thumb", "scrollbar", "style", "track", "offset", "thumbOffset", "schedule", "position", "range", "travel", "React", "getSubtree", "options", "content", "asChild", "children", "firstChild", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "i", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames", "widthPropDefs", "heightPropDefs", "OWNS_FOCUS", "useFocusableWhileScrollable", "element", "enabled", "frame", "update", "overflow", "scrollableOverflow", "schedule", "observer", "child", "ScrollArea", "props", "forwardedRef", "asChild", "children", "className", "style", "type", "scrollHideDelay", "dir", "radius", "scrollAreaPropDefs", "scrollbars", "fade", "viewportProps", "extractProps", "widthPropDefs", "heightPropDefs", "viewport", "setViewport", "setEdgesElement", "useScrollEdges", "setThumbViewport", "useThumbSync", "viewportRef", "named", "ScrollAreaPrimitive", "classNames", "getSubtree", "React", "import_internal", "SHELL_BREAKPOINTS", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "ShellStoreContext", "ShellFrameContext", "React", "PaneBandSizeContext", "React", "PAGE_SCROLL_QUERY", "list", "media", "listen", "m", "handler", "subscribe", "onChange", "usePageScrollMedia", "SidebarVisualContext", "useSidebarVisual", "ShellSizeContext", "ShellContentContext", "ShellWindowContext", "PaneChromeScope", "children", "presentation", "size", "value", "useChromeClasses", "visual", "shellSize", "menuVariant", "BAND_STEP", "useBandSize", "usePaneBandSize", "band", "PaneBandSizeContext", "inShell", "ShellStoreContext", "step", "PaneHeader", "className", "float", "props", "forwardedRef", "chrome", "classNames", "PaneFooter", "Scroll", "style", "dir", "fade", "pane", "contentPane", "inContent", "windowShell", "pageScrolls", "usePageScrollMedia", "tabIndex", "ScrollArea"]
7
7
  }
@@ -28,8 +28,13 @@ type BottomPublicProps = PaneBaseProps & (BottomControlledProps | BottomUncontro
28
28
  onSizeChange?: (size: number, meta: SizeChangeMeta) => void;
29
29
  sizeUpdate?: 'throttle' | 'debounce';
30
30
  sizeUpdateMs?: number;
31
- /** When true, adds margin and triggers the gray backdrop on the Shell. */
32
- inset?: boolean;
31
+ /**
32
+ * Sets whether this pane joins the app frame. The default is `true`: the pane sits against its
33
+ * neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a
34
+ * card. It then floats over the content if the content is flush, and otherwise sits on the
35
+ * Shell's background beside a card content.
36
+ */
37
+ flush?: boolean;
33
38
  };
34
39
  type BottomComponent = React.ForwardRefExoticComponent<BottomPublicProps & React.RefAttributes<HTMLDivElement>> & {
35
40
  Handle: typeof BottomHandle;
@@ -1 +1 @@
1
- {"version":3,"file":"shell-bottom.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-bottom.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAsD,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK/G,OAAO,KAAK,EAAE,UAAU,EAAyB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1F,KAAK,oBAAoB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAA;CAAE,CAAC;AACrF,KAAK,qBAAqB,GAAG;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAC/K,qGAAqG;AACrG,KAAK,uBAAuB,GAAG;IAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAA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GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEJ,KAAK,eAAe,GAAG,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAIlJ,eAAO,MAAM,MAAM,EA0Hb,eAAe,CAAC;AAKtB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";"use client";var pt=Object.create;var fe=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var Rt=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Ae=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of mt(t))!gt.call(e,a)&&a!==n&&fe(e,a,{get:()=>t[a],enumerable:!(r=ft(t,a))||r.enumerable});return e};var Y=(e,t,n)=>(n=e!=null?pt(bt(e)):{},Ae(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),vt=e=>Ae(fe({},"__esModule",{value:!0}),e);var It={};Rt(It,{Bottom:()=>Ve});module.exports=vt(It);var F=Y(require("react")),lt=Y(require("classnames")),ut=require("radix-ui/internal");var me=Y(require("react")),xe=me.createContext(null);function De(){let e=me.useContext(xe);if(!e)throw new Error("Shell.Handle must be used within a resizable pane");return e}var y=Y(require("react")),$e=require("radix-ui/internal"),Fe=Y(require("classnames"));var te=y.forwardRef(({className:e,children:t,...n},r)=>{let{containerRef:a,controls:l,cssVarName:m,minSize:N,maxSize:z,defaultSize:E,orientation:x,edge:j,growth:b,onResize:T,onResizeStart:Z,onResizeEnd:I,snapPoints:k,snapTolerance:h,collapseThreshold:O,collapsible:A,target:B,requestCollapse:U,requestToggle:L}=De(),M=y.useRef(null),q=y.useCallback(o=>{M.current=o,typeof r=="function"?r(o):r&&(r.current=o)},[r]),P=y.useRef(null);y.useEffect(()=>()=>{P.current?.(),P.current=null},[]);let i=y.useCallback(()=>{let o=a.current;if(!o)return E;let c=Number.parseFloat(getComputedStyle(o).getPropertyValue(m));return Number.isFinite(c)?c:E},[a,m,E]),u=y.useCallback(()=>{let o=a.current,c=M.current,p=o?.closest(".kui-ShellRoot")?.getBoundingClientRect();if(!o||!p||!c)return z;let R=o.getBoundingClientRect(),V=c.getBoundingClientRect(),C=b(getComputedStyle(o).direction==="rtl"),f;x==="vertical"?f=C>0?p.right-R.left:R.right-p.left:f=C>0?p.bottom-R.top:R.bottom-p.top;let W=x==="vertical"?V.width:V.height;return!(p.width>0&&p.height>0)||!Number.isFinite(f)?z:Math.max(N,Math.min(z,Math.round(f-W)))},[a,b,z,N,x]),S=()=>{M.current?.setAttribute("aria-valuemax",String(u()))};(0,$e.useLayoutEffect)(()=>{M.current?.setAttribute("aria-valuenow",String(Math.round(i())))},[i]);let g=(o,c)=>{o.style.setProperty(m,`${c}px`),M.current?.setAttribute("aria-valuenow",String(Math.round(c)))},D=B.charAt(0).toUpperCase()+B.slice(1);return y.createElement("div",{ref:q,className:(0,Fe.default)("kui-ShellResizer",e),"data-orientation":x,"data-edge":j,role:"separator",tabIndex:0,"aria-label":`Resize ${D} pane`,"aria-controls":l,"aria-orientation":x,"aria-valuemin":N,"aria-valuemax":z,...n,onPointerDown:o=>{n.onPointerDown?.(o);let c=a.current;if(!c||o.defaultPrevented||o.button!==0)return;o.preventDefault();let p=o.currentTarget,R=o.pointerId;P.current?.();try{p.setPointerCapture(R)}catch{}let V=getComputedStyle(c),C=Number.parseFloat(V.getPropertyValue(m)),f=Number.isFinite(C)?C:E,W=x==="vertical"?o.clientX:o.clientY,s=b(V.direction==="rtl"),$=u();p.setAttribute("aria-valuemax",String($));let Q=w=>Math.min(Math.max(w,N),$);c.setAttribute("data-resizing",""),p.setAttribute("data-dragging","");let G=document.body,Pe=G.style.cursor,ct=G.style.userSelect;G.style.cursor=x==="vertical"?"col-resize":"row-resize",G.style.userSelect="none",Z?.(f);let ee=f,Se=f,_=0,ie=null,Ne=()=>{if(_=0,ie===null)return;let w=ie;ie=null,T?.(w)},Be=null,Me=!1,dt=(w,re)=>{if(w.type===re)Me=!0;else if(Me)return!1;return!0},X=w=>{if(!dt(w,"pointermove")||w===Be)return;Be=w;let re=x==="vertical"?w.clientX:w.clientY;Se=f+(re-W)*s,ee=Q(Se),g(c,ee),ie=ee,_||(_=requestAnimationFrame(Ne))},pe=()=>{_&&cancelAnimationFrame(_),_=0;try{p.releasePointerCapture(R)}catch{}window.removeEventListener("pointermove",X),document.removeEventListener("pointermove",X),window.removeEventListener("mousemove",X),document.removeEventListener("mousemove",X),p.removeEventListener("pointermove",X),window.removeEventListener("pointerup",H),document.removeEventListener("pointerup",H),window.removeEventListener("mouseup",H),document.removeEventListener("mouseup",H),window.removeEventListener("pointercancel",H),document.removeEventListener("pointercancel",H),window.removeEventListener("keydown",Ie),p.removeEventListener("lostpointercapture",H),c.removeAttribute("data-resizing"),p.removeAttribute("data-dragging"),G.style.cursor=Pe,G.style.userSelect=ct,P.current=null},ye=!1,H=()=>{if(ye)return;if(ye=!0,_&&cancelAnimationFrame(_),Ne(),A&&typeof O=="number"&&Se<=O){g(c,f),T?.(f),pe(),U?.(),I?.(f);return}let w=ee;if(k&&k.length){let re=k.reduce((Oe,He)=>Math.abs(He-ee)<Math.abs(Oe-ee)?He:Oe,k[0]);Math.abs(re-ee)<=h&&(w=Q(re),g(c,w),T?.(w))}I?.(w),pe()},Ie=w=>{w.key==="Escape"&&(_&&cancelAnimationFrame(_),_=0,ie=null,g(c,f),T?.(f),ye=!0,I?.(f),pe())};window.addEventListener("pointermove",X),document.addEventListener("pointermove",X),window.addEventListener("mousemove",X),document.addEventListener("mousemove",X),p.addEventListener("pointermove",X),window.addEventListener("pointerup",H),document.addEventListener("pointerup",H),window.addEventListener("mouseup",H),document.addEventListener("mouseup",H),window.addEventListener("pointercancel",H),document.addEventListener("pointercancel",H),window.addEventListener("keydown",Ie),p.addEventListener("lostpointercapture",H),P.current=pe},onDoubleClick:o=>{n.onDoubleClick?.(o),!o.defaultPrevented&&A&&L?.()},onFocus:o=>{n.onFocus?.(o),S()},onKeyDown:o=>{n.onKeyDown?.(o);let c=a.current;if(!c||o.defaultPrevented)return;if(o.key==="Enter"){A&&L&&(o.preventDefault(),L());return}let p=i(),R=u(),V=f=>Math.min(Math.max(f,N),R),C;if(o.key==="Home")C=V(N);else if(o.key==="End")C=V(R);else{let f=x==="vertical"?o.key==="ArrowRight"?1:o.key==="ArrowLeft"?-1:0:o.key==="ArrowDown"?1:o.key==="ArrowUp"?-1:0;if(f===0)return;let W=o.shiftKey?32:8;C=V(p+f*W*b(getComputedStyle(c).direction==="rtl"))}o.preventDefault(),Z?.(p),g(c,C),T?.(C),I?.(C)}},t)});te.displayName="Shell.Handle";var ht=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));ht.displayName="Shell.Panel.Handle";var Pt=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));Pt.displayName="Shell.Sidebar.Handle";var St=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));St.displayName="Shell.Inspector.Handle";var be=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));be.displayName="Shell.Bottom.Handle";var v=Y(require("react")),de=require("radix-ui/internal");var le=Y(require("react"));var je={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},ge=["initial","xs","sm","md","lg","xl"];var yt=Object.entries(je),Ee=null,se=new Set,ne=null;function ze(){return Ee??(Ee=yt.map(([e,t])=>[e,window.matchMedia(t)])),Ee}function ve(){let e="initial";for(let[t,n]of ze())n.matches&&(e=t);return e}function Re(){let e=ve();e!==ne&&(ne=e,se.forEach(t=>t()))}function Ue(e){if(typeof window>"u")return()=>{};if(se.size===0){ne=ve();for(let[,t]of ze())typeof t.addEventListener=="function"?t.addEventListener("change",Re):t.addListener?.(Re)}return se.add(e),()=>{if(se.delete(e),!(se.size>0)){for(let[,t]of ze())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",Re):t.removeListener?.(Re)}catch{}ne=null}}}function xt(){return typeof window>"u"?"initial":(ne??(ne=ve()),ne)}function Et(){return"initial"}function ue(){return typeof window>"u"?"initial":ve()}var zt=()=>!0,wt=()=>!1,qe=()=>()=>{},Ct=()=>"initial";function _e(e=!0){let t=le.useSyncExternalStore(e?Ue:qe,e?xt:Ct,Et),n=le.useSyncExternalStore(e?Ue:qe,zt,wt);return le.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var J=Y(require("react")),We=require("radix-ui/internal");function Ke(e){return typeof e=="object"&&e!==null}function ce(e,t){let n={},r=null;for(let a of ge){if(e!==void 0&&!Ke(e)){n[a]=e;continue}let l=Ke(e)?e[a]:void 0;l!==void 0&&(r={value:l}),n[a]=r?r.value:t(a)}return n}function oe(e){let t=e.initial;return ge.every(n=>e[n]===t)?t:void 0}function we(e,t){let n=oe(t);if(n!==void 0)return{[`data-${e}`]:n};let r={};for(let a of ge)r[`data-${e}-${a}`]=t[a];return r}function Ce(e){return typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}var qt=ce("fixed",()=>"fixed");function Te(e){e.version+=1;for(let t of e.listeners)t()}function Tt(e,t){return e.listeners.add(t),()=>{e.listeners.delete(t)}}var kt=J.createContext(null);function Qe(e){let t=J.useContext(kt);if(!t)throw new Error(`${e} must be used within <Shell.Root>`);return t}function Ge(e,t){let n=J.useCallback(r=>Tt(e,r),[e]);return J.useSyncExternalStore(n,()=>e.peek===t,()=>!1)}var Lt=J.createContext(null);function Xe(e,t){let n=J.useContext(Lt);if(!n)throw new Error("Shell panes must be used within <Shell.Root>");let{registerInset:r,unregisterInset:a}=n;(0,We.useLayoutEffect)(()=>{if(t)return r(e),()=>a(e)},[e,t,r,a])}var ke=e=>typeof e=="object"&&e!==null;function Nt(e){for(let t of["initial","xs","sm","md","lg","xl"]){let n=e[t];if(n!==void 0)return n}return"closed"}function Ye(e){let{name:t,label:n,propNames:r,presentationTable:a,builtIn:l}=e,m=Qe(`Shell.${n}`),N=v.useId(),z=e.id??`shell-${t}${N}`,E=e.controlled!==void 0,x=ke(e.controlled);x&&(`${n}${r.controlled}${r.default}`,void 0);let j=x?e.controlled:void 0,b=j??(ke(e.defaultValue)?e.defaultValue:void 0),T=Ce(b),[Z,I]=v.useState(()=>typeof e.defaultValue=="string"?e.defaultValue:"auto"),k=v.useMemo(()=>j?ce(j,()=>Nt(j)):ce(b,s=>l(a[s])),[T,x,a,l]),h=Z;E&&(h=j?"auto":e.controlled);let O=oe(a)===void 0||h==="auto"&&oe(k)===void 0,{breakpoint:A,ready:B}=_e(O),U=s=>{let $=oe(s);return $!==void 0?$:B?s[A]:void 0},L=h==="auto"?U(k):h,M=U(a),q=M==="overlay",P=L===void 0?void 0:L!=="closed",i=P===!0&&q,u=e.defaultValue,S=v.useRef({state:h,value:L,autoTable:k,defaultValue:u,controlled:E,onChange:e.onChange,toggleNext:e.toggleNext});(0,de.useLayoutEffect)(()=>{S.current={state:h,value:L,autoTable:k,defaultValue:u,controlled:E,onChange:e.onChange,toggleNext:e.toggleNext}});let g=v.useCallback(()=>{let s=S.current;return s.value!==void 0?s.value:s.state==="auto"?s.autoTable[ue()]:void 0},[]),D=v.useCallback(()=>{let s=S.current;return typeof s.defaultValue=="string"?s.defaultValue:ke(s.defaultValue)?s.autoTable[ue()]:void 0},[]),o=v.useCallback((s,$)=>{let Q=S.current;g()!==s&&(Q.onChange?.(s,$),Q.controlled||I(s))},[g]),c=v.useCallback(s=>{let $=S.current,Q=g()??"closed",G=$.toggleNext?$.toggleNext(Q,D()):Q==="closed"?"open":"closed";o(G,s)},[o,g,D]),p=v.useRef(null),R=v.useCallback(s=>{p.current=s},[]);(0,de.useLayoutEffect)(()=>{let s={name:t,id:z,el:p.current,value:L,presentation:M,presentationTable:a,overlayLive:i,size:e.size,setValue:o,toggle:c};return m.entries.set(t,s),Te(m),()=>{m.entries.get(t)===s&&(m.entries.delete(t),Te(m))}},[m,t,z,L,M,a,i,e.size,o,c]);let V=v.useRef({onExpand:e.onExpand,onCollapse:e.onCollapse});(0,de.useLayoutEffect)(()=>{V.current={onExpand:e.onExpand,onCollapse:e.onCollapse}});let C=v.useRef({state:h,shown:P});v.useEffect(()=>{let s=C.current;s.state!==h&&s.shown!==void 0&&P!==void 0&&s.shown!==P&&(P?V.current.onExpand?.():V.current.onCollapse?.()),C.current={state:h,shown:P}},[h,P]),(0,de.useLayoutEffect)(()=>{},[]);let f=v.useRef(E);v.useEffect(()=>{},[E,n,r.controlled]);let W=Ge(m,t)&&P===!1&&!q;return{store:m,id:z,state:h,value:L,shown:P,presentation:M,overlaying:q,overlayLive:i,peeking:W,ready:B,breakpoint:A,autoTable:k,setValue:o,toggle:c,defaultHereNow:D,setElement:R}}function Je(e,t){let{state:n,value:r,presentation:a,shown:l}=e;return{...t,"data-state":n,...n==="auto"?we("auto",e.autoTable):{},"data-presentation":a,"data-mode":r===void 0?void 0:r==="closed"?"collapsed":"expanded","data-open":a==="stacked"&&l?"":void 0,"data-peek":e.peeking?"":void 0}}function Ze(e,t){let n=Ce(e),r=v.useMemo(()=>ce(e,()=>t),[n,t]),a=v.useMemo(()=>oe(r)===void 0?we("presentation",r):{},[r]);return{table:r,attributes:a}}var d=Y(require("react")),ae=require("radix-ui/internal");function et(e,t="horizontal"){if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;let n=String(e).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){let a=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*a}if(n.endsWith("%")){let a=Number.parseFloat(n),l=t==="horizontal"?document.documentElement.clientWidth||window.innerWidth||0:document.documentElement.clientHeight||window.innerHeight||0;return a/100*l}let r=Number.parseFloat(n);return Number.isFinite(r)?r:void 0}var he=(e,t,n)=>Math.max(t??e,Math.min(n??e,e));function tt(e,t,n,r){let[a]=d.useState(()=>{let l=e??t;return typeof l=="number"&&Number.isFinite(l)?`${he(l,n,r)}px`:void 0});return a}function nt(e){let{name:t,elementRef:n,cssVarName:r,orientation:a,minSize:l,maxSize:m,resizable:N,size:z,defaultSize:E,paneId:x,persistence:j}=e,b=d.useRef(e);(0,ae.useLayoutEffect)(()=>{b.current=e});let T=d.useRef(null),Z=d.useRef(0);d.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);let I=d.useCallback((i,u)=>{let{onSizeChange:S,sizeUpdate:g,sizeUpdateMs:D}=b.current;if(S){if(g==="debounce"){T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{T.current=null,b.current.onSizeChange?.(i,u)},D);return}if(g==="throttle"){let o=Date.now();if(o-Z.current<D)return;Z.current=o}S(i,u)}},[]),k=d.useCallback(i=>et(i,a==="vertical"?"horizontal":"vertical"),[a]),h=d.useRef(!1),O=d.useCallback((i,u)=>{let S=n.current;if(S){S.style.setProperty(r,`${i}px`);for(let g of S.querySelectorAll(":scope > .kui-ShellResizer"))g.setAttribute("aria-valuenow",String(Math.round(i)));u&&(h.current=!0)}},[n,r]);(0,ae.useLayoutEffect)(()=>{h.current||O(e.expandedSize,!1)},[e.expandedSize,O]),(0,ae.useLayoutEffect)(()=>{if(z!==void 0||E===void 0)return;let i=k(E);if(typeof i!="number"||!Number.isFinite(i))return;let u=he(i,l,m);O(u,!0),I(u,{reason:"init"})},[]),(0,ae.useLayoutEffect)(()=>{if(z===void 0||b.current.overlayingNow())return;let i=k(z);if(typeof i!="number"||!Number.isFinite(i))return;let u=he(i,l,m);O(u,!0),I(u,{reason:"controlled"})},[z,l,m,e.overlaying,k,O,I]);let A=j!==void 0,B=d.useMemo(()=>{if(A)return{load:()=>b.current.persistence?.load?.(),save:u=>b.current.persistence?.save?.(u)};if(!x)return;let i=`kookie-ui:shell:${t}:${x}`;return{load:()=>{if(!(typeof window>"u"))try{let u=window.localStorage.getItem(i);return u?Number(u):void 0}catch{return}},save:u=>{if(!(typeof window>"u"))try{window.localStorage.setItem(i,String(u))}catch{}}}},[t,x,A]);(0,ae.useLayoutEffect)(()=>{if(!N||!B?.load||b.current.overlayingNow())return;let i=!0,u=g=>{if(!i||typeof g!="number"||!Number.isFinite(g))return;let D=he(g,l,m);O(D,!0),b.current.onResize?.(D)},S=B.load();return S instanceof Promise?S.then(u).catch(g=>{}):u(S),()=>{i=!1}},[N,B,e.overlaying,O,l,m,t]);let U=d.useCallback(i=>b.current.onResize?.(i),[]),L=d.useCallback(i=>{h.current=!0,b.current.onResizeStart?.(i)},[]),M=d.useCallback(i=>{b.current.onResizeEnd?.(i),I(i,{reason:"resize"}),B?.save?.(i)},[I,B]),q=d.useCallback(()=>b.current.requestCollapse(),[]),P=d.useCallback(()=>b.current.requestToggle(),[]);return d.useMemo(()=>({containerRef:n,controls:e.elementId,cssVarName:r,minSize:l,maxSize:m,defaultSize:e.expandedSize,orientation:a,edge:e.edge,growth:e.growth,onResize:U,onResizeStart:L,onResizeEnd:M,target:t,collapsible:e.collapsible,snapPoints:e.snapPoints,snapTolerance:e.snapTolerance??8,collapseThreshold:e.collapseThreshold,requestCollapse:q,requestToggle:P}),[n,e.elementId,r,l,m,e.expandedSize,a,e.edge,e.growth,U,L,M,t,e.collapsible,e.snapPoints,e.snapTolerance,e.collapseThreshold,q,P])}function rt(e,t){let n=d.Children.toArray(e),r=n.filter(l=>d.isValidElement(l)&&l.type===t),a=n.filter(l=>!(d.isValidElement(l)&&l.type===t));return{handles:r,content:a}}function Le(e){if(e===void 0)return;if(typeof e=="boolean")return e?"open":"closed";let t={};for(let[n,r]of Object.entries(e))typeof r=="boolean"&&(t[n]=r?"open":"closed");return t}var ot=()=>"closed";var at=()=>-1;function it(e){if(!("height"in e)&&!("resizer"in e))return e;let{height:t,resizer:n,...r}=e;return r}var K=Y(require("react")),Bt=K.createContext(null);function st({children:e}){let t=K.useMemo(()=>({title:null,mirrors:new Set,collapsed:!1,listeners:new Set,version:0}),[]);return K.createElement(Bt.Provider,{value:t},e)}var Mt={controlled:"open",default:"defaultOpen"},Ve=F.forwardRef((e,t)=>{let{className:n,presentation:r="fixed",defaultOpen:a,open:l,onOpenChange:m,expandedSize:N=200,minSize:z=100,maxSize:E=400,resizable:x=!1,collapsible:j=!0,onExpand:b,onCollapse:T,onResize:Z,onResizeStart:I,onResizeEnd:k,snapPoints:h,snapTolerance:O,collapseThreshold:A,paneId:B,persistence:U,children:L,style:M,size:q,defaultSize:P,onSizeChange:i,sizeUpdate:u,sizeUpdateMs:S=50,inset:g,id:D,...o}=e,{table:c,attributes:p}=Ze(r,"fixed"),R=Ye({name:"bottom",label:"Bottom",propNames:Mt,id:D,controlled:Le(l),defaultValue:Le(a),presentationTable:c,builtIn:ot,onChange:(G,Pe)=>m?.(G!=="closed",{reason:Pe}),onExpand:b,onCollapse:T,size:N});Xe("bottom",g),F.useEffect(()=>{(h!==void 0||A!==void 0||B!==void 0||U!==void 0)&&void 0},[h,A,B,U]);let V=F.useRef(null),C=(0,ut.useComposedRefs)(t,R.setElement,V),f=nt({name:"bottom",elementId:R.id,elementRef:V,cssVarName:"--bottom-size",orientation:"horizontal",edge:"start",growth:at,expandedSize:N,minSize:z,maxSize:E,resizable:x,collapsible:j,size:q,defaultSize:P,onSizeChange:i,sizeUpdate:u,sizeUpdateMs:S,onResize:Z,onResizeStart:I,onResizeEnd:k,snapPoints:h,snapTolerance:O,collapseThreshold:A,paneId:B,persistence:U,overlaying:R.overlaying,overlayingNow:()=>c[ue()]==="overlay",requestCollapse:()=>R.setValue("closed","toggle"),requestToggle:()=>R.toggle("toggle")}),W=tt(q,P,z,E),{handles:s,content:$}=rt(L,be),Q=x&&R.shown!==!1&&!R.overlaying?F.createElement(xe.Provider,{value:f},s.length>0?s:F.createElement(te,null)):null;return F.createElement("div",{...it(o),id:R.id,ref:C,className:(0,lt.default)("kui-ShellPane","kui-ShellBottom",n),...Je(R,p),"data-inset":g||void 0,tabIndex:R.overlaying?-1:o.tabIndex,style:{...M,"--bottom-expanded-size":`${N}px`,...W?{"--bottom-size":W}:{},"--bottom-min-size":`${z}px`,"--bottom-max-size":`${E}px`}},F.createElement("div",{className:"kui-ShellBottomContent"},F.createElement(st,null,$)),Q)});Ve.displayName="Shell.Bottom";Ve.Handle=be;
2
+ "use strict";"use client";var pt=Object.create;var fe=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var Rt=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Ie=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of mt(t))!gt.call(e,a)&&a!==n&&fe(e,a,{get:()=>t[a],enumerable:!(r=ft(t,a))||r.enumerable});return e};var Y=(e,t,n)=>(n=e!=null?pt(bt(e)):{},Ie(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),vt=e=>Ie(fe({},"__esModule",{value:!0}),e);var Ot={};Rt(Ot,{Bottom:()=>Ve});module.exports=vt(Ot);var $=Y(require("react")),lt=Y(require("classnames")),ut=require("radix-ui/internal");var me=Y(require("react")),xe=me.createContext(null);function Fe(){let e=me.useContext(xe);if(!e)throw new Error("Shell.Handle must be used within a resizable pane");return e}var y=Y(require("react")),De=require("radix-ui/internal"),$e=Y(require("classnames"));var te=y.forwardRef(({className:e,children:t,...n},r)=>{let{containerRef:a,controls:l,cssVarName:m,minSize:N,maxSize:z,defaultSize:E,orientation:x,edge:j,growth:b,onResize:T,onResizeStart:Z,onResizeEnd:O,snapPoints:k,snapTolerance:h,collapseThreshold:H,collapsible:I,target:B,requestCollapse:U,requestToggle:L}=Fe(),M=y.useRef(null),q=y.useCallback(o=>{M.current=o,typeof r=="function"?r(o):r&&(r.current=o)},[r]),P=y.useRef(null);y.useEffect(()=>()=>{P.current?.(),P.current=null},[]);let i=y.useCallback(()=>{let o=a.current;if(!o)return E;let c=Number.parseFloat(getComputedStyle(o).getPropertyValue(m));return Number.isFinite(c)?c:E},[a,m,E]),u=y.useCallback(()=>{let o=a.current,c=M.current,p=o?.closest(".kui-ShellRoot")?.getBoundingClientRect();if(!o||!p||!c)return z;let R=o.getBoundingClientRect(),V=c.getBoundingClientRect(),C=b(getComputedStyle(o).direction==="rtl"),f;x==="vertical"?f=C>0?p.right-R.left:R.right-p.left:f=C>0?p.bottom-R.top:R.bottom-p.top;let W=x==="vertical"?V.width:V.height;return!(p.width>0&&p.height>0)||!Number.isFinite(f)?z:Math.max(N,Math.min(z,Math.round(f-W)))},[a,b,z,N,x]),S=()=>{M.current?.setAttribute("aria-valuemax",String(u()))};(0,De.useLayoutEffect)(()=>{M.current?.setAttribute("aria-valuenow",String(Math.round(i())))},[i]);let g=(o,c)=>{o.style.setProperty(m,`${c}px`),M.current?.setAttribute("aria-valuenow",String(Math.round(c)))},F=B.charAt(0).toUpperCase()+B.slice(1);return y.createElement("div",{ref:q,className:(0,$e.default)("kui-ShellResizer",e),"data-orientation":x,"data-edge":j,role:"separator",tabIndex:0,"aria-label":`Resize ${F} pane`,"aria-controls":l,"aria-orientation":x,"aria-valuemin":N,"aria-valuemax":z,...n,onPointerDown:o=>{n.onPointerDown?.(o);let c=a.current;if(!c||o.defaultPrevented||o.button!==0)return;o.preventDefault();let p=o.currentTarget,R=o.pointerId;P.current?.();try{p.setPointerCapture(R)}catch{}let V=getComputedStyle(c),C=Number.parseFloat(V.getPropertyValue(m)),f=Number.isFinite(C)?C:E,W=x==="vertical"?o.clientX:o.clientY,s=b(V.direction==="rtl"),D=u();p.setAttribute("aria-valuemax",String(D));let Q=w=>Math.min(Math.max(w,N),D);c.setAttribute("data-resizing",""),p.setAttribute("data-dragging","");let G=document.body,Pe=G.style.cursor,ct=G.style.userSelect;G.style.cursor=x==="vertical"?"col-resize":"row-resize",G.style.userSelect="none",Z?.(f);let ee=f,Se=f,_=0,ie=null,Ne=()=>{if(_=0,ie===null)return;let w=ie;ie=null,T?.(w)},Be=null,Me=!1,dt=(w,re)=>{if(w.type===re)Me=!0;else if(Me)return!1;return!0},X=w=>{if(!dt(w,"pointermove")||w===Be)return;Be=w;let re=x==="vertical"?w.clientX:w.clientY;Se=f+(re-W)*s,ee=Q(Se),g(c,ee),ie=ee,_||(_=requestAnimationFrame(Ne))},pe=()=>{_&&cancelAnimationFrame(_),_=0;try{p.releasePointerCapture(R)}catch{}window.removeEventListener("pointermove",X),document.removeEventListener("pointermove",X),window.removeEventListener("mousemove",X),document.removeEventListener("mousemove",X),p.removeEventListener("pointermove",X),window.removeEventListener("pointerup",A),document.removeEventListener("pointerup",A),window.removeEventListener("mouseup",A),document.removeEventListener("mouseup",A),window.removeEventListener("pointercancel",A),document.removeEventListener("pointercancel",A),window.removeEventListener("keydown",Oe),p.removeEventListener("lostpointercapture",A),c.removeAttribute("data-resizing"),p.removeAttribute("data-dragging"),G.style.cursor=Pe,G.style.userSelect=ct,P.current=null},ye=!1,A=()=>{if(ye)return;if(ye=!0,_&&cancelAnimationFrame(_),Ne(),I&&typeof H=="number"&&Se<=H){g(c,f),T?.(f),pe(),U?.(),O?.(f);return}let w=ee;if(k&&k.length){let re=k.reduce((He,Ae)=>Math.abs(Ae-ee)<Math.abs(He-ee)?Ae:He,k[0]);Math.abs(re-ee)<=h&&(w=Q(re),g(c,w),T?.(w))}O?.(w),pe()},Oe=w=>{w.key==="Escape"&&(_&&cancelAnimationFrame(_),_=0,ie=null,g(c,f),T?.(f),ye=!0,O?.(f),pe())};window.addEventListener("pointermove",X),document.addEventListener("pointermove",X),window.addEventListener("mousemove",X),document.addEventListener("mousemove",X),p.addEventListener("pointermove",X),window.addEventListener("pointerup",A),document.addEventListener("pointerup",A),window.addEventListener("mouseup",A),document.addEventListener("mouseup",A),window.addEventListener("pointercancel",A),document.addEventListener("pointercancel",A),window.addEventListener("keydown",Oe),p.addEventListener("lostpointercapture",A),P.current=pe},onDoubleClick:o=>{n.onDoubleClick?.(o),!o.defaultPrevented&&I&&L?.()},onFocus:o=>{n.onFocus?.(o),S()},onKeyDown:o=>{n.onKeyDown?.(o);let c=a.current;if(!c||o.defaultPrevented)return;if(o.key==="Enter"){I&&L&&(o.preventDefault(),L());return}let p=i(),R=u(),V=f=>Math.min(Math.max(f,N),R),C;if(o.key==="Home")C=V(N);else if(o.key==="End")C=V(R);else{let f=x==="vertical"?o.key==="ArrowRight"?1:o.key==="ArrowLeft"?-1:0:o.key==="ArrowDown"?1:o.key==="ArrowUp"?-1:0;if(f===0)return;let W=o.shiftKey?32:8;C=V(p+f*W*b(getComputedStyle(c).direction==="rtl"))}o.preventDefault(),Z?.(p),g(c,C),T?.(C),O?.(C)}},t)});te.displayName="Shell.Handle";var ht=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));ht.displayName="Shell.Panel.Handle";var Pt=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));Pt.displayName="Shell.Sidebar.Handle";var St=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));St.displayName="Shell.Inspector.Handle";var be=y.forwardRef((e,t)=>y.createElement(te,{...e,ref:t}));be.displayName="Shell.Bottom.Handle";var v=Y(require("react")),de=require("radix-ui/internal");var le=Y(require("react"));var je={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},ge=["initial","xs","sm","md","lg","xl"];var yt=Object.entries(je),Ee=null,se=new Set,ne=null;function ze(){return Ee??(Ee=yt.map(([e,t])=>[e,window.matchMedia(t)])),Ee}function ve(){let e="initial";for(let[t,n]of ze())n.matches&&(e=t);return e}function Re(){let e=ve();e!==ne&&(ne=e,se.forEach(t=>t()))}function Ue(e){if(typeof window>"u")return()=>{};if(se.size===0){ne=ve();for(let[,t]of ze())typeof t.addEventListener=="function"?t.addEventListener("change",Re):t.addListener?.(Re)}return se.add(e),()=>{if(se.delete(e),!(se.size>0)){for(let[,t]of ze())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",Re):t.removeListener?.(Re)}catch{}ne=null}}}function xt(){return typeof window>"u"?"initial":(ne??(ne=ve()),ne)}function Et(){return"initial"}function ue(){return typeof window>"u"?"initial":ve()}var zt=()=>!0,wt=()=>!1,qe=()=>()=>{},Ct=()=>"initial";function _e(e=!0){let t=le.useSyncExternalStore(e?Ue:qe,e?xt:Ct,Et),n=le.useSyncExternalStore(e?Ue:qe,zt,wt);return le.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var J=Y(require("react")),We=require("radix-ui/internal");function Ke(e){return typeof e=="object"&&e!==null}function ce(e,t){let n={},r=null;for(let a of ge){if(e!==void 0&&!Ke(e)){n[a]=e;continue}let l=Ke(e)?e[a]:void 0;l!==void 0&&(r={value:l}),n[a]=r?r.value:t(a)}return n}function oe(e){let t=e.initial;return ge.every(n=>e[n]===t)?t:void 0}function we(e,t){let n=oe(t);if(n!==void 0)return{[`data-${e}`]:n};let r={};for(let a of ge)r[`data-${e}-${a}`]=t[a];return r}function Ce(e){return typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}var qt=ce("fixed",()=>"fixed");function Te(e){e.version+=1;for(let t of e.listeners)t()}function Tt(e,t){return e.listeners.add(t),()=>{e.listeners.delete(t)}}var kt=J.createContext(null);function Qe(e){let t=J.useContext(kt);if(!t)throw new Error(`${e} must be used within <Shell.Root>`);return t}function Ge(e,t){let n=J.useCallback(r=>Tt(e,r),[e]);return J.useSyncExternalStore(n,()=>e.peek===t,()=>!1)}var Lt=J.createContext(null);function Xe(e,t){let n=J.useContext(Lt);if(!n)throw new Error("Shell panes must be used within <Shell.Root>");let{registerOffFrame:r,unregisterOffFrame:a}=n;(0,We.useLayoutEffect)(()=>{if(!t)return r(e),()=>a(e)},[e,t,r,a])}var ke=e=>typeof e=="object"&&e!==null;function Nt(e){for(let t of["initial","xs","sm","md","lg","xl"]){let n=e[t];if(n!==void 0)return n}return"closed"}function Ye(e){let{name:t,label:n,propNames:r,presentationTable:a,builtIn:l}=e,m=Qe(`Shell.${n}`),N=v.useId(),z=e.id??`shell-${t}${N}`,E=e.controlled!==void 0,x=ke(e.controlled);x&&(`${n}${r.controlled}${r.default}`,void 0);let j=x?e.controlled:void 0,b=j??(ke(e.defaultValue)?e.defaultValue:void 0),T=Ce(b),[Z,O]=v.useState(()=>typeof e.defaultValue=="string"?e.defaultValue:"auto"),k=v.useMemo(()=>j?ce(j,()=>Nt(j)):ce(b,s=>l(a[s])),[T,x,a,l]),h=Z;E&&(h=j?"auto":e.controlled);let H=oe(a)===void 0||h==="auto"&&oe(k)===void 0,{breakpoint:I,ready:B}=_e(H),U=s=>{let D=oe(s);return D!==void 0?D:B?s[I]:void 0},L=h==="auto"?U(k):h,M=U(a),q=M==="overlay",P=L===void 0?void 0:L!=="closed",i=P===!0&&q,u=e.defaultValue,S=v.useRef({state:h,value:L,autoTable:k,defaultValue:u,controlled:E,onChange:e.onChange,toggleNext:e.toggleNext});(0,de.useLayoutEffect)(()=>{S.current={state:h,value:L,autoTable:k,defaultValue:u,controlled:E,onChange:e.onChange,toggleNext:e.toggleNext}});let g=v.useCallback(()=>{let s=S.current;return s.value!==void 0?s.value:s.state==="auto"?s.autoTable[ue()]:void 0},[]),F=v.useCallback(()=>{let s=S.current;return typeof s.defaultValue=="string"?s.defaultValue:ke(s.defaultValue)?s.autoTable[ue()]:void 0},[]),o=v.useCallback((s,D)=>{let Q=S.current;g()!==s&&(Q.onChange?.(s,D),Q.controlled||O(s))},[g]),c=v.useCallback(s=>{let D=S.current,Q=g()??"closed",G=D.toggleNext?D.toggleNext(Q,F()):Q==="closed"?"open":"closed";o(G,s)},[o,g,F]),p=v.useRef(null),R=v.useCallback(s=>{p.current=s},[]);(0,de.useLayoutEffect)(()=>{let s={name:t,id:z,el:p.current,value:L,presentation:M,presentationTable:a,overlayLive:i,size:e.size,setValue:o,toggle:c};return m.entries.set(t,s),Te(m),()=>{m.entries.get(t)===s&&(m.entries.delete(t),Te(m))}},[m,t,z,L,M,a,i,e.size,o,c]);let V=v.useRef({onExpand:e.onExpand,onCollapse:e.onCollapse});(0,de.useLayoutEffect)(()=>{V.current={onExpand:e.onExpand,onCollapse:e.onCollapse}});let C=v.useRef({state:h,shown:P});v.useEffect(()=>{let s=C.current;s.state!==h&&s.shown!==void 0&&P!==void 0&&s.shown!==P&&(P?V.current.onExpand?.():V.current.onCollapse?.()),C.current={state:h,shown:P}},[h,P]),(0,de.useLayoutEffect)(()=>{},[]);let f=v.useRef(E);v.useEffect(()=>{},[E,n,r.controlled]);let W=Ge(m,t)&&P===!1&&!q;return{store:m,id:z,state:h,value:L,shown:P,presentation:M,overlaying:q,overlayLive:i,peeking:W,ready:B,breakpoint:I,autoTable:k,setValue:o,toggle:c,defaultHereNow:F,setElement:R}}function Je(e,t){let{state:n,value:r,presentation:a,shown:l}=e;return{...t,"data-state":n,...n==="auto"?we("auto",e.autoTable):{},"data-presentation":a,"data-mode":r===void 0?void 0:r==="closed"?"collapsed":"expanded","data-open":a==="stacked"&&l?"":void 0,"data-peek":e.peeking?"":void 0}}function Ze(e,t){let n=Ce(e),r=v.useMemo(()=>ce(e,()=>t),[n,t]),a=v.useMemo(()=>oe(r)===void 0?we("presentation",r):{},[r]);return{table:r,attributes:a}}var d=Y(require("react")),ae=require("radix-ui/internal");function et(e,t="horizontal"){if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;let n=String(e).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){let a=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*a}if(n.endsWith("%")){let a=Number.parseFloat(n),l=t==="horizontal"?document.documentElement.clientWidth||window.innerWidth||0:document.documentElement.clientHeight||window.innerHeight||0;return a/100*l}let r=Number.parseFloat(n);return Number.isFinite(r)?r:void 0}var he=(e,t,n)=>Math.max(t??e,Math.min(n??e,e));function tt(e,t,n,r){let[a]=d.useState(()=>{let l=e??t;return typeof l=="number"&&Number.isFinite(l)?`${he(l,n,r)}px`:void 0});return a}function nt(e){let{name:t,elementRef:n,cssVarName:r,orientation:a,minSize:l,maxSize:m,resizable:N,size:z,defaultSize:E,paneId:x,persistence:j}=e,b=d.useRef(e);(0,ae.useLayoutEffect)(()=>{b.current=e});let T=d.useRef(null),Z=d.useRef(0);d.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);let O=d.useCallback((i,u)=>{let{onSizeChange:S,sizeUpdate:g,sizeUpdateMs:F}=b.current;if(S){if(g==="debounce"){T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{T.current=null,b.current.onSizeChange?.(i,u)},F);return}if(g==="throttle"){let o=Date.now();if(o-Z.current<F)return;Z.current=o}S(i,u)}},[]),k=d.useCallback(i=>et(i,a==="vertical"?"horizontal":"vertical"),[a]),h=d.useRef(!1),H=d.useCallback((i,u)=>{let S=n.current;if(S){S.style.setProperty(r,`${i}px`);for(let g of S.querySelectorAll(":scope > .kui-ShellResizer"))g.setAttribute("aria-valuenow",String(Math.round(i)));u&&(h.current=!0)}},[n,r]);(0,ae.useLayoutEffect)(()=>{h.current||H(e.expandedSize,!1)},[e.expandedSize,H]),(0,ae.useLayoutEffect)(()=>{if(z!==void 0||E===void 0)return;let i=k(E);if(typeof i!="number"||!Number.isFinite(i))return;let u=he(i,l,m);H(u,!0),O(u,{reason:"init"})},[]),(0,ae.useLayoutEffect)(()=>{if(z===void 0||b.current.overlayingNow())return;let i=k(z);if(typeof i!="number"||!Number.isFinite(i))return;let u=he(i,l,m);H(u,!0),O(u,{reason:"controlled"})},[z,l,m,e.overlaying,k,H,O]);let I=j!==void 0,B=d.useMemo(()=>{if(I)return{load:()=>b.current.persistence?.load?.(),save:u=>b.current.persistence?.save?.(u)};if(!x)return;let i=`kookie-ui:shell:${t}:${x}`;return{load:()=>{if(!(typeof window>"u"))try{let u=window.localStorage.getItem(i);return u?Number(u):void 0}catch{return}},save:u=>{if(!(typeof window>"u"))try{window.localStorage.setItem(i,String(u))}catch{}}}},[t,x,I]);(0,ae.useLayoutEffect)(()=>{if(!N||!B?.load||b.current.overlayingNow())return;let i=!0,u=g=>{if(!i||typeof g!="number"||!Number.isFinite(g))return;let F=he(g,l,m);H(F,!0),b.current.onResize?.(F)},S=B.load();return S instanceof Promise?S.then(u).catch(g=>{}):u(S),()=>{i=!1}},[N,B,e.overlaying,H,l,m,t]);let U=d.useCallback(i=>b.current.onResize?.(i),[]),L=d.useCallback(i=>{h.current=!0,b.current.onResizeStart?.(i)},[]),M=d.useCallback(i=>{b.current.onResizeEnd?.(i),O(i,{reason:"resize"}),B?.save?.(i)},[O,B]),q=d.useCallback(()=>b.current.requestCollapse(),[]),P=d.useCallback(()=>b.current.requestToggle(),[]);return d.useMemo(()=>({containerRef:n,controls:e.elementId,cssVarName:r,minSize:l,maxSize:m,defaultSize:e.expandedSize,orientation:a,edge:e.edge,growth:e.growth,onResize:U,onResizeStart:L,onResizeEnd:M,target:t,collapsible:e.collapsible,snapPoints:e.snapPoints,snapTolerance:e.snapTolerance??8,collapseThreshold:e.collapseThreshold,requestCollapse:q,requestToggle:P}),[n,e.elementId,r,l,m,e.expandedSize,a,e.edge,e.growth,U,L,M,t,e.collapsible,e.snapPoints,e.snapTolerance,e.collapseThreshold,q,P])}function rt(e,t){let n=d.Children.toArray(e),r=n.filter(l=>d.isValidElement(l)&&l.type===t),a=n.filter(l=>!(d.isValidElement(l)&&l.type===t));return{handles:r,content:a}}function Le(e){if(e===void 0)return;if(typeof e=="boolean")return e?"open":"closed";let t={};for(let[n,r]of Object.entries(e))typeof r=="boolean"&&(t[n]=r?"open":"closed");return t}var ot=()=>"closed";var at=()=>-1;function it(e){if(!("height"in e)&&!("resizer"in e))return e;let{height:t,resizer:n,...r}=e;return r}var K=Y(require("react")),Bt=K.createContext(null);function st({children:e}){let t=K.useMemo(()=>({title:null,mirrors:new Set,collapsed:!1,listeners:new Set,version:0}),[]);return K.createElement(Bt.Provider,{value:t},e)}var Mt={controlled:"open",default:"defaultOpen"},Ve=$.forwardRef((e,t)=>{let{className:n,presentation:r="fixed",defaultOpen:a,open:l,onOpenChange:m,expandedSize:N=200,minSize:z=100,maxSize:E=400,resizable:x=!1,collapsible:j=!0,onExpand:b,onCollapse:T,onResize:Z,onResizeStart:O,onResizeEnd:k,snapPoints:h,snapTolerance:H,collapseThreshold:I,paneId:B,persistence:U,children:L,style:M,size:q,defaultSize:P,onSizeChange:i,sizeUpdate:u,sizeUpdateMs:S=50,flush:g=!0,id:F,...o}=e,{table:c,attributes:p}=Ze(r,"fixed"),R=Ye({name:"bottom",label:"Bottom",propNames:Mt,id:F,controlled:Le(l),defaultValue:Le(a),presentationTable:c,builtIn:ot,onChange:(G,Pe)=>m?.(G!=="closed",{reason:Pe}),onExpand:b,onCollapse:T,size:N});Xe("bottom",g),$.useEffect(()=>{(h!==void 0||I!==void 0||B!==void 0||U!==void 0)&&void 0},[h,I,B,U]);let V=$.useRef(null),C=(0,ut.useComposedRefs)(t,R.setElement,V),f=nt({name:"bottom",elementId:R.id,elementRef:V,cssVarName:"--bottom-size",orientation:"horizontal",edge:"start",growth:at,expandedSize:N,minSize:z,maxSize:E,resizable:x,collapsible:j,size:q,defaultSize:P,onSizeChange:i,sizeUpdate:u,sizeUpdateMs:S,onResize:Z,onResizeStart:O,onResizeEnd:k,snapPoints:h,snapTolerance:H,collapseThreshold:I,paneId:B,persistence:U,overlaying:R.overlaying,overlayingNow:()=>c[ue()]==="overlay",requestCollapse:()=>R.setValue("closed","toggle"),requestToggle:()=>R.toggle("toggle")}),W=tt(q,P,z,E),{handles:s,content:D}=rt(L,be),Q=x&&R.shown!==!1&&!R.overlaying?$.createElement(xe.Provider,{value:f},s.length>0?s:$.createElement(te,null)):null;return $.createElement("div",{...it(o),id:R.id,ref:C,className:(0,lt.default)("kui-ShellPane","kui-ShellBottom",n),...Je(R,p),"data-flush":g||void 0,tabIndex:R.overlaying?-1:o.tabIndex,style:{...M,"--bottom-expanded-size":`${N}px`,...W?{"--bottom-size":W}:{},"--bottom-min-size":`${z}px`,"--bottom-max-size":`${E}px`}},$.createElement("div",{className:"kui-ShellBottomContent"},$.createElement(st,null,D)),Q)});Ve.displayName="Shell.Bottom";Ve.Handle=be;
3
3
  //# sourceMappingURL=shell-bottom.js.map