import * as react_jsx_runtime from 'react/jsx-runtime';
import { ManualEditEvent } from '@tscircuit/props';
import { CircuitJson, AnyCircuitElement } from 'circuit-json';
import { Object3D } from 'three';
import * as react from 'react';
import { ComponentProps, FC } 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` | `board:renderPhaseStarted`;
    /**
     * Corresponds to the element that was rendered
     */
    renderId: string;
    eventsProcessed: number;
    createdAt: number;
    phase?: string;
};
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;
    fsMap?: Map<string, string> | Record<string, string>;
    readOnly?: boolean;
    onRunClicked?: () => void;
    tsxRunTriggerCount?: number;
    errorMessage?: string | null;
    errorStack?: 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;
    /**
     * Alias for defaultActiveTab
     */
    defaultTab?: TabId;
    /**
     * Tabs to display. Defaults to all
     */
    availableTabs?: TabId[];
    renderLog?: RenderLog | null;
    /**
     * Name of the currently running async effect from @tscircuit/core, if any
     */
    activeEffectName?: string;
    onEditEvent?: (editEvent: ManualEditEvent) => void;
    editEvents?: ManualEditEvent[];
    onActiveTabChange?: (tab: TabId) => any;
    autoRotate3dViewerDisabled?: boolean;
    showSchematicDebugGrid?: boolean;
    onReportAutoroutingLog?: (name: string, data: {
        simpleRouteJson: any;
    }) => void;
    /**
     * Enable selecting older @tscircuit/eval versions
     */
    allowSelectingVersion?: boolean;
    /**
     * Whether to show the file menu
     */
    showFileMenu?: boolean;
    /**
     * Whether the preview is being embedded in a web page
     */
    isWebEmbedded?: boolean;
}

declare global {
    interface Window {
        TSCIRCUIT_3D_OBJECT_REF: Object3D | undefined;
    }
}

declare const CircuitJsonPreview: ({ code, fsMap, onRunClicked, errorMessage, errorStack, circuitJson, autoroutingGraphics, showRightHeaderContent, showCodeTab, codeTabContent, showJsonTab, showRenderLogTab, onActiveTabChange, renderLog, showImportAndFormatButtons, className, headerClassName, leftHeaderContent, readOnly, isStreaming, autoroutingLog, onReportAutoroutingLog, isRunningCode, hasCodeChangedSinceLastRun, onEditEvent, editEvents, defaultActiveTab, defaultTab, availableTabs, autoRotate3dViewerDisabled, showSchematicDebugGrid, showToggleFullScreen, defaultToFullScreen, activeEffectName, allowSelectingVersion, showFileMenu, isWebEmbedded, }: 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 CliOrderDialogProps {
    isOpen: boolean;
    onClose: () => void;
    stage: "initial" | "progress" | "checkout";
    setStage: (stage: "initial" | "progress" | "checkout") => void;
    signIn?: () => void;
    isLoggedIn?: boolean;
}

interface OrderDialogProps {
    isOpen: boolean;
    onClose: () => void;
    stage: "initial" | "progress" | "checkout";
    setStage: (stage: "initial" | "progress" | "checkout") => void;
    circuitJson?: CircuitJson;
    packageReleaseId?: string;
    signIn?: () => void;
    isLoggedIn: boolean;
}
declare const OrderDialog: FC<OrderDialogProps>;

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: ({ onSignIn, isLoggedIn, packageReleaseId, }: {
    onSignIn: () => void;
    isLoggedIn: boolean;
    packageReleaseId: string;
}) => {
    isOpen: boolean;
    stage: OrderStage;
    open: () => void;
    close: () => void;
    setStage: react.Dispatch<react.SetStateAction<OrderStage>>;
    OrderDialog: (props: Omit<Parameters<typeof OrderDialog>[0], "signIn" | "isLoggedIn">) => react_jsx_runtime.JSX.Element;
};

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