{"version":3,"file":"mn-angular-lib-core.mjs","sources":["../../../projects/mn-angular-lib/core/src/config/mn-config.types.ts","../../../projects/mn-angular-lib/core/src/language/mn-language.types.ts","../../../projects/mn-angular-lib/core/src/language/mn-language.service.ts","../../../projects/mn-angular-lib/core/src/language/mn-language.providers.ts","../../../projects/mn-angular-lib/core/src/language/mn-translate.pipe.ts","../../../projects/mn-angular-lib/core/src/config/mn-config.service.ts","../../../projects/mn-angular-lib/core/src/config/mn-config.providers.ts","../../../projects/mn-angular-lib/core/src/context/mn-context.tokens.ts","../../../projects/mn-angular-lib/core/src/config/mn-component-config.providers.ts","../../../projects/mn-angular-lib/core/src/context/mn-section.directive.ts","../../../projects/mn-angular-lib/core/src/context/mn-instance.directive.ts","../../../projects/mn-angular-lib/core/src/shared/crud/crud.tokens.ts","../../../projects/mn-angular-lib/core/src/shared/crud/crud.service.ts","../../../projects/mn-angular-lib/core/src/shared/http/mn-http.service.ts","../../../projects/mn-angular-lib/core/src/shared/icons/lucide-icons.ts","../../../projects/mn-angular-lib/core/src/preview/mn-preview-listener.ts","../../../projects/mn-angular-lib/core/public-api.ts","../../../projects/mn-angular-lib/core/mn-angular-lib-core.ts"],"sourcesContent":["/**\n * Types for mn-lib configuration.\n */\n\nexport type MnConfigSettings = {\n  /** Application or library version. */\n  version?: string;\n  /** Application or library name. */\n  name?: string;\n}\n\nexport type MnConfigFile = {\n  /**\n   * General settings such as version and name.\n   */\n  settings?: MnConfigSettings;\n  /**\n   * Base defaults by component name. Each value is a plain object with inputs/options for that component.\n   */\n  defaults: Record<string, unknown>;\n  /**\n   * Nested object tree keyed by section names. Leaf nodes may contain\n   * component-name keys (component override objects) and keys starting with '#'\n   * representing instance-id overrides.\n   */\n  overrides: Record<string, unknown>;\n}\n","/**\n * A marker object used in config values to indicate that the value\n * should be resolved via the MnLanguageService.\n *\n * Example in mn-config.json5:\n *   label: { $translate: \"form.email.label\" }\n */\nexport type MnTranslatable = {\n  $translate: string;\n  params?: Record<string, string | number>;\n}\n\n/**\n * A config value that is either a plain value or a translatable marker.\n */\nexport type MnConfigValue<T = string> = T | MnTranslatable;\n\n/**\n * Translations for a single locale, as a tree of keys.\n *\n * Both shapes resolve through the same dotted lookup: a bundle may nest\n * (`{ form: { email: { label } } }`), flatten (`{ \"form.email.label\": … }`), or mix the two.\n */\nexport type MnTranslationMap = { [key: string]: string | MnTranslationMap };\n\n/**\n * All loaded translations keyed by locale code (e.g. \"en\", \"nl\", \"de\").\n */\nexport type MnTranslations = Record<string, MnTranslationMap>;\n\n/**\n * Configuration for the language provider.\n */\nexport type MnLanguageConfig = {\n  /** URL pattern for loading translation files. Use `{locale}` as placeholder. e.g. \"assets/i18n/{locale}.json\" */\n  urlPattern: string;\n  /** The default/fallback locale. */\n  defaultLocale: string;\n  /** Locales to preload at bootstrap. */\n  preload?: string[];\n  /**\n   * Optional mapping of domain hostnames to locale codes.\n   * When set, the service will use the current domain to determine the initial locale.\n   * Example: { \"example.nl\": \"nl\", \"example.de\": \"de\", \"example.com\": \"en\" }\n   */\n  domainLocaleMap?: Record<string, string>;\n  /** Whether to enable debug logging. */\n  debug?: boolean;\n}\n\n/**\n * Type guard: checks whether a value is a translatable marker object.\n */\nexport function isTranslatable(value: unknown): value is MnTranslatable {\n  return (\n    typeof value === 'object' &&\n    value !== null &&\n    typeof (value as Record<string, unknown>)['$translate'] === 'string'\n  );\n}\n","import {ApplicationRef, inject, Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {BehaviorSubject, firstValueFrom, Observable} from 'rxjs';\nimport {MnTranslationMap, MnTranslations} from './mn-language.types';\n\n/**\n * Key suffix per CLDR plural category.\n *\n * Only `one` earns a suffix: every locale shipped so far (`en`, `nl`) has exactly the two\n * categories `one` and `other`, and `other` keeps the bare key. A locale with `few`/`many`\n * (Polish, Russian, Arabic) resolves those to the plural until an entry is added here —\n * adding one is the whole change, since the lookup is category-driven already.\n */\nconst PLURAL_SUFFIX: Partial<Record<Intl.LDMLPluralRule, string>> = {\n  one: 'One',\n};\n\n/** Params key whose presence turns a translation into a plural-aware lookup. */\nconst COUNT_PARAM = 'count';\n\n@Injectable({ providedIn: 'root' })\nexport class MnLanguageService {\n  private readonly http = inject(HttpClient);\n  private readonly appRef = inject(ApplicationRef);\n\n  private _translations: MnTranslations = {};\n  private _locale$ = new BehaviorSubject<string>('en');\n  private _urlPattern: string | null = null;\n  private _debug = false;\n\n  /**\n   * `Intl.PluralRules` per locale. Cached because {@link translate} runs on every change\n   * detection through the impure `mnTranslate` pipe, and constructing one is not cheap.\n   */\n  private readonly _pluralRules = new Map<string, Intl.PluralRules | null>();\n\n  /** Observable of the current active locale. */\n  readonly locale$: Observable<string> = this._locale$.asObservable();\n\n  /** Current active locale. */\n  get locale(): string {\n    return this._locale$.value;\n  }\n\n  /**\n   * Enable or disable debug logging.\n   */\n  setDebug(enabled: boolean): void {\n    this._debug = enabled;\n    if (enabled) {\n      console.log(`[MnLanguage] Debug mode enabled`);\n    }\n  }\n\n  /**\n   * Configure the URL pattern used to fetch translation files.\n   * Use `{locale}` as placeholder, e.g. `\"assets/i18n/{locale}.json\"`.\n   */\n  configure(urlPattern: string): void {\n    if (this._debug) {\n      console.log(`[MnLanguage] Configured urlPattern: ${urlPattern}`);\n    }\n    this._urlPattern = urlPattern;\n  }\n\n  /**\n   * Load translations for a locale from the configured URL pattern.\n   * If translations are already loaded for this locale, this is a no-op.\n   */\n  async loadLocale(locale: string): Promise<void> {\n    if (this._translations[locale]) return;\n\n    if (!this._urlPattern) {\n      console.warn(`[MnLanguage] No URL pattern configured. Call configure() or use provideMnLanguage().`);\n      return;\n    }\n\n    const url = this._urlPattern.replace('{locale}', locale);\n    if (this._debug) {\n      console.log(`[MnLanguage] Loading locale \"${locale}\" from ${url}`);\n    }\n\n    try {\n      const map = await firstValueFrom(\n        this.http.get<MnTranslationMap>(url)\n      );\n      this._translations[locale] = map ?? {};\n      if (this._debug) {\n        console.log(`[MnLanguage] Loaded locale \"${locale}\"`, this._translations[locale]);\n      }\n    } catch (err) {\n      console.warn(`[MnLanguage] Failed to load translations from ${url}`, err);\n      this._translations[locale] = {};\n    }\n  }\n\n  /**\n   * Switch the active locale. Loads translations if not yet loaded.\n   */\n  async setLocale(locale: string): Promise<void> {\n    if (this._debug) {\n      console.log(`[MnLanguage] Setting locale to \"${locale}\"`);\n    }\n    await this.loadLocale(locale);\n    this._locale$.next(locale);\n    this.appRef.tick();\n  }\n\n  /**\n   * Register translations for a locale directly from code (no HTTP needed).\n   */\n  registerTranslations(locale: string, translations: MnTranslationMap): void {\n    this._translations[locale] = {\n      ...(this._translations[locale] ?? {}),\n      ...translations,\n    };\n  }\n\n  /**\n   * Translate a key using the current locale, with optional parameter interpolation.\n   * Falls back to the key itself if no translation is found.\n   *\n   * Interpolation replaces `{{paramName}}` with the provided value.\n   *\n   * A `count` param additionally selects the wording that agrees with it: the key is\n   * resolved against its CLDR plural category first (`key` + `One`/`Two`/`Few`/`Many`/\n   * `Zero`), falling back to `key` when that sibling is undefined. Nothing has to opt in —\n   * a key with no sibling behaves exactly as before.\n   *\n   * ```ts\n   * // 'shift.asked'    → '{{count}} members are notified'\n   * // 'shift.askedOne' → '{{count}} member is notified'\n   * lang.translate('shift.asked', { count: 3 }); // 3 members are notified\n   * lang.translate('shift.asked', { count: 1 }); // 1 member is notified\n   * ```\n   */\n  translate(key: string, params?: Record<string, string | number>): string {\n    const map = this._translations[this.locale] ?? {};\n    let value = this.getValueFromMap(map, this.resolvePluralKey(map, key, params));\n\n    if (value === undefined) {\n      if (this._debug) {\n        console.warn(`[MnLanguage] Missing translation for key: \"${key}\" in locale: \"${this.locale}\"`);\n      }\n      return key;\n    }\n\n    if (params) {\n      for (const [paramKey, paramValue] of Object.entries(params)) {\n        value = value.replace(new RegExp(`\\\\{\\\\{${paramKey}\\\\}\\\\}`, 'g'), String(paramValue));\n      }\n    }\n\n    return value;\n  }\n\n  /**\n   * Picks the wording that agrees with a `count` param.\n   *\n   * A key carrying a count resolves against its CLDR plural category first, so\n   * `askedMessage` + `askedMessageOne` render \"3 leden krijgen bericht\" and \"1 lid krijgt\n   * bericht\" off the same call. Both languages change the verb as well as the noun, which\n   * is why each form is a whole sentence under its own key rather than a swapped noun.\n   *\n   * Falls back to `key` whenever the sibling is undefined, so a key that never needed a\n   * plural — or an app that has not written one yet — behaves exactly as it did before.\n   * @param map The active locale's translations.\n   * @param key The dot-notated translation key.\n   * @param params The interpolation values, inspected for `count`.\n   * @returns The key to look up: the plural sibling, or `key` itself.\n   */\n  private resolvePluralKey(\n    map: MnTranslationMap,\n    key: string,\n    params?: Record<string, string | number>,\n  ): string {\n    const raw = params?.[COUNT_PARAM];\n    if (raw === undefined) return key;\n\n    // A count off a JSON payload arrives as a string often enough that comparing it\n    // strictly would silently pick the plural for a count of one.\n    const count = Number(raw);\n    if (!Number.isFinite(count)) return key;\n\n    const suffix = PLURAL_SUFFIX[this.pluralCategory(count)];\n    if (suffix === undefined) return key;\n\n    const variant = key + suffix;\n    return this.getValueFromMap(map, variant) !== undefined ? variant : key;\n  }\n\n  /**\n   * The CLDR plural category of a count in the active locale.\n   * @param count The count being quoted.\n   * @returns The category, falling back to English rules for an unusable locale.\n   */\n  private pluralCategory(count: number): Intl.LDMLPluralRule {\n    if (!this._pluralRules.has(this.locale)) {\n      try {\n        this._pluralRules.set(this.locale, new Intl.PluralRules(this.locale));\n      } catch {\n        // An unknown or malformed locale tag: fall back rather than break every string.\n        this._pluralRules.set(this.locale, null);\n      }\n    }\n    const rules = this._pluralRules.get(this.locale);\n    if (!rules) return count === 1 ? 'one' : 'other';\n    return rules.select(count);\n  }\n\n  /**\n   * Helper to retrieve a value from a potentially nested translation map using a dot-notated key.\n   */\n  private getValueFromMap(map: MnTranslationMap, key: string): string | undefined {\n    // A flattened bundle holds the dotted key verbatim; a nested one is walked below.\n    const direct = map[key];\n    if (typeof direct === 'string') return direct;\n\n    const parts = key.split('.');\n    let current: MnTranslationMap | string | undefined = map;\n\n    for (const part of parts) {\n      if (current === null || typeof current !== 'object') return undefined;\n      current = current[part];\n    }\n\n    return typeof current === 'string' ? current : undefined;\n  }\n\n  /**\n   * Translate a key **only if it is defined**, returning `undefined` otherwise.\n   *\n   * {@link translate} deliberately returns the key itself when it is missing, which\n   * makes it unusable for a library's own default labels: a consumer that never\n   * defined `mnCollection.rowsPerPage` would see that raw string in their UI. This\n   * lets a caller try a conventional key and fall back to a readable English default\n   * when the app has not translated it, so components ship translatable strings\n   * without forcing every consumer to define them.\n   *\n   * @param key The dot-notated translation key.\n   * @param params Optional `{{name}}` interpolation values.\n   * @returns The translation, or `undefined` when the key is not defined.\n   */\n  translateIfPresent(key: string, params?: Record<string, string | number>): string | undefined {\n    const map = this._translations[this.locale] ?? {};\n    if (this.getValueFromMap(map, key) === undefined) return undefined;\n    return this.translate(key, params);\n  }\n\n  /**\n   * Shorthand alias for `translate`.\n   */\n  t(key: string, params?: Record<string, string | number>): string {\n    return this.translate(key, params);\n  }\n\n  /**\n   * Resolve the effective default locale from a domain-to-locale map.\n   * Matches `window.location.hostname` against the map keys.\n   * Returns the mapped locale, or the provided fallback if no match is found.\n   */\n  resolveLocaleForDomain(domainLocaleMap: Record<string, string> | undefined, fallback: string): string {\n    if (!domainLocaleMap || typeof window === 'undefined') return fallback;\n    const hostname = window.location.hostname;\n    return domainLocaleMap[hostname] ?? fallback;\n  }\n}\n","import { APP_INITIALIZER, Provider } from '@angular/core';\nimport { MnLanguageService } from './mn-language.service';\nimport { MnLanguageConfig } from './mn-language.types';\n\n/**\n * Provides an APP_INITIALIZER that configures the MnLanguageService and\n * preloads the requested locales during application bootstrap.\n *\n * Usage in app.config.ts:\n *   ...provideMnLanguage({\n *     urlPattern: 'assets/i18n/{locale}.json',\n *     defaultLocale: 'en',\n *     preload: ['en', 'nl'],\n *   })\n */\nexport function provideMnLanguage(config: MnLanguageConfig): Provider[] {\n  return [\n    {\n      provide: APP_INITIALIZER,\n      multi: true,\n      useFactory: (svc: MnLanguageService) => async () => {\n        if (config.debug) {\n          svc.setDebug(true);\n        }\n        svc.configure(config.urlPattern);\n\n        const effectiveLocale = svc.resolveLocaleForDomain(config.domainLocaleMap, config.defaultLocale);\n        const localesToLoad = config.preload ?? [effectiveLocale];\n        await Promise.all(localesToLoad.map(l => svc.loadLocale(l)));\n        await svc.setLocale(effectiveLocale);\n      },\n      deps: [MnLanguageService],\n    },\n  ];\n}\n","import {Pipe, PipeTransform, inject} from '@angular/core';\nimport { MnLanguageService } from './mn-language.service';\n\n/**\n * Pipe that translates a key via MnLanguageService.\n *\n * Usage in templates:\n *   {{ 'form.email.label' | mnTranslate }}\n *   {{ 'greeting' | mnTranslate:{ name: 'World' } }}\n *\n * Note: This pipe is impure so it re-evaluates when the locale changes.\n */\n@Pipe({\n  name: 'mnTranslate',\n  standalone: true,\n  pure: false,\n})\nexport class MnTranslatePipe implements PipeTransform {\n  private readonly lang = inject(MnLanguageService);\n\n\n  transform(key: string, params?: Record<string, string | number>): string {\n    return this.lang.translate(key, params);\n  }\n}\n","import {inject, Injectable, signal} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {firstValueFrom} from 'rxjs';\nimport {MnConfigFile, MnConfigSettings} from './mn-config.types';\nimport {isTranslatable, MnLanguageConfig, MnLanguageService} from '../language';\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n  return (\n    typeof value === 'object' &&\n    value !== null &&\n    Object.prototype.toString.call(value) === '[object Object]'\n  );\n}\n\n/**\n * Parses a config file. Strict JSON goes through `JSON.parse`; only a file that needs JSON5\n * syntax (comments, unquoted keys, trailing commas) loads the `json5` parser, as its own chunk.\n * A static import put the CommonJS `json5` package (~32 kB) into every consumer's startup bundle.\n *\n * @param text The raw file content.\n * @returns The parsed value.\n */\nexport async function parseConfigText(text: string): Promise<unknown> {\n  try {\n    return JSON.parse(text);\n  } catch {\n    const { default: JSON5 } = await import('json5');\n    return JSON5.parse(text);\n  }\n}\n\n@Injectable({ providedIn: 'root' })\nexport class MnConfigService {\n  private readonly http = inject(HttpClient);\n\n  private _config: MnConfigFile | null = null;\n  private _settings: MnConfigSettings = {};\n  private _debugMode = false;\n\n  /** Reactive version counter — incremented on every config load. */\n  private _configVersion = signal(0);\n  readonly configVersion = this._configVersion.asReadonly();\n\n  private readonly lang = inject(MnLanguageService);\n\n  /** General settings from the config file (version, name, etc.). */\n  get settings(): Readonly<MnConfigSettings> {\n    return this._settings;\n  }\n\n  /**\n   * Load the configuration JSON from the provided URL and cache it in memory.\n   * Consumers should typically call this via the APP_INITIALIZER helper.\n   */\n  async load(url: string, debugMode = false): Promise<void> {\n    this._debugMode = debugMode;\n    this.lang.setDebug(debugMode);\n    let text: string;\n\n    try {\n      text = await firstValueFrom(\n        this.http.get(url, { responseType: 'text' })\n      );\n    } catch (err) {\n      console.warn(`[MnConfig] Failed to load config from ${url}`, err);\n      this._config = { defaults: {}, overrides: {} };\n      return;\n    }\n\n    let json: unknown;\n\n    try {\n      json = await parseConfigText(text);\n    } catch (err) {\n      console.warn(`[MnConfig] Failed to parse JSON5 from ${url}`, err, text);\n      json = {};\n    }\n\n    const cfg = (isPlainObject(json) ? json : {}) as Record<string, unknown>;\n    const defaults = isPlainObject(cfg['defaults']) ? cfg['defaults'] : {};\n    const overrides: Record<string, unknown> = isPlainObject(cfg['overrides']) ? cfg['overrides'] : {};\n\n    const settings: MnConfigSettings = isPlainObject(cfg['settings']) ? cfg['settings'] as MnConfigSettings : {};\n\n    this._config = { settings, defaults, overrides };\n    this._settings = settings;\n\n    // Bootstrap language service from config if a \"language\" section is present.\n    // This avoids circular dependency: config reads raw language settings and\n    // pushes them into the language service (language service never imports config).\n    const langCfg = cfg['language'];\n    if (isPlainObject(langCfg) && typeof langCfg['urlPattern'] === 'string') {\n      const lc = langCfg as MnLanguageConfig;\n      if (this._debugMode) {\n        console.log(`[MnConfig] Applying language config from file`, lc);\n      }\n      this.lang.configure(lc.urlPattern);\n      const effectiveLocale = this.lang.resolveLocaleForDomain(lc.domainLocaleMap, lc.defaultLocale);\n      const localesToLoad = Array.from(new Set([...(lc.preload ?? []), effectiveLocale]));\n      await Promise.all(localesToLoad.map(l => this.lang.loadLocale(l)));\n      await this.lang.setLocale(effectiveLocale);\n    }\n\n    this._configVersion.update(v => v + 1);\n  }\n\n  /**\n   * Load configuration from a pre-parsed object (no HTTP fetch).\n   * Used for live preview scenarios where config is pushed via postMessage.\n   * Optionally re-bootstraps the language service if a `language` section is present.\n   */\n  async loadFromObject(config: Record<string, unknown>, bootstrapLanguage = false): Promise<void> {\n    const defaults = isPlainObject(config['defaults']) ? config['defaults'] : {};\n    const overrides = isPlainObject(config['overrides']) ? config['overrides'] : {};\n    const settings: MnConfigSettings = isPlainObject(config['settings']) ? config['settings'] as MnConfigSettings : {};\n\n    this._config = { settings, defaults, overrides };\n    this._settings = settings;\n\n    if (bootstrapLanguage) {\n      const langCfg = config['language'];\n      if (isPlainObject(langCfg) && typeof langCfg['urlPattern'] === 'string') {\n        const lc = langCfg as MnLanguageConfig;\n        if (this._debugMode) {\n          console.log(`[MnConfig] Applying language config from object`, lc);\n        }\n        this.lang.configure(lc.urlPattern);\n        const effectiveLocale = this.lang.resolveLocaleForDomain(lc.domainLocaleMap, lc.defaultLocale);\n        const localesToLoad = Array.from(new Set([...(lc.preload ?? []), effectiveLocale]));\n        await Promise.all(localesToLoad.map(l => this.lang.loadLocale(l)));\n        await this.lang.setLocale(effectiveLocale);\n      }\n    }\n\n    this._configVersion.update(v => v + 1);\n  }\n\n\n  /**\n   * Resolve a configuration object for a component, optionally scoped to a section path\n   * and optionally overridden by an instance id.\n   */\n  resolve<T extends object = Record<string, unknown>>(\n    componentName: string,\n    sectionPath: string[] = [],\n    instanceId?: string,\n  ): T {\n    const baseConfig: Record<string, unknown> = isPlainObject(this._config?.defaults)\n      ? (isPlainObject((this._config as MnConfigFile).defaults[componentName])\n          ? { ...(this._config as MnConfigFile).defaults[componentName] as Record<string, unknown> }\n          : {})\n      : {};\n\n    const leaf = this.walkOverrides(this._config?.overrides ?? {}, sectionPath);\n\n    let resolved: Record<string, unknown> = baseConfig;\n\n    if (leaf && isPlainObject((leaf as Record<string, unknown>)[componentName])) {\n      resolved = this.deepMerge(resolved, (leaf as Record<string, unknown>)[componentName] as Record<string, unknown>);\n    }\n\n    if (instanceId) {\n      const instKey = `#${instanceId}`;\n      if (leaf && isPlainObject((leaf as Record<string, unknown>)[instKey])) {\n        resolved = this.deepMerge(resolved, (leaf as Record<string, unknown>)[instKey] as Record<string, unknown>);\n      }\n    }\n\n    if (this._debugMode) {\n      console.debug(`[MnConfig] Resolving for ${componentName}`, {\n        sectionPath,\n        instanceId,\n        resolved,\n      });\n    }\n\n    return this.resolveTranslatables(resolved) as T;\n  }\n\n  /**\n   * Walk the overrides nested object using the provided section path and return the leaf node.\n   * If any segment is missing or the current node is not a plain object, returns undefined.\n   */\n  walkOverrides(overridesRoot: unknown, sectionPath: string[]): unknown | undefined {\n    let node: unknown = overridesRoot;\n    for (const segment of sectionPath) {\n      if (!isPlainObject(node)) return undefined;\n      node = (node as Record<string, unknown>)[segment];\n      if (node === undefined) return undefined;\n    }\n    return node;\n  }\n\n  /**\n   * Recursively walk a resolved config object and replace any `{ $translate: \"key\" }` markers\n   * with their translated values from MnLanguageService.\n   */\n  private resolveTranslatables(obj: Record<string, unknown>): Record<string, unknown> {\n    const out: Record<string, unknown> = {};\n    for (const [key, value] of Object.entries(obj)) {\n      if (isTranslatable(value)) {\n        out[key] = this.lang.translate(value.$translate, value.params);\n      } else if (Array.isArray(value)) {\n        out[key] = value.map(item => {\n          if (isTranslatable(item)) {\n            return this.lang.translate(item.$translate, item.params);\n          } else if (isPlainObject(item)) {\n            return this.resolveTranslatables(item as Record<string, unknown>);\n          }\n          return item;\n        });\n      } else if (isPlainObject(value)) {\n        out[key] = this.resolveTranslatables(value as Record<string, unknown>);\n      } else {\n        out[key] = value;\n      }\n    }\n    return out;\n  }\n\n  /**\n   * Deep merge two plain-object trees. Arrays and non-plain values are replaced by the patch.\n   * Does not mutate inputs; returns a new object.\n   */\n  deepMerge<A extends Record<string, unknown>, B extends Record<string, unknown>>(base: A, patch: B): A & B {\n    const out: Record<string, unknown> = {...base};\n    for (const key of Object.keys(patch)) {\n      const bVal = base[key];\n      const pVal = patch[key];\n\n      if (isPlainObject(bVal) && isPlainObject(pVal)) {\n        out[key] = this.deepMerge(bVal, pVal);\n      } else {\n        // replace for arrays, primitives, null, undefined, and non-plain objects\n        out[key] = pVal;\n      }\n    }\n    return out as A & B;\n  }\n}\n","import { APP_INITIALIZER, Provider } from '@angular/core';\nimport { MnConfigService } from './mn-config.service';\n\n/**\n * Provides an APP_INITIALIZER that loads the mn-lib configuration from the given URL\n * during application bootstrap. The consuming application is responsible for providing\n * HttpClient (e.g., via HttpClientModule or provideHttpClient()).\n */\nexport function provideMnConfig(url: string, debugMode = false): Provider[] {\n  return [\n    {\n      provide: APP_INITIALIZER,\n      multi: true,\n      useFactory: (svc: MnConfigService) => () => svc.load(url, debugMode),\n      deps: [MnConfigService],\n    },\n  ];\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * Represents the current section path based on nested mn-section directives.\n */\nexport const MN_SECTION_PATH = new InjectionToken<string[]>(\n  'MN_SECTION_PATH',\n  {\n    providedIn: 'root',\n    factory: () => [],\n  },\n);\n\n/**\n * Represents the current component instance id provided by [mn-instance].\n */\nexport const MN_INSTANCE_ID = new InjectionToken<string | null>(\n  'MN_INSTANCE_ID',\n  {\n    providedIn: 'root',\n    factory: () => null,\n  },\n);\n","import { DestroyRef, InjectionToken, Optional, Provider } from '@angular/core';\nimport { MN_INSTANCE_ID, MN_SECTION_PATH } from '../context/mn-context.tokens';\nimport { MnConfigService } from './mn-config.service';\nimport { MnLanguageService } from '../language/mn-language.service';\n\n/**\n * Helper to provide a resolved, typed component config via DI.\n *\n * Usage in a component/module providers:\n *   const MY_CFG = new InjectionToken<MyCfg>('MY_CFG');\n *   providers: [ provideMnComponentConfig(MY_CFG, 'my-component') ]\n * Then in the component:\n *   readonly cfg = inject(MY_CFG)\n *\n * The returned config object is **reactive**: when the active locale changes,\n * all translatable values are re-resolved in place so that templates using\n * `cfg.someLabel` automatically reflect the new language on the next change-detection cycle.\n */\nexport function provideMnComponentConfig<T extends object>(\n  token: InjectionToken<T>,\n  componentName: string,\n  initial?: Partial<T>,\n): Provider {\n  return {\n    provide: token,\n    deps: [\n      MnConfigService,\n      MnLanguageService,\n      DestroyRef,\n      [new Optional(), MN_SECTION_PATH],\n      [new Optional(), MN_INSTANCE_ID],\n    ],\n    useFactory: (\n      svc: MnConfigService,\n      lang: MnLanguageService,\n      destroyRef: DestroyRef,\n      sectionPath: string[] | null,\n      instanceId: string | null,\n    ): T => {\n      const resolveConfig = (): T => {\n        const resolved = svc.resolve<T>(componentName, sectionPath ?? [], instanceId ?? undefined);\n        return Object.assign({}, initial ?? {}, resolved);\n      };\n\n      // Create the initial config object that will be shared by reference.\n      const cfg = resolveConfig();\n\n      // Re-resolve translatable values whenever the locale changes.\n      // skip(1) because the current locale was already used for the initial resolve.\n      const sub = lang.locale$.subscribe(() => {\n        const updated = resolveConfig();\n        // Mutate the existing object in place so all template bindings pick up the new values.\n        for (const key of Object.keys(updated)) {\n          (cfg as Record<string, unknown>)[key] = (updated as Record<string, unknown>)[key];\n        }\n      });\n\n      destroyRef.onDestroy(() => sub.unsubscribe());\n\n      return cfg;\n    },\n  };\n}\n","import { Attribute, Directive, Input, Optional, SkipSelf } from '@angular/core';\nimport { MN_SECTION_PATH } from './mn-context.tokens';\n\n@Directive({\n  // eslint-disable-next-line @angular-eslint/directive-selector -- kebab-case is intentional: matches the Attribute() token and is stable public API\n  selector: '[mn-section]',\n  standalone: true,\n  providers: [\n    {\n      provide: MN_SECTION_PATH,\n      // Read parent MN_SECTION_PATH from ancestor injector (skipSelf to avoid self-reference),\n      // and read the attribute value using Attribute so it's available at provider creation time.\n      deps: [[new Optional(), new SkipSelf(), MN_SECTION_PATH], new Attribute('mn-section')],\n      useFactory: (parentPath: string[] | null, attr: string | null) => {\n        const parent = Array.isArray(parentPath) ? parentPath : [];\n        const name = (attr ?? '').trim();\n        return name ? [...parent, name] : [...parent];\n      },\n    },\n  ],\n})\nexport class MnSectionDirective {\n  /** Section name contributed by this DOM node to the section path */\n  @Input('mn-section') mnSection: string | undefined;\n}\n","import { Attribute, Directive, Input } from '@angular/core';\nimport { MN_INSTANCE_ID } from './mn-context.tokens';\n\n@Directive({\n  // eslint-disable-next-line @angular-eslint/directive-selector -- kebab-case is intentional: matches the Attribute() token and is stable public API\n  selector: '[mn-instance]',\n  standalone: true,\n  providers: [\n    {\n      provide: MN_INSTANCE_ID,\n      // Read the attribute at provider creation time using Attribute token; Inputs may not be set yet.\n      deps: [new Attribute('mn-instance')],\n      useFactory: (attr: string | null) => (attr ?? '').trim() || null,\n    },\n  ],\n})\nexport class MnInstanceDirective {\n  /** Instance id for targeting per-component instance overrides */\n  @Input('mn-instance') mnInstance: string | undefined;\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * Injection token for the base URL used by all CRUD service requests.\n *\n * Provide this token at the application or module level to configure\n * the root API URL that `CrudService` prepends to every endpoint.\n */\nexport const API_BASE_URL = new InjectionToken<string>('API_BASE_URL');\n","import {inject} from '@angular/core';\nimport {ApiError, FailureResult, QueryParams, Result, ResultMeta, SuccessResult} from './crud.model';\nimport {catchError, map, Observable, of} from 'rxjs';\nimport {HttpClient, HttpErrorResponse, HttpParams, HttpResponse, HttpStatusCode} from '@angular/common/http';\nimport {API_BASE_URL} from './crud.tokens';\n\n/**\n * Configuration for a CRUD service endpoint.\n *\n * Passed to the `CrudService` constructor to define which API\n * resource the service operates on.\n */\nexport type CrudConfig = {\n  endpoint: string;\n}\n\n/**\n * Abstract base class for CRUD services.\n * Provides standard HTTP operations with typed `Result<T>` responses.\n *\n * @template TEntity The entity type returned by single-item operations.\n * @template TListResponse The response type for list operations (defaults to `TEntity[]`).\n * @template TCreatePayload The payload type for create operations (defaults to `Partial<TEntity>`).\n * @template TUpdatePayload The payload type for update operations (defaults to `Partial<TEntity>`).\n * @template TId The type of the entity identifier (defaults to `number`).\n * @template TGetByIdResponse The response type for getById (defaults to `TEntity`).\n * @template TCreateResponse The response type for create (defaults to `TEntity`).\n * @template TUpdateResponse The response type for update and patch (defaults to `TEntity`).\n * @template TDeleteResponse The response type for delete (defaults to `void`).\n */\nexport abstract class CrudService<\n  TEntity,\n  TListResponse = TEntity[],\n  TCreatePayload = Partial<TEntity>,\n  TUpdatePayload = Partial<TEntity>,\n  TId extends string | number = number,\n  TGetByIdResponse = TEntity,\n  TCreateResponse = TEntity,\n  TUpdateResponse = TEntity,\n  TDeleteResponse = void\n> {\n  protected readonly http = inject(HttpClient);\n  protected readonly baseUrl = inject(API_BASE_URL);\n  protected readonly endpoint: string;\n\n  protected constructor(config: CrudConfig) {\n    this.endpoint = `${this.baseUrl}${config.endpoint}`;\n  }\n\n  /**\n   * Retrieves all entities from the configured endpoint.\n   *\n   * Sends a GET request to the base endpoint. Query values are\n   * converted to `HttpParams` before the request is sent.\n   *\n   * @param query Optional query parameters appended to the request URL.\n   * @returns An observable emitting a `Result` with the list response or a structured failure.\n   */\n  getAll(query?: QueryParams): Observable<Result<TListResponse>> {\n    return this.http\n      .get<TListResponse>(this.endpoint, {\n        params: this.toHttpParams(query)\n      })\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Retrieves a single entity by its identifier.\n   *\n   * Sends a GET request to `{endpoint}/{id}`.\n   *\n   * @param id The unique identifier of the entity to retrieve.\n   * @returns An observable emitting a `Result` with the entity or a structured failure.\n   */\n  getById(id: TId): Observable<Result<TGetByIdResponse>> {\n    return this.http\n      .get<TGetByIdResponse>(this.itemUrl(id))\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Creates a new entity at the configured endpoint.\n   *\n   * Sends a POST request with the provided payload as the request body.\n   *\n   * @param payload The data used to create the entity.\n   * @returns An observable emitting a `Result` with the created entity or a structured failure.\n   */\n  create(payload: TCreatePayload): Observable<Result<TCreateResponse>> {\n    return this.http\n      .post<TCreateResponse>(this.endpoint, payload)\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Fully replaces an existing entity.\n   *\n   * Sends a PUT request to `{endpoint}/{id}` with the provided payload,\n   * replacing the entire entity.\n   *\n   * @param id The unique identifier of the entity to update.\n   * @param payload The complete data to replace the existing entity with.\n   * @returns An observable emitting a `Result` with the updated entity or a structured failure.\n   */\n  update(id: TId, payload: TUpdatePayload): Observable<Result<TUpdateResponse>> {\n    return this.http\n      .put<TUpdateResponse>(this.itemUrl(id), payload)\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Partially updates an existing entity.\n   *\n   * Sends a PATCH request to `{endpoint}/{id}` with the provided payload,\n   * merging changes into the existing entity.\n   *\n   * @param id The unique identifier of the entity to patch.\n   * @param payload A partial set of fields to update on the existing entity.\n   * @returns An observable emitting a `Result` with the updated entity or a structured failure.\n   */\n  patch(id: TId, payload: Partial<TUpdatePayload>): Observable<Result<TUpdateResponse>> {\n    return this.http\n      .patch<TUpdateResponse>(this.itemUrl(id), payload)\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Deletes an entity by its identifier.\n   *\n   * Sends a DELETE request to `{endpoint}/{id}`.\n   *\n   * @param id The unique identifier of the entity to delete.\n   * @returns An observable emitting a `Result` with the delete response or a structured failure.\n   */\n  delete(id: TId): Observable<Result<TDeleteResponse>> {\n    return this.http\n      .delete<TDeleteResponse>(this.itemUrl(id))\n      .pipe(\n        map((data) => this.success(data)),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Retrieves all entities with the full `HttpResponse` wrapper.\n   *\n   * Behaves like {@link getAll} but observes the complete HTTP response,\n   * giving access to headers, status code, and URL alongside the body.\n   *\n   * @param query Optional query parameters appended to the request URL.\n   * @returns An observable emitting a `Result` with the full HTTP response or a structured failure.\n   */\n  getAllResponse(query?: QueryParams): Observable<Result<HttpResponse<TListResponse>>> {\n    return this.http\n      .get<TListResponse>(this.endpoint, {\n        params: this.toHttpParams(query),\n        observe: 'response',\n      })\n      .pipe(\n        map((response) =>\n          this.success(response, {\n            statusCode: response.status,\n            headers: response.headers,\n            url: response.url ?? undefined,\n          })\n        ),\n        catchError((error) => of(this.failure(this.mapHttpError(error))))\n      );\n  }\n\n  /**\n   * Builds the URL for a single entity by appending the identifier to the endpoint.\n   *\n   * @param id The unique identifier to append.\n   * @returns The full URL targeting the specific entity.\n   */\n  protected itemUrl(id: TId): string {\n    return `${this.endpoint}/${id}`;\n  }\n\n  /**\n   * Wraps a value in a `SuccessResult`.\n   *\n   * @template T The type of the response data.\n   * @param data The response data to wrap.\n   * @param meta Optional metadata (status code, headers, URL) to attach.\n   * @returns A `SuccessResult` containing the provided data.\n   */\n  protected success<T>(data: T, meta?: ResultMeta): SuccessResult<T> {\n    return {ok: true, data, meta};\n  }\n\n  /**\n   * Wraps an error in a `FailureResult`.\n   *\n   * When no explicit metadata is provided, metadata is derived from\n   * the `ApiError` itself (status code, headers, URL).\n   *\n   * @param error The structured API error.\n   * @param meta Optional metadata to override the error-derived values.\n   * @returns A `FailureResult` containing the error and metadata.\n   */\n  protected failure(error: ApiError, meta?: ResultMeta): FailureResult {\n    return {\n      ok: false,\n      error,\n      meta: meta ?? {\n        statusCode: error.status ?? undefined,\n        headers: error.headers,\n        url: error.url ?? undefined,\n      },\n    };\n  }\n\n  /**\n   * Maps an unknown error into a structured `ApiError`.\n   *\n   * Handles both `HttpErrorResponse` instances and unexpected error types.\n   * Extracts backend messages, validation errors, and retry information\n   * so callers receive a consistent error shape.\n   *\n   * @param error The raw error caught from the HTTP pipeline.\n   * @returns A fully populated `ApiError` object.\n   */\n  protected mapHttpError(error: unknown): ApiError {\n    const timestamp = new Date().toISOString();\n\n    if (!(error instanceof HttpErrorResponse)) {\n      return {\n        status: null,\n        message: 'Unknown error',\n        original: error instanceof Error ? error : new Error(String(error)),\n        retryable: false,\n        timestamp,\n      };\n    }\n\n    const status = this.normalizeStatus(error.status);\n    const details = error.error;\n    const backendMessage = this.extractBackendMessage(details);\n    const validationErrors = this.extractValidationErrors(details);\n\n    return {\n      status,\n      message: backendMessage ?? this.defaultMessage(status),\n      details,\n      backendMessage,\n      validationErrors,\n      url: error.url,\n      headers: error.headers,\n      original: error,\n      retryable: this.isRetryable(status),\n      timestamp,\n    };\n  }\n\n  /**\n   * Extracts a human-readable message from the error response body.\n   *\n   * Checks common keys (`message`, `title`, `detail`, `error`) on the\n   * body object and returns the first non-empty string found.\n   *\n   * @param body The parsed error response body.\n   * @returns The extracted message, or `undefined` if none was found.\n   */\n  protected extractBackendMessage(body: unknown): string | undefined {\n    if (typeof body === 'string' && body.trim()) {\n      return body;\n    }\n\n    if (!body || typeof body !== 'object') {\n      return undefined;\n    }\n\n    const obj = body as Record<string, unknown>;\n\n    for (const key of ['message', 'title', 'detail', 'error']) {\n      const value = obj[key];\n      if (typeof value === 'string' && value.trim()) {\n        return value;\n      }\n    }\n    return undefined;\n  }\n\n  /**\n   * Extracts field-level validation errors from the error response body.\n   *\n   * Expects an `errors` property on the body containing a record of\n   * field names to error messages (string or string array).\n   *\n   * @param body The parsed error response body.\n   * @returns A record mapping field names to their error messages, or `undefined` if none were found.\n   */\n  protected extractValidationErrors(body: unknown): Record<string, string[]> | undefined {\n    if (!body || typeof body !== 'object') {\n      return undefined;\n    }\n\n    const obj = body as Record<string, unknown>;\n    const errors = obj['errors'];\n\n    if (!errors || typeof errors !== 'object') {\n      return undefined;\n    }\n\n    const result: Record<string, string[]> = {};\n\n    for (const [key, value] of Object.entries(errors as Record<string, unknown>)) {\n      if (Array.isArray(value)) {\n        result[key] = value.map(String);\n      } else if (typeof value === 'string') {\n        result[key] = [value];\n      }\n    }\n    return Object.keys(result).length ? result : undefined;\n  }\n\n  /**\n   * Returns a default user-facing message for the given HTTP status code.\n   *\n   * Provides human-readable messages for common HTTP status codes.\n   * Override this method to customise messages.\n   *\n   * @param status The HTTP status code, or `null` when unknown.\n   * @returns A descriptive error message.\n   */\n  protected defaultMessage(status: HttpStatusCode | null): string {\n    switch (status) {\n      case HttpStatusCode.BadRequest:\n        return 'Bad request';\n      case HttpStatusCode.Unauthorized:\n        return 'Unauthorized';\n      case HttpStatusCode.Forbidden:\n        return 'Forbidden';\n      case HttpStatusCode.NotFound:\n        return 'Not found';\n      case HttpStatusCode.Conflict:\n        return 'Conflict';\n      case HttpStatusCode.UnprocessableEntity:\n        return 'Unprocessable entity';\n      case HttpStatusCode.InternalServerError:\n        return 'Internal server error';\n      case null:\n        return 'Unknown error';\n      default:\n        return `Request failed with status ${status}`;\n    }\n  }\n\n  /**\n   * Determines whether a request with the given status can be retried.\n   *\n   * Timeouts, rate-limiting responses, and server errors\n   * (5xx) are considered retryable by default.\n   *\n   * @param status The HTTP status code, or `null` when unknown.\n   * @returns `true` if the request is safe to retry.\n   */\n  protected isRetryable(status: HttpStatusCode | null): boolean {\n    if (status === HttpStatusCode.RequestTimeout) return true;\n    if (status === HttpStatusCode.TooManyRequests) return true;\n    if (typeof status === 'number' && status >= 500) return true;\n    return false;\n  }\n\n  /**\n   * Normalises a raw HTTP status into an `HttpStatusCode | null` value.\n   *\n   * Converts `undefined`, `NaN`, and `0` (network error) to `null`\n   * so downstream code only needs to handle `HttpStatusCode | null`.\n   *\n   * @param status The raw status value from the HTTP response.\n   * @returns The normalised status code, or `null` when indeterminate.\n   */\n  protected normalizeStatus(status: number | null | undefined): HttpStatusCode | null {\n    if (status === null || status === undefined || status === 0 || Number.isNaN(status)) return null;\n    return status as HttpStatusCode;\n  }\n\n  /**\n   * Converts query parameters into Angular `HttpParams`.\n   *\n   * `null` and `undefined` values are silently skipped.\n   * Array values are appended as multiple entries for the same key.\n   *\n   * @param query The query parameter record to convert.\n   * @returns An `HttpParams` instance, or `undefined` when no parameters are provided.\n   */\n  protected toHttpParams(query?: QueryParams): HttpParams | undefined {\n    if (!query) return undefined;\n\n    let params = new HttpParams();\n\n    for (const [key, rawValue] of Object.entries(query)) {\n      if (rawValue === null || rawValue === undefined) continue;\n\n      const values = Array.isArray(rawValue) ? rawValue : [rawValue];\n\n      for (const value of values) {\n        if (value === null || value === undefined) continue;\n        params = params.append(key, String(value));\n      }\n    }\n    return params;\n  }\n}\n","import {inject} from '@angular/core';\nimport {HttpClient, HttpParams} from '@angular/common/http';\nimport {firstValueFrom} from 'rxjs';\nimport {API_BASE_URL} from '../crud';\n\n/** A single query parameter value. */\ntype MnQueryValue = string | number | boolean | null | undefined;\n\n/** A record of query parameter key-value pairs. Arrays are appended as multiple entries. */\nexport type MnQueryParams = Record<string, MnQueryValue | MnQueryValue[]>;\n\n/**\n * Lightweight abstract HTTP base class that removes common boilerplate\n * from API services.\n *\n * Provides typed `get`, `post`, `patch`, `put`, and `delete` methods\n * that return Promises, automatic query-param building, and base-URL\n * injection via the `API_BASE_URL` token.\n *\n * Subclass this directly for services with static or mixed endpoints.\n * No CRUD structure is imposed — every method accepts a free-form path.\n */\nexport abstract class MnHttpService {\n  /** Angular HTTP client injected automatically. */\n  protected readonly http = inject(HttpClient);\n\n  /** Base API URL provided via the `API_BASE_URL` injection token. */\n  protected readonly baseUrl = inject(API_BASE_URL);\n\n  /**\n   * Sends a typed GET request.\n   * @param path The path appended to the base URL.\n   * @param query Optional query parameters.\n   * @returns A promise resolving to the typed response body.\n   */\n  protected get<T>(path: string, query?: MnQueryParams): Promise<T> {\n    return firstValueFrom(\n      this.http.get<T>(`${this.baseUrl}${path}`, {\n        params: this.toHttpParams(query),\n      }),\n    );\n  }\n\n  /**\n   * Sends a typed POST request.\n   * @param path The path appended to the base URL.\n   * @param body Optional request body.\n   * @param query Optional query parameters.\n   * @returns A promise resolving to the typed response body.\n   */\n  protected post<T>(path: string, body?: unknown, query?: MnQueryParams): Promise<T> {\n    return firstValueFrom(\n      this.http.post<T>(`${this.baseUrl}${path}`, body ?? {}, {\n        params: this.toHttpParams(query),\n      }),\n    );\n  }\n\n  /**\n   * Sends a typed PATCH request.\n   * @param path The path appended to the base URL.\n   * @param body Optional request body.\n   * @param query Optional query parameters.\n   * @returns A promise resolving to the typed response body.\n   */\n  protected patch<T>(path: string, body?: unknown, query?: MnQueryParams): Promise<T> {\n    return firstValueFrom(\n      this.http.patch<T>(`${this.baseUrl}${path}`, body ?? {}, {\n        params: this.toHttpParams(query),\n      }),\n    );\n  }\n\n  /**\n   * Sends a typed PUT request.\n   * @param path The path appended to the base URL.\n   * @param body Optional request body.\n   * @param query Optional query parameters.\n   * @returns A promise resolving to the typed response body.\n   */\n  protected put<T>(path: string, body?: unknown, query?: MnQueryParams): Promise<T> {\n    return firstValueFrom(\n      this.http.put<T>(`${this.baseUrl}${path}`, body ?? {}, {\n        params: this.toHttpParams(query),\n      }),\n    );\n  }\n\n  /**\n   * Sends a typed DELETE request.\n   * @param path The path appended to the base URL.\n   * @param query Optional query parameters.\n   * @returns A promise resolving to the typed response body.\n   */\n  protected delete<T = void>(path: string, query?: MnQueryParams): Promise<T> {\n    return firstValueFrom(\n      this.http.delete<T>(`${this.baseUrl}${path}`, {\n        params: this.toHttpParams(query),\n      }),\n    );\n  }\n\n  /**\n   * Converts a query-params record to Angular `HttpParams`.\n   * Null and undefined values are silently skipped.\n   * Array values are appended as multiple entries for the same key.\n   * @param query The query parameter record to convert.\n   * @returns An `HttpParams` instance, or `undefined` when no parameters are provided.\n   */\n  protected toHttpParams(query?: MnQueryParams): HttpParams | undefined {\n    if (!query) return undefined;\n\n    let params = new HttpParams();\n\n    for (const [key, rawValue] of Object.entries(query)) {\n      if (rawValue === null || rawValue === undefined) continue;\n\n      const values = Array.isArray(rawValue) ? rawValue : [rawValue];\n\n      for (const value of values) {\n        if (value === null || value === undefined) continue;\n        params = params.append(key, String(value));\n      }\n    }\n\n    return params;\n  }\n}\n","import type { LucideIconData } from '@lucide/angular';\nimport type { IconNode } from 'lucide';\n\n/**\n * Turns icon nodes from the vanilla `lucide` package into the icon data that\n * `<svg [lucideIcon]>` (`LucideDynamicIcon`) and MnLib's icon inputs accept.\n *\n * Why not `@lucide/angular`'s per-icon components (`<svg lucideArrowLeft>`): that\n * package is a single module, and the Angular linker compiles a full copy of the\n * SVG template into every icon class, so each icon cost ~2.8 kB and all of them\n * landed in the startup chunk. With `lucide` an icon is a few hundred bytes of data, and\n * only the icons something imports are bundled. esbuild keeps all of them in one shared\n * chunk (they hang off the package's re-export barrel), about 30 kB for the whole app.\n *\n * Import the namespace and name each icon, so an icon called `Component`, `Map`\n * or `X` never shadows another import:\n *\n * ```ts\n * import * as lucide from 'lucide';\n * const ICONS = lucideIcons({ ArrowLeft: lucide.ArrowLeft, Trash2: lucide.Trash2 });\n * // template: <svg [lucideIcon]=\"icons.ArrowLeft\" [size]=\"16\"></svg>\n * ```\n *\n * @param nodes Icon nodes keyed by their PascalCase `lucide` export name.\n * @returns Icon data under the same keys, named `arrow-left`-style for the\n * `lucide-<name>` class the icon renders with.\n */\nexport function lucideIcons<K extends string>(nodes: Record<K, IconNode>): Record<K, LucideIconData> {\n  const icons = {} as Record<K, LucideIconData>;\n  for (const key of Object.keys(nodes) as K[]) {\n    // `lucide` types attribute values as optional; its generated icon data never omits one.\n    icons[key] = { name: toKebabCase(key), node: nodes[key] as LucideIconData['node'] };\n  }\n  return icons;\n}\n\n/**\n * Converts a PascalCase export name to Lucide's kebab-case icon name.\n * @param name Export name, e.g. `CircleCheck` or `Trash2`.\n * @returns The icon name, e.g. `circle-check` or `trash-2`.\n */\nfunction toKebabCase(name: string): string {\n  return name\n    .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n    .replace(/([a-zA-Z])(\\d)/g, '$1-$2')\n    .toLowerCase();\n}\n","import { MnConfigService } from '../config/mn-config.service';\nimport { MnLanguageService } from '../language/mn-language.service';\n\nexport type MnPreviewMessage = {\n  type: 'mn-config-update' | 'mn-translations-update';\n  config?: Record<string, unknown>;\n  translations?: Record<string, Record<string, string>>;\n}\n\n/**\n * Enable live preview mode. Listens for postMessage events from\n * Mn Web Manager and hot-swaps config/translations at runtime.\n *\n * Call this once in your app's bootstrap (e.g., APP_INITIALIZER or root component).\n *\n * @param configService - The MnConfigService instance\n * @param langService - The MnLanguageService instance\n * @param allowedOrigins - Optional whitelist of allowed origins (security)\n */\nexport function enableMnPreviewMode(\n  configService: MnConfigService,\n  langService: MnLanguageService,\n  allowedOrigins?: string[]\n): void {\n  window.addEventListener('message', async (event: MessageEvent<MnPreviewMessage>) => {\n    if (allowedOrigins?.length && !allowedOrigins.includes(event.origin)) {\n      return;\n    }\n\n    const data = event.data;\n    if (!data?.type) return;\n\n    switch (data.type) {\n      case 'mn-config-update':\n        if (data.config) {\n          await configService.loadFromObject(data.config);\n        }\n        break;\n\n      case 'mn-translations-update':\n        if (data.translations) {\n          for (const [locale, translations] of Object.entries(data.translations)) {\n            langService.registerTranslations(locale, translations);\n          }\n          await langService.setLocale(langService.locale);\n        }\n        break;\n    }\n  });\n}\n","/**\n * Public API of the `mn-angular-lib/core` entry point: config, context, language, preview, HTTP/CRUD services, shared types and icon helpers.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/config';\nexport * from './src/context';\nexport * from './src/shared/crud';\nexport * from './src/shared/http';\nexport * from './src/shared/types';\nexport * from './src/shared/icons';\nexport * from './src/language';\nexport * from './src/preview';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;AAEG;;ACgDH;;AAEG;AACG,SAAU,cAAc,CAAC,KAAc,EAAA;AAC3C,IAAA,QACE,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,KAAK,KAAK,IAAI;AACd,QAAA,OA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