@stacksjs/stx 0.2.849 → 0.2.850

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 (225) hide show
  1. package/dist/{chunk-rqjskxpw.js → chunk-0dnetjh8.js} +31 -31
  2. package/dist/{chunk-09412heg.js → chunk-0rszcb0m.js} +13 -13
  3. package/dist/chunk-1qdhwjs4.js +2 -0
  4. package/dist/{chunk-z57xq46m.js → chunk-2d7e5g92.js} +4 -4
  5. package/dist/{chunk-wp14sf2j.js → chunk-2j2qzv8g.js} +1 -1
  6. package/dist/{chunk-nws4zm4k.js → chunk-2rg9pqmh.js} +4 -4
  7. package/dist/chunk-3gyq9rjx.js +2 -0
  8. package/dist/chunk-3w9xhs7k.js +2 -0
  9. package/dist/chunk-3wt0nh3p.js +2 -0
  10. package/dist/{chunk-jh36gqcq.js → chunk-422r7zkx.js} +2 -2
  11. package/dist/chunk-4e6wkjtx.js +2 -0
  12. package/dist/chunk-4pbrszgz.js +2 -0
  13. package/dist/chunk-5be6p256.js +2 -0
  14. package/dist/{chunk-83dxfhkw.js → chunk-5jqz5qff.js} +7 -7
  15. package/dist/chunk-5m4txcry.js +2 -0
  16. package/dist/chunk-5p6vpvmz.js +2 -0
  17. package/dist/chunk-5wk40kjd.js +2 -0
  18. package/dist/{chunk-ct54e34a.js → chunk-62k66qj9.js} +1 -1
  19. package/dist/chunk-660g9vjn.js +2 -0
  20. package/dist/chunk-67bn31a3.js +2 -0
  21. package/dist/{chunk-y1cneng3.js → chunk-6p62jjzm.js} +2 -2
  22. package/dist/{chunk-9mbyhepc.js → chunk-6q6atv4g.js} +5 -5
  23. package/dist/chunk-6rd4phe3.js +2 -0
  24. package/dist/chunk-7hnt9a2e.js +2 -0
  25. package/dist/{chunk-88a7qaw8.js → chunk-7zxce1yw.js} +3 -3
  26. package/dist/chunk-80bb89fh.js +2 -0
  27. package/dist/{chunk-he9dzchk.js → chunk-833y1ndd.js} +1 -1
  28. package/dist/{chunk-93c08def.js → chunk-88392kaj.js} +5 -5
  29. package/dist/{chunk-t4dkcf28.js → chunk-8cvgm13s.js} +2 -2
  30. package/dist/{chunk-v929r67j.js → chunk-8hkgycpm.js} +1 -1
  31. package/dist/chunk-8k6cd1e0.js +2 -0
  32. package/dist/{chunk-2ts9pb6s.js → chunk-8vjr3atq.js} +2 -2
  33. package/dist/{chunk-ke76eaat.js → chunk-918ws1g7.js} +6 -6
  34. package/dist/{chunk-tj533808.js → chunk-98qgcmxr.js} +2 -2
  35. package/dist/chunk-9bkgbyrs.js +2 -0
  36. package/dist/{chunk-rtsshvpt.js → chunk-9mryv01z.js} +52 -52
  37. package/dist/{chunk-bsw6hd14.js → chunk-9yp0t7zc.js} +2 -2
  38. package/dist/{chunk-yrmppd8r.js → chunk-a2fngjfx.js} +1 -1
  39. package/dist/chunk-a2shk93y.js +3 -0
  40. package/dist/chunk-a7v1j7td.js +2 -0
  41. package/dist/{chunk-zfb2wnha.js → chunk-aas25pac.js} +3 -3
  42. package/dist/{chunk-90mm5bf8.js → chunk-ab1vk7jv.js} +4 -4
  43. package/dist/chunk-acbx3jn5.js +2 -0
  44. package/dist/{chunk-0wms5teg.js → chunk-agbkv9ab.js} +2 -2
  45. package/dist/{chunk-wdwx2aa6.js → chunk-amerebya.js} +2 -2
  46. package/dist/{chunk-b1q40vq4.js → chunk-anva219c.js} +2 -2
  47. package/dist/chunk-apq33h4w.js +2 -0
  48. package/dist/{chunk-8vkywnpx.js → chunk-ar1prdev.js} +7 -7
  49. package/dist/{chunk-trgbdydw.js → chunk-axga9ebe.js} +2 -2
  50. package/dist/{chunk-mnncq81c.js → chunk-brheng7x.js} +8 -8
  51. package/dist/{chunk-3m5v3ynh.js → chunk-btkazgdb.js} +3 -3
  52. package/dist/chunk-c90qz5w0.js +2 -0
  53. package/dist/{chunk-4fc8zs15.js → chunk-caehra7e.js} +5 -5
  54. package/dist/chunk-cwt26rvt.js +3 -0
  55. package/dist/chunk-d4kystzh.js +2 -0
  56. package/dist/chunk-dx31vsyf.js +2 -0
  57. package/dist/{chunk-jaf44web.js → chunk-e105xsee.js} +1 -1
  58. package/dist/{chunk-1k12cc65.js → chunk-e46n406k.js} +13 -13
  59. package/dist/{chunk-2j3gttzf.js → chunk-e85wsz8y.js} +1 -1
  60. package/dist/{chunk-0zgxxhvs.js → chunk-eh8g8kr1.js} +5 -5
  61. package/dist/chunk-f4x21pqx.js +2 -0
  62. package/dist/{chunk-6xcmeev9.js → chunk-f5n871gp.js} +5 -5
  63. package/dist/{chunk-81ysx0tc.js → chunk-fffjjgnt.js} +2 -2
  64. package/dist/{chunk-wzyc9da7.js → chunk-frhdk0p9.js} +2 -2
  65. package/dist/chunk-frhh6jd3.js +2 -0
  66. package/dist/{chunk-b3n1m4m5.js → chunk-g046t3hb.js} +1 -1
  67. package/dist/chunk-g1gqysb4.js +2 -0
  68. package/dist/{chunk-8bxws458.js → chunk-gr8q8xqz.js} +3 -3
  69. package/dist/{chunk-emf6ee94.js → chunk-gsrdjmw9.js} +2 -2
  70. package/dist/{chunk-r96ahk8s.js → chunk-gwdffrz6.js} +9 -9
  71. package/dist/chunk-h7rcb74n.js +2 -0
  72. package/dist/{chunk-jcwtw3hd.js → chunk-h9gjt73q.js} +2 -2
  73. package/dist/chunk-hg9354gt.js +2 -0
  74. package/dist/{chunk-tbcvarvy.js → chunk-hhk46fzp.js} +2 -2
  75. package/dist/chunk-j3x3e353.js +2 -0
  76. package/dist/chunk-j6r964wk.js +2 -0
  77. package/dist/chunk-je8ma636.js +2 -0
  78. package/dist/chunk-jpyk0gtr.js +3 -0
  79. package/dist/{chunk-f2zgh4xr.js → chunk-jqjw00qm.js} +12 -12
  80. package/dist/{chunk-yqjmqndq.js → chunk-jqsn4sgv.js} +6 -6
  81. package/dist/{chunk-b147ejha.js → chunk-jt5cqq09.js} +3 -3
  82. package/dist/chunk-k0pm7p0f.js +2 -0
  83. package/dist/chunk-k1pyzf9e.js +2 -0
  84. package/dist/{chunk-eg2p1cyw.js → chunk-k47addf7.js} +29 -29
  85. package/dist/{chunk-qpz9jrvw.js → chunk-k7dvn2r8.js} +2 -2
  86. package/dist/{chunk-fa3ygt8c.js → chunk-kd06c90f.js} +4 -4
  87. package/dist/{chunk-9sjtph54.js → chunk-krtkxnz6.js} +2 -2
  88. package/dist/chunk-kybes29w.js +2 -0
  89. package/dist/{chunk-25m74mh1.js → chunk-m05pqmcj.js} +5 -5
  90. package/dist/chunk-m276y4f3.js +2 -0
  91. package/dist/{chunk-63sqdcr6.js → chunk-m6nhh5xf.js} +9 -9
  92. package/dist/{chunk-cww1zk8y.js → chunk-m710wkr4.js} +1 -1
  93. package/dist/chunk-nnbr1q94.js +2 -0
  94. package/dist/chunk-nq2z2yrz.js +2 -0
  95. package/dist/chunk-p2chmq36.js +2 -0
  96. package/dist/chunk-p9sbpbhg.js +2 -0
  97. package/dist/{chunk-3qyz80d6.js → chunk-pkq96sqk.js} +6 -6
  98. package/dist/chunk-q2d8x7p1.js +2 -0
  99. package/dist/{chunk-54p27ney.js → chunk-qa1pcm7n.js} +5 -5
  100. package/dist/{chunk-tm5t3hh3.js → chunk-qa4vs1qg.js} +3 -3
  101. package/dist/{chunk-gpkxphqz.js → chunk-qahz3n8z.js} +2 -2
  102. package/dist/{chunk-jm0qsr3s.js → chunk-qev14f76.js} +6 -6
  103. package/dist/{chunk-tb5h85ag.js → chunk-qjc3qjyf.js} +2 -2
  104. package/dist/chunk-r0btg48x.js +2 -0
  105. package/dist/{chunk-qay7pgnq.js → chunk-r0k5jbvk.js} +1 -1
  106. package/dist/{chunk-xr9rf0e6.js → chunk-r2p2nyyq.js} +3 -3
  107. package/dist/chunk-ryb4jesm.js +2 -0
  108. package/dist/{chunk-bttvkzxh.js → chunk-s0pnyd2f.js} +6 -6
  109. package/dist/{chunk-dv9q56r7.js → chunk-s37af6rd.js} +2 -2
  110. package/dist/chunk-sa18tper.js +20 -0
  111. package/dist/{chunk-2xf323h9.js → chunk-scaawv2r.js} +3 -3
  112. package/dist/chunk-sjpya8wm.js +2 -0
  113. package/dist/chunk-sy0jtgmv.js +42 -0
  114. package/dist/chunk-sznk5c66.js +2 -0
  115. package/dist/{chunk-c541s99z.js → chunk-t23jn83r.js} +4 -4
  116. package/dist/{chunk-fez9828r.js → chunk-t74qb5ej.js} +3 -3
  117. package/dist/chunk-t7ws9sth.js +2 -0
  118. package/dist/{chunk-rwc322gq.js → chunk-tbs24vx1.js} +2 -2
  119. package/dist/{chunk-jmshgw0t.js → chunk-td6b41vj.js} +4 -4
  120. package/dist/chunk-tdtwqydq.js +2 -0
  121. package/dist/{chunk-ga650crj.js → chunk-tm1ec751.js} +9 -9
  122. package/dist/{chunk-k7e3e149.js → chunk-tmftv8na.js} +102 -102
  123. package/dist/chunk-tpax2gpz.js +2 -0
  124. package/dist/chunk-ts6sm467.js +2 -0
  125. package/dist/{chunk-46t924aw.js → chunk-v4bqmzj9.js} +2 -2
  126. package/dist/chunk-w005b56n.js +2 -0
  127. package/dist/{chunk-ema1c29k.js → chunk-w032x0zm.js} +2 -2
  128. package/dist/chunk-w8aj3f9v.js +2 -0
  129. package/dist/{chunk-ma9yq04p.js → chunk-wzv7k91a.js} +2 -2
  130. package/dist/chunk-x4077p94.js +2 -0
  131. package/dist/{chunk-y6wbbmp3.js → chunk-x80b12gr.js} +3 -3
  132. package/dist/{chunk-c7qej674.js → chunk-xa1f13nk.js} +56 -56
  133. package/dist/{chunk-ynnd6nnt.js → chunk-xe8m66a3.js} +104 -102
  134. package/dist/{chunk-9qxx2teq.js → chunk-xndr2dx9.js} +6 -6
  135. package/dist/chunk-xrdh4at4.js +2 -0
  136. package/dist/chunk-y8qdpb0p.js +2 -0
  137. package/dist/chunk-ydjy26ch.js +2 -0
  138. package/dist/{chunk-k44qj40k.js → chunk-ym5qgw03.js} +2 -2
  139. package/dist/chunk-yx37mvy7.js +2 -0
  140. package/dist/{chunk-na1x46xm.js → chunk-z0qfspzg.js} +3 -3
  141. package/dist/chunk-z278w3cb.js +2 -0
  142. package/dist/chunk-z33esms3.js +3 -0
  143. package/dist/{chunk-fx8jjasv.js → chunk-z46mk8ym.js} +4 -4
  144. package/dist/chunk-znfzh6fm.js +2 -0
  145. package/dist/chunk-zteccxj9.js +2 -0
  146. package/dist/cli.js +20 -20
  147. package/dist/component-renderer.d.ts +1 -0
  148. package/dist/component-renderer.js +28 -4
  149. package/dist/craft-entry.js +2 -2
  150. package/dist/craft.js +2 -2
  151. package/dist/pwa.js +3 -3
  152. package/dist/safe-evaluator.d.ts +10 -0
  153. package/dist/safe-evaluator.js +24 -5
  154. package/dist/server-bindings.d.ts +11 -0
  155. package/dist/server-bindings.js +27 -0
  156. package/dist/ssg.js +15 -15
  157. package/dist/stx-virtual-ts.d.ts +31 -0
  158. package/dist/stx-virtual-ts.js +49 -2
  159. package/dist/typecheck.d.ts +1 -1
  160. package/dist/typecheck.js +5 -4
  161. package/package.json +5 -5
  162. package/dist/chunk-056rsqc6.js +0 -20
  163. package/dist/chunk-0d4zhbjz.js +0 -2
  164. package/dist/chunk-0ey7kc6t.js +0 -3
  165. package/dist/chunk-11snc6n0.js +0 -2
  166. package/dist/chunk-1menbxwb.js +0 -2
  167. package/dist/chunk-1pf4y2yr.js +0 -2
  168. package/dist/chunk-2sxmmjt1.js +0 -2
  169. package/dist/chunk-34afrhts.js +0 -2
  170. package/dist/chunk-37bzsnr7.js +0 -2
  171. package/dist/chunk-3m6n90sk.js +0 -2
  172. package/dist/chunk-4q4mtrc5.js +0 -2
  173. package/dist/chunk-5bm8hmwd.js +0 -2
  174. package/dist/chunk-5r2z29n8.js +0 -2
  175. package/dist/chunk-660preb9.js +0 -2
  176. package/dist/chunk-6hd83cj4.js +0 -2
  177. package/dist/chunk-740njbwc.js +0 -2
  178. package/dist/chunk-77fs8281.js +0 -2
  179. package/dist/chunk-7c73t536.js +0 -2
  180. package/dist/chunk-84gg2atb.js +0 -2
  181. package/dist/chunk-86z8zrn9.js +0 -3
  182. package/dist/chunk-9c6yvh3p.js +0 -2
  183. package/dist/chunk-9f0pv6sz.js +0 -2
  184. package/dist/chunk-9fxeqf0e.js +0 -2
  185. package/dist/chunk-atsjexk0.js +0 -2
  186. package/dist/chunk-bcefawtc.js +0 -2
  187. package/dist/chunk-bkqqa8aw.js +0 -2
  188. package/dist/chunk-bmds786f.js +0 -2
  189. package/dist/chunk-c0azgkss.js +0 -2
  190. package/dist/chunk-cbz7jtzf.js +0 -2
  191. package/dist/chunk-e1n286mv.js +0 -2
  192. package/dist/chunk-evdskc25.js +0 -2
  193. package/dist/chunk-f8akfzzn.js +0 -2
  194. package/dist/chunk-f8wmxwa3.js +0 -2
  195. package/dist/chunk-fseqwysr.js +0 -2
  196. package/dist/chunk-gg48cgx3.js +0 -2
  197. package/dist/chunk-h8zb6cek.js +0 -2
  198. package/dist/chunk-hc4ydhw0.js +0 -2
  199. package/dist/chunk-j08r18x1.js +0 -2
  200. package/dist/chunk-j539dz72.js +0 -2
  201. package/dist/chunk-jqngvqby.js +0 -2
  202. package/dist/chunk-k33kgf8a.js +0 -2
  203. package/dist/chunk-kz7ha54c.js +0 -2
  204. package/dist/chunk-m7cbkrz6.js +0 -2
  205. package/dist/chunk-md8dj6tb.js +0 -2
  206. package/dist/chunk-na1v2jcy.js +0 -2
  207. package/dist/chunk-p2fkggw4.js +0 -3
  208. package/dist/chunk-pqqyjvq9.js +0 -2
  209. package/dist/chunk-q18508s2.js +0 -2
  210. package/dist/chunk-qczgdzjk.js +0 -2
  211. package/dist/chunk-r40g6785.js +0 -2
  212. package/dist/chunk-r6085mp4.js +0 -2
  213. package/dist/chunk-rke4q3jk.js +0 -2
  214. package/dist/chunk-rrnvbwac.js +0 -2
  215. package/dist/chunk-shnw9geh.js +0 -42
  216. package/dist/chunk-te1wksa0.js +0 -2
  217. package/dist/chunk-v11hvvxc.js +0 -2
  218. package/dist/chunk-vasvns9e.js +0 -2
  219. package/dist/chunk-vdb3p2v3.js +0 -2
  220. package/dist/chunk-vm2y05sr.js +0 -2
  221. package/dist/chunk-x2wn6mpd.js +0 -2
  222. package/dist/chunk-x45mp78q.js +0 -2
  223. package/dist/chunk-xa2qfe51.js +0 -3
  224. package/dist/chunk-xsmyhp5f.js +0 -2
  225. package/dist/chunk-zecffe6a.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{nt}from"./chunk-t4dkcf28.js";import{yt,qn}from"./chunk-ga650crj.js";import{Ir,Or,Nr,Mr,Ce}from"./chunk-eg2p1cyw.js";import{Me,yn,sl,ol}from"./chunk-ynnd6nnt.js";import{D}from"./chunk-46t924aw.js";import{Ei}from"./chunk-gpkxphqz.js";import{b}from"./chunk-8vkywnpx.js";import{i}from"./chunk-c7qej674.js";import{F,a}from"./chunk-rtsshvpt.js";import{$c}from"./chunk-nws4zm4k.js";import{Nn,Dn,qe,Te,ma,ha,Mn}from"./chunk-ke76eaat.js";import{cn,Do}from"./chunk-54p27ney.js";import{Ln}from"./chunk-12r22pf0.js";import{en,tr,nr}from"./chunk-86z8zrn9.js";import{G}from"./chunk-0zgxxhvs.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?qn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);sl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>Me(R))),{context:A}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...F,..._,...o,buildMode:"compile",strict:!1},f=await i(e,A,r,j,w),C=Nn(f)+Dn(f)+qe(f),P=ol();return{route:l,sourceFile:n,html:f,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:yn(e),streamTemplates:A.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function lm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Mr,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=Ln(w),f=n.serverApi??e.serverApi,C=typeof f==="object"?f:{};if(f)cn(o,C);if(e.runtimeConfig)D(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of B){let h=j(s.pattern),O=h.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Nr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ir(t.html,u);if(g.htmlAttrs)t.html=Or(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Mn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,A,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:h}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let E=nr(o);if(E){let{copied:s,bytes:h}=Z(E,c.join(r,"public",tr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${en}/`)}let N={runtime:v.filename,router:x.filename},T=ma(H,N,r);if(T.routeRules=w,T.routerContainer=A,f)T.apiRoutes=await Do(o,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ei(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify($c(e._layerGraph),null,2));ha(T,r);let K=Date.now()-l;return console.log(`
