import { DefaultToastOptions } from 'react-hot-toast';
import { DelayMode } from 'msw';
import { NavigateOptions } from 'react-router-dom';
import { QueryClient } from '@tanstack/react-query';
import { Renderable } from 'react-hot-toast';
import { SetupWorker } from 'msw/browser';
import { To } from 'react-router-dom';
import { Toast } from 'react-hot-toast';
import { ToastOptions } from 'react-hot-toast';
import { ValueOrFunction } from 'react-hot-toast';

declare interface ActionExecutionContext {
    uid: symbol;
    state: ContainerState_2;
    getCurrentState: () => ContainerState_2;
    appContext: AppContextObject;
    apiInstance?: IApiInterceptor;
    lookupAction: LookupAsyncFnInner;
    navigate: any;
    location: any;
}

declare type ActionFunction = (executionContext: ActionExecutionContext, ...args: any[]) => any;

declare type ApiInterceptorDefinition = {
    type?: string;
    config?: Record<string, any>;
    artificialDelay?: number | DelayMode;
    schemaDescriptor?: SchemaDescriptor;
    apiUrl?: string;
    initialData?: Record<string, any[]> | (() => Promise<Record<string, any[]>>);
    helpers?: Record<string, any>;
    initialize?: string;
    operations?: Record<string, InterceptorOperationDef>;
    auth?: AuthDefinition;
    useWorker?: boolean;
};

declare type AppContextObject = {
    [x: string]: unknown;
    version: string;
    Actions: Record<string, ActionFunction>;
    apiInterceptorContext: IApiInterceptorContext;
    appGlobals?: Record<string, any>;
    debugEnabled?: boolean;
    decorateComponentsWithTestId?: boolean;
    environment: {
        isWindowFocused: boolean;
    };
    mediaSize: MediaSize;
    queryClient: QueryClient | null;
    standalone?: boolean;
    appIsInShadowDom?: boolean;
    formatDate: (date: string | Date) => string | undefined;
    formatDateTime: (date: any) => string | undefined;
    formatDateWithoutYear: (date: string | Date) => string | undefined;
    formatTime: (date: any) => string | undefined;
    formatTimeWithoutSeconds: (date: string | Date) => string | undefined;
    getDate: (date?: string | number | Date) => Date;
    getDateUntilNow: (date?: string | number | Date, nowLabel?: string, time?: string) => string;
    isoDateString: (date?: string) => string;
    isToday: (date: string | Date) => boolean;
    isTomorrow: (date: string | Date) => boolean;
    isYesterday: (date: string | Date) => boolean;
    smartFormatDate: (date?: string | number | Date) => string;
    smartFormatDateTime: (date: string | Date) => string | undefined;
    differenceInMinutes: (date1: number | Date, date2: number | Date) => number;
    isSameDay: (dateLeft: number | Date, dateRight: number | Date) => boolean;
    isThisYear: (date: Date | number) => boolean;
    formatHumanElapsedTime: (date: string | Date) => string;
    avg: (values: number[], decimals?: number) => number;
    sum: (values: number[]) => number;
    formatFileSizeInBytes: (bytes: number) => string | undefined;
    getFileExtension: (fileName: string) => string | undefined;
    navigate: (url: To, options?: NavigateOptions & {
        queryParams?: Record<string, any>;
    }) => void;
    routerBaseName: string;
    pathname: string | undefined;
    setNavigationHandlers?: (onWillNavigate?: (to: string | number, queryParams?: Record<string, any>) => false | void | null | undefined, onDidNavigate?: (to: string | number, queryParams?: Record<string, any>) => void) => void;
    confirm: {
        (options: ConfirmOptions): Promise<boolean>;
        (title?: string, message?: string, actionLabel?: string, cancelLabel?: string, width?: string): Promise<boolean>;
    };
    signError(error: Error | string): void;
    toast: {
        (message: Message, opts?: ToastOptions): string;
        error: ToastHandler;
        success: ToastHandler;
        loading: ToastHandler;
        custom: ToastHandler;
        dismiss(toastId?: string): void;
        remove(toastId?: string): void;
        promise<T>(promise: Promise<T>, msgs: {
            loading: Renderable;
            success: ValueOrFunction<Renderable, T>;
            error: ValueOrFunction<Renderable, any>;
        }, opts?: DefaultToastOptions): Promise<T>;
    };
    activeThemeId: string;
    activeThemeTone: "light" | "dark";
    availableThemeIds: string[];
    setTheme: (themId: string) => void;
    setThemeTone: (newTone: "light" | "dark") => void;
    toggleThemeTone: () => void;
    getThemeVar: (themeVar: string) => string | undefined;
    loggedInUser: LoggedInUserDto | null;
    setLoggedInUser: (loggedInUser: any) => void;
    readonly resources?: Record<string, string>;
    capitalize: (s?: string) => string;
    pluralize: (number: number, singular: string, plural: string) => string;
    delay: (timeInMs: number, callback?: any) => Promise<void>;
    debounce: <F extends (...args: any[]) => any>(delayMs: number, func: F, ...args: any[]) => void;
    toHashObject: (arr: any[], keyProp: string, valueProp: string) => any;
    findByField: (arr: any[], field: string, value: any) => any;
    readonly embed: {
        isInIFrame: boolean;
    };
    distinct: (arr: any[]) => any[];
    forceRefreshAnchorScroll: () => void;
    scrollBookmarkIntoView: (bookmarkId: string, smoothScrolling?: boolean) => void;
    readLocalStorage: (key: string, fallback?: any) => any;
    writeLocalStorage: (key: string, value: any) => void;
    deleteLocalStorage: (key: string) => void;
    clearLocalStorage: (prefix?: string) => void;
    resetLocalStorage: (prefix?: string) => void;
    getAllLocalStorage: () => Record<string, any>;
    storageTimestamp: number;
    AppState: AppState;
    Log: LogNamespace;
    App: typeof AppUtilsNamespace & {
        fetch: (input: string | URL, init?: RequestInit) => Promise<Response>;
        environment: AppEnvironment;
    };
    Clipboard: typeof ClipboardNamespace;
    pubSubService: PubSubService;
    publishTopic: (topic: string | number, data?: any) => void;
};

declare type AppEnvironment = {
    /** `true` when a narrow-screen media query matches (≤ 768 px wide). */
    isMobile: boolean;
    /** `true` when the OS/browser color scheme preference is dark. */
    prefersDark: boolean;
    /** `true` when the OS/browser requests reduced motion. */
    prefersReducedMotion: boolean;
    /** BCP-47 locale string from `navigator.language`, e.g. `"en-US"`. */
    locale: string;
    /** Ordered list of preferred languages from `navigator.languages`. */
    languages: readonly string[];
};

/**
 * AppState type definition for global state management
 */
declare type AppState = {
    define(bucket: string, initialState: any): any;
    get(bucket: string, path?: string): any;
    set(bucket: string, pathOrValue: string | any, value?: any): any;
    update(bucket: string, pathOrUpdater: string | Function | any, updater?: Function | ((prev: any) => any | Promise<any>)): Promise<any>;
    updateWith(bucket: string, updater: (prev: any) => any | Promise<any>): Promise<any>;
    remove(bucket: string, value: any): void;
    removeBy(bucket: string, predicate: (item: any) => boolean | Promise<boolean>): Promise<void>;
    removeAt(bucket: string, index: number): any;
    append(bucket: string, value: any): any;
    push(bucket: string, value: any): any;
    pop(bucket: string): any;
    shift(bucket: string): any;
    unshift(bucket: string, value: any): any;
    insertAt(bucket: string, index: number, value: any): any;
};

declare const AppUtilsNamespace: {
    randomBytes: typeof randomBytes;
    now: typeof now;
    mark: typeof mark;
    measure: typeof measure;
};

declare type ARRAY_DESTRUCTURE = typeof T_ARRAY_DESTRUCTURE;

declare type ARRAY_LITERAL = typeof T_ARRAY_LITERAL;

declare interface ArrayDestructure extends DestructureBase {
    type: ARRAY_DESTRUCTURE;
}

declare interface ArrayLiteral extends ExpressionBase {
    type: ARRAY_LITERAL;
    items: Expression[];
    loose?: boolean;
}

declare type ARROW_EXPRESSION = typeof T_ARROW_EXPRESSION;

declare type ARROW_EXPRESSION_STATEMENT = typeof T_ARROW_EXPRESSION_STATEMENT;

declare interface ArrowExpression extends ExpressionBase {
    type: ARROW_EXPRESSION;
    name?: string;
    args: Expression[];
    statement: Statement;
    async?: boolean;
}

declare interface ArrowExpressionStatement extends ScripNodeBase {
    type: ARROW_EXPRESSION_STATEMENT;
    expr: ArrowExpression;
}

declare type ASSIGNMENT_EXPRESSION = typeof T_ASSIGNMENT_EXPRESSION;

declare interface AssignmentExpression extends ExpressionBase {
    type: ASSIGNMENT_EXPRESSION;
    leftValue: Expression;
    op: AssignmentSymbols;
    expr: Expression;
}

declare type AssignmentSymbols = "=" | "+=" | "-=" | "**=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" | "&&=" | "||=" | "??=";

declare type ASYNC_FUNCTION_DECLARATION = typeof T_ASYNC_FUNCTION_DECLARATION;

declare type AsyncFunction = (...args: any) => Promise<any> | any;

export declare class AttributeKeyNode extends Node_2 {
}

declare type AttributeKind = "prop" | "event" | "api" | "implicit" | "layout";

export declare class AttributeListNode extends Node_2 {
}

export declare class AttributeNode extends Node_2 {
}

declare type AuthDefinition = {
    defaultLoggedInUser?: any;
};

declare type AWAIT_EXPRESSION = typeof T_AWAIT_EXPRESSION;

declare interface AwaitExpression extends ExpressionBase {
    type: AWAIT_EXPRESSION;
    expr: Expression;
}

declare type BINARY_EXPRESSION = typeof T_BINARY_EXPRESSION;

declare interface BinaryExpression extends ExpressionBase {
    type: BINARY_EXPRESSION;
    op: BinaryOpSymbols;
    left: Expression;
    right: Expression;
}

