import * as react_jsx_runtime from 'react/jsx-runtime';
import { ManualEditEvent } from '@tscircuit/props';
import { CircuitJson, AnyCircuitElement } from 'circuit-json';
import * as react from 'react';
import { ComponentProps } from 'react';
import { PCBViewer } from '@tscircuit/pcb-viewer';
export { PCBViewer as PcbViewer } from '@tscircuit/pcb-viewer';
export { CadViewer } from '@tscircuit/3d-viewer';
export { SchematicViewer } from '@tscircuit/schematic-viewer';

type RenderEvent = {
    type: `renderable:renderLifecycle:${string}:start` | `renderable:renderLifecycle:${string}:end`;
    /**
     * Corresponds to the element that was rendered
     */
    renderId: string;
    eventsProcessed: number;
    createdAt: number;
};
interface RenderLog {
    lastRenderEvent?: RenderEvent;
    eventsProcessed?: number;
    progress?: number;
    renderEvents?: RenderEvent[];
    phaseTimings?: Record<string, number>;
}

type TabId = "code" | "pcb" | "schematic" | "assembly" | "cad" | "bom" | "circuit_json" | "errors" | "render_log";
interface PreviewContentProps {
    defaultToFullScreen?: boolean;
    code?: string;
    readOnly?: boolean;
    onRunClicked?: () => void;
    tsxRunTriggerCount?: number;
    errorMessage?: string | null;
    autoroutingGraphics?: any;
    circuitJson: CircuitJson | null;
    className?: string;
    showCodeTab?: boolean;
    showRenderLogTab?: boolean;
    codeTabContent?: React.ReactNode;
    showJsonTab?: boolean;
    showToggleFullScreen?: boolean;
    showImportAndFormatButtons?: boolean;
    headerClassName?: string;
    /**
     * A record of component name to autorouting information
     */
    autoroutingLog?: Record<string, {
        simpleRouteJson: any;
    }>;
    /**
     * An optional left-side header, you can put a save button, a run button, or
     * a title here.
     */
    leftHeaderContent?: React.ReactNode;
    /**
     * Default header content, shown on the right side of the header with the PCB,
     * schematic, and CAD tabs.
     */
    showRightHeaderContent?: boolean;
    isRunningCode?: boolean;
    isStreaming?: boolean;
    hasCodeChangedSinceLastRun?: boolean;
    defaultActiveTab?: TabId;
    renderLog?: RenderLog | null;
    onEditEvent?: (editEvent: ManualEditEvent) => void;
    editEvents?: ManualEditEvent[];
    onActiveTabChange?: (tab: TabId) => any;
    autoRotate3dViewerDisabled?: boolean;
    showSchematicDebugGrid?: boolean;
    onReportAutoroutingLog?: (name: string, data: {
        simpleRouteJson: any;
    }) => void;
}

declare function getCircuitJsonErrors(circuitJson: CircuitJson | null): ({
    message: string;
    type: "pcb_missing_footprint_error";
    source_component_id: string;
    error_type: "pcb_missing_footprint_error";
    pcb_missing_footprint_error_id: string;
    subcircuit_id?: string | undefined;
    pcb_group_id?: string | undefined;
} | {
    message: string;
    type: "pcb_trace_error";
    source_trace_id: string;
    error_type: "pcb_trace_error";
    pcb_trace_id: string;
    pcb_trace_error_id: string;
    pcb_component_ids: string[];
    pcb_port_ids: string[];
    center?: {
        x: number;
        y: number;
    } | undefined;
} | {
    message: string;
    type: "schematic_error";
    schematic_error_id: string;
    error_type: "schematic_port_not_found";
})[] | null;
type CircuitJsonErrors = ReturnType<typeof getCircuitJsonErrors>;
declare const CircuitJsonPreview: ({ code, onRunClicked, errorMessage, circuitJson, autoroutingGraphics, showRightHeaderContent, showCodeTab, codeTabContent, showJsonTab, showRenderLogTab, onActiveTabChange, renderLog, showImportAndFormatButtons, className, headerClassName, leftHeaderContent, readOnly, isStreaming, autoroutingLog, onReportAutoroutingLog, isRunningCode, hasCodeChangedSinceLastRun, onEditEvent, editEvents, defaultActiveTab, autoRotate3dViewerDisabled, showSchematicDebugGrid, showToggleFullScreen, defaultToFullScreen, }: PreviewContentProps) => react_jsx_runtime.JSX.Element;

interface BomTableProps {
    circuitJson: AnyCircuitElement[];
}
declare const linkify: (supplier: string, partNumber: string) => string | react_jsx_runtime.JSX.Element;
declare const BomTable: React.FC<BomTableProps>;

declare const PcbViewerWithContainerHeight: ({ containerClassName, ...props }: {
    containerClassName?: string;
} & ComponentProps<typeof PCBViewer>) => react_jsx_runtime.JSX.Element;

interface OrderDialogProps {
    isOpen: boolean;
    onClose: () => void;
    stage: "initial" | "progress" | "checkout";
    setStage: (stage: "initial" | "progress" | "checkout") => void;
    circuitJson?: CircuitJson;
    packageReleaseId?: string;
}

interface CliOrderDialogProps {
    isOpen: boolean;
    onClose: () => void;
    stage: "initial" | "progress" | "checkout";
    setStage: (stage: "initial" | "progress" | "checkout") => void;
}

type OrderStage = "initial" | "progress" | "checkout";
declare const useOrderDialogCli: () => {
    isOpen: boolean;
    stage: OrderStage;
    open: () => void;
    close: () => void;
    setStage: react.Dispatch<react.SetStateAction<OrderStage>>;
    OrderDialog: react.FC<CliOrderDialogProps>;
};
declare const useOrderDialog: () => {
    isOpen: boolean;
    stage: OrderStage;
    open: () => void;
    close: () => void;
    setStage: react.Dispatch<react.SetStateAction<OrderStage>>;
    OrderDialog: react.FC<OrderDialogProps>;
};

export { BomTable, type CircuitJsonErrors, CircuitJsonPreview, PcbViewerWithContainerHeight, type PreviewContentProps, type TabId, linkify, useOrderDialog, useOrderDialogCli };
