import type { EventObject, MachineConfig, MachineContext } from "../types/index.js"; import type { MachineModel } from "./model.js"; import { type StateNodeLookup } from "./stateValue.js"; /** Names referenced by validated actions / guards / delays; a mutable `ModelReferences`. */ export interface ReferenceCollector { readonly actions: Set; readonly guards: Set; readonly delays: Set; } /** What `#id` resolution needs (`core/stateValue.ts`): the build context during normalization, or a finished model. */ export type NodeLookup = StateNodeLookup; /** * Validates one action value (shape only; names are checked lazily by the * engine) and records referenced names. Dispatch order matters: builtins are * functions, so `isBuiltin` (and the foreign-creator check) run before the * plain-function branch. */ export declare function validateAction(action: unknown, path: string, references: ReferenceCollector): void; /** * Validates one guard value (shape only) and records referenced names. * `ctx` enables `stateIn("#id")` resolution; pass `null` outside a machine * (implementation tables). */ export declare function validateGuard(ctx: NodeLookup | null, guard: unknown, path: string, references: ReferenceCollector): void; /** * Builds the model in two passes: (1) create every `StateNode` in document * order, assign ids, register them in `idMap`; (2) resolve transition targets * (`#id`, `#id.a.b`, `.child`, sibling keys), history default targets and the * `initial` transitions, synthesize `onDone` / `after` descriptors and the * `after` raise/cancel actions, collect `references`. * * Pure with respect to `config`: nothing is mutated or frozen here, so a * rejected config is handed back untouched. `createMachine` deep-freezes it * only after every validation passed; the model keeps references to the very * same objects, which therefore end up frozen too. */ export declare function normalize(config: MachineConfig): MachineModel; /** Mutable `references` collector, also used by the lazy implementation checks (`MachineDefinition`). */ export declare function createReferenceCollector(): ReferenceCollector;