declare type BinaryOpSymbols = "**" | "*" | "/" | "%" | "+" | "-" | "<<" | ">>" | ">>>" | "<" | "<=" | ">" | ">=" | "==" | "===" | "!=" | "!==" | "&" | "|" | "^" | "&&" | "||" | "??" | "in" | "instanceof";

declare type BLOCK_STATEMENT = typeof T_BLOCK_STATEMENT;

declare interface BlockStatement extends ScripNodeBase {
    type: BLOCK_STATEMENT;
    stmts: Statement[];
}

declare type BREAK_STATEMENT = typeof T_BREAK_STATEMENT;

declare interface BreakStatement extends ScripNodeBase {
    type: BREAK_STATEMENT;
}

declare type ButtonThemeColor = (typeof buttonThemeValues)[number];

declare const buttonThemeValues: readonly ["attention", "primary", "secondary"];

declare type CALCULATED_MEMBER_ACCESS_EXPRESSION = typeof T_CALCULATED_MEMBER_ACCESS_EXPRESSION;

declare interface CalculatedMemberAccessExpression extends ExpressionBase {
    type: CALCULATED_MEMBER_ACCESS_EXPRESSION;
    obj: Expression;
    member: Expression;
}

export declare const enum CharacterCodes {
    EOF = -1,
    nullCharacter = 0,
    maxAsciiCharacter = 127,
    lineFeed = 10,// \n
    carriageReturn = 13,// \r
    lineSeparator = 8232,
    paragraphSeparator = 8233,
    nextLine = 133,
    space = 32,// " "
    nonBreakingSpace = 160,//
    enQuad = 8192,
    emQuad = 8193,
    enSpace = 8194,
    emSpace = 8195,
    threePerEmSpace = 8196,
    fourPerEmSpace = 8197,
    sixPerEmSpace = 8198,
    figureSpace = 8199,
    punctuationSpace = 8200,
    thinSpace = 8201,
    hairSpace = 8202,
    zeroWidthSpace = 8203,
    narrowNoBreakSpace = 8239,
    ideographicSpace = 12288,
    mathematicalSpace = 8287,
    ogham = 5760,
    replacementCharacter = 65533,
    _ = 95,
    $ = 36,
    _0 = 48,
    _1 = 49,
    _2 = 50,
    _3 = 51,
    _4 = 52,
    _5 = 53,
    _6 = 54,
    _7 = 55,
    _8 = 56,
    _9 = 57,
    a = 97,
    b = 98,
    c = 99,
    d = 100,
    e = 101,
    f = 102,
    g = 103,
    h = 104,
    i = 105,
    j = 106,
    k = 107,
    l = 108,
    m = 109,
    n = 110,
    o = 111,
    p = 112,
    q = 113,
    r = 114,
    s = 115,
    t = 116,
    u = 117,
    v = 118,
    w = 119,
    x = 120,
    y = 121,
    z = 122,
    A = 65,
    B = 66,
    C = 67,
    D = 68,
    E = 69,
    F = 70,
    G = 71,
    H = 72,
    I = 73,
    J = 74,
    K = 75,
    L = 76,
    M = 77,
    N = 78,
    O = 79,
    P = 80,
    Q = 81,
    R = 82,
    S = 83,
    T = 84,
    U = 85,
    V = 86,
    W = 87,
    X = 88,
    Y = 89,
    Z = 90,
    ampersand = 38,// &
    asterisk = 42,// *
    at = 64,// @
    backslash = 92,// \
    backtick = 96,// `
    bar = 124,// |
    caret = 94,// ^
    closeBrace = 125,// }
    closeBracket = 93,// ]
    closeParen = 41,// )
    colon = 58,// :
    comma = 44,// ,
    dot = 46,// .
    doubleQuote = 34,// "
    equals = 61,// =
    exclamation = 33,// !
    greaterThan = 62,// >
    hash = 35,// #
    lessThan = 60,// <
    minus = 45,// -
    openBrace = 123,// {
    openBracket = 91,// [
    openParen = 40,// (
    percent = 37,// %
    plus = 43,// +
    question = 63,// ?
    semicolon = 59,// ;
    singleQuote = 39,// '
    slash = 47,// /
    tilde = 126,// ~
    backspace = 8,// \b
    formFeed = 12,// \f
    byteOrderMark = 65279,
    tab = 9,// \t
    verticalTab = 11
}

/**
 * Writes `text` to the system clipboard.
 *
 * This is the sanctioned replacement for the banned `navigator.clipboard.writeText`.
 * The call is logged to the Inspector trace on every invocation.
 *
 * @throws {Error} If the clipboard API is unavailable (non-HTTPS context, denied
 *   permission, or SSR environment).
 */
declare function clipboardCopy(text: string): Promise<void>;

declare const ClipboardNamespace: {
    copy: typeof clipboardCopy;
};

export declare const codeBehindFileExtension = "xmlui.xs";

declare type CodeDeclaration = {
    source?: string;
    tree: Expression;
    [x: string]: unknown;
};

declare type CollectedDeclarations = {
    vars: Record<string, CodeDeclaration>;
    functions: Record<string, CodeDeclaration>;
    moduleErrors?: ModuleErrors;
    hasInvalidStatements?: boolean;
};

declare type ComponentApiMetadata = {
    readonly description: string;
    readonly signature?: string;
    readonly parameters?: Record<string, string>;
};

declare interface ComponentDef<TMd extends ComponentMetadata = ComponentMetadata> extends ComponentDefCore, Scriptable {
    props?: Record<keyof TMd["props"], any>;
    events?: Record<keyof TMd["events"], any>;
    api?: Record<keyof TMd["apis"], any>;
    contextVars?: Record<keyof TMd["contextVars"], string>;
}

/**
 * This interface represents the core properties of a component definition
 * (independent of component metadata).
 */
declare interface ComponentDefCore {
    /**
     * The type discriminator field of the component; it defines the unique ID of the component type.
     */
    type: string;
    /**
     * Unique identifier of a component-like object
     */
    uid?: string;
    /**
     * An optional identifier we use for e2e tests; it does not influence the rendering of a component.
     */
    testId?: string;
    /**
     * Though components manage their state internally, the app logic may require user
     * state management. Components may have user *variables*, which the UI logic uses to
     * manage the application state. This property holds the variables (name and value
     * pairs) associated with this component definition.
     */
    vars?: Record<string, any>;
    /**
     * Global variables that flow down to all child containers regardless of the `uses`
     * property. These variables are shared across the entire application and updates
     * to them propagate back to the root container where they are defined.
     * Only the root container should define globalVars.
     */
    globalVars?: Record<string, any>;
    /**
     * Each component may have child components to constitute a hierarchy of components.
     * This property holds the definition of these nested children.
     */
    children?: ComponentDef[];
    /**
     * Components may have slots that can be filled with other components. This property
     * holds the contents of the slots.
     */
    slots?: Record<string, ComponentDef[]>;
    /**
     * This property is evaluated to a Boolean value during run time. When this value is
     * `true`, the component with its children chain is rendered; otherwise, the entire
     * component hierarchy is omitted from the rendered tree.
     */
    when?: string | boolean;
    /**
     * Per-breakpoint visibility conditions (Tailwind mobile-first style).
     * Keys are breakpoint names ("xs" | "sm" | "md" | "lg" | "xl" | "xxl").
     * When any responsiveWhen entries are defined, they become the exclusive source of truth
     * for visiblity, overriding the base `when` value. For a given screen size, the resolution
     * walks from the current breakpoint down to "xs", returning the first defined responsive
     * value. If no responsive rule matches, the component is hidden (false). If no responsiveWhen
     * entries are defined at all, the base `when` property is used (backward compatibility).
     * Example: `<Button when-md="true" />` shows only at md and above, hidden at xs/sm.
     */
    responsiveWhen?: Partial<Record<MediaBreakpointType, string | boolean>>;
    /**
     * Some components work with data obtained asynchronously. Fetching this data requires
     * some state management handling the complexity (including error handling) of data
     * access. A *loader* is responsible for managing this logic. This property holds the
     * loaders associated with this component definition.
     */
    loaders?: ComponentDef[];
    /**
     * Components may have functions that are used to perform some logic. This property
     * holds the functions (name and function body) associated with this component
     * definition.
     */
    functions?: Record<string, any>;
    /**
     * Components managing state through variables or loaders are wrapped with containers
     * responsible for this job. Just as components, containers form a hierarchy. While
     * working with this hierarchy, parent components may flow state values (key and value
     * pairs) to their child containers. This property holds the name of state values to
     * flow down to the direct child containers.
     */
    uses?: string[];
    /**
     * Arbitrary debug information that can be attached to a component definition.
     * Current usage:
     * - `debug: { source: { start: number, end: number } }` The start and end
     *   positions of the source belonging to the particular component definition.
     */
    debug?: Record<string, any>;
}

declare type ComponentEventMetadata = {
    readonly description: string;
    readonly signature?: string;
    readonly parameters?: Record<string, string>;
};

export declare const componentFileExtension = "xmlui";

declare type ComponentLike = ComponentDef | CompoundComponentDef;

export declare type ComponentLints = {
    lints: {
        message: string;
        kind: LintDiagKind;
    }[];
    componentName: string;
};

