@stacksjs/stx 0.2.607 → 0.2.611

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 (229) hide show
  1. package/dist/chunk-02dcqhzy.js +2 -0
  2. package/dist/{chunk-vw62fjpv.js → chunk-0ff64x1p.js} +3 -3
  3. package/dist/chunk-0fgp13q4.js +2 -0
  4. package/dist/chunk-0gpjks6k.js +2 -0
  5. package/dist/chunk-1239cnda.js +2 -0
  6. package/dist/chunk-1qx531pp.js +2 -0
  7. package/dist/chunk-24tx4ysv.js +2 -0
  8. package/dist/{chunk-zs3ezqy3.js → chunk-2h8xmmtk.js} +1 -1
  9. package/dist/{chunk-6xsm53pz.js → chunk-2pgvbe5x.js} +4 -4
  10. package/dist/chunk-2pkx524z.js +2 -0
  11. package/dist/{chunk-0v89nfz1.js → chunk-2y0qy214.js} +2 -2
  12. package/dist/chunk-2y80c34h.js +2 -0
  13. package/dist/{chunk-tbsjg23k.js → chunk-2z56183d.js} +4 -4
  14. package/dist/{chunk-vntpfbwy.js → chunk-34x22hbs.js} +1 -1
  15. package/dist/{chunk-qh07a85k.js → chunk-39fqkzyb.js} +3 -3
  16. package/dist/{chunk-81qmj3sd.js → chunk-3d658f6n.js} +7 -7
  17. package/dist/{chunk-cp901m61.js → chunk-3v862v2c.js} +1 -1
  18. package/dist/{chunk-5s47qfp6.js → chunk-3wmt7ykt.js} +2 -2
  19. package/dist/chunk-4j3fmxeg.js +2 -0
  20. package/dist/{chunk-y54fz9rk.js → chunk-4rtxkqwh.js} +2 -2
  21. package/dist/chunk-5f330rrj.js +2 -0
  22. package/dist/{chunk-s4pjf2pc.js → chunk-5rtatjwq.js} +2 -2
  23. package/dist/{chunk-wzjf33es.js → chunk-5vnx8dmz.js} +2 -2
  24. package/dist/chunk-5ys7azpj.js +2 -0
  25. package/dist/chunk-64vnwrkw.js +2 -0
  26. package/dist/chunk-65jsp5fd.js +3 -0
  27. package/dist/{chunk-bsy8v1xj.js → chunk-66e4ga0z.js} +3 -3
  28. package/dist/{chunk-4tj0ap61.js → chunk-6yrjyrc2.js} +5 -5
  29. package/dist/{chunk-td5100fz.js → chunk-70n1t4ht.js} +7 -7
  30. package/dist/chunk-7446n6a3.js +2 -0
  31. package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
  32. package/dist/chunk-76ebcf61.js +2 -0
  33. package/dist/chunk-7aa4qncj.js +2 -0
  34. package/dist/chunk-7awf2gqs.js +2 -0
  35. package/dist/{chunk-dxqwm8tr.js → chunk-7g47wdd9.js} +3 -3
  36. package/dist/{chunk-m9h7pmkh.js → chunk-8211vr9v.js} +5 -5
  37. package/dist/chunk-84f8tft8.js +2 -0
  38. package/dist/{chunk-yzj55rfs.js → chunk-8f616tym.js} +3 -3
  39. package/dist/chunk-8t8wf1w2.js +2 -0
  40. package/dist/chunk-961nvcxw.js +43 -0
  41. package/dist/{chunk-xjxc4q3w.js → chunk-999d4sns.js} +21 -21
  42. package/dist/{chunk-r4h8fg1x.js → chunk-9dx519z6.js} +1 -1
  43. package/dist/{chunk-dnqq1ze0.js → chunk-9kzdk4na.js} +3 -3
  44. package/dist/chunk-9mmy9m0y.js +2 -0
  45. package/dist/{chunk-bhf9yt2w.js → chunk-9n7ehv7w.js} +2 -2
  46. package/dist/{chunk-dmdhbwmn.js → chunk-9nh7vxk1.js} +3 -3
  47. package/dist/chunk-9vxdjpn5.js +2 -0
  48. package/dist/chunk-aw79nm5c.js +127 -0
  49. package/dist/chunk-brbybne9.js +2 -0
  50. package/dist/chunk-cg8hg6cs.js +3 -0
  51. package/dist/{chunk-azpkje69.js → chunk-cjrfazzb.js} +34 -10
  52. package/dist/chunk-cjvq46n8.js +3 -0
  53. package/dist/chunk-cwvazqab.js +2 -0
  54. package/dist/{chunk-67tpacz0.js → chunk-cwxkgbck.js} +1 -1
  55. package/dist/chunk-d17mhbz9.js +2850 -0
  56. package/dist/{chunk-vp3fzjsc.js → chunk-det49x62.js} +2 -2
  57. package/dist/{chunk-tydv84gj.js → chunk-dtt7k0bz.js} +2 -2
  58. package/dist/{chunk-ev6w9c69.js → chunk-e98jqwnf.js} +1 -1
  59. package/dist/{chunk-8fq6bvnw.js → chunk-eg5yfnrn.js} +33 -33
  60. package/dist/chunk-ekfmad19.js +2 -0
  61. package/dist/{chunk-ghdyqt98.js → chunk-ewsd3apq.js} +2 -2
  62. package/dist/chunk-exwjabr5.js +2 -0
  63. package/dist/chunk-f19bzr36.js +2 -0
  64. package/dist/{chunk-5e182xqt.js → chunk-f8tts10s.js} +1 -1
  65. package/dist/chunk-fa0aa98d.js +2 -0
  66. package/dist/chunk-fgrjv29d.js +18 -0
  67. package/dist/chunk-fjx1sbg2.js +2 -0
  68. package/dist/{chunk-sswjv8p9.js → chunk-g22q68ds.js} +2 -2
  69. package/dist/chunk-g24kapd5.js +2 -0
  70. package/dist/{chunk-g04y5wyn.js → chunk-gbk2dbt1.js} +4 -4
  71. package/dist/{chunk-rmv35cx0.js → chunk-gk4c8d1c.js} +2 -2
  72. package/dist/{chunk-aestp72s.js → chunk-gn75qghq.js} +1 -1
  73. package/dist/chunk-gvv4d0tp.js +2 -0
  74. package/dist/chunk-h3fr7c5y.js +2 -0
  75. package/dist/{chunk-g63ye3fe.js → chunk-h3tzc41t.js} +2 -2
  76. package/dist/{chunk-vehtypx0.js → chunk-h7y89m22.js} +2 -2
  77. package/dist/{chunk-1jxdkp8x.js → chunk-hj49vk9e.js} +6 -6
  78. package/dist/chunk-hjp38m0w.js +3 -0
  79. package/dist/chunk-hwt7pyqt.js +2 -0
  80. package/dist/{chunk-x8q5przn.js → chunk-hxzy2t7r.js} +11 -11
  81. package/dist/{chunk-tcd2zez3.js → chunk-j18z5nxq.js} +2 -2
  82. package/dist/chunk-jp1xjh1f.js +2 -0
  83. package/dist/chunk-jrccxnbt.js +2 -0
  84. package/dist/chunk-jv3rdes9.js +2 -0
  85. package/dist/chunk-k36ve5ct.js +2 -0
  86. package/dist/chunk-k5vytrbx.js +2 -0
  87. package/dist/chunk-k7vg01vv.js +2 -0
  88. package/dist/chunk-kayh4pcw.js +2 -0
  89. package/dist/chunk-myg6gz76.js +2 -0
  90. package/dist/{chunk-jpxekhdh.js → chunk-n05hxy7w.js} +3 -3
  91. package/dist/{chunk-t9t66sz4.js → chunk-n1qr6n92.js} +6 -6
  92. package/dist/{chunk-77kpsnf6.js → chunk-n4f3fzp5.js} +85 -85
  93. package/dist/chunk-n6tspwf9.js +2 -0
  94. package/dist/{chunk-z2xrwmjr.js → chunk-nd8yx3qq.js} +10 -10
  95. package/dist/chunk-nfdma5hp.js +2 -0
  96. package/dist/chunk-ng819bkf.js +2 -0
  97. package/dist/{chunk-kxjd6e2h.js → chunk-pc15w7bb.js} +2 -2
  98. package/dist/{chunk-z8fhtym2.js → chunk-pkgmyg4r.js} +2 -2
  99. package/dist/{chunk-53y4z4p2.js → chunk-pm1gnjs5.js} +3 -3
  100. package/dist/{chunk-6by8dtan.js → chunk-pmpqzqq8.js} +2 -2
  101. package/dist/chunk-pnyxqze0.js +2 -0
  102. package/dist/{chunk-cfpenvc7.js → chunk-pyqrj2wk.js} +3 -3
  103. package/dist/chunk-qa5c5x2n.js +2 -0
  104. package/dist/chunk-qqenm7pg.js +40 -0
  105. package/dist/{chunk-5j29466h.js → chunk-r4xnqag4.js} +2 -2
  106. package/dist/chunk-r8a96bbd.js +2 -0
  107. package/dist/{chunk-1dd4qefr.js → chunk-s5s1w8na.js} +2 -2
  108. package/dist/chunk-sakagfdq.js +2 -0
  109. package/dist/chunk-sj0bkdy8.js +2 -0
  110. package/dist/chunk-spkwmfbm.js +2 -0
  111. package/dist/chunk-swv69q75.js +4 -0
  112. package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
  113. package/dist/{chunk-tfjcs55e.js → chunk-tk50q4zs.js} +12 -12
  114. package/dist/chunk-v6xk1q66.js +2 -0
  115. package/dist/{chunk-60wedefh.js → chunk-vep8d57h.js} +1 -1
  116. package/dist/chunk-vfk3vn6j.js +2 -0
  117. package/dist/{chunk-bspryr4a.js → chunk-vyjwag3f.js} +9 -9
  118. package/dist/{chunk-w8g2ppnr.js → chunk-w0h27sf8.js} +2 -2
  119. package/dist/chunk-w1szscbz.js +2 -0
  120. package/dist/{chunk-20k77e2a.js → chunk-wa26bn4s.js} +4 -4
  121. package/dist/chunk-wb9rbwb1.js +2 -0
  122. package/dist/{chunk-td30jg06.js → chunk-wdy6y0fq.js} +2 -2
  123. package/dist/chunk-wkx2m2br.js +2 -0
  124. package/dist/{chunk-mvwcf4xy.js → chunk-wyndxr8w.js} +4 -4
  125. package/dist/chunk-x73w6v8m.js +2 -0
  126. package/dist/{chunk-79edpvb2.js → chunk-x8y7yqwh.js} +7 -7
  127. package/dist/{chunk-7095f0hb.js → chunk-xap2cbkd.js} +9 -9
  128. package/dist/{chunk-wqmm1qsz.js → chunk-xh98677z.js} +5 -5
  129. package/dist/chunk-yagzr2ry.js +2 -0
  130. package/dist/chunk-yda8t21j.js +2 -0
  131. package/dist/{chunk-efy3038a.js → chunk-ydz9j0d3.js} +2 -2
  132. package/dist/chunk-yydx0sfy.js +2 -0
  133. package/dist/{chunk-r69jfs59.js → chunk-z79gnz6z.js} +1 -1
  134. package/dist/{chunk-c65q0svd.js → chunk-z7ezxqmg.js} +5 -5
  135. package/dist/{chunk-k3f4044e.js → chunk-zatgmkx7.js} +2 -2
  136. package/dist/chunk-zg0z8qt6.js +2 -0
  137. package/dist/{chunk-0cb00ys2.js → chunk-znwnacwz.js} +5 -5
  138. package/dist/cli.js +46 -46
  139. package/dist/craft-entry.js +2 -2
  140. package/dist/craft.js +2 -2
  141. package/dist/expressions.d.ts +0 -23
  142. package/dist/expressions.js +14 -11
  143. package/dist/includes.js +6 -0
  144. package/dist/native/compiler/component-mapping.js +1 -0
  145. package/dist/native/compiler/headwind-to-style.js +17 -0
  146. package/dist/native/compiler/html-to-ir.js +1 -0
  147. package/dist/native/compiler/inline-style.js +2 -0
  148. package/dist/native/compiler/ir.d.ts +2 -0
  149. package/dist/native/components/primitives.d.ts +33 -9
  150. package/dist/native/components/primitives.js +1 -0
  151. package/dist/native/primitives/MapPolygon.stx +2 -0
  152. package/dist/native/prop-names.js +1 -3
  153. package/dist/native/runtime/craft-bridge.js +22 -1
  154. package/dist/native/runtime/craft.d.ts +10 -0
  155. package/dist/process.js +3 -2
  156. package/dist/pwa.js +3 -3
  157. package/dist/script-validation.js +4 -4
  158. package/dist/serve.js +5 -1
  159. package/dist/ssg.js +13 -13
  160. package/dist/utils.js +15 -2
  161. package/package.json +5 -5
  162. package/dist/chunk-06wv8qwy.js +0 -40
  163. package/dist/chunk-0d6b3eeb.js +0 -2
  164. package/dist/chunk-0mgth7cm.js +0 -2
  165. package/dist/chunk-1fdrhfc0.js +0 -2
  166. package/dist/chunk-2n59ahd9.js +0 -2
  167. package/dist/chunk-2pwjnydp.js +0 -2
  168. package/dist/chunk-2r4an7bh.js +0 -2
  169. package/dist/chunk-304vaxnk.js +0 -2
  170. package/dist/chunk-32hr3qq7.js +0 -2
  171. package/dist/chunk-36n8yz6t.js +0 -2
  172. package/dist/chunk-39pgf5z3.js +0 -2
  173. package/dist/chunk-3xwzd9wp.js +0 -2845
  174. package/dist/chunk-3yttgk0s.js +0 -2
  175. package/dist/chunk-4ck2xc8m.js +0 -2
  176. package/dist/chunk-4jasfhh6.js +0 -2
  177. package/dist/chunk-4szajb1z.js +0 -2
  178. package/dist/chunk-61ztfana.js +0 -127
  179. package/dist/chunk-7f63z4xx.js +0 -2
  180. package/dist/chunk-7renf4zp.js +0 -2
  181. package/dist/chunk-8bzx0r0x.js +0 -2
  182. package/dist/chunk-974dxazw.js +0 -2
  183. package/dist/chunk-9fpnnfr3.js +0 -2
  184. package/dist/chunk-9sgt7v77.js +0 -2
  185. package/dist/chunk-9zzhpp2a.js +0 -2
  186. package/dist/chunk-aan7601v.js +0 -2
  187. package/dist/chunk-b4tbqz8r.js +0 -2
  188. package/dist/chunk-bakxqwnz.js +0 -2
  189. package/dist/chunk-be2kmw0p.js +0 -2
  190. package/dist/chunk-bnpb6ez9.js +0 -2
  191. package/dist/chunk-c48mh4d6.js +0 -18
  192. package/dist/chunk-dzbkgsv8.js +0 -4
  193. package/dist/chunk-ewkza45r.js +0 -2
  194. package/dist/chunk-exd1h9sd.js +0 -2
  195. package/dist/chunk-fcgf8d5k.js +0 -2
  196. package/dist/chunk-gw2dvp35.js +0 -2
  197. package/dist/chunk-h9drxwva.js +0 -2
  198. package/dist/chunk-hrr7k1qc.js +0 -2
  199. package/dist/chunk-j04brkj0.js +0 -2
  200. package/dist/chunk-jbvwg4gs.js +0 -2
  201. package/dist/chunk-jshj69dy.js +0 -2
  202. package/dist/chunk-k4wkfhvz.js +0 -2
  203. package/dist/chunk-km9a5gp4.js +0 -2
  204. package/dist/chunk-m95zjk91.js +0 -3
  205. package/dist/chunk-mgj0ngyq.js +0 -2
  206. package/dist/chunk-n35yc890.js +0 -3
  207. package/dist/chunk-n39ezmxz.js +0 -2
  208. package/dist/chunk-n8eavnxf.js +0 -2
  209. package/dist/chunk-p8sv5fqs.js +0 -2
  210. package/dist/chunk-pghtgep5.js +0 -2
  211. package/dist/chunk-pt7e0be5.js +0 -2
  212. package/dist/chunk-q40ahbjs.js +0 -2
  213. package/dist/chunk-qjxxhdv7.js +0 -2
  214. package/dist/chunk-rp93n4z7.js +0 -3
  215. package/dist/chunk-rrw2jg26.js +0 -2
  216. package/dist/chunk-rxja040z.js +0 -2
  217. package/dist/chunk-sx0qbekt.js +0 -2
  218. package/dist/chunk-t83acmv2.js +0 -2
  219. package/dist/chunk-tc176d93.js +0 -2
  220. package/dist/chunk-wjhhb6dn.js +0 -2
  221. package/dist/chunk-wm8w2721.js +0 -2
  222. package/dist/chunk-wtax276j.js +0 -2
  223. package/dist/chunk-wy53pys4.js +0 -43
  224. package/dist/chunk-x49qdt4c.js +0 -2
  225. package/dist/chunk-y0zyzbjf.js +0 -2
  226. package/dist/chunk-yn2d8x8m.js +0 -3
  227. package/dist/chunk-z8mdsjzw.js +0 -2
  228. package/dist/chunk-zg87pybq.js +0 -2
  229. package/dist/chunk-zq345s76.js +0 -2
