import * as _babel_types from '@babel/types';
import * as _babel_generator from '@babel/generator';
import * as _babel_traverse from '@babel/traverse';
import * as _babel_parser from '@babel/parser';

type ContentPart = {
    type: "text" | "dynamic";
    text: string;
};
interface ColorInfo {
    hex: string | null;
    opacity: number;
    hasColor: boolean;
}
interface ComputedStyles {
    color: ColorInfo;
    backgroundColor: ColorInfo;
    borderColor: ColorInfo;
    fontSize: string;
    fontWeight: string;
    fontFamily: string;
    textAlign: string;
    lineHeight: string;
    display: string;
    position: string;
}
interface ElementInfo {
    tagName: string;
    id: string | null;
    className: string | null;
    textContent: string | null;
    hasDirectTextContent?: boolean;
    hasChildElements?: boolean;
    childElementCount?: number;
    textNodeCount?: number;
    contentParts?: ContentPart[];
    attributes: Record<string, string>;
    rect: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    computedStyles?: ComputedStyles;
    isDynamic?: boolean;
    elementCount?: number;
    isMultiElement?: boolean;
    arrayIndex?: number | null;
    isEditable?: boolean;
    editType?: "textContent" | "variableEdit" | "readonly";
    sourceInfo?: Record<string, unknown> | null;
}
interface Position {
    x: number;
    y: number;
    width: number;
    height: number;
    elementRect: {
        top: number;
        left: number;
        bottom: number;
        right: number;
    };
    iframeBounds?: {
        left: number;
        top: number;
        right: number;
        bottom: number;
        width: number;
        height: number;
    };
    constraintBounds?: {
        left: number;
        top: number;
        right: number;
        bottom: number;
        width: number;
        height: number;
    };
}

type HistoryState = {
    textContent?: string;
    textParts?: string[];
    className?: string;
};
interface HistoryEntry {
    elementId: string;
    fileName: string;
    lineNumber: number;
    column?: number;
    component: string;
    hasChildElements?: boolean;
    hasDirectTextContent?: boolean;
    isMultiElement?: boolean;
    arrayIndex?: number | null;
    editType?: "textContent" | "variableEdit" | "readonly";
    sourceInfo?: Record<string, unknown> | null;
    previousState: HistoryState;
    currentState: HistoryState;
}
interface PendingChange {
    elementId: string;
    fileName: string;
    lineNumber: number;
    column?: number;
    component: string;
    hasChildElements: boolean;
    hasDirectTextContent: boolean;
    isMultiElement: boolean;
    changes: {
        textContent?: string;
        textParts?: string[];
        className?: string;
    };
    editType?: "textContent" | "variableEdit" | "readonly";
    sourceInfo?: Record<string, unknown> | null;
    arrayIndex?: number | null;
}
interface OriginalState {
    textContent: string;
    className: string;
}
declare function getPendingChangeKey(elementId: string, arrayIndex?: number | null): string;

interface InlineEditMetadata {
    editType: string;
    sourceInfo?: Record<string, unknown> | null;
    arrayIndex?: number | null;
    [key: string]: unknown;
}
interface MonitorState {
    isActive: boolean;
    interactionMode: "select" | "preview";
    selectedElement: HTMLElement | null;
    selectedGroup: HTMLElement[];
    hoverGroup: HTMLElement[];
    hoverBadge: HTMLElement | null;
    selectedBadge: HTMLElement | null;
    selectedBadges: HTMLElement[];
    hoverTarget: HTMLElement | null;
    repositionRAF: number | null;
    inlineEditElement: HTMLElement | null;
    inlineEditOriginalText: string;
    inlineEditMetadata: InlineEditMetadata | null;
}

declare const MONITOR_ACTION: {
    readonly MODE_ACTIVATED: "DEBUG_MODE_ACTIVATED";
    readonly MODE_DEACTIVATED: "DEBUG_MODE_DEACTIVATED";
    readonly ELEMENT_SELECTED: "ELEMENT_SELECTED";
    readonly ELEMENT_DESELECTED: "ELEMENT_DESELECTED";
    readonly CHANGES_ERROR: "CHANGES_ERROR";
    readonly INTERACTION_MODE_CHANGED: "INTERACTION_MODE_CHANGED";
    readonly INLINE_EDIT_START: "INLINE_EDIT_START";
    readonly INLINE_EDIT_CHANGE: "INLINE_EDIT_CHANGE";
    readonly INLINE_EDIT_END: "INLINE_EDIT_END";
    readonly INLINE_EDIT_ERROR: "INLINE_EDIT_ERROR";
};
declare const COMMAND_ACTION: {
    readonly ACTIVATE: "ACTIVATE";
    readonly DEACTIVATE: "DEACTIVATE";
    readonly CLEAR_SELECTION: "CLEAR_SELECTION";
    readonly APPLY_CHANGES: "APPLY_CHANGES";
    readonly SET_INTERACTION_MODE: "SET_INTERACTION_MODE";
    readonly ENABLE_INLINE_EDIT: "ENABLE_INLINE_EDIT";
    readonly DISABLE_INLINE_EDIT: "DISABLE_INLINE_EDIT";
};
declare const MESSAGE_TYPE: {
    readonly SITE_DEBUG: "SITE_DEBUG";
    readonly DEBUG_COMMAND: "DEBUG_COMMAND";
};

