@fluentic/style 0.1.0-beta.1 → 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 (297) hide show
  1. package/CHANGELOG.md +31 -2
  2. package/README.md +80 -23
  3. package/atomic/atRule/utils.ts +3 -2
  4. package/atomic/className.ts +25 -4
  5. package/atomic/debug/className/className.ts +23 -2
  6. package/atomic/element.ts +5 -2
  7. package/atomic/theme.ts +4 -2
  8. package/atomic/token.ts +4 -2
  9. package/atomic/utils/css.ts +44 -19
  10. package/atomic/utils/format.ts +1 -1
  11. package/atomic/utils/hash.ts +78 -0
  12. package/atomic/var.ts +3 -2
  13. package/builder/classname/class_name_builder.ts +447 -0
  14. package/builder/classname/fns.ts +77 -0
  15. package/builder/classname/index.ts +3 -0
  16. package/builder/classname/types.ts +34 -0
  17. package/builder/data/create.ts +6 -6
  18. package/builder/data/data.ts +7 -7
  19. package/builder/data/debug.ts +1 -0
  20. package/builder/data/is.ts +3 -3
  21. package/builder/data/merge/scope.ts +18 -19
  22. package/builder/data/merge/style.ts +11 -0
  23. package/builder/data/state.ts +1 -0
  24. package/builder/style_builder.ts +17 -17
  25. package/builder/style_fns.ts +33 -33
  26. package/builder/types/alias.ts +10 -10
  27. package/builder/types/fns.ts +11 -11
  28. package/builder/types/types.ts +5 -5
  29. package/compiler/compiler/types.ts +0 -1
  30. package/compiler/transform/debug/plugin.ts +8 -3
  31. package/compiler/transform/debug/utils/debug_data.ts +73 -0
  32. package/compiler/transform/evaluator/evaluator.ts +33 -2
  33. package/compiler/transform/evaluator/tracer.ts +13 -9
  34. package/compiler/transform/extract/chain/chain.ts +596 -28
  35. package/compiler/transform/extract/plugin.ts +5 -2
  36. package/compiler/transform/extract/utils/state.ts +1 -0
  37. package/compiler/utils/constants.ts +4 -4
  38. package/compiler/utils/file_resolver.ts +1 -0
  39. package/compiler/utils/import_source.ts +3 -2
  40. package/config/build.ts +12 -2
  41. package/config/config/css.ts +3 -0
  42. package/config/config/debug.ts +13 -1
  43. package/config/config/dev.ts +17 -1
  44. package/config/configure.ts +10 -2
  45. package/config/types.ts +7 -0
  46. package/dev/config.ts +2 -3
  47. package/dialect/extracted/index.ts +5 -0
  48. package/dialect/index.ts +1 -0
  49. package/dialect/namedTokens.ts +136 -0
  50. package/dist/{className-C1Ht5Wvv.js → className-CKo4TxuT.js} +2 -2
  51. package/dist/{className-C1Ht5Wvv.js.map → className-CKo4TxuT.js.map} +1 -1
  52. package/dist/{className-DC2Cq8p3.js → className-ZJ5pBA-o.js} +19 -7
  53. package/dist/className-ZJ5pBA-o.js.map +1 -0
  54. package/dist/compiler/index.mjs +1 -1
  55. package/dist/{compiler-DENc3a2R.mjs → compiler-D5v5tJXI.mjs} +607 -114
  56. package/dist/compiler-D5v5tJXI.mjs.map +1 -0
  57. package/dist/config/index.js +2 -2
  58. package/dist/{config-BryWDfQX.js → config-BEvP7108.js} +12 -4
  59. package/dist/config-BEvP7108.js.map +1 -0
  60. package/dist/config-B_cbG3S6.js +1 -0
  61. package/dist/config-FIfi5aJ8.js +32 -0
  62. package/dist/config-FIfi5aJ8.js.map +1 -0
  63. package/dist/config-OXHoDUIo.js +6 -0
  64. package/dist/{config-Di2VYYKV.js.map → config-OXHoDUIo.js.map} +1 -1
  65. package/dist/css-CELBp6Gu.js +58 -0
  66. package/dist/css-CELBp6Gu.js.map +1 -0
  67. package/dist/{css-BowBszUt.js → css-DcuJ_jSH.js} +17 -17
  68. package/dist/css-DcuJ_jSH.js.map +1 -0
  69. package/dist/{css-ByOrugEX.js → css-dPoZJDQH.js} +80 -78
  70. package/dist/css-dPoZJDQH.js.map +1 -0
  71. package/dist/{css-DcazYor9.js → css-oOt6ZR54.js} +10 -8
  72. package/dist/css-oOt6ZR54.js.map +1 -0
  73. package/dist/css.js +1 -1
  74. package/dist/{css_extra-DlOnsnR1.js → css_extra-DQdCrYoC.js} +2 -2
  75. package/dist/{css_extra-DlOnsnR1.js.map → css_extra-DQdCrYoC.js.map} +1 -1
  76. package/dist/{css_extra-oIi3UEPK.js → css_extra-DeTuIlcO.js} +2 -2
  77. package/dist/{css_extra-oIi3UEPK.js.map → css_extra-DeTuIlcO.js.map} +1 -1
  78. package/dist/{data-BsqOa5br.js → data-CeYstKMP.js} +21 -12
  79. package/dist/data-CeYstKMP.js.map +1 -0
  80. package/dist/{debug-n2aZQBSa.js → debug-D96KGgpH.js} +3 -3
  81. package/dist/debug-D96KGgpH.js.map +1 -0
  82. package/dist/dev/rsc.js +9 -9
  83. package/dist/{dev-CcphAa3R.js → dev-fOtWB5K3.js} +7 -8
  84. package/dist/{dev-CcphAa3R.js.map → dev-fOtWB5K3.js.map} +1 -1
  85. package/dist/{dev-DfBbuLeE.js → dev-p8tW7X-A.js} +14 -4
  86. package/dist/dev-p8tW7X-A.js.map +1 -0
  87. package/dist/dev.js +1 -1
  88. package/dist/dialect/extracted/index.js +2 -0
  89. package/dist/dialect/index.js +2 -0
  90. package/dist/{elementMarker-Bu7gDAkE.js → elementMarker-CvqqIb7J.js} +10 -8
  91. package/dist/{elementMarker-Bu7gDAkE.js.map → elementMarker-CvqqIb7J.js.map} +1 -1
  92. package/dist/entry/dev/css.js +2 -2
  93. package/dist/entry/dev/jsx-dev-runtime.js +2 -1
  94. package/dist/entry/dev/jsx-runtime.js +2 -1
  95. package/dist/entry/dev.js +12 -9
  96. package/dist/entry/prod/css.js +2 -2
  97. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  98. package/dist/entry/prod/jsx-runtime.js +2 -2
  99. package/dist/entry/prod/runtime.js +4 -4
  100. package/dist/entry/prod.js +8 -8
  101. package/dist/entry/prod.js.map +1 -1
  102. package/dist/entry/rsc-dev/css.js +2 -2
  103. package/dist/entry/rsc-dev/dev.js +4 -5
  104. package/dist/entry/rsc-dev/dev.js.map +1 -1
  105. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  106. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  107. package/dist/entry/rsc-dev.js +341 -105
  108. package/dist/entry/rsc-dev.js.map +1 -1
  109. package/dist/entry/rsc-prod/css.js +2 -2
  110. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  111. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  112. package/dist/entry/rsc-prod/runtime.js +4 -4
  113. package/dist/entry/rsc-prod.js +7 -7
  114. package/dist/extract-DeOytHKW.js +2 -0
  115. package/dist/{getClassName-BlvXHYuf.js → getClassName-oiQ8CnkS.js} +3 -3
  116. package/dist/getClassName-oiQ8CnkS.js.map +1 -0
  117. package/dist/global-Cul1dX8k.js +14 -0
  118. package/dist/{global-CvfmFLsK.js.map → global-Cul1dX8k.js.map} +1 -1
  119. package/dist/global-zaCE-g1C.js +31 -0
  120. package/dist/global-zaCE-g1C.js.map +1 -0
  121. package/dist/{format-3nKBE_5t.js → hash-Bycpk3MR.js} +53 -37
  122. package/dist/hash-Bycpk3MR.js.map +1 -0
  123. package/dist/index.js +10 -8
  124. package/dist/jsx/jsx-dev-runtime.js +2 -2
  125. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  126. package/dist/jsx/jsx-runtime.js +2 -2
  127. package/dist/jsx/jsx-runtime.server.js +1 -1
  128. package/dist/{jsx-D2BksHSv.js → jsx-A4cK517J.js} +7 -7
  129. package/dist/{jsx-D2BksHSv.js.map → jsx-A4cK517J.js.map} +1 -1
  130. package/dist/{jsx-CwTeyUxr.js → jsx-Ba-XV33u.js} +3 -3
  131. package/dist/{jsx-CwTeyUxr.js.map → jsx-Ba-XV33u.js.map} +1 -1
  132. package/dist/{jsx_dev_runtime-B6xs4by8.js → jsx_dev_runtime-BQcRzl5D.js} +2 -2
  133. package/dist/{jsx_dev_runtime-B6xs4by8.js.map → jsx_dev_runtime-BQcRzl5D.js.map} +1 -1
  134. package/dist/{jsx_runtime-iHLDwpcW.js → jsx_runtime-B9KEoAQN.js} +2 -2
  135. package/dist/{jsx_runtime-iHLDwpcW.js.map → jsx_runtime-B9KEoAQN.js.map} +1 -1
  136. package/dist/{jsx_runtime-04xfnsi7.js → jsx_runtime-BXcbW8Yp.js} +2 -2
  137. package/dist/{jsx_runtime-04xfnsi7.js.map → jsx_runtime-BXcbW8Yp.js.map} +1 -1
  138. package/dist/{layer-D1SaH07m.js → layer-CbQzwZF-.js} +4 -4
  139. package/dist/{layer-D1SaH07m.js.map → layer-CbQzwZF-.js.map} +1 -1
  140. package/dist/{loader-B5Kw0DD-.mjs → loader-BAth2yZ1.mjs} +3 -3
  141. package/dist/{loader-B5Kw0DD-.mjs.map → loader-BAth2yZ1.mjs.map} +1 -1
  142. package/dist/{misc-DCdYYyhK.mjs → misc-DFBKJGLT.mjs} +7 -3
  143. package/dist/{misc-DCdYYyhK.mjs.map → misc-DFBKJGLT.mjs.map} +1 -1
  144. package/dist/namedTokens-BUa6raTb.js +83 -0
  145. package/dist/namedTokens-BUa6raTb.js.map +1 -0
  146. package/dist/plugin/farm/index.mjs +2 -2
  147. package/dist/plugin/nextjs/index.mjs +4 -4
  148. package/dist/plugin/nextjs/loader.mjs +4 -4
  149. package/dist/plugin/parcel/optimizer.cjs +1 -1
  150. package/dist/plugin/parcel/optimizer.mjs +2 -2
  151. package/dist/plugin/parcel/resolver.cjs +1 -1
  152. package/dist/plugin/parcel/resolver.mjs +2 -2
  153. package/dist/plugin/parcel/runtime.cjs +1 -1
  154. package/dist/plugin/parcel/runtime.mjs +1 -1
  155. package/dist/plugin/parcel/transformer.cjs +1 -1
  156. package/dist/plugin/parcel/transformer.mjs +2 -2
  157. package/dist/plugin/rspack/index.mjs +1 -1
  158. package/dist/plugin/vite/index.mjs +11 -8
  159. package/dist/plugin/vite/index.mjs.map +1 -1
  160. package/dist/plugin/webpack/index.mjs +1 -1
  161. package/dist/plugin/webpack/loader.mjs +2 -2
  162. package/dist/presets/tailwind/index.js +971 -0
  163. package/dist/presets/tailwind/index.js.map +1 -0
  164. package/dist/{property-CnLFt5kx.js → property-CF6JgpTq.js} +2 -2
  165. package/dist/{property-CnLFt5kx.js.map → property-CF6JgpTq.js.map} +1 -1
  166. package/dist/{registry-yHLRxyoo.mjs → registry-CiwvMfx8.mjs} +2 -2
  167. package/dist/{registry-yHLRxyoo.mjs.map → registry-CiwvMfx8.mjs.map} +1 -1
  168. package/dist/{rules-9HSO1pxL.js → rules-DlXcch7-.js} +13 -10
  169. package/dist/rules-DlXcch7-.js.map +1 -0
  170. package/dist/runtime-BKChZZ2-.js +52 -0
  171. package/dist/runtime-BKChZZ2-.js.map +1 -0
  172. package/dist/server.js +13 -11
  173. package/dist/server.js.map +1 -1
  174. package/dist/{shared-CxbHR89f.mjs → shared-x59dI2NW.mjs} +4 -4
  175. package/dist/{shared-CxbHR89f.mjs.map → shared-x59dI2NW.mjs.map} +1 -1
  176. package/dist/{shared-CBArHB9-.cjs → shared-yDD0nfm1.cjs} +603 -110
  177. package/dist/shared-yDD0nfm1.cjs.map +1 -0
  178. package/dist/sheet-B-uJfHRY.js +7 -0
  179. package/dist/sheet-B-uJfHRY.js.map +1 -0
  180. package/dist/{sidecar-BFakLl0X.mjs → sidecar-CJ6i4wmn.mjs} +3 -3
  181. package/dist/{sidecar-BFakLl0X.mjs.map → sidecar-CJ6i4wmn.mjs.map} +1 -1
  182. package/dist/{style-B1UUqjj5.js → style-91J0B5ef.js} +35 -7
  183. package/dist/style-91J0B5ef.js.map +1 -0
  184. package/dist/{style-v2bf70TZ.js → style-Bw5ka-Nq.js} +440 -135
  185. package/dist/style-Bw5ka-Nq.js.map +1 -0
  186. package/dist/{style-DgHbdbdF.js → style-DFFK06Of.js} +258 -82
  187. package/dist/style-DFFK06Of.js.map +1 -0
  188. package/dist/style-pz8e5To1.js +5 -0
  189. package/dist/{styleStore-DyNXBcUK.js → styleStore-DJ0Msgkh.js} +6 -5
  190. package/dist/{styleStore-DyNXBcUK.js.map → styleStore-DJ0Msgkh.js.map} +1 -1
  191. package/dist/{styleStore-Dea_WVbr.js → styleStore-ydQcDBD4.js} +16 -7
  192. package/dist/styleStore-ydQcDBD4.js.map +1 -0
  193. package/dist/token-DTOyFLmp.js +58 -0
  194. package/dist/token-DTOyFLmp.js.map +1 -0
  195. package/dist/{token-u_tM-mtg.js → token-DT_sCPtm.js} +125 -31
  196. package/dist/token-DT_sCPtm.js.map +1 -0
  197. package/dist/{trace-Bu_qOqRy.js → trace-CO36aenp.js} +3 -3
  198. package/dist/{trace-Bu_qOqRy.js.map → trace-CO36aenp.js.map} +1 -1
  199. package/dist/{trace-CU0rvNYr.js → trace-D8j96G57.js} +2 -2
  200. package/dist/{trace-CU0rvNYr.js.map → trace-D8j96G57.js.map} +1 -1
  201. package/dist/transform-BTJOg8Hg.js +23 -0
  202. package/dist/transform-BTJOg8Hg.js.map +1 -0
  203. package/dist/{utils-CWNHx4EC.js → utils-Bmw655wa.js} +3 -3
  204. package/dist/{utils-CWNHx4EC.js.map → utils-Bmw655wa.js.map} +1 -1
  205. package/dist/{utils-CEaq_c-A.mjs → utils-D2fygyTm.mjs} +4 -4
  206. package/dist/{utils-CEaq_c-A.mjs.map → utils-D2fygyTm.mjs.map} +1 -1
  207. package/dist/{utils-Bdbqn0f8.mjs → utils-DTXCTUlS.mjs} +3 -3
  208. package/dist/{utils-Bdbqn0f8.mjs.map → utils-DTXCTUlS.mjs.map} +1 -1
  209. package/dist/{utils-BbehLOby.js → utils-DVFxZnVC.js} +159 -76
  210. package/dist/utils-DVFxZnVC.js.map +1 -0
  211. package/dist/{utils-D7FAOyg6.js → utils-hoYnMiA7.js} +4 -4
  212. package/dist/{utils-D7FAOyg6.js.map → utils-hoYnMiA7.js.map} +1 -1
  213. package/dist/utils.js +3 -3
  214. package/dist/value-D-ZcRzLA.js +42 -0
  215. package/dist/value-D-ZcRzLA.js.map +1 -0
  216. package/dist/{value-BR4e2MKt.js → value-DvFkGBy2.js} +147 -28
  217. package/dist/value-DvFkGBy2.js.map +1 -0
  218. package/dist/value-dG9LK0Gq.js +85 -0
  219. package/dist/value-dG9LK0Gq.js.map +1 -0
  220. package/dist/{valueRef-lshFk1Cs.js → valueRef-CsLVJwjA.js} +2 -2
  221. package/dist/{valueRef-lshFk1Cs.js.map → valueRef-CsLVJwjA.js.map} +1 -1
  222. package/dist/{webpack-Dh6lox2l.mjs → webpack-BOU7_xld.mjs} +5 -5
  223. package/dist/{webpack-Dh6lox2l.mjs.map → webpack-BOU7_xld.mjs.map} +1 -1
  224. package/entry/dev/config.ts +1 -1
  225. package/entry/dev/index.ts +1 -0
  226. package/entry/dev/jsx_dev_runtime.ts +1 -0
  227. package/entry/dev/jsx_runtime.ts +1 -0
  228. package/entry/dev/sheet.ts +4 -0
  229. package/entry/prod/runtime.ts +1 -1
  230. package/entry/rsc_dev/config.ts +1 -1
  231. package/entry/rsc_dev/server.ts +1 -1
  232. package/entry/rsc_prod/runtime.ts +1 -1
  233. package/entry/rsc_prod/server.ts +1 -1
  234. package/entry/shared/config_dev.ts +12 -0
  235. package/entry/shared/dev.ts +11 -2
  236. package/entry/shared/utils.ts +28 -0
  237. package/package.json +26 -9
  238. package/plugin/bundler/vite/plugin.ts +2 -1
  239. package/plugin/bundler/vite/state.ts +10 -5
  240. package/plugin/utils/runtimeEntry.ts +12 -0
  241. package/presets/tailwind/classname/index.ts +2 -0
  242. package/presets/tailwind/classname/transform.ts +208 -0
  243. package/presets/tailwind/classname/types.ts +124 -0
  244. package/presets/tailwind/index.ts +5 -0
  245. package/presets/tailwind/selectors.ts +27 -0
  246. package/presets/tailwind/style/index.ts +2 -0
  247. package/presets/tailwind/style/transform.ts +430 -0
  248. package/presets/tailwind/style/types.ts +346 -0
  249. package/presets/tailwind/theme.ts +479 -0
  250. package/presets/tailwind/types.ts +147 -0
  251. package/runtime/core/cache/pool.ts +1 -1
  252. package/runtime/extract/getClassName.ts +1 -6
  253. package/runtime/extract/index.ts +1 -1
  254. package/runtime/index.ts +8 -1
  255. package/runtime/types.ts +4 -2
  256. package/style/classname.ts +41 -0
  257. package/style/index.ts +1 -0
  258. package/style/style.ts +30 -11
  259. package/style/theme.ts +4 -2
  260. package/style/transform.ts +41 -2
  261. package/utils/hash.ts +4 -0
  262. package/atomic/layer/README.md +0 -116
  263. package/dist/className-DC2Cq8p3.js.map +0 -1
  264. package/dist/compiler-DENc3a2R.mjs.map +0 -1
  265. package/dist/config-BryWDfQX.js.map +0 -1
  266. package/dist/config-DKHXWhe1.js +0 -1
  267. package/dist/config-Di2VYYKV.js +0 -6
  268. package/dist/config-DloHOG6I.js +0 -13
  269. package/dist/config-DloHOG6I.js.map +0 -1
  270. package/dist/css-BowBszUt.js.map +0 -1
  271. package/dist/css-ByOrugEX.js.map +0 -1
  272. package/dist/css-DcazYor9.js.map +0 -1
  273. package/dist/data-BsqOa5br.js.map +0 -1
  274. package/dist/debug-BAw63qX6.js +0 -15
  275. package/dist/debug-BAw63qX6.js.map +0 -1
  276. package/dist/debug-DGki_v7g.js +0 -15
  277. package/dist/debug-DGki_v7g.js.map +0 -1
  278. package/dist/debug-n2aZQBSa.js.map +0 -1
  279. package/dist/dev-DfBbuLeE.js.map +0 -1
  280. package/dist/extract-DEwSDJ9Z.js +0 -2
  281. package/dist/format-3nKBE_5t.js.map +0 -1
  282. package/dist/getClassName-BlvXHYuf.js.map +0 -1
  283. package/dist/global-CvfmFLsK.js +0 -11
  284. package/dist/rules-9HSO1pxL.js.map +0 -1
  285. package/dist/runtime-CYqNCiaM.js +0 -53
  286. package/dist/runtime-CYqNCiaM.js.map +0 -1
  287. package/dist/shared-CBArHB9-.cjs.map +0 -1
  288. package/dist/style-B-6jHipw.js +0 -5
  289. package/dist/style-B1UUqjj5.js.map +0 -1
  290. package/dist/style-DgHbdbdF.js.map +0 -1
  291. package/dist/style-v2bf70TZ.js.map +0 -1
  292. package/dist/styleStore-Dea_WVbr.js.map +0 -1
  293. package/dist/token-u_tM-mtg.js.map +0 -1
  294. package/dist/utils-BbehLOby.js.map +0 -1
  295. package/dist/value-BR4e2MKt.js.map +0 -1
  296. package/dist/value-E8rEv2Oe.js +0 -136
  297. package/dist/value-E8rEv2Oe.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
