@tamagui/static 2.7.7 → 3.0.0-beta.1097.1

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 (335) hide show
  1. package/dist/cjs/check-dep-versions.cjs +354 -0
  2. package/dist/cjs/checkDeps.cjs +301 -0
  3. package/dist/cjs/compiler.cjs +349 -0
  4. package/dist/cjs/compilerHost.cjs +2287 -0
  5. package/dist/cjs/componentDiscovery.cjs +94 -0
  6. package/dist/cjs/constants.cjs +32 -0
  7. package/dist/cjs/domStructuralPass.cjs +121 -0
  8. package/dist/cjs/exports.cjs +44 -0
  9. package/dist/cjs/extractor/addLocalExports.cjs +63 -0
  10. package/dist/cjs/extractor/bundle.cjs +229 -0
  11. package/dist/cjs/extractor/bundleConfig.cjs +769 -0
  12. package/dist/cjs/extractor/concatClassName.cjs +120 -0
  13. package/dist/cjs/extractor/detectModuleFormat.cjs +53 -0
  14. package/dist/cjs/extractor/esbuildAliasPlugin.cjs +46 -0
  15. package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +91 -0
  16. package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +42 -0
  17. package/dist/cjs/extractor/loadTamagui.cjs +394 -0
  18. package/dist/cjs/extractor/regenerateConfig.cjs +160 -0
  19. package/dist/cjs/extractor/watchTamaguiConfig.cjs +63 -0
  20. package/dist/cjs/getPragmaOptions.cjs +66 -0
  21. package/dist/cjs/helpers/memoize.cjs +41 -0
  22. package/dist/cjs/helpers/requireTamaguiCore.cjs +39 -0
  23. package/dist/cjs/index.cjs +33 -0
  24. package/dist/cjs/registerRequire.cjs +219 -0
  25. package/dist/cjs/server.cjs +65 -0
  26. package/dist/cjs/staticEvaluationIgnoredModules.cjs +85 -0
  27. package/dist/cjs/types.cjs +16 -0
  28. package/dist/cjs/zero/artifact.cjs +144 -0
  29. package/dist/cjs/zero/graph.cjs +208 -0
  30. package/dist/cjs/zero/identity.cjs +60 -0
  31. package/dist/cjs/zero/index.cjs +33 -0
  32. package/dist/cjs/zero/islands.cjs +235 -0
  33. package/dist/cjs/zero/options.cjs +162 -0
  34. package/dist/cjs/zero/ownership.cjs +78 -0
  35. package/dist/cjs/zero/theme.cjs +337 -0
  36. package/dist/cjs/zero/transform.cjs +207 -0
  37. package/dist/esm/check-dep-versions.mjs +329 -0
  38. package/dist/esm/check-dep-versions.mjs.map +1 -0
  39. package/dist/esm/checkDeps.mjs +279 -0
  40. package/dist/esm/checkDeps.mjs.map +1 -0
  41. package/dist/esm/compiler.mjs +319 -0
  42. package/dist/esm/compiler.mjs.map +1 -0
  43. package/dist/esm/compilerHost.mjs +2265 -0
  44. package/dist/esm/compilerHost.mjs.map +1 -0
  45. package/dist/esm/componentDiscovery.mjs +69 -0
  46. package/dist/esm/componentDiscovery.mjs.map +1 -0
  47. package/dist/esm/constants.mjs +7 -0
  48. package/dist/esm/constants.mjs.map +1 -0
  49. package/dist/esm/domStructuralPass.mjs +102 -0
  50. package/dist/esm/domStructuralPass.mjs.map +1 -0
  51. package/dist/esm/exports.mjs +29 -0
  52. package/dist/esm/extractor/addLocalExports.mjs +44 -0
  53. package/dist/esm/extractor/addLocalExports.mjs.map +1 -0
  54. package/dist/esm/extractor/bundle.mjs +199 -0
  55. package/dist/esm/extractor/bundle.mjs.map +1 -0
  56. package/dist/esm/extractor/bundleConfig.mjs +728 -0
  57. package/dist/esm/extractor/bundleConfig.mjs.map +1 -0
  58. package/dist/esm/extractor/concatClassName.mjs +100 -0
  59. package/dist/esm/extractor/concatClassName.mjs.map +1 -0
  60. package/dist/esm/extractor/detectModuleFormat.mjs +31 -0
  61. package/dist/esm/extractor/detectModuleFormat.mjs.map +1 -0
  62. package/dist/esm/extractor/esbuildAliasPlugin.mjs +26 -0
  63. package/dist/esm/extractor/esbuildAliasPlugin.mjs.map +1 -0
  64. package/dist/esm/extractor/esbuildTsconfigPaths.mjs +63 -0
  65. package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -0
  66. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +23 -0
  67. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
  68. package/dist/esm/extractor/loadTamagui.mjs +357 -0
  69. package/dist/esm/extractor/loadTamagui.mjs.map +1 -0
  70. package/dist/esm/extractor/regenerateConfig.mjs +131 -0
  71. package/dist/esm/extractor/regenerateConfig.mjs.map +1 -0
  72. package/dist/esm/extractor/watchTamaguiConfig.mjs +43 -0
  73. package/dist/esm/extractor/watchTamaguiConfig.mjs.map +1 -0
  74. package/dist/esm/getPragmaOptions.mjs +46 -0
  75. package/dist/esm/getPragmaOptions.mjs.map +1 -0
  76. package/dist/esm/helpers/memoize.mjs +21 -0
  77. package/dist/esm/helpers/memoize.mjs.map +1 -0
  78. package/dist/esm/helpers/requireTamaguiCore.mjs +19 -0
  79. package/dist/esm/helpers/requireTamaguiCore.mjs.map +1 -0
  80. package/dist/esm/index.mjs +8 -0
  81. package/dist/esm/index.mjs.map +1 -0
  82. package/dist/esm/registerRequire.mjs +195 -0
  83. package/dist/esm/registerRequire.mjs.map +1 -0
  84. package/dist/esm/server.mjs +40 -0
  85. package/dist/esm/server.mjs.map +1 -0
  86. package/dist/esm/setup.mjs +0 -0
  87. package/dist/esm/staticEvaluationIgnoredModules.mjs +61 -0
  88. package/dist/esm/staticEvaluationIgnoredModules.mjs.map +1 -0
  89. package/dist/esm/types.mjs +0 -0
  90. package/dist/esm/zero/artifact.mjs +119 -0
  91. package/dist/esm/zero/artifact.mjs.map +1 -0
  92. package/dist/esm/zero/graph.mjs +170 -0
  93. package/dist/esm/zero/graph.mjs.map +1 -0
  94. package/dist/esm/zero/identity.mjs +36 -0
  95. package/dist/esm/zero/identity.mjs.map +1 -0
  96. package/dist/esm/zero/index.mjs +19 -0
  97. package/dist/esm/zero/islands.mjs +201 -0
  98. package/dist/esm/zero/islands.mjs.map +1 -0
  99. package/dist/esm/zero/options.mjs +129 -0
  100. package/dist/esm/zero/options.mjs.map +1 -0
  101. package/dist/esm/zero/ownership.mjs +48 -0
  102. package/dist/esm/zero/ownership.mjs.map +1 -0
  103. package/dist/esm/zero/theme.mjs +313 -0
  104. package/dist/esm/zero/theme.mjs.map +1 -0
  105. package/dist/esm/zero/transform.mjs +182 -0
  106. package/dist/esm/zero/transform.mjs.map +1 -0
  107. package/package.json +38 -47
  108. package/src/check-dep-versions.ts +2 -2
  109. package/src/checkDeps.ts +3 -2
  110. package/src/compiler.ts +506 -0
  111. package/src/compilerHost.ts +3739 -0
  112. package/src/componentDiscovery.ts +105 -0
  113. package/src/constants.ts +0 -5
  114. package/src/domStructuralPass.ts +190 -0
  115. package/src/exports.ts +5 -6
  116. package/src/extractor/addLocalExports.ts +49 -0
  117. package/src/extractor/bundle.ts +38 -40
  118. package/src/extractor/bundleConfig.ts +368 -187
  119. package/src/extractor/concatClassName.ts +21 -24
  120. package/src/extractor/getTamaguiConfigPathFromOptionsConfig.ts +13 -5
  121. package/src/extractor/loadTamagui.ts +196 -143
  122. package/src/extractor/regenerateConfig.ts +65 -13
  123. package/src/extractor/watchTamaguiConfig.ts +6 -1
  124. package/src/helpers/requireTamaguiCore.ts +6 -1
  125. package/src/registerRequire.ts +94 -132
  126. package/src/staticEvaluationIgnoredModules.ts +74 -0
  127. package/src/types.ts +2 -107
  128. package/src/zero/artifact.ts +142 -0
  129. package/src/zero/graph.ts +359 -0
  130. package/src/zero/identity.ts +73 -0
  131. package/src/zero/index.ts +9 -0
  132. package/src/zero/islands.ts +266 -0
  133. package/src/zero/options.ts +239 -0
  134. package/src/zero/ownership.ts +113 -0
  135. package/src/zero/theme.ts +526 -0
  136. package/src/zero/transform.ts +329 -0
  137. package/types/check-dep-versions.d.ts.map +1 -1
  138. package/types/checkDeps.d.ts.map +1 -1
  139. package/types/compiler.d.ts +134 -0
  140. package/types/compiler.d.ts.map +1 -0
  141. package/types/compilerHost.d.ts +38 -0
  142. package/types/compilerHost.d.ts.map +1 -0
  143. package/types/componentDiscovery.d.ts +27 -0
  144. package/types/componentDiscovery.d.ts.map +1 -0
  145. package/types/constants.d.ts +0 -1
  146. package/types/constants.d.ts.map +1 -1
  147. package/types/domStructuralPass.d.ts +3 -0
  148. package/types/domStructuralPass.d.ts.map +1 -0
  149. package/types/exports.d.ts +5 -6
  150. package/types/exports.d.ts.map +1 -1
  151. package/types/extractor/addLocalExports.d.ts +3 -0
  152. package/types/extractor/addLocalExports.d.ts.map +1 -0
  153. package/types/extractor/bundle.d.ts +66 -65
  154. package/types/extractor/bundle.d.ts.map +1 -1
  155. package/types/extractor/bundleConfig.d.ts +26 -4
  156. package/types/extractor/bundleConfig.d.ts.map +1 -1
  157. package/types/extractor/esbuildAliasPlugin.d.ts.map +1 -1
  158. package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts +1 -1
  159. package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts.map +1 -1
  160. package/types/extractor/loadTamagui.d.ts +26 -3
  161. package/types/extractor/loadTamagui.d.ts.map +1 -1
  162. package/types/extractor/regenerateConfig.d.ts +1 -1
  163. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  164. package/types/extractor/watchTamaguiConfig.d.ts.map +1 -1
  165. package/types/getPragmaOptions.d.ts +1 -1
  166. package/types/helpers/memoize.d.ts +1 -1
  167. package/types/helpers/memoize.d.ts.map +1 -1
  168. package/types/helpers/requireTamaguiCore.d.ts.map +1 -1
  169. package/types/index.d.ts.map +1 -1
  170. package/types/registerRequire.d.ts +2 -2
  171. package/types/registerRequire.d.ts.map +1 -1
  172. package/types/staticEvaluationIgnoredModules.d.ts +9 -0
  173. package/types/staticEvaluationIgnoredModules.d.ts.map +1 -0
  174. package/types/types.d.ts +2 -90
  175. package/types/types.d.ts.map +1 -1
  176. package/types/zero/artifact.d.ts +44 -0
  177. package/types/zero/artifact.d.ts.map +1 -0
  178. package/types/zero/graph.d.ts +139 -0
  179. package/types/zero/graph.d.ts.map +1 -0
  180. package/types/zero/identity.d.ts +33 -0
  181. package/types/zero/identity.d.ts.map +1 -0
  182. package/types/zero/index.d.ts +10 -0
  183. package/types/zero/index.d.ts.map +1 -0
  184. package/types/zero/islands.d.ts +56 -0
  185. package/types/zero/islands.d.ts.map +1 -0
  186. package/types/zero/options.d.ts +58 -0
  187. package/types/zero/options.d.ts.map +1 -0
  188. package/types/zero/ownership.d.ts +51 -0
  189. package/types/zero/ownership.d.ts.map +1 -0
  190. package/types/zero/theme.d.ts +85 -0
  191. package/types/zero/theme.d.ts.map +1 -0
  192. package/types/zero/transform.d.ts +53 -0
  193. package/types/zero/transform.d.ts.map +1 -0
  194. package/dist/check-dep-versions.cjs +0 -372
  195. package/dist/checkDeps.cjs +0 -271
  196. package/dist/constants.cjs +0 -51
  197. package/dist/exports.cjs +0 -48
  198. package/dist/extractor/accessSafe.cjs +0 -48
  199. package/dist/extractor/babelParse.cjs +0 -56
  200. package/dist/extractor/buildClassName.cjs +0 -86
  201. package/dist/extractor/bundle.cjs +0 -234
  202. package/dist/extractor/bundleConfig.cjs +0 -729
  203. package/dist/extractor/concatClassName.cjs +0 -129
  204. package/dist/extractor/createEvaluator.cjs +0 -88
  205. package/dist/extractor/createExtractor.cjs +0 -1968
  206. package/dist/extractor/createLogger.cjs +0 -50
  207. package/dist/extractor/detectModuleFormat.cjs +0 -55
  208. package/dist/extractor/ensureImportingConcat.cjs +0 -54
  209. package/dist/extractor/errors.cjs +0 -28
  210. package/dist/extractor/esbuildAliasPlugin.cjs +0 -56
  211. package/dist/extractor/esbuildTsconfigPaths.cjs +0 -108
  212. package/dist/extractor/evaluateAstNode.cjs +0 -128
  213. package/dist/extractor/extractHelpers.cjs +0 -182
  214. package/dist/extractor/extractMediaStyle.cjs +0 -169
  215. package/dist/extractor/extractToClassNames.cjs +0 -475
  216. package/dist/extractor/extractToNative.cjs +0 -369
  217. package/dist/extractor/findTopmostFunction.cjs +0 -43
  218. package/dist/extractor/generatedUid.cjs +0 -58
  219. package/dist/extractor/getPrefixLogs.cjs +0 -31
  220. package/dist/extractor/getPropValueFromAttributes.cjs +0 -85
  221. package/dist/extractor/getSourceModule.cjs +0 -100
  222. package/dist/extractor/getStaticBindingsForScope.cjs +0 -213
  223. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +0 -41
  224. package/dist/extractor/hasTopLevelAwait.cjs +0 -62
  225. package/dist/extractor/hoistClassNames.cjs +0 -76
  226. package/dist/extractor/literalToAst.cjs +0 -109
  227. package/dist/extractor/loadFile.cjs +0 -17
  228. package/dist/extractor/loadTamagui.cjs +0 -373
  229. package/dist/extractor/logLines.cjs +0 -43
  230. package/dist/extractor/normalizeTernaries.cjs +0 -100
  231. package/dist/extractor/propsToFontFamilyCache.cjs +0 -42
  232. package/dist/extractor/regenerateConfig.cjs +0 -178
  233. package/dist/extractor/removeUnusedHooks.cjs +0 -108
  234. package/dist/extractor/timer.cjs +0 -52
  235. package/dist/extractor/validHTMLAttributes.cjs +0 -79
  236. package/dist/extractor/watchTamaguiConfig.cjs +0 -70
  237. package/dist/getPragmaOptions.cjs +0 -73
  238. package/dist/helpers/memoize.cjs +0 -45
  239. package/dist/helpers/requireTamaguiCore.cjs +0 -40
  240. package/dist/index.cjs +0 -42
  241. package/dist/registerRequire.cjs +0 -209
  242. package/dist/server.cjs +0 -82
  243. package/dist/types.cjs +0 -18
  244. package/dist/worker.cjs +0 -111
  245. package/src/extractor/accessSafe.ts +0 -22
  246. package/src/extractor/babelParse.ts +0 -38
  247. package/src/extractor/buildClassName.ts +0 -76
  248. package/src/extractor/createEvaluator.ts +0 -82
  249. package/src/extractor/createExtractor.ts +0 -2970
  250. package/src/extractor/createLogger.ts +0 -41
  251. package/src/extractor/ensureImportingConcat.ts +0 -36
  252. package/src/extractor/errors.ts +0 -1
  253. package/src/extractor/evaluateAstNode.ts +0 -136
  254. package/src/extractor/extractHelpers.ts +0 -211
  255. package/src/extractor/extractMediaStyle.ts +0 -194
  256. package/src/extractor/extractToClassNames.ts +0 -733
  257. package/src/extractor/extractToNative.ts +0 -506
  258. package/src/extractor/findTopmostFunction.ts +0 -24
  259. package/src/extractor/generatedUid.ts +0 -41
  260. package/src/extractor/getPrefixLogs.ts +0 -9
  261. package/src/extractor/getPropValueFromAttributes.ts +0 -95
  262. package/src/extractor/getSourceModule.ts +0 -96
  263. package/src/extractor/getStaticBindingsForScope.ts +0 -237
  264. package/src/extractor/hasTopLevelAwait.ts +0 -28
  265. package/src/extractor/hoistClassNames.ts +0 -52
  266. package/src/extractor/literalToAst.ts +0 -85
  267. package/src/extractor/loadFile.ts +0 -17
  268. package/src/extractor/logLines.ts +0 -16
  269. package/src/extractor/normalizeTernaries.ts +0 -89
  270. package/src/extractor/propsToFontFamilyCache.ts +0 -18
  271. package/src/extractor/removeUnusedHooks.ts +0 -83
  272. package/src/extractor/timer.ts +0 -25
  273. package/src/extractor/validHTMLAttributes.ts +0 -52
  274. package/src/worker.ts +0 -142
  275. package/types/extractor/accessSafe.d.ts +0 -3
  276. package/types/extractor/accessSafe.d.ts.map +0 -1
  277. package/types/extractor/babelParse.d.ts +0 -5
  278. package/types/extractor/babelParse.d.ts.map +0 -1
  279. package/types/extractor/buildClassName.d.ts +0 -7
  280. package/types/extractor/buildClassName.d.ts.map +0 -1
  281. package/types/extractor/createEvaluator.d.ts +0 -12
  282. package/types/extractor/createEvaluator.d.ts.map +0 -1
  283. package/types/extractor/createExtractor.d.ts +0 -32
  284. package/types/extractor/createExtractor.d.ts.map +0 -1
  285. package/types/extractor/createLogger.d.ts +0 -3
  286. package/types/extractor/createLogger.d.ts.map +0 -1
  287. package/types/extractor/ensureImportingConcat.d.ts +0 -4
  288. package/types/extractor/ensureImportingConcat.d.ts.map +0 -1
  289. package/types/extractor/errors.d.ts +0 -3
  290. package/types/extractor/errors.d.ts.map +0 -1
  291. package/types/extractor/evaluateAstNode.d.ts +0 -3
  292. package/types/extractor/evaluateAstNode.d.ts.map +0 -1
  293. package/types/extractor/extractHelpers.d.ts +0 -28
  294. package/types/extractor/extractHelpers.d.ts.map +0 -1
  295. package/types/extractor/extractMediaStyle.d.ts +0 -11
  296. package/types/extractor/extractMediaStyle.d.ts.map +0 -1
  297. package/types/extractor/extractToClassNames.d.ts +0 -25
  298. package/types/extractor/extractToClassNames.d.ts.map +0 -1
  299. package/types/extractor/extractToNative.d.ts +0 -13
  300. package/types/extractor/extractToNative.d.ts.map +0 -1
  301. package/types/extractor/findTopmostFunction.d.ts +0 -4
  302. package/types/extractor/findTopmostFunction.d.ts.map +0 -1
  303. package/types/extractor/generatedUid.d.ts +0 -5
  304. package/types/extractor/generatedUid.d.ts.map +0 -1
  305. package/types/extractor/getPrefixLogs.d.ts +0 -3
  306. package/types/extractor/getPrefixLogs.d.ts.map +0 -1
  307. package/types/extractor/getPropValueFromAttributes.d.ts +0 -19
  308. package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -1
  309. package/types/extractor/getSourceModule.d.ts +0 -16
  310. package/types/extractor/getSourceModule.d.ts.map +0 -1
  311. package/types/extractor/getStaticBindingsForScope.d.ts +0 -5
  312. package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -1
  313. package/types/extractor/hasTopLevelAwait.d.ts +0 -2
  314. package/types/extractor/hasTopLevelAwait.d.ts.map +0 -1
  315. package/types/extractor/hoistClassNames.d.ts +0 -6
  316. package/types/extractor/hoistClassNames.d.ts.map +0 -1
  317. package/types/extractor/literalToAst.d.ts +0 -4
  318. package/types/extractor/literalToAst.d.ts.map +0 -1
  319. package/types/extractor/loadFile.d.ts +0 -1
  320. package/types/extractor/loadFile.d.ts.map +0 -1
  321. package/types/extractor/logLines.d.ts +0 -2
  322. package/types/extractor/logLines.d.ts.map +0 -1
  323. package/types/extractor/normalizeTernaries.d.ts +0 -5
  324. package/types/extractor/normalizeTernaries.d.ts.map +0 -1
  325. package/types/extractor/propsToFontFamilyCache.d.ts +0 -4
  326. package/types/extractor/propsToFontFamilyCache.d.ts.map +0 -1
  327. package/types/extractor/removeUnusedHooks.d.ts +0 -3
  328. package/types/extractor/removeUnusedHooks.d.ts.map +0 -1
  329. package/types/extractor/timer.d.ts +0 -5
  330. package/types/extractor/timer.d.ts.map +0 -1
  331. package/types/extractor/validHTMLAttributes.d.ts +0 -52
  332. package/types/extractor/validHTMLAttributes.d.ts.map +0 -1
  333. package/types/worker.d.ts +0 -46
  334. package/types/worker.d.ts.map +0 -1
  335. /package/dist/{setup.cjs → cjs/setup.cjs} +0 -0
