@stacksjs/stx 0.2.414 → 0.2.416

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 (204) hide show
  1. package/dist/builtins/image-delivery.js +19 -11
  2. package/dist/chunk-02k2v1mb.js +2 -0
  3. package/dist/chunk-0dh1rgg8.js +2 -0
  4. package/dist/{chunk-eed4fwps.js → chunk-0es4h5v1.js} +2 -2
  5. package/dist/chunk-0hrqt5c2.js +2 -0
  6. package/dist/chunk-0vtk2rpr.js +2 -0
  7. package/dist/{chunk-mp6hy8g4.js → chunk-1ctvgd7v.js} +1 -1
  8. package/dist/chunk-1rd3jzrq.js +2 -0
  9. package/dist/{chunk-h0atqq82.js → chunk-26j2q9rq.js} +7 -7
  10. package/dist/chunk-2py27bzq.js +2 -0
  11. package/dist/{chunk-px7fvbj6.js → chunk-2qa7hjp2.js} +2 -2
  12. package/dist/chunk-35e6zj5x.js +2 -0
  13. package/dist/{chunk-g578mcb0.js → chunk-388rx71h.js} +6 -6
  14. package/dist/chunk-3ch40ebr.js +2 -0
  15. package/dist/{chunk-bay9s6rs.js → chunk-3g8zzdgs.js} +5 -5
  16. package/dist/{chunk-md8rqn48.js → chunk-3t0yaexe.js} +5 -5
  17. package/dist/{chunk-b84h16er.js → chunk-3wrmz1j9.js} +6 -6
  18. package/dist/{chunk-ak1cgcah.js → chunk-41k0th97.js} +4 -4
  19. package/dist/chunk-49cpqjx2.js +2 -0
  20. package/dist/chunk-4k1nkp9r.js +2 -0
  21. package/dist/chunk-50vq8k55.js +2 -0
  22. package/dist/chunk-56pkjk55.js +2 -0
  23. package/dist/chunk-5hnh00ry.js +2 -0
  24. package/dist/chunk-5j52h3e3.js +2 -0
  25. package/dist/chunk-5y1mekxe.js +2 -0
  26. package/dist/chunk-5zryk911.js +2 -0
  27. package/dist/{chunk-h6zsqb9r.js → chunk-6agy2x1f.js} +2 -2
  28. package/dist/chunk-72w28vm8.js +2 -0
  29. package/dist/{chunk-3kthfs03.js → chunk-7mbpjv9e.js} +2 -2
  30. package/dist/chunk-7s7k94as.js +2 -0
  31. package/dist/{chunk-9g27ybyr.js → chunk-7tabykst.js} +2 -2
  32. package/dist/chunk-7wb6jf17.js +2 -0
  33. package/dist/{chunk-e57rhf65.js → chunk-7zjvsacw.js} +2 -2
  34. package/dist/{chunk-fh1qrp68.js → chunk-89xcpdsp.js} +5 -5
  35. package/dist/chunk-8cbkqckh.js +2 -0
  36. package/dist/chunk-8ycy1b0e.js +2 -0
  37. package/dist/chunk-8ygks6dx.js +3 -0
  38. package/dist/{chunk-rs4v4fha.js → chunk-95165j9c.js} +2 -2
  39. package/dist/{chunk-pqxzp1bb.js → chunk-9fyss0yk.js} +2 -2
  40. package/dist/{chunk-q4c06e8x.js → chunk-9rnh52t2.js} +10 -10
  41. package/dist/{chunk-169n1vpx.js → chunk-9t2xx2y4.js} +3 -3
  42. package/dist/{chunk-6sgswrqw.js → chunk-a47yp92z.js} +5 -5
  43. package/dist/{chunk-765e1s44.js → chunk-ae7j3n39.js} +6 -6
  44. package/dist/chunk-aqrnpgn7.js +2 -0
  45. package/dist/{chunk-dvgv8nry.js → chunk-at0ar6t3.js} +3 -3
  46. package/dist/chunk-b9rebdtq.js +2 -0
  47. package/dist/{chunk-7gkv67ky.js → chunk-bfjzfrw3.js} +2 -2
  48. package/dist/{chunk-z0g9jvv0.js → chunk-c4bkj1xw.js} +6 -6
  49. package/dist/chunk-c4thhfx9.js +2 -0
  50. package/dist/{chunk-6hc5vz20.js → chunk-cn9hgyh5.js} +2 -2
  51. package/dist/{chunk-pgzvyrv6.js → chunk-cq408jrm.js} +3 -3
  52. package/dist/chunk-cw6kqb63.js +2 -0
  53. package/dist/chunk-d3vtgnep.js +2 -0
  54. package/dist/chunk-d4ynv4z2.js +2 -0
  55. package/dist/chunk-d7xrewxq.js +2 -0
  56. package/dist/{chunk-q9bdh4s5.js → chunk-dd5fa7d6.js} +2 -2
  57. package/dist/{chunk-shr559s7.js → chunk-ddk6fx5b.js} +2 -2
  58. package/dist/{chunk-8nhshfz6.js → chunk-de2pv6ys.js} +2 -2
  59. package/dist/{chunk-69mc2np8.js → chunk-dg1n3g1d.js} +172 -172
  60. package/dist/chunk-ecr598p7.js +2 -0
  61. package/dist/chunk-eev80mpy.js +2 -0
  62. package/dist/chunk-ef5vz9w5.js +2 -0
  63. package/dist/chunk-f5qd84w8.js +2 -0
  64. package/dist/{chunk-gawrg4gb.js → chunk-fctjn68q.js} +6 -6
  65. package/dist/{chunk-amd6ey3t.js → chunk-fkhxz1dx.js} +5 -5
  66. package/dist/chunk-g69tnqga.js +2 -0
  67. package/dist/chunk-gacycmb0.js +2 -0
  68. package/dist/chunk-ggywfyzm.js +2 -0
  69. package/dist/chunk-gp1bhn7t.js +2 -0
  70. package/dist/{chunk-vgvtnwxa.js → chunk-gq97zh73.js} +3 -3
  71. package/dist/chunk-gr3r9xdh.js +2 -0
  72. package/dist/{chunk-ngc2wke4.js → chunk-gxrewzhv.js} +2 -2
  73. package/dist/{chunk-scezfp0w.js → chunk-gyv1t0f0.js} +5 -5
  74. package/dist/{chunk-340a824p.js → chunk-h8wegkb5.js} +1 -1
  75. package/dist/{chunk-v091jft4.js → chunk-hec0bvvf.js} +1 -1
  76. package/dist/chunk-hg1eq72d.js +2 -0
  77. package/dist/chunk-hvyqs5tf.js +2 -0
  78. package/dist/{chunk-y5310237.js → chunk-j8rxdbe5.js} +2 -2
  79. package/dist/{chunk-5qns2sdz.js → chunk-jr4dwkvc.js} +2 -2
  80. package/dist/chunk-kbysqxmd.js +2 -0
  81. package/dist/chunk-kmnsrvrp.js +2 -0
  82. package/dist/chunk-m6fvj7g1.js +2 -0
  83. package/dist/{chunk-j03revz2.js → chunk-m9xdkzm6.js} +3 -3
  84. package/dist/chunk-mgw2cvb7.js +2 -0
  85. package/dist/chunk-mvwt1c8f.js +2 -0
  86. package/dist/{chunk-daz5aqcf.js → chunk-n5k88y07.js} +3 -3
  87. package/dist/{chunk-r3f9jcf7.js → chunk-nj8edn4m.js} +3 -3
  88. package/dist/chunk-nvh31cxn.js +2 -0
  89. package/dist/{chunk-fr2txj8q.js → chunk-p1tb8kxq.js} +4 -4
  90. package/dist/chunk-p34gbb4z.js +2 -0
  91. package/dist/chunk-peyt18ce.js +2 -0
  92. package/dist/{chunk-d44b9ktb.js → chunk-ppse812s.js} +1 -1
  93. package/dist/{chunk-752hw7cd.js → chunk-qff4qkx5.js} +3 -3
  94. package/dist/chunk-qpx8kvd8.js +2 -0
  95. package/dist/{chunk-f46qsp4m.js → chunk-qzkebqm3.js} +2 -2
  96. package/dist/chunk-rb272g9d.js +3 -0
  97. package/dist/{chunk-m4sk62wb.js → chunk-rfdqrv5v.js} +4 -4
  98. package/dist/{chunk-9vrja6vp.js → chunk-rg6csnkw.js} +1 -1
  99. package/dist/chunk-rh1dyfsn.js +2 -0
  100. package/dist/{chunk-czxt605c.js → chunk-rhw7pqhy.js} +4 -4
  101. package/dist/{chunk-thyt8ed8.js → chunk-rp4khnan.js} +3 -3
  102. package/dist/{chunk-s5xezjps.js → chunk-rqc4jx2v.js} +1 -1
  103. package/dist/chunk-rspc8gn8.js +2 -0
  104. package/dist/{chunk-2gr351s0.js → chunk-rv5bk83t.js} +2 -2
  105. package/dist/chunk-rvs61c88.js +2 -0
  106. package/dist/chunk-sf1vhfrb.js +2 -0
  107. package/dist/{chunk-yvx1ap9b.js → chunk-sh5c60a2.js} +2 -2
  108. package/dist/{chunk-ym95v4nc.js → chunk-std6xw3y.js} +2 -2
  109. package/dist/{chunk-pbh4smw3.js → chunk-t9axxwy9.js} +4 -4
  110. package/dist/{chunk-ynvdvbat.js → chunk-tc274fcv.js} +4 -4
  111. package/dist/{chunk-9pt8fd2n.js → chunk-tfhjbjq5.js} +3 -3
  112. package/dist/chunk-ty7t3gp4.js +3 -0
  113. package/dist/{chunk-6h38kkjf.js → chunk-v096a6fw.js} +6 -6
  114. package/dist/chunk-vc9wa97m.js +2 -0
  115. package/dist/{chunk-y1cmjvk3.js → chunk-vvp4cmfq.js} +5 -5
  116. package/dist/{chunk-t4hzprsm.js → chunk-vvs75dse.js} +2 -2
  117. package/dist/{chunk-qet5gc6s.js → chunk-wjag92ch.js} +73 -73
  118. package/dist/chunk-wjzqz3yr.js +2 -0
  119. package/dist/{chunk-xtdw3692.js → chunk-wpe72ann.js} +5 -5
  120. package/dist/{chunk-ej9j6k1q.js → chunk-x0mq57pe.js} +2 -2
  121. package/dist/chunk-x7j0krz8.js +2 -0
  122. package/dist/chunk-xkv0evbf.js +2 -0
  123. package/dist/{chunk-x0q32ees.js → chunk-y5cqkmkf.js} +2 -2
  124. package/dist/{chunk-mepdnezf.js → chunk-y6rahx7t.js} +5 -5
  125. package/dist/{chunk-yazk54jr.js → chunk-yk63jd7v.js} +1 -1
  126. package/dist/chunk-yt452b4a.js +2 -0
  127. package/dist/{chunk-sd47dzs0.js → chunk-yt6h8c6g.js} +11 -11
  128. package/dist/chunk-yxfx44fv.js +2 -0
  129. package/dist/{chunk-ce1sejr3.js → chunk-yzv8n6qw.js} +2 -2
  130. package/dist/{chunk-v4vaqxrf.js → chunk-zcctf7tx.js} +3 -3
  131. package/dist/{chunk-ft4p6d28.js → chunk-znbay168.js} +2 -2
  132. package/dist/{chunk-xfp7k0v8.js → chunk-zyxp0nb3.js} +7 -7
  133. package/dist/cli.js +20 -20
  134. package/dist/craft-entry.js +2 -2
  135. package/dist/craft.js +2 -2
  136. package/dist/dev-server/serve-app.js +3 -0
  137. package/dist/dev-server/serve-multi.js +1 -1
  138. package/dist/document-shell.js +15 -3
  139. package/dist/native/components/primitives.d.ts +2 -0
  140. package/dist/production-server.js +4 -4
  141. package/dist/pwa.js +3 -3
  142. package/dist/ssg.js +15 -15
  143. package/package.json +5 -5
  144. package/dist/chunk-020xyn9q.js +0 -3
  145. package/dist/chunk-04jhmfbz.js +0 -2
  146. package/dist/chunk-10957mcb.js +0 -2
  147. package/dist/chunk-1098mas0.js +0 -2
  148. package/dist/chunk-1b6t12hd.js +0 -2
  149. package/dist/chunk-1chw8xsw.js +0 -2
  150. package/dist/chunk-2ce7f416.js +0 -2
  151. package/dist/chunk-2mkcjw08.js +0 -2
  152. package/dist/chunk-2v8wztd5.js +0 -2
  153. package/dist/chunk-39g1134q.js +0 -2
  154. package/dist/chunk-3c74vag1.js +0 -2
  155. package/dist/chunk-3qn1wcdg.js +0 -2
  156. package/dist/chunk-3s2vnqcf.js +0 -2
  157. package/dist/chunk-48bwk47q.js +0 -2
  158. package/dist/chunk-4bjravgk.js +0 -2
  159. package/dist/chunk-4jjme6a5.js +0 -2
  160. package/dist/chunk-5g3y8kym.js +0 -2
  161. package/dist/chunk-5gsxpaqk.js +0 -2
  162. package/dist/chunk-6cfa3g0r.js +0 -2
  163. package/dist/chunk-6y8hnymb.js +0 -2
  164. package/dist/chunk-7z2ra0yf.js +0 -2
  165. package/dist/chunk-866n724v.js +0 -2
  166. package/dist/chunk-92ps1xpk.js +0 -2
  167. package/dist/chunk-9xrbve19.js +0 -2
  168. package/dist/chunk-afhxw2t8.js +0 -2
  169. package/dist/chunk-apg16xcn.js +0 -2
  170. package/dist/chunk-b52s5z0c.js +0 -2
  171. package/dist/chunk-bmt7w2pk.js +0 -2
  172. package/dist/chunk-btmhj5t7.js +0 -2
  173. package/dist/chunk-dgdm3hy3.js +0 -2
  174. package/dist/chunk-dx7n22ed.js +0 -2
  175. package/dist/chunk-f6az0xj5.js +0 -2
  176. package/dist/chunk-fjs0a8h7.js +0 -2
  177. package/dist/chunk-fyzajkrx.js +0 -2
  178. package/dist/chunk-fzapbw9p.js +0 -3
  179. package/dist/chunk-gw07qmjk.js +0 -2
  180. package/dist/chunk-hbxz85wy.js +0 -2
  181. package/dist/chunk-hjg3ndgh.js +0 -2
  182. package/dist/chunk-hkxsewzk.js +0 -2
  183. package/dist/chunk-hrbbbtbn.js +0 -2
  184. package/dist/chunk-j9qcrwbg.js +0 -2
  185. package/dist/chunk-jk4njz0w.js +0 -2
  186. package/dist/chunk-jmabeqfq.js +0 -2
  187. package/dist/chunk-jt0n43mk.js +0 -2
  188. package/dist/chunk-m1vdghnx.js +0 -2
  189. package/dist/chunk-mhq0pjws.js +0 -2
  190. package/dist/chunk-nn2vstke.js +0 -2
  191. package/dist/chunk-p2v2a68k.js +0 -2
  192. package/dist/chunk-pdt69hpb.js +0 -2
  193. package/dist/chunk-pj1wg7jg.js +0 -2
  194. package/dist/chunk-q6vrb2pe.js +0 -2
  195. package/dist/chunk-q7qchkvk.js +0 -2
  196. package/dist/chunk-qz519eyp.js +0 -2
  197. package/dist/chunk-s2x4wcrz.js +0 -2
  198. package/dist/chunk-sd321bn3.js +0 -2
  199. package/dist/chunk-se7mwqd1.js +0 -2
  200. package/dist/chunk-syaw6b75.js +0 -2
  201. package/dist/chunk-x5bpeb4a.js +0 -2
  202. package/dist/chunk-x72tv2cg.js +0 -3
  203. package/dist/chunk-ydjfar14.js +0 -2
  204. package/dist/chunk-z6d0jmjb.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ga,ma,ha,ya,ba,va,wa,xa,Sa,ka,hl}from"./chunk-v096a6fw.js";export{ga as createIslandRegistry,hl as default,ka as generateIslandManifest,ha as generatePartialHydrationCSS,va as hydrateAll,ba as hydrateByStrategy,ya as hydrateIsland,wa as isHydrated,xa as onHydrated,ma as processPartialHydrationDirectives,Sa as processStaticDirectives};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Y}from"./chunk-czxt605c.js";import{de,S}from"./chunk-ngc2wke4.js";import{fo}from"./chunk-ak1cgcah.js";import{o}from"./chunk-fzapbw9p.js";import v from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function yt(s,l={}){let i=m.resolve(s,l.dir??"server/api"),a=[],f=new Map;if(!v.existsSync(i))return a;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:i})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,I)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&I!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(i,e);P.add(m.resolve(R)),P.add(v.realpathSync(R)),a.push({pattern:w,method:g,filePath:R})}return a.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function Vr(s,l){let i=o(s,"api-types.d.ts"),a=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(i),t.filePath).replace(/\\/g,"/")}`,{params:p}=Y(t.pattern);a.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}a.push(" }","}","export {}","");let f=a.join(`
