@principal-ade/panels 1.0.40 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/utils/themeMapping.ts","../src/components/AnimatedResizableLayout.tsx","../src/components/AnimatedVerticalLayout.tsx","../src/components/ThreePanelLayout.tsx","../src/components/TabGroup.tsx","../src/components/ConfigurablePanelLayout.tsx","../src/components/SnapCarousel.tsx","../src/hooks/useMediaQuery.ts","../src/components/ResponsiveConfigurablePanelLayout.tsx","../node_modules/@dnd-kit/utilities/dist/utilities.esm.js","../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js","../node_modules/@dnd-kit/core/dist/core.esm.js","../src/components/EditableConfigurablePanelLayout.tsx","../node_modules/@principal-ade/industry-theme/dist/esm/index.js","../src/components/PanelConfigurator.tsx","../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { Theme } from '@principal-ade/industry-theme';\n\n/**\n * Maps industry-theme Theme object to panel-specific CSS variables\n */\nexport function mapThemeToPanelVars(theme: Theme): Record<string, string> {\n return {\n '--panel-background': theme.colors.background,\n '--panel-border': theme.colors.border,\n '--panel-handle': theme.colors.backgroundSecondary,\n '--panel-handle-hover': theme.colors.backgroundHover,\n '--panel-handle-active': theme.colors.primary,\n '--panel-button-bg': theme.colors.surface,\n '--panel-button-hover': theme.colors.backgroundHover,\n '--panel-button-border': theme.colors.border,\n '--panel-button-icon': theme.colors.textSecondary,\n '--panel-accent-bg': theme.colors.primary + '15', // primary color with 15% opacity\n };\n}\n\n/**\n * Maps industry-theme Theme object to tab-specific CSS variables\n */\nexport function mapThemeToTabVars(theme: Theme): Record<string, string> {\n return {\n '--tab-list-bg': theme.colors.backgroundSecondary,\n '--tab-border': theme.colors.border,\n '--tab-bg': theme.colors.surface,\n '--tab-bg-hover': theme.colors.backgroundHover,\n '--tab-bg-active': theme.colors.primary,\n '--tab-text': theme.colors.text,\n '--tab-text-active': theme.colors.background,\n '--tab-border-hover': theme.colors.textSecondary,\n '--tab-border-active': theme.colors.primary,\n '--tab-focus': theme.colors.primary,\n '--tab-content-bg': theme.colors.background,\n '--tab-empty-text': theme.colors.textMuted,\n };\n}\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './AnimatedResizableLayout.css';\n\nexport interface AnimatedResizableLayoutProps {\n /** Content for the left panel */\n leftPanel: ReactNode;\n\n /** Content for the right panel */\n rightPanel: ReactNode;\n\n /** Which side is collapsible */\n collapsibleSide?: 'left' | 'right';\n\n /** Default size of the collapsible panel (0-100) */\n defaultSize?: number;\n\n /** Minimum size of the collapsible panel when expanded (0-100) */\n minSize?: number;\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Whether the panel is initially collapsed */\n collapsed?: boolean;\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show the collapse/expand toggle button */\n showCollapseButton?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Callback fired when collapse starts */\n onCollapseStart?: () => void;\n\n /** Callback fired when collapse completes */\n onCollapseComplete?: () => void;\n\n /** Callback fired when expand starts */\n onExpandStart?: () => void;\n\n /** Callback fired when expand completes */\n onExpandComplete?: () => void;\n\n /** Theme object for customizing colors */\n theme: Theme;\n}\n\n/**\n * AnimatedResizableLayout - Combines react-resizable-panels with smooth animations\n * Supports both manual dragging to resize AND smooth animations for collapse/expand\n */\nexport const AnimatedResizableLayout: React.FC<AnimatedResizableLayoutProps> = ({\n leftPanel,\n rightPanel,\n collapsibleSide = 'left',\n defaultSize = 25,\n minSize = 5,\n className = '',\n collapsed = false,\n style,\n showCollapseButton = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n onCollapseStart,\n onCollapseComplete,\n onExpandStart,\n onExpandComplete,\n theme,\n}) => {\n const [isCollapsed, setIsCollapsed] = useState(collapsed);\n const [isAnimating, setIsAnimating] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n const [hideHandle, setHideHandle] = useState(collapsed);\n const [currentSize, setCurrentSize] = useState(collapsed ? 0 : defaultSize);\n const panelRef = useRef<ImperativePanelHandle>(null);\n const animationFrameRef = useRef<number | undefined>(undefined);\n const startTimeRef = useRef<number | undefined>(undefined);\n const animationTimeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Smooth animation using requestAnimationFrame\n const animatePanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!panelRef.current) return;\n\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n\n startTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!startTimeRef.current || !panelRef.current) return;\n\n const elapsed = currentTime - startTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n // Apply easing\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n\n // Always use resize during animation, never collapse\n panelRef.current.resize(newSize);\n\n if (progress < 1) {\n animationFrameRef.current = requestAnimationFrame(animate);\n } else {\n // Ensure final state is set correctly\n if (toSize === 0) {\n panelRef.current.collapse();\n } else {\n panelRef.current.resize(toSize);\n }\n setIsAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n animationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n const handleCollapse = useCallback(() => {\n if (isAnimating || isDragging) return;\n\n setIsAnimating(true);\n setIsCollapsed(true);\n if (onCollapseStart) onCollapseStart();\n\n // Animate from current size to 0\n animatePanel(currentSize, 0, () => {\n setCurrentSize(0);\n setHideHandle(true); // Hide handle AFTER animation completes\n if (onCollapseComplete) onCollapseComplete();\n });\n }, [isAnimating, isDragging, currentSize, animatePanel, onCollapseStart, onCollapseComplete]);\n\n const handleExpand = useCallback(() => {\n if (isAnimating || isDragging) return;\n\n setIsAnimating(true);\n setIsCollapsed(false);\n setHideHandle(false); // Show handle immediately when expanding\n if (onExpandStart) onExpandStart();\n\n // Animate from 0 to the default size\n animatePanel(0, defaultSize, () => {\n setCurrentSize(defaultSize);\n if (onExpandComplete) onExpandComplete();\n });\n }, [isAnimating, isDragging, defaultSize, animatePanel, onExpandStart, onExpandComplete]);\n\n const togglePanel = useCallback(() => {\n if (isCollapsed) {\n handleExpand();\n } else {\n handleCollapse();\n }\n }, [isCollapsed, handleCollapse, handleExpand]);\n\n const handleResize = useCallback(\n (size: number) => {\n if (!isAnimating) {\n setCurrentSize(size);\n // If manually resized to non-zero, ensure we're not in collapsed state\n if (size > 0) {\n setIsCollapsed(false);\n }\n }\n },\n [isAnimating],\n );\n\n const handleDragStart = useCallback(() => {\n setIsDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n if (collapsed !== isCollapsed) {\n if (collapsed) {\n handleCollapse();\n } else {\n handleExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleCollapse/handleExpand would cause infinite loop\n }, [collapsed]);\n\n // Update hideHandle when collapsed prop changes externally\n useEffect(() => {\n if (collapsed && !isAnimating) {\n setHideHandle(true);\n } else if (!collapsed && !isAnimating) {\n setHideHandle(false);\n }\n }, [collapsed, isAnimating]);\n\n useEffect(() => {\n const animationFrame = animationFrameRef.current;\n const animationTimeout = animationTimeoutRef.current;\n return () => {\n if (animationFrame) {\n cancelAnimationFrame(animationFrame);\n }\n if (animationTimeout) {\n clearTimeout(animationTimeout);\n }\n };\n }, []);\n\n const leftIsCollapsible = collapsibleSide === 'left';\n const toggleIcon = isCollapsed ? (leftIsCollapsible ? '▸' : '◂') : leftIsCollapsible ? '◂' : '▸';\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const collapsiblePanelStyle =\n isAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n // Apply animation class when animating, not when dragging\n const getPanelClassName = (isCollapsiblePanel: boolean) => {\n let className = 'hybrid-panel';\n if (isCollapsiblePanel) {\n className += ' collapsible-panel';\n if (isAnimating && !isDragging) {\n className += ' animating';\n }\n if (isCollapsed) {\n className += ' collapsed';\n }\n }\n return className;\n };\n\n return (\n <div className={`animated-resizable-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup direction=\"horizontal\" onLayout={handleDragEnd}>\n <Panel\n ref={leftIsCollapsible ? panelRef : undefined}\n collapsible={leftIsCollapsible}\n defaultSize={leftIsCollapsible ? (collapsed ? 0 : defaultSize) : undefined}\n minSize={leftIsCollapsible ? minSize : 30}\n collapsedSize={0}\n onResize={leftIsCollapsible ? handleResize : undefined}\n onCollapse={leftIsCollapsible ? () => setIsCollapsed(true) : undefined}\n onExpand={leftIsCollapsible ? () => setIsCollapsed(false) : undefined}\n className={getPanelClassName(leftIsCollapsible)}\n style={leftIsCollapsible ? collapsiblePanelStyle : undefined}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: leftIsCollapsible && isCollapsed ? 0 : 1,\n transition: isAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {leftPanel}\n </div>\n </Panel>\n\n <PanelResizeHandle\n className={`resize-handle ${hideHandle ? 'collapsed' : ''}`}\n onDragging={handleDragStart}\n style={hideHandle ? { visibility: 'hidden', width: 0 } : undefined}\n >\n {showCollapseButton && (\n <div className=\"handle-bar\">\n <button\n onClick={togglePanel}\n className=\"collapse-toggle\"\n disabled={isAnimating}\n aria-label={isCollapsed ? 'Expand panel' : 'Collapse panel'}\n >\n {toggleIcon}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n <Panel\n ref={!leftIsCollapsible ? panelRef : undefined}\n collapsible={!leftIsCollapsible}\n defaultSize={!leftIsCollapsible ? (collapsed ? 0 : defaultSize) : undefined}\n minSize={!leftIsCollapsible ? minSize : 30}\n collapsedSize={0}\n onResize={!leftIsCollapsible ? handleResize : undefined}\n onCollapse={!leftIsCollapsible ? () => setIsCollapsed(true) : undefined}\n onExpand={!leftIsCollapsible ? () => setIsCollapsed(false) : undefined}\n className={getPanelClassName(!leftIsCollapsible)}\n style={!leftIsCollapsible ? collapsiblePanelStyle : undefined}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: !leftIsCollapsible && isCollapsed ? 0 : 1,\n transition: isAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {rightPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './AnimatedVerticalLayout.css';\n\nexport interface AnimatedVerticalLayoutProps {\n /** Content for the top panel */\n topPanel: ReactNode;\n\n /** Content for the bottom panel */\n bottomPanel: ReactNode;\n\n /** Which panels are collapsible */\n collapsiblePanels?: {\n top?: boolean;\n bottom?: boolean;\n };\n\n /** Default sizes for each panel (0-100) */\n defaultSizes?: {\n top: number;\n bottom: number;\n };\n\n /** Minimum sizes for each panel when expanded (0-100) */\n minSizes?: {\n top: number;\n bottom: number;\n };\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Initial collapsed state for panels */\n collapsed?: {\n top?: boolean;\n bottom?: boolean;\n };\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show the collapse/expand toggle buttons */\n showCollapseButtons?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Callbacks for panel events */\n onTopCollapseStart?: () => void;\n onTopCollapseComplete?: () => void;\n onTopExpandStart?: () => void;\n onTopExpandComplete?: () => void;\n onBottomCollapseStart?: () => void;\n onBottomCollapseComplete?: () => void;\n onBottomExpandStart?: () => void;\n onBottomExpandComplete?: () => void;\n onPanelResize?: (sizes: { top: number; bottom: number }) => void;\n}\n\n/**\n * AnimatedVerticalLayout - Vertical version with both panels independently collapsible\n * Supports both manual dragging to resize AND smooth animations for collapse/expand\n */\nexport const AnimatedVerticalLayout: React.FC<AnimatedVerticalLayoutProps> = ({\n topPanel,\n bottomPanel,\n collapsiblePanels = { top: true, bottom: true },\n defaultSizes = { top: 30, bottom: 30 },\n minSizes = { top: 5, bottom: 5 },\n className = '',\n collapsed = { top: false, bottom: false },\n style,\n showCollapseButtons = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n theme,\n onTopCollapseStart,\n onTopCollapseComplete,\n onTopExpandStart,\n onTopExpandComplete,\n onBottomCollapseStart,\n onBottomCollapseComplete,\n onBottomExpandStart,\n onBottomExpandComplete,\n onPanelResize,\n}) => {\n // Top panel state\n const [isTopCollapsed, setIsTopCollapsed] = useState(collapsed.top || false);\n const [isTopAnimating, setIsTopAnimating] = useState(false);\n const [currentTopSize, setCurrentTopSize] = useState(collapsed.top ? 0 : defaultSizes.top);\n const topPanelRef = useRef<ImperativePanelHandle>(null);\n const topAnimationFrameRef = useRef<number | undefined>(undefined);\n const topStartTimeRef = useRef<number | undefined>(undefined);\n\n // Bottom panel state\n const [isBottomCollapsed, setIsBottomCollapsed] = useState(collapsed.bottom || false);\n const [isBottomAnimating, setIsBottomAnimating] = useState(false);\n const [currentBottomSize, setCurrentBottomSize] = useState(collapsed.bottom ? 0 : defaultSizes.bottom);\n const bottomPanelRef = useRef<ImperativePanelHandle>(null);\n const bottomAnimationFrameRef = useRef<number | undefined>(undefined);\n const bottomStartTimeRef = useRef<number | undefined>(undefined);\n\n const [isDragging, setIsDragging] = useState(false);\n\n // Top panel animation\n const animateTopPanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!topPanelRef.current) return;\n\n if (topAnimationFrameRef.current) {\n cancelAnimationFrame(topAnimationFrameRef.current);\n }\n\n topStartTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!topStartTimeRef.current || !topPanelRef.current) return;\n\n const elapsed = currentTime - topStartTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n topPanelRef.current.resize(newSize);\n\n if (progress < 1) {\n topAnimationFrameRef.current = requestAnimationFrame(animate);\n } else {\n if (toSize === 0) {\n topPanelRef.current.collapse();\n } else {\n topPanelRef.current.resize(toSize);\n }\n setIsTopAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n topAnimationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n // Bottom panel animation\n const animateBottomPanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!bottomPanelRef.current) return;\n\n if (bottomAnimationFrameRef.current) {\n cancelAnimationFrame(bottomAnimationFrameRef.current);\n }\n\n bottomStartTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!bottomStartTimeRef.current || !bottomPanelRef.current) return;\n\n const elapsed = currentTime - bottomStartTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n bottomPanelRef.current.resize(newSize);\n\n if (progress < 1) {\n bottomAnimationFrameRef.current = requestAnimationFrame(animate);\n } else {\n if (toSize === 0) {\n bottomPanelRef.current.collapse();\n } else {\n bottomPanelRef.current.resize(toSize);\n }\n setIsBottomAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n bottomAnimationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n // Top panel handlers\n const handleTopCollapse = useCallback(() => {\n if (isTopAnimating || isDragging || !collapsiblePanels.top) return;\n\n setIsTopAnimating(true);\n setIsTopCollapsed(true);\n if (onTopCollapseStart) onTopCollapseStart();\n\n animateTopPanel(currentTopSize, 0, () => {\n setCurrentTopSize(0);\n if (onTopCollapseComplete) onTopCollapseComplete();\n });\n }, [isTopAnimating, isDragging, currentTopSize, collapsiblePanels.top, animateTopPanel, onTopCollapseStart, onTopCollapseComplete]);\n\n const handleTopExpand = useCallback(() => {\n if (isTopAnimating || isDragging || !collapsiblePanels.top) return;\n\n setIsTopAnimating(true);\n setIsTopCollapsed(false);\n if (onTopExpandStart) onTopExpandStart();\n\n animateTopPanel(0, defaultSizes.top, () => {\n setCurrentTopSize(defaultSizes.top);\n if (onTopExpandComplete) onTopExpandComplete();\n });\n }, [isTopAnimating, isDragging, defaultSizes.top, collapsiblePanels.top, animateTopPanel, onTopExpandStart, onTopExpandComplete]);\n\n const toggleTopPanel = useCallback(() => {\n if (isTopCollapsed) {\n handleTopExpand();\n } else {\n handleTopCollapse();\n }\n }, [isTopCollapsed, handleTopCollapse, handleTopExpand]);\n\n // Bottom panel handlers\n const handleBottomCollapse = useCallback(() => {\n if (isBottomAnimating || isDragging || !collapsiblePanels.bottom) return;\n\n setIsBottomAnimating(true);\n setIsBottomCollapsed(true);\n if (onBottomCollapseStart) onBottomCollapseStart();\n\n animateBottomPanel(currentBottomSize, 0, () => {\n setCurrentBottomSize(0);\n if (onBottomCollapseComplete) onBottomCollapseComplete();\n });\n }, [isBottomAnimating, isDragging, currentBottomSize, collapsiblePanels.bottom, animateBottomPanel, onBottomCollapseStart, onBottomCollapseComplete]);\n\n const handleBottomExpand = useCallback(() => {\n if (isBottomAnimating || isDragging || !collapsiblePanels.bottom) return;\n\n setIsBottomAnimating(true);\n setIsBottomCollapsed(false);\n if (onBottomExpandStart) onBottomExpandStart();\n\n animateBottomPanel(0, defaultSizes.bottom, () => {\n setCurrentBottomSize(defaultSizes.bottom);\n if (onBottomExpandComplete) onBottomExpandComplete();\n });\n }, [isBottomAnimating, isDragging, defaultSizes.bottom, collapsiblePanels.bottom, animateBottomPanel, onBottomExpandStart, onBottomExpandComplete]);\n\n const toggleBottomPanel = useCallback(() => {\n if (isBottomCollapsed) {\n handleBottomExpand();\n } else {\n handleBottomCollapse();\n }\n }, [isBottomCollapsed, handleBottomCollapse, handleBottomExpand]);\n\n const handleTopResize = useCallback(\n (size: number) => {\n if (!isTopAnimating) {\n setCurrentTopSize(size);\n if (size > 0) {\n setIsTopCollapsed(false);\n }\n }\n },\n [isTopAnimating],\n );\n\n const handleBottomResize = useCallback(\n (size: number) => {\n if (!isBottomAnimating) {\n setCurrentBottomSize(size);\n if (size > 0) {\n setIsBottomCollapsed(false);\n }\n }\n },\n [isBottomAnimating],\n );\n\n const handleDragStart = useCallback(() => {\n setIsDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false);\n if (onPanelResize) {\n onPanelResize({\n top: currentTopSize,\n bottom: currentBottomSize,\n });\n }\n }, [currentTopSize, currentBottomSize, onPanelResize]);\n\n // Sync top panel with external prop changes\n useEffect(() => {\n if (collapsed.top !== undefined && collapsed.top !== isTopCollapsed) {\n if (collapsed.top) {\n handleTopCollapse();\n } else {\n handleTopExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleTopCollapse/handleTopExpand would cause infinite loop\n }, [collapsed.top]);\n\n // Sync bottom panel with external prop changes\n useEffect(() => {\n if (collapsed.bottom !== undefined && collapsed.bottom !== isBottomCollapsed) {\n if (collapsed.bottom) {\n handleBottomCollapse();\n } else {\n handleBottomExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleBottomCollapse/handleBottomExpand would cause infinite loop\n }, [collapsed.bottom]);\n\n // Cleanup\n useEffect(() => {\n return () => {\n if (topAnimationFrameRef.current) {\n cancelAnimationFrame(topAnimationFrameRef.current);\n }\n if (bottomAnimationFrameRef.current) {\n cancelAnimationFrame(bottomAnimationFrameRef.current);\n }\n };\n }, []);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const topPanelStyle =\n isTopAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n const bottomPanelStyle =\n isBottomAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n const getTopPanelClassName = () => {\n let className = 'vertical-panel collapsible-panel';\n if (isTopAnimating && !isDragging) {\n className += ' animating';\n }\n if (isTopCollapsed) {\n className += ' collapsed';\n }\n return className;\n };\n\n const getBottomPanelClassName = () => {\n let className = 'vertical-panel collapsible-panel';\n if (isBottomAnimating && !isDragging) {\n className += ' animating';\n }\n if (isBottomCollapsed) {\n className += ' collapsed';\n }\n return className;\n };\n\n return (\n <div className={`animated-vertical-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup direction=\"vertical\" onLayout={handleDragEnd}>\n <Panel\n ref={topPanelRef}\n collapsible={collapsiblePanels.top}\n defaultSize={collapsed.top ? 0 : defaultSizes.top}\n minSize={minSizes.top}\n collapsedSize={0}\n onResize={handleTopResize}\n onCollapse={() => setIsTopCollapsed(true)}\n onExpand={() => setIsTopCollapsed(false)}\n className={getTopPanelClassName()}\n style={topPanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: isTopCollapsed ? 0 : 1,\n transition: isTopAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {topPanel}\n </div>\n </Panel>\n\n <PanelResizeHandle\n className=\"vertical-resize-handle\"\n onDragging={handleDragStart}\n >\n {showCollapseButtons && (\n <div className=\"handle-bar\">\n {collapsiblePanels.top && (\n <button\n onClick={toggleTopPanel}\n className=\"collapse-toggle collapse-toggle-top\"\n disabled={isTopAnimating}\n aria-label={isTopCollapsed ? 'Expand top panel' : 'Collapse top panel'}\n >\n {isTopCollapsed ? '▾' : '▴'}\n </button>\n )}\n {collapsiblePanels.bottom && (\n <button\n onClick={toggleBottomPanel}\n className=\"collapse-toggle collapse-toggle-bottom\"\n disabled={isBottomAnimating}\n aria-label={isBottomCollapsed ? 'Expand bottom panel' : 'Collapse bottom panel'}\n >\n {isBottomCollapsed ? '▴' : '▾'}\n </button>\n )}\n </div>\n )}\n </PanelResizeHandle>\n\n <Panel\n ref={bottomPanelRef}\n collapsible={collapsiblePanels.bottom}\n defaultSize={collapsed.bottom ? 0 : defaultSizes.bottom}\n minSize={minSizes.bottom}\n collapsedSize={0}\n onResize={handleBottomResize}\n onCollapse={() => setIsBottomCollapsed(true)}\n onExpand={() => setIsBottomCollapsed(false)}\n className={getBottomPanelClassName()}\n style={bottomPanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: isBottomCollapsed ? 0 : 1,\n transition: isBottomAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {bottomPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n ImperativePanelGroupHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './ThreePanelLayout.css';\n\nexport interface ThreePanelLayoutProps {\n /** Content for the left panel */\n leftPanel: ReactNode;\n\n /** Content for the middle panel */\n middlePanel: ReactNode;\n\n /** Content for the right panel */\n rightPanel: ReactNode;\n\n /** Which panels are collapsible */\n collapsiblePanels?: {\n left?: boolean;\n right?: boolean;\n };\n\n /** Default sizes for each panel (0-100, must sum to 100) */\n defaultSizes?: {\n left: number;\n middle: number;\n right: number;\n };\n\n /** Minimum sizes for each panel when expanded (0-100) */\n minSizes?: {\n left: number;\n middle: number;\n right: number;\n };\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Initial collapsed state for panels */\n collapsed?: {\n left?: boolean;\n right?: boolean;\n };\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show collapse/expand toggle buttons */\n showCollapseButtons?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Callbacks for panel events */\n onLeftCollapseStart?: () => void;\n onLeftCollapseComplete?: () => void;\n onLeftExpandStart?: () => void;\n onLeftExpandComplete?: () => void;\n onRightCollapseStart?: () => void;\n onRightCollapseComplete?: () => void;\n onRightExpandStart?: () => void;\n onRightExpandComplete?: () => void;\n onPanelResize?: (sizes: { left: number; middle: number; right: number }) => void;\n}\n\n/**\n * ThreePanelLayout - A three-panel layout with collapsible left and right panels\n */\nexport const ThreePanelLayout: React.FC<ThreePanelLayoutProps> = ({\n leftPanel,\n middlePanel,\n rightPanel,\n collapsiblePanels = { left: true, right: true },\n defaultSizes = { left: 20, middle: 60, right: 20 },\n minSizes = { left: 5, middle: 10, right: 5 },\n className = '',\n collapsed = { left: false, right: false },\n style,\n showCollapseButtons = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n theme,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n onLeftExpandStart,\n onLeftExpandComplete,\n onRightCollapseStart,\n onRightCollapseComplete,\n onRightExpandStart,\n onRightExpandComplete,\n onPanelResize,\n}) => {\n // State for collapsed status\n const [leftCollapsed, setLeftCollapsed] = useState(collapsed.left || false);\n const [rightCollapsed, setRightCollapsed] = useState(collapsed.right || false);\n\n // State for animation\n const [leftAnimating, setLeftAnimating] = useState(false);\n const [rightAnimating, setRightAnimating] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n\n const leftFullyCollapsed = leftCollapsed && !leftAnimating;\n const rightFullyCollapsed = rightCollapsed && !rightAnimating;\n\n\n // State for current sizes\n const [leftSize, setLeftSize] = useState(collapsed.left ? 0 : defaultSizes.left);\n const [rightSize, setRightSize] = useState(collapsed.right ? 0 : defaultSizes.right);\n\n // Panel refs\n const panelGroupRef = useRef<ImperativePanelGroupHandle>(null);\n const leftPanelRef = useRef<ImperativePanelHandle>(null);\n const rightPanelRef = useRef<ImperativePanelHandle>(null);\n\n // Animation refs\n const leftAnimationFrameRef = useRef<number | undefined>(undefined);\n const rightAnimationFrameRef = useRef<number | undefined>(undefined);\n const leftStartTimeRef = useRef<number | undefined>(undefined);\n const rightStartTimeRef = useRef<number | undefined>(undefined);\n\n // Generic animation function\n const animatePanel = useCallback(\n (\n panelRef: React.RefObject<ImperativePanelHandle | null>,\n fromSize: number,\n toSize: number,\n animationFrameRef: React.MutableRefObject<number | undefined>,\n startTimeRef: React.MutableRefObject<number | undefined>,\n onComplete?: () => void\n ) => {\n if (!panelRef.current) return;\n\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n\n startTimeRef.current = performance.now();\n\n // Instead of updating every frame, update only at specific intervals\n // This reduces the number of layout recalculations\n const steps = 10; // Only 10 updates instead of 30-40\n let currentStep = 0;\n\n const animate = () => {\n if (!panelRef.current || !startTimeRef.current) return;\n\n currentStep++;\n const progress = currentStep / steps;\n\n if (progress >= 1) {\n // Final update\n if (toSize === 0) {\n panelRef.current.collapse();\n } else {\n panelRef.current.resize(toSize);\n }\n if (onComplete) onComplete();\n return;\n }\n\n // Apply easing\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n panelRef.current.resize(newSize);\n\n // Schedule next update\n animationFrameRef.current = requestAnimationFrame(() => {\n setTimeout(animate, animationDuration / steps);\n });\n };\n\n animate();\n },\n [animationDuration]\n );\n\n // Left panel collapse/expand handlers\n const handleLeftCollapse = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setLeftCollapsed(true);\n });\n if (onLeftCollapseStart) onLeftCollapseStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n\n\n animatePanel(\n leftPanelRef,\n actualLeftSize,\n 0,\n leftAnimationFrameRef,\n leftStartTimeRef,\n () => {\n setLeftSize(0);\n setLeftAnimating(false);\n if (onLeftCollapseComplete) onLeftCollapseComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n leftSize,\n collapsiblePanels.left,\n animatePanel,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n ]);\n\n const handleLeftExpand = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setLeftCollapsed(false);\n });\n if (onLeftExpandStart) onLeftExpandStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n\n animatePanel(\n leftPanelRef,\n 0,\n defaultSizes.left,\n leftAnimationFrameRef,\n leftStartTimeRef,\n () => {\n setLeftSize(defaultSizes.left);\n setLeftAnimating(false);\n if (onLeftExpandComplete) onLeftExpandComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n defaultSizes.left,\n collapsiblePanels.left,\n animatePanel,\n onLeftExpandStart,\n onLeftExpandComplete,\n ]);\n\n // Right panel collapse/expand handlers\n const handleRightCollapse = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setRightAnimating(true);\n setRightCollapsed(true);\n });\n if (onRightCollapseStart) onRightCollapseStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n animatePanel(\n rightPanelRef,\n actualRightSize,\n 0,\n rightAnimationFrameRef,\n rightStartTimeRef,\n () => {\n setRightSize(0);\n setRightAnimating(false);\n if (onRightCollapseComplete) onRightCollapseComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n rightSize,\n collapsiblePanels.right,\n animatePanel,\n onRightCollapseStart,\n onRightCollapseComplete,\n ]);\n\n const handleRightExpand = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setRightAnimating(true);\n setRightCollapsed(false);\n });\n if (onRightExpandStart) onRightExpandStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n animatePanel(\n rightPanelRef,\n 0,\n defaultSizes.right,\n rightAnimationFrameRef,\n rightStartTimeRef,\n () => {\n setRightSize(defaultSizes.right);\n setRightAnimating(false);\n if (onRightExpandComplete) onRightExpandComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n defaultSizes.right,\n collapsiblePanels.right,\n animatePanel,\n onRightExpandStart,\n onRightExpandComplete,\n ]);\n\n // Toggle handlers\n const toggleLeftPanel = useCallback(() => {\n if (leftCollapsed) {\n handleLeftExpand();\n } else {\n handleLeftCollapse();\n }\n }, [leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n const toggleRightPanel = useCallback(() => {\n if (rightCollapsed) {\n handleRightExpand();\n } else {\n handleRightCollapse();\n }\n }, [rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Resize handlers\n const handleLeftResize = useCallback((size: number) => {\n if (!leftAnimating && !rightAnimating) {\n setLeftSize(size);\n if (size > 0) {\n setLeftCollapsed(false);\n }\n }\n }, [leftAnimating, rightAnimating]);\n\n const handleRightResize = useCallback((size: number) => {\n if (!leftAnimating && !rightAnimating) {\n setRightSize(size);\n if (size > 0) {\n setRightCollapsed(false);\n }\n }\n }, [leftAnimating, rightAnimating]);\n\n // Drag handlers\n const handleDragEnd = useCallback(() => {\n if (onPanelResize) {\n onPanelResize({\n left: leftSize,\n middle: 100 - leftSize - rightSize,\n right: rightSize,\n });\n }\n }, [leftSize, rightSize, onPanelResize]);\n\n const handleDragging = useCallback(\n (dragging: boolean) => {\n setIsDragging(dragging);\n if (!dragging) {\n handleDragEnd();\n }\n },\n [handleDragEnd]\n );\n\n // Effect for external collapsed prop changes\n useEffect(() => {\n if (collapsed.left !== undefined && collapsed.left !== leftCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.left) {\n handleLeftCollapse();\n } else {\n handleLeftExpand();\n }\n });\n }\n }, [collapsed.left, leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n useEffect(() => {\n if (collapsed.right !== undefined && collapsed.right !== rightCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.right) {\n handleRightCollapse();\n } else {\n handleRightExpand();\n }\n });\n }\n }, [collapsed.right, rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Cleanup\n useEffect(() => {\n return () => {\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n };\n }, []);\n\n // Panel class helper\n const getPanelClassName = (panelName: 'left' | 'middle' | 'right') => {\n let className = 'three-panel-item';\n\n if (panelName === 'left' && collapsiblePanels.left) {\n className += ' collapsible-panel';\n if (leftAnimating && !isDragging) className += ' animating';\n if (leftFullyCollapsed) className += ' collapsed';\n } else if (panelName === 'right' && collapsiblePanels.right) {\n className += ' collapsible-panel';\n if (rightAnimating && !isDragging) className += ' animating';\n if (rightFullyCollapsed) className += ' collapsed';\n } else if (panelName === 'middle') {\n className += ' middle-panel';\n }\n\n return className;\n };\n\n const leftCollapsiblePanelStyle =\n leftAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: leftCollapsed ? '0%' : `${defaultSizes.left}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n const rightCollapsiblePanelStyle =\n rightAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: rightCollapsed ? '0%' : `${defaultSizes.right}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const leftPanelMinSize = leftAnimating || rightAnimating ? 0 : minSizes.left;\n const rightPanelMinSize = leftAnimating || rightAnimating ? 0 : minSizes.right;\n\n return (\n <div className={`three-panel-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup ref={panelGroupRef} direction=\"horizontal\" onLayout={handleDragEnd}>\n {/* Left Panel */}\n <Panel\n ref={leftPanelRef}\n collapsible={collapsiblePanels.left}\n defaultSize={collapsed.left ? 0 : defaultSizes.left}\n minSize={leftPanelMinSize}\n collapsedSize={0}\n onResize={handleLeftResize}\n onCollapse={() => setLeftCollapsed(true)}\n onExpand={() => setLeftCollapsed(false)}\n className={getPanelClassName('left')}\n style={leftCollapsiblePanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: leftCollapsed ? 0 : 1,\n transition: leftAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {leftPanel}\n </div>\n </Panel>\n\n {/* Left Resize Handle */}\n <PanelResizeHandle\n className={`resize-handle left-handle ${leftFullyCollapsed ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={leftFullyCollapsed}\n >\n {showCollapseButtons && collapsiblePanels.left && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleLeftPanel}\n className=\"collapse-toggle\"\n disabled={leftAnimating}\n aria-label={leftCollapsed ? 'Expand left panel' : 'Collapse left panel'}\n >\n {leftCollapsed ? '▸' : '◂'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Middle Panel */}\n <Panel\n defaultSize={defaultSizes.middle}\n minSize={minSizes.middle}\n className={getPanelClassName('middle')}\n >\n <div className=\"panel-content-wrapper\">\n {middlePanel}\n </div>\n </Panel>\n\n {/* Right Resize Handle */}\n <PanelResizeHandle\n className={`resize-handle right-handle ${rightFullyCollapsed ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={rightFullyCollapsed}\n >\n {showCollapseButtons && collapsiblePanels.right && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleRightPanel}\n className=\"collapse-toggle\"\n disabled={rightAnimating}\n aria-label={rightCollapsed ? 'Expand right panel' : 'Collapse right panel'}\n >\n {rightCollapsed ? '◂' : '▸'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Right Panel */}\n <Panel\n ref={rightPanelRef}\n collapsible={collapsiblePanels.right}\n defaultSize={collapsed.right ? 0 : defaultSizes.right}\n minSize={rightPanelMinSize}\n collapsedSize={0}\n onResize={handleRightResize}\n onCollapse={() => setRightCollapsed(true)}\n onExpand={() => setRightCollapsed(false)}\n className={getPanelClassName('right')}\n style={rightCollapsiblePanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: rightCollapsed ? 0 : 1,\n transition: rightAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {rightPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};","import React, { useState, useEffect } from 'react';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToTabVars } from '../utils/themeMapping';\nimport { PanelDefinitionWithContent } from './ConfigurablePanelLayout';\nimport { TabsConfig } from './PanelConfigurator';\nimport './TabGroup.css';\n\nexport interface TabGroupProps {\n /** Panel IDs to display as tabs */\n panelIds: string[];\n\n /** All available panels with content */\n panels: PanelDefinitionWithContent[];\n\n /** Tab configuration */\n config?: TabsConfig;\n\n /** Optional class name */\n className?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n}\n\n/**\n * TabGroup - Renders multiple panels in a tabbed interface\n */\nexport const TabGroup: React.FC<TabGroupProps> = ({\n panelIds,\n panels,\n config = {},\n className = '',\n theme,\n}) => {\n const {\n defaultActiveTab = 0,\n tabPosition = 'top',\n centered = true,\n hideTabList = false,\n activeTabIndex: controlledIndex,\n onTabChange,\n } = config;\n\n // Internal state for uncontrolled mode\n const [internalIndex, setInternalIndex] = useState(defaultActiveTab);\n\n // Determine if component is controlled\n const isControlled = controlledIndex !== undefined;\n\n // Use controlled value if provided, otherwise use internal state\n const activeTabIndex = isControlled ? controlledIndex : internalIndex;\n\n // Handle tab changes\n const handleTabClick = (index: number) => {\n if (!isControlled) {\n setInternalIndex(index);\n }\n onTabChange?.(index);\n };\n\n // Sync internal state when defaultActiveTab changes (for uncontrolled mode)\n useEffect(() => {\n if (!isControlled) {\n setInternalIndex(defaultActiveTab);\n }\n }, [defaultActiveTab, isControlled]);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToTabVars(theme) as React.CSSProperties;\n\n // Get panels in order\n const tabPanels = panelIds\n .map(id => panels.find(p => p.id === id))\n .filter((p): p is PanelDefinitionWithContent => p !== undefined);\n\n // Ensure active tab is valid\n const safeActiveIndex = Math.min(activeTabIndex, tabPanels.length - 1);\n\n const activePanel = tabPanels[safeActiveIndex];\n\n if (tabPanels.length === 0) {\n return <div className=\"tab-group-empty\">No panels available</div>;\n }\n\n // For top/bottom positions, always center. For left/right, use the centered config\n const shouldCenter = (tabPosition === 'top' || tabPosition === 'bottom') ? true : centered;\n\n const tabList = (\n <div className={`tab-list ${shouldCenter ? 'centered' : ''}`} role=\"tablist\">\n {tabPanels.map((panel, index) => (\n <button\n key={panel.id}\n role=\"tab\"\n aria-selected={index === safeActiveIndex}\n aria-controls={`tabpanel-${panel.id}`}\n id={`tab-${panel.id}`}\n className={`tab-button ${index === safeActiveIndex ? 'active' : ''}`}\n onClick={() => handleTabClick(index)}\n title={panel.icon ? panel.label : undefined}\n >\n {panel.icon ? (\n <>\n <span className=\"tab-icon\">{panel.icon}</span>\n <span className=\"tab-label\">{panel.label}</span>\n </>\n ) : (\n panel.label\n )}\n </button>\n ))}\n </div>\n );\n\n const tabContent = activePanel ? (\n <div\n className=\"tab-content\"\n role=\"tabpanel\"\n id={`tabpanel-${activePanel.id}`}\n aria-labelledby={`tab-${activePanel.id}`}\n >\n {activePanel.content}\n </div>\n ) : null;\n\n return (\n <div className={`tab-group tab-position-${tabPosition} ${className}`} style={themeStyles}>\n {!hideTabList && (tabPosition === 'top' || tabPosition === 'left') && tabList}\n {tabContent}\n {!hideTabList && (tabPosition === 'bottom' || tabPosition === 'right') && tabList}\n </div>\n );\n};\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n ImperativePanelGroupHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport { PanelLayout, PanelSlot, PanelGroup as PanelGroupType, TabsConfig } from './PanelConfigurator';\nimport { TabGroup } from './TabGroup';\nimport './ConfigurablePanelLayout.css';\n\nexport interface PanelDefinitionWithContent {\n id: string;\n label: string;\n content: ReactNode;\n preview?: ReactNode;\n icon?: ReactNode;\n}\n\nexport interface ConfigurablePanelLayoutProps {\n /** Available panels with their content */\n panels: PanelDefinitionWithContent[];\n\n /** Current layout configuration - omit or set positions to null/undefined for two-panel layouts */\n layout: PanelLayout;\n\n /** Custom data attributes for slot identification (for edit mode) */\n slotDataAttributes?: {\n left?: Record<string, string>;\n middle?: Record<string, string>;\n right?: Record<string, string>;\n };\n\n /** Which panels are collapsible - only specify for active panels */\n collapsiblePanels?: {\n left?: boolean;\n middle?: boolean;\n right?: boolean;\n };\n\n /** Default sizes for each panel (0-100, should sum to 100 for active panels) - only specify for active panels */\n defaultSizes?: {\n left?: number;\n middle?: number;\n right?: number;\n };\n\n /** Minimum sizes for each panel when expanded (0-100) - only specify for active panels */\n minSizes?: {\n left?: number;\n middle?: number;\n right?: number;\n };\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Initial collapsed state for panels */\n collapsed?: {\n left?: boolean;\n middle?: boolean;\n right?: boolean;\n };\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show collapse/expand toggle buttons */\n showCollapseButtons?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Callbacks for panel events */\n onLeftCollapseStart?: () => void;\n onLeftCollapseComplete?: () => void;\n onLeftExpandStart?: () => void;\n onLeftExpandComplete?: () => void;\n onMiddleCollapseStart?: () => void;\n onMiddleCollapseComplete?: () => void;\n onMiddleExpandStart?: () => void;\n onMiddleExpandComplete?: () => void;\n onRightCollapseStart?: () => void;\n onRightCollapseComplete?: () => void;\n onRightExpandStart?: () => void;\n onRightExpandComplete?: () => void;\n onPanelResize?: (sizes: { left: number; middle: number; right: number }) => void;\n}\n\n/**\n * ConfigurablePanelLayout - A flexible panel layout that supports 2 or 3 panels\n *\n * Supports both two-panel and three-panel layouts:\n * - For two panels: omit or set unused positions to null/undefined (e.g., { left: 'panel1', right: 'panel2' })\n * - For three panels: define all positions (e.g., { left: 'panel1', middle: 'panel2', right: 'panel3' })\n *\n * The component automatically adjusts sizing and behavior based on active panels.\n */\nexport const ConfigurablePanelLayout: React.FC<ConfigurablePanelLayoutProps> = ({\n panels,\n layout,\n slotDataAttributes = {},\n collapsiblePanels = { left: true, middle: false, right: true },\n defaultSizes = { left: 20, middle: 60, right: 20 },\n minSizes = { left: 5, middle: 10, right: 5 },\n className = '',\n collapsed = { left: false, middle: false, right: false },\n style,\n showCollapseButtons = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n theme,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n onLeftExpandStart,\n onLeftExpandComplete,\n onMiddleCollapseStart,\n onMiddleCollapseComplete,\n onMiddleExpandStart,\n onMiddleExpandComplete,\n onRightCollapseStart,\n onRightCollapseComplete,\n onRightExpandStart,\n onRightExpandComplete,\n onPanelResize,\n}) => {\n // Auto-detect which panels are active (have content)\n // Support both undefined and null for inactive panels\n const isLeftActive = layout.left !== null && layout.left !== undefined;\n const isMiddleActive = layout.middle !== null && layout.middle !== undefined;\n const isRightActive = layout.right !== null && layout.right !== undefined;\n\n // Compute smart defaults based on active panels\n const activeCount = [isLeftActive, isMiddleActive, isRightActive].filter(Boolean).length;\n\n // Smart defaults:\n // - Two panels: 50/50 split by default\n // - Three panels: 20/60/20 split by default\n // - One panel: 100%\n const computedDefaultSizes = {\n left: isLeftActive ? (defaultSizes?.left ?? (activeCount === 2 ? 50 : activeCount === 3 ? 20 : 100)) : 0,\n middle: isMiddleActive ? (defaultSizes?.middle ?? (activeCount === 2 ? 50 : activeCount === 3 ? 60 : 100)) : 0,\n right: isRightActive ? (defaultSizes?.right ?? (activeCount === 2 ? 50 : activeCount === 3 ? 20 : 100)) : 0,\n };\n\n const computedMinSizes = {\n left: minSizes?.left ?? 5,\n middle: minSizes?.middle ?? 10,\n right: minSizes?.right ?? 5,\n };\n\n // State for collapsed status - auto-collapse inactive panels\n const [leftCollapsed, setLeftCollapsed] = useState(collapsed.left || !isLeftActive);\n const [middleCollapsed, setMiddleCollapsed] = useState(collapsed.middle || !isMiddleActive);\n const [rightCollapsed, setRightCollapsed] = useState(collapsed.right || !isRightActive);\n\n // State for animation\n const [leftAnimating, setLeftAnimating] = useState(false);\n const [middleAnimating, setMiddleAnimating] = useState(false);\n const [rightAnimating, setRightAnimating] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n\n const leftFullyCollapsed = leftCollapsed && !leftAnimating;\n const middleFullyCollapsed = middleCollapsed && !middleAnimating;\n const rightFullyCollapsed = rightCollapsed && !rightAnimating;\n\n // Helper to get panel content by ID\n const getPanelContent = useCallback((panelId: string | null): ReactNode => {\n if (!panelId) return null;\n const panel = panels.find(p => p.id === panelId);\n return panel?.content || null;\n }, [panels]);\n\n // Helper to render a panel slot (handles single panels, groups, or null)\n const renderPanelSlot = useCallback((slot: PanelSlot): ReactNode => {\n if (slot === null) return null;\n\n // Check if it's a group\n if (typeof slot === 'object' && 'type' in slot) {\n const group = slot as PanelGroupType;\n if (group.type === 'tabs') {\n return (\n <TabGroup\n panelIds={group.panels}\n panels={panels}\n config={group.config as TabsConfig}\n theme={theme}\n />\n );\n }\n // TODO: Handle tiles when implemented\n return null;\n }\n\n // It's a single panel ID\n return getPanelContent(slot as string);\n }, [panels, getPanelContent, theme]);\n\n // Get actual panel content from layout\n const leftPanel = renderPanelSlot(layout.left ?? null);\n const middlePanel = renderPanelSlot(layout.middle ?? null);\n const rightPanel = renderPanelSlot(layout.right ?? null);\n\n // State for current sizes - set to 0 for inactive or collapsed panels\n const [leftSize, setLeftSize] = useState((collapsed.left || !isLeftActive) ? 0 : computedDefaultSizes.left);\n const [middleSize, setMiddleSize] = useState((collapsed.middle || !isMiddleActive) ? 0 : computedDefaultSizes.middle);\n const [rightSize, setRightSize] = useState((collapsed.right || !isRightActive) ? 0 : computedDefaultSizes.right);\n\n // State to preserve the last expanded size for collapsed panels\n const [lastExpandedLeftSize, setLastExpandedLeftSize] = useState(computedDefaultSizes.left);\n const [lastExpandedMiddleSize, setLastExpandedMiddleSize] = useState(computedDefaultSizes.middle);\n const [lastExpandedRightSize, setLastExpandedRightSize] = useState(computedDefaultSizes.right);\n\n // Panel refs\n const panelGroupRef = useRef<ImperativePanelGroupHandle>(null);\n const leftPanelRef = useRef<ImperativePanelHandle>(null);\n const middlePanelRef = useRef<ImperativePanelHandle>(null);\n const rightPanelRef = useRef<ImperativePanelHandle>(null);\n\n // Animation refs\n const leftAnimationFrameRef = useRef<number | undefined>(undefined);\n const middleAnimationFrameRef = useRef<number | undefined>(undefined);\n const rightAnimationFrameRef = useRef<number | undefined>(undefined);\n const leftStartTimeRef = useRef<number | undefined>(undefined);\n const middleStartTimeRef = useRef<number | undefined>(undefined);\n const rightStartTimeRef = useRef<number | undefined>(undefined);\n\n // Multi-panel animation function for coordinated resizing\n const animateMultiplePanels = useCallback(\n (\n animations: Array<{\n panelRef: React.RefObject<ImperativePanelHandle | null>;\n fromSize: number;\n toSize: number;\n animationFrameRef: React.MutableRefObject<number | undefined>;\n startTimeRef: React.MutableRefObject<number | undefined>;\n }>,\n onComplete?: () => void\n ) => {\n // Validate all panel refs exist\n const validAnimations = animations.filter(anim => anim.panelRef.current);\n if (validAnimations.length === 0) return;\n\n // Cancel any existing animations\n validAnimations.forEach(anim => {\n if (anim.animationFrameRef.current) {\n cancelAnimationFrame(anim.animationFrameRef.current);\n }\n });\n\n const steps = 10;\n let currentStep = 0;\n\n const animate = () => {\n currentStep++;\n const progress = currentStep / steps;\n\n if (progress >= 1) {\n // Final update - set all panels to their target sizes\n validAnimations.forEach(anim => {\n if (anim.panelRef.current) {\n if (anim.toSize === 0) {\n anim.panelRef.current.collapse();\n } else {\n anim.panelRef.current.resize(anim.toSize);\n }\n }\n });\n if (onComplete) onComplete();\n return;\n }\n\n // Apply easing\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n // Update all panels simultaneously\n validAnimations.forEach(anim => {\n if (anim.panelRef.current) {\n const newSize = anim.fromSize + (anim.toSize - anim.fromSize) * eased;\n anim.panelRef.current.resize(newSize);\n }\n });\n\n // Schedule next update (use the first animation's ref for tracking)\n validAnimations[0].animationFrameRef.current = requestAnimationFrame(() => {\n setTimeout(animate, animationDuration / steps);\n });\n };\n\n animate();\n },\n [animationDuration]\n );\n\n // Left panel collapse/expand handlers\n const handleLeftCollapse = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setLeftCollapsed(true);\n });\n if (onLeftCollapseStart) onLeftCollapseStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n // Remaining panels get space proportionally to their current sizes\n const remainingTotal = actualMiddleSize + actualRightSize;\n const newMiddleSize = remainingTotal > 0 ? (actualMiddleSize / remainingTotal) * 100 : (isMiddleActive ? 50 : 0);\n const newRightSize = remainingTotal > 0 ? (actualRightSize / remainingTotal) * 100 : (isRightActive ? 50 : 0);\n\n // Update last expanded sizes for middle and right panels\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: 0,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(0);\n setMiddleSize(newMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onLeftCollapseComplete) onLeftCollapseComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isMiddleActive,\n isRightActive,\n collapsiblePanels.left,\n animateMultiplePanels,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n ]);\n\n const handleLeftExpand = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setLeftCollapsed(false);\n });\n if (onLeftExpandStart) onLeftExpandStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? 0) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Use the last expanded size to restore the panel to its previous size\n const targetLeftSize = lastExpandedLeftSize || computedDefaultSizes.left;\n\n // Calculate proportional redistribution for other panels\n // They need to shrink proportionally to make room\n const spaceForOthers = 100 - targetLeftSize;\n const currentOthersTotal = actualMiddleSize + actualRightSize;\n const newMiddleSize = currentOthersTotal > 0 ? (actualMiddleSize / currentOthersTotal) * spaceForOthers : (isMiddleActive ? spaceForOthers / 2 : 0);\n const newRightSize = currentOthersTotal > 0 ? (actualRightSize / currentOthersTotal) * spaceForOthers : (isRightActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for middle and right panels\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: targetLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(targetLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onLeftExpandComplete) onLeftExpandComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n middleSize,\n rightSize,\n computedDefaultSizes.left,\n lastExpandedLeftSize,\n isMiddleActive,\n isRightActive,\n collapsiblePanels.left,\n animateMultiplePanels,\n onLeftExpandStart,\n onLeftExpandComplete,\n ]);\n\n // Right panel collapse/expand handlers\n const handleRightCollapse = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setRightCollapsed(true);\n });\n if (onRightCollapseStart) onRightCollapseStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n const remainingTotal = actualLeftSize + actualMiddleSize;\n const newLeftSize = remainingTotal > 0 ? (actualLeftSize / remainingTotal) * 100 : (isLeftActive ? 50 : 0);\n const newMiddleSize = remainingTotal > 0 ? (actualMiddleSize / remainingTotal) * 100 : (isMiddleActive ? 50 : 0);\n\n // Update last expanded sizes for left and middle panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: 0,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(0);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onRightCollapseComplete) onRightCollapseComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isLeftActive,\n isMiddleActive,\n collapsiblePanels.right,\n animateMultiplePanels,\n onRightCollapseStart,\n onRightCollapseComplete,\n ]);\n\n const handleRightExpand = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setRightCollapsed(false);\n });\n if (onRightExpandStart) onRightExpandStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? 0) * 1000) / 1000;\n\n // Use the last expanded size to restore the panel to its previous size\n const targetRightSize = lastExpandedRightSize || computedDefaultSizes.right;\n\n // Calculate proportional redistribution for other panels\n const spaceForOthers = 100 - targetRightSize;\n const currentOthersTotal = actualLeftSize + actualMiddleSize;\n const newLeftSize = currentOthersTotal > 0 ? (actualLeftSize / currentOthersTotal) * spaceForOthers : (isLeftActive ? spaceForOthers / 2 : 0);\n const newMiddleSize = currentOthersTotal > 0 ? (actualMiddleSize / currentOthersTotal) * spaceForOthers : (isMiddleActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for left and middle panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: targetRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(targetRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onRightExpandComplete) onRightExpandComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n leftSize,\n middleSize,\n computedDefaultSizes.right,\n lastExpandedRightSize,\n isLeftActive,\n isMiddleActive,\n collapsiblePanels.right,\n animateMultiplePanels,\n onRightExpandStart,\n onRightExpandComplete,\n ]);\n\n // Toggle handlers\n const toggleLeftPanel = useCallback(() => {\n if (leftCollapsed) {\n handleLeftExpand();\n } else {\n handleLeftCollapse();\n }\n }, [leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n // Middle panel collapse/expand handlers\n const handleMiddleCollapse = useCallback(() => {\n if (middleAnimating || isDragging || !collapsiblePanels.middle) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setMiddleCollapsed(true);\n });\n if (onMiddleCollapseStart) onMiddleCollapseStart();\n\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n\n middleAnimationFrameRef.current = requestAnimationFrame(() => {\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n const remainingTotal = actualLeftSize + actualRightSize;\n const newLeftSize = remainingTotal > 0 ? (actualLeftSize / remainingTotal) * 100 : (isLeftActive ? 50 : 0);\n const newRightSize = remainingTotal > 0 ? (actualRightSize / remainingTotal) * 100 : (isRightActive ? 50 : 0);\n\n // Update last expanded sizes for left and right panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: 0,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(0);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onMiddleCollapseComplete) onMiddleCollapseComplete();\n }\n );\n });\n }, [\n middleAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isLeftActive,\n isRightActive,\n collapsiblePanels.middle,\n animateMultiplePanels,\n onMiddleCollapseStart,\n onMiddleCollapseComplete,\n ]);\n\n const handleMiddleExpand = useCallback(() => {\n if (middleAnimating || isDragging || !collapsiblePanels.middle) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setMiddleCollapsed(false);\n });\n if (onMiddleExpandStart) onMiddleExpandStart();\n\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n\n middleAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? 0) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n const targetMiddleSize = lastExpandedMiddleSize || computedDefaultSizes.middle;\n\n // Calculate proportional redistribution for other panels\n const spaceForOthers = 100 - targetMiddleSize;\n const currentOthersTotal = actualLeftSize + actualRightSize;\n const newLeftSize = currentOthersTotal > 0 ? (actualLeftSize / currentOthersTotal) * spaceForOthers : (isLeftActive ? spaceForOthers / 2 : 0);\n const newRightSize = currentOthersTotal > 0 ? (actualRightSize / currentOthersTotal) * spaceForOthers : (isRightActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for left and right panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: targetMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(targetMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onMiddleExpandComplete) onMiddleExpandComplete();\n }\n );\n });\n }, [\n middleAnimating,\n isDragging,\n leftSize,\n rightSize,\n computedDefaultSizes.middle,\n lastExpandedMiddleSize,\n isLeftActive,\n isRightActive,\n collapsiblePanels.middle,\n animateMultiplePanels,\n onMiddleExpandStart,\n onMiddleExpandComplete,\n ]);\n\n // Note: toggleMiddlePanel can be added if middle panel collapse buttons are needed\n // const toggleMiddlePanel = useCallback(() => {\n // if (middleCollapsed) {\n // handleMiddleExpand();\n // } else {\n // handleMiddleCollapse();\n // }\n // }, [middleCollapsed, handleMiddleCollapse, handleMiddleExpand]);\n\n const toggleRightPanel = useCallback(() => {\n if (rightCollapsed) {\n handleRightExpand();\n } else {\n handleRightCollapse();\n }\n }, [rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Resize handlers\n const handleLeftResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setLeftSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedLeftSize(size);\n setLeftCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n const handleMiddleResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setMiddleSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedMiddleSize(size);\n setMiddleCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n const handleRightResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setRightSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedRightSize(size);\n setRightCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n // Drag handlers\n const handleDragEnd = useCallback(() => {\n if (onPanelResize) {\n // Use the last expanded size for collapsed panels to preserve their size\n const reportedLeftSize = leftCollapsed ? lastExpandedLeftSize : leftSize;\n const reportedMiddleSize = middleCollapsed ? lastExpandedMiddleSize : middleSize;\n const reportedRightSize = rightCollapsed ? lastExpandedRightSize : rightSize;\n\n onPanelResize({\n left: reportedLeftSize,\n middle: reportedMiddleSize,\n right: reportedRightSize,\n });\n }\n }, [leftSize, middleSize, rightSize, leftCollapsed, middleCollapsed, rightCollapsed, lastExpandedLeftSize, lastExpandedMiddleSize, lastExpandedRightSize, onPanelResize]);\n\n const handleDragging = useCallback(\n (dragging: boolean) => {\n setIsDragging(dragging);\n if (!dragging) {\n handleDragEnd();\n }\n },\n [handleDragEnd]\n );\n\n // Effect for external collapsed prop changes\n useEffect(() => {\n if (collapsed.left !== undefined && collapsed.left !== leftCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.left) {\n handleLeftCollapse();\n } else {\n handleLeftExpand();\n }\n });\n }\n }, [collapsed.left, leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n useEffect(() => {\n if (collapsed.middle !== undefined && collapsed.middle !== middleCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.middle) {\n handleMiddleCollapse();\n } else {\n handleMiddleExpand();\n }\n });\n }\n }, [collapsed.middle, middleCollapsed, handleMiddleCollapse, handleMiddleExpand]);\n\n useEffect(() => {\n if (collapsed.right !== undefined && collapsed.right !== rightCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.right) {\n handleRightCollapse();\n } else {\n handleRightExpand();\n }\n });\n }\n }, [collapsed.right, rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Cleanup\n useEffect(() => {\n return () => {\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n };\n }, []);\n\n // Panel class helper\n const getPanelClassName = (panelName: 'left' | 'middle' | 'right') => {\n let className = 'three-panel-item';\n\n if (panelName === 'left') {\n if (collapsiblePanels.left || !isLeftActive) {\n className += ' collapsible-panel';\n if (leftAnimating && !isDragging) className += ' animating';\n if (leftFullyCollapsed) className += ' collapsed';\n }\n } else if (panelName === 'middle') {\n className += ' middle-panel';\n if (collapsiblePanels.middle || !isMiddleActive) {\n className += ' collapsible-panel';\n if (middleAnimating && !isDragging) className += ' animating';\n if (middleFullyCollapsed) className += ' collapsed';\n }\n } else if (panelName === 'right') {\n if (collapsiblePanels.right || !isRightActive) {\n className += ' collapsible-panel';\n if (rightAnimating && !isDragging) className += ' animating';\n if (rightFullyCollapsed) className += ' collapsed';\n }\n }\n\n return className;\n };\n\n const leftCollapsiblePanelStyle =\n leftAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: leftCollapsed ? '0%' : `${computedDefaultSizes.left}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n const middleCollapsiblePanelStyle =\n middleAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: middleCollapsed ? '0%' : `${computedDefaultSizes.middle}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n const rightCollapsiblePanelStyle =\n rightAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: rightCollapsed ? '0%' : `${computedDefaultSizes.right}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const leftPanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.left;\n const middlePanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.middle;\n const rightPanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.right;\n\n return (\n <div className={`three-panel-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup ref={panelGroupRef} direction=\"horizontal\" onLayout={handleDragEnd}>\n {/* Left Panel */}\n <Panel\n ref={leftPanelRef}\n collapsible={collapsiblePanels.left || !isLeftActive}\n defaultSize={(collapsed.left || !isLeftActive) ? 0 : computedDefaultSizes.left}\n minSize={leftPanelMinSize}\n collapsedSize={0}\n onResize={handleLeftResize}\n onCollapse={() => setLeftCollapsed(true)}\n onExpand={() => setLeftCollapsed(false)}\n className={getPanelClassName('left')}\n style={leftCollapsiblePanelStyle}\n {...(slotDataAttributes.left || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: leftCollapsed ? 0 : 1,\n transition: leftAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {leftPanel}\n </div>\n </Panel>\n\n {/* Left Resize Handle - between left and middle */}\n <PanelResizeHandle\n className={`resize-handle left-handle ${leftFullyCollapsed || !isLeftActive || !isMiddleActive ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={leftFullyCollapsed || !isLeftActive || !isMiddleActive}\n >\n {showCollapseButtons && collapsiblePanels.left && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleLeftPanel}\n className=\"collapse-toggle\"\n disabled={leftAnimating}\n aria-label={leftCollapsed ? 'Expand left panel' : 'Collapse left panel'}\n >\n {leftCollapsed ? '▸' : '◂'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Middle Panel */}\n <Panel\n ref={middlePanelRef}\n collapsible={collapsiblePanels.middle || !isMiddleActive}\n defaultSize={(collapsed.middle || !isMiddleActive) ? 0 : computedDefaultSizes.middle}\n minSize={middlePanelMinSize}\n collapsedSize={0}\n onResize={handleMiddleResize}\n onCollapse={() => setMiddleCollapsed(true)}\n onExpand={() => setMiddleCollapsed(false)}\n className={getPanelClassName('middle')}\n style={middleCollapsiblePanelStyle}\n {...(slotDataAttributes.middle || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: middleCollapsed ? 0 : 1,\n transition: middleAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {middlePanel}\n </div>\n </Panel>\n\n {/* Right Resize Handle - between middle and right, OR between left and right if middle is inactive */}\n <PanelResizeHandle\n className={`resize-handle right-handle ${rightFullyCollapsed || !isRightActive || (!isMiddleActive && !isLeftActive) ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={rightFullyCollapsed || !isRightActive || (!isMiddleActive && !isLeftActive)}\n >\n {showCollapseButtons && collapsiblePanels.right && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleRightPanel}\n className=\"collapse-toggle\"\n disabled={rightAnimating}\n aria-label={rightCollapsed ? 'Expand right panel' : 'Collapse right panel'}\n >\n {rightCollapsed ? '◂' : '▸'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Right Panel */}\n <Panel\n ref={rightPanelRef}\n collapsible={collapsiblePanels.right || !isRightActive}\n defaultSize={(collapsed.right || !isRightActive) ? 0 : computedDefaultSizes.right}\n minSize={rightPanelMinSize}\n collapsedSize={0}\n onResize={handleRightResize}\n onCollapse={() => setRightCollapsed(true)}\n onExpand={() => setRightCollapsed(false)}\n className={getPanelClassName('right')}\n style={rightCollapsiblePanelStyle}\n {...(slotDataAttributes.right || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: rightCollapsed ? 0 : 1,\n transition: rightAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {rightPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};","import React, { ReactNode, useRef, useImperativeHandle, forwardRef, useEffect } from 'react';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './SnapCarousel.css';\n\nexport interface SnapCarouselRef {\n /** Scroll to a specific panel by index */\n scrollToPanel: (index: number) => void;\n /** Get the current panel index */\n getCurrentPanel: () => number;\n}\n\nexport interface SnapCarouselProps {\n /** Array of panel content to display in the carousel */\n panels: ReactNode[];\n\n /** CSS class for the carousel container */\n className?: string;\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Minimum width for each panel (default: 350px). For 2-panel layouts, the threshold for switching to 50% width is 2x this value. */\n minPanelWidth?: number;\n\n /** Ideal width for each panel as a fraction of container width (default: 0.333 for 1/3 of container) */\n idealPanelWidth?: number;\n\n /** Whether to show a 1px separator between panels (default: false) */\n showSeparator?: boolean;\n\n /** Callback when a panel comes into view */\n onPanelChange?: (index: number) => void;\n\n /** Prevent keyboard keys (space, arrows, page up/down) from scrolling the carousel. Useful when panels contain interactive input components like terminals or text editors. (default: true) */\n preventKeyboardScroll?: boolean;\n}\n\n/**\n * SnapCarousel - A horizontally scrolling carousel with snap points\n *\n * Responsive behavior:\n * - 1 panel: 100% width of container\n * - 2 panels: 100% width by default, switches to 50% when container width > 2x minPanelWidth (default: 700px)\n * - 3+ panels: Uses max(minPanelWidth, idealPanelWidth%) of container width\n */\nexport const SnapCarousel = forwardRef<SnapCarouselRef, SnapCarouselProps>(({\n panels,\n className = '',\n style,\n theme,\n minPanelWidth = 350,\n idealPanelWidth = 0.333, // 1/3 of container\n showSeparator = false,\n onPanelChange,\n preventKeyboardScroll = true,\n}, ref) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n // Expose methods to parent via ref\n useImperativeHandle(ref, () => ({\n scrollToPanel: (index: number) => {\n if (!containerRef.current) return;\n\n const container = containerRef.current;\n const targetPanel = container.children[index] as HTMLElement;\n\n if (targetPanel) {\n // Calculate the scroll position directly instead of using scrollIntoView\n // This prevents scrolling ancestor containers\n const scrollLeft = targetPanel.offsetLeft;\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n });\n }\n },\n getCurrentPanel: () => {\n if (!containerRef.current || containerRef.current.children.length === 0) return 0;\n\n const container = containerRef.current;\n const containerRect = container.getBoundingClientRect();\n\n // The snap point is the left edge of the container\n const snapPointX = containerRect.left;\n\n // Find which panel's left edge is closest to the snap point\n let closestIndex = 0;\n let closestDistance = Infinity;\n\n for (let i = 0; i < container.children.length; i++) {\n const panel = container.children[i] as HTMLElement;\n const panelRect = panel.getBoundingClientRect();\n\n // Distance from this panel's left edge to the snap point\n const distance = Math.abs(panelRect.left - snapPointX);\n\n if (distance < closestDistance) {\n closestDistance = distance;\n closestIndex = i;\n }\n }\n\n return closestIndex;\n },\n }));\n\n // Handle scroll to track which panel is in view\n const handleScroll = (_e: React.UIEvent<HTMLDivElement>) => {\n if (!onPanelChange || !containerRef.current || containerRef.current.children.length === 0) return;\n\n const container = containerRef.current;\n const containerRect = container.getBoundingClientRect();\n\n // The snap point is the left edge of the container\n const snapPointX = containerRect.left;\n\n // Find which panel's left edge is closest to the snap point\n let closestIndex = 0;\n let closestDistance = Infinity;\n\n for (let i = 0; i < container.children.length; i++) {\n const panel = container.children[i] as HTMLElement;\n const panelRect = panel.getBoundingClientRect();\n\n // Distance from this panel's left edge to the snap point\n const distance = Math.abs(panelRect.left - snapPointX);\n\n if (distance < closestDistance) {\n closestDistance = distance;\n closestIndex = i;\n }\n }\n\n onPanelChange(closestIndex);\n };\n\n // Prevent keyboard-triggered scrolling when enabled\n useEffect(() => {\n if (!preventKeyboardScroll || !containerRef.current) return;\n\n const container = containerRef.current;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n // Don't prevent keyboard events if they're targeting interactive elements\n const target = e.target as HTMLElement;\n const isInteractive =\n target.tagName === 'INPUT' ||\n target.tagName === 'TEXTAREA' ||\n target.tagName === 'SELECT' ||\n target.isContentEditable ||\n target.closest('.xterm') !== null || // Terminal elements\n target.closest('[contenteditable=\"true\"]') !== null;\n\n if (isInteractive) {\n return; // Let the event through to the interactive element\n }\n\n // Prevent keys that trigger browser scrolling\n const scrollKeys = [' ', 'Space', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'PageUp', 'PageDown'];\n\n if (scrollKeys.includes(e.key)) {\n e.preventDefault();\n }\n };\n\n container.addEventListener('keydown', handleKeyDown);\n\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [preventKeyboardScroll]);\n\n // Calculate panel count for responsive sizing\n const panelCount = panels.length;\n\n // Calculate threshold for 2-panel layout: 2x minPanelWidth\n const twoPanelThreshold = minPanelWidth * 2;\n\n // Set panel width based on count\n let panelWidth: string;\n if (panelCount === 1) {\n panelWidth = '100%';\n } else if (panelCount === 2) {\n // For 2 panels, use 50% if parent > threshold, else 100%\n // We'll use container queries in CSS for this\n panelWidth = '100%'; // Default, CSS container query will override\n } else {\n // 3+ panels: use the maximum of minPanelWidth or idealPanelWidth% of container\n // This ensures panels are at least minPanelWidth wide, but can be larger if needed\n // For full-width mobile panels, set minPanelWidth to 0\n panelWidth = `max(${minPanelWidth}px, ${idealPanelWidth * 100}%)`;\n }\n\n // Generate unique ID for this carousel instance to scope the dynamic styles\n const carouselId = React.useId().replace(/:/g, '_');\n\n return (\n <>\n {/* Dynamic styles for 2-panel threshold */}\n {panelCount === 2 && (\n <style>\n {`\n .snap-carousel-container[data-carousel-id=\"${carouselId}\"][data-panel-count=\"2\"] .snap-carousel-panel {\n width: 100%;\n }\n @container (min-width: ${twoPanelThreshold}px) {\n .snap-carousel-container[data-carousel-id=\"${carouselId}\"][data-panel-count=\"2\"] .snap-carousel-panel {\n width: 50%;\n }\n }\n `}\n </style>\n )}\n <div\n ref={containerRef}\n className={`snap-carousel-container ${className}`}\n style={{\n ...themeStyles,\n ...style,\n '--snap-carousel-min-width': `${minPanelWidth}px`,\n '--snap-carousel-ideal-width': `${idealPanelWidth * 100}%`,\n '--snap-carousel-gap': showSeparator ? '1px' : '0px',\n '--snap-carousel-panel-width': panelWidth,\n '--snap-carousel-panel-count': panelCount,\n '--snap-carousel-two-panel-threshold': `${twoPanelThreshold}px`,\n } as React.CSSProperties}\n onScroll={handleScroll}\n data-panel-count={panelCount}\n data-carousel-id={carouselId}\n >\n {panels.map((panel, index) => (\n <div key={index} className=\"snap-carousel-panel\">\n {panel}\n </div>\n ))}\n </div>\n </>\n );\n});\n\nSnapCarousel.displayName = 'SnapCarousel';\n","import { useState, useEffect } from 'react';\n\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(query).matches;\n }\n return false;\n });\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const mediaQuery = window.matchMedia(query);\n const handler = (event: MediaQueryListEvent) => {\n setMatches(event.matches);\n };\n\n setMatches(mediaQuery.matches);\n\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n } else {\n mediaQuery.addListener(handler);\n return () => mediaQuery.removeListener(handler);\n }\n }, [query]);\n\n return matches;\n}","import React, { ReactNode, useMemo } from 'react';\nimport { ConfigurablePanelLayout, ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';\nimport { PanelGroup as PanelGroupType, PanelSlot, TabsConfig } from './PanelConfigurator';\nimport { TabGroup } from './TabGroup';\nimport { SnapCarousel, SnapCarouselProps } from './SnapCarousel';\nimport { useMediaQuery } from '../hooks/useMediaQuery';\n\nexport interface ResponsiveConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {\n /**\n * Media query used to determine when to switch to the mobile carousel layout.\n * Defaults to `(max-width: 768px)`.\n */\n mobileBreakpoint?: string;\n\n /**\n * Additional props passed to the SnapCarousel when the mobile layout is active.\n * The `panels` and `theme` props are managed by this component.\n */\n mobileCarouselProps?: Omit<SnapCarouselProps, 'panels' | 'theme'>;\n}\n\n/**\n * ResponsiveConfigurablePanelLayout - Renders ConfigurablePanelLayout on desktop widths\n * and automatically swaps to a SnapCarousel-powered experience on mobile.\n */\nexport const ResponsiveConfigurablePanelLayout: React.FC<ResponsiveConfigurablePanelLayoutProps> = ({\n mobileBreakpoint = '(max-width: 768px)',\n mobileCarouselProps,\n theme,\n layout,\n panels,\n ...rest\n}) => {\n const isMobile = useMediaQuery(mobileBreakpoint);\n\n const orderedSlots: (PanelSlot | undefined)[] = useMemo(() => [layout?.left, layout?.middle, layout?.right], [layout]);\n\n const mobilePanels = useMemo(() => {\n const getPanelContent = (panelId: string | null): ReactNode => {\n if (!panelId) return null;\n const panel = panels.find(p => p.id === panelId);\n return panel?.content ?? null;\n };\n\n const renderPanelSlot = (slot: PanelSlot | undefined): ReactNode | null => {\n if (slot === null || slot === undefined) return null;\n\n if (typeof slot === 'object' && 'type' in slot) {\n const group = slot as PanelGroupType;\n if (group.type === 'tabs') {\n return (\n <TabGroup\n panelIds={group.panels}\n panels={panels}\n config={group.config as TabsConfig}\n theme={theme}\n />\n );\n }\n // Future group types (e.g., tiles) can be added here\n return null;\n }\n\n return getPanelContent(slot);\n };\n\n return orderedSlots\n .map(renderPanelSlot)\n .filter((panelContent): panelContent is ReactNode => panelContent !== null);\n }, [orderedSlots, panels, theme]);\n\n if (isMobile) {\n if (mobilePanels.length === 0) {\n return null;\n }\n\n return (\n <SnapCarousel\n theme={theme}\n panels={mobilePanels}\n minPanelWidth={0}\n idealPanelWidth={1}\n {...mobileCarouselProps}\n />\n );\n }\n\n return (\n <ConfigurablePanelLayout\n theme={theme}\n layout={layout}\n panels={panels}\n {...rest}\n />\n );\n};\n","import { useMemo, useLayoutEffect, useEffect, useRef, useCallback } from 'react';\n\nfunction useCombinedRefs() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n\n return useMemo(() => node => {\n refs.forEach(ref => ref(node));\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n refs);\n}\n\n// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js\nconst canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';\n\nfunction isWindow(element) {\n const elementString = Object.prototype.toString.call(element);\n return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]\n elementString === '[object global]';\n}\n\nfunction isNode(node) {\n return 'nodeType' in node;\n}\n\nfunction getWindow(target) {\n var _target$ownerDocument, _target$ownerDocument2;\n\n if (!target) {\n return window;\n }\n\n if (isWindow(target)) {\n return target;\n }\n\n if (!isNode(target)) {\n return window;\n }\n\n return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;\n}\n\nfunction isDocument(node) {\n const {\n Document\n } = getWindow(node);\n return node instanceof Document;\n}\n\nfunction isHTMLElement(node) {\n if (isWindow(node)) {\n return false;\n }\n\n return node instanceof getWindow(node).HTMLElement;\n}\n\nfunction isSVGElement(node) {\n return node instanceof getWindow(node).SVGElement;\n}\n\nfunction getOwnerDocument(target) {\n if (!target) {\n return document;\n }\n\n if (isWindow(target)) {\n return target.document;\n }\n\n if (!isNode(target)) {\n return document;\n }\n\n if (isDocument(target)) {\n return target;\n }\n\n if (isHTMLElement(target) || isSVGElement(target)) {\n return target.ownerDocument;\n }\n\n return document;\n}\n\n/**\r\n * A hook that resolves to useEffect on the server and useLayoutEffect on the client\r\n * @param callback {function} Callback function that is invoked when the dependencies of the hook change\r\n */\n\nconst useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;\n\nfunction useEvent(handler) {\n const handlerRef = useRef(handler);\n useIsomorphicLayoutEffect(() => {\n handlerRef.current = handler;\n });\n return useCallback(function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return handlerRef.current == null ? void 0 : handlerRef.current(...args);\n }, []);\n}\n\nfunction useInterval() {\n const intervalRef = useRef(null);\n const set = useCallback((listener, duration) => {\n intervalRef.current = setInterval(listener, duration);\n }, []);\n const clear = useCallback(() => {\n if (intervalRef.current !== null) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n return [set, clear];\n}\n\nfunction useLatestValue(value, dependencies) {\n if (dependencies === void 0) {\n dependencies = [value];\n }\n\n const valueRef = useRef(value);\n useIsomorphicLayoutEffect(() => {\n if (valueRef.current !== value) {\n valueRef.current = value;\n }\n }, dependencies);\n return valueRef;\n}\n\nfunction useLazyMemo(callback, dependencies) {\n const valueRef = useRef();\n return useMemo(() => {\n const newValue = callback(valueRef.current);\n valueRef.current = newValue;\n return newValue;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [...dependencies]);\n}\n\nfunction useNodeRef(onChange) {\n const onChangeHandler = useEvent(onChange);\n const node = useRef(null);\n const setNodeRef = useCallback(element => {\n if (element !== node.current) {\n onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);\n }\n\n node.current = element;\n }, //eslint-disable-next-line\n []);\n return [node, setNodeRef];\n}\n\nfunction usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nlet ids = {};\nfunction useUniqueId(prefix, value) {\n return useMemo(() => {\n if (value) {\n return value;\n }\n\n const id = ids[prefix] == null ? 0 : ids[prefix] + 1;\n ids[prefix] = id;\n return prefix + \"-\" + id;\n }, [prefix, value]);\n}\n\nfunction createAdjustmentFn(modifier) {\n return function (object) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((accumulator, adjustment) => {\n const entries = Object.entries(adjustment);\n\n for (const [key, valueAdjustment] of entries) {\n const value = accumulator[key];\n\n if (value != null) {\n accumulator[key] = value + modifier * valueAdjustment;\n }\n }\n\n return accumulator;\n }, { ...object\n });\n };\n}\n\nconst add = /*#__PURE__*/createAdjustmentFn(1);\nconst subtract = /*#__PURE__*/createAdjustmentFn(-1);\n\nfunction hasViewportRelativeCoordinates(event) {\n return 'clientX' in event && 'clientY' in event;\n}\n\nfunction isKeyboardEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n KeyboardEvent\n } = getWindow(event.target);\n return KeyboardEvent && event instanceof KeyboardEvent;\n}\n\nfunction isTouchEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n TouchEvent\n } = getWindow(event.target);\n return TouchEvent && event instanceof TouchEvent;\n}\n\n/**\r\n * Returns the normalized x and y coordinates for mouse and touch events.\r\n */\n\nfunction getEventCoordinates(event) {\n if (isTouchEvent(event)) {\n if (event.touches && event.touches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.touches[0];\n return {\n x,\n y\n };\n } else if (event.changedTouches && event.changedTouches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.changedTouches[0];\n return {\n x,\n y\n };\n }\n }\n\n if (hasViewportRelativeCoordinates(event)) {\n return {\n x: event.clientX,\n y: event.clientY\n };\n }\n\n return null;\n}\n\nconst CSS = /*#__PURE__*/Object.freeze({\n Translate: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n x,\n y\n } = transform;\n return \"translate3d(\" + (x ? Math.round(x) : 0) + \"px, \" + (y ? Math.round(y) : 0) + \"px, 0)\";\n }\n\n },\n Scale: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n scaleX,\n scaleY\n } = transform;\n return \"scaleX(\" + scaleX + \") scaleY(\" + scaleY + \")\";\n }\n\n },\n Transform: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' ');\n }\n\n },\n Transition: {\n toString(_ref) {\n let {\n property,\n duration,\n easing\n } = _ref;\n return property + \" \" + duration + \"ms \" + easing;\n }\n\n }\n});\n\nconst SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]';\nfunction findFirstFocusableNode(element) {\n if (element.matches(SELECTOR)) {\n return element;\n }\n\n return element.querySelector(SELECTOR);\n}\n\nexport { CSS, add, canUseDOM, findFirstFocusableNode, getEventCoordinates, getOwnerDocument, getWindow, hasViewportRelativeCoordinates, isDocument, isHTMLElement, isKeyboardEvent, isNode, isSVGElement, isTouchEvent, isWindow, subtract, useCombinedRefs, useEvent, useInterval, useIsomorphicLayoutEffect, useLatestValue, useLazyMemo, useNodeRef, usePrevious, useUniqueId };\n//# sourceMappingURL=utilities.esm.js.map\n","import React, { useState, useCallback } from 'react';\n\nconst hiddenStyles = {\n display: 'none'\n};\nfunction HiddenText(_ref) {\n let {\n id,\n value\n } = _ref;\n return React.createElement(\"div\", {\n id: id,\n style: hiddenStyles\n }, value);\n}\n\nfunction LiveRegion(_ref) {\n let {\n id,\n announcement,\n ariaLiveType = \"assertive\"\n } = _ref;\n // Hide element visually but keep it readable by screen readers\n const visuallyHidden = {\n position: 'fixed',\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n margin: -1,\n border: 0,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(100%)',\n whiteSpace: 'nowrap'\n };\n return React.createElement(\"div\", {\n id: id,\n style: visuallyHidden,\n role: \"status\",\n \"aria-live\": ariaLiveType,\n \"aria-atomic\": true\n }, announcement);\n}\n\nfunction useAnnouncement() {\n const [announcement, setAnnouncement] = useState('');\n const announce = useCallback(value => {\n if (value != null) {\n setAnnouncement(value);\n }\n }, []);\n return {\n announce,\n announcement\n };\n}\n\nexport { HiddenText, LiveRegion, useAnnouncement };\n//# sourceMappingURL=accessibility.esm.js.map\n","import React, { createContext, useContext, useEffect, useState, useCallback, useMemo, useRef, memo, useReducer, cloneElement, forwardRef } from 'react';\nimport { createPortal, unstable_batchedUpdates } from 'react-dom';\nimport { useUniqueId, getEventCoordinates, getWindow, isDocument, isHTMLElement, isSVGElement, canUseDOM, isWindow, isNode, getOwnerDocument, add, isKeyboardEvent, subtract, useLazyMemo, useInterval, usePrevious, useLatestValue, useEvent, useIsomorphicLayoutEffect, useNodeRef, findFirstFocusableNode, CSS } from '@dnd-kit/utilities';\nimport { useAnnouncement, HiddenText, LiveRegion } from '@dnd-kit/accessibility';\n\nconst DndMonitorContext = /*#__PURE__*/createContext(null);\n\nfunction useDndMonitor(listener) {\n const registerListener = useContext(DndMonitorContext);\n useEffect(() => {\n if (!registerListener) {\n throw new Error('useDndMonitor must be used within a children of <DndContext>');\n }\n\n const unsubscribe = registerListener(listener);\n return unsubscribe;\n }, [listener, registerListener]);\n}\n\nfunction useDndMonitorProvider() {\n const [listeners] = useState(() => new Set());\n const registerListener = useCallback(listener => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }, [listeners]);\n const dispatch = useCallback(_ref => {\n let {\n type,\n event\n } = _ref;\n listeners.forEach(listener => {\n var _listener$type;\n\n return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);\n });\n }, [listeners]);\n return [dispatch, registerListener];\n}\n\nconst defaultScreenReaderInstructions = {\n draggable: \"\\n To pick up a draggable item, press the space bar.\\n While dragging, use the arrow keys to move the item.\\n Press space again to drop the item in its new position, or press escape to cancel.\\n \"\n};\nconst defaultAnnouncements = {\n onDragStart(_ref) {\n let {\n active\n } = _ref;\n return \"Picked up draggable item \" + active.id + \".\";\n },\n\n onDragOver(_ref2) {\n let {\n active,\n over\n } = _ref2;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was moved over droppable area \" + over.id + \".\";\n }\n\n return \"Draggable item \" + active.id + \" is no longer over a droppable area.\";\n },\n\n onDragEnd(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was dropped over droppable area \" + over.id;\n }\n\n return \"Draggable item \" + active.id + \" was dropped.\";\n },\n\n onDragCancel(_ref4) {\n let {\n active\n } = _ref4;\n return \"Dragging was cancelled. Draggable item \" + active.id + \" was dropped.\";\n }\n\n};\n\nfunction Accessibility(_ref) {\n let {\n announcements = defaultAnnouncements,\n container,\n hiddenTextDescribedById,\n screenReaderInstructions = defaultScreenReaderInstructions\n } = _ref;\n const {\n announce,\n announcement\n } = useAnnouncement();\n const liveRegionId = useUniqueId(\"DndLiveRegion\");\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n useDndMonitor(useMemo(() => ({\n onDragStart(_ref2) {\n let {\n active\n } = _ref2;\n announce(announcements.onDragStart({\n active\n }));\n },\n\n onDragMove(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (announcements.onDragMove) {\n announce(announcements.onDragMove({\n active,\n over\n }));\n }\n },\n\n onDragOver(_ref4) {\n let {\n active,\n over\n } = _ref4;\n announce(announcements.onDragOver({\n active,\n over\n }));\n },\n\n onDragEnd(_ref5) {\n let {\n active,\n over\n } = _ref5;\n announce(announcements.onDragEnd({\n active,\n over\n }));\n },\n\n onDragCancel(_ref6) {\n let {\n active,\n over\n } = _ref6;\n announce(announcements.onDragCancel({\n active,\n over\n }));\n }\n\n }), [announce, announcements]));\n\n if (!mounted) {\n return null;\n }\n\n const markup = React.createElement(React.Fragment, null, React.createElement(HiddenText, {\n id: hiddenTextDescribedById,\n value: screenReaderInstructions.draggable\n }), React.createElement(LiveRegion, {\n id: liveRegionId,\n announcement: announcement\n }));\n return container ? createPortal(markup, container) : markup;\n}\n\nvar Action;\n\n(function (Action) {\n Action[\"DragStart\"] = \"dragStart\";\n Action[\"DragMove\"] = \"dragMove\";\n Action[\"DragEnd\"] = \"dragEnd\";\n Action[\"DragCancel\"] = \"dragCancel\";\n Action[\"DragOver\"] = \"dragOver\";\n Action[\"RegisterDroppable\"] = \"registerDroppable\";\n Action[\"SetDroppableDisabled\"] = \"setDroppableDisabled\";\n Action[\"UnregisterDroppable\"] = \"unregisterDroppable\";\n})(Action || (Action = {}));\n\nfunction noop() {}\n\nfunction useSensor(sensor, options) {\n return useMemo(() => ({\n sensor,\n options: options != null ? options : {}\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [sensor, options]);\n}\n\nfunction useSensors() {\n for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {\n sensors[_key] = arguments[_key];\n }\n\n return useMemo(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps\n [...sensors]);\n}\n\nconst defaultCoordinates = /*#__PURE__*/Object.freeze({\n x: 0,\n y: 0\n});\n\n/**\r\n * Returns the distance between two points\r\n */\nfunction distanceBetween(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\nfunction getRelativeTransformOrigin(event, rect) {\n const eventCoordinates = getEventCoordinates(event);\n\n if (!eventCoordinates) {\n return '0 0';\n }\n\n const transformOrigin = {\n x: (eventCoordinates.x - rect.left) / rect.width * 100,\n y: (eventCoordinates.y - rect.top) / rect.height * 100\n };\n return transformOrigin.x + \"% \" + transformOrigin.y + \"%\";\n}\n\n/**\r\n * Sort collisions from smallest to greatest value\r\n */\nfunction sortCollisionsAsc(_ref, _ref2) {\n let {\n data: {\n value: a\n }\n } = _ref;\n let {\n data: {\n value: b\n }\n } = _ref2;\n return a - b;\n}\n/**\r\n * Sort collisions from greatest to smallest value\r\n */\n\nfunction sortCollisionsDesc(_ref3, _ref4) {\n let {\n data: {\n value: a\n }\n } = _ref3;\n let {\n data: {\n value: b\n }\n } = _ref4;\n return b - a;\n}\n/**\r\n * Returns the coordinates of the corners of a given rectangle:\r\n * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}]\r\n */\n\nfunction cornersOfRectangle(_ref5) {\n let {\n left,\n top,\n height,\n width\n } = _ref5;\n return [{\n x: left,\n y: top\n }, {\n x: left + width,\n y: top\n }, {\n x: left,\n y: top + height\n }, {\n x: left + width,\n y: top + height\n }];\n}\nfunction getFirstCollision(collisions, property) {\n if (!collisions || collisions.length === 0) {\n return null;\n }\n\n const [firstCollision] = collisions;\n return property ? firstCollision[property] : firstCollision;\n}\n\n/**\r\n * Returns the coordinates of the center of a given ClientRect\r\n */\n\nfunction centerOfRectangle(rect, left, top) {\n if (left === void 0) {\n left = rect.left;\n }\n\n if (top === void 0) {\n top = rect.top;\n }\n\n return {\n x: left + rect.width * 0.5,\n y: top + rect.height * 0.5\n };\n}\n/**\r\n * Returns the closest rectangles from an array of rectangles to the center of a given\r\n * rectangle.\r\n */\n\n\nconst closestCenter = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: distBetween\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the closest rectangles from an array of rectangles to the corners of\r\n * another rectangle.\r\n */\n\nconst closestCorners = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const corners = cornersOfRectangle(collisionRect);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const rectCorners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner, index) => {\n return accumulator + distanceBetween(rectCorners[index], corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the intersecting rectangle area between two rectangles\r\n */\n\nfunction getIntersectionRatio(entry, target) {\n const top = Math.max(target.top, entry.top);\n const left = Math.max(target.left, entry.left);\n const right = Math.min(target.left + target.width, entry.left + entry.width);\n const bottom = Math.min(target.top + target.height, entry.top + entry.height);\n const width = right - left;\n const height = bottom - top;\n\n if (left < right && top < bottom) {\n const targetArea = target.width * target.height;\n const entryArea = entry.width * entry.height;\n const intersectionArea = width * height;\n const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);\n return Number(intersectionRatio.toFixed(4));\n } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)\n\n\n return 0;\n}\n/**\r\n * Returns the rectangles that has the greatest intersection area with a given\r\n * rectangle in an array of rectangles.\r\n */\n\nconst rectIntersection = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const intersectionRatio = getIntersectionRatio(rect, collisionRect);\n\n if (intersectionRatio > 0) {\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: intersectionRatio\n }\n });\n }\n }\n }\n\n return collisions.sort(sortCollisionsDesc);\n};\n\n/**\r\n * Check if a given point is contained within a bounding rectangle\r\n */\n\nfunction isPointWithinRect(point, rect) {\n const {\n top,\n left,\n bottom,\n right\n } = rect;\n return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right;\n}\n/**\r\n * Returns the rectangles that the pointer is hovering over\r\n */\n\n\nconst pointerWithin = _ref => {\n let {\n droppableContainers,\n droppableRects,\n pointerCoordinates\n } = _ref;\n\n if (!pointerCoordinates) {\n return [];\n }\n\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect && isPointWithinRect(pointerCoordinates, rect)) {\n /* There may be more than a single rectangle intersecting\r\n * with the pointer coordinates. In order to sort the\r\n * colliding rectangles, we measure the distance between\r\n * the pointer and the corners of the intersecting rectangle\r\n */\n const corners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner) => {\n return accumulator + distanceBetween(pointerCoordinates, corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\nfunction adjustScale(transform, rect1, rect2) {\n return { ...transform,\n scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,\n scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1\n };\n}\n\nfunction getRectDelta(rect1, rect2) {\n return rect1 && rect2 ? {\n x: rect1.left - rect2.left,\n y: rect1.top - rect2.top\n } : defaultCoordinates;\n}\n\nfunction createRectAdjustmentFn(modifier) {\n return function adjustClientRect(rect) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((acc, adjustment) => ({ ...acc,\n top: acc.top + modifier * adjustment.y,\n bottom: acc.bottom + modifier * adjustment.y,\n left: acc.left + modifier * adjustment.x,\n right: acc.right + modifier * adjustment.x\n }), { ...rect\n });\n };\n}\nconst getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1);\n\nfunction parseTransform(transform) {\n if (transform.startsWith('matrix3d(')) {\n const transformArray = transform.slice(9, -1).split(/, /);\n return {\n x: +transformArray[12],\n y: +transformArray[13],\n scaleX: +transformArray[0],\n scaleY: +transformArray[5]\n };\n } else if (transform.startsWith('matrix(')) {\n const transformArray = transform.slice(7, -1).split(/, /);\n return {\n x: +transformArray[4],\n y: +transformArray[5],\n scaleX: +transformArray[0],\n scaleY: +transformArray[3]\n };\n }\n\n return null;\n}\n\nfunction inverseTransform(rect, transform, transformOrigin) {\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return rect;\n }\n\n const {\n scaleX,\n scaleY,\n x: translateX,\n y: translateY\n } = parsedTransform;\n const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);\n const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1));\n const w = scaleX ? rect.width / scaleX : rect.width;\n const h = scaleY ? rect.height / scaleY : rect.height;\n return {\n width: w,\n height: h,\n top: y,\n right: x + w,\n bottom: y + h,\n left: x\n };\n}\n\nconst defaultOptions = {\n ignoreTransform: false\n};\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n */\n\nfunction getClientRect(element, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n let rect = element.getBoundingClientRect();\n\n if (options.ignoreTransform) {\n const {\n transform,\n transformOrigin\n } = getWindow(element).getComputedStyle(element);\n\n if (transform) {\n rect = inverseTransform(rect, transform, transformOrigin);\n }\n }\n\n const {\n top,\n left,\n width,\n height,\n bottom,\n right\n } = rect;\n return {\n top,\n left,\n width,\n height,\n bottom,\n right\n };\n}\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n *\r\n * @remarks\r\n * The ClientRect returned by this method does not take into account transforms\r\n * applied to the element it measures.\r\n *\r\n */\n\nfunction getTransformAgnosticClientRect(element) {\n return getClientRect(element, {\n ignoreTransform: true\n });\n}\n\nfunction getWindowClientRect(element) {\n const width = element.innerWidth;\n const height = element.innerHeight;\n return {\n top: 0,\n left: 0,\n right: width,\n bottom: height,\n width,\n height\n };\n}\n\nfunction isFixed(node, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(node).getComputedStyle(node);\n }\n\n return computedStyle.position === 'fixed';\n}\n\nfunction isScrollable(element, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(element).getComputedStyle(element);\n }\n\n const overflowRegex = /(auto|scroll|overlay)/;\n const properties = ['overflow', 'overflowX', 'overflowY'];\n return properties.some(property => {\n const value = computedStyle[property];\n return typeof value === 'string' ? overflowRegex.test(value) : false;\n });\n}\n\nfunction getScrollableAncestors(element, limit) {\n const scrollParents = [];\n\n function findScrollableAncestors(node) {\n if (limit != null && scrollParents.length >= limit) {\n return scrollParents;\n }\n\n if (!node) {\n return scrollParents;\n }\n\n if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {\n scrollParents.push(node.scrollingElement);\n return scrollParents;\n }\n\n if (!isHTMLElement(node) || isSVGElement(node)) {\n return scrollParents;\n }\n\n if (scrollParents.includes(node)) {\n return scrollParents;\n }\n\n const computedStyle = getWindow(element).getComputedStyle(node);\n\n if (node !== element) {\n if (isScrollable(node, computedStyle)) {\n scrollParents.push(node);\n }\n }\n\n if (isFixed(node, computedStyle)) {\n return scrollParents;\n }\n\n return findScrollableAncestors(node.parentNode);\n }\n\n if (!element) {\n return scrollParents;\n }\n\n return findScrollableAncestors(element);\n}\nfunction getFirstScrollableAncestor(node) {\n const [firstScrollableAncestor] = getScrollableAncestors(node, 1);\n return firstScrollableAncestor != null ? firstScrollableAncestor : null;\n}\n\nfunction getScrollableElement(element) {\n if (!canUseDOM || !element) {\n return null;\n }\n\n if (isWindow(element)) {\n return element;\n }\n\n if (!isNode(element)) {\n return null;\n }\n\n if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {\n return window;\n }\n\n if (isHTMLElement(element)) {\n return element;\n }\n\n return null;\n}\n\nfunction getScrollXCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollX;\n }\n\n return element.scrollLeft;\n}\nfunction getScrollYCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollY;\n }\n\n return element.scrollTop;\n}\nfunction getScrollCoordinates(element) {\n return {\n x: getScrollXCoordinate(element),\n y: getScrollYCoordinate(element)\n };\n}\n\nvar Direction;\n\n(function (Direction) {\n Direction[Direction[\"Forward\"] = 1] = \"Forward\";\n Direction[Direction[\"Backward\"] = -1] = \"Backward\";\n})(Direction || (Direction = {}));\n\nfunction isDocumentScrollingElement(element) {\n if (!canUseDOM || !element) {\n return false;\n }\n\n return element === document.scrollingElement;\n}\n\nfunction getScrollPosition(scrollingContainer) {\n const minScroll = {\n x: 0,\n y: 0\n };\n const dimensions = isDocumentScrollingElement(scrollingContainer) ? {\n height: window.innerHeight,\n width: window.innerWidth\n } : {\n height: scrollingContainer.clientHeight,\n width: scrollingContainer.clientWidth\n };\n const maxScroll = {\n x: scrollingContainer.scrollWidth - dimensions.width,\n y: scrollingContainer.scrollHeight - dimensions.height\n };\n const isTop = scrollingContainer.scrollTop <= minScroll.y;\n const isLeft = scrollingContainer.scrollLeft <= minScroll.x;\n const isBottom = scrollingContainer.scrollTop >= maxScroll.y;\n const isRight = scrollingContainer.scrollLeft >= maxScroll.x;\n return {\n isTop,\n isLeft,\n isBottom,\n isRight,\n maxScroll,\n minScroll\n };\n}\n\nconst defaultThreshold = {\n x: 0.2,\n y: 0.2\n};\nfunction getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {\n let {\n top,\n left,\n right,\n bottom\n } = _ref;\n\n if (acceleration === void 0) {\n acceleration = 10;\n }\n\n if (thresholdPercentage === void 0) {\n thresholdPercentage = defaultThreshold;\n }\n\n const {\n isTop,\n isBottom,\n isLeft,\n isRight\n } = getScrollPosition(scrollContainer);\n const direction = {\n x: 0,\n y: 0\n };\n const speed = {\n x: 0,\n y: 0\n };\n const threshold = {\n height: scrollContainerRect.height * thresholdPercentage.y,\n width: scrollContainerRect.width * thresholdPercentage.x\n };\n\n if (!isTop && top <= scrollContainerRect.top + threshold.height) {\n // Scroll Up\n direction.y = Direction.Backward;\n speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);\n } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {\n // Scroll Down\n direction.y = Direction.Forward;\n speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);\n }\n\n if (!isRight && right >= scrollContainerRect.right - threshold.width) {\n // Scroll Right\n direction.x = Direction.Forward;\n speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);\n } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {\n // Scroll Left\n direction.x = Direction.Backward;\n speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);\n }\n\n return {\n direction,\n speed\n };\n}\n\nfunction getScrollElementRect(element) {\n if (element === document.scrollingElement) {\n const {\n innerWidth,\n innerHeight\n } = window;\n return {\n top: 0,\n left: 0,\n right: innerWidth,\n bottom: innerHeight,\n width: innerWidth,\n height: innerHeight\n };\n }\n\n const {\n top,\n left,\n right,\n bottom\n } = element.getBoundingClientRect();\n return {\n top,\n left,\n right,\n bottom,\n width: element.clientWidth,\n height: element.clientHeight\n };\n}\n\nfunction getScrollOffsets(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return add(acc, getScrollCoordinates(node));\n }, defaultCoordinates);\n}\nfunction getScrollXOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollXCoordinate(node);\n }, 0);\n}\nfunction getScrollYOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollYCoordinate(node);\n }, 0);\n}\n\nfunction scrollIntoViewIfNeeded(element, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n if (!element) {\n return;\n }\n\n const {\n top,\n left,\n bottom,\n right\n } = measure(element);\n const firstScrollableAncestor = getFirstScrollableAncestor(element);\n\n if (!firstScrollableAncestor) {\n return;\n }\n\n if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {\n element.scrollIntoView({\n block: 'center',\n inline: 'center'\n });\n }\n}\n\nconst properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]];\nclass Rect {\n constructor(rect, element) {\n this.rect = void 0;\n this.width = void 0;\n this.height = void 0;\n this.top = void 0;\n this.bottom = void 0;\n this.right = void 0;\n this.left = void 0;\n const scrollableAncestors = getScrollableAncestors(element);\n const scrollOffsets = getScrollOffsets(scrollableAncestors);\n this.rect = { ...rect\n };\n this.width = rect.width;\n this.height = rect.height;\n\n for (const [axis, keys, getScrollOffset] of properties) {\n for (const key of keys) {\n Object.defineProperty(this, key, {\n get: () => {\n const currentOffsets = getScrollOffset(scrollableAncestors);\n const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;\n return this.rect[key] + scrollOffsetsDeltla;\n },\n enumerable: true\n });\n }\n }\n\n Object.defineProperty(this, 'rect', {\n enumerable: false\n });\n }\n\n}\n\nclass Listeners {\n constructor(target) {\n this.target = void 0;\n this.listeners = [];\n\n this.removeAll = () => {\n this.listeners.forEach(listener => {\n var _this$target;\n\n return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);\n });\n };\n\n this.target = target;\n }\n\n add(eventName, handler, options) {\n var _this$target2;\n\n (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);\n this.listeners.push([eventName, handler, options]);\n }\n\n}\n\nfunction getEventListenerTarget(target) {\n // If the `event.target` element is removed from the document events will still be targeted\n // at it, and hence won't always bubble up to the window or document anymore.\n // If there is any risk of an element being removed while it is being dragged,\n // the best practice is to attach the event listeners directly to the target.\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n const {\n EventTarget\n } = getWindow(target);\n return target instanceof EventTarget ? target : getOwnerDocument(target);\n}\n\nfunction hasExceededDistance(delta, measurement) {\n const dx = Math.abs(delta.x);\n const dy = Math.abs(delta.y);\n\n if (typeof measurement === 'number') {\n return Math.sqrt(dx ** 2 + dy ** 2) > measurement;\n }\n\n if ('x' in measurement && 'y' in measurement) {\n return dx > measurement.x && dy > measurement.y;\n }\n\n if ('x' in measurement) {\n return dx > measurement.x;\n }\n\n if ('y' in measurement) {\n return dy > measurement.y;\n }\n\n return false;\n}\n\nvar EventName;\n\n(function (EventName) {\n EventName[\"Click\"] = \"click\";\n EventName[\"DragStart\"] = \"dragstart\";\n EventName[\"Keydown\"] = \"keydown\";\n EventName[\"ContextMenu\"] = \"contextmenu\";\n EventName[\"Resize\"] = \"resize\";\n EventName[\"SelectionChange\"] = \"selectionchange\";\n EventName[\"VisibilityChange\"] = \"visibilitychange\";\n})(EventName || (EventName = {}));\n\nfunction preventDefault(event) {\n event.preventDefault();\n}\nfunction stopPropagation(event) {\n event.stopPropagation();\n}\n\nvar KeyboardCode;\n\n(function (KeyboardCode) {\n KeyboardCode[\"Space\"] = \"Space\";\n KeyboardCode[\"Down\"] = \"ArrowDown\";\n KeyboardCode[\"Right\"] = \"ArrowRight\";\n KeyboardCode[\"Left\"] = \"ArrowLeft\";\n KeyboardCode[\"Up\"] = \"ArrowUp\";\n KeyboardCode[\"Esc\"] = \"Escape\";\n KeyboardCode[\"Enter\"] = \"Enter\";\n KeyboardCode[\"Tab\"] = \"Tab\";\n})(KeyboardCode || (KeyboardCode = {}));\n\nconst defaultKeyboardCodes = {\n start: [KeyboardCode.Space, KeyboardCode.Enter],\n cancel: [KeyboardCode.Esc],\n end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]\n};\nconst defaultKeyboardCoordinateGetter = (event, _ref) => {\n let {\n currentCoordinates\n } = _ref;\n\n switch (event.code) {\n case KeyboardCode.Right:\n return { ...currentCoordinates,\n x: currentCoordinates.x + 25\n };\n\n case KeyboardCode.Left:\n return { ...currentCoordinates,\n x: currentCoordinates.x - 25\n };\n\n case KeyboardCode.Down:\n return { ...currentCoordinates,\n y: currentCoordinates.y + 25\n };\n\n case KeyboardCode.Up:\n return { ...currentCoordinates,\n y: currentCoordinates.y - 25\n };\n }\n\n return undefined;\n};\n\nclass KeyboardSensor {\n constructor(props) {\n this.props = void 0;\n this.autoScrollEnabled = false;\n this.referenceCoordinates = void 0;\n this.listeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n const {\n event: {\n target\n }\n } = props;\n this.props = props;\n this.listeners = new Listeners(getOwnerDocument(target));\n this.windowListeners = new Listeners(getWindow(target));\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.attach();\n }\n\n attach() {\n this.handleStart();\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));\n }\n\n handleStart() {\n const {\n activeNode,\n onStart\n } = this.props;\n const node = activeNode.node.current;\n\n if (node) {\n scrollIntoViewIfNeeded(node);\n }\n\n onStart(defaultCoordinates);\n }\n\n handleKeyDown(event) {\n if (isKeyboardEvent(event)) {\n const {\n active,\n context,\n options\n } = this.props;\n const {\n keyboardCodes = defaultKeyboardCodes,\n coordinateGetter = defaultKeyboardCoordinateGetter,\n scrollBehavior = 'smooth'\n } = options;\n const {\n code\n } = event;\n\n if (keyboardCodes.end.includes(code)) {\n this.handleEnd(event);\n return;\n }\n\n if (keyboardCodes.cancel.includes(code)) {\n this.handleCancel(event);\n return;\n }\n\n const {\n collisionRect\n } = context.current;\n const currentCoordinates = collisionRect ? {\n x: collisionRect.left,\n y: collisionRect.top\n } : defaultCoordinates;\n\n if (!this.referenceCoordinates) {\n this.referenceCoordinates = currentCoordinates;\n }\n\n const newCoordinates = coordinateGetter(event, {\n active,\n context: context.current,\n currentCoordinates\n });\n\n if (newCoordinates) {\n const coordinatesDelta = subtract(newCoordinates, currentCoordinates);\n const scrollDelta = {\n x: 0,\n y: 0\n };\n const {\n scrollableAncestors\n } = context.current;\n\n for (const scrollContainer of scrollableAncestors) {\n const direction = event.code;\n const {\n isTop,\n isRight,\n isLeft,\n isBottom,\n maxScroll,\n minScroll\n } = getScrollPosition(scrollContainer);\n const scrollElementRect = getScrollElementRect(scrollContainer);\n const clampedCoordinates = {\n x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),\n y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))\n };\n const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;\n const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;\n\n if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {\n const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;\n const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.y) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n left: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;\n } else {\n scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;\n }\n\n if (scrollDelta.x) {\n scrollContainer.scrollBy({\n left: -scrollDelta.x,\n behavior: scrollBehavior\n });\n }\n\n break;\n } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {\n const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;\n const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.x) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n top: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;\n } else {\n scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;\n }\n\n if (scrollDelta.y) {\n scrollContainer.scrollBy({\n top: -scrollDelta.y,\n behavior: scrollBehavior\n });\n }\n\n break;\n }\n }\n\n this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));\n }\n }\n }\n\n handleMove(event, coordinates) {\n const {\n onMove\n } = this.props;\n event.preventDefault();\n onMove(coordinates);\n }\n\n handleEnd(event) {\n const {\n onEnd\n } = this.props;\n event.preventDefault();\n this.detach();\n onEnd();\n }\n\n handleCancel(event) {\n const {\n onCancel\n } = this.props;\n event.preventDefault();\n this.detach();\n onCancel();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll();\n }\n\n}\nKeyboardSensor.activators = [{\n eventName: 'onKeyDown',\n handler: (event, _ref, _ref2) => {\n let {\n keyboardCodes = defaultKeyboardCodes,\n onActivation\n } = _ref;\n let {\n active\n } = _ref2;\n const {\n code\n } = event.nativeEvent;\n\n if (keyboardCodes.start.includes(code)) {\n const activator = active.activatorNode.current;\n\n if (activator && event.target !== activator) {\n return false;\n }\n\n event.preventDefault();\n onActivation == null ? void 0 : onActivation({\n event: event.nativeEvent\n });\n return true;\n }\n\n return false;\n }\n}];\n\nfunction isDistanceConstraint(constraint) {\n return Boolean(constraint && 'distance' in constraint);\n}\n\nfunction isDelayConstraint(constraint) {\n return Boolean(constraint && 'delay' in constraint);\n}\n\nclass AbstractPointerSensor {\n constructor(props, events, listenerTarget) {\n var _getEventCoordinates;\n\n if (listenerTarget === void 0) {\n listenerTarget = getEventListenerTarget(props.event.target);\n }\n\n this.props = void 0;\n this.events = void 0;\n this.autoScrollEnabled = true;\n this.document = void 0;\n this.activated = false;\n this.initialCoordinates = void 0;\n this.timeoutId = null;\n this.listeners = void 0;\n this.documentListeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n this.events = events;\n const {\n event\n } = props;\n const {\n target\n } = event;\n this.props = props;\n this.events = events;\n this.document = getOwnerDocument(target);\n this.documentListeners = new Listeners(this.document);\n this.listeners = new Listeners(listenerTarget);\n this.windowListeners = new Listeners(getWindow(target));\n this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;\n this.handleStart = this.handleStart.bind(this);\n this.handleMove = this.handleMove.bind(this);\n this.handleEnd = this.handleEnd.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.removeTextSelection = this.removeTextSelection.bind(this);\n this.attach();\n }\n\n attach() {\n const {\n events,\n props: {\n options: {\n activationConstraint,\n bypassActivationConstraint\n }\n }\n } = this;\n this.listeners.add(events.move.name, this.handleMove, {\n passive: false\n });\n this.listeners.add(events.end.name, this.handleEnd);\n\n if (events.cancel) {\n this.listeners.add(events.cancel.name, this.handleCancel);\n }\n\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.DragStart, preventDefault);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n this.windowListeners.add(EventName.ContextMenu, preventDefault);\n this.documentListeners.add(EventName.Keydown, this.handleKeydown);\n\n if (activationConstraint) {\n if (bypassActivationConstraint != null && bypassActivationConstraint({\n event: this.props.event,\n activeNode: this.props.activeNode,\n options: this.props.options\n })) {\n return this.handleStart();\n }\n\n if (isDelayConstraint(activationConstraint)) {\n this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);\n this.handlePending(activationConstraint);\n return;\n }\n\n if (isDistanceConstraint(activationConstraint)) {\n this.handlePending(activationConstraint);\n return;\n }\n }\n\n this.handleStart();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners\n // This is necessary because we listen for `click` and `selection` events on the document\n\n setTimeout(this.documentListeners.removeAll, 50);\n\n if (this.timeoutId !== null) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n\n handlePending(constraint, offset) {\n const {\n active,\n onPending\n } = this.props;\n onPending(active, constraint, this.initialCoordinates, offset);\n }\n\n handleStart() {\n const {\n initialCoordinates\n } = this;\n const {\n onStart\n } = this.props;\n\n if (initialCoordinates) {\n this.activated = true; // Stop propagation of click events once activation constraints are met\n\n this.documentListeners.add(EventName.Click, stopPropagation, {\n capture: true\n }); // Remove any text selection from the document\n\n this.removeTextSelection(); // Prevent further text selection while dragging\n\n this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);\n onStart(initialCoordinates);\n }\n }\n\n handleMove(event) {\n var _getEventCoordinates2;\n\n const {\n activated,\n initialCoordinates,\n props\n } = this;\n const {\n onMove,\n options: {\n activationConstraint\n }\n } = props;\n\n if (!initialCoordinates) {\n return;\n }\n\n const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;\n const delta = subtract(initialCoordinates, coordinates); // Constraint validation\n\n if (!activated && activationConstraint) {\n if (isDistanceConstraint(activationConstraint)) {\n if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n\n if (hasExceededDistance(delta, activationConstraint.distance)) {\n return this.handleStart();\n }\n }\n\n if (isDelayConstraint(activationConstraint)) {\n if (hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n }\n\n this.handlePending(activationConstraint, delta);\n return;\n }\n\n if (event.cancelable) {\n event.preventDefault();\n }\n\n onMove(coordinates);\n }\n\n handleEnd() {\n const {\n onAbort,\n onEnd\n } = this.props;\n this.detach();\n\n if (!this.activated) {\n onAbort(this.props.active);\n }\n\n onEnd();\n }\n\n handleCancel() {\n const {\n onAbort,\n onCancel\n } = this.props;\n this.detach();\n\n if (!this.activated) {\n onAbort(this.props.active);\n }\n\n onCancel();\n }\n\n handleKeydown(event) {\n if (event.code === KeyboardCode.Esc) {\n this.handleCancel();\n }\n }\n\n removeTextSelection() {\n var _this$document$getSel;\n\n (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();\n }\n\n}\n\nconst events = {\n cancel: {\n name: 'pointercancel'\n },\n move: {\n name: 'pointermove'\n },\n end: {\n name: 'pointerup'\n }\n};\nclass PointerSensor extends AbstractPointerSensor {\n constructor(props) {\n const {\n event\n } = props; // Pointer events stop firing if the target is unmounted while dragging\n // Therefore we attach listeners to the owner document instead\n\n const listenerTarget = getOwnerDocument(event.target);\n super(props, events, listenerTarget);\n }\n\n}\nPointerSensor.activators = [{\n eventName: 'onPointerDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (!event.isPrimary || event.button !== 0) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$1 = {\n move: {\n name: 'mousemove'\n },\n end: {\n name: 'mouseup'\n }\n};\nvar MouseButton;\n\n(function (MouseButton) {\n MouseButton[MouseButton[\"RightClick\"] = 2] = \"RightClick\";\n})(MouseButton || (MouseButton = {}));\n\nclass MouseSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$1, getOwnerDocument(props.event.target));\n }\n\n}\nMouseSensor.activators = [{\n eventName: 'onMouseDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (event.button === MouseButton.RightClick) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$2 = {\n cancel: {\n name: 'touchcancel'\n },\n move: {\n name: 'touchmove'\n },\n end: {\n name: 'touchend'\n }\n};\nclass TouchSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$2);\n }\n\n static setup() {\n // Adding a non-capture and non-passive `touchmove` listener in order\n // to force `event.preventDefault()` calls to work in dynamically added\n // touchmove event handlers. This is required for iOS Safari.\n window.addEventListener(events$2.move.name, noop, {\n capture: false,\n passive: false\n });\n return function teardown() {\n window.removeEventListener(events$2.move.name, noop);\n }; // We create a new handler because the teardown function of another sensor\n // could remove our event listener if we use a referentially equal listener.\n\n function noop() {}\n }\n\n}\nTouchSensor.activators = [{\n eventName: 'onTouchStart',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n const {\n touches\n } = event;\n\n if (touches.length > 1) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nvar AutoScrollActivator;\n\n(function (AutoScrollActivator) {\n AutoScrollActivator[AutoScrollActivator[\"Pointer\"] = 0] = \"Pointer\";\n AutoScrollActivator[AutoScrollActivator[\"DraggableRect\"] = 1] = \"DraggableRect\";\n})(AutoScrollActivator || (AutoScrollActivator = {}));\n\nvar TraversalOrder;\n\n(function (TraversalOrder) {\n TraversalOrder[TraversalOrder[\"TreeOrder\"] = 0] = \"TreeOrder\";\n TraversalOrder[TraversalOrder[\"ReversedTreeOrder\"] = 1] = \"ReversedTreeOrder\";\n})(TraversalOrder || (TraversalOrder = {}));\n\nfunction useAutoScroller(_ref) {\n let {\n acceleration,\n activator = AutoScrollActivator.Pointer,\n canScroll,\n draggingRect,\n enabled,\n interval = 5,\n order = TraversalOrder.TreeOrder,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects,\n delta,\n threshold\n } = _ref;\n const scrollIntent = useScrollIntent({\n delta,\n disabled: !enabled\n });\n const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();\n const scrollSpeed = useRef({\n x: 0,\n y: 0\n });\n const scrollDirection = useRef({\n x: 0,\n y: 0\n });\n const rect = useMemo(() => {\n switch (activator) {\n case AutoScrollActivator.Pointer:\n return pointerCoordinates ? {\n top: pointerCoordinates.y,\n bottom: pointerCoordinates.y,\n left: pointerCoordinates.x,\n right: pointerCoordinates.x\n } : null;\n\n case AutoScrollActivator.DraggableRect:\n return draggingRect;\n }\n }, [activator, draggingRect, pointerCoordinates]);\n const scrollContainerRef = useRef(null);\n const autoScroll = useCallback(() => {\n const scrollContainer = scrollContainerRef.current;\n\n if (!scrollContainer) {\n return;\n }\n\n const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;\n const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;\n scrollContainer.scrollBy(scrollLeft, scrollTop);\n }, []);\n const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);\n useEffect(() => {\n if (!enabled || !scrollableAncestors.length || !rect) {\n clearAutoScrollInterval();\n return;\n }\n\n for (const scrollContainer of sortedScrollableAncestors) {\n if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {\n continue;\n }\n\n const index = scrollableAncestors.indexOf(scrollContainer);\n const scrollContainerRect = scrollableAncestorRects[index];\n\n if (!scrollContainerRect) {\n continue;\n }\n\n const {\n direction,\n speed\n } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);\n\n for (const axis of ['x', 'y']) {\n if (!scrollIntent[axis][direction[axis]]) {\n speed[axis] = 0;\n direction[axis] = 0;\n }\n }\n\n if (speed.x > 0 || speed.y > 0) {\n clearAutoScrollInterval();\n scrollContainerRef.current = scrollContainer;\n setAutoScrollInterval(autoScroll, interval);\n scrollSpeed.current = speed;\n scrollDirection.current = direction;\n return;\n }\n }\n\n scrollSpeed.current = {\n x: 0,\n y: 0\n };\n scrollDirection.current = {\n x: 0,\n y: 0\n };\n clearAutoScrollInterval();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(threshold)]);\n}\nconst defaultScrollIntent = {\n x: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n },\n y: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n }\n};\n\nfunction useScrollIntent(_ref2) {\n let {\n delta,\n disabled\n } = _ref2;\n const previousDelta = usePrevious(delta);\n return useLazyMemo(previousIntent => {\n if (disabled || !previousDelta || !previousIntent) {\n // Reset scroll intent tracking when auto-scrolling is disabled\n return defaultScrollIntent;\n }\n\n const direction = {\n x: Math.sign(delta.x - previousDelta.x),\n y: Math.sign(delta.y - previousDelta.y)\n }; // Keep track of the user intent to scroll in each direction for both axis\n\n return {\n x: {\n [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,\n [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1\n },\n y: {\n [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,\n [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1\n }\n };\n }, [disabled, delta, previousDelta]);\n}\n\nfunction useCachedNode(draggableNodes, id) {\n const draggableNode = id != null ? draggableNodes.get(id) : undefined;\n const node = draggableNode ? draggableNode.node.current : null;\n return useLazyMemo(cachedNode => {\n var _ref;\n\n if (id == null) {\n return null;\n } // In some cases, the draggable node can unmount while dragging\n // This is the case for virtualized lists. In those situations,\n // we fall back to the last known value for that node.\n\n\n return (_ref = node != null ? node : cachedNode) != null ? _ref : null;\n }, [node, id]);\n}\n\nfunction useCombineActivators(sensors, getSyntheticHandler) {\n return useMemo(() => sensors.reduce((accumulator, sensor) => {\n const {\n sensor: Sensor\n } = sensor;\n const sensorActivators = Sensor.activators.map(activator => ({\n eventName: activator.eventName,\n handler: getSyntheticHandler(activator.handler, sensor)\n }));\n return [...accumulator, ...sensorActivators];\n }, []), [sensors, getSyntheticHandler]);\n}\n\nvar MeasuringStrategy;\n\n(function (MeasuringStrategy) {\n MeasuringStrategy[MeasuringStrategy[\"Always\"] = 0] = \"Always\";\n MeasuringStrategy[MeasuringStrategy[\"BeforeDragging\"] = 1] = \"BeforeDragging\";\n MeasuringStrategy[MeasuringStrategy[\"WhileDragging\"] = 2] = \"WhileDragging\";\n})(MeasuringStrategy || (MeasuringStrategy = {}));\n\nvar MeasuringFrequency;\n\n(function (MeasuringFrequency) {\n MeasuringFrequency[\"Optimized\"] = \"optimized\";\n})(MeasuringFrequency || (MeasuringFrequency = {}));\n\nconst defaultValue = /*#__PURE__*/new Map();\nfunction useDroppableMeasuring(containers, _ref) {\n let {\n dragging,\n dependencies,\n config\n } = _ref;\n const [queue, setQueue] = useState(null);\n const {\n frequency,\n measure,\n strategy\n } = config;\n const containersRef = useRef(containers);\n const disabled = isDisabled();\n const disabledRef = useLatestValue(disabled);\n const measureDroppableContainers = useCallback(function (ids) {\n if (ids === void 0) {\n ids = [];\n }\n\n if (disabledRef.current) {\n return;\n }\n\n setQueue(value => {\n if (value === null) {\n return ids;\n }\n\n return value.concat(ids.filter(id => !value.includes(id)));\n });\n }, [disabledRef]);\n const timeoutId = useRef(null);\n const droppableRects = useLazyMemo(previousValue => {\n if (disabled && !dragging) {\n return defaultValue;\n }\n\n if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {\n const map = new Map();\n\n for (let container of containers) {\n if (!container) {\n continue;\n }\n\n if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {\n // This container does not need to be re-measured\n map.set(container.id, container.rect.current);\n continue;\n }\n\n const node = container.node.current;\n const rect = node ? new Rect(measure(node), node) : null;\n container.rect.current = rect;\n\n if (rect) {\n map.set(container.id, rect);\n }\n }\n\n return map;\n }\n\n return previousValue;\n }, [containers, queue, dragging, disabled, measure]);\n useEffect(() => {\n containersRef.current = containers;\n }, [containers]);\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n measureDroppableContainers();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [dragging, disabled]);\n useEffect(() => {\n if (queue && queue.length > 0) {\n setQueue(null);\n }\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(queue)]);\n useEffect(() => {\n if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) {\n return;\n }\n\n timeoutId.current = setTimeout(() => {\n measureDroppableContainers();\n timeoutId.current = null;\n }, frequency);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [frequency, disabled, measureDroppableContainers, ...dependencies]);\n return {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled: queue != null\n };\n\n function isDisabled() {\n switch (strategy) {\n case MeasuringStrategy.Always:\n return false;\n\n case MeasuringStrategy.BeforeDragging:\n return dragging;\n\n default:\n return !dragging;\n }\n }\n}\n\nfunction useInitialValue(value, computeFn) {\n return useLazyMemo(previousValue => {\n if (!value) {\n return null;\n }\n\n if (previousValue) {\n return previousValue;\n }\n\n return typeof computeFn === 'function' ? computeFn(value) : value;\n }, [computeFn, value]);\n}\n\nfunction useInitialRect(node, measure) {\n return useInitialValue(node, measure);\n}\n\n/**\r\n * Returns a new MutationObserver instance.\r\n * If `MutationObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useMutationObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleMutations = useEvent(callback);\n const mutationObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') {\n return undefined;\n }\n\n const {\n MutationObserver\n } = window;\n return new MutationObserver(handleMutations);\n }, [handleMutations, disabled]);\n useEffect(() => {\n return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }, [mutationObserver]);\n return mutationObserver;\n}\n\n/**\r\n * Returns a new ResizeObserver instance bound to the `onResize` callback.\r\n * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useResizeObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleResize = useEvent(callback);\n const resizeObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const {\n ResizeObserver\n } = window;\n return new ResizeObserver(handleResize);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [disabled]);\n useEffect(() => {\n return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();\n }, [resizeObserver]);\n return resizeObserver;\n}\n\nfunction defaultMeasure(element) {\n return new Rect(getClientRect(element), element);\n}\n\nfunction useRect(element, measure, fallbackRect) {\n if (measure === void 0) {\n measure = defaultMeasure;\n }\n\n const [rect, setRect] = useState(null);\n\n function measureRect() {\n setRect(currentRect => {\n if (!element) {\n return null;\n }\n\n if (element.isConnected === false) {\n var _ref;\n\n // Fall back to last rect we measured if the element is\n // no longer connected to the DOM.\n return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;\n }\n\n const newRect = measure(element);\n\n if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {\n return currentRect;\n }\n\n return newRect;\n });\n }\n\n const mutationObserver = useMutationObserver({\n callback(records) {\n if (!element) {\n return;\n }\n\n for (const record of records) {\n const {\n type,\n target\n } = record;\n\n if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) {\n measureRect();\n break;\n }\n }\n }\n\n });\n const resizeObserver = useResizeObserver({\n callback: measureRect\n });\n useIsomorphicLayoutEffect(() => {\n measureRect();\n\n if (element) {\n resizeObserver == null ? void 0 : resizeObserver.observe(element);\n mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {\n childList: true,\n subtree: true\n });\n } else {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }\n }, [element]);\n return rect;\n}\n\nfunction useRectDelta(rect) {\n const initialRect = useInitialValue(rect);\n return getRectDelta(rect, initialRect);\n}\n\nconst defaultValue$1 = [];\nfunction useScrollableAncestors(node) {\n const previousNode = useRef(node);\n const ancestors = useLazyMemo(previousValue => {\n if (!node) {\n return defaultValue$1;\n }\n\n if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {\n return previousValue;\n }\n\n return getScrollableAncestors(node);\n }, [node]);\n useEffect(() => {\n previousNode.current = node;\n }, [node]);\n return ancestors;\n}\n\nfunction useScrollOffsets(elements) {\n const [scrollCoordinates, setScrollCoordinates] = useState(null);\n const prevElements = useRef(elements); // To-do: Throttle the handleScroll callback\n\n const handleScroll = useCallback(event => {\n const scrollingElement = getScrollableElement(event.target);\n\n if (!scrollingElement) {\n return;\n }\n\n setScrollCoordinates(scrollCoordinates => {\n if (!scrollCoordinates) {\n return null;\n }\n\n scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));\n return new Map(scrollCoordinates);\n });\n }, []);\n useEffect(() => {\n const previousElements = prevElements.current;\n\n if (elements !== previousElements) {\n cleanup(previousElements);\n const entries = elements.map(element => {\n const scrollableElement = getScrollableElement(element);\n\n if (scrollableElement) {\n scrollableElement.addEventListener('scroll', handleScroll, {\n passive: true\n });\n return [scrollableElement, getScrollCoordinates(scrollableElement)];\n }\n\n return null;\n }).filter(entry => entry != null);\n setScrollCoordinates(entries.length ? new Map(entries) : null);\n prevElements.current = elements;\n }\n\n return () => {\n cleanup(elements);\n cleanup(previousElements);\n };\n\n function cleanup(elements) {\n elements.forEach(element => {\n const scrollableElement = getScrollableElement(element);\n scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll);\n });\n }\n }, [handleScroll, elements]);\n return useMemo(() => {\n if (elements.length) {\n return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);\n }\n\n return defaultCoordinates;\n }, [elements, scrollCoordinates]);\n}\n\nfunction useScrollOffsetsDelta(scrollOffsets, dependencies) {\n if (dependencies === void 0) {\n dependencies = [];\n }\n\n const initialScrollOffsets = useRef(null);\n useEffect(() => {\n initialScrollOffsets.current = null;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n dependencies);\n useEffect(() => {\n const hasScrollOffsets = scrollOffsets !== defaultCoordinates;\n\n if (hasScrollOffsets && !initialScrollOffsets.current) {\n initialScrollOffsets.current = scrollOffsets;\n }\n\n if (!hasScrollOffsets && initialScrollOffsets.current) {\n initialScrollOffsets.current = null;\n }\n }, [scrollOffsets]);\n return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;\n}\n\nfunction useSensorSetup(sensors) {\n useEffect(() => {\n if (!canUseDOM) {\n return;\n }\n\n const teardownFns = sensors.map(_ref => {\n let {\n sensor\n } = _ref;\n return sensor.setup == null ? void 0 : sensor.setup();\n });\n return () => {\n for (const teardown of teardownFns) {\n teardown == null ? void 0 : teardown();\n }\n };\n }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency\n // eslint-disable-next-line react-hooks/exhaustive-deps\n sensors.map(_ref2 => {\n let {\n sensor\n } = _ref2;\n return sensor;\n }));\n}\n\nfunction useSyntheticListeners(listeners, id) {\n return useMemo(() => {\n return listeners.reduce((acc, _ref) => {\n let {\n eventName,\n handler\n } = _ref;\n\n acc[eventName] = event => {\n handler(event, id);\n };\n\n return acc;\n }, {});\n }, [listeners, id]);\n}\n\nfunction useWindowRect(element) {\n return useMemo(() => element ? getWindowClientRect(element) : null, [element]);\n}\n\nconst defaultValue$2 = [];\nfunction useRects(elements, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n const [firstElement] = elements;\n const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);\n const [rects, setRects] = useState(defaultValue$2);\n\n function measureRects() {\n setRects(() => {\n if (!elements.length) {\n return defaultValue$2;\n }\n\n return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));\n });\n }\n\n const resizeObserver = useResizeObserver({\n callback: measureRects\n });\n useIsomorphicLayoutEffect(() => {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n measureRects();\n elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));\n }, [elements]);\n return rects;\n}\n\nfunction getMeasurableNode(node) {\n if (!node) {\n return null;\n }\n\n if (node.children.length > 1) {\n return node;\n }\n\n const firstChild = node.children[0];\n return isHTMLElement(firstChild) ? firstChild : node;\n}\n\nfunction useDragOverlayMeasuring(_ref) {\n let {\n measure\n } = _ref;\n const [rect, setRect] = useState(null);\n const handleResize = useCallback(entries => {\n for (const {\n target\n } of entries) {\n if (isHTMLElement(target)) {\n setRect(rect => {\n const newRect = measure(target);\n return rect ? { ...rect,\n width: newRect.width,\n height: newRect.height\n } : newRect;\n });\n break;\n }\n }\n }, [measure]);\n const resizeObserver = useResizeObserver({\n callback: handleResize\n });\n const handleNodeChange = useCallback(element => {\n const node = getMeasurableNode(element);\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n\n if (node) {\n resizeObserver == null ? void 0 : resizeObserver.observe(node);\n }\n\n setRect(node ? measure(node) : null);\n }, [measure, resizeObserver]);\n const [nodeRef, setRef] = useNodeRef(handleNodeChange);\n return useMemo(() => ({\n nodeRef,\n rect,\n setRef\n }), [rect, nodeRef, setRef]);\n}\n\nconst defaultSensors = [{\n sensor: PointerSensor,\n options: {}\n}, {\n sensor: KeyboardSensor,\n options: {}\n}];\nconst defaultData = {\n current: {}\n};\nconst defaultMeasuringConfiguration = {\n draggable: {\n measure: getTransformAgnosticClientRect\n },\n droppable: {\n measure: getTransformAgnosticClientRect,\n strategy: MeasuringStrategy.WhileDragging,\n frequency: MeasuringFrequency.Optimized\n },\n dragOverlay: {\n measure: getClientRect\n }\n};\n\nclass DroppableContainersMap extends Map {\n get(id) {\n var _super$get;\n\n return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined;\n }\n\n toArray() {\n return Array.from(this.values());\n }\n\n getEnabled() {\n return this.toArray().filter(_ref => {\n let {\n disabled\n } = _ref;\n return !disabled;\n });\n }\n\n getNodeFor(id) {\n var _this$get$node$curren, _this$get;\n\n return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined;\n }\n\n}\n\nconst defaultPublicContext = {\n activatorEvent: null,\n active: null,\n activeNode: null,\n activeNodeRect: null,\n collisions: null,\n containerNodeRect: null,\n draggableNodes: /*#__PURE__*/new Map(),\n droppableRects: /*#__PURE__*/new Map(),\n droppableContainers: /*#__PURE__*/new DroppableContainersMap(),\n over: null,\n dragOverlay: {\n nodeRef: {\n current: null\n },\n rect: null,\n setRef: noop\n },\n scrollableAncestors: [],\n scrollableAncestorRects: [],\n measuringConfiguration: defaultMeasuringConfiguration,\n measureDroppableContainers: noop,\n windowRect: null,\n measuringScheduled: false\n};\nconst defaultInternalContext = {\n activatorEvent: null,\n activators: [],\n active: null,\n activeNodeRect: null,\n ariaDescribedById: {\n draggable: ''\n },\n dispatch: noop,\n draggableNodes: /*#__PURE__*/new Map(),\n over: null,\n measureDroppableContainers: noop\n};\nconst InternalContext = /*#__PURE__*/createContext(defaultInternalContext);\nconst PublicContext = /*#__PURE__*/createContext(defaultPublicContext);\n\nfunction getInitialState() {\n return {\n draggable: {\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n nodes: new Map(),\n translate: {\n x: 0,\n y: 0\n }\n },\n droppable: {\n containers: new DroppableContainersMap()\n }\n };\n}\nfunction reducer(state, action) {\n switch (action.type) {\n case Action.DragStart:\n return { ...state,\n draggable: { ...state.draggable,\n initialCoordinates: action.initialCoordinates,\n active: action.active\n }\n };\n\n case Action.DragMove:\n if (state.draggable.active == null) {\n return state;\n }\n\n return { ...state,\n draggable: { ...state.draggable,\n translate: {\n x: action.coordinates.x - state.draggable.initialCoordinates.x,\n y: action.coordinates.y - state.draggable.initialCoordinates.y\n }\n }\n };\n\n case Action.DragEnd:\n case Action.DragCancel:\n return { ...state,\n draggable: { ...state.draggable,\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n translate: {\n x: 0,\n y: 0\n }\n }\n };\n\n case Action.RegisterDroppable:\n {\n const {\n element\n } = action;\n const {\n id\n } = element;\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, element);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.SetDroppableDisabled:\n {\n const {\n id,\n key,\n disabled\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, { ...element,\n disabled\n });\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.UnregisterDroppable:\n {\n const {\n id,\n key\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.delete(id);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n default:\n {\n return state;\n }\n }\n}\n\nfunction RestoreFocus(_ref) {\n let {\n disabled\n } = _ref;\n const {\n active,\n activatorEvent,\n draggableNodes\n } = useContext(InternalContext);\n const previousActivatorEvent = usePrevious(activatorEvent);\n const previousActiveId = usePrevious(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {\n if (!isKeyboardEvent(previousActivatorEvent)) {\n return;\n }\n\n if (document.activeElement === previousActivatorEvent.target) {\n // No need to restore focus\n return;\n }\n\n const draggableNode = draggableNodes.get(previousActiveId);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n activatorNode,\n node\n } = draggableNode;\n\n if (!activatorNode.current && !node.current) {\n return;\n }\n\n requestAnimationFrame(() => {\n for (const element of [activatorNode.current, node.current]) {\n if (!element) {\n continue;\n }\n\n const focusableNode = findFirstFocusableNode(element);\n\n if (focusableNode) {\n focusableNode.focus();\n break;\n }\n }\n });\n }\n }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);\n return null;\n}\n\nfunction applyModifiers(modifiers, _ref) {\n let {\n transform,\n ...args\n } = _ref;\n return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {\n return modifier({\n transform: accumulator,\n ...args\n });\n }, transform) : transform;\n}\n\nfunction useMeasuringConfiguration(config) {\n return useMemo(() => ({\n draggable: { ...defaultMeasuringConfiguration.draggable,\n ...(config == null ? void 0 : config.draggable)\n },\n droppable: { ...defaultMeasuringConfiguration.droppable,\n ...(config == null ? void 0 : config.droppable)\n },\n dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay,\n ...(config == null ? void 0 : config.dragOverlay)\n }\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]);\n}\n\nfunction useLayoutShiftScrollCompensation(_ref) {\n let {\n activeNode,\n measure,\n initialRect,\n config = true\n } = _ref;\n const initialized = useRef(false);\n const {\n x,\n y\n } = typeof config === 'boolean' ? {\n x: config,\n y: config\n } : config;\n useIsomorphicLayoutEffect(() => {\n const disabled = !x && !y;\n\n if (disabled || !activeNode) {\n initialized.current = false;\n return;\n }\n\n if (initialized.current || !initialRect) {\n // Return early if layout shift scroll compensation was already attempted\n // or if there is no initialRect to compare to.\n return;\n } // Get the most up to date node ref for the active draggable\n\n\n const node = activeNode == null ? void 0 : activeNode.node.current;\n\n if (!node || node.isConnected === false) {\n // Return early if there is no attached node ref or if the node is\n // disconnected from the document.\n return;\n }\n\n const rect = measure(node);\n const rectDelta = getRectDelta(rect, initialRect);\n\n if (!x) {\n rectDelta.x = 0;\n }\n\n if (!y) {\n rectDelta.y = 0;\n } // Only perform layout shift scroll compensation once\n\n\n initialized.current = true;\n\n if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {\n const firstScrollableAncestor = getFirstScrollableAncestor(node);\n\n if (firstScrollableAncestor) {\n firstScrollableAncestor.scrollBy({\n top: rectDelta.y,\n left: rectDelta.x\n });\n }\n }\n }, [activeNode, x, y, initialRect, measure]);\n}\n\nconst ActiveDraggableContext = /*#__PURE__*/createContext({ ...defaultCoordinates,\n scaleX: 1,\n scaleY: 1\n});\nvar Status;\n\n(function (Status) {\n Status[Status[\"Uninitialized\"] = 0] = \"Uninitialized\";\n Status[Status[\"Initializing\"] = 1] = \"Initializing\";\n Status[Status[\"Initialized\"] = 2] = \"Initialized\";\n})(Status || (Status = {}));\n\nconst DndContext = /*#__PURE__*/memo(function DndContext(_ref) {\n var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;\n\n let {\n id,\n accessibility,\n autoScroll = true,\n children,\n sensors = defaultSensors,\n collisionDetection = rectIntersection,\n measuring,\n modifiers,\n ...props\n } = _ref;\n const store = useReducer(reducer, undefined, getInitialState);\n const [state, dispatch] = store;\n const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();\n const [status, setStatus] = useState(Status.Uninitialized);\n const isInitialized = status === Status.Initialized;\n const {\n draggable: {\n active: activeId,\n nodes: draggableNodes,\n translate\n },\n droppable: {\n containers: droppableContainers\n }\n } = state;\n const node = activeId != null ? draggableNodes.get(activeId) : null;\n const activeRects = useRef({\n initial: null,\n translated: null\n });\n const active = useMemo(() => {\n var _node$data;\n\n return activeId != null ? {\n id: activeId,\n // It's possible for the active node to unmount while dragging\n data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,\n rect: activeRects\n } : null;\n }, [activeId, node]);\n const activeRef = useRef(null);\n const [activeSensor, setActiveSensor] = useState(null);\n const [activatorEvent, setActivatorEvent] = useState(null);\n const latestProps = useLatestValue(props, Object.values(props));\n const draggableDescribedById = useUniqueId(\"DndDescribedBy\", id);\n const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);\n const measuringConfiguration = useMeasuringConfiguration(measuring);\n const {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled\n } = useDroppableMeasuring(enabledDroppableContainers, {\n dragging: isInitialized,\n dependencies: [translate.x, translate.y],\n config: measuringConfiguration.droppable\n });\n const activeNode = useCachedNode(draggableNodes, activeId);\n const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);\n const autoScrollOptions = getAutoScrollerOptions();\n const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);\n useLayoutShiftScrollCompensation({\n activeNode: activeId != null ? draggableNodes.get(activeId) : null,\n config: autoScrollOptions.layoutShiftCompensation,\n initialRect: initialActiveNodeRect,\n measure: measuringConfiguration.draggable.measure\n });\n const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);\n const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);\n const sensorContext = useRef({\n activatorEvent: null,\n active: null,\n activeNode,\n collisionRect: null,\n collisions: null,\n droppableRects,\n draggableNodes,\n draggingNode: null,\n draggingNodeRect: null,\n droppableContainers,\n over: null,\n scrollableAncestors: [],\n scrollAdjustedTranslate: null\n });\n const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);\n const dragOverlay = useDragOverlayMeasuring({\n measure: measuringConfiguration.dragOverlay.measure\n }); // Use the rect of the drag overlay if it is mounted\n\n const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;\n const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;\n const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node\n // is only relevant when there is no drag overlay\n\n const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node\n\n const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); // Get scrollable ancestors of the dragging node\n\n const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);\n const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers\n\n const modifiedTranslate = applyModifiers(modifiers, {\n transform: {\n x: translate.x - nodeRectDelta.x,\n y: translate.y - nodeRectDelta.y,\n scaleX: 1,\n scaleY: 1\n },\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect,\n over: sensorContext.current.over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n });\n const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;\n const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated\n\n const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured\n\n const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);\n const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);\n const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;\n const collisions = active && collisionRect ? collisionDetection({\n active,\n collisionRect,\n droppableRects,\n droppableContainers: enabledDroppableContainers,\n pointerCoordinates\n }) : null;\n const overId = getFirstCollision(collisions, 'id');\n const [over, setOver] = useState(null); // When there is no drag overlay used, we need to account for the\n // window scroll delta\n\n const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);\n const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);\n const activeSensorRef = useRef(null);\n const instantiateSensor = useCallback((event, _ref2) => {\n let {\n sensor: Sensor,\n options\n } = _ref2;\n\n if (activeRef.current == null) {\n return;\n }\n\n const activeNode = draggableNodes.get(activeRef.current);\n\n if (!activeNode) {\n return;\n }\n\n const activatorEvent = event.nativeEvent;\n const sensorInstance = new Sensor({\n active: activeRef.current,\n activeNode,\n event: activatorEvent,\n options,\n // Sensors need to be instantiated with refs for arguments that change over time\n // otherwise they are frozen in time with the stale arguments\n context: sensorContext,\n\n onAbort(id) {\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragAbort\n } = latestProps.current;\n const event = {\n id\n };\n onDragAbort == null ? void 0 : onDragAbort(event);\n dispatchMonitorEvent({\n type: 'onDragAbort',\n event\n });\n },\n\n onPending(id, constraint, initialCoordinates, offset) {\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragPending\n } = latestProps.current;\n const event = {\n id,\n constraint,\n initialCoordinates,\n offset\n };\n onDragPending == null ? void 0 : onDragPending(event);\n dispatchMonitorEvent({\n type: 'onDragPending',\n event\n });\n },\n\n onStart(initialCoordinates) {\n const id = activeRef.current;\n\n if (id == null) {\n return;\n }\n\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragStart\n } = latestProps.current;\n const event = {\n activatorEvent,\n active: {\n id,\n data: draggableNode.data,\n rect: activeRects\n }\n };\n unstable_batchedUpdates(() => {\n onDragStart == null ? void 0 : onDragStart(event);\n setStatus(Status.Initializing);\n dispatch({\n type: Action.DragStart,\n initialCoordinates,\n active: id\n });\n dispatchMonitorEvent({\n type: 'onDragStart',\n event\n });\n setActiveSensor(activeSensorRef.current);\n setActivatorEvent(activatorEvent);\n });\n },\n\n onMove(coordinates) {\n dispatch({\n type: Action.DragMove,\n coordinates\n });\n },\n\n onEnd: createHandler(Action.DragEnd),\n onCancel: createHandler(Action.DragCancel)\n });\n activeSensorRef.current = sensorInstance;\n\n function createHandler(type) {\n return async function handler() {\n const {\n active,\n collisions,\n over,\n scrollAdjustedTranslate\n } = sensorContext.current;\n let event = null;\n\n if (active && scrollAdjustedTranslate) {\n const {\n cancelDrop\n } = latestProps.current;\n event = {\n activatorEvent,\n active: active,\n collisions,\n delta: scrollAdjustedTranslate,\n over\n };\n\n if (type === Action.DragEnd && typeof cancelDrop === 'function') {\n const shouldCancel = await Promise.resolve(cancelDrop(event));\n\n if (shouldCancel) {\n type = Action.DragCancel;\n }\n }\n }\n\n activeRef.current = null;\n unstable_batchedUpdates(() => {\n dispatch({\n type\n });\n setStatus(Status.Uninitialized);\n setOver(null);\n setActiveSensor(null);\n setActivatorEvent(null);\n activeSensorRef.current = null;\n const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';\n\n if (event) {\n const handler = latestProps.current[eventName];\n handler == null ? void 0 : handler(event);\n dispatchMonitorEvent({\n type: eventName,\n event\n });\n }\n });\n };\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes]);\n const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {\n return (event, active) => {\n const nativeEvent = event.nativeEvent;\n const activeDraggableNode = draggableNodes.get(active);\n\n if ( // Another sensor is already instantiating\n activeRef.current !== null || // No active draggable\n !activeDraggableNode || // Event has already been captured\n nativeEvent.dndKit || nativeEvent.defaultPrevented) {\n return;\n }\n\n const activationContext = {\n active: activeDraggableNode\n };\n const shouldActivate = handler(event, sensor.options, activationContext);\n\n if (shouldActivate === true) {\n nativeEvent.dndKit = {\n capturedBy: sensor.sensor\n };\n activeRef.current = active;\n instantiateSensor(event, sensor);\n }\n };\n }, [draggableNodes, instantiateSensor]);\n const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);\n useSensorSetup(sensors);\n useIsomorphicLayoutEffect(() => {\n if (activeNodeRect && status === Status.Initializing) {\n setStatus(Status.Initialized);\n }\n }, [activeNodeRect, status]);\n useEffect(() => {\n const {\n onDragMove\n } = latestProps.current;\n const {\n active,\n activatorEvent,\n collisions,\n over\n } = sensorContext.current;\n\n if (!active || !activatorEvent) {\n return;\n }\n\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n onDragMove == null ? void 0 : onDragMove(event);\n dispatchMonitorEvent({\n type: 'onDragMove',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]);\n useEffect(() => {\n const {\n active,\n activatorEvent,\n collisions,\n droppableContainers,\n scrollAdjustedTranslate\n } = sensorContext.current;\n\n if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) {\n return;\n }\n\n const {\n onDragOver\n } = latestProps.current;\n const overContainer = droppableContainers.get(overId);\n const over = overContainer && overContainer.rect.current ? {\n id: overContainer.id,\n rect: overContainer.rect.current,\n data: overContainer.data,\n disabled: overContainer.disabled\n } : null;\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n setOver(over);\n onDragOver == null ? void 0 : onDragOver(event);\n dispatchMonitorEvent({\n type: 'onDragOver',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [overId]);\n useIsomorphicLayoutEffect(() => {\n sensorContext.current = {\n activatorEvent,\n active,\n activeNode,\n collisionRect,\n collisions,\n droppableRects,\n draggableNodes,\n draggingNode,\n draggingNodeRect,\n droppableContainers,\n over,\n scrollableAncestors,\n scrollAdjustedTranslate\n };\n activeRects.current = {\n initial: draggingNodeRect,\n translated: collisionRect\n };\n }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);\n useAutoScroller({ ...autoScrollOptions,\n delta: translate,\n draggingRect: collisionRect,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects\n });\n const publicContext = useMemo(() => {\n const context = {\n active,\n activeNode,\n activeNodeRect,\n activatorEvent,\n collisions,\n containerNodeRect,\n dragOverlay,\n draggableNodes,\n droppableContainers,\n droppableRects,\n over,\n measureDroppableContainers,\n scrollableAncestors,\n scrollableAncestorRects,\n measuringConfiguration,\n measuringScheduled,\n windowRect\n };\n return context;\n }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);\n const internalContext = useMemo(() => {\n const context = {\n activatorEvent,\n activators,\n active,\n activeNodeRect,\n ariaDescribedById: {\n draggable: draggableDescribedById\n },\n dispatch,\n draggableNodes,\n over,\n measureDroppableContainers\n };\n return context;\n }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);\n return React.createElement(DndMonitorContext.Provider, {\n value: registerMonitorListener\n }, React.createElement(InternalContext.Provider, {\n value: internalContext\n }, React.createElement(PublicContext.Provider, {\n value: publicContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: transform\n }, children)), React.createElement(RestoreFocus, {\n disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false\n })), React.createElement(Accessibility, { ...accessibility,\n hiddenTextDescribedById: draggableDescribedById\n }));\n\n function getAutoScrollerOptions() {\n const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;\n const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false;\n const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;\n\n if (typeof autoScroll === 'object') {\n return { ...autoScroll,\n enabled\n };\n }\n\n return {\n enabled\n };\n }\n});\n\nconst NullContext = /*#__PURE__*/createContext(null);\nconst defaultRole = 'button';\nconst ID_PREFIX = 'Draggable';\nfunction useDraggable(_ref) {\n let {\n id,\n data,\n disabled = false,\n attributes\n } = _ref;\n const key = useUniqueId(ID_PREFIX);\n const {\n activators,\n activatorEvent,\n active,\n activeNodeRect,\n ariaDescribedById,\n draggableNodes,\n over\n } = useContext(InternalContext);\n const {\n role = defaultRole,\n roleDescription = 'draggable',\n tabIndex = 0\n } = attributes != null ? attributes : {};\n const isDragging = (active == null ? void 0 : active.id) === id;\n const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);\n const [node, setNodeRef] = useNodeRef();\n const [activatorNode, setActivatorNodeRef] = useNodeRef();\n const listeners = useSyntheticListeners(activators, id);\n const dataRef = useLatestValue(data);\n useIsomorphicLayoutEffect(() => {\n draggableNodes.set(id, {\n id,\n key,\n node,\n activatorNode,\n data: dataRef\n });\n return () => {\n const node = draggableNodes.get(id);\n\n if (node && node.key === key) {\n draggableNodes.delete(id);\n }\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes, id]);\n const memoizedAttributes = useMemo(() => ({\n role,\n tabIndex,\n 'aria-disabled': disabled,\n 'aria-pressed': isDragging && role === defaultRole ? true : undefined,\n 'aria-roledescription': roleDescription,\n 'aria-describedby': ariaDescribedById.draggable\n }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);\n return {\n active,\n activatorEvent,\n activeNodeRect,\n attributes: memoizedAttributes,\n isDragging,\n listeners: disabled ? undefined : listeners,\n node,\n over,\n setNodeRef,\n setActivatorNodeRef,\n transform\n };\n}\n\nfunction useDndContext() {\n return useContext(PublicContext);\n}\n\nconst ID_PREFIX$1 = 'Droppable';\nconst defaultResizeObserverConfig = {\n timeout: 25\n};\nfunction useDroppable(_ref) {\n let {\n data,\n disabled = false,\n id,\n resizeObserverConfig\n } = _ref;\n const key = useUniqueId(ID_PREFIX$1);\n const {\n active,\n dispatch,\n over,\n measureDroppableContainers\n } = useContext(InternalContext);\n const previous = useRef({\n disabled\n });\n const resizeObserverConnected = useRef(false);\n const rect = useRef(null);\n const callbackId = useRef(null);\n const {\n disabled: resizeObserverDisabled,\n updateMeasurementsFor,\n timeout: resizeObserverTimeout\n } = { ...defaultResizeObserverConfig,\n ...resizeObserverConfig\n };\n const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);\n const handleResize = useCallback(() => {\n if (!resizeObserverConnected.current) {\n // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called,\n // assuming the element is rendered and displayed.\n resizeObserverConnected.current = true;\n return;\n }\n\n if (callbackId.current != null) {\n clearTimeout(callbackId.current);\n }\n\n callbackId.current = setTimeout(() => {\n measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);\n callbackId.current = null;\n }, resizeObserverTimeout);\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [resizeObserverTimeout]);\n const resizeObserver = useResizeObserver({\n callback: handleResize,\n disabled: resizeObserverDisabled || !active\n });\n const handleNodeChange = useCallback((newElement, previousElement) => {\n if (!resizeObserver) {\n return;\n }\n\n if (previousElement) {\n resizeObserver.unobserve(previousElement);\n resizeObserverConnected.current = false;\n }\n\n if (newElement) {\n resizeObserver.observe(newElement);\n }\n }, [resizeObserver]);\n const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);\n const dataRef = useLatestValue(data);\n useEffect(() => {\n if (!resizeObserver || !nodeRef.current) {\n return;\n }\n\n resizeObserver.disconnect();\n resizeObserverConnected.current = false;\n resizeObserver.observe(nodeRef.current);\n }, [nodeRef, resizeObserver]);\n useEffect(() => {\n dispatch({\n type: Action.RegisterDroppable,\n element: {\n id,\n key,\n disabled,\n node: nodeRef,\n rect,\n data: dataRef\n }\n });\n return () => dispatch({\n type: Action.UnregisterDroppable,\n key,\n id\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [id]);\n useEffect(() => {\n if (disabled !== previous.current.disabled) {\n dispatch({\n type: Action.SetDroppableDisabled,\n id,\n key,\n disabled\n });\n previous.current.disabled = disabled;\n }\n }, [id, key, disabled, dispatch]);\n return {\n active,\n rect,\n isOver: (over == null ? void 0 : over.id) === id,\n node: nodeRef,\n over,\n setNodeRef\n };\n}\n\nfunction AnimationManager(_ref) {\n let {\n animation,\n children\n } = _ref;\n const [clonedChildren, setClonedChildren] = useState(null);\n const [element, setElement] = useState(null);\n const previousChildren = usePrevious(children);\n\n if (!children && !clonedChildren && previousChildren) {\n setClonedChildren(previousChildren);\n }\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const key = clonedChildren == null ? void 0 : clonedChildren.key;\n const id = clonedChildren == null ? void 0 : clonedChildren.props.id;\n\n if (key == null || id == null) {\n setClonedChildren(null);\n return;\n }\n\n Promise.resolve(animation(id, element)).then(() => {\n setClonedChildren(null);\n });\n }, [animation, clonedChildren, element]);\n return React.createElement(React.Fragment, null, children, clonedChildren ? cloneElement(clonedChildren, {\n ref: setElement\n }) : null);\n}\n\nconst defaultTransform = {\n x: 0,\n y: 0,\n scaleX: 1,\n scaleY: 1\n};\nfunction NullifiedContextProvider(_ref) {\n let {\n children\n } = _ref;\n return React.createElement(InternalContext.Provider, {\n value: defaultInternalContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: defaultTransform\n }, children));\n}\n\nconst baseStyles = {\n position: 'fixed',\n touchAction: 'none'\n};\n\nconst defaultTransition = activatorEvent => {\n const isKeyboardActivator = isKeyboardEvent(activatorEvent);\n return isKeyboardActivator ? 'transform 250ms ease' : undefined;\n};\n\nconst PositionedOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {\n let {\n as,\n activatorEvent,\n adjustScale,\n children,\n className,\n rect,\n style,\n transform,\n transition = defaultTransition\n } = _ref;\n\n if (!rect) {\n return null;\n }\n\n const scaleAdjustedTransform = adjustScale ? transform : { ...transform,\n scaleX: 1,\n scaleY: 1\n };\n const styles = { ...baseStyles,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n left: rect.left,\n transform: CSS.Transform.toString(scaleAdjustedTransform),\n transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined,\n transition: typeof transition === 'function' ? transition(activatorEvent) : transition,\n ...style\n };\n return React.createElement(as, {\n className,\n style: styles,\n ref\n }, children);\n});\n\nconst defaultDropAnimationSideEffects = options => _ref => {\n let {\n active,\n dragOverlay\n } = _ref;\n const originalStyles = {};\n const {\n styles,\n className\n } = options;\n\n if (styles != null && styles.active) {\n for (const [key, value] of Object.entries(styles.active)) {\n if (value === undefined) {\n continue;\n }\n\n originalStyles[key] = active.node.style.getPropertyValue(key);\n active.node.style.setProperty(key, value);\n }\n }\n\n if (styles != null && styles.dragOverlay) {\n for (const [key, value] of Object.entries(styles.dragOverlay)) {\n if (value === undefined) {\n continue;\n }\n\n dragOverlay.node.style.setProperty(key, value);\n }\n }\n\n if (className != null && className.active) {\n active.node.classList.add(className.active);\n }\n\n if (className != null && className.dragOverlay) {\n dragOverlay.node.classList.add(className.dragOverlay);\n }\n\n return function cleanup() {\n for (const [key, value] of Object.entries(originalStyles)) {\n active.node.style.setProperty(key, value);\n }\n\n if (className != null && className.active) {\n active.node.classList.remove(className.active);\n }\n };\n};\n\nconst defaultKeyframeResolver = _ref2 => {\n let {\n transform: {\n initial,\n final\n }\n } = _ref2;\n return [{\n transform: CSS.Transform.toString(initial)\n }, {\n transform: CSS.Transform.toString(final)\n }];\n};\n\nconst defaultDropAnimationConfiguration = {\n duration: 250,\n easing: 'ease',\n keyframes: defaultKeyframeResolver,\n sideEffects: /*#__PURE__*/defaultDropAnimationSideEffects({\n styles: {\n active: {\n opacity: '0'\n }\n }\n })\n};\nfunction useDropAnimation(_ref3) {\n let {\n config,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n } = _ref3;\n return useEvent((id, node) => {\n if (config === null) {\n return;\n }\n\n const activeDraggable = draggableNodes.get(id);\n\n if (!activeDraggable) {\n return;\n }\n\n const activeNode = activeDraggable.node.current;\n\n if (!activeNode) {\n return;\n }\n\n const measurableNode = getMeasurableNode(node);\n\n if (!measurableNode) {\n return;\n }\n\n const {\n transform\n } = getWindow(node).getComputedStyle(node);\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return;\n }\n\n const animation = typeof config === 'function' ? config : createDefaultDropAnimation(config);\n scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure);\n return animation({\n active: {\n id,\n data: activeDraggable.data,\n node: activeNode,\n rect: measuringConfiguration.draggable.measure(activeNode)\n },\n draggableNodes,\n dragOverlay: {\n node,\n rect: measuringConfiguration.dragOverlay.measure(measurableNode)\n },\n droppableContainers,\n measuringConfiguration,\n transform: parsedTransform\n });\n });\n}\n\nfunction createDefaultDropAnimation(options) {\n const {\n duration,\n easing,\n sideEffects,\n keyframes\n } = { ...defaultDropAnimationConfiguration,\n ...options\n };\n return _ref4 => {\n let {\n active,\n dragOverlay,\n transform,\n ...rest\n } = _ref4;\n\n if (!duration) {\n // Do not animate if animation duration is zero.\n return;\n }\n\n const delta = {\n x: dragOverlay.rect.left - active.rect.left,\n y: dragOverlay.rect.top - active.rect.top\n };\n const scale = {\n scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1,\n scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1\n };\n const finalTransform = {\n x: transform.x - delta.x,\n y: transform.y - delta.y,\n ...scale\n };\n const animationKeyframes = keyframes({ ...rest,\n active,\n dragOverlay,\n transform: {\n initial: transform,\n final: finalTransform\n }\n });\n const [firstKeyframe] = animationKeyframes;\n const lastKeyframe = animationKeyframes[animationKeyframes.length - 1];\n\n if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) {\n // The start and end keyframes are the same, infer that there is no animation needed.\n return;\n }\n\n const cleanup = sideEffects == null ? void 0 : sideEffects({\n active,\n dragOverlay,\n ...rest\n });\n const animation = dragOverlay.node.animate(animationKeyframes, {\n duration,\n easing,\n fill: 'forwards'\n });\n return new Promise(resolve => {\n animation.onfinish = () => {\n cleanup == null ? void 0 : cleanup();\n resolve();\n };\n });\n };\n}\n\nlet key = 0;\nfunction useKey(id) {\n return useMemo(() => {\n if (id == null) {\n return;\n }\n\n key++;\n return key;\n }, [id]);\n}\n\nconst DragOverlay = /*#__PURE__*/React.memo(_ref => {\n let {\n adjustScale = false,\n children,\n dropAnimation: dropAnimationConfig,\n style,\n transition,\n modifiers,\n wrapperElement = 'div',\n className,\n zIndex = 999\n } = _ref;\n const {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggableNodes,\n droppableContainers,\n dragOverlay,\n over,\n measuringConfiguration,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n } = useDndContext();\n const transform = useContext(ActiveDraggableContext);\n const key = useKey(active == null ? void 0 : active.id);\n const modifiedTransform = applyModifiers(modifiers, {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect: dragOverlay.rect,\n over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n transform,\n windowRect\n });\n const initialRect = useInitialValue(activeNodeRect);\n const dropAnimation = useDropAnimation({\n config: dropAnimationConfig,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n }); // We need to wait for the active node to be measured before connecting the drag overlay ref\n // otherwise collisions can be computed against a mispositioned drag overlay\n\n const ref = initialRect ? dragOverlay.setRef : undefined;\n return React.createElement(NullifiedContextProvider, null, React.createElement(AnimationManager, {\n animation: dropAnimation\n }, active && key ? React.createElement(PositionedOverlay, {\n key: key,\n id: active.id,\n ref: ref,\n as: wrapperElement,\n activatorEvent: activatorEvent,\n adjustScale: adjustScale,\n className: className,\n transition: transition,\n rect: initialRect,\n style: {\n zIndex,\n ...style\n },\n transform: modifiedTransform\n }, children) : null));\n});\n\nexport { AutoScrollActivator, DndContext, DragOverlay, KeyboardCode, KeyboardSensor, MeasuringFrequency, MeasuringStrategy, MouseSensor, PointerSensor, TouchSensor, TraversalOrder, applyModifiers, closestCenter, closestCorners, defaultAnnouncements, defaultCoordinates, defaultDropAnimationConfiguration as defaultDropAnimation, defaultDropAnimationSideEffects, defaultKeyboardCoordinateGetter, defaultScreenReaderInstructions, getClientRect, getFirstCollision, getScrollableAncestors, pointerWithin, rectIntersection, useDndContext, useDndMonitor, useDraggable, useDroppable, useSensor, useSensors };\n//# sourceMappingURL=core.esm.js.map\n","import React, { useState, useCallback, ReactNode, useEffect } from 'react';\nimport {\n DndContext,\n DragEndEvent,\n DragStartEvent,\n DragMoveEvent,\n closestCenter,\n PointerSensor,\n useSensor,\n useSensors,\n useDroppable,\n useDraggable,\n} from '@dnd-kit/core';\nimport { ConfigurablePanelLayout, ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';\nimport { PanelLayout, PanelDefinition } from './PanelConfigurator';\nimport './EditablePanelLayout.css';\n\nexport interface EditableConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {\n /** Whether edit mode is enabled (controlled) */\n isEditMode: boolean;\n\n /** Callback when layout changes in edit mode */\n onLayoutChange?: (layout: PanelLayout) => void;\n\n /** Available panels for drag-and-drop */\n availablePanels?: PanelDefinition[];\n}\n\ntype SlotPosition = 'left' | 'middle' | 'right';\n\n\n// Slot Overlay Component for Edit Mode\ninterface SlotOverlayWrapperProps {\n slotPosition: SlotPosition;\n isEditing: boolean;\n isDragging: boolean;\n children: ReactNode;\n}\n\nconst SlotOverlayWrapper: React.FC<SlotOverlayWrapperProps> = ({\n slotPosition,\n isEditing,\n isDragging,\n children,\n}) => {\n const { attributes, listeners, setNodeRef: setDraggableRef, transform } = useDraggable({\n id: `slot-${slotPosition}`,\n data: { slotPosition },\n disabled: !isEditing,\n });\n\n const { setNodeRef: setDroppableRef, isOver } = useDroppable({\n id: `drop-${slotPosition}`,\n data: { slotPosition },\n });\n\n const style: React.CSSProperties = {\n position: 'relative',\n height: '100%',\n width: '100%',\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n };\n\n // Merge refs\n const setRefs = useCallback((node: HTMLDivElement | null) => {\n setDraggableRef(node);\n setDroppableRef(node);\n }, [setDraggableRef, setDroppableRef]);\n\n return (\n <div\n ref={setRefs}\n style={style}\n className={`slot-with-overlay ${isEditing ? 'edit-mode' : ''} ${isDragging ? 'dragging' : ''} ${isOver ? 'drag-over' : ''}`}\n >\n {children}\n {isEditing && (\n <div\n className=\"slot-edit-overlay\"\n {...attributes}\n {...listeners}\n >\n <div className=\"drag-indicator\">⋮⋮</div>\n <div className=\"slot-position-label\">{slotPosition.toUpperCase()}</div>\n </div>\n )}\n </div>\n );\n};\n\n/**\n * EditableConfigurablePanelLayout - Wrapper component that adds iPhone-style edit mode\n * Allows dragging entire slot sections (left/middle/right) to rearrange them\n */\nexport const EditableConfigurablePanelLayout: React.FC<EditableConfigurablePanelLayoutProps> = ({\n isEditMode,\n onLayoutChange,\n panels,\n layout,\n ...layoutProps\n}) => {\n const [activeSlot, setActiveSlot] = useState<SlotPosition | null>(null);\n const [dragOffset, setDragOffset] = useState<{ x: number; y: number }>({ x: 0, y: 0 });\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 8,\n },\n })\n );\n\n const handleDragStart = useCallback((event: DragStartEvent) => {\n const id = event.active.id as string;\n if (id.startsWith('slot-')) {\n const slotPosition = id.replace('slot-', '') as SlotPosition;\n setActiveSlot(slotPosition);\n setDragOffset({ x: 0, y: 0 });\n }\n }, []);\n\n const handleDragMove = useCallback((event: DragMoveEvent) => {\n const { delta } = event;\n setDragOffset({ x: delta.x, y: delta.y });\n }, []);\n\n const handleDragEnd = useCallback((event: DragEndEvent) => {\n const { active, over } = event;\n setActiveSlot(null);\n setDragOffset({ x: 0, y: 0 });\n\n if (!over) return;\n\n const activeId = active.id as string;\n const overId = over.id as string;\n\n // Extract slot positions\n const sourceSlot = activeId.replace('slot-', '') as SlotPosition;\n const targetSlot = overId.replace('drop-', '') as SlotPosition;\n\n if (sourceSlot === targetSlot) return;\n\n // Swap the slot contents\n const newLayout = { ...layout };\n const temp = newLayout[sourceSlot];\n newLayout[sourceSlot] = newLayout[targetSlot];\n newLayout[targetSlot] = temp;\n\n // Notify parent of layout change\n if (onLayoutChange) {\n onLayoutChange(newLayout);\n }\n }, [layout, onLayoutChange]);\n\n // Apply transforms to slots during drag\n useEffect(() => {\n if (!activeSlot || !isEditMode) return;\n\n const element = document.querySelector(`[data-slot=\"${activeSlot}\"]`) as HTMLElement;\n\n if (element) {\n // Mark as dragging\n element.setAttribute('data-dragging', 'true');\n\n // Apply transform with !important to override any existing transforms\n // Keep the scale(0.95) and add the translation\n element.style.setProperty('transform', `scale(0.95) translate(${dragOffset.x}px, ${dragOffset.y}px)`, 'important');\n element.style.setProperty('z-index', '1000', 'important');\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('opacity', '0.95', 'important');\n element.style.setProperty('box-shadow', '0 12px 24px rgba(0, 0, 0, 0.25)', 'important');\n }\n\n return () => {\n if (element) {\n element.removeAttribute('data-dragging');\n element.style.removeProperty('transform');\n element.style.removeProperty('z-index');\n element.style.removeProperty('transition');\n element.style.removeProperty('opacity');\n element.style.removeProperty('box-shadow');\n }\n };\n }, [activeSlot, dragOffset, isEditMode]);\n\n // Create data attributes for slot identification\n const slotDataAttributes = {\n left: { 'data-slot': 'left', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n middle: { 'data-slot': 'middle', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n right: { 'data-slot': 'right', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n };\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragMove={handleDragMove}\n onDragEnd={handleDragEnd}\n >\n <div className={`editable-panel-layout ${isEditMode ? 'edit-mode-active' : ''}`}>\n {/* Render layout with data attributes */}\n <ConfigurablePanelLayout\n {...layoutProps}\n panels={panels}\n layout={layout}\n slotDataAttributes={slotDataAttributes}\n />\n\n {/* Slot overlays for edit mode - provides draggable areas */}\n {isEditMode && (\n <SlotOverlays\n layout={layout}\n activeSlot={activeSlot}\n onDragStart={() => {}}\n onDragEnd={() => {}}\n />\n )}\n </div>\n </DndContext>\n );\n};\n\n// Slot Overlays Component - renders absolutely positioned overlays on top of slots\ninterface SlotOverlaysProps {\n layout: PanelLayout;\n activeSlot: SlotPosition | null;\n onDragStart: () => void;\n onDragEnd: () => void;\n}\n\nconst SlotOverlays: React.FC<SlotOverlaysProps> = ({ layout, activeSlot }) => {\n const [slotRects, setSlotRects] = useState<Map<SlotPosition, DOMRect>>(new Map());\n\n // Update slot positions\n React.useEffect(() => {\n const updatePositions = () => {\n const newRects = new Map<SlotPosition, DOMRect>();\n\n (['left', 'middle', 'right'] as SlotPosition[]).forEach(slot => {\n const element = document.querySelector(`[data-slot=\"${slot}\"]`);\n if (element) {\n const rect = element.getBoundingClientRect();\n newRects.set(slot, rect);\n }\n });\n\n setSlotRects(newRects);\n };\n\n updatePositions();\n\n // Update on resize\n window.addEventListener('resize', updatePositions);\n const interval = setInterval(updatePositions, 100); // Poll for changes\n\n return () => {\n window.removeEventListener('resize', updatePositions);\n clearInterval(interval);\n };\n }, [layout]);\n\n return (\n <div style={{ pointerEvents: 'none', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 999 }}>\n {(['left', 'middle', 'right'] as SlotPosition[]).map(slotPosition => {\n const slot = layout[slotPosition];\n if (!slot) return null;\n\n const rect = slotRects.get(slotPosition);\n if (!rect) return null;\n\n const isDragging = activeSlot === slotPosition;\n\n return (\n <div\n key={slotPosition}\n style={{\n position: 'fixed',\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height,\n pointerEvents: 'auto',\n }}\n >\n <SlotOverlayWrapper\n slotPosition={slotPosition}\n isEditing={true}\n isDragging={isDragging}\n >\n <div style={{ height: '100%' }} />\n </SlotOverlayWrapper>\n </div>\n );\n })}\n </div>\n );\n};\n","// src/glassmorphismTheme.ts\nvar glassmorphismTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.4,\n relaxed: 1.8\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 8, 12, 16, 20, 24, 32, 40],\n shadows: [\n \"none\",\n \"0 8px 32px 0 rgba(31, 38, 135, 0.15)\",\n \"0 12px 40px 0 rgba(31, 38, 135, 0.2)\",\n \"0 16px 48px 0 rgba(31, 38, 135, 0.25)\",\n \"0 20px 56px 0 rgba(31, 38, 135, 0.3)\",\n \"0 24px 64px 0 rgba(31, 38, 135, 0.35)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"rgba(255, 255, 255, 0.95)\",\n background: \"rgba(255, 255, 255, 0.1)\",\n primary: \"rgba(99, 102, 241, 0.9)\",\n secondary: \"rgba(139, 92, 246, 0.9)\",\n accent: \"rgba(236, 72, 153, 0.9)\",\n highlight: \"rgba(99, 102, 241, 0.2)\",\n muted: \"rgba(255, 255, 255, 0.05)\",\n success: \"rgba(34, 197, 94, 0.9)\",\n warning: \"rgba(251, 146, 60, 0.9)\",\n error: \"rgba(239, 68, 68, 0.9)\",\n info: \"rgba(59, 130, 246, 0.9)\",\n border: \"rgba(255, 255, 255, 0.18)\",\n backgroundSecondary: \"rgba(255, 255, 255, 0.15)\",\n backgroundTertiary: \"rgba(255, 255, 255, 0.2)\",\n backgroundLight: \"rgba(255, 255, 255, 0.08)\",\n backgroundHover: \"rgba(255, 255, 255, 0.25)\",\n surface: \"rgba(255, 255, 255, 0.12)\",\n textSecondary: \"rgba(255, 255, 255, 0.8)\",\n textTertiary: \"rgba(255, 255, 255, 0.6)\",\n textMuted: \"rgba(255, 255, 255, 0.5)\",\n highlightBg: \"rgba(251, 191, 36, 0.3)\",\n highlightBorder: \"rgba(251, 191, 36, 0.5)\"\n },\n modes: {\n dark: {\n text: \"rgba(255, 255, 255, 0.95)\",\n background: \"rgba(0, 0, 0, 0.3)\",\n primary: \"rgba(129, 140, 248, 0.9)\",\n secondary: \"rgba(167, 139, 250, 0.9)\",\n accent: \"rgba(244, 114, 182, 0.9)\",\n highlight: \"rgba(129, 140, 248, 0.25)\",\n muted: \"rgba(0, 0, 0, 0.15)\",\n success: \"rgba(74, 222, 128, 0.9)\",\n warning: \"rgba(251, 191, 36, 0.9)\",\n error: \"rgba(248, 113, 113, 0.9)\",\n info: \"rgba(96, 165, 250, 0.9)\",\n border: \"rgba(255, 255, 255, 0.15)\",\n backgroundSecondary: \"rgba(0, 0, 0, 0.4)\",\n backgroundTertiary: \"rgba(0, 0, 0, 0.5)\",\n backgroundLight: \"rgba(0, 0, 0, 0.2)\",\n backgroundHover: \"rgba(255, 255, 255, 0.1)\",\n surface: \"rgba(0, 0, 0, 0.35)\",\n textSecondary: \"rgba(255, 255, 255, 0.8)\",\n textTertiary: \"rgba(255, 255, 255, 0.6)\",\n textMuted: \"rgba(255, 255, 255, 0.4)\",\n highlightBg: \"rgba(251, 191, 36, 0.35)\",\n highlightBorder: \"rgba(251, 191, 36, 0.6)\"\n },\n frosted: {\n text: \"rgba(31, 41, 55, 0.95)\",\n background: \"rgba(255, 255, 255, 0.3)\",\n primary: \"rgba(79, 70, 229, 0.95)\",\n secondary: \"rgba(124, 58, 237, 0.95)\",\n accent: \"rgba(219, 39, 119, 0.95)\",\n highlight: \"rgba(79, 70, 229, 0.15)\",\n muted: \"rgba(255, 255, 255, 0.4)\",\n success: \"rgba(16, 185, 129, 0.95)\",\n warning: \"rgba(245, 158, 11, 0.95)\",\n error: \"rgba(220, 38, 38, 0.95)\",\n info: \"rgba(37, 99, 235, 0.95)\",\n border: \"rgba(255, 255, 255, 0.5)\",\n backgroundSecondary: \"rgba(255, 255, 255, 0.4)\",\n backgroundTertiary: \"rgba(255, 255, 255, 0.5)\",\n backgroundLight: \"rgba(255, 255, 255, 0.25)\",\n backgroundHover: \"rgba(255, 255, 255, 0.6)\",\n surface: \"rgba(255, 255, 255, 0.35)\",\n textSecondary: \"rgba(31, 41, 55, 0.8)\",\n textTertiary: \"rgba(31, 41, 55, 0.6)\",\n textMuted: \"rgba(31, 41, 55, 0.5)\",\n highlightBg: \"rgba(251, 191, 36, 0.4)\",\n highlightBorder: \"rgba(251, 191, 36, 0.7)\"\n }\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"text\",\n bg: \"rgba(255, 255, 255, 0.1)\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n \"&:hover\": {\n bg: \"rgba(255, 255, 255, 0.2)\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"transparent\",\n \"&:hover\": {\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n bg: \"rgba(255, 255, 255, 0.05)\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n }\n }\n};\n// src/defaultThemes.ts\nvar defaultMarkdownTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Crimson Text\", \"Georgia\", \"Times New Roman\", serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#1a1a1a\",\n background: \"#ffffff\",\n primary: \"#007acc\",\n secondary: \"#005a9e\",\n accent: \"#1a1a1a\",\n highlight: \"rgba(0, 122, 204, 0.1)\",\n muted: \"#f0f0f0\",\n success: \"#28a745\",\n warning: \"#ffc107\",\n error: \"#dc3545\",\n info: \"#17a2b8\",\n border: \"rgba(0, 0, 0, 0.1)\",\n backgroundSecondary: \"#f8f9fa\",\n backgroundTertiary: \"#e9ecef\",\n backgroundLight: \"rgba(0, 0, 0, 0.03)\",\n backgroundHover: \"rgba(0, 0, 0, 0.05)\",\n surface: \"#ffffff\",\n textSecondary: \"#555555\",\n textTertiary: \"#888888\",\n textMuted: \"#aaaaaa\",\n highlightBg: \"rgba(255, 235, 59, 0.3)\",\n highlightBorder: \"rgba(255, 235, 59, 0.6)\"\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n }\n }\n};\nvar defaultTerminalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", Courier, monospace',\n heading: '\"Courier New\", Courier, monospace',\n monospace: '\"Courier New\", Courier, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.4,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.6\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 0 5px rgba(255, 193, 7, 0.1)\",\n \"0 0 10px rgba(255, 193, 7, 0.15)\",\n \"0 0 15px rgba(255, 193, 7, 0.2)\",\n \"0 0 20px rgba(255, 193, 7, 0.25)\",\n \"0 0 30px rgba(255, 193, 7, 0.3)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#ffc107\",\n background: \"#000000\",\n primary: \"#ffc107\",\n secondary: \"#ffb300\",\n accent: \"#ffffff\",\n highlight: \"rgba(255, 193, 7, 0.1)\",\n muted: \"#1a1a1a\",\n success: \"#4caf50\",\n warning: \"#ff9800\",\n error: \"#f44336\",\n info: \"#2196f3\",\n border: \"rgba(255, 193, 7, 0.2)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(255, 193, 7, 0.03)\",\n backgroundHover: \"rgba(255, 193, 7, 0.05)\",\n surface: \"#050505\",\n textSecondary: \"#e0e0e0\",\n textTertiary: \"#b0b0b0\",\n textMuted: \"#808080\",\n highlightBg: \"rgba(255, 193, 7, 0.2)\",\n highlightBorder: \"rgba(255, 193, 7, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar defaultEditorTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px rgba(0, 0, 0, 0.1)\",\n \"0 4px 8px rgba(0, 0, 0, 0.15)\",\n \"0 8px 16px rgba(0, 0, 0, 0.2)\",\n \"0 12px 24px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#d4d4d4\",\n background: \"#1e1e1e\",\n primary: \"#569cd6\",\n secondary: \"#408ac9\",\n accent: \"#c586c0\",\n highlight: \"rgba(86, 156, 214, 0.1)\",\n muted: \"#2a2a2a\",\n success: \"#6a9955\",\n warning: \"#d18616\",\n error: \"#f44747\",\n info: \"#569cd6\",\n border: \"rgba(255, 255, 255, 0.1)\",\n backgroundSecondary: \"#252526\",\n backgroundTertiary: \"#333333\",\n backgroundLight: \"rgba(255, 255, 255, 0.03)\",\n backgroundHover: \"rgba(255, 255, 255, 0.05)\",\n surface: \"#252526\",\n textSecondary: \"#cccccc\",\n textTertiary: \"#999999\",\n textMuted: \"#666666\",\n highlightBg: \"rgba(255, 235, 59, 0.2)\",\n highlightBorder: \"rgba(255, 235, 59, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n }\n }\n};\n\n// src/themes.ts\nvar regalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Crimson Text\", \"Georgia\", \"Times New Roman\", serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#f1e8dc\",\n background: \"#1a1f2e\",\n primary: \"#d4a574\",\n secondary: \"#e0b584\",\n accent: \"#c9b8a3\",\n highlight: \"rgba(212, 165, 116, 0.15)\",\n muted: \"#8b7968\",\n success: \"#5c8a72\",\n warning: \"#d4a574\",\n error: \"#a85751\",\n info: \"#d4a574\",\n border: \"rgba(212, 165, 116, 0.2)\",\n backgroundSecondary: \"#212738\",\n backgroundTertiary: \"#2d3446\",\n backgroundLight: \"rgba(212, 165, 116, 0.08)\",\n backgroundHover: \"rgba(212, 165, 116, 0.15)\",\n surface: \"#212738\",\n textSecondary: \"#c9b8a3\",\n textTertiary: \"#8b7968\",\n textMuted: \"#8b7968\",\n highlightBg: \"rgba(255, 193, 7, 0.25)\",\n highlightBorder: \"rgba(255, 193, 7, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"background\",\n bg: \"primary\",\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"text\",\n bg: \"muted\",\n \"&:hover\": {\n bg: \"backgroundSecondary\"\n }\n },\n ghost: {\n color: \"primary\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"muted\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"background\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n }\n }\n};\nvar terminalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace',\n heading: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace',\n monospace: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.4,\n relaxed: 1.8\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px 0 rgba(0, 0, 0, 0.07)\",\n \"0 8px 12px 0 rgba(0, 0, 0, 0.08)\",\n \"0 16px 24px 0 rgba(0, 0, 0, 0.10)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#e4e4e4\",\n background: \"rgba(10, 10, 10, 0.85)\",\n primary: \"#66b3ff\",\n secondary: \"#80c4ff\",\n accent: \"#66ff99\",\n highlight: \"rgba(102, 179, 255, 0.15)\",\n muted: \"rgba(26, 26, 26, 0.8)\",\n success: \"#66ff99\",\n warning: \"#ffcc66\",\n error: \"#ff6666\",\n info: \"#66b3ff\",\n border: \"rgba(255, 255, 255, 0.1)\",\n backgroundSecondary: \"rgba(15, 15, 15, 0.9)\",\n backgroundTertiary: \"rgba(20, 20, 20, 0.9)\",\n backgroundLight: \"rgba(255, 255, 255, 0.05)\",\n backgroundHover: \"rgba(102, 179, 255, 0.08)\",\n surface: \"rgba(15, 15, 15, 0.95)\",\n textSecondary: \"rgba(255, 255, 255, 0.7)\",\n textTertiary: \"rgba(255, 255, 255, 0.5)\",\n textMuted: \"rgba(255, 255, 255, 0.4)\",\n highlightBg: \"rgba(255, 235, 59, 0.25)\",\n highlightBorder: \"rgba(255, 235, 59, 0.5)\"\n },\n modes: {\n light: {\n text: \"#1a1a1a\",\n background: \"rgba(255, 255, 255, 0.9)\",\n primary: \"#0066cc\",\n secondary: \"#0052a3\",\n accent: \"#00cc88\",\n highlight: \"rgba(0, 102, 204, 0.08)\",\n muted: \"rgba(245, 245, 245, 0.8)\",\n success: \"#00cc88\",\n warning: \"#ffaa00\",\n error: \"#ff3333\",\n info: \"#0066cc\",\n border: \"rgba(0, 0, 0, 0.1)\",\n backgroundSecondary: \"rgba(250, 250, 250, 0.9)\",\n backgroundTertiary: \"rgba(245, 245, 245, 0.9)\",\n backgroundLight: \"rgba(0, 0, 0, 0.02)\",\n backgroundHover: \"rgba(0, 102, 204, 0.04)\",\n surface: \"rgba(255, 255, 255, 0.95)\",\n textSecondary: \"rgba(0, 0, 0, 0.6)\",\n textTertiary: \"rgba(0, 0, 0, 0.4)\",\n textMuted: \"rgba(0, 0, 0, 0.3)\",\n highlightBg: \"rgba(255, 235, 59, 0.3)\",\n highlightBorder: \"rgba(255, 235, 59, 0.6)\"\n }\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"highlight\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n }\n }\n};\nvar matrixTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n heading: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n monospace: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 0 5px rgba(0, 216, 53, 0.15)\",\n \"0 0 10px rgba(0, 216, 53, 0.2)\",\n \"0 0 15px rgba(0, 216, 53, 0.25)\",\n \"0 0 20px rgba(0, 216, 53, 0.3)\",\n \"0 0 30px rgba(0, 216, 53, 0.4)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#a8a8a8\",\n background: \"#000000\",\n primary: \"#00d835\",\n secondary: \"#00a828\",\n accent: \"#00d835\",\n highlight: \"rgba(0, 216, 53, 0.15)\",\n muted: \"#0a0a0a\",\n success: \"#00d835\",\n warning: \"#d4a000\",\n error: \"#d63333\",\n info: \"#00a8d6\",\n border: \"rgba(0, 216, 53, 0.2)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(0, 216, 53, 0.03)\",\n backgroundHover: \"rgba(0, 216, 53, 0.08)\",\n surface: \"#050505\",\n textSecondary: \"#808080\",\n textTertiary: \"#606060\",\n textMuted: \"#484848\",\n highlightBg: \"rgba(0, 216, 53, 0.25)\",\n highlightBorder: \"rgba(0, 216, 53, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"highlight\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar matrixMinimalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n heading: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n monospace: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px rgba(0, 0, 0, 0.1)\",\n \"0 4px 8px rgba(0, 0, 0, 0.15)\",\n \"0 8px 16px rgba(0, 0, 0, 0.2)\",\n \"0 0 20px rgba(0, 216, 53, 0.1)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#a8a8a8\",\n background: \"#000000\",\n primary: \"#b8b8b8\",\n secondary: \"#909090\",\n accent: \"#00d835\",\n highlight: \"rgba(0, 216, 53, 0.1)\",\n muted: \"#0a0a0a\",\n success: \"#00d835\",\n warning: \"#d4a000\",\n error: \"#d63333\",\n info: \"#00a8d6\",\n border: \"rgba(184, 184, 184, 0.1)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(184, 184, 184, 0.02)\",\n backgroundHover: \"rgba(0, 216, 53, 0.05)\",\n surface: \"#050505\",\n textSecondary: \"#808080\",\n textTertiary: \"#606060\",\n textMuted: \"#484848\",\n highlightBg: \"rgba(0, 216, 53, 0.2)\",\n highlightBorder: \"rgba(0, 216, 53, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar slateTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.2)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.2)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.2)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.25)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.3)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#9ca3af\",\n background: \"#1a1c1e\",\n primary: \"#d1d5db\",\n secondary: \"#6b7280\",\n accent: \"#f59e0b\",\n highlight: \"rgba(209, 213, 219, 0.15)\",\n muted: \"#2d3134\",\n success: \"#10b981\",\n warning: \"#f59e0b\",\n error: \"#ef4444\",\n info: \"#3b82f6\",\n border: \"rgba(156, 163, 175, 0.15)\",\n backgroundSecondary: \"#22252a\",\n backgroundTertiary: \"#2d3134\",\n backgroundLight: \"rgba(156, 163, 175, 0.05)\",\n backgroundHover: \"rgba(156, 163, 175, 0.1)\",\n surface: \"#1f2124\",\n textSecondary: \"#e5e7eb\",\n textTertiary: \"#6b7280\",\n textMuted: \"#4b5563\",\n highlightBg: \"rgba(245, 158, 11, 0.25)\",\n highlightBorder: \"rgba(245, 158, 11, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"#1a1c1e\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"#9ca3af\"\n }\n },\n secondary: {\n color: \"#e5e7eb\",\n bg: \"secondary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"#4b5563\"\n }\n },\n ghost: {\n color: \"textSecondary\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\",\n color: \"textSecondary\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textTertiary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n }\n }\n};\n// src/ThemeProvider.tsx\nimport React, { createContext, useContext, useState, useEffect } from \"react\";\n\n// src/themeHelpers.ts\nfunction overrideColors(theme, colors) {\n return {\n ...theme,\n colors: {\n ...theme.colors,\n ...colors\n }\n };\n}\nfunction makeTheme(baseTheme, overrides) {\n return {\n ...baseTheme,\n ...overrides,\n colors: {\n ...baseTheme.colors,\n ...overrides.colors\n },\n fonts: {\n ...baseTheme.fonts,\n ...overrides.fonts\n }\n };\n}\nfunction addMode(theme, modeName, colors, baseMode) {\n let baseColors;\n if (baseMode && theme.modes && theme.modes[baseMode]) {\n baseColors = {\n ...theme.colors,\n ...theme.modes[baseMode]\n };\n } else {\n baseColors = theme.colors;\n }\n const newMode = {\n ...baseColors,\n ...colors\n };\n return {\n ...theme,\n modes: {\n ...theme.modes,\n [modeName]: newMode\n }\n };\n}\nfunction getMode(theme, mode) {\n if (!mode || !theme.modes || !theme.modes[mode]) {\n return theme.colors;\n }\n return {\n ...theme.colors,\n ...theme.modes[mode]\n };\n}\n\n// src/ThemeProvider.tsx\nvar ThemeContext;\nvar getThemeContext = () => {\n if (typeof window !== \"undefined\") {\n const globalWindow = window;\n if (!globalWindow.__principlemd_theme_context__) {\n globalWindow.__principlemd_theme_context__ = createContext(undefined);\n }\n return globalWindow.__principlemd_theme_context__;\n } else {\n if (!ThemeContext) {\n ThemeContext = createContext(undefined);\n }\n return ThemeContext;\n }\n};\nvar ThemeContextSingleton = getThemeContext();\nvar useTheme = () => {\n const context = useContext(ThemeContextSingleton);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n return context;\n};\nvar ThemeProvider = ({\n children,\n theme: customTheme = theme,\n initialMode\n}) => {\n const [mode, setMode] = useState(initialMode);\n const activeTheme = React.useMemo(() => {\n if (!mode || !customTheme.modes || !customTheme.modes[mode]) {\n return customTheme;\n }\n return {\n ...customTheme,\n colors: getMode(customTheme, mode)\n };\n }, [customTheme, mode]);\n useEffect(() => {\n if (!initialMode) {\n const savedMode = localStorage.getItem(\"principlemd-theme-mode\");\n if (savedMode) {\n setMode(savedMode);\n }\n }\n }, [initialMode]);\n useEffect(() => {\n if (mode) {\n localStorage.setItem(\"principlemd-theme-mode\", mode);\n } else {\n localStorage.removeItem(\"principlemd-theme-mode\");\n }\n }, [mode]);\n const value = {\n theme: activeTheme,\n mode,\n setMode\n };\n return /* @__PURE__ */ React.createElement(ThemeContextSingleton.Provider, {\n value\n }, children);\n};\nvar withTheme = (Component) => {\n return (props) => {\n const { theme: theme2 } = useTheme();\n return /* @__PURE__ */ React.createElement(Component, {\n ...props,\n theme: theme2\n });\n };\n};\n// src/utils.ts\nvar getColor = (theme2, colorKey) => {\n const colors = theme2.colors;\n const value = colors[colorKey];\n return typeof value === \"string\" ? value : colorKey;\n};\nvar getSpace = (theme2, index) => {\n return theme2.space[index] || 0;\n};\nvar getFontSize = (theme2, index) => {\n return theme2.fontSizes[index] || theme2.fontSizes[2];\n};\nvar getRadius = (theme2, index) => {\n return theme2.radii[index] || 0;\n};\nvar getShadow = (theme2, index) => {\n return theme2.shadows[index] || \"none\";\n};\nvar getZIndex = (theme2, index) => {\n return theme2.zIndices[index] || 0;\n};\nvar responsive = (values) => {\n return values.reduce((acc, value, index) => {\n if (index === 0) {\n return value;\n }\n return {\n ...acc,\n [`@media screen and (min-width: ${values[index - 1]})`]: value\n };\n }, {});\n};\nvar sx = (styles) => styles;\nvar createStyle = (theme2, styleObj) => {\n const processValue = (value) => {\n if (typeof value === \"string\") {\n if (value in theme2.colors) {\n return getColor(theme2, value);\n }\n return value;\n }\n if (typeof value === \"number\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(processValue);\n }\n if (typeof value === \"object\" && value !== null) {\n const processed2 = {};\n for (const [key, val] of Object.entries(value)) {\n processed2[key] = processValue(val);\n }\n return processed2;\n }\n return value;\n };\n const processed = {};\n for (const [key, val] of Object.entries(styleObj)) {\n processed[key] = processValue(val);\n }\n return processed;\n};\nvar mergeThemes = (baseTheme, ...overrides) => {\n return overrides.reduce((theme2, override) => ({\n space: override.space || theme2.space,\n fonts: { ...theme2.fonts, ...override.fonts || {} },\n fontSizes: override.fontSizes || theme2.fontSizes,\n fontWeights: { ...theme2.fontWeights, ...override.fontWeights || {} },\n lineHeights: { ...theme2.lineHeights, ...override.lineHeights || {} },\n breakpoints: override.breakpoints || theme2.breakpoints,\n sizes: override.sizes || theme2.sizes,\n radii: override.radii || theme2.radii,\n shadows: override.shadows || theme2.shadows,\n zIndices: override.zIndices || theme2.zIndices,\n colors: {\n ...theme2.colors,\n ...override.colors || {}\n },\n buttons: { ...theme2.buttons, ...override.buttons || {} },\n text: { ...theme2.text, ...override.text || {} },\n cards: { ...theme2.cards, ...override.cards || {} }\n }), baseTheme);\n};\n// src/ThemeShowcase.tsx\nimport React2 from \"react\";\nvar ThemeShowcase = ({\n theme: theme2,\n title,\n showValues = true,\n sections = [\"colors\", \"typography\", \"spacing\", \"shadows\", \"radii\"]\n}) => {\n const containerStyle = {\n fontFamily: theme2.fonts.body,\n color: theme2.colors.text,\n backgroundColor: theme2.colors.background,\n padding: theme2.space[4],\n minHeight: \"100vh\"\n };\n const sectionStyle = {\n marginBottom: theme2.space[5],\n padding: theme2.space[4],\n backgroundColor: theme2.colors.surface || theme2.colors.backgroundSecondary,\n borderRadius: theme2.radii[2],\n border: `1px solid ${theme2.colors.border}`\n };\n const headingStyle = {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[5],\n fontWeight: theme2.fontWeights.heading,\n marginBottom: theme2.space[3],\n color: theme2.colors.primary\n };\n const subheadingStyle = {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[3],\n fontWeight: theme2.fontWeights.medium,\n marginBottom: theme2.space[2],\n marginTop: theme2.space[3],\n color: theme2.colors.text\n };\n return /* @__PURE__ */ React2.createElement(\"div\", {\n style: containerStyle\n }, title && /* @__PURE__ */ React2.createElement(\"h1\", {\n style: {\n ...headingStyle,\n fontSize: theme2.fontSizes[6],\n marginBottom: theme2.space[4]\n }\n }, title), sections.includes(\"colors\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Colors\"), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Primary Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3],\n marginBottom: theme2.space[3]\n }\n }, [\"text\", \"background\", \"primary\", \"secondary\", \"accent\", \"muted\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n padding: theme2.space[2],\n backgroundColor: theme2.colors.backgroundLight || theme2.colors.backgroundTertiary,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 40,\n height: 40,\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1],\n marginRight: theme2.space[2]\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", null, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, color)));\n })), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Status Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3],\n marginBottom: theme2.space[3]\n }\n }, [\"success\", \"warning\", \"error\", \"info\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n padding: theme2.space[2],\n backgroundColor: theme2.colors.backgroundLight || theme2.colors.backgroundTertiary,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 40,\n height: 40,\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1],\n marginRight: theme2.space[2]\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", null, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, color)));\n })), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Background Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3]\n }\n }, [\"backgroundSecondary\", \"backgroundTertiary\", \"backgroundLight\", \"backgroundHover\", \"surface\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n padding: theme2.space[3],\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary,\n marginTop: theme2.space[1]\n }\n }, color));\n }))), sections.includes(\"typography\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Typography\"), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Families\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { marginBottom: theme2.space[4] }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[4],\n marginBottom: theme2.space[2]\n }\n }, \"Heading Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.heading)), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[2],\n marginBottom: theme2.space[2]\n }\n }, \"Body Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.body)), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[2]\n }\n }, \"Monospace Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.monospace))), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Sizes\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { marginBottom: theme2.space[4] }\n }, theme2.fontSizes.map((size, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: {\n fontSize: size,\n lineHeight: theme2.lineHeights.body,\n marginBottom: theme2.space[1]\n }\n }, \"Size \", index, \": Sample Text \", showValues && `(${size}px)`))), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Weights\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fit, minmax(150px, 1fr))\",\n gap: theme2.space[2]\n }\n }, Object.entries(theme2.fontWeights).map(([name, weight]) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: name,\n style: {\n fontWeight: weight,\n fontSize: theme2.fontSizes[2]\n }\n }, name, \" \", showValues && `(${weight})`)))), sections.includes(\"spacing\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Spacing\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { display: \"flex\", flexDirection: \"column\", gap: theme2.space[2] }\n }, theme2.space.map((space, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { display: \"flex\", alignItems: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 60,\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \"[\", index, \"]\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n height: 24,\n width: space,\n backgroundColor: theme2.colors.primary,\n borderRadius: theme2.radii[1]\n }\n }), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n marginLeft: theme2.space[2],\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, space, \"px\"))))), sections.includes(\"radii\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Border Radii\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(100px, 1fr))\",\n gap: theme2.space[3]\n }\n }, theme2.radii.map((radius, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { textAlign: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 80,\n height: 80,\n backgroundColor: theme2.colors.primary,\n borderRadius: radius,\n marginBottom: theme2.space[1],\n margin: \"0 auto\"\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, \"[\", index, \"] \", showValues && `${radius}px`))))), sections.includes(\"shadows\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Shadows\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(150px, 1fr))\",\n gap: theme2.space[4]\n }\n }, theme2.shadows.map((shadow, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { textAlign: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 100,\n height: 100,\n backgroundColor: theme2.colors.background,\n boxShadow: shadow,\n borderRadius: theme2.radii[2],\n margin: \"0 auto\",\n marginBottom: theme2.space[2],\n border: `1px solid ${theme2.colors.border}`\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, \"Shadow [\", index, \"]\"), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textMuted,\n marginTop: theme2.space[1]\n }\n }, shadow === \"none\" ? \"none\" : \"...\"))))), theme2.modes && Object.keys(theme2.modes).length > 0 && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Available Modes\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"flex\",\n gap: theme2.space[2],\n flexWrap: \"wrap\"\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n padding: `${theme2.space[2]}px ${theme2.space[3]}px`,\n backgroundColor: theme2.colors.primary,\n color: \"#ffffff\",\n borderRadius: theme2.radii[2],\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[1]\n }\n }, \"default\"), Object.keys(theme2.modes).map((modeName) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: modeName,\n style: {\n padding: `${theme2.space[2]}px ${theme2.space[3]}px`,\n backgroundColor: theme2.colors.secondary,\n color: theme2.colors.text,\n borderRadius: theme2.radii[2],\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[1]\n }\n }, modeName)))));\n};\n\n// src/index.ts\nvar theme = terminalTheme;\nfunction scaleThemeFonts(theme2, scale) {\n const currentScale = theme2.fontScale || 1;\n const effectiveScale = scale / currentScale;\n return {\n ...theme2,\n fontSizes: theme2.fontSizes.map((size) => Math.round(size * effectiveScale)),\n fontScale: scale\n };\n}\nfunction increaseFontScale(theme2) {\n const currentScale = theme2.fontScale || 1;\n const newScale = Math.min(currentScale * 1.1, 2);\n return scaleThemeFonts(theme2, newScale);\n}\nfunction decreaseFontScale(theme2) {\n const currentScale = theme2.fontScale || 1;\n const newScale = Math.max(currentScale * 0.9, 0.5);\n return scaleThemeFonts(theme2, newScale);\n}\nfunction resetFontScale(theme2) {\n return scaleThemeFonts(theme2, 1);\n}\nvar src_default = theme;\nexport {\n withTheme,\n useTheme,\n theme,\n terminalTheme,\n sx,\n slateTheme,\n scaleThemeFonts,\n responsive,\n resetFontScale,\n regalTheme,\n overrideColors,\n mergeThemes,\n matrixTheme,\n matrixMinimalTheme,\n makeTheme,\n increaseFontScale,\n glassmorphismTheme,\n getZIndex,\n getSpace,\n getShadow,\n getRadius,\n getMode,\n getFontSize,\n getColor,\n defaultTerminalTheme,\n defaultMarkdownTheme,\n defaultEditorTheme,\n src_default as default,\n decreaseFontScale,\n createStyle,\n addMode,\n ThemeShowcase,\n ThemeProvider\n};\n","import React, { useState, useCallback } from 'react';\nimport { useTheme, Theme } from '@principal-ade/industry-theme';\nimport './PanelConfigurator.css';\n\nexport interface PanelDefinition {\n id: string;\n label: string;\n preview?: React.ReactNode;\n icon?: React.ReactNode;\n}\n\nexport type PanelSlot =\n | string // Single panel ID\n | null // Empty slot\n | PanelGroup; // Multiple panels grouped together\n\nexport interface PanelGroup {\n type: 'tabs' | 'tiles';\n panels: string[]; // Array of panel IDs\n config?: TabsConfig | TilesConfig;\n}\n\nexport interface TabsConfig {\n defaultActiveTab?: number; // Which tab is active by default (index) - for uncontrolled mode\n tabPosition?: 'top' | 'bottom' | 'left' | 'right';\n centered?: boolean; // Whether to center the tabs\n hideTabList?: boolean; // Whether to hide the tab list and show only active tab content\n\n // Controlled mode props\n activeTabIndex?: number; // Controlled active tab index\n onTabChange?: (index: number) => void; // Callback when tab changes\n}\n\nexport interface TilesConfig {\n direction?: 'horizontal' | 'vertical' | 'grid';\n columns?: number;\n rows?: number;\n tileSizes?: number[]; // Size percentages for each tile\n}\n\nexport interface PanelLayout {\n left?: PanelSlot;\n middle?: PanelSlot;\n right?: PanelSlot;\n}\n\nexport interface PanelConfiguratorProps {\n /** Available panels that can be placed in slots */\n availablePanels: PanelDefinition[];\n\n /** Current layout configuration */\n currentLayout: PanelLayout;\n\n /** Callback when layout changes */\n onChange: (layout: PanelLayout) => void;\n\n /** Optional class name for the container */\n className?: string;\n\n /** Optional theme override (uses context theme by default) */\n theme?: Theme;\n}\n\ntype SlotPosition = 'left' | 'middle' | 'right';\ntype Selection = { type: 'slot'; position: SlotPosition } | { type: 'panel'; id: string } | null;\n\n// Helper to check if a slot is a group\nconst isGroup = (slot: PanelSlot | undefined): slot is PanelGroup => {\n return slot !== null && slot !== undefined && typeof slot === 'object' && 'type' in slot;\n};\n\n// Helper to get panel IDs from a slot\nconst getPanelIdsFromSlot = (slot: PanelSlot | undefined): string[] => {\n if (slot === null || slot === undefined) return [];\n if (typeof slot === 'string') return [slot];\n if (isGroup(slot)) return slot.panels;\n return [];\n};\n\n/**\n * PanelConfigurator - Interactive UI for configuring panel layout\n *\n * Interaction modes:\n * - Click slot → click panel: Assigns panel to slot\n * - Click panel → click slot: Assigns panel to slot\n * - Click slot → click slot: Swaps their content\n */\nexport const PanelConfigurator: React.FC<PanelConfiguratorProps> = ({\n availablePanels,\n currentLayout,\n onChange,\n className = '',\n theme: themeProp,\n}) => {\n const contextTheme = useTheme();\n const theme = themeProp || contextTheme.theme;\n const [selection, setSelection] = useState<Selection>(null);\n\n // Get panel by id\n const getPanelById = useCallback((id: string | null) => {\n if (!id) return null;\n return availablePanels.find(p => p.id === id) || null;\n }, [availablePanels]);\n\n // Get all panels sorted alphabetically\n const getSortedPanels = useCallback(() => {\n return [...availablePanels].sort((a, b) => a.label.localeCompare(b.label));\n }, [availablePanels]);\n\n // Check if a panel is in use\n const isPanelInUse = useCallback((panelId: string) => {\n const leftIds = getPanelIdsFromSlot(currentLayout.left);\n const middleIds = getPanelIdsFromSlot(currentLayout.middle);\n const rightIds = getPanelIdsFromSlot(currentLayout.right);\n return leftIds.includes(panelId) || middleIds.includes(panelId) || rightIds.includes(panelId);\n }, [currentLayout]);\n\n // Remove panel from any slot\n const removePanelFromLayout = useCallback((layout: PanelLayout, panelId: string): PanelLayout => {\n const newLayout = { ...layout };\n (['left', 'middle', 'right'] as SlotPosition[]).forEach((pos) => {\n const slot = newLayout[pos];\n if (slot === panelId) {\n newLayout[pos] = null;\n } else if (slot !== null && slot !== undefined && isGroup(slot)) {\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n if (filteredPanels.length === 0) {\n newLayout[pos] = null;\n } else if (filteredPanels.length === 1) {\n newLayout[pos] = filteredPanels[0];\n } else {\n newLayout[pos] = { ...slot, panels: filteredPanels };\n }\n }\n });\n return newLayout;\n }, []);\n\n // Toggle panel in/out of tab group (preserves tab mode)\n const togglePanelInTabGroup = useCallback((position: SlotPosition, panelId: string) => {\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n const newLayout = { ...currentLayout };\n\n // Always keep tab mode structure, just update panels array\n newLayout[position] = { ...slot, panels: filteredPanels };\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Toggle tab mode for a slot\n const toggleTabMode = useCallback((position: SlotPosition, e: React.MouseEvent) => {\n e.stopPropagation();\n const slot = currentLayout[position];\n\n if (isGroup(slot) && slot.type === 'tabs') {\n // Disable tab mode - convert to single panel (first panel in group) or null\n const newLayout = { ...currentLayout };\n newLayout[position] = slot.panels.length > 0 ? slot.panels[0] : null;\n onChange(newLayout);\n setSelection(null);\n } else {\n // Enable tab mode - top/bottom are auto-centered\n const panels: string[] = slot && typeof slot === 'string' ? [slot] : [];\n const newLayout = { ...currentLayout };\n newLayout[position] = {\n type: 'tabs',\n panels,\n config: { defaultActiveTab: 0, tabPosition: 'top' } // Top/bottom auto-center\n };\n onChange(newLayout);\n // Automatically select the slot so user can immediately add panels\n setSelection({ type: 'slot', position });\n }\n }, [currentLayout, onChange]);\n\n // Handle slot click\n const handleSlotClick = useCallback((position: SlotPosition) => {\n if (!selection) {\n // First click - select this slot\n setSelection({ type: 'slot', position });\n return;\n }\n\n if (selection.type === 'slot') {\n // If clicking the same slot that's already selected, keep it selected (don't swap)\n if (selection.position === position) {\n return;\n }\n\n // Swap two different slots\n const newLayout = { ...currentLayout };\n const temp = newLayout[selection.position];\n newLayout[selection.position] = newLayout[position];\n newLayout[position] = temp;\n onChange(newLayout);\n setSelection(null);\n } else {\n // Assign panel to slot\n const slot = currentLayout[position];\n\n // If slot is in tab mode, add/remove panel from the tab group\n if (isGroup(slot) && slot.type === 'tabs') {\n // Check if panel is already in this group - if so, remove it\n if (slot.panels.includes(selection.id)) {\n togglePanelInTabGroup(position, selection.id);\n // Keep slot selected so user can add more panels\n return;\n }\n\n // Save the current group before removing the panel from layout\n const currentGroup = slot;\n const newLayout = removePanelFromLayout(currentLayout, selection.id);\n\n // Add panel to the saved group (preserving tab mode even if removePanelFromLayout modified it)\n newLayout[position] = {\n ...currentGroup,\n panels: [...currentGroup.panels, selection.id]\n };\n\n onChange(newLayout);\n // Keep slot selected so user can add more panels\n return;\n } else {\n // Replace slot with panel\n const newLayout = removePanelFromLayout(currentLayout, selection.id);\n newLayout[position] = selection.id;\n onChange(newLayout);\n setSelection(null);\n }\n }\n }, [selection, currentLayout, onChange, removePanelFromLayout, togglePanelInTabGroup]);\n\n // Handle panel click\n const handlePanelClick = useCallback((panelId: string) => {\n if (!selection) {\n // First click - select this panel\n setSelection({ type: 'panel', id: panelId });\n return;\n }\n\n if (selection.type === 'slot') {\n // Assign panel to the selected slot\n const slot = currentLayout[selection.position];\n\n // If slot is in tab mode, add/remove panel from the tab group\n if (isGroup(slot) && slot.type === 'tabs') {\n // Check if panel is already in this group - if so, remove it\n if (slot.panels.includes(panelId)) {\n togglePanelInTabGroup(selection.position, panelId);\n // Keep slot selected so user can add more panels\n return;\n }\n\n // Save the current group before removing the panel from layout\n const currentGroup = slot;\n const newLayout = removePanelFromLayout(currentLayout, panelId);\n\n // Add panel to the saved group (preserving tab mode even if removePanelFromLayout modified it)\n newLayout[selection.position] = {\n ...currentGroup,\n panels: [...currentGroup.panels, panelId]\n };\n\n onChange(newLayout);\n // Keep slot selected so user can add more panels\n return;\n } else {\n // Replace slot with panel\n const newLayout = removePanelFromLayout(currentLayout, panelId);\n newLayout[selection.position] = panelId;\n onChange(newLayout);\n setSelection(null);\n }\n } else {\n // Change selection to this panel\n setSelection({ type: 'panel', id: panelId });\n }\n }, [selection, currentLayout, onChange, removePanelFromLayout, togglePanelInTabGroup]);\n\n // Handle slot clear (remove panel from slot)\n const handleSlotClear = useCallback((position: SlotPosition, e: React.MouseEvent) => {\n e.stopPropagation();\n const newLayout = { ...currentLayout };\n newLayout[position] = null;\n onChange(newLayout);\n setSelection(null);\n }, [currentLayout, onChange]);\n\n // Remove panel from tab group (preserves tab mode)\n const removePanelFromTabGroup = useCallback((position: SlotPosition, panelId: string, e: React.MouseEvent) => {\n e.stopPropagation();\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n const newLayout = { ...currentLayout };\n\n // Always preserve tab mode structure, just update panels array\n newLayout[position] = { ...slot, panels: filteredPanels };\n\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Update tab configuration\n const updateTabConfig = useCallback((position: SlotPosition, config: Partial<TabsConfig>) => {\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const newLayout = { ...currentLayout };\n newLayout[position] = {\n ...slot,\n config: { ...(slot.config as TabsConfig), ...config }\n };\n\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Check if item is selected\n const isSlotSelected = (position: SlotPosition) =>\n selection?.type === 'slot' && selection.position === position;\n\n const isPanelSelected = (panelId: string) =>\n selection?.type === 'panel' && selection.id === panelId;\n\n const sortedPanels = getSortedPanels();\n\n const isTabModeSlot = (position: SlotPosition) => {\n const slot = currentLayout[position];\n return isGroup(slot) && slot.type === 'tabs';\n };\n\n // Apply theme colors as CSS variables\n const themeStyles = {\n '--configurator-bg': theme.colors.background,\n '--configurator-title': theme.colors.textSecondary,\n\n '--slot-bg': theme.colors.backgroundSecondary,\n '--slot-border': theme.colors.border,\n '--slot-border-hover': theme.colors.textTertiary,\n '--slot-border-selected': theme.colors.primary,\n '--slot-bg-selected': theme.colors.backgroundLight,\n '--slot-label': theme.colors.textTertiary,\n '--slot-content-text': theme.colors.text,\n '--slot-preview-bg': theme.colors.backgroundTertiary,\n '--slot-preview-border': theme.colors.border,\n '--slot-preview-text': theme.colors.textMuted,\n '--slot-empty-text': theme.colors.textMuted,\n\n '--panel-bg': theme.colors.backgroundSecondary,\n '--panel-border': theme.colors.border,\n '--panel-border-hover': theme.colors.textSecondary,\n '--panel-border-selected': theme.colors.primary,\n '--panel-bg-selected': theme.colors.backgroundLight,\n '--panel-label-text': theme.colors.text,\n '--panel-preview-bg': theme.colors.backgroundTertiary,\n '--panel-preview-text': theme.colors.textMuted,\n\n '--clear-btn-bg': theme.colors.error,\n '--clear-btn-text': theme.colors.background,\n '--clear-btn-hover': theme.colors.error,\n\n '--hint-bg': theme.colors.backgroundLight,\n '--hint-border': theme.colors.primary,\n '--hint-text': theme.colors.text,\n } as React.CSSProperties;\n\n return (\n <div className={`panel-configurator ${className}`} style={themeStyles}>\n <div className=\"configurator-section\">\n <h3 className=\"section-title\">Panel Layout (3 Slots)</h3>\n <div className=\"slots-container\">\n {(['left', 'middle', 'right'] as SlotPosition[]).map((position) => {\n const slot = currentLayout[position];\n const selected = isSlotSelected(position);\n const isTabGroup = isGroup(slot) && slot.type === 'tabs';\n const isFilled = slot !== null;\n\n return (\n <div\n key={position}\n data-position={position}\n className={`slot ${selected ? 'selected' : ''} ${isFilled ? 'filled' : 'empty'} ${isTabGroup ? 'tab-group' : ''}`}\n onClick={() => handleSlotClick(position)}\n >\n <button\n className={`tab-mode-toggle ${isTabGroup ? 'active' : ''}`}\n onClick={(e) => toggleTabMode(position, e)}\n title={isTabGroup ? 'Disable tab mode' : 'Enable tab mode'}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2h4v2H2V2zm5 0h4v2H7V2zm5 0h2v2h-2V2zM2 5h12v9H2V5zm1 1v7h10V6H3z\"/>\n </svg>\n </button>\n\n {slot === null ? (\n <div className=\"slot-empty-state\">\n {isTabGroup ? 'Click panels to add tabs' : 'Empty'}\n </div>\n ) : isGroup(slot) ? (\n <div className=\"slot-content group-content\">\n {slot.type === 'tabs' && slot.panels.length > 0 && (\n <div className=\"tab-config-controls\">\n <label className=\"tab-config-label\">\n Tabs:\n <select\n value={(slot.config as TabsConfig)?.tabPosition || 'top'}\n onChange={(e) => updateTabConfig(position, { tabPosition: e.target.value as 'top' | 'bottom' | 'left' | 'right' })}\n onClick={(e) => e.stopPropagation()}\n >\n <option value=\"top\">Top (centered)</option>\n <option value=\"bottom\">Bottom (centered)</option>\n <option value=\"left\">Left</option>\n <option value=\"right\">Right</option>\n </select>\n </label>\n </div>\n )}\n <div className=\"group-panels\">\n {slot.panels.length === 0 ? (\n <div className=\"slot-empty-state\">Click panels to add tabs</div>\n ) : (\n slot.panels.map((panelId, idx) => {\n const panel = getPanelById(panelId);\n const isDefaultTab = slot.type === 'tabs' && ((slot.config as TabsConfig)?.defaultActiveTab ?? 0) === idx;\n return panel ? (\n <div key={panelId} className=\"group-panel-item\">\n <span className=\"group-panel-label\">\n {panel.label}\n {isDefaultTab && <span className=\"default-badge\">★</span>}\n </span>\n <button\n className=\"remove-from-group-btn\"\n onClick={(e) => removePanelFromTabGroup(position, panelId, e)}\n title={`Remove ${panel.label}`}\n >\n ×\n </button>\n </div>\n ) : null;\n })\n )}\n </div>\n </div>\n ) : (\n <div className=\"slot-content\">\n {typeof slot === 'string' && getPanelById(slot)?.preview && (\n <div className=\"slot-preview\">{getPanelById(slot)?.preview}</div>\n )}\n <div className=\"slot-panel-label\">{typeof slot === 'string' ? getPanelById(slot)?.label : ''}</div>\n <button\n className=\"slot-clear-btn\"\n onClick={(e) => handleSlotClear(position, e)}\n aria-label={`Remove ${typeof slot === 'string' ? getPanelById(slot)?.label : 'panel'} from ${position} slot`}\n >\n ×\n </button>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n\n <div className=\"configurator-section\">\n <h3 className=\"section-title\">Available Panels</h3>\n <div className=\"available-panels\">\n {sortedPanels.map((panel) => {\n const selected = isPanelSelected(panel.id);\n const inUse = isPanelInUse(panel.id);\n return (\n <div\n key={panel.id}\n className={`available-panel ${selected ? 'selected' : ''} ${inUse ? 'in-use' : ''}`}\n onClick={() => handlePanelClick(panel.id)}\n >\n <div className=\"panel-label\">{panel.label}</div>\n {panel.preview && (\n <div className=\"panel-preview\">{panel.preview}</div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n\n {selection && (\n <div className=\"selection-hint\">\n {selection.type === 'slot' ? (\n isTabModeSlot(selection.position) ? (\n <>Selected: {selection.position} slot (Tab Mode). Click panels to add them to the tab group.</>\n ) : (\n <>Selected: {selection.position} slot. Click another slot to swap, or click a panel to assign.</>\n )\n ) : (\n <>Selected: {getPanelById(selection.id)?.label}. Click a slot to assign{isTabModeSlot('left') || isTabModeSlot('middle') || isTabModeSlot('right') ? ' (or add to tab group)' : ''}.</>\n )}\n </div>\n )}\n\n <div className=\"usage-hint\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={{ verticalAlign: 'text-bottom', marginRight: '4px' }}>\n <path d=\"M8 1a7 7 0 100 14A7 7 0 008 1zm0 1a6 6 0 110 12A6 6 0 018 2zm.5 3.5v3h-1v-3h1zm0 4v1h-1v-1h1z\"/>\n </svg>\n <strong>Tip:</strong> Toggle the tab icon on a slot to enable tab mode, then click panels to add multiple tabs.\n </div>\n </div>\n );\n};\n","import { useState, useEffect, useCallback } from 'react';\n\nexport function useLocalStorage<T>(\n key: string,\n initialValue: T\n): [T, (value: T | ((val: T) => T)) => void] {\n const [storedValue, setStoredValue] = useState<T>(() => {\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n console.error(`Error reading localStorage key \"${key}\":`, error);\n return initialValue;\n }\n });\n\n const setValue = useCallback(\n (value: T | ((val: T) => T)) => {\n try {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n\n if (typeof window !== 'undefined') {\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n }\n } catch (error) {\n console.error(`Error setting localStorage key \"${key}\":`, error);\n }\n },\n [key, storedValue]\n );\n\n useEffect(() => {\n const handleStorageChange = (e: StorageEvent) => {\n if (e.key === key && e.newValue !== null) {\n try {\n setStoredValue(JSON.parse(e.newValue));\n } catch (error) {\n console.error(`Error parsing localStorage value for \"${key}\":`, error);\n }\n }\n };\n\n window.addEventListener('storage', handleStorageChange);\n return () => window.removeEventListener('storage', handleStorageChange);\n }, [key]);\n\n return [storedValue, setValue];\n}"],"names":["mapThemeToPanelVars","theme","colors","background","border","backgroundSecondary","backgroundHover","primary","surface","textSecondary","mapThemeToTabVars","text","textMuted","AnimatedResizableLayout","leftPanel","rightPanel","collapsibleSide","defaultSize","minSize","className","collapsed","style","showCollapseButton","animationDuration","animationEasing","onCollapseStart","onCollapseComplete","onExpandStart","onExpandComplete","isCollapsed","setIsCollapsed","useState","isAnimating","setIsAnimating","isDragging","setIsDragging","hideHandle","setHideHandle","currentSize","setCurrentSize","panelRef","useRef","animationFrameRef","startTimeRef","animationTimeoutRef","animatePanel","useCallback","fromSize","toSize","onComplete","current","cancelAnimationFrame","performance","now","animate","currentTime","elapsed","progress","Math","min","eased","pow","newSize","resize","requestAnimationFrame","collapse","handleCollapse","handleExpand","togglePanel","handleResize","size","handleDragStart","handleDragEnd","useEffect","animationFrame","animationTimeout","clearTimeout","leftIsCollapsible","toggleIcon","themeStyles","collapsiblePanelStyle","transition","getPanelClassName","isCollapsiblePanel","children","jsxs","PanelGroup","direction","onLayout","jsx","Panel","ref","collapsible","collapsedSize","onResize","onCollapse","onExpand","opacity","PanelResizeHandle","onDragging","visibility","width","onClick","disabled","AnimatedVerticalLayout","topPanel","bottomPanel","collapsiblePanels","top","bottom","defaultSizes","minSizes","showCollapseButtons","onTopCollapseStart","onTopCollapseComplete","onTopExpandStart","onTopExpandComplete","onBottomCollapseStart","onBottomCollapseComplete","onBottomExpandStart","onBottomExpandComplete","onPanelResize","isTopCollapsed","setIsTopCollapsed","isTopAnimating","setIsTopAnimating","currentTopSize","setCurrentTopSize","topPanelRef","topAnimationFrameRef","topStartTimeRef","isBottomCollapsed","setIsBottomCollapsed","isBottomAnimating","setIsBottomAnimating","currentBottomSize","setCurrentBottomSize","bottomPanelRef","bottomAnimationFrameRef","bottomStartTimeRef","animateTopPanel","animateBottomPanel","handleTopCollapse","handleTopExpand","toggleTopPanel","handleBottomCollapse","handleBottomExpand","toggleBottomPanel","handleTopResize","handleBottomResize","topPanelStyle","bottomPanelStyle","getTopPanelClassName","getBottomPanelClassName","ThreePanelLayout","middlePanel","left","right","middle","onLeftCollapseStart","onLeftCollapseComplete","onLeftExpandStart","onLeftExpandComplete","onRightCollapseStart","onRightCollapseComplete","onRightExpandStart","onRightExpandComplete","leftCollapsed","setLeftCollapsed","rightCollapsed","setRightCollapsed","leftAnimating","setLeftAnimating","rightAnimating","setRightAnimating","leftFullyCollapsed","rightFullyCollapsed","leftSize","setLeftSize","rightSize","setRightSize","panelGroupRef","leftPanelRef","rightPanelRef","leftAnimationFrameRef","rightAnimationFrameRef","leftStartTimeRef","rightStartTimeRef","currentStep","setTimeout","handleLeftCollapse","flushSync","currentLayout","getLayout","actualLeftSize","round","handleLeftExpand","handleRightCollapse","actualRightSize","handleRightExpand","toggleLeftPanel","toggleRightPanel","handleLeftResize","handleRightResize","handleDragging","dragging","queueMicrotask","panelName","leftCollapsiblePanelStyle","rightCollapsiblePanelStyle","leftPanelMinSize","rightPanelMinSize","TabGroup","panelIds","panels","config","defaultActiveTab","tabPosition","centered","hideTabList","activeTabIndex","controlledIndex","onTabChange","internalIndex","setInternalIndex","isControlled","tabPanels","map","id","find","p","filter","safeActiveIndex","length","activePanel","tabList","role","panel","index","handleTabClick","title","icon","label","Fragment","tabContent","content","ConfigurablePanelLayout","layout","slotDataAttributes","onMiddleCollapseStart","onMiddleCollapseComplete","onMiddleExpandStart","onMiddleExpandComplete","isLeftActive","isMiddleActive","isRightActive","activeCount","Boolean","computedDefaultSizes","computedMinSizes","middleCollapsed","setMiddleCollapsed","middleAnimating","setMiddleAnimating","middleFullyCollapsed","getPanelContent","panelId","renderPanelSlot","slot","group","type","middleSize","setMiddleSize","lastExpandedLeftSize","setLastExpandedLeftSize","lastExpandedMiddleSize","setLastExpandedMiddleSize","lastExpandedRightSize","setLastExpandedRightSize","middlePanelRef","middleAnimationFrameRef","middleStartTimeRef","animateMultiplePanels","animations","validAnimations","anim","forEach","actualMiddleSize","remainingTotal","newMiddleSize","newRightSize","targetLeftSize","spaceForOthers","currentOthersTotal","newLeftSize","targetRightSize","handleMiddleCollapse","handleMiddleExpand","targetMiddleSize","handleMiddleResize","middleCollapsiblePanelStyle","middlePanelMinSize","SnapCarousel","forwardRef","minPanelWidth","idealPanelWidth","showSeparator","onPanelChange","preventKeyboardScroll","containerRef","useImperativeHandle","scrollToPanel","container","targetPanel","scrollLeft","offsetLeft","scrollTo","behavior","getCurrentPanel","snapPointX","getBoundingClientRect","closestIndex","closestDistance","Infinity","i","panelRect","distance","abs","handleKeyDown","e","target","tagName","isContentEditable","closest","includes","key","preventDefault","addEventListener","removeEventListener","panelCount","twoPanelThreshold","panelWidth","carouselId","React","useId","replace","onScroll","_e","useMediaQuery","query","matches","setMatches","window","matchMedia","mediaQuery","handler","event","addListener","removeListener","displayName","ResponsiveConfigurablePanelLayout","mobileBreakpoint","mobileCarouselProps","rest","isMobile","orderedSlots","useMemo","mobilePanels","panelContent","canUseDOM","document","createElement","isWindow","element","elementString","Object","prototype","toString","call","isNode","node","getWindow","_target$ownerDocument","_target$ownerDocument2","ownerDocument","defaultView","isDocument","Document","isHTMLElement","HTMLElement","isSVGElement","SVGElement","getOwnerDocument","useIsomorphicLayoutEffect","useLayoutEffect","useEvent","handlerRef","_len","arguments","args","Array","_key","useLatestValue","value","dependencies","valueRef","useLazyMemo","callback","newValue","useNodeRef","onChange","onChangeHandler","setNodeRef","usePrevious","ids","useUniqueId","prefix","createAdjustmentFn","modifier","object","adjustments","reduce","accumulator","adjustment","entries","valueAdjustment","add","subtract","isKeyboardEvent","KeyboardEvent","getEventCoordinates","TouchEvent","isTouchEvent","touches","clientX","x","clientY","y","changedTouches","hasViewportRelativeCoordinates","SELECTOR","findFirstFocusableNode","querySelector","hiddenStyles","display","HiddenText","_ref","LiveRegion","announcement","ariaLiveType","position","height","margin","padding","overflow","clip","clipPath","whiteSpace","DndMonitorContext","defaultScreenReaderInstructions","draggable","defaultAnnouncements","onDragStart","active","onDragOver","_ref2","over","onDragEnd","_ref3","onDragCancel","_ref4","Accessibility","announcements","hiddenTextDescribedById","screenReaderInstructions","announce","setAnnouncement","useAnnouncement","liveRegionId","mounted","setMounted","listener","registerListener","useContext","Error","useDndMonitor","onDragMove","_ref5","_ref6","markup","createPortal","Action","noop","defaultCoordinates","freeze","distanceBetween","p1","p2","sqrt","sortCollisionsAsc","data","a","b","sortCollisionsDesc","centerOfRectangle","rect","closestCenter","collisionRect","droppableRects","droppableContainers","centerRect","collisions","droppableContainer","get","distBetween","push","sort","getIntersectionRatio","entry","max","targetArea","entryArea","intersectionArea","Number","toFixed","rectIntersection","intersectionRatio","getRectDelta","rect1","rect2","createRectAdjustmentFn","acc","getAdjustedRect","defaultOptions","ignoreTransform","getClientRect","options","transform","transformOrigin","getComputedStyle","parsedTransform","startsWith","transformArray","slice","split","scaleX","scaleY","parseTransform","translateX","translateY","parseFloat","indexOf","w","h","inverseTransform","getTransformAgnosticClientRect","getScrollableAncestors","limit","scrollParents","findScrollableAncestors","scrollingElement","computedStyle","overflowRegex","some","property","test","isScrollable","isFixed","parentNode","getFirstScrollableAncestor","firstScrollableAncestor","getScrollableElement","getScrollXCoordinate","scrollX","getScrollYCoordinate","scrollY","scrollTop","getScrollCoordinates","Direction","isDocumentScrollingElement","getScrollPosition","scrollingContainer","minScroll","dimensions","innerHeight","innerWidth","clientHeight","clientWidth","maxScroll","scrollWidth","scrollHeight","isTop","isLeft","isBottom","isRight","defaultThreshold","getScrollDirectionAndSpeed","scrollContainer","scrollContainerRect","acceleration","thresholdPercentage","speed","threshold","Backward","Forward","getScrollElementRect","getScrollOffsets","scrollableAncestors","properties","Rect","constructor","this","scrollOffsets","axis","keys","getScrollOffset","defineProperty","currentOffsets","scrollOffsetsDeltla","enumerable","Listeners","listeners","removeAll","_this$target","eventName","_this$target2","hasExceededDistance","delta","measurement","dx","dy","EventName","KeyboardCode","stopPropagation","defaultKeyboardCodes","start","Space","Enter","cancel","Esc","end","Tab","defaultKeyboardCoordinateGetter","currentCoordinates","code","Right","Left","Down","Up","KeyboardSensor","props","autoScrollEnabled","referenceCoordinates","windowListeners","bind","handleCancel","attach","handleStart","Resize","VisibilityChange","Keydown","activeNode","onStart","measure","scrollIntoView","block","inline","scrollIntoViewIfNeeded","context","keyboardCodes","coordinateGetter","scrollBehavior","handleEnd","newCoordinates","coordinatesDelta","scrollDelta","scrollElementRect","clampedCoordinates","canScrollX","canScrollY","newScrollCoordinates","canScrollToNewCoordinates","scrollBy","handleMove","coordinates","onMove","onEnd","detach","onCancel","isDistanceConstraint","constraint","isDelayConstraint","activators","onActivation","nativeEvent","activator","activatorNode","AbstractPointerSensor","events","listenerTarget","_getEventCoordinates","EventTarget","getEventListenerTarget","activated","initialCoordinates","timeoutId","documentListeners","handleKeydown","removeTextSelection","activationConstraint","bypassActivationConstraint","move","name","passive","DragStart","ContextMenu","delay","handlePending","offset","onPending","Click","capture","SelectionChange","_getEventCoordinates2","tolerance","cancelable","onAbort","_this$document$getSel","getSelection","removeAllRanges","PointerSensor","super","isPrimary","button","events$1","MouseButton","RightClick","events$2","AutoScrollActivator","TraversalOrder","useAutoScroller","Pointer","canScroll","draggingRect","enabled","interval","order","TreeOrder","pointerCoordinates","scrollableAncestorRects","scrollIntent","previousDelta","previousIntent","defaultScrollIntent","sign","useScrollIntent","setAutoScrollInterval","clearAutoScrollInterval","intervalRef","duration","setInterval","clearInterval","useInterval","scrollSpeed","scrollDirection","DraggableRect","scrollContainerRef","autoScroll","sortedScrollableAncestors","reverse","JSON","stringify","setup","MeasuringStrategy","MeasuringFrequency","defaultValue","Map","useInitialValue","computeFn","previousValue","useResizeObserver","resizeObserver","ResizeObserver","disconnect","defaultMeasure","useRect","fallbackRect","setRect","measureRect","currentRect","isConnected","newRect","mutationObserver","handleMutations","MutationObserver","useMutationObserver","records","record","contains","observe","body","childList","subtree","defaultValue$1","useScrollOffsetsDelta","initialScrollOffsets","hasScrollOffsets","useWindowRect","getWindowClientRect","defaultValue$2","useDragOverlayMeasuring","handleNodeChange","firstChild","getMeasurableNode","nodeRef","setRef","defaultSensors","sensor","defaultData","defaultMeasuringConfiguration","droppable","strategy","WhileDragging","frequency","Optimized","dragOverlay","DroppableContainersMap","_super$get","toArray","from","values","getEnabled","getNodeFor","_this$get$node$curren","_this$get","defaultPublicContext","activatorEvent","activeNodeRect","containerNodeRect","draggableNodes","measuringConfiguration","measureDroppableContainers","windowRect","measuringScheduled","InternalContext","ariaDescribedById","dispatch","PublicContext","getInitialState","nodes","translate","containers","reducer","state","action","DragMove","DragEnd","DragCancel","RegisterDroppable","set","SetDroppableDisabled","UnregisterDroppable","delete","RestoreFocus","previousActivatorEvent","previousActiveId","activeElement","draggableNode","focusableNode","focus","ActiveDraggableContext","createContext","Status","DndContext","memo","_sensorContext$curren","_dragOverlay$nodeRef$","_dragOverlay$rect","_over$rect","accessibility","sensors","collisionDetection","measuring","modifiers","store","useReducer","dispatchMonitorEvent","registerMonitorListener","Set","_listener$type","useDndMonitorProvider","status","setStatus","Uninitialized","isInitialized","Initialized","activeId","activeRects","initial","translated","_node$data","activeRef","activeSensor","setActiveSensor","setActivatorEvent","latestProps","draggableDescribedById","enabledDroppableContainers","queue","setQueue","containersRef","Always","BeforeDragging","isDisabled","disabledRef","concat","useDroppableMeasuring","cachedNode","useCachedNode","activationCoordinates","autoScrollOptions","activeSensorDisablesAutoscroll","autoScrollGloballyDisabled","getAutoScrollerOptions","initialActiveNodeRect","useInitialRect","initialRect","initialized","rectDelta","useLayoutShiftScrollCompensation","layoutShiftCompensation","parentElement","sensorContext","draggingNode","draggingNodeRect","scrollAdjustedTranslate","overNode","usesDragOverlay","nodeRectDelta","previousNode","ancestors","useScrollableAncestors","elements","firstElement","rects","setRects","measureRects","useRects","modifiedTranslate","applyModifiers","overlayNodeRect","scrollCoordinates","setScrollCoordinates","prevElements","handleScroll","previousElements","cleanup","scrollableElement","useScrollOffsets","scrollAdjustment","activeNodeScrollDelta","overId","firstCollision","getFirstCollision","setOver","adjustScale","activeSensorRef","instantiateSensor","Sensor","sensorInstance","onDragAbort","onDragPending","unstable_batchedUpdates","Initializing","createHandler","async","cancelDrop","Promise","resolve","getSyntheticHandler","useCombineActivators","activeDraggableNode","dndKit","defaultPrevented","activationContext","capturedBy","teardownFns","teardown","useSensorSetup","overContainer","publicContext","internalContext","Provider","restoreFocus","NullContext","defaultRole","useDraggable","attributes","roleDescription","tabIndex","setActivatorNodeRef","useSyntheticListeners","dataRef","defaultResizeObserverConfig","timeout","SlotOverlayWrapper","slotPosition","isEditing","setDraggableRef","setDroppableRef","isOver","resizeObserverConfig","previous","resizeObserverConnected","callbackId","resizeObserverDisabled","updateMeasurementsFor","resizeObserverTimeout","isArray","newElement","previousElement","unobserve","useDroppable","setRefs","toUpperCase","EditableConfigurablePanelLayout","isEditMode","onLayoutChange","layoutProps","activeSlot","setActiveSlot","dragOffset","setDragOffset","useSensors","handleDragMove","sourceSlot","targetSlot","newLayout","temp","setAttribute","setProperty","removeAttribute","removeProperty","SlotOverlays","slotRects","setSlotRects","updatePositions","newRects","pointerEvents","zIndex","ThemeContext","ThemeContextSingleton","globalWindow","__principlemd_theme_context__","getThemeContext","isGroup","getPanelIdsFromSlot","PanelConfigurator","availablePanels","themeProp","contextTheme","useTheme","selection","setSelection","getPanelById","getSortedPanels","localeCompare","isPanelInUse","leftIds","middleIds","rightIds","removePanelFromLayout","pos","filteredPanels","togglePanelInTabGroup","toggleTabMode","handleSlotClick","currentGroup","handlePanelClick","handleSlotClear","removePanelFromTabGroup","updateTabConfig","sortedPanels","isTabModeSlot","textTertiary","backgroundLight","backgroundTertiary","error","selected","isSlotSelected","isTabGroup","viewBox","fill","d","idx","isDefaultTab","preview","inUse","verticalAlign","marginRight","useLocalStorage","initialValue","storedValue","setStoredValue","item","localStorage","getItem","parse","console","setValue","valueToStore","Function","setItem","handleStorageChange"],"mappings":"mcAKO,SAASA,EAAoBC,GAClC,MAAO,CACL,qBAAsBA,EAAMC,OAAOC,WACnC,iBAAkBF,EAAMC,OAAOE,OAC/B,iBAAkBH,EAAMC,OAAOG,oBAC/B,uBAAwBJ,EAAMC,OAAOI,gBACrC,wBAAyBL,EAAMC,OAAOK,QACtC,oBAAqBN,EAAMC,OAAOM,QAClC,uBAAwBP,EAAMC,OAAOI,gBACrC,wBAAyBL,EAAMC,O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vB,EAAaO,EACvB","x_google_ignoreList":[9,10,11,13]}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/utils/themeMapping.ts","../src/components/AnimatedResizableLayout.tsx","../src/components/AnimatedVerticalLayout.tsx","../src/components/TabGroup.tsx","../src/components/ConfigurablePanelLayout.tsx","../src/components/SnapCarousel.tsx","../src/hooks/useMediaQuery.ts","../src/components/ResponsiveConfigurablePanelLayout.tsx","../node_modules/@dnd-kit/utilities/dist/utilities.esm.js","../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js","../node_modules/@dnd-kit/core/dist/core.esm.js","../src/components/EditableConfigurablePanelLayout.tsx","../node_modules/@principal-ade/industry-theme/dist/esm/index.js","../src/components/PanelConfigurator.tsx"],"sourcesContent":["import { Theme } from '@principal-ade/industry-theme';\n\n/**\n * Maps industry-theme Theme object to panel-specific CSS variables\n */\nexport function mapThemeToPanelVars(theme: Theme): Record<string, string> {\n return {\n '--panel-background': theme.colors.background,\n '--panel-border': theme.colors.border,\n '--panel-handle': theme.colors.backgroundSecondary,\n '--panel-handle-hover': theme.colors.backgroundHover,\n '--panel-handle-active': theme.colors.primary,\n '--panel-button-bg': theme.colors.surface,\n '--panel-button-hover': theme.colors.backgroundHover,\n '--panel-button-border': theme.colors.border,\n '--panel-button-icon': theme.colors.textSecondary,\n '--panel-accent-bg': theme.colors.primary + '15', // primary color with 15% opacity\n };\n}\n\n/**\n * Maps industry-theme Theme object to tab-specific CSS variables\n */\nexport function mapThemeToTabVars(theme: Theme): Record<string, string> {\n return {\n '--tab-list-bg': theme.colors.backgroundSecondary,\n '--tab-border': theme.colors.border,\n '--tab-bg': theme.colors.surface,\n '--tab-bg-hover': theme.colors.backgroundHover,\n '--tab-bg-active': theme.colors.primary,\n '--tab-text': theme.colors.text,\n '--tab-text-active': theme.colors.background,\n '--tab-border-hover': theme.colors.textSecondary,\n '--tab-border-active': theme.colors.primary,\n '--tab-focus': theme.colors.primary,\n '--tab-content-bg': theme.colors.background,\n '--tab-empty-text': theme.colors.textMuted,\n };\n}\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './AnimatedResizableLayout.css';\n\nexport interface AnimatedResizableLayoutProps {\n /** Content for the left panel */\n leftPanel: ReactNode;\n\n /** Content for the right panel */\n rightPanel: ReactNode;\n\n /** Which side is collapsible */\n collapsibleSide?: 'left' | 'right';\n\n /** Default size of the collapsible panel (0-100) */\n defaultSize?: number;\n\n /** Minimum size of the collapsible panel when expanded (0-100) */\n minSize?: number;\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Whether the panel is initially collapsed */\n collapsed?: boolean;\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show the collapse/expand toggle button */\n showCollapseButton?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Callback fired when collapse starts */\n onCollapseStart?: () => void;\n\n /** Callback fired when collapse completes */\n onCollapseComplete?: () => void;\n\n /** Callback fired when expand starts */\n onExpandStart?: () => void;\n\n /** Callback fired when expand completes */\n onExpandComplete?: () => void;\n\n /** Theme object for customizing colors */\n theme: Theme;\n}\n\n/**\n * AnimatedResizableLayout - Combines react-resizable-panels with smooth animations\n * Supports both manual dragging to resize AND smooth animations for collapse/expand\n */\nexport const AnimatedResizableLayout: React.FC<AnimatedResizableLayoutProps> = ({\n leftPanel,\n rightPanel,\n collapsibleSide = 'left',\n defaultSize = 25,\n minSize = 5,\n className = '',\n collapsed = false,\n style,\n showCollapseButton = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n onCollapseStart,\n onCollapseComplete,\n onExpandStart,\n onExpandComplete,\n theme,\n}) => {\n const [isCollapsed, setIsCollapsed] = useState(collapsed);\n const [isAnimating, setIsAnimating] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n const [hideHandle, setHideHandle] = useState(collapsed);\n const [currentSize, setCurrentSize] = useState(collapsed ? 0 : defaultSize);\n const panelRef = useRef<ImperativePanelHandle>(null);\n const animationFrameRef = useRef<number | undefined>(undefined);\n const startTimeRef = useRef<number | undefined>(undefined);\n const animationTimeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Smooth animation using requestAnimationFrame\n const animatePanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!panelRef.current) return;\n\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n\n startTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!startTimeRef.current || !panelRef.current) return;\n\n const elapsed = currentTime - startTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n // Apply easing\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n\n // Always use resize during animation, never collapse\n panelRef.current.resize(newSize);\n\n if (progress < 1) {\n animationFrameRef.current = requestAnimationFrame(animate);\n } else {\n // Ensure final state is set correctly\n if (toSize === 0) {\n panelRef.current.collapse();\n } else {\n panelRef.current.resize(toSize);\n }\n setIsAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n animationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n const handleCollapse = useCallback(() => {\n if (isAnimating || isDragging) return;\n\n setIsAnimating(true);\n setIsCollapsed(true);\n if (onCollapseStart) onCollapseStart();\n\n // Animate from current size to 0\n animatePanel(currentSize, 0, () => {\n setCurrentSize(0);\n setHideHandle(true); // Hide handle AFTER animation completes\n if (onCollapseComplete) onCollapseComplete();\n });\n }, [isAnimating, isDragging, currentSize, animatePanel, onCollapseStart, onCollapseComplete]);\n\n const handleExpand = useCallback(() => {\n if (isAnimating || isDragging) return;\n\n setIsAnimating(true);\n setIsCollapsed(false);\n setHideHandle(false); // Show handle immediately when expanding\n if (onExpandStart) onExpandStart();\n\n // Animate from 0 to the default size\n animatePanel(0, defaultSize, () => {\n setCurrentSize(defaultSize);\n if (onExpandComplete) onExpandComplete();\n });\n }, [isAnimating, isDragging, defaultSize, animatePanel, onExpandStart, onExpandComplete]);\n\n const togglePanel = useCallback(() => {\n if (isCollapsed) {\n handleExpand();\n } else {\n handleCollapse();\n }\n }, [isCollapsed, handleCollapse, handleExpand]);\n\n const handleResize = useCallback(\n (size: number) => {\n if (!isAnimating) {\n setCurrentSize(size);\n // If manually resized to non-zero, ensure we're not in collapsed state\n if (size > 0) {\n setIsCollapsed(false);\n }\n }\n },\n [isAnimating],\n );\n\n const handleDragStart = useCallback(() => {\n setIsDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n if (collapsed !== isCollapsed) {\n if (collapsed) {\n handleCollapse();\n } else {\n handleExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleCollapse/handleExpand would cause infinite loop\n }, [collapsed]);\n\n // Update hideHandle when collapsed prop changes externally\n useEffect(() => {\n if (collapsed && !isAnimating) {\n setHideHandle(true);\n } else if (!collapsed && !isAnimating) {\n setHideHandle(false);\n }\n }, [collapsed, isAnimating]);\n\n useEffect(() => {\n const animationFrame = animationFrameRef.current;\n const animationTimeout = animationTimeoutRef.current;\n return () => {\n if (animationFrame) {\n cancelAnimationFrame(animationFrame);\n }\n if (animationTimeout) {\n clearTimeout(animationTimeout);\n }\n };\n }, []);\n\n const leftIsCollapsible = collapsibleSide === 'left';\n const toggleIcon = isCollapsed ? (leftIsCollapsible ? '▸' : '◂') : leftIsCollapsible ? '◂' : '▸';\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const collapsiblePanelStyle =\n isAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n // Apply animation class when animating, not when dragging\n const getPanelClassName = (isCollapsiblePanel: boolean) => {\n let className = 'hybrid-panel';\n if (isCollapsiblePanel) {\n className += ' collapsible-panel';\n if (isAnimating && !isDragging) {\n className += ' animating';\n }\n if (isCollapsed) {\n className += ' collapsed';\n }\n }\n return className;\n };\n\n return (\n <div className={`animated-resizable-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup direction=\"horizontal\" onLayout={handleDragEnd}>\n <Panel\n ref={leftIsCollapsible ? panelRef : undefined}\n collapsible={leftIsCollapsible}\n defaultSize={leftIsCollapsible ? (collapsed ? 0 : defaultSize) : undefined}\n minSize={leftIsCollapsible ? minSize : 30}\n collapsedSize={0}\n onResize={leftIsCollapsible ? handleResize : undefined}\n onCollapse={leftIsCollapsible ? () => setIsCollapsed(true) : undefined}\n onExpand={leftIsCollapsible ? () => setIsCollapsed(false) : undefined}\n className={getPanelClassName(leftIsCollapsible)}\n style={leftIsCollapsible ? collapsiblePanelStyle : undefined}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: leftIsCollapsible && isCollapsed ? 0 : 1,\n transition: isAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {leftPanel}\n </div>\n </Panel>\n\n <PanelResizeHandle\n className={`resize-handle ${hideHandle ? 'collapsed' : ''}`}\n onDragging={handleDragStart}\n style={hideHandle ? { visibility: 'hidden', width: 0 } : undefined}\n >\n {showCollapseButton && (\n <div className=\"handle-bar\">\n <button\n onClick={togglePanel}\n className=\"collapse-toggle\"\n disabled={isAnimating}\n aria-label={isCollapsed ? 'Expand panel' : 'Collapse panel'}\n >\n {toggleIcon}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n <Panel\n ref={!leftIsCollapsible ? panelRef : undefined}\n collapsible={!leftIsCollapsible}\n defaultSize={!leftIsCollapsible ? (collapsed ? 0 : defaultSize) : undefined}\n minSize={!leftIsCollapsible ? minSize : 30}\n collapsedSize={0}\n onResize={!leftIsCollapsible ? handleResize : undefined}\n onCollapse={!leftIsCollapsible ? () => setIsCollapsed(true) : undefined}\n onExpand={!leftIsCollapsible ? () => setIsCollapsed(false) : undefined}\n className={getPanelClassName(!leftIsCollapsible)}\n style={!leftIsCollapsible ? collapsiblePanelStyle : undefined}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: !leftIsCollapsible && isCollapsed ? 0 : 1,\n transition: isAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {rightPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './AnimatedVerticalLayout.css';\n\nexport interface AnimatedVerticalLayoutProps {\n /** Content for the top panel */\n topPanel: ReactNode;\n\n /** Content for the bottom panel */\n bottomPanel: ReactNode;\n\n /** Which panels are collapsible */\n collapsiblePanels?: {\n top?: boolean;\n bottom?: boolean;\n };\n\n /** Default sizes for each panel (0-100) */\n defaultSizes?: {\n top: number;\n bottom: number;\n };\n\n /** Minimum sizes for each panel when expanded (0-100) */\n minSizes?: {\n top: number;\n bottom: number;\n };\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Initial collapsed state for panels */\n collapsed?: {\n top?: boolean;\n bottom?: boolean;\n };\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show the collapse/expand toggle buttons */\n showCollapseButtons?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Callbacks for panel events */\n onTopCollapseStart?: () => void;\n onTopCollapseComplete?: () => void;\n onTopExpandStart?: () => void;\n onTopExpandComplete?: () => void;\n onBottomCollapseStart?: () => void;\n onBottomCollapseComplete?: () => void;\n onBottomExpandStart?: () => void;\n onBottomExpandComplete?: () => void;\n onPanelResize?: (sizes: { top: number; bottom: number }) => void;\n}\n\n/**\n * AnimatedVerticalLayout - Vertical version with both panels independently collapsible\n * Supports both manual dragging to resize AND smooth animations for collapse/expand\n */\nexport const AnimatedVerticalLayout: React.FC<AnimatedVerticalLayoutProps> = ({\n topPanel,\n bottomPanel,\n collapsiblePanels = { top: true, bottom: true },\n defaultSizes = { top: 30, bottom: 30 },\n minSizes = { top: 5, bottom: 5 },\n className = '',\n collapsed = { top: false, bottom: false },\n style,\n showCollapseButtons = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n theme,\n onTopCollapseStart,\n onTopCollapseComplete,\n onTopExpandStart,\n onTopExpandComplete,\n onBottomCollapseStart,\n onBottomCollapseComplete,\n onBottomExpandStart,\n onBottomExpandComplete,\n onPanelResize,\n}) => {\n // Top panel state\n const [isTopCollapsed, setIsTopCollapsed] = useState(collapsed.top || false);\n const [isTopAnimating, setIsTopAnimating] = useState(false);\n const [currentTopSize, setCurrentTopSize] = useState(collapsed.top ? 0 : defaultSizes.top);\n const topPanelRef = useRef<ImperativePanelHandle>(null);\n const topAnimationFrameRef = useRef<number | undefined>(undefined);\n const topStartTimeRef = useRef<number | undefined>(undefined);\n\n // Bottom panel state\n const [isBottomCollapsed, setIsBottomCollapsed] = useState(collapsed.bottom || false);\n const [isBottomAnimating, setIsBottomAnimating] = useState(false);\n const [currentBottomSize, setCurrentBottomSize] = useState(collapsed.bottom ? 0 : defaultSizes.bottom);\n const bottomPanelRef = useRef<ImperativePanelHandle>(null);\n const bottomAnimationFrameRef = useRef<number | undefined>(undefined);\n const bottomStartTimeRef = useRef<number | undefined>(undefined);\n\n const [isDragging, setIsDragging] = useState(false);\n\n // Top panel animation\n const animateTopPanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!topPanelRef.current) return;\n\n if (topAnimationFrameRef.current) {\n cancelAnimationFrame(topAnimationFrameRef.current);\n }\n\n topStartTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!topStartTimeRef.current || !topPanelRef.current) return;\n\n const elapsed = currentTime - topStartTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n topPanelRef.current.resize(newSize);\n\n if (progress < 1) {\n topAnimationFrameRef.current = requestAnimationFrame(animate);\n } else {\n if (toSize === 0) {\n topPanelRef.current.collapse();\n } else {\n topPanelRef.current.resize(toSize);\n }\n setIsTopAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n topAnimationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n // Bottom panel animation\n const animateBottomPanel = useCallback(\n (fromSize: number, toSize: number, onComplete?: () => void) => {\n if (!bottomPanelRef.current) return;\n\n if (bottomAnimationFrameRef.current) {\n cancelAnimationFrame(bottomAnimationFrameRef.current);\n }\n\n bottomStartTimeRef.current = performance.now();\n\n const animate = (currentTime: number) => {\n if (!bottomStartTimeRef.current || !bottomPanelRef.current) return;\n\n const elapsed = currentTime - bottomStartTimeRef.current;\n const progress = Math.min(elapsed / animationDuration, 1);\n\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n const newSize = fromSize + (toSize - fromSize) * eased;\n bottomPanelRef.current.resize(newSize);\n\n if (progress < 1) {\n bottomAnimationFrameRef.current = requestAnimationFrame(animate);\n } else {\n if (toSize === 0) {\n bottomPanelRef.current.collapse();\n } else {\n bottomPanelRef.current.resize(toSize);\n }\n setIsBottomAnimating(false);\n if (onComplete) onComplete();\n }\n };\n\n bottomAnimationFrameRef.current = requestAnimationFrame(animate);\n },\n [animationDuration],\n );\n\n // Top panel handlers\n const handleTopCollapse = useCallback(() => {\n if (isTopAnimating || isDragging || !collapsiblePanels.top) return;\n\n setIsTopAnimating(true);\n setIsTopCollapsed(true);\n if (onTopCollapseStart) onTopCollapseStart();\n\n animateTopPanel(currentTopSize, 0, () => {\n setCurrentTopSize(0);\n if (onTopCollapseComplete) onTopCollapseComplete();\n });\n }, [isTopAnimating, isDragging, currentTopSize, collapsiblePanels.top, animateTopPanel, onTopCollapseStart, onTopCollapseComplete]);\n\n const handleTopExpand = useCallback(() => {\n if (isTopAnimating || isDragging || !collapsiblePanels.top) return;\n\n setIsTopAnimating(true);\n setIsTopCollapsed(false);\n if (onTopExpandStart) onTopExpandStart();\n\n animateTopPanel(0, defaultSizes.top, () => {\n setCurrentTopSize(defaultSizes.top);\n if (onTopExpandComplete) onTopExpandComplete();\n });\n }, [isTopAnimating, isDragging, defaultSizes.top, collapsiblePanels.top, animateTopPanel, onTopExpandStart, onTopExpandComplete]);\n\n const toggleTopPanel = useCallback(() => {\n if (isTopCollapsed) {\n handleTopExpand();\n } else {\n handleTopCollapse();\n }\n }, [isTopCollapsed, handleTopCollapse, handleTopExpand]);\n\n // Bottom panel handlers\n const handleBottomCollapse = useCallback(() => {\n if (isBottomAnimating || isDragging || !collapsiblePanels.bottom) return;\n\n setIsBottomAnimating(true);\n setIsBottomCollapsed(true);\n if (onBottomCollapseStart) onBottomCollapseStart();\n\n animateBottomPanel(currentBottomSize, 0, () => {\n setCurrentBottomSize(0);\n if (onBottomCollapseComplete) onBottomCollapseComplete();\n });\n }, [isBottomAnimating, isDragging, currentBottomSize, collapsiblePanels.bottom, animateBottomPanel, onBottomCollapseStart, onBottomCollapseComplete]);\n\n const handleBottomExpand = useCallback(() => {\n if (isBottomAnimating || isDragging || !collapsiblePanels.bottom) return;\n\n setIsBottomAnimating(true);\n setIsBottomCollapsed(false);\n if (onBottomExpandStart) onBottomExpandStart();\n\n animateBottomPanel(0, defaultSizes.bottom, () => {\n setCurrentBottomSize(defaultSizes.bottom);\n if (onBottomExpandComplete) onBottomExpandComplete();\n });\n }, [isBottomAnimating, isDragging, defaultSizes.bottom, collapsiblePanels.bottom, animateBottomPanel, onBottomExpandStart, onBottomExpandComplete]);\n\n const toggleBottomPanel = useCallback(() => {\n if (isBottomCollapsed) {\n handleBottomExpand();\n } else {\n handleBottomCollapse();\n }\n }, [isBottomCollapsed, handleBottomCollapse, handleBottomExpand]);\n\n const handleTopResize = useCallback(\n (size: number) => {\n if (!isTopAnimating) {\n setCurrentTopSize(size);\n if (size > 0) {\n setIsTopCollapsed(false);\n }\n }\n },\n [isTopAnimating],\n );\n\n const handleBottomResize = useCallback(\n (size: number) => {\n if (!isBottomAnimating) {\n setCurrentBottomSize(size);\n if (size > 0) {\n setIsBottomCollapsed(false);\n }\n }\n },\n [isBottomAnimating],\n );\n\n const handleDragStart = useCallback(() => {\n setIsDragging(true);\n }, []);\n\n const handleDragEnd = useCallback(() => {\n setIsDragging(false);\n if (onPanelResize) {\n onPanelResize({\n top: currentTopSize,\n bottom: currentBottomSize,\n });\n }\n }, [currentTopSize, currentBottomSize, onPanelResize]);\n\n // Sync top panel with external prop changes\n useEffect(() => {\n if (collapsed.top !== undefined && collapsed.top !== isTopCollapsed) {\n if (collapsed.top) {\n handleTopCollapse();\n } else {\n handleTopExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleTopCollapse/handleTopExpand would cause infinite loop\n }, [collapsed.top]);\n\n // Sync bottom panel with external prop changes\n useEffect(() => {\n if (collapsed.bottom !== undefined && collapsed.bottom !== isBottomCollapsed) {\n if (collapsed.bottom) {\n handleBottomCollapse();\n } else {\n handleBottomExpand();\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- handleBottomCollapse/handleBottomExpand would cause infinite loop\n }, [collapsed.bottom]);\n\n // Cleanup\n useEffect(() => {\n return () => {\n if (topAnimationFrameRef.current) {\n cancelAnimationFrame(topAnimationFrameRef.current);\n }\n if (bottomAnimationFrameRef.current) {\n cancelAnimationFrame(bottomAnimationFrameRef.current);\n }\n };\n }, []);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const topPanelStyle =\n isTopAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n const bottomPanelStyle =\n isBottomAnimating && !isDragging\n ? ({ transition: `flex ${animationDuration}ms ${animationEasing}` } satisfies React.CSSProperties)\n : undefined;\n\n const getTopPanelClassName = () => {\n let className = 'vertical-panel collapsible-panel';\n if (isTopAnimating && !isDragging) {\n className += ' animating';\n }\n if (isTopCollapsed) {\n className += ' collapsed';\n }\n return className;\n };\n\n const getBottomPanelClassName = () => {\n let className = 'vertical-panel collapsible-panel';\n if (isBottomAnimating && !isDragging) {\n className += ' animating';\n }\n if (isBottomCollapsed) {\n className += ' collapsed';\n }\n return className;\n };\n\n return (\n <div className={`animated-vertical-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup direction=\"vertical\" onLayout={handleDragEnd}>\n <Panel\n ref={topPanelRef}\n collapsible={collapsiblePanels.top}\n defaultSize={collapsed.top ? 0 : defaultSizes.top}\n minSize={minSizes.top}\n collapsedSize={0}\n onResize={handleTopResize}\n onCollapse={() => setIsTopCollapsed(true)}\n onExpand={() => setIsTopCollapsed(false)}\n className={getTopPanelClassName()}\n style={topPanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: isTopCollapsed ? 0 : 1,\n transition: isTopAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {topPanel}\n </div>\n </Panel>\n\n <PanelResizeHandle\n className=\"vertical-resize-handle\"\n onDragging={handleDragStart}\n >\n {showCollapseButtons && (\n <div className=\"handle-bar\">\n {collapsiblePanels.top && (\n <button\n onClick={toggleTopPanel}\n className=\"collapse-toggle collapse-toggle-top\"\n disabled={isTopAnimating}\n aria-label={isTopCollapsed ? 'Expand top panel' : 'Collapse top panel'}\n >\n {isTopCollapsed ? '▾' : '▴'}\n </button>\n )}\n {collapsiblePanels.bottom && (\n <button\n onClick={toggleBottomPanel}\n className=\"collapse-toggle collapse-toggle-bottom\"\n disabled={isBottomAnimating}\n aria-label={isBottomCollapsed ? 'Expand bottom panel' : 'Collapse bottom panel'}\n >\n {isBottomCollapsed ? '▴' : '▾'}\n </button>\n )}\n </div>\n )}\n </PanelResizeHandle>\n\n <Panel\n ref={bottomPanelRef}\n collapsible={collapsiblePanels.bottom}\n defaultSize={collapsed.bottom ? 0 : defaultSizes.bottom}\n minSize={minSizes.bottom}\n collapsedSize={0}\n onResize={handleBottomResize}\n onCollapse={() => setIsBottomCollapsed(true)}\n onExpand={() => setIsBottomCollapsed(false)}\n className={getBottomPanelClassName()}\n style={bottomPanelStyle}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: isBottomCollapsed ? 0 : 1,\n transition: isBottomAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {bottomPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToTabVars } from '../utils/themeMapping';\nimport { PanelDefinitionWithContent } from './ConfigurablePanelLayout';\nimport { TabsConfig } from './PanelConfigurator';\nimport './TabGroup.css';\n\nexport interface TabGroupProps {\n /** Panel IDs to display as tabs */\n panelIds: string[];\n\n /** All available panels with content */\n panels: PanelDefinitionWithContent[];\n\n /** Tab configuration */\n config?: TabsConfig;\n\n /** Optional class name */\n className?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n}\n\n/**\n * TabGroup - Renders multiple panels in a tabbed interface\n */\nexport const TabGroup: React.FC<TabGroupProps> = ({\n panelIds,\n panels,\n config = {},\n className = '',\n theme,\n}) => {\n const {\n defaultActiveTab = 0,\n tabPosition = 'top',\n centered = true,\n hideTabList = false,\n activeTabIndex: controlledIndex,\n onTabChange,\n } = config;\n\n // Internal state for uncontrolled mode\n const [internalIndex, setInternalIndex] = useState(defaultActiveTab);\n\n // Determine if component is controlled\n const isControlled = controlledIndex !== undefined;\n\n // Use controlled value if provided, otherwise use internal state\n const activeTabIndex = isControlled ? controlledIndex : internalIndex;\n\n // Handle tab changes\n const handleTabClick = (index: number) => {\n if (!isControlled) {\n setInternalIndex(index);\n }\n onTabChange?.(index);\n };\n\n // Sync internal state when defaultActiveTab changes (for uncontrolled mode)\n useEffect(() => {\n if (!isControlled) {\n setInternalIndex(defaultActiveTab);\n }\n }, [defaultActiveTab, isControlled]);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToTabVars(theme) as React.CSSProperties;\n\n // Get panels in order\n const tabPanels = panelIds\n .map(id => panels.find(p => p.id === id))\n .filter((p): p is PanelDefinitionWithContent => p !== undefined);\n\n // Ensure active tab is valid\n const safeActiveIndex = Math.min(activeTabIndex, tabPanels.length - 1);\n\n const activePanel = tabPanels[safeActiveIndex];\n\n if (tabPanels.length === 0) {\n return <div className=\"tab-group-empty\">No panels available</div>;\n }\n\n // For top/bottom positions, always center. For left/right, use the centered config\n const shouldCenter = (tabPosition === 'top' || tabPosition === 'bottom') ? true : centered;\n\n const tabList = (\n <div className={`tab-list ${shouldCenter ? 'centered' : ''}`} role=\"tablist\">\n {tabPanels.map((panel, index) => (\n <button\n key={panel.id}\n role=\"tab\"\n aria-selected={index === safeActiveIndex}\n aria-controls={`tabpanel-${panel.id}`}\n id={`tab-${panel.id}`}\n className={`tab-button ${index === safeActiveIndex ? 'active' : ''}`}\n onClick={() => handleTabClick(index)}\n title={panel.icon ? panel.label : undefined}\n >\n {panel.icon ? (\n <>\n <span className=\"tab-icon\">{panel.icon}</span>\n <span className=\"tab-label\">{panel.label}</span>\n </>\n ) : (\n panel.label\n )}\n </button>\n ))}\n </div>\n );\n\n const tabContent = activePanel ? (\n <div\n className=\"tab-content\"\n role=\"tabpanel\"\n id={`tabpanel-${activePanel.id}`}\n aria-labelledby={`tab-${activePanel.id}`}\n >\n {activePanel.content}\n </div>\n ) : null;\n\n return (\n <div className={`tab-group tab-position-${tabPosition} ${className}`} style={themeStyles}>\n {!hideTabList && (tabPosition === 'top' || tabPosition === 'left') && tabList}\n {tabContent}\n {!hideTabList && (tabPosition === 'bottom' || tabPosition === 'right') && tabList}\n </div>\n );\n};\n","import React, { ReactNode, useState, useRef, useEffect, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\nimport {\n Panel,\n PanelGroup,\n PanelResizeHandle,\n ImperativePanelHandle,\n ImperativePanelGroupHandle,\n} from 'react-resizable-panels';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport { PanelLayout, PanelSlot, PanelGroup as PanelGroupType, TabsConfig } from './PanelConfigurator';\nimport { TabGroup } from './TabGroup';\nimport './ConfigurablePanelLayout.css';\n\nexport interface PanelDefinitionWithContent {\n id: string;\n label: string;\n content: ReactNode;\n preview?: ReactNode;\n icon?: ReactNode;\n}\n\nexport interface ConfigurablePanelLayoutProps {\n /** Available panels with their content */\n panels: PanelDefinitionWithContent[];\n\n /** Current layout configuration - omit or set positions to null/undefined for two-panel layouts */\n layout: PanelLayout;\n\n /** Custom data attributes for slot identification (for edit mode) */\n slotDataAttributes?: {\n left?: Record<string, string>;\n middle?: Record<string, string>;\n right?: Record<string, string>;\n };\n\n /** Which panels are collapsible - only specify for active panels */\n collapsiblePanels?: {\n left?: boolean;\n middle?: boolean;\n right?: boolean;\n };\n\n /** Default sizes for each panel (0-100, should sum to 100 for active panels) - only specify for active panels */\n defaultSizes?: {\n left?: number;\n middle?: number;\n right?: number;\n };\n\n /** Minimum sizes for each panel when expanded (0-100) - only specify for active panels */\n minSizes?: {\n left?: number;\n middle?: number;\n right?: number;\n };\n\n /** CSS class for the layout container */\n className?: string;\n\n /** Initial collapsed state for panels */\n collapsed?: {\n left?: boolean;\n middle?: boolean;\n right?: boolean;\n };\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Whether to show collapse/expand toggle buttons */\n showCollapseButtons?: boolean;\n\n /** Animation duration in milliseconds */\n animationDuration?: number;\n\n /** Animation easing function */\n animationEasing?: string;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Callbacks for panel events */\n onLeftCollapseStart?: () => void;\n onLeftCollapseComplete?: () => void;\n onLeftExpandStart?: () => void;\n onLeftExpandComplete?: () => void;\n onMiddleCollapseStart?: () => void;\n onMiddleCollapseComplete?: () => void;\n onMiddleExpandStart?: () => void;\n onMiddleExpandComplete?: () => void;\n onRightCollapseStart?: () => void;\n onRightCollapseComplete?: () => void;\n onRightExpandStart?: () => void;\n onRightExpandComplete?: () => void;\n onPanelResize?: (sizes: { left: number; middle: number; right: number }) => void;\n}\n\n/**\n * ConfigurablePanelLayout - A flexible panel layout that supports 2 or 3 panels\n *\n * Supports both two-panel and three-panel layouts:\n * - For two panels: omit or set unused positions to null/undefined (e.g., { left: 'panel1', right: 'panel2' })\n * - For three panels: define all positions (e.g., { left: 'panel1', middle: 'panel2', right: 'panel3' })\n *\n * The component automatically adjusts sizing and behavior based on active panels.\n */\nexport const ConfigurablePanelLayout: React.FC<ConfigurablePanelLayoutProps> = ({\n panels,\n layout,\n slotDataAttributes = {},\n collapsiblePanels = { left: true, middle: false, right: true },\n defaultSizes = { left: 20, middle: 60, right: 20 },\n minSizes = { left: 5, middle: 10, right: 5 },\n className = '',\n collapsed = { left: false, middle: false, right: false },\n style,\n showCollapseButtons = false,\n animationDuration = 300,\n animationEasing = 'cubic-bezier(0.4, 0, 0.2, 1)',\n theme,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n onLeftExpandStart,\n onLeftExpandComplete,\n onMiddleCollapseStart,\n onMiddleCollapseComplete,\n onMiddleExpandStart,\n onMiddleExpandComplete,\n onRightCollapseStart,\n onRightCollapseComplete,\n onRightExpandStart,\n onRightExpandComplete,\n onPanelResize,\n}) => {\n // Auto-detect which panels are active (have content)\n // Support both undefined and null for inactive panels\n const isLeftActive = layout.left !== null && layout.left !== undefined;\n const isMiddleActive = layout.middle !== null && layout.middle !== undefined;\n const isRightActive = layout.right !== null && layout.right !== undefined;\n\n // Compute smart defaults based on active panels\n const activeCount = [isLeftActive, isMiddleActive, isRightActive].filter(Boolean).length;\n\n // Smart defaults:\n // - Two panels: 50/50 split by default\n // - Three panels: 20/60/20 split by default\n // - One panel: 100%\n const computedDefaultSizes = {\n left: isLeftActive ? (defaultSizes?.left ?? (activeCount === 2 ? 50 : activeCount === 3 ? 20 : 100)) : 0,\n middle: isMiddleActive ? (defaultSizes?.middle ?? (activeCount === 2 ? 50 : activeCount === 3 ? 60 : 100)) : 0,\n right: isRightActive ? (defaultSizes?.right ?? (activeCount === 2 ? 50 : activeCount === 3 ? 20 : 100)) : 0,\n };\n\n const computedMinSizes = {\n left: minSizes?.left ?? 5,\n middle: minSizes?.middle ?? 10,\n right: minSizes?.right ?? 5,\n };\n\n // State for collapsed status - auto-collapse inactive panels\n const [leftCollapsed, setLeftCollapsed] = useState(collapsed.left || !isLeftActive);\n const [middleCollapsed, setMiddleCollapsed] = useState(collapsed.middle || !isMiddleActive);\n const [rightCollapsed, setRightCollapsed] = useState(collapsed.right || !isRightActive);\n\n // State for animation\n const [leftAnimating, setLeftAnimating] = useState(false);\n const [middleAnimating, setMiddleAnimating] = useState(false);\n const [rightAnimating, setRightAnimating] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n\n const leftFullyCollapsed = leftCollapsed && !leftAnimating;\n const middleFullyCollapsed = middleCollapsed && !middleAnimating;\n const rightFullyCollapsed = rightCollapsed && !rightAnimating;\n\n // Helper to get panel content by ID\n const getPanelContent = useCallback((panelId: string | null): ReactNode => {\n if (!panelId) return null;\n const panel = panels.find(p => p.id === panelId);\n return panel?.content || null;\n }, [panels]);\n\n // Helper to render a panel slot (handles single panels, groups, or null)\n const renderPanelSlot = useCallback((slot: PanelSlot): ReactNode => {\n if (slot === null) return null;\n\n // Check if it's a group\n if (typeof slot === 'object' && 'type' in slot) {\n const group = slot as PanelGroupType;\n if (group.type === 'tabs') {\n return (\n <TabGroup\n panelIds={group.panels}\n panels={panels}\n config={group.config as TabsConfig}\n theme={theme}\n />\n );\n }\n // TODO: Handle tiles when implemented\n return null;\n }\n\n // It's a single panel ID\n return getPanelContent(slot as string);\n }, [panels, getPanelContent, theme]);\n\n // Get actual panel content from layout\n const leftPanel = renderPanelSlot(layout.left ?? null);\n const middlePanel = renderPanelSlot(layout.middle ?? null);\n const rightPanel = renderPanelSlot(layout.right ?? null);\n\n // State for current sizes - set to 0 for inactive or collapsed panels\n const [leftSize, setLeftSize] = useState((collapsed.left || !isLeftActive) ? 0 : computedDefaultSizes.left);\n const [middleSize, setMiddleSize] = useState((collapsed.middle || !isMiddleActive) ? 0 : computedDefaultSizes.middle);\n const [rightSize, setRightSize] = useState((collapsed.right || !isRightActive) ? 0 : computedDefaultSizes.right);\n\n // State to preserve the last expanded size for collapsed panels\n const [lastExpandedLeftSize, setLastExpandedLeftSize] = useState(computedDefaultSizes.left);\n const [lastExpandedMiddleSize, setLastExpandedMiddleSize] = useState(computedDefaultSizes.middle);\n const [lastExpandedRightSize, setLastExpandedRightSize] = useState(computedDefaultSizes.right);\n\n // Panel refs\n const panelGroupRef = useRef<ImperativePanelGroupHandle>(null);\n const leftPanelRef = useRef<ImperativePanelHandle>(null);\n const middlePanelRef = useRef<ImperativePanelHandle>(null);\n const rightPanelRef = useRef<ImperativePanelHandle>(null);\n\n // Animation refs\n const leftAnimationFrameRef = useRef<number | undefined>(undefined);\n const middleAnimationFrameRef = useRef<number | undefined>(undefined);\n const rightAnimationFrameRef = useRef<number | undefined>(undefined);\n const leftStartTimeRef = useRef<number | undefined>(undefined);\n const middleStartTimeRef = useRef<number | undefined>(undefined);\n const rightStartTimeRef = useRef<number | undefined>(undefined);\n\n // Multi-panel animation function for coordinated resizing\n const animateMultiplePanels = useCallback(\n (\n animations: Array<{\n panelRef: React.RefObject<ImperativePanelHandle | null>;\n fromSize: number;\n toSize: number;\n animationFrameRef: React.MutableRefObject<number | undefined>;\n startTimeRef: React.MutableRefObject<number | undefined>;\n }>,\n onComplete?: () => void\n ) => {\n // Validate all panel refs exist\n const validAnimations = animations.filter(anim => anim.panelRef.current);\n if (validAnimations.length === 0) return;\n\n // Cancel any existing animations\n validAnimations.forEach(anim => {\n if (anim.animationFrameRef.current) {\n cancelAnimationFrame(anim.animationFrameRef.current);\n }\n });\n\n const steps = 10;\n let currentStep = 0;\n\n const animate = () => {\n currentStep++;\n const progress = currentStep / steps;\n\n if (progress >= 1) {\n // Final update - set all panels to their target sizes\n validAnimations.forEach(anim => {\n if (anim.panelRef.current) {\n if (anim.toSize === 0) {\n anim.panelRef.current.collapse();\n } else {\n anim.panelRef.current.resize(anim.toSize);\n }\n }\n });\n if (onComplete) onComplete();\n return;\n }\n\n // Apply easing\n const eased =\n progress < 0.5\n ? 4 * progress * progress * progress\n : 1 - Math.pow(-2 * progress + 2, 3) / 2;\n\n // Update all panels simultaneously\n validAnimations.forEach(anim => {\n if (anim.panelRef.current) {\n const newSize = anim.fromSize + (anim.toSize - anim.fromSize) * eased;\n anim.panelRef.current.resize(newSize);\n }\n });\n\n // Schedule next update (use the first animation's ref for tracking)\n validAnimations[0].animationFrameRef.current = requestAnimationFrame(() => {\n setTimeout(animate, animationDuration / steps);\n });\n };\n\n animate();\n },\n [animationDuration]\n );\n\n // Left panel collapse/expand handlers\n const handleLeftCollapse = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setLeftCollapsed(true);\n });\n if (onLeftCollapseStart) onLeftCollapseStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n // Remaining panels get space proportionally to their current sizes\n const remainingTotal = actualMiddleSize + actualRightSize;\n const newMiddleSize = remainingTotal > 0 ? (actualMiddleSize / remainingTotal) * 100 : (isMiddleActive ? 50 : 0);\n const newRightSize = remainingTotal > 0 ? (actualRightSize / remainingTotal) * 100 : (isRightActive ? 50 : 0);\n\n // Update last expanded sizes for middle and right panels\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: 0,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(0);\n setMiddleSize(newMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onLeftCollapseComplete) onLeftCollapseComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isMiddleActive,\n isRightActive,\n collapsiblePanels.left,\n animateMultiplePanels,\n onLeftCollapseStart,\n onLeftCollapseComplete,\n ]);\n\n const handleLeftExpand = useCallback(() => {\n if (leftAnimating || isDragging || !collapsiblePanels.left) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setLeftCollapsed(false);\n });\n if (onLeftExpandStart) onLeftExpandStart();\n\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n\n leftAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? 0) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Use the last expanded size to restore the panel to its previous size\n const targetLeftSize = lastExpandedLeftSize || computedDefaultSizes.left;\n\n // Calculate proportional redistribution for other panels\n // They need to shrink proportionally to make room\n const spaceForOthers = 100 - targetLeftSize;\n const currentOthersTotal = actualMiddleSize + actualRightSize;\n const newMiddleSize = currentOthersTotal > 0 ? (actualMiddleSize / currentOthersTotal) * spaceForOthers : (isMiddleActive ? spaceForOthers / 2 : 0);\n const newRightSize = currentOthersTotal > 0 ? (actualRightSize / currentOthersTotal) * spaceForOthers : (isRightActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for middle and right panels\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: targetLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(targetLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onLeftExpandComplete) onLeftExpandComplete();\n }\n );\n });\n }, [\n leftAnimating,\n isDragging,\n middleSize,\n rightSize,\n computedDefaultSizes.left,\n lastExpandedLeftSize,\n isMiddleActive,\n isRightActive,\n collapsiblePanels.left,\n animateMultiplePanels,\n onLeftExpandStart,\n onLeftExpandComplete,\n ]);\n\n // Right panel collapse/expand handlers\n const handleRightCollapse = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setRightCollapsed(true);\n });\n if (onRightCollapseStart) onRightCollapseStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n const remainingTotal = actualLeftSize + actualMiddleSize;\n const newLeftSize = remainingTotal > 0 ? (actualLeftSize / remainingTotal) * 100 : (isLeftActive ? 50 : 0);\n const newMiddleSize = remainingTotal > 0 ? (actualMiddleSize / remainingTotal) * 100 : (isMiddleActive ? 50 : 0);\n\n // Update last expanded sizes for left and middle panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: 0,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(0);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onRightCollapseComplete) onRightCollapseComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isLeftActive,\n isMiddleActive,\n collapsiblePanels.right,\n animateMultiplePanels,\n onRightCollapseStart,\n onRightCollapseComplete,\n ]);\n\n const handleRightExpand = useCallback(() => {\n if (rightAnimating || isDragging || !collapsiblePanels.right) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setRightCollapsed(false);\n });\n if (onRightExpandStart) onRightExpandStart();\n\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n\n rightAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? 0) * 1000) / 1000;\n\n // Use the last expanded size to restore the panel to its previous size\n const targetRightSize = lastExpandedRightSize || computedDefaultSizes.right;\n\n // Calculate proportional redistribution for other panels\n const spaceForOthers = 100 - targetRightSize;\n const currentOthersTotal = actualLeftSize + actualMiddleSize;\n const newLeftSize = currentOthersTotal > 0 ? (actualLeftSize / currentOthersTotal) * spaceForOthers : (isLeftActive ? spaceForOthers / 2 : 0);\n const newMiddleSize = currentOthersTotal > 0 ? (actualMiddleSize / currentOthersTotal) * spaceForOthers : (isMiddleActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for left and middle panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newMiddleSize > 0) setLastExpandedMiddleSize(newMiddleSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: newMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: targetRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(newMiddleSize);\n setRightSize(targetRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onRightExpandComplete) onRightExpandComplete();\n }\n );\n });\n }, [\n rightAnimating,\n isDragging,\n leftSize,\n middleSize,\n computedDefaultSizes.right,\n lastExpandedRightSize,\n isLeftActive,\n isMiddleActive,\n collapsiblePanels.right,\n animateMultiplePanels,\n onRightExpandStart,\n onRightExpandComplete,\n ]);\n\n // Toggle handlers\n const toggleLeftPanel = useCallback(() => {\n if (leftCollapsed) {\n handleLeftExpand();\n } else {\n handleLeftCollapse();\n }\n }, [leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n // Middle panel collapse/expand handlers\n const handleMiddleCollapse = useCallback(() => {\n if (middleAnimating || isDragging || !collapsiblePanels.middle) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setMiddleCollapsed(true);\n });\n if (onMiddleCollapseStart) onMiddleCollapseStart();\n\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n\n middleAnimationFrameRef.current = requestAnimationFrame(() => {\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? middleSize) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n // Calculate proportional redistribution\n const remainingTotal = actualLeftSize + actualRightSize;\n const newLeftSize = remainingTotal > 0 ? (actualLeftSize / remainingTotal) * 100 : (isLeftActive ? 50 : 0);\n const newRightSize = remainingTotal > 0 ? (actualRightSize / remainingTotal) * 100 : (isRightActive ? 50 : 0);\n\n // Update last expanded sizes for left and right panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: 0,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(0);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onMiddleCollapseComplete) onMiddleCollapseComplete();\n }\n );\n });\n }, [\n middleAnimating,\n isDragging,\n leftSize,\n middleSize,\n rightSize,\n isLeftActive,\n isRightActive,\n collapsiblePanels.middle,\n animateMultiplePanels,\n onMiddleCollapseStart,\n onMiddleCollapseComplete,\n ]);\n\n const handleMiddleExpand = useCallback(() => {\n if (middleAnimating || isDragging || !collapsiblePanels.middle) return;\n\n flushSync(() => {\n setLeftAnimating(true);\n setMiddleAnimating(true);\n setRightAnimating(true);\n setMiddleCollapsed(false);\n });\n if (onMiddleExpandStart) onMiddleExpandStart();\n\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n\n middleAnimationFrameRef.current = requestAnimationFrame(() => {\n // Get the actual current layout\n const currentLayout = panelGroupRef.current?.getLayout();\n const actualLeftSize = Math.round((currentLayout?.[0] ?? leftSize) * 1000) / 1000;\n const actualMiddleSize = Math.round((currentLayout?.[1] ?? 0) * 1000) / 1000;\n const actualRightSize = Math.round((currentLayout?.[2] ?? rightSize) * 1000) / 1000;\n\n const targetMiddleSize = lastExpandedMiddleSize || computedDefaultSizes.middle;\n\n // Calculate proportional redistribution for other panels\n const spaceForOthers = 100 - targetMiddleSize;\n const currentOthersTotal = actualLeftSize + actualRightSize;\n const newLeftSize = currentOthersTotal > 0 ? (actualLeftSize / currentOthersTotal) * spaceForOthers : (isLeftActive ? spaceForOthers / 2 : 0);\n const newRightSize = currentOthersTotal > 0 ? (actualRightSize / currentOthersTotal) * spaceForOthers : (isRightActive ? spaceForOthers / 2 : 0);\n\n // Update last expanded sizes for left and right panels\n if (newLeftSize > 0) setLastExpandedLeftSize(newLeftSize);\n if (newRightSize > 0) setLastExpandedRightSize(newRightSize);\n\n animateMultiplePanels(\n [\n {\n panelRef: leftPanelRef,\n fromSize: actualLeftSize,\n toSize: newLeftSize,\n animationFrameRef: leftAnimationFrameRef,\n startTimeRef: leftStartTimeRef,\n },\n {\n panelRef: middlePanelRef,\n fromSize: actualMiddleSize,\n toSize: targetMiddleSize,\n animationFrameRef: middleAnimationFrameRef,\n startTimeRef: middleStartTimeRef,\n },\n {\n panelRef: rightPanelRef,\n fromSize: actualRightSize,\n toSize: newRightSize,\n animationFrameRef: rightAnimationFrameRef,\n startTimeRef: rightStartTimeRef,\n },\n ],\n () => {\n setLeftSize(newLeftSize);\n setMiddleSize(targetMiddleSize);\n setRightSize(newRightSize);\n setLeftAnimating(false);\n setMiddleAnimating(false);\n setRightAnimating(false);\n if (onMiddleExpandComplete) onMiddleExpandComplete();\n }\n );\n });\n }, [\n middleAnimating,\n isDragging,\n leftSize,\n rightSize,\n computedDefaultSizes.middle,\n lastExpandedMiddleSize,\n isLeftActive,\n isRightActive,\n collapsiblePanels.middle,\n animateMultiplePanels,\n onMiddleExpandStart,\n onMiddleExpandComplete,\n ]);\n\n // Note: toggleMiddlePanel can be added if middle panel collapse buttons are needed\n // const toggleMiddlePanel = useCallback(() => {\n // if (middleCollapsed) {\n // handleMiddleExpand();\n // } else {\n // handleMiddleCollapse();\n // }\n // }, [middleCollapsed, handleMiddleCollapse, handleMiddleExpand]);\n\n const toggleRightPanel = useCallback(() => {\n if (rightCollapsed) {\n handleRightExpand();\n } else {\n handleRightCollapse();\n }\n }, [rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Resize handlers\n const handleLeftResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setLeftSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedLeftSize(size);\n setLeftCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n const handleMiddleResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setMiddleSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedMiddleSize(size);\n setMiddleCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n const handleRightResize = useCallback((size: number) => {\n if (!leftAnimating && !middleAnimating && !rightAnimating) {\n setRightSize(size);\n // Track the last expanded size (only when > 0)\n if (size > 0) {\n setLastExpandedRightSize(size);\n setRightCollapsed(false);\n }\n }\n }, [leftAnimating, middleAnimating, rightAnimating]);\n\n // Drag handlers\n const handleDragEnd = useCallback(() => {\n if (onPanelResize) {\n // Use the last expanded size for collapsed panels to preserve their size\n const reportedLeftSize = leftCollapsed ? lastExpandedLeftSize : leftSize;\n const reportedMiddleSize = middleCollapsed ? lastExpandedMiddleSize : middleSize;\n const reportedRightSize = rightCollapsed ? lastExpandedRightSize : rightSize;\n\n onPanelResize({\n left: reportedLeftSize,\n middle: reportedMiddleSize,\n right: reportedRightSize,\n });\n }\n }, [leftSize, middleSize, rightSize, leftCollapsed, middleCollapsed, rightCollapsed, lastExpandedLeftSize, lastExpandedMiddleSize, lastExpandedRightSize, onPanelResize]);\n\n const handleDragging = useCallback(\n (dragging: boolean) => {\n setIsDragging(dragging);\n if (!dragging) {\n handleDragEnd();\n }\n },\n [handleDragEnd]\n );\n\n // Effect for external collapsed prop changes\n useEffect(() => {\n if (collapsed.left !== undefined && collapsed.left !== leftCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.left) {\n handleLeftCollapse();\n } else {\n handleLeftExpand();\n }\n });\n }\n }, [collapsed.left, leftCollapsed, handleLeftCollapse, handleLeftExpand]);\n\n useEffect(() => {\n if (collapsed.middle !== undefined && collapsed.middle !== middleCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.middle) {\n handleMiddleCollapse();\n } else {\n handleMiddleExpand();\n }\n });\n }\n }, [collapsed.middle, middleCollapsed, handleMiddleCollapse, handleMiddleExpand]);\n\n useEffect(() => {\n if (collapsed.right !== undefined && collapsed.right !== rightCollapsed) {\n // Defer to next tick to avoid flushSync warning\n queueMicrotask(() => {\n if (collapsed.right) {\n handleRightCollapse();\n } else {\n handleRightExpand();\n }\n });\n }\n }, [collapsed.right, rightCollapsed, handleRightCollapse, handleRightExpand]);\n\n // Cleanup\n useEffect(() => {\n return () => {\n if (leftAnimationFrameRef.current) {\n cancelAnimationFrame(leftAnimationFrameRef.current);\n }\n if (middleAnimationFrameRef.current) {\n cancelAnimationFrame(middleAnimationFrameRef.current);\n }\n if (rightAnimationFrameRef.current) {\n cancelAnimationFrame(rightAnimationFrameRef.current);\n }\n };\n }, []);\n\n // Panel class helper\n const getPanelClassName = (panelName: 'left' | 'middle' | 'right') => {\n let className = 'three-panel-item';\n\n if (panelName === 'left') {\n if (collapsiblePanels.left || !isLeftActive) {\n className += ' collapsible-panel';\n if (leftAnimating && !isDragging) className += ' animating';\n if (leftFullyCollapsed) className += ' collapsed';\n }\n } else if (panelName === 'middle') {\n className += ' middle-panel';\n if (collapsiblePanels.middle || !isMiddleActive) {\n className += ' collapsible-panel';\n if (middleAnimating && !isDragging) className += ' animating';\n if (middleFullyCollapsed) className += ' collapsed';\n }\n } else if (panelName === 'right') {\n if (collapsiblePanels.right || !isRightActive) {\n className += ' collapsible-panel';\n if (rightAnimating && !isDragging) className += ' animating';\n if (rightFullyCollapsed) className += ' collapsed';\n }\n }\n\n return className;\n };\n\n const leftCollapsiblePanelStyle =\n leftAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: leftCollapsed ? '0%' : `${computedDefaultSizes.left}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n const middleCollapsiblePanelStyle =\n middleAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: middleCollapsed ? '0%' : `${computedDefaultSizes.middle}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n const rightCollapsiblePanelStyle =\n rightAnimating && !isDragging\n ? ({\n transition: `width ${animationDuration}ms ${animationEasing}`,\n width: rightCollapsed ? '0%' : `${computedDefaultSizes.right}%`\n } satisfies React.CSSProperties)\n : undefined;\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n const leftPanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.left;\n const middlePanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.middle;\n const rightPanelMinSize = leftAnimating || middleAnimating || rightAnimating ? 0 : computedMinSizes.right;\n\n return (\n <div className={`three-panel-layout ${className}`} style={{ ...themeStyles, ...style }}>\n <PanelGroup ref={panelGroupRef} direction=\"horizontal\" onLayout={handleDragEnd}>\n {/* Left Panel */}\n <Panel\n ref={leftPanelRef}\n collapsible={collapsiblePanels.left || !isLeftActive}\n defaultSize={(collapsed.left || !isLeftActive) ? 0 : computedDefaultSizes.left}\n minSize={leftPanelMinSize}\n collapsedSize={0}\n onResize={handleLeftResize}\n onCollapse={() => setLeftCollapsed(true)}\n onExpand={() => setLeftCollapsed(false)}\n className={getPanelClassName('left')}\n style={leftCollapsiblePanelStyle}\n {...(slotDataAttributes.left || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: leftCollapsed ? 0 : 1,\n transition: leftAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {leftPanel}\n </div>\n </Panel>\n\n {/* Left Resize Handle - between left and middle */}\n <PanelResizeHandle\n className={`resize-handle left-handle ${leftFullyCollapsed || !isLeftActive || !isMiddleActive ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={leftFullyCollapsed || !isLeftActive || !isMiddleActive}\n >\n {showCollapseButtons && collapsiblePanels.left && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleLeftPanel}\n className=\"collapse-toggle\"\n disabled={leftAnimating}\n aria-label={leftCollapsed ? 'Expand left panel' : 'Collapse left panel'}\n >\n {leftCollapsed ? '▸' : '◂'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Middle Panel */}\n <Panel\n ref={middlePanelRef}\n collapsible={collapsiblePanels.middle || !isMiddleActive}\n defaultSize={(collapsed.middle || !isMiddleActive) ? 0 : computedDefaultSizes.middle}\n minSize={middlePanelMinSize}\n collapsedSize={0}\n onResize={handleMiddleResize}\n onCollapse={() => setMiddleCollapsed(true)}\n onExpand={() => setMiddleCollapsed(false)}\n className={getPanelClassName('middle')}\n style={middleCollapsiblePanelStyle}\n {...(slotDataAttributes.middle || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: middleCollapsed ? 0 : 1,\n transition: middleAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {middlePanel}\n </div>\n </Panel>\n\n {/* Right Resize Handle - between middle and right, OR between left and right if middle is inactive */}\n <PanelResizeHandle\n className={`resize-handle right-handle ${rightFullyCollapsed || !isRightActive || (!isMiddleActive && !isLeftActive) ? 'collapsed' : ''}`}\n onDragging={handleDragging}\n disabled={rightFullyCollapsed || !isRightActive || (!isMiddleActive && !isLeftActive)}\n >\n {showCollapseButtons && collapsiblePanels.right && (\n <div className=\"handle-bar\">\n <button\n onClick={toggleRightPanel}\n className=\"collapse-toggle\"\n disabled={rightAnimating}\n aria-label={rightCollapsed ? 'Expand right panel' : 'Collapse right panel'}\n >\n {rightCollapsed ? '◂' : '▸'}\n </button>\n </div>\n )}\n </PanelResizeHandle>\n\n {/* Right Panel */}\n <Panel\n ref={rightPanelRef}\n collapsible={collapsiblePanels.right || !isRightActive}\n defaultSize={(collapsed.right || !isRightActive) ? 0 : computedDefaultSizes.right}\n minSize={rightPanelMinSize}\n collapsedSize={0}\n onResize={handleRightResize}\n onCollapse={() => setRightCollapsed(true)}\n onExpand={() => setRightCollapsed(false)}\n className={getPanelClassName('right')}\n style={rightCollapsiblePanelStyle}\n {...(slotDataAttributes.right || {})}\n >\n <div\n className=\"panel-content-wrapper\"\n style={{\n opacity: rightCollapsed ? 0 : 1,\n transition: rightAnimating\n ? `opacity ${animationDuration * 0.5}ms ${animationEasing}`\n : 'none',\n }}\n >\n {rightPanel}\n </div>\n </Panel>\n </PanelGroup>\n </div>\n );\n};","import React, { ReactNode, useRef, useImperativeHandle, forwardRef, useEffect } from 'react';\nimport { Theme } from '@principal-ade/industry-theme';\nimport { mapThemeToPanelVars } from '../utils/themeMapping';\nimport './SnapCarousel.css';\n\nexport interface SnapCarouselRef {\n /** Scroll to a specific panel by index */\n scrollToPanel: (index: number) => void;\n /** Get the current panel index */\n getCurrentPanel: () => number;\n}\n\nexport interface SnapCarouselProps {\n /** Array of panel content to display in the carousel */\n panels: ReactNode[];\n\n /** CSS class for the carousel container */\n className?: string;\n\n /** Additional styles to apply to the container */\n style?: React.CSSProperties;\n\n /** Theme object for customizing colors */\n theme: Theme;\n\n /** Minimum width for each panel (default: 350px). For 2-panel layouts, the threshold for switching to 50% width is 2x this value. */\n minPanelWidth?: number;\n\n /** Ideal width for each panel as a fraction of container width (default: 0.333 for 1/3 of container) */\n idealPanelWidth?: number;\n\n /** Whether to show a 1px separator between panels (default: false) */\n showSeparator?: boolean;\n\n /** Callback when a panel comes into view */\n onPanelChange?: (index: number) => void;\n\n /** Prevent keyboard keys (space, arrows, page up/down) from scrolling the carousel. Useful when panels contain interactive input components like terminals or text editors. (default: true) */\n preventKeyboardScroll?: boolean;\n}\n\n/**\n * SnapCarousel - A horizontally scrolling carousel with snap points\n *\n * Responsive behavior:\n * - 1 panel: 100% width of container\n * - 2 panels: 100% width by default, switches to 50% when container width > 2x minPanelWidth (default: 700px)\n * - 3+ panels: Uses max(minPanelWidth, idealPanelWidth%) of container width\n */\nexport const SnapCarousel = forwardRef<SnapCarouselRef, SnapCarouselProps>(({\n panels,\n className = '',\n style,\n theme,\n minPanelWidth = 350,\n idealPanelWidth = 0.333, // 1/3 of container\n showSeparator = false,\n onPanelChange,\n preventKeyboardScroll = true,\n}, ref) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Apply theme as CSS variables\n const themeStyles = mapThemeToPanelVars(theme) as React.CSSProperties;\n\n // Expose methods to parent via ref\n useImperativeHandle(ref, () => ({\n scrollToPanel: (index: number) => {\n if (!containerRef.current) return;\n\n const container = containerRef.current;\n const targetPanel = container.children[index] as HTMLElement;\n\n if (targetPanel) {\n // Calculate the scroll position directly instead of using scrollIntoView\n // This prevents scrolling ancestor containers\n const scrollLeft = targetPanel.offsetLeft;\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n });\n }\n },\n getCurrentPanel: () => {\n if (!containerRef.current || containerRef.current.children.length === 0) return 0;\n\n const container = containerRef.current;\n const containerRect = container.getBoundingClientRect();\n\n // The snap point is the left edge of the container\n const snapPointX = containerRect.left;\n\n // Find which panel's left edge is closest to the snap point\n let closestIndex = 0;\n let closestDistance = Infinity;\n\n for (let i = 0; i < container.children.length; i++) {\n const panel = container.children[i] as HTMLElement;\n const panelRect = panel.getBoundingClientRect();\n\n // Distance from this panel's left edge to the snap point\n const distance = Math.abs(panelRect.left - snapPointX);\n\n if (distance < closestDistance) {\n closestDistance = distance;\n closestIndex = i;\n }\n }\n\n return closestIndex;\n },\n }));\n\n // Handle scroll to track which panel is in view\n const handleScroll = (_e: React.UIEvent<HTMLDivElement>) => {\n if (!onPanelChange || !containerRef.current || containerRef.current.children.length === 0) return;\n\n const container = containerRef.current;\n const containerRect = container.getBoundingClientRect();\n\n // The snap point is the left edge of the container\n const snapPointX = containerRect.left;\n\n // Find which panel's left edge is closest to the snap point\n let closestIndex = 0;\n let closestDistance = Infinity;\n\n for (let i = 0; i < container.children.length; i++) {\n const panel = container.children[i] as HTMLElement;\n const panelRect = panel.getBoundingClientRect();\n\n // Distance from this panel's left edge to the snap point\n const distance = Math.abs(panelRect.left - snapPointX);\n\n if (distance < closestDistance) {\n closestDistance = distance;\n closestIndex = i;\n }\n }\n\n onPanelChange(closestIndex);\n };\n\n // Prevent keyboard-triggered scrolling when enabled\n useEffect(() => {\n if (!preventKeyboardScroll || !containerRef.current) return;\n\n const container = containerRef.current;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n // Don't prevent keyboard events if they're targeting interactive elements\n const target = e.target as HTMLElement;\n const isInteractive =\n target.tagName === 'INPUT' ||\n target.tagName === 'TEXTAREA' ||\n target.tagName === 'SELECT' ||\n target.isContentEditable ||\n target.closest('.xterm') !== null || // Terminal elements\n target.closest('[contenteditable=\"true\"]') !== null;\n\n if (isInteractive) {\n return; // Let the event through to the interactive element\n }\n\n // Prevent keys that trigger browser scrolling\n const scrollKeys = [' ', 'Space', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'PageUp', 'PageDown'];\n\n if (scrollKeys.includes(e.key)) {\n e.preventDefault();\n }\n };\n\n container.addEventListener('keydown', handleKeyDown);\n\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [preventKeyboardScroll]);\n\n // Calculate panel count for responsive sizing\n const panelCount = panels.length;\n\n // Calculate threshold for 2-panel layout: 2x minPanelWidth\n const twoPanelThreshold = minPanelWidth * 2;\n\n // Set panel width based on count\n let panelWidth: string;\n if (panelCount === 1) {\n panelWidth = '100%';\n } else if (panelCount === 2) {\n // For 2 panels, use 50% if parent > threshold, else 100%\n // We'll use container queries in CSS for this\n panelWidth = '100%'; // Default, CSS container query will override\n } else {\n // 3+ panels: use the maximum of minPanelWidth or idealPanelWidth% of container\n // This ensures panels are at least minPanelWidth wide, but can be larger if needed\n // For full-width mobile panels, set minPanelWidth to 0\n panelWidth = `max(${minPanelWidth}px, ${idealPanelWidth * 100}%)`;\n }\n\n // Generate unique ID for this carousel instance to scope the dynamic styles\n const carouselId = React.useId().replace(/:/g, '_');\n\n return (\n <>\n {/* Dynamic styles for 2-panel threshold */}\n {panelCount === 2 && (\n <style>\n {`\n .snap-carousel-container[data-carousel-id=\"${carouselId}\"][data-panel-count=\"2\"] .snap-carousel-panel {\n width: 100%;\n }\n @container (min-width: ${twoPanelThreshold}px) {\n .snap-carousel-container[data-carousel-id=\"${carouselId}\"][data-panel-count=\"2\"] .snap-carousel-panel {\n width: 50%;\n }\n }\n `}\n </style>\n )}\n <div\n ref={containerRef}\n className={`snap-carousel-container ${className}`}\n style={{\n ...themeStyles,\n ...style,\n '--snap-carousel-min-width': `${minPanelWidth}px`,\n '--snap-carousel-ideal-width': `${idealPanelWidth * 100}%`,\n '--snap-carousel-gap': showSeparator ? '1px' : '0px',\n '--snap-carousel-panel-width': panelWidth,\n '--snap-carousel-panel-count': panelCount,\n '--snap-carousel-two-panel-threshold': `${twoPanelThreshold}px`,\n } as React.CSSProperties}\n onScroll={handleScroll}\n data-panel-count={panelCount}\n data-carousel-id={carouselId}\n >\n {panels.map((panel, index) => (\n <div key={index} className=\"snap-carousel-panel\">\n {panel}\n </div>\n ))}\n </div>\n </>\n );\n});\n\nSnapCarousel.displayName = 'SnapCarousel';\n","import { useState, useEffect } from 'react';\n\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(query).matches;\n }\n return false;\n });\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const mediaQuery = window.matchMedia(query);\n const handler = (event: MediaQueryListEvent) => {\n setMatches(event.matches);\n };\n\n setMatches(mediaQuery.matches);\n\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n } else {\n mediaQuery.addListener(handler);\n return () => mediaQuery.removeListener(handler);\n }\n }, [query]);\n\n return matches;\n}","import React, { ReactNode, useMemo } from 'react';\nimport { ConfigurablePanelLayout, ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';\nimport { PanelGroup as PanelGroupType, PanelSlot, TabsConfig } from './PanelConfigurator';\nimport { TabGroup } from './TabGroup';\nimport { SnapCarousel, SnapCarouselProps } from './SnapCarousel';\nimport { useMediaQuery } from '../hooks/useMediaQuery';\n\nexport interface ResponsiveConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {\n /**\n * Media query used to determine when to switch to the mobile carousel layout.\n * Defaults to `(max-width: 768px)`.\n */\n mobileBreakpoint?: string;\n\n /**\n * Additional props passed to the SnapCarousel when the mobile layout is active.\n * The `panels` and `theme` props are managed by this component.\n */\n mobileCarouselProps?: Omit<SnapCarouselProps, 'panels' | 'theme'>;\n}\n\n/**\n * ResponsiveConfigurablePanelLayout - Renders ConfigurablePanelLayout on desktop widths\n * and automatically swaps to a SnapCarousel-powered experience on mobile.\n */\nexport const ResponsiveConfigurablePanelLayout: React.FC<ResponsiveConfigurablePanelLayoutProps> = ({\n mobileBreakpoint = '(max-width: 768px)',\n mobileCarouselProps,\n theme,\n layout,\n panels,\n ...rest\n}) => {\n const isMobile = useMediaQuery(mobileBreakpoint);\n\n const orderedSlots: (PanelSlot | undefined)[] = useMemo(() => [layout?.left, layout?.middle, layout?.right], [layout]);\n\n const mobilePanels = useMemo(() => {\n const getPanelContent = (panelId: string | null): ReactNode => {\n if (!panelId) return null;\n const panel = panels.find(p => p.id === panelId);\n return panel?.content ?? null;\n };\n\n const renderPanelSlot = (slot: PanelSlot | undefined): ReactNode | null => {\n if (slot === null || slot === undefined) return null;\n\n if (typeof slot === 'object' && 'type' in slot) {\n const group = slot as PanelGroupType;\n if (group.type === 'tabs') {\n return (\n <TabGroup\n panelIds={group.panels}\n panels={panels}\n config={group.config as TabsConfig}\n theme={theme}\n />\n );\n }\n // Future group types (e.g., tiles) can be added here\n return null;\n }\n\n return getPanelContent(slot);\n };\n\n return orderedSlots\n .map(renderPanelSlot)\n .filter((panelContent): panelContent is ReactNode => panelContent !== null);\n }, [orderedSlots, panels, theme]);\n\n if (isMobile) {\n if (mobilePanels.length === 0) {\n return null;\n }\n\n return (\n <SnapCarousel\n theme={theme}\n panels={mobilePanels}\n minPanelWidth={0}\n idealPanelWidth={1}\n {...mobileCarouselProps}\n />\n );\n }\n\n return (\n <ConfigurablePanelLayout\n theme={theme}\n layout={layout}\n panels={panels}\n {...rest}\n />\n );\n};\n","import { useMemo, useLayoutEffect, useEffect, useRef, useCallback } from 'react';\n\nfunction useCombinedRefs() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n\n return useMemo(() => node => {\n refs.forEach(ref => ref(node));\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n refs);\n}\n\n// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js\nconst canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';\n\nfunction isWindow(element) {\n const elementString = Object.prototype.toString.call(element);\n return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]\n elementString === '[object global]';\n}\n\nfunction isNode(node) {\n return 'nodeType' in node;\n}\n\nfunction getWindow(target) {\n var _target$ownerDocument, _target$ownerDocument2;\n\n if (!target) {\n return window;\n }\n\n if (isWindow(target)) {\n return target;\n }\n\n if (!isNode(target)) {\n return window;\n }\n\n return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;\n}\n\nfunction isDocument(node) {\n const {\n Document\n } = getWindow(node);\n return node instanceof Document;\n}\n\nfunction isHTMLElement(node) {\n if (isWindow(node)) {\n return false;\n }\n\n return node instanceof getWindow(node).HTMLElement;\n}\n\nfunction isSVGElement(node) {\n return node instanceof getWindow(node).SVGElement;\n}\n\nfunction getOwnerDocument(target) {\n if (!target) {\n return document;\n }\n\n if (isWindow(target)) {\n return target.document;\n }\n\n if (!isNode(target)) {\n return document;\n }\n\n if (isDocument(target)) {\n return target;\n }\n\n if (isHTMLElement(target) || isSVGElement(target)) {\n return target.ownerDocument;\n }\n\n return document;\n}\n\n/**\r\n * A hook that resolves to useEffect on the server and useLayoutEffect on the client\r\n * @param callback {function} Callback function that is invoked when the dependencies of the hook change\r\n */\n\nconst useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;\n\nfunction useEvent(handler) {\n const handlerRef = useRef(handler);\n useIsomorphicLayoutEffect(() => {\n handlerRef.current = handler;\n });\n return useCallback(function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return handlerRef.current == null ? void 0 : handlerRef.current(...args);\n }, []);\n}\n\nfunction useInterval() {\n const intervalRef = useRef(null);\n const set = useCallback((listener, duration) => {\n intervalRef.current = setInterval(listener, duration);\n }, []);\n const clear = useCallback(() => {\n if (intervalRef.current !== null) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n return [set, clear];\n}\n\nfunction useLatestValue(value, dependencies) {\n if (dependencies === void 0) {\n dependencies = [value];\n }\n\n const valueRef = useRef(value);\n useIsomorphicLayoutEffect(() => {\n if (valueRef.current !== value) {\n valueRef.current = value;\n }\n }, dependencies);\n return valueRef;\n}\n\nfunction useLazyMemo(callback, dependencies) {\n const valueRef = useRef();\n return useMemo(() => {\n const newValue = callback(valueRef.current);\n valueRef.current = newValue;\n return newValue;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [...dependencies]);\n}\n\nfunction useNodeRef(onChange) {\n const onChangeHandler = useEvent(onChange);\n const node = useRef(null);\n const setNodeRef = useCallback(element => {\n if (element !== node.current) {\n onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);\n }\n\n node.current = element;\n }, //eslint-disable-next-line\n []);\n return [node, setNodeRef];\n}\n\nfunction usePrevious(value) {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n\nlet ids = {};\nfunction useUniqueId(prefix, value) {\n return useMemo(() => {\n if (value) {\n return value;\n }\n\n const id = ids[prefix] == null ? 0 : ids[prefix] + 1;\n ids[prefix] = id;\n return prefix + \"-\" + id;\n }, [prefix, value]);\n}\n\nfunction createAdjustmentFn(modifier) {\n return function (object) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((accumulator, adjustment) => {\n const entries = Object.entries(adjustment);\n\n for (const [key, valueAdjustment] of entries) {\n const value = accumulator[key];\n\n if (value != null) {\n accumulator[key] = value + modifier * valueAdjustment;\n }\n }\n\n return accumulator;\n }, { ...object\n });\n };\n}\n\nconst add = /*#__PURE__*/createAdjustmentFn(1);\nconst subtract = /*#__PURE__*/createAdjustmentFn(-1);\n\nfunction hasViewportRelativeCoordinates(event) {\n return 'clientX' in event && 'clientY' in event;\n}\n\nfunction isKeyboardEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n KeyboardEvent\n } = getWindow(event.target);\n return KeyboardEvent && event instanceof KeyboardEvent;\n}\n\nfunction isTouchEvent(event) {\n if (!event) {\n return false;\n }\n\n const {\n TouchEvent\n } = getWindow(event.target);\n return TouchEvent && event instanceof TouchEvent;\n}\n\n/**\r\n * Returns the normalized x and y coordinates for mouse and touch events.\r\n */\n\nfunction getEventCoordinates(event) {\n if (isTouchEvent(event)) {\n if (event.touches && event.touches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.touches[0];\n return {\n x,\n y\n };\n } else if (event.changedTouches && event.changedTouches.length) {\n const {\n clientX: x,\n clientY: y\n } = event.changedTouches[0];\n return {\n x,\n y\n };\n }\n }\n\n if (hasViewportRelativeCoordinates(event)) {\n return {\n x: event.clientX,\n y: event.clientY\n };\n }\n\n return null;\n}\n\nconst CSS = /*#__PURE__*/Object.freeze({\n Translate: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n x,\n y\n } = transform;\n return \"translate3d(\" + (x ? Math.round(x) : 0) + \"px, \" + (y ? Math.round(y) : 0) + \"px, 0)\";\n }\n\n },\n Scale: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n const {\n scaleX,\n scaleY\n } = transform;\n return \"scaleX(\" + scaleX + \") scaleY(\" + scaleY + \")\";\n }\n\n },\n Transform: {\n toString(transform) {\n if (!transform) {\n return;\n }\n\n return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' ');\n }\n\n },\n Transition: {\n toString(_ref) {\n let {\n property,\n duration,\n easing\n } = _ref;\n return property + \" \" + duration + \"ms \" + easing;\n }\n\n }\n});\n\nconst SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]';\nfunction findFirstFocusableNode(element) {\n if (element.matches(SELECTOR)) {\n return element;\n }\n\n return element.querySelector(SELECTOR);\n}\n\nexport { CSS, add, canUseDOM, findFirstFocusableNode, getEventCoordinates, getOwnerDocument, getWindow, hasViewportRelativeCoordinates, isDocument, isHTMLElement, isKeyboardEvent, isNode, isSVGElement, isTouchEvent, isWindow, subtract, useCombinedRefs, useEvent, useInterval, useIsomorphicLayoutEffect, useLatestValue, useLazyMemo, useNodeRef, usePrevious, useUniqueId };\n//# sourceMappingURL=utilities.esm.js.map\n","import React, { useState, useCallback } from 'react';\n\nconst hiddenStyles = {\n display: 'none'\n};\nfunction HiddenText(_ref) {\n let {\n id,\n value\n } = _ref;\n return React.createElement(\"div\", {\n id: id,\n style: hiddenStyles\n }, value);\n}\n\nfunction LiveRegion(_ref) {\n let {\n id,\n announcement,\n ariaLiveType = \"assertive\"\n } = _ref;\n // Hide element visually but keep it readable by screen readers\n const visuallyHidden = {\n position: 'fixed',\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n margin: -1,\n border: 0,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(100%)',\n whiteSpace: 'nowrap'\n };\n return React.createElement(\"div\", {\n id: id,\n style: visuallyHidden,\n role: \"status\",\n \"aria-live\": ariaLiveType,\n \"aria-atomic\": true\n }, announcement);\n}\n\nfunction useAnnouncement() {\n const [announcement, setAnnouncement] = useState('');\n const announce = useCallback(value => {\n if (value != null) {\n setAnnouncement(value);\n }\n }, []);\n return {\n announce,\n announcement\n };\n}\n\nexport { HiddenText, LiveRegion, useAnnouncement };\n//# sourceMappingURL=accessibility.esm.js.map\n","import React, { createContext, useContext, useEffect, useState, useCallback, useMemo, useRef, memo, useReducer, cloneElement, forwardRef } from 'react';\nimport { createPortal, unstable_batchedUpdates } from 'react-dom';\nimport { useUniqueId, getEventCoordinates, getWindow, isDocument, isHTMLElement, isSVGElement, canUseDOM, isWindow, isNode, getOwnerDocument, add, isKeyboardEvent, subtract, useLazyMemo, useInterval, usePrevious, useLatestValue, useEvent, useIsomorphicLayoutEffect, useNodeRef, findFirstFocusableNode, CSS } from '@dnd-kit/utilities';\nimport { useAnnouncement, HiddenText, LiveRegion } from '@dnd-kit/accessibility';\n\nconst DndMonitorContext = /*#__PURE__*/createContext(null);\n\nfunction useDndMonitor(listener) {\n const registerListener = useContext(DndMonitorContext);\n useEffect(() => {\n if (!registerListener) {\n throw new Error('useDndMonitor must be used within a children of <DndContext>');\n }\n\n const unsubscribe = registerListener(listener);\n return unsubscribe;\n }, [listener, registerListener]);\n}\n\nfunction useDndMonitorProvider() {\n const [listeners] = useState(() => new Set());\n const registerListener = useCallback(listener => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n }, [listeners]);\n const dispatch = useCallback(_ref => {\n let {\n type,\n event\n } = _ref;\n listeners.forEach(listener => {\n var _listener$type;\n\n return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);\n });\n }, [listeners]);\n return [dispatch, registerListener];\n}\n\nconst defaultScreenReaderInstructions = {\n draggable: \"\\n To pick up a draggable item, press the space bar.\\n While dragging, use the arrow keys to move the item.\\n Press space again to drop the item in its new position, or press escape to cancel.\\n \"\n};\nconst defaultAnnouncements = {\n onDragStart(_ref) {\n let {\n active\n } = _ref;\n return \"Picked up draggable item \" + active.id + \".\";\n },\n\n onDragOver(_ref2) {\n let {\n active,\n over\n } = _ref2;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was moved over droppable area \" + over.id + \".\";\n }\n\n return \"Draggable item \" + active.id + \" is no longer over a droppable area.\";\n },\n\n onDragEnd(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (over) {\n return \"Draggable item \" + active.id + \" was dropped over droppable area \" + over.id;\n }\n\n return \"Draggable item \" + active.id + \" was dropped.\";\n },\n\n onDragCancel(_ref4) {\n let {\n active\n } = _ref4;\n return \"Dragging was cancelled. Draggable item \" + active.id + \" was dropped.\";\n }\n\n};\n\nfunction Accessibility(_ref) {\n let {\n announcements = defaultAnnouncements,\n container,\n hiddenTextDescribedById,\n screenReaderInstructions = defaultScreenReaderInstructions\n } = _ref;\n const {\n announce,\n announcement\n } = useAnnouncement();\n const liveRegionId = useUniqueId(\"DndLiveRegion\");\n const [mounted, setMounted] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n useDndMonitor(useMemo(() => ({\n onDragStart(_ref2) {\n let {\n active\n } = _ref2;\n announce(announcements.onDragStart({\n active\n }));\n },\n\n onDragMove(_ref3) {\n let {\n active,\n over\n } = _ref3;\n\n if (announcements.onDragMove) {\n announce(announcements.onDragMove({\n active,\n over\n }));\n }\n },\n\n onDragOver(_ref4) {\n let {\n active,\n over\n } = _ref4;\n announce(announcements.onDragOver({\n active,\n over\n }));\n },\n\n onDragEnd(_ref5) {\n let {\n active,\n over\n } = _ref5;\n announce(announcements.onDragEnd({\n active,\n over\n }));\n },\n\n onDragCancel(_ref6) {\n let {\n active,\n over\n } = _ref6;\n announce(announcements.onDragCancel({\n active,\n over\n }));\n }\n\n }), [announce, announcements]));\n\n if (!mounted) {\n return null;\n }\n\n const markup = React.createElement(React.Fragment, null, React.createElement(HiddenText, {\n id: hiddenTextDescribedById,\n value: screenReaderInstructions.draggable\n }), React.createElement(LiveRegion, {\n id: liveRegionId,\n announcement: announcement\n }));\n return container ? createPortal(markup, container) : markup;\n}\n\nvar Action;\n\n(function (Action) {\n Action[\"DragStart\"] = \"dragStart\";\n Action[\"DragMove\"] = \"dragMove\";\n Action[\"DragEnd\"] = \"dragEnd\";\n Action[\"DragCancel\"] = \"dragCancel\";\n Action[\"DragOver\"] = \"dragOver\";\n Action[\"RegisterDroppable\"] = \"registerDroppable\";\n Action[\"SetDroppableDisabled\"] = \"setDroppableDisabled\";\n Action[\"UnregisterDroppable\"] = \"unregisterDroppable\";\n})(Action || (Action = {}));\n\nfunction noop() {}\n\nfunction useSensor(sensor, options) {\n return useMemo(() => ({\n sensor,\n options: options != null ? options : {}\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [sensor, options]);\n}\n\nfunction useSensors() {\n for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {\n sensors[_key] = arguments[_key];\n }\n\n return useMemo(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps\n [...sensors]);\n}\n\nconst defaultCoordinates = /*#__PURE__*/Object.freeze({\n x: 0,\n y: 0\n});\n\n/**\r\n * Returns the distance between two points\r\n */\nfunction distanceBetween(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\nfunction getRelativeTransformOrigin(event, rect) {\n const eventCoordinates = getEventCoordinates(event);\n\n if (!eventCoordinates) {\n return '0 0';\n }\n\n const transformOrigin = {\n x: (eventCoordinates.x - rect.left) / rect.width * 100,\n y: (eventCoordinates.y - rect.top) / rect.height * 100\n };\n return transformOrigin.x + \"% \" + transformOrigin.y + \"%\";\n}\n\n/**\r\n * Sort collisions from smallest to greatest value\r\n */\nfunction sortCollisionsAsc(_ref, _ref2) {\n let {\n data: {\n value: a\n }\n } = _ref;\n let {\n data: {\n value: b\n }\n } = _ref2;\n return a - b;\n}\n/**\r\n * Sort collisions from greatest to smallest value\r\n */\n\nfunction sortCollisionsDesc(_ref3, _ref4) {\n let {\n data: {\n value: a\n }\n } = _ref3;\n let {\n data: {\n value: b\n }\n } = _ref4;\n return b - a;\n}\n/**\r\n * Returns the coordinates of the corners of a given rectangle:\r\n * [TopLeft {x, y}, TopRight {x, y}, BottomLeft {x, y}, BottomRight {x, y}]\r\n */\n\nfunction cornersOfRectangle(_ref5) {\n let {\n left,\n top,\n height,\n width\n } = _ref5;\n return [{\n x: left,\n y: top\n }, {\n x: left + width,\n y: top\n }, {\n x: left,\n y: top + height\n }, {\n x: left + width,\n y: top + height\n }];\n}\nfunction getFirstCollision(collisions, property) {\n if (!collisions || collisions.length === 0) {\n return null;\n }\n\n const [firstCollision] = collisions;\n return property ? firstCollision[property] : firstCollision;\n}\n\n/**\r\n * Returns the coordinates of the center of a given ClientRect\r\n */\n\nfunction centerOfRectangle(rect, left, top) {\n if (left === void 0) {\n left = rect.left;\n }\n\n if (top === void 0) {\n top = rect.top;\n }\n\n return {\n x: left + rect.width * 0.5,\n y: top + rect.height * 0.5\n };\n}\n/**\r\n * Returns the closest rectangles from an array of rectangles to the center of a given\r\n * rectangle.\r\n */\n\n\nconst closestCenter = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: distBetween\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the closest rectangles from an array of rectangles to the corners of\r\n * another rectangle.\r\n */\n\nconst closestCorners = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const corners = cornersOfRectangle(collisionRect);\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const rectCorners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner, index) => {\n return accumulator + distanceBetween(rectCorners[index], corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\n/**\r\n * Returns the intersecting rectangle area between two rectangles\r\n */\n\nfunction getIntersectionRatio(entry, target) {\n const top = Math.max(target.top, entry.top);\n const left = Math.max(target.left, entry.left);\n const right = Math.min(target.left + target.width, entry.left + entry.width);\n const bottom = Math.min(target.top + target.height, entry.top + entry.height);\n const width = right - left;\n const height = bottom - top;\n\n if (left < right && top < bottom) {\n const targetArea = target.width * target.height;\n const entryArea = entry.width * entry.height;\n const intersectionArea = width * height;\n const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);\n return Number(intersectionRatio.toFixed(4));\n } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)\n\n\n return 0;\n}\n/**\r\n * Returns the rectangles that has the greatest intersection area with a given\r\n * rectangle in an array of rectangles.\r\n */\n\nconst rectIntersection = _ref => {\n let {\n collisionRect,\n droppableRects,\n droppableContainers\n } = _ref;\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect) {\n const intersectionRatio = getIntersectionRatio(rect, collisionRect);\n\n if (intersectionRatio > 0) {\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: intersectionRatio\n }\n });\n }\n }\n }\n\n return collisions.sort(sortCollisionsDesc);\n};\n\n/**\r\n * Check if a given point is contained within a bounding rectangle\r\n */\n\nfunction isPointWithinRect(point, rect) {\n const {\n top,\n left,\n bottom,\n right\n } = rect;\n return top <= point.y && point.y <= bottom && left <= point.x && point.x <= right;\n}\n/**\r\n * Returns the rectangles that the pointer is hovering over\r\n */\n\n\nconst pointerWithin = _ref => {\n let {\n droppableContainers,\n droppableRects,\n pointerCoordinates\n } = _ref;\n\n if (!pointerCoordinates) {\n return [];\n }\n\n const collisions = [];\n\n for (const droppableContainer of droppableContainers) {\n const {\n id\n } = droppableContainer;\n const rect = droppableRects.get(id);\n\n if (rect && isPointWithinRect(pointerCoordinates, rect)) {\n /* There may be more than a single rectangle intersecting\r\n * with the pointer coordinates. In order to sort the\r\n * colliding rectangles, we measure the distance between\r\n * the pointer and the corners of the intersecting rectangle\r\n */\n const corners = cornersOfRectangle(rect);\n const distances = corners.reduce((accumulator, corner) => {\n return accumulator + distanceBetween(pointerCoordinates, corner);\n }, 0);\n const effectiveDistance = Number((distances / 4).toFixed(4));\n collisions.push({\n id,\n data: {\n droppableContainer,\n value: effectiveDistance\n }\n });\n }\n }\n\n return collisions.sort(sortCollisionsAsc);\n};\n\nfunction adjustScale(transform, rect1, rect2) {\n return { ...transform,\n scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,\n scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1\n };\n}\n\nfunction getRectDelta(rect1, rect2) {\n return rect1 && rect2 ? {\n x: rect1.left - rect2.left,\n y: rect1.top - rect2.top\n } : defaultCoordinates;\n}\n\nfunction createRectAdjustmentFn(modifier) {\n return function adjustClientRect(rect) {\n for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n adjustments[_key - 1] = arguments[_key];\n }\n\n return adjustments.reduce((acc, adjustment) => ({ ...acc,\n top: acc.top + modifier * adjustment.y,\n bottom: acc.bottom + modifier * adjustment.y,\n left: acc.left + modifier * adjustment.x,\n right: acc.right + modifier * adjustment.x\n }), { ...rect\n });\n };\n}\nconst getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1);\n\nfunction parseTransform(transform) {\n if (transform.startsWith('matrix3d(')) {\n const transformArray = transform.slice(9, -1).split(/, /);\n return {\n x: +transformArray[12],\n y: +transformArray[13],\n scaleX: +transformArray[0],\n scaleY: +transformArray[5]\n };\n } else if (transform.startsWith('matrix(')) {\n const transformArray = transform.slice(7, -1).split(/, /);\n return {\n x: +transformArray[4],\n y: +transformArray[5],\n scaleX: +transformArray[0],\n scaleY: +transformArray[3]\n };\n }\n\n return null;\n}\n\nfunction inverseTransform(rect, transform, transformOrigin) {\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return rect;\n }\n\n const {\n scaleX,\n scaleY,\n x: translateX,\n y: translateY\n } = parsedTransform;\n const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);\n const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1));\n const w = scaleX ? rect.width / scaleX : rect.width;\n const h = scaleY ? rect.height / scaleY : rect.height;\n return {\n width: w,\n height: h,\n top: y,\n right: x + w,\n bottom: y + h,\n left: x\n };\n}\n\nconst defaultOptions = {\n ignoreTransform: false\n};\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n */\n\nfunction getClientRect(element, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n let rect = element.getBoundingClientRect();\n\n if (options.ignoreTransform) {\n const {\n transform,\n transformOrigin\n } = getWindow(element).getComputedStyle(element);\n\n if (transform) {\n rect = inverseTransform(rect, transform, transformOrigin);\n }\n }\n\n const {\n top,\n left,\n width,\n height,\n bottom,\n right\n } = rect;\n return {\n top,\n left,\n width,\n height,\n bottom,\n right\n };\n}\n/**\r\n * Returns the bounding client rect of an element relative to the viewport.\r\n *\r\n * @remarks\r\n * The ClientRect returned by this method does not take into account transforms\r\n * applied to the element it measures.\r\n *\r\n */\n\nfunction getTransformAgnosticClientRect(element) {\n return getClientRect(element, {\n ignoreTransform: true\n });\n}\n\nfunction getWindowClientRect(element) {\n const width = element.innerWidth;\n const height = element.innerHeight;\n return {\n top: 0,\n left: 0,\n right: width,\n bottom: height,\n width,\n height\n };\n}\n\nfunction isFixed(node, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(node).getComputedStyle(node);\n }\n\n return computedStyle.position === 'fixed';\n}\n\nfunction isScrollable(element, computedStyle) {\n if (computedStyle === void 0) {\n computedStyle = getWindow(element).getComputedStyle(element);\n }\n\n const overflowRegex = /(auto|scroll|overlay)/;\n const properties = ['overflow', 'overflowX', 'overflowY'];\n return properties.some(property => {\n const value = computedStyle[property];\n return typeof value === 'string' ? overflowRegex.test(value) : false;\n });\n}\n\nfunction getScrollableAncestors(element, limit) {\n const scrollParents = [];\n\n function findScrollableAncestors(node) {\n if (limit != null && scrollParents.length >= limit) {\n return scrollParents;\n }\n\n if (!node) {\n return scrollParents;\n }\n\n if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {\n scrollParents.push(node.scrollingElement);\n return scrollParents;\n }\n\n if (!isHTMLElement(node) || isSVGElement(node)) {\n return scrollParents;\n }\n\n if (scrollParents.includes(node)) {\n return scrollParents;\n }\n\n const computedStyle = getWindow(element).getComputedStyle(node);\n\n if (node !== element) {\n if (isScrollable(node, computedStyle)) {\n scrollParents.push(node);\n }\n }\n\n if (isFixed(node, computedStyle)) {\n return scrollParents;\n }\n\n return findScrollableAncestors(node.parentNode);\n }\n\n if (!element) {\n return scrollParents;\n }\n\n return findScrollableAncestors(element);\n}\nfunction getFirstScrollableAncestor(node) {\n const [firstScrollableAncestor] = getScrollableAncestors(node, 1);\n return firstScrollableAncestor != null ? firstScrollableAncestor : null;\n}\n\nfunction getScrollableElement(element) {\n if (!canUseDOM || !element) {\n return null;\n }\n\n if (isWindow(element)) {\n return element;\n }\n\n if (!isNode(element)) {\n return null;\n }\n\n if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {\n return window;\n }\n\n if (isHTMLElement(element)) {\n return element;\n }\n\n return null;\n}\n\nfunction getScrollXCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollX;\n }\n\n return element.scrollLeft;\n}\nfunction getScrollYCoordinate(element) {\n if (isWindow(element)) {\n return element.scrollY;\n }\n\n return element.scrollTop;\n}\nfunction getScrollCoordinates(element) {\n return {\n x: getScrollXCoordinate(element),\n y: getScrollYCoordinate(element)\n };\n}\n\nvar Direction;\n\n(function (Direction) {\n Direction[Direction[\"Forward\"] = 1] = \"Forward\";\n Direction[Direction[\"Backward\"] = -1] = \"Backward\";\n})(Direction || (Direction = {}));\n\nfunction isDocumentScrollingElement(element) {\n if (!canUseDOM || !element) {\n return false;\n }\n\n return element === document.scrollingElement;\n}\n\nfunction getScrollPosition(scrollingContainer) {\n const minScroll = {\n x: 0,\n y: 0\n };\n const dimensions = isDocumentScrollingElement(scrollingContainer) ? {\n height: window.innerHeight,\n width: window.innerWidth\n } : {\n height: scrollingContainer.clientHeight,\n width: scrollingContainer.clientWidth\n };\n const maxScroll = {\n x: scrollingContainer.scrollWidth - dimensions.width,\n y: scrollingContainer.scrollHeight - dimensions.height\n };\n const isTop = scrollingContainer.scrollTop <= minScroll.y;\n const isLeft = scrollingContainer.scrollLeft <= minScroll.x;\n const isBottom = scrollingContainer.scrollTop >= maxScroll.y;\n const isRight = scrollingContainer.scrollLeft >= maxScroll.x;\n return {\n isTop,\n isLeft,\n isBottom,\n isRight,\n maxScroll,\n minScroll\n };\n}\n\nconst defaultThreshold = {\n x: 0.2,\n y: 0.2\n};\nfunction getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {\n let {\n top,\n left,\n right,\n bottom\n } = _ref;\n\n if (acceleration === void 0) {\n acceleration = 10;\n }\n\n if (thresholdPercentage === void 0) {\n thresholdPercentage = defaultThreshold;\n }\n\n const {\n isTop,\n isBottom,\n isLeft,\n isRight\n } = getScrollPosition(scrollContainer);\n const direction = {\n x: 0,\n y: 0\n };\n const speed = {\n x: 0,\n y: 0\n };\n const threshold = {\n height: scrollContainerRect.height * thresholdPercentage.y,\n width: scrollContainerRect.width * thresholdPercentage.x\n };\n\n if (!isTop && top <= scrollContainerRect.top + threshold.height) {\n // Scroll Up\n direction.y = Direction.Backward;\n speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);\n } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {\n // Scroll Down\n direction.y = Direction.Forward;\n speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);\n }\n\n if (!isRight && right >= scrollContainerRect.right - threshold.width) {\n // Scroll Right\n direction.x = Direction.Forward;\n speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);\n } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {\n // Scroll Left\n direction.x = Direction.Backward;\n speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);\n }\n\n return {\n direction,\n speed\n };\n}\n\nfunction getScrollElementRect(element) {\n if (element === document.scrollingElement) {\n const {\n innerWidth,\n innerHeight\n } = window;\n return {\n top: 0,\n left: 0,\n right: innerWidth,\n bottom: innerHeight,\n width: innerWidth,\n height: innerHeight\n };\n }\n\n const {\n top,\n left,\n right,\n bottom\n } = element.getBoundingClientRect();\n return {\n top,\n left,\n right,\n bottom,\n width: element.clientWidth,\n height: element.clientHeight\n };\n}\n\nfunction getScrollOffsets(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return add(acc, getScrollCoordinates(node));\n }, defaultCoordinates);\n}\nfunction getScrollXOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollXCoordinate(node);\n }, 0);\n}\nfunction getScrollYOffset(scrollableAncestors) {\n return scrollableAncestors.reduce((acc, node) => {\n return acc + getScrollYCoordinate(node);\n }, 0);\n}\n\nfunction scrollIntoViewIfNeeded(element, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n if (!element) {\n return;\n }\n\n const {\n top,\n left,\n bottom,\n right\n } = measure(element);\n const firstScrollableAncestor = getFirstScrollableAncestor(element);\n\n if (!firstScrollableAncestor) {\n return;\n }\n\n if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {\n element.scrollIntoView({\n block: 'center',\n inline: 'center'\n });\n }\n}\n\nconst properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]];\nclass Rect {\n constructor(rect, element) {\n this.rect = void 0;\n this.width = void 0;\n this.height = void 0;\n this.top = void 0;\n this.bottom = void 0;\n this.right = void 0;\n this.left = void 0;\n const scrollableAncestors = getScrollableAncestors(element);\n const scrollOffsets = getScrollOffsets(scrollableAncestors);\n this.rect = { ...rect\n };\n this.width = rect.width;\n this.height = rect.height;\n\n for (const [axis, keys, getScrollOffset] of properties) {\n for (const key of keys) {\n Object.defineProperty(this, key, {\n get: () => {\n const currentOffsets = getScrollOffset(scrollableAncestors);\n const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;\n return this.rect[key] + scrollOffsetsDeltla;\n },\n enumerable: true\n });\n }\n }\n\n Object.defineProperty(this, 'rect', {\n enumerable: false\n });\n }\n\n}\n\nclass Listeners {\n constructor(target) {\n this.target = void 0;\n this.listeners = [];\n\n this.removeAll = () => {\n this.listeners.forEach(listener => {\n var _this$target;\n\n return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);\n });\n };\n\n this.target = target;\n }\n\n add(eventName, handler, options) {\n var _this$target2;\n\n (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);\n this.listeners.push([eventName, handler, options]);\n }\n\n}\n\nfunction getEventListenerTarget(target) {\n // If the `event.target` element is removed from the document events will still be targeted\n // at it, and hence won't always bubble up to the window or document anymore.\n // If there is any risk of an element being removed while it is being dragged,\n // the best practice is to attach the event listeners directly to the target.\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n const {\n EventTarget\n } = getWindow(target);\n return target instanceof EventTarget ? target : getOwnerDocument(target);\n}\n\nfunction hasExceededDistance(delta, measurement) {\n const dx = Math.abs(delta.x);\n const dy = Math.abs(delta.y);\n\n if (typeof measurement === 'number') {\n return Math.sqrt(dx ** 2 + dy ** 2) > measurement;\n }\n\n if ('x' in measurement && 'y' in measurement) {\n return dx > measurement.x && dy > measurement.y;\n }\n\n if ('x' in measurement) {\n return dx > measurement.x;\n }\n\n if ('y' in measurement) {\n return dy > measurement.y;\n }\n\n return false;\n}\n\nvar EventName;\n\n(function (EventName) {\n EventName[\"Click\"] = \"click\";\n EventName[\"DragStart\"] = \"dragstart\";\n EventName[\"Keydown\"] = \"keydown\";\n EventName[\"ContextMenu\"] = \"contextmenu\";\n EventName[\"Resize\"] = \"resize\";\n EventName[\"SelectionChange\"] = \"selectionchange\";\n EventName[\"VisibilityChange\"] = \"visibilitychange\";\n})(EventName || (EventName = {}));\n\nfunction preventDefault(event) {\n event.preventDefault();\n}\nfunction stopPropagation(event) {\n event.stopPropagation();\n}\n\nvar KeyboardCode;\n\n(function (KeyboardCode) {\n KeyboardCode[\"Space\"] = \"Space\";\n KeyboardCode[\"Down\"] = \"ArrowDown\";\n KeyboardCode[\"Right\"] = \"ArrowRight\";\n KeyboardCode[\"Left\"] = \"ArrowLeft\";\n KeyboardCode[\"Up\"] = \"ArrowUp\";\n KeyboardCode[\"Esc\"] = \"Escape\";\n KeyboardCode[\"Enter\"] = \"Enter\";\n KeyboardCode[\"Tab\"] = \"Tab\";\n})(KeyboardCode || (KeyboardCode = {}));\n\nconst defaultKeyboardCodes = {\n start: [KeyboardCode.Space, KeyboardCode.Enter],\n cancel: [KeyboardCode.Esc],\n end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]\n};\nconst defaultKeyboardCoordinateGetter = (event, _ref) => {\n let {\n currentCoordinates\n } = _ref;\n\n switch (event.code) {\n case KeyboardCode.Right:\n return { ...currentCoordinates,\n x: currentCoordinates.x + 25\n };\n\n case KeyboardCode.Left:\n return { ...currentCoordinates,\n x: currentCoordinates.x - 25\n };\n\n case KeyboardCode.Down:\n return { ...currentCoordinates,\n y: currentCoordinates.y + 25\n };\n\n case KeyboardCode.Up:\n return { ...currentCoordinates,\n y: currentCoordinates.y - 25\n };\n }\n\n return undefined;\n};\n\nclass KeyboardSensor {\n constructor(props) {\n this.props = void 0;\n this.autoScrollEnabled = false;\n this.referenceCoordinates = void 0;\n this.listeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n const {\n event: {\n target\n }\n } = props;\n this.props = props;\n this.listeners = new Listeners(getOwnerDocument(target));\n this.windowListeners = new Listeners(getWindow(target));\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.attach();\n }\n\n attach() {\n this.handleStart();\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));\n }\n\n handleStart() {\n const {\n activeNode,\n onStart\n } = this.props;\n const node = activeNode.node.current;\n\n if (node) {\n scrollIntoViewIfNeeded(node);\n }\n\n onStart(defaultCoordinates);\n }\n\n handleKeyDown(event) {\n if (isKeyboardEvent(event)) {\n const {\n active,\n context,\n options\n } = this.props;\n const {\n keyboardCodes = defaultKeyboardCodes,\n coordinateGetter = defaultKeyboardCoordinateGetter,\n scrollBehavior = 'smooth'\n } = options;\n const {\n code\n } = event;\n\n if (keyboardCodes.end.includes(code)) {\n this.handleEnd(event);\n return;\n }\n\n if (keyboardCodes.cancel.includes(code)) {\n this.handleCancel(event);\n return;\n }\n\n const {\n collisionRect\n } = context.current;\n const currentCoordinates = collisionRect ? {\n x: collisionRect.left,\n y: collisionRect.top\n } : defaultCoordinates;\n\n if (!this.referenceCoordinates) {\n this.referenceCoordinates = currentCoordinates;\n }\n\n const newCoordinates = coordinateGetter(event, {\n active,\n context: context.current,\n currentCoordinates\n });\n\n if (newCoordinates) {\n const coordinatesDelta = subtract(newCoordinates, currentCoordinates);\n const scrollDelta = {\n x: 0,\n y: 0\n };\n const {\n scrollableAncestors\n } = context.current;\n\n for (const scrollContainer of scrollableAncestors) {\n const direction = event.code;\n const {\n isTop,\n isRight,\n isLeft,\n isBottom,\n maxScroll,\n minScroll\n } = getScrollPosition(scrollContainer);\n const scrollElementRect = getScrollElementRect(scrollContainer);\n const clampedCoordinates = {\n x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),\n y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))\n };\n const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;\n const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;\n\n if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {\n const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;\n const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.y) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n left: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;\n } else {\n scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;\n }\n\n if (scrollDelta.x) {\n scrollContainer.scrollBy({\n left: -scrollDelta.x,\n behavior: scrollBehavior\n });\n }\n\n break;\n } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {\n const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;\n const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;\n\n if (canScrollToNewCoordinates && !coordinatesDelta.x) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n top: newScrollCoordinates,\n behavior: scrollBehavior\n });\n return;\n }\n\n if (canScrollToNewCoordinates) {\n scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;\n } else {\n scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;\n }\n\n if (scrollDelta.y) {\n scrollContainer.scrollBy({\n top: -scrollDelta.y,\n behavior: scrollBehavior\n });\n }\n\n break;\n }\n }\n\n this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));\n }\n }\n }\n\n handleMove(event, coordinates) {\n const {\n onMove\n } = this.props;\n event.preventDefault();\n onMove(coordinates);\n }\n\n handleEnd(event) {\n const {\n onEnd\n } = this.props;\n event.preventDefault();\n this.detach();\n onEnd();\n }\n\n handleCancel(event) {\n const {\n onCancel\n } = this.props;\n event.preventDefault();\n this.detach();\n onCancel();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll();\n }\n\n}\nKeyboardSensor.activators = [{\n eventName: 'onKeyDown',\n handler: (event, _ref, _ref2) => {\n let {\n keyboardCodes = defaultKeyboardCodes,\n onActivation\n } = _ref;\n let {\n active\n } = _ref2;\n const {\n code\n } = event.nativeEvent;\n\n if (keyboardCodes.start.includes(code)) {\n const activator = active.activatorNode.current;\n\n if (activator && event.target !== activator) {\n return false;\n }\n\n event.preventDefault();\n onActivation == null ? void 0 : onActivation({\n event: event.nativeEvent\n });\n return true;\n }\n\n return false;\n }\n}];\n\nfunction isDistanceConstraint(constraint) {\n return Boolean(constraint && 'distance' in constraint);\n}\n\nfunction isDelayConstraint(constraint) {\n return Boolean(constraint && 'delay' in constraint);\n}\n\nclass AbstractPointerSensor {\n constructor(props, events, listenerTarget) {\n var _getEventCoordinates;\n\n if (listenerTarget === void 0) {\n listenerTarget = getEventListenerTarget(props.event.target);\n }\n\n this.props = void 0;\n this.events = void 0;\n this.autoScrollEnabled = true;\n this.document = void 0;\n this.activated = false;\n this.initialCoordinates = void 0;\n this.timeoutId = null;\n this.listeners = void 0;\n this.documentListeners = void 0;\n this.windowListeners = void 0;\n this.props = props;\n this.events = events;\n const {\n event\n } = props;\n const {\n target\n } = event;\n this.props = props;\n this.events = events;\n this.document = getOwnerDocument(target);\n this.documentListeners = new Listeners(this.document);\n this.listeners = new Listeners(listenerTarget);\n this.windowListeners = new Listeners(getWindow(target));\n this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;\n this.handleStart = this.handleStart.bind(this);\n this.handleMove = this.handleMove.bind(this);\n this.handleEnd = this.handleEnd.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.removeTextSelection = this.removeTextSelection.bind(this);\n this.attach();\n }\n\n attach() {\n const {\n events,\n props: {\n options: {\n activationConstraint,\n bypassActivationConstraint\n }\n }\n } = this;\n this.listeners.add(events.move.name, this.handleMove, {\n passive: false\n });\n this.listeners.add(events.end.name, this.handleEnd);\n\n if (events.cancel) {\n this.listeners.add(events.cancel.name, this.handleCancel);\n }\n\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.DragStart, preventDefault);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n this.windowListeners.add(EventName.ContextMenu, preventDefault);\n this.documentListeners.add(EventName.Keydown, this.handleKeydown);\n\n if (activationConstraint) {\n if (bypassActivationConstraint != null && bypassActivationConstraint({\n event: this.props.event,\n activeNode: this.props.activeNode,\n options: this.props.options\n })) {\n return this.handleStart();\n }\n\n if (isDelayConstraint(activationConstraint)) {\n this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);\n this.handlePending(activationConstraint);\n return;\n }\n\n if (isDistanceConstraint(activationConstraint)) {\n this.handlePending(activationConstraint);\n return;\n }\n }\n\n this.handleStart();\n }\n\n detach() {\n this.listeners.removeAll();\n this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners\n // This is necessary because we listen for `click` and `selection` events on the document\n\n setTimeout(this.documentListeners.removeAll, 50);\n\n if (this.timeoutId !== null) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n\n handlePending(constraint, offset) {\n const {\n active,\n onPending\n } = this.props;\n onPending(active, constraint, this.initialCoordinates, offset);\n }\n\n handleStart() {\n const {\n initialCoordinates\n } = this;\n const {\n onStart\n } = this.props;\n\n if (initialCoordinates) {\n this.activated = true; // Stop propagation of click events once activation constraints are met\n\n this.documentListeners.add(EventName.Click, stopPropagation, {\n capture: true\n }); // Remove any text selection from the document\n\n this.removeTextSelection(); // Prevent further text selection while dragging\n\n this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);\n onStart(initialCoordinates);\n }\n }\n\n handleMove(event) {\n var _getEventCoordinates2;\n\n const {\n activated,\n initialCoordinates,\n props\n } = this;\n const {\n onMove,\n options: {\n activationConstraint\n }\n } = props;\n\n if (!initialCoordinates) {\n return;\n }\n\n const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;\n const delta = subtract(initialCoordinates, coordinates); // Constraint validation\n\n if (!activated && activationConstraint) {\n if (isDistanceConstraint(activationConstraint)) {\n if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n\n if (hasExceededDistance(delta, activationConstraint.distance)) {\n return this.handleStart();\n }\n }\n\n if (isDelayConstraint(activationConstraint)) {\n if (hasExceededDistance(delta, activationConstraint.tolerance)) {\n return this.handleCancel();\n }\n }\n\n this.handlePending(activationConstraint, delta);\n return;\n }\n\n if (event.cancelable) {\n event.preventDefault();\n }\n\n onMove(coordinates);\n }\n\n handleEnd() {\n const {\n onAbort,\n onEnd\n } = this.props;\n this.detach();\n\n if (!this.activated) {\n onAbort(this.props.active);\n }\n\n onEnd();\n }\n\n handleCancel() {\n const {\n onAbort,\n onCancel\n } = this.props;\n this.detach();\n\n if (!this.activated) {\n onAbort(this.props.active);\n }\n\n onCancel();\n }\n\n handleKeydown(event) {\n if (event.code === KeyboardCode.Esc) {\n this.handleCancel();\n }\n }\n\n removeTextSelection() {\n var _this$document$getSel;\n\n (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();\n }\n\n}\n\nconst events = {\n cancel: {\n name: 'pointercancel'\n },\n move: {\n name: 'pointermove'\n },\n end: {\n name: 'pointerup'\n }\n};\nclass PointerSensor extends AbstractPointerSensor {\n constructor(props) {\n const {\n event\n } = props; // Pointer events stop firing if the target is unmounted while dragging\n // Therefore we attach listeners to the owner document instead\n\n const listenerTarget = getOwnerDocument(event.target);\n super(props, events, listenerTarget);\n }\n\n}\nPointerSensor.activators = [{\n eventName: 'onPointerDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (!event.isPrimary || event.button !== 0) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$1 = {\n move: {\n name: 'mousemove'\n },\n end: {\n name: 'mouseup'\n }\n};\nvar MouseButton;\n\n(function (MouseButton) {\n MouseButton[MouseButton[\"RightClick\"] = 2] = \"RightClick\";\n})(MouseButton || (MouseButton = {}));\n\nclass MouseSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$1, getOwnerDocument(props.event.target));\n }\n\n}\nMouseSensor.activators = [{\n eventName: 'onMouseDown',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n\n if (event.button === MouseButton.RightClick) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nconst events$2 = {\n cancel: {\n name: 'touchcancel'\n },\n move: {\n name: 'touchmove'\n },\n end: {\n name: 'touchend'\n }\n};\nclass TouchSensor extends AbstractPointerSensor {\n constructor(props) {\n super(props, events$2);\n }\n\n static setup() {\n // Adding a non-capture and non-passive `touchmove` listener in order\n // to force `event.preventDefault()` calls to work in dynamically added\n // touchmove event handlers. This is required for iOS Safari.\n window.addEventListener(events$2.move.name, noop, {\n capture: false,\n passive: false\n });\n return function teardown() {\n window.removeEventListener(events$2.move.name, noop);\n }; // We create a new handler because the teardown function of another sensor\n // could remove our event listener if we use a referentially equal listener.\n\n function noop() {}\n }\n\n}\nTouchSensor.activators = [{\n eventName: 'onTouchStart',\n handler: (_ref, _ref2) => {\n let {\n nativeEvent: event\n } = _ref;\n let {\n onActivation\n } = _ref2;\n const {\n touches\n } = event;\n\n if (touches.length > 1) {\n return false;\n }\n\n onActivation == null ? void 0 : onActivation({\n event\n });\n return true;\n }\n}];\n\nvar AutoScrollActivator;\n\n(function (AutoScrollActivator) {\n AutoScrollActivator[AutoScrollActivator[\"Pointer\"] = 0] = \"Pointer\";\n AutoScrollActivator[AutoScrollActivator[\"DraggableRect\"] = 1] = \"DraggableRect\";\n})(AutoScrollActivator || (AutoScrollActivator = {}));\n\nvar TraversalOrder;\n\n(function (TraversalOrder) {\n TraversalOrder[TraversalOrder[\"TreeOrder\"] = 0] = \"TreeOrder\";\n TraversalOrder[TraversalOrder[\"ReversedTreeOrder\"] = 1] = \"ReversedTreeOrder\";\n})(TraversalOrder || (TraversalOrder = {}));\n\nfunction useAutoScroller(_ref) {\n let {\n acceleration,\n activator = AutoScrollActivator.Pointer,\n canScroll,\n draggingRect,\n enabled,\n interval = 5,\n order = TraversalOrder.TreeOrder,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects,\n delta,\n threshold\n } = _ref;\n const scrollIntent = useScrollIntent({\n delta,\n disabled: !enabled\n });\n const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();\n const scrollSpeed = useRef({\n x: 0,\n y: 0\n });\n const scrollDirection = useRef({\n x: 0,\n y: 0\n });\n const rect = useMemo(() => {\n switch (activator) {\n case AutoScrollActivator.Pointer:\n return pointerCoordinates ? {\n top: pointerCoordinates.y,\n bottom: pointerCoordinates.y,\n left: pointerCoordinates.x,\n right: pointerCoordinates.x\n } : null;\n\n case AutoScrollActivator.DraggableRect:\n return draggingRect;\n }\n }, [activator, draggingRect, pointerCoordinates]);\n const scrollContainerRef = useRef(null);\n const autoScroll = useCallback(() => {\n const scrollContainer = scrollContainerRef.current;\n\n if (!scrollContainer) {\n return;\n }\n\n const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;\n const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;\n scrollContainer.scrollBy(scrollLeft, scrollTop);\n }, []);\n const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);\n useEffect(() => {\n if (!enabled || !scrollableAncestors.length || !rect) {\n clearAutoScrollInterval();\n return;\n }\n\n for (const scrollContainer of sortedScrollableAncestors) {\n if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {\n continue;\n }\n\n const index = scrollableAncestors.indexOf(scrollContainer);\n const scrollContainerRect = scrollableAncestorRects[index];\n\n if (!scrollContainerRect) {\n continue;\n }\n\n const {\n direction,\n speed\n } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);\n\n for (const axis of ['x', 'y']) {\n if (!scrollIntent[axis][direction[axis]]) {\n speed[axis] = 0;\n direction[axis] = 0;\n }\n }\n\n if (speed.x > 0 || speed.y > 0) {\n clearAutoScrollInterval();\n scrollContainerRef.current = scrollContainer;\n setAutoScrollInterval(autoScroll, interval);\n scrollSpeed.current = speed;\n scrollDirection.current = direction;\n return;\n }\n }\n\n scrollSpeed.current = {\n x: 0,\n y: 0\n };\n scrollDirection.current = {\n x: 0,\n y: 0\n };\n clearAutoScrollInterval();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(threshold)]);\n}\nconst defaultScrollIntent = {\n x: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n },\n y: {\n [Direction.Backward]: false,\n [Direction.Forward]: false\n }\n};\n\nfunction useScrollIntent(_ref2) {\n let {\n delta,\n disabled\n } = _ref2;\n const previousDelta = usePrevious(delta);\n return useLazyMemo(previousIntent => {\n if (disabled || !previousDelta || !previousIntent) {\n // Reset scroll intent tracking when auto-scrolling is disabled\n return defaultScrollIntent;\n }\n\n const direction = {\n x: Math.sign(delta.x - previousDelta.x),\n y: Math.sign(delta.y - previousDelta.y)\n }; // Keep track of the user intent to scroll in each direction for both axis\n\n return {\n x: {\n [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,\n [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1\n },\n y: {\n [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,\n [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1\n }\n };\n }, [disabled, delta, previousDelta]);\n}\n\nfunction useCachedNode(draggableNodes, id) {\n const draggableNode = id != null ? draggableNodes.get(id) : undefined;\n const node = draggableNode ? draggableNode.node.current : null;\n return useLazyMemo(cachedNode => {\n var _ref;\n\n if (id == null) {\n return null;\n } // In some cases, the draggable node can unmount while dragging\n // This is the case for virtualized lists. In those situations,\n // we fall back to the last known value for that node.\n\n\n return (_ref = node != null ? node : cachedNode) != null ? _ref : null;\n }, [node, id]);\n}\n\nfunction useCombineActivators(sensors, getSyntheticHandler) {\n return useMemo(() => sensors.reduce((accumulator, sensor) => {\n const {\n sensor: Sensor\n } = sensor;\n const sensorActivators = Sensor.activators.map(activator => ({\n eventName: activator.eventName,\n handler: getSyntheticHandler(activator.handler, sensor)\n }));\n return [...accumulator, ...sensorActivators];\n }, []), [sensors, getSyntheticHandler]);\n}\n\nvar MeasuringStrategy;\n\n(function (MeasuringStrategy) {\n MeasuringStrategy[MeasuringStrategy[\"Always\"] = 0] = \"Always\";\n MeasuringStrategy[MeasuringStrategy[\"BeforeDragging\"] = 1] = \"BeforeDragging\";\n MeasuringStrategy[MeasuringStrategy[\"WhileDragging\"] = 2] = \"WhileDragging\";\n})(MeasuringStrategy || (MeasuringStrategy = {}));\n\nvar MeasuringFrequency;\n\n(function (MeasuringFrequency) {\n MeasuringFrequency[\"Optimized\"] = \"optimized\";\n})(MeasuringFrequency || (MeasuringFrequency = {}));\n\nconst defaultValue = /*#__PURE__*/new Map();\nfunction useDroppableMeasuring(containers, _ref) {\n let {\n dragging,\n dependencies,\n config\n } = _ref;\n const [queue, setQueue] = useState(null);\n const {\n frequency,\n measure,\n strategy\n } = config;\n const containersRef = useRef(containers);\n const disabled = isDisabled();\n const disabledRef = useLatestValue(disabled);\n const measureDroppableContainers = useCallback(function (ids) {\n if (ids === void 0) {\n ids = [];\n }\n\n if (disabledRef.current) {\n return;\n }\n\n setQueue(value => {\n if (value === null) {\n return ids;\n }\n\n return value.concat(ids.filter(id => !value.includes(id)));\n });\n }, [disabledRef]);\n const timeoutId = useRef(null);\n const droppableRects = useLazyMemo(previousValue => {\n if (disabled && !dragging) {\n return defaultValue;\n }\n\n if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {\n const map = new Map();\n\n for (let container of containers) {\n if (!container) {\n continue;\n }\n\n if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {\n // This container does not need to be re-measured\n map.set(container.id, container.rect.current);\n continue;\n }\n\n const node = container.node.current;\n const rect = node ? new Rect(measure(node), node) : null;\n container.rect.current = rect;\n\n if (rect) {\n map.set(container.id, rect);\n }\n }\n\n return map;\n }\n\n return previousValue;\n }, [containers, queue, dragging, disabled, measure]);\n useEffect(() => {\n containersRef.current = containers;\n }, [containers]);\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n measureDroppableContainers();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [dragging, disabled]);\n useEffect(() => {\n if (queue && queue.length > 0) {\n setQueue(null);\n }\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(queue)]);\n useEffect(() => {\n if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) {\n return;\n }\n\n timeoutId.current = setTimeout(() => {\n measureDroppableContainers();\n timeoutId.current = null;\n }, frequency);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [frequency, disabled, measureDroppableContainers, ...dependencies]);\n return {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled: queue != null\n };\n\n function isDisabled() {\n switch (strategy) {\n case MeasuringStrategy.Always:\n return false;\n\n case MeasuringStrategy.BeforeDragging:\n return dragging;\n\n default:\n return !dragging;\n }\n }\n}\n\nfunction useInitialValue(value, computeFn) {\n return useLazyMemo(previousValue => {\n if (!value) {\n return null;\n }\n\n if (previousValue) {\n return previousValue;\n }\n\n return typeof computeFn === 'function' ? computeFn(value) : value;\n }, [computeFn, value]);\n}\n\nfunction useInitialRect(node, measure) {\n return useInitialValue(node, measure);\n}\n\n/**\r\n * Returns a new MutationObserver instance.\r\n * If `MutationObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useMutationObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleMutations = useEvent(callback);\n const mutationObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') {\n return undefined;\n }\n\n const {\n MutationObserver\n } = window;\n return new MutationObserver(handleMutations);\n }, [handleMutations, disabled]);\n useEffect(() => {\n return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }, [mutationObserver]);\n return mutationObserver;\n}\n\n/**\r\n * Returns a new ResizeObserver instance bound to the `onResize` callback.\r\n * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.\r\n */\n\nfunction useResizeObserver(_ref) {\n let {\n callback,\n disabled\n } = _ref;\n const handleResize = useEvent(callback);\n const resizeObserver = useMemo(() => {\n if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') {\n return undefined;\n }\n\n const {\n ResizeObserver\n } = window;\n return new ResizeObserver(handleResize);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [disabled]);\n useEffect(() => {\n return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();\n }, [resizeObserver]);\n return resizeObserver;\n}\n\nfunction defaultMeasure(element) {\n return new Rect(getClientRect(element), element);\n}\n\nfunction useRect(element, measure, fallbackRect) {\n if (measure === void 0) {\n measure = defaultMeasure;\n }\n\n const [rect, setRect] = useState(null);\n\n function measureRect() {\n setRect(currentRect => {\n if (!element) {\n return null;\n }\n\n if (element.isConnected === false) {\n var _ref;\n\n // Fall back to last rect we measured if the element is\n // no longer connected to the DOM.\n return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;\n }\n\n const newRect = measure(element);\n\n if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {\n return currentRect;\n }\n\n return newRect;\n });\n }\n\n const mutationObserver = useMutationObserver({\n callback(records) {\n if (!element) {\n return;\n }\n\n for (const record of records) {\n const {\n type,\n target\n } = record;\n\n if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) {\n measureRect();\n break;\n }\n }\n }\n\n });\n const resizeObserver = useResizeObserver({\n callback: measureRect\n });\n useIsomorphicLayoutEffect(() => {\n measureRect();\n\n if (element) {\n resizeObserver == null ? void 0 : resizeObserver.observe(element);\n mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {\n childList: true,\n subtree: true\n });\n } else {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n mutationObserver == null ? void 0 : mutationObserver.disconnect();\n }\n }, [element]);\n return rect;\n}\n\nfunction useRectDelta(rect) {\n const initialRect = useInitialValue(rect);\n return getRectDelta(rect, initialRect);\n}\n\nconst defaultValue$1 = [];\nfunction useScrollableAncestors(node) {\n const previousNode = useRef(node);\n const ancestors = useLazyMemo(previousValue => {\n if (!node) {\n return defaultValue$1;\n }\n\n if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {\n return previousValue;\n }\n\n return getScrollableAncestors(node);\n }, [node]);\n useEffect(() => {\n previousNode.current = node;\n }, [node]);\n return ancestors;\n}\n\nfunction useScrollOffsets(elements) {\n const [scrollCoordinates, setScrollCoordinates] = useState(null);\n const prevElements = useRef(elements); // To-do: Throttle the handleScroll callback\n\n const handleScroll = useCallback(event => {\n const scrollingElement = getScrollableElement(event.target);\n\n if (!scrollingElement) {\n return;\n }\n\n setScrollCoordinates(scrollCoordinates => {\n if (!scrollCoordinates) {\n return null;\n }\n\n scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));\n return new Map(scrollCoordinates);\n });\n }, []);\n useEffect(() => {\n const previousElements = prevElements.current;\n\n if (elements !== previousElements) {\n cleanup(previousElements);\n const entries = elements.map(element => {\n const scrollableElement = getScrollableElement(element);\n\n if (scrollableElement) {\n scrollableElement.addEventListener('scroll', handleScroll, {\n passive: true\n });\n return [scrollableElement, getScrollCoordinates(scrollableElement)];\n }\n\n return null;\n }).filter(entry => entry != null);\n setScrollCoordinates(entries.length ? new Map(entries) : null);\n prevElements.current = elements;\n }\n\n return () => {\n cleanup(elements);\n cleanup(previousElements);\n };\n\n function cleanup(elements) {\n elements.forEach(element => {\n const scrollableElement = getScrollableElement(element);\n scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll);\n });\n }\n }, [handleScroll, elements]);\n return useMemo(() => {\n if (elements.length) {\n return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);\n }\n\n return defaultCoordinates;\n }, [elements, scrollCoordinates]);\n}\n\nfunction useScrollOffsetsDelta(scrollOffsets, dependencies) {\n if (dependencies === void 0) {\n dependencies = [];\n }\n\n const initialScrollOffsets = useRef(null);\n useEffect(() => {\n initialScrollOffsets.current = null;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n dependencies);\n useEffect(() => {\n const hasScrollOffsets = scrollOffsets !== defaultCoordinates;\n\n if (hasScrollOffsets && !initialScrollOffsets.current) {\n initialScrollOffsets.current = scrollOffsets;\n }\n\n if (!hasScrollOffsets && initialScrollOffsets.current) {\n initialScrollOffsets.current = null;\n }\n }, [scrollOffsets]);\n return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;\n}\n\nfunction useSensorSetup(sensors) {\n useEffect(() => {\n if (!canUseDOM) {\n return;\n }\n\n const teardownFns = sensors.map(_ref => {\n let {\n sensor\n } = _ref;\n return sensor.setup == null ? void 0 : sensor.setup();\n });\n return () => {\n for (const teardown of teardownFns) {\n teardown == null ? void 0 : teardown();\n }\n };\n }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency\n // eslint-disable-next-line react-hooks/exhaustive-deps\n sensors.map(_ref2 => {\n let {\n sensor\n } = _ref2;\n return sensor;\n }));\n}\n\nfunction useSyntheticListeners(listeners, id) {\n return useMemo(() => {\n return listeners.reduce((acc, _ref) => {\n let {\n eventName,\n handler\n } = _ref;\n\n acc[eventName] = event => {\n handler(event, id);\n };\n\n return acc;\n }, {});\n }, [listeners, id]);\n}\n\nfunction useWindowRect(element) {\n return useMemo(() => element ? getWindowClientRect(element) : null, [element]);\n}\n\nconst defaultValue$2 = [];\nfunction useRects(elements, measure) {\n if (measure === void 0) {\n measure = getClientRect;\n }\n\n const [firstElement] = elements;\n const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);\n const [rects, setRects] = useState(defaultValue$2);\n\n function measureRects() {\n setRects(() => {\n if (!elements.length) {\n return defaultValue$2;\n }\n\n return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));\n });\n }\n\n const resizeObserver = useResizeObserver({\n callback: measureRects\n });\n useIsomorphicLayoutEffect(() => {\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n measureRects();\n elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));\n }, [elements]);\n return rects;\n}\n\nfunction getMeasurableNode(node) {\n if (!node) {\n return null;\n }\n\n if (node.children.length > 1) {\n return node;\n }\n\n const firstChild = node.children[0];\n return isHTMLElement(firstChild) ? firstChild : node;\n}\n\nfunction useDragOverlayMeasuring(_ref) {\n let {\n measure\n } = _ref;\n const [rect, setRect] = useState(null);\n const handleResize = useCallback(entries => {\n for (const {\n target\n } of entries) {\n if (isHTMLElement(target)) {\n setRect(rect => {\n const newRect = measure(target);\n return rect ? { ...rect,\n width: newRect.width,\n height: newRect.height\n } : newRect;\n });\n break;\n }\n }\n }, [measure]);\n const resizeObserver = useResizeObserver({\n callback: handleResize\n });\n const handleNodeChange = useCallback(element => {\n const node = getMeasurableNode(element);\n resizeObserver == null ? void 0 : resizeObserver.disconnect();\n\n if (node) {\n resizeObserver == null ? void 0 : resizeObserver.observe(node);\n }\n\n setRect(node ? measure(node) : null);\n }, [measure, resizeObserver]);\n const [nodeRef, setRef] = useNodeRef(handleNodeChange);\n return useMemo(() => ({\n nodeRef,\n rect,\n setRef\n }), [rect, nodeRef, setRef]);\n}\n\nconst defaultSensors = [{\n sensor: PointerSensor,\n options: {}\n}, {\n sensor: KeyboardSensor,\n options: {}\n}];\nconst defaultData = {\n current: {}\n};\nconst defaultMeasuringConfiguration = {\n draggable: {\n measure: getTransformAgnosticClientRect\n },\n droppable: {\n measure: getTransformAgnosticClientRect,\n strategy: MeasuringStrategy.WhileDragging,\n frequency: MeasuringFrequency.Optimized\n },\n dragOverlay: {\n measure: getClientRect\n }\n};\n\nclass DroppableContainersMap extends Map {\n get(id) {\n var _super$get;\n\n return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined;\n }\n\n toArray() {\n return Array.from(this.values());\n }\n\n getEnabled() {\n return this.toArray().filter(_ref => {\n let {\n disabled\n } = _ref;\n return !disabled;\n });\n }\n\n getNodeFor(id) {\n var _this$get$node$curren, _this$get;\n\n return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined;\n }\n\n}\n\nconst defaultPublicContext = {\n activatorEvent: null,\n active: null,\n activeNode: null,\n activeNodeRect: null,\n collisions: null,\n containerNodeRect: null,\n draggableNodes: /*#__PURE__*/new Map(),\n droppableRects: /*#__PURE__*/new Map(),\n droppableContainers: /*#__PURE__*/new DroppableContainersMap(),\n over: null,\n dragOverlay: {\n nodeRef: {\n current: null\n },\n rect: null,\n setRef: noop\n },\n scrollableAncestors: [],\n scrollableAncestorRects: [],\n measuringConfiguration: defaultMeasuringConfiguration,\n measureDroppableContainers: noop,\n windowRect: null,\n measuringScheduled: false\n};\nconst defaultInternalContext = {\n activatorEvent: null,\n activators: [],\n active: null,\n activeNodeRect: null,\n ariaDescribedById: {\n draggable: ''\n },\n dispatch: noop,\n draggableNodes: /*#__PURE__*/new Map(),\n over: null,\n measureDroppableContainers: noop\n};\nconst InternalContext = /*#__PURE__*/createContext(defaultInternalContext);\nconst PublicContext = /*#__PURE__*/createContext(defaultPublicContext);\n\nfunction getInitialState() {\n return {\n draggable: {\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n nodes: new Map(),\n translate: {\n x: 0,\n y: 0\n }\n },\n droppable: {\n containers: new DroppableContainersMap()\n }\n };\n}\nfunction reducer(state, action) {\n switch (action.type) {\n case Action.DragStart:\n return { ...state,\n draggable: { ...state.draggable,\n initialCoordinates: action.initialCoordinates,\n active: action.active\n }\n };\n\n case Action.DragMove:\n if (state.draggable.active == null) {\n return state;\n }\n\n return { ...state,\n draggable: { ...state.draggable,\n translate: {\n x: action.coordinates.x - state.draggable.initialCoordinates.x,\n y: action.coordinates.y - state.draggable.initialCoordinates.y\n }\n }\n };\n\n case Action.DragEnd:\n case Action.DragCancel:\n return { ...state,\n draggable: { ...state.draggable,\n active: null,\n initialCoordinates: {\n x: 0,\n y: 0\n },\n translate: {\n x: 0,\n y: 0\n }\n }\n };\n\n case Action.RegisterDroppable:\n {\n const {\n element\n } = action;\n const {\n id\n } = element;\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, element);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.SetDroppableDisabled:\n {\n const {\n id,\n key,\n disabled\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.set(id, { ...element,\n disabled\n });\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n case Action.UnregisterDroppable:\n {\n const {\n id,\n key\n } = action;\n const element = state.droppable.containers.get(id);\n\n if (!element || key !== element.key) {\n return state;\n }\n\n const containers = new DroppableContainersMap(state.droppable.containers);\n containers.delete(id);\n return { ...state,\n droppable: { ...state.droppable,\n containers\n }\n };\n }\n\n default:\n {\n return state;\n }\n }\n}\n\nfunction RestoreFocus(_ref) {\n let {\n disabled\n } = _ref;\n const {\n active,\n activatorEvent,\n draggableNodes\n } = useContext(InternalContext);\n const previousActivatorEvent = usePrevious(activatorEvent);\n const previousActiveId = usePrevious(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {\n if (!isKeyboardEvent(previousActivatorEvent)) {\n return;\n }\n\n if (document.activeElement === previousActivatorEvent.target) {\n // No need to restore focus\n return;\n }\n\n const draggableNode = draggableNodes.get(previousActiveId);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n activatorNode,\n node\n } = draggableNode;\n\n if (!activatorNode.current && !node.current) {\n return;\n }\n\n requestAnimationFrame(() => {\n for (const element of [activatorNode.current, node.current]) {\n if (!element) {\n continue;\n }\n\n const focusableNode = findFirstFocusableNode(element);\n\n if (focusableNode) {\n focusableNode.focus();\n break;\n }\n }\n });\n }\n }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);\n return null;\n}\n\nfunction applyModifiers(modifiers, _ref) {\n let {\n transform,\n ...args\n } = _ref;\n return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {\n return modifier({\n transform: accumulator,\n ...args\n });\n }, transform) : transform;\n}\n\nfunction useMeasuringConfiguration(config) {\n return useMemo(() => ({\n draggable: { ...defaultMeasuringConfiguration.draggable,\n ...(config == null ? void 0 : config.draggable)\n },\n droppable: { ...defaultMeasuringConfiguration.droppable,\n ...(config == null ? void 0 : config.droppable)\n },\n dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay,\n ...(config == null ? void 0 : config.dragOverlay)\n }\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]);\n}\n\nfunction useLayoutShiftScrollCompensation(_ref) {\n let {\n activeNode,\n measure,\n initialRect,\n config = true\n } = _ref;\n const initialized = useRef(false);\n const {\n x,\n y\n } = typeof config === 'boolean' ? {\n x: config,\n y: config\n } : config;\n useIsomorphicLayoutEffect(() => {\n const disabled = !x && !y;\n\n if (disabled || !activeNode) {\n initialized.current = false;\n return;\n }\n\n if (initialized.current || !initialRect) {\n // Return early if layout shift scroll compensation was already attempted\n // or if there is no initialRect to compare to.\n return;\n } // Get the most up to date node ref for the active draggable\n\n\n const node = activeNode == null ? void 0 : activeNode.node.current;\n\n if (!node || node.isConnected === false) {\n // Return early if there is no attached node ref or if the node is\n // disconnected from the document.\n return;\n }\n\n const rect = measure(node);\n const rectDelta = getRectDelta(rect, initialRect);\n\n if (!x) {\n rectDelta.x = 0;\n }\n\n if (!y) {\n rectDelta.y = 0;\n } // Only perform layout shift scroll compensation once\n\n\n initialized.current = true;\n\n if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {\n const firstScrollableAncestor = getFirstScrollableAncestor(node);\n\n if (firstScrollableAncestor) {\n firstScrollableAncestor.scrollBy({\n top: rectDelta.y,\n left: rectDelta.x\n });\n }\n }\n }, [activeNode, x, y, initialRect, measure]);\n}\n\nconst ActiveDraggableContext = /*#__PURE__*/createContext({ ...defaultCoordinates,\n scaleX: 1,\n scaleY: 1\n});\nvar Status;\n\n(function (Status) {\n Status[Status[\"Uninitialized\"] = 0] = \"Uninitialized\";\n Status[Status[\"Initializing\"] = 1] = \"Initializing\";\n Status[Status[\"Initialized\"] = 2] = \"Initialized\";\n})(Status || (Status = {}));\n\nconst DndContext = /*#__PURE__*/memo(function DndContext(_ref) {\n var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;\n\n let {\n id,\n accessibility,\n autoScroll = true,\n children,\n sensors = defaultSensors,\n collisionDetection = rectIntersection,\n measuring,\n modifiers,\n ...props\n } = _ref;\n const store = useReducer(reducer, undefined, getInitialState);\n const [state, dispatch] = store;\n const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();\n const [status, setStatus] = useState(Status.Uninitialized);\n const isInitialized = status === Status.Initialized;\n const {\n draggable: {\n active: activeId,\n nodes: draggableNodes,\n translate\n },\n droppable: {\n containers: droppableContainers\n }\n } = state;\n const node = activeId != null ? draggableNodes.get(activeId) : null;\n const activeRects = useRef({\n initial: null,\n translated: null\n });\n const active = useMemo(() => {\n var _node$data;\n\n return activeId != null ? {\n id: activeId,\n // It's possible for the active node to unmount while dragging\n data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,\n rect: activeRects\n } : null;\n }, [activeId, node]);\n const activeRef = useRef(null);\n const [activeSensor, setActiveSensor] = useState(null);\n const [activatorEvent, setActivatorEvent] = useState(null);\n const latestProps = useLatestValue(props, Object.values(props));\n const draggableDescribedById = useUniqueId(\"DndDescribedBy\", id);\n const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);\n const measuringConfiguration = useMeasuringConfiguration(measuring);\n const {\n droppableRects,\n measureDroppableContainers,\n measuringScheduled\n } = useDroppableMeasuring(enabledDroppableContainers, {\n dragging: isInitialized,\n dependencies: [translate.x, translate.y],\n config: measuringConfiguration.droppable\n });\n const activeNode = useCachedNode(draggableNodes, activeId);\n const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);\n const autoScrollOptions = getAutoScrollerOptions();\n const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);\n useLayoutShiftScrollCompensation({\n activeNode: activeId != null ? draggableNodes.get(activeId) : null,\n config: autoScrollOptions.layoutShiftCompensation,\n initialRect: initialActiveNodeRect,\n measure: measuringConfiguration.draggable.measure\n });\n const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);\n const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);\n const sensorContext = useRef({\n activatorEvent: null,\n active: null,\n activeNode,\n collisionRect: null,\n collisions: null,\n droppableRects,\n draggableNodes,\n draggingNode: null,\n draggingNodeRect: null,\n droppableContainers,\n over: null,\n scrollableAncestors: [],\n scrollAdjustedTranslate: null\n });\n const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);\n const dragOverlay = useDragOverlayMeasuring({\n measure: measuringConfiguration.dragOverlay.measure\n }); // Use the rect of the drag overlay if it is mounted\n\n const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;\n const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;\n const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node\n // is only relevant when there is no drag overlay\n\n const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node\n\n const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); // Get scrollable ancestors of the dragging node\n\n const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);\n const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers\n\n const modifiedTranslate = applyModifiers(modifiers, {\n transform: {\n x: translate.x - nodeRectDelta.x,\n y: translate.y - nodeRectDelta.y,\n scaleX: 1,\n scaleY: 1\n },\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect,\n over: sensorContext.current.over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n });\n const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;\n const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated\n\n const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured\n\n const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);\n const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);\n const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;\n const collisions = active && collisionRect ? collisionDetection({\n active,\n collisionRect,\n droppableRects,\n droppableContainers: enabledDroppableContainers,\n pointerCoordinates\n }) : null;\n const overId = getFirstCollision(collisions, 'id');\n const [over, setOver] = useState(null); // When there is no drag overlay used, we need to account for the\n // window scroll delta\n\n const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);\n const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);\n const activeSensorRef = useRef(null);\n const instantiateSensor = useCallback((event, _ref2) => {\n let {\n sensor: Sensor,\n options\n } = _ref2;\n\n if (activeRef.current == null) {\n return;\n }\n\n const activeNode = draggableNodes.get(activeRef.current);\n\n if (!activeNode) {\n return;\n }\n\n const activatorEvent = event.nativeEvent;\n const sensorInstance = new Sensor({\n active: activeRef.current,\n activeNode,\n event: activatorEvent,\n options,\n // Sensors need to be instantiated with refs for arguments that change over time\n // otherwise they are frozen in time with the stale arguments\n context: sensorContext,\n\n onAbort(id) {\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragAbort\n } = latestProps.current;\n const event = {\n id\n };\n onDragAbort == null ? void 0 : onDragAbort(event);\n dispatchMonitorEvent({\n type: 'onDragAbort',\n event\n });\n },\n\n onPending(id, constraint, initialCoordinates, offset) {\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragPending\n } = latestProps.current;\n const event = {\n id,\n constraint,\n initialCoordinates,\n offset\n };\n onDragPending == null ? void 0 : onDragPending(event);\n dispatchMonitorEvent({\n type: 'onDragPending',\n event\n });\n },\n\n onStart(initialCoordinates) {\n const id = activeRef.current;\n\n if (id == null) {\n return;\n }\n\n const draggableNode = draggableNodes.get(id);\n\n if (!draggableNode) {\n return;\n }\n\n const {\n onDragStart\n } = latestProps.current;\n const event = {\n activatorEvent,\n active: {\n id,\n data: draggableNode.data,\n rect: activeRects\n }\n };\n unstable_batchedUpdates(() => {\n onDragStart == null ? void 0 : onDragStart(event);\n setStatus(Status.Initializing);\n dispatch({\n type: Action.DragStart,\n initialCoordinates,\n active: id\n });\n dispatchMonitorEvent({\n type: 'onDragStart',\n event\n });\n setActiveSensor(activeSensorRef.current);\n setActivatorEvent(activatorEvent);\n });\n },\n\n onMove(coordinates) {\n dispatch({\n type: Action.DragMove,\n coordinates\n });\n },\n\n onEnd: createHandler(Action.DragEnd),\n onCancel: createHandler(Action.DragCancel)\n });\n activeSensorRef.current = sensorInstance;\n\n function createHandler(type) {\n return async function handler() {\n const {\n active,\n collisions,\n over,\n scrollAdjustedTranslate\n } = sensorContext.current;\n let event = null;\n\n if (active && scrollAdjustedTranslate) {\n const {\n cancelDrop\n } = latestProps.current;\n event = {\n activatorEvent,\n active: active,\n collisions,\n delta: scrollAdjustedTranslate,\n over\n };\n\n if (type === Action.DragEnd && typeof cancelDrop === 'function') {\n const shouldCancel = await Promise.resolve(cancelDrop(event));\n\n if (shouldCancel) {\n type = Action.DragCancel;\n }\n }\n }\n\n activeRef.current = null;\n unstable_batchedUpdates(() => {\n dispatch({\n type\n });\n setStatus(Status.Uninitialized);\n setOver(null);\n setActiveSensor(null);\n setActivatorEvent(null);\n activeSensorRef.current = null;\n const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';\n\n if (event) {\n const handler = latestProps.current[eventName];\n handler == null ? void 0 : handler(event);\n dispatchMonitorEvent({\n type: eventName,\n event\n });\n }\n });\n };\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes]);\n const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {\n return (event, active) => {\n const nativeEvent = event.nativeEvent;\n const activeDraggableNode = draggableNodes.get(active);\n\n if ( // Another sensor is already instantiating\n activeRef.current !== null || // No active draggable\n !activeDraggableNode || // Event has already been captured\n nativeEvent.dndKit || nativeEvent.defaultPrevented) {\n return;\n }\n\n const activationContext = {\n active: activeDraggableNode\n };\n const shouldActivate = handler(event, sensor.options, activationContext);\n\n if (shouldActivate === true) {\n nativeEvent.dndKit = {\n capturedBy: sensor.sensor\n };\n activeRef.current = active;\n instantiateSensor(event, sensor);\n }\n };\n }, [draggableNodes, instantiateSensor]);\n const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);\n useSensorSetup(sensors);\n useIsomorphicLayoutEffect(() => {\n if (activeNodeRect && status === Status.Initializing) {\n setStatus(Status.Initialized);\n }\n }, [activeNodeRect, status]);\n useEffect(() => {\n const {\n onDragMove\n } = latestProps.current;\n const {\n active,\n activatorEvent,\n collisions,\n over\n } = sensorContext.current;\n\n if (!active || !activatorEvent) {\n return;\n }\n\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n onDragMove == null ? void 0 : onDragMove(event);\n dispatchMonitorEvent({\n type: 'onDragMove',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]);\n useEffect(() => {\n const {\n active,\n activatorEvent,\n collisions,\n droppableContainers,\n scrollAdjustedTranslate\n } = sensorContext.current;\n\n if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) {\n return;\n }\n\n const {\n onDragOver\n } = latestProps.current;\n const overContainer = droppableContainers.get(overId);\n const over = overContainer && overContainer.rect.current ? {\n id: overContainer.id,\n rect: overContainer.rect.current,\n data: overContainer.data,\n disabled: overContainer.disabled\n } : null;\n const event = {\n active,\n activatorEvent,\n collisions,\n delta: {\n x: scrollAdjustedTranslate.x,\n y: scrollAdjustedTranslate.y\n },\n over\n };\n unstable_batchedUpdates(() => {\n setOver(over);\n onDragOver == null ? void 0 : onDragOver(event);\n dispatchMonitorEvent({\n type: 'onDragOver',\n event\n });\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [overId]);\n useIsomorphicLayoutEffect(() => {\n sensorContext.current = {\n activatorEvent,\n active,\n activeNode,\n collisionRect,\n collisions,\n droppableRects,\n draggableNodes,\n draggingNode,\n draggingNodeRect,\n droppableContainers,\n over,\n scrollableAncestors,\n scrollAdjustedTranslate\n };\n activeRects.current = {\n initial: draggingNodeRect,\n translated: collisionRect\n };\n }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);\n useAutoScroller({ ...autoScrollOptions,\n delta: translate,\n draggingRect: collisionRect,\n pointerCoordinates,\n scrollableAncestors,\n scrollableAncestorRects\n });\n const publicContext = useMemo(() => {\n const context = {\n active,\n activeNode,\n activeNodeRect,\n activatorEvent,\n collisions,\n containerNodeRect,\n dragOverlay,\n draggableNodes,\n droppableContainers,\n droppableRects,\n over,\n measureDroppableContainers,\n scrollableAncestors,\n scrollableAncestorRects,\n measuringConfiguration,\n measuringScheduled,\n windowRect\n };\n return context;\n }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);\n const internalContext = useMemo(() => {\n const context = {\n activatorEvent,\n activators,\n active,\n activeNodeRect,\n ariaDescribedById: {\n draggable: draggableDescribedById\n },\n dispatch,\n draggableNodes,\n over,\n measureDroppableContainers\n };\n return context;\n }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);\n return React.createElement(DndMonitorContext.Provider, {\n value: registerMonitorListener\n }, React.createElement(InternalContext.Provider, {\n value: internalContext\n }, React.createElement(PublicContext.Provider, {\n value: publicContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: transform\n }, children)), React.createElement(RestoreFocus, {\n disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false\n })), React.createElement(Accessibility, { ...accessibility,\n hiddenTextDescribedById: draggableDescribedById\n }));\n\n function getAutoScrollerOptions() {\n const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;\n const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false;\n const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;\n\n if (typeof autoScroll === 'object') {\n return { ...autoScroll,\n enabled\n };\n }\n\n return {\n enabled\n };\n }\n});\n\nconst NullContext = /*#__PURE__*/createContext(null);\nconst defaultRole = 'button';\nconst ID_PREFIX = 'Draggable';\nfunction useDraggable(_ref) {\n let {\n id,\n data,\n disabled = false,\n attributes\n } = _ref;\n const key = useUniqueId(ID_PREFIX);\n const {\n activators,\n activatorEvent,\n active,\n activeNodeRect,\n ariaDescribedById,\n draggableNodes,\n over\n } = useContext(InternalContext);\n const {\n role = defaultRole,\n roleDescription = 'draggable',\n tabIndex = 0\n } = attributes != null ? attributes : {};\n const isDragging = (active == null ? void 0 : active.id) === id;\n const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);\n const [node, setNodeRef] = useNodeRef();\n const [activatorNode, setActivatorNodeRef] = useNodeRef();\n const listeners = useSyntheticListeners(activators, id);\n const dataRef = useLatestValue(data);\n useIsomorphicLayoutEffect(() => {\n draggableNodes.set(id, {\n id,\n key,\n node,\n activatorNode,\n data: dataRef\n });\n return () => {\n const node = draggableNodes.get(id);\n\n if (node && node.key === key) {\n draggableNodes.delete(id);\n }\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [draggableNodes, id]);\n const memoizedAttributes = useMemo(() => ({\n role,\n tabIndex,\n 'aria-disabled': disabled,\n 'aria-pressed': isDragging && role === defaultRole ? true : undefined,\n 'aria-roledescription': roleDescription,\n 'aria-describedby': ariaDescribedById.draggable\n }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);\n return {\n active,\n activatorEvent,\n activeNodeRect,\n attributes: memoizedAttributes,\n isDragging,\n listeners: disabled ? undefined : listeners,\n node,\n over,\n setNodeRef,\n setActivatorNodeRef,\n transform\n };\n}\n\nfunction useDndContext() {\n return useContext(PublicContext);\n}\n\nconst ID_PREFIX$1 = 'Droppable';\nconst defaultResizeObserverConfig = {\n timeout: 25\n};\nfunction useDroppable(_ref) {\n let {\n data,\n disabled = false,\n id,\n resizeObserverConfig\n } = _ref;\n const key = useUniqueId(ID_PREFIX$1);\n const {\n active,\n dispatch,\n over,\n measureDroppableContainers\n } = useContext(InternalContext);\n const previous = useRef({\n disabled\n });\n const resizeObserverConnected = useRef(false);\n const rect = useRef(null);\n const callbackId = useRef(null);\n const {\n disabled: resizeObserverDisabled,\n updateMeasurementsFor,\n timeout: resizeObserverTimeout\n } = { ...defaultResizeObserverConfig,\n ...resizeObserverConfig\n };\n const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);\n const handleResize = useCallback(() => {\n if (!resizeObserverConnected.current) {\n // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called,\n // assuming the element is rendered and displayed.\n resizeObserverConnected.current = true;\n return;\n }\n\n if (callbackId.current != null) {\n clearTimeout(callbackId.current);\n }\n\n callbackId.current = setTimeout(() => {\n measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);\n callbackId.current = null;\n }, resizeObserverTimeout);\n }, //eslint-disable-next-line react-hooks/exhaustive-deps\n [resizeObserverTimeout]);\n const resizeObserver = useResizeObserver({\n callback: handleResize,\n disabled: resizeObserverDisabled || !active\n });\n const handleNodeChange = useCallback((newElement, previousElement) => {\n if (!resizeObserver) {\n return;\n }\n\n if (previousElement) {\n resizeObserver.unobserve(previousElement);\n resizeObserverConnected.current = false;\n }\n\n if (newElement) {\n resizeObserver.observe(newElement);\n }\n }, [resizeObserver]);\n const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);\n const dataRef = useLatestValue(data);\n useEffect(() => {\n if (!resizeObserver || !nodeRef.current) {\n return;\n }\n\n resizeObserver.disconnect();\n resizeObserverConnected.current = false;\n resizeObserver.observe(nodeRef.current);\n }, [nodeRef, resizeObserver]);\n useEffect(() => {\n dispatch({\n type: Action.RegisterDroppable,\n element: {\n id,\n key,\n disabled,\n node: nodeRef,\n rect,\n data: dataRef\n }\n });\n return () => dispatch({\n type: Action.UnregisterDroppable,\n key,\n id\n });\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [id]);\n useEffect(() => {\n if (disabled !== previous.current.disabled) {\n dispatch({\n type: Action.SetDroppableDisabled,\n id,\n key,\n disabled\n });\n previous.current.disabled = disabled;\n }\n }, [id, key, disabled, dispatch]);\n return {\n active,\n rect,\n isOver: (over == null ? void 0 : over.id) === id,\n node: nodeRef,\n over,\n setNodeRef\n };\n}\n\nfunction AnimationManager(_ref) {\n let {\n animation,\n children\n } = _ref;\n const [clonedChildren, setClonedChildren] = useState(null);\n const [element, setElement] = useState(null);\n const previousChildren = usePrevious(children);\n\n if (!children && !clonedChildren && previousChildren) {\n setClonedChildren(previousChildren);\n }\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const key = clonedChildren == null ? void 0 : clonedChildren.key;\n const id = clonedChildren == null ? void 0 : clonedChildren.props.id;\n\n if (key == null || id == null) {\n setClonedChildren(null);\n return;\n }\n\n Promise.resolve(animation(id, element)).then(() => {\n setClonedChildren(null);\n });\n }, [animation, clonedChildren, element]);\n return React.createElement(React.Fragment, null, children, clonedChildren ? cloneElement(clonedChildren, {\n ref: setElement\n }) : null);\n}\n\nconst defaultTransform = {\n x: 0,\n y: 0,\n scaleX: 1,\n scaleY: 1\n};\nfunction NullifiedContextProvider(_ref) {\n let {\n children\n } = _ref;\n return React.createElement(InternalContext.Provider, {\n value: defaultInternalContext\n }, React.createElement(ActiveDraggableContext.Provider, {\n value: defaultTransform\n }, children));\n}\n\nconst baseStyles = {\n position: 'fixed',\n touchAction: 'none'\n};\n\nconst defaultTransition = activatorEvent => {\n const isKeyboardActivator = isKeyboardEvent(activatorEvent);\n return isKeyboardActivator ? 'transform 250ms ease' : undefined;\n};\n\nconst PositionedOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {\n let {\n as,\n activatorEvent,\n adjustScale,\n children,\n className,\n rect,\n style,\n transform,\n transition = defaultTransition\n } = _ref;\n\n if (!rect) {\n return null;\n }\n\n const scaleAdjustedTransform = adjustScale ? transform : { ...transform,\n scaleX: 1,\n scaleY: 1\n };\n const styles = { ...baseStyles,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n left: rect.left,\n transform: CSS.Transform.toString(scaleAdjustedTransform),\n transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : undefined,\n transition: typeof transition === 'function' ? transition(activatorEvent) : transition,\n ...style\n };\n return React.createElement(as, {\n className,\n style: styles,\n ref\n }, children);\n});\n\nconst defaultDropAnimationSideEffects = options => _ref => {\n let {\n active,\n dragOverlay\n } = _ref;\n const originalStyles = {};\n const {\n styles,\n className\n } = options;\n\n if (styles != null && styles.active) {\n for (const [key, value] of Object.entries(styles.active)) {\n if (value === undefined) {\n continue;\n }\n\n originalStyles[key] = active.node.style.getPropertyValue(key);\n active.node.style.setProperty(key, value);\n }\n }\n\n if (styles != null && styles.dragOverlay) {\n for (const [key, value] of Object.entries(styles.dragOverlay)) {\n if (value === undefined) {\n continue;\n }\n\n dragOverlay.node.style.setProperty(key, value);\n }\n }\n\n if (className != null && className.active) {\n active.node.classList.add(className.active);\n }\n\n if (className != null && className.dragOverlay) {\n dragOverlay.node.classList.add(className.dragOverlay);\n }\n\n return function cleanup() {\n for (const [key, value] of Object.entries(originalStyles)) {\n active.node.style.setProperty(key, value);\n }\n\n if (className != null && className.active) {\n active.node.classList.remove(className.active);\n }\n };\n};\n\nconst defaultKeyframeResolver = _ref2 => {\n let {\n transform: {\n initial,\n final\n }\n } = _ref2;\n return [{\n transform: CSS.Transform.toString(initial)\n }, {\n transform: CSS.Transform.toString(final)\n }];\n};\n\nconst defaultDropAnimationConfiguration = {\n duration: 250,\n easing: 'ease',\n keyframes: defaultKeyframeResolver,\n sideEffects: /*#__PURE__*/defaultDropAnimationSideEffects({\n styles: {\n active: {\n opacity: '0'\n }\n }\n })\n};\nfunction useDropAnimation(_ref3) {\n let {\n config,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n } = _ref3;\n return useEvent((id, node) => {\n if (config === null) {\n return;\n }\n\n const activeDraggable = draggableNodes.get(id);\n\n if (!activeDraggable) {\n return;\n }\n\n const activeNode = activeDraggable.node.current;\n\n if (!activeNode) {\n return;\n }\n\n const measurableNode = getMeasurableNode(node);\n\n if (!measurableNode) {\n return;\n }\n\n const {\n transform\n } = getWindow(node).getComputedStyle(node);\n const parsedTransform = parseTransform(transform);\n\n if (!parsedTransform) {\n return;\n }\n\n const animation = typeof config === 'function' ? config : createDefaultDropAnimation(config);\n scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure);\n return animation({\n active: {\n id,\n data: activeDraggable.data,\n node: activeNode,\n rect: measuringConfiguration.draggable.measure(activeNode)\n },\n draggableNodes,\n dragOverlay: {\n node,\n rect: measuringConfiguration.dragOverlay.measure(measurableNode)\n },\n droppableContainers,\n measuringConfiguration,\n transform: parsedTransform\n });\n });\n}\n\nfunction createDefaultDropAnimation(options) {\n const {\n duration,\n easing,\n sideEffects,\n keyframes\n } = { ...defaultDropAnimationConfiguration,\n ...options\n };\n return _ref4 => {\n let {\n active,\n dragOverlay,\n transform,\n ...rest\n } = _ref4;\n\n if (!duration) {\n // Do not animate if animation duration is zero.\n return;\n }\n\n const delta = {\n x: dragOverlay.rect.left - active.rect.left,\n y: dragOverlay.rect.top - active.rect.top\n };\n const scale = {\n scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1,\n scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1\n };\n const finalTransform = {\n x: transform.x - delta.x,\n y: transform.y - delta.y,\n ...scale\n };\n const animationKeyframes = keyframes({ ...rest,\n active,\n dragOverlay,\n transform: {\n initial: transform,\n final: finalTransform\n }\n });\n const [firstKeyframe] = animationKeyframes;\n const lastKeyframe = animationKeyframes[animationKeyframes.length - 1];\n\n if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) {\n // The start and end keyframes are the same, infer that there is no animation needed.\n return;\n }\n\n const cleanup = sideEffects == null ? void 0 : sideEffects({\n active,\n dragOverlay,\n ...rest\n });\n const animation = dragOverlay.node.animate(animationKeyframes, {\n duration,\n easing,\n fill: 'forwards'\n });\n return new Promise(resolve => {\n animation.onfinish = () => {\n cleanup == null ? void 0 : cleanup();\n resolve();\n };\n });\n };\n}\n\nlet key = 0;\nfunction useKey(id) {\n return useMemo(() => {\n if (id == null) {\n return;\n }\n\n key++;\n return key;\n }, [id]);\n}\n\nconst DragOverlay = /*#__PURE__*/React.memo(_ref => {\n let {\n adjustScale = false,\n children,\n dropAnimation: dropAnimationConfig,\n style,\n transition,\n modifiers,\n wrapperElement = 'div',\n className,\n zIndex = 999\n } = _ref;\n const {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggableNodes,\n droppableContainers,\n dragOverlay,\n over,\n measuringConfiguration,\n scrollableAncestors,\n scrollableAncestorRects,\n windowRect\n } = useDndContext();\n const transform = useContext(ActiveDraggableContext);\n const key = useKey(active == null ? void 0 : active.id);\n const modifiedTransform = applyModifiers(modifiers, {\n activatorEvent,\n active,\n activeNodeRect,\n containerNodeRect,\n draggingNodeRect: dragOverlay.rect,\n over,\n overlayNodeRect: dragOverlay.rect,\n scrollableAncestors,\n scrollableAncestorRects,\n transform,\n windowRect\n });\n const initialRect = useInitialValue(activeNodeRect);\n const dropAnimation = useDropAnimation({\n config: dropAnimationConfig,\n draggableNodes,\n droppableContainers,\n measuringConfiguration\n }); // We need to wait for the active node to be measured before connecting the drag overlay ref\n // otherwise collisions can be computed against a mispositioned drag overlay\n\n const ref = initialRect ? dragOverlay.setRef : undefined;\n return React.createElement(NullifiedContextProvider, null, React.createElement(AnimationManager, {\n animation: dropAnimation\n }, active && key ? React.createElement(PositionedOverlay, {\n key: key,\n id: active.id,\n ref: ref,\n as: wrapperElement,\n activatorEvent: activatorEvent,\n adjustScale: adjustScale,\n className: className,\n transition: transition,\n rect: initialRect,\n style: {\n zIndex,\n ...style\n },\n transform: modifiedTransform\n }, children) : null));\n});\n\nexport { AutoScrollActivator, DndContext, DragOverlay, KeyboardCode, KeyboardSensor, MeasuringFrequency, MeasuringStrategy, MouseSensor, PointerSensor, TouchSensor, TraversalOrder, applyModifiers, closestCenter, closestCorners, defaultAnnouncements, defaultCoordinates, defaultDropAnimationConfiguration as defaultDropAnimation, defaultDropAnimationSideEffects, defaultKeyboardCoordinateGetter, defaultScreenReaderInstructions, getClientRect, getFirstCollision, getScrollableAncestors, pointerWithin, rectIntersection, useDndContext, useDndMonitor, useDraggable, useDroppable, useSensor, useSensors };\n//# sourceMappingURL=core.esm.js.map\n","import React, { useState, useCallback, ReactNode, useEffect } from 'react';\nimport {\n DndContext,\n DragEndEvent,\n DragStartEvent,\n DragMoveEvent,\n closestCenter,\n PointerSensor,\n useSensor,\n useSensors,\n useDroppable,\n useDraggable,\n} from '@dnd-kit/core';\nimport { ConfigurablePanelLayout, ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';\nimport { PanelLayout, PanelDefinition } from './PanelConfigurator';\nimport './EditablePanelLayout.css';\n\nexport interface EditableConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {\n /** Whether edit mode is enabled (controlled) */\n isEditMode: boolean;\n\n /** Callback when layout changes in edit mode */\n onLayoutChange?: (layout: PanelLayout) => void;\n\n /** Available panels for drag-and-drop */\n availablePanels?: PanelDefinition[];\n}\n\ntype SlotPosition = 'left' | 'middle' | 'right';\n\n\n// Slot Overlay Component for Edit Mode\ninterface SlotOverlayWrapperProps {\n slotPosition: SlotPosition;\n isEditing: boolean;\n isDragging: boolean;\n children: ReactNode;\n}\n\nconst SlotOverlayWrapper: React.FC<SlotOverlayWrapperProps> = ({\n slotPosition,\n isEditing,\n isDragging,\n children,\n}) => {\n const { attributes, listeners, setNodeRef: setDraggableRef, transform } = useDraggable({\n id: `slot-${slotPosition}`,\n data: { slotPosition },\n disabled: !isEditing,\n });\n\n const { setNodeRef: setDroppableRef, isOver } = useDroppable({\n id: `drop-${slotPosition}`,\n data: { slotPosition },\n });\n\n const style: React.CSSProperties = {\n position: 'relative',\n height: '100%',\n width: '100%',\n transform: transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined,\n };\n\n // Merge refs\n const setRefs = useCallback((node: HTMLDivElement | null) => {\n setDraggableRef(node);\n setDroppableRef(node);\n }, [setDraggableRef, setDroppableRef]);\n\n return (\n <div\n ref={setRefs}\n style={style}\n className={`slot-with-overlay ${isEditing ? 'edit-mode' : ''} ${isDragging ? 'dragging' : ''} ${isOver ? 'drag-over' : ''}`}\n >\n {children}\n {isEditing && (\n <div\n className=\"slot-edit-overlay\"\n {...attributes}\n {...listeners}\n >\n <div className=\"drag-indicator\">⋮⋮</div>\n <div className=\"slot-position-label\">{slotPosition.toUpperCase()}</div>\n </div>\n )}\n </div>\n );\n};\n\n/**\n * EditableConfigurablePanelLayout - Wrapper component that adds iPhone-style edit mode\n * Allows dragging entire slot sections (left/middle/right) to rearrange them\n */\nexport const EditableConfigurablePanelLayout: React.FC<EditableConfigurablePanelLayoutProps> = ({\n isEditMode,\n onLayoutChange,\n panels,\n layout,\n ...layoutProps\n}) => {\n const [activeSlot, setActiveSlot] = useState<SlotPosition | null>(null);\n const [dragOffset, setDragOffset] = useState<{ x: number; y: number }>({ x: 0, y: 0 });\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 8,\n },\n })\n );\n\n const handleDragStart = useCallback((event: DragStartEvent) => {\n const id = event.active.id as string;\n if (id.startsWith('slot-')) {\n const slotPosition = id.replace('slot-', '') as SlotPosition;\n setActiveSlot(slotPosition);\n setDragOffset({ x: 0, y: 0 });\n }\n }, []);\n\n const handleDragMove = useCallback((event: DragMoveEvent) => {\n const { delta } = event;\n setDragOffset({ x: delta.x, y: delta.y });\n }, []);\n\n const handleDragEnd = useCallback((event: DragEndEvent) => {\n const { active, over } = event;\n setActiveSlot(null);\n setDragOffset({ x: 0, y: 0 });\n\n if (!over) return;\n\n const activeId = active.id as string;\n const overId = over.id as string;\n\n // Extract slot positions\n const sourceSlot = activeId.replace('slot-', '') as SlotPosition;\n const targetSlot = overId.replace('drop-', '') as SlotPosition;\n\n if (sourceSlot === targetSlot) return;\n\n // Swap the slot contents\n const newLayout = { ...layout };\n const temp = newLayout[sourceSlot];\n newLayout[sourceSlot] = newLayout[targetSlot];\n newLayout[targetSlot] = temp;\n\n // Notify parent of layout change\n if (onLayoutChange) {\n onLayoutChange(newLayout);\n }\n }, [layout, onLayoutChange]);\n\n // Apply transforms to slots during drag\n useEffect(() => {\n if (!activeSlot || !isEditMode) return;\n\n const element = document.querySelector(`[data-slot=\"${activeSlot}\"]`) as HTMLElement;\n\n if (element) {\n // Mark as dragging\n element.setAttribute('data-dragging', 'true');\n\n // Apply transform with !important to override any existing transforms\n // Keep the scale(0.95) and add the translation\n element.style.setProperty('transform', `scale(0.95) translate(${dragOffset.x}px, ${dragOffset.y}px)`, 'important');\n element.style.setProperty('z-index', '1000', 'important');\n element.style.setProperty('transition', 'none', 'important');\n element.style.setProperty('opacity', '0.95', 'important');\n element.style.setProperty('box-shadow', '0 12px 24px rgba(0, 0, 0, 0.25)', 'important');\n }\n\n return () => {\n if (element) {\n element.removeAttribute('data-dragging');\n element.style.removeProperty('transform');\n element.style.removeProperty('z-index');\n element.style.removeProperty('transition');\n element.style.removeProperty('opacity');\n element.style.removeProperty('box-shadow');\n }\n };\n }, [activeSlot, dragOffset, isEditMode]);\n\n // Create data attributes for slot identification\n const slotDataAttributes = {\n left: { 'data-slot': 'left', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n middle: { 'data-slot': 'middle', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n right: { 'data-slot': 'right', 'data-edit-mode': isEditMode ? 'true' : 'false' },\n };\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragMove={handleDragMove}\n onDragEnd={handleDragEnd}\n >\n <div className={`editable-panel-layout ${isEditMode ? 'edit-mode-active' : ''}`}>\n {/* Render layout with data attributes */}\n <ConfigurablePanelLayout\n {...layoutProps}\n panels={panels}\n layout={layout}\n slotDataAttributes={slotDataAttributes}\n />\n\n {/* Slot overlays for edit mode - provides draggable areas */}\n {isEditMode && (\n <SlotOverlays\n layout={layout}\n activeSlot={activeSlot}\n onDragStart={() => {}}\n onDragEnd={() => {}}\n />\n )}\n </div>\n </DndContext>\n );\n};\n\n// Slot Overlays Component - renders absolutely positioned overlays on top of slots\ninterface SlotOverlaysProps {\n layout: PanelLayout;\n activeSlot: SlotPosition | null;\n onDragStart: () => void;\n onDragEnd: () => void;\n}\n\nconst SlotOverlays: React.FC<SlotOverlaysProps> = ({ layout, activeSlot }) => {\n const [slotRects, setSlotRects] = useState<Map<SlotPosition, DOMRect>>(new Map());\n\n // Update slot positions\n React.useEffect(() => {\n const updatePositions = () => {\n const newRects = new Map<SlotPosition, DOMRect>();\n\n (['left', 'middle', 'right'] as SlotPosition[]).forEach(slot => {\n const element = document.querySelector(`[data-slot=\"${slot}\"]`);\n if (element) {\n const rect = element.getBoundingClientRect();\n newRects.set(slot, rect);\n }\n });\n\n setSlotRects(newRects);\n };\n\n updatePositions();\n\n // Update on resize\n window.addEventListener('resize', updatePositions);\n const interval = setInterval(updatePositions, 100); // Poll for changes\n\n return () => {\n window.removeEventListener('resize', updatePositions);\n clearInterval(interval);\n };\n }, [layout]);\n\n return (\n <div style={{ pointerEvents: 'none', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 999 }}>\n {(['left', 'middle', 'right'] as SlotPosition[]).map(slotPosition => {\n const slot = layout[slotPosition];\n if (!slot) return null;\n\n const rect = slotRects.get(slotPosition);\n if (!rect) return null;\n\n const isDragging = activeSlot === slotPosition;\n\n return (\n <div\n key={slotPosition}\n style={{\n position: 'fixed',\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height,\n pointerEvents: 'auto',\n }}\n >\n <SlotOverlayWrapper\n slotPosition={slotPosition}\n isEditing={true}\n isDragging={isDragging}\n >\n <div style={{ height: '100%' }} />\n </SlotOverlayWrapper>\n </div>\n );\n })}\n </div>\n );\n};\n","// src/glassmorphismTheme.ts\nvar glassmorphismTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.4,\n relaxed: 1.8\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 8, 12, 16, 20, 24, 32, 40],\n shadows: [\n \"none\",\n \"0 8px 32px 0 rgba(31, 38, 135, 0.15)\",\n \"0 12px 40px 0 rgba(31, 38, 135, 0.2)\",\n \"0 16px 48px 0 rgba(31, 38, 135, 0.25)\",\n \"0 20px 56px 0 rgba(31, 38, 135, 0.3)\",\n \"0 24px 64px 0 rgba(31, 38, 135, 0.35)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"rgba(255, 255, 255, 0.95)\",\n background: \"rgba(255, 255, 255, 0.1)\",\n primary: \"rgba(99, 102, 241, 0.9)\",\n secondary: \"rgba(139, 92, 246, 0.9)\",\n accent: \"rgba(236, 72, 153, 0.9)\",\n highlight: \"rgba(99, 102, 241, 0.2)\",\n muted: \"rgba(255, 255, 255, 0.05)\",\n success: \"rgba(34, 197, 94, 0.9)\",\n warning: \"rgba(251, 146, 60, 0.9)\",\n error: \"rgba(239, 68, 68, 0.9)\",\n info: \"rgba(59, 130, 246, 0.9)\",\n border: \"rgba(255, 255, 255, 0.18)\",\n backgroundSecondary: \"rgba(255, 255, 255, 0.15)\",\n backgroundTertiary: \"rgba(255, 255, 255, 0.2)\",\n backgroundLight: \"rgba(255, 255, 255, 0.08)\",\n backgroundHover: \"rgba(255, 255, 255, 0.25)\",\n surface: \"rgba(255, 255, 255, 0.12)\",\n textSecondary: \"rgba(255, 255, 255, 0.8)\",\n textTertiary: \"rgba(255, 255, 255, 0.6)\",\n textMuted: \"rgba(255, 255, 255, 0.5)\",\n highlightBg: \"rgba(251, 191, 36, 0.3)\",\n highlightBorder: \"rgba(251, 191, 36, 0.5)\"\n },\n modes: {\n dark: {\n text: \"rgba(255, 255, 255, 0.95)\",\n background: \"rgba(0, 0, 0, 0.3)\",\n primary: \"rgba(129, 140, 248, 0.9)\",\n secondary: \"rgba(167, 139, 250, 0.9)\",\n accent: \"rgba(244, 114, 182, 0.9)\",\n highlight: \"rgba(129, 140, 248, 0.25)\",\n muted: \"rgba(0, 0, 0, 0.15)\",\n success: \"rgba(74, 222, 128, 0.9)\",\n warning: \"rgba(251, 191, 36, 0.9)\",\n error: \"rgba(248, 113, 113, 0.9)\",\n info: \"rgba(96, 165, 250, 0.9)\",\n border: \"rgba(255, 255, 255, 0.15)\",\n backgroundSecondary: \"rgba(0, 0, 0, 0.4)\",\n backgroundTertiary: \"rgba(0, 0, 0, 0.5)\",\n backgroundLight: \"rgba(0, 0, 0, 0.2)\",\n backgroundHover: \"rgba(255, 255, 255, 0.1)\",\n surface: \"rgba(0, 0, 0, 0.35)\",\n textSecondary: \"rgba(255, 255, 255, 0.8)\",\n textTertiary: \"rgba(255, 255, 255, 0.6)\",\n textMuted: \"rgba(255, 255, 255, 0.4)\",\n highlightBg: \"rgba(251, 191, 36, 0.35)\",\n highlightBorder: \"rgba(251, 191, 36, 0.6)\"\n },\n frosted: {\n text: \"rgba(31, 41, 55, 0.95)\",\n background: \"rgba(255, 255, 255, 0.3)\",\n primary: \"rgba(79, 70, 229, 0.95)\",\n secondary: \"rgba(124, 58, 237, 0.95)\",\n accent: \"rgba(219, 39, 119, 0.95)\",\n highlight: \"rgba(79, 70, 229, 0.15)\",\n muted: \"rgba(255, 255, 255, 0.4)\",\n success: \"rgba(16, 185, 129, 0.95)\",\n warning: \"rgba(245, 158, 11, 0.95)\",\n error: \"rgba(220, 38, 38, 0.95)\",\n info: \"rgba(37, 99, 235, 0.95)\",\n border: \"rgba(255, 255, 255, 0.5)\",\n backgroundSecondary: \"rgba(255, 255, 255, 0.4)\",\n backgroundTertiary: \"rgba(255, 255, 255, 0.5)\",\n backgroundLight: \"rgba(255, 255, 255, 0.25)\",\n backgroundHover: \"rgba(255, 255, 255, 0.6)\",\n surface: \"rgba(255, 255, 255, 0.35)\",\n textSecondary: \"rgba(31, 41, 55, 0.8)\",\n textTertiary: \"rgba(31, 41, 55, 0.6)\",\n textMuted: \"rgba(31, 41, 55, 0.5)\",\n highlightBg: \"rgba(251, 191, 36, 0.4)\",\n highlightBorder: \"rgba(251, 191, 36, 0.7)\"\n }\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"text\",\n bg: \"rgba(255, 255, 255, 0.1)\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n \"&:hover\": {\n bg: \"rgba(255, 255, 255, 0.2)\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"transparent\",\n \"&:hover\": {\n borderColor: \"rgba(255, 255, 255, 0.2)\",\n bg: \"rgba(255, 255, 255, 0.05)\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n }\n }\n};\n// src/defaultThemes.ts\nvar defaultMarkdownTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Crimson Text\", \"Georgia\", \"Times New Roman\", serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#1a1a1a\",\n background: \"#ffffff\",\n primary: \"#007acc\",\n secondary: \"#005a9e\",\n accent: \"#1a1a1a\",\n highlight: \"rgba(0, 122, 204, 0.1)\",\n muted: \"#f0f0f0\",\n success: \"#28a745\",\n warning: \"#ffc107\",\n error: \"#dc3545\",\n info: \"#17a2b8\",\n border: \"rgba(0, 0, 0, 0.1)\",\n backgroundSecondary: \"#f8f9fa\",\n backgroundTertiary: \"#e9ecef\",\n backgroundLight: \"rgba(0, 0, 0, 0.03)\",\n backgroundHover: \"rgba(0, 0, 0, 0.05)\",\n surface: \"#ffffff\",\n textSecondary: \"#555555\",\n textTertiary: \"#888888\",\n textMuted: \"#aaaaaa\",\n highlightBg: \"rgba(255, 235, 59, 0.3)\",\n highlightBorder: \"rgba(255, 235, 59, 0.6)\"\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n }\n }\n};\nvar defaultTerminalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", Courier, monospace',\n heading: '\"Courier New\", Courier, monospace',\n monospace: '\"Courier New\", Courier, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.4,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.6\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 0 5px rgba(255, 193, 7, 0.1)\",\n \"0 0 10px rgba(255, 193, 7, 0.15)\",\n \"0 0 15px rgba(255, 193, 7, 0.2)\",\n \"0 0 20px rgba(255, 193, 7, 0.25)\",\n \"0 0 30px rgba(255, 193, 7, 0.3)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#ffc107\",\n background: \"#000000\",\n primary: \"#ffc107\",\n secondary: \"#ffb300\",\n accent: \"#ffffff\",\n highlight: \"rgba(255, 193, 7, 0.1)\",\n muted: \"#1a1a1a\",\n success: \"#4caf50\",\n warning: \"#ff9800\",\n error: \"#f44336\",\n info: \"#2196f3\",\n border: \"rgba(255, 193, 7, 0.2)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(255, 193, 7, 0.03)\",\n backgroundHover: \"rgba(255, 193, 7, 0.05)\",\n surface: \"#050505\",\n textSecondary: \"#e0e0e0\",\n textTertiary: \"#b0b0b0\",\n textMuted: \"#808080\",\n highlightBg: \"rgba(255, 193, 7, 0.2)\",\n highlightBorder: \"rgba(255, 193, 7, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar defaultEditorTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px rgba(0, 0, 0, 0.1)\",\n \"0 4px 8px rgba(0, 0, 0, 0.15)\",\n \"0 8px 16px rgba(0, 0, 0, 0.2)\",\n \"0 12px 24px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#d4d4d4\",\n background: \"#1e1e1e\",\n primary: \"#569cd6\",\n secondary: \"#408ac9\",\n accent: \"#c586c0\",\n highlight: \"rgba(86, 156, 214, 0.1)\",\n muted: \"#2a2a2a\",\n success: \"#6a9955\",\n warning: \"#d18616\",\n error: \"#f44747\",\n info: \"#569cd6\",\n border: \"rgba(255, 255, 255, 0.1)\",\n backgroundSecondary: \"#252526\",\n backgroundTertiary: \"#333333\",\n backgroundLight: \"rgba(255, 255, 255, 0.03)\",\n backgroundHover: \"rgba(255, 255, 255, 0.05)\",\n surface: \"#252526\",\n textSecondary: \"#cccccc\",\n textTertiary: \"#999999\",\n textMuted: \"#666666\",\n highlightBg: \"rgba(255, 235, 59, 0.2)\",\n highlightBorder: \"rgba(255, 235, 59, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n \"&:hover\": { bg: \"secondary\" }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": { bg: \"highlight\" }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": { bg: \"backgroundHover\" }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n }\n }\n};\n\n// src/themes.ts\nvar regalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Crimson Text\", \"Georgia\", \"Times New Roman\", serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.25)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#f1e8dc\",\n background: \"#1a1f2e\",\n primary: \"#d4a574\",\n secondary: \"#e0b584\",\n accent: \"#c9b8a3\",\n highlight: \"rgba(212, 165, 116, 0.15)\",\n muted: \"#8b7968\",\n success: \"#5c8a72\",\n warning: \"#d4a574\",\n error: \"#a85751\",\n info: \"#d4a574\",\n border: \"rgba(212, 165, 116, 0.2)\",\n backgroundSecondary: \"#212738\",\n backgroundTertiary: \"#2d3446\",\n backgroundLight: \"rgba(212, 165, 116, 0.08)\",\n backgroundHover: \"rgba(212, 165, 116, 0.15)\",\n surface: \"#212738\",\n textSecondary: \"#c9b8a3\",\n textTertiary: \"#8b7968\",\n textMuted: \"#8b7968\",\n highlightBg: \"rgba(255, 193, 7, 0.25)\",\n highlightBorder: \"rgba(255, 193, 7, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"background\",\n bg: \"primary\",\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"text\",\n bg: \"muted\",\n \"&:hover\": {\n bg: \"backgroundSecondary\"\n }\n },\n ghost: {\n color: \"primary\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"muted\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"background\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 2\n }\n }\n};\nvar terminalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace',\n heading: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace',\n monospace: '\"SF Mono\", \"Monaco\", \"Inconsolata\", \"Fira Code\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.4,\n relaxed: 1.8\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px 0 rgba(0, 0, 0, 0.06)\",\n \"0 4px 6px 0 rgba(0, 0, 0, 0.07)\",\n \"0 8px 12px 0 rgba(0, 0, 0, 0.08)\",\n \"0 16px 24px 0 rgba(0, 0, 0, 0.10)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#e4e4e4\",\n background: \"rgba(10, 10, 10, 0.85)\",\n primary: \"#66b3ff\",\n secondary: \"#80c4ff\",\n accent: \"#66ff99\",\n highlight: \"rgba(102, 179, 255, 0.15)\",\n muted: \"rgba(26, 26, 26, 0.8)\",\n success: \"#66ff99\",\n warning: \"#ffcc66\",\n error: \"#ff6666\",\n info: \"#66b3ff\",\n border: \"rgba(255, 255, 255, 0.1)\",\n backgroundSecondary: \"rgba(15, 15, 15, 0.9)\",\n backgroundTertiary: \"rgba(20, 20, 20, 0.9)\",\n backgroundLight: \"rgba(255, 255, 255, 0.05)\",\n backgroundHover: \"rgba(102, 179, 255, 0.08)\",\n surface: \"rgba(15, 15, 15, 0.95)\",\n textSecondary: \"rgba(255, 255, 255, 0.7)\",\n textTertiary: \"rgba(255, 255, 255, 0.5)\",\n textMuted: \"rgba(255, 255, 255, 0.4)\",\n highlightBg: \"rgba(255, 235, 59, 0.25)\",\n highlightBorder: \"rgba(255, 235, 59, 0.5)\"\n },\n modes: {\n light: {\n text: \"#1a1a1a\",\n background: \"rgba(255, 255, 255, 0.9)\",\n primary: \"#0066cc\",\n secondary: \"#0052a3\",\n accent: \"#00cc88\",\n highlight: \"rgba(0, 102, 204, 0.08)\",\n muted: \"rgba(245, 245, 245, 0.8)\",\n success: \"#00cc88\",\n warning: \"#ffaa00\",\n error: \"#ff3333\",\n info: \"#0066cc\",\n border: \"rgba(0, 0, 0, 0.1)\",\n backgroundSecondary: \"rgba(250, 250, 250, 0.9)\",\n backgroundTertiary: \"rgba(245, 245, 245, 0.9)\",\n backgroundLight: \"rgba(0, 0, 0, 0.02)\",\n backgroundHover: \"rgba(0, 102, 204, 0.04)\",\n surface: \"rgba(255, 255, 255, 0.95)\",\n textSecondary: \"rgba(0, 0, 0, 0.6)\",\n textTertiary: \"rgba(0, 0, 0, 0.4)\",\n textMuted: \"rgba(0, 0, 0, 0.3)\",\n highlightBg: \"rgba(255, 235, 59, 0.3)\",\n highlightBorder: \"rgba(255, 235, 59, 0.6)\"\n }\n },\n buttons: {\n primary: {\n color: \"white\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"highlight\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 1\n }\n }\n};\nvar matrixTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n heading: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n monospace: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 0 5px rgba(0, 216, 53, 0.15)\",\n \"0 0 10px rgba(0, 216, 53, 0.2)\",\n \"0 0 15px rgba(0, 216, 53, 0.25)\",\n \"0 0 20px rgba(0, 216, 53, 0.3)\",\n \"0 0 30px rgba(0, 216, 53, 0.4)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#a8a8a8\",\n background: \"#000000\",\n primary: \"#00d835\",\n secondary: \"#00a828\",\n accent: \"#00d835\",\n highlight: \"rgba(0, 216, 53, 0.15)\",\n muted: \"#0a0a0a\",\n success: \"#00d835\",\n warning: \"#d4a000\",\n error: \"#d63333\",\n info: \"#00a8d6\",\n border: \"rgba(0, 216, 53, 0.2)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(0, 216, 53, 0.03)\",\n backgroundHover: \"rgba(0, 216, 53, 0.08)\",\n surface: \"#050505\",\n textSecondary: \"#808080\",\n textTertiary: \"#606060\",\n textMuted: \"#484848\",\n highlightBg: \"rgba(0, 216, 53, 0.25)\",\n highlightBorder: \"rgba(0, 216, 53, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"highlight\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar matrixMinimalTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n heading: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace',\n monospace: '\"Courier New\", \"Courier\", \"Lucida Console\", \"Monaco\", monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 500,\n bold: 600,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.5,\n heading: 1.2,\n tight: 1.3,\n relaxed: 1.7\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 2px rgba(0, 0, 0, 0.05)\",\n \"0 2px 4px rgba(0, 0, 0, 0.1)\",\n \"0 4px 8px rgba(0, 0, 0, 0.15)\",\n \"0 8px 16px rgba(0, 0, 0, 0.2)\",\n \"0 0 20px rgba(0, 216, 53, 0.1)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#a8a8a8\",\n background: \"#000000\",\n primary: \"#b8b8b8\",\n secondary: \"#909090\",\n accent: \"#00d835\",\n highlight: \"rgba(0, 216, 53, 0.1)\",\n muted: \"#0a0a0a\",\n success: \"#00d835\",\n warning: \"#d4a000\",\n error: \"#d63333\",\n info: \"#00a8d6\",\n border: \"rgba(184, 184, 184, 0.1)\",\n backgroundSecondary: \"#0a0a0a\",\n backgroundTertiary: \"#111111\",\n backgroundLight: \"rgba(184, 184, 184, 0.02)\",\n backgroundHover: \"rgba(0, 216, 53, 0.05)\",\n surface: \"#050505\",\n textSecondary: \"#808080\",\n textTertiary: \"#606060\",\n textMuted: \"#484848\",\n highlightBg: \"rgba(0, 216, 53, 0.2)\",\n highlightBorder: \"rgba(0, 216, 53, 0.4)\"\n },\n buttons: {\n primary: {\n color: \"black\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"secondary\"\n }\n },\n secondary: {\n color: \"primary\",\n bg: \"transparent\",\n borderWidth: 1,\n borderStyle: \"solid\",\n borderColor: \"primary\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n },\n ghost: {\n color: \"text\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textSecondary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 0\n }\n }\n};\nvar slateTheme = {\n space: [0, 4, 8, 16, 32, 64, 128, 256, 512],\n fonts: {\n body: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n heading: '\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n monospace: '\"Fira Code\", \"SF Mono\", Monaco, Inconsolata, monospace'\n },\n fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],\n fontScale: 1,\n fontWeights: {\n body: 400,\n heading: 600,\n bold: 700,\n light: 300,\n medium: 500,\n semibold: 600\n },\n lineHeights: {\n body: 1.6,\n heading: 1.3,\n tight: 1.25,\n relaxed: 1.75\n },\n breakpoints: [\"640px\", \"768px\", \"1024px\", \"1280px\"],\n sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],\n radii: [0, 2, 4, 6, 8, 12, 16, 24],\n shadows: [\n \"none\",\n \"0 1px 3px 0 rgba(0, 0, 0, 0.2)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.2)\",\n \"0 10px 15px -3px rgba(0, 0, 0, 0.2)\",\n \"0 20px 25px -5px rgba(0, 0, 0, 0.25)\",\n \"0 25px 50px -12px rgba(0, 0, 0, 0.3)\"\n ],\n zIndices: [0, 1, 10, 20, 30, 40, 50],\n colors: {\n text: \"#9ca3af\",\n background: \"#1a1c1e\",\n primary: \"#d1d5db\",\n secondary: \"#6b7280\",\n accent: \"#f59e0b\",\n highlight: \"rgba(209, 213, 219, 0.15)\",\n muted: \"#2d3134\",\n success: \"#10b981\",\n warning: \"#f59e0b\",\n error: \"#ef4444\",\n info: \"#3b82f6\",\n border: \"rgba(156, 163, 175, 0.15)\",\n backgroundSecondary: \"#22252a\",\n backgroundTertiary: \"#2d3134\",\n backgroundLight: \"rgba(156, 163, 175, 0.05)\",\n backgroundHover: \"rgba(156, 163, 175, 0.1)\",\n surface: \"#1f2124\",\n textSecondary: \"#e5e7eb\",\n textTertiary: \"#6b7280\",\n textMuted: \"#4b5563\",\n highlightBg: \"rgba(245, 158, 11, 0.25)\",\n highlightBorder: \"rgba(245, 158, 11, 0.5)\"\n },\n buttons: {\n primary: {\n color: \"#1a1c1e\",\n bg: \"primary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"#9ca3af\"\n }\n },\n secondary: {\n color: \"#e5e7eb\",\n bg: \"secondary\",\n borderWidth: 0,\n \"&:hover\": {\n bg: \"#4b5563\"\n }\n },\n ghost: {\n color: \"textSecondary\",\n bg: \"transparent\",\n \"&:hover\": {\n bg: \"backgroundHover\"\n }\n }\n },\n text: {\n heading: {\n fontFamily: \"heading\",\n fontWeight: \"heading\",\n lineHeight: \"heading\",\n color: \"textSecondary\"\n },\n body: {\n fontFamily: \"body\",\n fontWeight: \"body\",\n lineHeight: \"body\"\n },\n caption: {\n fontSize: 1,\n color: \"textTertiary\"\n }\n },\n cards: {\n primary: {\n bg: \"surface\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n },\n secondary: {\n bg: \"backgroundSecondary\",\n border: \"1px solid\",\n borderColor: \"border\",\n borderRadius: 3\n }\n }\n};\n// src/ThemeProvider.tsx\nimport React, { createContext, useContext, useState, useEffect } from \"react\";\n\n// src/themeHelpers.ts\nfunction overrideColors(theme, colors) {\n return {\n ...theme,\n colors: {\n ...theme.colors,\n ...colors\n }\n };\n}\nfunction makeTheme(baseTheme, overrides) {\n return {\n ...baseTheme,\n ...overrides,\n colors: {\n ...baseTheme.colors,\n ...overrides.colors\n },\n fonts: {\n ...baseTheme.fonts,\n ...overrides.fonts\n }\n };\n}\nfunction addMode(theme, modeName, colors, baseMode) {\n let baseColors;\n if (baseMode && theme.modes && theme.modes[baseMode]) {\n baseColors = {\n ...theme.colors,\n ...theme.modes[baseMode]\n };\n } else {\n baseColors = theme.colors;\n }\n const newMode = {\n ...baseColors,\n ...colors\n };\n return {\n ...theme,\n modes: {\n ...theme.modes,\n [modeName]: newMode\n }\n };\n}\nfunction getMode(theme, mode) {\n if (!mode || !theme.modes || !theme.modes[mode]) {\n return theme.colors;\n }\n return {\n ...theme.colors,\n ...theme.modes[mode]\n };\n}\n\n// src/ThemeProvider.tsx\nvar ThemeContext;\nvar getThemeContext = () => {\n if (typeof window !== \"undefined\") {\n const globalWindow = window;\n if (!globalWindow.__principlemd_theme_context__) {\n globalWindow.__principlemd_theme_context__ = createContext(undefined);\n }\n return globalWindow.__principlemd_theme_context__;\n } else {\n if (!ThemeContext) {\n ThemeContext = createContext(undefined);\n }\n return ThemeContext;\n }\n};\nvar ThemeContextSingleton = getThemeContext();\nvar useTheme = () => {\n const context = useContext(ThemeContextSingleton);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n return context;\n};\nvar ThemeProvider = ({\n children,\n theme: customTheme = theme,\n initialMode\n}) => {\n const [mode, setMode] = useState(initialMode);\n const activeTheme = React.useMemo(() => {\n if (!mode || !customTheme.modes || !customTheme.modes[mode]) {\n return customTheme;\n }\n return {\n ...customTheme,\n colors: getMode(customTheme, mode)\n };\n }, [customTheme, mode]);\n useEffect(() => {\n if (!initialMode) {\n const savedMode = localStorage.getItem(\"principlemd-theme-mode\");\n if (savedMode) {\n setMode(savedMode);\n }\n }\n }, [initialMode]);\n useEffect(() => {\n if (mode) {\n localStorage.setItem(\"principlemd-theme-mode\", mode);\n } else {\n localStorage.removeItem(\"principlemd-theme-mode\");\n }\n }, [mode]);\n const value = {\n theme: activeTheme,\n mode,\n setMode\n };\n return /* @__PURE__ */ React.createElement(ThemeContextSingleton.Provider, {\n value\n }, children);\n};\nvar withTheme = (Component) => {\n return (props) => {\n const { theme: theme2 } = useTheme();\n return /* @__PURE__ */ React.createElement(Component, {\n ...props,\n theme: theme2\n });\n };\n};\n// src/utils.ts\nvar getColor = (theme2, colorKey) => {\n const colors = theme2.colors;\n const value = colors[colorKey];\n return typeof value === \"string\" ? value : colorKey;\n};\nvar getSpace = (theme2, index) => {\n return theme2.space[index] || 0;\n};\nvar getFontSize = (theme2, index) => {\n return theme2.fontSizes[index] || theme2.fontSizes[2];\n};\nvar getRadius = (theme2, index) => {\n return theme2.radii[index] || 0;\n};\nvar getShadow = (theme2, index) => {\n return theme2.shadows[index] || \"none\";\n};\nvar getZIndex = (theme2, index) => {\n return theme2.zIndices[index] || 0;\n};\nvar responsive = (values) => {\n return values.reduce((acc, value, index) => {\n if (index === 0) {\n return value;\n }\n return {\n ...acc,\n [`@media screen and (min-width: ${values[index - 1]})`]: value\n };\n }, {});\n};\nvar sx = (styles) => styles;\nvar createStyle = (theme2, styleObj) => {\n const processValue = (value) => {\n if (typeof value === \"string\") {\n if (value in theme2.colors) {\n return getColor(theme2, value);\n }\n return value;\n }\n if (typeof value === \"number\") {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(processValue);\n }\n if (typeof value === \"object\" && value !== null) {\n const processed2 = {};\n for (const [key, val] of Object.entries(value)) {\n processed2[key] = processValue(val);\n }\n return processed2;\n }\n return value;\n };\n const processed = {};\n for (const [key, val] of Object.entries(styleObj)) {\n processed[key] = processValue(val);\n }\n return processed;\n};\nvar mergeThemes = (baseTheme, ...overrides) => {\n return overrides.reduce((theme2, override) => ({\n space: override.space || theme2.space,\n fonts: { ...theme2.fonts, ...override.fonts || {} },\n fontSizes: override.fontSizes || theme2.fontSizes,\n fontWeights: { ...theme2.fontWeights, ...override.fontWeights || {} },\n lineHeights: { ...theme2.lineHeights, ...override.lineHeights || {} },\n breakpoints: override.breakpoints || theme2.breakpoints,\n sizes: override.sizes || theme2.sizes,\n radii: override.radii || theme2.radii,\n shadows: override.shadows || theme2.shadows,\n zIndices: override.zIndices || theme2.zIndices,\n colors: {\n ...theme2.colors,\n ...override.colors || {}\n },\n buttons: { ...theme2.buttons, ...override.buttons || {} },\n text: { ...theme2.text, ...override.text || {} },\n cards: { ...theme2.cards, ...override.cards || {} }\n }), baseTheme);\n};\n// src/ThemeShowcase.tsx\nimport React2 from \"react\";\nvar ThemeShowcase = ({\n theme: theme2,\n title,\n showValues = true,\n sections = [\"colors\", \"typography\", \"spacing\", \"shadows\", \"radii\"]\n}) => {\n const containerStyle = {\n fontFamily: theme2.fonts.body,\n color: theme2.colors.text,\n backgroundColor: theme2.colors.background,\n padding: theme2.space[4],\n minHeight: \"100vh\"\n };\n const sectionStyle = {\n marginBottom: theme2.space[5],\n padding: theme2.space[4],\n backgroundColor: theme2.colors.surface || theme2.colors.backgroundSecondary,\n borderRadius: theme2.radii[2],\n border: `1px solid ${theme2.colors.border}`\n };\n const headingStyle = {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[5],\n fontWeight: theme2.fontWeights.heading,\n marginBottom: theme2.space[3],\n color: theme2.colors.primary\n };\n const subheadingStyle = {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[3],\n fontWeight: theme2.fontWeights.medium,\n marginBottom: theme2.space[2],\n marginTop: theme2.space[3],\n color: theme2.colors.text\n };\n return /* @__PURE__ */ React2.createElement(\"div\", {\n style: containerStyle\n }, title && /* @__PURE__ */ React2.createElement(\"h1\", {\n style: {\n ...headingStyle,\n fontSize: theme2.fontSizes[6],\n marginBottom: theme2.space[4]\n }\n }, title), sections.includes(\"colors\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Colors\"), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Primary Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3],\n marginBottom: theme2.space[3]\n }\n }, [\"text\", \"background\", \"primary\", \"secondary\", \"accent\", \"muted\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n padding: theme2.space[2],\n backgroundColor: theme2.colors.backgroundLight || theme2.colors.backgroundTertiary,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 40,\n height: 40,\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1],\n marginRight: theme2.space[2]\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", null, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, color)));\n })), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Status Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3],\n marginBottom: theme2.space[3]\n }\n }, [\"success\", \"warning\", \"error\", \"info\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n padding: theme2.space[2],\n backgroundColor: theme2.colors.backgroundLight || theme2.colors.backgroundTertiary,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 40,\n height: 40,\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1],\n marginRight: theme2.space[2]\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", null, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, color)));\n })), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Background Colors\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: theme2.space[3]\n }\n }, [\"backgroundSecondary\", \"backgroundTertiary\", \"backgroundLight\", \"backgroundHover\", \"surface\"].map((key) => {\n const color = theme2.colors[key];\n if (!color)\n return null;\n return /* @__PURE__ */ React2.createElement(\"div\", {\n key,\n style: {\n padding: theme2.space[3],\n backgroundColor: color,\n border: `1px solid ${theme2.colors.border}`,\n borderRadius: theme2.radii[1]\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n fontWeight: theme2.fontWeights.medium\n }\n }, key), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary,\n marginTop: theme2.space[1]\n }\n }, color));\n }))), sections.includes(\"typography\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Typography\"), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Families\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { marginBottom: theme2.space[4] }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.heading,\n fontSize: theme2.fontSizes[4],\n marginBottom: theme2.space[2]\n }\n }, \"Heading Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.heading)), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[2],\n marginBottom: theme2.space[2]\n }\n }, \"Body Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.body)), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[2]\n }\n }, \"Monospace Font: \", showValues && /* @__PURE__ */ React2.createElement(\"span\", {\n style: {\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \" \", theme2.fonts.monospace))), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Sizes\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { marginBottom: theme2.space[4] }\n }, theme2.fontSizes.map((size, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: {\n fontSize: size,\n lineHeight: theme2.lineHeights.body,\n marginBottom: theme2.space[1]\n }\n }, \"Size \", index, \": Sample Text \", showValues && `(${size}px)`))), /* @__PURE__ */ React2.createElement(\"h3\", {\n style: subheadingStyle\n }, \"Font Weights\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fit, minmax(150px, 1fr))\",\n gap: theme2.space[2]\n }\n }, Object.entries(theme2.fontWeights).map(([name, weight]) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: name,\n style: {\n fontWeight: weight,\n fontSize: theme2.fontSizes[2]\n }\n }, name, \" \", showValues && `(${weight})`)))), sections.includes(\"spacing\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Spacing\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: { display: \"flex\", flexDirection: \"column\", gap: theme2.space[2] }\n }, theme2.space.map((space, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { display: \"flex\", alignItems: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 60,\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, \"[\", index, \"]\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n height: 24,\n width: space,\n backgroundColor: theme2.colors.primary,\n borderRadius: theme2.radii[1]\n }\n }), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n marginLeft: theme2.space[2],\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[1],\n color: theme2.colors.textSecondary\n }\n }, space, \"px\"))))), sections.includes(\"radii\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Border Radii\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(100px, 1fr))\",\n gap: theme2.space[3]\n }\n }, theme2.radii.map((radius, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { textAlign: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 80,\n height: 80,\n backgroundColor: theme2.colors.primary,\n borderRadius: radius,\n marginBottom: theme2.space[1],\n margin: \"0 auto\"\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, \"[\", index, \"] \", showValues && `${radius}px`))))), sections.includes(\"shadows\") && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Shadows\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(150px, 1fr))\",\n gap: theme2.space[4]\n }\n }, theme2.shadows.map((shadow, index) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: index,\n style: { textAlign: \"center\" }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n width: 100,\n height: 100,\n backgroundColor: theme2.colors.background,\n boxShadow: shadow,\n borderRadius: theme2.radii[2],\n margin: \"0 auto\",\n marginBottom: theme2.space[2],\n border: `1px solid ${theme2.colors.border}`\n }\n }), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textSecondary\n }\n }, \"Shadow [\", index, \"]\"), showValues && /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n fontFamily: theme2.fonts.monospace,\n fontSize: theme2.fontSizes[0],\n color: theme2.colors.textMuted,\n marginTop: theme2.space[1]\n }\n }, shadow === \"none\" ? \"none\" : \"...\"))))), theme2.modes && Object.keys(theme2.modes).length > 0 && /* @__PURE__ */ React2.createElement(\"div\", {\n style: sectionStyle\n }, /* @__PURE__ */ React2.createElement(\"h2\", {\n style: headingStyle\n }, \"Available Modes\"), /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n display: \"flex\",\n gap: theme2.space[2],\n flexWrap: \"wrap\"\n }\n }, /* @__PURE__ */ React2.createElement(\"div\", {\n style: {\n padding: `${theme2.space[2]}px ${theme2.space[3]}px`,\n backgroundColor: theme2.colors.primary,\n color: \"#ffffff\",\n borderRadius: theme2.radii[2],\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[1]\n }\n }, \"default\"), Object.keys(theme2.modes).map((modeName) => /* @__PURE__ */ React2.createElement(\"div\", {\n key: modeName,\n style: {\n padding: `${theme2.space[2]}px ${theme2.space[3]}px`,\n backgroundColor: theme2.colors.secondary,\n color: theme2.colors.text,\n borderRadius: theme2.radii[2],\n fontFamily: theme2.fonts.body,\n fontSize: theme2.fontSizes[1]\n }\n }, modeName)))));\n};\n\n// src/index.ts\nvar theme = terminalTheme;\nfunction scaleThemeFonts(theme2, scale) {\n const currentScale = theme2.fontScale || 1;\n const effectiveScale = scale / currentScale;\n return {\n ...theme2,\n fontSizes: theme2.fontSizes.map((size) => Math.round(size * effectiveScale)),\n fontScale: scale\n };\n}\nfunction increaseFontScale(theme2) {\n const currentScale = theme2.fontScale || 1;\n const newScale = Math.min(currentScale * 1.1, 2);\n return scaleThemeFonts(theme2, newScale);\n}\nfunction decreaseFontScale(theme2) {\n const currentScale = theme2.fontScale || 1;\n const newScale = Math.max(currentScale * 0.9, 0.5);\n return scaleThemeFonts(theme2, newScale);\n}\nfunction resetFontScale(theme2) {\n return scaleThemeFonts(theme2, 1);\n}\nvar src_default = theme;\nexport {\n withTheme,\n useTheme,\n theme,\n terminalTheme,\n sx,\n slateTheme,\n scaleThemeFonts,\n responsive,\n resetFontScale,\n regalTheme,\n overrideColors,\n mergeThemes,\n matrixTheme,\n matrixMinimalTheme,\n makeTheme,\n increaseFontScale,\n glassmorphismTheme,\n getZIndex,\n getSpace,\n getShadow,\n getRadius,\n getMode,\n getFontSize,\n getColor,\n defaultTerminalTheme,\n defaultMarkdownTheme,\n defaultEditorTheme,\n src_default as default,\n decreaseFontScale,\n createStyle,\n addMode,\n ThemeShowcase,\n ThemeProvider\n};\n","import React, { useState, useCallback } from 'react';\nimport { useTheme, Theme } from '@principal-ade/industry-theme';\nimport './PanelConfigurator.css';\n\nexport interface PanelDefinition {\n id: string;\n label: string;\n preview?: React.ReactNode;\n icon?: React.ReactNode;\n}\n\nexport type PanelSlot =\n | string // Single panel ID\n | null // Empty slot\n | PanelGroup; // Multiple panels grouped together\n\nexport interface PanelGroup {\n type: 'tabs' | 'tiles';\n panels: string[]; // Array of panel IDs\n config?: TabsConfig | TilesConfig;\n}\n\nexport interface TabsConfig {\n defaultActiveTab?: number; // Which tab is active by default (index) - for uncontrolled mode\n tabPosition?: 'top' | 'bottom' | 'left' | 'right';\n centered?: boolean; // Whether to center the tabs\n hideTabList?: boolean; // Whether to hide the tab list and show only active tab content\n\n // Controlled mode props\n activeTabIndex?: number; // Controlled active tab index\n onTabChange?: (index: number) => void; // Callback when tab changes\n}\n\nexport interface TilesConfig {\n direction?: 'horizontal' | 'vertical' | 'grid';\n columns?: number;\n rows?: number;\n tileSizes?: number[]; // Size percentages for each tile\n}\n\nexport interface PanelLayout {\n left?: PanelSlot;\n middle?: PanelSlot;\n right?: PanelSlot;\n}\n\nexport interface PanelConfiguratorProps {\n /** Available panels that can be placed in slots */\n availablePanels: PanelDefinition[];\n\n /** Current layout configuration */\n currentLayout: PanelLayout;\n\n /** Callback when layout changes */\n onChange: (layout: PanelLayout) => void;\n\n /** Optional class name for the container */\n className?: string;\n\n /** Optional theme override (uses context theme by default) */\n theme?: Theme;\n}\n\ntype SlotPosition = 'left' | 'middle' | 'right';\ntype Selection = { type: 'slot'; position: SlotPosition } | { type: 'panel'; id: string } | null;\n\n// Helper to check if a slot is a group\nconst isGroup = (slot: PanelSlot | undefined): slot is PanelGroup => {\n return slot !== null && slot !== undefined && typeof slot === 'object' && 'type' in slot;\n};\n\n// Helper to get panel IDs from a slot\nconst getPanelIdsFromSlot = (slot: PanelSlot | undefined): string[] => {\n if (slot === null || slot === undefined) return [];\n if (typeof slot === 'string') return [slot];\n if (isGroup(slot)) return slot.panels;\n return [];\n};\n\n/**\n * PanelConfigurator - Interactive UI for configuring panel layout\n *\n * Interaction modes:\n * - Click slot → click panel: Assigns panel to slot\n * - Click panel → click slot: Assigns panel to slot\n * - Click slot → click slot: Swaps their content\n */\nexport const PanelConfigurator: React.FC<PanelConfiguratorProps> = ({\n availablePanels,\n currentLayout,\n onChange,\n className = '',\n theme: themeProp,\n}) => {\n const contextTheme = useTheme();\n const theme = themeProp || contextTheme.theme;\n const [selection, setSelection] = useState<Selection>(null);\n\n // Get panel by id\n const getPanelById = useCallback((id: string | null) => {\n if (!id) return null;\n return availablePanels.find(p => p.id === id) || null;\n }, [availablePanels]);\n\n // Get all panels sorted alphabetically\n const getSortedPanels = useCallback(() => {\n return [...availablePanels].sort((a, b) => a.label.localeCompare(b.label));\n }, [availablePanels]);\n\n // Check if a panel is in use\n const isPanelInUse = useCallback((panelId: string) => {\n const leftIds = getPanelIdsFromSlot(currentLayout.left);\n const middleIds = getPanelIdsFromSlot(currentLayout.middle);\n const rightIds = getPanelIdsFromSlot(currentLayout.right);\n return leftIds.includes(panelId) || middleIds.includes(panelId) || rightIds.includes(panelId);\n }, [currentLayout]);\n\n // Remove panel from any slot\n const removePanelFromLayout = useCallback((layout: PanelLayout, panelId: string): PanelLayout => {\n const newLayout = { ...layout };\n (['left', 'middle', 'right'] as SlotPosition[]).forEach((pos) => {\n const slot = newLayout[pos];\n if (slot === panelId) {\n newLayout[pos] = null;\n } else if (slot !== null && slot !== undefined && isGroup(slot)) {\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n if (filteredPanels.length === 0) {\n newLayout[pos] = null;\n } else if (filteredPanels.length === 1) {\n newLayout[pos] = filteredPanels[0];\n } else {\n newLayout[pos] = { ...slot, panels: filteredPanels };\n }\n }\n });\n return newLayout;\n }, []);\n\n // Toggle panel in/out of tab group (preserves tab mode)\n const togglePanelInTabGroup = useCallback((position: SlotPosition, panelId: string) => {\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n const newLayout = { ...currentLayout };\n\n // Always keep tab mode structure, just update panels array\n newLayout[position] = { ...slot, panels: filteredPanels };\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Toggle tab mode for a slot\n const toggleTabMode = useCallback((position: SlotPosition, e: React.MouseEvent) => {\n e.stopPropagation();\n const slot = currentLayout[position];\n\n if (isGroup(slot) && slot.type === 'tabs') {\n // Disable tab mode - convert to single panel (first panel in group) or null\n const newLayout = { ...currentLayout };\n newLayout[position] = slot.panels.length > 0 ? slot.panels[0] : null;\n onChange(newLayout);\n setSelection(null);\n } else {\n // Enable tab mode - top/bottom are auto-centered\n const panels: string[] = slot && typeof slot === 'string' ? [slot] : [];\n const newLayout = { ...currentLayout };\n newLayout[position] = {\n type: 'tabs',\n panels,\n config: { defaultActiveTab: 0, tabPosition: 'top' } // Top/bottom auto-center\n };\n onChange(newLayout);\n // Automatically select the slot so user can immediately add panels\n setSelection({ type: 'slot', position });\n }\n }, [currentLayout, onChange]);\n\n // Handle slot click\n const handleSlotClick = useCallback((position: SlotPosition) => {\n if (!selection) {\n // First click - select this slot\n setSelection({ type: 'slot', position });\n return;\n }\n\n if (selection.type === 'slot') {\n // If clicking the same slot that's already selected, keep it selected (don't swap)\n if (selection.position === position) {\n return;\n }\n\n // Swap two different slots\n const newLayout = { ...currentLayout };\n const temp = newLayout[selection.position];\n newLayout[selection.position] = newLayout[position];\n newLayout[position] = temp;\n onChange(newLayout);\n setSelection(null);\n } else {\n // Assign panel to slot\n const slot = currentLayout[position];\n\n // If slot is in tab mode, add/remove panel from the tab group\n if (isGroup(slot) && slot.type === 'tabs') {\n // Check if panel is already in this group - if so, remove it\n if (slot.panels.includes(selection.id)) {\n togglePanelInTabGroup(position, selection.id);\n // Keep slot selected so user can add more panels\n return;\n }\n\n // Save the current group before removing the panel from layout\n const currentGroup = slot;\n const newLayout = removePanelFromLayout(currentLayout, selection.id);\n\n // Add panel to the saved group (preserving tab mode even if removePanelFromLayout modified it)\n newLayout[position] = {\n ...currentGroup,\n panels: [...currentGroup.panels, selection.id]\n };\n\n onChange(newLayout);\n // Keep slot selected so user can add more panels\n return;\n } else {\n // Replace slot with panel\n const newLayout = removePanelFromLayout(currentLayout, selection.id);\n newLayout[position] = selection.id;\n onChange(newLayout);\n setSelection(null);\n }\n }\n }, [selection, currentLayout, onChange, removePanelFromLayout, togglePanelInTabGroup]);\n\n // Handle panel click\n const handlePanelClick = useCallback((panelId: string) => {\n if (!selection) {\n // First click - select this panel\n setSelection({ type: 'panel', id: panelId });\n return;\n }\n\n if (selection.type === 'slot') {\n // Assign panel to the selected slot\n const slot = currentLayout[selection.position];\n\n // If slot is in tab mode, add/remove panel from the tab group\n if (isGroup(slot) && slot.type === 'tabs') {\n // Check if panel is already in this group - if so, remove it\n if (slot.panels.includes(panelId)) {\n togglePanelInTabGroup(selection.position, panelId);\n // Keep slot selected so user can add more panels\n return;\n }\n\n // Save the current group before removing the panel from layout\n const currentGroup = slot;\n const newLayout = removePanelFromLayout(currentLayout, panelId);\n\n // Add panel to the saved group (preserving tab mode even if removePanelFromLayout modified it)\n newLayout[selection.position] = {\n ...currentGroup,\n panels: [...currentGroup.panels, panelId]\n };\n\n onChange(newLayout);\n // Keep slot selected so user can add more panels\n return;\n } else {\n // Replace slot with panel\n const newLayout = removePanelFromLayout(currentLayout, panelId);\n newLayout[selection.position] = panelId;\n onChange(newLayout);\n setSelection(null);\n }\n } else {\n // Change selection to this panel\n setSelection({ type: 'panel', id: panelId });\n }\n }, [selection, currentLayout, onChange, removePanelFromLayout, togglePanelInTabGroup]);\n\n // Handle slot clear (remove panel from slot)\n const handleSlotClear = useCallback((position: SlotPosition, e: React.MouseEvent) => {\n e.stopPropagation();\n const newLayout = { ...currentLayout };\n newLayout[position] = null;\n onChange(newLayout);\n setSelection(null);\n }, [currentLayout, onChange]);\n\n // Remove panel from tab group (preserves tab mode)\n const removePanelFromTabGroup = useCallback((position: SlotPosition, panelId: string, e: React.MouseEvent) => {\n e.stopPropagation();\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const filteredPanels = slot.panels.filter(id => id !== panelId);\n const newLayout = { ...currentLayout };\n\n // Always preserve tab mode structure, just update panels array\n newLayout[position] = { ...slot, panels: filteredPanels };\n\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Update tab configuration\n const updateTabConfig = useCallback((position: SlotPosition, config: Partial<TabsConfig>) => {\n const slot = currentLayout[position];\n if (!isGroup(slot) || slot.type !== 'tabs') return;\n\n const newLayout = { ...currentLayout };\n newLayout[position] = {\n ...slot,\n config: { ...(slot.config as TabsConfig), ...config }\n };\n\n onChange(newLayout);\n }, [currentLayout, onChange]);\n\n // Check if item is selected\n const isSlotSelected = (position: SlotPosition) =>\n selection?.type === 'slot' && selection.position === position;\n\n const isPanelSelected = (panelId: string) =>\n selection?.type === 'panel' && selection.id === panelId;\n\n const sortedPanels = getSortedPanels();\n\n const isTabModeSlot = (position: SlotPosition) => {\n const slot = currentLayout[position];\n return isGroup(slot) && slot.type === 'tabs';\n };\n\n // Apply theme colors as CSS variables\n const themeStyles = {\n '--configurator-bg': theme.colors.background,\n '--configurator-title': theme.colors.textSecondary,\n\n '--slot-bg': theme.colors.backgroundSecondary,\n '--slot-border': theme.colors.border,\n '--slot-border-hover': theme.colors.textTertiary,\n '--slot-border-selected': theme.colors.primary,\n '--slot-bg-selected': theme.colors.backgroundLight,\n '--slot-label': theme.colors.textTertiary,\n '--slot-content-text': theme.colors.text,\n '--slot-preview-bg': theme.colors.backgroundTertiary,\n '--slot-preview-border': theme.colors.border,\n '--slot-preview-text': theme.colors.textMuted,\n '--slot-empty-text': theme.colors.textMuted,\n\n '--panel-bg': theme.colors.backgroundSecondary,\n '--panel-border': theme.colors.border,\n '--panel-border-hover': theme.colors.textSecondary,\n '--panel-border-selected': theme.colors.primary,\n '--panel-bg-selected': theme.colors.backgroundLight,\n '--panel-label-text': theme.colors.text,\n '--panel-preview-bg': theme.colors.backgroundTertiary,\n '--panel-preview-text': theme.colors.textMuted,\n\n '--clear-btn-bg': theme.colors.error,\n '--clear-btn-text': theme.colors.background,\n '--clear-btn-hover': theme.colors.error,\n\n '--hint-bg': theme.colors.backgroundLight,\n '--hint-border': theme.colors.primary,\n '--hint-text': theme.colors.text,\n } as React.CSSProperties;\n\n return (\n <div className={`panel-configurator ${className}`} style={themeStyles}>\n <div className=\"configurator-section\">\n <h3 className=\"section-title\">Panel Layout (3 Slots)</h3>\n <div className=\"slots-container\">\n {(['left', 'middle', 'right'] as SlotPosition[]).map((position) => {\n const slot = currentLayout[position];\n const selected = isSlotSelected(position);\n const isTabGroup = isGroup(slot) && slot.type === 'tabs';\n const isFilled = slot !== null;\n\n return (\n <div\n key={position}\n data-position={position}\n className={`slot ${selected ? 'selected' : ''} ${isFilled ? 'filled' : 'empty'} ${isTabGroup ? 'tab-group' : ''}`}\n onClick={() => handleSlotClick(position)}\n >\n <button\n className={`tab-mode-toggle ${isTabGroup ? 'active' : ''}`}\n onClick={(e) => toggleTabMode(position, e)}\n title={isTabGroup ? 'Disable tab mode' : 'Enable tab mode'}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2h4v2H2V2zm5 0h4v2H7V2zm5 0h2v2h-2V2zM2 5h12v9H2V5zm1 1v7h10V6H3z\"/>\n </svg>\n </button>\n\n {slot === null ? (\n <div className=\"slot-empty-state\">\n {isTabGroup ? 'Click panels to add tabs' : 'Empty'}\n </div>\n ) : isGroup(slot) ? (\n <div className=\"slot-content group-content\">\n {slot.type === 'tabs' && slot.panels.length > 0 && (\n <div className=\"tab-config-controls\">\n <label className=\"tab-config-label\">\n Tabs:\n <select\n value={(slot.config as TabsConfig)?.tabPosition || 'top'}\n onChange={(e) => updateTabConfig(position, { tabPosition: e.target.value as 'top' | 'bottom' | 'left' | 'right' })}\n onClick={(e) => e.stopPropagation()}\n >\n <option value=\"top\">Top (centered)</option>\n <option value=\"bottom\">Bottom (centered)</option>\n <option value=\"left\">Left</option>\n <option value=\"right\">Right</option>\n </select>\n </label>\n </div>\n )}\n <div className=\"group-panels\">\n {slot.panels.length === 0 ? (\n <div className=\"slot-empty-state\">Click panels to add tabs</div>\n ) : (\n slot.panels.map((panelId, idx) => {\n const panel = getPanelById(panelId);\n const isDefaultTab = slot.type === 'tabs' && ((slot.config as TabsConfig)?.defaultActiveTab ?? 0) === idx;\n return panel ? (\n <div key={panelId} className=\"group-panel-item\">\n <span className=\"group-panel-label\">\n {panel.label}\n {isDefaultTab && <span className=\"default-badge\">★</span>}\n </span>\n <button\n className=\"remove-from-group-btn\"\n onClick={(e) => removePanelFromTabGroup(position, panelId, e)}\n title={`Remove ${panel.label}`}\n >\n ×\n </button>\n </div>\n ) : null;\n })\n )}\n </div>\n </div>\n ) : (\n <div className=\"slot-content\">\n {typeof slot === 'string' && getPanelById(slot)?.preview && (\n <div className=\"slot-preview\">{getPanelById(slot)?.preview}</div>\n )}\n <div className=\"slot-panel-label\">{typeof slot === 'string' ? getPanelById(slot)?.label : ''}</div>\n <button\n className=\"slot-clear-btn\"\n onClick={(e) => handleSlotClear(position, e)}\n aria-label={`Remove ${typeof slot === 'string' ? getPanelById(slot)?.label : 'panel'} from ${position} slot`}\n >\n ×\n </button>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n\n <div className=\"configurator-section\">\n <h3 className=\"section-title\">Available Panels</h3>\n <div className=\"available-panels\">\n {sortedPanels.map((panel) => {\n const selected = isPanelSelected(panel.id);\n const inUse = isPanelInUse(panel.id);\n return (\n <div\n key={panel.id}\n className={`available-panel ${selected ? 'selected' : ''} ${inUse ? 'in-use' : ''}`}\n onClick={() => handlePanelClick(panel.id)}\n >\n <div className=\"panel-label\">{panel.label}</div>\n {panel.preview && (\n <div className=\"panel-preview\">{panel.preview}</div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n\n {selection && (\n <div className=\"selection-hint\">\n {selection.type === 'slot' ? (\n isTabModeSlot(selection.position) ? (\n <>Selected: {selection.position} slot (Tab Mode). Click panels to add them to the tab group.</>\n ) : (\n <>Selected: {selection.position} slot. Click another slot to swap, or click a panel to assign.</>\n )\n ) : (\n <>Selected: {getPanelById(selection.id)?.label}. Click a slot to assign{isTabModeSlot('left') || isTabModeSlot('middle') || isTabModeSlot('right') ? ' (or add to tab group)' : ''}.</>\n )}\n </div>\n )}\n\n <div className=\"usage-hint\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={{ verticalAlign: 'text-bottom', marginRight: '4px' }}>\n <path d=\"M8 1a7 7 0 100 14A7 7 0 008 1zm0 1a6 6 0 110 12A6 6 0 018 2zm.5 3.5v3h-1v-3h1zm0 4v1h-1v-1h1z\"/>\n </svg>\n <strong>Tip:</strong> Toggle the tab icon on a slot to enable tab mode, then click panels to add multiple tabs.\n </div>\n </div>\n );\n};\n"],"names":["mapThemeToPanelVars","theme","colors","background","border","backgroundSecondary","backgroundHover","primary","surface","textSecondary","mapThemeToTabVars","text","textMuted","AnimatedResizableLayout","leftPanel","rightPanel","collapsibleSide","defaultSize","minSize","className","collapsed","style","showCollapseButton","animationDuration","animationEasing","onCollapseStart","onCollapseComplete","onExpandStart","onExpandComplete","isCollapsed","setIsCollapsed","useState","isAnimating","setIsAnimating","isDragging","setIsDragging","hideHandle","setHideHandle","currentSize","setCurrentSize","panelRef","useRef","animationFrameRef","startTimeRef","animationTimeoutRef","animatePanel","useCallback","fromSize","toSize","onComplete","current","cancelAnimationFrame","performance","now","animate","currentTime","elapsed","progress","Math","min","eased","pow","newSize","resize","requestAnimationFrame","collapse","handleCollapse","handleExpand","togglePanel","handleResize","size","handleDragStart","handleDragEnd","useEffect","animationFrame","animationTimeout","clearTimeout","leftIsCollapsible","toggleIcon","themeStyles","collapsiblePanelStyle","transition","getPanelClassName","isCollapsiblePanel","children","jsxs","PanelGroup","direction","onLayout","jsx","Panel","ref","collapsible","collapsedSize","onResize","onCollapse","onExpand","opacity","PanelResizeHandle","onDragging","visibility","width","onClick","disabled","AnimatedVerticalLayout","topPanel","bottomPanel","collapsiblePanels","top","bottom","defaultSizes","minSizes","showCollapseButtons","onTopCollapseStart","onTopCollapseComplete","onTopExpandStart","onTopExpandComplete","onBottomCollapseStart","onBottomCollapseComplete","onBottomExpandStart","onBottomExpandComplete","onPanelResize","isTopCollapsed","setIsTopCollapsed","isTopAnimating","setIsTopAnimating","currentTopSize","setCurrentTopSize","topPanelRef","topAnimationFrameRef","topStartTimeRef","isBottomCollapsed","setIsBottomCollapsed","isBottomAnimating","setIsBottomAnimating","currentBottomSize","setCurrentBottomSize","bottomPanelRef","bottomAnimationFrameRef","bottomStartTimeRef","animateTopPanel","animateBottomPanel","handleTopCollapse","handleTopExpand","toggleTopPanel","handleBottomCollapse","handleBottomExpand","toggleBottomPanel","handleTopResize","handleBottomResize","topPanelStyle","bottomPanelStyle","getTopPanelClassName","getBottomPanelClassName","TabGroup","panelIds","panels","config","defaultActiveTab","tabPosition","centered","hideTabList","activeTabIndex","controlledIndex","onTabChange","internalIndex","setInternalIndex","isControlled","tabPanels","map","id","find","p","filter","safeActiveIndex","length","activePanel","tabList","role","panel","index","handleTabClick","title","icon","label","Fragment","tabContent","content","ConfigurablePanelLayout","layout","slotDataAttributes","left","middle","right","onLeftCollapseStart","onLeftCollapseComplete","onLeftExpandStart","onLeftExpandComplete","onMiddleCollapseStart","onMiddleCollapseComplete","onMiddleExpandStart","onMiddleExpandComplete","onRightCollapseStart","onRightCollapseComplete","onRightExpandStart","onRightExpandComplete","isLeftActive","isMiddleActive","isRightActive","activeCount","Boolean","computedDefaultSizes","computedMinSizes","leftCollapsed","setLeftCollapsed","middleCollapsed","setMiddleCollapsed","rightCollapsed","setRightCollapsed","leftAnimating","setLeftAnimating","middleAnimating","setMiddleAnimating","rightAnimating","setRightAnimating","leftFullyCollapsed","middleFullyCollapsed","rightFullyCollapsed","getPanelContent","panelId","renderPanelSlot","slot","group","type","middlePanel","leftSize","setLeftSize","middleSize","setMiddleSize","rightSize","setRightSize","lastExpandedLeftSize","setLastExpandedLeftSize","lastExpandedMiddleSize","setLastExpandedMiddleSize","lastExpandedRightSize","setLastExpandedRightSize","panelGroupRef","leftPanelRef","middlePanelRef","rightPanelRef","leftAnimationFrameRef","middleAnimationFrameRef","rightAnimationFrameRef","leftStartTimeRef","middleStartTimeRef","rightStartTimeRef","animateMultiplePanels","animations","validAnimations","anim","forEach","currentStep","setTimeout","handleLeftCollapse","flushSync","currentLayout","getLayout","actualLeftSize","round","actualMiddleSize","actualRightSize","remainingTotal","newMiddleSize","newRightSize","handleLeftExpand","targetLeftSize","spaceForOthers","currentOthersTotal","handleRightCollapse","newLeftSize","handleRightExpand","targetRightSize","toggleLeftPanel","handleMiddleCollapse","handleMiddleExpand","targetMiddleSize","toggleRightPanel","handleLeftResize","handleMiddleResize","handleRightResize","handleDragging","dragging","queueMicrotask","panelName","leftCollapsiblePanelStyle","middleCollapsiblePanelStyle","rightCollapsiblePanelStyle","leftPanelMinSize","middlePanelMinSize","rightPanelMinSize","SnapCarousel","forwardRef","minPanelWidth","idealPanelWidth","showSeparator","onPanelChange","preventKeyboardScroll","containerRef","useImperativeHandle","scrollToPanel","container","targetPanel","scrollLeft","offsetLeft","scrollTo","behavior","getCurrentPanel","snapPointX","getBoundingClientRect","closestIndex","closestDistance","Infinity","i","panelRect","distance","abs","handleKeyDown","e","target","tagName","isContentEditable","closest","includes","key","preventDefault","addEventListener","removeEventListener","panelCount","twoPanelThreshold","panelWidth","carouselId","React","useId","replace","onScroll","_e","useMediaQuery","query","matches","setMatches","window","matchMedia","mediaQuery","handler","event","addListener","removeListener","displayName","ResponsiveConfigurablePanelLayout","mobileBreakpoint","mobileCarouselProps","rest","isMobile","orderedSlots","useMemo","mobilePanels","panelContent","canUseDOM","document","createElement","isWindow","element","elementString","Object","prototype","toString","call","isNode","node","getWindow","_target$ownerDocument","_target$ownerDocument2","ownerDocument","defaultView","isDocument","Document","isHTMLElement","HTMLElement","isSVGElement","SVGElement","getOwnerDocument","useIsomorphicLayoutEffect","useLayoutEffect","useEvent","handlerRef","_len","arguments","args","Array","_key","useLatestValue","value","dependencies","valueRef","useLazyMemo","callback","newValue","useNodeRef","onChange","onChangeHandler","setNodeRef","usePrevious","ids","useUniqueId","prefix","createAdjustmentFn","modifier","object","adjustments","reduce","accumulator","adjustment","entries","valueAdjustment","add","subtract","isKeyboardEvent","KeyboardEvent","getEventCoordinates","TouchEvent","isTouchEvent","touches","clientX","x","clientY","y","changedTouches","hasViewportRelativeCoordinates","SELECTOR","findFirstFocusableNode","querySelector","hiddenStyles","display","HiddenText","_ref","LiveRegion","announcement","ariaLiveType","position","height","margin","padding","overflow","clip","clipPath","whiteSpace","DndMonitorContext","defaultScreenReaderInstructions","draggable","defaultAnnouncements","onDragStart","active","onDragOver","_ref2","over","onDragEnd","_ref3","onDragCancel","_ref4","Accessibility","announcements","hiddenTextDescribedById","screenReaderInstructions","announce","setAnnouncement","useAnnouncement","liveRegionId","mounted","setMounted","listener","registerListener","useContext","Error","useDndMonitor","onDragMove","_ref5","_ref6","markup","createPortal","Action","noop","defaultCoordinates","freeze","distanceBetween","p1","p2","sqrt","sortCollisionsAsc","data","a","b","sortCollisionsDesc","centerOfRectangle","rect","closestCenter","collisionRect","droppableRects","droppableContainers","centerRect","collisions","droppableContainer","get","distBetween","push","sort","getIntersectionRatio","entry","max","targetArea","entryArea","intersectionArea","Number","toFixed","rectIntersection","intersectionRatio","getRectDelta","rect1","rect2","createRectAdjustmentFn","acc","getAdjustedRect","defaultOptions","ignoreTransform","getClientRect","options","transform","transformOrigin","getComputedStyle","parsedTransform","startsWith","transformArray","slice","split","scaleX","scaleY","parseTransform","translateX","translateY","parseFloat","indexOf","w","h","inverseTransform","getTransformAgnosticClientRect","getScrollableAncestors","limit","scrollParents","findScrollableAncestors","scrollingElement","computedStyle","overflowRegex","some","property","test","isScrollable","isFixed","parentNode","getFirstScrollableAncestor","firstScrollableAncestor","getScrollableElement","getScrollXCoordinate","scrollX","getScrollYCoordinate","scrollY","scrollTop","getScrollCoordinates","Direction","isDocumentScrollingElement","getScrollPosition","scrollingContainer","minScroll","dimensions","innerHeight","innerWidth","clientHeight","clientWidth","maxScroll","scrollWidth","scrollHeight","isTop","isLeft","isBottom","isRight","defaultThreshold","getScrollDirectionAndSpeed","scrollContainer","scrollContainerRect","acceleration","thresholdPercentage","speed","threshold","Backward","Forward","getScrollElementRect","getScrollOffsets","scrollableAncestors","properties","Rect","constructor","this","scrollOffsets","axis","keys","getScrollOffset","defineProperty","currentOffsets","scrollOffsetsDeltla","enumerable","Listeners","listeners","removeAll","_this$target","eventName","_this$target2","hasExceededDistance","delta","measurement","dx","dy","EventName","KeyboardCode","stopPropagation","defaultKeyboardCodes","start","Space","Enter","cancel","Esc","end","Tab","defaultKeyboardCoordinateGetter","currentCoordinates","code","Right","Left","Down","Up","KeyboardSensor","props","autoScrollEnabled","referenceCoordinates","windowListeners","bind","handleCancel","attach","handleStart","Resize","VisibilityChange","Keydown","activeNode","onStart","measure","scrollIntoView","block","inline","scrollIntoViewIfNeeded","context","keyboardCodes","coordinateGetter","scrollBehavior","handleEnd","newCoordinates","coordinatesDelta","scrollDelta","scrollElementRect","clampedCoordinates","canScrollX","canScrollY","newScrollCoordinates","canScrollToNewCoordinates","scrollBy","handleMove","coordinates","onMove","onEnd","detach","onCancel","isDistanceConstraint","constraint","isDelayConstraint","activators","onActivation","nativeEvent","activator","activatorNode","AbstractPointerSensor","events","listenerTarget","_getEventCoordinates","EventTarget","getEventListenerTarget","activated","initialCoordinates","timeoutId","documentListeners","handleKeydown","removeTextSelection","activationConstraint","bypassActivationConstraint","move","name","passive","DragStart","ContextMenu","delay","handlePending","offset","onPending","Click","capture","SelectionChange","_getEventCoordinates2","tolerance","cancelable","onAbort","_this$document$getSel","getSelection","removeAllRanges","PointerSensor","super","isPrimary","button","events$1","MouseButton","RightClick","events$2","AutoScrollActivator","TraversalOrder","useAutoScroller","Pointer","canScroll","draggingRect","enabled","interval","order","TreeOrder","pointerCoordinates","scrollableAncestorRects","scrollIntent","previousDelta","previousIntent","defaultScrollIntent","sign","useScrollIntent","setAutoScrollInterval","clearAutoScrollInterval","intervalRef","duration","setInterval","clearInterval","useInterval","scrollSpeed","scrollDirection","DraggableRect","scrollContainerRef","autoScroll","sortedScrollableAncestors","reverse","JSON","stringify","setup","MeasuringStrategy","MeasuringFrequency","defaultValue","Map","useInitialValue","computeFn","previousValue","useResizeObserver","resizeObserver","ResizeObserver","disconnect","defaultMeasure","useRect","fallbackRect","setRect","measureRect","currentRect","isConnected","newRect","mutationObserver","handleMutations","MutationObserver","useMutationObserver","records","record","contains","observe","body","childList","subtree","defaultValue$1","useScrollOffsetsDelta","initialScrollOffsets","hasScrollOffsets","useWindowRect","getWindowClientRect","defaultValue$2","useDragOverlayMeasuring","handleNodeChange","firstChild","getMeasurableNode","nodeRef","setRef","defaultSensors","sensor","defaultData","defaultMeasuringConfiguration","droppable","strategy","WhileDragging","frequency","Optimized","dragOverlay","DroppableContainersMap","_super$get","toArray","from","values","getEnabled","getNodeFor","_this$get$node$curren","_this$get","defaultPublicContext","activatorEvent","activeNodeRect","containerNodeRect","draggableNodes","measuringConfiguration","measureDroppableContainers","windowRect","measuringScheduled","InternalContext","ariaDescribedById","dispatch","PublicContext","getInitialState","nodes","translate","containers","reducer","state","action","DragMove","DragEnd","DragCancel","RegisterDroppable","set","SetDroppableDisabled","UnregisterDroppable","delete","RestoreFocus","previousActivatorEvent","previousActiveId","activeElement","draggableNode","focusableNode","focus","ActiveDraggableContext","createContext","Status","DndContext","memo","_sensorContext$curren","_dragOverlay$nodeRef$","_dragOverlay$rect","_over$rect","accessibility","sensors","collisionDetection","measuring","modifiers","store","useReducer","dispatchMonitorEvent","registerMonitorListener","Set","_listener$type","useDndMonitorProvider","status","setStatus","Uninitialized","isInitialized","Initialized","activeId","activeRects","initial","translated","_node$data","activeRef","activeSensor","setActiveSensor","setActivatorEvent","latestProps","draggableDescribedById","enabledDroppableContainers","queue","setQueue","containersRef","Always","BeforeDragging","isDisabled","disabledRef","concat","useDroppableMeasuring","cachedNode","useCachedNode","activationCoordinates","autoScrollOptions","activeSensorDisablesAutoscroll","autoScrollGloballyDisabled","getAutoScrollerOptions","initialActiveNodeRect","useInitialRect","initialRect","initialized","rectDelta","useLayoutShiftScrollCompensation","layoutShiftCompensation","parentElement","sensorContext","draggingNode","draggingNodeRect","scrollAdjustedTranslate","overNode","usesDragOverlay","nodeRectDelta","previousNode","ancestors","useScrollableAncestors","elements","firstElement","rects","setRects","measureRects","useRects","modifiedTranslate","applyModifiers","overlayNodeRect","scrollCoordinates","setScrollCoordinates","prevElements","handleScroll","previousElements","cleanup","scrollableElement","useScrollOffsets","scrollAdjustment","activeNodeScrollDelta","overId","firstCollision","getFirstCollision","setOver","adjustScale","activeSensorRef","instantiateSensor","Sensor","sensorInstance","onDragAbort","onDragPending","unstable_batchedUpdates","Initializing","createHandler","async","cancelDrop","Promise","resolve","getSyntheticHandler","useCombineActivators","activeDraggableNode","dndKit","defaultPrevented","activationContext","capturedBy","teardownFns","teardown","useSensorSetup","overContainer","publicContext","internalContext","Provider","restoreFocus","NullContext","defaultRole","useDraggable","attributes","roleDescription","tabIndex","setActivatorNodeRef","useSyntheticListeners","dataRef","defaultResizeObserverConfig","timeout","SlotOverlayWrapper","slotPosition","isEditing","setDraggableRef","setDroppableRef","isOver","resizeObserverConfig","previous","resizeObserverConnected","callbackId","resizeObserverDisabled","updateMeasurementsFor","resizeObserverTimeout","isArray","newElement","previousElement","unobserve","useDroppable","setRefs","toUpperCase","EditableConfigurablePanelLayout","isEditMode","onLayoutChange","layoutProps","activeSlot","setActiveSlot","dragOffset","setDragOffset","useSensors","handleDragMove","sourceSlot","targetSlot","newLayout","temp","setAttribute","setProperty","removeAttribute","removeProperty","SlotOverlays","slotRects","setSlotRects","updatePositions","newRects","pointerEvents","zIndex","ThemeContext","ThemeContextSingleton","globalWindow","__principlemd_theme_context__","getThemeContext","isGroup","getPanelIdsFromSlot","PanelConfigurator","availablePanels","themeProp","contextTheme","useTheme","selection","setSelection","getPanelById","getSortedPanels","localeCompare","isPanelInUse","leftIds","middleIds","rightIds","removePanelFromLayout","pos","filteredPanels","togglePanelInTabGroup","toggleTabMode","handleSlotClick","currentGroup","handlePanelClick","handleSlotClear","removePanelFromTabGroup","updateTabConfig","sortedPanels","isTabModeSlot","textTertiary","backgroundLight","backgroundTertiary","error","selected","isSlotSelected","isTabGroup","viewBox","fill","d","idx","isDefaultTab","preview","inUse","verticalAlign","marginRight"],"mappings":"mcAKO,SAASA,EAAoBC,GAClC,MAAO,CACL,qBAAsBA,EAAMC,OAAOC,WACnC,iBAAkBF,EAAMC,OAAOE,OAC/B,iBAAkBH,EAAMC,OAAOG,oBAC/B,uBAAwBJ,EAAMC,OAAOI,gBACrC,wBAAyBL,EAAMC,OAAOK,QACtC,oBAAqBN,EAAMC,OAAOM,QAClC,uBAAwBP,EAAMC,OAAOI,gBACrC,wBAAyBL,EAAMC,OAAOE,OACtC,sBAAuBH,EAAMC,OAAOO,cACpC,oBAAqBR,EAAMC,O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