@stacksjs/stx 0.2.708 → 0.2.710

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 (88) hide show
  1. package/dist/{chunk-dedmk383.js → chunk-07t75sa9.js} +1 -1
  2. package/dist/{chunk-9whmbfwx.js → chunk-0fsf124j.js} +1 -1
  3. package/dist/chunk-0v9ddb6n.js +2 -0
  4. package/dist/chunk-2t4z29p8.js +2 -0
  5. package/dist/{chunk-gvs17jd0.js → chunk-34hsn8tn.js} +39 -12
  6. package/dist/{chunk-0myrwz84.js → chunk-3ps07041.js} +42 -10
  7. package/dist/{chunk-xw8wwcr8.js → chunk-4jnmr21x.js} +1 -1
  8. package/dist/{chunk-fj3pct59.js → chunk-5q9epbwk.js} +1 -1
  9. package/dist/{chunk-kxwfrdt3.js → chunk-5zgb01qx.js} +1 -1
  10. package/dist/{chunk-c2b5p621.js → chunk-6r4at2sz.js} +5 -5
  11. package/dist/{chunk-bhpsr1mt.js → chunk-6w1qcqr1.js} +1 -1
  12. package/dist/{chunk-cqnpjdc9.js → chunk-717bek8h.js} +1 -1
  13. package/dist/{chunk-eywx2f4h.js → chunk-7c9nfrhv.js} +1 -1
  14. package/dist/{chunk-hmkg3xy0.js → chunk-8jb55rfm.js} +1 -1
  15. package/dist/{chunk-f9b7847f.js → chunk-8skqad4q.js} +1 -1
  16. package/dist/chunk-8xjp70r6.js +2 -0
  17. package/dist/{chunk-d2xnkt8m.js → chunk-9dsfcxzr.js} +1 -1
  18. package/dist/{chunk-3907sad1.js → chunk-9yn3nsr1.js} +1 -1
  19. package/dist/{chunk-erqsgfdj.js → chunk-a026vsrp.js} +1 -1
  20. package/dist/{chunk-r5k21k3x.js → chunk-b1a1wx8z.js} +4 -4
  21. package/dist/{chunk-ccty08sm.js → chunk-db9tv9kf.js} +3 -3
  22. package/dist/{chunk-zjcmybab.js → chunk-dkrj1qn3.js} +1 -1
  23. package/dist/{chunk-qcw1neka.js → chunk-e2fvr2w6.js} +1 -1
  24. package/dist/chunk-e5xa3xh1.js +2 -0
  25. package/dist/{chunk-19knw8c6.js → chunk-ebjn0t9q.js} +1 -1
  26. package/dist/{chunk-nde9yj3n.js → chunk-ecy52773.js} +1 -1
  27. package/dist/{chunk-0jtrdgyv.js → chunk-ev2asp1e.js} +6 -6
  28. package/dist/{chunk-90kfvtf6.js → chunk-f134xm9v.js} +2 -2
  29. package/dist/{chunk-c71f6mfr.js → chunk-fdzpctxs.js} +1 -1
  30. package/dist/{chunk-v5s6r2b3.js → chunk-ferqef0h.js} +3 -3
  31. package/dist/{chunk-cjx11tgd.js → chunk-fxvxkb55.js} +1 -1
  32. package/dist/{chunk-27catnpa.js → chunk-hek3gvcs.js} +1 -1
  33. package/dist/{chunk-65fcex5r.js → chunk-j184qf8s.js} +1 -1
  34. package/dist/{chunk-hb77kw66.js → chunk-jaq288y2.js} +1 -1
  35. package/dist/{chunk-9xb33nz0.js → chunk-jbvznf9t.js} +1 -1
  36. package/dist/{chunk-86775qk0.js → chunk-jh44a0eh.js} +1 -1
  37. package/dist/{chunk-sz0e6tpq.js → chunk-kdfdgn6c.js} +1 -1
  38. package/dist/{chunk-s1vj8gtz.js → chunk-khqa12tb.js} +2 -2
  39. package/dist/{chunk-3vsnnr1b.js → chunk-nf44whzd.js} +1 -1
  40. package/dist/{chunk-03p4w958.js → chunk-pp1beqrr.js} +1 -1
  41. package/dist/{chunk-4cs5t287.js → chunk-q5aptpc8.js} +1 -1
  42. package/dist/{chunk-3xmt01wr.js → chunk-q986z4qy.js} +2 -2
  43. package/dist/chunk-qq0m0fyn.js +3 -0
  44. package/dist/{chunk-vqratjvb.js → chunk-rr4dndjr.js} +1 -1
  45. package/dist/chunk-rrc9zwyh.js +2 -0
  46. package/dist/{chunk-609pekf5.js → chunk-s04ban9p.js} +1 -1
  47. package/dist/{chunk-w8yv9hnf.js → chunk-s6mzv28a.js} +1 -1
  48. package/dist/{chunk-7kaadsd1.js → chunk-t2kr9438.js} +2 -2
  49. package/dist/chunk-t7b8q0fg.js +2 -0
  50. package/dist/{chunk-e5vsw0fw.js → chunk-tbf23kt0.js} +1 -1
  51. package/dist/{chunk-f6ybdjt0.js → chunk-tvdaa2s4.js} +4 -4
  52. package/dist/{chunk-a32xsr61.js → chunk-vb0vf4f4.js} +1 -1
  53. package/dist/{chunk-2srb5f7t.js → chunk-vdbmvn1m.js} +1 -1
  54. package/dist/{chunk-rswg7xsg.js → chunk-vq5z2b8n.js} +2 -2
  55. package/dist/{chunk-e8brwwp1.js → chunk-vvdew463.js} +5 -5
  56. package/dist/{chunk-8c4zbq1k.js → chunk-wcj2rb7b.js} +1 -1
  57. package/dist/{chunk-zaj3gzet.js → chunk-wj1xg3z5.js} +1 -1
  58. package/dist/{chunk-avr65xra.js → chunk-x5h95nnq.js} +1 -1
  59. package/dist/chunk-xrx6ay3j.js +2 -0
  60. package/dist/{chunk-1kwsnqr1.js → chunk-xwdhvmnt.js} +1 -1
  61. package/dist/{chunk-9wgvn5rn.js → chunk-y0t70c3t.js} +1 -1
  62. package/dist/chunk-yaanjj3t.js +2 -0
  63. package/dist/chunk-yaxq5qq6.js +2 -0
  64. package/dist/chunk-z84yfx2x.js +2 -0
  65. package/dist/chunk-z9khppp8.js +2 -0
  66. package/dist/chunk-zc5e9bnh.js +2 -0
  67. package/dist/{chunk-93y8zwcz.js → chunk-zgvbsrq1.js} +2 -2
  68. package/dist/cli.js +8 -8
  69. package/dist/client/signals-authoring-runtime.js +17 -6
  70. package/dist/client/signals-binding-utils-runtime.js +17 -1
  71. package/dist/craft-entry.js +1 -1
  72. package/dist/craft.js +1 -1
  73. package/dist/pwa.js +1 -1
  74. package/dist/ssg.js +2 -2
  75. package/package.json +5 -5
  76. package/dist/chunk-2k6d8s6h.js +0 -2
  77. package/dist/chunk-3nsdb1fg.js +0 -2
  78. package/dist/chunk-3qnke2jb.js +0 -2
  79. package/dist/chunk-3sg2ardr.js +0 -2
  80. package/dist/chunk-48936paw.js +0 -2
  81. package/dist/chunk-75n3vbtk.js +0 -2
  82. package/dist/chunk-8z469777.js +0 -2
  83. package/dist/chunk-9nvywf05.js +0 -3
  84. package/dist/chunk-axwwhdtt.js +0 -2
  85. package/dist/chunk-h9n71rdn.js +0 -2
  86. package/dist/chunk-j7gg6xrc.js +0 -2
  87. package/dist/chunk-weaxr0qe.js +0 -2
  88. package/dist/chunk-ztckg7a3.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Qe}from"./chunk-0myrwz84.js";import{gt,Bn}from"./chunk-gvs17jd0.js";import{Ne,pn,Nc,Dc}from"./chunk-0jtrdgyv.js";import{kr,_r,Cr,Tr,ke}from"./chunk-xyyt8v1r.js";import{O}from"./chunk-wp6q0geg.js";import{ii}from"./chunk-qcw1neka.js";import{y}from"./chunk-3xmt01wr.js";import{i}from"./chunk-e8brwwp1.js";import{L,a}from"./chunk-90kfvtf6.js";import{oc}from"./chunk-zjw6j2x0.js";import{$n,Ue,Ce,Gi,Xi,Rn}from"./chunk-ccty08sm.js";import{nn,ho}from"./chunk-7kaadsd1.js";import{An}from"./chunk-b7j48bq9.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{K}from"./chunk-f6ybdjt0.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Bn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Nc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...L,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=$n(b)+Ue(b),j=Dc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:pn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Tg(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:Tr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=An(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)nn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=K(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),M=f.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Cr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=kr(t.html,u);if(g.htmlAttrs)t.html=_r(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),M){let p=await Rn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Xn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Gn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Xt}/`)}let F={runtime:v.filename,router:x.filename},C=Gi(H,F,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await ho(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ii(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(oc(e._layerGraph),null,2));Xi(C,r);let N=Date.now()-l;return console.log(`