@@ -48,32 +73,8 @@ function hashString(str) {
48
73
  for (let i = 0; i < str.length; i++) hash = Math.imul(hash ^ str.charCodeAt(i), 16777619);
49
74
  return (hash >>> 0).toString(36).padEnd(7, "0");
50
75
  }
51
- //#endregion
52
- //#region atomic/utils/css.ts
53
- function getCssVar(varName, value) {
54
- return "var(" + varName + ", " + escapeCssValue(value) + ")";
55
- }
56
- function getCssVarRawFallback(varName, fallbackCss) {
57
- return "var(" + varName + ", " + fallbackCss + ")";
58
- }
59
- function escapeCssValue(value) {
60
- if (!value) return "";
61
- return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
62
- }
63
- function escapeCssIdent(ident) {
64
- const escaped = ident.replace(/([[\]():.#,>+~*=!|^$@])/g, "\\$1");
65
- if (/^[0-9]/.test(escaped)) return "\\3" + escaped[0] + " " + escaped.slice(1);
66
- if (/^-[0-9]/.test(escaped)) return "-\\3" + escaped[1] + " " + escaped.slice(2);
67
- return escaped;
68
- }
69
- function sanitizeCssIdentName(value, fallback = "") {
70
- return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || fallback;
71
- }
72
- function getIdentifierSafeHash(value) {
73
- const hash = hashString(value);
74
- const first = hash.charCodeAt(0);
75
- if (first < 48 || first > 57) return hash;
76
- return String.fromCharCode(97 + first - 48) + hash.slice(1);
76
+ function normalizeHashLength(length) {
77
+ return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;
77
78
  }
78
79
  //#endregion
79
80
  //#region atomic/utils/format.ts
@@ -96,7 +97,7 @@ function createNameFormatter(keys) {
96
97
  const name = getFormatFn(format)(info);
97
98
  if (!hash) return name;
98
99
  if (name.includes(HASH_TOKEN)) return name.replace(HASH_TOKEN, hash);
99
- return name ? name + "-" + hash : hash;
100
+ return name ? name + "--" + hash : hash;
100
101
  };
101
102
  }
102
103
  function compileFormat(format, keySet) {
@@ -182,10 +183,103 @@ function formatTokenValue(value, maxLength, truncate) {
182
183
  if (!Number.isFinite(maxLength) || maxLength < 0 || value.length <= maxLength) return value;
183
184
  return truncate ? value.slice(0, maxLength) : null;
184
185
  }
186
+ //#endregion
187
+ //#region atomic/utils/css.ts
188
+ function getCssVar(varName, value) {
189
+ return "var(" + varName + ", " + escapeCssValue(value) + ")";
190
+ }
191
+ function getCssVarRawFallback(varName, fallbackCss) {
192
+ return "var(" + varName + ", " + fallbackCss + ")";
193
+ }
194
+ function escapeCssValue(value) {
195
+ if (!value) return "";
196
+ return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
197
+ }
198
+ function escapeCssIdent(ident) {
199
+ let result = "";
200
+ for (let i = 0; i < ident.length; i++) {
201
+ const char = ident.charAt(i);
202
+ const code = ident.charCodeAt(i);
203
+ const nextCode = ident.charCodeAt(i + 1);
204
+ if (code === 0) {
205
+ result += "�";
206
+ continue;
207
+ }
208
+ if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && ident.charCodeAt(0) === 45) {
209
+ result += "\\" + code.toString(16) + " ";
210
+ continue;
211
+ }
212
+ if (i === 0 && code === 45 && ident.length === 1) {
213
+ result += "\\-";
214
+ continue;
215
+ }
216
+ if (code >= 55296 && code <= 56319 && nextCode >= 56320 && nextCode <= 57343) {
217
+ result += char + ident.charAt(++i);
218
+ continue;
219
+ }
220
+ if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
221
+ result += char;
222
+ continue;
223
+ }
224
+ result += "\\" + char;
225
+ }
226
+ return result;
227
+ }
228
+ function sanitizeCssIdentName(value, fallback = "") {
229
+ return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || fallback;
230
+ }
231
+ //#endregion
232
+ //#region atomic/utils/hash.ts
233
+ const POOLED_HASH_STATE = globalData("atomic.hashPool", () => ({
234
+ byValue: /* @__PURE__ */ new Map(),
235
+ byHash: /* @__PURE__ */ new Map(),
236
+ usedByLength: []
237
+ }));
238
+ function getIdentifierSafeHash(value, startLength = 7) {
239
+ return getPooledHash(value, startLength);
240
+ }
241
+ function getPooledHash(value, startLength) {
242
+ const normalizedStartLength = normalizeHashLength(startLength);
243
+ const valueKey = normalizedStartLength + "\0" + value;
244
+ const existing = POOLED_HASH_STATE.byValue.get(valueKey);
245
+ if (existing) return existing;
246
+ let length = normalizedStartLength;
247
+ while (true) {
248
+ if (getPooledHashUsedCount(length) >= getIdentifierSafeHashPoolSize(length)) {
249
+ length++;
250
+ continue;
251
+ }
252
+ for (let index = 0; index < getIdentifierSafeHashPoolSize(length); index++) {
253
+ const hash = getPooledHashCandidate(value, length, index);
254
+ const owner = POOLED_HASH_STATE.byHash.get(hash);
255
+ if (owner !== void 0 && owner !== valueKey) continue;
256
+ POOLED_HASH_STATE.byValue.set(valueKey, hash);
257
+ POOLED_HASH_STATE.byHash.set(hash, valueKey);
258
+ POOLED_HASH_STATE.usedByLength[length] = getPooledHashUsedCount(length) + 1;
259
+ return hash;
260
+ }
261
+ length++;
262
+ }
263
+ }
264
+ function getPooledHashCandidate(value, length, index) {
265
+ return getIdentifierSafeHashValue(hashString(index === 0 ? value : value + "::" + index)).slice(0, length);
266
+ }
267
+ function getPooledHashUsedCount(length) {
268
+ return POOLED_HASH_STATE.usedByLength[length] ?? 0;
269
+ }
270
+ function getIdentifierSafeHashPoolSize(length) {
271
+ if (length <= 0) return 0;
272
+ return 26 * 36 ** (length - 1);
273
+ }
274
+ function getIdentifierSafeHashValue(hash) {
275
+ const first = hash.charCodeAt(0);
276
+ if (first < 48 || first > 57) return hash;
277
+ return String.fromCharCode(97 + first - 48) + hash.slice(1);
278
+ }
185
279
  const formatTokenName = createNameFormatter(["name"]);
186
280
  function getTokenVarName(token, format) {
187
281
  const id = getStyleTokenId(token);
188
- return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id), { name: id });
282
+ return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: id });
189
283
  }
