import * as _angular_core from '@angular/core';
import { AfterViewInit, OnDestroy, TemplateRef } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { CdkDragStart, CdkDragDrop } from '@angular/cdk/drag-drop';
import { Observable } from 'rxjs';
import * as _masterteam_components_formula from '@masterteam/components/formula';
import { FormulaRuntimeMessageCode, FormulaRuntimeMessage, FormulaConditionConfig, FormulaValidationRuleConfig } from '@masterteam/components';
export { FormulaConditionConfig, FormulaConditionMode, FormulaRuntimeMessage, FormulaRuntimeMessageCode, FormulaValidationRuleConfig, FormulaValidationSeverity } from '@masterteam/components';

/**
 * Flat Formula Token Model
 *
 * The formula is represented as a FLAT array of tokens.
 * This approach provides:
 * - Better performance (no deep component nesting)
 * - Solid drag-drop behavior (functions move as complete units)
 * - Simple serialization (just join token values)
 *
 * STRUCTURE RULES:
 * - fn-open: "IF(" - function name + opening paren as ONE token
 * - fn-close: ")" - closing paren, belongs to a function
 * - fn-separator: "," - argument separator, belongs to a function
 * - Dragging any structural token moves the ENTIRE function
 * - Content tokens (property, operator, literal) can move individually
 */
/** Token types */
type TokenType = 'fn-open' | 'fn-close' | 'fn-separator' | 'property' | 'operator' | 'literal';
/** What happens when this token is dragged */
type DragBehavior = 'function' | 'single';
/**
 * Formula Token - a single element in the flat formula array
 */
interface FormulaToken {
    id: string;
    type: TokenType;
    value: string;
    display?: string;
    functionId?: string;
    depth: number;
    argIndex?: number;
    dragBehavior: DragBehavior;
    functionName?: string;
    propertyType?: 'current' | 'children' | 'parent';
    literalType?: 'string' | 'number' | 'boolean';
}
/**
 * Function structure info - tracks open/close pairs
 */
interface FunctionInfo {
    id: string;
    name: string;
    openIndex: number;
    closeIndex: number;
    argCount: number;
    depth: number;
}
/** Generate unique token ID */
declare function generateTokenId(): string;
/** Generate unique function ID */
declare function generateFunctionId(): string;
/** Parse function signature like "SUM(values)" or "IF(cond, a, b)" */
declare function parseSignature(signature: string): {
    name: string;
    args: string[];
};
/**
 * Create a function's tokens from signature
 * e.g., "IF(condition, trueVal, falseVal)" creates:
 * - fn-open: "IF("
 * - fn-separator: "," (x2)
 * - fn-close: ")"
 */
declare function createFunctionTokens(signature: string, depth?: number): FormulaToken[];
/**
 * Create a property token
 */
declare function createPropertyToken(propertyKey: string, propertyType?: 'current' | 'children' | 'parent', depth?: number, functionId?: string, argIndex?: number, display?: string): FormulaToken;
/**
 * Create an operator token
 */
declare function createOperatorToken(symbol: string, depth?: number, functionId?: string, argIndex?: number): FormulaToken;
/**
 * Create a literal token
 */
declare function createLiteralToken(value: string | number | boolean, depth?: number, functionId?: string, argIndex?: number): FormulaToken;
/**
 * Find the complete range of a function in the token array
 * This includes ALL tokens between fn-open and fn-close (including nested content)
 * Returns [startIndex, endIndex] inclusive
 */
declare function findFunctionRange(tokens: FormulaToken[], functionId: string): [number, number] | null;
/**
 * Get all tokens belonging to a function (including nested content)
 */
declare function getFunctionTokens(tokens: FormulaToken[], functionId: string): FormulaToken[];
/**
 * Validate if a drop position is allowed
 */
declare function isValidDropPosition(tokens: FormulaToken[], dropIndex: number, draggedTokens: FormulaToken[]): boolean;
/**
 * Serialize tokens to formula string
 */
declare function serializeTokens(tokens: FormulaToken[]): string;
/**
 * Clone a token with new ID
 */
declare function cloneToken(token: FormulaToken): FormulaToken;
/**
 * Clone multiple tokens with new IDs and new function IDs
 */
declare function cloneTokens(tokens: FormulaToken[]): FormulaToken[];
/**
 * Update depth for all tokens (after move)
 */
