@fluentic/style 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/CHANGELOG.md +26 -17
  2. package/README.md +80 -23
  3. package/compiler/compiler/types.ts +0 -1
  4. package/compiler/transform/evaluator/evaluator.ts +2 -0
  5. package/compiler/transform/evaluator/tracer.ts +11 -1
  6. package/compiler/transform/extract/chain/chain.ts +7 -4
  7. package/compiler/transform/extract/plugin.ts +1 -1
  8. package/compiler/transform/extract/utils/state.ts +1 -0
  9. package/compiler/utils/constants.ts +0 -4
  10. package/config/build.ts +12 -2
  11. package/config/config/debug.ts +13 -1
  12. package/config/config/dev.ts +8 -0
  13. package/config/configure.ts +10 -2
  14. package/dev/config.ts +2 -3
  15. package/dist/{className-W2kDyeVl.js → className-CKo4TxuT.js} +2 -2
  16. package/dist/{className-W2kDyeVl.js.map → className-CKo4TxuT.js.map} +1 -1
  17. package/dist/{className-Cuh2JNxO.js → className-ZJ5pBA-o.js} +4 -4
  18. package/dist/{className-Cuh2JNxO.js.map → className-ZJ5pBA-o.js.map} +1 -1
  19. package/dist/compiler/index.mjs +1 -1
  20. package/dist/{compiler-BXcGyZUP.mjs → compiler-D5v5tJXI.mjs} +56 -57
  21. package/dist/compiler-D5v5tJXI.mjs.map +1 -0
  22. package/dist/config/index.js +2 -2
  23. package/dist/{config-CLYMN3_p.js → config-BEvP7108.js} +11 -4
  24. package/dist/config-BEvP7108.js.map +1 -0
  25. package/dist/config-B_cbG3S6.js +1 -0
  26. package/dist/{config-C1k9vUrM.js → config-FIfi5aJ8.js} +4 -4
  27. package/dist/{config-C1k9vUrM.js.map → config-FIfi5aJ8.js.map} +1 -1
  28. package/dist/config-OXHoDUIo.js +6 -0
  29. package/dist/{config-DcYrUB-M.js.map → config-OXHoDUIo.js.map} +1 -1
  30. package/dist/{css-CohHH2tn.js → css-DcuJ_jSH.js} +3 -3
  31. package/dist/{css-CohHH2tn.js.map → css-DcuJ_jSH.js.map} +1 -1
  32. package/dist/{css-DfH4Gb1c.js → css-dPoZJDQH.js} +5 -3
  33. package/dist/css-dPoZJDQH.js.map +1 -0
  34. package/dist/{css-D_DL1yOz.js → css-oOt6ZR54.js} +4 -4
  35. package/dist/{css-D_DL1yOz.js.map → css-oOt6ZR54.js.map} +1 -1
  36. package/dist/css.js +1 -1
  37. package/dist/{css_extra-9BZ_jVET.js → css_extra-DeTuIlcO.js} +2 -2
  38. package/dist/{css_extra-9BZ_jVET.js.map → css_extra-DeTuIlcO.js.map} +1 -1
  39. package/dist/{data-Ze8GNiJm.js → data-CeYstKMP.js} +6 -7
  40. package/dist/{data-Ze8GNiJm.js.map → data-CeYstKMP.js.map} +1 -1
  41. package/dist/{debug-DLmUG3Vh.js → debug-D96KGgpH.js} +2 -2
  42. package/dist/{debug-DLmUG3Vh.js.map → debug-D96KGgpH.js.map} +1 -1
  43. package/dist/dev/rsc.js +9 -9
  44. package/dist/{dev-C2u78xuv.js → dev-fOtWB5K3.js} +6 -7
  45. package/dist/{dev-C2u78xuv.js.map → dev-fOtWB5K3.js.map} +1 -1
  46. package/dist/{dev-4TqJORRn.js → dev-p8tW7X-A.js} +9 -3
  47. package/dist/dev-p8tW7X-A.js.map +1 -0
  48. package/dist/dev.js +1 -1
  49. package/dist/{elementMarker-BKzZyg5V.js → elementMarker-CvqqIb7J.js} +5 -5
  50. package/dist/{elementMarker-BKzZyg5V.js.map → elementMarker-CvqqIb7J.js.map} +1 -1
  51. package/dist/entry/dev/css.js +2 -2
  52. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  53. package/dist/entry/dev/jsx-runtime.js +2 -2
  54. package/dist/entry/dev.js +7 -7
  55. package/dist/entry/prod/css.js +2 -2
  56. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  57. package/dist/entry/prod/jsx-runtime.js +2 -2
  58. package/dist/entry/prod/runtime.js +4 -4
  59. package/dist/entry/prod.js +6 -6
  60. package/dist/entry/rsc-dev/css.js +2 -2
  61. package/dist/entry/rsc-dev/dev.js +4 -5
  62. package/dist/entry/rsc-dev/dev.js.map +1 -1
  63. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  64. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  65. package/dist/entry/rsc-dev.js +5 -6
  66. package/dist/entry/rsc-dev.js.map +1 -1
  67. package/dist/entry/rsc-prod/css.js +2 -2
  68. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  69. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  70. package/dist/entry/rsc-prod/runtime.js +4 -4
  71. package/dist/entry/rsc-prod.js +6 -6
  72. package/dist/extract-DeOytHKW.js +2 -0
  73. package/dist/{getClassName-C6690_nr.js → getClassName-oiQ8CnkS.js} +3 -3
  74. package/dist/{getClassName-C6690_nr.js.map → getClassName-oiQ8CnkS.js.map} +1 -1
  75. package/dist/{global-C7GsCW6Y.js → global-Cul1dX8k.js} +2 -2
  76. package/dist/{global-C7GsCW6Y.js.map → global-Cul1dX8k.js.map} +1 -1
  77. package/dist/index.js +5 -5
  78. package/dist/jsx/jsx-dev-runtime.js +2 -2
  79. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  80. package/dist/jsx/jsx-runtime.js +2 -2
  81. package/dist/jsx/jsx-runtime.server.js +1 -1
  82. package/dist/{jsx-DsMajv_M.js → jsx-A4cK517J.js} +7 -7
  83. package/dist/{jsx-DsMajv_M.js.map → jsx-A4cK517J.js.map} +1 -1
  84. package/dist/{jsx-Berx-L-r.js → jsx-Ba-XV33u.js} +3 -3
  85. package/dist/{jsx-Berx-L-r.js.map → jsx-Ba-XV33u.js.map} +1 -1
  86. package/dist/{jsx_dev_runtime-DXlSD6kV.js → jsx_dev_runtime-BQcRzl5D.js} +2 -2
  87. package/dist/{jsx_dev_runtime-DXlSD6kV.js.map → jsx_dev_runtime-BQcRzl5D.js.map} +1 -1
  88. package/dist/{jsx_runtime-DPWo5qvV.js → jsx_runtime-B9KEoAQN.js} +2 -2
  89. package/dist/{jsx_runtime-DPWo5qvV.js.map → jsx_runtime-B9KEoAQN.js.map} +1 -1
  90. package/dist/{jsx_runtime-CMdEXGNZ.js → jsx_runtime-BXcbW8Yp.js} +2 -2
  91. package/dist/{jsx_runtime-CMdEXGNZ.js.map → jsx_runtime-BXcbW8Yp.js.map} +1 -1
  92. package/dist/{layer-DiNeeTgG.js → layer-CbQzwZF-.js} +3 -3
  93. package/dist/{layer-DiNeeTgG.js.map → layer-CbQzwZF-.js.map} +1 -1
  94. package/dist/{loader-DCT1Q9yi.mjs → loader-BAth2yZ1.mjs} +3 -3
  95. package/dist/{loader-DCT1Q9yi.mjs.map → loader-BAth2yZ1.mjs.map} +1 -1
  96. package/dist/{misc-o8pviMUi.mjs → misc-DFBKJGLT.mjs} +2 -2
  97. package/dist/{misc-o8pviMUi.mjs.map → misc-DFBKJGLT.mjs.map} +1 -1
  98. package/dist/plugin/farm/index.mjs +2 -2
  99. package/dist/plugin/nextjs/index.mjs +4 -4
  100. package/dist/plugin/nextjs/loader.mjs +4 -4
  101. package/dist/plugin/parcel/optimizer.cjs +1 -1
  102. package/dist/plugin/parcel/optimizer.mjs +2 -2
  103. package/dist/plugin/parcel/resolver.cjs +1 -1
  104. package/dist/plugin/parcel/resolver.mjs +2 -2
  105. package/dist/plugin/parcel/runtime.cjs +1 -1
  106. package/dist/plugin/parcel/runtime.mjs +1 -1
  107. package/dist/plugin/parcel/transformer.cjs +1 -1
  108. package/dist/plugin/parcel/transformer.mjs +2 -2
  109. package/dist/plugin/rspack/index.mjs +1 -1
  110. package/dist/plugin/vite/index.mjs +3 -3
  111. package/dist/plugin/webpack/index.mjs +1 -1
  112. package/dist/plugin/webpack/loader.mjs +2 -2
  113. package/dist/{property-BzZSTVIh.js → property-CF6JgpTq.js} +2 -2
  114. package/dist/{property-BzZSTVIh.js.map → property-CF6JgpTq.js.map} +1 -1
  115. package/dist/{registry-D3x1EDJm.mjs → registry-CiwvMfx8.mjs} +2 -2
  116. package/dist/{registry-D3x1EDJm.mjs.map → registry-CiwvMfx8.mjs.map} +1 -1
  117. package/dist/{rules-Dz7Pu2K6.js → rules-DlXcch7-.js} +8 -8
  118. package/dist/{rules-Dz7Pu2K6.js.map → rules-DlXcch7-.js.map} +1 -1
  119. package/dist/runtime-BKChZZ2-.js +52 -0
  120. package/dist/runtime-BKChZZ2-.js.map +1 -0
  121. package/dist/server.js +8 -8
  122. package/dist/{shared-uAzFeq0x.mjs → shared-x59dI2NW.mjs} +4 -4
  123. package/dist/{shared-uAzFeq0x.mjs.map → shared-x59dI2NW.mjs.map} +1 -1
  124. package/dist/{shared-B_gJf5uj.cjs → shared-yDD0nfm1.cjs} +52 -53
  125. package/dist/shared-yDD0nfm1.cjs.map +1 -0
  126. package/dist/sheet-B-uJfHRY.js +7 -0
  127. package/dist/{sheet-DasbRnvy.js.map → sheet-B-uJfHRY.js.map} +1 -1
  128. package/dist/{sidecar-BUO1hKXu.mjs → sidecar-CJ6i4wmn.mjs} +3 -3
  129. package/dist/{sidecar-BUO1hKXu.mjs.map → sidecar-CJ6i4wmn.mjs.map} +1 -1
  130. package/dist/{style-CYXTs1iu.js → style-91J0B5ef.js} +3 -3
  131. package/dist/style-91J0B5ef.js.map +1 -0
  132. package/dist/{style-DUztHzBz.js → style-Bw5ka-Nq.js} +5 -16
  133. package/dist/style-Bw5ka-Nq.js.map +1 -0
  134. package/dist/{style-BkeAZl0n.js → style-DFFK06Of.js} +9 -9
  135. package/dist/{style-BkeAZl0n.js.map → style-DFFK06Of.js.map} +1 -1
  136. package/dist/style-pz8e5To1.js +5 -0
  137. package/dist/{styleStore-DVDp-gI-.js → styleStore-DJ0Msgkh.js} +5 -5
  138. package/dist/{styleStore-DVDp-gI-.js.map → styleStore-DJ0Msgkh.js.map} +1 -1
  139. package/dist/{styleStore-BGJ2ZYtK.js → styleStore-ydQcDBD4.js} +2 -2
  140. package/dist/{styleStore-BGJ2ZYtK.js.map → styleStore-ydQcDBD4.js.map} +1 -1
  141. package/dist/{token-CA1j7suG.js → token-DT_sCPtm.js} +28 -3
  142. package/dist/token-DT_sCPtm.js.map +1 -0
  143. package/dist/{trace-DR7_Rpkg.js → trace-CO36aenp.js} +3 -3
  144. package/dist/{trace-DR7_Rpkg.js.map → trace-CO36aenp.js.map} +1 -1
  145. package/dist/{trace-D0IL6JT8.js → trace-D8j96G57.js} +2 -2
  146. package/dist/{trace-D0IL6JT8.js.map → trace-D8j96G57.js.map} +1 -1
  147. package/dist/{utils-R6QadAsY.js → utils-Bmw655wa.js} +3 -3
  148. package/dist/{utils-R6QadAsY.js.map → utils-Bmw655wa.js.map} +1 -1
  149. package/dist/{utils-CpA-dSpY.mjs → utils-D2fygyTm.mjs} +4 -4
  150. package/dist/{utils-CpA-dSpY.mjs.map → utils-D2fygyTm.mjs.map} +1 -1
  151. package/dist/{utils-DQGa0uzS.mjs → utils-DTXCTUlS.mjs} +3 -3
  152. package/dist/{utils-DQGa0uzS.mjs.map → utils-DTXCTUlS.mjs.map} +1 -1
  153. package/dist/{utils-BsbfH6cd.js → utils-DVFxZnVC.js} +13 -1
  154. package/dist/utils-DVFxZnVC.js.map +1 -0
  155. package/dist/{utils-D4YWF2K0.js → utils-hoYnMiA7.js} +4 -4
  156. package/dist/{utils-D4YWF2K0.js.map → utils-hoYnMiA7.js.map} +1 -1
  157. package/dist/utils.js +2 -2
  158. package/dist/{value-DBtSe-9B.js → value-DvFkGBy2.js} +33 -4
  159. package/dist/value-DvFkGBy2.js.map +1 -0
  160. package/dist/{value-CJG6EWe8.js → value-dG9LK0Gq.js} +2 -2
  161. package/dist/{value-CJG6EWe8.js.map → value-dG9LK0Gq.js.map} +1 -1
  162. package/dist/{webpack-Fb9xF5jS.mjs → webpack-BOU7_xld.mjs} +5 -5
  163. package/dist/{webpack-Fb9xF5jS.mjs.map → webpack-BOU7_xld.mjs.map} +1 -1
  164. package/package.json +1 -1
  165. package/dist/compiler-BXcGyZUP.mjs.map +0 -1
  166. package/dist/config-CLYMN3_p.js.map +0 -1
  167. package/dist/config-DcYrUB-M.js +0 -6
  168. package/dist/config-oI_yS50f.js +0 -1
  169. package/dist/css-DfH4Gb1c.js.map +0 -1
  170. package/dist/debug-BefbXMq1.js +0 -15
  171. package/dist/debug-BefbXMq1.js.map +0 -1
  172. package/dist/debug-OG2wSB5R.js +0 -15
  173. package/dist/debug-OG2wSB5R.js.map +0 -1
  174. package/dist/dev-4TqJORRn.js.map +0 -1
  175. package/dist/extract-B9j4TBkU.js +0 -2
  176. package/dist/runtime-B3jHW9B1.js +0 -32
  177. package/dist/runtime-B3jHW9B1.js.map +0 -1
  178. package/dist/shared-B_gJf5uj.cjs.map +0 -1
  179. package/dist/sheet-DasbRnvy.js +0 -7
  180. package/dist/style-B0F1sgRZ.js +0 -5
  181. package/dist/style-CYXTs1iu.js.map +0 -1
  182. package/dist/style-DUztHzBz.js.map +0 -1
  183. package/dist/token-CA1j7suG.js.map +0 -1
  184. package/dist/utils-BsbfH6cd.js.map +0 -1
  185. package/dist/value-DBtSe-9B.js.map +0 -1
