import { ComponentType, ReactNode } from 'react';
import { TablerIcon } from '@tabler/icons-react';
import * as react_jsx_runtime from 'react/jsx-runtime';

/**
 * Contract for a single right-panel view registration.
 *
 * Views are registered by each app locally; the host framework is agnostic
 * to which views exist. The `isAvailable` predicate enables access-system-
 * agnostic permission gating: each app supplies its own predicate (or none).
 */
interface RightPanelView {
    id: string;
    title: string;
    icon: TablerIcon;
    component: ComponentType;
    /** When true, the component stays mounted even when not the active view. */
    alwaysMount?: boolean;
    /**
     * Optional predicate to hide the view when the caller's access system
     * determines the user should not see it. The predicate receives a context
     * value that is passed down from `<RightPanelProvider contextValue={...}>`.
     *
     * Deliberately access-system-agnostic so the host ships independently of
     * the unified AccessModel migration.
     */
    isAvailable?: (ctx: RightPanelContext) => boolean;
}
/**
 * Context object passed to each `isAvailable` predicate.
 * Intentionally open-ended; callers cast to their own extended type.
 */
type RightPanelContext = Record<string, unknown>;
/** Shape of the right-panel store state (read side). */
interface RightPanelState {
    isOpen: boolean;
    isMinimized: boolean;
    /** True once the panel has been opened at least once (guards alwaysMount components). */
    hasBeenOpened: boolean;
    width: number;
    activeViewId: string;
}
/** All actions exposed by useRightPanel(). */
interface RightPanelActions {
    open: (viewId?: string) => void;
    close: () => void;
    minimize: () => void;
    restore: () => void;
    setActiveView: (viewId: string) => void;
    setWidth: (width: number) => void;
    toggle: () => void;
}
/** Full hook surface returned by useRightPanel(). */
type UseRightPanelReturn = RightPanelState & RightPanelActions;
/** Props for the RightPanelProvider. */
interface RightPanelProviderProps {
    children: React.ReactNode;
    /** Override initial store state at mount time. */
    initialState?: Partial<RightPanelState>;
    /**
     * Optional context value forwarded to every view's `isAvailable` predicate.
     * Typically the result of an access hook or similar.
     */
    contextValue?: RightPanelContext;
}

/** Read the context value passed to <RightPanelProvider contextValue={...}>. */
declare function useRightPanelContext(): RightPanelContext;
/**
 * Provides the right-panel Zustand store to all descendant components.
 *
 * Each `<RightPanelProvider>` creates its own isolated store instance,
 * so multiple independent panels on the same page are supported.
 *
 * @example
 * ```tsx
 * function App() {
 *   return (
 *     <RightPanelProvider>
 *       <AppShell>
 *         <RightPanelLayer views={MY_VIEWS} />
 *       </AppShell>
 *     </RightPanelProvider>
 *   )
 * }
 * ```
 */
declare function RightPanelProvider({ children, initialState, contextValue }: RightPanelProviderProps): ReactNode;

interface RightPanelLayerProps {
    /**
     * The ordered list of views to render in the panel.
     * Filter and order these before passing (e.g. via useAvailableRightPanelViews
     * in your app or from the registry directly).
     */
    views: RightPanelView[];
    /**
     * When true, the panel is in a "processing" state — the trigger light bar
     * pulses to indicate ongoing work. Pass from app-specific state as needed.
     */
    isProcessing?: boolean;
    /**
     * Optional app-owned sidebar rendered to the left of the shared panel body.
     * Use for app-local switchers, history rails, or diagnostics that should
     * travel with the panel without becoming part of the shared host contract.
     */
    sidebar?: (props: {
        views: RightPanelView[];
        activeViewId: string;
        onSelectView: (viewId: string) => void;
    }) => ReactNode;
    /** Current rendered width of `sidebar`, required when the sidebar is present. */
    sidebarWidth?: number;
}
/**
 * Root host component combining the right-panel trigger tab and panel shell.
 *
 * Desktop: trigger tab is fixed independently on the right edge; the panel
 * slides in/out separately with a mechanical mounting arm connecting it to
 * the viewport edge.
 *
 * Mobile (≤768px): renders trigger and active view independently
 * (bottom-sheet behavior).
 *
 * Place this component inside a `<RightPanelProvider>` and at the root of
 * your app shell. Pass your app-local view registry as the `views` prop.
 */
declare function RightPanelLayer({ views, isProcessing, sidebar, sidebarWidth }: RightPanelLayerProps): react_jsx_runtime.JSX.Element;