190
284
  function getTokenVar(token, format) {
191
285
  return getTokenVarFallback(token, format);
@@ -199,6 +293,6 @@ function getTokenVarFallback(token, tokenNameFormat) {
199
293
  return getCssVar(varName, String(token.value ?? ""));
200
294
  }
201
295
  //#endregion
202
- export { LayerPlaceholder as _, escapeCssIdent as a, getIdentifierSafeHash as c, BUILD_CONFIG as d, RUNTIME_CONFIG as f, CSS_CONFIG_DEFAULT as g, CSS_CONFIG as h, createNameFormatter as i, sanitizeCssIdentName 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 };
203
297
 
204
- //# sourceMappingURL=token-u_tM-mtg.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;CACn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BAAkB,aAAa,WAAW;AACnD;AAEA,SAAS,8BAA8B,QAAgB;CACrD,IAAI,UAAU,GAAG,OAAO;CAExB,OAAO,KAAK,OAAO,SAAS;AAC9B;AAEA,SAAS,2BAA2B,MAAc;CAChD,MAAM,QAAQ,KAAK,WAAW,CAAC;CAE/B,IAAI,QAAQ,MAAM,QAAQ,IAAI,OAAO;CAErC,OAAO,OAAO,aAAa,KAAK,QAAQ,EAAE,IAAI,KAAK,MAAM,CAAC;AAC5D;ACpEA,MAAa,kBAAkB,oBAAmC,CAAC,MAAM,CAAC;AAE1E,SAAgB,gBACd,OACA,QACA;CACA,MAAM,KAAK,gBAAgB,KAAK;CAQhC,OAAO,OANM,gBACX,UAAA,wBACA,sBAAsB,IAAI,WAAW,UAAU,GAC/C,EAAE,MAAM,GAAG,CAGI;AACnB;AAEA,SAAgB,YACd,OACA,QACA;CACA,OAAO,oBAAoB,OAAO,MAAM;AAC1C;AAEA,SAAgB,sBACd,OACA,QACA;CACA,OAAO,MAAM,MAAM,YAAY,MAAM,KAAK,MAAM,IAAI,MAAM;AAC5D;AAEA,SAAS,oBACP,OACA,iBACQ;CACR,MAAM,UAAU,gBAAgB,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-n2aZQBSa.js";
2
- import { d as getDevSourcemapTags, m as getSourcemapRuleCallsite, p as createSourceMapComment } from "./elementMarker-Bu7gDAkE.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-Bu_qOqRy.js.map
245
+ //# sourceMappingURL=trace-CO36aenp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-Bu_qOqRy.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,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AAM;EAChC,IAAI,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;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
+ {"version":3,"file":"trace-CO36aenp.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,SAA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AQ,CAER;CACF;CAEA,OAAO;AACT;AAEA,SAAS,sBAAsB,QAAgB;CAC7C,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,MAAM;EAE1B,IAAI,SAAS;EACb,IAAI,OAAO;EAEX,OAAO,IAAI;CACb,QAAQ;EACN,MAAM,aAAa,eAAe,QAAQ,CAAC,KAAK,GAAG,CAAC;EAEpD,OAAO,eAAe,KAAK,SAAS,OAAO,MAAM,GAAG,UAAU;CAChE;AACF;AAEA,SAAS,eAAe,MAAc,SAAmB;CACvD,IAAI,QAAQ;CAEZ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,IAAI,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;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,4 +1,4 @@
1
- import { $ as getSourcemapRuleCallsite, Q as createSourceMapComment, X as getDevSourcemapTags, ot as normalizeCallsiteSourceUrl } from "./styleStore-Dea_WVbr.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-CU0rvNYr.js.map
244
+ //# sourceMappingURL=trace-D8j96G57.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trace-CU0rvNYr.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,aA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,OAAO,MAAM,GAAG,UAAU;CAChE;AACF;AAEA,SAAS,eAAe,MAAc,SAAmB;CACvD,IAAI,QAAQ;CAEZ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,IAAI,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,QAAQ;CAC7D;CAEA,OAAO;AACT;AAEA,SAAS,yBAAyB;CAChC,OAAO,iBAAiB,GAAG,SAAS;AACtC;AAEA,SAAS,mBAAmB;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
+ {"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,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"}
@@ -0,0 +1,23 @@
1
+ import { i as symbol } from "./global-zaCE-g1C.js";
2
+ //#region style/transform.ts
3
+ const CLASS_NAME_VALUE = symbol("transform.classNameValue");
4
+ function classNameValue(value, className) {
5
+ return {
6
+ [CLASS_NAME_VALUE]: true,
7
+ value,
8
+ className
9
+ };
10
+ }
11
+ function isClassNameValue(value) {
12
+ return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
13
+ }
14
+ function styleTransform(options) {
15
+ return options;
16
+ }
17
+ function classNameTransform(options) {
18
+ return options;
19
+ }
20
+ //#endregion
21
+ export { styleTransform as i, classNameValue as n, isClassNameValue as r, classNameTransform as t };
22
+
23
+ //# sourceMappingURL=transform-BTJOg8Hg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-BTJOg8Hg.js","names":[],"sources":["../style/transform.ts"],"sourcesContent":["import { symbol } from '../utils/global';\nimport type { CSSProperties, StyleObject, StyleValue } from './types';\n\nconst CLASS_NAME_VALUE: unique symbol = symbol('transform.classNameValue');\n\nexport type ClassNameValue<Value = unknown> = {\n readonly [CLASS_NAME_VALUE]: true;\n readonly value: Value;\n readonly className: string;\n};\n\nexport type TransformStyleObject<Style = unknown> = {\n [P in keyof Style]: StyleValue<Style[P] | ClassNameValue<Style[P]>>;\n};\n\nexport type StyleTransform<Style = unknown> = {\n transform(style: StyleObject<Style>): TransformStyleObject<CSSProperties>;\n};\n\nexport type ClassNameTransform<ClassName extends string = string> = {\n transform(className: ClassName): TransformStyleObject<CSSProperties>;\n};\n\nexport function classNameValue<const Value>(\n value: Value,\n className: string,\n): ClassNameValue<Value> {\n return {\n [CLASS_NAME_VALUE]: true,\n value,\n className,\n };\n}\n\nexport function isClassNameValue(value: unknown): value is ClassNameValue {\n return !!value &&\n typeof value === 'object' &&\n (value as ClassNameValue)[CLASS_NAME_VALUE] === true &&\n typeof (value as ClassNameValue).className === 'string';\n}\n\nexport function styleTransform<Style>(options: StyleTransform<Style>) {\n return options;\n}\n\nexport function classNameTransform<ClassName extends string>(options: ClassNameTransform<ClassName>) {\n return options;\n}\n"],"mappings":";;AAGA,MAAM,mBAAkC,OAAO,0BAA0B;AAoBzE,SAAgB,eACd,OACA,WACuB;CACvB,OAAO;GACJ,mBAAmB;EACpB;EACA;CACF;AACF;AAEA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,CAAC,CAAC,SACP,OAAO,UAAU,YAChB,MAAyB,sBAAsB,QAChD,OAAQ,MAAyB,cAAc;AACnD;AAEA,SAAgB,eAAsB,SAAgC;CACpE,OAAO;AACT;AAEA,SAAgB,mBAA6C,SAAwC;CACnG,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
- import { F as DEV_CONFIG, R as hasOwn } from "./value-BR4e2MKt.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-Dea_WVbr.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-CWNHx4EC.js.map
170
+ //# sourceMappingURL=utils-Bmw655wa.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-CWNHx4EC.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":";;;A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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,MAAM,QAAQ,IAAI,GACpB,KAAK,IAAI,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,SAC5C,MAAM,KAAK,KAAK,MAAM;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,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-DENc3a2R.mjs";
2
- import { f as resolvePluginSourcemapOptions, m as getPluginBuildDevConfig, p as getPluginBuildConfig } from "./misc-DCdYYyhK.mjs";
3
- import { n as STYLE_IMPORTS, t as createWebpackRegistry } from "./registry-yHLRxyoo.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-CEaq_c-A.mjs.map
97
+ //# sourceMappingURL=utils-D2fygyTm.mjs.map