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

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 (888) hide show
  1. package/CHANGELOG.md +228 -16
  2. package/README.md +182 -49
  3. package/atomic/className.ts +33 -12
  4. package/atomic/debug/className/className.ts +10 -15
  5. package/atomic/element.ts +2 -2
  6. package/atomic/layer/layer.ts +7 -3
  7. package/atomic/rule.ts +20 -6
  8. package/atomic/scope.ts +19 -0
  9. package/atomic/theme.ts +41 -2
  10. package/atomic/token.ts +13 -3
  11. package/atomic/utils/{css.ts → cssIdent.ts} +0 -20
  12. package/atomic/utils/cssVar.ts +19 -0
  13. package/atomic/utils/debug.ts +1 -1
  14. package/atomic/utils/hash.ts +1 -65
  15. package/atomic/utils/selector.ts +40 -1
  16. package/atomic/utils/types.ts +4 -2
  17. package/builder/classname/class_name_builder.ts +68 -24
  18. package/builder/classname/fns.ts +2 -2
  19. package/builder/classname/types.ts +7 -0
  20. package/builder/data/const.ts +10 -1
  21. package/builder/data/create.ts +46 -0
  22. package/builder/data/data.ts +26 -1
  23. package/builder/data/index.ts +0 -1
  24. package/builder/data/is.ts +23 -0
  25. package/builder/data/merge/scope.ts +27 -19
  26. package/builder/data/merge/style.ts +115 -46
  27. package/builder/data/state.ts +17 -2
  28. package/builder/extract/index.ts +1 -0
  29. package/builder/extract/sheet.ts +30 -0
  30. package/builder/extract/token.ts +40 -14
  31. package/builder/extract/utils.ts +2 -0
  32. package/builder/extract/withTokens.ts +2 -1
  33. package/builder/selector_override.noop.ts +11 -0
  34. package/builder/selector_override.ts +31 -0
  35. package/builder/selector_override_core.ts +99 -0
  36. package/builder/style_builder.ts +127 -3
  37. package/builder/style_data.ts +25 -0
  38. package/builder/style_fns.ts +24 -24
  39. package/builder/token/data.ts +30 -0
  40. package/builder/token/index.ts +3 -0
  41. package/builder/token/name.ts +54 -0
  42. package/builder/token/symbols.ts +6 -0
  43. package/builder/types/alias.ts +34 -6
  44. package/builder/types/fns.ts +13 -5
  45. package/builder/types/types.ts +32 -2
  46. package/builder/utils.ts +1 -0
  47. package/compiler/compiler/cache_identity.ts +115 -0
  48. package/compiler/compiler/compiler.ts +123 -18
  49. package/compiler/compiler/constants.ts +6 -0
  50. package/compiler/compiler/index.ts +1 -0
  51. package/compiler/compiler/persistent_cache.ts +310 -0
  52. package/compiler/compiler/types.ts +16 -1
  53. package/compiler/cssProp.ts +21 -0
  54. package/compiler/extract/collector.ts +2 -2
  55. package/compiler/extract/extract.ts +24 -45
  56. package/compiler/extract/types.ts +6 -0
  57. package/compiler/index.ts +1 -0
  58. package/compiler/transform/cssProp/index.ts +1 -0
  59. package/compiler/transform/cssProp/plugin.ts +161 -0
  60. package/compiler/transform/debug/plugin.ts +107 -1
  61. package/compiler/transform/debug/transform.ts +2 -1
  62. package/compiler/transform/evaluator/evaluator.ts +223 -38
  63. package/compiler/transform/evaluator/lazy_bindings.ts +63 -0
  64. package/compiler/transform/evaluator/metadata_cache.ts +124 -0
  65. package/compiler/transform/evaluator/tracer.ts +151 -89
  66. package/compiler/transform/extract/chain/chain.ts +794 -84
  67. package/compiler/transform/extract/chain/extract_chain.ts +28 -4
  68. package/compiler/transform/extract/chain/types.ts +3 -1
  69. package/compiler/transform/extract/plugin.ts +159 -42
  70. package/compiler/transform/extract/transform.ts +2 -1
  71. package/compiler/transform/extract/utils/imports.ts +8 -1
  72. package/compiler/transform/extract/utils/replacement.ts +92 -5
  73. package/compiler/transform/extract/utils/state.ts +8 -2
  74. package/compiler/transform/extract/utils/theme.ts +6 -6
  75. package/compiler/transform/extract/utils/token.ts +107 -0
  76. package/compiler/transform/index.ts +1 -0
  77. package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
  78. package/compiler/transform/syntax/static_ids.ts +1 -1
  79. package/compiler/transform/utils/babel.ts +1 -1
  80. package/compiler/utils/check_diagnostics.ts +18 -0
  81. package/compiler/utils/constants.ts +10 -5
  82. package/compiler/utils/file_resolver.ts +27 -1
  83. package/compiler/utils/import_source.ts +17 -7
  84. package/compiler/utils/imports.ts +11 -1
  85. package/config/build.ts +9 -2
  86. package/config/config/check.ts +25 -0
  87. package/config/config/css.ts +36 -1
  88. package/config/config/debug.ts +24 -1
  89. package/config/config/dev.ts +8 -0
  90. package/config/configure.ts +23 -2
  91. package/config/document.ts +23 -0
  92. package/css/globalSheet.ts +66 -0
  93. package/css/index.ts +5 -0
  94. package/css/sheet.ts +173 -0
  95. package/css/styleTarget.ts +251 -0
  96. package/dev/config.ts +2 -3
  97. package/dev/utils.ts +3 -3
  98. package/dialect/namedTokens.ts +30 -8
  99. package/dist/adapter/preact.js +2 -0
  100. package/dist/adapter/react.js +2 -0
  101. package/dist/adapter/solid.js +2 -0
  102. package/dist/className-CC5PHcXI.js +311 -0
  103. package/dist/className-CC5PHcXI.js.map +1 -0
  104. package/dist/{style-DUztHzBz.js → combine-CtR6MyD4.js} +402 -733
  105. package/dist/combine-CtR6MyD4.js.map +1 -0
  106. package/dist/compiler/index.mjs +2 -2
  107. package/dist/{compiler-BXcGyZUP.mjs → compiler-oXXProzz.mjs} +3092 -850
  108. package/dist/compiler-oXXProzz.mjs.map +1 -0
  109. package/dist/config/index.js +2 -2
  110. package/dist/config-BK7oK4Hx.js +57 -0
  111. package/dist/config-BK7oK4Hx.js.map +1 -0
  112. package/dist/config-BWFlaJ_v.js +6 -0
  113. package/dist/config-BWFlaJ_v.js.map +1 -0
  114. package/dist/config-BsF-QRgz.js +6 -0
  115. package/dist/{config-DcYrUB-M.js.map → config-BsF-QRgz.js.map} +1 -1
  116. package/dist/{config-C1k9vUrM.js → config-DKaGtG9O.js} +9 -7
  117. package/dist/config-DKaGtG9O.js.map +1 -0
  118. package/dist/config-IFmsTOQp.js +1 -0
  119. package/dist/css-B-7-Do-J.js +4541 -0
  120. package/dist/css-B-7-Do-J.js.map +1 -0
  121. package/dist/{css-CohHH2tn.js → css-BmIytNon.js} +185 -14
  122. package/dist/css-BmIytNon.js.map +1 -0
  123. package/dist/css-CYnQKnPu.js +563 -0
  124. package/dist/css-CYnQKnPu.js.map +1 -0
  125. package/dist/css.js +2 -2
  126. package/dist/{css_extra-DQdCrYoC.js → css_extra-Br7eDCrf.js} +2 -2
  127. package/dist/{css_extra-9BZ_jVET.js.map → css_extra-Br7eDCrf.js.map} +1 -1
  128. package/dist/{css_extra-9BZ_jVET.js → css_extra-qzi_eFFf.js} +2 -2
  129. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-qzi_eFFf.js.map} +1 -1
  130. package/dist/data-D6dD67li.js +786 -0
  131. package/dist/data-D6dD67li.js.map +1 -0
  132. package/dist/debug-Bo43rBKc.js +73 -0
  133. package/dist/debug-Bo43rBKc.js.map +1 -0
  134. package/dist/dev/rsc.js +138 -28
  135. package/dist/dev/rsc.js.map +1 -1
  136. package/dist/{dev-C2u78xuv.js → dev-_DW5n4U4.js} +9 -10
  137. package/dist/dev-_DW5n4U4.js.map +1 -0
  138. package/dist/dev.js +1 -1
  139. package/dist/dialect/extracted/index.js +1 -1
  140. package/dist/dialect/index.js +1 -1
  141. package/dist/{elementMarker-BKzZyg5V.js → elementMarker-u0d2LH8r.js} +582 -61
  142. package/dist/elementMarker-u0d2LH8r.js.map +1 -0
  143. package/dist/entry/dev/adapter/preact.js +12 -0
  144. package/dist/entry/dev/adapter/preact.js.map +1 -0
  145. package/dist/entry/dev/adapter/react.js +12 -0
  146. package/dist/entry/dev/adapter/react.js.map +1 -0
  147. package/dist/entry/dev/adapter/solid.js +12 -0
  148. package/dist/entry/dev/adapter/solid.js.map +1 -0
  149. package/dist/entry/dev/css.js +3 -3
  150. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  151. package/dist/entry/dev/jsx-runtime.js +2 -2
  152. package/dist/entry/dev.js +13 -12
  153. package/dist/entry/prod/adapter/preact.js +12 -0
  154. package/dist/entry/prod/adapter/preact.js.map +1 -0
  155. package/dist/entry/prod/adapter/react.js +12 -0
  156. package/dist/entry/prod/adapter/react.js.map +1 -0
  157. package/dist/entry/prod/adapter/solid.js +12 -0
  158. package/dist/entry/prod/adapter/solid.js.map +1 -0
  159. package/dist/entry/prod/css.js +3 -3
  160. package/dist/entry/prod/extract.js +251 -3
  161. package/dist/entry/prod/extract.js.map +1 -0
  162. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  163. package/dist/entry/prod/jsx-runtime.js +2 -2
  164. package/dist/entry/prod/runtime.js +3 -4
  165. package/dist/entry/prod.js +84 -1201
  166. package/dist/entry/prod.js.map +1 -1
  167. package/dist/entry/rsc-dev/adapter/preact.js +13 -0
  168. package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
  169. package/dist/entry/rsc-dev/adapter/react.js +13 -0
  170. package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
  171. package/dist/entry/rsc-dev/adapter/solid.js +13 -0
  172. package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
  173. package/dist/entry/rsc-dev/css.js +4 -3
  174. package/dist/entry/rsc-dev/dev.js +135 -32
  175. package/dist/entry/rsc-dev/dev.js.map +1 -1
  176. package/dist/entry/rsc-dev/jsx-dev-runtime.js +5 -4
  177. package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -1
  178. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  179. package/dist/entry/rsc-dev.js +298 -616
  180. package/dist/entry/rsc-dev.js.map +1 -1
  181. package/dist/entry/rsc-prod/adapter/preact.js +2 -0
  182. package/dist/entry/rsc-prod/adapter/react.js +2 -0
  183. package/dist/entry/rsc-prod/adapter/solid.js +2 -0
  184. package/dist/entry/rsc-prod/css.js +9 -3
  185. package/dist/entry/rsc-prod/css.js.map +1 -0
  186. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  187. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  188. package/dist/entry/rsc-prod/runtime.js +3 -4
  189. package/dist/entry/rsc-prod.js +251 -10
  190. package/dist/entry/rsc-prod.js.map +1 -0
  191. package/dist/{rules-Dz7Pu2K6.js → env-C8lKN1dB.js} +727 -147
  192. package/dist/env-C8lKN1dB.js.map +1 -0
  193. package/dist/{getClassName-C6690_nr.js → getClassName-BraU01Hd.js} +60 -15
  194. package/dist/getClassName-BraU01Hd.js.map +1 -0
  195. package/dist/getClassName-C35yO40s.js +548 -0
  196. package/dist/getClassName-C35yO40s.js.map +1 -0
  197. package/dist/getClassName-CfkGcBZy.js +49 -0
  198. package/dist/getClassName-CfkGcBZy.js.map +1 -0
  199. package/dist/{utils-D4YWF2K0.js → getClassName-i4oy2Up_.js} +27 -65
  200. package/dist/getClassName-i4oy2Up_.js.map +1 -0
  201. package/dist/{global-zaCE-g1C.js → global-DGcWZODV.js} +7 -8
  202. package/dist/global-DGcWZODV.js.map +1 -0
  203. package/dist/globalSheet-2ozCV1Zm.js +1091 -0
  204. package/dist/globalSheet-2ozCV1Zm.js.map +1 -0
  205. package/dist/hash-CGO13tOn.js +407 -0
  206. package/dist/hash-CGO13tOn.js.map +1 -0
  207. package/dist/index.js +10 -10
  208. package/dist/jsx/jsx-dev-runtime.js +2 -2
  209. package/dist/jsx/jsx-dev-runtime.server.js +3 -3
  210. package/dist/jsx/jsx-dev-runtime.server.js.map +1 -1
  211. package/dist/jsx/jsx-runtime.js +2 -2
  212. package/dist/jsx/jsx-runtime.server.js +4 -4
  213. package/dist/jsx/jsx-runtime.server.js.map +1 -1
  214. package/dist/jsx-C-v1b99-.js +39 -0
  215. package/dist/jsx-C-v1b99-.js.map +1 -0
  216. package/dist/{jsx_dev_runtime-DXlSD6kV.js → jsx_dev_runtime-Bd7FO7C1.js} +2 -3
  217. package/dist/{jsx_dev_runtime-DXlSD6kV.js.map → jsx_dev_runtime-Bd7FO7C1.js.map} +1 -1
  218. package/dist/jsx_runtime-BxumFGUy.js +13 -0
  219. package/dist/jsx_runtime-BxumFGUy.js.map +1 -0
  220. package/dist/{jsx_runtime-DPWo5qvV.js → jsx_runtime-gO4GQFcW.js} +3 -3
  221. package/dist/{jsx_runtime-CMdEXGNZ.js.map → jsx_runtime-gO4GQFcW.js.map} +1 -1
  222. package/dist/{loader-DCT1Q9yi.mjs → loader-A15L-NVK.mjs} +13 -14
  223. package/dist/loader-A15L-NVK.mjs.map +1 -0
  224. package/dist/{misc-o8pviMUi.mjs → misc-CRRQr1DT.mjs} +35 -8
  225. package/dist/misc-CRRQr1DT.mjs.map +1 -0
  226. package/dist/{namedTokens-BUa6raTb.js → namedTokens-paLD-Pdk.js} +15 -9
  227. package/dist/namedTokens-paLD-Pdk.js.map +1 -0
  228. package/dist/plugin/farm/index.mjs +5 -4
  229. package/dist/plugin/farm/index.mjs.map +1 -1
  230. package/dist/plugin/nextjs/index.mjs +153 -33
  231. package/dist/plugin/nextjs/index.mjs.map +1 -1
  232. package/dist/plugin/nextjs/loader.mjs +7 -5
  233. package/dist/plugin/nextjs/loader.mjs.map +1 -1
  234. package/dist/plugin/parcel/index.cjs +2 -0
  235. package/dist/plugin/parcel/index.mjs +3 -1
  236. package/dist/plugin/parcel/optimizer.cjs +3 -2
  237. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  238. package/dist/plugin/parcel/optimizer.mjs +3 -2
  239. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  240. package/dist/plugin/parcel/resolver.cjs +1 -1
  241. package/dist/plugin/parcel/resolver.mjs +2 -2
  242. package/dist/plugin/parcel/runtime.cjs +1 -1
  243. package/dist/plugin/parcel/runtime.mjs +1 -1
  244. package/dist/plugin/parcel/transformer.cjs +1 -1
  245. package/dist/plugin/parcel/transformer.mjs +2 -2
  246. package/dist/plugin/rspack/index.mjs +3 -2
  247. package/dist/plugin/rspack/index.mjs.map +1 -1
  248. package/dist/plugin/vite/index.mjs +26 -23
  249. package/dist/plugin/vite/index.mjs.map +1 -1
  250. package/dist/plugin/webpack/index.mjs +3 -2
  251. package/dist/plugin/webpack/loader.mjs +2 -2
  252. package/dist/presets/tailwind/index.js +32 -8
  253. package/dist/presets/tailwind/index.js.map +1 -1
  254. package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
  255. package/dist/presets-DSanixJV.js.map +1 -0
  256. package/dist/{registry-D3x1EDJm.mjs → registry-D2C6hTdx.mjs} +2 -2
  257. package/dist/{registry-D3x1EDJm.mjs.map → registry-D2C6hTdx.mjs.map} +1 -1
  258. package/dist/resolveClassNameRuntime-Cp8_UcxF.js +63 -0
  259. package/dist/resolveClassNameRuntime-Cp8_UcxF.js.map +1 -0
  260. package/dist/scope-Dg83Az-2.js +601 -0
  261. package/dist/scope-Dg83Az-2.js.map +1 -0
  262. package/dist/selector/index.js +1 -2
  263. package/dist/server.js +91 -17
  264. package/dist/server.js.map +1 -1
  265. package/dist/{shared-B_gJf5uj.cjs → shared-B7Nw_dcx.cjs} +3152 -891
  266. package/dist/shared-B7Nw_dcx.cjs.map +1 -0
  267. package/dist/{shared-uAzFeq0x.mjs → shared-BmJmaxu8.mjs} +5 -5
  268. package/dist/shared-BmJmaxu8.mjs.map +1 -0
  269. package/dist/sheet-CHnDkjn4.js +56 -0
  270. package/dist/sheet-CHnDkjn4.js.map +1 -0
  271. package/dist/sheet-PVxRQrOp.js +7 -0
  272. package/dist/sheet-PVxRQrOp.js.map +1 -0
  273. package/dist/sheet-ueNBw_2u.js +1 -0
  274. package/dist/{sidecar-BUO1hKXu.mjs → sidecar-DVegwGec.mjs} +3 -3
  275. package/dist/{sidecar-BUO1hKXu.mjs.map → sidecar-DVegwGec.mjs.map} +1 -1
  276. package/dist/{style-BkeAZl0n.js → style-B1tkE8zl.js} +329 -129
  277. package/dist/style-B1tkE8zl.js.map +1 -0
  278. package/dist/styleStore-BK2XBS8n.js +45 -0
  279. package/dist/styleStore-BK2XBS8n.js.map +1 -0
  280. package/dist/styleStore-D4umgIwQ.js +3457 -0
  281. package/dist/styleStore-D4umgIwQ.js.map +1 -0
  282. package/dist/token-BX5jRxMb.js +110 -0
  283. package/dist/token-BX5jRxMb.js.map +1 -0
  284. package/dist/token-CS0iRIIa.js +140 -0
  285. package/dist/token-CS0iRIIa.js.map +1 -0
  286. package/dist/{trace-D0IL6JT8.js → trace-DZYKSwdB.js} +2 -2
  287. package/dist/{trace-D0IL6JT8.js.map → trace-DZYKSwdB.js.map} +1 -1
  288. package/dist/{trace-DR7_Rpkg.js → trace-EEKXwKSr.js} +3 -3
  289. package/dist/{trace-DR7_Rpkg.js.map → trace-EEKXwKSr.js.map} +1 -1
  290. package/dist/{transform-BTJOg8Hg.js → transform-BZ4jPwy3.js} +2 -2
  291. package/dist/transform-BZ4jPwy3.js.map +1 -0
  292. package/dist/types/adapter/preact.d.ts +1 -0
  293. package/dist/types/adapter/react.d.ts +1 -0
  294. package/dist/types/adapter/solid.d.ts +1 -0
  295. package/dist/types/atomic/atRule/counterStyle.d.ts +10 -0
  296. package/dist/types/atomic/atRule/fontFace.d.ts +10 -0
  297. package/dist/types/atomic/atRule/fontPaletteValues.d.ts +10 -0
  298. package/dist/types/atomic/atRule/fontSrc.d.ts +1 -0
  299. package/dist/types/atomic/atRule/keyframes.d.ts +13 -0
  300. package/dist/types/atomic/atRule/positionTry.d.ts +13 -0
  301. package/dist/types/atomic/atRule/property.d.ts +13 -0
  302. package/dist/types/atomic/atRule/utils.d.ts +5 -0
  303. package/dist/types/atomic/className.d.ts +11 -0
  304. package/dist/types/atomic/debug/className/className.d.ts +9 -0
  305. package/dist/types/atomic/debug/className/index.d.ts +1 -0
  306. package/dist/types/atomic/debug/property/data.d.ts +3 -0
  307. package/dist/types/atomic/debug/property/index.d.ts +1 -0
  308. package/dist/types/atomic/debug/property/property.d.ts +5 -0
  309. package/dist/types/atomic/debug/selector.d.ts +2 -0
  310. package/dist/types/atomic/debug/value.d.ts +5 -0
  311. package/dist/types/atomic/element.d.ts +5 -0
  312. package/dist/types/atomic/layer/index.d.ts +3 -0
  313. package/dist/types/atomic/layer/layer.d.ts +12 -0
  314. package/dist/types/atomic/layer/types.d.ts +30 -0
  315. package/dist/types/atomic/layer/utils.d.ts +4 -0
  316. package/dist/types/atomic/property/index.d.ts +2 -0
  317. package/dist/types/atomic/property/presets.d.ts +4 -0
  318. package/dist/types/atomic/property/property.d.ts +3 -0
  319. package/dist/types/atomic/property/type_maps.d.ts +31 -0
  320. package/dist/types/atomic/property/types.d.ts +4 -0
  321. package/dist/types/atomic/rule.d.ts +5 -0
  322. package/dist/types/atomic/scope.d.ts +3 -0
  323. package/dist/types/atomic/theme.d.ts +7 -0
  324. package/dist/types/atomic/token.d.ts +7 -0
  325. package/dist/types/atomic/utils/cssIdent.d.ts +2 -0
  326. package/dist/types/atomic/utils/cssVar.d.ts +3 -0
  327. package/dist/types/atomic/utils/debug.d.ts +4 -0
  328. package/dist/types/atomic/utils/format.d.ts +5 -0
  329. package/dist/types/atomic/utils/hash.d.ts +1 -0
  330. package/dist/types/atomic/utils/selector.d.ts +7 -0
  331. package/dist/types/atomic/utils/types.d.ts +8 -0
  332. package/dist/types/atomic/value/index.d.ts +2 -0
  333. package/dist/types/atomic/value/unitless.d.ts +1 -0
  334. package/dist/types/atomic/value/value.d.ts +2 -0
  335. package/dist/types/atomic/var.d.ts +4 -0
  336. package/dist/types/builder/classname/class_name_builder.d.ts +4 -0
  337. package/dist/types/builder/classname/fns.d.ts +48 -0
  338. package/dist/types/builder/classname/index.d.ts +3 -0
  339. package/dist/types/builder/classname/types.d.ts +18 -0
  340. package/dist/types/builder/data/check_selector.d.ts +2 -0
  341. package/dist/types/builder/data/const.d.ts +27 -0
  342. package/dist/types/builder/data/create.d.ts +13 -0
  343. package/dist/types/builder/data/data.d.ts +44 -0
  344. package/dist/types/builder/data/debug.d.ts +38 -0
  345. package/dist/types/builder/data/index.d.ts +8 -0
  346. package/dist/types/builder/data/is.d.ts +16 -0
  347. package/dist/types/builder/data/merge/index.d.ts +2 -0
  348. package/dist/types/builder/data/merge/scope.d.ts +7 -0
  349. package/dist/types/builder/data/merge/style.d.ts +6 -0
  350. package/dist/types/builder/data/merge/utils.d.ts +10 -0
  351. package/dist/types/builder/data/selector.d.ts +8 -0
  352. package/dist/types/builder/data/state.d.ts +100 -0
  353. package/dist/types/builder/extract/index.d.ts +7 -0
  354. package/dist/types/builder/extract/scope.d.ts +14 -0
  355. package/dist/types/builder/extract/sheet.d.ts +10 -0
  356. package/dist/types/builder/extract/slot.d.ts +9 -0
  357. package/dist/types/builder/extract/style.d.ts +11 -0
  358. package/dist/types/builder/extract/theme.d.ts +2 -0
  359. package/dist/types/builder/extract/token.d.ts +12 -0
  360. package/dist/types/builder/extract/utils.d.ts +28 -0
  361. package/dist/types/builder/extract/withTokens.d.ts +10 -0
  362. package/dist/types/builder/index.d.ts +2 -0
  363. package/dist/types/builder/selector_override.d.ts +5 -0
  364. package/dist/types/builder/selector_override_core.d.ts +8 -0
  365. package/dist/types/builder/style_builder.d.ts +15 -0
  366. package/dist/types/builder/style_data.d.ts +8 -0
  367. package/dist/types/builder/style_fns.d.ts +14 -0
  368. package/dist/types/builder/token/data.d.ts +10 -0
  369. package/dist/types/builder/token/name.d.ts +3 -0
  370. package/dist/types/builder/token/symbols.d.ts +4 -0
  371. package/dist/types/builder/types/alias.d.ts +59 -0
  372. package/dist/types/builder/types/fns.d.ts +115 -0
  373. package/dist/types/builder/types/index.d.ts +1 -0
  374. package/dist/types/builder/types/types.d.ts +22 -0
  375. package/dist/types/builder/utils.d.ts +9 -0
  376. package/dist/types/compiler/compiler/cache.d.ts +24 -0
  377. package/dist/types/compiler/compiler/cache_identity.d.ts +4 -0
  378. package/dist/types/compiler/compiler/compiler.d.ts +40 -0
  379. package/dist/types/compiler/compiler/constants.d.ts +6 -0
  380. package/dist/types/compiler/compiler/index.d.ts +4 -0
  381. package/dist/types/compiler/compiler/persistent_cache.d.ts +14 -0
  382. package/dist/types/compiler/compiler/types.d.ts +64 -0
  383. package/dist/types/compiler/cssProp.d.ts +8 -0
  384. package/dist/types/compiler/extract/collector.d.ts +8 -0
  385. package/dist/types/compiler/extract/extract.d.ts +6 -0
  386. package/dist/types/compiler/extract/index.d.ts +3 -0
  387. package/dist/types/compiler/extract/types.d.ts +29 -0
  388. package/dist/types/compiler/index.d.ts +3 -0
  389. package/dist/types/compiler/transform/cssProp/index.d.ts +1 -0
  390. package/dist/types/compiler/transform/cssProp/plugin.d.ts +13 -0
  391. package/dist/types/compiler/transform/debug/index.d.ts +2 -0
  392. package/dist/types/compiler/transform/debug/plugin.d.ts +34 -0
  393. package/dist/types/compiler/transform/debug/transform.d.ts +7 -0
  394. package/dist/types/compiler/transform/debug/utils/debug_data.d.ts +11 -0
  395. package/dist/types/compiler/transform/debug/utils/source_url.d.ts +2 -0
  396. package/dist/types/compiler/transform/evaluator/evaluator.d.ts +58 -0
  397. package/dist/types/compiler/transform/evaluator/index.d.ts +3 -0
  398. package/dist/types/compiler/transform/evaluator/lazy_bindings.d.ts +22 -0
  399. package/dist/types/compiler/transform/evaluator/metadata_cache.d.ts +13 -0
  400. package/dist/types/compiler/transform/evaluator/tracer.d.ts +15 -0
  401. package/dist/types/compiler/transform/evaluator/types.d.ts +21 -0
  402. package/dist/types/compiler/transform/extract/chain/chain.d.ts +18 -0
  403. package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +21 -0
  404. package/dist/types/compiler/transform/extract/chain/index.d.ts +3 -0
  405. package/dist/types/compiler/transform/extract/chain/types.d.ts +32 -0
  406. package/dist/types/compiler/transform/extract/index.d.ts +2 -0
  407. package/dist/types/compiler/transform/extract/plugin.d.ts +20 -0
  408. package/dist/types/compiler/transform/extract/transform.d.ts +10 -0
  409. package/dist/types/compiler/transform/extract/utils/imports.d.ts +3 -0
  410. package/dist/types/compiler/transform/extract/utils/replacement.d.ts +11 -0
  411. package/dist/types/compiler/transform/extract/utils/slot.d.ts +4 -0
  412. package/dist/types/compiler/transform/extract/utils/state.d.ts +36 -0
  413. package/dist/types/compiler/transform/extract/utils/theme.d.ts +9 -0
  414. package/dist/types/compiler/transform/extract/utils/token.d.ts +4 -0
  415. package/dist/types/compiler/transform/index.d.ts +5 -0
  416. package/dist/types/compiler/transform/syntax/index.d.ts +5 -0
  417. package/dist/types/compiler/transform/syntax/isStaticStyleValue.d.ts +2 -0
  418. package/dist/types/compiler/transform/syntax/isStyleChainCall.d.ts +2 -0
  419. package/dist/types/compiler/transform/syntax/static_ids.d.ts +16 -0
  420. package/dist/types/compiler/transform/syntax/types.d.ts +4 -0
  421. package/dist/types/compiler/transform/syntax/utils.d.ts +5 -0
  422. package/dist/types/compiler/transform/utils/babel.d.ts +21 -0
  423. package/dist/types/compiler/transform/utils/import.d.ts +2 -0
  424. package/dist/types/compiler/transform/utils/path.d.ts +1 -0
  425. package/dist/types/compiler/transform/utils/selector.d.ts +18 -0
  426. package/dist/types/compiler/utils/check_diagnostics.d.ts +7 -0
  427. package/dist/types/compiler/utils/constants.d.ts +70 -0
  428. package/dist/types/compiler/utils/file_resolver.d.ts +16 -0
  429. package/dist/types/compiler/utils/import_source.d.ts +34 -0
  430. package/dist/types/compiler/utils/imports.d.ts +6 -0
  431. package/dist/types/compiler/utils/path.d.ts +4 -0
  432. package/dist/types/compiler/utils/sourcemap.d.ts +36 -0
  433. package/dist/types/config/build.d.ts +20 -0
  434. package/dist/types/config/config/check.d.ts +11 -0
  435. package/dist/types/config/config/css.d.ts +29 -0
  436. package/dist/types/config/config/css_extra.d.ts +13 -0
  437. package/dist/types/config/config/debug.d.ts +14 -0
  438. package/dist/types/config/config/dev.d.ts +36 -0
  439. package/dist/types/config/config/runtime.d.ts +10 -0
  440. package/dist/types/config/configure.d.ts +14 -0
  441. package/dist/types/config/constants.d.ts +1 -0
  442. package/dist/types/config/document.d.ts +3 -0
  443. package/dist/types/config/index.d.ts +2 -0
  444. package/dist/types/config/types.d.ts +47 -0
  445. package/dist/types/config/utils.d.ts +2 -0
  446. package/dist/types/css/counterStyle.d.ts +4 -0
  447. package/dist/types/css/fontFace.d.ts +5 -0
  448. package/dist/types/css/fontPaletteValues.d.ts +4 -0
  449. package/dist/types/css/globalSheet.d.ts +24 -0
  450. package/dist/types/css/index.d.ts +12 -0
  451. package/dist/types/css/keyframes.d.ts +4 -0
  452. package/dist/types/css/positionTry.d.ts +4 -0
  453. package/dist/types/css/property.d.ts +7 -0
  454. package/dist/types/css/sheet.d.ts +8 -0
  455. package/dist/types/css/styleTarget.d.ts +9 -0
  456. package/dist/types/css/utils.d.ts +19 -0
  457. package/dist/types/dev/config.d.ts +6 -0
  458. package/dist/types/dev/fns.d.ts +14 -0
  459. package/dist/types/dev/index.d.ts +2 -0
  460. package/dist/types/dev/trace.d.ts +8 -0
  461. package/dist/types/dev/utils.d.ts +5 -0
  462. package/dist/types/dialect/extracted/index.d.ts +1 -0
  463. package/dist/types/dialect/index.d.ts +1 -0
  464. package/dist/types/dialect/namedTokens.d.ts +9 -0
  465. package/dist/types/entry/dev/adapter/preact.d.ts +1 -0
  466. package/dist/types/entry/dev/adapter/react.d.ts +1 -0
  467. package/dist/types/entry/dev/adapter/solid.d.ts +1 -0
  468. package/dist/types/entry/dev/config.d.ts +2 -0
  469. package/dist/types/entry/dev/css.d.ts +2 -0
  470. package/dist/types/entry/dev/index.d.ts +3 -0
  471. package/dist/types/entry/dev/jsx_dev_runtime.d.ts +3 -0
  472. package/dist/types/entry/dev/sheet.d.ts +1 -0
  473. package/dist/types/entry/prod/adapter/preact.d.ts +1 -0
  474. package/dist/types/entry/prod/adapter/react.d.ts +1 -0
  475. package/dist/types/entry/prod/adapter/solid.d.ts +1 -0
  476. package/dist/types/entry/prod/config.d.ts +2 -0
  477. package/dist/types/entry/prod/config_debug.d.ts +2 -0
  478. package/dist/types/entry/prod/css.d.ts +2 -0
  479. package/dist/types/entry/prod/extract.d.ts +1 -0
  480. package/dist/types/entry/prod/index.d.ts +2 -0
  481. package/dist/types/entry/prod/jsx_runtime.d.ts +2 -0
  482. package/dist/types/entry/prod/runtime.d.ts +8 -0
  483. package/dist/types/entry/rsc_dev/adapter/preact.d.ts +1 -0
  484. package/dist/types/entry/rsc_dev/adapter/react.d.ts +1 -0
  485. package/dist/types/entry/rsc_dev/adapter/solid.d.ts +1 -0
  486. package/dist/types/entry/rsc_dev/config.d.ts +2 -0
  487. package/dist/types/entry/rsc_dev/css.d.ts +3 -0
  488. package/dist/types/entry/rsc_dev/index.d.ts +2 -0
  489. package/dist/types/entry/rsc_dev/server.d.ts +10 -0
  490. package/dist/types/entry/rsc_prod/adapter/preact.d.ts +1 -0
  491. package/dist/types/entry/rsc_prod/adapter/react.d.ts +1 -0
  492. package/dist/types/entry/rsc_prod/adapter/solid.d.ts +1 -0
  493. package/dist/types/entry/rsc_prod/config.d.ts +2 -0
  494. package/dist/types/entry/rsc_prod/config_debug.d.ts +2 -0
  495. package/dist/types/entry/rsc_prod/css.d.ts +2 -0
  496. package/dist/types/entry/rsc_prod/index.d.ts +2 -0
  497. package/dist/types/entry/rsc_prod/jsx_runtime.d.ts +2 -0
  498. package/dist/types/entry/rsc_prod/runtime.d.ts +4 -0
  499. package/dist/types/entry/rsc_prod/server.d.ts +6 -0
  500. package/dist/types/entry/shared/config.d.ts +1 -0
  501. package/dist/types/entry/shared/config_debug.d.ts +1 -0
  502. package/dist/types/entry/shared/config_dev.d.ts +1 -0
  503. package/dist/types/entry/shared/dev.d.ts +1 -0
  504. package/dist/types/entry/shared/prod.d.ts +1 -0
  505. package/dist/types/entry/shared/utils.d.ts +2 -0
  506. package/dist/types/index.d.ts +9 -0
  507. package/dist/types/jsx/extracted/jsx_runtime.d.ts +7 -0
  508. package/dist/types/jsx/rsc/jsx_runtime.d.ts +7 -0
  509. package/dist/types/jsx/rsc_extracted/jsx_runtime.d.ts +2 -0
  510. package/dist/types/jsx/runtime/jsx_dev_runtime.d.ts +6 -0
  511. package/dist/types/jsx/runtime/jsx_runtime.d.ts +7 -0
  512. package/dist/types/jsx/types/index.d.ts +1 -0
  513. package/dist/types/jsx/types/preact.d.ts +12 -0
  514. package/dist/types/jsx/types/react.d.ts +10 -0
  515. package/dist/types/jsx/types/solid.d.ts +12 -0
  516. package/dist/types/jsx/utils.d.ts +19 -0
  517. package/dist/types/plugin/bundler/farm/index.d.ts +1 -0
  518. package/dist/types/plugin/bundler/farm/plugin.d.ts +97 -0
  519. package/dist/types/plugin/bundler/parcel/index.d.ts +1 -0
  520. package/dist/types/plugin/bundler/parcel/optimizer.d.ts +3 -0
  521. package/dist/types/plugin/bundler/parcel/plugin.d.ts +6 -0
  522. package/dist/types/plugin/bundler/parcel/resolver.d.ts +3 -0
  523. package/dist/types/plugin/bundler/parcel/runtime.d.ts +3 -0
  524. package/dist/types/plugin/bundler/parcel/shared.d.ts +37 -0
  525. package/dist/types/plugin/bundler/parcel/transformer.d.ts +3 -0
  526. package/dist/types/plugin/bundler/rspack/index.d.ts +1 -0
  527. package/dist/types/plugin/bundler/rspack/plugin.d.ts +7 -0
  528. package/dist/types/plugin/bundler/vite/index.d.ts +1 -0
  529. package/dist/types/plugin/bundler/vite/plugin.d.ts +6 -0
  530. package/dist/types/plugin/bundler/vite/state.d.ts +79 -0
  531. package/dist/types/plugin/bundler/webpack/index.d.ts +1 -0
  532. package/dist/types/plugin/bundler/webpack/loader.d.ts +2 -0
  533. package/dist/types/plugin/bundler/webpack/plugin.d.ts +11 -0
  534. package/dist/types/plugin/bundler/webpack/shared/loader.d.ts +31 -0
  535. package/dist/types/plugin/bundler/webpack/shared/registry.d.ts +4 -0
  536. package/dist/types/plugin/bundler/webpack/utils.d.ts +18 -0
  537. package/dist/types/plugin/nextjs/constants.d.ts +3 -0
  538. package/dist/types/plugin/nextjs/html.d.ts +1 -0
  539. package/dist/types/plugin/nextjs/index.d.ts +2 -0
  540. package/dist/types/plugin/nextjs/loader.d.ts +3 -0
  541. package/dist/types/plugin/nextjs/plugin.d.ts +5 -0
  542. package/dist/types/plugin/nextjs/types.d.ts +21 -0
  543. package/dist/types/plugin/nextjs/utils.d.ts +59 -0
  544. package/dist/types/plugin/utils/cache/css_cache.d.ts +34 -0
  545. package/dist/types/plugin/utils/cache/file.d.ts +4 -0
  546. package/dist/types/plugin/utils/cache/index.d.ts +2 -0
  547. package/dist/types/plugin/utils/compiler.d.ts +51 -0
  548. package/dist/types/plugin/utils/constants.d.ts +4 -0
  549. package/dist/types/plugin/utils/cssMarker.d.ts +4 -0
  550. package/dist/types/plugin/utils/cssOutput.d.ts +10 -0
  551. package/dist/types/plugin/utils/filter.d.ts +25 -0
  552. package/dist/types/plugin/utils/imports.d.ts +3 -0
  553. package/dist/types/plugin/utils/index.d.ts +10 -0
  554. package/dist/types/plugin/utils/injection.d.ts +3 -0
  555. package/dist/types/plugin/utils/misc.d.ts +1 -0
  556. package/dist/types/plugin/utils/runtimeEntry.d.ts +8 -0
  557. package/dist/types/plugin/utils/sidecar/index.d.ts +1 -0
  558. package/dist/types/plugin/utils/sidecar/server.d.ts +19 -0
  559. package/dist/types/plugin/utils/sidecar/sidecar.d.ts +17 -0
  560. package/dist/types/plugin/utils/sidecar/utils.d.ts +33 -0
  561. package/dist/types/plugin/utils/sourcemap.d.ts +9 -0
  562. package/dist/types/plugin/utils/virtual.d.ts +12 -0
  563. package/dist/types/presets/tailwind/classname/index.d.ts +2 -0
  564. package/dist/types/presets/tailwind/classname/transform.d.ts +8 -0
  565. package/dist/types/presets/tailwind/classname/types.d.ts +27 -0
  566. package/dist/types/presets/tailwind/index.d.ts +5 -0
  567. package/dist/types/presets/tailwind/selectors.d.ts +68 -0
  568. package/dist/types/presets/tailwind/style/index.d.ts +2 -0
  569. package/dist/types/presets/tailwind/style/transform.d.ts +8 -0
  570. package/dist/types/presets/tailwind/style/types.d.ts +149 -0
  571. package/dist/types/presets/tailwind/theme.d.ts +477 -0
  572. package/dist/types/presets/tailwind/types.d.ts +53 -0
  573. package/dist/types/runtime/adapter/utils.d.ts +12 -0
  574. package/dist/types/runtime/core/cache/combine.d.ts +6 -0
  575. package/dist/types/runtime/core/cache/combineRuntime.d.ts +1 -0
  576. package/dist/types/runtime/core/cache/item.d.ts +15 -0
  577. package/dist/types/runtime/core/cache/itemWithResolver.d.ts +4 -0
  578. package/dist/types/runtime/core/cache/pool.d.ts +16 -0
  579. package/dist/types/runtime/core/cache/prop.d.ts +19 -0
  580. package/dist/types/runtime/core/cache/propCache.d.ts +12 -0
  581. package/dist/types/runtime/core/cache/resolvedItem.d.ts +5 -0
  582. package/dist/types/runtime/core/cache/result.d.ts +9 -0
  583. package/dist/types/runtime/core/cache/stateItem.d.ts +14 -0
  584. package/dist/types/runtime/core/cache/token.d.ts +2 -0
  585. package/dist/types/runtime/core/cache/tokenValues.d.ts +26 -0
  586. package/dist/types/runtime/core/cache/utils/tree.d.ts +12 -0
  587. package/dist/types/runtime/core/cache/utils/walk.d.ts +1 -0
  588. package/dist/types/runtime/core/className.d.ts +18 -0
  589. package/dist/types/runtime/core/combinedStyle.d.ts +20 -0
  590. package/dist/types/runtime/core/createTransformElement.d.ts +4 -0
  591. package/dist/types/runtime/core/elementMarker.d.ts +12 -0
  592. package/dist/types/runtime/core/elementMarkerData.d.ts +7 -0
  593. package/dist/types/runtime/core/getClassName.d.ts +4 -0
  594. package/dist/types/runtime/core/getSheetRules.d.ts +3 -0
  595. package/dist/types/runtime/core/getToken.d.ts +3 -0
  596. package/dist/types/runtime/core/index.d.ts +5 -0
  597. package/dist/types/runtime/core/jsx.d.ts +1 -0
  598. package/dist/types/runtime/core/resolveClassNameRuntime.d.ts +8 -0
  599. package/dist/types/runtime/env.d.ts +2 -0
  600. package/dist/types/runtime/extract/combineStyle.d.ts +27 -0
  601. package/dist/types/runtime/extract/getClassName.d.ts +10 -0
  602. package/dist/types/runtime/extract/index.d.ts +6 -0
  603. package/dist/types/runtime/extract/jsx.d.ts +10 -0
  604. package/dist/types/runtime/extract/token.d.ts +5 -0
  605. package/dist/types/runtime/extract/tokenResolver.d.ts +2 -0
  606. package/dist/types/runtime/rsc/constants.d.ts +6 -0
  607. package/dist/types/runtime/rsc/dev.d.ts +11 -0
  608. package/dist/types/runtime/rsc/getClassName.d.ts +27 -0
  609. package/dist/types/runtime/rsc/globalSheet.d.ts +22 -0
  610. package/dist/types/runtime/rsc/index.d.ts +1 -0
  611. package/dist/types/runtime/rsc/jsx.d.ts +1 -0
  612. package/dist/types/runtime/rsc/observer.d.ts +10 -0
  613. package/dist/types/runtime/rsc/styleStore.d.ts +7 -0
  614. package/dist/types/runtime/sheet/document.d.ts +3 -0
  615. package/dist/types/runtime/sheet/element.d.ts +2 -0
  616. package/dist/types/runtime/sheet/global.d.ts +3 -0
  617. package/dist/types/runtime/sheet/index.d.ts +3 -0
  618. package/dist/types/runtime/sheet/insert.d.ts +5 -0
  619. package/dist/types/runtime/sheet/rule.d.ts +8 -0
  620. package/dist/types/runtime/sheet/rules.d.ts +10 -0
  621. package/dist/types/runtime/sheet/theme.d.ts +5 -0
  622. package/dist/types/runtime/style/index.d.ts +3 -0
  623. package/dist/types/runtime/style/scope.d.ts +4 -0
  624. package/dist/types/runtime/style/style.d.ts +27 -0
  625. package/dist/types/runtime/style/token.d.ts +1 -0
  626. package/dist/types/runtime/types.d.ts +31 -0
  627. package/dist/types/selector/assert.d.ts +13 -0
  628. package/dist/types/selector/index.d.ts +5 -0
  629. package/dist/types/selector/presets/default.d.ts +108 -0
  630. package/dist/types/selector/presets/index.d.ts +3 -0
  631. package/dist/types/selector/presets/minimal.d.ts +46 -0
  632. package/dist/types/selector/presets/selectors.d.ts +62 -0
  633. package/dist/types/selector/selector.d.ts +25 -0
  634. package/dist/types/selector/types.d.ts +12 -0
  635. package/dist/types/selector/validate.d.ts +5 -0
  636. package/dist/types/sheet/dev/dev_layer.d.ts +4 -0
  637. package/dist/types/sheet/dev/dev_sort.d.ts +2 -0
  638. package/dist/types/sheet/dev/index.d.ts +5 -0
  639. package/dist/types/sheet/dev/utils.d.ts +26 -0
  640. package/dist/types/sheet/index.d.ts +4 -0
  641. package/dist/types/sheet/ordered.d.ts +4 -0
  642. package/dist/types/sheet/ordering.d.ts +15 -0
  643. package/dist/types/sheet/prod.d.ts +2 -0
  644. package/dist/types/sheet/sheet.d.ts +2 -0
  645. package/dist/types/sheet/sourcemap.d.ts +11 -0
  646. package/dist/types/sheet/types.d.ts +37 -0
  647. package/dist/types/sheet/utils/dom.d.ts +5 -0
  648. package/dist/types/sheet/utils/index.d.ts +4 -0
  649. package/dist/types/sheet/utils/layer.d.ts +10 -0
  650. package/dist/types/sheet/utils/noop.d.ts +2 -0
  651. package/dist/types/sheet/utils/rule.d.ts +3 -0
  652. package/dist/types/sheet/utils/sourcemap.d.ts +12 -0
  653. package/dist/types/style/classname.d.ts +15 -0
  654. package/dist/types/style/important.d.ts +9 -0
  655. package/dist/types/style/index.d.ts +12 -0
  656. package/dist/types/style/keyframes.d.ts +10 -0
  657. package/dist/types/style/style.d.ts +426 -0
  658. package/dist/types/style/theme.d.ts +5 -0
  659. package/dist/types/style/token.d.ts +29 -0
  660. package/dist/types/style/tokens.d.ts +10 -0
  661. package/dist/types/style/transform.d.ts +22 -0
  662. package/dist/types/style/types.d.ts +22 -0
  663. package/dist/types/style/utils/expose.d.ts +8 -0
  664. package/dist/types/style/utils/index.d.ts +1 -0
  665. package/dist/types/style/value.d.ts +12 -0
  666. package/dist/types/style/valueRef.d.ts +13 -0
  667. package/dist/types/style/weight.d.ts +9 -0
  668. package/dist/types/utils/global.d.ts +4 -0
  669. package/dist/types/utils/hash.d.ts +3 -0
  670. package/dist/types/utils/id.d.ts +12 -0
  671. package/dist/types/utils/object.d.ts +10 -0
  672. package/dist/types/utils/symbol.d.ts +1 -0
  673. package/dist/types/utils/trace.d.ts +21 -0
  674. package/dist/types/utils/type.d.ts +11 -0
  675. package/dist/utils-0UTYm294.js +42 -0
  676. package/dist/utils-0UTYm294.js.map +1 -0
  677. package/dist/utils-CO1ZXzKK.mjs +182 -0
  678. package/dist/utils-CO1ZXzKK.mjs.map +1 -0
  679. package/dist/{utils-DQGa0uzS.mjs → utils-CxYxZSSk.mjs} +3 -3
  680. package/dist/{utils-DQGa0uzS.mjs.map → utils-CxYxZSSk.mjs.map} +1 -1
  681. package/dist/utils-D1duUYV9.js +72 -0
  682. package/dist/utils-D1duUYV9.js.map +1 -0
  683. package/dist/utils-DxCpyV2E.js +62 -0
  684. package/dist/utils-DxCpyV2E.js.map +1 -0
  685. package/dist/{utils-BsbfH6cd.js → utils-ymEmGz-T.js} +1274 -608
  686. package/dist/utils-ymEmGz-T.js.map +1 -0
  687. package/dist/utils.js +4 -4
  688. package/dist/utils.js.map +1 -1
  689. package/dist/{webpack-Fb9xF5jS.mjs → webpack-DF165M2x.mjs} +7 -7
  690. package/dist/webpack-DF165M2x.mjs.map +1 -0
  691. package/entry/dev/adapter/preact.ts +8 -0
  692. package/entry/dev/adapter/react.ts +8 -0
  693. package/entry/dev/adapter/solid.ts +8 -0
  694. package/entry/dev/sheet.ts +4 -2
  695. package/entry/prod/adapter/preact.ts +8 -0
  696. package/entry/prod/adapter/react.ts +8 -0
  697. package/entry/prod/adapter/solid.ts +8 -0
  698. package/entry/prod/config_debug.ts +2 -0
  699. package/entry/prod/index.ts +1 -1
  700. package/entry/prod/runtime.ts +3 -1
  701. package/entry/rsc_dev/adapter/preact.ts +9 -0
  702. package/entry/rsc_dev/adapter/react.ts +9 -0
  703. package/entry/rsc_dev/adapter/solid.ts +9 -0
  704. package/entry/rsc_dev/css.ts +2 -0
  705. package/entry/rsc_prod/adapter/preact.ts +1 -0
  706. package/entry/rsc_prod/adapter/react.ts +1 -0
  707. package/entry/rsc_prod/adapter/solid.ts +1 -0
  708. package/entry/rsc_prod/config_debug.ts +6 -0
  709. package/entry/rsc_prod/index.ts +1 -1
  710. package/entry/shared/config_debug.ts +9 -0
  711. package/entry/shared/config_dev.ts +9 -7
  712. package/index.ts +1 -0
  713. package/jsx/rsc/jsx_dev_runtime.ts +11 -2
  714. package/jsx/rsc/jsx_runtime.ts +14 -3
  715. package/jsx/types/index.ts +1 -0
  716. package/jsx/types/preact.ts +14 -0
  717. package/jsx/{types.ts → types/react.ts} +2 -2
  718. package/jsx/types/solid.ts +15 -0
  719. package/package.json +179 -74
  720. package/plugin/bundler/farm/plugin.ts +3 -1
  721. package/plugin/bundler/parcel/optimizer.ts +1 -0
  722. package/plugin/bundler/parcel/plugin.ts +2 -0
  723. package/plugin/bundler/parcel/shared.ts +1 -1
  724. package/plugin/bundler/rspack/plugin.ts +1 -0
  725. package/plugin/bundler/vite/plugin.ts +23 -25
  726. package/plugin/bundler/vite/state.ts +7 -8
  727. package/plugin/bundler/webpack/plugin.ts +4 -3
  728. package/plugin/bundler/webpack/shared/loader.ts +13 -7
  729. package/plugin/nextjs/loader.ts +18 -2
  730. package/plugin/nextjs/plugin.ts +248 -35
  731. package/plugin/nextjs/types.ts +1 -2
  732. package/plugin/nextjs/utils.ts +122 -1
  733. package/plugin/utils/compiler.ts +3 -2
  734. package/plugin/utils/filter.ts +65 -1
  735. package/plugin/utils/runtimeEntry.ts +3 -2
  736. package/presets/tailwind/classname/transform.ts +32 -1
  737. package/presets/tailwind/style/transform.ts +9 -3
  738. package/runtime/adapter/utils.ts +120 -0
  739. package/runtime/core/cache/combine.ts +76 -28
  740. package/runtime/core/cache/combineRuntime.ts +4 -0
  741. package/runtime/core/cache/index.ts +2 -1
  742. package/runtime/core/cache/item.ts +32 -13
  743. package/runtime/core/cache/itemWithResolver.ts +44 -0
  744. package/runtime/core/cache/pool.ts +15 -30
  745. package/runtime/core/cache/prop.ts +10 -8
  746. package/runtime/core/cache/result.ts +2 -2
  747. package/runtime/core/cache/stateItem.ts +19 -1
  748. package/runtime/core/cache/token.ts +20 -0
  749. package/runtime/core/cache/tokenValues.ts +19 -11
  750. package/runtime/core/combinedStyle.ts +4 -4
  751. package/runtime/core/elementMarker.ts +9 -3
  752. package/runtime/extract/combineStyle.ts +211 -0
  753. package/runtime/extract/getClassName.ts +61 -16
  754. package/runtime/extract/index.ts +3 -1
  755. package/runtime/extract/token.ts +41 -0
  756. package/runtime/extract/tokenResolver.ts +17 -0
  757. package/runtime/rsc/constants.ts +3 -0
  758. package/runtime/rsc/dev.ts +31 -15
  759. package/runtime/rsc/getClassName.ts +10 -0
  760. package/runtime/rsc/globalSheet.ts +130 -0
  761. package/runtime/rsc/observer.ts +125 -15
  762. package/runtime/rsc/styleStore.ts +10 -19
  763. package/runtime/sheet/document.ts +28 -0
  764. package/runtime/sheet/global-prod.ts +3 -5
  765. package/runtime/sheet/global.ts +3 -5
  766. package/runtime/sheet/rule.ts +18 -12
  767. package/runtime/sheet/rules.ts +11 -3
  768. package/runtime/style/scope.ts +0 -24
  769. package/runtime/style/style.ts +181 -6
  770. package/runtime/types.ts +3 -3
  771. package/sheet/dev/dev_layer.ts +76 -17
  772. package/sheet/dev/dev_sort.ts +70 -18
  773. package/sheet/dev/index.ts +23 -3
  774. package/sheet/ordered.ts +225 -0
  775. package/sheet/ordering.ts +156 -0
  776. package/sheet/prod.ts +39 -12
  777. package/sheet/types.ts +7 -0
  778. package/sheet/utils/layer.ts +34 -0
  779. package/style/classname.ts +12 -6
  780. package/style/important.ts +21 -0
  781. package/style/index.ts +2 -0
  782. package/style/style.ts +17 -5
  783. package/style/theme.ts +0 -1
  784. package/style/token.ts +28 -21
  785. package/style/tokens.ts +20 -13
  786. package/style/transform.ts +5 -4
  787. package/style/types.ts +6 -4
  788. package/style/utils/expose.ts +4 -3
  789. package/style/value.ts +26 -11
  790. package/style/valueRef.ts +1 -1
  791. package/style/weight.ts +21 -0
  792. package/utils/global.ts +1 -3
  793. package/utils/symbol.ts +3 -0
  794. package/utils/trace.ts +1 -0
  795. package/dist/assert-BGdigdr5.js.map +0 -1
  796. package/dist/className-Cuh2JNxO.js +0 -263
  797. package/dist/className-Cuh2JNxO.js.map +0 -1
  798. package/dist/className-W2kDyeVl.js +0 -144
  799. package/dist/className-W2kDyeVl.js.map +0 -1
  800. package/dist/compiler-BXcGyZUP.mjs.map +0 -1
  801. package/dist/config-C1k9vUrM.js.map +0 -1
  802. package/dist/config-CLYMN3_p.js +0 -26
  803. package/dist/config-CLYMN3_p.js.map +0 -1
  804. package/dist/config-DcYrUB-M.js +0 -6
  805. package/dist/config-oI_yS50f.js +0 -1
  806. package/dist/css-CELBp6Gu.js +0 -58
  807. package/dist/css-CELBp6Gu.js.map +0 -1
  808. package/dist/css-CohHH2tn.js.map +0 -1
  809. package/dist/css-D_DL1yOz.js +0 -237
  810. package/dist/css-D_DL1yOz.js.map +0 -1
  811. package/dist/css-DfH4Gb1c.js +0 -805
  812. package/dist/css-DfH4Gb1c.js.map +0 -1
  813. package/dist/data-Ze8GNiJm.js +0 -483
  814. package/dist/data-Ze8GNiJm.js.map +0 -1
  815. package/dist/debug-BefbXMq1.js +0 -15
  816. package/dist/debug-BefbXMq1.js.map +0 -1
  817. package/dist/debug-DLmUG3Vh.js +0 -172
  818. package/dist/debug-DLmUG3Vh.js.map +0 -1
  819. package/dist/debug-OG2wSB5R.js +0 -15
  820. package/dist/debug-OG2wSB5R.js.map +0 -1
  821. package/dist/dev-4TqJORRn.js +0 -75
  822. package/dist/dev-4TqJORRn.js.map +0 -1
  823. package/dist/dev-C2u78xuv.js.map +0 -1
  824. package/dist/elementMarker-BKzZyg5V.js.map +0 -1
  825. package/dist/extract-B9j4TBkU.js +0 -2
  826. package/dist/extract-CzWJeQi8.js +0 -121
  827. package/dist/extract-CzWJeQi8.js.map +0 -1
  828. package/dist/getClassName-C6690_nr.js.map +0 -1
  829. package/dist/global-C7GsCW6Y.js +0 -14
  830. package/dist/global-C7GsCW6Y.js.map +0 -1
  831. package/dist/global-zaCE-g1C.js.map +0 -1
  832. package/dist/hash-Bycpk3MR.js +0 -160
  833. package/dist/hash-Bycpk3MR.js.map +0 -1
  834. package/dist/jsx-Berx-L-r.js +0 -39
  835. package/dist/jsx-Berx-L-r.js.map +0 -1
  836. package/dist/jsx-DsMajv_M.js +0 -38
  837. package/dist/jsx-DsMajv_M.js.map +0 -1
  838. package/dist/jsx_runtime-CMdEXGNZ.js +0 -13
  839. package/dist/jsx_runtime-DPWo5qvV.js.map +0 -1
  840. package/dist/layer-DiNeeTgG.js +0 -94
  841. package/dist/layer-DiNeeTgG.js.map +0 -1
  842. package/dist/loader-DCT1Q9yi.mjs.map +0 -1
  843. package/dist/misc-o8pviMUi.mjs.map +0 -1
  844. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  845. package/dist/presets-BhXa232U.js +0 -108
  846. package/dist/presets-BhXa232U.js.map +0 -1
  847. package/dist/property-BzZSTVIh.js +0 -406
  848. package/dist/property-BzZSTVIh.js.map +0 -1
  849. package/dist/rules-Dz7Pu2K6.js.map +0 -1
  850. package/dist/runtime-B3jHW9B1.js +0 -32
  851. package/dist/runtime-B3jHW9B1.js.map +0 -1
  852. package/dist/shared-B_gJf5uj.cjs.map +0 -1
  853. package/dist/shared-uAzFeq0x.mjs.map +0 -1
  854. package/dist/sheet-DasbRnvy.js +0 -7
  855. package/dist/sheet-DasbRnvy.js.map +0 -1
  856. package/dist/style-B0F1sgRZ.js +0 -5
  857. package/dist/style-BkeAZl0n.js.map +0 -1
  858. package/dist/style-CYXTs1iu.js +0 -771
  859. package/dist/style-CYXTs1iu.js.map +0 -1
  860. package/dist/style-DUztHzBz.js.map +0 -1
  861. package/dist/styleStore-BGJ2ZYtK.js +0 -2009
  862. package/dist/styleStore-BGJ2ZYtK.js.map +0 -1
  863. package/dist/styleStore-DVDp-gI-.js +0 -55
  864. package/dist/styleStore-DVDp-gI-.js.map +0 -1
  865. package/dist/token-CA1j7suG.js +0 -273
  866. package/dist/token-CA1j7suG.js.map +0 -1
  867. package/dist/token-CKXUECuU.js +0 -76
  868. package/dist/token-CKXUECuU.js.map +0 -1
  869. package/dist/token-DTOyFLmp.js +0 -58
  870. package/dist/token-DTOyFLmp.js.map +0 -1
  871. package/dist/transform-BTJOg8Hg.js.map +0 -1
  872. package/dist/utils-BsbfH6cd.js.map +0 -1
  873. package/dist/utils-CpA-dSpY.mjs +0 -97
  874. package/dist/utils-CpA-dSpY.mjs.map +0 -1
  875. package/dist/utils-D4YWF2K0.js.map +0 -1
  876. package/dist/utils-R6QadAsY.js +0 -170
  877. package/dist/utils-R6QadAsY.js.map +0 -1
  878. package/dist/value-CJG6EWe8.js +0 -85
  879. package/dist/value-CJG6EWe8.js.map +0 -1
  880. package/dist/value-D-ZcRzLA.js +0 -42
  881. package/dist/value-D-ZcRzLA.js.map +0 -1
  882. package/dist/value-DBtSe-9B.js +0 -1000
  883. package/dist/value-DBtSe-9B.js.map +0 -1
  884. package/dist/valueRef-CsLVJwjA.js +0 -16
  885. package/dist/valueRef-CsLVJwjA.js.map +0 -1
  886. package/dist/webpack-Fb9xF5jS.mjs.map +0 -1
  887. package/dist/withTokens-LRidu3Vc.js +0 -95
  888. package/dist/withTokens-LRidu3Vc.js.map +0 -1
