import { z } from 'zod';
import { type DesignBlockId, type DesignResolutionPolicy, type DesignSystemTemplateId, type PageDesignState, type SiteStyleId } from './types';
import { type SchemaVersionedJsonParseIssue } from './schemaVersionedJson';
import { type ThemeV2RuntimeStyleFieldName } from './rawStyleFields';
export { themeV2RuntimeStyleFieldNames, type ThemeV2RuntimeStyleFieldName, } from './rawStyleFields';
export declare const themeV2DesignStateSchemaVersion: 1;
export type ThemeV2RuntimeStyleFields = Partial<Record<ThemeV2RuntimeStyleFieldName, unknown>>;
export type NonEmptyRuntimeStyleFieldNames = readonly [
    ThemeV2RuntimeStyleFieldName,
    ...ThemeV2RuntimeStyleFieldName[]
];
export type ThemeV2StyleAuthority = Readonly<{
    kind: 'theme-v2';
    source: DesignResolutionPolicy;
    siteStyleId: SiteStyleId;
    templateId: DesignSystemTemplateId;
    templateVersion: number;
    resolverVersion: number;
}>;
export type LegacyRawStyleAuthority = Readonly<{
    kind: 'legacy-raw';
    reason: 'pre-theme-v2' | 'manual-runtime-fields';
}>;
export type AdvancedDetachedStyleAuthority = Readonly<{
    kind: 'advanced-detached';
    reason: 'detached-custom-runtime-fields';
}>;
export type StyleAuthority = ThemeV2StyleAuthority | LegacyRawStyleAuthority | AdvancedDetachedStyleAuthority;
export type BlockRuntimeStyleAuthority<TBlockId extends string = DesignBlockId> = Readonly<{
    unit: 'block-runtime-fields';
    blockId: TBlockId;
    fields: NonEmptyRuntimeStyleFieldNames;
    authority: StyleAuthority;
}>;
export type PersistedPageDesignStateV1<TBlockId extends string = DesignBlockId, TPurpose extends string = string> = Readonly<PageDesignState<TBlockId, TPurpose> & {
    schemaVersion: typeof themeV2DesignStateSchemaVersion;
    siteStyleId: SiteStyleId;
    templateId: DesignSystemTemplateId;
    templateVersion: number;
    resolverVersion: number;
    styleAuthorities: readonly BlockRuntimeStyleAuthority<TBlockId>[];
}>;
/**
 * Current persisted design state alias. When boundary overrides or full page
 * rhythm payloads land, add PersistedPageDesignStateV2 and widen this union.
 */
