import { MachineSnapshot } from "./State.js"; import type { StateNode } from "./StateNode.js"; import { ActionArgs, AnyEventObject, AnyMachineSnapshot, AnyStateNode, AnyTransitionDefinition, DelayedTransitionDefinition, EventObject, ExecutableActionObject, InitialTransitionConfig, InitialTransitionDefinition, MachineContext, StateValue, TransitionDefinition, TODO, UnknownAction, ParameterizedObject, AnyTransitionConfig, AnyActorScope } from "./types.js"; type StateNodeIterable = Iterable>; type AnyStateNodeIterable = StateNodeIterable; export declare function isAtomicStateNode(stateNode: StateNode): boolean; export declare function getProperAncestors(stateNode: AnyStateNode, toStateNode: AnyStateNode | undefined): Array; export declare function getAllStateNodes(stateNodes: Iterable): Set; export declare function getStateValue(rootNode: AnyStateNode, stateNodes: AnyStateNodeIterable): StateValue; export declare function isInFinalState(stateNodeSet: Set, stateNode: AnyStateNode): boolean; export declare const isStateId: (str: string) => boolean; export declare function getCandidates(stateNode: StateNode, receivedEventType: TEvent['type']): Array>; /** All delayed transitions from the config. */ export declare function getDelayedTransitions(stateNode: AnyStateNode): Array>; export declare function formatTransition(stateNode: AnyStateNode, descriptor: string, transitionConfig: AnyTransitionConfig): AnyTransitionDefinition; export declare function formatTransitions(stateNode: AnyStateNode): Map[]>; /** * Collects route transitions from all descendants with explicit IDs. Called * once on the root node to avoid O(N²) repeated traversals. */ export declare function formatRouteTransitions(rootStateNode: AnyStateNode): void; export declare function formatInitialTransition(stateNode: AnyStateNode, _target: string | undefined | InitialTransitionConfig): InitialTransitionDefinition; /** * Returns the relative state node from the given `statePath`, or throws. * * @param statePath The string or string array relative path to the state node. */ export declare function getStateNodeByPath(stateNode: AnyStateNode, statePath: string | string[]): AnyStateNode; /** * Returns the state nodes represented by the current state value. * * @param stateValue The state value or State instance */ export declare function getStateNodes(stateNode: AnyStateNode, stateValue: StateValue): Array; export declare function transitionNode(stateNode: AnyStateNode, stateValue: StateValue, snapshot: MachineSnapshot, event: TEvent): Array> | undefined; type Microstep = readonly [AnyMachineSnapshot, ExecutableActionObject[]]; export declare function initialMicrostep(root: AnyStateNode, preInitialState: AnyMachineSnapshot, actorScope: AnyActorScope, initEvent: AnyEventObject, internalQueue: AnyEventObject[]): Microstep; export interface BuiltinAction { (): void; type: `xstate.${string}`; resolve: (actorScope: AnyActorScope, snapshot: AnyMachineSnapshot, actionArgs: ActionArgs, actionParams: ParameterizedObject['params'] | undefined, action: unknown, extra: unknown) => [ newState: AnyMachineSnapshot, params: unknown, actions?: UnknownAction[] ]; retryResolve: (actorScope: AnyActorScope, snapshot: AnyMachineSnapshot, params: unknown) => void; execute: (actorScope: AnyActorScope, params: unknown) => void; } export declare function resolveActionsAndContext(currentSnapshot: AnyMachineSnapshot, event: AnyEventObject, actorScope: AnyActorScope, actions: UnknownAction[], internalQueue: AnyEventObject[], deferredActorIds: string[] | undefined): AnyMachineSnapshot; export declare function macrostep(snapshot: AnyMachineSnapshot, event: EventObject, actorScope: AnyActorScope, internalQueue: AnyEventObject[]): { snapshot: typeof snapshot; microsteps: Microstep[]; }; /** * Resolves a partial state value with its full representation in the state * node's machine. * * @param stateValue The partial state value to resolve. */ export declare function resolveStateValue(rootNode: AnyStateNode, stateValue: StateValue): StateValue; export {};