@stacksjs/stx 0.2.898 → 0.2.899

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/{chunk-qe0t0m38.js → chunk-0b57fgpn.js} +4 -4
  2. package/dist/chunk-0f2d61b3.js +2 -0
  3. package/dist/{chunk-pjj54ddk.js → chunk-0gc1hez6.js} +3 -3
  4. package/dist/chunk-0ht6exrv.js +2 -0
  5. package/dist/{chunk-t3zmfh8w.js → chunk-150cz8qq.js} +7 -7
  6. package/dist/chunk-1pbghytr.js +2 -0
  7. package/dist/chunk-1tb18a92.js +2 -0
  8. package/dist/{chunk-dvjv4c3a.js → chunk-2sz1kh9m.js} +1 -1
  9. package/dist/chunk-2vqamyay.js +2 -0
  10. package/dist/chunk-36mz0nwv.js +2 -0
  11. package/dist/{chunk-q4dcchrt.js → chunk-3k4rteax.js} +13 -13
  12. package/dist/chunk-3m37fzvh.js +2 -0
  13. package/dist/chunk-3my2eef2.js +2 -0
  14. package/dist/{chunk-qcbj1m21.js → chunk-40fpt0r6.js} +10 -10
  15. package/dist/{chunk-khm56bfm.js → chunk-46khhke2.js} +1 -1
  16. package/dist/{chunk-4wh71ddp.js → chunk-472w7t7p.js} +2 -2
  17. package/dist/{chunk-bjmkyead.js → chunk-4e28p8vf.js} +6 -6
  18. package/dist/{chunk-bgfs3mbg.js → chunk-4hk1mjtv.js} +5 -5
  19. package/dist/chunk-4jtewn1v.js +2 -0
  20. package/dist/chunk-4s6w89m2.js +2 -0
  21. package/dist/{chunk-dd074gp5.js → chunk-4wd5sn16.js} +7 -7
  22. package/dist/{chunk-1bft48gk.js → chunk-50wjk5ap.js} +2 -2
  23. package/dist/{chunk-ch9028z3.js → chunk-54x7h3sb.js} +1 -1
  24. package/dist/chunk-5astk182.js +2 -0
  25. package/dist/{chunk-3b3mkgpj.js → chunk-5g5khx0m.js} +2 -2
  26. package/dist/{chunk-zf68afyh.js → chunk-5gnt3qtn.js} +3 -3
  27. package/dist/{chunk-80ky40mm.js → chunk-5jrpzepc.js} +2 -2
  28. package/dist/{chunk-q0y8gv18.js → chunk-5mrt1enm.js} +2 -2
  29. package/dist/{chunk-wg6fmren.js → chunk-5tm1pvt3.js} +2 -2
  30. package/dist/chunk-5tvse0vw.js +2 -0
  31. package/dist/{chunk-ytjn0gq2.js → chunk-5yvgzh6n.js} +2 -2
  32. package/dist/{chunk-n6q1d66k.js → chunk-65g78sge.js} +1 -1
  33. package/dist/chunk-65rx54n6.js +2 -0
  34. package/dist/{chunk-x5bn2svk.js → chunk-67pq803s.js} +2 -2
  35. package/dist/{chunk-neg6ckjg.js → chunk-68r2zs20.js} +4 -4
  36. package/dist/{chunk-2s0q8mjx.js → chunk-6hjcqaqr.js} +2 -2
  37. package/dist/chunk-70ez3njv.js +2 -0
  38. package/dist/chunk-726w7fm2.js +2 -0
  39. package/dist/{chunk-xy8smv5e.js → chunk-73ebyhqq.js} +2 -2
  40. package/dist/chunk-73nazfe5.js +2 -0
  41. package/dist/{chunk-vk2jy6mn.js → chunk-7b3dqeyr.js} +2 -2
  42. package/dist/{chunk-whcrca58.js → chunk-7nn5s0c3.js} +30 -30
  43. package/dist/{chunk-062qfv99.js → chunk-7pfhr4nk.js} +2 -2
  44. package/dist/chunk-7r294vc9.js +2 -0
  45. package/dist/chunk-7rn7w53f.js +2 -0
  46. package/dist/{chunk-5v4e2a02.js → chunk-7z1hqp86.js} +4 -4
  47. package/dist/chunk-81qvg3yd.js +2 -0
  48. package/dist/{chunk-e16ef18k.js → chunk-83hs9905.js} +2 -2
  49. package/dist/chunk-8a9gmbxa.js +2 -0
  50. package/dist/chunk-8jvwapq3.js +2 -0
  51. package/dist/{chunk-g8p4sjy4.js → chunk-8rgy17fj.js} +8 -8
  52. package/dist/{chunk-ns2d6pb9.js → chunk-8v2hsn4d.js} +3 -3
  53. package/dist/{chunk-y1d3j2j7.js → chunk-8xb09hnn.js} +4 -4
  54. package/dist/{chunk-xmg6bmh6.js → chunk-945zygwa.js} +13 -13
  55. package/dist/{chunk-pvm48tse.js → chunk-9ejk9mwk.js} +2 -2
  56. package/dist/{chunk-bw2m1e7g.js → chunk-9hwg13ec.js} +5 -5
  57. package/dist/{chunk-ezpk14gs.js → chunk-9jpsxqaf.js} +1 -1
  58. package/dist/{chunk-0vrt55pp.js → chunk-9m45t60c.js} +80 -80
  59. package/dist/{chunk-jm9rbxj4.js → chunk-9n5san33.js} +14 -14
  60. package/dist/chunk-9vafweyd.js +3 -0
  61. package/dist/{chunk-zwqkbk2m.js → chunk-9w7whtbx.js} +2 -2
  62. package/dist/{chunk-1ph2yhfn.js → chunk-arfpzf17.js} +2 -2
  63. package/dist/chunk-avqxkbrd.js +2 -0
  64. package/dist/{chunk-htx5yezj.js → chunk-ayady5ws.js} +2 -2
  65. package/dist/{chunk-051r7ebx.js → chunk-b6ctdvdf.js} +6 -6
  66. package/dist/{chunk-taeqm3nc.js → chunk-becs8132.js} +5 -5
  67. package/dist/chunk-bmwcgmev.js +2 -0
  68. package/dist/{chunk-67j2m620.js → chunk-bzd387yx.js} +4 -4
  69. package/dist/{chunk-mhrnjaka.js → chunk-c0x9wyj7.js} +4 -4
  70. package/dist/chunk-cgqpn3e2.js +2 -0
  71. package/dist/chunk-cp82351f.js +2 -0
  72. package/dist/chunk-cvxg2rc1.js +2 -0
  73. package/dist/{chunk-v8ewgs1y.js → chunk-d1bwb2kz.js} +3 -3
  74. package/dist/{chunk-05x1rd86.js → chunk-de61k0ab.js} +2 -2
  75. package/dist/chunk-dj8fyaea.js +2 -0
  76. package/dist/chunk-dmc91qke.js +2 -0
  77. package/dist/{chunk-mr34w48c.js → chunk-e0bwzxfd.js} +6 -6
  78. package/dist/{chunk-w2qct5kq.js → chunk-e4xd1ca7.js} +1 -1
  79. package/dist/{chunk-3jxmnnef.js → chunk-e5q1ammf.js} +3 -3
  80. package/dist/{chunk-xvncq3m5.js → chunk-eb5cma4b.js} +2 -2
  81. package/dist/{chunk-3bsz7zj3.js → chunk-eb5v9npc.js} +2 -2
  82. package/dist/{chunk-aj5tsksz.js → chunk-edpsk4bg.js} +5 -5
  83. package/dist/{chunk-6kn2vwtn.js → chunk-eka2e4cm.js} +4 -4
  84. package/dist/{chunk-pnmafbv5.js → chunk-ern5hyvr.js} +1 -1
  85. package/dist/{chunk-41z7f41b.js → chunk-esm0pnpz.js} +2 -2
  86. package/dist/chunk-fe1wmmr5.js +2 -0
  87. package/dist/{chunk-r5ecgcx2.js → chunk-ffytbb4x.js} +5 -5
  88. package/dist/{chunk-vf4ejngv.js → chunk-fksmr50h.js} +6 -6
  89. package/dist/{chunk-nw2zjwcg.js → chunk-fsxk5fsh.js} +8 -8
  90. package/dist/{chunk-htvft92j.js → chunk-ft9h5qbs.js} +4 -4
  91. package/dist/chunk-fznzn35q.js +2 -0
  92. package/dist/{chunk-s94gqce0.js → chunk-g065d7p7.js} +2 -2
  93. package/dist/{chunk-rf0smj4c.js → chunk-g32hc78c.js} +2 -2
  94. package/dist/{chunk-nq60tjkz.js → chunk-gnf1e5q7.js} +2 -2
  95. package/dist/{chunk-bj8pv8m9.js → chunk-gq3gttt5.js} +21 -21
  96. package/dist/chunk-h2gnz7ja.js +2 -0
  97. package/dist/chunk-hc8ks7y3.js +2 -0
  98. package/dist/{chunk-cphc60zw.js → chunk-hdfhaddy.js} +2 -2
  99. package/dist/{chunk-t0ttxayz.js → chunk-hnjeqxqy.js} +2 -2
  100. package/dist/chunk-hpqvq1r9.js +2 -0
  101. package/dist/chunk-hs2a040z.js +2 -0
  102. package/dist/{chunk-xdrp6d7e.js → chunk-javb4e3b.js} +5 -5
  103. package/dist/chunk-jq49238b.js +2 -0
  104. package/dist/chunk-jr3fmkq7.js +2 -0
  105. package/dist/chunk-k2fw6paw.js +2 -0
  106. package/dist/chunk-k352spys.js +2 -0
  107. package/dist/{chunk-1knk403z.js → chunk-k3566kgd.js} +2 -2
  108. package/dist/{chunk-cmg9x1ka.js → chunk-k3ytyhkr.js} +3 -3
  109. package/dist/chunk-k79dvx67.js +2 -0
  110. package/dist/chunk-km1k3c4e.js +2 -0
  111. package/dist/chunk-kvjbpbmw.js +2 -0
  112. package/dist/chunk-mhv84p0x.js +2 -0
  113. package/dist/{chunk-ykax1thr.js → chunk-mjqsz20a.js} +2 -2
  114. package/dist/chunk-mmtyp5z4.js +2 -0
  115. package/dist/{chunk-8hwfdwgn.js → chunk-mry67rsk.js} +6 -6
  116. package/dist/{chunk-ksmn19qw.js → chunk-n3fgrsva.js} +2 -2
  117. package/dist/{chunk-jnwj14eq.js → chunk-n8xjqsze.js} +3 -3
  118. package/dist/{chunk-p3hbsrk9.js → chunk-nc5d3a5r.js} +5 -5
  119. package/dist/chunk-p4hm5srd.js +2 -0
  120. package/dist/{chunk-0jkj8thz.js → chunk-p89rpak1.js} +1 -1
  121. package/dist/{chunk-hxws025y.js → chunk-p92272k0.js} +2 -2
  122. package/dist/{chunk-bh2j50cy.js → chunk-pd31ge72.js} +6 -6
  123. package/dist/chunk-pjpy86c3.js +3 -0
  124. package/dist/chunk-psyqrxg0.js +2 -0
  125. package/dist/chunk-q4yq72wh.js +2 -0
  126. package/dist/{chunk-5xq6eky7.js → chunk-q6p96qq7.js} +7 -7
  127. package/dist/{chunk-115bb91s.js → chunk-qs0zk04y.js} +2 -2
  128. package/dist/{chunk-ta07gj66.js → chunk-qt2mr3f0.js} +31 -16
  129. package/dist/{chunk-a0aqs5a8.js → chunk-qykbjg3z.js} +2 -2
  130. package/dist/chunk-qzx6h6af.js +2 -0
  131. package/dist/{chunk-g5nfqzfh.js → chunk-r0az4z6d.js} +2 -2
  132. package/dist/{chunk-b9npgke0.js → chunk-r9n86na1.js} +39 -39
  133. package/dist/{chunk-zy97etqx.js → chunk-rapr0m13.js} +3 -3
  134. package/dist/{chunk-j1cgj6z2.js → chunk-rrpfn9rr.js} +1 -1
  135. package/dist/chunk-ryp47rwp.js +2 -0
  136. package/dist/{chunk-3qk8vf9m.js → chunk-t14bn66j.js} +3 -3
  137. package/dist/chunk-t9j000tb.js +2 -0
  138. package/dist/{chunk-7h52e87j.js → chunk-tga3nrn6.js} +5 -5
  139. package/dist/chunk-tgwwa872.js +2 -0
  140. package/dist/chunk-v0r6zb87.js +2 -0
  141. package/dist/{chunk-n0jfwsz1.js → chunk-v5v6w6rn.js} +2 -2
  142. package/dist/{chunk-9rjgq8k4.js → chunk-vbmvft7g.js} +1 -1
  143. package/dist/{chunk-kk2p2tgv.js → chunk-vfctk20v.js} +3 -3
  144. package/dist/{chunk-66qfr6b0.js → chunk-vgvxs1ag.js} +2 -2
  145. package/dist/{chunk-rb2zbdqd.js → chunk-vw7crz0z.js} +4 -4
  146. package/dist/chunk-vxtna1b1.js +2 -0
  147. package/dist/chunk-x43x2c6v.js +2 -0
  148. package/dist/chunk-xqx8t9w5.js +2 -0
  149. package/dist/{chunk-sh7a0g09.js → chunk-xr1s56k5.js} +3 -3
  150. package/dist/chunk-y10eaxgc.js +2 -0
  151. package/dist/chunk-ytk4f2j9.js +2 -0
  152. package/dist/chunk-z33r3pzy.js +2 -0
  153. package/dist/chunk-zcys6b06.js +2 -0
  154. package/dist/chunk-zkr42285.js +2 -0
  155. package/dist/chunk-zpwh9bpc.js +2 -0
  156. package/dist/chunk-zrs22j09.js +2 -0
  157. package/dist/chunk-zw6tgr0s.js +2 -0
  158. package/dist/cli.js +19 -19
  159. package/dist/client/signals-scope-disposal-runtime.js +18 -3
  160. package/dist/craft-entry.js +2 -2
  161. package/dist/craft.js +2 -2
  162. package/dist/dynamic-components.js +47 -25
  163. package/dist/pwa.js +3 -3
  164. package/dist/ssg.js +4 -4
  165. package/package.json +5 -5
  166. package/dist/chunk-0hgetg3j.js +0 -2
  167. package/dist/chunk-0k437z3q.js +0 -2
  168. package/dist/chunk-0yh33smh.js +0 -2
  169. package/dist/chunk-0yycygry.js +0 -2
  170. package/dist/chunk-1a7a8cjs.js +0 -2
  171. package/dist/chunk-1p4q6t48.js +0 -2
  172. package/dist/chunk-1z6pqvmf.js +0 -2
  173. package/dist/chunk-2nqmw4dv.js +0 -2
  174. package/dist/chunk-2shw0j2q.js +0 -2
  175. package/dist/chunk-35j7gaj5.js +0 -2
  176. package/dist/chunk-3hd73qqj.js +0 -2
  177. package/dist/chunk-4akw3bym.js +0 -2
  178. package/dist/chunk-4d85str1.js +0 -2
  179. package/dist/chunk-53kcqdjj.js +0 -2
  180. package/dist/chunk-5eq2e6p3.js +0 -2
  181. package/dist/chunk-690518hw.js +0 -2
  182. package/dist/chunk-732gb689.js +0 -2
  183. package/dist/chunk-80xzjxah.js +0 -2
  184. package/dist/chunk-8cs8jckk.js +0 -2
  185. package/dist/chunk-9afkttvz.js +0 -2
  186. package/dist/chunk-a0jhmkpd.js +0 -2
  187. package/dist/chunk-a1s0tfcd.js +0 -3
  188. package/dist/chunk-a2bstyq1.js +0 -2
  189. package/dist/chunk-ah8az9vv.js +0 -2
  190. package/dist/chunk-arr79m90.js +0 -2
  191. package/dist/chunk-cgxmgjk4.js +0 -2
  192. package/dist/chunk-cp5x6kx1.js +0 -2
  193. package/dist/chunk-e28czxw3.js +0 -2
  194. package/dist/chunk-e8szp5wa.js +0 -2
  195. package/dist/chunk-essd43ad.js +0 -2
  196. package/dist/chunk-f60k8j9m.js +0 -2
  197. package/dist/chunk-fsehzmg8.js +0 -2
  198. package/dist/chunk-fsk3rk2x.js +0 -2
  199. package/dist/chunk-g0p2n9tm.js +0 -2
  200. package/dist/chunk-g5axctr0.js +0 -2
  201. package/dist/chunk-ggnhr4r3.js +0 -2
  202. package/dist/chunk-hk241gt2.js +0 -2
  203. package/dist/chunk-hmpmvf5c.js +0 -2
  204. package/dist/chunk-j1ncsbk2.js +0 -2
  205. package/dist/chunk-j9kejcrx.js +0 -2
  206. package/dist/chunk-jhbz5w30.js +0 -2
  207. package/dist/chunk-jvc2qb1n.js +0 -2
  208. package/dist/chunk-jytqf6p6.js +0 -2
  209. package/dist/chunk-k4x680e3.js +0 -2
  210. package/dist/chunk-kfdmm240.js +0 -2
  211. package/dist/chunk-mx5twaps.js +0 -2
  212. package/dist/chunk-nd2bhjdw.js +0 -2
  213. package/dist/chunk-qfxy34d4.js +0 -2
  214. package/dist/chunk-qwt94yh2.js +0 -2
  215. package/dist/chunk-rarsjcs4.js +0 -2
  216. package/dist/chunk-rryzw9x7.js +0 -2
  217. package/dist/chunk-ryj1srqn.js +0 -2
  218. package/dist/chunk-s5j4fpdr.js +0 -2
  219. package/dist/chunk-snkbn5y8.js +0 -2
  220. package/dist/chunk-tbh7r1wh.js +0 -2
  221. package/dist/chunk-tsz03zc9.js +0 -2
  222. package/dist/chunk-v3jyb8k6.js +0 -2
  223. package/dist/chunk-wbp6jgcr.js +0 -2
  224. package/dist/chunk-x6565mhk.js +0 -2
  225. package/dist/chunk-x8yne6s5.js +0 -2
  226. package/dist/chunk-xwgdcc7w.js +0 -2
  227. package/dist/chunk-z4tdnfxd.js +0 -2
  228. package/dist/chunk-zrbyvyn2.js +0 -2
  229. package/dist/chunk-zxjdfgdx.js +0 -3
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import i from"os";import{join as s}from"path";function vr(t,r=process.cwd()){try{let n=typeof Bun<"u"?Bun.resolveSync(t,r):void 0;return n&&o(n)?n:void 0}catch{return}}function o(t,r=process.env){let n=t.replace(/\\/g,"/");if(n.split("/").some((e)=>/@\d[^/]*@@@\d+$/.test(e)))return!1;return![r.BUN_INSTALL_CACHE_DIR,s(r.BUN_INSTALL||s(i.homedir(),".bun"),"install","cache")].filter((e)=>!!e).map((e)=>`${e.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((e)=>n.startsWith(e))}
3
- export{vr};
2
+ import i from"os";import{join as s}from"path";function xr(t,r=process.cwd()){try{let n=typeof Bun<"u"?Bun.resolveSync(t,r):void 0;return n&&o(n)?n:void 0}catch{return}}function o(t,r=process.env){let n=t.replace(/\\/g,"/");if(n.split("/").some((e)=>/@\d[^/]*@@@\d+$/.test(e)))return!1;return![r.BUN_INSTALL_CACHE_DIR,s(r.BUN_INSTALL||s(i.homedir(),".bun"),"install","cache")].filter((e)=>!!e).map((e)=>`${e.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((e)=>n.startsWith(e))}
3
+ export{xr};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import S from"fs";import _ from"path";function Ao(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function Ea(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function is(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await Ea(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Po(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function Io(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Un(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function an(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function Ta(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
2
+ import S from"fs";import _ from"path";function Po(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function Ta(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function as(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await Ta(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Io(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function Oo(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Wn(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function an(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function $a(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
3
3
  `)+`
4
- `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function as(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function cs(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function Oo(e,t){let i=await as(e),s=t||cs(i),n=Ta(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function No(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Em(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Et(`No Netlify auth token found.
4
+ `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function cs(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function ls(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function No(e,t){let i=await cs(e),s=t||ls(i),n=$a(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Mo(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Tm(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Et(`No Netlify auth token found.
5
5
 
6
6
  To deploy to Netlify:
7
7
  1. Create account at https://app.netlify.com
@@ -19,12 +19,12 @@ Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,
19
19
 
20
20
  Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new Et(`Build directory is empty: ${l}
21
21
 
22
- Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await is(l),w=an(c);return n(`Would deploy ${c.length} files (${Un(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=Ao({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Et(`Site not found: ${f}
22
+ Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await as(l),w=an(c);return n(`Would deploy ${c.length} files (${Wn(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=Po({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Et(`Site not found: ${f}
23
23
 
24
- Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await is(l),g=an(a);if(n(`Found ${a.length} files (${Un(g)})`),a.length===0)throw new Et(`No files found in ${l}`,"NO_FILES");let b=Po(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=Io(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=an(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${Un(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:an(h)}}async function Tm(e={}){let t=e.directory||process.cwd(),i;if(No(t))i=_.join(t,"netlify.toml");else{let s=await as(t);i=await Oo(t,cs(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
24
+ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await as(l),g=an(a);if(n(`Found ${a.length} files (${Wn(g)})`),a.length===0)throw new Et(`No files found in ${l}`,"NO_FILES");let b=Io(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=Oo(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=an(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${Wn(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:an(h)}}async function $m(e={}){let t=e.directory||process.cwd(),i;if(Mo(t))i=_.join(t,"netlify.toml");else{let s=await cs(t);i=await No(t,ls(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
25
25
  `).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
26
26
  `),n&&!n.endsWith(`
27
27
  `))n+=`
28
28
  `}n+=`NETLIFY_SITE_ID=${e.siteId}
29
29
  `,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Et extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
30
- export{Ao,Ea,is,Po,Io,Un,an,Ta,as,cs,Oo,No,Em,Tm,Et};
30
+ export{Po,Ta,as,Io,Oo,Wn,an,$a,cs,ls,No,Mo,Tm,$m,Et};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Hl,Vl}from"./chunk-cphc60zw.js";import{J,Ir,Js,Ys,Ti,Ri,Zs,Oe,qe,ke,se,Mr,Dr,he,oe,F,mt,Lr,Oi,Fr,Ye,s,g,Y,On}from"./chunk-0vrt55pp.js";import{m,M,yt,p}from"./chunk-xmg6bmh6.js";import{r}from"./chunk-a1s0tfcd.js";import{ge}from"./chunk-80ky40mm.js";import{vr}from"./chunk-3bsz7zj3.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-neg6ckjg.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import on from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function an(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ie=0,vt=[];async function cn(){if(Ie<an()){Ie++;return}await new Promise((e)=>vt.push(e)),Ie++}function ln(){Ie--,vt.shift()?.()}var un="@stacksjs/stx/builtins/image-warmup-worker";function fn(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&on.existsSync(bt(n)))return bt(n)}catch{}return vr(un,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Pe(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=fn();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await cn();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(y){a(ue(`could not start ${o}: ${Pe(y)}`));return}let u=!1,f=!1,v=(y)=>{if(f)return;f=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Pe(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{ln()}}var dn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),gn=[320,640,960,1280,1920],ve="/_stx/images",pn=`stx:${ve}:alpha-1`,mn=`stx:${ve}:opaque-1`,hn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function yn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=hn.map((i)=>{let n;try{n=e?yn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function bn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function xn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function Pt(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await Pt(e,c));continue}if(!a.isFile()||!dn.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:bn(n.relativePath),input:n.absolutePath,name:xn(n.relativePath),...vn(n.absolutePath)?{options:{storage:i}}:{}}))}function vn(e){return Ue(e)==="possible"}function wn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function $n(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(wn(v.data))n.add(l)}catch{n.add(l)}}));return n}function Sn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function Cn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Rn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function kn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function si(e){let i=It(e);return i?we().catalog.get(i):void 0}function oi(e){let i=It(e);return i?we().transparent.has(i):!1}function ii(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function cy(e){let i=si(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ii(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:oi(e)?void 0:i.placeholder?.dataUrl}}function Ts(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ly(e,i,n={}){if(!e||!K.existsSync(e))return Ts(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return An(d.state),d.result}let o=await Pt(e);if(o.length===0)return Ts(),{count:0,fingerprint:""};let a=Rn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return Ts(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${pn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${mn}:${wt()}`),baseUrl:ve,widths:gn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,y;try{y=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await Cn(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)kn(i,a);if(v.length===0)return Ts(),{count:0,fingerprint:""};y=await f({...u,entries:Rt(v,l)})}let h=await $n(y.entries),C=Sn(y.entries,h),S=we();S.catalog=new Map(Object.entries(y.entries)),S.transparent=h;let b=h.size===0&&C.length===0?y.fingerprint:At("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ti(e,o);if(a!==void 0)return a;for(let c of Ri(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Pn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||Pn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function In(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=In(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Mr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,y)),f.push(...ie(e,y)),`<a ${f.join(" ")}>${i}</a>`}};var _n=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return _n.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Bn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Tn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=si(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),y=H(e,"densities"),h=H(e,"format"),C=oi(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!h,P=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,h),U=Je(f);else if(!T&&y){let Z=y.split(/\s+/).map((I)=>Number.parseFloat(I.replace("x","")));T=Nn(o,Z,P,d,h)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(P&&_)D.push(`aspect-ratio:${P}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let I=Tn(P||16,_||9,b);D.push(`background-image:url(${I})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,P,_,d,h),X=[];if(X.push(`src="${r(Mr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Mr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let xe=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",I=Bn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(I)}"`),xe.add("onload")}X.push(...re(e,xe)),X.push(...ie(e,xe));let le=`<img ${X.join(" ")} />`,Q="";if(z){let I=h==="webp"?"image/webp":h==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${I?` type="${I}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
3
- `}if(q){let Z=[];if(a)for(let I of ii(a))Z.push(`<source type="image/${I.format}" srcset="${r(I.srcset)}"${U?` sizes="${r(U)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let I=$e(o,P,_,d,"avif"),O=T?Qe(o,Ke,d,"avif"):`${I}`;Z.push(`<source type="image/avif" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let I=$e(o,P,_,d,"webp"),O=T?Qe(o,Ke,d,"webp"):`${I}`;Z.push(`<source type="image/webp" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}return`${Q}<picture>
2
+ import{Vl,Ul}from"./chunk-hdfhaddy.js";import{J,Or,Ys,Zs,$i,Ai,Qs,Oe,qe,ke,se,Dr,Lr,he,oe,F,mt,jr,Ni,zr,Ye,s,g,Y,Nn}from"./chunk-9m45t60c.js";import{m,M,yt,p}from"./chunk-945zygwa.js";import{r}from"./chunk-9vafweyd.js";import{ge}from"./chunk-5jrpzepc.js";import{xr}from"./chunk-eb5v9npc.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-68r2zs20.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import sn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function on(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ie=0,vt=[];async function an(){if(Ie<on()){Ie++;return}await new Promise((e)=>vt.push(e)),Ie++}function cn(){Ie--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return xr(ln,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Pe(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(y){a(ue(`could not start ${o}: ${Pe(y)}`));return}let u=!1,f=!1,v=(y)=>{if(f)return;f=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Pe(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function hn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function Pt(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await Pt(e,c));continue}if(!a.isFile()||!fn.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Ue(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function Sn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function oi(e){let i=It(e);return i?we().catalog.get(i):void 0}function ii(e){let i=It(e);return i?we().transparent.has(i):!1}function ai(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ly(e){let i=oi(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ai(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ii(e)?void 0:i.placeholder?.dataUrl}}function $s(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function uy(e,i,n={}){if(!e||!K.existsSync(e))return $s(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return An(d.state),d.result}let o=await Pt(e);if(o.length===0)return $s(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return $s(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,y;try{y=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await Sn(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Rn(i,a);if(v.length===0)return $s(),{count:0,fingerprint:""};y=await f({...u,entries:Rt(v,l)})}let h=await wn(y.entries),C=$n(y.entries,h),S=we();S.catalog=new Map(Object.entries(y.entries)),S.transparent=h;let b=h.size===0&&C.length===0?y.fingerprint:At("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=$i(e,o);if(a!==void 0)return a;for(let c of Ai(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Pn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||Pn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function In(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=In(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Dr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,y)),f.push(...ie(e,y)),`<a ${f.join(" ")}>${i}</a>`}};var _n=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return _n.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function On(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Bn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Tn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=oi(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),y=H(e,"densities"),h=H(e,"format"),C=ii(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!h,P=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,h),U=Je(f);else if(!T&&y){let Z=y.split(/\s+/).map((I)=>Number.parseFloat(I.replace("x","")));T=On(o,Z,P,d,h)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(P&&_)D.push(`aspect-ratio:${P}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let I=Tn(P||16,_||9,b);D.push(`background-image:url(${I})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,P,_,d,h),X=[];if(X.push(`src="${r(Dr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Dr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let xe=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",I=Bn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(I)}"`),xe.add("onload")}X.push(...re(e,xe)),X.push(...ie(e,xe));let le=`<img ${X.join(" ")} />`,Q="";if(z){let I=h==="webp"?"image/webp":h==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${I?` type="${I}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
3
+ `}if(q){let Z=[];if(a)for(let I of ai(a))Z.push(`<source type="image/${I.format}" srcset="${r(I.srcset)}"${U?` sizes="${r(U)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let I=$e(o,P,_,d,"avif"),O=T?Qe(o,Ke,d,"avif"):`${I}`;Z.push(`<source type="image/avif" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let I=$e(o,P,_,d,"webp"),O=T?Qe(o,Ke,d,"webp"):`${I}`;Z.push(`<source type="image/webp" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}return`${Q}<picture>
4
4
  ${Z.join(`
5
5
  `)}
6
6
  ${le}
@@ -38,5 +38,5 @@ ${le}
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 Mn,readFileSync as Ln}from"fs";var De=new Map,Dt=new Set;function zn(e){if(Dt.has(e))return;Dt.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 Un(e){let i=process.cwd();for(let n of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Mn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return w.resolve(n)}catch{}return null}function Fn(e){if(De.has(e))return De.get(e);let i=Un(e);if(!i)return zn(e),null;try{let n=JSON.parse(Ln(i,"utf8"));return De.set(e,n),n}catch{return null}}function Wn(e,i,n,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${n/2} ${o/2})`);if(i.hFlip)a.push(`translate(${n} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Hn(e,i){let n=i,o=e.icons[n],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[n];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;n=f.parent,o=e.icons[n]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Wn(o.body,a,c,l),width:c,height:l}}function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var at={name:"Icon",aliases:["icon","stx-icon"],render(e,i,n){let o=me(e,"name")??me(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let x=o.split(":");a=x[0],c=x[1]}let l=r(me(e,"size")||"24"),u=r(me(e,"color")||"currentColor"),f=r(me(e,"class")||""),v=r(me(e,"style")||""),y=De.get(a)??Fn(a);if(!y)return`<!-- Icon: collection "${a}" not loaded -->`;let h=Hn(y,c);if(!h)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${h.width} ${h.height}`,S=h.body;if(u!=="currentColor")S=S.replace(/currentColor/g,u);let b=f?` class="${f}"`:"",d=v?` style="${v}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${b}${d}>${S}</svg>`}};function jt(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}function Mt(e,i){let n=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(n);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var ct={name:"Suspense",aliases:["suspense"],render(e,i,n){let o=Mt(i,"fallback"),a=o.rest,c=Mt(a,"error"),l=c.rest,u=o.region??jt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??jt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Lt(e=fe){e.registerBuiltin(Ve),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt)}var zt=new Map;function qn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Xn(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function Wt(e,i,n){let o=[],a=0,c=typeof n==="function"?n:n?(l)=>n.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=qn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let v=f[1];if(c&&c(v)){let x=l+1+v.length;while(x<e.length&&e[x]!==">")x++;a=x+1;continue}let y=l+1+v.length,h=null,C=y,S=-1,b=!1;while(y<e.length){let x=e[y];if(h){if(x==="\\"&&y+1<e.length){y+=2;continue}if(x===h)h=null;y++;continue}if(x==='"'||x==="'"){h=x,y++;continue}if(x==="/"&&y+1<e.length&&e[y+1]===">"){S=y+2,b=!0;break}if(x===">"){S=y+1;break}y++}if(S===-1){a=l+1;continue}let d=e.slice(C,b?S-2:S-1).trim();if(b)o.push({fullMatch:e.slice(l,S),tagName:v,attributes:d,content:"",startIndex:l,endIndex:S,isSelfClosing:!0}),a=S;else{let x=`<${v}`,k=`</${v}>`,A=1,R=S,E=-1;while(A>0&&R<e.length){let B=e.indexOf(x,R),L=e.indexOf(k,R);if(L===-1)break;if(B!==-1&&B<L){let N=e[B+x.length];if(N===" "||N===">"||N==="/"||N===`
41
- `||N==="\t"){let q=Xn(e,B+x.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+x.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:v,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ht(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;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==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var Zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Vn=new Set([":for","x-for","v-for","@for"]),Zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){let v=n.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((v)=>Vn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Zt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Kn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Vt(e){let i=new Map,n=[];for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Zt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Kn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Oc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=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(...Gn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(h){return a.some(([C,S])=>h>=C&&h<S)}let f=[],v=new Map,y=256;for(let h of Oe(n)){if(h.closing||u(h.start))continue;let C=h.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,x=C,k=!1;while((d=b.exec(C))!==null){if(Dr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Hl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=v.get(B);if(!L){if(L=Function(...E,`return (${R})`),v.size>=y)v.clear();v.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Gt(N));if(q){let P=x.match(/\sclass="([^"]*)"/);if(P)x=x.replace(P[0],()=>` class="${P[1]} ${q}"`);else x=x.replace(d[0],()=>` class="${q}"`)}else x=x.replace(d[0],"");k=!0;continue}if(Zn.has(A)){if(N)x=x.replace(d[0],` ${A}`);else x=x.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)x=x.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),P=On(A,q);x=x.replace(d[0],()=>` ${A}="${P}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=h.selfClosing?" /":"",E=`<${h.name}${x}${A}>`;f.push({start:h.start,end:h.end,replacement:E})}}if(f.length>0){let h=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:b,end:d,replacement:x}=f[S];h[S*2]=n.slice(C,b),h[S*2+1]=x,C=d}h[f.length*2]=n.slice(C),n=h.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Jn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),b=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let d of l){let x=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${x}\\s*\\(`).test(S))return!0}return!1},f=new Set(Vl),v=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())},y=(C,S)=>{let b=v(C);if(c.static[b]=S,b!==C)c.staticNames[b]=C},h={...e};for(let[C,S]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete h[C];let d=b[1]||"modelValue";if(h[`:${d}`]=S,h[`@update:${d}`]=`${S} = $event`,b[2]){let x=b[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");h[`:${b[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${x} }`}}for(let[C,S]of Object.entries(h)){let b=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(b.startsWith("@")){c.events[b]=S;continue}if(b.startsWith("__stx_")){let d=v(b.slice(6));c.serverDynamic[d]=Ht(S,n);continue}if(b.startsWith(":")){let d=v(b.slice(1)),x=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=x;continue}if(o){c.clientReactive[d]=x;continue}if(F(x,a)){c.clientReactive[d]=x;continue}if(u(x)){c.clientReactive[d]=x;continue}try{if(!m(x)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${x}`);c.clientReactive[d]=x;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(yt(x).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=x;continue}let z=p(x,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=b.slice(1)}catch{c.clientReactive[d]=x}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=tr(S,a);if(d!==null){c.clientReactive[v(b)]=d;continue}let x=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(x)try{let k=x[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));y(b,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${k}`);y(b,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${b}:`,k);y(b,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}y(b,k)}continue}y(b,S===ne?"true":ut(S))}return c}var dt=new Set;function uy(){dt.clear()}function Yn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Qn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var gt=new Set;function dy(){gt.clear()}function er(e,i){let n=`${i}\x00${e}`;if(gt.has(n))return;gt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function tr(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var nr=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rr(e,i,n){if(!e.includes("@"))return e;if(!nr.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${sr(n)}"`).join(" ")}function sr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ir(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function ug(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let h of e.matchAll(f)){let[C,S,b]=h,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,x=b,k,A=[];while((k=d.exec(b))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let P=Jt.resolve(l,z);if(P.endsWith(".stx"))L=P;else{let _=`${P}.stx`;try{if(Kt.statSync(_).isFile())L=_}catch{try{if(Kt.statSync(P).isDirectory())B=P}catch{}}}}else B=Js(z,l);if(!B&&!L)continue;let N=!1,q=(P,_)=>{c.set(P,_),c.set(P.toLowerCase(),_);let T=P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let P=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Ir(B):null;for(let{source:T,local:U}of P){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)x=x.slice(0,A[R].start)+x.slice(A[R].end);u.push({start:h.index,end:h.index+C.length,value:`<script${S}>${x}</script>`})}if(u.length===0)return e;let v=[],y=0;for(let h of u)v.push(e.slice(y,h.start),h.value),y=h.end;return v.push(e.slice(y)),v.join("")}async function or(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[v,y]=f,h=y.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of h){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),x=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Ys(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(x,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${x} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ar(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,v;while((v=f.exec(c))!==null){let y=v.index,h=y+v[0].length-1,C=1,S=h+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let b=c.substring(h+1,S),d=S+1,x=b.match(/^\s*['"]([^'"]+)['"]/);if(!x){f.lastIndex=d;continue}let k=x[1],A,R=b.slice(x[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(P){let _=P instanceof Error?P.message:String(P);c=c.replace(c.substring(y,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Ye(k,G,z,l,i,n,o,u,a);c=c.substring(0,y)+q+c.substring(B),f.lastIndex=0}return c}async function cr(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=fr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let v=se(c);c=v.output;let y=mt(i);return c=await b(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await b(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Lr)),c=await b(c,/[a-z][a-z0-9]*/,!1,Lr),c=v.restore(c),c;async function b(d,x,k,A){if(!d)return d;let R=d,E=Wt(R,x,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let P=E.length-1;P>=0;P--){let _=E[P],T=k?J(_.tagName):_.tagName,U=ye(rr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))er(_.tagName,n);let te=D.length>0,ae=new Set(y);for(let O of D)for(let W of O.names)ae.add(W);let j=Jn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Ce=X?await Fr(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,xe=_.tagName==="Image"&&Zs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Ir(O).has("Image"));if(X&&!Ce&&!xe){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);L.set(P,W);continue}if(!k&&_.tagName.includes("-")&&!await Fr(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Ye(T,le,v.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Yn(Z)){B??=Vt(R);let O=B.get(_.startIndex);if(O)Qn(_.tagName,O,n)}let I=Z;if(I=lr(I,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=pt(I,!0);if(O.length&&W){if(!Object.hasOwn(ye(I.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))I=I.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+I.slice(W.insertPos);let ee=be(I);I=I.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+I.slice(ee.insertPos)}let ce=pt(I,!0);if(ce){let ee=ye(I.slice(ce.insertPos,ce.tagEnd)),Re=be(I),sn=ye(I.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(sn,"data-stx-native-host-owner"))I=I.slice(0,Re.insertPos)+" data-stx-native-host-owner"+I.slice(Re.insertPos)}}if(Object.keys(j.events).length>0){let O=be(I);if(O){let W=Qt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+I.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)I=en(I,j.clientReactive);L.set(P,I)}if(L.size===0)return R;let N="",q=0;for(let P=0;P<E.length;P++){let _=L.get(P);if(_===void 0)continue;N+=R.slice(q,E[P].startIndex),N+=_,q=E[P].endIndex}return N+=R.slice(q),N}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([y])=>!n.has(y)),c=a.filter(([y])=>!o.has(y)).map(([y])=>J(y)).join(" "),l=e,u=a.length>0?be(l):null;if(u){let y=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,"&quot;")}"`).join(" "),h=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${h} ${y}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,"&quot;")}">${l}</template>`;let v=i.for;if(v){let y=i.key,h=y?` :key="${y.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${v.replace(/"/g,"&quot;")}"${h}>${l}</template>`}return l}function lr(e,i,n=new Set,o=new Set,a=!1){let c=pt(e,a);if(!c)return e;let l=a?be(e):null;if(l){let u=nn(e,l).filter((f)=>f.insertPos>c.insertPos);for(let f=u.length-1;f>=0;f--)e=tn(e,u[f],i,n,o,a)}return tn(e,c,i,n,o,a)}function tn(e,i,n,o,a,c){let l=e.slice(i.insertPos,i.tagEnd),u=n.serverDynamic.class??n.static.class;if(c&&typeof u==="string"&&u&&!a.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=b.test(l)?l.replace(b,(x,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,i.insertPos)+d+e.slice(i.tagEnd),i.tagEnd+=d.length-l.length,l=d}let f=c||/\bdata-native(?:\s|=)/i.test(l),v=f?a:o,y=new Set(Object.keys(ye(l))),h=new Set(["class","className"]);for(let b of Object.keys(n.static)){let d=n.staticNames[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}for(let b of Object.keys(n.serverDynamic)){let d=n.serverDynamicNames?.[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}let C=[];if(f){for(let[b,d]of Object.entries(n.static)){if(h.has(b)||d!==!0&&d!==ne)continue;h.add(b),C.push(`${r(n.staticNames?.[b]??b)}="true"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!0)continue;h.add(b),C.push(`${r(n.serverDynamicNames?.[b]??b)}="true"`)}}let S=[...re(n,h),...ie(n,h),...C];if(f){for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!1)continue;let x=n.serverDynamicNames?.[b]??b;S.push(`${r(x)}="false"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d===null||typeof d!=="object")continue;let x=JSON.stringify(d);if(x!==void 0){let k=n.serverDynamicNames?.[b]??b;S.push(`${r(k)}="${r(x)}"`)}}}if(S.length===0)return e;return`${e.slice(0,i.insertPos)} ${S.join(" ")}${e.slice(i.insertPos)}`}function be(e){let i=rn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:ht(e,n.index+1+n[1].length)};return null}function pt(e,i=!1){let n=be(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?rn(e,n.tagEnd+1):n;return a&&i?ur(e,a)??a:a}function ur(e,i){return nn(e,i)[0]??null}function nn(e,i){let n=[];if(!e.includes("data-stx-native-host-root"))return n;let o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),a=e.lastIndexOf("<",i.insertPos),c=0,l;while(a>=0&&a<e.length){if(e.startsWith("<!--",a)){let h=e.indexOf("-->",a+4);if(h<0)return n;a=e.indexOf("<",h+3);continue}let u=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(a));if(!u){a=e.indexOf("<",a+1);continue}let f=u[2].toLowerCase(),v=a+u[0].length,y=ht(e,v);if(u[1]){if(c--,l!==void 0&&c<l)l=void 0;if(c<=0)return n}else if(f==="script"||f==="style"){let h=new RegExp(`</${f}\\s*>`,"gi");if(h.lastIndex=y+1,!h.exec(e))return n;a=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(v,y)),C=c>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner")),S=l===void 0&&!C&&Object.hasOwn(h,"data-stx-native-host-root");if(S)n.push({insertPos:v,tagEnd:y});if(!o.has(f)&&e[y-1]!=="/"){if(c++,l===void 0&&(C||S))l=c}else if(c===0)return n}a=e.indexOf("<",y+1)}return n}function rn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:ht(e,n+1+l[1].length)}}return null}function ht(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function fr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Oi(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.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))i.add(l)}}}return i}async function $s(e,i,n,o,a){if(!Yt)Lt(fe),Yt=!0;let c=await ug(e,i,n,o,a);c=await or(c,i,n,o,a),c=await ar(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,qe,(h,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let y=c;if(c=await cr(v.output,i,n,o,a),c===y)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=ir(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
- export{si,oi,ii,cy,Ts,ly,Oc,uy,dy,ug,$s};
41
+ `||N==="\t"){let q=Xn(e,B+x.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+x.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:v,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function kn(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;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==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function Ht(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function qt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var Zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Vn=new Set([":for","x-for","v-for","@for"]),Xt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){let v=n.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?qt(o.attributes).find((v)=>Vn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Xt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Kn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,n=[];for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Xt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Kn.exec(l)?.[1]??null:null,children:0})}}return i}function Vt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Vt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Nc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=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(...Gn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(h){return a.some(([C,S])=>h>=C&&h<S)}let f=[],v=new Map,y=256;for(let h of Oe(n)){if(h.closing||u(h.start))continue;let C=h.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,x=C,k=!1;while((d=b.exec(C))!==null){if(Lr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Vl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=v.get(B);if(!L){if(L=Function(...E,`return (${R})`),v.size>=y)v.clear();v.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Vt(N));if(q){let P=x.match(/\sclass="([^"]*)"/);if(P)x=x.replace(P[0],()=>` class="${P[1]} ${q}"`);else x=x.replace(d[0],()=>` class="${q}"`)}else x=x.replace(d[0],"");k=!0;continue}if(Zn.has(A)){if(N)x=x.replace(d[0],` ${A}`);else x=x.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)x=x.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),P=Nn(A,q);x=x.replace(d[0],()=>` ${A}="${P}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=h.selfClosing?" /":"",E=`<${h.name}${x}${A}>`;f.push({start:h.start,end:h.end,replacement:E})}}if(f.length>0){let h=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:b,end:d,replacement:x}=f[S];h[S*2]=n.slice(C,b),h[S*2+1]=x,C=d}h[f.length*2]=n.slice(C),n=h.join("")}return n}import Gt from"fs";import Kt from"path";var Jt=!1;function Jn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),b=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let d of l){let x=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${x}\\s*\\(`).test(S))return!0}return!1},f=new Set(Ul),v=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())},y=(C,S)=>{let b=v(C);if(c.static[b]=S,b!==C)c.staticNames[b]=C},h={...e};for(let[C,S]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete h[C];let d=b[1]||"modelValue";if(h[`:${d}`]=S,h[`@update:${d}`]=`${S} = $event`,b[2]){let x=b[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");h[`:${b[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${x} }`}}for(let[C,S]of Object.entries(h)){let b=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(b.startsWith("@")){c.events[b]=S;continue}if(b.startsWith("__stx_")){let d=v(b.slice(6));c.serverDynamic[d]=kn(S,n);continue}if(b.startsWith(":")){let d=v(b.slice(1)),x=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=x;continue}if(o){c.clientReactive[d]=x;continue}if(F(x,a)){c.clientReactive[d]=x;continue}if(u(x)){c.clientReactive[d]=x;continue}try{if(!m(x)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${x}`);c.clientReactive[d]=x;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(yt(x).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=x;continue}let z=p(x,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=b.slice(1)}catch{c.clientReactive[d]=x}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=tr(S,a);if(d!==null){c.clientReactive[v(b)]=d;continue}let x=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(x)try{let k=x[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));y(b,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${k}`);y(b,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${b}:`,k);y(b,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}y(b,k)}continue}y(b,S===ne?"true":ut(S))}return c}var dt=new Set;function dy(){dt.clear()}function Yn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Qn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var gt=new Set;function py(){gt.clear()}function er(e,i){let n=`${i}\x00${e}`;if(gt.has(n))return;gt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function tr(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var nr=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rr(e,i,n){if(!e.includes("@"))return e;if(!nr.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=Ht(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Yt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${sr(n)}"`).join(" ")}function sr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ir(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function dg(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Kt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let h of e.matchAll(f)){let[C,S,b]=h,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,x=b,k,A=[];while((k=d.exec(b))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let P=Kt.resolve(l,z);if(P.endsWith(".stx"))L=P;else{let _=`${P}.stx`;try{if(Gt.statSync(_).isFile())L=_}catch{try{if(Gt.statSync(P).isDirectory())B=P}catch{}}}}else B=Ys(z,l);if(!B&&!L)continue;let N=!1,q=(P,_)=>{c.set(P,_),c.set(P.toLowerCase(),_);let T=P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let P=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Or(B):null;for(let{source:T,local:U}of P){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)x=x.slice(0,A[R].start)+x.slice(A[R].end);u.push({start:h.index,end:h.index+C.length,value:`<script${S}>${x}</script>`})}if(u.length===0)return e;let v=[],y=0;for(let h of u)v.push(e.slice(y,h.start),h.value),y=h.end;return v.push(e.slice(y)),v.join("")}async function or(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[v,y]=f,h=y.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of h){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),x=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Zs(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(x,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${x} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ar(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,v;while((v=f.exec(c))!==null){let y=v.index,h=y+v[0].length-1,C=1,S=h+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let b=c.substring(h+1,S),d=S+1,x=b.match(/^\s*['"]([^'"]+)['"]/);if(!x){f.lastIndex=d;continue}let k=x[1],A,R=b.slice(x[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(P){let _=P instanceof Error?P.message:String(P);c=c.replace(c.substring(y,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Ye(k,G,z,l,i,n,o,u,a);c=c.substring(0,y)+q+c.substring(B),f.lastIndex=0}return c}async function cr(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=fr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let v=se(c);c=v.output;let y=mt(i);return c=await b(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await b(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(jr)),c=await b(c,/[a-z][a-z0-9]*/,!1,jr),c=v.restore(c),c;async function b(d,x,k,A){if(!d)return d;let R=d,E=Wt(R,x,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let P=E.length-1;P>=0;P--){let _=E[P],T=k?J(_.tagName):_.tagName,U=ye(rr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))er(_.tagName,n);let te=D.length>0,ae=new Set(y);for(let O of D)for(let W of O.names)ae.add(W);let j=Jn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Ce=X?await zr(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,xe=_.tagName==="Image"&&Qs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Or(O).has("Image"));if(X&&!Ce&&!xe){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Yt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=Qt(W,j.clientReactive);L.set(P,W);continue}if(!k&&_.tagName.includes("-")&&!await zr(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Ye(T,le,v.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Yn(Z)){B??=Zt(R);let O=B.get(_.startIndex);if(O)Qn(_.tagName,O,n)}let I=Z;if(I=lr(I,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=pt(I,!0);if(O.length&&W){if(!Object.hasOwn(ye(I.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))I=I.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+I.slice(W.insertPos);let ee=be(I);I=I.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+I.slice(ee.insertPos)}let ce=pt(I,!0);if(ce){let ee=ye(I.slice(ce.insertPos,ce.tagEnd)),Re=be(I),rn=ye(I.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(rn,"data-stx-native-host-owner"))I=I.slice(0,Re.insertPos)+" data-stx-native-host-owner"+I.slice(Re.insertPos)}}if(Object.keys(j.events).length>0){let O=be(I);if(O){let W=Yt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+I.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)I=Qt(I,j.clientReactive);L.set(P,I)}if(L.size===0)return R;let N="",q=0;for(let P=0;P<E.length;P++){let _=L.get(P);if(_===void 0)continue;N+=R.slice(q,E[P].startIndex),N+=_,q=E[P].endIndex}return N+=R.slice(q),N}}function Qt(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([y])=>!n.has(y)),c=a.filter(([y])=>!o.has(y)).map(([y])=>J(y)).join(" "),l=e,u=a.length>0?be(l):null;if(u){let y=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,"&quot;")}"`).join(" "),h=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${h} ${y}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,"&quot;")}">${l}</template>`;let v=i.for;if(v){let y=i.key,h=y?` :key="${y.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${v.replace(/"/g,"&quot;")}"${h}>${l}</template>`}return l}function lr(e,i,n=new Set,o=new Set,a=!1){let c=pt(e,a);if(!c)return e;let l=a?be(e):null;if(l){let u=tn(e,l).filter((f)=>f.insertPos>c.insertPos);for(let f=u.length-1;f>=0;f--)e=en(e,u[f],i,n,o,a)}return en(e,c,i,n,o,a)}function en(e,i,n,o,a,c){let l=e.slice(i.insertPos,i.tagEnd),u=n.serverDynamic.class??n.static.class;if(c&&typeof u==="string"&&u&&!a.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=b.test(l)?l.replace(b,(x,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,i.insertPos)+d+e.slice(i.tagEnd),i.tagEnd+=d.length-l.length,l=d}let f=c||/\bdata-native(?:\s|=)/i.test(l),v=f?a:o,y=new Set(Object.keys(ye(l))),h=new Set(["class","className"]);for(let b of Object.keys(n.static)){let d=n.staticNames[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}for(let b of Object.keys(n.serverDynamic)){let d=n.serverDynamicNames?.[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}let C=[];if(f){for(let[b,d]of Object.entries(n.static)){if(h.has(b)||d!==!0&&d!==ne)continue;h.add(b),C.push(`${r(n.staticNames?.[b]??b)}="true"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!0)continue;h.add(b),C.push(`${r(n.serverDynamicNames?.[b]??b)}="true"`)}}let S=[...re(n,h),...ie(n,h),...C];if(f){for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!1)continue;let x=n.serverDynamicNames?.[b]??b;S.push(`${r(x)}="false"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d===null||typeof d!=="object")continue;let x=JSON.stringify(d);if(x!==void 0){let k=n.serverDynamicNames?.[b]??b;S.push(`${r(k)}="${r(x)}"`)}}}if(S.length===0)return e;return`${e.slice(0,i.insertPos)} ${S.join(" ")}${e.slice(i.insertPos)}`}function be(e){let i=nn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:ht(e,n.index+1+n[1].length)};return null}function pt(e,i=!1){let n=be(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?nn(e,n.tagEnd+1):n;return a&&i?ur(e,a)??a:a}function ur(e,i){return tn(e,i)[0]??null}function tn(e,i){let n=[];if(!e.includes("data-stx-native-host-root"))return n;let o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),a=e.lastIndexOf("<",i.insertPos),c=0,l;while(a>=0&&a<e.length){if(e.startsWith("<!--",a)){let h=e.indexOf("-->",a+4);if(h<0)return n;a=e.indexOf("<",h+3);continue}let u=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(a));if(!u){a=e.indexOf("<",a+1);continue}let f=u[2].toLowerCase(),v=a+u[0].length,y=ht(e,v);if(u[1]){if(c--,l!==void 0&&c<l)l=void 0;if(c<=0)return n}else if(f==="script"||f==="style"){let h=new RegExp(`</${f}\\s*>`,"gi");if(h.lastIndex=y+1,!h.exec(e))return n;a=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(v,y)),C=c>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner")),S=l===void 0&&!C&&Object.hasOwn(h,"data-stx-native-host-root");if(S)n.push({insertPos:v,tagEnd:y});if(!o.has(f)&&e[y-1]!=="/"){if(c++,l===void 0&&(C||S))l=c}else if(c===0)return n}a=e.indexOf("<",y+1)}return n}function nn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:ht(e,n+1+l[1].length)}}return null}function ht(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function fr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Ni(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.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))i.add(l)}}}return i}async function Rs(e,i,n,o,a){if(!Jt)Lt(fe),Jt=!0;let c=await dg(e,i,n,o,a);c=await or(c,i,n,o,a),c=await ar(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,qe,(h,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let y=c;if(c=await cr(v.output,i,n,o,a),c===y)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=ir(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
+ export{oi,ii,ai,ly,$s,uy,kn,Nc,dy,py,dg,Rs};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function Ba(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Wm=new a;var u=Ba({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Ba({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Ba,Wm};
2
+ function Fa(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var qm=new a;var u=Fa({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Fa({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Fa,qm};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Ze(n,f){return m.run(n,f)}function Mn(){return m.getStore()}function uo(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Ki(){return uo().public}function z(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Jt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
- export{Ze,Mn,uo,Ki,z,Jt};
2
+ import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Ze(n,f){return m.run(n,f)}function Dn(){return m.getStore()}function po(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Gi(){return po().public}function z(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Jt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
+ export{Ze,Dn,po,Gi,z,Jt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{oi,ii,ai,ly,$s,uy}from"./chunk-eka2e4cm.js";export{$s as clearImageDeliveryCatalog,ly as deliveredImage,ai as efficientDeliverySources,oi as getImageDelivery,ii as isTransparentImage,uy as prepareImageDelivery};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function eh(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
2
+ var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function th(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
3
3
  <div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
4
4
  <div class="stx-keep-alive-content" data-keep-alive-content="${e}">
5
5
  ${t}
@@ -286,7 +286,7 @@ else {
286
286
  });
287
287
  })();
288
288
  </script>
289
- `}function th(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function nh(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function rh(){return`
289
+ `}function nh(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function rh(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function sh(){return`
290
290
  /* STX Keep-Alive Styles */
291
291
  .stx-keep-alive {
292
292
  position: relative;
@@ -311,7 +311,7 @@ else {
311
311
  .stx-keep-alive-content > [data-activated] {
312
312
  opacity: 1;
313
313
  }
314
- `}function sh(){return`
314
+ `}function oh(){return`
315
315
  // STX Keep-Alive Runtime
316
316
  (function() {
317
317
  if (typeof window === 'undefined') return;
@@ -347,5 +347,5 @@ else {
347
347
 
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
- `}function oh(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function ih(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
- export{eh,th,nh,rh,sh,oh,ih};
350
+ `}function ih(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function ah(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
+ export{th,nh,rh,sh,oh,ih,ah};
@@ -159,7 +159,7 @@ else {
159
159
  stxIslands.initIslands();
160
160
  }
161
161
  })();
162
- </script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function Cu(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
162
+ </script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function Eu(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
163
163
  <script data-hydrate="${e}">
164
164
  (function() {
165
165
  const island = document.querySelector('[data-island="${e}"]');
@@ -311,7 +311,7 @@ else {
311
311
  });
312
312
  })();
313
313
  </script>
314
- `}function Eu(e,t={},n){let r=e,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(r=u(r,"load",t),r=u(r,"idle",t),r=u(r,"visible",t),r=u(r,"media",t),r=M(r),r=u(r,"hover",t),r=u(r,"event",t),i=d&&r!==e,i)r+=`
314
+ `}function Tu(e,t={},n){let r=e,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(r=u(r,"load",t),r=u(r,"idle",t),r=u(r,"visible",t),r=u(r,"media",t),r=M(r),r=u(r,"hover",t),r=u(r,"event",t),i=d&&r!==e,i)r+=`
315
315
  `+v();return r}function u(e,t,n){let r=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(r,(i,d,o)=>{let a={strategy:t};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,g]=h.split(":").map((p)=>p.trim());if(m&&g){let p=g.replace(/^['"]|['"]$/g,"");a[m]=p}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,y=b(o.trim()),f=w(o.trim(),n),c=[];if(a.rootMargin)c.push(`data-root-margin="${a.rootMargin}"`);if(a.threshold!==void 0)c.push(`data-threshold="${a.threshold}"`);if(a.media)c.push(`data-media="${a.media}"`);if(a.event)c.push(`data-event="${a.event}"`);if(y)c.push(`data-component="${y}"`);let x=Object.keys(f).length>0?`
316
316
  <script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(t){case"load":l=I(s);break;case"idle":l=L(s,a);break;case"visible":l=C(s,a);break;case"media":l=S(s,a);break;case"hover":l=k(s);break;case"event":l=H(s,a);break}return`
317
317
  <div data-island="${s}"
@@ -342,7 +342,7 @@ else {
342
342
  }
343
343
  })();
344
344
  </script>
345
- `})}function Tu(){return`
345
+ `})}function $u(){return`
346
346
  /* Island base styles */
347
347
  .stx-island {
348
348
  display: contents;
@@ -383,9 +383,9 @@ else {
383
383
  .stx-island.hydrated {
384
384
  opacity: 1;
385
385
  }
386
- `}function $u(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Ru(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Au(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Pu(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Iu(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Ou(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Nu(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
386
+ `}function Ru(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Au(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Pu(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Iu(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Ou(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Nu(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Mu(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
387
387
  <script type="application/json" id="stx-island-manifest">
388
388
  ${JSON.stringify(t)}
389
389
  </script>
390
- `}var ch={processPartialHydrationDirectives:Eu,processStaticDirectives:Ou,generatePartialHydrationCSS:Tu,generateIslandManifest:Nu,createIslandRegistry:Cu,hydrateIsland:$u,hydrateByStrategy:Ru,hydrateAll:Au,isHydrated:Pu,onHydrated:Iu};
391
- export{Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,ch};
390
+ `}var lh={processPartialHydrationDirectives:Tu,processStaticDirectives:Nu,generatePartialHydrationCSS:$u,generateIslandManifest:Mu,createIslandRegistry:Eu,hydrateIsland:Ru,hydrateByStrategy:Au,hydrateAll:Pu,isHydrated:Iu,onHydrated:Ou};
391
+ export{Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,Mu,lh};