/**
 * JoinReducer — thin core of the current WARP reducer.
 *
 * After the M14/JoinReducer-split refactor, the only logic remaining
 * in this file is the per-path dispatcher (applyFast / applyWithDiff /
 * applyWithReceipt), the reducePatches driver, and thin wrappers for
 * backward-compatible factory/clone/join helpers.
 *
 * Everything else lives in its own module:
 *
 *   - Op class hierarchy    → src/domain/types/ops/
 *   - OpOutcomeResult family → src/domain/types/ops/
 *   - OpValidator            → ./OpValidator.ts
 *   - DiffCalculator         → ./DiffCalculator.ts
 *   - ReceiptBuilder         → ./ReceiptBuilder.ts
 *   - OpStrategy base / registry → ./OpStrategy.ts + ./OpStrategies.ts
 *   - WarpState class      → ./state/WarpState.ts (state factory
 *     concerns live as methods on the class)
 *
 * @module domain/services/JoinReducer
 */
import { EventId } from '../utils/EventId.ts';
import { type TickReceipt } from '../types/TickReceipt.ts';
import { PatchDiff } from '../types/PatchDiff.ts';
import WarpState from './state/WarpState.ts';
import type { OpLike } from './OpLike.ts';
export { default as WarpState } from './state/WarpState.ts';
export { default as OpOutcomeResult } from '../types/ops/OpOutcomeResult.ts';
export { default as OpApplied } from '../types/ops/OpApplied.ts';
export { default as OpSuperseded } from '../types/ops/OpSuperseded.ts';
export { default as OpRedundant } from '../types/ops/OpRedundant.ts';
export { OP_STRATEGIES } from './OpStrategies.ts';
export type { OpLike } from './OpLike.ts';
export { encodeEdgeKey, decodeEdgeKey, encodePropKey, EDGE_PROP_PREFIX, encodeEdgePropKey, isEdgePropKey, } from './KeyCodec.ts';
export { normalizeRawOp, lowerCanonicalOp } from './OpNormalizer.ts';
/** @deprecated Use OpValidator.RAW_KNOWN_OPS */
export declare const RAW_KNOWN_OPS: ReadonlySet<string>;
/** @deprecated Use OpValidator.CANONICAL_KNOWN_OPS */
export declare const CANONICAL_KNOWN_OPS: ReadonlySet<string>;
/** @deprecated Use OpValidator.isKnownRaw */
export declare function isKnownRawOp(op: unknown): boolean;
/** @deprecated Use OpValidator.isKnownCanonical */
export declare function isKnownCanonicalOp(op: unknown): boolean;
/** Minimal patch shape the reducer reads. */
export type PatchLike = {
    readonly writer: string;
    readonly lamport: number;
    readonly ops: readonly OpLike[];
    readonly context: WarpState['observedFrontier'] | Map<string, number> | Record<string, number> | null | undefined;
};
/**
 * Creates an empty state. Thin wrapper around `WarpState.empty()`.
 * @deprecated Call `WarpState.empty()` directly.
 */
export declare function createEmptyState(): WarpState;
/**
 * Returns a deep clone of a state. Accepts either a real
 * `WarpState` instance or a plain/deserialized snapshot (from a
 * checkpoint decode).
 * @deprecated Call `WarpState.cloneFromSnapshot(state)` directly.
 */
export declare function cloneState(state: Parameters<typeof WarpState.cloneFromSnapshot>[0]): WarpState;
/**
 * CRDT join of two states. Thin wrapper around `a.join(b)`.
 * @deprecated Call `a.join(b)` directly.
 */
export declare function joinStates(a: WarpState, b: WarpState): WarpState;
/**
 * Applies a single patch operation to the given state. Mutates `state`
 * in place. Unknown op types fail closed instead of becoming silent
 * data loss.
 */
export declare function applyPatchOp(state: WarpState, op: OpLike, eventId: EventId): void;
/** Applies a patch to state without receipt or diff collection. */
export declare function applyFast(state: WarpState, patch: PatchLike, patchSha: string): WarpState;
/**
 * Applies a patch with diff tracking for incremental index updates.
 * Only emits diff entries when alive-ness actually changes.
 */
export declare function applyWithDiff(state: WarpState, patch: PatchLike, // nosemgrep: ts-no-like-types -- 0025C
patchSha: string): {
    state: WarpState;
    diff: PatchDiff;
};
/**
 * Applies a patch with receipt collection for provenance tracking.
 * Returns a TickReceipt describing the outcome of every op in the
 * patch.
 */
export declare function applyWithReceipt(state: WarpState, patch: PatchLike, // nosemgrep: ts-no-like-types -- 0025C
patchSha: string): {
    state: WarpState;
    receipt: TickReceipt;
};
/**
 * Applies a patch and optionally collects a TickReceipt. Dispatches
 * to `applyWithReceipt` when `collectReceipts` is true, otherwise
 * `applyFast`.
 */
export declare function join(state: WarpState, patch: PatchLike, // nosemgrep: ts-no-like-types -- 0025C
patchSha: string, collectReceipts?: boolean): WarpState | {
    state: WarpState;
    receipt: TickReceipt;
};
/**
 * Reduces a sequence of patches into the current state. Supports three modes:
 *
 *   - default       → returns the mutated state
 *   - `receipts`    → returns `{ state, receipts }` for provenance tracking
 *   - `trackDiff`   → returns `{ state, diff }` for incremental index updates
 */
export declare function reducePatches(patches: ReadonlyArray<{
    readonly patch: PatchLike;
    readonly sha: string;
}>, // nosemgrep: ts-no-like-types -- 0025C
initialState?: WarpState, options?: undefined): WarpState;
export declare function reducePatches(patches: ReadonlyArray<{
    readonly patch: PatchLike;
    readonly sha: string;
}>, // nosemgrep: ts-no-like-types -- 0025C
initialState: WarpState | undefined, options: {
    readonly receipts: false;
    readonly trackDiff?: false;
}): WarpState;
export declare function reducePatches(patches: ReadonlyArray<{
    readonly patch: PatchLike;
    readonly sha: string;
}>, // nosemgrep: ts-no-like-types -- 0025C
initialState: WarpState | undefined, options: {
    readonly receipts: true;
    readonly trackDiff?: boolean;
}): {
    state: WarpState;
    receipts: TickReceipt[];
};
export declare function reducePatches(patches: ReadonlyArray<{
    readonly patch: PatchLike;
    readonly sha: string;
}>, // nosemgrep: ts-no-like-types -- 0025C
initialState: WarpState | undefined, options: {
    readonly receipts?: false;
    readonly trackDiff: true;
}): {
    state: WarpState;
    diff: PatchDiff;
};
export declare function reducePatches(patches: ReadonlyArray<{
    readonly patch: PatchLike;
    readonly sha: string;
}>, // nosemgrep: ts-no-like-types -- 0025C
initialState: WarpState | undefined, options: {
    readonly receipts?: boolean;
    readonly trackDiff?: boolean;
}): WarpState | {
    state: WarpState;
    receipts: TickReceipt[];
} | {
    state: WarpState;
    diff: PatchDiff;
};
