{"version":3,"sources":["../src/runtime-tokens.ts"],"names":[],"mappings":";;;AAaO,IAAM,iBAAA,GACX;AAEK,SAAS,wBAAA,CAAyB,OAAe,iBAAA,EAAyB;AAC/E,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,MAAM,WAAW,QAAA,CAAS,aAAA;AAAA,IACxB,CAAA,0CAAA;AAAA,GACF;AACA,EAAA,MAAM,IAAA,GAAO,QAAA,IAAY,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA;AACtD,EAAA,IAAA,CAAK,GAAA,GAAM,YAAA;AACX,EAAA,IAAI,CAAC,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,IAAA;AAG3B,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAChC","file":"runtime-tokens.cjs","sourcesContent":["// Runtime Brand tokens — the loader every app shares.\n//\n// Global-Rules (\"Consume Brand tokens at RUNTIME, never baked in at build time\")\n// requires each app to load specs.politogyvrm.com/api/tokens?format=css so a\n// Brand edit goes live without a redeploy. A static <link> in <head> is not\n// enough on its own: the app's own bundled chrome.css can be injected AFTER it\n// and win the cascade, which is exactly what happened on VRM — it linked the\n// runtime sheet yet still resolved --color-accent from the build-time snapshot.\n//\n// Appending the link to the END of <head> at startup makes the runtime sheet the\n// last stylesheet, so the live Brand values win every time. Idempotent: an\n// existing runtime link is MOVED to the end rather than duplicated.\n\nexport const SPECS_TOKENS_HREF =\n  'https://specs.politogyvrm.com/api/tokens?format=css'\n\nexport function ensureRuntimeBrandTokens(href: string = SPECS_TOKENS_HREF): void {\n  if (typeof document === 'undefined') return\n  const existing = document.querySelector<HTMLLinkElement>(\n    `link[rel=\"stylesheet\"][href*=\"api/tokens\"]`,\n  )\n  const link = existing ?? document.createElement('link')\n  link.rel = 'stylesheet'\n  if (!existing) link.href = href\n  // Re-appending an already-present node moves it; the browser does not refetch\n  // (and the response is ETag + max-age=60 cached regardless).\n  document.head.appendChild(link)\n}\n"]}