import { ClassProp } from 'class-variance-authority/types';
import { ClassValue } from 'clsx';
import { Component } from 'react';
import { ComponentType } from 'react';
import { default as default_2 } from '@tauri-apps/plugin-sql';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
import { ErrorInfo } from 'react';
import { default as i18n } from 'i18next';
import { JSX } from 'react/jsx-runtime';
import { LucideIcon } from 'lucide-react';
import * as ProgressPrimitive from '@radix-ui/react-progress';
import * as React_2 from 'react';
import { ReactNode } from 'react';
import { RefObject } from 'react';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
import * as Sentry from '@sentry/react';
import * as SeparatorPrimitive from '@radix-ui/react-separator';
import * as SwitchPrimitive from '@radix-ui/react-switch';
import * as TabsPrimitive from '@radix-ui/react-tabs';
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
import { Update } from '@tauri-apps/plugin-updater';
import { VariantProps } from 'class-variance-authority';
import { Window as Window_2 } from '@tauri-apps/api/window';
import { z } from 'zod';

export declare function addBreadcrumb(message: string, category: string, level?: 'debug' | 'info' | 'warning' | 'error'): void;

/**
 * Add resources to i18n after initialization
 */
export declare function addI18nResources(lang: string, resources: Record<string, unknown>): void;

export declare const api: {
    get<T>(endpoint: string, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    post<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    put<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    patch<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    delete<T>(endpoint: string, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    setHeader(key: string, value: string): void;
    removeHeader(key: string): void;
    setBaseUrl(url: string): void;
    getBaseUrl(): string;
};

export declare interface ApiConfig {
    baseUrl: string;
    timeout?: number;
    headers?: Record<string, string>;
}

export declare interface ApiError {
    status: number;
    message: string;
    data?: unknown;
}

export declare class ApiException extends Error {
    status: number;
    data?: unknown | undefined;
    constructor(status: number, message: string, data?: unknown | undefined);
}

export declare const appWindow: Window_2;

export declare interface AsyncState<T> {
    data: T | null;
    error: Error | null;
    isLoading: boolean;
    isSuccess: boolean;
    isError: boolean;
}

export declare function Badge({ className, variant, ...props }: BadgeProps): JSX.Element;

declare interface BadgeProps extends React_2.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
}

export declare const badgeVariants: (props?: ({
    variant?: "secondary" | "destructive" | "default" | "outline" | null | undefined;
} & ClassProp) | undefined) => string;

/**
 * Base migrations provided by the core
 * These create essential tables: settings, app_state
 */
export declare const baseMigrations: Migration[];

/**
 * Base translations provided by the core
 * These include common UI strings for settings, theme, etc.
 */
export declare const baseResources: {
    en: {
        translation: {
            common: {
                save: string;
                cancel: string;
                language: string;
                theme: string;
                user: string;
                menu: {
                    account: string;
                    profile: string;
                    billing: string;
                    logout: string;
                };
            };
            settings: {
                title: string;
                description: string;
                tabs: {
                    general: string;
                    about: string;
                };
                general: string;
                appearance: string;
                language_select: string;
                theme_select: string;
                theme_light: string;
                theme_dark: string;
                theme_system: string;
                about: {
                    check_updates: string;
                    checking: string;
                    up_to_date: string;
                    current_version: string;
                    new_version: string;
                    download_update: string;
                    ready_to_install: string;
                    restart_now: string;
                    check_error: string;
                    download_error: string;
                    retry: string;
                    updater_disabled: string;
                    footer_line1: string;
                    footer_line2: string;
                };
            };
        };
    };
    zh: {
        translation: {
            common: {
                save: string;
                cancel: string;
                language: string;
                theme: string;
                user: string;
                menu: {
                    account: string;
                    profile: string;
                    billing: string;
                    logout: string;
                };
            };
            settings: {
                title: string;
                description: string;
                tabs: {
                    general: string;
                    about: string;
                };
                general: string;
                appearance: string;
                language_select: string;
                theme_select: string;
                theme_light: string;
                theme_dark: string;
                theme_system: string;
                about: {
                    check_updates: string;
                    checking: string;
                    up_to_date: string;
                    current_version: string;
                    new_version: string;
                    download_update: string;
                    ready_to_install: string;
                    restart_now: string;
                    check_error: string;
                    download_error: string;
                    retry: string;
                    updater_disabled: string;
                    footer_line1: string;
                    footer_line2: string;
                };
            };
        };
    };
};

export declare interface BrandConfig {
    /**
     * Application name (or i18n key)
     */
    name: string;
    /**
     * Logo component (priority over logoUrl)
     */
    logo?: ComponentType<{
        className?: string;
    }>;
    /**
     * Logo image URL (fallback when logo component is not provided)
     */
    logoUrl?: string;
    /**
     * Version string to display
     */
    version?: string;
}

export declare const Button: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLButtonElement>>;

declare interface ButtonProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
    asChild?: boolean;
}