@@ -10,6 +10,26 @@ const CSS_CONFIG_DEFAULT = {
10
10
  };
11
11
  const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
12
12
  //#endregion
13
+ //#region config/config/debug.ts
14
+ const DEFAULT_DEBUG_CONFIG = {
15
+ isDebugClassNameEnabled: false,
16
+ isDebugClassNameConfigured: false,
17
+ maxPropertyLength: 24,
18
+ maxValueLength: 8,
19
+ maxSelectorLength: 8,
20
+ maxParentSelectorLength: 8,
21
+ maxAtRuleLength: 10
22
+ };
23
+ const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
24
+ function setDebugClassNameEnabled(value) {
25
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
26
+ DEBUG_CONFIG.isDebugClassNameConfigured = true;
27
+ }
28
+ function setDebugClassNameDefault(value) {
29
+ if (DEBUG_CONFIG.isDebugClassNameConfigured) return;
30
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
31
+ }
32
+ //#endregion
13
33
  //#region config/utils.ts
14
34
  const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
15
35
  function getCacheTTL(cache) {
@@ -32,7 +52,12 @@ const BUILD_CONFIG = globalData("config.build", () => ({ current: null }));
32
52
  function setBuildConfig(config) {
33
53
  BUILD_CONFIG.current = config;
34
54
  RUNTIME_CONFIG.isHoist = config.hoist;
35
- if (config.css) Object.assign(CSS_CONFIG, config.css);
55
+ if (config.css) {
56
+ const { debugClassName, ...css } = config.css;
57
+ Object.assign(CSS_CONFIG, css);
58
+ if (typeof debugClassName === "boolean") setDebugClassNameEnabled(debugClassName);
59
+ else setDebugClassNameDefault(false);
60
+ }
36
61
  }
37
62
  //#endregion
38
63
  //#region entry/shared/config.ts
@@ -268,6 +293,6 @@ function getTokenVarFallback(token, tokenNameFormat) {
268
293
  return getCssVar(varName, String(token.value ?? ""));
269
294
  }
270
295
  //#endregion
271
- export { LayerPlaceholder as _, escapeCssIdent as a, sanitizeCssIdentName as c, BUILD_CONFIG as d, RUNTIME_CONFIG as f, CSS_CONFIG_DEFAULT as g, CSS_CONFIG as h, getIdentifierSafeHash as i, createNameFormatter as l, getCacheTTL as m, getTokenVar as n, escapeCssValue as o, SIDECAR_URL_GLOBAL_SYMBOL as p, getTokenVarName as r, getCssVarRawFallback as s, getTokenOverrideValue as t, hashString as u };
296
+ export { CSS_CONFIG as _, escapeCssIdent as a, sanitizeCssIdentName as c, BUILD_CONFIG as d, RUNTIME_CONFIG as f, setDebugClassNameEnabled as g, DEBUG_CONFIG as h, getIdentifierSafeHash as i, createNameFormatter as l, getCacheTTL as m, getTokenVar as n, escapeCssValue as o, SIDECAR_URL_GLOBAL_SYMBOL as p, getTokenVarName as r, getCssVarRawFallback as s, getTokenOverrideValue as t, hashString as u, CSS_CONFIG_DEFAULT as v, LayerPlaceholder as y };
272
297
 
273
- //# sourceMappingURL=token-CA1j7suG.js.map
298
+ //# sourceMappingURL=token-DT_sCPtm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-DT_sCPtm.js","names":[],"sources":["../config/constants.ts","../config/config/css.ts","../config/config/debug.ts","../config/utils.ts","../config/config/runtime.ts","../config/build.ts","../entry/shared/config.ts","../entry/shared/prod.ts","../utils/hash.ts","../atomic/utils/format.ts","../atomic/utils/css.ts","../atomic/utils/hash.ts","../atomic/token.ts"],"sourcesContent":["export const LayerPlaceholder = '$layer';\n","import { globalData } from '../../utils/global';\nimport { LayerPlaceholder } from '../constants';\nimport type {\n ClassNameFormat,\n ElementClassNameFormat,\n ScopeClassNameFormat,\n ThemeNameFormat,\n TokenNameFormat,\n TransformClassNameFormat,\n} from '../types';\n\nexport type CssConfig = {\n layer: boolean;\n layers?: string[];\n layerNamespace?: string;\n hashLength?: number;\n classNameFormat?: ClassNameFormat;\n transformClassNameFormat?: TransformClassNameFormat;\n scopeClassNameFormat?: ScopeClassNameFormat;\n elementClassNameFormat?: ElementClassNameFormat;\n themeNameFormat?: ThemeNameFormat;\n tokenNameFormat?: TokenNameFormat;\n varNameFormat?: TokenNameFormat;\n};\n\nexport const CSS_CONFIG_DEFAULT: CssConfig = {\n layer: true,\n layers: [LayerPlaceholder],\n layerNamespace: 'css',\n};\n\nexport const CSS_CONFIG = globalData<CssConfig>(\n 'config.css',\n () => ({ ...CSS_CONFIG_DEFAULT }),\n);\n","import { globalData } from '../../utils/global';\n\nexport type DebugConfig = {\n isDebugClassNameEnabled: boolean;\n isDebugClassNameConfigured: boolean;\n\n maxPropertyLength: number;\n maxValueLength: number;\n maxSelectorLength: number;\n maxParentSelectorLength: number;\n maxAtRuleLength: number;\n};\n\nexport const DEFAULT_DEBUG_CONFIG: DebugConfig = {\n isDebugClassNameEnabled: false,\n isDebugClassNameConfigured: false,\n\n maxPropertyLength: 24,\n maxValueLength: 8,\n maxSelectorLength: 8,\n maxParentSelectorLength: 8,\n maxAtRuleLength: 10,\n};\n\nexport const DEBUG_CONFIG = globalData<DebugConfig>(\n 'config.debug',\n () => ({ ...DEFAULT_DEBUG_CONFIG }),\n);\n\nexport function setDebugClassNameEnabled(value: boolean) {\n DEBUG_CONFIG.isDebugClassNameEnabled = value;\n DEBUG_CONFIG.isDebugClassNameConfigured = true;\n}\n\nexport function setDebugClassNameDefault(value: boolean) {\n if (DEBUG_CONFIG.isDebugClassNameConfigured) return;\n DEBUG_CONFIG.isDebugClassNameEnabled = value;\n}\n","export const SIDECAR_URL_GLOBAL_SYMBOL = 'FLUENTIC_STYLE_SIDECAR_URL';\n\nexport function getCacheTTL(cache: boolean | number) {\n return cache === true ? 300_000 : cache === false ? 0 : Math.max(cache, 0);\n}\n","import { globalData } from '../../utils/global';\nimport { getCacheTTL } from '../utils';\n\nexport type RuntimeConfig = {\n changes: number;\n\n isPlugin: boolean;\n isHoist: boolean;\n isExtracted: boolean;\n isRSC: boolean;\n\n runtimeCacheTTL: number;\n};\n\nexport const RUNTIME_CONFIG_DEFAULT: RuntimeConfig = {\n changes: 0,\n\n isPlugin: false,\n isHoist: false,\n isExtracted: false,\n isRSC: false,\n\n runtimeCacheTTL: getCacheTTL(true),\n};\n\nexport const RUNTIME_CONFIG = globalData<RuntimeConfig>(\n 'config.runtime',\n () => ({ ...RUNTIME_CONFIG_DEFAULT }),\n);\n","import { globalData } from '../utils/global';\nimport type { ReplaceProps } from '../utils/type';\nimport { CSS_CONFIG, type CssConfig } from './config/css';\nimport { setDebugClassNameDefault, setDebugClassNameEnabled } from './config/debug';\nimport type { DevRuntimeOptions } from './config/dev';\nimport { RUNTIME_CONFIG } from './config/runtime';\nimport type { CheckSelectorMode } from './types';\n\nexport type BuildCssConfig = Partial<CssConfig> & {\n debugClassName?: boolean;\n};\n\nexport type BuildDevConfig = ReplaceProps<DevRuntimeOptions, {\n checkSelector?: CheckSelectorMode;\n}>;\n\nexport type BuildConfig = {\n hoist: boolean;\n css: BuildCssConfig;\n};\n\nexport const BUILD_CONFIG = globalData(\n 'config.build',\n () => ({ current: null as BuildConfig | null }),\n);\n\nexport function setBuildConfig(config: BuildConfig) {\n BUILD_CONFIG.current = config;\n\n RUNTIME_CONFIG.isHoist = config.hoist;\n\n if (config.css) {\n const { debugClassName, ...css } = config.css;\n Object.assign(CSS_CONFIG, css);\n\n if (typeof debugClassName === 'boolean') {\n setDebugClassNameEnabled(debugClassName);\n } else {\n setDebugClassNameDefault(false);\n }\n }\n}\n","import { setBuildConfig } from '../../config/build';\n\ndeclare const FLUENTIC_STYLE_BUILD_CONFIG: string;\n\nsetBuildConfig(JSON.parse(FLUENTIC_STYLE_BUILD_CONFIG));\n","import { RUNTIME_CONFIG } from '../../config/config/runtime';\n\nRUNTIME_CONFIG.isPlugin = true;\nRUNTIME_CONFIG.isExtracted = true;\n","const BASE62_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\nexport function toBase62(value: number) {\n let result = '';\n\n do {\n result = BASE62_CHARS[value % 62] + result;\n value = Math.floor(value / 62);\n } while (value > 0);\n\n return result;\n}\n\nexport function hashString(str: string) {\n let hash = 0x811c9dc5;\n\n for (let i = 0; i < str.length; i++) {\n hash = Math.imul(hash ^ str.charCodeAt(i), 0x01000193);\n }\n\n return (hash >>> 0).toString(36).padEnd(7, '0');\n}\n\nexport function normalizeHashLength(length: number) {\n return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;\n}\n","type FormatInfo = { [key: string]: string | null; };\n\ntype NameFormatFn<Info> = (info: Info) => string;\ntype NameFormat<Info> = string | NameFormatFn<Info>;\n\ntype CompiledSegment<Key extends string> = {\n optional: boolean;\n parts: CompiledPart<Key>[];\n};\n\ntype CompiledPart<Key extends string> =\n | { type: 'text'; value: string; }\n | {\n type: 'token';\n key: Key;\n maxLength: number | null;\n truncate: boolean;\n };\n\nconst TOKEN_REGEX = /\\(([a-zA-Z][a-zA-Z0-9]*)(?::([0-9]+)(!)?)?\\)/g;\nconst OPTIONAL_REGEX = /\\[([^[\\]]*)\\]/g;\n\nconst HASH_TOKEN = '$hash';\n\nexport type NameFormatter<Info extends object> = ReturnType<typeof createNameFormatter<Info>>;\n\nexport function createNameFormatter<Info extends object>(\n keys: readonly (keyof Info & string)[],\n) {\n const keySet = new Set<string>(keys);\n const cache = new Map<string, NameFormatFn<Info>>();\n\n function getFormatFn(format: NameFormat<Info>) {\n if (typeof format === 'function') return format;\n\n let fn = cache.get(format);\n\n if (!fn) {\n fn = compileFormat(format, keySet);\n cache.set(format, fn);\n }\n\n return fn;\n }\n\n return function format(format: NameFormat<Info>, hash: string | null, info: Info) {\n const name = getFormatFn(format)(info);\n\n if (!hash) return name;\n\n if (name.includes(HASH_TOKEN)) {\n return name.replace(HASH_TOKEN, hash);\n }\n\n return name ? (name + '--' + hash) : hash;\n };\n}\n\nfunction compileFormat<Info extends object>(\n format: string,\n keySet: ReadonlySet<string>,\n): NameFormatFn<Info> {\n type Key = keyof Info & string;\n const segments = compileSegments<Key>(format, keySet);\n\n return (info) => {\n let name = '';\n\n for (const segment of segments) {\n const text = formatSegment(info, segment);\n\n if (text === null) {\n if (!segment.optional) return '';\n continue;\n }\n\n name += text;\n }\n\n return name;\n };\n}\n\nfunction compileSegments<Key extends string>(\n format: string,\n keySet: ReadonlySet<string>,\n) {\n const segments: CompiledSegment<Key>[] = [];\n let lastIndex = 0;\n\n for (const match of format.matchAll(OPTIONAL_REGEX)) {\n const index = match.index ?? 0;\n\n if (index > lastIndex) {\n segments.push({\n optional: false,\n parts: compileParts<Key>(format.slice(lastIndex, index), keySet),\n });\n }\n\n segments.push({\n optional: true,\n parts: compileParts<Key>(match[1], keySet),\n });\n\n lastIndex = index + match[0].length;\n }\n\n if (lastIndex < format.length) {\n segments.push({\n optional: false,\n parts: compileParts<Key>(format.slice(lastIndex), keySet),\n });\n }\n\n return segments;\n}\n\nfunction compileParts<Key extends string>(\n segment: string,\n keySet: ReadonlySet<string>,\n) {\n const parts: CompiledPart<Key>[] = [];\n let lastIndex = 0;\n\n for (const match of segment.matchAll(TOKEN_REGEX)) {\n const index = match.index ?? 0;\n const key = match[1];\n\n if (!keySet.has(key)) continue;\n\n if (index > lastIndex) {\n parts.push({ type: 'text', value: segment.slice(lastIndex, index) });\n }\n\n parts.push({\n type: 'token',\n key: key as Key,\n maxLength: match[2] ? Number(match[2]) : null,\n truncate: Boolean(match[3]),\n });\n\n lastIndex = index + match[0].length;\n }\n\n if (lastIndex < segment.length) {\n parts.push({ type: 'text', value: segment.slice(lastIndex) });\n }\n\n return parts;\n}\n\nfunction formatSegment<Info extends object, Key extends keyof Info & string>(\n info: Info,\n segment: CompiledSegment<Key>,\n) {\n let text = '';\n\n for (const part of segment.parts) {\n if (part.type === 'text') {\n text += part.value;\n continue;\n }\n\n const value = formatTokenValue(\n (info as FormatInfo)[part.key],\n part.maxLength,\n part.truncate,\n );\n if (value === null) {\n if (segment.optional) return null;\n continue;\n }\n\n text += value;\n }\n\n return text;\n}\n\nfunction formatTokenValue(\n value: string | null,\n maxLength: number | null,\n truncate: boolean,\n) {\n if (!value) return null;\n if (!maxLength) return value;\n\n if (!Number.isFinite(maxLength) || maxLength < 0 || value.length <= maxLength) return value;\n\n return truncate ? value.slice(0, maxLength) : null;\n}\n","export function getCssVar(varName: string, value: string) {\n return 'var(' + varName + ', ' + escapeCssValue(value) + ')';\n}\n\nexport function getCssVarRawFallback(varName: string, fallbackCss: string) {\n return 'var(' + varName + ', ' + fallbackCss + ')';\n}\n\nexport function escapeCssValue(value: string): string {\n if (!value) return '';\n\n return value\n .trim()\n // Escape existing backslashes first so we don't break them.\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/'/g, \"\\\\'\")\n .replace(/;/g, '\\\\;');\n}\n\nexport function escapeCssIdent(ident: string): string {\n let result = '';\n\n for (let i = 0; i < ident.length; i++) {\n const char = ident.charAt(i);\n const code = ident.charCodeAt(i);\n const nextCode = ident.charCodeAt(i + 1);\n\n if (code === 0) {\n result += '\\uFFFD';\n continue;\n }\n\n if (\n (code >= 1 && code <= 31) ||\n code === 127 ||\n (i === 0 && code >= 48 && code <= 57) ||\n (i === 1 && code >= 48 && code <= 57 && ident.charCodeAt(0) === 45)\n ) {\n result += '\\\\' + code.toString(16) + ' ';\n continue;\n }\n\n if (i === 0 && code === 45 && ident.length === 1) {\n result += '\\\\-';\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDBFF && nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += char + ident.charAt(++i);\n continue;\n }\n\n if (\n code >= 128 ||\n code === 45 ||\n code === 95 ||\n (code >= 48 && code <= 57) ||\n (code >= 65 && code <= 90) ||\n (code >= 97 && code <= 122)\n ) {\n result += char;\n continue;\n }\n\n result += '\\\\' + char;\n }\n\n return result;\n}\n\nexport function sanitizeCssIdentName(value: string, fallback: string = '') {\n return value.replace(/[^a-zA-Z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || fallback;\n}\n","import { globalData } from '../../utils/global';\nimport { hashString, normalizeHashLength } from '../../utils/hash';\n\ntype PooledHashState = {\n byValue: Map<string, string>;\n byHash: Map<string, string>;\n usedByLength: number[];\n};\n\nconst POOLED_HASH_STATE = globalData<PooledHashState>(\n 'atomic.hashPool',\n () => ({\n byValue: new Map(),\n byHash: new Map(),\n usedByLength: [],\n }),\n);\n\nexport function getIdentifierSafeHash(value: string, startLength = 7) {\n return getPooledHash(value, startLength);\n}\n\nfunction getPooledHash(value: string, startLength: number) {\n const normalizedStartLength = normalizeHashLength(startLength);\n const valueKey = normalizedStartLength + '\\0' + value;\n const existing = POOLED_HASH_STATE.byValue.get(valueKey);\n if (existing) return existing;\n\n let length = normalizedStartLength;\n\n while (true) {\n if (getPooledHashUsedCount(length) >= getIdentifierSafeHashPoolSize(length)) {\n length++;\n continue;\n }\n\n for (let index = 0; index < getIdentifierSafeHashPoolSize(length); index++) {\n const hash = getPooledHashCandidate(value, length, index);\n const owner = POOLED_HASH_STATE.byHash.get(hash);\n\n if (owner !== undefined && owner !== valueKey) continue;\n\n POOLED_HASH_STATE.byValue.set(valueKey, hash);\n POOLED_HASH_STATE.byHash.set(hash, valueKey);\n POOLED_HASH_STATE.usedByLength[length] = getPooledHashUsedCount(length) + 1;\n return hash;\n }\n\n length++;\n }\n}\n\nfunction getPooledHashCandidate(\n value: string,\n length: number,\n index: number,\n) {\n const hashValue = index === 0 ? value : value + '::' + index;\n return getIdentifierSafeHashValue(hashString(hashValue)).slice(0, length);\n}\n\nfunction getPooledHashUsedCount(length: number) {\n return POOLED_HASH_STATE.usedByLength[length] ?? 0;\n}\n\nfunction getIdentifierSafeHashPoolSize(length: number) {\n if (length <= 0) return 0;\n\n return 26 * 36 ** (length - 1);\n}\n\nfunction getIdentifierSafeHashValue(hash: string) {\n const first = hash.charCodeAt(0);\n\n if (first < 48 || first > 57) return hash;\n\n return String.fromCharCode(97 + first - 48) + hash.slice(1);\n}\n","import { CSS_CONFIG } from '../config/config/css';\nimport type { TokenNameFormat, TokenNameInfo } from '../config/types';\nimport { getStyleTokenId, type StyleTokenData, type StyleTokenOverride } from '../style/token';\nimport { getCssVar, getCssVarRawFallback } from './utils/css';\nimport { createNameFormatter } from './utils/format';\nimport { getIdentifierSafeHash } from './utils/hash';\n\nexport const TOKEN_NAME_FORMAT = 'token[-(name)]-$hash';\n\nexport const formatTokenName = createNameFormatter<TokenNameInfo>(['name']);\n\nexport function getTokenVarName(\n token: StyleTokenData | StyleTokenOverride,\n format: TokenNameFormat | null,\n) {\n const id = getStyleTokenId(token);\n\n const name = formatTokenName(\n format || TOKEN_NAME_FORMAT,\n getIdentifierSafeHash(id, CSS_CONFIG.hashLength),\n { name: id },\n );\n\n return '--' + name;\n}\n\nexport function getTokenVar(\n token: StyleTokenData,\n format: TokenNameFormat | null,\n) {\n return getTokenVarFallback(token, format);\n}\n\nexport function getTokenOverrideValue(\n token: StyleTokenOverride,\n format: TokenNameFormat | null,\n) {\n return token.ref ? getTokenVar(token.ref, format) : token.value;\n}\n\nfunction getTokenVarFallback(\n token: StyleTokenData,\n tokenNameFormat: TokenNameFormat | null,\n): string {\n const varName = getTokenVarName(token, tokenNameFormat);\n\n if (token.ref) {\n return getCssVarRawFallback(\n varName,\n getTokenVarFallback(token.ref, tokenNameFormat),\n );\n }\n\n return getCssVar(varName, String(token.value ?? ''));\n}\n"],"mappings":";;AAAA,MAAa,mBAAmB;;;ACyBhC,MAAa,qBAAgC;CAC3C,OAAO;CACP,QAAQ,CAAC,gBAAgB;CACzB,gBAAgB;AAClB;AAEA,MAAa,aAAa,WACxB,qBACO,EAAE,GAAG,mBAAmB,EACjC;;;ACrBA,MAAa,uBAAoC;CAC/C,yBAAyB;CACzB,4BAA4B;CAE5B,mBAAmB;CACnB,gBAAgB;CAChB,mBAAmB;CACnB,yBAAyB;CACzB,iBAAiB;AACnB;AAEA,MAAa,eAAe,WAC1B,uBACO,EAAE,GAAG,qBAAqB,EACnC;AAEA,SAAgB,yBAAyB,OAAgB;CACvD,aAAa,0BAA0B;CACvC,aAAa,6BAA6B;AAC5C;AAEA,SAAgB,yBAAyB,OAAgB;CACvD,IAAI,aAAa,4BAA4B;CAC7C,aAAa,0BAA0B;AACzC;;;ACrCA,MAAa,4BAA4B;AAEzC,SAAgB,YAAY,OAAyB;CACnD,OAAO,UAAU,OAAO,MAAU,UAAU,QAAQ,IAAI,KAAK,IAAI,OAAO,CAAC;AAC3E;;;ACUA,MAAa,yBAAwC;CACnD,SAAS;CAET,UAAU;CACV,SAAS;CACT,aAAa;CACb,OAAO;CAEP,iBAAiB,YAAY,IAAI;AACnC;AAEA,MAAa,iBAAiB,WAC5B,yBACO,EAAE,GAAG,uBAAuB,EACrC;;;ACPA,MAAa,eAAe,WAC1B,uBACO,EAAE,SAAS,KAA2B,EAC/C;AAEA,SAAgB,eAAe,QAAqB;CAClD,aAAa,UAAU;CAEvB,eAAe,UAAU,OAAO;CAEhC,IAAI,OAAO,KAAK;EACd,MAAM,EAAE,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AAgB,OAAO,eAAe;CAEtD,IAAI,MAAM,KACR,OAAO,qBACL,SACA,oBAAoB,MAAM,KAAK,eAAe,CAChD;CAGF,OAAO,UAAU,SAAS,OAAO,MAAM,SAAS,EAAE,CAAC;AACrD"}
@@ -1,5 +1,5 @@
1
- import { f as normalizeCallsiteSourceUrl } from "./debug-DLmUG3Vh.js";
2
- import { f as getDevSourcemapTags, h as getSourcemapRuleCallsite, m as createSourceMapComment } from "./elementMarker-BKzZyg5V.js";
1
+ import { f as normalizeCallsiteSourceUrl } from "./debug-D96KGgpH.js";
2
+ import { f as getDevSourcemapTags, h as getSourcemapRuleCallsite, m as createSourceMapComment } from "./elementMarker-CvqqIb7J.js";
3
3
  import { TraceMap, originalPositionFor, sourceContentFor } from "@jridgewell/trace-mapping";
4
4
  //#region dev/trace.ts
5
5
  const SOURCE_MAPPING_URL_REGEX = /(?:\/\/|\/\*)[#@]\s*sourceMappingURL=([^\s*]+)(?:\s*\*\/)?/g;
@@ -242,4 +242,4 @@ function isAbsoluteSource(source) {
242
242
  //#endregion
243
243
  export { traceDevSourcemaps };
244
244
 
245
- //# sourceMappingURL=trace-DR7_Rpkg.js.map
245
+ //# sourceMappingURL=trace-CO36aenp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-DR7_Rpkg.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,MAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;EACrD,MA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ace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings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AAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
@@ -1,4 +1,4 @@
1
- import { $ as getSourcemapRuleCallsite, Q as createSourceMapComment, X as getDevSourcemapTags, ot as normalizeCallsiteSourceUrl } from "./styleStore-BGJ2ZYtK.js";
1
+ import { $ as getSourcemapRuleCallsite, Q as createSourceMapComment, X as getDevSourcemapTags, ot as normalizeCallsiteSourceUrl } from "./styleStore-ydQcDBD4.js";
2
2
  import { TraceMap, originalPositionFor, sourceContentFor } from "@jridgewell/trace-mapping";
3
3
  //#region dev/trace.ts
4
4
  const SOURCE_MAPPING_URL_REGEX = /(?:\/\/|\/\*)[#@]\s*sourceMappingURL=([^\s*]+)(?:\s*\*\/)?/g;
@@ -241,4 +241,4 @@ function isAbsoluteSource(source) {
241
241
  //#endregion
242
242
  export { traceDevSourcemaps };
243
243
 
244
- //# sourceMappingURL=trace-D0IL6JT8.js.map
244
+ //# sourceMappingURL=trace-D8j96G57.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-D0IL6JT8.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MA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S;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
1
+ {"version":3,"file":"trace-D8j96G57.js","names":[],"sources":["../dev/trace.ts"],"sourcesContent":["import { type EncodedSourceMap, originalPositionFor, sourceContentFor, TraceMap } from '@jridgewell/trace-mapping';\nimport { getDevSourcemapTags } from '../sheet/dev';\nimport { createSourceMapComment, getSourcemapRuleCallsite } from '../sheet/sourcemap';\nimport type { SheetCallsite } from '../sheet/types';\nimport { normalizeCallsiteSourceUrl } from '../utils/trace';\n\nexport type TraceSourcemapResult = {\n tags: number;\n rules: number;\n remapped: number;\n unresolved: number;\n sourcemaps: string[];\n};\n\ntype SourceMapData = {\n url: string;\n sourceBaseUrl: string;\n rawMap: EncodedSourceMap;\n map: TraceMap;\n sourceRoot?: string;\n};\n\nconst SOURCE_MAPPING_URL_REGEX = /(?:\\/\\/|\\/\\*)[#@]\\s*sourceMappingURL=([^\\s*]+)(?:\\s*\\*\\/)?/g;\n\nexport async function traceDevSourcemaps(): Promise<TraceSourcemapResult> {\n const activeTags = getDevSourcemapTags().filter((item) =>\n item.sourceMapNode && item.sourceMapNode.parentNode === item.tag\n );\n const browserWindow = getBrowserWindow();\n const fetcher = browserWindow?.fetch?.bind(browserWindow);\n const sourceMapCache = new Map<string, Promise<SourceMapData | null>>();\n const sourcemaps = new Set<string>();\n let rules = 0;\n let remapped = 0;\n let unresolved = 0;\n\n for (let i = 0, len = activeTags.length; i < len; i++) {\n const item = activeTags[i];\n let touched = false;\n\n for (let j = 0, ruleLen = item.rules.length; j < ruleLen; j++) {\n const rule = item.rules[j];\n const callsite = getSourcemapRuleCallsite(rule);\n\n if (!callsite) continue;\n if (isDisplaySourceUrl(callsite.sourceUrl || callsite.filePath)) continue;\n\n rules++;\n\n const nextCallsite = await traceCallsiteSourcemap(\n callsite,\n fetcher,\n sourceMapCache,\n );\n\n if (nextCallsite) {\n if (nextCallsite.sourceMapUrl) sourcemaps.add(nextCallsite.sourceMapUrl);\n rule.callsite = nextCallsite.callsite;\n rule.debug = null;\n rule.debugField = null;\n remapped++;\n } else {\n rule.callsite = createDisplayCallsite(callsite);\n rule.debug = null;\n rule.debugField = null;\n unresolved++;\n }\n\n touched = true;\n }\n\n if (touched) {\n rewriteDevSourcemapTag(item);\n }\n }\n\n return {\n tags: activeTags.length,\n rules,\n remapped,\n unresolved,\n sourcemaps: [...sourcemaps],\n };\n}\n\nasync function traceCallsiteSourcemap(\n callsite: SheetCallsite,\n fetcher: typeof fetch | undefined,\n sourceMapCache: Map<string, Promise<SourceMapData | null>>,\n): Promise<{ callsite: SheetCallsite; sourceMapUrl: string; } | null> {\n if (!fetcher) return null;\n\n const generatedUrl = getFetchableGeneratedUrl(\n callsite.sourceUrl || callsite.filePath,\n );\n\n if (!generatedUrl) return null;\n\n let sourceMapPromise = sourceMapCache.get(generatedUrl);\n\n if (!sourceMapPromise) {\n sourceMapPromise = fetchSourceMap(getGeneratedUrlFetchCandidates(generatedUrl), fetcher);\n sourceMapCache.set(generatedUrl, sourceMapPromise);\n }\n\n const sourceMap = await sourceMapPromise;\n\n if (!sourceMap) return null;\n\n const original = originalPositionFor(sourceMap.map, {\n line: callsite.line,\n column: Math.max(callsite.column - 1, 0),\n });\n\n if (!original.source || original.line == null || original.column == null) {\n return null;\n }\n\n const sourceUrl = resolveOriginalSourceUrl(\n original.source,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const sourceContent = getSourceContent(sourceMap, original.source, sourceUrl);\n const displaySourceUrl = getDisplaySourceUrl(sourceUrl);\n\n return {\n sourceMapUrl: sourceMap.url,\n callsite: {\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n sourceContent,\n line: original.line,\n column: original.column + 1,\n },\n };\n}\n\nfunction rewriteDevSourcemapTag(item: ReturnType<typeof getDevSourcemapTags>[number]) {\n const document = item.tag.ownerDocument;\n\n item.tag.textContent = '';\n\n for (let i = 0, len = item.rules.length; i < len; i++) {\n item.tag.appendChild(document.createTextNode(item.rules[i].css + '\\n'));\n }\n\n item.sourceMapNode = document.createTextNode('\\n' + createSourceMapComment(item.rules));\n item.tag.appendChild(item.sourceMapNode);\n}\n\nfunction createDisplayCallsite(callsite: SheetCallsite): SheetCallsite {\n const displaySourceUrl = getDisplaySourceUrl(callsite.sourceUrl || callsite.filePath);\n\n return {\n ...callsite,\n filePath: displaySourceUrl,\n sourceUrl: displaySourceUrl,\n };\n}\n\nfunction isDisplaySourceUrl(sourceUrl: string) {\n return sourceUrl.match(SOURCE_MAPPING_URL_REGEX);\n}\n\nasync function fetchSourceMap(\n generatedUrls: string[],\n fetcher: typeof fetch,\n): Promise<SourceMapData | null> {\n for (const generatedUrl of generatedUrls) {\n try {\n const response = await fetcher(generatedUrl);\n\n if (!response.ok) continue;\n\n const source = await response.text();\n const sourceMapUrl = findSourceMapUrl(source, generatedUrl);\n\n if (!sourceMapUrl) continue;\n\n const rawMap = await loadSourceMap(sourceMapUrl, fetcher);\n\n if (!rawMap) continue;\n\n const sourceBaseUrl = sourceMapUrl.startsWith('data:')\n ? normalizeGeneratedUrl(generatedUrl)\n : sourceMapUrl;\n\n return {\n url: sourceMapUrl,\n sourceBaseUrl,\n rawMap,\n map: new TraceMap(rawMap, sourceBaseUrl),\n sourceRoot: typeof rawMap.sourceRoot === 'string' ? rawMap.sourceRoot : undefined,\n };\n } catch {\n // Try the next generated URL variant.\n }\n }\n\n return null;\n}\n\nasync function loadSourceMap(sourceMapUrl: string, fetcher: typeof fetch) {\n try {\n if (sourceMapUrl.startsWith('data:')) {\n return parseDataUrlSourceMap(sourceMapUrl);\n }\n\n const response = await fetcher(sourceMapUrl);\n\n if (!response.ok) return null;\n\n return JSON.parse(await response.text()) as EncodedSourceMap;\n } catch {\n return null;\n }\n}\n\nfunction findSourceMapUrl(source: string, generatedUrl: string) {\n let match: RegExpExecArray | null = null;\n let sourceMapUrl: string | null = null;\n\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n\n while ((match = SOURCE_MAPPING_URL_REGEX.exec(source))) {\n sourceMapUrl = match[1];\n }\n\n if (!sourceMapUrl) return null;\n if (sourceMapUrl.startsWith('data:')) return sourceMapUrl;\n\n try {\n return new URL(sourceMapUrl, generatedUrl).href;\n } catch {\n return null;\n }\n}\n\nfunction parseDataUrlSourceMap(sourceMapUrl: string) {\n const commaIndex = sourceMapUrl.indexOf(',');\n\n if (commaIndex === -1) return null;\n\n const meta = sourceMapUrl.slice(0, commaIndex);\n const data = sourceMapUrl.slice(commaIndex + 1);\n const json = meta.endsWith(';base64') ? atob(data) : decodeURIComponent(data);\n\n return JSON.parse(json) as EncodedSourceMap;\n}\n\nfunction getFetchableGeneratedUrl(\n source: string,\n): string | null {\n source = normalizeCallsiteSourceUrl(source);\n\n if (source.startsWith('webpack://') || source.startsWith('node:')) {\n return null;\n }\n\n try {\n return new URL(source).href;\n } catch {\n // Continue with a browser-relative resolution below.\n }\n\n const base = getBrowserLocationHref();\n\n if (!base) return null;\n\n try {\n return new URL(source, base).href;\n } catch {\n return null;\n }\n}\n\nfunction getGeneratedUrlFetchCandidates(url: string) {\n const normalized = normalizeGeneratedUrl(url);\n\n return url === normalized ? [url] : [url, normalized];\n}\n\nfunction getDisplaySourceUrl(sourceUrl: string) {\n sourceUrl = normalizeCallsiteSourceUrl(sourceUrl);\n const normalized = normalizeGeneratedUrl(sourceUrl);\n\n try {\n const url = new URL(normalized);\n return 'source:///' + url.pathname.replace(/^\\/+/, '');\n } catch {\n return 'source:///' + normalized.replace(/^\\/+/, '');\n }\n}\n\nfunction getSourceContent(\n sourceMap: SourceMapData,\n originalSource: string,\n resolvedSourceUrl: string,\n) {\n const tracedContent = sourceContentFor(sourceMap.map, originalSource);\n\n if (tracedContent != null) return tracedContent;\n\n const rawSources = sourceMap.rawMap.sources;\n const rawSourcesContent = sourceMap.rawMap.sourcesContent;\n\n if (!rawSources || !rawSourcesContent) return undefined;\n\n const sourceKeys = getSourceMatchKeys(originalSource, resolvedSourceUrl);\n\n for (let i = 0, len = rawSources.length; i < len; i++) {\n const rawSource = rawSources[i];\n const rawContent = rawSourcesContent[i];\n\n if (typeof rawSource !== 'string') continue;\n if (typeof rawContent !== 'string') continue;\n\n const rawSourceUrl = resolveOriginalSourceUrl(\n rawSource,\n sourceMap.sourceBaseUrl,\n sourceMap.sourceRoot,\n );\n const rawKeys = getSourceMatchKeys(rawSource, rawSourceUrl);\n\n for (const key of rawKeys) {\n if (sourceKeys.has(key)) return rawContent;\n }\n }\n\n return undefined;\n}\n\nfunction getSourceMatchKeys(...sources: string[]) {\n const keys = new Set<string>();\n\n for (const source of sources) {\n if (!source) continue;\n\n keys.add(source);\n keys.add(normalizeGeneratedUrl(source));\n\n try {\n const url = new URL(source);\n keys.add(url.pathname);\n keys.add(normalizeGeneratedUrl(url.pathname));\n } catch {\n // Non-URL sources are still useful as exact keys.\n }\n }\n\n return keys;\n}\n\nfunction normalizeGeneratedUrl(source: string) {\n try {\n const url = new URL(source);\n\n url.search = '';\n url.hash = '';\n\n return url.href;\n } catch {\n const queryIndex = findFirstIndex(source, ['?', '#']);\n\n return queryIndex === -1 ? source : source.slice(0, queryIndex);\n }\n}\n\nfunction findFirstIndex(text: string, needles: string[]) {\n let index = -1;\n\n for (const needle of needles) {\n const next = text.indexOf(needle);\n if (next !== -1 && (index === -1 || next < index)) index = next;\n }\n\n return index;\n}\n\nfunction getBrowserLocationHref() {\n return getBrowserWindow()?.location.href;\n}\n\nfunction getBrowserWindow() {\n return typeof window === 'undefined' ? null : window;\n}\n\nfunction resolveOriginalSourceUrl(\n source: string,\n sourceMapUrl: string,\n sourceRoot?: string,\n) {\n if (isAbsoluteSource(source)) return source;\n\n try {\n if (sourceRoot && !isAbsoluteSource(sourceRoot)) {\n return new URL(sourceRoot.replace(/\\/?$/, '/') + source, sourceMapUrl).href;\n }\n\n if (sourceRoot) {\n return new URL(source, sourceRoot).href;\n }\n\n return new URL(source, sourceMapUrl).href;\n } catch {\n return sourceRoot ? sourceRoot.replace(/\\/?$/, '/') + source : source;\n }\n}\n\nfunction isAbsoluteSource(source: string) {\n return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(source) || source.startsWith('/');\n}\n"],"mappings":";;;AAsBA,MAAM,2BAA2B;AAEjC,eAAsB,qBAAoD;CACxE,MAAM,aAAa,oBAAoB,EAAE,QAAQ,SAC/C,KAAK,iBAAiB,KAAK,cAAc,eAAe,KAAK,GAC/D;CACA,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,UAAU,eAAe,OAAO,KAAK,aAAa;CACxD,MAAM,iCAAiB,IAAI,IAA2C;CACtE,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,aAAa;CAEjB,KAAK,IAAI,IAAI,GAAG,MAAM,WAAW,QAAQ,IAAI,KAAK,KAAK;EACrD,MAAM,OAAO,WAAW;EACxB,IAAI,UAAU;EAEd,KAAK,IAAI,IAAI,GAAG,UAAU,KAAK,MAAM,QAAQ,IAAI,SAAS,KAAK;GAC7D,MAAM,OAAO,KAAK,MAAM;GACxB,MAAM,WAAW,yBAAyB,IAAI;GAE9C,IAAI,CAAC,UAAU;GACf,IAAI,mBAAmB,SAAS,aAAa,SAAS,QAAQ,GAAG;GAEjE;GAEA,MAAM,eAAe,MAAM,uBACzB,UACA,SACA,cACF;GAEA,IAAI,cAAc;IAChB,IAAI,aAAa,cAAc,WAAW,IAAI,aAAa,YAAY;IACvE,KAAK,WAAW,aAAa;IAC7B,KAAK,QAAQ;IACb,KAAK,aAAa;IAClB;GACF,OAAO;IACL,KAAK,WAAW,sBAAsB,QAAQ;IAC9C,KAAK,QAAQ;IACb,KAAK,aAAa;IAClB;GACF;GAEA,UAAU;EACZ;EAEA,IAAI,SACF,uBAAuB,IAAI;CAE/B;CAEA,OAAO;EACL,MAAM,WAAW;EACjB;EACA;EACA;EACA,YAAY,CAAC,GAAG,UAAU;CAC5B;AACF;AAE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B;CAC1B,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD;AAEA,SAAS,yBACP,QACA,cACA,YACA;CACA,IAAI,iBAAiB,MAAM,GAAG,OAAO;CAErC,IAAI;EACF,IAAI,cAAc,CAAC,iBAAiB,UAAU,GAC5C,OAAO,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE;EAGzE,IAAI,YACF,OAAO,IAAI,IAAI,QAAQ,UAAU,EAAE;EAGrC,OAAO,IAAI,IAAI,QAAQ,YAAY,EAAE;CACvC,QAAQ;EACN,OAAO,aAAa,WAAW,QAAQ,QAAQ,GAAG,IAAI,SAAS;CACjE;AACF;AAEA,SAAS,iBAAiB,QAAgB;CACxC,OAAO,2BAA2B,KAAK,MAAM,KAAK,OAAO,WAAW,GAAG;AACzE"}
@@ -1,5 +1,5 @@
1
- import { L as hasOwn, P as DEV_CONFIG } from "./value-DBtSe-9B.js";
2
- import { H as createElementMarkerClassName, K as isElementMarkerRule, U as createElementMarkerRuleFromDebug, l as resolveStylePropRuntime, q as splitElementMarkerStyleProp, r as ELEMENT_CSS_DATA_ATTR, s as collectStylePropItemsSheetRulesWithThemes, t as addRscStyleRules } from "./styleStore-BGJ2ZYtK.js";
1
+ import { L as hasOwn, P as DEV_CONFIG } from "./value-DvFkGBy2.js";
2
+ import { H as createElementMarkerClassName, K as isElementMarkerRule, U as createElementMarkerRuleFromDebug, l as resolveStylePropRuntime, q as splitElementMarkerStyleProp, r as ELEMENT_CSS_DATA_ATTR, s as collectStylePropItemsSheetRulesWithThemes, t as addRscStyleRules } from "./styleStore-ydQcDBD4.js";
3
3
  //#region runtime/core/className.ts
4
4
  function mergeClassName(className) {
5
5
  if (!className) return void 0;
@@ -167,4 +167,4 @@ function createJsx(fn, transformElement) {
167
167
  //#endregion
168
168
  export { transformElement as a, wrapFragment as i, createJsxDEV as n, getClassName as o, wrapCreateElement as r, createJsx as t };
169
169
 
170
- //# sourceMappingURL=utils-R6QadAsY.js.map
170
+ //# sourceMappingURL=utils-Bmw655wa.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-R6QadAsY.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/rsc/getClassName.ts","../runtime/core/createTransformElement.ts","../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { LayerPriority } from '../../atomic/layer';\nimport type { DebugData } from '../../builder/data/debug';\nimport { DEV_CONFIG } from '../../config/config/dev';\nimport type { SheetRule } from '../../sheet';\nimport type { StylePropItem } from '../core/cache/prop';\nimport type { ClassNameProps, ClassNameResult } from '../core/className';\nimport {\n createElementMarkerRuleFromDebug,\n isElementMarkerRule,\n splitElementMarkerStyleProp,\n} from '../core/elementMarker';\nimport { resolveClassNameRuntime } from '../core/resolveClassNameRuntime';\nimport { collectStylePropItemsSheetRulesWithThemes } from '../sheet/rules';\nimport type { StyleProp } from '../types';\nimport { ELEMENT_CSS_DATA_ATTR } from './constants';\nimport { addRscStyleRules } from './styleStore';\n\nexport type RscStylePayloadRule = {\n key?: string | null;\n css: string;\n priority?: LayerPriority | null;\n callsite?: SheetRule['callsite'];\n debug?: DebugData | null;\n debugField?: string | null;\n};\n\nexport type ClassNameResultRSC = ClassNameResult & {\n [ELEMENT_CSS_DATA_ATTR]?: string;\n};\n\nexport function getClassName(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): ClassNameResultRSC {\n const marker = splitElementMarkerStyleProp(styleProp);\n const resolved = resolveClassNameRuntime(marker.styleProp as StyleProp, props);\n\n return DEV_CONFIG.isDev\n ? getClassNameRSC(resolved.result, resolved.items, marker.debug)\n : resolved.result;\n}\n\nexport function getClassNameRSC(\n result: ClassNameResult,\n items: readonly StylePropItem[],\n markerDebug?: ReturnType<typeof splitElementMarkerStyleProp>['debug'],\n): ClassNameResultRSC {\n const rules = collectStylePropItemsSheetRulesWithThemes(items);\n const marker = createElementMarkerRuleFromDebug(markerDebug);\n\n if (!rules.length && !marker) return result;\n\n addRscStyleRules(rules);\n\n if (marker) {\n result.className = result.className\n ? `${marker.className} ${result.className}`\n : marker.className;\n }\n\n return {\n ...result,\n [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules),\n };\n}\n\nexport function createRscStylePayload(rules: readonly SheetRule[]): string {\n return JSON.stringify(rules.map(createRscStylePayloadRule));\n}\n\nfunction createRscStylePayloadRule(rule: SheetRule): RscStylePayloadRule {\n return {\n key: rule.key,\n css: rule.css,\n priority: rule.priority,\n callsite: isElementMarkerRule(rule) ? rule.callsite : undefined,\n debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : undefined,\n debugField: rule.debugField,\n };\n}\n\nfunction createRscDebugPayload(\n debug: DebugData,\n debugField: string | null | undefined,\n): DebugData {\n const { code: _code, fields, ...payload } = debug;\n\n if (!debugField || !fields?.[debugField]) {\n return payload;\n }\n\n return {\n ...payload,\n fields: {\n [debugField]: fields[debugField],\n },\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,MAAM,YAAY,CAAC;CAEnB,MAAM,QAAmB,CAAC,KAAK;CAE/B,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,OAAO,OAAO,WAAW,IAAI;CAEjC;CAEA,OAAO;AACT;AAEA,SAAgB,uBACd,QACA,mBACA;CACA,IAAI,CAAC,mBAAmB;CAExB,OAAO,YAAY,OAAO,YACtB,OAAO,YAAY,MAAM,oBACzB;AACN;AAEA,SAAgB,mBACd,QACA,eACA;CACA,IAAI,CAAC,eAAe;CAEpB,OAAO,QAAQ,OAAO,QAClB,OAAO,OAAO,CAAC,GAAG,eAAe,OAAO,KAAK,IAC7C;AAC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O,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
1
+ {"version":3,"file":"utils-Bmw655wa.js","names":[],"sources":["../runtime/core/className.ts","../runtime/core/resolveClassNameRuntime.ts","../runtime/rsc/getClassName.ts","../runtime/core/createTransformElement.ts","../runtime/rsc/jsx.ts","../jsx/utils.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { RecursiveArray } from '../../utils/type';\n\ntype Items<T = string> = T | false | null | undefined | RecursiveArray<T | false | null | undefined>;\n\nexport type ClassNameProps = {\n className?: Items<string>;\n style?: Items<CSSProperties>;\n};\n\nexport type ClassNameResult = {\n className?: string | undefined;\n style?: CSSProperties | undefined;\n};\n\nexport function mergeClassName(className: Items<string>) {\n if (!className) return undefined;\n if (!Array.isArray(className)) return className as string;\n\n let nextClassName = '';\n\n const stack: unknown[] = [className];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n nextClassName = nextClassName\n ? `${nextClassName} ${item}`\n : item as string;\n }\n }\n\n return nextClassName || undefined;\n}\n\nexport function mergeStyle(style: Items<CSSProperties>) {\n if (!style) return undefined;\n if (!Array.isArray(style)) return style as CSSProperties;\n\n const nextStyle = {};\n\n const stack: unknown[] = [style];\n\n while (stack.length) {\n const item = stack.pop();\n\n if (!item) continue;\n\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index--) {\n stack.push(item[index]);\n }\n } else {\n Object.assign(nextStyle, item);\n }\n }\n\n return nextStyle;\n}\n\nexport function mergeResolvedClassName(\n result: ClassNameResult,\n resolvedClassName: string,\n) {\n if (!resolvedClassName) return;\n\n result.className = result.className\n ? result.className + ' ' + resolvedClassName\n : resolvedClassName;\n}\n\nexport function mergeResolvedStyle(\n result: ClassNameResult,\n resolvedStyle: CSSProperties | undefined,\n) {\n if (!resolvedStyle) return;\n\n result.style = result.style\n ? Object.assign({}, resolvedStyle, result.style)\n : resolvedStyle;\n}\n\nexport function createClassNameResult(\n props: ClassNameProps = {},\n): ClassNameResult {\n return {\n className: props.className ? mergeClassName(props.className) : undefined,\n style: props.style ? mergeStyle(props.style) : undefined,\n };\n}\n\nexport function finishClassNameResult(result: ClassNameResult): ClassNameResult {\n return result.className || result.style ? result : {};\n}\n","import { type StyleProp } from '../types';\nimport { resolveStylePropRuntime, type StylePropItem } from './cache/prop';\nimport {\n type ClassNameProps,\n type ClassNameResult,\n createClassNameResult,\n finishClassNameResult,\n mergeResolvedClassName,\n mergeResolvedStyle,\n} from './className';\n\nexport type RuntimeClassNameResolution = {\n result: ClassNameResult;\n items: StylePropItem[];\n};\n\nexport function resolveClassNameRuntime(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): RuntimeClassNameResolution {\n const result = createClassNameResult(props);\n const resolved = resolveStylePropRuntime(styleProp);\n\n if (resolved) {\n mergeResolvedClassName(result, resolved.result.className);\n mergeResolvedStyle(result, resolved.result.style);\n }\n\n return {\n result: finishClassNameResult(result),\n items: resolved?.items ?? [],\n };\n}\n","import type { LayerPriority } from '../../atomic/layer';\nimport type { DebugData } from '../../builder/data/debug';\nimport { DEV_CONFIG } from '../../config/config/dev';\nimport type { SheetRule } from '../../sheet';\nimport type { StylePropItem } from '../core/cache/prop';\nimport type { ClassNameProps, ClassNameResult } from '../core/className';\nimport {\n createElementMarkerRuleFromDebug,\n isElementMarkerRule,\n splitElementMarkerStyleProp,\n} from '../core/elementMarker';\nimport { resolveClassNameRuntime } from '../core/resolveClassNameRuntime';\nimport { collectStylePropItemsSheetRulesWithThemes } from '../sheet/rules';\nimport type { StyleProp } from '../types';\nimport { ELEMENT_CSS_DATA_ATTR } from './constants';\nimport { addRscStyleRules } from './styleStore';\n\nexport type RscStylePayloadRule = {\n key?: string | null;\n css: string;\n priority?: LayerPriority | null;\n callsite?: SheetRule['callsite'];\n debug?: DebugData | null;\n debugField?: string | null;\n};\n\nexport type ClassNameResultRSC = ClassNameResult & {\n [ELEMENT_CSS_DATA_ATTR]?: string;\n};\n\nexport function getClassName(\n styleProp: StyleProp,\n props: ClassNameProps = {},\n): ClassNameResultRSC {\n const marker = splitElementMarkerStyleProp(styleProp);\n const resolved = resolveClassNameRuntime(marker.styleProp as StyleProp, props);\n\n return DEV_CONFIG.isDev\n ? getClassNameRSC(resolved.result, resolved.items, marker.debug)\n : resolved.result;\n}\n\nexport function getClassNameRSC(\n result: ClassNameResult,\n items: readonly StylePropItem[],\n markerDebug?: ReturnType<typeof splitElementMarkerStyleProp>['debug'],\n): ClassNameResultRSC {\n const rules = collectStylePropItemsSheetRulesWithThemes(items);\n const marker = createElementMarkerRuleFromDebug(markerDebug);\n\n if (!rules.length && !marker) return result;\n\n addRscStyleRules(rules);\n\n if (marker) {\n result.className = result.className\n ? `${marker.className} ${result.className}`\n : marker.className;\n }\n\n return {\n ...result,\n [ELEMENT_CSS_DATA_ATTR]: createRscStylePayload(marker ? [marker.rule, ...rules] : rules),\n };\n}\n\nexport function createRscStylePayload(rules: readonly SheetRule[]): string {\n return JSON.stringify(rules.map(createRscStylePayloadRule));\n}\n\nfunction createRscStylePayloadRule(rule: SheetRule): RscStylePayloadRule {\n return {\n key: rule.key,\n css: rule.css,\n priority: rule.priority,\n callsite: isElementMarkerRule(rule) ? rule.callsite : undefined,\n debug: rule.debug ? createRscDebugPayload(rule.debug, rule.debugField) : undefined,\n debugField: rule.debugField,\n };\n}\n\nfunction createRscDebugPayload(\n debug: DebugData,\n debugField: string | null | undefined,\n): DebugData {\n const { code: _code, fields, ...payload } = debug;\n\n if (!debugField || !fields?.[debugField]) {\n return payload;\n }\n\n return {\n ...payload,\n fields: {\n [debugField]: fields[debugField],\n },\n };\n}\n","import type { TransformElement } from '../../jsx/utils';\nimport { hasOwn } from '../../utils/object';\nimport type { RuntimeStyleAttributes, StyleProp } from '../types';\nimport type { ClassNameProps, ClassNameResult } from './className';\nimport { createElementMarkerClassName, splitElementMarkerStyleProp } from './elementMarker';\n\nexport function createTransformElement(\n getClassName: (styleProp: StyleProp, props?: ClassNameProps) => ClassNameResult,\n): TransformElement {\n return ({ type, props }) => {\n if (!props || typeof type !== 'string') return { type, props };\n if (!hasOwn(props as object, 'css')) return { type, props };\n\n const { css, ...rest } = props as RuntimeStyleAttributes & ClassNameProps;\n\n if (!css) return { type, props: rest };\n\n const marker = splitElementMarkerStyleProp(css);\n\n if (marker.styleProp) {\n Object.assign(rest, getClassName(marker.styleProp, rest));\n }\n\n prependClassName(rest, createElementMarkerClassName(marker.debug));\n\n return { type, props: rest };\n };\n}\n\nfunction prependClassName(\n props: ClassNameProps,\n className: string | null,\n) {\n if (!className) return;\n\n props.className = props.className\n ? `${className} ${props.className}`\n : className;\n}\n","import { createTransformElement } from '../core/createTransformElement';\nimport { getClassName } from './getClassName';\n\nexport const transformElement = createTransformElement(getClassName);\n","import type { createElement, ElementType, Fragment } from 'react';\nimport type { jsxDEV } from 'react/jsx-dev-runtime';\nimport type { jsx, jsxs } from 'react/jsx-runtime';\n\nexport type FnJsxDEV = typeof jsxDEV;\nexport type FnJsx = typeof jsx;\nexport type FnJsxs = typeof jsxs;\nexport type FnCreateElement = typeof createElement;\n\nexport type TransformElementArgs = {\n type: ElementType;\n props: unknown;\n source?: unknown;\n};\n\nexport type TransformElement = {\n (args: TransformElementArgs): TransformElementArgs;\n};\n\nexport function wrapCreateElement(\n createElement: FnCreateElement,\n transformElement: TransformElement,\n): FnCreateElement {\n const fn = (type: ElementType, props: unknown, ...children: []) => {\n const result = transformElement({ type, props });\n\n return createElement(result.type, result.props, ...children);\n };\n\n return fn as FnCreateElement;\n}\n\nexport function wrapFragment(\n fragment: typeof Fragment,\n) {\n return fragment;\n}\n\nexport function createJsxDEV(\n fn: FnJsxDEV,\n transformElement: TransformElement,\n): FnJsxDEV {\n return (type, props, key, isStatic, source, self) => {\n const result = transformElement({ type, props, source });\n\n return fn(result.type, result.props, key, isStatic, source, self);\n };\n}\n\nexport function createJsx(\n fn: FnJsx,\n transformElement: TransformElement,\n): FnJsx {\n return (type, props, key) => {\n const result = transformElement({ type, props });\n\n return fn(result.type, result.props, key);\n };\n}\n"],"mappings":";;;AAeA,SAAgB,eAAe,WAA0B;CACvD,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAAG,OAAO;CAEtC,IAAI,gBAAgB;CAEpB,MAAM,QAAmB,CAAC,SAAS;CAEnC,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;OAGxB,gBAAgB,gBACZ,GAAG,cAAc,GAAG,SACpB;CAER;CAEA,OAAO,iBAAiB,KAAA;AAC1B;AAEA,SAAgB,WAAW,OAA6B;CACtD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,MAAM,YAAY,CAAC;CAEnB,MAAM,QAAmB,CAAC,KAAK;CAE/B,OAAO,MAAM,QAAQ;EACnB,MAAM,OAAO,MAAM,IAAI;EAEvB,IAAI,CAAC,MAAM;EAEX,IAAI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iB,MAAM,6BAA6B,OAAO,KAAK,CAAC;EAEjE,OAAO;GAAE;GAAM,OAAO;EAAK;CAC7B;AACF;AAEA,SAAS,iBACP,OACA,WACA;CACA,IAAI,CAAC,WAAW;CAEhB,MAAM,YAAY,MAAM,YACpB,GAAG,UAAU,GAAG,MAAM,cACtB;AACN;;;ACnCA,MAAa,mBAAmB,uBAAuB,YAAY;;;ACgBnE,SAAgB,kBACd,eACA,kBACiB;CACjB,MAAM,MAAM,MAAmB,OAAgB,GAAG,aAAiB;EACjE,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,cAAc,OAAO,MAAM,OAAO,OAAO,GAAG,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAgB,aACd,UACA;CACA,OAAO;AACT;AAEA,SAAgB,aACd,IACA,kBACU;CACV,QAAQ,MAAM,OAAO,KAAK,UAAU,QAAQ,SAAS;EACnD,MAAM,SAAS,iBAAiB;GAAE;GAAM;GAAO;EAAO,CAAC;EAEvD,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,KAAK,UAAU,QAAQ,IAAI;CAClE;AACF;AAEA,SAAgB,UACd,IACA,kBACO;CACP,QAAQ,MAAM,OAAO,QAAQ;EAC3B,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAM,CAAC;EAE/C,OAAO,GAAG,OAAO,MAAM,OAAO,OAAO,GAAG;CAC1C;AACF"}
@@ -1,6 +1,6 @@
1
- import { o as normalizePath } from "./compiler-BXcGyZUP.mjs";
2
- import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-o8pviMUi.mjs";
3
- import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-D3x1EDJm.mjs";
1
+ import { o as normalizePath } from "./compiler-D5v5tJXI.mjs";
2
+ import { f as resolvePluginSourcemapOptions, h as getPluginBuildDevConfig, m as getPluginBuildConfig } from "./misc-DFBKJGLT.mjs";
3
+ import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CiwvMfx8.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { createHash } from "node:crypto";
6
6
  import path from "node:path";
@@ -94,4 +94,4 @@ function replaceCssMarkerAsset(args) {
94
94
  //#endregion
95
95
  export { LOADER_IMPORT_PATH as _, createNextBuildDevConfig as a, getNextPrecollectCacheSubdir as c, nextRegistry as d, removeUndefinedValues as f, DEV_CSS_ROUTE as g, CSS_ENTRY_IMPORT_PATH as h, createNextBuildConfig as i, getTransformLoaderPath as l, resolveNextCompilerOptions as m, addAliases as n, createNextConfigHash as o, replaceCssMarkerAsset as p, addWebpackPlugin as r, getNextCacheDir as s, NEXT_COMPILER_IDS as t, isAppLayoutFile as u };
96
96
 
97
- //# sourceMappingURL=utils-CpA-dSpY.mjs.map
97
+ //# sourceMappingURL=utils-D2fygyTm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-CpA-dSpY.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACW5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBAAgB,SAAiB,UAAmB;CAClE,OAAO,YAAY,KAAK,KAAK,SAAS,4BAA4B;AACpE;AAEA,SAAgB,6BAA6B,KAAc;CACzD,OAAO,MAAM,sBAAsB,MAAM,sBAAsB;AACjE;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,yBAAyB,SAA+C;CACtF,OAAO,wBAAwB,OAAO;AACxC;AAEA,SAAgB,qBACd,aACA,KACA;CACA,MAAM,SAAS,CACb,MAAM,QAAQ,QACd,YAAY,QAAQ,UAAU,UAChC;CAEA,OAAO,WAAW,QAAQ,EAAE,OAAO,OAAO,K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SAAS,KAAK,YAAY,UAAU,GAAG;EAChD,IAAI,CAAC,MAAM,KAAK,SAAS,MAAM,GAAG;EAElC,MAAM,SAAS,MAAM,OAAO,OAAO,EAAE,SAAS;EAC9C,IAAI,CAAC,aAAa,QAAQ,KAAK,MAAM,GAAG;EAExC,KAAK,YAAY,YACf,MAAM,MACN,IAAI,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"utils-D2fygyTm.mjs","names":[],"sources":["../plugin/nextjs/constants.ts","../plugin/nextjs/utils.ts"],"sourcesContent":["import { STYLE_IMPORTS } from '../utils/imports';\n\nexport const DEV_CSS_ROUTE = '/__fluentic/dev.css';\n\nexport const LOADER_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/loader';\n\nexport const CSS_ENTRY_IMPORT_PATH = STYLE_IMPORTS.Plugin + '/nextjs/bundle.css';\n","import { createHash } from 'node:crypto';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport type { Compiler as PluginCompiler } from '../../compiler';\nimport { normalizePath } from '../../compiler/utils/path';\nimport type { BuildConfig, BuildDevConfig } from '../../config/build';\nimport { createWebpackRegistry } from '../bundler/webpack/shared/registry';\nimport type { FileCssCache } from '../utils/cache';\nimport type { PluginOptions as BasePluginOptions } from '../utils/compiler';\nimport type { TransformFilter } from '../utils/filter';\nimport { getPluginBuildConfig, getPluginBuildDevConfig } from '../utils/runtimeEntry';\nimport type { SourcemapSidecar } from '../utils/sidecar';\nimport { resolvePluginSourcemapOptions } from '../utils/sourcemap';\nimport { LOADER_IMPORT_PATH } from './constants';\nimport type { PluginOptions, WebpackConfiguration } from './types';\n\nexport const nextRegistry = createWebpackRegistry('nextjs.registry');\n\nexport const PRECOLLECT_CACHE_DIRS = {\n dev: 'nextjs/precollect/dev',\n prod: 'nextjs/precollect/prod',\n};\n\nexport const NEXT_COMPILER_IDS = {\n turbopack: 'nextjs:turbopack',\n webpackServer: 'nextjs:webpack-server',\n webpackClient: 'nextjs:webpack-client',\n};\n\nexport type { PluginCompiler };\n\nexport type NextLoaderState = {\n compiler: PluginCompiler;\n filter: TransformFilter;\n dev: boolean;\n isServer: boolean;\n configHash: string;\n devCssHref: string | null;\n cssEntryImportPath: string;\n cssCache: Pick<FileCssCache, 'setFileCss'> | null;\n};\n\nexport type NextWebpackEntryValue = string | string[] | {\n import?: string | string[];\n [key: string]: unknown;\n};\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(LOADER_IMPORT_PATH);\n}\n\nexport function getNextCacheDir(rootDir: string, cacheDir?: string) {\n return cacheDir ?? path.join(rootDir, '.next/cache/fluentic-style');\n}\n\nexport function getNextPrecollectCacheSubdir(dev: boolean) {\n return dev ? PRECOLLECT_CACHE_DIRS.dev : PRECOLLECT_CACHE_DIRS.prod;\n}\n\nexport function createNextBuildConfig(options: PluginOptions): BuildConfig {\n return getPluginBuildConfig(options);\n}\n\nexport function createNextBuildDevConfig(options: PluginOptions): BuildDevConfig | null {\n return getPluginBuildDevConfig(options);\n}\n\nexport function createNextConfigHash(\n buildConfig: BuildConfig,\n dev: boolean,\n) {\n const values = [\n dev ? 'dev' : 'prod',\n buildConfig.hoist ? 'hoist' : 'no-hoist',\n ];\n\n return createHash('sha256').update(values.join('\\0')).digest('hex');\n}\n\nexport function resolveNextCompilerOptions(\n options: PluginOptions,\n sidecar: SourcemapSidecar | null,\n buildConfig: BuildConfig,\n buildDevConfig: BuildDevConfig | null,\n dev: boolean,\n): BasePluginOptions {\n const resolved = resolvePluginSourcemapOptions({\n ...options,\n devSourcemap: dev ? 'sidecarServer' : 'sourceUrl',\n }, sidecar);\n\n return {\n ...resolved,\n css: {\n ...resolved.css,\n ...buildConfig.css,\n },\n dev: {\n ...resolved.dev,\n ...buildDevConfig,\n },\n };\n}\n\nexport function removeUndefinedValues<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item) => removeUndefinedValues(item)) as T;\n }\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, item] of Object.entries(value)) {\n if (item !== undefined) {\n result[key] = removeUndefinedValues(item);\n }\n }\n\n return result as T;\n}\n\nexport function prependClientEntry(entry: unknown, moduleId: string) {\n if (typeof entry === 'function') {\n return async () => prependClientEntry(await entry(), moduleId);\n }\n\n if (!entry || typeof entry !== 'object') return entry;\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependEntryValue(value as NextWebpackEntryValue, moduleId);\n }\n\n return result;\n}\n\nexport function prependEntryValue(entry: NextWebpackEntryValue, moduleId: string): NextWebpackEntryValue {\n if (typeof entry === 'string') {\n return entry === moduleId ? entry : [moduleId, entry];\n }\n\n if (Array.isArray(entry)) {\n return entry.includes(moduleId) ? entry : [moduleId, ...entry];\n }\n\n const imports = entry.import;\n if (!imports) return { ...entry, import: moduleId };\n\n return {\n ...entry,\n import: Array.isArray(imports)\n ? imports.includes(moduleId) ? imports : [moduleId, ...imports]\n : imports === moduleId\n ? imports\n : [moduleId, imports],\n };\n}\n\nexport function isAppLayoutFile(filePath: string) {\n return /\\/app\\/(?:[^/]+\\/)*layout\\.[cm]?[jt]sx?$/.test(normalizePath(filePath));\n}\n\nexport function hasCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function replaceCssMarker(source: string, marker: string, css: string) {\n return source.split(marker).join(css);\n}\n\nexport function addAliases(config: WebpackConfiguration, aliases: Record<string, string>) {\n if (!config.resolve) config.resolve = {};\n if (!config.resolve.alias) config.resolve.alias = {};\n Object.assign(config.resolve.alias, aliases);\n}\n\nexport function addWebpackPlugin(config: WebpackConfiguration, plugin: WebpackPluginInstance) {\n if (!config.plugins) config.plugins = [];\n config.plugins.push(plugin);\n}\n\nexport function replaceCssMarkerAsset(args: {\n compiler: Compiler;\n compilation: Compilation;\n css: string;\n marker: string;\n}) {\n for (const asset of args.compilation.getAssets()) {\n if (!asset.name.endsWith('.css')) continue;\n\n const source = asset.source.source().toString();\n if (!hasCssMarker(source, args.marker)) continue;\n\n args.compilation.updateAsset(\n asset.name,\n new args.compiler.webpack.sources.RawSource(\n replaceCssMarker(source, args.marker, args.css),\n ),\n );\n\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAEA,MAAa,gBAAgB;AAE7B,MAAa,qBAAqB,cAAc,SAAS;AAEzD,MAAa,wBAAwB,cAAc,SAAS;;;ACW5D,MAAa,eAAe,sBAAsB,iBAAiB;AAEnE,MAAa,wBAAwB;CACnC,KAAK;CACL,MAAM;AACR;AAEA,MAAa,oBAAoB;CAC/B,WAAW;CACX,eAAe;CACf,eAAe;AACjB;AAoBA,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,kBAAkB;AAClE;AAEA,SAAgB,gBAAgB,SAAiB,UAAmB;CAClE,OAAO,YAAY,KAAK,KAAK,SAAS,4BAA4B;AACpE;AAEA,SAAgB,6BAA6B,KAAc;CACzD,OAAO,MAAM,sBAAsB,MAAM,sBAAsB;AACjE;AAEA,SAAgB,sBAAsB,SAAqC;CACzE,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,yBAAyB,SAA+C;CACtF,OAAO,wBAAwB,OAAO;AACxC;AAEA,SAAgB,qBACd,aACA,KACA;CACA,MAAM,SAAS,CACb,MAAM,QAAQ,QACd,YAAY,QAAQ,UAAU,UAChC;CAEA,OAAO,WAAW,QAAQ,EAAE,OAAO,OAAO,KAAK,IAAI,CAAC,EAAE,OAAO,KAAK;AACpE;AAEA,SAAgB,2BACd,SACA,SACA,aACA,gBACA,KACmB;CACnB,MAAM,WAAW,8BAA8B;EAC7C,GAAG;EACH,cAAc,MAAM,kBAAkB;CACxC,GAAG,OAAO;CAEV,OAAO;EACL,GAAG;EACH,KAAK;GACH,GAAG,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I,KAAK,SAAS,QAAQ,QAAQ,UAChC,iBAAiB,QAAQ,KAAK,QAAQ,KAAK,GAAG,CAChD,CACF;EAEA,OAAO;CACT;CAEA,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
- import { o as normalizePath } from "./compiler-BXcGyZUP.mjs";
2
- import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-D3x1EDJm.mjs";
1
+ import { o as normalizePath } from "./compiler-D5v5tJXI.mjs";
2
+ import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-CiwvMfx8.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  //#region plugin/bundler/webpack/utils.ts
@@ -46,4 +46,4 @@ function prependEntryImport(entryImport, runtimeFilePath) {
46
46
  //#endregion
47
47
  export { prependWebpackRuntimeEntry as a, hasWebpackCssMarker as i, getStylePackageDistPath as n, replaceWebpackCssMarker as o, getTransformLoaderPath as r, webpackRegistry as s, createWebpackRuntimeModuleSource as t };
48
48
 
49
- //# sourceMappingURL=utils-DQGa0uzS.mjs.map
49
+ //# sourceMappingURL=utils-DTXCTUlS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-DQGa0uzS.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa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ACvC,cACA,CAAC,iBAAiB,GAAG,WAAW;AACtC"}
1
+ {"version":3,"file":"utils-DTXCTUlS.mjs","names":[],"sources":["../plugin/bundler/webpack/utils.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { EntryNormalized } from 'webpack';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport { SIDECAR_URL_GLOBAL_SYMBOL } from '../../../config/utils';\nimport type { PluginCompiler } from '../../utils';\nimport { STYLE_IMPORTS } from '../../utils/imports';\nimport { createWebpackRegistry } from './shared/registry';\n\ntype WebpackStaticEntry = Exclude<EntryNormalized, () => Promise<unknown>>;\ntype WebpackEntryDescription = WebpackStaticEntry[string];\n\nexport type WebpackLoaderState = {\n transform: PluginCompiler['transform'];\n};\n\nexport const webpackRegistry = createWebpackRegistry('webpack.registry');\n\nexport function getTransformLoaderPath() {\n return createRequire(import.meta.url).resolve(STYLE_IMPORTS.Plugin + '/webpack/loader');\n}\n\nexport function getStylePackageDistPath() {\n return path.resolve(path.dirname(getTransformLoaderPath()), '../..');\n}\n\nexport function createWebpackRuntimeModuleSource(\n extract: boolean,\n cssFilePath: string | null,\n options: {\n runtimeImportPath?: string | null;\n sidecarUrl?: string | null;\n } = {},\n) {\n return [\n extract && cssFilePath && `import ${JSON.stringify(normalizePath(cssFilePath))};`,\n options.sidecarUrl && options.runtimeImportPath && `import ${JSON.stringify(options.runtimeImportPath)};`,\n options.sidecarUrl &&\n `globalThis[Symbol.for(${JSON.stringify(SIDECAR_URL_GLOBAL_SYMBOL)})] = ${JSON.stringify(options.sidecarUrl)};`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function replaceWebpackCssMarker(\n source: string,\n marker: string,\n css: string,\n) {\n return source.replace(marker, css);\n}\n\nexport function hasWebpackCssMarker(source: string, marker: string) {\n return source.includes(marker);\n}\n\nexport function prependWebpackRuntimeEntry(\n entry: EntryNormalized,\n runtimeFilePath: string,\n): EntryNormalized {\n if (typeof entry === 'function') {\n return async () => prependWebpackRuntimeStaticEntry(await entry(), runtimeFilePath);\n }\n\n return prependWebpackRuntimeStaticEntry(entry, runtimeFilePath);\n}\n\nfunction prependWebpackRuntimeStaticEntry(\n entry: WebpackStaticEntry,\n runtimeFilePath: string,\n): WebpackStaticEntry {\n const result: WebpackStaticEntry = {};\n\n for (const [key, value] of Object.entries(entry)) {\n result[key] = prependWebpackRuntimeEntryDescription(value, runtimeFilePath);\n }\n\n return result;\n}\n\nfunction prependWebpackRuntimeEntryDescription(\n entry: WebpackEntryDescription,\n runtimeFilePath: string,\n): WebpackEntryDescription {\n if (!entry.import) return entry;\n\n return {\n ...entry,\n import: prependEntryImport(entry.import, runtimeFilePath),\n };\n}\n\nfunction prependEntryImport(entryImport: string[], runtimeFilePath: string) {\n return entryImport.includes(runtimeFilePath)\n ? entryImport\n : [runtimeFilePath, ...entryImport];\n}\n"],"mappings":";;;;;AAgBA,MAAa,kBAAkB,sBAAsB,kBAAkB;AAEvE,SAAgB,yBAAyB;CACvC,OAAO,cAAc,OAAO,KAAK,GAAG,EAAE,QAAQ,cAAc,SAAS,iBAAiB;AACxF;AAEA,SAAgB,0BAA0B;CACxC,OAAO,KAAK,QAAQ,KAAK,QAAQ,uBAAuB,CAAC,GAAG,OAAO;AACrE;AAEA,SAAgB,iCACd,SACA,aACA,UAGI,CAAC,GACL;CACA,OAAO;EACL,WAAW,eAAe,UAAU,KAAK,UAAU,cAAc,WAAW,CAAC,EAAE;EAC/E,QAAQ,cAAc,QAAQ,qBAAqB,UAAU,KAAK,UAAU,QAAQ,iBAAiB,EAAE;EACvG,QAAQ,cACR,yBAAyB,KAAK,UAAA,4BAAmC,EAAE,OAAO,KAAK,UAAU,QAAQ,UAAU,EAAE;EAC7G;CACF,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC7B;AAEA,SAAgB,wBACd,QACA,QACA,KACA;CACA,OAAO,OAAO,QAAQ,QAAQ,GAAG;AACnC;AAEA,SAAgB,oBAAoB,QAAgB,QAAgB;CAClE,OAAO,OAAO,SAAS,MAAM;AAC/B;AAEA,SAAgB,2BACd,OACA,iBACiB;CACjB,IAAI,OAAO,UAAU,YACnB,OAAO,YAAY,iCAAiC,MAAM,MAAM,GAAG,eAAe;CAGpF,OAAO,iCAAiC,OAAO,eAAe;AAChE;AAEA,SAAS,iCACP,OACA,iBACoB;CACpB,MAAM,SAA6B,CAAC;CAEpC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,OAAO,OAAO,sCAAsC,OAAO,eAAe;CAG5E,OAAO;AACT;AAEA,SAAS,sCACP,OACA,iBACyB;CACzB,IAAI,CAAC,MAAM,QAAQ,OAAO;CAE1B,OAAO;EACL,GAAG;EACH,QAAQ,mBAAmB,MAAM,QAAQ,eAAe;CAC1D;AACF;AAEA,SAAS,mBAAmB,aAAuB,iBAAyB;CAC1E,OAAO,YAAY,SAAS,eAAe,IACvC,cACA,CAAC,iBAAiB,GAAG,WAAW;AACtC"}
@@ -40,6 +40,18 @@ function normalizeHashLength(length) {
40
40
  return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;
41
41
  }
42
42
  //#endregion
43
+ //#region config/config/debug.ts
44
+ const DEFAULT_DEBUG_CONFIG = {
45
+ isDebugClassNameEnabled: false,
46
+ isDebugClassNameConfigured: false,
47
+ maxPropertyLength: 24,
48
+ maxValueLength: 8,
49
+ maxSelectorLength: 8,
50
+ maxParentSelectorLength: 8,
51
+ maxAtRuleLength: 10
52
+ };
53
+ globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
54
+ //#endregion
43
55
  //#region config/utils.ts
44
56
  const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
45
57
  function getCacheTTL(cache) {
@@ -2483,4 +2495,4 @@ function createJsx(fn, transformElement) {
2483
2495
  //#endregion
2484
2496
  export { transformElement as a, wrapFragment as i, createJsxDEV as n, wrapCreateElement as r, createJsx as t };
2485
2497
 
2486
- //# sourceMappingURL=utils-BsbfH6cd.js.map
2498
+ //# sourceMappingURL=utils-DVFxZnVC.js.map