declare function recalculateDepths(tokens: FormulaToken[]): FormulaToken[];
/**
 * Find which argument index a position belongs to within a function
 */
declare function getArgumentIndexAtPosition(tokens: FormulaToken[], functionId: string, position: number): number;

/**
 * Smart Formula Block - Types and Factory Functions
 * Defines the block structure and creation helpers
 */
/** Block type */
type BlockType = 'function' | 'property' | 'operator' | 'literal';
/** Argument slot for functions */
interface ArgumentSlot {
    id: string;
    name: string;
    blocks: SmartBlock[];
    placeholder?: string;
}
/** Smart block structure */
interface SmartBlock {
    id: string;
    type: BlockType;
    value: string;
    display?: string;
    functionName?: string;
    signature?: string;
    arguments?: ArgumentSlot[];
    propertyType?: 'current' | 'children' | 'parent';
    propertyKey?: string;
    operatorSymbol?: string;
    literalValue?: string | number | boolean;
}
/** Generate unique block ID */
declare function generateSmartBlockId(): string;
/** Create a function block from signature */
declare function createFunctionBlock(signature: string, name?: string): SmartBlock;
/** Create a property block */
declare function createPropertyBlock(propertyKey: string, propertyType?: 'current' | 'children' | 'parent', display?: string): SmartBlock;
/** Create an operator block */
declare function createOperatorBlock(symbol: string): SmartBlock;
/** Create a literal block */
declare function createLiteralBlock(value: string | number | boolean): SmartBlock;
/** Deep clone a block with new IDs */
declare function cloneBlock(block: SmartBlock): SmartBlock;

/**
 * Validation Result Models
 * API response types for formula validation
 */
/** Validation error/warning severity */
type ValidationSeverity = 'Error' | 'Warning';
/** Validation error or warning */
interface ValidationError {
    message: string;
    line: number;
    column: number;
    severity: ValidationSeverity;
}
/** Validation warning (same structure as error) */
type ValidationWarning = ValidationError;
/** Complete validation result from API */
interface ValidationResult {
    isValid: boolean;
    errors: ValidationError[];
    warnings: ValidationWarning[];
    dependencies: string[];
    complexity: number;
}
/** Validation request payload */
interface ValidationRequest {
    formula: string;
    knownProperties?: string[];
    levelSchemaId?: number;
    templateId?: number;
}
/** Autocomplete suggestion */
interface AutocompleteSuggestion {
    text: string;
    displayText: string;
    type: 'Function' | 'Property' | 'Operator' | 'Context' | 'Keyword';
    description: string;
    insertText: string;
    category?: string;
    cursorOffset?: number;
}
/** Autocomplete context */
interface AutocompleteContext {
    type: 'None' | 'Function' | 'Property' | 'Operator';
    scope: string;
    prefix: string;
}
/** Autocomplete response from API */
interface AutocompleteResponse {
    suggestions: AutocompleteSuggestion[];
    context: AutocompleteContext;
}
/** Autocomplete request payload */
interface AutocompleteRequest {
    formula: string;
    cursorPosition: number;
    knownProperties?: string[];
    levelSchemaId?: number;
    contextEntityTypeKey?: string;
}
/** API error response */
interface ApiErrorResponse {
    error: string;
    message?: string;
}

/**
 * Formula Block Model - Types for formula functions and operators
 */
/** Function category types */
type FunctionCategory = 'Math' | 'Aggregation' | 'Logic' | 'Hierarchy' | 'Date' | 'String' | 'PhaseGate' | any;
/** Parameter definition for a function */
interface ParameterDefinition {
    name: string;
    type: string;
    description: string;
    required: boolean;
    defaultValue?: unknown;
}
/** Function definition */
interface FunctionDefinition {
    name: string;
    category: FunctionCategory;
    description: string;
    signature: string;
    parameters: ParameterDefinition[];
    returnType: string;
    examples: string[];
}
/** Function category group */
interface FunctionCategoryGroup {
    name: FunctionCategory;
    displayName: string;
    functions: FunctionDefinition[];
}
/** Operator definition */
interface OperatorDefinition {
    symbol: string;
    name: string;
    type: 'arithmetic' | 'comparison' | 'logical';
    description: string;
    precedence: number;
}

