/**
 * Pure state module for the Style configurator. Per-action function style so
 * the picker rows, apply flow, and concurrency layer can call into a small,
 * exhaustive set of named transitions instead of a centralised reducer
 * switch.
 *
 * The configurator surfaces three site-level decisions (site style, button
 * personality, palette variant) plus optional sparse palette overrides. The
 * "base" snapshot is what the server has persisted; "previewed" is what the
 * preview pane is currently rendering. They diverge while the user is
 * picking and converge on apply-success.
 */
import type { ButtonPersonalityId } from '@riverbankcms/theme-core/buttons';
import type { PaletteOverrides, PaletteVariantId } from '@riverbankcms/theme-core/palette';
import type { SelectionFallbackWarning, SiteStyleId } from '@riverbankcms/theme-core/site-styles/previewCompiler';
export type StyleConfiguratorSaveStatus = Readonly<{
    kind: 'idle';
}> | Readonly<{
    kind: 'saving';
}> | Readonly<{
    kind: 'saved';
}> | Readonly<{
    kind: 'failed';
    message: string;
}>;
export type StyleConfiguratorExpandedRow = 'style' | 'buttons' | 'palette' | 'colours' | null;
/**
 * Configurator-level notices that aren't compiler selection fallback warnings.
 * Kept separate from `SelectionFallbackWarning` (which comes from
 * `compileSiteThemeFromSelections`) so the layers stay clean: warnings are
 * compiler-emitted, notices are UI-level decisions the configurator makes.
 */
export type StyleConfiguratorNotice = Readonly<{
    kind: 'palette-overrides-hidden';
}> | Readonly<{
    kind: 'palette-overrides-restored';
}>;
export type SelectionSnapshot = Readonly<{
    siteStyleId: SiteStyleId;
    buttonPersonalityId: ButtonPersonalityId;
    paletteVariantId: PaletteVariantId;
    paletteOverrides: PaletteOverrides | null;
}>;
type PaletteOverrideDrafts = Readonly<Partial<Record<PaletteVariantId, PaletteOverrides>>>;
export type StyleConfiguratorState = Readonly<{
    /**
     * Last persisted server snapshot. Updated on apply-success (and on
     * external rebases via `syncStyleConfiguratorState`).
     */
    base: SelectionSnapshot;
    /**
     * Currently rendered selection. Diverges from `base` while the user is
     * previewing changes. Identical to `base` after apply-success.
     */
    previewed: SelectionSnapshot;
    saveStatus: StyleConfiguratorSaveStatus;
    warnings: ReadonlyArray<SelectionFallbackWarning>;
    notices: ReadonlyArray<StyleConfiguratorNotice>;
    paletteOverrideDrafts: PaletteOverrideDrafts;
    expandedRow: StyleConfiguratorExpandedRow;
}>;
export declare function createStyleConfiguratorState(base: SelectionSnapshot): StyleConfiguratorState;
/**
 * True iff the user has previewed a change that hasn't been applied yet.
 * Drives the "Apply" / "Cancel" footer visibility and the live-preview
 * `setOverrideTheme` call.
 */
export declare function isPreviewingChange(state: StyleConfiguratorState): boolean;
export declare function previewSiteStyle(state: StyleConfiguratorState, siteStyleId: SiteStyleId): StyleConfiguratorState;
export declare function previewButtonPersonality(state: StyleConfiguratorState, buttonPersonalityId: ButtonPersonalityId): StyleConfiguratorState;
export declare function previewPaletteVariant(state: StyleConfiguratorState, paletteVariantId: PaletteVariantId): StyleConfiguratorState;
export declare function setPaletteOverrides(state: StyleConfiguratorState, paletteOverrides: PaletteOverrides | null): StyleConfiguratorState;
/**
 * Records the post-compile resolved selection + any fallback warnings.
 * Used after `compileSiteThemeFromSelections` runs against a new site style:
 * the resolver may have auto-picked a different personality / palette if the
 * user's previous selections are not offered for the new style.
 *
 * Palette overrides are scoped by palette variant. If the resolver moves the
 * preview to a different palette, the current sparse overrides are stashed
 * under the previous palette ID and any draft for the new palette is restored.
 */
export declare function applyResolvedSelections(state: StyleConfiguratorState, input: Readonly<{
    resolved: Pick<SelectionSnapshot, 'buttonPersonalityId' | 'paletteVariantId'>;
    warnings: ReadonlyArray<SelectionFallbackWarning>;
}>): StyleConfiguratorState;
export declare function cancelPreview(state: StyleConfiguratorState): StyleConfiguratorState;
export declare function markApplySaving(state: StyleConfiguratorState): StyleConfiguratorState;
export declare function markApplySaved(state: StyleConfiguratorState, persisted: SelectionSnapshot): StyleConfiguratorState;
export declare function markApplyFailed(state: StyleConfiguratorState, message: string): StyleConfiguratorState;
export declare function toggleRow(state: StyleConfiguratorState, row: StyleConfiguratorExpandedRow): StyleConfiguratorState;
export declare function dismissWarnings(state: StyleConfiguratorState): StyleConfiguratorState;
export declare function dismissNotices(state: StyleConfiguratorState): StyleConfiguratorState;
/**
 * Reconciles local state with a fresh server snapshot — used after
 * `router.refresh()` lands new theme data, or when an external write
 * changes the persisted selection out-of-band.
 */
export declare function syncStyleConfiguratorState(state: StyleConfiguratorState, base: SelectionSnapshot): StyleConfiguratorState;
export declare function paletteOverridesEqual(a: PaletteOverrides | null, b: PaletteOverrides | null): boolean;
export {};