interface RightPanelTriggerProps {
    /** Called during drag with the horizontal delta (negative = dragged left = wider). */
    onResizeDrag?: (deltaX: number, startWidth: number) => void;
    /** Called when a drag resize ends (pointer up after dragging). */
    onResizeEnd?: () => void;
    /**
     * Whether the panel is currently in a "processing" state (e.g. an async
     * operation is running). Controls the light-bar glow intensity.
     */
    isProcessing?: boolean;
}
/**
 * SVG trigger tab that opens/closes/minimizes the right panel.
 * Supports hold-and-drag to resize the panel width.
 *
 * This is the framework default trigger. Apps may use `useRightPanel().toggle()`
 * as an escape hatch to build a custom trigger in any slot they prefer.
 */
declare function RightPanelTrigger({ onResizeDrag, onResizeEnd, isProcessing }: RightPanelTriggerProps): react_jsx_runtime.JSX.Element;

type RightPanelStoreState = RightPanelState & RightPanelActions;
/** Hook to access right-panel state and actions. */
declare function useRightPanel(): RightPanelStoreState;

/**
 * Registers Cmd/Ctrl+Space to toggle the right-panel host open/closed.
 *
 * Resolution order:
 *   closed          → open
 *   open+minimized  → restore
 *   open            → close
 *
 * Skips activation when the user is typing in an input, textarea, or
 * contenteditable element. Respects the `enabled` flag — pass `false` to
 * disable the shortcut (e.g. when the panel feature is not available for
 * the current user/org).
 *
 * This hook is the canonical owner of the Cmd/Ctrl+Space binding.
 * Register it once in your app shell (e.g. inside <RightPanelProvider>'s
 * subtree). Do not register additional keydown listeners for the same key.
 */
declare function useRightPanelKeyboardShortcut(enabled?: boolean): void;

/**
 * Returns whether the right panel should render in mobile mode (bottom sheet).
 * Uses Mantine's useMediaQuery with the configured mobile breakpoint.
 */
declare function useMobileRightPanel(): {
    isMobile: boolean;
};

declare const RIGHT_PANEL_Z_INDEX: {
    readonly PANEL: 300;
    readonly TRIGGER: 400;
};
declare const RIGHT_PANEL_DEFAULTS: {
    readonly WIDTH: 600;
    readonly MIN_WIDTH: 600;
    readonly MAX_WIDTH: 1200;
    readonly WIDTH_STEP: 5;
};
/**
 * localStorage key preserved verbatim for user-state compatibility.
 * Historical note: the "assistant" in the name is an artifact of the original
 * implementation where this was the assistant panel width; the key was kept
 * as-is when the panel was generalized to the multi-view right-panel host to
 * avoid migration cost for a LOW-criticality wart that no user sees.
 */
declare const ASSISTANT_PANEL_WIDTH_KEY = "elevasis-assistant-panel-width";
declare const RIGHT_PANEL_TRIGGER: {
    readonly WIDTH: 20;
    readonly HEIGHT: 80;
    readonly LIGHT_BAR_WIDTH: 2;
    readonly LIGHT_BAR_HEIGHT: 52;
    readonly ARM_WIDTH: 50;
};
declare const RIGHT_PANEL_HISTORY_WIDTH = 260;
declare const RIGHT_PANEL_HISTORY_COLLAPSED_WIDTH = 48;
/** Breakpoint (px) below which the panel renders as a mobile bottom sheet. */
declare const RIGHT_PANEL_MOBILE_BREAKPOINT = 768;
/** Default view shown when the right panel opens without a specific target. */
declare const RIGHT_PANEL_DEFAULT_VIEW_ID = "overview";

export { ASSISTANT_PANEL_WIDTH_KEY, RIGHT_PANEL_DEFAULTS, RIGHT_PANEL_DEFAULT_VIEW_ID, RIGHT_PANEL_HISTORY_COLLAPSED_WIDTH, RIGHT_PANEL_HISTORY_WIDTH, RIGHT_PANEL_MOBILE_BREAKPOINT, RIGHT_PANEL_TRIGGER, RIGHT_PANEL_Z_INDEX, RightPanelLayer, RightPanelProvider, RightPanelTrigger, useMobileRightPanel, useRightPanel, useRightPanelContext, useRightPanelKeyboardShortcut };
export type { RightPanelActions, RightPanelContext, RightPanelLayerProps, RightPanelProviderProps, RightPanelState, RightPanelTriggerProps, RightPanelView, UseRightPanelReturn };
