{"version":3,"sources":["../src/config.ts","../src/constants.ts","../src/logger/colorings.ts","../src/logger/index.ts","../src/loader/translation-loader.ts","../src/scripts/client.ts","../src/scripts/server.ts","../src/scripts/ssg.ts","../node_modules/.pnpm/i18next-resources-for-ts@1.6.0/node_modules/i18next-resources-for-ts/dist/esm/mergeResources.js","../node_modules/.pnpm/i18next-resources-for-ts@1.6.0/node_modules/i18next-resources-for-ts/dist/esm/mergeResourcesAsInterface.js","../src/utils/type-generation.ts","../src/validation.ts","../src/vite-plugin.ts","../src/integration.ts"],"names":["createRequire","existsSync","readFileSync","readdirSync","resolve","statSync","join","relative","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,SAAS,sBAAsB,OAAA,EAA6B;AACjE,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB,OAAA,CAAQ,eAAA,IAAmB,cAAA,CAAe,eAAA;AAAA,IAC3D,cAAA,EAAgB;AAAA,MACd,OAAA,EACE,OAAA,EAAS,cAAA,EAAgB,OAAA,IACzB,eAAe,cAAA,CAAe,OAAA;AAAA,MAChC,QAAA,EACE,OAAA,EAAS,cAAA,EAAgB,QAAA,IACzB,eAAe,cAAA,CAAe;AAAA;AAClC,GACF;AACF;AAEO,IAAM,cAAA,GAA4C;AAAA,EACvD,cAAA,EAAgB;AAAA,IACd,OAAA,EAAS,OAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,eAAA,EAAiB;AACnB,CAAA;;;ACnCO,IAAM,gBAAA,GAAmB,sBAAA;ACGhC,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AACpC,IAAM,WAAA,GAAc,SAAA,GAAY,IAAA,GAAOA,sBAAA,CAAc,2PAAe,CAAA;AAG7D,IAAM,cAAA,GAAiB,CAAC,KAAA,KAAkB;AAC/C,EAAA,IAAI,SAAA,IAAa,CAAC,WAAA,EAAa,OAAO,KAAA;AACtC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,GAAA,EAAI,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F,GACF;AACF","file":"index.cjs","sourcesContent":["import type {\n  DefaultIntegrationOptions,\n  IntegrationOptions,\n} from \"./types/integration\";\nimport type { InitOptions } from \"i18next\";\n\n/**\n * Creates the base i18next configuration\n */\nexport function createI18nextConfig(\n  i18NextOptions: IntegrationOptions[\"i18NextOptions\"]\n): Partial<InitOptions> {\n  return i18NextOptions;\n}\n\nexport function applyInternalDefaults(options: IntegrationOptions) {\n  return {\n    translationsDir: options.translationsDir ?? defaultOptions.translationsDir,\n    generatedTypes: {\n      dirPath:\n        options?.generatedTypes?.dirPath ??\n        defaultOptions.generatedTypes.dirPath,\n      fileName:\n        options?.generatedTypes?.fileName ??\n        defaultOptions.generatedTypes.fileName,\n    },\n  };\n}\n\nexport const defaultOptions: DefaultIntegrationOptions = {\n  generatedTypes: {\n    dirPath: \"types\",\n    fileName: \"i18next-resources\",\n  },\n  translationsDir: \"i18n\",\n};\n","export const INTEGRATION_NAME = \"@vyxos/astro-i18next\";\n","// Browser-safe colorings - createRequire for ESM compatibility\nimport { createRequire } from \"module\";\n\nconst isBrowser = typeof window !== \"undefined\";\nconst nodeRequire = isBrowser ? null : createRequire(import.meta.url);\n\n// Synchronous color functions with fallback\nexport const colorTimestamp = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { dim } = nodeRequire(\"kleur/colors\");\n    return dim(value);\n  } catch {\n    return value;\n  }\n};\n\nexport const colorIntegration = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { bold, green } = nodeRequire(\"kleur/colors\");\n    return bold(green(value));\n  } catch {\n    return value;\n  }\n};\n\nexport const colorWarn = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { yellow } = nodeRequire(\"kleur/colors\");\n    return yellow(value);\n  } catch {\n    return value;\n  }\n};\n\nexport const colorError = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { red } = nodeRequire(\"kleur/colors\");\n    return red(value);\n  } catch {\n    return value;\n  }\n};\n\nexport const colorWarnPrefix = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { bold, yellow } = nodeRequire(\"kleur/colors\");\n    return bold(yellow(value));\n  } catch {\n    return value;\n  }\n};\n\nexport const colorErrorPrefix = (value: string) => {\n  if (isBrowser || !nodeRequire) return value;\n  try {\n    const { red } = nodeRequire(\"kleur/colors\");\n    return red(value);\n  } catch {\n    return value;\n  }\n};\n","import { INTEGRATION_NAME } from \"../constants\";\nimport {\n  colorError,\n  colorErrorPrefix,\n  colorIntegration,\n  colorTimestamp,\n  colorWarn,\n  colorWarnPrefix,\n} from \"./colorings\";\n\n/**\n * Logs a message with Astro-like formatting.\n * @param message The message to log.\n * @param label The label for the message, defaults to integration name\n * @example\n * ```ts\n * log(\"Server started\");\n * log(\"Custom message\", \"my-plugin\");\n * ```\n */\nexport function log(message: string, label = INTEGRATION_NAME): void {\n  const timestamp = new Date().toLocaleTimeString(\"en-US\", {\n    hour12: false,\n    hour: \"2-digit\",\n    minute: \"2-digit\",\n    second: \"2-digit\",\n  });\n\n  console.log(\n    `${colorTimestamp(timestamp)} ${colorIntegration(`[${label}]`)} ${message}`\n  );\n}\n\n/**\n * Logs an error message with Astro-like formatting and standard error output.\n * @param error The error message to log.\n * @param label The label for the message, defaults to integration name\n * @example\n * ```ts\n * logError(\"Failed to load config\");\n * logError(\"Database connection failed\", \"db-plugin\");\n * ```\n */\nexport function logError(error: string, label = INTEGRATION_NAME): void {\n  const timestamp = new Date().toLocaleTimeString(\"en-US\", {\n    hour12: false,\n    hour: \"2-digit\",\n    minute: \"2-digit\",\n    second: \"2-digit\",\n  });\n\n  console.error(\n    `${colorTimestamp(timestamp)} ${colorIntegration(`[${label}]`)} ${colorErrorPrefix(`[ERROR]`)} ${colorError(error)}`\n  );\n}\n\n/**\n * Logs a warning message with Astro-like formatting.\n * @param message The warning message to log.\n * @param label The label for the message, defaults to integration name\n * @example\n * ```ts\n * logWarn(\"Deprecated feature used\");\n * logWarn(\"Missing translation file\", \"i18n-loader\");\n * ```\n */\nexport function logWarn(message: string, label = INTEGRATION_NAME): void {\n  const timestamp = new Date().toLocaleTimeString(\"en-US\", {\n    hour12: false,\n    hour: \"2-digit\",\n    minute: \"2-digit\",\n    second: \"2-digit\",\n  });\n\n  console.warn(\n    `${colorTimestamp(timestamp)} ${colorIntegration(`[${label}]`)} ${colorWarnPrefix(`[WARN]`)} ${colorWarn(message)}`\n  );\n}\n","import { existsSync, readFileSync, readdirSync, statSync } from \"fs\";\nimport { resolve } from \"pathe\";\nimport { logError, logWarn } from \"../logger\";\nimport {\n  IntegrationOptions,\n  IntegrationOptionsInternal,\n} from \"../types/integration\";\nimport type {\n  LocaleFileData,\n  TranslationContent,\n  TranslationMap,\n} from \"../types/translations\";\n\n/**\n * Loads a translation file for a specific locale and namespace\n */\nexport function loadTranslation(filePath: string): TranslationContent {\n  if (!existsSync(filePath)) {\n    logWarn(`Translation file not found: ${filePath}`);\n    return {};\n  }\n\n  try {\n    const content = readFileSync(filePath, \"utf-8\");\n    const parsed = JSON.parse(content) as string;\n\n    if (\n      typeof parsed !== \"object\" ||\n      parsed === null ||\n      Array.isArray(parsed)\n    ) {\n      logError(\n        `Invalid translation file format: ${filePath}\\n` +\n          `Expected JSON object, got ${typeof parsed}`\n      );\n      return {};\n    }\n\n    return parsed;\n  } catch (error) {\n    logError(\n      `Failed to parse translation file: ${filePath}. Original error: ${error instanceof Error ? error.message : String(error)}`\n    );\n    return {};\n  }\n}\n\n/**\n * Pre-loads all translations for server-side rendering\n */\nexport function loadAllTranslations(\n  srcDir: string,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n): TranslationMap {\n  const allTranslations: TranslationMap = {};\n  const localeFilesData = getAllFilePaths(\n    srcDir,\n    internalOptions,\n    i18nextOptions\n  );\n\n  for (const data of localeFilesData) {\n    if (allTranslations[data.locale] === undefined) {\n      allTranslations[data.locale] = {};\n    }\n\n    allTranslations[data.locale][data.namespace] = loadTranslation(data.path);\n  }\n\n  return allTranslations;\n}\n\n/**\n * Recursively scans a directory for JSON translation files\n */\nfunction scanDirectoryRecursively(\n  currentPath: string,\n  localeBasePath: string,\n  locale: string,\n  filePaths: LocaleFileData[]\n): void {\n  try {\n    const entries = readdirSync(currentPath);\n\n    for (const entry of entries) {\n      const entryPath = resolve(currentPath, entry);\n      const stats = statSync(entryPath);\n\n      if (stats.isDirectory()) {\n        // Recursively scan subdirectories\n        scanDirectoryRecursively(entryPath, localeBasePath, locale, filePaths);\n      } else if (entry.endsWith(\".json\")) {\n        // Calculate the namespace from the relative path\n        // e.g., if file is at locale/features/dashboard.json\n        // the namespace should be \"features.dashboard\"\n        const relativePath = entryPath.substring(localeBasePath.length + 1);\n        const pathParts = relativePath.split(/[/\\\\]/);\n\n        // Remove .json extension from the last part\n        pathParts[pathParts.length - 1] = pathParts[\n          pathParts.length - 1\n        ].replace(\".json\", \"\");\n\n        // Join with dots to create the namespace\n        const namespace = pathParts.join(\".\");\n\n        filePaths.push({ path: entryPath, locale, namespace });\n      }\n    }\n  } catch (_error) {\n    logWarn(`Failed to scan directory: ${currentPath}`);\n  }\n}\n\nexport function getAllFilePaths(\n  srcDir: string,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n) {\n  const filePaths: LocaleFileData[] = [];\n\n  if (\n    i18nextOptions.supportedLngs === false ||\n    i18nextOptions.supportedLngs === undefined\n  ) {\n    const translationDirPath = resolve(srcDir, internalOptions.translationsDir);\n\n    if (!existsSync(translationDirPath)) {\n      return filePaths;\n    }\n\n    try {\n      const localeEntries = readdirSync(translationDirPath);\n\n      for (const localeEntry of localeEntries) {\n        const localeDir = resolve(translationDirPath, localeEntry);\n\n        if (statSync(localeDir).isDirectory()) {\n          const locale = localeEntry;\n\n          // Recursively scan for JSON files with support for nested directories\n          scanDirectoryRecursively(localeDir, localeDir, locale, filePaths);\n        }\n      }\n    } catch (_error) {\n      logError(`Failed to scan translation directory: ${translationDirPath}`);\n      return filePaths;\n    }\n\n    return filePaths;\n  }\n\n  // Handle array supportedLngs (including empty arrays)\n  if (Array.isArray(i18nextOptions.supportedLngs)) {\n    // If namespaces are not explicitly configured, discover them from the file system\n    let namespaces: string[] = [];\n\n    if (i18nextOptions.ns === undefined) {\n      // Try to discover namespaces from the file system for each locale\n      const translationDirPath = resolve(\n        srcDir,\n        internalOptions.translationsDir\n      );\n      const discoveredNamespaces = new Set<string>();\n\n      for (const locale of i18nextOptions.supportedLngs) {\n        const localeDir = resolve(translationDirPath, locale);\n        if (existsSync(localeDir) && statSync(localeDir).isDirectory()) {\n          const tempFilePaths: LocaleFileData[] = [];\n          scanDirectoryRecursively(localeDir, localeDir, locale, tempFilePaths);\n          tempFilePaths.forEach(({ namespace }) =>\n            discoveredNamespaces.add(namespace)\n          );\n        }\n      }\n\n      namespaces = Array.from(discoveredNamespaces);\n\n      // If no namespaces discovered, use default\n      if (namespaces.length === 0) {\n        namespaces = [\"translation\"]; // i18next default\n      }\n    } else if (typeof i18nextOptions.ns === \"string\") {\n      namespaces = [i18nextOptions.ns];\n    } else if (Array.isArray(i18nextOptions.ns)) {\n      namespaces = i18nextOptions.ns;\n    }\n\n    for (const locale of i18nextOptions.supportedLngs) {\n      for (const namespace of namespaces) {\n        const filePath = getFilePath(\n          locale,\n          namespace,\n          srcDir,\n          internalOptions.translationsDir\n        );\n\n        filePaths.push({ path: filePath, locale, namespace });\n      }\n    }\n  }\n\n  return filePaths;\n}\n\nexport function getFilePath(\n  locale: string,\n  namespace: string,\n  srcDir: string,\n  translationDirectoryPath: string\n) {\n  // Handle nested namespaces with dot notation\n  // e.g., \"features.dashboard\" becomes \"features/dashboard.json\"\n  const namespacePath = namespace.replace(/\\./g, \"/\");\n\n  return resolve(\n    srcDir,\n    translationDirectoryPath,\n    `${locale}/${namespacePath}.json`\n  );\n}\n\n/**\n * Checks if a directory contains JSON files (recursively)\n */\nfunction hasJsonFilesRecursively(dirPath: string): boolean {\n  try {\n    const entries = readdirSync(dirPath);\n\n    for (const entry of entries) {\n      const entryPath = resolve(dirPath, entry);\n      const stats = statSync(entryPath);\n\n      if (stats.isDirectory()) {\n        // Recursively check subdirectories\n        if (hasJsonFilesRecursively(entryPath)) {\n          return true;\n        }\n      } else if (entry.endsWith(\".json\")) {\n        return true;\n      }\n    }\n\n    return false;\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Discovers all available languages in the translations directory\n */\nexport function discoverAvailableLanguages(\n  srcDir: string,\n  translationsDir: string\n): string[] {\n  const translationDirPath = resolve(srcDir, translationsDir);\n\n  if (!existsSync(translationDirPath)) {\n    logWarn(`Translation directory not found: ${translationDirPath}`);\n    return [];\n  }\n\n  try {\n    const localeEntries = readdirSync(translationDirPath);\n    const availableLocales: string[] = [];\n\n    for (const localeEntry of localeEntries) {\n      const localeDir = resolve(translationDirPath, localeEntry);\n\n      if (statSync(localeDir).isDirectory()) {\n        // Verify this locale directory contains at least one .json file (checking recursively)\n        if (hasJsonFilesRecursively(localeDir)) {\n          availableLocales.push(localeEntry);\n        }\n      }\n    }\n\n    return availableLocales;\n  } catch (_error) {\n    logError(`Failed to scan translation directory: ${translationDirPath}`);\n    return [];\n  }\n}\n","import {\n  IntegrationOptionsInternal,\n  IntegrationOptions,\n} from \"../types/integration\";\nimport type { InitOptions } from \"i18next\";\n\n/**\n * Generates the client-side initialization script with SSR hydration support\n */\nexport function generateClientScript(\n  baseConfig: Partial<InitOptions>,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n): string {\n  return `\n    import i18next from \"i18next\";\n    import LanguageDetector from \"i18next-browser-languagedetector\";\n    \n    // CRITICAL: Read server state synchronously (react-i18next SSR pattern)\n    const initialI18nStore = typeof window !== 'undefined' ? window.__initialI18nStore__ : null;\n    const initialLanguage = typeof window !== 'undefined' ? window.__initialLanguage__ : null;\n    \n    if (initialI18nStore && initialLanguage) {\n      // SYNCHRONOUS initialization with exact server resources\n      i18next.init({\n        ...${JSON.stringify(baseConfig)},\n        lng: initialLanguage,\n        resources: initialI18nStore,\n        initImmediate: false,  // CRITICAL: Synchronous initialization\n        fallbackLng: false,\n        integrationOptions: ${JSON.stringify({ ...internalOptions, ...i18nextOptions })}\n      }).then(() => {\n        setupTranslationWrapper();\n        setupDynamicLoading();\n      }).catch(err => console.error('[ASTRO-I18N] SSR hydration initialization failed:', err));\n      \n    } else {\n      // Fallback: Dynamic loading for non-SSR or missing server data\n      const dynamicBackend = {\n        type: 'backend',\n        init: function() {},\n        read: async function(language, namespace, callback) {\n          try {\n            const { loadTranslation } = await import('virtual:i18n-loader');\n            const data = await loadTranslation(language, namespace);\n            callback(null, data);\n          } catch (err) {\n            console.warn(\\`Failed to load \\${language}/\\${namespace}:\\`, err);\n            callback(null, {});\n          }\n        }\n      };\n      \n      i18next\n        .use(LanguageDetector)\n        .use(dynamicBackend)\n        .init({\n          ...${JSON.stringify(baseConfig)},\n          fallbackLng: false,\n          initImmediate: true,\n          detection: {\n            order: [\"htmlTag\", \"path\"],\n            lookupFromPathIndex: 0,\n            caches: []\n          },\n          load: 'currentOnly',\n          partialBundledLanguages: true,\n          integrationOptions: ${JSON.stringify({ ...internalOptions, ...i18nextOptions })}\n        }).then(() => {\n          setupTranslationWrapper();\n          setupDynamicLoading();\n        }).catch(err => console.error('Dynamic initialization failed:', err));\n    }\n    \n    // Setup translation wrapper with dev warnings\n    function setupTranslationWrapper() {\n      const originalT = i18next.t;\n      i18next.t = function (...args) {\n        const key = args[0];\n        const lastArg = args[args.length - 1];\n        const options = typeof lastArg === 'object' && lastArg !== null ? lastArg : undefined;\n        let namespace;\n\n        if (typeof key === 'string' && key.includes(':')) {\n          namespace = key.split(':')[0];\n        } else if (options && 'ns' in options && typeof options.ns === 'string') {\n          namespace = options.ns;\n        }\n\n        if (import.meta.env.DEV && namespace) {\n          const currentLanguage = i18next.language;\n          if (!i18next.hasResourceBundle(currentLanguage, namespace)) {\n            console.warn(\n              \\`Warning: Translation key \"\\${String(key)}\" is being accessed \\` +\n              \\`for namespace \"\\${namespace}\" in locale \"\\${currentLanguage}\", \\` +\n              \\`but this namespace is not currently loaded. Ensure '\\${namespace}' is loaded \\` +\n              \\`using 'loadNamespacesForRoute' or 'useLoadNamespaces'.\\`\n            );\n          }\n        }\n\n        return originalT.apply(this, args);\n      };\n    }\n    \n    // Setup dynamic loading functions for SPA navigation\n    function setupDynamicLoading() {\n      window.__i18nLoadNamespaces = async function(namespaces) {\n        const currentLang = i18next.language${baseConfig.lng ? ` || '${baseConfig.lng}'` : \"\"};\n        const promises = namespaces.map(ns => \n          new Promise((resolve) => {\n            if (i18next.hasResourceBundle(currentLang, ns)) {\n              resolve(null);\n            } else {\n              i18next.loadNamespaces(ns, resolve);\n            }\n          })\n        );\n        await Promise.all(promises);\n      };\n    }\n  `;\n}\n","import { INTEGRATION_NAME } from \"../constants\";\nimport type {\n  IntegrationOptionsInternal,\n  IntegrationOptions,\n} from \"../types/integration\";\nimport type { TranslationMap } from \"../types/translations\";\nimport type { InitOptions } from \"i18next\";\n\n/**\n * Generates the server-side initialization script\n */\nexport function generateServerScript(\n  baseConfig: Partial<InitOptions>,\n  allTranslations: TranslationMap,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n): string {\n  return `\n    import i18next from \"i18next\";\n    \n    const resources = ${JSON.stringify(allTranslations)};\n    const usedNamespaces = new Set();\n    \n    i18next.init({\n      ...${JSON.stringify(baseConfig)},\n      resources,\n      initImmediate: true,\n      integrationOptions: ${JSON.stringify({ ...internalOptions, ...i18nextOptions })}\n    }).then(() => {\n      // Track namespace usage during SSR\n      const originalT = i18next.t;\n      i18next.t = function(...args) {\n        const key = args[0];\n        const lastArg = args[args.length - 1];\n        const options = typeof lastArg === 'object' && lastArg !== null ? lastArg : undefined;\n        \n        let namespace;\n        if (typeof key === 'string' && key.includes(':')) {\n          namespace = key.split(':')[0];\n        } else if (options && 'ns' in options && typeof options.ns === 'string') {\n          namespace = options.ns;\n        } else {\n          namespace = '${baseConfig.defaultNS || \"translation\"}';\n        }\n        \n        if (namespace) {\n          usedNamespaces.add(namespace);\n        }\n        \n        return originalT.apply(this, args);\n      };\n      \n      // CRITICAL: Serialize exact server state for client hydration\n      if (typeof window !== 'undefined') {\n        const currentLang = i18next.language;\n        \n        // Extract ONLY the resources that were actually used during SSR\n        const usedResources = {};\n        usedNamespaces.forEach(ns => {\n          if (resources[currentLang] && resources[currentLang][ns]) {\n            if (!usedResources[currentLang]) usedResources[currentLang] = {};\n            usedResources[currentLang][ns] = resources[currentLang][ns];\n          }\n        });\n        \n        // Serialize for synchronous client initialization (react-i18next SSR pattern)\n        window.__initialI18nStore__ = usedResources;\n        window.__initialLanguage__ = currentLang;\n      }\n    }).catch(err => console.error('[${INTEGRATION_NAME}] Server initialization failed:', err));\n  `;\n}\n","import type { IntegrationOptionsInternal } from \"../types/integration\";\nimport type { TranslationMap } from \"../types/translations\";\nimport type { InitOptions } from \"i18next\";\n\n/**\n * Generates an inline script for SSG pages that serializes all possible translations\n * This runs immediately when the HTML loads, before React hydration\n */\nexport function generateSSGSerializationScript(\n  baseConfig: Partial<InitOptions>,\n  allTranslations: TranslationMap,\n  _internalOptions: IntegrationOptionsInternal\n): string {\n  // For SSG, we need to be more aggressive and serialize more data upfront\n  // since we can't track usage during runtime\n\n  const supportedLanguages =\n    baseConfig.supportedLngs || Object.keys(allTranslations);\n  const defaultNamespace = baseConfig.defaultNS || \"translation\";\n  const namespaces = baseConfig.ns || [defaultNamespace];\n\n  return `\n    // CRITICAL: Detect language from current URL/HTML for SSG pages\n    (function() {\n      const detectSSGLanguage = function() {\n        // Try path-based detection first  \n        const pathMatch = window.location.pathname.match(/^\\\\/([a-z]{2}(?:-[A-Z]{2})?)/);\n        if (pathMatch) {\n          const detectedLang = pathMatch[1];\n          const supportedLangs = ${JSON.stringify(supportedLanguages)};\n          if (supportedLangs.includes(detectedLang)) {\n            return detectedLang;\n          }\n        }\n\n        // Try HTML lang attribute\n        const htmlLang = document.documentElement.lang;\n        if (htmlLang) {\n          const supportedLangs = ${JSON.stringify(supportedLanguages)};\n          if (supportedLangs.includes(htmlLang)) {\n            return htmlLang;\n          }\n        }\n\n        // Fallback to default\n        return \"${baseConfig.lng || supportedLanguages[0]}\";\n      };\n\n      const currentLanguage = detectSSGLanguage();\n      const allTranslations = ${JSON.stringify(allTranslations)};\n      const expectedNamespaces = ${JSON.stringify(namespaces)};\n\n      // Extract resources for the detected language and expected namespaces\n      const ssgResources = {};\n      if (allTranslations[currentLanguage]) {\n        ssgResources[currentLanguage] = {};\n        expectedNamespaces.forEach(function(ns) {\n          if (allTranslations[currentLanguage][ns]) {\n            ssgResources[currentLanguage][ns] = allTranslations[currentLanguage][ns];\n          }\n        });\n      }\n\n      // Serialize for synchronous client access\n      window.__initialI18nStore__ = ssgResources;\n      window.__initialLanguage__ = currentLanguage;\n    })();\n  `;\n}\n","function mergeResources(namespaces) {\n  return namespaces.reduce((prev, cur) => {\n    prev[cur.name] = cur.resources;\n    return prev;\n  }, {});\n}\n\nexport { mergeResources as default };\n","import mergeResources from './mergeResources.js';\n\nfunction mergeResourcesAsInterface(namespaces) {\n  const resources = mergeResources(namespaces);\n  let interfaceFileContent = 'interface Resources ';\n  interfaceFileContent += JSON.stringify(resources, null, 2);\n  interfaceFileContent += '\\n\\nexport default Resources;\\n';\n  return interfaceFileContent;\n}\n\nexport { mergeResourcesAsInterface as default };\n","import * as fs from \"fs\";\nimport { mergeResourcesAsInterface } from \"i18next-resources-for-ts\";\nimport { join } from \"node:path\";\nimport { relative, resolve } from \"pathe\";\nimport { log } from \"../logger\";\nimport {\n  IntegrationOptions,\n  IntegrationOptionsInternal,\n} from \"../types/integration\";\nimport { TranslationMap } from \"../types/translations\";\n\nfunction toNamespaceArray(translationMap: TranslationMap, lng?: string) {\n  // Determine which locale to use for type generation\n  // If lng is 'cimode' or undefined, use the first available language\n  const localeForTypes =\n    !lng || lng === \"cimode\" ? Object.keys(translationMap)[0] : lng;\n\n  return Object.entries(translationMap[localeForTypes]).map(\n    ([namespaceKey, resources]) => ({\n      name: namespaceKey,\n      resources,\n    })\n  );\n}\n\nexport function generateTypescriptDefinitions(\n  namespaces: TranslationMap,\n  outputDirPath: string,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n) {\n  try {\n    const INTERFACE_OUTPUT_FILE = join(\n      resolve(outputDirPath, internalOptions.generatedTypes.dirPath),\n      `${internalOptions.generatedTypes.fileName}.d.ts`\n    );\n\n    const typeDefinitionFile = mergeResourcesAsInterface(\n      toNamespaceArray(namespaces, i18nextOptions.lng)\n    );\n\n    const final = `\nimport \"i18next\";\n\ndeclare module \"i18next\" {\n  interface CustomTypeOptions {\n    defaultNS: \"${i18nextOptions.defaultNS === false ? \"false\" : i18nextOptions.defaultNS || \"translation\"}\";\n    resources: Resources;\n  }\n}\n\n${typeDefinitionFile}\n`;\n\n    const namespacesLength = Object.keys(Object.values(namespaces)[0]).length;\n    const RELATIVE_OUTPUT_PATH = relative(process.cwd(), INTERFACE_OUTPUT_FILE);\n    fs.writeFileSync(INTERFACE_OUTPUT_FILE, final, {\n      encoding: \"utf-8\",\n      flag: \"w\",\n    });\n\n    log(\n      `Created interface file for ${namespacesLength !== undefined ? namespacesLength : 0} namespaces: ${RELATIVE_OUTPUT_PATH}`\n    );\n  } catch (error) {\n    log(` Failed to create interface resources file: ${error}`);\n  }\n}\n","import { IntegrationOptions } from \"./types/integration\";\n\nexport class I18nConfigError extends Error {\n  constructor(\n    message: string,\n    public field?: string\n  ) {\n    super(message);\n    this.name = \"I18nConfigError\";\n  }\n}\n\nexport function validateOptions(options: IntegrationOptions): void {\n  if (!options) {\n    throw new I18nConfigError(\"Integration options are required\");\n  }\n}\n","import { INTEGRATION_NAME } from \"./constants\";\nimport {\n  discoverAvailableLanguages,\n  getAllFilePaths,\n  getFilePath,\n  loadTranslation,\n} from \"./loader/translation-loader\";\nimport type {\n  IntegrationOptions,\n  IntegrationOptionsInternal,\n} from \"./types/integration\";\n\n/**\n * Creates a Vite plugin for handling i18n virtual modules\n */\nexport function createI18nVitePlugin(\n  srcDir: string,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n) {\n  return {\n    name: \"i18n-virtual-modules\",\n    resolveId(id: string) {\n      if (id === \"virtual:i18n-loader\") return id;\n\n      const match = id.match(/^virtual:i18n-translation:(.+)\\/(.+)$/);\n      if (match) return id;\n\n      // Use double underscore as separator to avoid conflicts with dashes in namespaces\n      const virtualMatch = id.match(/^\\.?\\/virtual-i18n-(.+?)__(.+)\\.js$/);\n      if (virtualMatch) {\n        // Convert back dots for nested namespaces (e.g., features.dashboard)\n        const locale = virtualMatch[1];\n        const namespace = virtualMatch[2];\n        return `virtual:i18n-translation:${locale}/${namespace}`;\n      }\n\n      return null;\n    },\n    load(id: string) {\n      if (id === \"virtual:i18n-loader\") {\n        return generateDynamicTranslationLoader(\n          srcDir,\n          internalOptions,\n          i18nextOptions\n        );\n      }\n\n      const match = id.match(/^virtual:i18n-translation:(.+)\\/(.+)$/);\n      if (match) {\n        const [, locale, namespace] = match;\n        const translation = loadTranslation(\n          getFilePath(\n            locale,\n            namespace,\n            srcDir,\n            internalOptions.translationsDir\n          )\n        );\n        return `export default ${JSON.stringify(translation)};`;\n      }\n\n      return null;\n    },\n  };\n}\n\nfunction generateDynamicTranslationLoader(\n  srcDir: string,\n  internalOptions: IntegrationOptionsInternal,\n  i18nextOptions: IntegrationOptions[\"i18NextOptions\"]\n): string {\n  const importMap: string[] = [];\n  const caseStatements: string[] = [];\n\n  // Handle different supportedLngs values:\n  // - false/undefined: support all found languages (would need discovery logic)\n  // - []: support no languages\n  // - array with items: support those specific languages\n  let locales: string[] = [];\n  let namespaces: string[] = [];\n\n  if (\n    i18nextOptions.supportedLngs === false ||\n    i18nextOptions.supportedLngs === undefined\n  ) {\n    // Automatically discover languages and namespaces from translations directory\n    locales = discoverAvailableLanguages(\n      srcDir,\n      internalOptions.translationsDir\n    );\n\n    // Discover all namespaces from the file system for automatic discovery\n    const allFilePaths = getAllFilePaths(\n      srcDir,\n      internalOptions,\n      i18nextOptions\n    );\n\n    const discoveredNamespaces = new Set<string>();\n\n    allFilePaths.forEach(({ namespace }) =>\n      discoveredNamespaces.add(namespace)\n    );\n\n    namespaces = Array.from(discoveredNamespaces);\n\n    // If no namespaces found, fall back to configured or default\n    if (namespaces.length === 0) {\n      if (i18nextOptions.ns === undefined) {\n        namespaces = [\"translation\"]; // i18next default\n      } else if (typeof i18nextOptions.ns === \"string\") {\n        namespaces = [i18nextOptions.ns];\n      } else if (Array.isArray(i18nextOptions.ns)) {\n        namespaces = i18nextOptions.ns;\n      }\n    }\n  } else if (Array.isArray(i18nextOptions.supportedLngs)) {\n    locales = i18nextOptions.supportedLngs;\n\n    // For explicit locales, discover or use configured namespaces\n    if (i18nextOptions.ns === undefined) {\n      // Try to discover namespaces from the file system\n      const allFilePaths = getAllFilePaths(\n        srcDir,\n        internalOptions,\n        i18nextOptions\n      );\n      const discoveredNamespaces = new Set<string>();\n      allFilePaths.forEach(({ namespace }) =>\n        discoveredNamespaces.add(namespace)\n      );\n      namespaces = Array.from(discoveredNamespaces);\n\n      // If no namespaces discovered, use default\n      if (namespaces.length === 0) {\n        namespaces = [\"translation\"]; // i18next default\n      }\n    } else if (typeof i18nextOptions.ns === \"string\") {\n      namespaces = [i18nextOptions.ns];\n    } else if (Array.isArray(i18nextOptions.ns)) {\n      namespaces = i18nextOptions.ns;\n    }\n  }\n\n  locales.forEach((locale) => {\n    namespaces.forEach((namespace) => {\n      // Replace dots and dashes with underscores for variable names\n      const importVar = `${locale}_${namespace}`.replace(/[^a-zA-Z0-9_]/g, \"_\");\n      // Use double underscore separator to avoid conflicts with dashes in namespaces\n      importMap.push(\n        `const ${importVar} = () => import('./virtual-i18n-${locale}__${namespace}.js');`\n      );\n      caseStatements.push(\n        `    case '${locale}/${namespace}': return (await ${importVar}()).default || {};`\n      );\n    });\n  });\n\n  return `\n${importMap.join(\"\\n\")}\n\nexport async function loadTranslation(locale, namespace) {\n  try {\n    const key = \\`\\${locale}/\\${namespace}\\`;\n    switch (key) {\n${caseStatements.join(\"\\n\")}\n      default:\n        console.warn(\\`[${INTEGRATION_NAME}] Unknown translation: \\${locale}/\\${namespace}\\`);\n        return {};\n    }\n  } catch (err) {\n    console.warn(\\`[${INTEGRATION_NAME}] Failed to load translation \\${locale}/\\${namespace}:\\`, err);\n    return {};\n  }\n}\n\n// Helper to preload specific namespaces\nexport async function preloadNamespaces(locale, namespaces) {\n  const promises = namespaces.map(ns => loadTranslation(locale, ns));\n  return Promise.all(promises);\n}\n\n// Available locales and namespaces for validation\nexport const availableLocales = ${JSON.stringify(locales)};\nexport const availableNamespaces = ${JSON.stringify(namespaces)};\n`;\n}\n","import type { AstroIntegration } from \"astro\";\nimport { applyInternalDefaults } from \"./config\";\nimport { INTEGRATION_NAME } from \"./constants\";\nimport {\n  getAllFilePaths,\n  loadAllTranslations,\n} from \"./loader/translation-loader\";\nimport { generateClientScript } from \"./scripts/client\";\nimport { generateServerScript } from \"./scripts/server\";\nimport { generateSSGSerializationScript } from \"./scripts/ssg\";\nimport type { IntegrationOptions } from \"./types/integration\";\nimport { generateTypescriptDefinitions } from \"./utils/type-generation\";\nimport { validateOptions } from \"./validation\";\nimport { createI18nVitePlugin } from \"./vite-plugin\";\n\n/**\n * Creates an Astro integration for i18next internationalization\n */\nexport function i18nIntegration(options: IntegrationOptions): AstroIntegration {\n  return {\n    name: INTEGRATION_NAME,\n    hooks: {\n      \"astro:config:setup\": async ({\n        config,\n        injectScript,\n        addWatchFile,\n        updateConfig,\n        addMiddleware,\n      }) => {\n        try {\n          validateOptions(options);\n          const internalOptions = applyInternalDefaults(options);\n\n          const allTranslations = loadAllTranslations(\n            config.srcDir.pathname,\n            internalOptions,\n            options.i18NextOptions\n          );\n\n          updateConfig({\n            vite: {\n              plugins: [\n                createI18nVitePlugin(\n                  config.srcDir.pathname,\n                  internalOptions,\n                  options.i18NextOptions\n                ),\n              ],\n            },\n          });\n\n          injectScript(\n            \"page-ssr\",\n            generateServerScript(\n              options.i18NextOptions,\n              allTranslations,\n              internalOptions,\n              options.i18NextOptions\n            )\n          );\n\n          // CRITICAL: For SSG pages, inject inline serialization script first\n          injectScript(\n            \"head-inline\",\n            generateSSGSerializationScript(\n              options.i18NextOptions,\n              allTranslations,\n              internalOptions\n            )\n          );\n\n          injectScript(\n            \"before-hydration\",\n            generateClientScript(\n              options.i18NextOptions,\n              internalOptions,\n              options.i18NextOptions\n            )\n          );\n\n          generateTypescriptDefinitions(\n            allTranslations,\n            config.srcDir.pathname,\n            internalOptions,\n            options.i18NextOptions\n          );\n\n          addMiddleware({\n            entrypoint: `${INTEGRATION_NAME}/middleware`,\n            order: \"post\",\n          });\n\n          const translationsData = getAllFilePaths(\n            config.srcDir.pathname,\n            internalOptions,\n            options.i18NextOptions\n          );\n\n          translationsData.forEach(({ path }) => addWatchFile(path));\n        } catch (error) {\n          if (error instanceof Error) {\n            throw new Error(\n              `[${INTEGRATION_NAME}] Configuration error: ${error.message}`\n            );\n          }\n          throw error;\n        }\n      },\n    },\n  };\n}\n"]}