@@ -0,0 +1,3457 @@
1
+ //#region utils/symbol.ts
2
+ function symbol(name) {
3
+ return Symbol.for(`@fluentic/style.${name}`);
4
+ }
5
+ //#endregion
6
+ //#region utils/global.ts
7
+ function getGlobalData(key) {
8
+ return globalThis[symbol(key)];
9
+ }
10
+ function globalData(key, data) {
11
+ const id = symbol(key);
12
+ const root = globalThis;
13
+ if (root[id] === void 0) assign(root, id, data());
14
+ return root[id];
15
+ }
16
+ function clearGlobalData(key) {
17
+ delete globalThis[symbol(key)];
18
+ }
19
+ function assign(target, id, value) {
20
+ Object.defineProperty(target, id, {
21
+ value,
22
+ configurable: true,
23
+ enumerable: false,
24
+ writable: true
25
+ });
26
+ }
27
+ //#endregion
28
+ //#region config/utils.ts
29
+ const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
30
+ function getCacheTTL(cache) {
31
+ return cache === true ? 3e5 : cache === false ? 0 : Math.max(cache, 0);
32
+ }
33
+ //#endregion
34
+ //#region config/config/runtime.ts
35
+ const RUNTIME_CONFIG_DEFAULT = {
36
+ changes: 0,
37
+ isPlugin: false,
38
+ isHoist: false,
39
+ isExtracted: false,
40
+ isRSC: false,
41
+ runtimeCacheTTL: getCacheTTL(true)
42
+ };
43
+ const RUNTIME_CONFIG = globalData("config.runtime", () => ({ ...RUNTIME_CONFIG_DEFAULT }));
44
+ //#endregion
45
+ //#region config/config/check.ts
46
+ const CHECK_CONFIG_DEFAULT = {};
47
+ const CHECK_CONFIG = globalData("config.check", () => ({ ...CHECK_CONFIG_DEFAULT }));
48
+ function setStyleCheckOptions(options) {
49
+ CHECK_CONFIG.important = options.important ? { ...options.important } : void 0;
50
+ }
51
+ //#endregion
52
+ //#region config/constants.ts
53
+ const LayerPlaceholder = "$layer";
54
+ //#endregion
55
+ //#region config/config/css.ts
56
+ const CSS_CONFIG_DEFAULT = {
57
+ layer: true,
58
+ layers: [LayerPlaceholder],
59
+ layerNamespace: "css"
60
+ };
61
+ const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
62
+ function isStyleLayerEnabled(layer = CSS_CONFIG.layer) {
63
+ return typeof layer === "boolean" ? layer : layer.style ?? true;
64
+ }
65
+ function isSheetLayerOption(value) {
66
+ return value === void 0 || typeof value === "boolean" || typeof value === "string" && /^\.?(?:--|-?[a-zA-Z_\u0080-\uFFFF])[\w\u0080-\uFFFF-]*(?:\.(?:--|-?[a-zA-Z_\u0080-\uFFFF])[\w\u0080-\uFFFF-]*)*$/.test(value);
67
+ }
68
+ function resolveSheetLayerOption(layer, namespace, mainLayerEnabled = isStyleLayerEnabled()) {
69
+ if (typeof layer !== "string") return layer && mainLayerEnabled ? "style" : false;
70
+ return { name: layer.startsWith(".") ? mainLayerEnabled && namespace ? namespace + layer : layer.slice(1) : layer };
71
+ }
72
+ //#endregion
73
+ //#region config/build.ts
74
+ const BUILD_CONFIG = globalData("config.build", () => ({ current: null }));
75
+ function setBuildConfig(config) {
76
+ BUILD_CONFIG.current = config;
77
+ RUNTIME_CONFIG.isHoist = config.hoist;
78
+ if (config.css) {
79
+ const { debugClassName: _debugClassName, ...css } = config.css;
80
+ Object.assign(CSS_CONFIG, css);
81
+ }
82
+ setStyleCheckOptions(config.check ?? {});
83
+ }
84
+ //#endregion
85
+ //#region config/config/debug.ts
86
+ const DEFAULT_DEBUG_CONFIG = {
87
+ isDebugClassNameEnabled: false,
88
+ isDebugClassNameConfigured: false,
89
+ maxPropertyLength: 24,
90
+ maxValueLength: 8,
91
+ maxSelectorLength: 8,
92
+ maxParentSelectorLength: 8,
93
+ maxAtRuleLength: 10
94
+ };
95
+ const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
96
+ function setDebugClassNameEnabled(value) {
97
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
98
+ DEBUG_CONFIG.isDebugClassNameConfigured = true;
99
+ }
100
+ function setDebugClassNameDefault(value) {
101
+ if (DEBUG_CONFIG.isDebugClassNameConfigured) return;
102
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
103
+ }
104
+ function setBuildDebugClassName(value, fallback) {
105
+ if (typeof value === "boolean") setDebugClassNameEnabled(value);
106
+ else setDebugClassNameDefault(fallback);
107
+ }
108
+ //#endregion
109
+ //#region utils/hash.ts
110
+ function hashString(str) {
111
+ let hash = 2166136261;
112
+ for (let i = 0; i < str.length; i++) hash = Math.imul(hash ^ str.charCodeAt(i), 16777619);
113
+ return (hash >>> 0).toString(36).padEnd(7, "0");
114
+ }
115
+ function normalizeHashLength(length) {
116
+ return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;
117
+ }
118
+ //#endregion
119
+ //#region utils/object.ts
120
+ function set(target, field, data) {
121
+ target[field] = data;
122
+ }
123
+ function unsetAll(obj) {
124
+ for (const key of Object.keys(obj)) delete obj[key];
125
+ }
126
+ function hasOwn(target, field) {
127
+ return Object.prototype.hasOwnProperty.call(target, field);
128
+ }
129
+ //#endregion
130
+ //#region config/config/dev.ts
131
+ const DEV_CONFIG_DEFAULT = {
132
+ isDev: false,
133
+ isCheckSelectorEnabled: true,
134
+ isSourcemapEnabled: true,
135
+ isLocalClassNameEnabled: true,
136
+ sheetMaxRules: 1e3,
137
+ sheetStyleTagNonce: null,
138
+ hashLength: null,
139
+ stylePriorityMode: "sort",
140
+ sourcemapLocationMode: "style",
141
+ isElementClassNameEnabled: true
142
+ };
143
+ const IS_DEV = globalData("config.dev.isDev", () => ({ isDev: false }));
144
+ const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
145
+ const configPlugin = globalData("config.dev.plugin", () => ({ config: null }));
146
+ const configBase = globalData("config.dev.base", () => ({ config: null }));
147
+ const configUtils = globalData("config.dev.utils", () => ({ config: null }));
148
+ function getBuildDevConfig() {
149
+ return configPlugin.config;
150
+ }
151
+ function setBuildDevConfig(config) {
152
+ const checkSelector = config.checkSelector === "force" ? false : config.checkSelector;
153
+ IS_DEV.isDev = true;
154
+ setOptions(configPlugin, {
155
+ ...config,
156
+ checkSelector
157
+ }, null);
158
+ rebuildDevConfig();
159
+ }
160
+ function setDevUtilsRuntimeOptions(options) {
161
+ setOptions(configUtils, options, null);
162
+ rebuildDevConfig();
163
+ }
164
+ function rebuildDevConfig() {
165
+ unsetAll(DEV_CONFIG);
166
+ Object.assign(DEV_CONFIG, DEV_CONFIG_DEFAULT, configBase.config, configPlugin.config, configUtils.config);
167
+ DEV_CONFIG.isDev = IS_DEV.isDev;
168
+ DEV_CONFIG.isLocalClassNameEnabled = DEV_CONFIG.isDev;
169
+ setDebugClassNameDefault(DEV_CONFIG.isDev);
170
+ RUNTIME_CONFIG.changes += 1;
171
+ }
172
+ function setOptions(partialConfig, options, defaultConfig) {
173
+ if (!options) {
174
+ partialConfig.config = defaultConfig;
175
+ return;
176
+ }
177
+ if (!partialConfig.config) partialConfig.config = defaultConfig || {};
178
+ const config = partialConfig.config;
179
+ if (options.priorityMode) config.stylePriorityMode = options.priorityMode;
180
+ if (options.sourcemapMode) config.sourcemapLocationMode = options.sourcemapMode;
181
+ if (typeof options.elementClassName === "boolean") config.isElementClassNameEnabled = options.elementClassName;
182
+ if (typeof options.checkSelector === "boolean") config.isCheckSelectorEnabled = options.checkSelector;
183
+ if (typeof options.hashLength === "number") config.hashLength = normalizeHashLength(options.hashLength);
184
+ }
185
+ //#endregion
186
+ //#region config/document.ts
187
+ const state = globalData("config.document", () => ({
188
+ target: true,
189
+ listeners: /* @__PURE__ */ new Set()
190
+ }));
191
+ function getRuntimeDocument(documentOverride) {
192
+ if (state.target === false) return null;
193
+ if (state.target !== true) return state.target;
194
+ if (documentOverride) return documentOverride;
195
+ return typeof globalThis.document === "undefined" ? null : globalThis.document;
196
+ }
197
+ function setRuntimeDocument(target) {
198
+ if (state.target === target) return;
199
+ state.target = target;
200
+ state.listeners.forEach((listener) => listener());
201
+ }
202
+ function onRuntimeDocumentChange(listener) {
203
+ state.listeners.add(listener);
204
+ }
205
+ //#endregion
206
+ //#region config/configure.ts
207
+ function configureStyleRuntime(options = {}) {
208
+ if (options.document !== void 0) setRuntimeDocument(options.document);
209
+ if (options.css) {
210
+ checkBuildConfig("css");
211
+ const { debugClassName, ...css } = options.css;
212
+ Object.assign(CSS_CONFIG, css);
213
+ if (typeof debugClassName === "boolean") setDebugClassNameEnabled(debugClassName);
214
+ }
215
+ if (options.cacheTTL !== void 0) RUNTIME_CONFIG.runtimeCacheTTL = getCacheTTL(options.cacheTTL);
216
+ if (options.check) {
217
+ checkBuildConfig("check");
218
+ setStyleCheckOptions(options.check);
219
+ }
220
+ }
221
+ function checkBuildConfig(field) {
222
+ if (!BUILD_CONFIG.current) return;
223
+ throw new Error(`Configure "${field}" via plugin options.`);
224
+ }
225
+ //#endregion
226
+ //#region atomic/utils/cssIdent.ts
227
+ function escapeCssIdent(ident) {
228
+ let result = "";
229
+ for (let i = 0; i < ident.length; i++) {
230
+ const char = ident.charAt(i);
231
+ const code = ident.charCodeAt(i);
232
+ const nextCode = ident.charCodeAt(i + 1);
233
+ if (code === 0) {
234
+ result += "�";
235
+ continue;
236
+ }
237
+ if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && ident.charCodeAt(0) === 45) {
238
+ result += "\\" + code.toString(16) + " ";
239
+ continue;
240
+ }
241
+ if (i === 0 && code === 45 && ident.length === 1) {
242
+ result += "\\-";
243
+ continue;
244
+ }
245
+ if (code >= 55296 && code <= 56319 && nextCode >= 56320 && nextCode <= 57343) {
246
+ result += char + ident.charAt(++i);
247
+ continue;
248
+ }
249
+ if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
250
+ result += char;
251
+ continue;
252
+ }
253
+ result += "\\" + char;
254
+ }
255
+ return result;
256
+ }
257
+ function sanitizeCssIdentName(value, fallback = "") {
258
+ return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || fallback;
259
+ }
260
+ //#endregion
261
+ //#region atomic/utils/debug.ts
262
+ function normalizeDebugKeywordValue(value) {
263
+ const normalized = value.trim().toLowerCase();
264
+ return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : null;
265
+ }
266
+ function sanitizeDebugName(value) {
267
+ if (!value) return "";
268
+ return sanitizeCssIdentName(value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), "");
269
+ }
270
+ function normalizePropertyName(property) {
271
+ return property.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
272
+ }
273
+ function sanitizeDebugPropertyName(property) {
274
+ let name = property;
275
+ if (name.charCodeAt(0) === 45 && name.charCodeAt(1) === 45) name = name.slice(2);
276
+ return name.replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
277
+ }
278
+ //#endregion
279
+ //#region atomic/utils/format.ts
280
+ const TOKEN_REGEX = /\(([a-zA-Z][a-zA-Z0-9]*)(?::([0-9]+)(!)?)?\)/g;
281
+ const OPTIONAL_REGEX = /\[([^[\]]*)\]/g;
282
+ const HASH_TOKEN = "$hash";
283
+ function createNameFormatter(keys) {
284
+ const keySet = new Set(keys);
285
+ const cache = /* @__PURE__ */ new Map();
286
+ function getFormatFn(format) {
287
+ if (typeof format === "function") return format;
288
+ let fn = cache.get(format);
289
+ if (!fn) {
290
+ fn = compileFormat(format, keySet);
291
+ cache.set(format, fn);
292
+ }
293
+ return fn;
294
+ }
295
+ return function format(format, hash, info) {
296
+ const name = getFormatFn(format)(info);
297
+ if (!hash) return name;
298
+ if (name.includes(HASH_TOKEN)) return name.replace(HASH_TOKEN, hash);
299
+ return name ? name + "--" + hash : hash;
300
+ };
301
+ }
302
+ function compileFormat(format, keySet) {
303
+ const segments = compileSegments(format, keySet);
304
+ return (info) => {
305
+ let name = "";
306
+ for (const segment of segments) {
307
+ const text = formatSegment(info, segment);
308
+ if (text === null) {
309
+ if (!segment.optional) return "";
310
+ continue;
311
+ }
312
+ name += text;
313
+ }
314
+ return name;
315
+ };
316
+ }
317
+ function compileSegments(format, keySet) {
318
+ const segments = [];
319
+ let lastIndex = 0;
320
+ for (const match of format.matchAll(OPTIONAL_REGEX)) {
321
+ const index = match.index ?? 0;
322
+ if (index > lastIndex) segments.push({
323
+ optional: false,
324
+ parts: compileParts(format.slice(lastIndex, index), keySet)
325
+ });
326
+ segments.push({
327
+ optional: true,
328
+ parts: compileParts(match[1], keySet)
329
+ });
330
+ lastIndex = index + match[0].length;
331
+ }
332
+ if (lastIndex < format.length) segments.push({
333
+ optional: false,
334
+ parts: compileParts(format.slice(lastIndex), keySet)
335
+ });
336
+ return segments;
337
+ }
338
+ function compileParts(segment, keySet) {
339
+ const parts = [];
340
+ let lastIndex = 0;
341
+ for (const match of segment.matchAll(TOKEN_REGEX)) {
342
+ const index = match.index ?? 0;
343
+ const key = match[1];
344
+ if (!keySet.has(key)) continue;
345
+ if (index > lastIndex) parts.push({
346
+ type: "text",
347
+ value: segment.slice(lastIndex, index)
348
+ });
349
+ parts.push({
350
+ type: "token",
351
+ key,
352
+ maxLength: match[2] ? Number(match[2]) : null,
353
+ truncate: Boolean(match[3])
354
+ });
355
+ lastIndex = index + match[0].length;
356
+ }
357
+ if (lastIndex < segment.length) parts.push({
358
+ type: "text",
359
+ value: segment.slice(lastIndex)
360
+ });
361
+ return parts;
362
+ }
363
+ function formatSegment(info, segment) {
364
+ let text = "";
365
+ for (const part of segment.parts) {
366
+ if (part.type === "text") {
367
+ text += part.value;
368
+ continue;
369
+ }
370
+ const value = formatTokenValue(info[part.key], part.maxLength, part.truncate);
371
+ if (value === null) {
372
+ if (segment.optional) return null;
373
+ continue;
374
+ }
375
+ text += value;
376
+ }
377
+ return text;
378
+ }
379
+ function formatTokenValue(value, maxLength, truncate) {
380
+ if (!value) return null;
381
+ if (!maxLength) return value;
382
+ if (!Number.isFinite(maxLength) || maxLength < 0 || value.length <= maxLength) return value;
383
+ return truncate ? value.slice(0, maxLength) : null;
384
+ }
385
+ //#endregion
386
+ //#region atomic/utils/hash.ts
387
+ function getIdentifierSafeHash(value, startLength = 7) {
388
+ const normalizedStartLength = normalizeHashLength(startLength);
389
+ return getIdentifierSafeHashValue(hashString(value)).slice(0, normalizedStartLength);
390
+ }
391
+ function getIdentifierSafeHashValue(hash) {
392
+ const first = hash.charCodeAt(0);
393
+ if (first < 48 || first > 57) return hash;
394
+ return String.fromCharCode(97 + first - 48) + hash.slice(1);
395
+ }
396
+ const formatElementClassName = createNameFormatter(["name"]);
397
+ function getElementClassName(label, id, elementClassNameFormat) {
398
+ const name = sanitizeDebugName(label) || null;
399
+ const hash = getIdentifierSafeHash(id, DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 5);
400
+ return formatElementClassName(elementClassNameFormat || "@(name)", hash, { name });
401
+ }
402
+ function getElementMarkerRuleCss(className) {
403
+ return `.${escapeCssIdent(className)}{--fluentic-element-marker:0}`;
404
+ }
405
+ //#endregion
406
+ //#region atomic/layer/layer.ts
407
+ function compareLayerPriority(p1, p2) {
408
+ return p1[0] - p2[0] || p1[1] - p2[1] || p1[2] - p2[2] || p1[3] - p2[3] || p1[4] - p2[4] || p1[5] - p2[5] || p1[6] - p2[6];
409
+ }
410
+ function createLayerNamePool() {
411
+ const lookup = /* @__PURE__ */ new Map();
412
+ const getLayerId = (priority) => {
413
+ const key = priority.join("|");
414
+ let name = lookup.get(key);
415
+ if (name) return name;
416
+ name = "p" + hashString(key);
417
+ lookup.set(key, name);
418
+ return name;
419
+ };
420
+ const getLayerName = (layerNamespace, priority) => {
421
+ const layerId = getLayerId(priority);
422
+ return layerNamespace ? layerNamespace + "." + layerId : layerId;
423
+ };
424
+ return {
425
+ getLayerName,
426
+ getLayerId
427
+ };
428
+ }
429
+ function createLayerPool(layerNamespace) {
430
+ const namePool = createLayerNamePool();
431
+ const priorities = /* @__PURE__ */ new Map();
432
+ const getName = (priority) => {
433
+ const key = priority.join("|");
434
+ if (!priorities.has(key)) priorities.set(key, priority);
435
+ return namePool.getLayerName(layerNamespace, priority);
436
+ };
437
+ const getNames = () => {
438
+ return Array.from(priorities.values()).sort(compareLayerPriority).map((priority) => namePool.getLayerName(layerNamespace, priority));
439
+ };
440
+ return {
441
+ getName,
442
+ getNames
443
+ };
444
+ }
445
+ function flattenCssLayers(layers, layerNames) {
446
+ const names = typeof layerNames === "string" ? [layerNames] : layerNames;
447
+ return [...new Set(layers.flatMap((layer) => layer === "$layer" ? names.filter((name) => !layers.includes(name)) : layer).filter(Boolean))];
448
+ }
449
+ //#endregion
450
+ //#region atomic/layer/types.ts
451
+ const LayerDefaultLayers = [LayerPlaceholder];
452
+ const LayerDefaultPriority = [
453
+ 0,
454
+ 0,
455
+ 0,
456
+ 0,
457
+ 0,
458
+ 0,
459
+ 0
460
+ ];
461
+ const LayerMediaPriorities = {
462
+ base: 0,
463
+ media: 1,
464
+ priorityMedia: 2
465
+ };
466
+ const LayerSelectorPriorities = {
467
+ base: 0,
468
+ parentSelector: 1,
469
+ selector: 2,
470
+ prioritySelector: 3
471
+ };
472
+ const LayerPropertyPriorities = {
473
+ shorthand: 0,
474
+ intermediate: 1,
475
+ longhand: 2
476
+ };
477
+ //#endregion
478
+ //#region atomic/layer/utils.ts
479
+ function getLayerOrderCss(layers, layerNames) {
480
+ const names = flattenCssLayers(layers, layerNames);
481
+ if (!names.length) return "";
482
+ return "@layer " + names.join(", ") + ";";
483
+ }
484
+ function getLayerBlockCss(layerName, css) {
485
+ return "@layer " + layerName + " {" + css + "}";
486
+ }
487
+ //#endregion
488
+ //#region sheet/utils/layer.ts
489
+ function createSheetLayerState() {
490
+ return createLayerPool(getStyleLayerName());
491
+ }
492
+ function getSheetRulePriority(priority) {
493
+ return priority ?? LayerDefaultPriority;
494
+ }
495
+ function getSheetRuleLayerPriority(priority, important) {
496
+ const resolved = getSheetRulePriority(priority);
497
+ return important ? [
498
+ -resolved[0],
499
+ -resolved[1],
500
+ -resolved[2],
501
+ -resolved[3],
502
+ -resolved[4],
503
+ -resolved[5],
504
+ -resolved[6]
505
+ ] : resolved;
506
+ }
507
+ function getStyleLayerName() {
508
+ return CSS_CONFIG.layerNamespace || "css";
509
+ }
510
+ function getSheetLayerName() {
511
+ return getStyleLayerName() + ".sheet";
512
+ }
513
+ function getSheetLayerNames(layerState, hasSheetLayer, namedLayers = /* @__PURE__ */ new Set()) {
514
+ const names = layerState.getNames();
515
+ return [...new Set([
516
+ ...names,
517
+ ...hasSheetLayer ? [getSheetLayerName()] : [],
518
+ ...namedLayers
519
+ ])];
520
+ }
521
+ //#endregion
522
+ //#region sheet/ordering.ts
523
+ function sheetRuleLayer(rule, config = CSS_CONFIG) {
524
+ const mainEnabled = isStyleLayerEnabled(config.layer);
525
+ let layer = rule.layer ?? "style";
526
+ if (layer === "style" && !mainEnabled) layer = false;
527
+ if (rule.sheet && rule.important && !rule.importantNative && layer !== false) return { name: (typeof layer === "object" ? layer.name : config.layerNamespace || "css") + ".important" };
528
+ return layer;
529
+ }
530
+ function sheetRuleGroup(rule, config = CSS_CONFIG) {
531
+ if (rule.globalSheet) return "global:" + rule.globalSheet.id;
532
+ return rule.sheet && sheetRuleLayer(rule, config) === false ? "local-unlayered" : "regular";
533
+ }
534
+ function compareSheetGroups(a, b) {
535
+ const region = (rule) => rule.globalSheet ? rule.globalSheet.order <= 0 ? 0 : 2 : 1;
536
+ const order = region(a) - region(b);
537
+ if (order) return order;
538
+ if (a.globalSheet && b.globalSheet) return a.globalSheet.order - b.globalSheet.order;
539
+ return 0;
540
+ }
541
+ function compareSheetRules(a, b, config = CSS_CONFIG) {
542
+ const layerRank = (rule) => {
543
+ const layer = sheetRuleLayer(rule, config);
544
+ const main = config.layerNamespace || "css";
545
+ return layer === false ? 2 : layer === "style" || typeof layer === "object" && layer.name === main ? 0 : 1;
546
+ };
547
+ return layerRank(a) - layerRank(b) || compareLayerPriority(getSheetRulePriority(a.priority), getSheetRulePriority(b.priority));
548
+ }
549
+ /** Stable group sort: equal global orders keep the first-discovered sheet first. */
550
+ function orderSheetRules(rules, config = CSS_CONFIG) {
551
+ const groups = /* @__PURE__ */ new Map();
552
+ for (const rule of rules) {
553
+ const key = sheetRuleGroup(rule, config);
554
+ const group = groups.get(key) ?? [];
555
+ group.push(rule);
556
+ groups.set(key, group);
557
+ }
558
+ return [...groups.entries()].sort(([ak, a], [bk, b]) => compareSheetGroups(a[0], b[0]) || (!a[0].globalSheet && !b[0].globalSheet ? Number(ak === "local-unlayered") - Number(bk === "local-unlayered") : 0)).flatMap(([, group]) => group.slice().sort((a, b) => compareSheetRules(a, b, config)));
559
+ }
560
+ /** Reserve each parent's first child for managed important declarations. */
561
+ function sheetLayerOrder(names, config = CSS_CONFIG, reservedParents = names) {
562
+ const roots = [];
563
+ const children = /* @__PURE__ */ new Map();
564
+ const add = (name) => {
565
+ const parts = name.split(".");
566
+ if (!roots.includes(parts[0])) roots.push(parts[0]);
567
+ for (let i = 1; i < parts.length; i++) {
568
+ const parent = parts.slice(0, i).join(".");
569
+ const child = parts.slice(0, i + 1).join(".");
570
+ const list = children.get(parent) ?? [];
571
+ if (!list.includes(child)) list.push(child);
572
+ children.set(parent, list);
573
+ }
574
+ if (!name.endsWith(".important") && reservedParents.includes(name)) children.set(name, children.get(name) ?? []);
575
+ };
576
+ for (const name of [...(config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).filter((name) => name !== "$layer"), ...names]) add(name);
577
+ const rootOrder = flattenCssLayers((config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).map((name) => name === "$layer" ? name : name.split(".")[0]), roots);
578
+ const ordered = /* @__PURE__ */ new Set();
579
+ const append = (name) => {
580
+ ordered.add(name);
581
+ const list = children.get(name);
582
+ if (!list || name.endsWith(".important")) return;
583
+ ordered.add(name + ".important");
584
+ for (const child of list) append(child);
585
+ };
586
+ for (const root of new Set([...rootOrder, ...roots.filter((name) => children.has(name))])) append(root);
587
+ return ordered.size ? "@layer " + [...ordered].join(", ") + ";" : "";
588
+ }
589
+ function layerNameForRule(rule, config, mode, pool) {
590
+ const layer = sheetRuleLayer(rule, config);
591
+ return typeof layer === "object" ? layer.name : layer === false ? null : layer === "sheet" ? (config.layerNamespace || "css") + ".sheet" : mode === "layer" ? pool.getName(getSheetRuleLayerPriority(rule.priority, rule.important)) : config.layerNamespace || "css";
592
+ }
593
+ /** Build only ordering declarations; runtime flushing need not serialize rule bodies. */
594
+ function sheetOrderingPreamble(rules, config = CSS_CONFIG, mode = "sort") {
595
+ const pool = createLayerPool(config.layerNamespace || "css");
596
+ const names = /* @__PURE__ */ new Set();
597
+ for (const rule of orderSheetRules(rules, config)) {
598
+ const name = layerNameForRule(rule, config, mode, pool);
599
+ if (name) names.add(name);
600
+ }
601
+ const priorities = pool.getNames();
602
+ const named = [...names].filter((name) => !priorities.includes(name));
603
+ return sheetLayerOrder([...priorities, ...named], config, named);
604
+ }
605
+ function serializeOrderedRules(rules, config = CSS_CONFIG, mode = "sort") {
606
+ const pool = createLayerPool(config.layerNamespace || "css");
607
+ const rendered = [];
608
+ let currentLayer = null;
609
+ let group = [];
610
+ const flush = () => {
611
+ if (!group.length) return;
612
+ const css = group.join("\n");
613
+ rendered.push(currentLayer ? getLayerBlockCss(currentLayer, css) : css);
614
+ group = [];
615
+ };
616
+ for (const rule of orderSheetRules(rules, config)) {
617
+ const name = layerNameForRule(rule, config, mode, pool);
618
+ if (name !== currentLayer) flush();
619
+ currentLayer = name;
620
+ group.push(rule.css);
621
+ }
622
+ flush();
623
+ return [sheetOrderingPreamble(rules, config, mode), ...rendered].filter(Boolean).join("\n");
624
+ }
625
+ //#endregion
626
+ //#region sheet/utils/dom.ts
627
+ function resolveDocument(documentOverride) {
628
+ if (documentOverride !== void 0) return documentOverride;
629
+ if (typeof document === "undefined") return null;
630
+ return document;
631
+ }
632
+ function createStyleTag(document, name, nonce = DEV_CONFIG.sheetStyleTagNonce) {
633
+ const tag = document.createElement("style");
634
+ tag.setAttribute("data-css-sheet", name);
635
+ if (nonce) tag.setAttribute("nonce", nonce);
636
+ return tag;
637
+ }
638
+ function appendStyleTag(document, tag) {
639
+ (document.head || document.getElementsByTagName("head")[0] || document.documentElement).appendChild(tag);
640
+ }
641
+ function insertStyleTagAfter(document, tag, previous) {
642
+ if (!previous || !previous.parentNode) {
643
+ appendStyleTag(document, tag);
644
+ return;
645
+ }
646
+ previous.parentNode.insertBefore(tag, previous.nextSibling);
647
+ }
648
+ function insertStyleTagAtTop(document, tag) {
649
+ const head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
650
+ const first = getFirstCssSheetTag(head);
651
+ if (first) head.insertBefore(tag, first);
652
+ else head.appendChild(tag);
653
+ }
654
+ function getFirstCssSheetTag(head) {
655
+ const nodes = head.childNodes;
656
+ for (let i = 0, len = nodes.length; i < len; i++) {
657
+ const node = nodes[i];
658
+ if (typeof node.getAttribute !== "function") continue;
659
+ if (node.getAttribute("data-css-sheet")) return node;
660
+ }
661
+ return null;
662
+ }
663
+ //#endregion
664
+ //#region sheet/ordered.ts
665
+ const refreshers = globalData("sheet.ordered.refreshers", () => /* @__PURE__ */ new Set());
666
+ function refreshOrderedSheets() {
667
+ for (const refresh of refreshers) refresh();
668
+ }
669
+ /** Keep whole global sheets together; move DOM groups without rebuilding unrelated rules. */
670
+ function createOrderedSheet(create, options, dev) {
671
+ const document = resolveDocument(options.document);
672
+ if (!document) return create(options);
673
+ const groups = /* @__PURE__ */ new Map();
674
+ const owners = /* @__PURE__ */ new Map();
675
+ const direct = [];
676
+ const seen = /* @__PURE__ */ new Set();
677
+ let activeLayers = CSS_CONFIG.layers;
678
+ let enabled = false;
679
+ let header = null;
680
+ let serial = 0;
681
+ let dirty = false;
682
+ let orderingDirty = true;
683
+ let order = "";
684
+ let mode = DEV_CONFIG.stylePriorityMode;
685
+ const pending = /* @__PURE__ */ new Set();
686
+ const regular = getGroup("regular");
687
+ const refresh = () => {
688
+ dirty = true;
689
+ orderingDirty = true;
690
+ flush();
691
+ };
692
+ if (dev) refreshers.add(refresh);
693
+ function getGroup(name) {
694
+ const previous = groups.get(name);
695
+ if (previous) return previous;
696
+ const tagName = name === "regular" ? options.tagName : (options.tagName ? options.tagName + " " : "") + "ordered-" + ++serial;
697
+ const group = {
698
+ name,
699
+ tagName,
700
+ rules: [],
701
+ ordering: /* @__PURE__ */ new Map(),
702
+ sheet: create({
703
+ ...options,
704
+ tagName
705
+ })
706
+ };
707
+ group.sheet.updateLayers(activeLayers ?? []);
708
+ groups.set(name, group);
709
+ return group;
710
+ }
711
+ function route(rule) {
712
+ return {
713
+ ...rule,
714
+ layer: sheetRuleLayer(rule)
715
+ };
716
+ }
717
+ function insert(rule) {
718
+ const item = typeof rule === "string" ? { css: rule } : rule;
719
+ const key = sheetRuleGroup(item) + "\0" + (item.key ?? item.css);
720
+ if (seen.has(key)) return;
721
+ seen.add(key);
722
+ direct.push(item);
723
+ add(item);
724
+ }
725
+ function add(item) {
726
+ enabled ||= !!(item.sheet || item.globalSheet);
727
+ const group = getGroup(sheetRuleGroup(item));
728
+ const previous = group.rules[group.rules.length - 1];
729
+ group.rules.push(item);
730
+ trackOrdering(group, item);
731
+ if (!dev && enabled && previous && compareSheetRules(previous, item) > 0) pending.add(group);
732
+ if (!pending.has(group)) group.sheet.insert(route(item));
733
+ dirty = true;
734
+ }
735
+ function trackOrdering(group, rule) {
736
+ const key = JSON.stringify([
737
+ rule.layer ?? "style",
738
+ rule.priority ?? [
739
+ 0,
740
+ 0,
741
+ 0,
742
+ 0,
743
+ 0,
744
+ 0,
745
+ 0
746
+ ],
747
+ !!rule.sheet,
748
+ !!rule.important,
749
+ !!rule.importantNative,
750
+ rule.globalSheet?.order
751
+ ]);
752
+ if (group.ordering.has(key)) return;
753
+ group.ordering.set(key, rule);
754
+ orderingDirty = true;
755
+ }
756
+ function rebuild(group) {
757
+ pending.delete(group);
758
+ group.sheet.destroy?.();
759
+ group.sheet = create({
760
+ ...options,
761
+ tagName: group.tagName
762
+ });
763
+ group.sheet.updateLayers(activeLayers ?? []);
764
+ group.rules.sort((a, b) => compareSheetRules(a, b));
765
+ group.ordering.clear();
766
+ orderingDirty = true;
767
+ for (const rule of group.rules) trackOrdering(group, rule);
768
+ for (const rule of group.rules) group.sheet.insert(route(rule));
769
+ group.sheet.flush();
770
+ dirty = true;
771
+ }
772
+ function collectTags() {
773
+ const lookup = new Map([...groups.values()].map((group) => [group.tagName ?? "", group]));
774
+ const result = /* @__PURE__ */ new Map();
775
+ const head = document.head || document.documentElement;
776
+ for (const node of Array.from(head.childNodes)) {
777
+ if (typeof node.getAttribute !== "function") continue;
778
+ const match = node.getAttribute("data-css-sheet")?.match(/^(?:(.*) )?(?:layers|rules(?: .*)?)$/);
779
+ const group = match && lookup.get(match[1] ?? "");
780
+ if (!group) continue;
781
+ const list = result.get(group) ?? [];
782
+ list.push(node);
783
+ result.set(group, list);
784
+ }
785
+ return result;
786
+ }
787
+ function flush() {
788
+ if (dev && mode !== DEV_CONFIG.stylePriorityMode) {
789
+ mode = DEV_CONFIG.stylePriorityMode;
790
+ dirty = true;
791
+ orderingDirty = true;
792
+ }
793
+ for (const group of pending) rebuild(group);
794
+ pending.clear();
795
+ for (const group of groups.values()) group.sheet.flush();
796
+ if (!enabled || !dirty) return;
797
+ if (orderingDirty) {
798
+ const config = {
799
+ ...CSS_CONFIG,
800
+ layers: activeLayers ? [...activeLayers] : void 0
801
+ };
802
+ const all = [];
803
+ for (const group of groups.values()) for (const rule of group.ordering.values()) all.push(rule);
804
+ order = sheetOrderingPreamble(all, config, dev ? DEV_CONFIG.stylePriorityMode : "layer");
805
+ orderingDirty = false;
806
+ }
807
+ const head = document.head || document.documentElement;
808
+ const groupTags = collectTags();
809
+ if (!header) {
810
+ header = createStyleTag(document, (options.tagName ? options.tagName + " " : "") + "ordering", options.nonce);
811
+ const first = groupTags.get(regular)?.[0];
812
+ if (first) head.insertBefore(header, first);
813
+ else head.appendChild(header);
814
+ }
815
+ if (header.textContent !== order) header.textContent = order;
816
+ const sorted = [...groups.values()].sort((a, b) => {
817
+ const ar = a.rules[0] ?? { css: "" };
818
+ const br = b.rules[0] ?? { css: "" };
819
+ return compareSheetGroups(ar, br) || (!ar.globalSheet && !br.globalSheet ? Number(a.name === "local-unlayered") - Number(b.name === "local-unlayered") : 0);
820
+ });
821
+ let previous = header;
822
+ for (const group of sorted) for (const tag of groupTags.get(group) ?? []) {
823
+ if (previous.nextSibling !== tag) {
824
+ const oldSheet = tag.sheet;
825
+ const css = oldSheet ? Array.from(oldSheet.cssRules).map((rule) => rule.cssText) : [];
826
+ head.insertBefore(tag, previous.nextSibling);
827
+ if (oldSheet && tag.sheet !== oldSheet && css.length && !tag.sheet?.cssRules.length) for (const rule of css) tag.sheet?.insertRule(rule, tag.sheet.cssRules.length);
828
+ }
829
+ previous = tag;
830
+ }
831
+ dirty = false;
832
+ }
833
+ return {
834
+ insert,
835
+ flush,
836
+ updateLayers(layers) {
837
+ if (activeLayers?.length === layers.length && layers.every((name, index) => activeLayers[index] === name)) return;
838
+ activeLayers = [...layers];
839
+ orderingDirty = true;
840
+ for (const group of groups.values()) group.sheet.updateLayers(layers);
841
+ dirty = true;
842
+ },
843
+ replaceRules(owner, rules) {
844
+ const previous = owners.get(owner) ?? [];
845
+ owners.set(owner, rules);
846
+ enabled = true;
847
+ const affected = new Set([...previous, ...rules].map((rule) => sheetRuleGroup(rule)));
848
+ const all = [...direct, ...[...owners.values()].flat()];
849
+ for (const name of affected) {
850
+ const group = getGroup(name);
851
+ group.rules = all.filter((rule) => sheetRuleGroup(rule) === name);
852
+ rebuild(group);
853
+ }
854
+ flush();
855
+ },
856
+ destroy() {
857
+ refreshers.delete(refresh);
858
+ for (const group of groups.values()) group.sheet.destroy?.();
859
+ if (header?.parentNode) header.parentNode.removeChild(header);
860
+ groups.clear();
861
+ }
862
+ };
863
+ }
864
+ //#endregion
865
+ //#region sheet/utils/noop.ts
866
+ const noopSheet = {
867
+ updateLayers() {},
868
+ insert() {},
869
+ flush() {}
870
+ };
871
+ function createNoopSheet() {
872
+ return noopSheet;
873
+ }
874
+ //#endregion
875
+ //#region sheet/utils/rule.ts
876
+ function normalizeRule(rule) {
877
+ return typeof rule === "string" ? rule : rule.css;
878
+ }
879
+ //#endregion
880
+ //#region utils/trace.ts
881
+ const FN_MARKER = "$fn_";
882
+ function traceMarker(fn, name) {
883
+ Object.defineProperty(fn, "name", {
884
+ value: FN_MARKER + name,
885
+ configurable: true
886
+ });
887
+ }
888
+ const CALLSITE_REGEX = /(.+):(\d+):(\d+)$/;
889
+ function traceCallsite() {
890
+ const lines = (traceAdjustError(/* @__PURE__ */ new Error()).stack || "").split("\n");
891
+ const parsedFrames = lines.slice(1).map(parseStackFrame).filter((frame) => frame !== null);
892
+ if (!parsedFrames.length) return null;
893
+ const targetFrame = parsedFrames.find((frame) => !isInternalCallsite(frame.filePath)) ?? parsedFrames[0];
894
+ return {
895
+ stack: [lines[0] || "Error", createStackFrameLine(targetFrame)].join("\n"),
896
+ filePath: targetFrame.filePath,
897
+ sourceUrl: targetFrame.sourceUrl,
898
+ line: targetFrame.line,
899
+ column: targetFrame.column
900
+ };
901
+ }
902
+ function parseStackFrame(lineText) {
903
+ const match = getStackFrameLocationText(lineText).match(CALLSITE_REGEX);
904
+ if (!match) return null;
905
+ const rawFilePath = normalizeCallsiteSourceUrl(match[1]);
906
+ return {
907
+ filePath: normalizeCallsiteFilePath(rawFilePath),
908
+ sourceUrl: isFetchableCallsiteSourceUrl(rawFilePath) ? rawFilePath : void 0,
909
+ line: parseInt(match[2], 10),
910
+ column: parseInt(match[3], 10)
911
+ };
912
+ }
913
+ function getStackFrameLocationText(lineText) {
914
+ let frame = lineText.trim().replace(/^at\s+/, "");
915
+ if (frame.endsWith(")")) {
916
+ const parenIndex = frame.lastIndexOf("(");
917
+ if (parenIndex !== -1) frame = frame.slice(parenIndex + 1, -1);
918
+ }
919
+ return frame;
920
+ }
921
+ function normalizeCallsiteSourceUrl(source) {
922
+ let filePath = source.trim();
923
+ try {
924
+ filePath = decodeURI(filePath);
925
+ } catch {}
926
+ if (filePath.startsWith("source:///at ") || filePath.startsWith("source:///at%20")) filePath = filePath.slice(10);
927
+ const strayAtMatch = filePath.match(/(?:^|\/)at\s+([a-zA-Z][a-zA-Z\d+.-]*:\/\/.+|\/.+)$/);
928
+ return strayAtMatch ? strayAtMatch[1] : filePath.replace(/^at\s+/, "");
929
+ }
930
+ function normalizeCallsiteFilePath(filePath) {
931
+ filePath = normalizeCallsiteSourceUrl(filePath);
932
+ const queryIndex = findFirstIndex(filePath, ["?", "#"]);
933
+ if (queryIndex !== -1) filePath = filePath.substring(0, queryIndex);
934
+ filePath = filePath.replace(/^file:\/\/\/?/, "");
935
+ if (filePath.startsWith("/@fs/")) filePath = "/" + filePath.slice(5);
936
+ const webpackInternalMatch = filePath.match(/^webpack-internal:\/\/\/(?:\([^)]+\)\/)?(.+)$/);
937
+ if (webpackInternalMatch) filePath = webpackInternalMatch[1];
938
+ const webpackSourceMatch = filePath.match(/^webpack:\/\/[^/]+\/(.+)$/);
939
+ if (webpackSourceMatch) filePath = webpackSourceMatch[1];
940
+ return filePath;
941
+ }
942
+ function isFetchableCallsiteSourceUrl(filePath) {
943
+ return /^https?:\/\//.test(filePath) || filePath.startsWith("/");
944
+ }
945
+ function findFirstIndex(text, needles) {
946
+ let index = -1;
947
+ for (const needle of needles) {
948
+ const next = text.indexOf(needle);
949
+ if (next !== -1 && (index === -1 || next < index)) index = next;
950
+ }
951
+ return index;
952
+ }
953
+ function createStackFrameLine(frame) {
954
+ return ` at ${frame.filePath}:${frame.line}:${frame.column}`;
955
+ }
956
+ function isInternalCallsite(filePath) {
957
+ const normalized = filePath.replace(/\\/g, "/");
958
+ return normalized.startsWith("node:") || normalized.startsWith("internal/") || normalized.includes("/node_modules/") || normalized.includes("/packages/style/dist/") || normalized.includes("/packages/style/builder/") || normalized.includes("/packages/style/css/") || normalized.includes("/packages/style/runtime/") || normalized.includes("/packages/style/utils/trace.");
959
+ }
960
+ function traceError(message, options = {}) {
961
+ const error = new Error(message || "");
962
+ error.name = options.name || "StyleError";
963
+ if (typeof options.stack === "string") {
964
+ error.stack = options.stack;
965
+ return error;
966
+ }
967
+ return traceAdjustError(error, options);
968
+ }
969
+ function traceAdjustError(error, options = {}) {
970
+ const offset = options.offset ?? 0;
971
+ const stack = error.stack;
972
+ if (!stack) return error;
973
+ const lines = stack.split("\n");
974
+ const markerIndex = lines.findIndex((line) => line.includes(FN_MARKER));
975
+ if (markerIndex === -1) return error;
976
+ const traced = new Error(error.message);
977
+ traced.name = error.name;
978
+ const frameStartIndex = Math.max(markerIndex + 1 + offset, 1);
979
+ let frames = lines.slice(frameStartIndex);
980
+ if (options.limit) frames = frames.slice(0, options.limit);
981
+ traced.stack = [lines[0], ...frames].join("\n");
982
+ return traced;
983
+ }
984
+ function isDebugData(value) {
985
+ if (!value || typeof value !== "object") return false;
986
+ const data = value;
987
+ return data.$$debug === true && Array.isArray(data.loc) && Array.isArray(data.label);
988
+ }
989
+ function getDebugCallsiteId(debug) {
990
+ const label = debug.label[0] || debug.label[1];
991
+ if (!label) return null;
992
+ const hash = debug.sourceUrl + "\n" + debug.loc[0] + ":" + debug.loc[1] + "\n" + (debug.label[1] || label);
993
+ return label + "_" + hashString(hash);
994
+ }
995
+ function getTraceCallsiteId(callsite) {
996
+ return hashString(callsite.filePath + "\n" + callsite.line + ":" + callsite.column);
997
+ }
998
+ function getDebugCallsite(debug) {
999
+ return createDebugCallsite(debug.loc, debug);
1000
+ }
1001
+ function getDebugFieldCallsite(debug, field) {
1002
+ if (!debug) return null;
1003
+ const loc = getDebugFieldLoc(debug, field);
1004
+ return loc ? createDebugCallsite(loc, debug) : null;
1005
+ }
1006
+ function getDebugFieldLoc(debug, field) {
1007
+ const loc = debug?.fields?.[field];
1008
+ if (!loc) return null;
1009
+ if (Array.isArray(loc)) return loc;
1010
+ return loc[DEV_CONFIG.sourcemapLocationMode === "value" ? 1 : 0] ?? loc[0] ?? loc[1] ?? null;
1011
+ }
1012
+ function createDebugCallsite(loc, debug) {
1013
+ const [line, column] = loc;
1014
+ const sourceUrl = loc[3] ?? debug.sourceUrl;
1015
+ const sourceContent = loc[4] ?? debug.code;
1016
+ return {
1017
+ stack: `Error\n at ${sourceUrl}:${line}:${column}`,
1018
+ filePath: sourceUrl,
1019
+ sourceUrl,
1020
+ sourceContent,
1021
+ line,
1022
+ column
1023
+ };
1024
+ }
1025
+ //#endregion
1026
+ //#region sheet/utils/sourcemap.ts
1027
+ const VLQ_BASE_SHIFT = 5;
1028
+ const VLQ_BASE = 1 << VLQ_BASE_SHIFT;
1029
+ const VLQ_BASE_MASK = VLQ_BASE - 1;
1030
+ const VLQ_CONTINUATION_BIT = VLQ_BASE;
1031
+ const BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1032
+ const SOURCE_URL_PREFIX = "source://";
1033
+ function createSourceMapComment$1(rules) {
1034
+ const sources = [];
1035
+ const sourceLookup = Object.create(null);
1036
+ let generatedLine = 0;
1037
+ let previousSource = 0;
1038
+ let previousOriginalLine = 0;
1039
+ let previousOriginalColumn = 0;
1040
+ const mappingLines = [];
1041
+ for (let i = 0, len = rules.length; i < len; i++) {
1042
+ const rule = rules[i];
1043
+ const sourceData = rule.source;
1044
+ let mapping = "";
1045
+ if (sourceData) {
1046
+ const source = getSource(sources, sourceLookup, getSourceMapSourceUrl(sourceData), sourceData.sourceContent);
1047
+ const originalLine = Math.max(sourceData.line - 1, 0);
1048
+ const originalColumn = Math.max(sourceData.column - 1, 0);
1049
+ mapping += encodeVlq(0);
1050
+ mapping += encodeVlq(source.sourceIndex - previousSource);
1051
+ mapping += encodeVlq(originalLine - previousOriginalLine);
1052
+ mapping += encodeVlq(originalColumn - previousOriginalColumn);
1053
+ previousSource = source.sourceIndex;
1054
+ previousOriginalLine = originalLine;
1055
+ previousOriginalColumn = originalColumn;
1056
+ }
1057
+ mappingLines[generatedLine] = mapping;
1058
+ const lineCount = getLineCount(rule.css);
1059
+ for (let j = 1; j < lineCount; j++) mappingLines[generatedLine + j] = "";
1060
+ generatedLine += lineCount;
1061
+ }
1062
+ if (!sources.length) return "";
1063
+ const data = {
1064
+ version: 3,
1065
+ sources: sources.map((source) => source.filePath),
1066
+ sourcesContent: sources.some((source) => source.sourceContent !== void 0) ? sources.map((source) => source.sourceContent ?? null) : void 0,
1067
+ names: [],
1068
+ mappings: mappingLines.join(";")
1069
+ };
1070
+ return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + encodeBase64(JSON.stringify(data)) + " */";
1071
+ }
1072
+ function encodeBase64(text) {
1073
+ const bytes = new TextEncoder().encode(text);
1074
+ let binary = "";
1075
+ for (let i = 0, len = bytes.length; i < len; i++) binary += String.fromCharCode(bytes[i]);
1076
+ return btoa(binary);
1077
+ }
1078
+ function getSource(sources, sourceLookup, filePath, sourceContent) {
1079
+ let source = sourceLookup[filePath];
1080
+ if (source) {
1081
+ if (source.sourceContent === void 0) source.sourceContent = sourceContent;
1082
+ return source;
1083
+ }
1084
+ source = {
1085
+ filePath,
1086
+ sourceIndex: sources.length,
1087
+ sourceContent
1088
+ };
1089
+ sources.push(source);
1090
+ sourceLookup[filePath] = source;
1091
+ return source;
1092
+ }
1093
+ function normalizeSourcePath(filePath) {
1094
+ filePath = normalizeCallsiteSourceUrl(filePath);
1095
+ const atIndex = filePath.indexOf("/at ");
1096
+ if (atIndex !== -1) return filePath.slice(atIndex + 4);
1097
+ return filePath.replace(/^at\s+/, "");
1098
+ }
1099
+ function getSourceMapSourceUrl(sourceData) {
1100
+ const sourceUrl = sourceData.sourceUrl || sourceData.filePath;
1101
+ if (sourceData.sourceContent !== void 0) return normalizeSourcePath(sourceUrl);
1102
+ return normalizeSourcePath(resolveSidecarSourceUrl(sourceUrl));
1103
+ }
1104
+ function resolveSidecarSourceUrl(sourceUrl) {
1105
+ const sidecarUrl = getSidecarUrl();
1106
+ if (!sidecarUrl) return sourceUrl;
1107
+ return joinSourceUrl(sidecarUrl, getSourceUrlPath(sourceUrl));
1108
+ }
1109
+ function getSidecarUrl() {
1110
+ const value = globalThis[Symbol.for(SIDECAR_URL_GLOBAL_SYMBOL)];
1111
+ return typeof value === "string" && value ? value : null;
1112
+ }
1113
+ function getSourceUrlPath(sourceUrl) {
1114
+ if (sourceUrl.startsWith(SOURCE_URL_PREFIX)) return sourceUrl.slice(9).replace(/^\/+/, "");
1115
+ try {
1116
+ return new URL(sourceUrl).pathname.replace(/^\/+/, "");
1117
+ } catch {
1118
+ return sourceUrl.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:\/+/, "").replace(/^\/+/, "");
1119
+ }
1120
+ }
1121
+ function joinSourceUrl(baseUrl, sourcePath) {
1122
+ const base = baseUrl.replace(/\/+$/, "");
1123
+ const path = sourcePath.replace(/^\/+/, "");
1124
+ return path ? `${base}/${path}` : base;
1125
+ }
1126
+ function getLineCount(css) {
1127
+ let count = 1;
1128
+ for (let i = 0, len = css.length; i < len; i++) if (css.charCodeAt(i) === 10) count++;
1129
+ return count;
1130
+ }
1131
+ function encodeVlq(value) {
1132
+ let vlq = value < 0 ? (-value << 1) + 1 : value << 1;
1133
+ let encoded = "";
1134
+ do {
1135
+ let digit = vlq & VLQ_BASE_MASK;
1136
+ vlq >>>= VLQ_BASE_SHIFT;
1137
+ if (vlq > 0) digit |= VLQ_CONTINUATION_BIT;
1138
+ encoded += BASE64[digit];
1139
+ } while (vlq > 0);
1140
+ return encoded;
1141
+ }
1142
+ //#endregion
1143
+ //#region sheet/sourcemap.ts
1144
+ function getRuleCallsite(callsite, debug, debugField) {
1145
+ if (debug && debugField) {
1146
+ const loc = getDebugFieldLoc(debug, debugField);
1147
+ if (loc) return normalizeRuleCallsite({
1148
+ filePath: loc[3] ?? debug.sourceUrl,
1149
+ sourceUrl: loc[3] ?? debug.sourceUrl,
1150
+ sourceContent: loc[4] ?? debug.code,
1151
+ line: loc[0],
1152
+ column: loc[1]
1153
+ });
1154
+ }
1155
+ if (callsite) return normalizeRuleCallsite(callsite);
1156
+ if (debug) return normalizeRuleCallsite({
1157
+ filePath: debug.sourceUrl,
1158
+ sourceUrl: debug.sourceUrl,
1159
+ sourceContent: debug.code,
1160
+ line: debug.loc[0],
1161
+ column: debug.loc[1]
1162
+ });
1163
+ return callsite || null;
1164
+ }
1165
+ function normalizeRuleCallsite(callsite) {
1166
+ return {
1167
+ ...callsite,
1168
+ filePath: normalizeCallsiteSourceUrl(callsite.filePath),
1169
+ sourceUrl: callsite.sourceUrl ? normalizeCallsiteSourceUrl(callsite.sourceUrl) : callsite.sourceUrl
1170
+ };
1171
+ }
1172
+ function createSourceMapComment(rules) {
1173
+ return createSourceMapComment$1(rules.map((rule) => ({
1174
+ css: rule.css,
1175
+ source: getSourcemapRuleCallsite(rule)
1176
+ })));
1177
+ }
1178
+ function getSourcemapRuleCallsite(rule) {
1179
+ return getRuleCallsite(rule.callsite, rule.debug, rule.debugField);
1180
+ }
1181
+ //#endregion
1182
+ //#region sheet/dev/utils.ts
1183
+ const SOURCEMAP_TAGS = globalData("sheet.dev.sourcemapTags", () => []);
1184
+ function getDevSourcemapTags() {
1185
+ return SOURCEMAP_TAGS;
1186
+ }
1187
+ function refreshDevSourcemapTags() {
1188
+ for (let i = 0, len = SOURCEMAP_TAGS.length; i < len; i++) SOURCEMAP_TAGS[i].updateSourceMap();
1189
+ }
1190
+ function pruneDevSourcemapTags() {
1191
+ for (let i = SOURCEMAP_TAGS.length - 1; i >= 0; i--) if (!SOURCEMAP_TAGS[i].tag.parentNode) SOURCEMAP_TAGS.splice(i, 1);
1192
+ }
1193
+ function createDevTag(document, previous, options) {
1194
+ const tag = createStyleTag(document, options.className ?? "rules", options.nonce);
1195
+ const wrapperEndNode = options.wrapper ? document.createTextNode(options.wrapper.after) : null;
1196
+ const sourceMapNode = options.sourcemap ? document.createTextNode("") : null;
1197
+ if (options.wrapper) tag.appendChild(document.createTextNode(options.wrapper.before));
1198
+ if (wrapperEndNode) tag.appendChild(wrapperEndNode);
1199
+ if (sourceMapNode) tag.appendChild(sourceMapNode);
1200
+ if (options.before) options.before.parentNode?.insertBefore(tag, options.before);
1201
+ else if (options.top && (!previous || !previous.parentNode)) insertStyleTagAtTop(document, tag);
1202
+ else insertStyleTagAfter(document, tag, previous);
1203
+ const item = {
1204
+ tag,
1205
+ rules: [],
1206
+ sourceMapNode,
1207
+ insertBeforeNode: wrapperEndNode ?? sourceMapNode,
1208
+ count: 0,
1209
+ updateSourceMap() {
1210
+ if (!sourceMapNode) return;
1211
+ if (sourceMapNode.parentNode !== tag) tag.appendChild(sourceMapNode);
1212
+ sourceMapNode.data = "\n" + createSourceMapComment(getSourceMapRules(item.rules, options.wrapper?.sourceMapLineOffset ?? 0));
1213
+ }
1214
+ };
1215
+ if (sourceMapNode) SOURCEMAP_TAGS.push(item);
1216
+ return item;
1217
+ }
1218
+ function insertDevRule(document, item, fragment, css, rule) {
1219
+ fragment.appendChild(document.createTextNode(css + "\n"));
1220
+ item.rules.push({
1221
+ css,
1222
+ callsite: rule?.callsite ?? null,
1223
+ debug: rule?.debug ?? null,
1224
+ debugField: rule?.debugField ?? null
1225
+ });
1226
+ item.count++;
1227
+ }
1228
+ function getSourceMapRules(rules, offset) {
1229
+ if (!offset) return rules;
1230
+ const output = [];
1231
+ for (let i = 0; i < offset; i++) output.push({
1232
+ css: "",
1233
+ callsite: null
1234
+ });
1235
+ return output.concat(rules);
1236
+ }
1237
+ //#endregion
1238
+ //#region sheet/dev/dev_layer.ts
1239
+ function createDevLayerSheet(options = {}) {
1240
+ const document = resolveDocument(options.document);
1241
+ if (!document) return createNoopSheet();
1242
+ const maxRules = Math.max(options.maxRules ?? DEV_CONFIG.sheetMaxRules, 1);
1243
+ const sourcemap = options.sourcemap ?? DEV_CONFIG.isSourcemapEnabled;
1244
+ const inserted = /* @__PURE__ */ new Set();
1245
+ const layerState = createSheetLayerState();
1246
+ const tagPrefix = options.tagName ? options.tagName + " " : "";
1247
+ const rootLayer = tagPrefix === "element-marker " ? getStyleLayerName() : null;
1248
+ const layerTag = createStyleTag(document, tagPrefix + "layers", options.nonce);
1249
+ const queued = [];
1250
+ let layerText = "";
1251
+ let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
1252
+ const groups = [];
1253
+ const groupLookup = /* @__PURE__ */ new Map();
1254
+ let hasSheetLayer = false;
1255
+ const namedLayers = /* @__PURE__ */ new Set();
1256
+ if (options.top) insertStyleTagAtTop(document, layerTag);
1257
+ else insertStyleTagAfter(document, layerTag, null);
1258
+ return {
1259
+ updateLayers(layers) {
1260
+ activeLayers = layers;
1261
+ const next = getLayerOrderCss(layers, rootLayer ?? getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
1262
+ if (next === layerText) return;
1263
+ layerText = next;
1264
+ layerTag.textContent = next;
1265
+ },
1266
+ insert(rule) {
1267
+ const rawCss = normalizeRule(rule);
1268
+ const ruleKey = typeof rule === "string" ? null : rule.key;
1269
+ if (ruleKey && inserted.has(ruleKey)) return;
1270
+ const priority = typeof rule === "string" ? getSheetRuleLayerPriority(null, false) : getSheetRuleLayerPriority(rule.priority, rule.important);
1271
+ const ruleLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
1272
+ if (ruleLayer === "sheet") hasSheetLayer = true;
1273
+ if (typeof ruleLayer === "object") namedLayers.add(ruleLayer.name);
1274
+ const layerName = rootLayer ?? (typeof ruleLayer === "object" ? ruleLayer.name : ruleLayer === "sheet" ? getSheetLayerName() : ruleLayer === false || !isStyleLayerEnabled() ? null : layerState.getName(priority));
1275
+ const nextLayerText = getLayerOrderCss(activeLayers, rootLayer ?? getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
1276
+ if (nextLayerText !== layerText) {
1277
+ layerText = nextLayerText;
1278
+ layerTag.textContent = nextLayerText;
1279
+ }
1280
+ const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
1281
+ const key = typeof rule === "string" ? css : ruleKey;
1282
+ if (key && inserted.has(key)) return;
1283
+ if (key) inserted.add(key);
1284
+ queued.push({
1285
+ css,
1286
+ rule: typeof rule === "string" ? null : rule,
1287
+ group: getGroup(typeof rule === "string" ? { css: rule } : rule)
1288
+ });
1289
+ },
1290
+ flush() {
1291
+ if (!queued.length) return;
1292
+ const touched = /* @__PURE__ */ new Set();
1293
+ let fragment = null;
1294
+ let fragmentTag = null;
1295
+ const flushFragment = () => {
1296
+ if (!fragment || !fragmentTag) return;
1297
+ if (fragmentTag.insertBeforeNode && fragmentTag.insertBeforeNode.parentNode === fragmentTag.tag) fragmentTag.tag.insertBefore(fragment, fragmentTag.insertBeforeNode);
1298
+ else fragmentTag.tag.appendChild(fragment);
1299
+ fragment = null;
1300
+ fragmentTag = null;
1301
+ };
1302
+ for (let i = 0, len = queued.length; i < len; i++) {
1303
+ const item = queued[i];
1304
+ const group = item.group;
1305
+ let active = group.tags[group.tags.length - 1];
1306
+ if (!active || active.count >= maxRules) {
1307
+ flushFragment();
1308
+ const index = groups.indexOf(group);
1309
+ let before;
1310
+ let previous = layerTag;
1311
+ for (let i = index + 1; i < groups.length; i++) if (groups[i].tags.length) {
1312
+ before = groups[i].tags[0].tag;
1313
+ break;
1314
+ }
1315
+ for (let i = index; i >= 0; i--) {
1316
+ const tags = groups[i].tags;
1317
+ if (tags.length) {
1318
+ previous = tags[tags.length - 1].tag;
1319
+ break;
1320
+ }
1321
+ }
1322
+ active = createDevTag(document, previous, {
1323
+ before,
1324
+ sourcemap,
1325
+ nonce: options.nonce,
1326
+ className: tagPrefix + "rules",
1327
+ top: options.top
1328
+ });
1329
+ group.tags.push(active);
1330
+ }
1331
+ if (fragmentTag !== active) {
1332
+ flushFragment();
1333
+ fragmentTag = active;
1334
+ fragment = document.createDocumentFragment();
1335
+ }
1336
+ insertDevRule(document, active, fragment, item.css, item.rule);
1337
+ touched.add(active);
1338
+ }
1339
+ flushFragment();
1340
+ queued.length = 0;
1341
+ if (!sourcemap) return;
1342
+ for (const tag of touched) tag.updateSourceMap();
1343
+ }
1344
+ };
1345
+ function getGroup(rule) {
1346
+ const layer = rule.layer ?? "style";
1347
+ const key = (layer === false || layer === "style" && !isStyleLayerEnabled() ? 2 : layer === "style" || typeof layer === "object" && layer.name === getStyleLayerName() ? 0 : 1) + ":" + getSheetRulePriority(rule.priority).join(",");
1348
+ const cached = groupLookup.get(key);
1349
+ if (cached) return cached;
1350
+ const group = {
1351
+ rule,
1352
+ tags: []
1353
+ };
1354
+ const index = groups.findIndex((existing) => compareSheetRules(rule, existing.rule) < 0);
1355
+ if (index < 0) groups.push(group);
1356
+ else groups.splice(index, 0, group);
1357
+ groupLookup.set(key, group);
1358
+ return group;
1359
+ }
1360
+ }
1361
+ //#endregion
1362
+ //#region sheet/dev/dev_sort.ts
1363
+ function createDevSortSheet(options = {}) {
1364
+ const document = resolveDocument(options.document);
1365
+ if (!document) return createNoopSheet();
1366
+ const maxRules = Math.max(options.maxRules ?? DEV_CONFIG.sheetMaxRules, 1);
1367
+ const sourcemap = options.sourcemap ?? DEV_CONFIG.isSourcemapEnabled;
1368
+ const inserted = /* @__PURE__ */ new Set();
1369
+ const queued = [];
1370
+ const groups = [];
1371
+ const groupLookup = /* @__PURE__ */ new Map();
1372
+ const shouldLayer = isStyleLayerEnabled();
1373
+ const layerName = getStyleLayerName();
1374
+ const tagPrefix = options.tagName ? options.tagName + " " : "";
1375
+ let layerTag = shouldLayer ? createStyleTag(document, tagPrefix + "layers", options.nonce) : null;
1376
+ let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
1377
+ let layerText = "";
1378
+ let hasSheetLayer = false;
1379
+ const namedLayers = /* @__PURE__ */ new Set();
1380
+ if (layerTag) if (options.top) insertStyleTagAtTop(document, layerTag);
1381
+ else insertStyleTagAfter(document, layerTag, null);
1382
+ return {
1383
+ updateLayers(layers) {
1384
+ activeLayers = layers;
1385
+ updateLayerText();
1386
+ },
1387
+ insert(rule) {
1388
+ const css = normalizeRule(rule);
1389
+ const ruleKey = typeof rule === "string" ? null : rule.key;
1390
+ if (ruleKey && inserted.has(ruleKey)) return;
1391
+ const key = typeof rule === "string" ? css : ruleKey;
1392
+ if (key && inserted.has(key)) return;
1393
+ if (key) inserted.add(key);
1394
+ const requestedLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
1395
+ const layer = requestedLayer === "style" && !shouldLayer ? false : requestedLayer;
1396
+ if (layer === "sheet" || typeof layer === "object") {
1397
+ if (layer === "sheet") hasSheetLayer = true;
1398
+ else namedLayers.add(layer.name);
1399
+ ensureLayerTag();
1400
+ updateLayerText();
1401
+ }
1402
+ queued.push({
1403
+ css,
1404
+ rule: typeof rule === "string" ? null : rule,
1405
+ priority: getSheetRulePriority(typeof rule === "string" ? null : rule.priority),
1406
+ layer
1407
+ });
1408
+ },
1409
+ flush() {
1410
+ if (!queued.length) return;
1411
+ const touched = /* @__PURE__ */ new Set();
1412
+ let fragment = null;
1413
+ let fragmentTag = null;
1414
+ const flushFragment = () => {
1415
+ if (!fragment || !fragmentTag) return;
1416
+ if (fragmentTag.insertBeforeNode && fragmentTag.insertBeforeNode.parentNode === fragmentTag.tag) fragmentTag.tag.insertBefore(fragment, fragmentTag.insertBeforeNode);
1417
+ else fragmentTag.tag.appendChild(fragment);
1418
+ fragment = null;
1419
+ fragmentTag = null;
1420
+ };
1421
+ queued.sort((a, b) => compareLayerPriority(a.priority, b.priority));
1422
+ for (let i = 0, len = queued.length; i < len; i++) {
1423
+ const item = queued[i];
1424
+ const group = ensureGroup(groups, groupLookup, item.priority, item.layer);
1425
+ let active = group.tags[group.tags.length - 1] ?? null;
1426
+ if (!active || active.count >= maxRules) {
1427
+ flushFragment();
1428
+ active = createGroupTag(document, groups, group, {
1429
+ previous: layerTag,
1430
+ className: tagPrefix + "rules " + group.key,
1431
+ top: options.top,
1432
+ layerName: typeof group.layer === "object" ? group.layer.name : group.layer === "style" ? layerName : group.layer === "sheet" ? getSheetLayerName() : null,
1433
+ sourcemap,
1434
+ nonce: options.nonce
1435
+ });
1436
+ }
1437
+ if (fragmentTag !== active) {
1438
+ flushFragment();
1439
+ fragmentTag = active;
1440
+ fragment = document.createDocumentFragment();
1441
+ }
1442
+ insertDevRule(document, active, fragment, item.css, item.rule);
1443
+ touched.add(active);
1444
+ }
1445
+ flushFragment();
1446
+ queued.length = 0;
1447
+ if (!sourcemap) return;
1448
+ for (const tag of touched) tag.updateSourceMap();
1449
+ }
1450
+ };
1451
+ function updateLayerText() {
1452
+ if (!layerTag) return;
1453
+ const names = [
1454
+ shouldLayer ? layerName : "",
1455
+ hasSheetLayer ? getSheetLayerName() : "",
1456
+ ...namedLayers
1457
+ ].filter(Boolean);
1458
+ const next = getLayerOrderCss(activeLayers, names);
1459
+ if (next === layerText) return;
1460
+ layerText = next;
1461
+ layerTag.textContent = next;
1462
+ }
1463
+ function ensureLayerTag() {
1464
+ if (layerTag) return;
1465
+ layerTag = createStyleTag(document, tagPrefix + "layers", options.nonce);
1466
+ if (options.top) insertStyleTagAtTop(document, layerTag);
1467
+ else insertStyleTagAfter(document, layerTag, null);
1468
+ }
1469
+ }
1470
+ function ensureGroup(groups, lookup, priority, layer) {
1471
+ const key = (typeof layer === "object" ? "named-" + layer.name + "-" : layer === "sheet" ? "sheet-" : "") + getPriorityKey(priority);
1472
+ const lookupKey = JSON.stringify([layer, priority]);
1473
+ const cached = lookup.get(lookupKey);
1474
+ if (cached) return cached;
1475
+ for (let i = 0, len = groups.length; i < len; i++) {
1476
+ const group = groups[i];
1477
+ const order = getLayerRank(layer) - getLayerRank(group.layer) || compareLayerPriority(priority, group.priority);
1478
+ if (order === 0 && key === group.key && layer === false === (group.layer === false)) {
1479
+ lookup.set(lookupKey, group);
1480
+ return group;
1481
+ }
1482
+ if (order < 0) {
1483
+ const next = {
1484
+ key,
1485
+ priority,
1486
+ tags: [],
1487
+ layer
1488
+ };
1489
+ groups.splice(i, 0, next);
1490
+ lookup.set(lookupKey, next);
1491
+ return next;
1492
+ }
1493
+ }
1494
+ const group = {
1495
+ key,
1496
+ priority,
1497
+ tags: [],
1498
+ layer
1499
+ };
1500
+ groups.push(group);
1501
+ lookup.set(lookupKey, group);
1502
+ return group;
1503
+ }
1504
+ function getLayerRank(layer) {
1505
+ return layer === "style" || typeof layer === "object" && layer.name === getStyleLayerName() ? 0 : layer === "sheet" || typeof layer === "object" ? 1 : 2;
1506
+ }
1507
+ function createGroupTag(document, groups, group, options) {
1508
+ const previous = getPreviousTag(groups, group, options.previous);
1509
+ const before = getNextTag(groups, group);
1510
+ const item = createDevTag(document, previous, {
1511
+ ...options,
1512
+ className: options.className,
1513
+ before: before?.tag ?? null,
1514
+ top: options.top,
1515
+ wrapper: options.layerName ? {
1516
+ before: "@layer " + options.layerName + " {\n",
1517
+ after: "}\n",
1518
+ sourceMapLineOffset: 1
1519
+ } : void 0
1520
+ });
1521
+ group.tags.push(item);
1522
+ return item;
1523
+ }
1524
+ function getPreviousTag(groups, group, fallback) {
1525
+ const index = groups.indexOf(group);
1526
+ for (let i = index; i >= 0; i--) {
1527
+ const tags = groups[i].tags;
1528
+ const tag = tags[tags.length - 1];
1529
+ if (tag) return tag.tag;
1530
+ }
1531
+ return fallback;
1532
+ }
1533
+ function getNextTag(groups, group) {
1534
+ const index = groups.indexOf(group);
1535
+ for (let i = index + 1, len = groups.length; i < len; i++) {
1536
+ const tag = groups[i].tags[0];
1537
+ if (tag) return tag;
1538
+ }
1539
+ return null;
1540
+ }
1541
+ function getPriorityKey(priority) {
1542
+ return "p-" + priority.join("-").replace(/^-/, "n");
1543
+ }
1544
+ //#endregion
1545
+ //#region sheet/dev/index.ts
1546
+ const DEV_SHEETS = globalData("sheet.dev.sheets", () => /* @__PURE__ */ new Set());
1547
+ function createDevSheet(options = {}) {
1548
+ return createOrderedSheet(createDevSheetBase, options, true);
1549
+ }
1550
+ function createDevSheetBase(options = {}) {
1551
+ let activeMode = DEV_CONFIG.stylePriorityMode;
1552
+ let active = createDevSheetForMode(activeMode, options);
1553
+ let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
1554
+ const rules = [];
1555
+ const inserted = /* @__PURE__ */ new Set();
1556
+ const state = { rebuild };
1557
+ DEV_SHEETS.add(state);
1558
+ return {
1559
+ updateLayers(layers) {
1560
+ activeLayers = layers;
1561
+ active.updateLayers(layers);
1562
+ },
1563
+ insert(rule) {
1564
+ const key = getStoredRuleKey(rule);
1565
+ if (key && inserted.has(key)) return;
1566
+ if (key) inserted.add(key);
1567
+ rules.push(rule);
1568
+ active.insert(rule);
1569
+ },
1570
+ replaceRules(owner, next) {
1571
+ const group = rules.find((rule) => typeof rule === "object" && "owner" in rule && rule.owner === owner);
1572
+ if (group && typeof group === "object" && "owner" in group) group.rules = next;
1573
+ else rules.push({
1574
+ owner,
1575
+ rules: next
1576
+ });
1577
+ rebuild();
1578
+ },
1579
+ flush() {
1580
+ ensureActiveMode();
1581
+ active.flush();
1582
+ },
1583
+ destroy() {
1584
+ DEV_SHEETS.delete(state);
1585
+ removeDevSheetTags(options.document, options.tagName);
1586
+ pruneDevSourcemapTags();
1587
+ }
1588
+ };
1589
+ function ensureActiveMode() {
1590
+ if (activeMode === DEV_CONFIG.stylePriorityMode) return;
1591
+ rebuild();
1592
+ }
1593
+ function rebuild() {
1594
+ activeMode = DEV_CONFIG.stylePriorityMode;
1595
+ removeDevSheetTags(options.document, options.tagName);
1596
+ active = createDevSheetForMode(activeMode, options);
1597
+ active.updateLayers(activeLayers);
1598
+ for (let i = 0, len = rules.length; i < len; i++) {
1599
+ const rule = rules[i];
1600
+ if (typeof rule === "object" && "owner" in rule) for (const item of rule.rules) active.insert(item);
1601
+ else active.insert(rule);
1602
+ }
1603
+ active.flush();
1604
+ }
1605
+ }
1606
+ function refreshDevStyleTags() {
1607
+ DEV_SHEETS.forEach((sheet) => sheet.rebuild());
1608
+ refreshOrderedSheets();
1609
+ }
1610
+ function createDevSheetForMode(mode, options) {
1611
+ return mode === "sort" ? createDevSortSheet(options) : createDevLayerSheet(options);
1612
+ }
1613
+ function getStoredRuleKey(rule) {
1614
+ return typeof rule === "string" ? rule : rule.key ?? rule.css;
1615
+ }
1616
+ function removeDevSheetTags(documentOverride, tagName) {
1617
+ const document = documentOverride === void 0 ? typeof globalThis.document === "undefined" ? null : globalThis.document : documentOverride;
1618
+ if (!document) return;
1619
+ const head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
1620
+ const nodes = Array.from(head.childNodes);
1621
+ for (let i = 0, len = nodes.length; i < len; i++) {
1622
+ const node = nodes[i];
1623
+ if (typeof node.getAttribute !== "function") continue;
1624
+ const sheetName = node.getAttribute("data-css-sheet");
1625
+ if (!sheetName) continue;
1626
+ if (!matchesDevSheetTag(sheetName, tagName)) continue;
1627
+ node.parentNode?.removeChild(node);
1628
+ }
1629
+ pruneDevSourcemapTags();
1630
+ }
1631
+ function matchesDevSheetTag(sheetName, tagName) {
1632
+ if (tagName) {
1633
+ if (sheetName === tagName) return true;
1634
+ if (!sheetName.startsWith(tagName + " ")) return false;
1635
+ sheetName = sheetName.slice(tagName.length + 1);
1636
+ }
1637
+ return sheetName === "layers" || sheetName === "rules" || sheetName.startsWith("rules ");
1638
+ }
1639
+ //#endregion
1640
+ //#region sheet/prod.ts
1641
+ function createProdSheet(options = {}) {
1642
+ return createOrderedSheet(createProdSheetBase, options, false);
1643
+ }
1644
+ function createProdSheetBase(options = {}) {
1645
+ const document = resolveDocument(options.document);
1646
+ if (!document) return createNoopSheet();
1647
+ const tagPrefix = options.tagName ? options.tagName + " " : "";
1648
+ const inserted = /* @__PURE__ */ new Set();
1649
+ const layerState = createSheetLayerState();
1650
+ let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
1651
+ let layerText = "";
1652
+ let layerTag = null;
1653
+ let ruleTag = null;
1654
+ let hasSheetLayer = false;
1655
+ const namedLayers = /* @__PURE__ */ new Set();
1656
+ return {
1657
+ updateLayers(layers) {
1658
+ activeLayers = layers;
1659
+ const next = getLayerOrderCss(layers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
1660
+ if (next === layerText) return;
1661
+ layerText = next;
1662
+ layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
1663
+ layerTag.textContent = next;
1664
+ },
1665
+ insert(rule) {
1666
+ const rawCss = normalizeRule(rule);
1667
+ const ruleKey = typeof rule === "string" ? null : rule.key;
1668
+ if (ruleKey && inserted.has(ruleKey)) return;
1669
+ const priority = typeof rule === "string" ? getSheetRuleLayerPriority(null, false) : getSheetRuleLayerPriority(rule.priority, rule.important);
1670
+ const ruleLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
1671
+ if (ruleLayer === "sheet") hasSheetLayer = true;
1672
+ if (typeof ruleLayer === "object") namedLayers.add(ruleLayer.name);
1673
+ const layerName = typeof ruleLayer === "object" ? ruleLayer.name : ruleLayer === "sheet" ? getSheetLayerName() : ruleLayer === false || !isStyleLayerEnabled() ? null : layerState.getName(priority);
1674
+ const nextLayerText = getLayerOrderCss(activeLayers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
1675
+ if (nextLayerText !== layerText) {
1676
+ layerText = nextLayerText;
1677
+ layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
1678
+ layerTag.textContent = nextLayerText;
1679
+ }
1680
+ const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
1681
+ const key = typeof rule === "string" ? css : ruleKey;
1682
+ if (key && inserted.has(key)) return;
1683
+ if (key) inserted.add(key);
1684
+ const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
1685
+ layerTag = activeLayerTag;
1686
+ if (!ruleTag) {
1687
+ ruleTag = createStyleTag(document, tagPrefix + "rules", options.nonce);
1688
+ insertStyleTagAfter(document, ruleTag, activeLayerTag);
1689
+ }
1690
+ insertRule(ruleTag, css);
1691
+ },
1692
+ flush() {},
1693
+ destroy() {
1694
+ layerTag?.parentNode?.removeChild(layerTag);
1695
+ ruleTag?.parentNode?.removeChild(ruleTag);
1696
+ inserted.clear();
1697
+ }
1698
+ };
1699
+ }
1700
+ function ensureLayerTag(document, tag, nonce, prefix = "") {
1701
+ if (tag) return tag;
1702
+ const next = createStyleTag(document, prefix + "layers", nonce);
1703
+ insertStyleTagAfter(document, next, null);
1704
+ return next;
1705
+ }
1706
+ function insertRule(tag, css) {
1707
+ const sheet = tag.sheet;
1708
+ if (sheet) try {
1709
+ sheet.insertRule(css, sheet.cssRules.length);
1710
+ return;
1711
+ } catch {}
1712
+ tag.appendChild(tag.ownerDocument.createTextNode(css));
1713
+ }
1714
+ //#endregion
1715
+ //#region sheet/sheet.ts
1716
+ function createStyleSheet(options = {}) {
1717
+ return options.dev ?? DEV_CONFIG.isDev ? createDevSheet(options) : createProdSheet(options);
1718
+ }
1719
+ //#endregion
1720
+ //#region runtime/sheet/element.ts
1721
+ function createElementMarkerRule(className, callsite) {
1722
+ return {
1723
+ key: `element-marker:${className}`,
1724
+ css: getElementMarkerRuleCss(className),
1725
+ callsite
1726
+ };
1727
+ }
1728
+ //#endregion
1729
+ //#region runtime/core/elementMarkerData.ts
1730
+ function splitElementMarkerStyleProp(styleProp) {
1731
+ if (isElementDebugData(styleProp)) return {
1732
+ debug: styleProp,
1733
+ styleProp: void 0
1734
+ };
1735
+ if (!Array.isArray(styleProp) || !isElementDebugData(styleProp[0])) return {
1736
+ debug: void 0,
1737
+ styleProp
1738
+ };
1739
+ return {
1740
+ debug: styleProp[0],
1741
+ styleProp: styleProp.length > 2 ? styleProp.slice(1) : styleProp[1]
1742
+ };
1743
+ }
1744
+ function isElementDebugData(value) {
1745
+ if (!value || typeof value !== "object") return false;
1746
+ return value.$$elementDebug === true;
1747
+ }
1748
+ //#endregion
1749
+ //#region runtime/core/elementMarker.ts
1750
+ const ELEMENT_MARKER_SHEET = globalData("runtime.elementMarkerSheet", () => ({ sheet: null }));
1751
+ function createElementMarkerClassName(debug) {
1752
+ if (!DEV_CONFIG.isDev || !DEV_CONFIG.isElementClassNameEnabled) return null;
1753
+ const marker = createElementMarkerRuleFromDebug(debug);
1754
+ if (!marker) return null;
1755
+ insertElementMarkerSheetRule(marker.rule);
1756
+ return marker.className;
1757
+ }
1758
+ function insertElementMarkerSheetRule(rule, documentOverride) {
1759
+ const document = getRuntimeDocument(documentOverride);
1760
+ if (!document) return;
1761
+ const className = getElementMarkerClassNameFromRule(rule);
1762
+ if (!className) return;
1763
+ const sheet = getElementMarkerSheet(document);
1764
+ sheet.classNames.add(className);
1765
+ sheet.sheet.insert(rule);
1766
+ sheet.sheet.flush();
1767
+ }
1768
+ function createElementMarkerRuleFromDebug(debug) {
1769
+ const callsite = getElementCallsite(debug);
1770
+ if (!callsite) return null;
1771
+ const className = getElementClassName(debug?.label, getElementCallsiteId(callsite), CSS_CONFIG.elementClassNameFormat || null);
1772
+ return {
1773
+ className,
1774
+ rule: createElementMarkerRule(className, callsite)
1775
+ };
1776
+ }
1777
+ function isElementMarkerRule(rule) {
1778
+ return typeof rule.key === "string" && rule.key.startsWith("element-marker:");
1779
+ }
1780
+ function getElementMarkerClassNameFromRule(rule) {
1781
+ if (!isElementMarkerRule(rule)) return null;
1782
+ return rule.key.slice(15) || null;
1783
+ }
1784
+ function getElementMarkerSheet(document) {
1785
+ const current = ELEMENT_MARKER_SHEET.sheet;
1786
+ if (current?.document === document) return current;
1787
+ current?.sheet.destroy?.();
1788
+ const sheet = {
1789
+ document,
1790
+ sheet: createDevSheet({
1791
+ document,
1792
+ tagName: "element-marker",
1793
+ top: true
1794
+ }),
1795
+ classNames: /* @__PURE__ */ new Set()
1796
+ };
1797
+ ELEMENT_MARKER_SHEET.sheet = sheet;
1798
+ return sheet;
1799
+ }
1800
+ function clearElementMarkers(documentOverride) {
1801
+ const sheet = ELEMENT_MARKER_SHEET.sheet;
1802
+ const document = documentOverride ?? sheet?.document ?? (typeof globalThis.document === "undefined" ? null : globalThis.document);
1803
+ if (!sheet) {
1804
+ removeElementMarkerTags(document);
1805
+ return;
1806
+ }
1807
+ stripElementMarkerClasses(document, sheet.classNames);
1808
+ sheet.sheet.destroy?.();
1809
+ sheet.classNames.clear();
1810
+ ELEMENT_MARKER_SHEET.sheet = null;
1811
+ }
1812
+ onRuntimeDocumentChange(() => {
1813
+ ELEMENT_MARKER_SHEET.sheet?.sheet.destroy?.();
1814
+ ELEMENT_MARKER_SHEET.sheet = null;
1815
+ });
1816
+ function removeElementMarkerTags(document) {
1817
+ if (!document) return;
1818
+ const head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
1819
+ const nodes = Array.from(head.childNodes);
1820
+ for (let i = 0, len = nodes.length; i < len; i++) {
1821
+ const node = nodes[i];
1822
+ if (typeof node.getAttribute !== "function") continue;
1823
+ const sheetName = node.getAttribute("data-css-sheet");
1824
+ if (sheetName !== "element-marker" && !sheetName?.startsWith("element-marker ")) continue;
1825
+ node.parentNode?.removeChild(node);
1826
+ }
1827
+ }
1828
+ function stripElementMarkerClasses(document, classNames) {
1829
+ if (!document || !classNames.size) return;
1830
+ if (typeof document.querySelectorAll !== "function") return;
1831
+ const nodes = document.querySelectorAll("[class]");
1832
+ for (let i = 0, len = nodes.length; i < len; i++) stripElementClassNames(nodes[i], classNames);
1833
+ }
1834
+ function stripElementClassNames(element, classNames) {
1835
+ if (element.classList) {
1836
+ classNames.forEach((className) => element.classList.remove(className));
1837
+ return;
1838
+ }
1839
+ const value = element.getAttribute("class");
1840
+ if (!value) return;
1841
+ const next = value.split(/\s+/).filter((className) => !classNames.has(className)).join(" ");
1842
+ if (next) element.setAttribute("class", next);
1843
+ else element.removeAttribute("class");
1844
+ }
1845
+ function getElementCallsite(debug) {
1846
+ if (debug) return {
1847
+ filePath: debug.sourceUrl,
1848
+ sourceUrl: debug.sourceUrl,
1849
+ sourceContent: debug.code,
1850
+ line: debug.loc[0],
1851
+ column: debug.loc[1]
1852
+ };
1853
+ return null;
1854
+ }
1855
+ function getElementCallsiteId(callsite) {
1856
+ return `${callsite.filePath}\n${callsite.line}:${callsite.column}`;
1857
+ }
1858
+ //#endregion
1859
+ //#region builder/data/const.ts
1860
+ const BUILDER_TYPE = symbol("builder.type");
1861
+ const BUILDER_STATE = symbol("builder.state");
1862
+ const BUILDER_CALLSITE = symbol("builder.callsite");
1863
+ const BUILDER_SLOT_ID = symbol("builder.slotId");
1864
+ const BUILDER_SCOPE_ID = symbol("builder.scopeId");
1865
+ const BUILDER_SCOPE = symbol("builder.scope");
1866
+ const BUILDER_SELECTOR = symbol("builder.selector");
1867
+ const BUILDER_SHEET_OPTIONS = symbol("builder.sheetOptions");
1868
+ const GLOBAL_SHEET_SELECTOR_ANCHOR = "\0global";
1869
+ const SHEET_SELECTOR_ANCHOR = "\0sheet";
1870
+ //#endregion
1871
+ //#region builder/data/is.ts
1872
+ function getSlotId(data) {
1873
+ return data[BUILDER_SLOT_ID];
1874
+ }
1875
+ function getScopeTargetSlotId(data) {
1876
+ return data[BUILDER_SCOPE_ID];
1877
+ }
1878
+ function getScopeTargetScope(data) {
1879
+ return data[BUILDER_SCOPE];
1880
+ }
1881
+ function getSelectorSelectors(data) {
1882
+ return data[BUILDER_SELECTOR];
1883
+ }
1884
+ function isStyleData(value) {
1885
+ return getBuilderType(value) === 1;
1886
+ }
1887
+ function isSlotData(value) {
1888
+ return getBuilderType(value) === 2;
1889
+ }
1890
+ function isSlotOverrideData(value) {
1891
+ return getBuilderType(value) === 3;
1892
+ }
1893
+ function isSelectorData(value) {
1894
+ return getBuilderType(value) === 7;
1895
+ }
1896
+ function isSelectorOverrideData(value) {
1897
+ return getBuilderType(value) === 8;
1898
+ }
1899
+ function isSheetData(value) {
1900
+ return getBuilderType(value) === 9;
1901
+ }
1902
+ function isScopeData(value) {
1903
+ return getBuilderType(value) === 4;
1904
+ }
1905
+ function isScopeTargetData(value) {
1906
+ return getBuilderType(value) === 5;
1907
+ }
1908
+ function isThemeData(value) {
1909
+ return getBuilderType(value) === 6;
1910
+ }
1911
+ function getBuilderType(value) {
1912
+ if (!value || typeof value !== "object" && typeof value !== "function") return null;
1913
+ return value[BUILDER_TYPE];
1914
+ }
1915
+ //#endregion
1916
+ //#region builder/extract/withTokens.ts
1917
+ const tokenBoundData = /* @__PURE__ */ new WeakMap();
1918
+ function isExtractedTokenBoundData(value) {
1919
+ return !!value && (typeof value === "object" || typeof value === "function") && tokenBoundData.has(value);
1920
+ }
1921
+ function getExtractedTokenBoundData(value) {
1922
+ return tokenBoundData.get(value);
1923
+ }
1924
+ //#endregion
1925
+ //#region builder/token/symbols.ts
1926
+ const TOKEN_ID = symbol("style:token");
1927
+ const TOKEN_OVERRIDE = symbol("style:token.override");
1928
+ const TOKEN_NAME = symbol("style:token.name");
1929
+ const TOKEN_VAR_NAME = symbol("style:token.varName");
1930
+ //#endregion
1931
+ //#region builder/token/data.ts
1932
+ function isStyleTokenData(value) {
1933
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] !== true;
1934
+ }
1935
+ function isStyleTokenOverrideData(value) {
1936
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] === true;
1937
+ }
1938
+ function getStyleTokenId(token) {
1939
+ return token[TOKEN_ID];
1940
+ }
1941
+ function getStyleTokenName(token) {
1942
+ return token[TOKEN_NAME] ?? null;
1943
+ }
1944
+ function getStyleTokenVarName(token) {
1945
+ return token[TOKEN_VAR_NAME] ?? null;
1946
+ }
1947
+ //#endregion
1948
+ //#region builder/token/name.ts
1949
+ function getStyleTokenNameFromId(id) {
1950
+ if (!id) return null;
1951
+ const parts = id.split("--");
1952
+ const first = normalizeStyleTokenName(parts[0]);
1953
+ if (!first) return parts.length > 1 ? normalizeStyleTokenName(parts.slice(1).join("--")) : null;
1954
+ return normalizeStyleTokenName([first, ...parts.slice(1)].join("--"));
1955
+ }
1956
+ function getChildStyleTokenName(name, child) {
1957
+ const childName = normalizeStyleTokenName(child);
1958
+ if (!childName) return normalizeStyleTokenName(name);
1959
+ const parentName = normalizeStyleTokenName(name);
1960
+ return parentName ? parentName + "--" + childName : childName;
1961
+ }
1962
+ function normalizeStyleTokenName(value) {
1963
+ if (!value) return null;
1964
+ value = value.trim();
1965
+ if (!value) return null;
1966
+ if (/^\d+$/.test(value)) return null;
1967
+ if (isGeneratedTokenHash(value)) return null;
1968
+ value = stripGenericTokenPrefix(value);
1969
+ if (!value) return null;
1970
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
1971
+ if (stableSuffix?.[1] && isGeneratedTokenHash(value.slice(-7))) return normalizeStyleTokenName(stableSuffix[1]);
1972
+ return value;
1973
+ }
1974
+ function isGeneratedTokenHash(value) {
1975
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
1976
+ }
1977
+ function stripGenericTokenPrefix(value) {
1978
+ const parts = value.split("--");
1979
+ while (parts[0] === "token" || parts[0] === "tokens") parts.shift();
1980
+ return parts.join("--");
1981
+ }
1982
+ //#endregion
1983
+ //#region style/token.ts
1984
+ const TOKEN_DEBUG = symbol("style:token.debug");
1985
+ const idCounter = globalData("style.token.idCounter", () => ({ value: 0 }));
1986
+ function resetStyleTokenIdCounter() {
1987
+ idCounter.value = 0;
1988
+ }
1989
+ function createStyleToken(value, stableId, debugName) {
1990
+ const token = (value, debug) => {
1991
+ return createStyleTokenOverride(token, value, debug);
1992
+ };
1993
+ token[TOKEN_ID] = stableId || String(idCounter.value++);
1994
+ token[TOKEN_NAME] = debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName);
1995
+ if (isStyleTokenData(value)) {
1996
+ token.value = value.value;
1997
+ token.ref = value;
1998
+ } else {
1999
+ token.value = value;
2000
+ token.ref = null;
2001
+ }
2002
+ return token;
2003
+ }
2004
+ function createStyleTokenOverride(token, value, debug) {
2005
+ const override = isStyleTokenData(value) ? {
2006
+ [TOKEN_ID]: getStyleTokenId(token),
2007
+ [TOKEN_OVERRIDE]: true,
2008
+ [TOKEN_NAME]: getStyleTokenName(token),
2009
+ [TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
2010
+ value: value.value,
2011
+ ref: value
2012
+ } : {
2013
+ [TOKEN_ID]: getStyleTokenId(token),
2014
+ [TOKEN_OVERRIDE]: true,
2015
+ [TOKEN_NAME]: getStyleTokenName(token),
2016
+ [TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
2017
+ value,
2018
+ ref: null
2019
+ };
2020
+ if (debug) Object.defineProperty(override, TOKEN_DEBUG, {
2021
+ configurable: true,
2022
+ enumerable: false,
2023
+ value: debug
2024
+ });
2025
+ return override;
2026
+ }
2027
+ function getStyleTokenOverrideDebug(token) {
2028
+ return token[TOKEN_DEBUG] ?? null;
2029
+ }
2030
+ //#endregion
2031
+ //#region runtime/core/combinedStyle.ts
2032
+ const targets = globalData("runtime.combinedStyle.targets", () => /* @__PURE__ */ new WeakMap());
2033
+ function createCombinedStyle(meta, getField) {
2034
+ const target = {
2035
+ ...meta,
2036
+ cache: Object.create(null),
2037
+ getField
2038
+ };
2039
+ const proxyTarget = {};
2040
+ const proxy = new Proxy(proxyTarget, handlers);
2041
+ targets.set(proxyTarget, target);
2042
+ targets.set(proxy, target);
2043
+ return proxy;
2044
+ }
2045
+ function isCombinedStyle(value) {
2046
+ return !!value && typeof value === "object" && targets.has(value);
2047
+ }
2048
+ function getCombinedStyleStyles(style) {
2049
+ return getTarget(style).styles;
2050
+ }
2051
+ function getCombinedStyleScopes(style) {
2052
+ return getTarget(style).scopes;
2053
+ }
2054
+ function getCombinedStyleTokens(style) {
2055
+ return getTarget(style).tokens;
2056
+ }
2057
+ const handlers = { get(proxy, prop) {
2058
+ const target = getTarget(proxy);
2059
+ if (hasOwn(target.cache, prop)) return target.cache[prop];
2060
+ const value = target.getField(target, prop);
2061
+ if (value && typeof value === "object") target.cache[prop] = value;
2062
+ return value;
2063
+ } };
2064
+ function getTarget(value) {
2065
+ const target = targets.get(value);
2066
+ if (!target) throw new Error("[fluentic-style] Expected combined style.");
2067
+ return target;
2068
+ }
2069
+ //#endregion
2070
+ //#region runtime/core/cache/resolvedItem.ts
2071
+ const resolvedStyleItems = globalData("runtime.resolvedStyleItems", () => /* @__PURE__ */ new WeakSet());
2072
+ const resolvedStyleItemTokenValues = globalData("runtime.styleItemTokenValues", () => /* @__PURE__ */ new WeakMap());
2073
+ function markResolvedStyleItem(item) {
2074
+ resolvedStyleItems.add(item);
2075
+ }
2076
+ function isResolvedStyleItem$1(value) {
2077
+ return !!value && typeof value === "object" && resolvedStyleItems.has(value);
2078
+ }
2079
+ function setResolvedStyleItemTokenValues(item, tokens) {
2080
+ resolvedStyleItemTokenValues.set(item, tokens);
2081
+ }
2082
+ function getResolvedStyleItemTokenValues(item) {
2083
+ return resolvedStyleItemTokenValues.get(item) ?? null;
2084
+ }
2085
+ //#endregion
2086
+ //#region runtime/core/cache/tokenValues.ts
2087
+ function createMutableTokenValues(base) {
2088
+ return {
2089
+ ids: base ? base.ids.slice() : null,
2090
+ values: base ? base.values.slice() : null,
2091
+ lookup: base ? { ...base.lookup } : null,
2092
+ index: base ? createTokenIndexLookup(base.ids) : null
2093
+ };
2094
+ }
2095
+ function addTokenOverride(values, item, resolver) {
2096
+ if (!resolver.is(item)) return false;
2097
+ addTokenValue(values, resolver.id(item), resolver.value(item));
2098
+ return true;
2099
+ }
2100
+ function addTokenValue(values, id, value) {
2101
+ if (!values.ids) values.ids = [];
2102
+ if (!values.values) values.values = [];
2103
+ if (!values.lookup) values.lookup = Object.create(null);
2104
+ if (!values.index) values.index = Object.create(null);
2105
+ const ids = values.ids;
2106
+ const tokenValues = values.values;
2107
+ const lookup = values.lookup;
2108
+ const indexLookup = values.index;
2109
+ const index = indexLookup[id];
2110
+ if (index === void 0) {
2111
+ indexLookup[id] = ids.push(id) - 1;
2112
+ tokenValues.push(value);
2113
+ } else tokenValues[index] = value;
2114
+ lookup[id] = value;
2115
+ }
2116
+ function addTokenValues(values, next) {
2117
+ if (!next) return;
2118
+ for (let i = 0, len = next.ids.length; i < len; i++) addTokenValue(values, next.ids[i], next.values[i]);
2119
+ }
2120
+ function addTokenOverrides(values, overrides, resolver) {
2121
+ for (let i = 0, len = overrides.length; i < len; i++) addTokenOverride(values, overrides[i], resolver);
2122
+ }
2123
+ function finishTokenValues(base, values) {
2124
+ if (!values.ids || !values.values || !values.lookup) return null;
2125
+ if (isSameTokenValues(base, values.ids, values.values)) return base;
2126
+ return {
2127
+ ids: values.ids,
2128
+ values: values.values,
2129
+ lookup: values.lookup
2130
+ };
2131
+ }
2132
+ function mergeTokenValues(base, next) {
2133
+ if (!next) return base;
2134
+ if (!base) return next;
2135
+ const values = createMutableTokenValues(base);
2136
+ addTokenValues(values, next);
2137
+ return finishTokenValues(base, values);
2138
+ }
2139
+ function mergeTokenOverrides(base, overrides, resolver) {
2140
+ if (!overrides.length) return base;
2141
+ const values = createMutableTokenValues(base);
2142
+ addTokenOverrides(values, overrides, resolver);
2143
+ return finishTokenValues(base, values);
2144
+ }
2145
+ function createTokenIndexLookup(ids) {
2146
+ const lookup = Object.create(null);
2147
+ for (let i = 0, len = ids.length; i < len; i++) lookup[ids[i]] = i;
2148
+ return lookup;
2149
+ }
2150
+ function isSameTokenValues(base, ids, values) {
2151
+ if (!base || base.ids.length !== ids.length) return false;
2152
+ const baseLookup = base.lookup;
2153
+ for (let i = 0, len = ids.length; i < len; i++) {
2154
+ if (!hasOwn(baseLookup, ids[i])) return false;
2155
+ if (baseLookup[ids[i]] !== values[i]) return false;
2156
+ }
2157
+ return true;
2158
+ }
2159
+ globalData("runtime.directStyleItemCache", () => /* @__PURE__ */ new WeakMap());
2160
+ function isResolvedStyleItem(value) {
2161
+ return isResolvedStyleItem$1(value);
2162
+ }
2163
+ function createResolvedStyleItem(data, scopes, tokens = null) {
2164
+ return createStyleItem({
2165
+ data,
2166
+ items: resolveItems(data, scopes)
2167
+ }, tokens);
2168
+ }
2169
+ function createResolvedStyleItemFromItems(item, tokens) {
2170
+ return createStyleItem({
2171
+ data: item.data,
2172
+ items: item.items
2173
+ }, tokens);
2174
+ }
2175
+ function getStyleTokenValues(value) {
2176
+ if (isCombinedStyle(value)) return getCombinedStyleTokens(value);
2177
+ return getResolvedStyleItemTokenValues(value);
2178
+ }
2179
+ function createCombinedStyleFacade(styles, scopes) {
2180
+ return createCombinedStyle({
2181
+ styles,
2182
+ scopes,
2183
+ tokens: null
2184
+ }, getStyleField);
2185
+ }
2186
+ function createCombinedStyleTokenWrapper(style, tokens) {
2187
+ return createCombinedStyle({
2188
+ styles: getCombinedStyleStyles(style),
2189
+ scopes: getCombinedStyleScopes(style),
2190
+ tokens
2191
+ }, getTokenField(style));
2192
+ }
2193
+ const getStyleField = (meta, prop) => {
2194
+ const value = meta.styles?.[prop] ?? null;
2195
+ if (isStyleData(value) || isSheetData(value) || isSlotData(value)) return createResolvedStyleItem(value, meta.scopes);
2196
+ if (isSelectorData(value)) return value;
2197
+ if (value && typeof value === "object") return createCombinedStyleFacade(value, meta.scopes);
2198
+ return value;
2199
+ };
2200
+ function getTokenField(base) {
2201
+ return (meta, prop) => {
2202
+ const value = base?.[prop] ?? null;
2203
+ if (isResolvedStyleItem(value)) {
2204
+ const tokens = mergeTokenValues(getStyleTokenValues(value), meta.tokens);
2205
+ return createStyleItem({
2206
+ data: value.data,
2207
+ items: value.items
2208
+ }, tokens);
2209
+ }
2210
+ if (isCombinedStyle(value)) return createCombinedStyleTokenWrapper(value, meta.tokens);
2211
+ return value;
2212
+ };
2213
+ }
2214
+ function createStyleItem(item, tokens = null) {
2215
+ markResolvedStyleItem(item);
2216
+ if (tokens) setResolvedStyleItemTokenValues(item, tokens);
2217
+ return item;
2218
+ }
2219
+ function resolveItems(data, scopes) {
2220
+ const items = [];
2221
+ const stateItems = data[BUILDER_STATE]?.items ?? [];
2222
+ const slotId = isSlotData(data) ? getSlotId(data) : null;
2223
+ for (let i = 0, len = stateItems.length; i < len; i++) {
2224
+ const item = stateItems[i];
2225
+ if (Array.isArray(item)) {
2226
+ items.push(item);
2227
+ continue;
2228
+ }
2229
+ if (isStyleTokenOverrideData(item)) {
2230
+ items.push(item);
2231
+ continue;
2232
+ }
2233
+ if (slotId && item.type !== 2) continue;
2234
+ items.push(item);
2235
+ }
2236
+ if (!slotId || isSheetData(data)) return items;
2237
+ for (let i = 0, len = scopes.length; i < len; i++) {
2238
+ const boundScope = scopes[i];
2239
+ const scope = getScopeTargetScope(boundScope);
2240
+ if (!scope) continue;
2241
+ const scopeItems = scope[BUILDER_STATE]?.items;
2242
+ if (!scopeItems) continue;
2243
+ const targetSlotId = getScopeTargetSlotId(boundScope);
2244
+ for (let j = 0, len = scopeItems.length; j < len; j++) {
2245
+ const item = scopeItems[j];
2246
+ if (Array.isArray(item)) {
2247
+ if (item[1] === slotId) items.push(item);
2248
+ const hasParentSelector = isExtractedScopeParentMarker$1(item[4]) || isExtractedScopeParentMarker$1(item[5]);
2249
+ if (targetSlotId === slotId && hasParentSelector) items.push(getScopeParentItem(String(item[3])));
2250
+ continue;
2251
+ }
2252
+ if (isStyleTokenOverrideData(item)) continue;
2253
+ if (item.type !== 4) continue;
2254
+ if (item.slotId === slotId) items.push(item);
2255
+ if (item.parentSelector && targetSlotId === slotId) items.push(getScopeParentItem(item.className));
2256
+ }
2257
+ }
2258
+ return items;
2259
+ }
2260
+ function getScopeParentItem(className) {
2261
+ const parentClassName = formatScopeClassName$1(className);
2262
+ return [parentClassName, parentClassName];
2263
+ }
2264
+ function formatScopeClassName$1(className) {
2265
+ const format = CSS_CONFIG.scopeClassNameFormat;
2266
+ if (!format) return "-" + className;
2267
+ if (typeof format === "function") return format({ className });
2268
+ return format.replace(/\[|\]/g, "").replace(/\(className\)/g, className);
2269
+ }
2270
+ function isExtractedScopeParentMarker$1(value) {
2271
+ return value === 1 || value === true;
2272
+ }
2273
+ //#endregion
2274
+ //#region runtime/core/cache/itemWithResolver.ts
2275
+ function createResolvedStyleItemWithResolver(data, tokens, resolver) {
2276
+ return createResolvedStyleItem(data, [], mergeTokenValues(getDataTokenValues(data, resolver), tokens));
2277
+ }
2278
+ function getDirectStyleItemWithResolver(item, resolver) {
2279
+ return createResolvedStyleItemWithResolver(item, null, resolver);
2280
+ }
2281
+ function getDataTokenValues(data, resolver) {
2282
+ const stateItems = data[BUILDER_STATE]?.items ?? [];
2283
+ const values = createMutableTokenValues(null);
2284
+ for (let i = 0, len = stateItems.length; i < len; i++) addTokenOverride(values, stateItems[i], resolver);
2285
+ return finishTokenValues(null, values);
2286
+ }
2287
+ //#endregion
2288
+ //#region runtime/core/cache/utils/tree.ts
2289
+ function createCacheTreeNode(value) {
2290
+ return {
2291
+ children: /* @__PURE__ */ new Map(),
2292
+ value
2293
+ };
2294
+ }
2295
+ function getCacheTreeChild(node, key, createValue) {
2296
+ let child = node.children.get(key);
2297
+ if (!child) {
2298
+ child = createCacheTreeNode(createValue());
2299
+ node.children.set(key, child);
2300
+ }
2301
+ return child;
2302
+ }
2303
+ function createWeakCacheTreeNode(value) {
2304
+ return {
2305
+ children: /* @__PURE__ */ new WeakMap(),
2306
+ value
2307
+ };
2308
+ }
2309
+ function getWeakCacheTreeChild(node, key, createValue) {
2310
+ let child = node.children.get(key);
2311
+ if (!child) {
2312
+ child = createWeakCacheTreeNode(createValue());
2313
+ node.children.set(key, child);
2314
+ }
2315
+ return child;
2316
+ }
2317
+ //#endregion
2318
+ //#region runtime/core/cache/propCache.ts
2319
+ const root = createWeakCacheTreeNode(createCacheValue());
2320
+ function getStylePropCacheValue(styleProp, walk, onUnsupported) {
2321
+ let node = root;
2322
+ let hasItem = false;
2323
+ let canCache = true;
2324
+ walk(styleProp, (item) => {
2325
+ hasItem = true;
2326
+ node = getWeakCacheTreeChild(node, item, createCacheValue);
2327
+ }, () => {
2328
+ canCache = false;
2329
+ onUnsupported?.();
2330
+ });
2331
+ if (!hasItem || !canCache) return null;
2332
+ const value = node.value;
2333
+ if (value.c !== RUNTIME_CONFIG.changes) {
2334
+ value.d = null;
2335
+ value.c = RUNTIME_CONFIG.changes;
2336
+ }
2337
+ return value;
2338
+ }
2339
+ function createCacheValue() {
2340
+ return {
2341
+ d: null,
2342
+ c: RUNTIME_CONFIG.changes
2343
+ };
2344
+ }
2345
+ //#endregion
2346
+ //#region atomic/utils/cssVar.ts
2347
+ function getCssVar(varName, value) {
2348
+ return "var(" + varName + ", " + escapeCssValue(value) + ")";
2349
+ }
2350
+ function getCssVarRawFallback(varName, fallbackCss) {
2351
+ return "var(" + varName + ", " + fallbackCss + ")";
2352
+ }
2353
+ function escapeCssValue(value) {
2354
+ if (!value) return "";
2355
+ return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
2356
+ }
2357
+ const formatTokenName = createNameFormatter(["name"]);
2358
+ function getTokenVarName(token, format) {
2359
+ const explicitName = getStyleTokenVarName(token);
2360
+ if (explicitName) return explicitName;
2361
+ const id = getStyleTokenId(token);
2362
+ const debugName = getStyleTokenName(token);
2363
+ return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: debugName });
2364
+ }
2365
+ function getTokenVar(token, format) {
2366
+ return getTokenVarFallback(token, format);
2367
+ }
2368
+ function getTokenOverrideValue(token, format) {
2369
+ return token.ref ? getTokenVar(token.ref, format) : token.value;
2370
+ }
2371
+ function getTokenVarFallback(token, tokenNameFormat) {
2372
+ const varName = getTokenVarName(token, tokenNameFormat);
2373
+ if (token.ref) return getCssVarRawFallback(varName, getTokenVarFallback(token.ref, tokenNameFormat));
2374
+ return getCssVar(varName, String(token.value ?? ""));
2375
+ }
2376
+ //#endregion
2377
+ //#region runtime/core/cache/stateItem.ts
2378
+ function getStateItemDedupe(item) {
2379
+ if (Array.isArray(item)) {
2380
+ if (typeof item[0] === "number") switch (item[0]) {
2381
+ case 1:
2382
+ case 9: return item[1];
2383
+ case 2:
2384
+ case 3:
2385
+ case 4: return item[2];
2386
+ }
2387
+ else if (typeof item[1] === "string") return item[1];
2388
+ return "";
2389
+ }
2390
+ if (isStyleTokenOverrideData(item)) return "";
2391
+ return item.dedupe;
2392
+ }
2393
+ function getStateItemClassName(item) {
2394
+ if (Array.isArray(item)) {
2395
+ if (typeof item[0] === "number") switch (item[0]) {
2396
+ case 1:
2397
+ case 9: return item[2];
2398
+ case 2:
2399
+ case 3:
2400
+ case 4: return item[3];
2401
+ }
2402
+ else return item[1];
2403
+ return "";
2404
+ }
2405
+ if (isStyleTokenOverrideData(item)) return "";
2406
+ return item.className;
2407
+ }
2408
+ function getStateItemVariableValue(item, tokens) {
2409
+ if (isStyleTokenOverrideData(item)) {
2410
+ const id = getStyleTokenId(item);
2411
+ return [getTokenVarName(item, CSS_CONFIG.tokenNameFormat ?? null), tokens && hasOwn(tokens.lookup, id) ? tokens.lookup[id] : getTokenOverrideValue(item, CSS_CONFIG.tokenNameFormat ?? null)];
2412
+ }
2413
+ const value = getStateItemValue(item);
2414
+ if (Array.isArray(value) && value[0] === 1) {
2415
+ if (isStyleTokenData(value[2]) && value[1] === getTokenVarName(value[2], CSS_CONFIG.tokenNameFormat ?? null)) {
2416
+ if (!tokens || !hasOwn(tokens.lookup, getStyleTokenId(value[2]))) return null;
2417
+ }
2418
+ return [value[1], resolveMarkedVariableValue(value[2], value[3], tokens)];
2419
+ }
2420
+ if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.variable?.[0] === 1) return [item.variable[1], resolveMarkedVariableValue(item.variable[2], item.variable[3], tokens)];
2421
+ if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.token) {
2422
+ if (!tokens) return null;
2423
+ const id = getStyleTokenId(item.token);
2424
+ if (!hasOwn(tokens.lookup, id)) return null;
2425
+ return [getTokenVarName(item.token, CSS_CONFIG.tokenNameFormat ?? null), tokens.lookup[id]];
2426
+ }
2427
+ return null;
2428
+ }
2429
+ function resolveMarkedVariableValue(value, valueMode, tokens) {
2430
+ return normalizeVariableValue(resolveVariableValue(value, tokens), valueMode);
2431
+ }
2432
+ function normalizeVariableValue(value, valueMode) {
2433
+ if (typeof value !== "number") return value;
2434
+ return valueMode === 1 ? value + "px" : String(value);
2435
+ }
2436
+ function getStateItemAtRuleRef(item) {
2437
+ const value = getStateItemValue(item);
2438
+ if (Array.isArray(value) && value[0] === 3) return value[1];
2439
+ if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.variable?.[0] === 3) return item.variable[1];
2440
+ return null;
2441
+ }
2442
+ function getStateItemAtRuleRefVariables(item, tokens) {
2443
+ if (!tokens) return null;
2444
+ const refTokens = getStateItemAtRuleRef(item)?.tokens;
2445
+ if (!refTokens?.length) return null;
2446
+ const values = [];
2447
+ for (let i = 0, len = refTokens.length; i < len; i++) {
2448
+ const token = refTokens[i];
2449
+ const id = getStyleTokenId(token);
2450
+ if (!hasOwn(tokens.lookup, id)) continue;
2451
+ values.push([getTokenVarName(token, CSS_CONFIG.tokenNameFormat ?? null), tokens.lookup[id]]);
2452
+ }
2453
+ return values.length ? values : null;
2454
+ }
2455
+ function getStateItemValue(item) {
2456
+ if (Array.isArray(item)) if (typeof item[0] === "number") switch (item[0]) {
2457
+ case 1:
2458
+ case 9: return item[3];
2459
+ case 2:
2460
+ case 3: return item[4];
2461
+ case 4: return isExtractedScopeParentMarker(item[4]) ? void 0 : item[4];
2462
+ }
2463
+ else return item[2];
2464
+ }
2465
+ function isExtractedScopeParentMarker(value) {
2466
+ return value === 1 || value === true;
2467
+ }
2468
+ function resolveVariableValue(value, tokens) {
2469
+ if (isStyleTokenData(value)) return resolveTokenValue(value, tokens);
2470
+ return value;
2471
+ }
2472
+ function resolveTokenValue(token, tokens) {
2473
+ if (tokens) {
2474
+ const id = getStyleTokenId(token);
2475
+ if (hasOwn(tokens.lookup, id)) return tokens.lookup[id];
2476
+ }
2477
+ return getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null);
2478
+ }
2479
+ //#endregion
2480
+ //#region runtime/core/cache/result.ts
2481
+ const emptyStylePropResult = {
2482
+ className: "",
2483
+ style: void 0
2484
+ };
2485
+ let runId = 0;
2486
+ const dedupeRun = Object.create(null);
2487
+ const dedupeIndex = Object.create(null);
2488
+ function createStylePropResult(items, getThemeClassName) {
2489
+ runId++;
2490
+ const classNames = [];
2491
+ let style;
2492
+ for (let i = 0, len = items.length; i < len; i++) {
2493
+ const item = items[i];
2494
+ if (!isResolvedStyleItem(item)) {
2495
+ const themeClassName = getThemeClassName(item);
2496
+ if (themeClassName) classNames.push(themeClassName);
2497
+ continue;
2498
+ }
2499
+ const tokens = getStyleTokenValues(item);
2500
+ const stateItems = item.items;
2501
+ for (let j = 0, itemLen = stateItems.length; j < itemLen; j++) style = addItem(classNames, style, stateItems[j], tokens);
2502
+ }
2503
+ if (!classNames.length && !style) return emptyStylePropResult;
2504
+ return {
2505
+ className: classNames.join(" "),
2506
+ style
2507
+ };
2508
+ }
2509
+ function addItem(classNames, style, item, tokens) {
2510
+ const dedupe = getStateItemDedupe(item);
2511
+ const className = getStateItemClassName(item);
2512
+ if (!dedupe || !className) return addItemStyle(style, item, tokens);
2513
+ if (dedupeRun[dedupe] === runId) {
2514
+ classNames[dedupeIndex[dedupe]] = className;
2515
+ return addItemStyle(style, item, tokens);
2516
+ }
2517
+ dedupeRun[dedupe] = runId;
2518
+ dedupeIndex[dedupe] = classNames.push(className) - 1;
2519
+ return addItemStyle(style, item, tokens);
2520
+ }
2521
+ function addItemStyle(style, item, tokens) {
2522
+ const variableValue = getStateItemVariableValue(item, tokens);
2523
+ if (variableValue) style = setStyleValue(style, variableValue[0], variableValue[1]);
2524
+ const refValues = getStateItemAtRuleRefVariables(item, tokens);
2525
+ if (!refValues) return style;
2526
+ for (let i = 0, len = refValues.length; i < len; i++) style = setStyleValue(style, refValues[i][0], refValues[i][1]);
2527
+ return style;
2528
+ }
2529
+ function setStyleValue(style, name, value) {
2530
+ const next = style ?? {};
2531
+ next[name] = value;
2532
+ return next;
2533
+ }
2534
+ //#endregion
2535
+ //#region runtime/core/cache/token.ts
2536
+ const runtimeTokenValueResolver = {
2537
+ get key() {
2538
+ return CSS_CONFIG.tokenNameFormat;
2539
+ },
2540
+ is: isStyleTokenOverrideData,
2541
+ id(token) {
2542
+ return getStyleTokenId(token);
2543
+ },
2544
+ value(token) {
2545
+ return getTokenOverrideValue(token, CSS_CONFIG.tokenNameFormat ?? null);
2546
+ }
2547
+ };
2548
+ //#endregion
2549
+ //#region runtime/core/cache/utils/walk.ts
2550
+ function walkRecursiveItems(root, fn) {
2551
+ if (!root) return;
2552
+ const stack = [root];
2553
+ while (stack.length > 0) {
2554
+ const item = stack.pop();
2555
+ if (!item) continue;
2556
+ if (Array.isArray(item)) {
2557
+ for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
2558
+ continue;
2559
+ }
2560
+ fn(item);
2561
+ }
2562
+ }
2563
+ //#endregion
2564
+ //#region runtime/core/cache/prop.ts
2565
+ function resolveStylePropRuntime(styleProp) {
2566
+ if (!styleProp) return null;
2567
+ styleProp = splitElementMarkerStyleProp(styleProp).styleProp;
2568
+ if (!styleProp) return null;
2569
+ if (RUNTIME_CONFIG.runtimeCacheTTL === 0) {
2570
+ const items = collectStylePropItems(styleProp);
2571
+ return {
2572
+ items,
2573
+ result: createStylePropResult(items, getThemeClassName)
2574
+ };
2575
+ }
2576
+ let unsupportedItem;
2577
+ const tokenBindings = [];
2578
+ const cache = getStylePropCacheValue(styleProp, walkStylePropCachePath, () => warnUnsupportedStylePropItem(unsupportedItem));
2579
+ if (cache?.d) {
2580
+ if (!tokenBindings.length) return {
2581
+ items: cache.d.i,
2582
+ result: cache.d.r
2583
+ };
2584
+ return {
2585
+ items: cache.d.i,
2586
+ result: createStylePropResult(applyTokenBindings(cache.d.i, tokenBindings), getThemeClassName)
2587
+ };
2588
+ }
2589
+ const items = collectStylePropItems(styleProp, tokenBindings.length > 0);
2590
+ const data = {
2591
+ i: items,
2592
+ r: createStylePropResult(items, getThemeClassName)
2593
+ };
2594
+ if (cache) cache.d = data;
2595
+ if (!tokenBindings.length) return {
2596
+ items: data.i,
2597
+ result: data.r
2598
+ };
2599
+ return {
2600
+ items,
2601
+ result: createStylePropResult(applyTokenBindings(items, tokenBindings), getThemeClassName)
2602
+ };
2603
+ function walkStylePropCachePath(styleProp, fn, onUnsupported) {
2604
+ walkRecursiveItems(styleProp, (item) => {
2605
+ if (isElementDebugData(item)) return;
2606
+ const key = getStylePropCacheKey(item, tokenBindings);
2607
+ if (key) fn(key);
2608
+ else {
2609
+ unsupportedItem = item;
2610
+ onUnsupported();
2611
+ }
2612
+ });
2613
+ }
2614
+ }
2615
+ function walkStyleProp(styleProp, fn, options) {
2616
+ walkRecursiveItems(styleProp, (item) => {
2617
+ if (isElementDebugData(item)) return;
2618
+ const styleItem = normalizeStylePropItem(item, options?.stableTokenBound ?? false);
2619
+ if (styleItem) fn(styleItem);
2620
+ else options?.onUnsupported?.(item);
2621
+ });
2622
+ }
2623
+ function getStylePropItems(item) {
2624
+ if (isResolvedStyleItem(item)) return item.items;
2625
+ return [];
2626
+ }
2627
+ function collectStylePropItems(styleProp, stableTokenBound = false) {
2628
+ const items = [];
2629
+ walkStyleProp(styleProp, (item) => {
2630
+ items.push(item);
2631
+ }, { stableTokenBound });
2632
+ return items;
2633
+ }
2634
+ function warnUnsupportedStylePropItem(item) {
2635
+ if (!DEV_CONFIG.isDev) return;
2636
+ if (isElementDebugData(item)) return;
2637
+ if (isSlotOverrideData(item) || isScopeData(item) || isScopeTargetData(item) || isStyleTokenOverrideData(item)) {
2638
+ console.warn("[fluentic-style] Unsupported style prop value. Pass themes, scopes, slot overrides, and token overrides to combineStyle before using style prop.", item);
2639
+ return;
2640
+ }
2641
+ if (item) console.warn("[fluentic-style] Unsupported style prop value.", item);
2642
+ }
2643
+ function normalizeStylePropItem(item, stableTokenBound) {
2644
+ if (isElementDebugData(item)) return null;
2645
+ if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(item)) {
2646
+ const bound = getExtractedTokenBoundData(item);
2647
+ if (stableTokenBound) return normalizeStylePropItem(bound.data, true);
2648
+ const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
2649
+ if (isStyleData(bound.data) || isSheetData(bound.data) || isSlotData(bound.data)) return createResolvedStyleItemWithResolver(bound.data, tokens, runtimeTokenValueResolver);
2650
+ return normalizeStylePropItem(bound.data, false);
2651
+ }
2652
+ if (isResolvedStyleItem(item) || isThemeData(item)) return item;
2653
+ if (isStyleData(item) || isSheetData(item) || isSlotData(item)) return getDirectStyleItemWithResolver(item, runtimeTokenValueResolver);
2654
+ return null;
2655
+ }
2656
+ function getStylePropCacheKey(item, tokenBindings) {
2657
+ if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(item)) {
2658
+ const bound = getExtractedTokenBoundData(item);
2659
+ const key = getStylePropCacheKey(bound.data, tokenBindings);
2660
+ const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
2661
+ if (key && tokens) tokenBindings.push({
2662
+ data: key,
2663
+ tokens
2664
+ });
2665
+ return key;
2666
+ }
2667
+ if (isResolvedStyleItem(item) || isThemeData(item) || isStyleData(item) || isSheetData(item) || isSlotData(item)) return item;
2668
+ return null;
2669
+ }
2670
+ function getThemeClassName(item) {
2671
+ return isThemeData(item) ? item.className : null;
2672
+ }
2673
+ function applyTokenBindings(items, bindings) {
2674
+ if (!bindings.length) return items.slice();
2675
+ return items.map((item) => {
2676
+ if (!isResolvedStyleItem(item)) return item;
2677
+ const tokens = getBoundTokens(item, bindings);
2678
+ if (!tokens) return item;
2679
+ return createResolvedStyleItemFromItems(item, tokens);
2680
+ });
2681
+ }
2682
+ function getBoundTokens(item, bindings) {
2683
+ let tokens = getStyleTokenValues(item);
2684
+ for (let i = 0, len = bindings.length; i < len; i++) {
2685
+ const binding = bindings[i];
2686
+ if (binding.data !== item.data && binding.data !== item) continue;
2687
+ tokens = mergeTokenValues(tokens, binding.tokens);
2688
+ }
2689
+ return tokens;
2690
+ }
2691
+ //#endregion
2692
+ //#region atomic/property/types.ts
2693
+ const LONGHAND = LayerPropertyPriorities.longhand;
2694
+ const SHORTHAND = LayerPropertyPriorities.shorthand;
2695
+ const INTERMEDIATE = LayerPropertyPriorities.intermediate;
2696
+ //#endregion
2697
+ //#region atomic/property/type_maps.ts
2698
+ const animation = {
2699
+ animation: SHORTHAND,
2700
+ animationComposition: LONGHAND,
2701
+ animationDelay: LONGHAND,
2702
+ animationDirection: LONGHAND,
2703
+ animationDuration: LONGHAND,
2704
+ animationFillMode: LONGHAND,
2705
+ animationIterationCount: LONGHAND,
2706
+ animationName: LONGHAND,
2707
+ animationPlayState: LONGHAND,
2708
+ animationRange: INTERMEDIATE,
2709
+ animationRangeEnd: LONGHAND,
2710
+ animationRangeStart: LONGHAND,
2711
+ animationTimeline: LONGHAND,
2712
+ animationTimingFunction: LONGHAND
2713
+ };
2714
+ const background = {
2715
+ background: SHORTHAND,
2716
+ backgroundAttachment: LONGHAND,
2717
+ backgroundBlendMode: LONGHAND,
2718
+ backgroundClip: LONGHAND,
2719
+ backgroundColor: LONGHAND,
2720
+ backgroundImage: LONGHAND,
2721
+ backgroundOrigin: LONGHAND,
2722
+ backgroundPosition: INTERMEDIATE,
2723
+ backgroundPositionX: LONGHAND,
2724
+ backgroundPositionY: LONGHAND,
2725
+ backgroundRepeat: INTERMEDIATE,
2726
+ backgroundSize: LONGHAND
2727
+ };
2728
+ const border = {
2729
+ border: SHORTHAND,
2730
+ borderBlock: INTERMEDIATE,
2731
+ borderBlockColor: INTERMEDIATE,
2732
+ borderBlockEnd: INTERMEDIATE,
2733
+ borderBlockEndColor: LONGHAND,
2734
+ borderBlockEndStyle: LONGHAND,
2735
+ borderBlockEndWidth: LONGHAND,
2736
+ borderBlockStart: INTERMEDIATE,
2737
+ borderBlockStartColor: LONGHAND,
2738
+ borderBlockStartStyle: LONGHAND,
2739
+ borderBlockStartWidth: LONGHAND,
2740
+ borderBlockStyle: INTERMEDIATE,
2741
+ borderBlockWidth: INTERMEDIATE,
2742
+ borderBottom: INTERMEDIATE,
2743
+ borderBottomColor: LONGHAND,
2744
+ borderBottomLeftRadius: LONGHAND,
2745
+ borderBottomRightRadius: LONGHAND,
2746
+ borderBottomStyle: LONGHAND,
2747
+ borderBottomWidth: LONGHAND,
2748
+ borderColor: INTERMEDIATE,
2749
+ borderImage: INTERMEDIATE,
2750
+ borderImageOutset: LONGHAND,
2751
+ borderImageRepeat: LONGHAND,
2752
+ borderImageSlice: LONGHAND,
2753
+ borderImageSource: LONGHAND,
2754
+ borderImageWidth: LONGHAND,
2755
+ borderInline: INTERMEDIATE,
2756
+ borderInlineColor: INTERMEDIATE,
2757
+ borderInlineEnd: INTERMEDIATE,
2758
+ borderInlineEndColor: LONGHAND,
2759
+ borderInlineEndStyle: LONGHAND,
2760
+ borderInlineEndWidth: LONGHAND,
2761
+ borderInlineStart: INTERMEDIATE,
2762
+ borderInlineStartColor: LONGHAND,
2763
+ borderInlineStartStyle: LONGHAND,
2764
+ borderInlineStartWidth: LONGHAND,
2765
+ borderInlineStyle: INTERMEDIATE,
2766
+ borderInlineWidth: INTERMEDIATE,
2767
+ borderLeft: INTERMEDIATE,
2768
+ borderLeftColor: LONGHAND,
2769
+ borderLeftStyle: LONGHAND,
2770
+ borderLeftWidth: LONGHAND,
2771
+ borderRadius: SHORTHAND,
2772
+ borderEndEndRadius: LONGHAND,
2773
+ borderEndStartRadius: LONGHAND,
2774
+ borderRight: INTERMEDIATE,
2775
+ borderRightColor: LONGHAND,
2776
+ borderRightStyle: LONGHAND,
2777
+ borderRightWidth: LONGHAND,
2778
+ borderSpacing: SHORTHAND,
2779
+ borderStartEndRadius: LONGHAND,
2780
+ borderStartStartRadius: LONGHAND,
2781
+ borderStyle: INTERMEDIATE,
2782
+ borderTop: INTERMEDIATE,
2783
+ borderTopColor: LONGHAND,
2784
+ borderTopLeftRadius: LONGHAND,
2785
+ borderTopRightRadius: LONGHAND,
2786
+ borderTopStyle: LONGHAND,
2787
+ borderTopWidth: LONGHAND,
2788
+ borderWidth: INTERMEDIATE
2789
+ };
2790
+ const columns = {
2791
+ columns: SHORTHAND,
2792
+ columnCount: LONGHAND,
2793
+ columnRule: INTERMEDIATE,
2794
+ columnRuleColor: LONGHAND,
2795
+ columnRuleStyle: LONGHAND,
2796
+ columnRuleWidth: LONGHAND,
2797
+ columnWidth: LONGHAND
2798
+ };
2799
+ const containIntrinsicSize = {
2800
+ containIntrinsicSize: SHORTHAND,
2801
+ containIntrinsicBlockSize: LONGHAND,
2802
+ containIntrinsicHeight: LONGHAND,
2803
+ containIntrinsicInlineSize: LONGHAND,
2804
+ containIntrinsicWidth: LONGHAND
2805
+ };
2806
+ const container = {
2807
+ container: SHORTHAND,
2808
+ containerName: LONGHAND,
2809
+ containerType: LONGHAND
2810
+ };
2811
+ const flex = {
2812
+ flex: SHORTHAND,
2813
+ flexBasis: LONGHAND,
2814
+ flexDirection: LONGHAND,
2815
+ flexFlow: INTERMEDIATE,
2816
+ flexGrow: LONGHAND,
2817
+ flexShrink: LONGHAND,
2818
+ flexWrap: LONGHAND
2819
+ };
2820
+ const font = {
2821
+ font: SHORTHAND,
2822
+ fontFamily: LONGHAND,
2823
+ fontFeatureSettings: LONGHAND,
2824
+ fontKerning: LONGHAND,
2825
+ fontLanguageOverride: LONGHAND,
2826
+ fontOpticalSizing: LONGHAND,
2827
+ fontPalette: LONGHAND,
2828
+ fontSize: LONGHAND,
2829
+ fontSizeAdjust: LONGHAND,
2830
+ fontStretch: LONGHAND,
2831
+ fontStyle: LONGHAND,
2832
+ fontSynthesis: INTERMEDIATE,
2833
+ fontSynthesisSmallCaps: LONGHAND,
2834
+ fontSynthesisStyle: LONGHAND,
2835
+ fontSynthesisWeight: LONGHAND,
2836
+ fontVariant: INTERMEDIATE,
2837
+ fontVariantAlternates: LONGHAND,
2838
+ fontVariantCaps: LONGHAND,
2839
+ fontVariantEastAsian: LONGHAND,
2840
+ fontVariantEmoji: LONGHAND,
2841
+ fontVariantLigatures: LONGHAND,
2842
+ fontVariantNumeric: LONGHAND,
2843
+ fontVariantPosition: LONGHAND,
2844
+ fontVariationSettings: LONGHAND,
2845
+ fontWeight: LONGHAND,
2846
+ lineHeight: LONGHAND
2847
+ };
2848
+ const gap = {
2849
+ gap: SHORTHAND,
2850
+ columnGap: LONGHAND,
2851
+ rowGap: LONGHAND
2852
+ };
2853
+ const grid = {
2854
+ grid: SHORTHAND,
2855
+ gridArea: INTERMEDIATE,
2856
+ gridAutoColumns: LONGHAND,
2857
+ gridAutoFlow: LONGHAND,
2858
+ gridAutoRows: LONGHAND,
2859
+ gridColumn: INTERMEDIATE,
2860
+ gridColumnEnd: LONGHAND,
2861
+ gridColumnStart: LONGHAND,
2862
+ gridRow: INTERMEDIATE,
2863
+ gridRowEnd: LONGHAND,
2864
+ gridRowStart: LONGHAND,
2865
+ gridTemplate: INTERMEDIATE,
2866
+ gridTemplateAreas: LONGHAND,
2867
+ gridTemplateColumns: LONGHAND,
2868
+ gridTemplateRows: LONGHAND
2869
+ };
2870
+ const inset = {
2871
+ inset: SHORTHAND,
2872
+ insetBlock: INTERMEDIATE,
2873
+ insetBlockEnd: LONGHAND,
2874
+ insetBlockStart: LONGHAND,
2875
+ insetInline: INTERMEDIATE,
2876
+ insetInlineEnd: LONGHAND,
2877
+ insetInlineStart: LONGHAND,
2878
+ bottom: LONGHAND,
2879
+ left: LONGHAND,
2880
+ right: LONGHAND,
2881
+ top: LONGHAND
2882
+ };
2883
+ const listStyle = {
2884
+ listStyle: SHORTHAND,
2885
+ listStyleImage: LONGHAND,
2886
+ listStylePosition: LONGHAND,
2887
+ listStyleType: LONGHAND
2888
+ };
2889
+ const margin = {
2890
+ margin: SHORTHAND,
2891
+ marginBlock: INTERMEDIATE,
2892
+ marginBlockEnd: LONGHAND,
2893
+ marginBlockStart: LONGHAND,
2894
+ marginBottom: LONGHAND,
2895
+ marginInline: INTERMEDIATE,
2896
+ marginInlineEnd: LONGHAND,
2897
+ marginInlineStart: LONGHAND,
2898
+ marginLeft: LONGHAND,
2899
+ marginRight: LONGHAND,
2900
+ marginTop: LONGHAND
2901
+ };
2902
+ const mask = {
2903
+ mask: SHORTHAND,
2904
+ maskBorder: INTERMEDIATE,
2905
+ maskBorderMode: LONGHAND,
2906
+ maskBorderOutset: LONGHAND,
2907
+ maskBorderRepeat: LONGHAND,
2908
+ maskBorderSlice: LONGHAND,
2909
+ maskBorderSource: LONGHAND,
2910
+ maskBorderWidth: LONGHAND,
2911
+ maskClip: LONGHAND,
2912
+ maskComposite: LONGHAND,
2913
+ maskImage: LONGHAND,
2914
+ maskMode: LONGHAND,
2915
+ maskOrigin: LONGHAND,
2916
+ maskPosition: LONGHAND,
2917
+ maskRepeat: LONGHAND,
2918
+ maskSize: LONGHAND,
2919
+ maskType: LONGHAND,
2920
+ WebkitMask: SHORTHAND,
2921
+ WebkitMaskBoxImage: INTERMEDIATE,
2922
+ WebkitMaskBoxImageOutset: LONGHAND,
2923
+ WebkitMaskBoxImageRepeat: LONGHAND,
2924
+ WebkitMaskBoxImageSlice: LONGHAND,
2925
+ WebkitMaskBoxImageSource: LONGHAND,
2926
+ WebkitMaskBoxImageWidth: LONGHAND,
2927
+ WebkitMaskClip: LONGHAND,
2928
+ WebkitMaskComposite: LONGHAND,
2929
+ WebkitMaskImage: LONGHAND,
2930
+ WebkitMaskOrigin: LONGHAND,
2931
+ WebkitMaskPosition: LONGHAND,
2932
+ WebkitMaskPositionX: LONGHAND,
2933
+ WebkitMaskPositionY: LONGHAND,
2934
+ WebkitMaskRepeat: LONGHAND,
2935
+ WebkitMaskRepeatX: LONGHAND,
2936
+ WebkitMaskRepeatY: LONGHAND,
2937
+ WebkitMaskSize: LONGHAND
2938
+ };
2939
+ const offset = {
2940
+ offset: SHORTHAND,
2941
+ offsetAnchor: LONGHAND,
2942
+ offsetDistance: LONGHAND,
2943
+ offsetPath: LONGHAND,
2944
+ offsetPosition: LONGHAND,
2945
+ offsetRotate: LONGHAND
2946
+ };
2947
+ const outline = {
2948
+ outline: SHORTHAND,
2949
+ outlineColor: LONGHAND,
2950
+ outlineOffset: LONGHAND,
2951
+ outlineStyle: LONGHAND,
2952
+ outlineWidth: LONGHAND
2953
+ };
2954
+ const overflow = {
2955
+ overflow: SHORTHAND,
2956
+ overflowBlock: LONGHAND,
2957
+ overflowClipMargin: SHORTHAND,
2958
+ overflowInline: LONGHAND,
2959
+ overflowWrap: LONGHAND,
2960
+ overflowX: LONGHAND,
2961
+ overflowY: LONGHAND
2962
+ };
2963
+ const overscrollBehavior = {
2964
+ overscrollBehavior: SHORTHAND,
2965
+ overscrollBehaviorBlock: LONGHAND,
2966
+ overscrollBehaviorInline: LONGHAND,
2967
+ overscrollBehaviorX: LONGHAND,
2968
+ overscrollBehaviorY: LONGHAND
2969
+ };
2970
+ const padding = {
2971
+ padding: SHORTHAND,
2972
+ paddingBlock: INTERMEDIATE,
2973
+ paddingBlockEnd: LONGHAND,
2974
+ paddingBlockStart: LONGHAND,
2975
+ paddingBottom: LONGHAND,
2976
+ paddingInline: INTERMEDIATE,
2977
+ paddingInlineEnd: LONGHAND,
2978
+ paddingInlineStart: LONGHAND,
2979
+ paddingLeft: LONGHAND,
2980
+ paddingRight: LONGHAND,
2981
+ paddingTop: LONGHAND
2982
+ };
2983
+ const place = {
2984
+ placeContent: SHORTHAND,
2985
+ alignContent: LONGHAND,
2986
+ justifyContent: LONGHAND,
2987
+ placeItems: SHORTHAND,
2988
+ alignItems: LONGHAND,
2989
+ justifyItems: LONGHAND,
2990
+ placeSelf: SHORTHAND,
2991
+ alignSelf: LONGHAND,
2992
+ justifySelf: LONGHAND
2993
+ };
2994
+ const scrollMargin = {
2995
+ scrollMargin: SHORTHAND,
2996
+ scrollMarginBlock: INTERMEDIATE,
2997
+ scrollMarginBlockEnd: LONGHAND,
2998
+ scrollMarginBlockStart: LONGHAND,
2999
+ scrollMarginBottom: LONGHAND,
3000
+ scrollMarginInline: INTERMEDIATE,
3001
+ scrollMarginInlineEnd: LONGHAND,
3002
+ scrollMarginInlineStart: LONGHAND,
3003
+ scrollMarginLeft: LONGHAND,
3004
+ scrollMarginRight: LONGHAND,
3005
+ scrollMarginTop: LONGHAND
3006
+ };
3007
+ const scrollPadding = {
3008
+ scrollPadding: SHORTHAND,
3009
+ scrollPaddingBlock: INTERMEDIATE,
3010
+ scrollPaddingBlockEnd: LONGHAND,
3011
+ scrollPaddingBlockStart: LONGHAND,
3012
+ scrollPaddingBottom: LONGHAND,
3013
+ scrollPaddingInline: INTERMEDIATE,
3014
+ scrollPaddingInlineEnd: LONGHAND,
3015
+ scrollPaddingInlineStart: LONGHAND,
3016
+ scrollPaddingLeft: LONGHAND,
3017
+ scrollPaddingRight: LONGHAND,
3018
+ scrollPaddingTop: LONGHAND
3019
+ };
3020
+ const scrollTimeline = {
3021
+ scrollTimeline: SHORTHAND,
3022
+ scrollTimelineAxis: LONGHAND,
3023
+ scrollTimelineName: LONGHAND
3024
+ };
3025
+ const text = {
3026
+ textDecoration: SHORTHAND,
3027
+ textDecorationColor: LONGHAND,
3028
+ textDecorationLine: LONGHAND,
3029
+ textDecorationSkip: LONGHAND,
3030
+ textDecorationSkipInk: LONGHAND,
3031
+ textDecorationStyle: LONGHAND,
3032
+ textDecorationThickness: LONGHAND,
3033
+ textEmphasis: SHORTHAND,
3034
+ textEmphasisColor: LONGHAND,
3035
+ textEmphasisPosition: LONGHAND,
3036
+ textEmphasisStyle: LONGHAND
3037
+ };
3038
+ const transition = {
3039
+ transition: SHORTHAND,
3040
+ transitionBehavior: LONGHAND,
3041
+ transitionDelay: LONGHAND,
3042
+ transitionDuration: LONGHAND,
3043
+ transitionProperty: LONGHAND,
3044
+ transitionTimingFunction: LONGHAND
3045
+ };
3046
+ const viewTimeline = {
3047
+ viewTimeline: SHORTHAND,
3048
+ viewTimelineAxis: LONGHAND,
3049
+ viewTimelineInset: LONGHAND,
3050
+ viewTimelineName: LONGHAND
3051
+ };
3052
+ const whiteSpace = {
3053
+ whiteSpace: SHORTHAND,
3054
+ whiteSpaceCollapse: LONGHAND
3055
+ };
3056
+ //#endregion
3057
+ //#region atomic/property/presets.ts
3058
+ const DefaultPropertyTypes = {
3059
+ ...animation,
3060
+ ...background,
3061
+ ...border,
3062
+ ...columns,
3063
+ ...containIntrinsicSize,
3064
+ ...container,
3065
+ ...flex,
3066
+ ...font,
3067
+ ...gap,
3068
+ ...grid,
3069
+ ...inset,
3070
+ ...listStyle,
3071
+ ...margin,
3072
+ ...mask,
3073
+ ...offset,
3074
+ ...outline,
3075
+ ...overflow,
3076
+ ...overscrollBehavior,
3077
+ ...padding,
3078
+ ...place,
3079
+ ...scrollMargin,
3080
+ ...scrollPadding,
3081
+ ...scrollTimeline,
3082
+ ...text,
3083
+ ...transition,
3084
+ ...viewTimeline,
3085
+ ...whiteSpace
3086
+ };
3087
+ function getPropertyPriority(property) {
3088
+ return DefaultPropertyTypes[property] ?? 0;
3089
+ }
3090
+ function getCssPropertyName(property) {
3091
+ return property.replace(/^(webkit|moz|ms|o)([A-Z])/g, (_, prefix, c) => `-${prefix}-${c.toLowerCase()}`).replace(/[A-Z]/g, (c) => "-" + c.toLowerCase());
3092
+ }
3093
+ function getScopeClassName(className, scopeClassNameFormat) {
3094
+ return formatScopeClassName(scopeClassNameFormat || "-(className)", { className });
3095
+ }
3096
+ function formatScopeClassName(format, info) {
3097
+ if (typeof format === "function") return format(info);
3098
+ return format.replace(/\[|\]/g, "").replace(/\(className\)/g, info.className);
3099
+ }
3100
+ //#endregion
3101
+ //#region atomic/utils/selector.ts
3102
+ function getSelectorText(selector) {
3103
+ const text = Array.isArray(selector) ? selector[0] : selector;
3104
+ if (text.startsWith("\0global")) return text.slice(text.indexOf("\0", 7) + 1);
3105
+ return stripSheetSelectorAnchor(text);
3106
+ }
3107
+ function getSelectorHash(selector) {
3108
+ return Array.isArray(selector) ? selector.join("|") : selector;
3109
+ }
3110
+ function getSelectorPriority(selector) {
3111
+ if (!selector) return 0;
3112
+ return Array.isArray(selector) ? selector[1] : 0;
3113
+ }
3114
+ function hasSheetSelectorAnchor(selector) {
3115
+ return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(SHEET_SELECTOR_ANCHOR);
3116
+ }
3117
+ function getSheetSelectorSpecificity(selector) {
3118
+ const text = selector ? Array.isArray(selector) ? selector[0] : selector : "";
3119
+ if (!text.startsWith("\0sheet:")) return null;
3120
+ const end = text.indexOf("\0", 6);
3121
+ if (end < 0) return null;
3122
+ const [weightValue] = text.slice(7, end).split(":");
3123
+ if (!weightValue) return null;
3124
+ const weight = Number(weightValue);
3125
+ return Number.isInteger(weight) && weight >= 0 ? weight : null;
3126
+ }
3127
+ function stripSheetSelectorAnchor(selector) {
3128
+ if (!selector.startsWith("\0sheet")) return selector;
3129
+ if (selector.startsWith("\0sheet:")) {
3130
+ const end = selector.indexOf("\0", 6);
3131
+ if (end >= 0) return selector.slice(end + 1);
3132
+ }
3133
+ return selector.slice(6);
3134
+ }
3135
+ function hasGlobalSheetSelectorAnchor(selector) {
3136
+ return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(GLOBAL_SHEET_SELECTOR_ANCHOR);
3137
+ }
3138
+ //#endregion
3139
+ //#region atomic/value/unitless.ts
3140
+ const UnitlessProperties = [
3141
+ "animationIterationCount",
3142
+ "aspectRatio",
3143
+ "borderImageOutset",
3144
+ "borderImageSlice",
3145
+ "borderImageWidth",
3146
+ "boxFlex",
3147
+ "boxFlexGroup",
3148
+ "boxOrdinalGroup",
3149
+ "columnCount",
3150
+ "columns",
3151
+ "fillOpacity",
3152
+ "flex",
3153
+ "flexGrow",
3154
+ "flexNegative",
3155
+ "flexOrder",
3156
+ "flexPositive",
3157
+ "flexShrink",
3158
+ "floodOpacity",
3159
+ "fontWeight",
3160
+ "gridArea",
3161
+ "gridColumn",
3162
+ "gridColumnEnd",
3163
+ "gridColumnSpan",
3164
+ "gridColumnStart",
3165
+ "gridRow",
3166
+ "gridRowEnd",
3167
+ "gridRowSpan",
3168
+ "gridRowStart",
3169
+ "imageOrientation",
3170
+ "lineClamp",
3171
+ "lineHeight",
3172
+ "opacity",
3173
+ "order",
3174
+ "orphans",
3175
+ "scale",
3176
+ "stopOpacity",
3177
+ "strokeDasharray",
3178
+ "strokeDashoffset",
3179
+ "strokeMiterlimit",
3180
+ "strokeOpacity",
3181
+ "strokeWidth",
3182
+ "tabSize",
3183
+ "widows",
3184
+ "zIndex",
3185
+ "zoom"
3186
+ ];
3187
+ //#endregion
3188
+ //#region atomic/value/value.ts
3189
+ const CSS_NUMBER_VALUE = /^-?(\d+\.?\d*|\.\d+)$/;
3190
+ const UNITLESS = new Set(UnitlessProperties);
3191
+ function getCssPropertyValue(property, value) {
3192
+ if (!value || !shouldAppendCssPx(property)) return value;
3193
+ if (CSS_NUMBER_VALUE.test(value)) return value + "px";
3194
+ return value;
3195
+ }
3196
+ function shouldAppendCssPx(property) {
3197
+ return !UNITLESS.has(property);
3198
+ }
3199
+ //#endregion
3200
+ //#region atomic/rule.ts
3201
+ function buildAtomicRule(className, property, value, important, selector, parentSelector, atRules, scopeClassNameFormat) {
3202
+ const cssProp = getCssPropertyName(property);
3203
+ const cssValue = getCssPropertyValue(property, value) + (important ? " !important" : "");
3204
+ const escapedClass = escapeCssIdent(className);
3205
+ const specificity = hasSheetSelectorAnchor(selector) ? getSheetSelectorSpecificity(selector) ?? 1 : 1;
3206
+ const classSelector = specificity === 0 ? `:where(.${escapedClass})` : Array(specificity).fill("." + escapedClass).join("");
3207
+ const itemSelector = selector ? getSelectorText(selector) : "";
3208
+ let selectorStr = hasGlobalSheetSelectorAnchor(selector) ? itemSelector : classSelector + itemSelector;
3209
+ if (parentSelector) {
3210
+ const parentWhere = `:where(${"." + escapeCssIdent(getScopeClassName(className, scopeClassNameFormat)) + getSelectorText(parentSelector)})`;
3211
+ selectorStr = classSelector + parentWhere + itemSelector + "," + parentWhere + " " + selectorStr;
3212
+ }
3213
+ let rule = `${selectorStr}{${cssProp}: ${cssValue}}`;
3214
+ if (atRules) for (let i = atRules.length - 1; i >= 0; i--) rule = `${getSelectorText(atRules[i])}{${rule}}`;
3215
+ return rule;
3216
+ }
3217
+ function getAtomicRuleLayerPriority(property, priority, selector, parentSelector, atRules, isScopeRule = false) {
3218
+ const selectorPriority = getSelectorPriority(selector);
3219
+ const parentSelectorPriority = getSelectorPriority(parentSelector);
3220
+ const atRulePriority = getAtRulePriority(atRules);
3221
+ return [
3222
+ priority ?? 0,
3223
+ getLayerSelectorPriority(selector, parentSelector, selectorPriority),
3224
+ getParentSelectorPriority(parentSelector, parentSelectorPriority),
3225
+ getMediaPriority(atRules, atRulePriority),
3226
+ atRules ? atRules.length : 0,
3227
+ isScopeRule && !parentSelector ? 1 : 0,
3228
+ getPropertyPriority(property)
3229
+ ];
3230
+ }
3231
+ function getMediaPriority(atRules, priority) {
3232
+ if (!atRules?.length) return LayerMediaPriorities.base;
3233
+ if (priority <= 0) return LayerMediaPriorities.media;
3234
+ return LayerMediaPriorities.priorityMedia + priority;
3235
+ }
3236
+ function getLayerSelectorPriority(selector, parentSelector, priority) {
3237
+ if (selector) return priority > 0 ? LayerSelectorPriorities.prioritySelector + priority : LayerSelectorPriorities.selector;
3238
+ if (parentSelector) return LayerSelectorPriorities.parentSelector;
3239
+ return LayerSelectorPriorities.base;
3240
+ }
3241
+ function getParentSelectorPriority(parentSelector, priority) {
3242
+ if (!parentSelector) return 0;
3243
+ return priority > 0 ? priority + 1 : 1;
3244
+ }
3245
+ function getAtRulePriority(atRules) {
3246
+ if (!atRules?.length) return 0;
3247
+ let priority = 0;
3248
+ for (let i = 0, len = atRules.length; i < len; i++) priority = Math.max(priority, getSelectorPriority(atRules[i]));
3249
+ return priority;
3250
+ }
3251
+ //#endregion
3252
+ //#region runtime/sheet/rule.ts
3253
+ function createRuntimeSheetRules(item, sheetOptions = null) {
3254
+ if (Array.isArray(item)) return null;
3255
+ if (isStyleTokenOverrideData(item)) return null;
3256
+ const runtimeItem = item;
3257
+ const parentSelector = runtimeItem.type === 4 ? runtimeItem.parentSelector : null;
3258
+ const layerPriority = getAtomicRuleLayerPriority(runtimeItem.property, runtimeItem.weight, runtimeItem.selector, parentSelector, runtimeItem.atRule, runtimeItem.type === 4);
3259
+ const ruleCss = buildAtomicRule(runtimeItem.className, runtimeItem.property, runtimeItem.value, runtimeItem.important, runtimeItem.selector, parentSelector, runtimeItem.atRule, CSS_CONFIG.scopeClassNameFormat || null);
3260
+ const rule = {
3261
+ key: runtimeItem.className,
3262
+ dedupe: runtimeItem.dedupe,
3263
+ priority: layerPriority,
3264
+ important: runtimeItem.important,
3265
+ importantNative: runtimeItem.importantNative,
3266
+ sheet: !!sheetOptions,
3267
+ layer: getRuntimeRuleLayer(sheetOptions),
3268
+ css: ruleCss,
3269
+ callsite: runtimeItem.callsite,
3270
+ debug: runtimeItem.debug,
3271
+ debugField: runtimeItem.debugField
3272
+ };
3273
+ const ref = getStateItemAtRuleRef(item);
3274
+ if (!ref?.css) return [rule];
3275
+ return [{
3276
+ key: ref.key,
3277
+ dedupe: ref.key,
3278
+ priority: null,
3279
+ css: ref.css,
3280
+ callsite: runtimeItem.callsite
3281
+ }, rule];
3282
+ }
3283
+ function getRuntimeRuleLayer(sheetOptions) {
3284
+ if (!sheetOptions) return "style";
3285
+ return resolveSheetLayerOption(sheetOptions.layer ?? false, CSS_CONFIG.layerNamespace || "css");
3286
+ }
3287
+ const formatThemeName = createNameFormatter(["name"]);
3288
+ function createThemeClassName(name, id, themeNameFormat) {
3289
+ return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: normalizeThemeName(name) });
3290
+ }
3291
+ function getThemeRuleCss(className, tokens, tokenNameFormat) {
3292
+ const declarations = [];
3293
+ for (let i = 0, len = tokens.length; i < len; i++) declarations.push(getThemeDeclaration(tokens[i], tokenNameFormat));
3294
+ return "." + escapeCssIdent(className) + "{" + declarations.join(";") + "}";
3295
+ }
3296
+ function getThemeDeclaration(token, tokenNameFormat) {
3297
+ const name = getTokenVarName(token, tokenNameFormat);
3298
+ const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
3299
+ return name + ":" + value;
3300
+ }
3301
+ function normalizeThemeName(value) {
3302
+ if (!value) return null;
3303
+ value = value.trim();
3304
+ if (!value) return null;
3305
+ if (/^\d+$/.test(value)) return null;
3306
+ if (isGeneratedNameHash(value)) return null;
3307
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
3308
+ if (stableSuffix?.[1] && isGeneratedNameHash(value.slice(-7))) return normalizeThemeName(stableSuffix[1]);
3309
+ value = stripGenericThemePrefix(value);
3310
+ if (!value) return null;
3311
+ return value;
3312
+ }
3313
+ function stripGenericThemePrefix(value) {
3314
+ const parts = value.split("--");
3315
+ while (parts[0] === "theme" || parts[0] === "themes") parts.shift();
3316
+ value = parts.join("--");
3317
+ if (value.startsWith("theme-")) return value.slice(6);
3318
+ if (value.startsWith("themes-")) return value.slice(7);
3319
+ return value;
3320
+ }
3321
+ function isGeneratedNameHash(value) {
3322
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
3323
+ }
3324
+ //#endregion
3325
+ //#region runtime/sheet/theme.ts
3326
+ function insertRuntimeThemeRule(sheet, theme) {
3327
+ sheet.insert({
3328
+ key: theme.className,
3329
+ css: createThemeRule(theme),
3330
+ callsite: theme[BUILDER_CALLSITE]
3331
+ });
3332
+ }
3333
+ function createThemeRule(theme) {
3334
+ return getThemeRuleCss(theme.className, theme.tokens, CSS_CONFIG.tokenNameFormat || null);
3335
+ }
3336
+ //#endregion
3337
+ //#region runtime/sheet/rules.ts
3338
+ function walkStylePropSheetRules(styleProp, onRule, onTheme) {
3339
+ walkStyleProp(styleProp, (item) => {
3340
+ walkStylePropItemSheetRules(item, onRule, onTheme);
3341
+ });
3342
+ }
3343
+ function walkStylePropItemsSheetRules(items, onRule, onTheme) {
3344
+ for (let i = 0, len = items.length; i < len; i++) walkStylePropItemSheetRules(items[i], onRule, onTheme);
3345
+ }
3346
+ function walkStylePropItemSheetRules(item, onRule, onTheme) {
3347
+ if (isThemeData(item)) {
3348
+ onTheme?.(item);
3349
+ return;
3350
+ }
3351
+ const items = getStylePropItems(item);
3352
+ const sheetData = isResolvedStyleItem(item) && isSheetData(item.data) ? item.data : null;
3353
+ const sheetOptions = sheetData ? sheetData[BUILDER_SHEET_OPTIONS] : null;
3354
+ for (let i = 0, len = items.length; i < len; i++) {
3355
+ const rules = createRuntimeSheetRules(items[i], sheetOptions);
3356
+ if (!rules) continue;
3357
+ for (let j = 0, len = rules.length; j < len; j++) onRule(rules[j]);
3358
+ }
3359
+ }
3360
+ function collectStylePropSheetRules(styleProp) {
3361
+ return collectStylePropRules((onRule) => {
3362
+ walkStylePropSheetRules(styleProp, onRule);
3363
+ });
3364
+ }
3365
+ function collectStylePropItemsSheetRulesWithThemes(items) {
3366
+ const rules = [];
3367
+ const lookup = /* @__PURE__ */ new Map();
3368
+ const addRule = (rule, dedupe) => {
3369
+ const index = lookup.get(dedupe);
3370
+ if (index === void 0) lookup.set(dedupe, rules.push(rule) - 1);
3371
+ else rules[index] = rule;
3372
+ };
3373
+ walkStylePropItemsSheetRules(items, (rule) => {
3374
+ if (!rule.key || !rule.dedupe) return;
3375
+ addRule(createSheetRulePayload(rule), rule.dedupe);
3376
+ }, (theme) => {
3377
+ addRule({
3378
+ key: theme.className,
3379
+ css: createThemeRule(theme),
3380
+ callsite: theme[BUILDER_CALLSITE]
3381
+ }, theme.className);
3382
+ });
3383
+ return rules;
3384
+ }
3385
+ function collectStylePropRules(walk) {
3386
+ const rules = [];
3387
+ const lookup = /* @__PURE__ */ new Map();
3388
+ walk((rule) => {
3389
+ if (!rule.key || !rule.dedupe) return;
3390
+ const index = lookup.get(rule.dedupe);
3391
+ if (index === void 0) lookup.set(rule.dedupe, rules.push(createSheetRulePayload(rule)) - 1);
3392
+ else rules[index] = createSheetRulePayload(rule);
3393
+ });
3394
+ return rules;
3395
+ }
3396
+ function createSheetRulePayload(rule) {
3397
+ return {
3398
+ key: rule.key,
3399
+ css: rule.css,
3400
+ callsite: rule.callsite || null,
3401
+ debug: rule.debug || null,
3402
+ debugField: rule.debugField || null,
3403
+ priority: rule.priority,
3404
+ important: rule.important,
3405
+ importantNative: rule.importantNative,
3406
+ sheet: rule.sheet,
3407
+ globalSheet: rule.globalSheet,
3408
+ layer: rule.layer
3409
+ };
3410
+ }
3411
+ //#endregion
3412
+ //#region runtime/rsc/constants.ts
3413
+ const GLOBAL_SEED_ATTR = "data-css-global-seed-dev";
3414
+ const GLOBAL_RULES_ATTR = "data-css-global-rules-dev";
3415
+ const ELEMENT_CSS_DATA_ATTR = "data-css-dev";
3416
+ const PRECOLLECT_LINK_TAG_ATTR = "data-fluentic-style-rsc-dev-link";
3417
+ const SEED_STYLE_TAG_ATTR = "data-fluentic-style-rsc-dev-style";
3418
+ const SEED_STYLE_TAG_HREF = "href-fluentic-style-rsc-dev-style";
3419
+ //#endregion
3420
+ //#region runtime/env.ts
3421
+ const IS_SERVER_RUNTIME = typeof window === "undefined";
3422
+ function isServerRSC() {
3423
+ return RUNTIME_CONFIG.isRSC && IS_SERVER_RUNTIME;
3424
+ }
3425
+ //#endregion
3426
+ //#region runtime/rsc/styleStore.ts
3427
+ const GLOBAL_KEY = "runtime.rsc.styleStore";
3428
+ function addRscStyleRules(rules) {
3429
+ if (!RUNTIME_CONFIG.isRSC) return;
3430
+ if (!IS_SERVER_RUNTIME) return;
3431
+ const store = getRscStyleStore();
3432
+ for (let i = 0, len = rules.length; i < len; i++) {
3433
+ const rule = rules[i];
3434
+ if (!rule.key || !rule.css || store.keys.has(rule.key)) continue;
3435
+ store.keys.add(rule.key);
3436
+ store.rules.push(rule);
3437
+ }
3438
+ store.counter += 1;
3439
+ }
3440
+ function getRscStyleRules() {
3441
+ return getGlobalData(GLOBAL_KEY)?.rules ?? [];
3442
+ }
3443
+ function serializeRscRules(rules) {
3444
+ return serializeOrderedRules(rules, CSS_CONFIG, DEV_CONFIG.stylePriorityMode);
3445
+ }
3446
+ function getRscStyleStore() {
3447
+ return globalData(GLOBAL_KEY, () => ({
3448
+ counter: 0,
3449
+ lastCounter: 0,
3450
+ rules: [],
3451
+ keys: /* @__PURE__ */ new Set()
3452
+ }));
3453
+ }
3454
+ //#endregion
3455
+ export { TOKEN_VAR_NAME as $, getRuntimeDocument as $t, addTokenOverride as A, createStyleSheet as At, createStyleToken as B, isDebugData as Bt, runtimeTokenValueResolver as C, clearElementMarkers as Ct, createCombinedStyleFacade as D, insertElementMarkerSheetRule as Dt, getCacheTreeChild as E, getElementMarkerClassNameFromRule as Et, mergeTokenValues as F, getSourcemapRuleCallsite as Ft, getStyleTokenId as G, createNoopSheet as Gt, getStyleTokenOverrideDebug as H, traceCallsite as Ht, getCombinedStyleScopes as I, getDebugCallsite as It, isStyleTokenData as J, createNameFormatter as Jt, getStyleTokenName as K, LayerDefaultLayers as Kt, getCombinedStyleStyles as L, getDebugCallsiteId as Lt, createMutableTokenValues as M, getDevSourcemapTags as Mt, finishTokenValues as N, refreshDevSourcemapTags as Nt, createCombinedStyleTokenWrapper as O, isElementMarkerRule as Ot, mergeTokenOverrides as P, createSourceMapComment as Pt, TOKEN_OVERRIDE as Q, configureStyleRuntime as Qt, isCombinedStyle as R, getDebugFieldCallsite as Rt, resolveStylePropRuntime as S, symbol as Sn, SHEET_SELECTOR_ANCHOR as St, createCacheTreeNode as T, createElementMarkerRuleFromDebug as Tt, resetStyleTokenIdCounter as U, traceError as Ut, createStyleTokenOverride as V, normalizeCallsiteSourceUrl as Vt, getChildStyleTokenName as W, traceMarker as Wt, TOKEN_ID as X, normalizePropertyName as Xt, isStyleTokenOverrideData as Y, normalizeDebugKeywordValue as Yt, TOKEN_NAME as Z, sanitizeDebugPropertyName as Zt, getCssPropertyValue as _, RUNTIME_CONFIG as _n, BUILDER_SHEET_OPTIONS as _t, isServerRSC as a, hasOwn as an, isScopeData as at, hasSheetSelectorAnchor as b, getGlobalData as bn, BUILDER_TYPE as bt, GLOBAL_SEED_ATTR as c, DEBUG_CONFIG as cn, isSelectorOverrideData as ct, SEED_STYLE_TAG_HREF as d, CSS_CONFIG as dn, isSlotOverrideData as dt, onRuntimeDocumentChange as en, getExtractedTokenBoundData as et, collectStylePropItemsSheetRulesWithThemes as f, CSS_CONFIG_DEFAULT as fn, isStyleData as ft, createThemeClassName as g, CHECK_CONFIG as gn, BUILDER_SELECTOR as gt, insertRuntimeThemeRule as h, LayerPlaceholder as hn, BUILDER_SCOPE_ID as ht, IS_SERVER_RUNTIME as i, setDevUtilsRuntimeOptions as in, getSelectorSelectors as it, addTokenValues as j, refreshDevStyleTags as jt, getStyleTokenValues as k, splitElementMarkerStyleProp as kt, PRECOLLECT_LINK_TAG_ATTR as l, setBuildDebugClassName as ln, isSheetData as lt, walkStylePropItemsSheetRules as m, isStyleLayerEnabled as mn, BUILDER_SCOPE as mt, getRscStyleRules as n, getBuildDevConfig as nn, getScopeTargetScope as nt, ELEMENT_CSS_DATA_ATTR as o, set as on, isScopeTargetData as ot, collectStylePropSheetRules as p, isSheetLayerOption as pn, BUILDER_CALLSITE as pt, getStyleTokenVarName as q, getIdentifierSafeHash as qt, serializeRscRules as r, setBuildDevConfig as rn, getScopeTargetSlotId as rt, GLOBAL_RULES_ATTR as s, hashString as sn, isSelectorData as st, addRscStyleRules as t, DEV_CONFIG as tn, isExtractedTokenBoundData as tt, SEED_STYLE_TAG_ATTR as u, setBuildConfig as un, isSlotData as ut, getSelectorHash as v, SIDECAR_URL_GLOBAL_SYMBOL as vn, BUILDER_SLOT_ID as vt, getTokenVar as w, createElementMarkerClassName as wt, getCssPropertyName as x, globalData as xn, GLOBAL_SHEET_SELECTOR_ANCHOR as xt, getSelectorText as y, clearGlobalData as yn, BUILDER_STATE as yt, TOKEN_DEBUG as z, getTraceCallsiteId as zt };
3456
+
3457
+ //# sourceMappingURL=styleStore-D4umgIwQ.js.map