declare type ComponentMetadata<TProps extends Record<string, ComponentPropertyMetadata> = Record<string, any>, TEvents extends Record<string, ComponentEventMetadata> = Record<string, any>, TContextValues extends Record<string, ComponentPropertyMetadata> = Record<string, any>, TApis extends Record<string, ComponentApiMetadata> = Record<string, any>> = {
    status?: "stable" | "experimental" | "deprecated" | "in progress" | "internal";
    description?: string;
    shortDescription?: string;
    props?: TProps;
    events?: TEvents;
    contextVars?: TContextValues;
    apis?: TApis;
    nonVisual?: boolean;
    childrenAsTemplate?: string;
    opaque?: boolean;
    themeVars?: Record<string, string>;
    themeVarDescriptions?: Record<string, string>;
    defaultThemeVars?: DefaultThemeVars;
    toneSpecificThemeVars?: Record<string, Record<string, string>>;
    limitThemeVarsToComponent?: boolean;
    themeVarContributorComponents?: string[];
    allowArbitraryProps?: boolean;
    specializedFrom?: string;
    docFolder?: string;
    isHtmlTag?: boolean;
    parts?: Record<string, ComponentPartMetadata>;
    defaultPart?: string;
    excludeBehaviors?: string[];
    compactInlineLabel?: boolean;
    deprecationMessage?: string;
    defaultAriaLabel?: string;
    /**
     * Accessibility metadata for the component.
     *
     * Used by the a11y linter (`components-core/accessibility/linter.ts`) to determine:
     *   - What ARIA role the component maps to (`role`).
     *   - Which props provide an accessible name (`accessibleNameProps`).
     *   - Whether an accessible name is required (`requiresAccessibleName`).
     *   - Which landmark region the component represents (`landmark`).
     *
     * This field is purely advisory — no runtime behaviour changes.
     */
    a11y?: {
        /**
         * The ARIA role this component maps to.
         * Interactive roles (`button`, `link`, `switch`, `checkbox`, `menuitem`,
         * `tab`, `option`) require an accessible name by default.
         * Structural roles (`landmark`, `heading`, `list`, `image`) may or may
         * not require one. `decorative` suppresses the accessible-name requirement.
         */
        readonly role?: "button" | "link" | "switch" | "checkbox" | "menuitem" | "tab" | "option" | "dialog" | "form-input" | "landmark" | "heading" | "list" | "image" | "decorative";
        /**
         * Prop names that provide an accessible name for this component.
         * The linter checks that at least one is present and non-empty.
         * Typical values: `["label", "aria-label", "title"]`.
         */
        readonly accessibleNameProps?: readonly string[];
        /**
         * When `true` (default for interactive roles), the linter emits
         * `missing-accessible-name` if none of `accessibleNameProps` is set.
         * Set to `false` for components where an accessible name is optional.
         */
        readonly requiresAccessibleName?: boolean;
        /**
         * The HTML landmark region this component represents.
         * Used to detect `duplicate-landmark` (e.g., two `<main>` on the same page).
         */
        readonly landmark?: "main" | "navigation" | "banner" | "contentinfo" | "complementary" | "search";
    };
};

declare type ComponentMetadataCollection = Record<string, RestrictedComponentMetadata>;

declare class ComponentMetadataProvider {
    private readonly metadata;
    constructor(metadata: RestrictedComponentMetadata);
    /**
     * Retrieves the metadata for a given property, explicit or implicit.
     * @param name The name of the property.
     * @returns The metadata for the property, or `undefined` if not found.
     */
    getProp(name: string): any;
    getAttr(name: string): any;
    getAttrForKind({ name, kind }: TaggedAttribute): any;
    getAllAttributes(): TaggedAttribute[];
    getEvent(name: string): any;
    getApi(name: string): any;
    get events(): Record<string, string>;
    get apis(): Record<string, string>;
    get contextVars(): Record<string, string>;
    get allowArbitraryProps(): boolean;
    get shortDescription(): string;
    getMetadata(): RestrictedComponentMetadata;
}

declare type ComponentPartMetadata = {
    description: string;
};

declare type ComponentPropertyMetadata = {
    readonly description: string;
    readonly valueType?: PropertyValueType;
    readonly isResourceUrl?: boolean;
    readonly availableValues?: readonly PropertyValueDescription[];
    defaultValue?: any;
    isValid?: IsValidFunction<any>;
    isInternal?: boolean;
    isRequired?: boolean;
    deprecationMessage?: string;
    /**
     * Audit / PII classification metadata for this property.
     *
     * The audit pipeline (plan #15 Phase 2) uses this to apply default redaction
     * rules before forwarding log entries to sinks.  When a property is marked
     * `sensitive` or `secret`, the runtime will redact its value unless an
     * explicit policy overrides the default.
     *
     * - `"public"` — no redaction required.
     * - `"sensitive"` — mild PII (email, name, …); hashed by default.
     * - `"secret"` — high-sensitivity value (password, token, …); masked by default.
     */
    audit?: {
        classification: "public" | "sensitive" | "secret";
        defaultRedaction?: "mask" | "drop" | "hash";
    };
};

export declare const COMPOUND_COMP_ID = "Component";

declare interface CompoundComponentDef extends Scriptable {
    name: string;
    component: ComponentDef;
    api?: Record<string, any>;
    vars?: Record<string, any>;
    namespaces?: Record<string, string>;
    debug?: Record<string, any>;
    codeBehind?: string;
}

declare type CONDITIONAL_EXPRESSION = typeof T_CONDITIONAL_EXPRESSION;

declare interface ConditionalExpression extends ExpressionBase {
    type: CONDITIONAL_EXPRESSION;
    cond: Expression;
    thenE: Expression;
    elseE: Expression;
}

declare type ConfirmOptions = {
    title?: string;
    message?: string;
    actionLabel?: string;
    cancelLabel?: string;
    width?: string;
    actionThemeColor?: ButtonThemeColor;
};

declare type CONST_STATEMENT = typeof T_CONST_STATEMENT;

declare interface ConstStatement extends ScripNodeBase {
    type: CONST_STATEMENT;
    decls: VarDeclaration[];
}

/**
 * We store the state application state in a hierarchical structure of
 * containers. This type represents the state within a single container
 * stored as key and value pairs.
 */
declare type ContainerState = Record<string | symbol, any>;

declare type ContainerState_2 = Record<string | symbol, any>;

export declare class ContentListNode extends Node_2 {
}

declare type CONTINUE_STATEMENT = typeof T_CONTINUE_STATEMENT;

declare interface ContinueStatement extends ScripNodeBase {
    type: CONTINUE_STATEMENT;
}

export declare const CORE_NAMESPACE_VALUE = "#xmlui-core-ns";

export declare function createScanner(skipTrivia: boolean, textInitial?: string, onError?: ScannerErrorCallback, start?: number, length?: number): Scanner;

export declare function createXmlUiParser(source: string): {
    parse: () => ParseResult;
    getText: GetText;
};

declare type DefaultThemeVars = Record<string | ThemeTone, string | Record<string, string>>;

declare type DESTRUCTURE = typeof T_DESTRUCTURE;

declare interface Destructure extends DestructureBase {
    type: DESTRUCTURE;
    aDestr?: ArrayDestructure[];
    oDestr?: ObjectDestructure[];
}

declare interface DestructureBase extends ExpressionBase {
    id?: string;
    aDestr?: ArrayDestructure[];
    oDestr?: ObjectDestructure[];
}

export declare const Diag_Invalid_Character: {
    readonly code: ErrCodesParser.invalidChar;
    readonly message: "Invalid character.";
};

export declare const Diag_Unterminated_CData: {
    readonly code: ErrCodesParser.untermCData;
    readonly message: "Unterminated CDATA section";
};

export declare const Diag_Unterminated_Comment: {
    readonly code: ErrCodesParser.untermComment;
    readonly message: "Unterminated comment";
};

export declare const Diag_Unterminated_Script: {
    readonly code: ErrCodesParser.untermScript;
    readonly message: "Unterminated script section";
};

export declare const Diag_Unterminated_String_Literal: {
    readonly code: ErrCodesParser.untermStr;
    readonly message: "Unterminated string literal.";
};

export declare enum DiagnosticCategory {
    Error = 1,
    Warning = 2,
    Information = 3,
    Hint = 4
}