declare class FormulaEditor implements ControlValueAccessor {
    readonly placeholder: _angular_core.InputSignal<string>;
    readonly initialTokens: _angular_core.InputSignal<FormulaToken[]>;
    readonly disabled: _angular_core.InputSignal<boolean>;
    readonly borderless: _angular_core.InputSignal<boolean>;
    readonly formulaChange: _angular_core.OutputEmitterRef<string>;
    readonly tokensChange: _angular_core.OutputEmitterRef<FormulaToken[]>;
    readonly onBlur: _angular_core.OutputEmitterRef<void>;
    readonly onFocus: _angular_core.OutputEmitterRef<void>;
    readonly tokens: _angular_core.WritableSignal<FormulaToken[]>;
    /** Index range being dragged [start, end] inclusive */
    private draggedRange;
    /** Is currently dragging */
    readonly isDragging: _angular_core.WritableSignal<boolean>;
    /** Hovered function ID for highlighting */
    readonly hoveredFunctionId: _angular_core.WritableSignal<string | null>;
    /** Is focused */
    readonly isFocused: _angular_core.WritableSignal<boolean>;
    private onChange;
    private onTouched;
    readonly containerClasses: _angular_core.Signal<"flex min-h-20 font-mono text-sm bg-white dark:bg-surface-800" | "flex min-h-20 font-mono text-sm bg-white dark:bg-surface-800 border border-surface-200 dark:border-surface-700 rounded-md focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/10">;
    readonly lineNumberClasses: _angular_core.Signal<"flex flex-col px-1.5 py-2 bg-surface-50 dark:bg-surface-900 border-r border-surface-200 dark:border-surface-700 select-none min-w-6 text-right" | "flex flex-col px-1.5 py-2 bg-surface-50 dark:bg-surface-900 border-r border-surface-200 dark:border-surface-700 select-none min-w-6 text-right rounded-l-md">;
    /** Line numbers based on token count */
    readonly lines: _angular_core.Signal<any[]>;
    /** Serialized formula string */
    readonly formulaString: _angular_core.Signal<string>;
    constructor();
    writeValue(value: FormulaToken[] | null): void;
    registerOnChange(fn: (value: FormulaToken[]) => void): void;
    registerOnTouched(fn: () => void): void;
    /**
     * Add a block from toolbar (converts SmartBlock to tokens)
     */
    addBlock(block: SmartBlock): void;
    /**
     * Add tokens directly
     */
    addTokens(newTokens: FormulaToken[]): void;
    /**
     * Clear all tokens
     */
    clear(): void;
    /**
     * Get current formula string
     */
    serialize(): string;
    /**
     * Get current tokens
     */
    getTokens(): FormulaToken[];
    handleFocus(): void;
    handleBlur(): void;
    /**
     * Handle drag start - determine what tokens to drag
     */
    onDragStart(event: CdkDragStart, token: FormulaToken, index: number): void;
    /**
     * Handle drop - reorder tokens in the formula
     */
    onDrop(event: CdkDragDrop<FormulaToken[]>): void;
    /**
     * Reset drag state
     */
    private resetDragState;
    /**
     * Handle drag end
     * NOTE: CDK fires cdkDragEnded BEFORE cdkDropListDropped
     * So we don't reset draggedRange here - onDrop handles it
     */
    onDragEnd(): void;
    /**
     * Remove a token or function
     */
    removeToken(token: FormulaToken, index: number): void;
    onTokenHover(token: FormulaToken): void;
    onTokenLeave(): void;
    /**
     * Check if token should be highlighted
     * Only structural tokens (fn-open, fn-close, fn-separator) get highlighted
     * Content tokens (property, operator, literal) inside function are NOT highlighted
     */
    isHighlighted(token: FormulaToken): boolean;
    /** Base token classes */
    private readonly baseTokenClasses;
    /**
     * Get Tailwind classes for a token
     */
    getTokenClasses(token: FormulaToken): string;
    /**
     * Convert SmartBlock to FormulaTokens
     */
    private smartBlockToTokens;
    private emit;
    /**
     * Track function for ngFor
     */
    trackByToken(_index: number, token: FormulaToken): string;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaEditor, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaEditor, "mt-formula-editor", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "initialTokens": { "alias": "initialTokens"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "borderless": { "alias": "borderless"; "required": false; "isSignal": true; }; }, { "formulaChange": "formulaChange"; "tokensChange": "tokensChange"; "onBlur": "onBlur"; "onFocus": "onFocus"; }, never, never, true, never>;
}

