import * as z from "zod/mini"; import { colorSchemeConfigInputSchema, configureOptionsSchema, DEFAULT_COLOR_SCHEME_CONFIG, initOptionsSchema, } from "../widget-config.js"; /** * Core-only registration used by deployment-owned bundled documentation. * * This is deliberately not part of the public widget init contract. Keeping * the registration profile strict and credential-free prevents a local docs * instance from being mistaken for an API-key-backed widget instance. */ export const suppliedOnlyLocalRegistrationSchema = z.strictObject({ kind: z.literal("supplied-only-local"), profile: z.literal("bundled-docs"), }); /** @internal Core init options; not accepted by the public SDK init parser. */ export const suppliedOnlyLocalInitOptionsSchema = z.strictObject({ registration: suppliedOnlyLocalRegistrationSchema, colorScheme: z._default( z.optional(colorSchemeConfigInputSchema), DEFAULT_COLOR_SCHEME_CONFIG, ), }); /** * Core-only persisted registration carrying the host's current mutable runtime * configuration. This lets a replacement Core initialize from one coherent * snapshot without widening the public SDK init contract. */ export const persistedRuntimeInitOptionsSchema = z.extend(initOptionsSchema, { runtimeConfiguration: configureOptionsSchema, }); /** @internal Core accepts public persisted init or the local docs profile. */ export const coreInitOptionsSchema = z.union([ initOptionsSchema, persistedRuntimeInitOptionsSchema, suppliedOnlyLocalInitOptionsSchema, ]); export type SuppliedOnlyLocalRegistration = z.output< typeof suppliedOnlyLocalRegistrationSchema >; export type SuppliedOnlyLocalInitOptions = z.output< typeof suppliedOnlyLocalInitOptionsSchema >; export type PersistedRuntimeInitOptions = z.output< typeof persistedRuntimeInitOptionsSchema >; export type CoreInitOptions = z.output;