3
- `);if(!await Bun.file(i).exists()||await Bun.file(i).text()!==f)await Bun.write(i,f);return i}async function Ur(s,l,i={}){let a=yt(s,i);await Vr(s,a);let f=[];for(let t of a){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function j(s,l){let i=s.map((a)=>({route:a,...Y(a.pattern)}));return async(a)=>{let f=new URL(a.url).pathname,t=i.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=a.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(a,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Wr(s,l){return j(l,async(i)=>(await import(O(m.resolve(s,i.filePath)).href)).default)}async function Eu(s,l){if(!l)return async()=>null;let i=l===!0?{}:l,a=yt(s,i);return await Vr(s,a),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=yt(s,i);await Vr(s,t);let{loadStxConfig:e}=await import("./chunk-syaw6b75.js"),p=S((await e(s)).runtimeConfig);return await de(p,()=>j(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
- `));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function qr(s,l,i){if(fo(s))return!0;let a=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(a.test(m.basename(s)))return!0;try{if(a.test(m.basename(v.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!i)return!1;let f=m.resolve(l,typeof i==="object"?i.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
6
- export{yt,Vr,Ur,Wr,Eu,qr};
2
+ import{Y}from"./chunk-rhw7pqhy.js";import{de,S}from"./chunk-gxrewzhv.js";import{go}from"./chunk-41k0th97.js";import{o}from"./chunk-ty7t3gp4.js";import v from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function bt(s,l={}){let i=m.resolve(s,l.dir??"server/api"),a=[],f=new Map;if(!v.existsSync(i))return a;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:i})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,I)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&I!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(i,e);P.add(m.resolve(R)),P.add(v.realpathSync(R)),a.push({pattern:w,method:g,filePath:R})}return a.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function Ur(s,l){let i=o(s,"api-types.d.ts"),a=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(i),t.filePath).replace(/\\/g,"/")}`,{params:p}=Y(t.pattern);a.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}a.push(" }","}","export {}","");let f=a.join(`
3
+ `);if(!await Bun.file(i).exists()||await Bun.file(i).text()!==f)await Bun.write(i,f);return i}async function Wr(s,l,i={}){let a=bt(s,i);await Ur(s,a);let f=[];for(let t of a){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
+ `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function j(s,l){let i=s.map((a)=>({route:a,...Y(a.pattern)}));return async(a)=>{let f=new URL(a.url).pathname,t=i.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=a.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(a,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function qr(s,l){return j(l,async(i)=>(await import(O(m.resolve(s,i.filePath)).href)).default)}async function Tu(s,l){if(!l)return async()=>null;let i=l===!0?{}:l,a=bt(s,i);return await Ur(s,a),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=bt(s,i);await Ur(s,t);let{loadStxConfig:e}=await import("./chunk-5hnh00ry.js"),p=S((await e(s)).runtimeConfig);return await de(p,()=>j(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
+ `));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Xr(s,l,i){if(go(s))return!0;let a=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(a.test(m.basename(s)))return!0;try{if(a.test(m.basename(v.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!i)return!1;let f=m.resolve(l,typeof i==="object"?i.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
6
+ export{bt,Ur,Wr,qr,Tu,Xr};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{F}from"./chunk-eed4fwps.js";import S from"fs";import g from"path";import q from"crypto";var T=new Set(["webp","avif","jpeg","png"]),k=new Set(["cover","contain","fill","inside","outside"]),D=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),C=4096,U=80,A="cover";async function ei(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=L(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=S.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await S.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=q.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":F(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await N(),R=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,R),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Jo(e){return async(t)=>await ei(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function L(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!D.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??C,l=t.maxHeight??C,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!T.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...T].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??U;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||A;if(!k.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...k].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function N(){return await import("./chunk-04jhmfbz.js")}
3
- export{ei,Jo};
2
+ import{F}from"./chunk-0es4h5v1.js";import S from"fs";import g from"path";import q from"crypto";var T=new Set(["webp","avif","jpeg","png"]),k=new Set(["cover","contain","fill","inside","outside"]),D=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),C=4096,U=80,A="cover";async function ti(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=L(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=S.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await S.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=q.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":F(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await N(),R=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,R),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Yo(e){return async(t)=>await ti(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function L(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!D.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??C,l=t.maxHeight??C,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!T.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...T].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??U;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||A;if(!k.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...k].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function N(){return await import("./chunk-yt452b4a.js")}
3
+ export{ti,Yo};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ms,Ns,Qe,Y,bn,cr,vn,lr,ur,Ac,Pc,Ic,wn,Dc,Oc,Mc,Nc,Io,Do,Oo,Ls,Mo,Lc,et,tt,nt,rt,st,it,$e,jc}from"./chunk-rhw7pqhy.js";export{vn as Router,Mc as abortNavigation,cr as bracketPathToRegex,et as clearMiddleware,Do as createClientCookieManager,st as createMiddlewareContext,rt as createRouteLocation,Io as createServerCookieManager,Oo as createStorageManager,Nc as defineMiddleware,Pc as defineRoute,Ic as defineRoutes,lr as findErrorPage,ur as formatRoutes,Ns as generateRouteManifest,Ms as generateRouteTypes,Mo as getMiddleware,tt as getMiddlewareNames,$e as getRouterScript,jc as getRouterScriptDev,Lc as hasMiddleware,Qe as isFileRequestPath,nt as loadMiddlewareFromDirectory,bn as matchRoute,Oc as navigateTo,Y as patternToRegex,Ls as registerMiddleware,Dc as resetRoutes,wn as route,it as runMiddleware,Ac as setAppUrl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{R,It}from"./chunk-de2pv6ys.js";export{It as stripModuleImports,R as transformStoreImports};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as il}from"ts-broadcasting";import{Broadcast as ol,BroadcastServer as al}from"ts-broadcasting";var e=null,u=[];function Yc(){return e}async function Zc(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function Qc(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function el(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();Go(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function Go(n,t,r){if(!i())return;s.send(n,t,r)}function tl(n,t,r){if(!i())return;s.toUser(n,t,r)}function nl(n,t,r){if(!i())return;s.toUsers(n,t,r)}function rl(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function sl(n,t,r){if(!i())return;s.presence(n,t,r)}
3
- export{Yc,Zc,Qc,el,Go,tl,nl,rl,sl,il,ol,al};
2
+ import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as ol}from"ts-broadcasting";import{Broadcast as al,BroadcastServer as cl}from"ts-broadcasting";var e=null,u=[];function Zc(){return e}async function Qc(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function el(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function tl(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();Jo(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function Jo(n,t,r){if(!i())return;s.send(n,t,r)}function nl(n,t,r){if(!i())return;s.toUser(n,t,r)}function rl(n,t,r){if(!i())return;s.toUsers(n,t,r)}function sl(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function il(n,t,r){if(!i())return;s.presence(n,t,r)}
3
+ export{Zc,Qc,el,tl,Jo,nl,rl,sl,il,ol,al,cl};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{y,i,T}from"./chunk-69mc2np8.js";import{P,kt}from"./chunk-h0atqq82.js";import{qr}from"./chunk-xtdw3692.js";import{he}from"./chunk-et0rr8c7.js";import{s,we}from"./chunk-169n1vpx.js";import{o}from"./chunk-fzapbw9p.js";import f from"path";import b from"fs";function de(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function pe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function U(e,t){let r=[];for(let l of pe(e)){if(de(l)){let u=l.position||void 0;r.push({file:t||u?.file,line:u?.line,column:u?.column,message:l.message??"",lineText:u?.lineText});continue}r.push({file:t,message:l instanceof Error?l.message:String(l)})}return r}function Me(e,t){return U(e,t).map((r)=>{let l=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",u=r.lineText?`
2
+ import{y,i,T}from"./chunk-dg1n3g1d.js";import{P,Ct}from"./chunk-26j2q9rq.js";import{Xr}from"./chunk-wpe72ann.js";import{he}from"./chunk-et0rr8c7.js";import{s,we}from"./chunk-9t2xx2y4.js";import{o}from"./chunk-ty7t3gp4.js";import f from"path";import b from"fs";function de(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function pe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function U(e,t){let r=[];for(let l of pe(e)){if(de(l)){let u=l.position||void 0;r.push({file:t||u?.file,line:u?.line,column:u?.column,message:l.message??"",lineText:u?.lineText});continue}r.push({file:t,message:l instanceof Error?l.message:String(l)})}return r}function Me(e,t){return U(e,t).map((r)=>{let l=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",u=r.lineText?`
3
3
  ${r.lineText.trim()}`:"";return l?`${l}: ${r.message}${u}`:`${r.message}${u}`}).join(`
4
- `)}var me=9;function z(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||qr(e,t,r)}var re=1,se=new Map,J=600,fe=100,V=new Map;async function ge(e){let t=V.get(e)??0;if(t>0&&t<fe){V.set(e,t+1);return}V.set(e,1);try{let r=(await b.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=J)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await b.promises.stat(f.join(e,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,d)=>d.at-p.at);for(let p of u.slice(J)){let d=p.name.slice(0,-3);await b.promises.rm(f.join(e,`${d}.js`),{force:!0}),await b.promises.rm(f.join(e,`${d}.deps.json`),{force:!0})}F("pruned bundle cache to",J,"entries")}catch{}}function ce(e){return se.get(e)??[]}function G(e,t){if(e)se.set(e,t)}function Fa(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function F(...e){if(Fa())console.log("[stx:bundler]",...e)}var q=[];function Di(e,t,r){q.push({filePath:e||"<inline>",message:t,details:r})}function ft(){return q.slice()}function gt(){q.length=0}var X;function $u(e){X=e}function Oi(){if(X)return X;try{let e=T.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var ee=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function mt(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let u=r[1];if(!ee.some((d)=>d.test(u)))return F("detected user import:",u),!0}let l=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=l.exec(e))!==null){let u=r[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!ee.some((d)=>d.test(u)))return F("detected side-effect import:",u),!0}return!1}var nn="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function za(e,t){return f.relative(e,t).split(f.sep).join("/")}function Ha(e,t){if(t.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(r,l,u,p)=>{let d=t.get(p);return d&&!p.startsWith(nn)?`${l}${u}${d}${u}`:r})}function Va(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,x=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${x}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(x)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let x of p.split(",")){let v=x.trim();if(!v)continue;let c=v.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],a=c[2]??n;t.push(`var ${a} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,x)=>{let v=x.slice(nn.length),c=l(v),n=d.trim(),a=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(a&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${a[1]} = ${c}.default;`),n=n.slice(a[0].length).trim();let m=n.match(/^\*\s*as\s+([\w$]+)$/);if(m)t.push(`var ${m[1]} = ${c};`);else if(n.startsWith("{"))u(n.replace(/^\{|\}$/g,""),c);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d)=>(l(d.slice(nn.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let r of t)try{if(b.existsSync(r)&&b.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function $e(e,t,r,l,u,p=new Map,d){let x=(c,n,a)=>{if(z(n,e,d))return null;if(!u||c!==r||!xe.test(n))return null;try{if(!b.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let m=`${nn}${za(process.cwd(),n)}`;return p.set(a,m),{path:m,external:!0}},v=(c,n)=>{let a=c===r?t:f.dirname(c),m=f.resolve(a,n);return te(m)??m};return{name:"stx-client-bundle",setup(c){if(c.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^\//},(n)=>{let a=te(n.path);if(a){let m=x(n.importer,a,n.path);if(m)return m;if(a!==r)l.add(a);return{path:a}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let a=v(n.importer,n.path),m=x(n.importer,a,n.path);if(m)return m;return l.add(a),{path:a}}),c.onResolve({filter:/^[@~]\//},(n)=>{let a=f.resolve(e,n.path.slice(2)),m=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,f.join(a,"index.ts"),f.join(a,"index.tsx"),f.join(a,"index.js"),f.join(a,"index.mjs")];for(let w of m)if(b.existsSync(w)&&b.statSync(w,{throwIfNoEntry:!1})?.isFile()){let I=x(n.importer,w,n.path);if(I)return I;return F(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",w),l.add(w),{path:w}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:a}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let a=`${nn}npm:${n.path}`;return p.set(n.path,a),{path:a,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(z(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let a=f.extname(n.path).toLowerCase(),m=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:b.readFileSync(n.path,"utf8"),loader:m}})}}}var W=new Map,L=P(64),ne=Symbol.for("stx.client-bundle-build-queue");function Ua(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function ht(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await i(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,x=r.cacheDir||o(l,"bundle-cache"),v=new Bun.CryptoHasher("md5");v.update(`${me}\x00${he()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=v.digest("hex").slice(0,12),n=f.join(x,`${c}.js`),a=L.get(n);if(a){if(kt(a.files)&&a.files.every((E)=>!z(E.path,l,u))){F("memo hit:",c);let E=a.files.map((S)=>S.path);return G(t,E),r.collectInputs?.push(...E),a.code}L.delete(n),F("memo invalidated by dep change:",c)}let m=f.join(x,`${c}.deps.json`),w=Bun.file(n);if(await w.exists()){let E=Bun.file(m),S=!1,B=null;if(await E.exists())try{let D=JSON.parse(await E.text());if(D.metadataVersion!==re||!Array.isArray(D.files))S=!1;else B=D.files,S=!0;if(B&&(!kt(B)||B.some((N)=>z(N.path,l,u))))S=!1}catch{S=!1}if(S){if(F("cache hit:",c),B)G(t,B.map((N)=>N.path)),r.collectInputs?.push(...B.map((N)=>N.path));let D=await w.text();if(B)L.set(n,{code:D,files:B});return D}F("cache invalidated by dep change:",c)}let I=W.get(c);if(I){let E=await I;if(r.collectInputs)r.collectInputs.push(...(L.get(n)?.files??[]).map((S)=>S.path));return E}let _=Ua(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:x,hash:c,cachePath:n,depsPath:m,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));W.set(c,_);try{return await _}finally{W.delete(c)}}var be=0;function Wa(e){return`${e}-${process.pid}-${++be}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:x,depsPath:v,externalizeUserModules:c}=r,n=o(l,"bundle-tmp"),a=Wa(d),m=f.join(n,`${a}.ts`),w=f.join(n,"out",a);b.mkdirSync(n,{recursive:!0}),b.mkdirSync(w,{recursive:!0});let I=f.dirname(t),_=new Set,E=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,S=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:D,balanced:N}=we(B),H=(j)=>!N||D[j]===0,M;while((M=E.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;if(M[2])M[2].split(",").forEach((j)=>{let h=Be(j);if(h)_.add(h)});else if(M[3])_.add(M[3])}while((M=S.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;_.add(M[2])}let ie=_.size>0?`
5
- export { ${[..._].join(", ")} }`:"";await Bun.write(m,e+ie),F("bundling:",d,"from:",f.basename(t));let Z=new Set,Y=new Map;try{let j=await Bun.build({entrypoints:[m],outdir:w,target:"browser",format:"esm",minify:u,plugins:[$e(l,I,m,Z,c,Y,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!j.success){let R=j.logs.filter((k)=>k.level==="error").map((k)=>k.message).join(", ")||`Unable to bundle ${f.basename(t)}`,C=U(j.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),Di(t||"",R,C),Oi()==="error")throw Error(R);return e}let h="";for(let g of j.outputs){h=await g.text();break}let A=[];for(let g of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of g[1].split(",")){let C=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C){A.push([C[2],C[1]]);continue}let k=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let Q=[];h=Va(Ha(h,Y),Q);let oe=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${d}`,ae=A.map(([g,R])=>`${JSON.stringify(g)}: ${R}`).join(", "),le=A.map(([g])=>`var ${g} = undefined;`).join(`
4
+ `)}var me=9;function z(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||Xr(e,t,r)}var re=1,se=new Map,J=600,fe=100,V=new Map;async function ge(e){let t=V.get(e)??0;if(t>0&&t<fe){V.set(e,t+1);return}V.set(e,1);try{let r=(await b.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=J)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await b.promises.stat(f.join(e,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,d)=>d.at-p.at);for(let p of u.slice(J)){let d=p.name.slice(0,-3);await b.promises.rm(f.join(e,`${d}.js`),{force:!0}),await b.promises.rm(f.join(e,`${d}.deps.json`),{force:!0})}F("pruned bundle cache to",J,"entries")}catch{}}function ce(e){return se.get(e)??[]}function G(e,t){if(e)se.set(e,t)}function za(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function F(...e){if(za())console.log("[stx:bundler]",...e)}var q=[];function Oi(e,t,r){q.push({filePath:e||"<inline>",message:t,details:r})}function gt(){return q.slice()}function mt(){q.length=0}var X;function Eu(e){X=e}function Mi(){if(X)return X;try{let e=T.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var ee=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let u=r[1];if(!ee.some((d)=>d.test(u)))return F("detected user import:",u),!0}let l=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=l.exec(e))!==null){let u=r[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!ee.some((d)=>d.test(u)))return F("detected side-effect import:",u),!0}return!1}var rn="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function Ha(e,t){return f.relative(e,t).split(f.sep).join("/")}function Va(e,t){if(t.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(r,l,u,p)=>{let d=t.get(p);return d&&!p.startsWith(rn)?`${l}${u}${d}${u}`:r})}function Ua(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,x=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${x}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(x)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let x of p.split(",")){let v=x.trim();if(!v)continue;let c=v.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],a=c[2]??n;t.push(`var ${a} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,x)=>{let v=x.slice(rn.length),c=l(v),n=d.trim(),a=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(a&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${a[1]} = ${c}.default;`),n=n.slice(a[0].length).trim();let m=n.match(/^\*\s*as\s+([\w$]+)$/);if(m)t.push(`var ${m[1]} = ${c};`);else if(n.startsWith("{"))u(n.replace(/^\{|\}$/g,""),c);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d)=>(l(d.slice(rn.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let r of t)try{if(b.existsSync(r)&&b.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function $e(e,t,r,l,u,p=new Map,d){let x=(c,n,a)=>{if(z(n,e,d))return null;if(!u||c!==r||!xe.test(n))return null;try{if(!b.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let m=`${rn}${Ha(process.cwd(),n)}`;return p.set(a,m),{path:m,external:!0}},v=(c,n)=>{let a=c===r?t:f.dirname(c),m=f.resolve(a,n);return te(m)??m};return{name:"stx-client-bundle",setup(c){if(c.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^\//},(n)=>{let a=te(n.path);if(a){let m=x(n.importer,a,n.path);if(m)return m;if(a!==r)l.add(a);return{path:a}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let a=v(n.importer,n.path),m=x(n.importer,a,n.path);if(m)return m;return l.add(a),{path:a}}),c.onResolve({filter:/^[@~]\//},(n)=>{let a=f.resolve(e,n.path.slice(2)),m=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,f.join(a,"index.ts"),f.join(a,"index.tsx"),f.join(a,"index.js"),f.join(a,"index.mjs")];for(let w of m)if(b.existsSync(w)&&b.statSync(w,{throwIfNoEntry:!1})?.isFile()){let I=x(n.importer,w,n.path);if(I)return I;return F(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",w),l.add(w),{path:w}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:a}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let a=`${rn}npm:${n.path}`;return p.set(n.path,a),{path:a,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(z(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let a=f.extname(n.path).toLowerCase(),m=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:b.readFileSync(n.path,"utf8"),loader:m}})}}}var W=new Map,L=P(64),ne=Symbol.for("stx.client-bundle-build-queue");function Wa(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function yt(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await i(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,x=r.cacheDir||o(l,"bundle-cache"),v=new Bun.CryptoHasher("md5");v.update(`${me}\x00${he()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=v.digest("hex").slice(0,12),n=f.join(x,`${c}.js`),a=L.get(n);if(a){if(Ct(a.files)&&a.files.every((E)=>!z(E.path,l,u))){F("memo hit:",c);let E=a.files.map((S)=>S.path);return G(t,E),r.collectInputs?.push(...E),a.code}L.delete(n),F("memo invalidated by dep change:",c)}let m=f.join(x,`${c}.deps.json`),w=Bun.file(n);if(await w.exists()){let E=Bun.file(m),S=!1,B=null;if(await E.exists())try{let D=JSON.parse(await E.text());if(D.metadataVersion!==re||!Array.isArray(D.files))S=!1;else B=D.files,S=!0;if(B&&(!Ct(B)||B.some((N)=>z(N.path,l,u))))S=!1}catch{S=!1}if(S){if(F("cache hit:",c),B)G(t,B.map((N)=>N.path)),r.collectInputs?.push(...B.map((N)=>N.path));let D=await w.text();if(B)L.set(n,{code:D,files:B});return D}F("cache invalidated by dep change:",c)}let I=W.get(c);if(I){let E=await I;if(r.collectInputs)r.collectInputs.push(...(L.get(n)?.files??[]).map((S)=>S.path));return E}let _=Wa(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:x,hash:c,cachePath:n,depsPath:m,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));W.set(c,_);try{return await _}finally{W.delete(c)}}var be=0;function qa(e){return`${e}-${process.pid}-${++be}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:x,depsPath:v,externalizeUserModules:c}=r,n=o(l,"bundle-tmp"),a=qa(d),m=f.join(n,`${a}.ts`),w=f.join(n,"out",a);b.mkdirSync(n,{recursive:!0}),b.mkdirSync(w,{recursive:!0});let I=f.dirname(t),_=new Set,E=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,S=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:D,balanced:N}=we(B),H=(j)=>!N||D[j]===0,M;while((M=E.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;if(M[2])M[2].split(",").forEach((j)=>{let h=Be(j);if(h)_.add(h)});else if(M[3])_.add(M[3])}while((M=S.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;_.add(M[2])}let ie=_.size>0?`
5
+ export { ${[..._].join(", ")} }`:"";await Bun.write(m,e+ie),F("bundling:",d,"from:",f.basename(t));let Z=new Set,Y=new Map;try{let j=await Bun.build({entrypoints:[m],outdir:w,target:"browser",format:"esm",minify:u,plugins:[$e(l,I,m,Z,c,Y,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!j.success){let R=j.logs.filter((k)=>k.level==="error").map((k)=>k.message).join(", ")||`Unable to bundle ${f.basename(t)}`,C=U(j.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),Oi(t||"",R,C),Mi()==="error")throw Error(R);return e}let h="";for(let g of j.outputs){h=await g.text();break}let A=[];for(let g of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of g[1].split(",")){let C=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C){A.push([C[2],C[1]]);continue}let k=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let Q=[];h=Ua(Va(h,Y),Q);let oe=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${d}`,ae=A.map(([g,R])=>`${JSON.stringify(g)}: ${R}`).join(", "),le=A.map(([g])=>`var ${g} = undefined;`).join(`
6
6
  `),ue=A.map(([g])=>`${g} = ${K}[${JSON.stringify(g)}];`).join(`
7
7
  `);if(h=`${oe.join(`
8
8
  `)}
@@ -13,5 +13,5 @@ ${Q.join(`
13
13
  ${h}
14
14
  return { ${ae} };
15
15
  })();
16
- ${ue}`.trim(),F("bundled:",d,"output:",h.length,"bytes"),_.size>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${f.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;b.mkdirSync(p,{recursive:!0}),await Bun.write(x,h);let O=Array.from(Z).map((g)=>{try{return{path:g,mtimeMs:b.statSync(g).mtimeMs}}catch{return null}}).filter((g)=>g!==null);return await Bun.write(v,JSON.stringify({metadataVersion:re,files:O})),G(t,O.map((g)=>g.path)),r.collectInputs?.push(...O.map((g)=>g.path)),L.set(x,{code:h,files:O}),await ge(p),h}catch(j){let h=U(j,t||void 0),A=Me(j,t||void 0);if(console.warn(`[stx:bundler] error: ${A}`),Di(t||"",A,h),Oi()==="error")throw j;return e}finally{try{b.rmSync(m,{force:!0}),b.rmSync(w,{recursive:!0,force:!0})}catch{}}}function Be(e){let t=e.trim();if(!t)return null;let r=t.indexOf("=");if(r!==-1)t=t.slice(0,r).trim();let l=t.indexOf(":");if(l!==-1)t=t.slice(l+1).trim();if(t.startsWith("..."))t=t.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(t)?t:null}
17
- export{Me,ce,Fa,Di,ft,gt,$u,Oi,mt,nn,za,Ha,Va,Ua,ht,Wa};
16
+ ${ue}`.trim(),F("bundled:",d,"output:",h.length,"bytes"),_.size>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${f.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;b.mkdirSync(p,{recursive:!0}),await Bun.write(x,h);let O=Array.from(Z).map((g)=>{try{return{path:g,mtimeMs:b.statSync(g).mtimeMs}}catch{return null}}).filter((g)=>g!==null);return await Bun.write(v,JSON.stringify({metadataVersion:re,files:O})),G(t,O.map((g)=>g.path)),r.collectInputs?.push(...O.map((g)=>g.path)),L.set(x,{code:h,files:O}),await ge(p),h}catch(j){let h=U(j,t||void 0),A=Me(j,t||void 0);if(console.warn(`[stx:bundler] error: ${A}`),Oi(t||"",A,h),Mi()==="error")throw j;return e}finally{try{b.rmSync(m,{force:!0}),b.rmSync(w,{recursive:!0,force:!0})}catch{}}}function Be(e){let t=e.trim();if(!t)return null;let r=t.indexOf("=");if(r!==-1)t=t.slice(0,r).trim();let l=t.indexOf(":");if(l!==-1)t=t.slice(l+1).trim();if(t.startsWith("..."))t=t.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(t)?t:null}
17
+ export{Me,ce,za,Oi,gt,mt,Eu,Mi,ht,rn,Ha,Va,Ua,Wa,yt,qa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{s}from"./chunk-169n1vpx.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
2
+ import{s}from"./chunk-9t2xx2y4.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
3
3
  `)i++;return i}function b(e,n){let i=e.lastIndexOf(`
4
4
  `,n)+1,o=e.indexOf(`
5
5
  `,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let t=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return r+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return r+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):s(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),r=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?r:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let r=e;if(i.includes("confirm"))r=A(r,o,l);if(i.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),r=[];if(i.length>0){r.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)r.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{L,j,B,jt,Z,oe,_n,Zo,Ie,dt,Bt,Ft,zt,F,Ht,Vt,Rn}from"./chunk-0es4h5v1.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,Rn as ImageProcessingError,Vt as formatSize,dt as generateSizes,Ie as generateSrcSet,Bt as getFallbackVariant,_n as getImageMetadata,F as getMimeType,Ht as getTotalSize,Ft as groupVariantsByFormat,Z as isImageBackendAvailable,zt as isImageFile,jt as isSharpAvailable,oe as processImage,Zo as resizeAndConvert};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$i}from"./chunk-ynvdvbat.js";import{u}from"./chunk-cg8hg6cs.js";import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";var yu=`
2
+ import{Ei}from"./chunk-tc274fcv.js";import{u}from"./chunk-cg8hg6cs.js";import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";var bu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -465,7 +465,7 @@ else if (data.type === 'event' && data.method) {
465
465
  }
466
466
  })();
467
467
  </script>
468
- `;function hi(e={}){let{debug:r=!1,timeout:a=30000}=e;return`
468
+ `;function yi(e={}){let{debug:r=!1,timeout:a=30000}=e;return`
469
469
  <script>
470
470
  (function() {
471
471
  'use strict';
@@ -931,9 +931,9 @@ else if (data.type === 'event' && data.method) {
931
931
  }
932
932
  })();
933
933
  </script>
934
- `.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function bu(){return!1}function vu(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(i,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 hi(t)})}function yi(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=hi(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
934
+ `.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function vu(){return!1}function wu(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(i,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 yi(t)})}function bi(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=yi(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
935
935
  </head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
936
- ${a}`);return a+e}var Br={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 a=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
936
+ ${a}`);return a+e}var Fr={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 a=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
937
937
  <input type="checkbox" class="craft-checkbox" ${a} ${i}>
938
938
  <span class="craft-checkbox-label">${r||e.label||""}</span>
939
939
  </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let a=e.min??0,i=e.max??100,s=e.step??1,t=e.value??50,n=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${i}" step="${s}" value="${t}" ${n}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let a=e.size||40,i=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${s}" style="width:${a}px;height:${a}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${a}px;height:${a}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let a=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let a=e.size||24;return`<div class="craft-spinner" style="width:${a}px;height:${a}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let a=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${a}>
@@ -947,7 +947,7 @@ ${a}`);return a+e}var Br={button:{nativeType:"craft-button",fallbackTag:"button"
947
947
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let a=e.variant||"info",i=e.title||"";return`<div class="craft-alert craft-alert-${a}" role="alert">
948
948
  ${i?`<div class="craft-alert-title">${i}</div>`:""}
949
949
  <div class="craft-alert-content">${r}</div>
950
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:j},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:H},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:V},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:W},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let a=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},bi=`
950
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:j},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:H},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:V},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:W},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let a=e.value||"",i=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${i}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},vi=`
951
951
  <style id="craft-component-styles">
952
952
  /* Craft Component Base Styles */
953
953
  .craft-button {
@@ -1365,7 +1365,7 @@ ${a}`);return a+e}var Br={button:{nativeType:"craft-button",fallbackTag:"button"
1365
1365
  }
1366
1366
  }
1367
1367
  </style>
1368
- `,wu=`
1368
+ `,xu=`
1369
1369
  <script id="craft-component-runtime">
1370
1370
  (function() {
1371
1371
  if (window.__stxCraftComponentRuntime) return;
@@ -1469,7 +1469,7 @@ ${a}`);return a+e}var Br={button:{nativeType:"craft-button",fallbackTag:"button"
1469
1469
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
1470
1470
  })();
1471
1471
  </script>
1472
- `;function vi(e,r={}){let{classPrefix:a="craft"}=r;if(!e.includes("craft-component-styles"))if(e.includes("</head>"))e=e.replace("</head>",`${`
1472
+ `;function wi(e,r={}){let{classPrefix:a="craft"}=r;if(!e.includes("craft-component-styles"))if(e.includes("</head>"))e=e.replace("</head>",`${`
1473
1473
  <style id="craft-component-styles">
1474
1474
  /* Craft Component Base Styles */
1475
1475
  .craft-button {
@@ -2934,7 +2934,7 @@ ${a}`);return a+e}var Br={button:{nativeType:"craft-button",fallbackTag:"button"
2934
2934
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
2935
2935
  })();
2936
2936
  </script>
2937
- `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),r,a)),e}function R(e,r,a,i,s){let t=i.components?.[e]||Br[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let n=A(r),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,a);let d=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${a}</${t.fallbackTag}>`}function A(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,n,c]=i,d=n??c;if(s.startsWith(":"))r[t]=d;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)r[t]=!0;else r[t]=d}return r}function j(e,r){let a=I(String(e.id||`craft-sidebar-${K(r||JSON.stringify(e))}`)),i=Q(e.spaces)||Y(r),s=i.length?[]:X(e.sections)||F(r),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((g)=>g.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),d={id:a,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:c,sections:s,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",x=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(d.searchPlaceholder)}"></div>`:"",b;if(i.length)b=G(i,t,c);else if(s.length)b=s.map((g)=>D(g,c)).join("");else b=r;return`<aside class="${h(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(a)}" data-native="${f}" style="--craft-sidebar-width:${p}px">
2937
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),r,a)),e}function R(e,r,a,i,s){let t=i.components?.[e]||Fr[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let n=A(r),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,a);let d=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${a}</${t.fallbackTag}>`}function A(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,n,c]=i,d=n??c;if(s.startsWith(":"))r[t]=d;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)r[t]=!0;else r[t]=d}return r}function j(e,r){let a=I(String(e.id||`craft-sidebar-${K(r||JSON.stringify(e))}`)),i=Q(e.spaces)||Y(r),s=i.length?[]:X(e.sections)||F(r),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((g)=>g.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),d={id:a,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:c,sections:s,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",x=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(d.searchPlaceholder)}"></div>`:"",b;if(i.length)b=G(i,t,c);else if(s.length)b=s.map((g)=>D(g,c)).join("");else b=r;return`<aside class="${h(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(a)}" data-native="${f}" style="--craft-sidebar-width:${p}px">
2938
2938
  ${x}
2939
2939
  ${b}
2940
2940
  </aside>
@@ -2955,7 +2955,7 @@ ${a}`);return a+e}var Br={button:{nativeType:"craft-button",fallbackTag:"button"
2955
2955
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(e.icon)}"${a}></span>`:""}
2956
2956
  <span class="craft-sidebar-item-label">${C(e.label)}</span>
2957
2957
  ${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
2958
- </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function xu(e,r){Br[e]=r}function Su(){return{...Br}}async function wi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await $i(e.input,{context:e.context,options:{isDev:!1}});if(t=yi(t,{debug:e.verbose}),t=vi(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${bi}
2958
+ </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function Su(e,r){Fr[e]=r}function ku(){return{...Fr}}async function xi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await Ei(e.input,{context:e.context,options:{isDev:!1}});if(t=bi(t,{debug:e.verbose}),t=wi(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${vi}
2959
2959
  </head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await fe();if(!d)return{success:!1,target:a,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${d}`);let l;switch(a){case"macos":l=await ie(t,n,c,s,i,e,d);break;case"windows":l=await oe(t,n,c,s,i,e,d);break;case"linux":l=await ce(t,n,c,s,i,e,d);break;case"ios":l=await de(t,n,c,s,e,d);break;case"android":l=await le(t,n,c,s,e,d);break;default:l={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return l.duration=Date.now()-r,l}catch(a){return{success:!1,target:e.target||P(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function ie(e,r,a,i,s,t,n){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${r}.app`),l=o(d,"Contents"),p=o(l,"MacOS"),f=o(l,"Resources");v(p,{recursive:!0}),v(f,{recursive:!0});let x=o(f,"index.html");await Bun.write(x,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(f,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let g=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",m=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(p,r);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(m)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(w,null,2)}
2960
2960
  `)}else{let S=o(p,"craft");k(n,S),T(S,493);let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",U=`#!/bin/bash
2961
2961
  set -euo pipefail
@@ -3018,5 +3018,5 @@ Exec=${a.toLowerCase()}
3018
3018
  Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${a.toLowerCase()}
3021
- `;u("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=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(u("fs").writeFileSync(o(n,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(u("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{u("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function xi(){return[P()]}function Si(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 he={buildNative:wi,getAvailableTargets:xi,getAvailableFormats:Si,detectPlatform:P},ku=he;
3022
- export{yu,hi,bu,vu,yi,Br,bi,wu,vi,xu,Su,wi,xi,Si,ku};
3021
+ `;u("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=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(u("fs").writeFileSync(o(n,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(u("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{u("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function Si(){return[P()]}function ki(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 he={buildNative:xi,getAvailableTargets:Si,getAvailableFormats:ki,detectPlatform:P},Cu=he;
3022
+ export{bu,yi,vu,wu,bi,Fr,vi,xu,wi,Su,ku,xi,Si,ki,Cu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{No,Lo}from"./chunk-wjag92ch.js";import"./chunk-3t0yaexe.js";import"./chunk-vvp4cmfq.js";import"./chunk-9rnh52t2.js";import"./chunk-7mbpjv9e.js";import"./chunk-n5k88y07.js";import"./chunk-95165j9c.js";import"./chunk-y5cqkmkf.js";import"./chunk-x0mq57pe.js";import"./chunk-7zjvsacw.js";import"./chunk-8ygks6dx.js";import{ni}from"./chunk-gyv1t0f0.js";import"./chunk-h8wegkb5.js";import"./chunk-0es4h5v1.js";import"./chunk-sh5c60a2.js";import"./chunk-1ctvgd7v.js";import"./chunk-cq408jrm.js";import"./chunk-fctjn68q.js";import"./chunk-v096a6fw.js";import"./chunk-gq97zh73.js";import"./chunk-vvs75dse.js";import"./chunk-zcctf7tx.js";import"./chunk-jr4dwkvc.js";import"./chunk-tfhjbjq5.js";import"./chunk-3g8zzdgs.js";import"./chunk-89xcpdsp.js";import"./chunk-t9axxwy9.js";import"./chunk-fkhxz1dx.js";import"./chunk-at0ar6t3.js";import"./chunk-388rx71h.js";import"./chunk-ae7j3n39.js";import{Qt,en}from"./chunk-9fyss0yk.js";import"./chunk-tc274fcv.js";import"./chunk-nj8edn4m.js";import"./chunk-y6rahx7t.js";import"./chunk-wpe72ann.js";import{ye,X,d,r,Gn,A,i,ue}from"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{Gn as buildWebComponents,en as cacheTemplate,Qt as checkCache,ni as classifyAllScripts,No as createMiddleware,Lo as createRoute,A as defaultConfig,d as extractVariables,X as injectRouterScript,i as loadStxConfig,ye as processClientScript,r as processDirectives,ue as readMarkdownFile};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import u from"fs";import l from"path";var g=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,x=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=l.resolve(l.dirname(t),e);for(let o of b){let s=r+o;try{if(u.statSync(s).isFile())return s}catch{}}return null}function hn(e,t,r=0,o=new Set){if(!t||r>=h)return!1;for(let s of e.matchAll(x)){let n=y(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=u.readFileSync(n,"utf8")}catch{continue}if(g.test(i))return!0;if(hn(i,n,r+1,o))return!0}return!1}var m=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setKeptScope","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],ko=["onMount","onDestroy"];function It(e="const",t=[],r){let o=t.length?m.filter((s)=>!t.includes(s)):m;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=m.filter((e)=>!E.includes(e));function Ds(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function Co(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Ds(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(hn(r[1],t))return!0;return!1}function $o(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Eo(e){return _.includes(e.toLowerCase())}var p=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],To=[...p,...w];function _o(){return`{${p.map((e)=>`'${e}':1`).join(",")}}`}var A=["class","style","text","html","show","model","if","ref"];function Ro(){return`{${A.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var N=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Ao(){return`/^(${N.join("|")})/`}var M=65536,L=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=M;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=L){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{hn,m,ko,It,Ds,Co,$o,Eo,To,_o,Ro,Ao};
2
+ import u from"fs";import l from"path";var g=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,x=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=l.resolve(l.dirname(t),e);for(let o of b){let s=r+o;try{if(u.statSync(s).isFile())return s}catch{}}return null}function yn(e,t,r=0,o=new Set){if(!t||r>=h)return!1;for(let s of e.matchAll(x)){let n=y(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=u.readFileSync(n,"utf8")}catch{continue}if(g.test(i))return!0;if(yn(i,n,r+1,o))return!0}return!1}var m=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setKeptScope","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Co=["onMount","onDestroy"];function Dt(e="const",t=[],r){let o=t.length?m.filter((s)=>!t.includes(s)):m;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=m.filter((e)=>!E.includes(e));function Os(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function $o(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Os(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(yn(r[1],t))return!0;return!1}function Eo(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function To(e){return _.includes(e.toLowerCase())}var p=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],_o=[...p,...w];function Ro(){return`{${p.map((e)=>`'${e}':1`).join(",")}}`}var A=["class","style","text","html","show","model","if","ref"];function Ao(){return`{${A.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var N=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Po(){return`/^(${N.join("|")})/`}var M=65536,L=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=M;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=L){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{yn,m,Co,Dt,Os,$o,Eo,To,_o,Ro,Ao,Po};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{m}from"./chunk-ce1sejr3.js";import{R,Pt}from"./chunk-8nhshfz6.js";import{y,ze,N,i}from"./chunk-69mc2np8.js";import{ce,mt,ht}from"./chunk-mepdnezf.js";import{De,Xt,Q}from"./chunk-f46qsp4m.js";import _ from"path";var g=new Map,v=new Map,P=["composables","functions"];function E(n){let t=_.basename(n,".ts");return t==="index"||t==="types"||n.endsWith(".d.ts")}async function G(n){if(n)return _.resolve(n);let t=`<default>:${process.cwd()}`,l=v.get(t);if(l!==void 0)return l;let s=await J();if(s!==null)v.set(t,s);return s}async function J(){let n=await i(),t=n.root||process.cwd(),l=n.composablesDir;if(l)return _.resolve(t,l);for(let s of P){let r=_.resolve(t,s);try{let c=new Bun.Glob("**/*.ts");for await(let a of c.scan({cwd:r,absolute:!0}))if(!E(a))return r}catch{}}return null}async function j(n){let t=Array.isArray(n)?n:n?[_.resolve(n)]:(await i())._layerComposableDirs??[await G()].filter((s)=>!!s),l=new Map;for(let s of t){let r=new Bun.Glob("**/*.ts");try{for await(let c of r.scan({cwd:s,absolute:!0})){let a=_.relative(s,c);if(!E(c)&&!l.has(a))l.set(a,c)}}catch{}}return{key:t.join("\x00"),files:[...l.values()].sort()}}async function Mr(n){let{files:t}=await j(n),l=N({loader:"ts",target:"browser",define:y()}),s=[];for(let r of t)try{let c=await Bun.file(r).text(),a=l.scan(c).exports.filter((d)=>d!=="default");if(a.length>0)s.push({file:r,names:a})}catch{}return s}function T(n,t){return new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(n)}function z(n,t,l){let s=new Map;for(let{file:d,names:f}of n)for(let u of f)if(!s.has(u))s.set(u,d);let r=(d)=>{let f=[];for(let[u,w]of s)if(T(d,u))f.push(w);return f},c=new Set,a=l.flatMap(r);while(a.length>0){let d=[];for(let f of a){if(c.has(f))continue;c.add(f);for(let u of r(t.get(f)??""))if(!c.has(u))d.push(u)}a=d}return c}async function bl(n,t,l){let{key:s,files:r}=await j(n);if(!s)return null;let c=()=>[...new Set([...r,...r.flatMap((e)=>ce(e))])],a=De(c());if(r.length===0)return Q(g,s,a,""),null;r.sort();let d=N({loader:"ts",target:"browser",define:y()}),f=new Map,u=[];for(let e of r)try{let o=await Bun.file(e).text();f.set(e,o);let h=d.scan(o).exports.filter((p)=>p!=="default");if(h.length>0)u.push({file:e,names:h})}catch{f.set(e,"")}let w=t===void 0?new Set(r):z(u,f,l?[t,...l]:[t]);if(w.size===0)return null;let B=r.filter((e)=>w.has(e)),x=`${s}\x00${B.join("\x00")}`,M=Xt(g,x,a);if(M!==void 0)return M||null;let S=[],b=new Set,D=new Set;for(let e of B)try{let o=f.get(e)??await Bun.file(e).text(),h=_.basename(e,".ts");for(let p of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(p[1])D.add(p[1]);try{for(let p of d.scan(o).exports)if(p!=="default")b.add(p)}catch{}if(o=R(o),mt(o))o=await ht(o,e,{projectRoot:process.cwd(),externalizeUserModules:!1}),o=ze(o);o=Pt(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=d.transformSync(o),S.push(`// Composable: ${h}
2
+ import{m}from"./chunk-yzv8n6qw.js";import{R,It}from"./chunk-de2pv6ys.js";import{y,ze,N,i}from"./chunk-dg1n3g1d.js";import{ce,ht,yt}from"./chunk-y6rahx7t.js";import{De,Kt,Q}from"./chunk-qzkebqm3.js";import _ from"path";var g=new Map,v=new Map,P=["composables","functions"];function E(n){let t=_.basename(n,".ts");return t==="index"||t==="types"||n.endsWith(".d.ts")}async function G(n){if(n)return _.resolve(n);let t=`<default>:${process.cwd()}`,l=v.get(t);if(l!==void 0)return l;let s=await J();if(s!==null)v.set(t,s);return s}async function J(){let n=await i(),t=n.root||process.cwd(),l=n.composablesDir;if(l)return _.resolve(t,l);for(let s of P){let r=_.resolve(t,s);try{let c=new Bun.Glob("**/*.ts");for await(let a of c.scan({cwd:r,absolute:!0}))if(!E(a))return r}catch{}}return null}async function j(n){let t=Array.isArray(n)?n:n?[_.resolve(n)]:(await i())._layerComposableDirs??[await G()].filter((s)=>!!s),l=new Map;for(let s of t){let r=new Bun.Glob("**/*.ts");try{for await(let c of r.scan({cwd:s,absolute:!0})){let a=_.relative(s,c);if(!E(c)&&!l.has(a))l.set(a,c)}}catch{}}return{key:t.join("\x00"),files:[...l.values()].sort()}}async function Nr(n){let{files:t}=await j(n),l=N({loader:"ts",target:"browser",define:y()}),s=[];for(let r of t)try{let c=await Bun.file(r).text(),a=l.scan(c).exports.filter((d)=>d!=="default");if(a.length>0)s.push({file:r,names:a})}catch{}return s}function T(n,t){return new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(n)}function z(n,t,l){let s=new Map;for(let{file:d,names:f}of n)for(let u of f)if(!s.has(u))s.set(u,d);let r=(d)=>{let f=[];for(let[u,w]of s)if(T(d,u))f.push(w);return f},c=new Set,a=l.flatMap(r);while(a.length>0){let d=[];for(let f of a){if(c.has(f))continue;c.add(f);for(let u of r(t.get(f)??""))if(!c.has(u))d.push(u)}a=d}return c}async function vl(n,t,l){let{key:s,files:r}=await j(n);if(!s)return null;let c=()=>[...new Set([...r,...r.flatMap((e)=>ce(e))])],a=De(c());if(r.length===0)return Q(g,s,a,""),null;r.sort();let d=N({loader:"ts",target:"browser",define:y()}),f=new Map,u=[];for(let e of r)try{let o=await Bun.file(e).text();f.set(e,o);let h=d.scan(o).exports.filter((p)=>p!=="default");if(h.length>0)u.push({file:e,names:h})}catch{f.set(e,"")}let w=t===void 0?new Set(r):z(u,f,l?[t,...l]:[t]);if(w.size===0)return null;let B=r.filter((e)=>w.has(e)),x=`${s}\x00${B.join("\x00")}`,M=Kt(g,x,a);if(M!==void 0)return M||null;let S=[],b=new Set,D=new Set;for(let e of B)try{let o=f.get(e)??await Bun.file(e).text(),h=_.basename(e,".ts");for(let p of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(p[1])D.add(p[1]);try{for(let p of d.scan(o).exports)if(p!=="default")b.add(p)}catch{}if(o=R(o),ht(o))o=await yt(o,e,{projectRoot:process.cwd(),externalizeUserModules:!1}),o=ze(o);o=It(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=d.transformSync(o),S.push(`// Composable: ${h}
3
3
  ${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${e}:`,o)}if(S.length===0||b.size===0)return Q(g,x,a,""),null;let F=[...b].map((e)=>` try { if (!(${JSON.stringify(e)} in __c)) __c[${JSON.stringify(e)}] = ${e}; } catch (e) {}`).join(`
4
4
  `),k=JSON.stringify([...b]),C=S.join(`
5
5
 
@@ -29,5 +29,5 @@ ${F}
29
29
  window[__n] = __c[__n];
30
30
  __published[__n] = true;
31
31
  }
32
- })();`;return a=De(c()),Q(g,x,a,A),A}function vl(){g.clear(),v.clear()}
33
- export{Mr,bl,vl};
32
+ })();`;return a=De(c()),Q(g,x,a,A),A}function wl(){g.clear(),v.clear()}
33
+ export{Nr,vl,wl};
@@ -298,5 +298,5 @@ catch (error) {
298
298
  init();
299
299
  }
300
300
  })();
301
- </script>`}var jc={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Bc={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Fc={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},zc={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},dr=[jc,Bc,Fc,zc];function od(t){return[...t,...dr]}
302
- export{jc,Bc,Fc,zc,dr,od};
301
+ </script>`}var Bc={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Fc={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},zc={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Hc={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},pr=[Bc,Fc,zc,Hc];function ad(t){return[...t,...pr]}
302
+ export{Bc,Fc,zc,Hc,pr,ad};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,a}from"./chunk-z0g9jvv0.js";import{Ge,Je,Ye,pe,Se,k,rr,pn,fe}from"./chunk-m4sk62wb.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,x=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function S(e,r){return(n)=>k(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function ks(e,r,n,p){if(!e.includes("@meta"))return e;let i=Ge(e,I,(s,c)=>{let o=pn(Je(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return k("Meta",c,o.message,n,o.code)},S("Meta",n));return i=Ge(i,C,(s,c)=>{let o=Ye(s,r);if(!o.ok)return k("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!Se(o.value))return k("MetaTag",c,`expected an object such as { name, content }, got ${pe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return k("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let g="<meta";if(u.name)g+=` name="${l(u.name)}"`;if(u.property)g+=` property="${l(u.property)}"`;if(u.httpEquiv)g+=` http-equiv="${l(u.httpEquiv)}"`;return g+=` content="${l(u.content)}">`,g},S("MetaTag",n)),i}function R(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(Se(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(Se))return e.map(r);return null}function _(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function Cs(e,r,n){if(!e.includes("@structuredData"))return e;return Ge(e,x,(p,i)=>{let s=Ye(p,r);if(!s.ok)return k("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=R(s.value);if(!c)return k("StructuredData",i,`expected an object or an array of objects, got ${pe(s.value)}`,n,t.TYPE_ERROR);try{return _(c)}catch(o){let u=o instanceof Error?o.message:String(o);return k("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},S("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),E={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function $s(e,r,n,p){if(!e.includes("@seo"))return e;return Ge(e,N,(i,s)=>{if(!i.trim())return k("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=Ye(i,r);if(!c.ok)return k("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!Se(c.value))return k("SEO",s,`expected an object such as { title, description }, got ${pe(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return k("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},S("SEO",n))}function A(e,r,n,p){let i=e[r];if(i===void 0||i===null||i===!1)return;if(Se(i))return i;rr(n,`${r} must be an object, got ${pe(i)}; its tags were left out`,p);return}function q(e,r,n){let p=Object.keys(e).filter((o)=>!L.has(o));if(p.length>0){let o=p.map((u)=>E[u]?`${u} (use ${E[u]})`:u).join(", ");rr(r,`@seo does not read ${o}; ${p.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
2
+ import{t,a}from"./chunk-c4bkj1xw.js";import{Ge,Je,Ye,pe,Se,k,sr,fn,fe}from"./chunk-rfdqrv5v.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,x=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function S(e,r){return(n)=>k(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Cs(e,r,n,p){if(!e.includes("@meta"))return e;let i=Ge(e,I,(s,c)=>{let o=fn(Je(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return k("Meta",c,o.message,n,o.code)},S("Meta",n));return i=Ge(i,C,(s,c)=>{let o=Ye(s,r);if(!o.ok)return k("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!Se(o.value))return k("MetaTag",c,`expected an object such as { name, content }, got ${pe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return k("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let g="<meta";if(u.name)g+=` name="${l(u.name)}"`;if(u.property)g+=` property="${l(u.property)}"`;if(u.httpEquiv)g+=` http-equiv="${l(u.httpEquiv)}"`;return g+=` content="${l(u.content)}">`,g},S("MetaTag",n)),i}function R(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(Se(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(Se))return e.map(r);return null}function _(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function $s(e,r,n){if(!e.includes("@structuredData"))return e;return Ge(e,x,(p,i)=>{let s=Ye(p,r);if(!s.ok)return k("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=R(s.value);if(!c)return k("StructuredData",i,`expected an object or an array of objects, got ${pe(s.value)}`,n,t.TYPE_ERROR);try{return _(c)}catch(o){let u=o instanceof Error?o.message:String(o);return k("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},S("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),E={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Es(e,r,n,p){if(!e.includes("@seo"))return e;return Ge(e,N,(i,s)=>{if(!i.trim())return k("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=Ye(i,r);if(!c.ok)return k("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!Se(c.value))return k("SEO",s,`expected an object such as { title, description }, got ${pe(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return k("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},S("SEO",n))}function A(e,r,n,p){let i=e[r];if(i===void 0||i===null||i===!1)return;if(Se(i))return i;sr(n,`${r} must be an object, got ${pe(i)}; its tags were left out`,p);return}function q(e,r,n){let p=Object.keys(e).filter((o)=>!L.has(o));if(p.length>0){let o=p.map((u)=>E[u]?`${u} (use ${E[u]})`:u).join(", ");sr(r,`@seo does not read ${o}; ${p.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
3
3
  `,i+=`<meta name="title" content="${l(e.title)}">
4
4
  `;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
5
5
  `;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(o)}">
@@ -25,7 +25,7 @@ import{t,a}from"./chunk-z0g9jvv0.js";import{Ge,Je,Ye,pe,Se,k,rr,pn,fe}from"./chu
25
25
  `}if(c.site)i+=`<meta name="twitter:site" content="${l(c.site)}">
26
26
  `;if(c.creator)i+=`<meta name="twitter:creator" content="${l(c.creator)}">
27
27
  `}if(e.structuredData!==void 0&&e.structuredData!==null){let o=R(e.structuredData);if(o)i+=`${_(o)}
28
- `;else rr(r,`structuredData must be an object or an array of objects, got ${pe(e.structuredData)}; it was left out`,n)}return i.trim()}function Es(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let p=r.__stx_runtime_head;if(!!(p?.title||p?.meta?.some((w)=>w.property==="og:title"||w.name==="og:title"||w.name==="twitter:title"||w.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=M(e),o=V(c),u=U(c),g="";if(r.title)g=r.title;else if(r.meta&&r.meta.title)g=r.meta.title;else if(o)g=o;else if(n.seo?.defaultConfig?.title)g=n.seo.defaultConfig.title;else g=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
28
+ `;else sr(r,`structuredData must be an object or an array of objects, got ${pe(e.structuredData)}; it was left out`,n)}return i.trim()}function Ts(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let p=r.__stx_runtime_head;if(!!(p?.title||p?.meta?.some((w)=>w.property==="og:title"||w.name==="og:title"||w.name==="twitter:title"||w.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=M(e),o=V(c),u=U(c),g="";if(r.title)g=r.title;else if(r.meta&&r.meta.title)g=r.meta.title;else if(o)g=o;else if(n.seo?.defaultConfig?.title)g=n.seo.defaultConfig.title;else g=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
29
29
  <meta name="title" content="${l(g)}">`,h=G(c)?"":`
30
30
  <meta name="description" content="${l(m)}">`,T=`
31
31
  <!-- stx SEO Tags -->${f}${h}
@@ -43,7 +43,7 @@ import{t,a}from"./chunk-z0g9jvv0.js";import{Ge,Je,Ye,pe,Se,k,rr,pn,fe}from"./chu
43
43
  ${T}
44
44
  `),y;return y.replace(/<head[^>]*>/,`$&
45
45
  ${T}
46
- `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function b(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?b(r[1].trim()):""}function v(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return v(e).length>0}function U(e){for(let r of v(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),p=(n?.[1]??n?.[2]??"").trim();if(p)return b(p)}return""}function l(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var er={name:"meta",rawParams:!0,handler:(e,r,n,p)=>{let i=pn(r,n??{});if(i.kind==="error")return k("Meta",`@meta(${r.join(", ")})`,i.message,p,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=fe(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},tr={name:"structuredData",handler:(e,r,n,p)=>{if(e.trim()==="")return a("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return a("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return _(i)}catch(i){let s=i instanceof Error?i.message:String(i);return a("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function Uu(){return[er,tr]}function Wu(e,r){let{baseUrl:n,defaultChangefreq:p="weekly",defaultPriority:i=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,"");return`<?xml version="1.0" encoding="UTF-8"?>
46
+ `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function b(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?b(r[1].trim()):""}function v(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return v(e).length>0}function U(e){for(let r of v(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),p=(n?.[1]??n?.[2]??"").trim();if(p)return b(p)}return""}function l(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var tr={name:"meta",rawParams:!0,handler:(e,r,n,p)=>{let i=fn(r,n??{});if(i.kind==="error")return k("Meta",`@meta(${r.join(", ")})`,i.message,p,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=fe(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},nr={name:"structuredData",handler:(e,r,n,p)=>{if(e.trim()==="")return a("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return a("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return _(i)}catch(i){let s=i instanceof Error?i.message:String(i);return a("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function Wu(){return[tr,nr]}function qu(e,r){let{baseUrl:n,defaultChangefreq:p="weekly",defaultPriority:i=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,"");return`<?xml version="1.0" encoding="UTF-8"?>
47
47
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
48
48
  ${e.map((u)=>{let g=u.loc.startsWith("http")?u.loc:`${c}${u.loc.startsWith("/")?"":"/"}${u.loc}`,m=u.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),d=u.changefreq||p,f=u.priority??i,h=` <url>
49
49
  <loc>${O(g)}</loc>`;if(m)h+=`
@@ -52,13 +52,13 @@ ${e.map((u)=>{let g=u.loc.startsWith("http")?u.loc:`${c}${u.loc.startsWith("/")?
52
52
  <priority>${f.toFixed(1)}</priority>`,h+=`
53
53
  </url>`,h}).join(`
54
54
  `)}
55
- </urlset>`}function qu(e,r){let n=r.replace(/\/$/,""),p=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
55
+ </urlset>`}function Xu(e,r){let n=r.replace(/\/$/,""),p=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
56
56
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
57
57
  ${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
58
58
  <loc>${O(c)}</loc>
59
59
  <lastmod>${p}</lastmod>
60
60
  </sitemap>`}).join(`
61
61
  `)}
62
- </sitemapindex>`}async function Xu(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:p=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(p.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let g=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!g.startsWith("/"))g=`/${g}`;if(g!=="/"&&g.endsWith("/"))g=g.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:g||"/",lastmod:d,priority:g==="/"?1:0.5})}return i.sort((o,u)=>o.loc.localeCompare(u.loc)),i}function nr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let p of n.allow)r.push(`Allow: ${p}`);if(n.disallow)for(let p of n.disallow)r.push(`Disallow: ${p}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let p of n)r.push(`Sitemap: ${p}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
63
- `).trim()}function Ku(e){return nr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function O(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
64
- export{ks,Cs,$s,Es,er,tr,Uu,Wu,qu,Xu,nr,Ku};
62
+ </sitemapindex>`}async function Ku(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:p=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(p.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let g=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!g.startsWith("/"))g=`/${g}`;if(g!=="/"&&g.endsWith("/"))g=g.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:g||"/",lastmod:d,priority:g==="/"?1:0.5})}return i.sort((o,u)=>o.loc.localeCompare(u.loc)),i}function rr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let p of n.allow)r.push(`Allow: ${p}`);if(n.disallow)for(let p of n.disallow)r.push(`Disallow: ${p}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let p of n)r.push(`Sitemap: ${p}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
63
+ `).trim()}function Gu(e){return rr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function O(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
64
+ export{Cs,$s,Es,Ts,tr,nr,Wu,qu,Xu,Ku,rr,Gu};