type AutocompleteProvider = (request: AutocompleteRequest) => AutocompleteResponse | Promise<AutocompleteResponse | null> | Observable<AutocompleteResponse | null> | null;
declare class FormulaEditorCode implements ControlValueAccessor, AfterViewInit, OnDestroy {
    readonly placeholder: _angular_core.InputSignal<string>;
    readonly initialFormula: _angular_core.InputSignal<string>;
    readonly disabled: _angular_core.InputSignal<boolean>;
    readonly language: _angular_core.InputSignal<string>;
    readonly theme: _angular_core.InputSignal<"vs" | "vs-dark" | "hc-black" | "formula-light" | "formula-dark">;
    readonly borderless: _angular_core.InputSignal<boolean>;
    readonly autocompleteProvider: _angular_core.InputSignal<AutocompleteProvider | null>;
    readonly autocompleteDebounceMs: _angular_core.InputSignal<number>;
    readonly formulaChange: _angular_core.OutputEmitterRef<string>;
    readonly onBlur: _angular_core.OutputEmitterRef<void>;
    readonly onFocus: _angular_core.OutputEmitterRef<void>;
    private readonly editorHost;
    private readonly zone;
    private monaco;
    private editor;
    private model;
    private readonly disposables;
    private resizeObserver;
    private completionProvider;
    private readonly autocompleteSubject;
    private autocompleteSubscription;
    private readonly cancelAutocomplete$;
    private currentAutocompleteRequestId;
    private static formulaAssetsReady;
    readonly value: _angular_core.WritableSignal<string>;
    readonly isFocused: _angular_core.WritableSignal<boolean>;
    readonly showPlaceholder: _angular_core.Signal<boolean>;
    readonly containerClasses: _angular_core.Signal<"relative flex min-h-20 flex-col bg-white dark:bg-surface-800 font-mono text-sm" | "relative flex min-h-20 flex-col bg-white dark:bg-surface-800 font-mono text-sm rounded-md border border-surface-200 dark:border-surface-700 focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/10">;
    private hasWrittenValue;
    private isApplyingExternalValue;
    private onChange;
    private onTouched;
    constructor();
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    writeValue(value: string | null): void;
    registerOnChange(fn: (value: string) => void): void;
    registerOnTouched(fn: () => void): void;
    addBlock(block: SmartBlock): void;
    insertText(text: string, cursorOffset?: number): void;
    clear(): void;
    getValue(): string;
    private initEditor;
    private ensureFormulaAssets;
    private attachEditorListeners;
    private setupResizeObserver;
    private scheduleAutocomplete;
    private setupAutocompleteStream;
    private registerCompletionProvider;
    private resolveAutocompleteResponse;
    private applyCursorOffset;
    private mapSuggestionKind;
    private syncEditorValue;
    private smartBlockToText;
    private formatLiteral;
    private emitValue;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaEditorCode, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaEditorCode, "mt-formula-editor-code", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "initialFormula": { "alias": "initialFormula"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "borderless": { "alias": "borderless"; "required": false; "isSignal": true; }; "autocompleteProvider": { "alias": "autocompleteProvider"; "required": false; "isSignal": true; }; "autocompleteDebounceMs": { "alias": "autocompleteDebounceMs"; "required": false; "isSignal": true; }; }, { "formulaChange": "formulaChange"; "onBlur": "onBlur"; "onFocus": "onFocus"; }, never, never, true, never>;
}