@@ -0,0 +1,127 @@
1
+ // @bun
2
+ import"./chunk-qqenm7pg.js";import"./chunk-5vnx8dmz.js";import"./chunk-cjrfazzb.js";import{Er,no,oa}from"./chunk-g22q68ds.js";import"./chunk-66e4ga0z.js";import{Ke,_e,re,Mt,fe,xn,Sn,Ee,dr,n,o}from"./chunk-d17mhbz9.js";import"./chunk-hxzy2t7r.js";import"./chunk-70n1t4ht.js";import"./chunk-9n7ehv7w.js";import"./chunk-s5s1w8na.js";import"./chunk-gk4c8d1c.js";import"./chunk-2pgvbe5x.js";import{He}from"./chunk-999d4sns.js";import"./chunk-5rtatjwq.js";import"./chunk-z7ezxqmg.js";import{cs}from"./chunk-znwnacwz.js";import"./chunk-9kzdk4na.js";import{existsSync as de,mkdirSync as lr,readFileSync as ur}from"fs";import X from"path";import{existsSync as $e,mkdirSync as _t,realpathSync as Zn,rmSync as At}from"fs";import P from"path";import{existsSync as Gn}from"fs";import ee from"path";var Ot="data-stx-b",Xe=new Set(no),Bt=new Set(Er);function Dt(r){if(r==="ref"||r==="data-stx-ref")return"ref";if(r.startsWith("::"))return null;if(r.startsWith("@bind:")||r.startsWith("x-bind:"))return"attr";if(r.startsWith("@")||r.startsWith(":")){let e=r.slice(1).split(".")[0];if(Xe.has(e))return e==="if"?"if":e;if(e==="for"||e==="else"||e==="else-if"||e==="elseif")return"for";if(oa(e))return"event";if(r.startsWith("@"))return"event";return"attr"}if(r.startsWith("x-")){let e=r.split(".")[0];if(!Bt.has(e))return"attr";let t=e.slice(2);if(t==="cloak"||t==="data"||t==="bind")return null;if(t==="tooltip"||t==="tooltip-position")return null;return Xe.has(t)?t==="if"?"if":t:"attr"}return null}function Lt(r){let e=[];for(let[t,i]of r){let s=Dt(t);if(s)e.push({name:t,value:i,kind:s})}return e}var Vt=/<([a-z][\w-]*)((?:\s+[^\s"'=<>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)\s*\/?>/gi,ge=/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;function ze(r){let e=[],t=0;return{html:r.replace(Vt,(s,a,c)=>{if(!c||!/[:@]|x-/.test(c))return s;let l=[];ge.lastIndex=0;for(let b=ge.exec(c);b;b=ge.exec(c))l.push([b[1],b[2]??b[3]??b[4]??""]);let u=Lt(l);if(!u.length)return s;let m={id:t++,bindings:u};if(u.some((b)=>b.kind==="for"))m.template=!0;e.push(m);let w=s.endsWith("/>");return`${s.slice(0,w?-2:-1).trimEnd()} ${Ot}="${m.id}"${w?"/>":">"}`}),manifest:{entries:e}}}import un from"path";function ne(r){let e=r&&/^(\d+(?:\.\d+)?|\.\d+)(px|rem)?$/.exec(r.trim());if(!e)return;let t=Number(e[1])*(e[2]==="rem"?16:1);return Number.isFinite(t)?t:void 0}function he(r,e){if(!re[r])return;return ne(e?.get(Mt(r))??re[r].value)}function me(r,e){let t=xn[r];if(!t)return;return ne(e?.get(Ee(t))??fe[t]?.value)}function ye(r,e){let t=Sn[r];if(!t)return;let i=ne(e?.get(Ee(t.size))??fe[t.size]?.value),s=ne(e?.get(Ee(t.leading))??fe[t.leading]?.value);if(i===void 0||s===void 0)return;return{fontSize:i,lineHeight:s}}var $t={transparent:"transparent",current:"currentColor",black:"#000000",white:"#ffffff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},Je={px:1,0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},Ue={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},qe={none:0,sm:2,DEFAULT:4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999};function q(r){let e=r.lastIndexOf("/");if(e>0&&!r.endsWith("]")){let i=q(r.slice(0,e)),s=r.slice(e+1),a=/^\[(.+)\]$/.test(s)?Number.parseFloat(s.slice(1,-1))*(s.includes("%")?1:100):Number.parseFloat(s);if(!i||!Number.isFinite(a))return;return Ft(i,a/100)}if(r==="transparent")return"transparent";if(r==="current")return"currentColor";if(r==="black")return"#000000";if(r==="white")return"#ffffff";let t=r.split("-");if(t.length===2){let[i,s]=t,a=$t[i];if(a&&typeof a==="object")return a[s]}if(r.startsWith("[")&&r.endsWith("]")){let i=r.slice(1,-1);return/^(#|rgba?\(|hsla?\(|[a-z]+$)/i.test(i)?i:void 0}return}function ve(r){return q(r.trim())}function Ft(r,e){if(r==="transparent")return r;let t=r.startsWith("#")?r.slice(1):"";if(t.length===3)t=t.split("").map((s)=>s+s).join("");if(t.length===8)t=t.slice(0,6);if(t.length!==6)return;let i=Math.round(Math.min(1,Math.max(0,e))*255);return`#${t}${i.toString(16).padStart(2,"0")}`}function be(r,e=16){if(!r.startsWith("[")||!r.endsWith("]"))return;let t=r.slice(1,-1),i=Number.parseFloat(t);if(!Number.isFinite(i))return;if(t.endsWith("rem"))return i*16;if(t.endsWith("em"))return i*e;return i}function C(r){if(r.startsWith("[")&&r.endsWith("]")){let e=r.slice(1,-1);if(e.endsWith("%"))return;let t=e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e);return Number.isFinite(t)?t:void 0}return Je[r]??me(r)}function ie(r){let e=/^\[(-?\d*\.?\d+)%\]$/.exec(r);if(e)return`${Number.parseFloat(e[1])}%`;return C(r)}var jt={flex:(r,e)=>(e.display="flex",!0),hidden:(r,e)=>(e.display="none",!0),grid:(r,e)=>(e.display="grid",!0),"flex-row":(r,e)=>(e.flexDirection="row",!0),"flex-col":(r,e)=>(e.flexDirection="column",!0),"flex-row-reverse":(r,e)=>(e.flexDirection="row-reverse",!0),"flex-col-reverse":(r,e)=>(e.flexDirection="column-reverse",!0),"flex-wrap":(r,e)=>(e.flexWrap="wrap",!0),"flex-nowrap":(r,e)=>(e.flexWrap="nowrap",!0),"flex-wrap-reverse":(r,e)=>(e.flexWrap="wrap-reverse",!0),"flex-1":(r,e)=>(e.flex=1,e.flexGrow=1,e.flexShrink=1,e.flexBasis=0,!0),"flex-auto":(r,e)=>(e.flexGrow=1,e.flexShrink=1,!0),"flex-initial":(r,e)=>(e.flexGrow=0,e.flexShrink=1,!0),"flex-none":(r,e)=>(e.flexGrow=0,e.flexShrink=0,!0),grow:(r,e)=>(e.flexGrow=1,!0),"grow-0":(r,e)=>(e.flexGrow=0,!0),shrink:(r,e)=>(e.flexShrink=1,!0),"shrink-0":(r,e)=>(e.flexShrink=0,!0),"order-first":(r,e)=>(e.order=-9999,!0),"order-last":(r,e)=>(e.order=9999,!0),"order-none":(r,e)=>(e.order=0,!0),"justify-start":(r,e)=>(e.justifyContent="flex-start",!0),"justify-center":(r,e)=>(e.justifyContent="center",!0),"justify-end":(r,e)=>(e.justifyContent="flex-end",!0),"justify-between":(r,e)=>(e.justifyContent="space-between",!0),"justify-around":(r,e)=>(e.justifyContent="space-around",!0),"justify-evenly":(r,e)=>(e.justifyContent="space-evenly",!0),"items-start":(r,e)=>(e.alignItems="flex-start",!0),"items-center":(r,e)=>(e.alignItems="center",!0),"items-end":(r,e)=>(e.alignItems="flex-end",!0),"items-stretch":(r,e)=>(e.alignItems="stretch",!0),"items-baseline":(r,e)=>(e.alignItems="baseline",!0),"self-auto":(r,e)=>(e.alignSelf="auto",!0),"self-start":(r,e)=>(e.alignSelf="flex-start",!0),"self-center":(r,e)=>(e.alignSelf="center",!0),"self-end":(r,e)=>(e.alignSelf="flex-end",!0),"self-stretch":(r,e)=>(e.alignSelf="stretch",!0),"self-baseline":(r,e)=>(e.alignSelf="baseline",!0),"min-w-0":(r,e)=>(e.minWidth=0,!0),"aspect-square":(r,e)=>(e.aspectRatio=1,!0),"inset-0":(r,e)=>(e.top=0,e.right=0,e.bottom=0,e.left=0,!0),"tracking-tighter":(r,e)=>(e.letterSpacing=-0.8,!0),"tracking-tight":(r,e)=>(e.letterSpacing=-0.4,!0),"tracking-normal":(r,e)=>(e.letterSpacing=0,!0),"tracking-wide":(r,e)=>(e.letterSpacing=0.4,!0),"tracking-wider":(r,e)=>(e.letterSpacing=0.8,!0),"tracking-widest":(r,e)=>(e.letterSpacing=1.6,!0),"tabular-nums":()=>!0,block:()=>!0,"inline-flex":(r,e)=>(e.display="flex",!0),truncate:()=>!0,relative:(r,e)=>(e.position="relative",!0),absolute:(r,e)=>(e.position="absolute",!0),"overflow-visible":(r,e)=>(e.overflow="visible",!0),"overflow-hidden":(r,e)=>(e.overflow="hidden",!0),"overflow-scroll":(r,e)=>(e.overflow="scroll",!0),"overflow-x-auto":()=>!0,"overflow-x-scroll":()=>!0,"overflow-y-auto":()=>!0,"overflow-y-scroll":()=>!0,"font-thin":(r,e)=>(e.fontWeight="100",!0),"font-extralight":(r,e)=>(e.fontWeight="200",!0),"font-light":(r,e)=>(e.fontWeight="300",!0),"font-normal":(r,e)=>(e.fontWeight="400",!0),"font-medium":(r,e)=>(e.fontWeight="500",!0),"font-semibold":(r,e)=>(e.fontWeight="600",!0),"font-bold":(r,e)=>(e.fontWeight="bold",!0),"font-extrabold":(r,e)=>(e.fontWeight="800",!0),"font-black":(r,e)=>(e.fontWeight="900",!0),italic:(r,e)=>(e.fontStyle="italic",!0),"not-italic":(r,e)=>(e.fontStyle="normal",!0),"text-left":(r,e)=>(e.textAlign="left",!0),"text-center":(r,e)=>(e.textAlign="center",!0),"text-right":(r,e)=>(e.textAlign="right",!0),"text-justify":(r,e)=>(e.textAlign="justify",!0),uppercase:(r,e)=>(e.textTransform="uppercase",!0),lowercase:(r,e)=>(e.textTransform="lowercase",!0),capitalize:(r,e)=>(e.textTransform="capitalize",!0),"normal-case":(r,e)=>(e.textTransform="none",!0),underline:(r,e)=>(e.textDecorationLine="underline",!0),"line-through":(r,e)=>(e.textDecorationLine="line-through",!0),"no-underline":(r,e)=>(e.textDecorationLine="none",!0)};function Wt(r,e){if(!r.startsWith("bg-"))return!1;let t=r.slice(3),i=q(t);if(i)return e.backgroundColor=i,!0;return!1}function Xt(r,e){if(!r.startsWith("text-"))return!1;let t=r.slice(5),i=ye(t);if(i)return Object.assign(e,i),!0;if(Ue[t])return e.fontSize=Ue[t],!0;if(t.startsWith("[")&&t.endsWith("]")){let a=t.slice(1,-1);if(/^-?[\d.]+(?:px|r?em)?$/.test(a)){let c=a.endsWith("rem")||a.endsWith("em")?Number.parseFloat(a)*16:Number.parseFloat(a);if(Number.isFinite(c))return e.fontSize=c,!0}}let s=q(t);if(s)return e.color=s,!0;return!1}var zt=new Set(["t","tr","r","br","b","bl","l","tl"]);function Ht(r,e){let t=/^bg-(?:gradient|linear)-to-([a-z]+)$/.exec(r);if(t&&zt.has(t[1]))return e.gradientDirection=`to-${t[1]}`,!0;let i=/^(from|via|to)-(.+)$/.exec(r);if(!i)return!1;let s=q(i[2]);if(!s)return!1;if(i[1]==="from")e.gradientFrom=s;else if(i[1]==="via")e.gradientVia=s;else e.gradientTo=s;return!0}function Ut(r,e){for(let t of["fill","stroke"]){let i=`${t}-`;if(!r.startsWith(i))continue;let s=r.slice(i.length);if(s==="none")return e[t]="none",!0;if(t==="stroke"&&/^\d+(?:\.\d+)?$/.test(s))return e.strokeWidth=Number.parseFloat(s),!0;if(t==="stroke"&&/^\[\d+(?:\.\d+)?(?:px)?\]$/.test(s))return e.strokeWidth=Number.parseFloat(s.slice(1)),!0;let a=q(s);if(a)return e[t]=a,!0}return!1}function qt(r,e){if(r.startsWith("p-")){let t=C(r.slice(2));if(t!==void 0)return e.padding=t,!0}if(r.startsWith("px-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingHorizontal=t,!0}if(r.startsWith("py-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingVertical=t,!0}if(r.startsWith("pt-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingTop=t,!0}if(r.startsWith("pr-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingRight=t,!0}if(r.startsWith("pb-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingBottom=t,!0}if(r.startsWith("pl-")){let t=C(r.slice(3));if(t!==void 0)return e.paddingLeft=t,!0}return!1}function Ye(r,e){if(/^-(?:m|mx|my|mt|mr|mb|ml)-/.test(r)){let t={};if(!Ye(r.slice(1),t))return!1;let i=Object.entries(t);if(i.some(([,s])=>typeof s!=="number"))return!1;for(let[s,a]of i)e[s]=-a;return!0}if(r.startsWith("m-")){let t=C(r.slice(2));if(t!==void 0)return e.margin=t,!0}if(r.startsWith("mx-")){let t=C(r.slice(3));if(t!==void 0)return e.marginHorizontal=t,!0}if(r.startsWith("my-")){let t=C(r.slice(3));if(t!==void 0)return e.marginVertical=t,!0}if(r.startsWith("mt-")){let t=C(r.slice(3));if(t!==void 0)return e.marginTop=t,!0}if(r.startsWith("mr-")){let t=C(r.slice(3));if(t!==void 0)return e.marginRight=t,!0}if(r.startsWith("mb-")){let t=C(r.slice(3));if(t!==void 0)return e.marginBottom=t,!0}if(r.startsWith("ml-")){let t=C(r.slice(3));if(t!==void 0)return e.marginLeft=t,!0}return!1}function Gt(r,e){if(!r.startsWith("w-"))return!1;let t=r.slice(2);if(t==="full")return e.width="100%",!0;if(t==="screen")return e.width="100%",!0;if(t==="auto")return e.width="auto",!0;if(t.includes("/")){let[s,a]=t.split("/"),c=Number.parseInt(s)/Number.parseInt(a)*100;return e.width=`${c}%`,!0}let i=ie(t);if(i!==void 0)return e.width=i,!0;return!1}function Jt(r,e){if(!r.startsWith("h-"))return!1;let t=r.slice(2);if(t==="full")return e.height="100%",!0;if(t==="screen")return e.height="100%",!0;if(t==="auto")return e.height="auto",!0;let i=ie(t);if(i!==void 0)return e.height=i,!0;return!1}function Kt(r,e){if(r==="rounded")return e.borderRadius=qe.DEFAULT,!0;if(!r.startsWith("rounded-"))return!1;let t=r.slice(8);if(t==="")return!1;let i=/^(?:(tl|tr|bl|br|t|b|l|r)-)?(.+)$/.exec(t),s=qe[i[2]]??he(i[2])??be(i[2]);if(s===void 0)return!1;let a={t:["borderTopLeftRadius","borderTopRightRadius"],b:["borderBottomLeftRadius","borderBottomRightRadius"],l:["borderTopLeftRadius","borderBottomLeftRadius"],r:["borderTopRightRadius","borderBottomRightRadius"],tl:["borderTopLeftRadius"],tr:["borderTopRightRadius"],bl:["borderBottomLeftRadius"],br:["borderBottomRightRadius"]};for(let c of i[1]?a[i[1]]:["borderRadius"])e[c]=s;return!0}function Yt(r,e){let t=/^border(?:-([trblxy]))?(?:-(\d+|\[[^\]]+\]))?$/.exec(r);if(!t)return!1;let[,i="",s]=t,a=s===void 0?1:Number(s);if(s?.startsWith("[")){let l=/^\[(\d+(?:\.\d+)?|\.\d+)(px|rem)?\]$/.exec(s);if(!l)return!1;a=Number(l[1])*(l[2]==="rem"?16:1)}if(!Number.isFinite(a)||a<0)return!1;let c={"":["borderWidth"],t:["borderTopWidth"],r:["borderRightWidth"],b:["borderBottomWidth"],l:["borderLeftWidth"],x:["borderLeftWidth","borderRightWidth"],y:["borderTopWidth","borderBottomWidth"]};for(let l of c[i])e[l]=a;return!0}function Qt(r,e){if(!r.startsWith("border-"))return!1;let t=r.slice(7),i=q(t);if(i)return e.borderColor=i,!0;return!1}function Zt(r,e){if(!r.startsWith("opacity-"))return!1;let t=Number.parseInt(r.slice(8));if(!Number.isNaN(t))return e.opacity=t/100,!0;return!1}function en(r,e){if(r.startsWith("tracking-[")){let t=be(r.slice(9),typeof e.fontSize==="number"?e.fontSize:16);if(t===void 0)return!1;return e.letterSpacing=t,!0}if(r.startsWith("leading-")){let t=r.slice(8),i=typeof e.fontSize==="number"?e.fontSize:16,s={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},a=t.startsWith("[")?/^\[[\d.]+\]$/.test(t)?Number.parseFloat(t.slice(1,-1))*i:be(t,i):s[t]!==void 0?s[t]*i:Je[t];if(a===void 0||!Number.isFinite(a))return!1;return e.lineHeight=a,!0}return!1}function tn(r,e){let t=/^grid-cols-(\d+)$/.exec(r);if(!t)return!1;return e.gridColumns=Number(t[1]),!0}function nn(r,e){if(!r.startsWith("size-"))return!1;let t=r.slice(5),i=t==="full"?"100%":ie(t);if(i===void 0)return!1;return e.width=i,e.height=i,!0}var rn={xs:320,sm:384,md:448,lg:512,xl:576,"2xl":672,"3xl":768,"4xl":896,"5xl":1024,"6xl":1152,"7xl":1280};function sn(r,e){let t=/^(min|max)-(w|h)-(.+)$/.exec(r);if(!t)return!1;let[,i,s,a]=t,c=a==="full"||a==="screen"?"100%":a==="none"?void 0:s==="w"&&i==="max"&&rn[a]||ie(a);if(c===void 0&&a!=="none")return!1;let l=`${i}${s==="w"?"Width":"Height"}`;if(c===void 0)delete e[l];else e[l]=c;return!0}function on(r,e){let t=/^(-?)(top|right|bottom|left)-(.+)$/.exec(r);if(!t)return!1;let i=t[3]==="full"?"100%":C(t[3]);if(i===void 0)return!1;return e[t[2]]=typeof i==="number"&&t[1]?-i:i,!0}function an(r,e){let t=/^(-?)translate-(x|y)-(.+)$/.exec(r);if(!t)return!1;let i=t[3],s;if(i.startsWith("[")){let l=/^\[([+-]?(?:\d+\.?\d*|\.\d+))(px|rem|em)?\]$/.exec(i);if(!l)return!1;s=Number(l[1])*(l[2]?.endsWith("em")?16:1)}else s=C(i);if(s===void 0||!Number.isFinite(s))return!1;if(t[1])s=-s;let a=t[2]==="x"?"translateX":"translateY",c=a==="translateX"?{translateX:s}:{translateY:s};return e.transform=[...(e.transform??[]).filter((l)=>!(a in l)),c],!0}function cn(r,e){let t=/^space-(x|y)-(.+)$/.exec(r);if(!t)return!1;let i=C(t[2]);if(i===void 0)return!1;return e.gap=i,!0}function ln(r,e){if(r.startsWith("gap-")){let t=C(r.slice(4));if(t!==void 0)return e.gap=t,!0}if(r.startsWith("gap-x-")){let t=C(r.slice(6));if(t!==void 0)return e.columnGap=t,!0}if(r.startsWith("gap-y-")){let t=C(r.slice(6));if(t!==void 0)return e.rowGap=t,!0}return!1}function dn(r,e){let i={"shadow-none":[0,0,0,0],"shadow-xs":[1,1,0.05,1],"shadow-sm":[2,1,0.1,2],shadow:[3,2,0.12,3],"shadow-md":[6,4,0.15,4],"shadow-lg":[10,6,0.18,8],"shadow-xl":[16,10,0.2,12],"shadow-2xl":[24,16,0.25,18]}[r];if(!i)return!1;let[s,a,c,l]=i;return Object.assign(e,{shadowColor:"#000000",shadowOpacity:c,shadowRadius:s,shadowOffset:{width:0,height:a},elevation:l}),!0}function se(r,e){let t=[],i=[],s=[],a=[],c=new Map;function l(g,d){let p=/^(text|bg|border|ring)-([a-z-]+)(\/[^\s]+)?$/.exec(g),h=p&&Ke[p[2]];if(h){let x=e?.get(_e(p[2]));return[`${p[1]}-${x===void 0?h[d]:`[${x}]`}${p[3]||""}`]}let v=/^rounded-(?:(tl|tr|bl|br|t|b|l|r)-)?(.+)$/.exec(g);if(v&&re[v[2]]){let x=he(v[2],e);return x===void 0?void 0:[`rounded-${v[1]?`${v[1]}-`:""}[${x}px]`]}let S=g.startsWith("text-")?g.slice(5):"";if(Sn[S]){let x=ye(S,e);return x&&[`text-[${x.fontSize}px]`,`leading-[${x.lineHeight}px]`]}for(let x of Object.keys(xn)){if(!g.endsWith(`-${x}`))continue;let f=me(x,e);return f===void 0?void 0:[`${g.slice(0,-x.length)}[${f}px]`]}return[g]}function u(g,d){if(!c.has(g))c.set(g,new Set);return c.get(g).add(d),g}for(let g of r.split(/\s+/).filter(Boolean))if(g.startsWith("dark:")){let d=l(g.slice(5),"dark");if(!d)a.push(g);else i.push(...d.map((p)=>u(p,g)))}else if(!g.includes(":")||g.startsWith("[")){let d=l(g,"light"),p=l(g,"dark");if(!d||!p){a.push(g);continue}if(t.push(...d.map((h)=>u(h,g))),p.join(" ")!==d.join(" "))s.push(...p.map((h)=>u(h,g)))}else a.push(g);let m=[],w=Ge(t,m),y={style:w,unknown:m};if(i.length||s.length)y.dark=Ge([...s,...i],m);if(w.transform&&y.dark?.transform){let g=new Set(y.dark.transform.flatMap((d)=>Object.keys(d)));y.dark.transform=[...w.transform.filter((d)=>!Object.keys(d).some((p)=>g.has(p))),...y.dark.transform]}for(let g of t){if(g==="truncate")y.numberOfLines=1;let d=/^line-clamp-(\d+)$/.exec(g);if(d)y.numberOfLines=Number(d[1]);if(!y.icon&&/^i-[a-z0-9]+-[a-z0-9-]+$/.test(g))y.icon=g}let b=m.flatMap((g)=>[...c.get(g)??[g]]);return y.unknown=[...new Set([...b.filter((g)=>!/^line-clamp-\d+$/.test(g)),...a])],y}function Ge(r,e){let t={},i=Array.isArray(r)?r:r.split(/\s+/).filter(Boolean);for(let s of i){if(/^i-[a-z0-9]+-/.test(s))continue;let a=jt[s];if(a){a("",t);continue}if(dn(s,t))continue;if(Ht(s,t))continue;if(Wt(s,t))continue;if(Ut(s,t))continue;if(Xt(s,t))continue;if(qt(s,t))continue;if(Ye(s,t))continue;if(Gt(s,t))continue;if(Jt(s,t))continue;if(Kt(s,t))continue;if(Yt(s,t))continue;if(Qt(s,t))continue;if(Zt(s,t))continue;if(ln(s,t))continue;if(en(s,t))continue;if(nn(s,t))continue;if(sn(s,t))continue;if(tn(s,t))continue;let c=/^order-\[(-?\d+)\]$/.exec(s)??/^order-(-?\d+)$/.exec(s);if(c){t.order=Number(c[1]);continue}if(on(s,t))continue;if(an(s,t))continue;if(cn(s,t))continue;if(e?.push(s),typeof process<"u"&&process.env?.NODE_ENV==="development")console.warn(`[STX Native] Unknown Headwind class: ${s}`)}return t}var Qe=new Map;function Ze(r,e){if(!r)return;let t=r.trim(),i=t.lastIndexOf("-"),s=i===-1?e[t]:e[t.slice(0,i)],a=i===-1?s:s?.[t.slice(i+1)];if(typeof a==="string"&&/^#[\da-f]{3,8}$/i.test(a))return a;return ve(t)??ve(`[${t}]`)}function fn(r){let e=r.roles??{},t=r.shapes??{},i=r.density??{},s={...r.theme?.colors,...r.theme?.extend?.colors},a=[],c=[];for(let[l,u]of Object.entries(e)){if(!Ke[l])continue;let m=Ze(typeof u==="string"?u:u?.light,s),w=Ze(typeof u==="string"?u:u?.dark,s);if(m)a.push(`${_e(l)}: ${m};`);if(w)c.push(`${_e(l)}: ${w};`)}for(let[l,u]of Object.entries(t))if(re[l])a.push(`${Mt(l)}: ${u};`);for(let[l,u]of Object.entries(i))if(fe[l])a.push(`${Ee(l)}: ${u};`);return[a.length?`:root { ${a.join(" ")} }`:"",c.length?`.dark { ${c.join(" ")} }`:""].filter(Boolean).join(`
3
+ `)}async function pn(r){let{resolveUserCssConfig:e}=await import("./chunk-2y80c34h.js"),t=await e(r);return t?fn(t):""}function et(r){let e=un.resolve(r),t=Qe.get(e);if(!t)t=pn(e).catch(()=>""),Qe.set(e,t);return t}var nt={"aria-pressed":"selected","aria-selected":"selected","aria-checked":"checked","aria-disabled":"disabled","aria-expanded":"expanded","aria-busy":"busy"},tt={alert:"alert",button:"button",checkbox:"checkbox",combobox:"combobox",header:"header",heading:"header",image:"image",img:"image",link:"link",menu:"menu",menubar:"menubar",menuitem:"menuitem",none:"none",presentation:"none",progressbar:"progressbar",radio:"radio",scrollbar:"scrollbar",search:"search",searchbox:"search",slider:"adjustable",spinbutton:"spinbutton",switch:"switch",tab:"tab",tablist:"tablist",timer:"timer",toolbar:"toolbar"};function gn(r){return r==="role"||r==="aria-label"||r==="aria-valuetext"||r in nt}function hn(r,e){if(e===void 0||e===null)return;let t=String(e).trim().toLowerCase();if(t==="mixed")return r==="aria-checked"?"mixed":!0;if(t==="undefined")return;return t===""||t==="true"}function mn(r){if(r===void 0||r===null)return null;for(let e of String(r).trim().toLowerCase().split(/\s+/))if(tt[e])return tt[e];return null}function yn(r,e,t){if(r==="aria-label")return{accessibilityLabel:e===void 0||e===null||e===""?null:String(e)};if(r==="aria-valuetext")return{accessibilityValue:e===void 0||e===null||e===""?null:String(e)};if(r==="role")return{accessibilityRole:mn(e)};let i=nt[r];if(!i)return;let s=t.accessibilityState,a=s&&typeof s==="object"?{...s}:{},c=hn(r,e);if(c===void 0)delete a[i];else a[i]=c;return{accessibilityState:Object.keys(a).length?a:null}}function bn(r){let e=r.accessibilityState&&typeof r.accessibilityState==="object"?r.accessibilityState:void 0,t={};for(let[s,a]of Object.entries(r)){if(!gn(s))continue;let c=yn(s,a,t);if(c)Object.assign(t,c)}for(let s of["accessibilityLabel","accessibilityRole","accessibilityValue"])if(r[s]===void 0&&t[s]!==void 0&&t[s]!==null)r[s]=t[s];let i=t.accessibilityState;if(i)r.accessibilityState={...i,...e}}var we=["accessibilityLabel","accessibilityRole","accessibilityState","accessibilityValue"];function Se(r){let e={...r};return bn(e),Object.fromEntries(we.filter((t)=>(t in e)).map((t)=>[t,e[t]]))}var xe={"region-change-complete":"onRegionChangeComplete",regionchangecomplete:"onRegionChangeComplete",click:"onPress",press:"onPress","press-in":"onPressIn",pressin:"onPressIn","press-out":"onPressOut",pressout:"onPressOut",longpress:"onLongPress",contextmenu:"onLongPress",input:"onChangeText",onchange:"onChange",change:"onValueChange","value-change":"onValueChange",valuechange:"onValueChange",focus:"onFocus",focusin:"onFocus",blur:"onBlur",focusout:"onBlur",submit:"onSubmitEditing","submit-editing":"onSubmitEditing",submitediting:"onSubmitEditing","end-editing":"onEndEditing",endediting:"onEndEditing",scroll:"onScroll","scroll-begin-drag":"onScrollBeginDrag",scrollbegindrag:"onScrollBeginDrag","scroll-end-drag":"onScrollEndDrag",scrollenddrag:"onScrollEndDrag","momentum-scroll-begin":"onMomentumScrollBegin",momentumscrollbegin:"onMomentumScrollBegin","momentum-scroll-end":"onMomentumScrollEnd",momentumscrollend:"onMomentumScrollEnd",refresh:"onRefresh",layout:"onLayout","end-reached":"onEndReached",endreached:"onEndReached",close:"onRequestClose","request-close":"onRequestClose",requestclose:"onRequestClose",show:"onShow",dismiss:"onDismiss","sliding-complete":"onSlidingComplete",slidingcomplete:"onSlidingComplete","load-start":"onLoadStart",loadstart:"onLoadStart",load:"onLoad","load-end":"onLoadEnd",loadend:"onLoadEnd",error:"onError",play:"onPlay",playing:"onPlay",pause:"onPause",ended:"onEnd",end:"onEnd",timeupdate:"onProgress",progress:"onProgress",loadedmetadata:"onLoad",enterpictureinpicture:"onPictureInPictureStart",leavepictureinpicture:"onPictureInPictureStop"};var ke={svg:"Svg",g:"G",path:"Path",line:"Line",rect:"Rect",circle:"Circle",ellipse:"Ellipse",polyline:"Polyline",polygon:"Polygon",text:"SvgText",tspan:"SvgText"},Te=new Set(Object.values(ke));var st=new Set(["defs","title","desc","metadata","style","symbol","use","clippath","mask","lineargradient","radialgradient","stop","pattern","marker","filter","foreignobject"]),ot=["viewBox","preserveAspectRatio","strokeWidth","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","fillOpacity","fillRule","vectorEffect","textAnchor","dominantBaseline","fontSize","fontWeight"];function D(r){let e=typeof r==="number"?r:Number.parseFloat(String(r??""));return Number.isFinite(e)?e:0}function J(r){return Math.round(r*1000)/1000}function Re(r){if(Array.isArray(r)&&r.length===4&&r.every((t)=>Number.isFinite(Number(t))))return r.map(Number);let e=String(r??"").trim().split(/[\s,]+/).map(Number);if(e.length!==4||e.some((t)=>!Number.isFinite(t))||e[2]<=0||e[3]<=0)return null;return e}function vn(r){let e=String(r??"").trim().split(/[\s,]+/).filter(Boolean).map(Number).filter(Number.isFinite);return e.length%2?e.slice(0,-1):e}var rt=/[MLHVCSQTAZ]/i,Ne=/[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/gi;function wn(r){let e=[],t=r,i=rt.exec(t);while(i){let s=i.index;t=t.slice(s);let a=t[0];t=t.slice(1);let c=rt.exec(t),l=c?t.slice(0,c.index):t,u;if(a==="A"||a==="a"){u=[];let m=0,w=l.trim(),y=0;while(y<w.length){let b=m%7,g=w.slice(y).replace(/^[\s,]+/,"");if(y=w.length-g.length,!g)break;if(b===3||b===4)u.push(g[0]==="1"?1:0),y+=1;else{Ne.lastIndex=0;let d=Ne.exec(g);if(!d||d.index!==0)break;u.push(Number.parseFloat(d[0])),y+=d[0].length}m++}}else u=(l.match(Ne)||[]).map(Number.parseFloat);e.push({command:a,args:u}),i=c}return e}function Nn(r,e,t,i,s,a,c,l,u){if(r===l&&e===u)return[];let m=Math.abs(t),w=Math.abs(i);if(!m||!w)return[1,l,u];let y=s*Math.PI/180,b=Math.cos(y),g=Math.sin(y),d=(r-l)/2,p=(e-u)/2,h=b*d+g*p,v=-g*d+b*p,S=h*h/(m*m)+v*v/(w*w);if(S>1)m*=Math.sqrt(S),w*=Math.sqrt(S);let x=m*m*w*w-m*m*v*v-w*w*h*h,f=m*m*v*v+w*w*h*h,T=Math.sqrt(Math.max(0,x/f));if(a===c)T=-T;let E=T*(m*v)/w,j=T*-(w*h)/m,N=b*E-g*j+(r+l)/2,L=g*E+b*j+(e+u)/2,O=(B,F,V,Y)=>{let ue=B*Y-F*V<0?-1:1,pe=(B*V+F*Y)/(Math.hypot(B,F)*Math.hypot(V,Y));return ue*Math.acos(Math.min(1,Math.max(-1,pe)))},k=O(1,0,(h-E)/m,(v-j)/w),_=O((h-E)/m,(v-j)/w,(-h-E)/m,(-v-j)/w);if(!c&&_>0)_-=2*Math.PI;if(c&&_<0)_+=2*Math.PI;let I=Math.max(1,Math.ceil(Math.abs(_)/(Math.PI/2))),A=_/I,R=1.3333333333333333*Math.tan(A/4),M=[],H=(B)=>{let F=m*Math.cos(B),V=w*Math.sin(B);return[b*F-g*V+N,g*F+b*V+L]},U=(B)=>{let F=-m*Math.sin(B),V=w*Math.cos(B);return[b*F-g*V,g*F+b*V]},W=k;for(let B=0;B<I;B++){let F=W+A,[V,Y]=H(W),[ue,pe]=U(W),[je,We]=H(F),[Pt,Ct]=U(F);M.push(2,V+R*ue,Y+R*pe,je-R*Pt,We-R*Ct,B===I-1?l:je,B===I-1?u:We),W=F}return M}function kn(r){let e=[],t=0,i=0,s=0,a=0,c=0,l=0,u=0,m=0,w="";for(let{command:y,args:b}of wn(String(r??""))){let g=y===y.toLowerCase(),d=y.toUpperCase(),p=()=>g?t:0,h=()=>g?i:0,v=0,S=(f)=>{if(v+f>b.length)return null;let T=b.slice(v,v+f);return v+=f,T};if(d==="Z"){e.push(4),t=s,i=a,w="Z";continue}let x=!0;while(v<b.length||x&&d==="Z"){switch(d){case"M":{let f=S(2);if(!f)return e;if(t=f[0]+p(),i=f[1]+h(),x)e.push(0,t,i),s=t,a=i;else e.push(1,t,i);w=x?"M":"L";break}case"L":{let f=S(2);if(!f)return e;t=f[0]+p(),i=f[1]+h(),e.push(1,t,i),w="L";break}case"H":{let f=S(1);if(!f)return e;t=f[0]+p(),e.push(1,t,i),w="L";break}case"V":{let f=S(1);if(!f)return e;i=f[0]+h(),e.push(1,t,i),w="L";break}case"C":{let f=S(6);if(!f)return e;let T=f[0]+p(),E=f[1]+h();c=f[2]+p(),l=f[3]+h(),t=f[4]+p(),i=f[5]+h(),e.push(2,T,E,c,l,t,i),w="C";break}case"S":{let f=S(4);if(!f)return e;let T=w==="C"?2*t-c:t,E=w==="C"?2*i-l:i;c=f[0]+p(),l=f[1]+h(),t=f[2]+p(),i=f[3]+h(),e.push(2,T,E,c,l,t,i),w="C";break}case"Q":{let f=S(4);if(!f)return e;u=f[0]+p(),m=f[1]+h(),t=f[2]+p(),i=f[3]+h(),e.push(3,u,m,t,i),w="Q";break}case"T":{let f=S(2);if(!f)return e;u=w==="Q"?2*t-u:t,m=w==="Q"?2*i-m:i,t=f[0]+p(),i=f[1]+h(),e.push(3,u,m,t,i),w="Q";break}case"A":{let f=S(7);if(!f)return e;let T=f[5]+p(),E=f[6]+h();e.push(...Nn(t,i,f[0],f[1],f[2],f[3],f[4],T,E)),t=T,i=E,w="A";break}default:return e}x=!1}}return e.map((y)=>J(y))}function it(r,e,t,i){if(t<=0||i<=0)return[];let s=0.5522847498;return[0,r+t,e,2,r+t,e+s*i,r+s*t,e+i,r,e+i,2,r-s*t,e+i,r-t,e+s*i,r-t,e,2,r-t,e-s*i,r-s*t,e-i,r,e-i,2,r+s*t,e-i,r+t,e-s*i,r+t,e,4].map(J)}function Ae(r,e){switch(r){case"Path":return kn(String(e.d??""));case"Line":return[0,D(e.x1),D(e.y1),1,D(e.x2),D(e.y2)].map(J);case"Rect":{let t=D(e.x),i=D(e.y),s=D(e.width),a=D(e.height);if(s<=0||a<=0)return[];let c=e.rx===void 0?D(e.ry):D(e.rx),l=e.ry===void 0?c:D(e.ry);if(c=Math.min(Math.max(0,c),s/2),l=Math.min(Math.max(0,l),a/2),!c||!l)return[0,t,i,1,t+s,i,1,t+s,i+a,1,t,i+a,4].map(J);let u=0.5522847498;return[0,t+c,i,1,t+s-c,i,2,t+s-c+u*c,i,t+s,i+l-u*l,t+s,i+l,1,t+s,i+a-l,2,t+s,i+a-l+u*l,t+s-c+u*c,i+a,t+s-c,i+a,1,t+c,i+a,2,t+c-u*c,i+a,t,i+a-l+u*l,t,i+a-l,1,t,i+l,2,t,i+l-u*l,t+c-u*c,i,t+c,i,4].map(J)}case"Circle":return it(D(e.cx),D(e.cy),D(e.r),D(e.r));case"Ellipse":return it(D(e.cx),D(e.cy),D(e.rx),D(e.ry));case"Polyline":case"Polygon":{let t=vn(e.points);if(t.length<4)return[];let i=[0,t[0],t[1]];for(let s=2;s<t.length;s+=2)i.push(1,t[s],t[s+1]);if(r==="Polygon")i.push(4);return i.map(J)}default:return null}}var Tn=[...ot,"accessibilityHint","accessibilityLabel","accessibilityRole","accessibilityState","accessibilityValue","activeOpacity","alwaysBounceHorizontal","alwaysBounceVertical","animationType","autoCapitalize","autoComplete","autoCorrect","autoFocus","contentContainerStyle","currentTime","defaultSource","defaultValue","ellipsizeMode","hidesWhenStopped","hitSlop","imageStyle","initialNumToRender","ios_backgroundColor","keyboardDismissMode","keyboardShouldPersistTaps","keyboardType","keyboardVerticalOffset","keyExtractor","listRole","maxLength","maximumDate","maximumTrackTintColor","maximumValue","maxToRenderPerBatch","minimumDate","minimumTrackTintColor","minimumValue","minuteInterval","numberOfLines","numColumns","onEndReachedThreshold","pagingEnabled","passwordRules","placeholderTextColor","pointerEvents","presentationStyle","nonModal","dismissOnOutsideTap","pressRetentionOffset","progressBackgroundColor","progressViewOffset","refreshControl","resizeMode","returnKeyType","scrollEnabled","scrollTarget","secureTextEntry","selectedValue","selectionColor","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","stickyHeaderIndices","testID","textContentType","thumbColor","thumbTintColor","titleColor","trackColor","underlayColor","windowSize","initialRegion","tileOverlay","edgePadding","fitToBounds","showsUserLocation","zoomEnabled","rotateEnabled","pitchEnabled","mapType","fillColor","strokeColor","pinColor","showsCompass","showsScale","cameraPitch","cameraHeading","autoScrollBottom","scrollKey","pictureInPicture","transitionID"],at=new Set(["alwaysBounceHorizontal","alwaysBounceVertical","animating","autoCorrect","autoFocus","autoplay","autoPlay","bounces","controls","disabled","editable","hidesWhenStopped","horizontal","loop","multiline","muted","pagingEnabled","paused","refreshing","scrollEnabled","secureTextEntry","selectTextOnFocus","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","transparent","visible","nonModal","dismissOnOutsideTap","fitToBounds","showsUserLocation","zoomEnabled","rotateEnabled","pitchEnabled","showsCompass","showsScale","pictureInPicture"]),Rn=new Map(Tn.map((r)=>[ct(r),r]));function ct(r){return r.replace(/[-_]/g,"").toLowerCase()}function Ie(r){return Rn.get(ct(r))??r}var _n={view:"View",sidebar:"Sidebar",splitview:"SplitView",textinput:"TextInput",pressable:"Pressable",icon:"Icon",text:"Text",button:"Button",image:"Image",img:"Image",video:"Video",map:"Map",mappolyline:"MapPolyline",mappolygon:"MapPolygon",mapmarker:"MapMarker",input:"TextInput",textarea:"TextInput",scroll:"ScrollView",scrollview:"ScrollView",list:"FlatList",flatlist:"FlatList",modal:"Modal",switch:"Switch",checkbox:"Checkbox",slider:"Slider",picker:"Picker",select:"Picker",loading:"ActivityIndicator",spinner:"ActivityIndicator",div:"View",span:"Text",p:"Text",h1:"Text",h2:"Text",h3:"Text",h4:"Text",h5:"Text",h6:"Text",a:"TouchableOpacity",section:"View",article:"View",header:"SafeAreaView",footer:"View",main:"View",nav:"View",aside:"View",form:"View",label:"Text",fieldset:"View",legend:"Text",option:"Text",dialog:"Modal",figure:"View",figcaption:"Text",picture:"View",hr:"View",ul:"View",ol:"View",li:"View",dl:"View",dt:"Text",dd:"Text",table:"View",thead:"View",tbody:"View",tfoot:"View",tr:"View",th:"Text",td:"Text",caption:"Text",strong:"Text",b:"Text",em:"Text",i:"Text",u:"Text",s:"Text",small:"Text",mark:"Text",abbr:"Text",time:"Text",code:"Text",kbd:"Text",samp:"Text",pre:"Text",blockquote:"Text",cite:"Text",q:"Text",sub:"Text",sup:"Text"};function lt(r){return _n[r.toLowerCase()]||r}var An={activity:"waveform.path.ecg","alarm-clock":"alarm","alert-circle":"exclamationmark.circle","alert-triangle":"exclamationmark.triangle",archive:"archivebox",armchair:"sofa","arrow-down":"arrow.down","arrow-left":"arrow.left","arrow-right":"arrow.right","arrow-up":"arrow.up","arrow-up-right":"arrow.up.right","at-sign":"at","audio-lines":"waveform",award:"rosette",backpack:"backpack","badge-check":"checkmark.seal","badge-x":"xmark.seal",ban:"nosign","bar-chart":"chart.bar","bar-chart-2":"chart.bar","bar-chart-3":"chart.bar",battery:"battery.100","battery-charging":"battery.100.bolt",bed:"bed.double",bell:"bell","bell-off":"bell.slash","bell-ring":"bell.and.waves.left.and.right",bike:"figure.outdoor.cycle",blocks:"square.grid.2x2",bluetooth:"antenna.radiowaves.left.and.right",book:"book","book-open":"book",bookmark:"bookmark",box:"shippingbox",brain:"brain",building:"building","building-2":"building.2",cable:"cable.connector",calendar:"calendar","calendar-check":"calendar.badge.checkmark","calendar-clock":"calendar.badge.clock","calendar-days":"calendar","calendar-minus":"calendar.badge.minus","calendar-minus-2":"calendar.badge.minus","calendar-off":"calendar.badge.exclamationmark","calendar-plus":"calendar.badge.plus","calendar-range":"calendar","calendar-sync":"arrow.triangle.2.circlepath","calendar-x":"calendar.badge.exclamationmark","calendar-x-2":"calendar.badge.exclamationmark",camera:"camera","chart-bar":"chart.bar","chart-column":"chart.bar","chart-line":"chart.xyaxis.line","chart-no-axes-gantt":"chart.bar.doc.horizontal",check:"checkmark","check-circle":"checkmark.circle","check-circle-2":"checkmark.circle","chevron-down":"chevron.down","chevron-left":"chevron.left","chevron-right":"chevron.right","chevron-up":"chevron.up",circle:"circle","circle-alert":"exclamationmark.circle","circle-arrow-out-up-left":"arrow.uturn.backward.circle","circle-minus":"minus.circle","circle-arrow-down":"arrow.down.circle","circle-check":"checkmark.circle","circle-check-big":"checkmark.circle","circle-dot":"smallcircle.filled.circle","circle-help":"questionmark.circle","circle-play":"play.circle","circle-plus":"plus.circle","circle-user":"person.crop.circle","circle-x":"xmark.circle",clapperboard:"film",clipboard:"clipboard","clipboard-list":"list.clipboard",clock:"clock","clock-12":"clock","clock-2":"clock","clock-3":"clock","clock-4":"clock","clock-8":"clock",cloud:"cloud","cloud-off":"icloud.slash",coffee:"cup.and.saucer",copy:"doc.on.doc","credit-card":"creditcard",cylinder:"cylinder",disc:"opticaldisc",download:"arrow.down.circle",droplet:"drop",droplets:"drop",dumbbell:"dumbbell",edit:"pencil","external-link":"arrow.up.right.square",eye:"eye","eye-off":"eye.slash",file:"doc","file-text":"doc.text",filter:"line.3.horizontal.decrease",flag:"flag",flame:"flame","flower-2":"camera.macro",footprints:"figure.run",gauge:"gauge",gift:"gift",globe:"globe","graduation-cap":"graduationcap","grip-vertical":"line.3.horizontal","hand-fist":"hand.raised",heart:"heart","heart-off":"heart.slash","heart-pulse":"heart.text.square","help-circle":"questionmark.circle",history:"clock.arrow.circlepath",home:"house",hourglass:"hourglass",house:"house","id-card":"person.text.rectangle",image:"photo",inbox:"tray",info:"info.circle",layers:"square.3.layers.3d","layout-dashboard":"rectangle.3.group","layout-grid":"square.grid.2x2",leaf:"leaf",library:"books.vertical",link:"link",list:"list.bullet","list-checks":"checklist",loader:"arrow.triangle.2.circlepath","loader-2":"arrow.triangle.2.circlepath","loader-circle":"arrow.triangle.2.circlepath",lock:"lock","log-in":"arrow.right.to.line","log-out":"rectangle.portrait.and.arrow.right",mail:"envelope",map:"map","map-pin":"mappin.and.ellipse",medal:"medal",megaphone:"megaphone",menu:"line.3.horizontal","message-circle":"bubble.left","message-square":"text.bubble","message-square-quote":"quote.bubble",mic:"mic",minus:"minus",moon:"moon","more-horizontal":"ellipsis","more-vertical":"ellipsis",mountain:"mountain.2",music:"music.note","music-2":"music.note",package:"shippingbox",pause:"pause","pause-circle":"pause.circle",pencil:"pencil","person-standing":"figure.walk",phone:"phone",play:"play.fill",plug:"powerplug",plus:"plus","plus-circle":"plus.circle","rectangle-horizontal":"rectangle","refresh-cw":"arrow.clockwise",repeat:"repeat","rotate-ccw":"arrow.counterclockwise",route:"point.topleft.down.to.point.bottomright.curvepath",ruler:"ruler",sailboat:"sailboat",satellite:"antenna.radiowaves.left.and.right",save:"square.and.arrow.down",scale:"scalemass","scan-line":"barcode.viewfinder",search:"magnifyingglass",send:"paperplane",settings:"gearshape","settings-2":"slider.horizontal.3",share:"square.and.arrow.up","share-2":"square.and.arrow.up",shield:"shield","shield-check":"checkmark.shield","shopping-bag":"bag","shopping-cart":"cart",shuffle:"shuffle","skip-back":"backward.end","skip-forward":"forward.end",sliders:"slider.horizontal.3","sliders-horizontal":"slider.horizontal.3",smartphone:"iphone",snowflake:"snowflake",sparkles:"sparkles",sprout:"leaf",square:"square",star:"star",stopwatch:"stopwatch",store:"storefront","stretch-horizontal":"rectangle.split.1x2",sun:"sun.max",sunrise:"sunrise",sunset:"sunset",tag:"tag",target:"scope",thermometer:"thermometer.medium","thumbs-up":"hand.thumbsup",timer:"timer",trash:"trash","trash-2":"trash","trending-down":"chart.line.downtrend.xyaxis","trending-up":"chart.line.uptrend.xyaxis","triangle-alert":"exclamationmark.triangle",trophy:"trophy",unlink:"personalhotspot.slash",upload:"arrow.up.circle",user:"person","user-check":"person.crop.circle.badge.checkmark","user-minus":"person.badge.minus","user-plus":"person.badge.plus","user-round":"person","user-round-check":"person.crop.circle.badge.checkmark","user-round-minus":"person.crop.circle.badge.minus","user-round-plus":"person.crop.circle.badge.plus","user-round-x":"person.crop.circle.badge.xmark","user-x":"person.crop.circle.badge.xmark",users:"person.2","users-round":"person.2",video:"video","volume-2":"speaker.wave.2",warehouse:"building.2",watch:"applewatch",waves:"figure.pool.swim",weight:"scalemass",wifi:"wifi","wifi-off":"wifi.slash",wind:"wind",x:"xmark","x-circle":"xmark.circle",zap:"bolt"};function Pe(r,e=!1){let t=String(r??"").trim();if(!t)return{symbol:"circle",known:!1};if(e)return{symbol:t,known:!0};let i=/^i-([a-z0-9]+)-(.+)$/.exec(t)??/^([a-z0-9]+):(.+)$/.exec(t),s=i?i[1]:"lucide",a=i?i[2]:t;if(s==="lucide"){let c=An[a];if(c)return{symbol:c,iconify:`i-lucide-${a}`,known:!0};if(!i&&t.includes("."))return{symbol:t,known:!0}}return{symbol:"circle",iconify:i?t:`i-lucide-${a}`,known:!1}}var ut=/^--[\w\u0080-\uFFFF-]+$/u;function dt(r,e){if(!/var\(/i.test(r))return r;let t="",i="",s=!1;for(let a=0;a<r.length;a++){let c=r[a];if(c==="\\"){t+=r.slice(a,a+2),a++;continue}if(i){if(t+=c,c===i)i="";continue}if(c==='"'||c==="'"){i=c,t+=c;continue}if(r.slice(a,a+4).toLowerCase()!=="var("||a>0&&/[\w-]/.test(r[a-1])){t+=c;continue}let l=1,u=-1,m="",w=a+4;for(;w<r.length;w++){let g=r[w];if(g==="\\"){w++;continue}if(m){if(g===m)m="";continue}if(g==='"'||g==="'"){m=g;continue}if(g==="(")l++;if(g===")"&&--l===0)break;if(g===","&&l===1&&u===-1)u=w}if(l!==0)return;let y=r.slice(a+4,u===-1?w:u).trim();if(!ut.test(y))return;let b=e(y,u===-1?void 0:r.slice(u+1,w).trim());if(b===void 0||t.length+b.length>65536)return;t+=b,s=!0,a=w}return s&&t.length>65536?void 0:t}function Q(r,e){let t=new Map,i=new Set;for(let[p,h]of r){let v=p.trim();if(!ut.test(v))continue;if(typeof h==="string"||typeof h==="number"&&Number.isFinite(h))t.set(v,String(h).trim())}let s=new Map,a=new Set;for(let[p,h]of t){let v=new Set,S=(x,f=0)=>f>64?void 0:dt(x,(T,E)=>(v.add(T),E===void 0?"":S(E,f+1)));if(S(h)===void 0)a.add(p);s.set(p,v)}let c=new Map,l=new Map,u=[],m=new Set,w=0;function y(p,h=0){if(h>64){a.add(p);return}c.set(p,w),l.set(p,w++),u.push(p),m.add(p);for(let x of s.get(p)??[]){if(!t.has(x))continue;if(!c.has(x)){if(y(x,h+1),l.has(x))l.set(p,Math.min(l.get(p),l.get(x)))}else if(m.has(x))l.set(p,Math.min(l.get(p),c.get(x)))}if(l.get(p)!==c.get(p))return;let v=[],S;do S=u.pop(),m.delete(S),v.push(S);while(S!==p);if(v.length>1||s.get(p)?.has(p))v.forEach((x)=>a.add(x))}for(let p of t.keys())if(!c.has(p))y(p);let b=new Map;function g(p,h){if(i.add(p),b.has(p))return b.get(p);let v=t.get(p),S=v===void 0||/^(?:inherit|unset)$/i.test(v)?e?.get(p):a.has(p)||/^(?:initial|revert|revert-layer)$/i.test(v)?void 0:d(v,h+1);return b.set(p,S),S}function d(p,h=0){if(h>64)return;return dt(p,(v,S)=>g(v,h)??(S===void 0?void 0:d(S,h+1)))}return{resolve:d,used:i,computed(){let p=new Map(e);for(let h of t.keys())p.set(h,g(h,0));return p}}}function Ce(r){if(r.display==="flex"&&r.flexDirection==null)return{...r,flexDirection:"row"};return r}var ft=new Set(["display","gridColumns","gridTemplateColumns","gridTemplateRows","gridAutoRows","flex","flexGrow","flexShrink","flexBasis","flexDirection","flexWrap","order","justifyContent","alignItems","alignSelf","alignContent","position","top","right","bottom","left","zIndex","width","height","minWidth","maxWidth","minHeight","maxHeight","aspectRatio","margin","marginTop","marginRight","marginBottom","marginLeft","marginHorizontal","marginVertical","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingHorizontal","paddingVertical","gap","rowGap","columnGap","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderStyle","backgroundColor","backgroundImage","opacity","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","color","fontSize","fontWeight","fontStyle","fontFamily","lineHeight","letterSpacing","textAlign","textDecorationLine","textDecorationColor","textTransform","resizeMode","tintColor","transform","overflow","fill","stroke","strokeWidth","gradientDirection","gradientFrom","gradientVia","gradientTo"]),En=new Set(["gridColumns","gridAutoRows","flex","flexGrow","flexShrink","order","zIndex","aspectRatio","gap","rowGap","columnGap","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","opacity","shadowOpacity","shadowRadius","elevation","fontSize","lineHeight","letterSpacing","strokeWidth"]),pt=new Set(["top","right","bottom","left","width","height","minWidth","maxWidth","minHeight","maxHeight","flexBasis","margin","marginTop","marginRight","marginBottom","marginLeft","marginHorizontal","marginVertical","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingHorizontal","paddingVertical"]),In=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,Pn=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px|rem|em)?$/i,Cn=new Set(["rotate","rotateX","rotateY","rotateZ","skewX","skewY"]),On=new Set(["perspective","scale","scaleX","scaleY","translateX","translateY"]);function Mn(r){if(typeof r!=="string")return r;let e=Pn.exec(r);return e?Number(e[1])*(/^r?em$/i.test(e[2]||"")?16:1):r}function K(r){return typeof r==="number"&&Number.isFinite(r)}function Bn(r,e){if(r==="shadowOffset"&&e&&typeof e==="object"&&!Array.isArray(e)){let{width:t,height:i}=e;return K(t)&&K(i)?{width:t,height:i}:void 0}if(r==="transform"&&Array.isArray(e)){let t=[];for(let i of e){if(!i||typeof i!=="object"||Array.isArray(i)||Object.keys(i).length!==1)return;let[s,a]=Object.entries(i)[0];if(On.has(s)&&K(a))t.push({[s]:a});else if(Cn.has(s)&&typeof a==="string"&&/^[+-]?(?:\d+\.?\d*|\.\d+)(?:deg|rad)$/.test(a))t.push({[s]:a});else return}return t}return}function Dn(r){let e=[],t=0,i=0,s="";for(let a=0;a<=r.length;a++){let c=r[a];if(c==="\\"){a++;continue}if(s){if(c===s)s="";continue}if(c==='"'||c==="'"){s=c;continue}if(c==="(")i++;if(c===")")i=Math.max(0,i-1);if(a!==r.length&&(c!==";"||i))continue;let l=r.slice(t,a),u=l.indexOf(":");if(u!==-1)e.push([l.slice(0,u).trim(),l.slice(u+1).trim()]);t=a+1}return e}function Ln(r,e){let t;if(typeof r==="string"){if(r=r.trim(),!r)return[];try{r=JSON.parse(r)}catch{}}if(typeof r==="string")t=Dn(r);else if(r&&typeof r==="object"&&!Array.isArray(r))t=Object.entries(r);else{if(r!=null&&r!==!1)e({kind:"non-numeric-style",name:"style"});return[]}return t}function gt(r,e=()=>{},t={}){let i=Ln(r,e),s=Q(i,t.inheritedVariables);return t.onVariables?.(s.computed()),Vn(i,s,e)}function Vn(r,e,t){let i={},s=[];for(let[a,c]of r){if(a.trim().startsWith("--")){s.push(a.trim());continue}let l=ft.has(a)||a.trim().startsWith("--")?a:a.trim().toLowerCase().replace(/-([a-z])/g,(w,y)=>y.toUpperCase());if(!ft.has(l)){t({kind:"unknown-style",name:l});continue}if(c==null||c==="")continue;let u=typeof c==="string"?e.resolve(c.trim()):c;if(u===void 0){t({kind:"non-numeric-style",name:l});continue}if(u==="")continue;let m;if(En.has(l)||pt.has(l)){if(m=Mn(u),!K(m)&&!(pt.has(l)&&typeof m==="string"&&m.endsWith("%")&&In.test(m.slice(0,-1))&&Number.isFinite(Number(m.slice(0,-1)))))m=void 0}else if(l==="display"&&u==="inline-flex")m="flex";else if(l==="shadowOffset"||l==="transform")m=Bn(l,u);else if(l==="gridTemplateColumns"||l==="gridTemplateRows")m=K(u)||typeof u==="string"?u:void 0;else if(l==="fontWeight"&&K(u))m=String(u);else if(typeof u==="string")m=u;if(m===void 0)t({kind:"non-numeric-style",name:l});else i[l]=m}for(let a of s)if(!e.used.has(a))t({kind:"unknown-style",name:a});return i}import{generate as Z,parse as ht}from"@stacksjs/ts-css/parse";async function mt(r,e){let t={light:new Map,dark:new Map},i=new Set,s=(y)=>{if(!i.has(y))i.add(y),e(y)},a=(y,b,g)=>{for(let d of g){let p=t[d].get(y);if(!p||Number(b.important)>Number(p.important)||b.important===p.important&&b.specificity>=p.specificity)t[d].set(y,b)}},c=(y)=>{if(y.type==="Declaration")return y.property.startsWith("--");if(y.type==="Rule"||y.type==="Atrule")return!!y.block&&[...y.block.children].some(c);return!1},l=(y)=>{let b=y.replace(/\s+/g,"").toLowerCase();if(!b||b==="all"||b==="screen")return["light","dark"];let g=/^(?:screenand)?\(prefers-color-scheme:(light|dark)\)$/.exec(b);return g?[g[1]]:void 0};function u(y,b){for(let g of y){if(!c(g))continue;if(g.type==="Atrule"){let p=g.prelude?Z(g.prelude):"",h=g.name.toLowerCase()==="media"?l(p):void 0;if(!h){s(`@${g.name} ${p}`.trim());continue}u(g.block.children,b.filter((v)=>h.includes(v)));continue}if(g.type!=="Rule")continue;let d=g.prelude.type==="SelectorList"?[...g.prelude.children].map(Z):[Z(g.prelude)];for(let p of d){let h=/^(html|:root)?(?:\.(dark|light))?$/.exec(p.trim());if(!h||!h[1]&&!h[2]){s(p);continue}let v=(h[1]===":root"?10:h[1]?1:0)+(h[2]?10:0);for(let S of g.block.children){if(S.type!=="Declaration"){if(c(S))s(`nested rule in ${p}`);continue}if(!S.property.startsWith("--"))continue;let x={value:Z(S.value),important:!!S.important,specificity:v};a(S.property,x,b.filter((f)=>!h[2]||h[2]===f))}}}}let m="",w;return await new HTMLRewriter().on("html",{element(y){let b=y.getAttribute("style");if(!b)return;try{let g=ht(b,{context:"declarationList"});if(g.type!=="DeclarationList")return;for(let d of g.children)if(d.type==="Declaration"&&d.property.startsWith("--"))a(d.property,{value:Z(d.value),important:!!d.important,specificity:1000},["light","dark"])}catch{s("invalid document inline theme")}}}).on("style",{element(y){m="";let b=y.getAttribute("type");w=!b||b.toLowerCase()==="text/css"?l(y.getAttribute("media")??""):void 0,y.onEndTag(()=>{try{let g=ht(m);if(g.type!=="StyleSheet")return;if(!w){if([...g.children].some(c))s("style type/media");return}u(g.children,w)}catch{s("invalid stylesheet")}})},text(y){m+=y.text}}).transform(new Response(r)).text(),{light:[...t.light].map(([y,b])=>[y,b.value]),dark:[...t.dark].map(([y,b])=>[y,b.value])}}function z(r,e={},t={},i={},s=[]){return{type:r,props:e,style:t,events:i,children:s}}function yt(r,e,t={}){return{version:"1.0.0",root:r,script:e,meta:{source:t.source||"unknown",compiledAt:t.compiledAt||Date.now(),headwindConfig:t.headwindConfig}}}var bt=new Set(["script","style","head","meta","link","title","base","noscript"]),vt=new Set(["template","body","html","main","fragment"]),oe=new Set,$n=new Set(["onBlur","onChange","onChangeText","onDismiss","onEnd","onEndEditing","onEndReached","onError","onFocus","onLayout","onLoad","onLoadEnd","onLoadStart","onLongPress","onMomentumScrollBegin","onMomentumScrollEnd","onPause","onPictureInPictureStart","onPictureInPictureStop","onPlay","onPress","onPressIn","onPressOut","onProgress","onRequestClose","onRegionChangeComplete","onRefresh","onScroll","onScrollBeginDrag","onScrollEndDrag","onShow","onSlidingComplete","onSubmitEditing","onValueChange"]),Oe=new Set(["Sidebar","SplitView","View","ScrollView","SafeAreaView","KeyboardAvoidingView","Text","TextInput","Button","Link","TouchableOpacity","TouchableHighlight","Pressable","Icon","Image","ImageBackground","Video","Map","MapPolyline","MapPolygon","MapMarker","FlatList","SectionList","Switch","Checkbox","Slider","Picker","DatePicker","Modal","ActivityIndicator","StatusBar","RefreshControl",...Te]),Fn=new Map([["data","data"],["sections","sections"],["renderitem","renderItem"],["rendersectionheader","renderSectionHeader"],["keyextractor","keyExtractor"]]),wt=new Set(["View","SafeAreaView","ScrollView","KeyboardAvoidingView"]),jn={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ","#39":"'","#x27":"'"};function G(r){return r.replace(/&(#x?[0-9a-f]+|\w+);/gi,(e,t)=>{let i=jn[t.toLowerCase()];if(i!==void 0)return i;if(t[0]==="#"){let s=t[1]==="x"||t[1]==="X"?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return Number.isFinite(s)?String.fromCodePoint(s):e}return e})}function St(r,e,t,i={}){let s=i.inheritedVariables,a={},c={},l={},u="",m={};for(let[b,g]of e){let d=b.toLowerCase();if(d==="class"||d==="classname"){u=u?`${u} ${g}`:g;continue}if(d==="style"){m={...m,...Wn(r,g,t,{...i,onVariables(v){s=v,i.onVariables?.(v)}})};continue}if(d.startsWith(":")||d.startsWith("x-")&&d!=="x-cloak"){l[d.startsWith(":")?d.slice(1):d.slice(2)]=G(g);continue}if(d==="x-cloak")continue;if(d.startsWith("@")||d.startsWith("v-on:")){let v=d.startsWith("@")?d.slice(1):d.slice(5),[S]=v.split("."),x=xe[S]??(S.startsWith("on")?S:"");if(!x||!$n.has(x)){t.push({kind:"unread-event",tag:r,name:b});continue}c[x]=G(g);continue}if(d==="key"){a.key=g;continue}let p=G(g),h=Ie(b);if(p===""&&at.has(h)){a[h]=!0;continue}try{a[h]=JSON.parse(p)}catch{a[h]=p}}let w=u?se(u,s):void 0;for(let b of new Set(w?.unknown??[]))t.push({kind:"unknown-class",tag:r,name:b});let y=Ce({...w?.style,...m});return{props:a,style:y,events:c,bindings:l,classes:u,inline:m}}function Wn(r,e,t,i){return gt(G(e),(s)=>t.push({...s,tag:r}),i)}function Me(r){return r.children.map((e)=>typeof e==="string"?e:Me(e)).join("").replace(/\s+/g," ").trim()}function Xn(r,e){let t=r.node,i=t.children.filter((a)=>typeof a!=="string"),s=t.children.filter((a)=>typeof a==="string").join("").trim();if(r.tag==="button"&&t.type==="Button"&&!r.declaredNative&&i.length>0)return t.type="Pressable",t.props.role??="button",t.children=t.children.flatMap((a)=>typeof a==="string"?a.trim()?[z("Text",{},{},{},[a.trim()])]:[]:[a]),t;if(t.type==="Button"&&i.length===0)return t.children=s?[s]:[],t;if(t.type==="Svg"||t.type==="G")return t.children=i,t;if(t.type==="SvgText"){let a=Me(t);return t.children=a?[a]:[],t}if(wt.has(t.type)&&i.length===0&&s)return t.type="Text",t.children=[s],t;if(t.type==="Text"&&!s&&i.length===0&&typeof t.props.text==="string")return t.children=t.props.text?[t.props.text]:[],delete t.props.text,t;if(t.type==="Text"&&i.length>0){if(/(?:^|\s)(?:inline-)?(?:flex|grid)(?:\s|$)/.test(t._classes??"")||i.some((l)=>l.type!=="Text"))return t.type="View",t.children=t.children.map((l)=>typeof l==="string"?z("Text",{},{},{},[l]):l),t;let c=Me(t);return e.push({kind:"flattened-text",tag:r.tag}),t.children=c?[c]:[],t}if(wt.has(t.type)&&i.length>0)t.children=i;return t}async function zn(r,e={}){let t=[],i=await mt(r,(d)=>t.push({kind:"unsupported-theme-rule",tag:"style",name:d})),s=Q(i.light).computed(),a=[],c=[],l=new Set;function u(d){let p=c[c.length-1];if(!p)a.push(d);else if(!p.dropped)p.node.children.push(d)}function m(d){let p=(v)=>{if(d.tag!=="html"&&d.node._styleSource)v._styleAncestors=[d.node._styleSource,...v._styleAncestors??[]]};if(d.node.bindings&&Object.keys(d.node.bindings).length>0){let v=d.node.children,S=v.filter((f)=>typeof f!=="string"),x=S.length===1&&S.length===v.length?S[0]:z("View",{},{},{},v);if(x.bindings={...d.node.bindings,...x.bindings},x.bindingId===void 0&&d.node.bindingId!==void 0)x.bindingId=d.node.bindingId;p(x),u(x);return}let h=c[c.length-1];for(let v of d.node.children){if(typeof v==="string"){if(h&&!h.dropped)h.node.children.push(v);continue}if(p(v),!h)a.push(v);else if(!h.dropped)h.node.children.push(v)}}function w(d,p){let h=c[c.length-1];if(d==="svg"||h?.svg)return y(d,p,h);let v=bt.has(d)&&!oe.has(d),S=c[c.length-1]?.dropped??!1,x=h?.variables??s,{props:f,style:T,events:E,bindings:j,classes:N,inline:L}=v||S?{props:{},style:{},events:{},bindings:{},classes:"",inline:{}}:St(d,p,t,{inheritedVariables:x,onVariables:(A)=>{x=A}});if(d==="html")x=s;let O=f["data-native"],k;if(typeof O==="string"&&Oe.has(O))k=O,delete f["data-native"];else if(k=oe.has(d)?"View":lt(d),d==="input"){let A=String(f.type??"text").toLowerCase();if(A==="checkbox")k="Checkbox",f.formValue=f.value??"on",f.checked=f.checked===""||f.checked===!0||f.checked==="true",f.value=f.checked;else if(A==="hidden")k="View",T.display="none",L.display="none";else if(A==="radio")k="View",f.accessibilityRole="radio",t.push({kind:"unsupported-control",tag:d,name:"input:radio"})}if(k===d&&!Oe.has(k)&&!bt.has(d)&&!vt.has(d)&&!l.has(d))l.add(d),t.push({kind:"unmapped-tag",tag:d});if((v||oe.has(d))&&!l.has(`drop:${d}`))l.add(`drop:${d}`),t.push({kind:"dropped-subtree",tag:d});if(k==="View"&&/(?:^|\s)overflow-x-(?:auto|scroll)(?:\s|$)/.test(N))k="ScrollView",f.horizontal=!0,f.showsHorizontalScrollIndicator??=!1;else if(k==="View"&&/(?:^|\s)overflow-y-(?:auto|scroll)(?:\s|$)/.test(N))k="ScrollView";if(d==="form")f["data-stx-form"]=!0;if(d==="button"&&f.type===void 0)f.type="submit";if(k==="Video"&&f.source===void 0&&f.src!==void 0)f.source=f.src,delete f.src;if(k==="Icon"){let A=se(N).icon,R=Pe(String(f.symbol||f.name||A||""),Boolean(f.symbol));if(f.symbol=R.symbol,R.iconify)f.iconify=R.iconify}if(k==="FlatList"||k==="SectionList"){let A=new Set([...Object.keys(f),...Object.keys(j)].map((R)=>R.toLowerCase()));for(let[R,M]of Fn)if(A.has(R))t.push({kind:"unsupported-list-prop",tag:k,name:M})}let _=z(k,f,T,E);_._inlineStyle=L,_._styleSource=G(p.find(([A])=>A==="style")?.[1]??"");let I=f["data-stx-b"];if(typeof I==="number"&&Number.isInteger(I))_.bindingId=I;if(delete f["data-stx-b"],N)_._classes=N;if(Object.keys(j).length>0)_.bindings=j;if(typeof f.key==="string")_.key=f.key,delete f.key;return{tag:d,node:_,variables:x,declaredNative:typeof O==="string"&&Oe.has(O),dropped:v||S||oe.has(d),discard:v||S,unwrap:vt.has(d)}}function y(d,p,h){let v=h?.dropped??!1,S=ke[d];if(v||!S){if(!v&&!l.has(`drop:${d}`))l.add(`drop:${d}`),t.push({kind:st.has(d)?"dropped-subtree":"unmapped-tag",tag:d});return{tag:d,node:z("G",{},{},{}),svg:!0,dropped:!0,discard:!0,unwrap:!1}}let x=h?.variables??s,{props:f,style:T,events:E,bindings:j,classes:N,inline:L}=St(d,p,t,{inheritedVariables:x,onVariables:(I)=>{x=I}});if(S==="Svg"){let I=Re(f.viewBox);if(I)f.viewBox=I;else delete f.viewBox;for(let A of["width","height"]){if(typeof f[A]==="number"&&T[A]===void 0)T[A]=f[A];delete f[A]}}if(typeof f.strokeDasharray==="string"||typeof f.strokeDasharray==="number"){let I=String(f.strokeDasharray).split(/[\s,]+/).map(Number).filter(Number.isFinite);f.strokeDasharray=I}let O=Ae(S,f);if(O)f.geometry=O;let k=z(S,f,T,E);k._inlineStyle=L,k._styleSource=G(p.find(([I])=>I==="style")?.[1]??"");let _=f["data-stx-b"];if(typeof _==="number"&&Number.isInteger(_))k.bindingId=_;if(delete f["data-stx-b"],N)k._classes=N;if(Object.keys(j).length>0)k.bindings=j;if(typeof f.key==="string")k.key=f.key,delete f.key;return{tag:d,node:k,variables:x,svg:!0,dropped:!1,discard:!1,unwrap:!1}}if(await new HTMLRewriter().on("*",{element(d){let p=d.tagName.toLowerCase(),h=w(p,[...d.attributes]),v=!0;try{d.onEndTag(()=>{if(c.pop(),h.discard)return;if(h.unwrap)m(h);else u(Xn(h,t))})}catch{v=!1}if(v)c.push(h);else if(!h.discard)u(h.node)},text(d){let p=c[c.length-1];if(!p||p.dropped)return;let h=G(d.text).replace(/\s+/g," ");if(!h.trim())return;p.node.children.push(h)}}).transform(new Response(r)).text(),a.length===0)throw Error(`No element to translate in the rendered output of ${e.source??"unknown"}`);let b=a.length===1?a[0]:z("View",{},{},{},a);if(i.light.length||i.dark.length)b._stylesheetTheme=i;let g=(d)=>{let p=Se(d.props);if(Object.keys(p).length)d._accessibilitySource=Object.fromEntries(we.filter((h)=>(h in d.props)).map((h)=>[h,d.props[h]])),Object.assign(d.props,p);for(let h of d.children)if(typeof h!=="string")g(h)};return g(b),{root:b,diagnostics:t}}async function xt(r,e={}){let{root:t,diagnostics:i}=await zn(r,e),s=e.script??{exports:{},functions:[],code:""};return{document:yt(t,s,{source:e.source??"unknown"}),diagnostics:i}}var Nt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Hn=/(?:^|\n)\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([$\w]+)\s*\(/g,Un=/(?:^|\n)\s*(?:export\s+)?(?:const|let|var)\s+([$\w]+)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[$\w]+)\s*=>/g,kt=/(?:^|\n)\s*(?:export\s+)?const\s+([$\w]+)\s*=\s*(-?[\d.]+|true|false|'[^']*'|"[^"]*")\s*(?=;|\n|$)/g;function Be(r){let e=[];Nt.lastIndex=0;for(let a of r.matchAll(Nt)){let c=a[1]??"";if(/\bserver\b/.test(c))continue;e.push(a[2].trim())}let t=e.filter(Boolean).join(`
4
+
5
+ `),i=[];for(let a of[Hn,Un]){a.lastIndex=0;for(let c of t.matchAll(a))if(!i.includes(c[1]))i.push(c[1])}let s={};kt.lastIndex=0;for(let a of t.matchAll(kt)){let c=a[2];try{s[a[1]]=JSON.parse(c.replace(/^'(.*)'$/,'"$1"'))}catch{s[a[1]]=c}}return{exports:s,functions:i,code:t}}var ae=/<script\b([^>]*\bdata-stx-scoped\b[^>]*)>([\s\S]*?)<\/script>/gi,Tt=/function\s+(__stx_setup_[\w$]+)\s*\(/,qn=/\bdata-stx-owner\s*=\s*["']([^"']+)["']/i;function De(r){ae.lastIndex=0;for(let e of r.matchAll(ae)){let t=e[2].trim(),i=Tt.exec(t)?.[1];if(i)return{name:i,code:t}}return null}function Rt(r){let e=[];ae.lastIndex=0;for(let t of r.matchAll(ae)){let i=t[1],s=t[2].trim(),a=qn.exec(i)?.[1],c=/\bdata-stx-component-factories\b/i.test(i);if(!s||!a&&!c&&!Tt.test(s))continue;e.push(a?{code:s,owner:a}:{code:s})}return e}function Jn(){let r=[ee.join(import.meta.dir,"..","primitives"),ee.join(import.meta.dir,"native","primitives")];for(let e of r)if(Gn(ee.join(e,"View.stx")))return e;return r[0]}async function Kn(r,e,t={}){let i=t.root??ee.dirname(e),s=await o(i),a={root:i,componentsDir:t.componentsDir??s.componentsDir??ee.join(i,"components"),buildMode:"serve",cache:!1,_targetComponentDirs:[Jn()],_targetComponentFallbackNames:["Button","Checkbox","Switch"],_nativeHostAttrs:!0,skipEventDirectives:!0,_pluginComponentDirs:s._pluginComponentDirs??[]},c={...t.context??{},__stx_inject_css:!1},l=new Set([e]),u=await n(r,c,e,a,l),{html:m,manifest:w}=ze(u),y=await et(i),{document:b,diagnostics:g}=await xt(y?`<style>${y}</style>${m}`:m,{source:e,script:Be(r)}),d=De(m),p=Rt(m);if(Be(r).code.trim()){let h=await dr(r,e,t.context,{forceClientSetup:!0}),v=De(h.setupCode??"");if(d=v??d,v&&!p.some((S)=>S.code===v.code))p.push({code:v.code})}return{document:b,manifest:w,setup:d,scripts:p,diagnostics:g,html:m,dependencies:[...l]}}async function ce(r,e={}){return Kn(await Bun.file(r).text(),r,e)}var te="__app";var le="__runtime",er="__messages";function Le(r){let t=[P.join(import.meta.dir,"..","runtime",`${r}.ts`),P.join(import.meta.dir,"..","runtime",`${r}.js`),P.join(import.meta.dir,"native","runtime",`${r}.js`)].find((i)=>$e(i));if(!t)throw Error(`Native runtime module ${r} is missing`);return t}async function Ve(r,e,t,i,s){let a={name:"stx-screen-inputs",setup(l){l.onLoad({filter:/.*/,namespace:"file"},({path:u})=>{i.add(u);let m=s?.get(u);return m===void 0?void 0:{contents:m,loader:"js"}})}},c=await Bun.build({entrypoints:[r],target:"browser",format:"iife",minify:t,plugins:[a,...e],define:{"process.env.NODE_ENV":JSON.stringify(t?"production":"development")}});if(!c.success){let l=c.logs.map((u)=>String(u.message??u)).join(`
6
+ `);throw Error(`Could not bundle ${r}:
7
+ ${l}`)}return(await c.outputs[0].text()).trim()}var tr=/^[\w-]+(?:\/[\w-]+)*$/,nr=/^[\w-]+$/;async function rr(r,e){let t=P.resolve(r,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let i=new Map,s=new Map;for(let a of e.languages){if(!nr.test(a))throw Error(`messages: "${a}" is not a language directory name`);let c=P.join(t,a);if(!$e(c))throw Error(`messages: ${P.relative(r,c)} does not exist`);let l=new Map;for(let u of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:c})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(u))continue;let m=u.replace(/\.[^./]+$/,"").split(P.sep).join("/");if(!tr.test(m))throw Error(`messages: ${a}/${u} is not an area name`);if(l.has(m))throw Error(`messages: ${a}/${m} is defined twice`);let w=P.join(c,u),y=await import(w),b=Object.keys(y).filter((p)=>p!=="default");if(b.length)throw Error(`messages: ${a}/${u} exports ${b.join(", ")}; a message module exports its messages as default, and nothing else`);let g=y.default,d=g!==null&&typeof g==="object"&&!Array.isArray(g)?JSON.stringify(g):void 0;if(d===void 0||!Bun.deepEquals(JSON.parse(d),g,!0))throw Error(`messages: ${a}/${u} must export plain data (an object JSON can hold) as default`);l.set(m,d),i.set(w,{language:a,area:m})}s.set(a,l)}return{files:i,data:s}}function ir(r,e){return`export default globalThis.__stxNativeRuntime.messages(${JSON.stringify(r)}, ${JSON.stringify(e)});`}function sr(r){let e=new Map;for(let[t,{language:i,area:s}]of r.files){let a=ir(i,s);e.set(t,a),e.set(Zn(t),a)}return e}function or(r){let e=new Set;for(let t of r.matchAll(/__stxNativeRuntime\.messages\(\s*"[\w-]+"\s*,\s*"([\w/-]+)"\s*\)/g))e.add(t[1]);return[...e].sort()}function ar(r,e){let t=P.isAbsolute(r.meta.source)?P.relative(e,r.meta.source).split(P.sep).join("/"):r.meta.source;return{...r,script:{exports:r.script.exports,functions:[],code:""},meta:{...r.meta,source:t,compiledAt:0}}}async function Fe(r){let e=Object.keys(r.screens);if(e.length===0)throw Error("screens must name at least one .stx file");let t=r.routed??!0,i=r.initialScreen??e[0];if(!r.screens[i])throw Error(`Initial screen ${i} is not in screens`);let s=P.resolve(r.root??process.cwd());if(r.messages&&!r.routesDir)throw Error("messages ship a language at a time beside route files: they need routesDir");if(r.sharedRuntime&&!r.routesDir)throw Error("sharedRuntime is the route files' runtime: it needs routesDir");if(r.messages&&!r.sharedRuntime)throw Error("messages are read by the shared runtime: they need sharedRuntime");if(r.messages&&r.outFile)throw Error("messages leave the languages out of the screens' code, which the one-file bundle cannot read: build it without messages");let a=r.messages?await rr(s,r.messages):null,c=a?sr(a):null,l=[],u=async()=>{for(let N of e){let L=P.resolve(s,r.screens[N]);if(!L.endsWith(".stx"))throw Error(`Screen ${N} must name a .stx file`);l.push({name:N,file:L,compiled:await ce(L,{root:s})})}};if(c)await cs(c,u);else await u();let m=Le("jsc-globals"),w=Le("shared-screen"),y=r.app?P.resolve(s,r.app):null;if(y&&!$e(y))throw Error(`The app script ${r.app} does not exist`);if(y&&!t)throw Error("An app script needs a routed bundle");if(y&&r.screens[te])throw Error(`${te} is the app script's route, not a screen name`);let b=r.browser;if(r.screens[le])throw Error(`${le} is the runtime prelude's file, not a screen name`);let g=He();if(b&&r.routesDir)throw Error("A browser screen is one route; routesDir is for device hosts");let d=(N,L,O)=>{let k=t?`var routeName = g.__stxNativeRoute || ${JSON.stringify(i)};
8
+ var isApp = ${y?`routeName === ${JSON.stringify(te)}`:"false"};
9
+ if (!isApp && routeNames.indexOf(routeName) === -1) throw new Error(['Unknown native screen:', routeName].join(' '));
10
+ if (isApp ? ${!L} : ${JSON.stringify(N.map(({name:W})=>W))}.indexOf(routeName) === -1) throw new Error(['This bundle does not hold the native screen', routeName].join(' '));`:`var routeName = 'main';
11
+ var isApp = false;`,_=N.map(({name:W,compiled:B},F)=>`${F===0?"if":"else if"} (routeName === ${JSON.stringify(t?W:"main")}) {
12
+ nativeDocument = ${JSON.stringify(ar(B.document,s))};
13
+ manifest = ${JSON.stringify(B.manifest)};
14
+ }`).join(`
15
+ `),I=N.map(({name:W,compiled:B},F)=>`${F===0?"if":"else if"} (routeName === ${JSON.stringify(t?W:"main")}) {
16
+ g.__stx_latestSetup = null;
17
+ ${B.scripts.map((V)=>V.owner?` g.__stx_componentSetups = g.__stx_componentSetups || {};
18
+ // Kept by id as well as run once: a :for or :if clone of this component
19
+ // has no script to copy, and is set up from this (component hydration).
20
+ g.__stx_componentSetups[${JSON.stringify(V.owner)}] = function() {
21
+ ${V.code}
22
+ };
23
+ g.__STX_SETUP_ROOT__ = screen && screen.scopeRoot(${JSON.stringify(V.owner)});
24
+ try { g.__stx_componentSetups[${JSON.stringify(V.owner)}](); }
25
+ finally { g.__STX_SETUP_ROOT__ = null; }`:V.code).join(`
26
+ `)}
27
+ }`).join(`
28
+ `),A=L&&y,R=b?Le("browser-screen"):null,M=b?Bun.resolveSync(b.platformModule,s):null;return`
29
+ ${O?`var runtime = globalThis.__stxNativeRuntime;
30
+ if (!runtime || runtime.version !== ${JSON.stringify(O)}) throw new Error('This screen needs the stx native runtime it was built with: evaluate ${le}.js from the same build first');
31
+ var installJSCGlobals = runtime.installJSCGlobals;
32
+ var prepareNativeApp = runtime.prepareNativeApp;
33
+ var prepareSharedNativeScreen = runtime.prepareSharedNativeScreen;`:`import { installJSCGlobals } from ${JSON.stringify(m)};
34
+ import { prepareNativeApp, prepareSharedNativeScreen } from ${JSON.stringify(w)};`}
35
+ ${b?`import { createBrowserScreenBridge } from ${JSON.stringify(R)};
36
+ import { createBrowserPlatform } from ${JSON.stringify(M)};`:""}
37
+ ${A?`import * as nativeAppModule from ${JSON.stringify(y)};`:"var nativeAppModule = null;"}
38
+ ${b?"(async function() {":""}
39
+ var g = globalThis;
40
+ installJSCGlobals(g);
41
+ ${b?`var browserPlatform = await createBrowserPlatform(${JSON.stringify(b.platformOptions??{})});
42
+ var browserBridge = createBrowserScreenBridge(browserPlatform, ${JSON.stringify(b)});
43
+ var bridge = browserBridge;
44
+ g.__stxNativeRoute = ${JSON.stringify(i)};`:"var bridge = g.__stxNativeBridge;"}
45
+ if (!bridge) throw new Error('Missing __stxNativeBridge');
46
+ var routeNames = ${JSON.stringify(t?e:["main"])};
47
+ ${k}
48
+ g.__stxNativeRoute = routeName;
49
+ var nativeDocument;
50
+ var manifest;
51
+ ${_}
52
+ var screen = null;
53
+ var app = null;
54
+ if (isApp) {
55
+ app = prepareNativeApp(bridge, { routeName: routeName, routeNames: routeNames });
56
+ g.__stxNativeUnmount = function() { app.unmount(); };
57
+ }
58
+ else {
59
+ screen = prepareSharedNativeScreen(nativeDocument, manifest, bridge, { routeName: routeName, routeNames: routeNames });
60
+ g.__stx_host = screen.host;
61
+ g.__stxNativeUnmount = function() { screen.unmount(); };
62
+ }
63
+ ${O?"runtime.startSignals();":g}
64
+ var pageSetup = g.__stx_latestSetup;
65
+ var pageRuntimeSetup = g.stx && g.stx._latestSetup;
66
+ ${I}
67
+ // The screen's setup is the native host's to run. A screen script publishes
68
+ // it where a page's document runtime adopts its own, and in a browser that
69
+ // runtime's DOMContentLoaded and stx:load ran it a second time: another copy
70
+ // of the screen, mounted beside this one. Take it, and hand the page back
71
+ // whatever setup it had.
72
+ var screenSetup = g.__stx_latestSetup || null;
73
+ g.__stx_latestSetup = pageSetup;
74
+ if (g.stx) g.stx._latestSetup = pageRuntimeSetup || null;
75
+ if (isApp) app.start(nativeAppModule);
76
+ else screen.mount(g.stx, screenSetup);
77
+ ${b?`var stopApp = nativeAppModule && typeof nativeAppModule.default === 'function' ? nativeAppModule.default(g.craft) : null;
78
+ var unmount = g.__stxNativeUnmount;
79
+ var ended = false;
80
+ g.__stxNativeUnmount = function() { if (ended) return; ended = true; if (typeof stopApp === 'function') stopApp(); unmount(); browserBridge.dispose(); };
81
+ g.addEventListener('pagehide', function(event) { if (!event.persisted) g.__stxNativeUnmount(); });
82
+ })().catch(function(error) { console.error('[stx browser screen]', error); var node = document.querySelector(${JSON.stringify(b.container)}); if (node) { node.textContent = 'This screen could not start. Reload to try again.'; node.setAttribute('role', 'alert'); } });`:""}
83
+ `},p=(N)=>({name:"stx-native-shared-screens",setup(L){L.onResolve({filter:/^stx:native-shared-screens$/},()=>({path:"entry",namespace:"stx-native-shared-screens"})),L.onLoad({filter:/.*/,namespace:"stx-native-shared-screens"},()=>({contents:N,loader:"js"}))}}),h=new Set(l.flatMap(({compiled:N})=>N.dependencies)),v=l.flatMap(({compiled:N})=>N.diagnostics).map((N)=>({level:"warning",message:[N.kind,N.tag,N.name].filter(Boolean).join(": ")})),S=r.minify??!1,x,f,T;if(r.routesDir){let N=P.resolve(s,r.routesDir);_t(N,{recursive:!0});let L=`
84
+ import { installJSCGlobals } from ${JSON.stringify(m)};
85
+ import { prepareNativeApp, prepareSharedNativeScreen } from ${JSON.stringify(w)};
86
+ globalThis.__stxNativeRuntime = {
87
+ version: '__STX_NATIVE_RUNTIME_VERSION__',
88
+ installJSCGlobals: installJSCGlobals,
89
+ prepareNativeApp: prepareNativeApp,
90
+ prepareSharedNativeScreen: prepareSharedNativeScreen,
91
+ // Each screen starts its own signals runtime, after its host is in place.
92
+ startSignals: function() {
93
+ ${g}
94
+ },
95
+ // A language's messages for an area (the compile's \`messages\`), read the
96
+ // first time they are looked into: a screen never parses a language it
97
+ // is not shown in, nor an area it does not use.
98
+ messages: function(language, area) {
99
+ var g = globalThis;
100
+ var loaded = g.__stxNativeMessages || (g.__stxNativeMessages = {});
101
+ function table() {
102
+ var forLanguage = loaded[language] || (loaded[language] = {});
103
+ if (Object.prototype.hasOwnProperty.call(forLanguage, area)) return forLanguage[area];
104
+ var value = null;
105
+ if (typeof g.__stxNativeReadMessages === 'function') {
106
+ try {
107
+ var text = g.__stxNativeReadMessages(language, area);
108
+ if (typeof text === 'string') value = JSON.parse(text);
109
+ }
110
+ catch (error) { console.error('[stx native] could not read the ' + language + ' messages for ' + area, error); }
111
+ }
112
+ forLanguage[area] = value;
113
+ return value;
114
+ }
115
+ var own = Object.prototype.hasOwnProperty;
116
+ return new Proxy({}, {
117
+ get: function(target, name) { var messages = table(); return messages && own.call(messages, name) ? messages[name] : undefined; },
118
+ has: function(target, name) { var messages = table(); return !!messages && own.call(messages, name); },
119
+ ownKeys: function() { var messages = table(); return messages ? Object.keys(messages) : []; },
120
+ getOwnPropertyDescriptor: function(target, name) {
121
+ var messages = table();
122
+ return messages && own.call(messages, name) ? { value: messages[name], writable: false, enumerable: true, configurable: true } : undefined;
123
+ },
124
+ });
125
+ },
126
+ };
127
+ `,O,k=P.join(N,`${le}.js`);if(r.sharedRuntime){let R=await Ve("stx:native-shared-screens",[p(L)],S,h);O=Bun.hash(R).toString(36),f=k,await Bun.write(f,R.replace("__STX_NATIVE_RUNTIME_VERSION__",O))}else At(k,{force:!0});let _=P.join(N,er);At(_,{recursive:!0,force:!0});let I={},A=[...l.map((R)=>({name:R.name,screens:[R],app:!1})),...y?[{name:te,screens:[],app:!0}]:[]];x={};for(let R=0;R<A.length;R+=6)await Promise.all(A.slice(R,R+6).map(async(M)=>{let H=P.join(N,`${M.name}.js`),U=await Ve("stx:native-shared-screens",[p(d(M.screens,M.app,O))],S,h,c??void 0);if(await Bun.write(H,U),x[M.name]=H,a)I[M.name]=or(U)}));if(a){for(let[M,H]of a.data)for(let[U,W]of H)await Bun.write(P.join(_,M,`${U}.json`),W);let R=Object.fromEntries(Object.keys(I).sort().map((M)=>[M,I[M]]));await Bun.write(P.join(_,"routes.json"),JSON.stringify(R));for(let M of a.files.keys())h.add(M);T={dir:_,languages:[...a.data.keys()],routes:R}}if(!r.outFile)return{code:"",routes:x,runtime:f,...T?{messages:T}:{},diagnostics:v,dependencies:[...h]}}let E=await Ve("stx:native-shared-screens",[p(d(l,!0))],S,h);if(!r.outFile)return{code:E,diagnostics:v,dependencies:[...h]};let j=P.resolve(s,r.outFile);return _t(P.dirname(j),{recursive:!0}),await Bun.write(j,E),{code:E,outFile:j,...x?{routes:x,runtime:f}:{},...T?{messages:T}:{},diagnostics:v,dependencies:[...h]}}async function cr(r,e={}){return Fe({...e,screens:{main:r},routed:!1})}function Et(r,e={}){return cr(r,e)}var It=["native.config.json","stx-native.config.json"];function fr(r=process.cwd(),e){let t=e?X.resolve(r,e):It.map((u)=>X.join(r,u)).find((u)=>de(u));if(!t)return null;if(!de(t))throw Error(`Native config not found: ${t}`);let i=JSON.parse(ur(t,"utf8")),s=Object.entries(i.screens??{});if(s.length===0)throw Error(`${X.basename(t)} must name at least one screen in "screens"`);let a={};for(let[u,m]of s){if(!/^[A-Z][\w-]*$/i.test(u))throw Error(`Invalid native screen name: ${u}`);if(typeof m!=="string"||!m.endsWith(".stx"))throw Error(`Screen ${u} must name a .stx file`);if(a[u]=X.resolve(X.dirname(t),m),!de(a[u]))throw Error(`Screen ${u} not found: ${a[u]}`)}let c=i.initialScreen||s[0][0];if(!a[c])throw Error(`Initial screen ${c} is not in screens`);if(i.app!==void 0&&typeof i.app!=="string")throw Error(`"app" must name the app script's file`);let l=i.app?X.resolve(X.dirname(t),i.app):void 0;if(l&&!de(l))throw Error(`App script not found: ${l}`);return{initialScreen:c,screens:a,file:t,...l?{app:l}:{}}}async function gs(r,e={}){let t=X.resolve(e.cwd??process.cwd()),i=e.format??"ir";if(i!=="ir"&&i!=="bundle")throw Error(`Unknown compile format: ${i}. Expected ir or bundle.`);let s=r?null:fr(t,e.config);if(!r&&!s)throw Error(`Please specify an input file: stx native compile <file.stx>, or add ${It[0]}`);let a,c=[];if(i==="bundle"){let u=s?await Fe({screens:s.screens,initialScreen:s.initialScreen,minify:e.minify,root:t,...s.app?{app:s.app}:{}}):await Et(X.resolve(t,r),{minify:e.minify});a=u.code,c=u.diagnostics}else{let u=async(w)=>{let y=await ce(w);return c.push(...y.diagnostics.map((b)=>({level:"warning",message:[b.kind,b.tag,b.name].filter(Boolean).join(": ")}))),y.document},m=s?{initialScreen:s.initialScreen,screens:Object.fromEntries(await Promise.all(Object.entries(s.screens).map(async([w,y])=>[w,await u(y)])))}:await u(X.resolve(t,r));a=JSON.stringify(m,null,2)}if(!e.output)return{output:a,diagnostics:c};let l=X.resolve(t,e.output);return lr(X.dirname(l),{recursive:!0}),await Bun.write(l,a),{output:a,written:l,diagnostics:c}}export{gs as runNativeCompile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Dt,Ps,Ri,Uc}from"./chunk-d17mhbz9.js";import"./chunk-9kzdk4na.js";import"./chunk-5vnx8dmz.js";import"./chunk-2pgvbe5x.js";import"./chunk-s5s1w8na.js";import"./chunk-9n7ehv7w.js";import"./chunk-70n1t4ht.js";import"./chunk-hxzy2t7r.js";import"./chunk-qqenm7pg.js";import"./chunk-66e4ga0z.js";import"./chunk-g22q68ds.js";import"./chunk-cjrfazzb.js";import"./chunk-gk4c8d1c.js";export{Uc as declareBareLoopHead,Dt as parseLoopBinding,Ri as processLoops,Ps as reportDeferredLoopWarnings};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var u=import.meta.require;
3
+ export{u};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function no(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function ro(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function ct(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Z(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function jn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Er(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Z(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Bn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=Z(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");no(this.routes,s),ro(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Tr(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function $r(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function rl(e){k=e.replace(/\/$/,"")}function sl(e,t,a={}){f[e]={path:t,name:e,params:a}}function ol(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Fn(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function il(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import U from"path";function al(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function cl(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ll(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function oa(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function ia(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function aa(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function so(e,t){v.set(e,t)}function ca(e){return v.get(e)}function ul(e){return v.has(e)}function lt(){v.clear()}function ut(){return Array.from(v.keys())}async function dt(e,t="middleware"){let a=U.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")so(o,s);else if(typeof s==="function")so(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function pt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function ft(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?oa(a,i):ia(),storage:aa(),state:{},request:a,responseHeaders:i}}async function gt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=ca(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Rr(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Pe(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Rr(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
2
+ import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function ro(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function so(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function dt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Q(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Fn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Tr(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Q(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class zn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=Q(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");ro(this.routes,s),so(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function $r(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Rr(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function rl(e){k=e.replace(/\/$/,"")}function sl(e,t,a={}){f[e]={path:t,name:e,params:a}}function ol(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Hn(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function il(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import U from"path";function al(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function cl(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ll(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function ia(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function aa(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function ca(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function oo(e,t){v.set(e,t)}function la(e){return v.get(e)}function dl(e){return v.has(e)}function ut(){v.clear()}function pt(){return Array.from(v.keys())}async function ft(e,t="middleware"){let a=U.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")oo(o,s);else if(typeof s==="function")oo(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function gt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function mt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?ia(a,i):aa(),storage:ca(),state:{},request:a,responseHeaders:i}}async function ht(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=la(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ar(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Ie(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ar(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -1274,7 +1274,13 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
1274
1274
  // Cache hit \u2192 promote in LRU order so this entry survives eviction
1275
1275
  // longer than other entries that haven't been touched.
1276
1276
  touchCache(targetPath);
1277
- if(checkLayoutChange(layoutCache[targetPath],url,layoutGroupCache[targetPath])){
1277
+ var cached=cache[targetPath];
1278
+ // A whole document swaps in as it is: one prefetched across a layout
1279
+ // change (prefetchLink), or kept from an earlier full-page answer. Only a
1280
+ // fragment from another layout still needs its document fetched; asking
1281
+ // again was a second round trip on every tap into another layout.
1282
+ var isDoc=cached.indexOf('<!--stx-fragment')!==0;
1283
+ if(!isDoc&&checkLayoutChange(layoutCache[targetPath],url,layoutGroupCache[targetPath])){
1278
1284
  // Layout changed \u2014 fetch full page and do full document swap
1279
1285
  log('[router] cache hit but layout changed \u2014 fetching full page');
1280
1286
  return routerFetch(url,{'Accept':'text/html'}).then(function(r){
@@ -1288,11 +1294,10 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
1288
1294
  return swapWith(html,targetPath);
1289
1295
  }).catch(failed).finally(done);
1290
1296
  }
1291
- var cached=cache[targetPath];
1292
1297
  var swapCached=function(){
1293
1298
  if(stale())return false;
1294
1299
  pendingContainerAttrs=attrsCache[targetPath]||'';
1295
- pendingLayoutDecl=null;
1300
+ pendingLayoutDecl=isDoc?{layout:layoutCache[targetPath]||'',group:layoutGroupCache[targetPath]||''}:null;
1296
1301
  return swapWith(cached,targetPath);
1297
1302
  };
1298
1303
  var loading=beforeSwap(cached,url);
@@ -1300,8 +1305,10 @@ import x from"fs";import u from"path";import p from"fs";import w from"path";var
1300
1305
  if(swapped===false)return false;
1301
1306
  applyTitle(titleCache[targetPath]);
1302
1307
  // Shown from the cache at once; asked again behind it, so a page that
1303
- // changed since says so (stx:updated) instead of staying stale.
1304
- revalidate(targetPath,url);
1308
+ // changed since says so (stx:updated) instead of staying stale. Not a
1309
+ // whole document: it would be compared with a fragment and always
1310
+ // read as changed.
1311
+ if(!isDoc)revalidate(targetPath,url);
1305
1312
  return true;
1306
1313
  }).finally(done);
1307
1314
  }
@@ -3473,6 +3480,16 @@ else {
3473
3480
  var wantsFragment=shouldUseFragmentResponse();
3474
3481
  prefetching[key]=fetch(href,{headers:wantsFragment?{'X-STX-Router':'true','Accept':'text/html'}:{'Accept':'text/html'}}).then(function(r){
3475
3482
  return readPrefetchResponse(r,wantsFragment);
3483
+ }).then(function(result){
3484
+ // A page in another layout cannot be swapped in as a fragment: the tap
3485
+ // would read this answer, see the layout change, and fetch the whole
3486
+ // document then (navigate). Fetch it now instead, while the person is
3487
+ // still reaching for the link, so the tap is a swap like any other.
3488
+ if(!result||result.html.indexOf('<!--stx-fragment')||!checkLayoutChange(result.layout,href,result.layoutGroup))return result;
3489
+ // Same guards as any prefetch; the layout is the one the fragment declared.
3490
+ return fetch(href,{headers:{'Accept':'text/html'}}).then(function(full){
3491
+ return full.ok?readPrefetchResponse(full,false).then(function(doc){return doc&&(doc.layout=result.layout,doc.layoutGroup=result.layoutGroup,doc)}):null;
3492
+ });
3476
3493
  }).then(function(result){
3477
3494
  if(result&&o.cache){
3478
3495
  setCache(key,result.html,result.layout,result.layoutGroup,result.title,result.containerAttrs);
@@ -3483,7 +3500,8 @@ else {
3483
3500
  // Its stylesheet too, so the tap never waits on cssLoadTimeout for a
3484
3501
  // sheet it could have had all along. Added unapplied (media=print),
3485
3502
  // as a navigation adds it; the swap makes it live.
3486
- if(result.html.indexOf('<!--stx-fragment')===0)preloadGeneratedCss(fragmentCssHrefs(result.html),location.href);
3503
+ // A whole document's generated sheets too, named the same way in its head.
3504
+ preloadGeneratedCss(fragmentCssHrefs(result.html),location.href);
3487
3505
  }
3488
3506
  }).catch(function(){}).finally(function(){delete prefetching[key]});
3489
3507
  }
@@ -3562,6 +3580,12 @@ else {
3562
3580
  // Answers false when a bundle failed: that page cannot bind, and is
3563
3581
  // recovered (recoverUnbound) rather than swapped in bare.
3564
3582
  function beforeSwap(html,base){
3583
+ // Its generated stylesheets start now too, beside the bundles: the swap
3584
+ // waits for them anyway, and fetched one after the other a tap paid for
3585
+ // two round trips where one would do. The swap finds them here (pending
3586
+ // or loaded) rather than starting them; a failed sheet is the swap's to
3587
+ // handle, so it does not hold this up. Generated sheets are root paths.
3588
+ preloadGeneratedCss(fragmentCssHrefs(html),location.href);
3565
3589
  var waits=loadModuleRegistries(html,base);
3566
3590
  if(!waits)return null;
3567
3591
  return Promise.race([
@@ -3916,4 +3940,4 @@ else {
3916
3940
 
3917
3941
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
3918
3942
  })();
3919
- `}function Ie(){if(A)return A;return A=q(W(X()),!0),A}function dl(){if(T)return T;return T=q(X()),T}export{no,ro,ct,Z,jn,Er,Bn,Tr,$r,rl,sl,ol,Fn,il,al,cl,ll,oa,ia,aa,so,ca,ul,lt,ut,dt,pt,ft,gt,Rr,Pe,Ie,dl};
3943
+ `}function Oe(){if(A)return A;return A=q(W(X()),!0),A}function ul(){if(T)return T;return T=q(X()),T}export{ro,so,dt,Q,Fn,Tr,zn,$r,Rr,rl,sl,ol,Hn,il,al,cl,ll,ia,aa,ca,oo,la,dl,ut,pt,ft,gt,mt,ht,Ar,Ie,Oe,ul};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import i from"path";var Ft=".stx",o="STX_DIR",e=null;function Vi(t){e=t?.trim()||null}function En(){return process.env[o]?.trim()||e||Ft}function a(t=process.cwd(),...n){let r=En();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function Tn(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==Ft&&!n.startsWith(`${Ft}/`))return t;let r=n.slice(Ft.length+1);return r?i.join(En(),r):En()}
3
+ export{Ft,Vi,En,a,Tn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{J,gs,ms,bc,Ot,ai,hs,ci,Kd,Se,bn,ke}from"./chunk-d17mhbz9.js";import"./chunk-9kzdk4na.js";import"./chunk-5vnx8dmz.js";import{Bi,s}from"./chunk-wa26bn4s.js";import"./chunk-2pgvbe5x.js";import"./chunk-s5s1w8na.js";import"./chunk-9n7ehv7w.js";import"./chunk-70n1t4ht.js";import"./chunk-hxzy2t7r.js";import"./chunk-qqenm7pg.js";import"./chunk-66e4ga0z.js";import"./chunk-g22q68ds.js";import"./chunk-cjrfazzb.js";import"./chunk-gk4c8d1c.js";export{J as BROWSER_CORE_IMPORTS,bc as STX_AUTO_IMPORTS,gs as extractAndStripCssImports,Se as extractBridgeData,Bi as findInterpolationEnd,ci as generateAutoImportDestructuring,Kd as generateBrowserAutoImportDestructuring,bn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,ke as processClientScript,hs as referencesName,ms as renderVendorStyleTags,s as stripCommentsAndLiterals,ai as transformAutoImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{R,k,en,tn,nn}from"./chunk-tcd2zez3.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as E}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Ur{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return en(e,s,"image",this.config)}async set(e,s,r){return tn(e,s,r,"image",this.config)}async clear(){return nn("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Ur(e);else if(e)w.updateConfig(e);return w}async function Wr(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function qr(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Ra(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function F(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function D(e,s){let r=s?F(s):F("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Aa(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Wr(e,s,r);if(a)return a;try{let c=z(e);if(!await k(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=D(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await E(p,{recursive:!0});let d=await R(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Do(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await qr(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Pa(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Do(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as Q,basename as U,extname as V,join as L}from"path";import{mkdir as H}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function Ia(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=Q(e);if(!await k(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await H(p,{recursive:!0});let d=await R(a),P=U(e,V(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=L(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await k(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Oa(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Ur,Wr,qr,Ra,Aa,Pa,Do,Ia,Oa};
2
+ import{R,k,nn,rn,sn}from"./chunk-j18z5nxq.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as E}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Wr{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return nn(e,s,"image",this.config)}async set(e,s,r){return rn(e,s,r,"image",this.config)}async clear(){return sn("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Wr(e);else if(e)w.updateConfig(e);return w}async function qr(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Gr(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Aa(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function F(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function D(e,s){let r=s?F(s):F("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Pa(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await qr(e,s,r);if(a)return a;try{let c=z(e);if(!await k(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=D(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await E(p,{recursive:!0});let d=await R(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await No(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Gr(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Ia(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function No(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as Q,basename as U,extname as V,join as L}from"path";import{mkdir as H}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function Oa(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=Q(e);if(!await k(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await H(p,{recursive:!0});let d=await R(a),P=U(e,V(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=L(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await k(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Da(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Wr,qr,Gr,Aa,Pa,Ia,No,Oa,Da};