import { J as JsonValue, b as FormPolicy, c as FormSchema, A as AsyncTranslationAdapter, T as TranslationAdapter } from './analytics-CKp_MFX6.js'; export { normalizeLocale } from './locale.js'; import './lifecycle.js'; import './i18n/keys.js'; interface TranslationProviderError { readonly code: "RATE_LIMIT" | "AUTH_FAILED" | "UNSUPPORTED_LANGUAGE" | "NETWORK_ERROR" | "UNKNOWN"; readonly message: string; readonly retryable: boolean; readonly rawError?: unknown; } interface TranslationSlot { readonly kind: "form" | "page" | "field" | "option"; readonly nodeId: string; readonly property: "title" | "description" | "label" | "completionMessage" | "closedMessage" | "notYetOpenMessage"; readonly locale: string; readonly sourceText: string; readonly existingText?: string; readonly nodeMetadata?: Readonly>; readonly existingTranslationMetadata?: Readonly>; /** Canonical target information for workspace clients. */ readonly target?: { readonly kind: "form" | "page" | "field" | "option"; readonly id?: string; readonly property: "title" | "description" | "label" | "completionMessage" | "closedMessage" | "notYetOpenMessage"; }; readonly path?: string; readonly sourceTextHash?: string; readonly status?: TranslationStatus; /** @deprecated Use nodeMetadata instead. */ readonly metadata?: Readonly>; } type TranslationStatus = "missing" | "translated" | "stale" | "manual" | "manual-stale"; interface CanonicalTranslationMetadata { readonly sourceLocale: string; readonly sourceTextHash: string; readonly translationSource: "automatic" | "manual"; readonly translatedAt?: string; readonly editedAt?: string; } interface LegacyTranslationMetadata { readonly isManuallyEdited?: boolean; readonly translationSource?: "MANUAL" | "AUTOMATIC" | "manual" | "automatic" | string; readonly sourceTextHash?: string; readonly sourceText?: string; readonly sourceLocale?: string; readonly translatedAt?: string; readonly editedAt?: string; readonly isManual?: boolean; readonly [key: string]: unknown; } interface TranslationMigrationContext { /** Target locale code, for example "en" or "zh-Hans". */ readonly locale: string; /** The schema's default locale. */ readonly defaultLocale: string; /** JSON path of the translated property. */ readonly path: string; /** Translated property name. */ readonly property: "title" | "description" | "label" | "completionMessage" | "closedMessage" | "notYetOpenMessage"; /** Kind of node that owns the translated property. */ readonly nodeKind: "form" | "page" | "field" | "option"; /** Identifier of the owning node. */ readonly nodeId?: string; /** Identifier of the parent node, used for options. */ readonly parentId?: string; } type TranslationMetadataMigrator = (oldMeta: unknown, sourceText: string, context: TranslationMigrationContext) => CanonicalTranslationMetadata; interface MigrateSchemaTranslationMetadataOptions { /** Custom migration function used instead of the built-in legacy normalizer. */ readonly migrator?: TranslationMetadataMigrator; } declare const isManualTranslationMetadata: (metadata?: LegacyTranslationMetadata | CanonicalTranslationMetadata) => boolean; interface PopulateTranslationOptions { readonly overwrite?: "all" | "missing-only" | "stale-and-missing"; readonly preserveManualTranslations?: boolean; readonly markStaleTranslations?: boolean; readonly shouldOverwrite?: (slot: TranslationSlot) => boolean; readonly createMetadata?: (slot: TranslationSlot, translatedText: string) => Readonly>; readonly isManualTranslation?: (metadata: unknown, context: { readonly path: string; readonly locale: string; }) => boolean; readonly normalizeMetadata?: (metadata: unknown, sourceText: string) => CanonicalTranslationMetadata; /** Applies locale admission and count limits before the adapter is called. */ readonly policy?: Pick; /** Aborts an in-flight translation operation when requested. */ readonly signal?: AbortSignal; /** Reports progress for the slots selected for translation. */ readonly onProgress?: (progress: TranslationProgress) => void; /** Keeps successful slots when individual translation calls fail. */ readonly continueOnError?: boolean; } /** Compatibility alias for clients that used the pluralized options name. */ type PopulateTranslationsOptions = PopulateTranslationOptions; interface TranslationReport { readonly updatedSlots: readonly TranslationSlot[]; readonly skippedSlots: readonly TranslationSlot[]; readonly staleSlots?: readonly TranslationSlot[]; readonly skippedReasons?: Readonly>; readonly totalSlots?: number; readonly attemptedSlots?: number; readonly succeeded?: number; readonly failed?: number; readonly cancelled?: boolean; readonly failures?: readonly TranslationFailure[]; } interface TranslationProgress { readonly total: number; readonly completed: number; readonly succeeded: number; readonly failed: number; readonly percentage: number; } interface TranslationFailure { readonly slot: TranslationSlot; readonly cause: unknown; } declare const computeSourceTextHash: (text: string) => string; declare function getTranslationStatus(sourceText: string, translatedText: string | undefined, metadata: CanonicalTranslationMetadata | Readonly> | undefined): TranslationStatus; /** Normalizes canonical and legacy translation metadata for application-owned text codecs. */ declare function normalizeTranslationMetadata(metadata: unknown, sourceText: string, defaultLocale?: string): CanonicalTranslationMetadata; declare const migrateSchemaTranslationMetadata: (schema: FormSchema, migratorOrOptions?: ((oldMeta: unknown, sourceText: string) => CanonicalTranslationMetadata) | TranslationMetadataMigrator | MigrateSchemaTranslationMetadataOptions) => FormSchema; /** Removes a locale registration and every localized value and metadata entry for it. */ declare const removeLocaleFromSchema: (schema: FormSchema, localeToRemove: string) => FormSchema; declare function collectTranslationSlots(schema: FormSchema, locale: string): readonly TranslationSlot[]; declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema; declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{ readonly schema: FormSchema; readonly report: TranslationReport; }>; declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: TranslationAdapter, options?: PopulateTranslationOptions): Promise<{ readonly schema: FormSchema; readonly report: TranslationReport; }>; declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise; export { type CanonicalTranslationMetadata, type LegacyTranslationMetadata, type MigrateSchemaTranslationMetadataOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type TranslationFailure, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationProgress, type TranslationProviderError, type TranslationReport, type TranslationSlot, type TranslationStatus, collectTranslationSlots, computeSourceTextHash, getTranslationStatus, isManualTranslationMetadata, migrateSchemaTranslationMetadata, normalizeTranslationMetadata, populateSchemaTranslations, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema };