@stacksjs/stx 0.2.653 → 0.2.654

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 (79) hide show
  1. package/dist/chunk-17srvghf.js +2 -0
  2. package/dist/{chunk-fx6fvgh7.js → chunk-1zb7ar32.js} +2 -2
  3. package/dist/{chunk-xagtm6pe.js → chunk-26whq1rg.js} +1 -1
  4. package/dist/{chunk-2dm6ey5w.js → chunk-2yg9y1na.js} +6 -6
  5. package/dist/{chunk-0vfbcad6.js → chunk-2zqg980j.js} +1 -1
  6. package/dist/{chunk-aw7a82fp.js → chunk-35zjpdcb.js} +1 -1
  7. package/dist/{chunk-wxvpfzbe.js → chunk-3634ds4n.js} +1 -1
  8. package/dist/{chunk-e9k6gn09.js → chunk-36649w15.js} +1 -1
  9. package/dist/{chunk-anpp7jqf.js → chunk-3v8yejzc.js} +2 -2
  10. package/dist/{chunk-p4n5h44f.js → chunk-42v0vegr.js} +1 -1
  11. package/dist/{chunk-yvns10k8.js → chunk-5yxd4ryz.js} +1 -1
  12. package/dist/{chunk-bcak75rd.js → chunk-6raq8r7w.js} +1 -1
  13. package/dist/{chunk-vre4g5yb.js → chunk-6rparhvs.js} +1 -1
  14. package/dist/{chunk-pkftgt3b.js → chunk-71mthavp.js} +32 -32
  15. package/dist/chunk-73swyb5p.js +2 -0
  16. package/dist/{chunk-mhhhhq5m.js → chunk-7wnd2psp.js} +1 -1
  17. package/dist/{chunk-7v9hxyqx.js → chunk-929zbzh7.js} +1 -1
  18. package/dist/{chunk-3dms896y.js → chunk-bgt1dx8c.js} +1 -1
  19. package/dist/{chunk-rhejgcfj.js → chunk-cvw7gknw.js} +1 -1
  20. package/dist/chunk-d0xcykw6.js +2 -0
  21. package/dist/{chunk-mcqvhfks.js → chunk-dxjc11hx.js} +1 -1
  22. package/dist/chunk-etw04j02.js +2 -0
  23. package/dist/{chunk-77vp2r7q.js → chunk-ewng6v6g.js} +4 -4
  24. package/dist/{chunk-z1verv61.js → chunk-ex1kd5gs.js} +1 -1
  25. package/dist/chunk-fbd9w4ys.js +2 -0
  26. package/dist/{chunk-gvk4rrc5.js → chunk-ff1cb7k4.js} +2 -2
  27. package/dist/chunk-fnj3gja0.js +2 -0
  28. package/dist/chunk-fsnby15p.js +2 -0
  29. package/dist/{chunk-60ntv8n1.js → chunk-g7j3mwzd.js} +5 -5
  30. package/dist/{chunk-57ja31kj.js → chunk-gmrc24cb.js} +1 -1
  31. package/dist/{chunk-5e2pnqyr.js → chunk-h0bg2h0j.js} +1 -1
  32. package/dist/{chunk-g778htym.js → chunk-h4vg78mw.js} +1 -1
  33. package/dist/{chunk-7ct5a6e5.js → chunk-ht3dxx5m.js} +1 -1
  34. package/dist/{chunk-fd5px33r.js → chunk-hw7sv4ac.js} +1 -1
  35. package/dist/chunk-jmx4q1yr.js +2 -0
  36. package/dist/{chunk-xrn7fzbm.js → chunk-k49fg322.js} +1 -1
  37. package/dist/{chunk-sb8nvdwt.js → chunk-k7nan28e.js} +2 -2
  38. package/dist/{chunk-035g7w2k.js → chunk-kcrtqyek.js} +2 -2
  39. package/dist/{chunk-c3p6bnz2.js → chunk-ktvr9ta8.js} +2 -2
  40. package/dist/{chunk-4gxfhtxr.js → chunk-m47spkxr.js} +1 -1
  41. package/dist/chunk-m947aq9a.js +2 -0
  42. package/dist/{chunk-0pkvaj4d.js → chunk-n7xbhzzt.js} +4 -4
  43. package/dist/chunk-ndtxkps4.js +2 -0
  44. package/dist/{chunk-90w45mx5.js → chunk-pge3bzqx.js} +1 -1
  45. package/dist/{chunk-nw4vztfq.js → chunk-phws2c9s.js} +1 -1
  46. package/dist/{chunk-kqnsytx3.js → chunk-q1x7ckfw.js} +1 -1
  47. package/dist/{chunk-646x47qt.js → chunk-q79ksfcd.js} +1 -1
  48. package/dist/{chunk-j5nh5jkp.js → chunk-qjf1c8fa.js} +1 -1
  49. package/dist/{chunk-qvvb6v7r.js → chunk-ra56jh7e.js} +1 -1
  50. package/dist/{chunk-hezw1xmp.js → chunk-rmdw6s65.js} +1 -1
  51. package/dist/{chunk-wgddpw30.js → chunk-s0crnpyx.js} +1 -1
  52. package/dist/{chunk-y0r3egr3.js → chunk-s4cs2n2c.js} +1 -1
  53. package/dist/{chunk-kw680rcy.js → chunk-sd4jwn3y.js} +1 -1
  54. package/dist/{chunk-ycqnhnkr.js → chunk-t7j4h3nf.js} +3 -3
  55. package/dist/{chunk-shtcpfe6.js → chunk-v9bmw06j.js} +1 -1
  56. package/dist/{chunk-90937tdt.js → chunk-vs8kg85h.js} +1 -1
  57. package/dist/{chunk-9f1d2x97.js → chunk-x9d4bpmh.js} +5 -5
  58. package/dist/{chunk-kz2exzj0.js → chunk-xhmpfq9d.js} +1 -1
  59. package/dist/{chunk-r13q4a4w.js → chunk-xq410rsc.js} +1 -1
  60. package/dist/{chunk-hygs8atq.js → chunk-y8881za3.js} +1 -1
  61. package/dist/{chunk-83p6yy52.js → chunk-z75bp57x.js} +1 -1
  62. package/dist/cli.js +7 -7
  63. package/dist/craft-entry.js +1 -1
  64. package/dist/craft.js +1 -1
  65. package/dist/native-signing.d.ts +2 -0
  66. package/dist/native-signing.js +13 -4
  67. package/dist/pwa.js +1 -1
  68. package/dist/ssg.js +2 -2
  69. package/package.json +5 -5
  70. package/dist/chunk-14dpfzts.js +0 -2
  71. package/dist/chunk-3075268c.js +0 -2
  72. package/dist/chunk-33w449cn.js +0 -2
  73. package/dist/chunk-57rmkmbs.js +0 -2
  74. package/dist/chunk-ezez5jmd.js +0 -2
  75. package/dist/chunk-nfwy33s2.js +0 -2
  76. package/dist/chunk-qa2cyrbt.js +0 -2
  77. package/dist/chunk-qs1t1362.js +0 -2
  78. package/dist/chunk-x5hrbc9b.js +0 -2
  79. package/dist/chunk-z8nnsb11.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pc,ki,Iu,Ic,Oc,Ou,Nu}from"./chunk-k49fg322.js";import"./chunk-m47spkxr.js";import"./chunk-cvw7gknw.js";import"./chunk-5yxd4ryz.js";import"./chunk-9y2ncrnq.js";import"./chunk-k7nan28e.js";import"./chunk-n7xbhzzt.js";import"./chunk-wh838rdh.js";import"./chunk-3v8yejzc.js";import"./chunk-26whq1rg.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-h09a03ay.js";import"./chunk-qrt8b179.js";import{$t,Fl}from"./chunk-2yg9y1na.js";import"./chunk-35zjpdcb.js";import"./chunk-2h8ea0we.js";import"./chunk-4e0z858k.js";import"./chunk-ce6zddpf.js";import"./chunk-4qwvqbzf.js";export{Pc as buildVirtualSource,$t as extractScriptBlocks,Fl as extractTemplateExpressions,Ic as findRuntimeTypeDeclarations,Oc as findStxModuleDeclarations,Nu as formatTypecheckDiagnostics,Iu as sourcePathFor,Ou as typecheckStxFiles,ki as virtualPathFor};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ot,it,at}from"./chunk-jkvr7e91.js";import"./chunk-4qwvqbzf.js";import"./chunk-ce6zddpf.js";import{f}from"./chunk-2dm6ey5w.js";import"./chunk-4e0z858k.js";import"./chunk-2h8ea0we.js";import"./chunk-aw7a82fp.js";import{Bt,$s,Ft,ai,st,ci,Rs,zt,ui,Ht}from"./chunk-4yf1w261.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ci("Config file changed, restarting...");try{await e.onChange()}catch(p){st(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var ct=".stx/story/analytics.json",dt=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,ct),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:dt,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:pt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function pt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var lt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
2
+ import{ot,it,at}from"./chunk-jkvr7e91.js";import"./chunk-4qwvqbzf.js";import"./chunk-ce6zddpf.js";import{f}from"./chunk-2yg9y1na.js";import"./chunk-4e0z858k.js";import"./chunk-2h8ea0we.js";import"./chunk-35zjpdcb.js";import{Bt,$s,Ft,ai,st,ci,Rs,zt,ui,Ht}from"./chunk-4yf1w261.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{ci("Config file changed, restarting...");try{await e.onChange()}catch(p){st(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var ct=".stx/story/analytics.json",dt=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,ct),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:dt,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:pt(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),u=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:u}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function pt(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var lt=".stx/story/bookmarks.json",mt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,lt),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:mt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:ut(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function ut(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
3
3
  <script>
4
4
  (function() {
5
5
  const ws = new WebSocket('${t}');
@@ -556,7 +556,7 @@ window.__stxPerformance = {
556
556
 
557
557
  window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
558
558
  </script>
559
- `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-3075268c.js"),p={},u=h(n);if(u)try{await f(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await f(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-3075268c.js"),c={...r},n=h(e);if(n)try{await f(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
559
+ `}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-fsnby15p.js"),p={},u=h(n);if(u)try{await f(u,p,e)}catch(g){o.push(`Warning: Could not extract script variables: ${g instanceof Error?g.message:String(g)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),m=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:m,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await f(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-fsnby15p.js"),c={...r},n=h(e);if(n)try{await f(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
560
560
  `)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
561
561
  `)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function rt(t,e){let r=await zt(t);it(t,r);let s=Ht(t.config,r);at(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let g=new URL(i.url).pathname;if(g==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(g.startsWith("/api/"))return xt(t,g,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,g,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),u=`http://${o}:${e.port}`,y=ui(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let m=await zt(t);it(t,m);let g=Ht(t.config,m);if(at(t,g),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=u;try{let{exec:l}=await import("child_process"),m=process.platform;l(`${m==="darwin"?"open":m==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:u,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],u=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((m)=>m.id===p);if(!l)return new Response("Story not found",{status:404});try{let m=await Y(t,l,u,y);return Response.json({html:m.html,css:m.css,js:m.js,errors:m.errors,duration:m.duration})}catch(m){return Response.json({html:"",css:"",js:"",errors:[m instanceof Error?m.message:String(m)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((u)=>u.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
562
562
  <html lang="en" class="${r.darkClass||"dark"}">
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{E,t,a}from"./chunk-4e0z858k.js";import{K}from"./chunk-2dm6ey5w.js";import{fo}from"./chunk-a3d0g4mr.js";import C from"path";var S;async function J(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function G(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function Y(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!G(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await J(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
2
+ import{E,t,a}from"./chunk-4e0z858k.js";import{K}from"./chunk-2yg9y1na.js";import{fo}from"./chunk-a3d0g4mr.js";import C from"path";var S;async function J(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function G(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function Y(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!G(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await J(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
3
  `),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,p]=o,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return Y(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=ae(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return R(r[l],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=ne(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(o))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function fa(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>E(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?K(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return a("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(o)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>E(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return K(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return a("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function ga(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||p} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,W=H>z;if(!B&&!W)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),f=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function ma(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await fo(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let p=await Ae(g,o);if(u.push(o),p.length>0)i[o]=p}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:i,scannedFiles:u}}var ha={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},ya={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{fa,ga,ma,ha,ya};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Le,mn,ys,Bo,A}from"./chunk-2h8ea0we.js";import{gn}from"./chunk-aw7a82fp.js";import{br,x,ic,rt,Go,ac}from"./chunk-4qwvqbzf.js";import{T}from"./chunk-ce6zddpf.js";import{bs,l,d,Nt,u,z,D,w,Ss,we,Be,ks}from"./chunk-4e0z858k.js";import{o,Qe}from"./chunk-egg54kd0.js";import{p}from"./chunk-2a4szpje.js";import{H}from"./chunk-j3472s37.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as so}from"async_hooks";var er=new so;function ln(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function tr(e,s){return er.run(ln(e),s)}async function nr(e,s){let t=er.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(s).then((h)=>{let c=JSON.stringify(h,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),_=JSON.parse(c);return t.values.set(e,_),_}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function cr(e){let s=e.__stx_server_data;if(!s?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(s.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,s=!1){let t=o(e),i=[],a=new Set,h=0,c=0,_=t.length,v=()=>{if(h!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(s&&E[1]==="const")return;let I=E[2];if(!a.has(I))i.push(I),a.add(I);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(s&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let Z=P.indexOf(":"),V=(Z>=0?P.slice(Z+1).trim():P).split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(s&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let Z=P.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(s)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))i.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))i.push(I),a.add(I)}};while(c<_){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function ns(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ro(e,s=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((i)=>i.trim()));return s.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function rs(e,s){let t=`{ ${ro(e,s)} }`;return L(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Rn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function ss(e,s=!0){let t=ur.get(e);if(s&&t)return t;let i=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,_){if(_>6)return;let v;try{v=Rn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=Ce.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;h(R,_+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let O=E.name.slice(0,-4);if(!i.has(O))i.set(O,R);let M=O.toLowerCase();if(!i.has(M))i.set(M,R);let N=j(O);if(!i.has(N))i.set(N,R)}}}for(let c of a)if(h(c,0),i.size>0)break;if(s)ur.set(e,i);return i}function os(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let i=Ce.join(t,"node_modules",e);try{if(Rn.statSync(i).isDirectory())return i}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function is(e,s,t={}){return[Ce.resolve(Ce.dirname(s),`${e}.stx`),Ce.resolve(Ce.dirname(s),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=j(s);return[s,t,i]}function So(e,s){let[t,i,a]=fr(e);for(let h of[t,t.toLowerCase(),i,a]){let c=s?.__importedComponents?.get(h);if(c!==void 0)return c}}function*ko(e,s,t={},i){let a=fr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(s),`${a[0]}.stx`);return}let h=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),_=[...i?.__originalFilePath?[Ce.join(Ce.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(s),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(_)){for(let E of h)yield Ce.join(v,E);try{for(let E of Rn.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of h)yield Ce.join(v,E.name,R)}catch{}}}function pr(e,s,t={},i){let a=So(e,i);if(a!==void 0)return a;for(let h of ko(e,s,t,i))try{if(Rn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Hs from"fs";import oe from"path";import dt from"path";import Kt from"fs";var io=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Qn(e,s){if(s.passive)return!0;if(s.prevent||s.nonpassive)return!1;return io.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),gr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},oo=new Set(["ctrl","alt","shift","meta"]),xr={left:0,middle:1,right:2};function mr(e){let s={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")s.prevent=!0;else if(i==="stop")s.stop=!0;else if(i==="once")s.once=!0;else if(i==="capture")s.capture=!0;else if(i==="self")s.self=!0;else if(i==="passive")s.passive=!0;else if(i==="nonpassive")s.nonpassive=!0;else if(oo.has(i))s.systemKeys.push(i);else if(i in xr)s.mouse=i;else if(i in gr||/^[a-z]$/.test(i))s.keys.push(gr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);s.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);s.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return s}function yr(e,s=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,_,v]=h,E=h.index,R=E+c.length,O=`__stx_evt_${s}${i++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(v))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(v))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:E,endIndex:R})}return t}function ao(e){let s=[],{modifiers:t}=e;if(t.self)s.push("if ($event.target !== $el) return");for(let i of t.systemKeys)s.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");s.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=xr[t.mouse];s.push(`if ($event.button !== ${i}) return`)}if(t.prevent)s.push("$event.preventDefault()");if(t.stop)s.push("$event.stopPropagation()");return s.join("; ")}function co(e,s){let t=e;if(s.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${s.debounce})`;else if(s.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${s.throttle})`;return t}function es(e){let s=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(s))return e;return`if (typeof ${s} === 'function' && !${s}._isSignal) ${s}($event);`}function lo(e){let{modifiers:s}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ao(e),a=co(es(e.handler),s),h=[];if(s.once)h.push("once: true");if(s.capture)h.push("capture: true");if(Qn(e.event,s))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",_=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Le,mn,ys,Bo,A}from"./chunk-2h8ea0we.js";import{gn}from"./chunk-35zjpdcb.js";import{br,x,ic,rt,Go,ac}from"./chunk-4qwvqbzf.js";import{T}from"./chunk-ce6zddpf.js";import{bs,l,d,Nt,u,z,D,w,Ss,we,Be,ks}from"./chunk-4e0z858k.js";import{o,Qe}from"./chunk-egg54kd0.js";import{p}from"./chunk-2a4szpje.js";import{H}from"./chunk-j3472s37.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as so}from"async_hooks";var er=new so;function ln(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function tr(e,s){return er.run(ln(e),s)}async function nr(e,s){let t=er.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(s).then((h)=>{let c=JSON.stringify(h,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),_=JSON.parse(c);return t.values.set(e,_),_}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function cr(e){let s=e.__stx_server_data;if(!s?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(s.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,s=!1){let t=o(e),i=[],a=new Set,h=0,c=0,_=t.length,v=()=>{if(h!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(s&&E[1]==="const")return;let I=E[2];if(!a.has(I))i.push(I),a.add(I);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(s&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let Z=P.indexOf(":"),V=(Z>=0?P.slice(Z+1).trim():P).split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(s&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let Z=P.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(s)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))i.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))i.push(I),a.add(I)}};while(c<_){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function ns(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ro(e,s=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((i)=>i.trim()));return s.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function rs(e,s){let t=`{ ${ro(e,s)} }`;return L(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Rn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function ss(e,s=!0){let t=ur.get(e);if(s&&t)return t;let i=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,_){if(_>6)return;let v;try{v=Rn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=Ce.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;h(R,_+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let O=E.name.slice(0,-4);if(!i.has(O))i.set(O,R);let M=O.toLowerCase();if(!i.has(M))i.set(M,R);let N=j(O);if(!i.has(N))i.set(N,R)}}}for(let c of a)if(h(c,0),i.size>0)break;if(s)ur.set(e,i);return i}function os(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let i=Ce.join(t,"node_modules",e);try{if(Rn.statSync(i).isDirectory())return i}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function is(e,s,t={}){return[Ce.resolve(Ce.dirname(s),`${e}.stx`),Ce.resolve(Ce.dirname(s),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=j(s);return[s,t,i]}function So(e,s){let[t,i,a]=fr(e);for(let h of[t,t.toLowerCase(),i,a]){let c=s?.__importedComponents?.get(h);if(c!==void 0)return c}}function*ko(e,s,t={},i){let a=fr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(s),`${a[0]}.stx`);return}let h=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),_=[...i?.__originalFilePath?[Ce.join(Ce.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(s),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(_)){for(let E of h)yield Ce.join(v,E);try{for(let E of Rn.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of h)yield Ce.join(v,E.name,R)}catch{}}}function pr(e,s,t={},i){let a=So(e,i);if(a!==void 0)return a;for(let h of ko(e,s,t,i))try{if(Rn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Hs from"fs";import oe from"path";import dt from"path";import Kt from"fs";var io=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Qn(e,s){if(s.passive)return!0;if(s.prevent||s.nonpassive)return!1;return io.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),gr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},oo=new Set(["ctrl","alt","shift","meta"]),xr={left:0,middle:1,right:2};function mr(e){let s={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")s.prevent=!0;else if(i==="stop")s.stop=!0;else if(i==="once")s.once=!0;else if(i==="capture")s.capture=!0;else if(i==="self")s.self=!0;else if(i==="passive")s.passive=!0;else if(i==="nonpassive")s.nonpassive=!0;else if(oo.has(i))s.systemKeys.push(i);else if(i in xr)s.mouse=i;else if(i in gr||/^[a-z]$/.test(i))s.keys.push(gr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);s.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);s.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return s}function yr(e,s=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,_,v]=h,E=h.index,R=E+c.length,O=`__stx_evt_${s}${i++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(v))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(v))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:E,endIndex:R})}return t}function ao(e){let s=[],{modifiers:t}=e;if(t.self)s.push("if ($event.target !== $el) return");for(let i of t.systemKeys)s.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");s.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=xr[t.mouse];s.push(`if ($event.button !== ${i}) return`)}if(t.prevent)s.push("$event.preventDefault()");if(t.stop)s.push("$event.stopPropagation()");return s.join("; ")}function co(e,s){let t=e;if(s.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${s.debounce})`;else if(s.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${s.throttle})`;return t}function es(e){let s=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(s))return e;return`if (typeof ${s} === 'function' && !${s}._isSignal) ${s}($event);`}function lo(e){let{modifiers:s}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ao(e),a=co(es(e.handler),s),h=[];if(s.once)h.push("once: true");if(s.capture)h.push("capture: true");if(Qn(e.event,s))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",_=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function uo(e,s=""){let t=yr(e,s);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],_=c.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=_.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");_=_.replace(R,""),_=_.replace(O,"")}i=i.slice(0,c.startIndex)+_+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function hr(e){let s=e.$uid;return typeof s==="string"&&s?`${s}_`:""}function Ea(e,s,t){if(ac(e))return e;if(s.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:_,bindings:v}=uo(e,hr(s)),E=s.__stx_event_bindings||[];return s.__stx_event_bindings=[...E,...v],_}let i=yr(e,hr(s));if(i.length===0)return e;let a=e;for(let _=i.length-1;_>=0;_--){let v=i[_],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let O of v.events)O.elementId=R[1]}for(let R of v.events){let O=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");E=E.replace(M,""),E=E.replace(N,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let h=Co(i.flatMap((_)=>_.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
115
- `+a.slice(c);else a+=h;return a}function _r(e,s){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(s){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Ht(e,s){let t=o(e),{depths:i,balanced:a}=Qe(t),h=(_)=>!a||i[_]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${s}\\b)`,"g");for(let _ of t.matchAll(c)){let v=(_.index??0)+_[0].length-_[1].length;if(h(v))return!0}for(let _ of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(_.index??0)&&_r(_[1],!0).has(s))return!0;for(let _ of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(_.index??0)&&_r(_[1],!1).has(s))return!0;return!1}var wr="",Cn,at=/^[A-Za-z_$][\w$]*$/,fo=new Set(["if","for","while","switch","with"]),Sr=["(","[","{"],$r=[")","]","}"],po=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function go(e){let s=o(e),t=[];for(let i of s.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:s,tokens:t}}function ts(e){if(Cn&&e===wr)return Cn;let{code:s,tokens:t}=go(e),i=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let Z=a.at(-1);if(Z!==void 0&&["()","[]","{}"].includes(t[Z].text+P))a.pop(),i.set(Z,I),i.set(I,Z)}}function h(I,P){let Z=[],U=I;for(let V=I;V<P;V++){if(["(","[","{"].includes(t[V].text)&&(i.get(V)??P)<P){V=i.get(V);continue}if(t[V].text===",")Z.push([U,V]),U=V+1}return Z.push([U,P]),Z}let c=[];function _(I,P,Z,U=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let V=t[I].text;if(at.test(V)){if(Z.add(V),Z===R)c.push({name:V,token:I,functionScoped:U});return}if(V!=="{"&&V!=="[")return;let X=i.get(I);if(X===void 0||X>=P)return;for(let[Y,Q]of h(I+1,X)){let re=Y;if(V==="{")for(let pe=Y;pe<Q;pe++){if(t[pe].text===":"){re=pe+1;break}if(t[pe].text==="=")break;if(["(","[","{"].includes(t[pe].text)&&i.has(pe))pe=i.get(pe)}_(re,Q,Z,U)}}function v(I,P){let Z=new Set;for(let[U,V]of h(I,P))_(U,V,Z);return Z}function E(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(["(","[","{"].includes(Z)&&i.has(P)){P=i.get(P);continue}if([",",";",")","]","}"].includes(Z))break}return t[Math.max(I,P-1)]?.end??s.length}let R=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,Z=P,U;if(t[P]?.text===")"&&i.has(P))Z=i.get(P),U=v(Z+1,P);else if(t[P]&&at.test(t[P].text))U=new Set([t[P].text]);else continue;let V=I+1,X=t[V]?.text==="{"&&i.has(V)?t[i.get(V)].end:E(V);O.push({start:t[Z].start,end:X,bodyStart:t[V]?.start??X,functionBody:!0,names:U})}else if(t[I].text==="("&&i.has(I)){let P=t[I-1]?.text;if(!P||fo.has(P)||!at.test(P)&&P!=="*"&&P!=="]")continue;let Z=i.get(I),U=Z+1;if(t[U]?.text===":"){U++;while(U<t.length&&!["{","=>",";","="].includes(t[U].text))U++}if(t[U]?.text!=="{"||!i.has(U))continue;O.push({start:t[I].start,end:t[i.get(U)].end,bodyStart:t[U].start,functionBody:P!=="catch",names:v(I+1,Z)})}function M(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(Sr.includes(Z)&&i.has(P)){P=i.get(P);continue}if(Z===";"||$r.includes(Z))break;let U=t[P-1];if(P>I&&po.has(Z)&&U.text!==".")break;if(P>I&&/[\n\r]/.test(s.slice(U.end,t[P].start))&&(/^[\w$]+$/.test(U.text)||$r.includes(U.text)||['"',"'","`"].includes(U.text))&&at.test(Z)&&!["in","of","instanceof"].includes(Z))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!i.has(P))continue;let Z=i.get(P),U=Z+1,V=t[U]?.text==="{"&&i.has(U)?i.get(U):M(U),X=t[V]?.text===";"||t[V]?.text==="}"?t[V].end:t[Math.max(U,V-1)]?.end??s.length;N.push({headStart:P,headEnd:Z,start:t[P].start,end:X})}for(let I=0;I<t.length;I++){let P=t[I].text,Z=t[I-1]?.text;if(Z==="."||t[I+1]?.text===":")continue;if(Z==="as"||Z==="<")continue;if(P==="const"||P==="let"||P==="var"){let U=M(I+1),V=I+1,X=!1,Y=!1,Q=0;for(let re=I+1;re<=U;re++){let pe=t[re]?.text;if(re<U&&Sr.includes(pe)&&i.has(re)&&i.get(re)<U){re=i.get(re);continue}if(re<U&&pe===":"&&!Y)X=!0;else if(re<U&&pe==="="&&Q===0)X=!1,Y=!0;else if(re<U&&X&&pe==="<")Q++;else if(re<U&&X&&pe===">"&&Q>0)Q--;else if(re===U||pe===","&&Q===0)_(V,re,R,P==="var"),V=re+1,X=!1,Y=!1}}else if(P==="function"||P==="class"){let U=I+1;if(t[U]?.text==="*")U++;if(t[U]&&at.test(t[U].text)&&t[U].text!=="extends")R.add(t[U].text),c.push({name:t[U].text,token:U})}else if(P==="import"){let U=I+1;if(t[U]?.text==="*"&&t[U+1]?.text==="as")U+=2;let V=t[U]?.text;if(V&&at.test(V)&&V!=="type"&&t[U+1]?.text!=="("&&t[U+1]?.text!==".")R.add(V),c.push({name:V,token:U,file:!0});let X=t[U]?.text==="{"?U:t[U+1]?.text===","&&t[U+2]?.text==="{"?U+2:-1;if(X!==-1&&i.has(X)){let Y=i.get(X);for(let[Q,re]of h(X+1,Y)){let pe=re-1;while(pe>=Q&&!at.test(t[pe].text))pe--;if(pe>=Q&&t[pe].text!=="type")c.push({name:t[pe].text,token:pe,file:!0})}}}}return wr=e,Cn={code:s,scopes:O,loops:N,declarations:R,sites:c,tokens:t,pairs:i},Cn}function fs(e){let s=ts(e);return{code:s.code,shadows:(t,i)=>s.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Tn(e){return new Set(ts(e).declarations)}function rn(e,s){let{scopes:t,loops:i,sites:a,tokens:h,pairs:c}=ts(e),_=Array.from({length:h.length},()=>-1),v=[];for(let N=0;N<h.length;N++){_[N]=v.length?v[v.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))v.push(N);else if(I==="}"&&v.length&&c.get(N)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let N of a){if(!s.has(N.name))continue;E.add(N.token);let I=N.file?-1:_[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let U=h[N.token].start,V=t.filter((X)=>X.functionBody&&U>=X.bodyStart&&U<X.end).sort((X,Y)=>X.end-X.bodyStart-(Y.end-Y.bodyStart))[0];P=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let U=i.filter((V)=>N.token>V.headStart&&N.token<V.headEnd).sort((V,X)=>V.headEnd-V.headStart-(X.headEnd-X.headStart))[0];if(U)P=[U.start,U.end]}let Z=R.get(N.name);if(Z)Z.push(P);else R.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&at.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!s.has(I)||M.has(I)||E.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let Z=h[N].start;if(R.get(I)?.some(([U,V])=>Z>=U&&Z<V))continue;if(t.some((U)=>Z>=U.start&&Z<U.end&&U.names.has(I)))continue;M.add(I)}return M}var $e="0.2.653";var vr=Symbol.for(`stx.lazy-module-promises.${$e}`);function ho(){let e=globalThis;return e[vr]??=new Map,e[vr]}function r(e,s){let t=ho(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let h=s();return t.set(i,h),h.catch(()=>{if(t.get(i)===h)t.delete(i)}),h}var xo=/<\/(script)/gi;function sn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(xo,"<\\/$1")}import Rr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,s){this.maxSize=e,this.options=s??null,this.sizes=s?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}}get(e){if(!this.cache.has(e))return;let s=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,s),s}set(e,s){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(s):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,s),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let s=this.sizes.get(e);if(s!==void 0)this.bytes-=s,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,bo=500;function _t(e,s){if(s?.includes("g"))return new RegExp(e,s);let t=`${e}:${s||""}`;if(!St.has(t)){if(St.size>=bo){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,s))}return St.get(t)}class Er{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let s=Array.from(new Set(e)),t=s.sort().join(","),i=this.pool.find((_)=>_.context.join(",")===t);if(i)return i.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(..._)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}R=Function(...s,`
115
+ `+a.slice(c);else a+=h;return a}function _r(e,s){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(s){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Ht(e,s){let t=o(e),{depths:i,balanced:a}=Qe(t),h=(_)=>!a||i[_]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${s}\\b)`,"g");for(let _ of t.matchAll(c)){let v=(_.index??0)+_[0].length-_[1].length;if(h(v))return!0}for(let _ of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(_.index??0)&&_r(_[1],!0).has(s))return!0;for(let _ of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(_.index??0)&&_r(_[1],!1).has(s))return!0;return!1}var wr="",Cn,at=/^[A-Za-z_$][\w$]*$/,fo=new Set(["if","for","while","switch","with"]),Sr=["(","[","{"],$r=[")","]","}"],po=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function go(e){let s=o(e),t=[];for(let i of s.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:s,tokens:t}}function ts(e){if(Cn&&e===wr)return Cn;let{code:s,tokens:t}=go(e),i=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let Z=a.at(-1);if(Z!==void 0&&["()","[]","{}"].includes(t[Z].text+P))a.pop(),i.set(Z,I),i.set(I,Z)}}function h(I,P){let Z=[],U=I;for(let V=I;V<P;V++){if(["(","[","{"].includes(t[V].text)&&(i.get(V)??P)<P){V=i.get(V);continue}if(t[V].text===",")Z.push([U,V]),U=V+1}return Z.push([U,P]),Z}let c=[];function _(I,P,Z,U=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let V=t[I].text;if(at.test(V)){if(Z.add(V),Z===R)c.push({name:V,token:I,functionScoped:U});return}if(V!=="{"&&V!=="[")return;let X=i.get(I);if(X===void 0||X>=P)return;for(let[Y,Q]of h(I+1,X)){let re=Y;if(V==="{")for(let pe=Y;pe<Q;pe++){if(t[pe].text===":"){re=pe+1;break}if(t[pe].text==="=")break;if(["(","[","{"].includes(t[pe].text)&&i.has(pe))pe=i.get(pe)}_(re,Q,Z,U)}}function v(I,P){let Z=new Set;for(let[U,V]of h(I,P))_(U,V,Z);return Z}function E(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(["(","[","{"].includes(Z)&&i.has(P)){P=i.get(P);continue}if([",",";",")","]","}"].includes(Z))break}return t[Math.max(I,P-1)]?.end??s.length}let R=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,Z=P,U;if(t[P]?.text===")"&&i.has(P))Z=i.get(P),U=v(Z+1,P);else if(t[P]&&at.test(t[P].text))U=new Set([t[P].text]);else continue;let V=I+1,X=t[V]?.text==="{"&&i.has(V)?t[i.get(V)].end:E(V);O.push({start:t[Z].start,end:X,bodyStart:t[V]?.start??X,functionBody:!0,names:U})}else if(t[I].text==="("&&i.has(I)){let P=t[I-1]?.text;if(!P||fo.has(P)||!at.test(P)&&P!=="*"&&P!=="]")continue;let Z=i.get(I),U=Z+1;if(t[U]?.text===":"){U++;while(U<t.length&&!["{","=>",";","="].includes(t[U].text))U++}if(t[U]?.text!=="{"||!i.has(U))continue;O.push({start:t[I].start,end:t[i.get(U)].end,bodyStart:t[U].start,functionBody:P!=="catch",names:v(I+1,Z)})}function M(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(Sr.includes(Z)&&i.has(P)){P=i.get(P);continue}if(Z===";"||$r.includes(Z))break;let U=t[P-1];if(P>I&&po.has(Z)&&U.text!==".")break;if(P>I&&/[\n\r]/.test(s.slice(U.end,t[P].start))&&(/^[\w$]+$/.test(U.text)||$r.includes(U.text)||['"',"'","`"].includes(U.text))&&at.test(Z)&&!["in","of","instanceof"].includes(Z))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!i.has(P))continue;let Z=i.get(P),U=Z+1,V=t[U]?.text==="{"&&i.has(U)?i.get(U):M(U),X=t[V]?.text===";"||t[V]?.text==="}"?t[V].end:t[Math.max(U,V-1)]?.end??s.length;N.push({headStart:P,headEnd:Z,start:t[P].start,end:X})}for(let I=0;I<t.length;I++){let P=t[I].text,Z=t[I-1]?.text;if(Z==="."||t[I+1]?.text===":")continue;if(Z==="as"||Z==="<")continue;if(P==="const"||P==="let"||P==="var"){let U=M(I+1),V=I+1,X=!1,Y=!1,Q=0;for(let re=I+1;re<=U;re++){let pe=t[re]?.text;if(re<U&&Sr.includes(pe)&&i.has(re)&&i.get(re)<U){re=i.get(re);continue}if(re<U&&pe===":"&&!Y)X=!0;else if(re<U&&pe==="="&&Q===0)X=!1,Y=!0;else if(re<U&&X&&pe==="<")Q++;else if(re<U&&X&&pe===">"&&Q>0)Q--;else if(re===U||pe===","&&Q===0)_(V,re,R,P==="var"),V=re+1,X=!1,Y=!1}}else if(P==="function"||P==="class"){let U=I+1;if(t[U]?.text==="*")U++;if(t[U]&&at.test(t[U].text)&&t[U].text!=="extends")R.add(t[U].text),c.push({name:t[U].text,token:U})}else if(P==="import"){let U=I+1;if(t[U]?.text==="*"&&t[U+1]?.text==="as")U+=2;let V=t[U]?.text;if(V&&at.test(V)&&V!=="type"&&t[U+1]?.text!=="("&&t[U+1]?.text!==".")R.add(V),c.push({name:V,token:U,file:!0});let X=t[U]?.text==="{"?U:t[U+1]?.text===","&&t[U+2]?.text==="{"?U+2:-1;if(X!==-1&&i.has(X)){let Y=i.get(X);for(let[Q,re]of h(X+1,Y)){let pe=re-1;while(pe>=Q&&!at.test(t[pe].text))pe--;if(pe>=Q&&t[pe].text!=="type")c.push({name:t[pe].text,token:pe,file:!0})}}}}return wr=e,Cn={code:s,scopes:O,loops:N,declarations:R,sites:c,tokens:t,pairs:i},Cn}function fs(e){let s=ts(e);return{code:s.code,shadows:(t,i)=>s.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Tn(e){return new Set(ts(e).declarations)}function rn(e,s){let{scopes:t,loops:i,sites:a,tokens:h,pairs:c}=ts(e),_=Array.from({length:h.length},()=>-1),v=[];for(let N=0;N<h.length;N++){_[N]=v.length?v[v.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))v.push(N);else if(I==="}"&&v.length&&c.get(N)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let N of a){if(!s.has(N.name))continue;E.add(N.token);let I=N.file?-1:_[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let U=h[N.token].start,V=t.filter((X)=>X.functionBody&&U>=X.bodyStart&&U<X.end).sort((X,Y)=>X.end-X.bodyStart-(Y.end-Y.bodyStart))[0];P=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let U=i.filter((V)=>N.token>V.headStart&&N.token<V.headEnd).sort((V,X)=>V.headEnd-V.headStart-(X.headEnd-X.headStart))[0];if(U)P=[U.start,U.end]}let Z=R.get(N.name);if(Z)Z.push(P);else R.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&at.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!s.has(I)||M.has(I)||E.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let Z=h[N].start;if(R.get(I)?.some(([U,V])=>Z>=U&&Z<V))continue;if(t.some((U)=>Z>=U.start&&Z<U.end&&U.names.has(I)))continue;M.add(I)}return M}var $e="0.2.654";var vr=Symbol.for(`stx.lazy-module-promises.${$e}`);function ho(){let e=globalThis;return e[vr]??=new Map,e[vr]}function r(e,s){let t=ho(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let h=s();return t.set(i,h),h.catch(()=>{if(t.get(i)===h)t.delete(i)}),h}var xo=/<\/(script)/gi;function sn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(xo,"<\\/$1")}import Rr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,s){this.maxSize=e,this.options=s??null,this.sizes=s?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}}get(e){if(!this.cache.has(e))return;let s=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,s),s}set(e,s){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(s):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,s),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let s=this.sizes.get(e);if(s!==void 0)this.bytes-=s,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,bo=500;function _t(e,s){if(s?.includes("g"))return new RegExp(e,s);let t=`${e}:${s||""}`;if(!St.has(t)){if(St.size>=bo){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,s))}return St.get(t)}class Er{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let s=Array.from(new Set(e)),t=s.sort().join(","),i=this.pool.find((_)=>_.context.join(",")===t);if(i)return i.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(..._)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}R=Function(...s,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${v};
@@ -193,7 +193,7 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,i)=>ea(t,i)).join(`
195
195
  `)}`}function Or(e){let s=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=i.length,c=0;while(c<h){let _=i[c];if(_==="'"||_==='"'||_==="`"){let v=_;if(c++,v==="`"){let E=0;while(c<h){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<h){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(_==="/"&&i[c+1]==="/"){while(c<h&&i[c]!==`
196
- `)c++;continue}if(_==="/"&&i[c+1]==="*"){c+=2;while(c<h-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(_==="{"){a++,c++;continue}if(_==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let M=E[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=R[0].length;continue}let O=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var na=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function sa(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!na.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)i(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)i(h[1]);let _=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=_.exec(e))!==null)i(h[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=v.exec(e))!==null)i(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=E.exec(e))!==null)i(h[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((h=R.exec(e))!==null)i(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)i(h[1]);return s}async function Oe(e,s={}){let t=e,i="",a=!1,h=[],c=Io(t,{filePath:s.filePath,projectRoot:s.projectRoot});t=c.code;let _=Oo(c.styles),v=Pt(t);t=v.code,h=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await r("stx/client-script-bundler",()=>import("./chunk-83p6yy52.js"));if(E(t))t=await R(t,s.filePath||"",{projectRoot:s.projectRoot,minify:s.production}),a=!0;if(s.autoImports!==!1){let X=Wa(t);t=X.code,i=qa(X.stxImports,X.browserImports.filter((Y)=>!h.includes(Y)))}if(i=`${dn(t,s.serverData)}${i}`,t=T(t),!a&&Ne(s.attrs||""))t=De(t);let O=ta(s.eventBindings||[]),M=(s.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=s.instanceId?` data-stx-instance="${s.instanceId}"`:"";if(N){let X=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Y=`type="module" data-stx-scoped${I}${X?` ${X}`:""}`;return`${_}<script ${Y}>
196
+ `)c++;continue}if(_==="/"&&i[c+1]==="*"){c+=2;while(c<h-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(_==="{"){a++,c++;continue}if(_==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let M=E[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=R[0].length;continue}let O=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var na=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function sa(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!na.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)i(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)i(h[1]);let _=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=_.exec(e))!==null)i(h[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=v.exec(e))!==null)i(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=E.exec(e))!==null)i(h[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((h=R.exec(e))!==null)i(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)i(h[1]);return s}async function Oe(e,s={}){let t=e,i="",a=!1,h=[],c=Io(t,{filePath:s.filePath,projectRoot:s.projectRoot});t=c.code;let _=Oo(c.styles),v=Pt(t);t=v.code,h=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await r("stx/client-script-bundler",()=>import("./chunk-z75bp57x.js"));if(E(t))t=await R(t,s.filePath||"",{projectRoot:s.projectRoot,minify:s.production}),a=!0;if(s.autoImports!==!1){let X=Wa(t);t=X.code,i=qa(X.stxImports,X.browserImports.filter((Y)=>!h.includes(Y)))}if(i=`${dn(t,s.serverData)}${i}`,t=T(t),!a&&Ne(s.attrs||""))t=De(t);let O=ta(s.eventBindings||[]),M=(s.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=s.instanceId?` data-stx-instance="${s.instanceId}"`:"";if(N){let X=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Y=`type="module" data-stx-scoped${I}${X?` ${X}`:""}`;return`${_}<script ${Y}>
197
197
  ${sn(`${i}${t}
198
198
  ${O}`)}
199
199
  </script>`}let P=Go(e),Z=/function __stx_setup_/.test(t),U=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(X){let Y=X.length>0?`
@@ -286,8 +286,8 @@ ${E.join(`
286
286
  `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=()=>{if(i!==0)return;let R=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(R){let I=R[2].split(",").map((P)=>{let Z=P.trim().split(":");return Z[Z.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))s.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))s.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))s.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))s.push(I),t.add(I)}};while(a<h){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){_();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))E();a++}return s}function cl(e){let s=[],t=0,i=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(i,h)),i=h+1}if(i<e.length)s.push(e.slice(i));return s}function ll(e){let s=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")s++;else if(a===")"||a==="]"||a==="}")s--;else if(a==="="&&s===0){let h=e[i-1],c=e[i+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function ul(e,s){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,h=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")h++;else if(v==="{"){if(h--,h===0){c=i;break}}}if(c===-1)return;let _=e.slice(c+1,a);for(let v of cl(_)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=ll(E);if(R===-1)continue;let O=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(s[O]!==void 0)continue;let M=E.slice(R+1).trim();if(!M)continue;try{let N=Object.keys(s).filter(Nt),I=Function(...N,`"use strict"; return (${M});`);s[O]=I(...N.map((P)=>s[P]))}catch{}}}catch{}}var fl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function tu(e,s){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!fl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=ce(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,_=!1;for(let E of h){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;_=!0;break}}if(!_)return null;let v=t[0].length;return e.slice(0,v)+s+e.slice(v)}async function lr(e,s,t,i,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(Q)=>Q.split("-").map((re)=>re.charAt(0).toUpperCase()+re.slice(1)).join(""),_=t.__importedComponents;if(_){for(let Q of[h,h.toLowerCase(),c(h),j(h)])if(_.has(Q))return!0}let v=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],E=typeof a.root==="string"?oe.resolve(a.root):void 0,R=E??oe.dirname(i),O=[],M=(Q)=>{if(Q&&!O.includes(Q))O.push(Q)},N=t.__originalFilePath;if(N)M(oe.join(oe.dirname(N),"components"));M(s),M(a._rootComponentsDir),M(oe.join(oe.dirname(i),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((Q)=>Q.toLowerCase()===h.toLowerCase());if(!I)for(let Q of a._targetComponentDirs??[])M(Q);if(E)M(oe.resolve(E,"resources/views/components")),M(oe.resolve(E,"resources/components")),M(oe.resolve(E,"src/components")),M(oe.resolve(E,"components"));for(let Q of a._layerComponentDirs??[])M(Q);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let Q of P)M(typeof Q==="string"?Q:null);if(M(a.fallbackComponentsDir),I)for(let Q of a._targetComponentDirs??[])M(Q);if(h.startsWith("./")||h.startsWith("../"))return n(oe.resolve(oe.dirname(i),`${h}.stx`));let Z=ji(oe.resolve(import.meta.dir,"components")),U=O.map((Q)=>oe.isAbsolute(Q)?Q:oe.resolve(R,Q)),V=`${v.join("\x00")}\x00\x00${U.join("\x00")}`,X=Ws.get(V);if(X!==void 0)return X;let Y=!1;e:for(let Q of U){if(ji(Q)===Z)continue;for(let re of v)if(await n(oe.join(Q,re))){Y=!0;break e}}return Ws.set(V,Y),Y}function ji(e){let s=Fs.get(e);if(s!==void 0)return s;let t=e;try{t=Hs.realpathSync(e)}catch{}return Fs.set(e,t),t}function nu(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ga(e){if(!e)return!1;let s=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(s)}function pl(e,s,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,h)=>{let c;try{c=C(a,s)}catch{return h}if(c===void 0||c===null)return"";let _=String(c);if(/<\/style/i.test(_))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return _};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>i(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>i(h,a))}var Ni=new Set;function Li(e,s,t,i){let a=`${e}\x00${s}\x00${i??""}`;if(!process.env.STX_DEBUG&&Ni.has(a))return;Ni.add(a);let h=s?` used in ${s}`:"",c=i?` Cause: ${i}.`:"",_=t.length>0?`
287
287
  searched:
288
288
  ${t.map((v)=>` - ${v}`).join(`
289
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${_}`)}function Bi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Do(e){let s=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)s.add(a[1]);t.lastIndex=0}return[...s]}async function Me(e,s,t,i,a,h,c,_=new Set,v,E=Ze(a),R,O=e){let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-kw680rcy.js")),N=_??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof s.client==="string"?s.client.trim():"";if("client"in s)delete s.client;let Z=P&&P!=="load"&&nu(P)?P:"";try{let U=(ie)=>ie.split("-").map((se)=>se.charAt(0).toUpperCase()+se.slice(1)).join(""),V=O.endsWith(".stx")?O.slice(0,-4):O,X=null,Y=a.__importedComponents;if(Y){let ie=[V,V.toLowerCase(),U(V),j(V)];for(let se of ie)if(Y.has(se)){X=Y.get(se);break}}let Q=[];if(!X){let ie=[`${V}.stx`,`${U(V)}.stx`,`${j(V)}.stx`],se=[...new Set(ie)],ge=a.__originalFilePath,me=[];if(me.push(...c._layerComponentDirs??[]),ge){let Se=oe.join(oe.dirname(ge),"components");me.push(Se)}if(i)me.push(i);let Ue=c._rootComponentsDir;if(typeof Ue==="string"&&!me.includes(Ue))me.push(Ue);let je=oe.join(oe.dirname(h),"components");if(!me.includes(je))me.push(je);if(c.componentsDir&&c.componentsDir!==i&&!me.includes(c.componentsDir))me.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),bt=(R?.events??[]).map((Se)=>Se.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ot=Object.hasOwn(s,"checked")||Boolean(R?.reactiveProps?.includes("checked")),yt=Object.hasOwn(s,"value")||Boolean(R?.reactiveProps?.includes("value")),_n=!bt.includes("valuechange")&&(ot||bt.includes("change")&&!yt),wn=c._targetComponentFallbackNames?.some((Se)=>Se.toLowerCase()===V.toLowerCase())&&(!it||_n);for(let Se of wn?[]:c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se);let Xe=typeof c.root==="string"?oe.resolve(c.root):void 0,Sn=Xe??oe.dirname(h),nt=[];if(Xe)nt.push(oe.resolve(Xe,"resources/views/components")),nt.push(oe.resolve(Xe,"resources/components")),nt.push(oe.resolve(Xe,"src/components")),nt.push(oe.resolve(Xe,"components"));nt.push(oe.resolve(import.meta.dir,"components"));for(let Se of nt)if(!me.includes(Se))me.push(Se);let Vt=c._pluginComponentDirs;if(Array.isArray(Vt)){for(let Se of Vt)if(typeof Se==="string"&&!me.includes(Se))me.push(Se)}if(c.fallbackComponentsDir&&!me.includes(c.fallbackComponentsDir))me.push(c.fallbackComponentsDir);if(wn){for(let Se of c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se)}let Ut=[...new Set(me.map((Se)=>{if(!Se)return Se;return oe.isAbsolute(Se)?Se:oe.resolve(Sn,Se)}))];me.length=0,me.push(...Ut);let wt=`${V}\x00${h}\x00${Ut.join("\x00")}`,Jn=Vn.get(wt);if(Jn)if(await n(Jn))X=Jn;else Vn.delete(wt);if(!X&&(V.startsWith("./")||V.startsWith("../")))X=oe.resolve(oe.dirname(h),`${V}.stx`),Q.push(X);else if(!X)for(let Se of me){if(!Se)continue;for(let $n of se){let vn=oe.join(Se,$n);if(Q.push(vn),await n(vn)){X=vn;break}}if(X)break;if(!X)try{let $n=await import("fs");if(!$n.statSync(Se,{throwIfNoEntry:!1})?.isDirectory())continue;let to=8,Gn=[{path:Se,depth:0}];while(Gn.length>0&&!X){let En=Gn.pop();if(En.depth>=to)continue;let Ys;try{Ys=$n.readdirSync(En.path,{withFileTypes:!0})}catch{continue}for(let kn of Ys){if(!kn.isDirectory())continue;if(kn.name==="node_modules"||kn.name.startsWith("."))continue;let Qs=oe.join(En.path,kn.name);for(let no of se){let Yn=oe.join(Qs,no);if(Q.push(Yn),await n(Yn)){X=Yn;break}}if(X)break;Gn.push({path:Qs,depth:En.depth+1})}}}catch{}if(X)break}if(X)Vn.set(wt,X)}if(!X||!await n(X))return Li(e,h,Q),Bi(e);v.add(X);let re;if(Qt.has(X))re=Qt.get(X);else try{re=await Bun.file(X).text(),Qt.set(X,re)}catch(ie){let se=ie instanceof Error?ie.message:String(ie);return Li(e,h,[X],se),Bi(e)}if(R)for(let ie of new Set([...Object.keys(s),...R.reactiveProps??[]])){let se=ie.toLowerCase();if(se.startsWith("aria-")||se.startsWith("data-"))continue;let ge=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ge}\\b`).test(re))R.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ge}\\b|\\[\\s*['"]${ge}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ge}['"]`).test(re))R.consumedProps?.add(ie)}let pe=new Set(["__originalFilePath","__importedComponents",An,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ie,se]of Object.entries(a))if(!ie.startsWith("__")||pe.has(ie))Ee[ie]=se;let ke=E.length>0?{[Ln]:[...E]}:{},ze=t;if(t.includes("@include")){let{processIncludes:ie}=await r("stx/includes",()=>import("./chunk-wxvpfzbe.js"));ze=await ie(t,a,h,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:ie}=await r("stx/component-renderer",()=>import("./chunk-5e2pnqyr.js"));ze=await ie(ze,{...a,__processedComponents:N,...ke},h,c,v)}let Te=[];if(Ga(ze)){let{processExpressions:ie}=await r("stx/expressions",()=>import("./chunk-kqnsytx3.js")),se=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ke}:E.length>0?{...a,...ke}:a;ze=ie(ze,se,h);for(let ge of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(ge[1].trim())}let He=q(ze),Ye=[],mt=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,se)=>{let ge=He.scripts[Number(se)]||"",me=ge.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),je=!Ue||["module","text/javascript","application/javascript"].includes(Ue),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&je&&!it)return Ye.push(ge),"";return ge}),{extractSlotContent:Kn}=await r("stx/slots",()=>import("./chunk-p4n5h44f.js")),ct=Kn(mt),lt={};if(ct.defaultSlot?.trim())lt.default=ct.defaultSlot;for(let[ie,se]of ct.namedSlots)lt[ie]=se.content;let ut=a.__stx_scope_seq??={n:0,key:ms(String(a.__filename??h))},Ot=Wi(e,process.cwd()),ft=`stx_${(Ot.endsWith(".stx")?Ot.slice(0,-4):Ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Fe={...Ee,$uid:ft,...s,props:s,slot:mt,$slots:lt,__processedComponents:I,__sections:{},__stx_signals_gate:be(re)||Ga(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};ul(re,Fe);let Mt=re,tn=ae(Mt);if(tn)Mt=tn.content.trim();let Zn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Zn)];for(let[,ie,se]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Re(se,X,c.strict);let Je=[],jt=null,qn=Dt.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),ht=null,et=null,Lt=null,nn=0,Bt=null;if(sl(c),qn&&Vs>0){let ie=rl({props:s,slot:ze,slotContext:t.trim()?il(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((se)=>se.configFile),uid:ft});if(ie!==null){ht=`${X}\x00${b(re)}\x00${ie}`;let se=Un.get(ht);if(se){for(let ge of se.dependencies)v.add(ge);if(Nr(a,se.clientFactories),ut.n+=se.uidsConsumed,se.preservedClientExpressions.length>0){let ge=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of se.preservedClientExpressions)ge.add(me);a.__stx_preserved_client_expressions=[...ge]}return se.output}et=new Set(v),Lt=Dr(a),nn=ut.n,Bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let ie of Dt){let se=ie[1]||"",ge=ie[2]||"",me=se.includes("server");if(Ne(se)&&ge.trim())ge=De(ge);if(me&&ge){for(let je of Pe(ge))zt.add(je);try{await M(ge,Fe,X,{onFailure:(je)=>{if(je.kind!=="unknown")jt=je.kind}})}catch(je){}}if(!me){let je=ge.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=je.includes("{{")&&je.includes("}}"),bt=je.includes("{!!")&&je.includes("!!}");if(it||bt)je=Lo(je,Fe,X);let ot=se.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${ot}>${je}</script>`)}}let Ke=q(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Wt=Ke?Ke[1]:"",Xn=Ke?Ke[2]:"",tt="",J=Wt&&/\bscoped\b/i.test(Wt);if(Ke)tt=`<style${Wt}>${pl(Xn,Fe,X)}</style>`;let ee=Mt;if(ee=ee.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ke)ee=ee.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,se=[];if(ee=ee.replace(ie,(ge,me)=>{let Ue=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)se.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ee=ee.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),se.length>0)tt=`${tt}${se.join(`
290
- `)}`}if(t&&ee.includes("{{ text || slot }}"))ee=ee.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-p4n5h44f.js")),{defaultSlot:xe,namedSlots:ve}=ct,We=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ie)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ie)),pt=(ie)=>We?pi(ie,ft):ie,Gs=new Map([...ve].map(([ie,se])=>[ie,{...se,content:pt(se.content)}]));ee=await fe(ee,pt(xe),Gs,Fe);let hn=Do(Je),xn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((ie)=>!zt.has(ie));if(hn.length>0||xn.length>0)Fe.__stx_client_signal_names=[...new Set([...xn,...hn])];else delete Fe.__stx_client_signal_names;let Ft=E.filter((ie)=>!zt.has(ie)&&!(ie in s));if(Ft.length>0)Fe[Ln]=Ft;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:oe.dirname(X),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||We||Je.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await r("stx/process",()=>import("./chunk-3075268c.js")),st=await yn(ee,Fe,X,bn,v),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ie of st.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ie[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let qe=ft,Ve=st;if(We){let ie="";if(Object.keys(s).length>0)try{ie=` data-stx-props="${Bs(JSON.stringify(s))}"`}catch{}let se=Z?` stx-hydrate="${Bs(Z)}"`:"",ge=Object.fromEntries(Object.entries(lt).map(([ot,yt])=>[ot,Boolean(yt)])),me=Object.keys(ge).length>0?` data-stx-slots="${Bs(JSON.stringify(ge))}"`:"",Ue=` data-stx-scope="${qe}"${ie}${me}${se}`,je=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(st),it=je?"span":"div";Ve=tu(st,Ue)??`<${it}${Ue} data-stx-component-wrapper${je?' style="display:contents"':""}>${st}</${it}>`;let bt=await Promise.all(Je.map(async(ot)=>{let yt=ot.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return ot;let[,_n,wn]=yt,Xe=await ml(wn,X,c.buildMode==="compile"),Sn=dn(Xe.clientCode,Ie(Fe)),{vendorStyleTags:nt}=Xe,Vt=Sn?`function(__scopeId) {
289
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${_}`)}function Bi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Do(e){let s=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)s.add(a[1]);t.lastIndex=0}return[...s]}async function Me(e,s,t,i,a,h,c,_=new Set,v,E=Ze(a),R,O=e){let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-sd4jwn3y.js")),N=_??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof s.client==="string"?s.client.trim():"";if("client"in s)delete s.client;let Z=P&&P!=="load"&&nu(P)?P:"";try{let U=(ie)=>ie.split("-").map((se)=>se.charAt(0).toUpperCase()+se.slice(1)).join(""),V=O.endsWith(".stx")?O.slice(0,-4):O,X=null,Y=a.__importedComponents;if(Y){let ie=[V,V.toLowerCase(),U(V),j(V)];for(let se of ie)if(Y.has(se)){X=Y.get(se);break}}let Q=[];if(!X){let ie=[`${V}.stx`,`${U(V)}.stx`,`${j(V)}.stx`],se=[...new Set(ie)],ge=a.__originalFilePath,me=[];if(me.push(...c._layerComponentDirs??[]),ge){let Se=oe.join(oe.dirname(ge),"components");me.push(Se)}if(i)me.push(i);let Ue=c._rootComponentsDir;if(typeof Ue==="string"&&!me.includes(Ue))me.push(Ue);let je=oe.join(oe.dirname(h),"components");if(!me.includes(je))me.push(je);if(c.componentsDir&&c.componentsDir!==i&&!me.includes(c.componentsDir))me.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),bt=(R?.events??[]).map((Se)=>Se.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ot=Object.hasOwn(s,"checked")||Boolean(R?.reactiveProps?.includes("checked")),yt=Object.hasOwn(s,"value")||Boolean(R?.reactiveProps?.includes("value")),_n=!bt.includes("valuechange")&&(ot||bt.includes("change")&&!yt),wn=c._targetComponentFallbackNames?.some((Se)=>Se.toLowerCase()===V.toLowerCase())&&(!it||_n);for(let Se of wn?[]:c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se);let Xe=typeof c.root==="string"?oe.resolve(c.root):void 0,Sn=Xe??oe.dirname(h),nt=[];if(Xe)nt.push(oe.resolve(Xe,"resources/views/components")),nt.push(oe.resolve(Xe,"resources/components")),nt.push(oe.resolve(Xe,"src/components")),nt.push(oe.resolve(Xe,"components"));nt.push(oe.resolve(import.meta.dir,"components"));for(let Se of nt)if(!me.includes(Se))me.push(Se);let Vt=c._pluginComponentDirs;if(Array.isArray(Vt)){for(let Se of Vt)if(typeof Se==="string"&&!me.includes(Se))me.push(Se)}if(c.fallbackComponentsDir&&!me.includes(c.fallbackComponentsDir))me.push(c.fallbackComponentsDir);if(wn){for(let Se of c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se)}let Ut=[...new Set(me.map((Se)=>{if(!Se)return Se;return oe.isAbsolute(Se)?Se:oe.resolve(Sn,Se)}))];me.length=0,me.push(...Ut);let wt=`${V}\x00${h}\x00${Ut.join("\x00")}`,Jn=Vn.get(wt);if(Jn)if(await n(Jn))X=Jn;else Vn.delete(wt);if(!X&&(V.startsWith("./")||V.startsWith("../")))X=oe.resolve(oe.dirname(h),`${V}.stx`),Q.push(X);else if(!X)for(let Se of me){if(!Se)continue;for(let $n of se){let vn=oe.join(Se,$n);if(Q.push(vn),await n(vn)){X=vn;break}}if(X)break;if(!X)try{let $n=await import("fs");if(!$n.statSync(Se,{throwIfNoEntry:!1})?.isDirectory())continue;let to=8,Gn=[{path:Se,depth:0}];while(Gn.length>0&&!X){let En=Gn.pop();if(En.depth>=to)continue;let Ys;try{Ys=$n.readdirSync(En.path,{withFileTypes:!0})}catch{continue}for(let kn of Ys){if(!kn.isDirectory())continue;if(kn.name==="node_modules"||kn.name.startsWith("."))continue;let Qs=oe.join(En.path,kn.name);for(let no of se){let Yn=oe.join(Qs,no);if(Q.push(Yn),await n(Yn)){X=Yn;break}}if(X)break;Gn.push({path:Qs,depth:En.depth+1})}}}catch{}if(X)break}if(X)Vn.set(wt,X)}if(!X||!await n(X))return Li(e,h,Q),Bi(e);v.add(X);let re;if(Qt.has(X))re=Qt.get(X);else try{re=await Bun.file(X).text(),Qt.set(X,re)}catch(ie){let se=ie instanceof Error?ie.message:String(ie);return Li(e,h,[X],se),Bi(e)}if(R)for(let ie of new Set([...Object.keys(s),...R.reactiveProps??[]])){let se=ie.toLowerCase();if(se.startsWith("aria-")||se.startsWith("data-"))continue;let ge=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ge}\\b`).test(re))R.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ge}\\b|\\[\\s*['"]${ge}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ge}['"]`).test(re))R.consumedProps?.add(ie)}let pe=new Set(["__originalFilePath","__importedComponents",An,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ie,se]of Object.entries(a))if(!ie.startsWith("__")||pe.has(ie))Ee[ie]=se;let ke=E.length>0?{[Ln]:[...E]}:{},ze=t;if(t.includes("@include")){let{processIncludes:ie}=await r("stx/includes",()=>import("./chunk-3634ds4n.js"));ze=await ie(t,a,h,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:ie}=await r("stx/component-renderer",()=>import("./chunk-h0bg2h0j.js"));ze=await ie(ze,{...a,__processedComponents:N,...ke},h,c,v)}let Te=[];if(Ga(ze)){let{processExpressions:ie}=await r("stx/expressions",()=>import("./chunk-q1x7ckfw.js")),se=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ke}:E.length>0?{...a,...ke}:a;ze=ie(ze,se,h);for(let ge of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(ge[1].trim())}let He=q(ze),Ye=[],mt=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,se)=>{let ge=He.scripts[Number(se)]||"",me=ge.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),je=!Ue||["module","text/javascript","application/javascript"].includes(Ue),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&je&&!it)return Ye.push(ge),"";return ge}),{extractSlotContent:Kn}=await r("stx/slots",()=>import("./chunk-42v0vegr.js")),ct=Kn(mt),lt={};if(ct.defaultSlot?.trim())lt.default=ct.defaultSlot;for(let[ie,se]of ct.namedSlots)lt[ie]=se.content;let ut=a.__stx_scope_seq??={n:0,key:ms(String(a.__filename??h))},Ot=Wi(e,process.cwd()),ft=`stx_${(Ot.endsWith(".stx")?Ot.slice(0,-4):Ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Fe={...Ee,$uid:ft,...s,props:s,slot:mt,$slots:lt,__processedComponents:I,__sections:{},__stx_signals_gate:be(re)||Ga(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};ul(re,Fe);let Mt=re,tn=ae(Mt);if(tn)Mt=tn.content.trim();let Zn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Zn)];for(let[,ie,se]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Re(se,X,c.strict);let Je=[],jt=null,qn=Dt.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),ht=null,et=null,Lt=null,nn=0,Bt=null;if(sl(c),qn&&Vs>0){let ie=rl({props:s,slot:ze,slotContext:t.trim()?il(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((se)=>se.configFile),uid:ft});if(ie!==null){ht=`${X}\x00${b(re)}\x00${ie}`;let se=Un.get(ht);if(se){for(let ge of se.dependencies)v.add(ge);if(Nr(a,se.clientFactories),ut.n+=se.uidsConsumed,se.preservedClientExpressions.length>0){let ge=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of se.preservedClientExpressions)ge.add(me);a.__stx_preserved_client_expressions=[...ge]}return se.output}et=new Set(v),Lt=Dr(a),nn=ut.n,Bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let ie of Dt){let se=ie[1]||"",ge=ie[2]||"",me=se.includes("server");if(Ne(se)&&ge.trim())ge=De(ge);if(me&&ge){for(let je of Pe(ge))zt.add(je);try{await M(ge,Fe,X,{onFailure:(je)=>{if(je.kind!=="unknown")jt=je.kind}})}catch(je){}}if(!me){let je=ge.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=je.includes("{{")&&je.includes("}}"),bt=je.includes("{!!")&&je.includes("!!}");if(it||bt)je=Lo(je,Fe,X);let ot=se.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${ot}>${je}</script>`)}}let Ke=q(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Wt=Ke?Ke[1]:"",Xn=Ke?Ke[2]:"",tt="",J=Wt&&/\bscoped\b/i.test(Wt);if(Ke)tt=`<style${Wt}>${pl(Xn,Fe,X)}</style>`;let ee=Mt;if(ee=ee.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ke)ee=ee.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,se=[];if(ee=ee.replace(ie,(ge,me)=>{let Ue=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)se.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ee=ee.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),se.length>0)tt=`${tt}${se.join(`
290
+ `)}`}if(t&&ee.includes("{{ text || slot }}"))ee=ee.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-42v0vegr.js")),{defaultSlot:xe,namedSlots:ve}=ct,We=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ie)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ie)),pt=(ie)=>We?pi(ie,ft):ie,Gs=new Map([...ve].map(([ie,se])=>[ie,{...se,content:pt(se.content)}]));ee=await fe(ee,pt(xe),Gs,Fe);let hn=Do(Je),xn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((ie)=>!zt.has(ie));if(hn.length>0||xn.length>0)Fe.__stx_client_signal_names=[...new Set([...xn,...hn])];else delete Fe.__stx_client_signal_names;let Ft=E.filter((ie)=>!zt.has(ie)&&!(ie in s));if(Ft.length>0)Fe[Ln]=Ft;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:oe.dirname(X),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||We||Je.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await r("stx/process",()=>import("./chunk-fsnby15p.js")),st=await yn(ee,Fe,X,bn,v),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ie of st.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ie[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let qe=ft,Ve=st;if(We){let ie="";if(Object.keys(s).length>0)try{ie=` data-stx-props="${Bs(JSON.stringify(s))}"`}catch{}let se=Z?` stx-hydrate="${Bs(Z)}"`:"",ge=Object.fromEntries(Object.entries(lt).map(([ot,yt])=>[ot,Boolean(yt)])),me=Object.keys(ge).length>0?` data-stx-slots="${Bs(JSON.stringify(ge))}"`:"",Ue=` data-stx-scope="${qe}"${ie}${me}${se}`,je=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(st),it=je?"span":"div";Ve=tu(st,Ue)??`<${it}${Ue} data-stx-component-wrapper${je?' style="display:contents"':""}>${st}</${it}>`;let bt=await Promise.all(Je.map(async(ot)=>{let yt=ot.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return ot;let[,_n,wn]=yt,Xe=await ml(wn,X,c.buildMode==="compile"),Sn=dn(Xe.clientCode,Ie(Fe)),{vendorStyleTags:nt}=Xe,Vt=Sn?`function(__scopeId) {
291
291
  ${Sn}
292
292
  return (${Xe.factoryBody})(__scopeId);
293
293
  }`:Xe.factoryBody,Ut=Z?null:_s(a,Vt),wt=Ut?`window.__stxComponentFactories[${JSON.stringify(Ut)}](${JSON.stringify(qe)});`:`(${Vt})(${JSON.stringify(qe)});`;if(Z)return`${nt}<script type="stx/island" data-stx-island="${qe}" data-stx-scoped data-stx-owner="${qe}"${_n}>${wt}</script>`;return`${nt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${qe}"${_n}>${wt}</script>`}));if(Ve=Ve+`
@@ -313,7 +313,7 @@ ${_e.yellow}${_e.bold}Message:${_e.reset} ${s}
313
313
  `,_)R+=`
314
314
  ${_e.blue}${_e.bold}Context:${_e.reset}
315
315
  ${_e.dim}${_}${_e.reset}
316
- `;return R}function de(){Qt.clear(),Vn.clear(),Ws.clear(),Fs.clear(),Un.clear()}function Rp(){return{size:Qt.size,maxSize:500}}var zs=y(128);async function ml(e,s,t){let i=b(e,s,t),a=zs.get(i);if(a){if(as(a.deps))return a;zs.delete(i)}let h=Io(e,{filePath:s,projectRoot:process.cwd()}),c=h.code,_=Oo(h.styles);c=Pt(c).code;let{hasUserImports:v,bundleClientScript:E}=await r("stx/client-script-bundler",()=>import("./chunk-83p6yy52.js")),R=[],O=!1;if(v(c)){let V=c;c=await E(V,s,{projectRoot:process.cwd(),minify:t,collectInputs:R}),O=c===V}let{stripStxRuntimeImports:M}=await r("stx/signal-processing",()=>import("./chunk-646x47qt.js"));c=M(c);let N=T(c),I=al(N),P=new Set(L(N,!0).split(",").map((V)=>V.trim())),Z=`function(__scopeId) {
316
+ `;return R}function de(){Qt.clear(),Vn.clear(),Ws.clear(),Fs.clear(),Un.clear()}function Rp(){return{size:Qt.size,maxSize:500}}var zs=y(128);async function ml(e,s,t){let i=b(e,s,t),a=zs.get(i);if(a){if(as(a.deps))return a;zs.delete(i)}let h=Io(e,{filePath:s,projectRoot:process.cwd()}),c=h.code,_=Oo(h.styles);c=Pt(c).code;let{hasUserImports:v,bundleClientScript:E}=await r("stx/client-script-bundler",()=>import("./chunk-z75bp57x.js")),R=[],O=!1;if(v(c)){let V=c;c=await E(V,s,{projectRoot:process.cwd(),minify:t,collectInputs:R}),O=c===V}let{stripStxRuntimeImports:M}=await r("stx/signal-processing",()=>import("./chunk-q79ksfcd.js"));c=M(c);let N=T(c),I=al(N),P=new Set(L(N,!0).split(",").map((V)=>V.trim())),Z=`function(__scopeId) {
317
317
  ${rt("const",[...ic,...I],N)}
318
318
  const __scope = window.stx._scopes = window.stx._scopes || {};
319
319
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{f,g,m}from"./chunk-2dm6ey5w.js";import{N}from"./chunk-anpp7jqf.js";import{s}from"./chunk-60ntv8n1.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 r=n[1],i=n[2];t.push({type:"suspense",name:r,content:i}),o=n.index+n[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function rd(e,t={},o={}){let n={...N,...o,streaming:{...q,...o.streaming}},r=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await f(p,h,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 s(c,h,e,n,l);for(let b=0;b<u.length;b+=r)i.enqueue(u.slice(b,b+r)),await new Promise((y)=>setTimeout(y,0))}else{let u=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)u.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await s(I,h,e,n,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await s(_.content,h,e,n,l);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await s(_,h,e,n,l);i.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await s(d.content,h,e,n,l);i.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;i.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{f,g,m}from"./chunk-2yg9y1na.js";import{N}from"./chunk-3v8yejzc.js";import{s}from"./chunk-g7j3mwzd.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 r=n[1],i=n[2];t.push({type:"suspense",name:r,content:i}),o=n.index+n[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function rd(e,t={},o={}){let n={...N,...o,streaming:{...q,...o.streaming}},r=n.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await f(p,h,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 s(c,h,e,n,l);for(let b=0;b<u.length;b+=r)i.enqueue(u.slice(b,b+r)),await new Promise((y)=>setTimeout(y,0))}else{let u=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)u.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await s(I,h,e,n,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await s(_.content,h,e,n,l);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await s(_,h,e,n,l);i.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await s(d.content,h,e,n,l);i.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;i.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,s(d.content,h,e,n,l))}i.enqueue(`
5
5
  <script>
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{mn,A}from"./chunk-2h8ea0we.js";import m from"fs";import e from"path";async function gn(r,o,i){if(r.__stx_runtime_config)return;let n=mn();if(n||i){r.__stx_runtime_config=n??A(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-wgddpw30.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=A(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function jo(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{mn,A}from"./chunk-2h8ea0we.js";import m from"fs";import e from"path";async function gn(r,o,i){if(r.__stx_runtime_config)return;let n=mn();if(n||i){r.__stx_runtime_config=n??A(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-s0crnpyx.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=A(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function jo(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{lp,Sl,We,sa,up,Dr,Mr,Lr}from"./chunk-77vp2r7q.js";import"./chunk-7v9hxyqx.js";import"./chunk-8gewq710.js";import"./chunk-wh838rdh.js";import"./chunk-2dm6ey5w.js";import"./chunk-aw7a82fp.js";import"./chunk-2h8ea0we.js";import"./chunk-4e0z858k.js";import"./chunk-ce6zddpf.js";import"./chunk-4qwvqbzf.js";export{up as clearOnceStore,sa as onceStore,We as partialsCache,Dr as processIncludes,Mr as processStackPushDirectives,Lr as processStackReplacements,lp as resetUnscopedSignalWarnings,Sl as topLevelElements};
2
+ import{lp,Sl,We,sa,up,Dr,Mr,Lr}from"./chunk-ewng6v6g.js";import"./chunk-929zbzh7.js";import"./chunk-8gewq710.js";import"./chunk-wh838rdh.js";import"./chunk-2yg9y1na.js";import"./chunk-35zjpdcb.js";import"./chunk-2h8ea0we.js";import"./chunk-4e0z858k.js";import"./chunk-ce6zddpf.js";import"./chunk-4qwvqbzf.js";export{up as clearOnceStore,sa as onceStore,We as partialsCache,Dr as processIncludes,Mr as processStackPushDirectives,Lr as processStackReplacements,lp as resetUnscopedSignalWarnings,Sl as topLevelElements};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fo,vs,l,d,E,et,u,ws,t,a,w}from"./chunk-4e0z858k.js";import{he,Et,It,K,k}from"./chunk-2dm6ey5w.js";import{ee}from"./chunk-8gewq710.js";import{Ur}from"./chunk-wh838rdh.js";var ae=1000,ue=!1;function fe(n,r){let o=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",s=0,i;while((i=o.exec(n))!==null){let p=i.index+i[0].length,y=i.index+i[0].indexOf("("),m=w(n,"(",")",y);if(m===-1)continue;let c=n.slice(p,m).trim();if(!c)continue;if(!Object.keys(r).some((b)=>new RegExp(`(?:^|[^\\w$.])${b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let g;try{let b=E(c,r);if(!b||typeof b!=="object")continue;g=JSON.stringify(b)}catch{continue}e+=n.slice(s,p)+g,s=m,o.lastIndex=m}return s===0?n:e+n.slice(s)}function ge(n,r){let o=/@component\s*\(/g,e=n,s,i=[];while((s=o.exec(e))!==null){let p=s.index,y=p+s[0].length-1,m=1,c=y+1;while(c<e.length&&m>0){if(e[c]==="(")m++;else if(e[c]===")"){if(m--,m===0)break}c++}if(m!==0)continue;let f=e.substring(y+1,c),g=c+1,b=f.match(/^\s*['"]([^'"]+)['"]/);if(!b)continue;let x=b[1],h=f.slice(b[0].length),_=h.match(/^\s*,\s*/);if(!_)continue;let S=h.slice(_[0].length).trim();if(!S)continue;try{let P=E(S,r),F=JSON.stringify(P),R=`@component('${x}', ${F})`;i.push({start:p,end:g,replacement:R})}catch{continue}}for(let p=i.length-1;p>=0;p--){let{start:y,end:m,replacement:c}=i[p];e=e.substring(0,y)+c+e.substring(m)}return e}function te(n,r,o){let e=n,s=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=s.exec(e))!==null){let p=i.index,y=p+i[0].length-1,m=1,c=y+1,f=null,g=!1;while(c<e.length&&m>0){let h=e[c];if(g){g=!1,c++;continue}if(h==="\\"&&f){g=!0,c++;continue}if(f){if(h===f)f=null;c++;continue}if(h==='"'||h==="'"||h==="`"){f=h,c++;continue}if(h==="(")m++;else if(h===")"){if(m--,m===0)break}c++}if(m!==0)break;let b=e.substring(y+1,c),x=o(b);e=e.substring(0,p)+x+e.substring(c+1)}return e}function pe(n,r){let o=n;return o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,s)=>{if(s in r)return`:${s}="${s}"`;return e}),o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,s,i)=>{try{let p=Object.keys(r),y=Object.values(r);Fo(i);let c=u(i,p)(...y),f=JSON.stringify(c);if(f===void 0){if(!et(i).some((x)=>!(x in r)))return"";return e}let g=Buffer.from(f,"utf8").toString("base64");return`__stx_${s}="${g}"`}catch(p){return e}}),o}var Y="<!--__STX_BREAK__-->",G="<!--__STX_CONTINUE__-->";function se(n,r){let o=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",s=0;for(let i=o.exec(n);i;i=o.exec(n)){if(!i[1]){let c=i[0].length===3&&i[0]==="{{{"?3:2,f=i[0]==="{!!"?n.indexOf("!!}",o.lastIndex):he(n,i.index,c);if(f<0)break;o.lastIndex=f+(i[0]==="{!!"?3:c);continue}let p=o.lastIndex,y=!0,m=/^\s*\(/.exec(n.slice(p));if(m){let c=p+m[0].length-1,f=w(n,"(",")",c);if(f<0)break;p=f+1;try{let g=`!!(${n.slice(c+1,f).trim()})`;y=d(g)?Boolean(u(g,Object.keys(r))(...Object.values(r))):Boolean(l(g,r))}catch{y=!1}}if(e+=n.slice(s,i.index),y)return e+(i[1]==="break"?Y:G);s=p,o.lastIndex=p}return e+n.slice(s)}function oe(n){let r=(s)=>s.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),o="",e=0;return It(n,(s,i,p)=>(o+=ne(r(n.slice(e,p))),o+=`\${__stxRenderLoopValue(${p}, (${i}), ${s.length})}`,e=p+s.length,s)),o+ne(r(n.slice(e)))}function ie(n,r,o,e){return K(n,r,o==null?"":String(o),!1,e)}function ne(n){let r=n;return r=te(r,"@break",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { break; } result += \``}),r=te(r,"@continue",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function de(n){let r=/@forelse\s*\(/g,o,e=[],s=/@foreach\s*\(/g,i=/@endforeach/g,p;while((p=s.exec(n))!==null)e.push({pos:p.index,delta:1});while((p=i.exec(n))!==null)e.push({pos:p.index,delta:-1});e.sort((f,g)=>f.pos-g.pos);let y=[],m=0;for(let f of e)m+=f.delta,y.push({pos:f.pos,depth:m});function c(f){let g=0,b=y.length-1,x=0;while(g<=b){let h=g+b>>1;if(y[h].pos<=f)x=y[h].depth,g=h+1;else b=h-1}return x}while((o=r.exec(n))!==null){if(c(o.index)>0)continue;let f=o.index,g=o.index+o[0].length-1,b=1,x=g+1,h=-1;while(x<n.length&&b>0){if(n[x]==="(")b++;else if(n[x]===")"){if(b--,b===0){h=x;break}}x++}if(h===-1)continue;let _=n.substring(g+1,h),S=Et(_);if(!S)continue;let{arrayExpr:P,itemVar:F}=S,R=h+1,N=1,U=R,v=/@forelse\s*\(/g,V=/@endforelse/g,I=-1;while(N>0&&U<n.length){v.lastIndex=U,V.lastIndex=U;let A=v.exec(n),T=V.exec(n);if(!T)break;if(A&&A.index<T.index)N++,U=A.index+A[0].length;else{if(N--,N===0){I=T.index;break}U=T.index+11}}if(I===-1)continue;let j=n.substring(R,I),z=I+11,M=-1,W=0,O=0;while(O<j.length){let A=j.indexOf("@",O);if(A===-1)break;let T=j.substring(A);if(/^@forelse\s*\(/.test(T))W++,O=A+1;else if(T.startsWith("@endforelse"))W--,O=A+11;else if(W===0&&T.startsWith("@empty")){if(j.length<=A+6||!/[a-z]/i.test(j[A+6])){M=A;break}O=A+1}else O=A+1}if(M===-1)continue;return{start:f,end:z,arrayExpr:P,itemVar:F,foreachContent:j.substring(0,M),emptyContent:j.substring(M+6)}}return null}function re(n,r){let o=n;while(!0){let e=de(o);if(!e)break;let{start:s,end:i,arrayExpr:p,itemVar:y,foreachContent:m,emptyContent:c}=e;try{let f;if(d(p))f=u(p,Object.keys(r))(...Object.values(r));else f=l(p,r);let g;if(!Array.isArray(f)||f.length===0)g=c;else g=`@foreach (${p} as ${y})${m}@endforeach`;o=o.substring(0,s)+g+o.substring(i)}catch(f){let g=f instanceof Error?f.message:String(f),b=a("Forelse",`Error in @forelse(${p} as ${y}): ${g}`,t.EVALUATION_ERROR);o=o.substring(0,s)+b+o.substring(i)}}return o}var ce="<!--stx:foreach-not-iterable:",me=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function be(n,r){return`${ce}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function xe(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Nr(n){if(!n.includes(ce))return n;return n.replace(me,(r,o,e)=>(xe(decodeURIComponent(o),decodeURIComponent(e)),""))}function qn(n,r,o,e,s=!1){let i=n;i=re(i,r);function p(c){let f=/@foreach\s*\(/g,g;while((g=f.exec(c))!==null){let b=g.index,x=g.index+g[0].length-1,h=1,_=x+1,S=-1;while(_<c.length&&h>0){if(c[_]==="(")h++;else if(c[_]===")"){if(h--,h===0){S=_;break}}_++}if(S===-1)continue;let P=c.substring(x+1,S),F=Et(P);if(!F)continue;let R=b,{arrayExpr:N,itemVar:U}=F,v=S+1,V=1,I=v,j=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){j.lastIndex=I,z.lastIndex=I;let M=j.exec(c),W=z.exec(c);if(!W)break;if(M&&M.index<W.index)V++,I=M.index+M[0].length;else{if(V--,V===0){let O=c.substring(v,W.index),A=W.index+11;return{start:R,end:A,arrayExpr:N,itemVar:U,content:O}}I=W.index+11}}}return null}function y(c,f){let g=c;while(!0){let b=p(g);if(!b)break;let{start:x,end:h,arrayExpr:_,itemVar:S,content:P}=b;try{let F=_.trim(),R;if(d(F))R=u(F,Object.keys(f))(...Object.values(f));else R=l(F,f);let N=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),N=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),N=!0;else{let O=be(F,o)+a("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);g=g.substring(0,x)+O+g.substring(h);continue}let U=e?.loops?.useAltLoopVariable??ue,v=S.trim(),V=null,I,j=!1;if(v.includes("=>")){let O=v.split("=>").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])V=O[0],I=O[1];else I=v}else if(!v.startsWith("[")&&!v.startsWith("{")&&v.includes(",")){let O=v.split(",").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])I=O[0],V=O[1],j=!0;else I=v}else I=v;let z="",M=R,W=f[vs]??new WeakMap;for(let O=0;O<M.length;O++){let A=M[O],T={index:O,iteration:O+1,first:O===0,last:O===M.length-1,count:M.length},L={...f,loop:T,$loop:T,[vs]:W};if(I.startsWith("[")&&I.endsWith("]")){let J=I.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(A))J.forEach((B,D)=>{if(B)L[B]=A[D]});else L[I]=A}else if(I.startsWith("{")&&I.endsWith("}")){let J=I.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(A!==null&&typeof A==="object")J.forEach((B)=>{let D=B.indexOf(":"),q=(D===-1?B:B.slice(0,D)).trim(),Q=D===-1?q:B.slice(D+1).trim();if(q&&Q)L[Q]=A[q]});else L[I]=A}else L[I]=A;if(V)if(!j&&N&&Array.isArray(A)&&A.length===2)L[V]=A[0],L[I]=A[1];else L[V]=O;let C=re(P,L);C=qn(C,L,o,e,!0),C=ee(C,L,o),C=se(C,L);let Z=C.indexOf(Y),H=C.indexOf(G),X=Z<0?H:H<0?Z:Math.min(Z,H);if(X>=0)C=C.slice(0,X);if(C=k(C,L,o),C=pe(C,L),C=ge(C,L),C=fe(C,L),z+=C,X>=0&&X===Z)break}g=g.substring(0,x)+z+g.substring(h)}catch(F){let R=a("Foreach",`Error in @foreach(${_.trim()} as ${S.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);g=g.substring(0,x)+R+g.substring(h)}}return g}i=y(i,r),i=ye(i,r,o,e);let m=e?.loops?.maxWhileIterations??ae;return i=Re(i,r,m),s?i:Nr(i)}function xl(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function le(n){return ws(n)}function ye(n,r,o,e){let s=n,i=!0;while(i){i=!1;let p=s.match(/@for\s*\(/);if(!p||p.index===void 0)break;let y=p.index,m=y+p[0].length-1,c=w(s,"(",")",m);if(c===-1)break;let f=xl(s.slice(m+1,c)),g=c+1,b=Ur(s.slice(y),"for","endfor");if(b.length===0)break;let x=b[0].content,h=y+b[0].end;if(!le(f)){let _=a("For",`Unsafe expression in @for: ${f}`,t.UNSAFE_EXPRESSION);s=s.substring(0,y)+_+s.substring(h),i=!0;continue}try{let _=Ee(f),S=/@(?:for|foreach|if|unless)\s*\(/.test(x);if(_.length>0&&S){let v=$e({forExpr:f,content:x,iterVarNames:_,context:r,filePath:o,options:e});s=s.substring(0,y)+v+s.substring(h),i=!0;continue}let P=Object.keys(r),F=Object.values(r),R=oe(x),U=Function(...P,"__stxRenderLoopValue",`
2
+ import{Fo,vs,l,d,E,et,u,ws,t,a,w}from"./chunk-4e0z858k.js";import{he,Et,It,K,k}from"./chunk-2yg9y1na.js";import{ee}from"./chunk-8gewq710.js";import{Ur}from"./chunk-wh838rdh.js";var ae=1000,ue=!1;function fe(n,r){let o=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",s=0,i;while((i=o.exec(n))!==null){let p=i.index+i[0].length,y=i.index+i[0].indexOf("("),m=w(n,"(",")",y);if(m===-1)continue;let c=n.slice(p,m).trim();if(!c)continue;if(!Object.keys(r).some((b)=>new RegExp(`(?:^|[^\\w$.])${b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let g;try{let b=E(c,r);if(!b||typeof b!=="object")continue;g=JSON.stringify(b)}catch{continue}e+=n.slice(s,p)+g,s=m,o.lastIndex=m}return s===0?n:e+n.slice(s)}function ge(n,r){let o=/@component\s*\(/g,e=n,s,i=[];while((s=o.exec(e))!==null){let p=s.index,y=p+s[0].length-1,m=1,c=y+1;while(c<e.length&&m>0){if(e[c]==="(")m++;else if(e[c]===")"){if(m--,m===0)break}c++}if(m!==0)continue;let f=e.substring(y+1,c),g=c+1,b=f.match(/^\s*['"]([^'"]+)['"]/);if(!b)continue;let x=b[1],h=f.slice(b[0].length),_=h.match(/^\s*,\s*/);if(!_)continue;let S=h.slice(_[0].length).trim();if(!S)continue;try{let P=E(S,r),F=JSON.stringify(P),R=`@component('${x}', ${F})`;i.push({start:p,end:g,replacement:R})}catch{continue}}for(let p=i.length-1;p>=0;p--){let{start:y,end:m,replacement:c}=i[p];e=e.substring(0,y)+c+e.substring(m)}return e}function te(n,r,o){let e=n,s=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=s.exec(e))!==null){let p=i.index,y=p+i[0].length-1,m=1,c=y+1,f=null,g=!1;while(c<e.length&&m>0){let h=e[c];if(g){g=!1,c++;continue}if(h==="\\"&&f){g=!0,c++;continue}if(f){if(h===f)f=null;c++;continue}if(h==='"'||h==="'"||h==="`"){f=h,c++;continue}if(h==="(")m++;else if(h===")"){if(m--,m===0)break}c++}if(m!==0)break;let b=e.substring(y+1,c),x=o(b);e=e.substring(0,p)+x+e.substring(c+1)}return e}function pe(n,r){let o=n;return o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,s)=>{if(s in r)return`:${s}="${s}"`;return e}),o=o.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,s,i)=>{try{let p=Object.keys(r),y=Object.values(r);Fo(i);let c=u(i,p)(...y),f=JSON.stringify(c);if(f===void 0){if(!et(i).some((x)=>!(x in r)))return"";return e}let g=Buffer.from(f,"utf8").toString("base64");return`__stx_${s}="${g}"`}catch(p){return e}}),o}var Y="<!--__STX_BREAK__-->",G="<!--__STX_CONTINUE__-->";function se(n,r){let o=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",s=0;for(let i=o.exec(n);i;i=o.exec(n)){if(!i[1]){let c=i[0].length===3&&i[0]==="{{{"?3:2,f=i[0]==="{!!"?n.indexOf("!!}",o.lastIndex):he(n,i.index,c);if(f<0)break;o.lastIndex=f+(i[0]==="{!!"?3:c);continue}let p=o.lastIndex,y=!0,m=/^\s*\(/.exec(n.slice(p));if(m){let c=p+m[0].length-1,f=w(n,"(",")",c);if(f<0)break;p=f+1;try{let g=`!!(${n.slice(c+1,f).trim()})`;y=d(g)?Boolean(u(g,Object.keys(r))(...Object.values(r))):Boolean(l(g,r))}catch{y=!1}}if(e+=n.slice(s,i.index),y)return e+(i[1]==="break"?Y:G);s=p,o.lastIndex=p}return e+n.slice(s)}function oe(n){let r=(s)=>s.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),o="",e=0;return It(n,(s,i,p)=>(o+=ne(r(n.slice(e,p))),o+=`\${__stxRenderLoopValue(${p}, (${i}), ${s.length})}`,e=p+s.length,s)),o+ne(r(n.slice(e)))}function ie(n,r,o,e){return K(n,r,o==null?"":String(o),!1,e)}function ne(n){let r=n;return r=te(r,"@break",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { break; } result += \``}),r=te(r,"@continue",(o)=>{let e=o.trim();if(!ws(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function de(n){let r=/@forelse\s*\(/g,o,e=[],s=/@foreach\s*\(/g,i=/@endforeach/g,p;while((p=s.exec(n))!==null)e.push({pos:p.index,delta:1});while((p=i.exec(n))!==null)e.push({pos:p.index,delta:-1});e.sort((f,g)=>f.pos-g.pos);let y=[],m=0;for(let f of e)m+=f.delta,y.push({pos:f.pos,depth:m});function c(f){let g=0,b=y.length-1,x=0;while(g<=b){let h=g+b>>1;if(y[h].pos<=f)x=y[h].depth,g=h+1;else b=h-1}return x}while((o=r.exec(n))!==null){if(c(o.index)>0)continue;let f=o.index,g=o.index+o[0].length-1,b=1,x=g+1,h=-1;while(x<n.length&&b>0){if(n[x]==="(")b++;else if(n[x]===")"){if(b--,b===0){h=x;break}}x++}if(h===-1)continue;let _=n.substring(g+1,h),S=Et(_);if(!S)continue;let{arrayExpr:P,itemVar:F}=S,R=h+1,N=1,U=R,v=/@forelse\s*\(/g,V=/@endforelse/g,I=-1;while(N>0&&U<n.length){v.lastIndex=U,V.lastIndex=U;let A=v.exec(n),T=V.exec(n);if(!T)break;if(A&&A.index<T.index)N++,U=A.index+A[0].length;else{if(N--,N===0){I=T.index;break}U=T.index+11}}if(I===-1)continue;let j=n.substring(R,I),z=I+11,M=-1,W=0,O=0;while(O<j.length){let A=j.indexOf("@",O);if(A===-1)break;let T=j.substring(A);if(/^@forelse\s*\(/.test(T))W++,O=A+1;else if(T.startsWith("@endforelse"))W--,O=A+11;else if(W===0&&T.startsWith("@empty")){if(j.length<=A+6||!/[a-z]/i.test(j[A+6])){M=A;break}O=A+1}else O=A+1}if(M===-1)continue;return{start:f,end:z,arrayExpr:P,itemVar:F,foreachContent:j.substring(0,M),emptyContent:j.substring(M+6)}}return null}function re(n,r){let o=n;while(!0){let e=de(o);if(!e)break;let{start:s,end:i,arrayExpr:p,itemVar:y,foreachContent:m,emptyContent:c}=e;try{let f;if(d(p))f=u(p,Object.keys(r))(...Object.values(r));else f=l(p,r);let g;if(!Array.isArray(f)||f.length===0)g=c;else g=`@foreach (${p} as ${y})${m}@endforeach`;o=o.substring(0,s)+g+o.substring(i)}catch(f){let g=f instanceof Error?f.message:String(f),b=a("Forelse",`Error in @forelse(${p} as ${y}): ${g}`,t.EVALUATION_ERROR);o=o.substring(0,s)+b+o.substring(i)}}return o}var ce="<!--stx:foreach-not-iterable:",me=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function be(n,r){return`${ce}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function xe(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Nr(n){if(!n.includes(ce))return n;return n.replace(me,(r,o,e)=>(xe(decodeURIComponent(o),decodeURIComponent(e)),""))}function qn(n,r,o,e,s=!1){let i=n;i=re(i,r);function p(c){let f=/@foreach\s*\(/g,g;while((g=f.exec(c))!==null){let b=g.index,x=g.index+g[0].length-1,h=1,_=x+1,S=-1;while(_<c.length&&h>0){if(c[_]==="(")h++;else if(c[_]===")"){if(h--,h===0){S=_;break}}_++}if(S===-1)continue;let P=c.substring(x+1,S),F=Et(P);if(!F)continue;let R=b,{arrayExpr:N,itemVar:U}=F,v=S+1,V=1,I=v,j=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){j.lastIndex=I,z.lastIndex=I;let M=j.exec(c),W=z.exec(c);if(!W)break;if(M&&M.index<W.index)V++,I=M.index+M[0].length;else{if(V--,V===0){let O=c.substring(v,W.index),A=W.index+11;return{start:R,end:A,arrayExpr:N,itemVar:U,content:O}}I=W.index+11}}}return null}function y(c,f){let g=c;while(!0){let b=p(g);if(!b)break;let{start:x,end:h,arrayExpr:_,itemVar:S,content:P}=b;try{let F=_.trim(),R;if(d(F))R=u(F,Object.keys(f))(...Object.values(f));else R=l(F,f);let N=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),N=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),N=!0;else{let O=be(F,o)+a("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);g=g.substring(0,x)+O+g.substring(h);continue}let U=e?.loops?.useAltLoopVariable??ue,v=S.trim(),V=null,I,j=!1;if(v.includes("=>")){let O=v.split("=>").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])V=O[0],I=O[1];else I=v}else if(!v.startsWith("[")&&!v.startsWith("{")&&v.includes(",")){let O=v.split(",").map((A)=>A.trim());if(O.length===2&&O[0]&&O[1])I=O[0],V=O[1],j=!0;else I=v}else I=v;let z="",M=R,W=f[vs]??new WeakMap;for(let O=0;O<M.length;O++){let A=M[O],T={index:O,iteration:O+1,first:O===0,last:O===M.length-1,count:M.length},L={...f,loop:T,$loop:T,[vs]:W};if(I.startsWith("[")&&I.endsWith("]")){let J=I.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(A))J.forEach((B,D)=>{if(B)L[B]=A[D]});else L[I]=A}else if(I.startsWith("{")&&I.endsWith("}")){let J=I.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(A!==null&&typeof A==="object")J.forEach((B)=>{let D=B.indexOf(":"),q=(D===-1?B:B.slice(0,D)).trim(),Q=D===-1?q:B.slice(D+1).trim();if(q&&Q)L[Q]=A[q]});else L[I]=A}else L[I]=A;if(V)if(!j&&N&&Array.isArray(A)&&A.length===2)L[V]=A[0],L[I]=A[1];else L[V]=O;let C=re(P,L);C=qn(C,L,o,e,!0),C=ee(C,L,o),C=se(C,L);let Z=C.indexOf(Y),H=C.indexOf(G),X=Z<0?H:H<0?Z:Math.min(Z,H);if(X>=0)C=C.slice(0,X);if(C=k(C,L,o),C=pe(C,L),C=ge(C,L),C=fe(C,L),z+=C,X>=0&&X===Z)break}g=g.substring(0,x)+z+g.substring(h)}catch(F){let R=a("Foreach",`Error in @foreach(${_.trim()} as ${S.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);g=g.substring(0,x)+R+g.substring(h)}}return g}i=y(i,r),i=ye(i,r,o,e);let m=e?.loops?.maxWhileIterations??ae;return i=Re(i,r,m),s?i:Nr(i)}function xl(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function le(n){return ws(n)}function ye(n,r,o,e){let s=n,i=!0;while(i){i=!1;let p=s.match(/@for\s*\(/);if(!p||p.index===void 0)break;let y=p.index,m=y+p[0].length-1,c=w(s,"(",")",m);if(c===-1)break;let f=xl(s.slice(m+1,c)),g=c+1,b=Ur(s.slice(y),"for","endfor");if(b.length===0)break;let x=b[0].content,h=y+b[0].end;if(!le(f)){let _=a("For",`Unsafe expression in @for: ${f}`,t.UNSAFE_EXPRESSION);s=s.substring(0,y)+_+s.substring(h),i=!0;continue}try{let _=Ee(f),S=/@(?:for|foreach|if|unless)\s*\(/.test(x);if(_.length>0&&S){let v=$e({forExpr:f,content:x,iterVarNames:_,context:r,filePath:o,options:e});s=s.substring(0,y)+v+s.substring(h),i=!0;continue}let P=Object.keys(r),F=Object.values(r),R=oe(x),U=Function(...P,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${f}) {
5
5
  result += \`${R}\`;