export type PersistedPageDesignState<TBlockId extends string = DesignBlockId, TPurpose extends string = string> = PersistedPageDesignStateV1<TBlockId, TPurpose>;
export type DesignStateParseIssue = SchemaVersionedJsonParseIssue;
export type DesignStateParseResult<TBlockId extends string = DesignBlockId, TPurpose extends string = string> = Readonly<{
    kind: 'absent';
}> | Readonly<{
    kind: 'parsed';
    state: PersistedPageDesignState<TBlockId, TPurpose>;
}> | Readonly<{
    kind: 'invalid';
    issue: DesignStateParseIssue;
}>;
export type RuntimeStyleClassification = Readonly<{
    kind: 'clean-auto';
    fields: readonly [];
}> | Readonly<{
    kind: 'interpretable-override';
    fields: readonly ThemeV2RuntimeStyleFieldName[];
    authority: ThemeV2StyleAuthority;
}> | Readonly<{
    kind: 'advanced-detached';
    fields: readonly ThemeV2RuntimeStyleFieldName[];
    authority: AdvancedDetachedStyleAuthority;
}> | Readonly<{
    kind: 'unsupported-manual-review';
    fields: readonly ThemeV2RuntimeStyleFieldName[];
    authority?: LegacyRawStyleAuthority;
}>;
export type RuntimeStyleWriteResult<TContent extends Record<string, unknown>> = RuntimeStyleWriteResultForFields<TContent, ThemeV2RuntimeStyleFields>;
export type RuntimeStyleWriteResultForFields<TContent extends Record<string, unknown>, TFields extends ThemeV2RuntimeStyleFields> = Readonly<{
    kind: 'applied';
    content: Omit<TContent, ThemeV2RuntimeStyleFieldName> & TFields;
}> | Readonly<{
    kind: 'blocked';
    reason: 'missing-theme-v2-authority' | 'advanced-detached' | 'legacy-raw';
    content: TContent;
}>;
export type PageStyleAuthoritySummary<TBlockId extends string = DesignBlockId> = Readonly<{
    kind: 'no-runtime-authority';
    themeV2BlockIds: readonly [];
    legacyRawBlockIds: readonly [];
    advancedDetachedBlockIds: readonly [];
}> | Readonly<{
    kind: 'theme-v2-only';
    themeV2BlockIds: readonly TBlockId[];
    legacyRawBlockIds: readonly [];
    advancedDetachedBlockIds: readonly [];
}> | Readonly<{
    kind: 'advanced-detached-only';
    themeV2BlockIds: readonly [];
    legacyRawBlockIds: readonly [];
    advancedDetachedBlockIds: readonly TBlockId[];
}> | Readonly<{
    kind: 'manual-review-required';
    themeV2BlockIds: readonly TBlockId[];
    legacyRawBlockIds: readonly TBlockId[];
    advancedDetachedBlockIds: readonly TBlockId[];
}> | Readonly<{
    kind: 'mixed-authority';
    themeV2BlockIds: readonly TBlockId[];
    legacyRawBlockIds: readonly [];
    advancedDetachedBlockIds: readonly TBlockId[];
}>;
export declare const blockDesignPlanSchema: z.ZodObject<{
    blockId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignBlockId, string>>;
    blockKind: z.ZodString;
    purpose: z.ZodString;
    sectionSurface: z.ZodEnum<{
        base: "base";
        "muted-band": "muted-band";
        "accent-band": "accent-band";
        "hero-image": "hero-image";
    }>;
    contentFrame: z.ZodDiscriminatedUnion<[z.ZodObject<{
        kind: z.ZodLiteral<"plain">;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"panel">;
        treatment: z.ZodEnum<{
            editorial: "editorial";
            raised: "raised";
            inset: "inset";
        }>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"flush-panel">;
        treatment: z.ZodEnum<{
            "media-panel": "media-panel";
        }>;
        bleed: z.ZodEnum<{
            both: "both";
            start: "start";
            end: "end";
        }>;
    }, z.core.$strict>], "kind">;
    itemSurface: z.ZodEnum<{
        flat: "flat";
        default: "default";
        none: "none";
        editorial: "editorial";
        raised: "raised";
        outlined: "outlined";
        inset: "inset";
    }>;
    transitionAfter: z.ZodEnum<{
        none: "none";
        "soft-fade-short": "soft-fade-short";
        "soft-fade-long": "soft-fade-long";
        "wave-edge": "wave-edge";
        "angle-edge": "angle-edge";
    }>;
    emphasis: z.ZodEnum<{
        low: "low";
        high: "high";
        medium: "medium";
    }>;
    sectionHeight: z.ZodOptional<z.ZodEnum<{
        default: "default";
        hero: "hero";
        banner: "banner";
        immersive: "immersive";
    }>>;
    heroLegibility: z.ZodOptional<z.ZodEnum<{
        none: "none";
        "scrim-gradient": "scrim-gradient";
        "solid-panel": "solid-panel";
    }>>;
    imageSurfaceTreatment: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
        kind: z.ZodLiteral<"none">;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"brand-scrim">;
        token: z.ZodEnum<{
            primary: "primary";
            secondary: "secondary";
            accent: "accent";
        }>;
        intensity: z.ZodOptional<z.ZodEnum<{
            balanced: "balanced";
            soft: "soft";
            strong: "strong";
        }>>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"brand-wash">;
        token: z.ZodEnum<{
            primary: "primary";
            secondary: "secondary";
            accent: "accent";
        }>;
        intensity: z.ZodOptional<z.ZodEnum<{
            balanced: "balanced";
            soft: "soft";
            strong: "strong";
        }>>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"neutral-scrim">;
        intensity: z.ZodOptional<z.ZodEnum<{
            balanced: "balanced";
            soft: "soft";
            strong: "strong";
        }>>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"neutral-wash">;
        intensity: z.ZodOptional<z.ZodEnum<{
            balanced: "balanced";
            soft: "soft";
            strong: "strong";
        }>>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"solid-panel">;
        intensity: z.ZodOptional<z.ZodEnum<{
            balanced: "balanced";
            soft: "soft";
            strong: "strong";
        }>>;
    }, z.core.$strict>], "kind">>;
    imageSurfaceMotion: z.ZodOptional<z.ZodEnum<{
        static: "static";
        "fixed-frame": "fixed-frame";
    }>>;
    testimonialCardTreatment: z.ZodOptional<z.ZodEnum<{
        default: "default";
        "accent-quote": "accent-quote";
    }>>;
    eyebrowTreatment: z.ZodOptional<z.ZodEnum<{
        pill: "pill";
        plain: "plain";
        "accent-pill": "accent-pill";
        "pill-bounce": "pill-bounce";
        "accent-pill-bounce": "accent-pill-bounce";
    }>>;
}, z.core.$strict>;
export declare const styleAuthoritySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    kind: z.ZodLiteral<"theme-v2">;
    source: z.ZodEnum<{
        user: "user";
        admin: "admin";
        sdk: "sdk";
        generated: "generated";
    }>;
    siteStyleId: z.ZodPipe<z.ZodString, z.ZodTransform<SiteStyleId, string>>;
    templateId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignSystemTemplateId, string>>;
    templateVersion: z.ZodNumber;
    resolverVersion: z.ZodNumber;
}, z.core.$strict>, z.ZodObject<{
    kind: z.ZodLiteral<"legacy-raw">;
    reason: z.ZodEnum<{
        "pre-theme-v2": "pre-theme-v2";
        "manual-runtime-fields": "manual-runtime-fields";
    }>;
}, z.core.$strict>, z.ZodObject<{
    kind: z.ZodLiteral<"advanced-detached">;
    reason: z.ZodLiteral<"detached-custom-runtime-fields">;
}, z.core.$strict>], "kind">;
export declare const blockRuntimeStyleAuthoritySchema: z.ZodObject<{
    unit: z.ZodLiteral<"block-runtime-fields">;
    blockId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignBlockId, string>>;
    fields: z.ZodPipe<z.ZodArray<z.ZodEnum<{
        styleGroup: "styleGroup";
        _sectionStyles: "_sectionStyles";
        _containerStyles: "_containerStyles";
        _frameStyles: "_frameStyles";
        _cardStyles: "_cardStyles";
    }>>, z.ZodTransform<NonEmptyRuntimeStyleFieldNames, ("styleGroup" | "_sectionStyles" | "_containerStyles" | "_frameStyles" | "_cardStyles")[]>>;
    authority: z.ZodDiscriminatedUnion<[z.ZodObject<{
        kind: z.ZodLiteral<"theme-v2">;
        source: z.ZodEnum<{
            user: "user";
            admin: "admin";
            sdk: "sdk";
            generated: "generated";
        }>;
        siteStyleId: z.ZodPipe<z.ZodString, z.ZodTransform<SiteStyleId, string>>;
        templateId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignSystemTemplateId, string>>;
        templateVersion: z.ZodNumber;
        resolverVersion: z.ZodNumber;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"legacy-raw">;
        reason: z.ZodEnum<{
            "pre-theme-v2": "pre-theme-v2";
            "manual-runtime-fields": "manual-runtime-fields";
        }>;
    }, z.core.$strict>, z.ZodObject<{
        kind: z.ZodLiteral<"advanced-detached">;
        reason: z.ZodLiteral<"detached-custom-runtime-fields">;
    }, z.core.$strict>], "kind">;
}, z.core.$strict>;
export declare const persistedPageDesignStateV1Schema: z.ZodObject<{
    schemaVersion: z.ZodLiteral<1>;
    siteStyleId: z.ZodPipe<z.ZodString, z.ZodTransform<SiteStyleId, string>>;
    templateId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignSystemTemplateId, string>>;
    templateVersion: z.ZodNumber;
    resolverVersion: z.ZodNumber;
    rhythmPresetId: z.ZodString;
    blocks: z.ZodArray<z.ZodObject<{
        blockId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignBlockId, string>>;
        blockKind: z.ZodString;
        purpose: z.ZodString;
        sectionSurface: z.ZodEnum<{
            base: "base";
            "muted-band": "muted-band";
            "accent-band": "accent-band";
            "hero-image": "hero-image";
        }>;
        contentFrame: z.ZodDiscriminatedUnion<[z.ZodObject<{
            kind: z.ZodLiteral<"plain">;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"panel">;
            treatment: z.ZodEnum<{
                editorial: "editorial";
                raised: "raised";
                inset: "inset";
            }>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"flush-panel">;
            treatment: z.ZodEnum<{
                "media-panel": "media-panel";
            }>;
            bleed: z.ZodEnum<{
                both: "both";
                start: "start";
                end: "end";
            }>;
        }, z.core.$strict>], "kind">;
        itemSurface: z.ZodEnum<{
            flat: "flat";
            default: "default";
            none: "none";
            editorial: "editorial";
            raised: "raised";
            outlined: "outlined";
            inset: "inset";
        }>;
        transitionAfter: z.ZodEnum<{
            none: "none";
            "soft-fade-short": "soft-fade-short";
            "soft-fade-long": "soft-fade-long";
            "wave-edge": "wave-edge";
            "angle-edge": "angle-edge";
        }>;
        emphasis: z.ZodEnum<{
            low: "low";
            high: "high";
            medium: "medium";
        }>;
        sectionHeight: z.ZodOptional<z.ZodEnum<{
            default: "default";
            hero: "hero";
            banner: "banner";
            immersive: "immersive";
        }>>;
        heroLegibility: z.ZodOptional<z.ZodEnum<{
            none: "none";
            "scrim-gradient": "scrim-gradient";
            "solid-panel": "solid-panel";
        }>>;
        imageSurfaceTreatment: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
            kind: z.ZodLiteral<"none">;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"brand-scrim">;
            token: z.ZodEnum<{
                primary: "primary";
                secondary: "secondary";
                accent: "accent";
            }>;
            intensity: z.ZodOptional<z.ZodEnum<{
                balanced: "balanced";
                soft: "soft";
                strong: "strong";
            }>>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"brand-wash">;
            token: z.ZodEnum<{
                primary: "primary";
                secondary: "secondary";
                accent: "accent";
            }>;
            intensity: z.ZodOptional<z.ZodEnum<{
                balanced: "balanced";
                soft: "soft";
                strong: "strong";
            }>>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"neutral-scrim">;
            intensity: z.ZodOptional<z.ZodEnum<{
                balanced: "balanced";
                soft: "soft";
                strong: "strong";
            }>>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"neutral-wash">;
            intensity: z.ZodOptional<z.ZodEnum<{
                balanced: "balanced";
                soft: "soft";
                strong: "strong";
            }>>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"solid-panel">;
            intensity: z.ZodOptional<z.ZodEnum<{
                balanced: "balanced";
                soft: "soft";
                strong: "strong";
            }>>;
        }, z.core.$strict>], "kind">>;
        imageSurfaceMotion: z.ZodOptional<z.ZodEnum<{
            static: "static";
            "fixed-frame": "fixed-frame";
        }>>;
        testimonialCardTreatment: z.ZodOptional<z.ZodEnum<{
            default: "default";
            "accent-quote": "accent-quote";
        }>>;
        eyebrowTreatment: z.ZodOptional<z.ZodEnum<{
            pill: "pill";
            plain: "plain";
            "accent-pill": "accent-pill";
            "pill-bounce": "pill-bounce";
            "accent-pill-bounce": "accent-pill-bounce";
        }>>;
    }, z.core.$strict>>;
    styleAuthorities: z.ZodArray<z.ZodObject<{
        unit: z.ZodLiteral<"block-runtime-fields">;
        blockId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignBlockId, string>>;
        fields: z.ZodPipe<z.ZodArray<z.ZodEnum<{
            styleGroup: "styleGroup";
            _sectionStyles: "_sectionStyles";
            _containerStyles: "_containerStyles";
            _frameStyles: "_frameStyles";
            _cardStyles: "_cardStyles";
        }>>, z.ZodTransform<NonEmptyRuntimeStyleFieldNames, ("styleGroup" | "_sectionStyles" | "_containerStyles" | "_frameStyles" | "_cardStyles")[]>>;
        authority: z.ZodDiscriminatedUnion<[z.ZodObject<{
            kind: z.ZodLiteral<"theme-v2">;
            source: z.ZodEnum<{
                user: "user";
                admin: "admin";
                sdk: "sdk";
                generated: "generated";
            }>;
            siteStyleId: z.ZodPipe<z.ZodString, z.ZodTransform<SiteStyleId, string>>;
            templateId: z.ZodPipe<z.ZodString, z.ZodTransform<DesignSystemTemplateId, string>>;
            templateVersion: z.ZodNumber;
            resolverVersion: z.ZodNumber;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"legacy-raw">;
            reason: z.ZodEnum<{
                "pre-theme-v2": "pre-theme-v2";
                "manual-runtime-fields": "manual-runtime-fields";
            }>;
        }, z.core.$strict>, z.ZodObject<{
            kind: z.ZodLiteral<"advanced-detached">;
            reason: z.ZodLiteral<"detached-custom-runtime-fields">;
        }, z.core.$strict>], "kind">;
    }, z.core.$strict>>;
}, z.core.$strict>;
export declare function parsePersistedPageDesignState(value: unknown): DesignStateParseResult;
export declare function collectRuntimeStyleFieldNames(content: Readonly<Record<string, unknown>>): readonly ThemeV2RuntimeStyleFieldName[];
export declare function classifyRuntimeStyleFields(input: Readonly<{
    content: Readonly<Record<string, unknown>>;
    authority?: StyleAuthority;
}>): RuntimeStyleClassification;
export declare function canWriteThemeV2RuntimeFields(authority: StyleAuthority | undefined): authority is ThemeV2StyleAuthority;
/**
 * Persisted Theme V2 output is compile-at-write: once a block has Theme V2
 * authority, compiler-owned runtime fields are replaced in the same content
 * version. Preview-only compile-at-read callers should use compileBlockRuntimeFields
 * and avoid persisting these fields.
 */
export declare function replaceCompiledRuntimeStyleFields<TContent extends Record<string, unknown>, TFields extends ThemeV2RuntimeStyleFields>(input: Readonly<{
    content: TContent;
    fields: TFields;
    authority?: StyleAuthority;
}>): RuntimeStyleWriteResultForFields<TContent, TFields>;
export declare function summarizePageStyleAuthorities<TBlockId extends string>(state: Pick<PersistedPageDesignState<TBlockId>, 'styleAuthorities'>): PageStyleAuthoritySummary<TBlockId>;