type ToolbarTab = 'functions' | 'properties' | 'operators';
interface FormulaToolbarPropertiesContext {
    insertBlock: (block: SmartBlock) => void;
}
interface OperatorGroup {
    type: string;
    operators: OperatorDefinition[];
}
declare class FormulaToolbar {
    /** Known properties to show in properties tab */
    readonly knownProperties: _angular_core.InputSignal<string[]>;
    /** Custom properties template */
    readonly propertiesTemplate: _angular_core.InputSignal<TemplateRef<FormulaToolbarPropertiesContext> | null>;
    /** Projected properties template */
    readonly projectedPropertiesTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
    /** Function categories (from API or static data) */
    readonly functionCategories: _angular_core.InputSignal<FunctionCategoryGroup[]>;
    /** Operators list (overridable) */
    readonly operators: _angular_core.InputSignal<OperatorDefinition[]>;
    /** Initial active tab */
    readonly initialTab: _angular_core.InputSignal<ToolbarTab>;
    /** Tabs visible in the toolbar */
    readonly visibleTabs: _angular_core.InputSignal<readonly ToolbarTab[]>;
    /** Placeholder for search input */
    readonly searchPlaceholder: _angular_core.InputSignal<string>;
    /** Labels */
    readonly labels: _angular_core.InputSignal<{
        functions?: string;
        properties?: string;
        operators?: string;
        noFunctionsFound?: string;
        noPropertiesAvailable?: string;
        noOperatorsFound?: string;
    }>;
    /** Insert event - emits SmartBlock for the editor */
    readonly onBlockInsert: _angular_core.OutputEmitterRef<SmartBlock>;
    /** Tab change event */
    readonly onTabChange: _angular_core.OutputEmitterRef<ToolbarTab>;
    /** Active tab */
    readonly activeTab: _angular_core.WritableSignal<ToolbarTab>;
    /** Tab options */
    readonly tabOptions: {
        label: string;
        value: ToolbarTab;
    }[];
    /** Tabs actually rendered */
    readonly resolvedTabOptions: _angular_core.Signal<{
        label: string;
        value: ToolbarTab;
    }[]>;
    /** Context for custom properties template */
    protected readonly propertiesTemplateContext: FormulaToolbarPropertiesContext;
    /** Resolve properties template (projected first, input fallback) */
    readonly resolvedPropertiesTemplate: _angular_core.Signal<TemplateRef<any> | null>;
    /** Search query */
    readonly searchQuery: _angular_core.WritableSignal<string>;
    /** Custom value input */
    readonly customValue: _angular_core.WritableSignal<string>;
    /** Detected type of custom value */
    readonly customValueType: _angular_core.Signal<"string" | "number" | "text">;
    /** Preview of custom value */
    readonly customValuePreview: _angular_core.Signal<string>;
    /** CSS class for custom value type */
    readonly customValueTypeClass: _angular_core.Signal<"bg-rose-100 text-rose-700 hover:bg-rose-200 dark:bg-rose-900/30 dark:text-rose-300 dark:hover:bg-rose-900/50" | "bg-emerald-100 text-emerald-700 hover:bg-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-300 dark:hover:bg-emerald-900/50" | "bg-slate-100 text-slate-700 hover:bg-slate-200 dark:bg-slate-700 dark:text-slate-300 dark:hover:bg-slate-600">;
    constructor();
    /** Filtered categories based on search */
    readonly filteredCategories: _angular_core.Signal<FunctionCategoryGroup[]>;
    /** Filtered properties based on search */
    readonly filteredProperties: _angular_core.Signal<string[]>;
    /** Filtered operators based on search */
    readonly filteredOperators: _angular_core.Signal<OperatorDefinition[]>;
    /** Count of filtered items per tab */
    readonly filteredFunctionsCount: _angular_core.Signal<number>;
    readonly filteredPropertiesCount: _angular_core.Signal<number>;
    readonly filteredOperatorsCount: _angular_core.Signal<number>;
    /** Smart search effect - switches to tab with results */
    private readonly smartSearchEffect;
    /** Group operators by type */
    readonly operatorGroups: _angular_core.Signal<OperatorGroup[]>;
    /** Total item count for current tab */
    readonly itemCount: _angular_core.Signal<number>;
    readonly labelFunctions: _angular_core.Signal<string>;
    readonly labelProperties: _angular_core.Signal<string>;
    readonly labelOperators: _angular_core.Signal<string>;
    readonly labelNoFunctions: _angular_core.Signal<string>;
    readonly labelNoProperties: _angular_core.Signal<string>;
    readonly labelNoOperators: _angular_core.Signal<string>;
    /** Get count for a specific tab (filtered when searching) */
    getTabCount(tab: ToolbarTab): number;
    /** Check if a tab has results when searching */
    tabHasResults(tab: ToolbarTab): boolean;
    /** Set active tab */
    setActiveTab(tab: ToolbarTab): void;
    /** Emit block insert event */
    insertBlock(block: SmartBlock): void;
    /** Clear search */
    clearSearch(): void;
    /** Insert custom value */
    insertCustomValue(): void;
    /** Clear custom value input */
    clearCustomValue(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaToolbar, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaToolbar, "mt-formula-toolbar", never, { "knownProperties": { "alias": "knownProperties"; "required": false; "isSignal": true; }; "propertiesTemplate": { "alias": "propertiesTemplate"; "required": false; "isSignal": true; }; "functionCategories": { "alias": "functionCategories"; "required": false; "isSignal": true; }; "operators": { "alias": "operators"; "required": false; "isSignal": true; }; "initialTab": { "alias": "initialTab"; "required": false; "isSignal": true; }; "visibleTabs": { "alias": "visibleTabs"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "onBlockInsert": "onBlockInsert"; "onTabChange": "onTabChange"; }, ["projectedPropertiesTemplate"], never, true, never>;
}

declare const DEFAULT_OPERATORS: OperatorDefinition[];

type ToolbarItemType = 'function' | 'property' | 'operator';
interface ExampleItem {
    code: string;
    description?: string;
}
declare class FormulaToolbarItem {
    /** Item type */
    readonly type: _angular_core.InputSignal<ToolbarItemType>;
    /** Item value (function name, property key, operator symbol) */
    readonly value: _angular_core.InputSignal<string>;
    /** Display value (optional, defaults to value) */
    readonly display: _angular_core.InputSignal<string | undefined>;
    /** Description for tooltip */
    readonly description: _angular_core.InputSignal<string>;
    /** Function signature (for functions only, e.g., "SUM(values)") */
    readonly signature: _angular_core.InputSignal<string | undefined>;
    /** Function examples (for functions only) - can be strings or objects with code/description */
    readonly examples: _angular_core.InputSignal<(string | ExampleItem)[]>;
    /** Normalized examples as ExampleItem[] */
    readonly normalizedExamples: _angular_core.Signal<ExampleItem[]>;
    /** Property type for properties */
    readonly propertyType: _angular_core.InputSignal<"current" | "children" | "parent">;
    /** Insert event - emits SmartBlock */
    readonly onInsert: _angular_core.OutputEmitterRef<SmartBlock>;
    /** Computed display value */
    readonly displayValue: _angular_core.Signal<string>;
    /** Check if has rich tooltip content (signature or examples) */
    readonly hasRichTooltip: _angular_core.Signal<string | boolean>;
    /** Build SmartBlock from item data */
    readonly smartBlock: _angular_core.Signal<SmartBlock>;
    /** Item CSS class based on type */
    readonly itemClass: _angular_core.Signal<"bg-slate-200 text-slate-700 hover:bg-slate-300 dark:bg-slate-700 dark:text-slate-300 dark:hover:bg-slate-600" | "bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-300 dark:hover:bg-amber-900/50" | "bg-sky-100 text-sky-700 hover:bg-sky-200 dark:bg-sky-900/30 dark:text-sky-300 dark:hover:bg-sky-900/50" | "bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300">;
    /** Handle click - emit the SmartBlock */
    handleClick(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaToolbarItem, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaToolbarItem, "mt-formula-toolbar-item", never, { "type": { "alias": "type"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "display": { "alias": "display"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "signature": { "alias": "signature"; "required": false; "isSignal": true; }; "examples": { "alias": "examples"; "required": false; "isSignal": true; }; "propertyType": { "alias": "propertyType"; "required": false; "isSignal": true; }; }, { "onInsert": "onInsert"; }, never, never, true, never>;
}

declare class FormulaStatusBar {
    /** Validation result */
    readonly validation: _angular_core.InputSignal<ValidationResult | null>;
    /** Labels for i18n support */
    readonly labels: _angular_core.InputSignal<{
        valid?: string;
        invalid?: string;
        complexity?: string;
        dependencies?: string;
    }>;
    /** Is formula valid */
    readonly isValid: _angular_core.Signal<boolean>;
    /** Complexity score */
    readonly complexity: _angular_core.Signal<number>;
    /** Dependencies list */
    readonly dependencies: _angular_core.Signal<string[]>;
    /** Dependencies as text */
    readonly dependenciesText: _angular_core.Signal<string>;
    /** First error */
    readonly firstError: _angular_core.Signal<_masterteam_components_formula.ValidationError | null>;
    /** Complexity CSS class */
    readonly complexityClass: _angular_core.Signal<"text-emerald-600 dark:text-emerald-400" | "text-amber-600 dark:text-amber-400" | "text-rose-600 dark:text-rose-400">;
    readonly labelValid: _angular_core.Signal<string>;
    readonly labelInvalid: _angular_core.Signal<string>;
    readonly labelComplexity: _angular_core.Signal<string>;
    readonly labelDependencies: _angular_core.Signal<string>;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaStatusBar, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaStatusBar, "mt-formula-status-bar", never, { "validation": { "alias": "validation"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

type FormulaRuntimeDomain = 'condition' | 'validation';
type FormulaRuntimeEngineErrorCode = Extract<FormulaRuntimeMessageCode, 'FORMULA_PARSE_ERROR' | 'FORMULA_EVALUATION_ERROR'>;
interface FormulaRuntimeEngineError {
    code: FormulaRuntimeEngineErrorCode;
    message: string;
}
interface FormulaEvaluationContext {
    values: Record<string, any>;
}
interface FormulaConditionEvaluation {
    hidden?: boolean;
    disabled?: boolean;
    dependencies: string[];
    errors: FormulaRuntimeEngineError[];
}
interface FormulaValidationEvaluation {
    valid: boolean;
    dependencies: string[];
    errors: FormulaRuntimeEngineError[];
}
interface FormulaValidationRulesEvaluation {
    errors: FormulaRuntimeMessage[];
    warnings: FormulaRuntimeMessage[];
}
interface FormulaRuntimeCatalog {
    domain: FormulaRuntimeDomain;
    functions: FunctionCategoryGroup[];
    operators: OperatorDefinition[];
}

declare const CONDITION_FUNCTION_CATEGORIES: FunctionCategoryGroup[];
declare const CONDITION_OPERATORS: OperatorDefinition[];
declare const VALIDATION_FUNCTION_CATEGORIES: FunctionCategoryGroup[];
declare const VALIDATION_OPERATORS: OperatorDefinition[];
declare const CONDITION_RUNTIME_CATALOG: FormulaRuntimeCatalog;
declare const VALIDATION_RUNTIME_CATALOG: FormulaRuntimeCatalog;

type RuntimeFunction = (...args: any[]) => any;
declare class FormulaRuntimeEngine {
    private readonly compiledCache;
    private readonly functionRegistry;
    constructor(customFunctions?: Record<string, RuntimeFunction>);
    evaluateCondition(config: FormulaConditionConfig, context: FormulaEvaluationContext): FormulaConditionEvaluation;
    evaluateValidation(rule: FormulaValidationRuleConfig, context: FormulaEvaluationContext): FormulaValidationEvaluation;
    evaluateValidationRules(rules: FormulaValidationRuleConfig[], context: FormulaEvaluationContext, options?: {
        isDependencyActive?: (dependency: string) => boolean;
    }): FormulaValidationRulesEvaluation;
    extractDependencies(formulaTokens: string): string[];
    private resolveConditionAction;
    private getCompiledFormula;
    private deserializeFormulaTokens;
    private toLexTokens;
    private evaluateAst;
}

export { CONDITION_FUNCTION_CATEGORIES, CONDITION_OPERATORS, CONDITION_RUNTIME_CATALOG, DEFAULT_OPERATORS, FormulaEditor, FormulaEditorCode, FormulaRuntimeEngine, FormulaStatusBar, FormulaToolbar, FormulaToolbarItem, VALIDATION_FUNCTION_CATEGORIES, VALIDATION_OPERATORS, VALIDATION_RUNTIME_CATALOG, cloneBlock, cloneToken, cloneTokens, createFunctionBlock, createFunctionTokens, createLiteralBlock, createLiteralToken, createOperatorBlock, createOperatorToken, createPropertyBlock, createPropertyToken, findFunctionRange, generateFunctionId, generateSmartBlockId, generateTokenId, getArgumentIndexAtPosition, getFunctionTokens, isValidDropPosition, parseSignature, recalculateDepths, serializeTokens };
export type { ApiErrorResponse, ArgumentSlot, AutocompleteContext, AutocompleteRequest, AutocompleteResponse, AutocompleteSuggestion, BlockType, DragBehavior, ExampleItem, FormulaConditionEvaluation, FormulaEvaluationContext, FormulaRuntimeCatalog, FormulaRuntimeDomain, FormulaRuntimeEngineError, FormulaRuntimeEngineErrorCode, FormulaToken, FormulaToolbarPropertiesContext, FormulaValidationEvaluation, FormulaValidationRulesEvaluation, FunctionCategory, FunctionCategoryGroup, FunctionDefinition, FunctionInfo, OperatorDefinition, ParameterDefinition, SmartBlock, TokenType, ToolbarItemType, ToolbarTab, ValidationError, ValidationRequest, ValidationResult, ValidationSeverity, ValidationWarning };
