@stacksjs/stx 0.2.749 → 0.2.751

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 (217) hide show
  1. package/dist/{chunk-91pycazt.js → chunk-02c0zcaw.js} +2 -2
  2. package/dist/chunk-02kkd7fy.js +2 -0
  3. package/dist/chunk-04xvdwdv.js +2 -0
  4. package/dist/chunk-051evb5w.js +2 -0
  5. package/dist/chunk-0b7f2mby.js +2 -0
  6. package/dist/{chunk-7dhpecgc.js → chunk-0jdrw4rr.js} +9 -9
  7. package/dist/chunk-0k13q4w5.js +2 -0
  8. package/dist/{chunk-3jr1nwap.js → chunk-0k8ke4sy.js} +2 -2
  9. package/dist/chunk-0mehkbcx.js +2 -0
  10. package/dist/{chunk-vtmd3ssd.js → chunk-0p6fpsw5.js} +3 -3
  11. package/dist/chunk-1019v091.js +2 -0
  12. package/dist/{chunk-e0prbqds.js → chunk-10bge0j5.js} +4 -4
  13. package/dist/{chunk-1xjv71dw.js → chunk-19safa6y.js} +2 -2
  14. package/dist/chunk-1h9mcnvn.js +2 -0
  15. package/dist/{chunk-yx63etd1.js → chunk-1j2tt4fw.js} +10 -10
  16. package/dist/chunk-1kdtapc1.js +2 -0
  17. package/dist/{chunk-0shj71m2.js → chunk-1ksc7rnp.js} +3 -3
  18. package/dist/{chunk-23drx7xh.js → chunk-1qmeh6ba.js} +2 -2
  19. package/dist/{chunk-4998rbts.js → chunk-2kevesvh.js} +2 -2
  20. package/dist/{chunk-gtyvejny.js → chunk-35s1vpsc.js} +6 -6
  21. package/dist/{chunk-as9wg93m.js → chunk-391ha6yg.js} +25 -25
  22. package/dist/chunk-3a42s01p.js +2 -0
  23. package/dist/{chunk-amyxgejb.js → chunk-3yz7fafy.js} +1 -1
  24. package/dist/chunk-40kmkhkb.js +2 -0
  25. package/dist/{chunk-cka9p9v5.js → chunk-41yjah34.js} +2 -2
  26. package/dist/{chunk-byaasw3f.js → chunk-4nmb776w.js} +2 -2
  27. package/dist/chunk-59512t1y.js +2 -0
  28. package/dist/{chunk-9bbs9d9q.js → chunk-5bkha4ej.js} +2 -2
  29. package/dist/{chunk-wpwh529h.js → chunk-5hrm7rtx.js} +13 -13
  30. package/dist/{chunk-8f14cgm8.js → chunk-5s8bt976.js} +1 -1
  31. package/dist/{chunk-72hfqwvk.js → chunk-664tnv9e.js} +5 -5
  32. package/dist/{chunk-b107z777.js → chunk-67z3kesf.js} +2 -2
  33. package/dist/{chunk-n8mb6510.js → chunk-6fhcmg96.js} +2 -2
  34. package/dist/{chunk-jzqmq0hp.js → chunk-6hfrf0mb.js} +1 -1
  35. package/dist/chunk-6jtjhx7w.js +2 -0
  36. package/dist/{chunk-vcfrpxj2.js → chunk-6pjmnvph.js} +9 -9
  37. package/dist/chunk-6x112bw3.js +2 -0
  38. package/dist/{chunk-bsx40v6h.js → chunk-6xjkprv4.js} +2 -2
  39. package/dist/{chunk-0ckh7cy1.js → chunk-7t9wj2m4.js} +1 -1
  40. package/dist/{chunk-hgqpr15a.js → chunk-7ws6n88w.js} +2 -2
  41. package/dist/{chunk-zn3c0ew5.js → chunk-89h4snzd.js} +2 -2
  42. package/dist/{chunk-k8gxa1jf.js → chunk-8mkxge3a.js} +4 -4
  43. package/dist/chunk-8wnjaz0x.js +2 -0
  44. package/dist/chunk-9293adsm.js +2 -0
  45. package/dist/chunk-99p5yrkr.js +2 -0
  46. package/dist/{chunk-y3w2rc1y.js → chunk-9hfk5wf1.js} +5 -5
  47. package/dist/chunk-9tp4vfv9.js +2 -0
  48. package/dist/{chunk-ffk5p7rc.js → chunk-aeqm0vdq.js} +2 -2
  49. package/dist/{chunk-3kw9m62d.js → chunk-amwxbvdp.js} +2 -2
  50. package/dist/{chunk-rnhv0fx4.js → chunk-bc1zck9n.js} +13 -13
  51. package/dist/{chunk-xzv8t0nd.js → chunk-bd4c8af4.js} +1 -1
  52. package/dist/chunk-c0t3hys0.js +2 -0
  53. package/dist/{chunk-dxsdr77m.js → chunk-c0v9ng82.js} +7 -7
  54. package/dist/chunk-c7yjhjr2.js +2 -0
  55. package/dist/chunk-c88nx6te.js +2 -0
  56. package/dist/chunk-cgb6729y.js +2 -0
  57. package/dist/chunk-cgyddqxw.js +2 -0
  58. package/dist/{chunk-2hk6evh2.js → chunk-cn6k59h6.js} +5 -5
  59. package/dist/{chunk-j9zp3hne.js → chunk-cq032t09.js} +5 -5
  60. package/dist/chunk-cs5gf4zp.js +2 -0
  61. package/dist/{chunk-q1db41k8.js → chunk-dg1h0d9r.js} +3 -3
  62. package/dist/{chunk-mk0axhs2.js → chunk-dtgwjaxf.js} +6 -6
  63. package/dist/chunk-e7sykgst.js +2 -0
  64. package/dist/chunk-e8fqsbs7.js +2 -0
  65. package/dist/{chunk-2hrdh72h.js → chunk-ecf9tftk.js} +2 -2
  66. package/dist/chunk-f0kbpzbb.js +2 -0
  67. package/dist/chunk-f83dksbn.js +2 -0
  68. package/dist/{chunk-6fx89gvg.js → chunk-fgg1stc0.js} +2 -2
  69. package/dist/chunk-fk7gs41v.js +2 -0
  70. package/dist/chunk-ftjfw2bt.js +2 -0
  71. package/dist/{chunk-e43cxztn.js → chunk-ftk2jdg8.js} +2 -2
  72. package/dist/{chunk-crk5dzxb.js → chunk-g019qe9x.js} +4 -4
  73. package/dist/{chunk-965x7wqa.js → chunk-g7eye50p.js} +3 -3
  74. package/dist/{chunk-md36aysy.js → chunk-g7shwb6q.js} +6 -6
  75. package/dist/chunk-gsawyk8q.js +2 -0
  76. package/dist/{chunk-9v98dzxt.js → chunk-h7y2pmd9.js} +6 -6
  77. package/dist/{chunk-8fazd6fr.js → chunk-hc6m2t92.js} +2 -2
  78. package/dist/chunk-hec2qjj8.js +2 -0
  79. package/dist/{chunk-j6m7jwpv.js → chunk-hnzfzm0k.js} +5 -5
  80. package/dist/chunk-hzcgq05k.js +2 -0
  81. package/dist/{chunk-888xnaex.js → chunk-jq6gggcz.js} +2 -2
  82. package/dist/{chunk-zx5vg2pn.js → chunk-k0vqjagg.js} +3 -3
  83. package/dist/{chunk-nybty1zx.js → chunk-k7p9wkw3.js} +2 -2
  84. package/dist/chunk-k83z4nyg.js +2 -0
  85. package/dist/{chunk-h6pmg82p.js → chunk-kb8654dp.js} +2 -2
  86. package/dist/{chunk-vq77bjtx.js → chunk-kdzejksk.js} +10 -10
  87. package/dist/chunk-kg4zjb7a.js +2 -0
  88. package/dist/{chunk-27agaezn.js → chunk-kyk4ekng.js} +2 -2
  89. package/dist/{chunk-9zrbhs3p.js → chunk-mcdwjq8t.js} +1 -1
  90. package/dist/{chunk-4s1k8k2a.js → chunk-mdsrnd6s.js} +4 -4
  91. package/dist/chunk-mjam7gyj.js +2 -0
  92. package/dist/chunk-myr79xxf.js +3 -0
  93. package/dist/{chunk-w1sdxmx3.js → chunk-n3t2cd17.js} +2 -2
  94. package/dist/{chunk-78x8qfvt.js → chunk-neh3kewg.js} +4 -4
  95. package/dist/chunk-ng9xkyvs.js +2 -0
  96. package/dist/chunk-nhm3qamb.js +2 -0
  97. package/dist/chunk-nmqak9tg.js +2 -0
  98. package/dist/{chunk-xrb4dk5w.js → chunk-nzfbjmvb.js} +1 -1
  99. package/dist/{chunk-kp2rkczm.js → chunk-p4h5c79q.js} +5 -5
  100. package/dist/{chunk-egbt0bms.js → chunk-pnpabjzz.js} +7 -7
  101. package/dist/{chunk-x0c8xq0s.js → chunk-pnpd7gz7.js} +3 -3
  102. package/dist/chunk-qan3tb8e.js +2 -0
  103. package/dist/chunk-qdmzr3a1.js +2 -0
  104. package/dist/{chunk-6ew10ptg.js → chunk-qeh8f4bk.js} +2 -2
  105. package/dist/{chunk-ttsrhr95.js → chunk-qksbf2gt.js} +6 -6
  106. package/dist/chunk-r24cv13z.js +2 -0
  107. package/dist/{chunk-vyv76w55.js → chunk-r3v1zaj0.js} +2 -2
  108. package/dist/{chunk-nzwcbt98.js → chunk-r6s35xw9.js} +2 -2
  109. package/dist/chunk-rc1cb58n.js +2 -0
  110. package/dist/chunk-rhygq40y.js +2 -0
  111. package/dist/{chunk-yygtmm7t.js → chunk-rt5as4t6.js} +3 -3
  112. package/dist/{chunk-j3cbj356.js → chunk-rzqd4t77.js} +2 -2
  113. package/dist/chunk-s4fr9cx8.js +2 -0
  114. package/dist/{chunk-fsz9k5k0.js → chunk-smpb39kv.js} +5 -5
  115. package/dist/chunk-sn86wfnm.js +2 -0
  116. package/dist/{chunk-5f6x6fyp.js → chunk-snfmgp7a.js} +4 -4
  117. package/dist/chunk-sp5c1pgg.js +2 -0
  118. package/dist/{chunk-amsbfc3y.js → chunk-srjhnk6w.js} +56 -56
  119. package/dist/{chunk-yvh0d5xa.js → chunk-sw65q2dx.js} +4 -4
  120. package/dist/{chunk-s3cqm7x0.js → chunk-t29h7kb3.js} +3 -3
  121. package/dist/{chunk-bj0z4gve.js → chunk-tary163t.js} +2 -2
  122. package/dist/{chunk-es4ec0nr.js → chunk-tct6rn6f.js} +68 -68
  123. package/dist/chunk-tn40nh9e.js +3 -0
  124. package/dist/{chunk-rvevd9sh.js → chunk-txfh8fg1.js} +6 -6
  125. package/dist/chunk-tyb22n6n.js +2 -0
  126. package/dist/{chunk-djjjc178.js → chunk-vawr540d.js} +3 -3
  127. package/dist/chunk-vb440rt0.js +2 -0
  128. package/dist/{chunk-r2cfezt5.js → chunk-vfe8xj8g.js} +3 -3
  129. package/dist/chunk-vqjbqm6c.js +2 -0
  130. package/dist/chunk-vyznvnew.js +2 -0
  131. package/dist/{chunk-pd89jnqk.js → chunk-vzn029zn.js} +3 -3
  132. package/dist/{chunk-tdfszf8h.js → chunk-wd0xbhf6.js} +30 -30
  133. package/dist/chunk-wg0w5smr.js +2 -0
  134. package/dist/{chunk-9vhv2hx9.js → chunk-wrzmt43b.js} +2 -2
  135. package/dist/chunk-x24gng8y.js +2 -0
  136. package/dist/chunk-xh83mf56.js +2 -0
  137. package/dist/{chunk-h66xm89j.js → chunk-xqkh97s7.js} +1 -1
  138. package/dist/{chunk-k3233hjr.js → chunk-xymxx2np.js} +4 -4
  139. package/dist/chunk-xzvbr2gs.js +2 -0
  140. package/dist/{chunk-2x2ydz3v.js → chunk-y52ktcjz.js} +3 -3
  141. package/dist/{chunk-w34w1hrg.js → chunk-yax8wz93.js} +2 -2
  142. package/dist/chunk-ycxwf633.js +2 -0
  143. package/dist/chunk-ydx3j69d.js +2 -0
  144. package/dist/{chunk-c10aj83y.js → chunk-ymfa4w5g.js} +5 -5
  145. package/dist/chunk-yq3p5y7y.js +2 -0
  146. package/dist/chunk-yx4p2mb7.js +3 -0
  147. package/dist/chunk-z3ggbhhc.js +2 -0
  148. package/dist/chunk-ztqwya0a.js +2 -0
  149. package/dist/cli.js +20 -20
  150. package/dist/craft-entry.js +2 -2
  151. package/dist/craft.js +2 -2
  152. package/dist/pwa.js +3 -3
  153. package/dist/ssg.js +7 -7
  154. package/package.json +5 -5
  155. package/dist/chunk-068t9bkm.js +0 -2
  156. package/dist/chunk-07d8nssg.js +0 -2
  157. package/dist/chunk-24kagfwc.js +0 -2
  158. package/dist/chunk-3538p4ct.js +0 -2
  159. package/dist/chunk-3nbvr34s.js +0 -2
  160. package/dist/chunk-4rcfm5dk.js +0 -2
  161. package/dist/chunk-4rqx6k5p.js +0 -2
  162. package/dist/chunk-4yz476ss.js +0 -2
  163. package/dist/chunk-4z7bnc9j.js +0 -2
  164. package/dist/chunk-5d1c504j.js +0 -2
  165. package/dist/chunk-5qzg0p2h.js +0 -2
  166. package/dist/chunk-62b9nhv5.js +0 -2
  167. package/dist/chunk-6g3t2pwz.js +0 -2
  168. package/dist/chunk-6vajjyj8.js +0 -2
  169. package/dist/chunk-75wdm7kd.js +0 -2
  170. package/dist/chunk-7w7f14jq.js +0 -2
  171. package/dist/chunk-840t4gws.js +0 -2
  172. package/dist/chunk-8bw9yd5m.js +0 -2
  173. package/dist/chunk-8dfq934n.js +0 -2
  174. package/dist/chunk-8t9em8md.js +0 -2
  175. package/dist/chunk-9adx6f4k.js +0 -3
  176. package/dist/chunk-adncj39d.js +0 -2
  177. package/dist/chunk-cmm2mkr1.js +0 -2
  178. package/dist/chunk-dgv3016h.js +0 -2
  179. package/dist/chunk-fb6af3vk.js +0 -2
  180. package/dist/chunk-fd29vm1h.js +0 -3
  181. package/dist/chunk-fvrcp1mr.js +0 -2
  182. package/dist/chunk-fvwfpxbb.js +0 -2
  183. package/dist/chunk-h2y36t58.js +0 -3
  184. package/dist/chunk-h61daksw.js +0 -2
  185. package/dist/chunk-h6jba844.js +0 -2
  186. package/dist/chunk-h75rev1h.js +0 -2
  187. package/dist/chunk-hrb9fmq0.js +0 -2
  188. package/dist/chunk-jka3p99a.js +0 -2
  189. package/dist/chunk-k38vsxt8.js +0 -2
  190. package/dist/chunk-m7h2c8x1.js +0 -2
  191. package/dist/chunk-n2nb5f0m.js +0 -2
  192. package/dist/chunk-n6carvxa.js +0 -2
  193. package/dist/chunk-ne363j4c.js +0 -2
  194. package/dist/chunk-p2rawhtq.js +0 -2
  195. package/dist/chunk-pkyakgzn.js +0 -2
  196. package/dist/chunk-px7em6mh.js +0 -2
  197. package/dist/chunk-pzm8bc99.js +0 -2
  198. package/dist/chunk-r5re2zj0.js +0 -2
  199. package/dist/chunk-rdzccdjw.js +0 -2
  200. package/dist/chunk-rh0fe82b.js +0 -2
  201. package/dist/chunk-scdasnp7.js +0 -2
  202. package/dist/chunk-sx1aer4p.js +0 -2
  203. package/dist/chunk-sxh4enb9.js +0 -2
  204. package/dist/chunk-vkaa0a18.js +0 -2
  205. package/dist/chunk-vnrsm0kj.js +0 -2
  206. package/dist/chunk-vqj5mjrj.js +0 -2
  207. package/dist/chunk-vvk948z8.js +0 -2
  208. package/dist/chunk-w07kke19.js +0 -2
  209. package/dist/chunk-w6dyqh92.js +0 -2
  210. package/dist/chunk-waqnhm47.js +0 -2
  211. package/dist/chunk-wbcqtpkm.js +0 -2
  212. package/dist/chunk-wy8er1ps.js +0 -2
  213. package/dist/chunk-xrspzeqx.js +0 -2
  214. package/dist/chunk-yh5frx7x.js +0 -2
  215. package/dist/chunk-zgnqyta0.js +0 -2
  216. package/dist/chunk-zvfr6022.js +0 -2
  217. package/dist/chunk-zzeas8x5.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