export declare const buttonVariants: (props?: ({
    variant?: "secondary" | "destructive" | "link" | "default" | "outline" | "ghost" | null | undefined;
    size?: "sm" | "lg" | "default" | "icon" | null | undefined;
} & ClassProp) | undefined) => string;

export declare function captureError(error: Error, context?: Record<string, unknown>): void;

export declare const Card: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

export declare const CardContent: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

export declare const CardDescription: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

export declare const CardFooter: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

export declare const CardHeader: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

export declare const CardTitle: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;

/**
 * Change language
 */
export declare function changeLanguage(lang: string): Promise<void>;

/**
 * Check for updates and prompt user
 * Convenience function for common use case
 */
export declare function checkAndPromptUpdate(options?: {
    silent?: boolean;
    autoDownload?: boolean;
    onProgress?: (progress: UpdateProgress) => void;
}): Promise<UpdateInfo>;

/**
 * 检查基座更新
 */
export declare function checkCoreUpdate(): Promise<VersionCheckResult | null>;

/**
 * Check for updates
 */
export declare function checkForUpdate(): Promise<UpdateInfo>;

/**
 * Clear current update reference
 */
export declare function clearUpdate(): void;

/**
 * Close database connection
 */
export declare function closeDatabase(): Promise<void>;

export declare function closeWindow(): Promise<void>;

export declare function cn(...inputs: ClassValue[]): string;

export declare interface ComponentOverrides {
    /**
     * Override Shell component
     */
    Shell?: ComponentType<ShellProps>;
    /**
     * Override TitleBar component
     */
    TitleBar?: ComponentType<TitleBarProps>;
    /**
     * Override NavItem component
     */
    NavItem?: ComponentType<NavItemComponentProps>;
}

export declare function ConfigProvider({ config, children }: ConfigProviderProps): JSX.Element;

declare interface ConfigProviderProps {
    config: Partial<LinchDesktopConfig>;
    children: ReactNode;
}

/**
 * 基座版本检查工具
 * 在开发模式下检测 @linch-tech/desktop-core 是否有新版本
 */
export declare const CORE_VERSION: string;