export declare const DIAGS_PARSER: {
    readonly unexpectedCloseTag: {
        readonly code: ErrCodesParser.unexpectedCloseTag;
        readonly message: "Read '</', but there's no opening tag to close.";
    };
    readonly expCloseStartWithName: (openTagName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly expCloseStart: {
        readonly code: ErrCodesParser.expCloseStart;
        readonly message: "A '</' token expected.";
    };
    readonly uppercaseAttr: (attrName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly duplAttr: (attrName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly tagNameMismatch: (openTagName: string, closeTagName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly invalidChar: (char: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly expEnd: {
        readonly code: ErrCodesParser.expEnd;
        readonly message: "A '>' token expected.";
    };
    readonly expTagName: {
        readonly code: ErrCodesParser.expTagName;
        readonly message: "A tag name expected.";
    };
    readonly expAttrStr: {
        readonly code: ErrCodesParser.expAttrValue;
        readonly message: "A string expected as an attribute value after '='.";
    };
    readonly expEq: {
        readonly code: ErrCodesParser.expEq;
        readonly message: "An '=' token expected.";
    };
    readonly expTagOpen: {
        readonly code: ErrCodesParser.expTagOpen;
        readonly message: "A '<' token expected.";
    };
    readonly expEndOrClose: {
        readonly code: ErrCodesParser.expEndOrClose;
        readonly message: "A '>' or '/>' token expected.";
    };
    readonly expAttrName: {
        readonly code: ErrCodesParser.expAttrName;
        readonly message: "An attribute name expected.";
    };
    readonly expAttrNameAfterNamespace: (namespaceName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly expTagNameAfterNamespace: (namespaceName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly expTagNameAfterCloseStart: {
        readonly code: ErrCodesParser.expTagNameAfterCloseStart;
        readonly message: "Expected tag name after '</'.";
    };
    readonly expAttrNameBeforeEq: {
        readonly code: ErrCodesParser.expAttrNameBeforeEq;
        readonly message: "Expected attribute name before '='.";
    };
    readonly nestedCompDefs: {
        readonly code: ErrCodesParser.nestedCompDefs;
        readonly message: "A reusable component definition cannot nest another one.";
    };
    readonly invalidNodeName: (nodeName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly multipleScriptTags: {
        readonly code: ErrCodesParser.multipleScriptTags;
        readonly message: "Cannot have multiple <script> tags in the same tag.";
    };
    readonly compDefNameExp: {
        readonly code: ErrCodesParser.compDefNameExp;
        readonly message: "A reusable component must have a non-empty name.";
    };
    readonly compDefNameUppercase: {
        readonly code: ErrCodesParser.compDefNameUppercase;
        readonly message: "A component definition's name must start with an uppercase letter.";
    };
    readonly globalNotAllowedInComponent: {
        readonly code: ErrCodesParser.globalNotAllowedInComponent;
        readonly message: "Global variables cannot be declared in component definitions. Use Globals.xs or declare them in Main.xmlui instead.";
    };
    readonly invalidReusableCompAttr: (attrName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly eventNoOnPrefix: (attrName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly onlyNameValueAttrs: (elementName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly nameAttrRequired: (elementName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly usesValueOnly: {
        readonly code: ErrCodesParser.usesValueOnly;
        readonly message: "The uses element must define only a non-empty 'value' attribute.";
    };
    readonly cantHaveNameAttr: (nodeName: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly onlyFieldOrItemChild: {
        readonly code: ErrCodesParser.onlyFieldOrItemChild;
        readonly message: "Only 'field' or 'item' are accepted as a child element.";
    };
    readonly cannotMixFieldItem: {
        readonly code: ErrCodesParser.cannotMixFieldItem;
        readonly message: "Cannot mix 'field' and 'item' nodes within an element.";
    };
    readonly singleRootElem: {
        readonly code: ErrCodesParser.singleRootElem;
        readonly message: "A component definition must have exactly one XMLUI element.";
    };
    readonly compDefNesedElem: {
        readonly code: ErrCodesParser.compDefNesedElem;
        readonly message: "A reusable component must have at least one nested component definition.";
    };
    readonly duplXmlns: (namespace: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly rootCompNoNamespace: {
        readonly code: ErrCodesParser.rootCompNoNamespace;
        readonly message: "The top level component's name cannot have a namespace.";
    };
    readonly nsNotFound: (namespace: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly nsValueIncorrect: (namespace: string, details: string) => {
        code: ErrCodesParser;
        message: string;
    };
    readonly nsSchemeIncorrect: (namespace: string, defaultScheme: string) => {
        code: ErrCodesParser;
        message: string;
    };
};

export declare const DIAGS_TRANSFORM: {
    readonly invalidAttrName: (attrName: string) => {
        code: "T007";
        message: string;
    };
    readonly noTextChild: (elementName: string) => {
        code: "T010";
        message: string;
    };
    readonly loaderIdRequired: {
        readonly code: "T013";
        readonly message: "A loader element must have an id.";
    };
    readonly loaderCantHave: (attrName: string) => {
        code: "T014";
        message: string;
    };
    readonly valueAttrRequired: (elementName: string) => {
        code: "T019";
        message: string;
    };
    readonly cannotMixCompNonComp: {
        readonly code: "T020";
        readonly message: "Cannot mix nested components and non-component children.";
    };
    readonly scriptNoAttrs: {
        readonly code: "T022";
        readonly message: "The 'script' tag must not have any attribute.";
    };
    readonly cantPutReusableDefInSlot: {
        readonly code: "T024";
        readonly message: "Cannot put a reusable component definitions into a slot.";
    };
    readonly globalNotAllowedInNested: {
        readonly code: "T031";
        readonly message: "Global variables can only be declared in the root element of Main.xmlui, not in nested components.";
    };
    readonly varNameStartsWithDollar: (varName: string) => {
        code: "T032";
        message: string;
    };
};

declare type DO_WHILE_STATEMENT = typeof T_DO_WHILE_STATEMENT;

declare class DocumentCursor {
    private readonly text;
    private readonly newlineOffsets;
    constructor(text: string);
    get textLength(): number;
    get lineCount(): number;
    /**
     * Converts a zero-based offset to a position.
     *
     * @param offset A zero-based offset.
     * @return A valid {@link Position position}.
     * @example The text document "ab\ncd" produces:
     * * position { line: 0, character: 0 } for `offset` 0.
     * * position { line: 0, character: 1 } for `offset` 1.
     * * position { line: 0, character: 2 } for `offset` 2.
     * * position { line: 1, character: 0 } for `offset` 3.
     * * position { line: 1, character: 1 } for `offset` 4.
     */
    positionAt(offset: number): Position;
    /**
     * Converts the position to a zero-based offset.
     * Invalid positions are adjusted as described in {@link Position.line}
     * and {@link Position.character}.
     *
     * @param position A position.
     * @return A valid zero-based offset.
     */
    offsetAt(position: Position): number;
    offsetToDisplayPos(offset: number): {
        line: number;
        character: number;
    };
    getSurroundingContext(pos: number, end: number, surroundingLines: number): {
        contextPos: number;
        contextEnd: number;
    };
    rangeAt(range: {
        pos: number;
        end: number;
    }): Range_2;
    offsetRangeAt(range: Range_2): {
        pos: number;
        end: number;
    };
}

declare interface DoWhileStatement extends ScripNodeBase {
    type: DO_WHILE_STATEMENT;
    cond: Expression;
    body: Statement;
}

export declare class ElementNode extends Node_2 {
    getAttributeListNode(): Node_2;
}

declare type EMPTY_STATEMENT = typeof T_EMPTY_STATEMENT;

declare interface EmptyStatement extends ScripNodeBase {
    type: EMPTY_STATEMENT;
}

export declare enum ErrCodesParser {
    onlyOneElem = "U002",
    expTagOpen = "U003",
    expTagName = "U004",
    expCloseStart = "U005",
    expEndOrClose = "U006",
    tagNameMismatch = "U007",
    expEnd = "U008",
    expAttrName = "U009",
    expEq = "U010",
    expAttrValue = "U011",
    duplAttr = "U012",
    uppercaseAttr = "U013",
    expTagNameAfterNamespace = "U014",
    expCloseStartWithName = "U015",
    expAttrNameAfterNamespace = "U016",
    unexpectedCloseTag = "U017",
    expTagNameAfterCloseStart = "U019",
    expAttrNameBeforeEq = "U020",
    nestedCompDefs = "U021",
    invalidNodeName = "U022",
    multipleScriptTags = "U023",
    compDefNameExp = "U024",
    compDefNameUppercase = "U025",
    globalNotAllowedInComponent = "U026",
    invalidReusableCompAttr = "U027",
    eventNoOnPrefix = "U028",
    onlyNameValueAttrs = "U029",
    nameAttrRequired = "U030",
    usesValueOnly = "U031",
    cantHaveNameAttr = "U032",
    onlyFieldOrItemChild = "U033",
    cannotMixFieldItem = "U034",
    singleRootElem = "U035",
    compDefNesedElem = "U036",
    duplXmlns = "U037",
    rootCompNoNamespace = "U038",
    nsNotFound = "U039",
    nsValueIncorrect = "U040",
    nsSchemeIncorrect = "U041",
    invalidChar = "W001",
    untermStr = "W002",
    untermComment = "W007",
    untermCData = "W008",
    untermScript = "W009"
}

export declare const ErrCodesTransform: {
    readonly expressionExpected: "W001";
    readonly unexpectedToken: "W002";
    readonly identifierExpected: "W003";
    readonly closeBraceExpected: "W004";
    readonly closeBracketExpected: "W005";
    readonly closeParenExpected: "W006";
    readonly invalidPropName: "W007";
    readonly colonExpected: "W008";
    readonly equalExpected: "W009";
    readonly invalidArgList: "W010";
    readonly forLoopVarRequired: "W011";
    readonly openBraceExpected: "W012";
    readonly catchOrFinallyExpected: "W013";
    readonly openParenExpected: "W014";
    readonly caseOrDefaultExpected: "W015";
    readonly defaultCaseOnce: "W016";
    readonly invalidSequence: "W017";
    readonly invalidObjLiteral: "W018";
    readonly alreadyImported: "W019";
    readonly funcAlreadyDefined: "W020";
    readonly alreadyExported: "W021";
    readonly moduleNotFound: "W022";
    readonly exportNotFound: "W023";
    readonly functionExpected: "W024";
    readonly fromExpected: "W025";
    readonly stringLiteralExpected: "W026";
    readonly varInImportedModule: "W027";
    readonly invalidModuleStatement: "W028";
    readonly moduleOnlyExports: "W029";
    readonly nestedExport: "W030";
    readonly dollarIdentifier: "W031";
    readonly openBraceImportExpected: "W032";
    readonly identifierInImportExpected: "W033";
    readonly identifierAfterAsExpected: "W034";
    readonly commaOrCloseBraceExpected: "W035";
    readonly importFromExpected: "W036";
    readonly importPathExpected: "W037";
    readonly importNotAtTop: "W040";
    readonly importedFunctionNotFound: "W039";
    readonly circularImport: "W041";
    readonly circularImportDetailed: "W042";
    readonly reactiveVarInImportedModule: "W043";
    readonly constLetInImportedModule: "W044";
    readonly invalidStatementInImportedModule: "W045";
    readonly debuggerNotAllowed: "W046";
    readonly invalidAttrName: "T007";
    readonly noTextChild: "T010";
    readonly loaderIdRequired: "T013";
    readonly loaderCantHave: "T014";
    readonly valueAttrRequired: "T019";
    readonly cannotMixCompNonComp: "T020";
    readonly scriptNoAttrs: "T022";
    readonly cantPutReusableDefInSlot: "T024";
    readonly scriptParse: "T030";
    readonly globalNotAllowedInNested: "T031";
    readonly varNameStartsWithDollar: "T032";
};

export declare type ErrCodesTransform = (typeof ErrCodesTransform)[keyof typeof ErrCodesTransform];

declare type Expression = UnaryExpression | BinaryExpression | SequenceExpression | ConditionalExpression | FunctionInvocationExpression | MemberAccessExpression | CalculatedMemberAccessExpression | Identifier | TemplateLiteralExpression | Literal | ArrayLiteral | ObjectLiteral | SpreadExpression | AssignmentExpression | NoArgExpression | ArrowExpression | PrefixOpExpression | PostfixOpExpression | ReactiveVarDeclaration | AwaitExpression | NewExpression | VarDeclaration | Destructure | ObjectDestructure | ArrayDestructure | SwitchCase;

declare type EXPRESSION_STATEMENT = typeof T_EXPRESSION_STATEMENT;

declare interface ExpressionBase extends ScripNodeBase {
    parenthesized?: number;
    source?: string;
}

declare interface ExpressionStatement extends ScripNodeBase {
    type: EXPRESSION_STATEMENT;
    expr: Expression;
}

/**
 * Extract the value of the specified parameter from the given view container state
 * @param state The state of the view container
 * @param param Parameter to extract
 * @param appContext Application context to use
 * @param strict Strict evaluation?
 * @param extractContext
 * @returns
 */
export declare function extractParam(state: ContainerState, param: any, appContext?: AppContextObject | undefined, strict?: boolean, // --- In this case we only allow string binding expression
extractContext?: {
    didResolve: boolean;
}): any;

export declare function findTokenAtOffset(node: Node_2, offset: number): FindTokenSuccess | undefined;

/** If the position is in-between two tokens, the chain to the token just before the cursor is provided as well*/
export declare type FindTokenSuccess = {
    chainAtPos: Node_2[];
    /** If the position is in-between two tokens, the chain to the token just before the position is provided. */
    chainBeforePos: Node_2[];
    /**
     * This field specifies the first index where
     * `chainBeforePos` differs from chainAtPos
     */
    sharedParents: number;
} | {
    chainBeforePos: undefined;
    chainAtPos: Node_2[];
    sharedParents: undefined;
};

declare type FontDef = {
    fontFamily: string;
    fontStyle?: string;
    fontWeight?: string;
    fontDisplay?: string;
    format?: string;
    src: string;
} | string;

declare type FOR_IN_STATEMENT = typeof T_FOR_IN_STATEMENT;

declare type FOR_OF_STATEMENT = typeof T_FOR_OF_STATEMENT;

declare type FOR_STATEMENT = typeof T_FOR_STATEMENT;

declare interface ForInStatement extends ScripNodeBase {
    type: FOR_IN_STATEMENT;
    varB: ForVarBinding;
    id: Identifier;
    expr: Expression;
    body: Statement;
}

declare interface ForOfStatement extends ScripNodeBase {
    type: FOR_OF_STATEMENT;
    varB: ForVarBinding;
    id: Identifier;
    expr: Expression;
    body: Statement;
}

declare interface ForStatement extends ScripNodeBase {
    type: FOR_STATEMENT;
    init?: ExpressionStatement | LetStatement;
    cond?: Expression;
    upd?: Expression;
    body: Statement;
}

declare type ForVarBinding = "let" | "const" | "none";

declare type FUNCTION_DECLARATION = typeof T_FUNCTION_DECLARATION;

declare type FUNCTION_INVOCATION_EXPRESSION = typeof T_FUNCTION_INVOCATION_EXPRESSION;

declare interface FunctionDeclaration extends ScripNodeBase {
    type: FUNCTION_DECLARATION | ASYNC_FUNCTION_DECLARATION;
    id: Identifier;
    args: Expression[];
    stmt: BlockStatement;
    async?: boolean;
}

declare interface FunctionInvocationExpression extends ExpressionBase {
    type: FUNCTION_INVOCATION_EXPRESSION;
    obj: Expression;
    arguments: Expression[];
}

export declare interface GeneralDiag {
    readonly code: ErrCodesParser | ErrCodesTransform;
    readonly message: string;
    readonly pos: number;
    readonly end: number;
    readonly contextPos: number;
    readonly contextEnd: number;
}

declare type GenericToken<T> = {
    text: string;
    type: T;
    startPosition: number;
    endPosition: number;
    startLine: number;
    endLine: number;
    startColumn: number;
    endColumn: number;
};

export declare function getLintSeverity(lintSeverityOption: string | undefined): LintSeverity;

export declare function getSyntaxKindStrRepr(kind: SyntaxKind): string;

export declare type GetText = (n: Node_2, ignoreTrivia?: boolean) => string;

declare interface IApiInterceptor<TRequestInit = any> {
    hasMockForRequest(url: string, options: TRequestInit): boolean;
    executeMockedFetch(url: string, options: TRequestInit): Promise<any>;
}

declare interface IApiInterceptorContext {
    isMocked: (url: string) => boolean;
    initialized: boolean;
    forceInitialize: () => void;
    interceptorWorker: SetupWorker | null;
    apiInstance: IApiInterceptor | null;
}

declare type IDENTIFIER = typeof T_IDENTIFIER;

declare interface Identifier extends ExpressionBase {
    type: IDENTIFIER;
    name: string;
}

declare type IF_STATEMENT = typeof T_IF_STATEMENT;

declare interface IfStatement extends ScripNodeBase {
    type: IF_STATEMENT;
    cond: Expression;
    thenB: Statement;
    elseB?: Statement;
}

declare type IMPORT_DECLARATION = typeof T_IMPORT_DECLARATION;

declare type IMPORT_SPECIFIER = typeof T_IMPORT_SPECIFIER;

declare interface ImportDeclaration extends ScripNodeBase {
    type: IMPORT_DECLARATION;
    specifiers: ImportSpecifier[];
    source: Literal;
}

declare interface ImportSpecifier extends ExpressionBase {
    type: IMPORT_SPECIFIER;
    imported: Identifier;
    local?: Identifier;
}

declare type InterceptorOperationDef = {
    method: "get" | "post" | "put" | "delete" | "patch" | "head" | "options";
    url: string | Array<string>;
    handler: string;
    requestShape?: any;
    responseShape?: any;
    pathParamTypes?: Record<string, string>;
    queryParamTypes?: Record<string, string>;
    successStatusCode?: number;
};

export declare function isIdentifierStart(ch: number): boolean;

export declare function isInnerNode(token: SyntaxKind): boolean;

export declare function isTrivia(token: SyntaxKind): boolean;

declare type IsValidFunction<T> = (propKey: string, propValue: T) => string | string[] | undefined | null;

declare type LET_STATEMENT = typeof T_LET_STATEMENT;

declare interface LetStatement extends ScripNodeBase {
    type: LET_STATEMENT;
    decls: VarDeclaration[];
}

export declare function lint({ component, metadataProvider, }: {
    component: CompoundComponentDef | ComponentDef;
    metadataProvider: MetadataProvider;
}): LintDiagnostic[];

export declare function lintApp({ appDef, metadataProvider, }: {
    appDef: StandaloneAppDescription;
    metadataProvider: MetadataProvider;
}): ComponentLints[];

export declare enum LintDiagKind {
    UnrecognisedProp = 0
}

declare type LintDiagnostic = {
    message: string;
    kind: LintDiagKind;
};

export declare function lintErrorsComponent(lints: ComponentLints[]): ComponentDef;

export declare enum LintSeverity {
    Skip = 0,
    Warning = 1,
    Error = 2,
    Strict = 3
}

declare type LITERAL = typeof T_LITERAL;

declare interface Literal extends ExpressionBase {
    type: LITERAL;
    value: any;
}

declare type LoggedInUserDto = {
    id: number;
    email: string;
    name: string;
    imageRelativeUrl: string;
    permissions: Record<string, string>;
};

declare type LogNamespace = {
    debug(...args: unknown[]): void;
    info(...args: unknown[]): void;
    warn(...args: unknown[]): void;
    error(...args: unknown[]): void;
};

declare type LookupActionOptions = {
    signError?: boolean;
    eventName?: string;
    ephemeral?: boolean;
    defaultHandler?: string;
    context?: any;
    componentType?: string;
    componentLabel?: string;
    componentId?: string;
    sourceFileId?: string | number;
    sourceRange?: {
        start: number;
        end: number;
    };
};

declare type LookupAsyncFnInner = (action: string | undefined, uid: symbol, actionOptions?: LookupActionOptions) => AsyncFunction | undefined;

/**
 * Records a named timing mark. The mark and its timestamp are pushed to the
 * Inspector trace so they appear in the DevTools timeline without polluting
 * the browser's own Performance buffer.
 */
declare function mark(label: string): void;

/**
 * Measures the elapsed time between `fromMark` and the current instant (or
 * between `fromMark` and `toMark`). Pushes the result to the Inspector trace.
 *
 * @returns Elapsed milliseconds, or `NaN` if `fromMark` was never set.
 */
declare function measure(label: string, fromMark: string, toMark?: string): number;

declare const MediaBreakpointKeys: readonly ["xs", "sm", "md", "lg", "xl", "xxl"];

declare type MediaBreakpointType = (typeof MediaBreakpointKeys)[number];

declare type MediaSize = {
    phone: boolean;
    landscapePhone: boolean;
    tablet: boolean;
    desktop: boolean;
    largeDesktop: boolean;
    xlDesktop: boolean;
    smallScreen: boolean;
    largeScreen: boolean;
    size: MediaBreakpointType;
    sizeIndex: number;
};

declare type MEMBER_ACCESS_EXPRESSION = typeof T_MEMBER_ACCESS_EXPRESSION;

declare interface MemberAccessExpression extends ExpressionBase {
    type: MEMBER_ACCESS_EXPRESSION;
    obj: Expression;
    member: string;
    opt?: boolean;
}

declare type Message = ValueOrFunction<Renderable, Toast>;

declare class MetadataProvider {
    private readonly metadataCollection;
    constructor(metadataCollection: ComponentMetadataCollection);
    componentNames(): string[];
    getComponent(componentName: string): ComponentMetadataProvider | null;
}

/**
 * Represents a module error
 */
declare type ModuleErrors = Record<string, ScriptParserErrorMessage[]>;

export declare const moduleFileExtension = "xs";

declare type NEW_EXPRESSION = typeof T_NEW_EXPRESSION;

declare interface NewExpression extends ExpressionBase {
    type: NEW_EXPRESSION;
    callee: Expression;
    arguments: Expression[];
}

declare type NO_ARG_EXPRESSION = typeof T_NO_ARG_EXPRESSION;

declare interface NoArgExpression extends ExpressionBase {
    type: NO_ARG_EXPRESSION;
}

declare class Node_2 {
    readonly kind: SyntaxKind;
    /** Start position of the node including it's trivia */
    readonly start: number;
    readonly pos: number;
    readonly end: number;
    readonly triviaBefore?: Node_2[];
    readonly children?: Node_2[];
    constructor(kind: SyntaxKind, pos: number, end: number, triviaBefore?: Node_2[], children?: Node_2[]);
    isElementNode(): this is ElementNode;
    isAttributeNode(): this is AttributeNode;
    isTagLike(): boolean;
    isAttributeKeyNode(): this is AttributeKeyNode;
    isContentListNode(): this is ContentListNode;
    isAttributeListNode(): this is AttributeListNode;
    isTagNameNode(): this is TagNameNode;
    findTokenAtOffset(position: number): FindTokenSuccess;
    getTriviaNodes(): Node_2[] | null;
}
export { Node_2 as Node }

export declare function nodeToComponentDef(node: Node_2, originalGetText: GetText, fileId: string | number, preResolvedImports?: CollectedDeclarations, warnings?: string[], cursor?: DocumentCursor): ComponentDef | CompoundComponentDef | null;

/**
 * Returns a high-resolution timestamp (milliseconds, fractional) relative to
 * the navigation start — equivalent to `performance.now()`.
 *
 * This is the sanctioned replacement for the banned `performance` global.
 */
declare function now(): number;

declare type OBJECT_DESTRUCTURE = typeof T_OBJECT_DESTRUCTURE;

declare type OBJECT_LITERAL = typeof T_OBJECT_LITERAL;

declare interface ObjectDestructure extends DestructureBase {
    type: OBJECT_DESTRUCTURE;
    id: string;
    alias?: string;
}

declare interface ObjectLiteral extends ExpressionBase {
    type: OBJECT_LITERAL;
    props: (SpreadExpression | [Expression, Expression])[];
}

export declare const onPrefixRegex: RegExp;

export declare interface ParserDiag {
    readonly code: ErrCodesParser | ErrCodesTransform;
    readonly message: string;
    readonly pos: number;
    readonly end: number;
    readonly contextPos: number;
    readonly contextEnd: number;
}

export declare interface ParserDiagPositionless {
    code: ErrCodesParser | ErrCodesTransform;
    message: string;
}

export declare type ParseResult = {
    node: Node_2;
    errors: ParserDiag[];
};

export declare function parseXmlUiMarkup(text: string): ParseResult;

/**
 * Position in a text document expressed as zero-based line and character offset.
 * The offsets are based on a UTF-16 string representation. So a string of the form
 * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
 * is 1 and the character offset of b is 3 since `𐐀` is represented using two code
 * units in UTF-16.
 *
 * Positions are line end character agnostic. So you can not specify a position that
 * denotes `\r|\n` or `\n|` where `|` represents the character offset.
 */
declare interface Position {
    /**
     * Line position in a document (zero-based).
     *
     * If a line number is greater than the number of lines in a document, it
     * defaults back to the number of lines in the document.
     * If a line number is negative, it defaults to 0.
     *
     * The above two properties are implementation specific.
     */
    line: number;
    /**
     * Character offset on a line in a document (zero-based).
     *
     * The meaning of this offset is determined by the negotiated
     * `PositionEncodingKind`.
     *
     * If the character value is greater than the line length it defaults back
     * to the line length. This property is implementation specific.
     */
    character: number;
}

declare type POSTFIX_OP_EXPRESSION = typeof T_POSTFIX_OP_EXPRESSION;

declare interface PostfixOpExpression extends ExpressionBase {
    type: POSTFIX_OP_EXPRESSION;
    op: PrefixOpSymbol;
    expr: Expression;
}

declare type PREFIX_OP_EXPRESSION = typeof T_PREFIX_OP_EXPRESSION;

declare interface PrefixOpExpression extends ExpressionBase {
    type: PREFIX_OP_EXPRESSION;
    op: PrefixOpSymbol;
    expr: Expression;
}

declare type PrefixOpSymbol = "++" | "--";

export declare function printComponentLints(lintDiags: ComponentLints): void;

declare type PropertyValueDescription<T = string | number> = T | {
    value: T;
    description: string;
};

declare type PropertyValueType = "boolean" | "string" | "number" | "any" | "ComponentDef";

/**
 * PubSub service interface for managing topic subscriptions and publications.
 */
declare interface PubSubService {
    /**
     * Publishes a topic with optional data to all subscribers.
     * @param topic The topic to publish (string or number)
     * @param data Optional data payload to send to subscribers
     */
    publishTopic: (topic: string | number, data?: any) => void;
    /**
     * Subscribes a callback to one or more topics.
     * @param topics Single topic or array of topics to subscribe to
     * @param callback Function to call when any subscribed topic is published
     */
    subscribe: (topics: string | number | (string | number)[], callback: TopicCallback) => void;
    /**
     * Unsubscribes a callback from all topics it was subscribed to.
     * @param callback The callback to unsubscribe
     */
    unsubscribe: (callback: TopicCallback) => void;
}

/**
 * Returns `n` cryptographically random bytes as a `Uint8Array`.
 *
 * `n` must be an integer in the range [1, 1024]. The length of the request
 * (but never the bytes themselves) is pushed to the Inspector trace so
 * entropy consumption is observable.
 *
 * This is the sanctioned replacement for the banned `crypto.getRandomValues`.
 */
declare function randomBytes(n: number): Uint8Array;

/**
 * A range in a text document expressed as (zero-based) start and end positions.
 *
 * If you want to specify a range that contains a line including the line ending
 * character(s) then use an end position denoting the start of the next line.
 * For example:
 * ```ts
 * {
 *     start: { line: 5, character: 23 }
 *     end : { line: 6, character : 0 }
 * }
 * ```
 */
declare interface Range_2 {
    /**
     * The range's start position.
     */
    start: Position;
    /**
     * The range's end position.
     */
    end: Position;
}

declare type REACTIVE_VAR_DECLARATION = typeof T_REACTIVE_VAR_DECLARATION;

declare interface ReactiveVarDeclaration extends ExpressionBase {
    type: REACTIVE_VAR_DECLARATION;
    id: Identifier;
    expr: Expression;
}

declare type RestrictedComponentMetadata = Pick<ComponentMetadata, "description" | "status" | "props" | "events" | "apis" | "contextVars" | "allowArbitraryProps" | "shortDescription" | "nonVisual">;

declare type RETURN_STATEMENT = typeof T_RETURN_STATEMENT;

declare interface ReturnStatement extends ScripNodeBase {
    type: RETURN_STATEMENT;
    expr?: Expression;
}

export declare interface Scanner {
    getStartPos(): number;
    getToken(): SyntaxKind;
    getTokenStart(): number;
    getTokenEnd(): number;
    getTokenText(): string;
    getTokenValue(): string;
    isIdentifier(): boolean;
    peekChar(ahead?: number): number | null;
    scanChar(): number | null;
    scan(): SyntaxKind;
    scanTrivia(): SyntaxKind | null;
    scanText(): SyntaxKind;
    getText(): string;
    setText(text: string | undefined, start?: number, length?: number): void;
    setOnError(onError: ScannerErrorCallback | undefined): void;
    resetTokenState(pos: number): void;
    back(): void;
}

export declare type ScannerDiagnosticMessage = typeof Diag_Invalid_Character | typeof Diag_Unterminated_String_Literal | typeof Diag_Unterminated_Comment | typeof Diag_Unterminated_CData | typeof Diag_Unterminated_Script;

export declare type ScannerErrorCallback = (message: ScannerDiagnosticMessage, length: number, arg0?: any) => void;

declare type SchemaDescriptor = {
    tables: Array<TableDescriptor>;
    relationships?: any;
    dtos?: any;
};

declare interface ScripNodeBase {
    type: ScriptNode["type"];
    nodeId: number;
    startToken?: ScriptingToken;
    endToken?: ScriptingToken;
}

declare interface Scriptable {
    script?: string;
    scriptCollected?: CollectedDeclarations;
    scriptError?: any;
}

declare type ScriptingToken = GenericToken<TokenType>;

declare type ScriptNode = Statement | Expression;

declare interface ScriptParserErrorMessage {
    code: ScriptParsingErrorCodes;
    text: string;
    position?: number;
    line?: number;
    column?: number;
}

declare type ScriptParsingErrorCodes = "W001" | "W002" | "W003" | "W004" | "W005" | "W006" | "W007" | "W008" | "W009" | "W010" | "W011" | "W012" | "W013" | "W014" | "W015" | "W016" | "W017" | "W018" | "W019" | "W020" | "W021" | "W022" | "W023" | "W024" | "W025" | "W026" | "W027" | "W028" | "W029" | "W030" | "W031" | "W032" | "W033" | "W034" | "W035" | "W036" | "W037" | "W040" | "W038" | "W039" | "W041" | "W042" | "W043" | "W044" | "W045";

declare type SEQUENCE_EXPRESSION = typeof T_SEQUENCE_EXPRESSION;

declare interface SequenceExpression extends ExpressionBase {
    type: SEQUENCE_EXPRESSION;
    exprs: Expression[];
    loose?: boolean;
}

declare type SPREAD_EXPRESSION = typeof T_SPREAD_EXPRESSION;

declare interface SpreadExpression extends ExpressionBase {
    type: SPREAD_EXPRESSION;
    expr: Expression;
}

declare type StandaloneAppDescription = {
    name?: string;
    version?: string;
    entryPoint?: ComponentLike;
    components?: CompoundComponentDef[];
    themes?: ThemeDefinition[];
    defaultTheme?: string;
    defaultTone?: string;
    resources?: Record<string, string>;
    resourceMap?: Record<string, string>;
    /**
     * Arbitrary key/value settings accessible as `appContext.appGlobals` throughout the framework.
     *
     * Well-known keys:
     * - `xsVerbose` (boolean) — enable Inspector trace logging.
     * - `xsVerboseLogMax` (number) — max trace buffer size (default 200).
     * - `xsVerboseLogBucket` (string) — optional bucket label for trace entries.
     * - `defaultToOptionalMemberAccess` (boolean) — treat all member accesses as optional
     *   (default `true`).
     * - `maxCompoundDepth` (number) — max recursion depth for compound components.
     * - `strictDomSandbox` (boolean, default `false`) — when `true`, any expression that
     *   accesses a banned DOM API throws a `BannedApiError` immediately. When `false`
     *   (the rollout warn phase default), the access proceeds but a `console.warn` is
     *   emitted and a `"sandbox:warn"` Inspector trace entry is pushed so teams can audit
     *   usages before flipping to `true`. See `dev-docs/plans/dom-api-hardening.md`.
     * - `silentConsole` (boolean, default `false`) — controls whether `Log.*` calls mirror
     *   to the native `console.*` in addition to the Inspector trace. When `false` (default),
     *   `Log.info("x")` writes both to the trace and to `console.info`. When `true`, only the
     *   trace entry is emitted — nothing reaches the browser console. Useful in production
     *   deployments where trace data is exported to a server sink. This flag does NOT re-enable
     *   direct `console` access from expressions; that is governed by `strictDomSandbox`.
     * - `allowConsole` (boolean, default `true`) — when `true` (the default), expressions may
     *   freely access `console.*` methods (e.g. `console.log(msg)`). Set to `false` to enforce
     *   the sandbox ban and migrate call sites to `Log.*()` functions. Unlike `strictDomSandbox`
     *   which controls throw-vs-warn for *all* banned APIs, `allowConsole` is a targeted opt-out
     *   exclusively for `console`. When `false`, a `strictDomSandbox: true` config throws
     *   `BannedApiError`; without strict mode it emits a `sandbox:warn` trace entry.
     * - `allowedOrigins` (string[], default `undefined`) — when set, `App.fetch()` rejects any
     *   request whose target origin is not in this list before reaching the network. Origins
     *   must be fully-qualified (e.g. `"https://api.example.com"`). Same-origin requests are
     *   always permitted regardless of this list.
     * - `withXSRFToken` (boolean, default `true`) — when `true`, `App.fetch()` automatically
     *   injects the `X-XSRF-TOKEN` header from the `XSRF-TOKEN` cookie for same-origin
     *   requests. Set to `false` to disable this behaviour.
     * - `appStateKeys` (string[], default `undefined`) — when set, `AppState` rejects any
     *   call whose top-level bucket name is not in the list, throwing
     *   `AppStateSchemaError`. When unset, AppState is permissive — any bucket name is
     *   accepted. Use this in production to lock the global state surface to a declared
     *   schema and prevent accidental key sprawl. See
     *   `dev-docs/plans/dom-api-hardening.md` Step 2.1.
     * - `strictBuildValidation` (boolean, default `false`) — when `true`, all build-time
     *   validation diagnostics escalate one severity step (info → warn → error) and the
     *   `xmlui check` CLI exits non-zero on any `error`-severity finding. Flips to `true`
     *   in the next major release. See `dev-docs/plans/13-build-validation-analyzers.md`.
     * - `strictErrors` (boolean, default `false`) — when `true`, throwing a plain `Error`
     *   from script logs a `kind:"errors"` warn diagnostic with a migration hint to use
     *   `AppError`. Flips to `true` in the next major release. See
     *   `dev-docs/plans/07-structured-exception-model.md`.
     * - `errorCorrelationIdHeader` (string, default `"X-Correlation-Id"`) — the HTTP
     *   response header from which `AppError.correlationId` is read when a fetch fails.
     *   See `dev-docs/plans/07-structured-exception-model.md`.
     * - `strictAuditLogging` (boolean, default `false`) — when `true`, the default
     *   redaction policy blocks on un-redacted PII fields and the sink behaviour changes
     *   from "drop on backpressure" to "bounded buffer then drop with `audit-loss`
     *   diagnostic". Flips to `true` in the next major release. See
     *   `dev-docs/plans/15-audit-grade-observability.md`.
     * - `strictAccessibility` (boolean, default `false`) — when `true`, accessibility
     *   linter findings (`icon-only-button-no-label`, `modal-no-title`,
     *   `missing-accessible-name`, `form-input-no-label`) escalate from `warn` to
     *   `error`, causing the Vite build to fail if any are present. In non-strict mode
     *   they are warnings only. See `dev-docs/plans/05-enforced-accessibility.md`.
     * - `strictReactiveGraph` (boolean, default `false`) — when `true`, every
     *   detected reactive cycle (var ↔ var, var ↔ DataSource, function-mediated)
     *   produces a `kind:"reactive-cycle"` error trace entry plus a one-shot toast
     *   (planned for W6). When `false` (the rollout warn phase default — W2-7), the
     *   detector still runs at startup and emits a single `kind:"reactive-cycle"`
     *   warn entry per unique cycle so teams can audit existing apps before the
     *   strict default flips. See `dev-docs/plans/03-reactive-cycle-detection.md`.
     */
    appGlobals?: Record<string, any>;
    apiInterceptor?: ApiInterceptorDefinition;
    sources?: Record<string, string>;
    icons?: Record<string, string>;
};

declare type Statement = BlockStatement | EmptyStatement | ExpressionStatement | ArrowExpressionStatement | LetStatement | ConstStatement | VarStatement | IfStatement | ReturnStatement | BreakStatement | ContinueStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | ThrowStatement | TryStatement | SwitchStatement | FunctionDeclaration | ImportDeclaration | ImportSpecifier;

/**
 * @param name - The name of the event in camelCase, with "on" prefix.
 */
export declare function stripOnPrefix(name: string): string;

declare type SWITCH_CASE = typeof T_SWITCH_CASE;

declare type SWITCH_STATEMENT = typeof T_SWITCH_STATEMENT;

declare interface SwitchCase extends ExpressionBase {
    type: SWITCH_CASE;
    caseE?: Expression;
    stmts?: Statement[];
}

declare interface SwitchStatement extends ScripNodeBase {
    type: SWITCH_STATEMENT;
    expr: Expression;
    cases: SwitchCase[];
}

/** tokens and nodes combined. Order is significant since the functions below use the numeric values of this enum to check for a range of possible values*/
export declare const enum SyntaxKind {
    Unknown = 0,
    EndOfFileToken = 1,
    CommentTrivia = 2,
    NewLineTrivia = 3,
    WhitespaceTrivia = 4,
    Identifier = 5,
    /** < */
    OpenNodeStart = 6,
    /** </ */
    CloseNodeStart = 7,
    /** `>` */
    NodeEnd = 8,
    /** /> */
    NodeClose = 9,
    /** : */
    Colon = 10,
    /** = */
    Equal = 11,
    /** string literal */
    StringLiteral = 12,
    /** <![CDATA[ ... ]]> */
    CData = 13,
    /** <script>...</script> */
    Script = 14,
    TextNode = 15,
    AmpersandEntity = 16,
    LessThanEntity = 17,
    GreaterThanEntity = 18,
    SingleQuoteEntity = 19,
    DoubleQuoteEntity = 20,
    ElementNode = 21,
    AttributeNode = 22,
    AttributeKeyNode = 23,
    ContentListNode = 24,
    AttributeListNode = 25,
    TagNameNode = 26,
    ErrorNode = 27
}

declare const T_ARRAY_DESTRUCTURE: number;

declare const T_ARRAY_LITERAL: number;

declare const T_ARROW_EXPRESSION: number;

declare const T_ARROW_EXPRESSION_STATEMENT: number;

declare const T_ASSIGNMENT_EXPRESSION: number;

declare const T_ASYNC_FUNCTION_DECLARATION: number;

declare const T_AWAIT_EXPRESSION: number;

declare const T_BINARY_EXPRESSION: number;

declare const T_BLOCK_STATEMENT: number;

declare const T_BREAK_STATEMENT: number;

declare const T_CALCULATED_MEMBER_ACCESS_EXPRESSION: number;

declare const T_CONDITIONAL_EXPRESSION: number;

declare const T_CONST_STATEMENT: number;

declare const T_CONTINUE_STATEMENT: number;

declare const T_DESTRUCTURE: number;

declare const T_DO_WHILE_STATEMENT: number;

declare const T_EMPTY_STATEMENT: number;

declare const T_EXPRESSION_STATEMENT: number;

declare const T_FOR_IN_STATEMENT: number;

declare const T_FOR_OF_STATEMENT: number;

declare const T_FOR_STATEMENT: number;

declare const T_FUNCTION_DECLARATION: number;

declare const T_FUNCTION_INVOCATION_EXPRESSION: number;

declare const T_IDENTIFIER: number;

declare const T_IF_STATEMENT: number;

declare const T_IMPORT_DECLARATION: number;

declare const T_IMPORT_SPECIFIER: number;

declare const T_LET_STATEMENT: number;

declare const T_LITERAL: number;

declare const T_MEMBER_ACCESS_EXPRESSION: number;

declare const T_NEW_EXPRESSION: number;

declare const T_NO_ARG_EXPRESSION: number;

declare const T_OBJECT_DESTRUCTURE: number;

declare const T_OBJECT_LITERAL: number;

declare const T_POSTFIX_OP_EXPRESSION: number;

declare const T_PREFIX_OP_EXPRESSION: number;

declare const T_REACTIVE_VAR_DECLARATION: number;

declare const T_RETURN_STATEMENT: number;

declare const T_SEQUENCE_EXPRESSION: number;

declare const T_SPREAD_EXPRESSION: number;

declare const T_SWITCH_CASE: number;

declare const T_SWITCH_STATEMENT: number;

declare const T_TEMPLATE_LITERAL_EXPRESSION: number;

declare const T_THROW_STATEMENT: number;

declare const T_TRY_STATEMENT: number;

declare const T_UNARY_EXPRESSION: number;

declare const T_VAR_DECLARATION: number;

declare const T_VAR_STATEMENT: number;

declare const T_WHILE_STATEMENT: number;

declare type TableDescriptor = {
    name: string;
    fields?: Record<string, any>;
    pk: Array<string>;
    indexes?: Array<string>;
};

declare type TaggedAttribute = {
    name: string;
    kind: AttributeKind;
};

export declare class TagNameNode extends Node_2 {
}

/** Disregards error nodes amongst the children of the 2 compared name node. (Those reported an error earlyer anyways)*/
export declare function tagNameNodesWithoutErrorsMatch(name1: Node_2, name2: Node_2, getText: GetText): boolean;

declare type TEMPLATE_LITERAL_EXPRESSION = typeof T_TEMPLATE_LITERAL_EXPRESSION;

declare interface TemplateLiteralExpression extends ExpressionBase {
    type: TEMPLATE_LITERAL_EXPRESSION;
    segments: (Literal | Expression)[];
}

declare interface ThemeDefinition extends ThemeDefinitionDetails {
    id: string;
    name?: string;
    extends?: string | Array<string>;
    tones?: Record<string | ThemeTone, ThemeDefinitionDetails>;
    color?: string;
}

declare interface ThemeDefinitionDetails {
    themeVars?: Record<string, string>;
    resources?: Record<string, string | FontDef>;
}

declare type ThemeTone = "light" | "dark";

declare type THROW_STATEMENT = typeof T_THROW_STATEMENT;

declare interface ThrowStatement extends ScripNodeBase {
    type: THROW_STATEMENT;
    expr: Expression;
}

declare type ToastHandler = (message: Message, options?: ToastOptions) => string;

export declare function toDbgString(node: Node_2, getText: (node: Node_2) => string, indentationLvl?: number): string;

declare enum TokenType {
    Eof = -1,
    Ws = -2,
    BlockComment = -3,
    EolComment = -4,
    Unknown = 0,
    LParent = 1,
    RParent = 2,
    Identifier = 3,
    Exponent = 4,
    Divide = 5,
    Multiply = 6,
    Remainder = 7,
    Plus = 8,
    Minus = 9,
    BitwiseXor = 10,
    BitwiseOr = 11,
    LogicalOr = 12,
    BitwiseAnd = 13,
    LogicalAnd = 14,
    IncOp = 15,
    DecOp = 16,
    Assignment = 17,
    AddAssignment = 18,
    SubtractAssignment = 19,
    ExponentAssignment = 20,
    MultiplyAssignment = 21,
    DivideAssignment = 22,
    RemainderAssignment = 23,
    ShiftLeftAssignment = 24,
    ShiftRightAssignment = 25,
    SignedShiftRightAssignment = 26,
    BitwiseAndAssignment = 27,
    BitwiseXorAssignment = 28,
    BitwiseOrAssignment = 29,
    LogicalAndAssignment = 30,
    LogicalOrAssignment = 31,
    NullCoalesceAssignment = 32,
    Semicolon = 33,
    Comma = 34,
    Colon = 35,
    LSquare = 36,
    RSquare = 37,
    QuestionMark = 38,
    NullCoalesce = 39,
    OptionalChaining = 40,
    BinaryNot = 41,
    LBrace = 42,
    RBrace = 43,
    Equal = 44,
    StrictEqual = 45,
    LogicalNot = 46,
    NotEqual = 47,
    StrictNotEqual = 48,
    LessThan = 49,
    LessThanOrEqual = 50,
    ShiftLeft = 51,
    GreaterThan = 52,
    GreaterThanOrEqual = 53,
    ShiftRight = 54,
    SignedShiftRight = 55,
    Dot = 56,
    Spread = 57,
    Backtick = 58,
    DollarLBrace = 59,
    Arrow = 60,
    DecimalLiteral = 61,
    HexadecimalLiteral = 62,
    BinaryLiteral = 63,
    RealLiteral = 64,
    StringLiteral = 65,
    Infinity = 66,
    NaN = 67,
    True = 68,
    False = 69,
    Typeof = 70,
    Null = 71,
    Undefined = 72,
    In = 73,
    Instanceof = 74,
    Let = 75,
    Const = 76,
    Var = 77,
    If = 78,
    Else = 79,
    Return = 80,
    Break = 81,
    Continue = 82,
    Do = 83,
    While = 84,
    For = 85,
    Of = 86,
    Try = 87,
    Catch = 88,
    Finally = 89,
    Throw = 90,
    Switch = 91,
    Case = 92,
    Default = 93,
    Delete = 94,
    Function = 95,
    New = 96,
    As = 97,
    Import = 98,
    From = 99
}

/**
 * Type definition for a topic subscription callback.
 * @param topic The topic that was published
 * @param data The data payload sent with the topic
 */
declare type TopicCallback = (topic: string | number, data: any) => void;

export declare class TransformDiag extends Error {
    code: ErrCodesTransform;
    message: string;
    pos?: number;
    end?: number;
    readonly contextPos?: number;
    readonly contextEnd?: number;
    constructor(diagPositionless: TransformDiagPositionless, pos?: number, end?: number, contextPos?: number, contextEnd?: number);
    toString(): string;
}

export declare interface TransformDiagPositionless {
    code: ErrCodesTransform;
    message: string;
}

declare type TRY_STATEMENT = typeof T_TRY_STATEMENT;

declare interface TryStatement extends ScripNodeBase {
    type: TRY_STATEMENT;
    tryB: BlockStatement;
    catchB?: BlockStatement;
    catchV?: Identifier;
    finallyB?: BlockStatement;
}

export declare const UCRegex: RegExp;

declare type UNARY_EXPRESSION = typeof T_UNARY_EXPRESSION;

declare interface UnaryExpression extends ExpressionBase {
    type: UNARY_EXPRESSION;
    op: UnaryOpSymbols;
    expr: Expression;
}

declare type UnaryOpSymbols = "+" | "-" | "~" | "!" | "typeof" | "delete";

declare type VAR_DECLARATION = typeof T_VAR_DECLARATION;

declare type VAR_STATEMENT = typeof T_VAR_STATEMENT;

declare interface VarDeclaration extends ExpressionBase {
    type: VAR_DECLARATION;
    id?: string;
    aDestr?: ArrayDestructure[];
    oDestr?: ObjectDestructure[];
    expr?: Expression;
}

declare interface VarStatement extends ScripNodeBase {
    type: VAR_STATEMENT;
    decls: ReactiveVarDeclaration[];
}

declare type WHILE_STATEMENT = typeof T_WHILE_STATEMENT;

declare interface WhileStatement extends ScripNodeBase {
    type: WHILE_STATEMENT;
    cond: Expression;
    body: Statement;
}

export declare interface XmlUiAttribute extends XmlUiNodeBase {
    type: "XmlUiAttribute";
    name: string;
    namespace?: string;
    value?: string;
    preserveQuotes?: boolean;
    preserveSpaces?: boolean;
}

export declare interface XmlUiComment extends XmlUiNodeBase {
    type: "XmlUiComment";
    text?: string;
}

export declare interface XmlUiElement extends XmlUiNodeBase {
    type: "XmlUiElement";
    name: string;
    namespace?: string;
    attributes?: XmlUiAttribute[];
    text?: string;
    preserveSpaces?: boolean;
    childNodes?: XmlUiNode[];
}

export declare type XmlUiFragment = XmlUiNode | XmlUiNode[];

/**
 * Helper class for XMLUI serialization and parsing
 */
export declare class XmlUiHelper {
    /**
     * Serialize the specified XML fragment into a string
     * @param xml XML fragment to serialize
     * @param options Formatting options to use
     */
    serialize(xml: XmlUiFragment, options?: XmluiSerializationOptions): string;
    /**
     * Transform the specified component definition into an XMLUI node
     * @param def Component definitions
     * @param options Transformation options
     */
    transformComponentDefinition(def: ComponentDef | CompoundComponentDef, options?: XmlUiTransformOptions): XmlUiFragment;
    /**
     * Transform the specified object into an XMLUI nodes
     * @param def Object definition
     * @param options Transformation options
     */
    transformObject(def: Record<string, any>, options?: XmlUiTransformOptions): XmlUiNode[] | null;
    /**
     * Transforms the specified simple component definition into an XMLUI node
     * @param def Component definition
     * @param options Transformation options
     */
    private transformSimpleComponentDefinition;
    /**
     * Transforms the specified simple component definition into an Xml node
     * @param def Compound component definition
     * @param options Transformation options
     */
    private transformCompoundComponentDefinition;
    /**
     * Transforms a value into an XMLUI element
     * @param nodeName Name of the value node
     * @param name Optional (property) name
     * @param value Value to transform
     * @param options Transformation options
     */
    private transformValue;
    /**
     * Transforms the specified simple component definition into an Xml node
     * @param name Element name
     * @param value Value to transform
     * @param options Transformation options
     */
    private transformObjectValue;
    /**
     * Add a property to the specified XMLUI element
     * @param element XML element
     * @param name Element name
     * @param value Element value
     * @param options Transformation options
     */
    private addProperty;
    private addComponentElement;
    /**
     * Adds a list to the specified XML element
     * @param element XML element
     * @param name Name of the list (child in `element`)
     * @param prefix Prefix to use for the list
     * @param list List with items
     * @param options Transformation options
     */
    private addList;
    /**
     * Adds a component list to the specified element
     * @param element XML element
     * @param name Name to use for the wrapper element
     * @param list List with component items
     * @private
     */
    private addComponentList;
}

export declare type XmlUiNode = XmlUiComment | XmlUiAttribute | XmlUiElement;

export declare interface XmlUiNodeBase {
    type: XmlUiNode["type"];
}

export declare type XmluiSerializationOptions = {
    prettify?: boolean;
    indents?: number;
    lineLength?: number;
    useQuotes?: boolean;
    useSpaceBeforeClose?: boolean;
    breakClosingTag?: boolean;
};

/**
 * Options to use with markup transformation from memory format to XMLUI structure
 */
export declare type XmlUiTransformOptions = {
    preserveLineBreaks?: boolean;
    preserveSpecialChars?: boolean;
    removeQuotes?: boolean;
    extractProps?: boolean;
    preferTextToValue?: boolean;
};

export { }


declare module "@tanstack/table-core" {
    interface TableMeta<TData extends RowData> {
        cellRenderer: (...args: any[]) => any;
    }
    interface ColumnMeta<TData extends RowData, TValue> {
        style?: CSSProperties;
        className?: string;
        starSizedWidth?: string;
        accessorKey?: string;
        pinTo?: string;
        cellRenderer?: (row: any, rowIdx: number, colIdx: number, value?: any) => ReactNode;
    }
}