@@ -0,0 +1,2287 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var compilerHost_exports = {};
22
+ __export(compilerHost_exports, {
23
+ createComponentRegistry: () => createComponentRegistry,
24
+ createTamaguiCompilerHost: () => createTamaguiCompilerHost
25
+ });
26
+ module.exports = __toCommonJS(compilerHost_exports);
27
+ var import_compiler_core = require("@tamagui/compiler-core");
28
+ var import_helpers = require("@tamagui/helpers");
29
+ var import_dom = require("@tamagui/dom");
30
+ var import_animation_helpers = require("@tamagui/animation-helpers");
31
+ var import_tooling = require("@tamagui/style-grammar/tooling");
32
+ var import_web = require("@tamagui/web");
33
+ var import_concatClassName = require("./extractor/concatClassName.cjs");
34
+ var import_requireTamaguiCore = require("./helpers/requireTamaguiCore.cjs");
35
+ function createComponentRegistry(components, componentModules) {
36
+ return {
37
+ modulesById: new Map(componentModules.map((module2) => [module2.resolvedId, module2.moduleName])),
38
+ componentsByModule: new Map(components.map((component) => [component.moduleName, component]))
39
+ };
40
+ }
41
+ const DOM_FRONTENDS = /* @__PURE__ */ new Set([
42
+ "tamagui",
43
+ "tamagui/dom",
44
+ "@tamagui/core",
45
+ "@tamagui/core/dom",
46
+ "@tamagui/tailwind"
47
+ ]);
48
+ const componentState = {
49
+ focus: false,
50
+ focusVisible: false,
51
+ focusWithin: false,
52
+ hover: false,
53
+ unmounted: true,
54
+ press: false,
55
+ pressIn: false,
56
+ disabled: false
57
+ };
58
+ function staticObject(value) {
59
+ return !!value && typeof value === "object" && !Array.isArray(value);
60
+ }
61
+ const flatClausePattern = /(?:^|\s)@?[A-Za-z][A-Za-z0-9-]*(?:\/[A-Za-z0-9_-]+)?:/;
62
+ const nativeInheritedKeywordPattern = /(?:^|:)(?:inherit|unset)(?=\s|$)/;
63
+ const nativeInitialKeywordPattern = /(?:^|:)initial(?=\s|$)/;
64
+ const nativeRuntimeOnlyStyleProperties = /* @__PURE__ */ new Set(["textIndent"]);
65
+ function componentKey(resolvedId, exportName) {
66
+ return `${resolvedId}#${exportName}`;
67
+ }
68
+ function jsxClassName(value) {
69
+ return `className=${JSON.stringify(value)}`;
70
+ }
71
+ function objectClassName(value) {
72
+ return `className: ${JSON.stringify(value)}`;
73
+ }
74
+ function serializedStyle(style, dynamicProperties) {
75
+ if (dynamicProperties.length === 0) return style ? JSON.stringify(style) : "";
76
+ return `{ ${[...style ? Object.entries(style).map(([name, value]) => `${JSON.stringify(name)}: ${JSON.stringify(value)}`) : [], ...dynamicProperties].join(", ")} }`;
77
+ }
78
+ function jsxStyleAttributes(className, style, dynamicProperties = []) {
79
+ const serialized = serializedStyle(style, dynamicProperties);
80
+ return [className ? jsxClassName(className) : "", serialized ? `style={${serialized}}` : ""].filter(Boolean).join(" ");
81
+ }
82
+ function objectStyleProperties(className, style, dynamicProperties = []) {
83
+ const serialized = serializedStyle(style, dynamicProperties);
84
+ return [className ? objectClassName(className) : "", serialized ? `style: ${serialized}` : ""].filter(Boolean).join(", ");
85
+ }
86
+ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true, hasStyleFrontend = false) {
87
+ const callerClassName = !hasStyleFrontend && typeof props.className === "string" ? props.className : "";
88
+ const viewClassName = typeof split.viewProps?.className === "string" ? split.viewProps.className : "";
89
+ const classNameWithoutCaller = callerClassName && viewClassName.endsWith(callerClassName) ? viewClassName.slice(0, -callerClassName.length).trimEnd() : viewClassName;
90
+ const rules = split.rulesToInsert ?? {};
91
+ const mediaNames = Object.keys(config.media ?? {});
92
+ const rulesByIdentifier = /* @__PURE__ */ new Map();
93
+ for (const styleObject of Object.values(rules)) {
94
+ const identifier = styleObject?.[import_helpers.StyleObjectIdentifier];
95
+ const styleRules = styleObject?.[import_helpers.StyleObjectRules];
96
+ if (typeof identifier !== "string" || !Array.isArray(styleRules)) continue;
97
+ const existing = rulesByIdentifier.get(identifier);
98
+ if (existing) existing.push(...styleRules);
99
+ else rulesByIdentifier.set(identifier, [...styleRules]);
100
+ }
101
+ const pseudoNames = [
102
+ "hover",
103
+ "press",
104
+ "focus",
105
+ "focusVisible",
106
+ "focusWithin",
107
+ "disabled"
108
+ ];
109
+ const buckets = {
110
+ group: [],
111
+ normal: [],
112
+ pseudo: [],
113
+ theme: [],
114
+ media: []
115
+ };
116
+ const classKeys = /* @__PURE__ */ new Map();
117
+ for (const [key, identifier] of Object.entries(split.classNames ?? {})) {
118
+ if (typeof identifier === "string") classKeys.set(identifier, key);
119
+ }
120
+ const identifiers = /* @__PURE__ */ new Set([...classKeys.keys(), ...Object.values(rules).flatMap((styleObject) => {
121
+ const identifier = styleObject?.[import_helpers.StyleObjectIdentifier];
122
+ return typeof identifier === "string" ? [identifier] : [];
123
+ })]);
124
+ for (const identifier of identifiers) {
125
+ const key = classKeys.get(identifier) ?? "";
126
+ const css2 = (rulesByIdentifier.get(identifier) ?? []).join("");
127
+ if (identifier.startsWith("t_group_")) {
128
+ buckets.group.push(identifier);
129
+ } else if (pseudoNames.some((name) => key.endsWith(`-${name}`))) {
130
+ buckets.pseudo.push(identifier);
131
+ } else if (css2.includes(".t_")) {
132
+ buckets.theme.push(identifier);
133
+ } else if (mediaNames.some((name) => key.endsWith(`-${name}`))) {
134
+ buckets.media.push(identifier);
135
+ } else {
136
+ buckets.normal.push(identifier);
137
+ }
138
+ }
139
+ const orderedIdentifiers = [
140
+ ...buckets.group,
141
+ ...buckets.normal,
142
+ ...buckets.pseudo,
143
+ ...buckets.theme,
144
+ ...buckets.media
145
+ ];
146
+ const orderedSet = new Set(orderedIdentifiers);
147
+ const baseViewClassName = includeRuntimeBase ? classNameWithoutCaller.split(/\s+/).filter((token) => token && !orderedSet.has(token)).join(" ") : "";
148
+ const css = orderedIdentifiers.flatMap((identifier) => {
149
+ const identifierRules = rulesByIdentifier.get(identifier) ?? [];
150
+ return buckets.theme.includes(identifier) ? identifierRules.map((rule) => rule.replace(":root:root:root.t_", ":root:root:root:root.t_")) : identifierRules;
151
+ });
152
+ return {
153
+ className: (0, import_concatClassName.concatClassName)(baseViewClassName, orderedIdentifiers, callerClassName),
154
+ css
155
+ };
156
+ }
157
+ function spreadNonStyleReplacement(form, entry, isPropIgnored, rewriteProp) {
158
+ if (entry.kind !== "spread" || entry.value.kind !== "static" || !staticObject(entry.value.value)) {
159
+ return "";
160
+ }
161
+ const nonStyleEntries = Object.entries(entry.value.value).filter(([key]) => !isPropIgnored(key)).map(([key, value]) => rewriteProp(key, value));
162
+ if (nonStyleEntries.length === 0) return "";
163
+ const objectSource = `{ ${nonStyleEntries.map(([key, value]) => `${JSON.stringify(key)}: ${JSON.stringify(value)}`).join(", ")} }`;
164
+ return form === "jsx" ? `{...${objectSource}}` : `...${objectSource}`;
165
+ }
166
+ function compiledPropsEdits(input, styleEntries, replacement, spreadReplacement) {
167
+ const propsSpan = input.element.propsSpan;
168
+ if (!propsSpan) return null;
169
+ const original = input.source.slice(propsSpan.start, propsSpan.end);
170
+ const trimmed = original.trim();
171
+ if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
172
+ return [{
173
+ start: propsSpan.start,
174
+ end: propsSpan.end,
175
+ content: `{ ${replacement} }`,
176
+ origin: propsSpan
177
+ }];
178
+ }
179
+ if (styleEntries.length === 0) {
180
+ const close = original.lastIndexOf("}");
181
+ const separator = original.slice(1, close).trim() ? ", " : " ";
182
+ const position = propsSpan.start + close;
183
+ return [{
184
+ start: position,
185
+ end: position,
186
+ content: `${separator}${replacement} `,
187
+ origin: propsSpan
188
+ }];
189
+ }
190
+ const edits = [];
191
+ for (const [index, entry] of styleEntries.entries()) {
192
+ let start = entry.span.start;
193
+ let end = entry.span.end;
194
+ const nonStyle = spreadReplacement?.(entry) ?? "";
195
+ if (index === 0) {
196
+ const content = [replacement, nonStyle].filter(Boolean).join(", ");
197
+ edits.push({
198
+ start,
199
+ end,
200
+ content,
201
+ origin: entry.span
202
+ });
203
+ continue;
204
+ }
205
+ let cursor = end - propsSpan.start;
206
+ while (cursor < original.length - 1 && /\s/.test(original[cursor])) cursor++;
207
+ if (original[cursor] === ",") {
208
+ end = propsSpan.start + cursor + 1;
209
+ } else {
210
+ cursor = start - propsSpan.start - 1;
211
+ while (cursor > 0 && /\s/.test(original[cursor])) cursor--;
212
+ if (original[cursor] === ",") start = propsSpan.start + cursor;
213
+ }
214
+ edits.push({
215
+ start,
216
+ end,
217
+ content: nonStyle,
218
+ origin: entry.span
219
+ });
220
+ }
221
+ const merged = [];
222
+ for (const edit of edits.sort((left, right) => left.start - right.start)) {
223
+ const previous = merged.at(-1);
224
+ if (previous && edit.start <= previous.end && !previous.content && !edit.content) {
225
+ previous.end = Math.max(previous.end, edit.end);
226
+ } else {
227
+ merged.push(edit);
228
+ }
229
+ }
230
+ return merged;
231
+ }
232
+ const compilerStyleProps = /* @__PURE__ */ new Set([
233
+ "className",
234
+ "style",
235
+ "group",
236
+ "transition",
237
+ "animation",
238
+ "animatePresence",
239
+ "animatedBy",
240
+ "fontFamily",
241
+ "render"
242
+ ]);
243
+ const runtimeAnimationProps = /* @__PURE__ */ new Set([
244
+ "transition",
245
+ "animation",
246
+ "animatePresence",
247
+ "animatedBy"
248
+ ]);
249
+ const componentOnlyProps = /* @__PURE__ */ new Set([
250
+ "asChild",
251
+ "disableOptimization",
252
+ "themeInverse"
253
+ ]);
254
+ const cssShorthandConflicts = {
255
+ background: [
256
+ "backgroundAttachment",
257
+ "backgroundBlendMode",
258
+ "backgroundClip",
259
+ "backgroundColor",
260
+ "backgroundImage",
261
+ "backgroundOrigin",
262
+ "backgroundPosition",
263
+ "backgroundRepeat",
264
+ "backgroundSize"
265
+ ],
266
+ border: [
267
+ "borderTop",
268
+ "borderTopColor",
269
+ "borderTopStyle",
270
+ "borderTopWidth",
271
+ "borderRight",
272
+ "borderRightColor",
273
+ "borderRightStyle",
274
+ "borderRightWidth",
275
+ "borderBottom",
276
+ "borderBottomColor",
277
+ "borderBottomStyle",
278
+ "borderBottomWidth",
279
+ "borderLeft",
280
+ "borderLeftColor",
281
+ "borderLeftStyle",
282
+ "borderLeftWidth",
283
+ "borderColor",
284
+ "borderStyle",
285
+ "borderWidth",
286
+ "borderImage",
287
+ "borderImageOutset",
288
+ "borderImageRepeat",
289
+ "borderImageSlice",
290
+ "borderImageSource",
291
+ "borderImageWidth",
292
+ "borderInlineColor",
293
+ "borderInlineEndColor",
294
+ "borderInlineEndStyle",
295
+ "borderInlineEndWidth",
296
+ "borderInlineStartColor",
297
+ "borderInlineStartStyle",
298
+ "borderInlineStartWidth",
299
+ "borderInlineStyle",
300
+ "borderInlineWidth"
301
+ ],
302
+ borderTop: [
303
+ "borderTopColor",
304
+ "borderTopStyle",
305
+ "borderTopWidth"
306
+ ],
307
+ borderRight: [
308
+ "borderRightColor",
309
+ "borderRightStyle",
310
+ "borderRightWidth",
311
+ "borderInlineColor",
312
+ "borderInlineEndColor",
313
+ "borderInlineEndStyle",
314
+ "borderInlineEndWidth",
315
+ "borderInlineStartColor",
316
+ "borderInlineStartStyle",
317
+ "borderInlineStartWidth",
318
+ "borderInlineStyle",
319
+ "borderInlineWidth"
320
+ ],
321
+ borderBottom: [
322
+ "borderBottomColor",
323
+ "borderBottomStyle",
324
+ "borderBottomWidth"
325
+ ],
326
+ borderLeft: [
327
+ "borderLeftColor",
328
+ "borderLeftStyle",
329
+ "borderLeftWidth",
330
+ "borderInlineColor",
331
+ "borderInlineEndColor",
332
+ "borderInlineEndStyle",
333
+ "borderInlineEndWidth",
334
+ "borderInlineStartColor",
335
+ "borderInlineStartStyle",
336
+ "borderInlineStartWidth",
337
+ "borderInlineStyle",
338
+ "borderInlineWidth"
339
+ ],
340
+ borderImage: [
341
+ "borderImageOutset",
342
+ "borderImageRepeat",
343
+ "borderImageSlice",
344
+ "borderImageSource",
345
+ "borderImageWidth"
346
+ ],
347
+ outline: [
348
+ "outlineColor",
349
+ "outlineStyle",
350
+ "outlineWidth"
351
+ ],
352
+ gap: ["columnGap", "rowGap"],
353
+ gridColumn: ["gridColumnEnd", "gridColumnStart"],
354
+ gridRow: ["gridRowEnd", "gridRowStart"],
355
+ marginInline: [
356
+ "marginInlineEnd",
357
+ "marginInlineStart",
358
+ "marginEnd",
359
+ "marginStart",
360
+ "marginLeft",
361
+ "marginRight"
362
+ ],
363
+ paddingInline: [
364
+ "paddingInlineEnd",
365
+ "paddingInlineStart",
366
+ "paddingEnd",
367
+ "paddingStart",
368
+ "paddingLeft",
369
+ "paddingRight"
370
+ ],
371
+ insetInline: [
372
+ "insetInlineEnd",
373
+ "insetInlineStart",
374
+ "end",
375
+ "start",
376
+ "left",
377
+ "right"
378
+ ],
379
+ borderInlineColor: [
380
+ "borderInlineEndColor",
381
+ "borderInlineStartColor",
382
+ "borderEndColor",
383
+ "borderStartColor",
384
+ "borderLeftColor",
385
+ "borderRightColor"
386
+ ],
387
+ borderInlineStyle: [
388
+ "borderInlineEndStyle",
389
+ "borderInlineStartStyle",
390
+ "borderEndStyle",
391
+ "borderStartStyle",
392
+ "borderLeftStyle",
393
+ "borderRightStyle"
394
+ ],
395
+ borderInlineWidth: [
396
+ "borderInlineEndWidth",
397
+ "borderInlineStartWidth",
398
+ "borderEndWidth",
399
+ "borderStartWidth",
400
+ "borderLeftWidth",
401
+ "borderRightWidth"
402
+ ],
403
+ mask: [
404
+ "maskBorder",
405
+ "maskBorderMode",
406
+ "maskBorderOutset",
407
+ "maskBorderRepeat",
408
+ "maskBorderSlice",
409
+ "maskBorderSource",
410
+ "maskBorderWidth",
411
+ "maskClip",
412
+ "maskComposite",
413
+ "maskImage",
414
+ "maskMode",
415
+ "maskOrigin",
416
+ "maskPosition",
417
+ "maskRepeat",
418
+ "maskSize"
419
+ ],
420
+ maskBorder: [
421
+ "maskBorderMode",
422
+ "maskBorderOutset",
423
+ "maskBorderRepeat",
424
+ "maskBorderSlice",
425
+ "maskBorderSource",
426
+ "maskBorderWidth"
427
+ ]
428
+ };
429
+ const cssConflictFamilies = [
430
+ /* @__PURE__ */ new Set(["width", "inlineSize"]),
431
+ /* @__PURE__ */ new Set(["minWidth", "minInlineSize"]),
432
+ /* @__PURE__ */ new Set(["maxWidth", "maxInlineSize"]),
433
+ /* @__PURE__ */ new Set(["height", "blockSize"]),
434
+ /* @__PURE__ */ new Set(["minHeight", "minBlockSize"]),
435
+ /* @__PURE__ */ new Set(["maxHeight", "maxBlockSize"]),
436
+ /* @__PURE__ */ new Set([
437
+ "marginInline",
438
+ "marginInlineEnd",
439
+ "marginInlineStart",
440
+ "marginEnd",
441
+ "marginStart",
442
+ "marginLeft",
443
+ "marginRight"
444
+ ]),
445
+ /* @__PURE__ */ new Set([
446
+ "paddingInline",
447
+ "paddingInlineEnd",
448
+ "paddingInlineStart",
449
+ "paddingEnd",
450
+ "paddingStart",
451
+ "paddingLeft",
452
+ "paddingRight"
453
+ ]),
454
+ /* @__PURE__ */ new Set([
455
+ "insetInline",
456
+ "insetInlineEnd",
457
+ "insetInlineStart",
458
+ "end",
459
+ "start",
460
+ "left",
461
+ "right"
462
+ ]),
463
+ /* @__PURE__ */ new Set([
464
+ "borderInlineColor",
465
+ "borderInlineEndColor",
466
+ "borderInlineStartColor",
467
+ "borderEndColor",
468
+ "borderStartColor",
469
+ "borderLeftColor",
470
+ "borderRightColor"
471
+ ]),
472
+ /* @__PURE__ */ new Set([
473
+ "borderInlineStyle",
474
+ "borderInlineEndStyle",
475
+ "borderInlineStartStyle",
476
+ "borderEndStyle",
477
+ "borderStartStyle",
478
+ "borderLeftStyle",
479
+ "borderRightStyle"
480
+ ]),
481
+ /* @__PURE__ */ new Set([
482
+ "borderInlineWidth",
483
+ "borderInlineEndWidth",
484
+ "borderInlineStartWidth",
485
+ "borderEndWidth",
486
+ "borderStartWidth",
487
+ "borderLeftWidth",
488
+ "borderRightWidth"
489
+ ])
490
+ ];
491
+ function cssOwnersConflict(left, right) {
492
+ for (const leftOwner of left) {
493
+ for (const rightOwner of right) {
494
+ if (leftOwner === rightOwner || cssShorthandConflicts[leftOwner]?.includes(rightOwner) || cssShorthandConflicts[rightOwner]?.includes(leftOwner) || cssConflictFamilies.some((family) => family.has(leftOwner) && family.has(rightOwner))) {
495
+ return true;
496
+ }
497
+ }
498
+ }
499
+ return false;
500
+ }
501
+ const runtimeEventProps = /* @__PURE__ */ new Set([
502
+ "onHoverIn",
503
+ "onHoverOut",
504
+ "onLongPress",
505
+ "onPress",
506
+ "onPressIn",
507
+ "onPressOut"
508
+ ]);
509
+ const DOM_STYLE_ATTRIBUTES = new Map(Object.entries(import_dom.ATTRIBUTES).filter(([name, row]) => row.native !== "none" && row.nativeProp && row.nativeProp !== name && row.nativeProp in import_helpers.stylePropsText).map(([name, row]) => [name, row.nativeProp]));
510
+ const nativePointerEventProps = /* @__PURE__ */ new Set([
511
+ "onPointerCancel",
512
+ "onPointerDown",
513
+ "onPointerEnter",
514
+ "onPointerLeave",
515
+ "onPointerMove",
516
+ "onPointerUp"
517
+ ]);
518
+ function isSerializableNativeStyle(value) {
519
+ if (value == null || typeof value === "number" || typeof value === "boolean") {
520
+ return true;
521
+ }
522
+ if (typeof value === "string") return true;
523
+ if (Array.isArray(value)) return value.every(isSerializableNativeStyle);
524
+ if (!staticObject(value)) return false;
525
+ const prototype = Object.getPrototypeOf(value);
526
+ if (prototype !== Object.prototype && prototype !== null) return false;
527
+ return Object.values(value).every(isSerializableNativeStyle);
528
+ }
529
+ function unusedIdentifier(source, base) {
530
+ let candidate = base;
531
+ let suffix = 0;
532
+ while (new RegExp(`\\b${candidate}\\b`).test(source)) {
533
+ candidate = `${base}${++suffix}`;
534
+ }
535
+ return candidate;
536
+ }
537
+ const VIEW_WRAPPER_PROPS = /^(aria-|accessibilityState$|accessibilityValue$|id$|tabIndex$|nativeID$)/;
538
+ function isBareHostView(element) {
539
+ return !element.entries.some((entry) => entry.kind === "child" || entry.kind === "spread" || entry.kind === "prop" && VIEW_WRAPPER_PROPS.test(entry.name));
540
+ }
541
+ function entrySource(input, entry) {
542
+ return entry.value.kind === "static" ? JSON.stringify(entry.value.value) : input.source.slice(entry.value.span.start, entry.value.span.end);
543
+ }
544
+ function renamedPropEdit(input, entry, name) {
545
+ if (entry.name === name) return null;
546
+ const content = input.source.slice(entry.span.start, entry.span.end);
547
+ const offset = content.indexOf(entry.name);
548
+ if (offset === -1) return null;
549
+ const quoted = content[offset - 1] === "\"" || content[offset - 1] === "'";
550
+ return {
551
+ start: entry.span.start + offset,
552
+ end: entry.span.start + offset + entry.name.length,
553
+ content: input.element.form === "jsx" || quoted ? name : JSON.stringify(name),
554
+ origin: entry.span
555
+ };
556
+ }
557
+ function serializedProps(form, props) {
558
+ return props.map(([name, value]) => form === "jsx" ? `${name}={${value}}` : `${JSON.stringify(name)}: ${value}`).join(form === "jsx" ? " " : ", ");
559
+ }
560
+ function nativeDOMProps(input, tag) {
561
+ const consumed = [];
562
+ const edits = [];
563
+ const additions = [];
564
+ const nested = /* @__PURE__ */ new Map();
565
+ const entries = input.element.entries.filter((entry) => entry.kind === "prop");
566
+ const names = new Set(entries.map((entry) => entry.name));
567
+ if (names.has("ref") || tag === "br") additions.push(["__tag", JSON.stringify(tag)]);
568
+ if (import_dom.TAGS[tag].backing === "text" || import_dom.TAGS[tag].backing === "textinput") {
569
+ additions.push(["__inherit", "true"]);
570
+ }
571
+ const add = (name, value) => additions.push([name, value]);
572
+ const consume = (entry) => consumed.push(entry);
573
+ for (const entry of entries) {
574
+ const value = entrySource(input, entry);
575
+ const attribute = (entry.name in import_dom.ATTRIBUTES ? import_dom.ATTRIBUTES[entry.name] : void 0) ?? (entry.name.startsWith("data-") ? import_dom.ATTRIBUTES["data-*"] : void 0);
576
+ const event = entry.name in import_dom.EVENTS ? import_dom.EVENTS[entry.name] : void 0;
577
+ if (event) {
578
+ if (event.native === "none") {
579
+ return {
580
+ consumed,
581
+ edits,
582
+ additions,
583
+ diagnostic: `${entry.name} has no native DOM event equivalent`,
584
+ diagnosticSpan: entry.span
585
+ };
586
+ }
587
+ if (entry.name === "onKeyDown" && tag !== "input" && tag !== "textarea") {
588
+ return {
589
+ consumed,
590
+ edits,
591
+ additions,
592
+ diagnostic: `onKeyDown requires a native text-entry control`,
593
+ diagnosticSpan: entry.span
594
+ };
595
+ }
596
+ if ([
597
+ "onClick",
598
+ "onLoad",
599
+ "onError",
600
+ "onChange",
601
+ "onInput",
602
+ "onKeyDown"
603
+ ].includes(entry.name)) {
604
+ continue;
605
+ }
606
+ if (event.nativeProp) {
607
+ const edit2 = renamedPropEdit(input, entry, event.nativeProp);
608
+ if (edit2) edits.push(edit2);
609
+ }
610
+ continue;
611
+ }
612
+ if (!attribute || attribute.native === "none" || entry.name === "style") continue;
613
+ if (DOM_STYLE_ATTRIBUTES.has(entry.name)) {
614
+ if (entry.value.kind !== "static") {
615
+ return {
616
+ consumed,
617
+ edits,
618
+ additions,
619
+ diagnostic: `html.${tag} ${entry.name} must be statically known for native lowering`,
620
+ diagnosticSpan: entry.span
621
+ };
622
+ }
623
+ consume(entry);
624
+ continue;
625
+ }
626
+ if (entry.name === "hidden") {
627
+ if (entry.value.kind !== "static") {
628
+ return {
629
+ consumed,
630
+ edits,
631
+ additions,
632
+ diagnostic: `html.${tag} hidden must be statically known for native lowering`,
633
+ diagnosticSpan: entry.span
634
+ };
635
+ }
636
+ consume(entry);
637
+ continue;
638
+ }
639
+ if (entry.name === "tabIndex") {
640
+ consume(entry);
641
+ add("focusable", `(${value}) === 0`);
642
+ continue;
643
+ }
644
+ if (entry.name === "readOnly") {
645
+ consume(entry);
646
+ add("editable", `!(${value})`);
647
+ continue;
648
+ }
649
+ if (entry.name === "disabled") {
650
+ consume(entry);
651
+ add("disabled", value);
652
+ add("focusable", `!(${value})`);
653
+ if (tag === "input" || tag === "textarea") add("editable", `!(${value})`);
654
+ const state = nested.get("accessibilityState") ?? [];
655
+ state.push(["disabled", value]);
656
+ nested.set("accessibilityState", state);
657
+ continue;
658
+ }
659
+ if (entry.name === "type") {
660
+ consume(entry);
661
+ if (tag === "input" && entry.value.kind !== "static") {
662
+ return {
663
+ consumed,
664
+ edits,
665
+ additions,
666
+ diagnostic: `html.input type must be statically known for native lowering`,
667
+ diagnosticSpan: entry.span
668
+ };
669
+ }
670
+ if (tag === "input" && entry.value.kind === "static") {
671
+ const type = entry.value.value;
672
+ if (type === "password") add("secureTextEntry", "true");
673
+ else if (typeof type === "string" && type !== "text" && import_dom.NATIVE_INPUT_TYPES.includes(type)) {
674
+ if (!names.has("inputMode")) {
675
+ add("inputMode", JSON.stringify(type === "number" ? "numeric" : type));
676
+ }
677
+ }
678
+ }
679
+ continue;
680
+ }
681
+ if (entry.name === "aria-hidden") {
682
+ consume(entry);
683
+ add("accessibilityElementsHidden", value);
684
+ add("importantForAccessibility", `(${value}) ? "no-hide-descendants" : "auto"`);
685
+ continue;
686
+ }
687
+ if (entry.name === "aria-live") {
688
+ consume(entry);
689
+ add("accessibilityLiveRegion", entry.value.kind === "static" && entry.value.value === "off" ? "\"none\"" : value);
690
+ continue;
691
+ }
692
+ const nativeProp = attribute.nativeProp;
693
+ if (!nativeProp) continue;
694
+ if (nativeProp.includes(".")) {
695
+ consume(entry);
696
+ const [parent, child] = nativeProp.split(".");
697
+ const values = nested.get(parent) ?? [];
698
+ values.push([child, value]);
699
+ nested.set(parent, values);
700
+ continue;
701
+ }
702
+ const edit = renamedPropEdit(input, entry, nativeProp);
703
+ if (edit) edits.push(edit);
704
+ }
705
+ for (const [name, values] of nested) {
706
+ add(name, `{ ${values.map(([key, value]) => `${key}: ${value}`).join(", ")} }`);
707
+ }
708
+ if (!names.has("role") && import_dom.TAGS[tag].role) add("role", JSON.stringify(import_dom.TAGS[tag].role));
709
+ if (tag === "textarea") add("multiline", "true");
710
+ return {
711
+ consumed,
712
+ edits,
713
+ additions
714
+ };
715
+ }
716
+ function webDOMProps(input, tag) {
717
+ const edits = [];
718
+ const additions = [];
719
+ const entries = input.element.entries.filter((entry) => entry.kind === "prop");
720
+ const names = new Set(entries.map((entry) => entry.name));
721
+ for (const entry of entries) {
722
+ if (entry.name === "for") {
723
+ const edit = renamedPropEdit(input, entry, "htmlFor");
724
+ if (edit) edits.push(edit);
725
+ }
726
+ if (entry.name === "role" && entry.value.kind === "static" && entry.value.value === "none") {
727
+ edits.push({
728
+ start: entry.value.span.start,
729
+ end: entry.value.span.end,
730
+ content: JSON.stringify("presentation"),
731
+ origin: entry.value.span
732
+ });
733
+ }
734
+ }
735
+ if (tag === "button" && !names.has("type")) additions.push(["type", "\"button\""]);
736
+ if ((tag === "input" || tag === "textarea") && !names.has("dir")) {
737
+ additions.push(["dir", "\"auto\""]);
738
+ }
739
+ return {
740
+ edits,
741
+ additions
742
+ };
743
+ }
744
+ function createTamaguiCompilerHost(options) {
745
+ const platform = options.target === "native" ? "native" : "web";
746
+ const core = (0, import_requireTamaguiCore.requireTamaguiCore)(platform);
747
+ const compilerVariantStyleResolver = core.styled(core.View, {}).staticConfig.variantStyleResolver;
748
+ const firstThemeName = Object.keys(options.tamaguiConfig.themes ?? {})[0] ?? "";
749
+ const firstTheme = options.tamaguiConfig.themes?.[firstThemeName] ?? {};
750
+ const theme = firstTheme;
751
+ const modifierRegistry = (0, import_tooling.createModifierRegistry)({
752
+ mediaNames: options.tamaguiConfig.media ?? {},
753
+ themeNames: options.tamaguiConfig.themes ?? {}
754
+ }).registry;
755
+ const isClauseObjectValue = (value) => {
756
+ if (!staticObject(value)) return false;
757
+ if ("default" in value) return true;
758
+ for (const key in value) {
759
+ if (key.length === 0) return false;
760
+ let start = 0;
761
+ for (let index = 0; index <= key.length; index++) {
762
+ if (index !== key.length && key.charCodeAt(index) !== 58) continue;
763
+ if (modifierRegistry.get(key.slice(start, index)) === void 0) return false;
764
+ start = index + 1;
765
+ }
766
+ return true;
767
+ }
768
+ return false;
769
+ };
770
+ const platformModifiersRegistered = modifierRegistry.get("web") === "platform" && modifierRegistry.get("native") === "platform";
771
+ const nativeClauseValue = (value) => {
772
+ if (typeof value !== "string" || !flatClausePattern.test(value)) {
773
+ return isClauseObjectValue(value) ? "live" : null;
774
+ }
775
+ if (!platformModifiersRegistered) return "live";
776
+ const parsed = (0, import_tooling.parseValue)(value, modifierRegistry);
777
+ if (!parsed.ok || parsed.value.clauses.length === 0) return "live";
778
+ let payload = parsed.value.base;
779
+ let matched = parsed.value.base !== null;
780
+ for (const clause of parsed.value.clauses) {
781
+ if (clause.modifiers.includes("web")) continue;
782
+ if (clause.modifiers.length !== 1 || clause.modifiers[0] !== "native") return "live";
783
+ payload = clause.payload;
784
+ matched = true;
785
+ }
786
+ return {
787
+ payload,
788
+ matched
789
+ };
790
+ };
791
+ const configuredAnimationDriver = options.tamaguiConfig.animations;
792
+ const configuredCssAnimationDriver = platform === "web" && configuredAnimationDriver?.outputStyle === "css" && !options.tamaguiConfig.animationDrivers ? configuredAnimationDriver : null;
793
+ const resolveStaticCssTransition = (value, transitionPresets) => {
794
+ if (platform !== "web" || typeof value !== "string") return null;
795
+ const transitionPresetNames = new Set(Object.keys(transitionPresets));
796
+ const program = (0, import_tooling.parseValue)(value, modifierRegistry);
797
+ if (!program.ok) return null;
798
+ const resolvedPayloads = [];
799
+ const payloads = [program.value.base, ...program.value.clauses.map((clause) => clause.payload)].filter((payload) => payload !== null);
800
+ if (payloads.length === 0) return null;
801
+ for (const payload of payloads) {
802
+ const transition = (0, import_tooling.parseTransition)(payload, transitionPresetNames);
803
+ if (!transition.ok) return null;
804
+ if (transition.value.kind === "global") {
805
+ resolvedPayloads.push(payload);
806
+ continue;
807
+ }
808
+ const resolved2 = (0, import_animation_helpers.resolveTransition)(payload, { animations: transitionPresets });
809
+ if (resolved2.diagnostics.length > 0) return null;
810
+ if (!resolved2.fused) {
811
+ resolvedPayloads.push(payload);
812
+ continue;
813
+ }
814
+ const css = (0, import_animation_helpers.toCSSTransition)(resolved2);
815
+ if (css === void 0) return null;
816
+ resolvedPayloads.push(css);
817
+ }
818
+ let payloadIndex = 0;
819
+ const resolved = [];
820
+ if (program.value.base !== null) {
821
+ resolved.push(resolvedPayloads[payloadIndex++]);
822
+ }
823
+ for (const clause of program.value.clauses) {
824
+ resolved.push(`${clause.modifiers.join(":")}:${resolvedPayloads[payloadIndex++]}`);
825
+ }
826
+ return resolved.join(" ");
827
+ };
828
+ const { modulesById, componentsByModule } = options.registry ?? createComponentRegistry(options.components, options.componentModules);
829
+ const normalizedStyleConfigs = /* @__PURE__ */ new WeakMap();
830
+ const normalizeStaticConfig = (staticConfig) => {
831
+ if (!staticConfig.styleFrontend) return staticConfig;
832
+ const normalized = core.getStyleStaticConfig(staticConfig, options.tamaguiConfig);
833
+ const result = {
834
+ ...staticConfig,
835
+ baseStyle: normalized.baseStyle,
836
+ defaultProps: normalized.defaultProps,
837
+ variants: normalized.variants,
838
+ passthroughClassName: normalized.passthroughClassName
839
+ };
840
+ normalizedStyleConfigs.set(result, normalized);
841
+ return result;
842
+ };
843
+ const directStaticConfig = (element) => {
844
+ const identity = element.component.provenance;
845
+ if (!identity) return null;
846
+ const moduleName = modulesById.get(identity.resolvedId);
847
+ const component = moduleName ? componentsByModule.get(moduleName) : void 0;
848
+ const info = component?.nameToInfo[identity.importedName];
849
+ return info ? {
850
+ key: componentKey(identity.resolvedId, identity.importedName),
851
+ staticConfig: normalizeStaticConfig(info.staticConfig),
852
+ displayName: info.displayName
853
+ } : null;
854
+ };
855
+ const domStaticConfig = (element) => {
856
+ const identity = element.component.provenance;
857
+ const tag = element.component.name;
858
+ if (identity?.importedName !== "html" || !DOM_FRONTENDS.has(identity.specifier) || !(tag in import_dom.TAGS)) {
859
+ return null;
860
+ }
861
+ const row = import_dom.TAGS[tag];
862
+ const textLike = row.backing === "text" || row.backing === "textinput";
863
+ const base = (textLike ? core.Text : core.View)?.staticConfig;
864
+ if (!base) return null;
865
+ const platformDefaults = platform === "web" ? {
866
+ ...import_dom.DISPLAY_WEB_RESET[row.display],
867
+ ...row.defaults,
868
+ ...import_dom.TAG_WEB_DEFAULTS[tag]
869
+ } : {
870
+ ...import_dom.NATIVE_ELEMENT_DEFAULTS,
871
+ ...row.display === "block" ? import_dom.NATIVE_BLOCK_DEFAULTS : null,
872
+ ...row.defaults,
873
+ ...row.nativeDefaults
874
+ };
875
+ return {
876
+ key: componentKey(identity.resolvedId, `html.${tag}`),
877
+ tag,
878
+ displayName: tag,
879
+ staticConfig: normalizeStaticConfig({
880
+ ...base,
881
+ isInput: row.backing === "textinput",
882
+ validStyles: {
883
+ ...import_helpers.validStyles,
884
+ ...row.backing === "textinput" ? import_helpers.stylePropsInput : import_helpers.stylePropsText
885
+ },
886
+ defaultProps: {
887
+ ...base.defaultProps,
888
+ ...platformDefaults
889
+ }
890
+ })
891
+ };
892
+ };
893
+ const styledStaticConfig = (definition) => {
894
+ if (!definition || definition.options.kind !== "static") return null;
895
+ const staticConfig = definition.staticConfig;
896
+ if (staticConfig && (staticConfig.kind !== "static" || !staticObject(staticConfig.value))) {
897
+ return null;
898
+ }
899
+ const base = directStaticConfig({
900
+ kind: "element",
901
+ form: "jsx",
902
+ id: definition.id,
903
+ span: definition.span,
904
+ propsSpan: null,
905
+ component: definition.base,
906
+ complete: true,
907
+ entries: [],
908
+ bailouts: []
909
+ });
910
+ if (!base || !staticObject(definition.options.value)) return null;
911
+ const { variants, defaultVariants, displayName, context, contextProps, ...defaultProps } = definition.options.value;
912
+ const baseClassName = definition.baseClassName?.kind === "static" && typeof definition.baseClassName.value === "string" ? definition.baseClassName.value : void 0;
913
+ const localStaticConfig = {
914
+ ...base.staticConfig,
915
+ ...staticConfig?.value,
916
+ variants: {
917
+ ...base.staticConfig.variants,
918
+ ...variants
919
+ },
920
+ defaultProps: {
921
+ ...base.staticConfig.defaultProps,
922
+ ...defaultProps,
923
+ ...defaultVariants
924
+ },
925
+ defaultVariants,
926
+ baseClassName: [base.staticConfig.baseClassName, baseClassName].filter(Boolean).join(" "),
927
+ context: context ?? base.staticConfig.context,
928
+ contextProps: context ? contextProps : contextProps ?? base.staticConfig.contextProps
929
+ };
930
+ localStaticConfig.variantStyleResolver = compilerVariantStyleResolver;
931
+ return {
932
+ key: componentKey(definition.id, definition.name),
933
+ displayName: displayName || base.displayName,
934
+ staticConfig: normalizeStaticConfig(localStaticConfig)
935
+ };
936
+ };
937
+ const resolve = (element, styledDefinition) => {
938
+ const dom = domStaticConfig(element);
939
+ const resolved = dom ?? directStaticConfig(element) ?? styledStaticConfig(styledDefinition);
940
+ if (!resolved) return null;
941
+ const defaultProps = resolved.staticConfig.defaultProps ?? {};
942
+ return {
943
+ key: resolved.key,
944
+ canFlatten: resolved.staticConfig.acceptsClassName !== false && !resolved.staticConfig.neverFlatten && !resolved.staticConfig.context,
945
+ staticConfig: resolved.staticConfig,
946
+ displayName: resolved.displayName,
947
+ ...dom && { domTag: dom.tag },
948
+ partialRuntimeSafe: !dom && !styledDefinition && Object.keys(defaultProps).length === 0 && !resolved.staticConfig.defaultVariants && !resolved.staticConfig.baseClassName && !resolved.staticConfig.baseStyle
949
+ };
950
+ };
951
+ const isStyleProp = (name, component) => {
952
+ const staticConfig = component.staticConfig;
953
+ return compilerStyleProps.has(name) || name in (options.tamaguiConfig.shorthands ?? {}) || !!staticConfig.validStyles?.[name] || !!staticConfig.variants?.[name];
954
+ };
955
+ const runtimeOnlyStyleProps = /* @__PURE__ */ new Set([
956
+ "className",
957
+ "style",
958
+ "group",
959
+ "transition",
960
+ "animation",
961
+ "animatePresence",
962
+ "animatedBy",
963
+ "render"
964
+ ]);
965
+ const isFrontendClassName = (name, component) => name === "className" && !!component.staticConfig.styleFrontend;
966
+ const canLowerConditionalStyleProp = (name, component) => isStyleProp(name, component) && (!runtimeOnlyStyleProps.has(name) || isFrontendClassName(name, component));
967
+ const frontendClassDomain = (entry, component) => {
968
+ if (entry.kind !== "prop" || entry.value.kind !== "bailout" || !isFrontendClassName(entry.name, component)) {
969
+ return null;
970
+ }
971
+ const dynamic = entry.value.dynamic;
972
+ if (dynamic?.type !== "string" || !dynamic.values?.length) return null;
973
+ return dynamic.values.map(String);
974
+ };
975
+ const conditionalClassEntry = (entry, component) => entry.value.kind === "conditional" && canLowerConditionalStyleProp(entry.name, component) || frontendClassDomain(entry, component) !== null;
976
+ const isInvalidHostStyleProp = (name, component) => {
977
+ const staticConfig = component.staticConfig;
978
+ const validStyles = staticConfig.validStyles || (staticConfig.isInput ? import_helpers.stylePropsInput : staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
979
+ return name in import_helpers.stylePropsAll && !(0, import_web.isValidStyleKey)(name, validStyles);
980
+ };
981
+ const directStyleName = (name, component) => {
982
+ if (compilerStyleProps.has(name) || name === "style") {
983
+ return null;
984
+ }
985
+ const staticConfig = component.staticConfig;
986
+ if (staticConfig.variants?.[name]) return null;
987
+ const expanded = options.tamaguiConfig.shorthands?.[name] ?? name;
988
+ return staticConfig.validStyles?.[expanded] ? expanded : null;
989
+ };
990
+ const resolveSplitStyles = (props, staticConfig, animationDriver, displayName) => {
991
+ const previousStatic = process.env.IS_STATIC;
992
+ const previousTarget = process.env.TAMAGUI_TARGET;
993
+ if (platform === "native") {
994
+ process.env.IS_STATIC = "is_static";
995
+ } else {
996
+ delete process.env.IS_STATIC;
997
+ }
998
+ process.env.TAMAGUI_TARGET = platform;
999
+ try {
1000
+ return core.getSplitStyles(props, staticConfig, theme, firstThemeName, componentState, {
1001
+ isStatic: true,
1002
+ resolveValues: platform === "native" ? "except-theme" : "variable",
1003
+ noClass: platform === "native",
1004
+ isAnimated: false,
1005
+ displayName
1006
+ }, void 0, void 0, void 0, void 0, void 0, void 0, animationDriver, normalizedStyleConfigs.get(staticConfig));
1007
+ } finally {
1008
+ if (previousStatic === void 0) delete process.env.IS_STATIC;
1009
+ else process.env.IS_STATIC = previousStatic;
1010
+ if (previousTarget === void 0) delete process.env.TAMAGUI_TARGET;
1011
+ else process.env.TAMAGUI_TARGET = previousTarget;
1012
+ }
1013
+ };
1014
+ const partialStaticConfig = (staticConfig) => ({
1015
+ ...staticConfig,
1016
+ baseStyle: void 0,
1017
+ defaultProps: {},
1018
+ defaultVariants: void 0,
1019
+ variants: {}
1020
+ });
1021
+ const styleOwners = (name, value, staticConfig) => {
1022
+ const split = resolveSplitStyles({ [name]: value }, partialStaticConfig(staticConfig));
1023
+ if (!split) return null;
1024
+ const inlineStyle = split.viewProps?.style;
1025
+ if (staticObject(inlineStyle) && Object.keys(inlineStyle).length > 0) {
1026
+ return null;
1027
+ }
1028
+ const owners = new Set(Object.keys(split.classNames ?? {}));
1029
+ for (const styleObject of Object.values(split.rulesToInsert ?? {})) {
1030
+ const property = styleObject?.[import_helpers.StyleObjectProperty];
1031
+ if (typeof property === "string") owners.add(property);
1032
+ }
1033
+ return owners.size > 0 ? owners : null;
1034
+ };
1035
+ const dynamicStyleOwners = (name, staticConfig) => {
1036
+ const probeValue = name === "transform" ? [{ scale: 1 }] : name === "transformMatrix" ? [
1037
+ 1,
1038
+ 0,
1039
+ 0,
1040
+ 1,
1041
+ 0,
1042
+ 0
1043
+ ] : name === "shadowOffset" ? {
1044
+ width: 0,
1045
+ height: 0
1046
+ } : name === "shadowColor" ? "black" : name === "border" || name === "outline" ? "0 solid transparent" : name === "position" ? "relative" : name === "objectFit" ? "contain" : 0;
1047
+ const owners = styleOwners(name, probeValue, staticConfig);
1048
+ if (!owners || name !== "flex") return owners;
1049
+ const shorthandOwners = styleOwners(name, "0 1 auto", staticConfig);
1050
+ if (!shorthandOwners) return null;
1051
+ for (const owner of shorthandOwners) owners.add(owner);
1052
+ return owners;
1053
+ };
1054
+ const developmentDebugInstrumentation = (input, result) => {
1055
+ if (process.env.NODE_ENV !== "development") return;
1056
+ const debugEntry = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "debug" && entry.value.kind === "static" && entry.value.value === "verbose");
1057
+ if (!debugEntry) return;
1058
+ const component = input.component;
1059
+ const styleEntries = input.element.entries.filter((entry) => entry.kind === "prop" && entry.name !== "debug" && (entry.name === "style" || isStyleProp(entry.name, component)));
1060
+ const flattened = result.ok && !!result.flattened;
1061
+ const tiers = result.ok ? [
1062
+ "lowered",
1063
+ ...flattened ? ["flattened"] : [],
1064
+ ...input.styledDefinition ? ["styled"] : []
1065
+ ] : ["bailed"];
1066
+ const why = result.ok ? flattened ? "Static styles were lowered and the component was flattened to a host element." : "Static styles were lowered while the Tamagui component remained at runtime." : result.bailout.message;
1067
+ const styles = styleEntries.map((entry) => {
1068
+ if (!result.ok) {
1069
+ return {
1070
+ prop: entry.name,
1071
+ tier: "bailed",
1072
+ runtime: true,
1073
+ why: `${result.bailout.message}. The Tamagui runtime resolved this prop.`
1074
+ };
1075
+ }
1076
+ const edited = result.edits.some((edit) => edit.start < entry.span.end && edit.end > entry.span.start);
1077
+ if (!flattened && !edited) {
1078
+ return {
1079
+ prop: entry.name,
1080
+ tier: "bailed",
1081
+ runtime: true,
1082
+ why: "This prop remained for Tamagui runtime resolution."
1083
+ };
1084
+ }
1085
+ if (entry.value.kind === "static") {
1086
+ const split = resolveSplitStyles({ [entry.name]: entry.value.value }, partialStaticConfig(component.staticConfig));
1087
+ const hasOutput = Boolean(split && (Object.keys(split.classNames ?? {}).length > 0 || Object.keys(split.rulesToInsert ?? {}).length > 0 || staticObject(split.style) && Object.keys(split.style).length > 0 || staticObject(split.viewProps?.style) && Object.keys(split.viewProps.style).length > 0));
1088
+ if (!hasOutput) {
1089
+ return {
1090
+ prop: entry.name,
1091
+ tier: flattened ? "flattened" : "lowered",
1092
+ dropped: true,
1093
+ why: `No ${platform} style output was produced for this prop.`
1094
+ };
1095
+ }
1096
+ }
1097
+ return {
1098
+ prop: entry.name,
1099
+ tier: flattened ? "flattened" : "lowered",
1100
+ why: flattened ? "The compiler emitted this prop on the flattened host element." : "The compiler lowered this prop while retaining the Tamagui component."
1101
+ };
1102
+ });
1103
+ const receipt = JSON.stringify({
1104
+ component: input.element.component.name,
1105
+ tiers,
1106
+ why,
1107
+ styles
1108
+ });
1109
+ const content = flattened ? input.element.form === "jsx" ? `{...(console.info('\u{1F539} Tamagui style receipt', ${receipt}), {})}` : `...(console.info('\u{1F539} Tamagui style receipt', ${receipt}), {})` : input.element.form === "jsx" ? `debug="verbose" __tamaguiStyleDebugReceipt={${receipt}}` : `debug: "verbose", __tamaguiStyleDebugReceipt: ${receipt}`;
1110
+ return [{
1111
+ start: debugEntry.span.start,
1112
+ end: debugEntry.span.end,
1113
+ content,
1114
+ origin: debugEntry.span
1115
+ }];
1116
+ };
1117
+ return {
1118
+ resolveComponent: resolve,
1119
+ isStyleProp,
1120
+ canLowerDynamicStyleProp(name, component, valueKind) {
1121
+ if (!options.disablePartialExtraction && valueKind === "conditional" && canLowerConditionalStyleProp(name, component)) {
1122
+ return true;
1123
+ }
1124
+ if (component.staticConfig.resolvers?.length) {
1125
+ return false;
1126
+ }
1127
+ if (!options.disablePartialExtraction && platform === "web" && isFrontendClassName(name, component)) {
1128
+ return true;
1129
+ }
1130
+ return !options.disablePartialExtraction && (platform === "web" && !!directStyleName(name, component) || platform === "native" && directStyleName(name, component) === "opacity");
1131
+ },
1132
+ developmentDebugInstrumentation,
1133
+ lowerCandidate(input) {
1134
+ const component = input.component;
1135
+ if (!component.canFlatten) {
1136
+ const reason = component.staticConfig.acceptsClassName === false ? `${component.key} does not accept className` : component.staticConfig.neverFlatten ? `${component.key} is never flattened (behavior HOC)` : `${component.key} provides a styled context`;
1137
+ return bailout(input, "local/unsupported-target", reason, input.element.span, { rule: 6 });
1138
+ }
1139
+ if (options.zeroRuntime) {
1140
+ const spread = input.element.entries.find((entry) => entry.kind === "spread");
1141
+ if (spread) {
1142
+ return bailout(input, "local/unsafe-style-spread", "Zero-runtime rejects prop spreads", spread.span, {
1143
+ rule: 1,
1144
+ message: (0, import_compiler_core.zeroRuleMessage)(1, { component: input.element.component.name })
1145
+ });
1146
+ }
1147
+ }
1148
+ const props = {};
1149
+ for (const entry of input.element.entries) {
1150
+ if (entry.kind === "child" || entry.value.kind !== "static") continue;
1151
+ if (entry.kind === "spread") {
1152
+ if (!staticObject(entry.value.value)) {
1153
+ return bailout(input, "local/unsafe-style-spread", "Static spread did not materialize to an object", entry.span);
1154
+ }
1155
+ Object.assign(props, entry.value.value);
1156
+ } else {
1157
+ props[entry.name] = entry.value.value;
1158
+ }
1159
+ }
1160
+ if (component.staticConfig.resolvers?.length) {
1161
+ const unresolvedProps = input.element.entries.filter((entry) => entry.kind === "prop" && entry.value.kind !== "static");
1162
+ const onlyStaticBranchConditional = unresolvedProps.length === 1 && unresolvedProps[0]?.kind === "prop" && unresolvedProps[0].value.kind === "conditional" && canLowerConditionalStyleProp(unresolvedProps[0].name, component);
1163
+ const unresolvedProp = onlyStaticBranchConditional ? void 0 : unresolvedProps[0];
1164
+ if (unresolvedProp?.kind === "prop") {
1165
+ return bailout(input, "local/dynamic-style-value", `Component resolver prop ${unresolvedProp.name} could not be evaluated`, unresolvedProp.span, void 0, unresolvedProp.name);
1166
+ }
1167
+ }
1168
+ const componentOnlyProp = (name) => {
1169
+ let span;
1170
+ let unknown = false;
1171
+ for (const entry of input.element.entries) {
1172
+ if (entry.kind !== "prop" || entry.name !== name) continue;
1173
+ span = entry.span;
1174
+ if (entry.value.kind !== "static") unknown = true;
1175
+ }
1176
+ return {
1177
+ unknown,
1178
+ span
1179
+ };
1180
+ };
1181
+ const disableOptimization = componentOnlyProp("disableOptimization");
1182
+ if (disableOptimization.unknown || props.disableOptimization) {
1183
+ return bailout(input, "local/unsupported-target", "disableOptimization keeps the component on the runtime path", disableOptimization.span);
1184
+ }
1185
+ if (component.domTag && props.hidden) props.display = "none";
1186
+ if (component.domTag && platform === "native") {
1187
+ for (const [name, styleKey] of DOM_STYLE_ATTRIBUTES) {
1188
+ if (name in props) {
1189
+ props[styleKey] = props[name];
1190
+ delete props[name];
1191
+ }
1192
+ }
1193
+ }
1194
+ if (platform === "native" && component.domTag === "input" && typeof props.type === "string" && !import_dom.NATIVE_INPUT_TYPES.includes(props.type)) {
1195
+ return bailout(input, "local/unsupported-target", `input type ${props.type} has no native text-entry control`);
1196
+ }
1197
+ let styleObjectStatic = null;
1198
+ const styleMemberEntries = [];
1199
+ for (const entry of input.element.entries) {
1200
+ if (entry.kind !== "prop" || entry.name !== "style" || entry.value.kind !== "object") {
1201
+ continue;
1202
+ }
1203
+ styleObjectStatic = {};
1204
+ for (const member of entry.value.members) {
1205
+ if (member.value.kind === "static") {
1206
+ styleObjectStatic[member.name] = member.value.value;
1207
+ continue;
1208
+ }
1209
+ if (!isStyleProp(member.name, component)) {
1210
+ return bailout(input, "local/dynamic-style-value", `Style prop ${member.name} could not be evaluated`, member.span);
1211
+ }
1212
+ styleMemberEntries.push({
1213
+ kind: "prop",
1214
+ name: member.name,
1215
+ span: member.span,
1216
+ value: member.value,
1217
+ styleMember: true
1218
+ });
1219
+ }
1220
+ if (Object.keys(styleObjectStatic).length === 0) styleObjectStatic = null;
1221
+ }
1222
+ if (styleObjectStatic) props.style = styleObjectStatic;
1223
+ const dynamicStyleEntries = [...input.element.entries.filter((entry) => entry.kind === "prop" && (entry.value.kind === "bailout" || entry.value.kind === "conditional") && isStyleProp(entry.name, component)), ...styleMemberEntries];
1224
+ {
1225
+ const needsRuntimeMapping = (name) => runtimeEventProps.has(name) || platform === "native" && !component.domTag && nativePointerEventProps.has(name);
1226
+ const directRuntimeEvent = input.element.entries.find((entry) => entry.kind === "prop" && needsRuntimeMapping(entry.name));
1227
+ const runtimeEvent = directRuntimeEvent?.kind === "prop" ? directRuntimeEvent.name : Object.keys(props).find(needsRuntimeMapping);
1228
+ if (runtimeEvent) {
1229
+ return bailout(input, "local/unsupported-target", `${runtimeEvent} requires Tamagui runtime event mapping`);
1230
+ }
1231
+ }
1232
+ const animationDefaultProps = component.staticConfig.defaultProps ?? {};
1233
+ const animationProps = core.mergeProps(animationDefaultProps, props);
1234
+ const animationNames = /* @__PURE__ */ new Set([...input.element.entries.flatMap((entry) => entry.kind === "prop" && runtimeAnimationProps.has(entry.name) ? [entry.name] : []), ...Object.keys(animationProps).filter((name) => runtimeAnimationProps.has(name) && animationProps[name] !== void 0)]);
1235
+ const transitionEntry = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "transition");
1236
+ const animatedBy = typeof animationProps.animatedBy === "string" ? animationProps.animatedBy.trim() : null;
1237
+ const namedAnimationDriver = animatedBy === null ? null : options.tamaguiConfig.animationDrivers?.[animatedBy];
1238
+ const namedCssAnimationDriver = platform === "web" && namedAnimationDriver && !namedAnimationDriver.isStub && namedAnimationDriver.outputStyle === "css" ? namedAnimationDriver : null;
1239
+ const cssAnimationDriver = namedCssAnimationDriver ?? (animatedBy === null || animatedBy === "default" ? configuredCssAnimationDriver : null);
1240
+ const resolvedCssTransition = animationNames.has("transition") && cssAnimationDriver ? resolveStaticCssTransition(animationProps.transition, cssAnimationDriver.animations ?? {}) : null;
1241
+ if (resolvedCssTransition !== null) {
1242
+ props.transition = resolvedCssTransition;
1243
+ }
1244
+ const animatedByNeedsRuntime = animationNames.has("animatedBy") && !animationNames.has("transition") && (dynamicStyleEntries.length > 0 || Object.keys(animationProps).some((name) => name !== "animatedBy" && (isStyleProp(name, component) && typeof animationProps[name] === "string" && animationProps[name].includes(":") || name === "animationConfig" || name === "forceStyle" || name === "onTransition")));
1245
+ const runtimeAnimationRequired = animationNames.has("transition") && resolvedCssTransition === null || [...animationNames].some((name) => name !== "transition" && name !== "animatedBy") || animatedByNeedsRuntime;
1246
+ let dynamicHostStyleProperties = null;
1247
+ let laneAEntries = [];
1248
+ const laneAOwners = /* @__PURE__ */ new Set();
1249
+ const laneAMemberOwners = /* @__PURE__ */ new Set();
1250
+ const conflictsWithInline = (owners, dynamicOwners, memberOwners) => [...owners].some((owner) => !memberOwners.has(owner) && cssOwnersConflict(/* @__PURE__ */ new Set([owner]), dynamicOwners));
1251
+ const laneAAttempts = [dynamicStyleEntries];
1252
+ {
1253
+ const rest2 = dynamicStyleEntries.filter((entry) => !conditionalClassEntry(entry, component));
1254
+ if (rest2.length > 0 && rest2.length < dynamicStyleEntries.length) {
1255
+ laneAAttempts.push(rest2);
1256
+ }
1257
+ }
1258
+ if (platform === "web" && !options.disablePartialExtraction && (input.element.form === "jsx" || input.element.propsSpan !== null) && dynamicStyleEntries.length > 0 && !input.element.entries.some((entry) => entry.kind === "spread" && entry.value.kind !== "static")) {
1259
+ for (const attempt of laneAAttempts) {
1260
+ const seen = /* @__PURE__ */ new Set();
1261
+ const properties = [];
1262
+ const dynamicOwners = /* @__PURE__ */ new Set();
1263
+ const memberOwners = /* @__PURE__ */ new Set();
1264
+ for (const entry of attempt) {
1265
+ if (entry.kind !== "prop" || entry.value.kind !== "bailout" && entry.value.kind !== "conditional") {
1266
+ continue;
1267
+ }
1268
+ const name = directStyleName(entry.name, component);
1269
+ if (!name || seen.has(name)) {
1270
+ properties.length = 0;
1271
+ break;
1272
+ }
1273
+ const owners = dynamicStyleOwners(name, component.staticConfig);
1274
+ if (!owners) {
1275
+ properties.length = 0;
1276
+ break;
1277
+ }
1278
+ let property = null;
1279
+ const expression = input.source.slice(entry.value.span.start, entry.value.span.end);
1280
+ if (resolvedCssTransition !== null && (name === "opacity" || name === "scale")) {
1281
+ property = name === "opacity" ? `opacity: (${expression})` : `transform: "scale(" + (${expression}) + ")"`;
1282
+ } else if (entry.value.kind === "bailout" && owners.has(name)) {
1283
+ const dynamic = entry.value.dynamic;
1284
+ if (dynamic?.type === "number") {
1285
+ property = `${JSON.stringify(name)}: (${expression})`;
1286
+ } else if (dynamic?.type === "string" && dynamic.values?.length) {
1287
+ let valuesStayLiteral = true;
1288
+ for (const value of dynamic.values) {
1289
+ const split2 = resolveSplitStyles({ [entry.name]: value }, partialStaticConfig(component.staticConfig));
1290
+ const atomics = Object.values(split2?.rulesToInsert ?? {});
1291
+ if (atomics.length !== 1 || atomics[0]?.[import_helpers.StyleObjectProperty] !== name || atomics[0]?.[import_helpers.StyleObjectValue] !== value) {
1292
+ valuesStayLiteral = false;
1293
+ break;
1294
+ }
1295
+ }
1296
+ if (valuesStayLiteral) {
1297
+ property = `${JSON.stringify(name)}: (${expression})`;
1298
+ }
1299
+ }
1300
+ }
1301
+ if (!property) {
1302
+ properties.length = 0;
1303
+ break;
1304
+ }
1305
+ seen.add(name);
1306
+ for (const owner of owners) {
1307
+ dynamicOwners.add(owner);
1308
+ if (entry.styleMember) memberOwners.add(owner);
1309
+ }
1310
+ properties.push(property);
1311
+ }
1312
+ if (properties.length === attempt.length && !input.element.entries.some((entry) => {
1313
+ if (entry.kind !== "prop" || entry.value.kind !== "static") return false;
1314
+ const name = directStyleName(entry.name, component);
1315
+ if (!name) return false;
1316
+ const owners = styleOwners(name, entry.value.value, component.staticConfig);
1317
+ return !!owners && conflictsWithInline(owners, dynamicOwners, memberOwners);
1318
+ }) && !Object.entries(staticObject(props.style) ? props.style : {}).some(([name, value]) => {
1319
+ const owners = styleOwners(name, value, component.staticConfig);
1320
+ return !!owners && cssOwnersConflict(owners, dynamicOwners);
1321
+ })) {
1322
+ dynamicHostStyleProperties = properties;
1323
+ laneAEntries = attempt;
1324
+ for (const owner of dynamicOwners) laneAOwners.add(owner);
1325
+ for (const owner of memberOwners) laneAMemberOwners.add(owner);
1326
+ break;
1327
+ }
1328
+ }
1329
+ }
1330
+ const laneACoversAll = dynamicHostStyleProperties !== null && laneAEntries.length === dynamicStyleEntries.length;
1331
+ const webClassEntries = dynamicHostStyleProperties === null ? dynamicStyleEntries : dynamicStyleEntries.filter((entry) => !laneAEntries.includes(entry));
1332
+ const supportsWebConditionalClasses = platform === "web" && !options.disablePartialExtraction && (input.element.form === "jsx" || input.element.propsSpan !== null) && !laneACoversAll && webClassEntries.length > 0 && webClassEntries.every((entry) => conditionalClassEntry(entry, component));
1333
+ const themeEntry = componentOnlyProp("theme");
1334
+ const themeInverseEntry = componentOnlyProp("themeInverse");
1335
+ const themeBoundary = themeEntry.unknown || "theme" in props;
1336
+ if (themeBoundary || themeInverseEntry.unknown || props.themeInverse) {
1337
+ const themeProp = themeBoundary ? "theme" : "themeInverse";
1338
+ return bailout(input, "local/unsupported-target", "Theme boundary candidates remain on the runtime path", input.element.span, {
1339
+ rule: 4,
1340
+ message: (0, import_compiler_core.zeroThemeBoundaryMessage)(input.element.component.name, themeProp)
1341
+ });
1342
+ }
1343
+ const asChild = componentOnlyProp("asChild");
1344
+ if (asChild.unknown || props.asChild) {
1345
+ return bailout(input, "local/unsupported-target", "asChild renders a Slot, not a host view", asChild.span);
1346
+ }
1347
+ if (platform === "native" && ("group" in props || "container" in props || "containerName" in props || "containerType" in props)) {
1348
+ return bailout(input, "local/unsupported-target", "Native group and container providers remain on the runtime path");
1349
+ }
1350
+ if (runtimeAnimationRequired && !cssAnimationDriver) {
1351
+ return bailout(input, "local/unsupported-target", "Animated candidates remain on the runtime path", transitionEntry?.span, {
1352
+ rule: 5,
1353
+ message: (0, import_compiler_core.zeroRuleMessage)(5, { detail: `the animation configured on ${input.element.component.name}` })
1354
+ });
1355
+ }
1356
+ if (platform === "web" && (dynamicStyleEntries.length > 0 || runtimeAnimationRequired) && !laneACoversAll && !supportsWebConditionalClasses && component.partialRuntimeSafe) {
1357
+ const hasSpread = input.element.entries.some((entry) => entry.kind === "spread" && entry.value.kind !== "static");
1358
+ const unsupportedRuntimeStyle = input.element.entries.find((entry) => entry.kind === "prop" && isStyleProp(entry.name, component) && !runtimeAnimationProps.has(entry.name) && !directStyleName(entry.name, component));
1359
+ if (!hasSpread && !unsupportedRuntimeStyle) {
1360
+ const dynamicOwners = /* @__PURE__ */ new Set();
1361
+ let canProveDynamicOwnership = true;
1362
+ for (const entry of dynamicStyleEntries) {
1363
+ if (entry.kind !== "prop") continue;
1364
+ const name = directStyleName(entry.name, component);
1365
+ if (!name) {
1366
+ canProveDynamicOwnership = false;
1367
+ break;
1368
+ }
1369
+ const owners = dynamicStyleOwners(name, component.staticConfig);
1370
+ if (!owners) {
1371
+ canProveDynamicOwnership = false;
1372
+ break;
1373
+ }
1374
+ for (const owner of owners) dynamicOwners.add(owner);
1375
+ }
1376
+ const staticStyleEntries = canProveDynamicOwnership ? input.element.entries.filter((entry) => {
1377
+ if (entry.kind !== "prop" || entry.value.kind !== "static") return false;
1378
+ if (runtimeAnimationProps.has(entry.name)) return false;
1379
+ const name = directStyleName(entry.name, component);
1380
+ if (!name) return false;
1381
+ const owners = styleOwners(name, entry.value.value, component.staticConfig);
1382
+ return !!owners && !cssOwnersConflict(owners, dynamicOwners);
1383
+ }) : [];
1384
+ if (staticStyleEntries.length > 0) {
1385
+ const partialProps = {};
1386
+ for (const entry of staticStyleEntries) {
1387
+ if (entry.kind === "prop" && entry.value.kind === "static") {
1388
+ partialProps[entry.name] = entry.value.value;
1389
+ }
1390
+ }
1391
+ const partialSplit = resolveSplitStyles(partialProps, partialStaticConfig(component.staticConfig));
1392
+ const partialInlineStyle = partialSplit?.viewProps?.style;
1393
+ const hasPartialInlineStyle = staticObject(partialInlineStyle) && Object.keys(partialInlineStyle).length > 0;
1394
+ if (partialSplit && !hasPartialInlineStyle) {
1395
+ const artifacts2 = extractedStyleArtifacts(partialSplit, partialProps, options.tamaguiConfig, false);
1396
+ if (artifacts2.className) {
1397
+ if (input.element.form !== "jsx") {
1398
+ const propsEdits = compiledPropsEdits(input, staticStyleEntries, objectClassName(artifacts2.className));
1399
+ if (propsEdits) {
1400
+ return {
1401
+ ok: true,
1402
+ edits: propsEdits,
1403
+ css: artifacts2.css,
1404
+ imports: [],
1405
+ flattened: false
1406
+ };
1407
+ }
1408
+ } else {
1409
+ const [first2, ...rest2] = staticStyleEntries;
1410
+ return {
1411
+ ok: true,
1412
+ edits: [{
1413
+ start: first2.span.start,
1414
+ end: first2.span.end,
1415
+ content: jsxClassName(artifacts2.className),
1416
+ origin: first2.span
1417
+ }, ...rest2.map((entry) => ({
1418
+ start: entry.span.start,
1419
+ end: entry.span.end,
1420
+ content: "",
1421
+ origin: entry.span
1422
+ }))],
1423
+ css: artifacts2.css,
1424
+ imports: [],
1425
+ flattened: false
1426
+ };
1427
+ }
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+ if (runtimeAnimationRequired) {
1434
+ return bailout(input, "local/unsupported-target", "Animated candidates remain on the runtime path", transitionEntry?.span, {
1435
+ rule: 5,
1436
+ message: (0, import_compiler_core.zeroRuleMessage)(5, { detail: `the animation configured on ${input.element.component.name}` })
1437
+ });
1438
+ }
1439
+ const supportsNativeDynamicStyles = platform === "native" && !options.disablePartialExtraction && (input.element.form === "jsx" || input.element.propsSpan !== null) && dynamicStyleEntries.every((entry) => entry.kind === "prop" && (directStyleName(entry.name, component) === "opacity" || entry.value.kind === "conditional" && canLowerConditionalStyleProp(entry.name, component)));
1440
+ if (dynamicStyleEntries.length > 0 && !laneACoversAll && !supportsNativeDynamicStyles && !supportsWebConditionalClasses) {
1441
+ const entry = dynamicStyleEntries[0];
1442
+ return bailout(input, "local/dynamic-style-value", `Style prop ${entry.kind === "prop" ? entry.name : "unknown"} could not be safely extracted`, entry.span);
1443
+ }
1444
+ const resolvedStyleStaticConfig = core.getStyleStaticConfig(component.staticConfig, core.getConfig());
1445
+ const staticDefaultProps = resolvedStyleStaticConfig.defaultProps ?? {};
1446
+ const defaultProps = platform === "web" && !component.staticConfig.isText && options.tamaguiConfig.settings.defaultPosition === "relative" && staticDefaultProps.position === void 0 ? core.mergeProps({ position: "relative" }, staticDefaultProps) : staticDefaultProps;
1447
+ let completeProps = core.mergeProps(defaultProps, props);
1448
+ if (platform === "native" && component.domTag && props.display === "flex") {
1449
+ completeProps = core.mergeProps(core.mergeProps(defaultProps, import_dom.NATIVE_FLEX_DEFAULTS), props);
1450
+ }
1451
+ const domStyleProgram = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "style" && entry.value.kind === "dom-style");
1452
+ if (platform === "native" && !component.domTag && domStyleProgram) {
1453
+ return bailout(input, "local/unsupported-target", "Native style() pieces remain on the runtime path");
1454
+ }
1455
+ const propsForConditional = (target, value) => {
1456
+ const branchProps = {};
1457
+ if (styleObjectStatic) branchProps.style = styleObjectStatic;
1458
+ if (target.styleMember) {
1459
+ branchProps.style = {
1460
+ ...styleObjectStatic,
1461
+ [target.name]: value
1462
+ };
1463
+ }
1464
+ for (const entry of input.element.entries) {
1465
+ if (entry === target) {
1466
+ branchProps[target.name] = value;
1467
+ continue;
1468
+ }
1469
+ if (entry.kind === "child" || entry.value.kind !== "static") continue;
1470
+ if (entry.kind === "spread") {
1471
+ if (staticObject(entry.value.value)) Object.assign(branchProps, entry.value.value);
1472
+ } else {
1473
+ branchProps[entry.name] = entry.value.value;
1474
+ }
1475
+ }
1476
+ if (component.domTag && branchProps.hidden) branchProps.display = "none";
1477
+ if (resolvedCssTransition !== null) {
1478
+ branchProps.transition = resolvedCssTransition;
1479
+ }
1480
+ if (component.domTag && platform === "native") {
1481
+ for (const [name, styleKey] of DOM_STYLE_ATTRIBUTES) {
1482
+ if (name in branchProps) {
1483
+ branchProps[styleKey] = branchProps[name];
1484
+ delete branchProps[name];
1485
+ }
1486
+ }
1487
+ }
1488
+ const branchCompleteProps = platform === "native" && component.domTag && branchProps.display === "flex" ? core.mergeProps(core.mergeProps(defaultProps, import_dom.NATIVE_FLEX_DEFAULTS), branchProps) : core.mergeProps(defaultProps, branchProps);
1489
+ if (platform === "native") {
1490
+ for (const [name, value2] of Object.entries(branchCompleteProps)) {
1491
+ const clause = isStyleProp(name, component) ? nativeClauseValue(value2) : null;
1492
+ if (clause === null || clause === "live") continue;
1493
+ if (clause.matched) branchCompleteProps[name] = clause.payload;
1494
+ else delete branchCompleteProps[name];
1495
+ }
1496
+ }
1497
+ return {
1498
+ branchProps,
1499
+ branchCompleteProps
1500
+ };
1501
+ };
1502
+ if (platform === "native") {
1503
+ const isClauseValue = (name, value) => isStyleProp(name, component) && (typeof value === "string" && flatClausePattern.test(value) || isClauseObjectValue(value));
1504
+ const defaultVariants = component.staticConfig.defaultVariants ?? {};
1505
+ const definitionCarriesClause = Object.entries(resolvedStyleStaticConfig.baseStyle ?? {}).some(([name, value]) => isClauseValue(name, value)) || Object.entries(component.staticConfig.variants ?? {}).some(([variantName, definitions]) => (completeProps[variantName] !== void 0 || defaultVariants[variantName] !== void 0) && staticObject(definitions) && Object.values(definitions).some((definition) => staticObject(definition) && Object.entries(definition).some(([name, value]) => isClauseValue(name, value))));
1506
+ if (definitionCarriesClause) {
1507
+ return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1508
+ }
1509
+ const reducedProps = {};
1510
+ for (const [name, value] of Object.entries(completeProps)) {
1511
+ const clause = isStyleProp(name, component) ? nativeClauseValue(value) : null;
1512
+ if (clause === "live") {
1513
+ return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1514
+ }
1515
+ if (clause === null) {
1516
+ reducedProps[name] = value;
1517
+ continue;
1518
+ }
1519
+ if (clause.matched) reducedProps[name] = clause.payload;
1520
+ }
1521
+ completeProps = reducedProps;
1522
+ for (const entry of dynamicStyleEntries) {
1523
+ if (entry.value.kind !== "conditional") continue;
1524
+ for (const leaf of (0, import_compiler_core.collectLeaves)(entry.value.tree)) {
1525
+ if (nativeClauseValue(leaf.value) !== "live") continue;
1526
+ return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1527
+ }
1528
+ }
1529
+ }
1530
+ const split = resolveSplitStyles(completeProps, component.staticConfig, cssAnimationDriver, component.displayName);
1531
+ if (!split) {
1532
+ return bailout(input, "local/style-resolution-failed", "getSplitStyles returned no static result");
1533
+ }
1534
+ if (split.programLifecycleStyleKeys?.enter?.size || split.programLifecycleStyleKeys?.exit?.size) {
1535
+ return bailout(input, "local/unsupported-target", "Lifecycle value programs remain on the runtime path", input.element.span, {
1536
+ rule: 5,
1537
+ message: (0, import_compiler_core.zeroRuleMessage)(5, { detail: `an enter or exit style program on ${input.element.component.name}` })
1538
+ });
1539
+ }
1540
+ const flatTag = component.domTag ?? (typeof props.render === "string" ? props.render : typeof defaultProps.render === "string" ? defaultProps.render : component.staticConfig.isText ? "span" : "div");
1541
+ const tagEdits = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1542
+ start: span.start,
1543
+ end: span.end,
1544
+ content: input.element.form === "jsx" ? flatTag : JSON.stringify(flatTag),
1545
+ origin: span
1546
+ }));
1547
+ const isPropIgnored = (name) => isStyleProp(name, component) || isInvalidHostStyleProp(name, component) || componentOnlyProps.has(name);
1548
+ const spreadReplacement = (form, entry) => spreadNonStyleReplacement(form, entry, isPropIgnored, (name, value) => {
1549
+ if (platform !== "web") return [name, value];
1550
+ if (name === "testID") return ["data-testid", value];
1551
+ if (component.domTag && name === "for") return ["htmlFor", value];
1552
+ if (component.domTag && name === "role" && value === "none") {
1553
+ return ["role", "presentation"];
1554
+ }
1555
+ return [name, value];
1556
+ });
1557
+ let styleEntries = input.element.entries.filter((entry) => entry.kind === "prop" && isPropIgnored(entry.name) || entry.kind === "spread" && entry.value.kind === "static" && staticObject(entry.value.value) && Object.keys(entry.value.value).some(isPropIgnored));
1558
+ let invalidHostStyle;
1559
+ for (const entry of input.element.entries) {
1560
+ if (entry.kind === "prop") {
1561
+ if (isInvalidHostStyleProp(entry.name, component)) {
1562
+ invalidHostStyle = {
1563
+ entry,
1564
+ name: entry.name
1565
+ };
1566
+ break;
1567
+ }
1568
+ continue;
1569
+ }
1570
+ if (entry.kind === "spread" && entry.value.kind === "static" && staticObject(entry.value.value)) {
1571
+ const name = Object.keys(entry.value.value).find((name2) => isInvalidHostStyleProp(name2, component));
1572
+ if (name) {
1573
+ invalidHostStyle = {
1574
+ entry,
1575
+ name
1576
+ };
1577
+ break;
1578
+ }
1579
+ }
1580
+ }
1581
+ if (invalidHostStyle) {
1582
+ return bailout(input, "local/unsupported-target", `"${invalidHostStyle.name}" is a text style prop and this component is not text. Use a Text-based component, or html.* for raw web elements.`, invalidHostStyle.entry.span);
1583
+ }
1584
+ if (platform === "native" && component.domTag) {
1585
+ const mixedSpread = styleEntries.find((entry) => entry.kind === "spread" && entry.value.kind === "static" && staticObject(entry.value.value) && Object.keys(entry.value.value).some((name) => !isPropIgnored(name)));
1586
+ if (mixedSpread) {
1587
+ return bailout(input, "local/unsafe-style-spread", "Native DOM prop mapping requires non-style spread props to remain on the runtime path", mixedSpread.span);
1588
+ }
1589
+ }
1590
+ const webPropEdits = platform === "web" ? input.element.entries.flatMap((entry) => {
1591
+ if (entry.kind !== "prop" || entry.name !== "testID") return [];
1592
+ const content = input.source.slice(entry.span.start, entry.span.end);
1593
+ const nameOffset = content.indexOf("testID");
1594
+ if (nameOffset === -1) return [];
1595
+ const alreadyQuoted = content[nameOffset - 1] === "\"" || content[nameOffset - 1] === "'";
1596
+ return [{
1597
+ start: entry.span.start + nameOffset,
1598
+ end: entry.span.start + nameOffset + "testID".length,
1599
+ content: input.element.form === "jsx" || alreadyQuoted ? "data-testid" : `'data-testid'`,
1600
+ origin: entry.span
1601
+ }];
1602
+ }) : [];
1603
+ const webDOMResult = platform === "web" && component.domTag ? webDOMProps(input, component.domTag) : {
1604
+ edits: [],
1605
+ additions: []
1606
+ };
1607
+ webPropEdits.push(...webDOMResult.edits);
1608
+ if (platform === "native") {
1609
+ const nativeStyleResolved = split.viewProps?.style;
1610
+ let themedStyleKeys = null;
1611
+ let nativeStyle = nativeStyleResolved;
1612
+ if (staticObject(nativeStyleResolved)) {
1613
+ for (const [styleKey, styleValue] of Object.entries(nativeStyleResolved)) {
1614
+ if (!core.containsThemeRef(styleValue)) continue;
1615
+ const themeKey = core.themeRefKey(styleValue);
1616
+ if (!themeKey) {
1617
+ return bailout(input, "local/dynamic-style-value", `Style ${styleKey} uses a theme value in a compound or modified position that compiled output cannot represent`);
1618
+ }
1619
+ ;
1620
+ (themedStyleKeys ||= {})[styleKey] = themeKey;
1621
+ }
1622
+ if (themedStyleKeys) {
1623
+ const plain = {};
1624
+ for (const [styleKey, styleValue] of Object.entries(nativeStyleResolved)) {
1625
+ if (!(styleKey in themedStyleKeys)) plain[styleKey] = styleValue;
1626
+ }
1627
+ nativeStyle = plain;
1628
+ }
1629
+ } else if (core.containsThemeRef(nativeStyleResolved)) {
1630
+ return bailout(input, "local/dynamic-style-value", "Theme values inside non-object native style output stay on the runtime path");
1631
+ }
1632
+ if (!isSerializableNativeStyle(nativeStyle)) {
1633
+ return bailout(input, "local/unsupported-target", "Native style output is not a static serializable value");
1634
+ }
1635
+ const nativeStyleLocal = unusedIdentifier(input.source, `__TamaguiNativeStyle${input.element.span.start}`);
1636
+ const nativeStyleImports = [{
1637
+ content: `
1638
+ function ${nativeStyleLocal}() { return ${nativeStyleLocal}._ ?? (${nativeStyleLocal}._ = ${JSON.stringify(nativeStyle ?? {})}); } ${nativeStyleLocal}();`,
1639
+ origin: input.element.component.span
1640
+ }];
1641
+ const nativeStyleSource = `${nativeStyleLocal}._ ?? ${nativeStyleLocal}()`;
1642
+ let nativeFastPath;
1643
+ if (themedStyleKeys && options.experimentalNativeFastPath && dynamicStyleEntries.length === 0 && !input.element.entries.some((entry) => entry.kind === "spread")) {
1644
+ const mappingLocal = unusedIdentifier(input.source, `__TamaguiNativeMapping${input.element.span.start}`);
1645
+ nativeFastPath = {
1646
+ mappingLocal,
1647
+ imports: [{
1648
+ content: `
1649
+ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
1650
+ origin: input.element.component.span
1651
+ }]
1652
+ };
1653
+ }
1654
+ if (component.domTag) {
1655
+ if (themedStyleKeys) {
1656
+ return bailout(input, "local/unsupported-target", "Theme values on DOM-tag native output stay on the runtime path");
1657
+ }
1658
+ const row = import_dom.TAGS[component.domTag];
1659
+ const basePrimitive = import_dom.NATIVE_BACKING[row.backing].primitive;
1660
+ let primitive = basePrimitive;
1661
+ const propsResult = nativeDOMProps(input, component.domTag);
1662
+ if (propsResult.diagnostic) {
1663
+ return bailout(input, "local/unsupported-target", propsResult.diagnostic, propsResult.diagnosticSpan);
1664
+ }
1665
+ styleEntries = [.../* @__PURE__ */ new Set([...styleEntries, ...propsResult.consumed])];
1666
+ let nativeDOMStyleSource = nativeStyleSource;
1667
+ let runtimeStyleSource = null;
1668
+ if (domStyleProgram?.kind === "prop" && domStyleProgram.value.kind === "dom-style") {
1669
+ const needsRuntime = domStyleProgram.value.items.some((item) => item.value.kind === "static" && staticObject(item.value.value) && (Object.keys(item.value.value).some((property) => nativeRuntimeOnlyStyleProperties.has(property)) || Object.values(item.value.value).some((value) => typeof value === "string" && (flatClausePattern.test(value) || nativeInheritedKeywordPattern.test(value)) || isClauseObjectValue(value))));
1670
+ const itemSources = [];
1671
+ for (const item of domStyleProgram.value.items) {
1672
+ if (item.value.kind !== "static" || !staticObject(item.value.value)) {
1673
+ return bailout(input, "local/dynamic-style-value", "Every style() handle in a style array must be statically evaluable", item.value.span);
1674
+ }
1675
+ if (Object.values(item.value.value).some((value2) => typeof value2 === "string" && nativeInitialKeywordPattern.test(value2))) {
1676
+ return bailout(input, "local/unsupported-target", "Native DOM style() does not support the CSS initial keyword, matching the pinned upstream limitation", item.value.span);
1677
+ }
1678
+ let value;
1679
+ if (needsRuntime) {
1680
+ value = JSON.stringify(item.value.value);
1681
+ } else {
1682
+ const itemSplit = resolveSplitStyles(item.value.value, partialStaticConfig(component.staticConfig));
1683
+ const itemStyle = itemSplit?.viewProps?.style;
1684
+ if (!isSerializableNativeStyle(itemStyle) || core.containsThemeRef(itemStyle)) {
1685
+ return bailout(input, "local/unsupported-target", "Native style() output is not serializable", item.value.span);
1686
+ }
1687
+ value = JSON.stringify(itemStyle ?? {});
1688
+ }
1689
+ const condition = item.condition ? input.source.slice(item.condition.start, item.condition.end) : null;
1690
+ itemSources.push(condition ? `(${condition}) && ${value}` : value);
1691
+ }
1692
+ if (needsRuntime) {
1693
+ primitive = `DOMRuntime${basePrimitive.slice("DOM".length)}`;
1694
+ runtimeStyleSource = `[${itemSources.join(", ")}]`;
1695
+ } else {
1696
+ nativeDOMStyleSource = `[${[nativeDOMStyleSource, ...itemSources].join(", ")}]`;
1697
+ }
1698
+ }
1699
+ const nativeLocal2 = unusedIdentifier(input.source, `__Tamagui${primitive}`);
1700
+ const propertyContent = [
1701
+ input.element.form === "jsx" ? `style={${nativeDOMStyleSource}}` : `style: ${nativeDOMStyleSource}`,
1702
+ runtimeStyleSource ? input.element.form === "jsx" ? `__styles={${runtimeStyleSource}}` : `__styles: ${runtimeStyleSource}` : "",
1703
+ serializedProps(input.element.form, propsResult.additions)
1704
+ ].filter(Boolean).join(input.element.form === "jsx" ? " " : ", ");
1705
+ const primitiveTagEdits = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1706
+ start: span.start,
1707
+ end: span.end,
1708
+ content: input.element.form === "jsx" ? nativeLocal2 : JSON.stringify(nativeLocal2).slice(1, -1),
1709
+ origin: span
1710
+ }));
1711
+ const literalEdits = [];
1712
+ const imports = [...nativeStyleImports, {
1713
+ content: `
1714
+ import { ${primitive} as ${nativeLocal2} } from ${JSON.stringify(import_dom.NATIVE_PRIMITIVE_MODULE)}
1715
+ `,
1716
+ origin: input.element.component.span
1717
+ }];
1718
+ if (import_dom.NATIVE_BACKING[row.backing].wrapsLiteralText) {
1719
+ const textLocal = unusedIdentifier(input.source, "__TamaguiDOMText");
1720
+ const createElementLocal = unusedIdentifier(input.source, "__TamaguiCreateElement");
1721
+ let needsText = false;
1722
+ let needsCreateElement = false;
1723
+ for (const entry of input.element.entries) {
1724
+ if (entry.kind !== "child") continue;
1725
+ if (entry.value.kind === "empty" || entry.value.kind === "element" || entry.value.kind === "static" && (entry.value.value === null || typeof entry.value.value === "boolean")) {
1726
+ continue;
1727
+ }
1728
+ if (entry.value.kind !== "static" || entry.value.literalOrigin !== true || typeof entry.value.value !== "string" && typeof entry.value.value !== "number") {
1729
+ return bailout(input, "local/unsupported-child", `html.${component.domTag} has a direct child that may render unwrapped native text; write a literal as JSX text or wrap the child in html.span`, entry.span);
1730
+ }
1731
+ needsText = true;
1732
+ const child = input.source.slice(entry.span.start, entry.span.end);
1733
+ if (input.element.form === "jsx") {
1734
+ literalEdits.push({
1735
+ start: entry.span.start,
1736
+ end: entry.span.end,
1737
+ content: `<${textLocal} __inherit>${child}</${textLocal}>`,
1738
+ origin: entry.span
1739
+ });
1740
+ } else {
1741
+ needsCreateElement = true;
1742
+ literalEdits.push({
1743
+ start: entry.span.start,
1744
+ end: entry.span.end,
1745
+ content: `${createElementLocal}(${textLocal}, { __inherit: true }, ${child})`,
1746
+ origin: entry.span
1747
+ });
1748
+ }
1749
+ }
1750
+ if (needsText) {
1751
+ imports.push({
1752
+ content: `
1753
+ import { DOMText as ${textLocal} } from ${JSON.stringify(import_dom.NATIVE_PRIMITIVE_MODULE)}
1754
+ `,
1755
+ origin: input.element.component.span
1756
+ });
1757
+ }
1758
+ if (needsCreateElement) {
1759
+ imports.push({
1760
+ content: `
1761
+ import { createElement as ${createElementLocal} } from "react"
1762
+ `,
1763
+ origin: input.element.component.span
1764
+ });
1765
+ }
1766
+ }
1767
+ const [first3, ...rest3] = styleEntries;
1768
+ const firstNonStyle3 = first3 ? spreadReplacement("jsx", first3) : "";
1769
+ const propsEdits = input.element.form === "jsx" ? styleEntries.length === 0 ? [{
1770
+ start: input.element.component.span.end,
1771
+ end: input.element.component.span.end,
1772
+ content: ` ${propertyContent}`,
1773
+ origin: input.element.component.span
1774
+ }] : [{
1775
+ start: first3.span.start,
1776
+ end: first3.span.end,
1777
+ content: [propertyContent, firstNonStyle3].filter(Boolean).join(" "),
1778
+ origin: first3.span
1779
+ }, ...rest3.map((entry) => ({
1780
+ start: entry.span.start,
1781
+ end: entry.span.end,
1782
+ content: spreadReplacement("jsx", entry),
1783
+ origin: entry.span
1784
+ }))] : compiledPropsEdits(input, styleEntries, propertyContent, (entry) => spreadReplacement(input.element.form, entry));
1785
+ if (!propsEdits) {
1786
+ return bailout(input, "local/unsupported-target", `Compiled ${input.element.form} call has no editable props argument`);
1787
+ }
1788
+ return {
1789
+ ok: true,
1790
+ edits: [
1791
+ ...primitiveTagEdits,
1792
+ ...propsResult.edits,
1793
+ ...propsEdits,
1794
+ ...literalEdits
1795
+ ],
1796
+ css: [],
1797
+ imports,
1798
+ flattened: true
1799
+ };
1800
+ }
1801
+ const nativeName = component.staticConfig.isText ? "Text" : "View";
1802
+ const useHostView = options.experimentalNativeFastPath && nativeName === "View" && isBareHostView(input.element);
1803
+ const nativeExport = useHostView ? "unstable_NativeView" : nativeName;
1804
+ const nativeLocal = unusedIdentifier(input.source, `__TamaguiNative${useHostView ? "HostView" : nativeName}`);
1805
+ if (themedStyleKeys && options.disablePartialExtraction) {
1806
+ return bailout(input, "local/dynamic-style-value", "Theme values require partial extraction, which is disabled");
1807
+ }
1808
+ if (dynamicStyleEntries.length > 0 || themedStyleKeys) {
1809
+ if (nativeFastPath) {
1810
+ const fastLocal = `__TamaguiNativeFast${nativeName}${input.element.span.start}`;
1811
+ const tagEdits4 = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1812
+ start: span.start,
1813
+ end: span.end,
1814
+ content: fastLocal,
1815
+ origin: span
1816
+ }));
1817
+ const [first4, ...rest4] = styleEntries;
1818
+ const styleEdits = styleEntries.length === 0 ? [] : input.element.form === "jsx" ? [{
1819
+ start: first4.span.start,
1820
+ end: first4.span.end,
1821
+ content: "",
1822
+ origin: first4.span
1823
+ }, ...rest4.map((entry) => ({
1824
+ start: entry.span.start,
1825
+ end: entry.span.end,
1826
+ content: "",
1827
+ origin: entry.span
1828
+ }))] : compiledPropsEdits(input, styleEntries, `_expressions: []`);
1829
+ if (!styleEdits) {
1830
+ return bailout(input, "local/unsupported-target", `Compiled ${input.element.form} call has no editable props argument`);
1831
+ }
1832
+ return {
1833
+ ok: true,
1834
+ edits: [...tagEdits4, ...styleEdits],
1835
+ css: [],
1836
+ imports: [
1837
+ ...nativeStyleImports,
1838
+ ...nativeFastPath.imports,
1839
+ {
1840
+ content: `
1841
+ const ${nativeLocal} = require('react-native').${nativeExport};`,
1842
+ origin: input.element.component.span
1843
+ },
1844
+ {
1845
+ content: `
1846
+ const ${fastLocal} = require('@tamagui/core')._withNativeStyle(${nativeLocal}, ${nativeStyleSource}, ${nativeFastPath.mappingLocal});`,
1847
+ origin: input.element.component.span
1848
+ }
1849
+ ],
1850
+ flattened: true
1851
+ };
1852
+ }
1853
+ const stableLocal = `__TamaguiStable${nativeName}${input.element.span.start}`;
1854
+ const expressions = [];
1855
+ const plainDynamicParts = [];
1856
+ const conditionalParts = [];
1857
+ const conditionalKeys = /* @__PURE__ */ new Set();
1858
+ const baseStyleForDiff = staticObject(nativeStyleResolved) ? nativeStyleResolved : {};
1859
+ for (const entry of dynamicStyleEntries) {
1860
+ if (entry.value.kind === "conditional" && directStyleName(entry.name, component) !== "opacity") {
1861
+ let serializeNativeTree = function(node) {
1862
+ if (node.kind === "leaf") {
1863
+ const diff = leafDiffs.get(node) ?? {};
1864
+ return JSON.stringify(diff);
1865
+ }
1866
+ const index = expressions.length;
1867
+ expressions.push(input.source.slice(node.test.start, node.test.end));
1868
+ return `expressions[${index}] ? ${serializeNativeTree(node.whenTrue)} : ${serializeNativeTree(node.whenFalse)}`;
1869
+ };
1870
+ const tree = entry.value.tree;
1871
+ const leaves = (0, import_compiler_core.collectLeaves)(tree);
1872
+ const leafDiffs = /* @__PURE__ */ new Map();
1873
+ for (const leaf of leaves) {
1874
+ const { branchCompleteProps } = propsForConditional(entry, leaf.value);
1875
+ const branchSplit = resolveSplitStyles(branchCompleteProps, component.staticConfig, cssAnimationDriver, component.displayName);
1876
+ const branchStyle = branchSplit?.viewProps?.style ?? {};
1877
+ if (!staticObject(branchStyle)) {
1878
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch did not resolve to a static native style`, entry.value.span);
1879
+ }
1880
+ for (const viewPropsKey of /* @__PURE__ */ new Set([...Object.keys(branchSplit?.viewProps ?? {}), ...Object.keys(split.viewProps ?? {})])) {
1881
+ if (viewPropsKey === "style") continue;
1882
+ if (JSON.stringify(branchSplit?.viewProps?.[viewPropsKey]) !== JSON.stringify(split.viewProps?.[viewPropsKey])) {
1883
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch changes ${viewPropsKey}, which the compiled style array cannot express`, entry.value.span);
1884
+ }
1885
+ }
1886
+ for (const key of Object.keys(baseStyleForDiff)) {
1887
+ if (!(key in branchStyle)) {
1888
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch removes ${key}, which an additive style array cannot express`, entry.value.span);
1889
+ }
1890
+ }
1891
+ const diff = {};
1892
+ for (const [key, value] of Object.entries(branchStyle)) {
1893
+ if (JSON.stringify(baseStyleForDiff[key]) !== JSON.stringify(value)) {
1894
+ diff[key] = value;
1895
+ }
1896
+ }
1897
+ if (!isSerializableNativeStyle(diff) || core.containsThemeRef(diff)) {
1898
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch style is not statically representable`, entry.value.span);
1899
+ }
1900
+ for (const key of Object.keys(diff)) {
1901
+ if (conditionalKeys.has(key)) {
1902
+ return bailout(input, "local/dynamic-style-value", `Multiple conditionals contribute ${key}; their interaction cannot be resolved per-branch`, entry.value.span);
1903
+ }
1904
+ }
1905
+ leafDiffs.set(leaf, diff);
1906
+ }
1907
+ for (const diff of leafDiffs.values()) {
1908
+ for (const key of Object.keys(diff)) conditionalKeys.add(key);
1909
+ }
1910
+ conditionalParts.push(serializeNativeTree(tree));
1911
+ } else {
1912
+ const index = expressions.length;
1913
+ expressions.push(input.source.slice(entry.value.span.start, entry.value.span.end));
1914
+ plainDynamicParts.push(`${JSON.stringify(directStyleName(entry.name, component))}: expressions[${index}]`);
1915
+ }
1916
+ }
1917
+ const dynamicStyle = plainDynamicParts.join(", ");
1918
+ const themedStyle = themedStyleKeys ? Object.entries(themedStyleKeys).map(([styleKey, themeKey]) => `${JSON.stringify(styleKey)}: _theme[${JSON.stringify(themeKey)}]?.get()`).join(", ") : null;
1919
+ const styleParts = [
1920
+ nativeStyleSource,
1921
+ ...themedStyle ? [`{ ${themedStyle} }`] : [],
1922
+ ...conditionalParts,
1923
+ ...dynamicStyle ? [`{ ${dynamicStyle} }`] : []
1924
+ ];
1925
+ const tagEdits3 = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1926
+ start: span.start,
1927
+ end: span.end,
1928
+ content: stableLocal,
1929
+ origin: span
1930
+ }));
1931
+ const [first3, ...rest3] = styleEntries;
1932
+ const firstNonStyle3 = first3 ? spreadReplacement("jsx", first3) : "";
1933
+ const expressionEdits = styleEntries.length === 0 ? [] : input.element.form === "jsx" ? [{
1934
+ start: first3.span.start,
1935
+ end: first3.span.end,
1936
+ content: [expressions.length > 0 ? `_expressions={[${expressions.join(", ")}]}` : "", firstNonStyle3].filter(Boolean).join(" "),
1937
+ origin: first3.span
1938
+ }, ...rest3.map((entry) => ({
1939
+ start: entry.span.start,
1940
+ end: entry.span.end,
1941
+ content: spreadReplacement("jsx", entry),
1942
+ origin: entry.span
1943
+ }))] : compiledPropsEdits(input, styleEntries, `_expressions: [${expressions.join(", ")}]`, (entry) => spreadReplacement(input.element.form, entry));
1944
+ if (!expressionEdits) {
1945
+ return bailout(input, "local/unsupported-target", `Compiled ${input.element.form} call has no editable props argument`);
1946
+ }
1947
+ return {
1948
+ ok: true,
1949
+ edits: [...tagEdits3, ...expressionEdits],
1950
+ css: [],
1951
+ imports: [
1952
+ ...nativeStyleImports,
1953
+ {
1954
+ content: `
1955
+ const ${nativeLocal} = require('react-native').${nativeExport};`,
1956
+ origin: input.element.component.span
1957
+ },
1958
+ {
1959
+ content: `
1960
+ const ${stableLocal} = require('@tamagui/core')._withStableStyle(${nativeLocal}, (_theme, expressions) => [${styleParts.join(", ")}], ${themedStyleKeys ? "true" : "false"}, false);`,
1961
+ origin: input.element.component.span
1962
+ }
1963
+ ],
1964
+ flattened: true
1965
+ };
1966
+ }
1967
+ const styleContent = `style: ${nativeStyleSource}`;
1968
+ const tagEdits2 = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1969
+ start: span.start,
1970
+ end: span.end,
1971
+ content: nativeLocal,
1972
+ origin: span
1973
+ }));
1974
+ if (input.element.form !== "jsx") {
1975
+ const propsEdits = compiledPropsEdits(input, styleEntries, styleContent, (entry) => spreadReplacement(input.element.form, entry));
1976
+ if (!propsEdits) {
1977
+ return bailout(input, "local/unsupported-target", `Compiled ${input.element.form} call has no editable props argument`);
1978
+ }
1979
+ return {
1980
+ ok: true,
1981
+ edits: [...tagEdits2, ...propsEdits],
1982
+ css: [],
1983
+ imports: [...nativeStyleImports, {
1984
+ content: `
1985
+ const ${nativeLocal} = require('react-native').${nativeExport};`,
1986
+ origin: input.element.component.span
1987
+ }],
1988
+ flattened: true
1989
+ };
1990
+ }
1991
+ if (styleEntries.length === 0) {
1992
+ return {
1993
+ ok: true,
1994
+ edits: [...tagEdits2, {
1995
+ start: input.element.component.span.end,
1996
+ end: input.element.component.span.end,
1997
+ content: ` style={${nativeStyleSource}}`,
1998
+ origin: input.element.component.span
1999
+ }],
2000
+ css: [],
2001
+ imports: [...nativeStyleImports, {
2002
+ content: `
2003
+ const ${nativeLocal} = require('react-native').${nativeExport};`,
2004
+ origin: input.element.component.span
2005
+ }],
2006
+ flattened: true
2007
+ };
2008
+ }
2009
+ const [first2, ...rest2] = styleEntries;
2010
+ const firstNonStyle2 = first2 ? spreadReplacement("jsx", first2) : "";
2011
+ return {
2012
+ ok: true,
2013
+ edits: [
2014
+ ...tagEdits2,
2015
+ ...webPropEdits,
2016
+ {
2017
+ start: first2.span.start,
2018
+ end: first2.span.end,
2019
+ content: [`style={${nativeStyleSource}}`, firstNonStyle2].filter(Boolean).join(" "),
2020
+ origin: first2.span
2021
+ },
2022
+ ...rest2.map((entry) => ({
2023
+ start: entry.span.start,
2024
+ end: entry.span.end,
2025
+ content: spreadReplacement("jsx", entry),
2026
+ origin: entry.span
2027
+ }))
2028
+ ],
2029
+ css: [],
2030
+ imports: [...nativeStyleImports, {
2031
+ content: `
2032
+ const ${nativeLocal} = require('react-native').${nativeExport};`,
2033
+ origin: input.element.component.span
2034
+ }],
2035
+ flattened: true
2036
+ };
2037
+ }
2038
+ const artifacts = extractedStyleArtifacts(split, props, options.tamaguiConfig, !component.domTag, Boolean(component.staticConfig.styleFrontend));
2039
+ const className = artifacts.className;
2040
+ const rawInlineStyle = split.viewProps?.style;
2041
+ const inlineStyle = staticObject(rawInlineStyle) && Object.keys(rawInlineStyle).length > 0 ? rawInlineStyle : null;
2042
+ if (rawInlineStyle && !inlineStyle && !isSerializableNativeStyle(rawInlineStyle)) {
2043
+ return bailout(input, "local/unsupported-target", "Web inline style output is not a static serializable value");
2044
+ }
2045
+ const programCSS = [];
2046
+ const programClassSources = [];
2047
+ if (domStyleProgram?.kind === "prop" && domStyleProgram.value.kind === "dom-style") {
2048
+ for (const item of domStyleProgram.value.items) {
2049
+ if (item.value.kind !== "static" || !staticObject(item.value.value)) {
2050
+ return bailout(input, "local/dynamic-style-value", "Every style() handle in a style array must be statically evaluable", item.value.span);
2051
+ }
2052
+ const itemSplit = resolveSplitStyles(item.value.value, partialStaticConfig(component.staticConfig));
2053
+ if (!itemSplit) {
2054
+ return bailout(input, "local/style-resolution-failed", "A style() handle could not be resolved", item.value.span);
2055
+ }
2056
+ const itemInline = itemSplit.viewProps?.style;
2057
+ if (staticObject(itemInline) && Object.keys(itemInline).length > 0) {
2058
+ return bailout(input, "local/unsupported-target", "Conditional web style() handles must lower to CSS classes", item.value.span);
2059
+ }
2060
+ const itemArtifacts = extractedStyleArtifacts(itemSplit, item.value.value, options.tamaguiConfig, false);
2061
+ programCSS.push(...itemArtifacts.css);
2062
+ if (itemArtifacts.className) {
2063
+ const condition = item.condition ? input.source.slice(item.condition.start, item.condition.end) : null;
2064
+ programClassSources.push(condition ? `(${condition}) && ${JSON.stringify(itemArtifacts.className)}` : JSON.stringify(itemArtifacts.className));
2065
+ }
2066
+ }
2067
+ }
2068
+ const baseStaticClasses = new Set(className.split(" ").filter(Boolean));
2069
+ const staticClasses = new Set(baseStaticClasses);
2070
+ const webConditionalCSS = [];
2071
+ const webConditionalKeys = /* @__PURE__ */ new Set();
2072
+ const webConditionalEntries = supportsWebConditionalClasses ? webClassEntries : [];
2073
+ let webInlineStyle = inlineStyle;
2074
+ const conditionalInlineProperties = [];
2075
+ for (const entry of webConditionalEntries) {
2076
+ let serializeWebTree = function(node) {
2077
+ if (node.kind === "leaf") return JSON.stringify(leafClasses(node));
2078
+ const test = input.source.slice(node.test.start, node.test.end);
2079
+ const truePart = serializeWebTree(node.whenTrue);
2080
+ const falsePart = serializeWebTree(node.whenFalse);
2081
+ return `(${test}) ? ${truePart} : ${falsePart}`;
2082
+ };
2083
+ const tree = entry.value.kind === "conditional" ? entry.value.tree : null;
2084
+ const domain = frontendClassDomain(entry, component);
2085
+ if (!tree && !domain) continue;
2086
+ const leaves = tree ? (0, import_compiler_core.collectLeaves)(tree) : domain.map((value) => ({
2087
+ value,
2088
+ dependencies: []
2089
+ }));
2090
+ const leafArtifactsMap = /* @__PURE__ */ new Map();
2091
+ const leafStyles = /* @__PURE__ */ new Map();
2092
+ const entryConditionalKeys = /* @__PURE__ */ new Set();
2093
+ for (const leaf of leaves) {
2094
+ const { branchProps, branchCompleteProps } = propsForConditional(entry, leaf.value);
2095
+ const branchSplit = resolveSplitStyles(branchCompleteProps, component.staticConfig, cssAnimationDriver, component.displayName);
2096
+ if (!branchSplit) {
2097
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch could not be resolved`, entry.value.span);
2098
+ }
2099
+ for (const viewPropsKey of /* @__PURE__ */ new Set([...Object.keys(branchSplit.viewProps ?? {}), ...Object.keys(split.viewProps ?? {})])) {
2100
+ if (viewPropsKey === "className" || viewPropsKey === "style") continue;
2101
+ if (JSON.stringify(branchSplit.viewProps?.[viewPropsKey]) !== JSON.stringify(split.viewProps?.[viewPropsKey])) {
2102
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch changes ${viewPropsKey}, which conditional classes cannot express`, entry.value.span);
2103
+ }
2104
+ }
2105
+ const branchInline = branchSplit.viewProps?.style;
2106
+ if (branchInline !== void 0 && !staticObject(branchInline)) {
2107
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch style is not a static object`, entry.value.span);
2108
+ }
2109
+ leafStyles.set(leaf, staticObject(branchInline) ? branchInline : {});
2110
+ const changedKeys = /* @__PURE__ */ new Set();
2111
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(branchSplit.classNames ?? {}), ...Object.keys(split.classNames ?? {})])) {
2112
+ if (JSON.stringify(branchSplit.classNames?.[key]) !== JSON.stringify(split.classNames?.[key])) {
2113
+ changedKeys.add(key);
2114
+ }
2115
+ }
2116
+ const branchStyle = branchSplit.viewProps?.style;
2117
+ const baseStyle = split.viewProps?.style;
2118
+ if (staticObject(branchStyle) || staticObject(baseStyle)) {
2119
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(staticObject(branchStyle) ? branchStyle : {}), ...Object.keys(staticObject(baseStyle) ? baseStyle : {})])) {
2120
+ if (JSON.stringify(staticObject(branchStyle) ? branchStyle[key] : void 0) !== JSON.stringify(staticObject(baseStyle) ? baseStyle[key] : void 0)) {
2121
+ changedKeys.add(key);
2122
+ }
2123
+ }
2124
+ }
2125
+ for (const key of changedKeys) {
2126
+ if (webConditionalKeys.has(key)) {
2127
+ return bailout(input, "local/dynamic-style-value", `Multiple conditionals contribute ${key}; their interaction cannot be resolved per-branch`, entry.value.span);
2128
+ }
2129
+ entryConditionalKeys.add(key);
2130
+ }
2131
+ if (conflictsWithInline(changedKeys, laneAOwners, laneAMemberOwners)) {
2132
+ return bailout(input, "local/dynamic-style-value", `${entry.name} and an inline dynamic style both contribute a CSS property; their precedence cannot be resolved per-branch`, entry.value.span);
2133
+ }
2134
+ const branchArtifacts = extractedStyleArtifacts(branchSplit, branchProps, options.tamaguiConfig, !component.domTag, Boolean(component.staticConfig.styleFrontend));
2135
+ leafArtifactsMap.set(leaf, {
2136
+ classes: branchArtifacts.className.split(" ").filter(Boolean),
2137
+ css: branchArtifacts.css
2138
+ });
2139
+ }
2140
+ for (const key of entryConditionalKeys) webConditionalKeys.add(key);
2141
+ const styleKeys = new Set(Object.keys(webInlineStyle ?? {}));
2142
+ for (const leaf of leaves) {
2143
+ for (const key of Object.keys(leafStyles.get(leaf) ?? {})) styleKeys.add(key);
2144
+ }
2145
+ for (const key of styleKeys) {
2146
+ const serialized = leaves.map((leaf) => JSON.stringify(leafStyles.get(leaf)?.[key]));
2147
+ if (serialized.every((value) => value === serialized[0])) {
2148
+ if (serialized[0] === JSON.stringify(webInlineStyle?.[key])) continue;
2149
+ const next = { ...webInlineStyle };
2150
+ if (serialized[0] === void 0) delete next[key];
2151
+ else next[key] = leafStyles.get(leaves[0])[key];
2152
+ webInlineStyle = Object.keys(next).length > 0 ? next : null;
2153
+ continue;
2154
+ }
2155
+ if (!tree) {
2156
+ return bailout(input, "local/dynamic-style-value", `Conditional ${entry.name} branch changes style, which a class table cannot express`, entry.value.span);
2157
+ }
2158
+ const serializeValue = (node) => {
2159
+ if (node.kind === "leaf") return String(JSON.stringify(leafStyles.get(node)?.[key]));
2160
+ const test = input.source.slice(node.test.start, node.test.end);
2161
+ return `(${test}) ? ${serializeValue(node.whenTrue)} : ${serializeValue(node.whenFalse)}`;
2162
+ };
2163
+ conditionalInlineProperties.push(`${JSON.stringify(key)}: (${serializeValue(tree)})`);
2164
+ }
2165
+ for (const artifacts2 of leafArtifactsMap.values()) {
2166
+ webConditionalCSS.push(...artifacts2.css);
2167
+ }
2168
+ const allLeafArtifacts = leaves.map((l) => leafArtifactsMap.get(l));
2169
+ const sharedInConditional = new Set(allLeafArtifacts[0]?.classes.filter((c) => allLeafArtifacts.every((a) => a.classes.includes(c))) ?? []);
2170
+ for (const cls of baseStaticClasses) {
2171
+ if (!sharedInConditional.has(cls)) staticClasses.delete(cls);
2172
+ }
2173
+ for (const cls of sharedInConditional) {
2174
+ if (!baseStaticClasses.has(cls)) staticClasses.add(cls);
2175
+ }
2176
+ const leafClasses = (leaf) => {
2177
+ const artifacts2 = leafArtifactsMap.get(leaf);
2178
+ const only = artifacts2 ? artifacts2.classes.filter((item) => !sharedInConditional.has(item)) : [];
2179
+ return only.join(" ");
2180
+ };
2181
+ if (leaves.every((leaf) => leafClasses(leaf) === "")) {} else if (tree) {
2182
+ programClassSources.push(serializeWebTree(tree));
2183
+ } else {
2184
+ const table = Object.fromEntries(leaves.map((leaf) => [leaf.value, leafClasses(leaf)]));
2185
+ const key = input.source.slice(entry.value.span.start, entry.value.span.end);
2186
+ programClassSources.push(`(${JSON.stringify(table)})[${key}]`);
2187
+ }
2188
+ }
2189
+ const webClassName = [...staticClasses].join(" ");
2190
+ const hasStyleProgram = programClassSources.length > 0;
2191
+ const classNameExpression = hasStyleProgram ? `[${[JSON.stringify(webClassName), ...programClassSources].join(", ")}].filter(Boolean).join(" ")` : null;
2192
+ const webInlineProperties = [...dynamicHostStyleProperties ?? [], ...conditionalInlineProperties];
2193
+ const serializedInlineStyle = serializedStyle(webInlineStyle, webInlineProperties);
2194
+ const jsxWebStyle = classNameExpression ? [`className={${classNameExpression}}`, serializedInlineStyle ? `style={${serializedInlineStyle}}` : ""].filter(Boolean).join(" ") : jsxStyleAttributes(webClassName, webInlineStyle, webInlineProperties);
2195
+ const objectWebStyle = classNameExpression ? [`className: ${classNameExpression}`, serializedInlineStyle ? `style: ${serializedInlineStyle}` : ""].filter(Boolean).join(", ") : objectStyleProperties(webClassName, webInlineStyle, webInlineProperties);
2196
+ const webCSS = [.../* @__PURE__ */ new Set([
2197
+ ...artifacts.css,
2198
+ ...programCSS,
2199
+ ...webConditionalCSS
2200
+ ])];
2201
+ const webExtraProps = serializedProps(input.element.form, webDOMResult.additions);
2202
+ if (input.element.form !== "jsx") {
2203
+ const replacement = [objectWebStyle, webExtraProps].filter(Boolean).join(", ");
2204
+ const propsEdits = compiledPropsEdits(input, styleEntries, replacement, (entry) => spreadReplacement(input.element.form, entry));
2205
+ if (!propsEdits) {
2206
+ return bailout(input, "local/unsupported-target", `Compiled ${input.element.form} call has no editable props argument`);
2207
+ }
2208
+ return {
2209
+ ok: true,
2210
+ edits: [
2211
+ ...tagEdits,
2212
+ ...webPropEdits,
2213
+ ...propsEdits
2214
+ ],
2215
+ css: webCSS,
2216
+ imports: [],
2217
+ flattened: true
2218
+ };
2219
+ }
2220
+ if (styleEntries.length === 0) {
2221
+ const attributes2 = [jsxWebStyle, webExtraProps].filter(Boolean).join(" ");
2222
+ return {
2223
+ ok: true,
2224
+ edits: attributes2 ? [
2225
+ ...tagEdits,
2226
+ ...webPropEdits,
2227
+ {
2228
+ start: input.element.component.span.end,
2229
+ end: input.element.component.span.end,
2230
+ content: ` ${attributes2}`,
2231
+ origin: input.element.component.span
2232
+ }
2233
+ ] : [...tagEdits, ...webPropEdits],
2234
+ css: webCSS,
2235
+ imports: [],
2236
+ flattened: true
2237
+ };
2238
+ }
2239
+ const [first, ...rest] = styleEntries;
2240
+ const firstNonStyle = first ? spreadReplacement("jsx", first) : "";
2241
+ const attributes = [
2242
+ jsxWebStyle,
2243
+ webExtraProps,
2244
+ firstNonStyle
2245
+ ].filter(Boolean).join(" ");
2246
+ return {
2247
+ ok: true,
2248
+ edits: [
2249
+ ...tagEdits,
2250
+ ...webPropEdits,
2251
+ {
2252
+ start: first.span.start,
2253
+ end: first.span.end,
2254
+ content: attributes,
2255
+ origin: first.span
2256
+ },
2257
+ ...rest.map((entry) => ({
2258
+ start: entry.span.start,
2259
+ end: entry.span.end,
2260
+ content: spreadReplacement("jsx", entry),
2261
+ origin: entry.span
2262
+ }))
2263
+ ],
2264
+ css: webCSS,
2265
+ imports: [],
2266
+ flattened: true
2267
+ };
2268
+ }
2269
+ };
2270
+ }
2271
+ function bailout(input, code, message, span = input.element.span, zero, prop) {
2272
+ return {
2273
+ ok: false,
2274
+ bailout: {
2275
+ code,
2276
+ kind: "local",
2277
+ message,
2278
+ span,
2279
+ component: input.element.component.name,
2280
+ ...prop && { prop },
2281
+ ...zero && {
2282
+ zeroRule: zero.rule,
2283
+ zeroMessage: zero.message
2284
+ }
2285
+ }
2286
+ };
2287
+ }