export declare function createApiClient(config: ApiConfig): {
    get<T>(endpoint: string, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    post<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    put<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    patch<T>(endpoint: string, body?: unknown, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    delete<T>(endpoint: string, options?: {
        headers?: Record<string, string>;
        schema?: z.ZodType<T>;
        signal?: AbortSignal;
    }): Promise<T>;
    setHeader(key: string, value: string): void;
    removeHeader(key: string): void;
    setBaseUrl(url: string): void;
    getBaseUrl(): string;
};

export declare interface DatabaseConfig {
    /**
     * Database name (default: 'app.db')
     */
    name?: string;
    /**
     * Additional migrations (will run after base migrations)
     */
    migrations?: Migration[];
}

declare interface DatabaseContextValue {
    isReady: boolean;
    error: Error | null;
}

export declare interface DatabaseInitOptions {
    /**
     * Database name (default: 'app.db')
     */
    name?: string;
    /**
     * Additional migrations to run after base migrations
     */
    migrations?: Migration[];
}

export declare function DatabaseProvider({ children, dbName, migrations, fallback, }: DatabaseProviderProps): JSX.Element;

declare interface DatabaseProviderProps {
    children: ReactNode;
    /**
     * Custom database name (default: 'app.db')
     */
    dbName?: string;
    /**
     * Additional migrations to run
     */
    migrations?: Migration[];
    /**
     * Custom loading fallback
     */
    fallback?: ReactNode;
}

export declare const defaultConfig: LinchDesktopConfig;

export declare function defineEndpoint<TParams extends Record<string, string | number> | void, TBody, TResponse>(config: {
    method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
    path: string | ((params: TParams) => string);
    responseSchema?: z.ZodType<TResponse>;
}): (client: ReturnType<typeof createApiClient>, params: TParams, body?: TBody) => Promise<TResponse>;

/**
 * Delete app state
 */
export declare function deleteAppState(key: string): Promise<void>;

/**
 * Delete a setting
 */
export declare function deleteSetting(key: string): Promise<void>;

export declare const Dialog: React_2.FC<DialogPrimitive.DialogProps>;

export declare const DialogClose: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React_2.RefAttributes<HTMLButtonElement>>;

export declare const DialogContent: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DialogDescription: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;

export declare const DialogFooter: {
    ({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
    displayName: string;
};

export declare const DialogHeader: {
    ({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
    displayName: string;
};

export declare const DialogOverlay: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DialogPortal: React_2.FC<DialogPrimitive.DialogPortalProps>;

export declare const DialogTitle: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React_2.RefAttributes<HTMLHeadingElement>, "ref"> & React_2.RefAttributes<HTMLHeadingElement>>;

export declare const DialogTrigger: React_2.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;

/**
 * Download and install update
 */
export declare function downloadAndInstall(onProgress?: (progress: UpdateProgress) => void): Promise<void>;

export declare const DropdownMenu: React_2.FC<DropdownMenuPrimitive.DropdownMenuProps>;

export declare const DropdownMenuCheckboxItem: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuContent: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuGroup: React_2.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuItem: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & {
    inset?: boolean;
} & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuLabel: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & {
    inset?: boolean;
} & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuPortal: React_2.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;

export declare const DropdownMenuRadioGroup: React_2.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuRadioItem: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuSeparator: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuShortcut: {
    ({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): JSX.Element;
    displayName: string;
};

export declare const DropdownMenuSub: React_2.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;

export declare const DropdownMenuSubContent: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuSubTrigger: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & {
    inset?: boolean;
} & React_2.RefAttributes<HTMLDivElement>>;

export declare const DropdownMenuTrigger: React_2.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;

export declare class ErrorBoundary extends Component<Props, State> {
    constructor(props: Props);
    static getDerivedStateFromError(error: Error): State;
    componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
    handleReload: () => void;
    handleGoHome: () => void;
    handleReset: () => void;
    render(): ReactNode;
}

/**
 * Execute a raw INSERT/UPDATE/DELETE query
 */
export declare function execute(sql: string, params?: unknown[]): Promise<{
    rowsAffected: number;
    lastInsertId: number;
}>;

export declare interface FeaturesConfig {
    /**
     * Enable auto-updater (default: true)
     */
    updater?: boolean;
    /**
     * Enable database (default: true)
     */
    database?: boolean;
    /**
     * Enable Sentry error reporting (default: false)
     */
    sentry?: boolean;
}

/**
 * Get all settings
 */
export declare function getAllSettings(): Promise<Record<string, unknown>>;

/**
 * Get app state value
 */
export declare function getAppState<T = unknown>(key: string): Promise<T | null>;

/**
 * Get current language
 */
export declare function getCurrentLanguage(): string;

/**
 * Get current update if available
 */
export declare function getCurrentUpdate(): Update | null;

/**
 * Get database instance (must call initDatabase first)
 */
export declare function getDatabase(): default_2;

/**
 * Get a setting value
 */
export declare function getSetting<T = string>(key: string): Promise<T | null>;

export { i18n }

export declare interface I18nConfig {
    /**
     * Default language
     */
    defaultLanguage?: string;
    /**
     * Supported languages
     */
    supportedLanguages?: string[];
    /**
     * Additional translation resources (will be merged with base)
     */
    resources?: Record<string, Record<string, unknown>>;
}

/**
 * Initialize database connection
 */
export declare function initDatabase(options?: DatabaseInitOptions): Promise<default_2>;

/**
 * Configure i18n with app-specific resources and settings
 * Call this to add your app's translations
 */
export declare function initI18n(defaultLanguage?: string, appResources?: Record<string, Record<string, unknown>>, supportedLanguages?: string[]): typeof i18n;

export declare function initSentry(options?: SentryInitOptions): void;

export declare const Input: React_2.ForwardRefExoticComponent<Omit<React_2.DetailedHTMLProps<React_2.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React_2.RefAttributes<HTMLInputElement>>;

export declare function isMaximized(): Promise<boolean>;

export declare const Label: React_2.ForwardRefExoticComponent<React_2.LabelHTMLAttributes<HTMLLabelElement> & VariantProps<(props?: ClassProp | undefined) => string> & React_2.RefAttributes<HTMLLabelElement>>;

export declare function LanguageSwitcher({ variant, size, className, }: LanguageSwitcherProps): JSX.Element;

declare interface LanguageSwitcherProps {
    variant?: "icon" | "full";
    size?: "sm" | "default";
    className?: string;
}

export declare interface LayoutConfig {
    /**
     * Sidebar configuration
     */
    sidebar?: {
        width?: number;
        position?: "left" | "right";
    };
    /**
     * Title bar configuration
     */
    titleBar?: {
        height?: number;
        showWindowControls?: boolean;
        draggable?: boolean;
    };
}

export declare interface LinchDesktopConfig {
    /**
     * Brand configuration
     */
    brand: BrandConfig;
    /**
     * Navigation items
     */
    nav: NavItem[];
    /**
     * Feature toggles
     */
    features?: FeaturesConfig;
    /**
     * Theme customization
     */
    theme?: ThemeConfig;
    /**
     * Layout configuration
     */
    layout?: LayoutConfig;
    /**
     * Slot injection
     */
    slots?: SlotsConfig;
    /**
     * Component overrides
     */
    components?: ComponentOverrides;
    /**
     * i18n configuration
     */
    i18n?: I18nConfig;
    /**
     * Database configuration
     */
    database?: DatabaseConfig;
    /**
     * Sentry configuration
     */
    sentry?: SentryConfig;
}

/**
 * Main provider for Linch Desktop Core.
 * Wraps your app with all necessary providers:
 * - Config context
 * - Error boundary
 * - Database (optional)
 * - Sentry (optional)
 * - i18n
 */
export declare function LinchDesktopProvider({ config, children, }: LinchDesktopProviderProps): JSX.Element;

export declare interface LinchDesktopProviderProps {
    /**
     * Application configuration
     */
    config: Partial<LinchDesktopConfig>;
    /**
     * Children to render
     */
    children: ReactNode;
}

export declare interface LogEntry {
    level: LogLevel;
    message: string;
    timestamp: string;
    context?: Record<string, unknown>;
}

declare class Logger {
    private minLevel;
    private handlers;
    constructor(level?: LogLevel);
    private consoleHandler;
    addHandler(handler: LogHandler): void;
    removeHandler(handler: LogHandler): void;
    setMinLevel(level: LogLevel): void;
    private shouldLog;
    private log;
    debug(message: string, context?: Record<string, unknown>): void;
    info(message: string, context?: Record<string, unknown>): void;
    warn(message: string, context?: Record<string, unknown>): void;
    error(message: string, context?: Record<string, unknown>): void;
}

export declare const logger: Logger;

export declare type LogHandler = (entry: LogEntry) => void;

/**
 * Simple structured logging utility
 * In production, logs are minimized and can be sent to external services
 */
export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';

export declare function Logo({ className }: {
    className?: string;
}): JSX.Element;

/**
 * 在开发模式下输出更新提示
 */
export declare function logUpdateNotice(): Promise<void>;

/**
 * Merge application i18n resources with base resources
 */
export declare function mergeI18nResources(appResources: Record<string, Record<string, unknown>>): Record<string, {
    translation: Record<string, unknown>;
}>;

export declare interface Migration {
    version: number;
    name: string;
    up: string;
    down?: string;
}

export declare function minimizeWindow(): Promise<void>;

export declare interface NavItem {
    /**
     * Title (can be i18n key or plain text)
     */
    title: string;
    /**
     * Route path
     */
    path: string;
    /**
     * Icon component
     */
    icon: LucideIcon | ComponentType<{
        className?: string;
    }>;
    /**
     * Badge content (optional)
     */
    badge?: string | number;
}

export declare interface NavItemComponentProps {
    item: NavItem;
    isActive: boolean;
    onClick?: () => void;
}

export declare function PageHeader({ title, description, children, className }: PageHeaderProps): JSX.Element;

declare interface PageHeaderProps {
    title: string;
    description?: string;
    children?: React.ReactNode;
    className?: string;
}

export declare const Progress: React_2.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

declare interface Props {
    children: ReactNode;
    fallback?: ReactNode;
}

/**
 * Execute a raw SELECT query
 */
export declare function query<T = unknown>(sql: string, params?: unknown[]): Promise<T[]>;

export declare interface QueryResult<T = unknown> {
    rows: T[];
    rowsAffected: number;
    lastInsertId: number;
}

/**
 * Relaunch the application after update
 */
export declare function relaunchApp(): Promise<void>;

export declare const ScrollArea: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const ScrollBar: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export { Sentry }

export declare interface SentryConfig {
    /**
     * Sentry DSN
     */
    dsn?: string;
    /**
     * Traces sample rate (0-1)
     */
    tracesSampleRate?: number;
}

export declare interface SentryInitOptions extends SentryConfig {
    /**
     * Environment name (e.g., 'development', 'production')
     */
    environment?: string;
    /**
     * Whether to enable Sentry (default: true when DSN is provided)
     */
    enabled?: boolean;
}

export declare const Separator: React_2.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

/**
 * Set app state value
 */
export declare function setAppState<T = unknown>(key: string, value: T): Promise<void>;

/**
 * Set a setting value
 */
export declare function setSetting<T = string>(key: string, value: T): Promise<void>;

export declare function SettingsPage({ footer }: SettingsPageProps): JSX.Element;

export declare interface SettingsPageProps {
    footer?: ReactNode;
}

export declare function setUser(user: {
    id: string;
    email?: string;
    username?: string;
} | null): void;

/**
 * Main application shell with sidebar navigation
 */
export declare function Shell({ children, className, noOutlet }: ShellProps): JSX.Element;

export declare interface ShellProps {
    children?: ReactNode;
    className?: string;
    /**
     * If true, don't render Outlet (useful when you want to render children directly)
     */
    noOutlet?: boolean;
}

export declare interface SlotsConfig {
    /**
     * Title bar slots
     */
    titleBar?: {
        left?: ReactNode;
        center?: ReactNode;
        right?: ReactNode;
    };
    /**
     * Sidebar slots
     */
    sidebar?: {
        header?: ReactNode;
        footer?: ReactNode;
        beforeNav?: ReactNode;
        afterNav?: ReactNode;
    };
    /**
     * Shell slots
     */
    shell?: {
        beforeContent?: ReactNode;
        afterContent?: ReactNode;
    };
}

export declare function startDragging(): Promise<void>;

declare interface State {
    hasError: boolean;
    error: Error | null;
}

export declare const Switch: React_2.ForwardRefExoticComponent<Omit<SwitchPrimitive.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;

export declare const Tabs: React_2.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React_2.RefAttributes<HTMLDivElement>>;

export declare const TabsContent: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const TabsList: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const TabsTrigger: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;

declare type Theme = "dark" | "light" | "system";

export declare interface ThemeColors {
    primary: string;
    secondary: string;
    background: string;
    foreground: string;
    muted: string;
    mutedForeground: string;
    border: string;
    ring: string;
    accent: string;
    accentForeground: string;
    destructive: string;
    destructiveForeground: string;
}

export declare interface ThemeConfig {
    /**
     * Color overrides
     */
    colors?: Partial<ThemeColors>;
    /**
     * Border radius preset
     */
    radius?: "none" | "sm" | "md" | "lg" | "full";
    /**
     * Font family overrides
     */
    font?: {
        sans?: string;
        mono?: string;
    };
    /**
     * Custom CSS variables
     */
    cssVariables?: Record<string, string>;
}

export declare function ThemeSwitcher({ variant, size, className, }: ThemeSwitcherProps): JSX.Element;

declare interface ThemeSwitcherProps {
    variant?: "icon" | "full";
    size?: "sm" | "default";
    className?: string;
}

/**
 * Application title bar with window controls
 */
export declare function TitleBar({ className }: TitleBarProps): JSX.Element;

export declare interface TitleBarProps {
    className?: string;
}

export declare function toggleMaximize(): Promise<void>;

export declare const Tooltip: React_2.FC<TooltipPrimitive.TooltipProps>;

export declare const TooltipContent: React_2.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;

export declare const TooltipProvider: React_2.FC<TooltipPrimitive.TooltipProviderProps>;

export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;

/**
 * Run multiple queries in a transaction
 */
export declare function transaction<T>(callback: (db: default_2) => Promise<T>): Promise<T>;

export declare interface UpdateInfo {
    available: boolean;
    version?: string;
    currentVersion?: string;
    body?: string;
    date?: string;
}

export declare interface UpdateProgress {
    downloaded: number;
    total: number;
    percent: number;
}

export declare type UpdateStatus = 'idle' | 'checking' | 'available' | 'downloading' | 'ready' | 'check-error' | 'download-error' | 'up-to-date';

/**
 * Hook to persist UI state to database
 */
export declare function useAppState<T>(key: string, defaultValue?: T): UseAppStateReturn<T>;

declare interface UseAppStateReturn<T> {
    state: T | null;
    setState: (value: T) => Promise<void>;
    isLoading: boolean;
}

/**
 * Hook for managing async operations with loading, error, and data states
 *
 * @param asyncFunction - async function to execute
 * @param immediate - whether to execute immediately on mount
 * @returns async state and control functions
 *
 * @example
 * ```tsx
 * const { data, isLoading, error, execute } = useAsync(
 *   async (id: number) => fetchUser(id),
 *   false
 * );
 *
 * // Execute manually
 * const handleClick = () => execute(123);
 *
 * // Or execute immediately
 * const { data, isLoading } = useAsync(() => fetchUsers(), true);
 * ```
 */
export declare function useAsync<T, Args extends unknown[] = []>(asyncFunction: (...args: Args) => Promise<T>, immediate?: boolean): UseAsyncReturn<T, Args>;

export declare interface UseAsyncReturn<T, Args extends unknown[]> extends AsyncState<T> {
    execute: (...args: Args) => Promise<T | null>;
    reset: () => void;
}

/**
 * Hook that detects clicks outside of the specified element
 *
 * @param handler - callback to execute when clicking outside
 * @param enabled - whether the listener is active (default: true)
 * @returns ref to attach to the element
 *
 * @example
 * ```tsx
 * const [isOpen, setIsOpen] = useState(false);
 * const ref = useClickOutside(() => setIsOpen(false));
 *
 * return (
 *   <div ref={ref}>
 *     {isOpen && <Dropdown />}
 *   </div>
 * );
 * ```
 */
export declare function useClickOutside<T extends HTMLElement = HTMLElement>(handler: (event: MouseEvent | TouchEvent) => void, enabled?: boolean): RefObject<T | null>;

/**
 * Hook that detects clicks outside of multiple elements
 *
 * @param handler - callback to execute when clicking outside all refs
 * @param enabled - whether the listener is active (default: true)
 * @returns function to create refs
 *
 * @example
 * ```tsx
 * const { refs, addRef } = useClickOutsideMultiple(() => setIsOpen(false));
 *
 * return (
 *   <>
 *     <button ref={addRef}>Toggle</button>
 *     <div ref={addRef}>
 *       <Dropdown />
 *     </div>
 *   </>
 * );
 * ```
 */
export declare function useClickOutsideMultiple<T extends HTMLElement = HTMLElement>(handler: (event: MouseEvent | TouchEvent) => void, enabled?: boolean): {
    refs: RefObject<T[]>;
    addRef: (el: T | null) => void;
};

/**
 * Hook that combines click outside and escape key detection
 * Useful for modals and dropdowns
 *
 * @param handler - callback to execute when clicking outside or pressing escape
 * @param enabled - whether the listeners are active (default: true)
 * @returns ref to attach to the element
 *
 * @example
 * ```tsx
 * const ref = useClickOutsideOrEscape(() => setIsOpen(false), isOpen);
 *
 * return (
 *   <div ref={ref}>
 *     <Modal />
 *   </div>
 * );
 * ```
 */
export declare function useClickOutsideOrEscape<T extends HTMLElement = HTMLElement>(handler: (event: MouseEvent | TouchEvent | KeyboardEvent) => void, enabled?: boolean): RefObject<T | null>;

export declare function useConfig(): LinchDesktopConfig;

export declare function useDatabase(): DatabaseContextValue;

declare interface UseDatabaseInit {
    isReady: boolean;
    error: Error | null;
}

/**
 * Hook to initialize database on app start
 */
export declare function useDatabaseInit(options?: DatabaseInitOptions): UseDatabaseInit;

/**
 * Hook that debounces a value
 *
 * @param value - value to debounce
 * @param delay - delay in milliseconds
 * @returns debounced value
 *
 * @example
 * ```tsx
 * const [searchTerm, setSearchTerm] = useState('');
 * const debouncedSearch = useDebounce(searchTerm, 300);
 *
 * useEffect(() => {
 *   if (debouncedSearch) {
 *     search(debouncedSearch);
 *   }
 * }, [debouncedSearch]);
 * ```
 */
export declare function useDebounce<T>(value: T, delay: number): T;

/**
 * Hook that returns a debounced callback function
 *
 * @param callback - function to debounce
 * @param delay - delay in milliseconds
 * @returns debounced function and cancel function
 *
 * @example
 * ```tsx
 * const [debouncedSearch, cancel] = useDebouncedCallback(
 *   (term: string) => performSearch(term),
 *   300
 * );
 *
 * <input onChange={(e) => debouncedSearch(e.target.value)} />
 * ```
 */
export declare function useDebouncedCallback<Args extends unknown[]>(callback: (...args: Args) => void, delay: number): [(...args: Args) => void, () => void];

/**
 * Hook that detects escape key press
 *
 * @param handler - callback to execute when escape is pressed
 * @param enabled - whether the listener is active (default: true)
 *
 * @example
 * ```tsx
 * useEscapeKey(() => setIsOpen(false), isOpen);
 * ```
 */
export declare function useEscapeKey(handler: (event: KeyboardEvent) => void, enabled?: boolean): void;

/**
 * Simplified hook for fetching data on mount
 *
 * @param asyncFunction - async function that returns data
 * @param deps - dependency array to trigger refetch
 * @returns async state
 *
 * @example
 * ```tsx
 * const { data, isLoading, error } = useFetch(() => fetchUsers());
 * const { data } = useFetch(() => fetchUser(id), [id]);
 * ```
 */
export declare function useFetch<T>(asyncFunction: () => Promise<T>, deps?: React.DependencyList): AsyncState<T> & {
    refetch: () => Promise<T | null>;
};

/**
 * Hook for syncing state with localStorage
 *
 * @param key - localStorage key
 * @param initialValue - initial value if key doesn't exist
 * @returns [value, setValue, removeValue]
 *
 * @example
 * ```tsx
 * const [name, setName, removeName] = useLocalStorage('user-name', 'Guest');
 * ```
 */
export declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T | ((prev: T) => T)) => void, () => void];

/**
 * Hook to read/write a single setting
 */
export declare function useSetting<T = string>(key: string, options?: UseSettingOptions<T>): UseSettingReturn<T>;

declare interface UseSettingOptions<T> {
    defaultValue?: T;
}

declare interface UseSettingReturn<T> {
    value: T | null;
    setValue: (value: T) => Promise<void>;
    isLoading: boolean;
    error: Error | null;
}

export declare function useTheme(): {
    theme: Theme;
    setTheme: (theme: Theme) => void;
};

/**
 * Hook that throttles a value
 *
 * @param value - value to throttle
 * @param interval - interval in milliseconds
 * @returns throttled value
 *
 * @example
 * ```tsx
 * const [position, setPosition] = useState({ x: 0, y: 0 });
 * const throttledPosition = useThrottle(position, 100);
 * ```
 */
export declare function useThrottle<T>(value: T, interval: number): T;

/**
 * Hook that returns a throttled callback function
 *
 * @param callback - function to throttle
 * @param interval - interval in milliseconds
 * @returns throttled function
 *
 * @example
 * ```tsx
 * const throttledScroll = useThrottledCallback(
 *   () => console.log('scrolled'),
 *   100
 * );
 *
 * useEffect(() => {
 *   window.addEventListener('scroll', throttledScroll);
 *   return () => window.removeEventListener('scroll', throttledScroll);
 * }, [throttledScroll]);
 * ```
 */
export declare function useThrottledCallback<Args extends unknown[]>(callback: (...args: Args) => void, interval: number): (...args: Args) => void;

export declare function useUpdater(options?: {
    enabled?: boolean;
}): UseUpdaterReturn;

declare interface UseUpdaterReturn {
    enabled: boolean;
    status: UpdateStatus;
    updateInfo: UpdateInfo | null;
    progress: UpdateProgress | null;
    error: Error | null;
    check: () => Promise<UpdateInfo>;
    download: () => Promise<void>;
    install: () => Promise<void>;
}

declare interface VersionCheckResult {
    currentVersion: string;
    latestVersion: string;
    hasUpdate: boolean;
    updateType: 'major' | 'minor' | 'patch' | null;
}

export declare function WindowControls(): JSX.Element;

export { }