3
- `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function ko(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
- export{ko};
3
+ `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function Co(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
+ export{Co};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ei,Ti,$i,xg,Ri,Ai,Sg,Pi,Ii,dl,kg}from"./chunk-pnpd7gz7.js";export{Ei as VideoProcessorCache,dl as analyzeVideo,xg as clearVideoCache,Ii as generateDASHManifest,Pi as generateHLSManifest,Ri as generatePoster,Sg as generateSpriteSheet,Ai as generateThumbnails,Ti as getCachedVideoResult,kg as processVideo,$i as setCachedVideoResult};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xf,rs}from"./chunk-10bge0j5.js";import"./chunk-yx4p2mb7.js";import"./chunk-tary163t.js";import"./chunk-5s8bt976.js";import{vr}from"./chunk-tct6rn6f.js";import"./chunk-aeqm0vdq.js";import"./chunk-r6s35xw9.js";import{nt}from"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{nt as freeIdentifiers,rs as processComponents,xf as processESImports,vr as rendersAsElement};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{uo,ha,ya,Ym}from"./chunk-rt5as4t6.js";export{uo as NATIVE_COMPONENTS,ha as compileToNative,ya as createHotReloadServer,Ym as default};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zn,$e}from"./chunk-19safa6y.js";export{Zn as describeBuildFailure,$e as formatBuildFailure};
@@ -1,18 +1,18 @@
1
1
  // @bun