2
+ import{Qe}from"./chunk-3ps07041.js";import{gt,Bn}from"./chunk-34hsn8tn.js";import{Ne,pn,Nc,Dc}from"./chunk-ev2asp1e.js";import{kr,_r,Cr,Tr,ke}from"./chunk-xyyt8v1r.js";import{O}from"./chunk-wp6q0geg.js";import{ii}from"./chunk-e2fvr2w6.js";import{y}from"./chunk-q986z4qy.js";import{i}from"./chunk-vvdew463.js";import{L,a}from"./chunk-f134xm9v.js";import{oc}from"./chunk-zjw6j2x0.js";import{$n,Ue,Ce,Gi,Xi,Rn}from"./chunk-db9tv9kf.js";import{nn,ho}from"./chunk-t2kr9438.js";import{An}from"./chunk-b7j48bq9.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{K}from"./chunk-tvdaa2s4.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Bn():gt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=Qe(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Nc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Ne(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...L,..._,...o,buildMode:"compile",strict:!1},b=await i(e,D,r,T,A),w=$n(b)+Ue(b),j=Dc();return{route:l,sourceFile:n,html:b,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:pn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Tg(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=ke(e.app?.head,{known:Tr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=An(A),b=n.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)nn(o,w);if(e.runtimeConfig)O(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=K(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),M=f.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Cr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=kr(t.html,u);if(g.htmlAttrs)t.html=_r(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await y(t.html),M){let p=await Rn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Ce(t.html,D,!0);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Xn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Gn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Xt}/`)}let F={runtime:v.filename,router:x.filename},C=Gi(H,F,r);if(C.routeRules=A,C.routerContainer=D,b)C.apiRoutes=await ho(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ii(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(oc(e._layerGraph),null,2));Xi(C,r);let N=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${N}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:F,outputDir:r,duration:N}}
4
4
  export{Tg};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{ur}from"./chunk-0myrwz84.js";import{Sr}from"./chunk-xyyt8v1r.js";import{a}from"./chunk-90kfvtf6.js";import{G,Xe}from"./chunk-x2gxx8eg.js";import{Ga}from"./chunk-mr3r8crk.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function sr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function K(e,r={}){return new ur(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=K(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ye(e){return e.includes("data-stx-runtime")}function qa(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=sr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{ur}from"./chunk-3ps07041.js";import{Sr}from"./chunk-xyyt8v1r.js";import{a}from"./chunk-f134xm9v.js";import{G,Xe}from"./chunk-x2gxx8eg.js";import{Ga}from"./chunk-mr3r8crk.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function sr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function K(e,r={}){return new ur(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=K(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function ye(e){return e.includes("data-stx-runtime")}function qa(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=sr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=Sr(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(G(e))return Xe(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function or(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-eywx2f4h.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-eywx2f4h.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Ka(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Ga()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function or(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-7c9nfrhv.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-7c9nfrhv.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Ka(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${Ga()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-eywx2f4h.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function be(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-7c9nfrhv.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-eywx2f4h.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
12
+ `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-7c9nfrhv.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
13
13
  </body>`+e.slice(d+7)}
14
14
  export{sr,K,ye,qa,or,Ka,be};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{k}from"./chunk-wt18wv6x.js";import{A,kn}from"./chunk-zn3c0ew5.js";import{_,Y}from"./chunk-0jtrdgyv.js";import{a}from"./chunk-90kfvtf6.js";import{Te,Qt,en,tn}from"./chunk-sz0e6tpq.js";import{yt}from"./chunk-s1vj8gtz.js";import{ft,jn,Kt,ce}from"./chunk-h6pmg82p.js";import{T,$r}from"./chunk-ncs2j5kc.js";import p from"path";var c=new Map;function v(i,n){for(let s of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of i.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of i.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Am(i){let n;if(i)n=p.resolve(i);else{let t=await a();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${en()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ce(c,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Te(t))])],f=ft(l()),d=Kt(c,s,f);if(d!==void 0)return d||null;if(r.length===0)return ce(c,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let b=u.map((t)=>t.file),m=[],g=new Set,x=Y({loader:"ts",target:"browser",define:_()});for(let t of b)try{let e=await Bun.file(t).text(),y=p.basename(t,".ts");if(v(e,g),Qt(e))e=await tn(e,t,{projectRoot:process.cwd(),externalizeUserModules:T()});e=yt(e),e=A(e),e=kn(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=x.transformSync(e),m.push(`// Store: ${y}
2
+ import{k}from"./chunk-wt18wv6x.js";import{A,kn}from"./chunk-zn3c0ew5.js";import{_,Y}from"./chunk-ev2asp1e.js";import{a}from"./chunk-f134xm9v.js";import{Te,Qt,en,tn}from"./chunk-kdfdgn6c.js";import{yt}from"./chunk-khqa12tb.js";import{ft,jn,Kt,ce}from"./chunk-h6pmg82p.js";import{T,$r}from"./chunk-ncs2j5kc.js";import p from"path";var c=new Map;function v(i,n){for(let s of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of i.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of i.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Am(i){let n;if(i)n=p.resolve(i);else{let t=await a();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${en()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ce(c,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Te(t))])],f=ft(l()),d=Kt(c,s,f);if(d!==void 0)return d||null;if(r.length===0)return ce(c,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let b=u.map((t)=>t.file),m=[],g=new Set,x=Y({loader:"ts",target:"browser",define:_()});for(let t of b)try{let e=await Bun.file(t).text(),y=p.basename(t,".ts");if(v(e,g),Qt(e))e=await tn(e,t,{projectRoot:process.cwd(),externalizeUserModules:T()});e=yt(e),e=A(e),e=kn(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=x.transformSync(e),m.push(`// Store: ${y}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return ce(c,s,f,""),null;let S=m.join(`
4
4
 
5
5
  `),h=`;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qp,ef,Te,tf,ja,Yt,Zt,Gm,Ba,Qt,Jn,nf,rf,sf,go,en,of,tn,af}from"./chunk-sz0e6tpq.js";import"./chunk-7kaadsd1.js";import"./chunk-1xjv71dw.js";import"./chunk-90kfvtf6.js";import"./chunk-hmkg3xy0.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-0myrwz84.js";import"./chunk-0jtrdgyv.js";import"./chunk-qcw1neka.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Jn as MODULE_SPECIFIER_PREFIX,Qp as bundleCacheDir,ef as bundleCacheEntryLimit,tn as bundleClientScript,Zt as clearBundleFailures,Te as clientBundleDependencies,Yt as getBundleFailures,Qt as hasUserImports,en as moduleSubstitutionKey,rf as normalizeRegistrySpecifiers,of as queueClientBundleBuild,ja as recordBundleFailure,nf as registryIdForPath,Ba as resolveBundlerFallback,sf as rewriteRegistryImports,Gm as setBundlerFallbackMode,tf as shouldLogBundlerDiagnostics,af as tempBuildName,go as withModuleSubstitutes};
2
+ import{Qp,ef,Te,tf,ja,Yt,Zt,Gm,Ba,Qt,Jn,nf,rf,sf,go,en,of,tn,af}from"./chunk-kdfdgn6c.js";import"./chunk-t2kr9438.js";import"./chunk-1xjv71dw.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Jn as MODULE_SPECIFIER_PREFIX,Qp as bundleCacheDir,ef as bundleCacheEntryLimit,tn as bundleClientScript,Zt as clearBundleFailures,Te as clientBundleDependencies,Yt as getBundleFailures,Qt as hasUserImports,en as moduleSubstitutionKey,rf as normalizeRegistrySpecifiers,of as queueClientBundleBuild,ja as recordBundleFailure,nf as registryIdForPath,Ba as resolveBundlerFallback,sf as rewriteRegistryImports,Gm as setBundlerFallbackMode,tf as shouldLogBundlerDiagnostics,af as tempBuildName,go as withModuleSubstitutes};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{de,xc,$s,fn,m,De,Me}from"./chunk-0jtrdgyv.js";import{cr,Ye,L}from"./chunk-90kfvtf6.js";import{Zn,i}from"./chunk-e8brwwp1.js";import{be}from"./chunk-f6ybdjt0.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=cr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{de,xc,$s,fn,m,De,Me}from"./chunk-ev2asp1e.js";import{cr,Ye,L}from"./chunk-f134xm9v.js";import{Zn,i}from"./chunk-vvdew463.js";import{be}from"./chunk-tvdaa2s4.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=cr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=De(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Me(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await Zn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-86775qk0.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-jh44a0eh.js");t=await o(t)}catch{}return t}
18
18
  export{Oa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qo,dc,o,$t,oe,_,Ie,un,Oe,pe,X,hr,dn,Ts,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,De,Me,Ps,Be,r,hn,h,p,H,Z,xe,S,E}from"./chunk-0jtrdgyv.js";import{u,f,R,t,ae,W,c,Se,li,j,wn,ui,jt,di,Fc,kr,zc,st,Hc,_r,Vc,xn,pi,Uc,Cr,Tr,ke,fi}from"./chunk-xyyt8v1r.js";import{Dt}from"./chunk-wp6q0geg.js";import{bn}from"./chunk-qcw1neka.js";import{y}from"./chunk-3xmt01wr.js";import{dr,bs}from"./chunk-0myrwz84.js";import{Xa,Ja,cr,Ye,Ya,P}from"./chunk-90kfvtf6.js";import{Lo,jo,Bo,Fo}from"./chunk-3t3p2c1t.js";import{Ua,ts}from"./chunk-65fcex5r.js";import{Yr,Zr,Qr}from"./chunk-r5k21k3x.js";import{ns,Ro,Ao,rs,ss,Po}from"./chunk-s1vj8gtz.js";import{Jr,nr}from"./chunk-xw8wwcr8.js";import{xo}from"./chunk-ap30qs8p.js";import{se,Co,Eo,To}from"./chunk-7dc3n69c.js";import{sr,ye,qa,or,Ka}from"./chunk-f6ybdjt0.js";import{G,Xe}from"./chunk-x2gxx8eg.js";import{Za,Qa}from"./chunk-hmkg3xy0.js";import{T,Sn,gi}from"./chunk-ncs2j5kc.js";import fs from"fs";import ce from"path";function lt(){return`
2
+ import{qo,dc,o,$t,oe,_,Ie,un,Oe,pe,X,hr,dn,Ts,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,De,Me,Ps,Be,r,hn,h,p,H,Z,xe,S,E}from"./chunk-ev2asp1e.js";import{u,f,R,t,ae,W,c,Se,li,j,wn,ui,jt,di,Fc,kr,zc,st,Hc,_r,Vc,xn,pi,Uc,Cr,Tr,ke,fi}from"./chunk-xyyt8v1r.js";import{Dt}from"./chunk-wp6q0geg.js";import{bn}from"./chunk-e2fvr2w6.js";import{y}from"./chunk-q986z4qy.js";import{dr,bs}from"./chunk-3ps07041.js";import{Xa,Ja,cr,Ye,Ya,P}from"./chunk-f134xm9v.js";import{Lo,jo,Bo,Fo}from"./chunk-3t3p2c1t.js";import{Ua,ts}from"./chunk-j184qf8s.js";import{Yr,Zr,Qr}from"./chunk-b1a1wx8z.js";import{ns,Ro,Ao,rs,ss,Po}from"./chunk-khqa12tb.js";import{Jr,nr}from"./chunk-4jnmr21x.js";import{xo}from"./chunk-ap30qs8p.js";import{se,Co,Eo,To}from"./chunk-7dc3n69c.js";import{sr,ye,qa,or,Ka}from"./chunk-tvdaa2s4.js";import{G,Xe}from"./chunk-x2gxx8eg.js";import{Za,Qa}from"./chunk-8jb55rfm.js";import{T,Sn,gi}from"./chunk-ncs2j5kc.js";import fs from"fs";import ce from"path";function lt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -1558,13 +1558,13 @@ ${M}
1558
1558
  </style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import it from"path";var us=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ds=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ps(s,e){if(!e||!s.includes("/"))return s;let l=it.dirname(e);return s.replace(us,(a,g,n,d)=>{let v=it.resolve(l,d);return`${g}${n}${v.split(it.sep).join("/")}${n}`})}function cn(s,e){if(!e||!s.includes("<script"))return s;return s.replace(ds,(l,a,g,n)=>`${a}${ps(g,e)}${n}`)}var _e="<!--PARENT_CONTENT_PLACEHOLDER-->";function ln(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kn(s,e){let l=s.length,a=e,g=!0,n=[],d=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(d(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
1559
1559
  `,a+2),a===-1)return-1;a+=1,g=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(v==="/"&&g){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
1560
1560
  `){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
1561
- `)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-eywx2f4h.js");return`<script ${s} src="${a(e)}"></script>`}async function Zn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-erqsgfdj.js")),n=[],d=await g(a(...s),{minify:gi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-eywx2f4h.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=sr(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
1561
+ `)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-7c9nfrhv.js");return`<script ${s} src="${a(e)}"></script>`}async function Zn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-a026vsrp.js")),n=[],d=await g(a(...s),{minify:gi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-7c9nfrhv.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=sr(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
1562
1562
  `+s.slice(a,l.start)+s.slice(l.end);let g=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),d=sr(n);if(d===-1)return g+e+`
1563
1563
  `+n;return n.slice(0,d)+g+e+`
1564
1564
  `+n.slice(d)}function hs(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,g){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=xe(s,l);let n=!e.__stxProcessingDepth;fn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await bn(e,l,a.runtimeConfig);if(n)Ec(e),e.__stx_scope_seq??={n:0,key:Ps(String(e.__filename??l))},e.__stx_head_injections=di(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!Sn())&&l&&l.endsWith(".stx"))xo(s,l);try{return await oe.timeAsync("template-processing",async()=>{let d=await ys(s,e,l,a,g);if(n)d=Zo(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=ke(a.app?.head,{known:Tr,source:"app.head"}),x=(e.__stx_runtime_head||null)??fi(),b=(e.__stx_head_raw||"").trim(),w,k=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)w=k[1].trim(),b=b.replace(k[0],"").trim();let C=e.__sections?.title,D=C?S(C,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((z)=>st(z)).filter(Boolean)),q={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((z)=>!N.has(st(z))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
1565
1565
  `),...x.htmlAttrs&&{htmlAttrs:Hc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},V=pi(d);if(d=Cr(d,q,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},V),V)d=Uc(d,v),d=_r(d,q.htmlAttrs);let O=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&d.includes("<head")){let z=O[1],K=bs(z);d=d.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
1566
1566
  <meta name="stx-layout" content="${ln(z)}">
1567
- <meta name="stx-layout-group" content="${ln(K)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),B=L?G(d):null;if(L&&B&&!/\bdata-stx=/.test(B.tag)){d=Xe(d,(K,Y)=>`<body${Y} data-stx="${L[1]}">`);let z=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(z,"$1")}}if(n){let v=e.__stx_head_injections??di(),m=Vc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=Fc(d,v);let b=a.app?.colorMode;if(b)d=kr(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,k=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-axwwhdtt.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await pn("data-stx-stores",M,a)??b}catch{}m=await Zn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-f9b7847f.js"));k=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-ztckg7a3.js")),A=a.composablesDir,M=[m,b,k].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await pn('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let C=[m,x,w,k].filter((D)=>D!==null).map((D)=>`
1567
+ <meta name="stx-layout-group" content="${ln(K)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),B=L?G(d):null;if(L&&B&&!/\bdata-stx=/.test(B.tag)){d=Xe(d,(K,Y)=>`<body${Y} data-stx="${L[1]}">`);let z=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(z,"$1")}}if(n){let v=e.__stx_head_injections??di(),m=Vc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=Fc(d,v);let b=a.app?.colorMode;if(b)d=kr(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,k=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-z84yfx2x.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await pn("data-stx-stores",M,a)??b}catch{}m=await Zn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-8skqad4q.js"));k=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-yaxq5qq6.js")),A=a.composablesDir,M=[m,b,k].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await pn('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let C=[m,x,w,k].filter((D)=>D!==null).map((D)=>`
1568
1568
  ${D}`).join("");d=ms(d,C)}else{let m=await Zn([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
1569
1569
  `+d.slice(x)}}if(n)d=zc(d);if(n&&e.__stx_inject_css!==!1)d=await y(d,void 0,a.buildMode==="serve",!0);else if(n)d=dn(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=hs(d),n&&e.__stx_runtime_config)d=Dt(d,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let v=vr(e);if(v){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+v+d.slice(x)}}return d})}catch(d){if(d instanceof W)throw d;let v=d instanceof Error?d.message:String(d),m=new ae(`Template processing failed: ${v}`,l,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(j.log(m,{filePath:l,context:e}),wn.logDetailedError(m,{filePath:l,template:s.substring(0,500)}),T()&&!a.debug)console.error(`[stx] ${ce.relative(process.cwd(),l)||l}: ${m.message}`);if(a.debug)throw m;return li.createFallbackContent("Template Processing",m)}}async function ys(s,e,l,a,g){let n=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ce.isAbsolute(a.partialsDir)?ce.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ce.isAbsolute(a.componentsDir)?ce.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ce.isAbsolute(a.layoutsDir)?ce.resolve(n,a.layoutsDir):a.layoutsDir},v=d,m=s;await xs(l,e),ws(e,v),m=await Se(()=>zt(m,e,l,v),m,(O)=>{j.log(O,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${O.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=pe(m,Oe,(O,L)=>`\x00STX_HTML_COMMENT_${L}\x00`);m=x.output;let b=x.tokens,w=(O)=>b.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(L,B)=>b[Number(B)]??""),k="\x00STX_ESCAPED_AT\x00",C="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,k),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(O,L)=>`${C}${L}${D}`),m=Jt(m),m=await an(m,l,g);let A={};m=Zr(m,A);let M={...e.__sections||{}},I="",N=gt(mt(s)),q=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let V=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)I=V[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(I=N,!/@section\s*\(/.test(m))m=`@section('content')
1570
1570
  ${m.trim()}
@@ -1573,7 +1573,7 @@ ${m.trim()}
1573
1573
  @endsection`}}if(I&&m.includes("<script")){let O=X(m),L=O.scripts.map((B)=>gn(B,l)??B);m=hr(O.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,B)=>(M[L]=B,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,L,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return O;try{let z=u(B.trim(),e);if(z===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(z)-1;return M[L]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,B)=>{if(B.includes("@parent"))M[L]=B.replace("@parent",_e);else M[L]=B.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,B)=>M[L]||B||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=Qr(m,A),I){let O=[],L=X(m),B=pe(L.output,un,(z,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(m=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(z,K,Y)=>{let ee=K==="SCRIPT"?gn(L.scripts[Number(Y)],l):B.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let z=O.join(`
1574
1574
  `);M.content=M.content?`${M.content}
1575
1575
  ${z}`:z,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,g.add(I);else O=await Se(()=>hn(I,l,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return fs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${I} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"");if(j.log(Error(ue),{layoutPath:I,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),d.debug)throw new ae(ue,l);return m}let L=await Se(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});L=cn(L,O);let B=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(d.debug)console.log(`Found nested layout: ${B[1]} in ${O}`);let ee={},te=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,be)=>(ee[le]=be.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(_e)){let be=M[ie].indexOf(_e);M[ie]=M[ie].slice(0,be)+le+M[ie].slice(be+_e.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${B[1]}')${te}`;return await i(re,ue,O,d,g)}let z=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=Zr(z,A),Y={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(M[te]){let re=M[te];if(re.includes(_e)){let ie=Y[te]||"",le=re.indexOf(_e);re=re.slice(0,le)+ie+re.slice(le+_e.length)}return re}return ue||""}),K=vs(K,M),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),K=Qr(K,A),e.__originalFilePath=l,m=await vn(K,e,O,d,g),m=`<!-- stx-layout: ${I} -->
1576
- ${m}`,w(m)}catch(O){if(O instanceof W)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{j.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-cqnpjdc9.js")),n=[],d=!T()&&!Sn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=kn(s,b);if(w===-1)continue;let k=s.slice(b,w);if(!k.trim())continue;let C=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-8c4zbq1k.js"));await A(k,e,C,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:C,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:yn(C,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(j.log(M,{filePath:C,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${C}: ${M.message}`),d)n.push({...D,markup:yn(C,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function $s(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-03p4w958.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return j.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function vn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await $s(n,e,l),n=await At(n,e,l,d),xe(n))n=Ro(n,e),n=ss(n,e),n=rs(n,e);n=Ao(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-8z469777.js"));n=v(n,e),n=nr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await ts(n,e,l,d,g),n=Xa(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-dhdt7e54.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-w2h6nn70.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-g6wd49b5.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:C}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,l),n=C(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-r6bc2q44.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-bcr8sq50.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-h8kbcz9t.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-4fxg20je.js"));n=I(n,e,l),n=N(n,e,l),n=q(n,e,l);let{processPartialHydrationDirectives:V,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-t7mbaf69.js"));n=V(n,e,l),n=O(n);let{processComputedDirectives:L,processWatchDirectives:B}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,l),n=B(n,e,l);let{processFormValidationDirectives:z}=await o("stx/forms-validation",()=>import("./chunk-3vsnnr1b.js"));n=z(n,e,l);let{processHeadDirective:K,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-rwjgpmrw.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=K(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1576
+ ${m}`,w(m)}catch(O){if(O instanceof W)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{j.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-717bek8h.js")),n=[],d=!T()&&!Sn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=kn(s,b);if(w===-1)continue;let k=s.slice(b,w);if(!k.trim())continue;let C=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-wcj2rb7b.js"));await A(k,e,C,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:C,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:yn(C,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(j.log(M,{filePath:C,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${C}: ${M.message}`),d)n.push({...D,markup:yn(C,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function $s(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-pp1beqrr.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return j.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function vn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await $s(n,e,l),n=await At(n,e,l,d),xe(n))n=Ro(n,e),n=ss(n,e),n=rs(n,e);n=Ao(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-2t4z29p8.js"));n=v(n,e),n=nr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await ts(n,e,l,d,g),n=Xa(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-dhdt7e54.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-w2h6nn70.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-g6wd49b5.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:C}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,l),n=C(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-r6bc2q44.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-bcr8sq50.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-h8kbcz9t.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-4fxg20je.js"));n=I(n,e,l),n=N(n,e,l),n=q(n,e,l);let{processPartialHydrationDirectives:V,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-t7mbaf69.js"));n=V(n,e,l),n=O(n);let{processComputedDirectives:L,processWatchDirectives:B}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,l),n=B(n,e,l);let{processFormValidationDirectives:z}=await o("stx/forms-validation",()=>import("./chunk-nf44whzd.js"));n=z(n,e,l);let{processHeadDirective:K,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-rwjgpmrw.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=K(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
1577
1577
  `;if(n=Y(n,e),n=ee(n,e,l),n=Xt(n),n=Co(n,e),n=Ct(n),n=Ut(n),n=await Yr(n,e,l,d,g),n=await ts(n,e,l,d,g),e.__stxProcessingDepth===1)n=Tc(n,e);if(n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=Zo(n),n=se(n,e,l),n=Jr(n),n=Sc(n,e,{filePath:l,buildMode:d.buildMode}),n=Eo(n,e),n=To(n,e),n=ze(n,e),n=Nt(n,e),n=Ht(n,e),n=await bt(n,e,l,d),n=await Ya(n,e,l),n=await Za(n,e,l,d),n=Qa(n,e,l,d),n=Lo(n,e,l,d),n=jo(n,e,l),n=Bo(n,e,l,d),n=_t(n,e,l,d),n=Rs(n,e),n=As(n),n=kc(n),!d.skipEventDirectives)n=dc(n,e,l);if(n=vt(n,e,l),d.debug){let F=/\bx-data\s*=/.test(n),U=ns(s);if(F&&U)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1578
1578
  Both work on the same page, but they manage separate scopes.
1579
1579
  Prefer signals (state/derived/effect) for new components.`)}n=Ua(n,e),n=await S(n,e,l),n=_c(n),n=Cc(n),n=pt(n);let{processXElementDirectives:re}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=re(n);let ie=e.__originalFilePath||l,le=De(e);if(n=await Po(n,d,ie,le),n=Ot(n,e),n=await Wt(n,e,l,d),d.media?.image?.autoSiblings){let F=d.publicDir||"public",{rewriteImagesWithSiblings:U}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-9736003n.js"));n=await U(n,{publicDir:F})}if(d.seo?.enabled)n=Fo(n,e,d);let be=(F,U,J=!0)=>{if(!U)return F;let me=U.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Te=ne.index+fe.index;F=F.slice(0,Te)+me[0]+F.slice(Te+fe[0].length)}if(U=U.replace(me[0],"").trim(),!U)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${U}
@@ -1587,6 +1587,6 @@ ${lt()}
1587
1587
  `+Te}else n=n.replace("</head>",`${U}
1588
1588
  </head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
1589
1589
  ${U}`);else n=U+`
1590
- `+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-cqnpjdc9.js")),U=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=kn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;U.push({start:J.start,end:fe})}if(U.length>0){let J=Array(U.length+1),me=0;for(let ne=0;ne<U.length;ne++){let{start:fe,end:Te}=U[ne];J[ne]=n.slice(me,fe),me=Te}J[U.length]=n.slice(me),n=J.join("")}}let at=Ts(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-cqnpjdc9.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:U,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:U,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:gi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let U=qo(F);if(U){let J=n.lastIndexOf("</body>");n=J===-1?n+U:n.slice(0,J)+U+`
1590
+ `+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-717bek8h.js")),U=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=kn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;U.push({start:J.start,end:fe})}if(U.length>0){let J=Array(U.length+1),me=0;for(let ne=0;ne<U.length;ne++){let{start:fe,end:Te}=U[ne];J[ne]=n.slice(me,fe),me=Te}J[U.length]=n.slice(me),n=J.join("")}}let at=Ts(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-717bek8h.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:U,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:U,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:gi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let U=qo(F);if(U){let J=n.lastIndexOf("</body>");n=J===-1?n+U:n.slice(0,J)+U+`
1591
1591
  `+n.slice(J)}e.__stx_event_bindings=[]}}if(!ye(n)&&qa(n))n=await or(n,d);if(n=Ka(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=Et(n,e.cspNonce);return n}
1592
1592
  export{mt,Re,Fa,Xr,vo,wo,Zn,i};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gn,If,Of,Nf,Df,Mf,m,Lf,Qo,jf,$c,Rc}from"./chunk-0jtrdgyv.js";import"./chunk-qcw1neka.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{gn as STX_ENGINE_BINDING_NAMES,Qo as convertToCommonJS,$c as extractScriptFromTemplate,m as extractVariables,Rc as hasVariables,Lf as isCompleteImport,Mf as isMissingBindingFailure,Nf as isModuleResolutionFailure,Df as isSyntaxFailure,jf as splitDeclaration,If as stripTypeScript,Of as withoutStxReferrer};
2
+ import{gn,If,Of,Nf,Df,Mf,m,Lf,Qo,jf,$c,Rc}from"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{gn as STX_ENGINE_BINDING_NAMES,Qo as convertToCommonJS,$c as extractScriptFromTemplate,m as extractVariables,Rc as hasVariables,Lf as isCompleteImport,Mf as isMissingBindingFailure,Nf as isModuleResolutionFailure,Df as isSyntaxFailure,jf as splitDeclaration,If as stripTypeScript,Of as withoutStxReferrer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{L,wf,No,a,P,ph,fh}from"./chunk-90kfvtf6.js";import"./chunk-hmkg3xy0.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-0myrwz84.js";import"./chunk-0jtrdgyv.js";import"./chunk-qcw1neka.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{P as config,L as defaultConfig,ph as defineStxConfig,No as discoverConfig,a as loadStxConfig,wf as resolveStxDirectories,fh as validateConfig};
2
+ import{L,wf,No,a,P,ph,fh}from"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{P as config,L as defaultConfig,ph as defineStxConfig,No as discoverConfig,a as loadStxConfig,wf as resolveStxDirectories,fh as validateConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{zo,Ho,wt,ue,lr,ms,ur,hs,ys,Sf,kf,_f,dr,Cf,Ef,Tf,$f,ic,ac,cc,Vo,lc,Rf,xt,St,kt,_t,Ct,Et,Qe,Af}from"./chunk-0myrwz84.js";export{ur as Router,Tf as abortNavigation,ms as bracketPathToRegex,xt as clearMiddleware,ac as createClientCookieManager,Ct as createMiddlewareContext,_t as createRouteLocation,ic as createServerCookieManager,cc as createStorageManager,$f as defineMiddleware,kf as defineRoute,_f as defineRoutes,hs as findErrorPage,ys as formatRoutes,Ho as generateRouteManifest,zo as generateRouteTypes,lc as getMiddleware,St as getMiddlewareNames,Qe as getRouterScript,Af as getRouterScriptDev,Rf as hasMiddleware,wt as isFileRequestPath,kt as loadMiddlewareFromDirectory,lr as matchRoute,Ef as navigateTo,ue as patternToRegex,Vo as registerMiddleware,Cf as resetRoutes,dr as route,Et as runMiddleware,Sf as setAppUrl};
2
+ import{zo,Ho,wt,ue,lr,ms,ur,hs,ys,Sf,kf,_f,dr,Cf,Ef,Tf,$f,ic,ac,cc,Vo,lc,Rf,xt,St,kt,_t,Ct,Et,Qe,Af}from"./chunk-3ps07041.js";export{ur as Router,Tf as abortNavigation,ms as bracketPathToRegex,xt as clearMiddleware,ac as createClientCookieManager,Ct as createMiddlewareContext,_t as createRouteLocation,ic as createServerCookieManager,cc as createStorageManager,$f as defineMiddleware,kf as defineRoute,_f as defineRoutes,hs as findErrorPage,ys as formatRoutes,Ho as generateRouteManifest,zo as generateRouteTypes,lc as getMiddleware,St as getMiddlewareNames,Qe as getRouterScript,Af as getRouterScriptDev,Rf as hasMiddleware,wt as isFileRequestPath,kt as loadMiddlewareFromDirectory,lr as matchRoute,Ef as navigateTo,ue as patternToRegex,Vo as registerMiddleware,Cf as resetRoutes,dr as route,Et as runMiddleware,Sf as setAppUrl};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Tg}from"./chunk-tbf23kt0.js";import"./chunk-db9tv9kf.js";import"./chunk-34hsn8tn.js";import"./chunk-s04ban9p.js";import"./chunk-t2kr9438.js";import"./chunk-vvdew463.js";import"./chunk-q986z4qy.js";import"./chunk-ap30qs8p.js";import"./chunk-4jnmr21x.js";import"./chunk-b1a1wx8z.js";import"./chunk-j184qf8s.js";import"./chunk-qq0m0fyn.js";import"./chunk-7dc3n69c.js";import"./chunk-khqa12tb.js";import"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import"./chunk-dkrj1qn3.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Tg as buildForProduction};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{S}from"./chunk-0jtrdgyv.js";import{le}from"./chunk-jb5sftzz.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function na(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var zl=na;class Ln{rules=[];defaultValue="";addRule(e){let t=new Ln;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Ln;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Ln;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var qg=new Ln;function Hl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>S(c,{...t,message:l},r)).join(`
2
+ import{S}from"./chunk-ev2asp1e.js";import{le}from"./chunk-jb5sftzz.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function na(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var zl=na;class Ln{rules=[];defaultValue="";addRule(e){let t=new Ln;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Ln;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Ln;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var qg=new Ln;function Hl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>S(c,{...t,message:l},r)).join(`
3
3
  `)}catch{return""}})}function Vl(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>S(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function Ul(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Kg(e,t,r){let n=e;return n=Hl(n,t,r),n=Vl(n,t,r),n=Ul(n,t,r),n}export{na,zl,Ln,qg,Hl,Vl,Ul,Kg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S}from"./chunk-0jtrdgyv.js";import{i}from"./chunk-e8brwwp1.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{S}from"./chunk-ev2asp1e.js";import{i}from"./chunk-vvdew463.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{al,cl}from"./chunk-6r4at2sz.js";import"./chunk-y0t70c3t.js";import"./chunk-jbvznf9t.js";import"./chunk-zav8yrtp.js";import"./chunk-yw66yks2.js";import"./chunk-6w1qcqr1.js";import"./chunk-768evhvm.js";import"./chunk-tbf23kt0.js";import"./chunk-db9tv9kf.js";import"./chunk-cwhzk2n3.js";import"./chunk-g1tq4xdb.js";import"./chunk-ecy52773.js";import"./chunk-67abad76.js";import"./chunk-5zgb01qx.js";import"./chunk-dxqvv686.js";import"./chunk-2aarvd3a.js";import"./chunk-rb2a1qxb.js";import"./chunk-xwdhvmnt.js";import"./chunk-s9b6abkb.js";import"./chunk-9dsfcxzr.js";import"./chunk-t6ayy0t5.js";import"./chunk-4ckxs446.js";import"./chunk-029qng4p.js";import"./chunk-ckrmrdjp.js";import"./chunk-42w6snem.js";import"./chunk-6n11z33h.js";import"./chunk-vb0vf4f4.js";import"./chunk-rr4dndjr.js";import"./chunk-34hsn8tn.js";import"./chunk-vq5z2b8n.js";import"./chunk-t63f15yh.js";import"./chunk-edka95zp.js";import{Jt}from"./chunk-s04ban9p.js";import"./chunk-kdfdgn6c.js";import"./chunk-t2kr9438.js";import"./chunk-1xjv71dw.js";import{Re,i}from"./chunk-vvdew463.js";import"./chunk-q986z4qy.js";import"./chunk-ap30qs8p.js";import"./chunk-4jnmr21x.js";import"./chunk-b1a1wx8z.js";import"./chunk-j184qf8s.js";import"./chunk-qq0m0fyn.js";import"./chunk-7dc3n69c.js";import"./chunk-khqa12tb.js";import{be}from"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import{ir,ar}from"./chunk-dkrj1qn3.js";import{cs,L,a}from"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import{m,Me}from"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";import"./chunk-qa9t9k6z.js";import"./chunk-6cz1sbb1.js";export{cs as buildWebComponents,ar as cacheTemplate,ir as checkCache,Jt as classifyAllScripts,al as createMiddleware,cl as createRoute,L as defaultConfig,m as extractVariables,be as injectRouterScript,a as loadStxConfig,Me as processClientScript,i as processDirectives,Re as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ro,Im,Om}from"./chunk-rr4dndjr.js";import"./chunk-kdfdgn6c.js";import"./chunk-t2kr9438.js";import"./chunk-1xjv71dw.js";import"./chunk-khqa12tb.js";import"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Om as clearComposableCache,Im as getComposableScript,ro as listComposableModules};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Am,Pm}from"./chunk-vb0vf4f4.js";import"./chunk-kdfdgn6c.js";import"./chunk-t2kr9438.js";import"./chunk-1xjv71dw.js";import"./chunk-khqa12tb.js";import"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Pm as clearStoreCache,Am as getStoreScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{yl,Wi,kg,bl,vl,_g,Cg}from"./chunk-6w1qcqr1.js";import"./chunk-rr4dndjr.js";import"./chunk-kdfdgn6c.js";import"./chunk-t2kr9438.js";import"./chunk-1xjv71dw.js";import"./chunk-khqa12tb.js";import"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import{At,Pf}from"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{yl as buildVirtualSource,At as extractScriptBlocks,Pf as extractTemplateExpressions,bl as findRuntimeTypeDeclarations,vl as findStxModuleDeclarations,Cg as formatTypecheckDiagnostics,kg as sourcePathFor,_g as typecheckStxFiles,Wi as virtualPathFor};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zn,i}from"./chunk-vvdew463.js";import"./chunk-q986z4qy.js";import"./chunk-ap30qs8p.js";import"./chunk-4jnmr21x.js";import"./chunk-b1a1wx8z.js";import"./chunk-j184qf8s.js";import"./chunk-qq0m0fyn.js";import"./chunk-7dc3n69c.js";import"./chunk-khqa12tb.js";import{be}from"./chunk-tvdaa2s4.js";import"./chunk-8v2vbc4y.js";import"./chunk-dkrj1qn3.js";import"./chunk-f134xm9v.js";import"./chunk-8jb55rfm.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import{Ie,Rs,As}from"./chunk-ev2asp1e.js";import"./chunk-e2fvr2w6.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{Zn as buildModulesTag,be as injectRouterScript,i as processDirectives,Rs as processJsonDirective,As as processOnceDirective,Ie as validateClientScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{at,ct,lt}from"./chunk-6ts3sthp.js";import"./chunk-wt18wv6x.js";import"./chunk-zn3c0ew5.js";import{m}from"./chunk-0jtrdgyv.js";import"./chunk-xyyt8v1r.js";import"./chunk-wp6q0geg.js";import"./chunk-qcw1neka.js";import{zt,Us,Ht,Ri,it,Ai,Ws,Vt,Ii,Ut}from"./chunk-an387127.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Ai("Config file changed, restarting...");try{await e.onChange()}catch(p){it(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:dt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function dt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var pt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,pt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{at,ct,lt}from"./chunk-6ts3sthp.js";import"./chunk-wt18wv6x.js";import"./chunk-zn3c0ew5.js";import{m}from"./chunk-ev2asp1e.js";import"./chunk-xyyt8v1r.js";import"./chunk-wp6q0geg.js";import"./chunk-e2fvr2w6.js";import{zt,Us,Ht,Ri,it,Ai,Ws,Vt,Ii,Ut}from"./chunk-an387127.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Ai("Config file changed, restarting...");try{await e.onChange()}catch(p){it(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:dt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function dt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var pt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,pt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-3qnke2jb.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-3qnke2jb.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-zc5e9bnh.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-zc5e9bnh.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await Vt(t);ct(t,r);let s=Ut(t.config,r);lt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),g=`http://${o}:${e.port}`,y=Ii(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let u=await Vt(t);ct(t,u);let f=Ut(t.config,u);if(lt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=g;try{let{exec:l}=await import("child_process"),u=process.platform;l(`${u==="darwin"?"open":u==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:g,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],g=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((u)=>u.id===p);if(!l)return new Response("Story not found",{status:404});try{let u=await Y(t,l,g,y);return Response.json({html:u.html,css:u.css,js:u.js,errors:u.errors,duration:u.duration})}catch(u){return Response.json({html:"",css:"",js:"",errors:[u instanceof Error?u.message:String(u)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((g)=>g.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">