interface ModeActivatedMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.MODE_ACTIVATED;
}
interface ModeDeactivatedMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.MODE_DEACTIVATED;
}
interface ElementSelectedMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.ELEMENT_SELECTED;
    elementInfo: ElementInfo;
}
interface ElementDeselectedMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.ELEMENT_DESELECTED;
}
interface ChangesErrorMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.CHANGES_ERROR;
    error: string;
}
interface InteractionModeChangedMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.INTERACTION_MODE_CHANGED;
    mode: "select" | "preview";
}
interface InlineEditStartMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.INLINE_EDIT_START;
    text: string;
}
interface InlineEditChangeMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.INLINE_EDIT_CHANGE;
    text: string;
}
interface InlineEditEndMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.INLINE_EDIT_END;
    text: string;
}
interface InlineEditErrorMessage {
    type: typeof MESSAGE_TYPE.SITE_DEBUG;
    action: typeof MONITOR_ACTION.INLINE_EDIT_ERROR;
    error: string;
}
type MonitorMessage = ModeActivatedMessage | ModeDeactivatedMessage | ElementSelectedMessage | ElementDeselectedMessage | ChangesErrorMessage | InteractionModeChangedMessage | InlineEditStartMessage | InlineEditChangeMessage | InlineEditEndMessage | InlineEditErrorMessage;
interface ActivateCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.ACTIVATE;
}
interface DeactivateCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.DEACTIVATE;
}
interface ClearSelectionCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.CLEAR_SELECTION;
}
interface ApplyChangesCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.APPLY_CHANGES;
    changes: Record<string, unknown>;
}
interface SetInteractionModeCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.SET_INTERACTION_MODE;
    mode: "select" | "preview";
}
interface EnableInlineEditCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.ENABLE_INLINE_EDIT;
}
interface DisableInlineEditCommand {
    type: typeof MESSAGE_TYPE.DEBUG_COMMAND;
    action: typeof COMMAND_ACTION.DISABLE_INLINE_EDIT;
}
type CommandMessage = ActivateCommand | DeactivateCommand | ClearSelectionCommand | ApplyChangesCommand | SetInteractionModeCommand | EnableInlineEditCommand | DisableInlineEditCommand;

interface SourceInfo {
    type: string;
    varName: string | null;
    file: string | null;
    line: number | null;
    path: string | null;
    isEditable: boolean;
}
interface ArrayContext {
    arrayVar: string;
    arrayFile: string;
    arrayLine: number;
    itemParam: string;
}
interface BabelTools {
    parser: typeof _babel_parser;
    traverse: typeof _babel_traverse;
    generate: typeof _babel_generator;
    t: typeof _babel_types;
}
interface EditRequest {
    fileName: string;
    lineNumber: number;
    column?: number;
    component: string;
    changes: {
        textContent?: string;
        textParts?: string[];
        className?: string;
    };
    editType?: string;
    sourceInfo?: SourceInfo | null;
    hasChildElements?: boolean;
    hasDirectTextContent?: boolean;
    isMultiElement?: boolean;
    arrayIndex?: number | null;
}
interface EditResult {
    success: boolean;
    file?: string;
    error?: string;
    oldValue?: unknown;
    newValue?: unknown;
}

export { type ActivateCommand, type ApplyChangesCommand, type ArrayContext, type BabelTools, type ChangesErrorMessage, type ClearSelectionCommand, type ColorInfo, type CommandMessage, type ComputedStyles, type ContentPart, type DeactivateCommand, type DisableInlineEditCommand, type EditRequest, type EditResult, type ElementDeselectedMessage, type ElementInfo, type ElementSelectedMessage, type EnableInlineEditCommand, type HistoryEntry, type HistoryState, type InlineEditChangeMessage, type InlineEditEndMessage, type InlineEditErrorMessage, type InlineEditMetadata, type InlineEditStartMessage, type InteractionModeChangedMessage, type ModeActivatedMessage, type ModeDeactivatedMessage, type MonitorMessage, type MonitorState, type OriginalState, type PendingChange, type Position, type SetInteractionModeCommand, type SourceInfo, getPendingChangeKey };