2
- import{w,x,Qo,dn}from"./chunk-es4ec0nr.js";import{Do}from"./chunk-9vhv2hx9.js";import{l}from"./chunk-h2y36t58.js";import M from"fs";import d from"path";import{hasLocalConfig as le}from"bunfig";var ht={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function qe(n){return`--stx-${n}`}function F(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var xe=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function X(n,t){let s=t.trim();return F(n,s)??(xe.test(s)?s:void 0)}function Z(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!ht[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!he[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ae[t]).map((t)=>`density.${t}`)]}function q(n){let t={};for(let[s,r]of Object.entries(ht)){let i=F(n,r.light);if(i===void 0)continue;t[s]=`var(${qe(s)}, ${i})`}return t}function ee(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(ht)){let a=t[i],g=typeof a==="string"?a:a?.light,c=typeof a==="string"?a:a?.dark,u=g&&X(n,g)||F(n,o.light),m=c&&X(n,c)||F(n,o.dark);if(u===void 0)continue;if(s.push(` ${qe(i)}: ${u};`),m!==void 0)r.push(` ${qe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
3
- `)}var he={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function rn(n){return`--stx-radius-${n}`}function te(){let n={};for(let[t,s]of Object.entries(he))n[t]=`var(${rn(t)}, ${s.value})`;return n}function ne(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(he).map(([t,s])=>` ${rn(t)}: ${n[t]??s.value};`),"}",""].join(`
4
- `)}var Ae={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Qn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},er={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ke(n){return`--stx-${n}`}function V(n){let t=Ae[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Ke(n)}, ${t.value})`}function se(){let n={};for(let[t,s]of Object.entries(Qn))n[t]=V(s);return n}function re(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(er))n[t]=[V(s),{lineHeight:V(r)}];return n}function ie(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${Ke(t)}: ${n[t]??s.value};`),"}",""].join(`
2
+ import{w,x,ti,pn}from"./chunk-tct6rn6f.js";import{Lo}from"./chunk-wrzmt43b.js";import{l}from"./chunk-myr79xxf.js";import M from"fs";import d from"path";import{hasLocalConfig as le}from"bunfig";var ht={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function qe(n){return`--stx-${n}`}function F(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var xe=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function X(n,t){let s=t.trim();return F(n,s)??(xe.test(s)?s:void 0)}function Z(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!ht[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!he[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ae[t]).map((t)=>`density.${t}`)]}function q(n){let t={};for(let[s,r]of Object.entries(ht)){let i=F(n,r.light);if(i===void 0)continue;t[s]=`var(${qe(s)}, ${i})`}return t}function ee(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(ht)){let a=t[i],g=typeof a==="string"?a:a?.light,c=typeof a==="string"?a:a?.dark,u=g&&X(n,g)||F(n,o.light),m=c&&X(n,c)||F(n,o.dark);if(u===void 0)continue;if(s.push(` ${qe(i)}: ${u};`),m!==void 0)r.push(` ${qe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
3
+ `)}var he={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function sn(n){return`--stx-radius-${n}`}function te(){let n={};for(let[t,s]of Object.entries(he))n[t]=`var(${sn(t)}, ${s.value})`;return n}function ne(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(he).map(([t,s])=>` ${sn(t)}: ${n[t]??s.value};`),"}",""].join(`
4
+ `)}var Ae={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},er={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},tr={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ke(n){return`--stx-${n}`}function V(n){let t=Ae[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Ke(n)}, ${t.value})`}function se(){let n={};for(let[t,s]of Object.entries(er))n[t]=V(s);return n}function re(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(tr))n[t]=[V(s),{lineHeight:V(r)}];return n}function ie(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${Ke(t)}: ${n[t]??s.value};`),"}",""].join(`
5
5
  `)}function oe(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function U(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=oe(i)&&oe(s[r])?U(s[r],i):i;return s}function ce(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
6
- `:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...b}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...b,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function Jm(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function Va(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await ue(o);if(a){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ym(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),h.clear(),me=null,G.clear()}var fe=!1;async function Ua(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!fe)fe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function df(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-24kagfwc.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await Ua(n)}function pf(n){try{let t=new WeakSet;return L(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function sn(n){if(B)return I;B=!0;try{let t=await Va();if(!t||!t.build)return B=!1,"";if(!v)v=await Ua(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),a=await t.build(i),g=performance.now()-o;if(I=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let c=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(c);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(c,a.css)}return B=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,I}}async function tr(n){v=null,await sn(n)}function Zm(){return I}function ff(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let a=o[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let c of g.slice(1,-1).split(/\s+/))if(c.trim())t.add(c.trim())}o=i.exec(n)}return t}var Y=w(64);async function gf(n,t){let s=()=>G.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Y.get(x(n,t,s()));if(r!==void 0)return r;let i=await $e(n,t);if(i)Y.set(x(n,t,s()),i);return i}function*ye(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=Do(r);if(i)yield i}}function Qm(n){return[...ye(n)].join(`
7
- `)}async function $e(n,t){try{let s=await Va();if(!s)return"";let r=new Set;for(let f of ye(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(f):ff(f);for(let J of j)r.add(J)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=l(i,"cache");if(!z)z=o;let a=G.get(i);if(!a){let f=await df(i);a={config:f,fingerprint:pf(f)},G.set(i,a),me=a.fingerprint}let g=[...r].sort().join(" "),c=`${A}::${a.fingerprint||"default"}::${g}`,u=S.get(c);if(u!==void 0)return W(c,u),u;let m=await Ce(c,o);if(m!==null)return W(c,m),m;let H=s.defaultConfig||s.config,R=a.config||{},k=ae(H,R),{safelist:E,includePreflight:_,minify:P,tokenCSS:K}=k;if(k.unknownRoles.length>0&&!ge.has(i))ge.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${k.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let D=k.config,O=new s.CSSGenerator(D),T=D.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((f)=>r.has(f)||E.includes(f));for(let f of E)if(!T[f])O.generate(f);for(let f of r)if(!T[f])O.generate(f);let C="";if(N.length>0){let f=new s.CSSGenerator(D);for(let j of N)f.generate(j);if(C=f.toCSS(!1,P),C&&!C.endsWith(`
6
+ `:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...b}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...b,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,me=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function eh(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function qa(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await ue(o);if(a){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function th(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),h.clear(),me=null,G.clear()}var fe=!1;async function Ka(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!fe)fe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function mf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-nmqak9tg.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await Ka(n)}function hf(n){try{let t=new WeakSet;return L(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function on(n){if(B)return I;B=!0;try{let t=await qa();if(!t||!t.build)return B=!1,"";if(!v)v=await Ka(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),a=await t.build(i),g=performance.now()-o;if(I=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let c=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(c);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(c,a.css)}return B=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,I}}async function nr(n){v=null,await on(n)}function nh(){return I}function yf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let a=o[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let c of g.slice(1,-1).split(/\s+/))if(c.trim())t.add(c.trim())}o=i.exec(n)}return t}var Y=w(64);async function bf(n,t){let s=()=>G.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Y.get(x(n,t,s()));if(r!==void 0)return r;let i=await $e(n,t);if(i)Y.set(x(n,t,s()),i);return i}function*ye(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=Lo(r);if(i)yield i}}function rh(n){return[...ye(n)].join(`
7
+ `)}async function $e(n,t){try{let s=await qa();if(!s)return"";let r=new Set;for(let f of ye(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(f):yf(f);for(let J of j)r.add(J)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=l(i,"cache");if(!z)z=o;let a=G.get(i);if(!a){let f=await mf(i);a={config:f,fingerprint:hf(f)},G.set(i,a),me=a.fingerprint}let g=[...r].sort().join(" "),c=`${A}::${a.fingerprint||"default"}::${g}`,u=S.get(c);if(u!==void 0)return W(c,u),u;let m=await Ce(c,o);if(m!==null)return W(c,m),m;let H=s.defaultConfig||s.config,R=a.config||{},k=ae(H,R),{safelist:E,includePreflight:_,minify:P,tokenCSS:K}=k;if(k.unknownRoles.length>0&&!ge.has(i))ge.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${k.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let D=k.config,O=new s.CSSGenerator(D),T=D.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((f)=>r.has(f)||E.includes(f));for(let f of E)if(!T[f])O.generate(f);for(let f of r)if(!T[f])O.generate(f);let C="";if(N.length>0){let f=new s.CSSGenerator(D);for(let j of N)f.generate(j);if(C=f.toCSS(!1,P),C&&!C.endsWith(`
8
8
  `))C+=`
9
- `}let b=C+O.toCSS(_,P);return b=ce(s.CSSGenerator,k)+K+b,W(c,b),Se(c,b,o),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function y(n,t,s=!1,r=!1){let i=await gf(n,t);if(!i)return r?dn(n):n;let o=s?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ke(i)}.css">`:`<style data-css="generated">
9
+ `}let b=C+O.toCSS(_,P);return b=ce(s.CSSGenerator,k)+K+b,W(c,b),Se(c,b,o),b}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function y(n,t,s=!1,r=!1){let i=await bf(n,t);if(!i)return r?pn(n):n;let o=s?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ke(i)}.css">`:`<style data-css="generated">
10
10
  ${i}
11
11
  </style>`;if(r)return Te(n,o);let a=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(a.test(n)){let g=!1;return n.replace(a,()=>{if(g)return"";return g=!0,o})}if(n.includes("</head>"))return n.replace("</head>",`${o}
12
12
  </head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
13
- ${o}`);return o+n}function Te(n,t){let s=Qo(n).map((c)=>({...c,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let c=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:c?t:""}),c=!1,i=r.exec(n)}else{let c=n.indexOf("</head>");if(c!==-1)s.push({start:c,end:c,replacement:`${t}
13
+ ${o}`);return o+n}function Te(n,t){let s=ti(n).map((c)=>({...c,replacement:""})),r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=r.exec(n);if(i!==null){let c=!0;while(i!==null)s.push({start:i.index,end:i.index+i[0].length,replacement:c?t:""}),c=!1,i=r.exec(n)}else{let c=n.indexOf("</head>");if(c!==-1)s.push({start:c,end:c,replacement:`${t}
14
14
  `});else{let u=n.match(/<body([^>]*)>/);if(u?.index!==void 0)s.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
15
- ${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((c,u)=>c.start-u.start||c.end-u.end);for(let c=1;c<s.length;c++)if(s[c].start<s[c-1].end)return je(dn(n),t);let o=Array(s.length*2+1),a=0,g=0;for(let c of s)o[g++]=n.slice(a,c.start),o[g++]=c.replacement,a=c.end;return o[g]=n.slice(a),o.join("")}function je(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return n.replace("</head>",`${t}
15
+ ${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((c,u)=>c.start-u.start||c.end-u.end);for(let c=1;c<s.length;c++)if(s[c].start<s[c-1].end)return je(pn(n),t);let o=Array(s.length*2+1),a=0,g=0;for(let c of s)o[g++]=n.slice(a,c.start),o[g++]=c.replacement,a=c.end;return o[g]=n.slice(a),o.join("")}function je(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return n.replace("</head>",`${t}
16
16
  </head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
17
17
  ${t}`);return t+n}
18
- export{ht,qe,he,rn,Ae,Qn,er,Ke,e,Jm,Va,Ym,Ua,df,pf,sn,tr,Zm,ff,gf,Qm,y};
18
+ export{ht,qe,he,sn,Ae,er,tr,Ke,e,eh,qa,th,Ka,mf,hf,on,nr,nh,yf,bf,rh,y};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ve,Ds,eg,Ch,tg,Eh,Nt,p,V,Z,bn,xe,ng,li,rg,Th,k,sg,$h,E,Rh}from"./chunk-tct6rn6f.js";import"./chunk-aeqm0vdq.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{sg as applyFilters,Eh as clearCustomFilters,ng as clientLoopScopes,Ds as defaultFilters,bn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,tg as getAllFilters,rg as interpolateScriptAttributes,li as interpolateScriptExpressions,Th as interpolateScriptsInTemplate,k as processExpressions,eg as registerFilter,Ch as registerFilters,Nt as replaceInterpolations,$h as resetRejectedExpressionWarnings,Rh as unescapeHtml,xe as usesSignalsInScript};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Qe}from"./chunk-4s1k8k2a.js";import{gt,Bn}from"./chunk-j6m7jwpv.js";import{Ne,pn,Mc,Lc}from"./chunk-es4ec0nr.js";import{kr,_r,Cr,Tr,ke}from"./chunk-wpwh529h.js";import{O}from"./chunk-nzwcbt98.js";import{ci}from"./chunk-ffk5p7rc.js";import{y}from"./chunk-7dhpecgc.js";import{i}from"./chunk-as9wg93m.js";import{j,a}from"./chunk-yx63etd1.js";import{ac}from"./chunk-5f6x6fyp.js";import{$n,Ue,Ce,Ji,Yi,Rn}from"./chunk-rvevd9sh.js";import{nn,bo}from"./chunk-j9zp3hne.js";import{An}from"./chunk-3kw9m62d.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{G}from"./chunk-mk0axhs2.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Bn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Mc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=$n(b)+Ue(b),P=Lc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:pn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Rg(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:Tr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=An(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)nn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Cr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=kr(t.html,u);if(g.htmlAttrs)t.html=_r(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),H){let p=await Rn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let F=Xn(o);if(F){let{copied:s,bytes:f}=Z(F,c.join(r,"public",Gn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Xt}/`)}let N={runtime:v.filename,router:x.filename},C=Ji(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await bo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ci(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(ac(e._layerGraph),null,2));Yi(C,r);let K=Date.now()-l;return console.log(`
2
+ import{Qe}from"./chunk-mdsrnd6s.js";import{gt,Fn}from"./chunk-hnzfzm0k.js";import{Ne,fn,Bc,Fc}from"./chunk-tct6rn6f.js";import{_r,Cr,Er,$r,ke}from"./chunk-5hrm7rtx.js";import{O}from"./chunk-r6s35xw9.js";import{ui}from"./chunk-aeqm0vdq.js";import{y}from"./chunk-0jdrw4rr.js";import{i}from"./chunk-391ha6yg.js";import{j,a}from"./chunk-1j2tt4fw.js";import{uc}from"./chunk-snfmgp7a.js";import{Rn,Ue,Ce,Zi,Qi,An}from"./chunk-txfh8fg1.js";import{rn,wo}from"./chunk-cq032t09.js";import{Pn}from"./chunk-amwxbvdp.js";import{Jt,Xn,Jn}from"./chunk-tn40nh9e.js";import{G}from"./chunk-dtgwjaxf.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Fn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Bc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...j,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=Rn(b)+Ue(b),P=Fc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:fn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Og(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:$r,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Pn(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)rn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let f=T(s.pattern),H=f.rendering==="prerender";if(H&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Er(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=_r(t.html,u);if(g.htmlAttrs)t.html=Cr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),H){let p=await An(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:H}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(o,d);if(m.existsSync(E)){let{copied:s,bytes:f}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let F=Jn(o);if(F){let{copied:s,bytes:f}=Z(F,c.join(r,"public",Xn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Jt}/`)}let N={runtime:v.filename,router:x.filename},C=Zi(k,N,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await wo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ui(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(uc(e._layerGraph),null,2));Qi(C,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:N,outputDir:r,duration:K}}
4
- export{Rg};
4
+ export{Og};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{we,si,oi,Wf,Ot,Dc,ii,Mc,kh,De,hn,Me}from"./chunk-tct6rn6f.js";import{Hc,s}from"./chunk-dg1h0d9r.js";import"./chunk-aeqm0vdq.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{we as BROWSER_CORE_IMPORTS,Wf as STX_AUTO_IMPORTS,si as extractAndStripCssImports,De as extractBridgeData,Hc as findInterpolationEnd,Mc as generateAutoImportDestructuring,kh as generateBrowserAutoImportDestructuring,hn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,Me as processClientScript,ii as referencesName,oi as renderVendorStyleTags,s as stripCommentsAndLiterals,Dc as transformAutoImports};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function La(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function ja(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
2
+ import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function Fa(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function za(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
3
3
  `);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
4
- `)}function Ba(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
- export{La,ja,Ba};
4
+ `)}function Ha(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
+ export{Fa,za,Ha};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vm,wm,xm,Sm,km}from"./chunk-664tnv9e.js";export{wm as createSSRSuspense,Sm as generateSuspenseCSS,km as generateSuspenseRuntime,vm as processSuspenseDirectives,xm as renderSSRSuspense};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Yc,Zc}from"./chunk-27agaezn.js";import{H,ks,_s,Cs,qo,Ko,mr,Oe,pe,X,Ts,ie,J,I,tt,yr,Yo,wr,Be,r,p,V,yn}from"./chunk-es4ec0nr.js";import{f,R,nt,d}from"./chunk-wpwh529h.js";import{n}from"./chunk-fd29vm1h.js";import{se}from"./chunk-bj0z4gve.js";import{s}from"./chunk-q1db41k8.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var mt=!1;function me(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function bt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var xt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[xt]??={catalog:new Map,transparent:new Set},e[xt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...mn(i.absolutePath)?{options:{storage:t}}:{}}))}function mn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function bn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function _o(e){let t=At(e);return t?ye().catalog.get(t):void 0}function Co(e){let t=At(e);return t?ye().transparent.has(t):!1}function Eo(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=_o(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Eo(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:Co(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${bt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${bt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let v=await bn(y.entries),b=xn(y.entries,v),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=qo(e,o);if(a!==void 0)return a;for(let c of Ko(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function Fe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function We(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,Fe(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,Fe(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${be(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${be(e,l,void 0,o,a)} ${c}x`}).join(", ")}function be(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function In(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function _n(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=_o(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),v=K(e,"densities"),b=K(e,"format"),C=Co(o)||qe(o)?.transparent===!0,x=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",w=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),L=Ie(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&w&&w!=="local"&&w!=="static")z=Ve(o,Xe,w,b),G=Ze(u);else if(!z&&v){let _=v.split(/\s+/).map((W)=>Number.parseFloat(W.replace("x","")));z=Pn(o,_,B,w,b)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&x==="color")j.push(`background-color:${_.color}`),F.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let W=_n(B||16,T||9,h);j.push(`background-image:url(${W})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")j.push(`background-image:url(${n(x)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=a?.fallback.url||be(o,B,T,w,b),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",W=In(F)+(_?`;${_}`:"");Y.push(`onload="${n(W)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let W=b==="webp"?"image/webp":b==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${W?` type="${W}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
3
- `}if(E){let _=[];if(a)for(let W of Eo(a))_.push(`<source type="image/${W.format}" srcset="${n(W.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let W=be(o,B,T,w,"avif"),te=z?Ve(o,Xe,w,"avif"):`${W}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let W=be(o,B,T,w,"webp"),te=z?Ve(o,Xe,w,"webp"):`${W}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
2
+ import{el,tl}from"./chunk-kyk4ekng.js";import{H,_s,Cs,Es,Go,Xo,hr,Oe,pe,X,$s,ie,J,I,tt,br,Qo,xr,Be,r,p,V,bn}from"./chunk-tct6rn6f.js";import{f,R,nt,d}from"./chunk-5hrm7rtx.js";import{n}from"./chunk-yx4p2mb7.js";import{se}from"./chunk-tary163t.js";import{s}from"./chunk-dg1h0d9r.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var mt=!1;function me(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function bt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var xt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[xt]??={catalog:new Map,transparent:new Set},e[xt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...mn(i.absolutePath)?{options:{storage:t}}:{}}))}function mn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function yn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Eo(e){let t=At(e);return t?ye().catalog.get(t):void 0}function To(e){let t=At(e);return t?ye().transparent.has(t):!1}function $o(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ih(e){let t=Eo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:$o(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:To(e)?void 0:t.placeholder?.dataUrl}}function ns(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function ah(e,t,i={}){if(!e||!ee.existsSync(e))return ns(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ns(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return ns(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${bt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${bt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ns(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let v=await yn(y.entries),b=xn(y.entries,v),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Go(e,o);if(a!==void 0)return a;for(let c of Xo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function Fe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function We(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(hr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${be(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${be(e,l,void 0,o,a)} ${c}x`}).join(", ")}function be(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function In(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function _n(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=Eo(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),v=K(e,"densities"),b=K(e,"format"),C=To(o)||qe(o)?.transparent===!0,x=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",w=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),L=Ie(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&w&&w!=="local"&&w!=="static")z=Ve(o,Xe,w,b),G=Ze(u);else if(!z&&v){let _=v.split(/\s+/).map((W)=>Number.parseFloat(W.replace("x","")));z=Pn(o,_,B,w,b)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&x==="color")j.push(`background-color:${_.color}`),F.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let W=_n(B||16,T||9,h);j.push(`background-image:url(${W})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")j.push(`background-image:url(${n(x)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=a?.fallback.url||be(o,B,T,w,b),Y=[];if(Y.push(`src="${n(hr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(hr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",W=In(F)+(_?`;${_}`:"");Y.push(`onload="${n(W)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let W=b==="webp"?"image/webp":b==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${W?` type="${W}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
3
+ `}if(E){let _=[];if(a)for(let W of $o(a))_.push(`<source type="image/${W.format}" srcset="${n(W.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let W=be(o,B,T,w,"avif"),te=z?Ve(o,Xe,w,"avif"):`${W}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let W=be(o,B,T,w,"webp"),te=z?Ve(o,Xe,w,"webp"):`${W}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
4
4
  ${_.join(`
5
5
  `)}
6
6
  ${D}
@@ -38,5 +38,5 @@ ${D}
38
38
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
39
39
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
40
40
  </style>`}};import{existsSync as On,readFileSync as Bn}from"fs";var Ne=new Map,Ot=new Set;function Tn(e){if(Ot.has(e))return;Ot.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Dn(e){let t=process.cwd();for(let i of[`${t}/node_modules/@iconify-json/${e}/icons.json`,`${t}/pantry/@iconify-json/${e}/icons.json`,`${t}/node_modules/@iconify/json/json/${e}.json`,`${t}/pantry/@iconify/json/json/${e}.json`])if(On(i))return i;for(let i of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return g.resolve(i)}catch{}return null}function jn(e){if(Ne.has(e))return Ne.get(e);let t=Dn(e);if(!t)return Tn(e),null;try{let i=JSON.parse(Bn(t,"utf8"));return Ne.set(e,i),i}catch{return null}}function Mn(e,t,i,o){let a=[];if(t.rotate)a.push(`rotate(${t.rotate*90} ${i/2} ${o/2})`);if(t.hFlip)a.push(`translate(${i} 0) scale(-1 1)`);if(t.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Ln(e,t){let i=t,o=e.icons[i],a={hFlip:!1,vFlip:!1,rotate:0};for(let m=0;!o&&m<8;m++){let u=e.aliases?.[i];if(!u)return null;if(u.hFlip)a.hFlip=!a.hFlip;if(u.vFlip)a.vFlip=!a.vFlip;if(u.rotate)a.rotate=((a.rotate+u.rotate)%4+4)%4;i=u.parent,o=e.icons[i]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Mn(o.body,a,c,l),width:c,height:l}}function de(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);if(e.static[t]!==void 0)return String(e.static[t]);if(e.clientReactive[t]!==void 0)return e.clientReactive[t];return}var st={name:"Icon",aliases:["icon","stx-icon"],render(e,t,i){let o=de(e,"name")??de(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let S=o.split(":");a=S[0],c=S[1]}let l=n(de(e,"size")||"24"),m=n(de(e,"color")||"currentColor"),u=n(de(e,"class")||""),y=n(de(e,"style")||""),v=Ne.get(a)??jn(a);if(!v)return`<!-- Icon: collection "${a}" not loaded -->`;let b=Ln(v,c);if(!b)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${b.width} ${b.height}`,x=b.body;if(m!=="currentColor")x=x.replace(/currentColor/g,m);let h=u?` class="${u}"`:"",w=y?` style="${y}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${h}${w}>${x}</svg>`}};function Bt(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}function Tt(e,t){let i=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(i);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var it={name:"Suspense",aliases:["suspense"],render(e,t,i){let o=Tt(t,"fallback"),a=o.rest,c=Tt(a,"error"),l=c.rest,m=o.region??Bt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',u=c.region??Bt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${m}</div><div data-stx-suspense-error hidden>${u}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function Te(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}var ot={name:"TransitionGroup",aliases:["transition-group"],render(e,t,i){let o=(Te(e,"name")||"v").replace(/["'<>]/g,""),a=(Te(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=Te(e,"class"),l=Te(e,"id"),m=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${m}>${t}</${a}>`}};function Dt(e=le){e.registerBuiltin(He),e.registerBuiltin(Ge),e.registerBuiltin(Ke),e.registerBuiltin(Ye),e.registerBuiltin(Qe),e.registerBuiltin(et),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot)}var jt=new Map;function zn(e){let t=jt.get(e.source);if(!t)t=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),jt.set(e.source,t);return t}var Mt=new WeakMap;function Lt(e){let t=Mt.get(e);if(!t)t=new Set([...e].map((o)=>o.toLowerCase())),Mt.set(e,t);let i=t;return(o)=>!/[a-z]/.test(o)&&i.has(o.toLowerCase())}function Un(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function zt(e,t,i){let o=[],a=0,c=typeof i==="function"?i:i?(l)=>i.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let m=zn(t);m.lastIndex=l+1;let u=m.exec(e);if(!u){a=l+1;continue}let y=u[1];if(c&&c(y)){let S=l+1+y.length;while(S<e.length&&e[S]!==">")S++;a=S+1;continue}let v=l+1+y.length,b=null,C=v,x=-1,h=!1;while(v<e.length){let S=e[v];if(b){if(S==="\\"&&v+1<e.length){v+=2;continue}if(S===b)b=null;v++;continue}if(S==='"'||S==="'"){b=S,v++;continue}if(S==="/"&&v+1<e.length&&e[v+1]===">"){x=v+2,h=!0;break}if(S===">"){x=v+1;break}v++}if(x===-1){a=l+1;continue}let w=e.slice(C,h?x-2:x-1).trim();if(h)o.push({fullMatch:e.slice(l,x),tagName:y,attributes:w,content:"",startIndex:l,endIndex:x,isSelfClosing:!0}),a=x;else{let S=`<${y}`,A=`</${y}>`,P=1,k=x,N=-1;while(P>0&&k<e.length){let L=e.indexOf(S,k),q=e.indexOf(A,k);if(q===-1)break;if(L!==-1&&L<q){let O=e[L+S.length];if(O===" "||O===">"||O==="/"||O===`
41
- `||O==="\t"){let E=Un(e,L+S.length);if(e[E-1]!=="/")P++;k=E+1}else k=L+S.length}else{if(P--,P===0){N=q;break}k=q+A.length}}if(N===-1){a=x;continue}let U=e.slice(x,N),M=N+A.length;o.push({fullMatch:e.slice(l,M),tagName:y,attributes:w,content:U,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function at(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ut(e,t){try{let i=Buffer.from(e,"base64").toString("utf8");return JSON.parse(i)}catch{}try{let i=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(i)}catch(i){if(t?.debug)console.error("Error decoding __stx_ prop:",i);return e}}function ct(e,t){let i=0,o="",a=t;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")i++;else if(c==="}"){if(i--,i===0)return e.slice(t,a+1)}a++}return e.slice(t)}function Ft(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var Fn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Wn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Hn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],i=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,o;while((o=i.exec(e))!==null){let a=o[2]||"",c=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(a);if(!c)continue;let l=J(c[1]??c[2]??c[3]??""),m=o.index,u=m+o[0].length,y=o[1].toLowerCase();if(o[0].endsWith("/>")||Wn.has(y)){t.push({start:m,end:u,names:l});continue}let v=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=new RegExp(`<\\/?${v}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");b.lastIndex=u;let C=1,x=u,h;while((h=b.exec(e))!==null)if(h[0].startsWith("</")){if(C--,C===0){x=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))C++;t.push({start:m,end:x,names:l})}return t}function Wt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Wt(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function qa(e,t){if(!/:[\w-]+=/.test(e))return e;let i=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Hn(e));let l=new Set([...tt(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function m(C){return a.some(([x,h])=>C>=x&&C<h)}let u=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,y=[],v=new Map,b=256;while((c=u.exec(i))!==null){if(m(c.index))continue;let C=c[0],x=c[2];if(!x||!x.includes(":"))continue;let h=/(?:^|\s)data-native(?:\s|=|$)/i.test(x.replace(/"[^"]*"|'[^']*'/g,"")),w=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,A=x,P=!1;while((S=w.exec(x))!==null){if(Ts(x,S.index,!0)?.kind==="attribute")continue;let k=S[1],N=S[2];if(Yc(k))continue;if(I(N,l))continue;if(N.includes("()")&&!N.includes(".get(")||N.includes("$store")||N.includes("$ref"))continue;try{let U=Object.keys(t),M=Object.values(t),L=N.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!U.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let q=JSON.stringify([U,N]),O=v.get(q);if(!O){if(O=Function(...U,`return (${N})`),v.size>=b)v.clear();v.set(q,O)}let E=O(...M);if(k==="class"){let B=V(Wt(E));if(B){let T=A.match(/\sclass="([^"]*)"/);if(T)A=A.replace(T[0],()=>` class="${T[1]} ${B}"`);else A=A.replace(S[0],()=>` class="${B}"`)}else A=A.replace(S[0],"");P=!0;continue}if(Fn.has(k)){if(E)A=A.replace(S[0],` ${k}`);else A=A.replace(S[0],"");P=!0;continue}if(E===null||E===void 0||E===!1)A=A.replace(S[0],"");else{let B=h&&typeof E==="object"?JSON.stringify(E):String(E),T=yn(k,B);A=A.replace(S[0],()=>` ${k}="${T}"`)}P=!0}catch(U){if(U instanceof ie)throw U;continue}}if(P){let k=c[3]?" /":"",U=`<${c[1]}${A}${k}>`;y.push({start:c.index,end:c.index+C.length,replacement:U})}}if(y.length>0){let C=Array(y.length*2+1),x=0;for(let h=0;h<y.length;h++){let{start:w,end:S,replacement:A}=y[h];C[h*2]=i.slice(x,w),C[h*2+1]=A,x=S}C[y.length*2]=i.slice(x),i=C.join("")}return i}import Ht from"fs";import qt from"path";var Xt=!1;function qn(e,t,i,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),m=(b)=>{if(l.size===0)return!1;let C=s(b),x=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&l.has(x))return!0;for(let h of l){let w=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${w}\\s*\\(`).test(C))return!0}return!1},u=new Set(Zc),y=(b)=>{if(!b.includes("-")||b.startsWith("@")||b.startsWith(":")||b.startsWith("x-")||b.startsWith("__"))return b;if(b.startsWith("aria-")||b.startsWith("data-"))return b;return b.replace(/-([a-z0-9])/g,(C,x)=>x.toUpperCase())},v=(b,C)=>{let x=y(b);if(c.static[x]=C,x!==b)c.staticNames[x]=b};for(let[b,C]of Object.entries(e)){let x=b.startsWith("x-")&&!u.has(b)&&!b.startsWith("x-bind:")&&!b.startsWith("x-on:")?`:${b.slice(2)}`:b;if(x.startsWith("@")){c.events[x]=C;continue}if(x.startsWith("__stx_")){let h=y(x.slice(6));c.serverDynamic[h]=Ut(C,i);continue}if(x.startsWith(":")){let h=y(x.slice(1)),w=C===re?h:C;if(h==="if"||h==="for"||h==="show"){c.clientReactive[h]=w;continue}if(o){c.clientReactive[h]=w;continue}if(I(w,a)){c.clientReactive[h]=w;continue}if(m(w)){c.clientReactive[h]=w;continue}try{if(!f(w)){if(i.debug)console.error(`Unsafe expression in :${h} binding: ${w}`);c.clientReactive[h]=w;continue}let S=Object.keys(t),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),P=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(nt(w).some((M)=>!A.has(M)&&!S.includes(M)&&(!(M in globalThis)||P.has(M)))){c.clientReactive[h]=w;continue}let U=d(w,S)(...Object.values(t));if(c.serverDynamic[h]=U,h!==x.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[h]=x.slice(1)}catch{c.clientReactive[h]=w}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let h=Xn(C,a);if(h!==null){c.clientReactive[y(x)]=h;continue}let w=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(w)try{let S=w[1];if(f(S)){let P=d(S,Object.keys(t))(...Object.values(t));v(x,P!=null?String(P):"")}else{if(i.debug)console.error(`Unsafe expression in ${x}: ${S}`);v(x,C)}}catch(S){if(i.debug)console.error(`Error evaluating expression for ${x}:`,S);v(x,C)}else{let S=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,P;while((P=A.exec(C))!==null)try{let k=P[1];if(!f(k)){if(i.debug)console.error(`Unsafe expression in ${x}: ${k}`);continue}let U=d(k,Object.keys(t))(...Object.values(t));S=S.replace(P[0],String(U??""))}catch(k){if(i.debug)console.error(`Error evaluating expression in ${x}:`,k)}v(x,S)}continue}v(x,C===re?"true":at(C))}return c}function Xn(e,t){if(t.size===0)return null;let i=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(i)];if(!o.some((m)=>I(m[1],t)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let m of o)c+=e.slice(l,m.index).replace(/[`\\$]/g,(u)=>`\\${u}`),c+=`\${${m[1]}}`,l=m.index+m[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(m)=>`\\${m}`),`\`${c}\``}var Zn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Vn(e,t,i){if(!e.includes("@"))return e;if(!Zn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return se(e,t,i)}catch{return e}}function ge(e){let t={},i=0,o=e.length;while(i<o){while(i<o&&/\s/.test(e[i]))i++;if(i>=o)break;let a="";while(i<o&&!/[\s=]/.test(e[i]))a+=e[i],i++;if(!a)break;while(i<o&&/\s/.test(e[i]))i++;if(i<o&&e[i]==="="){i++;while(i<o&&/\s/.test(e[i]))i++;let c="";if(i<o&&(e[i]==='"'||e[i]==="'")){let l=e[i];i++;while(i<o){let m=e[i];if(m==="\\"&&i+1<o){i++,c+=e[i],i++;continue}if(m===l){i++;break}c+=m,i++}}else if(e[i]==="{"){c=ct(e,i),i+=c.length;let l=Ft(c);if(l!==null){t[`:${a}`]=l;continue}}else while(i<o&&!/\s/.test(e[i]))c+=e[i],i++;t[a]=c}else t[a]=re}return t}function Zt(e){return Object.entries(e).map(([t,i])=>i===re?t:`${t}="${Gn(i)}"`).join(" ")}function Gn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kn(e){let t=new Set,i=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=i.exec(e))!==null){let a=o[1];if(le.isBuiltin(a))t.add(a)}return[...t].sort()}async function yf(e,t,i,o,a){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,l=qt.dirname(i),m=[],u=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let b of e.matchAll(u)){let[C,x,h]=b,w=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=h,A,P=[];while((A=w.exec(h))!==null){let[k,N,U,M]=A,L=null,q=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))q=B;else{let T=`${B}.stx`;try{if(Ht.statSync(T).isFile())q=T}catch{try{if(Ht.statSync(B).isDirectory())L=B}catch{}}}}else L=_s(M,l);if(!L&&!q)continue;let O=!1,E=(B,T)=>{c.set(B,T),c.set(B.toLowerCase(),T);let z=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(z,T),a.add(T)};if(U&&q)E(U,q),O=!0;else if(N){let B=N.slice(1,-1).split(",").map((z)=>z.trim()).filter(Boolean).map((z)=>{let G=z.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(G)return{source:G[1],local:G[2]};return{source:z,local:z}}),T=L?ks(L):null;for(let{source:z,local:G}of B){let j=null;if(q)j=q;else if(T)j=T.get(z)??T.get(z.toLowerCase())??T.get(z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)E(G,j),O=!0}}if(O)P.push({start:A.index,end:A.index+k.length})}if(P.length===0)continue;for(let k=P.length-1;k>=0;k--)S=S.slice(0,P[k].start)+S.slice(P[k].end);m.push({start:b.index,end:b.index+C.length,value:`<script${x}>${S}</script>`})}if(m.length===0)return e;let y=[],v=0;for(let b of m)y.push(e.slice(v,b.start),b.value),v=b.end;return y.push(e.slice(v)),y.join("")}async function Jn(e,t,i,o,a){let c=e;if(!t.__importedComponents)t.__importedComponents=new Map;let l=t.__importedComponents,m=/@import\s*\(\s*([^)]+)\s*\)/g,u;while((u=m.exec(c))!==null){let[y,v]=u,b=v.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of b){let x=C.split("/"),w=x[x.length-1].replace(/\.stx$/,""),S=w.includes("-")?w.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):w.charAt(0).toUpperCase()+w.slice(1),A=null,P=Cs(C,i,o);for(let k of P)try{if(await Bun.file(k).exists()){A=k;break}}catch{}if(A){l.set(S,A),l.set(w,A),l.set(w.toLowerCase(),A);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,A),a.add(A),o.debug)console.log(`Imported component: ${S} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(y,""),m.lastIndex=0}return c}async function Yn(e,t,i,o,a){let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=/@component\s*\(/g,y;while((y=u.exec(c))!==null){let v=y.index,b=v+y[0].length-1,C=1,x=b+1;while(x<c.length&&C>0){if(c[x]==="(")C++;else if(c[x]===")"){if(C--,C===0)break}x++}if(C!==0)break;let h=c.substring(b+1,x),w=x+1,S=h.match(/^\s*['"]([^'"]+)['"]/);if(!S){u.lastIndex=0;continue}let A=S[1],P,k=h.slice(S[0].length),N=k.match(/^\s*,\s*/);if(N)P=k.slice(N[0].length).trim();let U={};if(P)try{U=R(P,t)}catch(B){let T=B instanceof Error?B.message:String(B);c=c.replace(c.substring(v,w),`[Error parsing component props: ${T}]`);continue}let M="",L=w,O=c.substring(w).match(/^([\s\S]*?)@endcomponent/);if(O)M=O[1].trim(),L=w+O[0].length;let E=await Be(A,U,M,l,t,i,o,m,a);c=c.substring(0,v)+E+c.substring(L),u.lastIndex=0}return c}async function Qn(e,t,i,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=nr(c);if(u.size>0){let w=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...w,...u])]}let y=X(c);c=y.output;let v=tt(t);return c=await h(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await h(c,/[A-Z][a-zA-Z0-9]*/,!0,Lt(yr)),c=await h(c,/[a-z][a-z0-9]*/,!1,yr),c=y.restore(c),c;async function h(w,S,A,P){if(!w)return w;let k=w,N=zt(k,S,P),U=lt(k),M=new Map;for(let O=N.length-1;O>=0;O--){let E=N[O],B=A?H(E.tagName):E.tagName,T=ge(Vn(E.attributes,t,i)),z=U.filter(({start:Z,end:_})=>E.startIndex>=Z&&E.startIndex<_),G=z.length>0,j=new Set(v);for(let Z of z)for(let _ of Z.names)j.add(_);let F=qn(T,t,o,G,j);if(typeof F.clientReactive.for==="string")for(let Z of J(F.clientReactive.for))j.add(Z);let ce=le.getBuiltin(E.tagName),we=ce?await wr(E.tagName,l,t,i,o):!1;if(ce&&!we){let Z={context:t,filePath:i,options:o,dependencies:a},_=ce.render(F,E.content,Z);if(Object.keys(F.events).length>0){let W=Zt(F.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${W}`)}if(Object.keys(F.clientReactive).length>0)_=Vt(_,F.clientReactive);M.set(O,_);continue}if(!A&&E.tagName.includes("-")&&!await wr(B,l,t,i,o))continue;let Y={};for(let[Z,_]of Object.entries(F.static))Y[Z]=_;for(let[Z,_]of Object.entries(F.serverDynamic))Y[Z]=_;let ne={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(F.clientReactive),events:Object.keys(F.events)},D=await Be(B,Y,y.restore(E.content),l,t,i,o,m,a,[...j],ne,E.tagName);if(D=er(D,F,ne.declaredProps,ne.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let Z=ne.reactiveProps.filter((te)=>!ne.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(H),_=ut(D,!0);if(Z.length&&_){if(!Object.hasOwn(ge(D.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))D=D.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+D.slice(_.insertPos);let te=ve(D);D=D.slice(0,te.insertPos)+` data-stx-native-forward="${Z.join(" ")}"`+D.slice(te.insertPos)}let W=ut(D,!0);if(W){let te=ge(D.slice(W.insertPos,W.tagEnd)),Se=ve(D),Kt=ge(D.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))D=D.slice(0,Se.insertPos)+" data-stx-native-host-owner"+D.slice(Se.insertPos)}}if(Object.keys(F.events).length>0){let Z=ve(D);if(Z){let _=Zt(F.events),W=Object.keys(F.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,Z.insertPos)+` data-stx-parent-events="${W}" ${_}`+D.substring(Z.insertPos)}}if(Object.keys(F.clientReactive).length>0)D=Vt(D,F.clientReactive);M.set(O,D)}if(M.size===0)return k;let L="",q=0;for(let O=0;O<N.length;O++){let E=M.get(O);if(E===void 0)continue;L+=k.slice(q,N[O].startIndex),L+=E,q=N[O].endIndex}return L+=k.slice(q),L}}function Vt(e,t){let i=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(t).filter(([v])=>!i.has(v)),c=a.filter(([v])=>!o.has(v)).map(([v])=>H(v)).join(" "),l=e,m=a.length>0?ve(l):null;if(m){let v=a.map(([C,x])=>`:${H(C)}="${x.replace(/"/g,"&quot;")}"`).join(" "),b=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,m.insertPos)+`${b} ${v}`+l.substring(m.insertPos)}let u=t.if;if(u)l=`<template :if="${u.replace(/"/g,"&quot;")}">${l}</template>`;let y=t.for;if(y){let v=t.key,b=v?` :key="${v.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${y.replace(/"/g,"&quot;")}"${b}>${l}</template>`}return l}function er(e,t,i=new Set,o=new Set,a=!1){let c=ut(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),m=t.serverDynamic.class??t.static.class;if(a&&typeof m==="string"&&m&&!o.has("class")){let h=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,w=h.test(l)?l.replace(h,(S,A,P,k,N)=>`${A}class="${n(`${at(P??k??N)} ${m}`)}"`):` class="${n(m)}"${l}`;e=e.slice(0,c.insertPos)+w+e.slice(c.tagEnd),c.tagEnd+=w.length-l.length,l=w}let u=a||/\bdata-native(?:\s|=)/i.test(l),y=u?o:i,v=new Set(Object.keys(ge(l))),b=new Set(["class","className"]);for(let h of Object.keys(t.static)){let w=t.staticNames[h]??h;if(v.has(w)||y.has(h)||!u&&!We(w))b.add(h)}for(let h of Object.keys(t.serverDynamic)){let w=t.serverDynamicNames?.[h]??h;if(v.has(w)||y.has(h)||!u&&!We(w))b.add(h)}let C=[];if(u){for(let[h,w]of Object.entries(t.static)){if(b.has(h)||w!==!0&&w!==re)continue;b.add(h),C.push(`${n(t.staticNames?.[h]??h)}="true"`)}for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w!==!0)continue;b.add(h),C.push(`${n(t.serverDynamicNames?.[h]??h)}="true"`)}}let x=[...oe(t,b),...ae(t,b),...C];if(u){for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w!==!1)continue;let S=t.serverDynamicNames?.[h]??h;x.push(`${n(S)}="false"`)}for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w===null||typeof w!=="object")continue;let S=JSON.stringify(w);if(S!==void 0){let A=t.serverDynamicNames?.[h]??h;x.push(`${n(A)}="${n(S)}"`)}}}if(x.length===0)return e;return`${e.slice(0,c.insertPos)} ${x.join(" ")}${e.slice(c.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(i)return{insertPos:i.index+1+i[1].length,tagEnd:ft(e,i.index+1+i[1].length)};return null}function ut(e,t=!1){let i=ve(e);if(!i)return null;let o=e.slice(i.insertPos,i.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,i.tagEnd+1):i;return a&&t?tr(e,a)??a:a}function tr(e,t){if(!e.includes("data-stx-native-host-root"))return null;let i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",t.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let v=e.indexOf("-->",o+4);if(v<0)return null;o=e.indexOf("<",v+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let m=l[2].toLowerCase(),u=o+l[0].length,y=ft(e,u);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(m==="script"||m==="style"){let v=new RegExp(`</${m}\\s*>`,"gi");if(v.lastIndex=y+1,!v.exec(e))return null;o=e.indexOf("<",v.lastIndex);continue}else{let v=ge(e.slice(u,y)),b=a>0&&(Object.hasOwn(v,"data-stx-component-wrapper")||Object.hasOwn(v,"data-stx-native-host-owner"));if(c===void 0&&!b&&Object.hasOwn(v,"data-stx-native-host-root"))return{insertPos:u,tagEnd:y};if(!i.has(m)&&e[y-1]!=="/"){if(a++,c===void 0&&b)c=a}else if(a===0)return null}o=e.indexOf("<",y+1)}return null}function Gt(e,t){let i=t;while(i<e.length){let o=e.slice(i),a=o.match(/^\s+/);if(a){i+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",i+4);if(m===-1)return null;i=m+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let m=`</${c[1].toLowerCase()}>`,u=e.toLowerCase().indexOf(m,i+c[0].length);if(u===-1)return null;i=u+m.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:i+1+l[1].length,tagEnd:ft(e,i+1+l[1].length)}}return null}function ft(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function nr(e){let t=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=i[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Yo(i[2]))t.add(a);for(let a of i[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])t.add(a[1]);if(a[3])t.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))t.add(l)}}}return t}async function ns(e,t,i,o,a){if(!Xt)Dt(le),Xt=!0;let c=await yf(e,t,i,o,a);c=await Jn(c,t,i,o,a),c=await Yn(c,t,i,o,a);let l=[];for(let m=0;m<3;m++){let u=l.length,y=pe(c,Oe,(b,C)=>`\x00STX_COMPONENT_COMMENT_${u+C}\x00`,`STX_COMPONENT_COMMENT:${u}`);l.push(...y.tokens);let v=c;if(c=await Qn(y.output,t,i,o,a),c===v)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(m,u)=>l[Number(u)]??"");if(o.debug){let m=Kn(c);if(m.length>0)console.warn(`[stx] ${i}: unresolved component tag(s) after render passes: ${m.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
- export{_o,Co,Eo,nh,ts,rh,qa,yf,ns};
41
+ `||O==="\t"){let E=Un(e,L+S.length);if(e[E-1]!=="/")P++;k=E+1}else k=L+S.length}else{if(P--,P===0){N=q;break}k=q+A.length}}if(N===-1){a=x;continue}let U=e.slice(x,N),M=N+A.length;o.push({fullMatch:e.slice(l,M),tagName:y,attributes:w,content:U,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function at(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ut(e,t){try{let i=Buffer.from(e,"base64").toString("utf8");return JSON.parse(i)}catch{}try{let i=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(i)}catch(i){if(t?.debug)console.error("Error decoding __stx_ prop:",i);return e}}function ct(e,t){let i=0,o="",a=t;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")i++;else if(c==="}"){if(i--,i===0)return e.slice(t,a+1)}a++}return e.slice(t)}function Ft(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var Fn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Wn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Hn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],i=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,o;while((o=i.exec(e))!==null){let a=o[2]||"",c=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(a);if(!c)continue;let l=J(c[1]??c[2]??c[3]??""),m=o.index,u=m+o[0].length,y=o[1].toLowerCase();if(o[0].endsWith("/>")||Wn.has(y)){t.push({start:m,end:u,names:l});continue}let v=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=new RegExp(`<\\/?${v}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");b.lastIndex=u;let C=1,x=u,h;while((h=b.exec(e))!==null)if(h[0].startsWith("</")){if(C--,C===0){x=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))C++;t.push({start:m,end:x,names:l})}return t}function Wt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Wt(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function Xa(e,t){if(!/:[\w-]+=/.test(e))return e;let i=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Hn(e));let l=new Set([...tt(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function m(C){return a.some(([x,h])=>C>=x&&C<h)}let u=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,y=[],v=new Map,b=256;while((c=u.exec(i))!==null){if(m(c.index))continue;let C=c[0],x=c[2];if(!x||!x.includes(":"))continue;let h=/(?:^|\s)data-native(?:\s|=|$)/i.test(x.replace(/"[^"]*"|'[^']*'/g,"")),w=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,A=x,P=!1;while((S=w.exec(x))!==null){if($s(x,S.index,!0)?.kind==="attribute")continue;let k=S[1],N=S[2];if(el(k))continue;if(I(N,l))continue;if(N.includes("()")&&!N.includes(".get(")||N.includes("$store")||N.includes("$ref"))continue;try{let U=Object.keys(t),M=Object.values(t),L=N.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!U.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let q=JSON.stringify([U,N]),O=v.get(q);if(!O){if(O=Function(...U,`return (${N})`),v.size>=b)v.clear();v.set(q,O)}let E=O(...M);if(k==="class"){let B=V(Wt(E));if(B){let T=A.match(/\sclass="([^"]*)"/);if(T)A=A.replace(T[0],()=>` class="${T[1]} ${B}"`);else A=A.replace(S[0],()=>` class="${B}"`)}else A=A.replace(S[0],"");P=!0;continue}if(Fn.has(k)){if(E)A=A.replace(S[0],` ${k}`);else A=A.replace(S[0],"");P=!0;continue}if(E===null||E===void 0||E===!1)A=A.replace(S[0],"");else{let B=h&&typeof E==="object"?JSON.stringify(E):String(E),T=bn(k,B);A=A.replace(S[0],()=>` ${k}="${T}"`)}P=!0}catch(U){if(U instanceof ie)throw U;continue}}if(P){let k=c[3]?" /":"",U=`<${c[1]}${A}${k}>`;y.push({start:c.index,end:c.index+C.length,replacement:U})}}if(y.length>0){let C=Array(y.length*2+1),x=0;for(let h=0;h<y.length;h++){let{start:w,end:S,replacement:A}=y[h];C[h*2]=i.slice(x,w),C[h*2+1]=A,x=S}C[y.length*2]=i.slice(x),i=C.join("")}return i}import Ht from"fs";import qt from"path";var Xt=!1;function qn(e,t,i,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),m=(b)=>{if(l.size===0)return!1;let C=s(b),x=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&l.has(x))return!0;for(let h of l){let w=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${w}\\s*\\(`).test(C))return!0}return!1},u=new Set(tl),y=(b)=>{if(!b.includes("-")||b.startsWith("@")||b.startsWith(":")||b.startsWith("x-")||b.startsWith("__"))return b;if(b.startsWith("aria-")||b.startsWith("data-"))return b;return b.replace(/-([a-z0-9])/g,(C,x)=>x.toUpperCase())},v=(b,C)=>{let x=y(b);if(c.static[x]=C,x!==b)c.staticNames[x]=b};for(let[b,C]of Object.entries(e)){let x=b.startsWith("x-")&&!u.has(b)&&!b.startsWith("x-bind:")&&!b.startsWith("x-on:")?`:${b.slice(2)}`:b;if(x.startsWith("@")){c.events[x]=C;continue}if(x.startsWith("__stx_")){let h=y(x.slice(6));c.serverDynamic[h]=Ut(C,i);continue}if(x.startsWith(":")){let h=y(x.slice(1)),w=C===re?h:C;if(h==="if"||h==="for"||h==="show"){c.clientReactive[h]=w;continue}if(o){c.clientReactive[h]=w;continue}if(I(w,a)){c.clientReactive[h]=w;continue}if(m(w)){c.clientReactive[h]=w;continue}try{if(!f(w)){if(i.debug)console.error(`Unsafe expression in :${h} binding: ${w}`);c.clientReactive[h]=w;continue}let S=Object.keys(t),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),P=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(nt(w).some((M)=>!A.has(M)&&!S.includes(M)&&(!(M in globalThis)||P.has(M)))){c.clientReactive[h]=w;continue}let U=d(w,S)(...Object.values(t));if(c.serverDynamic[h]=U,h!==x.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[h]=x.slice(1)}catch{c.clientReactive[h]=w}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let h=Xn(C,a);if(h!==null){c.clientReactive[y(x)]=h;continue}let w=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(w)try{let S=w[1];if(f(S)){let P=d(S,Object.keys(t))(...Object.values(t));v(x,P!=null?String(P):"")}else{if(i.debug)console.error(`Unsafe expression in ${x}: ${S}`);v(x,C)}}catch(S){if(i.debug)console.error(`Error evaluating expression for ${x}:`,S);v(x,C)}else{let S=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,P;while((P=A.exec(C))!==null)try{let k=P[1];if(!f(k)){if(i.debug)console.error(`Unsafe expression in ${x}: ${k}`);continue}let U=d(k,Object.keys(t))(...Object.values(t));S=S.replace(P[0],String(U??""))}catch(k){if(i.debug)console.error(`Error evaluating expression in ${x}:`,k)}v(x,S)}continue}v(x,C===re?"true":at(C))}return c}function Xn(e,t){if(t.size===0)return null;let i=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(i)];if(!o.some((m)=>I(m[1],t)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let m of o)c+=e.slice(l,m.index).replace(/[`\\$]/g,(u)=>`\\${u}`),c+=`\${${m[1]}}`,l=m.index+m[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(m)=>`\\${m}`),`\`${c}\``}var Zn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Vn(e,t,i){if(!e.includes("@"))return e;if(!Zn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return se(e,t,i)}catch{return e}}function ge(e){let t={},i=0,o=e.length;while(i<o){while(i<o&&/\s/.test(e[i]))i++;if(i>=o)break;let a="";while(i<o&&!/[\s=]/.test(e[i]))a+=e[i],i++;if(!a)break;while(i<o&&/\s/.test(e[i]))i++;if(i<o&&e[i]==="="){i++;while(i<o&&/\s/.test(e[i]))i++;let c="";if(i<o&&(e[i]==='"'||e[i]==="'")){let l=e[i];i++;while(i<o){let m=e[i];if(m==="\\"&&i+1<o){i++,c+=e[i],i++;continue}if(m===l){i++;break}c+=m,i++}}else if(e[i]==="{"){c=ct(e,i),i+=c.length;let l=Ft(c);if(l!==null){t[`:${a}`]=l;continue}}else while(i<o&&!/\s/.test(e[i]))c+=e[i],i++;t[a]=c}else t[a]=re}return t}function Zt(e){return Object.entries(e).map(([t,i])=>i===re?t:`${t}="${Gn(i)}"`).join(" ")}function Gn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kn(e){let t=new Set,i=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=i.exec(e))!==null){let a=o[1];if(le.isBuiltin(a))t.add(a)}return[...t].sort()}async function xf(e,t,i,o,a){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,l=qt.dirname(i),m=[],u=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let b of e.matchAll(u)){let[C,x,h]=b,w=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=h,A,P=[];while((A=w.exec(h))!==null){let[k,N,U,M]=A,L=null,q=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))q=B;else{let T=`${B}.stx`;try{if(Ht.statSync(T).isFile())q=T}catch{try{if(Ht.statSync(B).isDirectory())L=B}catch{}}}}else L=Cs(M,l);if(!L&&!q)continue;let O=!1,E=(B,T)=>{c.set(B,T),c.set(B.toLowerCase(),T);let z=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(z,T),a.add(T)};if(U&&q)E(U,q),O=!0;else if(N){let B=N.slice(1,-1).split(",").map((z)=>z.trim()).filter(Boolean).map((z)=>{let G=z.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(G)return{source:G[1],local:G[2]};return{source:z,local:z}}),T=L?_s(L):null;for(let{source:z,local:G}of B){let j=null;if(q)j=q;else if(T)j=T.get(z)??T.get(z.toLowerCase())??T.get(z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)E(G,j),O=!0}}if(O)P.push({start:A.index,end:A.index+k.length})}if(P.length===0)continue;for(let k=P.length-1;k>=0;k--)S=S.slice(0,P[k].start)+S.slice(P[k].end);m.push({start:b.index,end:b.index+C.length,value:`<script${x}>${S}</script>`})}if(m.length===0)return e;let y=[],v=0;for(let b of m)y.push(e.slice(v,b.start),b.value),v=b.end;return y.push(e.slice(v)),y.join("")}async function Jn(e,t,i,o,a){let c=e;if(!t.__importedComponents)t.__importedComponents=new Map;let l=t.__importedComponents,m=/@import\s*\(\s*([^)]+)\s*\)/g,u;while((u=m.exec(c))!==null){let[y,v]=u,b=v.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of b){let x=C.split("/"),w=x[x.length-1].replace(/\.stx$/,""),S=w.includes("-")?w.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):w.charAt(0).toUpperCase()+w.slice(1),A=null,P=Es(C,i,o);for(let k of P)try{if(await Bun.file(k).exists()){A=k;break}}catch{}if(A){l.set(S,A),l.set(w,A),l.set(w.toLowerCase(),A);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,A),a.add(A),o.debug)console.log(`Imported component: ${S} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(y,""),m.lastIndex=0}return c}async function Yn(e,t,i,o,a){let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=/@component\s*\(/g,y;while((y=u.exec(c))!==null){let v=y.index,b=v+y[0].length-1,C=1,x=b+1;while(x<c.length&&C>0){if(c[x]==="(")C++;else if(c[x]===")"){if(C--,C===0)break}x++}if(C!==0)break;let h=c.substring(b+1,x),w=x+1,S=h.match(/^\s*['"]([^'"]+)['"]/);if(!S){u.lastIndex=0;continue}let A=S[1],P,k=h.slice(S[0].length),N=k.match(/^\s*,\s*/);if(N)P=k.slice(N[0].length).trim();let U={};if(P)try{U=R(P,t)}catch(B){let T=B instanceof Error?B.message:String(B);c=c.replace(c.substring(v,w),`[Error parsing component props: ${T}]`);continue}let M="",L=w,O=c.substring(w).match(/^([\s\S]*?)@endcomponent/);if(O)M=O[1].trim(),L=w+O[0].length;let E=await Be(A,U,M,l,t,i,o,m,a);c=c.substring(0,v)+E+c.substring(L),u.lastIndex=0}return c}async function Qn(e,t,i,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=nr(c);if(u.size>0){let w=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...w,...u])]}let y=X(c);c=y.output;let v=tt(t);return c=await h(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await h(c,/[A-Z][a-zA-Z0-9]*/,!0,Lt(br)),c=await h(c,/[a-z][a-z0-9]*/,!1,br),c=y.restore(c),c;async function h(w,S,A,P){if(!w)return w;let k=w,N=zt(k,S,P),U=lt(k),M=new Map;for(let O=N.length-1;O>=0;O--){let E=N[O],B=A?H(E.tagName):E.tagName,T=ge(Vn(E.attributes,t,i)),z=U.filter(({start:Z,end:_})=>E.startIndex>=Z&&E.startIndex<_),G=z.length>0,j=new Set(v);for(let Z of z)for(let _ of Z.names)j.add(_);let F=qn(T,t,o,G,j);if(typeof F.clientReactive.for==="string")for(let Z of J(F.clientReactive.for))j.add(Z);let ce=le.getBuiltin(E.tagName),we=ce?await xr(E.tagName,l,t,i,o):!1;if(ce&&!we){let Z={context:t,filePath:i,options:o,dependencies:a},_=ce.render(F,E.content,Z);if(Object.keys(F.events).length>0){let W=Zt(F.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${W}`)}if(Object.keys(F.clientReactive).length>0)_=Vt(_,F.clientReactive);M.set(O,_);continue}if(!A&&E.tagName.includes("-")&&!await xr(B,l,t,i,o))continue;let Y={};for(let[Z,_]of Object.entries(F.static))Y[Z]=_;for(let[Z,_]of Object.entries(F.serverDynamic))Y[Z]=_;let ne={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(F.clientReactive),events:Object.keys(F.events)},D=await Be(B,Y,y.restore(E.content),l,t,i,o,m,a,[...j],ne,E.tagName);if(D=er(D,F,ne.declaredProps,ne.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let Z=ne.reactiveProps.filter((te)=>!ne.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(H),_=ut(D,!0);if(Z.length&&_){if(!Object.hasOwn(ge(D.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))D=D.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+D.slice(_.insertPos);let te=ve(D);D=D.slice(0,te.insertPos)+` data-stx-native-forward="${Z.join(" ")}"`+D.slice(te.insertPos)}let W=ut(D,!0);if(W){let te=ge(D.slice(W.insertPos,W.tagEnd)),Se=ve(D),Kt=ge(D.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))D=D.slice(0,Se.insertPos)+" data-stx-native-host-owner"+D.slice(Se.insertPos)}}if(Object.keys(F.events).length>0){let Z=ve(D);if(Z){let _=Zt(F.events),W=Object.keys(F.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,Z.insertPos)+` data-stx-parent-events="${W}" ${_}`+D.substring(Z.insertPos)}}if(Object.keys(F.clientReactive).length>0)D=Vt(D,F.clientReactive);M.set(O,D)}if(M.size===0)return k;let L="",q=0;for(let O=0;O<N.length;O++){let E=M.get(O);if(E===void 0)continue;L+=k.slice(q,N[O].startIndex),L+=E,q=N[O].endIndex}return L+=k.slice(q),L}}function Vt(e,t){let i=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(t).filter(([v])=>!i.has(v)),c=a.filter(([v])=>!o.has(v)).map(([v])=>H(v)).join(" "),l=e,m=a.length>0?ve(l):null;if(m){let v=a.map(([C,x])=>`:${H(C)}="${x.replace(/"/g,"&quot;")}"`).join(" "),b=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,m.insertPos)+`${b} ${v}`+l.substring(m.insertPos)}let u=t.if;if(u)l=`<template :if="${u.replace(/"/g,"&quot;")}">${l}</template>`;let y=t.for;if(y){let v=t.key,b=v?` :key="${v.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${y.replace(/"/g,"&quot;")}"${b}>${l}</template>`}return l}function er(e,t,i=new Set,o=new Set,a=!1){let c=ut(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),m=t.serverDynamic.class??t.static.class;if(a&&typeof m==="string"&&m&&!o.has("class")){let h=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,w=h.test(l)?l.replace(h,(S,A,P,k,N)=>`${A}class="${n(`${at(P??k??N)} ${m}`)}"`):` class="${n(m)}"${l}`;e=e.slice(0,c.insertPos)+w+e.slice(c.tagEnd),c.tagEnd+=w.length-l.length,l=w}let u=a||/\bdata-native(?:\s|=)/i.test(l),y=u?o:i,v=new Set(Object.keys(ge(l))),b=new Set(["class","className"]);for(let h of Object.keys(t.static)){let w=t.staticNames[h]??h;if(v.has(w)||y.has(h)||!u&&!We(w))b.add(h)}for(let h of Object.keys(t.serverDynamic)){let w=t.serverDynamicNames?.[h]??h;if(v.has(w)||y.has(h)||!u&&!We(w))b.add(h)}let C=[];if(u){for(let[h,w]of Object.entries(t.static)){if(b.has(h)||w!==!0&&w!==re)continue;b.add(h),C.push(`${n(t.staticNames?.[h]??h)}="true"`)}for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w!==!0)continue;b.add(h),C.push(`${n(t.serverDynamicNames?.[h]??h)}="true"`)}}let x=[...oe(t,b),...ae(t,b),...C];if(u){for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w!==!1)continue;let S=t.serverDynamicNames?.[h]??h;x.push(`${n(S)}="false"`)}for(let[h,w]of Object.entries(t.serverDynamic)){if(b.has(h)||w===null||typeof w!=="object")continue;let S=JSON.stringify(w);if(S!==void 0){let A=t.serverDynamicNames?.[h]??h;x.push(`${n(A)}="${n(S)}"`)}}}if(x.length===0)return e;return`${e.slice(0,c.insertPos)} ${x.join(" ")}${e.slice(c.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(i)return{insertPos:i.index+1+i[1].length,tagEnd:ft(e,i.index+1+i[1].length)};return null}function ut(e,t=!1){let i=ve(e);if(!i)return null;let o=e.slice(i.insertPos,i.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,i.tagEnd+1):i;return a&&t?tr(e,a)??a:a}function tr(e,t){if(!e.includes("data-stx-native-host-root"))return null;let i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",t.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let v=e.indexOf("-->",o+4);if(v<0)return null;o=e.indexOf("<",v+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let m=l[2].toLowerCase(),u=o+l[0].length,y=ft(e,u);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(m==="script"||m==="style"){let v=new RegExp(`</${m}\\s*>`,"gi");if(v.lastIndex=y+1,!v.exec(e))return null;o=e.indexOf("<",v.lastIndex);continue}else{let v=ge(e.slice(u,y)),b=a>0&&(Object.hasOwn(v,"data-stx-component-wrapper")||Object.hasOwn(v,"data-stx-native-host-owner"));if(c===void 0&&!b&&Object.hasOwn(v,"data-stx-native-host-root"))return{insertPos:u,tagEnd:y};if(!i.has(m)&&e[y-1]!=="/"){if(a++,c===void 0&&b)c=a}else if(a===0)return null}o=e.indexOf("<",y+1)}return null}function Gt(e,t){let i=t;while(i<e.length){let o=e.slice(i),a=o.match(/^\s+/);if(a){i+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",i+4);if(m===-1)return null;i=m+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let m=`</${c[1].toLowerCase()}>`,u=e.toLowerCase().indexOf(m,i+c[0].length);if(u===-1)return null;i=u+m.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:i+1+l[1].length,tagEnd:ft(e,i+1+l[1].length)}}return null}function ft(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function nr(e){let t=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=i[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Qo(i[2]))t.add(a);for(let a of i[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])t.add(a[1]);if(a[3])t.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))t.add(l)}}}return t}async function rs(e,t,i,o,a){if(!Xt)Dt(le),Xt=!0;let c=await xf(e,t,i,o,a);c=await Jn(c,t,i,o,a),c=await Yn(c,t,i,o,a);let l=[];for(let m=0;m<3;m++){let u=l.length,y=pe(c,Oe,(b,C)=>`\x00STX_COMPONENT_COMMENT_${u+C}\x00`,`STX_COMPONENT_COMMENT:${u}`);l.push(...y.tokens);let v=c;if(c=await Qn(y.output,t,i,o,a),c===v)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(m,u)=>l[Number(u)]??"");if(o.debug){let m=Kn(c);if(m.length>0)console.warn(`[stx] ${i}: unresolved component tag(s) after render passes: ${m.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
+ export{Eo,To,$o,ih,ns,ah,Xa,xf,rs};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function Yn(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function $e(n,i){return Yn(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
2
+ function t(n){if(!n||typeof n!=="object")return!1;let i=n;return typeof i.message==="string"&&(i.name==="BuildMessage"||i.name==="ResolveMessage"||("position"in i))}function o(n){if(n&&typeof n==="object"&&Array.isArray(n.errors))return n.errors;return[n]}function Zn(n,i){let e=[];for(let r of o(n)){if(t(r)){let s=r.position||void 0;e.push({file:i||s?.file,line:s?.line,column:s?.column,message:r.message??"",lineText:s?.lineText});continue}e.push({file:i,message:r instanceof Error?r.message:String(r)})}return e}function $e(n,i){return Zn(n,i).map((e)=>{let r=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",s=e.lineText?`
3
3
  ${e.lineText.trim()}`:"";return r?`${r}: ${e.message}${s}`:`${e.message}${s}`}).join(`
4
- `)}export{Yn,$e};
4
+ `)}export{Zn,$e};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Tf,Bo}from"./chunk-qeh8f4bk.js";export{Tf as looksLikeGlob,Bo as resolveStxTargets};