{"version":3,"file":"index.mjs","names":["extractCssinjsStyle"],"sources":["../../../src/static-css/runtime/index.ts"],"sourcesContent":["import { extractStyle as extractCssinjsStyle } from '@ant-design/cssinjs';\n\nimport { styleKeysOf } from '../shared';\n\ninterface CssinjsCache {\n  cache: Map<string, unknown>;\n  extracted: Set<string>;\n  updateTimes: Map<string, number>;\n}\n\nexport interface InlineAntdStyleResult {\n  css: string;\n  /** css wrapped in a prepend-ordered style tag, '' when empty */\n  html: string;\n  /** probe-uncovered components whose rules fell back inline */\n  uncovered: string[];\n}\n\n// Replaces antd-style's inline antd entry: component css-var blocks always stay\n// inline (their values are the light-theme truth for this render), while style\n// rules ship via the static stylesheet — except components the probe set missed,\n// which fall back to inline rules.\nexport const buildInlineAntdStyle = (\n  runtimeCache: unknown,\n  payload: { styleKeys: Iterable<string> },\n): InlineAntdStyleResult => {\n  const staticKeys =\n    payload.styleKeys instanceof Set ? payload.styleKeys : new Set(payload.styleKeys);\n  const cssinjsCache = runtimeCache as CssinjsCache;\n\n  const cssVarCss = extractCssinjsStyle(cssinjsCache as never, {\n    plain: true,\n    types: ['cssVar'],\n  });\n\n  const uncoveredKeys = styleKeysOf(cssinjsCache).filter((key) => !staticKeys.has(key));\n  let uncoveredCss = '';\n  if (uncoveredKeys.length > 0) {\n    const pseudoCache = {\n      cache: new Map(uncoveredKeys.map((key) => [key, cssinjsCache.cache.get(key)])),\n      extracted: new Set<string>(),\n      updateTimes: cssinjsCache.updateTimes,\n    };\n    uncoveredCss = extractCssinjsStyle(pseudoCache as never, { plain: true, types: ['style'] });\n  }\n\n  const css = cssVarCss + uncoveredCss;\n\n  return {\n    css,\n    html: css ? `<style data-rc-order=\"prepend\" data-rc-priority=\"-9999\">${css}</style>` : '',\n    uncovered: uncoveredKeys.map((key) => key.split('%')[2] ?? key),\n  };\n};\n"],"mappings":";;;AAsBA,MAAa,wBACX,cACA,YAC0B;CAC1B,MAAM,aACJ,QAAQ,qBAAqB,MAAM,QAAQ,YAAY,IAAI,IAAI,QAAQ,SAAS;CAClF,MAAM,eAAe;CAErB,MAAM,YAAYA,aAAoB,cAAuB;EAC3D,OAAO;EACP,OAAO,CAAC,QAAQ;CAClB,CAAC;CAED,MAAM,gBAAgB,YAAY,YAAY,CAAC,CAAC,QAAQ,QAAQ,CAAC,WAAW,IAAI,GAAG,CAAC;CACpF,IAAI,eAAe;CACnB,IAAI,cAAc,SAAS,GAAG;EAC5B,MAAM,cAAc;GAClB,OAAO,IAAI,IAAI,cAAc,KAAK,QAAQ,CAAC,KAAK,aAAa,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC;GAC7E,2BAAW,IAAI,IAAY;GAC3B,aAAa,aAAa;EAC5B;EACA,eAAeA,aAAoB,aAAsB;GAAE,OAAO;GAAM,OAAO,CAAC,OAAO;EAAE,CAAC;CAC5F;CAEA,MAAM,MAAM,YAAY;CAExB,OAAO;EACL;EACA,MAAM,MAAM,2DAA2D,IAAI,YAAY;EACvF,WAAW,cAAc,KAAK,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG;CAChE;AACF"}