{"version":3,"file":"StyleManager-CIpd6wbO.cjs","names":["hasPreset","getSmartPreset","getAvailablePresets","THEME_PRESETS","themeRecord"],"sources":["../../src/styles/StyleManager.ts"],"sourcesContent":["/**\n * @fileoverview StyleManager — style preset and display settings management.\n * Encapsulates active preset tracking, display toggles, and the\n * module-level LEVEL_STYLES variable.\n *\n * Wired into Logger.ts in F4. Logger delegates style queries and theme\n * changes through this bridge so that the module-level LEVEL_STYLES stay\n * in sync across the module.\n */\n\nimport {\n    THEME_PRESETS,\n    type StylePresets,\n    type StyleBuilder\n} from '../styling/index.js';\nimport { getSmartPreset, getAvailablePresets, hasPreset } from '../styling/SmartPresets.js';\nimport type { ThemeVariant, LogStyles } from '../types/index.js';\n\n// Re-export StyleBuilder for internal use by Logger\nexport { StyleBuilder } from '../styling/index.js';\n\n/**\n * Display visibility settings.\n */\nexport interface DisplaySettings {\n    showTimestamp: boolean;\n    showLocation: boolean;\n    showBadges: boolean;\n}\n\n/**\n * Active preset state tracked by StyleManager.\n */\nexport interface PresetState {\n    /** The resolved style config (LEVEL_STYLES). */\n    styles: typeof THEME_PRESETS.default;\n    /** The active smart-preset config (if any). */\n    activePreset: unknown;\n    /** Name of the active smart-preset (if any). */\n    activePresetName: string | undefined;\n    /** Last-applied customize() overrides. */\n    customization: unknown;\n    /** Display visibility settings. */\n    displaySettings: DisplaySettings;\n}\n\n/**\n * Options for creating StyleManager.\n */\nexport interface IStyleManagerOptions {\n    /** Initial display settings. */\n    initialDisplaySettings?: Partial<DisplaySettings>;\n}\n\n/**\n * StyleManager - manages style presets and display settings.\n */\nexport interface StyleManager {\n    /** Returns current display settings. */\n    getDisplaySettings(): DisplaySettings;\n    /** Applies a smart preset by name. Returns true if applied. */\n    applyPreset(name: string): boolean;\n    /** Lists all available presets. */\n    getAvailablePresets(): string[];\n    /** Gets the current LEVEL_STYLES. */\n    getStyles(): typeof THEME_PRESETS.default;\n    /** Gets the active smart-preset config. */\n    getActivePreset(): unknown;\n    /** Gets the active smart-preset name. */\n    getActivePresetName(): string | undefined;\n    /** Gets the active customization overrides. */\n    getCustomization(): unknown;\n    /** Stores customization overrides. */\n    setCustomization(overrides: unknown): void;\n    /** Resolves the effective styles for a theme variant. */\n    resolveThemeStyle(theme: ThemeVariant): typeof THEME_PRESETS.default;\n    /** Sets the active theme by name, updating the module-level LEVEL_STYLES. */\n    setTheme(theme: ThemeVariant): boolean;\n    /** Resets LEVEL_STYLES to the default preset. */\n    resetStyles(): void;\n}\n\nfunction createDefaultDisplaySettings(): DisplaySettings {\n    return {\n        showTimestamp: true,\n        showLocation: true,\n        showBadges: true\n    };\n}\n\n/**\n * Creates a StyleManager instance.\n */\nexport function createStyleManager(options: IStyleManagerOptions = {}): StyleManager {\n    const displaySettings = createDefaultDisplaySettings();\n    let activePreset: unknown;\n    let activePresetName: string | undefined;\n    let customization: unknown;\n\n    return {\n        getDisplaySettings(): DisplaySettings {\n            return { ...displaySettings };\n        },\n\n        applyPreset(name: string): boolean {\n            if (!hasPreset(name)) {\n                return false;\n            }\n\n            const presetConfig = getSmartPreset(name);\n            if (presetConfig) {\n                displaySettings.showTimestamp = presetConfig.timestamp?.show ?? true;\n                displaySettings.showLocation = presetConfig.location?.show ?? true;\n                activePreset = presetConfig;\n                activePresetName = name;\n            }\n            return true;\n        },\n\n        getAvailablePresets(): string[] {\n            return getAvailablePresets();\n        },\n\n        getStyles(): typeof THEME_PRESETS.default {\n            return LEVEL_STYLES;\n        },\n\n        getActivePreset(): unknown {\n            return activePreset;\n        },\n\n        getActivePresetName(): string | undefined {\n            return activePresetName;\n        },\n\n        getCustomization(): unknown {\n            return customization;\n        },\n\n        setCustomization(overrides: unknown): void {\n            customization = overrides;\n        },\n\n        resolveThemeStyle(theme: ThemeVariant): typeof THEME_PRESETS.default {\n            if (theme in THEME_PRESETS) {\n                const themeRecord = THEME_PRESETS as unknown as Record<string, typeof LEVEL_STYLES>;\n                return themeRecord[theme] ?? THEME_PRESETS.default;\n            }\n            return THEME_PRESETS.default;\n        },\n\n        setTheme(theme: ThemeVariant): boolean {\n            if (theme in THEME_PRESETS) {\n                const themeRecord = THEME_PRESETS as unknown as Record<string, typeof LEVEL_STYLES>;\n                const newStyles = themeRecord[theme];\n                if (newStyles) {\n                    LEVEL_STYLES = newStyles;\n                    return true;\n                }\n            }\n            return false;\n        },\n\n        resetStyles(): void {\n            LEVEL_STYLES = THEME_PRESETS.default;\n        }\n    };\n}\n\n/**\n * Module-level active styles — shared across all Logger instances.\n * Exported so Logger can reference it directly.\n */\nexport let LEVEL_STYLES: typeof THEME_PRESETS.default = THEME_PRESETS.default;\n\n/**\n * Resets LEVEL_STYLES to default.\n */\nexport function resetStyles(): void {\n    LEVEL_STYLES = THEME_PRESETS.default;\n}\n"],"mappings":";;;;;;;;;;;AAkFA,SAAS,+BAAgD;CACrD,OAAO;EACH,eAAe;EACf,cAAc;EACd,YAAY;CAChB;AACJ;;;;AAKA,SAAgB,mBAAmB,UAAgC,CAAC,GAAiB;CACjF,MAAM,kBAAkB,6BAA6B;CACrD,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,OAAO;EACH,qBAAsC;GAClC,OAAO,EAAE,GAAG,gBAAgB;EAChC;EAEA,YAAY,MAAuB;GAC/B,IAAI,CAACA,gBAAAA,UAAU,IAAI,GACf,OAAO;GAGX,MAAM,eAAeC,gBAAAA,eAAe,IAAI;GACxC,IAAI,cAAc;IACd,gBAAgB,gBAAgB,aAAa,WAAW,QAAQ;IAChE,gBAAgB,eAAe,aAAa,UAAU,QAAQ;IAC9D,eAAe;IACf,mBAAmB;GACvB;GACA,OAAO;EACX;EAEA,sBAAgC;GAC5B,OAAOC,gBAAAA,oBAAoB;EAC/B;EAEA,YAA0C;GACtC,OAAO;EACX;EAEA,kBAA2B;GACvB,OAAO;EACX;EAEA,sBAA0C;GACtC,OAAO;EACX;EAEA,mBAA4B;GACxB,OAAO;EACX;EAEA,iBAAiB,WAA0B;GACvC,gBAAgB;EACpB;EAEA,kBAAkB,OAAmD;GACjE,IAAI,SAASC,gBAAAA,eAET,OAAOC,gBAAAA,cAAY,UAAUD,gBAAAA,cAAc;GAE/C,OAAOA,gBAAAA,cAAc;EACzB;EAEA,SAAS,OAA8B;GACnC,IAAI,SAASA,gBAAAA,eAAe;IAExB,MAAM,YAAYC,gBAAAA,cAAY;IAC9B,IAAI,WAAW;KACX,eAAe;KACf,OAAO;IACX;GACJ;GACA,OAAO;EACX;EAEA,cAAoB;GAChB,eAAeD,gBAAAA,cAAc;EACjC;CACJ;AACJ;;;;;AAMA,IAAW,eAA6CA,gBAAAA,cAAc"}