3
- [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:N,outputDir:r,duration:K}}
4
- export{lm};
2
+ import{nt}from"./chunk-8cvgm13s.js";import{bt,qn}from"./chunk-tm1ec751.js";import{Ir,Or,Nr,Dr,Ce}from"./chunk-k47addf7.js";import{De,yn,ol,il}from"./chunk-xe8m66a3.js";import{M}from"./chunk-v4bqmzj9.js";import{Ti}from"./chunk-qahz3n8z.js";import{b}from"./chunk-ar1prdev.js";import{i}from"./chunk-xa1f13nk.js";import{F,a}from"./chunk-9mryv01z.js";import{Rc}from"./chunk-2rg9pqmh.js";import{Nn,Mn,qe,Te,ha,ya,Dn}from"./chunk-918ws1g7.js";import{ln,Mo}from"./chunk-qa1pcm7n.js";import{Ln}from"./chunk-12r22pf0.js";import{tn,tr,nr}from"./chunk-cwt26rvt.js";import{X}from"./chunk-eh8g8kr1.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?qn():bt(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=nt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);ol();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Nn(f)+Mn(f)+qe(f),j=il();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:yn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function um(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Dr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Ln(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)ln(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let h=T(s.pattern),O=h.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Nr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ir(t.html,u);if(g.htmlAttrs)t.html=Or(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Dn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:h}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let E=nr(o);if(E){let{copied:s,bytes:h}=Z(E,c.join(r,"public",tr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${tn}/`)}let N={runtime:v.filename,router:x.filename},C=ha(H,N,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Mo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ti(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Rc(e._layerGraph),null,2));ya(C,r);let K=Date.now()-l;return console.log(`
3
+ [stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
4
+ export{um};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ro,ji,Pg,Ig,Og}from"./chunk-s0pnyd2f.js";import"./chunk-t23jn83r.js";export{Ig as generateManifestLink,ro as generatePwaTags,Pg as generateSwRegistrationScript,Og as generateThemeColorMeta,ji as injectPwaTags};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Am(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 Pm(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 Pm(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 Im(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function Om(){return`
289
+ `}function Im(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 Om(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function Nm(){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 Nm(){return`
314
+ `}function Mm(){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 Dm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function Mm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
- export{Am,Pm,Im,Om,Nm,Dm,Mm};
350
+ `}function Dm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function Lm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
+ export{Pm,Im,Om,Nm,Mm,Dm,Lm};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import t from"fs";import r from"path";var tn="resources/assets",tr="assets";function nr(o=process.cwd()){let s=r.resolve(o,tn);return t.existsSync(s)&&t.statSync(s).isDirectory()?s:null}
3
+ export{tn,tr,nr};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xe,Gs,kg,iy,_g,ay,Sn,p,W,Q,kn,ke,Cg,Ci,Eg,cy,E,Ei,Tg,ly,A,uy}from"./chunk-xe8m66a3.js";import"./chunk-qahz3n8z.js";import"./chunk-v4bqmzj9.js";import"./chunk-k47addf7.js";import"./chunk-xppm4cs4.js";import"./chunk-agbkv9ab.js";export{Tg as applyFilters,ay as clearCustomFilters,Cg as clientLoopScopes,Gs as defaultFilters,kn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,A as evaluateExpression,xe as findMustacheEnd,_g as getAllFilters,Eg as interpolateScriptAttributes,Ci as interpolateScriptExpressions,cy as interpolateScriptsInTemplate,E as processExpressions,Ei as processExpressionsChunked,kg as registerFilter,iy as registerFilters,Sn as replaceInterpolations,ly as resetRejectedExpressionWarnings,uy as unescapeHtml,ke as usesSignalsInScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ai,ci,_t,de,hr,Ps,yr,Is,Os,Jf,Yf,Zf,br,Qf,eg,tg,ng,Ac,Pc,Ic,li,Oc,rg,Ct,Et,Tt,$t,Rt,At,nt,sg}from"./chunk-8cvgm13s.js";export{yr as Router,tg as abortNavigation,Ps as bracketPathToRegex,Ct as clearMiddleware,Pc as createClientCookieManager,Rt as createMiddlewareContext,$t as createRouteLocation,Ac as createServerCookieManager,Ic as createStorageManager,ng as defineMiddleware,Yf as defineRoute,Zf as defineRoutes,Is as findErrorPage,Os as formatRoutes,ci as generateRouteManifest,ai as generateRouteTypes,Oc as getMiddleware,Et as getMiddlewareNames,nt as getRouterScript,sg as getRouterScriptDev,rg as hasMiddleware,_t as isFileRequestPath,Tt as loadMiddlewareFromDirectory,hr as matchRoute,eg as navigateTo,de as patternToRegex,li as registerMiddleware,Qf as resetRoutes,br as route,At as runMiddleware,Jf as setAppUrl};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{H,L,jr,Br,Fr}from"./chunk-5wr1qqz3.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Bi{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return jr(e,s,"image",this.config)}async set(e,s,r){return Br(e,s,r,"image",this.config)}async clear(){return Fr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Bi(e);else if(e)w.updateConfig(e);return w}async function Fi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function zi(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function jg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Bg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Fi(e,s,r);if(a)return a;try{let c=S(e);if(!await L(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await H(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Rl(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await zi(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Fg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Rl(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as V}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function zg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await L(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await V(p,{recursive:!0});let d=await H(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await L(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Hg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Bi,Fi,zi,jg,Bg,Fg,Rl,zg,Hg};
2
+ import{H,L,jr,Br,Fr}from"./chunk-5wr1qqz3.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Fi{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return jr(e,s,"image",this.config)}async set(e,s,r){return Br(e,s,r,"image",this.config)}async clear(){return Fr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Fi(e);else if(e)w.updateConfig(e);return w}async function zi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Hi(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Bg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Fg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await zi(e,s,r);if(a)return a;try{let c=S(e);if(!await L(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await H(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Al(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Hi(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function zg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Al(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as V}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function Hg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await L(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await V(p,{recursive:!0});let d=await H(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await L(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Vg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Fi,zi,Hi,Bg,Fg,zg,Al,Hg,Vg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{rs,ss}from"./chunk-rqjskxpw.js";import{y}from"./chunk-ynnd6nnt.js";import{a}from"./chunk-rtsshvpt.js";import{Xe,se}from"./chunk-fez9828r.js";import{tc}from"./chunk-jmshgw0t.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var wu=`
2
+ import{rs,ss}from"./chunk-0dnetjh8.js";import{y}from"./chunk-xe8m66a3.js";import{a}from"./chunk-9mryv01z.js";import{Ge,se}from"./chunk-t74qb5ej.js";import{nc}from"./chunk-td6b41vj.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var vu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -468,7 +468,7 @@ else if (data.type === 'event' && data.method) {
468
468
  }
469
469
  })();
470
470
  </script>
471
- `;function Ta(e={}){let{debug:r=!1,timeout:i=30000}=e;return wu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Ch(){return!1}function Eh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ta(t)})}function $a(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=Ta(r),n=O(e,"head",`${i}
471
+ `;function $a(e={}){let{debug:r=!1,timeout:i=30000}=e;return vu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Eh(){return!1}function Th(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return $a(t)})}function Ra(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=$a(r),n=O(e,"head",`${i}
472
472
  `);if(n!==null)return n;let s=B(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
473
473
  ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
474
474
  <input type="checkbox" class="craft-checkbox" ${i} ${n}>
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
902
902
  }
903
903
  }
904
904
  </style>
905
- `,Ra=`
905
+ `,Aa=`
906
906
  <script id="craft-component-runtime">
907
907
  (function() {
908
908
  if (window.__stxCraftComponentRuntime) return;
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
1006
1006
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
1007
1007
  })();
1008
1008
  </script>
1009
- `;function Aa(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${ns}
1010
- `)??ns+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Ra}
1011
- `)??e+Ra;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||To[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
1009
+ `;function Pa(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${ns}
1010
+ `)??ns+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Aa}
1011
+ `)??e+Aa;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||To[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
1012
1012
  ${b}
1013
1013
  ${m}
1014
1014
  </aside>
@@ -1029,7 +1029,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
1029
1029
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(e.icon)}"${i}></span>`:""}
1030
1030
  <span class="craft-sidebar-item-label">${T(e.label)}</span>
1031
1031
  ${e.badge?`<span class="craft-sidebar-item-badge">${T(e.badge)}</span>`:""}
1032
- </button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(e){return T(e).replace(/`/g,"&#96;")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function Th(e,r){To[e]=r}function $h(){return{...To}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${p}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
1032
+ </button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(e){return T(e).replace(/`/g,"&#96;")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function $h(e,r){To[e]=r}function Rh(){return{...To}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${p}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
1033
1033
  ${i(u,f,`${t}.${l}`)}`);return p.length?`${s}<${d}>
1034
1034
  ${p.join(`
1035
1035
  `)}
@@ -1038,8 +1038,8 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
1038
1038
  <plist version="1.0">
1039
1039
  ${i(e,"","infoPlist")}
1040
1040
  </plist>
1041
- `}async function Pa(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await tc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=$a(o,{debug:e.verbose}),o=Aa(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${ns}
1042
- </head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||Ia(e.runtimeProfile);if(!p)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=rs(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=Xe("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
1041
+ `}async function Ia(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await nc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Ra(o,{debug:e.verbose}),o=Pa(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${ns}
1042
+ </head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||Oa(e.runtimeProfile);if(!p)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=rs(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=Ge("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
1043
1043
  import * as backend from ${JSON.stringify(X(t.backend.entry))}
1044
1044
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
1045
1045
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
@@ -1076,7 +1076,7 @@ Name=${r}
1076
1076
  Exec=${u}
1077
1077
  Terminal=false
1078
1078
  Categories=Utility;
1079
- `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Ia(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(ye()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return ss({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=Xe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,h));let m=`#!/bin/bash
1079
+ `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Oa(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(ye()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return ss({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=Ge("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,h));let m=`#!/bin/bash
1080
1080
  exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(p,i.toLowerCase()),m),I(c(p,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
1081
1081
  Version: ${n}
1082
1082
  Section: utils
@@ -1085,7 +1085,7 @@ Architecture: amd64
1085
1085
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
1086
1086
  Maintainer: ${s.author||"Unknown"}
1087
1087
  Description: ${s.description||i}
1088
- `;g("fs").writeFileSync(c(f,"control"),v);let k=_("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(se(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{se(o),t({success:!1,error:h.message})})}catch(d){se(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=Xe("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),f=c(d,"bin"),p=c(d,"share");S(f,{recursive:!0}),S(p,{recursive:!0});let l=c(p,i.toLowerCase());S(l,{recursive:!0});let u=g("fs").readdirSync(e);for(let h of u)P(c(e,h),c(l,h));let b=`#!/bin/bash
1088
+ `;g("fs").writeFileSync(c(f,"control"),v);let k=_("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(se(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{se(o),t({success:!1,error:h.message})})}catch(d){se(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=Ge("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),f=c(d,"bin"),p=c(d,"share");S(f,{recursive:!0}),S(p,{recursive:!0});let l=c(p,i.toLowerCase());S(l,{recursive:!0});let u=g("fs").readdirSync(e);for(let h of u)P(c(e,h),c(l,h));let b=`#!/bin/bash
1089
1089
  SELF=$(readlink -f "$0")
1090
1090
  HERE=\${SELF%/*}
1091
1091
  export PATH="\${HERE}/usr/bin:\${PATH}"
@@ -1097,5 +1097,5 @@ Exec=${i.toLowerCase()}
1097
1097
  Terminal=false
1098
1098
  Categories=Utility;
1099
1099
  Icon=${i.toLowerCase()}
1100
- `;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(se(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{se(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){se(t),s({success:!1,error:o.message})}})}function Oa(){return[q()]}function Na(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:Pa,getAvailableTargets:Oa,getAvailableFormats:Na,detectPlatform:q},Rh=qe;
1101
- export{wu,Ta,Ch,Eh,$a,To,ns,Ra,Aa,Th,$h,Pa,Ia,Oa,Na,Rh};
1100
+ `;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(se(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{se(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){se(t),s({success:!1,error:o.message})}})}function Na(){return[q()]}function Ma(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:Ia,getAvailableTargets:Na,getAvailableFormats:Ma,detectPlatform:q},Ah=qe;
1101
+ export{vu,$a,Eh,Th,Ra,To,ns,Aa,Pa,$h,Rh,Ia,Oa,Na,Ma,Ah};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function va(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 xm=new a;var u=va({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=va({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{va,xm};
2
+ function xa(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 Sm=new a;var u=xa({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=xa({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{xa,Sm};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{yr}from"./chunk-t4dkcf28.js";import{Pr}from"./chunk-eg2p1cyw.js";import{a}from"./chunk-rtsshvpt.js";import{B,Ze}from"./chunk-ybq56wam.js";import{yc}from"./chunk-dv9q56r7.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function dr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new yr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function we(e){return e.includes("data-stx-runtime")}function mc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=dr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{yr}from"./chunk-8cvgm13s.js";import{Pr}from"./chunk-k47addf7.js";import{a}from"./chunk-9mryv01z.js";import{B,Ze}from"./chunk-ybq56wam.js";import{bc}from"./chunk-s37af6rd.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function dr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new yr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function we(e){return e.includes("data-stx-runtime")}function hc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=dr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=Pr(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(B(e))return Ze(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function pr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-e1n286mv.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-e1n286mv.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function hc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${yc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function pr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-w8aj3f9v.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-w8aj3f9v.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function yc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${bc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-e1n286mv.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-w8aj3f9v.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${g(i)};</script>
12
- `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-e1n286mv.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
12
+ `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-w8aj3f9v.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
13
13
  </body>`+e.slice(d+7)}
14
- export{dr,G,we,mc,pr,hc,ve};
14
+ export{dr,X,we,hc,pr,yc,ve};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fi,zi,Hi,Bg,Fg,zg,Al,Hg,Vg}from"./chunk-e105xsee.js";export{Fi as ImageProcessorCache,Al as applyTransformations,Bg as clearImageCache,Hg as generateResponsiveVariants,Vg as generateSrcset,zi as getCachedImageResult,zg as optimizeImage,Fg as processImage,Hi as setCachedImageResult};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ee,te,ne,jn,he,$e,mt,Jt,Bn,Fn,zn,re,Hn,Vn}from"./chunk-jh36gqcq.js";import{St}from"./chunk-b1q40vq4.js";function Dl(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ne,placeholder:l="none",formats:f=te,widths:y=ee,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Fn(r),v=Bn(r),w=typeof m==="object"?Jt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=mt(z),Y=re(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
2
+ import{ee,te,ne,jn,he,$e,ht,Yt,Bn,Fn,zn,re,Hn,Vn}from"./chunk-422r7zkx.js";import{kt}from"./chunk-anva219c.js";function Dl(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ne,placeholder:l="none",formats:f=te,widths:y=ee,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Fn(r),v=Bn(r),w=typeof m==="object"?Yt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=ht(z),Y=re(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
3
3
  #${k} {
4
4
  position: relative;
5
5
  background-image: url('${e.placeholder}');
@@ -23,14 +23,14 @@ ${M.join(`
23
23
  src="${v?.url||t}"
24
24
  alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
25
25
  />
26
- </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=re(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ne,formats:u=te,widths:l=ee,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Jt(a):a,C=`
26
+ </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=re(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ne,formats:u=te,widths:l=ee,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Yt(a):a,C=`
27
27
  data-stx-image
28
28
  data-src="${r}"
29
29
  data-sizes="${R}"
30
30
  data-quality="${o}"
31
31
  data-formats="${u.join(",")}"
32
32
  data-widths="${l.join(",")}"
33
- `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function ca(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Ml(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=ca(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function Ll(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await $e(s,r);return D.set(e,t),t}catch{return null}}function la(){return St({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:ee),formats:a.formats||te,quality:a.quality||ne,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await he())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return ae(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=se(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function se(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ae(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=mt(p),w=re(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
33
+ `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function la(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Ll(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=la(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function jl(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await $e(s,r);return D.set(e,t),t}catch{return null}}function ua(){return kt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:ee),formats:a.formats||te,quality:a.quality||ne,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await he())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return ae(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=se(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function se(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ae(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=ht(p),w=re(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
34
34
  `;if(d+=l.join(`
35
35
  `)+`
36
36
  `,d+=` <img ${c.join(" ")} />
@@ -39,5 +39,5 @@ ${d}
39
39
  </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
40
  ${d}
41
41
  </div>`}}if(e.priority&&y){let g=re(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var jl=la();import P from"fs";import j from"path";function Bl(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=te,widths:a=ee,quality:i=ne,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await he()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await jn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await he())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await $e(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Hn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Vn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&zn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Fl(s,r,e={}){if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return $e(s,{...e,outputDir:r})}async function zl(s,r,e={}){let{formats:t=te,widths:n=ee,quality:a=ne,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await $e(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ua(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Hl(s,r){let e=ua(s);await Bun.write(r,JSON.stringify(e,null,2))}var sm={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
- export{Dl,ca,Ml,Ll,la,jl,Bl,Fl,zl,ua,Hl,sm};
42
+ `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Bl=ua();import P from"fs";import j from"path";function Fl(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=te,widths:a=ee,quality:i=ne,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await he()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await jn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await he())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await $e(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Hn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Vn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&zn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function zl(s,r,e={}){if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return $e(s,{...e,outputDir:r})}async function Hl(s,r,e={}){let{formats:t=te,widths:n=ee,quality:a=ne,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await he())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await $e(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function da(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Vl(s,r){let e=da(s);await Bun.write(r,JSON.stringify(e,null,2))}var om={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
+ export{Dl,la,Ll,jl,ua,Bl,Fl,zl,Hl,da,Vl,om};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function Yl(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
- export{Yl};
2
+ import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function Zl(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
+ export{Zl};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import d from"fs";import l from"path";function Cl(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function El(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function Tl(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function $g(n,s){let e=Cl(n),a=s&&d.existsSync(s)?El(s):[];return Tl([...e,...a])}function Rg(n){let s=[];s.push(`
2
+ import d from"fs";import l from"path";function El(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function Tl(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function $l(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function Rg(n,s){let e=El(n),a=s&&d.existsSync(s)?Tl(s):[];return $l([...e,...a])}function Ag(n){let s=[];s.push(`
3
3
  === PWA Audit Report ===
4
4
  `);let e=n.score>=90?"32":n.score>=70?"33":"31";s.push(`Score: \x1B[${e}m${n.score}/100\x1B[0m`),s.push(`Passed: ${n.passed} | Failed: ${n.failed} | Warnings: ${n.warnings}
5
5
  `);let a=["required","recommended","optional"];for(let t of a){let c=n.checks.filter((o)=>o.category===t);if(c.length===0)continue;s.push(`
6
6
  ${t.toUpperCase()}:`);for(let o of c){let u=o.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(s.push(` ${u} ${o.name}: ${o.message}`),o.details)s.push(` ${o.details}`)}}return s.push(""),s.join(`
7
7
  `)}
8
- export{Cl,El,Tl,$g,Rg};
8
+ export{El,Tl,$l,Rg,Ag};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{go,aa,Kr,mo,ho,On,Xt,ca,Gr,Xr,yo,bo,rm,sm,gt}from"./chunk-gwdffrz6.js";export{gt as DeployError,aa as calculateSha1,Kr as collectDeployFiles,Xr as createDefaultNetlifyConfig,mo as createFileManifest,go as createNetlifyClient,rm as deploy,Gr as detectProjectConfig,ho as filterRequiredFiles,On as formatSize,ca as generateNetlifyToml,Xt as getTotalSize,bo as hasNetlifyConfig,sm as initNetlify,yo as writeNetlifyConfig};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Vr}from"./chunk-emf6ee94.js";import{existsSync as m,statSync as x}from"fs";import s from"path";var g=new Map;function M(r){let n=s.extname(r);if(n===".tsx")return"tsx";if(n===".jsx")return"jsx";if(n===".ts"||n===".mts"||n===".cts")return"ts";return"js"}async function j(r,n){let l=Object.entries(n).map(([e,t])=>[s.resolve(r,e),s.resolve(r,t)]),d=l.map(([e,t])=>{try{return`${e}\x00${t}\x00${x(t).mtimeMs}`}catch{return`${e}\x00${t}\x00-`}}).join(`
2
+ import{Vr}from"./chunk-gsrdjmw9.js";import{existsSync as m,statSync as x}from"fs";import s from"path";var g=new Map;function M(r){let n=s.extname(r);if(n===".tsx")return"tsx";if(n===".jsx")return"jsx";if(n===".ts"||n===".mts"||n===".cts")return"ts";return"js"}async function j(r,n){let l=Object.entries(n).map(([e,t])=>[s.resolve(r,e),s.resolve(r,t)]),d=l.map(([e,t])=>{try{return`${e}\x00${t}\x00${x(t).mtimeMs}`}catch{return`${e}\x00${t}\x00-`}}).join(`
3
3
  `),f=`${r}\x00${JSON.stringify(n)}`,o=g.get(f);if(o&&o.signature===d)return o.standIns;let a=new Map;for(let[e,t]of l){let c=s.relative(r,e);if(!m(e))throw Error(`webModules: ${c} does not exist`);if(!m(t))throw Error(`webModules: ${s.relative(r,t)}, the stand-in for ${c}, does not exist`);if(e===t)throw Error(`webModules: ${c} stands in for itself`);let p=await Bun.file(t).text(),u=new Bun.Transpiler({loader:M(t),target:"browser"});if(s.dirname(t)!==s.dirname(e)){let i=u.scanImports(p).find((h)=>/^\.\.?\//.test(h.path));if(i)throw Error(`webModules: ${s.relative(r,t)} imports ${i.path}, which would resolve from ${s.relative(r,s.dirname(e))||"."}; a stand-in imports relatively only from the directory of the module it replaces`)}let w=u.transformSync(p);for(let i of Vr(e))a.set(i,w)}return g.set(f,{signature:d,standIns:a}),a}export{j as loadWebModules};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{bt,qn,wh}from"./chunk-tm1ec751.js";import{ue,Kn,vh,Gn,_o,Qr,es,xh,Sh,kh,Xn,Jn,Co,ts,_h}from"./chunk-h9gjt73q.js";import"./chunk-agbkv9ab.js";export{_o as batch,wh as default,Kn as derived,Gn as effect,bt as generateSignalsRuntime,qn as generateSignalsRuntimeDev,Jn as isDerived,Xn as isSignal,vh as memo,es as onDestroy,Qr as onMount,ts as peek,kh as pendingLifecycleCounts,Sh as runDestroyCallbacks,xh as runMountCallbacks,ue as state,Co as untrack,_h as useOptimistic};