@stacksjs/stx 0.2.787 → 0.2.789

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 (86) hide show
  1. package/dist/{chunk-8w54jyt7.js → chunk-05vb0qc8.js} +1 -1
  2. package/dist/{chunk-40ambk0h.js → chunk-06fej0jb.js} +4 -4
  3. package/dist/{chunk-5pgv8jh1.js → chunk-1d8zapw4.js} +1 -1
  4. package/dist/{chunk-wdqgf1hh.js → chunk-2cdpkbar.js} +1 -1
  5. package/dist/{chunk-d3pemcp8.js → chunk-348zcmgq.js} +2 -2
  6. package/dist/{chunk-8ycz8ss9.js → chunk-3654413v.js} +2 -2
  7. package/dist/{chunk-hzmhh3k5.js → chunk-4jqtj07m.js} +1 -1
  8. package/dist/{chunk-qf86f6c5.js → chunk-4n1z8qha.js} +1 -1
  9. package/dist/chunk-4pd6yk12.js +2 -0
  10. package/dist/{chunk-ymb0h1b9.js → chunk-4r9c6b95.js} +2 -2
  11. package/dist/{chunk-t0kh3ev1.js → chunk-5kwy36hj.js} +18 -18
  12. package/dist/{chunk-qvc6d3ka.js → chunk-5q9nn7dg.js} +1 -1
  13. package/dist/{chunk-hc8htggj.js → chunk-5qghq1c9.js} +2 -2
  14. package/dist/{chunk-gj5hjak1.js → chunk-67prgz52.js} +1 -1
  15. package/dist/chunk-6btgrn1h.js +2 -0
  16. package/dist/chunk-6pnbee90.js +2 -0
  17. package/dist/{chunk-2scyqqt3.js → chunk-6rzdz82t.js} +1 -1
  18. package/dist/{chunk-7gvaz6ye.js → chunk-6tyxze52.js} +1 -1
  19. package/dist/{chunk-hf2h0shz.js → chunk-70266pbx.js} +1 -1
  20. package/dist/{chunk-cg5ar6y0.js → chunk-73smt7ft.js} +1 -1
  21. package/dist/chunk-8x3jekrk.js +2 -0
  22. package/dist/chunk-968gy66p.js +2 -0
  23. package/dist/{chunk-vr6jccpy.js → chunk-9rk5xcvc.js} +1 -1
  24. package/dist/{chunk-hqmgvan6.js → chunk-9rvm6wfm.js} +1 -1
  25. package/dist/{chunk-x8pehmac.js → chunk-a8pbhdhr.js} +1 -1
  26. package/dist/{chunk-vgtbds23.js → chunk-adjkcbcy.js} +4 -4
  27. package/dist/chunk-b1d3z51x.js +2 -0
  28. package/dist/{chunk-mqr61kqn.js → chunk-cgjf0zdk.js} +1 -1
  29. package/dist/{chunk-p0f5vygc.js → chunk-ch2f7hf7.js} +1 -1
  30. package/dist/{chunk-qrnws56v.js → chunk-dk5jzps7.js} +1 -1
  31. package/dist/{chunk-w6emseps.js → chunk-f2t4dfk0.js} +3 -3
  32. package/dist/{chunk-npfs1zyn.js → chunk-frthfvrd.js} +1 -1
  33. package/dist/{chunk-9th217rf.js → chunk-hp0y7jr3.js} +1 -1
  34. package/dist/{chunk-n70gbh4y.js → chunk-jxzgph88.js} +1 -1
  35. package/dist/{chunk-bgybw1k5.js → chunk-kn83cqxy.js} +1 -1
  36. package/dist/chunk-kvjv3abv.js +2 -0
  37. package/dist/{chunk-qsqha895.js → chunk-mm3n41p0.js} +5 -5
  38. package/dist/{chunk-992nsr70.js → chunk-n49bv3mg.js} +1 -1
  39. package/dist/{chunk-n2cq11e3.js → chunk-neztwp5f.js} +1 -1
  40. package/dist/{chunk-rwbcxzw2.js → chunk-pr71c7t1.js} +2 -2
  41. package/dist/{chunk-kq1zc10a.js → chunk-q340jjzk.js} +1 -1
  42. package/dist/chunk-q54ptm6h.js +2 -0
  43. package/dist/{chunk-nzj7mkvm.js → chunk-qpqg82qv.js} +57 -57
  44. package/dist/{chunk-6w935vyf.js → chunk-qvtx0kzs.js} +1 -1
  45. package/dist/chunk-r4ne3cvw.js +3 -0
  46. package/dist/{chunk-rkpd5pqc.js → chunk-r4r91hs9.js} +1 -1
  47. package/dist/{chunk-tbnyx5d2.js → chunk-rn23wa1x.js} +1 -1
  48. package/dist/{chunk-7wkz9sz5.js → chunk-s4wysh3z.js} +2 -2
  49. package/dist/{chunk-h1cep4w8.js → chunk-s63n6fc1.js} +1 -1
  50. package/dist/{chunk-wrd3aygb.js → chunk-se6p0wsk.js} +1 -1
  51. package/dist/chunk-sq7zsdx9.js +2 -0
  52. package/dist/{chunk-549zk2p7.js → chunk-svvqscdk.js} +1 -1
  53. package/dist/{chunk-nrnkqqmb.js → chunk-tch1wqny.js} +4 -4
  54. package/dist/{chunk-s18ecm80.js → chunk-tqc24ep4.js} +1 -1
  55. package/dist/{chunk-rnaeezmp.js → chunk-tzy4xpsx.js} +1 -1
  56. package/dist/{chunk-44bm0pty.js → chunk-vhyw1zak.js} +1 -1
  57. package/dist/{chunk-e44zheax.js → chunk-w869yz2r.js} +1 -1
  58. package/dist/{chunk-k7w05cjv.js → chunk-whpb8p6x.js} +1 -1
  59. package/dist/{chunk-v6z3ak8h.js → chunk-wyc31w66.js} +1 -1
  60. package/dist/{chunk-0jp3tt5c.js → chunk-xb2576xg.js} +1 -1
  61. package/dist/{chunk-2v75eyf8.js → chunk-xxd1ywkf.js} +1 -1
  62. package/dist/chunk-yx5qq570.js +2 -0
  63. package/dist/{chunk-ebbzq4va.js → chunk-yxgx0c2g.js} +1 -1
  64. package/dist/{chunk-76ngpa25.js → chunk-zgf7gpeh.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/native/compiler/style-variables.js +7 -0
  69. package/dist/native/runtime/binding-tree.js +14 -9
  70. package/dist/native/runtime/native-host.js +5 -2
  71. package/dist/native/testing.js +7 -0
  72. package/dist/pwa.js +1 -1
  73. package/dist/ssg.js +2 -2
  74. package/dist/utils.js +13 -1
  75. package/package.json +5 -5
  76. package/dist/chunk-0s25gyy5.js +0 -2
  77. package/dist/chunk-1pdaqca9.js +0 -2
  78. package/dist/chunk-498286bb.js +0 -2
  79. package/dist/chunk-bm7xr4xh.js +0 -3
  80. package/dist/chunk-cagvn9tf.js +0 -2
  81. package/dist/chunk-dtc8expv.js +0 -2
  82. package/dist/chunk-eeqr09wt.js +0 -2
  83. package/dist/chunk-kk8vqwe4.js +0 -2
  84. package/dist/chunk-memz2xdn.js +0 -2
  85. package/dist/chunk-t2hscbrh.js +0 -2
  86. package/dist/chunk-wqjdzdaj.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{k}from"./chunk-gb65t4n1.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,C,Y}from"./chunk-nzj7mkvm.js";import{a}from"./chunk-7wkz9sz5.js";import{he,nn,rn,sn}from"./chunk-e44zheax.js";import{wt}from"./chunk-8ycz8ss9.js";import{mt,zn,Gt,ce}from"./chunk-tsvnhc0c.js";import{E,Cn}from"./chunk-bmfk3b29.js";import M from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function R(s,o=E()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${rn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ce(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>he(l))])],f=mt(i()),u=Gt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ce(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=Y({loader:"ts",target:"browser",define:C()});for(let l of p)try{let c=await Bun.file(l).text(),_=b.basename(l,".ts"),y=new Set;B(c,y);let v=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(nn(c))c=await sn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=wt(c),c=A(c),c=En(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:_,ids:v.length===N?v:[],declared:y,code:`// Store: ${_}
2
+ import{k}from"./chunk-gb65t4n1.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,C,Y}from"./chunk-qpqg82qv.js";import{a}from"./chunk-s4wysh3z.js";import{he,nn,rn,sn}from"./chunk-w869yz2r.js";import{wt}from"./chunk-3654413v.js";import{mt,zn,Gt,ce}from"./chunk-tsvnhc0c.js";import{E,Cn}from"./chunk-bmfk3b29.js";import M from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function R(s,o=E()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${rn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ce(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>he(l))])],f=mt(i()),u=Gt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ce(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=Y({loader:"ts",target:"browser",define:C()});for(let l of p)try{let c=await Bun.file(l).text(),_=b.basename(l,".ts"),y=new Set;B(c,y);let v=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(nn(c))c=await sn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=wt(c),c=A(c),c=En(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:_,ids:v.length===N?v:[],declared:y,code:`// Store: ${_}
3
3
  ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return ce(h,t,f,{chunks:[]}),null;f=mt(i());let S={chunks:g};return ce(h,t,f,S),S}function j(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
4
4
 
5
5
  `),n=`;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{de,Dc,js,mn,m,De,Le}from"./chunk-nzj7mkvm.js";import{dr,Qe,j}from"./chunk-7wkz9sz5.js";import{tr,i}from"./chunk-vgtbds23.js";import{we}from"./chunk-40ambk0h.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}=dr(s),a=await(e.renderer??((n)=>Qe(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,Dc,js,mn,m,De,Le}from"./chunk-qpqg82qv.js";import{dr,Qe,j}from"./chunk-s4wysh3z.js";import{tr,i}from"./chunk-adjkcbcy.js";import{we}from"./chunk-06fej0jb.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}=dr(s),a=await(e.renderer??((n)=>Qe(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 Le(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await tr(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 we(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-9th217rf.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await we(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-hp0y7jr3.js");t=await o(t)}catch{}return t}
18
18
  export{Ka};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-gb65t4n1.js";import"./chunk-2yxva96k.js";import{b,x,C,Y}from"./chunk-nzj7mkvm.js";import"./chunk-94gyfwpz.js";import"./chunk-27rzdq3n.js";import"./chunk-wrd3aygb.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-gb65t4n1.js";import"./chunk-2yxva96k.js";import{b,x,C,Y}from"./chunk-qpqg82qv.js";import"./chunk-94gyfwpz.js";import"./chunk-27rzdq3n.js";import"./chunk-se6p0wsk.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ml,sa,Gg,Dl,Ll,Jg,Yg}from"./chunk-jxzgph88.js";import"./chunk-s63n6fc1.js";import"./chunk-w869yz2r.js";import"./chunk-frthfvrd.js";import"./chunk-7sh9fa3q.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import{It,Gf}from"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Ml as buildVirtualSource,It as extractScriptBlocks,Gf as extractTemplateExpressions,Dl as findRuntimeTypeDeclarations,Ll as findStxModuleDeclarations,Yg as formatTypecheckDiagnostics,Gg as sourcePathFor,Jg as typecheckStxFiles,sa as virtualPathFor};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{us,or,If}from"./chunk-n49bv3mg.js";import"./chunk-qv85c3qy.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import{Pt}from"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{If as declareBareLoopHead,Pt as parseLoopBinding,or as processLoops,us as reportDeferredLoopWarnings};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pf,ls}from"./chunk-vr6jccpy.js";import"./chunk-bm7xr4xh.js";import"./chunk-qv85c3qy.js";import"./chunk-w5hhqjwr.js";import{kr}from"./chunk-nzj7mkvm.js";import"./chunk-wrd3aygb.js";import"./chunk-27rzdq3n.js";import{st}from"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{st as freeIdentifiers,ls as processComponents,Pf as processESImports,kr as rendersAsElement};
2
+ import{Pf,ls}from"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-qv85c3qy.js";import"./chunk-w5hhqjwr.js";import{kr}from"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import{st}from"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{st as freeIdentifiers,ls as processComponents,Pf as processESImports,kr as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-nzj7mkvm.js";import{i}from"./chunk-vgtbds23.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{_}from"./chunk-qpqg82qv.js";import{i}from"./chunk-adjkcbcy.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}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{_}from"./chunk-nzj7mkvm.js";import{le}from"./chunk-9tqa8xvf.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 ma(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 ou=ma;class Fn{rules=[];defaultValue="";addRule(e){let t=new Fn;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 Fn;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 Fn;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 $m=new Fn;function iu(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)=>_(c,{...t,message:l},r)).join(`
2
+ import{_}from"./chunk-qpqg82qv.js";import{le}from"./chunk-9tqa8xvf.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 ma(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 ou=ma;class Fn{rules=[];defaultValue="";addRule(e){let t=new Fn;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 Fn;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 Fn;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 $m=new Fn;function iu(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)=>_(c,{...t,message:l},r)).join(`
3
3
  `)}catch{return""}})}function au(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)=>_(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function cu(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 Rm(e,t,r){let n=e;return n=iu(n,t,r),n=au(n,t,r),n=cu(n,t,r),n}export{ma,ou,Fn,$m,iu,au,cu,Rm};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xe,fi,gi,rg,Mt,Wc,mi,qc,Wh,De,yn,Le}from"./chunk-nzj7mkvm.js";import{Qc,s}from"./chunk-14ft0zc7.js";import"./chunk-wrd3aygb.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{xe as BROWSER_CORE_IMPORTS,rg as STX_AUTO_IMPORTS,fi as extractAndStripCssImports,De as extractBridgeData,Qc as findInterpolationEnd,qc as generateAutoImportDestructuring,Wh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Mt as injectBrowserCoreAutoImports,Le as processClientScript,mi as referencesName,gi as renderVendorStyleTags,s as stripCommentsAndLiterals,Wc as transformAutoImports};
2
+ import{xe,fi,gi,rg,Mt,Wc,mi,qc,Wh,De,yn,Le}from"./chunk-qpqg82qv.js";import{Qc,s}from"./chunk-14ft0zc7.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{xe as BROWSER_CORE_IMPORTS,rg as STX_AUTO_IMPORTS,fi as extractAndStripCssImports,De as extractBridgeData,Qc as findInterpolationEnd,qc as generateAutoImportDestructuring,Wh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Mt as injectBrowserCoreAutoImports,Le as processClientScript,mi as referencesName,gi as renderVendorStyleTags,s as stripCommentsAndLiterals,Wc as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ka,_a,Ca,Ea,bh}from"./chunk-r4r91hs9.js";import"./chunk-3gn1t0pa.js";import"./chunk-5qghq1c9.js";import"./chunk-c0ejyxfj.js";import"./chunk-adjkcbcy.js";import"./chunk-348zcmgq.js";import"./chunk-tch1wqny.js";import"./chunk-2gqhfge6.js";import"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-n49bv3mg.js";import"./chunk-qv85c3qy.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-cgjf0zdk.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{ka as buildNative,bh as default,_a as findCraftBinary,Ea as getAvailableFormats,Ca as getAvailableTargets};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zg}from"./chunk-05vb0qc8.js";import"./chunk-f2t4dfk0.js";import"./chunk-59tbk9qj.js";import"./chunk-wyc31w66.js";import"./chunk-frthfvrd.js";import"./chunk-adjkcbcy.js";import"./chunk-348zcmgq.js";import"./chunk-tch1wqny.js";import"./chunk-2gqhfge6.js";import"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-n49bv3mg.js";import"./chunk-qv85c3qy.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-cgjf0zdk.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Zg as buildForProduction};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{dl,pl}from"./chunk-gb65t4n1.js";import{H,yr,Is,Os,ri,si,Ns,wr,Ne,pe,G,xr,ie,J,I,rt,Sr,ci,Cr,Fe,r,p,V,wn}from"./chunk-nzj7mkvm.js";import{f,R,st,d}from"./chunk-94gyfwpz.js";import{n}from"./chunk-bm7xr4xh.js";import{se}from"./chunk-qv85c3qy.js";import{s}from"./chunk-14ft0zc7.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function bn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Ue(e)),{recursive:!0}),Q.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Mo(e){let t=kt(e);return t?be().catalog.get(t):void 0}function Do(e){let t=kt(e);return t?be().transparent.has(t):!1}function Lo(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function $h(e){let t=Mo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Lo(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:Do(e)?void 0:t.placeholder?.dataUrl}}function cs(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function Rh(e,t,i={}){if(!e||!Q.existsSync(e))return cs(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return cs(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return cs(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=Ct(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return cs(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await bn(y.entries),b=xn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=ri(e,o);if(a!==void 0)return a;for(let c of si(e,t,i,o))if(await r(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(wr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function Z(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=Z(e,"src")||"",a=Mo(o),c=Z(e,"alt")||"",l=Z(e,"width")||(a?String(a.source.width):void 0),m=Z(e,"height")||(a?String(a.source.height):void 0),u=Z(e,"sizes"),y=Z(e,"srcset"),v=Z(e,"densities"),b=Z(e,"format"),C=Do(o)||Xe(o)?.transparent===!0,x=Z(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=Z(e,"placeholderColor")||"#e5e7eb",w=Z(e,"provider"),S=Z(e,"class")||Z(e,"className")||"",A=Z(e,"style")||"",P=Z(e,"objectFit")||Z(e,"fit"),k=Z(e,"objectPosition")||Z(e,"position"),O=Z(e,"quality"),W=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),U=Ie(e,"priority",!1),q=Z(e,"loading"),B=Z(e,"decoding")||"async",N=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,F=y||"",X="";if(a)F=a.sources[a.fallback.format]||"",X=u?Ve(u):"100vw";else if(!F&&u&&w&&w!=="local"&&w!=="static")F=Ge(o,Ze,w,b),X=Ve(u);else if(!F&&v){let _=v.split(/\s+/).map((E)=>Number.parseFloat(E.replace("x","")));F=In(o,_,T,w,b)}else if(u)X=Ve(u);let L=[];if(A)L.push(A);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(_&&x==="color")L.push(`background-color:${_.color}`),D.push("backgroundColor");else if(_)L.push(`background-color:${_.color}`),L.push(`background-image:url(${_.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let E=En(T||16,j||9,h);L.push(`background-image:url(${E})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(wr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(U||z?"eager":W?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(U)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(F)Y.push(`srcset="${n(wr(F,"fetched"))}"`);if(X)Y.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",E=_n(D)+(_?`;${_}`:"");Y.push(`onload="${n(E)}"`),te.add("onload")}Y.push(...oe(e,te)),Y.push(...ae(e,te));let Te=`<img ${Y.join(" ")} />`,M="";if(z){let E=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${E?` type="${E}"`:""}${F?` imagesrcset="${n(F)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
2
+ import{dl,pl}from"./chunk-gb65t4n1.js";import{H,yr,Is,Os,ri,si,Ns,wr,Ne,pe,G,xr,ie,J,I,rt,Sr,ci,Cr,Fe,r,p,V,wn}from"./chunk-qpqg82qv.js";import{f,R,st,d}from"./chunk-94gyfwpz.js";import{n}from"./chunk-r4ne3cvw.js";import{se}from"./chunk-qv85c3qy.js";import{s}from"./chunk-14ft0zc7.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function bn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Ue(e)),{recursive:!0}),Q.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Mo(e){let t=kt(e);return t?be().catalog.get(t):void 0}function Do(e){let t=kt(e);return t?be().transparent.has(t):!1}function Lo(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function $h(e){let t=Mo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Lo(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:Do(e)?void 0:t.placeholder?.dataUrl}}function cs(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function Rh(e,t,i={}){if(!e||!Q.existsSync(e))return cs(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return cs(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return cs(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=Ct(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return cs(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await bn(y.entries),b=xn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=ri(e,o);if(a!==void 0)return a;for(let c of si(e,t,i,o))if(await r(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(wr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function Z(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=Z(e,"src")||"",a=Mo(o),c=Z(e,"alt")||"",l=Z(e,"width")||(a?String(a.source.width):void 0),m=Z(e,"height")||(a?String(a.source.height):void 0),u=Z(e,"sizes"),y=Z(e,"srcset"),v=Z(e,"densities"),b=Z(e,"format"),C=Do(o)||Xe(o)?.transparent===!0,x=Z(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=Z(e,"placeholderColor")||"#e5e7eb",w=Z(e,"provider"),S=Z(e,"class")||Z(e,"className")||"",A=Z(e,"style")||"",P=Z(e,"objectFit")||Z(e,"fit"),k=Z(e,"objectPosition")||Z(e,"position"),O=Z(e,"quality"),W=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),U=Ie(e,"priority",!1),q=Z(e,"loading"),B=Z(e,"decoding")||"async",N=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,F=y||"",X="";if(a)F=a.sources[a.fallback.format]||"",X=u?Ve(u):"100vw";else if(!F&&u&&w&&w!=="local"&&w!=="static")F=Ge(o,Ze,w,b),X=Ve(u);else if(!F&&v){let _=v.split(/\s+/).map((E)=>Number.parseFloat(E.replace("x","")));F=In(o,_,T,w,b)}else if(u)X=Ve(u);let L=[];if(A)L.push(A);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(_&&x==="color")L.push(`background-color:${_.color}`),D.push("backgroundColor");else if(_)L.push(`background-color:${_.color}`),L.push(`background-image:url(${_.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let E=En(T||16,j||9,h);L.push(`background-image:url(${E})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(wr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(U||z?"eager":W?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(U)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(F)Y.push(`srcset="${n(wr(F,"fetched"))}"`);if(X)Y.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",E=_n(D)+(_?`;${_}`:"");Y.push(`onload="${n(E)}"`),te.add("onload")}Y.push(...oe(e,te)),Y.push(...ae(e,te));let Te=`<img ${Y.join(" ")} />`,M="";if(z){let E=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${E?` type="${E}"`:""}${F?` imagesrcset="${n(F)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
3
3
  `}if(N){let _=[];if(a)for(let E of Lo(a))_.push(`<source type="image/${E.format}" srcset="${n(E.srcset)}"${X?` sizes="${n(X)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let E=xe(o,T,j,w,"avif"),ee=F?Ge(o,Ze,w,"avif"):`${E}`;_.push(`<source type="image/avif" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let E=xe(o,T,j,w,"webp"),ee=F?Ge(o,Ze,w,"webp"):`${E}`;_.push(`<source type="image/webp" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}return`${M}<picture>
4
4
  ${_.join(`
5
5
  `)}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-7wkz9sz5.js";import{mo}from"./chunk-985afhhy.js";import p from"path";async function Ug(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(mo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-memz2xdn.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
2
+ import{a}from"./chunk-s4wysh3z.js";import{mo}from"./chunk-985afhhy.js";import p from"path";async function Ug(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(mo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-968gy66p.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
3
  export{Ug};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Eh,Af,Je,sc,Th,os,is,as}from"./chunk-nrnkqqmb.js";import"./chunk-vr6jccpy.js";import"./chunk-bm7xr4xh.js";import"./chunk-qv85c3qy.js";import"./chunk-w5hhqjwr.js";import"./chunk-nzj7mkvm.js";import"./chunk-wrd3aygb.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Th as clearOnceStore,sc as onceStore,Je as partialsCache,os as processIncludes,is as processStackPushDirectives,as as processStackReplacements,Eh as resetUnscopedSignalWarnings,Af as topLevelElements};
2
+ import{Eh,Af,Je,sc,Th,os,is,as}from"./chunk-tch1wqny.js";import"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-qv85c3qy.js";import"./chunk-w5hhqjwr.js";import"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Th as clearOnceStore,sc as onceStore,Je as partialsCache,os as processIncludes,is as processStackPushDirectives,as as processStackReplacements,Eh as resetUnscopedSignalWarnings,Af as topLevelElements};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{oi,Ec,o,At,oe,C,Oe,pn,Ne,pe,G,vr,fn,Ls,Lc,mn,_r,Bs,Fs,jc,di,Bc,Fc,zc,Hc,De,Le,zs,Fe,r,bn,h,p,V,Z,Se,_,T}from"./chunk-nzj7mkvm.js";import{u,f,R,t,ae,q,c,ke,Si,B,Sn,ki,Ft,_i,nl,$r,rl,it,sl,Rr,ol,kn,Ci,il,Ar,Ir,_e,Ei}from"./chunk-94gyfwpz.js";import{Lt}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-wrd3aygb.js";import{y}from"./chunk-d3pemcp8.js";import{gr,Rs}from"./chunk-q14d714d.js";import{uc,dc,dr,Qe,pc,P}from"./chunk-7wkz9sz5.js";import{Jo,Yo,Zo,Qo}from"./chunk-w9nwb8r3.js";import{oc,ls}from"./chunk-vr6jccpy.js";import{os,is,as}from"./chunk-nrnkqqmb.js";import{ps,Ho,Vo,gs,ms,Uo}from"./chunk-8ycz8ss9.js";import{us,or}from"./chunk-992nsr70.js";import{No}from"./chunk-2gqhfge6.js";import{se,jo,Bo,Fo}from"./chunk-qv85c3qy.js";import{ar,be,ac,cr,cc}from"./chunk-40ambk0h.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{fc,gc}from"./chunk-0jp3tt5c.js";import{E,_n,Ti}from"./chunk-bmfk3b29.js";import fs from"fs";import ce from"path";function dt(){return`
2
+ import{oi,Ec,o,At,oe,C,Oe,pn,Ne,pe,G,vr,fn,Ls,Lc,mn,_r,Bs,Fs,jc,di,Bc,Fc,zc,Hc,De,Le,zs,Fe,r,bn,h,p,V,Z,Se,_,T}from"./chunk-qpqg82qv.js";import{u,f,R,t,ae,q,c,ke,Si,B,Sn,ki,Ft,_i,nl,$r,rl,it,sl,Rr,ol,kn,Ci,il,Ar,Ir,_e,Ei}from"./chunk-94gyfwpz.js";import{Lt}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-se6p0wsk.js";import{y}from"./chunk-348zcmgq.js";import{gr,Rs}from"./chunk-q14d714d.js";import{uc,dc,dr,Qe,pc,P}from"./chunk-s4wysh3z.js";import{Jo,Yo,Zo,Qo}from"./chunk-w9nwb8r3.js";import{oc,ls}from"./chunk-9rk5xcvc.js";import{os,is,as}from"./chunk-tch1wqny.js";import{ps,Ho,Vo,gs,ms,Uo}from"./chunk-3654413v.js";import{us,or}from"./chunk-n49bv3mg.js";import{No}from"./chunk-2gqhfge6.js";import{se,jo,Bo,Fo}from"./chunk-qv85c3qy.js";import{ar,be,ac,cr,cc}from"./chunk-06fej0jb.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{fc,gc}from"./chunk-xb2576xg.js";import{E,_n,Ti}from"./chunk-bmfk3b29.js";import fs from"fs";import ce from"path";function dt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -1558,7 +1558,7 @@ ${M}
1558
1558
  </style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import ot from"path";var rs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,cs=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ds(s,e){if(!e||!s.includes("/"))return s;let l=ot.dirname(e);return s.replace(rs,(a,d,n,g)=>{let v=ot.resolve(l,g);return`${d}${n}${v.split(ot.sep).join("/")}${n}`})}function un(s,e){if(!e||!s.includes("<script"))return s;return s.replace(cs,(l,a,d,n)=>`${a}${ds(d,e)}${n}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function dn(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function En(s,e){let l=s.length,a=e,d=!0,n=[],g=(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(g(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
1559
1559
  `,a+2),a===-1)return-1;a+=1,d=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,d=!0;continue}if(v==="/"&&d){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++,d=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,d=!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++}d=!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,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,d=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let d=a.index+a[0].length,n=s.indexOf("</script>",d);if(n===-1)return null;let g=s.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var hs=4096;async function at(s,e,l){if(l.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:a}=await import("./chunk-76ngpa25.js");return`<script ${s} src="${a(e)}"></script>`}async function tr(s,e,l,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-qf86f6c5.js")),g=[],v=await n(d(...s),{minify:Ti(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)l?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-76ngpa25.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function ys(s,e,l,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-gj5hjak1.js"));d.frameworkScript=await S(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-t2hscbrh.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,D="",A=!1;try{if(n){let H=v?await n.getStoreScript(g).then((U)=>U?{code:U,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,D=H.stores.join(","),A=!!H.functions&&!v}}catch{}if(w!==null&&D===w)break;w=D;let M=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",I=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await at(M,k,e)??I:null;let N={};d.modulesTag=await tr([s,I],e,l,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-wqjdzdaj.js")),U=e.composablesDir,O=[d.modulesCode??d.modulesTag,I,d.frameworkScript].filter((F)=>F!==null),j=await H(e._layerComposableDirs??U,s,O,b);if(j)d.composableCode=j,d.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${j}</script>`}catch{}if(v||!n)break}return d}async function vs(s,e,l,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-tbnyx5d2.js"),g=await import("./chunk-qzb0v08n.js"),{messages:v,webModules:m}=e,x=null,b=null,w=n()===""&&!a.__stx_native_screen;if(v&&g.pageMessagesEnabled(e)&&w)try{x=await g.loadPageMessages(process.cwd(),v)}catch(M){bs(M)}if(m&&Object.keys(m).length&&w)try{b=await(await import("./chunk-qp3xd98j.js")).loadWebModules(process.cwd(),m)}catch(M){ws(M)}let S=new Map([...b??[],...x?.stubs??[]]),k=()=>ys(s,e,l,a),D=S.size?await d(S,k):await k(),A=null;if(x){let M=g.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),I=g.pageMessagesScript(x,g.pageLanguages(s,x),M);if(I)A=await at('data-stx-scoped data-stx-run="always" data-stx-messages',I,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${I.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((M)=>M!==null)}var gn=!1;function bs(s){if(gn)return;gn=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var hn=!1;function ws(s){if(hn)return;hn=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function xs(s,e=""){let l=Tn(s,"data-stx-runtime");if(!l)return s;let a=ar(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++}d=!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,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,d=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let d=a.index+a[0].length,n=s.indexOf("</script>",d);if(n===-1)return null;let g=s.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var hs=4096;async function at(s,e,l){if(l.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:a}=await import("./chunk-zgf7gpeh.js");return`<script ${s} src="${a(e)}"></script>`}async function tr(s,e,l,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-4n1z8qha.js")),g=[],v=await n(d(...s),{minify:Ti(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)l?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-zgf7gpeh.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function ys(s,e,l,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-67prgz52.js"));d.frameworkScript=await S(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-q54ptm6h.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,D="",A=!1;try{if(n){let H=v?await n.getStoreScript(g).then((U)=>U?{code:U,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,D=H.stores.join(","),A=!!H.functions&&!v}}catch{}if(w!==null&&D===w)break;w=D;let M=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",I=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await at(M,k,e)??I:null;let N={};d.modulesTag=await tr([s,I],e,l,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-yx5qq570.js")),U=e.composablesDir,O=[d.modulesCode??d.modulesTag,I,d.frameworkScript].filter((F)=>F!==null),j=await H(e._layerComposableDirs??U,s,O,b);if(j)d.composableCode=j,d.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${j}</script>`}catch{}if(v||!n)break}return d}async function vs(s,e,l,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-rn23wa1x.js"),g=await import("./chunk-qzb0v08n.js"),{messages:v,webModules:m}=e,x=null,b=null,w=n()===""&&!a.__stx_native_screen;if(v&&g.pageMessagesEnabled(e)&&w)try{x=await g.loadPageMessages(process.cwd(),v)}catch(M){bs(M)}if(m&&Object.keys(m).length&&w)try{b=await(await import("./chunk-qp3xd98j.js")).loadWebModules(process.cwd(),m)}catch(M){ws(M)}let S=new Map([...b??[],...x?.stubs??[]]),k=()=>ys(s,e,l,a),D=S.size?await d(S,k):await k(),A=null;if(x){let M=g.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),I=g.pageMessagesScript(x,g.pageLanguages(s,x),M);if(I)A=await at('data-stx-scoped data-stx-run="always" data-stx-messages',I,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${I.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((M)=>M!==null)}var gn=!1;function bs(s){if(gn)return;gn=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var hn=!1;function ws(s){if(hn)return;hn=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function xs(s,e=""){let l=Tn(s,"data-stx-runtime");if(!l)return s;let a=ar(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 d=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),g=ar(n);if(g===-1)return d+e+`
1563
1563
  `+n;return n.slice(0,g)+d+e+`
1564
1564
  `+n.slice(g)}function Ss(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,d)=>{let n=s.slice(0,d);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,d){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Se(s,l);let n=!e.__stxProcessingDepth;mn(e);for(let g of a._layerGraph?.configDependencies??[])d.add(g);if(n&&a.runtimeConfig)await vn(e,l,a.runtimeConfig);if(n)zc(e),e.__stx_scope_seq??={n:0,key:zs(String(e.__filename??l))},e.__stx_head_injections=_i(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!_n())&&l&&l.endsWith(".stx"))No(s,l);try{return await oe.timeAsync("template-processing",async()=>{let g=await ks(s,e,l,a,d);if(n)g=di(g);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=_e(a.app?.head,{known:Ir,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ei(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let k=e.__sections?.title,D=k?_(k,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((X)=>it(X)).filter(Boolean)),H={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((X)=>!N.has(it(X))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
@@ -1573,7 +1573,7 @@ ${m.trim()}
1573
1573
  @endsection`}}if(I&&m.includes("<script")){let O=G(m),j=O.scripts.map((F)=>yn(F,l)??F);m=vr(O.output,j)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,j,F)=>(M[j]=F,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,j,F)=>{if(/^(['"]).*\1$/.test(F.trim()))return O;try{let X=u(F.trim(),e);if(X===void 0)return O;let ee=(e.__stx_inline_section_values??=[]).push(X)-1;return M[j]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,j,F)=>{if(F.includes("@parent"))M[j]=F.replace("@parent",Te);else M[j]=F.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,j,F)=>M[j]||F||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=as(m,A),I){let O=[],j=G(m),F=pe(j.output,pn,(X,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(m=F.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,K,ee)=>{let te=K==="SCRIPT"?yn(j.scripts[Number(ee)],l):F.tokens[Number(ee)];if(te)O.push(te);return""}),O.length>0){let X=O.join(`
1574
1574
  `);M.content=M.content?`${M.content}
1575
1575
  ${X}`:X,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,d.add(I);else O=await ke(()=>bn(I,l,g,d),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let te=(J)=>{if(!J)return[];try{let me=ce.isAbsolute(J)?J:ce.resolve(process.cwd(),J);return fs.readdirSync(me).filter((we)=>we.endsWith(".stx")).map((we)=>we.replace(/\.stx$/,""))}catch{return[]}},ne=[...te(g.layoutsDir),...te(g.fallbackLayoutsDir)].filter((J,me,we)=>we.indexOf(J)===me).sort(),le=[g.layoutsDir,g.fallbackLayoutsDir].filter((J)=>typeof J==="string"&&J.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${I} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:g.layoutsDir?`. No .stx layouts found in ${g.layoutsDir}`:"")+de;if(B.log(Error(ie),{layoutPath:I,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),g.debug)throw new ae(ie,l);return m}let j=await ke(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});j=un(j,O);let F=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(g.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let te={},ne=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,J,me)=>(te[J]=me.trim(),""));for(let[ie,J]of Object.entries(te))if(M[ie]&&M[ie].includes(Te)){let me=M[ie].indexOf(Te);M[ie]=M[ie].slice(0,me)+J+M[ie].slice(me+Te.length)}else if(!M[ie])M[ie]=J;let le={...e,__sections:M},de=`@layout('${F[1]}')${ne}`;return await i(de,le,O,g,d)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=is(X,A),ee={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,ne,le)=>(ee[ne]=le.trim(),`@slot('${ne}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,ne,le)=>{if(M[ne]){let de=M[ne];if(de.includes(Te)){let ie=ee[ne]||"",J=de.indexOf(Te);de=de.slice(0,J)+ie+de.slice(J+Te.length)}return de}return le||""}),K=$s(K,M),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),K=as(K,A),e.__originalFilePath=l,m=await $n(K,e,O,g,d),m=`<!-- stx-layout: ${I} -->
1576
- ${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await $n(m,e,l,g,d))}function $s(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(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[d,n]of Object.entries(process.env))if(d.startsWith(l)&&n!==void 0)a[d]=n;s.$env=a}async function _s(s,e){await ke(()=>Jt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ct="data-stx-source";function yn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function Ts(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function wn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(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">${wn(s)}</span><span style="display:block;margin-top:4px">${wn(l)}</span></div>`}async function Cs(s,e,l,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-ebbzq4va.js")),n=[],g=!E()&&!_n();for(let m of d(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=En(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let k=Ts(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-5pgv8jh1.js"));await A(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...D,markup:xn(k,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...D,markup:xn(k,"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 As(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-rnaeezmp.js"));return a(s,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return B.log(d,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${d.message}`),s}}async function $n(s,e,l,a,d){let n=s,g=a;if(n=await Cs(n,e,l,a),n=await qt(n,e,l),n=await Ut(n,e,l),n=await As(n,e,l),n=await Mt(n,e,l,g),Se(n))n=Ho(n,e),n=ms(n,e),n=gs(n,e);n=Vo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-qrnws56v.js"));n=v(n,e),n=or(n,e,l,g,!0),n=await nn(n,e,l,g,d),n=await ls(n,e,l,g,d),n=uc(n,e,l,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-wr3adhd8.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-2vxh8b8g.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-8pphy0p1.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=k(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-3t4t655h.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-1brkqd5f.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-d910ytt2.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-vgzfsh1z.js"));n=I(n,e,l),n=N(n,e,l),n=H(n,e,l);let{processPartialHydrationDirectives:U,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-tktkj2dc.js"));n=U(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=F(n,e,l);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-wdqgf1hh.js"));n=X(n,e,l);let{processHeadDirective:K,processTitleDirective:ee,processMetaDirective:te,resetHead:ne}=await o("stx/head",()=>import("./chunk-fxy0cq7h.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ne();let le=K(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1576
+ ${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await $n(m,e,l,g,d))}function $s(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(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[d,n]of Object.entries(process.env))if(d.startsWith(l)&&n!==void 0)a[d]=n;s.$env=a}async function _s(s,e){await ke(()=>Jt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ct="data-stx-source";function yn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function Ts(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function wn(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(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">${wn(s)}</span><span style="display:block;margin-top:4px">${wn(l)}</span></div>`}async function Cs(s,e,l,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-yxgx0c2g.js")),n=[],g=!E()&&!_n();for(let m of d(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=En(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let k=Ts(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-1d8zapw4.js"));await A(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...D,markup:xn(k,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...D,markup:xn(k,"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 As(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-tzy4xpsx.js"));return a(s,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return B.log(d,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${d.message}`),s}}async function $n(s,e,l,a,d){let n=s,g=a;if(n=await Cs(n,e,l,a),n=await qt(n,e,l),n=await Ut(n,e,l),n=await As(n,e,l),n=await Mt(n,e,l,g),Se(n))n=Ho(n,e),n=ms(n,e),n=gs(n,e);n=Vo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-dk5jzps7.js"));n=v(n,e),n=or(n,e,l,g,!0),n=await nn(n,e,l,g,d),n=await ls(n,e,l,g,d),n=uc(n,e,l,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-wr3adhd8.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-2vxh8b8g.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-8pphy0p1.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=k(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-3t4t655h.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-1brkqd5f.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-d910ytt2.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-vgzfsh1z.js"));n=I(n,e,l),n=N(n,e,l),n=H(n,e,l);let{processPartialHydrationDirectives:U,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-tktkj2dc.js"));n=U(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=F(n,e,l);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-2cdpkbar.js"));n=X(n,e,l);let{processHeadDirective:K,processTitleDirective:ee,processMetaDirective:te,resetHead:ne}=await o("stx/head",()=>import("./chunk-fxy0cq7h.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ne();let le=K(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1577
1577
  `;if(n=ee(n,e),n=te(n,e,l),n=Gt(n),n=jo(n,e),n=Rt(n),n=zt(n),n=await os(n,e,l,g,d),n=await ls(n,e,l,g,d),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=di(n),n=se(n,e,l),n=us(n),e.__stxProcessingDepth===1)n=Hc(n,e);if(n=Lc(n,e,{filePath:l,buildMode:g.buildMode}),n=Bo(n,e),n=Fo(n,e),n=We(n,e),n=Ht(n,e),n=Bt(n,e),n=await xt(n,e,l,g),n=await pc(n,e,l),n=await fc(n,e,l,g),n=gc(n,e,l,g),n=Jo(n,e,l,g),n=Yo(n,e,l),n=Zo(n,e,l,g),n=Tt(n,e,l,g),n=Bs(n,e),n=Fs(n),n=jc(n),!g.skipEventDirectives)n=Ec(n,e,l);if(n=wt(n,e,l),g.debug){let z=/\bx-data\s*=/.test(n),W=ps(s);if(z&&W)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=oc(n,e),n=await _(n,e,l),n=Bc(n),n=Fc(n),n=gt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let ie=e.__originalFilePath||l,J=De(e);if(n=await Uo(n,g,ie,J),n=Pt(n,e),n=await Kt(n,e,l,g),g.media?.image?.autoSiblings){let z=g.publicDir||"public",{rewriteImagesWithSiblings:W}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-9wmjmas8.js"));n=await W(n,{publicDir:z})}if(g.seo?.enabled)n=Qo(n,e,g);let me=(z,W,Q=!0)=>{if(!W)return z;let he=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),re=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(z),fe=re?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(re[0]):null;if(he&&re&&fe){if(Q){let Ce=re.index+fe.index;z=z.slice(0,Ce)+he[0]+z.slice(Ce+fe[0].length)}if(W=W.replace(he[0],"").trim(),!W)return z}if(/<\/head>/i.test(z))return z.replace(/<\/head>/i,`${W}
@@ -1587,6 +1587,6 @@ ${dt()}
1587
1587
  `+Ce}else n=n.replace("</head>",`${W}
1588
1588
  </head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
1589
1589
  ${W}`);else n=W+`
1590
- `+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-ebbzq4va.js")),W=[];for(let Q of z(n)){if(!/\bserver\b/i.test(Q.attrs))continue;let he=Q.start+Q.fullMatch.indexOf(">")+1,re=En(n,he);if(re===-1)continue;let fe=re+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:Q.start,end:fe})}if(W.length>0){let Q=Array(W.length+1),he=0;for(let re=0;re<W.length;re++){let{start:fe,end:Ce}=W[re];Q[re]=n.slice(he,fe),he=Ce}Q[W.length]=n.slice(he),n=Q.join("")}}let lt=Ls(n,l);if(lt.hasScoped)n=lt.html;let Dn=e.__stx_event_bindings||[],Ke=!1,ut=[],In=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:On}=await o("stx/signal-processing",()=>import("./chunk-ebbzq4va.js"));for(let z of On(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:Q}of ut){Ke=!0;let he=Q;Oe(Q,l,a.strict,e.__originalFilePath);let re=await Le(Q,{eventBindings:Dn,attrs:W,hasColonDirectives:In,templateContent:s,filePath:l,projectRoot:process.cwd(),production:Ti(a.buildMode,a.minifyClient),serverData:J});n=n.replace(z,()=>re)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=oi(z);if(W){let Q=n.lastIndexOf("</body>");n=Q===-1?n+W:n.slice(0,Q)+W+`
1590
+ `+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-yxgx0c2g.js")),W=[];for(let Q of z(n)){if(!/\bserver\b/i.test(Q.attrs))continue;let he=Q.start+Q.fullMatch.indexOf(">")+1,re=En(n,he);if(re===-1)continue;let fe=re+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:Q.start,end:fe})}if(W.length>0){let Q=Array(W.length+1),he=0;for(let re=0;re<W.length;re++){let{start:fe,end:Ce}=W[re];Q[re]=n.slice(he,fe),he=Ce}Q[W.length]=n.slice(he),n=Q.join("")}}let lt=Ls(n,l);if(lt.hasScoped)n=lt.html;let Dn=e.__stx_event_bindings||[],Ke=!1,ut=[],In=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:On}=await o("stx/signal-processing",()=>import("./chunk-yxgx0c2g.js"));for(let z of On(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:Q}of ut){Ke=!0;let he=Q;Oe(Q,l,a.strict,e.__originalFilePath);let re=await Le(Q,{eventBindings:Dn,attrs:W,hasColonDirectives:In,templateContent:s,filePath:l,projectRoot:process.cwd(),production:Ti(a.buildMode,a.minifyClient),serverData:J});n=n.replace(z,()=>re)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=oi(z);if(W){let Q=n.lastIndexOf("</body>");n=Q===-1?n+W:n.slice(0,Q)+W+`
1591
1591
  `+n.slice(Q)}e.__stx_event_bindings=[]}}if(!be(n)&&ac(n))n=await cr(n,g);if(n=cc(n),g.csp?.enabled&&g.csp.useNonce&&typeof e.cspNonce==="string")n=_t(n,e.cspNonce);return n}
1592
1592
  export{yt,Re,tc,ss,Io,Oo,tr,i};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Vg}from"./chunk-6tyxze52.js";import"./chunk-adjkcbcy.js";import"./chunk-348zcmgq.js";import"./chunk-tch1wqny.js";import"./chunk-2gqhfge6.js";import"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-n49bv3mg.js";import"./chunk-qv85c3qy.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-cgjf0zdk.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{Vg as startInteractive};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Tc,r,fe}from"./chunk-nzj7mkvm.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import o from"fs";import u from"path";var Mf=new Map,m=new Map;async function Ph(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){n=s;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Ih(e){m.delete(e)}function Oh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Nh(e){x=e}async function Df(e=!1){let t=x??await import("./chunk-3n03m9w0.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Lf(){if(S===null){let{getRouterScript:e}=await import("./chunk-4v22nj67.js");S=e()}return S}var y={};async function Mh(e,t=!1){let n=e==="runtime"?await Df(t):await Lf(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==n)s={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:n,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Dh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let s=c.keys().next().value;p-=c.get(s).length*2,c.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(u.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function qo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Lh(){m.clear(),fe(),Tc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function lr(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${bs(e)}.html`),s=u.join(n,`${bs(e)}.meta.json`);if(!await r(i)||!await r(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==nt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await r(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ur(e,t,n,i){try{if(!i.cachePath)return;let s=u.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=u.join(s,`${bs(e)}.html`),a=u.join(s,`${bs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:nt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Mf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function bs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
2
+ import{Tc,r,fe}from"./chunk-qpqg82qv.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import o from"fs";import u from"path";var Mf=new Map,m=new Map;async function Ph(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){n=s;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Ih(e){m.delete(e)}function Oh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Nh(e){x=e}async function Df(e=!1){let t=x??await import("./chunk-3n03m9w0.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Lf(){if(S===null){let{getRouterScript:e}=await import("./chunk-4v22nj67.js");S=e()}return S}var y={};async function Mh(e,t=!1){let n=e==="runtime"?await Df(t):await Lf(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==n)s={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:n,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Dh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let s=c.keys().next().value;p-=c.get(s).length*2,c.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(u.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function qo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Lh(){m.clear(),fe(),Tc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function lr(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${bs(e)}.html`),s=u.join(n,`${bs(e)}.meta.json`);if(!await r(i)||!await r(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==nt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await r(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ur(e,t,n,i){try{if(!i.cachePath)return;let s=u.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=u.join(s,`${bs(e)}.html`),a=u.join(s,`${bs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:nt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Mf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function bs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
3
  export{Mf,Ph,Ih,Oh,Nh,Df,Lf,Mh,Dh,qo,Lh,lr,ur,bs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{m,h,p}from"./chunk-nzj7mkvm.js";import{j}from"./chunk-7wkz9sz5.js";import{i}from"./chunk-vgtbds23.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Am(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{m,h,p}from"./chunk-qpqg82qv.js";import{j}from"./chunk-s4wysh3z.js";import{i}from"./chunk-adjkcbcy.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Am(e,t={},o={}){let n={...j,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Am,ha,lu,Pm,Im,Om,Nm,Mm,uu,du,Dm,Lm,jm,Bm}from"./chunk-p0f5vygc.js";import"./chunk-vgtbds23.js";import"./chunk-d3pemcp8.js";import"./chunk-nrnkqqmb.js";import"./chunk-2gqhfge6.js";import"./chunk-vr6jccpy.js";import"./chunk-bm7xr4xh.js";import"./chunk-992nsr70.js";import"./chunk-qv85c3qy.js";import"./chunk-8ycz8ss9.js";import"./chunk-40ambk0h.js";import"./chunk-w5hhqjwr.js";import"./chunk-mqr61kqn.js";import"./chunk-7wkz9sz5.js";import"./chunk-0jp3tt5c.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-nzj7mkvm.js";import"./chunk-wrd3aygb.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{lu as SUSPENSE_RESOLVER_RUNTIME,ha as buildSuspenseResolveScript,Mm as createStreamRenderer,Om as extractStreamBoundaries,Bm as generateHydrationRuntime,du as islandDirective,Lm as processSectionDirectives,Im as processStreamDirectives,Dm as registerStreamingDirectives,Pm as renderStreamingPage,Am as streamTemplate,Nm as streamTemplateSimple,jm as streamToResponse,uu as streamingSuspenseDirective};
2
+ import{Am,ha,lu,Pm,Im,Om,Nm,Mm,uu,du,Dm,Lm,jm,Bm}from"./chunk-ch2f7hf7.js";import"./chunk-adjkcbcy.js";import"./chunk-348zcmgq.js";import"./chunk-tch1wqny.js";import"./chunk-2gqhfge6.js";import"./chunk-9rk5xcvc.js";import"./chunk-r4ne3cvw.js";import"./chunk-n49bv3mg.js";import"./chunk-qv85c3qy.js";import"./chunk-3654413v.js";import"./chunk-06fej0jb.js";import"./chunk-w5hhqjwr.js";import"./chunk-cgjf0zdk.js";import"./chunk-s4wysh3z.js";import"./chunk-xb2576xg.js";import"./chunk-h0jnatd4.js";import"./chunk-605b93pe.js";import"./chunk-w9nwb8r3.js";import"./chunk-q14d714d.js";import"./chunk-qpqg82qv.js";import"./chunk-se6p0wsk.js";import"./chunk-27rzdq3n.js";import"./chunk-94gyfwpz.js";import"./chunk-2yxva96k.js";import"./chunk-gb65t4n1.js";export{lu as SUSPENSE_RESOLVER_RUNTIME,ha as buildSuspenseResolveScript,Mm as createStreamRenderer,Om as extractStreamBoundaries,Bm as generateHydrationRuntime,du as islandDirective,Lm as processSectionDirectives,Im as processStreamDirectives,Dm as registerStreamingDirectives,Pm as renderStreamingPage,Am as streamTemplate,Nm as streamTemplateSimple,jm as streamToResponse,uu as streamingSuspenseDirective};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{kn}from"./chunk-94gyfwpz.js";import{W,S,Ot,Nt,_r,m,Zc,yi,V,T}from"./chunk-nzj7mkvm.js";import{Qt}from"./chunk-v6z3ak8h.js";import{n}from"./chunk-bm7xr4xh.js";import{K}from"./chunk-bmfk3b29.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function _(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var ft="private, no-store";function An(t){return t.replace(/&#(\d+);/g,(r,e)=>N(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>N(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function N(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function D(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=An(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=An(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
- `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-4v22nj67.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function oa(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function fo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Qt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-cagvn9tf.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function qr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{kn}from"./chunk-94gyfwpz.js";import{W,S,Ot,Nt,_r,m,Zc,yi,V,T}from"./chunk-qpqg82qv.js";import{Qt}from"./chunk-wyc31w66.js";import{n}from"./chunk-r4ne3cvw.js";import{K}from"./chunk-bmfk3b29.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function _(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var ft="private, no-store";function An(t){return t.replace(/&#(\d+);/g,(r,e)=>N(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>N(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function N(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function D(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=An(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=An(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
+ `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-4v22nj67.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function oa(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function fo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Qt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-kvjv3abv.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function qr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -28,5 +28,5 @@ ${c}
28
28
  `));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
29
29
  `));if(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
30
30
  `));return d.push(y),d.join(`
31
- `)}import O from"fs";import H from"path";function aa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ca(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function la(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function go(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!go(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ua(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function In(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-qrnws56v.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-498286bb.js"),{defaultConfig:h}=await import("./chunk-549zk2p7.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!yi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=_r(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!yi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Zc(t.html,i)),context:e,cookies:s.cookies}}
31
+ `)}import O from"fs";import H from"path";function aa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ca(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function la(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function go(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!go(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ua(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function In(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-dk5jzps7.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-sq7zsdx9.js"),{defaultConfig:h}=await import("./chunk-svvqscdk.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!yi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=_r(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!yi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Zc(t.html,i)),context:e,cookies:s.cookies}}
32
32
  export{ft,An,Ce,D,Pn,oa,fo,qr,We,ia,qe,Ee,aa,ca,la,go,ua,In};